@hyperjump/json-schema-core
Advanced tools
Comparing version 0.23.0 to 0.23.1
@@ -1,2 +0,2 @@ | ||
define(["exports","url"],(function(e,t){"use strict";function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=r(t),o=function(e,t){return function r(){null==t&&(t=e.length);var n=[].slice.call(arguments);return n.length>=t?e.apply(this,n):function(){return r.apply(this,n.concat([].slice.call(arguments)))}}};var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var i,s=(function(e,t){var r,n;r="object"==typeof window&&window||a,n={},r.PubSub=n,function(e){var t={},r=-1,n="*";function o(e){var t;for(t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function a(e){return function(){throw e}}function i(e,t,r){try{e(t,r)}catch(e){setTimeout(a(e),0)}}function s(e,t,r){e(t,r)}function u(e,r,n,o){var a,u=t[r],l=o?s:i;if(Object.prototype.hasOwnProperty.call(t,r))for(a in u)Object.prototype.hasOwnProperty.call(u,a)&&l(u[a],e,n)}function l(e,t,r){return function(){var o=String(e),a=o.lastIndexOf(".");for(u(e,e,t,r);-1!==a;)a=(o=o.substr(0,a)).lastIndexOf("."),u(e,o,t,r);u(e,n,t,r)}}function c(e){var r=String(e);return Boolean(Object.prototype.hasOwnProperty.call(t,r)&&o(t[r]))}function f(e){for(var t=String(e),r=c(t)||c(n),o=t.lastIndexOf(".");!r&&-1!==o;)o=(t=t.substr(0,o)).lastIndexOf("."),r=c(t);return r}function h(e,t,r,n){var o=l(e="symbol"==typeof e?e.toString():e,t,n);return!!f(e)&&(!0===r?o():setTimeout(o,0),!0)}e.publish=function(t,r){return h(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return h(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,Object.prototype.hasOwnProperty.call(t,e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeAll=function(t){return e.subscribe(n,t)},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n,o=0;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)){for(n in t[r])o++;break}return o},e.getSubscriptions=function(e){var r,n=[];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,a,i=function(e){var r;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e))return!0;return!1},s="string"==typeof r&&(Object.prototype.hasOwnProperty.call(t,r)||i(r)),u=!s&&"string"==typeof r,l="function"==typeof r,c=!1;if(!s){for(n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(o=t[n],u&&o[r]){delete o[r],c=r;break}if(l)for(a in o)Object.prototype.hasOwnProperty.call(o,a)&&o[a]===r&&(delete o[a],c=!0)}return c}e.clearSubscriptions(r)}}(n),void 0!==e&&e.exports&&(t=e.exports=n),t.PubSub=n,e.exports=t=n}(i={exports:{}},i.exports),i.exports);s.PubSub;var u=function(e,t){if(e=e.trim(),(t=t.trim()).startsWith("about:"))return t;const r=function(e){const t={host:"",path:"",query:"",protocol:""};let r=e,n=e.indexOf("//");t.protocol=r.substring(0,n),n+=2;const o=e.indexOf("/",n),a=e.indexOf("?"),i=e.indexOf("#");-1!==i&&(r=r.substring(0,i));if(-1!==a){const e=r.substring(a);t.query=e,r=r.substring(0,a)}if(-1!==o){const e=r.substring(0,o);t.host=e,r=r.substring(o),t.path=r}else t.host=r;return t}(e),n=function(e){const t={href:e,hash:"",query:"",netPath:!1,absolutePath:!1,relativePath:!1};if(f.test(e))return t.netPath=!0,t;"/"===e[0]?t.absolutePath=!0:""!==e&&(t.relativePath=!0);let r=e;const n=e.indexOf("?"),o=e.indexOf("#");if(-1!==o){const e=r.substring(o);t.hash=e,r=r.substring(0,o)}if(-1!==n){const e=r.substring(n);t.query=e,r=r.substring(0,n)}return t.path=r,t}(t);if(!r.protocol&&!n.netPath)throw new Error("Error, protocol is not specified");if(n.netPath)return function(e){return e.startsWith("//")}(n.href)&&(n.href=r.protocol+n.href),function(e){const t=e.indexOf("//")+2,r=!e.includes("/",t),n=!e.includes("?",t),o=!e.includes("#",t);return r&&n&&o}(n.href)?l(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+c(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let a,i=r.path,s=r.host;return 0===e.length?a=i:(i=i.substring(0,i.lastIndexOf("/")),a=c(i+"/"+e)),s+=""!==a||t||o?a+t+o:"/",s}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:l(e)}};function l(e){return e+("/"===e[e.length-1]?"":"/")}function c(e){let t=e.split("/");""===t[0]&&(t=t.slice(1));let r=[];return t.forEach(((e,n)=>{"."!==e&&(".."===e?r.pop():""===e&&n!==t.length-1||r.push(e))})),"/"+r.join("/")}const f=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");const h={null:e=>null===e,boolean:e=>"boolean"==typeof e,object:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,array:e=>Array.isArray(e),number:e=>"number"==typeof e,integer:e=>Number.isInteger(e),string:e=>"string"==typeof e},m=e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),o=e.slice(r+1);return[decodeURI(n),decodeURI(o)]},p=e=>{const t=RegExp(/^(.+):\/\//).exec(e);return t?t[1]:""};var d={jsonTypeOf:(e,t)=>h[t](e),splitUrl:m,safeResolveUrl:(e,t)=>{const r=u(e,t),n=m(e)[0];if(n&&"file"===p(r)&&"file"!==p(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r}};const y=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(E)},v=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:v(e,S(t,o,n),r,w(o,n))}}if(Array.isArray(t)){const n=[...t];return n[I(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:S(t,e[0],n)},b=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||j(t)){const o=e.shift();b(e,S(t,o,n),r,w(o,n))}else{t[I(t,e[0])]=r}},g=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=S(t,n,r);return{...t,[n]:g(e,o,w(n,r))}}if(Array.isArray(t))return t.filter(((t,r)=>r!=e[0]));if("object"==typeof t&&null!==t){const{[e[0]]:r,...n}=t;return n}return S(t,e[0],r)}},x=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=S(t,n,r);x(e,o,w(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:S(t,e[0],r)},w=o(((e,t)=>t+"/"+O(e))),O=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),E=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),I=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,S=(e,t,r="")=>{if(void 0===e)throw TypeError(`Value at '${r}' is undefined and does not have property '${t}'`);if(null===e)throw TypeError(`Value at '${r}' is null and does not have property '${t}'`);if(j(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[I(e,t)]},j=e=>null===e||"object"!=typeof e;var P={nil:"",append:w,get:(e,t)=>{const r=y(e),n=e=>r.reduce((([e,t],r)=>[S(e,r,t),w(r,t)]),[e,""])[0];return void 0===t?n:n(t)},set:(e,t,r)=>{const n=y(e),a=o(((e,t)=>v(n,e,t,"")));return void 0===t?a:a(t,r)},assign:(e,t,r)=>{const n=y(e),a=o(((e,t)=>b(n,e,t,"")));return void 0===t?a:a(t,r)},unset:(e,t)=>{const r=y(e),n=e=>g(r,e,"");return void 0===t?n:n(t)},remove:(e,t)=>{const r=y(e),n=e=>x(r,e,"");return void 0===t?n:n(t)}};P.nil,P.append,P.get,P.set,P.assign,P.unset,P.remove;const A=Symbol("$__value"),T=Symbol("$__href");var R={cons:(e,t)=>Object.freeze({[T]:e,[A]:t}),isReference:e=>e&&void 0!==e[T],href:e=>e[T],value:e=>e[A]};const{jsonTypeOf:$}=d,V=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),k=e=>R.isReference(e.value)?R.value(e.value):e.value,L=o(((e,t)=>$(k(e),t))),H=(e,t)=>Object.freeze({...t,pointer:P.append(e,t.pointer),value:k(t)[e]}),U=o(((e,t)=>k(t).map(((r,n,o,a)=>e(H(n,t),n,o,a))))),q=o(((e,t)=>k(t).map(((e,r,n,o)=>H(r,t))).filter(((t,r,n,o)=>e(t,r,n,o))))),D=o(((e,t,r)=>k(r).reduce(((t,n,o)=>e(t,H(o,r),o)),t))),_=o(((e,t)=>k(t).every(((r,n,o,a)=>e(H(n,t),n,o,a))))),Q=o(((e,t)=>k(t).some(((r,n,o,a)=>e(H(n,t),n,o,a)))));var C={nil:V,cons:(e,t="")=>Object.freeze({...V,id:t,instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:k,has:(e,t)=>e in k(t),typeOf:L,step:H,entries:e=>Object.keys(k(e)).map((t=>[t,H(t,e)])),keys:e=>Object.keys(k(e)),map:U,filter:q,reduce:D,every:_,some:Q,length:e=>k(e).length},z=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,B=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,K=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,N=/\\([\u000b\u0020-\u00ff])/g,M=/([\\"])/g,F=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function J(e){var t=String(e);if(K.test(t))return t;if(t.length>0&&!B.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(M,"\\$1")+'"'}function W(e){this.parameters=Object.create(null),this.type=e}var Z={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!F.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,a=Object.keys(t).sort(),i=0;i<a.length;i++){if(o=a[i],!K.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+J(t[o])}return n},parse:function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;"function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.substr(0,r).trim():t.trim();if(!F.test(n))throw new TypeError("invalid media type");var o=new W(n.toLowerCase());if(-1!==r){var a,i,s;for(z.lastIndex=r;i=z.exec(t);){if(i.index!==r)throw new TypeError("invalid parameter format");r+=i[0].length,a=i[1].toLowerCase(),'"'===(s=i[2])[0]&&(s=s.substr(1,s.length-2).replace(N,"$1")),o.parameters[a]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},G=async e=>Object.entries(await e),X=o((async(e,t)=>(await t).map(e))),Y=o((async(e,t,r)=>(await r).reduce((async(t,r)=>e(await t,r)),t))),ee=o((async(e,t,r={})=>Y((async(t,r)=>await e(r)?t.concat([r]):t),[],t,r))),te=o((async(e,t)=>{const r=await X(e,t);return(await Promise.all(r)).some((e=>e))})),re=o((async(e,t)=>{const r=await X(e,t);return(await Promise.all(r)).every((e=>e))})),ne=o(((e,t)=>e.reduce((async(e,t)=>t(await e)),t))),oe={entries:G,map:X,filter:ee,reduce:Y,some:te,every:re,pipeline:ne,all:e=>Promise.all(e),allValues:e=>ne([G,Y((async(e,[t,r])=>(e[t]=await r,e)),{})],e)};oe.entries,oe.map,oe.filter,oe.reduce,oe.some,oe.every,oe.pipeline,oe.all,oe.allValues;var ae={ABSOLUTE:"absolute",PATH_RELATIVE:"pathRelative",ROOT_RELATIVE:"rootRelative",SHORTEST:"shortest"};function ie(e,t){var r=t.removeEmptyQueries&&e.extra.relation.minimumPort;return e.query.string[r?"stripped":"full"]}function se(e,t){return!e.extra.relation.minimumQuery||t.output===ae.ABSOLUTE||t.output===ae.ROOT_RELATIVE}function ue(e,t){var r=t.removeDirectoryIndexes&&e.extra.resourceIsIndex,n=e.extra.relation.minimumResource&&t.output!==ae.ABSOLUTE&&t.output!==ae.ROOT_RELATIVE;return!!e.resource&&!n&&!r}var le=function(e,t){var r="";return r+=function(e,t){var r="";return(e.extra.relation.maximumHost||t.output===ae.ABSOLUTE)&&(e.extra.relation.minimumScheme&&t.schemeRelative&&t.output!==ae.ABSOLUTE?r+="//":r+=e.scheme+"://"),r}(e,t),r+=function(e,t){return!e.auth||t.removeAuth||!e.extra.relation.maximumHost&&t.output!==ae.ABSOLUTE?"":e.auth+"@"}(e,t),r+=function(e,t){return e.host.full&&(e.extra.relation.maximumAuth||t.output===ae.ABSOLUTE)?e.host.full:""}(e,t),r+=function(e,t){return e.port&&!e.extra.portIsDefault&&e.extra.relation.maximumHost?":"+e.port:""}(e),r+=function(e,t){var r="",n=e.path.absolute.string,o=e.path.relative.string,a=ue(e,t);if(e.extra.relation.maximumHost||t.output===ae.ABSOLUTE||t.output===ae.ROOT_RELATIVE)r=n;else if(o.length<=n.length&&t.output===ae.SHORTEST||t.output===ae.PATH_RELATIVE){if(""===(r=o)){var i=se(e,t)&&!!ie(e,t);e.extra.relation.maximumPath&&!a?r="./":!e.extra.relation.overridesQuery||a||i||(r="./")}}else r=n;return"/"!==r||a||!t.removeRootTrailingSlash||e.extra.relation.minimumPort&&t.output!==ae.ABSOLUTE||(r=""),r}(e,t),r+=function(e,t){return ue(e,t)?e.resource:""}(e,t),r+=function(e,t){return se(e,t)?ie(e,t):""}(e,t),r+=function(e,t){return e.hash?e.hash:""}(e)};var ce={clone:function e(t){if(t instanceof Object){var r=t instanceof Array?[]:{};for(var n in t)t.hasOwnProperty(n)&&(r[n]=e(t[n]));return r}return t},isPlainObject:function(e){return!!e&&"object"==typeof e&&e.constructor===Object},shallowMerge:function(e,t){if(e instanceof Object&&t instanceof Object)for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e}};function fe(e,t){return t instanceof Object&&e instanceof Object?t instanceof Array&&e instanceof Array?t.concat(e):ce.shallowMerge(e,t):e}var he=function(e,t){if(ce.isPlainObject(e)){var r={};for(var n in t)t.hasOwnProperty(n)&&(void 0!==e[n]?r[n]=fe(e[n],t[n]):r[n]=t[n]);return r}return t};var me=function(e){var t=!(e.scheme||e.auth||e.host.full||e.port),r=t&&!e.path.absolute.string,n=r&&!e.resource,o=n&&!e.query.string.full.length,a=o&&!e.hash;e.extra.hrefInfo.minimumPathOnly=t,e.extra.hrefInfo.minimumResourceOnly=r,e.extra.hrefInfo.minimumQueryOnly=n,e.extra.hrefInfo.minimumHashOnly=o,e.extra.hrefInfo.empty=a};var pe=function(e,t){if(t.ignore_www){var r=e.host.full;if(r){var n=r;0===r.indexOf("www.")&&(n=r.substr(4)),e.host.stripped=n}}};function de(e){if("/"!==e){var t=[];return e.split("/").forEach((function(e){""!==e&&t.push(e)})),t}return[]}var ye=function(e,t){var r=e.path.absolute.string;if(r){var n=r.lastIndexOf("/");if(n>-1){if(++n<r.length){var o=r.substr(n);"."!==o&&".."!==o?(e.resource=o,r=r.substr(0,n)):r+="/"}e.path.absolute.string=r,e.path.absolute.array=de(r)}else"."===r||".."===r?(r+="/",e.path.absolute.string=r,e.path.absolute.array=de(r)):(e.resource=r,e.path.absolute.string=null);e.extra.resourceIsIndex=function(e,t){var r=!1;return t.directoryIndexes.every((function(t){return t!==e||(r=!0,!1)})),r}(e.resource,t)}};var ve=function(e,t){var r=-1;for(var n in t.defaultPorts)if(n===e.scheme&&t.defaultPorts.hasOwnProperty(n)){r=t.defaultPorts[n];break}r>-1&&(r=r.toString(),null===e.port&&(e.port=r),e.extra.portIsDefault=e.port===r)},be=Object.prototype.hasOwnProperty;function ge(e,t){var r=0,n="";for(var o in e)if(""!==o&&!0===be.call(e,o)){var a=e[o];""===a&&t||(n+=1==++r?"?":"&",o=encodeURIComponent(o),n+=""!==a?o+"="+encodeURIComponent(a).replace(/%20/g,"+"):o)}return n}var xe=function(e,t){e.query.string.full=ge(e.query.object,!1),t.removeEmptyQueries&&(e.query.string.stripped=ge(e.query.object,!0))},we=n.default.parse;var Oe=function(e,t){return function(e,t){var r=!0;return t.rejectedSchemes.every((function(t){return r=!(0===e.indexOf(t+":"))})),r}(e,t)?(r=we(e,!0,t.slashesDenoteHost),(n=r.protocol)&&n.indexOf(":")===n.length-1&&(n=n.substr(0,n.length-1)),r.host={full:r.hostname,stripped:null},r.path={absolute:{array:null,string:r.pathname},relative:{array:null,string:null}},r.query={object:r.query,string:{full:null,stripped:null}},r.extra={hrefInfo:{minimumPathOnly:null,minimumResourceOnly:null,minimumQueryOnly:null,minimumHashOnly:null,empty:null,separatorOnlyQuery:"?"===r.search},portIsDefault:null,relation:{maximumScheme:null,maximumAuth:null,maximumHost:null,maximumPort:null,maximumPath:null,maximumResource:null,maximumQuery:null,maximumHash:null,minimumScheme:null,minimumAuth:null,minimumHost:null,minimumPort:null,minimumPath:null,minimumResource:null,minimumQuery:null,minimumHash:null,overridesQuery:null},resourceIsIndex:null,slashes:r.slashes},r.resource=null,r.scheme=n,delete r.hostname,delete r.pathname,delete r.protocol,delete r.search,delete r.slashes,r):{href:e,valid:!1};var r,n};var Ee={join:function(e){return e.length>0?e.join("/")+"/":""},resolveDotSegments:function(e){var t=[];return e.forEach((function(e){".."!==e?"."!==e&&t.push(e):t.length>0&&t.splice(t.length-1,1)})),t}};function Ie(e,t){var r=Oe(e,t);return!1===r.valid||(pe(r,t),ve(r,t),ye(r,t),xe(r,t),me(r)),r}var Se={from:function(e,t,r){if(e){var n=Ie(e,t),o=Ee.resolveDotSegments(n.path.absolute.array);return n.path.absolute.array=o,n.path.absolute.string="/"+Ee.join(o),n}return r},to:Ie};var je={pathOn:function(e,t,r){var n=e.extra.hrefInfo.minimumQueryOnly,o=e.extra.hrefInfo.minimumHashOnly,a=e.extra.hrefInfo.empty,i=e.extra.relation.minimumPort,s=e.extra.relation.minimumScheme,u=i&&e.path.absolute.string===t.path.absolute.string,l=e.resource===t.resource||!e.resource&&t.extra.resourceIsIndex||r.removeDirectoryIndexes&&e.extra.resourceIsIndex&&!t.resource,c=u&&(l||n||o||a),f=r.removeEmptyQueries?"stripped":"full",h=e.query.string[f],m=t.query.string[f],p=c&&!!h&&h===m||(o||a)&&!e.extra.hrefInfo.separatorOnlyQuery,d=p&&e.hash===t.hash;e.extra.relation.minimumPath=u,e.extra.relation.minimumResource=c,e.extra.relation.minimumQuery=p,e.extra.relation.minimumHash=d,e.extra.relation.maximumPort=!s||s&&!u,e.extra.relation.maximumPath=!s||s&&!c,e.extra.relation.maximumResource=!s||s&&!p,e.extra.relation.maximumQuery=!s||s&&!d,e.extra.relation.maximumHash=!s||s&&!d,e.extra.relation.overridesQuery=u&&e.extra.relation.maximumResource&&!p&&!!m},upToPath:function(e,t,r){var n=e.extra.hrefInfo.minimumPathOnly,o=e.scheme===t.scheme||!e.scheme,a=o&&(e.auth===t.auth||r.removeAuth||n),i=r.ignore_www?"stripped":"full",s=a&&(e.host[i]===t.host[i]||n),u=s&&(e.port===t.port||n);e.extra.relation.minimumScheme=o,e.extra.relation.minimumAuth=a,e.extra.relation.minimumHost=s,e.extra.relation.minimumPort=u,e.extra.relation.maximumScheme=!o||o&&!a,e.extra.relation.maximumAuth=!o||o&&!s,e.extra.relation.maximumHost=!o||o&&!u}};var Pe=function(e,t,r){je.upToPath(e,t,r),e.extra.relation.minimumScheme&&(e.scheme=t.scheme),e.extra.relation.minimumAuth&&(e.auth=t.auth),e.extra.relation.minimumHost&&(e.host=ce.clone(t.host)),e.extra.relation.minimumPort&&function(e,t){e.port=t.port,e.extra.portIsDefault=t.extra.portIsDefault}(e,t),e.extra.relation.minimumScheme&&function(e,t){if(e.extra.relation.maximumHost||!e.extra.hrefInfo.minimumResourceOnly){var r=e.path.absolute.array,n="/";r?(e.extra.hrefInfo.minimumPathOnly&&0!==e.path.absolute.string.indexOf("/")&&(r=t.path.absolute.array.concat(r)),r=Ee.resolveDotSegments(r),n+=Ee.join(r)):r=[],e.path.absolute.array=r,e.path.absolute.string=n}else e.path=ce.clone(t.path)}(e,t),je.pathOn(e,t,r),e.extra.relation.minimumResource&&function(e,t){e.resource=t.resource,e.extra.resourceIsIndex=t.extra.resourceIsIndex}(e,t),e.extra.relation.minimumQuery&&(e.query=ce.clone(t.query)),e.extra.relation.minimumHash&&(e.hash=t.hash)};var Ae=function(e,t,r){if(e.extra.relation.minimumScheme){var n=(o=e.path.absolute.array,a=t.path.absolute.array,i=[],s=!0,u=-1,a.forEach((function(e,t){s&&(o[t]!==e?s=!1:u=t),s||i.push("..")})),o.forEach((function(e,t){t>u&&i.push(e)})),i);e.path.relative.array=n,e.path.relative.string=Ee.join(n)}var o,a,i,s,u};var Te=function(e,t,r){return Pe(t,e,r),Ae(t,e),t};function Re(e,t){this.options=he(t,{defaultPorts:{ftp:21,http:80,https:443},directoryIndexes:["index.html"],ignore_www:!1,output:Re.SHORTEST,rejectedSchemes:["data","javascript","mailto"],removeAuth:!1,removeDirectoryIndexes:!0,removeEmptyQueries:!1,removeRootTrailingSlash:!0,schemeRelative:!0,site:void 0,slashesDenoteHost:!0}),this.from=Se.from(e,this.options,null)}Re.prototype.relate=function(e,t,r){if(ce.isPlainObject(t)?(r=t,t=e,e=null):t||(t=e,e=null),r=he(r,this.options),e=e||r.site,!(e=Se.from(e,r,this.from))||!e.href)throw new Error("from value not defined.");if(e.extra.hrefInfo.minimumPathOnly)throw new Error("from value supplied is not absolute: "+e.href);return!1===(t=Se.to(t,r)).valid?t.href:(t=Te(e,t,r),t=le(t,r))},Re.relate=function(e,t,r){return(new Re).relate(e,t,r)},ce.shallowMerge(Re,ae);var $e=Re,Ve=fetch;const{jsonTypeOf:ke,splitUrl:Le,safeResolveUrl:He}=d,Ue={},qe={},De=(e,t)=>{const r=e in qe?qe[e]:e;if(r in Ue)return Ue[r][t]},_e={},Qe={},Ce=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=Le(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=De(n,"baseToken"),a=De(n,"anchorToken"),i=Le(t)[0];if(!i&&!Le(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const s=He(i,e[o]||""),[u,l]=Le(s);delete e[o],l&&o===a&&(e[a]=a!==o?encodeURI(l):`#${encodeURI(l)}`),i&&(Qe[i]=u);const c={},f=De(n,"recursiveAnchorToken");let h;!0===e[f]&&(c[""]=`${u}#`,e[a]="",delete e[f]);const m=De(n,"vocabularyToken");ke(e[m],"object")?(qe[u]=n,h=e[m],delete e[m]):(qe[u]=n,h={[n]:!0});const p={"":""};return _e[u]={id:u,schemaVersion:n,schema:ze(e,u,n,P.nil,p,c),anchors:p,dynamicAnchors:c,vocabulary:h,validated:!1},u},ze=(e,t,r,n,o,a)=>{if(ke(e,"object")){const i="string"==typeof e.$schema?Le(e.$schema)[0]:r,s=De(i,"embeddedToken"),u=De(i,"anchorToken");if("string"==typeof e[s]&&(s!==u||"#"!==e[s][0])){const n=He(t,e[s]);return e[s]=n,Ce(e,n,r),R.cons(e[s],e)}const l=De(r,"anchorToken"),c=De(r,"dynamicAnchorToken");"string"==typeof e[c]&&(a[e[c]]=`${t}#${encodeURI(n)}`,o[e[c]]=n,delete e[c]);const f=De(r,"embeddedToken");if("string"==typeof e[l]){const t=l!==f?e[l]:e[l].slice(1);o[t]=n,delete e[l]}const h=De(r,"jrefToken");if("string"==typeof e[h])return R.cons(e[h],e);for(const i in e)e[i]=ze(e[i],t,r,P.append(i,n),o,a);return e}return Array.isArray(e)?e.map(((e,i)=>ze(e,t,r,P.append(i,n),o,a))):e},Be=e=>_e[Qe[e]]||_e[e],Ke=Object.freeze({id:"",schemaVersion:void 0,vocabulary:{},pointer:P.nil,schema:void 0,value:void 0,anchors:{},dynamicAnchors:{},validated:!0}),Ne=async(e,t=Ke)=>{const r=He(Je(t),e),[n,o]=Le(r);if(!(e=>e in _e||e in Qe)(n)){const e=await Ve(n,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error(`Failed to retrieve schema with id: ${n}`);if(e.headers.has("content-type")){const t=Z.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${n} is not a schema. Found a document with media type: ${t}`)}Ce(await e.json(),n)}const a=Be(n),i="/"!==o[0]?Fe(a,o):o,s=Object.freeze({...a,pointer:i,value:P.get(i,a.schema)});return Me(s)},Me=e=>R.isReference(e.value)?Ne(R.href(e.value),e):e,Fe=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},Je=e=>`${e.id}#${encodeURI(e.pointer)}`,We=e=>R.isReference(e.value)?R.value(e.value):e.value,Ze=(e,t)=>{const r=Be(t.id),n=Object.freeze({...t,pointer:P.append(e,t.pointer),value:We(t)[e],validated:r.validated});return Me(n)},Ge=o(((e,t)=>oe.pipeline([We,oe.map((async(r,n)=>e(await Ze(n,t),n))),oe.all],t))),Xe={parentId:"",parentDialect:"",includeEmbedded:!0},Ye=(e,t)=>t.startsWith("file://")?""===e?"":$e.relate(e,t):t;var et={setConfig:(e,t,r)=>{Ue[e]||(Ue[e]={}),Ue[e][t]=r},getConfig:De,add:Ce,get:Ne,markValidated:e=>{_e[e].validated=!0},uri:Je,value:We,getAnchorPointer:Fe,typeOf:(e,t)=>ke(We(e),t),has:(e,t)=>e in We(t),step:Ze,keys:e=>Object.keys(We(e)),entries:e=>oe.pipeline([We,Object.keys,oe.map((async t=>[t,await Ze(t,e)])),oe.all],e),map:Ge,length:e=>We(e).length,toSchema:(e,t={})=>{const r={...Xe,...t},n=JSON.parse(JSON.stringify(e.schema,((t,n)=>{if(!R.isReference(n))return n;const o=R.value(n),a=o.$schema||e.schemaVersion,i=De(a,"embeddedToken");return!r.includeEmbedded&&i in o?void 0:R.value(n)}))),o=De(e.schemaVersion,"dynamicAnchorToken");Object.entries(e.dynamicAnchors).forEach((([e,t])=>{const r=Le(t)[1];P.assign(r,n,{[o]:e,...P.get(r,n)})}));const a=De(e.schemaVersion,"anchorToken");Object.entries(e.anchors).filter((([e])=>""!==e)).forEach((([e,t])=>{P.assign(t,n,{[a]:e,...P.get(t,n)})}));const i=De(e.schemaVersion,"baseToken"),s=Ye(r.parentId,e.id),u=r.parentDialect===e.schemaVersion?"":e.schemaVersion;return{...s&&{[i]:s},...u&&{$schema:u},...n}}};et.setConfig,et.getConfig,et.add,et.get,et.markValidated,et.uri,et.value,et.getAnchorPointer,et.typeOf,et.has,et.step,et.keys,et.entries,et.map,et.length,et.toSchema;class tt extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var rt=tt;const{splitUrl:nt}=d,ot="FLAG",at="BASIC",it="DETAILED",st="VERBOSE";let ut=it,lt=!0;const ct=async e=>{const t={metaData:{}};return{ast:t,schemaUri:await bt(e,t)}},ft=o((({ast:e,schemaUri:t},r,n=ot)=>{if(![ot,at,it,st].includes(n))throw Error(`The '${n}' error format is not supported`);const o=[],a=s.subscribe("result",ht(n,o));return xt(t,r,e,{}),s.unsubscribe(a),o[0]})),ht=(e,t)=>{const r=[];return(n,o)=>{if("result"===n){const{keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:a}=o,i={keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:a,errors:[]};r.push(i)}else if("result.start"===n)r.push(n);else if("result.end"===n){const n=r.pop();for(;"result.start"!==r[r.length-1];){const t=r.pop(),o=[t];e===at&&(o.push(...t.errors),delete t.errors),(e===st||e!==ot&&!t.valid)&&n.errors.unshift(...o)}r[r.length-1]=n,t[0]=n}}},mt={},pt=e=>mt[e],dt=e=>e in mt,yt={},vt={},bt=async(e,t)=>{if(e=await gt(e),!dt(`${e.schemaVersion}#validate`)){const t=await et.get(e.schemaVersion);(et.getConfig(t.id,"mandatoryVocabularies")||[]).forEach((e=>{if(!t.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)})),Object.entries(t.vocabulary).forEach((([e,r])=>{if(e in yt)Object.entries(yt[e]).forEach((([e,r])=>{((e,t)=>{mt[e]={collectEvaluatedItems:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&new Set,collectEvaluatedProperties:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&[],...t}})(`${t.id}#${e}`,r)}));else if(r)throw Error(`Missing required vocabulary: ${e}`)}))}if(lt&&!e.validated){if(et.markValidated(e.id),!(e.schemaVersion in vt)){const t=await et.get(e.schemaVersion),r=await ct(t);vt[t.id]=ft(r)}const t=C.cons(e.schema,e.id),r=vt[e.schemaVersion](t,ut);if(!r.valid)throw new rt(r)}return e.id in t.metaData||(t.metaData[e.id]={id:e.id,dynamicAnchors:e.dynamicAnchors,anchors:e.anchors}),pt(`${e.schemaVersion}#validate`).compile(e,t)},gt=async e=>et.typeOf(e,"string")?gt(await et.get(et.value(e),e)):e,xt=(e,t,r,n)=>{const o=wt(e,r),a=nt(e)[0];return pt(o).interpret(e,t,r,{...r.metaData[a].dynamicAnchors,...n})},wt=(e,t)=>{if(!(e in t))throw Error(`No schema found at ${e}`);return t[e][0]};var Ot={validate:async(e,t,r)=>{const n=await ct(e),o=(e,t)=>ft(n,C.cons(e),t);return void 0===t?o:o(t,r)},compile:ct,interpret:ft,setMetaOutputFormat:e=>{ut=e},setShouldMetaValidate:e=>{lt=e},FLAG:ot,BASIC:at,DETAILED:it,VERBOSE:st,add:(e,t="",r="")=>{const n=et.add(e,t,r);delete vt[n]},getKeyword:pt,hasKeyword:dt,defineVocabulary:(e,t)=>{yt[e]=t},compileSchema:bt,interpretSchema:xt,collectEvaluatedProperties:(e,t,r,n,o)=>{const a=wt(e,r);return pt(a).collectEvaluatedProperties(e,t,r,n,o)},collectEvaluatedItems:(e,t,r,n,o)=>{const a=wt(e,r);return pt(a).collectEvaluatedItems(e,t,r,n,o)}};var Et={compile:e=>et.value(e),interpret:()=>!0};var It={compile:async(e,t)=>{const r=et.uri(e);if(!(r in t)){t[r]=!1;const n=et.value(e);if(!["object","boolean"].includes(typeof n))throw Error(`No schema found at '${et.uri(e)}'`);t[r]=[`${e.schemaVersion}#validate`,et.uri(e),"boolean"==typeof n?n:await oe.pipeline([et.entries,oe.map((([t,r])=>[`${e.schemaVersion}#${t}`,r])),oe.filter((([t])=>Ot.hasKeyword(t)&&t!==`${e.schemaVersion}#validate`)),oe.map((async([r,n])=>{const o=await Ot.getKeyword(r).compile(n,t,e);return[r,et.uri(n),o]})),oe.all],e)]}return r},interpret:(e,t,r,n)=>{const[o,a,i]=r[e];s.publishSync("result.start");const u="boolean"==typeof i?i:i.every((([e,o,a])=>{s.publishSync("result.start");const i=Ot.getKeyword(e).interpret(a,t,r,n);return s.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:C.uri(t),valid:i,ast:a}),s.publishSync("result.end"),i}));return s.publishSync("result",{keyword:o,absoluteKeywordLocation:a,instanceLocation:C.uri(t),valid:u,ast:e}),s.publishSync("result.end"),u},collectEvaluatedProperties:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&[]:a.filter((([e])=>!o||!e.endsWith("#unevaluatedProperties"))).reduce(((e,[o,,a])=>{const i=e&&Ot.getKeyword(o).collectEvaluatedProperties(a,t,r,n);return!1!==i&&[...e,...i]}),[])},collectEvaluatedItems:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&new Set:a.filter((([e])=>!o||!e.endsWith("#unevaluatedItems"))).reduce(((e,[o,,a])=>{const i=!1!==e&&Ot.getKeyword(o).collectEvaluatedItems(a,t,r,n);return!1!==i&&new Set([...e,...i])}),new Set)}},St={metaData:Et,validate:It},jt={Core:Ot,Schema:et,Instance:C,Reference:R,Keywords:St,InvalidSchemaError:rt},Pt=jt.Core,At=jt.Schema,Tt=jt.Instance,Rt=jt.Reference,$t=jt.Keywords,Vt=jt.InvalidSchemaError;e.Core=Pt,e.Instance=Tt,e.InvalidSchemaError=Vt,e.Keywords=$t,e.Reference=Rt,e.Schema=At,e.default=jt,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
define(["exports","url-resolve-browser"],(function(e,t){"use strict";function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=r(t),o=function(e,t){return function r(){null==t&&(t=e.length);var n=[].slice.call(arguments);return n.length>=t?e.apply(this,n):function(){return r.apply(this,n.concat([].slice.call(arguments)))}}};var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var i,s=(function(e,t){var r,n;r="object"==typeof window&&window||a,n={},r.PubSub=n,function(e){var t={},r=-1,n="*";function o(e){var t;for(t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function a(e){return function(){throw e}}function i(e,t,r){try{e(t,r)}catch(e){setTimeout(a(e),0)}}function s(e,t,r){e(t,r)}function c(e,r,n,o){var a,c=t[r],l=o?s:i;if(Object.prototype.hasOwnProperty.call(t,r))for(a in c)Object.prototype.hasOwnProperty.call(c,a)&&l(c[a],e,n)}function l(e,t,r){return function(){var o=String(e),a=o.lastIndexOf(".");for(c(e,e,t,r);-1!==a;)a=(o=o.substr(0,a)).lastIndexOf("."),c(e,o,t,r);c(e,n,t,r)}}function u(e){var r=String(e);return Boolean(Object.prototype.hasOwnProperty.call(t,r)&&o(t[r]))}function f(e){for(var t=String(e),r=u(t)||u(n),o=t.lastIndexOf(".");!r&&-1!==o;)o=(t=t.substr(0,o)).lastIndexOf("."),r=u(t);return r}function p(e,t,r,n){var o=l(e="symbol"==typeof e?e.toString():e,t,n);return!!f(e)&&(!0===r?o():setTimeout(o,0),!0)}e.publish=function(t,r){return p(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return p(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,Object.prototype.hasOwnProperty.call(t,e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeAll=function(t){return e.subscribe(n,t)},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n,o=0;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)){for(n in t[r])o++;break}return o},e.getSubscriptions=function(e){var r,n=[];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,a,i=function(e){var r;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e))return!0;return!1},s="string"==typeof r&&(Object.prototype.hasOwnProperty.call(t,r)||i(r)),c=!s&&"string"==typeof r,l="function"==typeof r,u=!1;if(!s){for(n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(o=t[n],c&&o[r]){delete o[r],u=r;break}if(l)for(a in o)Object.prototype.hasOwnProperty.call(o,a)&&o[a]===r&&(delete o[a],u=!0)}return u}e.clearSubscriptions(r)}}(n),void 0!==e&&e.exports&&(t=e.exports=n),t.PubSub=n,e.exports=t=n}(i={exports:{}},i.exports),i.exports);s.PubSub;const c={null:e=>null===e,boolean:e=>"boolean"==typeof e,object:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,array:e=>Array.isArray(e),number:e=>"number"==typeof e,integer:e=>Number.isInteger(e),string:e=>"string"==typeof e},l=e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),o=e.slice(r+1);return[decodeURI(n),decodeURI(o)]},u=e=>{const t=RegExp(/^(.+):\/\//).exec(e);return t?t[1]:""};var f={jsonTypeOf:(e,t)=>c[t](e),splitUrl:l,safeResolveUrl:(e,t)=>{const r=n.default(e,t),o=l(e)[0];if(o&&"file"===u(r)&&"file"!==u(o))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r}};const p=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(w)},d=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:d(e,O(t,o,n),r,m(o,n))}}if(Array.isArray(t)){const n=[...t];return n[g(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:O(t,e[0],n)},y=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||j(t)){const o=e.shift();y(e,O(t,o,n),r,m(o,n))}else{t[g(t,e[0])]=r}},h=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=O(t,n,r);return{...t,[n]:h(e,o,m(n,r))}}if(Array.isArray(t))return t.filter(((t,r)=>r!=e[0]));if("object"==typeof t&&null!==t){const{[e[0]]:r,...n}=t;return n}return O(t,e[0],r)}},v=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=O(t,n,r);v(e,o,m(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:O(t,e[0],r)},m=o(((e,t)=>t+"/"+b(e))),b=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),w=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),g=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,O=(e,t,r="")=>{if(void 0===e)throw TypeError(`Value at '${r}' is undefined and does not have property '${t}'`);if(null===e)throw TypeError(`Value at '${r}' is null and does not have property '${t}'`);if(j(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[g(e,t)]},j=e=>null===e||"object"!=typeof e;var E={nil:"",append:m,get:(e,t)=>{const r=p(e),n=e=>r.reduce((([e,t],r)=>[O(e,r,t),m(r,t)]),[e,""])[0];return void 0===t?n:n(t)},set:(e,t,r)=>{const n=p(e),a=o(((e,t)=>d(n,e,t,"")));return void 0===t?a:a(t,r)},assign:(e,t,r)=>{const n=p(e),a=o(((e,t)=>y(n,e,t,"")));return void 0===t?a:a(t,r)},unset:(e,t)=>{const r=p(e),n=e=>h(r,e,"");return void 0===t?n:n(t)},remove:(e,t)=>{const r=p(e),n=e=>v(r,e,"");return void 0===t?n:n(t)}};E.nil,E.append,E.get,E.set,E.assign,E.unset,E.remove;const $=Symbol("$__value"),S=Symbol("$__href");var A={cons:(e,t)=>Object.freeze({[S]:e,[$]:t}),isReference:e=>e&&void 0!==e[S],href:e=>e[S],value:e=>e[$]};const{jsonTypeOf:I}=f,T=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),k=e=>A.isReference(e.value)?A.value(e.value):e.value,x=o(((e,t)=>I(k(e),t))),P=(e,t)=>Object.freeze({...t,pointer:E.append(e,t.pointer),value:k(t)[e]}),V=o(((e,t)=>k(t).map(((r,n,o,a)=>e(P(n,t),n,o,a))))),R=o(((e,t)=>k(t).map(((e,r,n,o)=>P(r,t))).filter(((t,r,n,o)=>e(t,r,n,o))))),U=o(((e,t,r)=>k(r).reduce(((t,n,o)=>e(t,P(o,r),o)),t))),C=o(((e,t)=>k(t).every(((r,n,o,a)=>e(P(n,t),n,o,a))))),K=o(((e,t)=>k(t).some(((r,n,o,a)=>e(P(n,t),n,o,a)))));var L={nil:T,cons:(e,t="")=>Object.freeze({...T,id:t,instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:k,has:(e,t)=>e in k(t),typeOf:x,step:P,entries:e=>Object.keys(k(e)).map((t=>[t,P(t,e)])),keys:e=>Object.keys(k(e)),map:V,filter:R,reduce:U,every:C,some:K,length:e=>k(e).length},z=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,_=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,D=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,N=/\\([\u000b\u0020-\u00ff])/g,q=/([\\"])/g,B=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function F(e){var t=String(e);if(D.test(t))return t;if(t.length>0&&!_.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(q,"\\$1")+'"'}function Z(e){this.parameters=Object.create(null),this.type=e}var M={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!B.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,a=Object.keys(t).sort(),i=0;i<a.length;i++){if(o=a[i],!D.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+F(t[o])}return n},parse:function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;"function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.substr(0,r).trim():t.trim();if(!B.test(n))throw new TypeError("invalid media type");var o=new Z(n.toLowerCase());if(-1!==r){var a,i,s;for(z.lastIndex=r;i=z.exec(t);){if(i.index!==r)throw new TypeError("invalid parameter format");r+=i[0].length,a=i[1].toLowerCase(),'"'===(s=i[2])[0]&&(s=s.substr(1,s.length-2).replace(N,"$1")),o.parameters[a]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},J=async e=>Object.entries(await e),G=o((async(e,t)=>(await t).map(e))),H=o((async(e,t,r)=>(await r).reduce((async(t,r)=>e(await t,r)),t))),W=o((async(e,t,r={})=>H((async(t,r)=>await e(r)?t.concat([r]):t),[],t,r))),Q=o((async(e,t)=>{const r=await G(e,t);return(await Promise.all(r)).some((e=>e))})),X=o((async(e,t)=>{const r=await G(e,t);return(await Promise.all(r)).every((e=>e))})),Y=o(((e,t)=>e.reduce((async(e,t)=>t(await e)),t))),ee={entries:J,map:G,filter:W,reduce:H,some:Q,every:X,pipeline:Y,all:e=>Promise.all(e),allValues:e=>Y([J,H((async(e,[t,r])=>(e[t]=await r,e)),{})],e)};ee.entries,ee.map,ee.filter,ee.reduce,ee.some,ee.every,ee.pipeline,ee.all,ee.allValues;var te=fetch;const{jsonTypeOf:re,splitUrl:ne,safeResolveUrl:oe}=f,ae={},ie={},se=(e,t)=>{const r=e in ie?ie[e]:e;if(r in ae)return ae[r][t]},ce={},le={},ue=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=ne(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=se(n,"baseToken"),a=se(n,"anchorToken"),i=ne(t)[0];if(!i&&!ne(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const s=oe(i,e[o]||""),[c,l]=ne(s);delete e[o],l&&o===a&&(e[a]=a!==o?encodeURI(l):`#${encodeURI(l)}`),i&&(le[i]=c);const u={},f=se(n,"recursiveAnchorToken");let p;!0===e[f]&&(u[""]=`${c}#`,e[a]="",delete e[f]);const d=se(n,"vocabularyToken");re(e[d],"object")?(ie[c]=n,p=e[d],delete e[d]):(ie[c]=n,p={[n]:!0});const y={"":""};return ce[c]={id:c,schemaVersion:n,schema:fe(e,c,n,E.nil,y,u),anchors:y,dynamicAnchors:u,vocabulary:p,validated:!1},c},fe=(e,t,r,n,o,a)=>{if(re(e,"object")){const i="string"==typeof e.$schema?ne(e.$schema)[0]:r,s=se(i,"embeddedToken"),c=se(i,"anchorToken");if("string"==typeof e[s]&&(s!==c||"#"!==e[s][0])){const n=oe(t,e[s]);return e[s]=n,ue(e,n,r),A.cons(e[s],e)}const l=se(r,"anchorToken"),u=se(r,"dynamicAnchorToken");"string"==typeof e[u]&&(a[e[u]]=`${t}#${encodeURI(n)}`,o[e[u]]=n,delete e[u]);const f=se(r,"embeddedToken");if("string"==typeof e[l]){const t=l!==f?e[l]:e[l].slice(1);o[t]=n,delete e[l]}const p=se(r,"jrefToken");if("string"==typeof e[p])return A.cons(e[p],e);for(const i in e)e[i]=fe(e[i],t,r,E.append(i,n),o,a);return e}return Array.isArray(e)?e.map(((e,i)=>fe(e,t,r,E.append(i,n),o,a))):e},pe=e=>ce[le[e]]||ce[e],de=Object.freeze({id:"",schemaVersion:void 0,vocabulary:{},pointer:E.nil,schema:void 0,value:void 0,anchors:{},dynamicAnchors:{},validated:!0}),ye=async(e,t=de)=>{const r=oe(me(t),e),[n,o]=ne(r);if(!(e=>e in ce||e in le)(n)){const e=await te(n,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error(`Failed to retrieve schema with id: ${n}`);if(e.headers.has("content-type")){const t=M.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${n} is not a schema. Found a document with media type: ${t}`)}ue(await e.json(),n)}const a=pe(n),i="/"!==o[0]?ve(a,o):o,s=Object.freeze({...a,pointer:i,value:E.get(i,a.schema)});return he(s)},he=e=>A.isReference(e.value)?ye(A.href(e.value),e):e,ve=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},me=e=>`${e.id}#${encodeURI(e.pointer)}`,be=e=>A.isReference(e.value)?A.value(e.value):e.value,we=(e,t)=>{const r=pe(t.id),n=Object.freeze({...t,pointer:E.append(e,t.pointer),value:be(t)[e],validated:r.validated});return he(n)},ge=o(((e,t)=>ee.pipeline([be,ee.map((async(r,n)=>e(await we(n,t),n))),ee.all],t)));var Oe={setConfig:(e,t,r)=>{ae[e]||(ae[e]={}),ae[e][t]=r},getConfig:se,add:ue,get:ye,markValidated:e=>{ce[e].validated=!0},uri:me,value:be,getAnchorPointer:ve,typeOf:(e,t)=>re(be(e),t),has:(e,t)=>e in be(t),step:we,keys:e=>Object.keys(be(e)),entries:e=>ee.pipeline([be,Object.keys,ee.map((async t=>[t,await we(t,e)])),ee.all],e),map:ge,length:e=>be(e).length};Oe.setConfig,Oe.getConfig,Oe.add,Oe.get,Oe.markValidated,Oe.uri,Oe.value,Oe.getAnchorPointer,Oe.typeOf,Oe.has,Oe.step,Oe.keys,Oe.entries,Oe.map,Oe.length;class je extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var Ee=je;const{splitUrl:$e}=f,Se="FLAG",Ae="BASIC",Ie="DETAILED",Te="VERBOSE";let ke=Ie,xe=!0;const Pe=async e=>{const t={metaData:{}};return{ast:t,schemaUri:await _e(e,t)}},Ve=o((({ast:e,schemaUri:t},r,n=Se)=>{if(![Se,Ae,Ie,Te].includes(n))throw Error(`The '${n}' error format is not supported`);const o=[],a=s.subscribe("result",Re(n,o));return Ne(t,r,e,{}),s.unsubscribe(a),o[0]})),Re=(e,t)=>{const r=[];return(n,o)=>{if("result"===n){const{keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:a}=o,i={keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:a,errors:[]};r.push(i)}else if("result.start"===n)r.push(n);else if("result.end"===n){const n=r.pop();for(;"result.start"!==r[r.length-1];){const t=r.pop(),o=[t];e===Ae&&(o.push(...t.errors),delete t.errors),(e===Te||e!==Se&&!t.valid)&&n.errors.unshift(...o)}r[r.length-1]=n,t[0]=n}}},Ue={},Ce=e=>Ue[e],Ke=e=>e in Ue,Le={},ze={},_e=async(e,t)=>{if(e=await De(e),!Ke(`${e.schemaVersion}#validate`)){const t=await Oe.get(e.schemaVersion);(Oe.getConfig(t.id,"mandatoryVocabularies")||[]).forEach((e=>{if(!t.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)})),Object.entries(t.vocabulary).forEach((([e,r])=>{if(e in Le)Object.entries(Le[e]).forEach((([e,r])=>{((e,t)=>{Ue[e]={collectEvaluatedItems:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&new Set,collectEvaluatedProperties:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&[],...t}})(`${t.id}#${e}`,r)}));else if(r)throw Error(`Missing required vocabulary: ${e}`)}))}if(xe&&!e.validated){if(Oe.markValidated(e.id),!(e.schemaVersion in ze)){const t=await Oe.get(e.schemaVersion),r=await Pe(t);ze[t.id]=Ve(r)}const t=L.cons(e.schema,e.id),r=ze[e.schemaVersion](t,ke);if(!r.valid)throw new Ee(r)}return e.id in t.metaData||(t.metaData[e.id]={id:e.id,dynamicAnchors:e.dynamicAnchors,anchors:e.anchors}),Ce(`${e.schemaVersion}#validate`).compile(e,t)},De=async e=>Oe.typeOf(e,"string")?De(await Oe.get(Oe.value(e),e)):e,Ne=(e,t,r,n)=>{const o=qe(e,r),a=$e(e)[0];return Ce(o).interpret(e,t,r,{...r.metaData[a].dynamicAnchors,...n})},qe=(e,t)=>{if(!(e in t))throw Error(`No schema found at ${e}`);return t[e][0]};var Be={validate:async(e,t,r)=>{const n=await Pe(e),o=(e,t)=>Ve(n,L.cons(e),t);return void 0===t?o:o(t,r)},compile:Pe,interpret:Ve,setMetaOutputFormat:e=>{ke=e},setShouldMetaValidate:e=>{xe=e},FLAG:Se,BASIC:Ae,DETAILED:Ie,VERBOSE:Te,add:(e,t="",r="")=>{const n=Oe.add(e,t,r);delete ze[n]},getKeyword:Ce,hasKeyword:Ke,defineVocabulary:(e,t)=>{Le[e]=t},compileSchema:_e,interpretSchema:Ne,collectEvaluatedProperties:(e,t,r,n,o)=>{const a=qe(e,r);return Ce(a).collectEvaluatedProperties(e,t,r,n,o)},collectEvaluatedItems:(e,t,r,n,o)=>{const a=qe(e,r);return Ce(a).collectEvaluatedItems(e,t,r,n,o)}};var Fe={compile:e=>Oe.value(e),interpret:()=>!0};var Ze={compile:async(e,t)=>{const r=Oe.uri(e);if(!(r in t)){t[r]=!1;const n=Oe.value(e);if(!["object","boolean"].includes(typeof n))throw Error(`No schema found at '${Oe.uri(e)}'`);t[r]=[`${e.schemaVersion}#validate`,Oe.uri(e),"boolean"==typeof n?n:await ee.pipeline([Oe.entries,ee.map((([t,r])=>[`${e.schemaVersion}#${t}`,r])),ee.filter((([t])=>Be.hasKeyword(t)&&t!==`${e.schemaVersion}#validate`)),ee.map((async([r,n])=>{const o=await Be.getKeyword(r).compile(n,t,e);return[r,Oe.uri(n),o]})),ee.all],e)]}return r},interpret:(e,t,r,n)=>{const[o,a,i]=r[e];s.publishSync("result.start");const c="boolean"==typeof i?i:i.every((([e,o,a])=>{s.publishSync("result.start");const i=Be.getKeyword(e).interpret(a,t,r,n);return s.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:L.uri(t),valid:i,ast:a}),s.publishSync("result.end"),i}));return s.publishSync("result",{keyword:o,absoluteKeywordLocation:a,instanceLocation:L.uri(t),valid:c,ast:e}),s.publishSync("result.end"),c},collectEvaluatedProperties:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&[]:a.filter((([e])=>!o||!e.endsWith("#unevaluatedProperties"))).reduce(((e,[o,,a])=>{const i=e&&Be.getKeyword(o).collectEvaluatedProperties(a,t,r,n);return!1!==i&&[...e,...i]}),[])},collectEvaluatedItems:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&new Set:a.filter((([e])=>!o||!e.endsWith("#unevaluatedItems"))).reduce(((e,[o,,a])=>{const i=!1!==e&&Be.getKeyword(o).collectEvaluatedItems(a,t,r,n);return!1!==i&&new Set([...e,...i])}),new Set)}},Me={metaData:Fe,validate:Ze},Je={Core:Be,Schema:Oe,Instance:L,Reference:A,Keywords:Me,InvalidSchemaError:Ee},Ge=Je.Core,He=Je.Schema,We=Je.Instance,Qe=Je.Reference,Xe=Je.Keywords,Ye=Je.InvalidSchemaError;e.Core=Ge,e.Instance=We,e.InvalidSchemaError=Ye,e.Keywords=Xe,e.Reference=Qe,e.Schema=He,e.default=Je,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=json-schema-core-amd.min.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}Object.defineProperty(exports,"__esModule",{value:!0});var t=e(require("url")),r=function(e,t){return function r(){null==t&&(t=e.length);var n=[].slice.call(arguments);return n.length>=t?e.apply(this,n):function(){return r.apply(this,n.concat([].slice.call(arguments)))}}};var n="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var o,a=(function(e,t){var r;r={},("object"==typeof window&&window||n).PubSub=r,function(e){var t={},r=-1,n="*";function o(e){var t;for(t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function a(e){return function(){throw e}}function i(e,t,r){try{e(t,r)}catch(e){setTimeout(a(e),0)}}function s(e,t,r){e(t,r)}function u(e,r,n,o){var a,u=t[r],l=o?s:i;if(Object.prototype.hasOwnProperty.call(t,r))for(a in u)Object.prototype.hasOwnProperty.call(u,a)&&l(u[a],e,n)}function l(e,t,r){return function(){var o=String(e),a=o.lastIndexOf(".");for(u(e,e,t,r);-1!==a;)a=(o=o.substr(0,a)).lastIndexOf("."),u(e,o,t,r);u(e,n,t,r)}}function c(e){var r=String(e);return Boolean(Object.prototype.hasOwnProperty.call(t,r)&&o(t[r]))}function f(e){for(var t=String(e),r=c(t)||c(n),o=t.lastIndexOf(".");!r&&-1!==o;)o=(t=t.substr(0,o)).lastIndexOf("."),r=c(t);return r}function h(e,t,r,n){var o=l(e="symbol"==typeof e?e.toString():e,t,n);return!!f(e)&&(!0===r?o():setTimeout(o,0),!0)}e.publish=function(t,r){return h(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return h(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,Object.prototype.hasOwnProperty.call(t,e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeAll=function(t){return e.subscribe(n,t)},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n,o=0;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)){for(n in t[r])o++;break}return o},e.getSubscriptions=function(e){var r,n=[];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,a,i=function(e){var r;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e))return!0;return!1},s="string"==typeof r&&(Object.prototype.hasOwnProperty.call(t,r)||i(r)),u=!s&&"string"==typeof r,l="function"==typeof r,c=!1;if(!s){for(n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(o=t[n],u&&o[r]){delete o[r],c=r;break}if(l)for(a in o)Object.prototype.hasOwnProperty.call(o,a)&&o[a]===r&&(delete o[a],c=!0)}return c}e.clearSubscriptions(r)}}(r),void 0!==e&&e.exports&&(t=e.exports=r),t.PubSub=r,e.exports=t=r}(o={exports:{}},o.exports),o.exports);a.PubSub;var i=function(e,t){if(e=e.trim(),(t=t.trim()).startsWith("about:"))return t;const r=function(e){const t={host:"",path:"",query:"",protocol:""};let r=e,n=e.indexOf("//");t.protocol=r.substring(0,n),n+=2;const o=e.indexOf("/",n),a=e.indexOf("?"),i=e.indexOf("#");-1!==i&&(r=r.substring(0,i));if(-1!==a){const e=r.substring(a);t.query=e,r=r.substring(0,a)}if(-1!==o){const e=r.substring(0,o);t.host=e,r=r.substring(o),t.path=r}else t.host=r;return t}(e),n=function(e){const t={href:e,hash:"",query:"",netPath:!1,absolutePath:!1,relativePath:!1};if(l.test(e))return t.netPath=!0,t;"/"===e[0]?t.absolutePath=!0:""!==e&&(t.relativePath=!0);let r=e;const n=e.indexOf("?"),o=e.indexOf("#");if(-1!==o){const e=r.substring(o);t.hash=e,r=r.substring(0,o)}if(-1!==n){const e=r.substring(n);t.query=e,r=r.substring(0,n)}return t.path=r,t}(t);if(!r.protocol&&!n.netPath)throw new Error("Error, protocol is not specified");if(n.netPath)return function(e){return e.startsWith("//")}(n.href)&&(n.href=r.protocol+n.href),function(e){const t=e.indexOf("//")+2,r=!e.includes("/",t),n=!e.includes("?",t),o=!e.includes("#",t);return r&&n&&o}(n.href)?s(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+u(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let a,i=r.path,s=r.host;return 0===e.length?a=i:(i=i.substring(0,i.lastIndexOf("/")),a=u(i+"/"+e)),s+=""!==a||t||o?a+t+o:"/",s}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:s(e)}};function s(e){return e+("/"===e[e.length-1]?"":"/")}function u(e){let t=e.split("/");""===t[0]&&(t=t.slice(1));let r=[];return t.forEach(((e,n)=>{"."!==e&&(".."===e?r.pop():""===e&&n!==t.length-1||r.push(e))})),"/"+r.join("/")}const l=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");const c={null:e=>null===e,boolean:e=>"boolean"==typeof e,object:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,array:e=>Array.isArray(e),number:e=>"number"==typeof e,integer:e=>Number.isInteger(e),string:e=>"string"==typeof e},f=e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),o=e.slice(r+1);return[decodeURI(n),decodeURI(o)]},h=e=>{const t=RegExp(/^(.+):\/\//).exec(e);return t?t[1]:""};var m={jsonTypeOf:(e,t)=>c[t](e),splitUrl:f,safeResolveUrl:(e,t)=>{const r=i(e,t),n=f(e)[0];if(n&&"file"===h(r)&&"file"!==h(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r}};const p=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(w)},d=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:d(e,E(t,o,n),r,g(o,n))}}if(Array.isArray(t)){const n=[...t];return n[O(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:E(t,e[0],n)},y=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||I(t)){const o=e.shift();y(e,E(t,o,n),r,g(o,n))}else{t[O(t,e[0])]=r}},v=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=E(t,n,r);return{...t,[n]:v(e,o,g(n,r))}}if(Array.isArray(t))return t.filter(((t,r)=>r!=e[0]));if("object"==typeof t&&null!==t){const{[e[0]]:r,...n}=t;return n}return E(t,e[0],r)}},b=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=E(t,n,r);b(e,o,g(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:E(t,e[0],r)},g=r(((e,t)=>t+"/"+x(e))),x=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),w=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),O=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,E=(e,t,r="")=>{if(void 0===e)throw TypeError(`Value at '${r}' is undefined and does not have property '${t}'`);if(null===e)throw TypeError(`Value at '${r}' is null and does not have property '${t}'`);if(I(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[O(e,t)]},I=e=>null===e||"object"!=typeof e;var S={nil:"",append:g,get:(e,t)=>{const r=p(e),n=e=>r.reduce((([e,t],r)=>[E(e,r,t),g(r,t)]),[e,""])[0];return void 0===t?n:n(t)},set:(e,t,n)=>{const o=p(e),a=r(((e,t)=>d(o,e,t,"")));return void 0===t?a:a(t,n)},assign:(e,t,n)=>{const o=p(e),a=r(((e,t)=>y(o,e,t,"")));return void 0===t?a:a(t,n)},unset:(e,t)=>{const r=p(e),n=e=>v(r,e,"");return void 0===t?n:n(t)},remove:(e,t)=>{const r=p(e),n=e=>b(r,e,"");return void 0===t?n:n(t)}};S.nil,S.append,S.get,S.set,S.assign,S.unset,S.remove;const j=Symbol("$__value"),P=Symbol("$__href");var A={cons:(e,t)=>Object.freeze({[P]:e,[j]:t}),isReference:e=>e&&void 0!==e[P],href:e=>e[P],value:e=>e[j]};const{jsonTypeOf:T}=m,R=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),$=e=>A.isReference(e.value)?A.value(e.value):e.value,V=r(((e,t)=>T($(e),t))),k=(e,t)=>Object.freeze({...t,pointer:S.append(e,t.pointer),value:$(t)[e]}),L=r(((e,t)=>$(t).map(((r,n,o,a)=>e(k(n,t),n,o,a))))),H=r(((e,t)=>$(t).map(((e,r,n,o)=>k(r,t))).filter(((t,r,n,o)=>e(t,r,n,o))))),U=r(((e,t,r)=>$(r).reduce(((t,n,o)=>e(t,k(o,r),o)),t))),q=r(((e,t)=>$(t).every(((r,n,o,a)=>e(k(n,t),n,o,a))))),D=r(((e,t)=>$(t).some(((r,n,o,a)=>e(k(n,t),n,o,a)))));var _={nil:R,cons:(e,t="")=>Object.freeze({...R,id:t,instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:$,has:(e,t)=>e in $(t),typeOf:V,step:k,entries:e=>Object.keys($(e)).map((t=>[t,k(t,e)])),keys:e=>Object.keys($(e)),map:L,filter:H,reduce:U,every:q,some:D,length:e=>$(e).length},Q=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,C=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,z=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,B=/\\([\u000b\u0020-\u00ff])/g,K=/([\\"])/g,N=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function M(e){var t=String(e);if(z.test(t))return t;if(t.length>0&&!C.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(K,"\\$1")+'"'}function F(e){this.parameters=Object.create(null),this.type=e}var J={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!N.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,a=Object.keys(t).sort(),i=0;i<a.length;i++){if(o=a[i],!z.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+M(t[o])}return n},parse:function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;"function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.substr(0,r).trim():t.trim();if(!N.test(n))throw new TypeError("invalid media type");var o=new F(n.toLowerCase());if(-1!==r){var a,i,s;for(Q.lastIndex=r;i=Q.exec(t);){if(i.index!==r)throw new TypeError("invalid parameter format");r+=i[0].length,a=i[1].toLowerCase(),'"'===(s=i[2])[0]&&(s=s.substr(1,s.length-2).replace(B,"$1")),o.parameters[a]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},W=async e=>Object.entries(await e),Z=r((async(e,t)=>(await t).map(e))),G=r((async(e,t,r)=>(await r).reduce((async(t,r)=>e(await t,r)),t))),X=r((async(e,t,r={})=>G((async(t,r)=>await e(r)?t.concat([r]):t),[],t,r))),Y=r((async(e,t)=>{const r=await Z(e,t);return(await Promise.all(r)).some((e=>e))})),ee=r((async(e,t)=>{const r=await Z(e,t);return(await Promise.all(r)).every((e=>e))})),te=r(((e,t)=>e.reduce((async(e,t)=>t(await e)),t))),re={entries:W,map:Z,filter:X,reduce:G,some:Y,every:ee,pipeline:te,all:e=>Promise.all(e),allValues:e=>te([W,G((async(e,[t,r])=>(e[t]=await r,e)),{})],e)};re.entries,re.map,re.filter,re.reduce,re.some,re.every,re.pipeline,re.all,re.allValues;var ne={ABSOLUTE:"absolute",PATH_RELATIVE:"pathRelative",ROOT_RELATIVE:"rootRelative",SHORTEST:"shortest"};function oe(e,t){var r=t.removeEmptyQueries&&e.extra.relation.minimumPort;return e.query.string[r?"stripped":"full"]}function ae(e,t){return!e.extra.relation.minimumQuery||t.output===ne.ABSOLUTE||t.output===ne.ROOT_RELATIVE}function ie(e,t){var r=t.removeDirectoryIndexes&&e.extra.resourceIsIndex,n=e.extra.relation.minimumResource&&t.output!==ne.ABSOLUTE&&t.output!==ne.ROOT_RELATIVE;return!!e.resource&&!n&&!r}var se=function(e,t){var r="";return r+=function(e,t){var r="";return(e.extra.relation.maximumHost||t.output===ne.ABSOLUTE)&&(e.extra.relation.minimumScheme&&t.schemeRelative&&t.output!==ne.ABSOLUTE?r+="//":r+=e.scheme+"://"),r}(e,t),r+=function(e,t){return!e.auth||t.removeAuth||!e.extra.relation.maximumHost&&t.output!==ne.ABSOLUTE?"":e.auth+"@"}(e,t),r+=function(e,t){return e.host.full&&(e.extra.relation.maximumAuth||t.output===ne.ABSOLUTE)?e.host.full:""}(e,t),r+=function(e,t){return e.port&&!e.extra.portIsDefault&&e.extra.relation.maximumHost?":"+e.port:""}(e),r+=function(e,t){var r="",n=e.path.absolute.string,o=e.path.relative.string,a=ie(e,t);if(e.extra.relation.maximumHost||t.output===ne.ABSOLUTE||t.output===ne.ROOT_RELATIVE)r=n;else if(o.length<=n.length&&t.output===ne.SHORTEST||t.output===ne.PATH_RELATIVE){if(""===(r=o)){var i=ae(e,t)&&!!oe(e,t);e.extra.relation.maximumPath&&!a?r="./":!e.extra.relation.overridesQuery||a||i||(r="./")}}else r=n;return"/"!==r||a||!t.removeRootTrailingSlash||e.extra.relation.minimumPort&&t.output!==ne.ABSOLUTE||(r=""),r}(e,t),r+=function(e,t){return ie(e,t)?e.resource:""}(e,t),r+=function(e,t){return ae(e,t)?oe(e,t):""}(e,t),r+=function(e,t){return e.hash?e.hash:""}(e)};var ue={clone:function e(t){if(t instanceof Object){var r=t instanceof Array?[]:{};for(var n in t)t.hasOwnProperty(n)&&(r[n]=e(t[n]));return r}return t},isPlainObject:function(e){return!!e&&"object"==typeof e&&e.constructor===Object},shallowMerge:function(e,t){if(e instanceof Object&&t instanceof Object)for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e}};function le(e,t){return t instanceof Object&&e instanceof Object?t instanceof Array&&e instanceof Array?t.concat(e):ue.shallowMerge(e,t):e}var ce=function(e,t){if(ue.isPlainObject(e)){var r={};for(var n in t)t.hasOwnProperty(n)&&(void 0!==e[n]?r[n]=le(e[n],t[n]):r[n]=t[n]);return r}return t};var fe=function(e){var t=!(e.scheme||e.auth||e.host.full||e.port),r=t&&!e.path.absolute.string,n=r&&!e.resource,o=n&&!e.query.string.full.length,a=o&&!e.hash;e.extra.hrefInfo.minimumPathOnly=t,e.extra.hrefInfo.minimumResourceOnly=r,e.extra.hrefInfo.minimumQueryOnly=n,e.extra.hrefInfo.minimumHashOnly=o,e.extra.hrefInfo.empty=a};var he=function(e,t){if(t.ignore_www){var r=e.host.full;if(r){var n=r;0===r.indexOf("www.")&&(n=r.substr(4)),e.host.stripped=n}}};function me(e){if("/"!==e){var t=[];return e.split("/").forEach((function(e){""!==e&&t.push(e)})),t}return[]}var pe=function(e,t){var r=e.path.absolute.string;if(r){var n=r.lastIndexOf("/");if(n>-1){if(++n<r.length){var o=r.substr(n);"."!==o&&".."!==o?(e.resource=o,r=r.substr(0,n)):r+="/"}e.path.absolute.string=r,e.path.absolute.array=me(r)}else"."===r||".."===r?(r+="/",e.path.absolute.string=r,e.path.absolute.array=me(r)):(e.resource=r,e.path.absolute.string=null);e.extra.resourceIsIndex=function(e,t){var r=!1;return t.directoryIndexes.every((function(t){return t!==e||(r=!0,!1)})),r}(e.resource,t)}};var de=function(e,t){var r=-1;for(var n in t.defaultPorts)if(n===e.scheme&&t.defaultPorts.hasOwnProperty(n)){r=t.defaultPorts[n];break}r>-1&&(r=r.toString(),null===e.port&&(e.port=r),e.extra.portIsDefault=e.port===r)},ye=Object.prototype.hasOwnProperty;function ve(e,t){var r=0,n="";for(var o in e)if(""!==o&&!0===ye.call(e,o)){var a=e[o];""===a&&t||(n+=1==++r?"?":"&",o=encodeURIComponent(o),n+=""!==a?o+"="+encodeURIComponent(a).replace(/%20/g,"+"):o)}return n}var be=function(e,t){e.query.string.full=ve(e.query.object,!1),t.removeEmptyQueries&&(e.query.string.stripped=ve(e.query.object,!0))},ge=t.default.parse;var xe=function(e,t){return function(e,t){var r=!0;return t.rejectedSchemes.every((function(t){return r=!(0===e.indexOf(t+":"))})),r}(e,t)?(r=ge(e,!0,t.slashesDenoteHost),(n=r.protocol)&&n.indexOf(":")===n.length-1&&(n=n.substr(0,n.length-1)),r.host={full:r.hostname,stripped:null},r.path={absolute:{array:null,string:r.pathname},relative:{array:null,string:null}},r.query={object:r.query,string:{full:null,stripped:null}},r.extra={hrefInfo:{minimumPathOnly:null,minimumResourceOnly:null,minimumQueryOnly:null,minimumHashOnly:null,empty:null,separatorOnlyQuery:"?"===r.search},portIsDefault:null,relation:{maximumScheme:null,maximumAuth:null,maximumHost:null,maximumPort:null,maximumPath:null,maximumResource:null,maximumQuery:null,maximumHash:null,minimumScheme:null,minimumAuth:null,minimumHost:null,minimumPort:null,minimumPath:null,minimumResource:null,minimumQuery:null,minimumHash:null,overridesQuery:null},resourceIsIndex:null,slashes:r.slashes},r.resource=null,r.scheme=n,delete r.hostname,delete r.pathname,delete r.protocol,delete r.search,delete r.slashes,r):{href:e,valid:!1};var r,n};var we={join:function(e){return e.length>0?e.join("/")+"/":""},resolveDotSegments:function(e){var t=[];return e.forEach((function(e){".."!==e?"."!==e&&t.push(e):t.length>0&&t.splice(t.length-1,1)})),t}};function Oe(e,t){var r=xe(e,t);return!1===r.valid||(he(r,t),de(r,t),pe(r,t),be(r,t),fe(r)),r}var Ee={from:function(e,t,r){if(e){var n=Oe(e,t),o=we.resolveDotSegments(n.path.absolute.array);return n.path.absolute.array=o,n.path.absolute.string="/"+we.join(o),n}return r},to:Oe};var Ie={pathOn:function(e,t,r){var n=e.extra.hrefInfo.minimumQueryOnly,o=e.extra.hrefInfo.minimumHashOnly,a=e.extra.hrefInfo.empty,i=e.extra.relation.minimumPort,s=e.extra.relation.minimumScheme,u=i&&e.path.absolute.string===t.path.absolute.string,l=e.resource===t.resource||!e.resource&&t.extra.resourceIsIndex||r.removeDirectoryIndexes&&e.extra.resourceIsIndex&&!t.resource,c=u&&(l||n||o||a),f=r.removeEmptyQueries?"stripped":"full",h=e.query.string[f],m=t.query.string[f],p=c&&!!h&&h===m||(o||a)&&!e.extra.hrefInfo.separatorOnlyQuery,d=p&&e.hash===t.hash;e.extra.relation.minimumPath=u,e.extra.relation.minimumResource=c,e.extra.relation.minimumQuery=p,e.extra.relation.minimumHash=d,e.extra.relation.maximumPort=!s||s&&!u,e.extra.relation.maximumPath=!s||s&&!c,e.extra.relation.maximumResource=!s||s&&!p,e.extra.relation.maximumQuery=!s||s&&!d,e.extra.relation.maximumHash=!s||s&&!d,e.extra.relation.overridesQuery=u&&e.extra.relation.maximumResource&&!p&&!!m},upToPath:function(e,t,r){var n=e.extra.hrefInfo.minimumPathOnly,o=e.scheme===t.scheme||!e.scheme,a=o&&(e.auth===t.auth||r.removeAuth||n),i=r.ignore_www?"stripped":"full",s=a&&(e.host[i]===t.host[i]||n),u=s&&(e.port===t.port||n);e.extra.relation.minimumScheme=o,e.extra.relation.minimumAuth=a,e.extra.relation.minimumHost=s,e.extra.relation.minimumPort=u,e.extra.relation.maximumScheme=!o||o&&!a,e.extra.relation.maximumAuth=!o||o&&!s,e.extra.relation.maximumHost=!o||o&&!u}};var Se=function(e,t,r){Ie.upToPath(e,t,r),e.extra.relation.minimumScheme&&(e.scheme=t.scheme),e.extra.relation.minimumAuth&&(e.auth=t.auth),e.extra.relation.minimumHost&&(e.host=ue.clone(t.host)),e.extra.relation.minimumPort&&function(e,t){e.port=t.port,e.extra.portIsDefault=t.extra.portIsDefault}(e,t),e.extra.relation.minimumScheme&&function(e,t){if(e.extra.relation.maximumHost||!e.extra.hrefInfo.minimumResourceOnly){var r=e.path.absolute.array,n="/";r?(e.extra.hrefInfo.minimumPathOnly&&0!==e.path.absolute.string.indexOf("/")&&(r=t.path.absolute.array.concat(r)),r=we.resolveDotSegments(r),n+=we.join(r)):r=[],e.path.absolute.array=r,e.path.absolute.string=n}else e.path=ue.clone(t.path)}(e,t),Ie.pathOn(e,t,r),e.extra.relation.minimumResource&&function(e,t){e.resource=t.resource,e.extra.resourceIsIndex=t.extra.resourceIsIndex}(e,t),e.extra.relation.minimumQuery&&(e.query=ue.clone(t.query)),e.extra.relation.minimumHash&&(e.hash=t.hash)};var je=function(e,t,r){if(e.extra.relation.minimumScheme){var n=(o=e.path.absolute.array,a=t.path.absolute.array,i=[],s=!0,u=-1,a.forEach((function(e,t){s&&(o[t]!==e?s=!1:u=t),s||i.push("..")})),o.forEach((function(e,t){t>u&&i.push(e)})),i);e.path.relative.array=n,e.path.relative.string=we.join(n)}var o,a,i,s,u};var Pe=function(e,t,r){return Se(t,e,r),je(t,e),t};function Ae(e,t){this.options=ce(t,{defaultPorts:{ftp:21,http:80,https:443},directoryIndexes:["index.html"],ignore_www:!1,output:Ae.SHORTEST,rejectedSchemes:["data","javascript","mailto"],removeAuth:!1,removeDirectoryIndexes:!0,removeEmptyQueries:!1,removeRootTrailingSlash:!0,schemeRelative:!0,site:void 0,slashesDenoteHost:!0}),this.from=Ee.from(e,this.options,null)}Ae.prototype.relate=function(e,t,r){if(ue.isPlainObject(t)?(r=t,t=e,e=null):t||(t=e,e=null),r=ce(r,this.options),e=e||r.site,!(e=Ee.from(e,r,this.from))||!e.href)throw new Error("from value not defined.");if(e.extra.hrefInfo.minimumPathOnly)throw new Error("from value supplied is not absolute: "+e.href);return!1===(t=Ee.to(t,r)).valid?t.href:(t=Pe(e,t,r),t=se(t,r))},Ae.relate=function(e,t,r){return(new Ae).relate(e,t,r)},ue.shallowMerge(Ae,ne);var Te=Ae,Re=fetch;const{jsonTypeOf:$e,splitUrl:Ve,safeResolveUrl:ke}=m,Le={},He={},Ue=(e,t)=>{const r=e in He?He[e]:e;if(r in Le)return Le[r][t]},qe={},De={},_e=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=Ve(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=Ue(n,"baseToken"),a=Ue(n,"anchorToken"),i=Ve(t)[0];if(!i&&!Ve(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const s=ke(i,e[o]||""),[u,l]=Ve(s);delete e[o],l&&o===a&&(e[a]=a!==o?encodeURI(l):`#${encodeURI(l)}`),i&&(De[i]=u);const c={},f=Ue(n,"recursiveAnchorToken");let h;!0===e[f]&&(c[""]=`${u}#`,e[a]="",delete e[f]);const m=Ue(n,"vocabularyToken");$e(e[m],"object")?(He[u]=n,h=e[m],delete e[m]):(He[u]=n,h={[n]:!0});const p={"":""};return qe[u]={id:u,schemaVersion:n,schema:Qe(e,u,n,S.nil,p,c),anchors:p,dynamicAnchors:c,vocabulary:h,validated:!1},u},Qe=(e,t,r,n,o,a)=>{if($e(e,"object")){const i="string"==typeof e.$schema?Ve(e.$schema)[0]:r,s=Ue(i,"embeddedToken"),u=Ue(i,"anchorToken");if("string"==typeof e[s]&&(s!==u||"#"!==e[s][0])){const n=ke(t,e[s]);return e[s]=n,_e(e,n,r),A.cons(e[s],e)}const l=Ue(r,"anchorToken"),c=Ue(r,"dynamicAnchorToken");"string"==typeof e[c]&&(a[e[c]]=`${t}#${encodeURI(n)}`,o[e[c]]=n,delete e[c]);const f=Ue(r,"embeddedToken");if("string"==typeof e[l]){const t=l!==f?e[l]:e[l].slice(1);o[t]=n,delete e[l]}const h=Ue(r,"jrefToken");if("string"==typeof e[h])return A.cons(e[h],e);for(const i in e)e[i]=Qe(e[i],t,r,S.append(i,n),o,a);return e}return Array.isArray(e)?e.map(((e,i)=>Qe(e,t,r,S.append(i,n),o,a))):e},Ce=e=>qe[De[e]]||qe[e],ze=Object.freeze({id:"",schemaVersion:void 0,vocabulary:{},pointer:S.nil,schema:void 0,value:void 0,anchors:{},dynamicAnchors:{},validated:!0}),Be=async(e,t=ze)=>{const r=ke(Me(t),e),[n,o]=Ve(r);if(!(e=>e in qe||e in De)(n)){const e=await Re(n,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error(`Failed to retrieve schema with id: ${n}`);if(e.headers.has("content-type")){const t=J.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${n} is not a schema. Found a document with media type: ${t}`)}_e(await e.json(),n)}const a=Ce(n),i="/"!==o[0]?Ne(a,o):o,s=Object.freeze({...a,pointer:i,value:S.get(i,a.schema)});return Ke(s)},Ke=e=>A.isReference(e.value)?Be(A.href(e.value),e):e,Ne=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},Me=e=>`${e.id}#${encodeURI(e.pointer)}`,Fe=e=>A.isReference(e.value)?A.value(e.value):e.value,Je=(e,t)=>{const r=Ce(t.id),n=Object.freeze({...t,pointer:S.append(e,t.pointer),value:Fe(t)[e],validated:r.validated});return Ke(n)},We=r(((e,t)=>re.pipeline([Fe,re.map((async(r,n)=>e(await Je(n,t),n))),re.all],t))),Ze={parentId:"",parentDialect:"",includeEmbedded:!0},Ge=(e,t)=>t.startsWith("file://")?""===e?"":Te.relate(e,t):t;var Xe={setConfig:(e,t,r)=>{Le[e]||(Le[e]={}),Le[e][t]=r},getConfig:Ue,add:_e,get:Be,markValidated:e=>{qe[e].validated=!0},uri:Me,value:Fe,getAnchorPointer:Ne,typeOf:(e,t)=>$e(Fe(e),t),has:(e,t)=>e in Fe(t),step:Je,keys:e=>Object.keys(Fe(e)),entries:e=>re.pipeline([Fe,Object.keys,re.map((async t=>[t,await Je(t,e)])),re.all],e),map:We,length:e=>Fe(e).length,toSchema:(e,t={})=>{const r={...Ze,...t},n=JSON.parse(JSON.stringify(e.schema,((t,n)=>{if(!A.isReference(n))return n;const o=A.value(n),a=o.$schema||e.schemaVersion,i=Ue(a,"embeddedToken");return!r.includeEmbedded&&i in o?void 0:A.value(n)}))),o=Ue(e.schemaVersion,"dynamicAnchorToken");Object.entries(e.dynamicAnchors).forEach((([e,t])=>{const r=Ve(t)[1];S.assign(r,n,{[o]:e,...S.get(r,n)})}));const a=Ue(e.schemaVersion,"anchorToken");Object.entries(e.anchors).filter((([e])=>""!==e)).forEach((([e,t])=>{S.assign(t,n,{[a]:e,...S.get(t,n)})}));const i=Ue(e.schemaVersion,"baseToken"),s=Ge(r.parentId,e.id),u=r.parentDialect===e.schemaVersion?"":e.schemaVersion;return{...s&&{[i]:s},...u&&{$schema:u},...n}}};Xe.setConfig,Xe.getConfig,Xe.add,Xe.get,Xe.markValidated,Xe.uri,Xe.value,Xe.getAnchorPointer,Xe.typeOf,Xe.has,Xe.step,Xe.keys,Xe.entries,Xe.map,Xe.length,Xe.toSchema;class Ye extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var et=Ye;const{splitUrl:tt}=m,rt="FLAG",nt="BASIC",ot="DETAILED",at="VERBOSE";let it=ot,st=!0;const ut=async e=>{const t={metaData:{}};return{ast:t,schemaUri:await yt(e,t)}},lt=r((({ast:e,schemaUri:t},r,n=rt)=>{if(![rt,nt,ot,at].includes(n))throw Error(`The '${n}' error format is not supported`);const o=[],i=a.subscribe("result",ct(n,o));return bt(t,r,e,{}),a.unsubscribe(i),o[0]})),ct=(e,t)=>{const r=[];return(n,o)=>{if("result"===n){const{keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:a}=o,i={keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:a,errors:[]};r.push(i)}else if("result.start"===n)r.push(n);else if("result.end"===n){const n=r.pop();for(;"result.start"!==r[r.length-1];){const t=r.pop(),o=[t];e===nt&&(o.push(...t.errors),delete t.errors),(e===at||e!==rt&&!t.valid)&&n.errors.unshift(...o)}r[r.length-1]=n,t[0]=n}}},ft={},ht=e=>ft[e],mt=e=>e in ft,pt={},dt={},yt=async(e,t)=>{if(e=await vt(e),!mt(`${e.schemaVersion}#validate`)){const t=await Xe.get(e.schemaVersion);(Xe.getConfig(t.id,"mandatoryVocabularies")||[]).forEach((e=>{if(!t.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)})),Object.entries(t.vocabulary).forEach((([e,r])=>{if(e in pt)Object.entries(pt[e]).forEach((([e,r])=>{((e,t)=>{ft[e]={collectEvaluatedItems:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&new Set,collectEvaluatedProperties:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&[],...t}})(`${t.id}#${e}`,r)}));else if(r)throw Error(`Missing required vocabulary: ${e}`)}))}if(st&&!e.validated){if(Xe.markValidated(e.id),!(e.schemaVersion in dt)){const t=await Xe.get(e.schemaVersion),r=await ut(t);dt[t.id]=lt(r)}const t=_.cons(e.schema,e.id),r=dt[e.schemaVersion](t,it);if(!r.valid)throw new et(r)}return e.id in t.metaData||(t.metaData[e.id]={id:e.id,dynamicAnchors:e.dynamicAnchors,anchors:e.anchors}),ht(`${e.schemaVersion}#validate`).compile(e,t)},vt=async e=>Xe.typeOf(e,"string")?vt(await Xe.get(Xe.value(e),e)):e,bt=(e,t,r,n)=>{const o=gt(e,r),a=tt(e)[0];return ht(o).interpret(e,t,r,{...r.metaData[a].dynamicAnchors,...n})},gt=(e,t)=>{if(!(e in t))throw Error(`No schema found at ${e}`);return t[e][0]};var xt={validate:async(e,t,r)=>{const n=await ut(e),o=(e,t)=>lt(n,_.cons(e),t);return void 0===t?o:o(t,r)},compile:ut,interpret:lt,setMetaOutputFormat:e=>{it=e},setShouldMetaValidate:e=>{st=e},FLAG:rt,BASIC:nt,DETAILED:ot,VERBOSE:at,add:(e,t="",r="")=>{const n=Xe.add(e,t,r);delete dt[n]},getKeyword:ht,hasKeyword:mt,defineVocabulary:(e,t)=>{pt[e]=t},compileSchema:yt,interpretSchema:bt,collectEvaluatedProperties:(e,t,r,n,o)=>{const a=gt(e,r);return ht(a).collectEvaluatedProperties(e,t,r,n,o)},collectEvaluatedItems:(e,t,r,n,o)=>{const a=gt(e,r);return ht(a).collectEvaluatedItems(e,t,r,n,o)}};var wt={compile:e=>Xe.value(e),interpret:()=>!0};var Ot={compile:async(e,t)=>{const r=Xe.uri(e);if(!(r in t)){t[r]=!1;const n=Xe.value(e);if(!["object","boolean"].includes(typeof n))throw Error(`No schema found at '${Xe.uri(e)}'`);t[r]=[`${e.schemaVersion}#validate`,Xe.uri(e),"boolean"==typeof n?n:await re.pipeline([Xe.entries,re.map((([t,r])=>[`${e.schemaVersion}#${t}`,r])),re.filter((([t])=>xt.hasKeyword(t)&&t!==`${e.schemaVersion}#validate`)),re.map((async([r,n])=>{const o=await xt.getKeyword(r).compile(n,t,e);return[r,Xe.uri(n),o]})),re.all],e)]}return r},interpret:(e,t,r,n)=>{const[o,i,s]=r[e];a.publishSync("result.start");const u="boolean"==typeof s?s:s.every((([e,o,i])=>{a.publishSync("result.start");const s=xt.getKeyword(e).interpret(i,t,r,n);return a.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:_.uri(t),valid:s,ast:i}),a.publishSync("result.end"),s}));return a.publishSync("result",{keyword:o,absoluteKeywordLocation:i,instanceLocation:_.uri(t),valid:u,ast:e}),a.publishSync("result.end"),u},collectEvaluatedProperties:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&[]:a.filter((([e])=>!o||!e.endsWith("#unevaluatedProperties"))).reduce(((e,[o,,a])=>{const i=e&&xt.getKeyword(o).collectEvaluatedProperties(a,t,r,n);return!1!==i&&[...e,...i]}),[])},collectEvaluatedItems:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&new Set:a.filter((([e])=>!o||!e.endsWith("#unevaluatedItems"))).reduce(((e,[o,,a])=>{const i=!1!==e&&xt.getKeyword(o).collectEvaluatedItems(a,t,r,n);return!1!==i&&new Set([...e,...i])}),new Set)}},Et={metaData:wt,validate:Ot},It={Core:xt,Schema:Xe,Instance:_,Reference:A,Keywords:Et,InvalidSchemaError:et},St=It.Core,jt=It.Schema,Pt=It.Instance,At=It.Reference,Tt=It.Keywords,Rt=It.InvalidSchemaError;exports.Core=St,exports.Instance=Pt,exports.InvalidSchemaError=Rt,exports.Keywords=Tt,exports.Reference=At,exports.Schema=jt,exports.default=It; | ||
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}Object.defineProperty(exports,"__esModule",{value:!0});var t=e(require("url-resolve-browser")),r=function(e,t){return function r(){null==t&&(t=e.length);var n=[].slice.call(arguments);return n.length>=t?e.apply(this,n):function(){return r.apply(this,n.concat([].slice.call(arguments)))}}};var n="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var o,a=(function(e,t){var r;r={},("object"==typeof window&&window||n).PubSub=r,function(e){var t={},r=-1,n="*";function o(e){var t;for(t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function a(e){return function(){throw e}}function i(e,t,r){try{e(t,r)}catch(e){setTimeout(a(e),0)}}function s(e,t,r){e(t,r)}function c(e,r,n,o){var a,c=t[r],l=o?s:i;if(Object.prototype.hasOwnProperty.call(t,r))for(a in c)Object.prototype.hasOwnProperty.call(c,a)&&l(c[a],e,n)}function l(e,t,r){return function(){var o=String(e),a=o.lastIndexOf(".");for(c(e,e,t,r);-1!==a;)a=(o=o.substr(0,a)).lastIndexOf("."),c(e,o,t,r);c(e,n,t,r)}}function u(e){var r=String(e);return Boolean(Object.prototype.hasOwnProperty.call(t,r)&&o(t[r]))}function p(e){for(var t=String(e),r=u(t)||u(n),o=t.lastIndexOf(".");!r&&-1!==o;)o=(t=t.substr(0,o)).lastIndexOf("."),r=u(t);return r}function f(e,t,r,n){var o=l(e="symbol"==typeof e?e.toString():e,t,n);return!!p(e)&&(!0===r?o():setTimeout(o,0),!0)}e.publish=function(t,r){return f(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return f(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,Object.prototype.hasOwnProperty.call(t,e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeAll=function(t){return e.subscribe(n,t)},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n,o=0;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)){for(n in t[r])o++;break}return o},e.getSubscriptions=function(e){var r,n=[];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,a,i=function(e){var r;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e))return!0;return!1},s="string"==typeof r&&(Object.prototype.hasOwnProperty.call(t,r)||i(r)),c=!s&&"string"==typeof r,l="function"==typeof r,u=!1;if(!s){for(n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(o=t[n],c&&o[r]){delete o[r],u=r;break}if(l)for(a in o)Object.prototype.hasOwnProperty.call(o,a)&&o[a]===r&&(delete o[a],u=!0)}return u}e.clearSubscriptions(r)}}(r),void 0!==e&&e.exports&&(t=e.exports=r),t.PubSub=r,e.exports=t=r}(o={exports:{}},o.exports),o.exports);a.PubSub;const i={null:e=>null===e,boolean:e=>"boolean"==typeof e,object:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,array:e=>Array.isArray(e),number:e=>"number"==typeof e,integer:e=>Number.isInteger(e),string:e=>"string"==typeof e},s=e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),o=e.slice(r+1);return[decodeURI(n),decodeURI(o)]},c=e=>{const t=RegExp(/^(.+):\/\//).exec(e);return t?t[1]:""};var l={jsonTypeOf:(e,t)=>i[t](e),splitUrl:s,safeResolveUrl:(e,r)=>{const n=t.default(e,r),o=s(e)[0];if(o&&"file"===c(n)&&"file"!==c(o))throw Error(`Can't access file '${n}' resource from network context '${e}'`);return n}};const u=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(m)},p=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:p(e,w(t,o,n),r,h(o,n))}}if(Array.isArray(t)){const n=[...t];return n[b(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:w(t,e[0],n)},f=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||g(t)){const o=e.shift();f(e,w(t,o,n),r,h(o,n))}else{t[b(t,e[0])]=r}},d=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=w(t,n,r);return{...t,[n]:d(e,o,h(n,r))}}if(Array.isArray(t))return t.filter(((t,r)=>r!=e[0]));if("object"==typeof t&&null!==t){const{[e[0]]:r,...n}=t;return n}return w(t,e[0],r)}},y=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=w(t,n,r);y(e,o,h(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:w(t,e[0],r)},h=r(((e,t)=>t+"/"+v(e))),v=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),m=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),b=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,w=(e,t,r="")=>{if(void 0===e)throw TypeError(`Value at '${r}' is undefined and does not have property '${t}'`);if(null===e)throw TypeError(`Value at '${r}' is null and does not have property '${t}'`);if(g(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[b(e,t)]},g=e=>null===e||"object"!=typeof e;var O={nil:"",append:h,get:(e,t)=>{const r=u(e),n=e=>r.reduce((([e,t],r)=>[w(e,r,t),h(r,t)]),[e,""])[0];return void 0===t?n:n(t)},set:(e,t,n)=>{const o=u(e),a=r(((e,t)=>p(o,e,t,"")));return void 0===t?a:a(t,n)},assign:(e,t,n)=>{const o=u(e),a=r(((e,t)=>f(o,e,t,"")));return void 0===t?a:a(t,n)},unset:(e,t)=>{const r=u(e),n=e=>d(r,e,"");return void 0===t?n:n(t)},remove:(e,t)=>{const r=u(e),n=e=>y(r,e,"");return void 0===t?n:n(t)}};O.nil,O.append,O.get,O.set,O.assign,O.unset,O.remove;const j=Symbol("$__value"),E=Symbol("$__href");var $={cons:(e,t)=>Object.freeze({[E]:e,[j]:t}),isReference:e=>e&&void 0!==e[E],href:e=>e[E],value:e=>e[j]};const{jsonTypeOf:S}=l,A=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),x=e=>$.isReference(e.value)?$.value(e.value):e.value,I=r(((e,t)=>S(x(e),t))),T=(e,t)=>Object.freeze({...t,pointer:O.append(e,t.pointer),value:x(t)[e]}),k=r(((e,t)=>x(t).map(((r,n,o,a)=>e(T(n,t),n,o,a))))),P=r(((e,t)=>x(t).map(((e,r,n,o)=>T(r,t))).filter(((t,r,n,o)=>e(t,r,n,o))))),V=r(((e,t,r)=>x(r).reduce(((t,n,o)=>e(t,T(o,r),o)),t))),R=r(((e,t)=>x(t).every(((r,n,o,a)=>e(T(n,t),n,o,a))))),U=r(((e,t)=>x(t).some(((r,n,o,a)=>e(T(n,t),n,o,a)))));var C={nil:A,cons:(e,t="")=>Object.freeze({...A,id:t,instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:x,has:(e,t)=>e in x(t),typeOf:I,step:T,entries:e=>Object.keys(x(e)).map((t=>[t,T(t,e)])),keys:e=>Object.keys(x(e)),map:k,filter:P,reduce:V,every:R,some:U,length:e=>x(e).length},K=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,L=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,z=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,_=/\\([\u000b\u0020-\u00ff])/g,D=/([\\"])/g,N=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function q(e){var t=String(e);if(z.test(t))return t;if(t.length>0&&!L.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(D,"\\$1")+'"'}function B(e){this.parameters=Object.create(null),this.type=e}var F={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!N.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,a=Object.keys(t).sort(),i=0;i<a.length;i++){if(o=a[i],!z.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+q(t[o])}return n},parse:function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;"function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.substr(0,r).trim():t.trim();if(!N.test(n))throw new TypeError("invalid media type");var o=new B(n.toLowerCase());if(-1!==r){var a,i,s;for(K.lastIndex=r;i=K.exec(t);){if(i.index!==r)throw new TypeError("invalid parameter format");r+=i[0].length,a=i[1].toLowerCase(),'"'===(s=i[2])[0]&&(s=s.substr(1,s.length-2).replace(_,"$1")),o.parameters[a]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},Z=async e=>Object.entries(await e),M=r((async(e,t)=>(await t).map(e))),J=r((async(e,t,r)=>(await r).reduce((async(t,r)=>e(await t,r)),t))),G=r((async(e,t,r={})=>J((async(t,r)=>await e(r)?t.concat([r]):t),[],t,r))),H=r((async(e,t)=>{const r=await M(e,t);return(await Promise.all(r)).some((e=>e))})),W=r((async(e,t)=>{const r=await M(e,t);return(await Promise.all(r)).every((e=>e))})),Q=r(((e,t)=>e.reduce((async(e,t)=>t(await e)),t))),X={entries:Z,map:M,filter:G,reduce:J,some:H,every:W,pipeline:Q,all:e=>Promise.all(e),allValues:e=>Q([Z,J((async(e,[t,r])=>(e[t]=await r,e)),{})],e)};X.entries,X.map,X.filter,X.reduce,X.some,X.every,X.pipeline,X.all,X.allValues;var Y=fetch;const{jsonTypeOf:ee,splitUrl:te,safeResolveUrl:re}=l,ne={},oe={},ae=(e,t)=>{const r=e in oe?oe[e]:e;if(r in ne)return ne[r][t]},ie={},se={},ce=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=te(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=ae(n,"baseToken"),a=ae(n,"anchorToken"),i=te(t)[0];if(!i&&!te(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const s=re(i,e[o]||""),[c,l]=te(s);delete e[o],l&&o===a&&(e[a]=a!==o?encodeURI(l):`#${encodeURI(l)}`),i&&(se[i]=c);const u={},p=ae(n,"recursiveAnchorToken");let f;!0===e[p]&&(u[""]=`${c}#`,e[a]="",delete e[p]);const d=ae(n,"vocabularyToken");ee(e[d],"object")?(oe[c]=n,f=e[d],delete e[d]):(oe[c]=n,f={[n]:!0});const y={"":""};return ie[c]={id:c,schemaVersion:n,schema:le(e,c,n,O.nil,y,u),anchors:y,dynamicAnchors:u,vocabulary:f,validated:!1},c},le=(e,t,r,n,o,a)=>{if(ee(e,"object")){const i="string"==typeof e.$schema?te(e.$schema)[0]:r,s=ae(i,"embeddedToken"),c=ae(i,"anchorToken");if("string"==typeof e[s]&&(s!==c||"#"!==e[s][0])){const n=re(t,e[s]);return e[s]=n,ce(e,n,r),$.cons(e[s],e)}const l=ae(r,"anchorToken"),u=ae(r,"dynamicAnchorToken");"string"==typeof e[u]&&(a[e[u]]=`${t}#${encodeURI(n)}`,o[e[u]]=n,delete e[u]);const p=ae(r,"embeddedToken");if("string"==typeof e[l]){const t=l!==p?e[l]:e[l].slice(1);o[t]=n,delete e[l]}const f=ae(r,"jrefToken");if("string"==typeof e[f])return $.cons(e[f],e);for(const i in e)e[i]=le(e[i],t,r,O.append(i,n),o,a);return e}return Array.isArray(e)?e.map(((e,i)=>le(e,t,r,O.append(i,n),o,a))):e},ue=e=>ie[se[e]]||ie[e],pe=Object.freeze({id:"",schemaVersion:void 0,vocabulary:{},pointer:O.nil,schema:void 0,value:void 0,anchors:{},dynamicAnchors:{},validated:!0}),fe=async(e,t=pe)=>{const r=re(he(t),e),[n,o]=te(r);if(!(e=>e in ie||e in se)(n)){const e=await Y(n,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error(`Failed to retrieve schema with id: ${n}`);if(e.headers.has("content-type")){const t=F.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${n} is not a schema. Found a document with media type: ${t}`)}ce(await e.json(),n)}const a=ue(n),i="/"!==o[0]?ye(a,o):o,s=Object.freeze({...a,pointer:i,value:O.get(i,a.schema)});return de(s)},de=e=>$.isReference(e.value)?fe($.href(e.value),e):e,ye=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},he=e=>`${e.id}#${encodeURI(e.pointer)}`,ve=e=>$.isReference(e.value)?$.value(e.value):e.value,me=(e,t)=>{const r=ue(t.id),n=Object.freeze({...t,pointer:O.append(e,t.pointer),value:ve(t)[e],validated:r.validated});return de(n)},be=r(((e,t)=>X.pipeline([ve,X.map((async(r,n)=>e(await me(n,t),n))),X.all],t)));var we={setConfig:(e,t,r)=>{ne[e]||(ne[e]={}),ne[e][t]=r},getConfig:ae,add:ce,get:fe,markValidated:e=>{ie[e].validated=!0},uri:he,value:ve,getAnchorPointer:ye,typeOf:(e,t)=>ee(ve(e),t),has:(e,t)=>e in ve(t),step:me,keys:e=>Object.keys(ve(e)),entries:e=>X.pipeline([ve,Object.keys,X.map((async t=>[t,await me(t,e)])),X.all],e),map:be,length:e=>ve(e).length};we.setConfig,we.getConfig,we.add,we.get,we.markValidated,we.uri,we.value,we.getAnchorPointer,we.typeOf,we.has,we.step,we.keys,we.entries,we.map,we.length;class ge extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var Oe=ge;const{splitUrl:je}=l,Ee="FLAG",$e="BASIC",Se="DETAILED",Ae="VERBOSE";let xe=Se,Ie=!0;const Te=async e=>{const t={metaData:{}};return{ast:t,schemaUri:await Le(e,t)}},ke=r((({ast:e,schemaUri:t},r,n=Ee)=>{if(![Ee,$e,Se,Ae].includes(n))throw Error(`The '${n}' error format is not supported`);const o=[],i=a.subscribe("result",Pe(n,o));return _e(t,r,e,{}),a.unsubscribe(i),o[0]})),Pe=(e,t)=>{const r=[];return(n,o)=>{if("result"===n){const{keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:a}=o,i={keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:a,errors:[]};r.push(i)}else if("result.start"===n)r.push(n);else if("result.end"===n){const n=r.pop();for(;"result.start"!==r[r.length-1];){const t=r.pop(),o=[t];e===$e&&(o.push(...t.errors),delete t.errors),(e===Ae||e!==Ee&&!t.valid)&&n.errors.unshift(...o)}r[r.length-1]=n,t[0]=n}}},Ve={},Re=e=>Ve[e],Ue=e=>e in Ve,Ce={},Ke={},Le=async(e,t)=>{if(e=await ze(e),!Ue(`${e.schemaVersion}#validate`)){const t=await we.get(e.schemaVersion);(we.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 Ce)Object.entries(Ce[e]).forEach((([e,r])=>{((e,t)=>{Ve[e]={collectEvaluatedItems:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&new Set,collectEvaluatedProperties:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&[],...t}})(`${t.id}#${e}`,r)}));else if(r)throw Error(`Missing required vocabulary: ${e}`)}))}if(Ie&&!e.validated){if(we.markValidated(e.id),!(e.schemaVersion in Ke)){const t=await we.get(e.schemaVersion),r=await Te(t);Ke[t.id]=ke(r)}const t=C.cons(e.schema,e.id),r=Ke[e.schemaVersion](t,xe);if(!r.valid)throw new Oe(r)}return e.id in t.metaData||(t.metaData[e.id]={id:e.id,dynamicAnchors:e.dynamicAnchors,anchors:e.anchors}),Re(`${e.schemaVersion}#validate`).compile(e,t)},ze=async e=>we.typeOf(e,"string")?ze(await we.get(we.value(e),e)):e,_e=(e,t,r,n)=>{const o=De(e,r),a=je(e)[0];return Re(o).interpret(e,t,r,{...r.metaData[a].dynamicAnchors,...n})},De=(e,t)=>{if(!(e in t))throw Error(`No schema found at ${e}`);return t[e][0]};var Ne={validate:async(e,t,r)=>{const n=await Te(e),o=(e,t)=>ke(n,C.cons(e),t);return void 0===t?o:o(t,r)},compile:Te,interpret:ke,setMetaOutputFormat:e=>{xe=e},setShouldMetaValidate:e=>{Ie=e},FLAG:Ee,BASIC:$e,DETAILED:Se,VERBOSE:Ae,add:(e,t="",r="")=>{const n=we.add(e,t,r);delete Ke[n]},getKeyword:Re,hasKeyword:Ue,defineVocabulary:(e,t)=>{Ce[e]=t},compileSchema:Le,interpretSchema:_e,collectEvaluatedProperties:(e,t,r,n,o)=>{const a=De(e,r);return Re(a).collectEvaluatedProperties(e,t,r,n,o)},collectEvaluatedItems:(e,t,r,n,o)=>{const a=De(e,r);return Re(a).collectEvaluatedItems(e,t,r,n,o)}};var qe={compile:e=>we.value(e),interpret:()=>!0};var Be={compile:async(e,t)=>{const r=we.uri(e);if(!(r in t)){t[r]=!1;const n=we.value(e);if(!["object","boolean"].includes(typeof n))throw Error(`No schema found at '${we.uri(e)}'`);t[r]=[`${e.schemaVersion}#validate`,we.uri(e),"boolean"==typeof n?n:await X.pipeline([we.entries,X.map((([t,r])=>[`${e.schemaVersion}#${t}`,r])),X.filter((([t])=>Ne.hasKeyword(t)&&t!==`${e.schemaVersion}#validate`)),X.map((async([r,n])=>{const o=await Ne.getKeyword(r).compile(n,t,e);return[r,we.uri(n),o]})),X.all],e)]}return r},interpret:(e,t,r,n)=>{const[o,i,s]=r[e];a.publishSync("result.start");const c="boolean"==typeof s?s:s.every((([e,o,i])=>{a.publishSync("result.start");const s=Ne.getKeyword(e).interpret(i,t,r,n);return a.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:C.uri(t),valid:s,ast:i}),a.publishSync("result.end"),s}));return a.publishSync("result",{keyword:o,absoluteKeywordLocation:i,instanceLocation:C.uri(t),valid:c,ast:e}),a.publishSync("result.end"),c},collectEvaluatedProperties:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&[]:a.filter((([e])=>!o||!e.endsWith("#unevaluatedProperties"))).reduce(((e,[o,,a])=>{const i=e&&Ne.getKeyword(o).collectEvaluatedProperties(a,t,r,n);return!1!==i&&[...e,...i]}),[])},collectEvaluatedItems:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&new Set:a.filter((([e])=>!o||!e.endsWith("#unevaluatedItems"))).reduce(((e,[o,,a])=>{const i=!1!==e&&Ne.getKeyword(o).collectEvaluatedItems(a,t,r,n);return!1!==i&&new Set([...e,...i])}),new Set)}},Fe={metaData:qe,validate:Be},Ze={Core:Ne,Schema:we,Instance:C,Reference:$,Keywords:Fe,InvalidSchemaError:Oe},Me=Ze.Core,Je=Ze.Schema,Ge=Ze.Instance,He=Ze.Reference,We=Ze.Keywords,Qe=Ze.InvalidSchemaError;exports.Core=Me,exports.Instance=Ge,exports.InvalidSchemaError=Qe,exports.Keywords=We,exports.Reference=He,exports.Schema=Je,exports.default=Ze; | ||
//# sourceMappingURL=json-schema-core-cjs.min.js.map |
@@ -1,2 +0,2 @@ | ||
import e from"url";var t=function(e,t){return function r(){null==t&&(t=e.length);var n=[].slice.call(arguments);return n.length>=t?e.apply(this,n):function(){return r.apply(this,n.concat([].slice.call(arguments)))}}};var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var n,a=(function(e,t){var n;n={},("object"==typeof window&&window||r).PubSub=n,function(e){var t={},r=-1,n="*";function a(e){var t;for(t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function o(e){return function(){throw e}}function i(e,t,r){try{e(t,r)}catch(e){setTimeout(o(e),0)}}function s(e,t,r){e(t,r)}function u(e,r,n,a){var o,u=t[r],l=a?s:i;if(Object.prototype.hasOwnProperty.call(t,r))for(o in u)Object.prototype.hasOwnProperty.call(u,o)&&l(u[o],e,n)}function l(e,t,r){return function(){var a=String(e),o=a.lastIndexOf(".");for(u(e,e,t,r);-1!==o;)o=(a=a.substr(0,o)).lastIndexOf("."),u(e,a,t,r);u(e,n,t,r)}}function c(e){var r=String(e);return Boolean(Object.prototype.hasOwnProperty.call(t,r)&&a(t[r]))}function f(e){for(var t=String(e),r=c(t)||c(n),a=t.lastIndexOf(".");!r&&-1!==a;)a=(t=t.substr(0,a)).lastIndexOf("."),r=c(t);return r}function h(e,t,r,n){var a=l(e="symbol"==typeof e?e.toString():e,t,n);return!!f(e)&&(!0===r?a():setTimeout(a,0),!0)}e.publish=function(t,r){return h(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return h(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,Object.prototype.hasOwnProperty.call(t,e)||(t[e]={});var a="uid_"+String(++r);return t[e][a]=n,a},e.subscribeAll=function(t){return e.subscribe(n,t)},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n,a=0;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)){for(n in t[r])a++;break}return a},e.getSubscriptions=function(e){var r,n=[];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,a,o,i=function(e){var r;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e))return!0;return!1},s="string"==typeof r&&(Object.prototype.hasOwnProperty.call(t,r)||i(r)),u=!s&&"string"==typeof r,l="function"==typeof r,c=!1;if(!s){for(n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(a=t[n],u&&a[r]){delete a[r],c=r;break}if(l)for(o in a)Object.prototype.hasOwnProperty.call(a,o)&&a[o]===r&&(delete a[o],c=!0)}return c}e.clearSubscriptions(r)}}(n),void 0!==e&&e.exports&&(t=e.exports=n),t.PubSub=n,e.exports=t=n}(n={exports:{}},n.exports),n.exports);a.PubSub;var o=function(e,t){if(e=e.trim(),(t=t.trim()).startsWith("about:"))return t;const r=function(e){const t={host:"",path:"",query:"",protocol:""};let r=e,n=e.indexOf("//");t.protocol=r.substring(0,n),n+=2;const a=e.indexOf("/",n),o=e.indexOf("?"),i=e.indexOf("#");-1!==i&&(r=r.substring(0,i));if(-1!==o){const e=r.substring(o);t.query=e,r=r.substring(0,o)}if(-1!==a){const e=r.substring(0,a);t.host=e,r=r.substring(a),t.path=r}else t.host=r;return t}(e),n=function(e){const t={href:e,hash:"",query:"",netPath:!1,absolutePath:!1,relativePath:!1};if(u.test(e))return t.netPath=!0,t;"/"===e[0]?t.absolutePath=!0:""!==e&&(t.relativePath=!0);let r=e;const n=e.indexOf("?"),a=e.indexOf("#");if(-1!==a){const e=r.substring(a);t.hash=e,r=r.substring(0,a)}if(-1!==n){const e=r.substring(n);t.query=e,r=r.substring(0,n)}return t.path=r,t}(t);if(!r.protocol&&!n.netPath)throw new Error("Error, protocol is not specified");if(n.netPath)return function(e){return e.startsWith("//")}(n.href)&&(n.href=r.protocol+n.href),function(e){const t=e.indexOf("//")+2,r=!e.includes("/",t),n=!e.includes("?",t),a=!e.includes("#",t);return r&&n&&a}(n.href)?i(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:a}=n;return r.host+s(e)+t+a}if(n.relativePath){const{path:e,query:t,hash:a}=n;let o,i=r.path,u=r.host;return 0===e.length?o=i:(i=i.substring(0,i.lastIndexOf("/")),o=s(i+"/"+e)),u+=""!==o||t||a?o+t+a:"/",u}{const{host:e,path:t,query:a}=r;return t||a?e+t+a+n.hash:i(e)}};function i(e){return e+("/"===e[e.length-1]?"":"/")}function s(e){let t=e.split("/");""===t[0]&&(t=t.slice(1));let r=[];return t.forEach(((e,n)=>{"."!==e&&(".."===e?r.pop():""===e&&n!==t.length-1||r.push(e))})),"/"+r.join("/")}const u=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");const l={null:e=>null===e,boolean:e=>"boolean"==typeof e,object:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,array:e=>Array.isArray(e),number:e=>"number"==typeof e,integer:e=>Number.isInteger(e),string:e=>"string"==typeof e},c=e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),a=e.slice(r+1);return[decodeURI(n),decodeURI(a)]},f=e=>{const t=RegExp(/^(.+):\/\//).exec(e);return t?t[1]:""};var h={jsonTypeOf:(e,t)=>l[t](e),splitUrl:c,safeResolveUrl:(e,t)=>{const r=o(e,t),n=c(e)[0];if(n&&"file"===f(r)&&"file"!==f(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r}};const m=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(x)},p=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const a=e.shift();return{...t,[a]:p(e,O(t,a,n),r,b(a,n))}}if(Array.isArray(t)){const n=[...t];return n[w(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:O(t,e[0],n)},d=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||E(t)){const a=e.shift();d(e,O(t,a,n),r,b(a,n))}else{t[w(t,e[0])]=r}},y=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),a=O(t,n,r);return{...t,[n]:y(e,a,b(n,r))}}if(Array.isArray(t))return t.filter(((t,r)=>r!=e[0]));if("object"==typeof t&&null!==t){const{[e[0]]:r,...n}=t;return n}return O(t,e[0],r)}},v=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),a=O(t,n,r);v(e,a,b(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:O(t,e[0],r)},b=t(((e,t)=>t+"/"+g(e))),g=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),x=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),w=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,O=(e,t,r="")=>{if(void 0===e)throw TypeError(`Value at '${r}' is undefined and does not have property '${t}'`);if(null===e)throw TypeError(`Value at '${r}' is null and does not have property '${t}'`);if(E(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[w(e,t)]},E=e=>null===e||"object"!=typeof e;var I={nil:"",append:b,get:(e,t)=>{const r=m(e),n=e=>r.reduce((([e,t],r)=>[O(e,r,t),b(r,t)]),[e,""])[0];return void 0===t?n:n(t)},set:(e,r,n)=>{const a=m(e),o=t(((e,t)=>p(a,e,t,"")));return void 0===r?o:o(r,n)},assign:(e,r,n)=>{const a=m(e),o=t(((e,t)=>d(a,e,t,"")));return void 0===r?o:o(r,n)},unset:(e,t)=>{const r=m(e),n=e=>y(r,e,"");return void 0===t?n:n(t)},remove:(e,t)=>{const r=m(e),n=e=>v(r,e,"");return void 0===t?n:n(t)}};I.nil,I.append,I.get,I.set,I.assign,I.unset,I.remove;const S=Symbol("$__value"),j=Symbol("$__href");var P={cons:(e,t)=>Object.freeze({[j]:e,[S]:t}),isReference:e=>e&&void 0!==e[j],href:e=>e[j],value:e=>e[S]};const{jsonTypeOf:A}=h,T=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),R=e=>P.isReference(e.value)?P.value(e.value):e.value,$=t(((e,t)=>A(R(e),t))),V=(e,t)=>Object.freeze({...t,pointer:I.append(e,t.pointer),value:R(t)[e]}),k=t(((e,t)=>R(t).map(((r,n,a,o)=>e(V(n,t),n,a,o))))),L=t(((e,t)=>R(t).map(((e,r,n,a)=>V(r,t))).filter(((t,r,n,a)=>e(t,r,n,a))))),H=t(((e,t,r)=>R(r).reduce(((t,n,a)=>e(t,V(a,r),a)),t))),U=t(((e,t)=>R(t).every(((r,n,a,o)=>e(V(n,t),n,a,o))))),q=t(((e,t)=>R(t).some(((r,n,a,o)=>e(V(n,t),n,a,o)))));var D={nil:T,cons:(e,t="")=>Object.freeze({...T,id:t,instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:R,has:(e,t)=>e in R(t),typeOf:$,step:V,entries:e=>Object.keys(R(e)).map((t=>[t,V(t,e)])),keys:e=>Object.keys(R(e)),map:k,filter:L,reduce:H,every:U,some:q,length:e=>R(e).length},_=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,Q=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,C=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,z=/\\([\u000b\u0020-\u00ff])/g,B=/([\\"])/g,K=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function N(e){var t=String(e);if(C.test(t))return t;if(t.length>0&&!Q.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(B,"\\$1")+'"'}function M(e){this.parameters=Object.create(null),this.type=e}var F={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!K.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var a,o=Object.keys(t).sort(),i=0;i<o.length;i++){if(a=o[i],!C.test(a))throw new TypeError("invalid parameter name");n+="; "+a+"="+N(t[a])}return n},parse:function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;"function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.substr(0,r).trim():t.trim();if(!K.test(n))throw new TypeError("invalid media type");var a=new M(n.toLowerCase());if(-1!==r){var o,i,s;for(_.lastIndex=r;i=_.exec(t);){if(i.index!==r)throw new TypeError("invalid parameter format");r+=i[0].length,o=i[1].toLowerCase(),'"'===(s=i[2])[0]&&(s=s.substr(1,s.length-2).replace(z,"$1")),a.parameters[o]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return a}},J=async e=>Object.entries(await e),W=t((async(e,t)=>(await t).map(e))),Z=t((async(e,t,r)=>(await r).reduce((async(t,r)=>e(await t,r)),t))),G=t((async(e,t,r={})=>Z((async(t,r)=>await e(r)?t.concat([r]):t),[],t,r))),X=t((async(e,t)=>{const r=await W(e,t);return(await Promise.all(r)).some((e=>e))})),Y=t((async(e,t)=>{const r=await W(e,t);return(await Promise.all(r)).every((e=>e))})),ee=t(((e,t)=>e.reduce((async(e,t)=>t(await e)),t))),te={entries:J,map:W,filter:G,reduce:Z,some:X,every:Y,pipeline:ee,all:e=>Promise.all(e),allValues:e=>ee([J,Z((async(e,[t,r])=>(e[t]=await r,e)),{})],e)};te.entries,te.map,te.filter,te.reduce,te.some,te.every,te.pipeline,te.all,te.allValues;var re={ABSOLUTE:"absolute",PATH_RELATIVE:"pathRelative",ROOT_RELATIVE:"rootRelative",SHORTEST:"shortest"};function ne(e,t){var r=t.removeEmptyQueries&&e.extra.relation.minimumPort;return e.query.string[r?"stripped":"full"]}function ae(e,t){return!e.extra.relation.minimumQuery||t.output===re.ABSOLUTE||t.output===re.ROOT_RELATIVE}function oe(e,t){var r=t.removeDirectoryIndexes&&e.extra.resourceIsIndex,n=e.extra.relation.minimumResource&&t.output!==re.ABSOLUTE&&t.output!==re.ROOT_RELATIVE;return!!e.resource&&!n&&!r}var ie=function(e,t){var r="";return r+=function(e,t){var r="";return(e.extra.relation.maximumHost||t.output===re.ABSOLUTE)&&(e.extra.relation.minimumScheme&&t.schemeRelative&&t.output!==re.ABSOLUTE?r+="//":r+=e.scheme+"://"),r}(e,t),r+=function(e,t){return!e.auth||t.removeAuth||!e.extra.relation.maximumHost&&t.output!==re.ABSOLUTE?"":e.auth+"@"}(e,t),r+=function(e,t){return e.host.full&&(e.extra.relation.maximumAuth||t.output===re.ABSOLUTE)?e.host.full:""}(e,t),r+=function(e,t){return e.port&&!e.extra.portIsDefault&&e.extra.relation.maximumHost?":"+e.port:""}(e),r+=function(e,t){var r="",n=e.path.absolute.string,a=e.path.relative.string,o=oe(e,t);if(e.extra.relation.maximumHost||t.output===re.ABSOLUTE||t.output===re.ROOT_RELATIVE)r=n;else if(a.length<=n.length&&t.output===re.SHORTEST||t.output===re.PATH_RELATIVE){if(""===(r=a)){var i=ae(e,t)&&!!ne(e,t);e.extra.relation.maximumPath&&!o?r="./":!e.extra.relation.overridesQuery||o||i||(r="./")}}else r=n;return"/"!==r||o||!t.removeRootTrailingSlash||e.extra.relation.minimumPort&&t.output!==re.ABSOLUTE||(r=""),r}(e,t),r+=function(e,t){return oe(e,t)?e.resource:""}(e,t),r+=function(e,t){return ae(e,t)?ne(e,t):""}(e,t),r+=function(e,t){return e.hash?e.hash:""}(e)};var se={clone:function e(t){if(t instanceof Object){var r=t instanceof Array?[]:{};for(var n in t)t.hasOwnProperty(n)&&(r[n]=e(t[n]));return r}return t},isPlainObject:function(e){return!!e&&"object"==typeof e&&e.constructor===Object},shallowMerge:function(e,t){if(e instanceof Object&&t instanceof Object)for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e}};function ue(e,t){return t instanceof Object&&e instanceof Object?t instanceof Array&&e instanceof Array?t.concat(e):se.shallowMerge(e,t):e}var le=function(e,t){if(se.isPlainObject(e)){var r={};for(var n in t)t.hasOwnProperty(n)&&(void 0!==e[n]?r[n]=ue(e[n],t[n]):r[n]=t[n]);return r}return t};var ce=function(e){var t=!(e.scheme||e.auth||e.host.full||e.port),r=t&&!e.path.absolute.string,n=r&&!e.resource,a=n&&!e.query.string.full.length,o=a&&!e.hash;e.extra.hrefInfo.minimumPathOnly=t,e.extra.hrefInfo.minimumResourceOnly=r,e.extra.hrefInfo.minimumQueryOnly=n,e.extra.hrefInfo.minimumHashOnly=a,e.extra.hrefInfo.empty=o};var fe=function(e,t){if(t.ignore_www){var r=e.host.full;if(r){var n=r;0===r.indexOf("www.")&&(n=r.substr(4)),e.host.stripped=n}}};function he(e){if("/"!==e){var t=[];return e.split("/").forEach((function(e){""!==e&&t.push(e)})),t}return[]}var me=function(e,t){var r=e.path.absolute.string;if(r){var n=r.lastIndexOf("/");if(n>-1){if(++n<r.length){var a=r.substr(n);"."!==a&&".."!==a?(e.resource=a,r=r.substr(0,n)):r+="/"}e.path.absolute.string=r,e.path.absolute.array=he(r)}else"."===r||".."===r?(r+="/",e.path.absolute.string=r,e.path.absolute.array=he(r)):(e.resource=r,e.path.absolute.string=null);e.extra.resourceIsIndex=function(e,t){var r=!1;return t.directoryIndexes.every((function(t){return t!==e||(r=!0,!1)})),r}(e.resource,t)}};var pe=function(e,t){var r=-1;for(var n in t.defaultPorts)if(n===e.scheme&&t.defaultPorts.hasOwnProperty(n)){r=t.defaultPorts[n];break}r>-1&&(r=r.toString(),null===e.port&&(e.port=r),e.extra.portIsDefault=e.port===r)},de=Object.prototype.hasOwnProperty;function ye(e,t){var r=0,n="";for(var a in e)if(""!==a&&!0===de.call(e,a)){var o=e[a];""===o&&t||(n+=1==++r?"?":"&",a=encodeURIComponent(a),n+=""!==o?a+"="+encodeURIComponent(o).replace(/%20/g,"+"):a)}return n}var ve=function(e,t){e.query.string.full=ye(e.query.object,!1),t.removeEmptyQueries&&(e.query.string.stripped=ye(e.query.object,!0))},be=e.parse;var ge=function(e,t){return function(e,t){var r=!0;return t.rejectedSchemes.every((function(t){return r=!(0===e.indexOf(t+":"))})),r}(e,t)?(r=be(e,!0,t.slashesDenoteHost),(n=r.protocol)&&n.indexOf(":")===n.length-1&&(n=n.substr(0,n.length-1)),r.host={full:r.hostname,stripped:null},r.path={absolute:{array:null,string:r.pathname},relative:{array:null,string:null}},r.query={object:r.query,string:{full:null,stripped:null}},r.extra={hrefInfo:{minimumPathOnly:null,minimumResourceOnly:null,minimumQueryOnly:null,minimumHashOnly:null,empty:null,separatorOnlyQuery:"?"===r.search},portIsDefault:null,relation:{maximumScheme:null,maximumAuth:null,maximumHost:null,maximumPort:null,maximumPath:null,maximumResource:null,maximumQuery:null,maximumHash:null,minimumScheme:null,minimumAuth:null,minimumHost:null,minimumPort:null,minimumPath:null,minimumResource:null,minimumQuery:null,minimumHash:null,overridesQuery:null},resourceIsIndex:null,slashes:r.slashes},r.resource=null,r.scheme=n,delete r.hostname,delete r.pathname,delete r.protocol,delete r.search,delete r.slashes,r):{href:e,valid:!1};var r,n};var xe={join:function(e){return e.length>0?e.join("/")+"/":""},resolveDotSegments:function(e){var t=[];return e.forEach((function(e){".."!==e?"."!==e&&t.push(e):t.length>0&&t.splice(t.length-1,1)})),t}};function we(e,t){var r=ge(e,t);return!1===r.valid||(fe(r,t),pe(r,t),me(r,t),ve(r,t),ce(r)),r}var Oe={from:function(e,t,r){if(e){var n=we(e,t),a=xe.resolveDotSegments(n.path.absolute.array);return n.path.absolute.array=a,n.path.absolute.string="/"+xe.join(a),n}return r},to:we};var Ee={pathOn:function(e,t,r){var n=e.extra.hrefInfo.minimumQueryOnly,a=e.extra.hrefInfo.minimumHashOnly,o=e.extra.hrefInfo.empty,i=e.extra.relation.minimumPort,s=e.extra.relation.minimumScheme,u=i&&e.path.absolute.string===t.path.absolute.string,l=e.resource===t.resource||!e.resource&&t.extra.resourceIsIndex||r.removeDirectoryIndexes&&e.extra.resourceIsIndex&&!t.resource,c=u&&(l||n||a||o),f=r.removeEmptyQueries?"stripped":"full",h=e.query.string[f],m=t.query.string[f],p=c&&!!h&&h===m||(a||o)&&!e.extra.hrefInfo.separatorOnlyQuery,d=p&&e.hash===t.hash;e.extra.relation.minimumPath=u,e.extra.relation.minimumResource=c,e.extra.relation.minimumQuery=p,e.extra.relation.minimumHash=d,e.extra.relation.maximumPort=!s||s&&!u,e.extra.relation.maximumPath=!s||s&&!c,e.extra.relation.maximumResource=!s||s&&!p,e.extra.relation.maximumQuery=!s||s&&!d,e.extra.relation.maximumHash=!s||s&&!d,e.extra.relation.overridesQuery=u&&e.extra.relation.maximumResource&&!p&&!!m},upToPath:function(e,t,r){var n=e.extra.hrefInfo.minimumPathOnly,a=e.scheme===t.scheme||!e.scheme,o=a&&(e.auth===t.auth||r.removeAuth||n),i=r.ignore_www?"stripped":"full",s=o&&(e.host[i]===t.host[i]||n),u=s&&(e.port===t.port||n);e.extra.relation.minimumScheme=a,e.extra.relation.minimumAuth=o,e.extra.relation.minimumHost=s,e.extra.relation.minimumPort=u,e.extra.relation.maximumScheme=!a||a&&!o,e.extra.relation.maximumAuth=!a||a&&!s,e.extra.relation.maximumHost=!a||a&&!u}};var Ie=function(e,t,r){Ee.upToPath(e,t,r),e.extra.relation.minimumScheme&&(e.scheme=t.scheme),e.extra.relation.minimumAuth&&(e.auth=t.auth),e.extra.relation.minimumHost&&(e.host=se.clone(t.host)),e.extra.relation.minimumPort&&function(e,t){e.port=t.port,e.extra.portIsDefault=t.extra.portIsDefault}(e,t),e.extra.relation.minimumScheme&&function(e,t){if(e.extra.relation.maximumHost||!e.extra.hrefInfo.minimumResourceOnly){var r=e.path.absolute.array,n="/";r?(e.extra.hrefInfo.minimumPathOnly&&0!==e.path.absolute.string.indexOf("/")&&(r=t.path.absolute.array.concat(r)),r=xe.resolveDotSegments(r),n+=xe.join(r)):r=[],e.path.absolute.array=r,e.path.absolute.string=n}else e.path=se.clone(t.path)}(e,t),Ee.pathOn(e,t,r),e.extra.relation.minimumResource&&function(e,t){e.resource=t.resource,e.extra.resourceIsIndex=t.extra.resourceIsIndex}(e,t),e.extra.relation.minimumQuery&&(e.query=se.clone(t.query)),e.extra.relation.minimumHash&&(e.hash=t.hash)};var Se=function(e,t,r){if(e.extra.relation.minimumScheme){var n=(a=e.path.absolute.array,o=t.path.absolute.array,i=[],s=!0,u=-1,o.forEach((function(e,t){s&&(a[t]!==e?s=!1:u=t),s||i.push("..")})),a.forEach((function(e,t){t>u&&i.push(e)})),i);e.path.relative.array=n,e.path.relative.string=xe.join(n)}var a,o,i,s,u};var je=function(e,t,r){return Ie(t,e,r),Se(t,e),t};function Pe(e,t){this.options=le(t,{defaultPorts:{ftp:21,http:80,https:443},directoryIndexes:["index.html"],ignore_www:!1,output:Pe.SHORTEST,rejectedSchemes:["data","javascript","mailto"],removeAuth:!1,removeDirectoryIndexes:!0,removeEmptyQueries:!1,removeRootTrailingSlash:!0,schemeRelative:!0,site:void 0,slashesDenoteHost:!0}),this.from=Oe.from(e,this.options,null)}Pe.prototype.relate=function(e,t,r){if(se.isPlainObject(t)?(r=t,t=e,e=null):t||(t=e,e=null),r=le(r,this.options),e=e||r.site,!(e=Oe.from(e,r,this.from))||!e.href)throw new Error("from value not defined.");if(e.extra.hrefInfo.minimumPathOnly)throw new Error("from value supplied is not absolute: "+e.href);return!1===(t=Oe.to(t,r)).valid?t.href:(t=je(e,t,r),t=ie(t,r))},Pe.relate=function(e,t,r){return(new Pe).relate(e,t,r)},se.shallowMerge(Pe,re);var Ae=Pe,Te=fetch;const{jsonTypeOf:Re,splitUrl:$e,safeResolveUrl:Ve}=h,ke={},Le={},He=(e,t)=>{const r=e in Le?Le[e]:e;if(r in ke)return ke[r][t]},Ue={},qe={},De=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=$e(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const a=He(n,"baseToken"),o=He(n,"anchorToken"),i=$e(t)[0];if(!i&&!$e(e[a]||"")[0])throw Error("Couldn't determine an identifier for the schema");const s=Ve(i,e[a]||""),[u,l]=$e(s);delete e[a],l&&a===o&&(e[o]=o!==a?encodeURI(l):`#${encodeURI(l)}`),i&&(qe[i]=u);const c={},f=He(n,"recursiveAnchorToken");let h;!0===e[f]&&(c[""]=`${u}#`,e[o]="",delete e[f]);const m=He(n,"vocabularyToken");Re(e[m],"object")?(Le[u]=n,h=e[m],delete e[m]):(Le[u]=n,h={[n]:!0});const p={"":""};return Ue[u]={id:u,schemaVersion:n,schema:_e(e,u,n,I.nil,p,c),anchors:p,dynamicAnchors:c,vocabulary:h,validated:!1},u},_e=(e,t,r,n,a,o)=>{if(Re(e,"object")){const i="string"==typeof e.$schema?$e(e.$schema)[0]:r,s=He(i,"embeddedToken"),u=He(i,"anchorToken");if("string"==typeof e[s]&&(s!==u||"#"!==e[s][0])){const n=Ve(t,e[s]);return e[s]=n,De(e,n,r),P.cons(e[s],e)}const l=He(r,"anchorToken"),c=He(r,"dynamicAnchorToken");"string"==typeof e[c]&&(o[e[c]]=`${t}#${encodeURI(n)}`,a[e[c]]=n,delete e[c]);const f=He(r,"embeddedToken");if("string"==typeof e[l]){const t=l!==f?e[l]:e[l].slice(1);a[t]=n,delete e[l]}const h=He(r,"jrefToken");if("string"==typeof e[h])return P.cons(e[h],e);for(const i in e)e[i]=_e(e[i],t,r,I.append(i,n),a,o);return e}return Array.isArray(e)?e.map(((e,i)=>_e(e,t,r,I.append(i,n),a,o))):e},Qe=e=>Ue[qe[e]]||Ue[e],Ce=Object.freeze({id:"",schemaVersion:void 0,vocabulary:{},pointer:I.nil,schema:void 0,value:void 0,anchors:{},dynamicAnchors:{},validated:!0}),ze=async(e,t=Ce)=>{const r=Ve(Ne(t),e),[n,a]=$e(r);if(!(e=>e in Ue||e in qe)(n)){const e=await Te(n,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error(`Failed to retrieve schema with id: ${n}`);if(e.headers.has("content-type")){const t=F.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${n} is not a schema. Found a document with media type: ${t}`)}De(await e.json(),n)}const o=Qe(n),i="/"!==a[0]?Ke(o,a):a,s=Object.freeze({...o,pointer:i,value:I.get(i,o.schema)});return Be(s)},Be=e=>P.isReference(e.value)?ze(P.href(e.value),e):e,Ke=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},Ne=e=>`${e.id}#${encodeURI(e.pointer)}`,Me=e=>P.isReference(e.value)?P.value(e.value):e.value,Fe=(e,t)=>{const r=Qe(t.id),n=Object.freeze({...t,pointer:I.append(e,t.pointer),value:Me(t)[e],validated:r.validated});return Be(n)},Je=t(((e,t)=>te.pipeline([Me,te.map((async(r,n)=>e(await Fe(n,t),n))),te.all],t))),We={parentId:"",parentDialect:"",includeEmbedded:!0},Ze=(e,t)=>t.startsWith("file://")?""===e?"":Ae.relate(e,t):t;var Ge={setConfig:(e,t,r)=>{ke[e]||(ke[e]={}),ke[e][t]=r},getConfig:He,add:De,get:ze,markValidated:e=>{Ue[e].validated=!0},uri:Ne,value:Me,getAnchorPointer:Ke,typeOf:(e,t)=>Re(Me(e),t),has:(e,t)=>e in Me(t),step:Fe,keys:e=>Object.keys(Me(e)),entries:e=>te.pipeline([Me,Object.keys,te.map((async t=>[t,await Fe(t,e)])),te.all],e),map:Je,length:e=>Me(e).length,toSchema:(e,t={})=>{const r={...We,...t},n=JSON.parse(JSON.stringify(e.schema,((t,n)=>{if(!P.isReference(n))return n;const a=P.value(n),o=a.$schema||e.schemaVersion,i=He(o,"embeddedToken");return!r.includeEmbedded&&i in a?void 0:P.value(n)}))),a=He(e.schemaVersion,"dynamicAnchorToken");Object.entries(e.dynamicAnchors).forEach((([e,t])=>{const r=$e(t)[1];I.assign(r,n,{[a]:e,...I.get(r,n)})}));const o=He(e.schemaVersion,"anchorToken");Object.entries(e.anchors).filter((([e])=>""!==e)).forEach((([e,t])=>{I.assign(t,n,{[o]:e,...I.get(t,n)})}));const i=He(e.schemaVersion,"baseToken"),s=Ze(r.parentId,e.id),u=r.parentDialect===e.schemaVersion?"":e.schemaVersion;return{...s&&{[i]:s},...u&&{$schema:u},...n}}};Ge.setConfig,Ge.getConfig,Ge.add,Ge.get,Ge.markValidated,Ge.uri,Ge.value,Ge.getAnchorPointer,Ge.typeOf,Ge.has,Ge.step,Ge.keys,Ge.entries,Ge.map,Ge.length,Ge.toSchema;class Xe extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var Ye=Xe;const{splitUrl:et}=h,tt="FLAG",rt="BASIC",nt="DETAILED",at="VERBOSE";let ot=nt,it=!0;const st=async e=>{const t={metaData:{}};return{ast:t,schemaUri:await dt(e,t)}},ut=t((({ast:e,schemaUri:t},r,n=tt)=>{if(![tt,rt,nt,at].includes(n))throw Error(`The '${n}' error format is not supported`);const o=[],i=a.subscribe("result",lt(n,o));return vt(t,r,e,{}),a.unsubscribe(i),o[0]})),lt=(e,t)=>{const r=[];return(n,a)=>{if("result"===n){const{keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:o}=a,i={keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:o,errors:[]};r.push(i)}else if("result.start"===n)r.push(n);else if("result.end"===n){const n=r.pop();for(;"result.start"!==r[r.length-1];){const t=r.pop(),a=[t];e===rt&&(a.push(...t.errors),delete t.errors),(e===at||e!==tt&&!t.valid)&&n.errors.unshift(...a)}r[r.length-1]=n,t[0]=n}}},ct={},ft=e=>ct[e],ht=e=>e in ct,mt={},pt={},dt=async(e,t)=>{if(e=await yt(e),!ht(`${e.schemaVersion}#validate`)){const t=await Ge.get(e.schemaVersion);(Ge.getConfig(t.id,"mandatoryVocabularies")||[]).forEach((e=>{if(!t.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)})),Object.entries(t.vocabulary).forEach((([e,r])=>{if(e in mt)Object.entries(mt[e]).forEach((([e,r])=>{((e,t)=>{ct[e]={collectEvaluatedItems:(e,r,n,a,o)=>t.interpret(e,r,n,a,o)&&new Set,collectEvaluatedProperties:(e,r,n,a,o)=>t.interpret(e,r,n,a,o)&&[],...t}})(`${t.id}#${e}`,r)}));else if(r)throw Error(`Missing required vocabulary: ${e}`)}))}if(it&&!e.validated){if(Ge.markValidated(e.id),!(e.schemaVersion in pt)){const t=await Ge.get(e.schemaVersion),r=await st(t);pt[t.id]=ut(r)}const t=D.cons(e.schema,e.id),r=pt[e.schemaVersion](t,ot);if(!r.valid)throw new Ye(r)}return e.id in t.metaData||(t.metaData[e.id]={id:e.id,dynamicAnchors:e.dynamicAnchors,anchors:e.anchors}),ft(`${e.schemaVersion}#validate`).compile(e,t)},yt=async e=>Ge.typeOf(e,"string")?yt(await Ge.get(Ge.value(e),e)):e,vt=(e,t,r,n)=>{const a=bt(e,r),o=et(e)[0];return ft(a).interpret(e,t,r,{...r.metaData[o].dynamicAnchors,...n})},bt=(e,t)=>{if(!(e in t))throw Error(`No schema found at ${e}`);return t[e][0]};var gt={validate:async(e,t,r)=>{const n=await st(e),a=(e,t)=>ut(n,D.cons(e),t);return void 0===t?a:a(t,r)},compile:st,interpret:ut,setMetaOutputFormat:e=>{ot=e},setShouldMetaValidate:e=>{it=e},FLAG:tt,BASIC:rt,DETAILED:nt,VERBOSE:at,add:(e,t="",r="")=>{const n=Ge.add(e,t,r);delete pt[n]},getKeyword:ft,hasKeyword:ht,defineVocabulary:(e,t)=>{mt[e]=t},compileSchema:dt,interpretSchema:vt,collectEvaluatedProperties:(e,t,r,n,a)=>{const o=bt(e,r);return ft(o).collectEvaluatedProperties(e,t,r,n,a)},collectEvaluatedItems:(e,t,r,n,a)=>{const o=bt(e,r);return ft(o).collectEvaluatedItems(e,t,r,n,a)}};var xt={compile:e=>Ge.value(e),interpret:()=>!0};var wt={compile:async(e,t)=>{const r=Ge.uri(e);if(!(r in t)){t[r]=!1;const n=Ge.value(e);if(!["object","boolean"].includes(typeof n))throw Error(`No schema found at '${Ge.uri(e)}'`);t[r]=[`${e.schemaVersion}#validate`,Ge.uri(e),"boolean"==typeof n?n:await te.pipeline([Ge.entries,te.map((([t,r])=>[`${e.schemaVersion}#${t}`,r])),te.filter((([t])=>gt.hasKeyword(t)&&t!==`${e.schemaVersion}#validate`)),te.map((async([r,n])=>{const a=await gt.getKeyword(r).compile(n,t,e);return[r,Ge.uri(n),a]})),te.all],e)]}return r},interpret:(e,t,r,n)=>{const[o,i,s]=r[e];a.publishSync("result.start");const u="boolean"==typeof s?s:s.every((([e,o,i])=>{a.publishSync("result.start");const s=gt.getKeyword(e).interpret(i,t,r,n);return a.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:D.uri(t),valid:s,ast:i}),a.publishSync("result.end"),s}));return a.publishSync("result",{keyword:o,absoluteKeywordLocation:i,instanceLocation:D.uri(t),valid:u,ast:e}),a.publishSync("result.end"),u},collectEvaluatedProperties:(e,t,r,n,a=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter((([e])=>!a||!e.endsWith("#unevaluatedProperties"))).reduce(((e,[a,,o])=>{const i=e&>.getKeyword(a).collectEvaluatedProperties(o,t,r,n);return!1!==i&&[...e,...i]}),[])},collectEvaluatedItems:(e,t,r,n,a=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&new Set:o.filter((([e])=>!a||!e.endsWith("#unevaluatedItems"))).reduce(((e,[a,,o])=>{const i=!1!==e&>.getKeyword(a).collectEvaluatedItems(o,t,r,n);return!1!==i&&new Set([...e,...i])}),new Set)}},Ot={metaData:xt,validate:wt},Et={Core:gt,Schema:Ge,Instance:D,Reference:P,Keywords:Ot,InvalidSchemaError:Ye},It=Et.Core,St=Et.Schema,jt=Et.Instance,Pt=Et.Reference,At=Et.Keywords,Tt=Et.InvalidSchemaError;export{It as Core,jt as Instance,Tt as InvalidSchemaError,At as Keywords,Pt as Reference,St as Schema,Et as default}; | ||
import e from"url-resolve-browser";var t=function(e,t){return function r(){null==t&&(t=e.length);var n=[].slice.call(arguments);return n.length>=t?e.apply(this,n):function(){return r.apply(this,n.concat([].slice.call(arguments)))}}};var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var n,o=(function(e,t){var n;n={},("object"==typeof window&&window||r).PubSub=n,function(e){var t={},r=-1,n="*";function o(e){var t;for(t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function a(e){return function(){throw e}}function i(e,t,r){try{e(t,r)}catch(e){setTimeout(a(e),0)}}function s(e,t,r){e(t,r)}function c(e,r,n,o){var a,c=t[r],l=o?s:i;if(Object.prototype.hasOwnProperty.call(t,r))for(a in c)Object.prototype.hasOwnProperty.call(c,a)&&l(c[a],e,n)}function l(e,t,r){return function(){var o=String(e),a=o.lastIndexOf(".");for(c(e,e,t,r);-1!==a;)a=(o=o.substr(0,a)).lastIndexOf("."),c(e,o,t,r);c(e,n,t,r)}}function u(e){var r=String(e);return Boolean(Object.prototype.hasOwnProperty.call(t,r)&&o(t[r]))}function p(e){for(var t=String(e),r=u(t)||u(n),o=t.lastIndexOf(".");!r&&-1!==o;)o=(t=t.substr(0,o)).lastIndexOf("."),r=u(t);return r}function f(e,t,r,n){var o=l(e="symbol"==typeof e?e.toString():e,t,n);return!!p(e)&&(!0===r?o():setTimeout(o,0),!0)}e.publish=function(t,r){return f(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return f(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,Object.prototype.hasOwnProperty.call(t,e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeAll=function(t){return e.subscribe(n,t)},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n,o=0;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)){for(n in t[r])o++;break}return o},e.getSubscriptions=function(e){var r,n=[];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,a,i=function(e){var r;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e))return!0;return!1},s="string"==typeof r&&(Object.prototype.hasOwnProperty.call(t,r)||i(r)),c=!s&&"string"==typeof r,l="function"==typeof r,u=!1;if(!s){for(n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(o=t[n],c&&o[r]){delete o[r],u=r;break}if(l)for(a in o)Object.prototype.hasOwnProperty.call(o,a)&&o[a]===r&&(delete o[a],u=!0)}return u}e.clearSubscriptions(r)}}(n),void 0!==e&&e.exports&&(t=e.exports=n),t.PubSub=n,e.exports=t=n}(n={exports:{}},n.exports),n.exports);o.PubSub;const a={null:e=>null===e,boolean:e=>"boolean"==typeof e,object:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,array:e=>Array.isArray(e),number:e=>"number"==typeof e,integer:e=>Number.isInteger(e),string:e=>"string"==typeof e},i=e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),o=e.slice(r+1);return[decodeURI(n),decodeURI(o)]},s=e=>{const t=RegExp(/^(.+):\/\//).exec(e);return t?t[1]:""};var c={jsonTypeOf:(e,t)=>a[t](e),splitUrl:i,safeResolveUrl:(t,r)=>{const n=e(t,r),o=i(t)[0];if(o&&"file"===s(n)&&"file"!==s(o))throw Error(`Can't access file '${n}' resource from network context '${t}'`);return n}};const l=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(v)},u=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:u(e,b(t,o,n),r,y(o,n))}}if(Array.isArray(t)){const n=[...t];return n[m(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:b(t,e[0],n)},p=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||w(t)){const o=e.shift();p(e,b(t,o,n),r,y(o,n))}else{t[m(t,e[0])]=r}},f=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=b(t,n,r);return{...t,[n]:f(e,o,y(n,r))}}if(Array.isArray(t))return t.filter(((t,r)=>r!=e[0]));if("object"==typeof t&&null!==t){const{[e[0]]:r,...n}=t;return n}return b(t,e[0],r)}},d=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=b(t,n,r);d(e,o,y(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:b(t,e[0],r)},y=t(((e,t)=>t+"/"+h(e))),h=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),v=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),m=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,b=(e,t,r="")=>{if(void 0===e)throw TypeError(`Value at '${r}' is undefined and does not have property '${t}'`);if(null===e)throw TypeError(`Value at '${r}' is null and does not have property '${t}'`);if(w(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[m(e,t)]},w=e=>null===e||"object"!=typeof e;var g={nil:"",append:y,get:(e,t)=>{const r=l(e),n=e=>r.reduce((([e,t],r)=>[b(e,r,t),y(r,t)]),[e,""])[0];return void 0===t?n:n(t)},set:(e,r,n)=>{const o=l(e),a=t(((e,t)=>u(o,e,t,"")));return void 0===r?a:a(r,n)},assign:(e,r,n)=>{const o=l(e),a=t(((e,t)=>p(o,e,t,"")));return void 0===r?a:a(r,n)},unset:(e,t)=>{const r=l(e),n=e=>f(r,e,"");return void 0===t?n:n(t)},remove:(e,t)=>{const r=l(e),n=e=>d(r,e,"");return void 0===t?n:n(t)}};g.nil,g.append,g.get,g.set,g.assign,g.unset,g.remove;const O=Symbol("$__value"),E=Symbol("$__href");var j={cons:(e,t)=>Object.freeze({[E]:e,[O]:t}),isReference:e=>e&&void 0!==e[E],href:e=>e[E],value:e=>e[O]};const{jsonTypeOf:$}=c,S=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),A=e=>j.isReference(e.value)?j.value(e.value):e.value,I=t(((e,t)=>$(A(e),t))),T=(e,t)=>Object.freeze({...t,pointer:g.append(e,t.pointer),value:A(t)[e]}),k=t(((e,t)=>A(t).map(((r,n,o,a)=>e(T(n,t),n,o,a))))),x=t(((e,t)=>A(t).map(((e,r,n,o)=>T(r,t))).filter(((t,r,n,o)=>e(t,r,n,o))))),P=t(((e,t,r)=>A(r).reduce(((t,n,o)=>e(t,T(o,r),o)),t))),V=t(((e,t)=>A(t).every(((r,n,o,a)=>e(T(n,t),n,o,a))))),R=t(((e,t)=>A(t).some(((r,n,o,a)=>e(T(n,t),n,o,a)))));var U={nil:S,cons:(e,t="")=>Object.freeze({...S,id:t,instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:A,has:(e,t)=>e in A(t),typeOf:I,step:T,entries:e=>Object.keys(A(e)).map((t=>[t,T(t,e)])),keys:e=>Object.keys(A(e)),map:k,filter:x,reduce:P,every:V,some:R,length:e=>A(e).length},C=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,K=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,L=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,z=/\\([\u000b\u0020-\u00ff])/g,_=/([\\"])/g,D=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function N(e){var t=String(e);if(L.test(t))return t;if(t.length>0&&!K.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(_,"\\$1")+'"'}function q(e){this.parameters=Object.create(null),this.type=e}var B={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!D.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,a=Object.keys(t).sort(),i=0;i<a.length;i++){if(o=a[i],!L.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+N(t[o])}return n},parse:function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;"function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.substr(0,r).trim():t.trim();if(!D.test(n))throw new TypeError("invalid media type");var o=new q(n.toLowerCase());if(-1!==r){var a,i,s;for(C.lastIndex=r;i=C.exec(t);){if(i.index!==r)throw new TypeError("invalid parameter format");r+=i[0].length,a=i[1].toLowerCase(),'"'===(s=i[2])[0]&&(s=s.substr(1,s.length-2).replace(z,"$1")),o.parameters[a]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},F=async e=>Object.entries(await e),Z=t((async(e,t)=>(await t).map(e))),J=t((async(e,t,r)=>(await r).reduce((async(t,r)=>e(await t,r)),t))),M=t((async(e,t,r={})=>J((async(t,r)=>await e(r)?t.concat([r]):t),[],t,r))),G=t((async(e,t)=>{const r=await Z(e,t);return(await Promise.all(r)).some((e=>e))})),H=t((async(e,t)=>{const r=await Z(e,t);return(await Promise.all(r)).every((e=>e))})),W=t(((e,t)=>e.reduce((async(e,t)=>t(await e)),t))),Q={entries:F,map:Z,filter:M,reduce:J,some:G,every:H,pipeline:W,all:e=>Promise.all(e),allValues:e=>W([F,J((async(e,[t,r])=>(e[t]=await r,e)),{})],e)};Q.entries,Q.map,Q.filter,Q.reduce,Q.some,Q.every,Q.pipeline,Q.all,Q.allValues;var X=fetch;const{jsonTypeOf:Y,splitUrl:ee,safeResolveUrl:te}=c,re={},ne={},oe=(e,t)=>{const r=e in ne?ne[e]:e;if(r in re)return re[r][t]},ae={},ie={},se=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=ee(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=oe(n,"baseToken"),a=oe(n,"anchorToken"),i=ee(t)[0];if(!i&&!ee(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const s=te(i,e[o]||""),[c,l]=ee(s);delete e[o],l&&o===a&&(e[a]=a!==o?encodeURI(l):`#${encodeURI(l)}`),i&&(ie[i]=c);const u={},p=oe(n,"recursiveAnchorToken");let f;!0===e[p]&&(u[""]=`${c}#`,e[a]="",delete e[p]);const d=oe(n,"vocabularyToken");Y(e[d],"object")?(ne[c]=n,f=e[d],delete e[d]):(ne[c]=n,f={[n]:!0});const y={"":""};return ae[c]={id:c,schemaVersion:n,schema:ce(e,c,n,g.nil,y,u),anchors:y,dynamicAnchors:u,vocabulary:f,validated:!1},c},ce=(e,t,r,n,o,a)=>{if(Y(e,"object")){const i="string"==typeof e.$schema?ee(e.$schema)[0]:r,s=oe(i,"embeddedToken"),c=oe(i,"anchorToken");if("string"==typeof e[s]&&(s!==c||"#"!==e[s][0])){const n=te(t,e[s]);return e[s]=n,se(e,n,r),j.cons(e[s],e)}const l=oe(r,"anchorToken"),u=oe(r,"dynamicAnchorToken");"string"==typeof e[u]&&(a[e[u]]=`${t}#${encodeURI(n)}`,o[e[u]]=n,delete e[u]);const p=oe(r,"embeddedToken");if("string"==typeof e[l]){const t=l!==p?e[l]:e[l].slice(1);o[t]=n,delete e[l]}const f=oe(r,"jrefToken");if("string"==typeof e[f])return j.cons(e[f],e);for(const i in e)e[i]=ce(e[i],t,r,g.append(i,n),o,a);return e}return Array.isArray(e)?e.map(((e,i)=>ce(e,t,r,g.append(i,n),o,a))):e},le=e=>ae[ie[e]]||ae[e],ue=Object.freeze({id:"",schemaVersion:void 0,vocabulary:{},pointer:g.nil,schema:void 0,value:void 0,anchors:{},dynamicAnchors:{},validated:!0}),pe=async(e,t=ue)=>{const r=te(ye(t),e),[n,o]=ee(r);if(!(e=>e in ae||e in ie)(n)){const e=await X(n,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error(`Failed to retrieve schema with id: ${n}`);if(e.headers.has("content-type")){const t=B.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${n} is not a schema. Found a document with media type: ${t}`)}se(await e.json(),n)}const a=le(n),i="/"!==o[0]?de(a,o):o,s=Object.freeze({...a,pointer:i,value:g.get(i,a.schema)});return fe(s)},fe=e=>j.isReference(e.value)?pe(j.href(e.value),e):e,de=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},ye=e=>`${e.id}#${encodeURI(e.pointer)}`,he=e=>j.isReference(e.value)?j.value(e.value):e.value,ve=(e,t)=>{const r=le(t.id),n=Object.freeze({...t,pointer:g.append(e,t.pointer),value:he(t)[e],validated:r.validated});return fe(n)},me=t(((e,t)=>Q.pipeline([he,Q.map((async(r,n)=>e(await ve(n,t),n))),Q.all],t)));var be={setConfig:(e,t,r)=>{re[e]||(re[e]={}),re[e][t]=r},getConfig:oe,add:se,get:pe,markValidated:e=>{ae[e].validated=!0},uri:ye,value:he,getAnchorPointer:de,typeOf:(e,t)=>Y(he(e),t),has:(e,t)=>e in he(t),step:ve,keys:e=>Object.keys(he(e)),entries:e=>Q.pipeline([he,Object.keys,Q.map((async t=>[t,await ve(t,e)])),Q.all],e),map:me,length:e=>he(e).length};be.setConfig,be.getConfig,be.add,be.get,be.markValidated,be.uri,be.value,be.getAnchorPointer,be.typeOf,be.has,be.step,be.keys,be.entries,be.map,be.length;class we extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var ge=we;const{splitUrl:Oe}=c,Ee="FLAG",je="BASIC",$e="DETAILED",Se="VERBOSE";let Ae=$e,Ie=!0;const Te=async e=>{const t={metaData:{}};return{ast:t,schemaUri:await Ke(e,t)}},ke=t((({ast:e,schemaUri:t},r,n=Ee)=>{if(![Ee,je,$e,Se].includes(n))throw Error(`The '${n}' error format is not supported`);const a=[],i=o.subscribe("result",xe(n,a));return ze(t,r,e,{}),o.unsubscribe(i),a[0]})),xe=(e,t)=>{const r=[];return(n,o)=>{if("result"===n){const{keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:a}=o,i={keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:a,errors:[]};r.push(i)}else if("result.start"===n)r.push(n);else if("result.end"===n){const n=r.pop();for(;"result.start"!==r[r.length-1];){const t=r.pop(),o=[t];e===je&&(o.push(...t.errors),delete t.errors),(e===Se||e!==Ee&&!t.valid)&&n.errors.unshift(...o)}r[r.length-1]=n,t[0]=n}}},Pe={},Ve=e=>Pe[e],Re=e=>e in Pe,Ue={},Ce={},Ke=async(e,t)=>{if(e=await Le(e),!Re(`${e.schemaVersion}#validate`)){const t=await be.get(e.schemaVersion);(be.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 Ue)Object.entries(Ue[e]).forEach((([e,r])=>{((e,t)=>{Pe[e]={collectEvaluatedItems:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&new Set,collectEvaluatedProperties:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&[],...t}})(`${t.id}#${e}`,r)}));else if(r)throw Error(`Missing required vocabulary: ${e}`)}))}if(Ie&&!e.validated){if(be.markValidated(e.id),!(e.schemaVersion in Ce)){const t=await be.get(e.schemaVersion),r=await Te(t);Ce[t.id]=ke(r)}const t=U.cons(e.schema,e.id),r=Ce[e.schemaVersion](t,Ae);if(!r.valid)throw new ge(r)}return e.id in t.metaData||(t.metaData[e.id]={id:e.id,dynamicAnchors:e.dynamicAnchors,anchors:e.anchors}),Ve(`${e.schemaVersion}#validate`).compile(e,t)},Le=async e=>be.typeOf(e,"string")?Le(await be.get(be.value(e),e)):e,ze=(e,t,r,n)=>{const o=_e(e,r),a=Oe(e)[0];return Ve(o).interpret(e,t,r,{...r.metaData[a].dynamicAnchors,...n})},_e=(e,t)=>{if(!(e in t))throw Error(`No schema found at ${e}`);return t[e][0]};var De={validate:async(e,t,r)=>{const n=await Te(e),o=(e,t)=>ke(n,U.cons(e),t);return void 0===t?o:o(t,r)},compile:Te,interpret:ke,setMetaOutputFormat:e=>{Ae=e},setShouldMetaValidate:e=>{Ie=e},FLAG:Ee,BASIC:je,DETAILED:$e,VERBOSE:Se,add:(e,t="",r="")=>{const n=be.add(e,t,r);delete Ce[n]},getKeyword:Ve,hasKeyword:Re,defineVocabulary:(e,t)=>{Ue[e]=t},compileSchema:Ke,interpretSchema:ze,collectEvaluatedProperties:(e,t,r,n,o)=>{const a=_e(e,r);return Ve(a).collectEvaluatedProperties(e,t,r,n,o)},collectEvaluatedItems:(e,t,r,n,o)=>{const a=_e(e,r);return Ve(a).collectEvaluatedItems(e,t,r,n,o)}};var Ne={compile:e=>be.value(e),interpret:()=>!0};var qe={compile:async(e,t)=>{const r=be.uri(e);if(!(r in t)){t[r]=!1;const n=be.value(e);if(!["object","boolean"].includes(typeof n))throw Error(`No schema found at '${be.uri(e)}'`);t[r]=[`${e.schemaVersion}#validate`,be.uri(e),"boolean"==typeof n?n:await Q.pipeline([be.entries,Q.map((([t,r])=>[`${e.schemaVersion}#${t}`,r])),Q.filter((([t])=>De.hasKeyword(t)&&t!==`${e.schemaVersion}#validate`)),Q.map((async([r,n])=>{const o=await De.getKeyword(r).compile(n,t,e);return[r,be.uri(n),o]})),Q.all],e)]}return r},interpret:(e,t,r,n)=>{const[a,i,s]=r[e];o.publishSync("result.start");const c="boolean"==typeof s?s:s.every((([e,a,i])=>{o.publishSync("result.start");const s=De.getKeyword(e).interpret(i,t,r,n);return o.publishSync("result",{keyword:e,absoluteKeywordLocation:a,instanceLocation:U.uri(t),valid:s,ast:i}),o.publishSync("result.end"),s}));return o.publishSync("result",{keyword:a,absoluteKeywordLocation:i,instanceLocation:U.uri(t),valid:c,ast:e}),o.publishSync("result.end"),c},collectEvaluatedProperties:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&[]:a.filter((([e])=>!o||!e.endsWith("#unevaluatedProperties"))).reduce(((e,[o,,a])=>{const i=e&&De.getKeyword(o).collectEvaluatedProperties(a,t,r,n);return!1!==i&&[...e,...i]}),[])},collectEvaluatedItems:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&new Set:a.filter((([e])=>!o||!e.endsWith("#unevaluatedItems"))).reduce(((e,[o,,a])=>{const i=!1!==e&&De.getKeyword(o).collectEvaluatedItems(a,t,r,n);return!1!==i&&new Set([...e,...i])}),new Set)}},Be={metaData:Ne,validate:qe},Fe={Core:De,Schema:be,Instance:U,Reference:j,Keywords:Be,InvalidSchemaError:ge},Ze=Fe.Core,Je=Fe.Schema,Me=Fe.Instance,Ge=Fe.Reference,He=Fe.Keywords,We=Fe.InvalidSchemaError;export{Ze as Core,Me as Instance,We as InvalidSchemaError,He as Keywords,Ge as Reference,Je as Schema,Fe as default}; | ||
//# sourceMappingURL=json-schema-core-esm.min.js.map |
@@ -1,2 +0,2 @@ | ||
var JSC=function(e,t){"use strict";function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=r(t),a=function(e,t){return function r(){null==t&&(t=e.length);var n=[].slice.call(arguments);return n.length>=t?e.apply(this,n):function(){return r.apply(this,n.concat([].slice.call(arguments)))}}};var o="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var i,s=(function(e,t){var r,n;r="object"==typeof window&&window||o,n={},r.PubSub=n,function(e){var t={},r=-1,n="*";function a(e){var t;for(t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function o(e){return function(){throw e}}function i(e,t,r){try{e(t,r)}catch(e){setTimeout(o(e),0)}}function s(e,t,r){e(t,r)}function u(e,r,n,a){var o,u=t[r],l=a?s:i;if(Object.prototype.hasOwnProperty.call(t,r))for(o in u)Object.prototype.hasOwnProperty.call(u,o)&&l(u[o],e,n)}function l(e,t,r){return function(){var a=String(e),o=a.lastIndexOf(".");for(u(e,e,t,r);-1!==o;)o=(a=a.substr(0,o)).lastIndexOf("."),u(e,a,t,r);u(e,n,t,r)}}function c(e){var r=String(e);return Boolean(Object.prototype.hasOwnProperty.call(t,r)&&a(t[r]))}function f(e){for(var t=String(e),r=c(t)||c(n),a=t.lastIndexOf(".");!r&&-1!==a;)a=(t=t.substr(0,a)).lastIndexOf("."),r=c(t);return r}function h(e,t,r,n){var a=l(e="symbol"==typeof e?e.toString():e,t,n);return!!f(e)&&(!0===r?a():setTimeout(a,0),!0)}e.publish=function(t,r){return h(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return h(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,Object.prototype.hasOwnProperty.call(t,e)||(t[e]={});var a="uid_"+String(++r);return t[e][a]=n,a},e.subscribeAll=function(t){return e.subscribe(n,t)},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n,a=0;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)){for(n in t[r])a++;break}return a},e.getSubscriptions=function(e){var r,n=[];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,a,o,i=function(e){var r;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e))return!0;return!1},s="string"==typeof r&&(Object.prototype.hasOwnProperty.call(t,r)||i(r)),u=!s&&"string"==typeof r,l="function"==typeof r,c=!1;if(!s){for(n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(a=t[n],u&&a[r]){delete a[r],c=r;break}if(l)for(o in a)Object.prototype.hasOwnProperty.call(a,o)&&a[o]===r&&(delete a[o],c=!0)}return c}e.clearSubscriptions(r)}}(n),void 0!==e&&e.exports&&(t=e.exports=n),t.PubSub=n,e.exports=t=n}(i={exports:{}},i.exports),i.exports);s.PubSub;var u=function(e,t){if(e=e.trim(),(t=t.trim()).startsWith("about:"))return t;const r=function(e){const t={host:"",path:"",query:"",protocol:""};let r=e,n=e.indexOf("//");t.protocol=r.substring(0,n),n+=2;const a=e.indexOf("/",n),o=e.indexOf("?"),i=e.indexOf("#");-1!==i&&(r=r.substring(0,i));if(-1!==o){const e=r.substring(o);t.query=e,r=r.substring(0,o)}if(-1!==a){const e=r.substring(0,a);t.host=e,r=r.substring(a),t.path=r}else t.host=r;return t}(e),n=function(e){const t={href:e,hash:"",query:"",netPath:!1,absolutePath:!1,relativePath:!1};if(f.test(e))return t.netPath=!0,t;"/"===e[0]?t.absolutePath=!0:""!==e&&(t.relativePath=!0);let r=e;const n=e.indexOf("?"),a=e.indexOf("#");if(-1!==a){const e=r.substring(a);t.hash=e,r=r.substring(0,a)}if(-1!==n){const e=r.substring(n);t.query=e,r=r.substring(0,n)}return t.path=r,t}(t);if(!r.protocol&&!n.netPath)throw new Error("Error, protocol is not specified");if(n.netPath)return function(e){return e.startsWith("//")}(n.href)&&(n.href=r.protocol+n.href),function(e){const t=e.indexOf("//")+2,r=!e.includes("/",t),n=!e.includes("?",t),a=!e.includes("#",t);return r&&n&&a}(n.href)?l(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:a}=n;return r.host+c(e)+t+a}if(n.relativePath){const{path:e,query:t,hash:a}=n;let o,i=r.path,s=r.host;return 0===e.length?o=i:(i=i.substring(0,i.lastIndexOf("/")),o=c(i+"/"+e)),s+=""!==o||t||a?o+t+a:"/",s}{const{host:e,path:t,query:a}=r;return t||a?e+t+a+n.hash:l(e)}};function l(e){return e+("/"===e[e.length-1]?"":"/")}function c(e){let t=e.split("/");""===t[0]&&(t=t.slice(1));let r=[];return t.forEach(((e,n)=>{"."!==e&&(".."===e?r.pop():""===e&&n!==t.length-1||r.push(e))})),"/"+r.join("/")}const f=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");const h={null:e=>null===e,boolean:e=>"boolean"==typeof e,object:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,array:e=>Array.isArray(e),number:e=>"number"==typeof e,integer:e=>Number.isInteger(e),string:e=>"string"==typeof e},m=e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),a=e.slice(r+1);return[decodeURI(n),decodeURI(a)]},p=e=>{const t=RegExp(/^(.+):\/\//).exec(e);return t?t[1]:""};var d={jsonTypeOf:(e,t)=>h[t](e),splitUrl:m,safeResolveUrl:(e,t)=>{const r=u(e,t),n=m(e)[0];if(n&&"file"===p(r)&&"file"!==p(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r}};const y=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(E)},v=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const a=e.shift();return{...t,[a]:v(e,I(t,a,n),r,w(a,n))}}if(Array.isArray(t)){const n=[...t];return n[S(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:I(t,e[0],n)},b=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||j(t)){const a=e.shift();b(e,I(t,a,n),r,w(a,n))}else{t[S(t,e[0])]=r}},g=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),a=I(t,n,r);return{...t,[n]:g(e,a,w(n,r))}}if(Array.isArray(t))return t.filter(((t,r)=>r!=e[0]));if("object"==typeof t&&null!==t){const{[e[0]]:r,...n}=t;return n}return I(t,e[0],r)}},x=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),a=I(t,n,r);x(e,a,w(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:I(t,e[0],r)},w=a(((e,t)=>t+"/"+O(e))),O=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),E=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),S=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,I=(e,t,r="")=>{if(void 0===e)throw TypeError(`Value at '${r}' is undefined and does not have property '${t}'`);if(null===e)throw TypeError(`Value at '${r}' is null and does not have property '${t}'`);if(j(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[S(e,t)]},j=e=>null===e||"object"!=typeof e;var P={nil:"",append:w,get:(e,t)=>{const r=y(e),n=e=>r.reduce((([e,t],r)=>[I(e,r,t),w(r,t)]),[e,""])[0];return void 0===t?n:n(t)},set:(e,t,r)=>{const n=y(e),o=a(((e,t)=>v(n,e,t,"")));return void 0===t?o:o(t,r)},assign:(e,t,r)=>{const n=y(e),o=a(((e,t)=>b(n,e,t,"")));return void 0===t?o:o(t,r)},unset:(e,t)=>{const r=y(e),n=e=>g(r,e,"");return void 0===t?n:n(t)},remove:(e,t)=>{const r=y(e),n=e=>x(r,e,"");return void 0===t?n:n(t)}};P.nil,P.append,P.get,P.set,P.assign,P.unset,P.remove;const A=Symbol("$__value"),T=Symbol("$__href");var R={cons:(e,t)=>Object.freeze({[T]:e,[A]:t}),isReference:e=>e&&void 0!==e[T],href:e=>e[T],value:e=>e[A]};const{jsonTypeOf:$}=d,V=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),k=e=>R.isReference(e.value)?R.value(e.value):e.value,L=a(((e,t)=>$(k(e),t))),H=(e,t)=>Object.freeze({...t,pointer:P.append(e,t.pointer),value:k(t)[e]}),U=a(((e,t)=>k(t).map(((r,n,a,o)=>e(H(n,t),n,a,o))))),q=a(((e,t)=>k(t).map(((e,r,n,a)=>H(r,t))).filter(((t,r,n,a)=>e(t,r,n,a))))),D=a(((e,t,r)=>k(r).reduce(((t,n,a)=>e(t,H(a,r),a)),t))),_=a(((e,t)=>k(t).every(((r,n,a,o)=>e(H(n,t),n,a,o))))),C=a(((e,t)=>k(t).some(((r,n,a,o)=>e(H(n,t),n,a,o)))));var Q={nil:V,cons:(e,t="")=>Object.freeze({...V,id:t,instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:k,has:(e,t)=>e in k(t),typeOf:L,step:H,entries:e=>Object.keys(k(e)).map((t=>[t,H(t,e)])),keys:e=>Object.keys(k(e)),map:U,filter:q,reduce:D,every:_,some:C,length:e=>k(e).length},z=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,B=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,K=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,N=/\\([\u000b\u0020-\u00ff])/g,M=/([\\"])/g,J=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function F(e){var t=String(e);if(K.test(t))return t;if(t.length>0&&!B.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(M,"\\$1")+'"'}function W(e){this.parameters=Object.create(null),this.type=e}var Z={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!J.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var a,o=Object.keys(t).sort(),i=0;i<o.length;i++){if(a=o[i],!K.test(a))throw new TypeError("invalid parameter name");n+="; "+a+"="+F(t[a])}return n},parse:function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;"function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.substr(0,r).trim():t.trim();if(!J.test(n))throw new TypeError("invalid media type");var a=new W(n.toLowerCase());if(-1!==r){var o,i,s;for(z.lastIndex=r;i=z.exec(t);){if(i.index!==r)throw new TypeError("invalid parameter format");r+=i[0].length,o=i[1].toLowerCase(),'"'===(s=i[2])[0]&&(s=s.substr(1,s.length-2).replace(N,"$1")),a.parameters[o]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return a}},G=async e=>Object.entries(await e),X=a((async(e,t)=>(await t).map(e))),Y=a((async(e,t,r)=>(await r).reduce((async(t,r)=>e(await t,r)),t))),ee=a((async(e,t,r={})=>Y((async(t,r)=>await e(r)?t.concat([r]):t),[],t,r))),te=a((async(e,t)=>{const r=await X(e,t);return(await Promise.all(r)).some((e=>e))})),re=a((async(e,t)=>{const r=await X(e,t);return(await Promise.all(r)).every((e=>e))})),ne=a(((e,t)=>e.reduce((async(e,t)=>t(await e)),t))),ae={entries:G,map:X,filter:ee,reduce:Y,some:te,every:re,pipeline:ne,all:e=>Promise.all(e),allValues:e=>ne([G,Y((async(e,[t,r])=>(e[t]=await r,e)),{})],e)};ae.entries,ae.map,ae.filter,ae.reduce,ae.some,ae.every,ae.pipeline,ae.all,ae.allValues;var oe={ABSOLUTE:"absolute",PATH_RELATIVE:"pathRelative",ROOT_RELATIVE:"rootRelative",SHORTEST:"shortest"};function ie(e,t){var r=t.removeEmptyQueries&&e.extra.relation.minimumPort;return e.query.string[r?"stripped":"full"]}function se(e,t){return!e.extra.relation.minimumQuery||t.output===oe.ABSOLUTE||t.output===oe.ROOT_RELATIVE}function ue(e,t){var r=t.removeDirectoryIndexes&&e.extra.resourceIsIndex,n=e.extra.relation.minimumResource&&t.output!==oe.ABSOLUTE&&t.output!==oe.ROOT_RELATIVE;return!!e.resource&&!n&&!r}var le=function(e,t){var r="";return r+=function(e,t){var r="";return(e.extra.relation.maximumHost||t.output===oe.ABSOLUTE)&&(e.extra.relation.minimumScheme&&t.schemeRelative&&t.output!==oe.ABSOLUTE?r+="//":r+=e.scheme+"://"),r}(e,t),r+=function(e,t){return!e.auth||t.removeAuth||!e.extra.relation.maximumHost&&t.output!==oe.ABSOLUTE?"":e.auth+"@"}(e,t),r+=function(e,t){return e.host.full&&(e.extra.relation.maximumAuth||t.output===oe.ABSOLUTE)?e.host.full:""}(e,t),r+=function(e,t){return e.port&&!e.extra.portIsDefault&&e.extra.relation.maximumHost?":"+e.port:""}(e),r+=function(e,t){var r="",n=e.path.absolute.string,a=e.path.relative.string,o=ue(e,t);if(e.extra.relation.maximumHost||t.output===oe.ABSOLUTE||t.output===oe.ROOT_RELATIVE)r=n;else if(a.length<=n.length&&t.output===oe.SHORTEST||t.output===oe.PATH_RELATIVE){if(""===(r=a)){var i=se(e,t)&&!!ie(e,t);e.extra.relation.maximumPath&&!o?r="./":!e.extra.relation.overridesQuery||o||i||(r="./")}}else r=n;return"/"!==r||o||!t.removeRootTrailingSlash||e.extra.relation.minimumPort&&t.output!==oe.ABSOLUTE||(r=""),r}(e,t),r+=function(e,t){return ue(e,t)?e.resource:""}(e,t),r+=function(e,t){return se(e,t)?ie(e,t):""}(e,t),r+=function(e,t){return e.hash?e.hash:""}(e)};var ce={clone:function e(t){if(t instanceof Object){var r=t instanceof Array?[]:{};for(var n in t)t.hasOwnProperty(n)&&(r[n]=e(t[n]));return r}return t},isPlainObject:function(e){return!!e&&"object"==typeof e&&e.constructor===Object},shallowMerge:function(e,t){if(e instanceof Object&&t instanceof Object)for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e}};function fe(e,t){return t instanceof Object&&e instanceof Object?t instanceof Array&&e instanceof Array?t.concat(e):ce.shallowMerge(e,t):e}var he=function(e,t){if(ce.isPlainObject(e)){var r={};for(var n in t)t.hasOwnProperty(n)&&(void 0!==e[n]?r[n]=fe(e[n],t[n]):r[n]=t[n]);return r}return t};var me=function(e){var t=!(e.scheme||e.auth||e.host.full||e.port),r=t&&!e.path.absolute.string,n=r&&!e.resource,a=n&&!e.query.string.full.length,o=a&&!e.hash;e.extra.hrefInfo.minimumPathOnly=t,e.extra.hrefInfo.minimumResourceOnly=r,e.extra.hrefInfo.minimumQueryOnly=n,e.extra.hrefInfo.minimumHashOnly=a,e.extra.hrefInfo.empty=o};var pe=function(e,t){if(t.ignore_www){var r=e.host.full;if(r){var n=r;0===r.indexOf("www.")&&(n=r.substr(4)),e.host.stripped=n}}};function de(e){if("/"!==e){var t=[];return e.split("/").forEach((function(e){""!==e&&t.push(e)})),t}return[]}var ye=function(e,t){var r=e.path.absolute.string;if(r){var n=r.lastIndexOf("/");if(n>-1){if(++n<r.length){var a=r.substr(n);"."!==a&&".."!==a?(e.resource=a,r=r.substr(0,n)):r+="/"}e.path.absolute.string=r,e.path.absolute.array=de(r)}else"."===r||".."===r?(r+="/",e.path.absolute.string=r,e.path.absolute.array=de(r)):(e.resource=r,e.path.absolute.string=null);e.extra.resourceIsIndex=function(e,t){var r=!1;return t.directoryIndexes.every((function(t){return t!==e||(r=!0,!1)})),r}(e.resource,t)}};var ve=function(e,t){var r=-1;for(var n in t.defaultPorts)if(n===e.scheme&&t.defaultPorts.hasOwnProperty(n)){r=t.defaultPorts[n];break}r>-1&&(r=r.toString(),null===e.port&&(e.port=r),e.extra.portIsDefault=e.port===r)},be=Object.prototype.hasOwnProperty;function ge(e,t){var r=0,n="";for(var a in e)if(""!==a&&!0===be.call(e,a)){var o=e[a];""===o&&t||(n+=1==++r?"?":"&",a=encodeURIComponent(a),n+=""!==o?a+"="+encodeURIComponent(o).replace(/%20/g,"+"):a)}return n}var xe=function(e,t){e.query.string.full=ge(e.query.object,!1),t.removeEmptyQueries&&(e.query.string.stripped=ge(e.query.object,!0))},we=n.default.parse;var Oe=function(e,t){return function(e,t){var r=!0;return t.rejectedSchemes.every((function(t){return r=!(0===e.indexOf(t+":"))})),r}(e,t)?(r=we(e,!0,t.slashesDenoteHost),(n=r.protocol)&&n.indexOf(":")===n.length-1&&(n=n.substr(0,n.length-1)),r.host={full:r.hostname,stripped:null},r.path={absolute:{array:null,string:r.pathname},relative:{array:null,string:null}},r.query={object:r.query,string:{full:null,stripped:null}},r.extra={hrefInfo:{minimumPathOnly:null,minimumResourceOnly:null,minimumQueryOnly:null,minimumHashOnly:null,empty:null,separatorOnlyQuery:"?"===r.search},portIsDefault:null,relation:{maximumScheme:null,maximumAuth:null,maximumHost:null,maximumPort:null,maximumPath:null,maximumResource:null,maximumQuery:null,maximumHash:null,minimumScheme:null,minimumAuth:null,minimumHost:null,minimumPort:null,minimumPath:null,minimumResource:null,minimumQuery:null,minimumHash:null,overridesQuery:null},resourceIsIndex:null,slashes:r.slashes},r.resource=null,r.scheme=n,delete r.hostname,delete r.pathname,delete r.protocol,delete r.search,delete r.slashes,r):{href:e,valid:!1};var r,n};var Ee={join:function(e){return e.length>0?e.join("/")+"/":""},resolveDotSegments:function(e){var t=[];return e.forEach((function(e){".."!==e?"."!==e&&t.push(e):t.length>0&&t.splice(t.length-1,1)})),t}};function Se(e,t){var r=Oe(e,t);return!1===r.valid||(pe(r,t),ve(r,t),ye(r,t),xe(r,t),me(r)),r}var Ie={from:function(e,t,r){if(e){var n=Se(e,t),a=Ee.resolveDotSegments(n.path.absolute.array);return n.path.absolute.array=a,n.path.absolute.string="/"+Ee.join(a),n}return r},to:Se};var je={pathOn:function(e,t,r){var n=e.extra.hrefInfo.minimumQueryOnly,a=e.extra.hrefInfo.minimumHashOnly,o=e.extra.hrefInfo.empty,i=e.extra.relation.minimumPort,s=e.extra.relation.minimumScheme,u=i&&e.path.absolute.string===t.path.absolute.string,l=e.resource===t.resource||!e.resource&&t.extra.resourceIsIndex||r.removeDirectoryIndexes&&e.extra.resourceIsIndex&&!t.resource,c=u&&(l||n||a||o),f=r.removeEmptyQueries?"stripped":"full",h=e.query.string[f],m=t.query.string[f],p=c&&!!h&&h===m||(a||o)&&!e.extra.hrefInfo.separatorOnlyQuery,d=p&&e.hash===t.hash;e.extra.relation.minimumPath=u,e.extra.relation.minimumResource=c,e.extra.relation.minimumQuery=p,e.extra.relation.minimumHash=d,e.extra.relation.maximumPort=!s||s&&!u,e.extra.relation.maximumPath=!s||s&&!c,e.extra.relation.maximumResource=!s||s&&!p,e.extra.relation.maximumQuery=!s||s&&!d,e.extra.relation.maximumHash=!s||s&&!d,e.extra.relation.overridesQuery=u&&e.extra.relation.maximumResource&&!p&&!!m},upToPath:function(e,t,r){var n=e.extra.hrefInfo.minimumPathOnly,a=e.scheme===t.scheme||!e.scheme,o=a&&(e.auth===t.auth||r.removeAuth||n),i=r.ignore_www?"stripped":"full",s=o&&(e.host[i]===t.host[i]||n),u=s&&(e.port===t.port||n);e.extra.relation.minimumScheme=a,e.extra.relation.minimumAuth=o,e.extra.relation.minimumHost=s,e.extra.relation.minimumPort=u,e.extra.relation.maximumScheme=!a||a&&!o,e.extra.relation.maximumAuth=!a||a&&!s,e.extra.relation.maximumHost=!a||a&&!u}};var Pe=function(e,t,r){je.upToPath(e,t,r),e.extra.relation.minimumScheme&&(e.scheme=t.scheme),e.extra.relation.minimumAuth&&(e.auth=t.auth),e.extra.relation.minimumHost&&(e.host=ce.clone(t.host)),e.extra.relation.minimumPort&&function(e,t){e.port=t.port,e.extra.portIsDefault=t.extra.portIsDefault}(e,t),e.extra.relation.minimumScheme&&function(e,t){if(e.extra.relation.maximumHost||!e.extra.hrefInfo.minimumResourceOnly){var r=e.path.absolute.array,n="/";r?(e.extra.hrefInfo.minimumPathOnly&&0!==e.path.absolute.string.indexOf("/")&&(r=t.path.absolute.array.concat(r)),r=Ee.resolveDotSegments(r),n+=Ee.join(r)):r=[],e.path.absolute.array=r,e.path.absolute.string=n}else e.path=ce.clone(t.path)}(e,t),je.pathOn(e,t,r),e.extra.relation.minimumResource&&function(e,t){e.resource=t.resource,e.extra.resourceIsIndex=t.extra.resourceIsIndex}(e,t),e.extra.relation.minimumQuery&&(e.query=ce.clone(t.query)),e.extra.relation.minimumHash&&(e.hash=t.hash)};var Ae=function(e,t,r){if(e.extra.relation.minimumScheme){var n=(a=e.path.absolute.array,o=t.path.absolute.array,i=[],s=!0,u=-1,o.forEach((function(e,t){s&&(a[t]!==e?s=!1:u=t),s||i.push("..")})),a.forEach((function(e,t){t>u&&i.push(e)})),i);e.path.relative.array=n,e.path.relative.string=Ee.join(n)}var a,o,i,s,u};var Te=function(e,t,r){return Pe(t,e,r),Ae(t,e),t};function Re(e,t){this.options=he(t,{defaultPorts:{ftp:21,http:80,https:443},directoryIndexes:["index.html"],ignore_www:!1,output:Re.SHORTEST,rejectedSchemes:["data","javascript","mailto"],removeAuth:!1,removeDirectoryIndexes:!0,removeEmptyQueries:!1,removeRootTrailingSlash:!0,schemeRelative:!0,site:void 0,slashesDenoteHost:!0}),this.from=Ie.from(e,this.options,null)}Re.prototype.relate=function(e,t,r){if(ce.isPlainObject(t)?(r=t,t=e,e=null):t||(t=e,e=null),r=he(r,this.options),e=e||r.site,!(e=Ie.from(e,r,this.from))||!e.href)throw new Error("from value not defined.");if(e.extra.hrefInfo.minimumPathOnly)throw new Error("from value supplied is not absolute: "+e.href);return!1===(t=Ie.to(t,r)).valid?t.href:(t=Te(e,t,r),t=le(t,r))},Re.relate=function(e,t,r){return(new Re).relate(e,t,r)},ce.shallowMerge(Re,oe);var $e=Re,Ve=fetch;const{jsonTypeOf:ke,splitUrl:Le,safeResolveUrl:He}=d,Ue={},qe={},De=(e,t)=>{const r=e in qe?qe[e]:e;if(r in Ue)return Ue[r][t]},_e={},Ce={},Qe=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=Le(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const a=De(n,"baseToken"),o=De(n,"anchorToken"),i=Le(t)[0];if(!i&&!Le(e[a]||"")[0])throw Error("Couldn't determine an identifier for the schema");const s=He(i,e[a]||""),[u,l]=Le(s);delete e[a],l&&a===o&&(e[o]=o!==a?encodeURI(l):`#${encodeURI(l)}`),i&&(Ce[i]=u);const c={},f=De(n,"recursiveAnchorToken");let h;!0===e[f]&&(c[""]=`${u}#`,e[o]="",delete e[f]);const m=De(n,"vocabularyToken");ke(e[m],"object")?(qe[u]=n,h=e[m],delete e[m]):(qe[u]=n,h={[n]:!0});const p={"":""};return _e[u]={id:u,schemaVersion:n,schema:ze(e,u,n,P.nil,p,c),anchors:p,dynamicAnchors:c,vocabulary:h,validated:!1},u},ze=(e,t,r,n,a,o)=>{if(ke(e,"object")){const i="string"==typeof e.$schema?Le(e.$schema)[0]:r,s=De(i,"embeddedToken"),u=De(i,"anchorToken");if("string"==typeof e[s]&&(s!==u||"#"!==e[s][0])){const n=He(t,e[s]);return e[s]=n,Qe(e,n,r),R.cons(e[s],e)}const l=De(r,"anchorToken"),c=De(r,"dynamicAnchorToken");"string"==typeof e[c]&&(o[e[c]]=`${t}#${encodeURI(n)}`,a[e[c]]=n,delete e[c]);const f=De(r,"embeddedToken");if("string"==typeof e[l]){const t=l!==f?e[l]:e[l].slice(1);a[t]=n,delete e[l]}const h=De(r,"jrefToken");if("string"==typeof e[h])return R.cons(e[h],e);for(const i in e)e[i]=ze(e[i],t,r,P.append(i,n),a,o);return e}return Array.isArray(e)?e.map(((e,i)=>ze(e,t,r,P.append(i,n),a,o))):e},Be=e=>_e[Ce[e]]||_e[e],Ke=Object.freeze({id:"",schemaVersion:void 0,vocabulary:{},pointer:P.nil,schema:void 0,value:void 0,anchors:{},dynamicAnchors:{},validated:!0}),Ne=async(e,t=Ke)=>{const r=He(Fe(t),e),[n,a]=Le(r);if(!(e=>e in _e||e in Ce)(n)){const e=await Ve(n,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error(`Failed to retrieve schema with id: ${n}`);if(e.headers.has("content-type")){const t=Z.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${n} is not a schema. Found a document with media type: ${t}`)}Qe(await e.json(),n)}const o=Be(n),i="/"!==a[0]?Je(o,a):a,s=Object.freeze({...o,pointer:i,value:P.get(i,o.schema)});return Me(s)},Me=e=>R.isReference(e.value)?Ne(R.href(e.value),e):e,Je=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},Fe=e=>`${e.id}#${encodeURI(e.pointer)}`,We=e=>R.isReference(e.value)?R.value(e.value):e.value,Ze=(e,t)=>{const r=Be(t.id),n=Object.freeze({...t,pointer:P.append(e,t.pointer),value:We(t)[e],validated:r.validated});return Me(n)},Ge=a(((e,t)=>ae.pipeline([We,ae.map((async(r,n)=>e(await Ze(n,t),n))),ae.all],t))),Xe={parentId:"",parentDialect:"",includeEmbedded:!0},Ye=(e,t)=>t.startsWith("file://")?""===e?"":$e.relate(e,t):t;var et={setConfig:(e,t,r)=>{Ue[e]||(Ue[e]={}),Ue[e][t]=r},getConfig:De,add:Qe,get:Ne,markValidated:e=>{_e[e].validated=!0},uri:Fe,value:We,getAnchorPointer:Je,typeOf:(e,t)=>ke(We(e),t),has:(e,t)=>e in We(t),step:Ze,keys:e=>Object.keys(We(e)),entries:e=>ae.pipeline([We,Object.keys,ae.map((async t=>[t,await Ze(t,e)])),ae.all],e),map:Ge,length:e=>We(e).length,toSchema:(e,t={})=>{const r={...Xe,...t},n=JSON.parse(JSON.stringify(e.schema,((t,n)=>{if(!R.isReference(n))return n;const a=R.value(n),o=a.$schema||e.schemaVersion,i=De(o,"embeddedToken");return!r.includeEmbedded&&i in a?void 0:R.value(n)}))),a=De(e.schemaVersion,"dynamicAnchorToken");Object.entries(e.dynamicAnchors).forEach((([e,t])=>{const r=Le(t)[1];P.assign(r,n,{[a]:e,...P.get(r,n)})}));const o=De(e.schemaVersion,"anchorToken");Object.entries(e.anchors).filter((([e])=>""!==e)).forEach((([e,t])=>{P.assign(t,n,{[o]:e,...P.get(t,n)})}));const i=De(e.schemaVersion,"baseToken"),s=Ye(r.parentId,e.id),u=r.parentDialect===e.schemaVersion?"":e.schemaVersion;return{...s&&{[i]:s},...u&&{$schema:u},...n}}};et.setConfig,et.getConfig,et.add,et.get,et.markValidated,et.uri,et.value,et.getAnchorPointer,et.typeOf,et.has,et.step,et.keys,et.entries,et.map,et.length,et.toSchema;class tt extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var rt=tt;const{splitUrl:nt}=d,at="FLAG",ot="BASIC",it="DETAILED",st="VERBOSE";let ut=it,lt=!0;const ct=async e=>{const t={metaData:{}};return{ast:t,schemaUri:await bt(e,t)}},ft=a((({ast:e,schemaUri:t},r,n=at)=>{if(![at,ot,it,st].includes(n))throw Error(`The '${n}' error format is not supported`);const a=[],o=s.subscribe("result",ht(n,a));return xt(t,r,e,{}),s.unsubscribe(o),a[0]})),ht=(e,t)=>{const r=[];return(n,a)=>{if("result"===n){const{keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:o}=a,i={keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:o,errors:[]};r.push(i)}else if("result.start"===n)r.push(n);else if("result.end"===n){const n=r.pop();for(;"result.start"!==r[r.length-1];){const t=r.pop(),a=[t];e===ot&&(a.push(...t.errors),delete t.errors),(e===st||e!==at&&!t.valid)&&n.errors.unshift(...a)}r[r.length-1]=n,t[0]=n}}},mt={},pt=e=>mt[e],dt=e=>e in mt,yt={},vt={},bt=async(e,t)=>{if(e=await gt(e),!dt(`${e.schemaVersion}#validate`)){const t=await et.get(e.schemaVersion);(et.getConfig(t.id,"mandatoryVocabularies")||[]).forEach((e=>{if(!t.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)})),Object.entries(t.vocabulary).forEach((([e,r])=>{if(e in yt)Object.entries(yt[e]).forEach((([e,r])=>{((e,t)=>{mt[e]={collectEvaluatedItems:(e,r,n,a,o)=>t.interpret(e,r,n,a,o)&&new Set,collectEvaluatedProperties:(e,r,n,a,o)=>t.interpret(e,r,n,a,o)&&[],...t}})(`${t.id}#${e}`,r)}));else if(r)throw Error(`Missing required vocabulary: ${e}`)}))}if(lt&&!e.validated){if(et.markValidated(e.id),!(e.schemaVersion in vt)){const t=await et.get(e.schemaVersion),r=await ct(t);vt[t.id]=ft(r)}const t=Q.cons(e.schema,e.id),r=vt[e.schemaVersion](t,ut);if(!r.valid)throw new rt(r)}return e.id in t.metaData||(t.metaData[e.id]={id:e.id,dynamicAnchors:e.dynamicAnchors,anchors:e.anchors}),pt(`${e.schemaVersion}#validate`).compile(e,t)},gt=async e=>et.typeOf(e,"string")?gt(await et.get(et.value(e),e)):e,xt=(e,t,r,n)=>{const a=wt(e,r),o=nt(e)[0];return pt(a).interpret(e,t,r,{...r.metaData[o].dynamicAnchors,...n})},wt=(e,t)=>{if(!(e in t))throw Error(`No schema found at ${e}`);return t[e][0]};var Ot={validate:async(e,t,r)=>{const n=await ct(e),a=(e,t)=>ft(n,Q.cons(e),t);return void 0===t?a:a(t,r)},compile:ct,interpret:ft,setMetaOutputFormat:e=>{ut=e},setShouldMetaValidate:e=>{lt=e},FLAG:at,BASIC:ot,DETAILED:it,VERBOSE:st,add:(e,t="",r="")=>{const n=et.add(e,t,r);delete vt[n]},getKeyword:pt,hasKeyword:dt,defineVocabulary:(e,t)=>{yt[e]=t},compileSchema:bt,interpretSchema:xt,collectEvaluatedProperties:(e,t,r,n,a)=>{const o=wt(e,r);return pt(o).collectEvaluatedProperties(e,t,r,n,a)},collectEvaluatedItems:(e,t,r,n,a)=>{const o=wt(e,r);return pt(o).collectEvaluatedItems(e,t,r,n,a)}};var Et={compile:e=>et.value(e),interpret:()=>!0};var St={compile:async(e,t)=>{const r=et.uri(e);if(!(r in t)){t[r]=!1;const n=et.value(e);if(!["object","boolean"].includes(typeof n))throw Error(`No schema found at '${et.uri(e)}'`);t[r]=[`${e.schemaVersion}#validate`,et.uri(e),"boolean"==typeof n?n:await ae.pipeline([et.entries,ae.map((([t,r])=>[`${e.schemaVersion}#${t}`,r])),ae.filter((([t])=>Ot.hasKeyword(t)&&t!==`${e.schemaVersion}#validate`)),ae.map((async([r,n])=>{const a=await Ot.getKeyword(r).compile(n,t,e);return[r,et.uri(n),a]})),ae.all],e)]}return r},interpret:(e,t,r,n)=>{const[a,o,i]=r[e];s.publishSync("result.start");const u="boolean"==typeof i?i:i.every((([e,a,o])=>{s.publishSync("result.start");const i=Ot.getKeyword(e).interpret(o,t,r,n);return s.publishSync("result",{keyword:e,absoluteKeywordLocation:a,instanceLocation:Q.uri(t),valid:i,ast:o}),s.publishSync("result.end"),i}));return s.publishSync("result",{keyword:a,absoluteKeywordLocation:o,instanceLocation:Q.uri(t),valid:u,ast:e}),s.publishSync("result.end"),u},collectEvaluatedProperties:(e,t,r,n,a=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter((([e])=>!a||!e.endsWith("#unevaluatedProperties"))).reduce(((e,[a,,o])=>{const i=e&&Ot.getKeyword(a).collectEvaluatedProperties(o,t,r,n);return!1!==i&&[...e,...i]}),[])},collectEvaluatedItems:(e,t,r,n,a=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&new Set:o.filter((([e])=>!a||!e.endsWith("#unevaluatedItems"))).reduce(((e,[a,,o])=>{const i=!1!==e&&Ot.getKeyword(a).collectEvaluatedItems(o,t,r,n);return!1!==i&&new Set([...e,...i])}),new Set)}},It={metaData:Et,validate:St},jt={Core:Ot,Schema:et,Instance:Q,Reference:R,Keywords:It,InvalidSchemaError:rt},Pt=jt.Core,At=jt.Schema,Tt=jt.Instance,Rt=jt.Reference,$t=jt.Keywords,Vt=jt.InvalidSchemaError;return e.Core=Pt,e.Instance=Tt,e.InvalidSchemaError=Vt,e.Keywords=$t,e.Reference=Rt,e.Schema=At,e.default=jt,Object.defineProperty(e,"__esModule",{value:!0}),e}({},url); | ||
var JSC=function(e,t){"use strict";function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=r(t),o=function(e,t){return function r(){null==t&&(t=e.length);var n=[].slice.call(arguments);return n.length>=t?e.apply(this,n):function(){return r.apply(this,n.concat([].slice.call(arguments)))}}};var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var i,s=(function(e,t){var r,n;r="object"==typeof window&&window||a,n={},r.PubSub=n,function(e){var t={},r=-1,n="*";function o(e){var t;for(t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function a(e){return function(){throw e}}function i(e,t,r){try{e(t,r)}catch(e){setTimeout(a(e),0)}}function s(e,t,r){e(t,r)}function c(e,r,n,o){var a,c=t[r],l=o?s:i;if(Object.prototype.hasOwnProperty.call(t,r))for(a in c)Object.prototype.hasOwnProperty.call(c,a)&&l(c[a],e,n)}function l(e,t,r){return function(){var o=String(e),a=o.lastIndexOf(".");for(c(e,e,t,r);-1!==a;)a=(o=o.substr(0,a)).lastIndexOf("."),c(e,o,t,r);c(e,n,t,r)}}function u(e){var r=String(e);return Boolean(Object.prototype.hasOwnProperty.call(t,r)&&o(t[r]))}function f(e){for(var t=String(e),r=u(t)||u(n),o=t.lastIndexOf(".");!r&&-1!==o;)o=(t=t.substr(0,o)).lastIndexOf("."),r=u(t);return r}function p(e,t,r,n){var o=l(e="symbol"==typeof e?e.toString():e,t,n);return!!f(e)&&(!0===r?o():setTimeout(o,0),!0)}e.publish=function(t,r){return p(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return p(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,Object.prototype.hasOwnProperty.call(t,e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeAll=function(t){return e.subscribe(n,t)},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n,o=0;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)){for(n in t[r])o++;break}return o},e.getSubscriptions=function(e){var r,n=[];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,a,i=function(e){var r;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e))return!0;return!1},s="string"==typeof r&&(Object.prototype.hasOwnProperty.call(t,r)||i(r)),c=!s&&"string"==typeof r,l="function"==typeof r,u=!1;if(!s){for(n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(o=t[n],c&&o[r]){delete o[r],u=r;break}if(l)for(a in o)Object.prototype.hasOwnProperty.call(o,a)&&o[a]===r&&(delete o[a],u=!0)}return u}e.clearSubscriptions(r)}}(n),void 0!==e&&e.exports&&(t=e.exports=n),t.PubSub=n,e.exports=t=n}(i={exports:{}},i.exports),i.exports);s.PubSub;const c={null:e=>null===e,boolean:e=>"boolean"==typeof e,object:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,array:e=>Array.isArray(e),number:e=>"number"==typeof e,integer:e=>Number.isInteger(e),string:e=>"string"==typeof e},l=e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),o=e.slice(r+1);return[decodeURI(n),decodeURI(o)]},u=e=>{const t=RegExp(/^(.+):\/\//).exec(e);return t?t[1]:""};var f={jsonTypeOf:(e,t)=>c[t](e),splitUrl:l,safeResolveUrl:(e,t)=>{const r=n.default(e,t),o=l(e)[0];if(o&&"file"===u(r)&&"file"!==u(o))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r}};const p=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(w)},d=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:d(e,O(t,o,n),r,m(o,n))}}if(Array.isArray(t)){const n=[...t];return n[g(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:O(t,e[0],n)},y=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||j(t)){const o=e.shift();y(e,O(t,o,n),r,m(o,n))}else{t[g(t,e[0])]=r}},h=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=O(t,n,r);return{...t,[n]:h(e,o,m(n,r))}}if(Array.isArray(t))return t.filter(((t,r)=>r!=e[0]));if("object"==typeof t&&null!==t){const{[e[0]]:r,...n}=t;return n}return O(t,e[0],r)}},v=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=O(t,n,r);v(e,o,m(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:O(t,e[0],r)},m=o(((e,t)=>t+"/"+b(e))),b=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),w=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),g=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,O=(e,t,r="")=>{if(void 0===e)throw TypeError(`Value at '${r}' is undefined and does not have property '${t}'`);if(null===e)throw TypeError(`Value at '${r}' is null and does not have property '${t}'`);if(j(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[g(e,t)]},j=e=>null===e||"object"!=typeof e;var E={nil:"",append:m,get:(e,t)=>{const r=p(e),n=e=>r.reduce((([e,t],r)=>[O(e,r,t),m(r,t)]),[e,""])[0];return void 0===t?n:n(t)},set:(e,t,r)=>{const n=p(e),a=o(((e,t)=>d(n,e,t,"")));return void 0===t?a:a(t,r)},assign:(e,t,r)=>{const n=p(e),a=o(((e,t)=>y(n,e,t,"")));return void 0===t?a:a(t,r)},unset:(e,t)=>{const r=p(e),n=e=>h(r,e,"");return void 0===t?n:n(t)},remove:(e,t)=>{const r=p(e),n=e=>v(r,e,"");return void 0===t?n:n(t)}};E.nil,E.append,E.get,E.set,E.assign,E.unset,E.remove;const $=Symbol("$__value"),S=Symbol("$__href");var A={cons:(e,t)=>Object.freeze({[S]:e,[$]:t}),isReference:e=>e&&void 0!==e[S],href:e=>e[S],value:e=>e[$]};const{jsonTypeOf:I}=f,T=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),k=e=>A.isReference(e.value)?A.value(e.value):e.value,P=o(((e,t)=>I(k(e),t))),x=(e,t)=>Object.freeze({...t,pointer:E.append(e,t.pointer),value:k(t)[e]}),V=o(((e,t)=>k(t).map(((r,n,o,a)=>e(x(n,t),n,o,a))))),R=o(((e,t)=>k(t).map(((e,r,n,o)=>x(r,t))).filter(((t,r,n,o)=>e(t,r,n,o))))),C=o(((e,t,r)=>k(r).reduce(((t,n,o)=>e(t,x(o,r),o)),t))),U=o(((e,t)=>k(t).every(((r,n,o,a)=>e(x(n,t),n,o,a))))),K=o(((e,t)=>k(t).some(((r,n,o,a)=>e(x(n,t),n,o,a)))));var L={nil:T,cons:(e,t="")=>Object.freeze({...T,id:t,instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:k,has:(e,t)=>e in k(t),typeOf:P,step:x,entries:e=>Object.keys(k(e)).map((t=>[t,x(t,e)])),keys:e=>Object.keys(k(e)),map:V,filter:R,reduce:C,every:U,some:K,length:e=>k(e).length},z=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,_=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,D=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,N=/\\([\u000b\u0020-\u00ff])/g,B=/([\\"])/g,q=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function F(e){var t=String(e);if(D.test(t))return t;if(t.length>0&&!_.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(B,"\\$1")+'"'}function Z(e){this.parameters=Object.create(null),this.type=e}var J={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!q.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,a=Object.keys(t).sort(),i=0;i<a.length;i++){if(o=a[i],!D.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+F(t[o])}return n},parse:function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;"function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.substr(0,r).trim():t.trim();if(!q.test(n))throw new TypeError("invalid media type");var o=new Z(n.toLowerCase());if(-1!==r){var a,i,s;for(z.lastIndex=r;i=z.exec(t);){if(i.index!==r)throw new TypeError("invalid parameter format");r+=i[0].length,a=i[1].toLowerCase(),'"'===(s=i[2])[0]&&(s=s.substr(1,s.length-2).replace(N,"$1")),o.parameters[a]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},M=async e=>Object.entries(await e),G=o((async(e,t)=>(await t).map(e))),H=o((async(e,t,r)=>(await r).reduce((async(t,r)=>e(await t,r)),t))),W=o((async(e,t,r={})=>H((async(t,r)=>await e(r)?t.concat([r]):t),[],t,r))),Q=o((async(e,t)=>{const r=await G(e,t);return(await Promise.all(r)).some((e=>e))})),X=o((async(e,t)=>{const r=await G(e,t);return(await Promise.all(r)).every((e=>e))})),Y=o(((e,t)=>e.reduce((async(e,t)=>t(await e)),t))),ee={entries:M,map:G,filter:W,reduce:H,some:Q,every:X,pipeline:Y,all:e=>Promise.all(e),allValues:e=>Y([M,H((async(e,[t,r])=>(e[t]=await r,e)),{})],e)};ee.entries,ee.map,ee.filter,ee.reduce,ee.some,ee.every,ee.pipeline,ee.all,ee.allValues;var te=fetch;const{jsonTypeOf:re,splitUrl:ne,safeResolveUrl:oe}=f,ae={},ie={},se=(e,t)=>{const r=e in ie?ie[e]:e;if(r in ae)return ae[r][t]},ce={},le={},ue=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=ne(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=se(n,"baseToken"),a=se(n,"anchorToken"),i=ne(t)[0];if(!i&&!ne(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const s=oe(i,e[o]||""),[c,l]=ne(s);delete e[o],l&&o===a&&(e[a]=a!==o?encodeURI(l):`#${encodeURI(l)}`),i&&(le[i]=c);const u={},f=se(n,"recursiveAnchorToken");let p;!0===e[f]&&(u[""]=`${c}#`,e[a]="",delete e[f]);const d=se(n,"vocabularyToken");re(e[d],"object")?(ie[c]=n,p=e[d],delete e[d]):(ie[c]=n,p={[n]:!0});const y={"":""};return ce[c]={id:c,schemaVersion:n,schema:fe(e,c,n,E.nil,y,u),anchors:y,dynamicAnchors:u,vocabulary:p,validated:!1},c},fe=(e,t,r,n,o,a)=>{if(re(e,"object")){const i="string"==typeof e.$schema?ne(e.$schema)[0]:r,s=se(i,"embeddedToken"),c=se(i,"anchorToken");if("string"==typeof e[s]&&(s!==c||"#"!==e[s][0])){const n=oe(t,e[s]);return e[s]=n,ue(e,n,r),A.cons(e[s],e)}const l=se(r,"anchorToken"),u=se(r,"dynamicAnchorToken");"string"==typeof e[u]&&(a[e[u]]=`${t}#${encodeURI(n)}`,o[e[u]]=n,delete e[u]);const f=se(r,"embeddedToken");if("string"==typeof e[l]){const t=l!==f?e[l]:e[l].slice(1);o[t]=n,delete e[l]}const p=se(r,"jrefToken");if("string"==typeof e[p])return A.cons(e[p],e);for(const i in e)e[i]=fe(e[i],t,r,E.append(i,n),o,a);return e}return Array.isArray(e)?e.map(((e,i)=>fe(e,t,r,E.append(i,n),o,a))):e},pe=e=>ce[le[e]]||ce[e],de=Object.freeze({id:"",schemaVersion:void 0,vocabulary:{},pointer:E.nil,schema:void 0,value:void 0,anchors:{},dynamicAnchors:{},validated:!0}),ye=async(e,t=de)=>{const r=oe(me(t),e),[n,o]=ne(r);if(!(e=>e in ce||e in le)(n)){const e=await te(n,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error(`Failed to retrieve schema with id: ${n}`);if(e.headers.has("content-type")){const t=J.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${n} is not a schema. Found a document with media type: ${t}`)}ue(await e.json(),n)}const a=pe(n),i="/"!==o[0]?ve(a,o):o,s=Object.freeze({...a,pointer:i,value:E.get(i,a.schema)});return he(s)},he=e=>A.isReference(e.value)?ye(A.href(e.value),e):e,ve=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},me=e=>`${e.id}#${encodeURI(e.pointer)}`,be=e=>A.isReference(e.value)?A.value(e.value):e.value,we=(e,t)=>{const r=pe(t.id),n=Object.freeze({...t,pointer:E.append(e,t.pointer),value:be(t)[e],validated:r.validated});return he(n)},ge=o(((e,t)=>ee.pipeline([be,ee.map((async(r,n)=>e(await we(n,t),n))),ee.all],t)));var Oe={setConfig:(e,t,r)=>{ae[e]||(ae[e]={}),ae[e][t]=r},getConfig:se,add:ue,get:ye,markValidated:e=>{ce[e].validated=!0},uri:me,value:be,getAnchorPointer:ve,typeOf:(e,t)=>re(be(e),t),has:(e,t)=>e in be(t),step:we,keys:e=>Object.keys(be(e)),entries:e=>ee.pipeline([be,Object.keys,ee.map((async t=>[t,await we(t,e)])),ee.all],e),map:ge,length:e=>be(e).length};Oe.setConfig,Oe.getConfig,Oe.add,Oe.get,Oe.markValidated,Oe.uri,Oe.value,Oe.getAnchorPointer,Oe.typeOf,Oe.has,Oe.step,Oe.keys,Oe.entries,Oe.map,Oe.length;class je extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var Ee=je;const{splitUrl:$e}=f,Se="FLAG",Ae="BASIC",Ie="DETAILED",Te="VERBOSE";let ke=Ie,Pe=!0;const xe=async e=>{const t={metaData:{}};return{ast:t,schemaUri:await _e(e,t)}},Ve=o((({ast:e,schemaUri:t},r,n=Se)=>{if(![Se,Ae,Ie,Te].includes(n))throw Error(`The '${n}' error format is not supported`);const o=[],a=s.subscribe("result",Re(n,o));return Ne(t,r,e,{}),s.unsubscribe(a),o[0]})),Re=(e,t)=>{const r=[];return(n,o)=>{if("result"===n){const{keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:a}=o,i={keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:a,errors:[]};r.push(i)}else if("result.start"===n)r.push(n);else if("result.end"===n){const n=r.pop();for(;"result.start"!==r[r.length-1];){const t=r.pop(),o=[t];e===Ae&&(o.push(...t.errors),delete t.errors),(e===Te||e!==Se&&!t.valid)&&n.errors.unshift(...o)}r[r.length-1]=n,t[0]=n}}},Ce={},Ue=e=>Ce[e],Ke=e=>e in Ce,Le={},ze={},_e=async(e,t)=>{if(e=await De(e),!Ke(`${e.schemaVersion}#validate`)){const t=await Oe.get(e.schemaVersion);(Oe.getConfig(t.id,"mandatoryVocabularies")||[]).forEach((e=>{if(!t.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)})),Object.entries(t.vocabulary).forEach((([e,r])=>{if(e in Le)Object.entries(Le[e]).forEach((([e,r])=>{((e,t)=>{Ce[e]={collectEvaluatedItems:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&new Set,collectEvaluatedProperties:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&[],...t}})(`${t.id}#${e}`,r)}));else if(r)throw Error(`Missing required vocabulary: ${e}`)}))}if(Pe&&!e.validated){if(Oe.markValidated(e.id),!(e.schemaVersion in ze)){const t=await Oe.get(e.schemaVersion),r=await xe(t);ze[t.id]=Ve(r)}const t=L.cons(e.schema,e.id),r=ze[e.schemaVersion](t,ke);if(!r.valid)throw new Ee(r)}return e.id in t.metaData||(t.metaData[e.id]={id:e.id,dynamicAnchors:e.dynamicAnchors,anchors:e.anchors}),Ue(`${e.schemaVersion}#validate`).compile(e,t)},De=async e=>Oe.typeOf(e,"string")?De(await Oe.get(Oe.value(e),e)):e,Ne=(e,t,r,n)=>{const o=Be(e,r),a=$e(e)[0];return Ue(o).interpret(e,t,r,{...r.metaData[a].dynamicAnchors,...n})},Be=(e,t)=>{if(!(e in t))throw Error(`No schema found at ${e}`);return t[e][0]};var qe={validate:async(e,t,r)=>{const n=await xe(e),o=(e,t)=>Ve(n,L.cons(e),t);return void 0===t?o:o(t,r)},compile:xe,interpret:Ve,setMetaOutputFormat:e=>{ke=e},setShouldMetaValidate:e=>{Pe=e},FLAG:Se,BASIC:Ae,DETAILED:Ie,VERBOSE:Te,add:(e,t="",r="")=>{const n=Oe.add(e,t,r);delete ze[n]},getKeyword:Ue,hasKeyword:Ke,defineVocabulary:(e,t)=>{Le[e]=t},compileSchema:_e,interpretSchema:Ne,collectEvaluatedProperties:(e,t,r,n,o)=>{const a=Be(e,r);return Ue(a).collectEvaluatedProperties(e,t,r,n,o)},collectEvaluatedItems:(e,t,r,n,o)=>{const a=Be(e,r);return Ue(a).collectEvaluatedItems(e,t,r,n,o)}};var Fe={compile:e=>Oe.value(e),interpret:()=>!0};var Ze={compile:async(e,t)=>{const r=Oe.uri(e);if(!(r in t)){t[r]=!1;const n=Oe.value(e);if(!["object","boolean"].includes(typeof n))throw Error(`No schema found at '${Oe.uri(e)}'`);t[r]=[`${e.schemaVersion}#validate`,Oe.uri(e),"boolean"==typeof n?n:await ee.pipeline([Oe.entries,ee.map((([t,r])=>[`${e.schemaVersion}#${t}`,r])),ee.filter((([t])=>qe.hasKeyword(t)&&t!==`${e.schemaVersion}#validate`)),ee.map((async([r,n])=>{const o=await qe.getKeyword(r).compile(n,t,e);return[r,Oe.uri(n),o]})),ee.all],e)]}return r},interpret:(e,t,r,n)=>{const[o,a,i]=r[e];s.publishSync("result.start");const c="boolean"==typeof i?i:i.every((([e,o,a])=>{s.publishSync("result.start");const i=qe.getKeyword(e).interpret(a,t,r,n);return s.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:L.uri(t),valid:i,ast:a}),s.publishSync("result.end"),i}));return s.publishSync("result",{keyword:o,absoluteKeywordLocation:a,instanceLocation:L.uri(t),valid:c,ast:e}),s.publishSync("result.end"),c},collectEvaluatedProperties:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&[]:a.filter((([e])=>!o||!e.endsWith("#unevaluatedProperties"))).reduce(((e,[o,,a])=>{const i=e&&qe.getKeyword(o).collectEvaluatedProperties(a,t,r,n);return!1!==i&&[...e,...i]}),[])},collectEvaluatedItems:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&new Set:a.filter((([e])=>!o||!e.endsWith("#unevaluatedItems"))).reduce(((e,[o,,a])=>{const i=!1!==e&&qe.getKeyword(o).collectEvaluatedItems(a,t,r,n);return!1!==i&&new Set([...e,...i])}),new Set)}},Je={metaData:Fe,validate:Ze},Me={Core:qe,Schema:Oe,Instance:L,Reference:A,Keywords:Je,InvalidSchemaError:Ee},Ge=Me.Core,He=Me.Schema,We=Me.Instance,Qe=Me.Reference,Xe=Me.Keywords,Ye=Me.InvalidSchemaError;return e.Core=Ge,e.Instance=We,e.InvalidSchemaError=Ye,e.Keywords=Xe,e.Reference=Qe,e.Schema=He,e.default=Me,Object.defineProperty(e,"__esModule",{value:!0}),e}({},urlResolveBrowser); | ||
//# sourceMappingURL=json-schema-core-iife.min.js.map |
@@ -1,2 +0,2 @@ | ||
System.register("JSC",["url"],(function(e){"use strict";var t;return{setters:[function(e){t=e.default}],execute:function(){var r=function(e,t){return function r(){null==t&&(t=e.length);var n=[].slice.call(arguments);return n.length>=t?e.apply(this,n):function(){return r.apply(this,n.concat([].slice.call(arguments)))}}};var n="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var a,o=(function(e,t){var r,a;r="object"==typeof window&&window||n,a={},r.PubSub=a,function(e){var t={},r=-1,n="*";function a(e){var t;for(t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function o(e){return function(){throw e}}function i(e,t,r){try{e(t,r)}catch(e){setTimeout(o(e),0)}}function s(e,t,r){e(t,r)}function u(e,r,n,a){var o,u=t[r],l=a?s:i;if(Object.prototype.hasOwnProperty.call(t,r))for(o in u)Object.prototype.hasOwnProperty.call(u,o)&&l(u[o],e,n)}function l(e,t,r){return function(){var a=String(e),o=a.lastIndexOf(".");for(u(e,e,t,r);-1!==o;)o=(a=a.substr(0,o)).lastIndexOf("."),u(e,a,t,r);u(e,n,t,r)}}function c(e){var r=String(e);return Boolean(Object.prototype.hasOwnProperty.call(t,r)&&a(t[r]))}function f(e){for(var t=String(e),r=c(t)||c(n),a=t.lastIndexOf(".");!r&&-1!==a;)a=(t=t.substr(0,a)).lastIndexOf("."),r=c(t);return r}function h(e,t,r,n){var a=l(e="symbol"==typeof e?e.toString():e,t,n);return!!f(e)&&(!0===r?a():setTimeout(a,0),!0)}e.publish=function(t,r){return h(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return h(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,Object.prototype.hasOwnProperty.call(t,e)||(t[e]={});var a="uid_"+String(++r);return t[e][a]=n,a},e.subscribeAll=function(t){return e.subscribe(n,t)},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n,a=0;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)){for(n in t[r])a++;break}return a},e.getSubscriptions=function(e){var r,n=[];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,a,o,i=function(e){var r;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e))return!0;return!1},s="string"==typeof r&&(Object.prototype.hasOwnProperty.call(t,r)||i(r)),u=!s&&"string"==typeof r,l="function"==typeof r,c=!1;if(!s){for(n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(a=t[n],u&&a[r]){delete a[r],c=r;break}if(l)for(o in a)Object.prototype.hasOwnProperty.call(a,o)&&a[o]===r&&(delete a[o],c=!0)}return c}e.clearSubscriptions(r)}}(a),void 0!==e&&e.exports&&(t=e.exports=a),t.PubSub=a,e.exports=t=a}(a={exports:{}},a.exports),a.exports);o.PubSub;var i=function(e,t){if(e=e.trim(),(t=t.trim()).startsWith("about:"))return t;const r=function(e){const t={host:"",path:"",query:"",protocol:""};let r=e,n=e.indexOf("//");t.protocol=r.substring(0,n),n+=2;const a=e.indexOf("/",n),o=e.indexOf("?"),i=e.indexOf("#");-1!==i&&(r=r.substring(0,i));if(-1!==o){const e=r.substring(o);t.query=e,r=r.substring(0,o)}if(-1!==a){const e=r.substring(0,a);t.host=e,r=r.substring(a),t.path=r}else t.host=r;return t}(e),n=function(e){const t={href:e,hash:"",query:"",netPath:!1,absolutePath:!1,relativePath:!1};if(l.test(e))return t.netPath=!0,t;"/"===e[0]?t.absolutePath=!0:""!==e&&(t.relativePath=!0);let r=e;const n=e.indexOf("?"),a=e.indexOf("#");if(-1!==a){const e=r.substring(a);t.hash=e,r=r.substring(0,a)}if(-1!==n){const e=r.substring(n);t.query=e,r=r.substring(0,n)}return t.path=r,t}(t);if(!r.protocol&&!n.netPath)throw new Error("Error, protocol is not specified");if(n.netPath)return function(e){return e.startsWith("//")}(n.href)&&(n.href=r.protocol+n.href),function(e){const t=e.indexOf("//")+2,r=!e.includes("/",t),n=!e.includes("?",t),a=!e.includes("#",t);return r&&n&&a}(n.href)?s(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:a}=n;return r.host+u(e)+t+a}if(n.relativePath){const{path:e,query:t,hash:a}=n;let o,i=r.path,s=r.host;return 0===e.length?o=i:(i=i.substring(0,i.lastIndexOf("/")),o=u(i+"/"+e)),s+=""!==o||t||a?o+t+a:"/",s}{const{host:e,path:t,query:a}=r;return t||a?e+t+a+n.hash:s(e)}};function s(e){return e+("/"===e[e.length-1]?"":"/")}function u(e){let t=e.split("/");""===t[0]&&(t=t.slice(1));let r=[];return t.forEach(((e,n)=>{"."!==e&&(".."===e?r.pop():""===e&&n!==t.length-1||r.push(e))})),"/"+r.join("/")}const l=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");const c={null:e=>null===e,boolean:e=>"boolean"==typeof e,object:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,array:e=>Array.isArray(e),number:e=>"number"==typeof e,integer:e=>Number.isInteger(e),string:e=>"string"==typeof e},f=e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),a=e.slice(r+1);return[decodeURI(n),decodeURI(a)]},h=e=>{const t=RegExp(/^(.+):\/\//).exec(e);return t?t[1]:""};var m={jsonTypeOf:(e,t)=>c[t](e),splitUrl:f,safeResolveUrl:(e,t)=>{const r=i(e,t),n=f(e)[0];if(n&&"file"===h(r)&&"file"!==h(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r}};const p=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(w)},d=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const a=e.shift();return{...t,[a]:d(e,E(t,a,n),r,g(a,n))}}if(Array.isArray(t)){const n=[...t];return n[O(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:E(t,e[0],n)},y=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||S(t)){const a=e.shift();y(e,E(t,a,n),r,g(a,n))}else{t[O(t,e[0])]=r}},v=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),a=E(t,n,r);return{...t,[n]:v(e,a,g(n,r))}}if(Array.isArray(t))return t.filter(((t,r)=>r!=e[0]));if("object"==typeof t&&null!==t){const{[e[0]]:r,...n}=t;return n}return E(t,e[0],r)}},b=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),a=E(t,n,r);b(e,a,g(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:E(t,e[0],r)},g=r(((e,t)=>t+"/"+x(e))),x=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),w=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),O=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,E=(e,t,r="")=>{if(void 0===e)throw TypeError(`Value at '${r}' is undefined and does not have property '${t}'`);if(null===e)throw TypeError(`Value at '${r}' is null and does not have property '${t}'`);if(S(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[O(e,t)]},S=e=>null===e||"object"!=typeof e;var I={nil:"",append:g,get:(e,t)=>{const r=p(e),n=e=>r.reduce((([e,t],r)=>[E(e,r,t),g(r,t)]),[e,""])[0];return void 0===t?n:n(t)},set:(e,t,n)=>{const a=p(e),o=r(((e,t)=>d(a,e,t,"")));return void 0===t?o:o(t,n)},assign:(e,t,n)=>{const a=p(e),o=r(((e,t)=>y(a,e,t,"")));return void 0===t?o:o(t,n)},unset:(e,t)=>{const r=p(e),n=e=>v(r,e,"");return void 0===t?n:n(t)},remove:(e,t)=>{const r=p(e),n=e=>b(r,e,"");return void 0===t?n:n(t)}};I.nil,I.append,I.get,I.set,I.assign,I.unset,I.remove;const j=Symbol("$__value"),P=Symbol("$__href");var A={cons:(e,t)=>Object.freeze({[P]:e,[j]:t}),isReference:e=>e&&void 0!==e[P],href:e=>e[P],value:e=>e[j]};const{jsonTypeOf:T}=m,R=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),$=e=>A.isReference(e.value)?A.value(e.value):e.value,V=r(((e,t)=>T($(e),t))),k=(e,t)=>Object.freeze({...t,pointer:I.append(e,t.pointer),value:$(t)[e]}),L=r(((e,t)=>$(t).map(((r,n,a,o)=>e(k(n,t),n,a,o))))),H=r(((e,t)=>$(t).map(((e,r,n,a)=>k(r,t))).filter(((t,r,n,a)=>e(t,r,n,a))))),U=r(((e,t,r)=>$(r).reduce(((t,n,a)=>e(t,k(a,r),a)),t))),q=r(((e,t)=>$(t).every(((r,n,a,o)=>e(k(n,t),n,a,o))))),D=r(((e,t)=>$(t).some(((r,n,a,o)=>e(k(n,t),n,a,o)))));var _={nil:R,cons:(e,t="")=>Object.freeze({...R,id:t,instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:$,has:(e,t)=>e in $(t),typeOf:V,step:k,entries:e=>Object.keys($(e)).map((t=>[t,k(t,e)])),keys:e=>Object.keys($(e)),map:L,filter:H,reduce:U,every:q,some:D,length:e=>$(e).length},C=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,Q=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,z=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,B=/\\([\u000b\u0020-\u00ff])/g,K=/([\\"])/g,N=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function J(e){var t=String(e);if(z.test(t))return t;if(t.length>0&&!Q.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(K,"\\$1")+'"'}function M(e){this.parameters=Object.create(null),this.type=e}var F={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!N.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var a,o=Object.keys(t).sort(),i=0;i<o.length;i++){if(a=o[i],!z.test(a))throw new TypeError("invalid parameter name");n+="; "+a+"="+J(t[a])}return n},parse:function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;"function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.substr(0,r).trim():t.trim();if(!N.test(n))throw new TypeError("invalid media type");var a=new M(n.toLowerCase());if(-1!==r){var o,i,s;for(C.lastIndex=r;i=C.exec(t);){if(i.index!==r)throw new TypeError("invalid parameter format");r+=i[0].length,o=i[1].toLowerCase(),'"'===(s=i[2])[0]&&(s=s.substr(1,s.length-2).replace(B,"$1")),a.parameters[o]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return a}},W=async e=>Object.entries(await e),Z=r((async(e,t)=>(await t).map(e))),G=r((async(e,t,r)=>(await r).reduce((async(t,r)=>e(await t,r)),t))),X=r((async(e,t,r={})=>G((async(t,r)=>await e(r)?t.concat([r]):t),[],t,r))),Y=r((async(e,t)=>{const r=await Z(e,t);return(await Promise.all(r)).some((e=>e))})),ee=r((async(e,t)=>{const r=await Z(e,t);return(await Promise.all(r)).every((e=>e))})),te=r(((e,t)=>e.reduce((async(e,t)=>t(await e)),t))),re={entries:W,map:Z,filter:X,reduce:G,some:Y,every:ee,pipeline:te,all:e=>Promise.all(e),allValues:e=>te([W,G((async(e,[t,r])=>(e[t]=await r,e)),{})],e)};re.entries,re.map,re.filter,re.reduce,re.some,re.every,re.pipeline,re.all,re.allValues;var ne={ABSOLUTE:"absolute",PATH_RELATIVE:"pathRelative",ROOT_RELATIVE:"rootRelative",SHORTEST:"shortest"};function ae(e,t){var r=t.removeEmptyQueries&&e.extra.relation.minimumPort;return e.query.string[r?"stripped":"full"]}function oe(e,t){return!e.extra.relation.minimumQuery||t.output===ne.ABSOLUTE||t.output===ne.ROOT_RELATIVE}function ie(e,t){var r=t.removeDirectoryIndexes&&e.extra.resourceIsIndex,n=e.extra.relation.minimumResource&&t.output!==ne.ABSOLUTE&&t.output!==ne.ROOT_RELATIVE;return!!e.resource&&!n&&!r}var se=function(e,t){var r="";return r+=function(e,t){var r="";return(e.extra.relation.maximumHost||t.output===ne.ABSOLUTE)&&(e.extra.relation.minimumScheme&&t.schemeRelative&&t.output!==ne.ABSOLUTE?r+="//":r+=e.scheme+"://"),r}(e,t),r+=function(e,t){return!e.auth||t.removeAuth||!e.extra.relation.maximumHost&&t.output!==ne.ABSOLUTE?"":e.auth+"@"}(e,t),r+=function(e,t){return e.host.full&&(e.extra.relation.maximumAuth||t.output===ne.ABSOLUTE)?e.host.full:""}(e,t),r+=function(e,t){return e.port&&!e.extra.portIsDefault&&e.extra.relation.maximumHost?":"+e.port:""}(e),r+=function(e,t){var r="",n=e.path.absolute.string,a=e.path.relative.string,o=ie(e,t);if(e.extra.relation.maximumHost||t.output===ne.ABSOLUTE||t.output===ne.ROOT_RELATIVE)r=n;else if(a.length<=n.length&&t.output===ne.SHORTEST||t.output===ne.PATH_RELATIVE){if(""===(r=a)){var i=oe(e,t)&&!!ae(e,t);e.extra.relation.maximumPath&&!o?r="./":!e.extra.relation.overridesQuery||o||i||(r="./")}}else r=n;return"/"!==r||o||!t.removeRootTrailingSlash||e.extra.relation.minimumPort&&t.output!==ne.ABSOLUTE||(r=""),r}(e,t),r+=function(e,t){return ie(e,t)?e.resource:""}(e,t),r+=function(e,t){return oe(e,t)?ae(e,t):""}(e,t),r+=function(e,t){return e.hash?e.hash:""}(e)};var ue={clone:function e(t){if(t instanceof Object){var r=t instanceof Array?[]:{};for(var n in t)t.hasOwnProperty(n)&&(r[n]=e(t[n]));return r}return t},isPlainObject:function(e){return!!e&&"object"==typeof e&&e.constructor===Object},shallowMerge:function(e,t){if(e instanceof Object&&t instanceof Object)for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e}};function le(e,t){return t instanceof Object&&e instanceof Object?t instanceof Array&&e instanceof Array?t.concat(e):ue.shallowMerge(e,t):e}var ce=function(e,t){if(ue.isPlainObject(e)){var r={};for(var n in t)t.hasOwnProperty(n)&&(void 0!==e[n]?r[n]=le(e[n],t[n]):r[n]=t[n]);return r}return t};var fe=function(e){var t=!(e.scheme||e.auth||e.host.full||e.port),r=t&&!e.path.absolute.string,n=r&&!e.resource,a=n&&!e.query.string.full.length,o=a&&!e.hash;e.extra.hrefInfo.minimumPathOnly=t,e.extra.hrefInfo.minimumResourceOnly=r,e.extra.hrefInfo.minimumQueryOnly=n,e.extra.hrefInfo.minimumHashOnly=a,e.extra.hrefInfo.empty=o};var he=function(e,t){if(t.ignore_www){var r=e.host.full;if(r){var n=r;0===r.indexOf("www.")&&(n=r.substr(4)),e.host.stripped=n}}};function me(e){if("/"!==e){var t=[];return e.split("/").forEach((function(e){""!==e&&t.push(e)})),t}return[]}var pe=function(e,t){var r=e.path.absolute.string;if(r){var n=r.lastIndexOf("/");if(n>-1){if(++n<r.length){var a=r.substr(n);"."!==a&&".."!==a?(e.resource=a,r=r.substr(0,n)):r+="/"}e.path.absolute.string=r,e.path.absolute.array=me(r)}else"."===r||".."===r?(r+="/",e.path.absolute.string=r,e.path.absolute.array=me(r)):(e.resource=r,e.path.absolute.string=null);e.extra.resourceIsIndex=function(e,t){var r=!1;return t.directoryIndexes.every((function(t){return t!==e||(r=!0,!1)})),r}(e.resource,t)}};var de=function(e,t){var r=-1;for(var n in t.defaultPorts)if(n===e.scheme&&t.defaultPorts.hasOwnProperty(n)){r=t.defaultPorts[n];break}r>-1&&(r=r.toString(),null===e.port&&(e.port=r),e.extra.portIsDefault=e.port===r)},ye=Object.prototype.hasOwnProperty;function ve(e,t){var r=0,n="";for(var a in e)if(""!==a&&!0===ye.call(e,a)){var o=e[a];""===o&&t||(n+=1==++r?"?":"&",a=encodeURIComponent(a),n+=""!==o?a+"="+encodeURIComponent(o).replace(/%20/g,"+"):a)}return n}var be=function(e,t){e.query.string.full=ve(e.query.object,!1),t.removeEmptyQueries&&(e.query.string.stripped=ve(e.query.object,!0))},ge=t.parse;var xe=function(e,t){return function(e,t){var r=!0;return t.rejectedSchemes.every((function(t){return r=!(0===e.indexOf(t+":"))})),r}(e,t)?(r=ge(e,!0,t.slashesDenoteHost),(n=r.protocol)&&n.indexOf(":")===n.length-1&&(n=n.substr(0,n.length-1)),r.host={full:r.hostname,stripped:null},r.path={absolute:{array:null,string:r.pathname},relative:{array:null,string:null}},r.query={object:r.query,string:{full:null,stripped:null}},r.extra={hrefInfo:{minimumPathOnly:null,minimumResourceOnly:null,minimumQueryOnly:null,minimumHashOnly:null,empty:null,separatorOnlyQuery:"?"===r.search},portIsDefault:null,relation:{maximumScheme:null,maximumAuth:null,maximumHost:null,maximumPort:null,maximumPath:null,maximumResource:null,maximumQuery:null,maximumHash:null,minimumScheme:null,minimumAuth:null,minimumHost:null,minimumPort:null,minimumPath:null,minimumResource:null,minimumQuery:null,minimumHash:null,overridesQuery:null},resourceIsIndex:null,slashes:r.slashes},r.resource=null,r.scheme=n,delete r.hostname,delete r.pathname,delete r.protocol,delete r.search,delete r.slashes,r):{href:e,valid:!1};var r,n};var we={join:function(e){return e.length>0?e.join("/")+"/":""},resolveDotSegments:function(e){var t=[];return e.forEach((function(e){".."!==e?"."!==e&&t.push(e):t.length>0&&t.splice(t.length-1,1)})),t}};function Oe(e,t){var r=xe(e,t);return!1===r.valid||(he(r,t),de(r,t),pe(r,t),be(r,t),fe(r)),r}var Ee={from:function(e,t,r){if(e){var n=Oe(e,t),a=we.resolveDotSegments(n.path.absolute.array);return n.path.absolute.array=a,n.path.absolute.string="/"+we.join(a),n}return r},to:Oe};var Se={pathOn:function(e,t,r){var n=e.extra.hrefInfo.minimumQueryOnly,a=e.extra.hrefInfo.minimumHashOnly,o=e.extra.hrefInfo.empty,i=e.extra.relation.minimumPort,s=e.extra.relation.minimumScheme,u=i&&e.path.absolute.string===t.path.absolute.string,l=e.resource===t.resource||!e.resource&&t.extra.resourceIsIndex||r.removeDirectoryIndexes&&e.extra.resourceIsIndex&&!t.resource,c=u&&(l||n||a||o),f=r.removeEmptyQueries?"stripped":"full",h=e.query.string[f],m=t.query.string[f],p=c&&!!h&&h===m||(a||o)&&!e.extra.hrefInfo.separatorOnlyQuery,d=p&&e.hash===t.hash;e.extra.relation.minimumPath=u,e.extra.relation.minimumResource=c,e.extra.relation.minimumQuery=p,e.extra.relation.minimumHash=d,e.extra.relation.maximumPort=!s||s&&!u,e.extra.relation.maximumPath=!s||s&&!c,e.extra.relation.maximumResource=!s||s&&!p,e.extra.relation.maximumQuery=!s||s&&!d,e.extra.relation.maximumHash=!s||s&&!d,e.extra.relation.overridesQuery=u&&e.extra.relation.maximumResource&&!p&&!!m},upToPath:function(e,t,r){var n=e.extra.hrefInfo.minimumPathOnly,a=e.scheme===t.scheme||!e.scheme,o=a&&(e.auth===t.auth||r.removeAuth||n),i=r.ignore_www?"stripped":"full",s=o&&(e.host[i]===t.host[i]||n),u=s&&(e.port===t.port||n);e.extra.relation.minimumScheme=a,e.extra.relation.minimumAuth=o,e.extra.relation.minimumHost=s,e.extra.relation.minimumPort=u,e.extra.relation.maximumScheme=!a||a&&!o,e.extra.relation.maximumAuth=!a||a&&!s,e.extra.relation.maximumHost=!a||a&&!u}};var Ie=function(e,t,r){Se.upToPath(e,t,r),e.extra.relation.minimumScheme&&(e.scheme=t.scheme),e.extra.relation.minimumAuth&&(e.auth=t.auth),e.extra.relation.minimumHost&&(e.host=ue.clone(t.host)),e.extra.relation.minimumPort&&function(e,t){e.port=t.port,e.extra.portIsDefault=t.extra.portIsDefault}(e,t),e.extra.relation.minimumScheme&&function(e,t){if(e.extra.relation.maximumHost||!e.extra.hrefInfo.minimumResourceOnly){var r=e.path.absolute.array,n="/";r?(e.extra.hrefInfo.minimumPathOnly&&0!==e.path.absolute.string.indexOf("/")&&(r=t.path.absolute.array.concat(r)),r=we.resolveDotSegments(r),n+=we.join(r)):r=[],e.path.absolute.array=r,e.path.absolute.string=n}else e.path=ue.clone(t.path)}(e,t),Se.pathOn(e,t,r),e.extra.relation.minimumResource&&function(e,t){e.resource=t.resource,e.extra.resourceIsIndex=t.extra.resourceIsIndex}(e,t),e.extra.relation.minimumQuery&&(e.query=ue.clone(t.query)),e.extra.relation.minimumHash&&(e.hash=t.hash)};var je=function(e,t,r){if(e.extra.relation.minimumScheme){var n=(a=e.path.absolute.array,o=t.path.absolute.array,i=[],s=!0,u=-1,o.forEach((function(e,t){s&&(a[t]!==e?s=!1:u=t),s||i.push("..")})),a.forEach((function(e,t){t>u&&i.push(e)})),i);e.path.relative.array=n,e.path.relative.string=we.join(n)}var a,o,i,s,u};var Pe=function(e,t,r){return Ie(t,e,r),je(t,e),t};function Ae(e,t){this.options=ce(t,{defaultPorts:{ftp:21,http:80,https:443},directoryIndexes:["index.html"],ignore_www:!1,output:Ae.SHORTEST,rejectedSchemes:["data","javascript","mailto"],removeAuth:!1,removeDirectoryIndexes:!0,removeEmptyQueries:!1,removeRootTrailingSlash:!0,schemeRelative:!0,site:void 0,slashesDenoteHost:!0}),this.from=Ee.from(e,this.options,null)}Ae.prototype.relate=function(e,t,r){if(ue.isPlainObject(t)?(r=t,t=e,e=null):t||(t=e,e=null),r=ce(r,this.options),e=e||r.site,!(e=Ee.from(e,r,this.from))||!e.href)throw new Error("from value not defined.");if(e.extra.hrefInfo.minimumPathOnly)throw new Error("from value supplied is not absolute: "+e.href);return!1===(t=Ee.to(t,r)).valid?t.href:(t=Pe(e,t,r),t=se(t,r))},Ae.relate=function(e,t,r){return(new Ae).relate(e,t,r)},ue.shallowMerge(Ae,ne);var Te=Ae,Re=fetch;const{jsonTypeOf:$e,splitUrl:Ve,safeResolveUrl:ke}=m,Le={},He={},Ue=(e,t)=>{const r=e in He?He[e]:e;if(r in Le)return Le[r][t]},qe={},De={},_e=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=Ve(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const a=Ue(n,"baseToken"),o=Ue(n,"anchorToken"),i=Ve(t)[0];if(!i&&!Ve(e[a]||"")[0])throw Error("Couldn't determine an identifier for the schema");const s=ke(i,e[a]||""),[u,l]=Ve(s);delete e[a],l&&a===o&&(e[o]=o!==a?encodeURI(l):`#${encodeURI(l)}`),i&&(De[i]=u);const c={},f=Ue(n,"recursiveAnchorToken");let h;!0===e[f]&&(c[""]=`${u}#`,e[o]="",delete e[f]);const m=Ue(n,"vocabularyToken");$e(e[m],"object")?(He[u]=n,h=e[m],delete e[m]):(He[u]=n,h={[n]:!0});const p={"":""};return qe[u]={id:u,schemaVersion:n,schema:Ce(e,u,n,I.nil,p,c),anchors:p,dynamicAnchors:c,vocabulary:h,validated:!1},u},Ce=(e,t,r,n,a,o)=>{if($e(e,"object")){const i="string"==typeof e.$schema?Ve(e.$schema)[0]:r,s=Ue(i,"embeddedToken"),u=Ue(i,"anchorToken");if("string"==typeof e[s]&&(s!==u||"#"!==e[s][0])){const n=ke(t,e[s]);return e[s]=n,_e(e,n,r),A.cons(e[s],e)}const l=Ue(r,"anchorToken"),c=Ue(r,"dynamicAnchorToken");"string"==typeof e[c]&&(o[e[c]]=`${t}#${encodeURI(n)}`,a[e[c]]=n,delete e[c]);const f=Ue(r,"embeddedToken");if("string"==typeof e[l]){const t=l!==f?e[l]:e[l].slice(1);a[t]=n,delete e[l]}const h=Ue(r,"jrefToken");if("string"==typeof e[h])return A.cons(e[h],e);for(const i in e)e[i]=Ce(e[i],t,r,I.append(i,n),a,o);return e}return Array.isArray(e)?e.map(((e,i)=>Ce(e,t,r,I.append(i,n),a,o))):e},Qe=e=>qe[De[e]]||qe[e],ze=Object.freeze({id:"",schemaVersion:void 0,vocabulary:{},pointer:I.nil,schema:void 0,value:void 0,anchors:{},dynamicAnchors:{},validated:!0}),Be=async(e,t=ze)=>{const r=ke(Je(t),e),[n,a]=Ve(r);if(!(e=>e in qe||e in De)(n)){const e=await Re(n,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error(`Failed to retrieve schema with id: ${n}`);if(e.headers.has("content-type")){const t=F.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${n} is not a schema. Found a document with media type: ${t}`)}_e(await e.json(),n)}const o=Qe(n),i="/"!==a[0]?Ne(o,a):a,s=Object.freeze({...o,pointer:i,value:I.get(i,o.schema)});return Ke(s)},Ke=e=>A.isReference(e.value)?Be(A.href(e.value),e):e,Ne=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},Je=e=>`${e.id}#${encodeURI(e.pointer)}`,Me=e=>A.isReference(e.value)?A.value(e.value):e.value,Fe=(e,t)=>{const r=Qe(t.id),n=Object.freeze({...t,pointer:I.append(e,t.pointer),value:Me(t)[e],validated:r.validated});return Ke(n)},We=r(((e,t)=>re.pipeline([Me,re.map((async(r,n)=>e(await Fe(n,t),n))),re.all],t))),Ze={parentId:"",parentDialect:"",includeEmbedded:!0},Ge=(e,t)=>t.startsWith("file://")?""===e?"":Te.relate(e,t):t;var Xe={setConfig:(e,t,r)=>{Le[e]||(Le[e]={}),Le[e][t]=r},getConfig:Ue,add:_e,get:Be,markValidated:e=>{qe[e].validated=!0},uri:Je,value:Me,getAnchorPointer:Ne,typeOf:(e,t)=>$e(Me(e),t),has:(e,t)=>e in Me(t),step:Fe,keys:e=>Object.keys(Me(e)),entries:e=>re.pipeline([Me,Object.keys,re.map((async t=>[t,await Fe(t,e)])),re.all],e),map:We,length:e=>Me(e).length,toSchema:(e,t={})=>{const r={...Ze,...t},n=JSON.parse(JSON.stringify(e.schema,((t,n)=>{if(!A.isReference(n))return n;const a=A.value(n),o=a.$schema||e.schemaVersion,i=Ue(o,"embeddedToken");return!r.includeEmbedded&&i in a?void 0:A.value(n)}))),a=Ue(e.schemaVersion,"dynamicAnchorToken");Object.entries(e.dynamicAnchors).forEach((([e,t])=>{const r=Ve(t)[1];I.assign(r,n,{[a]:e,...I.get(r,n)})}));const o=Ue(e.schemaVersion,"anchorToken");Object.entries(e.anchors).filter((([e])=>""!==e)).forEach((([e,t])=>{I.assign(t,n,{[o]:e,...I.get(t,n)})}));const i=Ue(e.schemaVersion,"baseToken"),s=Ge(r.parentId,e.id),u=r.parentDialect===e.schemaVersion?"":e.schemaVersion;return{...s&&{[i]:s},...u&&{$schema:u},...n}}};Xe.setConfig,Xe.getConfig,Xe.add,Xe.get,Xe.markValidated,Xe.uri,Xe.value,Xe.getAnchorPointer,Xe.typeOf,Xe.has,Xe.step,Xe.keys,Xe.entries,Xe.map,Xe.length,Xe.toSchema;class Ye extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var et=Ye;const{splitUrl:tt}=m,rt="FLAG",nt="BASIC",at="DETAILED",ot="VERBOSE";let it=at,st=!0;const ut=async e=>{const t={metaData:{}};return{ast:t,schemaUri:await yt(e,t)}},lt=r((({ast:e,schemaUri:t},r,n=rt)=>{if(![rt,nt,at,ot].includes(n))throw Error(`The '${n}' error format is not supported`);const a=[],i=o.subscribe("result",ct(n,a));return bt(t,r,e,{}),o.unsubscribe(i),a[0]})),ct=(e,t)=>{const r=[];return(n,a)=>{if("result"===n){const{keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:o}=a,i={keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:o,errors:[]};r.push(i)}else if("result.start"===n)r.push(n);else if("result.end"===n){const n=r.pop();for(;"result.start"!==r[r.length-1];){const t=r.pop(),a=[t];e===nt&&(a.push(...t.errors),delete t.errors),(e===ot||e!==rt&&!t.valid)&&n.errors.unshift(...a)}r[r.length-1]=n,t[0]=n}}},ft={},ht=e=>ft[e],mt=e=>e in ft,pt={},dt={},yt=async(e,t)=>{if(e=await vt(e),!mt(`${e.schemaVersion}#validate`)){const t=await Xe.get(e.schemaVersion);(Xe.getConfig(t.id,"mandatoryVocabularies")||[]).forEach((e=>{if(!t.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)})),Object.entries(t.vocabulary).forEach((([e,r])=>{if(e in pt)Object.entries(pt[e]).forEach((([e,r])=>{((e,t)=>{ft[e]={collectEvaluatedItems:(e,r,n,a,o)=>t.interpret(e,r,n,a,o)&&new Set,collectEvaluatedProperties:(e,r,n,a,o)=>t.interpret(e,r,n,a,o)&&[],...t}})(`${t.id}#${e}`,r)}));else if(r)throw Error(`Missing required vocabulary: ${e}`)}))}if(st&&!e.validated){if(Xe.markValidated(e.id),!(e.schemaVersion in dt)){const t=await Xe.get(e.schemaVersion),r=await ut(t);dt[t.id]=lt(r)}const t=_.cons(e.schema,e.id),r=dt[e.schemaVersion](t,it);if(!r.valid)throw new et(r)}return e.id in t.metaData||(t.metaData[e.id]={id:e.id,dynamicAnchors:e.dynamicAnchors,anchors:e.anchors}),ht(`${e.schemaVersion}#validate`).compile(e,t)},vt=async e=>Xe.typeOf(e,"string")?vt(await Xe.get(Xe.value(e),e)):e,bt=(e,t,r,n)=>{const a=gt(e,r),o=tt(e)[0];return ht(a).interpret(e,t,r,{...r.metaData[o].dynamicAnchors,...n})},gt=(e,t)=>{if(!(e in t))throw Error(`No schema found at ${e}`);return t[e][0]};var xt={validate:async(e,t,r)=>{const n=await ut(e),a=(e,t)=>lt(n,_.cons(e),t);return void 0===t?a:a(t,r)},compile:ut,interpret:lt,setMetaOutputFormat:e=>{it=e},setShouldMetaValidate:e=>{st=e},FLAG:rt,BASIC:nt,DETAILED:at,VERBOSE:ot,add:(e,t="",r="")=>{const n=Xe.add(e,t,r);delete dt[n]},getKeyword:ht,hasKeyword:mt,defineVocabulary:(e,t)=>{pt[e]=t},compileSchema:yt,interpretSchema:bt,collectEvaluatedProperties:(e,t,r,n,a)=>{const o=gt(e,r);return ht(o).collectEvaluatedProperties(e,t,r,n,a)},collectEvaluatedItems:(e,t,r,n,a)=>{const o=gt(e,r);return ht(o).collectEvaluatedItems(e,t,r,n,a)}};var wt={compile:e=>Xe.value(e),interpret:()=>!0};var Ot={compile:async(e,t)=>{const r=Xe.uri(e);if(!(r in t)){t[r]=!1;const n=Xe.value(e);if(!["object","boolean"].includes(typeof n))throw Error(`No schema found at '${Xe.uri(e)}'`);t[r]=[`${e.schemaVersion}#validate`,Xe.uri(e),"boolean"==typeof n?n:await re.pipeline([Xe.entries,re.map((([t,r])=>[`${e.schemaVersion}#${t}`,r])),re.filter((([t])=>xt.hasKeyword(t)&&t!==`${e.schemaVersion}#validate`)),re.map((async([r,n])=>{const a=await xt.getKeyword(r).compile(n,t,e);return[r,Xe.uri(n),a]})),re.all],e)]}return r},interpret:(e,t,r,n)=>{const[a,i,s]=r[e];o.publishSync("result.start");const u="boolean"==typeof s?s:s.every((([e,a,i])=>{o.publishSync("result.start");const s=xt.getKeyword(e).interpret(i,t,r,n);return o.publishSync("result",{keyword:e,absoluteKeywordLocation:a,instanceLocation:_.uri(t),valid:s,ast:i}),o.publishSync("result.end"),s}));return o.publishSync("result",{keyword:a,absoluteKeywordLocation:i,instanceLocation:_.uri(t),valid:u,ast:e}),o.publishSync("result.end"),u},collectEvaluatedProperties:(e,t,r,n,a=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter((([e])=>!a||!e.endsWith("#unevaluatedProperties"))).reduce(((e,[a,,o])=>{const i=e&&xt.getKeyword(a).collectEvaluatedProperties(o,t,r,n);return!1!==i&&[...e,...i]}),[])},collectEvaluatedItems:(e,t,r,n,a=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&new Set:o.filter((([e])=>!a||!e.endsWith("#unevaluatedItems"))).reduce(((e,[a,,o])=>{const i=!1!==e&&xt.getKeyword(a).collectEvaluatedItems(o,t,r,n);return!1!==i&&new Set([...e,...i])}),new Set)}},Et={metaData:wt,validate:Ot},St=e("default",{Core:xt,Schema:Xe,Instance:_,Reference:A,Keywords:Et,InvalidSchemaError:et});e("Core",St.Core),e("Schema",St.Schema),e("Instance",St.Instance),e("Reference",St.Reference),e("Keywords",St.Keywords),e("InvalidSchemaError",St.InvalidSchemaError)}}})); | ||
System.register("JSC",["url-resolve-browser"],(function(e){"use strict";var t;return{setters:[function(e){t=e.default}],execute:function(){var r=function(e,t){return function r(){null==t&&(t=e.length);var n=[].slice.call(arguments);return n.length>=t?e.apply(this,n):function(){return r.apply(this,n.concat([].slice.call(arguments)))}}};var n="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var o,a=(function(e,t){var r,o;r="object"==typeof window&&window||n,o={},r.PubSub=o,function(e){var t={},r=-1,n="*";function o(e){var t;for(t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function a(e){return function(){throw e}}function i(e,t,r){try{e(t,r)}catch(e){setTimeout(a(e),0)}}function s(e,t,r){e(t,r)}function c(e,r,n,o){var a,c=t[r],l=o?s:i;if(Object.prototype.hasOwnProperty.call(t,r))for(a in c)Object.prototype.hasOwnProperty.call(c,a)&&l(c[a],e,n)}function l(e,t,r){return function(){var o=String(e),a=o.lastIndexOf(".");for(c(e,e,t,r);-1!==a;)a=(o=o.substr(0,a)).lastIndexOf("."),c(e,o,t,r);c(e,n,t,r)}}function u(e){var r=String(e);return Boolean(Object.prototype.hasOwnProperty.call(t,r)&&o(t[r]))}function p(e){for(var t=String(e),r=u(t)||u(n),o=t.lastIndexOf(".");!r&&-1!==o;)o=(t=t.substr(0,o)).lastIndexOf("."),r=u(t);return r}function f(e,t,r,n){var o=l(e="symbol"==typeof e?e.toString():e,t,n);return!!p(e)&&(!0===r?o():setTimeout(o,0),!0)}e.publish=function(t,r){return f(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return f(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,Object.prototype.hasOwnProperty.call(t,e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeAll=function(t){return e.subscribe(n,t)},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n,o=0;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)){for(n in t[r])o++;break}return o},e.getSubscriptions=function(e){var r,n=[];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,a,i=function(e){var r;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e))return!0;return!1},s="string"==typeof r&&(Object.prototype.hasOwnProperty.call(t,r)||i(r)),c=!s&&"string"==typeof r,l="function"==typeof r,u=!1;if(!s){for(n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(o=t[n],c&&o[r]){delete o[r],u=r;break}if(l)for(a in o)Object.prototype.hasOwnProperty.call(o,a)&&o[a]===r&&(delete o[a],u=!0)}return u}e.clearSubscriptions(r)}}(o),void 0!==e&&e.exports&&(t=e.exports=o),t.PubSub=o,e.exports=t=o}(o={exports:{}},o.exports),o.exports);a.PubSub;const i={null:e=>null===e,boolean:e=>"boolean"==typeof e,object:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,array:e=>Array.isArray(e),number:e=>"number"==typeof e,integer:e=>Number.isInteger(e),string:e=>"string"==typeof e},s=e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),o=e.slice(r+1);return[decodeURI(n),decodeURI(o)]},c=e=>{const t=RegExp(/^(.+):\/\//).exec(e);return t?t[1]:""};var l={jsonTypeOf:(e,t)=>i[t](e),splitUrl:s,safeResolveUrl:(e,r)=>{const n=t(e,r),o=s(e)[0];if(o&&"file"===c(n)&&"file"!==c(o))throw Error(`Can't access file '${n}' resource from network context '${e}'`);return n}};const u=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(m)},p=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:p(e,w(t,o,n),r,h(o,n))}}if(Array.isArray(t)){const n=[...t];return n[b(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:w(t,e[0],n)},f=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||g(t)){const o=e.shift();f(e,w(t,o,n),r,h(o,n))}else{t[b(t,e[0])]=r}},d=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=w(t,n,r);return{...t,[n]:d(e,o,h(n,r))}}if(Array.isArray(t))return t.filter(((t,r)=>r!=e[0]));if("object"==typeof t&&null!==t){const{[e[0]]:r,...n}=t;return n}return w(t,e[0],r)}},y=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=w(t,n,r);y(e,o,h(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:w(t,e[0],r)},h=r(((e,t)=>t+"/"+v(e))),v=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),m=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),b=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,w=(e,t,r="")=>{if(void 0===e)throw TypeError(`Value at '${r}' is undefined and does not have property '${t}'`);if(null===e)throw TypeError(`Value at '${r}' is null and does not have property '${t}'`);if(g(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[b(e,t)]},g=e=>null===e||"object"!=typeof e;var O={nil:"",append:h,get:(e,t)=>{const r=u(e),n=e=>r.reduce((([e,t],r)=>[w(e,r,t),h(r,t)]),[e,""])[0];return void 0===t?n:n(t)},set:(e,t,n)=>{const o=u(e),a=r(((e,t)=>p(o,e,t,"")));return void 0===t?a:a(t,n)},assign:(e,t,n)=>{const o=u(e),a=r(((e,t)=>f(o,e,t,"")));return void 0===t?a:a(t,n)},unset:(e,t)=>{const r=u(e),n=e=>d(r,e,"");return void 0===t?n:n(t)},remove:(e,t)=>{const r=u(e),n=e=>y(r,e,"");return void 0===t?n:n(t)}};O.nil,O.append,O.get,O.set,O.assign,O.unset,O.remove;const E=Symbol("$__value"),j=Symbol("$__href");var $={cons:(e,t)=>Object.freeze({[j]:e,[E]:t}),isReference:e=>e&&void 0!==e[j],href:e=>e[j],value:e=>e[E]};const{jsonTypeOf:S}=l,A=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),I=e=>$.isReference(e.value)?$.value(e.value):e.value,T=r(((e,t)=>S(I(e),t))),k=(e,t)=>Object.freeze({...t,pointer:O.append(e,t.pointer),value:I(t)[e]}),x=r(((e,t)=>I(t).map(((r,n,o,a)=>e(k(n,t),n,o,a))))),P=r(((e,t)=>I(t).map(((e,r,n,o)=>k(r,t))).filter(((t,r,n,o)=>e(t,r,n,o))))),V=r(((e,t,r)=>I(r).reduce(((t,n,o)=>e(t,k(o,r),o)),t))),R=r(((e,t)=>I(t).every(((r,n,o,a)=>e(k(n,t),n,o,a))))),C=r(((e,t)=>I(t).some(((r,n,o,a)=>e(k(n,t),n,o,a)))));var U={nil:A,cons:(e,t="")=>Object.freeze({...A,id:t,instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:I,has:(e,t)=>e in I(t),typeOf:T,step:k,entries:e=>Object.keys(I(e)).map((t=>[t,k(t,e)])),keys:e=>Object.keys(I(e)),map:x,filter:P,reduce:V,every:R,some:C,length:e=>I(e).length},K=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,L=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,z=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,_=/\\([\u000b\u0020-\u00ff])/g,D=/([\\"])/g,N=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function q(e){var t=String(e);if(z.test(t))return t;if(t.length>0&&!L.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(D,"\\$1")+'"'}function B(e){this.parameters=Object.create(null),this.type=e}var F={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!N.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,a=Object.keys(t).sort(),i=0;i<a.length;i++){if(o=a[i],!z.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+q(t[o])}return n},parse:function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;"function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.substr(0,r).trim():t.trim();if(!N.test(n))throw new TypeError("invalid media type");var o=new B(n.toLowerCase());if(-1!==r){var a,i,s;for(K.lastIndex=r;i=K.exec(t);){if(i.index!==r)throw new TypeError("invalid parameter format");r+=i[0].length,a=i[1].toLowerCase(),'"'===(s=i[2])[0]&&(s=s.substr(1,s.length-2).replace(_,"$1")),o.parameters[a]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},Z=async e=>Object.entries(await e),J=r((async(e,t)=>(await t).map(e))),M=r((async(e,t,r)=>(await r).reduce((async(t,r)=>e(await t,r)),t))),G=r((async(e,t,r={})=>M((async(t,r)=>await e(r)?t.concat([r]):t),[],t,r))),H=r((async(e,t)=>{const r=await J(e,t);return(await Promise.all(r)).some((e=>e))})),W=r((async(e,t)=>{const r=await J(e,t);return(await Promise.all(r)).every((e=>e))})),Q=r(((e,t)=>e.reduce((async(e,t)=>t(await e)),t))),X={entries:Z,map:J,filter:G,reduce:M,some:H,every:W,pipeline:Q,all:e=>Promise.all(e),allValues:e=>Q([Z,M((async(e,[t,r])=>(e[t]=await r,e)),{})],e)};X.entries,X.map,X.filter,X.reduce,X.some,X.every,X.pipeline,X.all,X.allValues;var Y=fetch;const{jsonTypeOf:ee,splitUrl:te,safeResolveUrl:re}=l,ne={},oe={},ae=(e,t)=>{const r=e in oe?oe[e]:e;if(r in ne)return ne[r][t]},ie={},se={},ce=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=te(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=ae(n,"baseToken"),a=ae(n,"anchorToken"),i=te(t)[0];if(!i&&!te(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const s=re(i,e[o]||""),[c,l]=te(s);delete e[o],l&&o===a&&(e[a]=a!==o?encodeURI(l):`#${encodeURI(l)}`),i&&(se[i]=c);const u={},p=ae(n,"recursiveAnchorToken");let f;!0===e[p]&&(u[""]=`${c}#`,e[a]="",delete e[p]);const d=ae(n,"vocabularyToken");ee(e[d],"object")?(oe[c]=n,f=e[d],delete e[d]):(oe[c]=n,f={[n]:!0});const y={"":""};return ie[c]={id:c,schemaVersion:n,schema:le(e,c,n,O.nil,y,u),anchors:y,dynamicAnchors:u,vocabulary:f,validated:!1},c},le=(e,t,r,n,o,a)=>{if(ee(e,"object")){const i="string"==typeof e.$schema?te(e.$schema)[0]:r,s=ae(i,"embeddedToken"),c=ae(i,"anchorToken");if("string"==typeof e[s]&&(s!==c||"#"!==e[s][0])){const n=re(t,e[s]);return e[s]=n,ce(e,n,r),$.cons(e[s],e)}const l=ae(r,"anchorToken"),u=ae(r,"dynamicAnchorToken");"string"==typeof e[u]&&(a[e[u]]=`${t}#${encodeURI(n)}`,o[e[u]]=n,delete e[u]);const p=ae(r,"embeddedToken");if("string"==typeof e[l]){const t=l!==p?e[l]:e[l].slice(1);o[t]=n,delete e[l]}const f=ae(r,"jrefToken");if("string"==typeof e[f])return $.cons(e[f],e);for(const i in e)e[i]=le(e[i],t,r,O.append(i,n),o,a);return e}return Array.isArray(e)?e.map(((e,i)=>le(e,t,r,O.append(i,n),o,a))):e},ue=e=>ie[se[e]]||ie[e],pe=Object.freeze({id:"",schemaVersion:void 0,vocabulary:{},pointer:O.nil,schema:void 0,value:void 0,anchors:{},dynamicAnchors:{},validated:!0}),fe=async(e,t=pe)=>{const r=re(he(t),e),[n,o]=te(r);if(!(e=>e in ie||e in se)(n)){const e=await Y(n,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error(`Failed to retrieve schema with id: ${n}`);if(e.headers.has("content-type")){const t=F.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${n} is not a schema. Found a document with media type: ${t}`)}ce(await e.json(),n)}const a=ue(n),i="/"!==o[0]?ye(a,o):o,s=Object.freeze({...a,pointer:i,value:O.get(i,a.schema)});return de(s)},de=e=>$.isReference(e.value)?fe($.href(e.value),e):e,ye=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},he=e=>`${e.id}#${encodeURI(e.pointer)}`,ve=e=>$.isReference(e.value)?$.value(e.value):e.value,me=(e,t)=>{const r=ue(t.id),n=Object.freeze({...t,pointer:O.append(e,t.pointer),value:ve(t)[e],validated:r.validated});return de(n)},be=r(((e,t)=>X.pipeline([ve,X.map((async(r,n)=>e(await me(n,t),n))),X.all],t)));var we={setConfig:(e,t,r)=>{ne[e]||(ne[e]={}),ne[e][t]=r},getConfig:ae,add:ce,get:fe,markValidated:e=>{ie[e].validated=!0},uri:he,value:ve,getAnchorPointer:ye,typeOf:(e,t)=>ee(ve(e),t),has:(e,t)=>e in ve(t),step:me,keys:e=>Object.keys(ve(e)),entries:e=>X.pipeline([ve,Object.keys,X.map((async t=>[t,await me(t,e)])),X.all],e),map:be,length:e=>ve(e).length};we.setConfig,we.getConfig,we.add,we.get,we.markValidated,we.uri,we.value,we.getAnchorPointer,we.typeOf,we.has,we.step,we.keys,we.entries,we.map,we.length;class ge extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var Oe=ge;const{splitUrl:Ee}=l,je="FLAG",$e="BASIC",Se="DETAILED",Ae="VERBOSE";let Ie=Se,Te=!0;const ke=async e=>{const t={metaData:{}};return{ast:t,schemaUri:await Le(e,t)}},xe=r((({ast:e,schemaUri:t},r,n=je)=>{if(![je,$e,Se,Ae].includes(n))throw Error(`The '${n}' error format is not supported`);const o=[],i=a.subscribe("result",Pe(n,o));return _e(t,r,e,{}),a.unsubscribe(i),o[0]})),Pe=(e,t)=>{const r=[];return(n,o)=>{if("result"===n){const{keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:a}=o,i={keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:a,errors:[]};r.push(i)}else if("result.start"===n)r.push(n);else if("result.end"===n){const n=r.pop();for(;"result.start"!==r[r.length-1];){const t=r.pop(),o=[t];e===$e&&(o.push(...t.errors),delete t.errors),(e===Ae||e!==je&&!t.valid)&&n.errors.unshift(...o)}r[r.length-1]=n,t[0]=n}}},Ve={},Re=e=>Ve[e],Ce=e=>e in Ve,Ue={},Ke={},Le=async(e,t)=>{if(e=await ze(e),!Ce(`${e.schemaVersion}#validate`)){const t=await we.get(e.schemaVersion);(we.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 Ue)Object.entries(Ue[e]).forEach((([e,r])=>{((e,t)=>{Ve[e]={collectEvaluatedItems:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&new Set,collectEvaluatedProperties:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&[],...t}})(`${t.id}#${e}`,r)}));else if(r)throw Error(`Missing required vocabulary: ${e}`)}))}if(Te&&!e.validated){if(we.markValidated(e.id),!(e.schemaVersion in Ke)){const t=await we.get(e.schemaVersion),r=await ke(t);Ke[t.id]=xe(r)}const t=U.cons(e.schema,e.id),r=Ke[e.schemaVersion](t,Ie);if(!r.valid)throw new Oe(r)}return e.id in t.metaData||(t.metaData[e.id]={id:e.id,dynamicAnchors:e.dynamicAnchors,anchors:e.anchors}),Re(`${e.schemaVersion}#validate`).compile(e,t)},ze=async e=>we.typeOf(e,"string")?ze(await we.get(we.value(e),e)):e,_e=(e,t,r,n)=>{const o=De(e,r),a=Ee(e)[0];return Re(o).interpret(e,t,r,{...r.metaData[a].dynamicAnchors,...n})},De=(e,t)=>{if(!(e in t))throw Error(`No schema found at ${e}`);return t[e][0]};var Ne={validate:async(e,t,r)=>{const n=await ke(e),o=(e,t)=>xe(n,U.cons(e),t);return void 0===t?o:o(t,r)},compile:ke,interpret:xe,setMetaOutputFormat:e=>{Ie=e},setShouldMetaValidate:e=>{Te=e},FLAG:je,BASIC:$e,DETAILED:Se,VERBOSE:Ae,add:(e,t="",r="")=>{const n=we.add(e,t,r);delete Ke[n]},getKeyword:Re,hasKeyword:Ce,defineVocabulary:(e,t)=>{Ue[e]=t},compileSchema:Le,interpretSchema:_e,collectEvaluatedProperties:(e,t,r,n,o)=>{const a=De(e,r);return Re(a).collectEvaluatedProperties(e,t,r,n,o)},collectEvaluatedItems:(e,t,r,n,o)=>{const a=De(e,r);return Re(a).collectEvaluatedItems(e,t,r,n,o)}};var qe={compile:e=>we.value(e),interpret:()=>!0};var Be={compile:async(e,t)=>{const r=we.uri(e);if(!(r in t)){t[r]=!1;const n=we.value(e);if(!["object","boolean"].includes(typeof n))throw Error(`No schema found at '${we.uri(e)}'`);t[r]=[`${e.schemaVersion}#validate`,we.uri(e),"boolean"==typeof n?n:await X.pipeline([we.entries,X.map((([t,r])=>[`${e.schemaVersion}#${t}`,r])),X.filter((([t])=>Ne.hasKeyword(t)&&t!==`${e.schemaVersion}#validate`)),X.map((async([r,n])=>{const o=await Ne.getKeyword(r).compile(n,t,e);return[r,we.uri(n),o]})),X.all],e)]}return r},interpret:(e,t,r,n)=>{const[o,i,s]=r[e];a.publishSync("result.start");const c="boolean"==typeof s?s:s.every((([e,o,i])=>{a.publishSync("result.start");const s=Ne.getKeyword(e).interpret(i,t,r,n);return a.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:U.uri(t),valid:s,ast:i}),a.publishSync("result.end"),s}));return a.publishSync("result",{keyword:o,absoluteKeywordLocation:i,instanceLocation:U.uri(t),valid:c,ast:e}),a.publishSync("result.end"),c},collectEvaluatedProperties:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&[]:a.filter((([e])=>!o||!e.endsWith("#unevaluatedProperties"))).reduce(((e,[o,,a])=>{const i=e&&Ne.getKeyword(o).collectEvaluatedProperties(a,t,r,n);return!1!==i&&[...e,...i]}),[])},collectEvaluatedItems:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&new Set:a.filter((([e])=>!o||!e.endsWith("#unevaluatedItems"))).reduce(((e,[o,,a])=>{const i=!1!==e&&Ne.getKeyword(o).collectEvaluatedItems(a,t,r,n);return!1!==i&&new Set([...e,...i])}),new Set)}},Fe={metaData:qe,validate:Be},Ze=e("default",{Core:Ne,Schema:we,Instance:U,Reference:$,Keywords:Fe,InvalidSchemaError:Oe});e("Core",Ze.Core),e("Schema",Ze.Schema),e("Instance",Ze.Instance),e("Reference",Ze.Reference),e("Keywords",Ze.Keywords),e("InvalidSchemaError",Ze.InvalidSchemaError)}}})); | ||
//# sourceMappingURL=json-schema-core-system.min.js.map |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("url")):"function"==typeof define&&define.amd?define(["exports","url"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).JSC={},e.url)}(this,(function(e,t){"use strict";function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=r(t),o=function(e,t){return function r(){null==t&&(t=e.length);var n=[].slice.call(arguments);return n.length>=t?e.apply(this,n):function(){return r.apply(this,n.concat([].slice.call(arguments)))}}};var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var i=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e,t){var r,n;r="object"==typeof window&&window||a,n={},r.PubSub=n,function(e){var t={},r=-1,n="*";function o(e){var t;for(t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function a(e){return function(){throw e}}function i(e,t,r){try{e(t,r)}catch(e){setTimeout(a(e),0)}}function s(e,t,r){e(t,r)}function u(e,r,n,o){var a,u=t[r],l=o?s:i;if(Object.prototype.hasOwnProperty.call(t,r))for(a in u)Object.prototype.hasOwnProperty.call(u,a)&&l(u[a],e,n)}function l(e,t,r){return function(){var o=String(e),a=o.lastIndexOf(".");for(u(e,e,t,r);-1!==a;)a=(o=o.substr(0,a)).lastIndexOf("."),u(e,o,t,r);u(e,n,t,r)}}function c(e){var r=String(e);return Boolean(Object.prototype.hasOwnProperty.call(t,r)&&o(t[r]))}function f(e){for(var t=String(e),r=c(t)||c(n),o=t.lastIndexOf(".");!r&&-1!==o;)o=(t=t.substr(0,o)).lastIndexOf("."),r=c(t);return r}function h(e,t,r,n){var o=l(e="symbol"==typeof e?e.toString():e,t,n);return!!f(e)&&(!0===r?o():setTimeout(o,0),!0)}e.publish=function(t,r){return h(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return h(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,Object.prototype.hasOwnProperty.call(t,e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeAll=function(t){return e.subscribe(n,t)},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n,o=0;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)){for(n in t[r])o++;break}return o},e.getSubscriptions=function(e){var r,n=[];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,a,i=function(e){var r;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e))return!0;return!1},s="string"==typeof r&&(Object.prototype.hasOwnProperty.call(t,r)||i(r)),u=!s&&"string"==typeof r,l="function"==typeof r,c=!1;if(!s){for(n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(o=t[n],u&&o[r]){delete o[r],c=r;break}if(l)for(a in o)Object.prototype.hasOwnProperty.call(o,a)&&o[a]===r&&(delete o[a],c=!0)}return c}e.clearSubscriptions(r)}}(n),void 0!==e&&e.exports&&(t=e.exports=n),t.PubSub=n,e.exports=t=n}));i.PubSub;var s=function(e,t){if(e=e.trim(),(t=t.trim()).startsWith("about:"))return t;const r=function(e){const t={host:"",path:"",query:"",protocol:""};let r=e,n=e.indexOf("//");t.protocol=r.substring(0,n),n+=2;const o=e.indexOf("/",n),a=e.indexOf("?"),i=e.indexOf("#");-1!==i&&(r=r.substring(0,i));if(-1!==a){const e=r.substring(a);t.query=e,r=r.substring(0,a)}if(-1!==o){const e=r.substring(0,o);t.host=e,r=r.substring(o),t.path=r}else t.host=r;return t}(e),n=function(e){const t={href:e,hash:"",query:"",netPath:!1,absolutePath:!1,relativePath:!1};if(c.test(e))return t.netPath=!0,t;"/"===e[0]?t.absolutePath=!0:""!==e&&(t.relativePath=!0);let r=e;const n=e.indexOf("?"),o=e.indexOf("#");if(-1!==o){const e=r.substring(o);t.hash=e,r=r.substring(0,o)}if(-1!==n){const e=r.substring(n);t.query=e,r=r.substring(0,n)}return t.path=r,t}(t);if(!r.protocol&&!n.netPath)throw new Error("Error, protocol is not specified");if(n.netPath)return function(e){return e.startsWith("//")}(n.href)&&(n.href=r.protocol+n.href),function(e){const t=e.indexOf("//")+2,r=!e.includes("/",t),n=!e.includes("?",t),o=!e.includes("#",t);return r&&n&&o}(n.href)?u(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+l(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let a,i=r.path,s=r.host;return 0===e.length?a=i:(i=i.substring(0,i.lastIndexOf("/")),a=l(i+"/"+e)),s+=""!==a||t||o?a+t+o:"/",s}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:u(e)}};function u(e){return e+("/"===e[e.length-1]?"":"/")}function l(e){let t=e.split("/");""===t[0]&&(t=t.slice(1));let r=[];return t.forEach(((e,n)=>{"."!==e&&(".."===e?r.pop():""===e&&n!==t.length-1||r.push(e))})),"/"+r.join("/")}const c=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");const f={null:e=>null===e,boolean:e=>"boolean"==typeof e,object:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,array:e=>Array.isArray(e),number:e=>"number"==typeof e,integer:e=>Number.isInteger(e),string:e=>"string"==typeof e},h=e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),o=e.slice(r+1);return[decodeURI(n),decodeURI(o)]},m=e=>{const t=RegExp(/^(.+):\/\//).exec(e);return t?t[1]:""};var p={jsonTypeOf:(e,t)=>f[t](e),splitUrl:h,safeResolveUrl:(e,t)=>{const r=s(e,t),n=h(e)[0];if(n&&"file"===m(r)&&"file"!==m(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r}};const d=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(O)},y=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:y(e,S(t,o,n),r,x(o,n))}}if(Array.isArray(t)){const n=[...t];return n[E(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:S(t,e[0],n)},v=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||I(t)){const o=e.shift();v(e,S(t,o,n),r,x(o,n))}else{t[E(t,e[0])]=r}},b=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=S(t,n,r);return{...t,[n]:b(e,o,x(n,r))}}if(Array.isArray(t))return t.filter(((t,r)=>r!=e[0]));if("object"==typeof t&&null!==t){const{[e[0]]:r,...n}=t;return n}return S(t,e[0],r)}},g=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=S(t,n,r);g(e,o,x(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:S(t,e[0],r)},x=o(((e,t)=>t+"/"+w(e))),w=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),O=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),E=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,S=(e,t,r="")=>{if(void 0===e)throw TypeError(`Value at '${r}' is undefined and does not have property '${t}'`);if(null===e)throw TypeError(`Value at '${r}' is null and does not have property '${t}'`);if(I(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[E(e,t)]},I=e=>null===e||"object"!=typeof e;var j={nil:"",append:x,get:(e,t)=>{const r=d(e),n=e=>r.reduce((([e,t],r)=>[S(e,r,t),x(r,t)]),[e,""])[0];return void 0===t?n:n(t)},set:(e,t,r)=>{const n=d(e),a=o(((e,t)=>y(n,e,t,"")));return void 0===t?a:a(t,r)},assign:(e,t,r)=>{const n=d(e),a=o(((e,t)=>v(n,e,t,"")));return void 0===t?a:a(t,r)},unset:(e,t)=>{const r=d(e),n=e=>b(r,e,"");return void 0===t?n:n(t)},remove:(e,t)=>{const r=d(e),n=e=>g(r,e,"");return void 0===t?n:n(t)}};j.nil,j.append,j.get,j.set,j.assign,j.unset,j.remove;const P=Symbol("$__value"),T=Symbol("$__href");var A={cons:(e,t)=>Object.freeze({[T]:e,[P]:t}),isReference:e=>e&&void 0!==e[T],href:e=>e[T],value:e=>e[P]};const{jsonTypeOf:R}=p,$=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),V=e=>A.isReference(e.value)?A.value(e.value):e.value,k=o(((e,t)=>R(V(e),t))),L=(e,t)=>Object.freeze({...t,pointer:j.append(e,t.pointer),value:V(t)[e]}),H=o(((e,t)=>V(t).map(((r,n,o,a)=>e(L(n,t),n,o,a))))),U=o(((e,t)=>V(t).map(((e,r,n,o)=>L(r,t))).filter(((t,r,n,o)=>e(t,r,n,o))))),q=o(((e,t,r)=>V(r).reduce(((t,n,o)=>e(t,L(o,r),o)),t))),D=o(((e,t)=>V(t).every(((r,n,o,a)=>e(L(n,t),n,o,a))))),_=o(((e,t)=>V(t).some(((r,n,o,a)=>e(L(n,t),n,o,a)))));var C={nil:$,cons:(e,t="")=>Object.freeze({...$,id:t,instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:V,has:(e,t)=>e in V(t),typeOf:k,step:L,entries:e=>Object.keys(V(e)).map((t=>[t,L(t,e)])),keys:e=>Object.keys(V(e)),map:H,filter:U,reduce:q,every:D,some:_,length:e=>V(e).length},Q=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,z=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,B=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,K=/\\([\u000b\u0020-\u00ff])/g,N=/([\\"])/g,M=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function J(e){var t=String(e);if(B.test(t))return t;if(t.length>0&&!z.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(N,"\\$1")+'"'}function F(e){this.parameters=Object.create(null),this.type=e}var W={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!M.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,a=Object.keys(t).sort(),i=0;i<a.length;i++){if(o=a[i],!B.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+J(t[o])}return n},parse:function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;"function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.substr(0,r).trim():t.trim();if(!M.test(n))throw new TypeError("invalid media type");var o=new F(n.toLowerCase());if(-1!==r){var a,i,s;for(Q.lastIndex=r;i=Q.exec(t);){if(i.index!==r)throw new TypeError("invalid parameter format");r+=i[0].length,a=i[1].toLowerCase(),'"'===(s=i[2])[0]&&(s=s.substr(1,s.length-2).replace(K,"$1")),o.parameters[a]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},Z=async e=>Object.entries(await e),G=o((async(e,t)=>(await t).map(e))),X=o((async(e,t,r)=>(await r).reduce((async(t,r)=>e(await t,r)),t))),Y=o((async(e,t,r={})=>X((async(t,r)=>await e(r)?t.concat([r]):t),[],t,r))),ee=o((async(e,t)=>{const r=await G(e,t);return(await Promise.all(r)).some((e=>e))})),te=o((async(e,t)=>{const r=await G(e,t);return(await Promise.all(r)).every((e=>e))})),re=o(((e,t)=>e.reduce((async(e,t)=>t(await e)),t))),ne={entries:Z,map:G,filter:Y,reduce:X,some:ee,every:te,pipeline:re,all:e=>Promise.all(e),allValues:e=>re([Z,X((async(e,[t,r])=>(e[t]=await r,e)),{})],e)};ne.entries,ne.map,ne.filter,ne.reduce,ne.some,ne.every,ne.pipeline,ne.all,ne.allValues;var oe={ABSOLUTE:"absolute",PATH_RELATIVE:"pathRelative",ROOT_RELATIVE:"rootRelative",SHORTEST:"shortest"};function ae(e,t){var r=t.removeEmptyQueries&&e.extra.relation.minimumPort;return e.query.string[r?"stripped":"full"]}function ie(e,t){return!e.extra.relation.minimumQuery||t.output===oe.ABSOLUTE||t.output===oe.ROOT_RELATIVE}function se(e,t){var r=t.removeDirectoryIndexes&&e.extra.resourceIsIndex,n=e.extra.relation.minimumResource&&t.output!==oe.ABSOLUTE&&t.output!==oe.ROOT_RELATIVE;return!!e.resource&&!n&&!r}var ue=function(e,t){var r="";return r+=function(e,t){var r="";return(e.extra.relation.maximumHost||t.output===oe.ABSOLUTE)&&(e.extra.relation.minimumScheme&&t.schemeRelative&&t.output!==oe.ABSOLUTE?r+="//":r+=e.scheme+"://"),r}(e,t),r+=function(e,t){return!e.auth||t.removeAuth||!e.extra.relation.maximumHost&&t.output!==oe.ABSOLUTE?"":e.auth+"@"}(e,t),r+=function(e,t){return e.host.full&&(e.extra.relation.maximumAuth||t.output===oe.ABSOLUTE)?e.host.full:""}(e,t),r+=function(e,t){return e.port&&!e.extra.portIsDefault&&e.extra.relation.maximumHost?":"+e.port:""}(e),r+=function(e,t){var r="",n=e.path.absolute.string,o=e.path.relative.string,a=se(e,t);if(e.extra.relation.maximumHost||t.output===oe.ABSOLUTE||t.output===oe.ROOT_RELATIVE)r=n;else if(o.length<=n.length&&t.output===oe.SHORTEST||t.output===oe.PATH_RELATIVE){if(""===(r=o)){var i=ie(e,t)&&!!ae(e,t);e.extra.relation.maximumPath&&!a?r="./":!e.extra.relation.overridesQuery||a||i||(r="./")}}else r=n;return"/"!==r||a||!t.removeRootTrailingSlash||e.extra.relation.minimumPort&&t.output!==oe.ABSOLUTE||(r=""),r}(e,t),r+=function(e,t){return se(e,t)?e.resource:""}(e,t),r+=function(e,t){return ie(e,t)?ae(e,t):""}(e,t),r+=function(e,t){return e.hash?e.hash:""}(e)};var le={clone:function e(t){if(t instanceof Object){var r=t instanceof Array?[]:{};for(var n in t)t.hasOwnProperty(n)&&(r[n]=e(t[n]));return r}return t},isPlainObject:function(e){return!!e&&"object"==typeof e&&e.constructor===Object},shallowMerge:function(e,t){if(e instanceof Object&&t instanceof Object)for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e}};function ce(e,t){return t instanceof Object&&e instanceof Object?t instanceof Array&&e instanceof Array?t.concat(e):le.shallowMerge(e,t):e}var fe=function(e,t){if(le.isPlainObject(e)){var r={};for(var n in t)t.hasOwnProperty(n)&&(void 0!==e[n]?r[n]=ce(e[n],t[n]):r[n]=t[n]);return r}return t};var he=function(e){var t=!(e.scheme||e.auth||e.host.full||e.port),r=t&&!e.path.absolute.string,n=r&&!e.resource,o=n&&!e.query.string.full.length,a=o&&!e.hash;e.extra.hrefInfo.minimumPathOnly=t,e.extra.hrefInfo.minimumResourceOnly=r,e.extra.hrefInfo.minimumQueryOnly=n,e.extra.hrefInfo.minimumHashOnly=o,e.extra.hrefInfo.empty=a};var me=function(e,t){if(t.ignore_www){var r=e.host.full;if(r){var n=r;0===r.indexOf("www.")&&(n=r.substr(4)),e.host.stripped=n}}};function pe(e){if("/"!==e){var t=[];return e.split("/").forEach((function(e){""!==e&&t.push(e)})),t}return[]}var de=function(e,t){var r=e.path.absolute.string;if(r){var n=r.lastIndexOf("/");if(n>-1){if(++n<r.length){var o=r.substr(n);"."!==o&&".."!==o?(e.resource=o,r=r.substr(0,n)):r+="/"}e.path.absolute.string=r,e.path.absolute.array=pe(r)}else"."===r||".."===r?(r+="/",e.path.absolute.string=r,e.path.absolute.array=pe(r)):(e.resource=r,e.path.absolute.string=null);e.extra.resourceIsIndex=function(e,t){var r=!1;return t.directoryIndexes.every((function(t){return t!==e||(r=!0,!1)})),r}(e.resource,t)}};var ye=function(e,t){var r=-1;for(var n in t.defaultPorts)if(n===e.scheme&&t.defaultPorts.hasOwnProperty(n)){r=t.defaultPorts[n];break}r>-1&&(r=r.toString(),null===e.port&&(e.port=r),e.extra.portIsDefault=e.port===r)},ve=Object.prototype.hasOwnProperty;function be(e,t){var r=0,n="";for(var o in e)if(""!==o&&!0===ve.call(e,o)){var a=e[o];""===a&&t||(n+=1==++r?"?":"&",o=encodeURIComponent(o),n+=""!==a?o+"="+encodeURIComponent(a).replace(/%20/g,"+"):o)}return n}var ge=function(e,t){e.query.string.full=be(e.query.object,!1),t.removeEmptyQueries&&(e.query.string.stripped=be(e.query.object,!0))},xe=n.default.parse;var we=function(e,t){return function(e,t){var r=!0;return t.rejectedSchemes.every((function(t){return r=!(0===e.indexOf(t+":"))})),r}(e,t)?(r=xe(e,!0,t.slashesDenoteHost),(n=r.protocol)&&n.indexOf(":")===n.length-1&&(n=n.substr(0,n.length-1)),r.host={full:r.hostname,stripped:null},r.path={absolute:{array:null,string:r.pathname},relative:{array:null,string:null}},r.query={object:r.query,string:{full:null,stripped:null}},r.extra={hrefInfo:{minimumPathOnly:null,minimumResourceOnly:null,minimumQueryOnly:null,minimumHashOnly:null,empty:null,separatorOnlyQuery:"?"===r.search},portIsDefault:null,relation:{maximumScheme:null,maximumAuth:null,maximumHost:null,maximumPort:null,maximumPath:null,maximumResource:null,maximumQuery:null,maximumHash:null,minimumScheme:null,minimumAuth:null,minimumHost:null,minimumPort:null,minimumPath:null,minimumResource:null,minimumQuery:null,minimumHash:null,overridesQuery:null},resourceIsIndex:null,slashes:r.slashes},r.resource=null,r.scheme=n,delete r.hostname,delete r.pathname,delete r.protocol,delete r.search,delete r.slashes,r):{href:e,valid:!1};var r,n};var Oe={join:function(e){return e.length>0?e.join("/")+"/":""},resolveDotSegments:function(e){var t=[];return e.forEach((function(e){".."!==e?"."!==e&&t.push(e):t.length>0&&t.splice(t.length-1,1)})),t}};function Ee(e,t){var r=we(e,t);return!1===r.valid||(me(r,t),ye(r,t),de(r,t),ge(r,t),he(r)),r}var Se={from:function(e,t,r){if(e){var n=Ee(e,t),o=Oe.resolveDotSegments(n.path.absolute.array);return n.path.absolute.array=o,n.path.absolute.string="/"+Oe.join(o),n}return r},to:Ee};var Ie={pathOn:function(e,t,r){var n=e.extra.hrefInfo.minimumQueryOnly,o=e.extra.hrefInfo.minimumHashOnly,a=e.extra.hrefInfo.empty,i=e.extra.relation.minimumPort,s=e.extra.relation.minimumScheme,u=i&&e.path.absolute.string===t.path.absolute.string,l=e.resource===t.resource||!e.resource&&t.extra.resourceIsIndex||r.removeDirectoryIndexes&&e.extra.resourceIsIndex&&!t.resource,c=u&&(l||n||o||a),f=r.removeEmptyQueries?"stripped":"full",h=e.query.string[f],m=t.query.string[f],p=c&&!!h&&h===m||(o||a)&&!e.extra.hrefInfo.separatorOnlyQuery,d=p&&e.hash===t.hash;e.extra.relation.minimumPath=u,e.extra.relation.minimumResource=c,e.extra.relation.minimumQuery=p,e.extra.relation.minimumHash=d,e.extra.relation.maximumPort=!s||s&&!u,e.extra.relation.maximumPath=!s||s&&!c,e.extra.relation.maximumResource=!s||s&&!p,e.extra.relation.maximumQuery=!s||s&&!d,e.extra.relation.maximumHash=!s||s&&!d,e.extra.relation.overridesQuery=u&&e.extra.relation.maximumResource&&!p&&!!m},upToPath:function(e,t,r){var n=e.extra.hrefInfo.minimumPathOnly,o=e.scheme===t.scheme||!e.scheme,a=o&&(e.auth===t.auth||r.removeAuth||n),i=r.ignore_www?"stripped":"full",s=a&&(e.host[i]===t.host[i]||n),u=s&&(e.port===t.port||n);e.extra.relation.minimumScheme=o,e.extra.relation.minimumAuth=a,e.extra.relation.minimumHost=s,e.extra.relation.minimumPort=u,e.extra.relation.maximumScheme=!o||o&&!a,e.extra.relation.maximumAuth=!o||o&&!s,e.extra.relation.maximumHost=!o||o&&!u}};var je=function(e,t,r){Ie.upToPath(e,t,r),e.extra.relation.minimumScheme&&(e.scheme=t.scheme),e.extra.relation.minimumAuth&&(e.auth=t.auth),e.extra.relation.minimumHost&&(e.host=le.clone(t.host)),e.extra.relation.minimumPort&&function(e,t){e.port=t.port,e.extra.portIsDefault=t.extra.portIsDefault}(e,t),e.extra.relation.minimumScheme&&function(e,t){if(e.extra.relation.maximumHost||!e.extra.hrefInfo.minimumResourceOnly){var r=e.path.absolute.array,n="/";r?(e.extra.hrefInfo.minimumPathOnly&&0!==e.path.absolute.string.indexOf("/")&&(r=t.path.absolute.array.concat(r)),r=Oe.resolveDotSegments(r),n+=Oe.join(r)):r=[],e.path.absolute.array=r,e.path.absolute.string=n}else e.path=le.clone(t.path)}(e,t),Ie.pathOn(e,t,r),e.extra.relation.minimumResource&&function(e,t){e.resource=t.resource,e.extra.resourceIsIndex=t.extra.resourceIsIndex}(e,t),e.extra.relation.minimumQuery&&(e.query=le.clone(t.query)),e.extra.relation.minimumHash&&(e.hash=t.hash)};var Pe=function(e,t,r){if(e.extra.relation.minimumScheme){var n=(o=e.path.absolute.array,a=t.path.absolute.array,i=[],s=!0,u=-1,a.forEach((function(e,t){s&&(o[t]!==e?s=!1:u=t),s||i.push("..")})),o.forEach((function(e,t){t>u&&i.push(e)})),i);e.path.relative.array=n,e.path.relative.string=Oe.join(n)}var o,a,i,s,u};var Te=function(e,t,r){return je(t,e,r),Pe(t,e),t};function Ae(e,t){this.options=fe(t,{defaultPorts:{ftp:21,http:80,https:443},directoryIndexes:["index.html"],ignore_www:!1,output:Ae.SHORTEST,rejectedSchemes:["data","javascript","mailto"],removeAuth:!1,removeDirectoryIndexes:!0,removeEmptyQueries:!1,removeRootTrailingSlash:!0,schemeRelative:!0,site:void 0,slashesDenoteHost:!0}),this.from=Se.from(e,this.options,null)}Ae.prototype.relate=function(e,t,r){if(le.isPlainObject(t)?(r=t,t=e,e=null):t||(t=e,e=null),r=fe(r,this.options),e=e||r.site,!(e=Se.from(e,r,this.from))||!e.href)throw new Error("from value not defined.");if(e.extra.hrefInfo.minimumPathOnly)throw new Error("from value supplied is not absolute: "+e.href);return!1===(t=Se.to(t,r)).valid?t.href:(t=Te(e,t,r),t=ue(t,r))},Ae.relate=function(e,t,r){return(new Ae).relate(e,t,r)},le.shallowMerge(Ae,oe);var Re=Ae,$e=fetch;const{jsonTypeOf:Ve,splitUrl:ke,safeResolveUrl:Le}=p,He={},Ue={},qe=(e,t)=>{const r=e in Ue?Ue[e]:e;if(r in He)return He[r][t]},De={},_e={},Ce=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=ke(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=qe(n,"baseToken"),a=qe(n,"anchorToken"),i=ke(t)[0];if(!i&&!ke(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const s=Le(i,e[o]||""),[u,l]=ke(s);delete e[o],l&&o===a&&(e[a]=a!==o?encodeURI(l):`#${encodeURI(l)}`),i&&(_e[i]=u);const c={},f=qe(n,"recursiveAnchorToken");let h;!0===e[f]&&(c[""]=`${u}#`,e[a]="",delete e[f]);const m=qe(n,"vocabularyToken");Ve(e[m],"object")?(Ue[u]=n,h=e[m],delete e[m]):(Ue[u]=n,h={[n]:!0});const p={"":""};return De[u]={id:u,schemaVersion:n,schema:Qe(e,u,n,j.nil,p,c),anchors:p,dynamicAnchors:c,vocabulary:h,validated:!1},u},Qe=(e,t,r,n,o,a)=>{if(Ve(e,"object")){const i="string"==typeof e.$schema?ke(e.$schema)[0]:r,s=qe(i,"embeddedToken"),u=qe(i,"anchorToken");if("string"==typeof e[s]&&(s!==u||"#"!==e[s][0])){const n=Le(t,e[s]);return e[s]=n,Ce(e,n,r),A.cons(e[s],e)}const l=qe(r,"anchorToken"),c=qe(r,"dynamicAnchorToken");"string"==typeof e[c]&&(a[e[c]]=`${t}#${encodeURI(n)}`,o[e[c]]=n,delete e[c]);const f=qe(r,"embeddedToken");if("string"==typeof e[l]){const t=l!==f?e[l]:e[l].slice(1);o[t]=n,delete e[l]}const h=qe(r,"jrefToken");if("string"==typeof e[h])return A.cons(e[h],e);for(const i in e)e[i]=Qe(e[i],t,r,j.append(i,n),o,a);return e}return Array.isArray(e)?e.map(((e,i)=>Qe(e,t,r,j.append(i,n),o,a))):e},ze=e=>De[_e[e]]||De[e],Be=Object.freeze({id:"",schemaVersion:void 0,vocabulary:{},pointer:j.nil,schema:void 0,value:void 0,anchors:{},dynamicAnchors:{},validated:!0}),Ke=async(e,t=Be)=>{const r=Le(Je(t),e),[n,o]=ke(r);if(!(e=>e in De||e in _e)(n)){const e=await $e(n,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error(`Failed to retrieve schema with id: ${n}`);if(e.headers.has("content-type")){const t=W.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${n} is not a schema. Found a document with media type: ${t}`)}Ce(await e.json(),n)}const a=ze(n),i="/"!==o[0]?Me(a,o):o,s=Object.freeze({...a,pointer:i,value:j.get(i,a.schema)});return Ne(s)},Ne=e=>A.isReference(e.value)?Ke(A.href(e.value),e):e,Me=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},Je=e=>`${e.id}#${encodeURI(e.pointer)}`,Fe=e=>A.isReference(e.value)?A.value(e.value):e.value,We=(e,t)=>{const r=ze(t.id),n=Object.freeze({...t,pointer:j.append(e,t.pointer),value:Fe(t)[e],validated:r.validated});return Ne(n)},Ze=o(((e,t)=>ne.pipeline([Fe,ne.map((async(r,n)=>e(await We(n,t),n))),ne.all],t))),Ge={parentId:"",parentDialect:"",includeEmbedded:!0},Xe=(e,t)=>t.startsWith("file://")?""===e?"":Re.relate(e,t):t;var Ye={setConfig:(e,t,r)=>{He[e]||(He[e]={}),He[e][t]=r},getConfig:qe,add:Ce,get:Ke,markValidated:e=>{De[e].validated=!0},uri:Je,value:Fe,getAnchorPointer:Me,typeOf:(e,t)=>Ve(Fe(e),t),has:(e,t)=>e in Fe(t),step:We,keys:e=>Object.keys(Fe(e)),entries:e=>ne.pipeline([Fe,Object.keys,ne.map((async t=>[t,await We(t,e)])),ne.all],e),map:Ze,length:e=>Fe(e).length,toSchema:(e,t={})=>{const r={...Ge,...t},n=JSON.parse(JSON.stringify(e.schema,((t,n)=>{if(!A.isReference(n))return n;const o=A.value(n),a=o.$schema||e.schemaVersion,i=qe(a,"embeddedToken");return!r.includeEmbedded&&i in o?void 0:A.value(n)}))),o=qe(e.schemaVersion,"dynamicAnchorToken");Object.entries(e.dynamicAnchors).forEach((([e,t])=>{const r=ke(t)[1];j.assign(r,n,{[o]:e,...j.get(r,n)})}));const a=qe(e.schemaVersion,"anchorToken");Object.entries(e.anchors).filter((([e])=>""!==e)).forEach((([e,t])=>{j.assign(t,n,{[a]:e,...j.get(t,n)})}));const i=qe(e.schemaVersion,"baseToken"),s=Xe(r.parentId,e.id),u=r.parentDialect===e.schemaVersion?"":e.schemaVersion;return{...s&&{[i]:s},...u&&{$schema:u},...n}}};Ye.setConfig,Ye.getConfig,Ye.add,Ye.get,Ye.markValidated,Ye.uri,Ye.value,Ye.getAnchorPointer,Ye.typeOf,Ye.has,Ye.step,Ye.keys,Ye.entries,Ye.map,Ye.length,Ye.toSchema;class et extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var tt=et;const{splitUrl:rt}=p,nt="FLAG",ot="BASIC",at="DETAILED",it="VERBOSE";let st=at,ut=!0;const lt=async e=>{const t={metaData:{}};return{ast:t,schemaUri:await vt(e,t)}},ct=o((({ast:e,schemaUri:t},r,n=nt)=>{if(![nt,ot,at,it].includes(n))throw Error(`The '${n}' error format is not supported`);const o=[],a=i.subscribe("result",ft(n,o));return gt(t,r,e,{}),i.unsubscribe(a),o[0]})),ft=(e,t)=>{const r=[];return(n,o)=>{if("result"===n){const{keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:a}=o,i={keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:a,errors:[]};r.push(i)}else if("result.start"===n)r.push(n);else if("result.end"===n){const n=r.pop();for(;"result.start"!==r[r.length-1];){const t=r.pop(),o=[t];e===ot&&(o.push(...t.errors),delete t.errors),(e===it||e!==nt&&!t.valid)&&n.errors.unshift(...o)}r[r.length-1]=n,t[0]=n}}},ht={},mt=e=>ht[e],pt=e=>e in ht,dt={},yt={},vt=async(e,t)=>{if(e=await bt(e),!pt(`${e.schemaVersion}#validate`)){const t=await Ye.get(e.schemaVersion);(Ye.getConfig(t.id,"mandatoryVocabularies")||[]).forEach((e=>{if(!t.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)})),Object.entries(t.vocabulary).forEach((([e,r])=>{if(e in dt)Object.entries(dt[e]).forEach((([e,r])=>{((e,t)=>{ht[e]={collectEvaluatedItems:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&new Set,collectEvaluatedProperties:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&[],...t}})(`${t.id}#${e}`,r)}));else if(r)throw Error(`Missing required vocabulary: ${e}`)}))}if(ut&&!e.validated){if(Ye.markValidated(e.id),!(e.schemaVersion in yt)){const t=await Ye.get(e.schemaVersion),r=await lt(t);yt[t.id]=ct(r)}const t=C.cons(e.schema,e.id),r=yt[e.schemaVersion](t,st);if(!r.valid)throw new tt(r)}return e.id in t.metaData||(t.metaData[e.id]={id:e.id,dynamicAnchors:e.dynamicAnchors,anchors:e.anchors}),mt(`${e.schemaVersion}#validate`).compile(e,t)},bt=async e=>Ye.typeOf(e,"string")?bt(await Ye.get(Ye.value(e),e)):e,gt=(e,t,r,n)=>{const o=xt(e,r),a=rt(e)[0];return mt(o).interpret(e,t,r,{...r.metaData[a].dynamicAnchors,...n})},xt=(e,t)=>{if(!(e in t))throw Error(`No schema found at ${e}`);return t[e][0]};var wt={validate:async(e,t,r)=>{const n=await lt(e),o=(e,t)=>ct(n,C.cons(e),t);return void 0===t?o:o(t,r)},compile:lt,interpret:ct,setMetaOutputFormat:e=>{st=e},setShouldMetaValidate:e=>{ut=e},FLAG:nt,BASIC:ot,DETAILED:at,VERBOSE:it,add:(e,t="",r="")=>{const n=Ye.add(e,t,r);delete yt[n]},getKeyword:mt,hasKeyword:pt,defineVocabulary:(e,t)=>{dt[e]=t},compileSchema:vt,interpretSchema:gt,collectEvaluatedProperties:(e,t,r,n,o)=>{const a=xt(e,r);return mt(a).collectEvaluatedProperties(e,t,r,n,o)},collectEvaluatedItems:(e,t,r,n,o)=>{const a=xt(e,r);return mt(a).collectEvaluatedItems(e,t,r,n,o)}};var Ot={compile:e=>Ye.value(e),interpret:()=>!0};var Et={compile:async(e,t)=>{const r=Ye.uri(e);if(!(r in t)){t[r]=!1;const n=Ye.value(e);if(!["object","boolean"].includes(typeof n))throw Error(`No schema found at '${Ye.uri(e)}'`);t[r]=[`${e.schemaVersion}#validate`,Ye.uri(e),"boolean"==typeof n?n:await ne.pipeline([Ye.entries,ne.map((([t,r])=>[`${e.schemaVersion}#${t}`,r])),ne.filter((([t])=>wt.hasKeyword(t)&&t!==`${e.schemaVersion}#validate`)),ne.map((async([r,n])=>{const o=await wt.getKeyword(r).compile(n,t,e);return[r,Ye.uri(n),o]})),ne.all],e)]}return r},interpret:(e,t,r,n)=>{const[o,a,s]=r[e];i.publishSync("result.start");const u="boolean"==typeof s?s:s.every((([e,o,a])=>{i.publishSync("result.start");const s=wt.getKeyword(e).interpret(a,t,r,n);return i.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:C.uri(t),valid:s,ast:a}),i.publishSync("result.end"),s}));return i.publishSync("result",{keyword:o,absoluteKeywordLocation:a,instanceLocation:C.uri(t),valid:u,ast:e}),i.publishSync("result.end"),u},collectEvaluatedProperties:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&[]:a.filter((([e])=>!o||!e.endsWith("#unevaluatedProperties"))).reduce(((e,[o,,a])=>{const i=e&&wt.getKeyword(o).collectEvaluatedProperties(a,t,r,n);return!1!==i&&[...e,...i]}),[])},collectEvaluatedItems:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&new Set:a.filter((([e])=>!o||!e.endsWith("#unevaluatedItems"))).reduce(((e,[o,,a])=>{const i=!1!==e&&wt.getKeyword(o).collectEvaluatedItems(a,t,r,n);return!1!==i&&new Set([...e,...i])}),new Set)}},St={metaData:Ot,validate:Et},It={Core:wt,Schema:Ye,Instance:C,Reference:A,Keywords:St,InvalidSchemaError:tt},jt=It.Core,Pt=It.Schema,Tt=It.Instance,At=It.Reference,Rt=It.Keywords,$t=It.InvalidSchemaError;e.Core=jt,e.Instance=Tt,e.InvalidSchemaError=$t,e.Keywords=Rt,e.Reference=At,e.Schema=Pt,e.default=It,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("url-resolve-browser")):"function"==typeof define&&define.amd?define(["exports","url-resolve-browser"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).JSC={},e.urlResolveBrowser)}(this,(function(e,t){"use strict";function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=r(t),o=function(e,t){return function r(){null==t&&(t=e.length);var n=[].slice.call(arguments);return n.length>=t?e.apply(this,n):function(){return r.apply(this,n.concat([].slice.call(arguments)))}}};var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var i=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e,t){var r,n;r="object"==typeof window&&window||a,n={},r.PubSub=n,function(e){var t={},r=-1,n="*";function o(e){var t;for(t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function a(e){return function(){throw e}}function i(e,t,r){try{e(t,r)}catch(e){setTimeout(a(e),0)}}function s(e,t,r){e(t,r)}function c(e,r,n,o){var a,c=t[r],l=o?s:i;if(Object.prototype.hasOwnProperty.call(t,r))for(a in c)Object.prototype.hasOwnProperty.call(c,a)&&l(c[a],e,n)}function l(e,t,r){return function(){var o=String(e),a=o.lastIndexOf(".");for(c(e,e,t,r);-1!==a;)a=(o=o.substr(0,a)).lastIndexOf("."),c(e,o,t,r);c(e,n,t,r)}}function u(e){var r=String(e);return Boolean(Object.prototype.hasOwnProperty.call(t,r)&&o(t[r]))}function f(e){for(var t=String(e),r=u(t)||u(n),o=t.lastIndexOf(".");!r&&-1!==o;)o=(t=t.substr(0,o)).lastIndexOf("."),r=u(t);return r}function p(e,t,r,n){var o=l(e="symbol"==typeof e?e.toString():e,t,n);return!!f(e)&&(!0===r?o():setTimeout(o,0),!0)}e.publish=function(t,r){return p(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return p(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,Object.prototype.hasOwnProperty.call(t,e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeAll=function(t){return e.subscribe(n,t)},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n,o=0;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)){for(n in t[r])o++;break}return o},e.getSubscriptions=function(e){var r,n=[];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,a,i=function(e){var r;for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&0===r.indexOf(e))return!0;return!1},s="string"==typeof r&&(Object.prototype.hasOwnProperty.call(t,r)||i(r)),c=!s&&"string"==typeof r,l="function"==typeof r,u=!1;if(!s){for(n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if(o=t[n],c&&o[r]){delete o[r],u=r;break}if(l)for(a in o)Object.prototype.hasOwnProperty.call(o,a)&&o[a]===r&&(delete o[a],u=!0)}return u}e.clearSubscriptions(r)}}(n),void 0!==e&&e.exports&&(t=e.exports=n),t.PubSub=n,e.exports=t=n}));i.PubSub;const s={null:e=>null===e,boolean:e=>"boolean"==typeof e,object:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,array:e=>Array.isArray(e),number:e=>"number"==typeof e,integer:e=>Number.isInteger(e),string:e=>"string"==typeof e},c=e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),o=e.slice(r+1);return[decodeURI(n),decodeURI(o)]},l=e=>{const t=RegExp(/^(.+):\/\//).exec(e);return t?t[1]:""};var u={jsonTypeOf:(e,t)=>s[t](e),splitUrl:c,safeResolveUrl:(e,t)=>{const r=n.default(e,t),o=c(e)[0];if(o&&"file"===l(r)&&"file"!==l(o))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r}};const f=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(b)},p=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:p(e,g(t,o,n),r,v(o,n))}}if(Array.isArray(t)){const n=[...t];return n[w(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:g(t,e[0],n)},d=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||O(t)){const o=e.shift();d(e,g(t,o,n),r,v(o,n))}else{t[w(t,e[0])]=r}},y=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=g(t,n,r);return{...t,[n]:y(e,o,v(n,r))}}if(Array.isArray(t))return t.filter(((t,r)=>r!=e[0]));if("object"==typeof t&&null!==t){const{[e[0]]:r,...n}=t;return n}return g(t,e[0],r)}},h=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=g(t,n,r);h(e,o,v(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:g(t,e[0],r)},v=o(((e,t)=>t+"/"+m(e))),m=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),b=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),w=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,g=(e,t,r="")=>{if(void 0===e)throw TypeError(`Value at '${r}' is undefined and does not have property '${t}'`);if(null===e)throw TypeError(`Value at '${r}' is null and does not have property '${t}'`);if(O(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[w(e,t)]},O=e=>null===e||"object"!=typeof e;var j={nil:"",append:v,get:(e,t)=>{const r=f(e),n=e=>r.reduce((([e,t],r)=>[g(e,r,t),v(r,t)]),[e,""])[0];return void 0===t?n:n(t)},set:(e,t,r)=>{const n=f(e),a=o(((e,t)=>p(n,e,t,"")));return void 0===t?a:a(t,r)},assign:(e,t,r)=>{const n=f(e),a=o(((e,t)=>d(n,e,t,"")));return void 0===t?a:a(t,r)},unset:(e,t)=>{const r=f(e),n=e=>y(r,e,"");return void 0===t?n:n(t)},remove:(e,t)=>{const r=f(e),n=e=>h(r,e,"");return void 0===t?n:n(t)}};j.nil,j.append,j.get,j.set,j.assign,j.unset,j.remove;const E=Symbol("$__value"),$=Symbol("$__href");var S={cons:(e,t)=>Object.freeze({[$]:e,[E]:t}),isReference:e=>e&&void 0!==e[$],href:e=>e[$],value:e=>e[E]};const{jsonTypeOf:A}=u,T=Object.freeze({id:"",pointer:"",instance:void 0,value:void 0}),I=e=>S.isReference(e.value)?S.value(e.value):e.value,x=o(((e,t)=>A(I(e),t))),k=(e,t)=>Object.freeze({...t,pointer:j.append(e,t.pointer),value:I(t)[e]}),P=o(((e,t)=>I(t).map(((r,n,o,a)=>e(k(n,t),n,o,a))))),V=o(((e,t)=>I(t).map(((e,r,n,o)=>k(r,t))).filter(((t,r,n,o)=>e(t,r,n,o))))),R=o(((e,t,r)=>I(r).reduce(((t,n,o)=>e(t,k(o,r),o)),t))),C=o(((e,t)=>I(t).every(((r,n,o,a)=>e(k(n,t),n,o,a))))),U=o(((e,t)=>I(t).some(((r,n,o,a)=>e(k(n,t),n,o,a)))));var K={nil:T,cons:(e,t="")=>Object.freeze({...T,id:t,instance:e,value:e}),uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:I,has:(e,t)=>e in I(t),typeOf:x,step:k,entries:e=>Object.keys(I(e)).map((t=>[t,k(t,e)])),keys:e=>Object.keys(I(e)),map:P,filter:V,reduce:R,every:C,some:U,length:e=>I(e).length},L=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,z=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,_=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,D=/\\([\u000b\u0020-\u00ff])/g,N=/([\\"])/g,q=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function B(e){var t=String(e);if(_.test(t))return t;if(t.length>0&&!z.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(N,"\\$1")+'"'}function F(e){this.parameters=Object.create(null),this.type=e}var Z={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!q.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,a=Object.keys(t).sort(),i=0;i<a.length;i++){if(o=a[i],!_.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+B(t[o])}return n},parse:function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;"function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.substr(0,r).trim():t.trim();if(!q.test(n))throw new TypeError("invalid media type");var o=new F(n.toLowerCase());if(-1!==r){var a,i,s;for(L.lastIndex=r;i=L.exec(t);){if(i.index!==r)throw new TypeError("invalid parameter format");r+=i[0].length,a=i[1].toLowerCase(),'"'===(s=i[2])[0]&&(s=s.substr(1,s.length-2).replace(D,"$1")),o.parameters[a]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},J=async e=>Object.entries(await e),M=o((async(e,t)=>(await t).map(e))),G=o((async(e,t,r)=>(await r).reduce((async(t,r)=>e(await t,r)),t))),H=o((async(e,t,r={})=>G((async(t,r)=>await e(r)?t.concat([r]):t),[],t,r))),W=o((async(e,t)=>{const r=await M(e,t);return(await Promise.all(r)).some((e=>e))})),Q=o((async(e,t)=>{const r=await M(e,t);return(await Promise.all(r)).every((e=>e))})),X=o(((e,t)=>e.reduce((async(e,t)=>t(await e)),t))),Y={entries:J,map:M,filter:H,reduce:G,some:W,every:Q,pipeline:X,all:e=>Promise.all(e),allValues:e=>X([J,G((async(e,[t,r])=>(e[t]=await r,e)),{})],e)};Y.entries,Y.map,Y.filter,Y.reduce,Y.some,Y.every,Y.pipeline,Y.all,Y.allValues;var ee=fetch;const{jsonTypeOf:te,splitUrl:re,safeResolveUrl:ne}=u,oe={},ae={},ie=(e,t)=>{const r=e in ae?ae[e]:e;if(r in oe)return oe[r][t]},se={},ce={},le=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=re(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=ie(n,"baseToken"),a=ie(n,"anchorToken"),i=re(t)[0];if(!i&&!re(e[o]||"")[0])throw Error("Couldn't determine an identifier for the schema");const s=ne(i,e[o]||""),[c,l]=re(s);delete e[o],l&&o===a&&(e[a]=a!==o?encodeURI(l):`#${encodeURI(l)}`),i&&(ce[i]=c);const u={},f=ie(n,"recursiveAnchorToken");let p;!0===e[f]&&(u[""]=`${c}#`,e[a]="",delete e[f]);const d=ie(n,"vocabularyToken");te(e[d],"object")?(ae[c]=n,p=e[d],delete e[d]):(ae[c]=n,p={[n]:!0});const y={"":""};return se[c]={id:c,schemaVersion:n,schema:ue(e,c,n,j.nil,y,u),anchors:y,dynamicAnchors:u,vocabulary:p,validated:!1},c},ue=(e,t,r,n,o,a)=>{if(te(e,"object")){const i="string"==typeof e.$schema?re(e.$schema)[0]:r,s=ie(i,"embeddedToken"),c=ie(i,"anchorToken");if("string"==typeof e[s]&&(s!==c||"#"!==e[s][0])){const n=ne(t,e[s]);return e[s]=n,le(e,n,r),S.cons(e[s],e)}const l=ie(r,"anchorToken"),u=ie(r,"dynamicAnchorToken");"string"==typeof e[u]&&(a[e[u]]=`${t}#${encodeURI(n)}`,o[e[u]]=n,delete e[u]);const f=ie(r,"embeddedToken");if("string"==typeof e[l]){const t=l!==f?e[l]:e[l].slice(1);o[t]=n,delete e[l]}const p=ie(r,"jrefToken");if("string"==typeof e[p])return S.cons(e[p],e);for(const i in e)e[i]=ue(e[i],t,r,j.append(i,n),o,a);return e}return Array.isArray(e)?e.map(((e,i)=>ue(e,t,r,j.append(i,n),o,a))):e},fe=e=>se[ce[e]]||se[e],pe=Object.freeze({id:"",schemaVersion:void 0,vocabulary:{},pointer:j.nil,schema:void 0,value:void 0,anchors:{},dynamicAnchors:{},validated:!0}),de=async(e,t=pe)=>{const r=ne(ve(t),e),[n,o]=re(r);if(!(e=>e in se||e in ce)(n)){const e=await ee(n,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error(`Failed to retrieve schema with id: ${n}`);if(e.headers.has("content-type")){const t=Z.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${n} is not a schema. Found a document with media type: ${t}`)}le(await e.json(),n)}const a=fe(n),i="/"!==o[0]?he(a,o):o,s=Object.freeze({...a,pointer:i,value:j.get(i,a.schema)});return ye(s)},ye=e=>S.isReference(e.value)?de(S.href(e.value),e):e,he=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},ve=e=>`${e.id}#${encodeURI(e.pointer)}`,me=e=>S.isReference(e.value)?S.value(e.value):e.value,be=(e,t)=>{const r=fe(t.id),n=Object.freeze({...t,pointer:j.append(e,t.pointer),value:me(t)[e],validated:r.validated});return ye(n)},we=o(((e,t)=>Y.pipeline([me,Y.map((async(r,n)=>e(await be(n,t),n))),Y.all],t)));var ge={setConfig:(e,t,r)=>{oe[e]||(oe[e]={}),oe[e][t]=r},getConfig:ie,add:le,get:de,markValidated:e=>{se[e].validated=!0},uri:ve,value:me,getAnchorPointer:he,typeOf:(e,t)=>te(me(e),t),has:(e,t)=>e in me(t),step:be,keys:e=>Object.keys(me(e)),entries:e=>Y.pipeline([me,Object.keys,Y.map((async t=>[t,await be(t,e)])),Y.all],e),map:we,length:e=>me(e).length};ge.setConfig,ge.getConfig,ge.add,ge.get,ge.markValidated,ge.uri,ge.value,ge.getAnchorPointer,ge.typeOf,ge.has,ge.step,ge.keys,ge.entries,ge.map,ge.length;class Oe extends Error{constructor(e){super("Invalid Schema"),this.name=this.constructor.name,this.output=e}}var je=Oe;const{splitUrl:Ee}=u,$e="FLAG",Se="BASIC",Ae="DETAILED",Te="VERBOSE";let Ie=Ae,xe=!0;const ke=async e=>{const t={metaData:{}};return{ast:t,schemaUri:await ze(e,t)}},Pe=o((({ast:e,schemaUri:t},r,n=$e)=>{if(![$e,Se,Ae,Te].includes(n))throw Error(`The '${n}' error format is not supported`);const o=[],a=i.subscribe("result",Ve(n,o));return De(t,r,e,{}),i.unsubscribe(a),o[0]})),Ve=(e,t)=>{const r=[];return(n,o)=>{if("result"===n){const{keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:a}=o,i={keyword:e,absoluteKeywordLocation:t,instanceLocation:n,valid:a,errors:[]};r.push(i)}else if("result.start"===n)r.push(n);else if("result.end"===n){const n=r.pop();for(;"result.start"!==r[r.length-1];){const t=r.pop(),o=[t];e===Se&&(o.push(...t.errors),delete t.errors),(e===Te||e!==$e&&!t.valid)&&n.errors.unshift(...o)}r[r.length-1]=n,t[0]=n}}},Re={},Ce=e=>Re[e],Ue=e=>e in Re,Ke={},Le={},ze=async(e,t)=>{if(e=await _e(e),!Ue(`${e.schemaVersion}#validate`)){const t=await ge.get(e.schemaVersion);(ge.getConfig(t.id,"mandatoryVocabularies")||[]).forEach((e=>{if(!t.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)})),Object.entries(t.vocabulary).forEach((([e,r])=>{if(e in Ke)Object.entries(Ke[e]).forEach((([e,r])=>{((e,t)=>{Re[e]={collectEvaluatedItems:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&new Set,collectEvaluatedProperties:(e,r,n,o,a)=>t.interpret(e,r,n,o,a)&&[],...t}})(`${t.id}#${e}`,r)}));else if(r)throw Error(`Missing required vocabulary: ${e}`)}))}if(xe&&!e.validated){if(ge.markValidated(e.id),!(e.schemaVersion in Le)){const t=await ge.get(e.schemaVersion),r=await ke(t);Le[t.id]=Pe(r)}const t=K.cons(e.schema,e.id),r=Le[e.schemaVersion](t,Ie);if(!r.valid)throw new je(r)}return e.id in t.metaData||(t.metaData[e.id]={id:e.id,dynamicAnchors:e.dynamicAnchors,anchors:e.anchors}),Ce(`${e.schemaVersion}#validate`).compile(e,t)},_e=async e=>ge.typeOf(e,"string")?_e(await ge.get(ge.value(e),e)):e,De=(e,t,r,n)=>{const o=Ne(e,r),a=Ee(e)[0];return Ce(o).interpret(e,t,r,{...r.metaData[a].dynamicAnchors,...n})},Ne=(e,t)=>{if(!(e in t))throw Error(`No schema found at ${e}`);return t[e][0]};var qe={validate:async(e,t,r)=>{const n=await ke(e),o=(e,t)=>Pe(n,K.cons(e),t);return void 0===t?o:o(t,r)},compile:ke,interpret:Pe,setMetaOutputFormat:e=>{Ie=e},setShouldMetaValidate:e=>{xe=e},FLAG:$e,BASIC:Se,DETAILED:Ae,VERBOSE:Te,add:(e,t="",r="")=>{const n=ge.add(e,t,r);delete Le[n]},getKeyword:Ce,hasKeyword:Ue,defineVocabulary:(e,t)=>{Ke[e]=t},compileSchema:ze,interpretSchema:De,collectEvaluatedProperties:(e,t,r,n,o)=>{const a=Ne(e,r);return Ce(a).collectEvaluatedProperties(e,t,r,n,o)},collectEvaluatedItems:(e,t,r,n,o)=>{const a=Ne(e,r);return Ce(a).collectEvaluatedItems(e,t,r,n,o)}};var Be={compile:e=>ge.value(e),interpret:()=>!0};var Fe={compile:async(e,t)=>{const r=ge.uri(e);if(!(r in t)){t[r]=!1;const n=ge.value(e);if(!["object","boolean"].includes(typeof n))throw Error(`No schema found at '${ge.uri(e)}'`);t[r]=[`${e.schemaVersion}#validate`,ge.uri(e),"boolean"==typeof n?n:await Y.pipeline([ge.entries,Y.map((([t,r])=>[`${e.schemaVersion}#${t}`,r])),Y.filter((([t])=>qe.hasKeyword(t)&&t!==`${e.schemaVersion}#validate`)),Y.map((async([r,n])=>{const o=await qe.getKeyword(r).compile(n,t,e);return[r,ge.uri(n),o]})),Y.all],e)]}return r},interpret:(e,t,r,n)=>{const[o,a,s]=r[e];i.publishSync("result.start");const c="boolean"==typeof s?s:s.every((([e,o,a])=>{i.publishSync("result.start");const s=qe.getKeyword(e).interpret(a,t,r,n);return i.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:K.uri(t),valid:s,ast:a}),i.publishSync("result.end"),s}));return i.publishSync("result",{keyword:o,absoluteKeywordLocation:a,instanceLocation:K.uri(t),valid:c,ast:e}),i.publishSync("result.end"),c},collectEvaluatedProperties:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&[]:a.filter((([e])=>!o||!e.endsWith("#unevaluatedProperties"))).reduce(((e,[o,,a])=>{const i=e&&qe.getKeyword(o).collectEvaluatedProperties(a,t,r,n);return!1!==i&&[...e,...i]}),[])},collectEvaluatedItems:(e,t,r,n,o=!1)=>{const a=r[e][2];return"boolean"==typeof a?!!a&&new Set:a.filter((([e])=>!o||!e.endsWith("#unevaluatedItems"))).reduce(((e,[o,,a])=>{const i=!1!==e&&qe.getKeyword(o).collectEvaluatedItems(a,t,r,n);return!1!==i&&new Set([...e,...i])}),new Set)}},Ze={metaData:Be,validate:Fe},Je={Core:qe,Schema:ge,Instance:K,Reference:S,Keywords:Ze,InvalidSchemaError:je},Me=Je.Core,Ge=Je.Schema,He=Je.Instance,We=Je.Reference,Qe=Je.Keywords,Xe=Je.InvalidSchemaError;e.Core=Me,e.Instance=He,e.InvalidSchemaError=Xe,e.Keywords=Qe,e.Reference=We,e.Schema=Ge,e.default=Je,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=json-schema-core-umd.min.js.map |
@@ -40,3 +40,2 @@ import type { JsonType } from "./common"; | ||
length: (doc: SchemaDocument) => number; | ||
toSchema: (doc: SchemaDocument, options: ToSchemaOptions) => SchemaObject; | ||
}; | ||
@@ -47,8 +46,2 @@ | ||
export type ToSchemaOptions = { | ||
parentId?: string; | ||
parentDialect?: string; | ||
includeEmbedded?: boolean; | ||
}; | ||
export type SchemaDocument<A extends SchemaFragment = SchemaFragment> = { | ||
@@ -55,0 +48,0 @@ id: string; |
@@ -5,3 +5,2 @@ const contentTypeParser = require("content-type"); | ||
const JsonPointer = require("@hyperjump/json-pointer"); | ||
const RelateUrl = require("relateurl"); | ||
const { jsonTypeOf, splitUrl, safeResolveUrl } = require("./common"); | ||
@@ -237,68 +236,6 @@ const fetch = require("./fetch"); | ||
const toSchemaDefaultOptions = { | ||
parentId: "", | ||
parentDialect: "", | ||
includeEmbedded: true | ||
}; | ||
const toSchema = (schemaDoc, options = {}) => { | ||
const fullOptions = { ...toSchemaDefaultOptions, ...options }; | ||
const schema = JSON.parse(JSON.stringify(schemaDoc.schema, (key, value) => { | ||
if (!Reference.isReference(value)) { | ||
return value; | ||
} | ||
const refValue = Reference.value(value); | ||
const embeddedDialect = refValue.$schema || schemaDoc.schemaVersion; | ||
const embeddedToken = getConfig(embeddedDialect, "embeddedToken"); | ||
if (!fullOptions.includeEmbedded && embeddedToken in refValue) { | ||
return; | ||
} else { | ||
return Reference.value(value); | ||
} | ||
})); | ||
const dynamicAnchorToken = getConfig(schemaDoc.schemaVersion, "dynamicAnchorToken"); | ||
Object.entries(schemaDoc.dynamicAnchors) | ||
.forEach(([anchor, uri]) => { | ||
const pointer = splitUrl(uri)[1]; | ||
JsonPointer.assign(pointer, schema, { | ||
[dynamicAnchorToken]: anchor, | ||
...JsonPointer.get(pointer, schema) | ||
}); | ||
}); | ||
const anchorToken = getConfig(schemaDoc.schemaVersion, "anchorToken"); | ||
Object.entries(schemaDoc.anchors) | ||
.filter(([anchor]) => anchor !== "") | ||
.forEach(([anchor, pointer]) => { | ||
JsonPointer.assign(pointer, schema, { | ||
[anchorToken]: anchor, | ||
...JsonPointer.get(pointer, schema) | ||
}); | ||
}); | ||
const baseToken = getConfig(schemaDoc.schemaVersion, "baseToken"); | ||
const id = relativeUri(fullOptions.parentId, schemaDoc.id); | ||
const dialect = fullOptions.parentDialect === schemaDoc.schemaVersion ? "" : schemaDoc.schemaVersion; | ||
return { | ||
...(id && { [baseToken]: id }), | ||
...(dialect && { $schema: dialect }), | ||
...schema | ||
}; | ||
}; | ||
const relativeUri = (from, to) => { | ||
if (to.startsWith("file://")) { | ||
return from === "" ? "" : RelateUrl.relate(from, to); | ||
} else { | ||
return to; | ||
} | ||
}; | ||
module.exports = { | ||
setConfig, getConfig, | ||
add, get, markValidated, | ||
uri, value, getAnchorPointer, typeOf, has, step, keys, entries, map, length, | ||
toSchema | ||
uri, value, getAnchorPointer, typeOf, has, step, keys, entries, map, length | ||
}; |
{ | ||
"name": "@hyperjump/json-schema-core", | ||
"version": "0.23.0", | ||
"version": "0.23.1", | ||
"description": "A framework for building JSON Schema tools", | ||
@@ -61,5 +61,4 @@ "main": "lib/index.js", | ||
"pubsub-js": "^1.9.1", | ||
"relateurl": "^0.2.7", | ||
"url-resolve-browser": "^1.2.0" | ||
} | ||
} |
@@ -88,15 +88,3 @@ # Hyperjump - JSON Schema Core | ||
Similar to `Array.prototype.length`. | ||
* **Schema.toSchema**: (doc: SDoc, options: ToSchemaOptions) => object | ||
Convert an SDoc back to a schema. | ||
* **ToSchemaOptions**: (doc: SDoc, options: ToSchemaOptions) => object | ||
parentId: string (default: "") -- We never want to include local file paths | ||
when using file based URIs, so this option allows us to to create relative | ||
URIs based on this URI. | ||
parentSchema: string (default: "") -- If this value matches the dialect of | ||
the schema, the `$schema` keyword will be omitted. | ||
includeEmbedded: boolean (default: true) -- If false, embedded schemas will | ||
be removed and only the root schema resource will be returned. | ||
### Schema Identification | ||
@@ -103,0 +91,0 @@ JSC requires that all schemas are identified by at least one URI. There are two |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
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
6
1498353
8913
743
- Removedrelateurl@^0.2.7
- Removedrelateurl@0.2.7(transitive)