Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@hyperjump/json-schema-core

Package Overview
Dependencies
Maintainers
1
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hyperjump/json-schema-core - npm Package Compare versions

Comparing version 0.16.1 to 0.17.0

83

dist/json-schema-core-amd.js

@@ -59,16 +59,8 @@ define(['exports'], function (exports) { 'use strict';

(function (root, factory){
var PubSub = {};
root.PubSub = PubSub;
var define = root.define;
factory(PubSub);
// AMD support
if (typeof define === 'function' && define.amd){
define(function() { return PubSub; });
// CommonJS and Node.js module support
} else {
// CommonJS and Node.js module support
{
if (module !== undefined && module.exports) {

@@ -79,3 +71,3 @@ exports = module.exports = PubSub; // Node.js specific `module.exports`

module.exports = exports = PubSub; // CommonJS
}
}

@@ -85,3 +77,4 @@ }(( typeof window === 'object' && window ) || commonjsGlobal, function (PubSub){

var messages = {},
lastUid = -1;
lastUid = -1,
ALL_SUBSCRIBING_MSG = '*';

@@ -153,8 +146,17 @@ function hasKeys(obj){

}
deliverMessage(message, ALL_SUBSCRIBING_MSG, data, immediateExceptions);
};
}
function hasDirectSubscribersFor( message ) {
var topic = String( message ),
found = Boolean(messages.hasOwnProperty( topic ) && hasKeys(messages[topic]));
return found;
}
function messageHasSubscribers( message ){
var topic = String( message ),
found = Boolean(messages.hasOwnProperty( topic ) && hasKeys(messages[topic])),
found = hasDirectSubscribersFor(topic) || hasDirectSubscribersFor(ALL_SUBSCRIBING_MSG),
position = topic.lastIndexOf( '.' );

@@ -165,3 +167,3 @@

position = topic.lastIndexOf( '.' );
found = Boolean(messages.hasOwnProperty( topic ) && hasKeys(messages[topic]));
found = hasDirectSubscribersFor(topic);
}

@@ -243,2 +245,6 @@

PubSub.subscribeAll = function( func ){
return PubSub.subscribe(ALL_SUBSCRIBING_MSG, func);
};
/**

@@ -1402,27 +1408,30 @@ * Subscribes the passed function to the passed message once

return (message, keywordResult) => {
const { keyword, absoluteKeywordLocation, instanceLocation, valid } = keywordResult;
const result = { keyword, absoluteKeywordLocation, instanceLocation, valid, errors: [] };
while (resultStack.length > 0 && isChild(resultStack[resultStack.length - 1], result)) {
const topResult = resultStack.pop();
let errors = [];
if (outputFormat === BASIC) {
errors = topResult.errors;
delete topResult.errors;
if (message === "result") {
const { keyword, absoluteKeywordLocation, instanceLocation, valid } = keywordResult;
const result = { keyword, absoluteKeywordLocation, instanceLocation, valid, errors: [] };
resultStack.push(result);
} else if (message === "result.start") {
resultStack.push(message);
} else if (message === "result.end") {
const result = resultStack.pop();
while (resultStack[resultStack.length - 1] !== "result.start") {
const topResult = resultStack.pop();
const errors = [topResult];
if (outputFormat === BASIC) {
errors.push(...topResult.errors);
delete topResult.errors;
}
if (outputFormat === VERBOSE || (outputFormat !== FLAG && !topResult.valid)) {
result.errors.unshift(...errors);
}
}
result.errors.unshift(topResult, ...errors);
}
resultStack[resultStack.length - 1] = result;
if (outputFormat === VERBOSE || (outputFormat !== FLAG && !result.valid)) {
resultStack.push(result);
output[0] = result;
}
output[0] = result;
};
};
const isChild = (topResult, nextResult) => {
return topResult.absoluteKeywordLocation.startsWith(nextResult.absoluteKeywordLocation)
|| nextResult.keyword.endsWith("#validate") && topResult.instanceLocation === nextResult.instanceLocation;
};
const setMetaOutputFormat = (format) => {

@@ -1552,2 +1561,4 @@ metaOutputFormat = format;

}
return url;
};

@@ -1558,4 +1569,6 @@

pubsub.publishSync("result.start");
const isValid = typeof nodes === "boolean" ? nodes : nodes
.every(([keywordId, schemaUrl, keywordValue]) => {
pubsub.publishSync("result.start");
const isValid = core.getKeyword(keywordId).interpret(keywordValue, instance$1, ast);

@@ -1570,2 +1583,3 @@

});
pubsub.publishSync("result.end");
return isValid;

@@ -1581,2 +1595,3 @@ });

});
pubsub.publishSync("result.end");
return isValid;

@@ -1583,0 +1598,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){!function(r,n){var o={};r.PubSub=o;var a=r.define;!function(e){var t={},r=-1;function n(e){var t;for(t in e)if(e.hasOwnProperty(t))return!0;return!1}function o(e){return function(){throw e}}function a(e,t,r){try{e(t,r)}catch(e){setTimeout(o(e),0)}}function i(e,t,r){e(t,r)}function s(e,r,n,o){var s,c=t[r],u=o?i:a;if(t.hasOwnProperty(r))for(s in c)c.hasOwnProperty(s)&&u(c[s],e,n)}function c(e,t,r){return function(){var n=String(e),o=n.lastIndexOf(".");for(s(e,e,t,r);-1!==o;)o=(n=n.substr(0,o)).lastIndexOf("."),s(e,n,t,r)}}function u(e){for(var r=String(e),o=Boolean(t.hasOwnProperty(r)&&n(t[r])),a=r.lastIndexOf(".");!o&&-1!==a;)a=(r=r.substr(0,a)).lastIndexOf("."),o=Boolean(t.hasOwnProperty(r)&&n(t[r]));return o}function l(e,t,r,n){var o=c(e="symbol"==typeof e?e.toString():e,t,n);return!!u(e)&&(!0===r?o():setTimeout(o,0),!0)}e.publish=function(t,r){return l(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return l(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,t.hasOwnProperty(e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},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)t.hasOwnProperty(r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n=0;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n++;return n},e.getSubscriptions=function(e){var r,n=[];for(r in t)t.hasOwnProperty(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(t.hasOwnProperty(r)&&0===r.indexOf(e))return!0;return!1},s="string"==typeof r&&(t.hasOwnProperty(r)||i(r)),c=!s&&"string"==typeof r,u="function"==typeof r,l=!1;if(!s){for(n in t)if(t.hasOwnProperty(n)){if(o=t[n],c&&o[r]){delete o[r],l=r;break}if(u)for(a in o)o.hasOwnProperty(a)&&o[a]===r&&(delete o[a],l=!0)}return l}e.clearSubscriptions(r)}}(o),"function"==typeof a&&a.amd?a((function(){return o})):(void 0!==e&&e.exports&&(t=e.exports=o),t.PubSub=o,e.exports=t=o)}("object"==typeof window&&window||r)}(n={exports:{}},n.exports),n.exports);o.PubSub;const a=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(d)},i=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:i(e,h(t,o,n),r,l(o,n))}}if(Array.isArray(t)){const n=[...t];return n[p(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:h(t,e[0],n)},s=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||y(t)){const o=e.shift();s(e,h(t,o,n),r,l(o,n))}else{t[p(t,e[0])]=r}},c=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=h(t,n,r);return{...t,[n]:c(e,o,l(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 h(t,e[0],r)}},u=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=h(t,n,r);u(e,o,l(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:h(t,e[0],r)},l=t((e,t)=>t+"/"+f(e)),f=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),d=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),p=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,h=(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(y(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[p(e,t)]},y=e=>null===e||"object"!=typeof e;var m={nil:"",append:l,get:(e,t)=>{const r=a(e),n=e=>r.reduce(([e,t],r)=>[h(e,r,t),l(r,t)],[e,""])[0];return void 0===t?n:n(t)},set:(e,r,n)=>{const o=a(e),s=t((e,t)=>i(o,e,t,""));return void 0===r?s:s(r,n)},assign:(e,r,n)=>{const o=a(e),i=t((e,t)=>s(o,e,t,""));return void 0===r?i:i(r,n)},unset:(e,t)=>{const r=a(e),n=e=>c(r,e,"");return void 0===t?n:n(t)},delete:(e,t)=>{const r=a(e),n=e=>u(r,e,"");return void 0===t?n:n(t)}};const v={null:e=>null===e,boolean:e=>"boolean"==typeof e,object:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,array:e=>Array.isArray(e),number:e=>"number"==typeof e,integer:e=>Number.isInteger(e),string:e=>"string"==typeof e};var b={jsonTypeOf:(e,t)=>v[t](e),splitUrl: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)]}};const w=Symbol("$__value"),g=Symbol("$__href"),O=Symbol("$__isDynamic");var E=(e,t,r=!1)=>Object.freeze({[g]:e,[w]:t,[O]:r}),j=e=>e&&void 0!==e[g],$=e=>e[g],A=e=>e[w],P=e=>e[O];const{jsonTypeOf:x}=b,S=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),T=e=>j(e.value)?A(e.value):e.value,I=t((e,t)=>x(T(e),t)),k=(e,t)=>Object.freeze({...t,pointer:m.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))),L=t((e,t)=>T(t).map((e,r,n,o)=>k(r,t)).filter((t,r,n,o)=>e(t,r,n,o))),K=t((e,t,r)=>T(r).reduce((t,n,o)=>e(t,k(o,r),o),t)),z=t((e,t)=>T(t).every((r,n,o,a)=>e(k(n,t),n,o,a))),_=t((e,t)=>T(t).some((r,n,o,a)=>e(k(n,t),n,o,a)));var C={cons:(e,t="")=>Object.freeze({...S,id:t,instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value: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:L,reduce:K,every:z,some:_,length:e=>T(e).length},U=/; *([!#$%&'*+.^_`|~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]+$/,R=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,B=/\\([\u000b\u0020-\u00ff])/g,D=/([\\"])/g,W=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
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(e.hasOwnProperty(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],u=o?s:i;if(t.hasOwnProperty(r))for(a in c)c.hasOwnProperty(a)&&u(c[a],e,n)}function u(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 l(e){var r=String(e);return Boolean(t.hasOwnProperty(r)&&o(t[r]))}function f(e){for(var t=String(e),r=l(t)||l(n),o=t.lastIndexOf(".");!r&&-1!==o;)o=(t=t.substr(0,o)).lastIndexOf("."),r=l(t);return r}function d(e,t,r,n){var o=u(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 d(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return d(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,t.hasOwnProperty(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)t.hasOwnProperty(r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n=0;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n++;return n},e.getSubscriptions=function(e){var r,n=[];for(r in t)t.hasOwnProperty(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(t.hasOwnProperty(r)&&0===r.indexOf(e))return!0;return!1},s="string"==typeof r&&(t.hasOwnProperty(r)||i(r)),c=!s&&"string"==typeof r,u="function"==typeof r,l=!1;if(!s){for(n in t)if(t.hasOwnProperty(n)){if(o=t[n],c&&o[r]){delete o[r],l=r;break}if(u)for(a in o)o.hasOwnProperty(a)&&o[a]===r&&(delete o[a],l=!0)}return l}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;const a=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(d)},i=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:i(e,h(t,o,n),r,l(o,n))}}if(Array.isArray(t)){const n=[...t];return n[p(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:h(t,e[0],n)},s=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||y(t)){const o=e.shift();s(e,h(t,o,n),r,l(o,n))}else{t[p(t,e[0])]=r}},c=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=h(t,n,r);return{...t,[n]:c(e,o,l(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 h(t,e[0],r)}},u=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=h(t,n,r);u(e,o,l(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:h(t,e[0],r)},l=t(((e,t)=>t+"/"+f(e))),f=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),d=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),p=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,h=(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(y(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[p(e,t)]},y=e=>null===e||"object"!=typeof e;var m={nil:"",append:l,get:(e,t)=>{const r=a(e),n=e=>r.reduce((([e,t],r)=>[h(e,r,t),l(r,t)]),[e,""])[0];return void 0===t?n:n(t)},set:(e,r,n)=>{const o=a(e),s=t(((e,t)=>i(o,e,t,"")));return void 0===r?s:s(r,n)},assign:(e,r,n)=>{const o=a(e),i=t(((e,t)=>s(o,e,t,"")));return void 0===r?i:i(r,n)},unset:(e,t)=>{const r=a(e),n=e=>c(r,e,"");return void 0===t?n:n(t)},delete:(e,t)=>{const r=a(e),n=e=>u(r,e,"");return void 0===t?n:n(t)}};const v={null:e=>null===e,boolean:e=>"boolean"==typeof e,object:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,array:e=>Array.isArray(e),number:e=>"number"==typeof e,integer:e=>Number.isInteger(e),string:e=>"string"==typeof e};var b={jsonTypeOf:(e,t)=>v[t](e),splitUrl: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)]}};const w=Symbol("$__value"),g=Symbol("$__href"),O=Symbol("$__isDynamic");var E=(e,t,r=!1)=>Object.freeze({[g]:e,[w]:t,[O]:r}),j=e=>e&&void 0!==e[g],S=e=>e[g],$=e=>e[w],A=e=>e[O];const{jsonTypeOf:x}=b,P=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),T=e=>j(e.value)?$(e.value):e.value,I=t(((e,t)=>x(T(e),t))),k=(e,t)=>Object.freeze({...t,pointer:m.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))))),z=t(((e,t)=>T(t).map(((e,r,n,o)=>k(r,t))).filter(((t,r,n,o)=>e(t,r,n,o))))),K=t(((e,t,r)=>T(r).reduce(((t,n,o)=>e(t,k(o,r),o)),t))),L=t(((e,t)=>T(t).every(((r,n,o,a)=>e(k(n,t),n,o,a))))),_=t(((e,t)=>T(t).some(((r,n,o,a)=>e(k(n,t),n,o,a)))));var C={cons:(e,t="")=>Object.freeze({...P,id:t,instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value: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:z,reduce:K,every:L,some:_,length:e=>T(e).length},U=/; *([!#$%&'*+.^_`|~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]+$/,R=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,D=/\\([\u000b\u0020-\u00ff])/g,B=/([\\"])/g,F=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
/*!

@@ -6,3 +6,3 @@ * content-type

* MIT Licensed
*/function F(e){var t=String(e);if(R.test(t))return t;if(t.length>0&&!q.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(D,"\\$1")+'"'}function M(e){this.parameters=Object.create(null),this.type=e}var N={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!W.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],!R.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(!W.test(n))throw new TypeError("invalid media type");var o=new M(n.toLowerCase());if(-1!==r){var a,i,s;for(U.lastIndex=r;i=U.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}},Z=async e=>Object.entries(await e),J=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 J(e,t);return(await Promise.all(r)).some(e=>e)}),X=t(async(e,t)=>{const r=await J(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:Z,map:J,filter:H,reduce:G,some:Q,every:X,pipeline:Y,all:e=>Promise.all(e),allValues:e=>Y([Z,G(async(e,[t,r])=>(e[t]=await r,e),{})],e)},te=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(oe.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)?re(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+ne(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=ne(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:re(e)}};function re(e){return e+("/"===e[e.length-1]?"":"/")}function ne(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 oe=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");var ae=fetch;const{jsonTypeOf:ie,splitUrl:se}=b,ce={},ue={},le=(e,t)=>{const r=e in ue?ue[e]:e;if(r in ce)return ce[r][t]},fe={},de={},pe=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=se(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=le(n,"baseToken"),a=le(n,"anchorToken"),i=se(t)[0];if(!i&&!se(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const s=we(i,e[o]||""),[c,u]=se(s);delete e[o],u&&o===a&&(e[a]=a!==o?encodeURI(u):"#"+encodeURI(u)),i&&(de[i]=c);const l={},f=le(n,"recursiveAnchorToken");let d;!0===e[f]&&(l["#"]=c,e[a]="",delete e[f]);const p=le(n,"vocabularyToken");ie(e[p],"object")?(ue[c]=n,d=e[p],delete e[p]):(ue[c]=n,d={[n]:!0});const h={};fe[c]={id:c,schemaVersion:n,schema:he(e,c,n,m.nil,h,l),anchors:h,dynamicAnchors:l,vocabulary:d,validated:!1}},he=(e,t,r,n,o,a)=>{if(ie(e,"object")){const i="string"==typeof e.$schema?se(e.$schema)[0]:r,s=le(i,"embeddedToken"),c=le(i,"anchorToken");if("string"==typeof e[s]&&(s!==c||"#"!==e[s][0])){const n=we(t,e[s]);return e[s]=n,pe(e,n,r),E(e[s],e)}const u=le(r,"anchorToken"),l=le(r,"dynamicAnchorToken");"string"==typeof e[l]&&(a["#"+e[l]]=t,e[u]=e[l],delete e[l]);const f=le(r,"embeddedToken");if("string"==typeof e[u]){const t=u!==f?e[u]:e[u].slice(1);o[t]=n,delete e[u]}const d=le(r,"jrefToken");if("string"==typeof e[d])return E(e[d],e);for(let i in e)e[i]=he(e[i],t,r,m.append(i,n),o,a);const p=le(r,"jsrefToken");"string"==typeof e[p]&&(e[p]=E(e[p],e[p]));const h=le(r,"dynamicJsrefToken");return"string"==typeof e[h]&&(e[h]=E(e[h],e[h],!0)),e}return Array.isArray(e)?e.map((e,i)=>he(e,t,r,m.append(i,n),o,a)):e},ye=e=>fe[de[e]]||fe[e],me=Object.freeze({id:"",schemaVersion:void 0,pointer:"",schema:void 0,dynamicAnchors:{}}),ve=async(e,t=me,r=!1)=>{const n=r&&t.dynamicAnchors[e]?t.dynamicAnchors[e]:Ee(t),o=we(n,e),[a,i]=se(o);if(!(e=>e in fe||e in de)(a)){const e=await ae(a,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error("Failed to retrieve schema with id: "+a);if(e.headers.has("content-type")){const t=N.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${a} is not a schema. Found a document with media type: ${t}`)}pe(await e.json(),a)}const s=ye(a),c=i&&"/"!==i[0]?Oe(s,i):i,u=Object.freeze({id:s.id,schemaVersion:s.schemaVersion,vocabulary:s.vocabulary,pointer:c,schema:s.schema,value:m.get(c,s.schema),dynamicAnchors:{...s.dynamicAnchors,...t.dynamicAnchors},validated:s.validated});return be(u)},be=e=>j(e.value)?ve($(e.value),e,P(e.value)):e,we=(e,t)=>{const r=te(e,t),n=se(e)[0];if(n&&"file"===ge(r)&&"file"!==ge(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},ge=e=>{const t=e.match(/^(.+):\/\//);return t?t[1]:""},Oe=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},Ee=e=>`${e.id}#${encodeURI(e.pointer)}`,je=e=>j(e.value)?A(e.value):e.value,$e=(e,t)=>{const r=ye(t.id),n=Object.freeze({id:t.id,schemaVersion:t.schemaVersion,vocabulary:t.vocabulary,pointer:m.append(e,t.pointer),schema:r.schema,value:je(t)[e],dynamicAnchors:t.dynamicAnchors,validated:r.validated});return be(n)},Ae=t((e,t)=>ee.pipeline([je,ee.map(async(r,n)=>e(await $e(n,t),n)),ee.all],t));var Pe={setConfig:(e,t,r)=>{ce[e]||(ce[e]={}),ce[e][t]=r},getConfig:le,add:pe,get:ve,markValidated:e=>{fe[e].validated=!0},uri:Ee,value:je,typeOf:(e,t)=>ie(je(e),t),has:(e,t)=>e in je(t),step:$e,keys:e=>Object.keys(je(e)),entries:e=>ee.pipeline([je,Object.keys,ee.map(async t=>[t,await $e(t,e)]),ee.all],e),map:Ae,length:e=>je(e).length};class xe extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var Se=xe;const Te="FLAG",Ie="BASIC",ke="DETAILED",Ve="VERBOSE";let Le=ke,Ke=!0;const ze=async e=>{const t={};return{ast:t,schemaUri:await Fe(e,t)}},_e=t(({ast:e,schemaUri:t},r,n=Te)=>{if(![Te,Ie,ke,Ve].includes(n))throw Error(`The '${n}' error format is not supported`);let a=[];const i=o.subscribe("result",Ce(n,a));return Me(t,r,e),o.unsubscribe(i),a[0]}),Ce=(e,t)=>{const r=[];return(n,o)=>{const{keyword:a,absoluteKeywordLocation:i,instanceLocation:s,valid:c}=o,u={keyword:a,absoluteKeywordLocation:i,instanceLocation:s,valid:c,errors:[]};for(;r.length>0&&Ue(r[r.length-1],u);){const t=r.pop();let n=[];e===Ie&&(n=t.errors,delete t.errors),u.errors.unshift(t,...n)}(e===Ve||e!==Te&&!u.valid)&&r.push(u),t[0]=u}},Ue=(e,t)=>e.absoluteKeywordLocation.startsWith(t.absoluteKeywordLocation)||t.keyword.endsWith("#validate")&&e.instanceLocation===t.instanceLocation,qe={},Re=e=>qe[e],Be=e=>e in qe,De={},We={},Fe=async(e,t)=>{if(!Be(e.schemaVersion+"#validate")){const t=await Pe.get(e.schemaVersion);(Pe.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 De)Object.entries(De[e]).forEach(([e,r])=>{((e,t)=>{qe[e]={collectEvaluatedItems:(e,r,n)=>t.interpret(e,r,n)&&0,collectEvaluatedProperties:(e,r,n)=>t.interpret(e,r,n)&&[],...t}})(`${t.id}#${e}`,r)});else if(r)throw Error("Missing required vocabulary: "+e)})}if(Ke&&!e.validated){if(Pe.markValidated(e.id),!(e.schemaVersion in We)){const t=await Pe.get(e.schemaVersion),r={},n=await Fe(t,r);We[t.id]=_e({ast:r,schemaUri:n})}const t=C.cons(e.schema,e.id),r=We[e.schemaVersion](t,Le);if(!r.valid)throw new Se(r)}return await Re(e.schemaVersion+"#validate").compile(e,t),Pe.uri(e)},Me=(e,t,r)=>{const[n]=r[e];return Re(n).interpret(e,t,r)};var Ne={validate:async(e,t,r)=>{const n=await ze(e),o=(e,t=Te)=>_e(n,C.cons(e),t);return void 0===t?o:o(t,r)},compile:ze,interpret:_e,setMetaOutputFormat:e=>{Le=e},setShouldMetaValidate:e=>{Ke=e},FLAG:Te,BASIC:Ie,DETAILED:ke,VERBOSE:Ve,getKeyword:Re,hasKeyword:Be,defineVocabulary:(e,t)=>{De[e]=t},compileSchema:Fe,interpretSchema:Me,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return Re(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return Re(o).collectEvaluatedItems(e,t,r,n)}};var Ze={compile:e=>Pe.value(e),interpret:()=>!0};var Je={compile:async(e,t)=>{const r=Pe.uri(e);if(!(r in t)){t[r]=!1;const n=Pe.value(e);t[r]=[e.schemaVersion+"#validate",Pe.uri(e),"boolean"==typeof n?n:await ee.pipeline([Pe.entries,ee.map(([t,r])=>[`${e.schemaVersion}#${t}`,r]),ee.filter(([t])=>Ne.hasKeyword(t)&&t!==e.schemaVersion+"#validate"),ee.map(async([r,n])=>{const o=await Ne.getKeyword(r).compile(n,t,e);return[r,Pe.uri(n),o]}),ee.all],e)]}},interpret:(e,t,r)=>{const[n,a,i]=r[e],s="boolean"==typeof i?i:i.every(([e,n,a])=>{const i=Ne.getKeyword(e).interpret(a,t,r);return o.publishSync("result",{keyword:e,absoluteKeywordLocation:n,instanceLocation:C.uri(t),valid:i,ast:a}),i});return o.publishSync("result",{keyword:n,absoluteKeywordLocation:a,instanceLocation:C.uri(t),valid:s,ast:e}),s},collectEvaluatedProperties:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedProperties")).reduce((e,[n,,o])=>{const a=e&&Ne.getKeyword(n).collectEvaluatedProperties(o,t,r);return a&&e.concat(a)},[])},collectEvaluatedItems:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedItems")).reduce((e,[n,,o])=>{const a=!1!==e&&Ne.getKeyword(n).collectEvaluatedItems(o,t,r);return!1!==a&&Math.max(e,a)},0)}},Ge={Core:Ne,Schema:Pe,Instance:C,Keywords:{metaData:Ze,validate:Je}},He=Ge.Core,Qe=Ge.Schema,Xe=Ge.Instance,Ye=Ge.Keywords;e.Core=He,e.Instance=Xe,e.Keywords=Ye,e.Schema=Qe,e.default=Ge,Object.defineProperty(e,"__esModule",{value:!0})}));
*/function M(e){var t=String(e);if(R.test(t))return t;if(t.length>0&&!q.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(B,"\\$1")+'"'}function N(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],!R.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(!F.test(n))throw new TypeError("invalid media type");var o=new N(n.toLowerCase());if(-1!==r){var a,i,s;for(U.lastIndex=r;i=U.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),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:J,map:W,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)},te=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(oe.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)?re(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+ne(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=ne(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:re(e)}};function re(e){return e+("/"===e[e.length-1]?"":"/")}function ne(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 oe=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");var ae=fetch;const{jsonTypeOf:ie,splitUrl:se}=b,ce={},ue={},le=(e,t)=>{const r=e in ue?ue[e]:e;if(r in ce)return ce[r][t]},fe={},de={},pe=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=se(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=le(n,"baseToken"),a=le(n,"anchorToken"),i=se(t)[0];if(!i&&!se(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const s=we(i,e[o]||""),[c,u]=se(s);delete e[o],u&&o===a&&(e[a]=a!==o?encodeURI(u):"#"+encodeURI(u)),i&&(de[i]=c);const l={},f=le(n,"recursiveAnchorToken");let d;!0===e[f]&&(l["#"]=c,e[a]="",delete e[f]);const p=le(n,"vocabularyToken");ie(e[p],"object")?(ue[c]=n,d=e[p],delete e[p]):(ue[c]=n,d={[n]:!0});const h={};fe[c]={id:c,schemaVersion:n,schema:he(e,c,n,m.nil,h,l),anchors:h,dynamicAnchors:l,vocabulary:d,validated:!1}},he=(e,t,r,n,o,a)=>{if(ie(e,"object")){const i="string"==typeof e.$schema?se(e.$schema)[0]:r,s=le(i,"embeddedToken"),c=le(i,"anchorToken");if("string"==typeof e[s]&&(s!==c||"#"!==e[s][0])){const n=we(t,e[s]);return e[s]=n,pe(e,n,r),E(e[s],e)}const u=le(r,"anchorToken"),l=le(r,"dynamicAnchorToken");"string"==typeof e[l]&&(a["#"+e[l]]=t,e[u]=e[l],delete e[l]);const f=le(r,"embeddedToken");if("string"==typeof e[u]){const t=u!==f?e[u]:e[u].slice(1);o[t]=n,delete e[u]}const d=le(r,"jrefToken");if("string"==typeof e[d])return E(e[d],e);for(let i in e)e[i]=he(e[i],t,r,m.append(i,n),o,a);const p=le(r,"jsrefToken");"string"==typeof e[p]&&(e[p]=E(e[p],e[p]));const h=le(r,"dynamicJsrefToken");return"string"==typeof e[h]&&(e[h]=E(e[h],e[h],!0)),e}return Array.isArray(e)?e.map(((e,i)=>he(e,t,r,m.append(i,n),o,a))):e},ye=e=>fe[de[e]]||fe[e],me=Object.freeze({id:"",schemaVersion:void 0,pointer:"",schema:void 0,dynamicAnchors:{}}),ve=async(e,t=me,r=!1)=>{const n=r&&t.dynamicAnchors[e]?t.dynamicAnchors[e]:Ee(t),o=we(n,e),[a,i]=se(o);if(!(e=>e in fe||e in de)(a)){const e=await ae(a,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error("Failed to retrieve schema with id: "+a);if(e.headers.has("content-type")){const t=Z.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${a} is not a schema. Found a document with media type: ${t}`)}pe(await e.json(),a)}const s=ye(a),c=i&&"/"!==i[0]?Oe(s,i):i,u=Object.freeze({id:s.id,schemaVersion:s.schemaVersion,vocabulary:s.vocabulary,pointer:c,schema:s.schema,value:m.get(c,s.schema),dynamicAnchors:{...s.dynamicAnchors,...t.dynamicAnchors},validated:s.validated});return be(u)},be=e=>j(e.value)?ve(S(e.value),e,A(e.value)):e,we=(e,t)=>{const r=te(e,t),n=se(e)[0];if(n&&"file"===ge(r)&&"file"!==ge(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},ge=e=>{const t=e.match(/^(.+):\/\//);return t?t[1]:""},Oe=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},Ee=e=>`${e.id}#${encodeURI(e.pointer)}`,je=e=>j(e.value)?$(e.value):e.value,Se=(e,t)=>{const r=ye(t.id),n=Object.freeze({id:t.id,schemaVersion:t.schemaVersion,vocabulary:t.vocabulary,pointer:m.append(e,t.pointer),schema:r.schema,value:je(t)[e],dynamicAnchors:t.dynamicAnchors,validated:r.validated});return be(n)},$e=t(((e,t)=>ee.pipeline([je,ee.map((async(r,n)=>e(await Se(n,t),n))),ee.all],t)));var Ae={setConfig:(e,t,r)=>{ce[e]||(ce[e]={}),ce[e][t]=r},getConfig:le,add:pe,get:ve,markValidated:e=>{fe[e].validated=!0},uri:Ee,value:je,typeOf:(e,t)=>ie(je(e),t),has:(e,t)=>e in je(t),step:Se,keys:e=>Object.keys(je(e)),entries:e=>ee.pipeline([je,Object.keys,ee.map((async t=>[t,await Se(t,e)])),ee.all],e),map:$e,length:e=>je(e).length};class xe extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var Pe=xe;const Te="FLAG",Ie="BASIC",ke="DETAILED",Ve="VERBOSE";let ze=ke,Ke=!0;const Le=async e=>{const t={};return{ast:t,schemaUri:await Fe(e,t)}},_e=t((({ast:e,schemaUri:t},r,n=Te)=>{if(![Te,Ie,ke,Ve].includes(n))throw Error(`The '${n}' error format is not supported`);let a=[];const i=o.subscribe("result",Ce(n,a));return Me(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===Ie&&(o.push(...t.errors),delete t.errors),(e===Ve||e!==Te&&!t.valid)&&n.errors.unshift(...o)}r[r.length-1]=n,t[0]=n}}},Ue={},qe=e=>Ue[e],Re=e=>e in Ue,De={},Be={},Fe=async(e,t)=>{if(!Re(e.schemaVersion+"#validate")){const t=await Ae.get(e.schemaVersion);(Ae.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 De)Object.entries(De[e]).forEach((([e,r])=>{((e,t)=>{Ue[e]={collectEvaluatedItems:(e,r,n)=>t.interpret(e,r,n)&&0,collectEvaluatedProperties:(e,r,n)=>t.interpret(e,r,n)&&[],...t}})(`${t.id}#${e}`,r)}));else if(r)throw Error("Missing required vocabulary: "+e)}))}if(Ke&&!e.validated){if(Ae.markValidated(e.id),!(e.schemaVersion in Be)){const t=await Ae.get(e.schemaVersion),r={},n=await Fe(t,r);Be[t.id]=_e({ast:r,schemaUri:n})}const t=C.cons(e.schema,e.id),r=Be[e.schemaVersion](t,ze);if(!r.valid)throw new Pe(r)}return await qe(e.schemaVersion+"#validate").compile(e,t),Ae.uri(e)},Me=(e,t,r)=>{const[n]=r[e];return qe(n).interpret(e,t,r)};var Ne={validate:async(e,t,r)=>{const n=await Le(e),o=(e,t=Te)=>_e(n,C.cons(e),t);return void 0===t?o:o(t,r)},compile:Le,interpret:_e,setMetaOutputFormat:e=>{ze=e},setShouldMetaValidate:e=>{Ke=e},FLAG:Te,BASIC:Ie,DETAILED:ke,VERBOSE:Ve,getKeyword:qe,hasKeyword:Re,defineVocabulary:(e,t)=>{De[e]=t},compileSchema:Fe,interpretSchema:Me,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return qe(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return qe(o).collectEvaluatedItems(e,t,r,n)}};var Ze={compile:e=>Ae.value(e),interpret:()=>!0};var Je={compile:async(e,t)=>{const r=Ae.uri(e);if(!(r in t)){t[r]=!1;const n=Ae.value(e);t[r]=[e.schemaVersion+"#validate",Ae.uri(e),"boolean"==typeof n?n:await ee.pipeline([Ae.entries,ee.map((([t,r])=>[`${e.schemaVersion}#${t}`,r])),ee.filter((([t])=>Ne.hasKeyword(t)&&t!==e.schemaVersion+"#validate")),ee.map((async([r,n])=>{const o=await Ne.getKeyword(r).compile(n,t,e);return[r,Ae.uri(n),o]})),ee.all],e)]}return r},interpret:(e,t,r)=>{const[n,a,i]=r[e];o.publishSync("result.start");const s="boolean"==typeof i?i:i.every((([e,n,a])=>{o.publishSync("result.start");const i=Ne.getKeyword(e).interpret(a,t,r);return o.publishSync("result",{keyword:e,absoluteKeywordLocation:n,instanceLocation:C.uri(t),valid:i,ast:a}),o.publishSync("result.end"),i}));return o.publishSync("result",{keyword:n,absoluteKeywordLocation:a,instanceLocation:C.uri(t),valid:s,ast:e}),o.publishSync("result.end"),s},collectEvaluatedProperties:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter((([e])=>!n||!e.endsWith("#unevaluatedProperties"))).reduce(((e,[n,,o])=>{const a=e&&Ne.getKeyword(n).collectEvaluatedProperties(o,t,r);return a&&e.concat(a)}),[])},collectEvaluatedItems:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter((([e])=>!n||!e.endsWith("#unevaluatedItems"))).reduce(((e,[n,,o])=>{const a=!1!==e&&Ne.getKeyword(n).collectEvaluatedItems(o,t,r);return!1!==a&&Math.max(e,a)}),0)}},We={Core:Ne,Schema:Ae,Instance:C,Keywords:{metaData:Ze,validate:Je}},Ge=We.Core,He=We.Schema,Qe=We.Instance,Xe=We.Keywords;e.Core=Ge,e.Instance=Qe,e.Keywords=Xe,e.Schema=He,e.default=We,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=json-schema-core-amd.min.js.map

@@ -61,16 +61,8 @@ 'use strict';

(function (root, factory){
var PubSub = {};
root.PubSub = PubSub;
var define = root.define;
factory(PubSub);
// AMD support
if (typeof define === 'function' && define.amd){
define(function() { return PubSub; });
// CommonJS and Node.js module support
} else {
// CommonJS and Node.js module support
{
if (module !== undefined && module.exports) {

@@ -81,3 +73,3 @@ exports = module.exports = PubSub; // Node.js specific `module.exports`

module.exports = exports = PubSub; // CommonJS
}
}

@@ -87,3 +79,4 @@ }(( typeof window === 'object' && window ) || commonjsGlobal, function (PubSub){

var messages = {},
lastUid = -1;
lastUid = -1,
ALL_SUBSCRIBING_MSG = '*';

@@ -155,8 +148,17 @@ function hasKeys(obj){

}
deliverMessage(message, ALL_SUBSCRIBING_MSG, data, immediateExceptions);
};
}
function hasDirectSubscribersFor( message ) {
var topic = String( message ),
found = Boolean(messages.hasOwnProperty( topic ) && hasKeys(messages[topic]));
return found;
}
function messageHasSubscribers( message ){
var topic = String( message ),
found = Boolean(messages.hasOwnProperty( topic ) && hasKeys(messages[topic])),
found = hasDirectSubscribersFor(topic) || hasDirectSubscribersFor(ALL_SUBSCRIBING_MSG),
position = topic.lastIndexOf( '.' );

@@ -167,3 +169,3 @@

position = topic.lastIndexOf( '.' );
found = Boolean(messages.hasOwnProperty( topic ) && hasKeys(messages[topic]));
found = hasDirectSubscribersFor(topic);
}

@@ -245,2 +247,6 @@

PubSub.subscribeAll = function( func ){
return PubSub.subscribe(ALL_SUBSCRIBING_MSG, func);
};
/**

@@ -1404,27 +1410,30 @@ * Subscribes the passed function to the passed message once

return (message, keywordResult) => {
const { keyword, absoluteKeywordLocation, instanceLocation, valid } = keywordResult;
const result = { keyword, absoluteKeywordLocation, instanceLocation, valid, errors: [] };
while (resultStack.length > 0 && isChild(resultStack[resultStack.length - 1], result)) {
const topResult = resultStack.pop();
let errors = [];
if (outputFormat === BASIC) {
errors = topResult.errors;
delete topResult.errors;
if (message === "result") {
const { keyword, absoluteKeywordLocation, instanceLocation, valid } = keywordResult;
const result = { keyword, absoluteKeywordLocation, instanceLocation, valid, errors: [] };
resultStack.push(result);
} else if (message === "result.start") {
resultStack.push(message);
} else if (message === "result.end") {
const result = resultStack.pop();
while (resultStack[resultStack.length - 1] !== "result.start") {
const topResult = resultStack.pop();
const errors = [topResult];
if (outputFormat === BASIC) {
errors.push(...topResult.errors);
delete topResult.errors;
}
if (outputFormat === VERBOSE || (outputFormat !== FLAG && !topResult.valid)) {
result.errors.unshift(...errors);
}
}
result.errors.unshift(topResult, ...errors);
}
resultStack[resultStack.length - 1] = result;
if (outputFormat === VERBOSE || (outputFormat !== FLAG && !result.valid)) {
resultStack.push(result);
output[0] = result;
}
output[0] = result;
};
};
const isChild = (topResult, nextResult) => {
return topResult.absoluteKeywordLocation.startsWith(nextResult.absoluteKeywordLocation)
|| nextResult.keyword.endsWith("#validate") && topResult.instanceLocation === nextResult.instanceLocation;
};
const setMetaOutputFormat = (format) => {

@@ -1554,2 +1563,4 @@ metaOutputFormat = format;

}
return url;
};

@@ -1560,4 +1571,6 @@

pubsub.publishSync("result.start");
const isValid = typeof nodes === "boolean" ? nodes : nodes
.every(([keywordId, schemaUrl, keywordValue]) => {
pubsub.publishSync("result.start");
const isValid = core.getKeyword(keywordId).interpret(keywordValue, instance$1, ast);

@@ -1572,2 +1585,3 @@

});
pubsub.publishSync("result.end");
return isValid;

@@ -1583,2 +1597,3 @@ });

});
pubsub.publishSync("result.end");
return isValid;

@@ -1585,0 +1600,0 @@ };

@@ -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){!function(t,n){var o={};t.PubSub=o;var a=t.define;!function(e){var t={},r=-1;function n(e){var t;for(t in e)if(e.hasOwnProperty(t))return!0;return!1}function o(e){return function(){throw e}}function a(e,t,r){try{e(t,r)}catch(e){setTimeout(o(e),0)}}function i(e,t,r){e(t,r)}function s(e,r,n,o){var s,c=t[r],u=o?i:a;if(t.hasOwnProperty(r))for(s in c)c.hasOwnProperty(s)&&u(c[s],e,n)}function c(e,t,r){return function(){var n=String(e),o=n.lastIndexOf(".");for(s(e,e,t,r);-1!==o;)o=(n=n.substr(0,o)).lastIndexOf("."),s(e,n,t,r)}}function u(e){for(var r=String(e),o=Boolean(t.hasOwnProperty(r)&&n(t[r])),a=r.lastIndexOf(".");!o&&-1!==a;)a=(r=r.substr(0,a)).lastIndexOf("."),o=Boolean(t.hasOwnProperty(r)&&n(t[r]));return o}function l(e,t,r,n){var o=c(e="symbol"==typeof e?e.toString():e,t,n);return!!u(e)&&(!0===r?o():setTimeout(o,0),!0)}e.publish=function(t,r){return l(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return l(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,t.hasOwnProperty(e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},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)t.hasOwnProperty(r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n=0;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n++;return n},e.getSubscriptions=function(e){var r,n=[];for(r in t)t.hasOwnProperty(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(t.hasOwnProperty(r)&&0===r.indexOf(e))return!0;return!1},s="string"==typeof r&&(t.hasOwnProperty(r)||i(r)),c=!s&&"string"==typeof r,u="function"==typeof r,l=!1;if(!s){for(n in t)if(t.hasOwnProperty(n)){if(o=t[n],c&&o[r]){delete o[r],l=r;break}if(u)for(a in o)o.hasOwnProperty(a)&&o[a]===r&&(delete o[a],l=!0)}return l}e.clearSubscriptions(r)}}(o),"function"==typeof a&&a.amd?a((function(){return o})):(void 0!==e&&e.exports&&(r=e.exports=o),r.PubSub=o,e.exports=r=o)}("object"==typeof window&&window||t)}(r={exports:{}},r.exports),r.exports);n.PubSub;const o=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(f)},a=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:a(e,p(t,o,n),r,u(o,n))}}if(Array.isArray(t)){const n=[...t];return n[d(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:p(t,e[0],n)},i=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||h(t)){const o=e.shift();i(e,p(t,o,n),r,u(o,n))}else{t[d(t,e[0])]=r}},s=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=p(t,n,r);return{...t,[n]:s(e,o,u(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 p(t,e[0],r)}},c=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=p(t,n,r);c(e,o,u(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:p(t,e[0],r)},u=e((e,t)=>t+"/"+l(e)),l=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),f=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),d=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,p=(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(h(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[d(e,t)]},h=e=>null===e||"object"!=typeof e;var y={nil:"",append:u,get:(e,t)=>{const r=o(e),n=e=>r.reduce(([e,t],r)=>[p(e,r,t),u(r,t)],[e,""])[0];return void 0===t?n:n(t)},set:(t,r,n)=>{const i=o(t),s=e((e,t)=>a(i,e,t,""));return void 0===r?s:s(r,n)},assign:(t,r,n)=>{const a=o(t),s=e((e,t)=>i(a,e,t,""));return void 0===r?s:s(r,n)},unset:(e,t)=>{const r=o(e),n=e=>s(r,e,"");return void 0===t?n:n(t)},delete:(e,t)=>{const r=o(e),n=e=>c(r,e,"");return void 0===t?n:n(t)}};const m={null:e=>null===e,boolean:e=>"boolean"==typeof e,object:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,array:e=>Array.isArray(e),number:e=>"number"==typeof e,integer:e=>Number.isInteger(e),string:e=>"string"==typeof e};var v={jsonTypeOf:(e,t)=>m[t](e),splitUrl: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)]}};const b=Symbol("$__value"),w=Symbol("$__href"),g=Symbol("$__isDynamic");var O=(e,t,r=!1)=>Object.freeze({[w]:e,[b]:t,[g]:r}),E=e=>e&&void 0!==e[w],j=e=>e[w],x=e=>e[b],$=e=>e[g];const{jsonTypeOf:A}=v,P=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),S=e=>E(e.value)?x(e.value):e.value,T=e((e,t)=>A(S(e),t)),I=(e,t)=>Object.freeze({...t,pointer:y.append(e,t.pointer),value:S(t)[e]}),k=e((e,t)=>S(t).map((r,n,o,a)=>e(I(n,t),n,o,a))),V=e((e,t)=>S(t).map((e,r,n,o)=>I(r,t)).filter((t,r,n,o)=>e(t,r,n,o))),L=e((e,t,r)=>S(r).reduce((t,n,o)=>e(t,I(o,r),o),t)),K=e((e,t)=>S(t).every((r,n,o,a)=>e(I(n,t),n,o,a))),z=e((e,t)=>S(t).some((r,n,o,a)=>e(I(n,t),n,o,a)));var _={cons:(e,t="")=>Object.freeze({...P,id:t,instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:S,typeOf:T,step:I,entries:e=>Object.keys(S(e)).map(t=>[t,I(t,e)]),keys:e=>Object.keys(S(e)),map:k,filter:V,reduce:L,every:K,some:z,length:e=>S(e).length},C=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,U=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,q=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,R=/\\([\u000b\u0020-\u00ff])/g,B=/([\\"])/g,D=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
"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(e.hasOwnProperty(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],u=o?s:i;if(t.hasOwnProperty(r))for(a in c)c.hasOwnProperty(a)&&u(c[a],e,n)}function u(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 l(e){var r=String(e);return Boolean(t.hasOwnProperty(r)&&o(t[r]))}function f(e){for(var t=String(e),r=l(t)||l(n),o=t.lastIndexOf(".");!r&&-1!==o;)o=(t=t.substr(0,o)).lastIndexOf("."),r=l(t);return r}function d(e,t,r,n){var o=u(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 d(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return d(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,t.hasOwnProperty(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)t.hasOwnProperty(r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n=0;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n++;return n},e.getSubscriptions=function(e){var r,n=[];for(r in t)t.hasOwnProperty(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(t.hasOwnProperty(r)&&0===r.indexOf(e))return!0;return!1},s="string"==typeof r&&(t.hasOwnProperty(r)||i(r)),c=!s&&"string"==typeof r,u="function"==typeof r,l=!1;if(!s){for(n in t)if(t.hasOwnProperty(n)){if(o=t[n],c&&o[r]){delete o[r],l=r;break}if(u)for(a in o)o.hasOwnProperty(a)&&o[a]===r&&(delete o[a],l=!0)}return l}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;const o=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(f)},a=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:a(e,p(t,o,n),r,u(o,n))}}if(Array.isArray(t)){const n=[...t];return n[d(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:p(t,e[0],n)},i=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||h(t)){const o=e.shift();i(e,p(t,o,n),r,u(o,n))}else{t[d(t,e[0])]=r}},s=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=p(t,n,r);return{...t,[n]:s(e,o,u(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 p(t,e[0],r)}},c=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=p(t,n,r);c(e,o,u(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:p(t,e[0],r)},u=e(((e,t)=>t+"/"+l(e))),l=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),f=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),d=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,p=(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(h(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[d(e,t)]},h=e=>null===e||"object"!=typeof e;var y={nil:"",append:u,get:(e,t)=>{const r=o(e),n=e=>r.reduce((([e,t],r)=>[p(e,r,t),u(r,t)]),[e,""])[0];return void 0===t?n:n(t)},set:(t,r,n)=>{const i=o(t),s=e(((e,t)=>a(i,e,t,"")));return void 0===r?s:s(r,n)},assign:(t,r,n)=>{const a=o(t),s=e(((e,t)=>i(a,e,t,"")));return void 0===r?s:s(r,n)},unset:(e,t)=>{const r=o(e),n=e=>s(r,e,"");return void 0===t?n:n(t)},delete:(e,t)=>{const r=o(e),n=e=>c(r,e,"");return void 0===t?n:n(t)}};const m={null:e=>null===e,boolean:e=>"boolean"==typeof e,object:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,array:e=>Array.isArray(e),number:e=>"number"==typeof e,integer:e=>Number.isInteger(e),string:e=>"string"==typeof e};var v={jsonTypeOf:(e,t)=>m[t](e),splitUrl: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)]}};const b=Symbol("$__value"),w=Symbol("$__href"),g=Symbol("$__isDynamic");var O=(e,t,r=!1)=>Object.freeze({[w]:e,[b]:t,[g]:r}),E=e=>e&&void 0!==e[w],j=e=>e[w],x=e=>e[b],S=e=>e[g];const{jsonTypeOf:$}=v,A=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),P=e=>E(e.value)?x(e.value):e.value,T=e(((e,t)=>$(P(e),t))),I=(e,t)=>Object.freeze({...t,pointer:y.append(e,t.pointer),value:P(t)[e]}),k=e(((e,t)=>P(t).map(((r,n,o,a)=>e(I(n,t),n,o,a))))),V=e(((e,t)=>P(t).map(((e,r,n,o)=>I(r,t))).filter(((t,r,n,o)=>e(t,r,n,o))))),z=e(((e,t,r)=>P(r).reduce(((t,n,o)=>e(t,I(o,r),o)),t))),K=e(((e,t)=>P(t).every(((r,n,o,a)=>e(I(n,t),n,o,a))))),L=e(((e,t)=>P(t).some(((r,n,o,a)=>e(I(n,t),n,o,a)))));var _={cons:(e,t="")=>Object.freeze({...A,id:t,instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:P,typeOf:T,step:I,entries:e=>Object.keys(P(e)).map((t=>[t,I(t,e)])),keys:e=>Object.keys(P(e)),map:k,filter:V,reduce:z,every:K,some:L,length:e=>P(e).length},C=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,U=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,q=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,R=/\\([\u000b\u0020-\u00ff])/g,D=/([\\"])/g,B=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
/*!

@@ -6,3 +6,3 @@ * content-type

* MIT Licensed
*/function W(e){var t=String(e);if(q.test(t))return t;if(t.length>0&&!U.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(B,"\\$1")+'"'}function F(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||!D.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],!q.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+W(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(!D.test(n))throw new TypeError("invalid media type");var o=new F(n.toLowerCase());if(-1!==r){var a,i,s;for(C.lastIndex=r;i=C.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(R,"$1")),o.parameters[a]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},N=async e=>Object.entries(await e),Z=e(async(e,t)=>(await t).map(e)),J=e(async(e,t,r)=>(await r).reduce(async(t,r)=>e(await t,r),t)),G=e(async(e,t,r={})=>J(async(t,r)=>await e(r)?t.concat([r]):t,[],t,r)),H=e(async(e,t)=>{const r=await Z(e,t);return(await Promise.all(r)).some(e=>e)}),Q=e(async(e,t)=>{const r=await Z(e,t);return(await Promise.all(r)).every(e=>e)}),X=e((e,t)=>e.reduce(async(e,t)=>t(await e),t)),Y={entries:N,map:Z,filter:G,reduce:J,some:H,every:Q,pipeline:X,all:e=>Promise.all(e),allValues:e=>X([N,J(async(e,[t,r])=>(e[t]=await r,e),{})],e)},ee=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(ne.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)?te(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+re(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=re(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:te(e)}};function te(e){return e+("/"===e[e.length-1]?"":"/")}function re(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 ne=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");var oe=fetch;const{jsonTypeOf:ae,splitUrl:ie}=v,se={},ce={},ue=(e,t)=>{const r=e in ce?ce[e]:e;if(r in se)return se[r][t]},le={},fe={},de=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=ie(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=ie(t)[0];if(!i&&!ie(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const s=be(i,e[o]||""),[c,u]=ie(s);delete e[o],u&&o===a&&(e[a]=a!==o?encodeURI(u):"#"+encodeURI(u)),i&&(fe[i]=c);const l={},f=ue(n,"recursiveAnchorToken");let d;!0===e[f]&&(l["#"]=c,e[a]="",delete e[f]);const p=ue(n,"vocabularyToken");ae(e[p],"object")?(ce[c]=n,d=e[p],delete e[p]):(ce[c]=n,d={[n]:!0});const h={};le[c]={id:c,schemaVersion:n,schema:pe(e,c,n,y.nil,h,l),anchors:h,dynamicAnchors:l,vocabulary:d,validated:!1}},pe=(e,t,r,n,o,a)=>{if(ae(e,"object")){const i="string"==typeof e.$schema?ie(e.$schema)[0]:r,s=ue(i,"embeddedToken"),c=ue(i,"anchorToken");if("string"==typeof e[s]&&(s!==c||"#"!==e[s][0])){const n=be(t,e[s]);return e[s]=n,de(e,n,r),O(e[s],e)}const u=ue(r,"anchorToken"),l=ue(r,"dynamicAnchorToken");"string"==typeof e[l]&&(a["#"+e[l]]=t,e[u]=e[l],delete e[l]);const f=ue(r,"embeddedToken");if("string"==typeof e[u]){const t=u!==f?e[u]:e[u].slice(1);o[t]=n,delete e[u]}const d=ue(r,"jrefToken");if("string"==typeof e[d])return O(e[d],e);for(let i in e)e[i]=pe(e[i],t,r,y.append(i,n),o,a);const p=ue(r,"jsrefToken");"string"==typeof e[p]&&(e[p]=O(e[p],e[p]));const h=ue(r,"dynamicJsrefToken");return"string"==typeof e[h]&&(e[h]=O(e[h],e[h],!0)),e}return Array.isArray(e)?e.map((e,i)=>pe(e,t,r,y.append(i,n),o,a)):e},he=e=>le[fe[e]]||le[e],ye=Object.freeze({id:"",schemaVersion:void 0,pointer:"",schema:void 0,dynamicAnchors:{}}),me=async(e,t=ye,r=!1)=>{const n=r&&t.dynamicAnchors[e]?t.dynamicAnchors[e]:Oe(t),o=be(n,e),[a,i]=ie(o);if(!(e=>e in le||e in fe)(a)){const e=await oe(a,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error("Failed to retrieve schema with id: "+a);if(e.headers.has("content-type")){const t=M.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${a} is not a schema. Found a document with media type: ${t}`)}de(await e.json(),a)}const s=he(a),c=i&&"/"!==i[0]?ge(s,i):i,u=Object.freeze({id:s.id,schemaVersion:s.schemaVersion,vocabulary:s.vocabulary,pointer:c,schema:s.schema,value:y.get(c,s.schema),dynamicAnchors:{...s.dynamicAnchors,...t.dynamicAnchors},validated:s.validated});return ve(u)},ve=e=>E(e.value)?me(j(e.value),e,$(e.value)):e,be=(e,t)=>{const r=ee(e,t),n=ie(e)[0];if(n&&"file"===we(r)&&"file"!==we(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},we=e=>{const t=e.match(/^(.+):\/\//);return t?t[1]:""},ge=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},Oe=e=>`${e.id}#${encodeURI(e.pointer)}`,Ee=e=>E(e.value)?x(e.value):e.value,je=(e,t)=>{const r=he(t.id),n=Object.freeze({id:t.id,schemaVersion:t.schemaVersion,vocabulary:t.vocabulary,pointer:y.append(e,t.pointer),schema:r.schema,value:Ee(t)[e],dynamicAnchors:t.dynamicAnchors,validated:r.validated});return ve(n)},xe=e((e,t)=>Y.pipeline([Ee,Y.map(async(r,n)=>e(await je(n,t),n)),Y.all],t));var $e={setConfig:(e,t,r)=>{se[e]||(se[e]={}),se[e][t]=r},getConfig:ue,add:de,get:me,markValidated:e=>{le[e].validated=!0},uri:Oe,value:Ee,typeOf:(e,t)=>ae(Ee(e),t),has:(e,t)=>e in Ee(t),step:je,keys:e=>Object.keys(Ee(e)),entries:e=>Y.pipeline([Ee,Object.keys,Y.map(async t=>[t,await je(t,e)]),Y.all],e),map:xe,length:e=>Ee(e).length};class Ae extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var Pe=Ae;const Se="FLAG",Te="BASIC",Ie="DETAILED",ke="VERBOSE";let Ve=Ie,Le=!0;const Ke=async e=>{const t={};return{ast:t,schemaUri:await We(e,t)}},ze=e(({ast:e,schemaUri:t},r,o=Se)=>{if(![Se,Te,Ie,ke].includes(o))throw Error(`The '${o}' error format is not supported`);let a=[];const i=n.subscribe("result",_e(o,a));return Fe(t,r,e),n.unsubscribe(i),a[0]}),_e=(e,t)=>{const r=[];return(n,o)=>{const{keyword:a,absoluteKeywordLocation:i,instanceLocation:s,valid:c}=o,u={keyword:a,absoluteKeywordLocation:i,instanceLocation:s,valid:c,errors:[]};for(;r.length>0&&Ce(r[r.length-1],u);){const t=r.pop();let n=[];e===Te&&(n=t.errors,delete t.errors),u.errors.unshift(t,...n)}(e===ke||e!==Se&&!u.valid)&&r.push(u),t[0]=u}},Ce=(e,t)=>e.absoluteKeywordLocation.startsWith(t.absoluteKeywordLocation)||t.keyword.endsWith("#validate")&&e.instanceLocation===t.instanceLocation,Ue={},qe=e=>Ue[e],Re=e=>e in Ue,Be={},De={},We=async(e,t)=>{if(!Re(e.schemaVersion+"#validate")){const t=await $e.get(e.schemaVersion);($e.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 Be)Object.entries(Be[e]).forEach(([e,r])=>{((e,t)=>{Ue[e]={collectEvaluatedItems:(e,r,n)=>t.interpret(e,r,n)&&0,collectEvaluatedProperties:(e,r,n)=>t.interpret(e,r,n)&&[],...t}})(`${t.id}#${e}`,r)});else if(r)throw Error("Missing required vocabulary: "+e)})}if(Le&&!e.validated){if($e.markValidated(e.id),!(e.schemaVersion in De)){const t=await $e.get(e.schemaVersion),r={},n=await We(t,r);De[t.id]=ze({ast:r,schemaUri:n})}const t=_.cons(e.schema,e.id),r=De[e.schemaVersion](t,Ve);if(!r.valid)throw new Pe(r)}return await qe(e.schemaVersion+"#validate").compile(e,t),$e.uri(e)},Fe=(e,t,r)=>{const[n]=r[e];return qe(n).interpret(e,t,r)};var Me={validate:async(e,t,r)=>{const n=await Ke(e),o=(e,t=Se)=>ze(n,_.cons(e),t);return void 0===t?o:o(t,r)},compile:Ke,interpret:ze,setMetaOutputFormat:e=>{Ve=e},setShouldMetaValidate:e=>{Le=e},FLAG:Se,BASIC:Te,DETAILED:Ie,VERBOSE:ke,getKeyword:qe,hasKeyword:Re,defineVocabulary:(e,t)=>{Be[e]=t},compileSchema:We,interpretSchema:Fe,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return qe(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return qe(o).collectEvaluatedItems(e,t,r,n)}};var Ne={compile:e=>$e.value(e),interpret:()=>!0};var Ze={compile:async(e,t)=>{const r=$e.uri(e);if(!(r in t)){t[r]=!1;const n=$e.value(e);t[r]=[e.schemaVersion+"#validate",$e.uri(e),"boolean"==typeof n?n:await Y.pipeline([$e.entries,Y.map(([t,r])=>[`${e.schemaVersion}#${t}`,r]),Y.filter(([t])=>Me.hasKeyword(t)&&t!==e.schemaVersion+"#validate"),Y.map(async([r,n])=>{const o=await Me.getKeyword(r).compile(n,t,e);return[r,$e.uri(n),o]}),Y.all],e)]}},interpret:(e,t,r)=>{const[o,a,i]=r[e],s="boolean"==typeof i?i:i.every(([e,o,a])=>{const i=Me.getKeyword(e).interpret(a,t,r);return n.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:_.uri(t),valid:i,ast:a}),i});return n.publishSync("result",{keyword:o,absoluteKeywordLocation:a,instanceLocation:_.uri(t),valid:s,ast:e}),s},collectEvaluatedProperties:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedProperties")).reduce((e,[n,,o])=>{const a=e&&Me.getKeyword(n).collectEvaluatedProperties(o,t,r);return a&&e.concat(a)},[])},collectEvaluatedItems:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedItems")).reduce((e,[n,,o])=>{const a=!1!==e&&Me.getKeyword(n).collectEvaluatedItems(o,t,r);return!1!==a&&Math.max(e,a)},0)}},Je={Core:Me,Schema:$e,Instance:_,Keywords:{metaData:Ne,validate:Ze}},Ge=Je.Core,He=Je.Schema,Qe=Je.Instance,Xe=Je.Keywords;exports.Core=Ge,exports.Instance=Qe,exports.Keywords=Xe,exports.Schema=He,exports.default=Je;
*/function F(e){var t=String(e);if(q.test(t))return t;if(t.length>0&&!U.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(D,"\\$1")+'"'}function M(e){this.parameters=Object.create(null),this.type=e}var N={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],!q.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 M(n.toLowerCase());if(-1!==r){var a,i,s;for(C.lastIndex=r;i=C.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(R,"$1")),o.parameters[a]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},Z=async e=>Object.entries(await e),J=e((async(e,t)=>(await t).map(e))),W=e((async(e,t,r)=>(await r).reduce((async(t,r)=>e(await t,r)),t))),G=e((async(e,t,r={})=>W((async(t,r)=>await e(r)?t.concat([r]):t),[],t,r))),H=e((async(e,t)=>{const r=await J(e,t);return(await Promise.all(r)).some((e=>e))})),Q=e((async(e,t)=>{const r=await J(e,t);return(await Promise.all(r)).every((e=>e))})),X=e(((e,t)=>e.reduce((async(e,t)=>t(await e)),t))),Y={entries:Z,map:J,filter:G,reduce:W,some:H,every:Q,pipeline:X,all:e=>Promise.all(e),allValues:e=>X([Z,W((async(e,[t,r])=>(e[t]=await r,e)),{})],e)},ee=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(ne.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)?te(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+re(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=re(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:te(e)}};function te(e){return e+("/"===e[e.length-1]?"":"/")}function re(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 ne=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");var oe=fetch;const{jsonTypeOf:ae,splitUrl:ie}=v,se={},ce={},ue=(e,t)=>{const r=e in ce?ce[e]:e;if(r in se)return se[r][t]},le={},fe={},de=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=ie(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=ie(t)[0];if(!i&&!ie(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const s=be(i,e[o]||""),[c,u]=ie(s);delete e[o],u&&o===a&&(e[a]=a!==o?encodeURI(u):"#"+encodeURI(u)),i&&(fe[i]=c);const l={},f=ue(n,"recursiveAnchorToken");let d;!0===e[f]&&(l["#"]=c,e[a]="",delete e[f]);const p=ue(n,"vocabularyToken");ae(e[p],"object")?(ce[c]=n,d=e[p],delete e[p]):(ce[c]=n,d={[n]:!0});const h={};le[c]={id:c,schemaVersion:n,schema:pe(e,c,n,y.nil,h,l),anchors:h,dynamicAnchors:l,vocabulary:d,validated:!1}},pe=(e,t,r,n,o,a)=>{if(ae(e,"object")){const i="string"==typeof e.$schema?ie(e.$schema)[0]:r,s=ue(i,"embeddedToken"),c=ue(i,"anchorToken");if("string"==typeof e[s]&&(s!==c||"#"!==e[s][0])){const n=be(t,e[s]);return e[s]=n,de(e,n,r),O(e[s],e)}const u=ue(r,"anchorToken"),l=ue(r,"dynamicAnchorToken");"string"==typeof e[l]&&(a["#"+e[l]]=t,e[u]=e[l],delete e[l]);const f=ue(r,"embeddedToken");if("string"==typeof e[u]){const t=u!==f?e[u]:e[u].slice(1);o[t]=n,delete e[u]}const d=ue(r,"jrefToken");if("string"==typeof e[d])return O(e[d],e);for(let i in e)e[i]=pe(e[i],t,r,y.append(i,n),o,a);const p=ue(r,"jsrefToken");"string"==typeof e[p]&&(e[p]=O(e[p],e[p]));const h=ue(r,"dynamicJsrefToken");return"string"==typeof e[h]&&(e[h]=O(e[h],e[h],!0)),e}return Array.isArray(e)?e.map(((e,i)=>pe(e,t,r,y.append(i,n),o,a))):e},he=e=>le[fe[e]]||le[e],ye=Object.freeze({id:"",schemaVersion:void 0,pointer:"",schema:void 0,dynamicAnchors:{}}),me=async(e,t=ye,r=!1)=>{const n=r&&t.dynamicAnchors[e]?t.dynamicAnchors[e]:Oe(t),o=be(n,e),[a,i]=ie(o);if(!(e=>e in le||e in fe)(a)){const e=await oe(a,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error("Failed to retrieve schema with id: "+a);if(e.headers.has("content-type")){const t=N.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${a} is not a schema. Found a document with media type: ${t}`)}de(await e.json(),a)}const s=he(a),c=i&&"/"!==i[0]?ge(s,i):i,u=Object.freeze({id:s.id,schemaVersion:s.schemaVersion,vocabulary:s.vocabulary,pointer:c,schema:s.schema,value:y.get(c,s.schema),dynamicAnchors:{...s.dynamicAnchors,...t.dynamicAnchors},validated:s.validated});return ve(u)},ve=e=>E(e.value)?me(j(e.value),e,S(e.value)):e,be=(e,t)=>{const r=ee(e,t),n=ie(e)[0];if(n&&"file"===we(r)&&"file"!==we(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},we=e=>{const t=e.match(/^(.+):\/\//);return t?t[1]:""},ge=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},Oe=e=>`${e.id}#${encodeURI(e.pointer)}`,Ee=e=>E(e.value)?x(e.value):e.value,je=(e,t)=>{const r=he(t.id),n=Object.freeze({id:t.id,schemaVersion:t.schemaVersion,vocabulary:t.vocabulary,pointer:y.append(e,t.pointer),schema:r.schema,value:Ee(t)[e],dynamicAnchors:t.dynamicAnchors,validated:r.validated});return ve(n)},xe=e(((e,t)=>Y.pipeline([Ee,Y.map((async(r,n)=>e(await je(n,t),n))),Y.all],t)));var Se={setConfig:(e,t,r)=>{se[e]||(se[e]={}),se[e][t]=r},getConfig:ue,add:de,get:me,markValidated:e=>{le[e].validated=!0},uri:Oe,value:Ee,typeOf:(e,t)=>ae(Ee(e),t),has:(e,t)=>e in Ee(t),step:je,keys:e=>Object.keys(Ee(e)),entries:e=>Y.pipeline([Ee,Object.keys,Y.map((async t=>[t,await je(t,e)])),Y.all],e),map:xe,length:e=>Ee(e).length};class $e extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var Ae=$e;const Pe="FLAG",Te="BASIC",Ie="DETAILED",ke="VERBOSE";let Ve=Ie,ze=!0;const Ke=async e=>{const t={};return{ast:t,schemaUri:await Be(e,t)}},Le=e((({ast:e,schemaUri:t},r,o=Pe)=>{if(![Pe,Te,Ie,ke].includes(o))throw Error(`The '${o}' error format is not supported`);let a=[];const i=n.subscribe("result",_e(o,a));return Fe(t,r,e),n.unsubscribe(i),a[0]})),_e=(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===Te&&(o.push(...t.errors),delete t.errors),(e===ke||e!==Pe&&!t.valid)&&n.errors.unshift(...o)}r[r.length-1]=n,t[0]=n}}},Ce={},Ue=e=>Ce[e],qe=e=>e in Ce,Re={},De={},Be=async(e,t)=>{if(!qe(e.schemaVersion+"#validate")){const t=await Se.get(e.schemaVersion);(Se.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 Re)Object.entries(Re[e]).forEach((([e,r])=>{((e,t)=>{Ce[e]={collectEvaluatedItems:(e,r,n)=>t.interpret(e,r,n)&&0,collectEvaluatedProperties:(e,r,n)=>t.interpret(e,r,n)&&[],...t}})(`${t.id}#${e}`,r)}));else if(r)throw Error("Missing required vocabulary: "+e)}))}if(ze&&!e.validated){if(Se.markValidated(e.id),!(e.schemaVersion in De)){const t=await Se.get(e.schemaVersion),r={},n=await Be(t,r);De[t.id]=Le({ast:r,schemaUri:n})}const t=_.cons(e.schema,e.id),r=De[e.schemaVersion](t,Ve);if(!r.valid)throw new Ae(r)}return await Ue(e.schemaVersion+"#validate").compile(e,t),Se.uri(e)},Fe=(e,t,r)=>{const[n]=r[e];return Ue(n).interpret(e,t,r)};var Me={validate:async(e,t,r)=>{const n=await Ke(e),o=(e,t=Pe)=>Le(n,_.cons(e),t);return void 0===t?o:o(t,r)},compile:Ke,interpret:Le,setMetaOutputFormat:e=>{Ve=e},setShouldMetaValidate:e=>{ze=e},FLAG:Pe,BASIC:Te,DETAILED:Ie,VERBOSE:ke,getKeyword:Ue,hasKeyword:qe,defineVocabulary:(e,t)=>{Re[e]=t},compileSchema:Be,interpretSchema:Fe,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return Ue(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return Ue(o).collectEvaluatedItems(e,t,r,n)}};var Ne={compile:e=>Se.value(e),interpret:()=>!0};var Ze={compile:async(e,t)=>{const r=Se.uri(e);if(!(r in t)){t[r]=!1;const n=Se.value(e);t[r]=[e.schemaVersion+"#validate",Se.uri(e),"boolean"==typeof n?n:await Y.pipeline([Se.entries,Y.map((([t,r])=>[`${e.schemaVersion}#${t}`,r])),Y.filter((([t])=>Me.hasKeyword(t)&&t!==e.schemaVersion+"#validate")),Y.map((async([r,n])=>{const o=await Me.getKeyword(r).compile(n,t,e);return[r,Se.uri(n),o]})),Y.all],e)]}return r},interpret:(e,t,r)=>{const[o,a,i]=r[e];n.publishSync("result.start");const s="boolean"==typeof i?i:i.every((([e,o,a])=>{n.publishSync("result.start");const i=Me.getKeyword(e).interpret(a,t,r);return n.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:_.uri(t),valid:i,ast:a}),n.publishSync("result.end"),i}));return n.publishSync("result",{keyword:o,absoluteKeywordLocation:a,instanceLocation:_.uri(t),valid:s,ast:e}),n.publishSync("result.end"),s},collectEvaluatedProperties:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter((([e])=>!n||!e.endsWith("#unevaluatedProperties"))).reduce(((e,[n,,o])=>{const a=e&&Me.getKeyword(n).collectEvaluatedProperties(o,t,r);return a&&e.concat(a)}),[])},collectEvaluatedItems:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter((([e])=>!n||!e.endsWith("#unevaluatedItems"))).reduce(((e,[n,,o])=>{const a=!1!==e&&Me.getKeyword(n).collectEvaluatedItems(o,t,r);return!1!==a&&Math.max(e,a)}),0)}},Je={Core:Me,Schema:Se,Instance:_,Keywords:{metaData:Ne,validate:Ze}},We=Je.Core,Ge=Je.Schema,He=Je.Instance,Qe=Je.Keywords;exports.Core=We,exports.Instance=He,exports.Keywords=Qe,exports.Schema=Ge,exports.default=Je;
//# sourceMappingURL=json-schema-core-cjs.min.js.map

@@ -57,16 +57,8 @@ var justCurryIt = curry;

(function (root, factory){
var PubSub = {};
root.PubSub = PubSub;
var define = root.define;
factory(PubSub);
// AMD support
if (typeof define === 'function' && define.amd){
define(function() { return PubSub; });
// CommonJS and Node.js module support
} else {
// CommonJS and Node.js module support
{
if (module !== undefined && module.exports) {

@@ -77,3 +69,3 @@ exports = module.exports = PubSub; // Node.js specific `module.exports`

module.exports = exports = PubSub; // CommonJS
}
}

@@ -83,3 +75,4 @@ }(( typeof window === 'object' && window ) || commonjsGlobal, function (PubSub){

var messages = {},
lastUid = -1;
lastUid = -1,
ALL_SUBSCRIBING_MSG = '*';

@@ -151,8 +144,17 @@ function hasKeys(obj){

}
deliverMessage(message, ALL_SUBSCRIBING_MSG, data, immediateExceptions);
};
}
function hasDirectSubscribersFor( message ) {
var topic = String( message ),
found = Boolean(messages.hasOwnProperty( topic ) && hasKeys(messages[topic]));
return found;
}
function messageHasSubscribers( message ){
var topic = String( message ),
found = Boolean(messages.hasOwnProperty( topic ) && hasKeys(messages[topic])),
found = hasDirectSubscribersFor(topic) || hasDirectSubscribersFor(ALL_SUBSCRIBING_MSG),
position = topic.lastIndexOf( '.' );

@@ -163,3 +165,3 @@

position = topic.lastIndexOf( '.' );
found = Boolean(messages.hasOwnProperty( topic ) && hasKeys(messages[topic]));
found = hasDirectSubscribersFor(topic);
}

@@ -241,2 +243,6 @@

PubSub.subscribeAll = function( func ){
return PubSub.subscribe(ALL_SUBSCRIBING_MSG, func);
};
/**

@@ -1400,27 +1406,30 @@ * Subscribes the passed function to the passed message once

return (message, keywordResult) => {
const { keyword, absoluteKeywordLocation, instanceLocation, valid } = keywordResult;
const result = { keyword, absoluteKeywordLocation, instanceLocation, valid, errors: [] };
while (resultStack.length > 0 && isChild(resultStack[resultStack.length - 1], result)) {
const topResult = resultStack.pop();
let errors = [];
if (outputFormat === BASIC) {
errors = topResult.errors;
delete topResult.errors;
if (message === "result") {
const { keyword, absoluteKeywordLocation, instanceLocation, valid } = keywordResult;
const result = { keyword, absoluteKeywordLocation, instanceLocation, valid, errors: [] };
resultStack.push(result);
} else if (message === "result.start") {
resultStack.push(message);
} else if (message === "result.end") {
const result = resultStack.pop();
while (resultStack[resultStack.length - 1] !== "result.start") {
const topResult = resultStack.pop();
const errors = [topResult];
if (outputFormat === BASIC) {
errors.push(...topResult.errors);
delete topResult.errors;
}
if (outputFormat === VERBOSE || (outputFormat !== FLAG && !topResult.valid)) {
result.errors.unshift(...errors);
}
}
result.errors.unshift(topResult, ...errors);
}
resultStack[resultStack.length - 1] = result;
if (outputFormat === VERBOSE || (outputFormat !== FLAG && !result.valid)) {
resultStack.push(result);
output[0] = result;
}
output[0] = result;
};
};
const isChild = (topResult, nextResult) => {
return topResult.absoluteKeywordLocation.startsWith(nextResult.absoluteKeywordLocation)
|| nextResult.keyword.endsWith("#validate") && topResult.instanceLocation === nextResult.instanceLocation;
};
const setMetaOutputFormat = (format) => {

@@ -1550,2 +1559,4 @@ metaOutputFormat = format;

}
return url;
};

@@ -1556,4 +1567,6 @@

pubsub.publishSync("result.start");
const isValid = typeof nodes === "boolean" ? nodes : nodes
.every(([keywordId, schemaUrl, keywordValue]) => {
pubsub.publishSync("result.start");
const isValid = core.getKeyword(keywordId).interpret(keywordValue, instance$1, ast);

@@ -1568,2 +1581,3 @@

});
pubsub.publishSync("result.end");
return isValid;

@@ -1579,2 +1593,3 @@ });

});
pubsub.publishSync("result.end");
return isValid;

@@ -1581,0 +1596,0 @@ };

@@ -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){!function(t,n){var o={};t.PubSub=o;var a=t.define;!function(e){var t={},r=-1;function n(e){var t;for(t in e)if(e.hasOwnProperty(t))return!0;return!1}function o(e){return function(){throw e}}function a(e,t,r){try{e(t,r)}catch(e){setTimeout(o(e),0)}}function i(e,t,r){e(t,r)}function s(e,r,n,o){var s,c=t[r],u=o?i:a;if(t.hasOwnProperty(r))for(s in c)c.hasOwnProperty(s)&&u(c[s],e,n)}function c(e,t,r){return function(){var n=String(e),o=n.lastIndexOf(".");for(s(e,e,t,r);-1!==o;)o=(n=n.substr(0,o)).lastIndexOf("."),s(e,n,t,r)}}function u(e){for(var r=String(e),o=Boolean(t.hasOwnProperty(r)&&n(t[r])),a=r.lastIndexOf(".");!o&&-1!==a;)a=(r=r.substr(0,a)).lastIndexOf("."),o=Boolean(t.hasOwnProperty(r)&&n(t[r]));return o}function l(e,t,r,n){var o=c(e="symbol"==typeof e?e.toString():e,t,n);return!!u(e)&&(!0===r?o():setTimeout(o,0),!0)}e.publish=function(t,r){return l(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return l(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,t.hasOwnProperty(e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},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)t.hasOwnProperty(r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n=0;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n++;return n},e.getSubscriptions=function(e){var r,n=[];for(r in t)t.hasOwnProperty(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(t.hasOwnProperty(r)&&0===r.indexOf(e))return!0;return!1},s="string"==typeof r&&(t.hasOwnProperty(r)||i(r)),c=!s&&"string"==typeof r,u="function"==typeof r,l=!1;if(!s){for(n in t)if(t.hasOwnProperty(n)){if(o=t[n],c&&o[r]){delete o[r],l=r;break}if(u)for(a in o)o.hasOwnProperty(a)&&o[a]===r&&(delete o[a],l=!0)}return l}e.clearSubscriptions(r)}}(o),"function"==typeof a&&a.amd?a((function(){return o})):(void 0!==e&&e.exports&&(r=e.exports=o),r.PubSub=o,e.exports=r=o)}("object"==typeof window&&window||t)}(r={exports:{}},r.exports),r.exports);n.PubSub;const o=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(f)},a=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:a(e,p(t,o,n),r,u(o,n))}}if(Array.isArray(t)){const n=[...t];return n[d(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:p(t,e[0],n)},i=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||h(t)){const o=e.shift();i(e,p(t,o,n),r,u(o,n))}else{t[d(t,e[0])]=r}},s=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=p(t,n,r);return{...t,[n]:s(e,o,u(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 p(t,e[0],r)}},c=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=p(t,n,r);c(e,o,u(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:p(t,e[0],r)},u=e((e,t)=>t+"/"+l(e)),l=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),f=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),d=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,p=(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(h(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[d(e,t)]},h=e=>null===e||"object"!=typeof e;var y={nil:"",append:u,get:(e,t)=>{const r=o(e),n=e=>r.reduce(([e,t],r)=>[p(e,r,t),u(r,t)],[e,""])[0];return void 0===t?n:n(t)},set:(t,r,n)=>{const i=o(t),s=e((e,t)=>a(i,e,t,""));return void 0===r?s:s(r,n)},assign:(t,r,n)=>{const a=o(t),s=e((e,t)=>i(a,e,t,""));return void 0===r?s:s(r,n)},unset:(e,t)=>{const r=o(e),n=e=>s(r,e,"");return void 0===t?n:n(t)},delete:(e,t)=>{const r=o(e),n=e=>c(r,e,"");return void 0===t?n:n(t)}};const m={null:e=>null===e,boolean:e=>"boolean"==typeof e,object:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,array:e=>Array.isArray(e),number:e=>"number"==typeof e,integer:e=>Number.isInteger(e),string:e=>"string"==typeof e};var v={jsonTypeOf:(e,t)=>m[t](e),splitUrl: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)]}};const b=Symbol("$__value"),w=Symbol("$__href"),g=Symbol("$__isDynamic");var O=(e,t,r=!1)=>Object.freeze({[w]:e,[b]:t,[g]:r}),E=e=>e&&void 0!==e[w],j=e=>e[w],$=e=>e[b],A=e=>e[g];const{jsonTypeOf:x}=v,P=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),S=e=>E(e.value)?$(e.value):e.value,T=e((e,t)=>x(S(e),t)),I=(e,t)=>Object.freeze({...t,pointer:y.append(e,t.pointer),value:S(t)[e]}),k=e((e,t)=>S(t).map((r,n,o,a)=>e(I(n,t),n,o,a))),V=e((e,t)=>S(t).map((e,r,n,o)=>I(r,t)).filter((t,r,n,o)=>e(t,r,n,o))),L=e((e,t,r)=>S(r).reduce((t,n,o)=>e(t,I(o,r),o),t)),K=e((e,t)=>S(t).every((r,n,o,a)=>e(I(n,t),n,o,a))),z=e((e,t)=>S(t).some((r,n,o,a)=>e(I(n,t),n,o,a)));var C={cons:(e,t="")=>Object.freeze({...P,id:t,instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:S,typeOf:T,step:I,entries:e=>Object.keys(S(e)).map(t=>[t,I(t,e)]),keys:e=>Object.keys(S(e)),map:k,filter:V,reduce:L,every:K,some:z,length:e=>S(e).length},U=/; *([!#$%&'*+.^_`|~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-]+$/,R=/\\([\u000b\u0020-\u00ff])/g,B=/([\\"])/g,D=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
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(e.hasOwnProperty(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],u=o?s:i;if(t.hasOwnProperty(r))for(a in c)c.hasOwnProperty(a)&&u(c[a],e,n)}function u(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 l(e){var r=String(e);return Boolean(t.hasOwnProperty(r)&&o(t[r]))}function f(e){for(var t=String(e),r=l(t)||l(n),o=t.lastIndexOf(".");!r&&-1!==o;)o=(t=t.substr(0,o)).lastIndexOf("."),r=l(t);return r}function d(e,t,r,n){var o=u(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 d(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return d(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,t.hasOwnProperty(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)t.hasOwnProperty(r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n=0;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n++;return n},e.getSubscriptions=function(e){var r,n=[];for(r in t)t.hasOwnProperty(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(t.hasOwnProperty(r)&&0===r.indexOf(e))return!0;return!1},s="string"==typeof r&&(t.hasOwnProperty(r)||i(r)),c=!s&&"string"==typeof r,u="function"==typeof r,l=!1;if(!s){for(n in t)if(t.hasOwnProperty(n)){if(o=t[n],c&&o[r]){delete o[r],l=r;break}if(u)for(a in o)o.hasOwnProperty(a)&&o[a]===r&&(delete o[a],l=!0)}return l}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;const o=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(f)},a=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:a(e,p(t,o,n),r,u(o,n))}}if(Array.isArray(t)){const n=[...t];return n[d(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:p(t,e[0],n)},i=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||h(t)){const o=e.shift();i(e,p(t,o,n),r,u(o,n))}else{t[d(t,e[0])]=r}},s=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=p(t,n,r);return{...t,[n]:s(e,o,u(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 p(t,e[0],r)}},c=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=p(t,n,r);c(e,o,u(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:p(t,e[0],r)},u=e(((e,t)=>t+"/"+l(e))),l=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),f=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),d=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,p=(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(h(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[d(e,t)]},h=e=>null===e||"object"!=typeof e;var y={nil:"",append:u,get:(e,t)=>{const r=o(e),n=e=>r.reduce((([e,t],r)=>[p(e,r,t),u(r,t)]),[e,""])[0];return void 0===t?n:n(t)},set:(t,r,n)=>{const i=o(t),s=e(((e,t)=>a(i,e,t,"")));return void 0===r?s:s(r,n)},assign:(t,r,n)=>{const a=o(t),s=e(((e,t)=>i(a,e,t,"")));return void 0===r?s:s(r,n)},unset:(e,t)=>{const r=o(e),n=e=>s(r,e,"");return void 0===t?n:n(t)},delete:(e,t)=>{const r=o(e),n=e=>c(r,e,"");return void 0===t?n:n(t)}};const m={null:e=>null===e,boolean:e=>"boolean"==typeof e,object:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,array:e=>Array.isArray(e),number:e=>"number"==typeof e,integer:e=>Number.isInteger(e),string:e=>"string"==typeof e};var v={jsonTypeOf:(e,t)=>m[t](e),splitUrl: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)]}};const b=Symbol("$__value"),w=Symbol("$__href"),g=Symbol("$__isDynamic");var O=(e,t,r=!1)=>Object.freeze({[w]:e,[b]:t,[g]:r}),E=e=>e&&void 0!==e[w],S=e=>e[w],j=e=>e[b],$=e=>e[g];const{jsonTypeOf:A}=v,x=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),P=e=>E(e.value)?j(e.value):e.value,T=e(((e,t)=>A(P(e),t))),I=(e,t)=>Object.freeze({...t,pointer:y.append(e,t.pointer),value:P(t)[e]}),k=e(((e,t)=>P(t).map(((r,n,o,a)=>e(I(n,t),n,o,a))))),V=e(((e,t)=>P(t).map(((e,r,n,o)=>I(r,t))).filter(((t,r,n,o)=>e(t,r,n,o))))),z=e(((e,t,r)=>P(r).reduce(((t,n,o)=>e(t,I(o,r),o)),t))),K=e(((e,t)=>P(t).every(((r,n,o,a)=>e(I(n,t),n,o,a))))),L=e(((e,t)=>P(t).some(((r,n,o,a)=>e(I(n,t),n,o,a)))));var C={cons:(e,t="")=>Object.freeze({...x,id:t,instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:P,typeOf:T,step:I,entries:e=>Object.keys(P(e)).map((t=>[t,I(t,e)])),keys:e=>Object.keys(P(e)),map:k,filter:V,reduce:z,every:K,some:L,length:e=>P(e).length},U=/; *([!#$%&'*+.^_`|~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-]+$/,R=/\\([\u000b\u0020-\u00ff])/g,D=/([\\"])/g,B=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
/*!

@@ -6,3 +6,3 @@ * content-type

* MIT Licensed
*/function W(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(B,"\\$1")+'"'}function F(e){this.parameters=Object.create(null),this.type=e}var N={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!D.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+"="+W(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(!D.test(n))throw new TypeError("invalid media type");var o=new F(n.toLowerCase());if(-1!==r){var a,i,s;for(U.lastIndex=r;i=U.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(R,"$1")),o.parameters[a]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},Z=async e=>Object.entries(await e),J=e(async(e,t)=>(await t).map(e)),M=e(async(e,t,r)=>(await r).reduce(async(t,r)=>e(await t,r),t)),G=e(async(e,t,r={})=>M(async(t,r)=>await e(r)?t.concat([r]):t,[],t,r)),H=e(async(e,t)=>{const r=await J(e,t);return(await Promise.all(r)).some(e=>e)}),Q=e(async(e,t)=>{const r=await J(e,t);return(await Promise.all(r)).every(e=>e)}),X=e((e,t)=>e.reduce(async(e,t)=>t(await e),t)),Y={entries:Z,map:J,filter:G,reduce:M,some:H,every:Q,pipeline:X,all:e=>Promise.all(e),allValues:e=>X([Z,M(async(e,[t,r])=>(e[t]=await r,e),{})],e)},ee=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(ne.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)?te(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+re(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=re(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:te(e)}};function te(e){return e+("/"===e[e.length-1]?"":"/")}function re(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 ne=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");var oe=fetch;const{jsonTypeOf:ae,splitUrl:ie}=v,se={},ce={},ue=(e,t)=>{const r=e in ce?ce[e]:e;if(r in se)return se[r][t]},le={},fe={},de=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=ie(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=ie(t)[0];if(!i&&!ie(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const s=be(i,e[o]||""),[c,u]=ie(s);delete e[o],u&&o===a&&(e[a]=a!==o?encodeURI(u):"#"+encodeURI(u)),i&&(fe[i]=c);const l={},f=ue(n,"recursiveAnchorToken");let d;!0===e[f]&&(l["#"]=c,e[a]="",delete e[f]);const p=ue(n,"vocabularyToken");ae(e[p],"object")?(ce[c]=n,d=e[p],delete e[p]):(ce[c]=n,d={[n]:!0});const h={};le[c]={id:c,schemaVersion:n,schema:pe(e,c,n,y.nil,h,l),anchors:h,dynamicAnchors:l,vocabulary:d,validated:!1}},pe=(e,t,r,n,o,a)=>{if(ae(e,"object")){const i="string"==typeof e.$schema?ie(e.$schema)[0]:r,s=ue(i,"embeddedToken"),c=ue(i,"anchorToken");if("string"==typeof e[s]&&(s!==c||"#"!==e[s][0])){const n=be(t,e[s]);return e[s]=n,de(e,n,r),O(e[s],e)}const u=ue(r,"anchorToken"),l=ue(r,"dynamicAnchorToken");"string"==typeof e[l]&&(a["#"+e[l]]=t,e[u]=e[l],delete e[l]);const f=ue(r,"embeddedToken");if("string"==typeof e[u]){const t=u!==f?e[u]:e[u].slice(1);o[t]=n,delete e[u]}const d=ue(r,"jrefToken");if("string"==typeof e[d])return O(e[d],e);for(let i in e)e[i]=pe(e[i],t,r,y.append(i,n),o,a);const p=ue(r,"jsrefToken");"string"==typeof e[p]&&(e[p]=O(e[p],e[p]));const h=ue(r,"dynamicJsrefToken");return"string"==typeof e[h]&&(e[h]=O(e[h],e[h],!0)),e}return Array.isArray(e)?e.map((e,i)=>pe(e,t,r,y.append(i,n),o,a)):e},he=e=>le[fe[e]]||le[e],ye=Object.freeze({id:"",schemaVersion:void 0,pointer:"",schema:void 0,dynamicAnchors:{}}),me=async(e,t=ye,r=!1)=>{const n=r&&t.dynamicAnchors[e]?t.dynamicAnchors[e]:Oe(t),o=be(n,e),[a,i]=ie(o);if(!(e=>e in le||e in fe)(a)){const e=await oe(a,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error("Failed to retrieve schema with id: "+a);if(e.headers.has("content-type")){const t=N.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${a} is not a schema. Found a document with media type: ${t}`)}de(await e.json(),a)}const s=he(a),c=i&&"/"!==i[0]?ge(s,i):i,u=Object.freeze({id:s.id,schemaVersion:s.schemaVersion,vocabulary:s.vocabulary,pointer:c,schema:s.schema,value:y.get(c,s.schema),dynamicAnchors:{...s.dynamicAnchors,...t.dynamicAnchors},validated:s.validated});return ve(u)},ve=e=>E(e.value)?me(j(e.value),e,A(e.value)):e,be=(e,t)=>{const r=ee(e,t),n=ie(e)[0];if(n&&"file"===we(r)&&"file"!==we(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},we=e=>{const t=e.match(/^(.+):\/\//);return t?t[1]:""},ge=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},Oe=e=>`${e.id}#${encodeURI(e.pointer)}`,Ee=e=>E(e.value)?$(e.value):e.value,je=(e,t)=>{const r=he(t.id),n=Object.freeze({id:t.id,schemaVersion:t.schemaVersion,vocabulary:t.vocabulary,pointer:y.append(e,t.pointer),schema:r.schema,value:Ee(t)[e],dynamicAnchors:t.dynamicAnchors,validated:r.validated});return ve(n)},$e=e((e,t)=>Y.pipeline([Ee,Y.map(async(r,n)=>e(await je(n,t),n)),Y.all],t));var Ae={setConfig:(e,t,r)=>{se[e]||(se[e]={}),se[e][t]=r},getConfig:ue,add:de,get:me,markValidated:e=>{le[e].validated=!0},uri:Oe,value:Ee,typeOf:(e,t)=>ae(Ee(e),t),has:(e,t)=>e in Ee(t),step:je,keys:e=>Object.keys(Ee(e)),entries:e=>Y.pipeline([Ee,Object.keys,Y.map(async t=>[t,await je(t,e)]),Y.all],e),map:$e,length:e=>Ee(e).length};class xe extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var Pe=xe;const Se="FLAG",Te="BASIC",Ie="DETAILED",ke="VERBOSE";let Ve=Ie,Le=!0;const Ke=async e=>{const t={};return{ast:t,schemaUri:await We(e,t)}},ze=e(({ast:e,schemaUri:t},r,o=Se)=>{if(![Se,Te,Ie,ke].includes(o))throw Error(`The '${o}' error format is not supported`);let a=[];const i=n.subscribe("result",Ce(o,a));return Fe(t,r,e),n.unsubscribe(i),a[0]}),Ce=(e,t)=>{const r=[];return(n,o)=>{const{keyword:a,absoluteKeywordLocation:i,instanceLocation:s,valid:c}=o,u={keyword:a,absoluteKeywordLocation:i,instanceLocation:s,valid:c,errors:[]};for(;r.length>0&&Ue(r[r.length-1],u);){const t=r.pop();let n=[];e===Te&&(n=t.errors,delete t.errors),u.errors.unshift(t,...n)}(e===ke||e!==Se&&!u.valid)&&r.push(u),t[0]=u}},Ue=(e,t)=>e.absoluteKeywordLocation.startsWith(t.absoluteKeywordLocation)||t.keyword.endsWith("#validate")&&e.instanceLocation===t.instanceLocation,qe={},_e=e=>qe[e],Re=e=>e in qe,Be={},De={},We=async(e,t)=>{if(!Re(e.schemaVersion+"#validate")){const t=await Ae.get(e.schemaVersion);(Ae.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 Be)Object.entries(Be[e]).forEach(([e,r])=>{((e,t)=>{qe[e]={collectEvaluatedItems:(e,r,n)=>t.interpret(e,r,n)&&0,collectEvaluatedProperties:(e,r,n)=>t.interpret(e,r,n)&&[],...t}})(`${t.id}#${e}`,r)});else if(r)throw Error("Missing required vocabulary: "+e)})}if(Le&&!e.validated){if(Ae.markValidated(e.id),!(e.schemaVersion in De)){const t=await Ae.get(e.schemaVersion),r={},n=await We(t,r);De[t.id]=ze({ast:r,schemaUri:n})}const t=C.cons(e.schema,e.id),r=De[e.schemaVersion](t,Ve);if(!r.valid)throw new Pe(r)}return await _e(e.schemaVersion+"#validate").compile(e,t),Ae.uri(e)},Fe=(e,t,r)=>{const[n]=r[e];return _e(n).interpret(e,t,r)};var Ne={validate:async(e,t,r)=>{const n=await Ke(e),o=(e,t=Se)=>ze(n,C.cons(e),t);return void 0===t?o:o(t,r)},compile:Ke,interpret:ze,setMetaOutputFormat:e=>{Ve=e},setShouldMetaValidate:e=>{Le=e},FLAG:Se,BASIC:Te,DETAILED:Ie,VERBOSE:ke,getKeyword:_e,hasKeyword:Re,defineVocabulary:(e,t)=>{Be[e]=t},compileSchema:We,interpretSchema:Fe,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return _e(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return _e(o).collectEvaluatedItems(e,t,r,n)}};var Ze={compile:e=>Ae.value(e),interpret:()=>!0};var Je={compile:async(e,t)=>{const r=Ae.uri(e);if(!(r in t)){t[r]=!1;const n=Ae.value(e);t[r]=[e.schemaVersion+"#validate",Ae.uri(e),"boolean"==typeof n?n:await Y.pipeline([Ae.entries,Y.map(([t,r])=>[`${e.schemaVersion}#${t}`,r]),Y.filter(([t])=>Ne.hasKeyword(t)&&t!==e.schemaVersion+"#validate"),Y.map(async([r,n])=>{const o=await Ne.getKeyword(r).compile(n,t,e);return[r,Ae.uri(n),o]}),Y.all],e)]}},interpret:(e,t,r)=>{const[o,a,i]=r[e],s="boolean"==typeof i?i:i.every(([e,o,a])=>{const i=Ne.getKeyword(e).interpret(a,t,r);return n.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:C.uri(t),valid:i,ast:a}),i});return n.publishSync("result",{keyword:o,absoluteKeywordLocation:a,instanceLocation:C.uri(t),valid:s,ast:e}),s},collectEvaluatedProperties:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedProperties")).reduce((e,[n,,o])=>{const a=e&&Ne.getKeyword(n).collectEvaluatedProperties(o,t,r);return a&&e.concat(a)},[])},collectEvaluatedItems:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedItems")).reduce((e,[n,,o])=>{const a=!1!==e&&Ne.getKeyword(n).collectEvaluatedItems(o,t,r);return!1!==a&&Math.max(e,a)},0)}},Me={Core:Ne,Schema:Ae,Instance:C,Keywords:{metaData:Ze,validate:Je}},Ge=Me.Core,He=Me.Schema,Qe=Me.Instance,Xe=Me.Keywords;export default Me;export{Ge as Core,Qe as Instance,Xe as Keywords,He as Schema};
*/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(D,"\\$1")+'"'}function N(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||!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 N(n.toLowerCase());if(-1!==r){var a,i,s;for(U.lastIndex=r;i=U.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(R,"$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))),W=e((async(e,t,r)=>(await r).reduce((async(t,r)=>e(await t,r)),t))),G=e((async(e,t,r={})=>W((async(t,r)=>await e(r)?t.concat([r]):t),[],t,r))),H=e((async(e,t)=>{const r=await M(e,t);return(await Promise.all(r)).some((e=>e))})),Q=e((async(e,t)=>{const r=await M(e,t);return(await Promise.all(r)).every((e=>e))})),X=e(((e,t)=>e.reduce((async(e,t)=>t(await e)),t))),Y={entries:J,map:M,filter:G,reduce:W,some:H,every:Q,pipeline:X,all:e=>Promise.all(e),allValues:e=>X([J,W((async(e,[t,r])=>(e[t]=await r,e)),{})],e)},ee=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(ne.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)?te(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+re(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=re(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:te(e)}};function te(e){return e+("/"===e[e.length-1]?"":"/")}function re(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 ne=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");var oe=fetch;const{jsonTypeOf:ae,splitUrl:ie}=v,se={},ce={},ue=(e,t)=>{const r=e in ce?ce[e]:e;if(r in se)return se[r][t]},le={},fe={},de=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=ie(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=ie(t)[0];if(!i&&!ie(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const s=be(i,e[o]||""),[c,u]=ie(s);delete e[o],u&&o===a&&(e[a]=a!==o?encodeURI(u):"#"+encodeURI(u)),i&&(fe[i]=c);const l={},f=ue(n,"recursiveAnchorToken");let d;!0===e[f]&&(l["#"]=c,e[a]="",delete e[f]);const p=ue(n,"vocabularyToken");ae(e[p],"object")?(ce[c]=n,d=e[p],delete e[p]):(ce[c]=n,d={[n]:!0});const h={};le[c]={id:c,schemaVersion:n,schema:pe(e,c,n,y.nil,h,l),anchors:h,dynamicAnchors:l,vocabulary:d,validated:!1}},pe=(e,t,r,n,o,a)=>{if(ae(e,"object")){const i="string"==typeof e.$schema?ie(e.$schema)[0]:r,s=ue(i,"embeddedToken"),c=ue(i,"anchorToken");if("string"==typeof e[s]&&(s!==c||"#"!==e[s][0])){const n=be(t,e[s]);return e[s]=n,de(e,n,r),O(e[s],e)}const u=ue(r,"anchorToken"),l=ue(r,"dynamicAnchorToken");"string"==typeof e[l]&&(a["#"+e[l]]=t,e[u]=e[l],delete e[l]);const f=ue(r,"embeddedToken");if("string"==typeof e[u]){const t=u!==f?e[u]:e[u].slice(1);o[t]=n,delete e[u]}const d=ue(r,"jrefToken");if("string"==typeof e[d])return O(e[d],e);for(let i in e)e[i]=pe(e[i],t,r,y.append(i,n),o,a);const p=ue(r,"jsrefToken");"string"==typeof e[p]&&(e[p]=O(e[p],e[p]));const h=ue(r,"dynamicJsrefToken");return"string"==typeof e[h]&&(e[h]=O(e[h],e[h],!0)),e}return Array.isArray(e)?e.map(((e,i)=>pe(e,t,r,y.append(i,n),o,a))):e},he=e=>le[fe[e]]||le[e],ye=Object.freeze({id:"",schemaVersion:void 0,pointer:"",schema:void 0,dynamicAnchors:{}}),me=async(e,t=ye,r=!1)=>{const n=r&&t.dynamicAnchors[e]?t.dynamicAnchors[e]:Oe(t),o=be(n,e),[a,i]=ie(o);if(!(e=>e in le||e in fe)(a)){const e=await oe(a,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error("Failed to retrieve schema with id: "+a);if(e.headers.has("content-type")){const t=Z.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${a} is not a schema. Found a document with media type: ${t}`)}de(await e.json(),a)}const s=he(a),c=i&&"/"!==i[0]?ge(s,i):i,u=Object.freeze({id:s.id,schemaVersion:s.schemaVersion,vocabulary:s.vocabulary,pointer:c,schema:s.schema,value:y.get(c,s.schema),dynamicAnchors:{...s.dynamicAnchors,...t.dynamicAnchors},validated:s.validated});return ve(u)},ve=e=>E(e.value)?me(S(e.value),e,$(e.value)):e,be=(e,t)=>{const r=ee(e,t),n=ie(e)[0];if(n&&"file"===we(r)&&"file"!==we(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},we=e=>{const t=e.match(/^(.+):\/\//);return t?t[1]:""},ge=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},Oe=e=>`${e.id}#${encodeURI(e.pointer)}`,Ee=e=>E(e.value)?j(e.value):e.value,Se=(e,t)=>{const r=he(t.id),n=Object.freeze({id:t.id,schemaVersion:t.schemaVersion,vocabulary:t.vocabulary,pointer:y.append(e,t.pointer),schema:r.schema,value:Ee(t)[e],dynamicAnchors:t.dynamicAnchors,validated:r.validated});return ve(n)},je=e(((e,t)=>Y.pipeline([Ee,Y.map((async(r,n)=>e(await Se(n,t),n))),Y.all],t)));var $e={setConfig:(e,t,r)=>{se[e]||(se[e]={}),se[e][t]=r},getConfig:ue,add:de,get:me,markValidated:e=>{le[e].validated=!0},uri:Oe,value:Ee,typeOf:(e,t)=>ae(Ee(e),t),has:(e,t)=>e in Ee(t),step:Se,keys:e=>Object.keys(Ee(e)),entries:e=>Y.pipeline([Ee,Object.keys,Y.map((async t=>[t,await Se(t,e)])),Y.all],e),map:je,length:e=>Ee(e).length};class Ae extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var xe=Ae;const Pe="FLAG",Te="BASIC",Ie="DETAILED",ke="VERBOSE";let Ve=Ie,ze=!0;const Ke=async e=>{const t={};return{ast:t,schemaUri:await Be(e,t)}},Le=e((({ast:e,schemaUri:t},r,o=Pe)=>{if(![Pe,Te,Ie,ke].includes(o))throw Error(`The '${o}' error format is not supported`);let a=[];const i=n.subscribe("result",Ce(o,a));return Fe(t,r,e),n.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===Te&&(o.push(...t.errors),delete t.errors),(e===ke||e!==Pe&&!t.valid)&&n.errors.unshift(...o)}r[r.length-1]=n,t[0]=n}}},Ue={},qe=e=>Ue[e],_e=e=>e in Ue,Re={},De={},Be=async(e,t)=>{if(!_e(e.schemaVersion+"#validate")){const t=await $e.get(e.schemaVersion);($e.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 Re)Object.entries(Re[e]).forEach((([e,r])=>{((e,t)=>{Ue[e]={collectEvaluatedItems:(e,r,n)=>t.interpret(e,r,n)&&0,collectEvaluatedProperties:(e,r,n)=>t.interpret(e,r,n)&&[],...t}})(`${t.id}#${e}`,r)}));else if(r)throw Error("Missing required vocabulary: "+e)}))}if(ze&&!e.validated){if($e.markValidated(e.id),!(e.schemaVersion in De)){const t=await $e.get(e.schemaVersion),r={},n=await Be(t,r);De[t.id]=Le({ast:r,schemaUri:n})}const t=C.cons(e.schema,e.id),r=De[e.schemaVersion](t,Ve);if(!r.valid)throw new xe(r)}return await qe(e.schemaVersion+"#validate").compile(e,t),$e.uri(e)},Fe=(e,t,r)=>{const[n]=r[e];return qe(n).interpret(e,t,r)};var Ne={validate:async(e,t,r)=>{const n=await Ke(e),o=(e,t=Pe)=>Le(n,C.cons(e),t);return void 0===t?o:o(t,r)},compile:Ke,interpret:Le,setMetaOutputFormat:e=>{Ve=e},setShouldMetaValidate:e=>{ze=e},FLAG:Pe,BASIC:Te,DETAILED:Ie,VERBOSE:ke,getKeyword:qe,hasKeyword:_e,defineVocabulary:(e,t)=>{Re[e]=t},compileSchema:Be,interpretSchema:Fe,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return qe(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return qe(o).collectEvaluatedItems(e,t,r,n)}};var Ze={compile:e=>$e.value(e),interpret:()=>!0};var Je={compile:async(e,t)=>{const r=$e.uri(e);if(!(r in t)){t[r]=!1;const n=$e.value(e);t[r]=[e.schemaVersion+"#validate",$e.uri(e),"boolean"==typeof n?n:await Y.pipeline([$e.entries,Y.map((([t,r])=>[`${e.schemaVersion}#${t}`,r])),Y.filter((([t])=>Ne.hasKeyword(t)&&t!==e.schemaVersion+"#validate")),Y.map((async([r,n])=>{const o=await Ne.getKeyword(r).compile(n,t,e);return[r,$e.uri(n),o]})),Y.all],e)]}return r},interpret:(e,t,r)=>{const[o,a,i]=r[e];n.publishSync("result.start");const s="boolean"==typeof i?i:i.every((([e,o,a])=>{n.publishSync("result.start");const i=Ne.getKeyword(e).interpret(a,t,r);return n.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:C.uri(t),valid:i,ast:a}),n.publishSync("result.end"),i}));return n.publishSync("result",{keyword:o,absoluteKeywordLocation:a,instanceLocation:C.uri(t),valid:s,ast:e}),n.publishSync("result.end"),s},collectEvaluatedProperties:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter((([e])=>!n||!e.endsWith("#unevaluatedProperties"))).reduce(((e,[n,,o])=>{const a=e&&Ne.getKeyword(n).collectEvaluatedProperties(o,t,r);return a&&e.concat(a)}),[])},collectEvaluatedItems:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter((([e])=>!n||!e.endsWith("#unevaluatedItems"))).reduce(((e,[n,,o])=>{const a=!1!==e&&Ne.getKeyword(n).collectEvaluatedItems(o,t,r);return!1!==a&&Math.max(e,a)}),0)}},Me={Core:Ne,Schema:$e,Instance:C,Keywords:{metaData:Ze,validate:Je}},We=Me.Core,Ge=Me.Schema,He=Me.Instance,Qe=Me.Keywords;export default Me;export{We as Core,He as Instance,Qe as Keywords,Ge as Schema};
//# sourceMappingURL=json-schema-core-esm.min.js.map

@@ -60,16 +60,8 @@ var JSC = (function (exports) {

(function (root, factory){
var PubSub = {};
root.PubSub = PubSub;
var define = root.define;
factory(PubSub);
// AMD support
if (typeof define === 'function' && define.amd){
define(function() { return PubSub; });
// CommonJS and Node.js module support
} else {
// CommonJS and Node.js module support
{
if (module !== undefined && module.exports) {

@@ -80,3 +72,3 @@ exports = module.exports = PubSub; // Node.js specific `module.exports`

module.exports = exports = PubSub; // CommonJS
}
}

@@ -86,3 +78,4 @@ }(( typeof window === 'object' && window ) || commonjsGlobal, function (PubSub){

var messages = {},
lastUid = -1;
lastUid = -1,
ALL_SUBSCRIBING_MSG = '*';

@@ -154,8 +147,17 @@ function hasKeys(obj){

}
deliverMessage(message, ALL_SUBSCRIBING_MSG, data, immediateExceptions);
};
}
function hasDirectSubscribersFor( message ) {
var topic = String( message ),
found = Boolean(messages.hasOwnProperty( topic ) && hasKeys(messages[topic]));
return found;
}
function messageHasSubscribers( message ){
var topic = String( message ),
found = Boolean(messages.hasOwnProperty( topic ) && hasKeys(messages[topic])),
found = hasDirectSubscribersFor(topic) || hasDirectSubscribersFor(ALL_SUBSCRIBING_MSG),
position = topic.lastIndexOf( '.' );

@@ -166,3 +168,3 @@

position = topic.lastIndexOf( '.' );
found = Boolean(messages.hasOwnProperty( topic ) && hasKeys(messages[topic]));
found = hasDirectSubscribersFor(topic);
}

@@ -244,2 +246,6 @@

PubSub.subscribeAll = function( func ){
return PubSub.subscribe(ALL_SUBSCRIBING_MSG, func);
};
/**

@@ -1403,27 +1409,30 @@ * Subscribes the passed function to the passed message once

return (message, keywordResult) => {
const { keyword, absoluteKeywordLocation, instanceLocation, valid } = keywordResult;
const result = { keyword, absoluteKeywordLocation, instanceLocation, valid, errors: [] };
while (resultStack.length > 0 && isChild(resultStack[resultStack.length - 1], result)) {
const topResult = resultStack.pop();
let errors = [];
if (outputFormat === BASIC) {
errors = topResult.errors;
delete topResult.errors;
if (message === "result") {
const { keyword, absoluteKeywordLocation, instanceLocation, valid } = keywordResult;
const result = { keyword, absoluteKeywordLocation, instanceLocation, valid, errors: [] };
resultStack.push(result);
} else if (message === "result.start") {
resultStack.push(message);
} else if (message === "result.end") {
const result = resultStack.pop();
while (resultStack[resultStack.length - 1] !== "result.start") {
const topResult = resultStack.pop();
const errors = [topResult];
if (outputFormat === BASIC) {
errors.push(...topResult.errors);
delete topResult.errors;
}
if (outputFormat === VERBOSE || (outputFormat !== FLAG && !topResult.valid)) {
result.errors.unshift(...errors);
}
}
result.errors.unshift(topResult, ...errors);
}
resultStack[resultStack.length - 1] = result;
if (outputFormat === VERBOSE || (outputFormat !== FLAG && !result.valid)) {
resultStack.push(result);
output[0] = result;
}
output[0] = result;
};
};
const isChild = (topResult, nextResult) => {
return topResult.absoluteKeywordLocation.startsWith(nextResult.absoluteKeywordLocation)
|| nextResult.keyword.endsWith("#validate") && topResult.instanceLocation === nextResult.instanceLocation;
};
const setMetaOutputFormat = (format) => {

@@ -1553,2 +1562,4 @@ metaOutputFormat = format;

}
return url;
};

@@ -1559,4 +1570,6 @@

pubsub.publishSync("result.start");
const isValid = typeof nodes === "boolean" ? nodes : nodes
.every(([keywordId, schemaUrl, keywordValue]) => {
pubsub.publishSync("result.start");
const isValid = core.getKeyword(keywordId).interpret(keywordValue, instance$1, ast);

@@ -1571,2 +1584,3 @@

});
pubsub.publishSync("result.end");
return isValid;

@@ -1582,2 +1596,3 @@ });

});
pubsub.publishSync("result.end");
return isValid;

@@ -1632,2 +1647,4 @@ };

Object.defineProperty(exports, '__esModule', { value: true });
return exports;

@@ -1634,0 +1651,0 @@

@@ -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){!function(r,n){var o={};r.PubSub=o;var a=r.define;!function(e){var t={},r=-1;function n(e){var t;for(t in e)if(e.hasOwnProperty(t))return!0;return!1}function o(e){return function(){throw e}}function a(e,t,r){try{e(t,r)}catch(e){setTimeout(o(e),0)}}function i(e,t,r){e(t,r)}function s(e,r,n,o){var s,c=t[r],u=o?i:a;if(t.hasOwnProperty(r))for(s in c)c.hasOwnProperty(s)&&u(c[s],e,n)}function c(e,t,r){return function(){var n=String(e),o=n.lastIndexOf(".");for(s(e,e,t,r);-1!==o;)o=(n=n.substr(0,o)).lastIndexOf("."),s(e,n,t,r)}}function u(e){for(var r=String(e),o=Boolean(t.hasOwnProperty(r)&&n(t[r])),a=r.lastIndexOf(".");!o&&-1!==a;)a=(r=r.substr(0,a)).lastIndexOf("."),o=Boolean(t.hasOwnProperty(r)&&n(t[r]));return o}function l(e,t,r,n){var o=c(e="symbol"==typeof e?e.toString():e,t,n);return!!u(e)&&(!0===r?o():setTimeout(o,0),!0)}e.publish=function(t,r){return l(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return l(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,t.hasOwnProperty(e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},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)t.hasOwnProperty(r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n=0;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n++;return n},e.getSubscriptions=function(e){var r,n=[];for(r in t)t.hasOwnProperty(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(t.hasOwnProperty(r)&&0===r.indexOf(e))return!0;return!1},s="string"==typeof r&&(t.hasOwnProperty(r)||i(r)),c=!s&&"string"==typeof r,u="function"==typeof r,l=!1;if(!s){for(n in t)if(t.hasOwnProperty(n)){if(o=t[n],c&&o[r]){delete o[r],l=r;break}if(u)for(a in o)o.hasOwnProperty(a)&&o[a]===r&&(delete o[a],l=!0)}return l}e.clearSubscriptions(r)}}(o),"function"==typeof a&&a.amd?a((function(){return o})):(void 0!==e&&e.exports&&(t=e.exports=o),t.PubSub=o,e.exports=t=o)}("object"==typeof window&&window||r)}(n={exports:{}},n.exports),n.exports);o.PubSub;const a=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(d)},i=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:i(e,h(t,o,n),r,l(o,n))}}if(Array.isArray(t)){const n=[...t];return n[p(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:h(t,e[0],n)},s=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||y(t)){const o=e.shift();s(e,h(t,o,n),r,l(o,n))}else{t[p(t,e[0])]=r}},c=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=h(t,n,r);return{...t,[n]:c(e,o,l(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 h(t,e[0],r)}},u=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=h(t,n,r);u(e,o,l(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:h(t,e[0],r)},l=t((e,t)=>t+"/"+f(e)),f=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),d=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),p=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,h=(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(y(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[p(e,t)]},y=e=>null===e||"object"!=typeof e;var m={nil:"",append:l,get:(e,t)=>{const r=a(e),n=e=>r.reduce(([e,t],r)=>[h(e,r,t),l(r,t)],[e,""])[0];return void 0===t?n:n(t)},set:(e,r,n)=>{const o=a(e),s=t((e,t)=>i(o,e,t,""));return void 0===r?s:s(r,n)},assign:(e,r,n)=>{const o=a(e),i=t((e,t)=>s(o,e,t,""));return void 0===r?i:i(r,n)},unset:(e,t)=>{const r=a(e),n=e=>c(r,e,"");return void 0===t?n:n(t)},delete:(e,t)=>{const r=a(e),n=e=>u(r,e,"");return void 0===t?n:n(t)}};const v={null:e=>null===e,boolean:e=>"boolean"==typeof e,object:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,array:e=>Array.isArray(e),number:e=>"number"==typeof e,integer:e=>Number.isInteger(e),string:e=>"string"==typeof e};var b={jsonTypeOf:(e,t)=>v[t](e),splitUrl: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)]}};const w=Symbol("$__value"),g=Symbol("$__href"),O=Symbol("$__isDynamic");var E=(e,t,r=!1)=>Object.freeze({[g]:e,[w]:t,[O]:r}),j=e=>e&&void 0!==e[g],$=e=>e[g],A=e=>e[w],S=e=>e[O];const{jsonTypeOf:P}=b,x=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),T=e=>j(e.value)?A(e.value):e.value,I=t((e,t)=>P(T(e),t)),k=(e,t)=>Object.freeze({...t,pointer:m.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))),L=t((e,t)=>T(t).map((e,r,n,o)=>k(r,t)).filter((t,r,n,o)=>e(t,r,n,o))),K=t((e,t,r)=>T(r).reduce((t,n,o)=>e(t,k(o,r),o),t)),z=t((e,t)=>T(t).every((r,n,o,a)=>e(k(n,t),n,o,a))),C=t((e,t)=>T(t).some((r,n,o,a)=>e(k(n,t),n,o,a)));var U={cons:(e,t="")=>Object.freeze({...x,id:t,instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value: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:L,reduce:K,every:z,some:C,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]+$/,R=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,B=/\\([\u000b\u0020-\u00ff])/g,D=/([\\"])/g,W=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
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(e.hasOwnProperty(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],u=o?s:i;if(t.hasOwnProperty(r))for(a in c)c.hasOwnProperty(a)&&u(c[a],e,n)}function u(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 l(e){var r=String(e);return Boolean(t.hasOwnProperty(r)&&o(t[r]))}function f(e){for(var t=String(e),r=l(t)||l(n),o=t.lastIndexOf(".");!r&&-1!==o;)o=(t=t.substr(0,o)).lastIndexOf("."),r=l(t);return r}function d(e,t,r,n){var o=u(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 d(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return d(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,t.hasOwnProperty(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)t.hasOwnProperty(r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n=0;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n++;return n},e.getSubscriptions=function(e){var r,n=[];for(r in t)t.hasOwnProperty(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(t.hasOwnProperty(r)&&0===r.indexOf(e))return!0;return!1},s="string"==typeof r&&(t.hasOwnProperty(r)||i(r)),c=!s&&"string"==typeof r,u="function"==typeof r,l=!1;if(!s){for(n in t)if(t.hasOwnProperty(n)){if(o=t[n],c&&o[r]){delete o[r],l=r;break}if(u)for(a in o)o.hasOwnProperty(a)&&o[a]===r&&(delete o[a],l=!0)}return l}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;const a=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(d)},i=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:i(e,h(t,o,n),r,l(o,n))}}if(Array.isArray(t)){const n=[...t];return n[p(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:h(t,e[0],n)},s=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||y(t)){const o=e.shift();s(e,h(t,o,n),r,l(o,n))}else{t[p(t,e[0])]=r}},c=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=h(t,n,r);return{...t,[n]:c(e,o,l(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 h(t,e[0],r)}},u=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=h(t,n,r);u(e,o,l(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:h(t,e[0],r)},l=t(((e,t)=>t+"/"+f(e))),f=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),d=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),p=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,h=(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(y(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[p(e,t)]},y=e=>null===e||"object"!=typeof e;var m={nil:"",append:l,get:(e,t)=>{const r=a(e),n=e=>r.reduce((([e,t],r)=>[h(e,r,t),l(r,t)]),[e,""])[0];return void 0===t?n:n(t)},set:(e,r,n)=>{const o=a(e),s=t(((e,t)=>i(o,e,t,"")));return void 0===r?s:s(r,n)},assign:(e,r,n)=>{const o=a(e),i=t(((e,t)=>s(o,e,t,"")));return void 0===r?i:i(r,n)},unset:(e,t)=>{const r=a(e),n=e=>c(r,e,"");return void 0===t?n:n(t)},delete:(e,t)=>{const r=a(e),n=e=>u(r,e,"");return void 0===t?n:n(t)}};const v={null:e=>null===e,boolean:e=>"boolean"==typeof e,object:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,array:e=>Array.isArray(e),number:e=>"number"==typeof e,integer:e=>Number.isInteger(e),string:e=>"string"==typeof e};var b={jsonTypeOf:(e,t)=>v[t](e),splitUrl: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)]}};const w=Symbol("$__value"),g=Symbol("$__href"),O=Symbol("$__isDynamic");var E=(e,t,r=!1)=>Object.freeze({[g]:e,[w]:t,[O]:r}),S=e=>e&&void 0!==e[g],j=e=>e[g],$=e=>e[w],A=e=>e[O];const{jsonTypeOf:P}=b,x=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),T=e=>S(e.value)?$(e.value):e.value,I=t(((e,t)=>P(T(e),t))),k=(e,t)=>Object.freeze({...t,pointer:m.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))))),z=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))),K=t(((e,t)=>T(t).every(((r,n,o,a)=>e(k(n,t),n,o,a))))),L=t(((e,t)=>T(t).some(((r,n,o,a)=>e(k(n,t),n,o,a)))));var _={cons:(e,t="")=>Object.freeze({...x,id:t,instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value: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:z,reduce:C,every:K,some:L,length:e=>T(e).length},U=/; *([!#$%&'*+.^_`|~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]+$/,R=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,D=/\\([\u000b\u0020-\u00ff])/g,B=/([\\"])/g,F=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
/*!

@@ -6,3 +6,3 @@ * content-type

* MIT Licensed
*/function F(e){var t=String(e);if(R.test(t))return t;if(t.length>0&&!_.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(D,"\\$1")+'"'}function J(e){this.parameters=Object.create(null),this.type=e}var N={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!W.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],!R.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(!W.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(B,"$1")),o.parameters[a]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},Z=async e=>Object.entries(await e),M=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 M(e,t);return(await Promise.all(r)).some(e=>e)}),X=t(async(e,t)=>{const r=await M(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:Z,map:M,filter:H,reduce:G,some:Q,every:X,pipeline:Y,all:e=>Promise.all(e),allValues:e=>Y([Z,G(async(e,[t,r])=>(e[t]=await r,e),{})],e)},te=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(oe.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)?re(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+ne(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=ne(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:re(e)}};function re(e){return e+("/"===e[e.length-1]?"":"/")}function ne(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 oe=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");var ae=fetch;const{jsonTypeOf:ie,splitUrl:se}=b,ce={},ue={},le=(e,t)=>{const r=e in ue?ue[e]:e;if(r in ce)return ce[r][t]},fe={},de={},pe=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=se(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=le(n,"baseToken"),a=le(n,"anchorToken"),i=se(t)[0];if(!i&&!se(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const s=we(i,e[o]||""),[c,u]=se(s);delete e[o],u&&o===a&&(e[a]=a!==o?encodeURI(u):"#"+encodeURI(u)),i&&(de[i]=c);const l={},f=le(n,"recursiveAnchorToken");let d;!0===e[f]&&(l["#"]=c,e[a]="",delete e[f]);const p=le(n,"vocabularyToken");ie(e[p],"object")?(ue[c]=n,d=e[p],delete e[p]):(ue[c]=n,d={[n]:!0});const h={};fe[c]={id:c,schemaVersion:n,schema:he(e,c,n,m.nil,h,l),anchors:h,dynamicAnchors:l,vocabulary:d,validated:!1}},he=(e,t,r,n,o,a)=>{if(ie(e,"object")){const i="string"==typeof e.$schema?se(e.$schema)[0]:r,s=le(i,"embeddedToken"),c=le(i,"anchorToken");if("string"==typeof e[s]&&(s!==c||"#"!==e[s][0])){const n=we(t,e[s]);return e[s]=n,pe(e,n,r),E(e[s],e)}const u=le(r,"anchorToken"),l=le(r,"dynamicAnchorToken");"string"==typeof e[l]&&(a["#"+e[l]]=t,e[u]=e[l],delete e[l]);const f=le(r,"embeddedToken");if("string"==typeof e[u]){const t=u!==f?e[u]:e[u].slice(1);o[t]=n,delete e[u]}const d=le(r,"jrefToken");if("string"==typeof e[d])return E(e[d],e);for(let i in e)e[i]=he(e[i],t,r,m.append(i,n),o,a);const p=le(r,"jsrefToken");"string"==typeof e[p]&&(e[p]=E(e[p],e[p]));const h=le(r,"dynamicJsrefToken");return"string"==typeof e[h]&&(e[h]=E(e[h],e[h],!0)),e}return Array.isArray(e)?e.map((e,i)=>he(e,t,r,m.append(i,n),o,a)):e},ye=e=>fe[de[e]]||fe[e],me=Object.freeze({id:"",schemaVersion:void 0,pointer:"",schema:void 0,dynamicAnchors:{}}),ve=async(e,t=me,r=!1)=>{const n=r&&t.dynamicAnchors[e]?t.dynamicAnchors[e]:Ee(t),o=we(n,e),[a,i]=se(o);if(!(e=>e in fe||e in de)(a)){const e=await ae(a,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error("Failed to retrieve schema with id: "+a);if(e.headers.has("content-type")){const t=N.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${a} is not a schema. Found a document with media type: ${t}`)}pe(await e.json(),a)}const s=ye(a),c=i&&"/"!==i[0]?Oe(s,i):i,u=Object.freeze({id:s.id,schemaVersion:s.schemaVersion,vocabulary:s.vocabulary,pointer:c,schema:s.schema,value:m.get(c,s.schema),dynamicAnchors:{...s.dynamicAnchors,...t.dynamicAnchors},validated:s.validated});return be(u)},be=e=>j(e.value)?ve($(e.value),e,S(e.value)):e,we=(e,t)=>{const r=te(e,t),n=se(e)[0];if(n&&"file"===ge(r)&&"file"!==ge(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},ge=e=>{const t=e.match(/^(.+):\/\//);return t?t[1]:""},Oe=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},Ee=e=>`${e.id}#${encodeURI(e.pointer)}`,je=e=>j(e.value)?A(e.value):e.value,$e=(e,t)=>{const r=ye(t.id),n=Object.freeze({id:t.id,schemaVersion:t.schemaVersion,vocabulary:t.vocabulary,pointer:m.append(e,t.pointer),schema:r.schema,value:je(t)[e],dynamicAnchors:t.dynamicAnchors,validated:r.validated});return be(n)},Ae=t((e,t)=>ee.pipeline([je,ee.map(async(r,n)=>e(await $e(n,t),n)),ee.all],t));var Se={setConfig:(e,t,r)=>{ce[e]||(ce[e]={}),ce[e][t]=r},getConfig:le,add:pe,get:ve,markValidated:e=>{fe[e].validated=!0},uri:Ee,value:je,typeOf:(e,t)=>ie(je(e),t),has:(e,t)=>e in je(t),step:$e,keys:e=>Object.keys(je(e)),entries:e=>ee.pipeline([je,Object.keys,ee.map(async t=>[t,await $e(t,e)]),ee.all],e),map:Ae,length:e=>je(e).length};class Pe extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var xe=Pe;const Te="FLAG",Ie="BASIC",ke="DETAILED",Ve="VERBOSE";let Le=ke,Ke=!0;const ze=async e=>{const t={};return{ast:t,schemaUri:await Fe(e,t)}},Ce=t(({ast:e,schemaUri:t},r,n=Te)=>{if(![Te,Ie,ke,Ve].includes(n))throw Error(`The '${n}' error format is not supported`);let a=[];const i=o.subscribe("result",Ue(n,a));return Je(t,r,e),o.unsubscribe(i),a[0]}),Ue=(e,t)=>{const r=[];return(n,o)=>{const{keyword:a,absoluteKeywordLocation:i,instanceLocation:s,valid:c}=o,u={keyword:a,absoluteKeywordLocation:i,instanceLocation:s,valid:c,errors:[]};for(;r.length>0&&qe(r[r.length-1],u);){const t=r.pop();let n=[];e===Ie&&(n=t.errors,delete t.errors),u.errors.unshift(t,...n)}(e===Ve||e!==Te&&!u.valid)&&r.push(u),t[0]=u}},qe=(e,t)=>e.absoluteKeywordLocation.startsWith(t.absoluteKeywordLocation)||t.keyword.endsWith("#validate")&&e.instanceLocation===t.instanceLocation,_e={},Re=e=>_e[e],Be=e=>e in _e,De={},We={},Fe=async(e,t)=>{if(!Be(e.schemaVersion+"#validate")){const t=await Se.get(e.schemaVersion);(Se.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 De)Object.entries(De[e]).forEach(([e,r])=>{((e,t)=>{_e[e]={collectEvaluatedItems:(e,r,n)=>t.interpret(e,r,n)&&0,collectEvaluatedProperties:(e,r,n)=>t.interpret(e,r,n)&&[],...t}})(`${t.id}#${e}`,r)});else if(r)throw Error("Missing required vocabulary: "+e)})}if(Ke&&!e.validated){if(Se.markValidated(e.id),!(e.schemaVersion in We)){const t=await Se.get(e.schemaVersion),r={},n=await Fe(t,r);We[t.id]=Ce({ast:r,schemaUri:n})}const t=U.cons(e.schema,e.id),r=We[e.schemaVersion](t,Le);if(!r.valid)throw new xe(r)}return await Re(e.schemaVersion+"#validate").compile(e,t),Se.uri(e)},Je=(e,t,r)=>{const[n]=r[e];return Re(n).interpret(e,t,r)};var Ne={validate:async(e,t,r)=>{const n=await ze(e),o=(e,t=Te)=>Ce(n,U.cons(e),t);return void 0===t?o:o(t,r)},compile:ze,interpret:Ce,setMetaOutputFormat:e=>{Le=e},setShouldMetaValidate:e=>{Ke=e},FLAG:Te,BASIC:Ie,DETAILED:ke,VERBOSE:Ve,getKeyword:Re,hasKeyword:Be,defineVocabulary:(e,t)=>{De[e]=t},compileSchema:Fe,interpretSchema:Je,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return Re(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return Re(o).collectEvaluatedItems(e,t,r,n)}};var Ze={compile:e=>Se.value(e),interpret:()=>!0};var Me={compile:async(e,t)=>{const r=Se.uri(e);if(!(r in t)){t[r]=!1;const n=Se.value(e);t[r]=[e.schemaVersion+"#validate",Se.uri(e),"boolean"==typeof n?n:await ee.pipeline([Se.entries,ee.map(([t,r])=>[`${e.schemaVersion}#${t}`,r]),ee.filter(([t])=>Ne.hasKeyword(t)&&t!==e.schemaVersion+"#validate"),ee.map(async([r,n])=>{const o=await Ne.getKeyword(r).compile(n,t,e);return[r,Se.uri(n),o]}),ee.all],e)]}},interpret:(e,t,r)=>{const[n,a,i]=r[e],s="boolean"==typeof i?i:i.every(([e,n,a])=>{const i=Ne.getKeyword(e).interpret(a,t,r);return o.publishSync("result",{keyword:e,absoluteKeywordLocation:n,instanceLocation:U.uri(t),valid:i,ast:a}),i});return o.publishSync("result",{keyword:n,absoluteKeywordLocation:a,instanceLocation:U.uri(t),valid:s,ast:e}),s},collectEvaluatedProperties:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedProperties")).reduce((e,[n,,o])=>{const a=e&&Ne.getKeyword(n).collectEvaluatedProperties(o,t,r);return a&&e.concat(a)},[])},collectEvaluatedItems:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedItems")).reduce((e,[n,,o])=>{const a=!1!==e&&Ne.getKeyword(n).collectEvaluatedItems(o,t,r);return!1!==a&&Math.max(e,a)},0)}},Ge={Core:Ne,Schema:Se,Instance:U,Keywords:{metaData:Ze,validate:Me}},He=Ge.Core,Qe=Ge.Schema,Xe=Ge.Instance,Ye=Ge.Keywords;return e.Core=He,e.Instance=Xe,e.Keywords=Ye,e.Schema=Qe,e.default=Ge,e}({});
*/function J(e){var t=String(e);if(R.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 N={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],!R.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 M(n.toLowerCase());if(-1!==r){var a,i,s;for(U.lastIndex=r;i=U.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}},Z=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:Z,map:W,filter:H,reduce:G,some:Q,every:X,pipeline:Y,all:e=>Promise.all(e),allValues:e=>Y([Z,G((async(e,[t,r])=>(e[t]=await r,e)),{})],e)},te=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(oe.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)?re(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+ne(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=ne(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:re(e)}};function re(e){return e+("/"===e[e.length-1]?"":"/")}function ne(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 oe=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");var ae=fetch;const{jsonTypeOf:ie,splitUrl:se}=b,ce={},ue={},le=(e,t)=>{const r=e in ue?ue[e]:e;if(r in ce)return ce[r][t]},fe={},de={},pe=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=se(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=le(n,"baseToken"),a=le(n,"anchorToken"),i=se(t)[0];if(!i&&!se(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const s=we(i,e[o]||""),[c,u]=se(s);delete e[o],u&&o===a&&(e[a]=a!==o?encodeURI(u):"#"+encodeURI(u)),i&&(de[i]=c);const l={},f=le(n,"recursiveAnchorToken");let d;!0===e[f]&&(l["#"]=c,e[a]="",delete e[f]);const p=le(n,"vocabularyToken");ie(e[p],"object")?(ue[c]=n,d=e[p],delete e[p]):(ue[c]=n,d={[n]:!0});const h={};fe[c]={id:c,schemaVersion:n,schema:he(e,c,n,m.nil,h,l),anchors:h,dynamicAnchors:l,vocabulary:d,validated:!1}},he=(e,t,r,n,o,a)=>{if(ie(e,"object")){const i="string"==typeof e.$schema?se(e.$schema)[0]:r,s=le(i,"embeddedToken"),c=le(i,"anchorToken");if("string"==typeof e[s]&&(s!==c||"#"!==e[s][0])){const n=we(t,e[s]);return e[s]=n,pe(e,n,r),E(e[s],e)}const u=le(r,"anchorToken"),l=le(r,"dynamicAnchorToken");"string"==typeof e[l]&&(a["#"+e[l]]=t,e[u]=e[l],delete e[l]);const f=le(r,"embeddedToken");if("string"==typeof e[u]){const t=u!==f?e[u]:e[u].slice(1);o[t]=n,delete e[u]}const d=le(r,"jrefToken");if("string"==typeof e[d])return E(e[d],e);for(let i in e)e[i]=he(e[i],t,r,m.append(i,n),o,a);const p=le(r,"jsrefToken");"string"==typeof e[p]&&(e[p]=E(e[p],e[p]));const h=le(r,"dynamicJsrefToken");return"string"==typeof e[h]&&(e[h]=E(e[h],e[h],!0)),e}return Array.isArray(e)?e.map(((e,i)=>he(e,t,r,m.append(i,n),o,a))):e},ye=e=>fe[de[e]]||fe[e],me=Object.freeze({id:"",schemaVersion:void 0,pointer:"",schema:void 0,dynamicAnchors:{}}),ve=async(e,t=me,r=!1)=>{const n=r&&t.dynamicAnchors[e]?t.dynamicAnchors[e]:Ee(t),o=we(n,e),[a,i]=se(o);if(!(e=>e in fe||e in de)(a)){const e=await ae(a,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error("Failed to retrieve schema with id: "+a);if(e.headers.has("content-type")){const t=N.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${a} is not a schema. Found a document with media type: ${t}`)}pe(await e.json(),a)}const s=ye(a),c=i&&"/"!==i[0]?Oe(s,i):i,u=Object.freeze({id:s.id,schemaVersion:s.schemaVersion,vocabulary:s.vocabulary,pointer:c,schema:s.schema,value:m.get(c,s.schema),dynamicAnchors:{...s.dynamicAnchors,...t.dynamicAnchors},validated:s.validated});return be(u)},be=e=>S(e.value)?ve(j(e.value),e,A(e.value)):e,we=(e,t)=>{const r=te(e,t),n=se(e)[0];if(n&&"file"===ge(r)&&"file"!==ge(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},ge=e=>{const t=e.match(/^(.+):\/\//);return t?t[1]:""},Oe=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},Ee=e=>`${e.id}#${encodeURI(e.pointer)}`,Se=e=>S(e.value)?$(e.value):e.value,je=(e,t)=>{const r=ye(t.id),n=Object.freeze({id:t.id,schemaVersion:t.schemaVersion,vocabulary:t.vocabulary,pointer:m.append(e,t.pointer),schema:r.schema,value:Se(t)[e],dynamicAnchors:t.dynamicAnchors,validated:r.validated});return be(n)},$e=t(((e,t)=>ee.pipeline([Se,ee.map((async(r,n)=>e(await je(n,t),n))),ee.all],t)));var Ae={setConfig:(e,t,r)=>{ce[e]||(ce[e]={}),ce[e][t]=r},getConfig:le,add:pe,get:ve,markValidated:e=>{fe[e].validated=!0},uri:Ee,value:Se,typeOf:(e,t)=>ie(Se(e),t),has:(e,t)=>e in Se(t),step:je,keys:e=>Object.keys(Se(e)),entries:e=>ee.pipeline([Se,Object.keys,ee.map((async t=>[t,await je(t,e)])),ee.all],e),map:$e,length:e=>Se(e).length};class Pe extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var xe=Pe;const Te="FLAG",Ie="BASIC",ke="DETAILED",Ve="VERBOSE";let ze=ke,Ce=!0;const Ke=async e=>{const t={};return{ast:t,schemaUri:await Fe(e,t)}},Le=t((({ast:e,schemaUri:t},r,n=Te)=>{if(![Te,Ie,ke,Ve].includes(n))throw Error(`The '${n}' error format is not supported`);let a=[];const i=o.subscribe("result",_e(n,a));return Je(t,r,e),o.unsubscribe(i),a[0]})),_e=(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===Ie&&(o.push(...t.errors),delete t.errors),(e===Ve||e!==Te&&!t.valid)&&n.errors.unshift(...o)}r[r.length-1]=n,t[0]=n}}},Ue={},qe=e=>Ue[e],Re=e=>e in Ue,De={},Be={},Fe=async(e,t)=>{if(!Re(e.schemaVersion+"#validate")){const t=await Ae.get(e.schemaVersion);(Ae.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 De)Object.entries(De[e]).forEach((([e,r])=>{((e,t)=>{Ue[e]={collectEvaluatedItems:(e,r,n)=>t.interpret(e,r,n)&&0,collectEvaluatedProperties:(e,r,n)=>t.interpret(e,r,n)&&[],...t}})(`${t.id}#${e}`,r)}));else if(r)throw Error("Missing required vocabulary: "+e)}))}if(Ce&&!e.validated){if(Ae.markValidated(e.id),!(e.schemaVersion in Be)){const t=await Ae.get(e.schemaVersion),r={},n=await Fe(t,r);Be[t.id]=Le({ast:r,schemaUri:n})}const t=_.cons(e.schema,e.id),r=Be[e.schemaVersion](t,ze);if(!r.valid)throw new xe(r)}return await qe(e.schemaVersion+"#validate").compile(e,t),Ae.uri(e)},Je=(e,t,r)=>{const[n]=r[e];return qe(n).interpret(e,t,r)};var Me={validate:async(e,t,r)=>{const n=await Ke(e),o=(e,t=Te)=>Le(n,_.cons(e),t);return void 0===t?o:o(t,r)},compile:Ke,interpret:Le,setMetaOutputFormat:e=>{ze=e},setShouldMetaValidate:e=>{Ce=e},FLAG:Te,BASIC:Ie,DETAILED:ke,VERBOSE:Ve,getKeyword:qe,hasKeyword:Re,defineVocabulary:(e,t)=>{De[e]=t},compileSchema:Fe,interpretSchema:Je,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return qe(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return qe(o).collectEvaluatedItems(e,t,r,n)}};var Ne={compile:e=>Ae.value(e),interpret:()=>!0};var Ze={compile:async(e,t)=>{const r=Ae.uri(e);if(!(r in t)){t[r]=!1;const n=Ae.value(e);t[r]=[e.schemaVersion+"#validate",Ae.uri(e),"boolean"==typeof n?n:await ee.pipeline([Ae.entries,ee.map((([t,r])=>[`${e.schemaVersion}#${t}`,r])),ee.filter((([t])=>Me.hasKeyword(t)&&t!==e.schemaVersion+"#validate")),ee.map((async([r,n])=>{const o=await Me.getKeyword(r).compile(n,t,e);return[r,Ae.uri(n),o]})),ee.all],e)]}return r},interpret:(e,t,r)=>{const[n,a,i]=r[e];o.publishSync("result.start");const s="boolean"==typeof i?i:i.every((([e,n,a])=>{o.publishSync("result.start");const i=Me.getKeyword(e).interpret(a,t,r);return o.publishSync("result",{keyword:e,absoluteKeywordLocation:n,instanceLocation:_.uri(t),valid:i,ast:a}),o.publishSync("result.end"),i}));return o.publishSync("result",{keyword:n,absoluteKeywordLocation:a,instanceLocation:_.uri(t),valid:s,ast:e}),o.publishSync("result.end"),s},collectEvaluatedProperties:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter((([e])=>!n||!e.endsWith("#unevaluatedProperties"))).reduce(((e,[n,,o])=>{const a=e&&Me.getKeyword(n).collectEvaluatedProperties(o,t,r);return a&&e.concat(a)}),[])},collectEvaluatedItems:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter((([e])=>!n||!e.endsWith("#unevaluatedItems"))).reduce(((e,[n,,o])=>{const a=!1!==e&&Me.getKeyword(n).collectEvaluatedItems(o,t,r);return!1!==a&&Math.max(e,a)}),0)}},We={Core:Me,Schema:Ae,Instance:_,Keywords:{metaData:Ne,validate:Ze}},Ge=We.Core,He=We.Schema,Qe=We.Instance,Xe=We.Keywords;return e.Core=Ge,e.Instance=Qe,e.Keywords=Xe,e.Schema=He,e.default=We,Object.defineProperty(e,"__esModule",{value:!0}),e}({});
//# sourceMappingURL=json-schema-core-iife.min.js.map

@@ -62,16 +62,8 @@ System.register('JSC', [], function (exports) {

(function (root, factory){
var PubSub = {};
root.PubSub = PubSub;
var define = root.define;
factory(PubSub);
// AMD support
if (typeof define === 'function' && define.amd){
define(function() { return PubSub; });
// CommonJS and Node.js module support
} else {
// CommonJS and Node.js module support
{
if (module !== undefined && module.exports) {

@@ -82,3 +74,3 @@ exports = module.exports = PubSub; // Node.js specific `module.exports`

module.exports = exports = PubSub; // CommonJS
}
}

@@ -88,3 +80,4 @@ }(( typeof window === 'object' && window ) || commonjsGlobal, function (PubSub){

var messages = {},
lastUid = -1;
lastUid = -1,
ALL_SUBSCRIBING_MSG = '*';

@@ -156,8 +149,17 @@ function hasKeys(obj){

}
deliverMessage(message, ALL_SUBSCRIBING_MSG, data, immediateExceptions);
};
}
function hasDirectSubscribersFor( message ) {
var topic = String( message ),
found = Boolean(messages.hasOwnProperty( topic ) && hasKeys(messages[topic]));
return found;
}
function messageHasSubscribers( message ){
var topic = String( message ),
found = Boolean(messages.hasOwnProperty( topic ) && hasKeys(messages[topic])),
found = hasDirectSubscribersFor(topic) || hasDirectSubscribersFor(ALL_SUBSCRIBING_MSG),
position = topic.lastIndexOf( '.' );

@@ -168,3 +170,3 @@

position = topic.lastIndexOf( '.' );
found = Boolean(messages.hasOwnProperty( topic ) && hasKeys(messages[topic]));
found = hasDirectSubscribersFor(topic);
}

@@ -246,2 +248,6 @@

PubSub.subscribeAll = function( func ){
return PubSub.subscribe(ALL_SUBSCRIBING_MSG, func);
};
/**

@@ -1405,27 +1411,30 @@ * Subscribes the passed function to the passed message once

return (message, keywordResult) => {
const { keyword, absoluteKeywordLocation, instanceLocation, valid } = keywordResult;
const result = { keyword, absoluteKeywordLocation, instanceLocation, valid, errors: [] };
while (resultStack.length > 0 && isChild(resultStack[resultStack.length - 1], result)) {
const topResult = resultStack.pop();
let errors = [];
if (outputFormat === BASIC) {
errors = topResult.errors;
delete topResult.errors;
if (message === "result") {
const { keyword, absoluteKeywordLocation, instanceLocation, valid } = keywordResult;
const result = { keyword, absoluteKeywordLocation, instanceLocation, valid, errors: [] };
resultStack.push(result);
} else if (message === "result.start") {
resultStack.push(message);
} else if (message === "result.end") {
const result = resultStack.pop();
while (resultStack[resultStack.length - 1] !== "result.start") {
const topResult = resultStack.pop();
const errors = [topResult];
if (outputFormat === BASIC) {
errors.push(...topResult.errors);
delete topResult.errors;
}
if (outputFormat === VERBOSE || (outputFormat !== FLAG && !topResult.valid)) {
result.errors.unshift(...errors);
}
}
result.errors.unshift(topResult, ...errors);
}
resultStack[resultStack.length - 1] = result;
if (outputFormat === VERBOSE || (outputFormat !== FLAG && !result.valid)) {
resultStack.push(result);
output[0] = result;
}
output[0] = result;
};
};
const isChild = (topResult, nextResult) => {
return topResult.absoluteKeywordLocation.startsWith(nextResult.absoluteKeywordLocation)
|| nextResult.keyword.endsWith("#validate") && topResult.instanceLocation === nextResult.instanceLocation;
};
const setMetaOutputFormat = (format) => {

@@ -1555,2 +1564,4 @@ metaOutputFormat = format;

}
return url;
};

@@ -1561,4 +1572,6 @@

pubsub.publishSync("result.start");
const isValid = typeof nodes === "boolean" ? nodes : nodes
.every(([keywordId, schemaUrl, keywordValue]) => {
pubsub.publishSync("result.start");
const isValid = core.getKeyword(keywordId).interpret(keywordValue, instance$1, ast);

@@ -1573,2 +1586,3 @@

});
pubsub.publishSync("result.end");
return isValid;

@@ -1584,2 +1598,3 @@ });

});
pubsub.publishSync("result.end");
return isValid;

@@ -1586,0 +1601,0 @@ };

@@ -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){!function(r,n){var o={};r.PubSub=o;var a=r.define;!function(e){var t={},r=-1;function n(e){var t;for(t in e)if(e.hasOwnProperty(t))return!0;return!1}function o(e){return function(){throw e}}function a(e,t,r){try{e(t,r)}catch(e){setTimeout(o(e),0)}}function i(e,t,r){e(t,r)}function s(e,r,n,o){var s,c=t[r],u=o?i:a;if(t.hasOwnProperty(r))for(s in c)c.hasOwnProperty(s)&&u(c[s],e,n)}function c(e,t,r){return function(){var n=String(e),o=n.lastIndexOf(".");for(s(e,e,t,r);-1!==o;)o=(n=n.substr(0,o)).lastIndexOf("."),s(e,n,t,r)}}function u(e){for(var r=String(e),o=Boolean(t.hasOwnProperty(r)&&n(t[r])),a=r.lastIndexOf(".");!o&&-1!==a;)a=(r=r.substr(0,a)).lastIndexOf("."),o=Boolean(t.hasOwnProperty(r)&&n(t[r]));return o}function l(e,t,r,n){var o=c(e="symbol"==typeof e?e.toString():e,t,n);return!!u(e)&&(!0===r?o():setTimeout(o,0),!0)}e.publish=function(t,r){return l(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return l(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,t.hasOwnProperty(e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},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)t.hasOwnProperty(r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n=0;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n++;return n},e.getSubscriptions=function(e){var r,n=[];for(r in t)t.hasOwnProperty(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(t.hasOwnProperty(r)&&0===r.indexOf(e))return!0;return!1},s="string"==typeof r&&(t.hasOwnProperty(r)||i(r)),c=!s&&"string"==typeof r,u="function"==typeof r,l=!1;if(!s){for(n in t)if(t.hasOwnProperty(n)){if(o=t[n],c&&o[r]){delete o[r],l=r;break}if(u)for(a in o)o.hasOwnProperty(a)&&o[a]===r&&(delete o[a],l=!0)}return l}e.clearSubscriptions(r)}}(o),"function"==typeof a&&a.amd?a((function(){return o})):(void 0!==e&&e.exports&&(t=e.exports=o),t.PubSub=o,e.exports=t=o)}("object"==typeof window&&window||r)}(n={exports:{}},n.exports),n.exports);o.PubSub;const a=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(d)},i=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:i(e,h(t,o,n),r,l(o,n))}}if(Array.isArray(t)){const n=[...t];return n[p(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:h(t,e[0],n)},s=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||y(t)){const o=e.shift();s(e,h(t,o,n),r,l(o,n))}else{t[p(t,e[0])]=r}},c=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=h(t,n,r);return{...t,[n]:c(e,o,l(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 h(t,e[0],r)}},u=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=h(t,n,r);u(e,o,l(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:h(t,e[0],r)},l=t((e,t)=>t+"/"+f(e)),f=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),d=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),p=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,h=(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(y(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[p(e,t)]},y=e=>null===e||"object"!=typeof e;var m={nil:"",append:l,get:(e,t)=>{const r=a(e),n=e=>r.reduce(([e,t],r)=>[h(e,r,t),l(r,t)],[e,""])[0];return void 0===t?n:n(t)},set:(e,r,n)=>{const o=a(e),s=t((e,t)=>i(o,e,t,""));return void 0===r?s:s(r,n)},assign:(e,r,n)=>{const o=a(e),i=t((e,t)=>s(o,e,t,""));return void 0===r?i:i(r,n)},unset:(e,t)=>{const r=a(e),n=e=>c(r,e,"");return void 0===t?n:n(t)},delete:(e,t)=>{const r=a(e),n=e=>u(r,e,"");return void 0===t?n:n(t)}};const v={null:e=>null===e,boolean:e=>"boolean"==typeof e,object:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,array:e=>Array.isArray(e),number:e=>"number"==typeof e,integer:e=>Number.isInteger(e),string:e=>"string"==typeof e};var b={jsonTypeOf:(e,t)=>v[t](e),splitUrl: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)]}};const w=Symbol("$__value"),g=Symbol("$__href"),O=Symbol("$__isDynamic");var E=(e,t,r=!1)=>Object.freeze({[g]:e,[w]:t,[O]:r}),j=e=>e&&void 0!==e[g],$=e=>e[g],A=e=>e[w],S=e=>e[O];const{jsonTypeOf:x}=b,P=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),T=e=>j(e.value)?A(e.value):e.value,I=t((e,t)=>x(T(e),t)),k=(e,t)=>Object.freeze({...t,pointer:m.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))),L=t((e,t)=>T(t).map((e,r,n,o)=>k(r,t)).filter((t,r,n,o)=>e(t,r,n,o))),K=t((e,t,r)=>T(r).reduce((t,n,o)=>e(t,k(o,r),o),t)),z=t((e,t)=>T(t).every((r,n,o,a)=>e(k(n,t),n,o,a))),C=t((e,t)=>T(t).some((r,n,o,a)=>e(k(n,t),n,o,a)));var U={cons:(e,t="")=>Object.freeze({...P,id:t,instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value: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:L,reduce:K,every:z,some:C,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]+$/,R=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,B=/\\([\u000b\u0020-\u00ff])/g,D=/([\\"])/g,W=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
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(e.hasOwnProperty(t))return!0;return!1}function i(e){return function(){throw e}}function a(e,t,r){try{e(t,r)}catch(e){setTimeout(i(e),0)}}function s(e,t,r){e(t,r)}function c(e,r,n,o){var i,c=t[r],u=o?s:a;if(t.hasOwnProperty(r))for(i in c)c.hasOwnProperty(i)&&u(c[i],e,n)}function u(e,t,r){return function(){var o=String(e),i=o.lastIndexOf(".");for(c(e,e,t,r);-1!==i;)i=(o=o.substr(0,i)).lastIndexOf("."),c(e,o,t,r);c(e,n,t,r)}}function l(e){var r=String(e);return Boolean(t.hasOwnProperty(r)&&o(t[r]))}function f(e){for(var t=String(e),r=l(t)||l(n),o=t.lastIndexOf(".");!r&&-1!==o;)o=(t=t.substr(0,o)).lastIndexOf("."),r=l(t);return r}function d(e,t,r,n){var o=u(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 d(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return d(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,t.hasOwnProperty(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)t.hasOwnProperty(r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n=0;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n++;return n},e.getSubscriptions=function(e){var r,n=[];for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,i,a=function(e){var r;for(r in t)if(t.hasOwnProperty(r)&&0===r.indexOf(e))return!0;return!1},s="string"==typeof r&&(t.hasOwnProperty(r)||a(r)),c=!s&&"string"==typeof r,u="function"==typeof r,l=!1;if(!s){for(n in t)if(t.hasOwnProperty(n)){if(o=t[n],c&&o[r]){delete o[r],l=r;break}if(u)for(i in o)o.hasOwnProperty(i)&&o[i]===r&&(delete o[i],l=!0)}return l}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;const i=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(d)},a=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:a(e,h(t,o,n),r,l(o,n))}}if(Array.isArray(t)){const n=[...t];return n[p(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:h(t,e[0],n)},s=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||y(t)){const o=e.shift();s(e,h(t,o,n),r,l(o,n))}else{t[p(t,e[0])]=r}},c=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=h(t,n,r);return{...t,[n]:c(e,o,l(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 h(t,e[0],r)}},u=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=h(t,n,r);u(e,o,l(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:h(t,e[0],r)},l=t(((e,t)=>t+"/"+f(e))),f=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),d=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),p=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,h=(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(y(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[p(e,t)]},y=e=>null===e||"object"!=typeof e;var m={nil:"",append:l,get:(e,t)=>{const r=i(e),n=e=>r.reduce((([e,t],r)=>[h(e,r,t),l(r,t)]),[e,""])[0];return void 0===t?n:n(t)},set:(e,r,n)=>{const o=i(e),s=t(((e,t)=>a(o,e,t,"")));return void 0===r?s:s(r,n)},assign:(e,r,n)=>{const o=i(e),a=t(((e,t)=>s(o,e,t,"")));return void 0===r?a:a(r,n)},unset:(e,t)=>{const r=i(e),n=e=>c(r,e,"");return void 0===t?n:n(t)},delete:(e,t)=>{const r=i(e),n=e=>u(r,e,"");return void 0===t?n:n(t)}};const v={null:e=>null===e,boolean:e=>"boolean"==typeof e,object:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,array:e=>Array.isArray(e),number:e=>"number"==typeof e,integer:e=>Number.isInteger(e),string:e=>"string"==typeof e};var b={jsonTypeOf:(e,t)=>v[t](e),splitUrl: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)]}};const w=Symbol("$__value"),g=Symbol("$__href"),O=Symbol("$__isDynamic");var E=(e,t,r=!1)=>Object.freeze({[g]:e,[w]:t,[O]:r}),S=e=>e&&void 0!==e[g],j=e=>e[g],$=e=>e[w],A=e=>e[O];const{jsonTypeOf:x}=b,P=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),T=e=>S(e.value)?$(e.value):e.value,I=t(((e,t)=>x(T(e),t))),k=(e,t)=>Object.freeze({...t,pointer:m.append(e,t.pointer),value:T(t)[e]}),V=t(((e,t)=>T(t).map(((r,n,o,i)=>e(k(n,t),n,o,i))))),z=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))),K=t(((e,t)=>T(t).every(((r,n,o,i)=>e(k(n,t),n,o,i))))),L=t(((e,t)=>T(t).some(((r,n,o,i)=>e(k(n,t),n,o,i)))));var U={cons:(e,t="")=>Object.freeze({...P,id:t,instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value: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:z,reduce:C,every:K,some:L,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]+$/,R=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,D=/\\([\u000b\u0020-\u00ff])/g,B=/([\\"])/g,F=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
/*!

@@ -6,3 +6,3 @@ * content-type

* MIT Licensed
*/function F(e){var t=String(e);if(R.test(t))return t;if(t.length>0&&!_.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(D,"\\$1")+'"'}function J(e){this.parameters=Object.create(null),this.type=e}var N={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!W.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],!R.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(!W.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(B,"$1")),o.parameters[a]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},Z=async e=>Object.entries(await e),M=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 M(e,t);return(await Promise.all(r)).some(e=>e)}),X=t(async(e,t)=>{const r=await M(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:Z,map:M,filter:H,reduce:G,some:Q,every:X,pipeline:Y,all:e=>Promise.all(e),allValues:e=>Y([Z,G(async(e,[t,r])=>(e[t]=await r,e),{})],e)},te=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(oe.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)?re(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+ne(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=ne(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:re(e)}};function re(e){return e+("/"===e[e.length-1]?"":"/")}function ne(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 oe=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");var ae=fetch;const{jsonTypeOf:ie,splitUrl:se}=b,ce={},ue={},le=(e,t)=>{const r=e in ue?ue[e]:e;if(r in ce)return ce[r][t]},fe={},de={},pe=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=se(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=le(n,"baseToken"),a=le(n,"anchorToken"),i=se(t)[0];if(!i&&!se(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const s=we(i,e[o]||""),[c,u]=se(s);delete e[o],u&&o===a&&(e[a]=a!==o?encodeURI(u):"#"+encodeURI(u)),i&&(de[i]=c);const l={},f=le(n,"recursiveAnchorToken");let d;!0===e[f]&&(l["#"]=c,e[a]="",delete e[f]);const p=le(n,"vocabularyToken");ie(e[p],"object")?(ue[c]=n,d=e[p],delete e[p]):(ue[c]=n,d={[n]:!0});const h={};fe[c]={id:c,schemaVersion:n,schema:he(e,c,n,m.nil,h,l),anchors:h,dynamicAnchors:l,vocabulary:d,validated:!1}},he=(e,t,r,n,o,a)=>{if(ie(e,"object")){const i="string"==typeof e.$schema?se(e.$schema)[0]:r,s=le(i,"embeddedToken"),c=le(i,"anchorToken");if("string"==typeof e[s]&&(s!==c||"#"!==e[s][0])){const n=we(t,e[s]);return e[s]=n,pe(e,n,r),E(e[s],e)}const u=le(r,"anchorToken"),l=le(r,"dynamicAnchorToken");"string"==typeof e[l]&&(a["#"+e[l]]=t,e[u]=e[l],delete e[l]);const f=le(r,"embeddedToken");if("string"==typeof e[u]){const t=u!==f?e[u]:e[u].slice(1);o[t]=n,delete e[u]}const d=le(r,"jrefToken");if("string"==typeof e[d])return E(e[d],e);for(let i in e)e[i]=he(e[i],t,r,m.append(i,n),o,a);const p=le(r,"jsrefToken");"string"==typeof e[p]&&(e[p]=E(e[p],e[p]));const h=le(r,"dynamicJsrefToken");return"string"==typeof e[h]&&(e[h]=E(e[h],e[h],!0)),e}return Array.isArray(e)?e.map((e,i)=>he(e,t,r,m.append(i,n),o,a)):e},ye=e=>fe[de[e]]||fe[e],me=Object.freeze({id:"",schemaVersion:void 0,pointer:"",schema:void 0,dynamicAnchors:{}}),ve=async(e,t=me,r=!1)=>{const n=r&&t.dynamicAnchors[e]?t.dynamicAnchors[e]:Ee(t),o=we(n,e),[a,i]=se(o);if(!(e=>e in fe||e in de)(a)){const e=await ae(a,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error("Failed to retrieve schema with id: "+a);if(e.headers.has("content-type")){const t=N.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${a} is not a schema. Found a document with media type: ${t}`)}pe(await e.json(),a)}const s=ye(a),c=i&&"/"!==i[0]?Oe(s,i):i,u=Object.freeze({id:s.id,schemaVersion:s.schemaVersion,vocabulary:s.vocabulary,pointer:c,schema:s.schema,value:m.get(c,s.schema),dynamicAnchors:{...s.dynamicAnchors,...t.dynamicAnchors},validated:s.validated});return be(u)},be=e=>j(e.value)?ve($(e.value),e,S(e.value)):e,we=(e,t)=>{const r=te(e,t),n=se(e)[0];if(n&&"file"===ge(r)&&"file"!==ge(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},ge=e=>{const t=e.match(/^(.+):\/\//);return t?t[1]:""},Oe=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},Ee=e=>`${e.id}#${encodeURI(e.pointer)}`,je=e=>j(e.value)?A(e.value):e.value,$e=(e,t)=>{const r=ye(t.id),n=Object.freeze({id:t.id,schemaVersion:t.schemaVersion,vocabulary:t.vocabulary,pointer:m.append(e,t.pointer),schema:r.schema,value:je(t)[e],dynamicAnchors:t.dynamicAnchors,validated:r.validated});return be(n)},Ae=t((e,t)=>ee.pipeline([je,ee.map(async(r,n)=>e(await $e(n,t),n)),ee.all],t));var Se={setConfig:(e,t,r)=>{ce[e]||(ce[e]={}),ce[e][t]=r},getConfig:le,add:pe,get:ve,markValidated:e=>{fe[e].validated=!0},uri:Ee,value:je,typeOf:(e,t)=>ie(je(e),t),has:(e,t)=>e in je(t),step:$e,keys:e=>Object.keys(je(e)),entries:e=>ee.pipeline([je,Object.keys,ee.map(async t=>[t,await $e(t,e)]),ee.all],e),map:Ae,length:e=>je(e).length};class xe extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var Pe=xe;const Te="FLAG",Ie="BASIC",ke="DETAILED",Ve="VERBOSE";let Le=ke,Ke=!0;const ze=async e=>{const t={};return{ast:t,schemaUri:await Fe(e,t)}},Ce=t(({ast:e,schemaUri:t},r,n=Te)=>{if(![Te,Ie,ke,Ve].includes(n))throw Error(`The '${n}' error format is not supported`);let a=[];const i=o.subscribe("result",Ue(n,a));return Je(t,r,e),o.unsubscribe(i),a[0]}),Ue=(e,t)=>{const r=[];return(n,o)=>{const{keyword:a,absoluteKeywordLocation:i,instanceLocation:s,valid:c}=o,u={keyword:a,absoluteKeywordLocation:i,instanceLocation:s,valid:c,errors:[]};for(;r.length>0&&qe(r[r.length-1],u);){const t=r.pop();let n=[];e===Ie&&(n=t.errors,delete t.errors),u.errors.unshift(t,...n)}(e===Ve||e!==Te&&!u.valid)&&r.push(u),t[0]=u}},qe=(e,t)=>e.absoluteKeywordLocation.startsWith(t.absoluteKeywordLocation)||t.keyword.endsWith("#validate")&&e.instanceLocation===t.instanceLocation,_e={},Re=e=>_e[e],Be=e=>e in _e,De={},We={},Fe=async(e,t)=>{if(!Be(e.schemaVersion+"#validate")){const t=await Se.get(e.schemaVersion);(Se.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 De)Object.entries(De[e]).forEach(([e,r])=>{((e,t)=>{_e[e]={collectEvaluatedItems:(e,r,n)=>t.interpret(e,r,n)&&0,collectEvaluatedProperties:(e,r,n)=>t.interpret(e,r,n)&&[],...t}})(`${t.id}#${e}`,r)});else if(r)throw Error("Missing required vocabulary: "+e)})}if(Ke&&!e.validated){if(Se.markValidated(e.id),!(e.schemaVersion in We)){const t=await Se.get(e.schemaVersion),r={},n=await Fe(t,r);We[t.id]=Ce({ast:r,schemaUri:n})}const t=U.cons(e.schema,e.id),r=We[e.schemaVersion](t,Le);if(!r.valid)throw new Pe(r)}return await Re(e.schemaVersion+"#validate").compile(e,t),Se.uri(e)},Je=(e,t,r)=>{const[n]=r[e];return Re(n).interpret(e,t,r)};var Ne={validate:async(e,t,r)=>{const n=await ze(e),o=(e,t=Te)=>Ce(n,U.cons(e),t);return void 0===t?o:o(t,r)},compile:ze,interpret:Ce,setMetaOutputFormat:e=>{Le=e},setShouldMetaValidate:e=>{Ke=e},FLAG:Te,BASIC:Ie,DETAILED:ke,VERBOSE:Ve,getKeyword:Re,hasKeyword:Be,defineVocabulary:(e,t)=>{De[e]=t},compileSchema:Fe,interpretSchema:Je,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return Re(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return Re(o).collectEvaluatedItems(e,t,r,n)}};var Ze={compile:e=>Se.value(e),interpret:()=>!0};var Me={compile:async(e,t)=>{const r=Se.uri(e);if(!(r in t)){t[r]=!1;const n=Se.value(e);t[r]=[e.schemaVersion+"#validate",Se.uri(e),"boolean"==typeof n?n:await ee.pipeline([Se.entries,ee.map(([t,r])=>[`${e.schemaVersion}#${t}`,r]),ee.filter(([t])=>Ne.hasKeyword(t)&&t!==e.schemaVersion+"#validate"),ee.map(async([r,n])=>{const o=await Ne.getKeyword(r).compile(n,t,e);return[r,Se.uri(n),o]}),ee.all],e)]}},interpret:(e,t,r)=>{const[n,a,i]=r[e],s="boolean"==typeof i?i:i.every(([e,n,a])=>{const i=Ne.getKeyword(e).interpret(a,t,r);return o.publishSync("result",{keyword:e,absoluteKeywordLocation:n,instanceLocation:U.uri(t),valid:i,ast:a}),i});return o.publishSync("result",{keyword:n,absoluteKeywordLocation:a,instanceLocation:U.uri(t),valid:s,ast:e}),s},collectEvaluatedProperties:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedProperties")).reduce((e,[n,,o])=>{const a=e&&Ne.getKeyword(n).collectEvaluatedProperties(o,t,r);return a&&e.concat(a)},[])},collectEvaluatedItems:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedItems")).reduce((e,[n,,o])=>{const a=!1!==e&&Ne.getKeyword(n).collectEvaluatedItems(o,t,r);return!1!==a&&Math.max(e,a)},0)}},Ge=e("default",{Core:Ne,Schema:Se,Instance:U,Keywords:{metaData:Ze,validate:Me}});e("Core",Ge.Core),e("Schema",Ge.Schema),e("Instance",Ge.Instance),e("Keywords",Ge.Keywords)}}}));
*/function J(e){var t=String(e);if(R.test(t))return t;if(t.length>0&&!_.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(B,"\\$1")+'"'}function N(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,i=Object.keys(t).sort(),a=0;a<i.length;a++){if(o=i[a],!R.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 N(n.toLowerCase());if(-1!==r){var i,a,s;for(q.lastIndex=r;a=q.exec(t);){if(a.index!==r)throw new TypeError("invalid parameter format");r+=a[0].length,i=a[1].toLowerCase(),'"'===(s=a[2])[0]&&(s=s.substr(1,s.length-2).replace(D,"$1")),o.parameters[i]=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)},te=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),i=e.indexOf("?"),a=e.indexOf("#");-1!==a&&(r=r.substring(0,a));if(-1!==i){const e=r.substring(i);t.query=e,r=r.substring(0,i)}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(oe.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)?re(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+ne(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let i,a=r.path,s=r.host;return 0===e.length?i=a:(a=a.substring(0,a.lastIndexOf("/")),i=ne(a+"/"+e)),s+=""!==i||t||o?i+t+o:"/",s}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:re(e)}};function re(e){return e+("/"===e[e.length-1]?"":"/")}function ne(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 oe=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");var ie=fetch;const{jsonTypeOf:ae,splitUrl:se}=b,ce={},ue={},le=(e,t)=>{const r=e in ue?ue[e]:e;if(r in ce)return ce[r][t]},fe={},de={},pe=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=se(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=le(n,"baseToken"),i=le(n,"anchorToken"),a=se(t)[0];if(!a&&!se(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const s=we(a,e[o]||""),[c,u]=se(s);delete e[o],u&&o===i&&(e[i]=i!==o?encodeURI(u):"#"+encodeURI(u)),a&&(de[a]=c);const l={},f=le(n,"recursiveAnchorToken");let d;!0===e[f]&&(l["#"]=c,e[i]="",delete e[f]);const p=le(n,"vocabularyToken");ae(e[p],"object")?(ue[c]=n,d=e[p],delete e[p]):(ue[c]=n,d={[n]:!0});const h={};fe[c]={id:c,schemaVersion:n,schema:he(e,c,n,m.nil,h,l),anchors:h,dynamicAnchors:l,vocabulary:d,validated:!1}},he=(e,t,r,n,o,i)=>{if(ae(e,"object")){const a="string"==typeof e.$schema?se(e.$schema)[0]:r,s=le(a,"embeddedToken"),c=le(a,"anchorToken");if("string"==typeof e[s]&&(s!==c||"#"!==e[s][0])){const n=we(t,e[s]);return e[s]=n,pe(e,n,r),E(e[s],e)}const u=le(r,"anchorToken"),l=le(r,"dynamicAnchorToken");"string"==typeof e[l]&&(i["#"+e[l]]=t,e[u]=e[l],delete e[l]);const f=le(r,"embeddedToken");if("string"==typeof e[u]){const t=u!==f?e[u]:e[u].slice(1);o[t]=n,delete e[u]}const d=le(r,"jrefToken");if("string"==typeof e[d])return E(e[d],e);for(let a in e)e[a]=he(e[a],t,r,m.append(a,n),o,i);const p=le(r,"jsrefToken");"string"==typeof e[p]&&(e[p]=E(e[p],e[p]));const h=le(r,"dynamicJsrefToken");return"string"==typeof e[h]&&(e[h]=E(e[h],e[h],!0)),e}return Array.isArray(e)?e.map(((e,a)=>he(e,t,r,m.append(a,n),o,i))):e},ye=e=>fe[de[e]]||fe[e],me=Object.freeze({id:"",schemaVersion:void 0,pointer:"",schema:void 0,dynamicAnchors:{}}),ve=async(e,t=me,r=!1)=>{const n=r&&t.dynamicAnchors[e]?t.dynamicAnchors[e]:Ee(t),o=we(n,e),[i,a]=se(o);if(!(e=>e in fe||e in de)(i)){const e=await ie(i,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error("Failed to retrieve schema with id: "+i);if(e.headers.has("content-type")){const t=Z.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${i} is not a schema. Found a document with media type: ${t}`)}pe(await e.json(),i)}const s=ye(i),c=a&&"/"!==a[0]?Oe(s,a):a,u=Object.freeze({id:s.id,schemaVersion:s.schemaVersion,vocabulary:s.vocabulary,pointer:c,schema:s.schema,value:m.get(c,s.schema),dynamicAnchors:{...s.dynamicAnchors,...t.dynamicAnchors},validated:s.validated});return be(u)},be=e=>S(e.value)?ve(j(e.value),e,A(e.value)):e,we=(e,t)=>{const r=te(e,t),n=se(e)[0];if(n&&"file"===ge(r)&&"file"!==ge(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},ge=e=>{const t=e.match(/^(.+):\/\//);return t?t[1]:""},Oe=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},Ee=e=>`${e.id}#${encodeURI(e.pointer)}`,Se=e=>S(e.value)?$(e.value):e.value,je=(e,t)=>{const r=ye(t.id),n=Object.freeze({id:t.id,schemaVersion:t.schemaVersion,vocabulary:t.vocabulary,pointer:m.append(e,t.pointer),schema:r.schema,value:Se(t)[e],dynamicAnchors:t.dynamicAnchors,validated:r.validated});return be(n)},$e=t(((e,t)=>ee.pipeline([Se,ee.map((async(r,n)=>e(await je(n,t),n))),ee.all],t)));var Ae={setConfig:(e,t,r)=>{ce[e]||(ce[e]={}),ce[e][t]=r},getConfig:le,add:pe,get:ve,markValidated:e=>{fe[e].validated=!0},uri:Ee,value:Se,typeOf:(e,t)=>ae(Se(e),t),has:(e,t)=>e in Se(t),step:je,keys:e=>Object.keys(Se(e)),entries:e=>ee.pipeline([Se,Object.keys,ee.map((async t=>[t,await je(t,e)])),ee.all],e),map:$e,length:e=>Se(e).length};class xe extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var Pe=xe;const Te="FLAG",Ie="BASIC",ke="DETAILED",Ve="VERBOSE";let ze=ke,Ce=!0;const Ke=async e=>{const t={};return{ast:t,schemaUri:await Fe(e,t)}},Le=t((({ast:e,schemaUri:t},r,n=Te)=>{if(![Te,Ie,ke,Ve].includes(n))throw Error(`The '${n}' error format is not supported`);let i=[];const a=o.subscribe("result",Ue(n,i));return Je(t,r,e),o.unsubscribe(a),i[0]})),Ue=(e,t)=>{const r=[];return(n,o)=>{if("result"===n){const{keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:i}=o,a={keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:i,errors:[]};r.push(a)}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===Ie&&(o.push(...t.errors),delete t.errors),(e===Ve||e!==Te&&!t.valid)&&n.errors.unshift(...o)}r[r.length-1]=n,t[0]=n}}},qe={},_e=e=>qe[e],Re=e=>e in qe,De={},Be={},Fe=async(e,t)=>{if(!Re(e.schemaVersion+"#validate")){const t=await Ae.get(e.schemaVersion);(Ae.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 De)Object.entries(De[e]).forEach((([e,r])=>{((e,t)=>{qe[e]={collectEvaluatedItems:(e,r,n)=>t.interpret(e,r,n)&&0,collectEvaluatedProperties:(e,r,n)=>t.interpret(e,r,n)&&[],...t}})(`${t.id}#${e}`,r)}));else if(r)throw Error("Missing required vocabulary: "+e)}))}if(Ce&&!e.validated){if(Ae.markValidated(e.id),!(e.schemaVersion in Be)){const t=await Ae.get(e.schemaVersion),r={},n=await Fe(t,r);Be[t.id]=Le({ast:r,schemaUri:n})}const t=U.cons(e.schema,e.id),r=Be[e.schemaVersion](t,ze);if(!r.valid)throw new Pe(r)}return await _e(e.schemaVersion+"#validate").compile(e,t),Ae.uri(e)},Je=(e,t,r)=>{const[n]=r[e];return _e(n).interpret(e,t,r)};var Ne={validate:async(e,t,r)=>{const n=await Ke(e),o=(e,t=Te)=>Le(n,U.cons(e),t);return void 0===t?o:o(t,r)},compile:Ke,interpret:Le,setMetaOutputFormat:e=>{ze=e},setShouldMetaValidate:e=>{Ce=e},FLAG:Te,BASIC:Ie,DETAILED:ke,VERBOSE:Ve,getKeyword:_e,hasKeyword:Re,defineVocabulary:(e,t)=>{De[e]=t},compileSchema:Fe,interpretSchema:Je,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return _e(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return _e(o).collectEvaluatedItems(e,t,r,n)}};var Ze={compile:e=>Ae.value(e),interpret:()=>!0};var Me={compile:async(e,t)=>{const r=Ae.uri(e);if(!(r in t)){t[r]=!1;const n=Ae.value(e);t[r]=[e.schemaVersion+"#validate",Ae.uri(e),"boolean"==typeof n?n:await ee.pipeline([Ae.entries,ee.map((([t,r])=>[`${e.schemaVersion}#${t}`,r])),ee.filter((([t])=>Ne.hasKeyword(t)&&t!==e.schemaVersion+"#validate")),ee.map((async([r,n])=>{const o=await Ne.getKeyword(r).compile(n,t,e);return[r,Ae.uri(n),o]})),ee.all],e)]}return r},interpret:(e,t,r)=>{const[n,i,a]=r[e];o.publishSync("result.start");const s="boolean"==typeof a?a:a.every((([e,n,i])=>{o.publishSync("result.start");const a=Ne.getKeyword(e).interpret(i,t,r);return o.publishSync("result",{keyword:e,absoluteKeywordLocation:n,instanceLocation:U.uri(t),valid:a,ast:i}),o.publishSync("result.end"),a}));return o.publishSync("result",{keyword:n,absoluteKeywordLocation:i,instanceLocation:U.uri(t),valid:s,ast:e}),o.publishSync("result.end"),s},collectEvaluatedProperties:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter((([e])=>!n||!e.endsWith("#unevaluatedProperties"))).reduce(((e,[n,,o])=>{const i=e&&Ne.getKeyword(n).collectEvaluatedProperties(o,t,r);return i&&e.concat(i)}),[])},collectEvaluatedItems:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter((([e])=>!n||!e.endsWith("#unevaluatedItems"))).reduce(((e,[n,,o])=>{const i=!1!==e&&Ne.getKeyword(n).collectEvaluatedItems(o,t,r);return!1!==i&&Math.max(e,i)}),0)}},We=e("default",{Core:Ne,Schema:Ae,Instance:U,Keywords:{metaData:Ze,validate:Me}});e("Core",We.Core),e("Schema",We.Schema),e("Instance",We.Instance),e("Keywords",We.Keywords)}}}));
//# sourceMappingURL=json-schema-core-system.min.js.map
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(global = global || self, factory(global.JSC = {}));
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.JSC = {}));
}(this, (function (exports) { 'use strict';

@@ -63,16 +63,8 @@

(function (root, factory){
var PubSub = {};
root.PubSub = PubSub;
var define = root.define;
factory(PubSub);
// AMD support
if (typeof define === 'function' && define.amd){
define(function() { return PubSub; });
// CommonJS and Node.js module support
} else {
// CommonJS and Node.js module support
{
if (module !== undefined && module.exports) {

@@ -83,3 +75,3 @@ exports = module.exports = PubSub; // Node.js specific `module.exports`

module.exports = exports = PubSub; // CommonJS
}
}

@@ -89,3 +81,4 @@ }(( typeof window === 'object' && window ) || commonjsGlobal, function (PubSub){

var messages = {},
lastUid = -1;
lastUid = -1,
ALL_SUBSCRIBING_MSG = '*';

@@ -157,8 +150,17 @@ function hasKeys(obj){

}
deliverMessage(message, ALL_SUBSCRIBING_MSG, data, immediateExceptions);
};
}
function hasDirectSubscribersFor( message ) {
var topic = String( message ),
found = Boolean(messages.hasOwnProperty( topic ) && hasKeys(messages[topic]));
return found;
}
function messageHasSubscribers( message ){
var topic = String( message ),
found = Boolean(messages.hasOwnProperty( topic ) && hasKeys(messages[topic])),
found = hasDirectSubscribersFor(topic) || hasDirectSubscribersFor(ALL_SUBSCRIBING_MSG),
position = topic.lastIndexOf( '.' );

@@ -169,3 +171,3 @@

position = topic.lastIndexOf( '.' );
found = Boolean(messages.hasOwnProperty( topic ) && hasKeys(messages[topic]));
found = hasDirectSubscribersFor(topic);
}

@@ -247,2 +249,6 @@

PubSub.subscribeAll = function( func ){
return PubSub.subscribe(ALL_SUBSCRIBING_MSG, func);
};
/**

@@ -1406,27 +1412,30 @@ * Subscribes the passed function to the passed message once

return (message, keywordResult) => {
const { keyword, absoluteKeywordLocation, instanceLocation, valid } = keywordResult;
const result = { keyword, absoluteKeywordLocation, instanceLocation, valid, errors: [] };
while (resultStack.length > 0 && isChild(resultStack[resultStack.length - 1], result)) {
const topResult = resultStack.pop();
let errors = [];
if (outputFormat === BASIC) {
errors = topResult.errors;
delete topResult.errors;
if (message === "result") {
const { keyword, absoluteKeywordLocation, instanceLocation, valid } = keywordResult;
const result = { keyword, absoluteKeywordLocation, instanceLocation, valid, errors: [] };
resultStack.push(result);
} else if (message === "result.start") {
resultStack.push(message);
} else if (message === "result.end") {
const result = resultStack.pop();
while (resultStack[resultStack.length - 1] !== "result.start") {
const topResult = resultStack.pop();
const errors = [topResult];
if (outputFormat === BASIC) {
errors.push(...topResult.errors);
delete topResult.errors;
}
if (outputFormat === VERBOSE || (outputFormat !== FLAG && !topResult.valid)) {
result.errors.unshift(...errors);
}
}
result.errors.unshift(topResult, ...errors);
}
resultStack[resultStack.length - 1] = result;
if (outputFormat === VERBOSE || (outputFormat !== FLAG && !result.valid)) {
resultStack.push(result);
output[0] = result;
}
output[0] = result;
};
};
const isChild = (topResult, nextResult) => {
return topResult.absoluteKeywordLocation.startsWith(nextResult.absoluteKeywordLocation)
|| nextResult.keyword.endsWith("#validate") && topResult.instanceLocation === nextResult.instanceLocation;
};
const setMetaOutputFormat = (format) => {

@@ -1556,2 +1565,4 @@ metaOutputFormat = format;

}
return url;
};

@@ -1562,4 +1573,6 @@

pubsub.publishSync("result.start");
const isValid = typeof nodes === "boolean" ? nodes : nodes
.every(([keywordId, schemaUrl, keywordValue]) => {
pubsub.publishSync("result.start");
const isValid = core.getKeyword(keywordId).interpret(keywordValue, instance$1, ast);

@@ -1574,2 +1587,3 @@

});
pubsub.publishSync("result.end");
return isValid;

@@ -1585,2 +1599,3 @@ });

});
pubsub.publishSync("result.end");
return isValid;

@@ -1587,0 +1602,0 @@ };

@@ -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=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){!function(r,n){var o={};r.PubSub=o;var a=r.define;!function(e){var t={},r=-1;function n(e){var t;for(t in e)if(e.hasOwnProperty(t))return!0;return!1}function o(e){return function(){throw e}}function a(e,t,r){try{e(t,r)}catch(e){setTimeout(o(e),0)}}function i(e,t,r){e(t,r)}function s(e,r,n,o){var s,c=t[r],u=o?i:a;if(t.hasOwnProperty(r))for(s in c)c.hasOwnProperty(s)&&u(c[s],e,n)}function c(e,t,r){return function(){var n=String(e),o=n.lastIndexOf(".");for(s(e,e,t,r);-1!==o;)o=(n=n.substr(0,o)).lastIndexOf("."),s(e,n,t,r)}}function u(e){for(var r=String(e),o=Boolean(t.hasOwnProperty(r)&&n(t[r])),a=r.lastIndexOf(".");!o&&-1!==a;)a=(r=r.substr(0,a)).lastIndexOf("."),o=Boolean(t.hasOwnProperty(r)&&n(t[r]));return o}function l(e,t,r,n){var o=c(e="symbol"==typeof e?e.toString():e,t,n);return!!u(e)&&(!0===r?o():setTimeout(o,0),!0)}e.publish=function(t,r){return l(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return l(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,t.hasOwnProperty(e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},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)t.hasOwnProperty(r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n=0;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n++;return n},e.getSubscriptions=function(e){var r,n=[];for(r in t)t.hasOwnProperty(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(t.hasOwnProperty(r)&&0===r.indexOf(e))return!0;return!1},s="string"==typeof r&&(t.hasOwnProperty(r)||i(r)),c=!s&&"string"==typeof r,u="function"==typeof r,l=!1;if(!s){for(n in t)if(t.hasOwnProperty(n)){if(o=t[n],c&&o[r]){delete o[r],l=r;break}if(u)for(a in o)o.hasOwnProperty(a)&&o[a]===r&&(delete o[a],l=!0)}return l}e.clearSubscriptions(r)}}(o),"function"==typeof a&&a.amd?a((function(){return o})):(void 0!==e&&e.exports&&(t=e.exports=o),t.PubSub=o,e.exports=t=o)}("object"==typeof window&&window||r)}));n.PubSub;const o=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(f)},a=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:a(e,p(t,o,n),r,u(o,n))}}if(Array.isArray(t)){const n=[...t];return n[d(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:p(t,e[0],n)},i=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||h(t)){const o=e.shift();i(e,p(t,o,n),r,u(o,n))}else{t[d(t,e[0])]=r}},s=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=p(t,n,r);return{...t,[n]:s(e,o,u(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 p(t,e[0],r)}},c=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=p(t,n,r);c(e,o,u(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:p(t,e[0],r)},u=t((e,t)=>t+"/"+l(e)),l=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),f=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),d=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,p=(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(h(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[d(e,t)]},h=e=>null===e||"object"!=typeof e;var y={nil:"",append:u,get:(e,t)=>{const r=o(e),n=e=>r.reduce(([e,t],r)=>[p(e,r,t),u(r,t)],[e,""])[0];return void 0===t?n:n(t)},set:(e,r,n)=>{const i=o(e),s=t((e,t)=>a(i,e,t,""));return void 0===r?s:s(r,n)},assign:(e,r,n)=>{const a=o(e),s=t((e,t)=>i(a,e,t,""));return void 0===r?s:s(r,n)},unset:(e,t)=>{const r=o(e),n=e=>s(r,e,"");return void 0===t?n:n(t)},delete:(e,t)=>{const r=o(e),n=e=>c(r,e,"");return void 0===t?n:n(t)}};const m={null:e=>null===e,boolean:e=>"boolean"==typeof e,object:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,array:e=>Array.isArray(e),number:e=>"number"==typeof e,integer:e=>Number.isInteger(e),string:e=>"string"==typeof e};var v={jsonTypeOf:(e,t)=>m[t](e),splitUrl: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)]}};const b=Symbol("$__value"),w=Symbol("$__href"),g=Symbol("$__isDynamic");var O=(e,t,r=!1)=>Object.freeze({[w]:e,[b]:t,[g]:r}),E=e=>e&&void 0!==e[w],j=e=>e[w],$=e=>e[b],x=e=>e[g];const{jsonTypeOf:A}=v,P=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),S=e=>E(e.value)?$(e.value):e.value,T=t((e,t)=>A(S(e),t)),I=(e,t)=>Object.freeze({...t,pointer:y.append(e,t.pointer),value:S(t)[e]}),k=t((e,t)=>S(t).map((r,n,o,a)=>e(I(n,t),n,o,a))),V=t((e,t)=>S(t).map((e,r,n,o)=>I(r,t)).filter((t,r,n,o)=>e(t,r,n,o))),L=t((e,t,r)=>S(r).reduce((t,n,o)=>e(t,I(o,r),o),t)),K=t((e,t)=>S(t).every((r,n,o,a)=>e(I(n,t),n,o,a))),z=t((e,t)=>S(t).some((r,n,o,a)=>e(I(n,t),n,o,a)));var C={cons:(e,t="")=>Object.freeze({...P,id:t,instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:S,typeOf:T,step:I,entries:e=>Object.keys(S(e)).map(t=>[t,I(t,e)]),keys:e=>Object.keys(S(e)),map:k,filter:V,reduce:L,every:K,some:z,length:e=>S(e).length},_=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,U=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,q=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,R=/\\([\u000b\u0020-\u00ff])/g,B=/([\\"])/g,D=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
!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(e.hasOwnProperty(t))return!0;return!1}function i(e){return function(){throw e}}function a(e,t,r){try{e(t,r)}catch(e){setTimeout(i(e),0)}}function s(e,t,r){e(t,r)}function c(e,r,n,o){var i,c=t[r],u=o?s:a;if(t.hasOwnProperty(r))for(i in c)c.hasOwnProperty(i)&&u(c[i],e,n)}function u(e,t,r){return function(){var o=String(e),i=o.lastIndexOf(".");for(c(e,e,t,r);-1!==i;)i=(o=o.substr(0,i)).lastIndexOf("."),c(e,o,t,r);c(e,n,t,r)}}function l(e){var r=String(e);return Boolean(t.hasOwnProperty(r)&&o(t[r]))}function f(e){for(var t=String(e),r=l(t)||l(n),o=t.lastIndexOf(".");!r&&-1!==o;)o=(t=t.substr(0,o)).lastIndexOf("."),r=l(t);return r}function d(e,t,r,n){var o=u(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 d(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return d(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,t.hasOwnProperty(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)t.hasOwnProperty(r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n=0;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n++;return n},e.getSubscriptions=function(e){var r,n=[];for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,i,a=function(e){var r;for(r in t)if(t.hasOwnProperty(r)&&0===r.indexOf(e))return!0;return!1},s="string"==typeof r&&(t.hasOwnProperty(r)||a(r)),c=!s&&"string"==typeof r,u="function"==typeof r,l=!1;if(!s){for(n in t)if(t.hasOwnProperty(n)){if(o=t[n],c&&o[r]){delete o[r],l=r;break}if(u)for(i in o)o.hasOwnProperty(i)&&o[i]===r&&(delete o[i],l=!0)}return l}e.clearSubscriptions(r)}}(o),void 0!==e&&e.exports&&(t=e.exports=o),t.PubSub=o,e.exports=t=o}));n.PubSub;const o=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(f)},i=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:i(e,p(t,o,n),r,u(o,n))}}if(Array.isArray(t)){const n=[...t];return n[d(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:p(t,e[0],n)},a=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||h(t)){const o=e.shift();a(e,p(t,o,n),r,u(o,n))}else{t[d(t,e[0])]=r}},s=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=p(t,n,r);return{...t,[n]:s(e,o,u(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 p(t,e[0],r)}},c=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=p(t,n,r);c(e,o,u(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:p(t,e[0],r)},u=t(((e,t)=>t+"/"+l(e))),l=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),f=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),d=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,p=(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(h(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[d(e,t)]},h=e=>null===e||"object"!=typeof e;var y={nil:"",append:u,get:(e,t)=>{const r=o(e),n=e=>r.reduce((([e,t],r)=>[p(e,r,t),u(r,t)]),[e,""])[0];return void 0===t?n:n(t)},set:(e,r,n)=>{const a=o(e),s=t(((e,t)=>i(a,e,t,"")));return void 0===r?s:s(r,n)},assign:(e,r,n)=>{const i=o(e),s=t(((e,t)=>a(i,e,t,"")));return void 0===r?s:s(r,n)},unset:(e,t)=>{const r=o(e),n=e=>s(r,e,"");return void 0===t?n:n(t)},delete:(e,t)=>{const r=o(e),n=e=>c(r,e,"");return void 0===t?n:n(t)}};const m={null:e=>null===e,boolean:e=>"boolean"==typeof e,object:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,array:e=>Array.isArray(e),number:e=>"number"==typeof e,integer:e=>Number.isInteger(e),string:e=>"string"==typeof e};var b={jsonTypeOf:(e,t)=>m[t](e),splitUrl: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)]}};const v=Symbol("$__value"),w=Symbol("$__href"),g=Symbol("$__isDynamic");var O=(e,t,r=!1)=>Object.freeze({[w]:e,[v]:t,[g]:r}),E=e=>e&&void 0!==e[w],j=e=>e[w],S=e=>e[v],$=e=>e[g];const{jsonTypeOf:A}=b,x=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),T=e=>E(e.value)?S(e.value):e.value,P=t(((e,t)=>A(T(e),t))),I=(e,t)=>Object.freeze({...t,pointer:y.append(e,t.pointer),value:T(t)[e]}),k=t(((e,t)=>T(t).map(((r,n,o,i)=>e(I(n,t),n,o,i))))),V=t(((e,t)=>T(t).map(((e,r,n,o)=>I(r,t))).filter(((t,r,n,o)=>e(t,r,n,o))))),z=t(((e,t,r)=>T(r).reduce(((t,n,o)=>e(t,I(o,r),o)),t))),C=t(((e,t)=>T(t).every(((r,n,o,i)=>e(I(n,t),n,o,i))))),K=t(((e,t)=>T(t).some(((r,n,o,i)=>e(I(n,t),n,o,i)))));var L={cons:(e,t="")=>Object.freeze({...x,id:t,instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:T,typeOf:P,step:I,entries:e=>Object.keys(T(e)).map((t=>[t,I(t,e)])),keys:e=>Object.keys(T(e)),map:k,filter:V,reduce:z,every:C,some:K,length:e=>T(e).length},_=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,U=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,q=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,R=/\\([\u000b\u0020-\u00ff])/g,D=/([\\"])/g,B=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
/*!

@@ -6,3 +6,3 @@ * content-type

* MIT Licensed
*/function W(e){var t=String(e);if(q.test(t))return t;if(t.length>0&&!U.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(B,"\\$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||!D.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],!q.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+W(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(!D.test(n))throw new TypeError("invalid media type");var o=new F(n.toLowerCase());if(-1!==r){var a,i,s;for(_.lastIndex=r;i=_.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(R,"$1")),o.parameters[a]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},M=async e=>Object.entries(await e),N=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)),H=t(async(e,t)=>{const r=await N(e,t);return(await Promise.all(r)).some(e=>e)}),Q=t(async(e,t)=>{const r=await N(e,t);return(await Promise.all(r)).every(e=>e)}),X=t((e,t)=>e.reduce(async(e,t)=>t(await e),t)),Y={entries:M,map:N,filter:G,reduce:Z,some:H,every:Q,pipeline:X,all:e=>Promise.all(e),allValues:e=>X([M,Z(async(e,[t,r])=>(e[t]=await r,e),{})],e)},ee=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(ne.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)?te(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+re(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=re(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:te(e)}};function te(e){return e+("/"===e[e.length-1]?"":"/")}function re(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 ne=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");var oe=fetch;const{jsonTypeOf:ae,splitUrl:ie}=v,se={},ce={},ue=(e,t)=>{const r=e in ce?ce[e]:e;if(r in se)return se[r][t]},le={},fe={},de=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=ie(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=ie(t)[0];if(!i&&!ie(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const s=be(i,e[o]||""),[c,u]=ie(s);delete e[o],u&&o===a&&(e[a]=a!==o?encodeURI(u):"#"+encodeURI(u)),i&&(fe[i]=c);const l={},f=ue(n,"recursiveAnchorToken");let d;!0===e[f]&&(l["#"]=c,e[a]="",delete e[f]);const p=ue(n,"vocabularyToken");ae(e[p],"object")?(ce[c]=n,d=e[p],delete e[p]):(ce[c]=n,d={[n]:!0});const h={};le[c]={id:c,schemaVersion:n,schema:pe(e,c,n,y.nil,h,l),anchors:h,dynamicAnchors:l,vocabulary:d,validated:!1}},pe=(e,t,r,n,o,a)=>{if(ae(e,"object")){const i="string"==typeof e.$schema?ie(e.$schema)[0]:r,s=ue(i,"embeddedToken"),c=ue(i,"anchorToken");if("string"==typeof e[s]&&(s!==c||"#"!==e[s][0])){const n=be(t,e[s]);return e[s]=n,de(e,n,r),O(e[s],e)}const u=ue(r,"anchorToken"),l=ue(r,"dynamicAnchorToken");"string"==typeof e[l]&&(a["#"+e[l]]=t,e[u]=e[l],delete e[l]);const f=ue(r,"embeddedToken");if("string"==typeof e[u]){const t=u!==f?e[u]:e[u].slice(1);o[t]=n,delete e[u]}const d=ue(r,"jrefToken");if("string"==typeof e[d])return O(e[d],e);for(let i in e)e[i]=pe(e[i],t,r,y.append(i,n),o,a);const p=ue(r,"jsrefToken");"string"==typeof e[p]&&(e[p]=O(e[p],e[p]));const h=ue(r,"dynamicJsrefToken");return"string"==typeof e[h]&&(e[h]=O(e[h],e[h],!0)),e}return Array.isArray(e)?e.map((e,i)=>pe(e,t,r,y.append(i,n),o,a)):e},he=e=>le[fe[e]]||le[e],ye=Object.freeze({id:"",schemaVersion:void 0,pointer:"",schema:void 0,dynamicAnchors:{}}),me=async(e,t=ye,r=!1)=>{const n=r&&t.dynamicAnchors[e]?t.dynamicAnchors[e]:Oe(t),o=be(n,e),[a,i]=ie(o);if(!(e=>e in le||e in fe)(a)){const e=await oe(a,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error("Failed to retrieve schema with id: "+a);if(e.headers.has("content-type")){const t=J.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${a} is not a schema. Found a document with media type: ${t}`)}de(await e.json(),a)}const s=he(a),c=i&&"/"!==i[0]?ge(s,i):i,u=Object.freeze({id:s.id,schemaVersion:s.schemaVersion,vocabulary:s.vocabulary,pointer:c,schema:s.schema,value:y.get(c,s.schema),dynamicAnchors:{...s.dynamicAnchors,...t.dynamicAnchors},validated:s.validated});return ve(u)},ve=e=>E(e.value)?me(j(e.value),e,x(e.value)):e,be=(e,t)=>{const r=ee(e,t),n=ie(e)[0];if(n&&"file"===we(r)&&"file"!==we(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},we=e=>{const t=e.match(/^(.+):\/\//);return t?t[1]:""},ge=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},Oe=e=>`${e.id}#${encodeURI(e.pointer)}`,Ee=e=>E(e.value)?$(e.value):e.value,je=(e,t)=>{const r=he(t.id),n=Object.freeze({id:t.id,schemaVersion:t.schemaVersion,vocabulary:t.vocabulary,pointer:y.append(e,t.pointer),schema:r.schema,value:Ee(t)[e],dynamicAnchors:t.dynamicAnchors,validated:r.validated});return ve(n)},$e=t((e,t)=>Y.pipeline([Ee,Y.map(async(r,n)=>e(await je(n,t),n)),Y.all],t));var xe={setConfig:(e,t,r)=>{se[e]||(se[e]={}),se[e][t]=r},getConfig:ue,add:de,get:me,markValidated:e=>{le[e].validated=!0},uri:Oe,value:Ee,typeOf:(e,t)=>ae(Ee(e),t),has:(e,t)=>e in Ee(t),step:je,keys:e=>Object.keys(Ee(e)),entries:e=>Y.pipeline([Ee,Object.keys,Y.map(async t=>[t,await je(t,e)]),Y.all],e),map:$e,length:e=>Ee(e).length};class Ae extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var Pe=Ae;const Se="FLAG",Te="BASIC",Ie="DETAILED",ke="VERBOSE";let Ve=Ie,Le=!0;const Ke=async e=>{const t={};return{ast:t,schemaUri:await We(e,t)}},ze=t(({ast:e,schemaUri:t},r,o=Se)=>{if(![Se,Te,Ie,ke].includes(o))throw Error(`The '${o}' error format is not supported`);let a=[];const i=n.subscribe("result",Ce(o,a));return Fe(t,r,e),n.unsubscribe(i),a[0]}),Ce=(e,t)=>{const r=[];return(n,o)=>{const{keyword:a,absoluteKeywordLocation:i,instanceLocation:s,valid:c}=o,u={keyword:a,absoluteKeywordLocation:i,instanceLocation:s,valid:c,errors:[]};for(;r.length>0&&_e(r[r.length-1],u);){const t=r.pop();let n=[];e===Te&&(n=t.errors,delete t.errors),u.errors.unshift(t,...n)}(e===ke||e!==Se&&!u.valid)&&r.push(u),t[0]=u}},_e=(e,t)=>e.absoluteKeywordLocation.startsWith(t.absoluteKeywordLocation)||t.keyword.endsWith("#validate")&&e.instanceLocation===t.instanceLocation,Ue={},qe=e=>Ue[e],Re=e=>e in Ue,Be={},De={},We=async(e,t)=>{if(!Re(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 Be)Object.entries(Be[e]).forEach(([e,r])=>{((e,t)=>{Ue[e]={collectEvaluatedItems:(e,r,n)=>t.interpret(e,r,n)&&0,collectEvaluatedProperties:(e,r,n)=>t.interpret(e,r,n)&&[],...t}})(`${t.id}#${e}`,r)});else if(r)throw Error("Missing required vocabulary: "+e)})}if(Le&&!e.validated){if(xe.markValidated(e.id),!(e.schemaVersion in De)){const t=await xe.get(e.schemaVersion),r={},n=await We(t,r);De[t.id]=ze({ast:r,schemaUri:n})}const t=C.cons(e.schema,e.id),r=De[e.schemaVersion](t,Ve);if(!r.valid)throw new Pe(r)}return await qe(e.schemaVersion+"#validate").compile(e,t),xe.uri(e)},Fe=(e,t,r)=>{const[n]=r[e];return qe(n).interpret(e,t,r)};var Je={validate:async(e,t,r)=>{const n=await Ke(e),o=(e,t=Se)=>ze(n,C.cons(e),t);return void 0===t?o:o(t,r)},compile:Ke,interpret:ze,setMetaOutputFormat:e=>{Ve=e},setShouldMetaValidate:e=>{Le=e},FLAG:Se,BASIC:Te,DETAILED:Ie,VERBOSE:ke,getKeyword:qe,hasKeyword:Re,defineVocabulary:(e,t)=>{Be[e]=t},compileSchema:We,interpretSchema:Fe,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return qe(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return qe(o).collectEvaluatedItems(e,t,r,n)}};var Me={compile:e=>xe.value(e),interpret:()=>!0};var Ne={compile:async(e,t)=>{const r=xe.uri(e);if(!(r in t)){t[r]=!1;const n=xe.value(e);t[r]=[e.schemaVersion+"#validate",xe.uri(e),"boolean"==typeof n?n:await Y.pipeline([xe.entries,Y.map(([t,r])=>[`${e.schemaVersion}#${t}`,r]),Y.filter(([t])=>Je.hasKeyword(t)&&t!==e.schemaVersion+"#validate"),Y.map(async([r,n])=>{const o=await Je.getKeyword(r).compile(n,t,e);return[r,xe.uri(n),o]}),Y.all],e)]}},interpret:(e,t,r)=>{const[o,a,i]=r[e],s="boolean"==typeof i?i:i.every(([e,o,a])=>{const i=Je.getKeyword(e).interpret(a,t,r);return n.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:C.uri(t),valid:i,ast:a}),i});return n.publishSync("result",{keyword:o,absoluteKeywordLocation:a,instanceLocation:C.uri(t),valid:s,ast:e}),s},collectEvaluatedProperties:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedProperties")).reduce((e,[n,,o])=>{const a=e&&Je.getKeyword(n).collectEvaluatedProperties(o,t,r);return a&&e.concat(a)},[])},collectEvaluatedItems:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedItems")).reduce((e,[n,,o])=>{const a=!1!==e&&Je.getKeyword(n).collectEvaluatedItems(o,t,r);return!1!==a&&Math.max(e,a)},0)}},Ze={Core:Je,Schema:xe,Instance:C,Keywords:{metaData:Me,validate:Ne}},Ge=Ze.Core,He=Ze.Schema,Qe=Ze.Instance,Xe=Ze.Keywords;e.Core=Ge,e.Instance=Qe,e.Keywords=Xe,e.Schema=He,e.default=Ze,Object.defineProperty(e,"__esModule",{value:!0})}));
*/function F(e){var t=String(e);if(q.test(t))return t;if(t.length>0&&!U.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(D,"\\$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||!B.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,i=Object.keys(t).sort(),a=0;a<i.length;a++){if(o=i[a],!q.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 J(n.toLowerCase());if(-1!==r){var i,a,s;for(_.lastIndex=r;a=_.exec(t);){if(a.index!==r)throw new TypeError("invalid parameter format");r+=a[0].length,i=a[1].toLowerCase(),'"'===(s=a[2])[0]&&(s=s.substr(1,s.length-2).replace(R,"$1")),o.parameters[i]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},N=async e=>Object.entries(await e),Z=t((async(e,t)=>(await t).map(e))),W=t((async(e,t,r)=>(await r).reduce((async(t,r)=>e(await t,r)),t))),G=t((async(e,t,r={})=>W((async(t,r)=>await e(r)?t.concat([r]):t),[],t,r))),H=t((async(e,t)=>{const r=await Z(e,t);return(await Promise.all(r)).some((e=>e))})),Q=t((async(e,t)=>{const r=await Z(e,t);return(await Promise.all(r)).every((e=>e))})),X=t(((e,t)=>e.reduce((async(e,t)=>t(await e)),t))),Y={entries:N,map:Z,filter:G,reduce:W,some:H,every:Q,pipeline:X,all:e=>Promise.all(e),allValues:e=>X([N,W((async(e,[t,r])=>(e[t]=await r,e)),{})],e)},ee=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),i=e.indexOf("?"),a=e.indexOf("#");-1!==a&&(r=r.substring(0,a));if(-1!==i){const e=r.substring(i);t.query=e,r=r.substring(0,i)}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(ne.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)?te(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+re(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let i,a=r.path,s=r.host;return 0===e.length?i=a:(a=a.substring(0,a.lastIndexOf("/")),i=re(a+"/"+e)),s+=""!==i||t||o?i+t+o:"/",s}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:te(e)}};function te(e){return e+("/"===e[e.length-1]?"":"/")}function re(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 ne=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");var oe=fetch;const{jsonTypeOf:ie,splitUrl:ae}=b,se={},ce={},ue=(e,t)=>{const r=e in ce?ce[e]:e;if(r in se)return se[r][t]},le={},fe={},de=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=ae(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=ue(n,"baseToken"),i=ue(n,"anchorToken"),a=ae(t)[0];if(!a&&!ae(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const s=ve(a,e[o]||""),[c,u]=ae(s);delete e[o],u&&o===i&&(e[i]=i!==o?encodeURI(u):"#"+encodeURI(u)),a&&(fe[a]=c);const l={},f=ue(n,"recursiveAnchorToken");let d;!0===e[f]&&(l["#"]=c,e[i]="",delete e[f]);const p=ue(n,"vocabularyToken");ie(e[p],"object")?(ce[c]=n,d=e[p],delete e[p]):(ce[c]=n,d={[n]:!0});const h={};le[c]={id:c,schemaVersion:n,schema:pe(e,c,n,y.nil,h,l),anchors:h,dynamicAnchors:l,vocabulary:d,validated:!1}},pe=(e,t,r,n,o,i)=>{if(ie(e,"object")){const a="string"==typeof e.$schema?ae(e.$schema)[0]:r,s=ue(a,"embeddedToken"),c=ue(a,"anchorToken");if("string"==typeof e[s]&&(s!==c||"#"!==e[s][0])){const n=ve(t,e[s]);return e[s]=n,de(e,n,r),O(e[s],e)}const u=ue(r,"anchorToken"),l=ue(r,"dynamicAnchorToken");"string"==typeof e[l]&&(i["#"+e[l]]=t,e[u]=e[l],delete e[l]);const f=ue(r,"embeddedToken");if("string"==typeof e[u]){const t=u!==f?e[u]:e[u].slice(1);o[t]=n,delete e[u]}const d=ue(r,"jrefToken");if("string"==typeof e[d])return O(e[d],e);for(let a in e)e[a]=pe(e[a],t,r,y.append(a,n),o,i);const p=ue(r,"jsrefToken");"string"==typeof e[p]&&(e[p]=O(e[p],e[p]));const h=ue(r,"dynamicJsrefToken");return"string"==typeof e[h]&&(e[h]=O(e[h],e[h],!0)),e}return Array.isArray(e)?e.map(((e,a)=>pe(e,t,r,y.append(a,n),o,i))):e},he=e=>le[fe[e]]||le[e],ye=Object.freeze({id:"",schemaVersion:void 0,pointer:"",schema:void 0,dynamicAnchors:{}}),me=async(e,t=ye,r=!1)=>{const n=r&&t.dynamicAnchors[e]?t.dynamicAnchors[e]:Oe(t),o=ve(n,e),[i,a]=ae(o);if(!(e=>e in le||e in fe)(i)){const e=await oe(i,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error("Failed to retrieve schema with id: "+i);if(e.headers.has("content-type")){const t=M.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${i} is not a schema. Found a document with media type: ${t}`)}de(await e.json(),i)}const s=he(i),c=a&&"/"!==a[0]?ge(s,a):a,u=Object.freeze({id:s.id,schemaVersion:s.schemaVersion,vocabulary:s.vocabulary,pointer:c,schema:s.schema,value:y.get(c,s.schema),dynamicAnchors:{...s.dynamicAnchors,...t.dynamicAnchors},validated:s.validated});return be(u)},be=e=>E(e.value)?me(j(e.value),e,$(e.value)):e,ve=(e,t)=>{const r=ee(e,t),n=ae(e)[0];if(n&&"file"===we(r)&&"file"!==we(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},we=e=>{const t=e.match(/^(.+):\/\//);return t?t[1]:""},ge=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},Oe=e=>`${e.id}#${encodeURI(e.pointer)}`,Ee=e=>E(e.value)?S(e.value):e.value,je=(e,t)=>{const r=he(t.id),n=Object.freeze({id:t.id,schemaVersion:t.schemaVersion,vocabulary:t.vocabulary,pointer:y.append(e,t.pointer),schema:r.schema,value:Ee(t)[e],dynamicAnchors:t.dynamicAnchors,validated:r.validated});return be(n)},Se=t(((e,t)=>Y.pipeline([Ee,Y.map((async(r,n)=>e(await je(n,t),n))),Y.all],t)));var $e={setConfig:(e,t,r)=>{se[e]||(se[e]={}),se[e][t]=r},getConfig:ue,add:de,get:me,markValidated:e=>{le[e].validated=!0},uri:Oe,value:Ee,typeOf:(e,t)=>ie(Ee(e),t),has:(e,t)=>e in Ee(t),step:je,keys:e=>Object.keys(Ee(e)),entries:e=>Y.pipeline([Ee,Object.keys,Y.map((async t=>[t,await je(t,e)])),Y.all],e),map:Se,length:e=>Ee(e).length};class Ae extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var xe=Ae;const Te="FLAG",Pe="BASIC",Ie="DETAILED",ke="VERBOSE";let Ve=Ie,ze=!0;const Ce=async e=>{const t={};return{ast:t,schemaUri:await Be(e,t)}},Ke=t((({ast:e,schemaUri:t},r,o=Te)=>{if(![Te,Pe,Ie,ke].includes(o))throw Error(`The '${o}' error format is not supported`);let i=[];const a=n.subscribe("result",Le(o,i));return Fe(t,r,e),n.unsubscribe(a),i[0]})),Le=(e,t)=>{const r=[];return(n,o)=>{if("result"===n){const{keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:i}=o,a={keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:i,errors:[]};r.push(a)}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===Pe&&(o.push(...t.errors),delete t.errors),(e===ke||e!==Te&&!t.valid)&&n.errors.unshift(...o)}r[r.length-1]=n,t[0]=n}}},_e={},Ue=e=>_e[e],qe=e=>e in _e,Re={},De={},Be=async(e,t)=>{if(!qe(e.schemaVersion+"#validate")){const t=await $e.get(e.schemaVersion);($e.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 Re)Object.entries(Re[e]).forEach((([e,r])=>{((e,t)=>{_e[e]={collectEvaluatedItems:(e,r,n)=>t.interpret(e,r,n)&&0,collectEvaluatedProperties:(e,r,n)=>t.interpret(e,r,n)&&[],...t}})(`${t.id}#${e}`,r)}));else if(r)throw Error("Missing required vocabulary: "+e)}))}if(ze&&!e.validated){if($e.markValidated(e.id),!(e.schemaVersion in De)){const t=await $e.get(e.schemaVersion),r={},n=await Be(t,r);De[t.id]=Ke({ast:r,schemaUri:n})}const t=L.cons(e.schema,e.id),r=De[e.schemaVersion](t,Ve);if(!r.valid)throw new xe(r)}return await Ue(e.schemaVersion+"#validate").compile(e,t),$e.uri(e)},Fe=(e,t,r)=>{const[n]=r[e];return Ue(n).interpret(e,t,r)};var Je={validate:async(e,t,r)=>{const n=await Ce(e),o=(e,t=Te)=>Ke(n,L.cons(e),t);return void 0===t?o:o(t,r)},compile:Ce,interpret:Ke,setMetaOutputFormat:e=>{Ve=e},setShouldMetaValidate:e=>{ze=e},FLAG:Te,BASIC:Pe,DETAILED:Ie,VERBOSE:ke,getKeyword:Ue,hasKeyword:qe,defineVocabulary:(e,t)=>{Re[e]=t},compileSchema:Be,interpretSchema:Fe,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return Ue(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return Ue(o).collectEvaluatedItems(e,t,r,n)}};var Me={compile:e=>$e.value(e),interpret:()=>!0};var Ne={compile:async(e,t)=>{const r=$e.uri(e);if(!(r in t)){t[r]=!1;const n=$e.value(e);t[r]=[e.schemaVersion+"#validate",$e.uri(e),"boolean"==typeof n?n:await Y.pipeline([$e.entries,Y.map((([t,r])=>[`${e.schemaVersion}#${t}`,r])),Y.filter((([t])=>Je.hasKeyword(t)&&t!==e.schemaVersion+"#validate")),Y.map((async([r,n])=>{const o=await Je.getKeyword(r).compile(n,t,e);return[r,$e.uri(n),o]})),Y.all],e)]}return r},interpret:(e,t,r)=>{const[o,i,a]=r[e];n.publishSync("result.start");const s="boolean"==typeof a?a:a.every((([e,o,i])=>{n.publishSync("result.start");const a=Je.getKeyword(e).interpret(i,t,r);return n.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:L.uri(t),valid:a,ast:i}),n.publishSync("result.end"),a}));return n.publishSync("result",{keyword:o,absoluteKeywordLocation:i,instanceLocation:L.uri(t),valid:s,ast:e}),n.publishSync("result.end"),s},collectEvaluatedProperties:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter((([e])=>!n||!e.endsWith("#unevaluatedProperties"))).reduce(((e,[n,,o])=>{const i=e&&Je.getKeyword(n).collectEvaluatedProperties(o,t,r);return i&&e.concat(i)}),[])},collectEvaluatedItems:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter((([e])=>!n||!e.endsWith("#unevaluatedItems"))).reduce(((e,[n,,o])=>{const i=!1!==e&&Je.getKeyword(n).collectEvaluatedItems(o,t,r);return!1!==i&&Math.max(e,i)}),0)}},Ze={Core:Je,Schema:$e,Instance:L,Keywords:{metaData:Me,validate:Ne}},We=Ze.Core,Ge=Ze.Schema,He=Ze.Instance,Qe=Ze.Keywords;e.Core=We,e.Instance=He,e.Keywords=Qe,e.Schema=Ge,e.default=Ze,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=json-schema-core-umd.min.js.map

@@ -43,27 +43,30 @@ const curry = require("just-curry-it");

return (message, keywordResult) => {
const { keyword, absoluteKeywordLocation, instanceLocation, valid } = keywordResult;
const result = { keyword, absoluteKeywordLocation, instanceLocation, valid, errors: [] };
while (resultStack.length > 0 && isChild(resultStack[resultStack.length - 1], result)) {
const topResult = resultStack.pop();
let errors = [];
if (outputFormat === BASIC) {
errors = topResult.errors;
delete topResult.errors;
if (message === "result") {
const { keyword, absoluteKeywordLocation, instanceLocation, valid } = keywordResult;
const result = { keyword, absoluteKeywordLocation, instanceLocation, valid, errors: [] };
resultStack.push(result);
} else if (message === "result.start") {
resultStack.push(message);
} else if (message === "result.end") {
const result = resultStack.pop();
while (resultStack[resultStack.length - 1] !== "result.start") {
const topResult = resultStack.pop();
const errors = [topResult];
if (outputFormat === BASIC) {
errors.push(...topResult.errors);
delete topResult.errors;
}
if (outputFormat === VERBOSE || (outputFormat !== FLAG && !topResult.valid)) {
result.errors.unshift(...errors);
}
}
result.errors.unshift(topResult, ...errors);
}
resultStack[resultStack.length - 1] = result;
if (outputFormat === VERBOSE || (outputFormat !== FLAG && !result.valid)) {
resultStack.push(result);
output[0] = result;
}
output[0] = result;
};
};
const isChild = (topResult, nextResult) => {
return topResult.absoluteKeywordLocation.startsWith(nextResult.absoluteKeywordLocation)
|| nextResult.keyword.endsWith("#validate") && topResult.instanceLocation === nextResult.instanceLocation;
};
const setMetaOutputFormat = (format) => {

@@ -70,0 +73,0 @@ metaOutputFormat = format;

@@ -28,2 +28,4 @@ const Pact = require("@hyperjump/pact");

}
return url;
};

@@ -34,4 +36,6 @@

PubSub.publishSync("result.start");
const isValid = typeof nodes === "boolean" ? nodes : nodes
.every(([keywordId, schemaUrl, keywordValue]) => {
PubSub.publishSync("result.start");
const isValid = Core.getKeyword(keywordId).interpret(keywordValue, instance, ast);

@@ -46,2 +50,3 @@

});
PubSub.publishSync("result.end");
return isValid;

@@ -57,2 +62,3 @@ });

});
PubSub.publishSync("result.end");
return isValid;

@@ -59,0 +65,0 @@ };

{
"name": "@hyperjump/json-schema-core",
"version": "0.16.1",
"version": "0.17.0",
"description": "A framework for building JSON Schema tools",

@@ -36,7 +36,7 @@ "main": "lib/index.js",

"eslint": "^4.19.1",
"eslint-import-resolver-node": "^0.3.2",
"eslint-plugin-import": "^2.20.2",
"mocha": "^8.1.3",
"eslint-import-resolver-node": "^0.3.4",
"eslint-plugin-import": "^2.22.1",
"mocha": "^8.2.1",
"nock": "^9.6.1",
"rollup": "^2.12.1",
"rollup": "^2.33.1",
"rollup-plugin-terser": "^7.0.2"

@@ -49,5 +49,5 @@ },

"node-fetch": "^2.6.1",
"pubsub-js": "^1.8.0",
"pubsub-js": "^1.9.1",
"url-resolve-browser": "^1.2.0"
}
}

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 not supported yet

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 not supported yet

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 not supported yet

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 not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc