diff --git a/dist/index.d.ts b/dist/index.d.ts index 908feeb..c3acc97 100644 --- a/dist/index.d.ts +++ b/dist/index.d.ts @@ -14,6 +14,7 @@ import { Draft } from "./lib/draft"; import { Draft04, draft04Config } from "./lib/draft04"; import { Draft06, draft06Config } from "./lib/draft06"; import { Draft07, draft07Config } from "./lib/draft07"; +import { Draft2019, draft2019Config } from "./lib/draft2019"; import { JsonEditor, draftJsonEditorConfig } from "./lib/jsoneditor"; import { isJsonError } from "./lib/types"; declare const config: { @@ -25,6 +26,8 @@ Draft06, // core implementing draft06 specs draft06Config, // config implementing draft06 specs Draft07, // core implementing draft07 specs draft07Config, // config implementing draft07 specs +Draft2019, // core implementing draft2019-09 specs +draft2019Config, // config implementing draft2019-09 specs draftJsonEditorConfig, // adjusted config of draft04 to better support the json-editor getTypeOf, // returns the javascript datatype isDynamicSchema, // NEW diff --git a/dist/jsonSchemaLibrary.js b/dist/jsonSchemaLibrary.js index e4338da..bc1e74c 100644 --- a/dist/jsonSchemaLibrary.js +++ b/dist/jsonSchemaLibrary.js @@ -1,2 +1 @@ -/*! For license information please see jsonSchemaLibrary.js.LICENSE.txt */ -!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define("jlib",[],r):"object"==typeof exports?exports.jlib=r():e.jlib=r()}("undefined"!=typeof self?self:this,(()=>(()=>{var e={546:function(e){"undefined"!=typeof self&&self,e.exports=(()=>{"use strict";var e={d:(r,t)=>{for(var n in t)e.o(t,n)&&!e.o(r,n)&&Object.defineProperty(r,n,{enumerable:!0,get:t[n]})},o:(e,r)=>Object.prototype.hasOwnProperty.call(e,r),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},r={};function t(e){return"#"===e||""===e||Array.isArray(e)&&0===e.length||!1}e.r(r),e.d(r,{default:()=>I,get:()=>c,isRoot:()=>t,join:()=>P,remove:()=>g,removeUndefinedItems:()=>b,set:()=>h,split:()=>u,splitLast:()=>_});const n=/~1/g,o=/~0/g,i=/\/+/g,a=/(^[#/]*|\/+$)/g;function s(e){return e.replace(n,"/").replace(o,"~")}function l(e){return s(decodeURIComponent(e))}function u(e){if(null==e||"string"!=typeof e||t(e))return Array.isArray(e)?e:[];const r=e.indexOf("#")>=0?l:s,n=(e=(e=e.replace(i,"/")).replace(a,"")).split("/");for(let e=0,t=n.length;e0&&"prototype"==r[0]}function h(e,r,t){if(null==r)return e;const n=u(r);if(0===n.length)return e;null==e&&(e=m.test(n[0])?[]:{});let o,i,a=e;for(;n.length>1;)o=n.shift(),i=m.test(n[0]),d(o,n)||(a=v(a,o,i));return o=n.pop(),y(a,o,t),e}function y(e,r,t){let n;const o=r.match(p);"[]"===r&&Array.isArray(e)?e.push(t):o?(n=o.pop(),e[n]=t):e[r]=t}function v(e,r,t){if(null!=e[r])return e[r];const n=t?[]:{};return y(e,r,n),n}function b(e){let r=0,t=0;for(;r+t{"use strict";var r=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var r=Object.prototype.toString.call(e);return"[object RegExp]"===r||"[object Date]"===r||function(e){return e.$$typeof===t}(e)}(e)};var t="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function n(e,r){return!1!==r.clone&&r.isMergeableObject(e)?l((t=e,Array.isArray(t)?[]:{}),e,r):e;var t}function o(e,r,t){return e.concat(r).map((function(e){return n(e,t)}))}function i(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter((function(r){return Object.propertyIsEnumerable.call(e,r)})):[]}(e))}function a(e,r){try{return r in e}catch(e){return!1}}function s(e,r,t){var o={};return t.isMergeableObject(e)&&i(e).forEach((function(r){o[r]=n(e[r],t)})),i(r).forEach((function(i){(function(e,r){return a(e,r)&&!(Object.hasOwnProperty.call(e,r)&&Object.propertyIsEnumerable.call(e,r))})(e,i)||(a(e,i)&&t.isMergeableObject(r[i])?o[i]=function(e,r){if(!r.customMerge)return l;var t=r.customMerge(e);return"function"==typeof t?t:l}(i,t)(e[i],r[i],t):o[i]=n(r[i],t))})),o}function l(e,t,i){(i=i||{}).arrayMerge=i.arrayMerge||o,i.isMergeableObject=i.isMergeableObject||r,i.cloneUnlessOtherwiseSpecified=n;var a=Array.isArray(t);return a===Array.isArray(e)?a?i.arrayMerge(e,t,i):s(e,t,i):n(t,i)}l.all=function(e,r){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,t){return l(e,t,r)}),{})};var u=l;e.exports=u},782:(e,r,t)=>{"use strict";const n=t(492);var o;!function(e){e.RULES=[{name:"Grammar",bnf:[["RULE_S*","%Atomic*","EOF"]]},{name:"%Atomic",bnf:[["Production","RULE_S*"]],fragment:!0},{name:"Production",bnf:[["NCName","RULE_S*",'"::="',"RULE_WHITESPACE*","Choice","RULE_WHITESPACE*","RULE_EOL+","RULE_S*"]]},{name:"NCName",bnf:[[/[a-zA-Z][a-zA-Z_0-9]*/]]},{name:"Choice",bnf:[["SequenceOrDifference","%_Choice_1*"]],fragment:!0},{name:"%_Choice_1",bnf:[["RULE_WHITESPACE*",'"|"',"RULE_WHITESPACE*","SequenceOrDifference"]],fragment:!0},{name:"SequenceOrDifference",bnf:[["Item","RULE_WHITESPACE*","%_Item_1?"]]},{name:"%_Item_1",bnf:[["Minus","Item"],["Item*"]],fragment:!0},{name:"Minus",bnf:[['"-"']]},{name:"Item",bnf:[["RULE_WHITESPACE*","%Primary","PrimaryDecoration?"]],fragment:!0},{name:"PrimaryDecoration",bnf:[['"?"'],['"*"'],['"+"']]},{name:"DecorationName",bnf:[['"ebnf://"',/[^\x5D#]+/]]},{name:"%Primary",bnf:[["NCName"],["StringLiteral"],["CharCode"],["CharClass"],["SubItem"]],fragment:!0},{name:"SubItem",bnf:[['"("',"RULE_WHITESPACE*","Choice","RULE_WHITESPACE*",'")"']]},{name:"StringLiteral",bnf:[["'\"'",/[^"]*/,"'\"'"],['"\'"',/[^']*/,'"\'"']],pinned:1},{name:"CharCode",bnf:[['"#x"',/[0-9a-zA-Z]+/]]},{name:"CharClass",bnf:[["'['","'^'?","%RULE_CharClass_1+",'"]"']]},{name:"%RULE_CharClass_1",bnf:[["CharCodeRange"],["CharRange"],["CharCode"],["RULE_Char"]],fragment:!0},{name:"RULE_Char",bnf:[[/\x09/],[/\x0A/],[/\x0D/],[/[\x20-\x5c]/],[/[\x5e-\uD7FF]/],[/[\uE000-\uFFFD]/]]},{name:"CharRange",bnf:[["RULE_Char",'"-"',"RULE_Char"]]},{name:"CharCodeRange",bnf:[["CharCode",'"-"',"CharCode"]]},{name:"RULE_WHITESPACE",bnf:[["%RULE_WHITESPACE_CHAR*"],["Comment","RULE_WHITESPACE*"]]},{name:"RULE_S",bnf:[["RULE_WHITESPACE","RULE_S*"],["RULE_EOL","RULE_S*"]]},{name:"%RULE_WHITESPACE_CHAR",bnf:[[/\x09/],[/\x20/]],fragment:!0},{name:"Comment",bnf:[['"/*"',"%RULE_Comment_Body*",'"*/"']]},{name:"%RULE_Comment_Body",bnf:[['!"*/"',/[^*]/]],fragment:!0},{name:"RULE_EOL",bnf:[[/\x0D/,/\x0A/],[/\x0A/],[/\x0D/]]},{name:"Link",bnf:[["'['","Url","']'"]]},{name:"Url",bnf:[[/[^\x5D:/?#]/,'"://"',/[^\x5D#]+/,"%Url1?"]]},{name:"%Url1",bnf:[['"#"',"NCName"]],fragment:!0}],e.defaultParser=new n.Parser(e.RULES,{debug:!1});const r=/^(!|&)/,t=/(\?|\+|\*)$/,o=/^%/;function i(e,i){if("string"==typeof e){if(r.test(e))return"";if(o.test(e)){let r=t.exec(e),o=r?r[0]+" ":"",s=function(e,r){let t=n.findRuleByName(e,r);return t&&1==t.bnf.length&&1==t.bnf[0].length&&(t.bnf[0][0]instanceof RegExp||'"'==t.bnf[0][0][0]||"'"==t.bnf[0][0][0])}(e,i);return s?a(e,i)+o:"("+a(e,i)+")"+o}return e}return e.source.replace(/\\(?:x|u)([a-zA-Z0-9]+)/g,"#x$1").replace(/\[\\(?:x|u)([a-zA-Z0-9]+)-\\(?:x|u)([a-zA-Z0-9]+)\]/g,"[#x$1-#x$2]")}function a(e,r){let t=n.findRuleByName(e,r);return t?t.bnf.map((e=>function(e,r){return e.map((e=>i(e,r))).join(" ")}(e,r))).join(" | "):"RULE_NOT_FOUND {"+e+"}"}function s(e){let r=[];return e.grammarRules.forEach((t=>{if(!/^%/.test(t.name)){let n=t.recover?" /* { recoverUntil="+t.recover+" } */":"";r.push(t.name+" ::= "+a(t.name,e)+n)}})),r.join("\n")}e.emit=s;let l=0;function u(e){return new RegExp(e.replace(/#x([a-zA-Z0-9]{4})/g,"\\u$1").replace(/#x([a-zA-Z0-9]{3})/g,"\\u0$1").replace(/#x([a-zA-Z0-9]{2})/g,"\\x$1").replace(/#x([a-zA-Z0-9]{1})/g,"\\x0$1"))}function c(e,r,t){let n=null,o=[];return r.children.forEach(((i,a)=>{"Minus"==i.type&&function(e,r){throw console.log("reberia restar "+r+" a "+e),new Error("Difference not supported yet")}(n,i);let s=r.children[a+1];s=s&&"PrimaryDecoration"==s.type&&s.text||"";switch(i.type){case"SubItem":let r="%"+(t+l++);f(e,i,r),o.push(""+r+s);break;case"NCName":case"StringLiteral":o.push(""+i.text+s);break;case"CharCode":case"CharClass":if(s){let r={name:"%"+(t+l++),bnf:[[u(i.text)]]};e.push(r),o.push(""+r.name+s)}else o.push(u(i.text));break;case"PrimaryDecoration":break;default:throw new Error(" HOW SHOULD I PARSE THIS? "+i.type+" -> "+JSON.stringify(i.text))}n=i})),o}function f(e,r,t){let n=r.children.filter((e=>"SequenceOrDifference"==e.type)).map((r=>c(e,r,t))),o={name:t,bnf:n},i=null;n.forEach((e=>{i=i||e.recover,delete e.recover})),0==t.indexOf("%")&&(o.fragment=!0),i&&(o.recover=i),e.push(o)}function m(r,t=e.defaultParser){let n=t.getAST(r);if(!n)throw new Error("Could not parse "+r);if(n.errors&&n.errors.length)throw n.errors[0];let o=[];return n.children.filter((e=>"Production"==e.type)).map((e=>{let r=e.children.filter((e=>"NCName"==e.type))[0].text;f(o,e,r)})),o}e.getRules=m,e.Transform=function(r,t=e.defaultParser){return m(r.join(""),t)};class p extends n.Parser{constructor(r,t){super(m(r,t&&!0===t.debugRulesParser?new n.Parser(e.RULES,{debug:!0}):e.defaultParser),t)}emitSource(){return s(this)}}e.Parser=p}(o||(o={})),r.A=o},492:(e,r,t)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.Parser=r.findRuleByName=r.parseRuleName=r.escapeRegExp=r.readToken=void 0;const n=/^[A-Z0-9_]+$/,o=/(\?|\+|\*)$/,i=/^(@|&|!)/,a="WS",s=t(594);function l(e,r){let t=r.exec(e);return t&&0==t.index?0==t[0].length&&r.source.length>0?null:{type:null,text:t[0],rest:e.substr(t[0].length),start:0,end:t[0].length-1,fullText:t[0],errors:[],children:[],parent:null}:null}function u(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}function c(e){e.rest="",e.children&&e.children.forEach((e=>c(e)))}function f(e,r){e.start+=r,e.end+=r,e.children&&e.children.forEach((r=>f(r,e.start)))}function m(e,r){r.errors&&r.errors.length&&r.errors.forEach((r=>e.push(r))),r.children&&r.children.forEach((r=>m(e,r)))}function p(e){let r=o.exec(e),t=i.exec(e),n=r&&r[0]||"",a=t&&t[0]||"",s={raw:e,name:e.replace(o,"").replace(i,""),isOptional:"?"==n||"*"==n,allowRepetition:"+"==n||"*"==n,atLeastOne:"+"==n,lookupPositive:"&"==a,lookupNegative:"!"==a,pinned:"@"==a,lookup:!1,isLiteral:!1};return s.isLiteral="'"==s.name[0]||'"'==s.name[0],s.lookup=s.lookupNegative||s.lookupPositive,s}function d(e,r){let t=p(e);return r.cachedRules[t.name]||null}function h(e,r){if(e.children){let t=e.children.filter((e=>e.type&&r.test(e.type)));for(let r=0;rh(e,r)))}}r.readToken=l,r.escapeRegExp=u,r.parseRuleName=p,r.findRuleByName=d;const y=["EOF"];class v{constructor(e,r){this.grammarRules=e,this.options=r,this.cachedRules={},this.debug=!!r&&!0===r.debug;let t=[],n=[];if(e.forEach((e=>{let r=p(e.name);if(r.name in this.cachedRules)t.push("Duplicated rule "+r.name);else{if(this.cachedRules[r.name]=e,e.bnf&&e.bnf.length)e.bnf.forEach((r=>{if("string"==typeof r[0]){if(p(r[0]).name==e.name){let r="Left recursion is not allowed, rule: "+e.name;-1==t.indexOf(r)&&t.push(r)}}r.forEach((e=>{if("string"==typeof e){let r=p(e);r.isLiteral||-1!=n.indexOf(r.name)||-1!=y.indexOf(r.name)||n.push(r.name)}}))}));else{let r="Missing rule content, rule: "+e.name;-1==t.indexOf(r)&&t.push(r)}a==e.name&&(e.implicitWs=!1),e.implicitWs&&-1==n.indexOf(a)&&n.push(a),e.recover&&-1==n.indexOf(e.recover)&&n.push(e.recover)}})),n.forEach((e=>{e in this.cachedRules||t.push("Missing rule "+e)})),t.length)throw new Error(t.join("\n"))}getAST(e,r){r||(r=this.grammarRules.filter((e=>!e.fragment&&0!=e.name.indexOf("%")))[0].name);let t=this.parse(e,r);if(t){m(t.errors,t),f(t,0),h(t,/^%/),this.options&&this.options.keepUpperRules||h(t,n);let e=t.rest;e&&new s.TokenError("Unexpected end of input: \n"+e,t),c(t),t.rest=e}return t}emitSource(){return"CANNOT EMIT SOURCE FROM BASE Parser"}parse(e,r,t=0){let o,i=null,c=p(r),f=this.debug&&!n.test(c.name);f&&console.log(new Array(t).join("│ ")+"Trying to get "+r+" from "+JSON.stringify(e.split("\n")[0]));let m=c.name,h=d(c.name,this);if("EOF"==c.name){if(e.length)return null;if(0==e.length)return{type:"EOF",text:"",rest:"",start:0,end:0,fullText:"",errors:[],children:[],parent:null}}try{if(!h&&c.isLiteral){let r=c.name.trim();if(r.startsWith('"')?r=JSON.parse(r):r.startsWith("'")&&(r=r.replace(/^'(.+)'$/,"$1").replace(/\\'/g,"'")),""===r)return{type:"%%EMPTY%%",text:"",rest:e,start:0,end:0,fullText:"",errors:[],children:[],parent:null};o=new RegExp(u(r)),m=null}}catch(e){return e instanceof ReferenceError&&console.error(e),null}if(o){let r=l(e,o);if(r)return r.type=m,r}else{let r=h.bnf;r instanceof Array&&r.forEach((r=>{if(i)return;let n=null,o={type:c.name,text:"",children:[],end:0,errors:[],fullText:"",parent:null,start:0,rest:e};h.fragment&&(o.fragment=!0);let u=e,m=0,d=r.length>0,y=!1;for(let e=0;e{e.start+=m,e.end+=m,e.parent=o,o.children.push(e)})):(l.parent=o,o.children.push(l))),c.lookup&&(l.lookup=!0),f&&console.log(new Array(t+1).join("│ ")+"└─ "+l.type+" "+JSON.stringify(l.text)),c.lookup||l.lookup||(o.text=o.text+l.text,o.end=o.text.length,u=u.substr(l.text.length),m+=l.text.length),o.rest=u}while(l&&c.allowRepetition&&u.length&&!l.lookup)}else{let n=l(u,r[e]);if(!n)return;f&&console.log(new Array(t+1).join("│ ")+"└> "+JSON.stringify(n.text)+r[e].source),y=!0,n.start+=m,n.end+=m,o.text=o.text+n.text,o.end=o.text.length,u=u.substr(n.text.length),m+=n.text.length,o.rest=u}y&&(i=o,f&&console.log(new Array(t).join("│ ")+"├<─┴< PUSHING "+i.type+" "+JSON.stringify(i.text)))})),i&&h.simplifyWhenOneChildren&&1==i.children.length&&(i=i.children[0])}return i||f&&console.log(r+" NOT RESOLVED FROM "+e),i}parseRecovery(e,r,t){if(e.recover&&r.length){let n=this.debug;n&&console.log(new Array(t+1).join("│ ")+"Trying to recover until token "+e.recover+" from "+JSON.stringify(r.split("\n")[0]+r.split("\n")[1]));let o,i={type:"SyntaxError",text:"",children:[],end:0,errors:[],fullText:"",parent:null,start:0,rest:""};do{if(o=this.parse(r,e.recover,t+1),o){new s.TokenError('Unexpected input: "'+i.text+`" Expecting: ${e.name}`,i);break}i.text=i.text+r[0],i.end=i.text.length,r=r.substr(1)}while(!o&&r.length>0);if(i.text.length>0&&o)return n&&console.log(new Array(t+1).join("│ ")+"Recovered text: "+JSON.stringify(i.text)),i}return null}}r.Parser=v,r.default=v},594:(e,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.TokenError=void 0;class t extends Error{constructor(e,r){if(super(e),this.message=e,this.token=r,!r||!r.errors)throw this;r.errors.push(this)}inspect(){return"SyntaxError: "+this.message}}r.TokenError=t},17:e=>{"use strict";e.exports=function e(r,t){if(r===t)return!0;if(r&&t&&"object"==typeof r&&"object"==typeof t){if(r.constructor!==t.constructor)return!1;var n,o,i;if(Array.isArray(r)){if((n=r.length)!=t.length)return!1;for(o=n;0!=o--;)if(!e(r[o],t[o]))return!1;return!0}if(r.constructor===RegExp)return r.source===t.source&&r.flags===t.flags;if(r.valueOf!==Object.prototype.valueOf)return r.valueOf()===t.valueOf();if(r.toString!==Object.prototype.toString)return r.toString()===t.toString();if((n=(i=Object.keys(r)).length)!==Object.keys(t).length)return!1;for(o=n;0!=o--;)if(!Object.prototype.hasOwnProperty.call(t,i[o]))return!1;for(o=n;0!=o--;){var a=i[o];if(!e(r[a],t[a]))return!1}return!0}return r!=r&&t!=t}},515:function(e){var r,t;r=this,t=function(){function e(r,t,n){return this.id=++e.highestId,this.name=r,this.symbols=t,this.postprocess=n,this}function r(e,r,t,n){this.rule=e,this.dot=r,this.reference=t,this.data=[],this.wantedBy=n,this.isComplete=this.dot===e.symbols.length}function t(e,r){this.grammar=e,this.index=r,this.states=[],this.wants={},this.scannable=[],this.completed={}}function n(e,r){this.rules=e,this.start=r||this.rules[0].name;var t=this.byName={};this.rules.forEach((function(e){t.hasOwnProperty(e.name)||(t[e.name]=[]),t[e.name].push(e)}))}function o(){this.reset("")}function i(e,r,i){if(e instanceof n){var a=e;i=r}else a=n.fromCompiled(e,r);for(var s in this.grammar=a,this.options={keepHistory:!1,lexer:a.lexer||new o},i||{})this.options[s]=i[s];this.lexer=this.options.lexer,this.lexerState=void 0;var l=new t(a,0);this.table=[l],l.wants[a.start]=[],l.predict(a.start),l.process(),this.current=0}function a(e){var r=typeof e;if("string"===r)return e;if("object"===r){if(e.literal)return JSON.stringify(e.literal);if(e instanceof RegExp)return e.toString();if(e.type)return"%"+e.type;if(e.test)return"<"+String(e.test)+">";throw new Error("Unknown symbol type: "+e)}}return e.highestId=0,e.prototype.toString=function(e){var r=void 0===e?this.symbols.map(a).join(" "):this.symbols.slice(0,e).map(a).join(" ")+" ● "+this.symbols.slice(e).map(a).join(" ");return this.name+" → "+r},r.prototype.toString=function(){return"{"+this.rule.toString(this.dot)+"}, from: "+(this.reference||0)},r.prototype.nextState=function(e){var t=new r(this.rule,this.dot+1,this.reference,this.wantedBy);return t.left=this,t.right=e,t.isComplete&&(t.data=t.build(),t.right=void 0),t},r.prototype.build=function(){var e=[],r=this;do{e.push(r.right.data),r=r.left}while(r.left);return e.reverse(),e},r.prototype.finish=function(){this.rule.postprocess&&(this.data=this.rule.postprocess(this.data,this.reference,i.fail))},t.prototype.process=function(e){for(var r=this.states,t=this.wants,n=this.completed,o=0;o0&&r.push(" ^ "+n+" more lines identical to this"),n=0,r.push(" "+a)),t=a}},i.prototype.getSymbolDisplay=function(e){return function(e){var r=typeof e;if("string"===r)return e;if("object"===r){if(e.literal)return JSON.stringify(e.literal);if(e instanceof RegExp)return"character matching "+e;if(e.type)return e.type+" token";if(e.test)return"token matching "+String(e.test);throw new Error("Unknown symbol type: "+e)}}(e)},i.prototype.buildFirstStateStack=function(e,r){if(-1!==r.indexOf(e))return null;if(0===e.wantedBy.length)return[e];var t=e.wantedBy[0],n=[e].concat(r),o=this.buildFirstStateStack(t,n);return null===o?null:[e].concat(o)},i.prototype.save=function(){var e=this.table[this.current];return e.lexerState=this.lexerState,e},i.prototype.restore=function(e){var r=e.index;this.current=r,this.table[r]=e,this.table.splice(r+1),this.lexerState=e.lexerState,this.results=this.finish()},i.prototype.rewind=function(e){if(!this.options.keepHistory)throw new Error("set option `keepHistory` to enable rewinding");this.restore(this.table[e])},i.prototype.finish=function(){var e=[],r=this.grammar.start;return this.table[this.table.length-1].states.forEach((function(t){t.rule.name===r&&t.dot===t.rule.symbols.length&&0===t.reference&&t.data!==i.fail&&e.push(t)})),e.map((function(e){return e.data}))},{Parser:i,Grammar:n,Rule:e}},e.exports?e.exports=t():r.nearley=t()},84:(e,r)=>{"use strict";function t(e){return e[0]}Object.defineProperty(r,"__esModule",{value:!0});const n=e=>[].concat(...e.map((e=>Array.isArray(e)?n(e):e)));function o(e){return e?Array.isArray(e)?n(e).join(""):e:""}const i={Lexer:void 0,ParserRules:[{name:"Reverse_path",symbols:["Path"]},{name:"Reverse_path$string$1",symbols:[{literal:"<"},{literal:">"}],postprocess:e=>e.join("")},{name:"Reverse_path",symbols:["Reverse_path$string$1"]},{name:"Forward_path$subexpression$1$subexpression$1",symbols:[{literal:"<"},/[pP]/,/[oO]/,/[sS]/,/[tT]/,/[mM]/,/[aA]/,/[sS]/,/[tT]/,/[eE]/,/[rR]/,{literal:"@"}],postprocess:function(e){return e.join("")}},{name:"Forward_path$subexpression$1",symbols:["Forward_path$subexpression$1$subexpression$1","Domain",{literal:">"}]},{name:"Forward_path",symbols:["Forward_path$subexpression$1"]},{name:"Forward_path$subexpression$2",symbols:[{literal:"<"},/[pP]/,/[oO]/,/[sS]/,/[tT]/,/[mM]/,/[aA]/,/[sS]/,/[tT]/,/[eE]/,/[rR]/,{literal:">"}],postprocess:function(e){return e.join("")}},{name:"Forward_path",symbols:["Forward_path$subexpression$2"]},{name:"Forward_path",symbols:["Path"]},{name:"Path$ebnf$1$subexpression$1",symbols:["A_d_l",{literal:":"}]},{name:"Path$ebnf$1",symbols:["Path$ebnf$1$subexpression$1"],postprocess:t},{name:"Path$ebnf$1",symbols:[],postprocess:()=>null},{name:"Path",symbols:[{literal:"<"},"Path$ebnf$1","Mailbox",{literal:">"}]},{name:"A_d_l$ebnf$1",symbols:[]},{name:"A_d_l$ebnf$1$subexpression$1",symbols:[{literal:","},"At_domain"]},{name:"A_d_l$ebnf$1",symbols:["A_d_l$ebnf$1","A_d_l$ebnf$1$subexpression$1"],postprocess:e=>e[0].concat([e[1]])},{name:"A_d_l",symbols:["At_domain","A_d_l$ebnf$1"]},{name:"At_domain",symbols:[{literal:"@"},"Domain"]},{name:"Domain$ebnf$1",symbols:[]},{name:"Domain$ebnf$1$subexpression$1",symbols:[{literal:"."},"sub_domain"]},{name:"Domain$ebnf$1",symbols:["Domain$ebnf$1","Domain$ebnf$1$subexpression$1"],postprocess:e=>e[0].concat([e[1]])},{name:"Domain",symbols:["sub_domain","Domain$ebnf$1"]},{name:"sub_domain",symbols:["U_label"]},{name:"Let_dig",symbols:["ALPHA_DIGIT"],postprocess:t},{name:"Ldh_str$ebnf$1",symbols:[]},{name:"Ldh_str$ebnf$1",symbols:["Ldh_str$ebnf$1","ALPHA_DIG_DASH"],postprocess:e=>e[0].concat([e[1]])},{name:"Ldh_str",symbols:["Ldh_str$ebnf$1","Let_dig"]},{name:"U_Let_dig",symbols:["ALPHA_DIGIT_U"],postprocess:t},{name:"U_Ldh_str$ebnf$1",symbols:[]},{name:"U_Ldh_str$ebnf$1",symbols:["U_Ldh_str$ebnf$1","ALPHA_DIG_DASH_U"],postprocess:e=>e[0].concat([e[1]])},{name:"U_Ldh_str",symbols:["U_Ldh_str$ebnf$1","U_Let_dig"]},{name:"U_label$ebnf$1$subexpression$1",symbols:["U_Ldh_str"]},{name:"U_label$ebnf$1",symbols:["U_label$ebnf$1$subexpression$1"],postprocess:t},{name:"U_label$ebnf$1",symbols:[],postprocess:()=>null},{name:"U_label",symbols:["U_Let_dig","U_label$ebnf$1"]},{name:"address_literal$subexpression$1",symbols:["IPv4_address_literal"]},{name:"address_literal$subexpression$1",symbols:["IPv6_address_literal"]},{name:"address_literal$subexpression$1",symbols:["General_address_literal"]},{name:"address_literal",symbols:[{literal:"["},"address_literal$subexpression$1",{literal:"]"}]},{name:"non_local_part",symbols:["Domain"],postprocess:function(e){return{DomainName:o(e[0])}}},{name:"non_local_part",symbols:["address_literal"],postprocess:function(e){return{AddressLiteral:o(e[0])}}},{name:"Mailbox",symbols:["Local_part",{literal:"@"},"non_local_part"],postprocess:function(e){return{localPart:o(e[0]),domainPart:o(e[2])}}},{name:"Local_part",symbols:["Dot_string"],postprocess:function(e){return{DotString:o(e[0])}}},{name:"Local_part",symbols:["Quoted_string"],postprocess:function(e){return{QuotedString:o(e[0])}}},{name:"Dot_string$ebnf$1",symbols:[]},{name:"Dot_string$ebnf$1$subexpression$1",symbols:[{literal:"."},"Atom"]},{name:"Dot_string$ebnf$1",symbols:["Dot_string$ebnf$1","Dot_string$ebnf$1$subexpression$1"],postprocess:e=>e[0].concat([e[1]])},{name:"Dot_string",symbols:["Atom","Dot_string$ebnf$1"]},{name:"Atom$ebnf$1",symbols:[/[0-9A-Za-z!#$%&'*+\-/=?^_`{|}~\u0080-\uFFFF/]/]},{name:"Atom$ebnf$1",symbols:["Atom$ebnf$1",/[0-9A-Za-z!#$%&'*+\-/=?^_`{|}~\u0080-\uFFFF/]/],postprocess:e=>e[0].concat([e[1]])},{name:"Atom",symbols:["Atom$ebnf$1"]},{name:"Quoted_string$ebnf$1",symbols:[]},{name:"Quoted_string$ebnf$1",symbols:["Quoted_string$ebnf$1","QcontentSMTP"],postprocess:e=>e[0].concat([e[1]])},{name:"Quoted_string",symbols:["DQUOTE","Quoted_string$ebnf$1","DQUOTE"]},{name:"QcontentSMTP",symbols:["qtextSMTP"]},{name:"QcontentSMTP",symbols:["quoted_pairSMTP"]},{name:"quoted_pairSMTP",symbols:[{literal:"\\"},/[\x20-\x7e]/]},{name:"qtextSMTP",symbols:[/[\x20-\x21\x23-\x5b\x5d-\x7e\u0080-\uFFFF]/],postprocess:t},{name:"IPv4_address_literal$macrocall$2",symbols:[{literal:"."},"Snum"]},{name:"IPv4_address_literal$macrocall$1",symbols:["IPv4_address_literal$macrocall$2","IPv4_address_literal$macrocall$2","IPv4_address_literal$macrocall$2"]},{name:"IPv4_address_literal",symbols:["Snum","IPv4_address_literal$macrocall$1"]},{name:"IPv6_address_literal$subexpression$1",symbols:[/[iI]/,/[pP]/,/[vV]/,{literal:"6"},{literal:":"}],postprocess:function(e){return e.join("")}},{name:"IPv6_address_literal",symbols:["IPv6_address_literal$subexpression$1","IPv6_addr"]},{name:"General_address_literal$ebnf$1",symbols:["dcontent"]},{name:"General_address_literal$ebnf$1",symbols:["General_address_literal$ebnf$1","dcontent"],postprocess:e=>e[0].concat([e[1]])},{name:"General_address_literal",symbols:["Standardized_tag",{literal:":"},"General_address_literal$ebnf$1"]},{name:"Standardized_tag",symbols:["Ldh_str"]},{name:"dcontent",symbols:[/[\x21-\x5a\x5e-\x7e]/],postprocess:t},{name:"Snum",symbols:["DIGIT"]},{name:"Snum$subexpression$1",symbols:[/[1-9]/,"DIGIT"]},{name:"Snum",symbols:["Snum$subexpression$1"]},{name:"Snum$subexpression$2",symbols:[{literal:"1"},"DIGIT","DIGIT"]},{name:"Snum",symbols:["Snum$subexpression$2"]},{name:"Snum$subexpression$3",symbols:[{literal:"2"},/[0-4]/,"DIGIT"]},{name:"Snum",symbols:["Snum$subexpression$3"]},{name:"Snum$subexpression$4",symbols:[{literal:"2"},{literal:"5"},/[0-5]/]},{name:"Snum",symbols:["Snum$subexpression$4"]},{name:"IPv6_addr",symbols:["IPv6_full"]},{name:"IPv6_addr",symbols:["IPv6_comp"]},{name:"IPv6_addr",symbols:["IPv6v4_full"]},{name:"IPv6_addr",symbols:["IPv6v4_comp"]},{name:"IPv6_hex",symbols:["HEXDIG"]},{name:"IPv6_hex$subexpression$1",symbols:["HEXDIG","HEXDIG"]},{name:"IPv6_hex",symbols:["IPv6_hex$subexpression$1"]},{name:"IPv6_hex$subexpression$2",symbols:["HEXDIG","HEXDIG","HEXDIG"]},{name:"IPv6_hex",symbols:["IPv6_hex$subexpression$2"]},{name:"IPv6_hex$subexpression$3",symbols:["HEXDIG","HEXDIG","HEXDIG","HEXDIG"]},{name:"IPv6_hex",symbols:["IPv6_hex$subexpression$3"]},{name:"IPv6_full$macrocall$2",symbols:[{literal:":"},"IPv6_hex"]},{name:"IPv6_full$macrocall$1",symbols:["IPv6_full$macrocall$2","IPv6_full$macrocall$2","IPv6_full$macrocall$2","IPv6_full$macrocall$2","IPv6_full$macrocall$2","IPv6_full$macrocall$2","IPv6_full$macrocall$2"]},{name:"IPv6_full",symbols:["IPv6_hex","IPv6_full$macrocall$1"]},{name:"IPv6_comp$ebnf$1$subexpression$1$macrocall$2",symbols:[{literal:":"},"IPv6_hex"]},{name:"IPv6_comp$ebnf$1$subexpression$1$macrocall$1",symbols:["IPv6_comp$ebnf$1$subexpression$1$macrocall$2","IPv6_comp$ebnf$1$subexpression$1$macrocall$2","IPv6_comp$ebnf$1$subexpression$1$macrocall$2","IPv6_comp$ebnf$1$subexpression$1$macrocall$2","IPv6_comp$ebnf$1$subexpression$1$macrocall$2"]},{name:"IPv6_comp$ebnf$1$subexpression$1",symbols:["IPv6_hex","IPv6_comp$ebnf$1$subexpression$1$macrocall$1"]},{name:"IPv6_comp$ebnf$1",symbols:["IPv6_comp$ebnf$1$subexpression$1"],postprocess:t},{name:"IPv6_comp$ebnf$1",symbols:[],postprocess:()=>null},{name:"IPv6_comp$string$1",symbols:[{literal:":"},{literal:":"}],postprocess:e=>e.join("")},{name:"IPv6_comp$ebnf$2$subexpression$1$macrocall$2",symbols:[{literal:":"},"IPv6_hex"]},{name:"IPv6_comp$ebnf$2$subexpression$1$macrocall$1",symbols:["IPv6_comp$ebnf$2$subexpression$1$macrocall$2","IPv6_comp$ebnf$2$subexpression$1$macrocall$2","IPv6_comp$ebnf$2$subexpression$1$macrocall$2","IPv6_comp$ebnf$2$subexpression$1$macrocall$2","IPv6_comp$ebnf$2$subexpression$1$macrocall$2"]},{name:"IPv6_comp$ebnf$2$subexpression$1",symbols:["IPv6_hex","IPv6_comp$ebnf$2$subexpression$1$macrocall$1"]},{name:"IPv6_comp$ebnf$2",symbols:["IPv6_comp$ebnf$2$subexpression$1"],postprocess:t},{name:"IPv6_comp$ebnf$2",symbols:[],postprocess:()=>null},{name:"IPv6_comp",symbols:["IPv6_comp$ebnf$1","IPv6_comp$string$1","IPv6_comp$ebnf$2"]},{name:"IPv6v4_full$macrocall$2",symbols:[{literal:":"},"IPv6_hex"]},{name:"IPv6v4_full$macrocall$1",symbols:["IPv6v4_full$macrocall$2","IPv6v4_full$macrocall$2","IPv6v4_full$macrocall$2","IPv6v4_full$macrocall$2","IPv6v4_full$macrocall$2"]},{name:"IPv6v4_full",symbols:["IPv6_hex","IPv6v4_full$macrocall$1",{literal:":"},"IPv4_address_literal"]},{name:"IPv6v4_comp$ebnf$1$subexpression$1$macrocall$2",symbols:[{literal:":"},"IPv6_hex"]},{name:"IPv6v4_comp$ebnf$1$subexpression$1$macrocall$1",symbols:["IPv6v4_comp$ebnf$1$subexpression$1$macrocall$2","IPv6v4_comp$ebnf$1$subexpression$1$macrocall$2","IPv6v4_comp$ebnf$1$subexpression$1$macrocall$2"]},{name:"IPv6v4_comp$ebnf$1$subexpression$1",symbols:["IPv6_hex","IPv6v4_comp$ebnf$1$subexpression$1$macrocall$1"]},{name:"IPv6v4_comp$ebnf$1",symbols:["IPv6v4_comp$ebnf$1$subexpression$1"],postprocess:t},{name:"IPv6v4_comp$ebnf$1",symbols:[],postprocess:()=>null},{name:"IPv6v4_comp$string$1",symbols:[{literal:":"},{literal:":"}],postprocess:e=>e.join("")},{name:"IPv6v4_comp$ebnf$2$subexpression$1$macrocall$2",symbols:[{literal:":"},"IPv6_hex"]},{name:"IPv6v4_comp$ebnf$2$subexpression$1$macrocall$1",symbols:["IPv6v4_comp$ebnf$2$subexpression$1$macrocall$2","IPv6v4_comp$ebnf$2$subexpression$1$macrocall$2","IPv6v4_comp$ebnf$2$subexpression$1$macrocall$2"]},{name:"IPv6v4_comp$ebnf$2$subexpression$1",symbols:["IPv6_hex","IPv6v4_comp$ebnf$2$subexpression$1$macrocall$1",{literal:":"}]},{name:"IPv6v4_comp$ebnf$2",symbols:["IPv6v4_comp$ebnf$2$subexpression$1"],postprocess:t},{name:"IPv6v4_comp$ebnf$2",symbols:[],postprocess:()=>null},{name:"IPv6v4_comp",symbols:["IPv6v4_comp$ebnf$1","IPv6v4_comp$string$1","IPv6v4_comp$ebnf$2","IPv4_address_literal"]},{name:"DIGIT",symbols:[/[0-9]/],postprocess:t},{name:"ALPHA_DIGIT_U",symbols:[/[0-9A-Za-z\u0080-\uFFFF]/],postprocess:t},{name:"ALPHA_DIGIT",symbols:[/[0-9A-Za-z]/],postprocess:t},{name:"ALPHA_DIG_DASH",symbols:[/[-0-9A-Za-z]/],postprocess:t},{name:"ALPHA_DIG_DASH_U",symbols:[/[-0-9A-Za-z\u0080-\uFFFF]/],postprocess:t},{name:"HEXDIG",symbols:[/[0-9A-Fa-f]/],postprocess:t},{name:"DQUOTE",symbols:[{literal:'"'}],postprocess:t}],ParserStart:"Reverse_path"};r.default=i},125:function(e,r,t){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.canonicalize=r.canonicalize_quoted_string=r.normalize=r.normalize_dot_string=r.parse=void 0;const o=t(515),i=n(t(84));i.default.ParserStart="Mailbox";const a=o.Grammar.fromCompiled(i.default);function s(e){const r=new o.Parser(a);if(r.feed(e),1!==r.results.length)throw new Error("address parsing failed: ambiguous grammar");return r.results[0]}function l(e){return function(){const r=e.indexOf("+");return-1===r?e:e.substr(0,r)}().replace(/\./g,"").toLowerCase()}function u(e){return`"${e.substr(1).substr(0,e.length-2).replace(/(?:\\(.))/g,"$1").replace(/(?:(["\\]))/g,"\\$1")}"`}r.parse=s,r.normalize_dot_string=l,r.normalize=function(e){var r,t;const n=s(e),o=null!==(r=n.domainPart.AddressLiteral)&&void 0!==r?r:n.domainPart.DomainName.toLowerCase();return`${null!==(t=n.localPart.QuotedString)&&void 0!==t?t:l(n.localPart.DotString)}@${o}`},r.canonicalize_quoted_string=u,r.canonicalize=function(e){var r;const t=s(e),n=null!==(r=t.domainPart.AddressLiteral)&&void 0!==r?r:t.domainPart.DomainName.toLowerCase();return`${t.localPart.QuotedString?u(t.localPart.QuotedString):t.localPart.DotString}@${n}`}},853:(e,r,t)=>{!function(e){"use strict";e.exports.is_uri=t,e.exports.is_http_uri=n,e.exports.is_https_uri=o,e.exports.is_web_uri=i,e.exports.isUri=t,e.exports.isHttpUri=n,e.exports.isHttpsUri=o,e.exports.isWebUri=i;var r=function(e){return e.match(/(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/)};function t(e){if(e&&!/[^a-z0-9\:\/\?\#\[\]\@\!\$\&\'\(\)\*\+\,\;\=\.\-\_\~\%]/i.test(e)&&!/%[^0-9a-f]/i.test(e)&&!/%[0-9a-f](:?[^0-9a-f]|$)/i.test(e)){var t,n,o,i,a,s="",l="";if(s=(t=r(e))[1],n=t[2],o=t[3],i=t[4],a=t[5],s&&s.length&&o.length>=0){if(n&&n.length){if(0!==o.length&&!/^\//.test(o))return}else if(/^\/\//.test(o))return;if(/^[a-z][a-z0-9\+\-\.]*$/.test(s.toLowerCase()))return l+=s+":",n&&n.length&&(l+="//"+n),l+=o,i&&i.length&&(l+="?"+i),a&&a.length&&(l+="#"+a),l}}}function n(e,n){if(t(e)){var o,i,a,s,l="",u="",c="",f="";if(l=(o=r(e))[1],u=o[2],i=o[3],a=o[4],s=o[5],l){if(n){if("https"!=l.toLowerCase())return}else if("http"!=l.toLowerCase())return;if(u)return/:(\d+)$/.test(u)&&(c=u.match(/:(\d+)$/)[0],u=u.replace(/:\d+$/,"")),f+=l+":",f+="//"+u,c&&(f+=c),f+=i,a&&a.length&&(f+="?"+a),s&&s.length&&(f+="#"+s),f}}}function o(e){return n(e,!0)}function i(e){return n(e)||o(e)}}(e=t.nmd(e))}},r={};function t(n){var o=r[n];if(void 0!==o)return o.exports;var i=r[n]={id:n,loaded:!1,exports:{}};return e[n].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}t.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return t.d(r,{a:r}),r},t.d=(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},t.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),t.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var n={};return(()=>{"use strict";t.r(n),t.d(n,{Draft:()=>Pe,Draft04:()=>Pt,Draft06:()=>kt,Draft07:()=>Dt,JsonEditor:()=>Nt,config:()=>Ut,createCustomError:()=>c,createError:()=>u,draft04Config:()=>xt,draft06Config:()=>Lt,draft07Config:()=>Tt,draftJsonEditorConfig:()=>Ct,getTypeOf:()=>o,isDynamicSchema:()=>$e,isJsonError:()=>d,mergeSchema:()=>S,reduceSchema:()=>xe,render:()=>s,resolveAllOf:()=>ue,resolveDynamicSchema:()=>Oe,resolveOneOf:()=>b,resolveOneOfFuzzy:()=>$,resolveRef:()=>fe,resolveRefMerge:()=>me,settings:()=>m,validateAsync:()=>pe});const e={AdditionalItemsError:"Array at `{{pointer}}` may not have an additional item `{{key}}`",AdditionalPropertiesError:"Additional property `{{property}}` on `{{pointer}}` does not match schema `{{schema}}`",AllOfError:"Value `{{value}}` at `{{pointer}}` does not match schema of `{{allOf}}`",AnyOfError:"Value `{{value}}` at `{{pointer}}` does not match any schema of `{{anyOf}}`",ConstError:"Expected value at `{{pointer}}` to be `{{expected}}`, but value given is `{{value}}`",containsAnyError:"The array at `{{pointer}}` must contain at least one item",ContainsArrayError:"The property at `{{pointer}}` must not be an array",ContainsError:"The array at `{{pointer}}` must contain an element that matches `{{schema}}`",EnumError:"Expected given value `{{value}}` in `{{pointer}}` to be one of `{{values}}`",ForbiddenPropertyError:"Property name `{{property}}` at `{{pointer}}` is not allowed",FormatDateError:"Value `{{value}}` at `{{pointer}}` is not a valid date",FormatDateTimeError:"Value `{{value}}` at `{{pointer}}` is not a valid date-time",FormatEmailError:"Value `{{value}}` at `{{pointer}}` is not a valid email",FormatHostnameError:"Value `{{value}}` at `{{pointer}}` is not a valid hostname",FormatIPV4Error:"Value `{{value}}` at `{{pointer}}` is not a valid IPv4 address",FormatIPV4LeadingZeroError:"IPv4 addresses starting with zero are invalid, since they are interpreted as octals",FormatIPV6Error:"Value `{{value}}` at `{{pointer}}` is not a valid IPv6 address",FormatIPV6LeadingZeroError:"IPv6 addresses starting with zero are invalid, since they are interpreted as octals",FormatJsonPointerError:"Value `{{value}}` at `{{pointer}}` is not a valid json-pointer",FormatRegExError:"Value `{{value}}` at `{{pointer}}` is not a valid regular expression",FormatTimeError:"Value `{{value}}` at `{{pointer}}` is not a valid time",FormatURIError:"Value `{{value}}` at `{{pointer}}` is not a valid uri",FormatURIReferenceError:"Value `{{value}}` at `{{pointer}}` is not a valid uri-reference",FormatURITemplateError:"Value `{{value}}` at `{{pointer}}` is not a valid uri-template",FormatURLError:"Value `{{value}}` at `{{pointer}}` is not a valid url",InvalidDataError:"No value may be specified in `{{pointer}}`",InvalidPropertyNameError:"Invalid property name `{{property}}` at `{{pointer}}`",MaximumError:"Value in `{{pointer}}` is `{{length}}`, but should be `{{maximum}}` at maximum",MaxItemsError:"Too many items in `{{pointer}}`, should be `{{maximum}}` at most, but got `{{length}}`",MaxLengthError:"Value `{{pointer}}` should have a maximum length of `{{maxLength}}`, but got `{{length}}`.",MaxPropertiesError:"Too many properties in `{{pointer}}`, should be `{{maximum}}` at most, but got `{{length}}`",MinimumError:"Value in `{{pointer}}` is `{{length}}`, but should be `{{minimum}}` at minimum",MinItemsError:"Too few items in `{{pointer}}`, should be at least `{{minItems}}`, but got `{{length}}`",MinItemsOneError:"At least one item is required in `{{pointer}}`",MinLengthError:"Value `{{pointer}}` should have a minimum length of `{{minLength}}`, but got `{{length}}`.",MinLengthOneError:"A value is required in `{{pointer}}`",MinPropertiesError:"Too few properties in `{{pointer}}`, should be at least `{{minimum}}`, but got `{{length}}`",MissingDependencyError:"The required propery '{{missingProperty}}' in `{{pointer}}` is missing",MissingOneOfPropertyError:"Value at `{{pointer}}` property: `{{property}}`",MultipleOfError:"Expected `{{value}}` in `{{pointer}}` to be multiple of `{{multipleOf}}`",MultipleOneOfError:"Value `{{value}}` should not match multiple schemas in oneOf `{{matches}}`",NoAdditionalPropertiesError:"Additional property `{{property}}` in `{{pointer}}` is not allowed",NotError:"Value `{{value}}` at pointer should not match schema `{{not}}`",OneOfError:"Value `{{value}}` in `{{pointer}}` does not match any given oneof schema",OneOfPropertyError:"Failed finding a matching oneOfProperty schema in `{{pointer}}` where `{{property}}` matches `{{value}}`",PatternError:"Value in `{{pointer}}` should match `{{description}}`, but received `{{received}}`",PatternPropertiesError:"Property `{{key}}` does not match any patterns in `{{pointer}}`. Valid patterns are: {{patterns}}",RequiredPropertyError:"The required property `{{key}}` is missing at `{{pointer}}`",SchemaWarning:"Failed retrieving a schema from '{{pointer}}' to key '{{key}}'",TypeError:"Expected `{{value}}` ({{received}}) in `{{pointer}}` to be of type `{{expected}}`",UndefinedValueError:"Value must not be undefined in `{{pointer}}`",UniqueItemsError:"Items in array must be unique. Value `{{value}}` in `{{pointer}}` is a duplicate of {{duplicatePointer}}.",UnknownPropertyError:"Could not find a valid schema for property `{{pointer}}` within object",ValueNotEmptyError:"A value for `{{property}}` is required at `{{pointer}}`"},r=Object.prototype.toString;function o(e){const t=r.call(e).match(/\s([^\]]+)\]/).pop().toLowerCase();return"file"===t?"object":t}const i="object",a="array";function s(e,r={}){return e.replace(/\{\{\w+\}\}/g,(e=>{const t=e.replace(/[{}]/g,""),n=r[t],s=o(n);return s===i||s===a?JSON.stringify(n):n}))}function l(r,t,n=r){var o;return s(null!==(o=e[r])&&void 0!==o?o:n,t)}function u(e,r){return{type:"error",name:e,code:(t=e,t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()),message:l(e,r),data:r};var t}function c(e){return u.bind(null,e)}function f(e,r=[]){for(let t=0;t({index:t,schema:e})}),n}function d(e){return"error"===(null==e?void 0:e.type)}function h(e){return d(e)||e instanceof Promise}function y(e){return d(e)}const{DECLARATOR_ONEOF:v}=m;function b(e,r,t=e.rootSchema,n="#"){if(null!=r&&t[v]){const o=[],i=t[v],a=r[t[v]];if(void 0===a)return e.errors.missingOneOfPropertyError({property:i,pointer:n,schema:t,value:r});for(let s=0;s0))return p(t,l,s);o.push(...c)}return e.errors.oneOfPropertyError({property:i,value:a,pointer:n,schema:t,errors:o})}const o=[],i=[];for(let a=0;a0?i.push(...l):o.push({index:a,schema:s})}return 1===o.length?p(t,o[0].schema,o[0].index):o.length>1?e.errors.multipleOneOfError({value:r,pointer:n,schema:t,matches:o}):e.errors.oneOfError({value:JSON.stringify(r),pointer:n,schema:t,oneOf:t.oneOf,errors:i})}function g(e,r,t,n){if(null==t||null==r.properties)return-1;let o=0;const i=Object.keys(r.properties);for(let a=0;a0))return p(t,l,s);o.push(...c)}return e.errors.oneOfPropertyError({property:i,value:a,pointer:n,schema:t,errors:o})}const i=[];for(let o=0;o1?e.errors.multipleOneOfError({matches:i,pointer:n,schema:t,value:r}):e.errors.oneOfError({value:JSON.stringify(r),pointer:n,schema:t,oneOf:t.oneOf})}var O=t(744),E=t.n(O);const x=(e,r)=>r,P=(e,r)=>E()(e,r,{arrayMerge:x}),_=(e,r)=>{const t=e.concat(r);return t.filter(((e,r)=>t.indexOf(e)===r))},I=(e,r)=>E()(e,r,{arrayMerge:_});function S(e,r){if(o(e)!==o(r))return e;const t=I(e,r);return e.getOneOfOrigin?Object.defineProperty(t,"getOneOfOrigin",{enumerable:!1,value:e.getOneOfOrigin}):r.getOneOfOrigin&&Object.defineProperty(t,"getOneOfOrigin",{enumerable:!1,value:r.getOneOfOrigin}),t}function A(e,...r){const t={};return Object.keys(e).forEach((n=>{r.includes(n)||(t[n]=e[n])})),e.getOneOfOrigin&&Object.defineProperty(t,"getOneOfOrigin",{enumerable:!1,value:e.getOneOfOrigin}),t}var j=Function.prototype.toString,w=Object.create,R=Object.prototype.toString,L=function(){function e(){this._keys=[],this._values=[]}return e.prototype.has=function(e){return!!~this._keys.indexOf(e)},e.prototype.get=function(e){return this._values[this._keys.indexOf(e)]},e.prototype.set=function(e,r){this._keys.push(e),this._values.push(r)},e}();var k="undefined"!=typeof WeakMap?function(){return new WeakMap}:function(){return new L};function T(e){if(!e)return w(null);var r=e.constructor;if(r===Object)return e===Object.prototype?{}:w(e);if(r&&~j.call(r).indexOf("[native code]"))try{return new r}catch(e){}return w(e)}var D="g"===/test/g.flags?function(e){return e.flags}:function(e){var r="";return e.global&&(r+="g"),e.ignoreCase&&(r+="i"),e.multiline&&(r+="m"),e.unicode&&(r+="u"),e.sticky&&(r+="y"),r};function C(e){var r=R.call(e);return r.substring(8,r.length-1)}var N="undefined"!=typeof Symbol?function(e){return e[Symbol.toStringTag]||C(e)}:C,U=Object.defineProperty,M=Object.getOwnPropertyDescriptor,F=Object.getOwnPropertyNames,V=Object.getOwnPropertySymbols,z=Object.prototype,q=z.hasOwnProperty,H=z.propertyIsEnumerable,K="function"==typeof V;var J=K?function(e){return F(e).concat(V(e))}:F;function G(e,r,t){for(var n=J(e),o=0,i=n.length,a=void 0,s=void 0;o{n=S(n,e.resolveRef(r))})),n}function fe(e,r){if(null==e||null==e.$ref)return e;if(e.getRoot){return e.getRoot().getRef(e)}return r.getRef(e)}function me(e,r){if(null==e||null==e.$ref)return e;const t=r.getRef(e),n=Object.assign({},t,e);return delete n.$ref,Object.defineProperty(n,"__ref",{enumerable:!1,value:e.__ref}),Object.defineProperty(n,"getRoot",{enumerable:!1,value:e.getRoot}),n}function pe(e,r,t){const{schema:n,pointer:o,onError:i}=Object.assign({schema:e.rootSchema,pointer:"#"},t);let a=e.validate(r,n,o);if(i){a=f(a);const e=function(e){return function r(t){return Array.isArray(t)?((t=f(t)).forEach(r),t):(d(t)&&e(t),t)}}(i);for(let r=0;re.filter(y))).catch((e=>{throw console.log("Failed resolving promises",e.message),console.log(e.stack),e}))}function de(e){return"object"===o(e)}function he(e,r,t){const{dependencies:n}=r;if(!de(n)||!de(t))return;let o=!1,i={required:[]};return Object.keys(n).forEach((a=>{var s,l;if(null==t[a]&&!(null===(s=r.required)||void 0===s?void 0:s.includes(a))&&!(null===(l=i.required)||void 0===l?void 0:l.includes(a)))return;const u=n[a];return Array.isArray(u)?(o=!0,void i.required.push(...u)):de(u)?(o=!0,void(i=S(i,e.resolveRef(u)))):void 0})),o?(i.required=(a=i.required).filter(((e,r)=>a.indexOf(e)===r)),i):void 0;var a}function ye(e,r,t){if(!Array.isArray(r.anyOf)||0===r.anyOf.length)return;let n;return r.anyOf.forEach((r=>{r=e.resolveRef(r),e.isValid(t,r)&&(n=n?S(n,r):r)})),n}function ve(e,r,t=e.rootSchema,n="#"){const{anyOf:o}=t;if(!Array.isArray(o)||0===o.length)return t;const i=ye(e,t,r);if(null==i)return e.errors.anyOfError({pointer:n,schema:t,value:r,anyOf:JSON.stringify(o)});return A(S(t,i),"anyOf")}const be=["allOf","anyOf","oneOf","dependencies","if","then","else"],ge=["allOf","anyOf","oneOf","dependencies","if"];function $e(e){const r=Object.keys(e);return-1!==ge.findIndex((e=>r.includes(e)))}function Oe(e,r,t,n){let o,i;if((r=e.resolveRef(r)).oneOf){const a=$(e,t,r,n);d(a)?i=a:a&&(o=S(null!=o?o:{},a))}if(Array.isArray(r.allOf)){const i=r.allOf.map((r=>{if($e(r)){let o=Oe(e,r,t,n);return o?(o=S(r,o),A(o,...be)):void 0}return r}));if(i.length>0){o=S(null!=o?o:{},ce(e,{allOf:i}))}}const a=ye(e,r,t);a&&(o=S(null!=o?o:{},a));const s=he(e,r,t);s&&(o=S(null!=o?o:{},s));const l=se(e,r,t);if(l&&(o=S(null!=o?o:{},l)),null==o)return i;const u=Oe(e,o,t,n);return u&&(o=S(o,u)),A(o,...be)}const Ee=["allOf","anyOf","oneOf","dependencies","if","then","else"];function xe(e,r,t,n){let o=Oe(e,r,t,n);return o?(o=S(r,o),A(o,...Ee)):r}class Pe{constructor(e,r){this.remotes={},this.errors={},this.typeKeywords={},this.validateKeyword={},this.validateType={},this.validateFormat={},this.config=e,this.typeKeywords=ae(e.typeKeywords),this.validateKeyword=Object.assign({},e.validateKeyword),this.validateType=Object.assign({},e.validateType),this.validateFormat=Object.assign({},e.validateFormat),this.errors=Object.assign({},e.errors),this.setSchema(r)}get rootSchema(){return this.__rootSchema}set rootSchema(e){null!=e&&(this.__rootSchema=this.config.compileSchema(this,e))}addRemoteSchema(e,r){this.config.addRemoteSchema(this,e,r)}compileSchema(e){var r;return this.config.compileSchema(this,e,null!==(r=this.rootSchema)&&void 0!==r?r:e)}createSchemaOf(e){return this.config.createSchemaOf(e)}each(e,r,t,n){return this.config.each(this,e,r,t,n)}eachSchema(e,r=this.rootSchema){return this.config.eachSchema(r,e)}getChildSchemaSelection(e,r){return this.config.getChildSchemaSelection(this,e,r)}getSchema(e){return this.config.getSchema(this,e)}getTemplate(e,r,t=this.config.templateDefaultOptions){return this.config.getTemplate(this,e,r,t)}isValid(e,r,t){return this.config.isValid(this,e,r,t)}resolveAnyOf(e,r,t){return this.config.resolveAnyOf(this,e,r,t)}resolveAllOf(e,r){return this.config.resolveAllOf(this,e,r)}resolveRef(e){return this.config.resolveRef(e,this.rootSchema)}resolveOneOf(e,r,t){return this.config.resolveOneOf(this,e,r,t)}setSchema(e){this.rootSchema=e}step(e,r,t,n){return this.config.step(this,e,r,t,n)}validate(e,r,t){return this.config.validate(this,e,r,t)}}function _e(e,r,t){t.id=t.id||r,e.remotes[r]=e.compileSchema(t)}var Ie=t(546),Se=t.n(Ie),Ae=t(782);const je="[^?/{}*,()#]+",we=`\nroot ::= ("#" recursion | recursion | (query | pattern) recursion* | "#" SEP? | SEP)\nrecursion ::= (SEP query | pattern)*\n\nquery ::= (ESC escaped ESC | property | all | any | regex) typecheck? lookahead?\nproperty ::= ${je}\nregex ::= "{" [^}]+ "}"\nSEP ::= "/"\nall ::= "**"\nany ::= "*"\n\ntypecheck ::= "?:" ("value" | "boolean" | "string" | "number" | "object" | "array")\nlookahead ::= "?" expression ((andExpr | orExpr) expression)*\nandExpr ::= S? "&&" S?\norExpr ::= S? "||" S?\n\nexpression ::= (exprProperty | ESC escaped ESC) ((isnot | is) (exprProperty | regex | ESC escaped ESC))*\nexprProperty ::= [a-zA-Z0-9-_ $]+\nescaped ::= [^"]+\nis ::= ":"\nisnot ::= ":!"\nESC ::= '"'\n\npattern ::= S? "(" (SEP query | pattern (orPattern? pattern)*)* ")" quantifier? S? lookahead?\nquantifier ::= "+" | "*" | [0-9]+\norPattern ::= S? "," S?\n\nS ::= [ ]*\n`,Re=new Ae.A.Parser(we),Le=e=>Re.getAST(e),ke=(e,r)=>`${e}/${r}`,Te=Object.prototype.toString,De=/Object|Array/,Ce=e=>De.test(Te.call(e));function Ne(e){return new RegExp(e.text.replace(/(^{|}$)/g,""))}function Ue(e){return Array.isArray(e)?e.map((function(e,r){return`${r}`})):"[object Object]"===Object.prototype.toString.call(e)?Object.keys(e):[]}const Me={mem:[],get(e,r){const t=e[0][r];if(!Me.mem.includes(t))return Ce(t)&&Me.mem.push(t),[t,r,e[0],ke(e[3],r)]},reset(){Me.mem.length=0}},Fe={any(e,r){const t=r[0];return Ue(t).map((e=>[t[e],e,t,ke(r[3],e)]))},all(e,r){const t=[r];var n,o;return n=r[0],o=(n,o)=>{const i=Me.get(r,o);i&&t.push(...Fe.all(e,i))},Array.isArray(n)?n.forEach(o):"[object Object]"===Object.prototype.toString.call(n)&&Object.keys(n).forEach((function(e){o(n[e],e,n)})),t},regex(e,r){const t=Ne(e),n=r[0];return Ue(n).filter((e=>t.test(e))).map((e=>[n[e],e,n,ke(r[3],e)]))}},Ve={escaped:(e,r)=>Ve.property(e,r),property:(e,r)=>{const t=e.text;if(r[0]&&void 0!==r[0][t])return[r[0][t],t,r[0],ke(r[3],t)]},typecheck:(e,r)=>{const t=e.text.replace(/^\?:/,"");if("value"===t)return Ce(r[0])?void 0:r;var n;return(n=r[0],Te.call(n).match(/\s([^\]]+)\]/).pop().toLowerCase())===t?r:void 0},lookahead:(e,r)=>{let t=!0,n=!1;return e.children.forEach((e=>{if("expression"===e.type){const o=void 0!==Ve.expression(e,r);t=!0===n?t||o:t&&o}else n="orExpr"===e.type})),t?r:void 0},expression:(e,r)=>{const t=e.children[0].text,n=e.children[1],o=e.children[2],i=r[0];if(!1!==Ce(i))return function(e,r,t){if(void 0===r)return void 0!==e;let n;const o=`${e}`;if("regex"===t.type){n=Ne(t).test(o)}else n=o===t.text;"isnot"===r.type&&(n=!1===n&&void 0!==e);return n}(i[t],n,o)?r:void 0}};function ze(e,r,t){const n=[];let o=e;return r.children.forEach((r=>{if("orPattern"===r.type)return n.push(...o),void(o=e);o=He(o,r,t)})),n.push(...o),n}function qe(e,r,t){const n=[],o=r.children.find((e=>"quantifier"===e.type)),i=function(e){if(null==e)return 1;if("*"===e||"+"===e)return 1/0;const r=parseInt(e);return isNaN(r)?1:r}(o&&o.text);let a=e;o&&"*"===o.text&&n.push(...a);let s=0;for(;a.length>0&&s{if(Fe[e.type])n=function(e,r,t,n){const o=[];for(let i=0,a=r.length;in=He(n,e,t))),n}(e,r,t),Me.reset(),Me.mem.push(e),n}const Ke={value:e=>e.map((e=>e[0])),pointer:e=>e.map((e=>e[3])),all:e=>e,map:e=>{const r={};return e.forEach((e=>r[e[3]]=e[0])),r}};var Je;function Ge(e,r,t=Je.VALUE){if(null==r)return[];""===(r=r.replace(/(\/$)/g,""))&&(r="#");const n=Le(r);if(null==n)throw new Error(`empty ast for '${r}'`);if(""!==n.rest)throw new Error(`Failed parsing queryString from: '${n.rest}'`);const o=function(e,r){return Me.reset(),Me.mem.push(e),He([[e,null,null,"#"]],r)}(e,n);return"function"==typeof t?o.map((e=>t(...e))):Ke[t]?Ke[t](o):o}!function(e){e.POINTER="pointer",e.VALUE="value",e.ALL="all",e.MAP="map"}(Je||(Je={})),Ge.POINTER=Je.POINTER,Ge.VALUE=Je.VALUE,Ge.ALL=Je.ALL,Ge.MAP=Je.MAP;const We=["root","recursion"];function Ze(e,r=[]){return We.includes(e.type)?(e.children.forEach((e=>Ze(e,r))),r):(r.push(e.text),r)}function Be(e){if(null==e||""===e)return[];return Ze(Le(e))}const Qe=e=>JSON.parse(JSON.stringify(e)),Xe=Object.prototype.toString,Ye=e=>Xe.call(e).match(/\s([^\]]+)\]/).pop().toLowerCase(),er=new RegExp(`^("[^"]+"|${je})$`),rr=["string","number","boolean","null"],tr=/^\[\d*\]$/,nr=/^\[(\d+)\]$/,or=/^".+"$/,ir=/(^\[\d*\]$|^\d+$)/;function ar(e){return parseInt(e.replace(/^(\[|\]$)/,""))}function sr(e){return or.test(e)?e.replace(/(^"|"$)/g,""):e}function lr(e,r,t,n){const o=e[0];if(/^\[\]$/.test(r)){o.push(t);const r=o.length-1;return[o[r],r,o,`${e[3]}/${r}}`]}if(null==n&&"object"===Ye(o[r])&&"object"===Ye(t))return[o[r],r,o,`${e[3]}/${r}}`];if(n===cr.INSERT_ITEMS||null==n&&nr.test(r)){const n=ar(r);return function(e,r,t){e.length<=r?e[r]=t:e.splice(r,0,t)}(o,n,t),[o[n],n,o,`${e[3]}/${n}}`]}if(n===cr.REPLACE_ITEMS||null==n){const n=ar(r);return o[n]=t,[o[n],n,o,`${e[3]}/${n}}`]}throw new Error(`Unknown array index '${r}' with force-option '${n}'`)}var ur;function cr(e,r,t,n){if(null==r)return Qe(e);if(""===(r=r.replace(/(\/$)/g,"")))return Qe(t);const o=Qe(e);let i=[[o,null,null,"#"]];const a=Be(r),s=a.pop(),l=tr.test(s)&&!1===nr.test(s);if(!1===er.test(s)||l)throw new Error(`Unsupported query '${r}' ending with non-property`);return a.forEach(((e,r)=>{if("__proto__"===e||"prototyped"===e||"constructor"===e)return;if(!1===er.test(e))return void(i=function(e,r){const t=[];return e.forEach((e=>t.push(...Ge(e[0],r,Je.ALL)))),t}(i,e));const t=r>=a.length-1?s:a[r+1],o=ir.test(t);i=function(e,r,t,n){return r=sr(r),e.filter((e=>!(!Array.isArray(e[0])||!ir.test(r))||!1===rr.includes(Ye(e[0][r])))).map((e=>{const o=t?[]:{},i=e[0];return Array.isArray(i)?lr(e,r,o,n):(i[r]=i[r]||o,[i[r],r,i,`${e[3]}/${r}`])}))}(i,e,o,n)})),i.forEach((e=>{let r=t;"function"===Ye(t)&&(r=t(e[3],s,e[0],`${e[3]}/${s}`));const o=e[0];if(Array.isArray(o))lr(e,s,r,n);else{const e=sr(s);if("__proto__"===e||"prototyped"===e||"constructor"===e)return;o[e]=r}})),o}!function(e){e.REPLACE_ITEMS="replace",e.INSERT_ITEMS="insert"}(ur||(ur={})),cr.REPLACE_ITEMS=ur.REPLACE_ITEMS,cr.INSERT_ITEMS=ur.INSERT_ITEMS;const fr={$ref:{type:!1},allOf:{type:!1,definitions:["allOf/*"]},anyOf:{type:!1,definitions:["anyOf/*"]},array:{type:!0,definitions:["allOf/*","anyOf/*","oneOf/*","not","items","items/*","additionalItems"],validationKeywords:["minItems","maxItems","uniqueItems"],keywords:["items","additionalItems","minItems","maxItems","uniqueItems"]},boolean:{type:!0},enum:{type:!1},integer:{type:!0,definitions:["allOf/*","anyOf/*","oneOf/*","not"],validationKeywords:["minimum","maximum","multipleOf"]},not:{type:!1,definitions:["not"]},number:{type:!0,definitions:["allOf/*","anyOf/*","oneOf/*","not"],validationKeywords:["minimum","maximum","multipleOf"]},null:{type:!0},object:{type:!0,definitions:["allOf/*","anyOf/*","oneOf/*","not","properties/*","additionalProperties","patternProperties/*","dependencies/*"],validationKeywords:["minProperties","maxProperties","required"],keywords:["properties","additionalProperties","patternProperties","dependencies","minProperties","maxProperties","required"]},oneOf:{type:!1,definitions:["oneOf/*"]},string:{type:!0,definitions:["allOf/*","anyOf/*","oneOf/*","not"],validationKeywords:["minLength","maxLength","pattern"]}},mr=Object.keys(fr).filter((e=>!1===fr[e].type)),pr=Object.prototype.hasOwnProperty;function dr(e){if(!1===de(e))return;if(e.enum)return"enum";const r=e.type;if(Array.isArray(r)||fr[r])return r;const t=mr.filter((r=>e[r]));if(1===t.length)return t[0];if(0!==t.length)throw new Error(`Mutiple typeIds [${t.join(", ")}] matched in ${JSON.stringify(e)}`);for(let r=0,t=fr.object.keywords.length;r{Ge(e,t,((e,t,n,o)=>{de(e)&&dr(e)&&r.push({pointer:Se().join(Se().split(o),!1),def:e})}))})),r}(e);t.forEach((e=>this.nextTypeDefs(e.def,Se().join(r,e.pointer,!1))))}function yr(e,r,t,n="definitions"){const o=r[n];Object.keys(o).forEach((r=>{(!1===o[r]||de(o[r]))&&e.nextTypeDefs(o[r],Se().join(t,n,r,!1))}))}function vr(e,r,t="#"){const n={callback:r,nextTypeDefs:hr};n.nextTypeDefs(e,t),null!=e.definitions&&(n.callback=(e,t)=>{r(e,t),null!=e.definitions&&yr(n,e,t)},yr(n,e,t)),null!=e.$defs&&(n.callback=(e,t)=>{r(e,t),null!=e.definitions&&yr(n,e,t)},yr(n,e,t,"$defs"))}const br=/(#|\/)+$/,gr=/#$/,$r=/^[^:]+:\/\/[^/]+\//,Or=/\/[^/]*$/,Er=/#.*$/;function xr(e,r){return null==e&&null==r?"#":null==r?e.replace(gr,""):null==e?r.replace(gr,""):"#"===r[0]?`${e.replace(Er,"")}${r.replace(br,"")}`:$r.test(r)?r.replace(gr,""):`${e.replace(Or,"")}/${r.replace(gr,"")}`}const Pr=/(#|\/)+$/g,_r=["",null,"#"];const Ir=/(#|\/)+$/g,Sr=e=>"object"===o(e);function Ar(e,r,t){if(Sr(t)&&(t=t.__ref||t.$ref),null==t)return r;let n;const o=t.replace(Ir,"");if(e.remotes[o])return n=e.remotes[o],n&&n.$ref?Ar(e,r,n.$ref):n;if(e.ids[t])return n=(0,Ie.get)(r,e.ids[t]),n&&n.$ref?Ar(e,r,n.$ref):n;const i=function(e){if(_r.includes(e))return[];if(-1===(e=e.replace(Pr,"")).indexOf("#"))return[e.replace(Pr,"")];if(0===e.indexOf("#"))return[e.replace(Pr,"")];const r=e.split("#");return r[0]=r[0].replace(Pr,""),r[1]=`#${r[1].replace(Pr,"")}`,r}(t);if(0===i.length)return r;if(1===i.length){if(t=i[0],e.remotes[t])return n=e.remotes[t],Ar(e,r,n.$ref);if(e.ids[t])return n=(0,Ie.get)(r,e.ids[t]),n&&n.$ref?Ar(e,r,n.$ref):n}if(2===i.length){const n=i[0];if(t=i[1],e.remotes[n])return e.remotes[n].getRef?e.remotes[n].getRef(t):Ar(e,e.remotes[n],t);if(e.ids[n])return Ar(e,(0,Ie.get)(r,e.ids[n]),t)}return n=(0,Ie.get)(r,e.ids[t]||t),n&&n.$ref?Ar(e,r,n.$ref):n}const jr="__compiled",wr="__ref",Rr=/(#|\/)+$/g;const Lr=function(e,r,t=r,n=!1){if(!r||void 0!==r[jr])return r;const o={ids:{},remotes:e.remotes},i=JSON.stringify(r),a=JSON.parse(i);if(Object.defineProperty(a,jr,{enumerable:!1,value:!0}),Object.defineProperty(a,"getRef",{enumerable:!1,value:Ar.bind(null,o,a)}),!1===n&&!1===i.includes("$ref"))return a;r!==t&&Object.defineProperty(a,"definitions",{enumerable:!1,value:Object.assign({},t.definitions,t.$defs,r.definitions,r.$defs)});const s={},l=()=>a;return vr(a,((e,r)=>{var t;if(e.id){if(e.id.startsWith("http")&&/(allOf|anyOf|oneOf)\/\d+$/.test(r)){const n=r.replace(/\/(allOf|anyOf|oneOf)\/\d+$/,""),o=(0,Ie.get)(a,n);e.id=null!==(t=o.id)&&void 0!==t?t:e.id}o.ids[e.id.replace(Rr,"")]=r}const n=(r=`#${r}`.replace(/##+/,"#")).replace(/\/[^/]+$/,""),i=r.replace(/\/[^/]+\/[^/]+$/,""),u=xr(s[n]||s[i],e.id);s[r]=u,null==o.ids[u]&&(o.ids[u]=r),e.$ref&&!e[wr]&&(Object.defineProperty(e,wr,{enumerable:!1,value:xr(u,e.$ref)}),Object.defineProperty(e,"getRoot",{enumerable:!1,value:l}))})),a};function kr(e,r,t,n=e.rootSchema,i="#"){n=e.resolveRef(n),t(n,r,i);const a=o(r);"object"===a?Object.keys(r).forEach((o=>{const a=e.step(o,n,r,i),s=r[o];e.each(s,t,a,`${i}/${o}`)})):"array"===a&&r.forEach(((o,a)=>{const s=e.step(a,n,r,i);e.each(o,t,s,`${i}/${a}`)}))}const Tr={additionalItemsError:c("AdditionalItemsError"),additionalPropertiesError:c("AdditionalPropertiesError"),anyOfError:c("AnyOfError"),allOfError:c("AllOfError"),constError:c("ConstError"),containsError:c("ContainsError"),containsArrayError:c("ContainsArrayError"),containsAnyError:c("ContainsAnyError"),enumError:c("EnumError"),forbiddenPropertyError:c("ForbiddenPropertyError"),formatURLError:c("FormatURLError"),formatURIError:c("FormatURIError"),formatURIReferenceError:c("FormatURIReferenceError"),formatURITemplateError:c("FormatURITemplateError"),formatDateError:c("FormatDateError"),formatDateTimeError:c("FormatDateTimeError"),formatEmailError:c("FormatEmailError"),formatHostnameError:c("FormatHostnameError"),formatIPV4Error:c("FormatIPV4Error"),formatIPV4LeadingZeroError:c("FormatIPV4LeadingZeroError"),formatIPV6Error:c("FormatIPV6Error"),formatIPV6LeadingZeroError:c("FormatIPV6LeadingZeroError"),formatJsonPointerError:c("FormatJsonPointerError"),formatRegExError:c("FormatRegExError"),formatTimeError:c("FormatTimeError"),invalidSchemaError:c("InvalidSchemaError"),invalidDataError:c("InvalidDataError"),invalidTypeError:c("InvalidTypeError"),invalidPropertyNameError:c("InvalidPropertyNameError"),maximumError:c("MaximumError"),maxItemsError:c("MaxItemsError"),maxLengthError:c("MaxLengthError"),maxPropertiesError:c("MaxPropertiesError"),minimumError:c("MinimumError"),minItemsError:c("MinItemsError"),minItemsOneError:c("MinItemsOneError"),minLengthError:c("MinLengthError"),minLengthOneError:c("MinLengthOneError"),minPropertiesError:c("MinPropertiesError"),missingDependencyError:c("MissingDependencyError"),missingOneOfPropertyError:c("MissingOneOfPropertyError"),multipleOfError:c("MultipleOfError"),multipleOneOfError:c("MultipleOneOfError"),noAdditionalPropertiesError:c("NoAdditionalPropertiesError"),notError:c("NotError"),oneOfError:c("OneOfError"),oneOfPropertyError:c("OneOfPropertyError"),patternError:c("PatternError"),patternPropertiesError:c("PatternPropertiesError"),requiredPropertyError:c("RequiredPropertyError"),schemaWarning:c("SchemaWarning"),typeError:c("TypeError"),undefinedValueError:c("UndefinedValueError"),uniqueItemsError:c("UniqueItemsError"),unknownPropertyError:c("UnknownPropertyError"),valueNotEmptyError:c("ValueNotEmptyError")};var Dr=t(853),Cr=t.n(Dr),Nr=t(125);const Ur=new RegExp("^([0-9]+)-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])[Tt]([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9]|60)(\\.[0-9]+)?(([Zz])|([\\+|\\-]([01][0-9]|2[0-3]):[0-5][0-9]))$"),Mr=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,Fr=/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,Vr=/^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\.?$/,zr=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,qr=/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,Hr=[0,31,28,31,30,31,30,31,31,30,31,30,31],Kr=/^(?:\/(?:[^~/]|~0|~1)*)*$/,Jr=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,Gr=/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,Wr=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,Zr={date:(e,r,t,n)=>{if("string"!=typeof t||""===t)return;const o=t.match(zr);if(!o)return e.errors.formatDateTimeError({value:t,pointer:n,schema:r});const i=+o[1],a=+o[2],s=+o[3];return a>=1&&a<=12&&s>=1&&s<=(2==a&&(i%4==0&&(i%100!=0||i%400==0))?29:Hr[a])?void 0:e.errors.formatDateError({value:t,pointer:n,schema:r})},"date-time":(e,r,t,n)=>{if("string"==typeof t&&""!==t)return""===t||Ur.test(t)?"Invalid Date"===new Date(t).toString()?e.errors.formatDateTimeError({value:t,pointer:n,schema:r}):void 0:e.errors.formatDateTimeError({value:t,pointer:n,schema:r})},email:(e,r,t,n)=>{if("string"!=typeof t||""===t)return;if('"'===t[0])return e.errors.formatEmailError({value:t,pointer:n,schema:r});const[o,i,...a]=t.split("@");return!o||!i||0!==a.length||o.length>64||i.length>253||"."===o[0]||o.endsWith(".")||o.includes("..")?e.errors.formatEmailError({value:t,pointer:n,schema:r}):/^[a-z0-9.-]+$/i.test(i)&&/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+$/i.test(o)&&i.split(".").every((e=>/^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(e)))?void 0:e.errors.formatEmailError({value:t,pointer:n,schema:r})},"idn-email":(e,r,t,n)=>{if("string"==typeof t&&""!==t)try{return void(0,Nr.parse)(t)}catch(o){return e.errors.formatEmailError({value:t,pointer:n,schema:r})}},hostname:(e,r,t,n)=>{if("string"==typeof t&&""!==t&&!Vr.test(t))return e.errors.formatHostnameError({value:t,pointer:n,schema:r})},ipv4:(e,r,t,n)=>{if("string"==typeof t&&""!==t){if(t&&"0"===t[0])return e.errors.formatIPV4LeadingZeroError({value:t,pointer:n,schema:r});if(!(t.length<=15&&Mr.test(t)))return e.errors.formatIPV4Error({value:t,pointer:n,schema:r})}},ipv6:(e,r,t,n)=>{if("string"==typeof t&&""!==t){if(t&&"0"===t[0])return e.errors.formatIPV6LeadingZeroError({value:t,pointer:n,schema:r});if(!(t.length<=45&&Fr.test(t)))return e.errors.formatIPV6Error({value:t,pointer:n,schema:r})}},"json-pointer":(e,r,t,n)=>{if("string"==typeof t&&""!==t&&!Kr.test(t))return e.errors.formatJsonPointerError({value:t,pointer:n,schema:r})},"relative-json-pointer":(e,r,t,n)=>{if("string"==typeof t&&""!==t&&!Jr.test(t))return e.errors.formatJsonPointerError({value:t,pointer:n,schema:r})},regex:(e,r,t,n)=>{if("string"==typeof t&&!1===/\\Z$/.test(t)){try{return void new RegExp(t)}catch(e){}return e.errors.formatRegExError({value:t,pointer:n,schema:r})}if("object"!=typeof t&&"number"!=typeof t&&!Array.isArray(t))return e.errors.formatRegExError({value:t,pointer:n,schema:r})},time:(e,r,t,n)=>{if("string"!=typeof t||""===t)return;return t.match(qr)?void 0:e.errors.formatDateTimeError({value:t,pointer:n,schema:r})},uri:(e,r,t,n)=>{if("string"==typeof t&&""!==t&&!Cr().isUri(t))return e.errors.formatURIError({value:t,pointer:n,schema:r})},"uri-reference":(e,r,t,n)=>{if("string"==typeof t&&""!==t&&!Gr.test(t))return e.errors.formatURIReferenceError({value:t,pointer:n,schema:r})},"uri-template":(e,r,t,n)=>{if("string"==typeof t&&""!==t&&!Wr.test(t))return e.errors.formatURITemplateError({value:t,pointer:n,schema:r})},url:(e,r,t,n)=>{if(""!==t&&!Cr().isWebUri(t))return e.errors.formatURLError({value:t,pointer:n,schema:r})}},Br={};function Qr(e,r=Br){const{pointer:t="#",data:n,schema:o=e.rootSchema,withSchemaWarning:i=!1}=r,a=Se().split(t),s=Xr(e,e.resolveRef(o),a,"#",n);if(i||"schema-warning"!==(null==s?void 0:s.code))return s}function Xr(e,r,t,n,o=Br){if(0===t.length)return e.resolveRef(r);const i=t.shift();return d(r=e.step(i,r,o,n))?r:Xr(e,r,t,`${n}/${i}`,o=o[i])}const Yr=m.templateDefaultOptions;let et;function rt(e,r){const{$ref:t}=e;if(null==t)return!0;return(null==et[r]||null==et[r][t]?0:et[r][t])0){if(rt(r.anyOf[0],`${n}/anyOf/0`)){const t=tt(e,r.anyOf[0],`${n}/anyOf/0`);a=P(a,t),a.pointer=r.anyOf[0].$ref||a.pointer}delete a.anyOf}if(Array.isArray(r.allOf)){const o=r.allOf.map(((e,r)=>rt(e,`${n}/allOf/${r}`))).reduceRight(((e,r)=>e&&r),!0);if(o){const o=[];let s=ae(t);for(let t=0;te&&"object"==typeof e;function it(e,r,t,n,i){var a;if(null==t)throw new Error(`getTemplate: missing schema for data: ${JSON.stringify(r)}`);if(null==n)throw new Error("Missing pointer");let s=nt(e,t,r,n,i);if(!ot(s))return;if(n=s.pointer,null==s?void 0:s.const)return s.const;if(Array.isArray(s.oneOf))if(function(e){switch(o(e)){case"string":case"array":return 0===(null==e?void 0:e.length);case"null":case"undefined":return!0;case"object":return 0===Object.keys(e).length;default:return!1}}(r)){const e=s.oneOf[0].type||s.type||s.const&&typeof s.const||o(r);s=Object.assign(Object.assign({},s.oneOf[0]),{type:e})}else{const t=$(e,r,s);if(d(t)){if(null!=r&&!0!==i.removeInvalidData)return r;s=s.oneOf[0],r=void 0}else t.type=null!==(a=t.type)&&void 0!==a?a:s.type,s=t}if(!ot(s)||null==s.type)return;if(r instanceof File)return r;const l=Array.isArray(s.type)?function(e,r,t){if(null==r){if(null!=t){const r=o(t);if(e.includes(r))return r}return e[0]}const n=o(r);if(e.includes(n))return n;return e[0]}(s.type,r,s.default):s.type,u=o(r);if(null==r||u===l||"number"===u&&"integer"===l||(r=function(e,r){if("string"===e)return JSON.stringify(r);if("string"!=typeof r)return null;try{if(typeof(r=JSON.parse(r))===e)return r}catch(e){}return null}(l,r)),null==at[l]){if(i.removeInvalidData)return;return r}return at[l](e,s,r,n,i)}const at={null:(e,r,t)=>st(r,t,null),string:(e,r,t)=>st(r,t,""),number:(e,r,t)=>st(r,t,0),integer:(e,r,t)=>st(r,t,0),boolean:(e,r,t)=>st(r,t,!1),object:(e,r,t,n,i)=>{var a;const s=void 0===r.default?{}:r.default,l={},u=!1===i.extendDefaults&&void 0!==r.default?[]:null!==(a=r.required)&&void 0!==a?a:[];r.properties&&Object.keys(r.properties).forEach((o=>{const a=null==t||null==t[o]?s[o]:t[o],c=u.includes(o);(null!=a||c||i.addOptionalProps)&&(l[o]=it(e,a,r.properties[o],`${n}/properties/${o}`,i))}));let c=he(e,r,l);if(c){c=S(r,c),delete c.dependencies;const o=it(e,t,c,`${n}/dependencies`,i);Object.assign(l,o)}t&&(!0!==i.removeInvalidData||!1!==r.additionalProperties&&"object"!==o(r.additionalProperties)?Object.keys(t).forEach((e=>null==l[e]&&(l[e]=t[e]))):"object"===o(r.additionalProperties)&&Object.keys(t).forEach((n=>{null==l[n]&&e.isValid(t[n],r.additionalProperties)&&(l[n]=t[n])})));const f=se(e,r,l);if(f){const r=it(e,l,Object.assign({type:"object"},f),n,i);Object.assign(l,r)}return l},array:(e,r,t,n,i)=>{var a,s;if(null==r.items)return t||[];const l=void 0===r.default?[]:r.default,u=t||l,c=!1===i.extendDefaults&&void 0!==r.default?0:r.minItems||0;if(Array.isArray(r.items)){for(let t=0,o=Math.max(null!=c?c:0,null!==(s=null===(a=r.items)||void 0===a?void 0:a.length)&&void 0!==s?s:0);t0){const r=Math.max(c,u.length);for(let t=0;t(et={},it(e,r,t,"#",n?Object.assign(Object.assign({},Yr),n):Yr));function ut(e,r,t=e.rootSchema,n="#"){return 0===e.validate(r,t,n).length}function ct(e){const r=[];let t=0;const n=e.length;for(;t=55296&&o<=56319&&t!(void 0===e[r]||!dt.call(e,r)),yt={additionalProperties:(e,r,t,n)=>{if(!0===r.additionalProperties||null==r.additionalProperties)return;if("object"===o(r.patternProperties)&&!1===r.additionalProperties)return;const i=[];let a=Object.keys(t).filter((e=>!1===m.propertyBlacklist.includes(e)));const s=Object.keys(r.properties||{});if("object"===o(r.patternProperties)){const e=Object.keys(r.patternProperties).map((e=>new RegExp(e)));a=a.filter((r=>{for(let t=0;t{const{allOf:o}=r;if(!Array.isArray(o)||0===o.length)return;const i=[];return r.allOf.forEach((r=>{i.push(...e.validate(t,r,n))})),i},anyOf:(e,r,t,n)=>{if(Array.isArray(r.anyOf)&&0!==r.anyOf.length){for(let n=0;n{if("object"!==o(r.dependencies))return;const i=[];return Object.keys(t).forEach((a=>{if(void 0===r.dependencies[a])return;if(!0===r.dependencies[a])return;if(!1===r.dependencies[a])return void i.push(e.errors.missingDependencyError({pointer:n,schema:r,value:t}));let s;const l=o(r.dependencies[a]);if("array"===l)s=r.dependencies[a].filter((e=>void 0===t[e])).map((o=>e.errors.missingDependencyError({missingProperty:o,pointer:n,schema:r,value:t})));else{if("object"!==l)throw new Error(`Invalid dependency definition for ${n}/${a}. Must be string[] or schema`);s=e.validate(t,r.dependencies[a],n)}i.push(...s)})),i.length>0?i:void 0},enum:(e,r,t,n)=>{const i=o(t);if("object"===i||"array"===i){const e=JSON.stringify(t);for(let t=0;t{if(e.validateFormat[r.format]){return e.validateFormat[r.format](e,r,t,n)}},items:(e,r,t,n)=>{if(!1===r.items){if(Array.isArray(t)&&0===t.length)return;return e.errors.invalidDataError({pointer:n,value:t,schema:r})}const o=[];for(let i=0;i{if(!isNaN(r.maximum))return r.maximum&&r.maximum{if(!isNaN(r.maxItems))return r.maxItems{if(isNaN(r.maxLength))return;const o=ct(t).length;return r.maxLength{const o=Object.keys(t).length;if(!1===isNaN(r.maxProperties)&&r.maxProperties{if(isNaN(r.minLength))return;const o=ct(t).length;return r.minLength>o?1===r.minLength?e.errors.minLengthOneError({minLength:r.minLength,length:o,pointer:n,schema:r,value:t}):e.errors.minLengthError({minLength:r.minLength,length:o,pointer:n,schema:r,value:t}):void 0},minimum:(e,r,t,n)=>{if(!isNaN(r.minimum))return r.minimum>t||!0===r.exclusiveMinimum&&r.minimum===t?e.errors.minimumError({minimum:r.minimum,length:t,pointer:n,schema:r,value:t}):void 0},minItems:(e,r,t,n)=>{if(!isNaN(r.minItems))return r.minItems>t.length?1===r.minItems?e.errors.minItemsOneError({minItems:r.minItems,length:t.length,pointer:n,schema:r,value:t}):e.errors.minItemsError({minItems:r.minItems,length:t.length,pointer:n,schema:r,value:t}):void 0},minProperties:(e,r,t,n)=>{if(isNaN(r.minProperties))return;const o=Object.keys(t).length;return r.minProperties>o?e.errors.minPropertiesError({minProperties:r.minProperties,length:o,pointer:n,schema:r,value:t}):void 0},multipleOf:(e,r,t,n)=>{if(isNaN(r.multipleOf)||"number"!=typeof t)return;const o=ft(t),i=ft(r.multipleOf);if(o>i)return e.errors.multipleOfError({multipleOf:r.multipleOf,value:t,pointer:n,schema:r});const a=Math.pow(10,i);return Math.round(t*a)%Math.round(r.multipleOf*a)/a!=0?e.errors.multipleOfError({multipleOf:r.multipleOf,value:t,pointer:n,schema:r}):void 0},not:(e,r,t,n)=>{const o=[];return 0===e.validate(t,r.not,n).length&&o.push(e.errors.notError({value:t,not:r.not,pointer:n,schema:r})),o},oneOf:(e,r,t,n)=>{if(Array.isArray(r.oneOf)){const o=e.resolveOneOf(t,r,n);if(d(o))return o}},pattern:(e,r,t,n)=>{if(!1===new RegExp(r.pattern,"u").test(t))return e.errors.patternError({pattern:r.pattern,description:r.patternExample||r.pattern,received:t,schema:r,value:t,pointer:n})},patternProperties:(e,r,t,n)=>{const i=r.properties||{},a=r.patternProperties;if("object"!==o(a))return;const s=[],l=Object.keys(t),u=Object.keys(a).map((e=>({regex:new RegExp(e),patternSchema:a[e]})));return l.forEach((o=>{let l=!1;for(let r=0,i=u.length;r0&&s.push(...i)}i[o]||!1===l&&!1===r.additionalProperties&&s.push(e.errors.patternPropertiesError({key:o,pointer:n,schema:r,value:t,patterns:Object.keys(a).join(",")}))})),s},properties:(e,r,t,n)=>{const o=[],i=Object.keys(r.properties||{});for(let a=0;a{const o=[],i=Object.keys(r.properties||{});for(let a=0;a{if(!1!==Array.isArray(r.required))return r.required.map((o=>{if(!ht(t,o))return e.errors.requiredPropertyError({key:o,pointer:n,schema:r,value:t})}))},requiredNotEmpty:(e,r,t,n)=>{if(!1!==Array.isArray(r.required))return r.required.map((o=>{if(null==t[o]||""===t[o])return e.errors.valueNotEmptyError({property:o,pointer:`${n}/${o}`,schema:r,value:t})}))},uniqueItems:(e,r,t,n)=>{if(!1===(Array.isArray(t)&&r.uniqueItems))return;const o=[],i=[];return t.forEach(((a,s)=>{for(let l=s+1;lr.properties[t]=bt(e[t])))),"array"===r.type&&Array.isArray(e)&&(1===e.length?r.items=bt(e[0]):r.items=e.map(bt)),r}const gt={array:(e,r,t,n,i)=>{const a=null==n?void 0:n[r],s=o(t.items);if("object"===s)return xe(e,t.items,a,`${i}/${r}`)||e.resolveRef(t.items);if("array"===s){if(!0===t.items[r])return bt(a);if(!1===t.items[r])return e.errors.invalidDataError({key:r,value:a,pointer:i,schema:t});if(t.items[r])return e.resolveRef(t.items[r]);if(!1===t.additionalItems)return e.errors.additionalItemsError({key:r,value:a,pointer:i,schema:t});if(!0===t.additionalItems||void 0===t.additionalItems)return bt(a);if("object"===o(t.additionalItems))return t.additionalItems;throw new Error(`Invalid schema ${JSON.stringify(t,null,2)} for ${JSON.stringify(n,null,2)}`)}return!1!==t.additionalItems&&a?bt(a):new Error(`Invalid array schema for ${r} at ${i}`)},object:(e,r,t,n,i)=>{var a;const s=null===(a=null==(t=xe(e,t,n,i))?void 0:t.properties)||void 0===a?void 0:a[r];if(void 0!==s){if(!1===s)return e.errors.forbiddenPropertyError({property:r,value:n,pointer:i,schema:t});if(!0===s)return bt(null==n?void 0:n[r]);const o=e.resolveRef(s);if(d(o))return o;if(o&&Array.isArray(o.oneOf))return e.resolveOneOf(n[r],o,`${i}/${r}`);if(o)return o}const{patternProperties:l}=t;if("object"===o(l)){let e;const t=Object.keys(l);for(let n=0,o=t.length;ne.resolveRef(r)));if(null===(n=t.items)||void 0===n?void 0:n.oneOf)return t.items.oneOf.map((r=>e.resolveRef(r)));const o=e.step(r,t,{},"#");return d(o)?o:[o]}function Et(e,r,t=e.rootSchema,n="#"){if("boolean"===o(t=e.resolveRef(t)))return t?[]:[e.errors.invalidDataError({pointer:n,schema:t,value:r})];if(d(t))return[t];if(void 0!==t.const)return pt()(t.const,r)?[]:[e.errors.constError({pointer:n,schema:t,value:r,expected:t.const})];const i=function(e,r){const t=o(e);return"number"===t&&("integer"===r||Array.isArray(r)&&r.includes("integer"))?Number.isInteger(e)||isNaN(e)?"integer":"number":t}(r,t.type),a=t.type||i;if(!(i===a||Array.isArray(a)&&a.includes(i)))return[e.errors.typeError({pointer:n,schema:t,value:r,received:i,expected:a})];if(null==e.validateType[i])return[e.errors.invalidTypeError({pointer:n,schema:t,value:r,receivedType:i})];return f(e.validateType[i](e,t,r,n)).filter(h)}const xt={typeKeywords:{array:["allOf","anyOf","enum","items","maxItems","minItems","not","oneOf","uniqueItems"],boolean:["enum","not","allOf","anyOf","oneOf"],object:["additionalProperties","dependencies","enum","format","minProperties","maxProperties","patternProperties","properties","required","not","oneOf","allOf","anyOf"],string:["allOf","anyOf","enum","format","maxLength","minLength","not","oneOf","pattern"],number:["allOf","anyOf","enum","format","maximum","minimum","multipleOf","not","oneOf"],null:["allOf","anyOf","enum","format","not","oneOf"]},validateKeyword:vt,validateType:{array:(e,r,t,n)=>e.typeKeywords.array.filter((e=>r&&null!=r[e])).map((o=>e.validateKeyword[o](e,r,t,n))),object:(e,r,t,n)=>e.typeKeywords.object.filter((e=>r&&null!=r[e])).map((o=>e.validateKeyword[o](e,r,t,n))),string:(e,r,t,n)=>e.typeKeywords.string.filter((e=>r&&null!=r[e])).map((o=>e.validateKeyword[o](e,r,t,n))),integer:(e,r,t,n)=>e.typeKeywords.number.filter((e=>r&&null!=r[e])).map((o=>e.validateKeyword[o](e,r,t,n))),number:(e,r,t,n)=>e.typeKeywords.number.filter((e=>r&&null!=r[e])).map((o=>e.validateKeyword[o](e,r,t,n))),boolean:(e,r,t,n)=>e.typeKeywords.boolean.filter((e=>r&&null!=r[e])).map((o=>e.validateKeyword[o](e,r,t,n))),null:(e,r,t,n)=>e.typeKeywords.null.filter((e=>r&&null!=r[e])).map((o=>e.validateKeyword[o](e,r,t,n)))},validateFormat:Zr,errors:Tr,addRemoteSchema:_e,compileSchema:Lr,createSchemaOf:bt,each:kr,eachSchema:vr,getChildSchemaSelection:Ot,getSchema:Qr,getTemplate:lt,isValid:ut,resolveAllOf:ue,resolveAnyOf:ve,resolveOneOf:b,resolveRef:fe,step:$t,validate:Et,templateDefaultOptions:m.templateDefaultOptions};class Pt extends Pe{constructor(e,r={}){super(P(xt,r),e)}}const _t="__compiled",It="__ref",St=/(#|\/)+$/g;function At(e,r,t=r,n=!1){if(!0===r||!1===r||void 0===r)return r;if(void 0!==r[_t])return r;const o={ids:{},remotes:e.remotes},i=JSON.stringify(r),a=JSON.parse(i);if(Object.defineProperty(a,_t,{enumerable:!1,value:!0}),Object.defineProperty(a,"getRef",{enumerable:!1,value:Ar.bind(null,o,a)}),!1===n&&!1===i.includes("$ref"))return a;a!==t&&Object.defineProperty(a,"$defs",{enumerable:!0,value:Object.assign({},t.definitions,t.$defs,a.definitions,a.$defs)});const s={},l=()=>a;return vr(a,((e,r)=>{var t;if(e.$id){if(e.$id.startsWith("http")&&/(allOf|anyOf|oneOf)\/\d+$/.test(r)){const n=r.replace(/\/(allOf|anyOf|oneOf)\/\d+$/,""),o=(0,Ie.get)(a,n);e.$id=null!==(t=o.$id)&&void 0!==t?t:e.$id}o.ids[e.$id.replace(St,"")]=r}const n=(r=`#${r}`.replace(/##+/,"#")).replace(/\/[^/]+$/,""),i=r.replace(/\/[^/]+\/[^/]+$/,""),u=xr(s[n]||s[i],e.$id);s[r]=u,null==o.ids[u]&&(o.ids[u]=r),e.$ref&&!e[It]&&(Object.defineProperty(e,It,{enumerable:!1,value:xr(u,e.$ref)}),Object.defineProperty(e,"getRoot",{enumerable:!1,value:l}))})),a}const jt=Object.assign(Object.assign({},vt),{contains:(e,r,t,n)=>{if(!1===r.contains)return e.errors.containsArrayError({pointer:n,value:t,schema:r});if(!0===r.contains)return Array.isArray(t)&&0===t.length?e.errors.containsAnyError({pointer:n,value:t,schema:r}):void 0;if("object"===o(r.contains)){for(let n=0;n{if(!isNaN(r.exclusiveMaximum))return r.exclusiveMaximum<=t?e.errors.maximumError({maximum:r.exclusiveMaximum,length:t,pointer:n,schema:r,value:t}):void 0},exclusiveMinimum:(e,r,t,n)=>{if(!isNaN(r.exclusiveMinimum))return r.exclusiveMinimum>=t?e.errors.minimumError({minimum:r.exclusiveMinimum,length:t,pointer:n,schema:r,value:t}):void 0},if:(e,r,t,n)=>{const o=se(e,r,t);if(o)return e.validate(t,o,n)},maximum:(e,r,t,n)=>{if(!isNaN(r.maximum))return r.maximum&&r.maximum{if(!isNaN(r.minimum))return r.minimum>t?e.errors.minimumError({minimum:r.minimum,length:t,pointer:n,schema:r,value:t}):void 0},patternProperties:(e,r,t,n)=>{const i=r.properties||{},a=r.patternProperties;if("object"!==o(a))return;const s=[],l=Object.keys(t),u=Object.keys(a).map((e=>({regex:new RegExp(e),patternSchema:a[e]})));return l.forEach((o=>{let l=!1;for(let i=0,c=u.length;i0&&s.push(...c)}i[o]||!1===l&&!1===r.additionalProperties&&s.push(e.errors.patternPropertiesError({key:o,pointer:n,patterns:Object.keys(a).join(","),schema:r,value:t}))})),s},propertyNames:(e,r,t,n)=>{if(!1===r.propertyNames){if(0===Object.keys(t).length)return;return e.errors.invalidPropertyNameError({property:Object.keys(t),pointer:n,value:t,schema:r})}if(!0===r.propertyNames)return;if("object"!==o(r.propertyNames))return;const i=[],a=Object.keys(t),s=Object.assign(Object.assign({},r.propertyNames),{type:"string"});return a.forEach((o=>{const a=e.validate(o,s,`${n}/${o}`);a.length>0&&i.push(e.errors.invalidPropertyNameError({property:o,pointer:n,validationError:a[0],value:t[o],schema:r}))})),i}}),wt=jt,Rt={array:(e,r,t,n)=>e.typeKeywords.array.filter((e=>r&&null!=r[e])).map((o=>e.validateKeyword[o](e,r,t,n))),object:(e,r,t,n)=>e.typeKeywords.object.filter((e=>r&&null!=r[e])).map((o=>e.validateKeyword[o](e,r,t,n))),string:(e,r,t,n)=>e.typeKeywords.string.filter((e=>r&&null!=r[e])).map((o=>e.validateKeyword[o](e,r,t,n))),integer:(e,r,t,n)=>e.typeKeywords.number.filter((e=>r&&null!=r[e])).map((o=>e.validateKeyword[o](e,r,t,n))),number:(e,r,t,n)=>e.typeKeywords.number.filter((e=>r&&null!=r[e])).map((o=>e.validateKeyword[o](e,r,t,n))),boolean:(e,r,t,n)=>e.typeKeywords.boolean.filter((e=>r&&null!=r[e])).map((o=>e.validateKeyword[o](e,r,t,n))),null:(e,r,t,n)=>e.typeKeywords.null.filter((e=>r&&null!=r[e])).map((o=>e.validateKeyword[o](e,r,t,n)))},Lt={typeKeywords:{array:["allOf","anyOf","contains","enum","if","items","maxItems","minItems","not","oneOf","uniqueItems"],boolean:["allOf","anyOf","enum","not","oneOf"],object:["additionalProperties","allOf","anyOf","dependencies","enum","format","if","maxProperties","minProperties","not","oneOf","patternProperties","properties","propertyNames","required"],string:["allOf","anyOf","enum","format","if","maxLength","minLength","not","oneOf","pattern"],number:["enum","exclusiveMaximum","exclusiveMinimum","format","maximum","minimum","multipleOf","not","oneOf","allOf","anyOf","if"],null:["allOf","anyOf","enum","format","not","oneOf"]},validateKeyword:wt,validateType:Rt,validateFormat:Zr,errors:Tr,addRemoteSchema:_e,compileSchema:At,createSchemaOf:bt,each:kr,eachSchema:vr,getChildSchemaSelection:Ot,getSchema:Qr,getTemplate:lt,isValid:ut,resolveAllOf:ue,resolveAnyOf:ve,resolveOneOf:b,resolveRef:fe,step:$t,validate:Et,templateDefaultOptions:m.templateDefaultOptions};class kt extends Pe{constructor(e,r={}){super(P(Lt,r),e)}}const Tt={typeKeywords:{array:["allOf","anyOf","contains","enum","if","items","maxItems","minItems","not","oneOf","uniqueItems"],boolean:["allOf","anyOf","enum","not","oneOf"],object:["additionalProperties","allOf","anyOf","dependencies","enum","format","if","maxProperties","minProperties","not","oneOf","patternProperties","properties","propertyNames","required"],string:["allOf","anyOf","enum","format","if","maxLength","minLength","not","oneOf","pattern"],number:["allOf","anyOf","enum","exclusiveMaximum","exclusiveMinimum","format","if","maximum","minimum","multipleOf","not","oneOf"],null:["allOf","anyOf","enum","format","not","oneOf"]},validateKeyword:wt,validateType:Rt,validateFormat:Zr,errors:Tr,addRemoteSchema:_e,compileSchema:At,createSchemaOf:bt,each:kr,eachSchema:vr,getChildSchemaSelection:Ot,getSchema:Qr,getTemplate:lt,isValid:ut,resolveAllOf:ue,resolveAnyOf:ve,resolveOneOf:b,resolveRef:fe,step:$t,validate:Et,templateDefaultOptions:m.templateDefaultOptions};class Dt extends Pe{constructor(e,r={}){super(P(Tt,r),e)}}const Ct=Object.assign(Object.assign({},Tt),{resolveOneOf:$,resolveRef:me});class Nt extends Pe{constructor(e,r={}){super(P(Ct,r),e)}}const Ut={strings:e}})(),n})())); \ No newline at end of file +!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define("jlib",[],r):"object"==typeof exports?exports.jlib=r():e.jlib=r()}("undefined"!=typeof self?self:this,(()=>(()=>{var e={546:function(e){"undefined"!=typeof self&&self,e.exports=(()=>{"use strict";var e={d:(r,t)=>{for(var n in t)e.o(t,n)&&!e.o(r,n)&&Object.defineProperty(r,n,{enumerable:!0,get:t[n]})},o:(e,r)=>Object.prototype.hasOwnProperty.call(e,r),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},r={};function t(e){return"#"===e||""===e||Array.isArray(e)&&0===e.length||!1}e.r(r),e.d(r,{default:()=>x,get:()=>u,isRoot:()=>t,join:()=>E,remove:()=>$,removeUndefinedItems:()=>v,set:()=>d,split:()=>l,splitLast:()=>P});const n=/~1/g,o=/~0/g,i=/(^#?\/?)/g;function a(e){return e.replace(n,"/").replace(o,"~")}function s(e){return a(decodeURIComponent(e))}function l(e){if(null==e||"string"!=typeof e||t(e))return Array.isArray(e)?e:[];const r=e.indexOf("#")>=0?s:a,n=(e=e.replace(i,"")).split("/");for(let e=0,t=n.length;e0&&"prototype"==r[0]}function d(e,r,t){if(null==r)return e;const n=l(r);if(0===n.length)return e;null==e&&(e=c.test(n[0])?[]:{});let o,i,a=e;for(;n.length>1;)o=n.shift(),i=c.test(n[0]),p(o,n)||(a=y(a,o,i));return o=n.pop(),h(a,o,t),e}function h(e,r,t){let n;const o=r.match(m);"[]"===r&&Array.isArray(e)?e.push(t):o?(n=o.pop(),e[n]=t):e[r]=t}function y(e,r,t){if(null!=e[r])return e[r];const n=t?[]:{};return h(e,r,n),n}function v(e){let r=0,t=0;for(;r+t{"use strict";var r=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var r=Object.prototype.toString.call(e);return"[object RegExp]"===r||"[object Date]"===r||function(e){return e.$$typeof===t}(e)}(e)};var t="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function n(e,r){return!1!==r.clone&&r.isMergeableObject(e)?l((t=e,Array.isArray(t)?[]:{}),e,r):e;var t}function o(e,r,t){return e.concat(r).map((function(e){return n(e,t)}))}function i(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter((function(r){return Object.propertyIsEnumerable.call(e,r)})):[]}(e))}function a(e,r){try{return r in e}catch(e){return!1}}function s(e,r,t){var o={};return t.isMergeableObject(e)&&i(e).forEach((function(r){o[r]=n(e[r],t)})),i(r).forEach((function(i){(function(e,r){return a(e,r)&&!(Object.hasOwnProperty.call(e,r)&&Object.propertyIsEnumerable.call(e,r))})(e,i)||(a(e,i)&&t.isMergeableObject(r[i])?o[i]=function(e,r){if(!r.customMerge)return l;var t=r.customMerge(e);return"function"==typeof t?t:l}(i,t)(e[i],r[i],t):o[i]=n(r[i],t))})),o}function l(e,t,i){(i=i||{}).arrayMerge=i.arrayMerge||o,i.isMergeableObject=i.isMergeableObject||r,i.cloneUnlessOtherwiseSpecified=n;var a=Array.isArray(t);return a===Array.isArray(e)?a?i.arrayMerge(e,t,i):s(e,t,i):n(t,i)}l.all=function(e,r){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce((function(e,t){return l(e,t,r)}),{})};var u=l;e.exports=u},17:e=>{"use strict";e.exports=function e(r,t){if(r===t)return!0;if(r&&t&&"object"==typeof r&&"object"==typeof t){if(r.constructor!==t.constructor)return!1;var n,o,i;if(Array.isArray(r)){if((n=r.length)!=t.length)return!1;for(o=n;0!=o--;)if(!e(r[o],t[o]))return!1;return!0}if(r.constructor===RegExp)return r.source===t.source&&r.flags===t.flags;if(r.valueOf!==Object.prototype.valueOf)return r.valueOf()===t.valueOf();if(r.toString!==Object.prototype.toString)return r.toString()===t.toString();if((n=(i=Object.keys(r)).length)!==Object.keys(t).length)return!1;for(o=n;0!=o--;)if(!Object.prototype.hasOwnProperty.call(t,i[o]))return!1;for(o=n;0!=o--;){var a=i[o];if(!e(r[a],t[a]))return!1}return!0}return r!=r&&t!=t}},515:function(e){var r,t;r=this,t=function(){function e(r,t,n){return this.id=++e.highestId,this.name=r,this.symbols=t,this.postprocess=n,this}function r(e,r,t,n){this.rule=e,this.dot=r,this.reference=t,this.data=[],this.wantedBy=n,this.isComplete=this.dot===e.symbols.length}function t(e,r){this.grammar=e,this.index=r,this.states=[],this.wants={},this.scannable=[],this.completed={}}function n(e,r){this.rules=e,this.start=r||this.rules[0].name;var t=this.byName={};this.rules.forEach((function(e){t.hasOwnProperty(e.name)||(t[e.name]=[]),t[e.name].push(e)}))}function o(){this.reset("")}function i(e,r,i){if(e instanceof n){var a=e;i=r}else a=n.fromCompiled(e,r);for(var s in this.grammar=a,this.options={keepHistory:!1,lexer:a.lexer||new o},i||{})this.options[s]=i[s];this.lexer=this.options.lexer,this.lexerState=void 0;var l=new t(a,0);this.table=[l],l.wants[a.start]=[],l.predict(a.start),l.process(),this.current=0}function a(e){var r=typeof e;if("string"===r)return e;if("object"===r){if(e.literal)return JSON.stringify(e.literal);if(e instanceof RegExp)return e.toString();if(e.type)return"%"+e.type;if(e.test)return"<"+String(e.test)+">";throw new Error("Unknown symbol type: "+e)}}return e.highestId=0,e.prototype.toString=function(e){var r=void 0===e?this.symbols.map(a).join(" "):this.symbols.slice(0,e).map(a).join(" ")+" ● "+this.symbols.slice(e).map(a).join(" ");return this.name+" → "+r},r.prototype.toString=function(){return"{"+this.rule.toString(this.dot)+"}, from: "+(this.reference||0)},r.prototype.nextState=function(e){var t=new r(this.rule,this.dot+1,this.reference,this.wantedBy);return t.left=this,t.right=e,t.isComplete&&(t.data=t.build(),t.right=void 0),t},r.prototype.build=function(){var e=[],r=this;do{e.push(r.right.data),r=r.left}while(r.left);return e.reverse(),e},r.prototype.finish=function(){this.rule.postprocess&&(this.data=this.rule.postprocess(this.data,this.reference,i.fail))},t.prototype.process=function(e){for(var r=this.states,t=this.wants,n=this.completed,o=0;o0&&r.push(" ^ "+n+" more lines identical to this"),n=0,r.push(" "+a)),t=a}},i.prototype.getSymbolDisplay=function(e){return function(e){var r=typeof e;if("string"===r)return e;if("object"===r){if(e.literal)return JSON.stringify(e.literal);if(e instanceof RegExp)return"character matching "+e;if(e.type)return e.type+" token";if(e.test)return"token matching "+String(e.test);throw new Error("Unknown symbol type: "+e)}}(e)},i.prototype.buildFirstStateStack=function(e,r){if(-1!==r.indexOf(e))return null;if(0===e.wantedBy.length)return[e];var t=e.wantedBy[0],n=[e].concat(r),o=this.buildFirstStateStack(t,n);return null===o?null:[e].concat(o)},i.prototype.save=function(){var e=this.table[this.current];return e.lexerState=this.lexerState,e},i.prototype.restore=function(e){var r=e.index;this.current=r,this.table[r]=e,this.table.splice(r+1),this.lexerState=e.lexerState,this.results=this.finish()},i.prototype.rewind=function(e){if(!this.options.keepHistory)throw new Error("set option `keepHistory` to enable rewinding");this.restore(this.table[e])},i.prototype.finish=function(){var e=[],r=this.grammar.start;return this.table[this.table.length-1].states.forEach((function(t){t.rule.name===r&&t.dot===t.rule.symbols.length&&0===t.reference&&t.data!==i.fail&&e.push(t)})),e.map((function(e){return e.data}))},{Parser:i,Grammar:n,Rule:e}},e.exports?e.exports=t():r.nearley=t()},84:(e,r)=>{"use strict";function t(e){return e[0]}Object.defineProperty(r,"__esModule",{value:!0});const n=e=>[].concat(...e.map((e=>Array.isArray(e)?n(e):e)));function o(e){return e?Array.isArray(e)?n(e).join(""):e:""}const i={Lexer:void 0,ParserRules:[{name:"Reverse_path",symbols:["Path"]},{name:"Reverse_path$string$1",symbols:[{literal:"<"},{literal:">"}],postprocess:e=>e.join("")},{name:"Reverse_path",symbols:["Reverse_path$string$1"]},{name:"Forward_path$subexpression$1$subexpression$1",symbols:[{literal:"<"},/[pP]/,/[oO]/,/[sS]/,/[tT]/,/[mM]/,/[aA]/,/[sS]/,/[tT]/,/[eE]/,/[rR]/,{literal:"@"}],postprocess:function(e){return e.join("")}},{name:"Forward_path$subexpression$1",symbols:["Forward_path$subexpression$1$subexpression$1","Domain",{literal:">"}]},{name:"Forward_path",symbols:["Forward_path$subexpression$1"]},{name:"Forward_path$subexpression$2",symbols:[{literal:"<"},/[pP]/,/[oO]/,/[sS]/,/[tT]/,/[mM]/,/[aA]/,/[sS]/,/[tT]/,/[eE]/,/[rR]/,{literal:">"}],postprocess:function(e){return e.join("")}},{name:"Forward_path",symbols:["Forward_path$subexpression$2"]},{name:"Forward_path",symbols:["Path"]},{name:"Path$ebnf$1$subexpression$1",symbols:["A_d_l",{literal:":"}]},{name:"Path$ebnf$1",symbols:["Path$ebnf$1$subexpression$1"],postprocess:t},{name:"Path$ebnf$1",symbols:[],postprocess:()=>null},{name:"Path",symbols:[{literal:"<"},"Path$ebnf$1","Mailbox",{literal:">"}]},{name:"A_d_l$ebnf$1",symbols:[]},{name:"A_d_l$ebnf$1$subexpression$1",symbols:[{literal:","},"At_domain"]},{name:"A_d_l$ebnf$1",symbols:["A_d_l$ebnf$1","A_d_l$ebnf$1$subexpression$1"],postprocess:e=>e[0].concat([e[1]])},{name:"A_d_l",symbols:["At_domain","A_d_l$ebnf$1"]},{name:"At_domain",symbols:[{literal:"@"},"Domain"]},{name:"Domain$ebnf$1",symbols:[]},{name:"Domain$ebnf$1$subexpression$1",symbols:[{literal:"."},"sub_domain"]},{name:"Domain$ebnf$1",symbols:["Domain$ebnf$1","Domain$ebnf$1$subexpression$1"],postprocess:e=>e[0].concat([e[1]])},{name:"Domain",symbols:["sub_domain","Domain$ebnf$1"]},{name:"sub_domain",symbols:["U_label"]},{name:"Let_dig",symbols:["ALPHA_DIGIT"],postprocess:t},{name:"Ldh_str$ebnf$1",symbols:[]},{name:"Ldh_str$ebnf$1",symbols:["Ldh_str$ebnf$1","ALPHA_DIG_DASH"],postprocess:e=>e[0].concat([e[1]])},{name:"Ldh_str",symbols:["Ldh_str$ebnf$1","Let_dig"]},{name:"U_Let_dig",symbols:["ALPHA_DIGIT_U"],postprocess:t},{name:"U_Ldh_str$ebnf$1",symbols:[]},{name:"U_Ldh_str$ebnf$1",symbols:["U_Ldh_str$ebnf$1","ALPHA_DIG_DASH_U"],postprocess:e=>e[0].concat([e[1]])},{name:"U_Ldh_str",symbols:["U_Ldh_str$ebnf$1","U_Let_dig"]},{name:"U_label$ebnf$1$subexpression$1",symbols:["U_Ldh_str"]},{name:"U_label$ebnf$1",symbols:["U_label$ebnf$1$subexpression$1"],postprocess:t},{name:"U_label$ebnf$1",symbols:[],postprocess:()=>null},{name:"U_label",symbols:["U_Let_dig","U_label$ebnf$1"]},{name:"address_literal$subexpression$1",symbols:["IPv4_address_literal"]},{name:"address_literal$subexpression$1",symbols:["IPv6_address_literal"]},{name:"address_literal$subexpression$1",symbols:["General_address_literal"]},{name:"address_literal",symbols:[{literal:"["},"address_literal$subexpression$1",{literal:"]"}]},{name:"non_local_part",symbols:["Domain"],postprocess:function(e){return{DomainName:o(e[0])}}},{name:"non_local_part",symbols:["address_literal"],postprocess:function(e){return{AddressLiteral:o(e[0])}}},{name:"Mailbox",symbols:["Local_part",{literal:"@"},"non_local_part"],postprocess:function(e){return{localPart:o(e[0]),domainPart:o(e[2])}}},{name:"Local_part",symbols:["Dot_string"],postprocess:function(e){return{DotString:o(e[0])}}},{name:"Local_part",symbols:["Quoted_string"],postprocess:function(e){return{QuotedString:o(e[0])}}},{name:"Dot_string$ebnf$1",symbols:[]},{name:"Dot_string$ebnf$1$subexpression$1",symbols:[{literal:"."},"Atom"]},{name:"Dot_string$ebnf$1",symbols:["Dot_string$ebnf$1","Dot_string$ebnf$1$subexpression$1"],postprocess:e=>e[0].concat([e[1]])},{name:"Dot_string",symbols:["Atom","Dot_string$ebnf$1"]},{name:"Atom$ebnf$1",symbols:[/[0-9A-Za-z!#$%&'*+\-/=?^_`{|}~\u0080-\uFFFF/]/]},{name:"Atom$ebnf$1",symbols:["Atom$ebnf$1",/[0-9A-Za-z!#$%&'*+\-/=?^_`{|}~\u0080-\uFFFF/]/],postprocess:e=>e[0].concat([e[1]])},{name:"Atom",symbols:["Atom$ebnf$1"]},{name:"Quoted_string$ebnf$1",symbols:[]},{name:"Quoted_string$ebnf$1",symbols:["Quoted_string$ebnf$1","QcontentSMTP"],postprocess:e=>e[0].concat([e[1]])},{name:"Quoted_string",symbols:["DQUOTE","Quoted_string$ebnf$1","DQUOTE"]},{name:"QcontentSMTP",symbols:["qtextSMTP"]},{name:"QcontentSMTP",symbols:["quoted_pairSMTP"]},{name:"quoted_pairSMTP",symbols:[{literal:"\\"},/[\x20-\x7e]/]},{name:"qtextSMTP",symbols:[/[\x20-\x21\x23-\x5b\x5d-\x7e\u0080-\uFFFF]/],postprocess:t},{name:"IPv4_address_literal$macrocall$2",symbols:[{literal:"."},"Snum"]},{name:"IPv4_address_literal$macrocall$1",symbols:["IPv4_address_literal$macrocall$2","IPv4_address_literal$macrocall$2","IPv4_address_literal$macrocall$2"]},{name:"IPv4_address_literal",symbols:["Snum","IPv4_address_literal$macrocall$1"]},{name:"IPv6_address_literal$subexpression$1",symbols:[/[iI]/,/[pP]/,/[vV]/,{literal:"6"},{literal:":"}],postprocess:function(e){return e.join("")}},{name:"IPv6_address_literal",symbols:["IPv6_address_literal$subexpression$1","IPv6_addr"]},{name:"General_address_literal$ebnf$1",symbols:["dcontent"]},{name:"General_address_literal$ebnf$1",symbols:["General_address_literal$ebnf$1","dcontent"],postprocess:e=>e[0].concat([e[1]])},{name:"General_address_literal",symbols:["Standardized_tag",{literal:":"},"General_address_literal$ebnf$1"]},{name:"Standardized_tag",symbols:["Ldh_str"]},{name:"dcontent",symbols:[/[\x21-\x5a\x5e-\x7e]/],postprocess:t},{name:"Snum",symbols:["DIGIT"]},{name:"Snum$subexpression$1",symbols:[/[1-9]/,"DIGIT"]},{name:"Snum",symbols:["Snum$subexpression$1"]},{name:"Snum$subexpression$2",symbols:[{literal:"1"},"DIGIT","DIGIT"]},{name:"Snum",symbols:["Snum$subexpression$2"]},{name:"Snum$subexpression$3",symbols:[{literal:"2"},/[0-4]/,"DIGIT"]},{name:"Snum",symbols:["Snum$subexpression$3"]},{name:"Snum$subexpression$4",symbols:[{literal:"2"},{literal:"5"},/[0-5]/]},{name:"Snum",symbols:["Snum$subexpression$4"]},{name:"IPv6_addr",symbols:["IPv6_full"]},{name:"IPv6_addr",symbols:["IPv6_comp"]},{name:"IPv6_addr",symbols:["IPv6v4_full"]},{name:"IPv6_addr",symbols:["IPv6v4_comp"]},{name:"IPv6_hex",symbols:["HEXDIG"]},{name:"IPv6_hex$subexpression$1",symbols:["HEXDIG","HEXDIG"]},{name:"IPv6_hex",symbols:["IPv6_hex$subexpression$1"]},{name:"IPv6_hex$subexpression$2",symbols:["HEXDIG","HEXDIG","HEXDIG"]},{name:"IPv6_hex",symbols:["IPv6_hex$subexpression$2"]},{name:"IPv6_hex$subexpression$3",symbols:["HEXDIG","HEXDIG","HEXDIG","HEXDIG"]},{name:"IPv6_hex",symbols:["IPv6_hex$subexpression$3"]},{name:"IPv6_full$macrocall$2",symbols:[{literal:":"},"IPv6_hex"]},{name:"IPv6_full$macrocall$1",symbols:["IPv6_full$macrocall$2","IPv6_full$macrocall$2","IPv6_full$macrocall$2","IPv6_full$macrocall$2","IPv6_full$macrocall$2","IPv6_full$macrocall$2","IPv6_full$macrocall$2"]},{name:"IPv6_full",symbols:["IPv6_hex","IPv6_full$macrocall$1"]},{name:"IPv6_comp$ebnf$1$subexpression$1$macrocall$2",symbols:[{literal:":"},"IPv6_hex"]},{name:"IPv6_comp$ebnf$1$subexpression$1$macrocall$1",symbols:["IPv6_comp$ebnf$1$subexpression$1$macrocall$2","IPv6_comp$ebnf$1$subexpression$1$macrocall$2","IPv6_comp$ebnf$1$subexpression$1$macrocall$2","IPv6_comp$ebnf$1$subexpression$1$macrocall$2","IPv6_comp$ebnf$1$subexpression$1$macrocall$2"]},{name:"IPv6_comp$ebnf$1$subexpression$1",symbols:["IPv6_hex","IPv6_comp$ebnf$1$subexpression$1$macrocall$1"]},{name:"IPv6_comp$ebnf$1",symbols:["IPv6_comp$ebnf$1$subexpression$1"],postprocess:t},{name:"IPv6_comp$ebnf$1",symbols:[],postprocess:()=>null},{name:"IPv6_comp$string$1",symbols:[{literal:":"},{literal:":"}],postprocess:e=>e.join("")},{name:"IPv6_comp$ebnf$2$subexpression$1$macrocall$2",symbols:[{literal:":"},"IPv6_hex"]},{name:"IPv6_comp$ebnf$2$subexpression$1$macrocall$1",symbols:["IPv6_comp$ebnf$2$subexpression$1$macrocall$2","IPv6_comp$ebnf$2$subexpression$1$macrocall$2","IPv6_comp$ebnf$2$subexpression$1$macrocall$2","IPv6_comp$ebnf$2$subexpression$1$macrocall$2","IPv6_comp$ebnf$2$subexpression$1$macrocall$2"]},{name:"IPv6_comp$ebnf$2$subexpression$1",symbols:["IPv6_hex","IPv6_comp$ebnf$2$subexpression$1$macrocall$1"]},{name:"IPv6_comp$ebnf$2",symbols:["IPv6_comp$ebnf$2$subexpression$1"],postprocess:t},{name:"IPv6_comp$ebnf$2",symbols:[],postprocess:()=>null},{name:"IPv6_comp",symbols:["IPv6_comp$ebnf$1","IPv6_comp$string$1","IPv6_comp$ebnf$2"]},{name:"IPv6v4_full$macrocall$2",symbols:[{literal:":"},"IPv6_hex"]},{name:"IPv6v4_full$macrocall$1",symbols:["IPv6v4_full$macrocall$2","IPv6v4_full$macrocall$2","IPv6v4_full$macrocall$2","IPv6v4_full$macrocall$2","IPv6v4_full$macrocall$2"]},{name:"IPv6v4_full",symbols:["IPv6_hex","IPv6v4_full$macrocall$1",{literal:":"},"IPv4_address_literal"]},{name:"IPv6v4_comp$ebnf$1$subexpression$1$macrocall$2",symbols:[{literal:":"},"IPv6_hex"]},{name:"IPv6v4_comp$ebnf$1$subexpression$1$macrocall$1",symbols:["IPv6v4_comp$ebnf$1$subexpression$1$macrocall$2","IPv6v4_comp$ebnf$1$subexpression$1$macrocall$2","IPv6v4_comp$ebnf$1$subexpression$1$macrocall$2"]},{name:"IPv6v4_comp$ebnf$1$subexpression$1",symbols:["IPv6_hex","IPv6v4_comp$ebnf$1$subexpression$1$macrocall$1"]},{name:"IPv6v4_comp$ebnf$1",symbols:["IPv6v4_comp$ebnf$1$subexpression$1"],postprocess:t},{name:"IPv6v4_comp$ebnf$1",symbols:[],postprocess:()=>null},{name:"IPv6v4_comp$string$1",symbols:[{literal:":"},{literal:":"}],postprocess:e=>e.join("")},{name:"IPv6v4_comp$ebnf$2$subexpression$1$macrocall$2",symbols:[{literal:":"},"IPv6_hex"]},{name:"IPv6v4_comp$ebnf$2$subexpression$1$macrocall$1",symbols:["IPv6v4_comp$ebnf$2$subexpression$1$macrocall$2","IPv6v4_comp$ebnf$2$subexpression$1$macrocall$2","IPv6v4_comp$ebnf$2$subexpression$1$macrocall$2"]},{name:"IPv6v4_comp$ebnf$2$subexpression$1",symbols:["IPv6_hex","IPv6v4_comp$ebnf$2$subexpression$1$macrocall$1",{literal:":"}]},{name:"IPv6v4_comp$ebnf$2",symbols:["IPv6v4_comp$ebnf$2$subexpression$1"],postprocess:t},{name:"IPv6v4_comp$ebnf$2",symbols:[],postprocess:()=>null},{name:"IPv6v4_comp",symbols:["IPv6v4_comp$ebnf$1","IPv6v4_comp$string$1","IPv6v4_comp$ebnf$2","IPv4_address_literal"]},{name:"DIGIT",symbols:[/[0-9]/],postprocess:t},{name:"ALPHA_DIGIT_U",symbols:[/[0-9A-Za-z\u0080-\uFFFF]/],postprocess:t},{name:"ALPHA_DIGIT",symbols:[/[0-9A-Za-z]/],postprocess:t},{name:"ALPHA_DIG_DASH",symbols:[/[-0-9A-Za-z]/],postprocess:t},{name:"ALPHA_DIG_DASH_U",symbols:[/[-0-9A-Za-z\u0080-\uFFFF]/],postprocess:t},{name:"HEXDIG",symbols:[/[0-9A-Fa-f]/],postprocess:t},{name:"DQUOTE",symbols:[{literal:'"'}],postprocess:t}],ParserStart:"Reverse_path"};r.default=i},125:function(e,r,t){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(r,"__esModule",{value:!0}),r.canonicalize=r.canonicalize_quoted_string=r.normalize=r.normalize_dot_string=r.parse=void 0;const o=t(515),i=n(t(84));i.default.ParserStart="Mailbox";const a=o.Grammar.fromCompiled(i.default);function s(e){const r=new o.Parser(a);if(r.feed(e),1!==r.results.length)throw new Error("address parsing failed: ambiguous grammar");return r.results[0]}function l(e){return function(){const r=e.indexOf("+");return-1===r?e:e.substr(0,r)}().replace(/\./g,"").toLowerCase()}function u(e){return`"${e.substr(1).substr(0,e.length-2).replace(/(?:\\(.))/g,"$1").replace(/(?:(["\\]))/g,"\\$1")}"`}r.parse=s,r.normalize_dot_string=l,r.normalize=function(e){var r,t;const n=s(e),o=null!==(r=n.domainPart.AddressLiteral)&&void 0!==r?r:n.domainPart.DomainName.toLowerCase();return`${null!==(t=n.localPart.QuotedString)&&void 0!==t?t:l(n.localPart.DotString)}@${o}`},r.canonicalize_quoted_string=u,r.canonicalize=function(e){var r;const t=s(e),n=null!==(r=t.domainPart.AddressLiteral)&&void 0!==r?r:t.domainPart.DomainName.toLowerCase();return`${t.localPart.QuotedString?u(t.localPart.QuotedString):t.localPart.DotString}@${n}`}},853:(e,r,t)=>{!function(e){"use strict";e.exports.is_uri=t,e.exports.is_http_uri=n,e.exports.is_https_uri=o,e.exports.is_web_uri=i,e.exports.isUri=t,e.exports.isHttpUri=n,e.exports.isHttpsUri=o,e.exports.isWebUri=i;var r=function(e){return e.match(/(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/)};function t(e){if(e&&!/[^a-z0-9\:\/\?\#\[\]\@\!\$\&\'\(\)\*\+\,\;\=\.\-\_\~\%]/i.test(e)&&!/%[^0-9a-f]/i.test(e)&&!/%[0-9a-f](:?[^0-9a-f]|$)/i.test(e)){var t,n,o,i,a,s="",l="";if(s=(t=r(e))[1],n=t[2],o=t[3],i=t[4],a=t[5],s&&s.length&&o.length>=0){if(n&&n.length){if(0!==o.length&&!/^\//.test(o))return}else if(/^\/\//.test(o))return;if(/^[a-z][a-z0-9\+\-\.]*$/.test(s.toLowerCase()))return l+=s+":",n&&n.length&&(l+="//"+n),l+=o,i&&i.length&&(l+="?"+i),a&&a.length&&(l+="#"+a),l}}}function n(e,n){if(t(e)){var o,i,a,s,l="",u="",f="",c="";if(l=(o=r(e))[1],u=o[2],i=o[3],a=o[4],s=o[5],l){if(n){if("https"!=l.toLowerCase())return}else if("http"!=l.toLowerCase())return;if(u)return/:(\d+)$/.test(u)&&(f=u.match(/:(\d+)$/)[0],u=u.replace(/:\d+$/,"")),c+=l+":",c+="//"+u,f&&(c+=f),c+=i,a&&a.length&&(c+="?"+a),s&&s.length&&(c+="#"+s),c}}}function o(e){return n(e,!0)}function i(e){return n(e)||o(e)}}(e=t.nmd(e))}},r={};function t(n){var o=r[n];if(void 0!==o)return o.exports;var i=r[n]={id:n,loaded:!1,exports:{}};return e[n].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}t.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return t.d(r,{a:r}),r},t.d=(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},t.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),t.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var n={};return(()=>{"use strict";t.r(n),t.d(n,{Draft:()=>Pe,Draft04:()=>Nr,Draft06:()=>Jr,Draft07:()=>Zr,Draft2019:()=>Yr,JsonEditor:()=>rt,config:()=>tt,createCustomError:()=>f,createError:()=>u,draft04Config:()=>Tr,draft06Config:()=>Hr,draft07Config:()=>Br,draft2019Config:()=>Xr,draftJsonEditorConfig:()=>et,getTypeOf:()=>o,isDynamicSchema:()=>be,isJsonError:()=>d,mergeSchema:()=>I,reduceSchema:()=>Ee,render:()=>s,resolveAllOf:()=>ue,resolveDynamicSchema:()=>ge,resolveOneOf:()=>$,resolveOneOfFuzzy:()=>g,resolveRef:()=>ce,resolveRefMerge:()=>me,settings:()=>m,validateAsync:()=>pe});const e={AdditionalItemsError:"Array at `{{pointer}}` may not have an additional item `{{key}}`",AdditionalPropertiesError:"Additional property `{{property}}` on `{{pointer}}` does not match schema `{{schema}}`",AllOfError:"Value `{{value}}` at `{{pointer}}` does not match schema of `{{allOf}}`",AnyOfError:"Value `{{value}}` at `{{pointer}}` does not match any schema of `{{anyOf}}`",ConstError:"Expected value at `{{pointer}}` to be `{{expected}}`, but value given is `{{value}}`",containsAnyError:"The array at `{{pointer}}` must contain at least one item",ContainsArrayError:"The property at `{{pointer}}` must not be an array",ContainsError:"The array at `{{pointer}}` must contain an element that matches `{{schema}}`",ContainsMinError:"The array at `{{pointer}}` contains {{delta}} too few items matching `{{schema}}`",ContainsMaxError:"The array at `{{pointer}}` contains {{delta}} too many items matching `{{schema}}`",EnumError:"Expected given value `{{value}}` in `{{pointer}}` to be one of `{{values}}`",ForbiddenPropertyError:"Property name `{{property}}` at `{{pointer}}` is not allowed",FormatDateError:"Value `{{value}}` at `{{pointer}}` is not a valid date",FormatDateTimeError:"Value `{{value}}` at `{{pointer}}` is not a valid date-time",FormatEmailError:"Value `{{value}}` at `{{pointer}}` is not a valid email",FormatHostnameError:"Value `{{value}}` at `{{pointer}}` is not a valid hostname",FormatIPV4Error:"Value `{{value}}` at `{{pointer}}` is not a valid IPv4 address",FormatIPV4LeadingZeroError:"IPv4 addresses starting with zero are invalid, since they are interpreted as octals",FormatIPV6Error:"Value `{{value}}` at `{{pointer}}` is not a valid IPv6 address",FormatIPV6LeadingZeroError:"IPv6 addresses starting with zero are invalid, since they are interpreted as octals",FormatJsonPointerError:"Value `{{value}}` at `{{pointer}}` is not a valid json-pointer",FormatRegExError:"Value `{{value}}` at `{{pointer}}` is not a valid regular expression",FormatTimeError:"Value `{{value}}` at `{{pointer}}` is not a valid time",FormatURIError:"Value `{{value}}` at `{{pointer}}` is not a valid uri",FormatURIReferenceError:"Value `{{value}}` at `{{pointer}}` is not a valid uri-reference",FormatURITemplateError:"Value `{{value}}` at `{{pointer}}` is not a valid uri-template",FormatURLError:"Value `{{value}}` at `{{pointer}}` is not a valid url",InvalidDataError:"No value may be specified in `{{pointer}}`",InvalidPropertyNameError:"Invalid property name `{{property}}` at `{{pointer}}`",MaximumError:"Value in `{{pointer}}` is `{{length}}`, but should be `{{maximum}}` at maximum",MaxItemsError:"Too many items in `{{pointer}}`, should be `{{maximum}}` at most, but got `{{length}}`",MaxLengthError:"Value `{{pointer}}` should have a maximum length of `{{maxLength}}`, but got `{{length}}`.",MaxPropertiesError:"Too many properties in `{{pointer}}`, should be `{{maximum}}` at most, but got `{{length}}`",MinimumError:"Value in `{{pointer}}` is `{{length}}`, but should be `{{minimum}}` at minimum",MinItemsError:"Too few items in `{{pointer}}`, should be at least `{{minItems}}`, but got `{{length}}`",MinItemsOneError:"At least one item is required in `{{pointer}}`",MinLengthError:"Value `{{pointer}}` should have a minimum length of `{{minLength}}`, but got `{{length}}`.",MinLengthOneError:"A value is required in `{{pointer}}`",MinPropertiesError:"Too few properties in `{{pointer}}`, should be at least `{{minimum}}`, but got `{{length}}`",MissingDependencyError:"The required propery '{{missingProperty}}' in `{{pointer}}` is missing",MissingOneOfPropertyError:"Value at `{{pointer}}` property: `{{property}}`",MultipleOfError:"Expected `{{value}}` in `{{pointer}}` to be multiple of `{{multipleOf}}`",MultipleOneOfError:"Value `{{value}}` should not match multiple schemas in oneOf `{{matches}}`",NoAdditionalPropertiesError:"Additional property `{{property}}` in `{{pointer}}` is not allowed",NotError:"Value `{{value}}` at pointer should not match schema `{{not}}`",OneOfError:"Value `{{value}}` in `{{pointer}}` does not match any given oneof schema",OneOfPropertyError:"Failed finding a matching oneOfProperty schema in `{{pointer}}` where `{{property}}` matches `{{value}}`",PatternError:"Value in `{{pointer}}` should match `{{description}}`, but received `{{received}}`",PatternPropertiesError:"Property `{{key}}` does not match any patterns in `{{pointer}}`. Valid patterns are: {{patterns}}",RequiredPropertyError:"The required property `{{key}}` is missing at `{{pointer}}`",SchemaWarning:"Failed retrieving a schema from '{{pointer}}' to key '{{key}}'",TypeError:"Expected `{{value}}` ({{received}}) in `{{pointer}}` to be of type `{{expected}}`",UndefinedValueError:"Value must not be undefined in `{{pointer}}`",UnevaluatedPropertyError:"Invalid unevaluated property `{{pointer}}`",UnevaluatedItemsError:"Invalid unevaluated item `{{pointer}}`",UniqueItemsError:"Items in array must be unique. Value `{{value}}` in `{{pointer}}` is a duplicate of {{duplicatePointer}}.",UnknownPropertyError:"Could not find a valid schema for property `{{pointer}}` within object",ValueNotEmptyError:"A value for `{{property}}` is required at `{{pointer}}`"},r=Object.prototype.toString;function o(e){const t=r.call(e).match(/\s([^\]]+)\]/).pop().toLowerCase();return"file"===t?"object":t}const i="object",a="array";function s(e,r={}){return e.replace(/\{\{\w+\}\}/g,(e=>{const t=e.replace(/[{}]/g,""),n=r[t],s=o(n);return s===i||s===a?JSON.stringify(n):n}))}function l(r,t,n=r){var o;return s(null!==(o=e[r])&&void 0!==o?o:n,t)}function u(e,r){return{type:"error",name:e,code:(t=e,t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()),message:l(e,r),data:r};var t}function f(e){return u.bind(null,e)}function c(e,r=[]){for(let t=0;t({index:t,schema:e})}),n}function d(e){return"error"===(null==e?void 0:e.type)}function h(e){return d(e)||e instanceof Promise}function y(e){return d(e)}const{DECLARATOR_ONEOF:v}=m;function $(e,r,t=e.rootSchema,n="#"){if(null!=r&&t[v]){const o=[],i=t[v],a=r[t[v]];if(void 0===a)return e.errors.missingOneOfPropertyError({property:i,pointer:n,schema:t,value:r});for(let s=0;s0))return p(t,l,s);o.push(...f)}return e.errors.oneOfPropertyError({property:i,value:a,pointer:n,schema:t,errors:o})}const o=[],i=[];for(let a=0;a0?i.push(...l):o.push({index:a,schema:s})}return 1===o.length?p(t,o[0].schema,o[0].index):o.length>1?e.errors.multipleOneOfError({value:r,pointer:n,schema:t,matches:o}):e.errors.oneOfError({value:JSON.stringify(r),pointer:n,schema:t,oneOf:t.oneOf,errors:i})}function b(e,r,t,n){if(null==t||null==r.properties)return-1;let o=0;const i=Object.keys(r.properties);for(let a=0;a0))return p(t,l,s);o.push(...f)}return e.errors.oneOfPropertyError({property:i,value:a,pointer:n,schema:t,errors:o})}const i=[];for(let o=0;o1?e.errors.multipleOneOfError({matches:i,pointer:n,schema:t,value:r}):e.errors.oneOfError({value:JSON.stringify(r),pointer:n,schema:t,oneOf:t.oneOf})}var O=t(744),E=t.n(O);const P=(e,r)=>r,x=(e,r)=>E()(e,r,{arrayMerge:P});function _(e){return"object"===o(e)}function I(e,r){if("error"===(null==r?void 0:r.type))return r;if("error"===(null==e?void 0:e.type))return e;if(o(e)!==o(r))return e;const t=A(e,r);return _(t)?((null==e?void 0:e.getOneOfOrigin)?Object.defineProperty(t,"getOneOfOrigin",{enumerable:!1,value:e.getOneOfOrigin}):(null==r?void 0:r.getOneOfOrigin)&&Object.defineProperty(t,"getOneOfOrigin",{enumerable:!1,value:r.getOneOfOrigin}),t):t}function A(e,r,t){var n;if(_(e)&&_(r)){const t={};return[...Object.keys(e),...Object.keys(r)].filter(((e,r,t)=>t.indexOf(e)===r)).forEach((n=>t[n]=A(e[n],r[n],n))),t}if(Array.isArray(e)&&Array.isArray(r)){if("required"===t)return e.concat(r).filter(((e,r,t)=>t.indexOf(e)===r));if("items"===t){const t=[];for(let o=0;ot.indexOf(e)===r))}return Array.isArray(r)?r:Array.isArray(e)?e:void 0!==r?r:e}function S(e,...r){const t={};return Object.keys(e).forEach((n=>{r.includes(n)||(t[n]=e[n])})),e.getOneOfOrigin&&Object.defineProperty(t,"getOneOfOrigin",{enumerable:!1,value:e.getOneOfOrigin}),t}var j=Function.prototype.toString,w=Object.create,R=Object.prototype.toString,D=function(){function e(){this._keys=[],this._values=[]}return e.prototype.has=function(e){return!!~this._keys.indexOf(e)},e.prototype.get=function(e){return this._values[this._keys.indexOf(e)]},e.prototype.set=function(e,r){this._keys.push(e),this._values.push(r)},e}();var L="undefined"!=typeof WeakMap?function(){return new WeakMap}:function(){return new D};function M(e){if(!e)return w(null);var r=e.constructor;if(r===Object)return e===Object.prototype?{}:w(e);if(r&&~j.call(r).indexOf("[native code]"))try{return new r}catch(e){}return w(e)}var k="g"===/test/g.flags?function(e){return e.flags}:function(e){var r="";return e.global&&(r+="g"),e.ignoreCase&&(r+="i"),e.multiline&&(r+="m"),e.unicode&&(r+="u"),e.sticky&&(r+="y"),r};function T(e){var r=R.call(e);return r.substring(8,r.length-1)}var N="undefined"!=typeof Symbol?function(e){return e[Symbol.toStringTag]||T(e)}:T,F=Object.defineProperty,U=Object.getOwnPropertyDescriptor,C=Object.getOwnPropertyNames,V=Object.getOwnPropertySymbols,z=Object.prototype,q=z.hasOwnProperty,K=z.propertyIsEnumerable,G="function"==typeof V;var H=G?function(e){return C(e).concat(V(e))}:C;function J(e,r,t){for(var n=H(e),o=0,i=n.length,a=void 0,s=void 0;o{n=I(n,e.resolveRef(r))})),n}function ce(e,r){if(null==e||null==e.$ref)return e;if(e.getRoot){return e.getRoot().getRef(e)}return r.getRef(e)}function me(e,r){if(null==e||null==e.$ref)return e;const t=r.getRef(e);if(!1===t)return t;const n=I(e,t);return delete n.$ref,Object.defineProperty(n,"__ref",{enumerable:!1,value:e.__ref}),Object.defineProperty(n,"getRoot",{enumerable:!1,value:e.getRoot}),n}function pe(e,r,t){const{schema:n,pointer:o,onError:i}=Object.assign({schema:e.rootSchema,pointer:"#"},t);let a=e.validate(r,n,o);if(i){a=c(a);const e=function(e){return function r(t){return Array.isArray(t)?((t=c(t)).forEach(r),t):(d(t)&&e(t),t)}}(i);for(let r=0;re.filter(y))).catch((e=>{throw console.log("Failed resolving promises",e.message),console.log(e.stack),e}))}function de(e,r,t){var n;const o=null!==(n=r.dependencies)&&void 0!==n?n:r.dependentSchemas;if(!_(o)||!_(t))return;let i=!1,a={required:[]};return Object.keys(o).forEach((n=>{var s,l;if(null==t[n]&&!(null===(s=r.required)||void 0===s?void 0:s.includes(n))&&!(null===(l=a.required)||void 0===l?void 0:l.includes(n)))return;const u=o[n];return Array.isArray(u)?(i=!0,void a.required.push(...u)):_(u)?(i=!0,void(a=I(a,e.resolveRef(u)))):void 0})),i?(a.required=(s=a.required).filter(((e,r)=>s.indexOf(e)===r)),a):void 0;var s}function he(e,r,t){if(!Array.isArray(r.anyOf)||0===r.anyOf.length)return;let n;return r.anyOf.forEach((r=>{r=e.resolveRef(r),e.isValid(t,r)&&(n=n?I(n,r):r)})),n}function ye(e,r,t=e.rootSchema,n="#"){const{anyOf:o}=t;if(!Array.isArray(o)||0===o.length)return t;const i=he(e,t,r);if(null==i)return e.errors.anyOfError({pointer:n,schema:t,value:r,anyOf:JSON.stringify(o)});return S(I(t,i),"anyOf")}const ve=["allOf","anyOf","oneOf","dependencies","if","then","else"],$e=["allOf","anyOf","oneOf","dependencies","if"];function be(e){const r=Object.keys(e);return-1!==$e.findIndex((e=>r.includes(e)))}function ge(e,r,t,n){let o,i;if((r=e.resolveRef(r)).oneOf){const a=g(e,t,r,n);d(a)?i=a:a&&(o=I(null!=o?o:{},a))}if(Array.isArray(r.allOf)){const i=r.allOf.map((r=>{if(be(r)){let o=ge(e,r,t,n);return o?(o=I(r,o),S(o,...ve)):void 0}return r}));if(i.length>0){o=I(null!=o?o:{},fe(e,{allOf:i}))}}const a=he(e,r,t);a&&(o=I(null!=o?o:{},a));const s=de(e,r,t);s&&(o=I(null!=o?o:{},s));const l=se(e,r,t);if(l&&(o=I(null!=o?o:{},l)),null==o)return i;const u=ge(e,o,t,n);return u&&(o=I(o,u)),S(o,...ve)}const Oe=["allOf","anyOf","oneOf","dependencies","if","then","else"];function Ee(e,r,t,n){let o=ge(e,r,t,n);return o?(o=I(r,o),S(o,...Oe)):r}class Pe{constructor(e,r){this.remotes={},this.errors={},this.typeKeywords={},this.validateKeyword={},this.validateType={},this.validateFormat={},this.config=e,this.typeKeywords=ae(e.typeKeywords),this.validateKeyword=Object.assign({},e.validateKeyword),this.validateType=Object.assign({},e.validateType),this.validateFormat=Object.assign({},e.validateFormat),this.errors=Object.assign({},e.errors),this.setSchema(r)}get rootSchema(){return this.__rootSchema}set rootSchema(e){null!=e&&(this.__rootSchema=this.config.compileSchema(this,e))}addRemoteSchema(e,r){this.config.addRemoteSchema(this,e,r)}compileSchema(e){var r;return this.config.compileSchema(this,e,null!==(r=this.rootSchema)&&void 0!==r?r:e)}createSchemaOf(e){return this.config.createSchemaOf(e)}each(e,r,t,n){return this.config.each(this,e,r,t,n)}eachSchema(e,r=this.rootSchema){return this.config.eachSchema(r,e)}getChildSchemaSelection(e,r){return this.config.getChildSchemaSelection(this,e,r)}getSchema(e){return this.config.getSchema(this,e)}getTemplate(e,r,t=this.config.templateDefaultOptions){return this.config.getTemplate(this,e,r,t)}isValid(e,r,t){return this.config.isValid(this,e,r,t)}resolveAnyOf(e,r,t){return this.config.resolveAnyOf(this,e,r,t)}resolveAllOf(e,r){return this.config.resolveAllOf(this,e,r)}resolveRef(e){return this.config.resolveRef(e,this.rootSchema)}resolveOneOf(e,r,t){return this.config.resolveOneOf(this,e,r,t)}setSchema(e){this.rootSchema=e}step(e,r,t,n){return this.config.step(this,e,r,t,n)}validate(e,r,t){return this.config.validate(this,e,r,t)}}function xe(e,r,t,n){const o=r[e];_(o)&&Object.keys(o).forEach((r=>{Array.isArray(o[r])||("$defs"===r?xe("$defs",o[r],t,`${n}/${e}/$defs`):Ie(o[r],t,`${n}/${e}/${r}`))}))}function _e(e,r,t,n){const o=r[e];Array.isArray(o)&&o.forEach(((r,o)=>Ie(r,t,`${n}/${e}/${o}`)))}function Ie(e,r,t=""){void 0!==e&&!0!==r(e,t)&&_(e)&&(xe("properties",e,r,t),xe("patternProperties",e,r,t),Ie(e.not,r,`${t}/not`),Ie(e.additionalProperties,r,`${t}/additionalProperties`),xe("dependencies",e,r,t),_(e.items)&&Ie(e.items,r,`${t}/items`),_e("items",e,r,t),Ie(e.additionalItems,r,`${t}/additionalItems`),_e("allOf",e,r,t),_e("anyOf",e,r,t),_e("oneOf",e,r,t),Ie(e.if,r,`${t}/if`),Ie(e.then,r,`${t}/then`),Ie(e.else,r,`${t}/else`),xe("definitions",e,r,t),xe("$defs",e,r,t))}const Ae=/(#)+$/,Se=/#$/,je=/^[#/]+/,we=/^[^:]+:\/\/[^/]+\//,Re=/\/[^/]*$/,De=/#.*$/,Le=/^urn:uuid:[0-9A-Fa-f]/;function Me(e,r){return null==e&&null==r?"#":null==r?e.replace(Se,""):Le.test(r)?r:null==e||""===e||"#"===e?r.replace(Se,""):"#"===r[0]?`${e.replace(De,"")}${r.replace(Ae,"")}`:we.test(r)?r.replace(Se,""):we.test(e)&&r.startsWith("/")?`${e.replace(/(^[^:]+:\/\/[^/]+)(.*)/,"$1")}/${r.replace(je,"")}`:`${e.replace(Re,"")}/${r.replace(je,"")}`}var ke=t(546),Te=t.n(ke);const Ne=/(#)+$/g,Fe=["",null,"#"];const Ue=/(#)+$/g,Ce=e=>"object"===o(e);function Ve(e,r,t){var n,o,i,a,s;let l,u;if(l=Ce(t)?t.__ref||t.$ref:t,null==l)return r;const f=l.replace(Ue,"");if(null!=e.remotes[f])return u=e.remotes[f],u&&u.$ref?Ve(e,u,u):u;const c=null===(n=e.anchors)||void 0===n?void 0:n[l];if(c)return(0,ke.get)(r,c);if(null!=e.ids[l])return u=(0,ke.get)(r,e.ids[l]),u&&u.$ref?Ve(e,r,u):u;const m=l,p=function(e){if(Fe.includes(e))return[];if(-1===(e=e.replace(Ne,"")).indexOf("#"))return[e.replace(/(#|\/)+$/g,"")];if(0===e.indexOf("#"))return[e.replace(Ne,"")];const r=e.split("#");return r[0]=r[0].replace(/(#|\/)+$/g,""),r[1]=`#${r[1].replace(Ne,"")}`,r}(l);if(0===p.length)return r;if(1===p.length){if(l=p[0],e.remotes[l]&&(u=e.remotes[l],u&&u.$ref))return Ve(e,r,u);if(e.ids[l])return u=(0,ke.get)(r,e.ids[l]),u&&u.$ref?Ve(e,r,u):u;const t=null===(o=r.getContext)||void 0===o?void 0:o.call(r).ids[l];if(t)return Ve(e,r,t)}if(2===p.length){const t=p[0];l=p[1];const n=null!==(i=e.remotes[t])&&void 0!==i?i:e.remotes[`${t}/`];if(n)return n.getContext&&null!=n.getContext().anchors[m]?n.getRef(m):n.getRef?n.getRef(l):Ve(e,n,l);const o=null!==(a=e.ids[t])&&void 0!==a?a:e.ids[`${t}/`];if(o)return Ve(e,(0,ke.get)(r,o),l)}return u=(0,ke.get)(r,null!==(s=e.ids[l])&&void 0!==s?s:l),u&&u.$ref?Ve(e,r,u):u}const ze="__compiled",qe="__ref",Ke=/(#|\/)+$/g;const Ge=function(e,r,t=r,n=!1){if(!r||void 0!==r[ze])return r;const o={ids:{},remotes:e.remotes},i=JSON.stringify(r),a=JSON.parse(i);if(Object.defineProperty(a,ze,{enumerable:!1,value:!0}),Object.defineProperty(a,"getRef",{enumerable:!1,value:Ve.bind(null,o,a)}),!1===n&&!1===i.includes("$ref"))return a;r!==t&&Object.defineProperty(a,"definitions",{enumerable:!1,value:Object.assign({},t.definitions,t.$defs,r.definitions,r.$defs)});const s={},l=()=>a;return Ie(a,((e,r)=>{var t;if(e.id){if(e.id.startsWith("http")&&/(allOf|anyOf|oneOf)\/\d+$/.test(r)){const n=r.replace(/\/(allOf|anyOf|oneOf)\/\d+$/,""),o=(0,ke.get)(a,n);e.id=null!==(t=o.id)&&void 0!==t?t:e.id}o.ids[e.id.replace(Ke,"")]=r}const n=(r=`#${r}`.replace(/##+/,"#")).replace(/\/[^/]+$/,""),i=r.replace(/\/[^/]+\/[^/]+$/,""),u=Me(s[n]||s[i],e.id);s[r]=u,null==o.ids[u]&&(o.ids[u]=r),e.$ref&&!e[qe]&&(Object.defineProperty(e,qe,{enumerable:!1,value:Me(u,e.$ref)}),Object.defineProperty(e,"getRoot",{enumerable:!1,value:l}))})),a};function He(e,r,t,n=e.rootSchema,i="#"){n=e.resolveRef(n),t(n,r,i);const a=o(r);"object"===a?Object.keys(r).forEach((o=>{const a=e.step(o,n,r,i),s=r[o];e.each(s,t,a,`${i}/${o}`)})):"array"===a&&r.forEach(((o,a)=>{const s=e.step(a,n,r,i);e.each(o,t,s,`${i}/${a}`)}))}const Je={additionalItemsError:f("AdditionalItemsError"),additionalPropertiesError:f("AdditionalPropertiesError"),anyOfError:f("AnyOfError"),allOfError:f("AllOfError"),constError:f("ConstError"),containsError:f("ContainsError"),containsMaxError:f("ContainsMaxError"),containsMinError:f("ContainsMinError"),containsArrayError:f("ContainsArrayError"),containsAnyError:f("ContainsAnyError"),enumError:f("EnumError"),forbiddenPropertyError:f("ForbiddenPropertyError"),formatURLError:f("FormatURLError"),formatURIError:f("FormatURIError"),formatURIReferenceError:f("FormatURIReferenceError"),formatURITemplateError:f("FormatURITemplateError"),formatDateError:f("FormatDateError"),formatDateTimeError:f("FormatDateTimeError"),formatEmailError:f("FormatEmailError"),formatHostnameError:f("FormatHostnameError"),formatIPV4Error:f("FormatIPV4Error"),formatIPV4LeadingZeroError:f("FormatIPV4LeadingZeroError"),formatIPV6Error:f("FormatIPV6Error"),formatIPV6LeadingZeroError:f("FormatIPV6LeadingZeroError"),formatJsonPointerError:f("FormatJsonPointerError"),formatRegExError:f("FormatRegExError"),formatTimeError:f("FormatTimeError"),invalidSchemaError:f("InvalidSchemaError"),invalidDataError:f("InvalidDataError"),invalidTypeError:f("InvalidTypeError"),invalidPropertyNameError:f("InvalidPropertyNameError"),maximumError:f("MaximumError"),maxItemsError:f("MaxItemsError"),maxLengthError:f("MaxLengthError"),maxPropertiesError:f("MaxPropertiesError"),minimumError:f("MinimumError"),minItemsError:f("MinItemsError"),minItemsOneError:f("MinItemsOneError"),minLengthError:f("MinLengthError"),minLengthOneError:f("MinLengthOneError"),minPropertiesError:f("MinPropertiesError"),missingDependencyError:f("MissingDependencyError"),missingOneOfPropertyError:f("MissingOneOfPropertyError"),multipleOfError:f("MultipleOfError"),multipleOneOfError:f("MultipleOneOfError"),noAdditionalPropertiesError:f("NoAdditionalPropertiesError"),notError:f("NotError"),oneOfError:f("OneOfError"),oneOfPropertyError:f("OneOfPropertyError"),patternError:f("PatternError"),patternPropertiesError:f("PatternPropertiesError"),requiredPropertyError:f("RequiredPropertyError"),schemaWarning:f("SchemaWarning"),typeError:f("TypeError"),undefinedValueError:f("UndefinedValueError"),unevaluatedPropertyError:f("UnevaluatedPropertyError"),unevaluatedItemsError:f("UnevaluatedItemsError"),uniqueItemsError:f("UniqueItemsError"),unknownPropertyError:f("UnknownPropertyError"),valueNotEmptyError:f("ValueNotEmptyError")};var Be=t(853),Ze=t.n(Be),Qe=t(125);const We=new RegExp("^([0-9]+)-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])[Tt]([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9]|60)(\\.[0-9]+)?(([Zz])|([\\+|\\-]([01][0-9]|2[0-3]):[0-5][0-9]))$"),Xe=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,Ye=/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,er=/^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\.?$/,rr=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,tr=/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,nr=[0,31,28,31,30,31,30,31,31,30,31,30,31],or=/^(?:\/(?:[^~/]|~0|~1)*)*$/,ir=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,ar=/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,sr=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,lr={date:(e,r,t,n)=>{if("string"!=typeof t||""===t)return;const o=t.match(rr);if(!o)return e.errors.formatDateTimeError({value:t,pointer:n,schema:r});const i=+o[1],a=+o[2],s=+o[3];return a>=1&&a<=12&&s>=1&&s<=(2==a&&(i%4==0&&(i%100!=0||i%400==0))?29:nr[a])?void 0:e.errors.formatDateError({value:t,pointer:n,schema:r})},"date-time":(e,r,t,n)=>{if("string"==typeof t&&""!==t)return""===t||We.test(t)?"Invalid Date"===new Date(t).toString()?e.errors.formatDateTimeError({value:t,pointer:n,schema:r}):void 0:e.errors.formatDateTimeError({value:t,pointer:n,schema:r})},email:(e,r,t,n)=>{if("string"!=typeof t||""===t)return;if('"'===t[0])return e.errors.formatEmailError({value:t,pointer:n,schema:r});const[o,i,...a]=t.split("@");return!o||!i||0!==a.length||o.length>64||i.length>253||"."===o[0]||o.endsWith(".")||o.includes("..")?e.errors.formatEmailError({value:t,pointer:n,schema:r}):/^[a-z0-9.-]+$/i.test(i)&&/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+$/i.test(o)&&i.split(".").every((e=>/^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(e)))?void 0:e.errors.formatEmailError({value:t,pointer:n,schema:r})},"idn-email":(e,r,t,n)=>{if("string"==typeof t&&""!==t)try{return void(0,Qe.parse)(t)}catch(o){return e.errors.formatEmailError({value:t,pointer:n,schema:r})}},hostname:(e,r,t,n)=>{if("string"==typeof t&&""!==t&&!er.test(t))return e.errors.formatHostnameError({value:t,pointer:n,schema:r})},ipv4:(e,r,t,n)=>{if("string"==typeof t&&""!==t){if(t&&"0"===t[0])return e.errors.formatIPV4LeadingZeroError({value:t,pointer:n,schema:r});if(!(t.length<=15&&Xe.test(t)))return e.errors.formatIPV4Error({value:t,pointer:n,schema:r})}},ipv6:(e,r,t,n)=>{if("string"==typeof t&&""!==t){if(t&&"0"===t[0])return e.errors.formatIPV6LeadingZeroError({value:t,pointer:n,schema:r});if(!(t.length<=45&&Ye.test(t)))return e.errors.formatIPV6Error({value:t,pointer:n,schema:r})}},"json-pointer":(e,r,t,n)=>{if("string"==typeof t&&""!==t&&!or.test(t))return e.errors.formatJsonPointerError({value:t,pointer:n,schema:r})},"relative-json-pointer":(e,r,t,n)=>{if("string"==typeof t&&!ir.test(t))return e.errors.formatJsonPointerError({value:t,pointer:n,schema:r})},regex:(e,r,t,n)=>{if("string"==typeof t&&!1===/\\Z$/.test(t)){try{return void new RegExp(t)}catch(e){}return e.errors.formatRegExError({value:t,pointer:n,schema:r})}if("object"!=typeof t&&"number"!=typeof t&&!Array.isArray(t))return e.errors.formatRegExError({value:t,pointer:n,schema:r})},time:(e,r,t,n)=>{if("string"!=typeof t||""===t)return;return t.match(tr)?void 0:e.errors.formatDateTimeError({value:t,pointer:n,schema:r})},uri:(e,r,t,n)=>{if("string"==typeof t&&""!==t&&!Ze().isUri(t))return e.errors.formatURIError({value:t,pointer:n,schema:r})},"uri-reference":(e,r,t,n)=>{if("string"==typeof t&&""!==t&&!ar.test(t))return e.errors.formatURIReferenceError({value:t,pointer:n,schema:r})},"uri-template":(e,r,t,n)=>{if("string"==typeof t&&""!==t&&!sr.test(t))return e.errors.formatURITemplateError({value:t,pointer:n,schema:r})},url:(e,r,t,n)=>{if(""!==t&&!Ze().isWebUri(t))return e.errors.formatURLError({value:t,pointer:n,schema:r})}},ur={};function fr(e,r=ur){const{pointer:t="#",data:n,schema:o=e.rootSchema,withSchemaWarning:i=!1}=r,a=Te().split(t),s=cr(e,e.resolveRef(o),a,"#",n);if(i||"schema-warning"!==(null==s?void 0:s.code))return s}function cr(e,r,t,n,o=ur){if(0===t.length)return e.resolveRef(r);const i=t.shift();return d(r=e.step(i,r,o,n))?r:cr(e,r,t,`${n}/${i}`,o=o[i])}const mr=m.templateDefaultOptions;let pr;function dr(e,r){const{$ref:t}=e;if(null==t)return!0;return(null==pr[r]||null==pr[r][t]?0:pr[r][t])0){if(dr(r.anyOf[0],`${n}/anyOf/0`)){const t=hr(e,r.anyOf[0],`${n}/anyOf/0`);a=x(a,t),a.pointer=r.anyOf[0].$ref||a.pointer}delete a.anyOf}if(Array.isArray(r.allOf)){const o=r.allOf.map(((e,r)=>dr(e,`${n}/allOf/${r}`))).reduceRight(((e,r)=>e&&r),!0);if(o){const o=[];let s=ae(t);for(let t=0;te&&"object"==typeof e;function $r(e,r,t,n,i){var a;if(null==t)throw new Error(`getTemplate: missing schema for data: ${JSON.stringify(r)}`);if(null==n)throw new Error("Missing pointer");let s=yr(e,t,r,n,i);if(!vr(s))return;if(n=s.pointer,null==s?void 0:s.const)return s.const;if(Array.isArray(s.oneOf))if(function(e){switch(o(e)){case"string":case"array":return 0===(null==e?void 0:e.length);case"null":case"undefined":return!0;case"object":return 0===Object.keys(e).length;default:return!1}}(r)){const e=s.oneOf[0].type||s.type||s.const&&typeof s.const||o(r);s=Object.assign(Object.assign({},s.oneOf[0]),{type:e})}else{const t=g(e,r,s);if(d(t)){if(null!=r&&!0!==i.removeInvalidData)return r;s=s.oneOf[0],r=void 0}else t.type=null!==(a=t.type)&&void 0!==a?a:s.type,s=t}if(!vr(s)||null==s.type)return;if(r instanceof File)return r;const l=Array.isArray(s.type)?function(e,r,t){if(null==r){if(null!=t){const r=o(t);if(e.includes(r))return r}return e[0]}const n=o(r);if(e.includes(n))return n;return e[0]}(s.type,r,s.default):s.type,u=o(r);if(null==r||u===l||"number"===u&&"integer"===l||(r=function(e,r){if("string"===e)return JSON.stringify(r);if("string"!=typeof r)return null;try{if(typeof(r=JSON.parse(r))===e)return r}catch(e){}return null}(l,r)),null==br[l]){if(i.removeInvalidData)return;return r}return br[l](e,s,r,n,i)}const br={null:(e,r,t)=>gr(r,t,null),string:(e,r,t)=>gr(r,t,""),number:(e,r,t)=>gr(r,t,0),integer:(e,r,t)=>gr(r,t,0),boolean:(e,r,t)=>gr(r,t,!1),object:(e,r,t,n,i)=>{var a;const s=void 0===r.default?{}:r.default,l={},u=!1===i.extendDefaults&&void 0!==r.default?[]:null!==(a=r.required)&&void 0!==a?a:[];r.properties&&Object.keys(r.properties).forEach((o=>{const a=null==t||null==t[o]?s[o]:t[o],f=u.includes(o);(null!=a||f||i.addOptionalProps)&&(l[o]=$r(e,a,r.properties[o],`${n}/properties/${o}`,i))}));let f=de(e,r,l);if(f){f=I(r,f),delete f.dependencies;const o=$r(e,t,f,`${n}/dependencies`,i);Object.assign(l,o)}t&&(!0!==i.removeInvalidData||!1!==r.additionalProperties&&"object"!==o(r.additionalProperties)?Object.keys(t).forEach((e=>null==l[e]&&(l[e]=t[e]))):"object"===o(r.additionalProperties)&&Object.keys(t).forEach((n=>{null==l[n]&&e.isValid(t[n],r.additionalProperties)&&(l[n]=t[n])})));const c=se(e,r,l);if(c){const r=$r(e,l,Object.assign({type:"object"},c),n,i);Object.assign(l,r)}return l},array:(e,r,t,n,i)=>{var a,s;if(null==r.items)return t||[];const l=void 0===r.default?[]:r.default,u=t||l,f=!1===i.extendDefaults&&void 0!==r.default?0:r.minItems||0;if(Array.isArray(r.items)){for(let t=0,o=Math.max(null!=f?f:0,null!==(s=null===(a=r.items)||void 0===a?void 0:a.length)&&void 0!==s?s:0);t0){const r=Math.max(f,u.length);for(let t=0;t(pr={},$r(e,r,t,"#",n?Object.assign(Object.assign({},mr),n):mr));function Er(e,r,t=e.rootSchema,n="#"){return 0===e.validate(r,t,n).length}function Pr(e){const r=[];let t=0;const n=e.length;for(;t=55296&&o<=56319&&t!(void 0===e[r]||!Ar.call(e,r)),jr={additionalProperties:(e,r,t,n)=>{if(!0===r.additionalProperties||null==r.additionalProperties)return;if("object"===o(r.patternProperties)&&!1===r.additionalProperties)return;const i=[];let a=Object.keys(t).filter((e=>!1===m.propertyBlacklist.includes(e)));const s=Object.keys(r.properties||{});if("object"===o(r.patternProperties)){const e=Object.keys(r.patternProperties).map((e=>new RegExp(e)));a=a.filter((r=>{for(let t=0;t{const{allOf:o}=r;if(!Array.isArray(o)||0===o.length)return;const i=[];return r.allOf.forEach((r=>{i.push(...e.validate(t,r,n))})),i},anyOf:(e,r,t,n)=>{if(Array.isArray(r.anyOf)&&0!==r.anyOf.length){for(let n=0;n{const i=r.dependencies;if(!_(i))return;const a=[];return Object.keys(t).forEach((s=>{if(void 0===i[s])return;if(!0===i[s])return;if(!1===i[s])return void a.push(e.errors.missingDependencyError({pointer:n,schema:r,value:t}));let l;const u=o(i[s]),f=i[s];if(Array.isArray(f))l=f.filter((e=>void 0===t[e])).map((o=>e.errors.missingDependencyError({missingProperty:o,pointer:n,schema:r,value:t})));else{if("object"!==u)throw new Error(`Invalid dependency definition for ${n}/${s}. Must be string[] or schema`);l=e.validate(t,i[s],n)}a.push(...l)})),a.length>0?a:void 0},enum:(e,r,t,n)=>{const i=o(t);if("object"===i||"array"===i){const e=JSON.stringify(t);for(let t=0;t{if(e.validateFormat[r.format]){return e.validateFormat[r.format](e,r,t,n)}},items:(e,r,t,n)=>{if(!1===r.items){if(Array.isArray(t)&&0===t.length)return;return e.errors.invalidDataError({pointer:n,value:t,schema:r})}const o=[];for(let i=0;i{if(!isNaN(r.maximum))return r.maximum&&r.maximum{if(!isNaN(r.maxItems))return r.maxItems{if(isNaN(r.maxLength))return;const o=Pr(t).length;return r.maxLength{const o=Object.keys(t).length;if(!1===isNaN(r.maxProperties)&&r.maxProperties{if(isNaN(r.minLength))return;const o=Pr(t).length;return r.minLength>o?1===r.minLength?e.errors.minLengthOneError({minLength:r.minLength,length:o,pointer:n,schema:r,value:t}):e.errors.minLengthError({minLength:r.minLength,length:o,pointer:n,schema:r,value:t}):void 0},minimum:(e,r,t,n)=>{if(!isNaN(r.minimum))return r.minimum>t||!0===r.exclusiveMinimum&&r.minimum===t?e.errors.minimumError({minimum:r.minimum,length:t,pointer:n,schema:r,value:t}):void 0},minItems:(e,r,t,n)=>{if(!isNaN(r.minItems))return r.minItems>t.length?1===r.minItems?e.errors.minItemsOneError({minItems:r.minItems,length:t.length,pointer:n,schema:r,value:t}):e.errors.minItemsError({minItems:r.minItems,length:t.length,pointer:n,schema:r,value:t}):void 0},minProperties:(e,r,t,n)=>{if(isNaN(r.minProperties))return;const o=Object.keys(t).length;return r.minProperties>o?e.errors.minPropertiesError({minProperties:r.minProperties,length:o,pointer:n,schema:r,value:t}):void 0},multipleOf:(e,r,t,n)=>{if(isNaN(r.multipleOf)||"number"!=typeof t)return;const o=xr(t),i=xr(r.multipleOf);if(o>i)return e.errors.multipleOfError({multipleOf:r.multipleOf,value:t,pointer:n,schema:r});const a=Math.pow(10,i);return Math.round(t*a)%Math.round(r.multipleOf*a)/a!=0?e.errors.multipleOfError({multipleOf:r.multipleOf,value:t,pointer:n,schema:r}):void 0},not:(e,r,t,n)=>{const o=[];return 0===e.validate(t,r.not,n).length&&o.push(e.errors.notError({value:t,not:r.not,pointer:n,schema:r})),o},oneOf:(e,r,t,n)=>{if(Array.isArray(r.oneOf)){const o=e.resolveOneOf(t,r,n);if(d(o))return o}},pattern:(e,r,t,n)=>{if(!1===new RegExp(r.pattern,"u").test(t))return e.errors.patternError({pattern:r.pattern,description:r.patternExample||r.pattern,received:t,schema:r,value:t,pointer:n})},patternProperties:(e,r,t,n)=>{const i=r.properties||{},a=r.patternProperties;if("object"!==o(a))return;const s=[],l=Object.keys(t),u=Object.keys(a).map((e=>({regex:new RegExp(e),patternSchema:a[e]})));return l.forEach((o=>{let l=!1;for(let r=0,i=u.length;r0&&s.push(...i)}i[o]||!1===l&&!1===r.additionalProperties&&s.push(e.errors.patternPropertiesError({key:o,pointer:n,schema:r,value:t,patterns:Object.keys(a).join(",")}))})),s},properties:(e,r,t,n)=>{const o=[],i=Object.keys(r.properties||{});for(let a=0;a{const o=[],i=Object.keys(r.properties||{});for(let a=0;a{if(!1!==Array.isArray(r.required))return r.required.map((o=>{if(!Sr(t,o))return e.errors.requiredPropertyError({key:o,pointer:n,schema:r,value:t})}))},requiredNotEmpty:(e,r,t,n)=>{if(!1!==Array.isArray(r.required))return r.required.map((o=>{if(null==t[o]||""===t[o])return e.errors.valueNotEmptyError({property:o,pointer:`${n}/${o}`,schema:r,value:t})}))},uniqueItems:(e,r,t,n)=>{if(!1===(Array.isArray(t)&&r.uniqueItems))return;const o=[],i=[];return t.forEach(((a,s)=>{for(let l=s+1;lr.properties[t]=Rr(e[t])))),"array"===r.type&&Array.isArray(e)&&(1===e.length?r.items=Rr(e[0]):r.items=e.map(Rr)),r}const Dr={array:(e,r,t,n,i)=>{const a=null==n?void 0:n[r],s=o(t.items);if("object"===s)return Ee(e,t.items,a,`${i}/${r}`)||e.resolveRef(t.items);if("array"===s){if(!0===t.items[r])return Rr(a);if(!1===t.items[r])return e.errors.invalidDataError({key:r,value:a,pointer:i,schema:t});if(t.items[r])return e.resolveRef(t.items[r]);if(!1===t.additionalItems)return e.errors.additionalItemsError({key:r,value:a,pointer:i,schema:t});if(!0===t.additionalItems||void 0===t.additionalItems)return Rr(a);if("object"===o(t.additionalItems))return t.additionalItems;throw new Error(`Invalid schema ${JSON.stringify(t,null,2)} for ${JSON.stringify(n,null,2)}`)}return!1!==t.additionalItems&&a?Rr(a):new Error(`Invalid array schema for ${r} at ${i}`)},object:(e,r,t,n,i)=>{var a;const s=null===(a=null==(t=Ee(e,t,n,i))?void 0:t.properties)||void 0===a?void 0:a[r];if(void 0!==s){if(!1===s)return e.errors.forbiddenPropertyError({property:r,value:n,pointer:i,schema:t});if(!0===s)return Rr(null==n?void 0:n[r]);const o=e.resolveRef(s);if(d(o))return o;if(o&&Array.isArray(o.oneOf))return e.resolveOneOf(n[r],o,`${i}/${r}`);if(o)return o}const{patternProperties:l}=t;if("object"===o(l)){let e;const t=Object.keys(l);for(let n=0,o=t.length;ne.resolveRef(r)));if(null===(n=t.items)||void 0===n?void 0:n.oneOf)return t.items.oneOf.map((r=>e.resolveRef(r)));const o=e.step(r,t,{},"#");return d(o)?o:[o]}function kr(e,r,t=e.rootSchema,n="#"){if("boolean"===o(t=e.resolveRef(t)))return t?[]:[e.errors.invalidDataError({pointer:n,schema:t,value:r})];if(d(t))return[t];if(void 0!==t.const)return Ir()(t.const,r)?[]:[e.errors.constError({pointer:n,schema:t,value:r,expected:t.const})];const i=function(e,r){const t=o(e);return"number"===t&&("integer"===r||Array.isArray(r)&&r.includes("integer"))?Number.isInteger(e)||isNaN(e)?"integer":"number":t}(r,t.type),a=t.type||i;if(!(i===a||Array.isArray(a)&&a.includes(i)))return[e.errors.typeError({pointer:n,schema:t,value:r,received:i,expected:a})];if(null==e.validateType[i])return[e.errors.invalidTypeError({pointer:n,schema:t,value:r,receivedType:i})];return c(e.validateType[i](e,t,r,n)).filter(h)}const Tr={typeKeywords:{array:["allOf","anyOf","enum","items","maxItems","minItems","not","oneOf","uniqueItems"],boolean:["enum","not","allOf","anyOf","oneOf"],object:["additionalProperties","dependencies","enum","format","minProperties","maxProperties","patternProperties","properties","required","not","oneOf","allOf","anyOf"],string:["allOf","anyOf","enum","format","maxLength","minLength","not","oneOf","pattern"],number:["allOf","anyOf","enum","format","maximum","minimum","multipleOf","not","oneOf"],null:["allOf","anyOf","enum","format","not","oneOf"]},validateKeyword:wr,validateType:{array:(e,r,t,n)=>e.typeKeywords.array.filter((e=>r&&null!=r[e])).map((o=>e.validateKeyword[o](e,r,t,n))),object:(e,r,t,n)=>e.typeKeywords.object.filter((e=>r&&null!=r[e])).map((o=>e.validateKeyword[o](e,r,t,n))),string:(e,r,t,n)=>e.typeKeywords.string.filter((e=>r&&null!=r[e])).map((o=>e.validateKeyword[o](e,r,t,n))),integer:(e,r,t,n)=>e.typeKeywords.number.filter((e=>r&&null!=r[e])).map((o=>e.validateKeyword[o](e,r,t,n))),number:(e,r,t,n)=>e.typeKeywords.number.filter((e=>r&&null!=r[e])).map((o=>e.validateKeyword[o](e,r,t,n))),boolean:(e,r,t,n)=>e.typeKeywords.boolean.filter((e=>r&&null!=r[e])).map((o=>e.validateKeyword[o](e,r,t,n))),null:(e,r,t,n)=>e.typeKeywords.null.filter((e=>r&&null!=r[e])).map((o=>e.validateKeyword[o](e,r,t,n)))},validateFormat:lr,errors:Je,addRemoteSchema:function(e,r,t){t.id=t.id||r,e.remotes[r]=e.compileSchema(t)},compileSchema:Ge,createSchemaOf:Rr,each:He,eachSchema:Ie,getChildSchemaSelection:Mr,getSchema:fr,getTemplate:Or,isValid:Er,resolveAllOf:ue,resolveAnyOf:ye,resolveOneOf:$,resolveRef:ce,step:Lr,validate:kr,templateDefaultOptions:m.templateDefaultOptions};class Nr extends Pe{constructor(e,r={}){super(x(Tr,r),e)}}function Fr(e,r,t){t.$id=t.$id||r,e.remotes[r]=e.compileSchema(t)}const Ur="__compiled",Cr="__ref",Vr=/(#|\/)+$/g;function zr(e,r,t=r,n=!1){if(!0===r||!1===r||void 0===r)return r;if(void 0!==r[Ur])return r;const o={ids:{},anchors:{},remotes:e.remotes},i=JSON.stringify(r),a=JSON.parse(i);if(Object.defineProperty(a,Ur,{enumerable:!1,value:!0}),Object.defineProperty(a,"getContext",{enumerable:!1,value:()=>o}),Object.defineProperty(a,"getRef",{enumerable:!1,value:Ve.bind(null,o,a)}),!1===n&&!1===i.includes("$ref"))return a;a!==t&&Object.defineProperty(a,"$defs",{enumerable:!0,value:Object.assign({},t.definitions,t.$defs,a.definitions,a.$defs)});const s={},l=()=>a;return Ie(a,((e,r)=>{var t;if(e.$id){if(e.$id.startsWith("http")&&/(allOf|anyOf|oneOf)\/\d+$/.test(r)){const n=r.replace(/\/(allOf|anyOf|oneOf)\/\d+$/,""),o=(0,ke.get)(a,n);e.$id=null!==(t=o.$id)&&void 0!==t?t:e.$id}o.ids[e.$id.replace(Vr,"")]=r}const n=(r=`#${r}`.replace(/##+/,"#")).replace(/\/[^/]+$/,""),i=r.replace(/\/[^/]+\/[^/]+$/,""),u=Me(s[n]||s[i],e.$id);s[r]=u,null==o.ids[u]&&(o.ids[u]=r),e.$anchor&&(o.anchors[`${u}#${e.$anchor}`]=r),e.$ref&&!e[Cr]&&(Object.defineProperty(e,Cr,{enumerable:!1,value:Me(u,e.$ref)}),Object.defineProperty(e,"getRoot",{enumerable:!1,value:l}))})),a}const qr=Object.assign(Object.assign({},wr),{contains:(e,r,t,n)=>{var i,a;if(!1===r.contains)return e.errors.containsArrayError({pointer:n,value:t,schema:r});if(!0===r.contains)return Array.isArray(t)&&0===t.length?e.errors.containsAnyError({pointer:n,value:t,schema:r}):void 0;if("object"!==o(r.contains))return;let s=0;for(let n=0;n=s&&u<=s?void 0:ls?e.errors.containsMinError({pointer:n,schema:r,delta:u-s,value:t}):e.errors.containsError({pointer:n,schema:r,value:t})},exclusiveMaximum:(e,r,t,n)=>{if(!isNaN(r.exclusiveMaximum))return r.exclusiveMaximum<=t?e.errors.maximumError({maximum:r.exclusiveMaximum,length:t,pointer:n,schema:r,value:t}):void 0},exclusiveMinimum:(e,r,t,n)=>{if(!isNaN(r.exclusiveMinimum))return r.exclusiveMinimum>=t?e.errors.minimumError({minimum:r.exclusiveMinimum,length:t,pointer:n,schema:r,value:t}):void 0},if:(e,r,t,n)=>{const o=se(e,r,t);if(o)return e.validate(t,o,n)},maximum:(e,r,t,n)=>{if(!isNaN(r.maximum))return r.maximum&&r.maximum{if(!isNaN(r.minimum))return r.minimum>t?e.errors.minimumError({minimum:r.minimum,length:t,pointer:n,schema:r,value:t}):void 0},patternProperties:(e,r,t,n)=>{const i=r.properties||{},a=r.patternProperties;if("object"!==o(a))return;const s=[],l=Object.keys(t),u=Object.keys(a).map((e=>({regex:new RegExp(e),patternSchema:a[e]})));return l.forEach((o=>{let l=!1;for(let i=0,f=u.length;i0&&s.push(...f)}i[o]||!1===l&&!1===r.additionalProperties&&s.push(e.errors.patternPropertiesError({key:o,pointer:n,patterns:Object.keys(a).join(","),schema:r,value:t}))})),s},propertyNames:(e,r,t,n)=>{if(!1===r.propertyNames){if(0===Object.keys(t).length)return;return e.errors.invalidPropertyNameError({property:Object.keys(t),pointer:n,value:t,schema:r})}if(!0===r.propertyNames)return;if("object"!==o(r.propertyNames))return;const i=[],a=Object.keys(t),s=Object.assign(Object.assign({},r.propertyNames),{type:"string"});return a.forEach((o=>{const a=e.validate(o,s,`${n}/${o}`);a.length>0&&i.push(e.errors.invalidPropertyNameError({property:o,pointer:n,validationError:a[0],value:t[o],schema:r}))})),i}}),Kr=qr,Gr={array:(e,r,t,n)=>e.typeKeywords.array.filter((e=>r&&null!=r[e])).map((o=>e.validateKeyword[o](e,r,t,n))),object:(e,r,t,n)=>e.typeKeywords.object.filter((e=>r&&null!=r[e])).map((o=>e.validateKeyword[o](e,r,t,n))),string:(e,r,t,n)=>e.typeKeywords.string.filter((e=>r&&null!=r[e])).map((o=>e.validateKeyword[o](e,r,t,n))),integer:(e,r,t,n)=>e.typeKeywords.number.filter((e=>r&&null!=r[e])).map((o=>e.validateKeyword[o](e,r,t,n))),number:(e,r,t,n)=>e.typeKeywords.number.filter((e=>r&&null!=r[e])).map((o=>e.validateKeyword[o](e,r,t,n))),boolean:(e,r,t,n)=>e.typeKeywords.boolean.filter((e=>r&&null!=r[e])).map((o=>e.validateKeyword[o](e,r,t,n))),null:(e,r,t,n)=>e.typeKeywords.null.filter((e=>r&&null!=r[e])).map((o=>e.validateKeyword[o](e,r,t,n)))},Hr={typeKeywords:{array:["allOf","anyOf","contains","enum","if","items","maxItems","minItems","not","oneOf","uniqueItems"],boolean:["allOf","anyOf","enum","not","oneOf"],object:["additionalProperties","allOf","anyOf","dependencies","enum","format","if","maxProperties","minProperties","not","oneOf","patternProperties","properties","propertyNames","required"],string:["allOf","anyOf","enum","format","if","maxLength","minLength","not","oneOf","pattern"],number:["enum","exclusiveMaximum","exclusiveMinimum","format","maximum","minimum","multipleOf","not","oneOf","allOf","anyOf","if"],null:["allOf","anyOf","enum","format","not","oneOf"]},validateKeyword:Kr,validateType:Gr,validateFormat:lr,errors:Je,addRemoteSchema:Fr,compileSchema:zr,createSchemaOf:Rr,each:He,eachSchema:Ie,getChildSchemaSelection:Mr,getSchema:fr,getTemplate:Or,isValid:Er,resolveAllOf:ue,resolveAnyOf:ye,resolveOneOf:$,resolveRef:ce,step:Lr,validate:kr,templateDefaultOptions:m.templateDefaultOptions};class Jr extends Pe{constructor(e,r={}){super(x(Hr,r),e)}}const Br={typeKeywords:{array:["allOf","anyOf","contains","enum","if","items","maxItems","minItems","not","oneOf","uniqueItems"],boolean:["allOf","anyOf","enum","not","oneOf"],object:["additionalProperties","allOf","anyOf","dependencies","enum","format","if","maxProperties","minProperties","not","oneOf","patternProperties","properties","propertyNames","required"],string:["allOf","anyOf","enum","format","if","maxLength","minLength","not","oneOf","pattern"],number:["allOf","anyOf","enum","exclusiveMaximum","exclusiveMinimum","format","if","maximum","minimum","multipleOf","not","oneOf"],null:["allOf","anyOf","enum","format","not","oneOf"]},validateKeyword:Kr,validateType:Gr,validateFormat:lr,errors:Je,addRemoteSchema:Fr,compileSchema:zr,createSchemaOf:Rr,each:He,eachSchema:Ie,getChildSchemaSelection:Mr,getSchema:fr,getTemplate:Or,isValid:Er,resolveAllOf:ue,resolveAnyOf:ye,resolveOneOf:$,resolveRef:ce,step:Lr,validate:kr,templateDefaultOptions:m.templateDefaultOptions};class Zr extends Pe{constructor(e,r={}){super(x(Br,r),e)}}const Qr=e=>_(e)?Object.keys(e).map((e=>new RegExp(e))):[];const Wr=Object.assign(Object.assign({},Kr),{dependencies:void 0,dependentSchemas:(e,r,t,n)=>{const o=r.dependentSchemas;if(!_(o))return;const i=[];return Object.keys(t).forEach((a=>{const s=o[a];!0!==s&&(!1!==s?_(s)&&e.validate(t,s,n).map((e=>i.push(e))):i.push(e.errors.missingDependencyError({pointer:n,schema:r,value:t})))})),i},dependentRequired:(e,r,t,n)=>{const o=r.dependentRequired;if(!_(o))return;const i=[];return Object.keys(t).forEach((a=>{const s=o[a];if(!0!==s)if(!1!==s){if(Array.isArray(s))for(let o=0,a=s.length;o{if(!_(t)||null==r.unevaluatedProperties)return;let o=Object.keys(t);if(0===o.length)return;const i=Ee(e,r,t,n);if(!0===i.unevaluatedProperties)return;const a=Qr(i.patternProperties);if(o=o.filter((n=>{var o;return!(null===(o=i.properties)||void 0===o?void 0:o[n])&&((!_(r.if)||!function(e,r,t,n){var o,i;const a=e.resolveRef(r);return!0===a.additionalProperties||(!(!(null===(o=a.properties)||void 0===o?void 0:o[t])||!e.isValid(n,null===(i=a.properties)||void 0===i?void 0:i[t]))||(!!Qr(a.patternProperties).find((e=>e.test(t)))||!!_(a.additionalProperties)&&e.validate(n,a.additionalProperties)))}(e,Object.assign({type:"object"},r.if),n,t[n]))&&(!a.find((e=>e.test(n)))&&!i.additionalProperties))})),0===o.length)return;const s=[];return!1===i.unevaluatedProperties?(o.forEach((o=>{s.push(e.errors.unevaluatedPropertyError({pointer:`${n}/${o}`,value:JSON.stringify(t[o]),schema:r}))})),s):(o.forEach((r=>{const o=e.validate(t[r],i.unevaluatedProperties,`${n}/${r}`);s.push(...o)})),s)},unevaluatedItems:(e,r,t,n)=>{if(!Array.isArray(t)||0===t.length||null==r.unevaluatedItems||!0===r.unevaluatedItems)return;const o=Ee(e,e.resolveRef(r),t,n);if(!0===o.unevaluatedItems||!0===o.additionalItems)return;if(_(r.if)){const n=Object.assign({type:"array"},r.if);if(e.isValid(t,n)&&Array.isArray(n.items)&&n.items.length===t.length)return}if(_(o.items)){return e.validate(t,Object.assign(Object.assign({},o),{unevaluatedItems:void 0}),n).map((r=>e.errors.unevaluatedItemsError(Object.assign({},r.data))))}if(Array.isArray(o.items)){const r=[];for(let n=o.items.length;ne.errors.unevaluatedItemsError({pointer:`${n}/${r.index}`,value:JSON.stringify(r.value),schema:o.unevaluatedItems})))}if(_(o.unevaluatedItems))return t.map(((r,t)=>{if(!e.isValid(r,o.unevaluatedItems))return e.errors.unevaluatedItemsError({pointer:`${n}/${t}`,value:JSON.stringify(r),schema:o.unevaluatedItems})}));const i=[];return t.forEach(((t,o)=>{i.push(e.errors.unevaluatedItemsError({pointer:`${n}/${o}`,value:JSON.stringify(t),schema:r}))})),i}}),Xr={typeKeywords:{array:["allOf","anyOf","contains","enum","if","items","maxItems","minItems","not","oneOf","unevaluatedItems","uniqueItems"],boolean:["allOf","anyOf","enum","not","oneOf"],object:["additionalProperties","allOf","anyOf","dependencies","dependentSchemas","dependentRequired","enum","format","if","maxProperties","minProperties","not","oneOf","patternProperties","properties","propertyNames","required","unevaluatedProperties"],string:["allOf","anyOf","enum","format","if","maxLength","minLength","not","oneOf","pattern"],number:["allOf","anyOf","enum","exclusiveMaximum","exclusiveMinimum","format","if","maximum","minimum","multipleOf","not","oneOf"],null:["allOf","anyOf","enum","format","not","oneOf"]},validateKeyword:Wr,validateType:Gr,validateFormat:lr,errors:Je,addRemoteSchema:Fr,compileSchema:zr,createSchemaOf:Rr,each:He,eachSchema:Ie,getChildSchemaSelection:Mr,getSchema:fr,getTemplate:Or,isValid:Er,resolveAllOf:ue,resolveAnyOf:ye,resolveOneOf:$,resolveRef:me,step:Lr,validate:kr,templateDefaultOptions:m.templateDefaultOptions};class Yr extends Pe{constructor(e,r={}){super(x(Xr,r),e)}}const et=Object.assign(Object.assign({},Br),{resolveOneOf:g,resolveRef:me});class rt extends Pe{constructor(e,r={}){super(x(et,r),e)}}const tt={strings:e}})(),n})())); \ No newline at end of file diff --git a/dist/jsonSchemaLibrary.js.LICENSE.txt b/dist/jsonSchemaLibrary.js.LICENSE.txt deleted file mode 100644 index b1824e0..0000000 --- a/dist/jsonSchemaLibrary.js.LICENSE.txt +++ /dev/null @@ -1 +0,0 @@ -/*!isLiteral &*/ diff --git a/dist/lib/compile/getRef.d.ts b/dist/lib/compile/getRef.d.ts index ecbbb13..c827294 100644 --- a/dist/lib/compile/getRef.d.ts +++ b/dist/lib/compile/getRef.d.ts @@ -1,3 +1,3 @@ import { JsonSchema } from "../types"; import { Context } from "./types"; -export default function getRef(context: Context, rootSchema: JsonSchema, $ref: string): JsonSchema; +export default function getRef(context: Context, rootSchema: JsonSchema, $search: string | JsonSchema): JsonSchema; diff --git a/dist/lib/draft04/addRemoteSchema.d.ts b/dist/lib/draft04/addRemoteSchema.d.ts new file mode 100644 index 0000000..6812b56 --- /dev/null +++ b/dist/lib/draft04/addRemoteSchema.d.ts @@ -0,0 +1,8 @@ +import { Draft } from "../draft"; +import { JsonSchema } from "../types"; +/** + * register a json-schema to be referenced from another json-schema + * @param url base-url of json-schema (aka id) + * @param schema + */ +export default function addRemoteSchema(draft: Draft, url: string, schema: JsonSchema): void; diff --git a/dist/lib/draft06/compile/index.d.ts b/dist/lib/draft06/compile/index.d.ts index f0caa4e..7cbd198 100644 --- a/dist/lib/draft06/compile/index.d.ts +++ b/dist/lib/draft06/compile/index.d.ts @@ -1,7 +1,10 @@ import { Draft } from "../../draft"; import { JsonSchema } from "../../types"; /** - * @draft starting with _draft 06_ keyword `id` has been renamed to `$id` + * @draft starting with _draft 2019-09_ plain name fragments are no longer + * defined with $id, but instead with the new keyword $anchor + * (which has a different syntax) + * https://json-schema.org/draft/2019-09/release-notes#incompatible-changes * * compiles the input root schema for $ref resolution and returns it again * @attention this modifies input schema but maintains object-structure diff --git a/dist/lib/draft2019/index.d.ts b/dist/lib/draft2019/index.d.ts new file mode 100644 index 0000000..416ba9e --- /dev/null +++ b/dist/lib/draft2019/index.d.ts @@ -0,0 +1,7 @@ +import { DraftConfig, Draft } from "../draft"; +import { JsonSchema } from "../types"; +declare const draft2019Config: DraftConfig; +declare class Draft2019 extends Draft { + constructor(schema?: JsonSchema, config?: Partial); +} +export { Draft2019, draft2019Config }; diff --git a/dist/lib/draft2019/validation/keyword.d.ts b/dist/lib/draft2019/validation/keyword.d.ts new file mode 100644 index 0000000..f1c5722 --- /dev/null +++ b/dist/lib/draft2019/validation/keyword.d.ts @@ -0,0 +1,3 @@ +import { JsonValidator } from "../../types"; +declare const KeywordValidation: Record; +export default KeywordValidation; diff --git a/dist/lib/features/dependencies.d.ts b/dist/lib/features/dependencies.d.ts index 12c4eeb..fe096cf 100644 --- a/dist/lib/features/dependencies.d.ts +++ b/dist/lib/features/dependencies.d.ts @@ -1,9 +1,10 @@ /** - * @draft-06 + * @draft 06, 2019-09 */ import { JsonSchema, JsonValidator } from "../types"; import { Draft } from "../draft"; /** + * @todo add support for dependentRequired (draft 2019-09) * returns dependencies as an object json schema. does not merge with input * json schema. you probably will need to do so to correctly resolve * references. @@ -11,8 +12,15 @@ import { Draft } from "../draft"; * @returns merged json schema defined by dependencies or undefined */ export declare function resolveDependencies(draft: Draft, schema: JsonSchema, data: unknown): JsonSchema | undefined; +/** + * @draft 2019-09 + */ +export declare const validateDependentRequired: JsonValidator; +/** + * @draft 2019-09 + */ +export declare const validateDependentSchemas: JsonValidator; /** * validate dependencies definition for given input data */ -declare const validateDependencies: JsonValidator; -export { validateDependencies }; +export declare const validateDependencies: JsonValidator; diff --git a/dist/lib/mergeSchema.d.ts b/dist/lib/mergeSchema.d.ts index 450e7bb..16f7d92 100644 --- a/dist/lib/mergeSchema.d.ts +++ b/dist/lib/mergeSchema.d.ts @@ -3,4 +3,6 @@ import { JsonSchema } from "./types"; * merges to two json schema. In case of conflicts, will use overwrite first * schema or directly return first json schema. */ -export declare function mergeSchema(a: JsonSchema, b: JsonSchema): JsonSchema; +export declare function _mergeSchema(a: JsonSchema, b: JsonSchema): JsonSchema; +export declare function mergeSchema(a: T, b: T): T; +export declare function mergeSchema2(a: unknown, b: unknown, property?: string): unknown; diff --git a/dist/lib/resolveRef.merge.d.ts b/dist/lib/resolveRef.merge.d.ts index 5daada5..5b11733 100644 --- a/dist/lib/resolveRef.merge.d.ts +++ b/dist/lib/resolveRef.merge.d.ts @@ -1,2 +1,6 @@ import { JsonSchema } from "./types"; +/** + * @todo update types + * Note: JsonSchema my be false + */ export default function resolveRefMerge(schema: JsonSchema, rootSchema: JsonSchema): JsonSchema; diff --git a/dist/module/index.js b/dist/module/index.js index 3753262..4d4f3d9 100644 --- a/dist/module/index.js +++ b/dist/module/index.js @@ -15,6 +15,7 @@ import { Draft } from "./lib/draft"; import { Draft04, draft04Config } from "./lib/draft04"; import { Draft06, draft06Config } from "./lib/draft06"; import { Draft07, draft07Config } from "./lib/draft07"; +import { Draft2019, draft2019Config } from "./lib/draft2019"; import { JsonEditor, draftJsonEditorConfig } from "./lib/jsoneditor"; import { isJsonError } from "./lib/types"; const config = { strings }; @@ -24,6 +25,8 @@ Draft06, // core implementing draft06 specs draft06Config, // config implementing draft06 specs Draft07, // core implementing draft07 specs draft07Config, // config implementing draft07 specs +Draft2019, // core implementing draft2019-09 specs +draft2019Config, // config implementing draft2019-09 specs draftJsonEditorConfig, // adjusted config of draft04 to better support the json-editor getTypeOf, // returns the javascript datatype isDynamicSchema, // NEW diff --git a/dist/module/lib/addRemoteSchema.js b/dist/module/lib/addRemoteSchema.js index a3856e5..b4c80f5 100644 --- a/dist/module/lib/addRemoteSchema.js +++ b/dist/module/lib/addRemoteSchema.js @@ -4,6 +4,7 @@ * @param schema */ export default function addRemoteSchema(draft, url, schema) { - schema.id = schema.id || url; + // @draft >= 6 + schema.$id = schema.$id || url; draft.remotes[url] = draft.compileSchema(schema); } diff --git a/dist/module/lib/compile/getRef.js b/dist/module/lib/compile/getRef.js index 7593a95..fdde2de 100644 --- a/dist/module/lib/compile/getRef.js +++ b/dist/module/lib/compile/getRef.js @@ -1,71 +1,121 @@ import { get } from "@sagold/json-pointer"; import splitRef from "./splitRef"; import getTypeOf from "../getTypeOf"; -const suffixes = /(#|\/)+$/g; +const suffixes = /(#)+$/g; const isObject = (val) => getTypeOf(val) === "object"; // 1. combined is known // 2. base or pointer is known // 3. base + pointer is known -export default function getRef(context, rootSchema, $ref) { - if (isObject($ref)) { - $ref = $ref.__ref || $ref.$ref; +export default function getRef(context, rootSchema, $search) { + var _a, _b, _c, _d, _e; + let $ref; + if (isObject($search)) { + $ref = $search.__ref || $search.$ref; + } + else { + $ref = $search; } if ($ref == null) { return rootSchema; } + // console.log("\n$ref", $ref); let schema; // is it a known $ref? const $remote = $ref.replace(suffixes, ""); - if (context.remotes[$remote]) { + if (context.remotes[$remote] != null) { schema = context.remotes[$remote]; + // console.log("» remote"); if (schema && schema.$ref) { - return getRef(context, rootSchema, schema.$ref); + // console.log("»» reresolve", schema); + // @todo add missing test for the following line + return getRef(context, schema, schema); } + // console.log("»» return", schema); return schema; } - if (context.ids[$ref]) { + // @ts-expect-error @draft 2019-09 + const $anchor = (_a = context.anchors) === null || _a === void 0 ? void 0 : _a[$ref]; + if ($anchor) { + // console.log("» anchor", $anchor); + return get(rootSchema, $anchor); + } + if (context.ids[$ref] != null) { + // console.log("» id", context.ids[$ref]); schema = get(rootSchema, context.ids[$ref]); if (schema && schema.$ref) { - return getRef(context, rootSchema, schema.$ref); + // @todo add missing test for the following line + return getRef(context, rootSchema, schema); } return schema; } + const $inputRef = $ref; // is it a ref with host/pointer? const fragments = splitRef($ref); if (fragments.length === 0) { return rootSchema; } if (fragments.length === 1) { + // console.log("» frag1", fragments); + // console.log("ids", rootSchema.getContext().ids); $ref = fragments[0]; if (context.remotes[$ref]) { + // console.log("» remote"); schema = context.remotes[$ref]; - return getRef(context, rootSchema, schema.$ref); + if (schema && schema.$ref) { + return getRef(context, rootSchema, schema); + } } if (context.ids[$ref]) { + // console.log("» id"); schema = get(rootSchema, context.ids[$ref]); if (schema && schema.$ref) { - return getRef(context, rootSchema, schema.$ref); + return getRef(context, rootSchema, schema); } return schema; } + // @todo why this special case + const rootContextRef = (_b = rootSchema.getContext) === null || _b === void 0 ? void 0 : _b.call(rootSchema).ids[$ref]; + if (rootContextRef) { + return getRef(context, rootSchema, rootContextRef); + } } if (fragments.length === 2) { + // console.log("» frag2", fragments); const base = fragments[0]; $ref = fragments[1]; - if (context.remotes[base]) { - if (context.remotes[base].getRef) { - return context.remotes[base].getRef($ref); + // @todo this is unnecessary due to inconsistencies + const fromRemote = (_c = context.remotes[base]) !== null && _c !== void 0 ? _c : context.remotes[`${base}/`]; + if (fromRemote) { + // console.log("» remote"); + // We have retrieved a different compiled json-schema. This compiled schema contains a + // separate scope (context) where we might need to work with + // ANCHOR + if (fromRemote.getContext && fromRemote.getContext().anchors[$inputRef] != null) { + // console.log("» remote » anchor"); + // an anchor is stored with its scope (id) it is defined in. Thus collisions are + // avoided, but the current condition is required to resolve the anchor for now + return fromRemote.getRef($inputRef); + } + // PATH (get_ref) + if (fromRemote.getRef) { + // console.log("» remote » ref"); + // resolve the local part of the reference in the new schema + return fromRemote.getRef($ref); } - // console.log("warning: uncompiled remote - context may be wrong", base); - return getRef(context, context.remotes[base], $ref); + //log("warning: uncompiled remote - context may be wrong", base); + return getRef(context, fromRemote, $ref); } - if (context.ids[base]) { - return getRef(context, get(rootSchema, context.ids[base]), $ref); + // @todo this is unnecessary due to inconsistencies + const fromId = (_d = context.ids[base]) !== null && _d !== void 0 ? _d : context.ids[`${base}/`]; + if (fromId) { + // console.log("» id", fromId); + return getRef(context, get(rootSchema, fromId), $ref); } } - schema = get(rootSchema, context.ids[$ref] || $ref); + // console.log("» other"); + schema = get(rootSchema, (_e = context.ids[$ref]) !== null && _e !== void 0 ? _e : $ref); if (schema && schema.$ref) { - return getRef(context, rootSchema, schema.$ref); + return getRef(context, rootSchema, schema); } return schema; } diff --git a/dist/module/lib/compile/joinScope.js b/dist/module/lib/compile/joinScope.js index c75311b..eaf79da 100644 --- a/dist/module/lib/compile/joinScope.js +++ b/dist/module/lib/compile/joinScope.js @@ -1,9 +1,12 @@ /* eslint max-statements-per-line: ["error", { "max": 2 }] */ -const suffixes = /(#|\/)+$/; +const suffixes = /(#)+$/; const trailingHash = /#$/; +const startingHashAndSlash = /^[#/]+/; const isDomain = /^[^:]+:\/\/[^/]+\//; const trailingFragments = /\/[^/]*$/; const idAndPointer = /#.*$/; +// @todo add missing test for urn ids +const isURN = /^urn:uuid:[0-9A-Fa-f]/; export default function joinScope(previous, id) { if (previous == null && id == null) { return "#"; @@ -11,7 +14,10 @@ export default function joinScope(previous, id) { if (id == null) { return previous.replace(trailingHash, ""); } - if (previous == null) { + if (isURN.test(id)) { + return id; + } + if (previous == null || previous === "" || previous === "#") { return id.replace(trailingHash, ""); } if (id[0] === "#") { @@ -20,5 +26,10 @@ export default function joinScope(previous, id) { if (isDomain.test(id)) { return id.replace(trailingHash, ""); } - return `${previous.replace(trailingFragments, "")}/${id.replace(trailingHash, "")}`; + if (isDomain.test(previous) && id.startsWith("/")) { + // we have a domain that should be joined with an absolute path + // thus we have to remove all paths from domain before joining + return `${previous.replace(/(^[^:]+:\/\/[^/]+)(.*)/, "$1")}/${id.replace(startingHashAndSlash, "")}`; + } + return `${previous.replace(trailingFragments, "")}/${id.replace(startingHashAndSlash, "")}`; } diff --git a/dist/module/lib/compile/splitRef.js b/dist/module/lib/compile/splitRef.js index 50bda3d..19b9ecd 100644 --- a/dist/module/lib/compile/splitRef.js +++ b/dist/module/lib/compile/splitRef.js @@ -1,4 +1,4 @@ -const suffixes = /(#|\/)+$/g; +const suffixes = /(#)+$/g; const emptyValues = ["", null, "#"]; export default function splitRef($ref) { if (emptyValues.includes($ref)) { @@ -6,13 +6,13 @@ export default function splitRef($ref) { } $ref = $ref.replace(suffixes, ""); if ($ref.indexOf("#") === -1) { - return [$ref.replace(suffixes, "")]; + return [$ref.replace(/(#|\/)+$/g, "")]; } if ($ref.indexOf("#") === 0) { return [$ref.replace(suffixes, "")]; } const result = $ref.split("#"); - result[0] = result[0].replace(suffixes, ""); + result[0] = result[0].replace(/(#|\/)+$/g, ""); result[1] = `#${result[1].replace(suffixes, "")}`; return result; } diff --git a/dist/module/lib/config/strings.js b/dist/module/lib/config/strings.js index 8d51c9f..61e2ffc 100644 --- a/dist/module/lib/config/strings.js +++ b/dist/module/lib/config/strings.js @@ -9,6 +9,8 @@ export default { containsAnyError: "The array at `{{pointer}}` must contain at least one item", ContainsArrayError: "The property at `{{pointer}}` must not be an array", ContainsError: "The array at `{{pointer}}` must contain an element that matches `{{schema}}`", + ContainsMinError: "The array at `{{pointer}}` contains {{delta}} too few items matching `{{schema}}`", + ContainsMaxError: "The array at `{{pointer}}` contains {{delta}} too many items matching `{{schema}}`", EnumError: "Expected given value `{{value}}` in `{{pointer}}` to be one of `{{values}}`", ForbiddenPropertyError: "Property name `{{property}}` at `{{pointer}}` is not allowed", FormatDateError: "Value `{{value}}` at `{{pointer}}` is not a valid date", @@ -52,6 +54,8 @@ export default { SchemaWarning: "Failed retrieving a schema from '{{pointer}}' to key '{{key}}'", TypeError: "Expected `{{value}}` ({{received}}) in `{{pointer}}` to be of type `{{expected}}`", UndefinedValueError: "Value must not be undefined in `{{pointer}}`", + UnevaluatedPropertyError: "Invalid unevaluated property `{{pointer}}`", + UnevaluatedItemsError: "Invalid unevaluated item `{{pointer}}`", UniqueItemsError: "Items in array must be unique. Value `{{value}}` in `{{pointer}}` is a duplicate of {{duplicatePointer}}.", UnknownPropertyError: "Could not find a valid schema for property `{{pointer}}` within object", ValueNotEmptyError: "A value for `{{property}}` is required at `{{pointer}}`" diff --git a/dist/module/lib/draft04/addRemoteSchema.js b/dist/module/lib/draft04/addRemoteSchema.js new file mode 100644 index 0000000..a3856e5 --- /dev/null +++ b/dist/module/lib/draft04/addRemoteSchema.js @@ -0,0 +1,9 @@ +/** + * register a json-schema to be referenced from another json-schema + * @param url base-url of json-schema (aka id) + * @param schema + */ +export default function addRemoteSchema(draft, url, schema) { + schema.id = schema.id || url; + draft.remotes[url] = draft.compileSchema(schema); +} diff --git a/dist/module/lib/draft04/index.js b/dist/module/lib/draft04/index.js index fb45eba..163d267 100644 --- a/dist/module/lib/draft04/index.js +++ b/dist/module/lib/draft04/index.js @@ -1,4 +1,4 @@ -import addRemoteSchema from "../addRemoteSchema"; +import addRemoteSchema from "./addRemoteSchema"; import compileSchema from "../compileSchema"; import { each } from "../each"; import { eachSchema } from "../eachSchema"; diff --git a/dist/module/lib/draft06/compile/index.js b/dist/module/lib/draft06/compile/index.js index 1c3d21f..518b6cc 100644 --- a/dist/module/lib/draft06/compile/index.js +++ b/dist/module/lib/draft06/compile/index.js @@ -7,9 +7,13 @@ const COMPILED = "__compiled"; const COMPILED_REF = "__ref"; const GET_REF = "getRef"; const GET_ROOT = "getRoot"; +const GET_CONTEXT = "getContext"; const suffixes = /(#|\/)+$/g; /** - * @draft starting with _draft 06_ keyword `id` has been renamed to `$id` + * @draft starting with _draft 2019-09_ plain name fragments are no longer + * defined with $id, but instead with the new keyword $anchor + * (which has a different syntax) + * https://json-schema.org/draft/2019-09/release-notes#incompatible-changes * * compiles the input root schema for $ref resolution and returns it again * @attention this modifies input schema but maintains object-structure @@ -29,10 +33,11 @@ export default function compileSchema(draft, schemaToCompile, rootSchema = schem if (schemaToCompile[COMPILED] !== undefined) { return schemaToCompile; } // eslint-disable-line - const context = { ids: {}, remotes: draft.remotes }; + const context = { ids: {}, anchors: {}, remotes: draft.remotes }; const rootSchemaAsString = JSON.stringify(schemaToCompile); const compiledSchema = JSON.parse(rootSchemaAsString); Object.defineProperty(compiledSchema, COMPILED, { enumerable: false, value: true }); + Object.defineProperty(compiledSchema, GET_CONTEXT, { enumerable: false, value: () => context }); Object.defineProperty(compiledSchema, GET_REF, { enumerable: false, value: getRef.bind(null, context, compiledSchema) @@ -68,11 +73,16 @@ export default function compileSchema(draft, schemaToCompile, rootSchema = schem const parentPointer = pointer.replace(/\/[^/]+\/[^/]+$/, ""); const previousScope = scopes[previousPointer] || scopes[parentPointer]; const scope = joinScope(previousScope, schema.$id); + // // @todo specify behaviour - we do not save ids with trailing slashes... scopes[pointer] = scope; if (context.ids[scope] == null) { context.ids[scope] = pointer; } + if (schema.$anchor) { + context.anchors[`${scope}#${schema.$anchor}`] = pointer; + } if (schema.$ref && !schema[COMPILED_REF]) { + // console.log("JOIN ref", `'${scope}'`, "+", schema.$ref, joinScope(scope, schema.$ref)); Object.defineProperty(schema, COMPILED_REF, { enumerable: false, value: joinScope(scope, schema.$ref) @@ -82,5 +92,7 @@ export default function compileSchema(draft, schemaToCompile, rootSchema = schem // console.log("compiled ref", scope, schema.$ref, "=>", joinScope(scope, schema.$ref)); } }); + // console.log("ids", context.ids); + // console.log("anchors", context.anchors); return compiledSchema; } diff --git a/dist/module/lib/draft06/validation/keyword.js b/dist/module/lib/draft06/validation/keyword.js index bf3b68b..b4ad8e9 100644 --- a/dist/module/lib/draft06/validation/keyword.js +++ b/dist/module/lib/draft06/validation/keyword.js @@ -5,6 +5,7 @@ const KeywordValidation = { ...Keywords, // @draft >= 6 contains: (draft, schema, value, pointer) => { + var _a, _b; if (schema.contains === false) { return draft.errors.containsArrayError({ pointer, value, schema }); } @@ -18,11 +19,24 @@ const KeywordValidation = { // ignore invalid schema return undefined; } + let count = 0; for (let i = 0; i < value.length; i += 1) { if (draft.isValid(value[i], schema.contains)) { - return undefined; + count++; } } + // @draft >= 2019-09 + const max = (_a = schema.maxContains) !== null && _a !== void 0 ? _a : Infinity; + const min = (_b = schema.minContains) !== null && _b !== void 0 ? _b : 1; + if (max >= count && min <= count) { + return undefined; + } + if (max < count) { + return draft.errors.containsMaxError({ pointer, schema, delta: count - max, value }); + } + if (min > count) { + return draft.errors.containsMinError({ pointer, schema, delta: min - count, value }); + } return draft.errors.containsError({ pointer, schema, value }); }, exclusiveMaximum: (draft, schema, value, pointer) => { diff --git a/dist/module/lib/draft2019/index.js b/dist/module/lib/draft2019/index.js new file mode 100644 index 0000000..bcbb017 --- /dev/null +++ b/dist/module/lib/draft2019/index.js @@ -0,0 +1,114 @@ +import addRemoteSchema from "../addRemoteSchema"; +import compileSchema from "../draft06/compile"; +import { each } from "../each"; +import { eachSchema } from "../eachSchema"; +import ERRORS from "../validation/errors"; +import FORMATS from "../validation/format"; +import getSchema from "../getSchema"; +import getTemplate from "../getTemplate"; +import isValid from "../isValid"; +import KEYWORDS from "./validation/keyword"; +import merge from "../utils/merge"; +import { resolveAllOf } from "../features/allOf"; +import { resolveAnyOf } from "../features/anyOf"; +import { resolveOneOf } from "../features/oneOf"; +import createSchemaOf from "../createSchemaOf"; +import getChildSchemaSelection from "../getChildSchemaSelection"; +import step from "../step"; +import TYPES from "../draft06/validation/type"; +import validate from "../validate"; +import { Draft } from "../draft"; +import settings from "../config/settings"; +import resolveRef from "../resolveRef.merge"; +const draft2019Config = { + typeKeywords: { + array: [ + "allOf", + "anyOf", + "contains", + "enum", + "if", + "items", + "maxItems", + "minItems", + "not", + "oneOf", + "unevaluatedItems", + "uniqueItems" + ], + boolean: ["allOf", "anyOf", "enum", "not", "oneOf"], + object: [ + "additionalProperties", + "allOf", + "anyOf", + "dependencies", + "dependentSchemas", + "dependentRequired", + "enum", + "format", + "if", + "maxProperties", + "minProperties", + "not", + "oneOf", + "patternProperties", + "properties", + "propertyNames", + "required", + "unevaluatedProperties" // 2019-09 + ], + string: [ + "allOf", + "anyOf", + "enum", + "format", + "if", + "maxLength", + "minLength", + "not", + "oneOf", + "pattern" + ], + number: [ + "allOf", + "anyOf", + "enum", + "exclusiveMaximum", + "exclusiveMinimum", + "format", + "if", + "maximum", + "minimum", + "multipleOf", + "not", + "oneOf" + ], + null: ["allOf", "anyOf", "enum", "format", "not", "oneOf"] + }, + validateKeyword: KEYWORDS, + validateType: TYPES, + validateFormat: FORMATS, + errors: ERRORS, + addRemoteSchema, + compileSchema, + createSchemaOf, + each, + eachSchema, + getChildSchemaSelection, + getSchema, + getTemplate, + isValid, + resolveAllOf, + resolveAnyOf, + resolveOneOf, + resolveRef, + step, + validate, + templateDefaultOptions: settings.templateDefaultOptions +}; +class Draft2019 extends Draft { + constructor(schema, config = {}) { + super(merge(draft2019Config, config), schema); + } +} +export { Draft2019, draft2019Config }; diff --git a/dist/module/lib/draft2019/validation/keyword.js b/dist/module/lib/draft2019/validation/keyword.js new file mode 100644 index 0000000..fd101b6 --- /dev/null +++ b/dist/module/lib/draft2019/validation/keyword.js @@ -0,0 +1,170 @@ +import Keywords from "../../draft06/validation/keyword"; +import { isObject } from "../../utils/isObject"; +import { reduceSchema } from "../../reduceSchema"; +import { validateDependentSchemas, validateDependentRequired } from "../../features/dependencies"; +/** + * Get a list of tests to search for a matching pattern to a property + */ +const getPatternTests = (patternProperties) => isObject(patternProperties) ? + Object.keys(patternProperties).map((pattern) => new RegExp(pattern)) + : []; +/** tests if a property is evaluated by the given schema */ +function isPropertyEvaluated(draft, objectSchema, propertyName, value) { + var _a, _b; + const schema = draft.resolveRef(objectSchema); + if (schema.additionalProperties === true) { + return true; + } + // PROPERTIES + if (((_a = schema.properties) === null || _a === void 0 ? void 0 : _a[propertyName]) && draft.isValid(value, (_b = schema.properties) === null || _b === void 0 ? void 0 : _b[propertyName])) { + return true; + } + // PATTERN-PROPERTIES + const patterns = getPatternTests(schema.patternProperties); + if (patterns.find(pattern => pattern.test(propertyName))) { + return true; + } + // ADDITIONAL-PROPERTIES + if (isObject(schema.additionalProperties)) { + return draft.validate(value, schema.additionalProperties); + } + return false; +} +const KeywordValidation = { + ...Keywords, + dependencies: undefined, + dependentSchemas: validateDependentSchemas, + dependentRequired: validateDependentRequired, + /** + * @draft >= 2019-09 + * Similar to additionalProperties, but can "see" into subschemas and across references + * https://json-schema.org/draft/2019-09/json-schema-core#rfc.section.9.3.2.4 + */ + unevaluatedProperties: (draft, schema, value, pointer) => { + // if not in properties, evaluated by additionalProperties and not matches patternProperties + // @todo we need to know dynamic parent statements - they should not be counted as evaluated... + if (!isObject(value) || schema.unevaluatedProperties == null) { + return undefined; + } + let unevaluated = Object.keys(value); + if (unevaluated.length === 0) { + return undefined; + } + // resolve all dynamic schemas + const resolvedSchema = reduceSchema(draft, schema, value, pointer); + // console.log("unevaluatedProperties", JSON.stringify(resolvedSchema, null, 2), value); + if (resolvedSchema.unevaluatedProperties === true) { + return undefined; + } + const testPatterns = getPatternTests(resolvedSchema.patternProperties); + unevaluated = unevaluated.filter(key => { + var _a; + if ((_a = resolvedSchema.properties) === null || _a === void 0 ? void 0 : _a[key]) { + return false; + } + // special case: an evaluation in if statement counts too + // we have an unevaluated prop only if the if-schema does not match + if (isObject(schema.if) && isPropertyEvaluated(draft, { type: "object", ...schema.if }, key, value[key])) { + return false; + } + if (testPatterns.find(pattern => pattern.test(key))) { + return false; + } + // @todo is this evaluated by additionaProperties per property + if (resolvedSchema.additionalProperties) { + return false; + } + return true; + }); + if (unevaluated.length === 0) { + return undefined; + } + const errors = []; + if (resolvedSchema.unevaluatedProperties === false) { + unevaluated.forEach(key => { + errors.push(draft.errors.unevaluatedPropertyError({ + pointer: `${pointer}/${key}`, + value: JSON.stringify(value[key]), + schema + })); + }); + return errors; + } + unevaluated.forEach(key => { + const keyErrors = draft.validate(value[key], resolvedSchema.unevaluatedProperties, `${pointer}/${key}`); + errors.push(...keyErrors); + }); + return errors; + }, + /** + * @draft >= 2019-09 + * Similar to additionalItems, but can "see" into subschemas and across references + * https://json-schema.org/draft/2019-09/json-schema-core#rfc.section.9.3.1.3 + */ + unevaluatedItems: (draft, schema, value, pointer) => { + // if not in items, and not matches additionalItems + if (!Array.isArray(value) || value.length === 0 || schema.unevaluatedItems == null || schema.unevaluatedItems === true) { + return undefined; + } + // resolve all dynamic schemas + const resolvedSchema = reduceSchema(draft, draft.resolveRef(schema), value, pointer); + // console.log("unevaluatedItems", JSON.stringify(resolvedSchema, null, 2), value); + if (resolvedSchema.unevaluatedItems === true || resolvedSchema.additionalItems === true) { + return undefined; + } + if (isObject(schema.if)) { + const ifSchema = { type: "array", ...schema.if }; + if (draft.isValid(value, ifSchema)) { + if (Array.isArray(ifSchema.items) && ifSchema.items.length === value.length) { + return undefined; + } + } + // need to test remaining items? + } + if (isObject(resolvedSchema.items)) { + const errors = draft.validate(value, { ...resolvedSchema, unevaluatedItems: undefined }, pointer); + return errors.map(e => draft.errors.unevaluatedItemsError({ ...e.data })); + } + if (Array.isArray(resolvedSchema.items)) { + const items = []; + for (let i = resolvedSchema.items.length; i < value.length; i += 1) { + if (i < resolvedSchema.items.length) { + if (!draft.isValid(value[i], resolvedSchema.items[i])) { + items.push({ index: i, value: value[i] }); + } + } + else { + items.push({ index: i, value: value[i] }); + } + } + return items.map(item => draft.errors.unevaluatedItemsError({ + pointer: `${pointer}/${item.index}`, + value: JSON.stringify(item.value), + schema: resolvedSchema.unevaluatedItems + })); + } + if (isObject(resolvedSchema.unevaluatedItems)) { + return value.map((item, index) => { + if (!draft.isValid(item, resolvedSchema.unevaluatedItems)) { + return draft.errors.unevaluatedItemsError({ + pointer: `${pointer}/${index}`, + value: JSON.stringify(item), + schema: resolvedSchema.unevaluatedItems + }); + } + }); + // const errors = draft.validate(value, { ...schema, unevaluatedItems: undefined }, pointer); + // return errors.map(e => draft.errors.unevaluatedItemsError({ ...e.data })); + } + const errors = []; + value.forEach((item, index) => { + errors.push(draft.errors.unevaluatedItemsError({ + pointer: `${pointer}/${index}`, + value: JSON.stringify(item), + schema + })); + }); + return errors; + } +}; +export default KeywordValidation; diff --git a/dist/module/lib/eachSchema.js b/dist/module/lib/eachSchema.js index 4e91229..a0fa57f 100644 --- a/dist/module/lib/eachSchema.js +++ b/dist/module/lib/eachSchema.js @@ -1,44 +1,58 @@ -import gp from "@sagold/json-pointer"; -import getTypeDefs from "./schema/getTypeDefs"; import { isObject } from "./utils/isObject"; -function nextTypeDefs(schema, pointer) { - if (this.callback(schema, pointer) === true) { - // eslint-disable-line no-invalid-this - return; // stop iteration +function eachProperty(property, schema, callback, pointer) { + const target = schema[property]; + if (!isObject(target)) { + return; } - const defs = getTypeDefs(schema); - // eslint-disable-next-line no-invalid-this - defs.forEach((next) => this.nextTypeDefs(next.def, gp.join(pointer, next.pointer, false))); -} -function eachDefinition(walk, schema, pointer, key = "definitions") { - const defs = schema[key]; - Object.keys(defs).forEach((defId) => { - if (defs[defId] === false || isObject(defs[defId])) { - walk.nextTypeDefs(defs[defId], gp.join(pointer, key, defId, false)); + Object.keys(target).forEach(key => { + if (Array.isArray(target[key])) { + // ignore depndencies list (of properties) return; } - // console.log(`Invalid schema in ${pointer}/${key}/${defId}`); + if (key === "$defs") { + eachProperty("$defs", target[key], callback, `${pointer}/${property}/$defs`); + } + else { + eachSchema(target[key], callback, `${pointer}/${property}/${key}`); + } }); } -export function eachSchema(schema, callback, pointer = "#") { - const walk = { callback, nextTypeDefs }; - walk.nextTypeDefs(schema, pointer); - if (schema.definitions != null) { - walk.callback = (defschema, schemaPointer) => { - callback(defschema, schemaPointer); - if (defschema.definitions != null) { - eachDefinition(walk, defschema, schemaPointer); - } - }; - eachDefinition(walk, schema, pointer); +function eachItem(property, schema, callback, pointer) { + const target = schema[property]; + if (!Array.isArray(target)) { + return; + } + target.forEach((s, key) => eachSchema(s, callback, `${pointer}/${property}/${key}`)); +} +export function eachSchema(schema, callback, pointer = "") { + if (schema === undefined) { + return; + } + // @ts-expect-error untyped + if (callback(schema, pointer) === true) { + return; } - if (schema.$defs != null) { - walk.callback = (defschema, schemaPointer) => { - callback(defschema, schemaPointer); - if (defschema.definitions != null) { - eachDefinition(walk, defschema, schemaPointer); - } - }; - eachDefinition(walk, schema, pointer, "$defs"); + if (!isObject(schema)) { + return; } + eachProperty("properties", schema, callback, pointer); + eachProperty("patternProperties", schema, callback, pointer); + eachSchema(schema.not, callback, `${pointer}/not`); + eachSchema(schema.additionalProperties, callback, `${pointer}/additionalProperties`); + eachProperty("dependencies", schema, callback, pointer); + // items + isObject(schema.items) && eachSchema(schema.items, callback, `${pointer}/items`); + eachItem("items", schema, callback, pointer); + // additional items + eachSchema(schema.additionalItems, callback, `${pointer}/additionalItems`); + // dynamic schemas + eachItem("allOf", schema, callback, pointer); + eachItem("anyOf", schema, callback, pointer); + eachItem("oneOf", schema, callback, pointer); + eachSchema(schema.if, callback, `${pointer}/if`); + eachSchema(schema.then, callback, `${pointer}/then`); + eachSchema(schema.else, callback, `${pointer}/else`); + // definitions + eachProperty("definitions", schema, callback, pointer); + eachProperty("$defs", schema, callback, pointer); } diff --git a/dist/module/lib/features/dependencies.js b/dist/module/lib/features/dependencies.js index 5ba2760..7f90088 100644 --- a/dist/module/lib/features/dependencies.js +++ b/dist/module/lib/features/dependencies.js @@ -3,6 +3,7 @@ import { mergeSchema } from "../mergeSchema"; import { uniqueItems } from "../utils/uniqueItems"; import { isObject } from "../utils/isObject"; /** + * @todo add support for dependentRequired (draft 2019-09) * returns dependencies as an object json schema. does not merge with input * json schema. you probably will need to do so to correctly resolve * references. @@ -10,7 +11,9 @@ import { isObject } from "../utils/isObject"; * @returns merged json schema defined by dependencies or undefined */ export function resolveDependencies(draft, schema, data) { - const { dependencies } = schema; + var _a; + // @draft >= 2019-09 dependentSchemas + const dependencies = (_a = schema.dependencies) !== null && _a !== void 0 ? _a : schema.dependentSchemas; if (!isObject(dependencies) || !isObject(data)) { return; } @@ -41,35 +44,94 @@ export function resolveDependencies(draft, schema, data) { return resolvedSchema; } } +/** + * @draft 2019-09 + */ +export const validateDependentRequired = (draft, schema, value, pointer) => { + const dependentRequired = schema.dependentRequired; + if (!isObject(dependentRequired)) { + return undefined; + } + const errors = []; + Object.keys(value).forEach((property) => { + const dependencies = dependentRequired[property]; + // @draft >= 6 boolean schema + if (dependencies === true) { + return; + } + if (dependencies === false) { + errors.push(draft.errors.missingDependencyError({ pointer, schema, value })); + return; + } + if (!Array.isArray(dependencies)) { + return; + } + for (let i = 0, l = dependencies.length; i < l; i += 1) { + if (value[dependencies[i]] === undefined) { + errors.push(draft.errors.missingDependencyError({ missingProperty: dependencies[i], pointer, schema, value })); + } + } + }); + return errors; +}; +/** + * @draft 2019-09 + */ +export const validateDependentSchemas = (draft, schema, value, pointer) => { + const dependentSchemas = schema.dependentSchemas; + if (!isObject(dependentSchemas)) { + return undefined; + } + const errors = []; + Object.keys(value).forEach((property) => { + const dependencies = dependentSchemas[property]; + // @draft >= 6 boolean schema + if (dependencies === true) { + return; + } + if (dependencies === false) { + errors.push(draft.errors.missingDependencyError({ pointer, schema, value })); + return; + } + if (!isObject(dependencies)) { + return; + } + draft.validate(value, dependencies, pointer).map(error => errors.push(error)); + }); + return errors; +}; /** * validate dependencies definition for given input data */ -const validateDependencies = (draft, schema, value, pointer) => { - if (getTypeOf(schema.dependencies) !== "object") { +export const validateDependencies = (draft, schema, value, pointer) => { + // @draft >= 2019-09 dependentSchemas + const dependencies = schema.dependencies; + if (!isObject(dependencies)) { return undefined; } const errors = []; Object.keys(value).forEach((property) => { - if (schema.dependencies[property] === undefined) { + if (dependencies[property] === undefined) { return; } // @draft >= 6 boolean schema - if (schema.dependencies[property] === true) { + if (dependencies[property] === true) { return; } - if (schema.dependencies[property] === false) { + if (dependencies[property] === false) { errors.push(draft.errors.missingDependencyError({ pointer, schema, value })); return; } let dependencyErrors; - const type = getTypeOf(schema.dependencies[property]); - if (type === "array") { - dependencyErrors = schema.dependencies[property] + const type = getTypeOf(dependencies[property]); + const propertyValue = dependencies[property]; + if (Array.isArray(propertyValue)) { + dependencyErrors = propertyValue .filter((dependency) => value[dependency] === undefined) .map((missingProperty) => draft.errors.missingDependencyError({ missingProperty, pointer, schema, value })); } else if (type === "object") { - dependencyErrors = draft.validate(value, schema.dependencies[property], pointer); + dependencyErrors = draft.validate(value, dependencies[property], pointer); } else { throw new Error(`Invalid dependency definition for ${pointer}/${property}. Must be string[] or schema`); @@ -78,4 +140,3 @@ const validateDependencies = (draft, schema, value, pointer) => { }); return errors.length > 0 ? errors : undefined; }; -export { validateDependencies }; diff --git a/dist/module/lib/mergeSchema.js b/dist/module/lib/mergeSchema.js index c54947f..5a4b951 100644 --- a/dist/module/lib/mergeSchema.js +++ b/dist/module/lib/mergeSchema.js @@ -1,10 +1,11 @@ import { mergeArraysUnique } from "./utils/merge"; import getTypeOf from "./getTypeOf"; +import { isObject } from "./utils/isObject"; /** * merges to two json schema. In case of conflicts, will use overwrite first * schema or directly return first json schema. */ -export function mergeSchema(a, b) { +export function _mergeSchema(a, b) { const aType = getTypeOf(a); const bType = getTypeOf(b); if (aType !== bType) { @@ -25,3 +26,93 @@ export function mergeSchema(a, b) { } return result; } +export function mergeSchema(a, b) { + // console.log("a", JSON.stringify(a, null, 2)); + // console.log("b", JSON.stringify(b, null, 2)); + if ((b === null || b === void 0 ? void 0 : b.type) === "error") { + return b; + } + else if ((a === null || a === void 0 ? void 0 : a.type) === "error") { + return a; + } + const aType = getTypeOf(a); + const bType = getTypeOf(b); + if (aType !== bType) { + return a; + } + const schema = mergeSchema2(a, b); + if (!isObject(schema)) { + return schema; + } + if (a === null || a === void 0 ? void 0 : a.getOneOfOrigin) { + Object.defineProperty(schema, "getOneOfOrigin", { + enumerable: false, + value: a.getOneOfOrigin + }); + } + else if (b === null || b === void 0 ? void 0 : b.getOneOfOrigin) { + Object.defineProperty(schema, "getOneOfOrigin", { + enumerable: false, + value: b.getOneOfOrigin + }); + } + // console.log("result", schema); + return schema; +} +export function mergeSchema2(a, b, property) { + var _a; + if (isObject(a) && isObject(b)) { + const newObject = {}; + [...Object.keys(a), ...Object.keys(b)] + .filter((item, index, array) => array.indexOf(item) === index) + .forEach(key => (newObject[key] = mergeSchema2(a[key], b[key], key))); + return newObject; + } + if (Array.isArray(a) && Array.isArray(b)) { + if (property === "required") { + return a.concat(b).filter((item, index, array) => array.indexOf(item) === index); + } + if (property === "items") { + const result = []; + for (let i = 0; i < b.length; i += 1) { + if (isObject(a[i]) && isObject(b[i]) && a[i].type === b[i].type) { + result[i] = mergeSchema2(a[i], b[i]); + } + else { + result.push((_a = b[i]) !== null && _a !== void 0 ? _a : a[i]); + } + } + return result; + } + const result = []; + const append = []; + for (let i = 0; i < Math.max(a.length, b.length); i += 1) { + if (isObject(a[i]) && isObject(b[i])) { + result[i] = mergeSchema2(a[i], b[i]); + } + else { + if (a[i] !== undefined && b[i] !== undefined) { + result[i] = a[i]; + append.push(b[i]); + } + else if (a[i] !== undefined) { + result[i] = a[i]; + } + else if (b[i] !== undefined) { + append.push(b[i]); + } + } + } + return [...result, ...append].filter((item, index, array) => array.indexOf(item) === index); + } + if (Array.isArray(b)) { + return b; + } + if (Array.isArray(a)) { + return a; + } + if (b !== undefined) { + return b; + } + return a; +} diff --git a/dist/module/lib/resolveRef.merge.js b/dist/module/lib/resolveRef.merge.js index 941955e..550e173 100644 --- a/dist/module/lib/resolveRef.merge.js +++ b/dist/module/lib/resolveRef.merge.js @@ -1,9 +1,18 @@ +import { mergeSchema } from "./mergeSchema"; +/** + * @todo update types + * Note: JsonSchema my be false + */ export default function resolveRefMerge(schema, rootSchema) { if (schema == null || schema.$ref == null) { return schema; } const resolvedSchema = rootSchema.getRef(schema); - const mergedSchema = Object.assign({}, resolvedSchema, schema); + if (resolvedSchema === false) { + return resolvedSchema; + } + // @draft >= 2019-09 we now merge schemas: in draft <= 7 $ref is treated as reference, not as schema + const mergedSchema = mergeSchema(schema, resolvedSchema); delete mergedSchema.$ref; // @todo the following might not be safe nor incomplete Object.defineProperty(mergedSchema, "__ref", { enumerable: false, value: schema.__ref }); diff --git a/dist/module/lib/resolveRef.strict.js b/dist/module/lib/resolveRef.strict.js index 6999905..8f2f794 100644 --- a/dist/module/lib/resolveRef.strict.js +++ b/dist/module/lib/resolveRef.strict.js @@ -6,7 +6,6 @@ export default function resolveRef(schema, rootSchema) { // we actually always need to resolve the schema like this, since returned subschemas // must resolve relative from their schema const resolvedSchema = schema.getRoot().getRef(schema); - // console.log(schema.$ref, "=>", resolvedSchema); return resolvedSchema; } // tryout - this should never be called, except we missed something diff --git a/dist/module/lib/utils/getPrecision.js b/dist/module/lib/utils/getPrecision.js index eed2453..dc0dfb0 100644 --- a/dist/module/lib/utils/getPrecision.js +++ b/dist/module/lib/utils/getPrecision.js @@ -3,6 +3,9 @@ */ export function getPrecision(value) { const string = `${value}`; + if (string.includes("e-")) { + return parseInt(string.replace(/.*e-/, "")); + } const index = string.indexOf("."); return index === -1 ? 0 : string.length - (index + 1); } diff --git a/dist/module/lib/validation/errors.js b/dist/module/lib/validation/errors.js index 61dbdb4..9400dc5 100644 --- a/dist/module/lib/validation/errors.js +++ b/dist/module/lib/validation/errors.js @@ -7,6 +7,8 @@ const errors = { allOfError: createCustomError("AllOfError"), constError: createCustomError("ConstError"), containsError: createCustomError("ContainsError"), + containsMaxError: createCustomError("ContainsMaxError"), + containsMinError: createCustomError("ContainsMinError"), containsArrayError: createCustomError("ContainsArrayError"), containsAnyError: createCustomError("ContainsAnyError"), enumError: createCustomError("EnumError"), @@ -54,6 +56,8 @@ const errors = { schemaWarning: createCustomError("SchemaWarning"), typeError: createCustomError("TypeError"), undefinedValueError: createCustomError("UndefinedValueError"), + unevaluatedPropertyError: createCustomError("UnevaluatedPropertyError"), + unevaluatedItemsError: createCustomError("UnevaluatedItemsError"), uniqueItemsError: createCustomError("UniqueItemsError"), unknownPropertyError: createCustomError("UnknownPropertyError"), valueNotEmptyError: createCustomError("ValueNotEmptyError") diff --git a/dist/module/lib/validation/format.js b/dist/module/lib/validation/format.js index f337abf..e184ee1 100644 --- a/dist/module/lib/validation/format.js +++ b/dist/module/lib/validation/format.js @@ -137,7 +137,7 @@ const formatValidators = { return draft.errors.formatJsonPointerError({ value, pointer, schema }); }, "relative-json-pointer": (draft, schema, value, pointer) => { - if (typeof value !== "string" || value === "") { + if (typeof value !== "string") { return undefined; } if (isValidRelativeJsonPointer.test(value)) {