@hyperjump/json-schema-core
Advanced tools
Comparing version 0.8.1 to 0.8.2
@@ -841,6 +841,2 @@ define(['exports'], function (exports) { 'use strict'; | ||
if (protocolEndIndex === -1) { | ||
throw new Error('Error, protocol is not specified'); | ||
} | ||
resultObject.protocol = path.substring(0, protocolEndIndex); | ||
@@ -904,3 +900,3 @@ | ||
// return resultObject | ||
} else { | ||
} else if (relative !== '') { | ||
resultObject.relativePath = true; | ||
@@ -955,23 +951,9 @@ } | ||
// if base is empty, assume relative is a net path. | ||
if (base === '') { | ||
if (_shouldAddSlash(relative)) { | ||
return _addSlash(relative); | ||
} | ||
// add / at end if not present if is only the host | ||
return relative; | ||
} | ||
const baseObj = _baseParse(base); | ||
// relative is empty, return base minus hash | ||
if (relative === '') { | ||
const {host, path, query} = baseObj; | ||
// when path and query aren't supplied add slash | ||
if ((!path) && (!query)) { | ||
return _addSlash(host); | ||
} | ||
return host + path + query; | ||
const relativeObj = _relativeParse(relative); | ||
if (!baseObj.protocol && !relativeObj.netPath) { | ||
throw new Error('Error, protocol is not specified'); | ||
} | ||
const relativeObj = _relativeParse(relative); | ||
if (relativeObj.netPath) { // relative is full qualified URL | ||
@@ -1015,2 +997,9 @@ if (_shouldAddProtocol(relativeObj.href)) { | ||
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; | ||
} | ||
@@ -1147,3 +1136,3 @@ } | ||
// Schema Retrieval | ||
const nil$2 = Object.freeze({ id: "http://", schemaVersion: undefined, pointer: "", schema: undefined, recursiveAnchor: false }); | ||
const nil$2 = Object.freeze({ id: "", schemaVersion: undefined, pointer: "", schema: undefined, recursiveAnchor: false }); | ||
@@ -1200,4 +1189,5 @@ const get$2 = async (url, contextDoc = nil$2, recursive = false) => { | ||
const resolvedUrl = urlResolveBrowser(contextUrl, url); | ||
if (getScheme(resolvedUrl) === "file" && getScheme(contextUrl) !== "file") { | ||
throw Error("Can't access file resource from network context"); | ||
const contextId = splitUrl$2(contextUrl)[0]; | ||
if (contextId && getScheme(resolvedUrl) === "file" && getScheme(contextId) !== "file") { | ||
throw Error(`Can't access file '${resolvedUrl}' resource from network context '${contextUrl}'`); | ||
} | ||
@@ -1204,0 +1194,0 @@ return resolvedUrl; |
@@ -1,2 +0,2 @@ | ||
define(["exports"],(function(e){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var r=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e,r){!function(t,n){var o={};t.PubSub=o;var i=t.define;!function(e){var t={},r=-1;function n(e){var t;for(t in e)if(e.hasOwnProperty(t))return!0;return!1}function o(e,t,r){try{e(t,r)}catch(e){setTimeout(function(e){return function(){throw e}}(e),0)}}function i(e,t,r){e(t,r)}function a(e,r,n,a){var s,c=t[r],u=a?i:o;if(t.hasOwnProperty(r))for(s in c)c.hasOwnProperty(s)&&u(c[s],e,n)}function s(e,r,o,i){var s=function(e,t,r){return function(){var n=String(e),o=n.lastIndexOf(".");for(a(e,e,t,r);-1!==o;)o=(n=n.substr(0,o)).lastIndexOf("."),a(e,n,t,r)}}(e="symbol"==typeof e?e.toString():e,r,i);return!!function(e){for(var r=String(e),o=Boolean(t.hasOwnProperty(r)&&n(t[r])),i=r.lastIndexOf(".");!o&&-1!==i;)i=(r=r.substr(0,i)).lastIndexOf("."),o=Boolean(t.hasOwnProperty(r)&&n(t[r]));return o}(e)&&(!0===o?s():setTimeout(s,0),!0)}e.publish=function(t,r){return s(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return s(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,t.hasOwnProperty(e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n=0;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n++;return n},e.getSubscriptions=function(e){var r,n=[];for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,i,a="string"==typeof r&&(t.hasOwnProperty(r)||function(e){var r;for(r in t)if(t.hasOwnProperty(r)&&0===r.indexOf(e))return!0;return!1}(r)),s=!a&&"string"==typeof r,c="function"==typeof r,u=!1;if(!a){for(n in t)if(t.hasOwnProperty(n)){if(o=t[n],s&&o[r]){delete o[r],u=r;break}if(c)for(i in o)o.hasOwnProperty(i)&&o[i]===r&&(delete o[i],u=!0)}return u}e.clearSubscriptions(r)}}(o),"function"==typeof i&&i.amd?i((function(){return o})):(void 0!==e&&e.exports&&(r=e.exports=o),r.PubSub=o,e.exports=r=o)}("object"==typeof window&&window||t)})),n=(r.PubSub,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)))}}});const o=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(f)},i=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:i(e,p(t,o,n),r,u(o,n))}}if(Array.isArray(t)){const n=[...t];return n[d(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:p(t,e[0],n)},a=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||h(t)){const o=e.shift();a(e,p(t,o,n),r,u(o,n))}else{t[d(t,e[0])]=r}},s=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=p(t,n,r);return{...t,[n]:s(e,o,u(n,r))}}if(Array.isArray(t))return t.filter((t,r)=>r!=e[0]);if("object"==typeof t&&null!==t){const{[e[0]]:r,...n}=t;return n}return p(t,e[0],r)}},c=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=p(t,n,r);c(e,o,u(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:p(t,e[0],r)},u=n((e,t)=>t+"/"+l(e)),l=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),f=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),d=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,p=(e,t,r="")=>{if(void 0===e)throw TypeError(`Value at '${r}' is undefined and does not have property '${t}'`);if(null===e)throw TypeError(`Value at '${r}' is null and does not have property '${t}'`);if(h(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[d(e,t)]},h=e=>null===e||"object"!=typeof e;var y={nil:"",append:u,get:(e,t)=>{const r=o(e),n=e=>r.reduce(([e,t],r)=>[p(e,r,t),u(r,t)],[e,""])[0];return void 0===t?n:n(t)},set:(e,t,r)=>{const a=o(e),s=n((e,t)=>i(a,e,t,""));return void 0===t?s:s(t,r)},assign:(e,t,r)=>{const i=o(e),s=n((e,t)=>a(i,e,t,""));return void 0===t?s:s(t,r)},unset:(e,t)=>{const r=o(e),n=e=>s(r,e,"");return void 0===t?n:n(t)},delete:(e,t)=>{const r=o(e),n=e=>c(r,e,"");return void 0===t?n:n(t)}};var v={isObject:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,splitUrl:e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),o=e.slice(r+1);return[decodeURI(n),decodeURI(o)]}};const{splitUrl:b}=v,m=Object.freeze({id:"",pointer:"",instance:void 0}),w=(e,t=m)=>Object.freeze({...t,pointer:b(e)[1]}),g=e=>y.get(e.pointer,e.instance),O=(e,t)=>{const r=y.append(e,t.pointer);return w(`#${encodeURI(r)}`,t)},$=n((e,t)=>g(t).map((r,n)=>e(O(n,t),n))),E=n((e,t)=>g(t).map((e,r)=>O(r,t)).filter((t,r)=>e(t,r))),j=n((e,t,r)=>g(r).reduce((t,n,o)=>e(t,O(o,r),o),t)),P=n((e,t)=>Object.keys(g(t)).every((r,n)=>e(O(r,t),n))),x=n((e,t)=>Object.keys(g(t)).some((r,n)=>e(O(r,t),n)));var A={cons:(e,t="")=>Object.freeze({...m,id:t,instance:e}),get:w,uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:g,step:O,entries:e=>Object.keys(g(e)).map(t=>[t,O(t,e)]),map:$,filter:E,reduce:j,every:P,some:x},S=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,I=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,V=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,T=/\\([\u000b\u0020-\u00ff])/g,k=/([\\"])/g,R=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/; | ||
define(["exports"],(function(e){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var r=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e,r){!function(t,n){var o={};t.PubSub=o;var i=t.define;!function(e){var t={},r=-1;function n(e){var t;for(t in e)if(e.hasOwnProperty(t))return!0;return!1}function o(e,t,r){try{e(t,r)}catch(e){setTimeout(function(e){return function(){throw e}}(e),0)}}function i(e,t,r){e(t,r)}function a(e,r,n,a){var s,c=t[r],u=a?i:o;if(t.hasOwnProperty(r))for(s in c)c.hasOwnProperty(s)&&u(c[s],e,n)}function s(e,r,o,i){var s=function(e,t,r){return function(){var n=String(e),o=n.lastIndexOf(".");for(a(e,e,t,r);-1!==o;)o=(n=n.substr(0,o)).lastIndexOf("."),a(e,n,t,r)}}(e="symbol"==typeof e?e.toString():e,r,i);return!!function(e){for(var r=String(e),o=Boolean(t.hasOwnProperty(r)&&n(t[r])),i=r.lastIndexOf(".");!o&&-1!==i;)i=(r=r.substr(0,i)).lastIndexOf("."),o=Boolean(t.hasOwnProperty(r)&&n(t[r]));return o}(e)&&(!0===o?s():setTimeout(s,0),!0)}e.publish=function(t,r){return s(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return s(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,t.hasOwnProperty(e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n=0;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n++;return n},e.getSubscriptions=function(e){var r,n=[];for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,i,a="string"==typeof r&&(t.hasOwnProperty(r)||function(e){var r;for(r in t)if(t.hasOwnProperty(r)&&0===r.indexOf(e))return!0;return!1}(r)),s=!a&&"string"==typeof r,c="function"==typeof r,u=!1;if(!a){for(n in t)if(t.hasOwnProperty(n)){if(o=t[n],s&&o[r]){delete o[r],u=r;break}if(c)for(i in o)o.hasOwnProperty(i)&&o[i]===r&&(delete o[i],u=!0)}return u}e.clearSubscriptions(r)}}(o),"function"==typeof i&&i.amd?i((function(){return o})):(void 0!==e&&e.exports&&(r=e.exports=o),r.PubSub=o,e.exports=r=o)}("object"==typeof window&&window||t)})),n=(r.PubSub,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)))}}});const o=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(f)},i=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:i(e,p(t,o,n),r,u(o,n))}}if(Array.isArray(t)){const n=[...t];return n[d(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:p(t,e[0],n)},a=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||h(t)){const o=e.shift();a(e,p(t,o,n),r,u(o,n))}else{t[d(t,e[0])]=r}},s=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=p(t,n,r);return{...t,[n]:s(e,o,u(n,r))}}if(Array.isArray(t))return t.filter((t,r)=>r!=e[0]);if("object"==typeof t&&null!==t){const{[e[0]]:r,...n}=t;return n}return p(t,e[0],r)}},c=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=p(t,n,r);c(e,o,u(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:p(t,e[0],r)},u=n((e,t)=>t+"/"+l(e)),l=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),f=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),d=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,p=(e,t,r="")=>{if(void 0===e)throw TypeError(`Value at '${r}' is undefined and does not have property '${t}'`);if(null===e)throw TypeError(`Value at '${r}' is null and does not have property '${t}'`);if(h(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[d(e,t)]},h=e=>null===e||"object"!=typeof e;var y={nil:"",append:u,get:(e,t)=>{const r=o(e),n=e=>r.reduce(([e,t],r)=>[p(e,r,t),u(r,t)],[e,""])[0];return void 0===t?n:n(t)},set:(e,t,r)=>{const a=o(e),s=n((e,t)=>i(a,e,t,""));return void 0===t?s:s(t,r)},assign:(e,t,r)=>{const i=o(e),s=n((e,t)=>a(i,e,t,""));return void 0===t?s:s(t,r)},unset:(e,t)=>{const r=o(e),n=e=>s(r,e,"");return void 0===t?n:n(t)},delete:(e,t)=>{const r=o(e),n=e=>c(r,e,"");return void 0===t?n:n(t)}};var v={isObject:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,splitUrl:e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),o=e.slice(r+1);return[decodeURI(n),decodeURI(o)]}};const{splitUrl:b}=v,m=Object.freeze({id:"",pointer:"",instance:void 0}),w=(e,t=m)=>Object.freeze({...t,pointer:b(e)[1]}),g=e=>y.get(e.pointer,e.instance),O=(e,t)=>{const r=y.append(e,t.pointer);return w("#"+encodeURI(r),t)},E=n((e,t)=>g(t).map((r,n)=>e(O(n,t),n))),$=n((e,t)=>g(t).map((e,r)=>O(r,t)).filter((t,r)=>e(t,r))),P=n((e,t,r)=>g(r).reduce((t,n,o)=>e(t,O(o,r),o),t)),j=n((e,t)=>Object.keys(g(t)).every((r,n)=>e(O(r,t),n))),x=n((e,t)=>Object.keys(g(t)).some((r,n)=>e(O(r,t),n)));var A={cons:(e,t="")=>Object.freeze({...m,id:t,instance:e}),get:w,uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:g,step:O,entries:e=>Object.keys(g(e)).map(t=>[t,O(t,e)]),map:E,filter:$,reduce:P,every:j,some:x},S=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,I=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,V=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,T=/\\([\u000b\u0020-\u00ff])/g,k=/([\\"])/g,R=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/; | ||
/*! | ||
@@ -6,3 +6,3 @@ * content-type | ||
* MIT Licensed | ||
*/function K(e){var t=String(e);if(V.test(t))return t;if(t.length>0&&!I.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(k,"\\$1")+'"'}function L(e){this.parameters=Object.create(null),this.type=e}var C={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!R.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,i=Object.keys(t).sort(),a=0;a<i.length;a++){if(o=i[a],!V.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+K(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(!R.test(n))throw new TypeError("invalid media type");var o=new L(n.toLowerCase());if(-1!==r){var i,a,s;for(S.lastIndex=r;a=S.exec(t);){if(a.index!==r)throw new TypeError("invalid parameter format");r+=a[0].length,i=a[1].toLowerCase(),'"'===(s=a[2])[0]&&(s=s.substr(1,s.length-2).replace(T,"$1")),o.parameters[i]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},U=function(e,t){if(e=e.trim(),(t=t.trim()).startsWith("about:"))return t;if(""===e)return _(t)?q(t):t;const r=function(e){const t={host:"",path:"",query:"",protocol:""};let r=e,n=e.indexOf("//");if(-1===n)throw new Error("Error, protocol is not specified");t.protocol=r.substring(0,n),n+=2;const o=e.indexOf("/",n),i=e.indexOf("?"),a=e.indexOf("#");-1!==a&&(r=r.substring(0,a));if(-1!==i){const e=r.substring(i);t.query=e,r=r.substring(0,i)}if(-1!==o){const e=r.substring(0,o);t.host=e,r=r.substring(o),t.path=r}else t.host=r;return t}(e);if(""===t){const{host:e,path:t,query:n}=r;return t||n?e+t+n:q(e)}const n=function(e){const t={href:e,hash:"",query:"",netPath:!1,absolutePath:!1,relativePath:!1};if(W.test(e))return t.netPath=!0,t;"/"===e[0]?t.absolutePath=!0: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(n.netPath)return n.href.startsWith("//")&&(n.href=r.protocol+n.href),_(n.href)?q(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+z(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let i,a=r.path,s=r.host;return 0===e.length?i=a:(a=a.substring(0,a.lastIndexOf("/")),i=z(a+"/"+e)),s+=""!==i||t||o?i+t+o:"/",s}};function q(e){return e+("/"===e[e.length-1]?"":"/")}function z(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 W=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");function _(e){const t=e.indexOf("//")+2,r=!e.includes("/",t),n=!e.includes("?",t),o=!e.includes("#",t);return r&&n&&o}var B=fetch;const{isObject:D,splitUrl:F}=v,M=Symbol("$__jref"),Z={},N={},J=(e,t)=>{const r=e in N?N[e]:e;if(r in Z)return Z[r][t]},G={},H={},Q=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=F(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=J(n,"idToken"),i=F(t)[0],a=te(i,e[o]||""),s=F(a)[0];if(!s)throw Error("Couldn't determine an identifier for the schema");i&&(H[i]=s);const c=!!e.$recursiveAnchor;let u;delete e.$recursiveAnchor,J(n,"vocabulary")&&D(e)&&"$vocabulary"in e?(N[s]=n,u=e.$vocabulary,delete e.$vocabulary):u=s===n?{[n]:!0}:{};const l={};G[s]={id:s,schemaVersion:n,schema:X(e,s,n,y.nil,l),anchors:l,recursiveAnchor:c,vocabulary:u,validated:!1}},X=(e,t,r,n,o)=>{if(D(e)){const i=J(r,"idToken"),a=J(r,"anchorToken");if("string"==typeof e[i]){const n=e[i],o=te(t,n),[s,c]=F(o);if(delete e[i],c&&(e[a]=a!==i?encodeURI(c):`#${encodeURI(c)}`),s!==t)return Q(e,te(t,s),r),{[M]:n}}if("string"==typeof e[a]){const t=a!==i?e[a]:e[a].slice(1);o[t]=n,delete e[a]}return Object.entries(e).reduce((e,[i,a])=>(e[i]=X(a,t,r,y.append(i,n),o),e),{})}return Array.isArray(e)?e.map((e,i)=>X(e,t,r,y.append(i,n),o)):e},Y=Object.freeze({id:"http://",schemaVersion:void 0,pointer:"",schema:void 0,recursiveAnchor:!1}),ee=async(e,t=Y,r=!1)=>{const n=r&&t.recursiveAnchor?t.recursiveAnchor:oe(t),o=te(n,e),[i,a]=F(o);if(!(e=>e in G||e in H)(i)){const e=await B(i,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error(`Failed to retrieve schema with id: ${i}`);if(e.headers.has("content-type")){const t=C.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${i} is not a schema. Found a document with media type: ${t}`)}Q(await e.json(),i)}const s=(e=>G[H[e]]||G[e])(i),c=Object.freeze({id:s.id,schemaVersion:s.schemaVersion,vocabulary:s.vocabulary,pointer:a&&"/"!==a[0]?ne(s,a):a,schema:s.schema,recursiveAnchor:t.recursiveAnchor||!!s.recursiveAnchor&&i,validated:s.validated}),u=ie(c);return D(u)&&M in u?ee(u[M],c):J(c.schemaVersion,"jsonReference")&&D(u)&&"string"==typeof u.$ref?ee(u.$ref,c):J(c.schemaVersion,"keywordReference")&&"string"==typeof u&&c.pointer.endsWith("/$ref")?ee(u,c):J(c.schemaVersion,"keywordRecursiveReference")&&"string"==typeof u&&c.pointer.endsWith("/$recursiveRef")?ee(u,c,!0):c},te=(e,t)=>{const r=U(e,t);if("file"===re(r)&&"file"!==re(e))throw Error("Can't access file resource from network context");return r},re=e=>{const t=e.match(/^(.+):\/\//);return t?t[1]:""},ne=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},oe=e=>`${e.id}#${encodeURI(e.pointer)}`,ie=e=>y.get(e.pointer,e.schema),ae=(e,t)=>{const r=y.append(e,t.pointer);return ee(`#${encodeURI(r)}`,t)},se=n((e,t)=>ie(t).map(async(r,n)=>e(await ae(n,t),n)));var ce={setConfig:(e,t,r)=>{Z[e]||(Z[e]={}),Z[e][t]=r},getConfig:J,add:Q,get:ee,markValidated:e=>{G[e].validated=!0},uri:oe,value:ie,has:(e,t)=>e in ie(t),step:ae,entries:e=>Object.keys(ie(e)).map(t=>[t,ae(t,e)]),map:se};const ue="FLAG",le="BASIC",fe="DETAILED",de="VERBOSE";let pe=fe,he=!0;const ye=(e,t)=>(n,o=ue)=>{if(![ue,le,fe,de].includes(o))throw Error(`The '${o}' error format is not supported`);let i=[];const a=r.subscribe("result",ve(o,i));return Pe(t,n,e),r.unsubscribe(a),i[0]},ve=(e,t)=>{const r=[];return(n,o)=>{const i={...o,errors:[]};for(;r.length>0&&be(r[r.length-1],i);){const t=r.pop();let n=[];if(e===le&&(n=t.errors,delete t.errors),i.errors.unshift(t,...n),me(i))break}(e===de||e!==ue&&!i.valid)&&r.push(i),t[0]=i}},be=(e,t)=>e.instanceLocation.startsWith(t.instanceLocation)&&(e.absoluteKeywordLocation.startsWith(t.absoluteKeywordLocation)||me(e)),me=e=>e.keyword.endsWith("#$ref")||e.keyword.endsWith("#$recursiveRef"),we={},ge=e=>we[e],Oe=e=>e in we,$e={},Ee={},je=async(e,t)=>{if(!Oe(`${e.schemaVersion}#validate`)){const t=await ce.get(e.schemaVersion);(ce.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)=>{we[e]={collectEvaluatedItems:(e,r,n)=>t.interpret(e,r,n)&&0,collectEvaluatedProperties:(e,r,n)=>t.interpret(e,r,n)&&[],...t}})(`${t.id}#${e}`,r)});else if(r)throw Error(`Missing required vocabulary: ${e}`)})}if(he&&!e.validated){if(ce.markValidated(e.id),!(e.schemaVersion in Ee)){const t=await ce.get(e.schemaVersion),r={},n=await je(t,r);Ee[t.id]=ye(r,n)}const t=A.cons(e.schema,e.id),r=Ee[e.schemaVersion](t,pe);if(!r.valid)throw r}return await ge(`${e.schemaVersion}#validate`).compile(e,t),ce.uri(e)},Pe=(e,t,r)=>{const[n]=r[e];return ge(n).interpret(e,t,r)};var xe={validate:async(e,t,r)=>{const n={},o=await je(e,n),i=(e,t=ue)=>ye(n,o)(A.cons(e),t);return void 0===t?i:i(t,r)},setMetaOutputFormat:e=>{pe=e},setShouldMetaValidate:e=>{he=e},FLAG:ue,BASIC:le,DETAILED:fe,VERBOSE:de,getKeyword:ge,hasKeyword:Oe,defineVocabulary:(e,t)=>{$e[e]=t},compileSchema:je,interpretSchema:Pe,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return ge(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return ge(o).collectEvaluatedItems(e,t,r,n)}};var Ae={compile:()=>{},interpret:()=>!0},Se=async e=>Object.entries(await e),Ie=n(async(e,t)=>(await t).map(e)),Ve=n(async(e,t,r)=>(await r).reduce(async(t,r)=>e(await t,r),t)),Te=n(async(e,t,r={})=>Ve(async(t,r)=>await e(r)?t.concat([r]):t,[],t,r)),ke=n(async(e,t)=>{const r=await Ie(e,t);return(await Promise.all(r)).some(e=>e)}),Re=n(async(e,t)=>{const r=await Ie(e,t);return(await Promise.all(r)).every(e=>e)}),Ke=n((e,t)=>e.reduce(async(e,t)=>t(await e),t)),Le={entries:Se,map:Ie,filter:Te,reduce:Ve,some:ke,every:Re,pipeline:Ke,all:e=>Promise.all(e),allValues:e=>Ke([Se,Ve(async(e,[t,r])=>(e[t]=await r,e),{})],e)};var Ce={compile:async(e,t)=>{const r=ce.uri(e);if(!(r in t)){t[r]=!1;const n=ce.value(e);t[r]=[`${e.schemaVersion}#validate`,ce.uri(e),"boolean"==typeof n?n:await Le.pipeline([ce.entries,Le.map(([t,r])=>[`${e.schemaVersion}#${t}`,r]),Le.filter(([t])=>xe.hasKeyword(t)&&t!==`${e.schemaVersion}#validate`),Le.map(async([r,n])=>{const o=await n,i=await xe.getKeyword(r).compile(o,t,e);return[r,ce.uri(o),i]}),Le.all],e)]}},interpret:(e,t,n)=>{const[o,i,a]=n[e],s="boolean"==typeof a?a:a.every(([e,o,i])=>{const a=xe.getKeyword(e).interpret(i,t,n);return r.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:A.uri(t),valid:a}),a});return r.publishSync("result",{keyword:o,absoluteKeywordLocation:i,instanceLocation:A.uri(t),valid:s}),s},collectEvaluatedProperties:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedProperties")).reduce((e,[n,,o])=>{const i=e&&xe.getKeyword(n).collectEvaluatedProperties(o,t,r);return i&&e.concat(i)},[])},collectEvaluatedItems:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedItems")).reduce((e,[n,,o])=>{const i=!1!==e&&xe.getKeyword(n).collectEvaluatedItems(o,t,r);return!1!==i&&Math.max(e,i)},0)}},Ue={Core:xe,Schema:ce,Instance:A,Keywords:{metaData:Ae,validate:Ce}},qe=Ue.Core,ze=Ue.Schema,We=Ue.Instance,_e=Ue.Keywords;e.Core=qe,e.Instance=We,e.Keywords=_e,e.Schema=ze,e.default=Ue,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
*/function K(e){var t=String(e);if(V.test(t))return t;if(t.length>0&&!I.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(k,"\\$1")+'"'}function L(e){this.parameters=Object.create(null),this.type=e}var C={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!R.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,i=Object.keys(t).sort(),a=0;a<i.length;a++){if(o=i[a],!V.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+K(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(!R.test(n))throw new TypeError("invalid media type");var o=new L(n.toLowerCase());if(-1!==r){var i,a,s;for(S.lastIndex=r;a=S.exec(t);){if(a.index!==r)throw new TypeError("invalid parameter format");r+=a[0].length,i=a[1].toLowerCase(),'"'===(s=a[2])[0]&&(s=s.substr(1,s.length-2).replace(T,"$1")),o.parameters[i]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},U=function(e,t){if(e=e.trim(),(t=t.trim()).startsWith("about:"))return t;const r=function(e){const t={host:"",path:"",query:"",protocol:""};let r=e,n=e.indexOf("//");t.protocol=r.substring(0,n),n+=2;const o=e.indexOf("/",n),i=e.indexOf("?"),a=e.indexOf("#");-1!==a&&(r=r.substring(0,a));if(-1!==i){const e=r.substring(i);t.query=e,r=r.substring(0,i)}if(-1!==o){const e=r.substring(0,o);t.host=e,r=r.substring(o),t.path=r}else t.host=r;return t}(e),n=function(e){const t={href:e,hash:"",query:"",netPath:!1,absolutePath:!1,relativePath:!1};if(W.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)?q(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+z(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let i,a=r.path,s=r.host;return 0===e.length?i=a:(a=a.substring(0,a.lastIndexOf("/")),i=z(a+"/"+e)),s+=""!==i||t||o?i+t+o:"/",s}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:q(e)}};function q(e){return e+("/"===e[e.length-1]?"":"/")}function z(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 W=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");var _=fetch;const{isObject:B,splitUrl:D}=v,F=Symbol("$__jref"),M={},Z={},N=(e,t)=>{const r=e in Z?Z[e]:e;if(r in M)return M[r][t]},J={},G={},H=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=D(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=N(n,"idToken"),i=D(t)[0],a=ee(i,e[o]||""),s=D(a)[0];if(!s)throw Error("Couldn't determine an identifier for the schema");i&&(G[i]=s);const c=!!e.$recursiveAnchor;let u;delete e.$recursiveAnchor,N(n,"vocabulary")&&B(e)&&"$vocabulary"in e?(Z[s]=n,u=e.$vocabulary,delete e.$vocabulary):u=s===n?{[n]:!0}:{};const l={};J[s]={id:s,schemaVersion:n,schema:Q(e,s,n,y.nil,l),anchors:l,recursiveAnchor:c,vocabulary:u,validated:!1}},Q=(e,t,r,n,o)=>{if(B(e)){const i=N(r,"idToken"),a=N(r,"anchorToken");if("string"==typeof e[i]){const n=e[i],o=ee(t,n),[s,c]=D(o);if(delete e[i],c&&(e[a]=a!==i?encodeURI(c):"#"+encodeURI(c)),s!==t)return H(e,ee(t,s),r),{[F]:n}}if("string"==typeof e[a]){const t=a!==i?e[a]:e[a].slice(1);o[t]=n,delete e[a]}return Object.entries(e).reduce((e,[i,a])=>(e[i]=Q(a,t,r,y.append(i,n),o),e),{})}return Array.isArray(e)?e.map((e,i)=>Q(e,t,r,y.append(i,n),o)):e},X=Object.freeze({id:"",schemaVersion:void 0,pointer:"",schema:void 0,recursiveAnchor:!1}),Y=async(e,t=X,r=!1)=>{const n=r&&t.recursiveAnchor?t.recursiveAnchor:ne(t),o=ee(n,e),[i,a]=D(o);if(!(e=>e in J||e in G)(i)){const e=await _(i,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error("Failed to retrieve schema with id: "+i);if(e.headers.has("content-type")){const t=C.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${i} is not a schema. Found a document with media type: ${t}`)}H(await e.json(),i)}const s=(e=>J[G[e]]||J[e])(i),c=Object.freeze({id:s.id,schemaVersion:s.schemaVersion,vocabulary:s.vocabulary,pointer:a&&"/"!==a[0]?re(s,a):a,schema:s.schema,recursiveAnchor:t.recursiveAnchor||!!s.recursiveAnchor&&i,validated:s.validated}),u=oe(c);return B(u)&&F in u?Y(u[F],c):N(c.schemaVersion,"jsonReference")&&B(u)&&"string"==typeof u.$ref?Y(u.$ref,c):N(c.schemaVersion,"keywordReference")&&"string"==typeof u&&c.pointer.endsWith("/$ref")?Y(u,c):N(c.schemaVersion,"keywordRecursiveReference")&&"string"==typeof u&&c.pointer.endsWith("/$recursiveRef")?Y(u,c,!0):c},ee=(e,t)=>{const r=U(e,t),n=D(e)[0];if(n&&"file"===te(r)&&"file"!==te(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},te=e=>{const t=e.match(/^(.+):\/\//);return t?t[1]:""},re=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},ne=e=>`${e.id}#${encodeURI(e.pointer)}`,oe=e=>y.get(e.pointer,e.schema),ie=(e,t)=>{const r=y.append(e,t.pointer);return Y("#"+encodeURI(r),t)},ae=n((e,t)=>oe(t).map(async(r,n)=>e(await ie(n,t),n)));var se={setConfig:(e,t,r)=>{M[e]||(M[e]={}),M[e][t]=r},getConfig:N,add:H,get:Y,markValidated:e=>{J[e].validated=!0},uri:ne,value:oe,has:(e,t)=>e in oe(t),step:ie,entries:e=>Object.keys(oe(e)).map(t=>[t,ie(t,e)]),map:ae};const ce="FLAG",ue="BASIC",le="DETAILED",fe="VERBOSE";let de=le,pe=!0;const he=(e,t)=>(n,o=ce)=>{if(![ce,ue,le,fe].includes(o))throw Error(`The '${o}' error format is not supported`);let i=[];const a=r.subscribe("result",ye(o,i));return Pe(t,n,e),r.unsubscribe(a),i[0]},ye=(e,t)=>{const r=[];return(n,o)=>{const i={...o,errors:[]};for(;r.length>0&&ve(r[r.length-1],i);){const t=r.pop();let n=[];if(e===ue&&(n=t.errors,delete t.errors),i.errors.unshift(t,...n),be(i))break}(e===fe||e!==ce&&!i.valid)&&r.push(i),t[0]=i}},ve=(e,t)=>e.instanceLocation.startsWith(t.instanceLocation)&&(e.absoluteKeywordLocation.startsWith(t.absoluteKeywordLocation)||be(e)),be=e=>e.keyword.endsWith("#$ref")||e.keyword.endsWith("#$recursiveRef"),me={},we=e=>me[e],ge=e=>e in me,Oe={},Ee={},$e=async(e,t)=>{if(!ge(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 Oe)Object.entries(Oe[e]).forEach(([e,r])=>{((e,t)=>{me[e]={collectEvaluatedItems:(e,r,n)=>t.interpret(e,r,n)&&0,collectEvaluatedProperties:(e,r,n)=>t.interpret(e,r,n)&&[],...t}})(`${t.id}#${e}`,r)});else if(r)throw Error("Missing required vocabulary: "+e)})}if(pe&&!e.validated){if(se.markValidated(e.id),!(e.schemaVersion in Ee)){const t=await se.get(e.schemaVersion),r={},n=await $e(t,r);Ee[t.id]=he(r,n)}const t=A.cons(e.schema,e.id),r=Ee[e.schemaVersion](t,de);if(!r.valid)throw r}return await we(e.schemaVersion+"#validate").compile(e,t),se.uri(e)},Pe=(e,t,r)=>{const[n]=r[e];return we(n).interpret(e,t,r)};var je={validate:async(e,t,r)=>{const n={},o=await $e(e,n),i=(e,t=ce)=>he(n,o)(A.cons(e),t);return void 0===t?i:i(t,r)},setMetaOutputFormat:e=>{de=e},setShouldMetaValidate:e=>{pe=e},FLAG:ce,BASIC:ue,DETAILED:le,VERBOSE:fe,getKeyword:we,hasKeyword:ge,defineVocabulary:(e,t)=>{Oe[e]=t},compileSchema:$e,interpretSchema:Pe,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return we(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return we(o).collectEvaluatedItems(e,t,r,n)}};var xe={compile:()=>{},interpret:()=>!0},Ae=async e=>Object.entries(await e),Se=n(async(e,t)=>(await t).map(e)),Ie=n(async(e,t,r)=>(await r).reduce(async(t,r)=>e(await t,r),t)),Ve=n(async(e,t,r={})=>Ie(async(t,r)=>await e(r)?t.concat([r]):t,[],t,r)),Te=n(async(e,t)=>{const r=await Se(e,t);return(await Promise.all(r)).some(e=>e)}),ke=n(async(e,t)=>{const r=await Se(e,t);return(await Promise.all(r)).every(e=>e)}),Re=n((e,t)=>e.reduce(async(e,t)=>t(await e),t)),Ke={entries:Ae,map:Se,filter:Ve,reduce:Ie,some:Te,every:ke,pipeline:Re,all:e=>Promise.all(e),allValues:e=>Re([Ae,Ie(async(e,[t,r])=>(e[t]=await r,e),{})],e)};var Le={compile:async(e,t)=>{const r=se.uri(e);if(!(r in t)){t[r]=!1;const n=se.value(e);t[r]=[e.schemaVersion+"#validate",se.uri(e),"boolean"==typeof n?n:await Ke.pipeline([se.entries,Ke.map(([t,r])=>[`${e.schemaVersion}#${t}`,r]),Ke.filter(([t])=>je.hasKeyword(t)&&t!==e.schemaVersion+"#validate"),Ke.map(async([r,n])=>{const o=await n,i=await je.getKeyword(r).compile(o,t,e);return[r,se.uri(o),i]}),Ke.all],e)]}},interpret:(e,t,n)=>{const[o,i,a]=n[e],s="boolean"==typeof a?a:a.every(([e,o,i])=>{const a=je.getKeyword(e).interpret(i,t,n);return r.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:A.uri(t),valid:a}),a});return r.publishSync("result",{keyword:o,absoluteKeywordLocation:i,instanceLocation:A.uri(t),valid:s}),s},collectEvaluatedProperties:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedProperties")).reduce((e,[n,,o])=>{const i=e&&je.getKeyword(n).collectEvaluatedProperties(o,t,r);return i&&e.concat(i)},[])},collectEvaluatedItems:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedItems")).reduce((e,[n,,o])=>{const i=!1!==e&&je.getKeyword(n).collectEvaluatedItems(o,t,r);return!1!==i&&Math.max(e,i)},0)}},Ce={Core:je,Schema:se,Instance:A,Keywords:{metaData:xe,validate:Le}},Ue=Ce.Core,qe=Ce.Schema,ze=Ce.Instance,We=Ce.Keywords;e.Core=Ue,e.Instance=ze,e.Keywords=We,e.Schema=qe,e.default=Ce,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=json-schema-core-amd.min.js.map |
@@ -843,6 +843,2 @@ 'use strict'; | ||
if (protocolEndIndex === -1) { | ||
throw new Error('Error, protocol is not specified'); | ||
} | ||
resultObject.protocol = path.substring(0, protocolEndIndex); | ||
@@ -906,3 +902,3 @@ | ||
// return resultObject | ||
} else { | ||
} else if (relative !== '') { | ||
resultObject.relativePath = true; | ||
@@ -957,23 +953,9 @@ } | ||
// if base is empty, assume relative is a net path. | ||
if (base === '') { | ||
if (_shouldAddSlash(relative)) { | ||
return _addSlash(relative); | ||
} | ||
// add / at end if not present if is only the host | ||
return relative; | ||
} | ||
const baseObj = _baseParse(base); | ||
// relative is empty, return base minus hash | ||
if (relative === '') { | ||
const {host, path, query} = baseObj; | ||
// when path and query aren't supplied add slash | ||
if ((!path) && (!query)) { | ||
return _addSlash(host); | ||
} | ||
return host + path + query; | ||
const relativeObj = _relativeParse(relative); | ||
if (!baseObj.protocol && !relativeObj.netPath) { | ||
throw new Error('Error, protocol is not specified'); | ||
} | ||
const relativeObj = _relativeParse(relative); | ||
if (relativeObj.netPath) { // relative is full qualified URL | ||
@@ -1017,2 +999,9 @@ if (_shouldAddProtocol(relativeObj.href)) { | ||
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; | ||
} | ||
@@ -1149,3 +1138,3 @@ } | ||
// Schema Retrieval | ||
const nil$2 = Object.freeze({ id: "http://", schemaVersion: undefined, pointer: "", schema: undefined, recursiveAnchor: false }); | ||
const nil$2 = Object.freeze({ id: "", schemaVersion: undefined, pointer: "", schema: undefined, recursiveAnchor: false }); | ||
@@ -1202,4 +1191,5 @@ const get$2 = async (url, contextDoc = nil$2, recursive = false) => { | ||
const resolvedUrl = urlResolveBrowser(contextUrl, url); | ||
if (getScheme(resolvedUrl) === "file" && getScheme(contextUrl) !== "file") { | ||
throw Error("Can't access file resource from network context"); | ||
const contextId = splitUrl$2(contextUrl)[0]; | ||
if (contextId && getScheme(resolvedUrl) === "file" && getScheme(contextId) !== "file") { | ||
throw Error(`Can't access file '${resolvedUrl}' resource from network context '${contextUrl}'`); | ||
} | ||
@@ -1206,0 +1196,0 @@ return resolvedUrl; |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var t=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(t,r){!function(e,n){var o={};e.PubSub=o;var i=e.define;!function(e){var t={},r=-1;function n(e){var t;for(t in e)if(e.hasOwnProperty(t))return!0;return!1}function o(e,t,r){try{e(t,r)}catch(e){setTimeout(function(e){return function(){throw e}}(e),0)}}function i(e,t,r){e(t,r)}function a(e,r,n,a){var s,c=t[r],u=a?i:o;if(t.hasOwnProperty(r))for(s in c)c.hasOwnProperty(s)&&u(c[s],e,n)}function s(e,r,o,i){var s=function(e,t,r){return function(){var n=String(e),o=n.lastIndexOf(".");for(a(e,e,t,r);-1!==o;)o=(n=n.substr(0,o)).lastIndexOf("."),a(e,n,t,r)}}(e="symbol"==typeof e?e.toString():e,r,i);return!!function(e){for(var r=String(e),o=Boolean(t.hasOwnProperty(r)&&n(t[r])),i=r.lastIndexOf(".");!o&&-1!==i;)i=(r=r.substr(0,i)).lastIndexOf("."),o=Boolean(t.hasOwnProperty(r)&&n(t[r]));return o}(e)&&(!0===o?s():setTimeout(s,0),!0)}e.publish=function(t,r){return s(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return s(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,t.hasOwnProperty(e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n=0;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n++;return n},e.getSubscriptions=function(e){var r,n=[];for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,i,a="string"==typeof r&&(t.hasOwnProperty(r)||function(e){var r;for(r in t)if(t.hasOwnProperty(r)&&0===r.indexOf(e))return!0;return!1}(r)),s=!a&&"string"==typeof r,c="function"==typeof r,u=!1;if(!a){for(n in t)if(t.hasOwnProperty(n)){if(o=t[n],s&&o[r]){delete o[r],u=r;break}if(c)for(i in o)o.hasOwnProperty(i)&&o[i]===r&&(delete o[i],u=!0)}return u}e.clearSubscriptions(r)}}(o),"function"==typeof i&&i.amd?i((function(){return o})):(void 0!==t&&t.exports&&(r=t.exports=o),r.PubSub=o,t.exports=r=o)}("object"==typeof window&&window||e)})),r=(t.PubSub,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)))}}});const n=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(l)},o=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const i=e.shift();return{...t,[i]:o(e,d(t,i,n),r,c(i,n))}}if(Array.isArray(t)){const n=[...t];return n[f(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:d(t,e[0],n)},i=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||p(t)){const o=e.shift();i(e,d(t,o,n),r,c(o,n))}else{t[f(t,e[0])]=r}},a=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=d(t,n,r);return{...t,[n]:a(e,o,c(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 d(t,e[0],r)}},s=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=d(t,n,r);s(e,o,c(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:d(t,e[0],r)},c=r((e,t)=>t+"/"+u(e)),u=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),l=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),f=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,d=(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(p(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[f(e,t)]},p=e=>null===e||"object"!=typeof e;var h={nil:"",append:c,get:(e,t)=>{const r=n(e),o=e=>r.reduce(([e,t],r)=>[d(e,r,t),c(r,t)],[e,""])[0];return void 0===t?o:o(t)},set:(e,t,i)=>{const a=n(e),s=r((e,t)=>o(a,e,t,""));return void 0===t?s:s(t,i)},assign:(e,t,o)=>{const a=n(e),s=r((e,t)=>i(a,e,t,""));return void 0===t?s:s(t,o)},unset:(e,t)=>{const r=n(e),o=e=>a(r,e,"");return void 0===t?o:o(t)},delete:(e,t)=>{const r=n(e),o=e=>s(r,e,"");return void 0===t?o:o(t)}};var y={isObject:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,splitUrl:e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),o=e.slice(r+1);return[decodeURI(n),decodeURI(o)]}};const{splitUrl:v}=y,b=Object.freeze({id:"",pointer:"",instance:void 0}),m=(e,t=b)=>Object.freeze({...t,pointer:v(e)[1]}),w=e=>h.get(e.pointer,e.instance),g=(e,t)=>{const r=h.append(e,t.pointer);return m(`#${encodeURI(r)}`,t)},O=r((e,t)=>w(t).map((r,n)=>e(g(n,t),n))),$=r((e,t)=>w(t).map((e,r)=>g(r,t)).filter((t,r)=>e(t,r))),E=r((e,t,r)=>w(r).reduce((t,n,o)=>e(t,g(o,r),o),t)),x=r((e,t)=>Object.keys(w(t)).every((r,n)=>e(g(r,t),n))),j=r((e,t)=>Object.keys(w(t)).some((r,n)=>e(g(r,t),n)));var P={cons:(e,t="")=>Object.freeze({...b,id:t,instance:e}),get:m,uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:w,step:g,entries:e=>Object.keys(w(e)).map(t=>[t,g(t,e)]),map:O,filter:$,reduce:E,every:x,some:j},A=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,S=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,I=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,V=/\\([\u000b\u0020-\u00ff])/g,T=/([\\"])/g,k=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var t=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(t,r){!function(e,n){var o={};e.PubSub=o;var i=e.define;!function(e){var t={},r=-1;function n(e){var t;for(t in e)if(e.hasOwnProperty(t))return!0;return!1}function o(e,t,r){try{e(t,r)}catch(e){setTimeout(function(e){return function(){throw e}}(e),0)}}function i(e,t,r){e(t,r)}function a(e,r,n,a){var s,c=t[r],u=a?i:o;if(t.hasOwnProperty(r))for(s in c)c.hasOwnProperty(s)&&u(c[s],e,n)}function s(e,r,o,i){var s=function(e,t,r){return function(){var n=String(e),o=n.lastIndexOf(".");for(a(e,e,t,r);-1!==o;)o=(n=n.substr(0,o)).lastIndexOf("."),a(e,n,t,r)}}(e="symbol"==typeof e?e.toString():e,r,i);return!!function(e){for(var r=String(e),o=Boolean(t.hasOwnProperty(r)&&n(t[r])),i=r.lastIndexOf(".");!o&&-1!==i;)i=(r=r.substr(0,i)).lastIndexOf("."),o=Boolean(t.hasOwnProperty(r)&&n(t[r]));return o}(e)&&(!0===o?s():setTimeout(s,0),!0)}e.publish=function(t,r){return s(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return s(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,t.hasOwnProperty(e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n=0;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n++;return n},e.getSubscriptions=function(e){var r,n=[];for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,i,a="string"==typeof r&&(t.hasOwnProperty(r)||function(e){var r;for(r in t)if(t.hasOwnProperty(r)&&0===r.indexOf(e))return!0;return!1}(r)),s=!a&&"string"==typeof r,c="function"==typeof r,u=!1;if(!a){for(n in t)if(t.hasOwnProperty(n)){if(o=t[n],s&&o[r]){delete o[r],u=r;break}if(c)for(i in o)o.hasOwnProperty(i)&&o[i]===r&&(delete o[i],u=!0)}return u}e.clearSubscriptions(r)}}(o),"function"==typeof i&&i.amd?i((function(){return o})):(void 0!==t&&t.exports&&(r=t.exports=o),r.PubSub=o,t.exports=r=o)}("object"==typeof window&&window||e)})),r=(t.PubSub,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)))}}});const n=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(l)},o=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const i=e.shift();return{...t,[i]:o(e,d(t,i,n),r,c(i,n))}}if(Array.isArray(t)){const n=[...t];return n[f(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:d(t,e[0],n)},i=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||p(t)){const o=e.shift();i(e,d(t,o,n),r,c(o,n))}else{t[f(t,e[0])]=r}},a=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=d(t,n,r);return{...t,[n]:a(e,o,c(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 d(t,e[0],r)}},s=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=d(t,n,r);s(e,o,c(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:d(t,e[0],r)},c=r((e,t)=>t+"/"+u(e)),u=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),l=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),f=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,d=(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(p(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[f(e,t)]},p=e=>null===e||"object"!=typeof e;var h={nil:"",append:c,get:(e,t)=>{const r=n(e),o=e=>r.reduce(([e,t],r)=>[d(e,r,t),c(r,t)],[e,""])[0];return void 0===t?o:o(t)},set:(e,t,i)=>{const a=n(e),s=r((e,t)=>o(a,e,t,""));return void 0===t?s:s(t,i)},assign:(e,t,o)=>{const a=n(e),s=r((e,t)=>i(a,e,t,""));return void 0===t?s:s(t,o)},unset:(e,t)=>{const r=n(e),o=e=>a(r,e,"");return void 0===t?o:o(t)},delete:(e,t)=>{const r=n(e),o=e=>s(r,e,"");return void 0===t?o:o(t)}};var y={isObject:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,splitUrl:e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),o=e.slice(r+1);return[decodeURI(n),decodeURI(o)]}};const{splitUrl:v}=y,b=Object.freeze({id:"",pointer:"",instance:void 0}),m=(e,t=b)=>Object.freeze({...t,pointer:v(e)[1]}),w=e=>h.get(e.pointer,e.instance),g=(e,t)=>{const r=h.append(e,t.pointer);return m("#"+encodeURI(r),t)},O=r((e,t)=>w(t).map((r,n)=>e(g(n,t),n))),E=r((e,t)=>w(t).map((e,r)=>g(r,t)).filter((t,r)=>e(t,r))),$=r((e,t,r)=>w(r).reduce((t,n,o)=>e(t,g(o,r),o),t)),x=r((e,t)=>Object.keys(w(t)).every((r,n)=>e(g(r,t),n))),P=r((e,t)=>Object.keys(w(t)).some((r,n)=>e(g(r,t),n)));var j={cons:(e,t="")=>Object.freeze({...b,id:t,instance:e}),get:m,uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:w,step:g,entries:e=>Object.keys(w(e)).map(t=>[t,g(t,e)]),map:O,filter:E,reduce:$,every:x,some:P},A=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,S=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,I=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,V=/\\([\u000b\u0020-\u00ff])/g,T=/([\\"])/g,k=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/; | ||
/*! | ||
@@ -6,3 +6,3 @@ * content-type | ||
* MIT Licensed | ||
*/function R(e){var t=String(e);if(I.test(t))return t;if(t.length>0&&!S.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(T,"\\$1")+'"'}function K(e){this.parameters=Object.create(null),this.type=e}var L={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!k.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,i=Object.keys(t).sort(),a=0;a<i.length;a++){if(o=i[a],!I.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+R(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(!k.test(n))throw new TypeError("invalid media type");var o=new K(n.toLowerCase());if(-1!==r){var i,a,s;for(A.lastIndex=r;a=A.exec(t);){if(a.index!==r)throw new TypeError("invalid parameter format");r+=a[0].length,i=a[1].toLowerCase(),'"'===(s=a[2])[0]&&(s=s.substr(1,s.length-2).replace(V,"$1")),o.parameters[i]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},C=function(e,t){if(e=e.trim(),(t=t.trim()).startsWith("about:"))return t;if(""===e)return W(t)?U(t):t;const r=function(e){const t={host:"",path:"",query:"",protocol:""};let r=e,n=e.indexOf("//");if(-1===n)throw new Error("Error, protocol is not specified");t.protocol=r.substring(0,n),n+=2;const o=e.indexOf("/",n),i=e.indexOf("?"),a=e.indexOf("#");-1!==a&&(r=r.substring(0,a));if(-1!==i){const e=r.substring(i);t.query=e,r=r.substring(0,i)}if(-1!==o){const e=r.substring(0,o);t.host=e,r=r.substring(o),t.path=r}else t.host=r;return t}(e);if(""===t){const{host:e,path:t,query:n}=r;return t||n?e+t+n:U(e)}const n=function(e){const t={href:e,hash:"",query:"",netPath:!1,absolutePath:!1,relativePath:!1};if(z.test(e))return t.netPath=!0,t;"/"===e[0]?t.absolutePath=!0: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(n.netPath)return n.href.startsWith("//")&&(n.href=r.protocol+n.href),W(n.href)?U(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+q(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let i,a=r.path,s=r.host;return 0===e.length?i=a:(a=a.substring(0,a.lastIndexOf("/")),i=q(a+"/"+e)),s+=""!==i||t||o?i+t+o:"/",s}};function U(e){return e+("/"===e[e.length-1]?"":"/")}function q(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 z=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");function W(e){const t=e.indexOf("//")+2,r=!e.includes("/",t),n=!e.includes("?",t),o=!e.includes("#",t);return r&&n&&o}var _=fetch;const{isObject:B,splitUrl:D}=y,F=Symbol("$__jref"),M={},Z={},N=(e,t)=>{const r=e in Z?Z[e]:e;if(r in M)return M[r][t]},J={},G={},H=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=D(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=N(n,"idToken"),i=D(t)[0],a=ee(i,e[o]||""),s=D(a)[0];if(!s)throw Error("Couldn't determine an identifier for the schema");i&&(G[i]=s);const c=!!e.$recursiveAnchor;let u;delete e.$recursiveAnchor,N(n,"vocabulary")&&B(e)&&"$vocabulary"in e?(Z[s]=n,u=e.$vocabulary,delete e.$vocabulary):u=s===n?{[n]:!0}:{};const l={};J[s]={id:s,schemaVersion:n,schema:Q(e,s,n,h.nil,l),anchors:l,recursiveAnchor:c,vocabulary:u,validated:!1}},Q=(e,t,r,n,o)=>{if(B(e)){const i=N(r,"idToken"),a=N(r,"anchorToken");if("string"==typeof e[i]){const n=e[i],o=ee(t,n),[s,c]=D(o);if(delete e[i],c&&(e[a]=a!==i?encodeURI(c):`#${encodeURI(c)}`),s!==t)return H(e,ee(t,s),r),{[F]:n}}if("string"==typeof e[a]){const t=a!==i?e[a]:e[a].slice(1);o[t]=n,delete e[a]}return Object.entries(e).reduce((e,[i,a])=>(e[i]=Q(a,t,r,h.append(i,n),o),e),{})}return Array.isArray(e)?e.map((e,i)=>Q(e,t,r,h.append(i,n),o)):e},X=Object.freeze({id:"http://",schemaVersion:void 0,pointer:"",schema:void 0,recursiveAnchor:!1}),Y=async(e,t=X,r=!1)=>{const n=r&&t.recursiveAnchor?t.recursiveAnchor:ne(t),o=ee(n,e),[i,a]=D(o);if(!(e=>e in J||e in G)(i)){const e=await _(i,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error(`Failed to retrieve schema with id: ${i}`);if(e.headers.has("content-type")){const t=L.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${i} is not a schema. Found a document with media type: ${t}`)}H(await e.json(),i)}const s=(e=>J[G[e]]||J[e])(i),c=Object.freeze({id:s.id,schemaVersion:s.schemaVersion,vocabulary:s.vocabulary,pointer:a&&"/"!==a[0]?re(s,a):a,schema:s.schema,recursiveAnchor:t.recursiveAnchor||!!s.recursiveAnchor&&i,validated:s.validated}),u=oe(c);return B(u)&&F in u?Y(u[F],c):N(c.schemaVersion,"jsonReference")&&B(u)&&"string"==typeof u.$ref?Y(u.$ref,c):N(c.schemaVersion,"keywordReference")&&"string"==typeof u&&c.pointer.endsWith("/$ref")?Y(u,c):N(c.schemaVersion,"keywordRecursiveReference")&&"string"==typeof u&&c.pointer.endsWith("/$recursiveRef")?Y(u,c,!0):c},ee=(e,t)=>{const r=C(e,t);if("file"===te(r)&&"file"!==te(e))throw Error("Can't access file resource from network context");return r},te=e=>{const t=e.match(/^(.+):\/\//);return t?t[1]:""},re=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},ne=e=>`${e.id}#${encodeURI(e.pointer)}`,oe=e=>h.get(e.pointer,e.schema),ie=(e,t)=>{const r=h.append(e,t.pointer);return Y(`#${encodeURI(r)}`,t)},ae=r((e,t)=>oe(t).map(async(r,n)=>e(await ie(n,t),n)));var se={setConfig:(e,t,r)=>{M[e]||(M[e]={}),M[e][t]=r},getConfig:N,add:H,get:Y,markValidated:e=>{J[e].validated=!0},uri:ne,value:oe,has:(e,t)=>e in oe(t),step:ie,entries:e=>Object.keys(oe(e)).map(t=>[t,ie(t,e)]),map:ae};const ce="FLAG",ue="BASIC",le="DETAILED",fe="VERBOSE";let de=le,pe=!0;const he=(e,r)=>(n,o=ce)=>{if(![ce,ue,le,fe].includes(o))throw Error(`The '${o}' error format is not supported`);let i=[];const a=t.subscribe("result",ye(o,i));return xe(r,n,e),t.unsubscribe(a),i[0]},ye=(e,t)=>{const r=[];return(n,o)=>{const i={...o,errors:[]};for(;r.length>0&&ve(r[r.length-1],i);){const t=r.pop();let n=[];if(e===ue&&(n=t.errors,delete t.errors),i.errors.unshift(t,...n),be(i))break}(e===fe||e!==ce&&!i.valid)&&r.push(i),t[0]=i}},ve=(e,t)=>e.instanceLocation.startsWith(t.instanceLocation)&&(e.absoluteKeywordLocation.startsWith(t.absoluteKeywordLocation)||be(e)),be=e=>e.keyword.endsWith("#$ref")||e.keyword.endsWith("#$recursiveRef"),me={},we=e=>me[e],ge=e=>e in me,Oe={},$e={},Ee=async(e,t)=>{if(!ge(`${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 Oe)Object.entries(Oe[e]).forEach(([e,r])=>{((e,t)=>{me[e]={collectEvaluatedItems:(e,r,n)=>t.interpret(e,r,n)&&0,collectEvaluatedProperties:(e,r,n)=>t.interpret(e,r,n)&&[],...t}})(`${t.id}#${e}`,r)});else if(r)throw Error(`Missing required vocabulary: ${e}`)})}if(pe&&!e.validated){if(se.markValidated(e.id),!(e.schemaVersion in $e)){const t=await se.get(e.schemaVersion),r={},n=await Ee(t,r);$e[t.id]=he(r,n)}const t=P.cons(e.schema,e.id),r=$e[e.schemaVersion](t,de);if(!r.valid)throw r}return await we(`${e.schemaVersion}#validate`).compile(e,t),se.uri(e)},xe=(e,t,r)=>{const[n]=r[e];return we(n).interpret(e,t,r)};var je={validate:async(e,t,r)=>{const n={},o=await Ee(e,n),i=(e,t=ce)=>he(n,o)(P.cons(e),t);return void 0===t?i:i(t,r)},setMetaOutputFormat:e=>{de=e},setShouldMetaValidate:e=>{pe=e},FLAG:ce,BASIC:ue,DETAILED:le,VERBOSE:fe,getKeyword:we,hasKeyword:ge,defineVocabulary:(e,t)=>{Oe[e]=t},compileSchema:Ee,interpretSchema:xe,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return we(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return we(o).collectEvaluatedItems(e,t,r,n)}};var Pe={compile:()=>{},interpret:()=>!0},Ae=async e=>Object.entries(await e),Se=r(async(e,t)=>(await t).map(e)),Ie=r(async(e,t,r)=>(await r).reduce(async(t,r)=>e(await t,r),t)),Ve=r(async(e,t,r={})=>Ie(async(t,r)=>await e(r)?t.concat([r]):t,[],t,r)),Te=r(async(e,t)=>{const r=await Se(e,t);return(await Promise.all(r)).some(e=>e)}),ke=r(async(e,t)=>{const r=await Se(e,t);return(await Promise.all(r)).every(e=>e)}),Re=r((e,t)=>e.reduce(async(e,t)=>t(await e),t)),Ke={entries:Ae,map:Se,filter:Ve,reduce:Ie,some:Te,every:ke,pipeline:Re,all:e=>Promise.all(e),allValues:e=>Re([Ae,Ie(async(e,[t,r])=>(e[t]=await r,e),{})],e)};var Le={compile:async(e,t)=>{const r=se.uri(e);if(!(r in t)){t[r]=!1;const n=se.value(e);t[r]=[`${e.schemaVersion}#validate`,se.uri(e),"boolean"==typeof n?n:await Ke.pipeline([se.entries,Ke.map(([t,r])=>[`${e.schemaVersion}#${t}`,r]),Ke.filter(([t])=>je.hasKeyword(t)&&t!==`${e.schemaVersion}#validate`),Ke.map(async([r,n])=>{const o=await n,i=await je.getKeyword(r).compile(o,t,e);return[r,se.uri(o),i]}),Ke.all],e)]}},interpret:(e,r,n)=>{const[o,i,a]=n[e],s="boolean"==typeof a?a:a.every(([e,o,i])=>{const a=je.getKeyword(e).interpret(i,r,n);return t.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:P.uri(r),valid:a}),a});return t.publishSync("result",{keyword:o,absoluteKeywordLocation:i,instanceLocation:P.uri(r),valid:s}),s},collectEvaluatedProperties:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedProperties")).reduce((e,[n,,o])=>{const i=e&&je.getKeyword(n).collectEvaluatedProperties(o,t,r);return i&&e.concat(i)},[])},collectEvaluatedItems:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedItems")).reduce((e,[n,,o])=>{const i=!1!==e&&je.getKeyword(n).collectEvaluatedItems(o,t,r);return!1!==i&&Math.max(e,i)},0)}},Ce={Core:je,Schema:se,Instance:P,Keywords:{metaData:Pe,validate:Le}},Ue=Ce.Core,qe=Ce.Schema,ze=Ce.Instance,We=Ce.Keywords;exports.Core=Ue,exports.Instance=ze,exports.Keywords=We,exports.Schema=qe,exports.default=Ce; | ||
*/function R(e){var t=String(e);if(I.test(t))return t;if(t.length>0&&!S.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(T,"\\$1")+'"'}function K(e){this.parameters=Object.create(null),this.type=e}var L={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!k.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,i=Object.keys(t).sort(),a=0;a<i.length;a++){if(o=i[a],!I.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+R(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(!k.test(n))throw new TypeError("invalid media type");var o=new K(n.toLowerCase());if(-1!==r){var i,a,s;for(A.lastIndex=r;a=A.exec(t);){if(a.index!==r)throw new TypeError("invalid parameter format");r+=a[0].length,i=a[1].toLowerCase(),'"'===(s=a[2])[0]&&(s=s.substr(1,s.length-2).replace(V,"$1")),o.parameters[i]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},C=function(e,t){if(e=e.trim(),(t=t.trim()).startsWith("about:"))return t;const r=function(e){const t={host:"",path:"",query:"",protocol:""};let r=e,n=e.indexOf("//");t.protocol=r.substring(0,n),n+=2;const o=e.indexOf("/",n),i=e.indexOf("?"),a=e.indexOf("#");-1!==a&&(r=r.substring(0,a));if(-1!==i){const e=r.substring(i);t.query=e,r=r.substring(0,i)}if(-1!==o){const e=r.substring(0,o);t.host=e,r=r.substring(o),t.path=r}else t.host=r;return t}(e),n=function(e){const t={href:e,hash:"",query:"",netPath:!1,absolutePath:!1,relativePath:!1};if(z.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)?U(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+q(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let i,a=r.path,s=r.host;return 0===e.length?i=a:(a=a.substring(0,a.lastIndexOf("/")),i=q(a+"/"+e)),s+=""!==i||t||o?i+t+o:"/",s}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:U(e)}};function U(e){return e+("/"===e[e.length-1]?"":"/")}function q(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 z=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");var W=fetch;const{isObject:_,splitUrl:B}=y,D=Symbol("$__jref"),F={},M={},Z=(e,t)=>{const r=e in M?M[e]:e;if(r in F)return F[r][t]},N={},J={},G=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=B(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=Z(n,"idToken"),i=B(t)[0],a=Y(i,e[o]||""),s=B(a)[0];if(!s)throw Error("Couldn't determine an identifier for the schema");i&&(J[i]=s);const c=!!e.$recursiveAnchor;let u;delete e.$recursiveAnchor,Z(n,"vocabulary")&&_(e)&&"$vocabulary"in e?(M[s]=n,u=e.$vocabulary,delete e.$vocabulary):u=s===n?{[n]:!0}:{};const l={};N[s]={id:s,schemaVersion:n,schema:H(e,s,n,h.nil,l),anchors:l,recursiveAnchor:c,vocabulary:u,validated:!1}},H=(e,t,r,n,o)=>{if(_(e)){const i=Z(r,"idToken"),a=Z(r,"anchorToken");if("string"==typeof e[i]){const n=e[i],o=Y(t,n),[s,c]=B(o);if(delete e[i],c&&(e[a]=a!==i?encodeURI(c):"#"+encodeURI(c)),s!==t)return G(e,Y(t,s),r),{[D]:n}}if("string"==typeof e[a]){const t=a!==i?e[a]:e[a].slice(1);o[t]=n,delete e[a]}return Object.entries(e).reduce((e,[i,a])=>(e[i]=H(a,t,r,h.append(i,n),o),e),{})}return Array.isArray(e)?e.map((e,i)=>H(e,t,r,h.append(i,n),o)):e},Q=Object.freeze({id:"",schemaVersion:void 0,pointer:"",schema:void 0,recursiveAnchor:!1}),X=async(e,t=Q,r=!1)=>{const n=r&&t.recursiveAnchor?t.recursiveAnchor:re(t),o=Y(n,e),[i,a]=B(o);if(!(e=>e in N||e in J)(i)){const e=await W(i,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error("Failed to retrieve schema with id: "+i);if(e.headers.has("content-type")){const t=L.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${i} is not a schema. Found a document with media type: ${t}`)}G(await e.json(),i)}const s=(e=>N[J[e]]||N[e])(i),c=Object.freeze({id:s.id,schemaVersion:s.schemaVersion,vocabulary:s.vocabulary,pointer:a&&"/"!==a[0]?te(s,a):a,schema:s.schema,recursiveAnchor:t.recursiveAnchor||!!s.recursiveAnchor&&i,validated:s.validated}),u=ne(c);return _(u)&&D in u?X(u[D],c):Z(c.schemaVersion,"jsonReference")&&_(u)&&"string"==typeof u.$ref?X(u.$ref,c):Z(c.schemaVersion,"keywordReference")&&"string"==typeof u&&c.pointer.endsWith("/$ref")?X(u,c):Z(c.schemaVersion,"keywordRecursiveReference")&&"string"==typeof u&&c.pointer.endsWith("/$recursiveRef")?X(u,c,!0):c},Y=(e,t)=>{const r=C(e,t),n=B(e)[0];if(n&&"file"===ee(r)&&"file"!==ee(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},ee=e=>{const t=e.match(/^(.+):\/\//);return t?t[1]:""},te=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},re=e=>`${e.id}#${encodeURI(e.pointer)}`,ne=e=>h.get(e.pointer,e.schema),oe=(e,t)=>{const r=h.append(e,t.pointer);return X("#"+encodeURI(r),t)},ie=r((e,t)=>ne(t).map(async(r,n)=>e(await oe(n,t),n)));var ae={setConfig:(e,t,r)=>{F[e]||(F[e]={}),F[e][t]=r},getConfig:Z,add:G,get:X,markValidated:e=>{N[e].validated=!0},uri:re,value:ne,has:(e,t)=>e in ne(t),step:oe,entries:e=>Object.keys(ne(e)).map(t=>[t,oe(t,e)]),map:ie};const se="FLAG",ce="BASIC",ue="DETAILED",le="VERBOSE";let fe=ue,de=!0;const pe=(e,r)=>(n,o=se)=>{if(![se,ce,ue,le].includes(o))throw Error(`The '${o}' error format is not supported`);let i=[];const a=t.subscribe("result",he(o,i));return $e(r,n,e),t.unsubscribe(a),i[0]},he=(e,t)=>{const r=[];return(n,o)=>{const i={...o,errors:[]};for(;r.length>0&&ye(r[r.length-1],i);){const t=r.pop();let n=[];if(e===ce&&(n=t.errors,delete t.errors),i.errors.unshift(t,...n),ve(i))break}(e===le||e!==se&&!i.valid)&&r.push(i),t[0]=i}},ye=(e,t)=>e.instanceLocation.startsWith(t.instanceLocation)&&(e.absoluteKeywordLocation.startsWith(t.absoluteKeywordLocation)||ve(e)),ve=e=>e.keyword.endsWith("#$ref")||e.keyword.endsWith("#$recursiveRef"),be={},me=e=>be[e],we=e=>e in be,ge={},Oe={},Ee=async(e,t)=>{if(!we(e.schemaVersion+"#validate")){const t=await ae.get(e.schemaVersion);(ae.getConfig(t.id,"mandatoryVocabularies")||[]).forEach(e=>{if(!t.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)}),Object.entries(t.vocabulary).forEach(([e,r])=>{if(e in ge)Object.entries(ge[e]).forEach(([e,r])=>{((e,t)=>{be[e]={collectEvaluatedItems:(e,r,n)=>t.interpret(e,r,n)&&0,collectEvaluatedProperties:(e,r,n)=>t.interpret(e,r,n)&&[],...t}})(`${t.id}#${e}`,r)});else if(r)throw Error("Missing required vocabulary: "+e)})}if(de&&!e.validated){if(ae.markValidated(e.id),!(e.schemaVersion in Oe)){const t=await ae.get(e.schemaVersion),r={},n=await Ee(t,r);Oe[t.id]=pe(r,n)}const t=j.cons(e.schema,e.id),r=Oe[e.schemaVersion](t,fe);if(!r.valid)throw r}return await me(e.schemaVersion+"#validate").compile(e,t),ae.uri(e)},$e=(e,t,r)=>{const[n]=r[e];return me(n).interpret(e,t,r)};var xe={validate:async(e,t,r)=>{const n={},o=await Ee(e,n),i=(e,t=se)=>pe(n,o)(j.cons(e),t);return void 0===t?i:i(t,r)},setMetaOutputFormat:e=>{fe=e},setShouldMetaValidate:e=>{de=e},FLAG:se,BASIC:ce,DETAILED:ue,VERBOSE:le,getKeyword:me,hasKeyword:we,defineVocabulary:(e,t)=>{ge[e]=t},compileSchema:Ee,interpretSchema:$e,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return me(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return me(o).collectEvaluatedItems(e,t,r,n)}};var Pe={compile:()=>{},interpret:()=>!0},je=async e=>Object.entries(await e),Ae=r(async(e,t)=>(await t).map(e)),Se=r(async(e,t,r)=>(await r).reduce(async(t,r)=>e(await t,r),t)),Ie=r(async(e,t,r={})=>Se(async(t,r)=>await e(r)?t.concat([r]):t,[],t,r)),Ve=r(async(e,t)=>{const r=await Ae(e,t);return(await Promise.all(r)).some(e=>e)}),Te=r(async(e,t)=>{const r=await Ae(e,t);return(await Promise.all(r)).every(e=>e)}),ke=r((e,t)=>e.reduce(async(e,t)=>t(await e),t)),Re={entries:je,map:Ae,filter:Ie,reduce:Se,some:Ve,every:Te,pipeline:ke,all:e=>Promise.all(e),allValues:e=>ke([je,Se(async(e,[t,r])=>(e[t]=await r,e),{})],e)};var Ke={compile:async(e,t)=>{const r=ae.uri(e);if(!(r in t)){t[r]=!1;const n=ae.value(e);t[r]=[e.schemaVersion+"#validate",ae.uri(e),"boolean"==typeof n?n:await Re.pipeline([ae.entries,Re.map(([t,r])=>[`${e.schemaVersion}#${t}`,r]),Re.filter(([t])=>xe.hasKeyword(t)&&t!==e.schemaVersion+"#validate"),Re.map(async([r,n])=>{const o=await n,i=await xe.getKeyword(r).compile(o,t,e);return[r,ae.uri(o),i]}),Re.all],e)]}},interpret:(e,r,n)=>{const[o,i,a]=n[e],s="boolean"==typeof a?a:a.every(([e,o,i])=>{const a=xe.getKeyword(e).interpret(i,r,n);return t.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:j.uri(r),valid:a}),a});return t.publishSync("result",{keyword:o,absoluteKeywordLocation:i,instanceLocation:j.uri(r),valid:s}),s},collectEvaluatedProperties:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedProperties")).reduce((e,[n,,o])=>{const i=e&&xe.getKeyword(n).collectEvaluatedProperties(o,t,r);return i&&e.concat(i)},[])},collectEvaluatedItems:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedItems")).reduce((e,[n,,o])=>{const i=!1!==e&&xe.getKeyword(n).collectEvaluatedItems(o,t,r);return!1!==i&&Math.max(e,i)},0)}},Le={Core:xe,Schema:ae,Instance:j,Keywords:{metaData:Pe,validate:Ke}},Ce=Le.Core,Ue=Le.Schema,qe=Le.Instance,ze=Le.Keywords;exports.Core=Ce,exports.Instance=qe,exports.Keywords=ze,exports.Schema=Ue,exports.default=Le; | ||
//# sourceMappingURL=json-schema-core-cjs.min.js.map |
@@ -839,6 +839,2 @@ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; | ||
if (protocolEndIndex === -1) { | ||
throw new Error('Error, protocol is not specified'); | ||
} | ||
resultObject.protocol = path.substring(0, protocolEndIndex); | ||
@@ -902,3 +898,3 @@ | ||
// return resultObject | ||
} else { | ||
} else if (relative !== '') { | ||
resultObject.relativePath = true; | ||
@@ -953,23 +949,9 @@ } | ||
// if base is empty, assume relative is a net path. | ||
if (base === '') { | ||
if (_shouldAddSlash(relative)) { | ||
return _addSlash(relative); | ||
} | ||
// add / at end if not present if is only the host | ||
return relative; | ||
} | ||
const baseObj = _baseParse(base); | ||
// relative is empty, return base minus hash | ||
if (relative === '') { | ||
const {host, path, query} = baseObj; | ||
// when path and query aren't supplied add slash | ||
if ((!path) && (!query)) { | ||
return _addSlash(host); | ||
} | ||
return host + path + query; | ||
const relativeObj = _relativeParse(relative); | ||
if (!baseObj.protocol && !relativeObj.netPath) { | ||
throw new Error('Error, protocol is not specified'); | ||
} | ||
const relativeObj = _relativeParse(relative); | ||
if (relativeObj.netPath) { // relative is full qualified URL | ||
@@ -1013,2 +995,9 @@ if (_shouldAddProtocol(relativeObj.href)) { | ||
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; | ||
} | ||
@@ -1145,3 +1134,3 @@ } | ||
// Schema Retrieval | ||
const nil$2 = Object.freeze({ id: "http://", schemaVersion: undefined, pointer: "", schema: undefined, recursiveAnchor: false }); | ||
const nil$2 = Object.freeze({ id: "", schemaVersion: undefined, pointer: "", schema: undefined, recursiveAnchor: false }); | ||
@@ -1198,4 +1187,5 @@ const get$2 = async (url, contextDoc = nil$2, recursive = false) => { | ||
const resolvedUrl = urlResolveBrowser(contextUrl, url); | ||
if (getScheme(resolvedUrl) === "file" && getScheme(contextUrl) !== "file") { | ||
throw Error("Can't access file resource from network context"); | ||
const contextId = splitUrl$2(contextUrl)[0]; | ||
if (contextId && getScheme(resolvedUrl) === "file" && getScheme(contextId) !== "file") { | ||
throw Error(`Can't access file '${resolvedUrl}' resource from network context '${contextUrl}'`); | ||
} | ||
@@ -1202,0 +1192,0 @@ return resolvedUrl; |
@@ -1,2 +0,2 @@ | ||
var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var t=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(t,r){!function(e,n){var o={};e.PubSub=o;var i=e.define;!function(e){var t={},r=-1;function n(e){var t;for(t in e)if(e.hasOwnProperty(t))return!0;return!1}function o(e,t,r){try{e(t,r)}catch(e){setTimeout(function(e){return function(){throw e}}(e),0)}}function i(e,t,r){e(t,r)}function a(e,r,n,a){var s,c=t[r],u=a?i:o;if(t.hasOwnProperty(r))for(s in c)c.hasOwnProperty(s)&&u(c[s],e,n)}function s(e,r,o,i){var s=function(e,t,r){return function(){var n=String(e),o=n.lastIndexOf(".");for(a(e,e,t,r);-1!==o;)o=(n=n.substr(0,o)).lastIndexOf("."),a(e,n,t,r)}}(e="symbol"==typeof e?e.toString():e,r,i);return!!function(e){for(var r=String(e),o=Boolean(t.hasOwnProperty(r)&&n(t[r])),i=r.lastIndexOf(".");!o&&-1!==i;)i=(r=r.substr(0,i)).lastIndexOf("."),o=Boolean(t.hasOwnProperty(r)&&n(t[r]));return o}(e)&&(!0===o?s():setTimeout(s,0),!0)}e.publish=function(t,r){return s(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return s(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,t.hasOwnProperty(e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n=0;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n++;return n},e.getSubscriptions=function(e){var r,n=[];for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,i,a="string"==typeof r&&(t.hasOwnProperty(r)||function(e){var r;for(r in t)if(t.hasOwnProperty(r)&&0===r.indexOf(e))return!0;return!1}(r)),s=!a&&"string"==typeof r,c="function"==typeof r,u=!1;if(!a){for(n in t)if(t.hasOwnProperty(n)){if(o=t[n],s&&o[r]){delete o[r],u=r;break}if(c)for(i in o)o.hasOwnProperty(i)&&o[i]===r&&(delete o[i],u=!0)}return u}e.clearSubscriptions(r)}}(o),"function"==typeof i&&i.amd?i((function(){return o})):(void 0!==t&&t.exports&&(r=t.exports=o),r.PubSub=o,t.exports=r=o)}("object"==typeof window&&window||e)})),r=(t.PubSub,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)))}}});const n=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(l)},o=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const i=e.shift();return{...t,[i]:o(e,d(t,i,n),r,c(i,n))}}if(Array.isArray(t)){const n=[...t];return n[f(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:d(t,e[0],n)},i=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||p(t)){const o=e.shift();i(e,d(t,o,n),r,c(o,n))}else{t[f(t,e[0])]=r}},a=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=d(t,n,r);return{...t,[n]:a(e,o,c(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 d(t,e[0],r)}},s=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=d(t,n,r);s(e,o,c(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:d(t,e[0],r)},c=r((e,t)=>t+"/"+u(e)),u=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),l=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),f=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,d=(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(p(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[f(e,t)]},p=e=>null===e||"object"!=typeof e;var h={nil:"",append:c,get:(e,t)=>{const r=n(e),o=e=>r.reduce(([e,t],r)=>[d(e,r,t),c(r,t)],[e,""])[0];return void 0===t?o:o(t)},set:(e,t,i)=>{const a=n(e),s=r((e,t)=>o(a,e,t,""));return void 0===t?s:s(t,i)},assign:(e,t,o)=>{const a=n(e),s=r((e,t)=>i(a,e,t,""));return void 0===t?s:s(t,o)},unset:(e,t)=>{const r=n(e),o=e=>a(r,e,"");return void 0===t?o:o(t)},delete:(e,t)=>{const r=n(e),o=e=>s(r,e,"");return void 0===t?o:o(t)}};var y={isObject:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,splitUrl:e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),o=e.slice(r+1);return[decodeURI(n),decodeURI(o)]}};const{splitUrl:v}=y,b=Object.freeze({id:"",pointer:"",instance:void 0}),m=(e,t=b)=>Object.freeze({...t,pointer:v(e)[1]}),w=e=>h.get(e.pointer,e.instance),g=(e,t)=>{const r=h.append(e,t.pointer);return m(`#${encodeURI(r)}`,t)},O=r((e,t)=>w(t).map((r,n)=>e(g(n,t),n))),$=r((e,t)=>w(t).map((e,r)=>g(r,t)).filter((t,r)=>e(t,r))),E=r((e,t,r)=>w(r).reduce((t,n,o)=>e(t,g(o,r),o),t)),x=r((e,t)=>Object.keys(w(t)).every((r,n)=>e(g(r,t),n))),j=r((e,t)=>Object.keys(w(t)).some((r,n)=>e(g(r,t),n)));var P={cons:(e,t="")=>Object.freeze({...b,id:t,instance:e}),get:m,uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:w,step:g,entries:e=>Object.keys(w(e)).map(t=>[t,g(t,e)]),map:O,filter:$,reduce:E,every:x,some:j},A=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,S=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,I=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,V=/\\([\u000b\u0020-\u00ff])/g,T=/([\\"])/g,k=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/; | ||
var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var t=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(t,r){!function(e,n){var o={};e.PubSub=o;var i=e.define;!function(e){var t={},r=-1;function n(e){var t;for(t in e)if(e.hasOwnProperty(t))return!0;return!1}function o(e,t,r){try{e(t,r)}catch(e){setTimeout(function(e){return function(){throw e}}(e),0)}}function i(e,t,r){e(t,r)}function a(e,r,n,a){var s,c=t[r],u=a?i:o;if(t.hasOwnProperty(r))for(s in c)c.hasOwnProperty(s)&&u(c[s],e,n)}function s(e,r,o,i){var s=function(e,t,r){return function(){var n=String(e),o=n.lastIndexOf(".");for(a(e,e,t,r);-1!==o;)o=(n=n.substr(0,o)).lastIndexOf("."),a(e,n,t,r)}}(e="symbol"==typeof e?e.toString():e,r,i);return!!function(e){for(var r=String(e),o=Boolean(t.hasOwnProperty(r)&&n(t[r])),i=r.lastIndexOf(".");!o&&-1!==i;)i=(r=r.substr(0,i)).lastIndexOf("."),o=Boolean(t.hasOwnProperty(r)&&n(t[r]));return o}(e)&&(!0===o?s():setTimeout(s,0),!0)}e.publish=function(t,r){return s(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return s(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,t.hasOwnProperty(e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n=0;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n++;return n},e.getSubscriptions=function(e){var r,n=[];for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,i,a="string"==typeof r&&(t.hasOwnProperty(r)||function(e){var r;for(r in t)if(t.hasOwnProperty(r)&&0===r.indexOf(e))return!0;return!1}(r)),s=!a&&"string"==typeof r,c="function"==typeof r,u=!1;if(!a){for(n in t)if(t.hasOwnProperty(n)){if(o=t[n],s&&o[r]){delete o[r],u=r;break}if(c)for(i in o)o.hasOwnProperty(i)&&o[i]===r&&(delete o[i],u=!0)}return u}e.clearSubscriptions(r)}}(o),"function"==typeof i&&i.amd?i((function(){return o})):(void 0!==t&&t.exports&&(r=t.exports=o),r.PubSub=o,t.exports=r=o)}("object"==typeof window&&window||e)})),r=(t.PubSub,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)))}}});const n=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(l)},o=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const i=e.shift();return{...t,[i]:o(e,d(t,i,n),r,c(i,n))}}if(Array.isArray(t)){const n=[...t];return n[f(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:d(t,e[0],n)},i=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||p(t)){const o=e.shift();i(e,d(t,o,n),r,c(o,n))}else{t[f(t,e[0])]=r}},a=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=d(t,n,r);return{...t,[n]:a(e,o,c(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 d(t,e[0],r)}},s=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=d(t,n,r);s(e,o,c(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:d(t,e[0],r)},c=r((e,t)=>t+"/"+u(e)),u=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),l=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),f=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,d=(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(p(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[f(e,t)]},p=e=>null===e||"object"!=typeof e;var h={nil:"",append:c,get:(e,t)=>{const r=n(e),o=e=>r.reduce(([e,t],r)=>[d(e,r,t),c(r,t)],[e,""])[0];return void 0===t?o:o(t)},set:(e,t,i)=>{const a=n(e),s=r((e,t)=>o(a,e,t,""));return void 0===t?s:s(t,i)},assign:(e,t,o)=>{const a=n(e),s=r((e,t)=>i(a,e,t,""));return void 0===t?s:s(t,o)},unset:(e,t)=>{const r=n(e),o=e=>a(r,e,"");return void 0===t?o:o(t)},delete:(e,t)=>{const r=n(e),o=e=>s(r,e,"");return void 0===t?o:o(t)}};var y={isObject:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,splitUrl:e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),o=e.slice(r+1);return[decodeURI(n),decodeURI(o)]}};const{splitUrl:v}=y,b=Object.freeze({id:"",pointer:"",instance:void 0}),m=(e,t=b)=>Object.freeze({...t,pointer:v(e)[1]}),w=e=>h.get(e.pointer,e.instance),g=(e,t)=>{const r=h.append(e,t.pointer);return m("#"+encodeURI(r),t)},O=r((e,t)=>w(t).map((r,n)=>e(g(n,t),n))),E=r((e,t)=>w(t).map((e,r)=>g(r,t)).filter((t,r)=>e(t,r))),$=r((e,t,r)=>w(r).reduce((t,n,o)=>e(t,g(o,r),o),t)),x=r((e,t)=>Object.keys(w(t)).every((r,n)=>e(g(r,t),n))),P=r((e,t)=>Object.keys(w(t)).some((r,n)=>e(g(r,t),n)));var j={cons:(e,t="")=>Object.freeze({...b,id:t,instance:e}),get:m,uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:w,step:g,entries:e=>Object.keys(w(e)).map(t=>[t,g(t,e)]),map:O,filter:E,reduce:$,every:x,some:P},A=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,S=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,I=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,V=/\\([\u000b\u0020-\u00ff])/g,T=/([\\"])/g,k=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/; | ||
/*! | ||
@@ -6,3 +6,3 @@ * content-type | ||
* MIT Licensed | ||
*/function R(e){var t=String(e);if(I.test(t))return t;if(t.length>0&&!S.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(T,"\\$1")+'"'}function K(e){this.parameters=Object.create(null),this.type=e}var L={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!k.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,i=Object.keys(t).sort(),a=0;a<i.length;a++){if(o=i[a],!I.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+R(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(!k.test(n))throw new TypeError("invalid media type");var o=new K(n.toLowerCase());if(-1!==r){var i,a,s;for(A.lastIndex=r;a=A.exec(t);){if(a.index!==r)throw new TypeError("invalid parameter format");r+=a[0].length,i=a[1].toLowerCase(),'"'===(s=a[2])[0]&&(s=s.substr(1,s.length-2).replace(V,"$1")),o.parameters[i]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},C=function(e,t){if(e=e.trim(),(t=t.trim()).startsWith("about:"))return t;if(""===e)return W(t)?U(t):t;const r=function(e){const t={host:"",path:"",query:"",protocol:""};let r=e,n=e.indexOf("//");if(-1===n)throw new Error("Error, protocol is not specified");t.protocol=r.substring(0,n),n+=2;const o=e.indexOf("/",n),i=e.indexOf("?"),a=e.indexOf("#");-1!==a&&(r=r.substring(0,a));if(-1!==i){const e=r.substring(i);t.query=e,r=r.substring(0,i)}if(-1!==o){const e=r.substring(0,o);t.host=e,r=r.substring(o),t.path=r}else t.host=r;return t}(e);if(""===t){const{host:e,path:t,query:n}=r;return t||n?e+t+n:U(e)}const n=function(e){const t={href:e,hash:"",query:"",netPath:!1,absolutePath:!1,relativePath:!1};if(z.test(e))return t.netPath=!0,t;"/"===e[0]?t.absolutePath=!0: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(n.netPath)return n.href.startsWith("//")&&(n.href=r.protocol+n.href),W(n.href)?U(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+q(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let i,a=r.path,s=r.host;return 0===e.length?i=a:(a=a.substring(0,a.lastIndexOf("/")),i=q(a+"/"+e)),s+=""!==i||t||o?i+t+o:"/",s}};function U(e){return e+("/"===e[e.length-1]?"":"/")}function q(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 z=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");function W(e){const t=e.indexOf("//")+2,r=!e.includes("/",t),n=!e.includes("?",t),o=!e.includes("#",t);return r&&n&&o}var _=fetch;const{isObject:B,splitUrl:D}=y,F=Symbol("$__jref"),Z={},M={},N=(e,t)=>{const r=e in M?M[e]:e;if(r in Z)return Z[r][t]},J={},G={},H=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=D(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=N(n,"idToken"),i=D(t)[0],a=ee(i,e[o]||""),s=D(a)[0];if(!s)throw Error("Couldn't determine an identifier for the schema");i&&(G[i]=s);const c=!!e.$recursiveAnchor;let u;delete e.$recursiveAnchor,N(n,"vocabulary")&&B(e)&&"$vocabulary"in e?(M[s]=n,u=e.$vocabulary,delete e.$vocabulary):u=s===n?{[n]:!0}:{};const l={};J[s]={id:s,schemaVersion:n,schema:Q(e,s,n,h.nil,l),anchors:l,recursiveAnchor:c,vocabulary:u,validated:!1}},Q=(e,t,r,n,o)=>{if(B(e)){const i=N(r,"idToken"),a=N(r,"anchorToken");if("string"==typeof e[i]){const n=e[i],o=ee(t,n),[s,c]=D(o);if(delete e[i],c&&(e[a]=a!==i?encodeURI(c):`#${encodeURI(c)}`),s!==t)return H(e,ee(t,s),r),{[F]:n}}if("string"==typeof e[a]){const t=a!==i?e[a]:e[a].slice(1);o[t]=n,delete e[a]}return Object.entries(e).reduce((e,[i,a])=>(e[i]=Q(a,t,r,h.append(i,n),o),e),{})}return Array.isArray(e)?e.map((e,i)=>Q(e,t,r,h.append(i,n),o)):e},X=Object.freeze({id:"http://",schemaVersion:void 0,pointer:"",schema:void 0,recursiveAnchor:!1}),Y=async(e,t=X,r=!1)=>{const n=r&&t.recursiveAnchor?t.recursiveAnchor:ne(t),o=ee(n,e),[i,a]=D(o);if(!(e=>e in J||e in G)(i)){const e=await _(i,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error(`Failed to retrieve schema with id: ${i}`);if(e.headers.has("content-type")){const t=L.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${i} is not a schema. Found a document with media type: ${t}`)}H(await e.json(),i)}const s=(e=>J[G[e]]||J[e])(i),c=Object.freeze({id:s.id,schemaVersion:s.schemaVersion,vocabulary:s.vocabulary,pointer:a&&"/"!==a[0]?re(s,a):a,schema:s.schema,recursiveAnchor:t.recursiveAnchor||!!s.recursiveAnchor&&i,validated:s.validated}),u=oe(c);return B(u)&&F in u?Y(u[F],c):N(c.schemaVersion,"jsonReference")&&B(u)&&"string"==typeof u.$ref?Y(u.$ref,c):N(c.schemaVersion,"keywordReference")&&"string"==typeof u&&c.pointer.endsWith("/$ref")?Y(u,c):N(c.schemaVersion,"keywordRecursiveReference")&&"string"==typeof u&&c.pointer.endsWith("/$recursiveRef")?Y(u,c,!0):c},ee=(e,t)=>{const r=C(e,t);if("file"===te(r)&&"file"!==te(e))throw Error("Can't access file resource from network context");return r},te=e=>{const t=e.match(/^(.+):\/\//);return t?t[1]:""},re=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},ne=e=>`${e.id}#${encodeURI(e.pointer)}`,oe=e=>h.get(e.pointer,e.schema),ie=(e,t)=>{const r=h.append(e,t.pointer);return Y(`#${encodeURI(r)}`,t)},ae=r((e,t)=>oe(t).map(async(r,n)=>e(await ie(n,t),n)));var se={setConfig:(e,t,r)=>{Z[e]||(Z[e]={}),Z[e][t]=r},getConfig:N,add:H,get:Y,markValidated:e=>{J[e].validated=!0},uri:ne,value:oe,has:(e,t)=>e in oe(t),step:ie,entries:e=>Object.keys(oe(e)).map(t=>[t,ie(t,e)]),map:ae};const ce="FLAG",ue="BASIC",le="DETAILED",fe="VERBOSE";let de=le,pe=!0;const he=(e,r)=>(n,o=ce)=>{if(![ce,ue,le,fe].includes(o))throw Error(`The '${o}' error format is not supported`);let i=[];const a=t.subscribe("result",ye(o,i));return xe(r,n,e),t.unsubscribe(a),i[0]},ye=(e,t)=>{const r=[];return(n,o)=>{const i={...o,errors:[]};for(;r.length>0&&ve(r[r.length-1],i);){const t=r.pop();let n=[];if(e===ue&&(n=t.errors,delete t.errors),i.errors.unshift(t,...n),be(i))break}(e===fe||e!==ce&&!i.valid)&&r.push(i),t[0]=i}},ve=(e,t)=>e.instanceLocation.startsWith(t.instanceLocation)&&(e.absoluteKeywordLocation.startsWith(t.absoluteKeywordLocation)||be(e)),be=e=>e.keyword.endsWith("#$ref")||e.keyword.endsWith("#$recursiveRef"),me={},we=e=>me[e],ge=e=>e in me,Oe={},$e={},Ee=async(e,t)=>{if(!ge(`${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 Oe)Object.entries(Oe[e]).forEach(([e,r])=>{((e,t)=>{me[e]={collectEvaluatedItems:(e,r,n)=>t.interpret(e,r,n)&&0,collectEvaluatedProperties:(e,r,n)=>t.interpret(e,r,n)&&[],...t}})(`${t.id}#${e}`,r)});else if(r)throw Error(`Missing required vocabulary: ${e}`)})}if(pe&&!e.validated){if(se.markValidated(e.id),!(e.schemaVersion in $e)){const t=await se.get(e.schemaVersion),r={},n=await Ee(t,r);$e[t.id]=he(r,n)}const t=P.cons(e.schema,e.id),r=$e[e.schemaVersion](t,de);if(!r.valid)throw r}return await we(`${e.schemaVersion}#validate`).compile(e,t),se.uri(e)},xe=(e,t,r)=>{const[n]=r[e];return we(n).interpret(e,t,r)};var je={validate:async(e,t,r)=>{const n={},o=await Ee(e,n),i=(e,t=ce)=>he(n,o)(P.cons(e),t);return void 0===t?i:i(t,r)},setMetaOutputFormat:e=>{de=e},setShouldMetaValidate:e=>{pe=e},FLAG:ce,BASIC:ue,DETAILED:le,VERBOSE:fe,getKeyword:we,hasKeyword:ge,defineVocabulary:(e,t)=>{Oe[e]=t},compileSchema:Ee,interpretSchema:xe,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return we(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return we(o).collectEvaluatedItems(e,t,r,n)}};var Pe={compile:()=>{},interpret:()=>!0},Ae=async e=>Object.entries(await e),Se=r(async(e,t)=>(await t).map(e)),Ie=r(async(e,t,r)=>(await r).reduce(async(t,r)=>e(await t,r),t)),Ve=r(async(e,t,r={})=>Ie(async(t,r)=>await e(r)?t.concat([r]):t,[],t,r)),Te=r(async(e,t)=>{const r=await Se(e,t);return(await Promise.all(r)).some(e=>e)}),ke=r(async(e,t)=>{const r=await Se(e,t);return(await Promise.all(r)).every(e=>e)}),Re=r((e,t)=>e.reduce(async(e,t)=>t(await e),t)),Ke={entries:Ae,map:Se,filter:Ve,reduce:Ie,some:Te,every:ke,pipeline:Re,all:e=>Promise.all(e),allValues:e=>Re([Ae,Ie(async(e,[t,r])=>(e[t]=await r,e),{})],e)};var Le={compile:async(e,t)=>{const r=se.uri(e);if(!(r in t)){t[r]=!1;const n=se.value(e);t[r]=[`${e.schemaVersion}#validate`,se.uri(e),"boolean"==typeof n?n:await Ke.pipeline([se.entries,Ke.map(([t,r])=>[`${e.schemaVersion}#${t}`,r]),Ke.filter(([t])=>je.hasKeyword(t)&&t!==`${e.schemaVersion}#validate`),Ke.map(async([r,n])=>{const o=await n,i=await je.getKeyword(r).compile(o,t,e);return[r,se.uri(o),i]}),Ke.all],e)]}},interpret:(e,r,n)=>{const[o,i,a]=n[e],s="boolean"==typeof a?a:a.every(([e,o,i])=>{const a=je.getKeyword(e).interpret(i,r,n);return t.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:P.uri(r),valid:a}),a});return t.publishSync("result",{keyword:o,absoluteKeywordLocation:i,instanceLocation:P.uri(r),valid:s}),s},collectEvaluatedProperties:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedProperties")).reduce((e,[n,,o])=>{const i=e&&je.getKeyword(n).collectEvaluatedProperties(o,t,r);return i&&e.concat(i)},[])},collectEvaluatedItems:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedItems")).reduce((e,[n,,o])=>{const i=!1!==e&&je.getKeyword(n).collectEvaluatedItems(o,t,r);return!1!==i&&Math.max(e,i)},0)}},Ce={Core:je,Schema:se,Instance:P,Keywords:{metaData:Pe,validate:Le}},Ue=Ce.Core,qe=Ce.Schema,ze=Ce.Instance,We=Ce.Keywords;export default Ce;export{Ue as Core,ze as Instance,We as Keywords,qe as Schema}; | ||
*/function R(e){var t=String(e);if(I.test(t))return t;if(t.length>0&&!S.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(T,"\\$1")+'"'}function K(e){this.parameters=Object.create(null),this.type=e}var L={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!k.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,i=Object.keys(t).sort(),a=0;a<i.length;a++){if(o=i[a],!I.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+R(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(!k.test(n))throw new TypeError("invalid media type");var o=new K(n.toLowerCase());if(-1!==r){var i,a,s;for(A.lastIndex=r;a=A.exec(t);){if(a.index!==r)throw new TypeError("invalid parameter format");r+=a[0].length,i=a[1].toLowerCase(),'"'===(s=a[2])[0]&&(s=s.substr(1,s.length-2).replace(V,"$1")),o.parameters[i]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},C=function(e,t){if(e=e.trim(),(t=t.trim()).startsWith("about:"))return t;const r=function(e){const t={host:"",path:"",query:"",protocol:""};let r=e,n=e.indexOf("//");t.protocol=r.substring(0,n),n+=2;const o=e.indexOf("/",n),i=e.indexOf("?"),a=e.indexOf("#");-1!==a&&(r=r.substring(0,a));if(-1!==i){const e=r.substring(i);t.query=e,r=r.substring(0,i)}if(-1!==o){const e=r.substring(0,o);t.host=e,r=r.substring(o),t.path=r}else t.host=r;return t}(e),n=function(e){const t={href:e,hash:"",query:"",netPath:!1,absolutePath:!1,relativePath:!1};if(z.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)?U(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+q(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let i,a=r.path,s=r.host;return 0===e.length?i=a:(a=a.substring(0,a.lastIndexOf("/")),i=q(a+"/"+e)),s+=""!==i||t||o?i+t+o:"/",s}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:U(e)}};function U(e){return e+("/"===e[e.length-1]?"":"/")}function q(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 z=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");var W=fetch;const{isObject:_,splitUrl:B}=y,D=Symbol("$__jref"),F={},Z={},M=(e,t)=>{const r=e in Z?Z[e]:e;if(r in F)return F[r][t]},N={},J={},G=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=B(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=M(n,"idToken"),i=B(t)[0],a=Y(i,e[o]||""),s=B(a)[0];if(!s)throw Error("Couldn't determine an identifier for the schema");i&&(J[i]=s);const c=!!e.$recursiveAnchor;let u;delete e.$recursiveAnchor,M(n,"vocabulary")&&_(e)&&"$vocabulary"in e?(Z[s]=n,u=e.$vocabulary,delete e.$vocabulary):u=s===n?{[n]:!0}:{};const l={};N[s]={id:s,schemaVersion:n,schema:H(e,s,n,h.nil,l),anchors:l,recursiveAnchor:c,vocabulary:u,validated:!1}},H=(e,t,r,n,o)=>{if(_(e)){const i=M(r,"idToken"),a=M(r,"anchorToken");if("string"==typeof e[i]){const n=e[i],o=Y(t,n),[s,c]=B(o);if(delete e[i],c&&(e[a]=a!==i?encodeURI(c):"#"+encodeURI(c)),s!==t)return G(e,Y(t,s),r),{[D]:n}}if("string"==typeof e[a]){const t=a!==i?e[a]:e[a].slice(1);o[t]=n,delete e[a]}return Object.entries(e).reduce((e,[i,a])=>(e[i]=H(a,t,r,h.append(i,n),o),e),{})}return Array.isArray(e)?e.map((e,i)=>H(e,t,r,h.append(i,n),o)):e},Q=Object.freeze({id:"",schemaVersion:void 0,pointer:"",schema:void 0,recursiveAnchor:!1}),X=async(e,t=Q,r=!1)=>{const n=r&&t.recursiveAnchor?t.recursiveAnchor:re(t),o=Y(n,e),[i,a]=B(o);if(!(e=>e in N||e in J)(i)){const e=await W(i,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error("Failed to retrieve schema with id: "+i);if(e.headers.has("content-type")){const t=L.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${i} is not a schema. Found a document with media type: ${t}`)}G(await e.json(),i)}const s=(e=>N[J[e]]||N[e])(i),c=Object.freeze({id:s.id,schemaVersion:s.schemaVersion,vocabulary:s.vocabulary,pointer:a&&"/"!==a[0]?te(s,a):a,schema:s.schema,recursiveAnchor:t.recursiveAnchor||!!s.recursiveAnchor&&i,validated:s.validated}),u=ne(c);return _(u)&&D in u?X(u[D],c):M(c.schemaVersion,"jsonReference")&&_(u)&&"string"==typeof u.$ref?X(u.$ref,c):M(c.schemaVersion,"keywordReference")&&"string"==typeof u&&c.pointer.endsWith("/$ref")?X(u,c):M(c.schemaVersion,"keywordRecursiveReference")&&"string"==typeof u&&c.pointer.endsWith("/$recursiveRef")?X(u,c,!0):c},Y=(e,t)=>{const r=C(e,t),n=B(e)[0];if(n&&"file"===ee(r)&&"file"!==ee(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},ee=e=>{const t=e.match(/^(.+):\/\//);return t?t[1]:""},te=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},re=e=>`${e.id}#${encodeURI(e.pointer)}`,ne=e=>h.get(e.pointer,e.schema),oe=(e,t)=>{const r=h.append(e,t.pointer);return X("#"+encodeURI(r),t)},ie=r((e,t)=>ne(t).map(async(r,n)=>e(await oe(n,t),n)));var ae={setConfig:(e,t,r)=>{F[e]||(F[e]={}),F[e][t]=r},getConfig:M,add:G,get:X,markValidated:e=>{N[e].validated=!0},uri:re,value:ne,has:(e,t)=>e in ne(t),step:oe,entries:e=>Object.keys(ne(e)).map(t=>[t,oe(t,e)]),map:ie};const se="FLAG",ce="BASIC",ue="DETAILED",le="VERBOSE";let fe=ue,de=!0;const pe=(e,r)=>(n,o=se)=>{if(![se,ce,ue,le].includes(o))throw Error(`The '${o}' error format is not supported`);let i=[];const a=t.subscribe("result",he(o,i));return $e(r,n,e),t.unsubscribe(a),i[0]},he=(e,t)=>{const r=[];return(n,o)=>{const i={...o,errors:[]};for(;r.length>0&&ye(r[r.length-1],i);){const t=r.pop();let n=[];if(e===ce&&(n=t.errors,delete t.errors),i.errors.unshift(t,...n),ve(i))break}(e===le||e!==se&&!i.valid)&&r.push(i),t[0]=i}},ye=(e,t)=>e.instanceLocation.startsWith(t.instanceLocation)&&(e.absoluteKeywordLocation.startsWith(t.absoluteKeywordLocation)||ve(e)),ve=e=>e.keyword.endsWith("#$ref")||e.keyword.endsWith("#$recursiveRef"),be={},me=e=>be[e],we=e=>e in be,ge={},Oe={},Ee=async(e,t)=>{if(!we(e.schemaVersion+"#validate")){const t=await ae.get(e.schemaVersion);(ae.getConfig(t.id,"mandatoryVocabularies")||[]).forEach(e=>{if(!t.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)}),Object.entries(t.vocabulary).forEach(([e,r])=>{if(e in ge)Object.entries(ge[e]).forEach(([e,r])=>{((e,t)=>{be[e]={collectEvaluatedItems:(e,r,n)=>t.interpret(e,r,n)&&0,collectEvaluatedProperties:(e,r,n)=>t.interpret(e,r,n)&&[],...t}})(`${t.id}#${e}`,r)});else if(r)throw Error("Missing required vocabulary: "+e)})}if(de&&!e.validated){if(ae.markValidated(e.id),!(e.schemaVersion in Oe)){const t=await ae.get(e.schemaVersion),r={},n=await Ee(t,r);Oe[t.id]=pe(r,n)}const t=j.cons(e.schema,e.id),r=Oe[e.schemaVersion](t,fe);if(!r.valid)throw r}return await me(e.schemaVersion+"#validate").compile(e,t),ae.uri(e)},$e=(e,t,r)=>{const[n]=r[e];return me(n).interpret(e,t,r)};var xe={validate:async(e,t,r)=>{const n={},o=await Ee(e,n),i=(e,t=se)=>pe(n,o)(j.cons(e),t);return void 0===t?i:i(t,r)},setMetaOutputFormat:e=>{fe=e},setShouldMetaValidate:e=>{de=e},FLAG:se,BASIC:ce,DETAILED:ue,VERBOSE:le,getKeyword:me,hasKeyword:we,defineVocabulary:(e,t)=>{ge[e]=t},compileSchema:Ee,interpretSchema:$e,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return me(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return me(o).collectEvaluatedItems(e,t,r,n)}};var Pe={compile:()=>{},interpret:()=>!0},je=async e=>Object.entries(await e),Ae=r(async(e,t)=>(await t).map(e)),Se=r(async(e,t,r)=>(await r).reduce(async(t,r)=>e(await t,r),t)),Ie=r(async(e,t,r={})=>Se(async(t,r)=>await e(r)?t.concat([r]):t,[],t,r)),Ve=r(async(e,t)=>{const r=await Ae(e,t);return(await Promise.all(r)).some(e=>e)}),Te=r(async(e,t)=>{const r=await Ae(e,t);return(await Promise.all(r)).every(e=>e)}),ke=r((e,t)=>e.reduce(async(e,t)=>t(await e),t)),Re={entries:je,map:Ae,filter:Ie,reduce:Se,some:Ve,every:Te,pipeline:ke,all:e=>Promise.all(e),allValues:e=>ke([je,Se(async(e,[t,r])=>(e[t]=await r,e),{})],e)};var Ke={compile:async(e,t)=>{const r=ae.uri(e);if(!(r in t)){t[r]=!1;const n=ae.value(e);t[r]=[e.schemaVersion+"#validate",ae.uri(e),"boolean"==typeof n?n:await Re.pipeline([ae.entries,Re.map(([t,r])=>[`${e.schemaVersion}#${t}`,r]),Re.filter(([t])=>xe.hasKeyword(t)&&t!==e.schemaVersion+"#validate"),Re.map(async([r,n])=>{const o=await n,i=await xe.getKeyword(r).compile(o,t,e);return[r,ae.uri(o),i]}),Re.all],e)]}},interpret:(e,r,n)=>{const[o,i,a]=n[e],s="boolean"==typeof a?a:a.every(([e,o,i])=>{const a=xe.getKeyword(e).interpret(i,r,n);return t.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:j.uri(r),valid:a}),a});return t.publishSync("result",{keyword:o,absoluteKeywordLocation:i,instanceLocation:j.uri(r),valid:s}),s},collectEvaluatedProperties:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedProperties")).reduce((e,[n,,o])=>{const i=e&&xe.getKeyword(n).collectEvaluatedProperties(o,t,r);return i&&e.concat(i)},[])},collectEvaluatedItems:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedItems")).reduce((e,[n,,o])=>{const i=!1!==e&&xe.getKeyword(n).collectEvaluatedItems(o,t,r);return!1!==i&&Math.max(e,i)},0)}},Le={Core:xe,Schema:ae,Instance:j,Keywords:{metaData:Pe,validate:Ke}},Ce=Le.Core,Ue=Le.Schema,qe=Le.Instance,ze=Le.Keywords;export default Le;export{Ce as Core,qe as Instance,ze as Keywords,Ue as Schema}; | ||
//# sourceMappingURL=json-schema-core-esm.min.js.map |
@@ -842,6 +842,2 @@ var JSC = (function (exports) { | ||
if (protocolEndIndex === -1) { | ||
throw new Error('Error, protocol is not specified'); | ||
} | ||
resultObject.protocol = path.substring(0, protocolEndIndex); | ||
@@ -905,3 +901,3 @@ | ||
// return resultObject | ||
} else { | ||
} else if (relative !== '') { | ||
resultObject.relativePath = true; | ||
@@ -956,23 +952,9 @@ } | ||
// if base is empty, assume relative is a net path. | ||
if (base === '') { | ||
if (_shouldAddSlash(relative)) { | ||
return _addSlash(relative); | ||
} | ||
// add / at end if not present if is only the host | ||
return relative; | ||
} | ||
const baseObj = _baseParse(base); | ||
// relative is empty, return base minus hash | ||
if (relative === '') { | ||
const {host, path, query} = baseObj; | ||
// when path and query aren't supplied add slash | ||
if ((!path) && (!query)) { | ||
return _addSlash(host); | ||
} | ||
return host + path + query; | ||
const relativeObj = _relativeParse(relative); | ||
if (!baseObj.protocol && !relativeObj.netPath) { | ||
throw new Error('Error, protocol is not specified'); | ||
} | ||
const relativeObj = _relativeParse(relative); | ||
if (relativeObj.netPath) { // relative is full qualified URL | ||
@@ -1016,2 +998,9 @@ if (_shouldAddProtocol(relativeObj.href)) { | ||
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; | ||
} | ||
@@ -1148,3 +1137,3 @@ } | ||
// Schema Retrieval | ||
const nil$2 = Object.freeze({ id: "http://", schemaVersion: undefined, pointer: "", schema: undefined, recursiveAnchor: false }); | ||
const nil$2 = Object.freeze({ id: "", schemaVersion: undefined, pointer: "", schema: undefined, recursiveAnchor: false }); | ||
@@ -1201,4 +1190,5 @@ const get$2 = async (url, contextDoc = nil$2, recursive = false) => { | ||
const resolvedUrl = urlResolveBrowser(contextUrl, url); | ||
if (getScheme(resolvedUrl) === "file" && getScheme(contextUrl) !== "file") { | ||
throw Error("Can't access file resource from network context"); | ||
const contextId = splitUrl$2(contextUrl)[0]; | ||
if (contextId && getScheme(resolvedUrl) === "file" && getScheme(contextId) !== "file") { | ||
throw Error(`Can't access file '${resolvedUrl}' resource from network context '${contextUrl}'`); | ||
} | ||
@@ -1205,0 +1195,0 @@ return resolvedUrl; |
@@ -1,2 +0,2 @@ | ||
var JSC=function(e){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var r=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e,r){!function(t,n){var o={};t.PubSub=o;var i=t.define;!function(e){var t={},r=-1;function n(e){var t;for(t in e)if(e.hasOwnProperty(t))return!0;return!1}function o(e,t,r){try{e(t,r)}catch(e){setTimeout(function(e){return function(){throw e}}(e),0)}}function i(e,t,r){e(t,r)}function a(e,r,n,a){var s,c=t[r],u=a?i:o;if(t.hasOwnProperty(r))for(s in c)c.hasOwnProperty(s)&&u(c[s],e,n)}function s(e,r,o,i){var s=function(e,t,r){return function(){var n=String(e),o=n.lastIndexOf(".");for(a(e,e,t,r);-1!==o;)o=(n=n.substr(0,o)).lastIndexOf("."),a(e,n,t,r)}}(e="symbol"==typeof e?e.toString():e,r,i);return!!function(e){for(var r=String(e),o=Boolean(t.hasOwnProperty(r)&&n(t[r])),i=r.lastIndexOf(".");!o&&-1!==i;)i=(r=r.substr(0,i)).lastIndexOf("."),o=Boolean(t.hasOwnProperty(r)&&n(t[r]));return o}(e)&&(!0===o?s():setTimeout(s,0),!0)}e.publish=function(t,r){return s(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return s(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,t.hasOwnProperty(e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n=0;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n++;return n},e.getSubscriptions=function(e){var r,n=[];for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,i,a="string"==typeof r&&(t.hasOwnProperty(r)||function(e){var r;for(r in t)if(t.hasOwnProperty(r)&&0===r.indexOf(e))return!0;return!1}(r)),s=!a&&"string"==typeof r,c="function"==typeof r,u=!1;if(!a){for(n in t)if(t.hasOwnProperty(n)){if(o=t[n],s&&o[r]){delete o[r],u=r;break}if(c)for(i in o)o.hasOwnProperty(i)&&o[i]===r&&(delete o[i],u=!0)}return u}e.clearSubscriptions(r)}}(o),"function"==typeof i&&i.amd?i((function(){return o})):(void 0!==e&&e.exports&&(r=e.exports=o),r.PubSub=o,e.exports=r=o)}("object"==typeof window&&window||t)})),n=(r.PubSub,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)))}}});const o=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(f)},i=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:i(e,p(t,o,n),r,u(o,n))}}if(Array.isArray(t)){const n=[...t];return n[d(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:p(t,e[0],n)},a=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||h(t)){const o=e.shift();a(e,p(t,o,n),r,u(o,n))}else{t[d(t,e[0])]=r}},s=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=p(t,n,r);return{...t,[n]:s(e,o,u(n,r))}}if(Array.isArray(t))return t.filter((t,r)=>r!=e[0]);if("object"==typeof t&&null!==t){const{[e[0]]:r,...n}=t;return n}return p(t,e[0],r)}},c=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=p(t,n,r);c(e,o,u(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:p(t,e[0],r)},u=n((e,t)=>t+"/"+l(e)),l=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),f=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),d=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,p=(e,t,r="")=>{if(void 0===e)throw TypeError(`Value at '${r}' is undefined and does not have property '${t}'`);if(null===e)throw TypeError(`Value at '${r}' is null and does not have property '${t}'`);if(h(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[d(e,t)]},h=e=>null===e||"object"!=typeof e;var y={nil:"",append:u,get:(e,t)=>{const r=o(e),n=e=>r.reduce(([e,t],r)=>[p(e,r,t),u(r,t)],[e,""])[0];return void 0===t?n:n(t)},set:(e,t,r)=>{const a=o(e),s=n((e,t)=>i(a,e,t,""));return void 0===t?s:s(t,r)},assign:(e,t,r)=>{const i=o(e),s=n((e,t)=>a(i,e,t,""));return void 0===t?s:s(t,r)},unset:(e,t)=>{const r=o(e),n=e=>s(r,e,"");return void 0===t?n:n(t)},delete:(e,t)=>{const r=o(e),n=e=>c(r,e,"");return void 0===t?n:n(t)}};var v={isObject:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,splitUrl:e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),o=e.slice(r+1);return[decodeURI(n),decodeURI(o)]}};const{splitUrl:b}=v,m=Object.freeze({id:"",pointer:"",instance:void 0}),w=(e,t=m)=>Object.freeze({...t,pointer:b(e)[1]}),g=e=>y.get(e.pointer,e.instance),O=(e,t)=>{const r=y.append(e,t.pointer);return w(`#${encodeURI(r)}`,t)},$=n((e,t)=>g(t).map((r,n)=>e(O(n,t),n))),E=n((e,t)=>g(t).map((e,r)=>O(r,t)).filter((t,r)=>e(t,r))),j=n((e,t,r)=>g(r).reduce((t,n,o)=>e(t,O(o,r),o),t)),P=n((e,t)=>Object.keys(g(t)).every((r,n)=>e(O(r,t),n))),x=n((e,t)=>Object.keys(g(t)).some((r,n)=>e(O(r,t),n)));var A={cons:(e,t="")=>Object.freeze({...m,id:t,instance:e}),get:w,uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:g,step:O,entries:e=>Object.keys(g(e)).map(t=>[t,O(t,e)]),map:$,filter:E,reduce:j,every:P,some:x},S=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,I=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,V=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,T=/\\([\u000b\u0020-\u00ff])/g,k=/([\\"])/g,R=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/; | ||
var JSC=function(e){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var r=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e,r){!function(t,n){var o={};t.PubSub=o;var i=t.define;!function(e){var t={},r=-1;function n(e){var t;for(t in e)if(e.hasOwnProperty(t))return!0;return!1}function o(e,t,r){try{e(t,r)}catch(e){setTimeout(function(e){return function(){throw e}}(e),0)}}function i(e,t,r){e(t,r)}function a(e,r,n,a){var s,c=t[r],u=a?i:o;if(t.hasOwnProperty(r))for(s in c)c.hasOwnProperty(s)&&u(c[s],e,n)}function s(e,r,o,i){var s=function(e,t,r){return function(){var n=String(e),o=n.lastIndexOf(".");for(a(e,e,t,r);-1!==o;)o=(n=n.substr(0,o)).lastIndexOf("."),a(e,n,t,r)}}(e="symbol"==typeof e?e.toString():e,r,i);return!!function(e){for(var r=String(e),o=Boolean(t.hasOwnProperty(r)&&n(t[r])),i=r.lastIndexOf(".");!o&&-1!==i;)i=(r=r.substr(0,i)).lastIndexOf("."),o=Boolean(t.hasOwnProperty(r)&&n(t[r]));return o}(e)&&(!0===o?s():setTimeout(s,0),!0)}e.publish=function(t,r){return s(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return s(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,t.hasOwnProperty(e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n=0;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n++;return n},e.getSubscriptions=function(e){var r,n=[];for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,i,a="string"==typeof r&&(t.hasOwnProperty(r)||function(e){var r;for(r in t)if(t.hasOwnProperty(r)&&0===r.indexOf(e))return!0;return!1}(r)),s=!a&&"string"==typeof r,c="function"==typeof r,u=!1;if(!a){for(n in t)if(t.hasOwnProperty(n)){if(o=t[n],s&&o[r]){delete o[r],u=r;break}if(c)for(i in o)o.hasOwnProperty(i)&&o[i]===r&&(delete o[i],u=!0)}return u}e.clearSubscriptions(r)}}(o),"function"==typeof i&&i.amd?i((function(){return o})):(void 0!==e&&e.exports&&(r=e.exports=o),r.PubSub=o,e.exports=r=o)}("object"==typeof window&&window||t)})),n=(r.PubSub,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)))}}});const o=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(f)},i=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:i(e,p(t,o,n),r,u(o,n))}}if(Array.isArray(t)){const n=[...t];return n[d(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:p(t,e[0],n)},a=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||h(t)){const o=e.shift();a(e,p(t,o,n),r,u(o,n))}else{t[d(t,e[0])]=r}},s=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=p(t,n,r);return{...t,[n]:s(e,o,u(n,r))}}if(Array.isArray(t))return t.filter((t,r)=>r!=e[0]);if("object"==typeof t&&null!==t){const{[e[0]]:r,...n}=t;return n}return p(t,e[0],r)}},c=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=p(t,n,r);c(e,o,u(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:p(t,e[0],r)},u=n((e,t)=>t+"/"+l(e)),l=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),f=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),d=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,p=(e,t,r="")=>{if(void 0===e)throw TypeError(`Value at '${r}' is undefined and does not have property '${t}'`);if(null===e)throw TypeError(`Value at '${r}' is null and does not have property '${t}'`);if(h(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[d(e,t)]},h=e=>null===e||"object"!=typeof e;var y={nil:"",append:u,get:(e,t)=>{const r=o(e),n=e=>r.reduce(([e,t],r)=>[p(e,r,t),u(r,t)],[e,""])[0];return void 0===t?n:n(t)},set:(e,t,r)=>{const a=o(e),s=n((e,t)=>i(a,e,t,""));return void 0===t?s:s(t,r)},assign:(e,t,r)=>{const i=o(e),s=n((e,t)=>a(i,e,t,""));return void 0===t?s:s(t,r)},unset:(e,t)=>{const r=o(e),n=e=>s(r,e,"");return void 0===t?n:n(t)},delete:(e,t)=>{const r=o(e),n=e=>c(r,e,"");return void 0===t?n:n(t)}};var v={isObject:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,splitUrl:e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),o=e.slice(r+1);return[decodeURI(n),decodeURI(o)]}};const{splitUrl:b}=v,m=Object.freeze({id:"",pointer:"",instance:void 0}),w=(e,t=m)=>Object.freeze({...t,pointer:b(e)[1]}),g=e=>y.get(e.pointer,e.instance),O=(e,t)=>{const r=y.append(e,t.pointer);return w("#"+encodeURI(r),t)},E=n((e,t)=>g(t).map((r,n)=>e(O(n,t),n))),$=n((e,t)=>g(t).map((e,r)=>O(r,t)).filter((t,r)=>e(t,r))),P=n((e,t,r)=>g(r).reduce((t,n,o)=>e(t,O(o,r),o),t)),j=n((e,t)=>Object.keys(g(t)).every((r,n)=>e(O(r,t),n))),x=n((e,t)=>Object.keys(g(t)).some((r,n)=>e(O(r,t),n)));var A={cons:(e,t="")=>Object.freeze({...m,id:t,instance:e}),get:w,uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:g,step:O,entries:e=>Object.keys(g(e)).map(t=>[t,O(t,e)]),map:E,filter:$,reduce:P,every:j,some:x},S=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,I=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,V=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,T=/\\([\u000b\u0020-\u00ff])/g,k=/([\\"])/g,R=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/; | ||
/*! | ||
@@ -6,3 +6,3 @@ * content-type | ||
* MIT Licensed | ||
*/function C(e){var t=String(e);if(V.test(t))return t;if(t.length>0&&!I.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(k,"\\$1")+'"'}function K(e){this.parameters=Object.create(null),this.type=e}var L={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!R.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,i=Object.keys(t).sort(),a=0;a<i.length;a++){if(o=i[a],!V.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+C(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(!R.test(n))throw new TypeError("invalid media type");var o=new K(n.toLowerCase());if(-1!==r){var i,a,s;for(S.lastIndex=r;a=S.exec(t);){if(a.index!==r)throw new TypeError("invalid parameter format");r+=a[0].length,i=a[1].toLowerCase(),'"'===(s=a[2])[0]&&(s=s.substr(1,s.length-2).replace(T,"$1")),o.parameters[i]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},U=function(e,t){if(e=e.trim(),(t=t.trim()).startsWith("about:"))return t;if(""===e)return _(t)?q(t):t;const r=function(e){const t={host:"",path:"",query:"",protocol:""};let r=e,n=e.indexOf("//");if(-1===n)throw new Error("Error, protocol is not specified");t.protocol=r.substring(0,n),n+=2;const o=e.indexOf("/",n),i=e.indexOf("?"),a=e.indexOf("#");-1!==a&&(r=r.substring(0,a));if(-1!==i){const e=r.substring(i);t.query=e,r=r.substring(0,i)}if(-1!==o){const e=r.substring(0,o);t.host=e,r=r.substring(o),t.path=r}else t.host=r;return t}(e);if(""===t){const{host:e,path:t,query:n}=r;return t||n?e+t+n:q(e)}const n=function(e){const t={href:e,hash:"",query:"",netPath:!1,absolutePath:!1,relativePath:!1};if(W.test(e))return t.netPath=!0,t;"/"===e[0]?t.absolutePath=!0: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(n.netPath)return n.href.startsWith("//")&&(n.href=r.protocol+n.href),_(n.href)?q(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+z(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let i,a=r.path,s=r.host;return 0===e.length?i=a:(a=a.substring(0,a.lastIndexOf("/")),i=z(a+"/"+e)),s+=""!==i||t||o?i+t+o:"/",s}};function q(e){return e+("/"===e[e.length-1]?"":"/")}function z(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 W=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");function _(e){const t=e.indexOf("//")+2,r=!e.includes("/",t),n=!e.includes("?",t),o=!e.includes("#",t);return r&&n&&o}var B=fetch;const{isObject:D,splitUrl:F}=v,Z=Symbol("$__jref"),J={},M={},N=(e,t)=>{const r=e in M?M[e]:e;if(r in J)return J[r][t]},G={},H={},Q=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=F(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=N(n,"idToken"),i=F(t)[0],a=te(i,e[o]||""),s=F(a)[0];if(!s)throw Error("Couldn't determine an identifier for the schema");i&&(H[i]=s);const c=!!e.$recursiveAnchor;let u;delete e.$recursiveAnchor,N(n,"vocabulary")&&D(e)&&"$vocabulary"in e?(M[s]=n,u=e.$vocabulary,delete e.$vocabulary):u=s===n?{[n]:!0}:{};const l={};G[s]={id:s,schemaVersion:n,schema:X(e,s,n,y.nil,l),anchors:l,recursiveAnchor:c,vocabulary:u,validated:!1}},X=(e,t,r,n,o)=>{if(D(e)){const i=N(r,"idToken"),a=N(r,"anchorToken");if("string"==typeof e[i]){const n=e[i],o=te(t,n),[s,c]=F(o);if(delete e[i],c&&(e[a]=a!==i?encodeURI(c):`#${encodeURI(c)}`),s!==t)return Q(e,te(t,s),r),{[Z]:n}}if("string"==typeof e[a]){const t=a!==i?e[a]:e[a].slice(1);o[t]=n,delete e[a]}return Object.entries(e).reduce((e,[i,a])=>(e[i]=X(a,t,r,y.append(i,n),o),e),{})}return Array.isArray(e)?e.map((e,i)=>X(e,t,r,y.append(i,n),o)):e},Y=Object.freeze({id:"http://",schemaVersion:void 0,pointer:"",schema:void 0,recursiveAnchor:!1}),ee=async(e,t=Y,r=!1)=>{const n=r&&t.recursiveAnchor?t.recursiveAnchor:oe(t),o=te(n,e),[i,a]=F(o);if(!(e=>e in G||e in H)(i)){const e=await B(i,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error(`Failed to retrieve schema with id: ${i}`);if(e.headers.has("content-type")){const t=L.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${i} is not a schema. Found a document with media type: ${t}`)}Q(await e.json(),i)}const s=(e=>G[H[e]]||G[e])(i),c=Object.freeze({id:s.id,schemaVersion:s.schemaVersion,vocabulary:s.vocabulary,pointer:a&&"/"!==a[0]?ne(s,a):a,schema:s.schema,recursiveAnchor:t.recursiveAnchor||!!s.recursiveAnchor&&i,validated:s.validated}),u=ie(c);return D(u)&&Z in u?ee(u[Z],c):N(c.schemaVersion,"jsonReference")&&D(u)&&"string"==typeof u.$ref?ee(u.$ref,c):N(c.schemaVersion,"keywordReference")&&"string"==typeof u&&c.pointer.endsWith("/$ref")?ee(u,c):N(c.schemaVersion,"keywordRecursiveReference")&&"string"==typeof u&&c.pointer.endsWith("/$recursiveRef")?ee(u,c,!0):c},te=(e,t)=>{const r=U(e,t);if("file"===re(r)&&"file"!==re(e))throw Error("Can't access file resource from network context");return r},re=e=>{const t=e.match(/^(.+):\/\//);return t?t[1]:""},ne=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},oe=e=>`${e.id}#${encodeURI(e.pointer)}`,ie=e=>y.get(e.pointer,e.schema),ae=(e,t)=>{const r=y.append(e,t.pointer);return ee(`#${encodeURI(r)}`,t)},se=n((e,t)=>ie(t).map(async(r,n)=>e(await ae(n,t),n)));var ce={setConfig:(e,t,r)=>{J[e]||(J[e]={}),J[e][t]=r},getConfig:N,add:Q,get:ee,markValidated:e=>{G[e].validated=!0},uri:oe,value:ie,has:(e,t)=>e in ie(t),step:ae,entries:e=>Object.keys(ie(e)).map(t=>[t,ae(t,e)]),map:se};const ue="FLAG",le="BASIC",fe="DETAILED",de="VERBOSE";let pe=fe,he=!0;const ye=(e,t)=>(n,o=ue)=>{if(![ue,le,fe,de].includes(o))throw Error(`The '${o}' error format is not supported`);let i=[];const a=r.subscribe("result",ve(o,i));return Pe(t,n,e),r.unsubscribe(a),i[0]},ve=(e,t)=>{const r=[];return(n,o)=>{const i={...o,errors:[]};for(;r.length>0&&be(r[r.length-1],i);){const t=r.pop();let n=[];if(e===le&&(n=t.errors,delete t.errors),i.errors.unshift(t,...n),me(i))break}(e===de||e!==ue&&!i.valid)&&r.push(i),t[0]=i}},be=(e,t)=>e.instanceLocation.startsWith(t.instanceLocation)&&(e.absoluteKeywordLocation.startsWith(t.absoluteKeywordLocation)||me(e)),me=e=>e.keyword.endsWith("#$ref")||e.keyword.endsWith("#$recursiveRef"),we={},ge=e=>we[e],Oe=e=>e in we,$e={},Ee={},je=async(e,t)=>{if(!Oe(`${e.schemaVersion}#validate`)){const t=await ce.get(e.schemaVersion);(ce.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)=>{we[e]={collectEvaluatedItems:(e,r,n)=>t.interpret(e,r,n)&&0,collectEvaluatedProperties:(e,r,n)=>t.interpret(e,r,n)&&[],...t}})(`${t.id}#${e}`,r)});else if(r)throw Error(`Missing required vocabulary: ${e}`)})}if(he&&!e.validated){if(ce.markValidated(e.id),!(e.schemaVersion in Ee)){const t=await ce.get(e.schemaVersion),r={},n=await je(t,r);Ee[t.id]=ye(r,n)}const t=A.cons(e.schema,e.id),r=Ee[e.schemaVersion](t,pe);if(!r.valid)throw r}return await ge(`${e.schemaVersion}#validate`).compile(e,t),ce.uri(e)},Pe=(e,t,r)=>{const[n]=r[e];return ge(n).interpret(e,t,r)};var xe={validate:async(e,t,r)=>{const n={},o=await je(e,n),i=(e,t=ue)=>ye(n,o)(A.cons(e),t);return void 0===t?i:i(t,r)},setMetaOutputFormat:e=>{pe=e},setShouldMetaValidate:e=>{he=e},FLAG:ue,BASIC:le,DETAILED:fe,VERBOSE:de,getKeyword:ge,hasKeyword:Oe,defineVocabulary:(e,t)=>{$e[e]=t},compileSchema:je,interpretSchema:Pe,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return ge(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return ge(o).collectEvaluatedItems(e,t,r,n)}};var Ae={compile:()=>{},interpret:()=>!0},Se=async e=>Object.entries(await e),Ie=n(async(e,t)=>(await t).map(e)),Ve=n(async(e,t,r)=>(await r).reduce(async(t,r)=>e(await t,r),t)),Te=n(async(e,t,r={})=>Ve(async(t,r)=>await e(r)?t.concat([r]):t,[],t,r)),ke=n(async(e,t)=>{const r=await Ie(e,t);return(await Promise.all(r)).some(e=>e)}),Re=n(async(e,t)=>{const r=await Ie(e,t);return(await Promise.all(r)).every(e=>e)}),Ce=n((e,t)=>e.reduce(async(e,t)=>t(await e),t)),Ke={entries:Se,map:Ie,filter:Te,reduce:Ve,some:ke,every:Re,pipeline:Ce,all:e=>Promise.all(e),allValues:e=>Ce([Se,Ve(async(e,[t,r])=>(e[t]=await r,e),{})],e)};var Le={compile:async(e,t)=>{const r=ce.uri(e);if(!(r in t)){t[r]=!1;const n=ce.value(e);t[r]=[`${e.schemaVersion}#validate`,ce.uri(e),"boolean"==typeof n?n:await Ke.pipeline([ce.entries,Ke.map(([t,r])=>[`${e.schemaVersion}#${t}`,r]),Ke.filter(([t])=>xe.hasKeyword(t)&&t!==`${e.schemaVersion}#validate`),Ke.map(async([r,n])=>{const o=await n,i=await xe.getKeyword(r).compile(o,t,e);return[r,ce.uri(o),i]}),Ke.all],e)]}},interpret:(e,t,n)=>{const[o,i,a]=n[e],s="boolean"==typeof a?a:a.every(([e,o,i])=>{const a=xe.getKeyword(e).interpret(i,t,n);return r.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:A.uri(t),valid:a}),a});return r.publishSync("result",{keyword:o,absoluteKeywordLocation:i,instanceLocation:A.uri(t),valid:s}),s},collectEvaluatedProperties:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedProperties")).reduce((e,[n,,o])=>{const i=e&&xe.getKeyword(n).collectEvaluatedProperties(o,t,r);return i&&e.concat(i)},[])},collectEvaluatedItems:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedItems")).reduce((e,[n,,o])=>{const i=!1!==e&&xe.getKeyword(n).collectEvaluatedItems(o,t,r);return!1!==i&&Math.max(e,i)},0)}},Ue={Core:xe,Schema:ce,Instance:A,Keywords:{metaData:Ae,validate:Le}},qe=Ue.Core,ze=Ue.Schema,We=Ue.Instance,_e=Ue.Keywords;return e.Core=qe,e.Instance=We,e.Keywords=_e,e.Schema=ze,e.default=Ue,e}({}); | ||
*/function C(e){var t=String(e);if(V.test(t))return t;if(t.length>0&&!I.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(k,"\\$1")+'"'}function K(e){this.parameters=Object.create(null),this.type=e}var L={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!R.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,i=Object.keys(t).sort(),a=0;a<i.length;a++){if(o=i[a],!V.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+C(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(!R.test(n))throw new TypeError("invalid media type");var o=new K(n.toLowerCase());if(-1!==r){var i,a,s;for(S.lastIndex=r;a=S.exec(t);){if(a.index!==r)throw new TypeError("invalid parameter format");r+=a[0].length,i=a[1].toLowerCase(),'"'===(s=a[2])[0]&&(s=s.substr(1,s.length-2).replace(T,"$1")),o.parameters[i]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},U=function(e,t){if(e=e.trim(),(t=t.trim()).startsWith("about:"))return t;const r=function(e){const t={host:"",path:"",query:"",protocol:""};let r=e,n=e.indexOf("//");t.protocol=r.substring(0,n),n+=2;const o=e.indexOf("/",n),i=e.indexOf("?"),a=e.indexOf("#");-1!==a&&(r=r.substring(0,a));if(-1!==i){const e=r.substring(i);t.query=e,r=r.substring(0,i)}if(-1!==o){const e=r.substring(0,o);t.host=e,r=r.substring(o),t.path=r}else t.host=r;return t}(e),n=function(e){const t={href:e,hash:"",query:"",netPath:!1,absolutePath:!1,relativePath:!1};if(W.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)?q(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+z(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let i,a=r.path,s=r.host;return 0===e.length?i=a:(a=a.substring(0,a.lastIndexOf("/")),i=z(a+"/"+e)),s+=""!==i||t||o?i+t+o:"/",s}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:q(e)}};function q(e){return e+("/"===e[e.length-1]?"":"/")}function z(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 W=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");var _=fetch;const{isObject:B,splitUrl:D}=v,F=Symbol("$__jref"),Z={},J={},M=(e,t)=>{const r=e in J?J[e]:e;if(r in Z)return Z[r][t]},N={},G={},H=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=D(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=M(n,"idToken"),i=D(t)[0],a=ee(i,e[o]||""),s=D(a)[0];if(!s)throw Error("Couldn't determine an identifier for the schema");i&&(G[i]=s);const c=!!e.$recursiveAnchor;let u;delete e.$recursiveAnchor,M(n,"vocabulary")&&B(e)&&"$vocabulary"in e?(J[s]=n,u=e.$vocabulary,delete e.$vocabulary):u=s===n?{[n]:!0}:{};const l={};N[s]={id:s,schemaVersion:n,schema:Q(e,s,n,y.nil,l),anchors:l,recursiveAnchor:c,vocabulary:u,validated:!1}},Q=(e,t,r,n,o)=>{if(B(e)){const i=M(r,"idToken"),a=M(r,"anchorToken");if("string"==typeof e[i]){const n=e[i],o=ee(t,n),[s,c]=D(o);if(delete e[i],c&&(e[a]=a!==i?encodeURI(c):"#"+encodeURI(c)),s!==t)return H(e,ee(t,s),r),{[F]:n}}if("string"==typeof e[a]){const t=a!==i?e[a]:e[a].slice(1);o[t]=n,delete e[a]}return Object.entries(e).reduce((e,[i,a])=>(e[i]=Q(a,t,r,y.append(i,n),o),e),{})}return Array.isArray(e)?e.map((e,i)=>Q(e,t,r,y.append(i,n),o)):e},X=Object.freeze({id:"",schemaVersion:void 0,pointer:"",schema:void 0,recursiveAnchor:!1}),Y=async(e,t=X,r=!1)=>{const n=r&&t.recursiveAnchor?t.recursiveAnchor:ne(t),o=ee(n,e),[i,a]=D(o);if(!(e=>e in N||e in G)(i)){const e=await _(i,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error("Failed to retrieve schema with id: "+i);if(e.headers.has("content-type")){const t=L.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${i} is not a schema. Found a document with media type: ${t}`)}H(await e.json(),i)}const s=(e=>N[G[e]]||N[e])(i),c=Object.freeze({id:s.id,schemaVersion:s.schemaVersion,vocabulary:s.vocabulary,pointer:a&&"/"!==a[0]?re(s,a):a,schema:s.schema,recursiveAnchor:t.recursiveAnchor||!!s.recursiveAnchor&&i,validated:s.validated}),u=oe(c);return B(u)&&F in u?Y(u[F],c):M(c.schemaVersion,"jsonReference")&&B(u)&&"string"==typeof u.$ref?Y(u.$ref,c):M(c.schemaVersion,"keywordReference")&&"string"==typeof u&&c.pointer.endsWith("/$ref")?Y(u,c):M(c.schemaVersion,"keywordRecursiveReference")&&"string"==typeof u&&c.pointer.endsWith("/$recursiveRef")?Y(u,c,!0):c},ee=(e,t)=>{const r=U(e,t),n=D(e)[0];if(n&&"file"===te(r)&&"file"!==te(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},te=e=>{const t=e.match(/^(.+):\/\//);return t?t[1]:""},re=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},ne=e=>`${e.id}#${encodeURI(e.pointer)}`,oe=e=>y.get(e.pointer,e.schema),ie=(e,t)=>{const r=y.append(e,t.pointer);return Y("#"+encodeURI(r),t)},ae=n((e,t)=>oe(t).map(async(r,n)=>e(await ie(n,t),n)));var se={setConfig:(e,t,r)=>{Z[e]||(Z[e]={}),Z[e][t]=r},getConfig:M,add:H,get:Y,markValidated:e=>{N[e].validated=!0},uri:ne,value:oe,has:(e,t)=>e in oe(t),step:ie,entries:e=>Object.keys(oe(e)).map(t=>[t,ie(t,e)]),map:ae};const ce="FLAG",ue="BASIC",le="DETAILED",fe="VERBOSE";let de=le,pe=!0;const he=(e,t)=>(n,o=ce)=>{if(![ce,ue,le,fe].includes(o))throw Error(`The '${o}' error format is not supported`);let i=[];const a=r.subscribe("result",ye(o,i));return Pe(t,n,e),r.unsubscribe(a),i[0]},ye=(e,t)=>{const r=[];return(n,o)=>{const i={...o,errors:[]};for(;r.length>0&&ve(r[r.length-1],i);){const t=r.pop();let n=[];if(e===ue&&(n=t.errors,delete t.errors),i.errors.unshift(t,...n),be(i))break}(e===fe||e!==ce&&!i.valid)&&r.push(i),t[0]=i}},ve=(e,t)=>e.instanceLocation.startsWith(t.instanceLocation)&&(e.absoluteKeywordLocation.startsWith(t.absoluteKeywordLocation)||be(e)),be=e=>e.keyword.endsWith("#$ref")||e.keyword.endsWith("#$recursiveRef"),me={},we=e=>me[e],ge=e=>e in me,Oe={},Ee={},$e=async(e,t)=>{if(!ge(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 Oe)Object.entries(Oe[e]).forEach(([e,r])=>{((e,t)=>{me[e]={collectEvaluatedItems:(e,r,n)=>t.interpret(e,r,n)&&0,collectEvaluatedProperties:(e,r,n)=>t.interpret(e,r,n)&&[],...t}})(`${t.id}#${e}`,r)});else if(r)throw Error("Missing required vocabulary: "+e)})}if(pe&&!e.validated){if(se.markValidated(e.id),!(e.schemaVersion in Ee)){const t=await se.get(e.schemaVersion),r={},n=await $e(t,r);Ee[t.id]=he(r,n)}const t=A.cons(e.schema,e.id),r=Ee[e.schemaVersion](t,de);if(!r.valid)throw r}return await we(e.schemaVersion+"#validate").compile(e,t),se.uri(e)},Pe=(e,t,r)=>{const[n]=r[e];return we(n).interpret(e,t,r)};var je={validate:async(e,t,r)=>{const n={},o=await $e(e,n),i=(e,t=ce)=>he(n,o)(A.cons(e),t);return void 0===t?i:i(t,r)},setMetaOutputFormat:e=>{de=e},setShouldMetaValidate:e=>{pe=e},FLAG:ce,BASIC:ue,DETAILED:le,VERBOSE:fe,getKeyword:we,hasKeyword:ge,defineVocabulary:(e,t)=>{Oe[e]=t},compileSchema:$e,interpretSchema:Pe,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return we(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return we(o).collectEvaluatedItems(e,t,r,n)}};var xe={compile:()=>{},interpret:()=>!0},Ae=async e=>Object.entries(await e),Se=n(async(e,t)=>(await t).map(e)),Ie=n(async(e,t,r)=>(await r).reduce(async(t,r)=>e(await t,r),t)),Ve=n(async(e,t,r={})=>Ie(async(t,r)=>await e(r)?t.concat([r]):t,[],t,r)),Te=n(async(e,t)=>{const r=await Se(e,t);return(await Promise.all(r)).some(e=>e)}),ke=n(async(e,t)=>{const r=await Se(e,t);return(await Promise.all(r)).every(e=>e)}),Re=n((e,t)=>e.reduce(async(e,t)=>t(await e),t)),Ce={entries:Ae,map:Se,filter:Ve,reduce:Ie,some:Te,every:ke,pipeline:Re,all:e=>Promise.all(e),allValues:e=>Re([Ae,Ie(async(e,[t,r])=>(e[t]=await r,e),{})],e)};var Ke={compile:async(e,t)=>{const r=se.uri(e);if(!(r in t)){t[r]=!1;const n=se.value(e);t[r]=[e.schemaVersion+"#validate",se.uri(e),"boolean"==typeof n?n:await Ce.pipeline([se.entries,Ce.map(([t,r])=>[`${e.schemaVersion}#${t}`,r]),Ce.filter(([t])=>je.hasKeyword(t)&&t!==e.schemaVersion+"#validate"),Ce.map(async([r,n])=>{const o=await n,i=await je.getKeyword(r).compile(o,t,e);return[r,se.uri(o),i]}),Ce.all],e)]}},interpret:(e,t,n)=>{const[o,i,a]=n[e],s="boolean"==typeof a?a:a.every(([e,o,i])=>{const a=je.getKeyword(e).interpret(i,t,n);return r.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:A.uri(t),valid:a}),a});return r.publishSync("result",{keyword:o,absoluteKeywordLocation:i,instanceLocation:A.uri(t),valid:s}),s},collectEvaluatedProperties:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedProperties")).reduce((e,[n,,o])=>{const i=e&&je.getKeyword(n).collectEvaluatedProperties(o,t,r);return i&&e.concat(i)},[])},collectEvaluatedItems:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedItems")).reduce((e,[n,,o])=>{const i=!1!==e&&je.getKeyword(n).collectEvaluatedItems(o,t,r);return!1!==i&&Math.max(e,i)},0)}},Le={Core:je,Schema:se,Instance:A,Keywords:{metaData:xe,validate:Ke}},Ue=Le.Core,qe=Le.Schema,ze=Le.Instance,We=Le.Keywords;return e.Core=Ue,e.Instance=ze,e.Keywords=We,e.Schema=qe,e.default=Le,e}({}); | ||
//# sourceMappingURL=json-schema-core-iife.min.js.map |
@@ -844,6 +844,2 @@ System.register('JSC', [], function (exports) { | ||
if (protocolEndIndex === -1) { | ||
throw new Error('Error, protocol is not specified'); | ||
} | ||
resultObject.protocol = path.substring(0, protocolEndIndex); | ||
@@ -907,3 +903,3 @@ | ||
// return resultObject | ||
} else { | ||
} else if (relative !== '') { | ||
resultObject.relativePath = true; | ||
@@ -958,23 +954,9 @@ } | ||
// if base is empty, assume relative is a net path. | ||
if (base === '') { | ||
if (_shouldAddSlash(relative)) { | ||
return _addSlash(relative); | ||
} | ||
// add / at end if not present if is only the host | ||
return relative; | ||
} | ||
const baseObj = _baseParse(base); | ||
// relative is empty, return base minus hash | ||
if (relative === '') { | ||
const {host, path, query} = baseObj; | ||
// when path and query aren't supplied add slash | ||
if ((!path) && (!query)) { | ||
return _addSlash(host); | ||
} | ||
return host + path + query; | ||
const relativeObj = _relativeParse(relative); | ||
if (!baseObj.protocol && !relativeObj.netPath) { | ||
throw new Error('Error, protocol is not specified'); | ||
} | ||
const relativeObj = _relativeParse(relative); | ||
if (relativeObj.netPath) { // relative is full qualified URL | ||
@@ -1018,2 +1000,9 @@ if (_shouldAddProtocol(relativeObj.href)) { | ||
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; | ||
} | ||
@@ -1150,3 +1139,3 @@ } | ||
// Schema Retrieval | ||
const nil$2 = Object.freeze({ id: "http://", schemaVersion: undefined, pointer: "", schema: undefined, recursiveAnchor: false }); | ||
const nil$2 = Object.freeze({ id: "", schemaVersion: undefined, pointer: "", schema: undefined, recursiveAnchor: false }); | ||
@@ -1203,4 +1192,5 @@ const get$2 = async (url, contextDoc = nil$2, recursive = false) => { | ||
const resolvedUrl = urlResolveBrowser(contextUrl, url); | ||
if (getScheme(resolvedUrl) === "file" && getScheme(contextUrl) !== "file") { | ||
throw Error("Can't access file resource from network context"); | ||
const contextId = splitUrl$2(contextUrl)[0]; | ||
if (contextId && getScheme(resolvedUrl) === "file" && getScheme(contextId) !== "file") { | ||
throw Error(`Can't access file '${resolvedUrl}' resource from network context '${contextUrl}'`); | ||
} | ||
@@ -1207,0 +1197,0 @@ return resolvedUrl; |
@@ -1,2 +0,2 @@ | ||
System.register("JSC",[],(function(e){"use strict";return{execute:function(){var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var r=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e,r){!function(t,n){var o={};t.PubSub=o;var i=t.define;!function(e){var t={},r=-1;function n(e){var t;for(t in e)if(e.hasOwnProperty(t))return!0;return!1}function o(e,t,r){try{e(t,r)}catch(e){setTimeout(function(e){return function(){throw e}}(e),0)}}function i(e,t,r){e(t,r)}function a(e,r,n,a){var s,c=t[r],u=a?i:o;if(t.hasOwnProperty(r))for(s in c)c.hasOwnProperty(s)&&u(c[s],e,n)}function s(e,r,o,i){var s=function(e,t,r){return function(){var n=String(e),o=n.lastIndexOf(".");for(a(e,e,t,r);-1!==o;)o=(n=n.substr(0,o)).lastIndexOf("."),a(e,n,t,r)}}(e="symbol"==typeof e?e.toString():e,r,i);return!!function(e){for(var r=String(e),o=Boolean(t.hasOwnProperty(r)&&n(t[r])),i=r.lastIndexOf(".");!o&&-1!==i;)i=(r=r.substr(0,i)).lastIndexOf("."),o=Boolean(t.hasOwnProperty(r)&&n(t[r]));return o}(e)&&(!0===o?s():setTimeout(s,0),!0)}e.publish=function(t,r){return s(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return s(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,t.hasOwnProperty(e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n=0;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n++;return n},e.getSubscriptions=function(e){var r,n=[];for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,i,a="string"==typeof r&&(t.hasOwnProperty(r)||function(e){var r;for(r in t)if(t.hasOwnProperty(r)&&0===r.indexOf(e))return!0;return!1}(r)),s=!a&&"string"==typeof r,c="function"==typeof r,u=!1;if(!a){for(n in t)if(t.hasOwnProperty(n)){if(o=t[n],s&&o[r]){delete o[r],u=r;break}if(c)for(i in o)o.hasOwnProperty(i)&&o[i]===r&&(delete o[i],u=!0)}return u}e.clearSubscriptions(r)}}(o),"function"==typeof i&&i.amd?i((function(){return o})):(void 0!==e&&e.exports&&(r=e.exports=o),r.PubSub=o,e.exports=r=o)}("object"==typeof window&&window||t)})),n=(r.PubSub,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)))}}});const o=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(f)},i=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:i(e,p(t,o,n),r,u(o,n))}}if(Array.isArray(t)){const n=[...t];return n[d(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:p(t,e[0],n)},a=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||h(t)){const o=e.shift();a(e,p(t,o,n),r,u(o,n))}else{t[d(t,e[0])]=r}},s=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=p(t,n,r);return{...t,[n]:s(e,o,u(n,r))}}if(Array.isArray(t))return t.filter((t,r)=>r!=e[0]);if("object"==typeof t&&null!==t){const{[e[0]]:r,...n}=t;return n}return p(t,e[0],r)}},c=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=p(t,n,r);c(e,o,u(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:p(t,e[0],r)},u=n((e,t)=>t+"/"+l(e)),l=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),f=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),d=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,p=(e,t,r="")=>{if(void 0===e)throw TypeError(`Value at '${r}' is undefined and does not have property '${t}'`);if(null===e)throw TypeError(`Value at '${r}' is null and does not have property '${t}'`);if(h(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[d(e,t)]},h=e=>null===e||"object"!=typeof e;var y={nil:"",append:u,get:(e,t)=>{const r=o(e),n=e=>r.reduce(([e,t],r)=>[p(e,r,t),u(r,t)],[e,""])[0];return void 0===t?n:n(t)},set:(e,t,r)=>{const a=o(e),s=n((e,t)=>i(a,e,t,""));return void 0===t?s:s(t,r)},assign:(e,t,r)=>{const i=o(e),s=n((e,t)=>a(i,e,t,""));return void 0===t?s:s(t,r)},unset:(e,t)=>{const r=o(e),n=e=>s(r,e,"");return void 0===t?n:n(t)},delete:(e,t)=>{const r=o(e),n=e=>c(r,e,"");return void 0===t?n:n(t)}};var v={isObject:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,splitUrl:e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),o=e.slice(r+1);return[decodeURI(n),decodeURI(o)]}};const{splitUrl:b}=v,m=Object.freeze({id:"",pointer:"",instance:void 0}),w=(e,t=m)=>Object.freeze({...t,pointer:b(e)[1]}),g=e=>y.get(e.pointer,e.instance),O=(e,t)=>{const r=y.append(e,t.pointer);return w(`#${encodeURI(r)}`,t)},$=n((e,t)=>g(t).map((r,n)=>e(O(n,t),n))),E=n((e,t)=>g(t).map((e,r)=>O(r,t)).filter((t,r)=>e(t,r))),j=n((e,t,r)=>g(r).reduce((t,n,o)=>e(t,O(o,r),o),t)),x=n((e,t)=>Object.keys(g(t)).every((r,n)=>e(O(r,t),n))),P=n((e,t)=>Object.keys(g(t)).some((r,n)=>e(O(r,t),n)));var S={cons:(e,t="")=>Object.freeze({...m,id:t,instance:e}),get:w,uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:g,step:O,entries:e=>Object.keys(g(e)).map(t=>[t,O(t,e)]),map:$,filter:E,reduce:j,every:x,some:P},A=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,I=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,V=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,T=/\\([\u000b\u0020-\u00ff])/g,k=/([\\"])/g,R=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/; | ||
System.register("JSC",[],(function(e){"use strict";return{execute:function(){var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var r=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e,r){!function(t,n){var o={};t.PubSub=o;var i=t.define;!function(e){var t={},r=-1;function n(e){var t;for(t in e)if(e.hasOwnProperty(t))return!0;return!1}function o(e,t,r){try{e(t,r)}catch(e){setTimeout(function(e){return function(){throw e}}(e),0)}}function i(e,t,r){e(t,r)}function a(e,r,n,a){var s,c=t[r],u=a?i:o;if(t.hasOwnProperty(r))for(s in c)c.hasOwnProperty(s)&&u(c[s],e,n)}function s(e,r,o,i){var s=function(e,t,r){return function(){var n=String(e),o=n.lastIndexOf(".");for(a(e,e,t,r);-1!==o;)o=(n=n.substr(0,o)).lastIndexOf("."),a(e,n,t,r)}}(e="symbol"==typeof e?e.toString():e,r,i);return!!function(e){for(var r=String(e),o=Boolean(t.hasOwnProperty(r)&&n(t[r])),i=r.lastIndexOf(".");!o&&-1!==i;)i=(r=r.substr(0,i)).lastIndexOf("."),o=Boolean(t.hasOwnProperty(r)&&n(t[r]));return o}(e)&&(!0===o?s():setTimeout(s,0),!0)}e.publish=function(t,r){return s(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return s(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,t.hasOwnProperty(e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n=0;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n++;return n},e.getSubscriptions=function(e){var r,n=[];for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,i,a="string"==typeof r&&(t.hasOwnProperty(r)||function(e){var r;for(r in t)if(t.hasOwnProperty(r)&&0===r.indexOf(e))return!0;return!1}(r)),s=!a&&"string"==typeof r,c="function"==typeof r,u=!1;if(!a){for(n in t)if(t.hasOwnProperty(n)){if(o=t[n],s&&o[r]){delete o[r],u=r;break}if(c)for(i in o)o.hasOwnProperty(i)&&o[i]===r&&(delete o[i],u=!0)}return u}e.clearSubscriptions(r)}}(o),"function"==typeof i&&i.amd?i((function(){return o})):(void 0!==e&&e.exports&&(r=e.exports=o),r.PubSub=o,e.exports=r=o)}("object"==typeof window&&window||t)})),n=(r.PubSub,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)))}}});const o=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(f)},i=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:i(e,p(t,o,n),r,u(o,n))}}if(Array.isArray(t)){const n=[...t];return n[d(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:p(t,e[0],n)},a=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||h(t)){const o=e.shift();a(e,p(t,o,n),r,u(o,n))}else{t[d(t,e[0])]=r}},s=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=p(t,n,r);return{...t,[n]:s(e,o,u(n,r))}}if(Array.isArray(t))return t.filter((t,r)=>r!=e[0]);if("object"==typeof t&&null!==t){const{[e[0]]:r,...n}=t;return n}return p(t,e[0],r)}},c=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=p(t,n,r);c(e,o,u(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:p(t,e[0],r)},u=n((e,t)=>t+"/"+l(e)),l=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),f=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),d=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,p=(e,t,r="")=>{if(void 0===e)throw TypeError(`Value at '${r}' is undefined and does not have property '${t}'`);if(null===e)throw TypeError(`Value at '${r}' is null and does not have property '${t}'`);if(h(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[d(e,t)]},h=e=>null===e||"object"!=typeof e;var y={nil:"",append:u,get:(e,t)=>{const r=o(e),n=e=>r.reduce(([e,t],r)=>[p(e,r,t),u(r,t)],[e,""])[0];return void 0===t?n:n(t)},set:(e,t,r)=>{const a=o(e),s=n((e,t)=>i(a,e,t,""));return void 0===t?s:s(t,r)},assign:(e,t,r)=>{const i=o(e),s=n((e,t)=>a(i,e,t,""));return void 0===t?s:s(t,r)},unset:(e,t)=>{const r=o(e),n=e=>s(r,e,"");return void 0===t?n:n(t)},delete:(e,t)=>{const r=o(e),n=e=>c(r,e,"");return void 0===t?n:n(t)}};var v={isObject:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,splitUrl:e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),o=e.slice(r+1);return[decodeURI(n),decodeURI(o)]}};const{splitUrl:b}=v,m=Object.freeze({id:"",pointer:"",instance:void 0}),w=(e,t=m)=>Object.freeze({...t,pointer:b(e)[1]}),g=e=>y.get(e.pointer,e.instance),O=(e,t)=>{const r=y.append(e,t.pointer);return w("#"+encodeURI(r),t)},E=n((e,t)=>g(t).map((r,n)=>e(O(n,t),n))),$=n((e,t)=>g(t).map((e,r)=>O(r,t)).filter((t,r)=>e(t,r))),P=n((e,t,r)=>g(r).reduce((t,n,o)=>e(t,O(o,r),o),t)),j=n((e,t)=>Object.keys(g(t)).every((r,n)=>e(O(r,t),n))),x=n((e,t)=>Object.keys(g(t)).some((r,n)=>e(O(r,t),n)));var S={cons:(e,t="")=>Object.freeze({...m,id:t,instance:e}),get:w,uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:g,step:O,entries:e=>Object.keys(g(e)).map(t=>[t,O(t,e)]),map:E,filter:$,reduce:P,every:j,some:x},A=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,I=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,V=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,T=/\\([\u000b\u0020-\u00ff])/g,k=/([\\"])/g,R=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/; | ||
/*! | ||
@@ -6,3 +6,3 @@ * content-type | ||
* MIT Licensed | ||
*/function C(e){var t=String(e);if(V.test(t))return t;if(t.length>0&&!I.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(k,"\\$1")+'"'}function K(e){this.parameters=Object.create(null),this.type=e}var L={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!R.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,i=Object.keys(t).sort(),a=0;a<i.length;a++){if(o=i[a],!V.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+C(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(!R.test(n))throw new TypeError("invalid media type");var o=new K(n.toLowerCase());if(-1!==r){var i,a,s;for(A.lastIndex=r;a=A.exec(t);){if(a.index!==r)throw new TypeError("invalid parameter format");r+=a[0].length,i=a[1].toLowerCase(),'"'===(s=a[2])[0]&&(s=s.substr(1,s.length-2).replace(T,"$1")),o.parameters[i]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},U=function(e,t){if(e=e.trim(),(t=t.trim()).startsWith("about:"))return t;if(""===e)return _(t)?q(t):t;const r=function(e){const t={host:"",path:"",query:"",protocol:""};let r=e,n=e.indexOf("//");if(-1===n)throw new Error("Error, protocol is not specified");t.protocol=r.substring(0,n),n+=2;const o=e.indexOf("/",n),i=e.indexOf("?"),a=e.indexOf("#");-1!==a&&(r=r.substring(0,a));if(-1!==i){const e=r.substring(i);t.query=e,r=r.substring(0,i)}if(-1!==o){const e=r.substring(0,o);t.host=e,r=r.substring(o),t.path=r}else t.host=r;return t}(e);if(""===t){const{host:e,path:t,query:n}=r;return t||n?e+t+n:q(e)}const n=function(e){const t={href:e,hash:"",query:"",netPath:!1,absolutePath:!1,relativePath:!1};if(W.test(e))return t.netPath=!0,t;"/"===e[0]?t.absolutePath=!0: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(n.netPath)return n.href.startsWith("//")&&(n.href=r.protocol+n.href),_(n.href)?q(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+z(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let i,a=r.path,s=r.host;return 0===e.length?i=a:(a=a.substring(0,a.lastIndexOf("/")),i=z(a+"/"+e)),s+=""!==i||t||o?i+t+o:"/",s}};function q(e){return e+("/"===e[e.length-1]?"":"/")}function z(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 W=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");function _(e){const t=e.indexOf("//")+2,r=!e.includes("/",t),n=!e.includes("?",t),o=!e.includes("#",t);return r&&n&&o}var B=fetch;const{isObject:D,splitUrl:F}=v,Z=Symbol("$__jref"),J={},M={},N=(e,t)=>{const r=e in M?M[e]:e;if(r in J)return J[r][t]},G={},H={},Q=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=F(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=N(n,"idToken"),i=F(t)[0],a=te(i,e[o]||""),s=F(a)[0];if(!s)throw Error("Couldn't determine an identifier for the schema");i&&(H[i]=s);const c=!!e.$recursiveAnchor;let u;delete e.$recursiveAnchor,N(n,"vocabulary")&&D(e)&&"$vocabulary"in e?(M[s]=n,u=e.$vocabulary,delete e.$vocabulary):u=s===n?{[n]:!0}:{};const l={};G[s]={id:s,schemaVersion:n,schema:X(e,s,n,y.nil,l),anchors:l,recursiveAnchor:c,vocabulary:u,validated:!1}},X=(e,t,r,n,o)=>{if(D(e)){const i=N(r,"idToken"),a=N(r,"anchorToken");if("string"==typeof e[i]){const n=e[i],o=te(t,n),[s,c]=F(o);if(delete e[i],c&&(e[a]=a!==i?encodeURI(c):`#${encodeURI(c)}`),s!==t)return Q(e,te(t,s),r),{[Z]:n}}if("string"==typeof e[a]){const t=a!==i?e[a]:e[a].slice(1);o[t]=n,delete e[a]}return Object.entries(e).reduce((e,[i,a])=>(e[i]=X(a,t,r,y.append(i,n),o),e),{})}return Array.isArray(e)?e.map((e,i)=>X(e,t,r,y.append(i,n),o)):e},Y=Object.freeze({id:"http://",schemaVersion:void 0,pointer:"",schema:void 0,recursiveAnchor:!1}),ee=async(e,t=Y,r=!1)=>{const n=r&&t.recursiveAnchor?t.recursiveAnchor:oe(t),o=te(n,e),[i,a]=F(o);if(!(e=>e in G||e in H)(i)){const e=await B(i,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error(`Failed to retrieve schema with id: ${i}`);if(e.headers.has("content-type")){const t=L.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${i} is not a schema. Found a document with media type: ${t}`)}Q(await e.json(),i)}const s=(e=>G[H[e]]||G[e])(i),c=Object.freeze({id:s.id,schemaVersion:s.schemaVersion,vocabulary:s.vocabulary,pointer:a&&"/"!==a[0]?ne(s,a):a,schema:s.schema,recursiveAnchor:t.recursiveAnchor||!!s.recursiveAnchor&&i,validated:s.validated}),u=ie(c);return D(u)&&Z in u?ee(u[Z],c):N(c.schemaVersion,"jsonReference")&&D(u)&&"string"==typeof u.$ref?ee(u.$ref,c):N(c.schemaVersion,"keywordReference")&&"string"==typeof u&&c.pointer.endsWith("/$ref")?ee(u,c):N(c.schemaVersion,"keywordRecursiveReference")&&"string"==typeof u&&c.pointer.endsWith("/$recursiveRef")?ee(u,c,!0):c},te=(e,t)=>{const r=U(e,t);if("file"===re(r)&&"file"!==re(e))throw Error("Can't access file resource from network context");return r},re=e=>{const t=e.match(/^(.+):\/\//);return t?t[1]:""},ne=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},oe=e=>`${e.id}#${encodeURI(e.pointer)}`,ie=e=>y.get(e.pointer,e.schema),ae=(e,t)=>{const r=y.append(e,t.pointer);return ee(`#${encodeURI(r)}`,t)},se=n((e,t)=>ie(t).map(async(r,n)=>e(await ae(n,t),n)));var ce={setConfig:(e,t,r)=>{J[e]||(J[e]={}),J[e][t]=r},getConfig:N,add:Q,get:ee,markValidated:e=>{G[e].validated=!0},uri:oe,value:ie,has:(e,t)=>e in ie(t),step:ae,entries:e=>Object.keys(ie(e)).map(t=>[t,ae(t,e)]),map:se};const ue="FLAG",le="BASIC",fe="DETAILED",de="VERBOSE";let pe=fe,he=!0;const ye=(e,t)=>(n,o=ue)=>{if(![ue,le,fe,de].includes(o))throw Error(`The '${o}' error format is not supported`);let i=[];const a=r.subscribe("result",ve(o,i));return xe(t,n,e),r.unsubscribe(a),i[0]},ve=(e,t)=>{const r=[];return(n,o)=>{const i={...o,errors:[]};for(;r.length>0&&be(r[r.length-1],i);){const t=r.pop();let n=[];if(e===le&&(n=t.errors,delete t.errors),i.errors.unshift(t,...n),me(i))break}(e===de||e!==ue&&!i.valid)&&r.push(i),t[0]=i}},be=(e,t)=>e.instanceLocation.startsWith(t.instanceLocation)&&(e.absoluteKeywordLocation.startsWith(t.absoluteKeywordLocation)||me(e)),me=e=>e.keyword.endsWith("#$ref")||e.keyword.endsWith("#$recursiveRef"),we={},ge=e=>we[e],Oe=e=>e in we,$e={},Ee={},je=async(e,t)=>{if(!Oe(`${e.schemaVersion}#validate`)){const t=await ce.get(e.schemaVersion);(ce.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)=>{we[e]={collectEvaluatedItems:(e,r,n)=>t.interpret(e,r,n)&&0,collectEvaluatedProperties:(e,r,n)=>t.interpret(e,r,n)&&[],...t}})(`${t.id}#${e}`,r)});else if(r)throw Error(`Missing required vocabulary: ${e}`)})}if(he&&!e.validated){if(ce.markValidated(e.id),!(e.schemaVersion in Ee)){const t=await ce.get(e.schemaVersion),r={},n=await je(t,r);Ee[t.id]=ye(r,n)}const t=S.cons(e.schema,e.id),r=Ee[e.schemaVersion](t,pe);if(!r.valid)throw r}return await ge(`${e.schemaVersion}#validate`).compile(e,t),ce.uri(e)},xe=(e,t,r)=>{const[n]=r[e];return ge(n).interpret(e,t,r)};var Pe={validate:async(e,t,r)=>{const n={},o=await je(e,n),i=(e,t=ue)=>ye(n,o)(S.cons(e),t);return void 0===t?i:i(t,r)},setMetaOutputFormat:e=>{pe=e},setShouldMetaValidate:e=>{he=e},FLAG:ue,BASIC:le,DETAILED:fe,VERBOSE:de,getKeyword:ge,hasKeyword:Oe,defineVocabulary:(e,t)=>{$e[e]=t},compileSchema:je,interpretSchema:xe,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return ge(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return ge(o).collectEvaluatedItems(e,t,r,n)}};var Se={compile:()=>{},interpret:()=>!0},Ae=async e=>Object.entries(await e),Ie=n(async(e,t)=>(await t).map(e)),Ve=n(async(e,t,r)=>(await r).reduce(async(t,r)=>e(await t,r),t)),Te=n(async(e,t,r={})=>Ve(async(t,r)=>await e(r)?t.concat([r]):t,[],t,r)),ke=n(async(e,t)=>{const r=await Ie(e,t);return(await Promise.all(r)).some(e=>e)}),Re=n(async(e,t)=>{const r=await Ie(e,t);return(await Promise.all(r)).every(e=>e)}),Ce=n((e,t)=>e.reduce(async(e,t)=>t(await e),t)),Ke={entries:Ae,map:Ie,filter:Te,reduce:Ve,some:ke,every:Re,pipeline:Ce,all:e=>Promise.all(e),allValues:e=>Ce([Ae,Ve(async(e,[t,r])=>(e[t]=await r,e),{})],e)};var Le={compile:async(e,t)=>{const r=ce.uri(e);if(!(r in t)){t[r]=!1;const n=ce.value(e);t[r]=[`${e.schemaVersion}#validate`,ce.uri(e),"boolean"==typeof n?n:await Ke.pipeline([ce.entries,Ke.map(([t,r])=>[`${e.schemaVersion}#${t}`,r]),Ke.filter(([t])=>Pe.hasKeyword(t)&&t!==`${e.schemaVersion}#validate`),Ke.map(async([r,n])=>{const o=await n,i=await Pe.getKeyword(r).compile(o,t,e);return[r,ce.uri(o),i]}),Ke.all],e)]}},interpret:(e,t,n)=>{const[o,i,a]=n[e],s="boolean"==typeof a?a:a.every(([e,o,i])=>{const a=Pe.getKeyword(e).interpret(i,t,n);return r.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:S.uri(t),valid:a}),a});return r.publishSync("result",{keyword:o,absoluteKeywordLocation:i,instanceLocation:S.uri(t),valid:s}),s},collectEvaluatedProperties:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedProperties")).reduce((e,[n,,o])=>{const i=e&&Pe.getKeyword(n).collectEvaluatedProperties(o,t,r);return i&&e.concat(i)},[])},collectEvaluatedItems:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedItems")).reduce((e,[n,,o])=>{const i=!1!==e&&Pe.getKeyword(n).collectEvaluatedItems(o,t,r);return!1!==i&&Math.max(e,i)},0)}},Ue={Core:Pe,Schema:ce,Instance:S,Keywords:{metaData:Se,validate:Le}};e("default",Ue);e("Core",Ue.Core),e("Schema",Ue.Schema),e("Instance",Ue.Instance),e("Keywords",Ue.Keywords)}}})); | ||
*/function C(e){var t=String(e);if(V.test(t))return t;if(t.length>0&&!I.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(k,"\\$1")+'"'}function K(e){this.parameters=Object.create(null),this.type=e}var L={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!R.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,i=Object.keys(t).sort(),a=0;a<i.length;a++){if(o=i[a],!V.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+C(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(!R.test(n))throw new TypeError("invalid media type");var o=new K(n.toLowerCase());if(-1!==r){var i,a,s;for(A.lastIndex=r;a=A.exec(t);){if(a.index!==r)throw new TypeError("invalid parameter format");r+=a[0].length,i=a[1].toLowerCase(),'"'===(s=a[2])[0]&&(s=s.substr(1,s.length-2).replace(T,"$1")),o.parameters[i]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},U=function(e,t){if(e=e.trim(),(t=t.trim()).startsWith("about:"))return t;const r=function(e){const t={host:"",path:"",query:"",protocol:""};let r=e,n=e.indexOf("//");t.protocol=r.substring(0,n),n+=2;const o=e.indexOf("/",n),i=e.indexOf("?"),a=e.indexOf("#");-1!==a&&(r=r.substring(0,a));if(-1!==i){const e=r.substring(i);t.query=e,r=r.substring(0,i)}if(-1!==o){const e=r.substring(0,o);t.host=e,r=r.substring(o),t.path=r}else t.host=r;return t}(e),n=function(e){const t={href:e,hash:"",query:"",netPath:!1,absolutePath:!1,relativePath:!1};if(W.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)?q(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+z(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let i,a=r.path,s=r.host;return 0===e.length?i=a:(a=a.substring(0,a.lastIndexOf("/")),i=z(a+"/"+e)),s+=""!==i||t||o?i+t+o:"/",s}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:q(e)}};function q(e){return e+("/"===e[e.length-1]?"":"/")}function z(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 W=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");var _=fetch;const{isObject:B,splitUrl:D}=v,F=Symbol("$__jref"),Z={},J={},M=(e,t)=>{const r=e in J?J[e]:e;if(r in Z)return Z[r][t]},N={},G={},H=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=D(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=M(n,"idToken"),i=D(t)[0],a=ee(i,e[o]||""),s=D(a)[0];if(!s)throw Error("Couldn't determine an identifier for the schema");i&&(G[i]=s);const c=!!e.$recursiveAnchor;let u;delete e.$recursiveAnchor,M(n,"vocabulary")&&B(e)&&"$vocabulary"in e?(J[s]=n,u=e.$vocabulary,delete e.$vocabulary):u=s===n?{[n]:!0}:{};const l={};N[s]={id:s,schemaVersion:n,schema:Q(e,s,n,y.nil,l),anchors:l,recursiveAnchor:c,vocabulary:u,validated:!1}},Q=(e,t,r,n,o)=>{if(B(e)){const i=M(r,"idToken"),a=M(r,"anchorToken");if("string"==typeof e[i]){const n=e[i],o=ee(t,n),[s,c]=D(o);if(delete e[i],c&&(e[a]=a!==i?encodeURI(c):"#"+encodeURI(c)),s!==t)return H(e,ee(t,s),r),{[F]:n}}if("string"==typeof e[a]){const t=a!==i?e[a]:e[a].slice(1);o[t]=n,delete e[a]}return Object.entries(e).reduce((e,[i,a])=>(e[i]=Q(a,t,r,y.append(i,n),o),e),{})}return Array.isArray(e)?e.map((e,i)=>Q(e,t,r,y.append(i,n),o)):e},X=Object.freeze({id:"",schemaVersion:void 0,pointer:"",schema:void 0,recursiveAnchor:!1}),Y=async(e,t=X,r=!1)=>{const n=r&&t.recursiveAnchor?t.recursiveAnchor:ne(t),o=ee(n,e),[i,a]=D(o);if(!(e=>e in N||e in G)(i)){const e=await _(i,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error("Failed to retrieve schema with id: "+i);if(e.headers.has("content-type")){const t=L.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${i} is not a schema. Found a document with media type: ${t}`)}H(await e.json(),i)}const s=(e=>N[G[e]]||N[e])(i),c=Object.freeze({id:s.id,schemaVersion:s.schemaVersion,vocabulary:s.vocabulary,pointer:a&&"/"!==a[0]?re(s,a):a,schema:s.schema,recursiveAnchor:t.recursiveAnchor||!!s.recursiveAnchor&&i,validated:s.validated}),u=oe(c);return B(u)&&F in u?Y(u[F],c):M(c.schemaVersion,"jsonReference")&&B(u)&&"string"==typeof u.$ref?Y(u.$ref,c):M(c.schemaVersion,"keywordReference")&&"string"==typeof u&&c.pointer.endsWith("/$ref")?Y(u,c):M(c.schemaVersion,"keywordRecursiveReference")&&"string"==typeof u&&c.pointer.endsWith("/$recursiveRef")?Y(u,c,!0):c},ee=(e,t)=>{const r=U(e,t),n=D(e)[0];if(n&&"file"===te(r)&&"file"!==te(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},te=e=>{const t=e.match(/^(.+):\/\//);return t?t[1]:""},re=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},ne=e=>`${e.id}#${encodeURI(e.pointer)}`,oe=e=>y.get(e.pointer,e.schema),ie=(e,t)=>{const r=y.append(e,t.pointer);return Y("#"+encodeURI(r),t)},ae=n((e,t)=>oe(t).map(async(r,n)=>e(await ie(n,t),n)));var se={setConfig:(e,t,r)=>{Z[e]||(Z[e]={}),Z[e][t]=r},getConfig:M,add:H,get:Y,markValidated:e=>{N[e].validated=!0},uri:ne,value:oe,has:(e,t)=>e in oe(t),step:ie,entries:e=>Object.keys(oe(e)).map(t=>[t,ie(t,e)]),map:ae};const ce="FLAG",ue="BASIC",le="DETAILED",fe="VERBOSE";let de=le,pe=!0;const he=(e,t)=>(n,o=ce)=>{if(![ce,ue,le,fe].includes(o))throw Error(`The '${o}' error format is not supported`);let i=[];const a=r.subscribe("result",ye(o,i));return Pe(t,n,e),r.unsubscribe(a),i[0]},ye=(e,t)=>{const r=[];return(n,o)=>{const i={...o,errors:[]};for(;r.length>0&&ve(r[r.length-1],i);){const t=r.pop();let n=[];if(e===ue&&(n=t.errors,delete t.errors),i.errors.unshift(t,...n),be(i))break}(e===fe||e!==ce&&!i.valid)&&r.push(i),t[0]=i}},ve=(e,t)=>e.instanceLocation.startsWith(t.instanceLocation)&&(e.absoluteKeywordLocation.startsWith(t.absoluteKeywordLocation)||be(e)),be=e=>e.keyword.endsWith("#$ref")||e.keyword.endsWith("#$recursiveRef"),me={},we=e=>me[e],ge=e=>e in me,Oe={},Ee={},$e=async(e,t)=>{if(!ge(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 Oe)Object.entries(Oe[e]).forEach(([e,r])=>{((e,t)=>{me[e]={collectEvaluatedItems:(e,r,n)=>t.interpret(e,r,n)&&0,collectEvaluatedProperties:(e,r,n)=>t.interpret(e,r,n)&&[],...t}})(`${t.id}#${e}`,r)});else if(r)throw Error("Missing required vocabulary: "+e)})}if(pe&&!e.validated){if(se.markValidated(e.id),!(e.schemaVersion in Ee)){const t=await se.get(e.schemaVersion),r={},n=await $e(t,r);Ee[t.id]=he(r,n)}const t=S.cons(e.schema,e.id),r=Ee[e.schemaVersion](t,de);if(!r.valid)throw r}return await we(e.schemaVersion+"#validate").compile(e,t),se.uri(e)},Pe=(e,t,r)=>{const[n]=r[e];return we(n).interpret(e,t,r)};var je={validate:async(e,t,r)=>{const n={},o=await $e(e,n),i=(e,t=ce)=>he(n,o)(S.cons(e),t);return void 0===t?i:i(t,r)},setMetaOutputFormat:e=>{de=e},setShouldMetaValidate:e=>{pe=e},FLAG:ce,BASIC:ue,DETAILED:le,VERBOSE:fe,getKeyword:we,hasKeyword:ge,defineVocabulary:(e,t)=>{Oe[e]=t},compileSchema:$e,interpretSchema:Pe,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return we(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return we(o).collectEvaluatedItems(e,t,r,n)}};var xe={compile:()=>{},interpret:()=>!0},Se=async e=>Object.entries(await e),Ae=n(async(e,t)=>(await t).map(e)),Ie=n(async(e,t,r)=>(await r).reduce(async(t,r)=>e(await t,r),t)),Ve=n(async(e,t,r={})=>Ie(async(t,r)=>await e(r)?t.concat([r]):t,[],t,r)),Te=n(async(e,t)=>{const r=await Ae(e,t);return(await Promise.all(r)).some(e=>e)}),ke=n(async(e,t)=>{const r=await Ae(e,t);return(await Promise.all(r)).every(e=>e)}),Re=n((e,t)=>e.reduce(async(e,t)=>t(await e),t)),Ce={entries:Se,map:Ae,filter:Ve,reduce:Ie,some:Te,every:ke,pipeline:Re,all:e=>Promise.all(e),allValues:e=>Re([Se,Ie(async(e,[t,r])=>(e[t]=await r,e),{})],e)};var Ke={compile:async(e,t)=>{const r=se.uri(e);if(!(r in t)){t[r]=!1;const n=se.value(e);t[r]=[e.schemaVersion+"#validate",se.uri(e),"boolean"==typeof n?n:await Ce.pipeline([se.entries,Ce.map(([t,r])=>[`${e.schemaVersion}#${t}`,r]),Ce.filter(([t])=>je.hasKeyword(t)&&t!==e.schemaVersion+"#validate"),Ce.map(async([r,n])=>{const o=await n,i=await je.getKeyword(r).compile(o,t,e);return[r,se.uri(o),i]}),Ce.all],e)]}},interpret:(e,t,n)=>{const[o,i,a]=n[e],s="boolean"==typeof a?a:a.every(([e,o,i])=>{const a=je.getKeyword(e).interpret(i,t,n);return r.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:S.uri(t),valid:a}),a});return r.publishSync("result",{keyword:o,absoluteKeywordLocation:i,instanceLocation:S.uri(t),valid:s}),s},collectEvaluatedProperties:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedProperties")).reduce((e,[n,,o])=>{const i=e&&je.getKeyword(n).collectEvaluatedProperties(o,t,r);return i&&e.concat(i)},[])},collectEvaluatedItems:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedItems")).reduce((e,[n,,o])=>{const i=!1!==e&&je.getKeyword(n).collectEvaluatedItems(o,t,r);return!1!==i&&Math.max(e,i)},0)}},Le={Core:je,Schema:se,Instance:S,Keywords:{metaData:xe,validate:Ke}};e("default",Le);e("Core",Le.Core),e("Schema",Le.Schema),e("Instance",Le.Instance),e("Keywords",Le.Keywords)}}})); | ||
//# sourceMappingURL=json-schema-core-system.min.js.map |
@@ -845,6 +845,2 @@ (function (global, factory) { | ||
if (protocolEndIndex === -1) { | ||
throw new Error('Error, protocol is not specified'); | ||
} | ||
resultObject.protocol = path.substring(0, protocolEndIndex); | ||
@@ -908,3 +904,3 @@ | ||
// return resultObject | ||
} else { | ||
} else if (relative !== '') { | ||
resultObject.relativePath = true; | ||
@@ -959,23 +955,9 @@ } | ||
// if base is empty, assume relative is a net path. | ||
if (base === '') { | ||
if (_shouldAddSlash(relative)) { | ||
return _addSlash(relative); | ||
} | ||
// add / at end if not present if is only the host | ||
return relative; | ||
} | ||
const baseObj = _baseParse(base); | ||
// relative is empty, return base minus hash | ||
if (relative === '') { | ||
const {host, path, query} = baseObj; | ||
// when path and query aren't supplied add slash | ||
if ((!path) && (!query)) { | ||
return _addSlash(host); | ||
} | ||
return host + path + query; | ||
const relativeObj = _relativeParse(relative); | ||
if (!baseObj.protocol && !relativeObj.netPath) { | ||
throw new Error('Error, protocol is not specified'); | ||
} | ||
const relativeObj = _relativeParse(relative); | ||
if (relativeObj.netPath) { // relative is full qualified URL | ||
@@ -1019,2 +1001,9 @@ if (_shouldAddProtocol(relativeObj.href)) { | ||
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; | ||
} | ||
@@ -1151,3 +1140,3 @@ } | ||
// Schema Retrieval | ||
const nil$2 = Object.freeze({ id: "http://", schemaVersion: undefined, pointer: "", schema: undefined, recursiveAnchor: false }); | ||
const nil$2 = Object.freeze({ id: "", schemaVersion: undefined, pointer: "", schema: undefined, recursiveAnchor: false }); | ||
@@ -1204,4 +1193,5 @@ const get$2 = async (url, contextDoc = nil$2, recursive = false) => { | ||
const resolvedUrl = urlResolveBrowser(contextUrl, url); | ||
if (getScheme(resolvedUrl) === "file" && getScheme(contextUrl) !== "file") { | ||
throw Error("Can't access file resource from network context"); | ||
const contextId = splitUrl$2(contextUrl)[0]; | ||
if (contextId && getScheme(resolvedUrl) === "file" && getScheme(contextId) !== "file") { | ||
throw Error(`Can't access file '${resolvedUrl}' resource from network context '${contextUrl}'`); | ||
} | ||
@@ -1208,0 +1198,0 @@ return resolvedUrl; |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).JSC={})}(this,(function(e){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var r=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e,r){!function(t,n){var o={};t.PubSub=o;var i=t.define;!function(e){var t={},r=-1;function n(e){var t;for(t in e)if(e.hasOwnProperty(t))return!0;return!1}function o(e,t,r){try{e(t,r)}catch(e){setTimeout(function(e){return function(){throw e}}(e),0)}}function i(e,t,r){e(t,r)}function a(e,r,n,a){var s,c=t[r],u=a?i:o;if(t.hasOwnProperty(r))for(s in c)c.hasOwnProperty(s)&&u(c[s],e,n)}function s(e,r,o,i){var s=function(e,t,r){return function(){var n=String(e),o=n.lastIndexOf(".");for(a(e,e,t,r);-1!==o;)o=(n=n.substr(0,o)).lastIndexOf("."),a(e,n,t,r)}}(e="symbol"==typeof e?e.toString():e,r,i);return!!function(e){for(var r=String(e),o=Boolean(t.hasOwnProperty(r)&&n(t[r])),i=r.lastIndexOf(".");!o&&-1!==i;)i=(r=r.substr(0,i)).lastIndexOf("."),o=Boolean(t.hasOwnProperty(r)&&n(t[r]));return o}(e)&&(!0===o?s():setTimeout(s,0),!0)}e.publish=function(t,r){return s(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return s(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,t.hasOwnProperty(e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n=0;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n++;return n},e.getSubscriptions=function(e){var r,n=[];for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,i,a="string"==typeof r&&(t.hasOwnProperty(r)||function(e){var r;for(r in t)if(t.hasOwnProperty(r)&&0===r.indexOf(e))return!0;return!1}(r)),s=!a&&"string"==typeof r,c="function"==typeof r,u=!1;if(!a){for(n in t)if(t.hasOwnProperty(n)){if(o=t[n],s&&o[r]){delete o[r],u=r;break}if(c)for(i in o)o.hasOwnProperty(i)&&o[i]===r&&(delete o[i],u=!0)}return u}e.clearSubscriptions(r)}}(o),"function"==typeof i&&i.amd?i((function(){return o})):(void 0!==e&&e.exports&&(r=e.exports=o),r.PubSub=o,e.exports=r=o)}("object"==typeof window&&window||t)})),n=(r.PubSub,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)))}}});const o=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(f)},i=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:i(e,p(t,o,n),r,u(o,n))}}if(Array.isArray(t)){const n=[...t];return n[d(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:p(t,e[0],n)},a=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||h(t)){const o=e.shift();a(e,p(t,o,n),r,u(o,n))}else{t[d(t,e[0])]=r}},s=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=p(t,n,r);return{...t,[n]:s(e,o,u(n,r))}}if(Array.isArray(t))return t.filter((t,r)=>r!=e[0]);if("object"==typeof t&&null!==t){const{[e[0]]:r,...n}=t;return n}return p(t,e[0],r)}},c=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=p(t,n,r);c(e,o,u(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:p(t,e[0],r)},u=n((e,t)=>t+"/"+l(e)),l=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),f=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),d=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,p=(e,t,r="")=>{if(void 0===e)throw TypeError(`Value at '${r}' is undefined and does not have property '${t}'`);if(null===e)throw TypeError(`Value at '${r}' is null and does not have property '${t}'`);if(h(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[d(e,t)]},h=e=>null===e||"object"!=typeof e;var y={nil:"",append:u,get:(e,t)=>{const r=o(e),n=e=>r.reduce(([e,t],r)=>[p(e,r,t),u(r,t)],[e,""])[0];return void 0===t?n:n(t)},set:(e,t,r)=>{const a=o(e),s=n((e,t)=>i(a,e,t,""));return void 0===t?s:s(t,r)},assign:(e,t,r)=>{const i=o(e),s=n((e,t)=>a(i,e,t,""));return void 0===t?s:s(t,r)},unset:(e,t)=>{const r=o(e),n=e=>s(r,e,"");return void 0===t?n:n(t)},delete:(e,t)=>{const r=o(e),n=e=>c(r,e,"");return void 0===t?n:n(t)}};var v={isObject:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,splitUrl:e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),o=e.slice(r+1);return[decodeURI(n),decodeURI(o)]}};const{splitUrl:b}=v,m=Object.freeze({id:"",pointer:"",instance:void 0}),w=(e,t=m)=>Object.freeze({...t,pointer:b(e)[1]}),g=e=>y.get(e.pointer,e.instance),O=(e,t)=>{const r=y.append(e,t.pointer);return w(`#${encodeURI(r)}`,t)},$=n((e,t)=>g(t).map((r,n)=>e(O(n,t),n))),E=n((e,t)=>g(t).map((e,r)=>O(r,t)).filter((t,r)=>e(t,r))),j=n((e,t,r)=>g(r).reduce((t,n,o)=>e(t,O(o,r),o),t)),x=n((e,t)=>Object.keys(g(t)).every((r,n)=>e(O(r,t),n))),P=n((e,t)=>Object.keys(g(t)).some((r,n)=>e(O(r,t),n)));var A={cons:(e,t="")=>Object.freeze({...m,id:t,instance:e}),get:w,uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:g,step:O,entries:e=>Object.keys(g(e)).map(t=>[t,O(t,e)]),map:$,filter:E,reduce:j,every:x,some:P},S=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,I=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,V=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,T=/\\([\u000b\u0020-\u00ff])/g,k=/([\\"])/g,R=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/; | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).JSC={})}(this,(function(e){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var r=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e,r){!function(t,n){var o={};t.PubSub=o;var i=t.define;!function(e){var t={},r=-1;function n(e){var t;for(t in e)if(e.hasOwnProperty(t))return!0;return!1}function o(e,t,r){try{e(t,r)}catch(e){setTimeout(function(e){return function(){throw e}}(e),0)}}function i(e,t,r){e(t,r)}function a(e,r,n,a){var s,c=t[r],u=a?i:o;if(t.hasOwnProperty(r))for(s in c)c.hasOwnProperty(s)&&u(c[s],e,n)}function s(e,r,o,i){var s=function(e,t,r){return function(){var n=String(e),o=n.lastIndexOf(".");for(a(e,e,t,r);-1!==o;)o=(n=n.substr(0,o)).lastIndexOf("."),a(e,n,t,r)}}(e="symbol"==typeof e?e.toString():e,r,i);return!!function(e){for(var r=String(e),o=Boolean(t.hasOwnProperty(r)&&n(t[r])),i=r.lastIndexOf(".");!o&&-1!==i;)i=(r=r.substr(0,i)).lastIndexOf("."),o=Boolean(t.hasOwnProperty(r)&&n(t[r]));return o}(e)&&(!0===o?s():setTimeout(s,0),!0)}e.publish=function(t,r){return s(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return s(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,t.hasOwnProperty(e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n=0;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n++;return n},e.getSubscriptions=function(e){var r,n=[];for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,i,a="string"==typeof r&&(t.hasOwnProperty(r)||function(e){var r;for(r in t)if(t.hasOwnProperty(r)&&0===r.indexOf(e))return!0;return!1}(r)),s=!a&&"string"==typeof r,c="function"==typeof r,u=!1;if(!a){for(n in t)if(t.hasOwnProperty(n)){if(o=t[n],s&&o[r]){delete o[r],u=r;break}if(c)for(i in o)o.hasOwnProperty(i)&&o[i]===r&&(delete o[i],u=!0)}return u}e.clearSubscriptions(r)}}(o),"function"==typeof i&&i.amd?i((function(){return o})):(void 0!==e&&e.exports&&(r=e.exports=o),r.PubSub=o,e.exports=r=o)}("object"==typeof window&&window||t)})),n=(r.PubSub,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)))}}});const o=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(f)},i=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:i(e,p(t,o,n),r,u(o,n))}}if(Array.isArray(t)){const n=[...t];return n[d(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:p(t,e[0],n)},a=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||h(t)){const o=e.shift();a(e,p(t,o,n),r,u(o,n))}else{t[d(t,e[0])]=r}},s=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=p(t,n,r);return{...t,[n]:s(e,o,u(n,r))}}if(Array.isArray(t))return t.filter((t,r)=>r!=e[0]);if("object"==typeof t&&null!==t){const{[e[0]]:r,...n}=t;return n}return p(t,e[0],r)}},c=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=p(t,n,r);c(e,o,u(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:p(t,e[0],r)},u=n((e,t)=>t+"/"+l(e)),l=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),f=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),d=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,p=(e,t,r="")=>{if(void 0===e)throw TypeError(`Value at '${r}' is undefined and does not have property '${t}'`);if(null===e)throw TypeError(`Value at '${r}' is null and does not have property '${t}'`);if(h(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[d(e,t)]},h=e=>null===e||"object"!=typeof e;var y={nil:"",append:u,get:(e,t)=>{const r=o(e),n=e=>r.reduce(([e,t],r)=>[p(e,r,t),u(r,t)],[e,""])[0];return void 0===t?n:n(t)},set:(e,t,r)=>{const a=o(e),s=n((e,t)=>i(a,e,t,""));return void 0===t?s:s(t,r)},assign:(e,t,r)=>{const i=o(e),s=n((e,t)=>a(i,e,t,""));return void 0===t?s:s(t,r)},unset:(e,t)=>{const r=o(e),n=e=>s(r,e,"");return void 0===t?n:n(t)},delete:(e,t)=>{const r=o(e),n=e=>c(r,e,"");return void 0===t?n:n(t)}};var v={isObject:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,splitUrl:e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),o=e.slice(r+1);return[decodeURI(n),decodeURI(o)]}};const{splitUrl:b}=v,m=Object.freeze({id:"",pointer:"",instance:void 0}),w=(e,t=m)=>Object.freeze({...t,pointer:b(e)[1]}),g=e=>y.get(e.pointer,e.instance),O=(e,t)=>{const r=y.append(e,t.pointer);return w("#"+encodeURI(r),t)},E=n((e,t)=>g(t).map((r,n)=>e(O(n,t),n))),$=n((e,t)=>g(t).map((e,r)=>O(r,t)).filter((t,r)=>e(t,r))),j=n((e,t,r)=>g(r).reduce((t,n,o)=>e(t,O(o,r),o),t)),x=n((e,t)=>Object.keys(g(t)).every((r,n)=>e(O(r,t),n))),P=n((e,t)=>Object.keys(g(t)).some((r,n)=>e(O(r,t),n)));var A={cons:(e,t="")=>Object.freeze({...m,id:t,instance:e}),get:w,uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:g,step:O,entries:e=>Object.keys(g(e)).map(t=>[t,O(t,e)]),map:E,filter:$,reduce:j,every:x,some:P},S=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,I=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,V=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,T=/\\([\u000b\u0020-\u00ff])/g,k=/([\\"])/g,R=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/; | ||
/*! | ||
@@ -6,3 +6,3 @@ * content-type | ||
* MIT Licensed | ||
*/function C(e){var t=String(e);if(V.test(t))return t;if(t.length>0&&!I.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(k,"\\$1")+'"'}function K(e){this.parameters=Object.create(null),this.type=e}var L={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!R.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,i=Object.keys(t).sort(),a=0;a<i.length;a++){if(o=i[a],!V.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+C(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(!R.test(n))throw new TypeError("invalid media type");var o=new K(n.toLowerCase());if(-1!==r){var i,a,s;for(S.lastIndex=r;a=S.exec(t);){if(a.index!==r)throw new TypeError("invalid parameter format");r+=a[0].length,i=a[1].toLowerCase(),'"'===(s=a[2])[0]&&(s=s.substr(1,s.length-2).replace(T,"$1")),o.parameters[i]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},U=function(e,t){if(e=e.trim(),(t=t.trim()).startsWith("about:"))return t;if(""===e)return _(t)?q(t):t;const r=function(e){const t={host:"",path:"",query:"",protocol:""};let r=e,n=e.indexOf("//");if(-1===n)throw new Error("Error, protocol is not specified");t.protocol=r.substring(0,n),n+=2;const o=e.indexOf("/",n),i=e.indexOf("?"),a=e.indexOf("#");-1!==a&&(r=r.substring(0,a));if(-1!==i){const e=r.substring(i);t.query=e,r=r.substring(0,i)}if(-1!==o){const e=r.substring(0,o);t.host=e,r=r.substring(o),t.path=r}else t.host=r;return t}(e);if(""===t){const{host:e,path:t,query:n}=r;return t||n?e+t+n:q(e)}const n=function(e){const t={href:e,hash:"",query:"",netPath:!1,absolutePath:!1,relativePath:!1};if(W.test(e))return t.netPath=!0,t;"/"===e[0]?t.absolutePath=!0: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(n.netPath)return n.href.startsWith("//")&&(n.href=r.protocol+n.href),_(n.href)?q(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+z(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let i,a=r.path,s=r.host;return 0===e.length?i=a:(a=a.substring(0,a.lastIndexOf("/")),i=z(a+"/"+e)),s+=""!==i||t||o?i+t+o:"/",s}};function q(e){return e+("/"===e[e.length-1]?"":"/")}function z(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 W=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");function _(e){const t=e.indexOf("//")+2,r=!e.includes("/",t),n=!e.includes("?",t),o=!e.includes("#",t);return r&&n&&o}var B=fetch;const{isObject:D,splitUrl:F}=v,M=Symbol("$__jref"),Z={},J={},N=(e,t)=>{const r=e in J?J[e]:e;if(r in Z)return Z[r][t]},G={},H={},Q=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=F(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=N(n,"idToken"),i=F(t)[0],a=te(i,e[o]||""),s=F(a)[0];if(!s)throw Error("Couldn't determine an identifier for the schema");i&&(H[i]=s);const c=!!e.$recursiveAnchor;let u;delete e.$recursiveAnchor,N(n,"vocabulary")&&D(e)&&"$vocabulary"in e?(J[s]=n,u=e.$vocabulary,delete e.$vocabulary):u=s===n?{[n]:!0}:{};const l={};G[s]={id:s,schemaVersion:n,schema:X(e,s,n,y.nil,l),anchors:l,recursiveAnchor:c,vocabulary:u,validated:!1}},X=(e,t,r,n,o)=>{if(D(e)){const i=N(r,"idToken"),a=N(r,"anchorToken");if("string"==typeof e[i]){const n=e[i],o=te(t,n),[s,c]=F(o);if(delete e[i],c&&(e[a]=a!==i?encodeURI(c):`#${encodeURI(c)}`),s!==t)return Q(e,te(t,s),r),{[M]:n}}if("string"==typeof e[a]){const t=a!==i?e[a]:e[a].slice(1);o[t]=n,delete e[a]}return Object.entries(e).reduce((e,[i,a])=>(e[i]=X(a,t,r,y.append(i,n),o),e),{})}return Array.isArray(e)?e.map((e,i)=>X(e,t,r,y.append(i,n),o)):e},Y=Object.freeze({id:"http://",schemaVersion:void 0,pointer:"",schema:void 0,recursiveAnchor:!1}),ee=async(e,t=Y,r=!1)=>{const n=r&&t.recursiveAnchor?t.recursiveAnchor:oe(t),o=te(n,e),[i,a]=F(o);if(!(e=>e in G||e in H)(i)){const e=await B(i,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error(`Failed to retrieve schema with id: ${i}`);if(e.headers.has("content-type")){const t=L.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${i} is not a schema. Found a document with media type: ${t}`)}Q(await e.json(),i)}const s=(e=>G[H[e]]||G[e])(i),c=Object.freeze({id:s.id,schemaVersion:s.schemaVersion,vocabulary:s.vocabulary,pointer:a&&"/"!==a[0]?ne(s,a):a,schema:s.schema,recursiveAnchor:t.recursiveAnchor||!!s.recursiveAnchor&&i,validated:s.validated}),u=ie(c);return D(u)&&M in u?ee(u[M],c):N(c.schemaVersion,"jsonReference")&&D(u)&&"string"==typeof u.$ref?ee(u.$ref,c):N(c.schemaVersion,"keywordReference")&&"string"==typeof u&&c.pointer.endsWith("/$ref")?ee(u,c):N(c.schemaVersion,"keywordRecursiveReference")&&"string"==typeof u&&c.pointer.endsWith("/$recursiveRef")?ee(u,c,!0):c},te=(e,t)=>{const r=U(e,t);if("file"===re(r)&&"file"!==re(e))throw Error("Can't access file resource from network context");return r},re=e=>{const t=e.match(/^(.+):\/\//);return t?t[1]:""},ne=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},oe=e=>`${e.id}#${encodeURI(e.pointer)}`,ie=e=>y.get(e.pointer,e.schema),ae=(e,t)=>{const r=y.append(e,t.pointer);return ee(`#${encodeURI(r)}`,t)},se=n((e,t)=>ie(t).map(async(r,n)=>e(await ae(n,t),n)));var ce={setConfig:(e,t,r)=>{Z[e]||(Z[e]={}),Z[e][t]=r},getConfig:N,add:Q,get:ee,markValidated:e=>{G[e].validated=!0},uri:oe,value:ie,has:(e,t)=>e in ie(t),step:ae,entries:e=>Object.keys(ie(e)).map(t=>[t,ae(t,e)]),map:se};const ue="FLAG",le="BASIC",fe="DETAILED",de="VERBOSE";let pe=fe,he=!0;const ye=(e,t)=>(n,o=ue)=>{if(![ue,le,fe,de].includes(o))throw Error(`The '${o}' error format is not supported`);let i=[];const a=r.subscribe("result",ve(o,i));return xe(t,n,e),r.unsubscribe(a),i[0]},ve=(e,t)=>{const r=[];return(n,o)=>{const i={...o,errors:[]};for(;r.length>0&&be(r[r.length-1],i);){const t=r.pop();let n=[];if(e===le&&(n=t.errors,delete t.errors),i.errors.unshift(t,...n),me(i))break}(e===de||e!==ue&&!i.valid)&&r.push(i),t[0]=i}},be=(e,t)=>e.instanceLocation.startsWith(t.instanceLocation)&&(e.absoluteKeywordLocation.startsWith(t.absoluteKeywordLocation)||me(e)),me=e=>e.keyword.endsWith("#$ref")||e.keyword.endsWith("#$recursiveRef"),we={},ge=e=>we[e],Oe=e=>e in we,$e={},Ee={},je=async(e,t)=>{if(!Oe(`${e.schemaVersion}#validate`)){const t=await ce.get(e.schemaVersion);(ce.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)=>{we[e]={collectEvaluatedItems:(e,r,n)=>t.interpret(e,r,n)&&0,collectEvaluatedProperties:(e,r,n)=>t.interpret(e,r,n)&&[],...t}})(`${t.id}#${e}`,r)});else if(r)throw Error(`Missing required vocabulary: ${e}`)})}if(he&&!e.validated){if(ce.markValidated(e.id),!(e.schemaVersion in Ee)){const t=await ce.get(e.schemaVersion),r={},n=await je(t,r);Ee[t.id]=ye(r,n)}const t=A.cons(e.schema,e.id),r=Ee[e.schemaVersion](t,pe);if(!r.valid)throw r}return await ge(`${e.schemaVersion}#validate`).compile(e,t),ce.uri(e)},xe=(e,t,r)=>{const[n]=r[e];return ge(n).interpret(e,t,r)};var Pe={validate:async(e,t,r)=>{const n={},o=await je(e,n),i=(e,t=ue)=>ye(n,o)(A.cons(e),t);return void 0===t?i:i(t,r)},setMetaOutputFormat:e=>{pe=e},setShouldMetaValidate:e=>{he=e},FLAG:ue,BASIC:le,DETAILED:fe,VERBOSE:de,getKeyword:ge,hasKeyword:Oe,defineVocabulary:(e,t)=>{$e[e]=t},compileSchema:je,interpretSchema:xe,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return ge(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return ge(o).collectEvaluatedItems(e,t,r,n)}};var Ae={compile:()=>{},interpret:()=>!0},Se=async e=>Object.entries(await e),Ie=n(async(e,t)=>(await t).map(e)),Ve=n(async(e,t,r)=>(await r).reduce(async(t,r)=>e(await t,r),t)),Te=n(async(e,t,r={})=>Ve(async(t,r)=>await e(r)?t.concat([r]):t,[],t,r)),ke=n(async(e,t)=>{const r=await Ie(e,t);return(await Promise.all(r)).some(e=>e)}),Re=n(async(e,t)=>{const r=await Ie(e,t);return(await Promise.all(r)).every(e=>e)}),Ce=n((e,t)=>e.reduce(async(e,t)=>t(await e),t)),Ke={entries:Se,map:Ie,filter:Te,reduce:Ve,some:ke,every:Re,pipeline:Ce,all:e=>Promise.all(e),allValues:e=>Ce([Se,Ve(async(e,[t,r])=>(e[t]=await r,e),{})],e)};var Le={compile:async(e,t)=>{const r=ce.uri(e);if(!(r in t)){t[r]=!1;const n=ce.value(e);t[r]=[`${e.schemaVersion}#validate`,ce.uri(e),"boolean"==typeof n?n:await Ke.pipeline([ce.entries,Ke.map(([t,r])=>[`${e.schemaVersion}#${t}`,r]),Ke.filter(([t])=>Pe.hasKeyword(t)&&t!==`${e.schemaVersion}#validate`),Ke.map(async([r,n])=>{const o=await n,i=await Pe.getKeyword(r).compile(o,t,e);return[r,ce.uri(o),i]}),Ke.all],e)]}},interpret:(e,t,n)=>{const[o,i,a]=n[e],s="boolean"==typeof a?a:a.every(([e,o,i])=>{const a=Pe.getKeyword(e).interpret(i,t,n);return r.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:A.uri(t),valid:a}),a});return r.publishSync("result",{keyword:o,absoluteKeywordLocation:i,instanceLocation:A.uri(t),valid:s}),s},collectEvaluatedProperties:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedProperties")).reduce((e,[n,,o])=>{const i=e&&Pe.getKeyword(n).collectEvaluatedProperties(o,t,r);return i&&e.concat(i)},[])},collectEvaluatedItems:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedItems")).reduce((e,[n,,o])=>{const i=!1!==e&&Pe.getKeyword(n).collectEvaluatedItems(o,t,r);return!1!==i&&Math.max(e,i)},0)}},Ue={Core:Pe,Schema:ce,Instance:A,Keywords:{metaData:Ae,validate:Le}},qe=Ue.Core,ze=Ue.Schema,We=Ue.Instance,_e=Ue.Keywords;e.Core=qe,e.Instance=We,e.Keywords=_e,e.Schema=ze,e.default=Ue,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
*/function C(e){var t=String(e);if(V.test(t))return t;if(t.length>0&&!I.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(k,"\\$1")+'"'}function K(e){this.parameters=Object.create(null),this.type=e}var L={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!R.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,i=Object.keys(t).sort(),a=0;a<i.length;a++){if(o=i[a],!V.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+C(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(!R.test(n))throw new TypeError("invalid media type");var o=new K(n.toLowerCase());if(-1!==r){var i,a,s;for(S.lastIndex=r;a=S.exec(t);){if(a.index!==r)throw new TypeError("invalid parameter format");r+=a[0].length,i=a[1].toLowerCase(),'"'===(s=a[2])[0]&&(s=s.substr(1,s.length-2).replace(T,"$1")),o.parameters[i]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},U=function(e,t){if(e=e.trim(),(t=t.trim()).startsWith("about:"))return t;const r=function(e){const t={host:"",path:"",query:"",protocol:""};let r=e,n=e.indexOf("//");t.protocol=r.substring(0,n),n+=2;const o=e.indexOf("/",n),i=e.indexOf("?"),a=e.indexOf("#");-1!==a&&(r=r.substring(0,a));if(-1!==i){const e=r.substring(i);t.query=e,r=r.substring(0,i)}if(-1!==o){const e=r.substring(0,o);t.host=e,r=r.substring(o),t.path=r}else t.host=r;return t}(e),n=function(e){const t={href:e,hash:"",query:"",netPath:!1,absolutePath:!1,relativePath:!1};if(W.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)?q(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+z(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let i,a=r.path,s=r.host;return 0===e.length?i=a:(a=a.substring(0,a.lastIndexOf("/")),i=z(a+"/"+e)),s+=""!==i||t||o?i+t+o:"/",s}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:q(e)}};function q(e){return e+("/"===e[e.length-1]?"":"/")}function z(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 W=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");var _=fetch;const{isObject:B,splitUrl:D}=v,F=Symbol("$__jref"),M={},Z={},J=(e,t)=>{const r=e in Z?Z[e]:e;if(r in M)return M[r][t]},N={},G={},H=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=D(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=J(n,"idToken"),i=D(t)[0],a=ee(i,e[o]||""),s=D(a)[0];if(!s)throw Error("Couldn't determine an identifier for the schema");i&&(G[i]=s);const c=!!e.$recursiveAnchor;let u;delete e.$recursiveAnchor,J(n,"vocabulary")&&B(e)&&"$vocabulary"in e?(Z[s]=n,u=e.$vocabulary,delete e.$vocabulary):u=s===n?{[n]:!0}:{};const l={};N[s]={id:s,schemaVersion:n,schema:Q(e,s,n,y.nil,l),anchors:l,recursiveAnchor:c,vocabulary:u,validated:!1}},Q=(e,t,r,n,o)=>{if(B(e)){const i=J(r,"idToken"),a=J(r,"anchorToken");if("string"==typeof e[i]){const n=e[i],o=ee(t,n),[s,c]=D(o);if(delete e[i],c&&(e[a]=a!==i?encodeURI(c):"#"+encodeURI(c)),s!==t)return H(e,ee(t,s),r),{[F]:n}}if("string"==typeof e[a]){const t=a!==i?e[a]:e[a].slice(1);o[t]=n,delete e[a]}return Object.entries(e).reduce((e,[i,a])=>(e[i]=Q(a,t,r,y.append(i,n),o),e),{})}return Array.isArray(e)?e.map((e,i)=>Q(e,t,r,y.append(i,n),o)):e},X=Object.freeze({id:"",schemaVersion:void 0,pointer:"",schema:void 0,recursiveAnchor:!1}),Y=async(e,t=X,r=!1)=>{const n=r&&t.recursiveAnchor?t.recursiveAnchor:ne(t),o=ee(n,e),[i,a]=D(o);if(!(e=>e in N||e in G)(i)){const e=await _(i,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error("Failed to retrieve schema with id: "+i);if(e.headers.has("content-type")){const t=L.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${i} is not a schema. Found a document with media type: ${t}`)}H(await e.json(),i)}const s=(e=>N[G[e]]||N[e])(i),c=Object.freeze({id:s.id,schemaVersion:s.schemaVersion,vocabulary:s.vocabulary,pointer:a&&"/"!==a[0]?re(s,a):a,schema:s.schema,recursiveAnchor:t.recursiveAnchor||!!s.recursiveAnchor&&i,validated:s.validated}),u=oe(c);return B(u)&&F in u?Y(u[F],c):J(c.schemaVersion,"jsonReference")&&B(u)&&"string"==typeof u.$ref?Y(u.$ref,c):J(c.schemaVersion,"keywordReference")&&"string"==typeof u&&c.pointer.endsWith("/$ref")?Y(u,c):J(c.schemaVersion,"keywordRecursiveReference")&&"string"==typeof u&&c.pointer.endsWith("/$recursiveRef")?Y(u,c,!0):c},ee=(e,t)=>{const r=U(e,t),n=D(e)[0];if(n&&"file"===te(r)&&"file"!==te(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},te=e=>{const t=e.match(/^(.+):\/\//);return t?t[1]:""},re=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},ne=e=>`${e.id}#${encodeURI(e.pointer)}`,oe=e=>y.get(e.pointer,e.schema),ie=(e,t)=>{const r=y.append(e,t.pointer);return Y("#"+encodeURI(r),t)},ae=n((e,t)=>oe(t).map(async(r,n)=>e(await ie(n,t),n)));var se={setConfig:(e,t,r)=>{M[e]||(M[e]={}),M[e][t]=r},getConfig:J,add:H,get:Y,markValidated:e=>{N[e].validated=!0},uri:ne,value:oe,has:(e,t)=>e in oe(t),step:ie,entries:e=>Object.keys(oe(e)).map(t=>[t,ie(t,e)]),map:ae};const ce="FLAG",ue="BASIC",le="DETAILED",fe="VERBOSE";let de=le,pe=!0;const he=(e,t)=>(n,o=ce)=>{if(![ce,ue,le,fe].includes(o))throw Error(`The '${o}' error format is not supported`);let i=[];const a=r.subscribe("result",ye(o,i));return je(t,n,e),r.unsubscribe(a),i[0]},ye=(e,t)=>{const r=[];return(n,o)=>{const i={...o,errors:[]};for(;r.length>0&&ve(r[r.length-1],i);){const t=r.pop();let n=[];if(e===ue&&(n=t.errors,delete t.errors),i.errors.unshift(t,...n),be(i))break}(e===fe||e!==ce&&!i.valid)&&r.push(i),t[0]=i}},ve=(e,t)=>e.instanceLocation.startsWith(t.instanceLocation)&&(e.absoluteKeywordLocation.startsWith(t.absoluteKeywordLocation)||be(e)),be=e=>e.keyword.endsWith("#$ref")||e.keyword.endsWith("#$recursiveRef"),me={},we=e=>me[e],ge=e=>e in me,Oe={},Ee={},$e=async(e,t)=>{if(!ge(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 Oe)Object.entries(Oe[e]).forEach(([e,r])=>{((e,t)=>{me[e]={collectEvaluatedItems:(e,r,n)=>t.interpret(e,r,n)&&0,collectEvaluatedProperties:(e,r,n)=>t.interpret(e,r,n)&&[],...t}})(`${t.id}#${e}`,r)});else if(r)throw Error("Missing required vocabulary: "+e)})}if(pe&&!e.validated){if(se.markValidated(e.id),!(e.schemaVersion in Ee)){const t=await se.get(e.schemaVersion),r={},n=await $e(t,r);Ee[t.id]=he(r,n)}const t=A.cons(e.schema,e.id),r=Ee[e.schemaVersion](t,de);if(!r.valid)throw r}return await we(e.schemaVersion+"#validate").compile(e,t),se.uri(e)},je=(e,t,r)=>{const[n]=r[e];return we(n).interpret(e,t,r)};var xe={validate:async(e,t,r)=>{const n={},o=await $e(e,n),i=(e,t=ce)=>he(n,o)(A.cons(e),t);return void 0===t?i:i(t,r)},setMetaOutputFormat:e=>{de=e},setShouldMetaValidate:e=>{pe=e},FLAG:ce,BASIC:ue,DETAILED:le,VERBOSE:fe,getKeyword:we,hasKeyword:ge,defineVocabulary:(e,t)=>{Oe[e]=t},compileSchema:$e,interpretSchema:je,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return we(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return we(o).collectEvaluatedItems(e,t,r,n)}};var Pe={compile:()=>{},interpret:()=>!0},Ae=async e=>Object.entries(await e),Se=n(async(e,t)=>(await t).map(e)),Ie=n(async(e,t,r)=>(await r).reduce(async(t,r)=>e(await t,r),t)),Ve=n(async(e,t,r={})=>Ie(async(t,r)=>await e(r)?t.concat([r]):t,[],t,r)),Te=n(async(e,t)=>{const r=await Se(e,t);return(await Promise.all(r)).some(e=>e)}),ke=n(async(e,t)=>{const r=await Se(e,t);return(await Promise.all(r)).every(e=>e)}),Re=n((e,t)=>e.reduce(async(e,t)=>t(await e),t)),Ce={entries:Ae,map:Se,filter:Ve,reduce:Ie,some:Te,every:ke,pipeline:Re,all:e=>Promise.all(e),allValues:e=>Re([Ae,Ie(async(e,[t,r])=>(e[t]=await r,e),{})],e)};var Ke={compile:async(e,t)=>{const r=se.uri(e);if(!(r in t)){t[r]=!1;const n=se.value(e);t[r]=[e.schemaVersion+"#validate",se.uri(e),"boolean"==typeof n?n:await Ce.pipeline([se.entries,Ce.map(([t,r])=>[`${e.schemaVersion}#${t}`,r]),Ce.filter(([t])=>xe.hasKeyword(t)&&t!==e.schemaVersion+"#validate"),Ce.map(async([r,n])=>{const o=await n,i=await xe.getKeyword(r).compile(o,t,e);return[r,se.uri(o),i]}),Ce.all],e)]}},interpret:(e,t,n)=>{const[o,i,a]=n[e],s="boolean"==typeof a?a:a.every(([e,o,i])=>{const a=xe.getKeyword(e).interpret(i,t,n);return r.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:A.uri(t),valid:a}),a});return r.publishSync("result",{keyword:o,absoluteKeywordLocation:i,instanceLocation:A.uri(t),valid:s}),s},collectEvaluatedProperties:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedProperties")).reduce((e,[n,,o])=>{const i=e&&xe.getKeyword(n).collectEvaluatedProperties(o,t,r);return i&&e.concat(i)},[])},collectEvaluatedItems:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedItems")).reduce((e,[n,,o])=>{const i=!1!==e&&xe.getKeyword(n).collectEvaluatedItems(o,t,r);return!1!==i&&Math.max(e,i)},0)}},Le={Core:xe,Schema:se,Instance:A,Keywords:{metaData:Pe,validate:Ke}},Ue=Le.Core,qe=Le.Schema,ze=Le.Instance,We=Le.Keywords;e.Core=Ue,e.Instance=ze,e.Keywords=We,e.Schema=qe,e.default=Le,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=json-schema-core-umd.min.js.map |
@@ -131,3 +131,3 @@ const contentTypeParser = require("content-type"); | ||
// Schema Retrieval | ||
const nil = Object.freeze({ id: "http://", schemaVersion: undefined, pointer: "", schema: undefined, recursiveAnchor: false }); | ||
const nil = Object.freeze({ id: "", schemaVersion: undefined, pointer: "", schema: undefined, recursiveAnchor: false }); | ||
@@ -184,4 +184,5 @@ const get = async (url, contextDoc = nil, recursive = false) => { | ||
const resolvedUrl = resolveUrl(contextUrl, url); | ||
if (getScheme(resolvedUrl) === "file" && getScheme(contextUrl) !== "file") { | ||
throw Error("Can't access file resource from network context"); | ||
const contextId = splitUrl(contextUrl)[0]; | ||
if (contextId && getScheme(resolvedUrl) === "file" && getScheme(contextId) !== "file") { | ||
throw Error(`Can't access file '${resolvedUrl}' resource from network context '${contextUrl}'`); | ||
} | ||
@@ -188,0 +189,0 @@ return resolvedUrl; |
@@ -50,6 +50,2 @@ 'use strict'; | ||
if (protocolEndIndex === -1) { | ||
throw new Error('Error, protocol is not specified'); | ||
} | ||
resultObject.protocol = path.substring(0, protocolEndIndex); | ||
@@ -113,3 +109,3 @@ | ||
// return resultObject | ||
} else { | ||
} else if (relative !== '') { | ||
resultObject.relativePath = true; | ||
@@ -164,23 +160,9 @@ } | ||
// if base is empty, assume relative is a net path. | ||
if (base === '') { | ||
if (_shouldAddSlash(relative)) { | ||
return _addSlash(relative); | ||
} | ||
// add / at end if not present if is only the host | ||
return relative; | ||
} | ||
const baseObj = _baseParse(base); | ||
// relative is empty, return base minus hash | ||
if (relative === '') { | ||
const {host, path, query} = baseObj; | ||
// when path and query aren't supplied add slash | ||
if ((!path) && (!query)) { | ||
return _addSlash(host); | ||
} | ||
return host + path + query; | ||
const relativeObj = _relativeParse(relative); | ||
if (!baseObj.protocol && !relativeObj.netPath) { | ||
throw new Error('Error, protocol is not specified'); | ||
} | ||
const relativeObj = _relativeParse(relative); | ||
if (relativeObj.netPath) { // relative is full qualified URL | ||
@@ -224,3 +206,10 @@ if (_shouldAddProtocol(relativeObj.href)) { | ||
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; | ||
} | ||
} |
{ | ||
"name": "@hyperjump/json-schema-core", | ||
"version": "0.8.1", | ||
"version": "0.8.2", | ||
"description": "A framework for building JSON Schema tools", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1481813
8703