indexeddb-fs
Advanced tools
Comparing version 1.1.1 to 1.1.2
@@ -28,3 +28,4 @@ import { FileEntry, DirectoryEntry } from "../../types"; | ||
writeFile: <TData = any>(fullPath: string, data: TData) => Promise<FileEntry<TData>>; | ||
renameFile: <TData = any>(fullPath: string, newFilename: string) => Promise<FileEntry<TData>>; | ||
copyFile: <TData = any>(sourcePath: string, destinationPath: string) => Promise<FileEntry<TData>>; | ||
} |
@@ -8,2 +8,3 @@ export * from './exists-decorator/exists-decorator.function'; | ||
export * from './write-file-decorator/write-file-decorator.function'; | ||
export * from './rename-file-decorator/rename-file-decorator.function'; | ||
export * from './remove-file-decorator/remove-file-decorator.function'; | ||
@@ -16,3 +17,4 @@ export * from './is-directory-decorator/is-directory-decorator.function'; | ||
export * from './directory-details-decorator/directory-details-decorator.function'; | ||
export * from './update-file-details-decorator/update-file-details-decorator.function'; | ||
export * from './create-root-directory-decorator/create-root-directory-decorator.function'; | ||
export * from './read-directory-decorator/read-directory-decorator.types'; |
@@ -1,2 +0,6 @@ | ||
export * from './functions'; | ||
export * from './indexeddb'; | ||
export * from './is-valid-path/is-valid-path.function'; | ||
export * from './starts-with-slash/starts-with-slash.function'; | ||
export * from './validate-create-fs-props/validate-create-fs-props.function'; | ||
export * from './has-root-directory-prefix/has-root-directory-prefix.function'; | ||
export * from './with-root-directory-prefix/with-root-directory-prefix.function'; | ||
export * from './format-and-validate-full-path/format-and-validate-full-path.function'; |
@@ -15,3 +15,3 @@ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["indexeddb-fs"]={})}(this,(function(e){"use strict"; | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */function t(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{u(n.next(e))}catch(e){o(e)}}function s(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}u((n=n.apply(e,t||[])).next())}))}function r(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}var n=function(e){return"string"==typeof e||e instanceof String},i=function(e,n){return t(void 0,void 0,void 0,(function(){var t;return r(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,e()];case 1:return[2,r.sent()];case 2:return t=r.sent(),n&&n(t),[3,3];case 3:return[2,null]}}))}))},o=new RegExp("^([A-Za-z]:|[A-Za-z0-9_-]+(.[A-Za-z0-9_-]+)*)((/[A-Za-z0-9_.-]+)+)$");function a(e){if(e.__esModule)return e;var t=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(e).forEach((function(r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})})),t} | ||
/*! https://mths.be/punycode v1.4.1 by @mathias */var s=2147483647,u=/[^\x20-\x7E]/,c=/[\x2E\u3002\uFF0E\uFF61]/g,f={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},h=Math.floor,l=String.fromCharCode;function m(e){throw new RangeError(f[e])}function d(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function p(e,t,r){var n=0;for(e=r?h(e/700):e>>1,e+=h(e/t);e>455;n+=36)e=h(e/35);return h(n+36*e/(e+38))}function v(e){return function(e,t){var r=e.split("@"),n="";r.length>1&&(n=r[0]+"@",e=r[1]);var i=function(e,t){for(var r=e.length,n=[];r--;)n[r]=t(e[r]);return n}((e=e.replace(c,".")).split("."),t).join(".");return n+i}(e,(function(e){return u.test(e)?"xn--"+function(e){var t,r,n,i,o,a,u,c,f,v,y,b,g,w,A,x=[];for(b=(e=function(e){for(var t,r,n=[],i=0,o=e.length;i<o;)(t=e.charCodeAt(i++))>=55296&&t<=56319&&i<o?56320==(64512&(r=e.charCodeAt(i++)))?n.push(((1023&t)<<10)+(1023&r)+65536):(n.push(t),i--):n.push(t);return n}(e)).length,t=128,r=0,o=72,a=0;a<b;++a)(y=e[a])<128&&x.push(l(y));for(n=i=x.length,i&&x.push("-");n<b;){for(u=s,a=0;a<b;++a)(y=e[a])>=t&&y<u&&(u=y);for(u-t>h((s-r)/(g=n+1))&&m("overflow"),r+=(u-t)*g,t=u,a=0;a<b;++a)if((y=e[a])<t&&++r>s&&m("overflow"),y==t){for(c=r,f=36;!(c<(v=f<=o?1:f>=o+26?26:f-o));f+=36)A=c-v,w=36-v,x.push(l(d(v+A%w,0))),c=h(A/w);x.push(l(d(c,0))),o=p(r,g,n==i),r=0,++n}++r,++t}return x.join("")}(e):e}))}function y(e){return null===e}function b(e){return"string"==typeof e}function g(e){return"object"==typeof e&&null!==e}function w(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var A=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function x(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}}function E(e,t){if(e.map)return e.map(t);for(var r=[],n=0;n<e.length;n++)r.push(t(e[n],n));return r}var O=Object.keys||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t};function j(e,t,r,n){t=t||"&",r=r||"=";var i={};if("string"!=typeof e||0===e.length)return i;var o=/\+/g;e=e.split(t);var a=1e3;n&&"number"==typeof n.maxKeys&&(a=n.maxKeys);var s=e.length;a>0&&s>a&&(s=a);for(var u=0;u<s;++u){var c,f,h,l,m=e[u].replace(o,"%20"),d=m.indexOf(r);d>=0?(c=m.substr(0,d),f=m.substr(d+1)):(c=m,f=""),h=decodeURIComponent(c),l=decodeURIComponent(f),w(i,h)?A(i[h])?i[h].push(l):i[h]=[i[h],l]:i[h]=l}return i}var S={parse:M,resolve:U,resolveObject:B,format:L,Url:F};function F(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var z=/^([a-z0-9.+-]+:)/i,D=/:[0-9]*$/,P=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,N=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),$=["'"].concat(N),Z=["%","/","?",";","#"].concat($),R=["/","?","#"],I=/^[+a-z0-9A-Z_-]{0,63}$/,C=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,k={javascript:!0,"javascript:":!0},_={javascript:!0,"javascript:":!0},q={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function M(e,t,r){if(e&&g(e)&&e instanceof F)return e;var n=new F;return n.parse(e,t,r),n}function V(e,t,r,n){if(!b(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var i=t.indexOf("?"),o=-1!==i&&i<t.indexOf("#")?"?":"#",a=t.split(o);a[0]=a[0].replace(/\\/g,"/");var s=t=a.join(o);if(s=s.trim(),!n&&1===t.split("#").length){var u=P.exec(s);if(u)return e.path=s,e.href=s,e.pathname=u[1],u[2]?(e.search=u[2],e.query=r?j(e.search.substr(1)):e.search.substr(1)):r&&(e.search="",e.query={}),e}var c,f,h,l,m=z.exec(s);if(m){var d=(m=m[0]).toLowerCase();e.protocol=d,s=s.substr(m.length)}if(n||m||s.match(/^\/\/[^@\/]+@[^@\/]+/)){var p="//"===s.substr(0,2);!p||m&&_[m]||(s=s.substr(2),e.slashes=!0)}if(!_[m]&&(p||m&&!q[m])){var y,g,w=-1;for(c=0;c<R.length;c++)-1!==(f=s.indexOf(R[c]))&&(-1===w||f<w)&&(w=f);for(-1!==(g=-1===w?s.lastIndexOf("@"):s.lastIndexOf("@",w))&&(y=s.slice(0,g),s=s.slice(g+1),e.auth=decodeURIComponent(y)),w=-1,c=0;c<Z.length;c++)-1!==(f=s.indexOf(Z[c]))&&(-1===w||f<w)&&(w=f);-1===w&&(w=s.length),e.host=s.slice(0,w),s=s.slice(w),J(e),e.hostname=e.hostname||"";var A="["===e.hostname[0]&&"]"===e.hostname[e.hostname.length-1];if(!A){var x=e.hostname.split(/\./);for(c=0,h=x.length;c<h;c++){var E=x[c];if(E&&!E.match(I)){for(var O="",S=0,F=E.length;S<F;S++)E.charCodeAt(S)>127?O+="x":O+=E[S];if(!O.match(I)){var D=x.slice(0,c),N=x.slice(c+1),M=E.match(C);M&&(D.push(M[1]),N.unshift(M[2])),N.length&&(s="/"+N.join(".")+s),e.hostname=D.join(".");break}}}}e.hostname.length>255?e.hostname="":e.hostname=e.hostname.toLowerCase(),A||(e.hostname=v(e.hostname)),l=e.port?":"+e.port:"";var V=e.hostname||"";e.host=V+l,e.href+=e.host,A&&(e.hostname=e.hostname.substr(1,e.hostname.length-2),"/"!==s[0]&&(s="/"+s))}if(!k[d])for(c=0,h=$.length;c<h;c++){var L=$[c];if(-1!==s.indexOf(L)){var U=encodeURIComponent(L);U===L&&(U=escape(L)),s=s.split(L).join(U)}}var B=s.indexOf("#");-1!==B&&(e.hash=s.substr(B),s=s.slice(0,B));var Y=s.indexOf("?");if(-1!==Y?(e.search=s.substr(Y),e.query=s.substr(Y+1),r&&(e.query=j(e.query)),s=s.slice(0,Y)):r&&(e.search="",e.query={}),s&&(e.pathname=s),q[d]&&e.hostname&&!e.pathname&&(e.pathname="/"),e.pathname||e.search){l=e.pathname||"";var G=e.search||"";e.path=l+G}return e.href=T(e),e}function L(e){return b(e)&&(e=V({},e)),T(e)}function T(e){var t=e.auth||"";t&&(t=(t=encodeURIComponent(t)).replace(/%3A/i,":"),t+="@");var r=e.protocol||"",n=e.pathname||"",i=e.hash||"",o=!1,a="";e.host?o=t+e.host:e.hostname&&(o=t+(-1===e.hostname.indexOf(":")?e.hostname:"["+this.hostname+"]"),e.port&&(o+=":"+e.port)),e.query&&g(e.query)&&Object.keys(e.query).length&&(a=function(e,t,r,n){return t=t||"&",r=r||"=",null===e&&(e=void 0),"object"==typeof e?E(O(e),(function(n){var i=encodeURIComponent(x(n))+r;return A(e[n])?E(e[n],(function(e){return i+encodeURIComponent(x(e))})).join(t):i+encodeURIComponent(x(e[n]))})).join(t):n?encodeURIComponent(x(n))+r+encodeURIComponent(x(e)):""}(e.query));var s=e.search||a&&"?"+a||"";return r&&":"!==r.substr(-1)&&(r+=":"),e.slashes||(!r||q[r])&&!1!==o?(o="//"+(o||""),n&&"/"!==n.charAt(0)&&(n="/"+n)):o||(o=""),i&&"#"!==i.charAt(0)&&(i="#"+i),s&&"?"!==s.charAt(0)&&(s="?"+s),r+o+(n=n.replace(/[?#]/g,(function(e){return encodeURIComponent(e)})))+(s=s.replace("#","%23"))+i}function U(e,t){return M(e,!1,!0).resolve(t)}function B(e,t){return e?M(e,!1,!0).resolveObject(t):t}function J(e){var t=e.host,r=D.exec(t);r&&(":"!==(r=r[0])&&(e.port=r.substr(1)),t=t.substr(0,t.length-r.length)),t&&(e.hostname=t)}F.prototype.parse=function(e,t,r){return V(this,e,t,r)},F.prototype.format=function(){return T(this)},F.prototype.resolve=function(e){return this.resolveObject(M(e,!1,!0)).format()},F.prototype.resolveObject=function(e){if(b(e)){var t=new F;t.parse(e,!1,!0),e=t}for(var r,n=new F,i=Object.keys(this),o=0;o<i.length;o++){var a=i[o];n[a]=this[a]}if(n.hash=e.hash,""===e.href)return n.href=n.format(),n;if(e.slashes&&!e.protocol){for(var s=Object.keys(e),u=0;u<s.length;u++){var c=s[u];"protocol"!==c&&(n[c]=e[c])}return q[n.protocol]&&n.hostname&&!n.pathname&&(n.path=n.pathname="/"),n.href=n.format(),n}if(e.protocol&&e.protocol!==n.protocol){if(!q[e.protocol]){for(var f=Object.keys(e),h=0;h<f.length;h++){var l=f[h];n[l]=e[l]}return n.href=n.format(),n}if(n.protocol=e.protocol,e.host||_[e.protocol])n.pathname=e.pathname;else{for(r=(e.pathname||"").split("/");r.length&&!(e.host=r.shift()););e.host||(e.host=""),e.hostname||(e.hostname=""),""!==r[0]&&r.unshift(""),r.length<2&&r.unshift(""),n.pathname=r.join("/")}if(n.search=e.search,n.query=e.query,n.host=e.host||"",n.auth=e.auth,n.hostname=e.hostname||e.host,n.port=e.port,n.pathname||n.search){var m=n.pathname||"",d=n.search||"";n.path=m+d}return n.slashes=n.slashes||e.slashes,n.href=n.format(),n}var p,v=n.pathname&&"/"===n.pathname.charAt(0),g=e.host||e.pathname&&"/"===e.pathname.charAt(0),w=g||v||n.host&&e.pathname,A=w,x=n.pathname&&n.pathname.split("/")||[],E=n.protocol&&!q[n.protocol];if(r=e.pathname&&e.pathname.split("/")||[],E&&(n.hostname="",n.port=null,n.host&&(""===x[0]?x[0]=n.host:x.unshift(n.host)),n.host="",e.protocol&&(e.hostname=null,e.port=null,e.host&&(""===r[0]?r[0]=e.host:r.unshift(e.host)),e.host=null),w=w&&(""===r[0]||""===x[0])),g)n.host=e.host||""===e.host?e.host:n.host,n.hostname=e.hostname||""===e.hostname?e.hostname:n.hostname,n.search=e.search,n.query=e.query,x=r;else if(r.length)x||(x=[]),x.pop(),x=x.concat(r),n.search=e.search,n.query=e.query;else if(null!=e.search)return E&&(n.hostname=n.host=x.shift(),(p=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=p.shift(),n.host=n.hostname=p.shift())),n.search=e.search,n.query=e.query,y(n.pathname)&&y(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n;if(!x.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var O=x.slice(-1)[0],j=(n.host||e.host||x.length>1)&&("."===O||".."===O)||""===O,S=0,z=x.length;z>=0;z--)"."===(O=x[z])?x.splice(z,1):".."===O?(x.splice(z,1),S++):S&&(x.splice(z,1),S--);if(!w&&!A)for(;S--;S)x.unshift("..");!w||""===x[0]||x[0]&&"/"===x[0].charAt(0)||x.unshift(""),j&&"/"!==x.join("/").substr(-1)&&x.push("");var D=""===x[0]||x[0]&&"/"===x[0].charAt(0);return E&&(n.hostname=n.host=D?"":x.length?x.shift():"",(p=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=p.shift(),n.host=n.hostname=p.shift())),(w=w||n.host&&x.length)&&!D&&x.unshift(""),x.length?n.pathname=x.join("/"):(n.pathname=null,n.path=null),y(n.pathname)&&y(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=e.auth||n.auth,n.slashes=n.slashes||e.slashes,n.href=n.format(),n},F.prototype.parseHost=function(){return J(this)};var Y=a(Object.freeze({__proto__:null,parse:M,resolve:U,resolveObject:B,format:L,default:S,Url:F})),G={},K=Y,H=G.ValidationError=function(e,t,r,n,i,o){if(Array.isArray(n)?(this.path=n,this.property=n.reduce((function(e,t){return e+ne(t)}),"instance")):void 0!==n&&(this.property=n),e&&(this.message=e),r){var a=r.$id||r.id;this.schema=a||r}void 0!==t&&(this.instance=t),this.name=i,this.argument=o,this.stack=this.toString()};H.prototype.toString=function(){return this.property+" "+this.message};var W=G.ValidatorResult=function(e,t,r,n){this.instance=e,this.schema=t,this.options=r,this.path=n.path,this.propertyPath=n.propertyPath,this.errors=[],this.throwError=r&&r.throwError,this.throwFirst=r&&r.throwFirst,this.throwAll=r&&r.throwAll,this.disableFormat=r&&!0===r.disableFormat};function X(e,t){return t+": "+e.toString()+"\n"}function Q(e){Error.captureStackTrace&&Error.captureStackTrace(this,Q),this.instance=e.instance,this.schema=e.schema,this.options=e.options,this.errors=e.errors}W.prototype.addError=function(e){var t;if("string"==typeof e)t=new H(e,this.instance,this.schema,this.path);else{if(!e)throw new Error("Missing error detail");if(!e.message)throw new Error("Missing error message");if(!e.name)throw new Error("Missing validator type");t=new H(e.message,this.instance,this.schema,this.path,e.name,e.argument)}if(this.errors.push(t),this.throwFirst)throw new Q(this);if(this.throwError)throw t;return t},W.prototype.importErrors=function(e){"string"==typeof e||e&&e.validatorType?this.addError(e):e&&e.errors&&Array.prototype.push.apply(this.errors,e.errors)},W.prototype.toString=function(e){return this.errors.map(X).join("")},Object.defineProperty(W.prototype,"valid",{get:function(){return!this.errors.length}}),G.ValidatorResultError=Q,Q.prototype=new Error,Q.prototype.constructor=Q,Q.prototype.name="Validation Error";var ee=G.SchemaError=function e(t,r){this.message=t,this.schema=r,Error.call(this,t),Error.captureStackTrace(this,e)};ee.prototype=Object.create(Error.prototype,{constructor:{value:ee,enumerable:!1},name:{value:"SchemaError",enumerable:!1}});var te=G.SchemaContext=function(e,t,r,n,i){this.schema=e,this.options=t,Array.isArray(r)?(this.path=r,this.propertyPath=r.reduce((function(e,t){return e+ne(t)}),"instance")):this.propertyPath=r,this.base=n,this.schemas=i};te.prototype.resolve=function(e){return K.resolve(this.base,e)},te.prototype.makeChild=function(e,t){var r=void 0===t?this.path:this.path.concat([t]),n=e.$id||e.id,i=K.resolve(this.base,n||""),o=new te(e,this.options,r,i,Object.create(this.schemas));return n&&!o.schemas[i]&&(o.schemas[i]=e),o};var re=G.FORMAT_REGEXPS={"date-time":/^\d{4}-(?:0[0-9]{1}|1[0-2]{1})-(3[01]|0[1-9]|[12][0-9])[tT ](2[0-4]|[01][0-9]):([0-5][0-9]):(60|[0-5][0-9])(\.\d+)?([zZ]|[+-]([0-5][0-9]):(60|[0-5][0-9]))$/,date:/^\d{4}-(?:0[0-9]{1}|1[0-2]{1})-(3[01]|0[1-9]|[12][0-9])$/,time:/^(2[0-4]|[01][0-9]):([0-5][0-9]):(60|[0-5][0-9])$/,email:/^(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+@(?:(?:(?:[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!\.)){0,61}[a-zA-Z0-9]?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!$)){0,61}[a-zA-Z0-9]?)|(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\]))$/,"ip-address":/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,ipv6:/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-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-Fa-f]{1,4}:){5}(((:[0-9A-Fa-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-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-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-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-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-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-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-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-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-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-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}))|:)))(%.+)?\s*$/,uri:/^[a-zA-Z][a-zA-Z0-9+-.]*:[^\s]*$/,"uri-reference":/^(((([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|([A-Za-z][+\-.0-9A-Za-z]*:?)?)|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|(\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?)?))#(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|(([A-Za-z][+\-.0-9A-Za-z]*)?%[0-9A-Fa-f]{2}|[!$&-.0-9;=@_~]|[A-Za-z][+\-.0-9A-Za-z]*[!$&-*,;=@_~])(%[0-9A-Fa-f]{2}|[!$&-.0-9;=@-Z_a-z~])*((([/?](%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*)?#|[/?])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*)?|([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+(:\d*)?|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?:\d*|\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)?|[A-Za-z][+\-.0-9A-Za-z]*:?)?$/,color:/^(#?([0-9A-Fa-f]{3}){1,2}\b|aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow|(rgb\(\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*\))|(rgb\(\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*\)))$/,hostname:/^(?=.{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])?)*\.?$/,"host-name":/^(?=.{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])?)*\.?$/,alpha:/^[a-zA-Z]+$/,alphanumeric:/^[a-zA-Z0-9]+$/,"utc-millisec":function(e){return"string"==typeof e&&parseFloat(e)===parseInt(e,10)&&!isNaN(e)},regex:function(e){var t=!0;try{new RegExp(e)}catch(e){t=!1}return t},style:/\s*(.+?):\s*([^;]+);?/,phone:/^\+(?:[0-9] ?){6,14}[0-9]$/};re.regexp=re.regex,re.pattern=re.regex,re.ipv4=re["ip-address"],G.isFormat=function(e,t,r){if("string"==typeof e&&void 0!==re[t]){if(re[t]instanceof RegExp)return re[t].test(e);if("function"==typeof re[t])return re[t](e)}else if(r&&r.customFormats&&"function"==typeof r.customFormats[t])return r.customFormats[t](e);return!0};var ne=G.makeSuffix=function(e){return(e=e.toString()).match(/[.\s\[\]]/)||e.match(/^[\d]/)?e.match(/^\d+$/)?"["+e+"]":"["+JSON.stringify(e)+"]":"."+e};function ie(e,t,r,n){"object"==typeof r?t[n]=se(e[n],r):-1===e.indexOf(r)&&t.push(r)}function oe(e,t,r){t[r]=e[r]}function ae(e,t,r,n){"object"==typeof t[n]&&t[n]&&e[n]?r[n]=se(e[n],t[n]):r[n]=t[n]}function se(e,t){var r=Array.isArray(t),n=r&&[]||{};return r?(e=e||[],n=n.concat(e),t.forEach(ie.bind(null,e,n))):(e&&"object"==typeof e&&Object.keys(e).forEach(oe.bind(null,e,n)),Object.keys(t).forEach(ae.bind(null,e,t,n))),n}function ue(e){return"/"+encodeURIComponent(e).replace(/~/g,"%7E")}G.deepCompareStrict=function e(t,r){if(typeof t!=typeof r)return!1;if(Array.isArray(t))return!!Array.isArray(r)&&(t.length===r.length&&t.every((function(n,i){return e(t[i],r[i])})));if("object"==typeof t){if(!t||!r)return t===r;var n=Object.keys(t),i=Object.keys(r);return n.length===i.length&&n.every((function(n){return e(t[n],r[n])}))}return t===r},G.deepMerge=se,G.objectGetPath=function(e,t){for(var r,n=t.split("/").slice(1);"string"==typeof(r=n.shift());){var i=decodeURIComponent(r.replace(/~0/,"~").replace(/~1/g,"/"));if(!(i in e))return;e=e[i]}return e},G.encodePath=function(e){return e.map(ue).join("")},G.getDecimalPlaces=function(e){var t=0;if(isNaN(e))return t;"number"!=typeof e&&(e=Number(e));var r=e.toString().split("e");if(2===r.length){if("-"!==r[1][0])return t;t=Number(r[1].slice(1))}var n=r[0].split(".");return 2===n.length&&(t+=n[1].length),t},G.isSchema=function(e){return"object"==typeof e&&e||"boolean"==typeof e};var ce=G,fe=ce.ValidatorResult,he=ce.SchemaError,le={ignoreProperties:{id:!0,default:!0,description:!0,title:!0,additionalItems:!0,then:!0,else:!0,$schema:!0,$ref:!0,extends:!0}},me=le.validators={};function de(e,t,r,n,i){var o=t.throwError,a=t.throwAll;t.throwError=!1,t.throwAll=!1;var s=this.validateSchema(e,i,t,r);return t.throwError=o,t.throwAll=a,!s.valid&&n instanceof Function&&n(s),s.valid}function pe(e,t){if(Object.hasOwnProperty.call(e,t))return e[t];if(t in e)for(;e=Object.getPrototypeOf(e);)if(Object.propertyIsEnumerable.call(e,t))return e[t]}function ve(e,t,r,n,i,o){if(this.types.object(e)&&(!t.properties||void 0===t.properties[i]))if(!1===t.additionalProperties)o.addError({name:"additionalProperties",argument:i,message:"is not allowed to have the additional property "+JSON.stringify(i)});else{var a=t.additionalProperties||{};"function"==typeof r.preValidateProperty&&r.preValidateProperty(e,i,a,r,n);var s=this.validateSchema(e[i],a,r,n.makeChild(a,i));s.instance!==o.instance[i]&&(o.instance[i]=s.instance),o.importErrors(s)}}me.type=function(e,t,r,n){if(void 0===e)return null;var i=new fe(e,t,r,n),o=Array.isArray(t.type)?t.type:[t.type];if(!o.some(this.testType.bind(this,e,t,r,n))){var a=o.map((function(e){if(e){var t=e.$id||e.id;return t?"<"+t+">":e+""}}));i.addError({name:"type",argument:a,message:"is not of a type(s) "+a})}return i},me.anyOf=function(e,t,r,n){if(void 0===e)return null;var i=new fe(e,t,r,n),o=new fe(e,t,r,n);if(!Array.isArray(t.anyOf))throw new he("anyOf must be an array");if(!t.anyOf.some(de.bind(this,e,r,n,(function(e){o.importErrors(e)})))){var a=t.anyOf.map((function(e,t){var r=e.$id||e.id;return r?"<"+r+">":e.title&&JSON.stringify(e.title)||e.$ref&&"<"+e.$ref+">"||"[subschema "+t+"]"}));r.nestedErrors&&i.importErrors(o),i.addError({name:"anyOf",argument:a,message:"is not any of "+a.join(",")})}return i},me.allOf=function(e,t,r,n){if(void 0===e)return null;if(!Array.isArray(t.allOf))throw new he("allOf must be an array");var i=new fe(e,t,r,n),o=this;return t.allOf.forEach((function(t,a){var s=o.validateSchema(e,t,r,n);if(!s.valid){var u=t.$id||t.id||t.title&&JSON.stringify(t.title)||t.$ref&&"<"+t.$ref+">"||"[subschema "+a+"]";i.addError({name:"allOf",argument:{id:u,length:s.errors.length,valid:s},message:"does not match allOf schema "+u+" with "+s.errors.length+" error[s]:"}),i.importErrors(s)}})),i},me.oneOf=function(e,t,r,n){if(void 0===e)return null;if(!Array.isArray(t.oneOf))throw new he("oneOf must be an array");var i=new fe(e,t,r,n),o=new fe(e,t,r,n),a=t.oneOf.filter(de.bind(this,e,r,n,(function(e){o.importErrors(e)}))).length,s=t.oneOf.map((function(e,t){return e.$id||e.id||e.title&&JSON.stringify(e.title)||e.$ref&&"<"+e.$ref+">"||"[subschema "+t+"]"}));return 1!==a&&(r.nestedErrors&&i.importErrors(o),i.addError({name:"oneOf",argument:s,message:"is not exactly one from "+s.join(",")})),i},me.if=function(e,t,r,n){if(void 0===e)return null;if(!ce.isSchema(t.if))throw new Error('Expected "if" keyword to be a schema');var i,o=de.call(this,e,r,n,null,t.if),a=new fe(e,t,r,n);if(o){if(void 0===t.then)return;if(!ce.isSchema(t.then))throw new Error('Expected "then" keyword to be a schema');i=this.validateSchema(e,t.then,r,n.makeChild(t.then)),a.importErrors(i)}else{if(void 0===t.else)return;if(!ce.isSchema(t.else))throw new Error('Expected "else" keyword to be a schema');i=this.validateSchema(e,t.else,r,n.makeChild(t.else)),a.importErrors(i)}return a},me.propertyNames=function(e,t,r,n){if(this.types.object(e)){var i=new fe(e,t,r,n),o=void 0!==t.propertyNames?t.propertyNames:{};if(!ce.isSchema(o))throw new he('Expected "propertyNames" to be a schema (object or boolean)');for(var a in e)if(void 0!==pe(e,a)){var s=this.validateSchema(a,o,r,n.makeChild(o));i.importErrors(s)}return i}},me.properties=function(e,t,r,n){if(this.types.object(e)){var i=new fe(e,t,r,n),o=t.properties||{};for(var a in o){var s=o[a];if(void 0!==s){if(null===s)throw new he('Unexpected null, expected schema in "properties"');"function"==typeof r.preValidateProperty&&r.preValidateProperty(e,a,s,r,n);var u=pe(e,a),c=this.validateSchema(u,s,r,n.makeChild(s,a));c.instance!==i.instance[a]&&(i.instance[a]=c.instance),i.importErrors(c)}}return i}},me.patternProperties=function(e,t,r,n){if(this.types.object(e)){var i=new fe(e,t,r,n),o=t.patternProperties||{};for(var a in e){var s=!0;for(var u in o){var c=o[u];if(void 0!==c){if(null===c)throw new he('Unexpected null, expected schema in "patternProperties"');try{var f=new RegExp(u,"u")}catch(e){f=new RegExp(u)}if(f.test(a)){s=!1,"function"==typeof r.preValidateProperty&&r.preValidateProperty(e,a,c,r,n);var h=this.validateSchema(e[a],c,r,n.makeChild(c,a));h.instance!==i.instance[a]&&(i.instance[a]=h.instance),i.importErrors(h)}}}s&&ve.call(this,e,t,r,n,a,i)}return i}},me.additionalProperties=function(e,t,r,n){if(this.types.object(e)){if(t.patternProperties)return null;var i=new fe(e,t,r,n);for(var o in e)ve.call(this,e,t,r,n,o,i);return i}},me.minProperties=function(e,t,r,n){if(this.types.object(e)){var i=new fe(e,t,r,n);return Object.keys(e).length>=t.minProperties||i.addError({name:"minProperties",argument:t.minProperties,message:"does not meet minimum property length of "+t.minProperties}),i}},me.maxProperties=function(e,t,r,n){if(this.types.object(e)){var i=new fe(e,t,r,n);return Object.keys(e).length<=t.maxProperties||i.addError({name:"maxProperties",argument:t.maxProperties,message:"does not meet maximum property length of "+t.maxProperties}),i}},me.items=function(e,t,r,n){var i=this;if(this.types.array(e)&&t.items){var o=new fe(e,t,r,n);return e.every((function(e,a){var s=Array.isArray(t.items)?t.items[a]||t.additionalItems:t.items;if(void 0===s)return!0;if(!1===s)return o.addError({name:"items",message:"additionalItems not permitted"}),!1;var u=i.validateSchema(e,s,r,n.makeChild(s,a));return u.instance!==o.instance[a]&&(o.instance[a]=u.instance),o.importErrors(u),!0})),o}},me.minimum=function(e,t,r,n){if(this.types.number(e)){var i=new fe(e,t,r,n);return t.exclusiveMinimum&&!0===t.exclusiveMinimum?e>t.minimum||i.addError({name:"minimum",argument:t.minimum,message:"must be greater than "+t.minimum}):e>=t.minimum||i.addError({name:"minimum",argument:t.minimum,message:"must be greater than or equal to "+t.minimum}),i}},me.maximum=function(e,t,r,n){if(this.types.number(e)){var i=new fe(e,t,r,n);return t.exclusiveMaximum&&!0===t.exclusiveMaximum?e<t.maximum||i.addError({name:"maximum",argument:t.maximum,message:"must be less than "+t.maximum}):e<=t.maximum||i.addError({name:"maximum",argument:t.maximum,message:"must be less than or equal to "+t.maximum}),i}},me.exclusiveMinimum=function(e,t,r,n){if("boolean"!=typeof t.exclusiveMaximum&&this.types.number(e)){var i=new fe(e,t,r,n);return e>t.exclusiveMinimum||i.addError({name:"exclusiveMinimum",argument:t.exclusiveMinimum,message:"must be strictly greater than "+t.exclusiveMinimum}),i}},me.exclusiveMaximum=function(e,t,r,n){if("boolean"!=typeof t.exclusiveMaximum&&this.types.number(e)){var i=new fe(e,t,r,n);return e<t.exclusiveMaximum||i.addError({name:"exclusiveMaximum",argument:t.exclusiveMaximum,message:"must be strictly less than "+t.exclusiveMaximum}),i}};var ye=function(e,t,r,n,i,o){if(this.types.number(e)){var a=t[i];if(0==a)throw new he(i+" cannot be zero");var s=new fe(e,t,r,n),u=ce.getDecimalPlaces(e),c=ce.getDecimalPlaces(a),f=Math.max(u,c),h=Math.pow(10,f);return Math.round(e*h)%Math.round(a*h)!=0&&s.addError({name:i,argument:a,message:o+JSON.stringify(a)}),s}};function be(e,t,r){var n,i=r.length;for(n=t+1;n<i;n++)if(ce.deepCompareStrict(e,r[n]))return!1;return!0}me.multipleOf=function(e,t,r,n){return ye.call(this,e,t,r,n,"multipleOf","is not a multiple of (divisible by) ")},me.divisibleBy=function(e,t,r,n){return ye.call(this,e,t,r,n,"divisibleBy","is not divisible by (multiple of) ")},me.required=function(e,t,r,n){var i=new fe(e,t,r,n);return void 0===e&&!0===t.required?i.addError({name:"required",message:"is required"}):this.types.object(e)&&Array.isArray(t.required)&&t.required.forEach((function(t){void 0===pe(e,t)&&i.addError({name:"required",argument:t,message:"requires property "+JSON.stringify(t)})})),i},me.pattern=function(e,t,r,n){if(this.types.string(e)){var i=new fe(e,t,r,n),o=t.pattern;try{var a=new RegExp(o,"u")}catch(e){a=new RegExp(o)}return e.match(a)||i.addError({name:"pattern",argument:t.pattern,message:"does not match pattern "+JSON.stringify(t.pattern.toString())}),i}},me.format=function(e,t,r,n){if(void 0!==e){var i=new fe(e,t,r,n);return i.disableFormat||ce.isFormat(e,t.format,this)||i.addError({name:"format",argument:t.format,message:"does not conform to the "+JSON.stringify(t.format)+" format"}),i}},me.minLength=function(e,t,r,n){if(this.types.string(e)){var i=new fe(e,t,r,n),o=e.match(/[\uDC00-\uDFFF]/g);return e.length-(o?o.length:0)>=t.minLength||i.addError({name:"minLength",argument:t.minLength,message:"does not meet minimum length of "+t.minLength}),i}},me.maxLength=function(e,t,r,n){if(this.types.string(e)){var i=new fe(e,t,r,n),o=e.match(/[\uDC00-\uDFFF]/g);return e.length-(o?o.length:0)<=t.maxLength||i.addError({name:"maxLength",argument:t.maxLength,message:"does not meet maximum length of "+t.maxLength}),i}},me.minItems=function(e,t,r,n){if(this.types.array(e)){var i=new fe(e,t,r,n);return e.length>=t.minItems||i.addError({name:"minItems",argument:t.minItems,message:"does not meet minimum length of "+t.minItems}),i}},me.maxItems=function(e,t,r,n){if(this.types.array(e)){var i=new fe(e,t,r,n);return e.length<=t.maxItems||i.addError({name:"maxItems",argument:t.maxItems,message:"does not meet maximum length of "+t.maxItems}),i}},me.uniqueItems=function(e,t,r,n){if(!0===t.uniqueItems&&this.types.array(e)){var i=new fe(e,t,r,n);return e.every(be)||i.addError({name:"uniqueItems",message:"contains duplicate item"}),i}},me.dependencies=function(e,t,r,n){if(this.types.object(e)){var i=new fe(e,t,r,n);for(var o in t.dependencies)if(void 0!==e[o]){var a=t.dependencies[o],s=n.makeChild(a,o);if("string"==typeof a&&(a=[a]),Array.isArray(a))a.forEach((function(t){void 0===e[t]&&i.addError({name:"dependencies",argument:s.propertyPath,message:"property "+t+" not found, required by "+s.propertyPath})}));else{var u=this.validateSchema(e,a,r,s);i.instance!==u.instance&&(i.instance=u.instance),u&&u.errors.length&&(i.addError({name:"dependencies",argument:s.propertyPath,message:"does not meet dependency required by "+s.propertyPath}),i.importErrors(u))}}return i}},me.enum=function(e,t,r,n){if(void 0===e)return null;if(!Array.isArray(t.enum))throw new he("enum expects an array",t);var i=new fe(e,t,r,n);return t.enum.some(ce.deepCompareStrict.bind(null,e))||i.addError({name:"enum",argument:t.enum,message:"is not one of enum values: "+t.enum.map(String).join(",")}),i},me.const=function(e,t,r,n){if(void 0===e)return null;var i=new fe(e,t,r,n);return ce.deepCompareStrict(t.const,e)||i.addError({name:"const",argument:t.const,message:"does not exactly match expected constant: "+t.const}),i},me.not=me.disallow=function(e,t,r,n){var i=this;if(void 0===e)return null;var o=new fe(e,t,r,n),a=t.not||t.disallow;return a?(Array.isArray(a)||(a=[a]),a.forEach((function(a){if(i.testType(e,t,r,n,a)){var s=a&&(a.$id||a.id)||a;o.addError({name:"not",argument:s,message:"is of prohibited type "+s})}})),o):null};var ge=le,we={},Ae=Y,xe=G;function Ee(e,t){this.id=e,this.ref=t}we.SchemaScanResult=Ee,we.scan=function(e,t){function r(e,t){if(t&&"object"==typeof t)if(t.$ref){var s=Ae.resolve(e,t.$ref);a[s]=a[s]?a[s]+1:0}else{var u=t.$id||t.id,c=u?Ae.resolve(e,u):e;if(c){if(c.indexOf("#")<0&&(c+="#"),o[c]){if(!xe.deepCompareStrict(o[c],t))throw new Error("Schema <"+c+"> already exists with different definition");return o[c]}o[c]=t,"#"==c[c.length-1]&&(o[c.substring(0,c.length-1)]=t)}n(c+"/items",Array.isArray(t.items)?t.items:[t.items]),n(c+"/extends",Array.isArray(t.extends)?t.extends:[t.extends]),r(c+"/additionalItems",t.additionalItems),i(c+"/properties",t.properties),r(c+"/additionalProperties",t.additionalProperties),i(c+"/definitions",t.definitions),i(c+"/patternProperties",t.patternProperties),i(c+"/dependencies",t.dependencies),n(c+"/disallow",t.disallow),n(c+"/allOf",t.allOf),n(c+"/anyOf",t.anyOf),n(c+"/oneOf",t.oneOf),r(c+"/not",t.not)}}function n(e,t){if(Array.isArray(t))for(var n=0;n<t.length;n++)r(e+"/"+n,t[n])}function i(e,t){if(t&&"object"==typeof t)for(var n in t)r(e+"/"+n,t[n])}var o={},a={};return r(e,t),new Ee(o,a)};var Oe=Y,je=ge,Se=G,Fe=we.scan,ze=Se.ValidatorResult,De=Se.ValidatorResultError,Pe=Se.SchemaError,Ne=Se.SchemaContext,$e=function e(){this.customFormats=Object.create(e.prototype.customFormats),this.schemas={},this.unresolvedRefs=[],this.types=Object.create(Re),this.attributes=Object.create(je.validators)};function Ze(e){var t="string"==typeof e?e:e.$ref;return"string"==typeof t&&t}$e.prototype.customFormats={},$e.prototype.schemas=null,$e.prototype.types=null,$e.prototype.attributes=null,$e.prototype.unresolvedRefs=null,$e.prototype.addSchema=function(e,t){var r=this;if(!e)return null;var n=Fe(t||"/",e),i=t||e.$id||e.id;for(var o in n.id)this.schemas[o]=n.id[o];for(var o in n.ref)this.unresolvedRefs.push(o);return this.unresolvedRefs=this.unresolvedRefs.filter((function(e){return void 0===r.schemas[e]})),this.schemas[i]},$e.prototype.addSubSchemaArray=function(e,t){if(Array.isArray(t))for(var r=0;r<t.length;r++)this.addSubSchema(e,t[r])},$e.prototype.addSubSchemaObject=function(e,t){if(t&&"object"==typeof t)for(var r in t)this.addSubSchema(e,t[r])},$e.prototype.setSchemas=function(e){this.schemas=e},$e.prototype.getSchema=function(e){return this.schemas[e]},$e.prototype.validate=function(e,t,r,n){if("boolean"!=typeof t&&"object"!=typeof t||null===t)throw new Pe("Expected `schema` to be an object or boolean");r||(r={});var i,o=t.$id||t.id,a=Oe.resolve(r.base||"/",o||"");if(!n){(n=new Ne(t,r,[],a,Object.create(this.schemas))).schemas[a]||(n.schemas[a]=t);var s=Fe(a,t);for(var u in s.id){var c=s.id[u];n.schemas[u]=c}}if(r.required&&void 0===e)return(i=new ze(e,t,r,n)).addError("is required, but is undefined"),i;if(!(i=this.validateSchema(e,t,r,n)))throw new Error("Result undefined");if(r.throwAll&&i.errors.length)throw new De(i);return i},$e.prototype.validateSchema=function(e,t,r,n){var i=new ze(e,t,r,n);if("boolean"==typeof t)!0===t?t={}:!1===t&&(t={type:[]});else if(!t)throw new Error("schema is undefined");if(t.extends)if(Array.isArray(t.extends)){var o={schema:t,ctx:n};t.extends.forEach(this.schemaTraverser.bind(this,o)),t=o.schema,o.schema=null,o.ctx=null,o=null}else t=Se.deepMerge(t,this.superResolve(t.extends,n));var a=Ze(t);if(a){var s=this.resolve(t,a,n),u=new Ne(s.subschema,r,n.path,s.switchSchema,n.schemas);return this.validateSchema(e,s.subschema,r,u)}var c=r&&r.skipAttributes||[];for(var f in t)if(!je.ignoreProperties[f]&&c.indexOf(f)<0){var h=null,l=this.attributes[f];if(l)h=l.call(this,e,t,r,n);else if(!1===r.allowUnknownAttributes)throw new Pe("Unsupported attribute: "+f,t);h&&i.importErrors(h)}if("function"==typeof r.rewrite){var m=r.rewrite.call(this,e,t,r,n);i.instance=m}return i},$e.prototype.schemaTraverser=function(e,t){e.schema=Se.deepMerge(e.schema,this.superResolve(t,e.ctx))},$e.prototype.superResolve=function(e,t){var r=Ze(e);return r?this.resolve(e,r,t).subschema:e},$e.prototype.resolve=function(e,t,r){if(t=r.resolve(t),r.schemas[t])return{subschema:r.schemas[t],switchSchema:t};var n=Oe.parse(t),i=n&&n.hash,o=i&&i.length&&t.substr(0,t.length-i.length);if(!o||!r.schemas[o])throw new Pe("no such schema <"+t+">",e);var a=Se.objectGetPath(r.schemas[o],i.substr(1));if(void 0===a)throw new Pe("no such schema "+i+" located in <"+o+">",e);return{subschema:a,switchSchema:t}},$e.prototype.testType=function(e,t,r,n,i){if(void 0!==i){if(null===i)throw new Pe('Unexpected null in "type" keyword');if("function"==typeof this.types[i])return this.types[i].call(this,e);if(i&&"object"==typeof i){var o=this.validateSchema(e,i,r,n);return void 0===o||!(o&&o.errors.length)}return!0}};var Re=$e.prototype.types={};Re.string=function(e){return"string"==typeof e},Re.number=function(e){return"number"==typeof e&&isFinite(e)},Re.integer=function(e){return"number"==typeof e&&e%1==0},Re.boolean=function(e){return"boolean"==typeof e},Re.array=function(e){return Array.isArray(e)},Re.null=function(e){return null===e},Re.date=function(e){return e instanceof Date},Re.any=function(e){return!0},Re.object=function(e){return e&&"object"==typeof e&&!Array.isArray(e)&&!(e instanceof Date)};var Ie=$e,Ce="^[a-zA-Z0-9_.-]*$",ke={type:"object",id:"/CreateFsPropsSchema",properties:{databaseName:{minLength:4,maxLength:50,type:"string",pattern:Ce},objectStoreName:{minLength:1,maxLength:20,type:"string",pattern:Ce},rootDirectoryName:{minLength:1,maxLength:20,type:"string",pattern:Ce},databaseVersion:{minimum:1,maximum:100,type:"integer"}},required:["databaseName","databaseVersion","objectStoreName","rootDirectoryName"]};function _e(e){var t,r,n,i=(t=e,r=ke,(new Ie).validate(t,r,n)),o=i.valid,a=i.errors;if(o)return o;var s=JSON.stringify(a);throw new Error("Props passed to createFS function are invalid:\n"+s)}function qe(e,t){return""===e?t:function(e,t){if(!n(e)||!n(t)||""===t)return!1;var r=t+"/";return e.startsWith(r)}(e,t)?e:t+(function(e){return!(!n(e)||0===e.length)&&"/"===e[0]}(e)?"":"/")+e}function Me(e,t){if(!n(t)||""===t)throw new Error("rootDirectoryName parameter was not provided");if(!n(e))throw new Error("fullPath parameter was not provided");if(e===t)return t;var r=qe(e,t);if(!r||!function(e){return!!n(e)&&o.test(e)}(r))throw new Error('"'+e+'" path is invalid.');return r}var Ve="directory";function Le(e){return e?e.result:null}function Te(e,t){t||e(new Error("Something went wrong and the database transaction was not opened."))}var Ue,Be=function(e){var t=e.databaseName,r=e.databaseVersion,n=e.objectStoreName;return new Promise((function(e,i){var o=Je(t,r);o.onupgradeneeded=function(e){var t=Le(e.target);Te(i,t),t.createObjectStore(n,{keyPath:"fullPath"}).createIndex(Ve,Ve,{unique:!1})},o.onsuccess=function(t){var r=t.target,n=Le(r);Te(i,n),e(Le(r))},o.onerror=i}))},Je=function(e,t){return indexedDB.open(e,t)};!function(e){e.FILE="file",e.DIRECTORY="directory"}(Ue||(Ue={}));function Ye(e,t){for(var r=0,n=e.length-1;n>=0;n--){var i=e[n];"."===i?e.splice(n,1):".."===i?(e.splice(n,1),r++):r&&(e.splice(n,1),r--)}if(t)for(;r--;r)e.unshift("..");return e}var Ge=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,Ke=function(e){return Ge.exec(e).slice(1)};function He(){for(var e="",t=!1,r=arguments.length-1;r>=-1&&!t;r--){var n=r>=0?arguments[r]:"/";if("string"!=typeof n)throw new TypeError("Arguments to path.resolve must be strings");n&&(e=n+"/"+e,t="/"===n.charAt(0))}return(t?"/":"")+(e=Ye(et(e.split("/"),(function(e){return!!e})),!t).join("/"))||"."}function We(e){var t=Xe(e),r="/"===tt(e,-1);return(e=Ye(et(e.split("/"),(function(e){return!!e})),!t).join("/"))||t||(e="."),e&&r&&(e+="/"),(t?"/":"")+e}function Xe(e){return"/"===e.charAt(0)}var Qe={extname:function(e){return Ke(e)[3]},basename:function(e,t){var r=Ke(e)[2];return t&&r.substr(-1*t.length)===t&&(r=r.substr(0,r.length-t.length)),r},dirname:function(e){var t=Ke(e),r=t[0],n=t[1];return r||n?(n&&(n=n.substr(0,n.length-1)),r+n):"."},sep:"/",delimiter:":",relative:function(e,t){function r(e){for(var t=0;t<e.length&&""===e[t];t++);for(var r=e.length-1;r>=0&&""===e[r];r--);return t>r?[]:e.slice(t,r-t+1)}e=He(e).substr(1),t=He(t).substr(1);for(var n=r(e.split("/")),i=r(t.split("/")),o=Math.min(n.length,i.length),a=o,s=0;s<o;s++)if(n[s]!==i[s]){a=s;break}var u=[];for(s=a;s<n.length;s++)u.push("..");return(u=u.concat(i.slice(a))).join("/")},join:function(){var e=Array.prototype.slice.call(arguments,0);return We(et(e,(function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e})).join("/"))},isAbsolute:Xe,normalize:We,resolve:He};function et(e,t){if(e.filter)return e.filter(t);for(var r=[],n=0;n<e.length;n++)t(e[n],n,e)&&r.push(e[n]);return r}var tt="b"==="ab".substr(-1)?function(e,t,r){return e.substr(t,r)}:function(e,t,r){return t<0&&(t=e.length+t),e.substr(t,r)},rt=function(e){var n=e.isDirectory,i=e.rootDirectoryName,o=e.initializeObjectStore;return function(e){return t(void 0,void 0,void 0,(function(){var t,a;return r(this,(function(r){switch(r.label){case 0:return t=Me(e,i),[4,n(e)];case 1:if(!r.sent())throw new Error('"'+t+'" is not a directory.');return[4,o("readonly")];case 2:return a=r.sent(),[2,new Promise((function(e,r){var n=a.index(Ve),i=IDBKeyRange.only(t),o=n.openCursor(i);o.onerror=r;var s=[],u=[];o.onsuccess=function(t){var r=t.target.result;if(r){var n=r.value;if(n.type===Ue.FILE){n.data;var i=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r}(n,["data"]);s.push(i)}else n.type!==Ue.DIRECTORY||n.isRoot||u.push(n);r.continue()}else{var o=s.length,a=u.length;e({isEmpty:0===o&&0===a,filesCount:o,directoriesCount:a,files:s,directories:u})}}}))]}}))}))}},nt={databaseVersion:1,objectStoreName:"files",rootDirectoryName:"root",databaseName:"indexeddb-fs"};function it(e){var n=this,o=void 0===e?nt:e,a=o.databaseName,s=void 0===a?nt.databaseName:a,u=o.databaseVersion,c=void 0===u?nt.databaseVersion:u,f=o.objectStoreName,h=void 0===f?nt.objectStoreName:f,l=o.rootDirectoryName,m=void 0===l?nt.rootDirectoryName:l;var d=function(e){var n=e.databaseName,i=e.databaseVersion,o=e.objectStoreName;return function(e){return t(void 0,void 0,void 0,(function(){return r(this,(function(t){switch(t.label){case 0:return[4,Be({databaseName:n,databaseVersion:i,objectStoreName:o})];case 1:return[2,t.sent().transaction(o,e).objectStore(o)]}}))}))}}({databaseName:s,databaseVersion:c,objectStoreName:h}),p=function(e){var n=e.rootDirectoryName,i=e.initializeObjectStore;return function(e){return t(void 0,void 0,void 0,(function(){var t,o;return r(this,(function(r){switch(r.label){case 0:return t=Me(e,n),[4,i("readonly")];case 1:return o=r.sent(),[2,new Promise((function(e){var r=o.get(t);r.onerror=function(){return e(!1)},r.onsuccess=function(t){var r=t.target.result;e(Boolean(null==r?void 0:r.createdAt))}}))]}}))}))}}({rootDirectoryName:m,initializeObjectStore:d}),v=function(e){var n=e.exists,i=e.rootDirectoryName,o=e.initializeObjectStore;return function(e){return t(void 0,void 0,void 0,(function(){var t,a;return r(this,(function(r){switch(r.label){case 0:return t=Me(e,i),[4,n(t)];case 1:if(!r.sent())throw new Error('"'+t+'" file does not exist.');return[4,o("readonly")];case 2:return a=r.sent(),[2,new Promise((function(e){var r=a.get(t);r.onerror=function(){return e(!1)},r.onsuccess=function(t){var r=t.target.result;e(Boolean((null==r?void 0:r.type)===Ue.FILE))}}))]}}))}))}}({exists:p,rootDirectoryName:m,initializeObjectStore:d}),y=function(e){var n=e.exists,i=e.rootDirectoryName,o=e.initializeObjectStore;return function(e){return t(void 0,void 0,void 0,(function(){var t,a;return r(this,(function(r){switch(r.label){case 0:return t=Me(e,i),[4,n(t)];case 1:if(!r.sent())throw new Error('"'+t+'" file or directory does not exist.');return[4,o("readwrite")];case 2:return a=r.sent(),[2,new Promise((function(e,r){var n=a.delete(t);n.onerror=r,n.onsuccess=function(){return e()}}))]}}))}))}}({exists:p,rootDirectoryName:m,initializeObjectStore:d}),b=function(e){var n=e.isFile,i=e.rootDirectoryName,o=e.initializeObjectStore;return function(e){return t(void 0,void 0,void 0,(function(){var t,a;return r(this,(function(r){switch(r.label){case 0:return t=Me(e,i),[4,n(t)];case 1:if(!r.sent())throw new Error('"'+t+'" is not a file.');return[4,o("readonly")];case 2:return a=r.sent(),[2,new Promise((function(e,r){var n=a.getAll(t);n.onerror=r,n.onsuccess=function(t){var r=t.target.result.find((function(e){return e.type===Ue.FILE}));e(r)}}))]}}))}))}}({isFile:v,rootDirectoryName:m,initializeObjectStore:d}),g=function(e){var n=e.fileDetails;return function(e){return t(void 0,void 0,void 0,(function(){return r(this,(function(t){switch(t.label){case 0:return[4,n(e)];case 1:return[2,t.sent().data]}}))}))}}({fileDetails:b}),w=function(e){var n=e.isFile,i=e.rootDirectoryName,o=e.initializeObjectStore;return function(e){return t(void 0,void 0,void 0,(function(){var t,a;return r(this,(function(r){switch(r.label){case 0:return t=Me(e,i),[4,n(t)];case 1:if(!r.sent())throw new Error('"'+t+'" is not a file.');return[4,o("readwrite")];case 2:return a=r.sent(),[2,new Promise((function(e,r){var n=a.delete(t);n.onerror=r,n.onsuccess=function(){return e()}}))]}}))}))}}({isFile:v,rootDirectoryName:m,initializeObjectStore:d}),A=function(e){var n=e.exists,i=e.rootDirectoryName,o=e.initializeObjectStore;return function(e){return t(void 0,void 0,void 0,(function(){var t,a;return r(this,(function(r){switch(r.label){case 0:return t=Me(e,i),[4,n(t)];case 1:if(!r.sent())throw new Error('"'+t+'" directory does not exist.');return[4,o("readonly")];case 2:return a=r.sent(),[2,new Promise((function(e){var r=a.get(t);r.onerror=function(){return e(!1)},r.onsuccess=function(t){var r=t.target.result;e(Boolean((null==r?void 0:r.type)===Ue.DIRECTORY))}}))]}}))}))}}({exists:p,rootDirectoryName:m,initializeObjectStore:d}),x=function(e){var n=e.isDirectory,o=e.rootDirectoryName,a=e.initializeObjectStore;return function(e,s){return t(void 0,void 0,void 0,(function(){var t,u,c,f;return r(this,(function(r){switch(r.label){case 0:if((t=Me(e,o))===o)throw new Error('Root directory: "'+t+'" cannot be a file.');return u=Qe.basename(t),c=Qe.dirname(t),[4,n(c)];case 1:if(!r.sent())throw new Error('"'+c+'" directory does not exist.');return[4,i((function(){return n(t)}),(function(){return!1}))];case 2:if(r.sent())throw new Error('"'+t+'" you cannot create a file with the same name as the directory.');return[4,a("readwrite")];case 3:return f=r.sent(),[2,new Promise((function(e,r){var n={data:s,directory:c,name:u,type:Ue.FILE,createdAt:Date.now(),fullPath:t},i=f.put(n);i.onerror=r,i.onsuccess=function(){return e(n)}}))]}}))}))}}({isDirectory:A,rootDirectoryName:m,initializeObjectStore:d}),E=function(e){var n=e.isFile,i=e.exists,o=e.writeFile,a=e.isDirectory,s=e.fileDetails,u=e.rootDirectoryName;return function(e,c){return t(void 0,void 0,void 0,(function(){var t,f,h,l;return r(this,(function(r){switch(r.label){case 0:return t=Me(e,u),f=Me(c,u),[4,n(t)];case 1:if(!r.sent())throw new Error('"'+t+'" source is not a file.');return h=Qe.dirname(f),[4,a(h)];case 2:if(!r.sent())throw new Error('"'+h+'" destination directory does not exist.');return[4,i(f)];case 3:if(r.sent())throw new Error('"'+f+'" is already taken.');return[4,s(t)];case 4:return l=r.sent(),[2,o(f,l.data)]}}))}))}}({exists:p,isFile:v,writeFile:x,fileDetails:b,isDirectory:A,rootDirectoryName:m}),O=rt({isDirectory:A,rootDirectoryName:m,initializeObjectStore:d}),j=function(e){var n=e.isFile,o=e.isDirectory,a=e.rootDirectoryName,s=e.initializeObjectStore;return function(e){return t(void 0,void 0,void 0,(function(){var t,u,c,f;return r(this,(function(r){switch(r.label){case 0:if((t=Me(e,a))===a)throw new Error('Root directory: "'+t+'" already exist.');return u=Qe.basename(t),c=Qe.dirname(t),[4,o(c)];case 1:if(!r.sent())throw new Error('"'+c+'" is not a directory.');return[4,i((function(){return n(t)}),(function(){return!1}))];case 2:if(r.sent())throw new Error('"'+t+'" you cannot create a directory with the same name as the file.');return[4,s("readwrite")];case 3:return f=r.sent(),[2,new Promise((function(e,r){var n={directory:c,isRoot:!1,name:u,createdAt:Date.now(),type:Ue.DIRECTORY,fullPath:t},i=f.put(n);i.onerror=r,i.onsuccess=function(){return e(n)}}))]}}))}))}}({isFile:v,isDirectory:A,rootDirectoryName:m,initializeObjectStore:d}),S=function(e){var n=e.remove,o=e.isDirectory,a=e.readDirectory,s=e.rootDirectoryName;function u(e){return t(this,void 0,void 0,(function(){var t,o,c,f,h,l,m,d,p,v,y,b,g;return r(this,(function(w){switch(w.label){case 0:return t=Me(e,s),[4,a(t)];case 1:if(o=w.sent(),c=o.files,f=o.filesCount,h=o.directories,l=o.directoriesCount,!(f>0))return[3,5];m=0,d=c,w.label=2;case 2:return m<d.length?(p=d[m],[4,n(p.fullPath)]):[3,5];case 3:w.sent(),w.label=4;case 4:return m++,[3,2];case 5:return l?[3,7]:[4,n(e)];case 6:return w.sent(),[2];case 7:v=function(e){return r(this,(function(t){switch(t.label){case 0:return e.isRoot?[3,2]:[4,u(e.fullPath)];case 1:t.sent(),t.label=2;case 2:return[4,i((function(){return n(e.fullPath)}))];case 3:return t.sent(),[2]}}))},y=0,b=h,w.label=8;case 8:return y<b.length?(g=b[y],[5,v(g)]):[3,11];case 9:w.sent(),w.label=10;case 10:return y++,[3,8];case 11:return[2]}}))}))}return function(e){return t(this,void 0,void 0,(function(){return r(this,(function(t){switch(t.label){case 0:return[4,o(e)];case 1:if(!t.sent())throw new Error('"'+e+'" is not a directory.');return[4,u(e)];case 2:return t.sent(),e===s?[3,4]:[4,i((function(){return n(e)}))];case 3:t.sent(),t.label=4;case 4:return[2]}}))}))}}({remove:y,isDirectory:A,readDirectory:O,rootDirectoryName:m}),F=function(e){var n=e.isDirectory,i=e.rootDirectoryName,o=e.initializeObjectStore;return function(e){return t(void 0,void 0,void 0,(function(){var t,a;return r(this,(function(r){switch(r.label){case 0:return t=Me(e,i),[4,n(e)];case 1:if(!r.sent())throw new Error('"'+t+'" is not a directory.');return[4,o("readonly")];case 2:return a=r.sent(),[2,new Promise((function(e,r){var n=a.getAll(t);n.onerror=r,n.onsuccess=function(t){var r=t.target.result.find((function(e){return e.type===Ue.DIRECTORY}));e(r)}}))]}}))}))}}({isDirectory:A,rootDirectoryName:m,initializeObjectStore:d}),z=function(e){var n=e.exists,i=e.isFile,o=e.isDirectory,a=e.fileDetails,s=e.directoryDetails,u=e.rootDirectoryName;return function(e){return t(void 0,void 0,void 0,(function(){var t,c,f;return r(this,(function(r){switch(r.label){case 0:return t=Me(e,u),[4,n(t)];case 1:if(!r.sent())throw new Error('"'+t+'" file or directory does not exist.');return[4,i(t)];case 2:return c=r.sent(),[4,o(t)];case 3:if(f=r.sent(),c&&f)throw new Error('"'+t+'" is a path of file and directory.');return c?[2,a(t)]:[2,s(t)]}}))}))}}({isFile:v,exists:p,isDirectory:A,fileDetails:b,directoryDetails:F,rootDirectoryName:m}),D=function(e){var n=e.rootDirectoryName,i=e.initializeObjectStore;return function(){return t(void 0,void 0,void 0,(function(){var e;return r(this,(function(t){switch(t.label){case 0:return[4,i("readwrite")];case 1:return e=t.sent(),[2,new Promise((function(t,r){var i={isRoot:!0,createdAt:Date.now(),name:n,type:Ue.DIRECTORY,fullPath:n,directory:n},o=e.put(i);o.onerror=r,o.onsuccess=function(){return t(i)}}))]}}))}))}}({rootDirectoryName:m,initializeObjectStore:d});function P(){return t(this,void 0,void 0,(function(){return r(this,(function(e){switch(e.label){case 0:return[4,p(m)];case 1:return e.sent()?[3,3]:[4,D()];case 2:e.sent(),e.label=3;case 3:return[2]}}))}))}var N=function(e){return function(){for(var i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];return t(n,void 0,void 0,(function(){return r(this,(function(t){switch(t.label){case 0:return[4,P()];case 1:return t.sent(),[2,e.apply(void 0,i)]}}))}))}};return function(){if(!Boolean(indexedDB))throw new Error("Your browser does not support indexedDB.")}(),_e({databaseName:s,objectStoreName:h,databaseVersion:c,rootDirectoryName:m}),{databaseName:s,databaseVersion:c,objectStoreName:h,rootDirectoryName:m,exists:N(p),isFile:N(v),remove:N(y),details:N(z),copyFile:N(E),readFile:N(g),writeFile:N(x),removeFile:N(w),fileDetails:N(b),isDirectory:N(A),readDirectory:N(O),createDirectory:N(j),removeDirectory:N(S),directoryDetails:N(F)}}var ot=it();e.createFs=it,e.default=ot,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
***************************************************************************** */var t=function(){return(t=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function r(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{u(n.next(e))}catch(e){o(e)}}function s(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}u((n=n.apply(e,t||[])).next())}))}function n(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}var i=function(e){return"string"==typeof e||e instanceof String},o=function(e,t){return r(void 0,void 0,void 0,(function(){var r;return n(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,e()];case 1:return[2,n.sent()];case 2:return r=n.sent(),t&&t(r),[3,3];case 3:return[2,null]}}))}))},a=new RegExp("^([A-Za-z]:|[A-Za-z0-9_-]+(.[A-Za-z0-9_-]+)*)((/[A-Za-z0-9_.-]+)+)$");function s(e){if(e.__esModule)return e;var t=Object.defineProperty({},"__esModule",{value:!0});return Object.keys(e).forEach((function(r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})})),t} | ||
/*! https://mths.be/punycode v1.4.1 by @mathias */var u=2147483647,c=/[^\x20-\x7E]/,f=/[\x2E\u3002\uFF0E\uFF61]/g,h={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},l=Math.floor,m=String.fromCharCode;function d(e){throw new RangeError(h[e])}function p(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function v(e,t,r){var n=0;for(e=r?l(e/700):e>>1,e+=l(e/t);e>455;n+=36)e=l(e/35);return l(n+36*e/(e+38))}function y(e){return function(e,t){var r=e.split("@"),n="";r.length>1&&(n=r[0]+"@",e=r[1]);var i=function(e,t){for(var r=e.length,n=[];r--;)n[r]=t(e[r]);return n}((e=e.replace(f,".")).split("."),t).join(".");return n+i}(e,(function(e){return c.test(e)?"xn--"+function(e){var t,r,n,i,o,a,s,c,f,h,y,b,g,w,A,x=[];for(b=(e=function(e){for(var t,r,n=[],i=0,o=e.length;i<o;)(t=e.charCodeAt(i++))>=55296&&t<=56319&&i<o?56320==(64512&(r=e.charCodeAt(i++)))?n.push(((1023&t)<<10)+(1023&r)+65536):(n.push(t),i--):n.push(t);return n}(e)).length,t=128,r=0,o=72,a=0;a<b;++a)(y=e[a])<128&&x.push(m(y));for(n=i=x.length,i&&x.push("-");n<b;){for(s=u,a=0;a<b;++a)(y=e[a])>=t&&y<s&&(s=y);for(s-t>l((u-r)/(g=n+1))&&d("overflow"),r+=(s-t)*g,t=s,a=0;a<b;++a)if((y=e[a])<t&&++r>u&&d("overflow"),y==t){for(c=r,f=36;!(c<(h=f<=o?1:f>=o+26?26:f-o));f+=36)A=c-h,w=36-h,x.push(m(p(h+A%w,0))),c=l(A/w);x.push(m(p(c,0))),o=v(r,g,n==i),r=0,++n}++r,++t}return x.join("")}(e):e}))}function b(e){return null===e}function g(e){return"string"==typeof e}function w(e){return"object"==typeof e&&null!==e}function A(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var x=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function E(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}}function O(e,t){if(e.map)return e.map(t);for(var r=[],n=0;n<e.length;n++)r.push(t(e[n],n));return r}var j=Object.keys||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t};function S(e,t,r,n){t=t||"&",r=r||"=";var i={};if("string"!=typeof e||0===e.length)return i;var o=/\+/g;e=e.split(t);var a=1e3;n&&"number"==typeof n.maxKeys&&(a=n.maxKeys);var s=e.length;a>0&&s>a&&(s=a);for(var u=0;u<s;++u){var c,f,h,l,m=e[u].replace(o,"%20"),d=m.indexOf(r);d>=0?(c=m.substr(0,d),f=m.substr(d+1)):(c=m,f=""),h=decodeURIComponent(c),l=decodeURIComponent(f),A(i,h)?x(i[h])?i[h].push(l):i[h]=[i[h],l]:i[h]=l}return i}var F={parse:V,resolve:B,resolveObject:J,format:T,Url:z};function z(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var D=/^([a-z0-9.+-]+:)/i,N=/:[0-9]*$/,P=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,$=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),Z=["'"].concat($),R=["%","/","?",";","#"].concat(Z),I=["/","?","#"],C=/^[+a-z0-9A-Z_-]{0,63}$/,k=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,_={javascript:!0,"javascript:":!0},q={javascript:!0,"javascript:":!0},M={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function V(e,t,r){if(e&&w(e)&&e instanceof z)return e;var n=new z;return n.parse(e,t,r),n}function L(e,t,r,n){if(!g(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var i=t.indexOf("?"),o=-1!==i&&i<t.indexOf("#")?"?":"#",a=t.split(o);a[0]=a[0].replace(/\\/g,"/");var s=t=a.join(o);if(s=s.trim(),!n&&1===t.split("#").length){var u=P.exec(s);if(u)return e.path=s,e.href=s,e.pathname=u[1],u[2]?(e.search=u[2],e.query=r?S(e.search.substr(1)):e.search.substr(1)):r&&(e.search="",e.query={}),e}var c,f,h,l,m=D.exec(s);if(m){var d=(m=m[0]).toLowerCase();e.protocol=d,s=s.substr(m.length)}if(n||m||s.match(/^\/\/[^@\/]+@[^@\/]+/)){var p="//"===s.substr(0,2);!p||m&&q[m]||(s=s.substr(2),e.slashes=!0)}if(!q[m]&&(p||m&&!M[m])){var v,b,w=-1;for(c=0;c<I.length;c++)-1!==(f=s.indexOf(I[c]))&&(-1===w||f<w)&&(w=f);for(-1!==(b=-1===w?s.lastIndexOf("@"):s.lastIndexOf("@",w))&&(v=s.slice(0,b),s=s.slice(b+1),e.auth=decodeURIComponent(v)),w=-1,c=0;c<R.length;c++)-1!==(f=s.indexOf(R[c]))&&(-1===w||f<w)&&(w=f);-1===w&&(w=s.length),e.host=s.slice(0,w),s=s.slice(w),Y(e),e.hostname=e.hostname||"";var A="["===e.hostname[0]&&"]"===e.hostname[e.hostname.length-1];if(!A){var x=e.hostname.split(/\./);for(c=0,h=x.length;c<h;c++){var E=x[c];if(E&&!E.match(C)){for(var O="",j=0,F=E.length;j<F;j++)E.charCodeAt(j)>127?O+="x":O+=E[j];if(!O.match(C)){var z=x.slice(0,c),N=x.slice(c+1),$=E.match(k);$&&(z.push($[1]),N.unshift($[2])),N.length&&(s="/"+N.join(".")+s),e.hostname=z.join(".");break}}}}e.hostname.length>255?e.hostname="":e.hostname=e.hostname.toLowerCase(),A||(e.hostname=y(e.hostname)),l=e.port?":"+e.port:"";var V=e.hostname||"";e.host=V+l,e.href+=e.host,A&&(e.hostname=e.hostname.substr(1,e.hostname.length-2),"/"!==s[0]&&(s="/"+s))}if(!_[d])for(c=0,h=Z.length;c<h;c++){var L=Z[c];if(-1!==s.indexOf(L)){var T=encodeURIComponent(L);T===L&&(T=escape(L)),s=s.split(L).join(T)}}var B=s.indexOf("#");-1!==B&&(e.hash=s.substr(B),s=s.slice(0,B));var J=s.indexOf("?");if(-1!==J?(e.search=s.substr(J),e.query=s.substr(J+1),r&&(e.query=S(e.query)),s=s.slice(0,J)):r&&(e.search="",e.query={}),s&&(e.pathname=s),M[d]&&e.hostname&&!e.pathname&&(e.pathname="/"),e.pathname||e.search){l=e.pathname||"";var G=e.search||"";e.path=l+G}return e.href=U(e),e}function T(e){return g(e)&&(e=L({},e)),U(e)}function U(e){var t=e.auth||"";t&&(t=(t=encodeURIComponent(t)).replace(/%3A/i,":"),t+="@");var r=e.protocol||"",n=e.pathname||"",i=e.hash||"",o=!1,a="";e.host?o=t+e.host:e.hostname&&(o=t+(-1===e.hostname.indexOf(":")?e.hostname:"["+this.hostname+"]"),e.port&&(o+=":"+e.port)),e.query&&w(e.query)&&Object.keys(e.query).length&&(a=function(e,t,r,n){return t=t||"&",r=r||"=",null===e&&(e=void 0),"object"==typeof e?O(j(e),(function(n){var i=encodeURIComponent(E(n))+r;return x(e[n])?O(e[n],(function(e){return i+encodeURIComponent(E(e))})).join(t):i+encodeURIComponent(E(e[n]))})).join(t):n?encodeURIComponent(E(n))+r+encodeURIComponent(E(e)):""}(e.query));var s=e.search||a&&"?"+a||"";return r&&":"!==r.substr(-1)&&(r+=":"),e.slashes||(!r||M[r])&&!1!==o?(o="//"+(o||""),n&&"/"!==n.charAt(0)&&(n="/"+n)):o||(o=""),i&&"#"!==i.charAt(0)&&(i="#"+i),s&&"?"!==s.charAt(0)&&(s="?"+s),r+o+(n=n.replace(/[?#]/g,(function(e){return encodeURIComponent(e)})))+(s=s.replace("#","%23"))+i}function B(e,t){return V(e,!1,!0).resolve(t)}function J(e,t){return e?V(e,!1,!0).resolveObject(t):t}function Y(e){var t=e.host,r=N.exec(t);r&&(":"!==(r=r[0])&&(e.port=r.substr(1)),t=t.substr(0,t.length-r.length)),t&&(e.hostname=t)}z.prototype.parse=function(e,t,r){return L(this,e,t,r)},z.prototype.format=function(){return U(this)},z.prototype.resolve=function(e){return this.resolveObject(V(e,!1,!0)).format()},z.prototype.resolveObject=function(e){if(g(e)){var t=new z;t.parse(e,!1,!0),e=t}for(var r,n=new z,i=Object.keys(this),o=0;o<i.length;o++){var a=i[o];n[a]=this[a]}if(n.hash=e.hash,""===e.href)return n.href=n.format(),n;if(e.slashes&&!e.protocol){for(var s=Object.keys(e),u=0;u<s.length;u++){var c=s[u];"protocol"!==c&&(n[c]=e[c])}return M[n.protocol]&&n.hostname&&!n.pathname&&(n.path=n.pathname="/"),n.href=n.format(),n}if(e.protocol&&e.protocol!==n.protocol){if(!M[e.protocol]){for(var f=Object.keys(e),h=0;h<f.length;h++){var l=f[h];n[l]=e[l]}return n.href=n.format(),n}if(n.protocol=e.protocol,e.host||q[e.protocol])n.pathname=e.pathname;else{for(r=(e.pathname||"").split("/");r.length&&!(e.host=r.shift()););e.host||(e.host=""),e.hostname||(e.hostname=""),""!==r[0]&&r.unshift(""),r.length<2&&r.unshift(""),n.pathname=r.join("/")}if(n.search=e.search,n.query=e.query,n.host=e.host||"",n.auth=e.auth,n.hostname=e.hostname||e.host,n.port=e.port,n.pathname||n.search){var m=n.pathname||"",d=n.search||"";n.path=m+d}return n.slashes=n.slashes||e.slashes,n.href=n.format(),n}var p,v=n.pathname&&"/"===n.pathname.charAt(0),y=e.host||e.pathname&&"/"===e.pathname.charAt(0),w=y||v||n.host&&e.pathname,A=w,x=n.pathname&&n.pathname.split("/")||[],E=n.protocol&&!M[n.protocol];if(r=e.pathname&&e.pathname.split("/")||[],E&&(n.hostname="",n.port=null,n.host&&(""===x[0]?x[0]=n.host:x.unshift(n.host)),n.host="",e.protocol&&(e.hostname=null,e.port=null,e.host&&(""===r[0]?r[0]=e.host:r.unshift(e.host)),e.host=null),w=w&&(""===r[0]||""===x[0])),y)n.host=e.host||""===e.host?e.host:n.host,n.hostname=e.hostname||""===e.hostname?e.hostname:n.hostname,n.search=e.search,n.query=e.query,x=r;else if(r.length)x||(x=[]),x.pop(),x=x.concat(r),n.search=e.search,n.query=e.query;else if(null!=e.search)return E&&(n.hostname=n.host=x.shift(),(p=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=p.shift(),n.host=n.hostname=p.shift())),n.search=e.search,n.query=e.query,b(n.pathname)&&b(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n;if(!x.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var O=x.slice(-1)[0],j=(n.host||e.host||x.length>1)&&("."===O||".."===O)||""===O,S=0,F=x.length;F>=0;F--)"."===(O=x[F])?x.splice(F,1):".."===O?(x.splice(F,1),S++):S&&(x.splice(F,1),S--);if(!w&&!A)for(;S--;S)x.unshift("..");!w||""===x[0]||x[0]&&"/"===x[0].charAt(0)||x.unshift(""),j&&"/"!==x.join("/").substr(-1)&&x.push("");var D=""===x[0]||x[0]&&"/"===x[0].charAt(0);return E&&(n.hostname=n.host=D?"":x.length?x.shift():"",(p=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=p.shift(),n.host=n.hostname=p.shift())),(w=w||n.host&&x.length)&&!D&&x.unshift(""),x.length?n.pathname=x.join("/"):(n.pathname=null,n.path=null),b(n.pathname)&&b(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=e.auth||n.auth,n.slashes=n.slashes||e.slashes,n.href=n.format(),n},z.prototype.parseHost=function(){return Y(this)};var G=s(Object.freeze({__proto__:null,parse:V,resolve:B,resolveObject:J,format:T,default:F,Url:z})),K={},H=G,W=K.ValidationError=function(e,t,r,n,i,o){if(Array.isArray(n)?(this.path=n,this.property=n.reduce((function(e,t){return e+ie(t)}),"instance")):void 0!==n&&(this.property=n),e&&(this.message=e),r){var a=r.$id||r.id;this.schema=a||r}void 0!==t&&(this.instance=t),this.name=i,this.argument=o,this.stack=this.toString()};W.prototype.toString=function(){return this.property+" "+this.message};var X=K.ValidatorResult=function(e,t,r,n){this.instance=e,this.schema=t,this.options=r,this.path=n.path,this.propertyPath=n.propertyPath,this.errors=[],this.throwError=r&&r.throwError,this.throwFirst=r&&r.throwFirst,this.throwAll=r&&r.throwAll,this.disableFormat=r&&!0===r.disableFormat};function Q(e,t){return t+": "+e.toString()+"\n"}function ee(e){Error.captureStackTrace&&Error.captureStackTrace(this,ee),this.instance=e.instance,this.schema=e.schema,this.options=e.options,this.errors=e.errors}X.prototype.addError=function(e){var t;if("string"==typeof e)t=new W(e,this.instance,this.schema,this.path);else{if(!e)throw new Error("Missing error detail");if(!e.message)throw new Error("Missing error message");if(!e.name)throw new Error("Missing validator type");t=new W(e.message,this.instance,this.schema,this.path,e.name,e.argument)}if(this.errors.push(t),this.throwFirst)throw new ee(this);if(this.throwError)throw t;return t},X.prototype.importErrors=function(e){"string"==typeof e||e&&e.validatorType?this.addError(e):e&&e.errors&&Array.prototype.push.apply(this.errors,e.errors)},X.prototype.toString=function(e){return this.errors.map(Q).join("")},Object.defineProperty(X.prototype,"valid",{get:function(){return!this.errors.length}}),K.ValidatorResultError=ee,ee.prototype=new Error,ee.prototype.constructor=ee,ee.prototype.name="Validation Error";var te=K.SchemaError=function e(t,r){this.message=t,this.schema=r,Error.call(this,t),Error.captureStackTrace(this,e)};te.prototype=Object.create(Error.prototype,{constructor:{value:te,enumerable:!1},name:{value:"SchemaError",enumerable:!1}});var re=K.SchemaContext=function(e,t,r,n,i){this.schema=e,this.options=t,Array.isArray(r)?(this.path=r,this.propertyPath=r.reduce((function(e,t){return e+ie(t)}),"instance")):this.propertyPath=r,this.base=n,this.schemas=i};re.prototype.resolve=function(e){return H.resolve(this.base,e)},re.prototype.makeChild=function(e,t){var r=void 0===t?this.path:this.path.concat([t]),n=e.$id||e.id,i=H.resolve(this.base,n||""),o=new re(e,this.options,r,i,Object.create(this.schemas));return n&&!o.schemas[i]&&(o.schemas[i]=e),o};var ne=K.FORMAT_REGEXPS={"date-time":/^\d{4}-(?:0[0-9]{1}|1[0-2]{1})-(3[01]|0[1-9]|[12][0-9])[tT ](2[0-4]|[01][0-9]):([0-5][0-9]):(60|[0-5][0-9])(\.\d+)?([zZ]|[+-]([0-5][0-9]):(60|[0-5][0-9]))$/,date:/^\d{4}-(?:0[0-9]{1}|1[0-2]{1})-(3[01]|0[1-9]|[12][0-9])$/,time:/^(2[0-4]|[01][0-9]):([0-5][0-9]):(60|[0-5][0-9])$/,email:/^(?:[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\$\%\&\'\*\+\-\/\=\?\^\`\{\|\}\~]+@(?:(?:(?:[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!\.)){0,61}[a-zA-Z0-9]?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!$)){0,61}[a-zA-Z0-9]?)|(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\]))$/,"ip-address":/^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/,ipv6:/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-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-Fa-f]{1,4}:){5}(((:[0-9A-Fa-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-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-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-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-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-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-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-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-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-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-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}))|:)))(%.+)?\s*$/,uri:/^[a-zA-Z][a-zA-Z0-9+-.]*:[^\s]*$/,"uri-reference":/^(((([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|([A-Za-z][+\-.0-9A-Za-z]*:?)?)|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|(\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?)?))#(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|(([A-Za-z][+\-.0-9A-Za-z]*)?%[0-9A-Fa-f]{2}|[!$&-.0-9;=@_~]|[A-Za-z][+\-.0-9A-Za-z]*[!$&-*,;=@_~])(%[0-9A-Fa-f]{2}|[!$&-.0-9;=@-Z_a-z~])*((([/?](%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*)?#|[/?])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*)?|([A-Za-z][+\-.0-9A-Za-z]*(:%[0-9A-Fa-f]{2}|:[!$&-.0-;=?-Z_a-z~]|[/?])|\?)(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|([A-Za-z][+\-.0-9A-Za-z]*:)?\/((%[0-9A-Fa-f]{2}|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)(:\d*)?[/?]|[!$&-.0-;=?-Z_a-z~])(%[0-9A-Fa-f]{2}|[!$&-;=?-Z_a-z~])*|\/((%[0-9A-Fa-f]{2}|[!$&-.0-9;=A-Z_a-z~])+(:\d*)?|(\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?:\d*|\[(([Vv][0-9A-Fa-f]+\.[!$&-.0-;=A-Z_a-z~]+)?|[.0-:A-Fa-f]+)\])?)?|[A-Za-z][+\-.0-9A-Za-z]*:?)?$/,color:/^(#?([0-9A-Fa-f]{3}){1,2}\b|aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow|(rgb\(\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*,\s*\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\s*\))|(rgb\(\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*,\s*(\d?\d%|100%)+\s*\)))$/,hostname:/^(?=.{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])?)*\.?$/,"host-name":/^(?=.{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])?)*\.?$/,alpha:/^[a-zA-Z]+$/,alphanumeric:/^[a-zA-Z0-9]+$/,"utc-millisec":function(e){return"string"==typeof e&&parseFloat(e)===parseInt(e,10)&&!isNaN(e)},regex:function(e){var t=!0;try{new RegExp(e)}catch(e){t=!1}return t},style:/\s*(.+?):\s*([^;]+);?/,phone:/^\+(?:[0-9] ?){6,14}[0-9]$/};ne.regexp=ne.regex,ne.pattern=ne.regex,ne.ipv4=ne["ip-address"],K.isFormat=function(e,t,r){if("string"==typeof e&&void 0!==ne[t]){if(ne[t]instanceof RegExp)return ne[t].test(e);if("function"==typeof ne[t])return ne[t](e)}else if(r&&r.customFormats&&"function"==typeof r.customFormats[t])return r.customFormats[t](e);return!0};var ie=K.makeSuffix=function(e){return(e=e.toString()).match(/[.\s\[\]]/)||e.match(/^[\d]/)?e.match(/^\d+$/)?"["+e+"]":"["+JSON.stringify(e)+"]":"."+e};function oe(e,t,r,n){"object"==typeof r?t[n]=ue(e[n],r):-1===e.indexOf(r)&&t.push(r)}function ae(e,t,r){t[r]=e[r]}function se(e,t,r,n){"object"==typeof t[n]&&t[n]&&e[n]?r[n]=ue(e[n],t[n]):r[n]=t[n]}function ue(e,t){var r=Array.isArray(t),n=r&&[]||{};return r?(e=e||[],n=n.concat(e),t.forEach(oe.bind(null,e,n))):(e&&"object"==typeof e&&Object.keys(e).forEach(ae.bind(null,e,n)),Object.keys(t).forEach(se.bind(null,e,t,n))),n}function ce(e){return"/"+encodeURIComponent(e).replace(/~/g,"%7E")}K.deepCompareStrict=function e(t,r){if(typeof t!=typeof r)return!1;if(Array.isArray(t))return!!Array.isArray(r)&&(t.length===r.length&&t.every((function(n,i){return e(t[i],r[i])})));if("object"==typeof t){if(!t||!r)return t===r;var n=Object.keys(t),i=Object.keys(r);return n.length===i.length&&n.every((function(n){return e(t[n],r[n])}))}return t===r},K.deepMerge=ue,K.objectGetPath=function(e,t){for(var r,n=t.split("/").slice(1);"string"==typeof(r=n.shift());){var i=decodeURIComponent(r.replace(/~0/,"~").replace(/~1/g,"/"));if(!(i in e))return;e=e[i]}return e},K.encodePath=function(e){return e.map(ce).join("")},K.getDecimalPlaces=function(e){var t=0;if(isNaN(e))return t;"number"!=typeof e&&(e=Number(e));var r=e.toString().split("e");if(2===r.length){if("-"!==r[1][0])return t;t=Number(r[1].slice(1))}var n=r[0].split(".");return 2===n.length&&(t+=n[1].length),t},K.isSchema=function(e){return"object"==typeof e&&e||"boolean"==typeof e};var fe=K,he=fe.ValidatorResult,le=fe.SchemaError,me={ignoreProperties:{id:!0,default:!0,description:!0,title:!0,additionalItems:!0,then:!0,else:!0,$schema:!0,$ref:!0,extends:!0}},de=me.validators={};function pe(e,t,r,n,i){var o=t.throwError,a=t.throwAll;t.throwError=!1,t.throwAll=!1;var s=this.validateSchema(e,i,t,r);return t.throwError=o,t.throwAll=a,!s.valid&&n instanceof Function&&n(s),s.valid}function ve(e,t){if(Object.hasOwnProperty.call(e,t))return e[t];if(t in e)for(;e=Object.getPrototypeOf(e);)if(Object.propertyIsEnumerable.call(e,t))return e[t]}function ye(e,t,r,n,i,o){if(this.types.object(e)&&(!t.properties||void 0===t.properties[i]))if(!1===t.additionalProperties)o.addError({name:"additionalProperties",argument:i,message:"is not allowed to have the additional property "+JSON.stringify(i)});else{var a=t.additionalProperties||{};"function"==typeof r.preValidateProperty&&r.preValidateProperty(e,i,a,r,n);var s=this.validateSchema(e[i],a,r,n.makeChild(a,i));s.instance!==o.instance[i]&&(o.instance[i]=s.instance),o.importErrors(s)}}de.type=function(e,t,r,n){if(void 0===e)return null;var i=new he(e,t,r,n),o=Array.isArray(t.type)?t.type:[t.type];if(!o.some(this.testType.bind(this,e,t,r,n))){var a=o.map((function(e){if(e){var t=e.$id||e.id;return t?"<"+t+">":e+""}}));i.addError({name:"type",argument:a,message:"is not of a type(s) "+a})}return i},de.anyOf=function(e,t,r,n){if(void 0===e)return null;var i=new he(e,t,r,n),o=new he(e,t,r,n);if(!Array.isArray(t.anyOf))throw new le("anyOf must be an array");if(!t.anyOf.some(pe.bind(this,e,r,n,(function(e){o.importErrors(e)})))){var a=t.anyOf.map((function(e,t){var r=e.$id||e.id;return r?"<"+r+">":e.title&&JSON.stringify(e.title)||e.$ref&&"<"+e.$ref+">"||"[subschema "+t+"]"}));r.nestedErrors&&i.importErrors(o),i.addError({name:"anyOf",argument:a,message:"is not any of "+a.join(",")})}return i},de.allOf=function(e,t,r,n){if(void 0===e)return null;if(!Array.isArray(t.allOf))throw new le("allOf must be an array");var i=new he(e,t,r,n),o=this;return t.allOf.forEach((function(t,a){var s=o.validateSchema(e,t,r,n);if(!s.valid){var u=t.$id||t.id||t.title&&JSON.stringify(t.title)||t.$ref&&"<"+t.$ref+">"||"[subschema "+a+"]";i.addError({name:"allOf",argument:{id:u,length:s.errors.length,valid:s},message:"does not match allOf schema "+u+" with "+s.errors.length+" error[s]:"}),i.importErrors(s)}})),i},de.oneOf=function(e,t,r,n){if(void 0===e)return null;if(!Array.isArray(t.oneOf))throw new le("oneOf must be an array");var i=new he(e,t,r,n),o=new he(e,t,r,n),a=t.oneOf.filter(pe.bind(this,e,r,n,(function(e){o.importErrors(e)}))).length,s=t.oneOf.map((function(e,t){return e.$id||e.id||e.title&&JSON.stringify(e.title)||e.$ref&&"<"+e.$ref+">"||"[subschema "+t+"]"}));return 1!==a&&(r.nestedErrors&&i.importErrors(o),i.addError({name:"oneOf",argument:s,message:"is not exactly one from "+s.join(",")})),i},de.if=function(e,t,r,n){if(void 0===e)return null;if(!fe.isSchema(t.if))throw new Error('Expected "if" keyword to be a schema');var i,o=pe.call(this,e,r,n,null,t.if),a=new he(e,t,r,n);if(o){if(void 0===t.then)return;if(!fe.isSchema(t.then))throw new Error('Expected "then" keyword to be a schema');i=this.validateSchema(e,t.then,r,n.makeChild(t.then)),a.importErrors(i)}else{if(void 0===t.else)return;if(!fe.isSchema(t.else))throw new Error('Expected "else" keyword to be a schema');i=this.validateSchema(e,t.else,r,n.makeChild(t.else)),a.importErrors(i)}return a},de.propertyNames=function(e,t,r,n){if(this.types.object(e)){var i=new he(e,t,r,n),o=void 0!==t.propertyNames?t.propertyNames:{};if(!fe.isSchema(o))throw new le('Expected "propertyNames" to be a schema (object or boolean)');for(var a in e)if(void 0!==ve(e,a)){var s=this.validateSchema(a,o,r,n.makeChild(o));i.importErrors(s)}return i}},de.properties=function(e,t,r,n){if(this.types.object(e)){var i=new he(e,t,r,n),o=t.properties||{};for(var a in o){var s=o[a];if(void 0!==s){if(null===s)throw new le('Unexpected null, expected schema in "properties"');"function"==typeof r.preValidateProperty&&r.preValidateProperty(e,a,s,r,n);var u=ve(e,a),c=this.validateSchema(u,s,r,n.makeChild(s,a));c.instance!==i.instance[a]&&(i.instance[a]=c.instance),i.importErrors(c)}}return i}},de.patternProperties=function(e,t,r,n){if(this.types.object(e)){var i=new he(e,t,r,n),o=t.patternProperties||{};for(var a in e){var s=!0;for(var u in o){var c=o[u];if(void 0!==c){if(null===c)throw new le('Unexpected null, expected schema in "patternProperties"');try{var f=new RegExp(u,"u")}catch(e){f=new RegExp(u)}if(f.test(a)){s=!1,"function"==typeof r.preValidateProperty&&r.preValidateProperty(e,a,c,r,n);var h=this.validateSchema(e[a],c,r,n.makeChild(c,a));h.instance!==i.instance[a]&&(i.instance[a]=h.instance),i.importErrors(h)}}}s&&ye.call(this,e,t,r,n,a,i)}return i}},de.additionalProperties=function(e,t,r,n){if(this.types.object(e)){if(t.patternProperties)return null;var i=new he(e,t,r,n);for(var o in e)ye.call(this,e,t,r,n,o,i);return i}},de.minProperties=function(e,t,r,n){if(this.types.object(e)){var i=new he(e,t,r,n);return Object.keys(e).length>=t.minProperties||i.addError({name:"minProperties",argument:t.minProperties,message:"does not meet minimum property length of "+t.minProperties}),i}},de.maxProperties=function(e,t,r,n){if(this.types.object(e)){var i=new he(e,t,r,n);return Object.keys(e).length<=t.maxProperties||i.addError({name:"maxProperties",argument:t.maxProperties,message:"does not meet maximum property length of "+t.maxProperties}),i}},de.items=function(e,t,r,n){var i=this;if(this.types.array(e)&&t.items){var o=new he(e,t,r,n);return e.every((function(e,a){var s=Array.isArray(t.items)?t.items[a]||t.additionalItems:t.items;if(void 0===s)return!0;if(!1===s)return o.addError({name:"items",message:"additionalItems not permitted"}),!1;var u=i.validateSchema(e,s,r,n.makeChild(s,a));return u.instance!==o.instance[a]&&(o.instance[a]=u.instance),o.importErrors(u),!0})),o}},de.minimum=function(e,t,r,n){if(this.types.number(e)){var i=new he(e,t,r,n);return t.exclusiveMinimum&&!0===t.exclusiveMinimum?e>t.minimum||i.addError({name:"minimum",argument:t.minimum,message:"must be greater than "+t.minimum}):e>=t.minimum||i.addError({name:"minimum",argument:t.minimum,message:"must be greater than or equal to "+t.minimum}),i}},de.maximum=function(e,t,r,n){if(this.types.number(e)){var i=new he(e,t,r,n);return t.exclusiveMaximum&&!0===t.exclusiveMaximum?e<t.maximum||i.addError({name:"maximum",argument:t.maximum,message:"must be less than "+t.maximum}):e<=t.maximum||i.addError({name:"maximum",argument:t.maximum,message:"must be less than or equal to "+t.maximum}),i}},de.exclusiveMinimum=function(e,t,r,n){if("boolean"!=typeof t.exclusiveMaximum&&this.types.number(e)){var i=new he(e,t,r,n);return e>t.exclusiveMinimum||i.addError({name:"exclusiveMinimum",argument:t.exclusiveMinimum,message:"must be strictly greater than "+t.exclusiveMinimum}),i}},de.exclusiveMaximum=function(e,t,r,n){if("boolean"!=typeof t.exclusiveMaximum&&this.types.number(e)){var i=new he(e,t,r,n);return e<t.exclusiveMaximum||i.addError({name:"exclusiveMaximum",argument:t.exclusiveMaximum,message:"must be strictly less than "+t.exclusiveMaximum}),i}};var be=function(e,t,r,n,i,o){if(this.types.number(e)){var a=t[i];if(0==a)throw new le(i+" cannot be zero");var s=new he(e,t,r,n),u=fe.getDecimalPlaces(e),c=fe.getDecimalPlaces(a),f=Math.max(u,c),h=Math.pow(10,f);return Math.round(e*h)%Math.round(a*h)!=0&&s.addError({name:i,argument:a,message:o+JSON.stringify(a)}),s}};function ge(e,t,r){var n,i=r.length;for(n=t+1;n<i;n++)if(fe.deepCompareStrict(e,r[n]))return!1;return!0}de.multipleOf=function(e,t,r,n){return be.call(this,e,t,r,n,"multipleOf","is not a multiple of (divisible by) ")},de.divisibleBy=function(e,t,r,n){return be.call(this,e,t,r,n,"divisibleBy","is not divisible by (multiple of) ")},de.required=function(e,t,r,n){var i=new he(e,t,r,n);return void 0===e&&!0===t.required?i.addError({name:"required",message:"is required"}):this.types.object(e)&&Array.isArray(t.required)&&t.required.forEach((function(t){void 0===ve(e,t)&&i.addError({name:"required",argument:t,message:"requires property "+JSON.stringify(t)})})),i},de.pattern=function(e,t,r,n){if(this.types.string(e)){var i=new he(e,t,r,n),o=t.pattern;try{var a=new RegExp(o,"u")}catch(e){a=new RegExp(o)}return e.match(a)||i.addError({name:"pattern",argument:t.pattern,message:"does not match pattern "+JSON.stringify(t.pattern.toString())}),i}},de.format=function(e,t,r,n){if(void 0!==e){var i=new he(e,t,r,n);return i.disableFormat||fe.isFormat(e,t.format,this)||i.addError({name:"format",argument:t.format,message:"does not conform to the "+JSON.stringify(t.format)+" format"}),i}},de.minLength=function(e,t,r,n){if(this.types.string(e)){var i=new he(e,t,r,n),o=e.match(/[\uDC00-\uDFFF]/g);return e.length-(o?o.length:0)>=t.minLength||i.addError({name:"minLength",argument:t.minLength,message:"does not meet minimum length of "+t.minLength}),i}},de.maxLength=function(e,t,r,n){if(this.types.string(e)){var i=new he(e,t,r,n),o=e.match(/[\uDC00-\uDFFF]/g);return e.length-(o?o.length:0)<=t.maxLength||i.addError({name:"maxLength",argument:t.maxLength,message:"does not meet maximum length of "+t.maxLength}),i}},de.minItems=function(e,t,r,n){if(this.types.array(e)){var i=new he(e,t,r,n);return e.length>=t.minItems||i.addError({name:"minItems",argument:t.minItems,message:"does not meet minimum length of "+t.minItems}),i}},de.maxItems=function(e,t,r,n){if(this.types.array(e)){var i=new he(e,t,r,n);return e.length<=t.maxItems||i.addError({name:"maxItems",argument:t.maxItems,message:"does not meet maximum length of "+t.maxItems}),i}},de.uniqueItems=function(e,t,r,n){if(!0===t.uniqueItems&&this.types.array(e)){var i=new he(e,t,r,n);return e.every(ge)||i.addError({name:"uniqueItems",message:"contains duplicate item"}),i}},de.dependencies=function(e,t,r,n){if(this.types.object(e)){var i=new he(e,t,r,n);for(var o in t.dependencies)if(void 0!==e[o]){var a=t.dependencies[o],s=n.makeChild(a,o);if("string"==typeof a&&(a=[a]),Array.isArray(a))a.forEach((function(t){void 0===e[t]&&i.addError({name:"dependencies",argument:s.propertyPath,message:"property "+t+" not found, required by "+s.propertyPath})}));else{var u=this.validateSchema(e,a,r,s);i.instance!==u.instance&&(i.instance=u.instance),u&&u.errors.length&&(i.addError({name:"dependencies",argument:s.propertyPath,message:"does not meet dependency required by "+s.propertyPath}),i.importErrors(u))}}return i}},de.enum=function(e,t,r,n){if(void 0===e)return null;if(!Array.isArray(t.enum))throw new le("enum expects an array",t);var i=new he(e,t,r,n);return t.enum.some(fe.deepCompareStrict.bind(null,e))||i.addError({name:"enum",argument:t.enum,message:"is not one of enum values: "+t.enum.map(String).join(",")}),i},de.const=function(e,t,r,n){if(void 0===e)return null;var i=new he(e,t,r,n);return fe.deepCompareStrict(t.const,e)||i.addError({name:"const",argument:t.const,message:"does not exactly match expected constant: "+t.const}),i},de.not=de.disallow=function(e,t,r,n){var i=this;if(void 0===e)return null;var o=new he(e,t,r,n),a=t.not||t.disallow;return a?(Array.isArray(a)||(a=[a]),a.forEach((function(a){if(i.testType(e,t,r,n,a)){var s=a&&(a.$id||a.id)||a;o.addError({name:"not",argument:s,message:"is of prohibited type "+s})}})),o):null};var we=me,Ae={},xe=G,Ee=K;function Oe(e,t){this.id=e,this.ref=t}Ae.SchemaScanResult=Oe,Ae.scan=function(e,t){function r(e,t){if(t&&"object"==typeof t)if(t.$ref){var s=xe.resolve(e,t.$ref);a[s]=a[s]?a[s]+1:0}else{var u=t.$id||t.id,c=u?xe.resolve(e,u):e;if(c){if(c.indexOf("#")<0&&(c+="#"),o[c]){if(!Ee.deepCompareStrict(o[c],t))throw new Error("Schema <"+c+"> already exists with different definition");return o[c]}o[c]=t,"#"==c[c.length-1]&&(o[c.substring(0,c.length-1)]=t)}n(c+"/items",Array.isArray(t.items)?t.items:[t.items]),n(c+"/extends",Array.isArray(t.extends)?t.extends:[t.extends]),r(c+"/additionalItems",t.additionalItems),i(c+"/properties",t.properties),r(c+"/additionalProperties",t.additionalProperties),i(c+"/definitions",t.definitions),i(c+"/patternProperties",t.patternProperties),i(c+"/dependencies",t.dependencies),n(c+"/disallow",t.disallow),n(c+"/allOf",t.allOf),n(c+"/anyOf",t.anyOf),n(c+"/oneOf",t.oneOf),r(c+"/not",t.not)}}function n(e,t){if(Array.isArray(t))for(var n=0;n<t.length;n++)r(e+"/"+n,t[n])}function i(e,t){if(t&&"object"==typeof t)for(var n in t)r(e+"/"+n,t[n])}var o={},a={};return r(e,t),new Oe(o,a)};var je=G,Se=we,Fe=K,ze=Ae.scan,De=Fe.ValidatorResult,Ne=Fe.ValidatorResultError,Pe=Fe.SchemaError,$e=Fe.SchemaContext,Ze=function e(){this.customFormats=Object.create(e.prototype.customFormats),this.schemas={},this.unresolvedRefs=[],this.types=Object.create(Ie),this.attributes=Object.create(Se.validators)};function Re(e){var t="string"==typeof e?e:e.$ref;return"string"==typeof t&&t}Ze.prototype.customFormats={},Ze.prototype.schemas=null,Ze.prototype.types=null,Ze.prototype.attributes=null,Ze.prototype.unresolvedRefs=null,Ze.prototype.addSchema=function(e,t){var r=this;if(!e)return null;var n=ze(t||"/",e),i=t||e.$id||e.id;for(var o in n.id)this.schemas[o]=n.id[o];for(var o in n.ref)this.unresolvedRefs.push(o);return this.unresolvedRefs=this.unresolvedRefs.filter((function(e){return void 0===r.schemas[e]})),this.schemas[i]},Ze.prototype.addSubSchemaArray=function(e,t){if(Array.isArray(t))for(var r=0;r<t.length;r++)this.addSubSchema(e,t[r])},Ze.prototype.addSubSchemaObject=function(e,t){if(t&&"object"==typeof t)for(var r in t)this.addSubSchema(e,t[r])},Ze.prototype.setSchemas=function(e){this.schemas=e},Ze.prototype.getSchema=function(e){return this.schemas[e]},Ze.prototype.validate=function(e,t,r,n){if("boolean"!=typeof t&&"object"!=typeof t||null===t)throw new Pe("Expected `schema` to be an object or boolean");r||(r={});var i,o=t.$id||t.id,a=je.resolve(r.base||"/",o||"");if(!n){(n=new $e(t,r,[],a,Object.create(this.schemas))).schemas[a]||(n.schemas[a]=t);var s=ze(a,t);for(var u in s.id){var c=s.id[u];n.schemas[u]=c}}if(r.required&&void 0===e)return(i=new De(e,t,r,n)).addError("is required, but is undefined"),i;if(!(i=this.validateSchema(e,t,r,n)))throw new Error("Result undefined");if(r.throwAll&&i.errors.length)throw new Ne(i);return i},Ze.prototype.validateSchema=function(e,t,r,n){var i=new De(e,t,r,n);if("boolean"==typeof t)!0===t?t={}:!1===t&&(t={type:[]});else if(!t)throw new Error("schema is undefined");if(t.extends)if(Array.isArray(t.extends)){var o={schema:t,ctx:n};t.extends.forEach(this.schemaTraverser.bind(this,o)),t=o.schema,o.schema=null,o.ctx=null,o=null}else t=Fe.deepMerge(t,this.superResolve(t.extends,n));var a=Re(t);if(a){var s=this.resolve(t,a,n),u=new $e(s.subschema,r,n.path,s.switchSchema,n.schemas);return this.validateSchema(e,s.subschema,r,u)}var c=r&&r.skipAttributes||[];for(var f in t)if(!Se.ignoreProperties[f]&&c.indexOf(f)<0){var h=null,l=this.attributes[f];if(l)h=l.call(this,e,t,r,n);else if(!1===r.allowUnknownAttributes)throw new Pe("Unsupported attribute: "+f,t);h&&i.importErrors(h)}if("function"==typeof r.rewrite){var m=r.rewrite.call(this,e,t,r,n);i.instance=m}return i},Ze.prototype.schemaTraverser=function(e,t){e.schema=Fe.deepMerge(e.schema,this.superResolve(t,e.ctx))},Ze.prototype.superResolve=function(e,t){var r=Re(e);return r?this.resolve(e,r,t).subschema:e},Ze.prototype.resolve=function(e,t,r){if(t=r.resolve(t),r.schemas[t])return{subschema:r.schemas[t],switchSchema:t};var n=je.parse(t),i=n&&n.hash,o=i&&i.length&&t.substr(0,t.length-i.length);if(!o||!r.schemas[o])throw new Pe("no such schema <"+t+">",e);var a=Fe.objectGetPath(r.schemas[o],i.substr(1));if(void 0===a)throw new Pe("no such schema "+i+" located in <"+o+">",e);return{subschema:a,switchSchema:t}},Ze.prototype.testType=function(e,t,r,n,i){if(void 0!==i){if(null===i)throw new Pe('Unexpected null in "type" keyword');if("function"==typeof this.types[i])return this.types[i].call(this,e);if(i&&"object"==typeof i){var o=this.validateSchema(e,i,r,n);return void 0===o||!(o&&o.errors.length)}return!0}};var Ie=Ze.prototype.types={};Ie.string=function(e){return"string"==typeof e},Ie.number=function(e){return"number"==typeof e&&isFinite(e)},Ie.integer=function(e){return"number"==typeof e&&e%1==0},Ie.boolean=function(e){return"boolean"==typeof e},Ie.array=function(e){return Array.isArray(e)},Ie.null=function(e){return null===e},Ie.date=function(e){return e instanceof Date},Ie.any=function(e){return!0},Ie.object=function(e){return e&&"object"==typeof e&&!Array.isArray(e)&&!(e instanceof Date)};var Ce=Ze,ke="^[a-zA-Z0-9_.-]*$",_e={type:"object",id:"/CreateFsPropsSchema",properties:{databaseName:{minLength:4,maxLength:50,type:"string",pattern:ke},objectStoreName:{minLength:1,maxLength:20,type:"string",pattern:ke},rootDirectoryName:{minLength:1,maxLength:20,type:"string",pattern:ke},databaseVersion:{minimum:1,maximum:100,type:"integer"}},required:["databaseName","databaseVersion","objectStoreName","rootDirectoryName"]};function qe(e){var t,r,n,i=(t=e,r=_e,(new Ce).validate(t,r,n)),o=i.valid,a=i.errors;if(o)return o;var s=JSON.stringify(a);throw new Error("Props passed to createFS function are invalid:\n"+s)}function Me(e,t){return""===e?t:function(e,t){if(!i(e)||!i(t)||""===t)return!1;var r=t+"/";return e.startsWith(r)}(e,t)?e:t+(function(e){return!(!i(e)||0===e.length)&&"/"===e[0]}(e)?"":"/")+e}function Ve(e,t){if(!i(t)||""===t)throw new Error("rootDirectoryName parameter was not provided");if(!i(e))throw new Error("fullPath parameter was not provided");if(e===t)return t;var r=Me(e,t);if(!r||!function(e){return!!i(e)&&a.test(e)}(r))throw new Error('"'+e+'" path is invalid.');return r}var Le=function(e){var t=e.initializeObjectStore;return function(e,i){return r(void 0,void 0,void 0,(function(){var r;return n(this,(function(n){switch(n.label){case 0:return[4,t("readwrite")];case 1:return r=n.sent(),[2,new Promise((function(t,n){var o=r.put(e,i);o.onerror=n,o.onsuccess=function(){return t(e)}}))]}}))}))}},Te="directory";function Ue(e){return e?e.result:null}function Be(e,t){t||e(new Error("Something went wrong and the database transaction was not opened."))}var Je,Ye=function(e){var t=e.databaseName,r=e.databaseVersion,n=e.objectStoreName;return new Promise((function(e,i){var o=Ke(t,r);o.onupgradeneeded=function(e){var t=Ue(e.target);Be(i,t),t.createObjectStore(n,{keyPath:"fullPath"}).createIndex(Te,Te,{unique:!1})},o.onsuccess=function(t){var r=t.target,n=Ue(r);Be(i,n),e(Ue(r))},o.onerror=i}))},Ge=function(e){var t=e.initializeObjectStore;return function(e){return r(void 0,void 0,void 0,(function(){var r;return n(this,(function(n){switch(n.label){case 0:return[4,t("readwrite")];case 1:return r=n.sent(),[2,new Promise((function(t,n){var i=r.delete(e);i.onerror=n,i.onsuccess=function(){return t()}}))]}}))}))}},Ke=function(e,t){return indexedDB.open(e,t)};!function(e){e.FILE="file",e.DIRECTORY="directory"}(Je||(Je={}));function He(e,t){for(var r=0,n=e.length-1;n>=0;n--){var i=e[n];"."===i?e.splice(n,1):".."===i?(e.splice(n,1),r++):r&&(e.splice(n,1),r--)}if(t)for(;r--;r)e.unshift("..");return e}var We=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,Xe=function(e){return We.exec(e).slice(1)};function Qe(){for(var e="",t=!1,r=arguments.length-1;r>=-1&&!t;r--){var n=r>=0?arguments[r]:"/";if("string"!=typeof n)throw new TypeError("Arguments to path.resolve must be strings");n&&(e=n+"/"+e,t="/"===n.charAt(0))}return(t?"/":"")+(e=He(nt(e.split("/"),(function(e){return!!e})),!t).join("/"))||"."}function et(e){var t=tt(e),r="/"===it(e,-1);return(e=He(nt(e.split("/"),(function(e){return!!e})),!t).join("/"))||t||(e="."),e&&r&&(e+="/"),(t?"/":"")+e}function tt(e){return"/"===e.charAt(0)}var rt={extname:function(e){return Xe(e)[3]},basename:function(e,t){var r=Xe(e)[2];return t&&r.substr(-1*t.length)===t&&(r=r.substr(0,r.length-t.length)),r},dirname:function(e){var t=Xe(e),r=t[0],n=t[1];return r||n?(n&&(n=n.substr(0,n.length-1)),r+n):"."},sep:"/",delimiter:":",relative:function(e,t){function r(e){for(var t=0;t<e.length&&""===e[t];t++);for(var r=e.length-1;r>=0&&""===e[r];r--);return t>r?[]:e.slice(t,r-t+1)}e=Qe(e).substr(1),t=Qe(t).substr(1);for(var n=r(e.split("/")),i=r(t.split("/")),o=Math.min(n.length,i.length),a=o,s=0;s<o;s++)if(n[s]!==i[s]){a=s;break}var u=[];for(s=a;s<n.length;s++)u.push("..");return(u=u.concat(i.slice(a))).join("/")},join:function(){var e=Array.prototype.slice.call(arguments,0);return et(nt(e,(function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e})).join("/"))},isAbsolute:tt,normalize:et,resolve:Qe};function nt(e,t){if(e.filter)return e.filter(t);for(var r=[],n=0;n<e.length;n++)t(e[n],n,e)&&r.push(e[n]);return r}var it="b"==="ab".substr(-1)?function(e,t,r){return e.substr(t,r)}:function(e,t,r){return t<0&&(t=e.length+t),e.substr(t,r)},ot=function(e){var t=e.isDirectory,i=e.rootDirectoryName,o=e.initializeObjectStore;return function(e){return r(void 0,void 0,void 0,(function(){var r,a;return n(this,(function(n){switch(n.label){case 0:return r=Ve(e,i),[4,t(e)];case 1:if(!n.sent())throw new Error('"'+r+'" is not a directory.');return[4,o("readonly")];case 2:return a=n.sent(),[2,new Promise((function(e,t){var n=a.index(Te),i=IDBKeyRange.only(r),o=n.openCursor(i);o.onerror=t;var s=[],u=[];o.onsuccess=function(t){var r=t.target.result;if(r){var n=r.value;if(n.type===Je.FILE){n.data;var i=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r}(n,["data"]);s.push(i)}else n.type!==Je.DIRECTORY||n.isRoot||u.push(n);r.continue()}else{var o=s.length,a=u.length;e({isEmpty:0===o&&0===a,filesCount:o,directoriesCount:a,files:s,directories:u})}}}))]}}))}))}},at={databaseVersion:1,objectStoreName:"files",rootDirectoryName:"root",databaseName:"indexeddb-fs"};function st(e){var i=this,a=void 0===e?at:e,s=a.databaseName,u=void 0===s?at.databaseName:s,c=a.databaseVersion,f=void 0===c?at.databaseVersion:c,h=a.objectStoreName,l=void 0===h?at.objectStoreName:h,m=a.rootDirectoryName,d=void 0===m?at.rootDirectoryName:m;var p=function(e){var t=e.databaseName,i=e.databaseVersion,o=e.objectStoreName;return function(e){return r(void 0,void 0,void 0,(function(){return n(this,(function(r){switch(r.label){case 0:return[4,Ye({databaseName:t,databaseVersion:i,objectStoreName:o})];case 1:return[2,r.sent().transaction(o,e).objectStore(o)]}}))}))}}({databaseName:u,databaseVersion:f,objectStoreName:l}),v=function(e){var t=e.rootDirectoryName,i=e.initializeObjectStore;return function(e){return r(void 0,void 0,void 0,(function(){var r,o;return n(this,(function(n){switch(n.label){case 0:return r=Ve(e,t),[4,i("readonly")];case 1:return o=n.sent(),[2,new Promise((function(e){var t=o.get(r);t.onerror=function(){return e(!1)},t.onsuccess=function(t){var r=t.target.result;e(Boolean(null==r?void 0:r.createdAt))}}))]}}))}))}}({rootDirectoryName:d,initializeObjectStore:p}),y=function(e){var t=e.exists,i=e.rootDirectoryName,o=e.initializeObjectStore;return function(e){return r(void 0,void 0,void 0,(function(){var r,a;return n(this,(function(n){switch(n.label){case 0:return r=Ve(e,i),[4,t(r)];case 1:if(!n.sent())throw new Error('"'+r+'" file does not exist.');return[4,o("readonly")];case 2:return a=n.sent(),[2,new Promise((function(e){var t=a.get(r);t.onerror=function(){return e(!1)},t.onsuccess=function(t){var r=t.target.result;e(Boolean((null==r?void 0:r.type)===Je.FILE))}}))]}}))}))}}({exists:v,rootDirectoryName:d,initializeObjectStore:p}),b=function(e){var t=e.exists,i=e.rootDirectoryName,o=e.initializeObjectStore;return function(e){return r(void 0,void 0,void 0,(function(){var r;return n(this,(function(n){switch(n.label){case 0:return r=Ve(e,i),[4,t(r)];case 1:if(!n.sent())throw new Error('"'+r+'" file or directory does not exist.');return[2,Ge({initializeObjectStore:o})(r)]}}))}))}}({exists:v,rootDirectoryName:d,initializeObjectStore:p}),g=function(e){var t=e.isFile,i=e.rootDirectoryName,o=e.initializeObjectStore;return function(e){return r(void 0,void 0,void 0,(function(){var r,a;return n(this,(function(n){switch(n.label){case 0:return r=Ve(e,i),[4,t(r)];case 1:if(!n.sent())throw new Error('"'+r+'" is not a file.');return[4,o("readonly")];case 2:return a=n.sent(),[2,new Promise((function(e,t){var n=a.getAll(r);n.onerror=t,n.onsuccess=function(t){var r=t.target.result.find((function(e){return e.type===Je.FILE}));e(r)}}))]}}))}))}}({isFile:y,rootDirectoryName:d,initializeObjectStore:p}),w=function(e){var t=e.fileDetails;return function(e){return r(void 0,void 0,void 0,(function(){return n(this,(function(r){switch(r.label){case 0:return[4,t(e)];case 1:return[2,r.sent().data]}}))}))}}({fileDetails:g}),A=function(e){var t=e.isFile,i=e.rootDirectoryName,o=e.initializeObjectStore;return function(e){return r(void 0,void 0,void 0,(function(){var r;return n(this,(function(n){switch(n.label){case 0:return r=Ve(e,i),[4,t(r)];case 1:if(!n.sent())throw new Error('"'+r+'" is not a file.');return[2,Ge({initializeObjectStore:o})(r)]}}))}))}}({isFile:y,rootDirectoryName:d,initializeObjectStore:p}),x=function(e){var t=e.exists,i=e.rootDirectoryName,o=e.initializeObjectStore;return function(e){return r(void 0,void 0,void 0,(function(){var r,a;return n(this,(function(n){switch(n.label){case 0:return r=Ve(e,i),[4,t(r)];case 1:if(!n.sent())throw new Error('"'+r+'" directory does not exist.');return[4,o("readonly")];case 2:return a=n.sent(),[2,new Promise((function(e){var t=a.get(r);t.onerror=function(){return e(!1)},t.onsuccess=function(t){var r=t.target.result;e(Boolean((null==r?void 0:r.type)===Je.DIRECTORY))}}))]}}))}))}}({exists:v,rootDirectoryName:d,initializeObjectStore:p}),E=function(e){var t=e.isDirectory,i=e.rootDirectoryName,a=e.initializeObjectStore;return function(e,s){return r(void 0,void 0,void 0,(function(){var r,u,c,f;return n(this,(function(n){switch(n.label){case 0:if((r=Ve(e,i))===i)throw new Error('Root directory: "'+r+'" cannot be a file.');return u=rt.basename(r),c=rt.dirname(r),[4,t(c)];case 1:if(!n.sent())throw new Error('"'+c+'" directory does not exist.');return[4,o((function(){return t(r)}),(function(){return!1}))];case 2:if(n.sent())throw new Error('"'+r+'" you cannot create a file with the same name as the directory.');return f={data:s,directory:c,name:u,type:Je.FILE,createdAt:Date.now(),fullPath:r},[2,Le({initializeObjectStore:a})(f)]}}))}))}}({isDirectory:x,rootDirectoryName:d,initializeObjectStore:p}),O=function(e){var t=e.isFile,i=e.exists,o=e.writeFile,a=e.isDirectory,s=e.fileDetails,u=e.rootDirectoryName;return function(e,c){return r(void 0,void 0,void 0,(function(){var r,f,h,l;return n(this,(function(n){switch(n.label){case 0:return r=Ve(e,u),f=Ve(c,u),[4,t(r)];case 1:if(!n.sent())throw new Error('"'+r+'" source is not a file.');return h=rt.dirname(f),[4,a(h)];case 2:if(!n.sent())throw new Error('"'+h+'" destination directory does not exist.');return[4,i(f)];case 3:if(n.sent())throw new Error('"'+f+'" is already taken.');return[4,s(r)];case 4:return l=n.sent(),[2,o(f,l.data)]}}))}))}}({exists:v,isFile:y,writeFile:E,fileDetails:g,isDirectory:x,rootDirectoryName:d}),j=ot({isDirectory:x,rootDirectoryName:d,initializeObjectStore:p}),S=function(e){var t=e.isFile,i=e.isDirectory,a=e.rootDirectoryName,s=e.initializeObjectStore;return function(e){return r(void 0,void 0,void 0,(function(){var r,u,c,f;return n(this,(function(n){switch(n.label){case 0:if((r=Ve(e,a))===a)throw new Error('Root directory: "'+r+'" already exist.');return u=rt.basename(r),c=rt.dirname(r),[4,i(c)];case 1:if(!n.sent())throw new Error('"'+c+'" is not a directory.');return[4,o((function(){return t(r)}),(function(){return!1}))];case 2:if(n.sent())throw new Error('"'+r+'" you cannot create a directory with the same name as the file.');return f={directory:c,isRoot:!1,name:u,createdAt:Date.now(),type:Je.DIRECTORY,fullPath:r},[2,Le({initializeObjectStore:s})(f)]}}))}))}}({isFile:y,isDirectory:x,rootDirectoryName:d,initializeObjectStore:p}),F=function(e){var t=e.remove,i=e.isDirectory,a=e.readDirectory,s=e.rootDirectoryName;function u(e){return r(this,void 0,void 0,(function(){var r,i,c,f,h,l,m,d,p,v,y,b,g;return n(this,(function(w){switch(w.label){case 0:return r=Ve(e,s),[4,a(r)];case 1:if(i=w.sent(),c=i.files,f=i.filesCount,h=i.directories,l=i.directoriesCount,!(f>0))return[3,5];m=0,d=c,w.label=2;case 2:return m<d.length?(p=d[m],[4,t(p.fullPath)]):[3,5];case 3:w.sent(),w.label=4;case 4:return m++,[3,2];case 5:return l?[3,7]:[4,t(e)];case 6:return w.sent(),[2];case 7:v=function(e){return n(this,(function(r){switch(r.label){case 0:return e.isRoot?[3,2]:[4,u(e.fullPath)];case 1:r.sent(),r.label=2;case 2:return[4,o((function(){return t(e.fullPath)}))];case 3:return r.sent(),[2]}}))},y=0,b=h,w.label=8;case 8:return y<b.length?(g=b[y],[5,v(g)]):[3,11];case 9:w.sent(),w.label=10;case 10:return y++,[3,8];case 11:return[2]}}))}))}return function(e){return r(this,void 0,void 0,(function(){return n(this,(function(r){switch(r.label){case 0:return[4,i(e)];case 1:if(!r.sent())throw new Error('"'+e+'" is not a directory.');return[4,u(e)];case 2:return r.sent(),e===s?[3,4]:[4,o((function(){return t(e)}))];case 3:r.sent(),r.label=4;case 4:return[2]}}))}))}}({remove:b,isDirectory:x,readDirectory:j,rootDirectoryName:d}),z=function(e){var t=e.isDirectory,i=e.rootDirectoryName,o=e.initializeObjectStore;return function(e){return r(void 0,void 0,void 0,(function(){var r,a;return n(this,(function(n){switch(n.label){case 0:return r=Ve(e,i),[4,t(e)];case 1:if(!n.sent())throw new Error('"'+r+'" is not a directory.');return[4,o("readonly")];case 2:return a=n.sent(),[2,new Promise((function(e,t){var n=a.getAll(r);n.onerror=t,n.onsuccess=function(t){var r=t.target.result.find((function(e){return e.type===Je.DIRECTORY}));e(r)}}))]}}))}))}}({isDirectory:x,rootDirectoryName:d,initializeObjectStore:p}),D=function(e){var t=e.exists,i=e.isFile,o=e.isDirectory,a=e.fileDetails,s=e.directoryDetails,u=e.rootDirectoryName;return function(e){return r(void 0,void 0,void 0,(function(){var r,c,f;return n(this,(function(n){switch(n.label){case 0:return r=Ve(e,u),[4,t(r)];case 1:if(!n.sent())throw new Error('"'+r+'" file or directory does not exist.');return[4,i(r)];case 2:return c=n.sent(),[4,o(r)];case 3:if(f=n.sent(),c&&f)throw new Error('"'+r+'" is a path of file and directory.');return c?[2,a(r)]:[2,s(r)]}}))}))}}({isFile:y,exists:v,isDirectory:x,fileDetails:g,directoryDetails:z,rootDirectoryName:d}),N=function(e){var i=e.isDirectory,a=e.fileDetails,s=e.rootDirectoryName,u=e.initializeObjectStore;return function(e,c){return r(void 0,void 0,void 0,(function(){var r,f,h,l;return n(this,(function(n){switch(n.label){case 0:return r=Ve(e,s),f=rt.dirname(r),[4,i(f)];case 1:if(!n.sent())throw new Error('"'+f+'" directory does not exist.');return[4,o((function(){return i(r)}),(function(){return!1}))];case 2:if(n.sent())throw new Error('"'+r+'" you cannot update a file with the same name as the directory.');return[4,a(r)];case 3:return h=n.sent(),l=t(t({},h),c),[2,Le({initializeObjectStore:u})(l)]}}))}))}}({fileDetails:g,isDirectory:x,rootDirectoryName:d,initializeObjectStore:p}),P=function(e){var t=e.isFile,i=e.exists,o=e.removeFile,a=e.updateFileDetails,s=e.rootDirectoryName;return function(e,u){return r(void 0,void 0,void 0,(function(){var r,c,f,h;return n(this,(function(n){switch(n.label){case 0:return r=Ve(e,s),[4,t(r)];case 1:if(!n.sent())throw new Error('"'+r+'" is not a file.');return c=rt.dirname(r),[4,i(f=c+"/"+u)];case 2:if(n.sent())throw new Error('"'+f+'" is already taken.');return[4,a(r,{name:u,fullPath:f})];case 3:return h=n.sent(),[4,o(r)];case 4:return n.sent(),[2,h]}}))}))}}({exists:v,isFile:y,removeFile:A,updateFileDetails:N,rootDirectoryName:d}),$=function(e){var t=e.rootDirectoryName,i=e.initializeObjectStore;return function(){return r(void 0,void 0,void 0,(function(){var e;return n(this,(function(r){return e={isRoot:!0,createdAt:Date.now(),name:t,type:Je.DIRECTORY,fullPath:t,directory:t},[2,Le({initializeObjectStore:i})(e)]}))}))}}({rootDirectoryName:d,initializeObjectStore:p});function Z(){return r(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return[4,v(d)];case 1:return e.sent()?[3,3]:[4,$()];case 2:e.sent(),e.label=3;case 3:return[2]}}))}))}var R=function(e){return function(){for(var t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];return r(i,void 0,void 0,(function(){return n(this,(function(r){switch(r.label){case 0:return[4,Z()];case 1:return r.sent(),[2,e.apply(void 0,t)]}}))}))}};return function(){if(!Boolean(indexedDB))throw new Error("Your browser does not support indexedDB.")}(),qe({databaseName:u,objectStoreName:l,databaseVersion:f,rootDirectoryName:d}),{databaseName:u,databaseVersion:f,objectStoreName:l,rootDirectoryName:d,exists:R(v),isFile:R(y),remove:R(b),details:R(D),copyFile:R(O),readFile:R(w),writeFile:R(E),renameFile:R(P),removeFile:R(A),fileDetails:R(g),isDirectory:R(x),readDirectory:R(j),createDirectory:R(S),removeDirectory:R(F),directoryDetails:R(z)}}var ut=st();e.createFs=st,e.default=ut,Object.defineProperty(e,"__esModule",{value:!0})})); |
{ | ||
"name": "indexeddb-fs", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "An 'fs' kind of library dedicated for the browser. It works based on indexed-db.", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
226230
75
4579