@hyperjump/json-schema-core
Advanced tools
Comparing version 0.22.3 to 0.23.0
@@ -1,2 +0,2 @@ | ||
define(["exports"],(function(e){"use strict";var t=function(e,t){return function r(){null==t&&(t=e.length);var n=[].slice.call(arguments);return n.length>=t?e.apply(this,n):function(){return r.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:{};var n,o=(function(e,t){var n,o;n="object"==typeof window&&window||r,o={},n.PubSub=o,function(e){var t={},r=-1,n="*";function o(e){var t;for(t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function a(e){return function(){throw e}}function i(e,t,r){try{e(t,r)}catch(e){setTimeout(a(e),0)}}function s(e,t,r){e(t,r)}function c(e,r,n,o){var a,c=t[r],l=o?s:i;if(Object.prototype.hasOwnProperty.call(t,r))for(a in c)Object.prototype.hasOwnProperty.call(c,a)&&l(c[a],e,n)}function l(e,t,r){return function(){var o=String(e),a=o.lastIndexOf(".");for(c(e,e,t,r);-1!==a;)a=(o=o.substr(0,a)).lastIndexOf("."),c(e,o,t,r);c(e,n,t,r)}}function u(e){var r=String(e);return Boolean(Object.prototype.hasOwnProperty.call(t,r)&&o(t[r]))}function f(e){for(var t=String(e),r=u(t)||u(n),o=t.lastIndexOf(".");!r&&-1!==o;)o=(t=t.substr(0,o)).lastIndexOf("."),r=u(t);return r}function p(e,t,r,n){var o=l(e="symbol"==typeof e?e.toString():e,t,n);return!!f(e)&&(!0===r?o():setTimeout(o,0),!0)}e.publish=function(t,r){return p(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return p(t,r,!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(t,e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeAll=function(t){return e.subscribe(n,t)},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n,o=0;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)){for(n in t[r])o++;break}return o},e.getSubscriptions=function(e){var r,n=[];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,a,i=function(e){var r;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e))return!0;return!1},s="string"==typeof r&&(Object.prototype.hasOwnProperty.call(t,r)||i(r)),c=!s&&"string"==typeof r,l="function"==typeof r,u=!1;if(!s){for(n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(o=t[n],c&&o[r]){delete o[r],u=r;break}if(l)for(a in o)Object.prototype.hasOwnProperty.call(o,a)&&o[a]===r&&(delete o[a],u=!0)}return u}e.clearSubscriptions(r)}}(o),void 0!==e&&e.exports&&(t=e.exports=o),t.PubSub=o,e.exports=t=o}(n={exports:{}},n.exports),n.exports);o.PubSub;var a=function(e,t){if(e=e.trim(),(t=t.trim()).startsWith("about:"))return t;const r=function(e){const t={host:"",path:"",query:"",protocol:""};let r=e,n=e.indexOf("//");t.protocol=r.substring(0,n),n+=2;const o=e.indexOf("/",n),a=e.indexOf("?"),i=e.indexOf("#");-1!==i&&(r=r.substring(0,i));if(-1!==a){const e=r.substring(a);t.query=e,r=r.substring(0,a)}if(-1!==o){const e=r.substring(0,o);t.host=e,r=r.substring(o),t.path=r}else t.host=r;return t}(e),n=function(e){const t={href:e,hash:"",query:"",netPath:!1,absolutePath:!1,relativePath:!1};if(c.test(e))return t.netPath=!0,t;"/"===e[0]?t.absolutePath=!0:""!==e&&(t.relativePath=!0);let r=e;const n=e.indexOf("?"),o=e.indexOf("#");if(-1!==o){const e=r.substring(o);t.hash=e,r=r.substring(0,o)}if(-1!==n){const e=r.substring(n);t.query=e,r=r.substring(0,n)}return t.path=r,t}(t);if(!r.protocol&&!n.netPath)throw new Error("Error, protocol is not specified");if(n.netPath)return n.href.startsWith("//")&&(n.href=r.protocol+n.href),function(e){const t=e.indexOf("//")+2,r=!e.includes("/",t),n=!e.includes("?",t),o=!e.includes("#",t);return r&&n&&o}(n.href)?i(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+s(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let a,i=r.path,c=r.host;return 0===e.length?a=i:(i=i.substring(0,i.lastIndexOf("/")),a=s(i+"/"+e)),c+=""!==a||t||o?a+t+o:"/",c}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:i(e)}};function i(e){return e+("/"===e[e.length-1]?"":"/")}function s(e){let t=e.split("/");""===t[0]&&(t=t.slice(1));let r=[];return t.forEach(((e,n)=>{"."!==e&&(".."===e?r.pop():""===e&&n!==t.length-1||r.push(e))})),"/"+r.join("/")}const c=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");const l={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},u=e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),o=e.slice(r+1);return[decodeURI(n),decodeURI(o)]},f=e=>{const t=RegExp(/^(.+):\/\//).exec(e);return t?t[1]:""};var p={jsonTypeOf:(e,t)=>l[t](e),splitUrl:u,safeResolveUrl:(e,t)=>{const r=a(e,t),n=u(e)[0];if(n&&"file"===f(r)&&"file"!==f(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r}};const d=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(g)},h=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:h(e,E(t,o,n),r,m(o,n))}}if(Array.isArray(t)){const n=[...t];return n[O(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:E(t,e[0],n)},y=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||j(t)){const o=e.shift();y(e,E(t,o,n),r,m(o,n))}else{t[O(t,e[0])]=r}},v=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=E(t,n,r);return{...t,[n]:v(e,o,m(n,r))}}if(Array.isArray(t))return t.filter(((t,r)=>r!=e[0]));if("object"==typeof t&&null!==t){const{[e[0]]:r,...n}=t;return n}return E(t,e[0],r)}},b=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=E(t,n,r);b(e,o,m(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:E(t,e[0],r)},m=t(((e,t)=>t+"/"+w(e))),w=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),g=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),O=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,E=(e,t,r="")=>{if(void 0===e)throw TypeError(`Value at '${r}' is undefined and does not have property '${t}'`);if(null===e)throw TypeError(`Value at '${r}' is null and does not have property '${t}'`);if(j(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[O(e,t)]},j=e=>null===e||"object"!=typeof e;var $={nil:"",append:m,get:(e,t)=>{const r=d(e),n=e=>r.reduce((([e,t],r)=>[E(e,r,t),m(r,t)]),[e,""])[0];return void 0===t?n:n(t)},set:(e,r,n)=>{const o=d(e),a=t(((e,t)=>h(o,e,t,"")));return void 0===r?a:a(r,n)},assign:(e,r,n)=>{const o=d(e),a=t(((e,t)=>y(o,e,t,"")));return void 0===r?a:a(r,n)},unset:(e,t)=>{const r=d(e),n=e=>v(r,e,"");return void 0===t?n:n(t)},remove:(e,t)=>{const r=d(e),n=e=>b(r,e,"");return void 0===t?n:n(t)}};$.nil,$.append,$.get,$.set,$.assign,$.unset,$.remove;const S=Symbol("$__value"),P=Symbol("$__href");var x={cons:(e,t)=>Object.freeze({[P]:e,[S]:t}),isReference:e=>e&&void 0!==e[P],href:e=>e[P],value:e=>e[S]};const{jsonTypeOf:A}=p,I=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),T=e=>x.isReference(e.value)?x.value(e.value):e.value,k=t(((e,t)=>A(T(e),t))),V=(e,t)=>Object.freeze({...t,pointer:$.append(e,t.pointer),value:T(t)[e]}),R=t(((e,t)=>T(t).map(((r,n,o,a)=>e(V(n,t),n,o,a))))),U=t(((e,t)=>T(t).map(((e,r,n,o)=>V(r,t))).filter(((t,r,n,o)=>e(t,r,n,o))))),C=t(((e,t,r)=>T(r).reduce(((t,n,o)=>e(t,V(o,r),o)),t))),z=t(((e,t)=>T(t).every(((r,n,o,a)=>e(V(n,t),n,o,a))))),K=t(((e,t)=>T(t).some(((r,n,o,a)=>e(V(n,t),n,o,a)))));var L={nil:I,cons:(e,t="")=>Object.freeze({...I,id:t,instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:T,has:(e,t)=>e in T(t),typeOf:k,step:V,entries:e=>Object.keys(T(e)).map((t=>[t,V(t,e)])),keys:e=>Object.keys(T(e)),map:R,filter:U,reduce:C,every:z,some:K,length:e=>T(e).length},q=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,_=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,D=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,N=/\\([\u000b\u0020-\u00ff])/g,B=/([\\"])/g,F=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function Z(e){var t=String(e);if(D.test(t))return t;if(t.length>0&&!_.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(B,"\\$1")+'"'}function M(e){this.parameters=Object.create(null),this.type=e}var W={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!F.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,a=Object.keys(t).sort(),i=0;i<a.length;i++){if(o=a[i],!D.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+Z(t[o])}return n},parse:function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;"function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.substr(0,r).trim():t.trim();if(!F.test(n))throw new TypeError("invalid media type");var o=new M(n.toLowerCase());if(-1!==r){var a,i,s;for(q.lastIndex=r;i=q.exec(t);){if(i.index!==r)throw new TypeError("invalid parameter format");r+=i[0].length,a=i[1].toLowerCase(),'"'===(s=i[2])[0]&&(s=s.substr(1,s.length-2).replace(N,"$1")),o.parameters[a]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},J=async e=>Object.entries(await e),G=t((async(e,t)=>(await t).map(e))),H=t((async(e,t,r)=>(await r).reduce((async(t,r)=>e(await t,r)),t))),Q=t((async(e,t,r={})=>H((async(t,r)=>await e(r)?t.concat([r]):t),[],t,r))),X=t((async(e,t)=>{const r=await G(e,t);return(await Promise.all(r)).some((e=>e))})),Y=t((async(e,t)=>{const r=await G(e,t);return(await Promise.all(r)).every((e=>e))})),ee=t(((e,t)=>e.reduce((async(e,t)=>t(await e)),t))),te={entries:J,map:G,filter:Q,reduce:H,some:X,every:Y,pipeline:ee,all:e=>Promise.all(e),allValues:e=>ee([J,H((async(e,[t,r])=>(e[t]=await r,e)),{})],e)};te.entries,te.map,te.filter,te.reduce,te.some,te.every,te.pipeline,te.all,te.allValues;var re=fetch;const{jsonTypeOf:ne,splitUrl:oe,safeResolveUrl:ae}=p,ie={},se={},ce=(e,t)=>{const r=e in se?se[e]:e;if(r in ie)return ie[r][t]},le={},ue={},fe=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=oe(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=ce(n,"baseToken"),a=ce(n,"anchorToken"),i=oe(t)[0];if(!i&&!oe(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const s=ae(i,e[o]||""),[c,l]=oe(s);delete e[o],l&&o===a&&(e[a]=a!==o?encodeURI(l):`#${encodeURI(l)}`),i&&(ue[i]=c);const u={},f=ce(n,"recursiveAnchorToken");let p;!0===e[f]&&(u[""]=`${c}#`,e[a]="",delete e[f]);const d=ce(n,"vocabularyToken");ne(e[d],"object")?(se[c]=n,p=e[d],delete e[d]):(se[c]=n,p={[n]:!0});const h={"":""};return le[c]={id:c,schemaVersion:n,schema:pe(e,c,n,$.nil,h,u),anchors:h,dynamicAnchors:u,vocabulary:p,validated:!1},c},pe=(e,t,r,n,o,a)=>{if(ne(e,"object")){const i="string"==typeof e.$schema?oe(e.$schema)[0]:r,s=ce(i,"embeddedToken"),c=ce(i,"anchorToken");if("string"==typeof e[s]&&(s!==c||"#"!==e[s][0])){const n=ae(t,e[s]);return e[s]=n,fe(e,n,r),x.cons(e[s],e)}const l=ce(r,"anchorToken"),u=ce(r,"dynamicAnchorToken");"string"==typeof e[u]&&(a[e[u]]=`${t}#${encodeURI(n)}`,o[e[u]]=n,delete e[u]);const f=ce(r,"embeddedToken");if("string"==typeof e[l]){const t=l!==f?e[l]:e[l].slice(1);o[t]=n,delete e[l]}const p=ce(r,"jrefToken");if("string"==typeof e[p])return x.cons(e[p],e);for(const i in e)e[i]=pe(e[i],t,r,$.append(i,n),o,a);return e}return Array.isArray(e)?e.map(((e,i)=>pe(e,t,r,$.append(i,n),o,a))):e},de=e=>le[ue[e]]||le[e],he=Object.freeze({id:"",schemaVersion:void 0,vocabulary:{},pointer:$.nil,schema:void 0,value:void 0,anchors:{},dynamicAnchors:{},validated:!0}),ye=async(e,t=he)=>{const r=ae(me(t),e),[n,o]=oe(r);if(!(e=>e in le||e in ue)(n)){const e=await re(n,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error(`Failed to retrieve schema with id: ${n}`);if(e.headers.has("content-type")){const t=W.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${n} is not a schema. Found a document with media type: ${t}`)}fe(await e.json(),n)}const a=de(n),i="/"!==o[0]?be(a,o):o,s=Object.freeze({...a,pointer:i,value:$.get(i,a.schema)});return ve(s)},ve=e=>x.isReference(e.value)?ye(x.href(e.value),e):e,be=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},me=e=>`${e.id}#${encodeURI(e.pointer)}`,we=e=>x.isReference(e.value)?x.value(e.value):e.value,ge=(e,t)=>{const r=de(t.id),n=Object.freeze({...t,pointer:$.append(e,t.pointer),value:we(t)[e],validated:r.validated});return ve(n)},Oe=t(((e,t)=>te.pipeline([we,te.map((async(r,n)=>e(await ge(n,t),n))),te.all],t)));var Ee={setConfig:(e,t,r)=>{ie[e]||(ie[e]={}),ie[e][t]=r},getConfig:ce,add:fe,get:ye,markValidated:e=>{le[e].validated=!0},uri:me,value:we,getAnchorPointer:be,typeOf:(e,t)=>ne(we(e),t),has:(e,t)=>e in we(t),step:ge,keys:e=>Object.keys(we(e)),entries:e=>te.pipeline([we,Object.keys,te.map((async t=>[t,await ge(t,e)])),te.all],e),map:Oe,length:e=>we(e).length};Ee.setConfig,Ee.getConfig,Ee.add,Ee.get,Ee.markValidated,Ee.uri,Ee.value,Ee.getAnchorPointer,Ee.typeOf,Ee.has,Ee.step,Ee.keys,Ee.entries,Ee.map,Ee.length;class je extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var $e=je;const{splitUrl:Se}=p,Pe="FLAG",xe="BASIC",Ae="DETAILED",Ie="VERBOSE";let Te=Ae,ke=!0;const Ve=async e=>{const t={metaData:{}};return{ast:t,schemaUri:await _e(e,t)}},Re=t((({ast:e,schemaUri:t},r,n=Pe)=>{if(![Pe,xe,Ae,Ie].includes(n))throw Error(`The '${n}' error format is not supported`);const a=[],i=o.subscribe("result",Ue(n,a));return Ne(t,r,e,{}),o.unsubscribe(i),a[0]})),Ue=(e,t)=>{const r=[];return(n,o)=>{if("result"===n){const{keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:a}=o,i={keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:a,errors:[]};r.push(i)}else if("result.start"===n)r.push(n);else if("result.end"===n){const n=r.pop();for(;"result.start"!==r[r.length-1];){const t=r.pop(),o=[t];e===xe&&(o.push(...t.errors),delete t.errors),(e===Ie||e!==Pe&&!t.valid)&&n.errors.unshift(...o)}r[r.length-1]=n,t[0]=n}}},Ce={},ze=e=>Ce[e],Ke=e=>e in Ce,Le={},qe={},_e=async(e,t)=>{if(e=await De(e),!Ke(`${e.schemaVersion}#validate`)){const t=await Ee.get(e.schemaVersion);(Ee.getConfig(t.id,"mandatoryVocabularies")||[]).forEach((e=>{if(!t.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)})),Object.entries(t.vocabulary).forEach((([e,r])=>{if(e in Le)Object.entries(Le[e]).forEach((([e,r])=>{((e,t)=>{Ce[e]={collectEvaluatedItems:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&new Set,collectEvaluatedProperties:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&[],...t}})(`${t.id}#${e}`,r)}));else if(r)throw Error(`Missing required vocabulary: ${e}`)}))}if(ke&&!e.validated){if(Ee.markValidated(e.id),!(e.schemaVersion in qe)){const t=await Ee.get(e.schemaVersion),r=await Ve(t);qe[t.id]=Re(r)}const t=L.cons(e.schema,e.id),r=qe[e.schemaVersion](t,Te);if(!r.valid)throw new $e(r)}return e.id in t.metaData||(t.metaData[e.id]={id:e.id,dynamicAnchors:e.dynamicAnchors,anchors:e.anchors}),ze(`${e.schemaVersion}#validate`).compile(e,t)},De=async e=>Ee.typeOf(e,"string")?De(await Ee.get(Ee.value(e),e)):e,Ne=(e,t,r,n)=>{const o=Be(e,r),a=Se(e)[0];return ze(o).interpret(e,t,r,{...r.metaData[a].dynamicAnchors,...n})},Be=(e,t)=>{if(!(e in t))throw Error(`No schema found at ${e}`);return t[e][0]};var Fe={validate:async(e,t,r)=>{const n=await Ve(e),o=(e,t)=>Re(n,L.cons(e),t);return void 0===t?o:o(t,r)},compile:Ve,interpret:Re,setMetaOutputFormat:e=>{Te=e},setShouldMetaValidate:e=>{ke=e},FLAG:Pe,BASIC:xe,DETAILED:Ae,VERBOSE:Ie,add:(e,t="",r="")=>{const n=Ee.add(e,t,r);delete qe[n]},getKeyword:ze,hasKeyword:Ke,defineVocabulary:(e,t)=>{Le[e]=t},compileSchema:_e,interpretSchema:Ne,collectEvaluatedProperties:(e,t,r,n,o)=>{const a=Be(e,r);return ze(a).collectEvaluatedProperties(e,t,r,n,o)},collectEvaluatedItems:(e,t,r,n,o)=>{const a=Be(e,r);return ze(a).collectEvaluatedItems(e,t,r,n,o)}};var Ze={compile:e=>Ee.value(e),interpret:()=>!0};var Me={compile:async(e,t)=>{const r=Ee.uri(e);if(!(r in t)){t[r]=!1;const n=Ee.value(e);if(!["object","boolean"].includes(typeof n))throw Error(`No schema found at '${Ee.uri(e)}'`);t[r]=[`${e.schemaVersion}#validate`,Ee.uri(e),"boolean"==typeof n?n:await te.pipeline([Ee.entries,te.map((([t,r])=>[`${e.schemaVersion}#${t}`,r])),te.filter((([t])=>Fe.hasKeyword(t)&&t!==`${e.schemaVersion}#validate`)),te.map((async([r,n])=>{const o=await Fe.getKeyword(r).compile(n,t,e);return[r,Ee.uri(n),o]})),te.all],e)]}return r},interpret:(e,t,r,n)=>{const[a,i,s]=r[e];o.publishSync("result.start");const c="boolean"==typeof s?s:s.every((([e,a,i])=>{o.publishSync("result.start");const s=Fe.getKeyword(e).interpret(i,t,r,n);return o.publishSync("result",{keyword:e,absoluteKeywordLocation:a,instanceLocation:L.uri(t),valid:s,ast:i}),o.publishSync("result.end"),s}));return o.publishSync("result",{keyword:a,absoluteKeywordLocation:i,instanceLocation:L.uri(t),valid:c,ast:e}),o.publishSync("result.end"),c},collectEvaluatedProperties:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&[]:a.filter((([e])=>!o||!e.endsWith("#unevaluatedProperties"))).reduce(((e,[o,,a])=>{const i=e&&Fe.getKeyword(o).collectEvaluatedProperties(a,t,r,n);return!1!==i&&[...e,...i]}),[])},collectEvaluatedItems:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&new Set:a.filter((([e])=>!o||!e.endsWith("#unevaluatedItems"))).reduce(((e,[o,,a])=>{const i=!1!==e&&Fe.getKeyword(o).collectEvaluatedItems(a,t,r,n);return!1!==i&&new Set([...e,...i])}),new Set)}},We={metaData:Ze,validate:Me},Je={Core:Fe,Schema:Ee,Instance:L,Reference:x,Keywords:We,InvalidSchemaError:$e},Ge=Je.Core,He=Je.Schema,Qe=Je.Instance,Xe=Je.Reference,Ye=Je.Keywords,et=Je.InvalidSchemaError;e.Core=Ge,e.Instance=Qe,e.InvalidSchemaError=et,e.Keywords=Ye,e.Reference=Xe,e.Schema=He,e.default=Je,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
define(["exports","url"],(function(e,t){"use strict";function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=r(t),o=function(e,t){return function r(){null==t&&(t=e.length);var n=[].slice.call(arguments);return n.length>=t?e.apply(this,n):function(){return r.apply(this,n.concat([].slice.call(arguments)))}}};var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var i,s=(function(e,t){var r,n;r="object"==typeof window&&window||a,n={},r.PubSub=n,function(e){var t={},r=-1,n="*";function o(e){var t;for(t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function a(e){return function(){throw e}}function i(e,t,r){try{e(t,r)}catch(e){setTimeout(a(e),0)}}function s(e,t,r){e(t,r)}function u(e,r,n,o){var a,u=t[r],l=o?s:i;if(Object.prototype.hasOwnProperty.call(t,r))for(a in u)Object.prototype.hasOwnProperty.call(u,a)&&l(u[a],e,n)}function l(e,t,r){return function(){var o=String(e),a=o.lastIndexOf(".");for(u(e,e,t,r);-1!==a;)a=(o=o.substr(0,a)).lastIndexOf("."),u(e,o,t,r);u(e,n,t,r)}}function c(e){var r=String(e);return Boolean(Object.prototype.hasOwnProperty.call(t,r)&&o(t[r]))}function f(e){for(var t=String(e),r=c(t)||c(n),o=t.lastIndexOf(".");!r&&-1!==o;)o=(t=t.substr(0,o)).lastIndexOf("."),r=c(t);return r}function h(e,t,r,n){var o=l(e="symbol"==typeof e?e.toString():e,t,n);return!!f(e)&&(!0===r?o():setTimeout(o,0),!0)}e.publish=function(t,r){return h(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return h(t,r,!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(t,e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeAll=function(t){return e.subscribe(n,t)},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n,o=0;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)){for(n in t[r])o++;break}return o},e.getSubscriptions=function(e){var r,n=[];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,a,i=function(e){var r;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e))return!0;return!1},s="string"==typeof r&&(Object.prototype.hasOwnProperty.call(t,r)||i(r)),u=!s&&"string"==typeof r,l="function"==typeof r,c=!1;if(!s){for(n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(o=t[n],u&&o[r]){delete o[r],c=r;break}if(l)for(a in o)Object.prototype.hasOwnProperty.call(o,a)&&o[a]===r&&(delete o[a],c=!0)}return c}e.clearSubscriptions(r)}}(n),void 0!==e&&e.exports&&(t=e.exports=n),t.PubSub=n,e.exports=t=n}(i={exports:{}},i.exports),i.exports);s.PubSub;var u=function(e,t){if(e=e.trim(),(t=t.trim()).startsWith("about:"))return t;const r=function(e){const t={host:"",path:"",query:"",protocol:""};let r=e,n=e.indexOf("//");t.protocol=r.substring(0,n),n+=2;const o=e.indexOf("/",n),a=e.indexOf("?"),i=e.indexOf("#");-1!==i&&(r=r.substring(0,i));if(-1!==a){const e=r.substring(a);t.query=e,r=r.substring(0,a)}if(-1!==o){const e=r.substring(0,o);t.host=e,r=r.substring(o),t.path=r}else t.host=r;return t}(e),n=function(e){const t={href:e,hash:"",query:"",netPath:!1,absolutePath:!1,relativePath:!1};if(f.test(e))return t.netPath=!0,t;"/"===e[0]?t.absolutePath=!0:""!==e&&(t.relativePath=!0);let r=e;const n=e.indexOf("?"),o=e.indexOf("#");if(-1!==o){const e=r.substring(o);t.hash=e,r=r.substring(0,o)}if(-1!==n){const e=r.substring(n);t.query=e,r=r.substring(0,n)}return t.path=r,t}(t);if(!r.protocol&&!n.netPath)throw new Error("Error, protocol is not specified");if(n.netPath)return function(e){return e.startsWith("//")}(n.href)&&(n.href=r.protocol+n.href),function(e){const t=e.indexOf("//")+2,r=!e.includes("/",t),n=!e.includes("?",t),o=!e.includes("#",t);return r&&n&&o}(n.href)?l(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+c(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let a,i=r.path,s=r.host;return 0===e.length?a=i:(i=i.substring(0,i.lastIndexOf("/")),a=c(i+"/"+e)),s+=""!==a||t||o?a+t+o:"/",s}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:l(e)}};function l(e){return e+("/"===e[e.length-1]?"":"/")}function c(e){let t=e.split("/");""===t[0]&&(t=t.slice(1));let r=[];return t.forEach(((e,n)=>{"."!==e&&(".."===e?r.pop():""===e&&n!==t.length-1||r.push(e))})),"/"+r.join("/")}const f=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");const h={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},m=e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),o=e.slice(r+1);return[decodeURI(n),decodeURI(o)]},p=e=>{const t=RegExp(/^(.+):\/\//).exec(e);return t?t[1]:""};var d={jsonTypeOf:(e,t)=>h[t](e),splitUrl:m,safeResolveUrl:(e,t)=>{const r=u(e,t),n=m(e)[0];if(n&&"file"===p(r)&&"file"!==p(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r}};const y=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(E)},v=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:v(e,S(t,o,n),r,w(o,n))}}if(Array.isArray(t)){const n=[...t];return n[I(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:S(t,e[0],n)},b=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||j(t)){const o=e.shift();b(e,S(t,o,n),r,w(o,n))}else{t[I(t,e[0])]=r}},g=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=S(t,n,r);return{...t,[n]:g(e,o,w(n,r))}}if(Array.isArray(t))return t.filter(((t,r)=>r!=e[0]));if("object"==typeof t&&null!==t){const{[e[0]]:r,...n}=t;return n}return S(t,e[0],r)}},x=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=S(t,n,r);x(e,o,w(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:S(t,e[0],r)},w=o(((e,t)=>t+"/"+O(e))),O=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),E=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),I=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,S=(e,t,r="")=>{if(void 0===e)throw TypeError(`Value at '${r}' is undefined and does not have property '${t}'`);if(null===e)throw TypeError(`Value at '${r}' is null and does not have property '${t}'`);if(j(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[I(e,t)]},j=e=>null===e||"object"!=typeof e;var P={nil:"",append:w,get:(e,t)=>{const r=y(e),n=e=>r.reduce((([e,t],r)=>[S(e,r,t),w(r,t)]),[e,""])[0];return void 0===t?n:n(t)},set:(e,t,r)=>{const n=y(e),a=o(((e,t)=>v(n,e,t,"")));return void 0===t?a:a(t,r)},assign:(e,t,r)=>{const n=y(e),a=o(((e,t)=>b(n,e,t,"")));return void 0===t?a:a(t,r)},unset:(e,t)=>{const r=y(e),n=e=>g(r,e,"");return void 0===t?n:n(t)},remove:(e,t)=>{const r=y(e),n=e=>x(r,e,"");return void 0===t?n:n(t)}};P.nil,P.append,P.get,P.set,P.assign,P.unset,P.remove;const A=Symbol("$__value"),T=Symbol("$__href");var R={cons:(e,t)=>Object.freeze({[T]:e,[A]:t}),isReference:e=>e&&void 0!==e[T],href:e=>e[T],value:e=>e[A]};const{jsonTypeOf:$}=d,V=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),k=e=>R.isReference(e.value)?R.value(e.value):e.value,L=o(((e,t)=>$(k(e),t))),H=(e,t)=>Object.freeze({...t,pointer:P.append(e,t.pointer),value:k(t)[e]}),U=o(((e,t)=>k(t).map(((r,n,o,a)=>e(H(n,t),n,o,a))))),q=o(((e,t)=>k(t).map(((e,r,n,o)=>H(r,t))).filter(((t,r,n,o)=>e(t,r,n,o))))),D=o(((e,t,r)=>k(r).reduce(((t,n,o)=>e(t,H(o,r),o)),t))),_=o(((e,t)=>k(t).every(((r,n,o,a)=>e(H(n,t),n,o,a))))),Q=o(((e,t)=>k(t).some(((r,n,o,a)=>e(H(n,t),n,o,a)))));var C={nil:V,cons:(e,t="")=>Object.freeze({...V,id:t,instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:k,has:(e,t)=>e in k(t),typeOf:L,step:H,entries:e=>Object.keys(k(e)).map((t=>[t,H(t,e)])),keys:e=>Object.keys(k(e)),map:U,filter:q,reduce:D,every:_,some:Q,length:e=>k(e).length},z=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,B=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,K=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,N=/\\([\u000b\u0020-\u00ff])/g,M=/([\\"])/g,F=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function J(e){var t=String(e);if(K.test(t))return t;if(t.length>0&&!B.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(M,"\\$1")+'"'}function W(e){this.parameters=Object.create(null),this.type=e}var Z={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!F.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,a=Object.keys(t).sort(),i=0;i<a.length;i++){if(o=a[i],!K.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+J(t[o])}return n},parse:function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;"function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.substr(0,r).trim():t.trim();if(!F.test(n))throw new TypeError("invalid media type");var o=new W(n.toLowerCase());if(-1!==r){var a,i,s;for(z.lastIndex=r;i=z.exec(t);){if(i.index!==r)throw new TypeError("invalid parameter format");r+=i[0].length,a=i[1].toLowerCase(),'"'===(s=i[2])[0]&&(s=s.substr(1,s.length-2).replace(N,"$1")),o.parameters[a]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},G=async e=>Object.entries(await e),X=o((async(e,t)=>(await t).map(e))),Y=o((async(e,t,r)=>(await r).reduce((async(t,r)=>e(await t,r)),t))),ee=o((async(e,t,r={})=>Y((async(t,r)=>await e(r)?t.concat([r]):t),[],t,r))),te=o((async(e,t)=>{const r=await X(e,t);return(await Promise.all(r)).some((e=>e))})),re=o((async(e,t)=>{const r=await X(e,t);return(await Promise.all(r)).every((e=>e))})),ne=o(((e,t)=>e.reduce((async(e,t)=>t(await e)),t))),oe={entries:G,map:X,filter:ee,reduce:Y,some:te,every:re,pipeline:ne,all:e=>Promise.all(e),allValues:e=>ne([G,Y((async(e,[t,r])=>(e[t]=await r,e)),{})],e)};oe.entries,oe.map,oe.filter,oe.reduce,oe.some,oe.every,oe.pipeline,oe.all,oe.allValues;var ae={ABSOLUTE:"absolute",PATH_RELATIVE:"pathRelative",ROOT_RELATIVE:"rootRelative",SHORTEST:"shortest"};function ie(e,t){var r=t.removeEmptyQueries&&e.extra.relation.minimumPort;return e.query.string[r?"stripped":"full"]}function se(e,t){return!e.extra.relation.minimumQuery||t.output===ae.ABSOLUTE||t.output===ae.ROOT_RELATIVE}function ue(e,t){var r=t.removeDirectoryIndexes&&e.extra.resourceIsIndex,n=e.extra.relation.minimumResource&&t.output!==ae.ABSOLUTE&&t.output!==ae.ROOT_RELATIVE;return!!e.resource&&!n&&!r}var le=function(e,t){var r="";return r+=function(e,t){var r="";return(e.extra.relation.maximumHost||t.output===ae.ABSOLUTE)&&(e.extra.relation.minimumScheme&&t.schemeRelative&&t.output!==ae.ABSOLUTE?r+="//":r+=e.scheme+"://"),r}(e,t),r+=function(e,t){return!e.auth||t.removeAuth||!e.extra.relation.maximumHost&&t.output!==ae.ABSOLUTE?"":e.auth+"@"}(e,t),r+=function(e,t){return e.host.full&&(e.extra.relation.maximumAuth||t.output===ae.ABSOLUTE)?e.host.full:""}(e,t),r+=function(e,t){return e.port&&!e.extra.portIsDefault&&e.extra.relation.maximumHost?":"+e.port:""}(e),r+=function(e,t){var r="",n=e.path.absolute.string,o=e.path.relative.string,a=ue(e,t);if(e.extra.relation.maximumHost||t.output===ae.ABSOLUTE||t.output===ae.ROOT_RELATIVE)r=n;else if(o.length<=n.length&&t.output===ae.SHORTEST||t.output===ae.PATH_RELATIVE){if(""===(r=o)){var i=se(e,t)&&!!ie(e,t);e.extra.relation.maximumPath&&!a?r="./":!e.extra.relation.overridesQuery||a||i||(r="./")}}else r=n;return"/"!==r||a||!t.removeRootTrailingSlash||e.extra.relation.minimumPort&&t.output!==ae.ABSOLUTE||(r=""),r}(e,t),r+=function(e,t){return ue(e,t)?e.resource:""}(e,t),r+=function(e,t){return se(e,t)?ie(e,t):""}(e,t),r+=function(e,t){return e.hash?e.hash:""}(e)};var ce={clone:function e(t){if(t instanceof Object){var r=t instanceof Array?[]:{};for(var n in t)t.hasOwnProperty(n)&&(r[n]=e(t[n]));return r}return t},isPlainObject:function(e){return!!e&&"object"==typeof e&&e.constructor===Object},shallowMerge:function(e,t){if(e instanceof Object&&t instanceof Object)for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e}};function fe(e,t){return t instanceof Object&&e instanceof Object?t instanceof Array&&e instanceof Array?t.concat(e):ce.shallowMerge(e,t):e}var he=function(e,t){if(ce.isPlainObject(e)){var r={};for(var n in t)t.hasOwnProperty(n)&&(void 0!==e[n]?r[n]=fe(e[n],t[n]):r[n]=t[n]);return r}return t};var me=function(e){var t=!(e.scheme||e.auth||e.host.full||e.port),r=t&&!e.path.absolute.string,n=r&&!e.resource,o=n&&!e.query.string.full.length,a=o&&!e.hash;e.extra.hrefInfo.minimumPathOnly=t,e.extra.hrefInfo.minimumResourceOnly=r,e.extra.hrefInfo.minimumQueryOnly=n,e.extra.hrefInfo.minimumHashOnly=o,e.extra.hrefInfo.empty=a};var pe=function(e,t){if(t.ignore_www){var r=e.host.full;if(r){var n=r;0===r.indexOf("www.")&&(n=r.substr(4)),e.host.stripped=n}}};function de(e){if("/"!==e){var t=[];return e.split("/").forEach((function(e){""!==e&&t.push(e)})),t}return[]}var ye=function(e,t){var r=e.path.absolute.string;if(r){var n=r.lastIndexOf("/");if(n>-1){if(++n<r.length){var o=r.substr(n);"."!==o&&".."!==o?(e.resource=o,r=r.substr(0,n)):r+="/"}e.path.absolute.string=r,e.path.absolute.array=de(r)}else"."===r||".."===r?(r+="/",e.path.absolute.string=r,e.path.absolute.array=de(r)):(e.resource=r,e.path.absolute.string=null);e.extra.resourceIsIndex=function(e,t){var r=!1;return t.directoryIndexes.every((function(t){return t!==e||(r=!0,!1)})),r}(e.resource,t)}};var ve=function(e,t){var r=-1;for(var n in t.defaultPorts)if(n===e.scheme&&t.defaultPorts.hasOwnProperty(n)){r=t.defaultPorts[n];break}r>-1&&(r=r.toString(),null===e.port&&(e.port=r),e.extra.portIsDefault=e.port===r)},be=Object.prototype.hasOwnProperty;function ge(e,t){var r=0,n="";for(var o in e)if(""!==o&&!0===be.call(e,o)){var a=e[o];""===a&&t||(n+=1==++r?"?":"&",o=encodeURIComponent(o),n+=""!==a?o+"="+encodeURIComponent(a).replace(/%20/g,"+"):o)}return n}var xe=function(e,t){e.query.string.full=ge(e.query.object,!1),t.removeEmptyQueries&&(e.query.string.stripped=ge(e.query.object,!0))},we=n.default.parse;var Oe=function(e,t){return function(e,t){var r=!0;return t.rejectedSchemes.every((function(t){return r=!(0===e.indexOf(t+":"))})),r}(e,t)?(r=we(e,!0,t.slashesDenoteHost),(n=r.protocol)&&n.indexOf(":")===n.length-1&&(n=n.substr(0,n.length-1)),r.host={full:r.hostname,stripped:null},r.path={absolute:{array:null,string:r.pathname},relative:{array:null,string:null}},r.query={object:r.query,string:{full:null,stripped:null}},r.extra={hrefInfo:{minimumPathOnly:null,minimumResourceOnly:null,minimumQueryOnly:null,minimumHashOnly:null,empty:null,separatorOnlyQuery:"?"===r.search},portIsDefault:null,relation:{maximumScheme:null,maximumAuth:null,maximumHost:null,maximumPort:null,maximumPath:null,maximumResource:null,maximumQuery:null,maximumHash:null,minimumScheme:null,minimumAuth:null,minimumHost:null,minimumPort:null,minimumPath:null,minimumResource:null,minimumQuery:null,minimumHash:null,overridesQuery:null},resourceIsIndex:null,slashes:r.slashes},r.resource=null,r.scheme=n,delete r.hostname,delete r.pathname,delete r.protocol,delete r.search,delete r.slashes,r):{href:e,valid:!1};var r,n};var Ee={join:function(e){return e.length>0?e.join("/")+"/":""},resolveDotSegments:function(e){var t=[];return e.forEach((function(e){".."!==e?"."!==e&&t.push(e):t.length>0&&t.splice(t.length-1,1)})),t}};function Ie(e,t){var r=Oe(e,t);return!1===r.valid||(pe(r,t),ve(r,t),ye(r,t),xe(r,t),me(r)),r}var Se={from:function(e,t,r){if(e){var n=Ie(e,t),o=Ee.resolveDotSegments(n.path.absolute.array);return n.path.absolute.array=o,n.path.absolute.string="/"+Ee.join(o),n}return r},to:Ie};var je={pathOn:function(e,t,r){var n=e.extra.hrefInfo.minimumQueryOnly,o=e.extra.hrefInfo.minimumHashOnly,a=e.extra.hrefInfo.empty,i=e.extra.relation.minimumPort,s=e.extra.relation.minimumScheme,u=i&&e.path.absolute.string===t.path.absolute.string,l=e.resource===t.resource||!e.resource&&t.extra.resourceIsIndex||r.removeDirectoryIndexes&&e.extra.resourceIsIndex&&!t.resource,c=u&&(l||n||o||a),f=r.removeEmptyQueries?"stripped":"full",h=e.query.string[f],m=t.query.string[f],p=c&&!!h&&h===m||(o||a)&&!e.extra.hrefInfo.separatorOnlyQuery,d=p&&e.hash===t.hash;e.extra.relation.minimumPath=u,e.extra.relation.minimumResource=c,e.extra.relation.minimumQuery=p,e.extra.relation.minimumHash=d,e.extra.relation.maximumPort=!s||s&&!u,e.extra.relation.maximumPath=!s||s&&!c,e.extra.relation.maximumResource=!s||s&&!p,e.extra.relation.maximumQuery=!s||s&&!d,e.extra.relation.maximumHash=!s||s&&!d,e.extra.relation.overridesQuery=u&&e.extra.relation.maximumResource&&!p&&!!m},upToPath:function(e,t,r){var n=e.extra.hrefInfo.minimumPathOnly,o=e.scheme===t.scheme||!e.scheme,a=o&&(e.auth===t.auth||r.removeAuth||n),i=r.ignore_www?"stripped":"full",s=a&&(e.host[i]===t.host[i]||n),u=s&&(e.port===t.port||n);e.extra.relation.minimumScheme=o,e.extra.relation.minimumAuth=a,e.extra.relation.minimumHost=s,e.extra.relation.minimumPort=u,e.extra.relation.maximumScheme=!o||o&&!a,e.extra.relation.maximumAuth=!o||o&&!s,e.extra.relation.maximumHost=!o||o&&!u}};var Pe=function(e,t,r){je.upToPath(e,t,r),e.extra.relation.minimumScheme&&(e.scheme=t.scheme),e.extra.relation.minimumAuth&&(e.auth=t.auth),e.extra.relation.minimumHost&&(e.host=ce.clone(t.host)),e.extra.relation.minimumPort&&function(e,t){e.port=t.port,e.extra.portIsDefault=t.extra.portIsDefault}(e,t),e.extra.relation.minimumScheme&&function(e,t){if(e.extra.relation.maximumHost||!e.extra.hrefInfo.minimumResourceOnly){var r=e.path.absolute.array,n="/";r?(e.extra.hrefInfo.minimumPathOnly&&0!==e.path.absolute.string.indexOf("/")&&(r=t.path.absolute.array.concat(r)),r=Ee.resolveDotSegments(r),n+=Ee.join(r)):r=[],e.path.absolute.array=r,e.path.absolute.string=n}else e.path=ce.clone(t.path)}(e,t),je.pathOn(e,t,r),e.extra.relation.minimumResource&&function(e,t){e.resource=t.resource,e.extra.resourceIsIndex=t.extra.resourceIsIndex}(e,t),e.extra.relation.minimumQuery&&(e.query=ce.clone(t.query)),e.extra.relation.minimumHash&&(e.hash=t.hash)};var Ae=function(e,t,r){if(e.extra.relation.minimumScheme){var n=(o=e.path.absolute.array,a=t.path.absolute.array,i=[],s=!0,u=-1,a.forEach((function(e,t){s&&(o[t]!==e?s=!1:u=t),s||i.push("..")})),o.forEach((function(e,t){t>u&&i.push(e)})),i);e.path.relative.array=n,e.path.relative.string=Ee.join(n)}var o,a,i,s,u};var Te=function(e,t,r){return Pe(t,e,r),Ae(t,e),t};function Re(e,t){this.options=he(t,{defaultPorts:{ftp:21,http:80,https:443},directoryIndexes:["index.html"],ignore_www:!1,output:Re.SHORTEST,rejectedSchemes:["data","javascript","mailto"],removeAuth:!1,removeDirectoryIndexes:!0,removeEmptyQueries:!1,removeRootTrailingSlash:!0,schemeRelative:!0,site:void 0,slashesDenoteHost:!0}),this.from=Se.from(e,this.options,null)}Re.prototype.relate=function(e,t,r){if(ce.isPlainObject(t)?(r=t,t=e,e=null):t||(t=e,e=null),r=he(r,this.options),e=e||r.site,!(e=Se.from(e,r,this.from))||!e.href)throw new Error("from value not defined.");if(e.extra.hrefInfo.minimumPathOnly)throw new Error("from value supplied is not absolute: "+e.href);return!1===(t=Se.to(t,r)).valid?t.href:(t=Te(e,t,r),t=le(t,r))},Re.relate=function(e,t,r){return(new Re).relate(e,t,r)},ce.shallowMerge(Re,ae);var $e=Re,Ve=fetch;const{jsonTypeOf:ke,splitUrl:Le,safeResolveUrl:He}=d,Ue={},qe={},De=(e,t)=>{const r=e in qe?qe[e]:e;if(r in Ue)return Ue[r][t]},_e={},Qe={},Ce=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=Le(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=De(n,"baseToken"),a=De(n,"anchorToken"),i=Le(t)[0];if(!i&&!Le(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const s=He(i,e[o]||""),[u,l]=Le(s);delete e[o],l&&o===a&&(e[a]=a!==o?encodeURI(l):`#${encodeURI(l)}`),i&&(Qe[i]=u);const c={},f=De(n,"recursiveAnchorToken");let h;!0===e[f]&&(c[""]=`${u}#`,e[a]="",delete e[f]);const m=De(n,"vocabularyToken");ke(e[m],"object")?(qe[u]=n,h=e[m],delete e[m]):(qe[u]=n,h={[n]:!0});const p={"":""};return _e[u]={id:u,schemaVersion:n,schema:ze(e,u,n,P.nil,p,c),anchors:p,dynamicAnchors:c,vocabulary:h,validated:!1},u},ze=(e,t,r,n,o,a)=>{if(ke(e,"object")){const i="string"==typeof e.$schema?Le(e.$schema)[0]:r,s=De(i,"embeddedToken"),u=De(i,"anchorToken");if("string"==typeof e[s]&&(s!==u||"#"!==e[s][0])){const n=He(t,e[s]);return e[s]=n,Ce(e,n,r),R.cons(e[s],e)}const l=De(r,"anchorToken"),c=De(r,"dynamicAnchorToken");"string"==typeof e[c]&&(a[e[c]]=`${t}#${encodeURI(n)}`,o[e[c]]=n,delete e[c]);const f=De(r,"embeddedToken");if("string"==typeof e[l]){const t=l!==f?e[l]:e[l].slice(1);o[t]=n,delete e[l]}const h=De(r,"jrefToken");if("string"==typeof e[h])return R.cons(e[h],e);for(const i in e)e[i]=ze(e[i],t,r,P.append(i,n),o,a);return e}return Array.isArray(e)?e.map(((e,i)=>ze(e,t,r,P.append(i,n),o,a))):e},Be=e=>_e[Qe[e]]||_e[e],Ke=Object.freeze({id:"",schemaVersion:void 0,vocabulary:{},pointer:P.nil,schema:void 0,value:void 0,anchors:{},dynamicAnchors:{},validated:!0}),Ne=async(e,t=Ke)=>{const r=He(Je(t),e),[n,o]=Le(r);if(!(e=>e in _e||e in Qe)(n)){const e=await Ve(n,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error(`Failed to retrieve schema with id: ${n}`);if(e.headers.has("content-type")){const t=Z.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${n} is not a schema. Found a document with media type: ${t}`)}Ce(await e.json(),n)}const a=Be(n),i="/"!==o[0]?Fe(a,o):o,s=Object.freeze({...a,pointer:i,value:P.get(i,a.schema)});return Me(s)},Me=e=>R.isReference(e.value)?Ne(R.href(e.value),e):e,Fe=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},Je=e=>`${e.id}#${encodeURI(e.pointer)}`,We=e=>R.isReference(e.value)?R.value(e.value):e.value,Ze=(e,t)=>{const r=Be(t.id),n=Object.freeze({...t,pointer:P.append(e,t.pointer),value:We(t)[e],validated:r.validated});return Me(n)},Ge=o(((e,t)=>oe.pipeline([We,oe.map((async(r,n)=>e(await Ze(n,t),n))),oe.all],t))),Xe={parentId:"",parentDialect:"",includeEmbedded:!0},Ye=(e,t)=>t.startsWith("file://")?""===e?"":$e.relate(e,t):t;var et={setConfig:(e,t,r)=>{Ue[e]||(Ue[e]={}),Ue[e][t]=r},getConfig:De,add:Ce,get:Ne,markValidated:e=>{_e[e].validated=!0},uri:Je,value:We,getAnchorPointer:Fe,typeOf:(e,t)=>ke(We(e),t),has:(e,t)=>e in We(t),step:Ze,keys:e=>Object.keys(We(e)),entries:e=>oe.pipeline([We,Object.keys,oe.map((async t=>[t,await Ze(t,e)])),oe.all],e),map:Ge,length:e=>We(e).length,toSchema:(e,t={})=>{const r={...Xe,...t},n=JSON.parse(JSON.stringify(e.schema,((t,n)=>{if(!R.isReference(n))return n;const o=R.value(n),a=o.$schema||e.schemaVersion,i=De(a,"embeddedToken");return!r.includeEmbedded&&i in o?void 0:R.value(n)}))),o=De(e.schemaVersion,"dynamicAnchorToken");Object.entries(e.dynamicAnchors).forEach((([e,t])=>{const r=Le(t)[1];P.assign(r,n,{[o]:e,...P.get(r,n)})}));const a=De(e.schemaVersion,"anchorToken");Object.entries(e.anchors).filter((([e])=>""!==e)).forEach((([e,t])=>{P.assign(t,n,{[a]:e,...P.get(t,n)})}));const i=De(e.schemaVersion,"baseToken"),s=Ye(r.parentId,e.id),u=r.parentDialect===e.schemaVersion?"":e.schemaVersion;return{...s&&{[i]:s},...u&&{$schema:u},...n}}};et.setConfig,et.getConfig,et.add,et.get,et.markValidated,et.uri,et.value,et.getAnchorPointer,et.typeOf,et.has,et.step,et.keys,et.entries,et.map,et.length,et.toSchema;class tt extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var rt=tt;const{splitUrl:nt}=d,ot="FLAG",at="BASIC",it="DETAILED",st="VERBOSE";let ut=it,lt=!0;const ct=async e=>{const t={metaData:{}};return{ast:t,schemaUri:await bt(e,t)}},ft=o((({ast:e,schemaUri:t},r,n=ot)=>{if(![ot,at,it,st].includes(n))throw Error(`The '${n}' error format is not supported`);const o=[],a=s.subscribe("result",ht(n,o));return xt(t,r,e,{}),s.unsubscribe(a),o[0]})),ht=(e,t)=>{const r=[];return(n,o)=>{if("result"===n){const{keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:a}=o,i={keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:a,errors:[]};r.push(i)}else if("result.start"===n)r.push(n);else if("result.end"===n){const n=r.pop();for(;"result.start"!==r[r.length-1];){const t=r.pop(),o=[t];e===at&&(o.push(...t.errors),delete t.errors),(e===st||e!==ot&&!t.valid)&&n.errors.unshift(...o)}r[r.length-1]=n,t[0]=n}}},mt={},pt=e=>mt[e],dt=e=>e in mt,yt={},vt={},bt=async(e,t)=>{if(e=await gt(e),!dt(`${e.schemaVersion}#validate`)){const t=await et.get(e.schemaVersion);(et.getConfig(t.id,"mandatoryVocabularies")||[]).forEach((e=>{if(!t.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)})),Object.entries(t.vocabulary).forEach((([e,r])=>{if(e in yt)Object.entries(yt[e]).forEach((([e,r])=>{((e,t)=>{mt[e]={collectEvaluatedItems:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&new Set,collectEvaluatedProperties:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&[],...t}})(`${t.id}#${e}`,r)}));else if(r)throw Error(`Missing required vocabulary: ${e}`)}))}if(lt&&!e.validated){if(et.markValidated(e.id),!(e.schemaVersion in vt)){const t=await et.get(e.schemaVersion),r=await ct(t);vt[t.id]=ft(r)}const t=C.cons(e.schema,e.id),r=vt[e.schemaVersion](t,ut);if(!r.valid)throw new rt(r)}return e.id in t.metaData||(t.metaData[e.id]={id:e.id,dynamicAnchors:e.dynamicAnchors,anchors:e.anchors}),pt(`${e.schemaVersion}#validate`).compile(e,t)},gt=async e=>et.typeOf(e,"string")?gt(await et.get(et.value(e),e)):e,xt=(e,t,r,n)=>{const o=wt(e,r),a=nt(e)[0];return pt(o).interpret(e,t,r,{...r.metaData[a].dynamicAnchors,...n})},wt=(e,t)=>{if(!(e in t))throw Error(`No schema found at ${e}`);return t[e][0]};var Ot={validate:async(e,t,r)=>{const n=await ct(e),o=(e,t)=>ft(n,C.cons(e),t);return void 0===t?o:o(t,r)},compile:ct,interpret:ft,setMetaOutputFormat:e=>{ut=e},setShouldMetaValidate:e=>{lt=e},FLAG:ot,BASIC:at,DETAILED:it,VERBOSE:st,add:(e,t="",r="")=>{const n=et.add(e,t,r);delete vt[n]},getKeyword:pt,hasKeyword:dt,defineVocabulary:(e,t)=>{yt[e]=t},compileSchema:bt,interpretSchema:xt,collectEvaluatedProperties:(e,t,r,n,o)=>{const a=wt(e,r);return pt(a).collectEvaluatedProperties(e,t,r,n,o)},collectEvaluatedItems:(e,t,r,n,o)=>{const a=wt(e,r);return pt(a).collectEvaluatedItems(e,t,r,n,o)}};var Et={compile:e=>et.value(e),interpret:()=>!0};var It={compile:async(e,t)=>{const r=et.uri(e);if(!(r in t)){t[r]=!1;const n=et.value(e);if(!["object","boolean"].includes(typeof n))throw Error(`No schema found at '${et.uri(e)}'`);t[r]=[`${e.schemaVersion}#validate`,et.uri(e),"boolean"==typeof n?n:await oe.pipeline([et.entries,oe.map((([t,r])=>[`${e.schemaVersion}#${t}`,r])),oe.filter((([t])=>Ot.hasKeyword(t)&&t!==`${e.schemaVersion}#validate`)),oe.map((async([r,n])=>{const o=await Ot.getKeyword(r).compile(n,t,e);return[r,et.uri(n),o]})),oe.all],e)]}return r},interpret:(e,t,r,n)=>{const[o,a,i]=r[e];s.publishSync("result.start");const u="boolean"==typeof i?i:i.every((([e,o,a])=>{s.publishSync("result.start");const i=Ot.getKeyword(e).interpret(a,t,r,n);return s.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:C.uri(t),valid:i,ast:a}),s.publishSync("result.end"),i}));return s.publishSync("result",{keyword:o,absoluteKeywordLocation:a,instanceLocation:C.uri(t),valid:u,ast:e}),s.publishSync("result.end"),u},collectEvaluatedProperties:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&[]:a.filter((([e])=>!o||!e.endsWith("#unevaluatedProperties"))).reduce(((e,[o,,a])=>{const i=e&&Ot.getKeyword(o).collectEvaluatedProperties(a,t,r,n);return!1!==i&&[...e,...i]}),[])},collectEvaluatedItems:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&new Set:a.filter((([e])=>!o||!e.endsWith("#unevaluatedItems"))).reduce(((e,[o,,a])=>{const i=!1!==e&&Ot.getKeyword(o).collectEvaluatedItems(a,t,r,n);return!1!==i&&new Set([...e,...i])}),new Set)}},St={metaData:Et,validate:It},jt={Core:Ot,Schema:et,Instance:C,Reference:R,Keywords:St,InvalidSchemaError:rt},Pt=jt.Core,At=jt.Schema,Tt=jt.Instance,Rt=jt.Reference,$t=jt.Keywords,Vt=jt.InvalidSchemaError;e.Core=Pt,e.Instance=Tt,e.InvalidSchemaError=Vt,e.Keywords=$t,e.Reference=Rt,e.Schema=At,e.default=jt,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=json-schema-core-amd.min.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=function(e,t){return function r(){null==t&&(t=e.length);var n=[].slice.call(arguments);return n.length>=t?e.apply(this,n):function(){return r.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:{};var r,n=(function(e,r){var n;n={},("object"==typeof window&&window||t).PubSub=n,function(e){var t={},r=-1,n="*";function o(e){var t;for(t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function a(e){return function(){throw e}}function i(e,t,r){try{e(t,r)}catch(e){setTimeout(a(e),0)}}function s(e,t,r){e(t,r)}function c(e,r,n,o){var a,c=t[r],l=o?s:i;if(Object.prototype.hasOwnProperty.call(t,r))for(a in c)Object.prototype.hasOwnProperty.call(c,a)&&l(c[a],e,n)}function l(e,t,r){return function(){var o=String(e),a=o.lastIndexOf(".");for(c(e,e,t,r);-1!==a;)a=(o=o.substr(0,a)).lastIndexOf("."),c(e,o,t,r);c(e,n,t,r)}}function u(e){var r=String(e);return Boolean(Object.prototype.hasOwnProperty.call(t,r)&&o(t[r]))}function f(e){for(var t=String(e),r=u(t)||u(n),o=t.lastIndexOf(".");!r&&-1!==o;)o=(t=t.substr(0,o)).lastIndexOf("."),r=u(t);return r}function p(e,t,r,n){var o=l(e="symbol"==typeof e?e.toString():e,t,n);return!!f(e)&&(!0===r?o():setTimeout(o,0),!0)}e.publish=function(t,r){return p(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return p(t,r,!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(t,e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeAll=function(t){return e.subscribe(n,t)},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n,o=0;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)){for(n in t[r])o++;break}return o},e.getSubscriptions=function(e){var r,n=[];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,a,i=function(e){var r;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e))return!0;return!1},s="string"==typeof r&&(Object.prototype.hasOwnProperty.call(t,r)||i(r)),c=!s&&"string"==typeof r,l="function"==typeof r,u=!1;if(!s){for(n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(o=t[n],c&&o[r]){delete o[r],u=r;break}if(l)for(a in o)Object.prototype.hasOwnProperty.call(o,a)&&o[a]===r&&(delete o[a],u=!0)}return u}e.clearSubscriptions(r)}}(n),void 0!==e&&e.exports&&(r=e.exports=n),r.PubSub=n,e.exports=r=n}(r={exports:{}},r.exports),r.exports);n.PubSub;var o=function(e,t){if(e=e.trim(),(t=t.trim()).startsWith("about:"))return t;const r=function(e){const t={host:"",path:"",query:"",protocol:""};let r=e,n=e.indexOf("//");t.protocol=r.substring(0,n),n+=2;const o=e.indexOf("/",n),a=e.indexOf("?"),i=e.indexOf("#");-1!==i&&(r=r.substring(0,i));if(-1!==a){const e=r.substring(a);t.query=e,r=r.substring(0,a)}if(-1!==o){const e=r.substring(0,o);t.host=e,r=r.substring(o),t.path=r}else t.host=r;return t}(e),n=function(e){const t={href:e,hash:"",query:"",netPath:!1,absolutePath:!1,relativePath:!1};if(s.test(e))return t.netPath=!0,t;"/"===e[0]?t.absolutePath=!0:""!==e&&(t.relativePath=!0);let r=e;const n=e.indexOf("?"),o=e.indexOf("#");if(-1!==o){const e=r.substring(o);t.hash=e,r=r.substring(0,o)}if(-1!==n){const e=r.substring(n);t.query=e,r=r.substring(0,n)}return t.path=r,t}(t);if(!r.protocol&&!n.netPath)throw new Error("Error, protocol is not specified");if(n.netPath)return n.href.startsWith("//")&&(n.href=r.protocol+n.href),function(e){const t=e.indexOf("//")+2,r=!e.includes("/",t),n=!e.includes("?",t),o=!e.includes("#",t);return r&&n&&o}(n.href)?a(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+i(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let a,s=r.path,c=r.host;return 0===e.length?a=s:(s=s.substring(0,s.lastIndexOf("/")),a=i(s+"/"+e)),c+=""!==a||t||o?a+t+o:"/",c}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:a(e)}};function a(e){return e+("/"===e[e.length-1]?"":"/")}function i(e){let t=e.split("/");""===t[0]&&(t=t.slice(1));let r=[];return t.forEach(((e,n)=>{"."!==e&&(".."===e?r.pop():""===e&&n!==t.length-1||r.push(e))})),"/"+r.join("/")}const s=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");const c={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},l=e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),o=e.slice(r+1);return[decodeURI(n),decodeURI(o)]},u=e=>{const t=RegExp(/^(.+):\/\//).exec(e);return t?t[1]:""};var f={jsonTypeOf:(e,t)=>c[t](e),splitUrl:l,safeResolveUrl:(e,t)=>{const r=o(e,t),n=l(e)[0];if(n&&"file"===u(r)&&"file"!==u(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r}};const p=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(w)},d=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:d(e,O(t,o,n),r,b(o,n))}}if(Array.isArray(t)){const n=[...t];return n[g(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:O(t,e[0],n)},h=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||E(t)){const o=e.shift();h(e,O(t,o,n),r,b(o,n))}else{t[g(t,e[0])]=r}},y=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=O(t,n,r);return{...t,[n]:y(e,o,b(n,r))}}if(Array.isArray(t))return t.filter(((t,r)=>r!=e[0]));if("object"==typeof t&&null!==t){const{[e[0]]:r,...n}=t;return n}return O(t,e[0],r)}},v=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=O(t,n,r);v(e,o,b(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:O(t,e[0],r)},b=e(((e,t)=>t+"/"+m(e))),m=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),w=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),g=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,O=(e,t,r="")=>{if(void 0===e)throw TypeError(`Value at '${r}' is undefined and does not have property '${t}'`);if(null===e)throw TypeError(`Value at '${r}' is null and does not have property '${t}'`);if(E(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[g(e,t)]},E=e=>null===e||"object"!=typeof e;var j={nil:"",append:b,get:(e,t)=>{const r=p(e),n=e=>r.reduce((([e,t],r)=>[O(e,r,t),b(r,t)]),[e,""])[0];return void 0===t?n:n(t)},set:(t,r,n)=>{const o=p(t),a=e(((e,t)=>d(o,e,t,"")));return void 0===r?a:a(r,n)},assign:(t,r,n)=>{const o=p(t),a=e(((e,t)=>h(o,e,t,"")));return void 0===r?a:a(r,n)},unset:(e,t)=>{const r=p(e),n=e=>y(r,e,"");return void 0===t?n:n(t)},remove:(e,t)=>{const r=p(e),n=e=>v(r,e,"");return void 0===t?n:n(t)}};j.nil,j.append,j.get,j.set,j.assign,j.unset,j.remove;const $=Symbol("$__value"),S=Symbol("$__href");var x={cons:(e,t)=>Object.freeze({[S]:e,[$]:t}),isReference:e=>e&&void 0!==e[S],href:e=>e[S],value:e=>e[$]};const{jsonTypeOf:P}=f,A=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),I=e=>x.isReference(e.value)?x.value(e.value):e.value,T=e(((e,t)=>P(I(e),t))),k=(e,t)=>Object.freeze({...t,pointer:j.append(e,t.pointer),value:I(t)[e]}),V=e(((e,t)=>I(t).map(((r,n,o,a)=>e(k(n,t),n,o,a))))),R=e(((e,t)=>I(t).map(((e,r,n,o)=>k(r,t))).filter(((t,r,n,o)=>e(t,r,n,o))))),U=e(((e,t,r)=>I(r).reduce(((t,n,o)=>e(t,k(o,r),o)),t))),C=e(((e,t)=>I(t).every(((r,n,o,a)=>e(k(n,t),n,o,a))))),z=e(((e,t)=>I(t).some(((r,n,o,a)=>e(k(n,t),n,o,a)))));var K={nil:A,cons:(e,t="")=>Object.freeze({...A,id:t,instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:I,has:(e,t)=>e in I(t),typeOf:T,step:k,entries:e=>Object.keys(I(e)).map((t=>[t,k(t,e)])),keys:e=>Object.keys(I(e)),map:V,filter:R,reduce:U,every:C,some:z,length:e=>I(e).length},L=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,q=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,_=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,D=/\\([\u000b\u0020-\u00ff])/g,N=/([\\"])/g,B=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function F(e){var t=String(e);if(_.test(t))return t;if(t.length>0&&!q.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(N,"\\$1")+'"'}function Z(e){this.parameters=Object.create(null),this.type=e}var M={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!B.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,a=Object.keys(t).sort(),i=0;i<a.length;i++){if(o=a[i],!_.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+F(t[o])}return n},parse:function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;"function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.substr(0,r).trim():t.trim();if(!B.test(n))throw new TypeError("invalid media type");var o=new Z(n.toLowerCase());if(-1!==r){var a,i,s;for(L.lastIndex=r;i=L.exec(t);){if(i.index!==r)throw new TypeError("invalid parameter format");r+=i[0].length,a=i[1].toLowerCase(),'"'===(s=i[2])[0]&&(s=s.substr(1,s.length-2).replace(D,"$1")),o.parameters[a]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},W=async e=>Object.entries(await e),J=e((async(e,t)=>(await t).map(e))),G=e((async(e,t,r)=>(await r).reduce((async(t,r)=>e(await t,r)),t))),H=e((async(e,t,r={})=>G((async(t,r)=>await e(r)?t.concat([r]):t),[],t,r))),Q=e((async(e,t)=>{const r=await J(e,t);return(await Promise.all(r)).some((e=>e))})),X=e((async(e,t)=>{const r=await J(e,t);return(await Promise.all(r)).every((e=>e))})),Y=e(((e,t)=>e.reduce((async(e,t)=>t(await e)),t))),ee={entries:W,map:J,filter:H,reduce:G,some:Q,every:X,pipeline:Y,all:e=>Promise.all(e),allValues:e=>Y([W,G((async(e,[t,r])=>(e[t]=await r,e)),{})],e)};ee.entries,ee.map,ee.filter,ee.reduce,ee.some,ee.every,ee.pipeline,ee.all,ee.allValues;var te=fetch;const{jsonTypeOf:re,splitUrl:ne,safeResolveUrl:oe}=f,ae={},ie={},se=(e,t)=>{const r=e in ie?ie[e]:e;if(r in ae)return ae[r][t]},ce={},le={},ue=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=ne(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=se(n,"baseToken"),a=se(n,"anchorToken"),i=ne(t)[0];if(!i&&!ne(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const s=oe(i,e[o]||""),[c,l]=ne(s);delete e[o],l&&o===a&&(e[a]=a!==o?encodeURI(l):`#${encodeURI(l)}`),i&&(le[i]=c);const u={},f=se(n,"recursiveAnchorToken");let p;!0===e[f]&&(u[""]=`${c}#`,e[a]="",delete e[f]);const d=se(n,"vocabularyToken");re(e[d],"object")?(ie[c]=n,p=e[d],delete e[d]):(ie[c]=n,p={[n]:!0});const h={"":""};return ce[c]={id:c,schemaVersion:n,schema:fe(e,c,n,j.nil,h,u),anchors:h,dynamicAnchors:u,vocabulary:p,validated:!1},c},fe=(e,t,r,n,o,a)=>{if(re(e,"object")){const i="string"==typeof e.$schema?ne(e.$schema)[0]:r,s=se(i,"embeddedToken"),c=se(i,"anchorToken");if("string"==typeof e[s]&&(s!==c||"#"!==e[s][0])){const n=oe(t,e[s]);return e[s]=n,ue(e,n,r),x.cons(e[s],e)}const l=se(r,"anchorToken"),u=se(r,"dynamicAnchorToken");"string"==typeof e[u]&&(a[e[u]]=`${t}#${encodeURI(n)}`,o[e[u]]=n,delete e[u]);const f=se(r,"embeddedToken");if("string"==typeof e[l]){const t=l!==f?e[l]:e[l].slice(1);o[t]=n,delete e[l]}const p=se(r,"jrefToken");if("string"==typeof e[p])return x.cons(e[p],e);for(const i in e)e[i]=fe(e[i],t,r,j.append(i,n),o,a);return e}return Array.isArray(e)?e.map(((e,i)=>fe(e,t,r,j.append(i,n),o,a))):e},pe=e=>ce[le[e]]||ce[e],de=Object.freeze({id:"",schemaVersion:void 0,vocabulary:{},pointer:j.nil,schema:void 0,value:void 0,anchors:{},dynamicAnchors:{},validated:!0}),he=async(e,t=de)=>{const r=oe(be(t),e),[n,o]=ne(r);if(!(e=>e in ce||e in le)(n)){const e=await te(n,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error(`Failed to retrieve schema with id: ${n}`);if(e.headers.has("content-type")){const t=M.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${n} is not a schema. Found a document with media type: ${t}`)}ue(await e.json(),n)}const a=pe(n),i="/"!==o[0]?ve(a,o):o,s=Object.freeze({...a,pointer:i,value:j.get(i,a.schema)});return ye(s)},ye=e=>x.isReference(e.value)?he(x.href(e.value),e):e,ve=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},be=e=>`${e.id}#${encodeURI(e.pointer)}`,me=e=>x.isReference(e.value)?x.value(e.value):e.value,we=(e,t)=>{const r=pe(t.id),n=Object.freeze({...t,pointer:j.append(e,t.pointer),value:me(t)[e],validated:r.validated});return ye(n)},ge=e(((e,t)=>ee.pipeline([me,ee.map((async(r,n)=>e(await we(n,t),n))),ee.all],t)));var Oe={setConfig:(e,t,r)=>{ae[e]||(ae[e]={}),ae[e][t]=r},getConfig:se,add:ue,get:he,markValidated:e=>{ce[e].validated=!0},uri:be,value:me,getAnchorPointer:ve,typeOf:(e,t)=>re(me(e),t),has:(e,t)=>e in me(t),step:we,keys:e=>Object.keys(me(e)),entries:e=>ee.pipeline([me,Object.keys,ee.map((async t=>[t,await we(t,e)])),ee.all],e),map:ge,length:e=>me(e).length};Oe.setConfig,Oe.getConfig,Oe.add,Oe.get,Oe.markValidated,Oe.uri,Oe.value,Oe.getAnchorPointer,Oe.typeOf,Oe.has,Oe.step,Oe.keys,Oe.entries,Oe.map,Oe.length;class Ee extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var je=Ee;const{splitUrl:$e}=f,Se="FLAG",xe="BASIC",Pe="DETAILED",Ae="VERBOSE";let Ie=Pe,Te=!0;const ke=async e=>{const t={metaData:{}};return{ast:t,schemaUri:await qe(e,t)}},Ve=e((({ast:e,schemaUri:t},r,o=Se)=>{if(![Se,xe,Pe,Ae].includes(o))throw Error(`The '${o}' error format is not supported`);const a=[],i=n.subscribe("result",Re(o,a));return De(t,r,e,{}),n.unsubscribe(i),a[0]})),Re=(e,t)=>{const r=[];return(n,o)=>{if("result"===n){const{keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:a}=o,i={keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:a,errors:[]};r.push(i)}else if("result.start"===n)r.push(n);else if("result.end"===n){const n=r.pop();for(;"result.start"!==r[r.length-1];){const t=r.pop(),o=[t];e===xe&&(o.push(...t.errors),delete t.errors),(e===Ae||e!==Se&&!t.valid)&&n.errors.unshift(...o)}r[r.length-1]=n,t[0]=n}}},Ue={},Ce=e=>Ue[e],ze=e=>e in Ue,Ke={},Le={},qe=async(e,t)=>{if(e=await _e(e),!ze(`${e.schemaVersion}#validate`)){const t=await Oe.get(e.schemaVersion);(Oe.getConfig(t.id,"mandatoryVocabularies")||[]).forEach((e=>{if(!t.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)})),Object.entries(t.vocabulary).forEach((([e,r])=>{if(e in Ke)Object.entries(Ke[e]).forEach((([e,r])=>{((e,t)=>{Ue[e]={collectEvaluatedItems:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&new Set,collectEvaluatedProperties:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&[],...t}})(`${t.id}#${e}`,r)}));else if(r)throw Error(`Missing required vocabulary: ${e}`)}))}if(Te&&!e.validated){if(Oe.markValidated(e.id),!(e.schemaVersion in Le)){const t=await Oe.get(e.schemaVersion),r=await ke(t);Le[t.id]=Ve(r)}const t=K.cons(e.schema,e.id),r=Le[e.schemaVersion](t,Ie);if(!r.valid)throw new je(r)}return e.id in t.metaData||(t.metaData[e.id]={id:e.id,dynamicAnchors:e.dynamicAnchors,anchors:e.anchors}),Ce(`${e.schemaVersion}#validate`).compile(e,t)},_e=async e=>Oe.typeOf(e,"string")?_e(await Oe.get(Oe.value(e),e)):e,De=(e,t,r,n)=>{const o=Ne(e,r),a=$e(e)[0];return Ce(o).interpret(e,t,r,{...r.metaData[a].dynamicAnchors,...n})},Ne=(e,t)=>{if(!(e in t))throw Error(`No schema found at ${e}`);return t[e][0]};var Be={validate:async(e,t,r)=>{const n=await ke(e),o=(e,t)=>Ve(n,K.cons(e),t);return void 0===t?o:o(t,r)},compile:ke,interpret:Ve,setMetaOutputFormat:e=>{Ie=e},setShouldMetaValidate:e=>{Te=e},FLAG:Se,BASIC:xe,DETAILED:Pe,VERBOSE:Ae,add:(e,t="",r="")=>{const n=Oe.add(e,t,r);delete Le[n]},getKeyword:Ce,hasKeyword:ze,defineVocabulary:(e,t)=>{Ke[e]=t},compileSchema:qe,interpretSchema:De,collectEvaluatedProperties:(e,t,r,n,o)=>{const a=Ne(e,r);return Ce(a).collectEvaluatedProperties(e,t,r,n,o)},collectEvaluatedItems:(e,t,r,n,o)=>{const a=Ne(e,r);return Ce(a).collectEvaluatedItems(e,t,r,n,o)}};var Fe={compile:e=>Oe.value(e),interpret:()=>!0};var Ze={compile:async(e,t)=>{const r=Oe.uri(e);if(!(r in t)){t[r]=!1;const n=Oe.value(e);if(!["object","boolean"].includes(typeof n))throw Error(`No schema found at '${Oe.uri(e)}'`);t[r]=[`${e.schemaVersion}#validate`,Oe.uri(e),"boolean"==typeof n?n:await ee.pipeline([Oe.entries,ee.map((([t,r])=>[`${e.schemaVersion}#${t}`,r])),ee.filter((([t])=>Be.hasKeyword(t)&&t!==`${e.schemaVersion}#validate`)),ee.map((async([r,n])=>{const o=await Be.getKeyword(r).compile(n,t,e);return[r,Oe.uri(n),o]})),ee.all],e)]}return r},interpret:(e,t,r,o)=>{const[a,i,s]=r[e];n.publishSync("result.start");const c="boolean"==typeof s?s:s.every((([e,a,i])=>{n.publishSync("result.start");const s=Be.getKeyword(e).interpret(i,t,r,o);return n.publishSync("result",{keyword:e,absoluteKeywordLocation:a,instanceLocation:K.uri(t),valid:s,ast:i}),n.publishSync("result.end"),s}));return n.publishSync("result",{keyword:a,absoluteKeywordLocation:i,instanceLocation:K.uri(t),valid:c,ast:e}),n.publishSync("result.end"),c},collectEvaluatedProperties:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&[]:a.filter((([e])=>!o||!e.endsWith("#unevaluatedProperties"))).reduce(((e,[o,,a])=>{const i=e&&Be.getKeyword(o).collectEvaluatedProperties(a,t,r,n);return!1!==i&&[...e,...i]}),[])},collectEvaluatedItems:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&new Set:a.filter((([e])=>!o||!e.endsWith("#unevaluatedItems"))).reduce(((e,[o,,a])=>{const i=!1!==e&&Be.getKeyword(o).collectEvaluatedItems(a,t,r,n);return!1!==i&&new Set([...e,...i])}),new Set)}},Me={metaData:Fe,validate:Ze},We={Core:Be,Schema:Oe,Instance:K,Reference:x,Keywords:Me,InvalidSchemaError:je},Je=We.Core,Ge=We.Schema,He=We.Instance,Qe=We.Reference,Xe=We.Keywords,Ye=We.InvalidSchemaError;exports.Core=Je,exports.Instance=He,exports.InvalidSchemaError=Ye,exports.Keywords=Xe,exports.Reference=Qe,exports.Schema=Ge,exports.default=We; | ||
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}Object.defineProperty(exports,"__esModule",{value:!0});var t=e(require("url")),r=function(e,t){return function r(){null==t&&(t=e.length);var n=[].slice.call(arguments);return n.length>=t?e.apply(this,n):function(){return r.apply(this,n.concat([].slice.call(arguments)))}}};var n="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var o,a=(function(e,t){var r;r={},("object"==typeof window&&window||n).PubSub=r,function(e){var t={},r=-1,n="*";function o(e){var t;for(t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function a(e){return function(){throw e}}function i(e,t,r){try{e(t,r)}catch(e){setTimeout(a(e),0)}}function s(e,t,r){e(t,r)}function u(e,r,n,o){var a,u=t[r],l=o?s:i;if(Object.prototype.hasOwnProperty.call(t,r))for(a in u)Object.prototype.hasOwnProperty.call(u,a)&&l(u[a],e,n)}function l(e,t,r){return function(){var o=String(e),a=o.lastIndexOf(".");for(u(e,e,t,r);-1!==a;)a=(o=o.substr(0,a)).lastIndexOf("."),u(e,o,t,r);u(e,n,t,r)}}function c(e){var r=String(e);return Boolean(Object.prototype.hasOwnProperty.call(t,r)&&o(t[r]))}function f(e){for(var t=String(e),r=c(t)||c(n),o=t.lastIndexOf(".");!r&&-1!==o;)o=(t=t.substr(0,o)).lastIndexOf("."),r=c(t);return r}function h(e,t,r,n){var o=l(e="symbol"==typeof e?e.toString():e,t,n);return!!f(e)&&(!0===r?o():setTimeout(o,0),!0)}e.publish=function(t,r){return h(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return h(t,r,!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(t,e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeAll=function(t){return e.subscribe(n,t)},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n,o=0;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)){for(n in t[r])o++;break}return o},e.getSubscriptions=function(e){var r,n=[];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,a,i=function(e){var r;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e))return!0;return!1},s="string"==typeof r&&(Object.prototype.hasOwnProperty.call(t,r)||i(r)),u=!s&&"string"==typeof r,l="function"==typeof r,c=!1;if(!s){for(n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(o=t[n],u&&o[r]){delete o[r],c=r;break}if(l)for(a in o)Object.prototype.hasOwnProperty.call(o,a)&&o[a]===r&&(delete o[a],c=!0)}return c}e.clearSubscriptions(r)}}(r),void 0!==e&&e.exports&&(t=e.exports=r),t.PubSub=r,e.exports=t=r}(o={exports:{}},o.exports),o.exports);a.PubSub;var i=function(e,t){if(e=e.trim(),(t=t.trim()).startsWith("about:"))return t;const r=function(e){const t={host:"",path:"",query:"",protocol:""};let r=e,n=e.indexOf("//");t.protocol=r.substring(0,n),n+=2;const o=e.indexOf("/",n),a=e.indexOf("?"),i=e.indexOf("#");-1!==i&&(r=r.substring(0,i));if(-1!==a){const e=r.substring(a);t.query=e,r=r.substring(0,a)}if(-1!==o){const e=r.substring(0,o);t.host=e,r=r.substring(o),t.path=r}else t.host=r;return t}(e),n=function(e){const t={href:e,hash:"",query:"",netPath:!1,absolutePath:!1,relativePath:!1};if(l.test(e))return t.netPath=!0,t;"/"===e[0]?t.absolutePath=!0:""!==e&&(t.relativePath=!0);let r=e;const n=e.indexOf("?"),o=e.indexOf("#");if(-1!==o){const e=r.substring(o);t.hash=e,r=r.substring(0,o)}if(-1!==n){const e=r.substring(n);t.query=e,r=r.substring(0,n)}return t.path=r,t}(t);if(!r.protocol&&!n.netPath)throw new Error("Error, protocol is not specified");if(n.netPath)return function(e){return e.startsWith("//")}(n.href)&&(n.href=r.protocol+n.href),function(e){const t=e.indexOf("//")+2,r=!e.includes("/",t),n=!e.includes("?",t),o=!e.includes("#",t);return r&&n&&o}(n.href)?s(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+u(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let a,i=r.path,s=r.host;return 0===e.length?a=i:(i=i.substring(0,i.lastIndexOf("/")),a=u(i+"/"+e)),s+=""!==a||t||o?a+t+o:"/",s}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:s(e)}};function s(e){return e+("/"===e[e.length-1]?"":"/")}function u(e){let t=e.split("/");""===t[0]&&(t=t.slice(1));let r=[];return t.forEach(((e,n)=>{"."!==e&&(".."===e?r.pop():""===e&&n!==t.length-1||r.push(e))})),"/"+r.join("/")}const l=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");const c={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},f=e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),o=e.slice(r+1);return[decodeURI(n),decodeURI(o)]},h=e=>{const t=RegExp(/^(.+):\/\//).exec(e);return t?t[1]:""};var m={jsonTypeOf:(e,t)=>c[t](e),splitUrl:f,safeResolveUrl:(e,t)=>{const r=i(e,t),n=f(e)[0];if(n&&"file"===h(r)&&"file"!==h(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r}};const p=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(w)},d=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:d(e,E(t,o,n),r,g(o,n))}}if(Array.isArray(t)){const n=[...t];return n[O(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:E(t,e[0],n)},y=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||I(t)){const o=e.shift();y(e,E(t,o,n),r,g(o,n))}else{t[O(t,e[0])]=r}},v=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=E(t,n,r);return{...t,[n]:v(e,o,g(n,r))}}if(Array.isArray(t))return t.filter(((t,r)=>r!=e[0]));if("object"==typeof t&&null!==t){const{[e[0]]:r,...n}=t;return n}return E(t,e[0],r)}},b=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=E(t,n,r);b(e,o,g(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:E(t,e[0],r)},g=r(((e,t)=>t+"/"+x(e))),x=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),w=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),O=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,E=(e,t,r="")=>{if(void 0===e)throw TypeError(`Value at '${r}' is undefined and does not have property '${t}'`);if(null===e)throw TypeError(`Value at '${r}' is null and does not have property '${t}'`);if(I(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[O(e,t)]},I=e=>null===e||"object"!=typeof e;var S={nil:"",append:g,get:(e,t)=>{const r=p(e),n=e=>r.reduce((([e,t],r)=>[E(e,r,t),g(r,t)]),[e,""])[0];return void 0===t?n:n(t)},set:(e,t,n)=>{const o=p(e),a=r(((e,t)=>d(o,e,t,"")));return void 0===t?a:a(t,n)},assign:(e,t,n)=>{const o=p(e),a=r(((e,t)=>y(o,e,t,"")));return void 0===t?a:a(t,n)},unset:(e,t)=>{const r=p(e),n=e=>v(r,e,"");return void 0===t?n:n(t)},remove:(e,t)=>{const r=p(e),n=e=>b(r,e,"");return void 0===t?n:n(t)}};S.nil,S.append,S.get,S.set,S.assign,S.unset,S.remove;const j=Symbol("$__value"),P=Symbol("$__href");var A={cons:(e,t)=>Object.freeze({[P]:e,[j]:t}),isReference:e=>e&&void 0!==e[P],href:e=>e[P],value:e=>e[j]};const{jsonTypeOf:T}=m,R=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),$=e=>A.isReference(e.value)?A.value(e.value):e.value,V=r(((e,t)=>T($(e),t))),k=(e,t)=>Object.freeze({...t,pointer:S.append(e,t.pointer),value:$(t)[e]}),L=r(((e,t)=>$(t).map(((r,n,o,a)=>e(k(n,t),n,o,a))))),H=r(((e,t)=>$(t).map(((e,r,n,o)=>k(r,t))).filter(((t,r,n,o)=>e(t,r,n,o))))),U=r(((e,t,r)=>$(r).reduce(((t,n,o)=>e(t,k(o,r),o)),t))),q=r(((e,t)=>$(t).every(((r,n,o,a)=>e(k(n,t),n,o,a))))),D=r(((e,t)=>$(t).some(((r,n,o,a)=>e(k(n,t),n,o,a)))));var _={nil:R,cons:(e,t="")=>Object.freeze({...R,id:t,instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:$,has:(e,t)=>e in $(t),typeOf:V,step:k,entries:e=>Object.keys($(e)).map((t=>[t,k(t,e)])),keys:e=>Object.keys($(e)),map:L,filter:H,reduce:U,every:q,some:D,length:e=>$(e).length},Q=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,C=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,z=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,B=/\\([\u000b\u0020-\u00ff])/g,K=/([\\"])/g,N=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function M(e){var t=String(e);if(z.test(t))return t;if(t.length>0&&!C.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(K,"\\$1")+'"'}function F(e){this.parameters=Object.create(null),this.type=e}var J={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!N.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,a=Object.keys(t).sort(),i=0;i<a.length;i++){if(o=a[i],!z.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+M(t[o])}return n},parse:function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;"function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.substr(0,r).trim():t.trim();if(!N.test(n))throw new TypeError("invalid media type");var o=new F(n.toLowerCase());if(-1!==r){var a,i,s;for(Q.lastIndex=r;i=Q.exec(t);){if(i.index!==r)throw new TypeError("invalid parameter format");r+=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(r!==t.length)throw new TypeError("invalid parameter format")}return o}},W=async e=>Object.entries(await e),Z=r((async(e,t)=>(await t).map(e))),G=r((async(e,t,r)=>(await r).reduce((async(t,r)=>e(await t,r)),t))),X=r((async(e,t,r={})=>G((async(t,r)=>await e(r)?t.concat([r]):t),[],t,r))),Y=r((async(e,t)=>{const r=await Z(e,t);return(await Promise.all(r)).some((e=>e))})),ee=r((async(e,t)=>{const r=await Z(e,t);return(await Promise.all(r)).every((e=>e))})),te=r(((e,t)=>e.reduce((async(e,t)=>t(await e)),t))),re={entries:W,map:Z,filter:X,reduce:G,some:Y,every:ee,pipeline:te,all:e=>Promise.all(e),allValues:e=>te([W,G((async(e,[t,r])=>(e[t]=await r,e)),{})],e)};re.entries,re.map,re.filter,re.reduce,re.some,re.every,re.pipeline,re.all,re.allValues;var ne={ABSOLUTE:"absolute",PATH_RELATIVE:"pathRelative",ROOT_RELATIVE:"rootRelative",SHORTEST:"shortest"};function oe(e,t){var r=t.removeEmptyQueries&&e.extra.relation.minimumPort;return e.query.string[r?"stripped":"full"]}function ae(e,t){return!e.extra.relation.minimumQuery||t.output===ne.ABSOLUTE||t.output===ne.ROOT_RELATIVE}function ie(e,t){var r=t.removeDirectoryIndexes&&e.extra.resourceIsIndex,n=e.extra.relation.minimumResource&&t.output!==ne.ABSOLUTE&&t.output!==ne.ROOT_RELATIVE;return!!e.resource&&!n&&!r}var se=function(e,t){var r="";return r+=function(e,t){var r="";return(e.extra.relation.maximumHost||t.output===ne.ABSOLUTE)&&(e.extra.relation.minimumScheme&&t.schemeRelative&&t.output!==ne.ABSOLUTE?r+="//":r+=e.scheme+"://"),r}(e,t),r+=function(e,t){return!e.auth||t.removeAuth||!e.extra.relation.maximumHost&&t.output!==ne.ABSOLUTE?"":e.auth+"@"}(e,t),r+=function(e,t){return e.host.full&&(e.extra.relation.maximumAuth||t.output===ne.ABSOLUTE)?e.host.full:""}(e,t),r+=function(e,t){return e.port&&!e.extra.portIsDefault&&e.extra.relation.maximumHost?":"+e.port:""}(e),r+=function(e,t){var r="",n=e.path.absolute.string,o=e.path.relative.string,a=ie(e,t);if(e.extra.relation.maximumHost||t.output===ne.ABSOLUTE||t.output===ne.ROOT_RELATIVE)r=n;else if(o.length<=n.length&&t.output===ne.SHORTEST||t.output===ne.PATH_RELATIVE){if(""===(r=o)){var i=ae(e,t)&&!!oe(e,t);e.extra.relation.maximumPath&&!a?r="./":!e.extra.relation.overridesQuery||a||i||(r="./")}}else r=n;return"/"!==r||a||!t.removeRootTrailingSlash||e.extra.relation.minimumPort&&t.output!==ne.ABSOLUTE||(r=""),r}(e,t),r+=function(e,t){return ie(e,t)?e.resource:""}(e,t),r+=function(e,t){return ae(e,t)?oe(e,t):""}(e,t),r+=function(e,t){return e.hash?e.hash:""}(e)};var ue={clone:function e(t){if(t instanceof Object){var r=t instanceof Array?[]:{};for(var n in t)t.hasOwnProperty(n)&&(r[n]=e(t[n]));return r}return t},isPlainObject:function(e){return!!e&&"object"==typeof e&&e.constructor===Object},shallowMerge:function(e,t){if(e instanceof Object&&t instanceof Object)for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e}};function le(e,t){return t instanceof Object&&e instanceof Object?t instanceof Array&&e instanceof Array?t.concat(e):ue.shallowMerge(e,t):e}var ce=function(e,t){if(ue.isPlainObject(e)){var r={};for(var n in t)t.hasOwnProperty(n)&&(void 0!==e[n]?r[n]=le(e[n],t[n]):r[n]=t[n]);return r}return t};var fe=function(e){var t=!(e.scheme||e.auth||e.host.full||e.port),r=t&&!e.path.absolute.string,n=r&&!e.resource,o=n&&!e.query.string.full.length,a=o&&!e.hash;e.extra.hrefInfo.minimumPathOnly=t,e.extra.hrefInfo.minimumResourceOnly=r,e.extra.hrefInfo.minimumQueryOnly=n,e.extra.hrefInfo.minimumHashOnly=o,e.extra.hrefInfo.empty=a};var he=function(e,t){if(t.ignore_www){var r=e.host.full;if(r){var n=r;0===r.indexOf("www.")&&(n=r.substr(4)),e.host.stripped=n}}};function me(e){if("/"!==e){var t=[];return e.split("/").forEach((function(e){""!==e&&t.push(e)})),t}return[]}var pe=function(e,t){var r=e.path.absolute.string;if(r){var n=r.lastIndexOf("/");if(n>-1){if(++n<r.length){var o=r.substr(n);"."!==o&&".."!==o?(e.resource=o,r=r.substr(0,n)):r+="/"}e.path.absolute.string=r,e.path.absolute.array=me(r)}else"."===r||".."===r?(r+="/",e.path.absolute.string=r,e.path.absolute.array=me(r)):(e.resource=r,e.path.absolute.string=null);e.extra.resourceIsIndex=function(e,t){var r=!1;return t.directoryIndexes.every((function(t){return t!==e||(r=!0,!1)})),r}(e.resource,t)}};var de=function(e,t){var r=-1;for(var n in t.defaultPorts)if(n===e.scheme&&t.defaultPorts.hasOwnProperty(n)){r=t.defaultPorts[n];break}r>-1&&(r=r.toString(),null===e.port&&(e.port=r),e.extra.portIsDefault=e.port===r)},ye=Object.prototype.hasOwnProperty;function ve(e,t){var r=0,n="";for(var o in e)if(""!==o&&!0===ye.call(e,o)){var a=e[o];""===a&&t||(n+=1==++r?"?":"&",o=encodeURIComponent(o),n+=""!==a?o+"="+encodeURIComponent(a).replace(/%20/g,"+"):o)}return n}var be=function(e,t){e.query.string.full=ve(e.query.object,!1),t.removeEmptyQueries&&(e.query.string.stripped=ve(e.query.object,!0))},ge=t.default.parse;var xe=function(e,t){return function(e,t){var r=!0;return t.rejectedSchemes.every((function(t){return r=!(0===e.indexOf(t+":"))})),r}(e,t)?(r=ge(e,!0,t.slashesDenoteHost),(n=r.protocol)&&n.indexOf(":")===n.length-1&&(n=n.substr(0,n.length-1)),r.host={full:r.hostname,stripped:null},r.path={absolute:{array:null,string:r.pathname},relative:{array:null,string:null}},r.query={object:r.query,string:{full:null,stripped:null}},r.extra={hrefInfo:{minimumPathOnly:null,minimumResourceOnly:null,minimumQueryOnly:null,minimumHashOnly:null,empty:null,separatorOnlyQuery:"?"===r.search},portIsDefault:null,relation:{maximumScheme:null,maximumAuth:null,maximumHost:null,maximumPort:null,maximumPath:null,maximumResource:null,maximumQuery:null,maximumHash:null,minimumScheme:null,minimumAuth:null,minimumHost:null,minimumPort:null,minimumPath:null,minimumResource:null,minimumQuery:null,minimumHash:null,overridesQuery:null},resourceIsIndex:null,slashes:r.slashes},r.resource=null,r.scheme=n,delete r.hostname,delete r.pathname,delete r.protocol,delete r.search,delete r.slashes,r):{href:e,valid:!1};var r,n};var we={join:function(e){return e.length>0?e.join("/")+"/":""},resolveDotSegments:function(e){var t=[];return e.forEach((function(e){".."!==e?"."!==e&&t.push(e):t.length>0&&t.splice(t.length-1,1)})),t}};function Oe(e,t){var r=xe(e,t);return!1===r.valid||(he(r,t),de(r,t),pe(r,t),be(r,t),fe(r)),r}var Ee={from:function(e,t,r){if(e){var n=Oe(e,t),o=we.resolveDotSegments(n.path.absolute.array);return n.path.absolute.array=o,n.path.absolute.string="/"+we.join(o),n}return r},to:Oe};var Ie={pathOn:function(e,t,r){var n=e.extra.hrefInfo.minimumQueryOnly,o=e.extra.hrefInfo.minimumHashOnly,a=e.extra.hrefInfo.empty,i=e.extra.relation.minimumPort,s=e.extra.relation.minimumScheme,u=i&&e.path.absolute.string===t.path.absolute.string,l=e.resource===t.resource||!e.resource&&t.extra.resourceIsIndex||r.removeDirectoryIndexes&&e.extra.resourceIsIndex&&!t.resource,c=u&&(l||n||o||a),f=r.removeEmptyQueries?"stripped":"full",h=e.query.string[f],m=t.query.string[f],p=c&&!!h&&h===m||(o||a)&&!e.extra.hrefInfo.separatorOnlyQuery,d=p&&e.hash===t.hash;e.extra.relation.minimumPath=u,e.extra.relation.minimumResource=c,e.extra.relation.minimumQuery=p,e.extra.relation.minimumHash=d,e.extra.relation.maximumPort=!s||s&&!u,e.extra.relation.maximumPath=!s||s&&!c,e.extra.relation.maximumResource=!s||s&&!p,e.extra.relation.maximumQuery=!s||s&&!d,e.extra.relation.maximumHash=!s||s&&!d,e.extra.relation.overridesQuery=u&&e.extra.relation.maximumResource&&!p&&!!m},upToPath:function(e,t,r){var n=e.extra.hrefInfo.minimumPathOnly,o=e.scheme===t.scheme||!e.scheme,a=o&&(e.auth===t.auth||r.removeAuth||n),i=r.ignore_www?"stripped":"full",s=a&&(e.host[i]===t.host[i]||n),u=s&&(e.port===t.port||n);e.extra.relation.minimumScheme=o,e.extra.relation.minimumAuth=a,e.extra.relation.minimumHost=s,e.extra.relation.minimumPort=u,e.extra.relation.maximumScheme=!o||o&&!a,e.extra.relation.maximumAuth=!o||o&&!s,e.extra.relation.maximumHost=!o||o&&!u}};var Se=function(e,t,r){Ie.upToPath(e,t,r),e.extra.relation.minimumScheme&&(e.scheme=t.scheme),e.extra.relation.minimumAuth&&(e.auth=t.auth),e.extra.relation.minimumHost&&(e.host=ue.clone(t.host)),e.extra.relation.minimumPort&&function(e,t){e.port=t.port,e.extra.portIsDefault=t.extra.portIsDefault}(e,t),e.extra.relation.minimumScheme&&function(e,t){if(e.extra.relation.maximumHost||!e.extra.hrefInfo.minimumResourceOnly){var r=e.path.absolute.array,n="/";r?(e.extra.hrefInfo.minimumPathOnly&&0!==e.path.absolute.string.indexOf("/")&&(r=t.path.absolute.array.concat(r)),r=we.resolveDotSegments(r),n+=we.join(r)):r=[],e.path.absolute.array=r,e.path.absolute.string=n}else e.path=ue.clone(t.path)}(e,t),Ie.pathOn(e,t,r),e.extra.relation.minimumResource&&function(e,t){e.resource=t.resource,e.extra.resourceIsIndex=t.extra.resourceIsIndex}(e,t),e.extra.relation.minimumQuery&&(e.query=ue.clone(t.query)),e.extra.relation.minimumHash&&(e.hash=t.hash)};var je=function(e,t,r){if(e.extra.relation.minimumScheme){var n=(o=e.path.absolute.array,a=t.path.absolute.array,i=[],s=!0,u=-1,a.forEach((function(e,t){s&&(o[t]!==e?s=!1:u=t),s||i.push("..")})),o.forEach((function(e,t){t>u&&i.push(e)})),i);e.path.relative.array=n,e.path.relative.string=we.join(n)}var o,a,i,s,u};var Pe=function(e,t,r){return Se(t,e,r),je(t,e),t};function Ae(e,t){this.options=ce(t,{defaultPorts:{ftp:21,http:80,https:443},directoryIndexes:["index.html"],ignore_www:!1,output:Ae.SHORTEST,rejectedSchemes:["data","javascript","mailto"],removeAuth:!1,removeDirectoryIndexes:!0,removeEmptyQueries:!1,removeRootTrailingSlash:!0,schemeRelative:!0,site:void 0,slashesDenoteHost:!0}),this.from=Ee.from(e,this.options,null)}Ae.prototype.relate=function(e,t,r){if(ue.isPlainObject(t)?(r=t,t=e,e=null):t||(t=e,e=null),r=ce(r,this.options),e=e||r.site,!(e=Ee.from(e,r,this.from))||!e.href)throw new Error("from value not defined.");if(e.extra.hrefInfo.minimumPathOnly)throw new Error("from value supplied is not absolute: "+e.href);return!1===(t=Ee.to(t,r)).valid?t.href:(t=Pe(e,t,r),t=se(t,r))},Ae.relate=function(e,t,r){return(new Ae).relate(e,t,r)},ue.shallowMerge(Ae,ne);var Te=Ae,Re=fetch;const{jsonTypeOf:$e,splitUrl:Ve,safeResolveUrl:ke}=m,Le={},He={},Ue=(e,t)=>{const r=e in He?He[e]:e;if(r in Le)return Le[r][t]},qe={},De={},_e=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=Ve(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=Ue(n,"baseToken"),a=Ue(n,"anchorToken"),i=Ve(t)[0];if(!i&&!Ve(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const s=ke(i,e[o]||""),[u,l]=Ve(s);delete e[o],l&&o===a&&(e[a]=a!==o?encodeURI(l):`#${encodeURI(l)}`),i&&(De[i]=u);const c={},f=Ue(n,"recursiveAnchorToken");let h;!0===e[f]&&(c[""]=`${u}#`,e[a]="",delete e[f]);const m=Ue(n,"vocabularyToken");$e(e[m],"object")?(He[u]=n,h=e[m],delete e[m]):(He[u]=n,h={[n]:!0});const p={"":""};return qe[u]={id:u,schemaVersion:n,schema:Qe(e,u,n,S.nil,p,c),anchors:p,dynamicAnchors:c,vocabulary:h,validated:!1},u},Qe=(e,t,r,n,o,a)=>{if($e(e,"object")){const i="string"==typeof e.$schema?Ve(e.$schema)[0]:r,s=Ue(i,"embeddedToken"),u=Ue(i,"anchorToken");if("string"==typeof e[s]&&(s!==u||"#"!==e[s][0])){const n=ke(t,e[s]);return e[s]=n,_e(e,n,r),A.cons(e[s],e)}const l=Ue(r,"anchorToken"),c=Ue(r,"dynamicAnchorToken");"string"==typeof e[c]&&(a[e[c]]=`${t}#${encodeURI(n)}`,o[e[c]]=n,delete e[c]);const f=Ue(r,"embeddedToken");if("string"==typeof e[l]){const t=l!==f?e[l]:e[l].slice(1);o[t]=n,delete e[l]}const h=Ue(r,"jrefToken");if("string"==typeof e[h])return A.cons(e[h],e);for(const i in e)e[i]=Qe(e[i],t,r,S.append(i,n),o,a);return e}return Array.isArray(e)?e.map(((e,i)=>Qe(e,t,r,S.append(i,n),o,a))):e},Ce=e=>qe[De[e]]||qe[e],ze=Object.freeze({id:"",schemaVersion:void 0,vocabulary:{},pointer:S.nil,schema:void 0,value:void 0,anchors:{},dynamicAnchors:{},validated:!0}),Be=async(e,t=ze)=>{const r=ke(Me(t),e),[n,o]=Ve(r);if(!(e=>e in qe||e in De)(n)){const e=await Re(n,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error(`Failed to retrieve schema with id: ${n}`);if(e.headers.has("content-type")){const t=J.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${n} is not a schema. Found a document with media type: ${t}`)}_e(await e.json(),n)}const a=Ce(n),i="/"!==o[0]?Ne(a,o):o,s=Object.freeze({...a,pointer:i,value:S.get(i,a.schema)});return Ke(s)},Ke=e=>A.isReference(e.value)?Be(A.href(e.value),e):e,Ne=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},Me=e=>`${e.id}#${encodeURI(e.pointer)}`,Fe=e=>A.isReference(e.value)?A.value(e.value):e.value,Je=(e,t)=>{const r=Ce(t.id),n=Object.freeze({...t,pointer:S.append(e,t.pointer),value:Fe(t)[e],validated:r.validated});return Ke(n)},We=r(((e,t)=>re.pipeline([Fe,re.map((async(r,n)=>e(await Je(n,t),n))),re.all],t))),Ze={parentId:"",parentDialect:"",includeEmbedded:!0},Ge=(e,t)=>t.startsWith("file://")?""===e?"":Te.relate(e,t):t;var Xe={setConfig:(e,t,r)=>{Le[e]||(Le[e]={}),Le[e][t]=r},getConfig:Ue,add:_e,get:Be,markValidated:e=>{qe[e].validated=!0},uri:Me,value:Fe,getAnchorPointer:Ne,typeOf:(e,t)=>$e(Fe(e),t),has:(e,t)=>e in Fe(t),step:Je,keys:e=>Object.keys(Fe(e)),entries:e=>re.pipeline([Fe,Object.keys,re.map((async t=>[t,await Je(t,e)])),re.all],e),map:We,length:e=>Fe(e).length,toSchema:(e,t={})=>{const r={...Ze,...t},n=JSON.parse(JSON.stringify(e.schema,((t,n)=>{if(!A.isReference(n))return n;const o=A.value(n),a=o.$schema||e.schemaVersion,i=Ue(a,"embeddedToken");return!r.includeEmbedded&&i in o?void 0:A.value(n)}))),o=Ue(e.schemaVersion,"dynamicAnchorToken");Object.entries(e.dynamicAnchors).forEach((([e,t])=>{const r=Ve(t)[1];S.assign(r,n,{[o]:e,...S.get(r,n)})}));const a=Ue(e.schemaVersion,"anchorToken");Object.entries(e.anchors).filter((([e])=>""!==e)).forEach((([e,t])=>{S.assign(t,n,{[a]:e,...S.get(t,n)})}));const i=Ue(e.schemaVersion,"baseToken"),s=Ge(r.parentId,e.id),u=r.parentDialect===e.schemaVersion?"":e.schemaVersion;return{...s&&{[i]:s},...u&&{$schema:u},...n}}};Xe.setConfig,Xe.getConfig,Xe.add,Xe.get,Xe.markValidated,Xe.uri,Xe.value,Xe.getAnchorPointer,Xe.typeOf,Xe.has,Xe.step,Xe.keys,Xe.entries,Xe.map,Xe.length,Xe.toSchema;class Ye extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var et=Ye;const{splitUrl:tt}=m,rt="FLAG",nt="BASIC",ot="DETAILED",at="VERBOSE";let it=ot,st=!0;const ut=async e=>{const t={metaData:{}};return{ast:t,schemaUri:await yt(e,t)}},lt=r((({ast:e,schemaUri:t},r,n=rt)=>{if(![rt,nt,ot,at].includes(n))throw Error(`The '${n}' error format is not supported`);const o=[],i=a.subscribe("result",ct(n,o));return bt(t,r,e,{}),a.unsubscribe(i),o[0]})),ct=(e,t)=>{const r=[];return(n,o)=>{if("result"===n){const{keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:a}=o,i={keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:a,errors:[]};r.push(i)}else if("result.start"===n)r.push(n);else if("result.end"===n){const n=r.pop();for(;"result.start"!==r[r.length-1];){const t=r.pop(),o=[t];e===nt&&(o.push(...t.errors),delete t.errors),(e===at||e!==rt&&!t.valid)&&n.errors.unshift(...o)}r[r.length-1]=n,t[0]=n}}},ft={},ht=e=>ft[e],mt=e=>e in ft,pt={},dt={},yt=async(e,t)=>{if(e=await vt(e),!mt(`${e.schemaVersion}#validate`)){const t=await Xe.get(e.schemaVersion);(Xe.getConfig(t.id,"mandatoryVocabularies")||[]).forEach((e=>{if(!t.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)})),Object.entries(t.vocabulary).forEach((([e,r])=>{if(e in pt)Object.entries(pt[e]).forEach((([e,r])=>{((e,t)=>{ft[e]={collectEvaluatedItems:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&new Set,collectEvaluatedProperties:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&[],...t}})(`${t.id}#${e}`,r)}));else if(r)throw Error(`Missing required vocabulary: ${e}`)}))}if(st&&!e.validated){if(Xe.markValidated(e.id),!(e.schemaVersion in dt)){const t=await Xe.get(e.schemaVersion),r=await ut(t);dt[t.id]=lt(r)}const t=_.cons(e.schema,e.id),r=dt[e.schemaVersion](t,it);if(!r.valid)throw new et(r)}return e.id in t.metaData||(t.metaData[e.id]={id:e.id,dynamicAnchors:e.dynamicAnchors,anchors:e.anchors}),ht(`${e.schemaVersion}#validate`).compile(e,t)},vt=async e=>Xe.typeOf(e,"string")?vt(await Xe.get(Xe.value(e),e)):e,bt=(e,t,r,n)=>{const o=gt(e,r),a=tt(e)[0];return ht(o).interpret(e,t,r,{...r.metaData[a].dynamicAnchors,...n})},gt=(e,t)=>{if(!(e in t))throw Error(`No schema found at ${e}`);return t[e][0]};var xt={validate:async(e,t,r)=>{const n=await ut(e),o=(e,t)=>lt(n,_.cons(e),t);return void 0===t?o:o(t,r)},compile:ut,interpret:lt,setMetaOutputFormat:e=>{it=e},setShouldMetaValidate:e=>{st=e},FLAG:rt,BASIC:nt,DETAILED:ot,VERBOSE:at,add:(e,t="",r="")=>{const n=Xe.add(e,t,r);delete dt[n]},getKeyword:ht,hasKeyword:mt,defineVocabulary:(e,t)=>{pt[e]=t},compileSchema:yt,interpretSchema:bt,collectEvaluatedProperties:(e,t,r,n,o)=>{const a=gt(e,r);return ht(a).collectEvaluatedProperties(e,t,r,n,o)},collectEvaluatedItems:(e,t,r,n,o)=>{const a=gt(e,r);return ht(a).collectEvaluatedItems(e,t,r,n,o)}};var wt={compile:e=>Xe.value(e),interpret:()=>!0};var Ot={compile:async(e,t)=>{const r=Xe.uri(e);if(!(r in t)){t[r]=!1;const n=Xe.value(e);if(!["object","boolean"].includes(typeof n))throw Error(`No schema found at '${Xe.uri(e)}'`);t[r]=[`${e.schemaVersion}#validate`,Xe.uri(e),"boolean"==typeof n?n:await re.pipeline([Xe.entries,re.map((([t,r])=>[`${e.schemaVersion}#${t}`,r])),re.filter((([t])=>xt.hasKeyword(t)&&t!==`${e.schemaVersion}#validate`)),re.map((async([r,n])=>{const o=await xt.getKeyword(r).compile(n,t,e);return[r,Xe.uri(n),o]})),re.all],e)]}return r},interpret:(e,t,r,n)=>{const[o,i,s]=r[e];a.publishSync("result.start");const u="boolean"==typeof s?s:s.every((([e,o,i])=>{a.publishSync("result.start");const s=xt.getKeyword(e).interpret(i,t,r,n);return a.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:_.uri(t),valid:s,ast:i}),a.publishSync("result.end"),s}));return a.publishSync("result",{keyword:o,absoluteKeywordLocation:i,instanceLocation:_.uri(t),valid:u,ast:e}),a.publishSync("result.end"),u},collectEvaluatedProperties:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&[]:a.filter((([e])=>!o||!e.endsWith("#unevaluatedProperties"))).reduce(((e,[o,,a])=>{const i=e&&xt.getKeyword(o).collectEvaluatedProperties(a,t,r,n);return!1!==i&&[...e,...i]}),[])},collectEvaluatedItems:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&new Set:a.filter((([e])=>!o||!e.endsWith("#unevaluatedItems"))).reduce(((e,[o,,a])=>{const i=!1!==e&&xt.getKeyword(o).collectEvaluatedItems(a,t,r,n);return!1!==i&&new Set([...e,...i])}),new Set)}},Et={metaData:wt,validate:Ot},It={Core:xt,Schema:Xe,Instance:_,Reference:A,Keywords:Et,InvalidSchemaError:et},St=It.Core,jt=It.Schema,Pt=It.Instance,At=It.Reference,Tt=It.Keywords,Rt=It.InvalidSchemaError;exports.Core=St,exports.Instance=Pt,exports.InvalidSchemaError=Rt,exports.Keywords=Tt,exports.Reference=At,exports.Schema=jt,exports.default=It; | ||
//# sourceMappingURL=json-schema-core-cjs.min.js.map |
@@ -1,2 +0,2 @@ | ||
var e=function(e,t){return function r(){null==t&&(t=e.length);var n=[].slice.call(arguments);return n.length>=t?e.apply(this,n):function(){return r.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:{};var r,n=(function(e,r){var n;n={},("object"==typeof window&&window||t).PubSub=n,function(e){var t={},r=-1,n="*";function o(e){var t;for(t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function a(e){return function(){throw e}}function i(e,t,r){try{e(t,r)}catch(e){setTimeout(a(e),0)}}function s(e,t,r){e(t,r)}function c(e,r,n,o){var a,c=t[r],l=o?s:i;if(Object.prototype.hasOwnProperty.call(t,r))for(a in c)Object.prototype.hasOwnProperty.call(c,a)&&l(c[a],e,n)}function l(e,t,r){return function(){var o=String(e),a=o.lastIndexOf(".");for(c(e,e,t,r);-1!==a;)a=(o=o.substr(0,a)).lastIndexOf("."),c(e,o,t,r);c(e,n,t,r)}}function u(e){var r=String(e);return Boolean(Object.prototype.hasOwnProperty.call(t,r)&&o(t[r]))}function f(e){for(var t=String(e),r=u(t)||u(n),o=t.lastIndexOf(".");!r&&-1!==o;)o=(t=t.substr(0,o)).lastIndexOf("."),r=u(t);return r}function p(e,t,r,n){var o=l(e="symbol"==typeof e?e.toString():e,t,n);return!!f(e)&&(!0===r?o():setTimeout(o,0),!0)}e.publish=function(t,r){return p(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return p(t,r,!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(t,e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeAll=function(t){return e.subscribe(n,t)},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n,o=0;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)){for(n in t[r])o++;break}return o},e.getSubscriptions=function(e){var r,n=[];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,a,i=function(e){var r;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e))return!0;return!1},s="string"==typeof r&&(Object.prototype.hasOwnProperty.call(t,r)||i(r)),c=!s&&"string"==typeof r,l="function"==typeof r,u=!1;if(!s){for(n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(o=t[n],c&&o[r]){delete o[r],u=r;break}if(l)for(a in o)Object.prototype.hasOwnProperty.call(o,a)&&o[a]===r&&(delete o[a],u=!0)}return u}e.clearSubscriptions(r)}}(n),void 0!==e&&e.exports&&(r=e.exports=n),r.PubSub=n,e.exports=r=n}(r={exports:{}},r.exports),r.exports);n.PubSub;var o=function(e,t){if(e=e.trim(),(t=t.trim()).startsWith("about:"))return t;const r=function(e){const t={host:"",path:"",query:"",protocol:""};let r=e,n=e.indexOf("//");t.protocol=r.substring(0,n),n+=2;const o=e.indexOf("/",n),a=e.indexOf("?"),i=e.indexOf("#");-1!==i&&(r=r.substring(0,i));if(-1!==a){const e=r.substring(a);t.query=e,r=r.substring(0,a)}if(-1!==o){const e=r.substring(0,o);t.host=e,r=r.substring(o),t.path=r}else t.host=r;return t}(e),n=function(e){const t={href:e,hash:"",query:"",netPath:!1,absolutePath:!1,relativePath:!1};if(s.test(e))return t.netPath=!0,t;"/"===e[0]?t.absolutePath=!0:""!==e&&(t.relativePath=!0);let r=e;const n=e.indexOf("?"),o=e.indexOf("#");if(-1!==o){const e=r.substring(o);t.hash=e,r=r.substring(0,o)}if(-1!==n){const e=r.substring(n);t.query=e,r=r.substring(0,n)}return t.path=r,t}(t);if(!r.protocol&&!n.netPath)throw new Error("Error, protocol is not specified");if(n.netPath)return n.href.startsWith("//")&&(n.href=r.protocol+n.href),function(e){const t=e.indexOf("//")+2,r=!e.includes("/",t),n=!e.includes("?",t),o=!e.includes("#",t);return r&&n&&o}(n.href)?a(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+i(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let a,s=r.path,c=r.host;return 0===e.length?a=s:(s=s.substring(0,s.lastIndexOf("/")),a=i(s+"/"+e)),c+=""!==a||t||o?a+t+o:"/",c}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:a(e)}};function a(e){return e+("/"===e[e.length-1]?"":"/")}function i(e){let t=e.split("/");""===t[0]&&(t=t.slice(1));let r=[];return t.forEach(((e,n)=>{"."!==e&&(".."===e?r.pop():""===e&&n!==t.length-1||r.push(e))})),"/"+r.join("/")}const s=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");const c={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},l=e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),o=e.slice(r+1);return[decodeURI(n),decodeURI(o)]},u=e=>{const t=RegExp(/^(.+):\/\//).exec(e);return t?t[1]:""};var f={jsonTypeOf:(e,t)=>c[t](e),splitUrl:l,safeResolveUrl:(e,t)=>{const r=o(e,t),n=l(e)[0];if(n&&"file"===u(r)&&"file"!==u(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r}};const p=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(w)},d=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:d(e,O(t,o,n),r,b(o,n))}}if(Array.isArray(t)){const n=[...t];return n[g(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:O(t,e[0],n)},h=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||E(t)){const o=e.shift();h(e,O(t,o,n),r,b(o,n))}else{t[g(t,e[0])]=r}},y=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=O(t,n,r);return{...t,[n]:y(e,o,b(n,r))}}if(Array.isArray(t))return t.filter(((t,r)=>r!=e[0]));if("object"==typeof t&&null!==t){const{[e[0]]:r,...n}=t;return n}return O(t,e[0],r)}},v=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=O(t,n,r);v(e,o,b(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:O(t,e[0],r)},b=e(((e,t)=>t+"/"+m(e))),m=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),w=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),g=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,O=(e,t,r="")=>{if(void 0===e)throw TypeError(`Value at '${r}' is undefined and does not have property '${t}'`);if(null===e)throw TypeError(`Value at '${r}' is null and does not have property '${t}'`);if(E(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[g(e,t)]},E=e=>null===e||"object"!=typeof e;var j={nil:"",append:b,get:(e,t)=>{const r=p(e),n=e=>r.reduce((([e,t],r)=>[O(e,r,t),b(r,t)]),[e,""])[0];return void 0===t?n:n(t)},set:(t,r,n)=>{const o=p(t),a=e(((e,t)=>d(o,e,t,"")));return void 0===r?a:a(r,n)},assign:(t,r,n)=>{const o=p(t),a=e(((e,t)=>h(o,e,t,"")));return void 0===r?a:a(r,n)},unset:(e,t)=>{const r=p(e),n=e=>y(r,e,"");return void 0===t?n:n(t)},remove:(e,t)=>{const r=p(e),n=e=>v(r,e,"");return void 0===t?n:n(t)}};j.nil,j.append,j.get,j.set,j.assign,j.unset,j.remove;const $=Symbol("$__value"),S=Symbol("$__href");var x={cons:(e,t)=>Object.freeze({[S]:e,[$]:t}),isReference:e=>e&&void 0!==e[S],href:e=>e[S],value:e=>e[$]};const{jsonTypeOf:A}=f,P=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),I=e=>x.isReference(e.value)?x.value(e.value):e.value,T=e(((e,t)=>A(I(e),t))),k=(e,t)=>Object.freeze({...t,pointer:j.append(e,t.pointer),value:I(t)[e]}),V=e(((e,t)=>I(t).map(((r,n,o,a)=>e(k(n,t),n,o,a))))),R=e(((e,t)=>I(t).map(((e,r,n,o)=>k(r,t))).filter(((t,r,n,o)=>e(t,r,n,o))))),U=e(((e,t,r)=>I(r).reduce(((t,n,o)=>e(t,k(o,r),o)),t))),C=e(((e,t)=>I(t).every(((r,n,o,a)=>e(k(n,t),n,o,a))))),z=e(((e,t)=>I(t).some(((r,n,o,a)=>e(k(n,t),n,o,a)))));var K={nil:P,cons:(e,t="")=>Object.freeze({...P,id:t,instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:I,has:(e,t)=>e in I(t),typeOf:T,step:k,entries:e=>Object.keys(I(e)).map((t=>[t,k(t,e)])),keys:e=>Object.keys(I(e)),map:V,filter:R,reduce:U,every:C,some:z,length:e=>I(e).length},L=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,q=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,_=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,D=/\\([\u000b\u0020-\u00ff])/g,N=/([\\"])/g,B=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function F(e){var t=String(e);if(_.test(t))return t;if(t.length>0&&!q.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(N,"\\$1")+'"'}function Z(e){this.parameters=Object.create(null),this.type=e}var W={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!B.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,a=Object.keys(t).sort(),i=0;i<a.length;i++){if(o=a[i],!_.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+F(t[o])}return n},parse:function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;"function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.substr(0,r).trim():t.trim();if(!B.test(n))throw new TypeError("invalid media type");var o=new Z(n.toLowerCase());if(-1!==r){var a,i,s;for(L.lastIndex=r;i=L.exec(t);){if(i.index!==r)throw new TypeError("invalid parameter format");r+=i[0].length,a=i[1].toLowerCase(),'"'===(s=i[2])[0]&&(s=s.substr(1,s.length-2).replace(D,"$1")),o.parameters[a]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},J=async e=>Object.entries(await e),M=e((async(e,t)=>(await t).map(e))),G=e((async(e,t,r)=>(await r).reduce((async(t,r)=>e(await t,r)),t))),H=e((async(e,t,r={})=>G((async(t,r)=>await e(r)?t.concat([r]):t),[],t,r))),Q=e((async(e,t)=>{const r=await M(e,t);return(await Promise.all(r)).some((e=>e))})),X=e((async(e,t)=>{const r=await M(e,t);return(await Promise.all(r)).every((e=>e))})),Y=e(((e,t)=>e.reduce((async(e,t)=>t(await e)),t))),ee={entries:J,map:M,filter:H,reduce:G,some:Q,every:X,pipeline:Y,all:e=>Promise.all(e),allValues:e=>Y([J,G((async(e,[t,r])=>(e[t]=await r,e)),{})],e)};ee.entries,ee.map,ee.filter,ee.reduce,ee.some,ee.every,ee.pipeline,ee.all,ee.allValues;var te=fetch;const{jsonTypeOf:re,splitUrl:ne,safeResolveUrl:oe}=f,ae={},ie={},se=(e,t)=>{const r=e in ie?ie[e]:e;if(r in ae)return ae[r][t]},ce={},le={},ue=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=ne(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=se(n,"baseToken"),a=se(n,"anchorToken"),i=ne(t)[0];if(!i&&!ne(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const s=oe(i,e[o]||""),[c,l]=ne(s);delete e[o],l&&o===a&&(e[a]=a!==o?encodeURI(l):`#${encodeURI(l)}`),i&&(le[i]=c);const u={},f=se(n,"recursiveAnchorToken");let p;!0===e[f]&&(u[""]=`${c}#`,e[a]="",delete e[f]);const d=se(n,"vocabularyToken");re(e[d],"object")?(ie[c]=n,p=e[d],delete e[d]):(ie[c]=n,p={[n]:!0});const h={"":""};return ce[c]={id:c,schemaVersion:n,schema:fe(e,c,n,j.nil,h,u),anchors:h,dynamicAnchors:u,vocabulary:p,validated:!1},c},fe=(e,t,r,n,o,a)=>{if(re(e,"object")){const i="string"==typeof e.$schema?ne(e.$schema)[0]:r,s=se(i,"embeddedToken"),c=se(i,"anchorToken");if("string"==typeof e[s]&&(s!==c||"#"!==e[s][0])){const n=oe(t,e[s]);return e[s]=n,ue(e,n,r),x.cons(e[s],e)}const l=se(r,"anchorToken"),u=se(r,"dynamicAnchorToken");"string"==typeof e[u]&&(a[e[u]]=`${t}#${encodeURI(n)}`,o[e[u]]=n,delete e[u]);const f=se(r,"embeddedToken");if("string"==typeof e[l]){const t=l!==f?e[l]:e[l].slice(1);o[t]=n,delete e[l]}const p=se(r,"jrefToken");if("string"==typeof e[p])return x.cons(e[p],e);for(const i in e)e[i]=fe(e[i],t,r,j.append(i,n),o,a);return e}return Array.isArray(e)?e.map(((e,i)=>fe(e,t,r,j.append(i,n),o,a))):e},pe=e=>ce[le[e]]||ce[e],de=Object.freeze({id:"",schemaVersion:void 0,vocabulary:{},pointer:j.nil,schema:void 0,value:void 0,anchors:{},dynamicAnchors:{},validated:!0}),he=async(e,t=de)=>{const r=oe(be(t),e),[n,o]=ne(r);if(!(e=>e in ce||e in le)(n)){const e=await te(n,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error(`Failed to retrieve schema with id: ${n}`);if(e.headers.has("content-type")){const t=W.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${n} is not a schema. Found a document with media type: ${t}`)}ue(await e.json(),n)}const a=pe(n),i="/"!==o[0]?ve(a,o):o,s=Object.freeze({...a,pointer:i,value:j.get(i,a.schema)});return ye(s)},ye=e=>x.isReference(e.value)?he(x.href(e.value),e):e,ve=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},be=e=>`${e.id}#${encodeURI(e.pointer)}`,me=e=>x.isReference(e.value)?x.value(e.value):e.value,we=(e,t)=>{const r=pe(t.id),n=Object.freeze({...t,pointer:j.append(e,t.pointer),value:me(t)[e],validated:r.validated});return ye(n)},ge=e(((e,t)=>ee.pipeline([me,ee.map((async(r,n)=>e(await we(n,t),n))),ee.all],t)));var Oe={setConfig:(e,t,r)=>{ae[e]||(ae[e]={}),ae[e][t]=r},getConfig:se,add:ue,get:he,markValidated:e=>{ce[e].validated=!0},uri:be,value:me,getAnchorPointer:ve,typeOf:(e,t)=>re(me(e),t),has:(e,t)=>e in me(t),step:we,keys:e=>Object.keys(me(e)),entries:e=>ee.pipeline([me,Object.keys,ee.map((async t=>[t,await we(t,e)])),ee.all],e),map:ge,length:e=>me(e).length};Oe.setConfig,Oe.getConfig,Oe.add,Oe.get,Oe.markValidated,Oe.uri,Oe.value,Oe.getAnchorPointer,Oe.typeOf,Oe.has,Oe.step,Oe.keys,Oe.entries,Oe.map,Oe.length;class Ee extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var je=Ee;const{splitUrl:$e}=f,Se="FLAG",xe="BASIC",Ae="DETAILED",Pe="VERBOSE";let Ie=Ae,Te=!0;const ke=async e=>{const t={metaData:{}};return{ast:t,schemaUri:await qe(e,t)}},Ve=e((({ast:e,schemaUri:t},r,o=Se)=>{if(![Se,xe,Ae,Pe].includes(o))throw Error(`The '${o}' error format is not supported`);const a=[],i=n.subscribe("result",Re(o,a));return De(t,r,e,{}),n.unsubscribe(i),a[0]})),Re=(e,t)=>{const r=[];return(n,o)=>{if("result"===n){const{keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:a}=o,i={keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:a,errors:[]};r.push(i)}else if("result.start"===n)r.push(n);else if("result.end"===n){const n=r.pop();for(;"result.start"!==r[r.length-1];){const t=r.pop(),o=[t];e===xe&&(o.push(...t.errors),delete t.errors),(e===Pe||e!==Se&&!t.valid)&&n.errors.unshift(...o)}r[r.length-1]=n,t[0]=n}}},Ue={},Ce=e=>Ue[e],ze=e=>e in Ue,Ke={},Le={},qe=async(e,t)=>{if(e=await _e(e),!ze(`${e.schemaVersion}#validate`)){const t=await Oe.get(e.schemaVersion);(Oe.getConfig(t.id,"mandatoryVocabularies")||[]).forEach((e=>{if(!t.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)})),Object.entries(t.vocabulary).forEach((([e,r])=>{if(e in Ke)Object.entries(Ke[e]).forEach((([e,r])=>{((e,t)=>{Ue[e]={collectEvaluatedItems:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&new Set,collectEvaluatedProperties:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&[],...t}})(`${t.id}#${e}`,r)}));else if(r)throw Error(`Missing required vocabulary: ${e}`)}))}if(Te&&!e.validated){if(Oe.markValidated(e.id),!(e.schemaVersion in Le)){const t=await Oe.get(e.schemaVersion),r=await ke(t);Le[t.id]=Ve(r)}const t=K.cons(e.schema,e.id),r=Le[e.schemaVersion](t,Ie);if(!r.valid)throw new je(r)}return e.id in t.metaData||(t.metaData[e.id]={id:e.id,dynamicAnchors:e.dynamicAnchors,anchors:e.anchors}),Ce(`${e.schemaVersion}#validate`).compile(e,t)},_e=async e=>Oe.typeOf(e,"string")?_e(await Oe.get(Oe.value(e),e)):e,De=(e,t,r,n)=>{const o=Ne(e,r),a=$e(e)[0];return Ce(o).interpret(e,t,r,{...r.metaData[a].dynamicAnchors,...n})},Ne=(e,t)=>{if(!(e in t))throw Error(`No schema found at ${e}`);return t[e][0]};var Be={validate:async(e,t,r)=>{const n=await ke(e),o=(e,t)=>Ve(n,K.cons(e),t);return void 0===t?o:o(t,r)},compile:ke,interpret:Ve,setMetaOutputFormat:e=>{Ie=e},setShouldMetaValidate:e=>{Te=e},FLAG:Se,BASIC:xe,DETAILED:Ae,VERBOSE:Pe,add:(e,t="",r="")=>{const n=Oe.add(e,t,r);delete Le[n]},getKeyword:Ce,hasKeyword:ze,defineVocabulary:(e,t)=>{Ke[e]=t},compileSchema:qe,interpretSchema:De,collectEvaluatedProperties:(e,t,r,n,o)=>{const a=Ne(e,r);return Ce(a).collectEvaluatedProperties(e,t,r,n,o)},collectEvaluatedItems:(e,t,r,n,o)=>{const a=Ne(e,r);return Ce(a).collectEvaluatedItems(e,t,r,n,o)}};var Fe={compile:e=>Oe.value(e),interpret:()=>!0};var Ze={compile:async(e,t)=>{const r=Oe.uri(e);if(!(r in t)){t[r]=!1;const n=Oe.value(e);if(!["object","boolean"].includes(typeof n))throw Error(`No schema found at '${Oe.uri(e)}'`);t[r]=[`${e.schemaVersion}#validate`,Oe.uri(e),"boolean"==typeof n?n:await ee.pipeline([Oe.entries,ee.map((([t,r])=>[`${e.schemaVersion}#${t}`,r])),ee.filter((([t])=>Be.hasKeyword(t)&&t!==`${e.schemaVersion}#validate`)),ee.map((async([r,n])=>{const o=await Be.getKeyword(r).compile(n,t,e);return[r,Oe.uri(n),o]})),ee.all],e)]}return r},interpret:(e,t,r,o)=>{const[a,i,s]=r[e];n.publishSync("result.start");const c="boolean"==typeof s?s:s.every((([e,a,i])=>{n.publishSync("result.start");const s=Be.getKeyword(e).interpret(i,t,r,o);return n.publishSync("result",{keyword:e,absoluteKeywordLocation:a,instanceLocation:K.uri(t),valid:s,ast:i}),n.publishSync("result.end"),s}));return n.publishSync("result",{keyword:a,absoluteKeywordLocation:i,instanceLocation:K.uri(t),valid:c,ast:e}),n.publishSync("result.end"),c},collectEvaluatedProperties:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&[]:a.filter((([e])=>!o||!e.endsWith("#unevaluatedProperties"))).reduce(((e,[o,,a])=>{const i=e&&Be.getKeyword(o).collectEvaluatedProperties(a,t,r,n);return!1!==i&&[...e,...i]}),[])},collectEvaluatedItems:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&new Set:a.filter((([e])=>!o||!e.endsWith("#unevaluatedItems"))).reduce(((e,[o,,a])=>{const i=!1!==e&&Be.getKeyword(o).collectEvaluatedItems(a,t,r,n);return!1!==i&&new Set([...e,...i])}),new Set)}},We={metaData:Fe,validate:Ze},Je={Core:Be,Schema:Oe,Instance:K,Reference:x,Keywords:We,InvalidSchemaError:je},Me=Je.Core,Ge=Je.Schema,He=Je.Instance,Qe=Je.Reference,Xe=Je.Keywords,Ye=Je.InvalidSchemaError;export{Me as Core,He as Instance,Ye as InvalidSchemaError,Xe as Keywords,Qe as Reference,Ge as Schema,Je as default}; | ||
import e from"url";var t=function(e,t){return function r(){null==t&&(t=e.length);var n=[].slice.call(arguments);return n.length>=t?e.apply(this,n):function(){return r.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:{};var n,a=(function(e,t){var n;n={},("object"==typeof window&&window||r).PubSub=n,function(e){var t={},r=-1,n="*";function a(e){var t;for(t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function o(e){return function(){throw e}}function i(e,t,r){try{e(t,r)}catch(e){setTimeout(o(e),0)}}function s(e,t,r){e(t,r)}function u(e,r,n,a){var o,u=t[r],l=a?s:i;if(Object.prototype.hasOwnProperty.call(t,r))for(o in u)Object.prototype.hasOwnProperty.call(u,o)&&l(u[o],e,n)}function l(e,t,r){return function(){var a=String(e),o=a.lastIndexOf(".");for(u(e,e,t,r);-1!==o;)o=(a=a.substr(0,o)).lastIndexOf("."),u(e,a,t,r);u(e,n,t,r)}}function c(e){var r=String(e);return Boolean(Object.prototype.hasOwnProperty.call(t,r)&&a(t[r]))}function f(e){for(var t=String(e),r=c(t)||c(n),a=t.lastIndexOf(".");!r&&-1!==a;)a=(t=t.substr(0,a)).lastIndexOf("."),r=c(t);return r}function h(e,t,r,n){var a=l(e="symbol"==typeof e?e.toString():e,t,n);return!!f(e)&&(!0===r?a():setTimeout(a,0),!0)}e.publish=function(t,r){return h(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return h(t,r,!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(t,e)||(t[e]={});var a="uid_"+String(++r);return t[e][a]=n,a},e.subscribeAll=function(t){return e.subscribe(n,t)},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n,a=0;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)){for(n in t[r])a++;break}return a},e.getSubscriptions=function(e){var r,n=[];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,a,o,i=function(e){var r;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e))return!0;return!1},s="string"==typeof r&&(Object.prototype.hasOwnProperty.call(t,r)||i(r)),u=!s&&"string"==typeof r,l="function"==typeof r,c=!1;if(!s){for(n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(a=t[n],u&&a[r]){delete a[r],c=r;break}if(l)for(o in a)Object.prototype.hasOwnProperty.call(a,o)&&a[o]===r&&(delete a[o],c=!0)}return c}e.clearSubscriptions(r)}}(n),void 0!==e&&e.exports&&(t=e.exports=n),t.PubSub=n,e.exports=t=n}(n={exports:{}},n.exports),n.exports);a.PubSub;var o=function(e,t){if(e=e.trim(),(t=t.trim()).startsWith("about:"))return t;const r=function(e){const t={host:"",path:"",query:"",protocol:""};let r=e,n=e.indexOf("//");t.protocol=r.substring(0,n),n+=2;const a=e.indexOf("/",n),o=e.indexOf("?"),i=e.indexOf("#");-1!==i&&(r=r.substring(0,i));if(-1!==o){const e=r.substring(o);t.query=e,r=r.substring(0,o)}if(-1!==a){const e=r.substring(0,a);t.host=e,r=r.substring(a),t.path=r}else t.host=r;return t}(e),n=function(e){const t={href:e,hash:"",query:"",netPath:!1,absolutePath:!1,relativePath:!1};if(u.test(e))return t.netPath=!0,t;"/"===e[0]?t.absolutePath=!0:""!==e&&(t.relativePath=!0);let r=e;const n=e.indexOf("?"),a=e.indexOf("#");if(-1!==a){const e=r.substring(a);t.hash=e,r=r.substring(0,a)}if(-1!==n){const e=r.substring(n);t.query=e,r=r.substring(0,n)}return t.path=r,t}(t);if(!r.protocol&&!n.netPath)throw new Error("Error, protocol is not specified");if(n.netPath)return function(e){return e.startsWith("//")}(n.href)&&(n.href=r.protocol+n.href),function(e){const t=e.indexOf("//")+2,r=!e.includes("/",t),n=!e.includes("?",t),a=!e.includes("#",t);return r&&n&&a}(n.href)?i(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:a}=n;return r.host+s(e)+t+a}if(n.relativePath){const{path:e,query:t,hash:a}=n;let o,i=r.path,u=r.host;return 0===e.length?o=i:(i=i.substring(0,i.lastIndexOf("/")),o=s(i+"/"+e)),u+=""!==o||t||a?o+t+a:"/",u}{const{host:e,path:t,query:a}=r;return t||a?e+t+a+n.hash:i(e)}};function i(e){return e+("/"===e[e.length-1]?"":"/")}function s(e){let t=e.split("/");""===t[0]&&(t=t.slice(1));let r=[];return t.forEach(((e,n)=>{"."!==e&&(".."===e?r.pop():""===e&&n!==t.length-1||r.push(e))})),"/"+r.join("/")}const u=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");const l={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},c=e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),a=e.slice(r+1);return[decodeURI(n),decodeURI(a)]},f=e=>{const t=RegExp(/^(.+):\/\//).exec(e);return t?t[1]:""};var h={jsonTypeOf:(e,t)=>l[t](e),splitUrl:c,safeResolveUrl:(e,t)=>{const r=o(e,t),n=c(e)[0];if(n&&"file"===f(r)&&"file"!==f(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r}};const m=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(x)},p=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const a=e.shift();return{...t,[a]:p(e,O(t,a,n),r,b(a,n))}}if(Array.isArray(t)){const n=[...t];return n[w(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:O(t,e[0],n)},d=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||E(t)){const a=e.shift();d(e,O(t,a,n),r,b(a,n))}else{t[w(t,e[0])]=r}},y=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),a=O(t,n,r);return{...t,[n]:y(e,a,b(n,r))}}if(Array.isArray(t))return t.filter(((t,r)=>r!=e[0]));if("object"==typeof t&&null!==t){const{[e[0]]:r,...n}=t;return n}return O(t,e[0],r)}},v=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),a=O(t,n,r);v(e,a,b(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:O(t,e[0],r)},b=t(((e,t)=>t+"/"+g(e))),g=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),x=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),w=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,O=(e,t,r="")=>{if(void 0===e)throw TypeError(`Value at '${r}' is undefined and does not have property '${t}'`);if(null===e)throw TypeError(`Value at '${r}' is null and does not have property '${t}'`);if(E(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[w(e,t)]},E=e=>null===e||"object"!=typeof e;var I={nil:"",append:b,get:(e,t)=>{const r=m(e),n=e=>r.reduce((([e,t],r)=>[O(e,r,t),b(r,t)]),[e,""])[0];return void 0===t?n:n(t)},set:(e,r,n)=>{const a=m(e),o=t(((e,t)=>p(a,e,t,"")));return void 0===r?o:o(r,n)},assign:(e,r,n)=>{const a=m(e),o=t(((e,t)=>d(a,e,t,"")));return void 0===r?o:o(r,n)},unset:(e,t)=>{const r=m(e),n=e=>y(r,e,"");return void 0===t?n:n(t)},remove:(e,t)=>{const r=m(e),n=e=>v(r,e,"");return void 0===t?n:n(t)}};I.nil,I.append,I.get,I.set,I.assign,I.unset,I.remove;const S=Symbol("$__value"),j=Symbol("$__href");var P={cons:(e,t)=>Object.freeze({[j]:e,[S]:t}),isReference:e=>e&&void 0!==e[j],href:e=>e[j],value:e=>e[S]};const{jsonTypeOf:A}=h,T=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),R=e=>P.isReference(e.value)?P.value(e.value):e.value,$=t(((e,t)=>A(R(e),t))),V=(e,t)=>Object.freeze({...t,pointer:I.append(e,t.pointer),value:R(t)[e]}),k=t(((e,t)=>R(t).map(((r,n,a,o)=>e(V(n,t),n,a,o))))),L=t(((e,t)=>R(t).map(((e,r,n,a)=>V(r,t))).filter(((t,r,n,a)=>e(t,r,n,a))))),H=t(((e,t,r)=>R(r).reduce(((t,n,a)=>e(t,V(a,r),a)),t))),U=t(((e,t)=>R(t).every(((r,n,a,o)=>e(V(n,t),n,a,o))))),q=t(((e,t)=>R(t).some(((r,n,a,o)=>e(V(n,t),n,a,o)))));var D={nil:T,cons:(e,t="")=>Object.freeze({...T,id:t,instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:R,has:(e,t)=>e in R(t),typeOf:$,step:V,entries:e=>Object.keys(R(e)).map((t=>[t,V(t,e)])),keys:e=>Object.keys(R(e)),map:k,filter:L,reduce:H,every:U,some:q,length:e=>R(e).length},_=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,Q=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,C=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,z=/\\([\u000b\u0020-\u00ff])/g,B=/([\\"])/g,K=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function N(e){var t=String(e);if(C.test(t))return t;if(t.length>0&&!Q.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(B,"\\$1")+'"'}function M(e){this.parameters=Object.create(null),this.type=e}var F={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!K.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var a,o=Object.keys(t).sort(),i=0;i<o.length;i++){if(a=o[i],!C.test(a))throw new TypeError("invalid parameter name");n+="; "+a+"="+N(t[a])}return n},parse:function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;"function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.substr(0,r).trim():t.trim();if(!K.test(n))throw new TypeError("invalid media type");var a=new M(n.toLowerCase());if(-1!==r){var o,i,s;for(_.lastIndex=r;i=_.exec(t);){if(i.index!==r)throw new TypeError("invalid parameter format");r+=i[0].length,o=i[1].toLowerCase(),'"'===(s=i[2])[0]&&(s=s.substr(1,s.length-2).replace(z,"$1")),a.parameters[o]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return a}},J=async e=>Object.entries(await e),W=t((async(e,t)=>(await t).map(e))),Z=t((async(e,t,r)=>(await r).reduce((async(t,r)=>e(await t,r)),t))),G=t((async(e,t,r={})=>Z((async(t,r)=>await e(r)?t.concat([r]):t),[],t,r))),X=t((async(e,t)=>{const r=await W(e,t);return(await Promise.all(r)).some((e=>e))})),Y=t((async(e,t)=>{const r=await W(e,t);return(await Promise.all(r)).every((e=>e))})),ee=t(((e,t)=>e.reduce((async(e,t)=>t(await e)),t))),te={entries:J,map:W,filter:G,reduce:Z,some:X,every:Y,pipeline:ee,all:e=>Promise.all(e),allValues:e=>ee([J,Z((async(e,[t,r])=>(e[t]=await r,e)),{})],e)};te.entries,te.map,te.filter,te.reduce,te.some,te.every,te.pipeline,te.all,te.allValues;var re={ABSOLUTE:"absolute",PATH_RELATIVE:"pathRelative",ROOT_RELATIVE:"rootRelative",SHORTEST:"shortest"};function ne(e,t){var r=t.removeEmptyQueries&&e.extra.relation.minimumPort;return e.query.string[r?"stripped":"full"]}function ae(e,t){return!e.extra.relation.minimumQuery||t.output===re.ABSOLUTE||t.output===re.ROOT_RELATIVE}function oe(e,t){var r=t.removeDirectoryIndexes&&e.extra.resourceIsIndex,n=e.extra.relation.minimumResource&&t.output!==re.ABSOLUTE&&t.output!==re.ROOT_RELATIVE;return!!e.resource&&!n&&!r}var ie=function(e,t){var r="";return r+=function(e,t){var r="";return(e.extra.relation.maximumHost||t.output===re.ABSOLUTE)&&(e.extra.relation.minimumScheme&&t.schemeRelative&&t.output!==re.ABSOLUTE?r+="//":r+=e.scheme+"://"),r}(e,t),r+=function(e,t){return!e.auth||t.removeAuth||!e.extra.relation.maximumHost&&t.output!==re.ABSOLUTE?"":e.auth+"@"}(e,t),r+=function(e,t){return e.host.full&&(e.extra.relation.maximumAuth||t.output===re.ABSOLUTE)?e.host.full:""}(e,t),r+=function(e,t){return e.port&&!e.extra.portIsDefault&&e.extra.relation.maximumHost?":"+e.port:""}(e),r+=function(e,t){var r="",n=e.path.absolute.string,a=e.path.relative.string,o=oe(e,t);if(e.extra.relation.maximumHost||t.output===re.ABSOLUTE||t.output===re.ROOT_RELATIVE)r=n;else if(a.length<=n.length&&t.output===re.SHORTEST||t.output===re.PATH_RELATIVE){if(""===(r=a)){var i=ae(e,t)&&!!ne(e,t);e.extra.relation.maximumPath&&!o?r="./":!e.extra.relation.overridesQuery||o||i||(r="./")}}else r=n;return"/"!==r||o||!t.removeRootTrailingSlash||e.extra.relation.minimumPort&&t.output!==re.ABSOLUTE||(r=""),r}(e,t),r+=function(e,t){return oe(e,t)?e.resource:""}(e,t),r+=function(e,t){return ae(e,t)?ne(e,t):""}(e,t),r+=function(e,t){return e.hash?e.hash:""}(e)};var se={clone:function e(t){if(t instanceof Object){var r=t instanceof Array?[]:{};for(var n in t)t.hasOwnProperty(n)&&(r[n]=e(t[n]));return r}return t},isPlainObject:function(e){return!!e&&"object"==typeof e&&e.constructor===Object},shallowMerge:function(e,t){if(e instanceof Object&&t instanceof Object)for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e}};function ue(e,t){return t instanceof Object&&e instanceof Object?t instanceof Array&&e instanceof Array?t.concat(e):se.shallowMerge(e,t):e}var le=function(e,t){if(se.isPlainObject(e)){var r={};for(var n in t)t.hasOwnProperty(n)&&(void 0!==e[n]?r[n]=ue(e[n],t[n]):r[n]=t[n]);return r}return t};var ce=function(e){var t=!(e.scheme||e.auth||e.host.full||e.port),r=t&&!e.path.absolute.string,n=r&&!e.resource,a=n&&!e.query.string.full.length,o=a&&!e.hash;e.extra.hrefInfo.minimumPathOnly=t,e.extra.hrefInfo.minimumResourceOnly=r,e.extra.hrefInfo.minimumQueryOnly=n,e.extra.hrefInfo.minimumHashOnly=a,e.extra.hrefInfo.empty=o};var fe=function(e,t){if(t.ignore_www){var r=e.host.full;if(r){var n=r;0===r.indexOf("www.")&&(n=r.substr(4)),e.host.stripped=n}}};function he(e){if("/"!==e){var t=[];return e.split("/").forEach((function(e){""!==e&&t.push(e)})),t}return[]}var me=function(e,t){var r=e.path.absolute.string;if(r){var n=r.lastIndexOf("/");if(n>-1){if(++n<r.length){var a=r.substr(n);"."!==a&&".."!==a?(e.resource=a,r=r.substr(0,n)):r+="/"}e.path.absolute.string=r,e.path.absolute.array=he(r)}else"."===r||".."===r?(r+="/",e.path.absolute.string=r,e.path.absolute.array=he(r)):(e.resource=r,e.path.absolute.string=null);e.extra.resourceIsIndex=function(e,t){var r=!1;return t.directoryIndexes.every((function(t){return t!==e||(r=!0,!1)})),r}(e.resource,t)}};var pe=function(e,t){var r=-1;for(var n in t.defaultPorts)if(n===e.scheme&&t.defaultPorts.hasOwnProperty(n)){r=t.defaultPorts[n];break}r>-1&&(r=r.toString(),null===e.port&&(e.port=r),e.extra.portIsDefault=e.port===r)},de=Object.prototype.hasOwnProperty;function ye(e,t){var r=0,n="";for(var a in e)if(""!==a&&!0===de.call(e,a)){var o=e[a];""===o&&t||(n+=1==++r?"?":"&",a=encodeURIComponent(a),n+=""!==o?a+"="+encodeURIComponent(o).replace(/%20/g,"+"):a)}return n}var ve=function(e,t){e.query.string.full=ye(e.query.object,!1),t.removeEmptyQueries&&(e.query.string.stripped=ye(e.query.object,!0))},be=e.parse;var ge=function(e,t){return function(e,t){var r=!0;return t.rejectedSchemes.every((function(t){return r=!(0===e.indexOf(t+":"))})),r}(e,t)?(r=be(e,!0,t.slashesDenoteHost),(n=r.protocol)&&n.indexOf(":")===n.length-1&&(n=n.substr(0,n.length-1)),r.host={full:r.hostname,stripped:null},r.path={absolute:{array:null,string:r.pathname},relative:{array:null,string:null}},r.query={object:r.query,string:{full:null,stripped:null}},r.extra={hrefInfo:{minimumPathOnly:null,minimumResourceOnly:null,minimumQueryOnly:null,minimumHashOnly:null,empty:null,separatorOnlyQuery:"?"===r.search},portIsDefault:null,relation:{maximumScheme:null,maximumAuth:null,maximumHost:null,maximumPort:null,maximumPath:null,maximumResource:null,maximumQuery:null,maximumHash:null,minimumScheme:null,minimumAuth:null,minimumHost:null,minimumPort:null,minimumPath:null,minimumResource:null,minimumQuery:null,minimumHash:null,overridesQuery:null},resourceIsIndex:null,slashes:r.slashes},r.resource=null,r.scheme=n,delete r.hostname,delete r.pathname,delete r.protocol,delete r.search,delete r.slashes,r):{href:e,valid:!1};var r,n};var xe={join:function(e){return e.length>0?e.join("/")+"/":""},resolveDotSegments:function(e){var t=[];return e.forEach((function(e){".."!==e?"."!==e&&t.push(e):t.length>0&&t.splice(t.length-1,1)})),t}};function we(e,t){var r=ge(e,t);return!1===r.valid||(fe(r,t),pe(r,t),me(r,t),ve(r,t),ce(r)),r}var Oe={from:function(e,t,r){if(e){var n=we(e,t),a=xe.resolveDotSegments(n.path.absolute.array);return n.path.absolute.array=a,n.path.absolute.string="/"+xe.join(a),n}return r},to:we};var Ee={pathOn:function(e,t,r){var n=e.extra.hrefInfo.minimumQueryOnly,a=e.extra.hrefInfo.minimumHashOnly,o=e.extra.hrefInfo.empty,i=e.extra.relation.minimumPort,s=e.extra.relation.minimumScheme,u=i&&e.path.absolute.string===t.path.absolute.string,l=e.resource===t.resource||!e.resource&&t.extra.resourceIsIndex||r.removeDirectoryIndexes&&e.extra.resourceIsIndex&&!t.resource,c=u&&(l||n||a||o),f=r.removeEmptyQueries?"stripped":"full",h=e.query.string[f],m=t.query.string[f],p=c&&!!h&&h===m||(a||o)&&!e.extra.hrefInfo.separatorOnlyQuery,d=p&&e.hash===t.hash;e.extra.relation.minimumPath=u,e.extra.relation.minimumResource=c,e.extra.relation.minimumQuery=p,e.extra.relation.minimumHash=d,e.extra.relation.maximumPort=!s||s&&!u,e.extra.relation.maximumPath=!s||s&&!c,e.extra.relation.maximumResource=!s||s&&!p,e.extra.relation.maximumQuery=!s||s&&!d,e.extra.relation.maximumHash=!s||s&&!d,e.extra.relation.overridesQuery=u&&e.extra.relation.maximumResource&&!p&&!!m},upToPath:function(e,t,r){var n=e.extra.hrefInfo.minimumPathOnly,a=e.scheme===t.scheme||!e.scheme,o=a&&(e.auth===t.auth||r.removeAuth||n),i=r.ignore_www?"stripped":"full",s=o&&(e.host[i]===t.host[i]||n),u=s&&(e.port===t.port||n);e.extra.relation.minimumScheme=a,e.extra.relation.minimumAuth=o,e.extra.relation.minimumHost=s,e.extra.relation.minimumPort=u,e.extra.relation.maximumScheme=!a||a&&!o,e.extra.relation.maximumAuth=!a||a&&!s,e.extra.relation.maximumHost=!a||a&&!u}};var Ie=function(e,t,r){Ee.upToPath(e,t,r),e.extra.relation.minimumScheme&&(e.scheme=t.scheme),e.extra.relation.minimumAuth&&(e.auth=t.auth),e.extra.relation.minimumHost&&(e.host=se.clone(t.host)),e.extra.relation.minimumPort&&function(e,t){e.port=t.port,e.extra.portIsDefault=t.extra.portIsDefault}(e,t),e.extra.relation.minimumScheme&&function(e,t){if(e.extra.relation.maximumHost||!e.extra.hrefInfo.minimumResourceOnly){var r=e.path.absolute.array,n="/";r?(e.extra.hrefInfo.minimumPathOnly&&0!==e.path.absolute.string.indexOf("/")&&(r=t.path.absolute.array.concat(r)),r=xe.resolveDotSegments(r),n+=xe.join(r)):r=[],e.path.absolute.array=r,e.path.absolute.string=n}else e.path=se.clone(t.path)}(e,t),Ee.pathOn(e,t,r),e.extra.relation.minimumResource&&function(e,t){e.resource=t.resource,e.extra.resourceIsIndex=t.extra.resourceIsIndex}(e,t),e.extra.relation.minimumQuery&&(e.query=se.clone(t.query)),e.extra.relation.minimumHash&&(e.hash=t.hash)};var Se=function(e,t,r){if(e.extra.relation.minimumScheme){var n=(a=e.path.absolute.array,o=t.path.absolute.array,i=[],s=!0,u=-1,o.forEach((function(e,t){s&&(a[t]!==e?s=!1:u=t),s||i.push("..")})),a.forEach((function(e,t){t>u&&i.push(e)})),i);e.path.relative.array=n,e.path.relative.string=xe.join(n)}var a,o,i,s,u};var je=function(e,t,r){return Ie(t,e,r),Se(t,e),t};function Pe(e,t){this.options=le(t,{defaultPorts:{ftp:21,http:80,https:443},directoryIndexes:["index.html"],ignore_www:!1,output:Pe.SHORTEST,rejectedSchemes:["data","javascript","mailto"],removeAuth:!1,removeDirectoryIndexes:!0,removeEmptyQueries:!1,removeRootTrailingSlash:!0,schemeRelative:!0,site:void 0,slashesDenoteHost:!0}),this.from=Oe.from(e,this.options,null)}Pe.prototype.relate=function(e,t,r){if(se.isPlainObject(t)?(r=t,t=e,e=null):t||(t=e,e=null),r=le(r,this.options),e=e||r.site,!(e=Oe.from(e,r,this.from))||!e.href)throw new Error("from value not defined.");if(e.extra.hrefInfo.minimumPathOnly)throw new Error("from value supplied is not absolute: "+e.href);return!1===(t=Oe.to(t,r)).valid?t.href:(t=je(e,t,r),t=ie(t,r))},Pe.relate=function(e,t,r){return(new Pe).relate(e,t,r)},se.shallowMerge(Pe,re);var Ae=Pe,Te=fetch;const{jsonTypeOf:Re,splitUrl:$e,safeResolveUrl:Ve}=h,ke={},Le={},He=(e,t)=>{const r=e in Le?Le[e]:e;if(r in ke)return ke[r][t]},Ue={},qe={},De=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=$e(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const a=He(n,"baseToken"),o=He(n,"anchorToken"),i=$e(t)[0];if(!i&&!$e(e[a]||"")[0])throw Error("Couldn't determine an identifier for the schema");const s=Ve(i,e[a]||""),[u,l]=$e(s);delete e[a],l&&a===o&&(e[o]=o!==a?encodeURI(l):`#${encodeURI(l)}`),i&&(qe[i]=u);const c={},f=He(n,"recursiveAnchorToken");let h;!0===e[f]&&(c[""]=`${u}#`,e[o]="",delete e[f]);const m=He(n,"vocabularyToken");Re(e[m],"object")?(Le[u]=n,h=e[m],delete e[m]):(Le[u]=n,h={[n]:!0});const p={"":""};return Ue[u]={id:u,schemaVersion:n,schema:_e(e,u,n,I.nil,p,c),anchors:p,dynamicAnchors:c,vocabulary:h,validated:!1},u},_e=(e,t,r,n,a,o)=>{if(Re(e,"object")){const i="string"==typeof e.$schema?$e(e.$schema)[0]:r,s=He(i,"embeddedToken"),u=He(i,"anchorToken");if("string"==typeof e[s]&&(s!==u||"#"!==e[s][0])){const n=Ve(t,e[s]);return e[s]=n,De(e,n,r),P.cons(e[s],e)}const l=He(r,"anchorToken"),c=He(r,"dynamicAnchorToken");"string"==typeof e[c]&&(o[e[c]]=`${t}#${encodeURI(n)}`,a[e[c]]=n,delete e[c]);const f=He(r,"embeddedToken");if("string"==typeof e[l]){const t=l!==f?e[l]:e[l].slice(1);a[t]=n,delete e[l]}const h=He(r,"jrefToken");if("string"==typeof e[h])return P.cons(e[h],e);for(const i in e)e[i]=_e(e[i],t,r,I.append(i,n),a,o);return e}return Array.isArray(e)?e.map(((e,i)=>_e(e,t,r,I.append(i,n),a,o))):e},Qe=e=>Ue[qe[e]]||Ue[e],Ce=Object.freeze({id:"",schemaVersion:void 0,vocabulary:{},pointer:I.nil,schema:void 0,value:void 0,anchors:{},dynamicAnchors:{},validated:!0}),ze=async(e,t=Ce)=>{const r=Ve(Ne(t),e),[n,a]=$e(r);if(!(e=>e in Ue||e in qe)(n)){const e=await Te(n,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error(`Failed to retrieve schema with id: ${n}`);if(e.headers.has("content-type")){const t=F.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${n} is not a schema. Found a document with media type: ${t}`)}De(await e.json(),n)}const o=Qe(n),i="/"!==a[0]?Ke(o,a):a,s=Object.freeze({...o,pointer:i,value:I.get(i,o.schema)});return Be(s)},Be=e=>P.isReference(e.value)?ze(P.href(e.value),e):e,Ke=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},Ne=e=>`${e.id}#${encodeURI(e.pointer)}`,Me=e=>P.isReference(e.value)?P.value(e.value):e.value,Fe=(e,t)=>{const r=Qe(t.id),n=Object.freeze({...t,pointer:I.append(e,t.pointer),value:Me(t)[e],validated:r.validated});return Be(n)},Je=t(((e,t)=>te.pipeline([Me,te.map((async(r,n)=>e(await Fe(n,t),n))),te.all],t))),We={parentId:"",parentDialect:"",includeEmbedded:!0},Ze=(e,t)=>t.startsWith("file://")?""===e?"":Ae.relate(e,t):t;var Ge={setConfig:(e,t,r)=>{ke[e]||(ke[e]={}),ke[e][t]=r},getConfig:He,add:De,get:ze,markValidated:e=>{Ue[e].validated=!0},uri:Ne,value:Me,getAnchorPointer:Ke,typeOf:(e,t)=>Re(Me(e),t),has:(e,t)=>e in Me(t),step:Fe,keys:e=>Object.keys(Me(e)),entries:e=>te.pipeline([Me,Object.keys,te.map((async t=>[t,await Fe(t,e)])),te.all],e),map:Je,length:e=>Me(e).length,toSchema:(e,t={})=>{const r={...We,...t},n=JSON.parse(JSON.stringify(e.schema,((t,n)=>{if(!P.isReference(n))return n;const a=P.value(n),o=a.$schema||e.schemaVersion,i=He(o,"embeddedToken");return!r.includeEmbedded&&i in a?void 0:P.value(n)}))),a=He(e.schemaVersion,"dynamicAnchorToken");Object.entries(e.dynamicAnchors).forEach((([e,t])=>{const r=$e(t)[1];I.assign(r,n,{[a]:e,...I.get(r,n)})}));const o=He(e.schemaVersion,"anchorToken");Object.entries(e.anchors).filter((([e])=>""!==e)).forEach((([e,t])=>{I.assign(t,n,{[o]:e,...I.get(t,n)})}));const i=He(e.schemaVersion,"baseToken"),s=Ze(r.parentId,e.id),u=r.parentDialect===e.schemaVersion?"":e.schemaVersion;return{...s&&{[i]:s},...u&&{$schema:u},...n}}};Ge.setConfig,Ge.getConfig,Ge.add,Ge.get,Ge.markValidated,Ge.uri,Ge.value,Ge.getAnchorPointer,Ge.typeOf,Ge.has,Ge.step,Ge.keys,Ge.entries,Ge.map,Ge.length,Ge.toSchema;class Xe extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var Ye=Xe;const{splitUrl:et}=h,tt="FLAG",rt="BASIC",nt="DETAILED",at="VERBOSE";let ot=nt,it=!0;const st=async e=>{const t={metaData:{}};return{ast:t,schemaUri:await dt(e,t)}},ut=t((({ast:e,schemaUri:t},r,n=tt)=>{if(![tt,rt,nt,at].includes(n))throw Error(`The '${n}' error format is not supported`);const o=[],i=a.subscribe("result",lt(n,o));return vt(t,r,e,{}),a.unsubscribe(i),o[0]})),lt=(e,t)=>{const r=[];return(n,a)=>{if("result"===n){const{keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:o}=a,i={keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:o,errors:[]};r.push(i)}else if("result.start"===n)r.push(n);else if("result.end"===n){const n=r.pop();for(;"result.start"!==r[r.length-1];){const t=r.pop(),a=[t];e===rt&&(a.push(...t.errors),delete t.errors),(e===at||e!==tt&&!t.valid)&&n.errors.unshift(...a)}r[r.length-1]=n,t[0]=n}}},ct={},ft=e=>ct[e],ht=e=>e in ct,mt={},pt={},dt=async(e,t)=>{if(e=await yt(e),!ht(`${e.schemaVersion}#validate`)){const t=await Ge.get(e.schemaVersion);(Ge.getConfig(t.id,"mandatoryVocabularies")||[]).forEach((e=>{if(!t.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)})),Object.entries(t.vocabulary).forEach((([e,r])=>{if(e in mt)Object.entries(mt[e]).forEach((([e,r])=>{((e,t)=>{ct[e]={collectEvaluatedItems:(e,r,n,a,o)=>t.interpret(e,r,n,a,o)&&new Set,collectEvaluatedProperties:(e,r,n,a,o)=>t.interpret(e,r,n,a,o)&&[],...t}})(`${t.id}#${e}`,r)}));else if(r)throw Error(`Missing required vocabulary: ${e}`)}))}if(it&&!e.validated){if(Ge.markValidated(e.id),!(e.schemaVersion in pt)){const t=await Ge.get(e.schemaVersion),r=await st(t);pt[t.id]=ut(r)}const t=D.cons(e.schema,e.id),r=pt[e.schemaVersion](t,ot);if(!r.valid)throw new Ye(r)}return e.id in t.metaData||(t.metaData[e.id]={id:e.id,dynamicAnchors:e.dynamicAnchors,anchors:e.anchors}),ft(`${e.schemaVersion}#validate`).compile(e,t)},yt=async e=>Ge.typeOf(e,"string")?yt(await Ge.get(Ge.value(e),e)):e,vt=(e,t,r,n)=>{const a=bt(e,r),o=et(e)[0];return ft(a).interpret(e,t,r,{...r.metaData[o].dynamicAnchors,...n})},bt=(e,t)=>{if(!(e in t))throw Error(`No schema found at ${e}`);return t[e][0]};var gt={validate:async(e,t,r)=>{const n=await st(e),a=(e,t)=>ut(n,D.cons(e),t);return void 0===t?a:a(t,r)},compile:st,interpret:ut,setMetaOutputFormat:e=>{ot=e},setShouldMetaValidate:e=>{it=e},FLAG:tt,BASIC:rt,DETAILED:nt,VERBOSE:at,add:(e,t="",r="")=>{const n=Ge.add(e,t,r);delete pt[n]},getKeyword:ft,hasKeyword:ht,defineVocabulary:(e,t)=>{mt[e]=t},compileSchema:dt,interpretSchema:vt,collectEvaluatedProperties:(e,t,r,n,a)=>{const o=bt(e,r);return ft(o).collectEvaluatedProperties(e,t,r,n,a)},collectEvaluatedItems:(e,t,r,n,a)=>{const o=bt(e,r);return ft(o).collectEvaluatedItems(e,t,r,n,a)}};var xt={compile:e=>Ge.value(e),interpret:()=>!0};var wt={compile:async(e,t)=>{const r=Ge.uri(e);if(!(r in t)){t[r]=!1;const n=Ge.value(e);if(!["object","boolean"].includes(typeof n))throw Error(`No schema found at '${Ge.uri(e)}'`);t[r]=[`${e.schemaVersion}#validate`,Ge.uri(e),"boolean"==typeof n?n:await te.pipeline([Ge.entries,te.map((([t,r])=>[`${e.schemaVersion}#${t}`,r])),te.filter((([t])=>gt.hasKeyword(t)&&t!==`${e.schemaVersion}#validate`)),te.map((async([r,n])=>{const a=await gt.getKeyword(r).compile(n,t,e);return[r,Ge.uri(n),a]})),te.all],e)]}return r},interpret:(e,t,r,n)=>{const[o,i,s]=r[e];a.publishSync("result.start");const u="boolean"==typeof s?s:s.every((([e,o,i])=>{a.publishSync("result.start");const s=gt.getKeyword(e).interpret(i,t,r,n);return a.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:D.uri(t),valid:s,ast:i}),a.publishSync("result.end"),s}));return a.publishSync("result",{keyword:o,absoluteKeywordLocation:i,instanceLocation:D.uri(t),valid:u,ast:e}),a.publishSync("result.end"),u},collectEvaluatedProperties:(e,t,r,n,a=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter((([e])=>!a||!e.endsWith("#unevaluatedProperties"))).reduce(((e,[a,,o])=>{const i=e&>.getKeyword(a).collectEvaluatedProperties(o,t,r,n);return!1!==i&&[...e,...i]}),[])},collectEvaluatedItems:(e,t,r,n,a=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&new Set:o.filter((([e])=>!a||!e.endsWith("#unevaluatedItems"))).reduce(((e,[a,,o])=>{const i=!1!==e&>.getKeyword(a).collectEvaluatedItems(o,t,r,n);return!1!==i&&new Set([...e,...i])}),new Set)}},Ot={metaData:xt,validate:wt},Et={Core:gt,Schema:Ge,Instance:D,Reference:P,Keywords:Ot,InvalidSchemaError:Ye},It=Et.Core,St=Et.Schema,jt=Et.Instance,Pt=Et.Reference,At=Et.Keywords,Tt=Et.InvalidSchemaError;export{It as Core,jt as Instance,Tt as InvalidSchemaError,At as Keywords,Pt as Reference,St as Schema,Et as default}; | ||
//# sourceMappingURL=json-schema-core-esm.min.js.map |
@@ -1,2 +0,2 @@ | ||
var JSC=function(e){"use strict";var t=function(e,t){return function r(){null==t&&(t=e.length);var n=[].slice.call(arguments);return n.length>=t?e.apply(this,n):function(){return r.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:{};var n,o=(function(e,t){var n,o;n="object"==typeof window&&window||r,o={},n.PubSub=o,function(e){var t={},r=-1,n="*";function o(e){var t;for(t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function a(e){return function(){throw e}}function i(e,t,r){try{e(t,r)}catch(e){setTimeout(a(e),0)}}function s(e,t,r){e(t,r)}function c(e,r,n,o){var a,c=t[r],l=o?s:i;if(Object.prototype.hasOwnProperty.call(t,r))for(a in c)Object.prototype.hasOwnProperty.call(c,a)&&l(c[a],e,n)}function l(e,t,r){return function(){var o=String(e),a=o.lastIndexOf(".");for(c(e,e,t,r);-1!==a;)a=(o=o.substr(0,a)).lastIndexOf("."),c(e,o,t,r);c(e,n,t,r)}}function u(e){var r=String(e);return Boolean(Object.prototype.hasOwnProperty.call(t,r)&&o(t[r]))}function f(e){for(var t=String(e),r=u(t)||u(n),o=t.lastIndexOf(".");!r&&-1!==o;)o=(t=t.substr(0,o)).lastIndexOf("."),r=u(t);return r}function p(e,t,r,n){var o=l(e="symbol"==typeof e?e.toString():e,t,n);return!!f(e)&&(!0===r?o():setTimeout(o,0),!0)}e.publish=function(t,r){return p(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return p(t,r,!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(t,e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeAll=function(t){return e.subscribe(n,t)},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n,o=0;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)){for(n in t[r])o++;break}return o},e.getSubscriptions=function(e){var r,n=[];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,a,i=function(e){var r;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e))return!0;return!1},s="string"==typeof r&&(Object.prototype.hasOwnProperty.call(t,r)||i(r)),c=!s&&"string"==typeof r,l="function"==typeof r,u=!1;if(!s){for(n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(o=t[n],c&&o[r]){delete o[r],u=r;break}if(l)for(a in o)Object.prototype.hasOwnProperty.call(o,a)&&o[a]===r&&(delete o[a],u=!0)}return u}e.clearSubscriptions(r)}}(o),void 0!==e&&e.exports&&(t=e.exports=o),t.PubSub=o,e.exports=t=o}(n={exports:{}},n.exports),n.exports);o.PubSub;var a=function(e,t){if(e=e.trim(),(t=t.trim()).startsWith("about:"))return t;const r=function(e){const t={host:"",path:"",query:"",protocol:""};let r=e,n=e.indexOf("//");t.protocol=r.substring(0,n),n+=2;const o=e.indexOf("/",n),a=e.indexOf("?"),i=e.indexOf("#");-1!==i&&(r=r.substring(0,i));if(-1!==a){const e=r.substring(a);t.query=e,r=r.substring(0,a)}if(-1!==o){const e=r.substring(0,o);t.host=e,r=r.substring(o),t.path=r}else t.host=r;return t}(e),n=function(e){const t={href:e,hash:"",query:"",netPath:!1,absolutePath:!1,relativePath:!1};if(c.test(e))return t.netPath=!0,t;"/"===e[0]?t.absolutePath=!0:""!==e&&(t.relativePath=!0);let r=e;const n=e.indexOf("?"),o=e.indexOf("#");if(-1!==o){const e=r.substring(o);t.hash=e,r=r.substring(0,o)}if(-1!==n){const e=r.substring(n);t.query=e,r=r.substring(0,n)}return t.path=r,t}(t);if(!r.protocol&&!n.netPath)throw new Error("Error, protocol is not specified");if(n.netPath)return n.href.startsWith("//")&&(n.href=r.protocol+n.href),function(e){const t=e.indexOf("//")+2,r=!e.includes("/",t),n=!e.includes("?",t),o=!e.includes("#",t);return r&&n&&o}(n.href)?i(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+s(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let a,i=r.path,c=r.host;return 0===e.length?a=i:(i=i.substring(0,i.lastIndexOf("/")),a=s(i+"/"+e)),c+=""!==a||t||o?a+t+o:"/",c}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:i(e)}};function i(e){return e+("/"===e[e.length-1]?"":"/")}function s(e){let t=e.split("/");""===t[0]&&(t=t.slice(1));let r=[];return t.forEach(((e,n)=>{"."!==e&&(".."===e?r.pop():""===e&&n!==t.length-1||r.push(e))})),"/"+r.join("/")}const c=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");const l={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},u=e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),o=e.slice(r+1);return[decodeURI(n),decodeURI(o)]},f=e=>{const t=RegExp(/^(.+):\/\//).exec(e);return t?t[1]:""};var p={jsonTypeOf:(e,t)=>l[t](e),splitUrl:u,safeResolveUrl:(e,t)=>{const r=a(e,t),n=u(e)[0];if(n&&"file"===f(r)&&"file"!==f(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r}};const d=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(g)},h=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:h(e,E(t,o,n),r,m(o,n))}}if(Array.isArray(t)){const n=[...t];return n[O(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:E(t,e[0],n)},y=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||j(t)){const o=e.shift();y(e,E(t,o,n),r,m(o,n))}else{t[O(t,e[0])]=r}},v=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=E(t,n,r);return{...t,[n]:v(e,o,m(n,r))}}if(Array.isArray(t))return t.filter(((t,r)=>r!=e[0]));if("object"==typeof t&&null!==t){const{[e[0]]:r,...n}=t;return n}return E(t,e[0],r)}},b=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=E(t,n,r);b(e,o,m(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:E(t,e[0],r)},m=t(((e,t)=>t+"/"+w(e))),w=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),g=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),O=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,E=(e,t,r="")=>{if(void 0===e)throw TypeError(`Value at '${r}' is undefined and does not have property '${t}'`);if(null===e)throw TypeError(`Value at '${r}' is null and does not have property '${t}'`);if(j(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[O(e,t)]},j=e=>null===e||"object"!=typeof e;var $={nil:"",append:m,get:(e,t)=>{const r=d(e),n=e=>r.reduce((([e,t],r)=>[E(e,r,t),m(r,t)]),[e,""])[0];return void 0===t?n:n(t)},set:(e,r,n)=>{const o=d(e),a=t(((e,t)=>h(o,e,t,"")));return void 0===r?a:a(r,n)},assign:(e,r,n)=>{const o=d(e),a=t(((e,t)=>y(o,e,t,"")));return void 0===r?a:a(r,n)},unset:(e,t)=>{const r=d(e),n=e=>v(r,e,"");return void 0===t?n:n(t)},remove:(e,t)=>{const r=d(e),n=e=>b(r,e,"");return void 0===t?n:n(t)}};$.nil,$.append,$.get,$.set,$.assign,$.unset,$.remove;const S=Symbol("$__value"),P=Symbol("$__href");var A={cons:(e,t)=>Object.freeze({[P]:e,[S]:t}),isReference:e=>e&&void 0!==e[P],href:e=>e[P],value:e=>e[S]};const{jsonTypeOf:x}=p,I=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),T=e=>A.isReference(e.value)?A.value(e.value):e.value,k=t(((e,t)=>x(T(e),t))),V=(e,t)=>Object.freeze({...t,pointer:$.append(e,t.pointer),value:T(t)[e]}),R=t(((e,t)=>T(t).map(((r,n,o,a)=>e(V(n,t),n,o,a))))),C=t(((e,t)=>T(t).map(((e,r,n,o)=>V(r,t))).filter(((t,r,n,o)=>e(t,r,n,o))))),U=t(((e,t,r)=>T(r).reduce(((t,n,o)=>e(t,V(o,r),o)),t))),z=t(((e,t)=>T(t).every(((r,n,o,a)=>e(V(n,t),n,o,a))))),K=t(((e,t)=>T(t).some(((r,n,o,a)=>e(V(n,t),n,o,a)))));var L={nil:I,cons:(e,t="")=>Object.freeze({...I,id:t,instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:T,has:(e,t)=>e in T(t),typeOf:k,step:V,entries:e=>Object.keys(T(e)).map((t=>[t,V(t,e)])),keys:e=>Object.keys(T(e)),map:R,filter:C,reduce:U,every:z,some:K,length:e=>T(e).length},q=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,_=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,D=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,N=/\\([\u000b\u0020-\u00ff])/g,B=/([\\"])/g,F=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function Z(e){var t=String(e);if(D.test(t))return t;if(t.length>0&&!_.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(B,"\\$1")+'"'}function J(e){this.parameters=Object.create(null),this.type=e}var M={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!F.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,a=Object.keys(t).sort(),i=0;i<a.length;i++){if(o=a[i],!D.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+Z(t[o])}return n},parse:function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;"function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.substr(0,r).trim():t.trim();if(!F.test(n))throw new TypeError("invalid media type");var o=new J(n.toLowerCase());if(-1!==r){var a,i,s;for(q.lastIndex=r;i=q.exec(t);){if(i.index!==r)throw new TypeError("invalid parameter format");r+=i[0].length,a=i[1].toLowerCase(),'"'===(s=i[2])[0]&&(s=s.substr(1,s.length-2).replace(N,"$1")),o.parameters[a]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},W=async e=>Object.entries(await e),G=t((async(e,t)=>(await t).map(e))),H=t((async(e,t,r)=>(await r).reduce((async(t,r)=>e(await t,r)),t))),Q=t((async(e,t,r={})=>H((async(t,r)=>await e(r)?t.concat([r]):t),[],t,r))),X=t((async(e,t)=>{const r=await G(e,t);return(await Promise.all(r)).some((e=>e))})),Y=t((async(e,t)=>{const r=await G(e,t);return(await Promise.all(r)).every((e=>e))})),ee=t(((e,t)=>e.reduce((async(e,t)=>t(await e)),t))),te={entries:W,map:G,filter:Q,reduce:H,some:X,every:Y,pipeline:ee,all:e=>Promise.all(e),allValues:e=>ee([W,H((async(e,[t,r])=>(e[t]=await r,e)),{})],e)};te.entries,te.map,te.filter,te.reduce,te.some,te.every,te.pipeline,te.all,te.allValues;var re=fetch;const{jsonTypeOf:ne,splitUrl:oe,safeResolveUrl:ae}=p,ie={},se={},ce=(e,t)=>{const r=e in se?se[e]:e;if(r in ie)return ie[r][t]},le={},ue={},fe=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=oe(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=ce(n,"baseToken"),a=ce(n,"anchorToken"),i=oe(t)[0];if(!i&&!oe(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const s=ae(i,e[o]||""),[c,l]=oe(s);delete e[o],l&&o===a&&(e[a]=a!==o?encodeURI(l):`#${encodeURI(l)}`),i&&(ue[i]=c);const u={},f=ce(n,"recursiveAnchorToken");let p;!0===e[f]&&(u[""]=`${c}#`,e[a]="",delete e[f]);const d=ce(n,"vocabularyToken");ne(e[d],"object")?(se[c]=n,p=e[d],delete e[d]):(se[c]=n,p={[n]:!0});const h={"":""};return le[c]={id:c,schemaVersion:n,schema:pe(e,c,n,$.nil,h,u),anchors:h,dynamicAnchors:u,vocabulary:p,validated:!1},c},pe=(e,t,r,n,o,a)=>{if(ne(e,"object")){const i="string"==typeof e.$schema?oe(e.$schema)[0]:r,s=ce(i,"embeddedToken"),c=ce(i,"anchorToken");if("string"==typeof e[s]&&(s!==c||"#"!==e[s][0])){const n=ae(t,e[s]);return e[s]=n,fe(e,n,r),A.cons(e[s],e)}const l=ce(r,"anchorToken"),u=ce(r,"dynamicAnchorToken");"string"==typeof e[u]&&(a[e[u]]=`${t}#${encodeURI(n)}`,o[e[u]]=n,delete e[u]);const f=ce(r,"embeddedToken");if("string"==typeof e[l]){const t=l!==f?e[l]:e[l].slice(1);o[t]=n,delete e[l]}const p=ce(r,"jrefToken");if("string"==typeof e[p])return A.cons(e[p],e);for(const i in e)e[i]=pe(e[i],t,r,$.append(i,n),o,a);return e}return Array.isArray(e)?e.map(((e,i)=>pe(e,t,r,$.append(i,n),o,a))):e},de=e=>le[ue[e]]||le[e],he=Object.freeze({id:"",schemaVersion:void 0,vocabulary:{},pointer:$.nil,schema:void 0,value:void 0,anchors:{},dynamicAnchors:{},validated:!0}),ye=async(e,t=he)=>{const r=ae(me(t),e),[n,o]=oe(r);if(!(e=>e in le||e in ue)(n)){const e=await re(n,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error(`Failed to retrieve schema with id: ${n}`);if(e.headers.has("content-type")){const t=M.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${n} is not a schema. Found a document with media type: ${t}`)}fe(await e.json(),n)}const a=de(n),i="/"!==o[0]?be(a,o):o,s=Object.freeze({...a,pointer:i,value:$.get(i,a.schema)});return ve(s)},ve=e=>A.isReference(e.value)?ye(A.href(e.value),e):e,be=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},me=e=>`${e.id}#${encodeURI(e.pointer)}`,we=e=>A.isReference(e.value)?A.value(e.value):e.value,ge=(e,t)=>{const r=de(t.id),n=Object.freeze({...t,pointer:$.append(e,t.pointer),value:we(t)[e],validated:r.validated});return ve(n)},Oe=t(((e,t)=>te.pipeline([we,te.map((async(r,n)=>e(await ge(n,t),n))),te.all],t)));var Ee={setConfig:(e,t,r)=>{ie[e]||(ie[e]={}),ie[e][t]=r},getConfig:ce,add:fe,get:ye,markValidated:e=>{le[e].validated=!0},uri:me,value:we,getAnchorPointer:be,typeOf:(e,t)=>ne(we(e),t),has:(e,t)=>e in we(t),step:ge,keys:e=>Object.keys(we(e)),entries:e=>te.pipeline([we,Object.keys,te.map((async t=>[t,await ge(t,e)])),te.all],e),map:Oe,length:e=>we(e).length};Ee.setConfig,Ee.getConfig,Ee.add,Ee.get,Ee.markValidated,Ee.uri,Ee.value,Ee.getAnchorPointer,Ee.typeOf,Ee.has,Ee.step,Ee.keys,Ee.entries,Ee.map,Ee.length;class je extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var $e=je;const{splitUrl:Se}=p,Pe="FLAG",Ae="BASIC",xe="DETAILED",Ie="VERBOSE";let Te=xe,ke=!0;const Ve=async e=>{const t={metaData:{}};return{ast:t,schemaUri:await _e(e,t)}},Re=t((({ast:e,schemaUri:t},r,n=Pe)=>{if(![Pe,Ae,xe,Ie].includes(n))throw Error(`The '${n}' error format is not supported`);const a=[],i=o.subscribe("result",Ce(n,a));return Ne(t,r,e,{}),o.unsubscribe(i),a[0]})),Ce=(e,t)=>{const r=[];return(n,o)=>{if("result"===n){const{keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:a}=o,i={keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:a,errors:[]};r.push(i)}else if("result.start"===n)r.push(n);else if("result.end"===n){const n=r.pop();for(;"result.start"!==r[r.length-1];){const t=r.pop(),o=[t];e===Ae&&(o.push(...t.errors),delete t.errors),(e===Ie||e!==Pe&&!t.valid)&&n.errors.unshift(...o)}r[r.length-1]=n,t[0]=n}}},Ue={},ze=e=>Ue[e],Ke=e=>e in Ue,Le={},qe={},_e=async(e,t)=>{if(e=await De(e),!Ke(`${e.schemaVersion}#validate`)){const t=await Ee.get(e.schemaVersion);(Ee.getConfig(t.id,"mandatoryVocabularies")||[]).forEach((e=>{if(!t.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)})),Object.entries(t.vocabulary).forEach((([e,r])=>{if(e in Le)Object.entries(Le[e]).forEach((([e,r])=>{((e,t)=>{Ue[e]={collectEvaluatedItems:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&new Set,collectEvaluatedProperties:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&[],...t}})(`${t.id}#${e}`,r)}));else if(r)throw Error(`Missing required vocabulary: ${e}`)}))}if(ke&&!e.validated){if(Ee.markValidated(e.id),!(e.schemaVersion in qe)){const t=await Ee.get(e.schemaVersion),r=await Ve(t);qe[t.id]=Re(r)}const t=L.cons(e.schema,e.id),r=qe[e.schemaVersion](t,Te);if(!r.valid)throw new $e(r)}return e.id in t.metaData||(t.metaData[e.id]={id:e.id,dynamicAnchors:e.dynamicAnchors,anchors:e.anchors}),ze(`${e.schemaVersion}#validate`).compile(e,t)},De=async e=>Ee.typeOf(e,"string")?De(await Ee.get(Ee.value(e),e)):e,Ne=(e,t,r,n)=>{const o=Be(e,r),a=Se(e)[0];return ze(o).interpret(e,t,r,{...r.metaData[a].dynamicAnchors,...n})},Be=(e,t)=>{if(!(e in t))throw Error(`No schema found at ${e}`);return t[e][0]};var Fe={validate:async(e,t,r)=>{const n=await Ve(e),o=(e,t)=>Re(n,L.cons(e),t);return void 0===t?o:o(t,r)},compile:Ve,interpret:Re,setMetaOutputFormat:e=>{Te=e},setShouldMetaValidate:e=>{ke=e},FLAG:Pe,BASIC:Ae,DETAILED:xe,VERBOSE:Ie,add:(e,t="",r="")=>{const n=Ee.add(e,t,r);delete qe[n]},getKeyword:ze,hasKeyword:Ke,defineVocabulary:(e,t)=>{Le[e]=t},compileSchema:_e,interpretSchema:Ne,collectEvaluatedProperties:(e,t,r,n,o)=>{const a=Be(e,r);return ze(a).collectEvaluatedProperties(e,t,r,n,o)},collectEvaluatedItems:(e,t,r,n,o)=>{const a=Be(e,r);return ze(a).collectEvaluatedItems(e,t,r,n,o)}};var Ze={compile:e=>Ee.value(e),interpret:()=>!0};var Je={compile:async(e,t)=>{const r=Ee.uri(e);if(!(r in t)){t[r]=!1;const n=Ee.value(e);if(!["object","boolean"].includes(typeof n))throw Error(`No schema found at '${Ee.uri(e)}'`);t[r]=[`${e.schemaVersion}#validate`,Ee.uri(e),"boolean"==typeof n?n:await te.pipeline([Ee.entries,te.map((([t,r])=>[`${e.schemaVersion}#${t}`,r])),te.filter((([t])=>Fe.hasKeyword(t)&&t!==`${e.schemaVersion}#validate`)),te.map((async([r,n])=>{const o=await Fe.getKeyword(r).compile(n,t,e);return[r,Ee.uri(n),o]})),te.all],e)]}return r},interpret:(e,t,r,n)=>{const[a,i,s]=r[e];o.publishSync("result.start");const c="boolean"==typeof s?s:s.every((([e,a,i])=>{o.publishSync("result.start");const s=Fe.getKeyword(e).interpret(i,t,r,n);return o.publishSync("result",{keyword:e,absoluteKeywordLocation:a,instanceLocation:L.uri(t),valid:s,ast:i}),o.publishSync("result.end"),s}));return o.publishSync("result",{keyword:a,absoluteKeywordLocation:i,instanceLocation:L.uri(t),valid:c,ast:e}),o.publishSync("result.end"),c},collectEvaluatedProperties:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&[]:a.filter((([e])=>!o||!e.endsWith("#unevaluatedProperties"))).reduce(((e,[o,,a])=>{const i=e&&Fe.getKeyword(o).collectEvaluatedProperties(a,t,r,n);return!1!==i&&[...e,...i]}),[])},collectEvaluatedItems:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&new Set:a.filter((([e])=>!o||!e.endsWith("#unevaluatedItems"))).reduce(((e,[o,,a])=>{const i=!1!==e&&Fe.getKeyword(o).collectEvaluatedItems(a,t,r,n);return!1!==i&&new Set([...e,...i])}),new Set)}},Me={metaData:Ze,validate:Je},We={Core:Fe,Schema:Ee,Instance:L,Reference:A,Keywords:Me,InvalidSchemaError:$e},Ge=We.Core,He=We.Schema,Qe=We.Instance,Xe=We.Reference,Ye=We.Keywords,et=We.InvalidSchemaError;return e.Core=Ge,e.Instance=Qe,e.InvalidSchemaError=et,e.Keywords=Ye,e.Reference=Xe,e.Schema=He,e.default=We,Object.defineProperty(e,"__esModule",{value:!0}),e}({}); | ||
var JSC=function(e,t){"use strict";function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=r(t),a=function(e,t){return function r(){null==t&&(t=e.length);var n=[].slice.call(arguments);return n.length>=t?e.apply(this,n):function(){return r.apply(this,n.concat([].slice.call(arguments)))}}};var o="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var i,s=(function(e,t){var r,n;r="object"==typeof window&&window||o,n={},r.PubSub=n,function(e){var t={},r=-1,n="*";function a(e){var t;for(t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function o(e){return function(){throw e}}function i(e,t,r){try{e(t,r)}catch(e){setTimeout(o(e),0)}}function s(e,t,r){e(t,r)}function u(e,r,n,a){var o,u=t[r],l=a?s:i;if(Object.prototype.hasOwnProperty.call(t,r))for(o in u)Object.prototype.hasOwnProperty.call(u,o)&&l(u[o],e,n)}function l(e,t,r){return function(){var a=String(e),o=a.lastIndexOf(".");for(u(e,e,t,r);-1!==o;)o=(a=a.substr(0,o)).lastIndexOf("."),u(e,a,t,r);u(e,n,t,r)}}function c(e){var r=String(e);return Boolean(Object.prototype.hasOwnProperty.call(t,r)&&a(t[r]))}function f(e){for(var t=String(e),r=c(t)||c(n),a=t.lastIndexOf(".");!r&&-1!==a;)a=(t=t.substr(0,a)).lastIndexOf("."),r=c(t);return r}function h(e,t,r,n){var a=l(e="symbol"==typeof e?e.toString():e,t,n);return!!f(e)&&(!0===r?a():setTimeout(a,0),!0)}e.publish=function(t,r){return h(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return h(t,r,!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(t,e)||(t[e]={});var a="uid_"+String(++r);return t[e][a]=n,a},e.subscribeAll=function(t){return e.subscribe(n,t)},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n,a=0;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)){for(n in t[r])a++;break}return a},e.getSubscriptions=function(e){var r,n=[];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,a,o,i=function(e){var r;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e))return!0;return!1},s="string"==typeof r&&(Object.prototype.hasOwnProperty.call(t,r)||i(r)),u=!s&&"string"==typeof r,l="function"==typeof r,c=!1;if(!s){for(n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(a=t[n],u&&a[r]){delete a[r],c=r;break}if(l)for(o in a)Object.prototype.hasOwnProperty.call(a,o)&&a[o]===r&&(delete a[o],c=!0)}return c}e.clearSubscriptions(r)}}(n),void 0!==e&&e.exports&&(t=e.exports=n),t.PubSub=n,e.exports=t=n}(i={exports:{}},i.exports),i.exports);s.PubSub;var u=function(e,t){if(e=e.trim(),(t=t.trim()).startsWith("about:"))return t;const r=function(e){const t={host:"",path:"",query:"",protocol:""};let r=e,n=e.indexOf("//");t.protocol=r.substring(0,n),n+=2;const a=e.indexOf("/",n),o=e.indexOf("?"),i=e.indexOf("#");-1!==i&&(r=r.substring(0,i));if(-1!==o){const e=r.substring(o);t.query=e,r=r.substring(0,o)}if(-1!==a){const e=r.substring(0,a);t.host=e,r=r.substring(a),t.path=r}else t.host=r;return t}(e),n=function(e){const t={href:e,hash:"",query:"",netPath:!1,absolutePath:!1,relativePath:!1};if(f.test(e))return t.netPath=!0,t;"/"===e[0]?t.absolutePath=!0:""!==e&&(t.relativePath=!0);let r=e;const n=e.indexOf("?"),a=e.indexOf("#");if(-1!==a){const e=r.substring(a);t.hash=e,r=r.substring(0,a)}if(-1!==n){const e=r.substring(n);t.query=e,r=r.substring(0,n)}return t.path=r,t}(t);if(!r.protocol&&!n.netPath)throw new Error("Error, protocol is not specified");if(n.netPath)return function(e){return e.startsWith("//")}(n.href)&&(n.href=r.protocol+n.href),function(e){const t=e.indexOf("//")+2,r=!e.includes("/",t),n=!e.includes("?",t),a=!e.includes("#",t);return r&&n&&a}(n.href)?l(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:a}=n;return r.host+c(e)+t+a}if(n.relativePath){const{path:e,query:t,hash:a}=n;let o,i=r.path,s=r.host;return 0===e.length?o=i:(i=i.substring(0,i.lastIndexOf("/")),o=c(i+"/"+e)),s+=""!==o||t||a?o+t+a:"/",s}{const{host:e,path:t,query:a}=r;return t||a?e+t+a+n.hash:l(e)}};function l(e){return e+("/"===e[e.length-1]?"":"/")}function c(e){let t=e.split("/");""===t[0]&&(t=t.slice(1));let r=[];return t.forEach(((e,n)=>{"."!==e&&(".."===e?r.pop():""===e&&n!==t.length-1||r.push(e))})),"/"+r.join("/")}const f=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");const h={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},m=e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),a=e.slice(r+1);return[decodeURI(n),decodeURI(a)]},p=e=>{const t=RegExp(/^(.+):\/\//).exec(e);return t?t[1]:""};var d={jsonTypeOf:(e,t)=>h[t](e),splitUrl:m,safeResolveUrl:(e,t)=>{const r=u(e,t),n=m(e)[0];if(n&&"file"===p(r)&&"file"!==p(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r}};const y=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(E)},v=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const a=e.shift();return{...t,[a]:v(e,I(t,a,n),r,w(a,n))}}if(Array.isArray(t)){const n=[...t];return n[S(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:I(t,e[0],n)},b=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||j(t)){const a=e.shift();b(e,I(t,a,n),r,w(a,n))}else{t[S(t,e[0])]=r}},g=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),a=I(t,n,r);return{...t,[n]:g(e,a,w(n,r))}}if(Array.isArray(t))return t.filter(((t,r)=>r!=e[0]));if("object"==typeof t&&null!==t){const{[e[0]]:r,...n}=t;return n}return I(t,e[0],r)}},x=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),a=I(t,n,r);x(e,a,w(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:I(t,e[0],r)},w=a(((e,t)=>t+"/"+O(e))),O=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),E=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),S=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,I=(e,t,r="")=>{if(void 0===e)throw TypeError(`Value at '${r}' is undefined and does not have property '${t}'`);if(null===e)throw TypeError(`Value at '${r}' is null and does not have property '${t}'`);if(j(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[S(e,t)]},j=e=>null===e||"object"!=typeof e;var P={nil:"",append:w,get:(e,t)=>{const r=y(e),n=e=>r.reduce((([e,t],r)=>[I(e,r,t),w(r,t)]),[e,""])[0];return void 0===t?n:n(t)},set:(e,t,r)=>{const n=y(e),o=a(((e,t)=>v(n,e,t,"")));return void 0===t?o:o(t,r)},assign:(e,t,r)=>{const n=y(e),o=a(((e,t)=>b(n,e,t,"")));return void 0===t?o:o(t,r)},unset:(e,t)=>{const r=y(e),n=e=>g(r,e,"");return void 0===t?n:n(t)},remove:(e,t)=>{const r=y(e),n=e=>x(r,e,"");return void 0===t?n:n(t)}};P.nil,P.append,P.get,P.set,P.assign,P.unset,P.remove;const A=Symbol("$__value"),T=Symbol("$__href");var R={cons:(e,t)=>Object.freeze({[T]:e,[A]:t}),isReference:e=>e&&void 0!==e[T],href:e=>e[T],value:e=>e[A]};const{jsonTypeOf:$}=d,V=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),k=e=>R.isReference(e.value)?R.value(e.value):e.value,L=a(((e,t)=>$(k(e),t))),H=(e,t)=>Object.freeze({...t,pointer:P.append(e,t.pointer),value:k(t)[e]}),U=a(((e,t)=>k(t).map(((r,n,a,o)=>e(H(n,t),n,a,o))))),q=a(((e,t)=>k(t).map(((e,r,n,a)=>H(r,t))).filter(((t,r,n,a)=>e(t,r,n,a))))),D=a(((e,t,r)=>k(r).reduce(((t,n,a)=>e(t,H(a,r),a)),t))),_=a(((e,t)=>k(t).every(((r,n,a,o)=>e(H(n,t),n,a,o))))),C=a(((e,t)=>k(t).some(((r,n,a,o)=>e(H(n,t),n,a,o)))));var Q={nil:V,cons:(e,t="")=>Object.freeze({...V,id:t,instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:k,has:(e,t)=>e in k(t),typeOf:L,step:H,entries:e=>Object.keys(k(e)).map((t=>[t,H(t,e)])),keys:e=>Object.keys(k(e)),map:U,filter:q,reduce:D,every:_,some:C,length:e=>k(e).length},z=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,B=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,K=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,N=/\\([\u000b\u0020-\u00ff])/g,M=/([\\"])/g,J=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function F(e){var t=String(e);if(K.test(t))return t;if(t.length>0&&!B.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(M,"\\$1")+'"'}function W(e){this.parameters=Object.create(null),this.type=e}var Z={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!J.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var a,o=Object.keys(t).sort(),i=0;i<o.length;i++){if(a=o[i],!K.test(a))throw new TypeError("invalid parameter name");n+="; "+a+"="+F(t[a])}return n},parse:function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;"function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.substr(0,r).trim():t.trim();if(!J.test(n))throw new TypeError("invalid media type");var a=new W(n.toLowerCase());if(-1!==r){var o,i,s;for(z.lastIndex=r;i=z.exec(t);){if(i.index!==r)throw new TypeError("invalid parameter format");r+=i[0].length,o=i[1].toLowerCase(),'"'===(s=i[2])[0]&&(s=s.substr(1,s.length-2).replace(N,"$1")),a.parameters[o]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return a}},G=async e=>Object.entries(await e),X=a((async(e,t)=>(await t).map(e))),Y=a((async(e,t,r)=>(await r).reduce((async(t,r)=>e(await t,r)),t))),ee=a((async(e,t,r={})=>Y((async(t,r)=>await e(r)?t.concat([r]):t),[],t,r))),te=a((async(e,t)=>{const r=await X(e,t);return(await Promise.all(r)).some((e=>e))})),re=a((async(e,t)=>{const r=await X(e,t);return(await Promise.all(r)).every((e=>e))})),ne=a(((e,t)=>e.reduce((async(e,t)=>t(await e)),t))),ae={entries:G,map:X,filter:ee,reduce:Y,some:te,every:re,pipeline:ne,all:e=>Promise.all(e),allValues:e=>ne([G,Y((async(e,[t,r])=>(e[t]=await r,e)),{})],e)};ae.entries,ae.map,ae.filter,ae.reduce,ae.some,ae.every,ae.pipeline,ae.all,ae.allValues;var oe={ABSOLUTE:"absolute",PATH_RELATIVE:"pathRelative",ROOT_RELATIVE:"rootRelative",SHORTEST:"shortest"};function ie(e,t){var r=t.removeEmptyQueries&&e.extra.relation.minimumPort;return e.query.string[r?"stripped":"full"]}function se(e,t){return!e.extra.relation.minimumQuery||t.output===oe.ABSOLUTE||t.output===oe.ROOT_RELATIVE}function ue(e,t){var r=t.removeDirectoryIndexes&&e.extra.resourceIsIndex,n=e.extra.relation.minimumResource&&t.output!==oe.ABSOLUTE&&t.output!==oe.ROOT_RELATIVE;return!!e.resource&&!n&&!r}var le=function(e,t){var r="";return r+=function(e,t){var r="";return(e.extra.relation.maximumHost||t.output===oe.ABSOLUTE)&&(e.extra.relation.minimumScheme&&t.schemeRelative&&t.output!==oe.ABSOLUTE?r+="//":r+=e.scheme+"://"),r}(e,t),r+=function(e,t){return!e.auth||t.removeAuth||!e.extra.relation.maximumHost&&t.output!==oe.ABSOLUTE?"":e.auth+"@"}(e,t),r+=function(e,t){return e.host.full&&(e.extra.relation.maximumAuth||t.output===oe.ABSOLUTE)?e.host.full:""}(e,t),r+=function(e,t){return e.port&&!e.extra.portIsDefault&&e.extra.relation.maximumHost?":"+e.port:""}(e),r+=function(e,t){var r="",n=e.path.absolute.string,a=e.path.relative.string,o=ue(e,t);if(e.extra.relation.maximumHost||t.output===oe.ABSOLUTE||t.output===oe.ROOT_RELATIVE)r=n;else if(a.length<=n.length&&t.output===oe.SHORTEST||t.output===oe.PATH_RELATIVE){if(""===(r=a)){var i=se(e,t)&&!!ie(e,t);e.extra.relation.maximumPath&&!o?r="./":!e.extra.relation.overridesQuery||o||i||(r="./")}}else r=n;return"/"!==r||o||!t.removeRootTrailingSlash||e.extra.relation.minimumPort&&t.output!==oe.ABSOLUTE||(r=""),r}(e,t),r+=function(e,t){return ue(e,t)?e.resource:""}(e,t),r+=function(e,t){return se(e,t)?ie(e,t):""}(e,t),r+=function(e,t){return e.hash?e.hash:""}(e)};var ce={clone:function e(t){if(t instanceof Object){var r=t instanceof Array?[]:{};for(var n in t)t.hasOwnProperty(n)&&(r[n]=e(t[n]));return r}return t},isPlainObject:function(e){return!!e&&"object"==typeof e&&e.constructor===Object},shallowMerge:function(e,t){if(e instanceof Object&&t instanceof Object)for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e}};function fe(e,t){return t instanceof Object&&e instanceof Object?t instanceof Array&&e instanceof Array?t.concat(e):ce.shallowMerge(e,t):e}var he=function(e,t){if(ce.isPlainObject(e)){var r={};for(var n in t)t.hasOwnProperty(n)&&(void 0!==e[n]?r[n]=fe(e[n],t[n]):r[n]=t[n]);return r}return t};var me=function(e){var t=!(e.scheme||e.auth||e.host.full||e.port),r=t&&!e.path.absolute.string,n=r&&!e.resource,a=n&&!e.query.string.full.length,o=a&&!e.hash;e.extra.hrefInfo.minimumPathOnly=t,e.extra.hrefInfo.minimumResourceOnly=r,e.extra.hrefInfo.minimumQueryOnly=n,e.extra.hrefInfo.minimumHashOnly=a,e.extra.hrefInfo.empty=o};var pe=function(e,t){if(t.ignore_www){var r=e.host.full;if(r){var n=r;0===r.indexOf("www.")&&(n=r.substr(4)),e.host.stripped=n}}};function de(e){if("/"!==e){var t=[];return e.split("/").forEach((function(e){""!==e&&t.push(e)})),t}return[]}var ye=function(e,t){var r=e.path.absolute.string;if(r){var n=r.lastIndexOf("/");if(n>-1){if(++n<r.length){var a=r.substr(n);"."!==a&&".."!==a?(e.resource=a,r=r.substr(0,n)):r+="/"}e.path.absolute.string=r,e.path.absolute.array=de(r)}else"."===r||".."===r?(r+="/",e.path.absolute.string=r,e.path.absolute.array=de(r)):(e.resource=r,e.path.absolute.string=null);e.extra.resourceIsIndex=function(e,t){var r=!1;return t.directoryIndexes.every((function(t){return t!==e||(r=!0,!1)})),r}(e.resource,t)}};var ve=function(e,t){var r=-1;for(var n in t.defaultPorts)if(n===e.scheme&&t.defaultPorts.hasOwnProperty(n)){r=t.defaultPorts[n];break}r>-1&&(r=r.toString(),null===e.port&&(e.port=r),e.extra.portIsDefault=e.port===r)},be=Object.prototype.hasOwnProperty;function ge(e,t){var r=0,n="";for(var a in e)if(""!==a&&!0===be.call(e,a)){var o=e[a];""===o&&t||(n+=1==++r?"?":"&",a=encodeURIComponent(a),n+=""!==o?a+"="+encodeURIComponent(o).replace(/%20/g,"+"):a)}return n}var xe=function(e,t){e.query.string.full=ge(e.query.object,!1),t.removeEmptyQueries&&(e.query.string.stripped=ge(e.query.object,!0))},we=n.default.parse;var Oe=function(e,t){return function(e,t){var r=!0;return t.rejectedSchemes.every((function(t){return r=!(0===e.indexOf(t+":"))})),r}(e,t)?(r=we(e,!0,t.slashesDenoteHost),(n=r.protocol)&&n.indexOf(":")===n.length-1&&(n=n.substr(0,n.length-1)),r.host={full:r.hostname,stripped:null},r.path={absolute:{array:null,string:r.pathname},relative:{array:null,string:null}},r.query={object:r.query,string:{full:null,stripped:null}},r.extra={hrefInfo:{minimumPathOnly:null,minimumResourceOnly:null,minimumQueryOnly:null,minimumHashOnly:null,empty:null,separatorOnlyQuery:"?"===r.search},portIsDefault:null,relation:{maximumScheme:null,maximumAuth:null,maximumHost:null,maximumPort:null,maximumPath:null,maximumResource:null,maximumQuery:null,maximumHash:null,minimumScheme:null,minimumAuth:null,minimumHost:null,minimumPort:null,minimumPath:null,minimumResource:null,minimumQuery:null,minimumHash:null,overridesQuery:null},resourceIsIndex:null,slashes:r.slashes},r.resource=null,r.scheme=n,delete r.hostname,delete r.pathname,delete r.protocol,delete r.search,delete r.slashes,r):{href:e,valid:!1};var r,n};var Ee={join:function(e){return e.length>0?e.join("/")+"/":""},resolveDotSegments:function(e){var t=[];return e.forEach((function(e){".."!==e?"."!==e&&t.push(e):t.length>0&&t.splice(t.length-1,1)})),t}};function Se(e,t){var r=Oe(e,t);return!1===r.valid||(pe(r,t),ve(r,t),ye(r,t),xe(r,t),me(r)),r}var Ie={from:function(e,t,r){if(e){var n=Se(e,t),a=Ee.resolveDotSegments(n.path.absolute.array);return n.path.absolute.array=a,n.path.absolute.string="/"+Ee.join(a),n}return r},to:Se};var je={pathOn:function(e,t,r){var n=e.extra.hrefInfo.minimumQueryOnly,a=e.extra.hrefInfo.minimumHashOnly,o=e.extra.hrefInfo.empty,i=e.extra.relation.minimumPort,s=e.extra.relation.minimumScheme,u=i&&e.path.absolute.string===t.path.absolute.string,l=e.resource===t.resource||!e.resource&&t.extra.resourceIsIndex||r.removeDirectoryIndexes&&e.extra.resourceIsIndex&&!t.resource,c=u&&(l||n||a||o),f=r.removeEmptyQueries?"stripped":"full",h=e.query.string[f],m=t.query.string[f],p=c&&!!h&&h===m||(a||o)&&!e.extra.hrefInfo.separatorOnlyQuery,d=p&&e.hash===t.hash;e.extra.relation.minimumPath=u,e.extra.relation.minimumResource=c,e.extra.relation.minimumQuery=p,e.extra.relation.minimumHash=d,e.extra.relation.maximumPort=!s||s&&!u,e.extra.relation.maximumPath=!s||s&&!c,e.extra.relation.maximumResource=!s||s&&!p,e.extra.relation.maximumQuery=!s||s&&!d,e.extra.relation.maximumHash=!s||s&&!d,e.extra.relation.overridesQuery=u&&e.extra.relation.maximumResource&&!p&&!!m},upToPath:function(e,t,r){var n=e.extra.hrefInfo.minimumPathOnly,a=e.scheme===t.scheme||!e.scheme,o=a&&(e.auth===t.auth||r.removeAuth||n),i=r.ignore_www?"stripped":"full",s=o&&(e.host[i]===t.host[i]||n),u=s&&(e.port===t.port||n);e.extra.relation.minimumScheme=a,e.extra.relation.minimumAuth=o,e.extra.relation.minimumHost=s,e.extra.relation.minimumPort=u,e.extra.relation.maximumScheme=!a||a&&!o,e.extra.relation.maximumAuth=!a||a&&!s,e.extra.relation.maximumHost=!a||a&&!u}};var Pe=function(e,t,r){je.upToPath(e,t,r),e.extra.relation.minimumScheme&&(e.scheme=t.scheme),e.extra.relation.minimumAuth&&(e.auth=t.auth),e.extra.relation.minimumHost&&(e.host=ce.clone(t.host)),e.extra.relation.minimumPort&&function(e,t){e.port=t.port,e.extra.portIsDefault=t.extra.portIsDefault}(e,t),e.extra.relation.minimumScheme&&function(e,t){if(e.extra.relation.maximumHost||!e.extra.hrefInfo.minimumResourceOnly){var r=e.path.absolute.array,n="/";r?(e.extra.hrefInfo.minimumPathOnly&&0!==e.path.absolute.string.indexOf("/")&&(r=t.path.absolute.array.concat(r)),r=Ee.resolveDotSegments(r),n+=Ee.join(r)):r=[],e.path.absolute.array=r,e.path.absolute.string=n}else e.path=ce.clone(t.path)}(e,t),je.pathOn(e,t,r),e.extra.relation.minimumResource&&function(e,t){e.resource=t.resource,e.extra.resourceIsIndex=t.extra.resourceIsIndex}(e,t),e.extra.relation.minimumQuery&&(e.query=ce.clone(t.query)),e.extra.relation.minimumHash&&(e.hash=t.hash)};var Ae=function(e,t,r){if(e.extra.relation.minimumScheme){var n=(a=e.path.absolute.array,o=t.path.absolute.array,i=[],s=!0,u=-1,o.forEach((function(e,t){s&&(a[t]!==e?s=!1:u=t),s||i.push("..")})),a.forEach((function(e,t){t>u&&i.push(e)})),i);e.path.relative.array=n,e.path.relative.string=Ee.join(n)}var a,o,i,s,u};var Te=function(e,t,r){return Pe(t,e,r),Ae(t,e),t};function Re(e,t){this.options=he(t,{defaultPorts:{ftp:21,http:80,https:443},directoryIndexes:["index.html"],ignore_www:!1,output:Re.SHORTEST,rejectedSchemes:["data","javascript","mailto"],removeAuth:!1,removeDirectoryIndexes:!0,removeEmptyQueries:!1,removeRootTrailingSlash:!0,schemeRelative:!0,site:void 0,slashesDenoteHost:!0}),this.from=Ie.from(e,this.options,null)}Re.prototype.relate=function(e,t,r){if(ce.isPlainObject(t)?(r=t,t=e,e=null):t||(t=e,e=null),r=he(r,this.options),e=e||r.site,!(e=Ie.from(e,r,this.from))||!e.href)throw new Error("from value not defined.");if(e.extra.hrefInfo.minimumPathOnly)throw new Error("from value supplied is not absolute: "+e.href);return!1===(t=Ie.to(t,r)).valid?t.href:(t=Te(e,t,r),t=le(t,r))},Re.relate=function(e,t,r){return(new Re).relate(e,t,r)},ce.shallowMerge(Re,oe);var $e=Re,Ve=fetch;const{jsonTypeOf:ke,splitUrl:Le,safeResolveUrl:He}=d,Ue={},qe={},De=(e,t)=>{const r=e in qe?qe[e]:e;if(r in Ue)return Ue[r][t]},_e={},Ce={},Qe=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=Le(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const a=De(n,"baseToken"),o=De(n,"anchorToken"),i=Le(t)[0];if(!i&&!Le(e[a]||"")[0])throw Error("Couldn't determine an identifier for the schema");const s=He(i,e[a]||""),[u,l]=Le(s);delete e[a],l&&a===o&&(e[o]=o!==a?encodeURI(l):`#${encodeURI(l)}`),i&&(Ce[i]=u);const c={},f=De(n,"recursiveAnchorToken");let h;!0===e[f]&&(c[""]=`${u}#`,e[o]="",delete e[f]);const m=De(n,"vocabularyToken");ke(e[m],"object")?(qe[u]=n,h=e[m],delete e[m]):(qe[u]=n,h={[n]:!0});const p={"":""};return _e[u]={id:u,schemaVersion:n,schema:ze(e,u,n,P.nil,p,c),anchors:p,dynamicAnchors:c,vocabulary:h,validated:!1},u},ze=(e,t,r,n,a,o)=>{if(ke(e,"object")){const i="string"==typeof e.$schema?Le(e.$schema)[0]:r,s=De(i,"embeddedToken"),u=De(i,"anchorToken");if("string"==typeof e[s]&&(s!==u||"#"!==e[s][0])){const n=He(t,e[s]);return e[s]=n,Qe(e,n,r),R.cons(e[s],e)}const l=De(r,"anchorToken"),c=De(r,"dynamicAnchorToken");"string"==typeof e[c]&&(o[e[c]]=`${t}#${encodeURI(n)}`,a[e[c]]=n,delete e[c]);const f=De(r,"embeddedToken");if("string"==typeof e[l]){const t=l!==f?e[l]:e[l].slice(1);a[t]=n,delete e[l]}const h=De(r,"jrefToken");if("string"==typeof e[h])return R.cons(e[h],e);for(const i in e)e[i]=ze(e[i],t,r,P.append(i,n),a,o);return e}return Array.isArray(e)?e.map(((e,i)=>ze(e,t,r,P.append(i,n),a,o))):e},Be=e=>_e[Ce[e]]||_e[e],Ke=Object.freeze({id:"",schemaVersion:void 0,vocabulary:{},pointer:P.nil,schema:void 0,value:void 0,anchors:{},dynamicAnchors:{},validated:!0}),Ne=async(e,t=Ke)=>{const r=He(Fe(t),e),[n,a]=Le(r);if(!(e=>e in _e||e in Ce)(n)){const e=await Ve(n,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error(`Failed to retrieve schema with id: ${n}`);if(e.headers.has("content-type")){const t=Z.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${n} is not a schema. Found a document with media type: ${t}`)}Qe(await e.json(),n)}const o=Be(n),i="/"!==a[0]?Je(o,a):a,s=Object.freeze({...o,pointer:i,value:P.get(i,o.schema)});return Me(s)},Me=e=>R.isReference(e.value)?Ne(R.href(e.value),e):e,Je=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},Fe=e=>`${e.id}#${encodeURI(e.pointer)}`,We=e=>R.isReference(e.value)?R.value(e.value):e.value,Ze=(e,t)=>{const r=Be(t.id),n=Object.freeze({...t,pointer:P.append(e,t.pointer),value:We(t)[e],validated:r.validated});return Me(n)},Ge=a(((e,t)=>ae.pipeline([We,ae.map((async(r,n)=>e(await Ze(n,t),n))),ae.all],t))),Xe={parentId:"",parentDialect:"",includeEmbedded:!0},Ye=(e,t)=>t.startsWith("file://")?""===e?"":$e.relate(e,t):t;var et={setConfig:(e,t,r)=>{Ue[e]||(Ue[e]={}),Ue[e][t]=r},getConfig:De,add:Qe,get:Ne,markValidated:e=>{_e[e].validated=!0},uri:Fe,value:We,getAnchorPointer:Je,typeOf:(e,t)=>ke(We(e),t),has:(e,t)=>e in We(t),step:Ze,keys:e=>Object.keys(We(e)),entries:e=>ae.pipeline([We,Object.keys,ae.map((async t=>[t,await Ze(t,e)])),ae.all],e),map:Ge,length:e=>We(e).length,toSchema:(e,t={})=>{const r={...Xe,...t},n=JSON.parse(JSON.stringify(e.schema,((t,n)=>{if(!R.isReference(n))return n;const a=R.value(n),o=a.$schema||e.schemaVersion,i=De(o,"embeddedToken");return!r.includeEmbedded&&i in a?void 0:R.value(n)}))),a=De(e.schemaVersion,"dynamicAnchorToken");Object.entries(e.dynamicAnchors).forEach((([e,t])=>{const r=Le(t)[1];P.assign(r,n,{[a]:e,...P.get(r,n)})}));const o=De(e.schemaVersion,"anchorToken");Object.entries(e.anchors).filter((([e])=>""!==e)).forEach((([e,t])=>{P.assign(t,n,{[o]:e,...P.get(t,n)})}));const i=De(e.schemaVersion,"baseToken"),s=Ye(r.parentId,e.id),u=r.parentDialect===e.schemaVersion?"":e.schemaVersion;return{...s&&{[i]:s},...u&&{$schema:u},...n}}};et.setConfig,et.getConfig,et.add,et.get,et.markValidated,et.uri,et.value,et.getAnchorPointer,et.typeOf,et.has,et.step,et.keys,et.entries,et.map,et.length,et.toSchema;class tt extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var rt=tt;const{splitUrl:nt}=d,at="FLAG",ot="BASIC",it="DETAILED",st="VERBOSE";let ut=it,lt=!0;const ct=async e=>{const t={metaData:{}};return{ast:t,schemaUri:await bt(e,t)}},ft=a((({ast:e,schemaUri:t},r,n=at)=>{if(![at,ot,it,st].includes(n))throw Error(`The '${n}' error format is not supported`);const a=[],o=s.subscribe("result",ht(n,a));return xt(t,r,e,{}),s.unsubscribe(o),a[0]})),ht=(e,t)=>{const r=[];return(n,a)=>{if("result"===n){const{keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:o}=a,i={keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:o,errors:[]};r.push(i)}else if("result.start"===n)r.push(n);else if("result.end"===n){const n=r.pop();for(;"result.start"!==r[r.length-1];){const t=r.pop(),a=[t];e===ot&&(a.push(...t.errors),delete t.errors),(e===st||e!==at&&!t.valid)&&n.errors.unshift(...a)}r[r.length-1]=n,t[0]=n}}},mt={},pt=e=>mt[e],dt=e=>e in mt,yt={},vt={},bt=async(e,t)=>{if(e=await gt(e),!dt(`${e.schemaVersion}#validate`)){const t=await et.get(e.schemaVersion);(et.getConfig(t.id,"mandatoryVocabularies")||[]).forEach((e=>{if(!t.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)})),Object.entries(t.vocabulary).forEach((([e,r])=>{if(e in yt)Object.entries(yt[e]).forEach((([e,r])=>{((e,t)=>{mt[e]={collectEvaluatedItems:(e,r,n,a,o)=>t.interpret(e,r,n,a,o)&&new Set,collectEvaluatedProperties:(e,r,n,a,o)=>t.interpret(e,r,n,a,o)&&[],...t}})(`${t.id}#${e}`,r)}));else if(r)throw Error(`Missing required vocabulary: ${e}`)}))}if(lt&&!e.validated){if(et.markValidated(e.id),!(e.schemaVersion in vt)){const t=await et.get(e.schemaVersion),r=await ct(t);vt[t.id]=ft(r)}const t=Q.cons(e.schema,e.id),r=vt[e.schemaVersion](t,ut);if(!r.valid)throw new rt(r)}return e.id in t.metaData||(t.metaData[e.id]={id:e.id,dynamicAnchors:e.dynamicAnchors,anchors:e.anchors}),pt(`${e.schemaVersion}#validate`).compile(e,t)},gt=async e=>et.typeOf(e,"string")?gt(await et.get(et.value(e),e)):e,xt=(e,t,r,n)=>{const a=wt(e,r),o=nt(e)[0];return pt(a).interpret(e,t,r,{...r.metaData[o].dynamicAnchors,...n})},wt=(e,t)=>{if(!(e in t))throw Error(`No schema found at ${e}`);return t[e][0]};var Ot={validate:async(e,t,r)=>{const n=await ct(e),a=(e,t)=>ft(n,Q.cons(e),t);return void 0===t?a:a(t,r)},compile:ct,interpret:ft,setMetaOutputFormat:e=>{ut=e},setShouldMetaValidate:e=>{lt=e},FLAG:at,BASIC:ot,DETAILED:it,VERBOSE:st,add:(e,t="",r="")=>{const n=et.add(e,t,r);delete vt[n]},getKeyword:pt,hasKeyword:dt,defineVocabulary:(e,t)=>{yt[e]=t},compileSchema:bt,interpretSchema:xt,collectEvaluatedProperties:(e,t,r,n,a)=>{const o=wt(e,r);return pt(o).collectEvaluatedProperties(e,t,r,n,a)},collectEvaluatedItems:(e,t,r,n,a)=>{const o=wt(e,r);return pt(o).collectEvaluatedItems(e,t,r,n,a)}};var Et={compile:e=>et.value(e),interpret:()=>!0};var St={compile:async(e,t)=>{const r=et.uri(e);if(!(r in t)){t[r]=!1;const n=et.value(e);if(!["object","boolean"].includes(typeof n))throw Error(`No schema found at '${et.uri(e)}'`);t[r]=[`${e.schemaVersion}#validate`,et.uri(e),"boolean"==typeof n?n:await ae.pipeline([et.entries,ae.map((([t,r])=>[`${e.schemaVersion}#${t}`,r])),ae.filter((([t])=>Ot.hasKeyword(t)&&t!==`${e.schemaVersion}#validate`)),ae.map((async([r,n])=>{const a=await Ot.getKeyword(r).compile(n,t,e);return[r,et.uri(n),a]})),ae.all],e)]}return r},interpret:(e,t,r,n)=>{const[a,o,i]=r[e];s.publishSync("result.start");const u="boolean"==typeof i?i:i.every((([e,a,o])=>{s.publishSync("result.start");const i=Ot.getKeyword(e).interpret(o,t,r,n);return s.publishSync("result",{keyword:e,absoluteKeywordLocation:a,instanceLocation:Q.uri(t),valid:i,ast:o}),s.publishSync("result.end"),i}));return s.publishSync("result",{keyword:a,absoluteKeywordLocation:o,instanceLocation:Q.uri(t),valid:u,ast:e}),s.publishSync("result.end"),u},collectEvaluatedProperties:(e,t,r,n,a=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter((([e])=>!a||!e.endsWith("#unevaluatedProperties"))).reduce(((e,[a,,o])=>{const i=e&&Ot.getKeyword(a).collectEvaluatedProperties(o,t,r,n);return!1!==i&&[...e,...i]}),[])},collectEvaluatedItems:(e,t,r,n,a=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&new Set:o.filter((([e])=>!a||!e.endsWith("#unevaluatedItems"))).reduce(((e,[a,,o])=>{const i=!1!==e&&Ot.getKeyword(a).collectEvaluatedItems(o,t,r,n);return!1!==i&&new Set([...e,...i])}),new Set)}},It={metaData:Et,validate:St},jt={Core:Ot,Schema:et,Instance:Q,Reference:R,Keywords:It,InvalidSchemaError:rt},Pt=jt.Core,At=jt.Schema,Tt=jt.Instance,Rt=jt.Reference,$t=jt.Keywords,Vt=jt.InvalidSchemaError;return e.Core=Pt,e.Instance=Tt,e.InvalidSchemaError=Vt,e.Keywords=$t,e.Reference=Rt,e.Schema=At,e.default=jt,Object.defineProperty(e,"__esModule",{value:!0}),e}({},url); | ||
//# sourceMappingURL=json-schema-core-iife.min.js.map |
@@ -1,2 +0,2 @@ | ||
System.register("JSC",[],(function(e){"use strict";return{execute:function(){var t=function(e,t){return function r(){null==t&&(t=e.length);var n=[].slice.call(arguments);return n.length>=t?e.apply(this,n):function(){return r.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:{};var n,o=(function(e,t){var n,o;n="object"==typeof window&&window||r,o={},n.PubSub=o,function(e){var t={},r=-1,n="*";function o(e){var t;for(t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function a(e){return function(){throw e}}function i(e,t,r){try{e(t,r)}catch(e){setTimeout(a(e),0)}}function s(e,t,r){e(t,r)}function c(e,r,n,o){var a,c=t[r],l=o?s:i;if(Object.prototype.hasOwnProperty.call(t,r))for(a in c)Object.prototype.hasOwnProperty.call(c,a)&&l(c[a],e,n)}function l(e,t,r){return function(){var o=String(e),a=o.lastIndexOf(".");for(c(e,e,t,r);-1!==a;)a=(o=o.substr(0,a)).lastIndexOf("."),c(e,o,t,r);c(e,n,t,r)}}function u(e){var r=String(e);return Boolean(Object.prototype.hasOwnProperty.call(t,r)&&o(t[r]))}function f(e){for(var t=String(e),r=u(t)||u(n),o=t.lastIndexOf(".");!r&&-1!==o;)o=(t=t.substr(0,o)).lastIndexOf("."),r=u(t);return r}function p(e,t,r,n){var o=l(e="symbol"==typeof e?e.toString():e,t,n);return!!f(e)&&(!0===r?o():setTimeout(o,0),!0)}e.publish=function(t,r){return p(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return p(t,r,!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(t,e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeAll=function(t){return e.subscribe(n,t)},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n,o=0;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)){for(n in t[r])o++;break}return o},e.getSubscriptions=function(e){var r,n=[];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,a,i=function(e){var r;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e))return!0;return!1},s="string"==typeof r&&(Object.prototype.hasOwnProperty.call(t,r)||i(r)),c=!s&&"string"==typeof r,l="function"==typeof r,u=!1;if(!s){for(n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(o=t[n],c&&o[r]){delete o[r],u=r;break}if(l)for(a in o)Object.prototype.hasOwnProperty.call(o,a)&&o[a]===r&&(delete o[a],u=!0)}return u}e.clearSubscriptions(r)}}(o),void 0!==e&&e.exports&&(t=e.exports=o),t.PubSub=o,e.exports=t=o}(n={exports:{}},n.exports),n.exports);o.PubSub;var a=function(e,t){if(e=e.trim(),(t=t.trim()).startsWith("about:"))return t;const r=function(e){const t={host:"",path:"",query:"",protocol:""};let r=e,n=e.indexOf("//");t.protocol=r.substring(0,n),n+=2;const o=e.indexOf("/",n),a=e.indexOf("?"),i=e.indexOf("#");-1!==i&&(r=r.substring(0,i));if(-1!==a){const e=r.substring(a);t.query=e,r=r.substring(0,a)}if(-1!==o){const e=r.substring(0,o);t.host=e,r=r.substring(o),t.path=r}else t.host=r;return t}(e),n=function(e){const t={href:e,hash:"",query:"",netPath:!1,absolutePath:!1,relativePath:!1};if(c.test(e))return t.netPath=!0,t;"/"===e[0]?t.absolutePath=!0:""!==e&&(t.relativePath=!0);let r=e;const n=e.indexOf("?"),o=e.indexOf("#");if(-1!==o){const e=r.substring(o);t.hash=e,r=r.substring(0,o)}if(-1!==n){const e=r.substring(n);t.query=e,r=r.substring(0,n)}return t.path=r,t}(t);if(!r.protocol&&!n.netPath)throw new Error("Error, protocol is not specified");if(n.netPath)return n.href.startsWith("//")&&(n.href=r.protocol+n.href),function(e){const t=e.indexOf("//")+2,r=!e.includes("/",t),n=!e.includes("?",t),o=!e.includes("#",t);return r&&n&&o}(n.href)?i(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+s(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let a,i=r.path,c=r.host;return 0===e.length?a=i:(i=i.substring(0,i.lastIndexOf("/")),a=s(i+"/"+e)),c+=""!==a||t||o?a+t+o:"/",c}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:i(e)}};function i(e){return e+("/"===e[e.length-1]?"":"/")}function s(e){let t=e.split("/");""===t[0]&&(t=t.slice(1));let r=[];return t.forEach(((e,n)=>{"."!==e&&(".."===e?r.pop():""===e&&n!==t.length-1||r.push(e))})),"/"+r.join("/")}const c=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");const l={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},u=e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),o=e.slice(r+1);return[decodeURI(n),decodeURI(o)]},f=e=>{const t=RegExp(/^(.+):\/\//).exec(e);return t?t[1]:""};var p={jsonTypeOf:(e,t)=>l[t](e),splitUrl:u,safeResolveUrl:(e,t)=>{const r=a(e,t),n=u(e)[0];if(n&&"file"===f(r)&&"file"!==f(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r}};const d=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(w)},h=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:h(e,E(t,o,n),r,m(o,n))}}if(Array.isArray(t)){const n=[...t];return n[O(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:E(t,e[0],n)},y=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||j(t)){const o=e.shift();y(e,E(t,o,n),r,m(o,n))}else{t[O(t,e[0])]=r}},v=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=E(t,n,r);return{...t,[n]:v(e,o,m(n,r))}}if(Array.isArray(t))return t.filter(((t,r)=>r!=e[0]));if("object"==typeof t&&null!==t){const{[e[0]]:r,...n}=t;return n}return E(t,e[0],r)}},b=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=E(t,n,r);b(e,o,m(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:E(t,e[0],r)},m=t(((e,t)=>t+"/"+g(e))),g=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),w=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),O=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,E=(e,t,r="")=>{if(void 0===e)throw TypeError(`Value at '${r}' is undefined and does not have property '${t}'`);if(null===e)throw TypeError(`Value at '${r}' is null and does not have property '${t}'`);if(j(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[O(e,t)]},j=e=>null===e||"object"!=typeof e;var $={nil:"",append:m,get:(e,t)=>{const r=d(e),n=e=>r.reduce((([e,t],r)=>[E(e,r,t),m(r,t)]),[e,""])[0];return void 0===t?n:n(t)},set:(e,r,n)=>{const o=d(e),a=t(((e,t)=>h(o,e,t,"")));return void 0===r?a:a(r,n)},assign:(e,r,n)=>{const o=d(e),a=t(((e,t)=>y(o,e,t,"")));return void 0===r?a:a(r,n)},unset:(e,t)=>{const r=d(e),n=e=>v(r,e,"");return void 0===t?n:n(t)},remove:(e,t)=>{const r=d(e),n=e=>b(r,e,"");return void 0===t?n:n(t)}};$.nil,$.append,$.get,$.set,$.assign,$.unset,$.remove;const S=Symbol("$__value"),x=Symbol("$__href");var A={cons:(e,t)=>Object.freeze({[x]:e,[S]:t}),isReference:e=>e&&void 0!==e[x],href:e=>e[x],value:e=>e[S]};const{jsonTypeOf:P}=p,I=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),T=e=>A.isReference(e.value)?A.value(e.value):e.value,k=t(((e,t)=>P(T(e),t))),V=(e,t)=>Object.freeze({...t,pointer:$.append(e,t.pointer),value:T(t)[e]}),R=t(((e,t)=>T(t).map(((r,n,o,a)=>e(V(n,t),n,o,a))))),C=t(((e,t)=>T(t).map(((e,r,n,o)=>V(r,t))).filter(((t,r,n,o)=>e(t,r,n,o))))),U=t(((e,t,r)=>T(r).reduce(((t,n,o)=>e(t,V(o,r),o)),t))),z=t(((e,t)=>T(t).every(((r,n,o,a)=>e(V(n,t),n,o,a))))),K=t(((e,t)=>T(t).some(((r,n,o,a)=>e(V(n,t),n,o,a)))));var L={nil:I,cons:(e,t="")=>Object.freeze({...I,id:t,instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:T,has:(e,t)=>e in T(t),typeOf:k,step:V,entries:e=>Object.keys(T(e)).map((t=>[t,V(t,e)])),keys:e=>Object.keys(T(e)),map:R,filter:C,reduce:U,every:z,some:K,length:e=>T(e).length},q=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,_=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,D=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,N=/\\([\u000b\u0020-\u00ff])/g,B=/([\\"])/g,F=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function Z(e){var t=String(e);if(D.test(t))return t;if(t.length>0&&!_.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(B,"\\$1")+'"'}function J(e){this.parameters=Object.create(null),this.type=e}var W={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!F.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,a=Object.keys(t).sort(),i=0;i<a.length;i++){if(o=a[i],!D.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+Z(t[o])}return n},parse:function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;"function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.substr(0,r).trim():t.trim();if(!F.test(n))throw new TypeError("invalid media type");var o=new J(n.toLowerCase());if(-1!==r){var a,i,s;for(q.lastIndex=r;i=q.exec(t);){if(i.index!==r)throw new TypeError("invalid parameter format");r+=i[0].length,a=i[1].toLowerCase(),'"'===(s=i[2])[0]&&(s=s.substr(1,s.length-2).replace(N,"$1")),o.parameters[a]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},M=async e=>Object.entries(await e),G=t((async(e,t)=>(await t).map(e))),H=t((async(e,t,r)=>(await r).reduce((async(t,r)=>e(await t,r)),t))),Q=t((async(e,t,r={})=>H((async(t,r)=>await e(r)?t.concat([r]):t),[],t,r))),X=t((async(e,t)=>{const r=await G(e,t);return(await Promise.all(r)).some((e=>e))})),Y=t((async(e,t)=>{const r=await G(e,t);return(await Promise.all(r)).every((e=>e))})),ee=t(((e,t)=>e.reduce((async(e,t)=>t(await e)),t))),te={entries:M,map:G,filter:Q,reduce:H,some:X,every:Y,pipeline:ee,all:e=>Promise.all(e),allValues:e=>ee([M,H((async(e,[t,r])=>(e[t]=await r,e)),{})],e)};te.entries,te.map,te.filter,te.reduce,te.some,te.every,te.pipeline,te.all,te.allValues;var re=fetch;const{jsonTypeOf:ne,splitUrl:oe,safeResolveUrl:ae}=p,ie={},se={},ce=(e,t)=>{const r=e in se?se[e]:e;if(r in ie)return ie[r][t]},le={},ue={},fe=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=oe(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=ce(n,"baseToken"),a=ce(n,"anchorToken"),i=oe(t)[0];if(!i&&!oe(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const s=ae(i,e[o]||""),[c,l]=oe(s);delete e[o],l&&o===a&&(e[a]=a!==o?encodeURI(l):`#${encodeURI(l)}`),i&&(ue[i]=c);const u={},f=ce(n,"recursiveAnchorToken");let p;!0===e[f]&&(u[""]=`${c}#`,e[a]="",delete e[f]);const d=ce(n,"vocabularyToken");ne(e[d],"object")?(se[c]=n,p=e[d],delete e[d]):(se[c]=n,p={[n]:!0});const h={"":""};return le[c]={id:c,schemaVersion:n,schema:pe(e,c,n,$.nil,h,u),anchors:h,dynamicAnchors:u,vocabulary:p,validated:!1},c},pe=(e,t,r,n,o,a)=>{if(ne(e,"object")){const i="string"==typeof e.$schema?oe(e.$schema)[0]:r,s=ce(i,"embeddedToken"),c=ce(i,"anchorToken");if("string"==typeof e[s]&&(s!==c||"#"!==e[s][0])){const n=ae(t,e[s]);return e[s]=n,fe(e,n,r),A.cons(e[s],e)}const l=ce(r,"anchorToken"),u=ce(r,"dynamicAnchorToken");"string"==typeof e[u]&&(a[e[u]]=`${t}#${encodeURI(n)}`,o[e[u]]=n,delete e[u]);const f=ce(r,"embeddedToken");if("string"==typeof e[l]){const t=l!==f?e[l]:e[l].slice(1);o[t]=n,delete e[l]}const p=ce(r,"jrefToken");if("string"==typeof e[p])return A.cons(e[p],e);for(const i in e)e[i]=pe(e[i],t,r,$.append(i,n),o,a);return e}return Array.isArray(e)?e.map(((e,i)=>pe(e,t,r,$.append(i,n),o,a))):e},de=e=>le[ue[e]]||le[e],he=Object.freeze({id:"",schemaVersion:void 0,vocabulary:{},pointer:$.nil,schema:void 0,value:void 0,anchors:{},dynamicAnchors:{},validated:!0}),ye=async(e,t=he)=>{const r=ae(me(t),e),[n,o]=oe(r);if(!(e=>e in le||e in ue)(n)){const e=await re(n,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error(`Failed to retrieve schema with id: ${n}`);if(e.headers.has("content-type")){const t=W.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${n} is not a schema. Found a document with media type: ${t}`)}fe(await e.json(),n)}const a=de(n),i="/"!==o[0]?be(a,o):o,s=Object.freeze({...a,pointer:i,value:$.get(i,a.schema)});return ve(s)},ve=e=>A.isReference(e.value)?ye(A.href(e.value),e):e,be=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},me=e=>`${e.id}#${encodeURI(e.pointer)}`,ge=e=>A.isReference(e.value)?A.value(e.value):e.value,we=(e,t)=>{const r=de(t.id),n=Object.freeze({...t,pointer:$.append(e,t.pointer),value:ge(t)[e],validated:r.validated});return ve(n)},Oe=t(((e,t)=>te.pipeline([ge,te.map((async(r,n)=>e(await we(n,t),n))),te.all],t)));var Ee={setConfig:(e,t,r)=>{ie[e]||(ie[e]={}),ie[e][t]=r},getConfig:ce,add:fe,get:ye,markValidated:e=>{le[e].validated=!0},uri:me,value:ge,getAnchorPointer:be,typeOf:(e,t)=>ne(ge(e),t),has:(e,t)=>e in ge(t),step:we,keys:e=>Object.keys(ge(e)),entries:e=>te.pipeline([ge,Object.keys,te.map((async t=>[t,await we(t,e)])),te.all],e),map:Oe,length:e=>ge(e).length};Ee.setConfig,Ee.getConfig,Ee.add,Ee.get,Ee.markValidated,Ee.uri,Ee.value,Ee.getAnchorPointer,Ee.typeOf,Ee.has,Ee.step,Ee.keys,Ee.entries,Ee.map,Ee.length;class je extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var $e=je;const{splitUrl:Se}=p,xe="FLAG",Ae="BASIC",Pe="DETAILED",Ie="VERBOSE";let Te=Pe,ke=!0;const Ve=async e=>{const t={metaData:{}};return{ast:t,schemaUri:await _e(e,t)}},Re=t((({ast:e,schemaUri:t},r,n=xe)=>{if(![xe,Ae,Pe,Ie].includes(n))throw Error(`The '${n}' error format is not supported`);const a=[],i=o.subscribe("result",Ce(n,a));return Ne(t,r,e,{}),o.unsubscribe(i),a[0]})),Ce=(e,t)=>{const r=[];return(n,o)=>{if("result"===n){const{keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:a}=o,i={keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:a,errors:[]};r.push(i)}else if("result.start"===n)r.push(n);else if("result.end"===n){const n=r.pop();for(;"result.start"!==r[r.length-1];){const t=r.pop(),o=[t];e===Ae&&(o.push(...t.errors),delete t.errors),(e===Ie||e!==xe&&!t.valid)&&n.errors.unshift(...o)}r[r.length-1]=n,t[0]=n}}},Ue={},ze=e=>Ue[e],Ke=e=>e in Ue,Le={},qe={},_e=async(e,t)=>{if(e=await De(e),!Ke(`${e.schemaVersion}#validate`)){const t=await Ee.get(e.schemaVersion);(Ee.getConfig(t.id,"mandatoryVocabularies")||[]).forEach((e=>{if(!t.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)})),Object.entries(t.vocabulary).forEach((([e,r])=>{if(e in Le)Object.entries(Le[e]).forEach((([e,r])=>{((e,t)=>{Ue[e]={collectEvaluatedItems:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&new Set,collectEvaluatedProperties:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&[],...t}})(`${t.id}#${e}`,r)}));else if(r)throw Error(`Missing required vocabulary: ${e}`)}))}if(ke&&!e.validated){if(Ee.markValidated(e.id),!(e.schemaVersion in qe)){const t=await Ee.get(e.schemaVersion),r=await Ve(t);qe[t.id]=Re(r)}const t=L.cons(e.schema,e.id),r=qe[e.schemaVersion](t,Te);if(!r.valid)throw new $e(r)}return e.id in t.metaData||(t.metaData[e.id]={id:e.id,dynamicAnchors:e.dynamicAnchors,anchors:e.anchors}),ze(`${e.schemaVersion}#validate`).compile(e,t)},De=async e=>Ee.typeOf(e,"string")?De(await Ee.get(Ee.value(e),e)):e,Ne=(e,t,r,n)=>{const o=Be(e,r),a=Se(e)[0];return ze(o).interpret(e,t,r,{...r.metaData[a].dynamicAnchors,...n})},Be=(e,t)=>{if(!(e in t))throw Error(`No schema found at ${e}`);return t[e][0]};var Fe={validate:async(e,t,r)=>{const n=await Ve(e),o=(e,t)=>Re(n,L.cons(e),t);return void 0===t?o:o(t,r)},compile:Ve,interpret:Re,setMetaOutputFormat:e=>{Te=e},setShouldMetaValidate:e=>{ke=e},FLAG:xe,BASIC:Ae,DETAILED:Pe,VERBOSE:Ie,add:(e,t="",r="")=>{const n=Ee.add(e,t,r);delete qe[n]},getKeyword:ze,hasKeyword:Ke,defineVocabulary:(e,t)=>{Le[e]=t},compileSchema:_e,interpretSchema:Ne,collectEvaluatedProperties:(e,t,r,n,o)=>{const a=Be(e,r);return ze(a).collectEvaluatedProperties(e,t,r,n,o)},collectEvaluatedItems:(e,t,r,n,o)=>{const a=Be(e,r);return ze(a).collectEvaluatedItems(e,t,r,n,o)}};var Ze={compile:e=>Ee.value(e),interpret:()=>!0};var Je={compile:async(e,t)=>{const r=Ee.uri(e);if(!(r in t)){t[r]=!1;const n=Ee.value(e);if(!["object","boolean"].includes(typeof n))throw Error(`No schema found at '${Ee.uri(e)}'`);t[r]=[`${e.schemaVersion}#validate`,Ee.uri(e),"boolean"==typeof n?n:await te.pipeline([Ee.entries,te.map((([t,r])=>[`${e.schemaVersion}#${t}`,r])),te.filter((([t])=>Fe.hasKeyword(t)&&t!==`${e.schemaVersion}#validate`)),te.map((async([r,n])=>{const o=await Fe.getKeyword(r).compile(n,t,e);return[r,Ee.uri(n),o]})),te.all],e)]}return r},interpret:(e,t,r,n)=>{const[a,i,s]=r[e];o.publishSync("result.start");const c="boolean"==typeof s?s:s.every((([e,a,i])=>{o.publishSync("result.start");const s=Fe.getKeyword(e).interpret(i,t,r,n);return o.publishSync("result",{keyword:e,absoluteKeywordLocation:a,instanceLocation:L.uri(t),valid:s,ast:i}),o.publishSync("result.end"),s}));return o.publishSync("result",{keyword:a,absoluteKeywordLocation:i,instanceLocation:L.uri(t),valid:c,ast:e}),o.publishSync("result.end"),c},collectEvaluatedProperties:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&[]:a.filter((([e])=>!o||!e.endsWith("#unevaluatedProperties"))).reduce(((e,[o,,a])=>{const i=e&&Fe.getKeyword(o).collectEvaluatedProperties(a,t,r,n);return!1!==i&&[...e,...i]}),[])},collectEvaluatedItems:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&new Set:a.filter((([e])=>!o||!e.endsWith("#unevaluatedItems"))).reduce(((e,[o,,a])=>{const i=!1!==e&&Fe.getKeyword(o).collectEvaluatedItems(a,t,r,n);return!1!==i&&new Set([...e,...i])}),new Set)}},We={metaData:Ze,validate:Je},Me=e("default",{Core:Fe,Schema:Ee,Instance:L,Reference:A,Keywords:We,InvalidSchemaError:$e});e("Core",Me.Core),e("Schema",Me.Schema),e("Instance",Me.Instance),e("Reference",Me.Reference),e("Keywords",Me.Keywords),e("InvalidSchemaError",Me.InvalidSchemaError)}}})); | ||
System.register("JSC",["url"],(function(e){"use strict";var t;return{setters:[function(e){t=e.default}],execute:function(){var r=function(e,t){return function r(){null==t&&(t=e.length);var n=[].slice.call(arguments);return n.length>=t?e.apply(this,n):function(){return r.apply(this,n.concat([].slice.call(arguments)))}}};var n="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var a,o=(function(e,t){var r,a;r="object"==typeof window&&window||n,a={},r.PubSub=a,function(e){var t={},r=-1,n="*";function a(e){var t;for(t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function o(e){return function(){throw e}}function i(e,t,r){try{e(t,r)}catch(e){setTimeout(o(e),0)}}function s(e,t,r){e(t,r)}function u(e,r,n,a){var o,u=t[r],l=a?s:i;if(Object.prototype.hasOwnProperty.call(t,r))for(o in u)Object.prototype.hasOwnProperty.call(u,o)&&l(u[o],e,n)}function l(e,t,r){return function(){var a=String(e),o=a.lastIndexOf(".");for(u(e,e,t,r);-1!==o;)o=(a=a.substr(0,o)).lastIndexOf("."),u(e,a,t,r);u(e,n,t,r)}}function c(e){var r=String(e);return Boolean(Object.prototype.hasOwnProperty.call(t,r)&&a(t[r]))}function f(e){for(var t=String(e),r=c(t)||c(n),a=t.lastIndexOf(".");!r&&-1!==a;)a=(t=t.substr(0,a)).lastIndexOf("."),r=c(t);return r}function h(e,t,r,n){var a=l(e="symbol"==typeof e?e.toString():e,t,n);return!!f(e)&&(!0===r?a():setTimeout(a,0),!0)}e.publish=function(t,r){return h(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return h(t,r,!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(t,e)||(t[e]={});var a="uid_"+String(++r);return t[e][a]=n,a},e.subscribeAll=function(t){return e.subscribe(n,t)},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n,a=0;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)){for(n in t[r])a++;break}return a},e.getSubscriptions=function(e){var r,n=[];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,a,o,i=function(e){var r;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e))return!0;return!1},s="string"==typeof r&&(Object.prototype.hasOwnProperty.call(t,r)||i(r)),u=!s&&"string"==typeof r,l="function"==typeof r,c=!1;if(!s){for(n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(a=t[n],u&&a[r]){delete a[r],c=r;break}if(l)for(o in a)Object.prototype.hasOwnProperty.call(a,o)&&a[o]===r&&(delete a[o],c=!0)}return c}e.clearSubscriptions(r)}}(a),void 0!==e&&e.exports&&(t=e.exports=a),t.PubSub=a,e.exports=t=a}(a={exports:{}},a.exports),a.exports);o.PubSub;var i=function(e,t){if(e=e.trim(),(t=t.trim()).startsWith("about:"))return t;const r=function(e){const t={host:"",path:"",query:"",protocol:""};let r=e,n=e.indexOf("//");t.protocol=r.substring(0,n),n+=2;const a=e.indexOf("/",n),o=e.indexOf("?"),i=e.indexOf("#");-1!==i&&(r=r.substring(0,i));if(-1!==o){const e=r.substring(o);t.query=e,r=r.substring(0,o)}if(-1!==a){const e=r.substring(0,a);t.host=e,r=r.substring(a),t.path=r}else t.host=r;return t}(e),n=function(e){const t={href:e,hash:"",query:"",netPath:!1,absolutePath:!1,relativePath:!1};if(l.test(e))return t.netPath=!0,t;"/"===e[0]?t.absolutePath=!0:""!==e&&(t.relativePath=!0);let r=e;const n=e.indexOf("?"),a=e.indexOf("#");if(-1!==a){const e=r.substring(a);t.hash=e,r=r.substring(0,a)}if(-1!==n){const e=r.substring(n);t.query=e,r=r.substring(0,n)}return t.path=r,t}(t);if(!r.protocol&&!n.netPath)throw new Error("Error, protocol is not specified");if(n.netPath)return function(e){return e.startsWith("//")}(n.href)&&(n.href=r.protocol+n.href),function(e){const t=e.indexOf("//")+2,r=!e.includes("/",t),n=!e.includes("?",t),a=!e.includes("#",t);return r&&n&&a}(n.href)?s(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:a}=n;return r.host+u(e)+t+a}if(n.relativePath){const{path:e,query:t,hash:a}=n;let o,i=r.path,s=r.host;return 0===e.length?o=i:(i=i.substring(0,i.lastIndexOf("/")),o=u(i+"/"+e)),s+=""!==o||t||a?o+t+a:"/",s}{const{host:e,path:t,query:a}=r;return t||a?e+t+a+n.hash:s(e)}};function s(e){return e+("/"===e[e.length-1]?"":"/")}function u(e){let t=e.split("/");""===t[0]&&(t=t.slice(1));let r=[];return t.forEach(((e,n)=>{"."!==e&&(".."===e?r.pop():""===e&&n!==t.length-1||r.push(e))})),"/"+r.join("/")}const l=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");const c={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},f=e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),a=e.slice(r+1);return[decodeURI(n),decodeURI(a)]},h=e=>{const t=RegExp(/^(.+):\/\//).exec(e);return t?t[1]:""};var m={jsonTypeOf:(e,t)=>c[t](e),splitUrl:f,safeResolveUrl:(e,t)=>{const r=i(e,t),n=f(e)[0];if(n&&"file"===h(r)&&"file"!==h(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r}};const p=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(w)},d=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const a=e.shift();return{...t,[a]:d(e,E(t,a,n),r,g(a,n))}}if(Array.isArray(t)){const n=[...t];return n[O(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:E(t,e[0],n)},y=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||S(t)){const a=e.shift();y(e,E(t,a,n),r,g(a,n))}else{t[O(t,e[0])]=r}},v=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),a=E(t,n,r);return{...t,[n]:v(e,a,g(n,r))}}if(Array.isArray(t))return t.filter(((t,r)=>r!=e[0]));if("object"==typeof t&&null!==t){const{[e[0]]:r,...n}=t;return n}return E(t,e[0],r)}},b=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),a=E(t,n,r);b(e,a,g(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:E(t,e[0],r)},g=r(((e,t)=>t+"/"+x(e))),x=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),w=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),O=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,E=(e,t,r="")=>{if(void 0===e)throw TypeError(`Value at '${r}' is undefined and does not have property '${t}'`);if(null===e)throw TypeError(`Value at '${r}' is null and does not have property '${t}'`);if(S(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[O(e,t)]},S=e=>null===e||"object"!=typeof e;var I={nil:"",append:g,get:(e,t)=>{const r=p(e),n=e=>r.reduce((([e,t],r)=>[E(e,r,t),g(r,t)]),[e,""])[0];return void 0===t?n:n(t)},set:(e,t,n)=>{const a=p(e),o=r(((e,t)=>d(a,e,t,"")));return void 0===t?o:o(t,n)},assign:(e,t,n)=>{const a=p(e),o=r(((e,t)=>y(a,e,t,"")));return void 0===t?o:o(t,n)},unset:(e,t)=>{const r=p(e),n=e=>v(r,e,"");return void 0===t?n:n(t)},remove:(e,t)=>{const r=p(e),n=e=>b(r,e,"");return void 0===t?n:n(t)}};I.nil,I.append,I.get,I.set,I.assign,I.unset,I.remove;const j=Symbol("$__value"),P=Symbol("$__href");var A={cons:(e,t)=>Object.freeze({[P]:e,[j]:t}),isReference:e=>e&&void 0!==e[P],href:e=>e[P],value:e=>e[j]};const{jsonTypeOf:T}=m,R=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),$=e=>A.isReference(e.value)?A.value(e.value):e.value,V=r(((e,t)=>T($(e),t))),k=(e,t)=>Object.freeze({...t,pointer:I.append(e,t.pointer),value:$(t)[e]}),L=r(((e,t)=>$(t).map(((r,n,a,o)=>e(k(n,t),n,a,o))))),H=r(((e,t)=>$(t).map(((e,r,n,a)=>k(r,t))).filter(((t,r,n,a)=>e(t,r,n,a))))),U=r(((e,t,r)=>$(r).reduce(((t,n,a)=>e(t,k(a,r),a)),t))),q=r(((e,t)=>$(t).every(((r,n,a,o)=>e(k(n,t),n,a,o))))),D=r(((e,t)=>$(t).some(((r,n,a,o)=>e(k(n,t),n,a,o)))));var _={nil:R,cons:(e,t="")=>Object.freeze({...R,id:t,instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:$,has:(e,t)=>e in $(t),typeOf:V,step:k,entries:e=>Object.keys($(e)).map((t=>[t,k(t,e)])),keys:e=>Object.keys($(e)),map:L,filter:H,reduce:U,every:q,some:D,length:e=>$(e).length},C=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,Q=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,z=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,B=/\\([\u000b\u0020-\u00ff])/g,K=/([\\"])/g,N=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function J(e){var t=String(e);if(z.test(t))return t;if(t.length>0&&!Q.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(K,"\\$1")+'"'}function M(e){this.parameters=Object.create(null),this.type=e}var F={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!N.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var a,o=Object.keys(t).sort(),i=0;i<o.length;i++){if(a=o[i],!z.test(a))throw new TypeError("invalid parameter name");n+="; "+a+"="+J(t[a])}return n},parse:function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;"function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.substr(0,r).trim():t.trim();if(!N.test(n))throw new TypeError("invalid media type");var a=new M(n.toLowerCase());if(-1!==r){var o,i,s;for(C.lastIndex=r;i=C.exec(t);){if(i.index!==r)throw new TypeError("invalid parameter format");r+=i[0].length,o=i[1].toLowerCase(),'"'===(s=i[2])[0]&&(s=s.substr(1,s.length-2).replace(B,"$1")),a.parameters[o]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return a}},W=async e=>Object.entries(await e),Z=r((async(e,t)=>(await t).map(e))),G=r((async(e,t,r)=>(await r).reduce((async(t,r)=>e(await t,r)),t))),X=r((async(e,t,r={})=>G((async(t,r)=>await e(r)?t.concat([r]):t),[],t,r))),Y=r((async(e,t)=>{const r=await Z(e,t);return(await Promise.all(r)).some((e=>e))})),ee=r((async(e,t)=>{const r=await Z(e,t);return(await Promise.all(r)).every((e=>e))})),te=r(((e,t)=>e.reduce((async(e,t)=>t(await e)),t))),re={entries:W,map:Z,filter:X,reduce:G,some:Y,every:ee,pipeline:te,all:e=>Promise.all(e),allValues:e=>te([W,G((async(e,[t,r])=>(e[t]=await r,e)),{})],e)};re.entries,re.map,re.filter,re.reduce,re.some,re.every,re.pipeline,re.all,re.allValues;var ne={ABSOLUTE:"absolute",PATH_RELATIVE:"pathRelative",ROOT_RELATIVE:"rootRelative",SHORTEST:"shortest"};function ae(e,t){var r=t.removeEmptyQueries&&e.extra.relation.minimumPort;return e.query.string[r?"stripped":"full"]}function oe(e,t){return!e.extra.relation.minimumQuery||t.output===ne.ABSOLUTE||t.output===ne.ROOT_RELATIVE}function ie(e,t){var r=t.removeDirectoryIndexes&&e.extra.resourceIsIndex,n=e.extra.relation.minimumResource&&t.output!==ne.ABSOLUTE&&t.output!==ne.ROOT_RELATIVE;return!!e.resource&&!n&&!r}var se=function(e,t){var r="";return r+=function(e,t){var r="";return(e.extra.relation.maximumHost||t.output===ne.ABSOLUTE)&&(e.extra.relation.minimumScheme&&t.schemeRelative&&t.output!==ne.ABSOLUTE?r+="//":r+=e.scheme+"://"),r}(e,t),r+=function(e,t){return!e.auth||t.removeAuth||!e.extra.relation.maximumHost&&t.output!==ne.ABSOLUTE?"":e.auth+"@"}(e,t),r+=function(e,t){return e.host.full&&(e.extra.relation.maximumAuth||t.output===ne.ABSOLUTE)?e.host.full:""}(e,t),r+=function(e,t){return e.port&&!e.extra.portIsDefault&&e.extra.relation.maximumHost?":"+e.port:""}(e),r+=function(e,t){var r="",n=e.path.absolute.string,a=e.path.relative.string,o=ie(e,t);if(e.extra.relation.maximumHost||t.output===ne.ABSOLUTE||t.output===ne.ROOT_RELATIVE)r=n;else if(a.length<=n.length&&t.output===ne.SHORTEST||t.output===ne.PATH_RELATIVE){if(""===(r=a)){var i=oe(e,t)&&!!ae(e,t);e.extra.relation.maximumPath&&!o?r="./":!e.extra.relation.overridesQuery||o||i||(r="./")}}else r=n;return"/"!==r||o||!t.removeRootTrailingSlash||e.extra.relation.minimumPort&&t.output!==ne.ABSOLUTE||(r=""),r}(e,t),r+=function(e,t){return ie(e,t)?e.resource:""}(e,t),r+=function(e,t){return oe(e,t)?ae(e,t):""}(e,t),r+=function(e,t){return e.hash?e.hash:""}(e)};var ue={clone:function e(t){if(t instanceof Object){var r=t instanceof Array?[]:{};for(var n in t)t.hasOwnProperty(n)&&(r[n]=e(t[n]));return r}return t},isPlainObject:function(e){return!!e&&"object"==typeof e&&e.constructor===Object},shallowMerge:function(e,t){if(e instanceof Object&&t instanceof Object)for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e}};function le(e,t){return t instanceof Object&&e instanceof Object?t instanceof Array&&e instanceof Array?t.concat(e):ue.shallowMerge(e,t):e}var ce=function(e,t){if(ue.isPlainObject(e)){var r={};for(var n in t)t.hasOwnProperty(n)&&(void 0!==e[n]?r[n]=le(e[n],t[n]):r[n]=t[n]);return r}return t};var fe=function(e){var t=!(e.scheme||e.auth||e.host.full||e.port),r=t&&!e.path.absolute.string,n=r&&!e.resource,a=n&&!e.query.string.full.length,o=a&&!e.hash;e.extra.hrefInfo.minimumPathOnly=t,e.extra.hrefInfo.minimumResourceOnly=r,e.extra.hrefInfo.minimumQueryOnly=n,e.extra.hrefInfo.minimumHashOnly=a,e.extra.hrefInfo.empty=o};var he=function(e,t){if(t.ignore_www){var r=e.host.full;if(r){var n=r;0===r.indexOf("www.")&&(n=r.substr(4)),e.host.stripped=n}}};function me(e){if("/"!==e){var t=[];return e.split("/").forEach((function(e){""!==e&&t.push(e)})),t}return[]}var pe=function(e,t){var r=e.path.absolute.string;if(r){var n=r.lastIndexOf("/");if(n>-1){if(++n<r.length){var a=r.substr(n);"."!==a&&".."!==a?(e.resource=a,r=r.substr(0,n)):r+="/"}e.path.absolute.string=r,e.path.absolute.array=me(r)}else"."===r||".."===r?(r+="/",e.path.absolute.string=r,e.path.absolute.array=me(r)):(e.resource=r,e.path.absolute.string=null);e.extra.resourceIsIndex=function(e,t){var r=!1;return t.directoryIndexes.every((function(t){return t!==e||(r=!0,!1)})),r}(e.resource,t)}};var de=function(e,t){var r=-1;for(var n in t.defaultPorts)if(n===e.scheme&&t.defaultPorts.hasOwnProperty(n)){r=t.defaultPorts[n];break}r>-1&&(r=r.toString(),null===e.port&&(e.port=r),e.extra.portIsDefault=e.port===r)},ye=Object.prototype.hasOwnProperty;function ve(e,t){var r=0,n="";for(var a in e)if(""!==a&&!0===ye.call(e,a)){var o=e[a];""===o&&t||(n+=1==++r?"?":"&",a=encodeURIComponent(a),n+=""!==o?a+"="+encodeURIComponent(o).replace(/%20/g,"+"):a)}return n}var be=function(e,t){e.query.string.full=ve(e.query.object,!1),t.removeEmptyQueries&&(e.query.string.stripped=ve(e.query.object,!0))},ge=t.parse;var xe=function(e,t){return function(e,t){var r=!0;return t.rejectedSchemes.every((function(t){return r=!(0===e.indexOf(t+":"))})),r}(e,t)?(r=ge(e,!0,t.slashesDenoteHost),(n=r.protocol)&&n.indexOf(":")===n.length-1&&(n=n.substr(0,n.length-1)),r.host={full:r.hostname,stripped:null},r.path={absolute:{array:null,string:r.pathname},relative:{array:null,string:null}},r.query={object:r.query,string:{full:null,stripped:null}},r.extra={hrefInfo:{minimumPathOnly:null,minimumResourceOnly:null,minimumQueryOnly:null,minimumHashOnly:null,empty:null,separatorOnlyQuery:"?"===r.search},portIsDefault:null,relation:{maximumScheme:null,maximumAuth:null,maximumHost:null,maximumPort:null,maximumPath:null,maximumResource:null,maximumQuery:null,maximumHash:null,minimumScheme:null,minimumAuth:null,minimumHost:null,minimumPort:null,minimumPath:null,minimumResource:null,minimumQuery:null,minimumHash:null,overridesQuery:null},resourceIsIndex:null,slashes:r.slashes},r.resource=null,r.scheme=n,delete r.hostname,delete r.pathname,delete r.protocol,delete r.search,delete r.slashes,r):{href:e,valid:!1};var r,n};var we={join:function(e){return e.length>0?e.join("/")+"/":""},resolveDotSegments:function(e){var t=[];return e.forEach((function(e){".."!==e?"."!==e&&t.push(e):t.length>0&&t.splice(t.length-1,1)})),t}};function Oe(e,t){var r=xe(e,t);return!1===r.valid||(he(r,t),de(r,t),pe(r,t),be(r,t),fe(r)),r}var Ee={from:function(e,t,r){if(e){var n=Oe(e,t),a=we.resolveDotSegments(n.path.absolute.array);return n.path.absolute.array=a,n.path.absolute.string="/"+we.join(a),n}return r},to:Oe};var Se={pathOn:function(e,t,r){var n=e.extra.hrefInfo.minimumQueryOnly,a=e.extra.hrefInfo.minimumHashOnly,o=e.extra.hrefInfo.empty,i=e.extra.relation.minimumPort,s=e.extra.relation.minimumScheme,u=i&&e.path.absolute.string===t.path.absolute.string,l=e.resource===t.resource||!e.resource&&t.extra.resourceIsIndex||r.removeDirectoryIndexes&&e.extra.resourceIsIndex&&!t.resource,c=u&&(l||n||a||o),f=r.removeEmptyQueries?"stripped":"full",h=e.query.string[f],m=t.query.string[f],p=c&&!!h&&h===m||(a||o)&&!e.extra.hrefInfo.separatorOnlyQuery,d=p&&e.hash===t.hash;e.extra.relation.minimumPath=u,e.extra.relation.minimumResource=c,e.extra.relation.minimumQuery=p,e.extra.relation.minimumHash=d,e.extra.relation.maximumPort=!s||s&&!u,e.extra.relation.maximumPath=!s||s&&!c,e.extra.relation.maximumResource=!s||s&&!p,e.extra.relation.maximumQuery=!s||s&&!d,e.extra.relation.maximumHash=!s||s&&!d,e.extra.relation.overridesQuery=u&&e.extra.relation.maximumResource&&!p&&!!m},upToPath:function(e,t,r){var n=e.extra.hrefInfo.minimumPathOnly,a=e.scheme===t.scheme||!e.scheme,o=a&&(e.auth===t.auth||r.removeAuth||n),i=r.ignore_www?"stripped":"full",s=o&&(e.host[i]===t.host[i]||n),u=s&&(e.port===t.port||n);e.extra.relation.minimumScheme=a,e.extra.relation.minimumAuth=o,e.extra.relation.minimumHost=s,e.extra.relation.minimumPort=u,e.extra.relation.maximumScheme=!a||a&&!o,e.extra.relation.maximumAuth=!a||a&&!s,e.extra.relation.maximumHost=!a||a&&!u}};var Ie=function(e,t,r){Se.upToPath(e,t,r),e.extra.relation.minimumScheme&&(e.scheme=t.scheme),e.extra.relation.minimumAuth&&(e.auth=t.auth),e.extra.relation.minimumHost&&(e.host=ue.clone(t.host)),e.extra.relation.minimumPort&&function(e,t){e.port=t.port,e.extra.portIsDefault=t.extra.portIsDefault}(e,t),e.extra.relation.minimumScheme&&function(e,t){if(e.extra.relation.maximumHost||!e.extra.hrefInfo.minimumResourceOnly){var r=e.path.absolute.array,n="/";r?(e.extra.hrefInfo.minimumPathOnly&&0!==e.path.absolute.string.indexOf("/")&&(r=t.path.absolute.array.concat(r)),r=we.resolveDotSegments(r),n+=we.join(r)):r=[],e.path.absolute.array=r,e.path.absolute.string=n}else e.path=ue.clone(t.path)}(e,t),Se.pathOn(e,t,r),e.extra.relation.minimumResource&&function(e,t){e.resource=t.resource,e.extra.resourceIsIndex=t.extra.resourceIsIndex}(e,t),e.extra.relation.minimumQuery&&(e.query=ue.clone(t.query)),e.extra.relation.minimumHash&&(e.hash=t.hash)};var je=function(e,t,r){if(e.extra.relation.minimumScheme){var n=(a=e.path.absolute.array,o=t.path.absolute.array,i=[],s=!0,u=-1,o.forEach((function(e,t){s&&(a[t]!==e?s=!1:u=t),s||i.push("..")})),a.forEach((function(e,t){t>u&&i.push(e)})),i);e.path.relative.array=n,e.path.relative.string=we.join(n)}var a,o,i,s,u};var Pe=function(e,t,r){return Ie(t,e,r),je(t,e),t};function Ae(e,t){this.options=ce(t,{defaultPorts:{ftp:21,http:80,https:443},directoryIndexes:["index.html"],ignore_www:!1,output:Ae.SHORTEST,rejectedSchemes:["data","javascript","mailto"],removeAuth:!1,removeDirectoryIndexes:!0,removeEmptyQueries:!1,removeRootTrailingSlash:!0,schemeRelative:!0,site:void 0,slashesDenoteHost:!0}),this.from=Ee.from(e,this.options,null)}Ae.prototype.relate=function(e,t,r){if(ue.isPlainObject(t)?(r=t,t=e,e=null):t||(t=e,e=null),r=ce(r,this.options),e=e||r.site,!(e=Ee.from(e,r,this.from))||!e.href)throw new Error("from value not defined.");if(e.extra.hrefInfo.minimumPathOnly)throw new Error("from value supplied is not absolute: "+e.href);return!1===(t=Ee.to(t,r)).valid?t.href:(t=Pe(e,t,r),t=se(t,r))},Ae.relate=function(e,t,r){return(new Ae).relate(e,t,r)},ue.shallowMerge(Ae,ne);var Te=Ae,Re=fetch;const{jsonTypeOf:$e,splitUrl:Ve,safeResolveUrl:ke}=m,Le={},He={},Ue=(e,t)=>{const r=e in He?He[e]:e;if(r in Le)return Le[r][t]},qe={},De={},_e=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=Ve(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const a=Ue(n,"baseToken"),o=Ue(n,"anchorToken"),i=Ve(t)[0];if(!i&&!Ve(e[a]||"")[0])throw Error("Couldn't determine an identifier for the schema");const s=ke(i,e[a]||""),[u,l]=Ve(s);delete e[a],l&&a===o&&(e[o]=o!==a?encodeURI(l):`#${encodeURI(l)}`),i&&(De[i]=u);const c={},f=Ue(n,"recursiveAnchorToken");let h;!0===e[f]&&(c[""]=`${u}#`,e[o]="",delete e[f]);const m=Ue(n,"vocabularyToken");$e(e[m],"object")?(He[u]=n,h=e[m],delete e[m]):(He[u]=n,h={[n]:!0});const p={"":""};return qe[u]={id:u,schemaVersion:n,schema:Ce(e,u,n,I.nil,p,c),anchors:p,dynamicAnchors:c,vocabulary:h,validated:!1},u},Ce=(e,t,r,n,a,o)=>{if($e(e,"object")){const i="string"==typeof e.$schema?Ve(e.$schema)[0]:r,s=Ue(i,"embeddedToken"),u=Ue(i,"anchorToken");if("string"==typeof e[s]&&(s!==u||"#"!==e[s][0])){const n=ke(t,e[s]);return e[s]=n,_e(e,n,r),A.cons(e[s],e)}const l=Ue(r,"anchorToken"),c=Ue(r,"dynamicAnchorToken");"string"==typeof e[c]&&(o[e[c]]=`${t}#${encodeURI(n)}`,a[e[c]]=n,delete e[c]);const f=Ue(r,"embeddedToken");if("string"==typeof e[l]){const t=l!==f?e[l]:e[l].slice(1);a[t]=n,delete e[l]}const h=Ue(r,"jrefToken");if("string"==typeof e[h])return A.cons(e[h],e);for(const i in e)e[i]=Ce(e[i],t,r,I.append(i,n),a,o);return e}return Array.isArray(e)?e.map(((e,i)=>Ce(e,t,r,I.append(i,n),a,o))):e},Qe=e=>qe[De[e]]||qe[e],ze=Object.freeze({id:"",schemaVersion:void 0,vocabulary:{},pointer:I.nil,schema:void 0,value:void 0,anchors:{},dynamicAnchors:{},validated:!0}),Be=async(e,t=ze)=>{const r=ke(Je(t),e),[n,a]=Ve(r);if(!(e=>e in qe||e in De)(n)){const e=await Re(n,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error(`Failed to retrieve schema with id: ${n}`);if(e.headers.has("content-type")){const t=F.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${n} is not a schema. Found a document with media type: ${t}`)}_e(await e.json(),n)}const o=Qe(n),i="/"!==a[0]?Ne(o,a):a,s=Object.freeze({...o,pointer:i,value:I.get(i,o.schema)});return Ke(s)},Ke=e=>A.isReference(e.value)?Be(A.href(e.value),e):e,Ne=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},Je=e=>`${e.id}#${encodeURI(e.pointer)}`,Me=e=>A.isReference(e.value)?A.value(e.value):e.value,Fe=(e,t)=>{const r=Qe(t.id),n=Object.freeze({...t,pointer:I.append(e,t.pointer),value:Me(t)[e],validated:r.validated});return Ke(n)},We=r(((e,t)=>re.pipeline([Me,re.map((async(r,n)=>e(await Fe(n,t),n))),re.all],t))),Ze={parentId:"",parentDialect:"",includeEmbedded:!0},Ge=(e,t)=>t.startsWith("file://")?""===e?"":Te.relate(e,t):t;var Xe={setConfig:(e,t,r)=>{Le[e]||(Le[e]={}),Le[e][t]=r},getConfig:Ue,add:_e,get:Be,markValidated:e=>{qe[e].validated=!0},uri:Je,value:Me,getAnchorPointer:Ne,typeOf:(e,t)=>$e(Me(e),t),has:(e,t)=>e in Me(t),step:Fe,keys:e=>Object.keys(Me(e)),entries:e=>re.pipeline([Me,Object.keys,re.map((async t=>[t,await Fe(t,e)])),re.all],e),map:We,length:e=>Me(e).length,toSchema:(e,t={})=>{const r={...Ze,...t},n=JSON.parse(JSON.stringify(e.schema,((t,n)=>{if(!A.isReference(n))return n;const a=A.value(n),o=a.$schema||e.schemaVersion,i=Ue(o,"embeddedToken");return!r.includeEmbedded&&i in a?void 0:A.value(n)}))),a=Ue(e.schemaVersion,"dynamicAnchorToken");Object.entries(e.dynamicAnchors).forEach((([e,t])=>{const r=Ve(t)[1];I.assign(r,n,{[a]:e,...I.get(r,n)})}));const o=Ue(e.schemaVersion,"anchorToken");Object.entries(e.anchors).filter((([e])=>""!==e)).forEach((([e,t])=>{I.assign(t,n,{[o]:e,...I.get(t,n)})}));const i=Ue(e.schemaVersion,"baseToken"),s=Ge(r.parentId,e.id),u=r.parentDialect===e.schemaVersion?"":e.schemaVersion;return{...s&&{[i]:s},...u&&{$schema:u},...n}}};Xe.setConfig,Xe.getConfig,Xe.add,Xe.get,Xe.markValidated,Xe.uri,Xe.value,Xe.getAnchorPointer,Xe.typeOf,Xe.has,Xe.step,Xe.keys,Xe.entries,Xe.map,Xe.length,Xe.toSchema;class Ye extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var et=Ye;const{splitUrl:tt}=m,rt="FLAG",nt="BASIC",at="DETAILED",ot="VERBOSE";let it=at,st=!0;const ut=async e=>{const t={metaData:{}};return{ast:t,schemaUri:await yt(e,t)}},lt=r((({ast:e,schemaUri:t},r,n=rt)=>{if(![rt,nt,at,ot].includes(n))throw Error(`The '${n}' error format is not supported`);const a=[],i=o.subscribe("result",ct(n,a));return bt(t,r,e,{}),o.unsubscribe(i),a[0]})),ct=(e,t)=>{const r=[];return(n,a)=>{if("result"===n){const{keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:o}=a,i={keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:o,errors:[]};r.push(i)}else if("result.start"===n)r.push(n);else if("result.end"===n){const n=r.pop();for(;"result.start"!==r[r.length-1];){const t=r.pop(),a=[t];e===nt&&(a.push(...t.errors),delete t.errors),(e===ot||e!==rt&&!t.valid)&&n.errors.unshift(...a)}r[r.length-1]=n,t[0]=n}}},ft={},ht=e=>ft[e],mt=e=>e in ft,pt={},dt={},yt=async(e,t)=>{if(e=await vt(e),!mt(`${e.schemaVersion}#validate`)){const t=await Xe.get(e.schemaVersion);(Xe.getConfig(t.id,"mandatoryVocabularies")||[]).forEach((e=>{if(!t.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)})),Object.entries(t.vocabulary).forEach((([e,r])=>{if(e in pt)Object.entries(pt[e]).forEach((([e,r])=>{((e,t)=>{ft[e]={collectEvaluatedItems:(e,r,n,a,o)=>t.interpret(e,r,n,a,o)&&new Set,collectEvaluatedProperties:(e,r,n,a,o)=>t.interpret(e,r,n,a,o)&&[],...t}})(`${t.id}#${e}`,r)}));else if(r)throw Error(`Missing required vocabulary: ${e}`)}))}if(st&&!e.validated){if(Xe.markValidated(e.id),!(e.schemaVersion in dt)){const t=await Xe.get(e.schemaVersion),r=await ut(t);dt[t.id]=lt(r)}const t=_.cons(e.schema,e.id),r=dt[e.schemaVersion](t,it);if(!r.valid)throw new et(r)}return e.id in t.metaData||(t.metaData[e.id]={id:e.id,dynamicAnchors:e.dynamicAnchors,anchors:e.anchors}),ht(`${e.schemaVersion}#validate`).compile(e,t)},vt=async e=>Xe.typeOf(e,"string")?vt(await Xe.get(Xe.value(e),e)):e,bt=(e,t,r,n)=>{const a=gt(e,r),o=tt(e)[0];return ht(a).interpret(e,t,r,{...r.metaData[o].dynamicAnchors,...n})},gt=(e,t)=>{if(!(e in t))throw Error(`No schema found at ${e}`);return t[e][0]};var xt={validate:async(e,t,r)=>{const n=await ut(e),a=(e,t)=>lt(n,_.cons(e),t);return void 0===t?a:a(t,r)},compile:ut,interpret:lt,setMetaOutputFormat:e=>{it=e},setShouldMetaValidate:e=>{st=e},FLAG:rt,BASIC:nt,DETAILED:at,VERBOSE:ot,add:(e,t="",r="")=>{const n=Xe.add(e,t,r);delete dt[n]},getKeyword:ht,hasKeyword:mt,defineVocabulary:(e,t)=>{pt[e]=t},compileSchema:yt,interpretSchema:bt,collectEvaluatedProperties:(e,t,r,n,a)=>{const o=gt(e,r);return ht(o).collectEvaluatedProperties(e,t,r,n,a)},collectEvaluatedItems:(e,t,r,n,a)=>{const o=gt(e,r);return ht(o).collectEvaluatedItems(e,t,r,n,a)}};var wt={compile:e=>Xe.value(e),interpret:()=>!0};var Ot={compile:async(e,t)=>{const r=Xe.uri(e);if(!(r in t)){t[r]=!1;const n=Xe.value(e);if(!["object","boolean"].includes(typeof n))throw Error(`No schema found at '${Xe.uri(e)}'`);t[r]=[`${e.schemaVersion}#validate`,Xe.uri(e),"boolean"==typeof n?n:await re.pipeline([Xe.entries,re.map((([t,r])=>[`${e.schemaVersion}#${t}`,r])),re.filter((([t])=>xt.hasKeyword(t)&&t!==`${e.schemaVersion}#validate`)),re.map((async([r,n])=>{const a=await xt.getKeyword(r).compile(n,t,e);return[r,Xe.uri(n),a]})),re.all],e)]}return r},interpret:(e,t,r,n)=>{const[a,i,s]=r[e];o.publishSync("result.start");const u="boolean"==typeof s?s:s.every((([e,a,i])=>{o.publishSync("result.start");const s=xt.getKeyword(e).interpret(i,t,r,n);return o.publishSync("result",{keyword:e,absoluteKeywordLocation:a,instanceLocation:_.uri(t),valid:s,ast:i}),o.publishSync("result.end"),s}));return o.publishSync("result",{keyword:a,absoluteKeywordLocation:i,instanceLocation:_.uri(t),valid:u,ast:e}),o.publishSync("result.end"),u},collectEvaluatedProperties:(e,t,r,n,a=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter((([e])=>!a||!e.endsWith("#unevaluatedProperties"))).reduce(((e,[a,,o])=>{const i=e&&xt.getKeyword(a).collectEvaluatedProperties(o,t,r,n);return!1!==i&&[...e,...i]}),[])},collectEvaluatedItems:(e,t,r,n,a=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&new Set:o.filter((([e])=>!a||!e.endsWith("#unevaluatedItems"))).reduce(((e,[a,,o])=>{const i=!1!==e&&xt.getKeyword(a).collectEvaluatedItems(o,t,r,n);return!1!==i&&new Set([...e,...i])}),new Set)}},Et={metaData:wt,validate:Ot},St=e("default",{Core:xt,Schema:Xe,Instance:_,Reference:A,Keywords:Et,InvalidSchemaError:et});e("Core",St.Core),e("Schema",St.Schema),e("Instance",St.Instance),e("Reference",St.Reference),e("Keywords",St.Keywords),e("InvalidSchemaError",St.InvalidSchemaError)}}})); | ||
//# sourceMappingURL=json-schema-core-system.min.js.map |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).JSC={})}(this,(function(e){"use strict";var t=function(e,t){return function r(){null==t&&(t=e.length);var n=[].slice.call(arguments);return n.length>=t?e.apply(this,n):function(){return r.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:{};var n=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e,t){var n,o;n="object"==typeof window&&window||r,o={},n.PubSub=o,function(e){var t={},r=-1,n="*";function o(e){var t;for(t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function a(e){return function(){throw e}}function i(e,t,r){try{e(t,r)}catch(e){setTimeout(a(e),0)}}function s(e,t,r){e(t,r)}function c(e,r,n,o){var a,c=t[r],l=o?s:i;if(Object.prototype.hasOwnProperty.call(t,r))for(a in c)Object.prototype.hasOwnProperty.call(c,a)&&l(c[a],e,n)}function l(e,t,r){return function(){var o=String(e),a=o.lastIndexOf(".");for(c(e,e,t,r);-1!==a;)a=(o=o.substr(0,a)).lastIndexOf("."),c(e,o,t,r);c(e,n,t,r)}}function u(e){var r=String(e);return Boolean(Object.prototype.hasOwnProperty.call(t,r)&&o(t[r]))}function f(e){for(var t=String(e),r=u(t)||u(n),o=t.lastIndexOf(".");!r&&-1!==o;)o=(t=t.substr(0,o)).lastIndexOf("."),r=u(t);return r}function p(e,t,r,n){var o=l(e="symbol"==typeof e?e.toString():e,t,n);return!!f(e)&&(!0===r?o():setTimeout(o,0),!0)}e.publish=function(t,r){return p(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return p(t,r,!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(t,e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeAll=function(t){return e.subscribe(n,t)},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n,o=0;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)){for(n in t[r])o++;break}return o},e.getSubscriptions=function(e){var r,n=[];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,a,i=function(e){var r;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e))return!0;return!1},s="string"==typeof r&&(Object.prototype.hasOwnProperty.call(t,r)||i(r)),c=!s&&"string"==typeof r,l="function"==typeof r,u=!1;if(!s){for(n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(o=t[n],c&&o[r]){delete o[r],u=r;break}if(l)for(a in o)Object.prototype.hasOwnProperty.call(o,a)&&o[a]===r&&(delete o[a],u=!0)}return u}e.clearSubscriptions(r)}}(o),void 0!==e&&e.exports&&(t=e.exports=o),t.PubSub=o,e.exports=t=o}));n.PubSub;var o=function(e,t){if(e=e.trim(),(t=t.trim()).startsWith("about:"))return t;const r=function(e){const t={host:"",path:"",query:"",protocol:""};let r=e,n=e.indexOf("//");t.protocol=r.substring(0,n),n+=2;const o=e.indexOf("/",n),a=e.indexOf("?"),i=e.indexOf("#");-1!==i&&(r=r.substring(0,i));if(-1!==a){const e=r.substring(a);t.query=e,r=r.substring(0,a)}if(-1!==o){const e=r.substring(0,o);t.host=e,r=r.substring(o),t.path=r}else t.host=r;return t}(e),n=function(e){const t={href:e,hash:"",query:"",netPath:!1,absolutePath:!1,relativePath:!1};if(s.test(e))return t.netPath=!0,t;"/"===e[0]?t.absolutePath=!0:""!==e&&(t.relativePath=!0);let r=e;const n=e.indexOf("?"),o=e.indexOf("#");if(-1!==o){const e=r.substring(o);t.hash=e,r=r.substring(0,o)}if(-1!==n){const e=r.substring(n);t.query=e,r=r.substring(0,n)}return t.path=r,t}(t);if(!r.protocol&&!n.netPath)throw new Error("Error, protocol is not specified");if(n.netPath)return n.href.startsWith("//")&&(n.href=r.protocol+n.href),function(e){const t=e.indexOf("//")+2,r=!e.includes("/",t),n=!e.includes("?",t),o=!e.includes("#",t);return r&&n&&o}(n.href)?a(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+i(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let a,s=r.path,c=r.host;return 0===e.length?a=s:(s=s.substring(0,s.lastIndexOf("/")),a=i(s+"/"+e)),c+=""!==a||t||o?a+t+o:"/",c}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:a(e)}};function a(e){return e+("/"===e[e.length-1]?"":"/")}function i(e){let t=e.split("/");""===t[0]&&(t=t.slice(1));let r=[];return t.forEach(((e,n)=>{"."!==e&&(".."===e?r.pop():""===e&&n!==t.length-1||r.push(e))})),"/"+r.join("/")}const s=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");const c={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},l=e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),o=e.slice(r+1);return[decodeURI(n),decodeURI(o)]},u=e=>{const t=RegExp(/^(.+):\/\//).exec(e);return t?t[1]:""};var f={jsonTypeOf:(e,t)=>c[t](e),splitUrl:l,safeResolveUrl:(e,t)=>{const r=o(e,t),n=l(e)[0];if(n&&"file"===u(r)&&"file"!==u(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r}};const p=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(g)},d=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:d(e,O(t,o,n),r,v(o,n))}}if(Array.isArray(t)){const n=[...t];return n[w(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:O(t,e[0],n)},h=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||E(t)){const o=e.shift();h(e,O(t,o,n),r,v(o,n))}else{t[w(t,e[0])]=r}},y=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=O(t,n,r);return{...t,[n]:y(e,o,v(n,r))}}if(Array.isArray(t))return t.filter(((t,r)=>r!=e[0]));if("object"==typeof t&&null!==t){const{[e[0]]:r,...n}=t;return n}return O(t,e[0],r)}},b=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=O(t,n,r);b(e,o,v(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:O(t,e[0],r)},v=t(((e,t)=>t+"/"+m(e))),m=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),g=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),w=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,O=(e,t,r="")=>{if(void 0===e)throw TypeError(`Value at '${r}' is undefined and does not have property '${t}'`);if(null===e)throw TypeError(`Value at '${r}' is null and does not have property '${t}'`);if(E(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[w(e,t)]},E=e=>null===e||"object"!=typeof e;var j={nil:"",append:v,get:(e,t)=>{const r=p(e),n=e=>r.reduce((([e,t],r)=>[O(e,r,t),v(r,t)]),[e,""])[0];return void 0===t?n:n(t)},set:(e,r,n)=>{const o=p(e),a=t(((e,t)=>d(o,e,t,"")));return void 0===r?a:a(r,n)},assign:(e,r,n)=>{const o=p(e),a=t(((e,t)=>h(o,e,t,"")));return void 0===r?a:a(r,n)},unset:(e,t)=>{const r=p(e),n=e=>y(r,e,"");return void 0===t?n:n(t)},remove:(e,t)=>{const r=p(e),n=e=>b(r,e,"");return void 0===t?n:n(t)}};j.nil,j.append,j.get,j.set,j.assign,j.unset,j.remove;const $=Symbol("$__value"),S=Symbol("$__href");var x={cons:(e,t)=>Object.freeze({[S]:e,[$]:t}),isReference:e=>e&&void 0!==e[S],href:e=>e[S],value:e=>e[$]};const{jsonTypeOf:P}=f,A=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),T=e=>x.isReference(e.value)?x.value(e.value):e.value,I=t(((e,t)=>P(T(e),t))),k=(e,t)=>Object.freeze({...t,pointer:j.append(e,t.pointer),value:T(t)[e]}),V=t(((e,t)=>T(t).map(((r,n,o,a)=>e(k(n,t),n,o,a))))),R=t(((e,t)=>T(t).map(((e,r,n,o)=>k(r,t))).filter(((t,r,n,o)=>e(t,r,n,o))))),C=t(((e,t,r)=>T(r).reduce(((t,n,o)=>e(t,k(o,r),o)),t))),U=t(((e,t)=>T(t).every(((r,n,o,a)=>e(k(n,t),n,o,a))))),z=t(((e,t)=>T(t).some(((r,n,o,a)=>e(k(n,t),n,o,a)))));var K={nil:A,cons:(e,t="")=>Object.freeze({...A,id:t,instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:T,has:(e,t)=>e in T(t),typeOf:I,step:k,entries:e=>Object.keys(T(e)).map((t=>[t,k(t,e)])),keys:e=>Object.keys(T(e)),map:V,filter:R,reduce:C,every:U,some:z,length:e=>T(e).length},L=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,q=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,_=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,D=/\\([\u000b\u0020-\u00ff])/g,N=/([\\"])/g,B=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function F(e){var t=String(e);if(_.test(t))return t;if(t.length>0&&!q.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(N,"\\$1")+'"'}function Z(e){this.parameters=Object.create(null),this.type=e}var J={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!B.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,a=Object.keys(t).sort(),i=0;i<a.length;i++){if(o=a[i],!_.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+F(t[o])}return n},parse:function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;"function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.substr(0,r).trim():t.trim();if(!B.test(n))throw new TypeError("invalid media type");var o=new Z(n.toLowerCase());if(-1!==r){var a,i,s;for(L.lastIndex=r;i=L.exec(t);){if(i.index!==r)throw new TypeError("invalid parameter format");r+=i[0].length,a=i[1].toLowerCase(),'"'===(s=i[2])[0]&&(s=s.substr(1,s.length-2).replace(D,"$1")),o.parameters[a]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},M=async e=>Object.entries(await e),W=t((async(e,t)=>(await t).map(e))),G=t((async(e,t,r)=>(await r).reduce((async(t,r)=>e(await t,r)),t))),H=t((async(e,t,r={})=>G((async(t,r)=>await e(r)?t.concat([r]):t),[],t,r))),Q=t((async(e,t)=>{const r=await W(e,t);return(await Promise.all(r)).some((e=>e))})),X=t((async(e,t)=>{const r=await W(e,t);return(await Promise.all(r)).every((e=>e))})),Y=t(((e,t)=>e.reduce((async(e,t)=>t(await e)),t))),ee={entries:M,map:W,filter:H,reduce:G,some:Q,every:X,pipeline:Y,all:e=>Promise.all(e),allValues:e=>Y([M,G((async(e,[t,r])=>(e[t]=await r,e)),{})],e)};ee.entries,ee.map,ee.filter,ee.reduce,ee.some,ee.every,ee.pipeline,ee.all,ee.allValues;var te=fetch;const{jsonTypeOf:re,splitUrl:ne,safeResolveUrl:oe}=f,ae={},ie={},se=(e,t)=>{const r=e in ie?ie[e]:e;if(r in ae)return ae[r][t]},ce={},le={},ue=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=ne(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=se(n,"baseToken"),a=se(n,"anchorToken"),i=ne(t)[0];if(!i&&!ne(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const s=oe(i,e[o]||""),[c,l]=ne(s);delete e[o],l&&o===a&&(e[a]=a!==o?encodeURI(l):`#${encodeURI(l)}`),i&&(le[i]=c);const u={},f=se(n,"recursiveAnchorToken");let p;!0===e[f]&&(u[""]=`${c}#`,e[a]="",delete e[f]);const d=se(n,"vocabularyToken");re(e[d],"object")?(ie[c]=n,p=e[d],delete e[d]):(ie[c]=n,p={[n]:!0});const h={"":""};return ce[c]={id:c,schemaVersion:n,schema:fe(e,c,n,j.nil,h,u),anchors:h,dynamicAnchors:u,vocabulary:p,validated:!1},c},fe=(e,t,r,n,o,a)=>{if(re(e,"object")){const i="string"==typeof e.$schema?ne(e.$schema)[0]:r,s=se(i,"embeddedToken"),c=se(i,"anchorToken");if("string"==typeof e[s]&&(s!==c||"#"!==e[s][0])){const n=oe(t,e[s]);return e[s]=n,ue(e,n,r),x.cons(e[s],e)}const l=se(r,"anchorToken"),u=se(r,"dynamicAnchorToken");"string"==typeof e[u]&&(a[e[u]]=`${t}#${encodeURI(n)}`,o[e[u]]=n,delete e[u]);const f=se(r,"embeddedToken");if("string"==typeof e[l]){const t=l!==f?e[l]:e[l].slice(1);o[t]=n,delete e[l]}const p=se(r,"jrefToken");if("string"==typeof e[p])return x.cons(e[p],e);for(const i in e)e[i]=fe(e[i],t,r,j.append(i,n),o,a);return e}return Array.isArray(e)?e.map(((e,i)=>fe(e,t,r,j.append(i,n),o,a))):e},pe=e=>ce[le[e]]||ce[e],de=Object.freeze({id:"",schemaVersion:void 0,vocabulary:{},pointer:j.nil,schema:void 0,value:void 0,anchors:{},dynamicAnchors:{},validated:!0}),he=async(e,t=de)=>{const r=oe(ve(t),e),[n,o]=ne(r);if(!(e=>e in ce||e in le)(n)){const e=await te(n,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error(`Failed to retrieve schema with id: ${n}`);if(e.headers.has("content-type")){const t=J.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${n} is not a schema. Found a document with media type: ${t}`)}ue(await e.json(),n)}const a=pe(n),i="/"!==o[0]?be(a,o):o,s=Object.freeze({...a,pointer:i,value:j.get(i,a.schema)});return ye(s)},ye=e=>x.isReference(e.value)?he(x.href(e.value),e):e,be=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},ve=e=>`${e.id}#${encodeURI(e.pointer)}`,me=e=>x.isReference(e.value)?x.value(e.value):e.value,ge=(e,t)=>{const r=pe(t.id),n=Object.freeze({...t,pointer:j.append(e,t.pointer),value:me(t)[e],validated:r.validated});return ye(n)},we=t(((e,t)=>ee.pipeline([me,ee.map((async(r,n)=>e(await ge(n,t),n))),ee.all],t)));var Oe={setConfig:(e,t,r)=>{ae[e]||(ae[e]={}),ae[e][t]=r},getConfig:se,add:ue,get:he,markValidated:e=>{ce[e].validated=!0},uri:ve,value:me,getAnchorPointer:be,typeOf:(e,t)=>re(me(e),t),has:(e,t)=>e in me(t),step:ge,keys:e=>Object.keys(me(e)),entries:e=>ee.pipeline([me,Object.keys,ee.map((async t=>[t,await ge(t,e)])),ee.all],e),map:we,length:e=>me(e).length};Oe.setConfig,Oe.getConfig,Oe.add,Oe.get,Oe.markValidated,Oe.uri,Oe.value,Oe.getAnchorPointer,Oe.typeOf,Oe.has,Oe.step,Oe.keys,Oe.entries,Oe.map,Oe.length;class Ee extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var je=Ee;const{splitUrl:$e}=f,Se="FLAG",xe="BASIC",Pe="DETAILED",Ae="VERBOSE";let Te=Pe,Ie=!0;const ke=async e=>{const t={metaData:{}};return{ast:t,schemaUri:await qe(e,t)}},Ve=t((({ast:e,schemaUri:t},r,o=Se)=>{if(![Se,xe,Pe,Ae].includes(o))throw Error(`The '${o}' error format is not supported`);const a=[],i=n.subscribe("result",Re(o,a));return De(t,r,e,{}),n.unsubscribe(i),a[0]})),Re=(e,t)=>{const r=[];return(n,o)=>{if("result"===n){const{keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:a}=o,i={keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:a,errors:[]};r.push(i)}else if("result.start"===n)r.push(n);else if("result.end"===n){const n=r.pop();for(;"result.start"!==r[r.length-1];){const t=r.pop(),o=[t];e===xe&&(o.push(...t.errors),delete t.errors),(e===Ae||e!==Se&&!t.valid)&&n.errors.unshift(...o)}r[r.length-1]=n,t[0]=n}}},Ce={},Ue=e=>Ce[e],ze=e=>e in Ce,Ke={},Le={},qe=async(e,t)=>{if(e=await _e(e),!ze(`${e.schemaVersion}#validate`)){const t=await Oe.get(e.schemaVersion);(Oe.getConfig(t.id,"mandatoryVocabularies")||[]).forEach((e=>{if(!t.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)})),Object.entries(t.vocabulary).forEach((([e,r])=>{if(e in Ke)Object.entries(Ke[e]).forEach((([e,r])=>{((e,t)=>{Ce[e]={collectEvaluatedItems:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&new Set,collectEvaluatedProperties:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&[],...t}})(`${t.id}#${e}`,r)}));else if(r)throw Error(`Missing required vocabulary: ${e}`)}))}if(Ie&&!e.validated){if(Oe.markValidated(e.id),!(e.schemaVersion in Le)){const t=await Oe.get(e.schemaVersion),r=await ke(t);Le[t.id]=Ve(r)}const t=K.cons(e.schema,e.id),r=Le[e.schemaVersion](t,Te);if(!r.valid)throw new je(r)}return e.id in t.metaData||(t.metaData[e.id]={id:e.id,dynamicAnchors:e.dynamicAnchors,anchors:e.anchors}),Ue(`${e.schemaVersion}#validate`).compile(e,t)},_e=async e=>Oe.typeOf(e,"string")?_e(await Oe.get(Oe.value(e),e)):e,De=(e,t,r,n)=>{const o=Ne(e,r),a=$e(e)[0];return Ue(o).interpret(e,t,r,{...r.metaData[a].dynamicAnchors,...n})},Ne=(e,t)=>{if(!(e in t))throw Error(`No schema found at ${e}`);return t[e][0]};var Be={validate:async(e,t,r)=>{const n=await ke(e),o=(e,t)=>Ve(n,K.cons(e),t);return void 0===t?o:o(t,r)},compile:ke,interpret:Ve,setMetaOutputFormat:e=>{Te=e},setShouldMetaValidate:e=>{Ie=e},FLAG:Se,BASIC:xe,DETAILED:Pe,VERBOSE:Ae,add:(e,t="",r="")=>{const n=Oe.add(e,t,r);delete Le[n]},getKeyword:Ue,hasKeyword:ze,defineVocabulary:(e,t)=>{Ke[e]=t},compileSchema:qe,interpretSchema:De,collectEvaluatedProperties:(e,t,r,n,o)=>{const a=Ne(e,r);return Ue(a).collectEvaluatedProperties(e,t,r,n,o)},collectEvaluatedItems:(e,t,r,n,o)=>{const a=Ne(e,r);return Ue(a).collectEvaluatedItems(e,t,r,n,o)}};var Fe={compile:e=>Oe.value(e),interpret:()=>!0};var Ze={compile:async(e,t)=>{const r=Oe.uri(e);if(!(r in t)){t[r]=!1;const n=Oe.value(e);if(!["object","boolean"].includes(typeof n))throw Error(`No schema found at '${Oe.uri(e)}'`);t[r]=[`${e.schemaVersion}#validate`,Oe.uri(e),"boolean"==typeof n?n:await ee.pipeline([Oe.entries,ee.map((([t,r])=>[`${e.schemaVersion}#${t}`,r])),ee.filter((([t])=>Be.hasKeyword(t)&&t!==`${e.schemaVersion}#validate`)),ee.map((async([r,n])=>{const o=await Be.getKeyword(r).compile(n,t,e);return[r,Oe.uri(n),o]})),ee.all],e)]}return r},interpret:(e,t,r,o)=>{const[a,i,s]=r[e];n.publishSync("result.start");const c="boolean"==typeof s?s:s.every((([e,a,i])=>{n.publishSync("result.start");const s=Be.getKeyword(e).interpret(i,t,r,o);return n.publishSync("result",{keyword:e,absoluteKeywordLocation:a,instanceLocation:K.uri(t),valid:s,ast:i}),n.publishSync("result.end"),s}));return n.publishSync("result",{keyword:a,absoluteKeywordLocation:i,instanceLocation:K.uri(t),valid:c,ast:e}),n.publishSync("result.end"),c},collectEvaluatedProperties:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&[]:a.filter((([e])=>!o||!e.endsWith("#unevaluatedProperties"))).reduce(((e,[o,,a])=>{const i=e&&Be.getKeyword(o).collectEvaluatedProperties(a,t,r,n);return!1!==i&&[...e,...i]}),[])},collectEvaluatedItems:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&new Set:a.filter((([e])=>!o||!e.endsWith("#unevaluatedItems"))).reduce(((e,[o,,a])=>{const i=!1!==e&&Be.getKeyword(o).collectEvaluatedItems(a,t,r,n);return!1!==i&&new Set([...e,...i])}),new Set)}},Je={metaData:Fe,validate:Ze},Me={Core:Be,Schema:Oe,Instance:K,Reference:x,Keywords:Je,InvalidSchemaError:je},We=Me.Core,Ge=Me.Schema,He=Me.Instance,Qe=Me.Reference,Xe=Me.Keywords,Ye=Me.InvalidSchemaError;e.Core=We,e.Instance=He,e.InvalidSchemaError=Ye,e.Keywords=Xe,e.Reference=Qe,e.Schema=Ge,e.default=Me,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("url")):"function"==typeof define&&define.amd?define(["exports","url"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).JSC={},e.url)}(this,(function(e,t){"use strict";function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=r(t),o=function(e,t){return function r(){null==t&&(t=e.length);var n=[].slice.call(arguments);return n.length>=t?e.apply(this,n):function(){return r.apply(this,n.concat([].slice.call(arguments)))}}};var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var i=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e,t){var r,n;r="object"==typeof window&&window||a,n={},r.PubSub=n,function(e){var t={},r=-1,n="*";function o(e){var t;for(t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function a(e){return function(){throw e}}function i(e,t,r){try{e(t,r)}catch(e){setTimeout(a(e),0)}}function s(e,t,r){e(t,r)}function u(e,r,n,o){var a,u=t[r],l=o?s:i;if(Object.prototype.hasOwnProperty.call(t,r))for(a in u)Object.prototype.hasOwnProperty.call(u,a)&&l(u[a],e,n)}function l(e,t,r){return function(){var o=String(e),a=o.lastIndexOf(".");for(u(e,e,t,r);-1!==a;)a=(o=o.substr(0,a)).lastIndexOf("."),u(e,o,t,r);u(e,n,t,r)}}function c(e){var r=String(e);return Boolean(Object.prototype.hasOwnProperty.call(t,r)&&o(t[r]))}function f(e){for(var t=String(e),r=c(t)||c(n),o=t.lastIndexOf(".");!r&&-1!==o;)o=(t=t.substr(0,o)).lastIndexOf("."),r=c(t);return r}function h(e,t,r,n){var o=l(e="symbol"==typeof e?e.toString():e,t,n);return!!f(e)&&(!0===r?o():setTimeout(o,0),!0)}e.publish=function(t,r){return h(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return h(t,r,!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(t,e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeAll=function(t){return e.subscribe(n,t)},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n,o=0;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)){for(n in t[r])o++;break}return o},e.getSubscriptions=function(e){var r,n=[];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,a,i=function(e){var r;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e))return!0;return!1},s="string"==typeof r&&(Object.prototype.hasOwnProperty.call(t,r)||i(r)),u=!s&&"string"==typeof r,l="function"==typeof r,c=!1;if(!s){for(n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(o=t[n],u&&o[r]){delete o[r],c=r;break}if(l)for(a in o)Object.prototype.hasOwnProperty.call(o,a)&&o[a]===r&&(delete o[a],c=!0)}return c}e.clearSubscriptions(r)}}(n),void 0!==e&&e.exports&&(t=e.exports=n),t.PubSub=n,e.exports=t=n}));i.PubSub;var s=function(e,t){if(e=e.trim(),(t=t.trim()).startsWith("about:"))return t;const r=function(e){const t={host:"",path:"",query:"",protocol:""};let r=e,n=e.indexOf("//");t.protocol=r.substring(0,n),n+=2;const o=e.indexOf("/",n),a=e.indexOf("?"),i=e.indexOf("#");-1!==i&&(r=r.substring(0,i));if(-1!==a){const e=r.substring(a);t.query=e,r=r.substring(0,a)}if(-1!==o){const e=r.substring(0,o);t.host=e,r=r.substring(o),t.path=r}else t.host=r;return t}(e),n=function(e){const t={href:e,hash:"",query:"",netPath:!1,absolutePath:!1,relativePath:!1};if(c.test(e))return t.netPath=!0,t;"/"===e[0]?t.absolutePath=!0:""!==e&&(t.relativePath=!0);let r=e;const n=e.indexOf("?"),o=e.indexOf("#");if(-1!==o){const e=r.substring(o);t.hash=e,r=r.substring(0,o)}if(-1!==n){const e=r.substring(n);t.query=e,r=r.substring(0,n)}return t.path=r,t}(t);if(!r.protocol&&!n.netPath)throw new Error("Error, protocol is not specified");if(n.netPath)return function(e){return e.startsWith("//")}(n.href)&&(n.href=r.protocol+n.href),function(e){const t=e.indexOf("//")+2,r=!e.includes("/",t),n=!e.includes("?",t),o=!e.includes("#",t);return r&&n&&o}(n.href)?u(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+l(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let a,i=r.path,s=r.host;return 0===e.length?a=i:(i=i.substring(0,i.lastIndexOf("/")),a=l(i+"/"+e)),s+=""!==a||t||o?a+t+o:"/",s}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:u(e)}};function u(e){return e+("/"===e[e.length-1]?"":"/")}function l(e){let t=e.split("/");""===t[0]&&(t=t.slice(1));let r=[];return t.forEach(((e,n)=>{"."!==e&&(".."===e?r.pop():""===e&&n!==t.length-1||r.push(e))})),"/"+r.join("/")}const c=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");const f={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},h=e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),o=e.slice(r+1);return[decodeURI(n),decodeURI(o)]},m=e=>{const t=RegExp(/^(.+):\/\//).exec(e);return t?t[1]:""};var p={jsonTypeOf:(e,t)=>f[t](e),splitUrl:h,safeResolveUrl:(e,t)=>{const r=s(e,t),n=h(e)[0];if(n&&"file"===m(r)&&"file"!==m(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r}};const d=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(O)},y=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:y(e,S(t,o,n),r,x(o,n))}}if(Array.isArray(t)){const n=[...t];return n[E(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:S(t,e[0],n)},v=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||I(t)){const o=e.shift();v(e,S(t,o,n),r,x(o,n))}else{t[E(t,e[0])]=r}},b=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=S(t,n,r);return{...t,[n]:b(e,o,x(n,r))}}if(Array.isArray(t))return t.filter(((t,r)=>r!=e[0]));if("object"==typeof t&&null!==t){const{[e[0]]:r,...n}=t;return n}return S(t,e[0],r)}},g=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=S(t,n,r);g(e,o,x(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:S(t,e[0],r)},x=o(((e,t)=>t+"/"+w(e))),w=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),O=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),E=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,S=(e,t,r="")=>{if(void 0===e)throw TypeError(`Value at '${r}' is undefined and does not have property '${t}'`);if(null===e)throw TypeError(`Value at '${r}' is null and does not have property '${t}'`);if(I(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[E(e,t)]},I=e=>null===e||"object"!=typeof e;var j={nil:"",append:x,get:(e,t)=>{const r=d(e),n=e=>r.reduce((([e,t],r)=>[S(e,r,t),x(r,t)]),[e,""])[0];return void 0===t?n:n(t)},set:(e,t,r)=>{const n=d(e),a=o(((e,t)=>y(n,e,t,"")));return void 0===t?a:a(t,r)},assign:(e,t,r)=>{const n=d(e),a=o(((e,t)=>v(n,e,t,"")));return void 0===t?a:a(t,r)},unset:(e,t)=>{const r=d(e),n=e=>b(r,e,"");return void 0===t?n:n(t)},remove:(e,t)=>{const r=d(e),n=e=>g(r,e,"");return void 0===t?n:n(t)}};j.nil,j.append,j.get,j.set,j.assign,j.unset,j.remove;const P=Symbol("$__value"),T=Symbol("$__href");var A={cons:(e,t)=>Object.freeze({[T]:e,[P]:t}),isReference:e=>e&&void 0!==e[T],href:e=>e[T],value:e=>e[P]};const{jsonTypeOf:R}=p,$=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),V=e=>A.isReference(e.value)?A.value(e.value):e.value,k=o(((e,t)=>R(V(e),t))),L=(e,t)=>Object.freeze({...t,pointer:j.append(e,t.pointer),value:V(t)[e]}),H=o(((e,t)=>V(t).map(((r,n,o,a)=>e(L(n,t),n,o,a))))),U=o(((e,t)=>V(t).map(((e,r,n,o)=>L(r,t))).filter(((t,r,n,o)=>e(t,r,n,o))))),q=o(((e,t,r)=>V(r).reduce(((t,n,o)=>e(t,L(o,r),o)),t))),D=o(((e,t)=>V(t).every(((r,n,o,a)=>e(L(n,t),n,o,a))))),_=o(((e,t)=>V(t).some(((r,n,o,a)=>e(L(n,t),n,o,a)))));var C={nil:$,cons:(e,t="")=>Object.freeze({...$,id:t,instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:V,has:(e,t)=>e in V(t),typeOf:k,step:L,entries:e=>Object.keys(V(e)).map((t=>[t,L(t,e)])),keys:e=>Object.keys(V(e)),map:H,filter:U,reduce:q,every:D,some:_,length:e=>V(e).length},Q=/; *([!#$%&'*+.^_`|~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]+$/,B=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,K=/\\([\u000b\u0020-\u00ff])/g,N=/([\\"])/g,M=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function J(e){var t=String(e);if(B.test(t))return t;if(t.length>0&&!z.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(N,"\\$1")+'"'}function F(e){this.parameters=Object.create(null),this.type=e}var W={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!M.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,a=Object.keys(t).sort(),i=0;i<a.length;i++){if(o=a[i],!B.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+J(t[o])}return n},parse:function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;"function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.substr(0,r).trim():t.trim();if(!M.test(n))throw new TypeError("invalid media type");var o=new F(n.toLowerCase());if(-1!==r){var a,i,s;for(Q.lastIndex=r;i=Q.exec(t);){if(i.index!==r)throw new TypeError("invalid parameter format");r+=i[0].length,a=i[1].toLowerCase(),'"'===(s=i[2])[0]&&(s=s.substr(1,s.length-2).replace(K,"$1")),o.parameters[a]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},Z=async e=>Object.entries(await e),G=o((async(e,t)=>(await t).map(e))),X=o((async(e,t,r)=>(await r).reduce((async(t,r)=>e(await t,r)),t))),Y=o((async(e,t,r={})=>X((async(t,r)=>await e(r)?t.concat([r]):t),[],t,r))),ee=o((async(e,t)=>{const r=await G(e,t);return(await Promise.all(r)).some((e=>e))})),te=o((async(e,t)=>{const r=await G(e,t);return(await Promise.all(r)).every((e=>e))})),re=o(((e,t)=>e.reduce((async(e,t)=>t(await e)),t))),ne={entries:Z,map:G,filter:Y,reduce:X,some:ee,every:te,pipeline:re,all:e=>Promise.all(e),allValues:e=>re([Z,X((async(e,[t,r])=>(e[t]=await r,e)),{})],e)};ne.entries,ne.map,ne.filter,ne.reduce,ne.some,ne.every,ne.pipeline,ne.all,ne.allValues;var oe={ABSOLUTE:"absolute",PATH_RELATIVE:"pathRelative",ROOT_RELATIVE:"rootRelative",SHORTEST:"shortest"};function ae(e,t){var r=t.removeEmptyQueries&&e.extra.relation.minimumPort;return e.query.string[r?"stripped":"full"]}function ie(e,t){return!e.extra.relation.minimumQuery||t.output===oe.ABSOLUTE||t.output===oe.ROOT_RELATIVE}function se(e,t){var r=t.removeDirectoryIndexes&&e.extra.resourceIsIndex,n=e.extra.relation.minimumResource&&t.output!==oe.ABSOLUTE&&t.output!==oe.ROOT_RELATIVE;return!!e.resource&&!n&&!r}var ue=function(e,t){var r="";return r+=function(e,t){var r="";return(e.extra.relation.maximumHost||t.output===oe.ABSOLUTE)&&(e.extra.relation.minimumScheme&&t.schemeRelative&&t.output!==oe.ABSOLUTE?r+="//":r+=e.scheme+"://"),r}(e,t),r+=function(e,t){return!e.auth||t.removeAuth||!e.extra.relation.maximumHost&&t.output!==oe.ABSOLUTE?"":e.auth+"@"}(e,t),r+=function(e,t){return e.host.full&&(e.extra.relation.maximumAuth||t.output===oe.ABSOLUTE)?e.host.full:""}(e,t),r+=function(e,t){return e.port&&!e.extra.portIsDefault&&e.extra.relation.maximumHost?":"+e.port:""}(e),r+=function(e,t){var r="",n=e.path.absolute.string,o=e.path.relative.string,a=se(e,t);if(e.extra.relation.maximumHost||t.output===oe.ABSOLUTE||t.output===oe.ROOT_RELATIVE)r=n;else if(o.length<=n.length&&t.output===oe.SHORTEST||t.output===oe.PATH_RELATIVE){if(""===(r=o)){var i=ie(e,t)&&!!ae(e,t);e.extra.relation.maximumPath&&!a?r="./":!e.extra.relation.overridesQuery||a||i||(r="./")}}else r=n;return"/"!==r||a||!t.removeRootTrailingSlash||e.extra.relation.minimumPort&&t.output!==oe.ABSOLUTE||(r=""),r}(e,t),r+=function(e,t){return se(e,t)?e.resource:""}(e,t),r+=function(e,t){return ie(e,t)?ae(e,t):""}(e,t),r+=function(e,t){return e.hash?e.hash:""}(e)};var le={clone:function e(t){if(t instanceof Object){var r=t instanceof Array?[]:{};for(var n in t)t.hasOwnProperty(n)&&(r[n]=e(t[n]));return r}return t},isPlainObject:function(e){return!!e&&"object"==typeof e&&e.constructor===Object},shallowMerge:function(e,t){if(e instanceof Object&&t instanceof Object)for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e}};function ce(e,t){return t instanceof Object&&e instanceof Object?t instanceof Array&&e instanceof Array?t.concat(e):le.shallowMerge(e,t):e}var fe=function(e,t){if(le.isPlainObject(e)){var r={};for(var n in t)t.hasOwnProperty(n)&&(void 0!==e[n]?r[n]=ce(e[n],t[n]):r[n]=t[n]);return r}return t};var he=function(e){var t=!(e.scheme||e.auth||e.host.full||e.port),r=t&&!e.path.absolute.string,n=r&&!e.resource,o=n&&!e.query.string.full.length,a=o&&!e.hash;e.extra.hrefInfo.minimumPathOnly=t,e.extra.hrefInfo.minimumResourceOnly=r,e.extra.hrefInfo.minimumQueryOnly=n,e.extra.hrefInfo.minimumHashOnly=o,e.extra.hrefInfo.empty=a};var me=function(e,t){if(t.ignore_www){var r=e.host.full;if(r){var n=r;0===r.indexOf("www.")&&(n=r.substr(4)),e.host.stripped=n}}};function pe(e){if("/"!==e){var t=[];return e.split("/").forEach((function(e){""!==e&&t.push(e)})),t}return[]}var de=function(e,t){var r=e.path.absolute.string;if(r){var n=r.lastIndexOf("/");if(n>-1){if(++n<r.length){var o=r.substr(n);"."!==o&&".."!==o?(e.resource=o,r=r.substr(0,n)):r+="/"}e.path.absolute.string=r,e.path.absolute.array=pe(r)}else"."===r||".."===r?(r+="/",e.path.absolute.string=r,e.path.absolute.array=pe(r)):(e.resource=r,e.path.absolute.string=null);e.extra.resourceIsIndex=function(e,t){var r=!1;return t.directoryIndexes.every((function(t){return t!==e||(r=!0,!1)})),r}(e.resource,t)}};var ye=function(e,t){var r=-1;for(var n in t.defaultPorts)if(n===e.scheme&&t.defaultPorts.hasOwnProperty(n)){r=t.defaultPorts[n];break}r>-1&&(r=r.toString(),null===e.port&&(e.port=r),e.extra.portIsDefault=e.port===r)},ve=Object.prototype.hasOwnProperty;function be(e,t){var r=0,n="";for(var o in e)if(""!==o&&!0===ve.call(e,o)){var a=e[o];""===a&&t||(n+=1==++r?"?":"&",o=encodeURIComponent(o),n+=""!==a?o+"="+encodeURIComponent(a).replace(/%20/g,"+"):o)}return n}var ge=function(e,t){e.query.string.full=be(e.query.object,!1),t.removeEmptyQueries&&(e.query.string.stripped=be(e.query.object,!0))},xe=n.default.parse;var we=function(e,t){return function(e,t){var r=!0;return t.rejectedSchemes.every((function(t){return r=!(0===e.indexOf(t+":"))})),r}(e,t)?(r=xe(e,!0,t.slashesDenoteHost),(n=r.protocol)&&n.indexOf(":")===n.length-1&&(n=n.substr(0,n.length-1)),r.host={full:r.hostname,stripped:null},r.path={absolute:{array:null,string:r.pathname},relative:{array:null,string:null}},r.query={object:r.query,string:{full:null,stripped:null}},r.extra={hrefInfo:{minimumPathOnly:null,minimumResourceOnly:null,minimumQueryOnly:null,minimumHashOnly:null,empty:null,separatorOnlyQuery:"?"===r.search},portIsDefault:null,relation:{maximumScheme:null,maximumAuth:null,maximumHost:null,maximumPort:null,maximumPath:null,maximumResource:null,maximumQuery:null,maximumHash:null,minimumScheme:null,minimumAuth:null,minimumHost:null,minimumPort:null,minimumPath:null,minimumResource:null,minimumQuery:null,minimumHash:null,overridesQuery:null},resourceIsIndex:null,slashes:r.slashes},r.resource=null,r.scheme=n,delete r.hostname,delete r.pathname,delete r.protocol,delete r.search,delete r.slashes,r):{href:e,valid:!1};var r,n};var Oe={join:function(e){return e.length>0?e.join("/")+"/":""},resolveDotSegments:function(e){var t=[];return e.forEach((function(e){".."!==e?"."!==e&&t.push(e):t.length>0&&t.splice(t.length-1,1)})),t}};function Ee(e,t){var r=we(e,t);return!1===r.valid||(me(r,t),ye(r,t),de(r,t),ge(r,t),he(r)),r}var Se={from:function(e,t,r){if(e){var n=Ee(e,t),o=Oe.resolveDotSegments(n.path.absolute.array);return n.path.absolute.array=o,n.path.absolute.string="/"+Oe.join(o),n}return r},to:Ee};var Ie={pathOn:function(e,t,r){var n=e.extra.hrefInfo.minimumQueryOnly,o=e.extra.hrefInfo.minimumHashOnly,a=e.extra.hrefInfo.empty,i=e.extra.relation.minimumPort,s=e.extra.relation.minimumScheme,u=i&&e.path.absolute.string===t.path.absolute.string,l=e.resource===t.resource||!e.resource&&t.extra.resourceIsIndex||r.removeDirectoryIndexes&&e.extra.resourceIsIndex&&!t.resource,c=u&&(l||n||o||a),f=r.removeEmptyQueries?"stripped":"full",h=e.query.string[f],m=t.query.string[f],p=c&&!!h&&h===m||(o||a)&&!e.extra.hrefInfo.separatorOnlyQuery,d=p&&e.hash===t.hash;e.extra.relation.minimumPath=u,e.extra.relation.minimumResource=c,e.extra.relation.minimumQuery=p,e.extra.relation.minimumHash=d,e.extra.relation.maximumPort=!s||s&&!u,e.extra.relation.maximumPath=!s||s&&!c,e.extra.relation.maximumResource=!s||s&&!p,e.extra.relation.maximumQuery=!s||s&&!d,e.extra.relation.maximumHash=!s||s&&!d,e.extra.relation.overridesQuery=u&&e.extra.relation.maximumResource&&!p&&!!m},upToPath:function(e,t,r){var n=e.extra.hrefInfo.minimumPathOnly,o=e.scheme===t.scheme||!e.scheme,a=o&&(e.auth===t.auth||r.removeAuth||n),i=r.ignore_www?"stripped":"full",s=a&&(e.host[i]===t.host[i]||n),u=s&&(e.port===t.port||n);e.extra.relation.minimumScheme=o,e.extra.relation.minimumAuth=a,e.extra.relation.minimumHost=s,e.extra.relation.minimumPort=u,e.extra.relation.maximumScheme=!o||o&&!a,e.extra.relation.maximumAuth=!o||o&&!s,e.extra.relation.maximumHost=!o||o&&!u}};var je=function(e,t,r){Ie.upToPath(e,t,r),e.extra.relation.minimumScheme&&(e.scheme=t.scheme),e.extra.relation.minimumAuth&&(e.auth=t.auth),e.extra.relation.minimumHost&&(e.host=le.clone(t.host)),e.extra.relation.minimumPort&&function(e,t){e.port=t.port,e.extra.portIsDefault=t.extra.portIsDefault}(e,t),e.extra.relation.minimumScheme&&function(e,t){if(e.extra.relation.maximumHost||!e.extra.hrefInfo.minimumResourceOnly){var r=e.path.absolute.array,n="/";r?(e.extra.hrefInfo.minimumPathOnly&&0!==e.path.absolute.string.indexOf("/")&&(r=t.path.absolute.array.concat(r)),r=Oe.resolveDotSegments(r),n+=Oe.join(r)):r=[],e.path.absolute.array=r,e.path.absolute.string=n}else e.path=le.clone(t.path)}(e,t),Ie.pathOn(e,t,r),e.extra.relation.minimumResource&&function(e,t){e.resource=t.resource,e.extra.resourceIsIndex=t.extra.resourceIsIndex}(e,t),e.extra.relation.minimumQuery&&(e.query=le.clone(t.query)),e.extra.relation.minimumHash&&(e.hash=t.hash)};var Pe=function(e,t,r){if(e.extra.relation.minimumScheme){var n=(o=e.path.absolute.array,a=t.path.absolute.array,i=[],s=!0,u=-1,a.forEach((function(e,t){s&&(o[t]!==e?s=!1:u=t),s||i.push("..")})),o.forEach((function(e,t){t>u&&i.push(e)})),i);e.path.relative.array=n,e.path.relative.string=Oe.join(n)}var o,a,i,s,u};var Te=function(e,t,r){return je(t,e,r),Pe(t,e),t};function Ae(e,t){this.options=fe(t,{defaultPorts:{ftp:21,http:80,https:443},directoryIndexes:["index.html"],ignore_www:!1,output:Ae.SHORTEST,rejectedSchemes:["data","javascript","mailto"],removeAuth:!1,removeDirectoryIndexes:!0,removeEmptyQueries:!1,removeRootTrailingSlash:!0,schemeRelative:!0,site:void 0,slashesDenoteHost:!0}),this.from=Se.from(e,this.options,null)}Ae.prototype.relate=function(e,t,r){if(le.isPlainObject(t)?(r=t,t=e,e=null):t||(t=e,e=null),r=fe(r,this.options),e=e||r.site,!(e=Se.from(e,r,this.from))||!e.href)throw new Error("from value not defined.");if(e.extra.hrefInfo.minimumPathOnly)throw new Error("from value supplied is not absolute: "+e.href);return!1===(t=Se.to(t,r)).valid?t.href:(t=Te(e,t,r),t=ue(t,r))},Ae.relate=function(e,t,r){return(new Ae).relate(e,t,r)},le.shallowMerge(Ae,oe);var Re=Ae,$e=fetch;const{jsonTypeOf:Ve,splitUrl:ke,safeResolveUrl:Le}=p,He={},Ue={},qe=(e,t)=>{const r=e in Ue?Ue[e]:e;if(r in He)return He[r][t]},De={},_e={},Ce=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=ke(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=qe(n,"baseToken"),a=qe(n,"anchorToken"),i=ke(t)[0];if(!i&&!ke(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const s=Le(i,e[o]||""),[u,l]=ke(s);delete e[o],l&&o===a&&(e[a]=a!==o?encodeURI(l):`#${encodeURI(l)}`),i&&(_e[i]=u);const c={},f=qe(n,"recursiveAnchorToken");let h;!0===e[f]&&(c[""]=`${u}#`,e[a]="",delete e[f]);const m=qe(n,"vocabularyToken");Ve(e[m],"object")?(Ue[u]=n,h=e[m],delete e[m]):(Ue[u]=n,h={[n]:!0});const p={"":""};return De[u]={id:u,schemaVersion:n,schema:Qe(e,u,n,j.nil,p,c),anchors:p,dynamicAnchors:c,vocabulary:h,validated:!1},u},Qe=(e,t,r,n,o,a)=>{if(Ve(e,"object")){const i="string"==typeof e.$schema?ke(e.$schema)[0]:r,s=qe(i,"embeddedToken"),u=qe(i,"anchorToken");if("string"==typeof e[s]&&(s!==u||"#"!==e[s][0])){const n=Le(t,e[s]);return e[s]=n,Ce(e,n,r),A.cons(e[s],e)}const l=qe(r,"anchorToken"),c=qe(r,"dynamicAnchorToken");"string"==typeof e[c]&&(a[e[c]]=`${t}#${encodeURI(n)}`,o[e[c]]=n,delete e[c]);const f=qe(r,"embeddedToken");if("string"==typeof e[l]){const t=l!==f?e[l]:e[l].slice(1);o[t]=n,delete e[l]}const h=qe(r,"jrefToken");if("string"==typeof e[h])return A.cons(e[h],e);for(const i in e)e[i]=Qe(e[i],t,r,j.append(i,n),o,a);return e}return Array.isArray(e)?e.map(((e,i)=>Qe(e,t,r,j.append(i,n),o,a))):e},ze=e=>De[_e[e]]||De[e],Be=Object.freeze({id:"",schemaVersion:void 0,vocabulary:{},pointer:j.nil,schema:void 0,value:void 0,anchors:{},dynamicAnchors:{},validated:!0}),Ke=async(e,t=Be)=>{const r=Le(Je(t),e),[n,o]=ke(r);if(!(e=>e in De||e in _e)(n)){const e=await $e(n,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error(`Failed to retrieve schema with id: ${n}`);if(e.headers.has("content-type")){const t=W.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${n} is not a schema. Found a document with media type: ${t}`)}Ce(await e.json(),n)}const a=ze(n),i="/"!==o[0]?Me(a,o):o,s=Object.freeze({...a,pointer:i,value:j.get(i,a.schema)});return Ne(s)},Ne=e=>A.isReference(e.value)?Ke(A.href(e.value),e):e,Me=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},Je=e=>`${e.id}#${encodeURI(e.pointer)}`,Fe=e=>A.isReference(e.value)?A.value(e.value):e.value,We=(e,t)=>{const r=ze(t.id),n=Object.freeze({...t,pointer:j.append(e,t.pointer),value:Fe(t)[e],validated:r.validated});return Ne(n)},Ze=o(((e,t)=>ne.pipeline([Fe,ne.map((async(r,n)=>e(await We(n,t),n))),ne.all],t))),Ge={parentId:"",parentDialect:"",includeEmbedded:!0},Xe=(e,t)=>t.startsWith("file://")?""===e?"":Re.relate(e,t):t;var Ye={setConfig:(e,t,r)=>{He[e]||(He[e]={}),He[e][t]=r},getConfig:qe,add:Ce,get:Ke,markValidated:e=>{De[e].validated=!0},uri:Je,value:Fe,getAnchorPointer:Me,typeOf:(e,t)=>Ve(Fe(e),t),has:(e,t)=>e in Fe(t),step:We,keys:e=>Object.keys(Fe(e)),entries:e=>ne.pipeline([Fe,Object.keys,ne.map((async t=>[t,await We(t,e)])),ne.all],e),map:Ze,length:e=>Fe(e).length,toSchema:(e,t={})=>{const r={...Ge,...t},n=JSON.parse(JSON.stringify(e.schema,((t,n)=>{if(!A.isReference(n))return n;const o=A.value(n),a=o.$schema||e.schemaVersion,i=qe(a,"embeddedToken");return!r.includeEmbedded&&i in o?void 0:A.value(n)}))),o=qe(e.schemaVersion,"dynamicAnchorToken");Object.entries(e.dynamicAnchors).forEach((([e,t])=>{const r=ke(t)[1];j.assign(r,n,{[o]:e,...j.get(r,n)})}));const a=qe(e.schemaVersion,"anchorToken");Object.entries(e.anchors).filter((([e])=>""!==e)).forEach((([e,t])=>{j.assign(t,n,{[a]:e,...j.get(t,n)})}));const i=qe(e.schemaVersion,"baseToken"),s=Xe(r.parentId,e.id),u=r.parentDialect===e.schemaVersion?"":e.schemaVersion;return{...s&&{[i]:s},...u&&{$schema:u},...n}}};Ye.setConfig,Ye.getConfig,Ye.add,Ye.get,Ye.markValidated,Ye.uri,Ye.value,Ye.getAnchorPointer,Ye.typeOf,Ye.has,Ye.step,Ye.keys,Ye.entries,Ye.map,Ye.length,Ye.toSchema;class et extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var tt=et;const{splitUrl:rt}=p,nt="FLAG",ot="BASIC",at="DETAILED",it="VERBOSE";let st=at,ut=!0;const lt=async e=>{const t={metaData:{}};return{ast:t,schemaUri:await vt(e,t)}},ct=o((({ast:e,schemaUri:t},r,n=nt)=>{if(![nt,ot,at,it].includes(n))throw Error(`The '${n}' error format is not supported`);const o=[],a=i.subscribe("result",ft(n,o));return gt(t,r,e,{}),i.unsubscribe(a),o[0]})),ft=(e,t)=>{const r=[];return(n,o)=>{if("result"===n){const{keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:a}=o,i={keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:a,errors:[]};r.push(i)}else if("result.start"===n)r.push(n);else if("result.end"===n){const n=r.pop();for(;"result.start"!==r[r.length-1];){const t=r.pop(),o=[t];e===ot&&(o.push(...t.errors),delete t.errors),(e===it||e!==nt&&!t.valid)&&n.errors.unshift(...o)}r[r.length-1]=n,t[0]=n}}},ht={},mt=e=>ht[e],pt=e=>e in ht,dt={},yt={},vt=async(e,t)=>{if(e=await bt(e),!pt(`${e.schemaVersion}#validate`)){const t=await Ye.get(e.schemaVersion);(Ye.getConfig(t.id,"mandatoryVocabularies")||[]).forEach((e=>{if(!t.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)})),Object.entries(t.vocabulary).forEach((([e,r])=>{if(e in dt)Object.entries(dt[e]).forEach((([e,r])=>{((e,t)=>{ht[e]={collectEvaluatedItems:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&new Set,collectEvaluatedProperties:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&[],...t}})(`${t.id}#${e}`,r)}));else if(r)throw Error(`Missing required vocabulary: ${e}`)}))}if(ut&&!e.validated){if(Ye.markValidated(e.id),!(e.schemaVersion in yt)){const t=await Ye.get(e.schemaVersion),r=await lt(t);yt[t.id]=ct(r)}const t=C.cons(e.schema,e.id),r=yt[e.schemaVersion](t,st);if(!r.valid)throw new tt(r)}return e.id in t.metaData||(t.metaData[e.id]={id:e.id,dynamicAnchors:e.dynamicAnchors,anchors:e.anchors}),mt(`${e.schemaVersion}#validate`).compile(e,t)},bt=async e=>Ye.typeOf(e,"string")?bt(await Ye.get(Ye.value(e),e)):e,gt=(e,t,r,n)=>{const o=xt(e,r),a=rt(e)[0];return mt(o).interpret(e,t,r,{...r.metaData[a].dynamicAnchors,...n})},xt=(e,t)=>{if(!(e in t))throw Error(`No schema found at ${e}`);return t[e][0]};var wt={validate:async(e,t,r)=>{const n=await lt(e),o=(e,t)=>ct(n,C.cons(e),t);return void 0===t?o:o(t,r)},compile:lt,interpret:ct,setMetaOutputFormat:e=>{st=e},setShouldMetaValidate:e=>{ut=e},FLAG:nt,BASIC:ot,DETAILED:at,VERBOSE:it,add:(e,t="",r="")=>{const n=Ye.add(e,t,r);delete yt[n]},getKeyword:mt,hasKeyword:pt,defineVocabulary:(e,t)=>{dt[e]=t},compileSchema:vt,interpretSchema:gt,collectEvaluatedProperties:(e,t,r,n,o)=>{const a=xt(e,r);return mt(a).collectEvaluatedProperties(e,t,r,n,o)},collectEvaluatedItems:(e,t,r,n,o)=>{const a=xt(e,r);return mt(a).collectEvaluatedItems(e,t,r,n,o)}};var Ot={compile:e=>Ye.value(e),interpret:()=>!0};var Et={compile:async(e,t)=>{const r=Ye.uri(e);if(!(r in t)){t[r]=!1;const n=Ye.value(e);if(!["object","boolean"].includes(typeof n))throw Error(`No schema found at '${Ye.uri(e)}'`);t[r]=[`${e.schemaVersion}#validate`,Ye.uri(e),"boolean"==typeof n?n:await ne.pipeline([Ye.entries,ne.map((([t,r])=>[`${e.schemaVersion}#${t}`,r])),ne.filter((([t])=>wt.hasKeyword(t)&&t!==`${e.schemaVersion}#validate`)),ne.map((async([r,n])=>{const o=await wt.getKeyword(r).compile(n,t,e);return[r,Ye.uri(n),o]})),ne.all],e)]}return r},interpret:(e,t,r,n)=>{const[o,a,s]=r[e];i.publishSync("result.start");const u="boolean"==typeof s?s:s.every((([e,o,a])=>{i.publishSync("result.start");const s=wt.getKeyword(e).interpret(a,t,r,n);return i.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:C.uri(t),valid:s,ast:a}),i.publishSync("result.end"),s}));return i.publishSync("result",{keyword:o,absoluteKeywordLocation:a,instanceLocation:C.uri(t),valid:u,ast:e}),i.publishSync("result.end"),u},collectEvaluatedProperties:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&[]:a.filter((([e])=>!o||!e.endsWith("#unevaluatedProperties"))).reduce(((e,[o,,a])=>{const i=e&&wt.getKeyword(o).collectEvaluatedProperties(a,t,r,n);return!1!==i&&[...e,...i]}),[])},collectEvaluatedItems:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&new Set:a.filter((([e])=>!o||!e.endsWith("#unevaluatedItems"))).reduce(((e,[o,,a])=>{const i=!1!==e&&wt.getKeyword(o).collectEvaluatedItems(a,t,r,n);return!1!==i&&new Set([...e,...i])}),new Set)}},St={metaData:Ot,validate:Et},It={Core:wt,Schema:Ye,Instance:C,Reference:A,Keywords:St,InvalidSchemaError:tt},jt=It.Core,Pt=It.Schema,Tt=It.Instance,At=It.Reference,Rt=It.Keywords,$t=It.InvalidSchemaError;e.Core=jt,e.Instance=Tt,e.InvalidSchemaError=$t,e.Keywords=Rt,e.Reference=At,e.Schema=Pt,e.default=It,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=json-schema-core-umd.min.js.map |
@@ -40,2 +40,3 @@ import type { JsonType } from "./common"; | ||
length: (doc: SchemaDocument) => number; | ||
toSchema: (doc: SchemaDocument, options: ToSchemaOptions) => SchemaObject; | ||
}; | ||
@@ -46,2 +47,8 @@ | ||
export type ToSchemaOptions = { | ||
parentId?: string; | ||
parentDialect?: string; | ||
includeEmbedded?: boolean; | ||
}; | ||
export type SchemaDocument<A extends SchemaFragment = SchemaFragment> = { | ||
@@ -48,0 +55,0 @@ id: string; |
@@ -5,2 +5,3 @@ const contentTypeParser = require("content-type"); | ||
const JsonPointer = require("@hyperjump/json-pointer"); | ||
const RelateUrl = require("relateurl"); | ||
const { jsonTypeOf, splitUrl, safeResolveUrl } = require("./common"); | ||
@@ -236,6 +237,68 @@ const fetch = require("./fetch"); | ||
const toSchemaDefaultOptions = { | ||
parentId: "", | ||
parentDialect: "", | ||
includeEmbedded: true | ||
}; | ||
const toSchema = (schemaDoc, options = {}) => { | ||
const fullOptions = { ...toSchemaDefaultOptions, ...options }; | ||
const schema = JSON.parse(JSON.stringify(schemaDoc.schema, (key, value) => { | ||
if (!Reference.isReference(value)) { | ||
return value; | ||
} | ||
const refValue = Reference.value(value); | ||
const embeddedDialect = refValue.$schema || schemaDoc.schemaVersion; | ||
const embeddedToken = getConfig(embeddedDialect, "embeddedToken"); | ||
if (!fullOptions.includeEmbedded && embeddedToken in refValue) { | ||
return; | ||
} else { | ||
return Reference.value(value); | ||
} | ||
})); | ||
const dynamicAnchorToken = getConfig(schemaDoc.schemaVersion, "dynamicAnchorToken"); | ||
Object.entries(schemaDoc.dynamicAnchors) | ||
.forEach(([anchor, uri]) => { | ||
const pointer = splitUrl(uri)[1]; | ||
JsonPointer.assign(pointer, schema, { | ||
[dynamicAnchorToken]: anchor, | ||
...JsonPointer.get(pointer, schema) | ||
}); | ||
}); | ||
const anchorToken = getConfig(schemaDoc.schemaVersion, "anchorToken"); | ||
Object.entries(schemaDoc.anchors) | ||
.filter(([anchor]) => anchor !== "") | ||
.forEach(([anchor, pointer]) => { | ||
JsonPointer.assign(pointer, schema, { | ||
[anchorToken]: anchor, | ||
...JsonPointer.get(pointer, schema) | ||
}); | ||
}); | ||
const baseToken = getConfig(schemaDoc.schemaVersion, "baseToken"); | ||
const id = relativeUri(fullOptions.parentId, schemaDoc.id); | ||
const dialect = fullOptions.parentDialect === schemaDoc.schemaVersion ? "" : schemaDoc.schemaVersion; | ||
return { | ||
...(id && { [baseToken]: id }), | ||
...(dialect && { $schema: dialect }), | ||
...schema | ||
}; | ||
}; | ||
const relativeUri = (from, to) => { | ||
if (to.startsWith("file://")) { | ||
return from === "" ? "" : RelateUrl.relate(from, to); | ||
} else { | ||
return to; | ||
} | ||
}; | ||
module.exports = { | ||
setConfig, getConfig, | ||
add, get, markValidated, | ||
uri, value, getAnchorPointer, typeOf, has, step, keys, entries, map, length | ||
uri, value, getAnchorPointer, typeOf, has, step, keys, entries, map, length, | ||
toSchema | ||
}; |
{ | ||
"name": "@hyperjump/json-schema-core", | ||
"version": "0.22.3", | ||
"version": "0.23.0", | ||
"description": "A framework for building JSON Schema tools", | ||
@@ -61,4 +61,5 @@ "main": "lib/index.js", | ||
"pubsub-js": "^1.9.1", | ||
"relateurl": "^0.2.7", | ||
"url-resolve-browser": "^1.2.0" | ||
} | ||
} |
@@ -88,3 +88,15 @@ # Hyperjump - JSON Schema Core | ||
Similar to `Array.prototype.length`. | ||
* **Schema.toSchema**: (doc: SDoc, options: ToSchemaOptions) => object | ||
Convert an SDoc back to a schema. | ||
* **ToSchemaOptions**: (doc: SDoc, options: ToSchemaOptions) => object | ||
parentId: string (default: "") -- We never want to include local file paths | ||
when using file based URIs, so this option allows us to to create relative | ||
URIs based on this URI. | ||
parentSchema: string (default: "") -- If this value matches the dialect of | ||
the schema, the `$schema` keyword will be omitted. | ||
includeEmbedded: boolean (default: true) -- If false, embedded schemas will | ||
be removed and only the root schema resource will be returned. | ||
### Schema Identification | ||
@@ -91,0 +103,0 @@ JSC requires that all schemas are identified by at least one URI. There are two |
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
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
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
2487267
15534
755
7
4
+ Addedrelateurl@^0.2.7
+ Addedrelateurl@0.2.7(transitive)