@hyperjump/json-schema-core
Advanced tools
Comparing version 0.23.4 to 0.23.5
@@ -1,3 +0,7 @@ | ||
define(['exports'], (function (exports) { 'use strict'; | ||
define(['exports', 'url-resolve-browser'], (function (exports, urlResolveBrowser) { 'use strict'; | ||
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } | ||
var urlResolveBrowser__default = /*#__PURE__*/_interopDefaultLegacy(urlResolveBrowser); | ||
var justCurryIt = curry; | ||
@@ -399,213 +403,2 @@ | ||
var urlResolveBrowser = urlResolve; | ||
/* | ||
The majority of the module is built by following RFC1808 | ||
url: https://tools.ietf.org/html/rfc1808 | ||
*/ | ||
// adds a slash at end if not present | ||
function _addSlash (url) { | ||
return url + (url[url.length-1] === '/' ? '' : '/'); | ||
} | ||
// resolve the ..'s (directory up) and such | ||
function _pathResolve (path) { | ||
let pathSplit = path.split('/'); | ||
// happens when path starts with / | ||
if (pathSplit[0] === '') { | ||
pathSplit = pathSplit.slice(1); | ||
} | ||
// let segmentCount = 0; // number of segments that have been passed | ||
let resultArray = []; | ||
pathSplit.forEach((current, index) => { | ||
// skip occurances of '.' | ||
if (current !== '.') { | ||
if (current === '..') { | ||
resultArray.pop(); // remove previous | ||
} else if (current !== '' || index === pathSplit.length - 1) { | ||
resultArray.push(current); | ||
} | ||
} | ||
}); | ||
return '/' + resultArray.join('/'); | ||
} | ||
// parses a base url string into an object containing host, path and query | ||
function _baseParse (base) { | ||
const resultObject = { | ||
host: '', | ||
path: '', | ||
query: '', | ||
protocol: '' | ||
}; | ||
let path = base; | ||
let protocolEndIndex = base.indexOf('//'); | ||
resultObject.protocol = path.substring(0, protocolEndIndex); | ||
protocolEndIndex += 2; // add two to pass double slash | ||
const pathIndex = base.indexOf('/', protocolEndIndex); | ||
const queryIndex = base.indexOf('?'); | ||
const hashIndex = base.indexOf('#'); | ||
if (hashIndex !== -1) { | ||
path = path.substring(0, hashIndex); // remove hash, not needed for base | ||
} | ||
if (queryIndex !== -1) { | ||
const query = path.substring(queryIndex); // remove query, save in return obj | ||
resultObject.query = query; | ||
path = path.substring(0, queryIndex); | ||
} | ||
if (pathIndex !== -1) { | ||
const host = path.substring(0, pathIndex); // separate host & path | ||
resultObject.host = host; | ||
path = path.substring(pathIndex); | ||
resultObject.path = path; | ||
} else { | ||
resultObject.host = path; // there was no path, therefore path is host | ||
} | ||
return resultObject; | ||
} | ||
// https://tools.ietf.org/html/rfc3986#section-3.1 | ||
const _scheme = '[a-z][a-z0-9+.-]*'; // ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )] | ||
const _isAbsolute = new RegExp(`^(${_scheme}:)?//`, 'i'); | ||
// parses a relative url string into an object containing the href, | ||
// hash, query and whether it is a net path, absolute path or relative path | ||
function _relativeParse (relative) { | ||
const resultObject = { | ||
href: relative, // href is always what was passed through | ||
hash: '', | ||
query: '', | ||
netPath: false, | ||
absolutePath: false, | ||
relativePath: false | ||
}; | ||
// check for protocol | ||
// if protocol exists, is net path (absolute URL) | ||
if (_isAbsolute.test(relative)) { | ||
resultObject.netPath = true; | ||
// return, in this case the relative is the resolved url, no need to parse. | ||
return resultObject; | ||
} | ||
// if / is first, this is an absolute path, | ||
// I.E. it overwrites the base URL's path | ||
if (relative[0] === '/') { | ||
resultObject.absolutePath = true; | ||
// return resultObject | ||
} else if (relative !== '') { | ||
resultObject.relativePath = true; | ||
} | ||
let path = relative; | ||
const queryIndex = relative.indexOf('?'); | ||
const hashIndex = relative.indexOf('#'); | ||
if (hashIndex !== -1) { | ||
const hash = path.substring(hashIndex); | ||
resultObject.hash = hash; | ||
path = path.substring(0, hashIndex); | ||
} | ||
if (queryIndex !== -1) { | ||
const query = path.substring(queryIndex); | ||
resultObject.query = query; | ||
path = path.substring(0, queryIndex); | ||
} | ||
resultObject.path = path; // whatever is left is path | ||
return resultObject; | ||
} | ||
function _shouldAddSlash (url) { | ||
const protocolIndex = url.indexOf('//') + 2; | ||
const noPath = !(url.includes('/', protocolIndex)); | ||
const noQuery = !(url.includes('?', protocolIndex)); | ||
const noHash = !(url.includes('#', protocolIndex)); | ||
return (noPath && noQuery && noHash); | ||
} | ||
function _shouldAddProtocol (url) { | ||
return url.startsWith('//'); | ||
} | ||
/* | ||
* PRECONDITION: Base is a fully qualified URL. e.g. http://example.com/ | ||
* optional: path, query or hash | ||
* returns the resolved url | ||
*/ | ||
function urlResolve (base, relative) { | ||
base = base.trim(); | ||
relative = relative.trim(); | ||
// about is always absolute | ||
if (relative.startsWith('about:')) { | ||
return relative; | ||
} | ||
const baseObj = _baseParse(base); | ||
const relativeObj = _relativeParse(relative); | ||
if (!baseObj.protocol && !relativeObj.netPath) { | ||
throw new Error('Error, protocol is not specified'); | ||
} | ||
if (relativeObj.netPath) { // relative is full qualified URL | ||
if (_shouldAddProtocol(relativeObj.href)) { | ||
relativeObj.href = baseObj.protocol + relativeObj.href; | ||
} | ||
if (_shouldAddSlash(relativeObj.href)) { | ||
return _addSlash(relativeObj.href); | ||
} | ||
return relativeObj.href; | ||
} else if (relativeObj.absolutePath) { // relative is an absolute path | ||
const {path, query, hash} = relativeObj; | ||
return baseObj.host + _pathResolve(path) + query + hash; | ||
} else if (relativeObj.relativePath) { // relative is a relative path | ||
const {path, query, hash} = relativeObj; | ||
let basePath = baseObj.path; | ||
let resultString = baseObj.host; | ||
let resolvePath; | ||
if (path.length === 0) { | ||
resolvePath = basePath; | ||
} else { | ||
// remove last segment if no slash at end | ||
basePath = basePath.substring(0, basePath.lastIndexOf('/')); | ||
resolvePath = _pathResolve(basePath + '/' + path); | ||
} | ||
// if result is just the base host, add / | ||
if ((resolvePath === '') && (!query) && (!hash)) { | ||
resultString += '/'; | ||
} else { | ||
resultString += resolvePath + query + hash; | ||
} | ||
return resultString; | ||
} else { | ||
const {host, path, query} = baseObj; | ||
// when path and query aren't supplied add slash | ||
if ((!path) && (!query)) { | ||
return _addSlash(host); | ||
} | ||
return host + path + query + relativeObj.hash; | ||
} | ||
} | ||
const isObject = (value) => typeof value === "object" && !Array.isArray(value) && value !== null; | ||
@@ -638,3 +431,3 @@ const isType = { | ||
const safeResolveUrl$1 = (contextUrl, url) => { | ||
const resolvedUrl = urlResolveBrowser(contextUrl, url); | ||
const resolvedUrl = urlResolveBrowser__default["default"](contextUrl, url); | ||
const contextId = splitUrl$2(contextUrl)[0]; | ||
@@ -641,0 +434,0 @@ if (contextId && getScheme(resolvedUrl) === "file" && getScheme(contextId) !== "file") { |
@@ -1,2 +0,2 @@ | ||
define(["exports"],(function(e){"use strict";var t=function(e,t){return function r(){null==t&&(t=e.length);var n=[].slice.call(arguments);return n.length>=t?e.apply(this,n):function(){return r.apply(this,n.concat([].slice.call(arguments)))}}};var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var n,o=(function(e,t){var n,o;n="object"==typeof window&&window||r,o={},n.PubSub=o,function(e){var t={},r=-1,n="*";function o(e){var t;for(t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function a(e){return function(){throw e}}function i(e,t,r){try{e(t,r)}catch(e){setTimeout(a(e),0)}}function s(e,t,r){e(t,r)}function c(e,r,n,o){var a,c=t[r],l=o?s:i;if(Object.prototype.hasOwnProperty.call(t,r))for(a in c)Object.prototype.hasOwnProperty.call(c,a)&&l(c[a],e,n)}function l(e,t,r){return function(){var o=String(e),a=o.lastIndexOf(".");for(c(e,e,t,r);-1!==a;)a=(o=o.substr(0,a)).lastIndexOf("."),c(e,o,t,r);c(e,n,t,r)}}function u(e){var r=String(e);return Boolean(Object.prototype.hasOwnProperty.call(t,r)&&o(t[r]))}function f(e){for(var t=String(e),r=u(t)||u(n),o=t.lastIndexOf(".");!r&&-1!==o;)o=(t=t.substr(0,o)).lastIndexOf("."),r=u(t);return r}function d(e,t,r,n){var o=l(e="symbol"==typeof e?e.toString():e,t,n);return!!f(e)&&(!0===r?o():setTimeout(o,0),!0)}e.publish=function(t,r){return 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,Object.prototype.hasOwnProperty.call(t,e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeAll=function(t){return e.subscribe(n,t)},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n,o=0;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)){for(n in t[r])o++;break}return o},e.getSubscriptions=function(e){var r,n=[];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,a,i=function(e){var r;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e))return!0;return!1},s="string"==typeof r&&(Object.prototype.hasOwnProperty.call(t,r)||i(r)),c=!s&&"string"==typeof r,l="function"==typeof r,u=!1;if(!s){for(n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(o=t[n],c&&o[r]){delete o[r],u=r;break}if(l)for(a in o)Object.prototype.hasOwnProperty.call(o,a)&&o[a]===r&&(delete o[a],u=!0)}return u}e.clearSubscriptions(r)}}(o),void 0!==e&&e.exports&&(t=e.exports=o),t.PubSub=o,e.exports=t=o}(n={exports:{}},n.exports),n.exports);o.PubSub;var a=function(e,t){if(e=e.trim(),(t=t.trim()).startsWith("about:"))return t;const r=function(e){const t={host:"",path:"",query:"",protocol:""};let r=e,n=e.indexOf("//");t.protocol=r.substring(0,n),n+=2;const o=e.indexOf("/",n),a=e.indexOf("?"),i=e.indexOf("#");-1!==i&&(r=r.substring(0,i));if(-1!==a){const e=r.substring(a);t.query=e,r=r.substring(0,a)}if(-1!==o){const e=r.substring(0,o);t.host=e,r=r.substring(o),t.path=r}else t.host=r;return t}(e),n=function(e){const t={href:e,hash:"",query:"",netPath:!1,absolutePath:!1,relativePath:!1};if(c.test(e))return t.netPath=!0,t;"/"===e[0]?t.absolutePath=!0:""!==e&&(t.relativePath=!0);let r=e;const n=e.indexOf("?"),o=e.indexOf("#");if(-1!==o){const e=r.substring(o);t.hash=e,r=r.substring(0,o)}if(-1!==n){const e=r.substring(n);t.query=e,r=r.substring(0,n)}return t.path=r,t}(t);if(!r.protocol&&!n.netPath)throw new Error("Error, protocol is not specified");if(n.netPath)return n.href.startsWith("//")&&(n.href=r.protocol+n.href),function(e){const t=e.indexOf("//")+2,r=!e.includes("/",t),n=!e.includes("?",t),o=!e.includes("#",t);return r&&n&&o}(n.href)?i(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+s(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let a,i=r.path,c=r.host;return 0===e.length?a=i:(i=i.substring(0,i.lastIndexOf("/")),a=s(i+"/"+e)),c+=""!==a||t||o?a+t+o:"/",c}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:i(e)}};function i(e){return e+("/"===e[e.length-1]?"":"/")}function s(e){let t=e.split("/");""===t[0]&&(t=t.slice(1));let r=[];return t.forEach(((e,n)=>{"."!==e&&(".."===e?r.pop():""===e&&n!==t.length-1||r.push(e))})),"/"+r.join("/")}const c=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");const l={null:e=>null===e,boolean:e=>"boolean"==typeof e,object:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,array:e=>Array.isArray(e),number:e=>"number"==typeof e,integer:e=>Number.isInteger(e),string:e=>"string"==typeof e},u=e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),o=e.slice(r+1);return[decodeURI(n),decodeURI(o)]},f=e=>{const t=RegExp(/^(.+):\/\//).exec(e);return t?t[1]:""};var d={jsonTypeOf:(e,t)=>l[t](e),splitUrl:u,safeResolveUrl:(e,t)=>{const r=a(e,t),n=u(e)[0];if(n&&"file"===f(r)&&"file"!==f(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},pathRelative:(e,t)=>{if(e===t)return"";let r=1;const n=e.length-1,o=t.length-r,a=n<o?n:o;let i=-1,s=0;for(;s<a;s++){const n=e.charCodeAt(s+1);if(n!==t.charCodeAt(r+s))break;47===n&&(i=s)}if(o>a){if(47===t.charCodeAt(r+s))return t.slice(r+s+1);if(0===s)return t.slice(r+s)}n>a&&(47===e.charCodeAt(s+1)?i=s:0===a&&(i=0));let c="";for(s=i+2;s<=e.length;++s)s!==e.length&&47!==e.charCodeAt(s)||(c+=0===c.length?"..":"/..");return r+=i,c.length>0?`${c}${t.slice(r,t.length)}`:(47===t.charCodeAt(r)&&++r,t.slice(r,t.length))}};const p=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(w)},h=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:h(e,E(t,o,n),r,v(o,n))}}if(Array.isArray(t)){const n=[...t];return n[O(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:E(t,e[0],n)},y=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||j(t)){const o=e.shift();y(e,E(t,o,n),r,v(o,n))}else{t[O(t,e[0])]=r}},m=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=E(t,n,r);return{...t,[n]:m(e,o,v(n,r))}}if(Array.isArray(t))return t.filter(((t,r)=>r!=e[0]));if("object"==typeof t&&null!==t){const{[e[0]]:r,...n}=t;return n}return E(t,e[0],r)}},b=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=E(t,n,r);b(e,o,v(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:E(t,e[0],r)},v=t(((e,t)=>t+"/"+g(e))),g=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),w=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),O=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,E=(e,t,r="")=>{if(void 0===e)throw TypeError(`Value at '${r}' is undefined and does not have property '${t}'`);if(null===e)throw TypeError(`Value at '${r}' is null and does not have property '${t}'`);if(j(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[O(e,t)]},j=e=>null===e||"object"!=typeof e;var $={nil:"",append:v,get:(e,t)=>{const r=p(e),n=e=>r.reduce((([e,t],r)=>[E(e,r,t),v(r,t)]),[e,""])[0];return void 0===t?n:n(t)},set:(e,r,n)=>{const o=p(e),a=t(((e,t)=>h(o,e,t,"")));return void 0===r?a:a(r,n)},assign:(e,r,n)=>{const o=p(e),a=t(((e,t)=>y(o,e,t,"")));return void 0===r?a:a(r,n)},unset:(e,t)=>{const r=p(e),n=e=>m(r,e,"");return void 0===t?n:n(t)},remove:(e,t)=>{const r=p(e),n=e=>b(r,e,"");return void 0===t?n:n(t)}};$.nil,$.append,$.get,$.set,$.assign,$.unset,$.remove;const S=Symbol("$__value"),A=Symbol("$__href");var x={cons:(e,t)=>Object.freeze({[A]:e,[S]:t}),isReference:e=>e&&void 0!==e[A],href:e=>e[A],value:e=>e[S]};const{jsonTypeOf:P}=d,I=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),T=e=>x.isReference(e.value)?x.value(e.value):e.value,k=t(((e,t)=>P(T(e),t))),V=(e,t)=>Object.freeze({...t,pointer:$.append(e,t.pointer),value:T(t)[e]}),R=t(((e,t)=>T(t).map(((r,n,o,a)=>e(V(n,t),n,o,a))))),C=t(((e,t)=>T(t).map(((e,r,n,o)=>V(r,t))).filter(((t,r,n,o)=>e(t,r,n,o))))),U=t(((e,t,r)=>T(r).reduce(((t,n,o)=>e(t,V(o,r),o)),t))),z=t(((e,t)=>T(t).every(((r,n,o,a)=>e(V(n,t),n,o,a))))),K=t(((e,t)=>T(t).some(((r,n,o,a)=>e(V(n,t),n,o,a)))));var L={nil:I,cons:(e,t="")=>Object.freeze({...I,id:t,instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:T,has:(e,t)=>e in T(t),typeOf:k,step:V,entries:e=>Object.keys(T(e)).map((t=>[t,V(t,e)])),keys:e=>Object.keys(T(e)),map:R,filter:C,reduce:U,every:z,some:K,length:e=>T(e).length},q=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,_=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,D=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,N=/\\([\u000b\u0020-\u00ff])/g,B=/([\\"])/g,F=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function J(e){var t=String(e);if(D.test(t))return t;if(t.length>0&&!_.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(B,"\\$1")+'"'}function W(e){this.parameters=Object.create(null),this.type=e}var Z={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!F.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,a=Object.keys(t).sort(),i=0;i<a.length;i++){if(o=a[i],!D.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+J(t[o])}return n},parse:function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;"function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.substr(0,r).trim():t.trim();if(!F.test(n))throw new TypeError("invalid media type");var o=new W(n.toLowerCase());if(-1!==r){var a,i,s;for(q.lastIndex=r;i=q.exec(t);){if(i.index!==r)throw new TypeError("invalid parameter format");r+=i[0].length,a=i[1].toLowerCase(),'"'===(s=i[2])[0]&&(s=s.substr(1,s.length-2).replace(N,"$1")),o.parameters[a]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},M=async e=>Object.entries(await e),G=t((async(e,t)=>(await t).map(e))),H=t((async(e,t,r)=>(await r).reduce((async(t,r)=>e(await t,r)),t))),Q=t((async(e,t,r={})=>H((async(t,r)=>await e(r)?t.concat([r]):t),[],t,r))),X=t((async(e,t)=>{const r=await G(e,t);return(await Promise.all(r)).some((e=>e))})),Y=t((async(e,t)=>{const r=await G(e,t);return(await Promise.all(r)).every((e=>e))})),ee=t(((e,t)=>e.reduce((async(e,t)=>t(await e)),t))),te={entries:M,map:G,filter:Q,reduce:H,some:X,every:Y,pipeline:ee,all:e=>Promise.all(e),allValues:e=>ee([M,H((async(e,[t,r])=>(e[t]=await r,e)),{})],e)};te.entries,te.map,te.filter,te.reduce,te.some,te.every,te.pipeline,te.all,te.allValues;var re=fetch;const{jsonTypeOf:ne,splitUrl:oe,safeResolveUrl:ae,pathRelative:ie}=d,se={},ce={},le=(e,t)=>{const r=e in ce?ce[e]:e;if(r in se)return se[r][t]},ue={},fe={},de=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=oe(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=le(n,"baseToken"),a=le(n,"anchorToken"),i=oe(t)[0];if(!i&&!oe(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const s=ae(i,e[o]||""),[c,l]=oe(s);delete e[o],l&&o===a&&(e[a]=a!==o?encodeURI(l):`#${encodeURI(l)}`),i&&(fe[i]=c);const u={},f=le(n,"recursiveAnchorToken");let d;!0===e[f]&&(u[""]=`${c}#`,e[a]="",delete e[f]);const p=le(n,"vocabularyToken");ne(e[p],"object")?(ce[c]=n,d=e[p],delete e[p]):(ce[c]=n,d={[n]:!0});const h={"":""};return ue[c]={id:c,schemaVersion:n,schema:pe(e,c,n,$.nil,h,u),anchors:h,dynamicAnchors:u,vocabulary:d,validated:!1},c},pe=(e,t,r,n,o,a)=>{if(ne(e,"object")){const i="string"==typeof e.$schema?oe(e.$schema)[0]:r,s=le(i,"embeddedToken"),c=le(i,"anchorToken");if("string"==typeof e[s]&&(s!==c||"#"!==e[s][0])){const n=ae(t,e[s]);return e[s]=n,de(e,n,r),x.cons(e[s],e)}const l=le(r,"anchorToken"),u=le(r,"dynamicAnchorToken");"string"==typeof e[u]&&(a[e[u]]=`${t}#${encodeURI(n)}`,o[e[u]]=n,delete e[u]);const f=le(r,"embeddedToken");if("string"==typeof e[l]){const t=l!==f?e[l]:e[l].slice(1);o[t]=n,delete e[l]}const d=le(r,"jrefToken");if("string"==typeof e[d])return x.cons(e[d],e);for(const i in e)e[i]=pe(e[i],t,r,$.append(i,n),o,a);return e}return Array.isArray(e)?e.map(((e,i)=>pe(e,t,r,$.append(i,n),o,a))):e},he=e=>ue[fe[e]]||ue[e],ye=Object.freeze({id:"",schemaVersion:void 0,vocabulary:{},pointer:$.nil,schema:void 0,value:void 0,anchors:{},dynamicAnchors:{},validated:!0}),me=async(e,t=ye)=>{const r=ae(ge(t),e),[n,o]=oe(r);if(!(e=>e in ue||e in fe)(n)){const e=await re(n,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error(`Failed to retrieve schema with id: ${n}`);if(e.headers.has("content-type")){const t=Z.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${n} is not a schema. Found a document with media type: ${t}`)}de(await e.json(),n)}const a=he(n),i="/"!==o[0]?ve(a,o):o,s=Object.freeze({...a,pointer:i,value:$.get(i,a.schema)});return be(s)},be=e=>x.isReference(e.value)?me(x.href(e.value),e):e,ve=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},ge=e=>`${e.id}#${encodeURI(e.pointer)}`,we=e=>x.isReference(e.value)?x.value(e.value):e.value,Oe=(e,t)=>{const r=he(t.id),n=Object.freeze({...t,pointer:$.append(e,t.pointer),value:we(t)[e],validated:r.validated});return be(n)},Ee=t(((e,t)=>te.pipeline([we,te.map((async(r,n)=>e(await Oe(n,t),n))),te.all],t))),je={parentId:"",parentDialect:"",includeEmbedded:!0},$e=(e,t)=>{if(t.startsWith("file://")){const r=e.slice(7,e.lastIndexOf("/"));return""===e?"":ie(r,t.slice(7))}return t};var Se={setConfig:(e,t,r)=>{se[e]||(se[e]={}),se[e][t]=r},getConfig:le,add:de,get:me,markValidated:e=>{ue[e].validated=!0},uri:ge,value:we,getAnchorPointer:ve,typeOf:(e,t)=>ne(we(e),t),has:(e,t)=>e in we(t),step:Oe,keys:e=>Object.keys(we(e)),entries:e=>te.pipeline([we,Object.keys,te.map((async t=>[t,await Oe(t,e)])),te.all],e),map:Ee,length:e=>we(e).length,toSchema:(e,t={})=>{const r={...je,...t},n=JSON.parse(JSON.stringify(e.schema,((t,n)=>{if(!x.isReference(n))return n;const o=x.value(n),a=o.$schema||e.schemaVersion,i=le(a,"embeddedToken");return!r.includeEmbedded&&i in o?void 0:x.value(n)}))),o=le(e.schemaVersion,"dynamicAnchorToken");Object.entries(e.dynamicAnchors).forEach((([e,t])=>{const r=oe(t)[1];$.assign(r,n,{[o]:e,...$.get(r,n)})}));const a=le(e.schemaVersion,"anchorToken");Object.entries(e.anchors).filter((([e])=>""!==e)).forEach((([e,t])=>{$.assign(t,n,{[a]:e,...$.get(t,n)})}));const i=le(e.schemaVersion,"baseToken"),s=$e(r.parentId,e.id),c=r.parentDialect===e.schemaVersion?"":e.schemaVersion;return{...s&&{[i]:s},...c&&{$schema:c},...n}}};Se.setConfig,Se.getConfig,Se.add,Se.get,Se.markValidated,Se.uri,Se.value,Se.getAnchorPointer,Se.typeOf,Se.has,Se.step,Se.keys,Se.entries,Se.map,Se.length,Se.toSchema;class Ae extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var xe=Ae;const{splitUrl:Pe}=d,Ie="FLAG",Te="BASIC",ke="DETAILED",Ve="VERBOSE";let Re=ke,Ce=!0;const Ue=async e=>{const t={metaData:{}};return{ast:t,schemaUri:await Be(e,t)}},ze=t((({ast:e,schemaUri:t},r,n=Ie)=>{if(![Ie,Te,ke,Ve].includes(n))throw Error(`The '${n}' error format is not supported`);const a=[],i=o.subscribe("result",Ke(n,a));return Je(t,r,e,{}),o.unsubscribe(i),a[0]})),Ke=(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===Ve||e!==Ie&&!t.valid)&&n.errors.unshift(...o)}r[r.length-1]=n,t[0]=n}}},Le={},qe=e=>Le[e],_e=e=>e in Le,De={},Ne={},Be=async(e,t)=>{if(e=await Fe(e),!_e(`${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)=>{Le[e]={collectEvaluatedItems:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&new Set,collectEvaluatedProperties:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&[],...t}})(`${t.id}#${e}`,r)}));else if(r)throw Error(`Missing required vocabulary: ${e}`)}))}if(Ce&&!e.validated){if(Se.markValidated(e.id),!(e.schemaVersion in Ne)){const t=await Se.get(e.schemaVersion),r=await Ue(t);Ne[t.id]=ze(r)}const t=L.cons(e.schema,e.id),r=Ne[e.schemaVersion](t,Re);if(!r.valid)throw new xe(r)}return e.id in t.metaData||(t.metaData[e.id]={id:e.id,dynamicAnchors:e.dynamicAnchors,anchors:e.anchors}),qe(`${e.schemaVersion}#validate`).compile(e,t)},Fe=async e=>Se.typeOf(e,"string")?Fe(await Se.get(Se.value(e),e)):e,Je=(e,t,r,n)=>{const o=We(e,r),a=Pe(e)[0];return qe(o).interpret(e,t,r,{...r.metaData[a].dynamicAnchors,...n})},We=(e,t)=>{if(!(e in t))throw Error(`No schema found at ${e}`);return t[e][0]};var Ze={validate:async(e,t,r)=>{const n=await Ue(e),o=(e,t)=>ze(n,L.cons(e),t);return void 0===t?o:o(t,r)},compile:Ue,interpret:ze,setMetaOutputFormat:e=>{Re=e},setShouldMetaValidate:e=>{Ce=e},FLAG:Ie,BASIC:Te,DETAILED:ke,VERBOSE:Ve,add:(e,t="",r="")=>{const n=Se.add(e,t,r);delete Ne[n]},getKeyword:qe,hasKeyword:_e,defineVocabulary:(e,t)=>{De[e]=t},compileSchema:Be,interpretSchema:Je,collectEvaluatedProperties:(e,t,r,n,o)=>{const a=We(e,r);return qe(a).collectEvaluatedProperties(e,t,r,n,o)},collectEvaluatedItems:(e,t,r,n,o)=>{const a=We(e,r);return qe(a).collectEvaluatedItems(e,t,r,n,o)}};var Me={compile:e=>Se.value(e),interpret:()=>!0};var Ge={compile:async(e,t)=>{const r=Se.uri(e);if(!(r in t)){t[r]=!1;const n=Se.value(e);if(!["object","boolean"].includes(typeof n))throw Error(`No schema found at '${Se.uri(e)}'`);t[r]=[`${e.schemaVersion}#validate`,Se.uri(e),"boolean"==typeof n?n:await te.pipeline([Se.entries,te.map((([t,r])=>[`${e.schemaVersion}#${t}`,r])),te.filter((([t])=>Ze.hasKeyword(t)&&t!==`${e.schemaVersion}#validate`)),te.map((async([r,n])=>{const o=await Ze.getKeyword(r).compile(n,t,e);return[r,Se.uri(n),o]})),te.all],e)]}return r},interpret:(e,t,r,n)=>{const[a,i,s]=r[e];o.publishSync("result.start");const c="boolean"==typeof s?s:s.every((([e,a,i])=>{o.publishSync("result.start");const s=Ze.getKeyword(e).interpret(i,t,r,n);return o.publishSync("result",{keyword:e,absoluteKeywordLocation:a,instanceLocation:L.uri(t),valid:s,ast:i}),o.publishSync("result.end"),s}));return o.publishSync("result",{keyword:a,absoluteKeywordLocation:i,instanceLocation:L.uri(t),valid:c,ast:e}),o.publishSync("result.end"),c},collectEvaluatedProperties:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&[]:a.filter((([e])=>!o||!e.endsWith("#unevaluatedProperties"))).reduce(((e,[o,,a])=>{const i=e&&Ze.getKeyword(o).collectEvaluatedProperties(a,t,r,n);return!1!==i&&[...e,...i]}),[])},collectEvaluatedItems:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&new Set:a.filter((([e])=>!o||!e.endsWith("#unevaluatedItems"))).reduce(((e,[o,,a])=>{const i=!1!==e&&Ze.getKeyword(o).collectEvaluatedItems(a,t,r,n);return!1!==i&&new Set([...e,...i])}),new Set)}},He={metaData:Me,validate:Ge},Qe={Core:Ze,Schema:Se,Instance:L,Reference:x,Keywords:He,InvalidSchemaError:xe},Xe=Qe.Core,Ye=Qe.Schema,et=Qe.Instance,tt=Qe.Reference,rt=Qe.Keywords,nt=Qe.InvalidSchemaError;e.Core=Xe,e.Instance=et,e.InvalidSchemaError=nt,e.Keywords=rt,e.Reference=tt,e.Schema=Ye,e.default=Qe,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
define(["exports","url-resolve-browser"],(function(e,t){"use strict";function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=r(t),o=function(e,t){return function r(){null==t&&(t=e.length);var n=[].slice.call(arguments);return n.length>=t?e.apply(this,n):function(){return r.apply(this,n.concat([].slice.call(arguments)))}}};var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var i,s=(function(e,t){var r,n;r="object"==typeof window&&window||a,n={},r.PubSub=n,function(e){var t={},r=-1,n="*";function o(e){var t;for(t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function a(e){return function(){throw e}}function i(e,t,r){try{e(t,r)}catch(e){setTimeout(a(e),0)}}function s(e,t,r){e(t,r)}function c(e,r,n,o){var a,c=t[r],l=o?s:i;if(Object.prototype.hasOwnProperty.call(t,r))for(a in c)Object.prototype.hasOwnProperty.call(c,a)&&l(c[a],e,n)}function l(e,t,r){return function(){var o=String(e),a=o.lastIndexOf(".");for(c(e,e,t,r);-1!==a;)a=(o=o.substr(0,a)).lastIndexOf("."),c(e,o,t,r);c(e,n,t,r)}}function u(e){var r=String(e);return Boolean(Object.prototype.hasOwnProperty.call(t,r)&&o(t[r]))}function d(e){for(var t=String(e),r=u(t)||u(n),o=t.lastIndexOf(".");!r&&-1!==o;)o=(t=t.substr(0,o)).lastIndexOf("."),r=u(t);return r}function f(e,t,r,n){var o=l(e="symbol"==typeof e?e.toString():e,t,n);return!!d(e)&&(!0===r?o():setTimeout(o,0),!0)}e.publish=function(t,r){return f(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return f(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,Object.prototype.hasOwnProperty.call(t,e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeAll=function(t){return e.subscribe(n,t)},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n,o=0;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)){for(n in t[r])o++;break}return o},e.getSubscriptions=function(e){var r,n=[];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,a,i=function(e){var r;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e))return!0;return!1},s="string"==typeof r&&(Object.prototype.hasOwnProperty.call(t,r)||i(r)),c=!s&&"string"==typeof r,l="function"==typeof r,u=!1;if(!s){for(n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(o=t[n],c&&o[r]){delete o[r],u=r;break}if(l)for(a in o)Object.prototype.hasOwnProperty.call(o,a)&&o[a]===r&&(delete o[a],u=!0)}return u}e.clearSubscriptions(r)}}(n),void 0!==e&&e.exports&&(t=e.exports=n),t.PubSub=n,e.exports=t=n}(i={exports:{}},i.exports),i.exports);s.PubSub;const c={null:e=>null===e,boolean:e=>"boolean"==typeof e,object:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,array:e=>Array.isArray(e),number:e=>"number"==typeof e,integer:e=>Number.isInteger(e),string:e=>"string"==typeof e},l=e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),o=e.slice(r+1);return[decodeURI(n),decodeURI(o)]},u=e=>{const t=RegExp(/^(.+):\/\//).exec(e);return t?t[1]:""};var d={jsonTypeOf:(e,t)=>c[t](e),splitUrl:l,safeResolveUrl:(e,t)=>{const r=n.default(e,t),o=l(e)[0];if(o&&"file"===u(r)&&"file"!==u(o))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},pathRelative:(e,t)=>{if(e===t)return"";let r=1;const n=e.length-1,o=t.length-r,a=n<o?n:o;let i=-1,s=0;for(;s<a;s++){const n=e.charCodeAt(s+1);if(n!==t.charCodeAt(r+s))break;47===n&&(i=s)}if(o>a){if(47===t.charCodeAt(r+s))return t.slice(r+s+1);if(0===s)return t.slice(r+s)}n>a&&(47===e.charCodeAt(s+1)?i=s:0===a&&(i=0));let c="";for(s=i+2;s<=e.length;++s)s!==e.length&&47!==e.charCodeAt(s)||(c+=0===c.length?"..":"/..");return r+=i,c.length>0?`${c}${t.slice(r,t.length)}`:(47===t.charCodeAt(r)&&++r,t.slice(r,t.length))}};const f=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(w)},p=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:p(e,O(t,o,n),r,v(o,n))}}if(Array.isArray(t)){const n=[...t];return n[g(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:O(t,e[0],n)},h=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||E(t)){const o=e.shift();h(e,O(t,o,n),r,v(o,n))}else{t[g(t,e[0])]=r}},y=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=O(t,n,r);return{...t,[n]:y(e,o,v(n,r))}}if(Array.isArray(t))return t.filter(((t,r)=>r!=e[0]));if("object"==typeof t&&null!==t){const{[e[0]]:r,...n}=t;return n}return O(t,e[0],r)}},m=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=O(t,n,r);m(e,o,v(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:O(t,e[0],r)},v=o(((e,t)=>t+"/"+b(e))),b=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),w=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),g=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,O=(e,t,r="")=>{if(void 0===e)throw TypeError(`Value at '${r}' is undefined and does not have property '${t}'`);if(null===e)throw TypeError(`Value at '${r}' is null and does not have property '${t}'`);if(E(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[g(e,t)]},E=e=>null===e||"object"!=typeof e;var j={nil:"",append:v,get:(e,t)=>{const r=f(e),n=e=>r.reduce((([e,t],r)=>[O(e,r,t),v(r,t)]),[e,""])[0];return void 0===t?n:n(t)},set:(e,t,r)=>{const n=f(e),a=o(((e,t)=>p(n,e,t,"")));return void 0===t?a:a(t,r)},assign:(e,t,r)=>{const n=f(e),a=o(((e,t)=>h(n,e,t,"")));return void 0===t?a:a(t,r)},unset:(e,t)=>{const r=f(e),n=e=>y(r,e,"");return void 0===t?n:n(t)},remove:(e,t)=>{const r=f(e),n=e=>m(r,e,"");return void 0===t?n:n(t)}};j.nil,j.append,j.get,j.set,j.assign,j.unset,j.remove;const $=Symbol("$__value"),S=Symbol("$__href");var A={cons:(e,t)=>Object.freeze({[S]:e,[$]:t}),isReference:e=>e&&void 0!==e[S],href:e=>e[S],value:e=>e[$]};const{jsonTypeOf:T}=d,I=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),k=e=>A.isReference(e.value)?A.value(e.value):e.value,V=o(((e,t)=>T(k(e),t))),x=(e,t)=>Object.freeze({...t,pointer:j.append(e,t.pointer),value:k(t)[e]}),P=o(((e,t)=>k(t).map(((r,n,o,a)=>e(x(n,t),n,o,a))))),R=o(((e,t)=>k(t).map(((e,r,n,o)=>x(r,t))).filter(((t,r,n,o)=>e(t,r,n,o))))),C=o(((e,t,r)=>k(r).reduce(((t,n,o)=>e(t,x(o,r),o)),t))),U=o(((e,t)=>k(t).every(((r,n,o,a)=>e(x(n,t),n,o,a))))),K=o(((e,t)=>k(t).some(((r,n,o,a)=>e(x(n,t),n,o,a)))));var L={nil:I,cons:(e,t="")=>Object.freeze({...I,id:t,instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:k,has:(e,t)=>e in k(t),typeOf:V,step:x,entries:e=>Object.keys(k(e)).map((t=>[t,x(t,e)])),keys:e=>Object.keys(k(e)),map:P,filter:R,reduce:C,every:U,some:K,length:e=>k(e).length},z=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,_=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,D=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,N=/\\([\u000b\u0020-\u00ff])/g,q=/([\\"])/g,B=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function F(e){var t=String(e);if(D.test(t))return t;if(t.length>0&&!_.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(q,"\\$1")+'"'}function J(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],!D.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 a,i,s;for(z.lastIndex=r;i=z.exec(t);){if(i.index!==r)throw new TypeError("invalid parameter format");r+=i[0].length,a=i[1].toLowerCase(),'"'===(s=i[2])[0]&&(s=s.substr(1,s.length-2).replace(N,"$1")),o.parameters[a]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},M=async e=>Object.entries(await e),W=o((async(e,t)=>(await t).map(e))),G=o((async(e,t,r)=>(await r).reduce((async(t,r)=>e(await t,r)),t))),H=o((async(e,t,r={})=>G((async(t,r)=>await e(r)?t.concat([r]):t),[],t,r))),Q=o((async(e,t)=>{const r=await W(e,t);return(await Promise.all(r)).some((e=>e))})),X=o((async(e,t)=>{const r=await W(e,t);return(await Promise.all(r)).every((e=>e))})),Y=o(((e,t)=>e.reduce((async(e,t)=>t(await e)),t))),ee={entries:M,map:W,filter:H,reduce:G,some:Q,every:X,pipeline:Y,all:e=>Promise.all(e),allValues:e=>Y([M,G((async(e,[t,r])=>(e[t]=await r,e)),{})],e)};ee.entries,ee.map,ee.filter,ee.reduce,ee.some,ee.every,ee.pipeline,ee.all,ee.allValues;var te=fetch;const{jsonTypeOf:re,splitUrl:ne,safeResolveUrl:oe,pathRelative:ae}=d,ie={},se={},ce=(e,t)=>{const r=e in se?se[e]:e;if(r in ie)return ie[r][t]},le={},ue={},de=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=ne(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=ce(n,"baseToken"),a=ce(n,"anchorToken"),i=ne(t)[0];if(!i&&!ne(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const s=oe(i,e[o]||""),[c,l]=ne(s);delete e[o],l&&o===a&&(e[a]=a!==o?encodeURI(l):`#${encodeURI(l)}`),i&&(ue[i]=c);const u={},d=ce(n,"recursiveAnchorToken");let f;!0===e[d]&&(u[""]=`${c}#`,e[a]="",delete e[d]);const p=ce(n,"vocabularyToken");re(e[p],"object")?(se[c]=n,f=e[p],delete e[p]):(se[c]=n,f={[n]:!0});const h={"":""};return le[c]={id:c,schemaVersion:n,schema:fe(e,c,n,j.nil,h,u),anchors:h,dynamicAnchors:u,vocabulary:f,validated:!1},c},fe=(e,t,r,n,o,a)=>{if(re(e,"object")){const i="string"==typeof e.$schema?ne(e.$schema)[0]:r,s=ce(i,"embeddedToken"),c=ce(i,"anchorToken");if("string"==typeof e[s]&&(s!==c||"#"!==e[s][0])){const n=oe(t,e[s]);return e[s]=n,de(e,n,r),A.cons(e[s],e)}const l=ce(r,"anchorToken"),u=ce(r,"dynamicAnchorToken");"string"==typeof e[u]&&(a[e[u]]=`${t}#${encodeURI(n)}`,o[e[u]]=n,delete e[u]);const d=ce(r,"embeddedToken");if("string"==typeof e[l]){const t=l!==d?e[l]:e[l].slice(1);o[t]=n,delete e[l]}const f=ce(r,"jrefToken");if("string"==typeof e[f])return A.cons(e[f],e);for(const i in e)e[i]=fe(e[i],t,r,j.append(i,n),o,a);return e}return Array.isArray(e)?e.map(((e,i)=>fe(e,t,r,j.append(i,n),o,a))):e},pe=e=>le[ue[e]]||le[e],he=Object.freeze({id:"",schemaVersion:void 0,vocabulary:{},pointer:j.nil,schema:void 0,value:void 0,anchors:{},dynamicAnchors:{},validated:!0}),ye=async(e,t=he)=>{const r=oe(be(t),e),[n,o]=ne(r);if(!(e=>e in le||e in ue)(n)){const e=await te(n,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error(`Failed to retrieve schema with id: ${n}`);if(e.headers.has("content-type")){const t=Z.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${n} is not a schema. Found a document with media type: ${t}`)}de(await e.json(),n)}const a=pe(n),i="/"!==o[0]?ve(a,o):o,s=Object.freeze({...a,pointer:i,value:j.get(i,a.schema)});return me(s)},me=e=>A.isReference(e.value)?ye(A.href(e.value),e):e,ve=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},be=e=>`${e.id}#${encodeURI(e.pointer)}`,we=e=>A.isReference(e.value)?A.value(e.value):e.value,ge=(e,t)=>{const r=pe(t.id),n=Object.freeze({...t,pointer:j.append(e,t.pointer),value:we(t)[e],validated:r.validated});return me(n)},Oe=o(((e,t)=>ee.pipeline([we,ee.map((async(r,n)=>e(await ge(n,t),n))),ee.all],t))),Ee={parentId:"",parentDialect:"",includeEmbedded:!0},je=(e,t)=>{if(t.startsWith("file://")){const r=e.slice(7,e.lastIndexOf("/"));return""===e?"":ae(r,t.slice(7))}return t};var $e={setConfig:(e,t,r)=>{ie[e]||(ie[e]={}),ie[e][t]=r},getConfig:ce,add:de,get:ye,markValidated:e=>{le[e].validated=!0},uri:be,value:we,getAnchorPointer:ve,typeOf:(e,t)=>re(we(e),t),has:(e,t)=>e in we(t),step:ge,keys:e=>Object.keys(we(e)),entries:e=>ee.pipeline([we,Object.keys,ee.map((async t=>[t,await ge(t,e)])),ee.all],e),map:Oe,length:e=>we(e).length,toSchema:(e,t={})=>{const r={...Ee,...t},n=JSON.parse(JSON.stringify(e.schema,((t,n)=>{if(!A.isReference(n))return n;const o=A.value(n),a=o.$schema||e.schemaVersion,i=ce(a,"embeddedToken");return!r.includeEmbedded&&i in o?void 0:A.value(n)}))),o=ce(e.schemaVersion,"dynamicAnchorToken");Object.entries(e.dynamicAnchors).forEach((([e,t])=>{const r=ne(t)[1];j.assign(r,n,{[o]:e,...j.get(r,n)})}));const a=ce(e.schemaVersion,"anchorToken");Object.entries(e.anchors).filter((([e])=>""!==e)).forEach((([e,t])=>{j.assign(t,n,{[a]:e,...j.get(t,n)})}));const i=ce(e.schemaVersion,"baseToken"),s=je(r.parentId,e.id),c=r.parentDialect===e.schemaVersion?"":e.schemaVersion;return{...s&&{[i]:s},...c&&{$schema:c},...n}}};$e.setConfig,$e.getConfig,$e.add,$e.get,$e.markValidated,$e.uri,$e.value,$e.getAnchorPointer,$e.typeOf,$e.has,$e.step,$e.keys,$e.entries,$e.map,$e.length,$e.toSchema;class Se extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var Ae=Se;const{splitUrl:Te}=d,Ie="FLAG",ke="BASIC",Ve="DETAILED",xe="VERBOSE";let Pe=Ve,Re=!0;const Ce=async e=>{const t={metaData:{}};return{ast:t,schemaUri:await qe(e,t)}},Ue=o((({ast:e,schemaUri:t},r,n=Ie)=>{if(![Ie,ke,Ve,xe].includes(n))throw Error(`The '${n}' error format is not supported`);const o=[],a=s.subscribe("result",Ke(n,o));return Fe(t,r,e,{}),s.unsubscribe(a),o[0]})),Ke=(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===ke&&(o.push(...t.errors),delete t.errors),(e===xe||e!==Ie&&!t.valid)&&n.errors.unshift(...o)}r[r.length-1]=n,t[0]=n}}},Le={},ze=e=>Le[e],_e=e=>e in Le,De={},Ne={},qe=async(e,t)=>{if(e=await Be(e),!_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 De)Object.entries(De[e]).forEach((([e,r])=>{((e,t)=>{Le[e]={collectEvaluatedItems:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&new Set,collectEvaluatedProperties:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&[],...t}})(`${t.id}#${e}`,r)}));else if(r)throw Error(`Missing required vocabulary: ${e}`)}))}if(Re&&!e.validated){if($e.markValidated(e.id),!(e.schemaVersion in Ne)){const t=await $e.get(e.schemaVersion),r=await Ce(t);Ne[t.id]=Ue(r)}const t=L.cons(e.schema,e.id),r=Ne[e.schemaVersion](t,Pe);if(!r.valid)throw new Ae(r)}return e.id in t.metaData||(t.metaData[e.id]={id:e.id,dynamicAnchors:e.dynamicAnchors,anchors:e.anchors}),ze(`${e.schemaVersion}#validate`).compile(e,t)},Be=async e=>$e.typeOf(e,"string")?Be(await $e.get($e.value(e),e)):e,Fe=(e,t,r,n)=>{const o=Je(e,r),a=Te(e)[0];return ze(o).interpret(e,t,r,{...r.metaData[a].dynamicAnchors,...n})},Je=(e,t)=>{if(!(e in t))throw Error(`No schema found at ${e}`);return t[e][0]};var Ze={validate:async(e,t,r)=>{const n=await Ce(e),o=(e,t)=>Ue(n,L.cons(e),t);return void 0===t?o:o(t,r)},compile:Ce,interpret:Ue,setMetaOutputFormat:e=>{Pe=e},setShouldMetaValidate:e=>{Re=e},FLAG:Ie,BASIC:ke,DETAILED:Ve,VERBOSE:xe,add:(e,t="",r="")=>{const n=$e.add(e,t,r);delete Ne[n]},getKeyword:ze,hasKeyword:_e,defineVocabulary:(e,t)=>{De[e]=t},compileSchema:qe,interpretSchema:Fe,collectEvaluatedProperties:(e,t,r,n,o)=>{const a=Je(e,r);return ze(a).collectEvaluatedProperties(e,t,r,n,o)},collectEvaluatedItems:(e,t,r,n,o)=>{const a=Je(e,r);return ze(a).collectEvaluatedItems(e,t,r,n,o)}};var Me={compile:e=>$e.value(e),interpret:()=>!0};var We={compile:async(e,t)=>{const r=$e.uri(e);if(!(r in t)){t[r]=!1;const n=$e.value(e);if(!["object","boolean"].includes(typeof n))throw Error(`No schema found at '${$e.uri(e)}'`);t[r]=[`${e.schemaVersion}#validate`,$e.uri(e),"boolean"==typeof n?n:await ee.pipeline([$e.entries,ee.map((([t,r])=>[`${e.schemaVersion}#${t}`,r])),ee.filter((([t])=>Ze.hasKeyword(t)&&t!==`${e.schemaVersion}#validate`)),ee.map((async([r,n])=>{const o=await Ze.getKeyword(r).compile(n,t,e);return[r,$e.uri(n),o]})),ee.all],e)]}return r},interpret:(e,t,r,n)=>{const[o,a,i]=r[e];s.publishSync("result.start");const c="boolean"==typeof i?i:i.every((([e,o,a])=>{s.publishSync("result.start");const i=Ze.getKeyword(e).interpret(a,t,r,n);return s.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:L.uri(t),valid:i,ast:a}),s.publishSync("result.end"),i}));return s.publishSync("result",{keyword:o,absoluteKeywordLocation:a,instanceLocation:L.uri(t),valid:c,ast:e}),s.publishSync("result.end"),c},collectEvaluatedProperties:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&[]:a.filter((([e])=>!o||!e.endsWith("#unevaluatedProperties"))).reduce(((e,[o,,a])=>{const i=e&&Ze.getKeyword(o).collectEvaluatedProperties(a,t,r,n);return!1!==i&&[...e,...i]}),[])},collectEvaluatedItems:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&new Set:a.filter((([e])=>!o||!e.endsWith("#unevaluatedItems"))).reduce(((e,[o,,a])=>{const i=!1!==e&&Ze.getKeyword(o).collectEvaluatedItems(a,t,r,n);return!1!==i&&new Set([...e,...i])}),new Set)}},Ge={metaData:Me,validate:We},He={Core:Ze,Schema:$e,Instance:L,Reference:A,Keywords:Ge,InvalidSchemaError:Ae},Qe=He.Core,Xe=He.Schema,Ye=He.Instance,et=He.Reference,tt=He.Keywords,rt=He.InvalidSchemaError;e.Core=Qe,e.Instance=Ye,e.InvalidSchemaError=rt,e.Keywords=tt,e.Reference=et,e.Schema=Xe,e.default=He,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=json-schema-core-amd.min.js.map |
@@ -5,2 +5,8 @@ 'use strict'; | ||
var urlResolveBrowser = require('url-resolve-browser'); | ||
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } | ||
var urlResolveBrowser__default = /*#__PURE__*/_interopDefaultLegacy(urlResolveBrowser); | ||
var justCurryIt = curry; | ||
@@ -402,213 +408,2 @@ | ||
var urlResolveBrowser = urlResolve; | ||
/* | ||
The majority of the module is built by following RFC1808 | ||
url: https://tools.ietf.org/html/rfc1808 | ||
*/ | ||
// adds a slash at end if not present | ||
function _addSlash (url) { | ||
return url + (url[url.length-1] === '/' ? '' : '/'); | ||
} | ||
// resolve the ..'s (directory up) and such | ||
function _pathResolve (path) { | ||
let pathSplit = path.split('/'); | ||
// happens when path starts with / | ||
if (pathSplit[0] === '') { | ||
pathSplit = pathSplit.slice(1); | ||
} | ||
// let segmentCount = 0; // number of segments that have been passed | ||
let resultArray = []; | ||
pathSplit.forEach((current, index) => { | ||
// skip occurances of '.' | ||
if (current !== '.') { | ||
if (current === '..') { | ||
resultArray.pop(); // remove previous | ||
} else if (current !== '' || index === pathSplit.length - 1) { | ||
resultArray.push(current); | ||
} | ||
} | ||
}); | ||
return '/' + resultArray.join('/'); | ||
} | ||
// parses a base url string into an object containing host, path and query | ||
function _baseParse (base) { | ||
const resultObject = { | ||
host: '', | ||
path: '', | ||
query: '', | ||
protocol: '' | ||
}; | ||
let path = base; | ||
let protocolEndIndex = base.indexOf('//'); | ||
resultObject.protocol = path.substring(0, protocolEndIndex); | ||
protocolEndIndex += 2; // add two to pass double slash | ||
const pathIndex = base.indexOf('/', protocolEndIndex); | ||
const queryIndex = base.indexOf('?'); | ||
const hashIndex = base.indexOf('#'); | ||
if (hashIndex !== -1) { | ||
path = path.substring(0, hashIndex); // remove hash, not needed for base | ||
} | ||
if (queryIndex !== -1) { | ||
const query = path.substring(queryIndex); // remove query, save in return obj | ||
resultObject.query = query; | ||
path = path.substring(0, queryIndex); | ||
} | ||
if (pathIndex !== -1) { | ||
const host = path.substring(0, pathIndex); // separate host & path | ||
resultObject.host = host; | ||
path = path.substring(pathIndex); | ||
resultObject.path = path; | ||
} else { | ||
resultObject.host = path; // there was no path, therefore path is host | ||
} | ||
return resultObject; | ||
} | ||
// https://tools.ietf.org/html/rfc3986#section-3.1 | ||
const _scheme = '[a-z][a-z0-9+.-]*'; // ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )] | ||
const _isAbsolute = new RegExp(`^(${_scheme}:)?//`, 'i'); | ||
// parses a relative url string into an object containing the href, | ||
// hash, query and whether it is a net path, absolute path or relative path | ||
function _relativeParse (relative) { | ||
const resultObject = { | ||
href: relative, // href is always what was passed through | ||
hash: '', | ||
query: '', | ||
netPath: false, | ||
absolutePath: false, | ||
relativePath: false | ||
}; | ||
// check for protocol | ||
// if protocol exists, is net path (absolute URL) | ||
if (_isAbsolute.test(relative)) { | ||
resultObject.netPath = true; | ||
// return, in this case the relative is the resolved url, no need to parse. | ||
return resultObject; | ||
} | ||
// if / is first, this is an absolute path, | ||
// I.E. it overwrites the base URL's path | ||
if (relative[0] === '/') { | ||
resultObject.absolutePath = true; | ||
// return resultObject | ||
} else if (relative !== '') { | ||
resultObject.relativePath = true; | ||
} | ||
let path = relative; | ||
const queryIndex = relative.indexOf('?'); | ||
const hashIndex = relative.indexOf('#'); | ||
if (hashIndex !== -1) { | ||
const hash = path.substring(hashIndex); | ||
resultObject.hash = hash; | ||
path = path.substring(0, hashIndex); | ||
} | ||
if (queryIndex !== -1) { | ||
const query = path.substring(queryIndex); | ||
resultObject.query = query; | ||
path = path.substring(0, queryIndex); | ||
} | ||
resultObject.path = path; // whatever is left is path | ||
return resultObject; | ||
} | ||
function _shouldAddSlash (url) { | ||
const protocolIndex = url.indexOf('//') + 2; | ||
const noPath = !(url.includes('/', protocolIndex)); | ||
const noQuery = !(url.includes('?', protocolIndex)); | ||
const noHash = !(url.includes('#', protocolIndex)); | ||
return (noPath && noQuery && noHash); | ||
} | ||
function _shouldAddProtocol (url) { | ||
return url.startsWith('//'); | ||
} | ||
/* | ||
* PRECONDITION: Base is a fully qualified URL. e.g. http://example.com/ | ||
* optional: path, query or hash | ||
* returns the resolved url | ||
*/ | ||
function urlResolve (base, relative) { | ||
base = base.trim(); | ||
relative = relative.trim(); | ||
// about is always absolute | ||
if (relative.startsWith('about:')) { | ||
return relative; | ||
} | ||
const baseObj = _baseParse(base); | ||
const relativeObj = _relativeParse(relative); | ||
if (!baseObj.protocol && !relativeObj.netPath) { | ||
throw new Error('Error, protocol is not specified'); | ||
} | ||
if (relativeObj.netPath) { // relative is full qualified URL | ||
if (_shouldAddProtocol(relativeObj.href)) { | ||
relativeObj.href = baseObj.protocol + relativeObj.href; | ||
} | ||
if (_shouldAddSlash(relativeObj.href)) { | ||
return _addSlash(relativeObj.href); | ||
} | ||
return relativeObj.href; | ||
} else if (relativeObj.absolutePath) { // relative is an absolute path | ||
const {path, query, hash} = relativeObj; | ||
return baseObj.host + _pathResolve(path) + query + hash; | ||
} else if (relativeObj.relativePath) { // relative is a relative path | ||
const {path, query, hash} = relativeObj; | ||
let basePath = baseObj.path; | ||
let resultString = baseObj.host; | ||
let resolvePath; | ||
if (path.length === 0) { | ||
resolvePath = basePath; | ||
} else { | ||
// remove last segment if no slash at end | ||
basePath = basePath.substring(0, basePath.lastIndexOf('/')); | ||
resolvePath = _pathResolve(basePath + '/' + path); | ||
} | ||
// if result is just the base host, add / | ||
if ((resolvePath === '') && (!query) && (!hash)) { | ||
resultString += '/'; | ||
} else { | ||
resultString += resolvePath + query + hash; | ||
} | ||
return resultString; | ||
} else { | ||
const {host, path, query} = baseObj; | ||
// when path and query aren't supplied add slash | ||
if ((!path) && (!query)) { | ||
return _addSlash(host); | ||
} | ||
return host + path + query + relativeObj.hash; | ||
} | ||
} | ||
const isObject = (value) => typeof value === "object" && !Array.isArray(value) && value !== null; | ||
@@ -641,3 +436,3 @@ const isType = { | ||
const safeResolveUrl$1 = (contextUrl, url) => { | ||
const resolvedUrl = urlResolveBrowser(contextUrl, url); | ||
const resolvedUrl = urlResolveBrowser__default["default"](contextUrl, url); | ||
const contextId = splitUrl$2(contextUrl)[0]; | ||
@@ -644,0 +439,0 @@ if (contextId && getScheme(resolvedUrl) === "file" && getScheme(contextId) !== "file") { |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=function(e,t){return function r(){null==t&&(t=e.length);var n=[].slice.call(arguments);return n.length>=t?e.apply(this,n):function(){return r.apply(this,n.concat([].slice.call(arguments)))}}};var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var r,n=(function(e,r){var n;n={},("object"==typeof window&&window||t).PubSub=n,function(e){var t={},r=-1,n="*";function o(e){var t;for(t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function a(e){return function(){throw e}}function i(e,t,r){try{e(t,r)}catch(e){setTimeout(a(e),0)}}function s(e,t,r){e(t,r)}function c(e,r,n,o){var a,c=t[r],l=o?s:i;if(Object.prototype.hasOwnProperty.call(t,r))for(a in c)Object.prototype.hasOwnProperty.call(c,a)&&l(c[a],e,n)}function l(e,t,r){return function(){var o=String(e),a=o.lastIndexOf(".");for(c(e,e,t,r);-1!==a;)a=(o=o.substr(0,a)).lastIndexOf("."),c(e,o,t,r);c(e,n,t,r)}}function u(e){var r=String(e);return Boolean(Object.prototype.hasOwnProperty.call(t,r)&&o(t[r]))}function f(e){for(var t=String(e),r=u(t)||u(n),o=t.lastIndexOf(".");!r&&-1!==o;)o=(t=t.substr(0,o)).lastIndexOf("."),r=u(t);return r}function p(e,t,r,n){var o=l(e="symbol"==typeof e?e.toString():e,t,n);return!!f(e)&&(!0===r?o():setTimeout(o,0),!0)}e.publish=function(t,r){return p(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return p(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,Object.prototype.hasOwnProperty.call(t,e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeAll=function(t){return e.subscribe(n,t)},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n,o=0;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)){for(n in t[r])o++;break}return o},e.getSubscriptions=function(e){var r,n=[];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,a,i=function(e){var r;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e))return!0;return!1},s="string"==typeof r&&(Object.prototype.hasOwnProperty.call(t,r)||i(r)),c=!s&&"string"==typeof r,l="function"==typeof r,u=!1;if(!s){for(n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(o=t[n],c&&o[r]){delete o[r],u=r;break}if(l)for(a in o)Object.prototype.hasOwnProperty.call(o,a)&&o[a]===r&&(delete o[a],u=!0)}return u}e.clearSubscriptions(r)}}(n),void 0!==e&&e.exports&&(r=e.exports=n),r.PubSub=n,e.exports=r=n}(r={exports:{}},r.exports),r.exports);n.PubSub;var o=function(e,t){if(e=e.trim(),(t=t.trim()).startsWith("about:"))return t;const r=function(e){const t={host:"",path:"",query:"",protocol:""};let r=e,n=e.indexOf("//");t.protocol=r.substring(0,n),n+=2;const o=e.indexOf("/",n),a=e.indexOf("?"),i=e.indexOf("#");-1!==i&&(r=r.substring(0,i));if(-1!==a){const e=r.substring(a);t.query=e,r=r.substring(0,a)}if(-1!==o){const e=r.substring(0,o);t.host=e,r=r.substring(o),t.path=r}else t.host=r;return t}(e),n=function(e){const t={href:e,hash:"",query:"",netPath:!1,absolutePath:!1,relativePath:!1};if(s.test(e))return t.netPath=!0,t;"/"===e[0]?t.absolutePath=!0:""!==e&&(t.relativePath=!0);let r=e;const n=e.indexOf("?"),o=e.indexOf("#");if(-1!==o){const e=r.substring(o);t.hash=e,r=r.substring(0,o)}if(-1!==n){const e=r.substring(n);t.query=e,r=r.substring(0,n)}return t.path=r,t}(t);if(!r.protocol&&!n.netPath)throw new Error("Error, protocol is not specified");if(n.netPath)return n.href.startsWith("//")&&(n.href=r.protocol+n.href),function(e){const t=e.indexOf("//")+2,r=!e.includes("/",t),n=!e.includes("?",t),o=!e.includes("#",t);return r&&n&&o}(n.href)?a(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+i(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let a,s=r.path,c=r.host;return 0===e.length?a=s:(s=s.substring(0,s.lastIndexOf("/")),a=i(s+"/"+e)),c+=""!==a||t||o?a+t+o:"/",c}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:a(e)}};function a(e){return e+("/"===e[e.length-1]?"":"/")}function i(e){let t=e.split("/");""===t[0]&&(t=t.slice(1));let r=[];return t.forEach(((e,n)=>{"."!==e&&(".."===e?r.pop():""===e&&n!==t.length-1||r.push(e))})),"/"+r.join("/")}const s=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");const c={null:e=>null===e,boolean:e=>"boolean"==typeof e,object:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,array:e=>Array.isArray(e),number:e=>"number"==typeof e,integer:e=>Number.isInteger(e),string:e=>"string"==typeof e},l=e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),o=e.slice(r+1);return[decodeURI(n),decodeURI(o)]},u=e=>{const t=RegExp(/^(.+):\/\//).exec(e);return t?t[1]:""};var f={jsonTypeOf:(e,t)=>c[t](e),splitUrl:l,safeResolveUrl:(e,t)=>{const r=o(e,t),n=l(e)[0];if(n&&"file"===u(r)&&"file"!==u(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},pathRelative:(e,t)=>{if(e===t)return"";let r=1;const n=e.length-1,o=t.length-r,a=n<o?n:o;let i=-1,s=0;for(;s<a;s++){const n=e.charCodeAt(s+1);if(n!==t.charCodeAt(r+s))break;47===n&&(i=s)}if(o>a){if(47===t.charCodeAt(r+s))return t.slice(r+s+1);if(0===s)return t.slice(r+s)}n>a&&(47===e.charCodeAt(s+1)?i=s:0===a&&(i=0));let c="";for(s=i+2;s<=e.length;++s)s!==e.length&&47!==e.charCodeAt(s)||(c+=0===c.length?"..":"/..");return r+=i,c.length>0?`${c}${t.slice(r,t.length)}`:(47===t.charCodeAt(r)&&++r,t.slice(r,t.length))}};const p=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(g)},d=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:d(e,O(t,o,n),r,b(o,n))}}if(Array.isArray(t)){const n=[...t];return n[w(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:O(t,e[0],n)},h=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||E(t)){const o=e.shift();h(e,O(t,o,n),r,b(o,n))}else{t[w(t,e[0])]=r}},y=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=O(t,n,r);return{...t,[n]:y(e,o,b(n,r))}}if(Array.isArray(t))return t.filter(((t,r)=>r!=e[0]));if("object"==typeof t&&null!==t){const{[e[0]]:r,...n}=t;return n}return O(t,e[0],r)}},m=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=O(t,n,r);m(e,o,b(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:O(t,e[0],r)},b=e(((e,t)=>t+"/"+v(e))),v=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),g=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),w=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,O=(e,t,r="")=>{if(void 0===e)throw TypeError(`Value at '${r}' is undefined and does not have property '${t}'`);if(null===e)throw TypeError(`Value at '${r}' is null and does not have property '${t}'`);if(E(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[w(e,t)]},E=e=>null===e||"object"!=typeof e;var j={nil:"",append:b,get:(e,t)=>{const r=p(e),n=e=>r.reduce((([e,t],r)=>[O(e,r,t),b(r,t)]),[e,""])[0];return void 0===t?n:n(t)},set:(t,r,n)=>{const o=p(t),a=e(((e,t)=>d(o,e,t,"")));return void 0===r?a:a(r,n)},assign:(t,r,n)=>{const o=p(t),a=e(((e,t)=>h(o,e,t,"")));return void 0===r?a:a(r,n)},unset:(e,t)=>{const r=p(e),n=e=>y(r,e,"");return void 0===t?n:n(t)},remove:(e,t)=>{const r=p(e),n=e=>m(r,e,"");return void 0===t?n:n(t)}};j.nil,j.append,j.get,j.set,j.assign,j.unset,j.remove;const $=Symbol("$__value"),S=Symbol("$__href");var x={cons:(e,t)=>Object.freeze({[S]:e,[$]:t}),isReference:e=>e&&void 0!==e[S],href:e=>e[S],value:e=>e[$]};const{jsonTypeOf:A}=f,P=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),I=e=>x.isReference(e.value)?x.value(e.value):e.value,T=e(((e,t)=>A(I(e),t))),k=(e,t)=>Object.freeze({...t,pointer:j.append(e,t.pointer),value:I(t)[e]}),V=e(((e,t)=>I(t).map(((r,n,o,a)=>e(k(n,t),n,o,a))))),R=e(((e,t)=>I(t).map(((e,r,n,o)=>k(r,t))).filter(((t,r,n,o)=>e(t,r,n,o))))),C=e(((e,t,r)=>I(r).reduce(((t,n,o)=>e(t,k(o,r),o)),t))),U=e(((e,t)=>I(t).every(((r,n,o,a)=>e(k(n,t),n,o,a))))),z=e(((e,t)=>I(t).some(((r,n,o,a)=>e(k(n,t),n,o,a)))));var K={nil:P,cons:(e,t="")=>Object.freeze({...P,id:t,instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:I,has:(e,t)=>e in I(t),typeOf:T,step:k,entries:e=>Object.keys(I(e)).map((t=>[t,k(t,e)])),keys:e=>Object.keys(I(e)),map:V,filter:R,reduce:C,every:U,some:z,length:e=>I(e).length},L=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,q=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,_=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,D=/\\([\u000b\u0020-\u00ff])/g,N=/([\\"])/g,B=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function F(e){var t=String(e);if(_.test(t))return t;if(t.length>0&&!q.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(N,"\\$1")+'"'}function J(e){this.parameters=Object.create(null),this.type=e}var W={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!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 J(n.toLowerCase());if(-1!==r){var a,i,s;for(L.lastIndex=r;i=L.exec(t);){if(i.index!==r)throw new TypeError("invalid parameter format");r+=i[0].length,a=i[1].toLowerCase(),'"'===(s=i[2])[0]&&(s=s.substr(1,s.length-2).replace(D,"$1")),o.parameters[a]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},Z=async e=>Object.entries(await e),M=e((async(e,t)=>(await t).map(e))),G=e((async(e,t,r)=>(await r).reduce((async(t,r)=>e(await t,r)),t))),H=e((async(e,t,r={})=>G((async(t,r)=>await e(r)?t.concat([r]):t),[],t,r))),Q=e((async(e,t)=>{const r=await M(e,t);return(await Promise.all(r)).some((e=>e))})),X=e((async(e,t)=>{const r=await M(e,t);return(await Promise.all(r)).every((e=>e))})),Y=e(((e,t)=>e.reduce((async(e,t)=>t(await e)),t))),ee={entries: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)};ee.entries,ee.map,ee.filter,ee.reduce,ee.some,ee.every,ee.pipeline,ee.all,ee.allValues;var te=fetch;const{jsonTypeOf:re,splitUrl:ne,safeResolveUrl:oe,pathRelative:ae}=f,ie={},se={},ce=(e,t)=>{const r=e in se?se[e]:e;if(r in ie)return ie[r][t]},le={},ue={},fe=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=ne(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=ce(n,"baseToken"),a=ce(n,"anchorToken"),i=ne(t)[0];if(!i&&!ne(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const s=oe(i,e[o]||""),[c,l]=ne(s);delete e[o],l&&o===a&&(e[a]=a!==o?encodeURI(l):`#${encodeURI(l)}`),i&&(ue[i]=c);const u={},f=ce(n,"recursiveAnchorToken");let p;!0===e[f]&&(u[""]=`${c}#`,e[a]="",delete e[f]);const d=ce(n,"vocabularyToken");re(e[d],"object")?(se[c]=n,p=e[d],delete e[d]):(se[c]=n,p={[n]:!0});const h={"":""};return le[c]={id:c,schemaVersion:n,schema:pe(e,c,n,j.nil,h,u),anchors:h,dynamicAnchors:u,vocabulary:p,validated:!1},c},pe=(e,t,r,n,o,a)=>{if(re(e,"object")){const i="string"==typeof e.$schema?ne(e.$schema)[0]:r,s=ce(i,"embeddedToken"),c=ce(i,"anchorToken");if("string"==typeof e[s]&&(s!==c||"#"!==e[s][0])){const n=oe(t,e[s]);return e[s]=n,fe(e,n,r),x.cons(e[s],e)}const l=ce(r,"anchorToken"),u=ce(r,"dynamicAnchorToken");"string"==typeof e[u]&&(a[e[u]]=`${t}#${encodeURI(n)}`,o[e[u]]=n,delete e[u]);const f=ce(r,"embeddedToken");if("string"==typeof e[l]){const t=l!==f?e[l]:e[l].slice(1);o[t]=n,delete e[l]}const p=ce(r,"jrefToken");if("string"==typeof e[p])return x.cons(e[p],e);for(const i in e)e[i]=pe(e[i],t,r,j.append(i,n),o,a);return e}return Array.isArray(e)?e.map(((e,i)=>pe(e,t,r,j.append(i,n),o,a))):e},de=e=>le[ue[e]]||le[e],he=Object.freeze({id:"",schemaVersion:void 0,vocabulary:{},pointer:j.nil,schema:void 0,value:void 0,anchors:{},dynamicAnchors:{},validated:!0}),ye=async(e,t=he)=>{const r=oe(ve(t),e),[n,o]=ne(r);if(!(e=>e in le||e in ue)(n)){const e=await te(n,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error(`Failed to retrieve schema with id: ${n}`);if(e.headers.has("content-type")){const t=W.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${n} is not a schema. Found a document with media type: ${t}`)}fe(await e.json(),n)}const a=de(n),i="/"!==o[0]?be(a,o):o,s=Object.freeze({...a,pointer:i,value:j.get(i,a.schema)});return me(s)},me=e=>x.isReference(e.value)?ye(x.href(e.value),e):e,be=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},ve=e=>`${e.id}#${encodeURI(e.pointer)}`,ge=e=>x.isReference(e.value)?x.value(e.value):e.value,we=(e,t)=>{const r=de(t.id),n=Object.freeze({...t,pointer:j.append(e,t.pointer),value:ge(t)[e],validated:r.validated});return me(n)},Oe=e(((e,t)=>ee.pipeline([ge,ee.map((async(r,n)=>e(await we(n,t),n))),ee.all],t))),Ee={parentId:"",parentDialect:"",includeEmbedded:!0},je=(e,t)=>{if(t.startsWith("file://")){const r=e.slice(7,e.lastIndexOf("/"));return""===e?"":ae(r,t.slice(7))}return t};var $e={setConfig:(e,t,r)=>{ie[e]||(ie[e]={}),ie[e][t]=r},getConfig:ce,add:fe,get:ye,markValidated:e=>{le[e].validated=!0},uri:ve,value:ge,getAnchorPointer:be,typeOf:(e,t)=>re(ge(e),t),has:(e,t)=>e in ge(t),step:we,keys:e=>Object.keys(ge(e)),entries:e=>ee.pipeline([ge,Object.keys,ee.map((async t=>[t,await we(t,e)])),ee.all],e),map:Oe,length:e=>ge(e).length,toSchema:(e,t={})=>{const r={...Ee,...t},n=JSON.parse(JSON.stringify(e.schema,((t,n)=>{if(!x.isReference(n))return n;const o=x.value(n),a=o.$schema||e.schemaVersion,i=ce(a,"embeddedToken");return!r.includeEmbedded&&i in o?void 0:x.value(n)}))),o=ce(e.schemaVersion,"dynamicAnchorToken");Object.entries(e.dynamicAnchors).forEach((([e,t])=>{const r=ne(t)[1];j.assign(r,n,{[o]:e,...j.get(r,n)})}));const a=ce(e.schemaVersion,"anchorToken");Object.entries(e.anchors).filter((([e])=>""!==e)).forEach((([e,t])=>{j.assign(t,n,{[a]:e,...j.get(t,n)})}));const i=ce(e.schemaVersion,"baseToken"),s=je(r.parentId,e.id),c=r.parentDialect===e.schemaVersion?"":e.schemaVersion;return{...s&&{[i]:s},...c&&{$schema:c},...n}}};$e.setConfig,$e.getConfig,$e.add,$e.get,$e.markValidated,$e.uri,$e.value,$e.getAnchorPointer,$e.typeOf,$e.has,$e.step,$e.keys,$e.entries,$e.map,$e.length,$e.toSchema;class Se extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var xe=Se;const{splitUrl:Ae}=f,Pe="FLAG",Ie="BASIC",Te="DETAILED",ke="VERBOSE";let Ve=Te,Re=!0;const Ce=async e=>{const t={metaData:{}};return{ast:t,schemaUri:await Ne(e,t)}},Ue=e((({ast:e,schemaUri:t},r,o=Pe)=>{if(![Pe,Ie,Te,ke].includes(o))throw Error(`The '${o}' error format is not supported`);const a=[],i=n.subscribe("result",ze(o,a));return Fe(t,r,e,{}),n.unsubscribe(i),a[0]})),ze=(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===ke||e!==Pe&&!t.valid)&&n.errors.unshift(...o)}r[r.length-1]=n,t[0]=n}}},Ke={},Le=e=>Ke[e],qe=e=>e in Ke,_e={},De={},Ne=async(e,t)=>{if(e=await Be(e),!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 _e)Object.entries(_e[e]).forEach((([e,r])=>{((e,t)=>{Ke[e]={collectEvaluatedItems:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&new Set,collectEvaluatedProperties:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&[],...t}})(`${t.id}#${e}`,r)}));else if(r)throw Error(`Missing required vocabulary: ${e}`)}))}if(Re&&!e.validated){if($e.markValidated(e.id),!(e.schemaVersion in De)){const t=await $e.get(e.schemaVersion),r=await Ce(t);De[t.id]=Ue(r)}const t=K.cons(e.schema,e.id),r=De[e.schemaVersion](t,Ve);if(!r.valid)throw new xe(r)}return e.id in t.metaData||(t.metaData[e.id]={id:e.id,dynamicAnchors:e.dynamicAnchors,anchors:e.anchors}),Le(`${e.schemaVersion}#validate`).compile(e,t)},Be=async e=>$e.typeOf(e,"string")?Be(await $e.get($e.value(e),e)):e,Fe=(e,t,r,n)=>{const o=Je(e,r),a=Ae(e)[0];return Le(o).interpret(e,t,r,{...r.metaData[a].dynamicAnchors,...n})},Je=(e,t)=>{if(!(e in t))throw Error(`No schema found at ${e}`);return t[e][0]};var We={validate:async(e,t,r)=>{const n=await Ce(e),o=(e,t)=>Ue(n,K.cons(e),t);return void 0===t?o:o(t,r)},compile:Ce,interpret:Ue,setMetaOutputFormat:e=>{Ve=e},setShouldMetaValidate:e=>{Re=e},FLAG:Pe,BASIC:Ie,DETAILED:Te,VERBOSE:ke,add:(e,t="",r="")=>{const n=$e.add(e,t,r);delete De[n]},getKeyword:Le,hasKeyword:qe,defineVocabulary:(e,t)=>{_e[e]=t},compileSchema:Ne,interpretSchema:Fe,collectEvaluatedProperties:(e,t,r,n,o)=>{const a=Je(e,r);return Le(a).collectEvaluatedProperties(e,t,r,n,o)},collectEvaluatedItems:(e,t,r,n,o)=>{const a=Je(e,r);return Le(a).collectEvaluatedItems(e,t,r,n,o)}};var Ze={compile:e=>$e.value(e),interpret:()=>!0};var Me={compile:async(e,t)=>{const r=$e.uri(e);if(!(r in t)){t[r]=!1;const n=$e.value(e);if(!["object","boolean"].includes(typeof n))throw Error(`No schema found at '${$e.uri(e)}'`);t[r]=[`${e.schemaVersion}#validate`,$e.uri(e),"boolean"==typeof n?n:await ee.pipeline([$e.entries,ee.map((([t,r])=>[`${e.schemaVersion}#${t}`,r])),ee.filter((([t])=>We.hasKeyword(t)&&t!==`${e.schemaVersion}#validate`)),ee.map((async([r,n])=>{const o=await We.getKeyword(r).compile(n,t,e);return[r,$e.uri(n),o]})),ee.all],e)]}return r},interpret:(e,t,r,o)=>{const[a,i,s]=r[e];n.publishSync("result.start");const c="boolean"==typeof s?s:s.every((([e,a,i])=>{n.publishSync("result.start");const s=We.getKeyword(e).interpret(i,t,r,o);return n.publishSync("result",{keyword:e,absoluteKeywordLocation:a,instanceLocation:K.uri(t),valid:s,ast:i}),n.publishSync("result.end"),s}));return n.publishSync("result",{keyword:a,absoluteKeywordLocation:i,instanceLocation:K.uri(t),valid:c,ast:e}),n.publishSync("result.end"),c},collectEvaluatedProperties:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&[]:a.filter((([e])=>!o||!e.endsWith("#unevaluatedProperties"))).reduce(((e,[o,,a])=>{const i=e&&We.getKeyword(o).collectEvaluatedProperties(a,t,r,n);return!1!==i&&[...e,...i]}),[])},collectEvaluatedItems:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&new Set:a.filter((([e])=>!o||!e.endsWith("#unevaluatedItems"))).reduce(((e,[o,,a])=>{const i=!1!==e&&We.getKeyword(o).collectEvaluatedItems(a,t,r,n);return!1!==i&&new Set([...e,...i])}),new Set)}},Ge={metaData:Ze,validate:Me},He={Core:We,Schema:$e,Instance:K,Reference:x,Keywords:Ge,InvalidSchemaError:xe},Qe=He.Core,Xe=He.Schema,Ye=He.Instance,et=He.Reference,tt=He.Keywords,rt=He.InvalidSchemaError;exports.Core=Qe,exports.Instance=Ye,exports.InvalidSchemaError=rt,exports.Keywords=tt,exports.Reference=et,exports.Schema=Xe,exports.default=He; | ||
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}Object.defineProperty(exports,"__esModule",{value:!0});var t=e(require("url-resolve-browser")),r=function(e,t){return function r(){null==t&&(t=e.length);var n=[].slice.call(arguments);return n.length>=t?e.apply(this,n):function(){return r.apply(this,n.concat([].slice.call(arguments)))}}};var n="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var o,a=(function(e,t){var r;r={},("object"==typeof window&&window||n).PubSub=r,function(e){var t={},r=-1,n="*";function o(e){var t;for(t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function a(e){return function(){throw e}}function i(e,t,r){try{e(t,r)}catch(e){setTimeout(a(e),0)}}function s(e,t,r){e(t,r)}function c(e,r,n,o){var a,c=t[r],l=o?s:i;if(Object.prototype.hasOwnProperty.call(t,r))for(a in c)Object.prototype.hasOwnProperty.call(c,a)&&l(c[a],e,n)}function l(e,t,r){return function(){var o=String(e),a=o.lastIndexOf(".");for(c(e,e,t,r);-1!==a;)a=(o=o.substr(0,a)).lastIndexOf("."),c(e,o,t,r);c(e,n,t,r)}}function u(e){var r=String(e);return Boolean(Object.prototype.hasOwnProperty.call(t,r)&&o(t[r]))}function d(e){for(var t=String(e),r=u(t)||u(n),o=t.lastIndexOf(".");!r&&-1!==o;)o=(t=t.substr(0,o)).lastIndexOf("."),r=u(t);return r}function f(e,t,r,n){var o=l(e="symbol"==typeof e?e.toString():e,t,n);return!!d(e)&&(!0===r?o():setTimeout(o,0),!0)}e.publish=function(t,r){return f(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return f(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,Object.prototype.hasOwnProperty.call(t,e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeAll=function(t){return e.subscribe(n,t)},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n,o=0;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)){for(n in t[r])o++;break}return o},e.getSubscriptions=function(e){var r,n=[];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,a,i=function(e){var r;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e))return!0;return!1},s="string"==typeof r&&(Object.prototype.hasOwnProperty.call(t,r)||i(r)),c=!s&&"string"==typeof r,l="function"==typeof r,u=!1;if(!s){for(n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(o=t[n],c&&o[r]){delete o[r],u=r;break}if(l)for(a in o)Object.prototype.hasOwnProperty.call(o,a)&&o[a]===r&&(delete o[a],u=!0)}return u}e.clearSubscriptions(r)}}(r),void 0!==e&&e.exports&&(t=e.exports=r),t.PubSub=r,e.exports=t=r}(o={exports:{}},o.exports),o.exports);a.PubSub;const i={null:e=>null===e,boolean:e=>"boolean"==typeof e,object:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,array:e=>Array.isArray(e),number:e=>"number"==typeof e,integer:e=>Number.isInteger(e),string:e=>"string"==typeof e},s=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)]},c=e=>{const t=RegExp(/^(.+):\/\//).exec(e);return t?t[1]:""};var l={jsonTypeOf:(e,t)=>i[t](e),splitUrl:s,safeResolveUrl:(e,r)=>{const n=t.default(e,r),o=s(e)[0];if(o&&"file"===c(n)&&"file"!==c(o))throw Error(`Can't access file '${n}' resource from network context '${e}'`);return n},pathRelative:(e,t)=>{if(e===t)return"";let r=1;const n=e.length-1,o=t.length-r,a=n<o?n:o;let i=-1,s=0;for(;s<a;s++){const n=e.charCodeAt(s+1);if(n!==t.charCodeAt(r+s))break;47===n&&(i=s)}if(o>a){if(47===t.charCodeAt(r+s))return t.slice(r+s+1);if(0===s)return t.slice(r+s)}n>a&&(47===e.charCodeAt(s+1)?i=s:0===a&&(i=0));let c="";for(s=i+2;s<=e.length;++s)s!==e.length&&47!==e.charCodeAt(s)||(c+=0===c.length?"..":"/..");return r+=i,c.length>0?`${c}${t.slice(r,t.length)}`:(47===t.charCodeAt(r)&&++r,t.slice(r,t.length))}};const u=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(v)},d=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:d(e,w(t,o,n),r,y(o,n))}}if(Array.isArray(t)){const n=[...t];return n[b(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:w(t,e[0],n)},f=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||g(t)){const o=e.shift();f(e,w(t,o,n),r,y(o,n))}else{t[b(t,e[0])]=r}},p=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=w(t,n,r);return{...t,[n]:p(e,o,y(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 w(t,e[0],r)}},h=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=w(t,n,r);h(e,o,y(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:w(t,e[0],r)},y=r(((e,t)=>t+"/"+m(e))),m=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),v=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),b=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,w=(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(g(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[b(e,t)]},g=e=>null===e||"object"!=typeof e;var O={nil:"",append:y,get:(e,t)=>{const r=u(e),n=e=>r.reduce((([e,t],r)=>[w(e,r,t),y(r,t)]),[e,""])[0];return void 0===t?n:n(t)},set:(e,t,n)=>{const o=u(e),a=r(((e,t)=>d(o,e,t,"")));return void 0===t?a:a(t,n)},assign:(e,t,n)=>{const o=u(e),a=r(((e,t)=>f(o,e,t,"")));return void 0===t?a:a(t,n)},unset:(e,t)=>{const r=u(e),n=e=>p(r,e,"");return void 0===t?n:n(t)},remove:(e,t)=>{const r=u(e),n=e=>h(r,e,"");return void 0===t?n:n(t)}};O.nil,O.append,O.get,O.set,O.assign,O.unset,O.remove;const E=Symbol("$__value"),j=Symbol("$__href");var $={cons:(e,t)=>Object.freeze({[j]:e,[E]:t}),isReference:e=>e&&void 0!==e[j],href:e=>e[j],value:e=>e[E]};const{jsonTypeOf:S}=l,A=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),T=e=>$.isReference(e.value)?$.value(e.value):e.value,x=r(((e,t)=>S(T(e),t))),I=(e,t)=>Object.freeze({...t,pointer:O.append(e,t.pointer),value:T(t)[e]}),k=r(((e,t)=>T(t).map(((r,n,o,a)=>e(I(n,t),n,o,a))))),V=r(((e,t)=>T(t).map(((e,r,n,o)=>I(r,t))).filter(((t,r,n,o)=>e(t,r,n,o))))),P=r(((e,t,r)=>T(r).reduce(((t,n,o)=>e(t,I(o,r),o)),t))),R=r(((e,t)=>T(t).every(((r,n,o,a)=>e(I(n,t),n,o,a))))),C=r(((e,t)=>T(t).some(((r,n,o,a)=>e(I(n,t),n,o,a)))));var U={nil:A,cons:(e,t="")=>Object.freeze({...A,id:t,instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:T,has:(e,t)=>e in T(t),typeOf:x,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:P,every:R,some:C,length:e=>T(e).length},K=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,L=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,z=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,_=/\\([\u000b\u0020-\u00ff])/g,D=/([\\"])/g,N=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function q(e){var t=String(e);if(z.test(t))return t;if(t.length>0&&!L.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(D,"\\$1")+'"'}function B(e){this.parameters=Object.create(null),this.type=e}var F={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!N.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,a=Object.keys(t).sort(),i=0;i<a.length;i++){if(o=a[i],!z.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+q(t[o])}return n},parse:function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;"function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.substr(0,r).trim():t.trim();if(!N.test(n))throw new TypeError("invalid media type");var o=new B(n.toLowerCase());if(-1!==r){var a,i,s;for(K.lastIndex=r;i=K.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(_,"$1")),o.parameters[a]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},J=async e=>Object.entries(await e),Z=r((async(e,t)=>(await t).map(e))),M=r((async(e,t,r)=>(await r).reduce((async(t,r)=>e(await t,r)),t))),W=r((async(e,t,r={})=>M((async(t,r)=>await e(r)?t.concat([r]):t),[],t,r))),G=r((async(e,t)=>{const r=await Z(e,t);return(await Promise.all(r)).some((e=>e))})),H=r((async(e,t)=>{const r=await Z(e,t);return(await Promise.all(r)).every((e=>e))})),Q=r(((e,t)=>e.reduce((async(e,t)=>t(await e)),t))),X={entries:J,map:Z,filter:W,reduce:M,some:G,every:H,pipeline:Q,all:e=>Promise.all(e),allValues:e=>Q([J,M((async(e,[t,r])=>(e[t]=await r,e)),{})],e)};X.entries,X.map,X.filter,X.reduce,X.some,X.every,X.pipeline,X.all,X.allValues;var Y=fetch;const{jsonTypeOf:ee,splitUrl:te,safeResolveUrl:re,pathRelative:ne}=l,oe={},ae={},ie=(e,t)=>{const r=e in ae?ae[e]:e;if(r in oe)return oe[r][t]},se={},ce={},le=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=te(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=ie(n,"baseToken"),a=ie(n,"anchorToken"),i=te(t)[0];if(!i&&!te(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const s=re(i,e[o]||""),[c,l]=te(s);delete e[o],l&&o===a&&(e[a]=a!==o?encodeURI(l):`#${encodeURI(l)}`),i&&(ce[i]=c);const u={},d=ie(n,"recursiveAnchorToken");let f;!0===e[d]&&(u[""]=`${c}#`,e[a]="",delete e[d]);const p=ie(n,"vocabularyToken");ee(e[p],"object")?(ae[c]=n,f=e[p],delete e[p]):(ae[c]=n,f={[n]:!0});const h={"":""};return se[c]={id:c,schemaVersion:n,schema:ue(e,c,n,O.nil,h,u),anchors:h,dynamicAnchors:u,vocabulary:f,validated:!1},c},ue=(e,t,r,n,o,a)=>{if(ee(e,"object")){const i="string"==typeof e.$schema?te(e.$schema)[0]:r,s=ie(i,"embeddedToken"),c=ie(i,"anchorToken");if("string"==typeof e[s]&&(s!==c||"#"!==e[s][0])){const n=re(t,e[s]);return e[s]=n,le(e,n,r),$.cons(e[s],e)}const l=ie(r,"anchorToken"),u=ie(r,"dynamicAnchorToken");"string"==typeof e[u]&&(a[e[u]]=`${t}#${encodeURI(n)}`,o[e[u]]=n,delete e[u]);const d=ie(r,"embeddedToken");if("string"==typeof e[l]){const t=l!==d?e[l]:e[l].slice(1);o[t]=n,delete e[l]}const f=ie(r,"jrefToken");if("string"==typeof e[f])return $.cons(e[f],e);for(const i in e)e[i]=ue(e[i],t,r,O.append(i,n),o,a);return e}return Array.isArray(e)?e.map(((e,i)=>ue(e,t,r,O.append(i,n),o,a))):e},de=e=>se[ce[e]]||se[e],fe=Object.freeze({id:"",schemaVersion:void 0,vocabulary:{},pointer:O.nil,schema:void 0,value:void 0,anchors:{},dynamicAnchors:{},validated:!0}),pe=async(e,t=fe)=>{const r=re(me(t),e),[n,o]=te(r);if(!(e=>e in se||e in ce)(n)){const e=await Y(n,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error(`Failed to retrieve schema with id: ${n}`);if(e.headers.has("content-type")){const t=F.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${n} is not a schema. Found a document with media type: ${t}`)}le(await e.json(),n)}const a=de(n),i="/"!==o[0]?ye(a,o):o,s=Object.freeze({...a,pointer:i,value:O.get(i,a.schema)});return he(s)},he=e=>$.isReference(e.value)?pe($.href(e.value),e):e,ye=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},me=e=>`${e.id}#${encodeURI(e.pointer)}`,ve=e=>$.isReference(e.value)?$.value(e.value):e.value,be=(e,t)=>{const r=de(t.id),n=Object.freeze({...t,pointer:O.append(e,t.pointer),value:ve(t)[e],validated:r.validated});return he(n)},we=r(((e,t)=>X.pipeline([ve,X.map((async(r,n)=>e(await be(n,t),n))),X.all],t))),ge={parentId:"",parentDialect:"",includeEmbedded:!0},Oe=(e,t)=>{if(t.startsWith("file://")){const r=e.slice(7,e.lastIndexOf("/"));return""===e?"":ne(r,t.slice(7))}return t};var Ee={setConfig:(e,t,r)=>{oe[e]||(oe[e]={}),oe[e][t]=r},getConfig:ie,add:le,get:pe,markValidated:e=>{se[e].validated=!0},uri:me,value:ve,getAnchorPointer:ye,typeOf:(e,t)=>ee(ve(e),t),has:(e,t)=>e in ve(t),step:be,keys:e=>Object.keys(ve(e)),entries:e=>X.pipeline([ve,Object.keys,X.map((async t=>[t,await be(t,e)])),X.all],e),map:we,length:e=>ve(e).length,toSchema:(e,t={})=>{const r={...ge,...t},n=JSON.parse(JSON.stringify(e.schema,((t,n)=>{if(!$.isReference(n))return n;const o=$.value(n),a=o.$schema||e.schemaVersion,i=ie(a,"embeddedToken");return!r.includeEmbedded&&i in o?void 0:$.value(n)}))),o=ie(e.schemaVersion,"dynamicAnchorToken");Object.entries(e.dynamicAnchors).forEach((([e,t])=>{const r=te(t)[1];O.assign(r,n,{[o]:e,...O.get(r,n)})}));const a=ie(e.schemaVersion,"anchorToken");Object.entries(e.anchors).filter((([e])=>""!==e)).forEach((([e,t])=>{O.assign(t,n,{[a]:e,...O.get(t,n)})}));const i=ie(e.schemaVersion,"baseToken"),s=Oe(r.parentId,e.id),c=r.parentDialect===e.schemaVersion?"":e.schemaVersion;return{...s&&{[i]:s},...c&&{$schema:c},...n}}};Ee.setConfig,Ee.getConfig,Ee.add,Ee.get,Ee.markValidated,Ee.uri,Ee.value,Ee.getAnchorPointer,Ee.typeOf,Ee.has,Ee.step,Ee.keys,Ee.entries,Ee.map,Ee.length,Ee.toSchema;class je extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var $e=je;const{splitUrl:Se}=l,Ae="FLAG",Te="BASIC",xe="DETAILED",Ie="VERBOSE";let ke=xe,Ve=!0;const Pe=async e=>{const t={metaData:{}};return{ast:t,schemaUri:await De(e,t)}},Re=r((({ast:e,schemaUri:t},r,n=Ae)=>{if(![Ae,Te,xe,Ie].includes(n))throw Error(`The '${n}' error format is not supported`);const o=[],i=a.subscribe("result",Ce(n,o));return qe(t,r,e,{}),a.unsubscribe(i),o[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===Ie||e!==Ae&&!t.valid)&&n.errors.unshift(...o)}r[r.length-1]=n,t[0]=n}}},Ue={},Ke=e=>Ue[e],Le=e=>e in Ue,ze={},_e={},De=async(e,t)=>{if(e=await Ne(e),!Le(`${e.schemaVersion}#validate`)){const t=await Ee.get(e.schemaVersion);(Ee.getConfig(t.id,"mandatoryVocabularies")||[]).forEach((e=>{if(!t.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)})),Object.entries(t.vocabulary).forEach((([e,r])=>{if(e in ze)Object.entries(ze[e]).forEach((([e,r])=>{((e,t)=>{Ue[e]={collectEvaluatedItems:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&new Set,collectEvaluatedProperties:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&[],...t}})(`${t.id}#${e}`,r)}));else if(r)throw Error(`Missing required vocabulary: ${e}`)}))}if(Ve&&!e.validated){if(Ee.markValidated(e.id),!(e.schemaVersion in _e)){const t=await Ee.get(e.schemaVersion),r=await Pe(t);_e[t.id]=Re(r)}const t=U.cons(e.schema,e.id),r=_e[e.schemaVersion](t,ke);if(!r.valid)throw new $e(r)}return e.id in t.metaData||(t.metaData[e.id]={id:e.id,dynamicAnchors:e.dynamicAnchors,anchors:e.anchors}),Ke(`${e.schemaVersion}#validate`).compile(e,t)},Ne=async e=>Ee.typeOf(e,"string")?Ne(await Ee.get(Ee.value(e),e)):e,qe=(e,t,r,n)=>{const o=Be(e,r),a=Se(e)[0];return Ke(o).interpret(e,t,r,{...r.metaData[a].dynamicAnchors,...n})},Be=(e,t)=>{if(!(e in t))throw Error(`No schema found at ${e}`);return t[e][0]};var Fe={validate:async(e,t,r)=>{const n=await Pe(e),o=(e,t)=>Re(n,U.cons(e),t);return void 0===t?o:o(t,r)},compile:Pe,interpret:Re,setMetaOutputFormat:e=>{ke=e},setShouldMetaValidate:e=>{Ve=e},FLAG:Ae,BASIC:Te,DETAILED:xe,VERBOSE:Ie,add:(e,t="",r="")=>{const n=Ee.add(e,t,r);delete _e[n]},getKeyword:Ke,hasKeyword:Le,defineVocabulary:(e,t)=>{ze[e]=t},compileSchema:De,interpretSchema:qe,collectEvaluatedProperties:(e,t,r,n,o)=>{const a=Be(e,r);return Ke(a).collectEvaluatedProperties(e,t,r,n,o)},collectEvaluatedItems:(e,t,r,n,o)=>{const a=Be(e,r);return Ke(a).collectEvaluatedItems(e,t,r,n,o)}};var Je={compile:e=>Ee.value(e),interpret:()=>!0};var Ze={compile:async(e,t)=>{const r=Ee.uri(e);if(!(r in t)){t[r]=!1;const n=Ee.value(e);if(!["object","boolean"].includes(typeof n))throw Error(`No schema found at '${Ee.uri(e)}'`);t[r]=[`${e.schemaVersion}#validate`,Ee.uri(e),"boolean"==typeof n?n:await X.pipeline([Ee.entries,X.map((([t,r])=>[`${e.schemaVersion}#${t}`,r])),X.filter((([t])=>Fe.hasKeyword(t)&&t!==`${e.schemaVersion}#validate`)),X.map((async([r,n])=>{const o=await Fe.getKeyword(r).compile(n,t,e);return[r,Ee.uri(n),o]})),X.all],e)]}return r},interpret:(e,t,r,n)=>{const[o,i,s]=r[e];a.publishSync("result.start");const c="boolean"==typeof s?s:s.every((([e,o,i])=>{a.publishSync("result.start");const s=Fe.getKeyword(e).interpret(i,t,r,n);return a.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:U.uri(t),valid:s,ast:i}),a.publishSync("result.end"),s}));return a.publishSync("result",{keyword:o,absoluteKeywordLocation:i,instanceLocation:U.uri(t),valid:c,ast:e}),a.publishSync("result.end"),c},collectEvaluatedProperties:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&[]:a.filter((([e])=>!o||!e.endsWith("#unevaluatedProperties"))).reduce(((e,[o,,a])=>{const i=e&&Fe.getKeyword(o).collectEvaluatedProperties(a,t,r,n);return!1!==i&&[...e,...i]}),[])},collectEvaluatedItems:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&new Set:a.filter((([e])=>!o||!e.endsWith("#unevaluatedItems"))).reduce(((e,[o,,a])=>{const i=!1!==e&&Fe.getKeyword(o).collectEvaluatedItems(a,t,r,n);return!1!==i&&new Set([...e,...i])}),new Set)}},Me={metaData:Je,validate:Ze},We={Core:Fe,Schema:Ee,Instance:U,Reference:$,Keywords:Me,InvalidSchemaError:$e},Ge=We.Core,He=We.Schema,Qe=We.Instance,Xe=We.Reference,Ye=We.Keywords,et=We.InvalidSchemaError;exports.Core=Ge,exports.Instance=Qe,exports.InvalidSchemaError=et,exports.Keywords=Ye,exports.Reference=Xe,exports.Schema=He,exports.default=We; | ||
//# sourceMappingURL=json-schema-core-cjs.min.js.map |
@@ -0,1 +1,3 @@ | ||
import urlResolveBrowser from 'url-resolve-browser'; | ||
var justCurryIt = curry; | ||
@@ -397,213 +399,2 @@ | ||
var urlResolveBrowser = urlResolve; | ||
/* | ||
The majority of the module is built by following RFC1808 | ||
url: https://tools.ietf.org/html/rfc1808 | ||
*/ | ||
// adds a slash at end if not present | ||
function _addSlash (url) { | ||
return url + (url[url.length-1] === '/' ? '' : '/'); | ||
} | ||
// resolve the ..'s (directory up) and such | ||
function _pathResolve (path) { | ||
let pathSplit = path.split('/'); | ||
// happens when path starts with / | ||
if (pathSplit[0] === '') { | ||
pathSplit = pathSplit.slice(1); | ||
} | ||
// let segmentCount = 0; // number of segments that have been passed | ||
let resultArray = []; | ||
pathSplit.forEach((current, index) => { | ||
// skip occurances of '.' | ||
if (current !== '.') { | ||
if (current === '..') { | ||
resultArray.pop(); // remove previous | ||
} else if (current !== '' || index === pathSplit.length - 1) { | ||
resultArray.push(current); | ||
} | ||
} | ||
}); | ||
return '/' + resultArray.join('/'); | ||
} | ||
// parses a base url string into an object containing host, path and query | ||
function _baseParse (base) { | ||
const resultObject = { | ||
host: '', | ||
path: '', | ||
query: '', | ||
protocol: '' | ||
}; | ||
let path = base; | ||
let protocolEndIndex = base.indexOf('//'); | ||
resultObject.protocol = path.substring(0, protocolEndIndex); | ||
protocolEndIndex += 2; // add two to pass double slash | ||
const pathIndex = base.indexOf('/', protocolEndIndex); | ||
const queryIndex = base.indexOf('?'); | ||
const hashIndex = base.indexOf('#'); | ||
if (hashIndex !== -1) { | ||
path = path.substring(0, hashIndex); // remove hash, not needed for base | ||
} | ||
if (queryIndex !== -1) { | ||
const query = path.substring(queryIndex); // remove query, save in return obj | ||
resultObject.query = query; | ||
path = path.substring(0, queryIndex); | ||
} | ||
if (pathIndex !== -1) { | ||
const host = path.substring(0, pathIndex); // separate host & path | ||
resultObject.host = host; | ||
path = path.substring(pathIndex); | ||
resultObject.path = path; | ||
} else { | ||
resultObject.host = path; // there was no path, therefore path is host | ||
} | ||
return resultObject; | ||
} | ||
// https://tools.ietf.org/html/rfc3986#section-3.1 | ||
const _scheme = '[a-z][a-z0-9+.-]*'; // ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )] | ||
const _isAbsolute = new RegExp(`^(${_scheme}:)?//`, 'i'); | ||
// parses a relative url string into an object containing the href, | ||
// hash, query and whether it is a net path, absolute path or relative path | ||
function _relativeParse (relative) { | ||
const resultObject = { | ||
href: relative, // href is always what was passed through | ||
hash: '', | ||
query: '', | ||
netPath: false, | ||
absolutePath: false, | ||
relativePath: false | ||
}; | ||
// check for protocol | ||
// if protocol exists, is net path (absolute URL) | ||
if (_isAbsolute.test(relative)) { | ||
resultObject.netPath = true; | ||
// return, in this case the relative is the resolved url, no need to parse. | ||
return resultObject; | ||
} | ||
// if / is first, this is an absolute path, | ||
// I.E. it overwrites the base URL's path | ||
if (relative[0] === '/') { | ||
resultObject.absolutePath = true; | ||
// return resultObject | ||
} else if (relative !== '') { | ||
resultObject.relativePath = true; | ||
} | ||
let path = relative; | ||
const queryIndex = relative.indexOf('?'); | ||
const hashIndex = relative.indexOf('#'); | ||
if (hashIndex !== -1) { | ||
const hash = path.substring(hashIndex); | ||
resultObject.hash = hash; | ||
path = path.substring(0, hashIndex); | ||
} | ||
if (queryIndex !== -1) { | ||
const query = path.substring(queryIndex); | ||
resultObject.query = query; | ||
path = path.substring(0, queryIndex); | ||
} | ||
resultObject.path = path; // whatever is left is path | ||
return resultObject; | ||
} | ||
function _shouldAddSlash (url) { | ||
const protocolIndex = url.indexOf('//') + 2; | ||
const noPath = !(url.includes('/', protocolIndex)); | ||
const noQuery = !(url.includes('?', protocolIndex)); | ||
const noHash = !(url.includes('#', protocolIndex)); | ||
return (noPath && noQuery && noHash); | ||
} | ||
function _shouldAddProtocol (url) { | ||
return url.startsWith('//'); | ||
} | ||
/* | ||
* PRECONDITION: Base is a fully qualified URL. e.g. http://example.com/ | ||
* optional: path, query or hash | ||
* returns the resolved url | ||
*/ | ||
function urlResolve (base, relative) { | ||
base = base.trim(); | ||
relative = relative.trim(); | ||
// about is always absolute | ||
if (relative.startsWith('about:')) { | ||
return relative; | ||
} | ||
const baseObj = _baseParse(base); | ||
const relativeObj = _relativeParse(relative); | ||
if (!baseObj.protocol && !relativeObj.netPath) { | ||
throw new Error('Error, protocol is not specified'); | ||
} | ||
if (relativeObj.netPath) { // relative is full qualified URL | ||
if (_shouldAddProtocol(relativeObj.href)) { | ||
relativeObj.href = baseObj.protocol + relativeObj.href; | ||
} | ||
if (_shouldAddSlash(relativeObj.href)) { | ||
return _addSlash(relativeObj.href); | ||
} | ||
return relativeObj.href; | ||
} else if (relativeObj.absolutePath) { // relative is an absolute path | ||
const {path, query, hash} = relativeObj; | ||
return baseObj.host + _pathResolve(path) + query + hash; | ||
} else if (relativeObj.relativePath) { // relative is a relative path | ||
const {path, query, hash} = relativeObj; | ||
let basePath = baseObj.path; | ||
let resultString = baseObj.host; | ||
let resolvePath; | ||
if (path.length === 0) { | ||
resolvePath = basePath; | ||
} else { | ||
// remove last segment if no slash at end | ||
basePath = basePath.substring(0, basePath.lastIndexOf('/')); | ||
resolvePath = _pathResolve(basePath + '/' + path); | ||
} | ||
// if result is just the base host, add / | ||
if ((resolvePath === '') && (!query) && (!hash)) { | ||
resultString += '/'; | ||
} else { | ||
resultString += resolvePath + query + hash; | ||
} | ||
return resultString; | ||
} else { | ||
const {host, path, query} = baseObj; | ||
// when path and query aren't supplied add slash | ||
if ((!path) && (!query)) { | ||
return _addSlash(host); | ||
} | ||
return host + path + query + relativeObj.hash; | ||
} | ||
} | ||
const isObject = (value) => typeof value === "object" && !Array.isArray(value) && value !== null; | ||
@@ -610,0 +401,0 @@ const isType = { |
@@ -1,2 +0,2 @@ | ||
var e=function(e,t){return function r(){null==t&&(t=e.length);var n=[].slice.call(arguments);return n.length>=t?e.apply(this,n):function(){return r.apply(this,n.concat([].slice.call(arguments)))}}};var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var r,n=(function(e,r){var n;n={},("object"==typeof window&&window||t).PubSub=n,function(e){var t={},r=-1,n="*";function o(e){var t;for(t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function a(e){return function(){throw e}}function i(e,t,r){try{e(t,r)}catch(e){setTimeout(a(e),0)}}function s(e,t,r){e(t,r)}function c(e,r,n,o){var a,c=t[r],l=o?s:i;if(Object.prototype.hasOwnProperty.call(t,r))for(a in c)Object.prototype.hasOwnProperty.call(c,a)&&l(c[a],e,n)}function l(e,t,r){return function(){var o=String(e),a=o.lastIndexOf(".");for(c(e,e,t,r);-1!==a;)a=(o=o.substr(0,a)).lastIndexOf("."),c(e,o,t,r);c(e,n,t,r)}}function u(e){var r=String(e);return Boolean(Object.prototype.hasOwnProperty.call(t,r)&&o(t[r]))}function f(e){for(var t=String(e),r=u(t)||u(n),o=t.lastIndexOf(".");!r&&-1!==o;)o=(t=t.substr(0,o)).lastIndexOf("."),r=u(t);return r}function d(e,t,r,n){var o=l(e="symbol"==typeof e?e.toString():e,t,n);return!!f(e)&&(!0===r?o():setTimeout(o,0),!0)}e.publish=function(t,r){return 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,Object.prototype.hasOwnProperty.call(t,e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeAll=function(t){return e.subscribe(n,t)},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n,o=0;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)){for(n in t[r])o++;break}return o},e.getSubscriptions=function(e){var r,n=[];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,a,i=function(e){var r;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e))return!0;return!1},s="string"==typeof r&&(Object.prototype.hasOwnProperty.call(t,r)||i(r)),c=!s&&"string"==typeof r,l="function"==typeof r,u=!1;if(!s){for(n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(o=t[n],c&&o[r]){delete o[r],u=r;break}if(l)for(a in o)Object.prototype.hasOwnProperty.call(o,a)&&o[a]===r&&(delete o[a],u=!0)}return u}e.clearSubscriptions(r)}}(n),void 0!==e&&e.exports&&(r=e.exports=n),r.PubSub=n,e.exports=r=n}(r={exports:{}},r.exports),r.exports);n.PubSub;var o=function(e,t){if(e=e.trim(),(t=t.trim()).startsWith("about:"))return t;const r=function(e){const t={host:"",path:"",query:"",protocol:""};let r=e,n=e.indexOf("//");t.protocol=r.substring(0,n),n+=2;const o=e.indexOf("/",n),a=e.indexOf("?"),i=e.indexOf("#");-1!==i&&(r=r.substring(0,i));if(-1!==a){const e=r.substring(a);t.query=e,r=r.substring(0,a)}if(-1!==o){const e=r.substring(0,o);t.host=e,r=r.substring(o),t.path=r}else t.host=r;return t}(e),n=function(e){const t={href:e,hash:"",query:"",netPath:!1,absolutePath:!1,relativePath:!1};if(s.test(e))return t.netPath=!0,t;"/"===e[0]?t.absolutePath=!0:""!==e&&(t.relativePath=!0);let r=e;const n=e.indexOf("?"),o=e.indexOf("#");if(-1!==o){const e=r.substring(o);t.hash=e,r=r.substring(0,o)}if(-1!==n){const e=r.substring(n);t.query=e,r=r.substring(0,n)}return t.path=r,t}(t);if(!r.protocol&&!n.netPath)throw new Error("Error, protocol is not specified");if(n.netPath)return n.href.startsWith("//")&&(n.href=r.protocol+n.href),function(e){const t=e.indexOf("//")+2,r=!e.includes("/",t),n=!e.includes("?",t),o=!e.includes("#",t);return r&&n&&o}(n.href)?a(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+i(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let a,s=r.path,c=r.host;return 0===e.length?a=s:(s=s.substring(0,s.lastIndexOf("/")),a=i(s+"/"+e)),c+=""!==a||t||o?a+t+o:"/",c}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:a(e)}};function a(e){return e+("/"===e[e.length-1]?"":"/")}function i(e){let t=e.split("/");""===t[0]&&(t=t.slice(1));let r=[];return t.forEach(((e,n)=>{"."!==e&&(".."===e?r.pop():""===e&&n!==t.length-1||r.push(e))})),"/"+r.join("/")}const s=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");const c={null:e=>null===e,boolean:e=>"boolean"==typeof e,object:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,array:e=>Array.isArray(e),number:e=>"number"==typeof e,integer:e=>Number.isInteger(e),string:e=>"string"==typeof e},l=e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),o=e.slice(r+1);return[decodeURI(n),decodeURI(o)]},u=e=>{const t=RegExp(/^(.+):\/\//).exec(e);return t?t[1]:""};var f={jsonTypeOf:(e,t)=>c[t](e),splitUrl:l,safeResolveUrl:(e,t)=>{const r=o(e,t),n=l(e)[0];if(n&&"file"===u(r)&&"file"!==u(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},pathRelative:(e,t)=>{if(e===t)return"";let r=1;const n=e.length-1,o=t.length-r,a=n<o?n:o;let i=-1,s=0;for(;s<a;s++){const n=e.charCodeAt(s+1);if(n!==t.charCodeAt(r+s))break;47===n&&(i=s)}if(o>a){if(47===t.charCodeAt(r+s))return t.slice(r+s+1);if(0===s)return t.slice(r+s)}n>a&&(47===e.charCodeAt(s+1)?i=s:0===a&&(i=0));let c="";for(s=i+2;s<=e.length;++s)s!==e.length&&47!==e.charCodeAt(s)||(c+=0===c.length?"..":"/..");return r+=i,c.length>0?`${c}${t.slice(r,t.length)}`:(47===t.charCodeAt(r)&&++r,t.slice(r,t.length))}};const d=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(g)},p=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:p(e,O(t,o,n),r,b(o,n))}}if(Array.isArray(t)){const n=[...t];return n[w(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:O(t,e[0],n)},h=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||E(t)){const o=e.shift();h(e,O(t,o,n),r,b(o,n))}else{t[w(t,e[0])]=r}},y=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=O(t,n,r);return{...t,[n]:y(e,o,b(n,r))}}if(Array.isArray(t))return t.filter(((t,r)=>r!=e[0]));if("object"==typeof t&&null!==t){const{[e[0]]:r,...n}=t;return n}return O(t,e[0],r)}},m=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=O(t,n,r);m(e,o,b(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:O(t,e[0],r)},b=e(((e,t)=>t+"/"+v(e))),v=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),g=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),w=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,O=(e,t,r="")=>{if(void 0===e)throw TypeError(`Value at '${r}' is undefined and does not have property '${t}'`);if(null===e)throw TypeError(`Value at '${r}' is null and does not have property '${t}'`);if(E(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[w(e,t)]},E=e=>null===e||"object"!=typeof e;var $={nil:"",append:b,get:(e,t)=>{const r=d(e),n=e=>r.reduce((([e,t],r)=>[O(e,r,t),b(r,t)]),[e,""])[0];return void 0===t?n:n(t)},set:(t,r,n)=>{const o=d(t),a=e(((e,t)=>p(o,e,t,"")));return void 0===r?a:a(r,n)},assign:(t,r,n)=>{const o=d(t),a=e(((e,t)=>h(o,e,t,"")));return void 0===r?a:a(r,n)},unset:(e,t)=>{const r=d(e),n=e=>y(r,e,"");return void 0===t?n:n(t)},remove:(e,t)=>{const r=d(e),n=e=>m(r,e,"");return void 0===t?n:n(t)}};$.nil,$.append,$.get,$.set,$.assign,$.unset,$.remove;const j=Symbol("$__value"),S=Symbol("$__href");var A={cons:(e,t)=>Object.freeze({[S]:e,[j]:t}),isReference:e=>e&&void 0!==e[S],href:e=>e[S],value:e=>e[j]};const{jsonTypeOf:x}=f,I=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),P=e=>A.isReference(e.value)?A.value(e.value):e.value,T=e(((e,t)=>x(P(e),t))),k=(e,t)=>Object.freeze({...t,pointer:$.append(e,t.pointer),value:P(t)[e]}),V=e(((e,t)=>P(t).map(((r,n,o,a)=>e(k(n,t),n,o,a))))),R=e(((e,t)=>P(t).map(((e,r,n,o)=>k(r,t))).filter(((t,r,n,o)=>e(t,r,n,o))))),C=e(((e,t,r)=>P(r).reduce(((t,n,o)=>e(t,k(o,r),o)),t))),U=e(((e,t)=>P(t).every(((r,n,o,a)=>e(k(n,t),n,o,a))))),z=e(((e,t)=>P(t).some(((r,n,o,a)=>e(k(n,t),n,o,a)))));var K={nil:I,cons:(e,t="")=>Object.freeze({...I,id:t,instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:P,has:(e,t)=>e in P(t),typeOf:T,step:k,entries:e=>Object.keys(P(e)).map((t=>[t,k(t,e)])),keys:e=>Object.keys(P(e)),map:V,filter:R,reduce:C,every:U,some:z,length:e=>P(e).length},L=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,q=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,D=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,_=/\\([\u000b\u0020-\u00ff])/g,N=/([\\"])/g,B=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function F(e){var t=String(e);if(D.test(t))return t;if(t.length>0&&!q.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(N,"\\$1")+'"'}function J(e){this.parameters=Object.create(null),this.type=e}var W={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!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],!D.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 a,i,s;for(L.lastIndex=r;i=L.exec(t);){if(i.index!==r)throw new TypeError("invalid parameter format");r+=i[0].length,a=i[1].toLowerCase(),'"'===(s=i[2])[0]&&(s=s.substr(1,s.length-2).replace(_,"$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=e((async(e,t)=>(await t).map(e))),G=e((async(e,t,r)=>(await r).reduce((async(t,r)=>e(await t,r)),t))),H=e((async(e,t,r={})=>G((async(t,r)=>await e(r)?t.concat([r]):t),[],t,r))),Q=e((async(e,t)=>{const r=await M(e,t);return(await Promise.all(r)).some((e=>e))})),X=e((async(e,t)=>{const r=await M(e,t);return(await Promise.all(r)).every((e=>e))})),Y=e(((e,t)=>e.reduce((async(e,t)=>t(await e)),t))),ee={entries: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)};ee.entries,ee.map,ee.filter,ee.reduce,ee.some,ee.every,ee.pipeline,ee.all,ee.allValues;var te=fetch;const{jsonTypeOf:re,splitUrl:ne,safeResolveUrl:oe,pathRelative:ae}=f,ie={},se={},ce=(e,t)=>{const r=e in se?se[e]:e;if(r in ie)return ie[r][t]},le={},ue={},fe=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=ne(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=ce(n,"baseToken"),a=ce(n,"anchorToken"),i=ne(t)[0];if(!i&&!ne(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const s=oe(i,e[o]||""),[c,l]=ne(s);delete e[o],l&&o===a&&(e[a]=a!==o?encodeURI(l):`#${encodeURI(l)}`),i&&(ue[i]=c);const u={},f=ce(n,"recursiveAnchorToken");let d;!0===e[f]&&(u[""]=`${c}#`,e[a]="",delete e[f]);const p=ce(n,"vocabularyToken");re(e[p],"object")?(se[c]=n,d=e[p],delete e[p]):(se[c]=n,d={[n]:!0});const h={"":""};return le[c]={id:c,schemaVersion:n,schema:de(e,c,n,$.nil,h,u),anchors:h,dynamicAnchors:u,vocabulary:d,validated:!1},c},de=(e,t,r,n,o,a)=>{if(re(e,"object")){const i="string"==typeof e.$schema?ne(e.$schema)[0]:r,s=ce(i,"embeddedToken"),c=ce(i,"anchorToken");if("string"==typeof e[s]&&(s!==c||"#"!==e[s][0])){const n=oe(t,e[s]);return e[s]=n,fe(e,n,r),A.cons(e[s],e)}const l=ce(r,"anchorToken"),u=ce(r,"dynamicAnchorToken");"string"==typeof e[u]&&(a[e[u]]=`${t}#${encodeURI(n)}`,o[e[u]]=n,delete e[u]);const f=ce(r,"embeddedToken");if("string"==typeof e[l]){const t=l!==f?e[l]:e[l].slice(1);o[t]=n,delete e[l]}const d=ce(r,"jrefToken");if("string"==typeof e[d])return A.cons(e[d],e);for(const i in e)e[i]=de(e[i],t,r,$.append(i,n),o,a);return e}return Array.isArray(e)?e.map(((e,i)=>de(e,t,r,$.append(i,n),o,a))):e},pe=e=>le[ue[e]]||le[e],he=Object.freeze({id:"",schemaVersion:void 0,vocabulary:{},pointer:$.nil,schema:void 0,value:void 0,anchors:{},dynamicAnchors:{},validated:!0}),ye=async(e,t=he)=>{const r=oe(ve(t),e),[n,o]=ne(r);if(!(e=>e in le||e in ue)(n)){const e=await te(n,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error(`Failed to retrieve schema with id: ${n}`);if(e.headers.has("content-type")){const t=W.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${n} is not a schema. Found a document with media type: ${t}`)}fe(await e.json(),n)}const a=pe(n),i="/"!==o[0]?be(a,o):o,s=Object.freeze({...a,pointer:i,value:$.get(i,a.schema)});return me(s)},me=e=>A.isReference(e.value)?ye(A.href(e.value),e):e,be=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},ve=e=>`${e.id}#${encodeURI(e.pointer)}`,ge=e=>A.isReference(e.value)?A.value(e.value):e.value,we=(e,t)=>{const r=pe(t.id),n=Object.freeze({...t,pointer:$.append(e,t.pointer),value:ge(t)[e],validated:r.validated});return me(n)},Oe=e(((e,t)=>ee.pipeline([ge,ee.map((async(r,n)=>e(await we(n,t),n))),ee.all],t))),Ee={parentId:"",parentDialect:"",includeEmbedded:!0},$e=(e,t)=>{if(t.startsWith("file://")){const r=e.slice(7,e.lastIndexOf("/"));return""===e?"":ae(r,t.slice(7))}return t};var je={setConfig:(e,t,r)=>{ie[e]||(ie[e]={}),ie[e][t]=r},getConfig:ce,add:fe,get:ye,markValidated:e=>{le[e].validated=!0},uri:ve,value:ge,getAnchorPointer:be,typeOf:(e,t)=>re(ge(e),t),has:(e,t)=>e in ge(t),step:we,keys:e=>Object.keys(ge(e)),entries:e=>ee.pipeline([ge,Object.keys,ee.map((async t=>[t,await we(t,e)])),ee.all],e),map:Oe,length:e=>ge(e).length,toSchema:(e,t={})=>{const r={...Ee,...t},n=JSON.parse(JSON.stringify(e.schema,((t,n)=>{if(!A.isReference(n))return n;const o=A.value(n),a=o.$schema||e.schemaVersion,i=ce(a,"embeddedToken");return!r.includeEmbedded&&i in o?void 0:A.value(n)}))),o=ce(e.schemaVersion,"dynamicAnchorToken");Object.entries(e.dynamicAnchors).forEach((([e,t])=>{const r=ne(t)[1];$.assign(r,n,{[o]:e,...$.get(r,n)})}));const a=ce(e.schemaVersion,"anchorToken");Object.entries(e.anchors).filter((([e])=>""!==e)).forEach((([e,t])=>{$.assign(t,n,{[a]:e,...$.get(t,n)})}));const i=ce(e.schemaVersion,"baseToken"),s=$e(r.parentId,e.id),c=r.parentDialect===e.schemaVersion?"":e.schemaVersion;return{...s&&{[i]:s},...c&&{$schema:c},...n}}};je.setConfig,je.getConfig,je.add,je.get,je.markValidated,je.uri,je.value,je.getAnchorPointer,je.typeOf,je.has,je.step,je.keys,je.entries,je.map,je.length,je.toSchema;class Se extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var Ae=Se;const{splitUrl:xe}=f,Ie="FLAG",Pe="BASIC",Te="DETAILED",ke="VERBOSE";let Ve=Te,Re=!0;const Ce=async e=>{const t={metaData:{}};return{ast:t,schemaUri:await Ne(e,t)}},Ue=e((({ast:e,schemaUri:t},r,o=Ie)=>{if(![Ie,Pe,Te,ke].includes(o))throw Error(`The '${o}' error format is not supported`);const a=[],i=n.subscribe("result",ze(o,a));return Fe(t,r,e,{}),n.unsubscribe(i),a[0]})),ze=(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===Pe&&(o.push(...t.errors),delete t.errors),(e===ke||e!==Ie&&!t.valid)&&n.errors.unshift(...o)}r[r.length-1]=n,t[0]=n}}},Ke={},Le=e=>Ke[e],qe=e=>e in Ke,De={},_e={},Ne=async(e,t)=>{if(e=await Be(e),!qe(`${e.schemaVersion}#validate`)){const t=await je.get(e.schemaVersion);(je.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)=>{Ke[e]={collectEvaluatedItems:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&new Set,collectEvaluatedProperties:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&[],...t}})(`${t.id}#${e}`,r)}));else if(r)throw Error(`Missing required vocabulary: ${e}`)}))}if(Re&&!e.validated){if(je.markValidated(e.id),!(e.schemaVersion in _e)){const t=await je.get(e.schemaVersion),r=await Ce(t);_e[t.id]=Ue(r)}const t=K.cons(e.schema,e.id),r=_e[e.schemaVersion](t,Ve);if(!r.valid)throw new Ae(r)}return e.id in t.metaData||(t.metaData[e.id]={id:e.id,dynamicAnchors:e.dynamicAnchors,anchors:e.anchors}),Le(`${e.schemaVersion}#validate`).compile(e,t)},Be=async e=>je.typeOf(e,"string")?Be(await je.get(je.value(e),e)):e,Fe=(e,t,r,n)=>{const o=Je(e,r),a=xe(e)[0];return Le(o).interpret(e,t,r,{...r.metaData[a].dynamicAnchors,...n})},Je=(e,t)=>{if(!(e in t))throw Error(`No schema found at ${e}`);return t[e][0]};var We={validate:async(e,t,r)=>{const n=await Ce(e),o=(e,t)=>Ue(n,K.cons(e),t);return void 0===t?o:o(t,r)},compile:Ce,interpret:Ue,setMetaOutputFormat:e=>{Ve=e},setShouldMetaValidate:e=>{Re=e},FLAG:Ie,BASIC:Pe,DETAILED:Te,VERBOSE:ke,add:(e,t="",r="")=>{const n=je.add(e,t,r);delete _e[n]},getKeyword:Le,hasKeyword:qe,defineVocabulary:(e,t)=>{De[e]=t},compileSchema:Ne,interpretSchema:Fe,collectEvaluatedProperties:(e,t,r,n,o)=>{const a=Je(e,r);return Le(a).collectEvaluatedProperties(e,t,r,n,o)},collectEvaluatedItems:(e,t,r,n,o)=>{const a=Je(e,r);return Le(a).collectEvaluatedItems(e,t,r,n,o)}};var Ze={compile:e=>je.value(e),interpret:()=>!0};var Me={compile:async(e,t)=>{const r=je.uri(e);if(!(r in t)){t[r]=!1;const n=je.value(e);if(!["object","boolean"].includes(typeof n))throw Error(`No schema found at '${je.uri(e)}'`);t[r]=[`${e.schemaVersion}#validate`,je.uri(e),"boolean"==typeof n?n:await ee.pipeline([je.entries,ee.map((([t,r])=>[`${e.schemaVersion}#${t}`,r])),ee.filter((([t])=>We.hasKeyword(t)&&t!==`${e.schemaVersion}#validate`)),ee.map((async([r,n])=>{const o=await We.getKeyword(r).compile(n,t,e);return[r,je.uri(n),o]})),ee.all],e)]}return r},interpret:(e,t,r,o)=>{const[a,i,s]=r[e];n.publishSync("result.start");const c="boolean"==typeof s?s:s.every((([e,a,i])=>{n.publishSync("result.start");const s=We.getKeyword(e).interpret(i,t,r,o);return n.publishSync("result",{keyword:e,absoluteKeywordLocation:a,instanceLocation:K.uri(t),valid:s,ast:i}),n.publishSync("result.end"),s}));return n.publishSync("result",{keyword:a,absoluteKeywordLocation:i,instanceLocation:K.uri(t),valid:c,ast:e}),n.publishSync("result.end"),c},collectEvaluatedProperties:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&[]:a.filter((([e])=>!o||!e.endsWith("#unevaluatedProperties"))).reduce(((e,[o,,a])=>{const i=e&&We.getKeyword(o).collectEvaluatedProperties(a,t,r,n);return!1!==i&&[...e,...i]}),[])},collectEvaluatedItems:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&new Set:a.filter((([e])=>!o||!e.endsWith("#unevaluatedItems"))).reduce(((e,[o,,a])=>{const i=!1!==e&&We.getKeyword(o).collectEvaluatedItems(a,t,r,n);return!1!==i&&new Set([...e,...i])}),new Set)}},Ge={metaData:Ze,validate:Me},He={Core:We,Schema:je,Instance:K,Reference:A,Keywords:Ge,InvalidSchemaError:Ae},Qe=He.Core,Xe=He.Schema,Ye=He.Instance,et=He.Reference,tt=He.Keywords,rt=He.InvalidSchemaError;export{Qe as Core,Ye as Instance,rt as InvalidSchemaError,tt as Keywords,et as Reference,Xe as Schema,He as default}; | ||
import e from"url-resolve-browser";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;n={},("object"==typeof window&&window||r).PubSub=n,function(e){var t={},r=-1,n="*";function o(e){var t;for(t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function a(e){return function(){throw e}}function i(e,t,r){try{e(t,r)}catch(e){setTimeout(a(e),0)}}function s(e,t,r){e(t,r)}function c(e,r,n,o){var a,c=t[r],l=o?s:i;if(Object.prototype.hasOwnProperty.call(t,r))for(a in c)Object.prototype.hasOwnProperty.call(c,a)&&l(c[a],e,n)}function l(e,t,r){return function(){var o=String(e),a=o.lastIndexOf(".");for(c(e,e,t,r);-1!==a;)a=(o=o.substr(0,a)).lastIndexOf("."),c(e,o,t,r);c(e,n,t,r)}}function u(e){var r=String(e);return Boolean(Object.prototype.hasOwnProperty.call(t,r)&&o(t[r]))}function d(e){for(var t=String(e),r=u(t)||u(n),o=t.lastIndexOf(".");!r&&-1!==o;)o=(t=t.substr(0,o)).lastIndexOf("."),r=u(t);return r}function f(e,t,r,n){var o=l(e="symbol"==typeof e?e.toString():e,t,n);return!!d(e)&&(!0===r?o():setTimeout(o,0),!0)}e.publish=function(t,r){return f(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return f(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,Object.prototype.hasOwnProperty.call(t,e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeAll=function(t){return e.subscribe(n,t)},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n,o=0;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)){for(n in t[r])o++;break}return o},e.getSubscriptions=function(e){var r,n=[];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,a,i=function(e){var r;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e))return!0;return!1},s="string"==typeof r&&(Object.prototype.hasOwnProperty.call(t,r)||i(r)),c=!s&&"string"==typeof r,l="function"==typeof r,u=!1;if(!s){for(n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(o=t[n],c&&o[r]){delete o[r],u=r;break}if(l)for(a in o)Object.prototype.hasOwnProperty.call(o,a)&&o[a]===r&&(delete o[a],u=!0)}return u}e.clearSubscriptions(r)}}(n),void 0!==e&&e.exports&&(t=e.exports=n),t.PubSub=n,e.exports=t=n}(n={exports:{}},n.exports),n.exports);o.PubSub;const a={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},i=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)]},s=e=>{const t=RegExp(/^(.+):\/\//).exec(e);return t?t[1]:""};var c={jsonTypeOf:(e,t)=>a[t](e),splitUrl:i,safeResolveUrl:(t,r)=>{const n=e(t,r),o=i(t)[0];if(o&&"file"===s(n)&&"file"!==s(o))throw Error(`Can't access file '${n}' resource from network context '${t}'`);return n},pathRelative:(e,t)=>{if(e===t)return"";let r=1;const n=e.length-1,o=t.length-r,a=n<o?n:o;let i=-1,s=0;for(;s<a;s++){const n=e.charCodeAt(s+1);if(n!==t.charCodeAt(r+s))break;47===n&&(i=s)}if(o>a){if(47===t.charCodeAt(r+s))return t.slice(r+s+1);if(0===s)return t.slice(r+s)}n>a&&(47===e.charCodeAt(s+1)?i=s:0===a&&(i=0));let c="";for(s=i+2;s<=e.length;++s)s!==e.length&&47!==e.charCodeAt(s)||(c+=0===c.length?"..":"/..");return r+=i,c.length>0?`${c}${t.slice(r,t.length)}`:(47===t.charCodeAt(r)&&++r,t.slice(r,t.length))}};const l=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(m)},u=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:u(e,b(t,o,n),r,h(o,n))}}if(Array.isArray(t)){const n=[...t];return n[v(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:b(t,e[0],n)},d=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||w(t)){const o=e.shift();d(e,b(t,o,n),r,h(o,n))}else{t[v(t,e[0])]=r}},f=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=b(t,n,r);return{...t,[n]:f(e,o,h(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 b(t,e[0],r)}},p=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=b(t,n,r);p(e,o,h(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:b(t,e[0],r)},h=t(((e,t)=>t+"/"+y(e))),y=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),m=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),v=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,b=(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(w(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[v(e,t)]},w=e=>null===e||"object"!=typeof e;var g={nil:"",append:h,get:(e,t)=>{const r=l(e),n=e=>r.reduce((([e,t],r)=>[b(e,r,t),h(r,t)]),[e,""])[0];return void 0===t?n:n(t)},set:(e,r,n)=>{const o=l(e),a=t(((e,t)=>u(o,e,t,"")));return void 0===r?a:a(r,n)},assign:(e,r,n)=>{const o=l(e),a=t(((e,t)=>d(o,e,t,"")));return void 0===r?a:a(r,n)},unset:(e,t)=>{const r=l(e),n=e=>f(r,e,"");return void 0===t?n:n(t)},remove:(e,t)=>{const r=l(e),n=e=>p(r,e,"");return void 0===t?n:n(t)}};g.nil,g.append,g.get,g.set,g.assign,g.unset,g.remove;const O=Symbol("$__value"),E=Symbol("$__href");var $={cons:(e,t)=>Object.freeze({[E]:e,[O]:t}),isReference:e=>e&&void 0!==e[E],href:e=>e[E],value:e=>e[O]};const{jsonTypeOf:j}=c,S=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),A=e=>$.isReference(e.value)?$.value(e.value):e.value,T=t(((e,t)=>j(A(e),t))),I=(e,t)=>Object.freeze({...t,pointer:g.append(e,t.pointer),value:A(t)[e]}),k=t(((e,t)=>A(t).map(((r,n,o,a)=>e(I(n,t),n,o,a))))),V=t(((e,t)=>A(t).map(((e,r,n,o)=>I(r,t))).filter(((t,r,n,o)=>e(t,r,n,o))))),x=t(((e,t,r)=>A(r).reduce(((t,n,o)=>e(t,I(o,r),o)),t))),P=t(((e,t)=>A(t).every(((r,n,o,a)=>e(I(n,t),n,o,a))))),R=t(((e,t)=>A(t).some(((r,n,o,a)=>e(I(n,t),n,o,a)))));var C={nil:S,cons:(e,t="")=>Object.freeze({...S,id:t,instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:A,has:(e,t)=>e in A(t),typeOf:T,step:I,entries:e=>Object.keys(A(e)).map((t=>[t,I(t,e)])),keys:e=>Object.keys(A(e)),map:k,filter:V,reduce:x,every:P,some:R,length:e=>A(e).length},U=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,K=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,L=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,z=/\\([\u000b\u0020-\u00ff])/g,D=/([\\"])/g,_=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function N(e){var t=String(e);if(L.test(t))return t;if(t.length>0&&!K.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(D,"\\$1")+'"'}function q(e){this.parameters=Object.create(null),this.type=e}var B={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!_.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],!L.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+N(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(!_.test(n))throw new TypeError("invalid media type");var o=new q(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(z,"$1")),o.parameters[a]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},F=async e=>Object.entries(await e),J=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))),M=t((async(e,t,r={})=>Z((async(t,r)=>await e(r)?t.concat([r]):t),[],t,r))),W=t((async(e,t)=>{const r=await J(e,t);return(await Promise.all(r)).some((e=>e))})),G=t((async(e,t)=>{const r=await J(e,t);return(await Promise.all(r)).every((e=>e))})),H=t(((e,t)=>e.reduce((async(e,t)=>t(await e)),t))),Q={entries:F,map:J,filter:M,reduce:Z,some:W,every:G,pipeline:H,all:e=>Promise.all(e),allValues:e=>H([F,Z((async(e,[t,r])=>(e[t]=await r,e)),{})],e)};Q.entries,Q.map,Q.filter,Q.reduce,Q.some,Q.every,Q.pipeline,Q.all,Q.allValues;var X=fetch;const{jsonTypeOf:Y,splitUrl:ee,safeResolveUrl:te,pathRelative:re}=c,ne={},oe={},ae=(e,t)=>{const r=e in oe?oe[e]:e;if(r in ne)return ne[r][t]},ie={},se={},ce=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=ee(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=ae(n,"baseToken"),a=ae(n,"anchorToken"),i=ee(t)[0];if(!i&&!ee(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const s=te(i,e[o]||""),[c,l]=ee(s);delete e[o],l&&o===a&&(e[a]=a!==o?encodeURI(l):`#${encodeURI(l)}`),i&&(se[i]=c);const u={},d=ae(n,"recursiveAnchorToken");let f;!0===e[d]&&(u[""]=`${c}#`,e[a]="",delete e[d]);const p=ae(n,"vocabularyToken");Y(e[p],"object")?(oe[c]=n,f=e[p],delete e[p]):(oe[c]=n,f={[n]:!0});const h={"":""};return ie[c]={id:c,schemaVersion:n,schema:le(e,c,n,g.nil,h,u),anchors:h,dynamicAnchors:u,vocabulary:f,validated:!1},c},le=(e,t,r,n,o,a)=>{if(Y(e,"object")){const i="string"==typeof e.$schema?ee(e.$schema)[0]:r,s=ae(i,"embeddedToken"),c=ae(i,"anchorToken");if("string"==typeof e[s]&&(s!==c||"#"!==e[s][0])){const n=te(t,e[s]);return e[s]=n,ce(e,n,r),$.cons(e[s],e)}const l=ae(r,"anchorToken"),u=ae(r,"dynamicAnchorToken");"string"==typeof e[u]&&(a[e[u]]=`${t}#${encodeURI(n)}`,o[e[u]]=n,delete e[u]);const d=ae(r,"embeddedToken");if("string"==typeof e[l]){const t=l!==d?e[l]:e[l].slice(1);o[t]=n,delete e[l]}const f=ae(r,"jrefToken");if("string"==typeof e[f])return $.cons(e[f],e);for(const i in e)e[i]=le(e[i],t,r,g.append(i,n),o,a);return e}return Array.isArray(e)?e.map(((e,i)=>le(e,t,r,g.append(i,n),o,a))):e},ue=e=>ie[se[e]]||ie[e],de=Object.freeze({id:"",schemaVersion:void 0,vocabulary:{},pointer:g.nil,schema:void 0,value:void 0,anchors:{},dynamicAnchors:{},validated:!0}),fe=async(e,t=de)=>{const r=te(ye(t),e),[n,o]=ee(r);if(!(e=>e in ie||e in se)(n)){const e=await X(n,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error(`Failed to retrieve schema with id: ${n}`);if(e.headers.has("content-type")){const t=B.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${n} is not a schema. Found a document with media type: ${t}`)}ce(await e.json(),n)}const a=ue(n),i="/"!==o[0]?he(a,o):o,s=Object.freeze({...a,pointer:i,value:g.get(i,a.schema)});return pe(s)},pe=e=>$.isReference(e.value)?fe($.href(e.value),e):e,he=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},ye=e=>`${e.id}#${encodeURI(e.pointer)}`,me=e=>$.isReference(e.value)?$.value(e.value):e.value,ve=(e,t)=>{const r=ue(t.id),n=Object.freeze({...t,pointer:g.append(e,t.pointer),value:me(t)[e],validated:r.validated});return pe(n)},be=t(((e,t)=>Q.pipeline([me,Q.map((async(r,n)=>e(await ve(n,t),n))),Q.all],t))),we={parentId:"",parentDialect:"",includeEmbedded:!0},ge=(e,t)=>{if(t.startsWith("file://")){const r=e.slice(7,e.lastIndexOf("/"));return""===e?"":re(r,t.slice(7))}return t};var Oe={setConfig:(e,t,r)=>{ne[e]||(ne[e]={}),ne[e][t]=r},getConfig:ae,add:ce,get:fe,markValidated:e=>{ie[e].validated=!0},uri:ye,value:me,getAnchorPointer:he,typeOf:(e,t)=>Y(me(e),t),has:(e,t)=>e in me(t),step:ve,keys:e=>Object.keys(me(e)),entries:e=>Q.pipeline([me,Object.keys,Q.map((async t=>[t,await ve(t,e)])),Q.all],e),map:be,length:e=>me(e).length,toSchema:(e,t={})=>{const r={...we,...t},n=JSON.parse(JSON.stringify(e.schema,((t,n)=>{if(!$.isReference(n))return n;const o=$.value(n),a=o.$schema||e.schemaVersion,i=ae(a,"embeddedToken");return!r.includeEmbedded&&i in o?void 0:$.value(n)}))),o=ae(e.schemaVersion,"dynamicAnchorToken");Object.entries(e.dynamicAnchors).forEach((([e,t])=>{const r=ee(t)[1];g.assign(r,n,{[o]:e,...g.get(r,n)})}));const a=ae(e.schemaVersion,"anchorToken");Object.entries(e.anchors).filter((([e])=>""!==e)).forEach((([e,t])=>{g.assign(t,n,{[a]:e,...g.get(t,n)})}));const i=ae(e.schemaVersion,"baseToken"),s=ge(r.parentId,e.id),c=r.parentDialect===e.schemaVersion?"":e.schemaVersion;return{...s&&{[i]:s},...c&&{$schema:c},...n}}};Oe.setConfig,Oe.getConfig,Oe.add,Oe.get,Oe.markValidated,Oe.uri,Oe.value,Oe.getAnchorPointer,Oe.typeOf,Oe.has,Oe.step,Oe.keys,Oe.entries,Oe.map,Oe.length,Oe.toSchema;class Ee extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var $e=Ee;const{splitUrl:je}=c,Se="FLAG",Ae="BASIC",Te="DETAILED",Ie="VERBOSE";let ke=Te,Ve=!0;const xe=async e=>{const t={metaData:{}};return{ast:t,schemaUri:await De(e,t)}},Pe=t((({ast:e,schemaUri:t},r,n=Se)=>{if(![Se,Ae,Te,Ie].includes(n))throw Error(`The '${n}' error format is not supported`);const a=[],i=o.subscribe("result",Re(n,a));return Ne(t,r,e,{}),o.unsubscribe(i),a[0]})),Re=(e,t)=>{const r=[];return(n,o)=>{if("result"===n){const{keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:a}=o,i={keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:a,errors:[]};r.push(i)}else if("result.start"===n)r.push(n);else if("result.end"===n){const n=r.pop();for(;"result.start"!==r[r.length-1];){const t=r.pop(),o=[t];e===Ae&&(o.push(...t.errors),delete t.errors),(e===Ie||e!==Se&&!t.valid)&&n.errors.unshift(...o)}r[r.length-1]=n,t[0]=n}}},Ce={},Ue=e=>Ce[e],Ke=e=>e in Ce,Le={},ze={},De=async(e,t)=>{if(e=await _e(e),!Ke(`${e.schemaVersion}#validate`)){const t=await Oe.get(e.schemaVersion);(Oe.getConfig(t.id,"mandatoryVocabularies")||[]).forEach((e=>{if(!t.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)})),Object.entries(t.vocabulary).forEach((([e,r])=>{if(e in Le)Object.entries(Le[e]).forEach((([e,r])=>{((e,t)=>{Ce[e]={collectEvaluatedItems:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&new Set,collectEvaluatedProperties:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&[],...t}})(`${t.id}#${e}`,r)}));else if(r)throw Error(`Missing required vocabulary: ${e}`)}))}if(Ve&&!e.validated){if(Oe.markValidated(e.id),!(e.schemaVersion in ze)){const t=await Oe.get(e.schemaVersion),r=await xe(t);ze[t.id]=Pe(r)}const t=C.cons(e.schema,e.id),r=ze[e.schemaVersion](t,ke);if(!r.valid)throw new $e(r)}return e.id in t.metaData||(t.metaData[e.id]={id:e.id,dynamicAnchors:e.dynamicAnchors,anchors:e.anchors}),Ue(`${e.schemaVersion}#validate`).compile(e,t)},_e=async e=>Oe.typeOf(e,"string")?_e(await Oe.get(Oe.value(e),e)):e,Ne=(e,t,r,n)=>{const o=qe(e,r),a=je(e)[0];return Ue(o).interpret(e,t,r,{...r.metaData[a].dynamicAnchors,...n})},qe=(e,t)=>{if(!(e in t))throw Error(`No schema found at ${e}`);return t[e][0]};var Be={validate:async(e,t,r)=>{const n=await xe(e),o=(e,t)=>Pe(n,C.cons(e),t);return void 0===t?o:o(t,r)},compile:xe,interpret:Pe,setMetaOutputFormat:e=>{ke=e},setShouldMetaValidate:e=>{Ve=e},FLAG:Se,BASIC:Ae,DETAILED:Te,VERBOSE:Ie,add:(e,t="",r="")=>{const n=Oe.add(e,t,r);delete ze[n]},getKeyword:Ue,hasKeyword:Ke,defineVocabulary:(e,t)=>{Le[e]=t},compileSchema:De,interpretSchema:Ne,collectEvaluatedProperties:(e,t,r,n,o)=>{const a=qe(e,r);return Ue(a).collectEvaluatedProperties(e,t,r,n,o)},collectEvaluatedItems:(e,t,r,n,o)=>{const a=qe(e,r);return Ue(a).collectEvaluatedItems(e,t,r,n,o)}};var Fe={compile:e=>Oe.value(e),interpret:()=>!0};var Je={compile:async(e,t)=>{const r=Oe.uri(e);if(!(r in t)){t[r]=!1;const n=Oe.value(e);if(!["object","boolean"].includes(typeof n))throw Error(`No schema found at '${Oe.uri(e)}'`);t[r]=[`${e.schemaVersion}#validate`,Oe.uri(e),"boolean"==typeof n?n:await Q.pipeline([Oe.entries,Q.map((([t,r])=>[`${e.schemaVersion}#${t}`,r])),Q.filter((([t])=>Be.hasKeyword(t)&&t!==`${e.schemaVersion}#validate`)),Q.map((async([r,n])=>{const o=await Be.getKeyword(r).compile(n,t,e);return[r,Oe.uri(n),o]})),Q.all],e)]}return r},interpret:(e,t,r,n)=>{const[a,i,s]=r[e];o.publishSync("result.start");const c="boolean"==typeof s?s:s.every((([e,a,i])=>{o.publishSync("result.start");const s=Be.getKeyword(e).interpret(i,t,r,n);return o.publishSync("result",{keyword:e,absoluteKeywordLocation:a,instanceLocation:C.uri(t),valid:s,ast:i}),o.publishSync("result.end"),s}));return o.publishSync("result",{keyword:a,absoluteKeywordLocation:i,instanceLocation:C.uri(t),valid:c,ast:e}),o.publishSync("result.end"),c},collectEvaluatedProperties:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&[]:a.filter((([e])=>!o||!e.endsWith("#unevaluatedProperties"))).reduce(((e,[o,,a])=>{const i=e&&Be.getKeyword(o).collectEvaluatedProperties(a,t,r,n);return!1!==i&&[...e,...i]}),[])},collectEvaluatedItems:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&new Set:a.filter((([e])=>!o||!e.endsWith("#unevaluatedItems"))).reduce(((e,[o,,a])=>{const i=!1!==e&&Be.getKeyword(o).collectEvaluatedItems(a,t,r,n);return!1!==i&&new Set([...e,...i])}),new Set)}},Ze={metaData:Fe,validate:Je},Me={Core:Be,Schema:Oe,Instance:C,Reference:$,Keywords:Ze,InvalidSchemaError:$e},We=Me.Core,Ge=Me.Schema,He=Me.Instance,Qe=Me.Reference,Xe=Me.Keywords,Ye=Me.InvalidSchemaError;export{We as Core,He as Instance,Ye as InvalidSchemaError,Xe as Keywords,Qe as Reference,Ge as Schema,Me as default}; | ||
//# sourceMappingURL=json-schema-core-esm.min.js.map |
@@ -1,4 +0,8 @@ | ||
var JSC = (function (exports) { | ||
var JSC = (function (exports, urlResolveBrowser) { | ||
'use strict'; | ||
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } | ||
var urlResolveBrowser__default = /*#__PURE__*/_interopDefaultLegacy(urlResolveBrowser); | ||
var justCurryIt = curry; | ||
@@ -400,213 +404,2 @@ | ||
var urlResolveBrowser = urlResolve; | ||
/* | ||
The majority of the module is built by following RFC1808 | ||
url: https://tools.ietf.org/html/rfc1808 | ||
*/ | ||
// adds a slash at end if not present | ||
function _addSlash (url) { | ||
return url + (url[url.length-1] === '/' ? '' : '/'); | ||
} | ||
// resolve the ..'s (directory up) and such | ||
function _pathResolve (path) { | ||
let pathSplit = path.split('/'); | ||
// happens when path starts with / | ||
if (pathSplit[0] === '') { | ||
pathSplit = pathSplit.slice(1); | ||
} | ||
// let segmentCount = 0; // number of segments that have been passed | ||
let resultArray = []; | ||
pathSplit.forEach((current, index) => { | ||
// skip occurances of '.' | ||
if (current !== '.') { | ||
if (current === '..') { | ||
resultArray.pop(); // remove previous | ||
} else if (current !== '' || index === pathSplit.length - 1) { | ||
resultArray.push(current); | ||
} | ||
} | ||
}); | ||
return '/' + resultArray.join('/'); | ||
} | ||
// parses a base url string into an object containing host, path and query | ||
function _baseParse (base) { | ||
const resultObject = { | ||
host: '', | ||
path: '', | ||
query: '', | ||
protocol: '' | ||
}; | ||
let path = base; | ||
let protocolEndIndex = base.indexOf('//'); | ||
resultObject.protocol = path.substring(0, protocolEndIndex); | ||
protocolEndIndex += 2; // add two to pass double slash | ||
const pathIndex = base.indexOf('/', protocolEndIndex); | ||
const queryIndex = base.indexOf('?'); | ||
const hashIndex = base.indexOf('#'); | ||
if (hashIndex !== -1) { | ||
path = path.substring(0, hashIndex); // remove hash, not needed for base | ||
} | ||
if (queryIndex !== -1) { | ||
const query = path.substring(queryIndex); // remove query, save in return obj | ||
resultObject.query = query; | ||
path = path.substring(0, queryIndex); | ||
} | ||
if (pathIndex !== -1) { | ||
const host = path.substring(0, pathIndex); // separate host & path | ||
resultObject.host = host; | ||
path = path.substring(pathIndex); | ||
resultObject.path = path; | ||
} else { | ||
resultObject.host = path; // there was no path, therefore path is host | ||
} | ||
return resultObject; | ||
} | ||
// https://tools.ietf.org/html/rfc3986#section-3.1 | ||
const _scheme = '[a-z][a-z0-9+.-]*'; // ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )] | ||
const _isAbsolute = new RegExp(`^(${_scheme}:)?//`, 'i'); | ||
// parses a relative url string into an object containing the href, | ||
// hash, query and whether it is a net path, absolute path or relative path | ||
function _relativeParse (relative) { | ||
const resultObject = { | ||
href: relative, // href is always what was passed through | ||
hash: '', | ||
query: '', | ||
netPath: false, | ||
absolutePath: false, | ||
relativePath: false | ||
}; | ||
// check for protocol | ||
// if protocol exists, is net path (absolute URL) | ||
if (_isAbsolute.test(relative)) { | ||
resultObject.netPath = true; | ||
// return, in this case the relative is the resolved url, no need to parse. | ||
return resultObject; | ||
} | ||
// if / is first, this is an absolute path, | ||
// I.E. it overwrites the base URL's path | ||
if (relative[0] === '/') { | ||
resultObject.absolutePath = true; | ||
// return resultObject | ||
} else if (relative !== '') { | ||
resultObject.relativePath = true; | ||
} | ||
let path = relative; | ||
const queryIndex = relative.indexOf('?'); | ||
const hashIndex = relative.indexOf('#'); | ||
if (hashIndex !== -1) { | ||
const hash = path.substring(hashIndex); | ||
resultObject.hash = hash; | ||
path = path.substring(0, hashIndex); | ||
} | ||
if (queryIndex !== -1) { | ||
const query = path.substring(queryIndex); | ||
resultObject.query = query; | ||
path = path.substring(0, queryIndex); | ||
} | ||
resultObject.path = path; // whatever is left is path | ||
return resultObject; | ||
} | ||
function _shouldAddSlash (url) { | ||
const protocolIndex = url.indexOf('//') + 2; | ||
const noPath = !(url.includes('/', protocolIndex)); | ||
const noQuery = !(url.includes('?', protocolIndex)); | ||
const noHash = !(url.includes('#', protocolIndex)); | ||
return (noPath && noQuery && noHash); | ||
} | ||
function _shouldAddProtocol (url) { | ||
return url.startsWith('//'); | ||
} | ||
/* | ||
* PRECONDITION: Base is a fully qualified URL. e.g. http://example.com/ | ||
* optional: path, query or hash | ||
* returns the resolved url | ||
*/ | ||
function urlResolve (base, relative) { | ||
base = base.trim(); | ||
relative = relative.trim(); | ||
// about is always absolute | ||
if (relative.startsWith('about:')) { | ||
return relative; | ||
} | ||
const baseObj = _baseParse(base); | ||
const relativeObj = _relativeParse(relative); | ||
if (!baseObj.protocol && !relativeObj.netPath) { | ||
throw new Error('Error, protocol is not specified'); | ||
} | ||
if (relativeObj.netPath) { // relative is full qualified URL | ||
if (_shouldAddProtocol(relativeObj.href)) { | ||
relativeObj.href = baseObj.protocol + relativeObj.href; | ||
} | ||
if (_shouldAddSlash(relativeObj.href)) { | ||
return _addSlash(relativeObj.href); | ||
} | ||
return relativeObj.href; | ||
} else if (relativeObj.absolutePath) { // relative is an absolute path | ||
const {path, query, hash} = relativeObj; | ||
return baseObj.host + _pathResolve(path) + query + hash; | ||
} else if (relativeObj.relativePath) { // relative is a relative path | ||
const {path, query, hash} = relativeObj; | ||
let basePath = baseObj.path; | ||
let resultString = baseObj.host; | ||
let resolvePath; | ||
if (path.length === 0) { | ||
resolvePath = basePath; | ||
} else { | ||
// remove last segment if no slash at end | ||
basePath = basePath.substring(0, basePath.lastIndexOf('/')); | ||
resolvePath = _pathResolve(basePath + '/' + path); | ||
} | ||
// if result is just the base host, add / | ||
if ((resolvePath === '') && (!query) && (!hash)) { | ||
resultString += '/'; | ||
} else { | ||
resultString += resolvePath + query + hash; | ||
} | ||
return resultString; | ||
} else { | ||
const {host, path, query} = baseObj; | ||
// when path and query aren't supplied add slash | ||
if ((!path) && (!query)) { | ||
return _addSlash(host); | ||
} | ||
return host + path + query + relativeObj.hash; | ||
} | ||
} | ||
const isObject = (value) => typeof value === "object" && !Array.isArray(value) && value !== null; | ||
@@ -639,3 +432,3 @@ const isType = { | ||
const safeResolveUrl$1 = (contextUrl, url) => { | ||
const resolvedUrl = urlResolveBrowser(contextUrl, url); | ||
const resolvedUrl = urlResolveBrowser__default["default"](contextUrl, url); | ||
const contextId = splitUrl$2(contextUrl)[0]; | ||
@@ -1879,3 +1672,3 @@ if (contextId && getScheme(resolvedUrl) === "file" && getScheme(contextId) !== "file") { | ||
})({}); | ||
})({}, urlResolveBrowser); | ||
//# sourceMappingURL=json-schema-core-iife.js.map |
@@ -1,2 +0,2 @@ | ||
var JSC=function(e){"use strict";var t=function(e,t){return function r(){null==t&&(t=e.length);var n=[].slice.call(arguments);return n.length>=t?e.apply(this,n):function(){return r.apply(this,n.concat([].slice.call(arguments)))}}};var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var n,o=(function(e,t){var n,o;n="object"==typeof window&&window||r,o={},n.PubSub=o,function(e){var t={},r=-1,n="*";function o(e){var t;for(t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function a(e){return function(){throw e}}function i(e,t,r){try{e(t,r)}catch(e){setTimeout(a(e),0)}}function s(e,t,r){e(t,r)}function c(e,r,n,o){var a,c=t[r],l=o?s:i;if(Object.prototype.hasOwnProperty.call(t,r))for(a in c)Object.prototype.hasOwnProperty.call(c,a)&&l(c[a],e,n)}function l(e,t,r){return function(){var o=String(e),a=o.lastIndexOf(".");for(c(e,e,t,r);-1!==a;)a=(o=o.substr(0,a)).lastIndexOf("."),c(e,o,t,r);c(e,n,t,r)}}function u(e){var r=String(e);return Boolean(Object.prototype.hasOwnProperty.call(t,r)&&o(t[r]))}function f(e){for(var t=String(e),r=u(t)||u(n),o=t.lastIndexOf(".");!r&&-1!==o;)o=(t=t.substr(0,o)).lastIndexOf("."),r=u(t);return r}function d(e,t,r,n){var o=l(e="symbol"==typeof e?e.toString():e,t,n);return!!f(e)&&(!0===r?o():setTimeout(o,0),!0)}e.publish=function(t,r){return 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,Object.prototype.hasOwnProperty.call(t,e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeAll=function(t){return e.subscribe(n,t)},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n,o=0;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)){for(n in t[r])o++;break}return o},e.getSubscriptions=function(e){var r,n=[];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,a,i=function(e){var r;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e))return!0;return!1},s="string"==typeof r&&(Object.prototype.hasOwnProperty.call(t,r)||i(r)),c=!s&&"string"==typeof r,l="function"==typeof r,u=!1;if(!s){for(n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(o=t[n],c&&o[r]){delete o[r],u=r;break}if(l)for(a in o)Object.prototype.hasOwnProperty.call(o,a)&&o[a]===r&&(delete o[a],u=!0)}return u}e.clearSubscriptions(r)}}(o),void 0!==e&&e.exports&&(t=e.exports=o),t.PubSub=o,e.exports=t=o}(n={exports:{}},n.exports),n.exports);o.PubSub;var a=function(e,t){if(e=e.trim(),(t=t.trim()).startsWith("about:"))return t;const r=function(e){const t={host:"",path:"",query:"",protocol:""};let r=e,n=e.indexOf("//");t.protocol=r.substring(0,n),n+=2;const o=e.indexOf("/",n),a=e.indexOf("?"),i=e.indexOf("#");-1!==i&&(r=r.substring(0,i));if(-1!==a){const e=r.substring(a);t.query=e,r=r.substring(0,a)}if(-1!==o){const e=r.substring(0,o);t.host=e,r=r.substring(o),t.path=r}else t.host=r;return t}(e),n=function(e){const t={href:e,hash:"",query:"",netPath:!1,absolutePath:!1,relativePath:!1};if(c.test(e))return t.netPath=!0,t;"/"===e[0]?t.absolutePath=!0:""!==e&&(t.relativePath=!0);let r=e;const n=e.indexOf("?"),o=e.indexOf("#");if(-1!==o){const e=r.substring(o);t.hash=e,r=r.substring(0,o)}if(-1!==n){const e=r.substring(n);t.query=e,r=r.substring(0,n)}return t.path=r,t}(t);if(!r.protocol&&!n.netPath)throw new Error("Error, protocol is not specified");if(n.netPath)return n.href.startsWith("//")&&(n.href=r.protocol+n.href),function(e){const t=e.indexOf("//")+2,r=!e.includes("/",t),n=!e.includes("?",t),o=!e.includes("#",t);return r&&n&&o}(n.href)?i(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+s(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let a,i=r.path,c=r.host;return 0===e.length?a=i:(i=i.substring(0,i.lastIndexOf("/")),a=s(i+"/"+e)),c+=""!==a||t||o?a+t+o:"/",c}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:i(e)}};function i(e){return e+("/"===e[e.length-1]?"":"/")}function s(e){let t=e.split("/");""===t[0]&&(t=t.slice(1));let r=[];return t.forEach(((e,n)=>{"."!==e&&(".."===e?r.pop():""===e&&n!==t.length-1||r.push(e))})),"/"+r.join("/")}const c=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");const l={null:e=>null===e,boolean:e=>"boolean"==typeof e,object:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,array:e=>Array.isArray(e),number:e=>"number"==typeof e,integer:e=>Number.isInteger(e),string:e=>"string"==typeof e},u=e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),o=e.slice(r+1);return[decodeURI(n),decodeURI(o)]},f=e=>{const t=RegExp(/^(.+):\/\//).exec(e);return t?t[1]:""};var d={jsonTypeOf:(e,t)=>l[t](e),splitUrl:u,safeResolveUrl:(e,t)=>{const r=a(e,t),n=u(e)[0];if(n&&"file"===f(r)&&"file"!==f(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},pathRelative:(e,t)=>{if(e===t)return"";let r=1;const n=e.length-1,o=t.length-r,a=n<o?n:o;let i=-1,s=0;for(;s<a;s++){const n=e.charCodeAt(s+1);if(n!==t.charCodeAt(r+s))break;47===n&&(i=s)}if(o>a){if(47===t.charCodeAt(r+s))return t.slice(r+s+1);if(0===s)return t.slice(r+s)}n>a&&(47===e.charCodeAt(s+1)?i=s:0===a&&(i=0));let c="";for(s=i+2;s<=e.length;++s)s!==e.length&&47!==e.charCodeAt(s)||(c+=0===c.length?"..":"/..");return r+=i,c.length>0?`${c}${t.slice(r,t.length)}`:(47===t.charCodeAt(r)&&++r,t.slice(r,t.length))}};const p=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(w)},h=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:h(e,E(t,o,n),r,b(o,n))}}if(Array.isArray(t)){const n=[...t];return n[O(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:E(t,e[0],n)},y=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||j(t)){const o=e.shift();y(e,E(t,o,n),r,b(o,n))}else{t[O(t,e[0])]=r}},m=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=E(t,n,r);return{...t,[n]:m(e,o,b(n,r))}}if(Array.isArray(t))return t.filter(((t,r)=>r!=e[0]));if("object"==typeof t&&null!==t){const{[e[0]]:r,...n}=t;return n}return E(t,e[0],r)}},v=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=E(t,n,r);v(e,o,b(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:E(t,e[0],r)},b=t(((e,t)=>t+"/"+g(e))),g=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),w=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),O=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,E=(e,t,r="")=>{if(void 0===e)throw TypeError(`Value at '${r}' is undefined and does not have property '${t}'`);if(null===e)throw TypeError(`Value at '${r}' is null and does not have property '${t}'`);if(j(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[O(e,t)]},j=e=>null===e||"object"!=typeof e;var $={nil:"",append:b,get:(e,t)=>{const r=p(e),n=e=>r.reduce((([e,t],r)=>[E(e,r,t),b(r,t)]),[e,""])[0];return void 0===t?n:n(t)},set:(e,r,n)=>{const o=p(e),a=t(((e,t)=>h(o,e,t,"")));return void 0===r?a:a(r,n)},assign:(e,r,n)=>{const o=p(e),a=t(((e,t)=>y(o,e,t,"")));return void 0===r?a:a(r,n)},unset:(e,t)=>{const r=p(e),n=e=>m(r,e,"");return void 0===t?n:n(t)},remove:(e,t)=>{const r=p(e),n=e=>v(r,e,"");return void 0===t?n:n(t)}};$.nil,$.append,$.get,$.set,$.assign,$.unset,$.remove;const S=Symbol("$__value"),A=Symbol("$__href");var P={cons:(e,t)=>Object.freeze({[A]:e,[S]:t}),isReference:e=>e&&void 0!==e[A],href:e=>e[A],value:e=>e[S]};const{jsonTypeOf:x}=d,I=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),T=e=>P.isReference(e.value)?P.value(e.value):e.value,k=t(((e,t)=>x(T(e),t))),V=(e,t)=>Object.freeze({...t,pointer:$.append(e,t.pointer),value:T(t)[e]}),R=t(((e,t)=>T(t).map(((r,n,o,a)=>e(V(n,t),n,o,a))))),C=t(((e,t)=>T(t).map(((e,r,n,o)=>V(r,t))).filter(((t,r,n,o)=>e(t,r,n,o))))),U=t(((e,t,r)=>T(r).reduce(((t,n,o)=>e(t,V(o,r),o)),t))),z=t(((e,t)=>T(t).every(((r,n,o,a)=>e(V(n,t),n,o,a))))),K=t(((e,t)=>T(t).some(((r,n,o,a)=>e(V(n,t),n,o,a)))));var L={nil:I,cons:(e,t="")=>Object.freeze({...I,id:t,instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:T,has:(e,t)=>e in T(t),typeOf:k,step:V,entries:e=>Object.keys(T(e)).map((t=>[t,V(t,e)])),keys:e=>Object.keys(T(e)),map:R,filter:C,reduce:U,every:z,some:K,length:e=>T(e).length},q=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,_=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,D=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,N=/\\([\u000b\u0020-\u00ff])/g,J=/([\\"])/g,B=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function F(e){var t=String(e);if(D.test(t))return t;if(t.length>0&&!_.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(J,"\\$1")+'"'}function W(e){this.parameters=Object.create(null),this.type=e}var Z={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!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],!D.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 W(n.toLowerCase());if(-1!==r){var a,i,s;for(q.lastIndex=r;i=q.exec(t);){if(i.index!==r)throw new TypeError("invalid parameter format");r+=i[0].length,a=i[1].toLowerCase(),'"'===(s=i[2])[0]&&(s=s.substr(1,s.length-2).replace(N,"$1")),o.parameters[a]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},M=async e=>Object.entries(await e),G=t((async(e,t)=>(await t).map(e))),H=t((async(e,t,r)=>(await r).reduce((async(t,r)=>e(await t,r)),t))),Q=t((async(e,t,r={})=>H((async(t,r)=>await e(r)?t.concat([r]):t),[],t,r))),X=t((async(e,t)=>{const r=await G(e,t);return(await Promise.all(r)).some((e=>e))})),Y=t((async(e,t)=>{const r=await G(e,t);return(await Promise.all(r)).every((e=>e))})),ee=t(((e,t)=>e.reduce((async(e,t)=>t(await e)),t))),te={entries:M,map:G,filter:Q,reduce:H,some:X,every:Y,pipeline:ee,all:e=>Promise.all(e),allValues:e=>ee([M,H((async(e,[t,r])=>(e[t]=await r,e)),{})],e)};te.entries,te.map,te.filter,te.reduce,te.some,te.every,te.pipeline,te.all,te.allValues;var re=fetch;const{jsonTypeOf:ne,splitUrl:oe,safeResolveUrl:ae,pathRelative:ie}=d,se={},ce={},le=(e,t)=>{const r=e in ce?ce[e]:e;if(r in se)return se[r][t]},ue={},fe={},de=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=oe(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=le(n,"baseToken"),a=le(n,"anchorToken"),i=oe(t)[0];if(!i&&!oe(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const s=ae(i,e[o]||""),[c,l]=oe(s);delete e[o],l&&o===a&&(e[a]=a!==o?encodeURI(l):`#${encodeURI(l)}`),i&&(fe[i]=c);const u={},f=le(n,"recursiveAnchorToken");let d;!0===e[f]&&(u[""]=`${c}#`,e[a]="",delete e[f]);const p=le(n,"vocabularyToken");ne(e[p],"object")?(ce[c]=n,d=e[p],delete e[p]):(ce[c]=n,d={[n]:!0});const h={"":""};return ue[c]={id:c,schemaVersion:n,schema:pe(e,c,n,$.nil,h,u),anchors:h,dynamicAnchors:u,vocabulary:d,validated:!1},c},pe=(e,t,r,n,o,a)=>{if(ne(e,"object")){const i="string"==typeof e.$schema?oe(e.$schema)[0]:r,s=le(i,"embeddedToken"),c=le(i,"anchorToken");if("string"==typeof e[s]&&(s!==c||"#"!==e[s][0])){const n=ae(t,e[s]);return e[s]=n,de(e,n,r),P.cons(e[s],e)}const l=le(r,"anchorToken"),u=le(r,"dynamicAnchorToken");"string"==typeof e[u]&&(a[e[u]]=`${t}#${encodeURI(n)}`,o[e[u]]=n,delete e[u]);const f=le(r,"embeddedToken");if("string"==typeof e[l]){const t=l!==f?e[l]:e[l].slice(1);o[t]=n,delete e[l]}const d=le(r,"jrefToken");if("string"==typeof e[d])return P.cons(e[d],e);for(const i in e)e[i]=pe(e[i],t,r,$.append(i,n),o,a);return e}return Array.isArray(e)?e.map(((e,i)=>pe(e,t,r,$.append(i,n),o,a))):e},he=e=>ue[fe[e]]||ue[e],ye=Object.freeze({id:"",schemaVersion:void 0,vocabulary:{},pointer:$.nil,schema:void 0,value:void 0,anchors:{},dynamicAnchors:{},validated:!0}),me=async(e,t=ye)=>{const r=ae(ge(t),e),[n,o]=oe(r);if(!(e=>e in ue||e in fe)(n)){const e=await re(n,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error(`Failed to retrieve schema with id: ${n}`);if(e.headers.has("content-type")){const t=Z.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${n} is not a schema. Found a document with media type: ${t}`)}de(await e.json(),n)}const a=he(n),i="/"!==o[0]?be(a,o):o,s=Object.freeze({...a,pointer:i,value:$.get(i,a.schema)});return ve(s)},ve=e=>P.isReference(e.value)?me(P.href(e.value),e):e,be=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},ge=e=>`${e.id}#${encodeURI(e.pointer)}`,we=e=>P.isReference(e.value)?P.value(e.value):e.value,Oe=(e,t)=>{const r=he(t.id),n=Object.freeze({...t,pointer:$.append(e,t.pointer),value:we(t)[e],validated:r.validated});return ve(n)},Ee=t(((e,t)=>te.pipeline([we,te.map((async(r,n)=>e(await Oe(n,t),n))),te.all],t))),je={parentId:"",parentDialect:"",includeEmbedded:!0},$e=(e,t)=>{if(t.startsWith("file://")){const r=e.slice(7,e.lastIndexOf("/"));return""===e?"":ie(r,t.slice(7))}return t};var Se={setConfig:(e,t,r)=>{se[e]||(se[e]={}),se[e][t]=r},getConfig:le,add:de,get:me,markValidated:e=>{ue[e].validated=!0},uri:ge,value:we,getAnchorPointer:be,typeOf:(e,t)=>ne(we(e),t),has:(e,t)=>e in we(t),step:Oe,keys:e=>Object.keys(we(e)),entries:e=>te.pipeline([we,Object.keys,te.map((async t=>[t,await Oe(t,e)])),te.all],e),map:Ee,length:e=>we(e).length,toSchema:(e,t={})=>{const r={...je,...t},n=JSON.parse(JSON.stringify(e.schema,((t,n)=>{if(!P.isReference(n))return n;const o=P.value(n),a=o.$schema||e.schemaVersion,i=le(a,"embeddedToken");return!r.includeEmbedded&&i in o?void 0:P.value(n)}))),o=le(e.schemaVersion,"dynamicAnchorToken");Object.entries(e.dynamicAnchors).forEach((([e,t])=>{const r=oe(t)[1];$.assign(r,n,{[o]:e,...$.get(r,n)})}));const a=le(e.schemaVersion,"anchorToken");Object.entries(e.anchors).filter((([e])=>""!==e)).forEach((([e,t])=>{$.assign(t,n,{[a]:e,...$.get(t,n)})}));const i=le(e.schemaVersion,"baseToken"),s=$e(r.parentId,e.id),c=r.parentDialect===e.schemaVersion?"":e.schemaVersion;return{...s&&{[i]:s},...c&&{$schema:c},...n}}};Se.setConfig,Se.getConfig,Se.add,Se.get,Se.markValidated,Se.uri,Se.value,Se.getAnchorPointer,Se.typeOf,Se.has,Se.step,Se.keys,Se.entries,Se.map,Se.length,Se.toSchema;class Ae extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var Pe=Ae;const{splitUrl:xe}=d,Ie="FLAG",Te="BASIC",ke="DETAILED",Ve="VERBOSE";let Re=ke,Ce=!0;const Ue=async e=>{const t={metaData:{}};return{ast:t,schemaUri:await Je(e,t)}},ze=t((({ast:e,schemaUri:t},r,n=Ie)=>{if(![Ie,Te,ke,Ve].includes(n))throw Error(`The '${n}' error format is not supported`);const a=[],i=o.subscribe("result",Ke(n,a));return Fe(t,r,e,{}),o.unsubscribe(i),a[0]})),Ke=(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===Ve||e!==Ie&&!t.valid)&&n.errors.unshift(...o)}r[r.length-1]=n,t[0]=n}}},Le={},qe=e=>Le[e],_e=e=>e in Le,De={},Ne={},Je=async(e,t)=>{if(e=await Be(e),!_e(`${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)=>{Le[e]={collectEvaluatedItems:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&new Set,collectEvaluatedProperties:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&[],...t}})(`${t.id}#${e}`,r)}));else if(r)throw Error(`Missing required vocabulary: ${e}`)}))}if(Ce&&!e.validated){if(Se.markValidated(e.id),!(e.schemaVersion in Ne)){const t=await Se.get(e.schemaVersion),r=await Ue(t);Ne[t.id]=ze(r)}const t=L.cons(e.schema,e.id),r=Ne[e.schemaVersion](t,Re);if(!r.valid)throw new Pe(r)}return e.id in t.metaData||(t.metaData[e.id]={id:e.id,dynamicAnchors:e.dynamicAnchors,anchors:e.anchors}),qe(`${e.schemaVersion}#validate`).compile(e,t)},Be=async e=>Se.typeOf(e,"string")?Be(await Se.get(Se.value(e),e)):e,Fe=(e,t,r,n)=>{const o=We(e,r),a=xe(e)[0];return qe(o).interpret(e,t,r,{...r.metaData[a].dynamicAnchors,...n})},We=(e,t)=>{if(!(e in t))throw Error(`No schema found at ${e}`);return t[e][0]};var Ze={validate:async(e,t,r)=>{const n=await Ue(e),o=(e,t)=>ze(n,L.cons(e),t);return void 0===t?o:o(t,r)},compile:Ue,interpret:ze,setMetaOutputFormat:e=>{Re=e},setShouldMetaValidate:e=>{Ce=e},FLAG:Ie,BASIC:Te,DETAILED:ke,VERBOSE:Ve,add:(e,t="",r="")=>{const n=Se.add(e,t,r);delete Ne[n]},getKeyword:qe,hasKeyword:_e,defineVocabulary:(e,t)=>{De[e]=t},compileSchema:Je,interpretSchema:Fe,collectEvaluatedProperties:(e,t,r,n,o)=>{const a=We(e,r);return qe(a).collectEvaluatedProperties(e,t,r,n,o)},collectEvaluatedItems:(e,t,r,n,o)=>{const a=We(e,r);return qe(a).collectEvaluatedItems(e,t,r,n,o)}};var Me={compile:e=>Se.value(e),interpret:()=>!0};var Ge={compile:async(e,t)=>{const r=Se.uri(e);if(!(r in t)){t[r]=!1;const n=Se.value(e);if(!["object","boolean"].includes(typeof n))throw Error(`No schema found at '${Se.uri(e)}'`);t[r]=[`${e.schemaVersion}#validate`,Se.uri(e),"boolean"==typeof n?n:await te.pipeline([Se.entries,te.map((([t,r])=>[`${e.schemaVersion}#${t}`,r])),te.filter((([t])=>Ze.hasKeyword(t)&&t!==`${e.schemaVersion}#validate`)),te.map((async([r,n])=>{const o=await Ze.getKeyword(r).compile(n,t,e);return[r,Se.uri(n),o]})),te.all],e)]}return r},interpret:(e,t,r,n)=>{const[a,i,s]=r[e];o.publishSync("result.start");const c="boolean"==typeof s?s:s.every((([e,a,i])=>{o.publishSync("result.start");const s=Ze.getKeyword(e).interpret(i,t,r,n);return o.publishSync("result",{keyword:e,absoluteKeywordLocation:a,instanceLocation:L.uri(t),valid:s,ast:i}),o.publishSync("result.end"),s}));return o.publishSync("result",{keyword:a,absoluteKeywordLocation:i,instanceLocation:L.uri(t),valid:c,ast:e}),o.publishSync("result.end"),c},collectEvaluatedProperties:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&[]:a.filter((([e])=>!o||!e.endsWith("#unevaluatedProperties"))).reduce(((e,[o,,a])=>{const i=e&&Ze.getKeyword(o).collectEvaluatedProperties(a,t,r,n);return!1!==i&&[...e,...i]}),[])},collectEvaluatedItems:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&new Set:a.filter((([e])=>!o||!e.endsWith("#unevaluatedItems"))).reduce(((e,[o,,a])=>{const i=!1!==e&&Ze.getKeyword(o).collectEvaluatedItems(a,t,r,n);return!1!==i&&new Set([...e,...i])}),new Set)}},He={metaData:Me,validate:Ge},Qe={Core:Ze,Schema:Se,Instance:L,Reference:P,Keywords:He,InvalidSchemaError:Pe},Xe=Qe.Core,Ye=Qe.Schema,et=Qe.Instance,tt=Qe.Reference,rt=Qe.Keywords,nt=Qe.InvalidSchemaError;return e.Core=Xe,e.Instance=et,e.InvalidSchemaError=nt,e.Keywords=rt,e.Reference=tt,e.Schema=Ye,e.default=Qe,Object.defineProperty(e,"__esModule",{value:!0}),e}({}); | ||
var JSC=function(e,t){"use strict";function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=r(t),o=function(e,t){return function r(){null==t&&(t=e.length);var n=[].slice.call(arguments);return n.length>=t?e.apply(this,n):function(){return r.apply(this,n.concat([].slice.call(arguments)))}}};var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var i,s=(function(e,t){var r,n;r="object"==typeof window&&window||a,n={},r.PubSub=n,function(e){var t={},r=-1,n="*";function o(e){var t;for(t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function a(e){return function(){throw e}}function i(e,t,r){try{e(t,r)}catch(e){setTimeout(a(e),0)}}function s(e,t,r){e(t,r)}function c(e,r,n,o){var a,c=t[r],l=o?s:i;if(Object.prototype.hasOwnProperty.call(t,r))for(a in c)Object.prototype.hasOwnProperty.call(c,a)&&l(c[a],e,n)}function l(e,t,r){return function(){var o=String(e),a=o.lastIndexOf(".");for(c(e,e,t,r);-1!==a;)a=(o=o.substr(0,a)).lastIndexOf("."),c(e,o,t,r);c(e,n,t,r)}}function u(e){var r=String(e);return Boolean(Object.prototype.hasOwnProperty.call(t,r)&&o(t[r]))}function d(e){for(var t=String(e),r=u(t)||u(n),o=t.lastIndexOf(".");!r&&-1!==o;)o=(t=t.substr(0,o)).lastIndexOf("."),r=u(t);return r}function f(e,t,r,n){var o=l(e="symbol"==typeof e?e.toString():e,t,n);return!!d(e)&&(!0===r?o():setTimeout(o,0),!0)}e.publish=function(t,r){return f(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return f(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,Object.prototype.hasOwnProperty.call(t,e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeAll=function(t){return e.subscribe(n,t)},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n,o=0;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)){for(n in t[r])o++;break}return o},e.getSubscriptions=function(e){var r,n=[];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,a,i=function(e){var r;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e))return!0;return!1},s="string"==typeof r&&(Object.prototype.hasOwnProperty.call(t,r)||i(r)),c=!s&&"string"==typeof r,l="function"==typeof r,u=!1;if(!s){for(n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(o=t[n],c&&o[r]){delete o[r],u=r;break}if(l)for(a in o)Object.prototype.hasOwnProperty.call(o,a)&&o[a]===r&&(delete o[a],u=!0)}return u}e.clearSubscriptions(r)}}(n),void 0!==e&&e.exports&&(t=e.exports=n),t.PubSub=n,e.exports=t=n}(i={exports:{}},i.exports),i.exports);s.PubSub;const c={null:e=>null===e,boolean:e=>"boolean"==typeof e,object:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,array:e=>Array.isArray(e),number:e=>"number"==typeof e,integer:e=>Number.isInteger(e),string:e=>"string"==typeof e},l=e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),o=e.slice(r+1);return[decodeURI(n),decodeURI(o)]},u=e=>{const t=RegExp(/^(.+):\/\//).exec(e);return t?t[1]:""};var d={jsonTypeOf:(e,t)=>c[t](e),splitUrl:l,safeResolveUrl:(e,t)=>{const r=n.default(e,t),o=l(e)[0];if(o&&"file"===u(r)&&"file"!==u(o))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},pathRelative:(e,t)=>{if(e===t)return"";let r=1;const n=e.length-1,o=t.length-r,a=n<o?n:o;let i=-1,s=0;for(;s<a;s++){const n=e.charCodeAt(s+1);if(n!==t.charCodeAt(r+s))break;47===n&&(i=s)}if(o>a){if(47===t.charCodeAt(r+s))return t.slice(r+s+1);if(0===s)return t.slice(r+s)}n>a&&(47===e.charCodeAt(s+1)?i=s:0===a&&(i=0));let c="";for(s=i+2;s<=e.length;++s)s!==e.length&&47!==e.charCodeAt(s)||(c+=0===c.length?"..":"/..");return r+=i,c.length>0?`${c}${t.slice(r,t.length)}`:(47===t.charCodeAt(r)&&++r,t.slice(r,t.length))}};const f=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(w)},p=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:p(e,O(t,o,n),r,v(o,n))}}if(Array.isArray(t)){const n=[...t];return n[g(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:O(t,e[0],n)},h=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||E(t)){const o=e.shift();h(e,O(t,o,n),r,v(o,n))}else{t[g(t,e[0])]=r}},y=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=O(t,n,r);return{...t,[n]:y(e,o,v(n,r))}}if(Array.isArray(t))return t.filter(((t,r)=>r!=e[0]));if("object"==typeof t&&null!==t){const{[e[0]]:r,...n}=t;return n}return O(t,e[0],r)}},m=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=O(t,n,r);m(e,o,v(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:O(t,e[0],r)},v=o(((e,t)=>t+"/"+b(e))),b=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),w=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),g=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,O=(e,t,r="")=>{if(void 0===e)throw TypeError(`Value at '${r}' is undefined and does not have property '${t}'`);if(null===e)throw TypeError(`Value at '${r}' is null and does not have property '${t}'`);if(E(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[g(e,t)]},E=e=>null===e||"object"!=typeof e;var j={nil:"",append:v,get:(e,t)=>{const r=f(e),n=e=>r.reduce((([e,t],r)=>[O(e,r,t),v(r,t)]),[e,""])[0];return void 0===t?n:n(t)},set:(e,t,r)=>{const n=f(e),a=o(((e,t)=>p(n,e,t,"")));return void 0===t?a:a(t,r)},assign:(e,t,r)=>{const n=f(e),a=o(((e,t)=>h(n,e,t,"")));return void 0===t?a:a(t,r)},unset:(e,t)=>{const r=f(e),n=e=>y(r,e,"");return void 0===t?n:n(t)},remove:(e,t)=>{const r=f(e),n=e=>m(r,e,"");return void 0===t?n:n(t)}};j.nil,j.append,j.get,j.set,j.assign,j.unset,j.remove;const $=Symbol("$__value"),S=Symbol("$__href");var A={cons:(e,t)=>Object.freeze({[S]:e,[$]:t}),isReference:e=>e&&void 0!==e[S],href:e=>e[S],value:e=>e[$]};const{jsonTypeOf:T}=d,I=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),k=e=>A.isReference(e.value)?A.value(e.value):e.value,V=o(((e,t)=>T(k(e),t))),x=(e,t)=>Object.freeze({...t,pointer:j.append(e,t.pointer),value:k(t)[e]}),P=o(((e,t)=>k(t).map(((r,n,o,a)=>e(x(n,t),n,o,a))))),R=o(((e,t)=>k(t).map(((e,r,n,o)=>x(r,t))).filter(((t,r,n,o)=>e(t,r,n,o))))),C=o(((e,t,r)=>k(r).reduce(((t,n,o)=>e(t,x(o,r),o)),t))),U=o(((e,t)=>k(t).every(((r,n,o,a)=>e(x(n,t),n,o,a))))),K=o(((e,t)=>k(t).some(((r,n,o,a)=>e(x(n,t),n,o,a)))));var L={nil:I,cons:(e,t="")=>Object.freeze({...I,id:t,instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:k,has:(e,t)=>e in k(t),typeOf:V,step:x,entries:e=>Object.keys(k(e)).map((t=>[t,x(t,e)])),keys:e=>Object.keys(k(e)),map:P,filter:R,reduce:C,every:U,some:K,length:e=>k(e).length},z=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,_=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,D=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,N=/\\([\u000b\u0020-\u00ff])/g,B=/([\\"])/g,J=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function q(e){var t=String(e);if(D.test(t))return t;if(t.length>0&&!_.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(B,"\\$1")+'"'}function F(e){this.parameters=Object.create(null),this.type=e}var Z={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!J.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,a=Object.keys(t).sort(),i=0;i<a.length;i++){if(o=a[i],!D.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+q(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(!J.test(n))throw new TypeError("invalid media type");var o=new F(n.toLowerCase());if(-1!==r){var a,i,s;for(z.lastIndex=r;i=z.exec(t);){if(i.index!==r)throw new TypeError("invalid parameter format");r+=i[0].length,a=i[1].toLowerCase(),'"'===(s=i[2])[0]&&(s=s.substr(1,s.length-2).replace(N,"$1")),o.parameters[a]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},M=async e=>Object.entries(await e),W=o((async(e,t)=>(await t).map(e))),G=o((async(e,t,r)=>(await r).reduce((async(t,r)=>e(await t,r)),t))),H=o((async(e,t,r={})=>G((async(t,r)=>await e(r)?t.concat([r]):t),[],t,r))),Q=o((async(e,t)=>{const r=await W(e,t);return(await Promise.all(r)).some((e=>e))})),X=o((async(e,t)=>{const r=await W(e,t);return(await Promise.all(r)).every((e=>e))})),Y=o(((e,t)=>e.reduce((async(e,t)=>t(await e)),t))),ee={entries:M,map:W,filter:H,reduce:G,some:Q,every:X,pipeline:Y,all:e=>Promise.all(e),allValues:e=>Y([M,G((async(e,[t,r])=>(e[t]=await r,e)),{})],e)};ee.entries,ee.map,ee.filter,ee.reduce,ee.some,ee.every,ee.pipeline,ee.all,ee.allValues;var te=fetch;const{jsonTypeOf:re,splitUrl:ne,safeResolveUrl:oe,pathRelative:ae}=d,ie={},se={},ce=(e,t)=>{const r=e in se?se[e]:e;if(r in ie)return ie[r][t]},le={},ue={},de=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=ne(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=ce(n,"baseToken"),a=ce(n,"anchorToken"),i=ne(t)[0];if(!i&&!ne(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const s=oe(i,e[o]||""),[c,l]=ne(s);delete e[o],l&&o===a&&(e[a]=a!==o?encodeURI(l):`#${encodeURI(l)}`),i&&(ue[i]=c);const u={},d=ce(n,"recursiveAnchorToken");let f;!0===e[d]&&(u[""]=`${c}#`,e[a]="",delete e[d]);const p=ce(n,"vocabularyToken");re(e[p],"object")?(se[c]=n,f=e[p],delete e[p]):(se[c]=n,f={[n]:!0});const h={"":""};return le[c]={id:c,schemaVersion:n,schema:fe(e,c,n,j.nil,h,u),anchors:h,dynamicAnchors:u,vocabulary:f,validated:!1},c},fe=(e,t,r,n,o,a)=>{if(re(e,"object")){const i="string"==typeof e.$schema?ne(e.$schema)[0]:r,s=ce(i,"embeddedToken"),c=ce(i,"anchorToken");if("string"==typeof e[s]&&(s!==c||"#"!==e[s][0])){const n=oe(t,e[s]);return e[s]=n,de(e,n,r),A.cons(e[s],e)}const l=ce(r,"anchorToken"),u=ce(r,"dynamicAnchorToken");"string"==typeof e[u]&&(a[e[u]]=`${t}#${encodeURI(n)}`,o[e[u]]=n,delete e[u]);const d=ce(r,"embeddedToken");if("string"==typeof e[l]){const t=l!==d?e[l]:e[l].slice(1);o[t]=n,delete e[l]}const f=ce(r,"jrefToken");if("string"==typeof e[f])return A.cons(e[f],e);for(const i in e)e[i]=fe(e[i],t,r,j.append(i,n),o,a);return e}return Array.isArray(e)?e.map(((e,i)=>fe(e,t,r,j.append(i,n),o,a))):e},pe=e=>le[ue[e]]||le[e],he=Object.freeze({id:"",schemaVersion:void 0,vocabulary:{},pointer:j.nil,schema:void 0,value:void 0,anchors:{},dynamicAnchors:{},validated:!0}),ye=async(e,t=he)=>{const r=oe(be(t),e),[n,o]=ne(r);if(!(e=>e in le||e in ue)(n)){const e=await te(n,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error(`Failed to retrieve schema with id: ${n}`);if(e.headers.has("content-type")){const t=Z.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${n} is not a schema. Found a document with media type: ${t}`)}de(await e.json(),n)}const a=pe(n),i="/"!==o[0]?ve(a,o):o,s=Object.freeze({...a,pointer:i,value:j.get(i,a.schema)});return me(s)},me=e=>A.isReference(e.value)?ye(A.href(e.value),e):e,ve=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},be=e=>`${e.id}#${encodeURI(e.pointer)}`,we=e=>A.isReference(e.value)?A.value(e.value):e.value,ge=(e,t)=>{const r=pe(t.id),n=Object.freeze({...t,pointer:j.append(e,t.pointer),value:we(t)[e],validated:r.validated});return me(n)},Oe=o(((e,t)=>ee.pipeline([we,ee.map((async(r,n)=>e(await ge(n,t),n))),ee.all],t))),Ee={parentId:"",parentDialect:"",includeEmbedded:!0},je=(e,t)=>{if(t.startsWith("file://")){const r=e.slice(7,e.lastIndexOf("/"));return""===e?"":ae(r,t.slice(7))}return t};var $e={setConfig:(e,t,r)=>{ie[e]||(ie[e]={}),ie[e][t]=r},getConfig:ce,add:de,get:ye,markValidated:e=>{le[e].validated=!0},uri:be,value:we,getAnchorPointer:ve,typeOf:(e,t)=>re(we(e),t),has:(e,t)=>e in we(t),step:ge,keys:e=>Object.keys(we(e)),entries:e=>ee.pipeline([we,Object.keys,ee.map((async t=>[t,await ge(t,e)])),ee.all],e),map:Oe,length:e=>we(e).length,toSchema:(e,t={})=>{const r={...Ee,...t},n=JSON.parse(JSON.stringify(e.schema,((t,n)=>{if(!A.isReference(n))return n;const o=A.value(n),a=o.$schema||e.schemaVersion,i=ce(a,"embeddedToken");return!r.includeEmbedded&&i in o?void 0:A.value(n)}))),o=ce(e.schemaVersion,"dynamicAnchorToken");Object.entries(e.dynamicAnchors).forEach((([e,t])=>{const r=ne(t)[1];j.assign(r,n,{[o]:e,...j.get(r,n)})}));const a=ce(e.schemaVersion,"anchorToken");Object.entries(e.anchors).filter((([e])=>""!==e)).forEach((([e,t])=>{j.assign(t,n,{[a]:e,...j.get(t,n)})}));const i=ce(e.schemaVersion,"baseToken"),s=je(r.parentId,e.id),c=r.parentDialect===e.schemaVersion?"":e.schemaVersion;return{...s&&{[i]:s},...c&&{$schema:c},...n}}};$e.setConfig,$e.getConfig,$e.add,$e.get,$e.markValidated,$e.uri,$e.value,$e.getAnchorPointer,$e.typeOf,$e.has,$e.step,$e.keys,$e.entries,$e.map,$e.length,$e.toSchema;class Se extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var Ae=Se;const{splitUrl:Te}=d,Ie="FLAG",ke="BASIC",Ve="DETAILED",xe="VERBOSE";let Pe=Ve,Re=!0;const Ce=async e=>{const t={metaData:{}};return{ast:t,schemaUri:await Be(e,t)}},Ue=o((({ast:e,schemaUri:t},r,n=Ie)=>{if(![Ie,ke,Ve,xe].includes(n))throw Error(`The '${n}' error format is not supported`);const o=[],a=s.subscribe("result",Ke(n,o));return qe(t,r,e,{}),s.unsubscribe(a),o[0]})),Ke=(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===ke&&(o.push(...t.errors),delete t.errors),(e===xe||e!==Ie&&!t.valid)&&n.errors.unshift(...o)}r[r.length-1]=n,t[0]=n}}},Le={},ze=e=>Le[e],_e=e=>e in Le,De={},Ne={},Be=async(e,t)=>{if(e=await Je(e),!_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 De)Object.entries(De[e]).forEach((([e,r])=>{((e,t)=>{Le[e]={collectEvaluatedItems:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&new Set,collectEvaluatedProperties:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&[],...t}})(`${t.id}#${e}`,r)}));else if(r)throw Error(`Missing required vocabulary: ${e}`)}))}if(Re&&!e.validated){if($e.markValidated(e.id),!(e.schemaVersion in Ne)){const t=await $e.get(e.schemaVersion),r=await Ce(t);Ne[t.id]=Ue(r)}const t=L.cons(e.schema,e.id),r=Ne[e.schemaVersion](t,Pe);if(!r.valid)throw new Ae(r)}return e.id in t.metaData||(t.metaData[e.id]={id:e.id,dynamicAnchors:e.dynamicAnchors,anchors:e.anchors}),ze(`${e.schemaVersion}#validate`).compile(e,t)},Je=async e=>$e.typeOf(e,"string")?Je(await $e.get($e.value(e),e)):e,qe=(e,t,r,n)=>{const o=Fe(e,r),a=Te(e)[0];return ze(o).interpret(e,t,r,{...r.metaData[a].dynamicAnchors,...n})},Fe=(e,t)=>{if(!(e in t))throw Error(`No schema found at ${e}`);return t[e][0]};var Ze={validate:async(e,t,r)=>{const n=await Ce(e),o=(e,t)=>Ue(n,L.cons(e),t);return void 0===t?o:o(t,r)},compile:Ce,interpret:Ue,setMetaOutputFormat:e=>{Pe=e},setShouldMetaValidate:e=>{Re=e},FLAG:Ie,BASIC:ke,DETAILED:Ve,VERBOSE:xe,add:(e,t="",r="")=>{const n=$e.add(e,t,r);delete Ne[n]},getKeyword:ze,hasKeyword:_e,defineVocabulary:(e,t)=>{De[e]=t},compileSchema:Be,interpretSchema:qe,collectEvaluatedProperties:(e,t,r,n,o)=>{const a=Fe(e,r);return ze(a).collectEvaluatedProperties(e,t,r,n,o)},collectEvaluatedItems:(e,t,r,n,o)=>{const a=Fe(e,r);return ze(a).collectEvaluatedItems(e,t,r,n,o)}};var Me={compile:e=>$e.value(e),interpret:()=>!0};var We={compile:async(e,t)=>{const r=$e.uri(e);if(!(r in t)){t[r]=!1;const n=$e.value(e);if(!["object","boolean"].includes(typeof n))throw Error(`No schema found at '${$e.uri(e)}'`);t[r]=[`${e.schemaVersion}#validate`,$e.uri(e),"boolean"==typeof n?n:await ee.pipeline([$e.entries,ee.map((([t,r])=>[`${e.schemaVersion}#${t}`,r])),ee.filter((([t])=>Ze.hasKeyword(t)&&t!==`${e.schemaVersion}#validate`)),ee.map((async([r,n])=>{const o=await Ze.getKeyword(r).compile(n,t,e);return[r,$e.uri(n),o]})),ee.all],e)]}return r},interpret:(e,t,r,n)=>{const[o,a,i]=r[e];s.publishSync("result.start");const c="boolean"==typeof i?i:i.every((([e,o,a])=>{s.publishSync("result.start");const i=Ze.getKeyword(e).interpret(a,t,r,n);return s.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:L.uri(t),valid:i,ast:a}),s.publishSync("result.end"),i}));return s.publishSync("result",{keyword:o,absoluteKeywordLocation:a,instanceLocation:L.uri(t),valid:c,ast:e}),s.publishSync("result.end"),c},collectEvaluatedProperties:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&[]:a.filter((([e])=>!o||!e.endsWith("#unevaluatedProperties"))).reduce(((e,[o,,a])=>{const i=e&&Ze.getKeyword(o).collectEvaluatedProperties(a,t,r,n);return!1!==i&&[...e,...i]}),[])},collectEvaluatedItems:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&new Set:a.filter((([e])=>!o||!e.endsWith("#unevaluatedItems"))).reduce(((e,[o,,a])=>{const i=!1!==e&&Ze.getKeyword(o).collectEvaluatedItems(a,t,r,n);return!1!==i&&new Set([...e,...i])}),new Set)}},Ge={metaData:Me,validate:We},He={Core:Ze,Schema:$e,Instance:L,Reference:A,Keywords:Ge,InvalidSchemaError:Ae},Qe=He.Core,Xe=He.Schema,Ye=He.Instance,et=He.Reference,tt=He.Keywords,rt=He.InvalidSchemaError;return e.Core=Qe,e.Instance=Ye,e.InvalidSchemaError=rt,e.Keywords=tt,e.Reference=et,e.Schema=Xe,e.default=He,Object.defineProperty(e,"__esModule",{value:!0}),e}({},urlResolveBrowser); | ||
//# sourceMappingURL=json-schema-core-iife.min.js.map |
@@ -1,2 +0,2 @@ | ||
System.register("JSC",[],(function(e){"use strict";return{execute:function(){var t=function(e,t){return function r(){null==t&&(t=e.length);var n=[].slice.call(arguments);return n.length>=t?e.apply(this,n):function(){return r.apply(this,n.concat([].slice.call(arguments)))}}};var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var n,o=(function(e,t){var n,o;n="object"==typeof window&&window||r,o={},n.PubSub=o,function(e){var t={},r=-1,n="*";function o(e){var t;for(t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function a(e){return function(){throw e}}function i(e,t,r){try{e(t,r)}catch(e){setTimeout(a(e),0)}}function s(e,t,r){e(t,r)}function c(e,r,n,o){var a,c=t[r],l=o?s:i;if(Object.prototype.hasOwnProperty.call(t,r))for(a in c)Object.prototype.hasOwnProperty.call(c,a)&&l(c[a],e,n)}function l(e,t,r){return function(){var o=String(e),a=o.lastIndexOf(".");for(c(e,e,t,r);-1!==a;)a=(o=o.substr(0,a)).lastIndexOf("."),c(e,o,t,r);c(e,n,t,r)}}function u(e){var r=String(e);return Boolean(Object.prototype.hasOwnProperty.call(t,r)&&o(t[r]))}function f(e){for(var t=String(e),r=u(t)||u(n),o=t.lastIndexOf(".");!r&&-1!==o;)o=(t=t.substr(0,o)).lastIndexOf("."),r=u(t);return r}function d(e,t,r,n){var o=l(e="symbol"==typeof e?e.toString():e,t,n);return!!f(e)&&(!0===r?o():setTimeout(o,0),!0)}e.publish=function(t,r){return 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,Object.prototype.hasOwnProperty.call(t,e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeAll=function(t){return e.subscribe(n,t)},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n,o=0;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)){for(n in t[r])o++;break}return o},e.getSubscriptions=function(e){var r,n=[];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,a,i=function(e){var r;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e))return!0;return!1},s="string"==typeof r&&(Object.prototype.hasOwnProperty.call(t,r)||i(r)),c=!s&&"string"==typeof r,l="function"==typeof r,u=!1;if(!s){for(n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(o=t[n],c&&o[r]){delete o[r],u=r;break}if(l)for(a in o)Object.prototype.hasOwnProperty.call(o,a)&&o[a]===r&&(delete o[a],u=!0)}return u}e.clearSubscriptions(r)}}(o),void 0!==e&&e.exports&&(t=e.exports=o),t.PubSub=o,e.exports=t=o}(n={exports:{}},n.exports),n.exports);o.PubSub;var a=function(e,t){if(e=e.trim(),(t=t.trim()).startsWith("about:"))return t;const r=function(e){const t={host:"",path:"",query:"",protocol:""};let r=e,n=e.indexOf("//");t.protocol=r.substring(0,n),n+=2;const o=e.indexOf("/",n),a=e.indexOf("?"),i=e.indexOf("#");-1!==i&&(r=r.substring(0,i));if(-1!==a){const e=r.substring(a);t.query=e,r=r.substring(0,a)}if(-1!==o){const e=r.substring(0,o);t.host=e,r=r.substring(o),t.path=r}else t.host=r;return t}(e),n=function(e){const t={href:e,hash:"",query:"",netPath:!1,absolutePath:!1,relativePath:!1};if(c.test(e))return t.netPath=!0,t;"/"===e[0]?t.absolutePath=!0:""!==e&&(t.relativePath=!0);let r=e;const n=e.indexOf("?"),o=e.indexOf("#");if(-1!==o){const e=r.substring(o);t.hash=e,r=r.substring(0,o)}if(-1!==n){const e=r.substring(n);t.query=e,r=r.substring(0,n)}return t.path=r,t}(t);if(!r.protocol&&!n.netPath)throw new Error("Error, protocol is not specified");if(n.netPath)return n.href.startsWith("//")&&(n.href=r.protocol+n.href),function(e){const t=e.indexOf("//")+2,r=!e.includes("/",t),n=!e.includes("?",t),o=!e.includes("#",t);return r&&n&&o}(n.href)?i(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+s(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let a,i=r.path,c=r.host;return 0===e.length?a=i:(i=i.substring(0,i.lastIndexOf("/")),a=s(i+"/"+e)),c+=""!==a||t||o?a+t+o:"/",c}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:i(e)}};function i(e){return e+("/"===e[e.length-1]?"":"/")}function s(e){let t=e.split("/");""===t[0]&&(t=t.slice(1));let r=[];return t.forEach(((e,n)=>{"."!==e&&(".."===e?r.pop():""===e&&n!==t.length-1||r.push(e))})),"/"+r.join("/")}const c=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");const l={null:e=>null===e,boolean:e=>"boolean"==typeof e,object:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,array:e=>Array.isArray(e),number:e=>"number"==typeof e,integer:e=>Number.isInteger(e),string:e=>"string"==typeof e},u=e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),o=e.slice(r+1);return[decodeURI(n),decodeURI(o)]},f=e=>{const t=RegExp(/^(.+):\/\//).exec(e);return t?t[1]:""};var d={jsonTypeOf:(e,t)=>l[t](e),splitUrl:u,safeResolveUrl:(e,t)=>{const r=a(e,t),n=u(e)[0];if(n&&"file"===f(r)&&"file"!==f(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},pathRelative:(e,t)=>{if(e===t)return"";let r=1;const n=e.length-1,o=t.length-r,a=n<o?n:o;let i=-1,s=0;for(;s<a;s++){const n=e.charCodeAt(s+1);if(n!==t.charCodeAt(r+s))break;47===n&&(i=s)}if(o>a){if(47===t.charCodeAt(r+s))return t.slice(r+s+1);if(0===s)return t.slice(r+s)}n>a&&(47===e.charCodeAt(s+1)?i=s:0===a&&(i=0));let c="";for(s=i+2;s<=e.length;++s)s!==e.length&&47!==e.charCodeAt(s)||(c+=0===c.length?"..":"/..");return r+=i,c.length>0?`${c}${t.slice(r,t.length)}`:(47===t.charCodeAt(r)&&++r,t.slice(r,t.length))}};const p=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(w)},h=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:h(e,E(t,o,n),r,v(o,n))}}if(Array.isArray(t)){const n=[...t];return n[O(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:E(t,e[0],n)},y=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||$(t)){const o=e.shift();y(e,E(t,o,n),r,v(o,n))}else{t[O(t,e[0])]=r}},m=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=E(t,n,r);return{...t,[n]:m(e,o,v(n,r))}}if(Array.isArray(t))return t.filter(((t,r)=>r!=e[0]));if("object"==typeof t&&null!==t){const{[e[0]]:r,...n}=t;return n}return E(t,e[0],r)}},b=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=E(t,n,r);b(e,o,v(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:E(t,e[0],r)},v=t(((e,t)=>t+"/"+g(e))),g=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),w=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),O=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,E=(e,t,r="")=>{if(void 0===e)throw TypeError(`Value at '${r}' is undefined and does not have property '${t}'`);if(null===e)throw TypeError(`Value at '${r}' is null and does not have property '${t}'`);if($(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[O(e,t)]},$=e=>null===e||"object"!=typeof e;var j={nil:"",append:v,get:(e,t)=>{const r=p(e),n=e=>r.reduce((([e,t],r)=>[E(e,r,t),v(r,t)]),[e,""])[0];return void 0===t?n:n(t)},set:(e,r,n)=>{const o=p(e),a=t(((e,t)=>h(o,e,t,"")));return void 0===r?a:a(r,n)},assign:(e,r,n)=>{const o=p(e),a=t(((e,t)=>y(o,e,t,"")));return void 0===r?a:a(r,n)},unset:(e,t)=>{const r=p(e),n=e=>m(r,e,"");return void 0===t?n:n(t)},remove:(e,t)=>{const r=p(e),n=e=>b(r,e,"");return void 0===t?n:n(t)}};j.nil,j.append,j.get,j.set,j.assign,j.unset,j.remove;const S=Symbol("$__value"),A=Symbol("$__href");var x={cons:(e,t)=>Object.freeze({[A]:e,[S]:t}),isReference:e=>e&&void 0!==e[A],href:e=>e[A],value:e=>e[S]};const{jsonTypeOf:I}=d,P=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),T=e=>x.isReference(e.value)?x.value(e.value):e.value,k=t(((e,t)=>I(T(e),t))),V=(e,t)=>Object.freeze({...t,pointer:j.append(e,t.pointer),value:T(t)[e]}),R=t(((e,t)=>T(t).map(((r,n,o,a)=>e(V(n,t),n,o,a))))),C=t(((e,t)=>T(t).map(((e,r,n,o)=>V(r,t))).filter(((t,r,n,o)=>e(t,r,n,o))))),U=t(((e,t,r)=>T(r).reduce(((t,n,o)=>e(t,V(o,r),o)),t))),z=t(((e,t)=>T(t).every(((r,n,o,a)=>e(V(n,t),n,o,a))))),K=t(((e,t)=>T(t).some(((r,n,o,a)=>e(V(n,t),n,o,a)))));var L={nil:P,cons:(e,t="")=>Object.freeze({...P,id:t,instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:T,has:(e,t)=>e in T(t),typeOf:k,step:V,entries:e=>Object.keys(T(e)).map((t=>[t,V(t,e)])),keys:e=>Object.keys(T(e)),map:R,filter:C,reduce:U,every:z,some:K,length:e=>T(e).length},q=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,D=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,_=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,N=/\\([\u000b\u0020-\u00ff])/g,J=/([\\"])/g,B=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function F(e){var t=String(e);if(_.test(t))return t;if(t.length>0&&!D.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(J,"\\$1")+'"'}function W(e){this.parameters=Object.create(null),this.type=e}var Z={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!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 W(n.toLowerCase());if(-1!==r){var a,i,s;for(q.lastIndex=r;i=q.exec(t);){if(i.index!==r)throw new TypeError("invalid parameter format");r+=i[0].length,a=i[1].toLowerCase(),'"'===(s=i[2])[0]&&(s=s.substr(1,s.length-2).replace(N,"$1")),o.parameters[a]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},M=async e=>Object.entries(await e),G=t((async(e,t)=>(await t).map(e))),H=t((async(e,t,r)=>(await r).reduce((async(t,r)=>e(await t,r)),t))),Q=t((async(e,t,r={})=>H((async(t,r)=>await e(r)?t.concat([r]):t),[],t,r))),X=t((async(e,t)=>{const r=await G(e,t);return(await Promise.all(r)).some((e=>e))})),Y=t((async(e,t)=>{const r=await G(e,t);return(await Promise.all(r)).every((e=>e))})),ee=t(((e,t)=>e.reduce((async(e,t)=>t(await e)),t))),te={entries:M,map:G,filter:Q,reduce:H,some:X,every:Y,pipeline:ee,all:e=>Promise.all(e),allValues:e=>ee([M,H((async(e,[t,r])=>(e[t]=await r,e)),{})],e)};te.entries,te.map,te.filter,te.reduce,te.some,te.every,te.pipeline,te.all,te.allValues;var re=fetch;const{jsonTypeOf:ne,splitUrl:oe,safeResolveUrl:ae,pathRelative:ie}=d,se={},ce={},le=(e,t)=>{const r=e in ce?ce[e]:e;if(r in se)return se[r][t]},ue={},fe={},de=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=oe(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=le(n,"baseToken"),a=le(n,"anchorToken"),i=oe(t)[0];if(!i&&!oe(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const s=ae(i,e[o]||""),[c,l]=oe(s);delete e[o],l&&o===a&&(e[a]=a!==o?encodeURI(l):`#${encodeURI(l)}`),i&&(fe[i]=c);const u={},f=le(n,"recursiveAnchorToken");let d;!0===e[f]&&(u[""]=`${c}#`,e[a]="",delete e[f]);const p=le(n,"vocabularyToken");ne(e[p],"object")?(ce[c]=n,d=e[p],delete e[p]):(ce[c]=n,d={[n]:!0});const h={"":""};return ue[c]={id:c,schemaVersion:n,schema:pe(e,c,n,j.nil,h,u),anchors:h,dynamicAnchors:u,vocabulary:d,validated:!1},c},pe=(e,t,r,n,o,a)=>{if(ne(e,"object")){const i="string"==typeof e.$schema?oe(e.$schema)[0]:r,s=le(i,"embeddedToken"),c=le(i,"anchorToken");if("string"==typeof e[s]&&(s!==c||"#"!==e[s][0])){const n=ae(t,e[s]);return e[s]=n,de(e,n,r),x.cons(e[s],e)}const l=le(r,"anchorToken"),u=le(r,"dynamicAnchorToken");"string"==typeof e[u]&&(a[e[u]]=`${t}#${encodeURI(n)}`,o[e[u]]=n,delete e[u]);const f=le(r,"embeddedToken");if("string"==typeof e[l]){const t=l!==f?e[l]:e[l].slice(1);o[t]=n,delete e[l]}const d=le(r,"jrefToken");if("string"==typeof e[d])return x.cons(e[d],e);for(const i in e)e[i]=pe(e[i],t,r,j.append(i,n),o,a);return e}return Array.isArray(e)?e.map(((e,i)=>pe(e,t,r,j.append(i,n),o,a))):e},he=e=>ue[fe[e]]||ue[e],ye=Object.freeze({id:"",schemaVersion:void 0,vocabulary:{},pointer:j.nil,schema:void 0,value:void 0,anchors:{},dynamicAnchors:{},validated:!0}),me=async(e,t=ye)=>{const r=ae(ge(t),e),[n,o]=oe(r);if(!(e=>e in ue||e in fe)(n)){const e=await re(n,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error(`Failed to retrieve schema with id: ${n}`);if(e.headers.has("content-type")){const t=Z.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${n} is not a schema. Found a document with media type: ${t}`)}de(await e.json(),n)}const a=he(n),i="/"!==o[0]?ve(a,o):o,s=Object.freeze({...a,pointer:i,value:j.get(i,a.schema)});return be(s)},be=e=>x.isReference(e.value)?me(x.href(e.value),e):e,ve=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},ge=e=>`${e.id}#${encodeURI(e.pointer)}`,we=e=>x.isReference(e.value)?x.value(e.value):e.value,Oe=(e,t)=>{const r=he(t.id),n=Object.freeze({...t,pointer:j.append(e,t.pointer),value:we(t)[e],validated:r.validated});return be(n)},Ee=t(((e,t)=>te.pipeline([we,te.map((async(r,n)=>e(await Oe(n,t),n))),te.all],t))),$e={parentId:"",parentDialect:"",includeEmbedded:!0},je=(e,t)=>{if(t.startsWith("file://")){const r=e.slice(7,e.lastIndexOf("/"));return""===e?"":ie(r,t.slice(7))}return t};var Se={setConfig:(e,t,r)=>{se[e]||(se[e]={}),se[e][t]=r},getConfig:le,add:de,get:me,markValidated:e=>{ue[e].validated=!0},uri:ge,value:we,getAnchorPointer:ve,typeOf:(e,t)=>ne(we(e),t),has:(e,t)=>e in we(t),step:Oe,keys:e=>Object.keys(we(e)),entries:e=>te.pipeline([we,Object.keys,te.map((async t=>[t,await Oe(t,e)])),te.all],e),map:Ee,length:e=>we(e).length,toSchema:(e,t={})=>{const r={...$e,...t},n=JSON.parse(JSON.stringify(e.schema,((t,n)=>{if(!x.isReference(n))return n;const o=x.value(n),a=o.$schema||e.schemaVersion,i=le(a,"embeddedToken");return!r.includeEmbedded&&i in o?void 0:x.value(n)}))),o=le(e.schemaVersion,"dynamicAnchorToken");Object.entries(e.dynamicAnchors).forEach((([e,t])=>{const r=oe(t)[1];j.assign(r,n,{[o]:e,...j.get(r,n)})}));const a=le(e.schemaVersion,"anchorToken");Object.entries(e.anchors).filter((([e])=>""!==e)).forEach((([e,t])=>{j.assign(t,n,{[a]:e,...j.get(t,n)})}));const i=le(e.schemaVersion,"baseToken"),s=je(r.parentId,e.id),c=r.parentDialect===e.schemaVersion?"":e.schemaVersion;return{...s&&{[i]:s},...c&&{$schema:c},...n}}};Se.setConfig,Se.getConfig,Se.add,Se.get,Se.markValidated,Se.uri,Se.value,Se.getAnchorPointer,Se.typeOf,Se.has,Se.step,Se.keys,Se.entries,Se.map,Se.length,Se.toSchema;class Ae extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var xe=Ae;const{splitUrl:Ie}=d,Pe="FLAG",Te="BASIC",ke="DETAILED",Ve="VERBOSE";let Re=ke,Ce=!0;const Ue=async e=>{const t={metaData:{}};return{ast:t,schemaUri:await Je(e,t)}},ze=t((({ast:e,schemaUri:t},r,n=Pe)=>{if(![Pe,Te,ke,Ve].includes(n))throw Error(`The '${n}' error format is not supported`);const a=[],i=o.subscribe("result",Ke(n,a));return Fe(t,r,e,{}),o.unsubscribe(i),a[0]})),Ke=(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===Ve||e!==Pe&&!t.valid)&&n.errors.unshift(...o)}r[r.length-1]=n,t[0]=n}}},Le={},qe=e=>Le[e],De=e=>e in Le,_e={},Ne={},Je=async(e,t)=>{if(e=await Be(e),!De(`${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 _e)Object.entries(_e[e]).forEach((([e,r])=>{((e,t)=>{Le[e]={collectEvaluatedItems:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&new Set,collectEvaluatedProperties:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&[],...t}})(`${t.id}#${e}`,r)}));else if(r)throw Error(`Missing required vocabulary: ${e}`)}))}if(Ce&&!e.validated){if(Se.markValidated(e.id),!(e.schemaVersion in Ne)){const t=await Se.get(e.schemaVersion),r=await Ue(t);Ne[t.id]=ze(r)}const t=L.cons(e.schema,e.id),r=Ne[e.schemaVersion](t,Re);if(!r.valid)throw new xe(r)}return e.id in t.metaData||(t.metaData[e.id]={id:e.id,dynamicAnchors:e.dynamicAnchors,anchors:e.anchors}),qe(`${e.schemaVersion}#validate`).compile(e,t)},Be=async e=>Se.typeOf(e,"string")?Be(await Se.get(Se.value(e),e)):e,Fe=(e,t,r,n)=>{const o=We(e,r),a=Ie(e)[0];return qe(o).interpret(e,t,r,{...r.metaData[a].dynamicAnchors,...n})},We=(e,t)=>{if(!(e in t))throw Error(`No schema found at ${e}`);return t[e][0]};var Ze={validate:async(e,t,r)=>{const n=await Ue(e),o=(e,t)=>ze(n,L.cons(e),t);return void 0===t?o:o(t,r)},compile:Ue,interpret:ze,setMetaOutputFormat:e=>{Re=e},setShouldMetaValidate:e=>{Ce=e},FLAG:Pe,BASIC:Te,DETAILED:ke,VERBOSE:Ve,add:(e,t="",r="")=>{const n=Se.add(e,t,r);delete Ne[n]},getKeyword:qe,hasKeyword:De,defineVocabulary:(e,t)=>{_e[e]=t},compileSchema:Je,interpretSchema:Fe,collectEvaluatedProperties:(e,t,r,n,o)=>{const a=We(e,r);return qe(a).collectEvaluatedProperties(e,t,r,n,o)},collectEvaluatedItems:(e,t,r,n,o)=>{const a=We(e,r);return qe(a).collectEvaluatedItems(e,t,r,n,o)}};var Me={compile:e=>Se.value(e),interpret:()=>!0};var Ge={compile:async(e,t)=>{const r=Se.uri(e);if(!(r in t)){t[r]=!1;const n=Se.value(e);if(!["object","boolean"].includes(typeof n))throw Error(`No schema found at '${Se.uri(e)}'`);t[r]=[`${e.schemaVersion}#validate`,Se.uri(e),"boolean"==typeof n?n:await te.pipeline([Se.entries,te.map((([t,r])=>[`${e.schemaVersion}#${t}`,r])),te.filter((([t])=>Ze.hasKeyword(t)&&t!==`${e.schemaVersion}#validate`)),te.map((async([r,n])=>{const o=await Ze.getKeyword(r).compile(n,t,e);return[r,Se.uri(n),o]})),te.all],e)]}return r},interpret:(e,t,r,n)=>{const[a,i,s]=r[e];o.publishSync("result.start");const c="boolean"==typeof s?s:s.every((([e,a,i])=>{o.publishSync("result.start");const s=Ze.getKeyword(e).interpret(i,t,r,n);return o.publishSync("result",{keyword:e,absoluteKeywordLocation:a,instanceLocation:L.uri(t),valid:s,ast:i}),o.publishSync("result.end"),s}));return o.publishSync("result",{keyword:a,absoluteKeywordLocation:i,instanceLocation:L.uri(t),valid:c,ast:e}),o.publishSync("result.end"),c},collectEvaluatedProperties:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&[]:a.filter((([e])=>!o||!e.endsWith("#unevaluatedProperties"))).reduce(((e,[o,,a])=>{const i=e&&Ze.getKeyword(o).collectEvaluatedProperties(a,t,r,n);return!1!==i&&[...e,...i]}),[])},collectEvaluatedItems:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&new Set:a.filter((([e])=>!o||!e.endsWith("#unevaluatedItems"))).reduce(((e,[o,,a])=>{const i=!1!==e&&Ze.getKeyword(o).collectEvaluatedItems(a,t,r,n);return!1!==i&&new Set([...e,...i])}),new Set)}},He={metaData:Me,validate:Ge},Qe=e("default",{Core:Ze,Schema:Se,Instance:L,Reference:x,Keywords:He,InvalidSchemaError:xe});e("Core",Qe.Core),e("Schema",Qe.Schema),e("Instance",Qe.Instance),e("Reference",Qe.Reference),e("Keywords",Qe.Keywords),e("InvalidSchemaError",Qe.InvalidSchemaError)}}})); | ||
System.register("JSC",["url-resolve-browser"],(function(e){"use strict";var t;return{setters:[function(e){t=e.default}],execute:function(){var r=function(e,t){return function r(){null==t&&(t=e.length);var n=[].slice.call(arguments);return n.length>=t?e.apply(this,n):function(){return r.apply(this,n.concat([].slice.call(arguments)))}}};var n="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var o,a=(function(e,t){var r,o;r="object"==typeof window&&window||n,o={},r.PubSub=o,function(e){var t={},r=-1,n="*";function o(e){var t;for(t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function a(e){return function(){throw e}}function i(e,t,r){try{e(t,r)}catch(e){setTimeout(a(e),0)}}function s(e,t,r){e(t,r)}function c(e,r,n,o){var a,c=t[r],l=o?s:i;if(Object.prototype.hasOwnProperty.call(t,r))for(a in c)Object.prototype.hasOwnProperty.call(c,a)&&l(c[a],e,n)}function l(e,t,r){return function(){var o=String(e),a=o.lastIndexOf(".");for(c(e,e,t,r);-1!==a;)a=(o=o.substr(0,a)).lastIndexOf("."),c(e,o,t,r);c(e,n,t,r)}}function u(e){var r=String(e);return Boolean(Object.prototype.hasOwnProperty.call(t,r)&&o(t[r]))}function d(e){for(var t=String(e),r=u(t)||u(n),o=t.lastIndexOf(".");!r&&-1!==o;)o=(t=t.substr(0,o)).lastIndexOf("."),r=u(t);return r}function f(e,t,r,n){var o=l(e="symbol"==typeof e?e.toString():e,t,n);return!!d(e)&&(!0===r?o():setTimeout(o,0),!0)}e.publish=function(t,r){return f(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return f(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,Object.prototype.hasOwnProperty.call(t,e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeAll=function(t){return e.subscribe(n,t)},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n,o=0;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)){for(n in t[r])o++;break}return o},e.getSubscriptions=function(e){var r,n=[];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,a,i=function(e){var r;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e))return!0;return!1},s="string"==typeof r&&(Object.prototype.hasOwnProperty.call(t,r)||i(r)),c=!s&&"string"==typeof r,l="function"==typeof r,u=!1;if(!s){for(n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(o=t[n],c&&o[r]){delete o[r],u=r;break}if(l)for(a in o)Object.prototype.hasOwnProperty.call(o,a)&&o[a]===r&&(delete o[a],u=!0)}return u}e.clearSubscriptions(r)}}(o),void 0!==e&&e.exports&&(t=e.exports=o),t.PubSub=o,e.exports=t=o}(o={exports:{}},o.exports),o.exports);a.PubSub;const i={null:e=>null===e,boolean:e=>"boolean"==typeof e,object:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,array:e=>Array.isArray(e),number:e=>"number"==typeof e,integer:e=>Number.isInteger(e),string:e=>"string"==typeof e},s=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)]},c=e=>{const t=RegExp(/^(.+):\/\//).exec(e);return t?t[1]:""};var l={jsonTypeOf:(e,t)=>i[t](e),splitUrl:s,safeResolveUrl:(e,r)=>{const n=t(e,r),o=s(e)[0];if(o&&"file"===c(n)&&"file"!==c(o))throw Error(`Can't access file '${n}' resource from network context '${e}'`);return n},pathRelative:(e,t)=>{if(e===t)return"";let r=1;const n=e.length-1,o=t.length-r,a=n<o?n:o;let i=-1,s=0;for(;s<a;s++){const n=e.charCodeAt(s+1);if(n!==t.charCodeAt(r+s))break;47===n&&(i=s)}if(o>a){if(47===t.charCodeAt(r+s))return t.slice(r+s+1);if(0===s)return t.slice(r+s)}n>a&&(47===e.charCodeAt(s+1)?i=s:0===a&&(i=0));let c="";for(s=i+2;s<=e.length;++s)s!==e.length&&47!==e.charCodeAt(s)||(c+=0===c.length?"..":"/..");return r+=i,c.length>0?`${c}${t.slice(r,t.length)}`:(47===t.charCodeAt(r)&&++r,t.slice(r,t.length))}};const u=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(v)},d=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:d(e,g(t,o,n),r,y(o,n))}}if(Array.isArray(t)){const n=[...t];return n[b(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:g(t,e[0],n)},f=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||w(t)){const o=e.shift();f(e,g(t,o,n),r,y(o,n))}else{t[b(t,e[0])]=r}},p=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=g(t,n,r);return{...t,[n]:p(e,o,y(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 g(t,e[0],r)}},h=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=g(t,n,r);h(e,o,y(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:g(t,e[0],r)},y=r(((e,t)=>t+"/"+m(e))),m=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),v=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),b=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,g=(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(w(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[b(e,t)]},w=e=>null===e||"object"!=typeof e;var O={nil:"",append:y,get:(e,t)=>{const r=u(e),n=e=>r.reduce((([e,t],r)=>[g(e,r,t),y(r,t)]),[e,""])[0];return void 0===t?n:n(t)},set:(e,t,n)=>{const o=u(e),a=r(((e,t)=>d(o,e,t,"")));return void 0===t?a:a(t,n)},assign:(e,t,n)=>{const o=u(e),a=r(((e,t)=>f(o,e,t,"")));return void 0===t?a:a(t,n)},unset:(e,t)=>{const r=u(e),n=e=>p(r,e,"");return void 0===t?n:n(t)},remove:(e,t)=>{const r=u(e),n=e=>h(r,e,"");return void 0===t?n:n(t)}};O.nil,O.append,O.get,O.set,O.assign,O.unset,O.remove;const E=Symbol("$__value"),$=Symbol("$__href");var j={cons:(e,t)=>Object.freeze({[$]:e,[E]:t}),isReference:e=>e&&void 0!==e[$],href:e=>e[$],value:e=>e[E]};const{jsonTypeOf:S}=l,A=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),T=e=>j.isReference(e.value)?j.value(e.value):e.value,I=r(((e,t)=>S(T(e),t))),k=(e,t)=>Object.freeze({...t,pointer:O.append(e,t.pointer),value:T(t)[e]}),V=r(((e,t)=>T(t).map(((r,n,o,a)=>e(k(n,t),n,o,a))))),x=r(((e,t)=>T(t).map(((e,r,n,o)=>k(r,t))).filter(((t,r,n,o)=>e(t,r,n,o))))),P=r(((e,t,r)=>T(r).reduce(((t,n,o)=>e(t,k(o,r),o)),t))),R=r(((e,t)=>T(t).every(((r,n,o,a)=>e(k(n,t),n,o,a))))),C=r(((e,t)=>T(t).some(((r,n,o,a)=>e(k(n,t),n,o,a)))));var U={nil:A,cons:(e,t="")=>Object.freeze({...A,id:t,instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:T,has:(e,t)=>e in T(t),typeOf:I,step:k,entries:e=>Object.keys(T(e)).map((t=>[t,k(t,e)])),keys:e=>Object.keys(T(e)),map:V,filter:x,reduce:P,every:R,some:C,length:e=>T(e).length},K=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,L=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,z=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,D=/\\([\u000b\u0020-\u00ff])/g,_=/([\\"])/g,N=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function J(e){var t=String(e);if(z.test(t))return t;if(t.length>0&&!L.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(_,"\\$1")+'"'}function q(e){this.parameters=Object.create(null),this.type=e}var B={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!N.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,a=Object.keys(t).sort(),i=0;i<a.length;i++){if(o=a[i],!z.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+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(!N.test(n))throw new TypeError("invalid media type");var o=new q(n.toLowerCase());if(-1!==r){var a,i,s;for(K.lastIndex=r;i=K.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}},F=async e=>Object.entries(await e),Z=r((async(e,t)=>(await t).map(e))),M=r((async(e,t,r)=>(await r).reduce((async(t,r)=>e(await t,r)),t))),W=r((async(e,t,r={})=>M((async(t,r)=>await e(r)?t.concat([r]):t),[],t,r))),G=r((async(e,t)=>{const r=await Z(e,t);return(await Promise.all(r)).some((e=>e))})),H=r((async(e,t)=>{const r=await Z(e,t);return(await Promise.all(r)).every((e=>e))})),Q=r(((e,t)=>e.reduce((async(e,t)=>t(await e)),t))),X={entries:F,map:Z,filter:W,reduce:M,some:G,every:H,pipeline:Q,all:e=>Promise.all(e),allValues:e=>Q([F,M((async(e,[t,r])=>(e[t]=await r,e)),{})],e)};X.entries,X.map,X.filter,X.reduce,X.some,X.every,X.pipeline,X.all,X.allValues;var Y=fetch;const{jsonTypeOf:ee,splitUrl:te,safeResolveUrl:re,pathRelative:ne}=l,oe={},ae={},ie=(e,t)=>{const r=e in ae?ae[e]:e;if(r in oe)return oe[r][t]},se={},ce={},le=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=te(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=ie(n,"baseToken"),a=ie(n,"anchorToken"),i=te(t)[0];if(!i&&!te(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const s=re(i,e[o]||""),[c,l]=te(s);delete e[o],l&&o===a&&(e[a]=a!==o?encodeURI(l):`#${encodeURI(l)}`),i&&(ce[i]=c);const u={},d=ie(n,"recursiveAnchorToken");let f;!0===e[d]&&(u[""]=`${c}#`,e[a]="",delete e[d]);const p=ie(n,"vocabularyToken");ee(e[p],"object")?(ae[c]=n,f=e[p],delete e[p]):(ae[c]=n,f={[n]:!0});const h={"":""};return se[c]={id:c,schemaVersion:n,schema:ue(e,c,n,O.nil,h,u),anchors:h,dynamicAnchors:u,vocabulary:f,validated:!1},c},ue=(e,t,r,n,o,a)=>{if(ee(e,"object")){const i="string"==typeof e.$schema?te(e.$schema)[0]:r,s=ie(i,"embeddedToken"),c=ie(i,"anchorToken");if("string"==typeof e[s]&&(s!==c||"#"!==e[s][0])){const n=re(t,e[s]);return e[s]=n,le(e,n,r),j.cons(e[s],e)}const l=ie(r,"anchorToken"),u=ie(r,"dynamicAnchorToken");"string"==typeof e[u]&&(a[e[u]]=`${t}#${encodeURI(n)}`,o[e[u]]=n,delete e[u]);const d=ie(r,"embeddedToken");if("string"==typeof e[l]){const t=l!==d?e[l]:e[l].slice(1);o[t]=n,delete e[l]}const f=ie(r,"jrefToken");if("string"==typeof e[f])return j.cons(e[f],e);for(const i in e)e[i]=ue(e[i],t,r,O.append(i,n),o,a);return e}return Array.isArray(e)?e.map(((e,i)=>ue(e,t,r,O.append(i,n),o,a))):e},de=e=>se[ce[e]]||se[e],fe=Object.freeze({id:"",schemaVersion:void 0,vocabulary:{},pointer:O.nil,schema:void 0,value:void 0,anchors:{},dynamicAnchors:{},validated:!0}),pe=async(e,t=fe)=>{const r=re(me(t),e),[n,o]=te(r);if(!(e=>e in se||e in ce)(n)){const e=await Y(n,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error(`Failed to retrieve schema with id: ${n}`);if(e.headers.has("content-type")){const t=B.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${n} is not a schema. Found a document with media type: ${t}`)}le(await e.json(),n)}const a=de(n),i="/"!==o[0]?ye(a,o):o,s=Object.freeze({...a,pointer:i,value:O.get(i,a.schema)});return he(s)},he=e=>j.isReference(e.value)?pe(j.href(e.value),e):e,ye=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},me=e=>`${e.id}#${encodeURI(e.pointer)}`,ve=e=>j.isReference(e.value)?j.value(e.value):e.value,be=(e,t)=>{const r=de(t.id),n=Object.freeze({...t,pointer:O.append(e,t.pointer),value:ve(t)[e],validated:r.validated});return he(n)},ge=r(((e,t)=>X.pipeline([ve,X.map((async(r,n)=>e(await be(n,t),n))),X.all],t))),we={parentId:"",parentDialect:"",includeEmbedded:!0},Oe=(e,t)=>{if(t.startsWith("file://")){const r=e.slice(7,e.lastIndexOf("/"));return""===e?"":ne(r,t.slice(7))}return t};var Ee={setConfig:(e,t,r)=>{oe[e]||(oe[e]={}),oe[e][t]=r},getConfig:ie,add:le,get:pe,markValidated:e=>{se[e].validated=!0},uri:me,value:ve,getAnchorPointer:ye,typeOf:(e,t)=>ee(ve(e),t),has:(e,t)=>e in ve(t),step:be,keys:e=>Object.keys(ve(e)),entries:e=>X.pipeline([ve,Object.keys,X.map((async t=>[t,await be(t,e)])),X.all],e),map:ge,length:e=>ve(e).length,toSchema:(e,t={})=>{const r={...we,...t},n=JSON.parse(JSON.stringify(e.schema,((t,n)=>{if(!j.isReference(n))return n;const o=j.value(n),a=o.$schema||e.schemaVersion,i=ie(a,"embeddedToken");return!r.includeEmbedded&&i in o?void 0:j.value(n)}))),o=ie(e.schemaVersion,"dynamicAnchorToken");Object.entries(e.dynamicAnchors).forEach((([e,t])=>{const r=te(t)[1];O.assign(r,n,{[o]:e,...O.get(r,n)})}));const a=ie(e.schemaVersion,"anchorToken");Object.entries(e.anchors).filter((([e])=>""!==e)).forEach((([e,t])=>{O.assign(t,n,{[a]:e,...O.get(t,n)})}));const i=ie(e.schemaVersion,"baseToken"),s=Oe(r.parentId,e.id),c=r.parentDialect===e.schemaVersion?"":e.schemaVersion;return{...s&&{[i]:s},...c&&{$schema:c},...n}}};Ee.setConfig,Ee.getConfig,Ee.add,Ee.get,Ee.markValidated,Ee.uri,Ee.value,Ee.getAnchorPointer,Ee.typeOf,Ee.has,Ee.step,Ee.keys,Ee.entries,Ee.map,Ee.length,Ee.toSchema;class $e extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var je=$e;const{splitUrl:Se}=l,Ae="FLAG",Te="BASIC",Ie="DETAILED",ke="VERBOSE";let Ve=Ie,xe=!0;const Pe=async e=>{const t={metaData:{}};return{ast:t,schemaUri:await _e(e,t)}},Re=r((({ast:e,schemaUri:t},r,n=Ae)=>{if(![Ae,Te,Ie,ke].includes(n))throw Error(`The '${n}' error format is not supported`);const o=[],i=a.subscribe("result",Ce(n,o));return Je(t,r,e,{}),a.unsubscribe(i),o[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!==Ae&&!t.valid)&&n.errors.unshift(...o)}r[r.length-1]=n,t[0]=n}}},Ue={},Ke=e=>Ue[e],Le=e=>e in Ue,ze={},De={},_e=async(e,t)=>{if(e=await Ne(e),!Le(`${e.schemaVersion}#validate`)){const t=await Ee.get(e.schemaVersion);(Ee.getConfig(t.id,"mandatoryVocabularies")||[]).forEach((e=>{if(!t.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)})),Object.entries(t.vocabulary).forEach((([e,r])=>{if(e in ze)Object.entries(ze[e]).forEach((([e,r])=>{((e,t)=>{Ue[e]={collectEvaluatedItems:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&new Set,collectEvaluatedProperties:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&[],...t}})(`${t.id}#${e}`,r)}));else if(r)throw Error(`Missing required vocabulary: ${e}`)}))}if(xe&&!e.validated){if(Ee.markValidated(e.id),!(e.schemaVersion in De)){const t=await Ee.get(e.schemaVersion),r=await Pe(t);De[t.id]=Re(r)}const t=U.cons(e.schema,e.id),r=De[e.schemaVersion](t,Ve);if(!r.valid)throw new je(r)}return e.id in t.metaData||(t.metaData[e.id]={id:e.id,dynamicAnchors:e.dynamicAnchors,anchors:e.anchors}),Ke(`${e.schemaVersion}#validate`).compile(e,t)},Ne=async e=>Ee.typeOf(e,"string")?Ne(await Ee.get(Ee.value(e),e)):e,Je=(e,t,r,n)=>{const o=qe(e,r),a=Se(e)[0];return Ke(o).interpret(e,t,r,{...r.metaData[a].dynamicAnchors,...n})},qe=(e,t)=>{if(!(e in t))throw Error(`No schema found at ${e}`);return t[e][0]};var Be={validate:async(e,t,r)=>{const n=await Pe(e),o=(e,t)=>Re(n,U.cons(e),t);return void 0===t?o:o(t,r)},compile:Pe,interpret:Re,setMetaOutputFormat:e=>{Ve=e},setShouldMetaValidate:e=>{xe=e},FLAG:Ae,BASIC:Te,DETAILED:Ie,VERBOSE:ke,add:(e,t="",r="")=>{const n=Ee.add(e,t,r);delete De[n]},getKeyword:Ke,hasKeyword:Le,defineVocabulary:(e,t)=>{ze[e]=t},compileSchema:_e,interpretSchema:Je,collectEvaluatedProperties:(e,t,r,n,o)=>{const a=qe(e,r);return Ke(a).collectEvaluatedProperties(e,t,r,n,o)},collectEvaluatedItems:(e,t,r,n,o)=>{const a=qe(e,r);return Ke(a).collectEvaluatedItems(e,t,r,n,o)}};var Fe={compile:e=>Ee.value(e),interpret:()=>!0};var Ze={compile:async(e,t)=>{const r=Ee.uri(e);if(!(r in t)){t[r]=!1;const n=Ee.value(e);if(!["object","boolean"].includes(typeof n))throw Error(`No schema found at '${Ee.uri(e)}'`);t[r]=[`${e.schemaVersion}#validate`,Ee.uri(e),"boolean"==typeof n?n:await X.pipeline([Ee.entries,X.map((([t,r])=>[`${e.schemaVersion}#${t}`,r])),X.filter((([t])=>Be.hasKeyword(t)&&t!==`${e.schemaVersion}#validate`)),X.map((async([r,n])=>{const o=await Be.getKeyword(r).compile(n,t,e);return[r,Ee.uri(n),o]})),X.all],e)]}return r},interpret:(e,t,r,n)=>{const[o,i,s]=r[e];a.publishSync("result.start");const c="boolean"==typeof s?s:s.every((([e,o,i])=>{a.publishSync("result.start");const s=Be.getKeyword(e).interpret(i,t,r,n);return a.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:U.uri(t),valid:s,ast:i}),a.publishSync("result.end"),s}));return a.publishSync("result",{keyword:o,absoluteKeywordLocation:i,instanceLocation:U.uri(t),valid:c,ast:e}),a.publishSync("result.end"),c},collectEvaluatedProperties:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&[]:a.filter((([e])=>!o||!e.endsWith("#unevaluatedProperties"))).reduce(((e,[o,,a])=>{const i=e&&Be.getKeyword(o).collectEvaluatedProperties(a,t,r,n);return!1!==i&&[...e,...i]}),[])},collectEvaluatedItems:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&new Set:a.filter((([e])=>!o||!e.endsWith("#unevaluatedItems"))).reduce(((e,[o,,a])=>{const i=!1!==e&&Be.getKeyword(o).collectEvaluatedItems(a,t,r,n);return!1!==i&&new Set([...e,...i])}),new Set)}},Me={metaData:Fe,validate:Ze},We=e("default",{Core:Be,Schema:Ee,Instance:U,Reference:j,Keywords:Me,InvalidSchemaError:je});e("Core",We.Core),e("Schema",We.Schema),e("Instance",We.Instance),e("Reference",We.Reference),e("Keywords",We.Keywords),e("InvalidSchemaError",We.InvalidSchemaError)}}})); | ||
//# 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 = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.JSC = {})); | ||
})(this, (function (exports) { 'use strict'; | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('url-resolve-browser')) : | ||
typeof define === 'function' && define.amd ? define(['exports', 'url-resolve-browser'], factory) : | ||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.JSC = {}, global.urlResolveBrowser)); | ||
})(this, (function (exports, urlResolveBrowser) { 'use strict'; | ||
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } | ||
var urlResolveBrowser__default = /*#__PURE__*/_interopDefaultLegacy(urlResolveBrowser); | ||
var justCurryIt = curry; | ||
@@ -403,213 +407,2 @@ | ||
var urlResolveBrowser = urlResolve; | ||
/* | ||
The majority of the module is built by following RFC1808 | ||
url: https://tools.ietf.org/html/rfc1808 | ||
*/ | ||
// adds a slash at end if not present | ||
function _addSlash (url) { | ||
return url + (url[url.length-1] === '/' ? '' : '/'); | ||
} | ||
// resolve the ..'s (directory up) and such | ||
function _pathResolve (path) { | ||
let pathSplit = path.split('/'); | ||
// happens when path starts with / | ||
if (pathSplit[0] === '') { | ||
pathSplit = pathSplit.slice(1); | ||
} | ||
// let segmentCount = 0; // number of segments that have been passed | ||
let resultArray = []; | ||
pathSplit.forEach((current, index) => { | ||
// skip occurances of '.' | ||
if (current !== '.') { | ||
if (current === '..') { | ||
resultArray.pop(); // remove previous | ||
} else if (current !== '' || index === pathSplit.length - 1) { | ||
resultArray.push(current); | ||
} | ||
} | ||
}); | ||
return '/' + resultArray.join('/'); | ||
} | ||
// parses a base url string into an object containing host, path and query | ||
function _baseParse (base) { | ||
const resultObject = { | ||
host: '', | ||
path: '', | ||
query: '', | ||
protocol: '' | ||
}; | ||
let path = base; | ||
let protocolEndIndex = base.indexOf('//'); | ||
resultObject.protocol = path.substring(0, protocolEndIndex); | ||
protocolEndIndex += 2; // add two to pass double slash | ||
const pathIndex = base.indexOf('/', protocolEndIndex); | ||
const queryIndex = base.indexOf('?'); | ||
const hashIndex = base.indexOf('#'); | ||
if (hashIndex !== -1) { | ||
path = path.substring(0, hashIndex); // remove hash, not needed for base | ||
} | ||
if (queryIndex !== -1) { | ||
const query = path.substring(queryIndex); // remove query, save in return obj | ||
resultObject.query = query; | ||
path = path.substring(0, queryIndex); | ||
} | ||
if (pathIndex !== -1) { | ||
const host = path.substring(0, pathIndex); // separate host & path | ||
resultObject.host = host; | ||
path = path.substring(pathIndex); | ||
resultObject.path = path; | ||
} else { | ||
resultObject.host = path; // there was no path, therefore path is host | ||
} | ||
return resultObject; | ||
} | ||
// https://tools.ietf.org/html/rfc3986#section-3.1 | ||
const _scheme = '[a-z][a-z0-9+.-]*'; // ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )] | ||
const _isAbsolute = new RegExp(`^(${_scheme}:)?//`, 'i'); | ||
// parses a relative url string into an object containing the href, | ||
// hash, query and whether it is a net path, absolute path or relative path | ||
function _relativeParse (relative) { | ||
const resultObject = { | ||
href: relative, // href is always what was passed through | ||
hash: '', | ||
query: '', | ||
netPath: false, | ||
absolutePath: false, | ||
relativePath: false | ||
}; | ||
// check for protocol | ||
// if protocol exists, is net path (absolute URL) | ||
if (_isAbsolute.test(relative)) { | ||
resultObject.netPath = true; | ||
// return, in this case the relative is the resolved url, no need to parse. | ||
return resultObject; | ||
} | ||
// if / is first, this is an absolute path, | ||
// I.E. it overwrites the base URL's path | ||
if (relative[0] === '/') { | ||
resultObject.absolutePath = true; | ||
// return resultObject | ||
} else if (relative !== '') { | ||
resultObject.relativePath = true; | ||
} | ||
let path = relative; | ||
const queryIndex = relative.indexOf('?'); | ||
const hashIndex = relative.indexOf('#'); | ||
if (hashIndex !== -1) { | ||
const hash = path.substring(hashIndex); | ||
resultObject.hash = hash; | ||
path = path.substring(0, hashIndex); | ||
} | ||
if (queryIndex !== -1) { | ||
const query = path.substring(queryIndex); | ||
resultObject.query = query; | ||
path = path.substring(0, queryIndex); | ||
} | ||
resultObject.path = path; // whatever is left is path | ||
return resultObject; | ||
} | ||
function _shouldAddSlash (url) { | ||
const protocolIndex = url.indexOf('//') + 2; | ||
const noPath = !(url.includes('/', protocolIndex)); | ||
const noQuery = !(url.includes('?', protocolIndex)); | ||
const noHash = !(url.includes('#', protocolIndex)); | ||
return (noPath && noQuery && noHash); | ||
} | ||
function _shouldAddProtocol (url) { | ||
return url.startsWith('//'); | ||
} | ||
/* | ||
* PRECONDITION: Base is a fully qualified URL. e.g. http://example.com/ | ||
* optional: path, query or hash | ||
* returns the resolved url | ||
*/ | ||
function urlResolve (base, relative) { | ||
base = base.trim(); | ||
relative = relative.trim(); | ||
// about is always absolute | ||
if (relative.startsWith('about:')) { | ||
return relative; | ||
} | ||
const baseObj = _baseParse(base); | ||
const relativeObj = _relativeParse(relative); | ||
if (!baseObj.protocol && !relativeObj.netPath) { | ||
throw new Error('Error, protocol is not specified'); | ||
} | ||
if (relativeObj.netPath) { // relative is full qualified URL | ||
if (_shouldAddProtocol(relativeObj.href)) { | ||
relativeObj.href = baseObj.protocol + relativeObj.href; | ||
} | ||
if (_shouldAddSlash(relativeObj.href)) { | ||
return _addSlash(relativeObj.href); | ||
} | ||
return relativeObj.href; | ||
} else if (relativeObj.absolutePath) { // relative is an absolute path | ||
const {path, query, hash} = relativeObj; | ||
return baseObj.host + _pathResolve(path) + query + hash; | ||
} else if (relativeObj.relativePath) { // relative is a relative path | ||
const {path, query, hash} = relativeObj; | ||
let basePath = baseObj.path; | ||
let resultString = baseObj.host; | ||
let resolvePath; | ||
if (path.length === 0) { | ||
resolvePath = basePath; | ||
} else { | ||
// remove last segment if no slash at end | ||
basePath = basePath.substring(0, basePath.lastIndexOf('/')); | ||
resolvePath = _pathResolve(basePath + '/' + path); | ||
} | ||
// if result is just the base host, add / | ||
if ((resolvePath === '') && (!query) && (!hash)) { | ||
resultString += '/'; | ||
} else { | ||
resultString += resolvePath + query + hash; | ||
} | ||
return resultString; | ||
} else { | ||
const {host, path, query} = baseObj; | ||
// when path and query aren't supplied add slash | ||
if ((!path) && (!query)) { | ||
return _addSlash(host); | ||
} | ||
return host + path + query + relativeObj.hash; | ||
} | ||
} | ||
const isObject = (value) => typeof value === "object" && !Array.isArray(value) && value !== null; | ||
@@ -642,3 +435,3 @@ const isType = { | ||
const safeResolveUrl$1 = (contextUrl, url) => { | ||
const resolvedUrl = urlResolveBrowser(contextUrl, url); | ||
const resolvedUrl = urlResolveBrowser__default["default"](contextUrl, url); | ||
const contextId = splitUrl$2(contextUrl)[0]; | ||
@@ -645,0 +438,0 @@ if (contextId && getScheme(resolvedUrl) === "file" && getScheme(contextId) !== "file") { |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).JSC={})}(this,(function(e){"use strict";var t=function(e,t){return function r(){null==t&&(t=e.length);var n=[].slice.call(arguments);return n.length>=t?e.apply(this,n):function(){return r.apply(this,n.concat([].slice.call(arguments)))}}};var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var n=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e,t){var n,o;n="object"==typeof window&&window||r,o={},n.PubSub=o,function(e){var t={},r=-1,n="*";function o(e){var t;for(t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function a(e){return function(){throw e}}function i(e,t,r){try{e(t,r)}catch(e){setTimeout(a(e),0)}}function s(e,t,r){e(t,r)}function c(e,r,n,o){var a,c=t[r],l=o?s:i;if(Object.prototype.hasOwnProperty.call(t,r))for(a in c)Object.prototype.hasOwnProperty.call(c,a)&&l(c[a],e,n)}function l(e,t,r){return function(){var o=String(e),a=o.lastIndexOf(".");for(c(e,e,t,r);-1!==a;)a=(o=o.substr(0,a)).lastIndexOf("."),c(e,o,t,r);c(e,n,t,r)}}function u(e){var r=String(e);return Boolean(Object.prototype.hasOwnProperty.call(t,r)&&o(t[r]))}function f(e){for(var t=String(e),r=u(t)||u(n),o=t.lastIndexOf(".");!r&&-1!==o;)o=(t=t.substr(0,o)).lastIndexOf("."),r=u(t);return r}function d(e,t,r,n){var o=l(e="symbol"==typeof e?e.toString():e,t,n);return!!f(e)&&(!0===r?o():setTimeout(o,0),!0)}e.publish=function(t,r){return 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,Object.prototype.hasOwnProperty.call(t,e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeAll=function(t){return e.subscribe(n,t)},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n,o=0;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)){for(n in t[r])o++;break}return o},e.getSubscriptions=function(e){var r,n=[];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,a,i=function(e){var r;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e))return!0;return!1},s="string"==typeof r&&(Object.prototype.hasOwnProperty.call(t,r)||i(r)),c=!s&&"string"==typeof r,l="function"==typeof r,u=!1;if(!s){for(n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(o=t[n],c&&o[r]){delete o[r],u=r;break}if(l)for(a in o)Object.prototype.hasOwnProperty.call(o,a)&&o[a]===r&&(delete o[a],u=!0)}return u}e.clearSubscriptions(r)}}(o),void 0!==e&&e.exports&&(t=e.exports=o),t.PubSub=o,e.exports=t=o}));n.PubSub;var o=function(e,t){if(e=e.trim(),(t=t.trim()).startsWith("about:"))return t;const r=function(e){const t={host:"",path:"",query:"",protocol:""};let r=e,n=e.indexOf("//");t.protocol=r.substring(0,n),n+=2;const o=e.indexOf("/",n),a=e.indexOf("?"),i=e.indexOf("#");-1!==i&&(r=r.substring(0,i));if(-1!==a){const e=r.substring(a);t.query=e,r=r.substring(0,a)}if(-1!==o){const e=r.substring(0,o);t.host=e,r=r.substring(o),t.path=r}else t.host=r;return t}(e),n=function(e){const t={href:e,hash:"",query:"",netPath:!1,absolutePath:!1,relativePath:!1};if(s.test(e))return t.netPath=!0,t;"/"===e[0]?t.absolutePath=!0:""!==e&&(t.relativePath=!0);let r=e;const n=e.indexOf("?"),o=e.indexOf("#");if(-1!==o){const e=r.substring(o);t.hash=e,r=r.substring(0,o)}if(-1!==n){const e=r.substring(n);t.query=e,r=r.substring(0,n)}return t.path=r,t}(t);if(!r.protocol&&!n.netPath)throw new Error("Error, protocol is not specified");if(n.netPath)return n.href.startsWith("//")&&(n.href=r.protocol+n.href),function(e){const t=e.indexOf("//")+2,r=!e.includes("/",t),n=!e.includes("?",t),o=!e.includes("#",t);return r&&n&&o}(n.href)?a(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+i(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let a,s=r.path,c=r.host;return 0===e.length?a=s:(s=s.substring(0,s.lastIndexOf("/")),a=i(s+"/"+e)),c+=""!==a||t||o?a+t+o:"/",c}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:a(e)}};function a(e){return e+("/"===e[e.length-1]?"":"/")}function i(e){let t=e.split("/");""===t[0]&&(t=t.slice(1));let r=[];return t.forEach(((e,n)=>{"."!==e&&(".."===e?r.pop():""===e&&n!==t.length-1||r.push(e))})),"/"+r.join("/")}const s=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");const c={null:e=>null===e,boolean:e=>"boolean"==typeof e,object:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,array:e=>Array.isArray(e),number:e=>"number"==typeof e,integer:e=>Number.isInteger(e),string:e=>"string"==typeof e},l=e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),o=e.slice(r+1);return[decodeURI(n),decodeURI(o)]},u=e=>{const t=RegExp(/^(.+):\/\//).exec(e);return t?t[1]:""};var f={jsonTypeOf:(e,t)=>c[t](e),splitUrl:l,safeResolveUrl:(e,t)=>{const r=o(e,t),n=l(e)[0];if(n&&"file"===u(r)&&"file"!==u(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},pathRelative:(e,t)=>{if(e===t)return"";let r=1;const n=e.length-1,o=t.length-r,a=n<o?n:o;let i=-1,s=0;for(;s<a;s++){const n=e.charCodeAt(s+1);if(n!==t.charCodeAt(r+s))break;47===n&&(i=s)}if(o>a){if(47===t.charCodeAt(r+s))return t.slice(r+s+1);if(0===s)return t.slice(r+s)}n>a&&(47===e.charCodeAt(s+1)?i=s:0===a&&(i=0));let c="";for(s=i+2;s<=e.length;++s)s!==e.length&&47!==e.charCodeAt(s)||(c+=0===c.length?"..":"/..");return r+=i,c.length>0?`${c}${t.slice(r,t.length)}`:(47===t.charCodeAt(r)&&++r,t.slice(r,t.length))}};const d=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(g)},p=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:p(e,O(t,o,n),r,m(o,n))}}if(Array.isArray(t)){const n=[...t];return n[w(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:O(t,e[0],n)},h=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||E(t)){const o=e.shift();h(e,O(t,o,n),r,m(o,n))}else{t[w(t,e[0])]=r}},y=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=O(t,n,r);return{...t,[n]:y(e,o,m(n,r))}}if(Array.isArray(t))return t.filter(((t,r)=>r!=e[0]));if("object"==typeof t&&null!==t){const{[e[0]]:r,...n}=t;return n}return O(t,e[0],r)}},b=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=O(t,n,r);b(e,o,m(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:O(t,e[0],r)},m=t(((e,t)=>t+"/"+v(e))),v=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),g=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),w=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,O=(e,t,r="")=>{if(void 0===e)throw TypeError(`Value at '${r}' is undefined and does not have property '${t}'`);if(null===e)throw TypeError(`Value at '${r}' is null and does not have property '${t}'`);if(E(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[w(e,t)]},E=e=>null===e||"object"!=typeof e;var j={nil:"",append:m,get:(e,t)=>{const r=d(e),n=e=>r.reduce((([e,t],r)=>[O(e,r,t),m(r,t)]),[e,""])[0];return void 0===t?n:n(t)},set:(e,r,n)=>{const o=d(e),a=t(((e,t)=>p(o,e,t,"")));return void 0===r?a:a(r,n)},assign:(e,r,n)=>{const o=d(e),a=t(((e,t)=>h(o,e,t,"")));return void 0===r?a:a(r,n)},unset:(e,t)=>{const r=d(e),n=e=>y(r,e,"");return void 0===t?n:n(t)},remove:(e,t)=>{const r=d(e),n=e=>b(r,e,"");return void 0===t?n:n(t)}};j.nil,j.append,j.get,j.set,j.assign,j.unset,j.remove;const $=Symbol("$__value"),S=Symbol("$__href");var A={cons:(e,t)=>Object.freeze({[S]:e,[$]:t}),isReference:e=>e&&void 0!==e[S],href:e=>e[S],value:e=>e[$]};const{jsonTypeOf:x}=f,T=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),P=e=>A.isReference(e.value)?A.value(e.value):e.value,I=t(((e,t)=>x(P(e),t))),k=(e,t)=>Object.freeze({...t,pointer:j.append(e,t.pointer),value:P(t)[e]}),V=t(((e,t)=>P(t).map(((r,n,o,a)=>e(k(n,t),n,o,a))))),R=t(((e,t)=>P(t).map(((e,r,n,o)=>k(r,t))).filter(((t,r,n,o)=>e(t,r,n,o))))),C=t(((e,t,r)=>P(r).reduce(((t,n,o)=>e(t,k(o,r),o)),t))),U=t(((e,t)=>P(t).every(((r,n,o,a)=>e(k(n,t),n,o,a))))),z=t(((e,t)=>P(t).some(((r,n,o,a)=>e(k(n,t),n,o,a)))));var K={nil:T,cons:(e,t="")=>Object.freeze({...T,id:t,instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:P,has:(e,t)=>e in P(t),typeOf:I,step:k,entries:e=>Object.keys(P(e)).map((t=>[t,k(t,e)])),keys:e=>Object.keys(P(e)),map:V,filter:R,reduce:C,every:U,some:z,length:e=>P(e).length},L=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,q=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,_=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,D=/\\([\u000b\u0020-\u00ff])/g,N=/([\\"])/g,J=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function B(e){var t=String(e);if(_.test(t))return t;if(t.length>0&&!q.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(N,"\\$1")+'"'}function F(e){this.parameters=Object.create(null),this.type=e}var W={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!J.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+"="+B(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(!J.test(n))throw new TypeError("invalid media type");var o=new F(n.toLowerCase());if(-1!==r){var a,i,s;for(L.lastIndex=r;i=L.exec(t);){if(i.index!==r)throw new TypeError("invalid parameter format");r+=i[0].length,a=i[1].toLowerCase(),'"'===(s=i[2])[0]&&(s=s.substr(1,s.length-2).replace(D,"$1")),o.parameters[a]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},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)};ee.entries,ee.map,ee.filter,ee.reduce,ee.some,ee.every,ee.pipeline,ee.all,ee.allValues;var te=fetch;const{jsonTypeOf:re,splitUrl:ne,safeResolveUrl:oe,pathRelative:ae}=f,ie={},se={},ce=(e,t)=>{const r=e in se?se[e]:e;if(r in ie)return ie[r][t]},le={},ue={},fe=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=ne(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=ce(n,"baseToken"),a=ce(n,"anchorToken"),i=ne(t)[0];if(!i&&!ne(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const s=oe(i,e[o]||""),[c,l]=ne(s);delete e[o],l&&o===a&&(e[a]=a!==o?encodeURI(l):`#${encodeURI(l)}`),i&&(ue[i]=c);const u={},f=ce(n,"recursiveAnchorToken");let d;!0===e[f]&&(u[""]=`${c}#`,e[a]="",delete e[f]);const p=ce(n,"vocabularyToken");re(e[p],"object")?(se[c]=n,d=e[p],delete e[p]):(se[c]=n,d={[n]:!0});const h={"":""};return le[c]={id:c,schemaVersion:n,schema:de(e,c,n,j.nil,h,u),anchors:h,dynamicAnchors:u,vocabulary:d,validated:!1},c},de=(e,t,r,n,o,a)=>{if(re(e,"object")){const i="string"==typeof e.$schema?ne(e.$schema)[0]:r,s=ce(i,"embeddedToken"),c=ce(i,"anchorToken");if("string"==typeof e[s]&&(s!==c||"#"!==e[s][0])){const n=oe(t,e[s]);return e[s]=n,fe(e,n,r),A.cons(e[s],e)}const l=ce(r,"anchorToken"),u=ce(r,"dynamicAnchorToken");"string"==typeof e[u]&&(a[e[u]]=`${t}#${encodeURI(n)}`,o[e[u]]=n,delete e[u]);const f=ce(r,"embeddedToken");if("string"==typeof e[l]){const t=l!==f?e[l]:e[l].slice(1);o[t]=n,delete e[l]}const d=ce(r,"jrefToken");if("string"==typeof e[d])return A.cons(e[d],e);for(const i in e)e[i]=de(e[i],t,r,j.append(i,n),o,a);return e}return Array.isArray(e)?e.map(((e,i)=>de(e,t,r,j.append(i,n),o,a))):e},pe=e=>le[ue[e]]||le[e],he=Object.freeze({id:"",schemaVersion:void 0,vocabulary:{},pointer:j.nil,schema:void 0,value:void 0,anchors:{},dynamicAnchors:{},validated:!0}),ye=async(e,t=he)=>{const r=oe(ve(t),e),[n,o]=ne(r);if(!(e=>e in le||e in ue)(n)){const e=await te(n,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error(`Failed to retrieve schema with id: ${n}`);if(e.headers.has("content-type")){const t=W.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${n} is not a schema. Found a document with media type: ${t}`)}fe(await e.json(),n)}const a=pe(n),i="/"!==o[0]?me(a,o):o,s=Object.freeze({...a,pointer:i,value:j.get(i,a.schema)});return be(s)},be=e=>A.isReference(e.value)?ye(A.href(e.value),e):e,me=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},ve=e=>`${e.id}#${encodeURI(e.pointer)}`,ge=e=>A.isReference(e.value)?A.value(e.value):e.value,we=(e,t)=>{const r=pe(t.id),n=Object.freeze({...t,pointer:j.append(e,t.pointer),value:ge(t)[e],validated:r.validated});return be(n)},Oe=t(((e,t)=>ee.pipeline([ge,ee.map((async(r,n)=>e(await we(n,t),n))),ee.all],t))),Ee={parentId:"",parentDialect:"",includeEmbedded:!0},je=(e,t)=>{if(t.startsWith("file://")){const r=e.slice(7,e.lastIndexOf("/"));return""===e?"":ae(r,t.slice(7))}return t};var $e={setConfig:(e,t,r)=>{ie[e]||(ie[e]={}),ie[e][t]=r},getConfig:ce,add:fe,get:ye,markValidated:e=>{le[e].validated=!0},uri:ve,value:ge,getAnchorPointer:me,typeOf:(e,t)=>re(ge(e),t),has:(e,t)=>e in ge(t),step:we,keys:e=>Object.keys(ge(e)),entries:e=>ee.pipeline([ge,Object.keys,ee.map((async t=>[t,await we(t,e)])),ee.all],e),map:Oe,length:e=>ge(e).length,toSchema:(e,t={})=>{const r={...Ee,...t},n=JSON.parse(JSON.stringify(e.schema,((t,n)=>{if(!A.isReference(n))return n;const o=A.value(n),a=o.$schema||e.schemaVersion,i=ce(a,"embeddedToken");return!r.includeEmbedded&&i in o?void 0:A.value(n)}))),o=ce(e.schemaVersion,"dynamicAnchorToken");Object.entries(e.dynamicAnchors).forEach((([e,t])=>{const r=ne(t)[1];j.assign(r,n,{[o]:e,...j.get(r,n)})}));const a=ce(e.schemaVersion,"anchorToken");Object.entries(e.anchors).filter((([e])=>""!==e)).forEach((([e,t])=>{j.assign(t,n,{[a]:e,...j.get(t,n)})}));const i=ce(e.schemaVersion,"baseToken"),s=je(r.parentId,e.id),c=r.parentDialect===e.schemaVersion?"":e.schemaVersion;return{...s&&{[i]:s},...c&&{$schema:c},...n}}};$e.setConfig,$e.getConfig,$e.add,$e.get,$e.markValidated,$e.uri,$e.value,$e.getAnchorPointer,$e.typeOf,$e.has,$e.step,$e.keys,$e.entries,$e.map,$e.length,$e.toSchema;class Se extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var Ae=Se;const{splitUrl:xe}=f,Te="FLAG",Pe="BASIC",Ie="DETAILED",ke="VERBOSE";let Ve=Ie,Re=!0;const Ce=async e=>{const t={metaData:{}};return{ast:t,schemaUri:await Ne(e,t)}},Ue=t((({ast:e,schemaUri:t},r,o=Te)=>{if(![Te,Pe,Ie,ke].includes(o))throw Error(`The '${o}' error format is not supported`);const a=[],i=n.subscribe("result",ze(o,a));return Be(t,r,e,{}),n.unsubscribe(i),a[0]})),ze=(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===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}}},Ke={},Le=e=>Ke[e],qe=e=>e in Ke,_e={},De={},Ne=async(e,t)=>{if(e=await Je(e),!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 _e)Object.entries(_e[e]).forEach((([e,r])=>{((e,t)=>{Ke[e]={collectEvaluatedItems:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&new Set,collectEvaluatedProperties:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&[],...t}})(`${t.id}#${e}`,r)}));else if(r)throw Error(`Missing required vocabulary: ${e}`)}))}if(Re&&!e.validated){if($e.markValidated(e.id),!(e.schemaVersion in De)){const t=await $e.get(e.schemaVersion),r=await Ce(t);De[t.id]=Ue(r)}const t=K.cons(e.schema,e.id),r=De[e.schemaVersion](t,Ve);if(!r.valid)throw new Ae(r)}return e.id in t.metaData||(t.metaData[e.id]={id:e.id,dynamicAnchors:e.dynamicAnchors,anchors:e.anchors}),Le(`${e.schemaVersion}#validate`).compile(e,t)},Je=async e=>$e.typeOf(e,"string")?Je(await $e.get($e.value(e),e)):e,Be=(e,t,r,n)=>{const o=Fe(e,r),a=xe(e)[0];return Le(o).interpret(e,t,r,{...r.metaData[a].dynamicAnchors,...n})},Fe=(e,t)=>{if(!(e in t))throw Error(`No schema found at ${e}`);return t[e][0]};var We={validate:async(e,t,r)=>{const n=await Ce(e),o=(e,t)=>Ue(n,K.cons(e),t);return void 0===t?o:o(t,r)},compile:Ce,interpret:Ue,setMetaOutputFormat:e=>{Ve=e},setShouldMetaValidate:e=>{Re=e},FLAG:Te,BASIC:Pe,DETAILED:Ie,VERBOSE:ke,add:(e,t="",r="")=>{const n=$e.add(e,t,r);delete De[n]},getKeyword:Le,hasKeyword:qe,defineVocabulary:(e,t)=>{_e[e]=t},compileSchema:Ne,interpretSchema:Be,collectEvaluatedProperties:(e,t,r,n,o)=>{const a=Fe(e,r);return Le(a).collectEvaluatedProperties(e,t,r,n,o)},collectEvaluatedItems:(e,t,r,n,o)=>{const a=Fe(e,r);return Le(a).collectEvaluatedItems(e,t,r,n,o)}};var Ze={compile:e=>$e.value(e),interpret:()=>!0};var Me={compile:async(e,t)=>{const r=$e.uri(e);if(!(r in t)){t[r]=!1;const n=$e.value(e);if(!["object","boolean"].includes(typeof n))throw Error(`No schema found at '${$e.uri(e)}'`);t[r]=[`${e.schemaVersion}#validate`,$e.uri(e),"boolean"==typeof n?n:await ee.pipeline([$e.entries,ee.map((([t,r])=>[`${e.schemaVersion}#${t}`,r])),ee.filter((([t])=>We.hasKeyword(t)&&t!==`${e.schemaVersion}#validate`)),ee.map((async([r,n])=>{const o=await We.getKeyword(r).compile(n,t,e);return[r,$e.uri(n),o]})),ee.all],e)]}return r},interpret:(e,t,r,o)=>{const[a,i,s]=r[e];n.publishSync("result.start");const c="boolean"==typeof s?s:s.every((([e,a,i])=>{n.publishSync("result.start");const s=We.getKeyword(e).interpret(i,t,r,o);return n.publishSync("result",{keyword:e,absoluteKeywordLocation:a,instanceLocation:K.uri(t),valid:s,ast:i}),n.publishSync("result.end"),s}));return n.publishSync("result",{keyword:a,absoluteKeywordLocation:i,instanceLocation:K.uri(t),valid:c,ast:e}),n.publishSync("result.end"),c},collectEvaluatedProperties:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&[]:a.filter((([e])=>!o||!e.endsWith("#unevaluatedProperties"))).reduce(((e,[o,,a])=>{const i=e&&We.getKeyword(o).collectEvaluatedProperties(a,t,r,n);return!1!==i&&[...e,...i]}),[])},collectEvaluatedItems:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&new Set:a.filter((([e])=>!o||!e.endsWith("#unevaluatedItems"))).reduce(((e,[o,,a])=>{const i=!1!==e&&We.getKeyword(o).collectEvaluatedItems(a,t,r,n);return!1!==i&&new Set([...e,...i])}),new Set)}},Ge={metaData:Ze,validate:Me},He={Core:We,Schema:$e,Instance:K,Reference:A,Keywords:Ge,InvalidSchemaError:Ae},Qe=He.Core,Xe=He.Schema,Ye=He.Instance,et=He.Reference,tt=He.Keywords,rt=He.InvalidSchemaError;e.Core=Qe,e.Instance=Ye,e.InvalidSchemaError=rt,e.Keywords=tt,e.Reference=et,e.Schema=Xe,e.default=He,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("url-resolve-browser")):"function"==typeof define&&define.amd?define(["exports","url-resolve-browser"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).JSC={},e.urlResolveBrowser)}(this,(function(e,t){"use strict";function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=r(t),o=function(e,t){return function r(){null==t&&(t=e.length);var n=[].slice.call(arguments);return n.length>=t?e.apply(this,n):function(){return r.apply(this,n.concat([].slice.call(arguments)))}}};var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var i=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e,t){var r,n;r="object"==typeof window&&window||a,n={},r.PubSub=n,function(e){var t={},r=-1,n="*";function o(e){var t;for(t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function a(e){return function(){throw e}}function i(e,t,r){try{e(t,r)}catch(e){setTimeout(a(e),0)}}function s(e,t,r){e(t,r)}function c(e,r,n,o){var a,c=t[r],l=o?s:i;if(Object.prototype.hasOwnProperty.call(t,r))for(a in c)Object.prototype.hasOwnProperty.call(c,a)&&l(c[a],e,n)}function l(e,t,r){return function(){var o=String(e),a=o.lastIndexOf(".");for(c(e,e,t,r);-1!==a;)a=(o=o.substr(0,a)).lastIndexOf("."),c(e,o,t,r);c(e,n,t,r)}}function u(e){var r=String(e);return Boolean(Object.prototype.hasOwnProperty.call(t,r)&&o(t[r]))}function d(e){for(var t=String(e),r=u(t)||u(n),o=t.lastIndexOf(".");!r&&-1!==o;)o=(t=t.substr(0,o)).lastIndexOf("."),r=u(t);return r}function f(e,t,r,n){var o=l(e="symbol"==typeof e?e.toString():e,t,n);return!!d(e)&&(!0===r?o():setTimeout(o,0),!0)}e.publish=function(t,r){return f(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return f(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,Object.prototype.hasOwnProperty.call(t,e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeAll=function(t){return e.subscribe(n,t)},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n,o=0;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)){for(n in t[r])o++;break}return o},e.getSubscriptions=function(e){var r,n=[];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,a,i=function(e){var r;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e))return!0;return!1},s="string"==typeof r&&(Object.prototype.hasOwnProperty.call(t,r)||i(r)),c=!s&&"string"==typeof r,l="function"==typeof r,u=!1;if(!s){for(n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(o=t[n],c&&o[r]){delete o[r],u=r;break}if(l)for(a in o)Object.prototype.hasOwnProperty.call(o,a)&&o[a]===r&&(delete o[a],u=!0)}return u}e.clearSubscriptions(r)}}(n),void 0!==e&&e.exports&&(t=e.exports=n),t.PubSub=n,e.exports=t=n}));i.PubSub;const s={null:e=>null===e,boolean:e=>"boolean"==typeof e,object:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,array:e=>Array.isArray(e),number:e=>"number"==typeof e,integer:e=>Number.isInteger(e),string:e=>"string"==typeof e},c=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)]},l=e=>{const t=RegExp(/^(.+):\/\//).exec(e);return t?t[1]:""};var u={jsonTypeOf:(e,t)=>s[t](e),splitUrl:c,safeResolveUrl:(e,t)=>{const r=n.default(e,t),o=c(e)[0];if(o&&"file"===l(r)&&"file"!==l(o))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},pathRelative:(e,t)=>{if(e===t)return"";let r=1;const n=e.length-1,o=t.length-r,a=n<o?n:o;let i=-1,s=0;for(;s<a;s++){const n=e.charCodeAt(s+1);if(n!==t.charCodeAt(r+s))break;47===n&&(i=s)}if(o>a){if(47===t.charCodeAt(r+s))return t.slice(r+s+1);if(0===s)return t.slice(r+s)}n>a&&(47===e.charCodeAt(s+1)?i=s:0===a&&(i=0));let c="";for(s=i+2;s<=e.length;++s)s!==e.length&&47!==e.charCodeAt(s)||(c+=0===c.length?"..":"/..");return r+=i,c.length>0?`${c}${t.slice(r,t.length)}`:(47===t.charCodeAt(r)&&++r,t.slice(r,t.length))}};const d=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(b)},f=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:f(e,g(t,o,n),r,m(o,n))}}if(Array.isArray(t)){const n=[...t];return n[w(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:g(t,e[0],n)},p=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||O(t)){const o=e.shift();p(e,g(t,o,n),r,m(o,n))}else{t[w(t,e[0])]=r}},h=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=g(t,n,r);return{...t,[n]:h(e,o,m(n,r))}}if(Array.isArray(t))return t.filter(((t,r)=>r!=e[0]));if("object"==typeof t&&null!==t){const{[e[0]]:r,...n}=t;return n}return g(t,e[0],r)}},y=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=g(t,n,r);y(e,o,m(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:g(t,e[0],r)},m=o(((e,t)=>t+"/"+v(e))),v=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),b=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),w=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,g=(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(O(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[w(e,t)]},O=e=>null===e||"object"!=typeof e;var E={nil:"",append:m,get:(e,t)=>{const r=d(e),n=e=>r.reduce((([e,t],r)=>[g(e,r,t),m(r,t)]),[e,""])[0];return void 0===t?n:n(t)},set:(e,t,r)=>{const n=d(e),a=o(((e,t)=>f(n,e,t,"")));return void 0===t?a:a(t,r)},assign:(e,t,r)=>{const n=d(e),a=o(((e,t)=>p(n,e,t,"")));return void 0===t?a:a(t,r)},unset:(e,t)=>{const r=d(e),n=e=>h(r,e,"");return void 0===t?n:n(t)},remove:(e,t)=>{const r=d(e),n=e=>y(r,e,"");return void 0===t?n:n(t)}};E.nil,E.append,E.get,E.set,E.assign,E.unset,E.remove;const j=Symbol("$__value"),$=Symbol("$__href");var S={cons:(e,t)=>Object.freeze({[$]:e,[j]:t}),isReference:e=>e&&void 0!==e[$],href:e=>e[$],value:e=>e[j]};const{jsonTypeOf:A}=u,T=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),I=e=>S.isReference(e.value)?S.value(e.value):e.value,k=o(((e,t)=>A(I(e),t))),x=(e,t)=>Object.freeze({...t,pointer:E.append(e,t.pointer),value:I(t)[e]}),V=o(((e,t)=>I(t).map(((r,n,o,a)=>e(x(n,t),n,o,a))))),P=o(((e,t)=>I(t).map(((e,r,n,o)=>x(r,t))).filter(((t,r,n,o)=>e(t,r,n,o))))),R=o(((e,t,r)=>I(r).reduce(((t,n,o)=>e(t,x(o,r),o)),t))),C=o(((e,t)=>I(t).every(((r,n,o,a)=>e(x(n,t),n,o,a))))),U=o(((e,t)=>I(t).some(((r,n,o,a)=>e(x(n,t),n,o,a)))));var K={nil:T,cons:(e,t="")=>Object.freeze({...T,id:t,instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:I,has:(e,t)=>e in I(t),typeOf:k,step:x,entries:e=>Object.keys(I(e)).map((t=>[t,x(t,e)])),keys:e=>Object.keys(I(e)),map:V,filter:P,reduce:R,every:C,some:U,length:e=>I(e).length},L=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,z=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,_=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,D=/\\([\u000b\u0020-\u00ff])/g,N=/([\\"])/g,q=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function B(e){var t=String(e);if(_.test(t))return t;if(t.length>0&&!z.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(N,"\\$1")+'"'}function J(e){this.parameters=Object.create(null),this.type=e}var F={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!q.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+"="+B(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(!q.test(n))throw new TypeError("invalid media type");var o=new J(n.toLowerCase());if(-1!==r){var a,i,s;for(L.lastIndex=r;i=L.exec(t);){if(i.index!==r)throw new TypeError("invalid parameter format");r+=i[0].length,a=i[1].toLowerCase(),'"'===(s=i[2])[0]&&(s=s.substr(1,s.length-2).replace(D,"$1")),o.parameters[a]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},Z=async e=>Object.entries(await e),M=o((async(e,t)=>(await t).map(e))),W=o((async(e,t,r)=>(await r).reduce((async(t,r)=>e(await t,r)),t))),G=o((async(e,t,r={})=>W((async(t,r)=>await e(r)?t.concat([r]):t),[],t,r))),H=o((async(e,t)=>{const r=await M(e,t);return(await Promise.all(r)).some((e=>e))})),Q=o((async(e,t)=>{const r=await M(e,t);return(await Promise.all(r)).every((e=>e))})),X=o(((e,t)=>e.reduce((async(e,t)=>t(await e)),t))),Y={entries:Z,map:M,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)};Y.entries,Y.map,Y.filter,Y.reduce,Y.some,Y.every,Y.pipeline,Y.all,Y.allValues;var ee=fetch;const{jsonTypeOf:te,splitUrl:re,safeResolveUrl:ne,pathRelative:oe}=u,ae={},ie={},se=(e,t)=>{const r=e in ie?ie[e]:e;if(r in ae)return ae[r][t]},ce={},le={},ue=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=re(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=se(n,"baseToken"),a=se(n,"anchorToken"),i=re(t)[0];if(!i&&!re(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const s=ne(i,e[o]||""),[c,l]=re(s);delete e[o],l&&o===a&&(e[a]=a!==o?encodeURI(l):`#${encodeURI(l)}`),i&&(le[i]=c);const u={},d=se(n,"recursiveAnchorToken");let f;!0===e[d]&&(u[""]=`${c}#`,e[a]="",delete e[d]);const p=se(n,"vocabularyToken");te(e[p],"object")?(ie[c]=n,f=e[p],delete e[p]):(ie[c]=n,f={[n]:!0});const h={"":""};return ce[c]={id:c,schemaVersion:n,schema:de(e,c,n,E.nil,h,u),anchors:h,dynamicAnchors:u,vocabulary:f,validated:!1},c},de=(e,t,r,n,o,a)=>{if(te(e,"object")){const i="string"==typeof e.$schema?re(e.$schema)[0]:r,s=se(i,"embeddedToken"),c=se(i,"anchorToken");if("string"==typeof e[s]&&(s!==c||"#"!==e[s][0])){const n=ne(t,e[s]);return e[s]=n,ue(e,n,r),S.cons(e[s],e)}const l=se(r,"anchorToken"),u=se(r,"dynamicAnchorToken");"string"==typeof e[u]&&(a[e[u]]=`${t}#${encodeURI(n)}`,o[e[u]]=n,delete e[u]);const d=se(r,"embeddedToken");if("string"==typeof e[l]){const t=l!==d?e[l]:e[l].slice(1);o[t]=n,delete e[l]}const f=se(r,"jrefToken");if("string"==typeof e[f])return S.cons(e[f],e);for(const i in e)e[i]=de(e[i],t,r,E.append(i,n),o,a);return e}return Array.isArray(e)?e.map(((e,i)=>de(e,t,r,E.append(i,n),o,a))):e},fe=e=>ce[le[e]]||ce[e],pe=Object.freeze({id:"",schemaVersion:void 0,vocabulary:{},pointer:E.nil,schema:void 0,value:void 0,anchors:{},dynamicAnchors:{},validated:!0}),he=async(e,t=pe)=>{const r=ne(ve(t),e),[n,o]=re(r);if(!(e=>e in ce||e in le)(n)){const e=await ee(n,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error(`Failed to retrieve schema with id: ${n}`);if(e.headers.has("content-type")){const t=F.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${n} is not a schema. Found a document with media type: ${t}`)}ue(await e.json(),n)}const a=fe(n),i="/"!==o[0]?me(a,o):o,s=Object.freeze({...a,pointer:i,value:E.get(i,a.schema)});return ye(s)},ye=e=>S.isReference(e.value)?he(S.href(e.value),e):e,me=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},ve=e=>`${e.id}#${encodeURI(e.pointer)}`,be=e=>S.isReference(e.value)?S.value(e.value):e.value,we=(e,t)=>{const r=fe(t.id),n=Object.freeze({...t,pointer:E.append(e,t.pointer),value:be(t)[e],validated:r.validated});return ye(n)},ge=o(((e,t)=>Y.pipeline([be,Y.map((async(r,n)=>e(await we(n,t),n))),Y.all],t))),Oe={parentId:"",parentDialect:"",includeEmbedded:!0},Ee=(e,t)=>{if(t.startsWith("file://")){const r=e.slice(7,e.lastIndexOf("/"));return""===e?"":oe(r,t.slice(7))}return t};var je={setConfig:(e,t,r)=>{ae[e]||(ae[e]={}),ae[e][t]=r},getConfig:se,add:ue,get:he,markValidated:e=>{ce[e].validated=!0},uri:ve,value:be,getAnchorPointer:me,typeOf:(e,t)=>te(be(e),t),has:(e,t)=>e in be(t),step:we,keys:e=>Object.keys(be(e)),entries:e=>Y.pipeline([be,Object.keys,Y.map((async t=>[t,await we(t,e)])),Y.all],e),map:ge,length:e=>be(e).length,toSchema:(e,t={})=>{const r={...Oe,...t},n=JSON.parse(JSON.stringify(e.schema,((t,n)=>{if(!S.isReference(n))return n;const o=S.value(n),a=o.$schema||e.schemaVersion,i=se(a,"embeddedToken");return!r.includeEmbedded&&i in o?void 0:S.value(n)}))),o=se(e.schemaVersion,"dynamicAnchorToken");Object.entries(e.dynamicAnchors).forEach((([e,t])=>{const r=re(t)[1];E.assign(r,n,{[o]:e,...E.get(r,n)})}));const a=se(e.schemaVersion,"anchorToken");Object.entries(e.anchors).filter((([e])=>""!==e)).forEach((([e,t])=>{E.assign(t,n,{[a]:e,...E.get(t,n)})}));const i=se(e.schemaVersion,"baseToken"),s=Ee(r.parentId,e.id),c=r.parentDialect===e.schemaVersion?"":e.schemaVersion;return{...s&&{[i]:s},...c&&{$schema:c},...n}}};je.setConfig,je.getConfig,je.add,je.get,je.markValidated,je.uri,je.value,je.getAnchorPointer,je.typeOf,je.has,je.step,je.keys,je.entries,je.map,je.length,je.toSchema;class $e extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var Se=$e;const{splitUrl:Ae}=u,Te="FLAG",Ie="BASIC",ke="DETAILED",xe="VERBOSE";let Ve=ke,Pe=!0;const Re=async e=>{const t={metaData:{}};return{ast:t,schemaUri:await Ne(e,t)}},Ce=o((({ast:e,schemaUri:t},r,n=Te)=>{if(![Te,Ie,ke,xe].includes(n))throw Error(`The '${n}' error format is not supported`);const o=[],a=i.subscribe("result",Ue(n,o));return Be(t,r,e,{}),i.unsubscribe(a),o[0]})),Ue=(e,t)=>{const r=[];return(n,o)=>{if("result"===n){const{keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:a}=o,i={keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:a,errors:[]};r.push(i)}else if("result.start"===n)r.push(n);else if("result.end"===n){const n=r.pop();for(;"result.start"!==r[r.length-1];){const t=r.pop(),o=[t];e===Ie&&(o.push(...t.errors),delete t.errors),(e===xe||e!==Te&&!t.valid)&&n.errors.unshift(...o)}r[r.length-1]=n,t[0]=n}}},Ke={},Le=e=>Ke[e],ze=e=>e in Ke,_e={},De={},Ne=async(e,t)=>{if(e=await qe(e),!ze(`${e.schemaVersion}#validate`)){const t=await je.get(e.schemaVersion);(je.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 _e)Object.entries(_e[e]).forEach((([e,r])=>{((e,t)=>{Ke[e]={collectEvaluatedItems:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&new Set,collectEvaluatedProperties:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&[],...t}})(`${t.id}#${e}`,r)}));else if(r)throw Error(`Missing required vocabulary: ${e}`)}))}if(Pe&&!e.validated){if(je.markValidated(e.id),!(e.schemaVersion in De)){const t=await je.get(e.schemaVersion),r=await Re(t);De[t.id]=Ce(r)}const t=K.cons(e.schema,e.id),r=De[e.schemaVersion](t,Ve);if(!r.valid)throw new Se(r)}return e.id in t.metaData||(t.metaData[e.id]={id:e.id,dynamicAnchors:e.dynamicAnchors,anchors:e.anchors}),Le(`${e.schemaVersion}#validate`).compile(e,t)},qe=async e=>je.typeOf(e,"string")?qe(await je.get(je.value(e),e)):e,Be=(e,t,r,n)=>{const o=Je(e,r),a=Ae(e)[0];return Le(o).interpret(e,t,r,{...r.metaData[a].dynamicAnchors,...n})},Je=(e,t)=>{if(!(e in t))throw Error(`No schema found at ${e}`);return t[e][0]};var Fe={validate:async(e,t,r)=>{const n=await Re(e),o=(e,t)=>Ce(n,K.cons(e),t);return void 0===t?o:o(t,r)},compile:Re,interpret:Ce,setMetaOutputFormat:e=>{Ve=e},setShouldMetaValidate:e=>{Pe=e},FLAG:Te,BASIC:Ie,DETAILED:ke,VERBOSE:xe,add:(e,t="",r="")=>{const n=je.add(e,t,r);delete De[n]},getKeyword:Le,hasKeyword:ze,defineVocabulary:(e,t)=>{_e[e]=t},compileSchema:Ne,interpretSchema:Be,collectEvaluatedProperties:(e,t,r,n,o)=>{const a=Je(e,r);return Le(a).collectEvaluatedProperties(e,t,r,n,o)},collectEvaluatedItems:(e,t,r,n,o)=>{const a=Je(e,r);return Le(a).collectEvaluatedItems(e,t,r,n,o)}};var Ze={compile:e=>je.value(e),interpret:()=>!0};var Me={compile:async(e,t)=>{const r=je.uri(e);if(!(r in t)){t[r]=!1;const n=je.value(e);if(!["object","boolean"].includes(typeof n))throw Error(`No schema found at '${je.uri(e)}'`);t[r]=[`${e.schemaVersion}#validate`,je.uri(e),"boolean"==typeof n?n:await Y.pipeline([je.entries,Y.map((([t,r])=>[`${e.schemaVersion}#${t}`,r])),Y.filter((([t])=>Fe.hasKeyword(t)&&t!==`${e.schemaVersion}#validate`)),Y.map((async([r,n])=>{const o=await Fe.getKeyword(r).compile(n,t,e);return[r,je.uri(n),o]})),Y.all],e)]}return r},interpret:(e,t,r,n)=>{const[o,a,s]=r[e];i.publishSync("result.start");const c="boolean"==typeof s?s:s.every((([e,o,a])=>{i.publishSync("result.start");const s=Fe.getKeyword(e).interpret(a,t,r,n);return i.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:K.uri(t),valid:s,ast:a}),i.publishSync("result.end"),s}));return i.publishSync("result",{keyword:o,absoluteKeywordLocation:a,instanceLocation:K.uri(t),valid:c,ast:e}),i.publishSync("result.end"),c},collectEvaluatedProperties:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&[]:a.filter((([e])=>!o||!e.endsWith("#unevaluatedProperties"))).reduce(((e,[o,,a])=>{const i=e&&Fe.getKeyword(o).collectEvaluatedProperties(a,t,r,n);return!1!==i&&[...e,...i]}),[])},collectEvaluatedItems:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&new Set:a.filter((([e])=>!o||!e.endsWith("#unevaluatedItems"))).reduce(((e,[o,,a])=>{const i=!1!==e&&Fe.getKeyword(o).collectEvaluatedItems(a,t,r,n);return!1!==i&&new Set([...e,...i])}),new Set)}},We={metaData:Ze,validate:Me},Ge={Core:Fe,Schema:je,Instance:K,Reference:S,Keywords:We,InvalidSchemaError:Se},He=Ge.Core,Qe=Ge.Schema,Xe=Ge.Instance,Ye=Ge.Reference,et=Ge.Keywords,tt=Ge.InvalidSchemaError;e.Core=He,e.Instance=Xe,e.InvalidSchemaError=tt,e.Keywords=et,e.Reference=Ye,e.Schema=Qe,e.default=Ge,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=json-schema-core-umd.min.js.map |
{ | ||
"name": "@hyperjump/json-schema-core", | ||
"version": "0.23.4", | ||
"version": "0.23.5", | ||
"description": "A framework for building JSON Schema tools", | ||
@@ -18,3 +18,4 @@ "main": "lib/index.js", | ||
"build": "rollup --config rollup.config.js", | ||
"prepublishOnly": "npm run build" | ||
"prepublishOnly": "npm run build", | ||
"postinstall": "rm -rf dist" | ||
}, | ||
@@ -21,0 +22,0 @@ "repository": "github:hyperjump-io/json-schema-core", |
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 too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Install scripts
Supply chain riskInstall scripts are run when the package is installed. The majority of malware in npm is hidden in install scripts.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1620400
9720
4
1