@graffiti-garden/implementation-local 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -2
- package/dist/cjs/database.js +1 -1
- package/dist/cjs/database.js.map +3 -3
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +3 -3
- package/dist/cjs/utilities.js +1 -1
- package/dist/cjs/utilities.js.map +3 -3
- package/dist/database.d.ts +4 -4
- package/dist/database.d.ts.map +1 -1
- package/dist/esm/database.js +1 -1
- package/dist/esm/database.js.map +3 -3
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +3 -3
- package/dist/esm/utilities.js +1 -1
- package/dist/esm/utilities.js.map +3 -3
- package/dist/index.browser.js +10 -10
- package/dist/index.browser.js.map +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/utilities.d.ts +2 -2
- package/dist/utilities.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/database.ts +46 -24
- package/src/index.ts +1 -3
- package/src/utilities.ts +10 -3
package/dist/index.browser.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
var ep=Object.create;var as=Object.defineProperty;var tp=Object.getOwnPropertyDescriptor;var rp=Object.getOwnPropertyNames;var np=Object.getPrototypeOf,ip=Object.prototype.hasOwnProperty;var Pr=(t,e)=>()=>(t&&(e=t(t=0)),e);var Y=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),us=(t,e)=>{for(var r in e)as(t,r,{get:e[r],enumerable:!0})},sp=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of rp(e))!ip.call(t,i)&&i!==r&&as(t,i,{get:()=>e[i],enumerable:!(n=tp(e,i))||n.enumerable});return t};var Mn=(t,e,r)=>(r=t!=null?ep(np(t)):{},sp(e||!t||!t.__esModule?as(r,"default",{value:t,enumerable:!0}):r,t));var I=Pr(()=>{});var K={};us(K,{_debugEnd:()=>ec,_debugProcess:()=>Zu,_events:()=>vc,_eventsCount:()=>yc,_exiting:()=>xu,_fatalExceptions:()=>Wu,_getActiveHandles:()=>Bu,_getActiveRequests:()=>Du,_kill:()=>Mu,_linkedBinding:()=>Cu,_maxListeners:()=>mc,_preload_modules:()=>dc,_rawDebug:()=>Ru,_startProfilerIdleNotifier:()=>tc,_stopProfilerIdleNotifier:()=>rc,_tickCallback:()=>Xu,abort:()=>oc,addListener:()=>gc,allowedNodeEnvironmentFlags:()=>Vu,arch:()=>vu,argv:()=>_u,argv0:()=>lc,assert:()=>Ju,binding:()=>Su,browser:()=>Tu,chdir:()=>Au,config:()=>Nu,cpuUsage:()=>Fn,cwd:()=>Ou,debugPort:()=>fc,default:()=>Ac,dlopen:()=>ju,domain:()=>ku,emit:()=>$c,emitWarning:()=>$u,env:()=>gu,execArgv:()=>wu,execPath:()=>cc,exit:()=>Ku,features:()=>Hu,hasUncaughtExceptionCaptureCallback:()=>Yu,hrtime:()=>Gn,kill:()=>Fu,listeners:()=>Oc,memoryUsage:()=>Gu,moduleLoadList:()=>qu,nextTick:()=>hu,off:()=>wc,on:()=>xt,once:()=>_c,openStdin:()=>zu,pid:()=>ac,platform:()=>yu,ppid:()=>uc,prependListener:()=>Sc,prependOnceListener:()=>Pc,reallyExit:()=>Lu,release:()=>Iu,removeAllListeners:()=>Ec,removeListener:()=>bc,resourceUsage:()=>Uu,setSourceMapsEnabled:()=>hc,setUncaughtExceptionCaptureCallback:()=>Qu,stderr:()=>ic,stdin:()=>sc,stdout:()=>nc,title:()=>mu,umask:()=>Pu,uptime:()=>pc,version:()=>bu,versions:()=>Eu});function ls(t){throw new Error("Node.js process "+t+" is not supported by JSPM core outside of Node.js")}function op(){!Or||!er||(Or=!1,er.length?kt=er.concat(kt):Un=-1,kt.length&&du())}function du(){if(!Or){var t=setTimeout(op,0);Or=!0;for(var e=kt.length;e;){for(er=kt,kt=[];++Un<e;)er&&er[Un].run();Un=-1,e=kt.length}er=null,Or=!1,clearTimeout(t)}}function hu(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];kt.push(new pu(t,e)),kt.length===1&&!Or&&setTimeout(du,0)}function pu(t,e){this.fun=t,this.array=e}function Qe(){}function Cu(t){ls("_linkedBinding")}function ju(t){ls("dlopen")}function Du(){return[]}function Bu(){return[]}function Ju(t,e){if(!t)throw new Error(e||"assertion error")}function Yu(){return!1}function pc(){return Gt.now()/1e3}function Gn(t){var e=Math.floor((Date.now()-Gt.now())*.001),r=Gt.now()*.001,n=Math.floor(r)+e,i=Math.floor(r%1*1e9);return t&&(n=n-t[0],i=i-t[1],i<0&&(n--,i+=fs)),[n,i]}function xt(){return Ac}function Oc(t){return[]}var kt,Or,er,Un,mu,vu,yu,gu,_u,wu,bu,Eu,$u,Su,Pu,Ou,Au,Iu,Tu,Ru,qu,ku,xu,Nu,Lu,Mu,Fn,Uu,Gu,Fu,Ku,zu,Vu,Hu,Wu,Qu,Xu,Zu,ec,tc,rc,nc,ic,sc,oc,ac,uc,cc,fc,lc,dc,hc,Gt,cs,fs,mc,vc,yc,gc,_c,wc,bc,Ec,$c,Sc,Pc,Ac,Ic=Pr(()=>{I();R();T();kt=[],Or=!1,Un=-1;pu.prototype.run=function(){this.fun.apply(null,this.array)};mu="browser",vu="x64",yu="browser",gu={PATH:"/usr/bin",LANG:typeof navigator<"u"?navigator.language+".UTF-8":void 0,PWD:"/",HOME:"/home",TMP:"/tmp"},_u=["/usr/bin/node"],wu=[],bu="v16.8.0",Eu={},$u=function(t,e){console.warn((e?e+": ":"")+t)},Su=function(t){ls("binding")},Pu=function(t){return 0},Ou=function(){return"/"},Au=function(t){},Iu={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};Tu=!0,Ru=Qe,qu=[];ku={},xu=!1,Nu={};Lu=Qe,Mu=Qe,Fn=function(){return{}},Uu=Fn,Gu=Fn,Fu=Qe,Ku=Qe,zu=Qe,Vu={};Hu={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},Wu=Qe,Qu=Qe;Xu=Qe,Zu=Qe,ec=Qe,tc=Qe,rc=Qe,nc=void 0,ic=void 0,sc=void 0,oc=Qe,ac=2,uc=1,cc="/bin/usr/node",fc=9229,lc="node",dc=[],hc=Qe,Gt={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};Gt.now===void 0&&(cs=Date.now(),Gt.timing&&Gt.timing.navigationStart&&(cs=Gt.timing.navigationStart),Gt.now=()=>Date.now()-cs);fs=1e9;Gn.bigint=function(t){var e=Gn(t);return typeof BigInt>"u"?e[0]*fs+e[1]:BigInt(e[0]*fs)+BigInt(e[1])};mc=10,vc={},yc=0;gc=xt,_c=xt,wc=xt,bc=xt,Ec=xt,$c=Qe,Sc=xt,Pc=xt;Ac={version:bu,versions:Eu,arch:vu,platform:yu,browser:Tu,release:Iu,_rawDebug:Ru,moduleLoadList:qu,binding:Su,_linkedBinding:Cu,_events:vc,_eventsCount:yc,_maxListeners:mc,on:xt,addListener:gc,once:_c,off:wc,removeListener:bc,removeAllListeners:Ec,emit:$c,prependListener:Sc,prependOnceListener:Pc,listeners:Oc,domain:ku,_exiting:xu,config:Nu,dlopen:ju,uptime:pc,_getActiveRequests:Du,_getActiveHandles:Bu,reallyExit:Lu,_kill:Mu,cpuUsage:Fn,resourceUsage:Uu,memoryUsage:Gu,kill:Fu,exit:Ku,openStdin:zu,allowedNodeEnvironmentFlags:Vu,assert:Ju,features:Hu,_fatalExceptions:Wu,setUncaughtExceptionCaptureCallback:Qu,hasUncaughtExceptionCaptureCallback:Yu,emitWarning:$u,nextTick:hu,_tickCallback:Xu,_debugProcess:Zu,_debugEnd:ec,_startProfilerIdleNotifier:tc,_stopProfilerIdleNotifier:rc,stdout:nc,stdin:sc,stderr:ic,abort:oc,umask:Pu,chdir:Au,cwd:Ou,env:gu,title:mu,argv:_u,execArgv:wu,pid:ac,ppid:uc,execPath:cc,debugPort:fc,hrtime:Gn,argv0:lc,_preload_modules:dc,setSourceMapsEnabled:hc}});var T=Pr(()=>{Ic()});function ap(){if(Tc)return Xr;Tc=!0,Xr.byteLength=a,Xr.toByteArray=d,Xr.fromByteArray=g;for(var t=[],e=[],r=typeof Uint8Array<"u"?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,s=n.length;i<s;++i)t[i]=n[i],e[n.charCodeAt(i)]=i;e[45]=62,e[95]=63;function o(_){var b=_.length;if(b%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var P=_.indexOf("=");P===-1&&(P=b);var S=P===b?0:4-P%4;return[P,S]}function a(_){var b=o(_),P=b[0],S=b[1];return(P+S)*3/4-S}function c(_,b,P){return(b+P)*3/4-P}function d(_){var b,P=o(_),S=P[0],y=P[1],w=new r(c(_,S,y)),p=0,h=y>0?S-4:S,v;for(v=0;v<h;v+=4)b=e[_.charCodeAt(v)]<<18|e[_.charCodeAt(v+1)]<<12|e[_.charCodeAt(v+2)]<<6|e[_.charCodeAt(v+3)],w[p++]=b>>16&255,w[p++]=b>>8&255,w[p++]=b&255;return y===2&&(b=e[_.charCodeAt(v)]<<2|e[_.charCodeAt(v+1)]>>4,w[p++]=b&255),y===1&&(b=e[_.charCodeAt(v)]<<10|e[_.charCodeAt(v+1)]<<4|e[_.charCodeAt(v+2)]>>2,w[p++]=b>>8&255,w[p++]=b&255),w}function m(_){return t[_>>18&63]+t[_>>12&63]+t[_>>6&63]+t[_&63]}function f(_,b,P){for(var S,y=[],w=b;w<P;w+=3)S=(_[w]<<16&16711680)+(_[w+1]<<8&65280)+(_[w+2]&255),y.push(m(S));return y.join("")}function g(_){for(var b,P=_.length,S=P%3,y=[],w=16383,p=0,h=P-S;p<h;p+=w)y.push(f(_,p,p+w>h?h:p+w));return S===1?(b=_[P-1],y.push(t[b>>2]+t[b<<4&63]+"==")):S===2&&(b=(_[P-2]<<8)+_[P-1],y.push(t[b>>10]+t[b>>4&63]+t[b<<2&63]+"=")),y.join("")}return Xr}function up(){if(Rc)return Kn;Rc=!0;return Kn.read=function(t,e,r,n,i){var s,o,a=i*8-n-1,c=(1<<a)-1,d=c>>1,m=-7,f=r?i-1:0,g=r?-1:1,_=t[e+f];for(f+=g,s=_&(1<<-m)-1,_>>=-m,m+=a;m>0;s=s*256+t[e+f],f+=g,m-=8);for(o=s&(1<<-m)-1,s>>=-m,m+=n;m>0;o=o*256+t[e+f],f+=g,m-=8);if(s===0)s=1-d;else{if(s===c)return o?NaN:(_?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-d}return(_?-1:1)*o*Math.pow(2,s-n)},Kn.write=function(t,e,r,n,i,s){var o,a,c,d=s*8-i-1,m=(1<<d)-1,f=m>>1,g=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,_=n?0:s-1,b=n?1:-1,P=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=m):(o=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-o))<1&&(o--,c*=2),o+f>=1?e+=g/c:e+=g*Math.pow(2,1-f),e*c>=2&&(o++,c/=2),o+f>=m?(a=0,o=m):o+f>=1?(a=(e*c-1)*Math.pow(2,i),o=o+f):(a=e*Math.pow(2,f-1)*Math.pow(2,i),o=0));i>=8;t[r+_]=a&255,_+=b,a/=256,i-=8);for(o=o<<i|a,d+=i;d>0;t[r+_]=o&255,_+=b,o/=256,d-=8);t[r+_-b]|=P*128},Kn}function Cc(){if(qc)return tr;qc=!0;let t=ap(),e=up(),r=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;tr.Buffer=o,tr.SlowBuffer=y,tr.INSPECT_MAX_BYTES=50;let n=2147483647;tr.kMaxLength=n,o.TYPED_ARRAY_SUPPORT=i(),!o.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function i(){try{let $=new Uint8Array(1),u={foo:function(){return 42}};return Object.setPrototypeOf(u,Uint8Array.prototype),Object.setPrototypeOf($,u),$.foo()===42}catch{return!1}}Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}});function s($){if($>n)throw new RangeError('The value "'+$+'" is invalid for option "size"');let u=new Uint8Array($);return Object.setPrototypeOf(u,o.prototype),u}function o($,u,l){if(typeof $=="number"){if(typeof u=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return m($)}return a($,u,l)}o.poolSize=8192;function a($,u,l){if(typeof $=="string")return f($,u);if(ArrayBuffer.isView($))return _($);if($==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof $);if(Pe($,ArrayBuffer)||$&&Pe($.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Pe($,SharedArrayBuffer)||$&&Pe($.buffer,SharedArrayBuffer)))return b($,u,l);if(typeof $=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let O=$.valueOf&&$.valueOf();if(O!=null&&O!==$)return o.from(O,u,l);let A=P($);if(A)return A;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof $[Symbol.toPrimitive]=="function")return o.from($[Symbol.toPrimitive]("string"),u,l);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof $)}o.from=function($,u,l){return a($,u,l)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array);function c($){if(typeof $!="number")throw new TypeError('"size" argument must be of type number');if($<0)throw new RangeError('The value "'+$+'" is invalid for option "size"')}function d($,u,l){return c($),$<=0?s($):u!==void 0?typeof l=="string"?s($).fill(u,l):s($).fill(u):s($)}o.alloc=function($,u,l){return d($,u,l)};function m($){return c($),s($<0?0:S($)|0)}o.allocUnsafe=function($){return m($)},o.allocUnsafeSlow=function($){return m($)};function f($,u){if((typeof u!="string"||u==="")&&(u="utf8"),!o.isEncoding(u))throw new TypeError("Unknown encoding: "+u);let l=w($,u)|0,O=s(l),A=O.write($,u);return A!==l&&(O=O.slice(0,A)),O}function g($){let u=$.length<0?0:S($.length)|0,l=s(u);for(let O=0;O<u;O+=1)l[O]=$[O]&255;return l}function _($){if(Pe($,Uint8Array)){let u=new Uint8Array($);return b(u.buffer,u.byteOffset,u.byteLength)}return g($)}function b($,u,l){if(u<0||$.byteLength<u)throw new RangeError('"offset" is outside of buffer bounds');if($.byteLength<u+(l||0))throw new RangeError('"length" is outside of buffer bounds');let O;return u===void 0&&l===void 0?O=new Uint8Array($):l===void 0?O=new Uint8Array($,u):O=new Uint8Array($,u,l),Object.setPrototypeOf(O,o.prototype),O}function P($){if(o.isBuffer($)){let u=S($.length)|0,l=s(u);return l.length===0||$.copy(l,0,0,u),l}if($.length!==void 0)return typeof $.length!="number"||Xt($.length)?s(0):g($);if($.type==="Buffer"&&Array.isArray($.data))return g($.data)}function S($){if($>=n)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n.toString(16)+" bytes");return $|0}function y($){return+$!=$&&($=0),o.alloc(+$)}o.isBuffer=function(u){return u!=null&&u._isBuffer===!0&&u!==o.prototype},o.compare=function(u,l){if(Pe(u,Uint8Array)&&(u=o.from(u,u.offset,u.byteLength)),Pe(l,Uint8Array)&&(l=o.from(l,l.offset,l.byteLength)),!o.isBuffer(u)||!o.isBuffer(l))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(u===l)return 0;let O=u.length,A=l.length;for(let N=0,U=Math.min(O,A);N<U;++N)if(u[N]!==l[N]){O=u[N],A=l[N];break}return O<A?-1:A<O?1:0},o.isEncoding=function(u){switch(String(u).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},o.concat=function(u,l){if(!Array.isArray(u))throw new TypeError('"list" argument must be an Array of Buffers');if(u.length===0)return o.alloc(0);let O;if(l===void 0)for(l=0,O=0;O<u.length;++O)l+=u[O].length;let A=o.allocUnsafe(l),N=0;for(O=0;O<u.length;++O){let U=u[O];if(Pe(U,Uint8Array))N+U.length>A.length?(o.isBuffer(U)||(U=o.from(U)),U.copy(A,N)):Uint8Array.prototype.set.call(A,U,N);else if(o.isBuffer(U))U.copy(A,N);else throw new TypeError('"list" argument must be an Array of Buffers');N+=U.length}return A};function w($,u){if(o.isBuffer($))return $.length;if(ArrayBuffer.isView($)||Pe($,ArrayBuffer))return $.byteLength;if(typeof $!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof $);let l=$.length,O=arguments.length>2&&arguments[2]===!0;if(!O&&l===0)return 0;let A=!1;for(;;)switch(u){case"ascii":case"latin1":case"binary":return l;case"utf8":case"utf-8":return ve($).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return l*2;case"hex":return l>>>1;case"base64":return nt($).length;default:if(A)return O?-1:ve($).length;u=(""+u).toLowerCase(),A=!0}}o.byteLength=w;function p($,u,l){let O=!1;if((u===void 0||u<0)&&(u=0),u>this.length||((l===void 0||l>this.length)&&(l=this.length),l<=0)||(l>>>=0,u>>>=0,l<=u))return"";for($||($="utf8");;)switch($){case"hex":return q(this,u,l);case"utf8":case"utf-8":return Q(this,u,l);case"ascii":return fe(this,u,l);case"latin1":case"binary":return me(this,u,l);case"base64":return re(this,u,l);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,u,l);default:if(O)throw new TypeError("Unknown encoding: "+$);$=($+"").toLowerCase(),O=!0}}o.prototype._isBuffer=!0;function h($,u,l){let O=$[u];$[u]=$[l],$[l]=O}o.prototype.swap16=function(){let u=this.length;if(u%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let l=0;l<u;l+=2)h(this,l,l+1);return this},o.prototype.swap32=function(){let u=this.length;if(u%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let l=0;l<u;l+=4)h(this,l,l+3),h(this,l+1,l+2);return this},o.prototype.swap64=function(){let u=this.length;if(u%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let l=0;l<u;l+=8)h(this,l,l+7),h(this,l+1,l+6),h(this,l+2,l+5),h(this,l+3,l+4);return this},o.prototype.toString=function(){let u=this.length;return u===0?"":arguments.length===0?Q(this,0,u):p.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(u){if(!o.isBuffer(u))throw new TypeError("Argument must be a Buffer");return this===u?!0:o.compare(this,u)===0},o.prototype.inspect=function(){let u="",l=tr.INSPECT_MAX_BYTES;return u=this.toString("hex",0,l).replace(/(.{2})/g,"$1 ").trim(),this.length>l&&(u+=" ... "),"<Buffer "+u+">"},r&&(o.prototype[r]=o.prototype.inspect),o.prototype.compare=function(u,l,O,A,N){if(Pe(u,Uint8Array)&&(u=o.from(u,u.offset,u.byteLength)),!o.isBuffer(u))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof u);if(l===void 0&&(l=0),O===void 0&&(O=u?u.length:0),A===void 0&&(A=0),N===void 0&&(N=this.length),l<0||O>u.length||A<0||N>this.length)throw new RangeError("out of range index");if(A>=N&&l>=O)return 0;if(A>=N)return-1;if(l>=O)return 1;if(l>>>=0,O>>>=0,A>>>=0,N>>>=0,this===u)return 0;let U=N-A,he=O-l,ke=Math.min(U,he),Ce=this.slice(A,N),xe=u.slice(l,O);for(let Ae=0;Ae<ke;++Ae)if(Ce[Ae]!==xe[Ae]){U=Ce[Ae],he=xe[Ae];break}return U<he?-1:he<U?1:0};function v($,u,l,O,A){if($.length===0)return-1;if(typeof l=="string"?(O=l,l=0):l>2147483647?l=2147483647:l<-2147483648&&(l=-2147483648),l=+l,Xt(l)&&(l=A?0:$.length-1),l<0&&(l=$.length+l),l>=$.length){if(A)return-1;l=$.length-1}else if(l<0)if(A)l=0;else return-1;if(typeof u=="string"&&(u=o.from(u,O)),o.isBuffer(u))return u.length===0?-1:E($,u,l,O,A);if(typeof u=="number")return u=u&255,typeof Uint8Array.prototype.indexOf=="function"?A?Uint8Array.prototype.indexOf.call($,u,l):Uint8Array.prototype.lastIndexOf.call($,u,l):E($,[u],l,O,A);throw new TypeError("val must be string, number or Buffer")}function E($,u,l,O,A){let N=1,U=$.length,he=u.length;if(O!==void 0&&(O=String(O).toLowerCase(),O==="ucs2"||O==="ucs-2"||O==="utf16le"||O==="utf-16le")){if($.length<2||u.length<2)return-1;N=2,U/=2,he/=2,l/=2}function ke(xe,Ae){return N===1?xe[Ae]:xe.readUInt16BE(Ae*N)}let Ce;if(A){let xe=-1;for(Ce=l;Ce<U;Ce++)if(ke($,Ce)===ke(u,xe===-1?0:Ce-xe)){if(xe===-1&&(xe=Ce),Ce-xe+1===he)return xe*N}else xe!==-1&&(Ce-=Ce-xe),xe=-1}else for(l+he>U&&(l=U-he),Ce=l;Ce>=0;Ce--){let xe=!0;for(let Ae=0;Ae<he;Ae++)if(ke($,Ce+Ae)!==ke(u,Ae)){xe=!1;break}if(xe)return Ce}return-1}o.prototype.includes=function(u,l,O){return this.indexOf(u,l,O)!==-1},o.prototype.indexOf=function(u,l,O){return v(this,u,l,O,!0)},o.prototype.lastIndexOf=function(u,l,O){return v(this,u,l,O,!1)};function C($,u,l,O){l=Number(l)||0;let A=$.length-l;O?(O=Number(O),O>A&&(O=A)):O=A;let N=u.length;O>N/2&&(O=N/2);let U;for(U=0;U<O;++U){let he=parseInt(u.substr(U*2,2),16);if(Xt(he))return U;$[l+U]=he}return U}function x($,u,l,O){return Fe(ve(u,$.length-l),$,l,O)}function j($,u,l,O){return Fe(ge(u),$,l,O)}function G($,u,l,O){return Fe(nt(u),$,l,O)}function H($,u,l,O){return Fe(Se(u,$.length-l),$,l,O)}o.prototype.write=function(u,l,O,A){if(l===void 0)A="utf8",O=this.length,l=0;else if(O===void 0&&typeof l=="string")A=l,O=this.length,l=0;else if(isFinite(l))l=l>>>0,isFinite(O)?(O=O>>>0,A===void 0&&(A="utf8")):(A=O,O=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let N=this.length-l;if((O===void 0||O>N)&&(O=N),u.length>0&&(O<0||l<0)||l>this.length)throw new RangeError("Attempt to write outside buffer bounds");A||(A="utf8");let U=!1;for(;;)switch(A){case"hex":return C(this,u,l,O);case"utf8":case"utf-8":return x(this,u,l,O);case"ascii":case"latin1":case"binary":return j(this,u,l,O);case"base64":return G(this,u,l,O);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return H(this,u,l,O);default:if(U)throw new TypeError("Unknown encoding: "+A);A=(""+A).toLowerCase(),U=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function re($,u,l){return u===0&&l===$.length?t.fromByteArray($):t.fromByteArray($.slice(u,l))}function Q($,u,l){l=Math.min($.length,l);let O=[],A=u;for(;A<l;){let N=$[A],U=null,he=N>239?4:N>223?3:N>191?2:1;if(A+he<=l){let ke,Ce,xe,Ae;switch(he){case 1:N<128&&(U=N);break;case 2:ke=$[A+1],(ke&192)===128&&(Ae=(N&31)<<6|ke&63,Ae>127&&(U=Ae));break;case 3:ke=$[A+1],Ce=$[A+2],(ke&192)===128&&(Ce&192)===128&&(Ae=(N&15)<<12|(ke&63)<<6|Ce&63,Ae>2047&&(Ae<55296||Ae>57343)&&(U=Ae));break;case 4:ke=$[A+1],Ce=$[A+2],xe=$[A+3],(ke&192)===128&&(Ce&192)===128&&(xe&192)===128&&(Ae=(N&15)<<18|(ke&63)<<12|(Ce&63)<<6|xe&63,Ae>65535&&Ae<1114112&&(U=Ae))}}U===null?(U=65533,he=1):U>65535&&(U-=65536,O.push(U>>>10&1023|55296),U=56320|U&1023),O.push(U),A+=he}return ce(O)}let Z=4096;function ce($){let u=$.length;if(u<=Z)return String.fromCharCode.apply(String,$);let l="",O=0;for(;O<u;)l+=String.fromCharCode.apply(String,$.slice(O,O+=Z));return l}function fe($,u,l){let O="";l=Math.min($.length,l);for(let A=u;A<l;++A)O+=String.fromCharCode($[A]&127);return O}function me($,u,l){let O="";l=Math.min($.length,l);for(let A=u;A<l;++A)O+=String.fromCharCode($[A]);return O}function q($,u,l){let O=$.length;(!u||u<0)&&(u=0),(!l||l<0||l>O)&&(l=O);let A="";for(let N=u;N<l;++N)A+=Zt[$[N]];return A}function k($,u,l){let O=$.slice(u,l),A="";for(let N=0;N<O.length-1;N+=2)A+=String.fromCharCode(O[N]+O[N+1]*256);return A}o.prototype.slice=function(u,l){let O=this.length;u=~~u,l=l===void 0?O:~~l,u<0?(u+=O,u<0&&(u=0)):u>O&&(u=O),l<0?(l+=O,l<0&&(l=0)):l>O&&(l=O),l<u&&(l=u);let A=this.subarray(u,l);return Object.setPrototypeOf(A,o.prototype),A};function L($,u,l){if($%1!==0||$<0)throw new RangeError("offset is not uint");if($+u>l)throw new RangeError("Trying to access beyond buffer length")}o.prototype.readUintLE=o.prototype.readUIntLE=function(u,l,O){u=u>>>0,l=l>>>0,O||L(u,l,this.length);let A=this[u],N=1,U=0;for(;++U<l&&(N*=256);)A+=this[u+U]*N;return A},o.prototype.readUintBE=o.prototype.readUIntBE=function(u,l,O){u=u>>>0,l=l>>>0,O||L(u,l,this.length);let A=this[u+--l],N=1;for(;l>0&&(N*=256);)A+=this[u+--l]*N;return A},o.prototype.readUint8=o.prototype.readUInt8=function(u,l){return u=u>>>0,l||L(u,1,this.length),this[u]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(u,l){return u=u>>>0,l||L(u,2,this.length),this[u]|this[u+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(u,l){return u=u>>>0,l||L(u,2,this.length),this[u]<<8|this[u+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(u,l){return u=u>>>0,l||L(u,4,this.length),(this[u]|this[u+1]<<8|this[u+2]<<16)+this[u+3]*16777216},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(u,l){return u=u>>>0,l||L(u,4,this.length),this[u]*16777216+(this[u+1]<<16|this[u+2]<<8|this[u+3])},o.prototype.readBigUInt64LE=Ut(function(u){u=u>>>0,$e(u,"offset");let l=this[u],O=this[u+7];(l===void 0||O===void 0)&&Re(u,this.length-8);let A=l+this[++u]*2**8+this[++u]*2**16+this[++u]*2**24,N=this[++u]+this[++u]*2**8+this[++u]*2**16+O*2**24;return BigInt(A)+(BigInt(N)<<BigInt(32))}),o.prototype.readBigUInt64BE=Ut(function(u){u=u>>>0,$e(u,"offset");let l=this[u],O=this[u+7];(l===void 0||O===void 0)&&Re(u,this.length-8);let A=l*2**24+this[++u]*2**16+this[++u]*2**8+this[++u],N=this[++u]*2**24+this[++u]*2**16+this[++u]*2**8+O;return(BigInt(A)<<BigInt(32))+BigInt(N)}),o.prototype.readIntLE=function(u,l,O){u=u>>>0,l=l>>>0,O||L(u,l,this.length);let A=this[u],N=1,U=0;for(;++U<l&&(N*=256);)A+=this[u+U]*N;return N*=128,A>=N&&(A-=Math.pow(2,8*l)),A},o.prototype.readIntBE=function(u,l,O){u=u>>>0,l=l>>>0,O||L(u,l,this.length);let A=l,N=1,U=this[u+--A];for(;A>0&&(N*=256);)U+=this[u+--A]*N;return N*=128,U>=N&&(U-=Math.pow(2,8*l)),U},o.prototype.readInt8=function(u,l){return u=u>>>0,l||L(u,1,this.length),this[u]&128?(255-this[u]+1)*-1:this[u]},o.prototype.readInt16LE=function(u,l){u=u>>>0,l||L(u,2,this.length);let O=this[u]|this[u+1]<<8;return O&32768?O|4294901760:O},o.prototype.readInt16BE=function(u,l){u=u>>>0,l||L(u,2,this.length);let O=this[u+1]|this[u]<<8;return O&32768?O|4294901760:O},o.prototype.readInt32LE=function(u,l){return u=u>>>0,l||L(u,4,this.length),this[u]|this[u+1]<<8|this[u+2]<<16|this[u+3]<<24},o.prototype.readInt32BE=function(u,l){return u=u>>>0,l||L(u,4,this.length),this[u]<<24|this[u+1]<<16|this[u+2]<<8|this[u+3]},o.prototype.readBigInt64LE=Ut(function(u){u=u>>>0,$e(u,"offset");let l=this[u],O=this[u+7];(l===void 0||O===void 0)&&Re(u,this.length-8);let A=this[u+4]+this[u+5]*2**8+this[u+6]*2**16+(O<<24);return(BigInt(A)<<BigInt(32))+BigInt(l+this[++u]*2**8+this[++u]*2**16+this[++u]*2**24)}),o.prototype.readBigInt64BE=Ut(function(u){u=u>>>0,$e(u,"offset");let l=this[u],O=this[u+7];(l===void 0||O===void 0)&&Re(u,this.length-8);let A=(l<<24)+this[++u]*2**16+this[++u]*2**8+this[++u];return(BigInt(A)<<BigInt(32))+BigInt(this[++u]*2**24+this[++u]*2**16+this[++u]*2**8+O)}),o.prototype.readFloatLE=function(u,l){return u=u>>>0,l||L(u,4,this.length),e.read(this,u,!0,23,4)},o.prototype.readFloatBE=function(u,l){return u=u>>>0,l||L(u,4,this.length),e.read(this,u,!1,23,4)},o.prototype.readDoubleLE=function(u,l){return u=u>>>0,l||L(u,8,this.length),e.read(this,u,!0,52,8)},o.prototype.readDoubleBE=function(u,l){return u=u>>>0,l||L(u,8,this.length),e.read(this,u,!1,52,8)};function B($,u,l,O,A,N){if(!o.isBuffer($))throw new TypeError('"buffer" argument must be a Buffer instance');if(u>A||u<N)throw new RangeError('"value" argument is out of bounds');if(l+O>$.length)throw new RangeError("Index out of range")}o.prototype.writeUintLE=o.prototype.writeUIntLE=function(u,l,O,A){if(u=+u,l=l>>>0,O=O>>>0,!A){let he=Math.pow(2,8*O)-1;B(this,u,l,O,he,0)}let N=1,U=0;for(this[l]=u&255;++U<O&&(N*=256);)this[l+U]=u/N&255;return l+O},o.prototype.writeUintBE=o.prototype.writeUIntBE=function(u,l,O,A){if(u=+u,l=l>>>0,O=O>>>0,!A){let he=Math.pow(2,8*O)-1;B(this,u,l,O,he,0)}let N=O-1,U=1;for(this[l+N]=u&255;--N>=0&&(U*=256);)this[l+N]=u/U&255;return l+O},o.prototype.writeUint8=o.prototype.writeUInt8=function(u,l,O){return u=+u,l=l>>>0,O||B(this,u,l,1,255,0),this[l]=u&255,l+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(u,l,O){return u=+u,l=l>>>0,O||B(this,u,l,2,65535,0),this[l]=u&255,this[l+1]=u>>>8,l+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(u,l,O){return u=+u,l=l>>>0,O||B(this,u,l,2,65535,0),this[l]=u>>>8,this[l+1]=u&255,l+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(u,l,O){return u=+u,l=l>>>0,O||B(this,u,l,4,4294967295,0),this[l+3]=u>>>24,this[l+2]=u>>>16,this[l+1]=u>>>8,this[l]=u&255,l+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(u,l,O){return u=+u,l=l>>>0,O||B(this,u,l,4,4294967295,0),this[l]=u>>>24,this[l+1]=u>>>16,this[l+2]=u>>>8,this[l+3]=u&255,l+4};function F($,u,l,O,A){Ee(u,O,A,$,l,7);let N=Number(u&BigInt(4294967295));$[l++]=N,N=N>>8,$[l++]=N,N=N>>8,$[l++]=N,N=N>>8,$[l++]=N;let U=Number(u>>BigInt(32)&BigInt(4294967295));return $[l++]=U,U=U>>8,$[l++]=U,U=U>>8,$[l++]=U,U=U>>8,$[l++]=U,l}function X($,u,l,O,A){Ee(u,O,A,$,l,7);let N=Number(u&BigInt(4294967295));$[l+7]=N,N=N>>8,$[l+6]=N,N=N>>8,$[l+5]=N,N=N>>8,$[l+4]=N;let U=Number(u>>BigInt(32)&BigInt(4294967295));return $[l+3]=U,U=U>>8,$[l+2]=U,U=U>>8,$[l+1]=U,U=U>>8,$[l]=U,l+8}o.prototype.writeBigUInt64LE=Ut(function(u,l=0){return F(this,u,l,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeBigUInt64BE=Ut(function(u,l=0){return X(this,u,l,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeIntLE=function(u,l,O,A){if(u=+u,l=l>>>0,!A){let ke=Math.pow(2,8*O-1);B(this,u,l,O,ke-1,-ke)}let N=0,U=1,he=0;for(this[l]=u&255;++N<O&&(U*=256);)u<0&&he===0&&this[l+N-1]!==0&&(he=1),this[l+N]=(u/U>>0)-he&255;return l+O},o.prototype.writeIntBE=function(u,l,O,A){if(u=+u,l=l>>>0,!A){let ke=Math.pow(2,8*O-1);B(this,u,l,O,ke-1,-ke)}let N=O-1,U=1,he=0;for(this[l+N]=u&255;--N>=0&&(U*=256);)u<0&&he===0&&this[l+N+1]!==0&&(he=1),this[l+N]=(u/U>>0)-he&255;return l+O},o.prototype.writeInt8=function(u,l,O){return u=+u,l=l>>>0,O||B(this,u,l,1,127,-128),u<0&&(u=255+u+1),this[l]=u&255,l+1},o.prototype.writeInt16LE=function(u,l,O){return u=+u,l=l>>>0,O||B(this,u,l,2,32767,-32768),this[l]=u&255,this[l+1]=u>>>8,l+2},o.prototype.writeInt16BE=function(u,l,O){return u=+u,l=l>>>0,O||B(this,u,l,2,32767,-32768),this[l]=u>>>8,this[l+1]=u&255,l+2},o.prototype.writeInt32LE=function(u,l,O){return u=+u,l=l>>>0,O||B(this,u,l,4,2147483647,-2147483648),this[l]=u&255,this[l+1]=u>>>8,this[l+2]=u>>>16,this[l+3]=u>>>24,l+4},o.prototype.writeInt32BE=function(u,l,O){return u=+u,l=l>>>0,O||B(this,u,l,4,2147483647,-2147483648),u<0&&(u=4294967295+u+1),this[l]=u>>>24,this[l+1]=u>>>16,this[l+2]=u>>>8,this[l+3]=u&255,l+4},o.prototype.writeBigInt64LE=Ut(function(u,l=0){return F(this,u,l,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),o.prototype.writeBigInt64BE=Ut(function(u,l=0){return X(this,u,l,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function ie($,u,l,O,A,N){if(l+O>$.length)throw new RangeError("Index out of range");if(l<0)throw new RangeError("Index out of range")}function J($,u,l,O,A){return u=+u,l=l>>>0,A||ie($,u,l,4),e.write($,u,l,O,23,4),l+4}o.prototype.writeFloatLE=function(u,l,O){return J(this,u,l,!0,O)},o.prototype.writeFloatBE=function(u,l,O){return J(this,u,l,!1,O)};function D($,u,l,O,A){return u=+u,l=l>>>0,A||ie($,u,l,8),e.write($,u,l,O,52,8),l+8}o.prototype.writeDoubleLE=function(u,l,O){return D(this,u,l,!0,O)},o.prototype.writeDoubleBE=function(u,l,O){return D(this,u,l,!1,O)},o.prototype.copy=function(u,l,O,A){if(!o.isBuffer(u))throw new TypeError("argument should be a Buffer");if(O||(O=0),!A&&A!==0&&(A=this.length),l>=u.length&&(l=u.length),l||(l=0),A>0&&A<O&&(A=O),A===O||u.length===0||this.length===0)return 0;if(l<0)throw new RangeError("targetStart out of bounds");if(O<0||O>=this.length)throw new RangeError("Index out of range");if(A<0)throw new RangeError("sourceEnd out of bounds");A>this.length&&(A=this.length),u.length-l<A-O&&(A=u.length-l+O);let N=A-O;return this===u&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(l,O,A):Uint8Array.prototype.set.call(u,this.subarray(O,A),l),N},o.prototype.fill=function(u,l,O,A){if(typeof u=="string"){if(typeof l=="string"?(A=l,l=0,O=this.length):typeof O=="string"&&(A=O,O=this.length),A!==void 0&&typeof A!="string")throw new TypeError("encoding must be a string");if(typeof A=="string"&&!o.isEncoding(A))throw new TypeError("Unknown encoding: "+A);if(u.length===1){let U=u.charCodeAt(0);(A==="utf8"&&U<128||A==="latin1")&&(u=U)}}else typeof u=="number"?u=u&255:typeof u=="boolean"&&(u=Number(u));if(l<0||this.length<l||this.length<O)throw new RangeError("Out of range index");if(O<=l)return this;l=l>>>0,O=O===void 0?this.length:O>>>0,u||(u=0);let N;if(typeof u=="number")for(N=l;N<O;++N)this[N]=u;else{let U=o.isBuffer(u)?u:o.from(u,A),he=U.length;if(he===0)throw new TypeError('The value "'+u+'" is invalid for argument "value"');for(N=0;N<O-l;++N)this[N+l]=U[N%he]}return this};let M={};function W($,u,l){M[$]=class extends l{constructor(){super(),Object.defineProperty(this,"message",{value:u.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${$}]`,this.stack,delete this.name}get code(){return $}set code(A){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:A,writable:!0})}toString(){return`${this.name} [${$}]: ${this.message}`}}}W("ERR_BUFFER_OUT_OF_BOUNDS",function($){return $?`${$} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),W("ERR_INVALID_ARG_TYPE",function($,u){return`The "${$}" argument must be of type number. Received type ${typeof u}`},TypeError),W("ERR_OUT_OF_RANGE",function($,u,l){let O=`The value of "${$}" is out of range.`,A=l;return Number.isInteger(l)&&Math.abs(l)>2**32?A=ee(String(l)):typeof l=="bigint"&&(A=String(l),(l>BigInt(2)**BigInt(32)||l<-(BigInt(2)**BigInt(32)))&&(A=ee(A)),A+="n"),O+=` It must be ${u}. Received ${A}`,O},RangeError);function ee($){let u="",l=$.length,O=$[0]==="-"?1:0;for(;l>=O+4;l-=3)u=`_${$.slice(l-3,l)}${u}`;return`${$.slice(0,l)}${u}`}function ne($,u,l){$e(u,"offset"),($[u]===void 0||$[u+l]===void 0)&&Re(u,$.length-(l+1))}function Ee($,u,l,O,A,N){if($>l||$<u){let U=typeof u=="bigint"?"n":"",he;throw u===0||u===BigInt(0)?he=`>= 0${U} and < 2${U} ** ${(N+1)*8}${U}`:he=`>= -(2${U} ** ${(N+1)*8-1}${U}) and < 2 ** ${(N+1)*8-1}${U}`,new M.ERR_OUT_OF_RANGE("value",he,$)}ne(O,A,N)}function $e($,u){if(typeof $!="number")throw new M.ERR_INVALID_ARG_TYPE(u,"number",$)}function Re($,u,l){throw Math.floor($)!==$?($e($,l),new M.ERR_OUT_OF_RANGE("offset","an integer",$)):u<0?new M.ERR_BUFFER_OUT_OF_BOUNDS:new M.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${u}`,$)}let We=/[^+/0-9A-Za-z-_]/g;function ct($){if($=$.split("=")[0],$=$.trim().replace(We,""),$.length<2)return"";for(;$.length%4!==0;)$=$+"=";return $}function ve($,u){u=u||1/0;let l,O=$.length,A=null,N=[];for(let U=0;U<O;++U){if(l=$.charCodeAt(U),l>55295&&l<57344){if(!A){if(l>56319){(u-=3)>-1&&N.push(239,191,189);continue}else if(U+1===O){(u-=3)>-1&&N.push(239,191,189);continue}A=l;continue}if(l<56320){(u-=3)>-1&&N.push(239,191,189),A=l;continue}l=(A-55296<<10|l-56320)+65536}else A&&(u-=3)>-1&&N.push(239,191,189);if(A=null,l<128){if((u-=1)<0)break;N.push(l)}else if(l<2048){if((u-=2)<0)break;N.push(l>>6|192,l&63|128)}else if(l<65536){if((u-=3)<0)break;N.push(l>>12|224,l>>6&63|128,l&63|128)}else if(l<1114112){if((u-=4)<0)break;N.push(l>>18|240,l>>12&63|128,l>>6&63|128,l&63|128)}else throw new Error("Invalid code point")}return N}function ge($){let u=[];for(let l=0;l<$.length;++l)u.push($.charCodeAt(l)&255);return u}function Se($,u){let l,O,A,N=[];for(let U=0;U<$.length&&!((u-=2)<0);++U)l=$.charCodeAt(U),O=l>>8,A=l%256,N.push(A),N.push(O);return N}function nt($){return t.toByteArray(ct($))}function Fe($,u,l,O){let A;for(A=0;A<O&&!(A+l>=u.length||A>=$.length);++A)u[A+l]=$[A];return A}function Pe($,u){return $ instanceof u||$!=null&&$.constructor!=null&&$.constructor.name!=null&&$.constructor.name===u.name}function Xt($){return $!==$}let Zt=function(){let $="0123456789abcdef",u=new Array(256);for(let l=0;l<16;++l){let O=l*16;for(let A=0;A<16;++A)u[O+A]=$[l]+$[A]}return u}();function Ut($){return typeof BigInt>"u"?Zh:$}function Zh(){throw new Error("BigInt not supported")}return tr}var Xr,Tc,Kn,Rc,tr,qc,kc=Pr(()=>{I();R();T();Xr={},Tc=!1;Kn={},Rc=!1;tr={},qc=!1});var rr,z,sb,ob,xc=Pr(()=>{I();R();T();kc();rr=Cc();rr.Buffer;rr.SlowBuffer;rr.INSPECT_MAX_BYTES;rr.kMaxLength;z=rr.Buffer,sb=rr.INSPECT_MAX_BYTES,ob=rr.kMaxLength});var R=Pr(()=>{xc()});var rn=Y(we=>{"use strict";I();R();T();Object.defineProperty(we,"__esModule",{value:!0});we.regexpCode=we.getEsmExportName=we.getProperty=we.safeStringify=we.stringify=we.strConcat=we.addCodeArg=we.str=we._=we.nil=we._Code=we.Name=we.IDENTIFIER=we._CodeOrName=void 0;var en=class{};we._CodeOrName=en;we.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var nr=class extends en{constructor(e){if(super(),!we.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};we.Name=nr;var ft=class extends en{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,n)=>(n instanceof nr&&(r[n.str]=(r[n.str]||0)+1),r),{})}};we._Code=ft;we.nil=new ft("");function Jc(t,...e){let r=[t[0]],n=0;for(;n<e.length;)hs(r,e[n]),r.push(t[++n]);return new ft(r)}we._=Jc;var ds=new ft("+");function Hc(t,...e){let r=[tn(t[0])],n=0;for(;n<e.length;)r.push(ds),hs(r,e[n]),r.push(ds,tn(t[++n]));return cp(r),new ft(r)}we.str=Hc;function hs(t,e){e instanceof ft?t.push(...e._items):e instanceof nr?t.push(e):t.push(dp(e))}we.addCodeArg=hs;function cp(t){let e=1;for(;e<t.length-1;){if(t[e]===ds){let r=fp(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function fp(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof nr||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof nr))return`"${t}${e.slice(1)}`}function lp(t,e){return e.emptyStr()?t:t.emptyStr()?e:Hc`${t}${e}`}we.strConcat=lp;function dp(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:tn(Array.isArray(t)?t.join(","):t)}function hp(t){return new ft(tn(t))}we.stringify=hp;function tn(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}we.safeStringify=tn;function pp(t){return typeof t=="string"&&we.IDENTIFIER.test(t)?new ft(`.${t}`):Jc`[${t}]`}we.getProperty=pp;function mp(t){if(typeof t=="string"&&we.IDENTIFIER.test(t))return new ft(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}we.getEsmExportName=mp;function vp(t){return new ft(t.toString())}we.regexpCode=vp});var vs=Y(st=>{"use strict";I();R();T();Object.defineProperty(st,"__esModule",{value:!0});st.ValueScope=st.ValueScopeName=st.Scope=st.varKinds=st.UsedValueState=void 0;var it=rn(),ps=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},Vn;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(Vn||(st.UsedValueState=Vn={}));st.varKinds={const:new it.Name("const"),let:new it.Name("let"),var:new it.Name("var")};var Jn=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof it.Name?e:this.name(e)}name(e){return new it.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};st.Scope=Jn;var Hn=class extends it.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=(0,it._)`.${new it.Name(r)}[${n}]`}};st.ValueScopeName=Hn;var yp=(0,it._)`\n`,ms=class extends Jn{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?yp:it.nil}}get(){return this._scope}name(e){return new Hn(e,this._newName(e))}value(e,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let i=this.toName(e),{prefix:s}=i,o=(n=r.key)!==null&&n!==void 0?n:r.ref,a=this._values[s];if(a){let m=a.get(o);if(m)return m}else a=this._values[s]=new Map;a.set(o,i);let c=this._scope[s]||(this._scope[s]=[]),d=c.length;return c[d]=r.ref,i.setValue(r,{property:s,itemIndex:d}),i}getValue(e,r){let n=this._values[e];if(n)return n.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,it._)`${e}${n.scopePath}`})}scopeCode(e=this._values,r,n){return this._reduceValues(e,i=>{if(i.value===void 0)throw new Error(`CodeGen: name "${i}" has no value`);return i.value.code},r,n)}_reduceValues(e,r,n={},i){let s=it.nil;for(let o in e){let a=e[o];if(!a)continue;let c=n[o]=n[o]||new Map;a.forEach(d=>{if(c.has(d))return;c.set(d,Vn.Started);let m=r(d);if(m){let f=this.opts.es5?st.varKinds.var:st.varKinds.const;s=(0,it._)`${s}${f} ${d} = ${m};${this.opts._n}`}else if(m=i?.(d))s=(0,it._)`${s}${m}${this.opts._n}`;else throw new ps(d);c.set(d,Vn.Completed)})}return s}};st.ValueScope=ms});var pe=Y(le=>{"use strict";I();R();T();Object.defineProperty(le,"__esModule",{value:!0});le.or=le.and=le.not=le.CodeGen=le.operators=le.varKinds=le.ValueScopeName=le.ValueScope=le.Scope=le.Name=le.regexpCode=le.stringify=le.getProperty=le.nil=le.strConcat=le.str=le._=void 0;var ye=rn(),yt=vs(),Ft=rn();Object.defineProperty(le,"_",{enumerable:!0,get:function(){return Ft._}});Object.defineProperty(le,"str",{enumerable:!0,get:function(){return Ft.str}});Object.defineProperty(le,"strConcat",{enumerable:!0,get:function(){return Ft.strConcat}});Object.defineProperty(le,"nil",{enumerable:!0,get:function(){return Ft.nil}});Object.defineProperty(le,"getProperty",{enumerable:!0,get:function(){return Ft.getProperty}});Object.defineProperty(le,"stringify",{enumerable:!0,get:function(){return Ft.stringify}});Object.defineProperty(le,"regexpCode",{enumerable:!0,get:function(){return Ft.regexpCode}});Object.defineProperty(le,"Name",{enumerable:!0,get:function(){return Ft.Name}});var Xn=vs();Object.defineProperty(le,"Scope",{enumerable:!0,get:function(){return Xn.Scope}});Object.defineProperty(le,"ValueScope",{enumerable:!0,get:function(){return Xn.ValueScope}});Object.defineProperty(le,"ValueScopeName",{enumerable:!0,get:function(){return Xn.ValueScopeName}});Object.defineProperty(le,"varKinds",{enumerable:!0,get:function(){return Xn.varKinds}});le.operators={GT:new ye._Code(">"),GTE:new ye._Code(">="),LT:new ye._Code("<"),LTE:new ye._Code("<="),EQ:new ye._Code("==="),NEQ:new ye._Code("!=="),NOT:new ye._Code("!"),OR:new ye._Code("||"),AND:new ye._Code("&&"),ADD:new ye._Code("+")};var Nt=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},ys=class extends Nt{constructor(e,r,n){super(),this.varKind=e,this.name=r,this.rhs=n}render({es5:e,_n:r}){let n=e?yt.varKinds.var:this.varKind,i=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${i};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=Tr(this.rhs,e,r)),this}get names(){return this.rhs instanceof ye._CodeOrName?this.rhs.names:{}}},Wn=class extends Nt{constructor(e,r,n){super(),this.lhs=e,this.rhs=r,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof ye.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=Tr(this.rhs,e,r),this}get names(){let e=this.lhs instanceof ye.Name?{}:{...this.lhs.names};return Yn(e,this.rhs)}},gs=class extends Wn{constructor(e,r,n,i){super(e,n,i),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},_s=class extends Nt{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},ws=class extends Nt{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},bs=class extends Nt{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},Es=class extends Nt{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=Tr(this.code,e,r),this}get names(){return this.code instanceof ye._CodeOrName?this.code.names:{}}},nn=class extends Nt{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,n)=>r+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let n=e[r].optimizeNodes();Array.isArray(n)?e.splice(r,1,...n):n?e[r]=n:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:n}=this,i=n.length;for(;i--;){let s=n[i];s.optimizeNames(e,r)||(gp(e,s.names),n.splice(i,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>or(e,r.names),{})}},jt=class extends nn{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},$s=class extends nn{},Ir=class extends jt{};Ir.kind="else";var ir=class t extends jt{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new Ir(n):n}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(Wc(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=Tr(this.condition,e,r),this}get names(){let e=super.names;return Yn(e,this.condition),this.else&&or(e,this.else.names),e}};ir.kind="if";var sr=class extends jt{};sr.kind="for";var Ss=class extends sr{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=Tr(this.iteration,e,r),this}get names(){return or(super.names,this.iteration.names)}},Ps=class extends sr{constructor(e,r,n,i){super(),this.varKind=e,this.name=r,this.from=n,this.to=i}render(e){let r=e.es5?yt.varKinds.var:this.varKind,{name:n,from:i,to:s}=this;return`for(${r} ${n}=${i}; ${n}<${s}; ${n}++)`+super.render(e)}get names(){let e=Yn(super.names,this.from);return Yn(e,this.to)}},Qn=class extends sr{constructor(e,r,n,i){super(),this.loop=e,this.varKind=r,this.name=n,this.iterable=i}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=Tr(this.iterable,e,r),this}get names(){return or(super.names,this.iterable.names)}},sn=class extends jt{constructor(e,r,n){super(),this.name=e,this.args=r,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};sn.kind="func";var on=class extends nn{render(e){return"return "+super.render(e)}};on.kind="return";var Os=class extends jt{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var n,i;return super.optimizeNames(e,r),(n=this.catch)===null||n===void 0||n.optimizeNames(e,r),(i=this.finally)===null||i===void 0||i.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&or(e,this.catch.names),this.finally&&or(e,this.finally.names),e}},an=class extends jt{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};an.kind="catch";var un=class extends jt{render(e){return"finally"+super.render(e)}};un.kind="finally";var As=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
2
|
-
`:""},this._extScope=e,this._scope=new yt.Scope({parent:e}),this._nodes=[new $s]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,r){let n=this._extScope.value(e,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,r){return this._extScope.getValue(e,r)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,r,n,i){let s=this._scope.toName(r);return n!==void 0&&i&&(this._constants[s.str]=n),this._leafNode(new ys(e,s,n)),s}const(e,r,n){return this._def(yt.varKinds.const,e,r,n)}let(e,r,n){return this._def(yt.varKinds.let,e,r,n)}var(e,r,n){return this._def(yt.varKinds.var,e,r,n)}assign(e,r,n){return this._leafNode(new Wn(e,r,n))}add(e,r){return this._leafNode(new gs(e,le.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==ye.nil&&this._leafNode(new Es(e)),this}object(...e){let r=["{"];for(let[n,i]of e)r.length>1&&r.push(","),r.push(n),(n!==i||this.opts.es5)&&(r.push(":"),(0,ye.addCodeArg)(r,i));return r.push("}"),new ye._Code(r)}if(e,r,n){if(this._blockNode(new ir(e)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new ir(e))}else(){return this._elseNode(new Ir)}endIf(){return this._endBlockNode(ir,Ir)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new Ss(e),r)}forRange(e,r,n,i,s=this.opts.es5?yt.varKinds.var:yt.varKinds.let){let o=this._scope.toName(e);return this._for(new Ps(s,o,r,n),()=>i(o))}forOf(e,r,n,i=yt.varKinds.const){let s=this._scope.toName(e);if(this.opts.es5){let o=r instanceof ye.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,ye._)`${o}.length`,a=>{this.var(s,(0,ye._)`${o}[${a}]`),n(s)})}return this._for(new Qn("of",i,s,r),()=>n(s))}forIn(e,r,n,i=this.opts.es5?yt.varKinds.var:yt.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,ye._)`Object.keys(${r})`,n);let s=this._scope.toName(e);return this._for(new Qn("in",i,s,r),()=>n(s))}endFor(){return this._endBlockNode(sr)}label(e){return this._leafNode(new _s(e))}break(e){return this._leafNode(new ws(e))}return(e){let r=new on;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(on)}try(e,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let i=new Os;if(this._blockNode(i),this.code(e),r){let s=this.name("e");this._currNode=i.catch=new an(s),r(s)}return n&&(this._currNode=i.finally=new un,this.code(n)),this._endBlockNode(an,un)}throw(e){return this._leafNode(new bs(e))}block(e,r){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(r),this}endBlock(e){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let n=this._nodes.length-r;if(n<0||e!==void 0&&n!==e)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=ye.nil,n,i){return this._blockNode(new sn(e,r,n)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode(sn)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,r){let n=this._currNode;if(n instanceof e||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${e.kind}/${r.kind}`:e.kind}"`)}_elseNode(e){let r=this._currNode;if(!(r instanceof ir))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let r=this._nodes;r[r.length-1]=e}};le.CodeGen=As;function or(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function Yn(t,e){return e instanceof ye._CodeOrName?or(t,e.names):t}function Tr(t,e,r){if(t instanceof ye.Name)return n(t);if(!i(t))return t;return new ye._Code(t._items.reduce((s,o)=>(o instanceof ye.Name&&(o=n(o)),o instanceof ye._Code?s.push(...o._items):s.push(o),s),[]));function n(s){let o=r[s.str];return o===void 0||e[s.str]!==1?s:(delete e[s.str],o)}function i(s){return s instanceof ye._Code&&s._items.some(o=>o instanceof ye.Name&&e[o.str]===1&&r[o.str]!==void 0)}}function gp(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function Wc(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,ye._)`!${Is(t)}`}le.not=Wc;var _p=Qc(le.operators.AND);function wp(...t){return t.reduce(_p)}le.and=wp;var bp=Qc(le.operators.OR);function Ep(...t){return t.reduce(bp)}le.or=Ep;function Qc(t){return(e,r)=>e===ye.nil?r:r===ye.nil?e:(0,ye._)`${Is(e)} ${t} ${Is(r)}`}function Is(t){return t instanceof ye.Name?t:(0,ye._)`(${t})`}});var be=Y(de=>{"use strict";I();R();T();Object.defineProperty(de,"__esModule",{value:!0});de.checkStrictMode=de.getErrorPath=de.Type=de.useFunc=de.setEvaluated=de.evaluatedPropsToName=de.mergeEvaluated=de.eachItem=de.unescapeJsonPointer=de.escapeJsonPointer=de.escapeFragment=de.unescapeFragment=de.schemaRefOrVal=de.schemaHasRulesButRef=de.schemaHasRules=de.checkUnknownRules=de.alwaysValidSchema=de.toHash=void 0;var Ie=pe(),$p=rn();function Sp(t){let e={};for(let r of t)e[r]=!0;return e}de.toHash=Sp;function Pp(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(Zc(t,e),!ef(e,t.self.RULES.all))}de.alwaysValidSchema=Pp;function Zc(t,e=t.schema){let{opts:r,self:n}=t;if(!r.strictSchema||typeof e=="boolean")return;let i=n.RULES.keywords;for(let s in e)i[s]||nf(t,`unknown keyword: "${s}"`)}de.checkUnknownRules=Zc;function ef(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}de.schemaHasRules=ef;function Op(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}de.schemaHasRulesButRef=Op;function Ap({topSchemaRef:t,schemaPath:e},r,n,i){if(!i){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,Ie._)`${r}`}return(0,Ie._)`${t}${e}${(0,Ie.getProperty)(n)}`}de.schemaRefOrVal=Ap;function Ip(t){return tf(decodeURIComponent(t))}de.unescapeFragment=Ip;function Tp(t){return encodeURIComponent(Rs(t))}de.escapeFragment=Tp;function Rs(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}de.escapeJsonPointer=Rs;function tf(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}de.unescapeJsonPointer=tf;function Rp(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}de.eachItem=Rp;function Yc({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:n}){return(i,s,o,a)=>{let c=o===void 0?s:o instanceof Ie.Name?(s instanceof Ie.Name?t(i,s,o):e(i,s,o),o):s instanceof Ie.Name?(e(i,o,s),s):r(s,o);return a===Ie.Name&&!(c instanceof Ie.Name)?n(i,c):c}}de.mergeEvaluated={props:Yc({mergeNames:(t,e,r)=>t.if((0,Ie._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,Ie._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,Ie._)`${r} || {}`).code((0,Ie._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,Ie._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,Ie._)`${r} || {}`),qs(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:rf}),items:Yc({mergeNames:(t,e,r)=>t.if((0,Ie._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,Ie._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,Ie._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,Ie._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function rf(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,Ie._)`{}`);return e!==void 0&&qs(t,r,e),r}de.evaluatedPropsToName=rf;function qs(t,e,r){Object.keys(r).forEach(n=>t.assign((0,Ie._)`${e}${(0,Ie.getProperty)(n)}`,!0))}de.setEvaluated=qs;var Xc={};function qp(t,e){return t.scopeValue("func",{ref:e,code:Xc[e.code]||(Xc[e.code]=new $p._Code(e.code))})}de.useFunc=qp;var Ts;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(Ts||(de.Type=Ts={}));function Cp(t,e,r){if(t instanceof Ie.Name){let n=e===Ts.Num;return r?n?(0,Ie._)`"[" + ${t} + "]"`:(0,Ie._)`"['" + ${t} + "']"`:n?(0,Ie._)`"/" + ${t}`:(0,Ie._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,Ie.getProperty)(t).toString():"/"+Rs(t)}de.getErrorPath=Cp;function nf(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}de.checkStrictMode=nf});var Dt=Y(Cs=>{"use strict";I();R();T();Object.defineProperty(Cs,"__esModule",{value:!0});var Ye=pe(),kp={data:new Ye.Name("data"),valCxt:new Ye.Name("valCxt"),instancePath:new Ye.Name("instancePath"),parentData:new Ye.Name("parentData"),parentDataProperty:new Ye.Name("parentDataProperty"),rootData:new Ye.Name("rootData"),dynamicAnchors:new Ye.Name("dynamicAnchors"),vErrors:new Ye.Name("vErrors"),errors:new Ye.Name("errors"),this:new Ye.Name("this"),self:new Ye.Name("self"),scope:new Ye.Name("scope"),json:new Ye.Name("json"),jsonPos:new Ye.Name("jsonPos"),jsonLen:new Ye.Name("jsonLen"),jsonPart:new Ye.Name("jsonPart")};Cs.default=kp});var cn=Y(Xe=>{"use strict";I();R();T();Object.defineProperty(Xe,"__esModule",{value:!0});Xe.extendErrors=Xe.resetErrorsCount=Xe.reportExtraError=Xe.reportError=Xe.keyword$DataError=Xe.keywordError=void 0;var _e=pe(),Zn=be(),et=Dt();Xe.keywordError={message:({keyword:t})=>(0,_e.str)`must pass "${t}" keyword validation`};Xe.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,_e.str)`"${t}" keyword must be ${e} ($data)`:(0,_e.str)`"${t}" keyword is invalid ($data)`};function xp(t,e=Xe.keywordError,r,n){let{it:i}=t,{gen:s,compositeRule:o,allErrors:a}=i,c=af(t,e,r);n??(o||a)?sf(s,c):of(i,(0,_e._)`[${c}]`)}Xe.reportError=xp;function Np(t,e=Xe.keywordError,r){let{it:n}=t,{gen:i,compositeRule:s,allErrors:o}=n,a=af(t,e,r);sf(i,a),s||o||of(n,et.default.vErrors)}Xe.reportExtraError=Np;function jp(t,e){t.assign(et.default.errors,e),t.if((0,_e._)`${et.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,_e._)`${et.default.vErrors}.length`,e),()=>t.assign(et.default.vErrors,null)))}Xe.resetErrorsCount=jp;function Dp({gen:t,keyword:e,schemaValue:r,data:n,errsCount:i,it:s}){if(i===void 0)throw new Error("ajv implementation error");let o=t.name("err");t.forRange("i",i,et.default.errors,a=>{t.const(o,(0,_e._)`${et.default.vErrors}[${a}]`),t.if((0,_e._)`${o}.instancePath === undefined`,()=>t.assign((0,_e._)`${o}.instancePath`,(0,_e.strConcat)(et.default.instancePath,s.errorPath))),t.assign((0,_e._)`${o}.schemaPath`,(0,_e.str)`${s.errSchemaPath}/${e}`),s.opts.verbose&&(t.assign((0,_e._)`${o}.schema`,r),t.assign((0,_e._)`${o}.data`,n))})}Xe.extendErrors=Dp;function sf(t,e){let r=t.const("err",e);t.if((0,_e._)`${et.default.vErrors} === null`,()=>t.assign(et.default.vErrors,(0,_e._)`[${r}]`),(0,_e._)`${et.default.vErrors}.push(${r})`),t.code((0,_e._)`${et.default.errors}++`)}function of(t,e){let{gen:r,validateName:n,schemaEnv:i}=t;i.$async?r.throw((0,_e._)`new ${t.ValidationError}(${e})`):(r.assign((0,_e._)`${n}.errors`,e),r.return(!1))}var ar={keyword:new _e.Name("keyword"),schemaPath:new _e.Name("schemaPath"),params:new _e.Name("params"),propertyName:new _e.Name("propertyName"),message:new _e.Name("message"),schema:new _e.Name("schema"),parentSchema:new _e.Name("parentSchema")};function af(t,e,r){let{createErrors:n}=t.it;return n===!1?(0,_e._)`{}`:Bp(t,e,r)}function Bp(t,e,r={}){let{gen:n,it:i}=t,s=[Lp(i,r),Mp(t,r)];return Up(t,e,s),n.object(...s)}function Lp({errorPath:t},{instancePath:e}){let r=e?(0,_e.str)`${t}${(0,Zn.getErrorPath)(e,Zn.Type.Str)}`:t;return[et.default.instancePath,(0,_e.strConcat)(et.default.instancePath,r)]}function Mp({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:n}){let i=n?e:(0,_e.str)`${e}/${t}`;return r&&(i=(0,_e.str)`${i}${(0,Zn.getErrorPath)(r,Zn.Type.Str)}`),[ar.schemaPath,i]}function Up(t,{params:e,message:r},n){let{keyword:i,data:s,schemaValue:o,it:a}=t,{opts:c,propertyName:d,topSchemaRef:m,schemaPath:f}=a;n.push([ar.keyword,i],[ar.params,typeof e=="function"?e(t):e||(0,_e._)`{}`]),c.messages&&n.push([ar.message,typeof r=="function"?r(t):r]),c.verbose&&n.push([ar.schema,o],[ar.parentSchema,(0,_e._)`${m}${f}`],[et.default.data,s]),d&&n.push([ar.propertyName,d])}});var cf=Y(Rr=>{"use strict";I();R();T();Object.defineProperty(Rr,"__esModule",{value:!0});Rr.boolOrEmptySchema=Rr.topBoolOrEmptySchema=void 0;var Gp=cn(),Fp=pe(),Kp=Dt(),zp={message:"boolean schema is false"};function Vp(t){let{gen:e,schema:r,validateName:n}=t;r===!1?uf(t,!1):typeof r=="object"&&r.$async===!0?e.return(Kp.default.data):(e.assign((0,Fp._)`${n}.errors`,null),e.return(!0))}Rr.topBoolOrEmptySchema=Vp;function Jp(t,e){let{gen:r,schema:n}=t;n===!1?(r.var(e,!1),uf(t)):r.var(e,!0)}Rr.boolOrEmptySchema=Jp;function uf(t,e){let{gen:r,data:n}=t,i={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,Gp.reportError)(i,zp,void 0,e)}});var ks=Y(qr=>{"use strict";I();R();T();Object.defineProperty(qr,"__esModule",{value:!0});qr.getRules=qr.isJSONType=void 0;var Hp=["string","number","integer","boolean","null","object","array"],Wp=new Set(Hp);function Qp(t){return typeof t=="string"&&Wp.has(t)}qr.isJSONType=Qp;function Yp(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}qr.getRules=Yp});var xs=Y(Kt=>{"use strict";I();R();T();Object.defineProperty(Kt,"__esModule",{value:!0});Kt.shouldUseRule=Kt.shouldUseGroup=Kt.schemaHasRulesForType=void 0;function Xp({schema:t,self:e},r){let n=e.RULES.types[r];return n&&n!==!0&&ff(t,n)}Kt.schemaHasRulesForType=Xp;function ff(t,e){return e.rules.some(r=>lf(t,r))}Kt.shouldUseGroup=ff;function lf(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(n=>t[n]!==void 0))}Kt.shouldUseRule=lf});var fn=Y(Ze=>{"use strict";I();R();T();Object.defineProperty(Ze,"__esModule",{value:!0});Ze.reportTypeError=Ze.checkDataTypes=Ze.checkDataType=Ze.coerceAndCheckDataType=Ze.getJSONTypes=Ze.getSchemaTypes=Ze.DataType=void 0;var Zp=ks(),em=xs(),tm=cn(),ue=pe(),df=be(),Cr;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(Cr||(Ze.DataType=Cr={}));function rm(t){let e=hf(t.type);if(e.includes("null")){if(t.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===!0&&e.push("null")}return e}Ze.getSchemaTypes=rm;function hf(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(Zp.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}Ze.getJSONTypes=hf;function nm(t,e){let{gen:r,data:n,opts:i}=t,s=im(e,i.coerceTypes),o=e.length>0&&!(s.length===0&&e.length===1&&(0,em.schemaHasRulesForType)(t,e[0]));if(o){let a=js(e,n,i.strictNumbers,Cr.Wrong);r.if(a,()=>{s.length?sm(t,e,s):Ds(t)})}return o}Ze.coerceAndCheckDataType=nm;var pf=new Set(["string","number","integer","boolean","null"]);function im(t,e){return e?t.filter(r=>pf.has(r)||e==="array"&&r==="array"):[]}function sm(t,e,r){let{gen:n,data:i,opts:s}=t,o=n.let("dataType",(0,ue._)`typeof ${i}`),a=n.let("coerced",(0,ue._)`undefined`);s.coerceTypes==="array"&&n.if((0,ue._)`${o} == 'object' && Array.isArray(${i}) && ${i}.length == 1`,()=>n.assign(i,(0,ue._)`${i}[0]`).assign(o,(0,ue._)`typeof ${i}`).if(js(e,i,s.strictNumbers),()=>n.assign(a,i))),n.if((0,ue._)`${a} !== undefined`);for(let d of r)(pf.has(d)||d==="array"&&s.coerceTypes==="array")&&c(d);n.else(),Ds(t),n.endIf(),n.if((0,ue._)`${a} !== undefined`,()=>{n.assign(i,a),om(t,a)});function c(d){switch(d){case"string":n.elseIf((0,ue._)`${o} == "number" || ${o} == "boolean"`).assign(a,(0,ue._)`"" + ${i}`).elseIf((0,ue._)`${i} === null`).assign(a,(0,ue._)`""`);return;case"number":n.elseIf((0,ue._)`${o} == "boolean" || ${i} === null
|
|
1
|
+
var ep=Object.create;var cs=Object.defineProperty;var tp=Object.getOwnPropertyDescriptor;var rp=Object.getOwnPropertyNames;var np=Object.getPrototypeOf,ip=Object.prototype.hasOwnProperty;var Pr=(t,e)=>()=>(t&&(e=t(t=0)),e);var Q=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),fs=(t,e)=>{for(var r in e)cs(t,r,{get:e[r],enumerable:!0})},sp=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of rp(e))!ip.call(t,i)&&i!==r&&cs(t,i,{get:()=>e[i],enumerable:!(n=tp(e,i))||n.enumerable});return t};var ls=(t,e,r)=>(r=t!=null?ep(np(t)):{},sp(e||!t||!t.__esModule?cs(r,"default",{value:t,enumerable:!0}):r,t));var I=Pr(()=>{});var K={};fs(K,{_debugEnd:()=>Zu,_debugProcess:()=>Xu,_events:()=>mc,_eventsCount:()=>vc,_exiting:()=>ku,_fatalExceptions:()=>Hu,_getActiveHandles:()=>Du,_getActiveRequests:()=>ju,_kill:()=>Lu,_linkedBinding:()=>qu,_maxListeners:()=>pc,_preload_modules:()=>lc,_rawDebug:()=>Tu,_startProfilerIdleNotifier:()=>ec,_stopProfilerIdleNotifier:()=>tc,_tickCallback:()=>Yu,abort:()=>sc,addListener:()=>yc,allowedNodeEnvironmentFlags:()=>zu,arch:()=>mu,argv:()=>gu,argv0:()=>fc,assert:()=>Vu,binding:()=>$u,browser:()=>Iu,chdir:()=>Ou,config:()=>Cu,cpuUsage:()=>zn,cwd:()=>Pu,debugPort:()=>cc,default:()=>Oc,dlopen:()=>xu,domain:()=>Nu,emit:()=>Ec,emitWarning:()=>Eu,env:()=>yu,execArgv:()=>_u,execPath:()=>uc,exit:()=>Fu,features:()=>Ju,hasUncaughtExceptionCaptureCallback:()=>Qu,hrtime:()=>Kn,kill:()=>Gu,listeners:()=>Pc,memoryUsage:()=>Uu,moduleLoadList:()=>Ru,nextTick:()=>du,off:()=>_c,on:()=>Ct,once:()=>gc,openStdin:()=>Ku,pid:()=>oc,platform:()=>vu,ppid:()=>ac,prependListener:()=>$c,prependOnceListener:()=>Sc,reallyExit:()=>Bu,release:()=>Au,removeAllListeners:()=>bc,removeListener:()=>wc,resourceUsage:()=>Mu,setSourceMapsEnabled:()=>dc,setUncaughtExceptionCaptureCallback:()=>Wu,stderr:()=>nc,stdin:()=>ic,stdout:()=>rc,title:()=>pu,umask:()=>Su,uptime:()=>hc,version:()=>wu,versions:()=>bu});function ps(t){throw new Error("Node.js process "+t+" is not supported by JSPM core outside of Node.js")}function op(){!Or||!er||(Or=!1,er.length?kt=er.concat(kt):Fn=-1,kt.length&&lu())}function lu(){if(!Or){var t=setTimeout(op,0);Or=!0;for(var e=kt.length;e;){for(er=kt,kt=[];++Fn<e;)er&&er[Fn].run();Fn=-1,e=kt.length}er=null,Or=!1,clearTimeout(t)}}function du(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];kt.push(new hu(t,e)),kt.length===1&&!Or&&setTimeout(lu,0)}function hu(t,e){this.fun=t,this.array=e}function Qe(){}function qu(t){ps("_linkedBinding")}function xu(t){ps("dlopen")}function ju(){return[]}function Du(){return[]}function Vu(t,e){if(!t)throw new Error(e||"assertion error")}function Qu(){return!1}function hc(){return Gt.now()/1e3}function Kn(t){var e=Math.floor((Date.now()-Gt.now())*.001),r=Gt.now()*.001,n=Math.floor(r)+e,i=Math.floor(r%1*1e9);return t&&(n=n-t[0],i=i-t[1],i<0&&(n--,i+=hs)),[n,i]}function Ct(){return Oc}function Pc(t){return[]}var kt,Or,er,Fn,pu,mu,vu,yu,gu,_u,wu,bu,Eu,$u,Su,Pu,Ou,Au,Iu,Tu,Ru,Nu,ku,Cu,Bu,Lu,zn,Mu,Uu,Gu,Fu,Ku,zu,Ju,Hu,Wu,Yu,Xu,Zu,ec,tc,rc,nc,ic,sc,oc,ac,uc,cc,fc,lc,dc,Gt,ds,hs,pc,mc,vc,yc,gc,_c,wc,bc,Ec,$c,Sc,Oc,Ac=Pr(()=>{I();R();T();kt=[],Or=!1,Fn=-1;hu.prototype.run=function(){this.fun.apply(null,this.array)};pu="browser",mu="x64",vu="browser",yu={PATH:"/usr/bin",LANG:typeof navigator<"u"?navigator.language+".UTF-8":void 0,PWD:"/",HOME:"/home",TMP:"/tmp"},gu=["/usr/bin/node"],_u=[],wu="v16.8.0",bu={},Eu=function(t,e){console.warn((e?e+": ":"")+t)},$u=function(t){ps("binding")},Su=function(t){return 0},Pu=function(){return"/"},Ou=function(t){},Au={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};Iu=!0,Tu=Qe,Ru=[];Nu={},ku=!1,Cu={};Bu=Qe,Lu=Qe,zn=function(){return{}},Mu=zn,Uu=zn,Gu=Qe,Fu=Qe,Ku=Qe,zu={};Ju={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},Hu=Qe,Wu=Qe;Yu=Qe,Xu=Qe,Zu=Qe,ec=Qe,tc=Qe,rc=void 0,nc=void 0,ic=void 0,sc=Qe,oc=2,ac=1,uc="/bin/usr/node",cc=9229,fc="node",lc=[],dc=Qe,Gt={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0};Gt.now===void 0&&(ds=Date.now(),Gt.timing&&Gt.timing.navigationStart&&(ds=Gt.timing.navigationStart),Gt.now=()=>Date.now()-ds);hs=1e9;Kn.bigint=function(t){var e=Kn(t);return typeof BigInt>"u"?e[0]*hs+e[1]:BigInt(e[0]*hs)+BigInt(e[1])};pc=10,mc={},vc=0;yc=Ct,gc=Ct,_c=Ct,wc=Ct,bc=Ct,Ec=Qe,$c=Ct,Sc=Ct;Oc={version:wu,versions:bu,arch:mu,platform:vu,browser:Iu,release:Au,_rawDebug:Tu,moduleLoadList:Ru,binding:$u,_linkedBinding:qu,_events:mc,_eventsCount:vc,_maxListeners:pc,on:Ct,addListener:yc,once:gc,off:_c,removeListener:wc,removeAllListeners:bc,emit:Ec,prependListener:$c,prependOnceListener:Sc,listeners:Pc,domain:Nu,_exiting:ku,config:Cu,dlopen:xu,uptime:hc,_getActiveRequests:ju,_getActiveHandles:Du,reallyExit:Bu,_kill:Lu,cpuUsage:zn,resourceUsage:Mu,memoryUsage:Uu,kill:Gu,exit:Fu,openStdin:Ku,allowedNodeEnvironmentFlags:zu,assert:Vu,features:Ju,_fatalExceptions:Hu,setUncaughtExceptionCaptureCallback:Wu,hasUncaughtExceptionCaptureCallback:Qu,emitWarning:Eu,nextTick:du,_tickCallback:Yu,_debugProcess:Xu,_debugEnd:Zu,_startProfilerIdleNotifier:ec,_stopProfilerIdleNotifier:tc,stdout:rc,stdin:ic,stderr:nc,abort:sc,umask:Su,chdir:Ou,cwd:Pu,env:yu,title:pu,argv:gu,execArgv:_u,pid:oc,ppid:ac,execPath:uc,debugPort:cc,hrtime:Kn,argv0:fc,_preload_modules:lc,setSourceMapsEnabled:dc}});var T=Pr(()=>{Ac()});function ap(){if(Ic)return en;Ic=!0,en.byteLength=a,en.toByteArray=d,en.fromByteArray=g;for(var t=[],e=[],r=typeof Uint8Array<"u"?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0,s=n.length;i<s;++i)t[i]=n[i],e[n.charCodeAt(i)]=i;e[45]=62,e[95]=63;function o(_){var E=_.length;if(E%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var P=_.indexOf("=");P===-1&&(P=E);var S=P===E?0:4-P%4;return[P,S]}function a(_){var E=o(_),P=E[0],S=E[1];return(P+S)*3/4-S}function c(_,E,P){return(E+P)*3/4-P}function d(_){var E,P=o(_),S=P[0],y=P[1],w=new r(c(_,S,y)),p=0,h=y>0?S-4:S,v;for(v=0;v<h;v+=4)E=e[_.charCodeAt(v)]<<18|e[_.charCodeAt(v+1)]<<12|e[_.charCodeAt(v+2)]<<6|e[_.charCodeAt(v+3)],w[p++]=E>>16&255,w[p++]=E>>8&255,w[p++]=E&255;return y===2&&(E=e[_.charCodeAt(v)]<<2|e[_.charCodeAt(v+1)]>>4,w[p++]=E&255),y===1&&(E=e[_.charCodeAt(v)]<<10|e[_.charCodeAt(v+1)]<<4|e[_.charCodeAt(v+2)]>>2,w[p++]=E>>8&255,w[p++]=E&255),w}function m(_){return t[_>>18&63]+t[_>>12&63]+t[_>>6&63]+t[_&63]}function f(_,E,P){for(var S,y=[],w=E;w<P;w+=3)S=(_[w]<<16&16711680)+(_[w+1]<<8&65280)+(_[w+2]&255),y.push(m(S));return y.join("")}function g(_){for(var E,P=_.length,S=P%3,y=[],w=16383,p=0,h=P-S;p<h;p+=w)y.push(f(_,p,p+w>h?h:p+w));return S===1?(E=_[P-1],y.push(t[E>>2]+t[E<<4&63]+"==")):S===2&&(E=(_[P-2]<<8)+_[P-1],y.push(t[E>>10]+t[E>>4&63]+t[E<<2&63]+"=")),y.join("")}return en}function up(){if(Tc)return Vn;Tc=!0;return Vn.read=function(t,e,r,n,i){var s,o,a=i*8-n-1,c=(1<<a)-1,d=c>>1,m=-7,f=r?i-1:0,g=r?-1:1,_=t[e+f];for(f+=g,s=_&(1<<-m)-1,_>>=-m,m+=a;m>0;s=s*256+t[e+f],f+=g,m-=8);for(o=s&(1<<-m)-1,s>>=-m,m+=n;m>0;o=o*256+t[e+f],f+=g,m-=8);if(s===0)s=1-d;else{if(s===c)return o?NaN:(_?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-d}return(_?-1:1)*o*Math.pow(2,s-n)},Vn.write=function(t,e,r,n,i,s){var o,a,c,d=s*8-i-1,m=(1<<d)-1,f=m>>1,g=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,_=n?0:s-1,E=n?1:-1,P=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=m):(o=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-o))<1&&(o--,c*=2),o+f>=1?e+=g/c:e+=g*Math.pow(2,1-f),e*c>=2&&(o++,c/=2),o+f>=m?(a=0,o=m):o+f>=1?(a=(e*c-1)*Math.pow(2,i),o=o+f):(a=e*Math.pow(2,f-1)*Math.pow(2,i),o=0));i>=8;t[r+_]=a&255,_+=E,a/=256,i-=8);for(o=o<<i|a,d+=i;d>0;t[r+_]=o&255,_+=E,o/=256,d-=8);t[r+_-E]|=P*128},Vn}function qc(){if(Rc)return tr;Rc=!0;let t=ap(),e=up(),r=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;tr.Buffer=o,tr.SlowBuffer=y,tr.INSPECT_MAX_BYTES=50;let n=2147483647;tr.kMaxLength=n,o.TYPED_ARRAY_SUPPORT=i(),!o.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function i(){try{let $=new Uint8Array(1),u={foo:function(){return 42}};return Object.setPrototypeOf(u,Uint8Array.prototype),Object.setPrototypeOf($,u),$.foo()===42}catch{return!1}}Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}});function s($){if($>n)throw new RangeError('The value "'+$+'" is invalid for option "size"');let u=new Uint8Array($);return Object.setPrototypeOf(u,o.prototype),u}function o($,u,l){if(typeof $=="number"){if(typeof u=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return m($)}return a($,u,l)}o.poolSize=8192;function a($,u,l){if(typeof $=="string")return f($,u);if(ArrayBuffer.isView($))return _($);if($==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof $);if(Pe($,ArrayBuffer)||$&&Pe($.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Pe($,SharedArrayBuffer)||$&&Pe($.buffer,SharedArrayBuffer)))return E($,u,l);if(typeof $=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let O=$.valueOf&&$.valueOf();if(O!=null&&O!==$)return o.from(O,u,l);let A=P($);if(A)return A;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof $[Symbol.toPrimitive]=="function")return o.from($[Symbol.toPrimitive]("string"),u,l);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof $)}o.from=function($,u,l){return a($,u,l)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array);function c($){if(typeof $!="number")throw new TypeError('"size" argument must be of type number');if($<0)throw new RangeError('The value "'+$+'" is invalid for option "size"')}function d($,u,l){return c($),$<=0?s($):u!==void 0?typeof l=="string"?s($).fill(u,l):s($).fill(u):s($)}o.alloc=function($,u,l){return d($,u,l)};function m($){return c($),s($<0?0:S($)|0)}o.allocUnsafe=function($){return m($)},o.allocUnsafeSlow=function($){return m($)};function f($,u){if((typeof u!="string"||u==="")&&(u="utf8"),!o.isEncoding(u))throw new TypeError("Unknown encoding: "+u);let l=w($,u)|0,O=s(l),A=O.write($,u);return A!==l&&(O=O.slice(0,A)),O}function g($){let u=$.length<0?0:S($.length)|0,l=s(u);for(let O=0;O<u;O+=1)l[O]=$[O]&255;return l}function _($){if(Pe($,Uint8Array)){let u=new Uint8Array($);return E(u.buffer,u.byteOffset,u.byteLength)}return g($)}function E($,u,l){if(u<0||$.byteLength<u)throw new RangeError('"offset" is outside of buffer bounds');if($.byteLength<u+(l||0))throw new RangeError('"length" is outside of buffer bounds');let O;return u===void 0&&l===void 0?O=new Uint8Array($):l===void 0?O=new Uint8Array($,u):O=new Uint8Array($,u,l),Object.setPrototypeOf(O,o.prototype),O}function P($){if(o.isBuffer($)){let u=S($.length)|0,l=s(u);return l.length===0||$.copy(l,0,0,u),l}if($.length!==void 0)return typeof $.length!="number"||Xt($.length)?s(0):g($);if($.type==="Buffer"&&Array.isArray($.data))return g($.data)}function S($){if($>=n)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n.toString(16)+" bytes");return $|0}function y($){return+$!=$&&($=0),o.alloc(+$)}o.isBuffer=function(u){return u!=null&&u._isBuffer===!0&&u!==o.prototype},o.compare=function(u,l){if(Pe(u,Uint8Array)&&(u=o.from(u,u.offset,u.byteLength)),Pe(l,Uint8Array)&&(l=o.from(l,l.offset,l.byteLength)),!o.isBuffer(u)||!o.isBuffer(l))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(u===l)return 0;let O=u.length,A=l.length;for(let x=0,U=Math.min(O,A);x<U;++x)if(u[x]!==l[x]){O=u[x],A=l[x];break}return O<A?-1:A<O?1:0},o.isEncoding=function(u){switch(String(u).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},o.concat=function(u,l){if(!Array.isArray(u))throw new TypeError('"list" argument must be an Array of Buffers');if(u.length===0)return o.alloc(0);let O;if(l===void 0)for(l=0,O=0;O<u.length;++O)l+=u[O].length;let A=o.allocUnsafe(l),x=0;for(O=0;O<u.length;++O){let U=u[O];if(Pe(U,Uint8Array))x+U.length>A.length?(o.isBuffer(U)||(U=o.from(U)),U.copy(A,x)):Uint8Array.prototype.set.call(A,U,x);else if(o.isBuffer(U))U.copy(A,x);else throw new TypeError('"list" argument must be an Array of Buffers');x+=U.length}return A};function w($,u){if(o.isBuffer($))return $.length;if(ArrayBuffer.isView($)||Pe($,ArrayBuffer))return $.byteLength;if(typeof $!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof $);let l=$.length,O=arguments.length>2&&arguments[2]===!0;if(!O&&l===0)return 0;let A=!1;for(;;)switch(u){case"ascii":case"latin1":case"binary":return l;case"utf8":case"utf-8":return ve($).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return l*2;case"hex":return l>>>1;case"base64":return nt($).length;default:if(A)return O?-1:ve($).length;u=(""+u).toLowerCase(),A=!0}}o.byteLength=w;function p($,u,l){let O=!1;if((u===void 0||u<0)&&(u=0),u>this.length||((l===void 0||l>this.length)&&(l=this.length),l<=0)||(l>>>=0,u>>>=0,l<=u))return"";for($||($="utf8");;)switch($){case"hex":return q(this,u,l);case"utf8":case"utf-8":return Y(this,u,l);case"ascii":return fe(this,u,l);case"latin1":case"binary":return me(this,u,l);case"base64":return re(this,u,l);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,u,l);default:if(O)throw new TypeError("Unknown encoding: "+$);$=($+"").toLowerCase(),O=!0}}o.prototype._isBuffer=!0;function h($,u,l){let O=$[u];$[u]=$[l],$[l]=O}o.prototype.swap16=function(){let u=this.length;if(u%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let l=0;l<u;l+=2)h(this,l,l+1);return this},o.prototype.swap32=function(){let u=this.length;if(u%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let l=0;l<u;l+=4)h(this,l,l+3),h(this,l+1,l+2);return this},o.prototype.swap64=function(){let u=this.length;if(u%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let l=0;l<u;l+=8)h(this,l,l+7),h(this,l+1,l+6),h(this,l+2,l+5),h(this,l+3,l+4);return this},o.prototype.toString=function(){let u=this.length;return u===0?"":arguments.length===0?Y(this,0,u):p.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(u){if(!o.isBuffer(u))throw new TypeError("Argument must be a Buffer");return this===u?!0:o.compare(this,u)===0},o.prototype.inspect=function(){let u="",l=tr.INSPECT_MAX_BYTES;return u=this.toString("hex",0,l).replace(/(.{2})/g,"$1 ").trim(),this.length>l&&(u+=" ... "),"<Buffer "+u+">"},r&&(o.prototype[r]=o.prototype.inspect),o.prototype.compare=function(u,l,O,A,x){if(Pe(u,Uint8Array)&&(u=o.from(u,u.offset,u.byteLength)),!o.isBuffer(u))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof u);if(l===void 0&&(l=0),O===void 0&&(O=u?u.length:0),A===void 0&&(A=0),x===void 0&&(x=this.length),l<0||O>u.length||A<0||x>this.length)throw new RangeError("out of range index");if(A>=x&&l>=O)return 0;if(A>=x)return-1;if(l>=O)return 1;if(l>>>=0,O>>>=0,A>>>=0,x>>>=0,this===u)return 0;let U=x-A,pe=O-l,Ce=Math.min(U,pe),ke=this.slice(A,x),xe=u.slice(l,O);for(let Ae=0;Ae<Ce;++Ae)if(ke[Ae]!==xe[Ae]){U=ke[Ae],pe=xe[Ae];break}return U<pe?-1:pe<U?1:0};function v($,u,l,O,A){if($.length===0)return-1;if(typeof l=="string"?(O=l,l=0):l>2147483647?l=2147483647:l<-2147483648&&(l=-2147483648),l=+l,Xt(l)&&(l=A?0:$.length-1),l<0&&(l=$.length+l),l>=$.length){if(A)return-1;l=$.length-1}else if(l<0)if(A)l=0;else return-1;if(typeof u=="string"&&(u=o.from(u,O)),o.isBuffer(u))return u.length===0?-1:b($,u,l,O,A);if(typeof u=="number")return u=u&255,typeof Uint8Array.prototype.indexOf=="function"?A?Uint8Array.prototype.indexOf.call($,u,l):Uint8Array.prototype.lastIndexOf.call($,u,l):b($,[u],l,O,A);throw new TypeError("val must be string, number or Buffer")}function b($,u,l,O,A){let x=1,U=$.length,pe=u.length;if(O!==void 0&&(O=String(O).toLowerCase(),O==="ucs2"||O==="ucs-2"||O==="utf16le"||O==="utf-16le")){if($.length<2||u.length<2)return-1;x=2,U/=2,pe/=2,l/=2}function Ce(xe,Ae){return x===1?xe[Ae]:xe.readUInt16BE(Ae*x)}let ke;if(A){let xe=-1;for(ke=l;ke<U;ke++)if(Ce($,ke)===Ce(u,xe===-1?0:ke-xe)){if(xe===-1&&(xe=ke),ke-xe+1===pe)return xe*x}else xe!==-1&&(ke-=ke-xe),xe=-1}else for(l+pe>U&&(l=U-pe),ke=l;ke>=0;ke--){let xe=!0;for(let Ae=0;Ae<pe;Ae++)if(Ce($,ke+Ae)!==Ce(u,Ae)){xe=!1;break}if(xe)return ke}return-1}o.prototype.includes=function(u,l,O){return this.indexOf(u,l,O)!==-1},o.prototype.indexOf=function(u,l,O){return v(this,u,l,O,!0)},o.prototype.lastIndexOf=function(u,l,O){return v(this,u,l,O,!1)};function N($,u,l,O){l=Number(l)||0;let A=$.length-l;O?(O=Number(O),O>A&&(O=A)):O=A;let x=u.length;O>x/2&&(O=x/2);let U;for(U=0;U<O;++U){let pe=parseInt(u.substr(U*2,2),16);if(Xt(pe))return U;$[l+U]=pe}return U}function C($,u,l,O){return Fe(ve(u,$.length-l),$,l,O)}function j($,u,l,O){return Fe(ge(u),$,l,O)}function G($,u,l,O){return Fe(nt(u),$,l,O)}function H($,u,l,O){return Fe(Se(u,$.length-l),$,l,O)}o.prototype.write=function(u,l,O,A){if(l===void 0)A="utf8",O=this.length,l=0;else if(O===void 0&&typeof l=="string")A=l,O=this.length,l=0;else if(isFinite(l))l=l>>>0,isFinite(O)?(O=O>>>0,A===void 0&&(A="utf8")):(A=O,O=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let x=this.length-l;if((O===void 0||O>x)&&(O=x),u.length>0&&(O<0||l<0)||l>this.length)throw new RangeError("Attempt to write outside buffer bounds");A||(A="utf8");let U=!1;for(;;)switch(A){case"hex":return N(this,u,l,O);case"utf8":case"utf-8":return C(this,u,l,O);case"ascii":case"latin1":case"binary":return j(this,u,l,O);case"base64":return G(this,u,l,O);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return H(this,u,l,O);default:if(U)throw new TypeError("Unknown encoding: "+A);A=(""+A).toLowerCase(),U=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function re($,u,l){return u===0&&l===$.length?t.fromByteArray($):t.fromByteArray($.slice(u,l))}function Y($,u,l){l=Math.min($.length,l);let O=[],A=u;for(;A<l;){let x=$[A],U=null,pe=x>239?4:x>223?3:x>191?2:1;if(A+pe<=l){let Ce,ke,xe,Ae;switch(pe){case 1:x<128&&(U=x);break;case 2:Ce=$[A+1],(Ce&192)===128&&(Ae=(x&31)<<6|Ce&63,Ae>127&&(U=Ae));break;case 3:Ce=$[A+1],ke=$[A+2],(Ce&192)===128&&(ke&192)===128&&(Ae=(x&15)<<12|(Ce&63)<<6|ke&63,Ae>2047&&(Ae<55296||Ae>57343)&&(U=Ae));break;case 4:Ce=$[A+1],ke=$[A+2],xe=$[A+3],(Ce&192)===128&&(ke&192)===128&&(xe&192)===128&&(Ae=(x&15)<<18|(Ce&63)<<12|(ke&63)<<6|xe&63,Ae>65535&&Ae<1114112&&(U=Ae))}}U===null?(U=65533,pe=1):U>65535&&(U-=65536,O.push(U>>>10&1023|55296),U=56320|U&1023),O.push(U),A+=pe}return ce(O)}let Z=4096;function ce($){let u=$.length;if(u<=Z)return String.fromCharCode.apply(String,$);let l="",O=0;for(;O<u;)l+=String.fromCharCode.apply(String,$.slice(O,O+=Z));return l}function fe($,u,l){let O="";l=Math.min($.length,l);for(let A=u;A<l;++A)O+=String.fromCharCode($[A]&127);return O}function me($,u,l){let O="";l=Math.min($.length,l);for(let A=u;A<l;++A)O+=String.fromCharCode($[A]);return O}function q($,u,l){let O=$.length;(!u||u<0)&&(u=0),(!l||l<0||l>O)&&(l=O);let A="";for(let x=u;x<l;++x)A+=Zt[$[x]];return A}function k($,u,l){let O=$.slice(u,l),A="";for(let x=0;x<O.length-1;x+=2)A+=String.fromCharCode(O[x]+O[x+1]*256);return A}o.prototype.slice=function(u,l){let O=this.length;u=~~u,l=l===void 0?O:~~l,u<0?(u+=O,u<0&&(u=0)):u>O&&(u=O),l<0?(l+=O,l<0&&(l=0)):l>O&&(l=O),l<u&&(l=u);let A=this.subarray(u,l);return Object.setPrototypeOf(A,o.prototype),A};function L($,u,l){if($%1!==0||$<0)throw new RangeError("offset is not uint");if($+u>l)throw new RangeError("Trying to access beyond buffer length")}o.prototype.readUintLE=o.prototype.readUIntLE=function(u,l,O){u=u>>>0,l=l>>>0,O||L(u,l,this.length);let A=this[u],x=1,U=0;for(;++U<l&&(x*=256);)A+=this[u+U]*x;return A},o.prototype.readUintBE=o.prototype.readUIntBE=function(u,l,O){u=u>>>0,l=l>>>0,O||L(u,l,this.length);let A=this[u+--l],x=1;for(;l>0&&(x*=256);)A+=this[u+--l]*x;return A},o.prototype.readUint8=o.prototype.readUInt8=function(u,l){return u=u>>>0,l||L(u,1,this.length),this[u]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(u,l){return u=u>>>0,l||L(u,2,this.length),this[u]|this[u+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(u,l){return u=u>>>0,l||L(u,2,this.length),this[u]<<8|this[u+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(u,l){return u=u>>>0,l||L(u,4,this.length),(this[u]|this[u+1]<<8|this[u+2]<<16)+this[u+3]*16777216},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(u,l){return u=u>>>0,l||L(u,4,this.length),this[u]*16777216+(this[u+1]<<16|this[u+2]<<8|this[u+3])},o.prototype.readBigUInt64LE=Ut(function(u){u=u>>>0,$e(u,"offset");let l=this[u],O=this[u+7];(l===void 0||O===void 0)&&Re(u,this.length-8);let A=l+this[++u]*2**8+this[++u]*2**16+this[++u]*2**24,x=this[++u]+this[++u]*2**8+this[++u]*2**16+O*2**24;return BigInt(A)+(BigInt(x)<<BigInt(32))}),o.prototype.readBigUInt64BE=Ut(function(u){u=u>>>0,$e(u,"offset");let l=this[u],O=this[u+7];(l===void 0||O===void 0)&&Re(u,this.length-8);let A=l*2**24+this[++u]*2**16+this[++u]*2**8+this[++u],x=this[++u]*2**24+this[++u]*2**16+this[++u]*2**8+O;return(BigInt(A)<<BigInt(32))+BigInt(x)}),o.prototype.readIntLE=function(u,l,O){u=u>>>0,l=l>>>0,O||L(u,l,this.length);let A=this[u],x=1,U=0;for(;++U<l&&(x*=256);)A+=this[u+U]*x;return x*=128,A>=x&&(A-=Math.pow(2,8*l)),A},o.prototype.readIntBE=function(u,l,O){u=u>>>0,l=l>>>0,O||L(u,l,this.length);let A=l,x=1,U=this[u+--A];for(;A>0&&(x*=256);)U+=this[u+--A]*x;return x*=128,U>=x&&(U-=Math.pow(2,8*l)),U},o.prototype.readInt8=function(u,l){return u=u>>>0,l||L(u,1,this.length),this[u]&128?(255-this[u]+1)*-1:this[u]},o.prototype.readInt16LE=function(u,l){u=u>>>0,l||L(u,2,this.length);let O=this[u]|this[u+1]<<8;return O&32768?O|4294901760:O},o.prototype.readInt16BE=function(u,l){u=u>>>0,l||L(u,2,this.length);let O=this[u+1]|this[u]<<8;return O&32768?O|4294901760:O},o.prototype.readInt32LE=function(u,l){return u=u>>>0,l||L(u,4,this.length),this[u]|this[u+1]<<8|this[u+2]<<16|this[u+3]<<24},o.prototype.readInt32BE=function(u,l){return u=u>>>0,l||L(u,4,this.length),this[u]<<24|this[u+1]<<16|this[u+2]<<8|this[u+3]},o.prototype.readBigInt64LE=Ut(function(u){u=u>>>0,$e(u,"offset");let l=this[u],O=this[u+7];(l===void 0||O===void 0)&&Re(u,this.length-8);let A=this[u+4]+this[u+5]*2**8+this[u+6]*2**16+(O<<24);return(BigInt(A)<<BigInt(32))+BigInt(l+this[++u]*2**8+this[++u]*2**16+this[++u]*2**24)}),o.prototype.readBigInt64BE=Ut(function(u){u=u>>>0,$e(u,"offset");let l=this[u],O=this[u+7];(l===void 0||O===void 0)&&Re(u,this.length-8);let A=(l<<24)+this[++u]*2**16+this[++u]*2**8+this[++u];return(BigInt(A)<<BigInt(32))+BigInt(this[++u]*2**24+this[++u]*2**16+this[++u]*2**8+O)}),o.prototype.readFloatLE=function(u,l){return u=u>>>0,l||L(u,4,this.length),e.read(this,u,!0,23,4)},o.prototype.readFloatBE=function(u,l){return u=u>>>0,l||L(u,4,this.length),e.read(this,u,!1,23,4)},o.prototype.readDoubleLE=function(u,l){return u=u>>>0,l||L(u,8,this.length),e.read(this,u,!0,52,8)},o.prototype.readDoubleBE=function(u,l){return u=u>>>0,l||L(u,8,this.length),e.read(this,u,!1,52,8)};function B($,u,l,O,A,x){if(!o.isBuffer($))throw new TypeError('"buffer" argument must be a Buffer instance');if(u>A||u<x)throw new RangeError('"value" argument is out of bounds');if(l+O>$.length)throw new RangeError("Index out of range")}o.prototype.writeUintLE=o.prototype.writeUIntLE=function(u,l,O,A){if(u=+u,l=l>>>0,O=O>>>0,!A){let pe=Math.pow(2,8*O)-1;B(this,u,l,O,pe,0)}let x=1,U=0;for(this[l]=u&255;++U<O&&(x*=256);)this[l+U]=u/x&255;return l+O},o.prototype.writeUintBE=o.prototype.writeUIntBE=function(u,l,O,A){if(u=+u,l=l>>>0,O=O>>>0,!A){let pe=Math.pow(2,8*O)-1;B(this,u,l,O,pe,0)}let x=O-1,U=1;for(this[l+x]=u&255;--x>=0&&(U*=256);)this[l+x]=u/U&255;return l+O},o.prototype.writeUint8=o.prototype.writeUInt8=function(u,l,O){return u=+u,l=l>>>0,O||B(this,u,l,1,255,0),this[l]=u&255,l+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(u,l,O){return u=+u,l=l>>>0,O||B(this,u,l,2,65535,0),this[l]=u&255,this[l+1]=u>>>8,l+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(u,l,O){return u=+u,l=l>>>0,O||B(this,u,l,2,65535,0),this[l]=u>>>8,this[l+1]=u&255,l+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(u,l,O){return u=+u,l=l>>>0,O||B(this,u,l,4,4294967295,0),this[l+3]=u>>>24,this[l+2]=u>>>16,this[l+1]=u>>>8,this[l]=u&255,l+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(u,l,O){return u=+u,l=l>>>0,O||B(this,u,l,4,4294967295,0),this[l]=u>>>24,this[l+1]=u>>>16,this[l+2]=u>>>8,this[l+3]=u&255,l+4};function F($,u,l,O,A){Ee(u,O,A,$,l,7);let x=Number(u&BigInt(4294967295));$[l++]=x,x=x>>8,$[l++]=x,x=x>>8,$[l++]=x,x=x>>8,$[l++]=x;let U=Number(u>>BigInt(32)&BigInt(4294967295));return $[l++]=U,U=U>>8,$[l++]=U,U=U>>8,$[l++]=U,U=U>>8,$[l++]=U,l}function X($,u,l,O,A){Ee(u,O,A,$,l,7);let x=Number(u&BigInt(4294967295));$[l+7]=x,x=x>>8,$[l+6]=x,x=x>>8,$[l+5]=x,x=x>>8,$[l+4]=x;let U=Number(u>>BigInt(32)&BigInt(4294967295));return $[l+3]=U,U=U>>8,$[l+2]=U,U=U>>8,$[l+1]=U,U=U>>8,$[l]=U,l+8}o.prototype.writeBigUInt64LE=Ut(function(u,l=0){return F(this,u,l,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeBigUInt64BE=Ut(function(u,l=0){return X(this,u,l,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeIntLE=function(u,l,O,A){if(u=+u,l=l>>>0,!A){let Ce=Math.pow(2,8*O-1);B(this,u,l,O,Ce-1,-Ce)}let x=0,U=1,pe=0;for(this[l]=u&255;++x<O&&(U*=256);)u<0&&pe===0&&this[l+x-1]!==0&&(pe=1),this[l+x]=(u/U>>0)-pe&255;return l+O},o.prototype.writeIntBE=function(u,l,O,A){if(u=+u,l=l>>>0,!A){let Ce=Math.pow(2,8*O-1);B(this,u,l,O,Ce-1,-Ce)}let x=O-1,U=1,pe=0;for(this[l+x]=u&255;--x>=0&&(U*=256);)u<0&&pe===0&&this[l+x+1]!==0&&(pe=1),this[l+x]=(u/U>>0)-pe&255;return l+O},o.prototype.writeInt8=function(u,l,O){return u=+u,l=l>>>0,O||B(this,u,l,1,127,-128),u<0&&(u=255+u+1),this[l]=u&255,l+1},o.prototype.writeInt16LE=function(u,l,O){return u=+u,l=l>>>0,O||B(this,u,l,2,32767,-32768),this[l]=u&255,this[l+1]=u>>>8,l+2},o.prototype.writeInt16BE=function(u,l,O){return u=+u,l=l>>>0,O||B(this,u,l,2,32767,-32768),this[l]=u>>>8,this[l+1]=u&255,l+2},o.prototype.writeInt32LE=function(u,l,O){return u=+u,l=l>>>0,O||B(this,u,l,4,2147483647,-2147483648),this[l]=u&255,this[l+1]=u>>>8,this[l+2]=u>>>16,this[l+3]=u>>>24,l+4},o.prototype.writeInt32BE=function(u,l,O){return u=+u,l=l>>>0,O||B(this,u,l,4,2147483647,-2147483648),u<0&&(u=4294967295+u+1),this[l]=u>>>24,this[l+1]=u>>>16,this[l+2]=u>>>8,this[l+3]=u&255,l+4},o.prototype.writeBigInt64LE=Ut(function(u,l=0){return F(this,u,l,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),o.prototype.writeBigInt64BE=Ut(function(u,l=0){return X(this,u,l,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function ie($,u,l,O,A,x){if(l+O>$.length)throw new RangeError("Index out of range");if(l<0)throw new RangeError("Index out of range")}function J($,u,l,O,A){return u=+u,l=l>>>0,A||ie($,u,l,4),e.write($,u,l,O,23,4),l+4}o.prototype.writeFloatLE=function(u,l,O){return J(this,u,l,!0,O)},o.prototype.writeFloatBE=function(u,l,O){return J(this,u,l,!1,O)};function D($,u,l,O,A){return u=+u,l=l>>>0,A||ie($,u,l,8),e.write($,u,l,O,52,8),l+8}o.prototype.writeDoubleLE=function(u,l,O){return D(this,u,l,!0,O)},o.prototype.writeDoubleBE=function(u,l,O){return D(this,u,l,!1,O)},o.prototype.copy=function(u,l,O,A){if(!o.isBuffer(u))throw new TypeError("argument should be a Buffer");if(O||(O=0),!A&&A!==0&&(A=this.length),l>=u.length&&(l=u.length),l||(l=0),A>0&&A<O&&(A=O),A===O||u.length===0||this.length===0)return 0;if(l<0)throw new RangeError("targetStart out of bounds");if(O<0||O>=this.length)throw new RangeError("Index out of range");if(A<0)throw new RangeError("sourceEnd out of bounds");A>this.length&&(A=this.length),u.length-l<A-O&&(A=u.length-l+O);let x=A-O;return this===u&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(l,O,A):Uint8Array.prototype.set.call(u,this.subarray(O,A),l),x},o.prototype.fill=function(u,l,O,A){if(typeof u=="string"){if(typeof l=="string"?(A=l,l=0,O=this.length):typeof O=="string"&&(A=O,O=this.length),A!==void 0&&typeof A!="string")throw new TypeError("encoding must be a string");if(typeof A=="string"&&!o.isEncoding(A))throw new TypeError("Unknown encoding: "+A);if(u.length===1){let U=u.charCodeAt(0);(A==="utf8"&&U<128||A==="latin1")&&(u=U)}}else typeof u=="number"?u=u&255:typeof u=="boolean"&&(u=Number(u));if(l<0||this.length<l||this.length<O)throw new RangeError("Out of range index");if(O<=l)return this;l=l>>>0,O=O===void 0?this.length:O>>>0,u||(u=0);let x;if(typeof u=="number")for(x=l;x<O;++x)this[x]=u;else{let U=o.isBuffer(u)?u:o.from(u,A),pe=U.length;if(pe===0)throw new TypeError('The value "'+u+'" is invalid for argument "value"');for(x=0;x<O-l;++x)this[x+l]=U[x%pe]}return this};let M={};function W($,u,l){M[$]=class extends l{constructor(){super(),Object.defineProperty(this,"message",{value:u.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${$}]`,this.stack,delete this.name}get code(){return $}set code(A){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:A,writable:!0})}toString(){return`${this.name} [${$}]: ${this.message}`}}}W("ERR_BUFFER_OUT_OF_BOUNDS",function($){return $?`${$} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),W("ERR_INVALID_ARG_TYPE",function($,u){return`The "${$}" argument must be of type number. Received type ${typeof u}`},TypeError),W("ERR_OUT_OF_RANGE",function($,u,l){let O=`The value of "${$}" is out of range.`,A=l;return Number.isInteger(l)&&Math.abs(l)>2**32?A=ee(String(l)):typeof l=="bigint"&&(A=String(l),(l>BigInt(2)**BigInt(32)||l<-(BigInt(2)**BigInt(32)))&&(A=ee(A)),A+="n"),O+=` It must be ${u}. Received ${A}`,O},RangeError);function ee($){let u="",l=$.length,O=$[0]==="-"?1:0;for(;l>=O+4;l-=3)u=`_${$.slice(l-3,l)}${u}`;return`${$.slice(0,l)}${u}`}function ne($,u,l){$e(u,"offset"),($[u]===void 0||$[u+l]===void 0)&&Re(u,$.length-(l+1))}function Ee($,u,l,O,A,x){if($>l||$<u){let U=typeof u=="bigint"?"n":"",pe;throw u===0||u===BigInt(0)?pe=`>= 0${U} and < 2${U} ** ${(x+1)*8}${U}`:pe=`>= -(2${U} ** ${(x+1)*8-1}${U}) and < 2 ** ${(x+1)*8-1}${U}`,new M.ERR_OUT_OF_RANGE("value",pe,$)}ne(O,A,x)}function $e($,u){if(typeof $!="number")throw new M.ERR_INVALID_ARG_TYPE(u,"number",$)}function Re($,u,l){throw Math.floor($)!==$?($e($,l),new M.ERR_OUT_OF_RANGE("offset","an integer",$)):u<0?new M.ERR_BUFFER_OUT_OF_BOUNDS:new M.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${u}`,$)}let We=/[^+/0-9A-Za-z-_]/g;function ct($){if($=$.split("=")[0],$=$.trim().replace(We,""),$.length<2)return"";for(;$.length%4!==0;)$=$+"=";return $}function ve($,u){u=u||1/0;let l,O=$.length,A=null,x=[];for(let U=0;U<O;++U){if(l=$.charCodeAt(U),l>55295&&l<57344){if(!A){if(l>56319){(u-=3)>-1&&x.push(239,191,189);continue}else if(U+1===O){(u-=3)>-1&&x.push(239,191,189);continue}A=l;continue}if(l<56320){(u-=3)>-1&&x.push(239,191,189),A=l;continue}l=(A-55296<<10|l-56320)+65536}else A&&(u-=3)>-1&&x.push(239,191,189);if(A=null,l<128){if((u-=1)<0)break;x.push(l)}else if(l<2048){if((u-=2)<0)break;x.push(l>>6|192,l&63|128)}else if(l<65536){if((u-=3)<0)break;x.push(l>>12|224,l>>6&63|128,l&63|128)}else if(l<1114112){if((u-=4)<0)break;x.push(l>>18|240,l>>12&63|128,l>>6&63|128,l&63|128)}else throw new Error("Invalid code point")}return x}function ge($){let u=[];for(let l=0;l<$.length;++l)u.push($.charCodeAt(l)&255);return u}function Se($,u){let l,O,A,x=[];for(let U=0;U<$.length&&!((u-=2)<0);++U)l=$.charCodeAt(U),O=l>>8,A=l%256,x.push(A),x.push(O);return x}function nt($){return t.toByteArray(ct($))}function Fe($,u,l,O){let A;for(A=0;A<O&&!(A+l>=u.length||A>=$.length);++A)u[A+l]=$[A];return A}function Pe($,u){return $ instanceof u||$!=null&&$.constructor!=null&&$.constructor.name!=null&&$.constructor.name===u.name}function Xt($){return $!==$}let Zt=function(){let $="0123456789abcdef",u=new Array(256);for(let l=0;l<16;++l){let O=l*16;for(let A=0;A<16;++A)u[O+A]=$[l]+$[A]}return u}();function Ut($){return typeof BigInt>"u"?Zh:$}function Zh(){throw new Error("BigInt not supported")}return tr}var en,Ic,Vn,Tc,tr,Rc,Nc=Pr(()=>{I();R();T();en={},Ic=!1;Vn={},Tc=!1;tr={},Rc=!1});var rr,z,ob,ab,kc=Pr(()=>{I();R();T();Nc();rr=qc();rr.Buffer;rr.SlowBuffer;rr.INSPECT_MAX_BYTES;rr.kMaxLength;z=rr.Buffer,ob=rr.INSPECT_MAX_BYTES,ab=rr.kMaxLength});var R=Pr(()=>{kc()});var Hc=Q((Vc,Jc)=>{I();R();T();(function(t){if(typeof Vc=="object")Jc.exports=t();else if(typeof define=="function"&&define.amd)define(t);else{var e;try{e=window}catch{e=self}e.SparkMD5=t()}})(function(t){"use strict";var e=function(y,w){return y+w&4294967295},r=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function n(y,w,p,h,v,b){return w=e(e(w,y),e(h,b)),e(w<<v|w>>>32-v,p)}function i(y,w){var p=y[0],h=y[1],v=y[2],b=y[3];p+=(h&v|~h&b)+w[0]-680876936|0,p=(p<<7|p>>>25)+h|0,b+=(p&h|~p&v)+w[1]-389564586|0,b=(b<<12|b>>>20)+p|0,v+=(b&p|~b&h)+w[2]+606105819|0,v=(v<<17|v>>>15)+b|0,h+=(v&b|~v&p)+w[3]-1044525330|0,h=(h<<22|h>>>10)+v|0,p+=(h&v|~h&b)+w[4]-176418897|0,p=(p<<7|p>>>25)+h|0,b+=(p&h|~p&v)+w[5]+1200080426|0,b=(b<<12|b>>>20)+p|0,v+=(b&p|~b&h)+w[6]-1473231341|0,v=(v<<17|v>>>15)+b|0,h+=(v&b|~v&p)+w[7]-45705983|0,h=(h<<22|h>>>10)+v|0,p+=(h&v|~h&b)+w[8]+1770035416|0,p=(p<<7|p>>>25)+h|0,b+=(p&h|~p&v)+w[9]-1958414417|0,b=(b<<12|b>>>20)+p|0,v+=(b&p|~b&h)+w[10]-42063|0,v=(v<<17|v>>>15)+b|0,h+=(v&b|~v&p)+w[11]-1990404162|0,h=(h<<22|h>>>10)+v|0,p+=(h&v|~h&b)+w[12]+1804603682|0,p=(p<<7|p>>>25)+h|0,b+=(p&h|~p&v)+w[13]-40341101|0,b=(b<<12|b>>>20)+p|0,v+=(b&p|~b&h)+w[14]-1502002290|0,v=(v<<17|v>>>15)+b|0,h+=(v&b|~v&p)+w[15]+1236535329|0,h=(h<<22|h>>>10)+v|0,p+=(h&b|v&~b)+w[1]-165796510|0,p=(p<<5|p>>>27)+h|0,b+=(p&v|h&~v)+w[6]-1069501632|0,b=(b<<9|b>>>23)+p|0,v+=(b&h|p&~h)+w[11]+643717713|0,v=(v<<14|v>>>18)+b|0,h+=(v&p|b&~p)+w[0]-373897302|0,h=(h<<20|h>>>12)+v|0,p+=(h&b|v&~b)+w[5]-701558691|0,p=(p<<5|p>>>27)+h|0,b+=(p&v|h&~v)+w[10]+38016083|0,b=(b<<9|b>>>23)+p|0,v+=(b&h|p&~h)+w[15]-660478335|0,v=(v<<14|v>>>18)+b|0,h+=(v&p|b&~p)+w[4]-405537848|0,h=(h<<20|h>>>12)+v|0,p+=(h&b|v&~b)+w[9]+568446438|0,p=(p<<5|p>>>27)+h|0,b+=(p&v|h&~v)+w[14]-1019803690|0,b=(b<<9|b>>>23)+p|0,v+=(b&h|p&~h)+w[3]-187363961|0,v=(v<<14|v>>>18)+b|0,h+=(v&p|b&~p)+w[8]+1163531501|0,h=(h<<20|h>>>12)+v|0,p+=(h&b|v&~b)+w[13]-1444681467|0,p=(p<<5|p>>>27)+h|0,b+=(p&v|h&~v)+w[2]-51403784|0,b=(b<<9|b>>>23)+p|0,v+=(b&h|p&~h)+w[7]+1735328473|0,v=(v<<14|v>>>18)+b|0,h+=(v&p|b&~p)+w[12]-1926607734|0,h=(h<<20|h>>>12)+v|0,p+=(h^v^b)+w[5]-378558|0,p=(p<<4|p>>>28)+h|0,b+=(p^h^v)+w[8]-2022574463|0,b=(b<<11|b>>>21)+p|0,v+=(b^p^h)+w[11]+1839030562|0,v=(v<<16|v>>>16)+b|0,h+=(v^b^p)+w[14]-35309556|0,h=(h<<23|h>>>9)+v|0,p+=(h^v^b)+w[1]-1530992060|0,p=(p<<4|p>>>28)+h|0,b+=(p^h^v)+w[4]+1272893353|0,b=(b<<11|b>>>21)+p|0,v+=(b^p^h)+w[7]-155497632|0,v=(v<<16|v>>>16)+b|0,h+=(v^b^p)+w[10]-1094730640|0,h=(h<<23|h>>>9)+v|0,p+=(h^v^b)+w[13]+681279174|0,p=(p<<4|p>>>28)+h|0,b+=(p^h^v)+w[0]-358537222|0,b=(b<<11|b>>>21)+p|0,v+=(b^p^h)+w[3]-722521979|0,v=(v<<16|v>>>16)+b|0,h+=(v^b^p)+w[6]+76029189|0,h=(h<<23|h>>>9)+v|0,p+=(h^v^b)+w[9]-640364487|0,p=(p<<4|p>>>28)+h|0,b+=(p^h^v)+w[12]-421815835|0,b=(b<<11|b>>>21)+p|0,v+=(b^p^h)+w[15]+530742520|0,v=(v<<16|v>>>16)+b|0,h+=(v^b^p)+w[2]-995338651|0,h=(h<<23|h>>>9)+v|0,p+=(v^(h|~b))+w[0]-198630844|0,p=(p<<6|p>>>26)+h|0,b+=(h^(p|~v))+w[7]+1126891415|0,b=(b<<10|b>>>22)+p|0,v+=(p^(b|~h))+w[14]-1416354905|0,v=(v<<15|v>>>17)+b|0,h+=(b^(v|~p))+w[5]-57434055|0,h=(h<<21|h>>>11)+v|0,p+=(v^(h|~b))+w[12]+1700485571|0,p=(p<<6|p>>>26)+h|0,b+=(h^(p|~v))+w[3]-1894986606|0,b=(b<<10|b>>>22)+p|0,v+=(p^(b|~h))+w[10]-1051523|0,v=(v<<15|v>>>17)+b|0,h+=(b^(v|~p))+w[1]-2054922799|0,h=(h<<21|h>>>11)+v|0,p+=(v^(h|~b))+w[8]+1873313359|0,p=(p<<6|p>>>26)+h|0,b+=(h^(p|~v))+w[15]-30611744|0,b=(b<<10|b>>>22)+p|0,v+=(p^(b|~h))+w[6]-1560198380|0,v=(v<<15|v>>>17)+b|0,h+=(b^(v|~p))+w[13]+1309151649|0,h=(h<<21|h>>>11)+v|0,p+=(v^(h|~b))+w[4]-145523070|0,p=(p<<6|p>>>26)+h|0,b+=(h^(p|~v))+w[11]-1120210379|0,b=(b<<10|b>>>22)+p|0,v+=(p^(b|~h))+w[2]+718787259|0,v=(v<<15|v>>>17)+b|0,h+=(b^(v|~p))+w[9]-343485551|0,h=(h<<21|h>>>11)+v|0,y[0]=p+y[0]|0,y[1]=h+y[1]|0,y[2]=v+y[2]|0,y[3]=b+y[3]|0}function s(y){var w=[],p;for(p=0;p<64;p+=4)w[p>>2]=y.charCodeAt(p)+(y.charCodeAt(p+1)<<8)+(y.charCodeAt(p+2)<<16)+(y.charCodeAt(p+3)<<24);return w}function o(y){var w=[],p;for(p=0;p<64;p+=4)w[p>>2]=y[p]+(y[p+1]<<8)+(y[p+2]<<16)+(y[p+3]<<24);return w}function a(y){var w=y.length,p=[1732584193,-271733879,-1732584194,271733878],h,v,b,N,C,j;for(h=64;h<=w;h+=64)i(p,s(y.substring(h-64,h)));for(y=y.substring(h-64),v=y.length,b=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],h=0;h<v;h+=1)b[h>>2]|=y.charCodeAt(h)<<(h%4<<3);if(b[h>>2]|=128<<(h%4<<3),h>55)for(i(p,b),h=0;h<16;h+=1)b[h]=0;return N=w*8,N=N.toString(16).match(/(.*?)(.{0,8})$/),C=parseInt(N[2],16),j=parseInt(N[1],16)||0,b[14]=C,b[15]=j,i(p,b),p}function c(y){var w=y.length,p=[1732584193,-271733879,-1732584194,271733878],h,v,b,N,C,j;for(h=64;h<=w;h+=64)i(p,o(y.subarray(h-64,h)));for(y=h-64<w?y.subarray(h-64):new Uint8Array(0),v=y.length,b=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],h=0;h<v;h+=1)b[h>>2]|=y[h]<<(h%4<<3);if(b[h>>2]|=128<<(h%4<<3),h>55)for(i(p,b),h=0;h<16;h+=1)b[h]=0;return N=w*8,N=N.toString(16).match(/(.*?)(.{0,8})$/),C=parseInt(N[2],16),j=parseInt(N[1],16)||0,b[14]=C,b[15]=j,i(p,b),p}function d(y){var w="",p;for(p=0;p<4;p+=1)w+=r[y>>p*8+4&15]+r[y>>p*8&15];return w}function m(y){var w;for(w=0;w<y.length;w+=1)y[w]=d(y[w]);return y.join("")}m(a("hello"))!=="5d41402abc4b2a76b9719d911017c592"&&(e=function(y,w){var p=(y&65535)+(w&65535),h=(y>>16)+(w>>16)+(p>>16);return h<<16|p&65535}),typeof ArrayBuffer<"u"&&!ArrayBuffer.prototype.slice&&function(){function y(w,p){return w=w|0||0,w<0?Math.max(w+p,0):Math.min(w,p)}ArrayBuffer.prototype.slice=function(w,p){var h=this.byteLength,v=y(w,h),b=h,N,C,j,G;return p!==t&&(b=y(p,h)),v>b?new ArrayBuffer(0):(N=b-v,C=new ArrayBuffer(N),j=new Uint8Array(C),G=new Uint8Array(this,v,N),j.set(G),C)}}();function f(y){return/[\u0080-\uFFFF]/.test(y)&&(y=unescape(encodeURIComponent(y))),y}function g(y,w){var p=y.length,h=new ArrayBuffer(p),v=new Uint8Array(h),b;for(b=0;b<p;b+=1)v[b]=y.charCodeAt(b);return w?v:h}function _(y){return String.fromCharCode.apply(null,new Uint8Array(y))}function E(y,w,p){var h=new Uint8Array(y.byteLength+w.byteLength);return h.set(new Uint8Array(y)),h.set(new Uint8Array(w),y.byteLength),p?h:h.buffer}function P(y){var w=[],p=y.length,h;for(h=0;h<p-1;h+=2)w.push(parseInt(y.substr(h,2),16));return String.fromCharCode.apply(String,w)}function S(){this.reset()}return S.prototype.append=function(y){return this.appendBinary(f(y)),this},S.prototype.appendBinary=function(y){this._buff+=y,this._length+=y.length;var w=this._buff.length,p;for(p=64;p<=w;p+=64)i(this._hash,s(this._buff.substring(p-64,p)));return this._buff=this._buff.substring(p-64),this},S.prototype.end=function(y){var w=this._buff,p=w.length,h,v=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],b;for(h=0;h<p;h+=1)v[h>>2]|=w.charCodeAt(h)<<(h%4<<3);return this._finish(v,p),b=m(this._hash),y&&(b=P(b)),this.reset(),b},S.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},S.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},S.prototype.setState=function(y){return this._buff=y.buff,this._length=y.length,this._hash=y.hash,this},S.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},S.prototype._finish=function(y,w){var p=w,h,v,b;if(y[p>>2]|=128<<(p%4<<3),p>55)for(i(this._hash,y),p=0;p<16;p+=1)y[p]=0;h=this._length*8,h=h.toString(16).match(/(.*?)(.{0,8})$/),v=parseInt(h[2],16),b=parseInt(h[1],16)||0,y[14]=v,y[15]=b,i(this._hash,y)},S.hash=function(y,w){return S.hashBinary(f(y),w)},S.hashBinary=function(y,w){var p=a(y),h=m(p);return w?P(h):h},S.ArrayBuffer=function(){this.reset()},S.ArrayBuffer.prototype.append=function(y){var w=E(this._buff.buffer,y,!0),p=w.length,h;for(this._length+=y.byteLength,h=64;h<=p;h+=64)i(this._hash,o(w.subarray(h-64,h)));return this._buff=h-64<p?new Uint8Array(w.buffer.slice(h-64)):new Uint8Array(0),this},S.ArrayBuffer.prototype.end=function(y){var w=this._buff,p=w.length,h=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],v,b;for(v=0;v<p;v+=1)h[v>>2]|=w[v]<<(v%4<<3);return this._finish(h,p),b=m(this._hash),y&&(b=P(b)),this.reset(),b},S.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},S.ArrayBuffer.prototype.getState=function(){var y=S.prototype.getState.call(this);return y.buff=_(y.buff),y},S.ArrayBuffer.prototype.setState=function(y){return y.buff=g(y.buff,!0),S.prototype.setState.call(this,y)},S.ArrayBuffer.prototype.destroy=S.prototype.destroy,S.ArrayBuffer.prototype._finish=S.prototype._finish,S.ArrayBuffer.hash=function(y,w){var p=c(new Uint8Array(y)),h=m(p);return w?P(h):h},S})});var Xc=Q(vs=>{"use strict";I();R();T();vs.stringify=function(e){var r=[];r.push({obj:e});for(var n="",i,s,o,a,c,d,m,f,g,_,E;i=r.pop();)if(s=i.obj,o=i.prefix||"",a=i.val||"",n+=o,a)n+=a;else if(typeof s!="object")n+=typeof s>"u"?null:JSON.stringify(s);else if(s===null)n+="null";else if(Array.isArray(s)){for(r.push({val:"]"}),c=s.length-1;c>=0;c--)d=c===0?"":",",r.push({obj:s[c],prefix:d});r.push({val:"["})}else{m=[];for(f in s)s.hasOwnProperty(f)&&m.push(f);for(r.push({val:"}"}),c=m.length-1;c>=0;c--)g=m[c],_=s[g],E=c>0?",":"",E+=JSON.stringify(g)+":",r.push({obj:_,prefix:E});r.push({val:"{"})}return n};function Ir(t,e,r){var n=r[r.length-1];t===n.element&&(r.pop(),n=r[r.length-1]);var i=n.element,s=n.index;if(Array.isArray(i))i.push(t);else if(s===e.length-2){var o=e.pop();i[o]=t}else e.push(t)}vs.parse=function(t){for(var e=[],r=[],n=0,i,s,o,a,c,d,m,f,g;;){if(i=t[n++],i==="}"||i==="]"||typeof i>"u"){if(e.length===1)return e.pop();Ir(e.pop(),e,r);continue}switch(i){case" ":case" ":case`
|
|
2
|
+
`:case":":case",":break;case"n":n+=3,Ir(null,e,r);break;case"t":n+=3,Ir(!0,e,r);break;case"f":n+=4,Ir(!1,e,r);break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"-":for(s="",n--;;)if(o=t[n++],/[\d\.\-e\+]/.test(o))s+=o;else{n--;break}Ir(parseFloat(s),e,r);break;case'"':for(a="",c=void 0,d=0;m=t[n++],m!=='"'||c==="\\"&&d%2===1;)a+=m,c=m,c==="\\"?d++:d=0;Ir(JSON.parse('"'+a+'"'),e,r);break;case"[":f={element:[],index:e.length},e.push(f.element),r.push(f);break;case"{":g={element:{},index:e.length},e.push(g.element),r.push(g);break;default:throw new Error("unexpectedly reached end of input: "+i)}}}});var pn=Q(we=>{"use strict";I();R();T();Object.defineProperty(we,"__esModule",{value:!0});we.regexpCode=we.getEsmExportName=we.getProperty=we.safeStringify=we.stringify=we.strConcat=we.addCodeArg=we.str=we._=we.nil=we._Code=we.Name=we.IDENTIFIER=we._CodeOrName=void 0;var dn=class{};we._CodeOrName=dn;we.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var pr=class extends dn{constructor(e){if(super(),!we.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};we.Name=pr;var ht=class extends dn{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,n)=>(n instanceof pr&&(r[n.str]=(r[n.str]||0)+1),r),{})}};we._Code=ht;we.nil=new ht("");function vl(t,...e){let r=[t[0]],n=0;for(;n<e.length;)So(r,e[n]),r.push(t[++n]);return new ht(r)}we._=vl;var $o=new ht("+");function yl(t,...e){let r=[hn(t[0])],n=0;for(;n<e.length;)r.push($o),So(r,e[n]),r.push($o,hn(t[++n]));return ly(r),new ht(r)}we.str=yl;function So(t,e){e instanceof ht?t.push(...e._items):e instanceof pr?t.push(e):t.push(py(e))}we.addCodeArg=So;function ly(t){let e=1;for(;e<t.length-1;){if(t[e]===$o){let r=dy(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function dy(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof pr||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof pr))return`"${t}${e.slice(1)}`}function hy(t,e){return e.emptyStr()?t:t.emptyStr()?e:yl`${t}${e}`}we.strConcat=hy;function py(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:hn(Array.isArray(t)?t.join(","):t)}function my(t){return new ht(hn(t))}we.stringify=my;function hn(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}we.safeStringify=hn;function vy(t){return typeof t=="string"&&we.IDENTIFIER.test(t)?new ht(`.${t}`):vl`[${t}]`}we.getProperty=vy;function yy(t){if(typeof t=="string"&&we.IDENTIFIER.test(t))return new ht(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}we.getEsmExportName=yy;function gy(t){return new ht(t.toString())}we.regexpCode=gy});var Ao=Q(ot=>{"use strict";I();R();T();Object.defineProperty(ot,"__esModule",{value:!0});ot.ValueScope=ot.ValueScopeName=ot.Scope=ot.varKinds=ot.UsedValueState=void 0;var st=pn(),Po=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},Ei;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(Ei||(ot.UsedValueState=Ei={}));ot.varKinds={const:new st.Name("const"),let:new st.Name("let"),var:new st.Name("var")};var $i=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof st.Name?e:this.name(e)}name(e){return new st.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};ot.Scope=$i;var Si=class extends st.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=(0,st._)`.${new st.Name(r)}[${n}]`}};ot.ValueScopeName=Si;var _y=(0,st._)`\n`,Oo=class extends $i{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?_y:st.nil}}get(){return this._scope}name(e){return new Si(e,this._newName(e))}value(e,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let i=this.toName(e),{prefix:s}=i,o=(n=r.key)!==null&&n!==void 0?n:r.ref,a=this._values[s];if(a){let m=a.get(o);if(m)return m}else a=this._values[s]=new Map;a.set(o,i);let c=this._scope[s]||(this._scope[s]=[]),d=c.length;return c[d]=r.ref,i.setValue(r,{property:s,itemIndex:d}),i}getValue(e,r){let n=this._values[e];if(n)return n.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,st._)`${e}${n.scopePath}`})}scopeCode(e=this._values,r,n){return this._reduceValues(e,i=>{if(i.value===void 0)throw new Error(`CodeGen: name "${i}" has no value`);return i.value.code},r,n)}_reduceValues(e,r,n={},i){let s=st.nil;for(let o in e){let a=e[o];if(!a)continue;let c=n[o]=n[o]||new Map;a.forEach(d=>{if(c.has(d))return;c.set(d,Ei.Started);let m=r(d);if(m){let f=this.opts.es5?ot.varKinds.var:ot.varKinds.const;s=(0,st._)`${s}${f} ${d} = ${m};${this.opts._n}`}else if(m=i?.(d))s=(0,st._)`${s}${m}${this.opts._n}`;else throw new Po(d);c.set(d,Ei.Completed)})}return s}};ot.ValueScope=Oo});var de=Q(le=>{"use strict";I();R();T();Object.defineProperty(le,"__esModule",{value:!0});le.or=le.and=le.not=le.CodeGen=le.operators=le.varKinds=le.ValueScopeName=le.ValueScope=le.Scope=le.Name=le.regexpCode=le.stringify=le.getProperty=le.nil=le.strConcat=le.str=le._=void 0;var ye=pn(),wt=Ao(),zt=pn();Object.defineProperty(le,"_",{enumerable:!0,get:function(){return zt._}});Object.defineProperty(le,"str",{enumerable:!0,get:function(){return zt.str}});Object.defineProperty(le,"strConcat",{enumerable:!0,get:function(){return zt.strConcat}});Object.defineProperty(le,"nil",{enumerable:!0,get:function(){return zt.nil}});Object.defineProperty(le,"getProperty",{enumerable:!0,get:function(){return zt.getProperty}});Object.defineProperty(le,"stringify",{enumerable:!0,get:function(){return zt.stringify}});Object.defineProperty(le,"regexpCode",{enumerable:!0,get:function(){return zt.regexpCode}});Object.defineProperty(le,"Name",{enumerable:!0,get:function(){return zt.Name}});var Ii=Ao();Object.defineProperty(le,"Scope",{enumerable:!0,get:function(){return Ii.Scope}});Object.defineProperty(le,"ValueScope",{enumerable:!0,get:function(){return Ii.ValueScope}});Object.defineProperty(le,"ValueScopeName",{enumerable:!0,get:function(){return Ii.ValueScopeName}});Object.defineProperty(le,"varKinds",{enumerable:!0,get:function(){return Ii.varKinds}});le.operators={GT:new ye._Code(">"),GTE:new ye._Code(">="),LT:new ye._Code("<"),LTE:new ye._Code("<="),EQ:new ye._Code("==="),NEQ:new ye._Code("!=="),NOT:new ye._Code("!"),OR:new ye._Code("||"),AND:new ye._Code("&&"),ADD:new ye._Code("+")};var jt=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},Io=class extends jt{constructor(e,r,n){super(),this.varKind=e,this.name=r,this.rhs=n}render({es5:e,_n:r}){let n=e?wt.varKinds.var:this.varKind,i=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${i};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=Lr(this.rhs,e,r)),this}get names(){return this.rhs instanceof ye._CodeOrName?this.rhs.names:{}}},Pi=class extends jt{constructor(e,r,n){super(),this.lhs=e,this.rhs=r,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof ye.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=Lr(this.rhs,e,r),this}get names(){let e=this.lhs instanceof ye.Name?{}:{...this.lhs.names};return Ai(e,this.rhs)}},To=class extends Pi{constructor(e,r,n,i){super(e,n,i),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},Ro=class extends jt{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},qo=class extends jt{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},No=class extends jt{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},ko=class extends jt{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=Lr(this.code,e,r),this}get names(){return this.code instanceof ye._CodeOrName?this.code.names:{}}},mn=class extends jt{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,n)=>r+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let n=e[r].optimizeNodes();Array.isArray(n)?e.splice(r,1,...n):n?e[r]=n:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:n}=this,i=n.length;for(;i--;){let s=n[i];s.optimizeNames(e,r)||(wy(e,s.names),n.splice(i,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>yr(e,r.names),{})}},Dt=class extends mn{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},Co=class extends mn{},Br=class extends Dt{};Br.kind="else";var mr=class t extends Dt{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new Br(n):n}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(gl(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=Lr(this.condition,e,r),this}get names(){let e=super.names;return Ai(e,this.condition),this.else&&yr(e,this.else.names),e}};mr.kind="if";var vr=class extends Dt{};vr.kind="for";var xo=class extends vr{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=Lr(this.iteration,e,r),this}get names(){return yr(super.names,this.iteration.names)}},jo=class extends vr{constructor(e,r,n,i){super(),this.varKind=e,this.name=r,this.from=n,this.to=i}render(e){let r=e.es5?wt.varKinds.var:this.varKind,{name:n,from:i,to:s}=this;return`for(${r} ${n}=${i}; ${n}<${s}; ${n}++)`+super.render(e)}get names(){let e=Ai(super.names,this.from);return Ai(e,this.to)}},Oi=class extends vr{constructor(e,r,n,i){super(),this.loop=e,this.varKind=r,this.name=n,this.iterable=i}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=Lr(this.iterable,e,r),this}get names(){return yr(super.names,this.iterable.names)}},vn=class extends Dt{constructor(e,r,n){super(),this.name=e,this.args=r,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};vn.kind="func";var yn=class extends mn{render(e){return"return "+super.render(e)}};yn.kind="return";var Do=class extends Dt{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var n,i;return super.optimizeNames(e,r),(n=this.catch)===null||n===void 0||n.optimizeNames(e,r),(i=this.finally)===null||i===void 0||i.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&yr(e,this.catch.names),this.finally&&yr(e,this.finally.names),e}},gn=class extends Dt{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};gn.kind="catch";var _n=class extends Dt{render(e){return"finally"+super.render(e)}};_n.kind="finally";var Bo=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
3
|
+
`:""},this._extScope=e,this._scope=new wt.Scope({parent:e}),this._nodes=[new Co]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,r){let n=this._extScope.value(e,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,r){return this._extScope.getValue(e,r)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,r,n,i){let s=this._scope.toName(r);return n!==void 0&&i&&(this._constants[s.str]=n),this._leafNode(new Io(e,s,n)),s}const(e,r,n){return this._def(wt.varKinds.const,e,r,n)}let(e,r,n){return this._def(wt.varKinds.let,e,r,n)}var(e,r,n){return this._def(wt.varKinds.var,e,r,n)}assign(e,r,n){return this._leafNode(new Pi(e,r,n))}add(e,r){return this._leafNode(new To(e,le.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==ye.nil&&this._leafNode(new ko(e)),this}object(...e){let r=["{"];for(let[n,i]of e)r.length>1&&r.push(","),r.push(n),(n!==i||this.opts.es5)&&(r.push(":"),(0,ye.addCodeArg)(r,i));return r.push("}"),new ye._Code(r)}if(e,r,n){if(this._blockNode(new mr(e)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new mr(e))}else(){return this._elseNode(new Br)}endIf(){return this._endBlockNode(mr,Br)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new xo(e),r)}forRange(e,r,n,i,s=this.opts.es5?wt.varKinds.var:wt.varKinds.let){let o=this._scope.toName(e);return this._for(new jo(s,o,r,n),()=>i(o))}forOf(e,r,n,i=wt.varKinds.const){let s=this._scope.toName(e);if(this.opts.es5){let o=r instanceof ye.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,ye._)`${o}.length`,a=>{this.var(s,(0,ye._)`${o}[${a}]`),n(s)})}return this._for(new Oi("of",i,s,r),()=>n(s))}forIn(e,r,n,i=this.opts.es5?wt.varKinds.var:wt.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,ye._)`Object.keys(${r})`,n);let s=this._scope.toName(e);return this._for(new Oi("in",i,s,r),()=>n(s))}endFor(){return this._endBlockNode(vr)}label(e){return this._leafNode(new Ro(e))}break(e){return this._leafNode(new qo(e))}return(e){let r=new yn;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(yn)}try(e,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let i=new Do;if(this._blockNode(i),this.code(e),r){let s=this.name("e");this._currNode=i.catch=new gn(s),r(s)}return n&&(this._currNode=i.finally=new _n,this.code(n)),this._endBlockNode(gn,_n)}throw(e){return this._leafNode(new No(e))}block(e,r){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(r),this}endBlock(e){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let n=this._nodes.length-r;if(n<0||e!==void 0&&n!==e)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=ye.nil,n,i){return this._blockNode(new vn(e,r,n)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode(vn)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,r){let n=this._currNode;if(n instanceof e||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${e.kind}/${r.kind}`:e.kind}"`)}_elseNode(e){let r=this._currNode;if(!(r instanceof mr))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let r=this._nodes;r[r.length-1]=e}};le.CodeGen=Bo;function yr(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function Ai(t,e){return e instanceof ye._CodeOrName?yr(t,e.names):t}function Lr(t,e,r){if(t instanceof ye.Name)return n(t);if(!i(t))return t;return new ye._Code(t._items.reduce((s,o)=>(o instanceof ye.Name&&(o=n(o)),o instanceof ye._Code?s.push(...o._items):s.push(o),s),[]));function n(s){let o=r[s.str];return o===void 0||e[s.str]!==1?s:(delete e[s.str],o)}function i(s){return s instanceof ye._Code&&s._items.some(o=>o instanceof ye.Name&&e[o.str]===1&&r[o.str]!==void 0)}}function wy(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function gl(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,ye._)`!${Lo(t)}`}le.not=gl;var by=_l(le.operators.AND);function Ey(...t){return t.reduce(by)}le.and=Ey;var $y=_l(le.operators.OR);function Sy(...t){return t.reduce($y)}le.or=Sy;function _l(t){return(e,r)=>e===ye.nil?r:r===ye.nil?e:(0,ye._)`${Lo(e)} ${t} ${Lo(r)}`}function Lo(t){return t instanceof ye.Name?t:(0,ye._)`(${t})`}});var be=Q(he=>{"use strict";I();R();T();Object.defineProperty(he,"__esModule",{value:!0});he.checkStrictMode=he.getErrorPath=he.Type=he.useFunc=he.setEvaluated=he.evaluatedPropsToName=he.mergeEvaluated=he.eachItem=he.unescapeJsonPointer=he.escapeJsonPointer=he.escapeFragment=he.unescapeFragment=he.schemaRefOrVal=he.schemaHasRulesButRef=he.schemaHasRules=he.checkUnknownRules=he.alwaysValidSchema=he.toHash=void 0;var Te=de(),Py=pn();function Oy(t){let e={};for(let r of t)e[r]=!0;return e}he.toHash=Oy;function Ay(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(El(t,e),!$l(e,t.self.RULES.all))}he.alwaysValidSchema=Ay;function El(t,e=t.schema){let{opts:r,self:n}=t;if(!r.strictSchema||typeof e=="boolean")return;let i=n.RULES.keywords;for(let s in e)i[s]||Ol(t,`unknown keyword: "${s}"`)}he.checkUnknownRules=El;function $l(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}he.schemaHasRules=$l;function Iy(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}he.schemaHasRulesButRef=Iy;function Ty({topSchemaRef:t,schemaPath:e},r,n,i){if(!i){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,Te._)`${r}`}return(0,Te._)`${t}${e}${(0,Te.getProperty)(n)}`}he.schemaRefOrVal=Ty;function Ry(t){return Sl(decodeURIComponent(t))}he.unescapeFragment=Ry;function qy(t){return encodeURIComponent(Uo(t))}he.escapeFragment=qy;function Uo(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}he.escapeJsonPointer=Uo;function Sl(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}he.unescapeJsonPointer=Sl;function Ny(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}he.eachItem=Ny;function wl({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:n}){return(i,s,o,a)=>{let c=o===void 0?s:o instanceof Te.Name?(s instanceof Te.Name?t(i,s,o):e(i,s,o),o):s instanceof Te.Name?(e(i,o,s),s):r(s,o);return a===Te.Name&&!(c instanceof Te.Name)?n(i,c):c}}he.mergeEvaluated={props:wl({mergeNames:(t,e,r)=>t.if((0,Te._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,Te._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,Te._)`${r} || {}`).code((0,Te._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,Te._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,Te._)`${r} || {}`),Go(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:Pl}),items:wl({mergeNames:(t,e,r)=>t.if((0,Te._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,Te._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,Te._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,Te._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function Pl(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,Te._)`{}`);return e!==void 0&&Go(t,r,e),r}he.evaluatedPropsToName=Pl;function Go(t,e,r){Object.keys(r).forEach(n=>t.assign((0,Te._)`${e}${(0,Te.getProperty)(n)}`,!0))}he.setEvaluated=Go;var bl={};function ky(t,e){return t.scopeValue("func",{ref:e,code:bl[e.code]||(bl[e.code]=new Py._Code(e.code))})}he.useFunc=ky;var Mo;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(Mo||(he.Type=Mo={}));function Cy(t,e,r){if(t instanceof Te.Name){let n=e===Mo.Num;return r?n?(0,Te._)`"[" + ${t} + "]"`:(0,Te._)`"['" + ${t} + "']"`:n?(0,Te._)`"/" + ${t}`:(0,Te._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,Te.getProperty)(t).toString():"/"+Uo(t)}he.getErrorPath=Cy;function Ol(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}he.checkStrictMode=Ol});var Bt=Q(Fo=>{"use strict";I();R();T();Object.defineProperty(Fo,"__esModule",{value:!0});var Ye=de(),xy={data:new Ye.Name("data"),valCxt:new Ye.Name("valCxt"),instancePath:new Ye.Name("instancePath"),parentData:new Ye.Name("parentData"),parentDataProperty:new Ye.Name("parentDataProperty"),rootData:new Ye.Name("rootData"),dynamicAnchors:new Ye.Name("dynamicAnchors"),vErrors:new Ye.Name("vErrors"),errors:new Ye.Name("errors"),this:new Ye.Name("this"),self:new Ye.Name("self"),scope:new Ye.Name("scope"),json:new Ye.Name("json"),jsonPos:new Ye.Name("jsonPos"),jsonLen:new Ye.Name("jsonLen"),jsonPart:new Ye.Name("jsonPart")};Fo.default=xy});var wn=Q(Xe=>{"use strict";I();R();T();Object.defineProperty(Xe,"__esModule",{value:!0});Xe.extendErrors=Xe.resetErrorsCount=Xe.reportExtraError=Xe.reportError=Xe.keyword$DataError=Xe.keywordError=void 0;var _e=de(),Ti=be(),tt=Bt();Xe.keywordError={message:({keyword:t})=>(0,_e.str)`must pass "${t}" keyword validation`};Xe.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,_e.str)`"${t}" keyword must be ${e} ($data)`:(0,_e.str)`"${t}" keyword is invalid ($data)`};function jy(t,e=Xe.keywordError,r,n){let{it:i}=t,{gen:s,compositeRule:o,allErrors:a}=i,c=Tl(t,e,r);n??(o||a)?Al(s,c):Il(i,(0,_e._)`[${c}]`)}Xe.reportError=jy;function Dy(t,e=Xe.keywordError,r){let{it:n}=t,{gen:i,compositeRule:s,allErrors:o}=n,a=Tl(t,e,r);Al(i,a),s||o||Il(n,tt.default.vErrors)}Xe.reportExtraError=Dy;function By(t,e){t.assign(tt.default.errors,e),t.if((0,_e._)`${tt.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,_e._)`${tt.default.vErrors}.length`,e),()=>t.assign(tt.default.vErrors,null)))}Xe.resetErrorsCount=By;function Ly({gen:t,keyword:e,schemaValue:r,data:n,errsCount:i,it:s}){if(i===void 0)throw new Error("ajv implementation error");let o=t.name("err");t.forRange("i",i,tt.default.errors,a=>{t.const(o,(0,_e._)`${tt.default.vErrors}[${a}]`),t.if((0,_e._)`${o}.instancePath === undefined`,()=>t.assign((0,_e._)`${o}.instancePath`,(0,_e.strConcat)(tt.default.instancePath,s.errorPath))),t.assign((0,_e._)`${o}.schemaPath`,(0,_e.str)`${s.errSchemaPath}/${e}`),s.opts.verbose&&(t.assign((0,_e._)`${o}.schema`,r),t.assign((0,_e._)`${o}.data`,n))})}Xe.extendErrors=Ly;function Al(t,e){let r=t.const("err",e);t.if((0,_e._)`${tt.default.vErrors} === null`,()=>t.assign(tt.default.vErrors,(0,_e._)`[${r}]`),(0,_e._)`${tt.default.vErrors}.push(${r})`),t.code((0,_e._)`${tt.default.errors}++`)}function Il(t,e){let{gen:r,validateName:n,schemaEnv:i}=t;i.$async?r.throw((0,_e._)`new ${t.ValidationError}(${e})`):(r.assign((0,_e._)`${n}.errors`,e),r.return(!1))}var gr={keyword:new _e.Name("keyword"),schemaPath:new _e.Name("schemaPath"),params:new _e.Name("params"),propertyName:new _e.Name("propertyName"),message:new _e.Name("message"),schema:new _e.Name("schema"),parentSchema:new _e.Name("parentSchema")};function Tl(t,e,r){let{createErrors:n}=t.it;return n===!1?(0,_e._)`{}`:My(t,e,r)}function My(t,e,r={}){let{gen:n,it:i}=t,s=[Uy(i,r),Gy(t,r)];return Fy(t,e,s),n.object(...s)}function Uy({errorPath:t},{instancePath:e}){let r=e?(0,_e.str)`${t}${(0,Ti.getErrorPath)(e,Ti.Type.Str)}`:t;return[tt.default.instancePath,(0,_e.strConcat)(tt.default.instancePath,r)]}function Gy({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:n}){let i=n?e:(0,_e.str)`${e}/${t}`;return r&&(i=(0,_e.str)`${i}${(0,Ti.getErrorPath)(r,Ti.Type.Str)}`),[gr.schemaPath,i]}function Fy(t,{params:e,message:r},n){let{keyword:i,data:s,schemaValue:o,it:a}=t,{opts:c,propertyName:d,topSchemaRef:m,schemaPath:f}=a;n.push([gr.keyword,i],[gr.params,typeof e=="function"?e(t):e||(0,_e._)`{}`]),c.messages&&n.push([gr.message,typeof r=="function"?r(t):r]),c.verbose&&n.push([gr.schema,o],[gr.parentSchema,(0,_e._)`${m}${f}`],[tt.default.data,s]),d&&n.push([gr.propertyName,d])}});var ql=Q(Mr=>{"use strict";I();R();T();Object.defineProperty(Mr,"__esModule",{value:!0});Mr.boolOrEmptySchema=Mr.topBoolOrEmptySchema=void 0;var Ky=wn(),zy=de(),Vy=Bt(),Jy={message:"boolean schema is false"};function Hy(t){let{gen:e,schema:r,validateName:n}=t;r===!1?Rl(t,!1):typeof r=="object"&&r.$async===!0?e.return(Vy.default.data):(e.assign((0,zy._)`${n}.errors`,null),e.return(!0))}Mr.topBoolOrEmptySchema=Hy;function Wy(t,e){let{gen:r,schema:n}=t;n===!1?(r.var(e,!1),Rl(t)):r.var(e,!0)}Mr.boolOrEmptySchema=Wy;function Rl(t,e){let{gen:r,data:n}=t,i={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,Ky.reportError)(i,Jy,void 0,e)}});var Ko=Q(Ur=>{"use strict";I();R();T();Object.defineProperty(Ur,"__esModule",{value:!0});Ur.getRules=Ur.isJSONType=void 0;var Qy=["string","number","integer","boolean","null","object","array"],Yy=new Set(Qy);function Xy(t){return typeof t=="string"&&Yy.has(t)}Ur.isJSONType=Xy;function Zy(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}Ur.getRules=Zy});var zo=Q(Vt=>{"use strict";I();R();T();Object.defineProperty(Vt,"__esModule",{value:!0});Vt.shouldUseRule=Vt.shouldUseGroup=Vt.schemaHasRulesForType=void 0;function eg({schema:t,self:e},r){let n=e.RULES.types[r];return n&&n!==!0&&Nl(t,n)}Vt.schemaHasRulesForType=eg;function Nl(t,e){return e.rules.some(r=>kl(t,r))}Vt.shouldUseGroup=Nl;function kl(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(n=>t[n]!==void 0))}Vt.shouldUseRule=kl});var bn=Q(Ze=>{"use strict";I();R();T();Object.defineProperty(Ze,"__esModule",{value:!0});Ze.reportTypeError=Ze.checkDataTypes=Ze.checkDataType=Ze.coerceAndCheckDataType=Ze.getJSONTypes=Ze.getSchemaTypes=Ze.DataType=void 0;var tg=Ko(),rg=zo(),ng=wn(),ue=de(),Cl=be(),Gr;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(Gr||(Ze.DataType=Gr={}));function ig(t){let e=xl(t.type);if(e.includes("null")){if(t.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===!0&&e.push("null")}return e}Ze.getSchemaTypes=ig;function xl(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(tg.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}Ze.getJSONTypes=xl;function sg(t,e){let{gen:r,data:n,opts:i}=t,s=og(e,i.coerceTypes),o=e.length>0&&!(s.length===0&&e.length===1&&(0,rg.schemaHasRulesForType)(t,e[0]));if(o){let a=Jo(e,n,i.strictNumbers,Gr.Wrong);r.if(a,()=>{s.length?ag(t,e,s):Ho(t)})}return o}Ze.coerceAndCheckDataType=sg;var jl=new Set(["string","number","integer","boolean","null"]);function og(t,e){return e?t.filter(r=>jl.has(r)||e==="array"&&r==="array"):[]}function ag(t,e,r){let{gen:n,data:i,opts:s}=t,o=n.let("dataType",(0,ue._)`typeof ${i}`),a=n.let("coerced",(0,ue._)`undefined`);s.coerceTypes==="array"&&n.if((0,ue._)`${o} == 'object' && Array.isArray(${i}) && ${i}.length == 1`,()=>n.assign(i,(0,ue._)`${i}[0]`).assign(o,(0,ue._)`typeof ${i}`).if(Jo(e,i,s.strictNumbers),()=>n.assign(a,i))),n.if((0,ue._)`${a} !== undefined`);for(let d of r)(jl.has(d)||d==="array"&&s.coerceTypes==="array")&&c(d);n.else(),Ho(t),n.endIf(),n.if((0,ue._)`${a} !== undefined`,()=>{n.assign(i,a),ug(t,a)});function c(d){switch(d){case"string":n.elseIf((0,ue._)`${o} == "number" || ${o} == "boolean"`).assign(a,(0,ue._)`"" + ${i}`).elseIf((0,ue._)`${i} === null`).assign(a,(0,ue._)`""`);return;case"number":n.elseIf((0,ue._)`${o} == "boolean" || ${i} === null
|
|
3
4
|
|| (${o} == "string" && ${i} && ${i} == +${i})`).assign(a,(0,ue._)`+${i}`);return;case"integer":n.elseIf((0,ue._)`${o} === "boolean" || ${i} === null
|
|
4
5
|
|| (${o} === "string" && ${i} && ${i} == +${i} && !(${i} % 1))`).assign(a,(0,ue._)`+${i}`);return;case"boolean":n.elseIf((0,ue._)`${i} === "false" || ${i} === 0 || ${i} === null`).assign(a,!1).elseIf((0,ue._)`${i} === "true" || ${i} === 1`).assign(a,!0);return;case"null":n.elseIf((0,ue._)`${i} === "" || ${i} === 0 || ${i} === false`),n.assign(a,null);return;case"array":n.elseIf((0,ue._)`${o} === "string" || ${o} === "number"
|
|
5
|
-
|| ${o} === "boolean" || ${i} === null`).assign(a,(0,ue._)`[${i}]`)}}}function om({gen:t,parentData:e,parentDataProperty:r},n){t.if((0,ue._)`${e} !== undefined`,()=>t.assign((0,ue._)`${e}[${r}]`,n))}function Ns(t,e,r,n=Cr.Correct){let i=n===Cr.Correct?ue.operators.EQ:ue.operators.NEQ,s;switch(t){case"null":return(0,ue._)`${e} ${i} null`;case"array":s=(0,ue._)`Array.isArray(${e})`;break;case"object":s=(0,ue._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":s=o((0,ue._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":s=o();break;default:return(0,ue._)`typeof ${e} ${i} ${t}`}return n===Cr.Correct?s:(0,ue.not)(s);function o(a=ue.nil){return(0,ue.and)((0,ue._)`typeof ${e} == "number"`,a,r?(0,ue._)`isFinite(${e})`:ue.nil)}}Ze.checkDataType=Ns;function js(t,e,r,n){if(t.length===1)return Ns(t[0],e,r,n);let i,s=(0,df.toHash)(t);if(s.array&&s.object){let o=(0,ue._)`typeof ${e} != "object"`;i=s.null?o:(0,ue._)`!${e} || ${o}`,delete s.null,delete s.array,delete s.object}else i=ue.nil;s.number&&delete s.integer;for(let o in s)i=(0,ue.and)(i,Ns(o,e,r,n));return i}Ze.checkDataTypes=js;var am={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,ue._)`{type: ${t}}`:(0,ue._)`{type: ${e}}`};function Ds(t){let e=um(t);(0,tm.reportError)(e,am)}Ze.reportTypeError=Ds;function um(t){let{gen:e,data:r,schema:n}=t,i=(0,df.schemaRefOrVal)(t,n,"type");return{gen:e,keyword:"type",data:r,schema:n.type,schemaCode:i,schemaValue:i,parentSchema:n,params:{},it:t}}});var vf=Y(ei=>{"use strict";I();R();T();Object.defineProperty(ei,"__esModule",{value:!0});ei.assignDefaults=void 0;var kr=pe(),cm=be();function fm(t,e){let{properties:r,items:n}=t.schema;if(e==="object"&&r)for(let i in r)mf(t,i,r[i].default);else e==="array"&&Array.isArray(n)&&n.forEach((i,s)=>mf(t,s,i.default))}ei.assignDefaults=fm;function mf(t,e,r){let{gen:n,compositeRule:i,data:s,opts:o}=t;if(r===void 0)return;let a=(0,kr._)`${s}${(0,kr.getProperty)(e)}`;if(i){(0,cm.checkStrictMode)(t,`default is ignored for: ${a}`);return}let c=(0,kr._)`${a} === undefined`;o.useDefaults==="empty"&&(c=(0,kr._)`${c} || ${a} === null || ${a} === ""`),n.if(c,(0,kr._)`${a} = ${(0,kr.stringify)(r)}`)}});var lt=Y(Oe=>{"use strict";I();R();T();Object.defineProperty(Oe,"__esModule",{value:!0});Oe.validateUnion=Oe.validateArray=Oe.usePattern=Oe.callValidateCode=Oe.schemaProperties=Oe.allSchemaProperties=Oe.noPropertyInData=Oe.propertyInData=Oe.isOwnProperty=Oe.hasPropFunc=Oe.reportMissingProp=Oe.checkMissingProp=Oe.checkReportMissingProp=void 0;var qe=pe(),Bs=be(),zt=Dt(),lm=be();function dm(t,e){let{gen:r,data:n,it:i}=t;r.if(Ms(r,n,e,i.opts.ownProperties),()=>{t.setParams({missingProperty:(0,qe._)`${e}`},!0),t.error()})}Oe.checkReportMissingProp=dm;function hm({gen:t,data:e,it:{opts:r}},n,i){return(0,qe.or)(...n.map(s=>(0,qe.and)(Ms(t,e,s,r.ownProperties),(0,qe._)`${i} = ${s}`)))}Oe.checkMissingProp=hm;function pm(t,e){t.setParams({missingProperty:e},!0),t.error()}Oe.reportMissingProp=pm;function yf(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,qe._)`Object.prototype.hasOwnProperty`})}Oe.hasPropFunc=yf;function Ls(t,e,r){return(0,qe._)`${yf(t)}.call(${e}, ${r})`}Oe.isOwnProperty=Ls;function mm(t,e,r,n){let i=(0,qe._)`${e}${(0,qe.getProperty)(r)} !== undefined`;return n?(0,qe._)`${i} && ${Ls(t,e,r)}`:i}Oe.propertyInData=mm;function Ms(t,e,r,n){let i=(0,qe._)`${e}${(0,qe.getProperty)(r)} === undefined`;return n?(0,qe.or)(i,(0,qe.not)(Ls(t,e,r))):i}Oe.noPropertyInData=Ms;function gf(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}Oe.allSchemaProperties=gf;function vm(t,e){return gf(e).filter(r=>!(0,Bs.alwaysValidSchema)(t,e[r]))}Oe.schemaProperties=vm;function ym({schemaCode:t,data:e,it:{gen:r,topSchemaRef:n,schemaPath:i,errorPath:s},it:o},a,c,d){let m=d?(0,qe._)`${t}, ${e}, ${n}${i}`:e,f=[[zt.default.instancePath,(0,qe.strConcat)(zt.default.instancePath,s)],[zt.default.parentData,o.parentData],[zt.default.parentDataProperty,o.parentDataProperty],[zt.default.rootData,zt.default.rootData]];o.opts.dynamicRef&&f.push([zt.default.dynamicAnchors,zt.default.dynamicAnchors]);let g=(0,qe._)`${m}, ${r.object(...f)}`;return c!==qe.nil?(0,qe._)`${a}.call(${c}, ${g})`:(0,qe._)`${a}(${g})`}Oe.callValidateCode=ym;var gm=(0,qe._)`new RegExp`;function _m({gen:t,it:{opts:e}},r){let n=e.unicodeRegExp?"u":"",{regExp:i}=e.code,s=i(r,n);return t.scopeValue("pattern",{key:s.toString(),ref:s,code:(0,qe._)`${i.code==="new RegExp"?gm:(0,lm.useFunc)(t,i)}(${r}, ${n})`})}Oe.usePattern=_m;function wm(t){let{gen:e,data:r,keyword:n,it:i}=t,s=e.name("valid");if(i.allErrors){let a=e.let("valid",!0);return o(()=>e.assign(a,!1)),a}return e.var(s,!0),o(()=>e.break()),s;function o(a){let c=e.const("len",(0,qe._)`${r}.length`);e.forRange("i",0,c,d=>{t.subschema({keyword:n,dataProp:d,dataPropType:Bs.Type.Num},s),e.if((0,qe.not)(s),a)})}}Oe.validateArray=wm;function bm(t){let{gen:e,schema:r,keyword:n,it:i}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,Bs.alwaysValidSchema)(i,c))&&!i.opts.unevaluated)return;let o=e.let("valid",!1),a=e.name("_valid");e.block(()=>r.forEach((c,d)=>{let m=t.subschema({keyword:n,schemaProp:d,compositeRule:!0},a);e.assign(o,(0,qe._)`${o} || ${a}`),t.mergeValidEvaluated(m,a)||e.if((0,qe.not)(o))})),t.result(o,()=>t.reset(),()=>t.error(!0))}Oe.validateUnion=bm});var bf=Y(St=>{"use strict";I();R();T();Object.defineProperty(St,"__esModule",{value:!0});St.validateKeywordUsage=St.validSchemaType=St.funcKeywordCode=St.macroKeywordCode=void 0;var tt=pe(),ur=Dt(),Em=lt(),$m=cn();function Sm(t,e){let{gen:r,keyword:n,schema:i,parentSchema:s,it:o}=t,a=e.macro.call(o.self,i,s,o),c=wf(r,n,a);o.opts.validateSchema!==!1&&o.self.validateSchema(a,!0);let d=r.name("valid");t.subschema({schema:a,schemaPath:tt.nil,errSchemaPath:`${o.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},d),t.pass(d,()=>t.error(!0))}St.macroKeywordCode=Sm;function Pm(t,e){var r;let{gen:n,keyword:i,schema:s,parentSchema:o,$data:a,it:c}=t;Am(c,e);let d=!a&&e.compile?e.compile.call(c.self,s,o,c):e.validate,m=wf(n,i,d),f=n.let("valid");t.block$data(f,g),t.ok((r=e.valid)!==null&&r!==void 0?r:f);function g(){if(e.errors===!1)P(),e.modifying&&_f(t),S(()=>t.error());else{let y=e.async?_():b();e.modifying&&_f(t),S(()=>Om(t,y))}}function _(){let y=n.let("ruleErrs",null);return n.try(()=>P((0,tt._)`await `),w=>n.assign(f,!1).if((0,tt._)`${w} instanceof ${c.ValidationError}`,()=>n.assign(y,(0,tt._)`${w}.errors`),()=>n.throw(w))),y}function b(){let y=(0,tt._)`${m}.errors`;return n.assign(y,null),P(tt.nil),y}function P(y=e.async?(0,tt._)`await `:tt.nil){let w=c.opts.passContext?ur.default.this:ur.default.self,p=!("compile"in e&&!a||e.schema===!1);n.assign(f,(0,tt._)`${y}${(0,Em.callValidateCode)(t,m,w,p)}`,e.modifying)}function S(y){var w;n.if((0,tt.not)((w=e.valid)!==null&&w!==void 0?w:f),y)}}St.funcKeywordCode=Pm;function _f(t){let{gen:e,data:r,it:n}=t;e.if(n.parentData,()=>e.assign(r,(0,tt._)`${n.parentData}[${n.parentDataProperty}]`))}function Om(t,e){let{gen:r}=t;r.if((0,tt._)`Array.isArray(${e})`,()=>{r.assign(ur.default.vErrors,(0,tt._)`${ur.default.vErrors} === null ? ${e} : ${ur.default.vErrors}.concat(${e})`).assign(ur.default.errors,(0,tt._)`${ur.default.vErrors}.length`),(0,$m.extendErrors)(t)},()=>t.error())}function Am({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function wf(t,e,r){if(r===void 0)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,tt.stringify)(r)})}function Im(t,e,r=!1){return!e.length||e.some(n=>n==="array"?Array.isArray(t):n==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==n||r&&typeof t>"u")}St.validSchemaType=Im;function Tm({schema:t,opts:e,self:r,errSchemaPath:n},i,s){if(Array.isArray(i.keyword)?!i.keyword.includes(s):i.keyword!==s)throw new Error("ajv implementation error");let o=i.dependencies;if(o?.some(a=>!Object.prototype.hasOwnProperty.call(t,a)))throw new Error(`parent schema must have dependencies of ${s}: ${o.join(",")}`);if(i.validateSchema&&!i.validateSchema(t[s])){let c=`keyword "${s}" value is invalid at path "${n}": `+r.errorsText(i.validateSchema.errors);if(e.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}St.validateKeywordUsage=Tm});var $f=Y(Vt=>{"use strict";I();R();T();Object.defineProperty(Vt,"__esModule",{value:!0});Vt.extendSubschemaMode=Vt.extendSubschemaData=Vt.getSubschema=void 0;var Pt=pe(),Ef=be();function Rm(t,{keyword:e,schemaProp:r,schema:n,schemaPath:i,errSchemaPath:s,topSchemaRef:o}){if(e!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){let a=t.schema[e];return r===void 0?{schema:a,schemaPath:(0,Pt._)`${t.schemaPath}${(0,Pt.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:a[r],schemaPath:(0,Pt._)`${t.schemaPath}${(0,Pt.getProperty)(e)}${(0,Pt.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,Ef.escapeFragment)(r)}`}}if(n!==void 0){if(i===void 0||s===void 0||o===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:i,topSchemaRef:o,errSchemaPath:s}}throw new Error('either "keyword" or "schema" must be passed')}Vt.getSubschema=Rm;function qm(t,e,{dataProp:r,dataPropType:n,data:i,dataTypes:s,propertyName:o}){if(i!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=e;if(r!==void 0){let{errorPath:d,dataPathArr:m,opts:f}=e,g=a.let("data",(0,Pt._)`${e.data}${(0,Pt.getProperty)(r)}`,!0);c(g),t.errorPath=(0,Pt.str)`${d}${(0,Ef.getErrorPath)(r,n,f.jsPropertySyntax)}`,t.parentDataProperty=(0,Pt._)`${r}`,t.dataPathArr=[...m,t.parentDataProperty]}if(i!==void 0){let d=i instanceof Pt.Name?i:a.let("data",i,!0);c(d),o!==void 0&&(t.propertyName=o)}s&&(t.dataTypes=s);function c(d){t.data=d,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,d]}}Vt.extendSubschemaData=qm;function Cm(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:n,createErrors:i,allErrors:s}){n!==void 0&&(t.compositeRule=n),i!==void 0&&(t.createErrors=i),s!==void 0&&(t.allErrors=s),t.jtdDiscriminator=e,t.jtdMetadata=r}Vt.extendSubschemaMode=Cm});var Us=Y((wE,Sf)=>{"use strict";I();R();T();Sf.exports=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var n,i,s;if(Array.isArray(e)){if(n=e.length,n!=r.length)return!1;for(i=n;i--!==0;)if(!t(e[i],r[i]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(s=Object.keys(e),n=s.length,n!==Object.keys(r).length)return!1;for(i=n;i--!==0;)if(!Object.prototype.hasOwnProperty.call(r,s[i]))return!1;for(i=n;i--!==0;){var o=s[i];if(!t(e[o],r[o]))return!1}return!0}return e!==e&&r!==r}});var Of=Y((SE,Pf)=>{"use strict";I();R();T();var Jt=Pf.exports=function(t,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var n=typeof r=="function"?r:r.pre||function(){},i=r.post||function(){};ti(e,n,i,t,"",t)};Jt.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Jt.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Jt.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Jt.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function ti(t,e,r,n,i,s,o,a,c,d){if(n&&typeof n=="object"&&!Array.isArray(n)){e(n,i,s,o,a,c,d);for(var m in n){var f=n[m];if(Array.isArray(f)){if(m in Jt.arrayKeywords)for(var g=0;g<f.length;g++)ti(t,e,r,f[g],i+"/"+m+"/"+g,s,i,m,n,g)}else if(m in Jt.propsKeywords){if(f&&typeof f=="object")for(var _ in f)ti(t,e,r,f[_],i+"/"+m+"/"+km(_),s,i,m,n,_)}else(m in Jt.keywords||t.allKeys&&!(m in Jt.skipKeywords))&&ti(t,e,r,f,i+"/"+m,s,i,m,n)}r(n,i,s,o,a,c,d)}}function km(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}});var ln=Y(ot=>{"use strict";I();R();T();Object.defineProperty(ot,"__esModule",{value:!0});ot.getSchemaRefs=ot.resolveUrl=ot.normalizeId=ot._getFullPath=ot.getFullPath=ot.inlineRef=void 0;var xm=be(),Nm=Us(),jm=Of(),Dm=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function Bm(t,e=!0){return typeof t=="boolean"?!0:e===!0?!Gs(t):e?Af(t)<=e:!1}ot.inlineRef=Bm;var Lm=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Gs(t){for(let e in t){if(Lm.has(e))return!0;let r=t[e];if(Array.isArray(r)&&r.some(Gs)||typeof r=="object"&&Gs(r))return!0}return!1}function Af(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!Dm.has(r)&&(typeof t[r]=="object"&&(0,xm.eachItem)(t[r],n=>e+=Af(n)),e===1/0))return 1/0}return e}function If(t,e="",r){r!==!1&&(e=xr(e));let n=t.parse(e);return Tf(t,n)}ot.getFullPath=If;function Tf(t,e){return t.serialize(e).split("#")[0]+"#"}ot._getFullPath=Tf;var Mm=/#\/?$/;function xr(t){return t?t.replace(Mm,""):""}ot.normalizeId=xr;function Um(t,e,r){return r=xr(r),t.resolve(e,r)}ot.resolveUrl=Um;var Gm=/^[a-z_][-a-z0-9._]*$/i;function Fm(t,e){if(typeof t=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,i=xr(t[r]||e),s={"":i},o=If(n,i,!1),a={},c=new Set;return jm(t,{allKeys:!0},(f,g,_,b)=>{if(b===void 0)return;let P=o+g,S=s[b];typeof f[r]=="string"&&(S=y.call(this,f[r])),w.call(this,f.$anchor),w.call(this,f.$dynamicAnchor),s[g]=S;function y(p){let h=this.opts.uriResolver.resolve;if(p=xr(S?h(S,p):p),c.has(p))throw m(p);c.add(p);let v=this.refs[p];return typeof v=="string"&&(v=this.refs[v]),typeof v=="object"?d(f,v.schema,p):p!==xr(P)&&(p[0]==="#"?(d(f,a[p],p),a[p]=f):this.refs[p]=P),p}function w(p){if(typeof p=="string"){if(!Gm.test(p))throw new Error(`invalid anchor "${p}"`);y.call(this,`#${p}`)}}}),a;function d(f,g,_){if(g!==void 0&&!Nm(f,g))throw m(_)}function m(f){return new Error(`reference "${f}" resolves to more than one schema`)}}ot.getSchemaRefs=Fm});var ii=Y(Ht=>{"use strict";I();R();T();Object.defineProperty(Ht,"__esModule",{value:!0});Ht.getData=Ht.KeywordCxt=Ht.validateFunctionCode=void 0;var xf=cf(),Rf=fn(),Ks=xs(),ri=fn(),Km=vf(),hn=bf(),Fs=$f(),te=pe(),se=Dt(),zm=ln(),Bt=be(),dn=cn();function Vm(t){if(Df(t)&&(Bf(t),jf(t))){Wm(t);return}Nf(t,()=>(0,xf.topBoolOrEmptySchema)(t))}Ht.validateFunctionCode=Vm;function Nf({gen:t,validateName:e,schema:r,schemaEnv:n,opts:i},s){i.code.es5?t.func(e,(0,te._)`${se.default.data}, ${se.default.valCxt}`,n.$async,()=>{t.code((0,te._)`"use strict"; ${qf(r,i)}`),Hm(t,i),t.code(s)}):t.func(e,(0,te._)`${se.default.data}, ${Jm(i)}`,n.$async,()=>t.code(qf(r,i)).code(s))}function Jm(t){return(0,te._)`{${se.default.instancePath}="", ${se.default.parentData}, ${se.default.parentDataProperty}, ${se.default.rootData}=${se.default.data}${t.dynamicRef?(0,te._)`, ${se.default.dynamicAnchors}={}`:te.nil}}={}`}function Hm(t,e){t.if(se.default.valCxt,()=>{t.var(se.default.instancePath,(0,te._)`${se.default.valCxt}.${se.default.instancePath}`),t.var(se.default.parentData,(0,te._)`${se.default.valCxt}.${se.default.parentData}`),t.var(se.default.parentDataProperty,(0,te._)`${se.default.valCxt}.${se.default.parentDataProperty}`),t.var(se.default.rootData,(0,te._)`${se.default.valCxt}.${se.default.rootData}`),e.dynamicRef&&t.var(se.default.dynamicAnchors,(0,te._)`${se.default.valCxt}.${se.default.dynamicAnchors}`)},()=>{t.var(se.default.instancePath,(0,te._)`""`),t.var(se.default.parentData,(0,te._)`undefined`),t.var(se.default.parentDataProperty,(0,te._)`undefined`),t.var(se.default.rootData,se.default.data),e.dynamicRef&&t.var(se.default.dynamicAnchors,(0,te._)`{}`)})}function Wm(t){let{schema:e,opts:r,gen:n}=t;Nf(t,()=>{r.$comment&&e.$comment&&Mf(t),ev(t),n.let(se.default.vErrors,null),n.let(se.default.errors,0),r.unevaluated&&Qm(t),Lf(t),nv(t)})}function Qm(t){let{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",(0,te._)`${r}.evaluated`),e.if((0,te._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,te._)`${t.evaluated}.props`,(0,te._)`undefined`)),e.if((0,te._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,te._)`${t.evaluated}.items`,(0,te._)`undefined`))}function qf(t,e){let r=typeof t=="object"&&t[e.schemaId];return r&&(e.code.source||e.code.process)?(0,te._)`/*# sourceURL=${r} */`:te.nil}function Ym(t,e){if(Df(t)&&(Bf(t),jf(t))){Xm(t,e);return}(0,xf.boolOrEmptySchema)(t,e)}function jf({schema:t,self:e}){if(typeof t=="boolean")return!t;for(let r in t)if(e.RULES.all[r])return!0;return!1}function Df(t){return typeof t.schema!="boolean"}function Xm(t,e){let{schema:r,gen:n,opts:i}=t;i.$comment&&r.$comment&&Mf(t),tv(t),rv(t);let s=n.const("_errs",se.default.errors);Lf(t,s),n.var(e,(0,te._)`${s} === ${se.default.errors}`)}function Bf(t){(0,Bt.checkUnknownRules)(t),Zm(t)}function Lf(t,e){if(t.opts.jtd)return Cf(t,[],!1,e);let r=(0,Rf.getSchemaTypes)(t.schema),n=(0,Rf.coerceAndCheckDataType)(t,r);Cf(t,r,!n,e)}function Zm(t){let{schema:e,errSchemaPath:r,opts:n,self:i}=t;e.$ref&&n.ignoreKeywordsWithRef&&(0,Bt.schemaHasRulesButRef)(e,i.RULES)&&i.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function ev(t){let{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,Bt.checkStrictMode)(t,"default is ignored in the schema root")}function tv(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,zm.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function rv(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function Mf({gen:t,schemaEnv:e,schema:r,errSchemaPath:n,opts:i}){let s=r.$comment;if(i.$comment===!0)t.code((0,te._)`${se.default.self}.logger.log(${s})`);else if(typeof i.$comment=="function"){let o=(0,te.str)`${n}/$comment`,a=t.scopeValue("root",{ref:e.root});t.code((0,te._)`${se.default.self}.opts.$comment(${s}, ${o}, ${a}.schema)`)}}function nv(t){let{gen:e,schemaEnv:r,validateName:n,ValidationError:i,opts:s}=t;r.$async?e.if((0,te._)`${se.default.errors} === 0`,()=>e.return(se.default.data),()=>e.throw((0,te._)`new ${i}(${se.default.vErrors})`)):(e.assign((0,te._)`${n}.errors`,se.default.vErrors),s.unevaluated&&iv(t),e.return((0,te._)`${se.default.errors} === 0`))}function iv({gen:t,evaluated:e,props:r,items:n}){r instanceof te.Name&&t.assign((0,te._)`${e}.props`,r),n instanceof te.Name&&t.assign((0,te._)`${e}.items`,n)}function Cf(t,e,r,n){let{gen:i,schema:s,data:o,allErrors:a,opts:c,self:d}=t,{RULES:m}=d;if(s.$ref&&(c.ignoreKeywordsWithRef||!(0,Bt.schemaHasRulesButRef)(s,m))){i.block(()=>Gf(t,"$ref",m.all.$ref.definition));return}c.jtd||sv(t,e),i.block(()=>{for(let g of m.rules)f(g);f(m.post)});function f(g){(0,Ks.shouldUseGroup)(s,g)&&(g.type?(i.if((0,ri.checkDataType)(g.type,o,c.strictNumbers)),kf(t,g),e.length===1&&e[0]===g.type&&r&&(i.else(),(0,ri.reportTypeError)(t)),i.endIf()):kf(t,g),a||i.if((0,te._)`${se.default.errors} === ${n||0}`))}}function kf(t,e){let{gen:r,schema:n,opts:{useDefaults:i}}=t;i&&(0,Km.assignDefaults)(t,e.type),r.block(()=>{for(let s of e.rules)(0,Ks.shouldUseRule)(n,s)&&Gf(t,s.keyword,s.definition,e.type)})}function sv(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(ov(t,e),t.opts.allowUnionTypes||av(t,e),uv(t,t.dataTypes))}function ov(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{Uf(t.dataTypes,r)||zs(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),fv(t,e)}}function av(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&zs(t,"use allowUnionTypes to allow union type keyword")}function uv(t,e){let r=t.self.RULES.all;for(let n in r){let i=r[n];if(typeof i=="object"&&(0,Ks.shouldUseRule)(t.schema,i)){let{type:s}=i.definition;s.length&&!s.some(o=>cv(e,o))&&zs(t,`missing type "${s.join(",")}" for keyword "${n}"`)}}}function cv(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function Uf(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function fv(t,e){let r=[];for(let n of t.dataTypes)Uf(e,n)?r.push(n):e.includes("integer")&&n==="number"&&r.push("integer");t.dataTypes=r}function zs(t,e){let r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,Bt.checkStrictMode)(t,e,t.opts.strictTypes)}var ni=class{constructor(e,r,n){if((0,hn.validateKeywordUsage)(e,r,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=r.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Bt.schemaRefOrVal)(e,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=r,this.$data)this.schemaCode=e.gen.const("vSchema",Ff(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,hn.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=e.gen.const("_errs",se.default.errors))}result(e,r,n){this.failResult((0,te.not)(e),r,n)}failResult(e,r,n){this.gen.if(e),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,r){this.failResult((0,te.not)(e),void 0,r)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:r}=this;this.fail((0,te._)`${r} !== undefined && (${(0,te.or)(this.invalid$data(),e)})`)}error(e,r,n){if(r){this.setParams(r),this._error(e,n),this.setParams({});return}this._error(e,n)}_error(e,r){(e?dn.reportExtraError:dn.reportError)(this,this.def.error,r)}$dataError(){(0,dn.reportError)(this,this.def.$dataError||dn.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,dn.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,r){r?Object.assign(this.params,e):this.params=e}block$data(e,r,n=te.nil){this.gen.block(()=>{this.check$data(e,n),r()})}check$data(e=te.nil,r=te.nil){if(!this.$data)return;let{gen:n,schemaCode:i,schemaType:s,def:o}=this;n.if((0,te.or)((0,te._)`${i} === undefined`,r)),e!==te.nil&&n.assign(e,!0),(s.length||o.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==te.nil&&n.assign(e,!1)),n.else()}invalid$data(){let{gen:e,schemaCode:r,schemaType:n,def:i,it:s}=this;return(0,te.or)(o(),a());function o(){if(n.length){if(!(r instanceof te.Name))throw new Error("ajv implementation error");let c=Array.isArray(n)?n:[n];return(0,te._)`${(0,ri.checkDataTypes)(c,r,s.opts.strictNumbers,ri.DataType.Wrong)}`}return te.nil}function a(){if(i.validateSchema){let c=e.scopeValue("validate$data",{ref:i.validateSchema});return(0,te._)`!${c}(${r})`}return te.nil}}subschema(e,r){let n=(0,Fs.getSubschema)(this.it,e);(0,Fs.extendSubschemaData)(n,this.it,e),(0,Fs.extendSubschemaMode)(n,e);let i={...this.it,...n,items:void 0,props:void 0};return Ym(i,r),i}mergeEvaluated(e,r){let{it:n,gen:i}=this;n.opts.unevaluated&&(n.props!==!0&&e.props!==void 0&&(n.props=Bt.mergeEvaluated.props(i,e.props,n.props,r)),n.items!==!0&&e.items!==void 0&&(n.items=Bt.mergeEvaluated.items(i,e.items,n.items,r)))}mergeValidEvaluated(e,r){let{it:n,gen:i}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return i.if(r,()=>this.mergeEvaluated(e,te.Name)),!0}};Ht.KeywordCxt=ni;function Gf(t,e,r,n){let i=new ni(t,r,e);"code"in r?r.code(i,n):i.$data&&r.validate?(0,hn.funcKeywordCode)(i,r):"macro"in r?(0,hn.macroKeywordCode)(i,r):(r.compile||r.validate)&&(0,hn.funcKeywordCode)(i,r)}var lv=/^\/(?:[^~]|~0|~1)*$/,dv=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Ff(t,{dataLevel:e,dataNames:r,dataPathArr:n}){let i,s;if(t==="")return se.default.rootData;if(t[0]==="/"){if(!lv.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);i=t,s=se.default.rootData}else{let d=dv.exec(t);if(!d)throw new Error(`Invalid JSON-pointer: ${t}`);let m=+d[1];if(i=d[2],i==="#"){if(m>=e)throw new Error(c("property/index",m));return n[e-m]}if(m>e)throw new Error(c("data",m));if(s=r[e-m],!i)return s}let o=s,a=i.split("/");for(let d of a)d&&(s=(0,te._)`${s}${(0,te.getProperty)((0,Bt.unescapeJsonPointer)(d))}`,o=(0,te._)`${o} && ${s}`);return o;function c(d,m){return`Cannot access ${d} ${m} levels up, current level is ${e}`}}Ht.getData=Ff});var Hs=Y(Js=>{"use strict";I();R();T();Object.defineProperty(Js,"__esModule",{value:!0});var Vs=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};Js.default=Vs});var si=Y(Ys=>{"use strict";I();R();T();Object.defineProperty(Ys,"__esModule",{value:!0});var Ws=ln(),Qs=class extends Error{constructor(e,r,n,i){super(i||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,Ws.resolveUrl)(e,r,n),this.missingSchema=(0,Ws.normalizeId)((0,Ws.getFullPath)(e,this.missingRef))}};Ys.default=Qs});var ai=Y(dt=>{"use strict";I();R();T();Object.defineProperty(dt,"__esModule",{value:!0});dt.resolveSchema=dt.getCompilingSchema=dt.resolveRef=dt.compileSchema=dt.SchemaEnv=void 0;var gt=pe(),hv=Hs(),cr=Dt(),_t=ln(),Kf=be(),pv=ii(),Nr=class{constructor(e){var r;this.refs={},this.dynamicAnchors={};let n;typeof e.schema=="object"&&(n=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(r=e.baseId)!==null&&r!==void 0?r:(0,_t.normalizeId)(n?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=n?.$async,this.refs={}}};dt.SchemaEnv=Nr;function Zs(t){let e=zf.call(this,t);if(e)return e;let r=(0,_t.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:n,lines:i}=this.opts.code,{ownProperties:s}=this.opts,o=new gt.CodeGen(this.scope,{es5:n,lines:i,ownProperties:s}),a;t.$async&&(a=o.scopeValue("Error",{ref:hv.default,code:(0,gt._)`require("ajv/dist/runtime/validation_error").default`}));let c=o.scopeName("validate");t.validateName=c;let d={gen:o,allErrors:this.opts.allErrors,data:cr.default.data,parentData:cr.default.parentData,parentDataProperty:cr.default.parentDataProperty,dataNames:[cr.default.data],dataPathArr:[gt.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:o.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,gt.stringify)(t.schema)}:{ref:t.schema}),validateName:c,ValidationError:a,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:gt.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,gt._)`""`,opts:this.opts,self:this},m;try{this._compilations.add(t),(0,pv.validateFunctionCode)(d),o.optimize(this.opts.code.optimize);let f=o.toString();m=`${o.scopeRefs(cr.default.scope)}return ${f}`,this.opts.code.process&&(m=this.opts.code.process(m,t));let _=new Function(`${cr.default.self}`,`${cr.default.scope}`,m)(this,this.scope.get());if(this.scope.value(c,{ref:_}),_.errors=null,_.schema=t.schema,_.schemaEnv=t,t.$async&&(_.$async=!0),this.opts.code.source===!0&&(_.source={validateName:c,validateCode:f,scopeValues:o._values}),this.opts.unevaluated){let{props:b,items:P}=d;_.evaluated={props:b instanceof gt.Name?void 0:b,items:P instanceof gt.Name?void 0:P,dynamicProps:b instanceof gt.Name,dynamicItems:P instanceof gt.Name},_.source&&(_.source.evaluated=(0,gt.stringify)(_.evaluated))}return t.validate=_,t}catch(f){throw delete t.validate,delete t.validateName,m&&this.logger.error("Error compiling schema, function code:",m),f}finally{this._compilations.delete(t)}}dt.compileSchema=Zs;function mv(t,e,r){var n;r=(0,_t.resolveUrl)(this.opts.uriResolver,e,r);let i=t.refs[r];if(i)return i;let s=gv.call(this,t,r);if(s===void 0){let o=(n=t.localRefs)===null||n===void 0?void 0:n[r],{schemaId:a}=this.opts;o&&(s=new Nr({schema:o,schemaId:a,root:t,baseId:e}))}if(s!==void 0)return t.refs[r]=vv.call(this,s)}dt.resolveRef=mv;function vv(t){return(0,_t.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:Zs.call(this,t)}function zf(t){for(let e of this._compilations)if(yv(e,t))return e}dt.getCompilingSchema=zf;function yv(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function gv(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||oi.call(this,t,e)}function oi(t,e){let r=this.opts.uriResolver.parse(e),n=(0,_t._getFullPath)(this.opts.uriResolver,r),i=(0,_t.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&n===i)return Xs.call(this,r,t);let s=(0,_t.normalizeId)(n),o=this.refs[s]||this.schemas[s];if(typeof o=="string"){let a=oi.call(this,t,o);return typeof a?.schema!="object"?void 0:Xs.call(this,r,a)}if(typeof o?.schema=="object"){if(o.validate||Zs.call(this,o),s===(0,_t.normalizeId)(e)){let{schema:a}=o,{schemaId:c}=this.opts,d=a[c];return d&&(i=(0,_t.resolveUrl)(this.opts.uriResolver,i,d)),new Nr({schema:a,schemaId:c,root:t,baseId:i})}return Xs.call(this,r,o)}}dt.resolveSchema=oi;var _v=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function Xs(t,{baseId:e,schema:r,root:n}){var i;if(((i=t.fragment)===null||i===void 0?void 0:i[0])!=="/")return;for(let a of t.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,Kf.unescapeFragment)(a)];if(c===void 0)return;r=c;let d=typeof r=="object"&&r[this.opts.schemaId];!_v.has(a)&&d&&(e=(0,_t.resolveUrl)(this.opts.uriResolver,e,d))}let s;if(typeof r!="boolean"&&r.$ref&&!(0,Kf.schemaHasRulesButRef)(r,this.RULES)){let a=(0,_t.resolveUrl)(this.opts.uriResolver,e,r.$ref);s=oi.call(this,n,a)}let{schemaId:o}=this.opts;if(s=s||new Nr({schema:r,schemaId:o,root:n,baseId:e}),s.schema!==s.root.schema)return s}});var Vf=Y((HE,wv)=>{wv.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var Hf=Y((WE,Jf)=>{"use strict";I();R();T();var bv={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};Jf.exports={HEX:bv}});var rl=Y((ZE,tl)=>{"use strict";I();R();T();var{HEX:Ev}=Hf(),$v=/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u;function Xf(t){if(el(t,".")<3)return{host:t,isIPV4:!1};let e=t.match($v)||[],[r]=e;return r?{host:Pv(r,"."),isIPV4:!0}:{host:t,isIPV4:!1}}function eo(t,e=!1){let r="",n=!0;for(let i of t){if(Ev[i]===void 0)return;i!=="0"&&n===!0&&(n=!1),n||(r+=i)}return e&&r.length===0&&(r="0"),r}function Sv(t){let e=0,r={error:!1,address:"",zone:""},n=[],i=[],s=!1,o=!1,a=!1;function c(){if(i.length){if(s===!1){let d=eo(i);if(d!==void 0)n.push(d);else return r.error=!0,!1}i.length=0}return!0}for(let d=0;d<t.length;d++){let m=t[d];if(!(m==="["||m==="]"))if(m===":"){if(o===!0&&(a=!0),!c())break;if(e++,n.push(":"),e>7){r.error=!0;break}d-1>=0&&t[d-1]===":"&&(o=!0);continue}else if(m==="%"){if(!c())break;s=!0}else{i.push(m);continue}}return i.length&&(s?r.zone=i.join(""):a?n.push(i.join("")):n.push(eo(i))),r.address=n.join(""),r}function Zf(t){if(el(t,":")<2)return{host:t,isIPV6:!1};let e=Sv(t);if(e.error)return{host:t,isIPV6:!1};{let r=e.address,n=e.address;return e.zone&&(r+="%"+e.zone,n+="%25"+e.zone),{host:r,escapedHost:n,isIPV6:!0}}}function Pv(t,e){let r="",n=!0,i=t.length;for(let s=0;s<i;s++){let o=t[s];o==="0"&&n?(s+1<=i&&t[s+1]===e||s+1===i)&&(r+=o,n=!1):(o===e?n=!0:n=!1,r+=o)}return r}function el(t,e){let r=0;for(let n=0;n<t.length;n++)t[n]===e&&r++;return r}var Wf=/^\.\.?\//u,Qf=/^\/\.(?:\/|$)/u,Yf=/^\/\.\.(?:\/|$)/u,Ov=/^\/?(?:.|\n)*?(?=\/|$)/u;function Av(t){let e=[];for(;t.length;)if(t.match(Wf))t=t.replace(Wf,"");else if(t.match(Qf))t=t.replace(Qf,"/");else if(t.match(Yf))t=t.replace(Yf,"/"),e.pop();else if(t==="."||t==="..")t="";else{let r=t.match(Ov);if(r){let n=r[0];t=t.slice(n.length),e.push(n)}else throw new Error("Unexpected dot segment condition")}return e.join("")}function Iv(t,e){let r=e!==!0?escape:unescape;return t.scheme!==void 0&&(t.scheme=r(t.scheme)),t.userinfo!==void 0&&(t.userinfo=r(t.userinfo)),t.host!==void 0&&(t.host=r(t.host)),t.path!==void 0&&(t.path=r(t.path)),t.query!==void 0&&(t.query=r(t.query)),t.fragment!==void 0&&(t.fragment=r(t.fragment)),t}function Tv(t){let e=[];if(t.userinfo!==void 0&&(e.push(t.userinfo),e.push("@")),t.host!==void 0){let r=unescape(t.host),n=Xf(r);if(n.isIPV4)r=n.host;else{let i=Zf(n.host);i.isIPV6===!0?r=`[${i.escapedHost}]`:r=t.host}e.push(r)}return(typeof t.port=="number"||typeof t.port=="string")&&(e.push(":"),e.push(String(t.port))),e.length?e.join(""):void 0}tl.exports={recomposeAuthority:Tv,normalizeComponentEncoding:Iv,removeDotSegments:Av,normalizeIPv4:Xf,normalizeIPv6:Zf,stringArrayToHexStripped:eo}});var ul=Y((n$,al)=>{"use strict";I();R();T();var Rv=/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu,qv=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;function nl(t){return typeof t.secure=="boolean"?t.secure:String(t.scheme).toLowerCase()==="wss"}function il(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function sl(t){let e=String(t.scheme).toLowerCase()==="https";return(t.port===(e?443:80)||t.port==="")&&(t.port=void 0),t.path||(t.path="/"),t}function Cv(t){return t.secure=nl(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function kv(t){if((t.port===(nl(t)?443:80)||t.port==="")&&(t.port=void 0),typeof t.secure=="boolean"&&(t.scheme=t.secure?"wss":"ws",t.secure=void 0),t.resourceName){let[e,r]=t.resourceName.split("?");t.path=e&&e!=="/"?e:void 0,t.query=r,t.resourceName=void 0}return t.fragment=void 0,t}function xv(t,e){if(!t.path)return t.error="URN can not be parsed",t;let r=t.path.match(qv);if(r){let n=e.scheme||t.scheme||"urn";t.nid=r[1].toLowerCase(),t.nss=r[2];let i=`${n}:${e.nid||t.nid}`,s=to[i];t.path=void 0,s&&(t=s.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function Nv(t,e){let r=e.scheme||t.scheme||"urn",n=t.nid.toLowerCase(),i=`${r}:${e.nid||n}`,s=to[i];s&&(t=s.serialize(t,e));let o=t,a=t.nss;return o.path=`${n||e.nid}:${a}`,e.skipEscape=!0,o}function jv(t,e){let r=t;return r.uuid=r.nss,r.nss=void 0,!e.tolerant&&(!r.uuid||!Rv.test(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function Dv(t){let e=t;return e.nss=(t.uuid||"").toLowerCase(),e}var ol={scheme:"http",domainHost:!0,parse:il,serialize:sl},Bv={scheme:"https",domainHost:ol.domainHost,parse:il,serialize:sl},ui={scheme:"ws",domainHost:!0,parse:Cv,serialize:kv},Lv={scheme:"wss",domainHost:ui.domainHost,parse:ui.parse,serialize:ui.serialize},Mv={scheme:"urn",parse:xv,serialize:Nv,skipNormalize:!0},Uv={scheme:"urn:uuid",parse:jv,serialize:Dv,skipNormalize:!0},to={http:ol,https:Bv,ws:ui,wss:Lv,urn:Mv,"urn:uuid":Uv};al.exports=to});var fl=Y((a$,fi)=>{"use strict";I();R();T();var{normalizeIPv6:Gv,normalizeIPv4:Fv,removeDotSegments:pn,recomposeAuthority:Kv,normalizeComponentEncoding:ci}=rl(),ro=ul();function zv(t,e){return typeof t=="string"?t=Ot(Lt(t,e),e):typeof t=="object"&&(t=Lt(Ot(t,e),e)),t}function Vv(t,e,r){let n=Object.assign({scheme:"null"},r),i=cl(Lt(t,n),Lt(e,n),n,!0);return Ot(i,{...n,skipEscape:!0})}function cl(t,e,r,n){let i={};return n||(t=Lt(Ot(t,r),r),e=Lt(Ot(e,r),r)),r=r||{},!r.tolerant&&e.scheme?(i.scheme=e.scheme,i.userinfo=e.userinfo,i.host=e.host,i.port=e.port,i.path=pn(e.path||""),i.query=e.query):(e.userinfo!==void 0||e.host!==void 0||e.port!==void 0?(i.userinfo=e.userinfo,i.host=e.host,i.port=e.port,i.path=pn(e.path||""),i.query=e.query):(e.path?(e.path.charAt(0)==="/"?i.path=pn(e.path):((t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)&&!t.path?i.path="/"+e.path:t.path?i.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+e.path:i.path=e.path,i.path=pn(i.path)),i.query=e.query):(i.path=t.path,e.query!==void 0?i.query=e.query:i.query=t.query),i.userinfo=t.userinfo,i.host=t.host,i.port=t.port),i.scheme=t.scheme),i.fragment=e.fragment,i}function Jv(t,e,r){return typeof t=="string"?(t=unescape(t),t=Ot(ci(Lt(t,r),!0),{...r,skipEscape:!0})):typeof t=="object"&&(t=Ot(ci(t,!0),{...r,skipEscape:!0})),typeof e=="string"?(e=unescape(e),e=Ot(ci(Lt(e,r),!0),{...r,skipEscape:!0})):typeof e=="object"&&(e=Ot(ci(e,!0),{...r,skipEscape:!0})),t.toLowerCase()===e.toLowerCase()}function Ot(t,e){let r={host:t.host,scheme:t.scheme,userinfo:t.userinfo,port:t.port,path:t.path,query:t.query,nid:t.nid,nss:t.nss,uuid:t.uuid,fragment:t.fragment,reference:t.reference,resourceName:t.resourceName,secure:t.secure,error:""},n=Object.assign({},e),i=[],s=ro[(n.scheme||r.scheme||"").toLowerCase()];s&&s.serialize&&s.serialize(r,n),r.path!==void 0&&(n.skipEscape?r.path=unescape(r.path):(r.path=escape(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),n.reference!=="suffix"&&r.scheme&&i.push(r.scheme,":");let o=Kv(r);if(o!==void 0&&(n.reference!=="suffix"&&i.push("//"),i.push(o),r.path&&r.path.charAt(0)!=="/"&&i.push("/")),r.path!==void 0){let a=r.path;!n.absolutePath&&(!s||!s.absolutePath)&&(a=pn(a)),o===void 0&&(a=a.replace(/^\/\//u,"/%2F")),i.push(a)}return r.query!==void 0&&i.push("?",r.query),r.fragment!==void 0&&i.push("#",r.fragment),i.join("")}var Hv=Array.from({length:127},(t,e)=>/[^!"$&'()*+,\-.;=_`a-z{}~]/u.test(String.fromCharCode(e)));function Wv(t){let e=0;for(let r=0,n=t.length;r<n;++r)if(e=t.charCodeAt(r),e>126||Hv[e])return!0;return!1}var Qv=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function Lt(t,e){let r=Object.assign({},e),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},i=t.indexOf("%")!==-1,s=!1;r.reference==="suffix"&&(t=(r.scheme?r.scheme+":":"")+"//"+t);let o=t.match(Qv);if(o){if(n.scheme=o[1],n.userinfo=o[3],n.host=o[4],n.port=parseInt(o[5],10),n.path=o[6]||"",n.query=o[7],n.fragment=o[8],isNaN(n.port)&&(n.port=o[5]),n.host){let c=Fv(n.host);if(c.isIPV4===!1){let d=Gv(c.host);n.host=d.host.toLowerCase(),s=d.isIPV6}else n.host=c.host,s=!0}n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&n.query===void 0&&!n.path?n.reference="same-document":n.scheme===void 0?n.reference="relative":n.fragment===void 0?n.reference="absolute":n.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==n.reference&&(n.error=n.error||"URI is not a "+r.reference+" reference.");let a=ro[(r.scheme||n.scheme||"").toLowerCase()];if(!r.unicodeSupport&&(!a||!a.unicodeSupport)&&n.host&&(r.domainHost||a&&a.domainHost)&&s===!1&&Wv(n.host))try{n.host=URL.domainToASCII(n.host.toLowerCase())}catch(c){n.error=n.error||"Host's domain name can not be converted to ASCII: "+c}(!a||a&&!a.skipNormalize)&&(i&&n.scheme!==void 0&&(n.scheme=unescape(n.scheme)),i&&n.host!==void 0&&(n.host=unescape(n.host)),n.path&&(n.path=escape(unescape(n.path))),n.fragment&&(n.fragment=encodeURI(decodeURIComponent(n.fragment)))),a&&a.parse&&a.parse(n,r)}else n.error=n.error||"URI can not be parsed.";return n}var no={SCHEMES:ro,normalize:zv,resolve:Vv,resolveComponents:cl,equal:Jv,serialize:Ot,parse:Lt};fi.exports=no;fi.exports.default=no;fi.exports.fastUri=no});var dl=Y(io=>{"use strict";I();R();T();Object.defineProperty(io,"__esModule",{value:!0});var ll=fl();ll.code='require("ajv/dist/runtime/uri").default';io.default=ll});var gn=Y(Ke=>{"use strict";I();R();T();Object.defineProperty(Ke,"__esModule",{value:!0});Ke.CodeGen=Ke.Name=Ke.nil=Ke.stringify=Ke.str=Ke._=Ke.KeywordCxt=void 0;var Yv=ii();Object.defineProperty(Ke,"KeywordCxt",{enumerable:!0,get:function(){return Yv.KeywordCxt}});var jr=pe();Object.defineProperty(Ke,"_",{enumerable:!0,get:function(){return jr._}});Object.defineProperty(Ke,"str",{enumerable:!0,get:function(){return jr.str}});Object.defineProperty(Ke,"stringify",{enumerable:!0,get:function(){return jr.stringify}});Object.defineProperty(Ke,"nil",{enumerable:!0,get:function(){return jr.nil}});Object.defineProperty(Ke,"Name",{enumerable:!0,get:function(){return jr.Name}});Object.defineProperty(Ke,"CodeGen",{enumerable:!0,get:function(){return jr.CodeGen}});var Xv=Hs(),yl=si(),Zv=ks(),mn=ai(),ey=pe(),vn=ln(),li=fn(),oo=be(),hl=Vf(),ty=dl(),gl=(t,e)=>new RegExp(t,e);gl.code="new RegExp";var ry=["removeAdditional","useDefaults","coerceTypes"],ny=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),iy={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},sy={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},pl=200;function oy(t){var e,r,n,i,s,o,a,c,d,m,f,g,_,b,P,S,y,w,p,h,v,E,C,x,j;let G=t.strict,H=(e=t.code)===null||e===void 0?void 0:e.optimize,re=H===!0||H===void 0?1:H||0,Q=(n=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:gl,Z=(i=t.uriResolver)!==null&&i!==void 0?i:ty.default;return{strictSchema:(o=(s=t.strictSchema)!==null&&s!==void 0?s:G)!==null&&o!==void 0?o:!0,strictNumbers:(c=(a=t.strictNumbers)!==null&&a!==void 0?a:G)!==null&&c!==void 0?c:!0,strictTypes:(m=(d=t.strictTypes)!==null&&d!==void 0?d:G)!==null&&m!==void 0?m:"log",strictTuples:(g=(f=t.strictTuples)!==null&&f!==void 0?f:G)!==null&&g!==void 0?g:"log",strictRequired:(b=(_=t.strictRequired)!==null&&_!==void 0?_:G)!==null&&b!==void 0?b:!1,code:t.code?{...t.code,optimize:re,regExp:Q}:{optimize:re,regExp:Q},loopRequired:(P=t.loopRequired)!==null&&P!==void 0?P:pl,loopEnum:(S=t.loopEnum)!==null&&S!==void 0?S:pl,meta:(y=t.meta)!==null&&y!==void 0?y:!0,messages:(w=t.messages)!==null&&w!==void 0?w:!0,inlineRefs:(p=t.inlineRefs)!==null&&p!==void 0?p:!0,schemaId:(h=t.schemaId)!==null&&h!==void 0?h:"$id",addUsedSchema:(v=t.addUsedSchema)!==null&&v!==void 0?v:!0,validateSchema:(E=t.validateSchema)!==null&&E!==void 0?E:!0,validateFormats:(C=t.validateFormats)!==null&&C!==void 0?C:!0,unicodeRegExp:(x=t.unicodeRegExp)!==null&&x!==void 0?x:!0,int32range:(j=t.int32range)!==null&&j!==void 0?j:!0,uriResolver:Z}}var yn=class{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...oy(e)};let{es5:r,lines:n}=this.opts.code;this.scope=new ey.ValueScope({scope:{},prefixes:ny,es5:r,lines:n}),this.logger=dy(e.logger);let i=e.validateFormats;e.validateFormats=!1,this.RULES=(0,Zv.getRules)(),ml.call(this,iy,e,"NOT SUPPORTED"),ml.call(this,sy,e,"DEPRECATED","warn"),this._metaOpts=fy.call(this),e.formats&&uy.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&cy.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),ay.call(this),e.validateFormats=i}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:n}=this.opts,i=hl;n==="id"&&(i={...hl},i.id=i.$id,delete i.$id),r&&e&&this.addMetaSchema(i,i[n],!1)}defaultMeta(){let{meta:e,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[r]||e:void 0}validate(e,r){let n;if(typeof e=="string"){if(n=this.getSchema(e),!n)throw new Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let i=n(r);return"$async"in n||(this.errors=n.errors),i}compile(e,r){let n=this._addSchema(e,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return i.call(this,e,r);async function i(m,f){await s.call(this,m.$schema);let g=this._addSchema(m,f);return g.validate||o.call(this,g)}async function s(m){m&&!this.getSchema(m)&&await i.call(this,{$ref:m},!0)}async function o(m){try{return this._compileSchemaEnv(m)}catch(f){if(!(f instanceof yl.default))throw f;return a.call(this,f),await c.call(this,f.missingSchema),o.call(this,m)}}function a({missingSchema:m,missingRef:f}){if(this.refs[m])throw new Error(`AnySchema ${m} is loaded but ${f} cannot be resolved`)}async function c(m){let f=await d.call(this,m);this.refs[m]||await s.call(this,f.$schema),this.refs[m]||this.addSchema(f,m,r)}async function d(m){let f=this._loading[m];if(f)return f;try{return await(this._loading[m]=n(m))}finally{delete this._loading[m]}}}addSchema(e,r,n,i=this.opts.validateSchema){if(Array.isArray(e)){for(let o of e)this.addSchema(o,void 0,n,i);return this}let s;if(typeof e=="object"){let{schemaId:o}=this.opts;if(s=e[o],s!==void 0&&typeof s!="string")throw new Error(`schema ${o} must be string`)}return r=(0,vn.normalizeId)(r||s),this._checkUnique(r),this.schemas[r]=this._addSchema(e,n,r,i,!0),this}addMetaSchema(e,r,n=this.opts.validateSchema){return this.addSchema(e,r,!0,n),this}validateSchema(e,r){if(typeof e=="boolean")return!0;let n;if(n=e.$schema,n!==void 0&&typeof n!="string")throw new Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let i=this.validate(n,e);if(!i&&r){let s="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(s);else throw new Error(s)}return i}getSchema(e){let r;for(;typeof(r=vl.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:n}=this.opts,i=new mn.SchemaEnv({schema:{},schemaId:n});if(r=mn.resolveSchema.call(this,i,e),!r)return;this.refs[e]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=vl.call(this,e);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{let r=e;this._cache.delete(r);let n=e[this.opts.schemaId];return n&&(n=(0,vn.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let r of e)this.addKeyword(r);return this}addKeyword(e,r){let n;if(typeof e=="string")n=e,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof e=="object"&&r===void 0){if(r=e,n=r.keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(py.call(this,n,r),!r)return(0,oo.eachItem)(n,s=>so.call(this,s)),this;vy.call(this,r);let i={...r,type:(0,li.getJSONTypes)(r.type),schemaType:(0,li.getJSONTypes)(r.schemaType)};return(0,oo.eachItem)(n,i.type.length===0?s=>so.call(this,s,i):s=>i.type.forEach(o=>so.call(this,s,i,o))),this}getKeyword(e){let r=this.RULES.all[e];return typeof r=="object"?r.definition:!!r}removeKeyword(e){let{RULES:r}=this;delete r.keywords[e],delete r.all[e];for(let n of r.rules){let i=n.rules.findIndex(s=>s.keyword===e);i>=0&&n.rules.splice(i,1)}return this}addFormat(e,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[e]=r,this}errorsText(e=this.errors,{separator:r=", ",dataVar:n="data"}={}){return!e||e.length===0?"No errors":e.map(i=>`${n}${i.instancePath} ${i.message}`).reduce((i,s)=>i+r+s)}$dataMetaSchema(e,r){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let i of r){let s=i.split("/").slice(1),o=e;for(let a of s)o=o[a];for(let a in n){let c=n[a];if(typeof c!="object")continue;let{$data:d}=c.definition,m=o[a];d&&m&&(o[a]=_l(m))}}return e}_removeAllSchemas(e,r){for(let n in e){let i=e[n];(!r||r.test(n))&&(typeof i=="string"?delete e[n]:i&&!i.meta&&(this._cache.delete(i.schema),delete e[n]))}}_addSchema(e,r,n,i=this.opts.validateSchema,s=this.opts.addUsedSchema){let o,{schemaId:a}=this.opts;if(typeof e=="object")o=e[a];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof e!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(e);if(c!==void 0)return c;n=(0,vn.normalizeId)(o||n);let d=vn.getSchemaRefs.call(this,e,n);return c=new mn.SchemaEnv({schema:e,schemaId:a,meta:r,baseId:n,localRefs:d}),this._cache.set(c.schema,c),s&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=c),i&&this.validateSchema(e,!0),c}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):mn.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let r=this.opts;this.opts=this._metaOpts;try{mn.compileSchema.call(this,e)}finally{this.opts=r}}};yn.ValidationError=Xv.default;yn.MissingRefError=yl.default;Ke.default=yn;function ml(t,e,r,n="error"){for(let i in t){let s=i;s in e&&this.logger[n](`${r}: option ${i}. ${t[s]}`)}}function vl(t){return t=(0,vn.normalizeId)(t),this.schemas[t]||this.refs[t]}function ay(){let t=this.opts.schemas;if(t)if(Array.isArray(t))this.addSchema(t);else for(let e in t)this.addSchema(t[e],e)}function uy(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function cy(t){if(Array.isArray(t)){this.addVocabulary(t);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let e in t){let r=t[e];r.keyword||(r.keyword=e),this.addKeyword(r)}}function fy(){let t={...this.opts};for(let e of ry)delete t[e];return t}var ly={log(){},warn(){},error(){}};function dy(t){if(t===!1)return ly;if(t===void 0)return console;if(t.log&&t.warn&&t.error)return t;throw new Error("logger must implement log, warn and error methods")}var hy=/^[a-z_$][a-z0-9_$:-]*$/i;function py(t,e){let{RULES:r}=this;if((0,oo.eachItem)(t,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!hy.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!e&&e.$data&&!("code"in e||"validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function so(t,e,r){var n;let i=e?.post;if(r&&i)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:s}=this,o=i?s.post:s.rules.find(({type:c})=>c===r);if(o||(o={type:r,rules:[]},s.rules.push(o)),s.keywords[t]=!0,!e)return;let a={keyword:t,definition:{...e,type:(0,li.getJSONTypes)(e.type),schemaType:(0,li.getJSONTypes)(e.schemaType)}};e.before?my.call(this,o,a,e.before):o.rules.push(a),s.all[t]=a,(n=e.implements)===null||n===void 0||n.forEach(c=>this.addKeyword(c))}function my(t,e,r){let n=t.rules.findIndex(i=>i.keyword===r);n>=0?t.rules.splice(n,0,e):(t.rules.push(e),this.logger.warn(`rule ${r} is not defined`))}function vy(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=_l(e)),t.validateSchema=this.compile(e,!0))}var yy={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function _l(t){return{anyOf:[t,yy]}}});var $l=Y(fr=>{"use strict";I();R();T();Object.defineProperty(fr,"__esModule",{value:!0});fr.callRef=fr.getValidate=void 0;var gy=si(),wl=lt(),at=pe(),Dr=Dt(),bl=ai(),di=be(),_y={keyword:"$ref",schemaType:"string",code(t){let{gen:e,schema:r,it:n}=t,{baseId:i,schemaEnv:s,validateName:o,opts:a,self:c}=n,{root:d}=s;if((r==="#"||r==="#/")&&i===d.baseId)return f();let m=bl.resolveRef.call(c,d,i,r);if(m===void 0)throw new gy.default(n.opts.uriResolver,i,r);if(m instanceof bl.SchemaEnv)return g(m);return _(m);function f(){if(s===d)return hi(t,o,s,s.$async);let b=e.scopeValue("root",{ref:d});return hi(t,(0,at._)`${b}.validate`,d,d.$async)}function g(b){let P=El(t,b);hi(t,P,b,b.$async)}function _(b){let P=e.scopeValue("schema",a.code.source===!0?{ref:b,code:(0,at.stringify)(b)}:{ref:b}),S=e.name("valid"),y=t.subschema({schema:b,dataTypes:[],schemaPath:at.nil,topSchemaRef:P,errSchemaPath:r},S);t.mergeEvaluated(y),t.ok(S)}}};function El(t,e){let{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,at._)`${r.scopeValue("wrapper",{ref:e})}.validate`}fr.getValidate=El;function hi(t,e,r,n){let{gen:i,it:s}=t,{allErrors:o,schemaEnv:a,opts:c}=s,d=c.passContext?Dr.default.this:at.nil;n?m():f();function m(){if(!a.$async)throw new Error("async schema referenced by sync schema");let b=i.let("valid");i.try(()=>{i.code((0,at._)`await ${(0,wl.callValidateCode)(t,e,d)}`),_(e),o||i.assign(b,!0)},P=>{i.if((0,at._)`!(${P} instanceof ${s.ValidationError})`,()=>i.throw(P)),g(P),o||i.assign(b,!1)}),t.ok(b)}function f(){t.result((0,wl.callValidateCode)(t,e,d),()=>_(e),()=>g(e))}function g(b){let P=(0,at._)`${b}.errors`;i.assign(Dr.default.vErrors,(0,at._)`${Dr.default.vErrors} === null ? ${P} : ${Dr.default.vErrors}.concat(${P})`),i.assign(Dr.default.errors,(0,at._)`${Dr.default.vErrors}.length`)}function _(b){var P;if(!s.opts.unevaluated)return;let S=(P=r?.validate)===null||P===void 0?void 0:P.evaluated;if(s.props!==!0)if(S&&!S.dynamicProps)S.props!==void 0&&(s.props=di.mergeEvaluated.props(i,S.props,s.props));else{let y=i.var("props",(0,at._)`${b}.evaluated.props`);s.props=di.mergeEvaluated.props(i,y,s.props,at.Name)}if(s.items!==!0)if(S&&!S.dynamicItems)S.items!==void 0&&(s.items=di.mergeEvaluated.items(i,S.items,s.items));else{let y=i.var("items",(0,at._)`${b}.evaluated.items`);s.items=di.mergeEvaluated.items(i,y,s.items,at.Name)}}}fr.callRef=hi;fr.default=_y});var Sl=Y(ao=>{"use strict";I();R();T();Object.defineProperty(ao,"__esModule",{value:!0});var wy=$l(),by=["$schema","id","$defs",{keyword:"$comment"},"definitions",wy.default];ao.default=by});var Pl=Y(lo=>{"use strict";I();R();T();Object.defineProperty(lo,"__esModule",{value:!0});var uo=gn(),Ey=pe(),Wt=Ey.operators,co={maximum:{exclusive:"exclusiveMaximum",ops:[{okStr:"<=",ok:Wt.LTE,fail:Wt.GT},{okStr:"<",ok:Wt.LT,fail:Wt.GTE}]},minimum:{exclusive:"exclusiveMinimum",ops:[{okStr:">=",ok:Wt.GTE,fail:Wt.LT},{okStr:">",ok:Wt.GT,fail:Wt.LTE}]}},$y={message:t=>uo.str`must be ${fo(t).okStr} ${t.schemaCode}`,params:t=>uo._`{comparison: ${fo(t).okStr}, limit: ${t.schemaCode}}`},Sy={keyword:Object.keys(co),type:"number",schemaType:"number",$data:!0,error:$y,code(t){let{data:e,schemaCode:r}=t;t.fail$data(uo._`${e} ${fo(t).fail} ${r} || isNaN(${e})`)}};function fo(t){var e;let r=t.keyword,n=!((e=t.parentSchema)===null||e===void 0)&&e[co[r].exclusive]?1:0;return co[r].ops[n]}lo.default=Sy});var Al=Y(ho=>{"use strict";I();R();T();Object.defineProperty(ho,"__esModule",{value:!0});var Ol={exclusiveMaximum:"maximum",exclusiveMinimum:"minimum"},Py={keyword:Object.keys(Ol),type:"number",schemaType:"boolean",code({keyword:t,parentSchema:e}){let r=Ol[t];if(e[r]===void 0)throw new Error(`${t} can only be used with ${r}`)}};ho.default=Py});var Il=Y(po=>{"use strict";I();R();T();Object.defineProperty(po,"__esModule",{value:!0});var _n=pe(),Oy={message:({schemaCode:t})=>(0,_n.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,_n._)`{multipleOf: ${t}}`},Ay={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:Oy,code(t){let{gen:e,data:r,schemaCode:n,it:i}=t,s=i.opts.multipleOfPrecision,o=e.let("res"),a=s?(0,_n._)`Math.abs(Math.round(${o}) - ${o}) > 1e-${s}`:(0,_n._)`${o} !== parseInt(${o})`;t.fail$data((0,_n._)`(${n} === 0 || (${o} = ${r}/${n}, ${a}))`)}};po.default=Ay});var Rl=Y(mo=>{"use strict";I();R();T();Object.defineProperty(mo,"__esModule",{value:!0});function Tl(t){let e=t.length,r=0,n=0,i;for(;n<e;)r++,i=t.charCodeAt(n++),i>=55296&&i<=56319&&n<e&&(i=t.charCodeAt(n),(i&64512)===56320&&n++);return r}mo.default=Tl;Tl.code='require("ajv/dist/runtime/ucs2length").default'});var ql=Y(vo=>{"use strict";I();R();T();Object.defineProperty(vo,"__esModule",{value:!0});var lr=pe(),Iy=be(),Ty=Rl(),Ry={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return(0,lr.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,lr._)`{limit: ${t}}`},qy={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:Ry,code(t){let{keyword:e,data:r,schemaCode:n,it:i}=t,s=e==="maxLength"?lr.operators.GT:lr.operators.LT,o=i.opts.unicode===!1?(0,lr._)`${r}.length`:(0,lr._)`${(0,Iy.useFunc)(t.gen,Ty.default)}(${r})`;t.fail$data((0,lr._)`${o} ${s} ${n}`)}};vo.default=qy});var Cl=Y(yo=>{"use strict";I();R();T();Object.defineProperty(yo,"__esModule",{value:!0});var Cy=lt(),pi=pe(),ky={message:({schemaCode:t})=>(0,pi.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,pi._)`{pattern: ${t}}`},xy={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:ky,code(t){let{data:e,$data:r,schema:n,schemaCode:i,it:s}=t,o=s.opts.unicodeRegExp?"u":"",a=r?(0,pi._)`(new RegExp(${i}, ${o}))`:(0,Cy.usePattern)(t,n);t.fail$data((0,pi._)`!${a}.test(${e})`)}};yo.default=xy});var kl=Y(go=>{"use strict";I();R();T();Object.defineProperty(go,"__esModule",{value:!0});var wn=pe(),Ny={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return(0,wn.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,wn._)`{limit: ${t}}`},jy={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:Ny,code(t){let{keyword:e,data:r,schemaCode:n}=t,i=e==="maxProperties"?wn.operators.GT:wn.operators.LT;t.fail$data((0,wn._)`Object.keys(${r}).length ${i} ${n}`)}};go.default=jy});var xl=Y(_o=>{"use strict";I();R();T();Object.defineProperty(_o,"__esModule",{value:!0});var bn=lt(),En=pe(),Dy=be(),By={message:({params:{missingProperty:t}})=>(0,En.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,En._)`{missingProperty: ${t}}`},Ly={keyword:"required",type:"object",schemaType:"array",$data:!0,error:By,code(t){let{gen:e,schema:r,schemaCode:n,data:i,$data:s,it:o}=t,{opts:a}=o;if(!s&&r.length===0)return;let c=r.length>=a.loopRequired;if(o.allErrors?d():m(),a.strictRequired){let _=t.parentSchema.properties,{definedProperties:b}=t.it;for(let P of r)if(_?.[P]===void 0&&!b.has(P)){let S=o.schemaEnv.baseId+o.errSchemaPath,y=`required property "${P}" is not defined at "${S}" (strictRequired)`;(0,Dy.checkStrictMode)(o,y,o.opts.strictRequired)}}function d(){if(c||s)t.block$data(En.nil,f);else for(let _ of r)(0,bn.checkReportMissingProp)(t,_)}function m(){let _=e.let("missing");if(c||s){let b=e.let("valid",!0);t.block$data(b,()=>g(_,b)),t.ok(b)}else e.if((0,bn.checkMissingProp)(t,r,_)),(0,bn.reportMissingProp)(t,_),e.else()}function f(){e.forOf("prop",n,_=>{t.setParams({missingProperty:_}),e.if((0,bn.noPropertyInData)(e,i,_,a.ownProperties),()=>t.error())})}function g(_,b){t.setParams({missingProperty:_}),e.forOf(_,n,()=>{e.assign(b,(0,bn.propertyInData)(e,i,_,a.ownProperties)),e.if((0,En.not)(b),()=>{t.error(),e.break()})},En.nil)}}};_o.default=Ly});var Nl=Y(wo=>{"use strict";I();R();T();Object.defineProperty(wo,"__esModule",{value:!0});var $n=pe(),My={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return(0,$n.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,$n._)`{limit: ${t}}`},Uy={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:My,code(t){let{keyword:e,data:r,schemaCode:n}=t,i=e==="maxItems"?$n.operators.GT:$n.operators.LT;t.fail$data((0,$n._)`${r}.length ${i} ${n}`)}};wo.default=Uy});var mi=Y(bo=>{"use strict";I();R();T();Object.defineProperty(bo,"__esModule",{value:!0});var jl=Us();jl.code='require("ajv/dist/runtime/equal").default';bo.default=jl});var Dl=Y($o=>{"use strict";I();R();T();Object.defineProperty($o,"__esModule",{value:!0});var Eo=fn(),ze=pe(),Gy=be(),Fy=mi(),Ky={message:({params:{i:t,j:e}})=>(0,ze.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,ze._)`{i: ${t}, j: ${e}}`},zy={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:Ky,code(t){let{gen:e,data:r,$data:n,schema:i,parentSchema:s,schemaCode:o,it:a}=t;if(!n&&!i)return;let c=e.let("valid"),d=s.items?(0,Eo.getSchemaTypes)(s.items):[];t.block$data(c,m,(0,ze._)`${o} === false`),t.ok(c);function m(){let b=e.let("i",(0,ze._)`${r}.length`),P=e.let("j");t.setParams({i:b,j:P}),e.assign(c,!0),e.if((0,ze._)`${b} > 1`,()=>(f()?g:_)(b,P))}function f(){return d.length>0&&!d.some(b=>b==="object"||b==="array")}function g(b,P){let S=e.name("item"),y=(0,Eo.checkDataTypes)(d,S,a.opts.strictNumbers,Eo.DataType.Wrong),w=e.const("indices",(0,ze._)`{}`);e.for((0,ze._)`;${b}--;`,()=>{e.let(S,(0,ze._)`${r}[${b}]`),e.if(y,(0,ze._)`continue`),d.length>1&&e.if((0,ze._)`typeof ${S} == "string"`,(0,ze._)`${S} += "_"`),e.if((0,ze._)`typeof ${w}[${S}] == "number"`,()=>{e.assign(P,(0,ze._)`${w}[${S}]`),t.error(),e.assign(c,!1).break()}).code((0,ze._)`${w}[${S}] = ${b}`)})}function _(b,P){let S=(0,Gy.useFunc)(e,Fy.default),y=e.name("outer");e.label(y).for((0,ze._)`;${b}--;`,()=>e.for((0,ze._)`${P} = ${b}; ${P}--;`,()=>e.if((0,ze._)`${S}(${r}[${b}], ${r}[${P}])`,()=>{t.error(),e.assign(c,!1).break(y)})))}}};$o.default=zy});var Bl=Y(Po=>{"use strict";I();R();T();Object.defineProperty(Po,"__esModule",{value:!0});var So=pe(),Vy=be(),Jy=mi(),Hy={message:"must be equal to constant",params:({schemaCode:t})=>(0,So._)`{allowedValue: ${t}}`},Wy={keyword:"const",$data:!0,error:Hy,code(t){let{gen:e,data:r,$data:n,schemaCode:i,schema:s}=t;n||s&&typeof s=="object"?t.fail$data((0,So._)`!${(0,Vy.useFunc)(e,Jy.default)}(${r}, ${i})`):t.fail((0,So._)`${s} !== ${r}`)}};Po.default=Wy});var Ll=Y(Oo=>{"use strict";I();R();T();Object.defineProperty(Oo,"__esModule",{value:!0});var Sn=pe(),Qy=be(),Yy=mi(),Xy={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,Sn._)`{allowedValues: ${t}}`},Zy={keyword:"enum",schemaType:"array",$data:!0,error:Xy,code(t){let{gen:e,data:r,$data:n,schema:i,schemaCode:s,it:o}=t;if(!n&&i.length===0)throw new Error("enum must have non-empty array");let a=i.length>=o.opts.loopEnum,c,d=()=>c??(c=(0,Qy.useFunc)(e,Yy.default)),m;if(a||n)m=e.let("valid"),t.block$data(m,f);else{if(!Array.isArray(i))throw new Error("ajv implementation error");let _=e.const("vSchema",s);m=(0,Sn.or)(...i.map((b,P)=>g(_,P)))}t.pass(m);function f(){e.assign(m,!1),e.forOf("v",s,_=>e.if((0,Sn._)`${d()}(${r}, ${_})`,()=>e.assign(m,!0).break()))}function g(_,b){let P=i[b];return typeof P=="object"&&P!==null?(0,Sn._)`${d()}(${r}, ${_}[${b}])`:(0,Sn._)`${r} === ${P}`}}};Oo.default=Zy});var Ml=Y(Ao=>{"use strict";I();R();T();Object.defineProperty(Ao,"__esModule",{value:!0});var eg=Pl(),tg=Al(),rg=Il(),ng=ql(),ig=Cl(),sg=kl(),og=xl(),ag=Nl(),ug=Dl(),cg=Bl(),fg=Ll(),lg=[eg.default,tg.default,rg.default,ng.default,ig.default,sg.default,og.default,ag.default,ug.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},cg.default,fg.default];Ao.default=lg});var To=Y(Pn=>{"use strict";I();R();T();Object.defineProperty(Pn,"__esModule",{value:!0});Pn.validateAdditionalItems=void 0;var dr=pe(),Io=be(),dg={message:({params:{len:t}})=>(0,dr.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,dr._)`{limit: ${t}}`},hg={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:dg,code(t){let{parentSchema:e,it:r}=t,{items:n}=e;if(!Array.isArray(n)){(0,Io.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}Ul(t,n)}};function Ul(t,e){let{gen:r,schema:n,data:i,keyword:s,it:o}=t;o.items=!0;let a=r.const("len",(0,dr._)`${i}.length`);if(n===!1)t.setParams({len:e.length}),t.pass((0,dr._)`${a} <= ${e.length}`);else if(typeof n=="object"&&!(0,Io.alwaysValidSchema)(o,n)){let d=r.var("valid",(0,dr._)`${a} <= ${e.length}`);r.if((0,dr.not)(d),()=>c(d)),t.ok(d)}function c(d){r.forRange("i",e.length,a,m=>{t.subschema({keyword:s,dataProp:m,dataPropType:Io.Type.Num},d),o.allErrors||r.if((0,dr.not)(d),()=>r.break())})}}Pn.validateAdditionalItems=Ul;Pn.default=hg});var Ro=Y(On=>{"use strict";I();R();T();Object.defineProperty(On,"__esModule",{value:!0});On.validateTuple=void 0;var Gl=pe(),vi=be(),pg=lt(),mg={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return Fl(t,"additionalItems",e);r.items=!0,!(0,vi.alwaysValidSchema)(r,e)&&t.ok((0,pg.validateArray)(t))}};function Fl(t,e,r=t.schema){let{gen:n,parentSchema:i,data:s,keyword:o,it:a}=t;m(i),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=vi.mergeEvaluated.items(n,r.length,a.items));let c=n.name("valid"),d=n.const("len",(0,Gl._)`${s}.length`);r.forEach((f,g)=>{(0,vi.alwaysValidSchema)(a,f)||(n.if((0,Gl._)`${d} > ${g}`,()=>t.subschema({keyword:o,schemaProp:g,dataProp:g},c)),t.ok(c))});function m(f){let{opts:g,errSchemaPath:_}=a,b=r.length,P=b===f.minItems&&(b===f.maxItems||f[e]===!1);if(g.strictTuples&&!P){let S=`"${o}" is ${b}-tuple, but minItems or maxItems/${e} are not specified or different at path "${_}"`;(0,vi.checkStrictMode)(a,S,g.strictTuples)}}}On.validateTuple=Fl;On.default=mg});var Kl=Y(qo=>{"use strict";I();R();T();Object.defineProperty(qo,"__esModule",{value:!0});var vg=Ro(),yg={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,vg.validateTuple)(t,"items")};qo.default=yg});var Vl=Y(Co=>{"use strict";I();R();T();Object.defineProperty(Co,"__esModule",{value:!0});var zl=pe(),gg=be(),_g=lt(),wg=To(),bg={message:({params:{len:t}})=>(0,zl.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,zl._)`{limit: ${t}}`},Eg={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:bg,code(t){let{schema:e,parentSchema:r,it:n}=t,{prefixItems:i}=r;n.items=!0,!(0,gg.alwaysValidSchema)(n,e)&&(i?(0,wg.validateAdditionalItems)(t,i):t.ok((0,_g.validateArray)(t)))}};Co.default=Eg});var Jl=Y(ko=>{"use strict";I();R();T();Object.defineProperty(ko,"__esModule",{value:!0});var ht=pe(),yi=be(),$g={message:({params:{min:t,max:e}})=>e===void 0?(0,ht.str)`must contain at least ${t} valid item(s)`:(0,ht.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,ht._)`{minContains: ${t}}`:(0,ht._)`{minContains: ${t}, maxContains: ${e}}`},Sg={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:$g,code(t){let{gen:e,schema:r,parentSchema:n,data:i,it:s}=t,o,a,{minContains:c,maxContains:d}=n;s.opts.next?(o=c===void 0?1:c,a=d):o=1;let m=e.const("len",(0,ht._)`${i}.length`);if(t.setParams({min:o,max:a}),a===void 0&&o===0){(0,yi.checkStrictMode)(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&o>a){(0,yi.checkStrictMode)(s,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,yi.alwaysValidSchema)(s,r)){let P=(0,ht._)`${m} >= ${o}`;a!==void 0&&(P=(0,ht._)`${P} && ${m} <= ${a}`),t.pass(P);return}s.items=!0;let f=e.name("valid");a===void 0&&o===1?_(f,()=>e.if(f,()=>e.break())):o===0?(e.let(f,!0),a!==void 0&&e.if((0,ht._)`${i}.length > 0`,g)):(e.let(f,!1),g()),t.result(f,()=>t.reset());function g(){let P=e.name("_valid"),S=e.let("count",0);_(P,()=>e.if(P,()=>b(S)))}function _(P,S){e.forRange("i",0,m,y=>{t.subschema({keyword:"contains",dataProp:y,dataPropType:yi.Type.Num,compositeRule:!0},P),S()})}function b(P){e.code((0,ht._)`${P}++`),a===void 0?e.if((0,ht._)`${P} >= ${o}`,()=>e.assign(f,!0).break()):(e.if((0,ht._)`${P} > ${a}`,()=>e.assign(f,!1).break()),o===1?e.assign(f,!0):e.if((0,ht._)`${P} >= ${o}`,()=>e.assign(f,!0)))}}};ko.default=Sg});var Ql=Y(At=>{"use strict";I();R();T();Object.defineProperty(At,"__esModule",{value:!0});At.validateSchemaDeps=At.validatePropertyDeps=At.error=void 0;var xo=pe(),Pg=be(),An=lt();At.error={message:({params:{property:t,depsCount:e,deps:r}})=>{let n=e===1?"property":"properties";return(0,xo.str)`must have ${n} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:n}})=>(0,xo._)`{property: ${t},
|
|
6
|
+
|| ${o} === "boolean" || ${i} === null`).assign(a,(0,ue._)`[${i}]`)}}}function ug({gen:t,parentData:e,parentDataProperty:r},n){t.if((0,ue._)`${e} !== undefined`,()=>t.assign((0,ue._)`${e}[${r}]`,n))}function Vo(t,e,r,n=Gr.Correct){let i=n===Gr.Correct?ue.operators.EQ:ue.operators.NEQ,s;switch(t){case"null":return(0,ue._)`${e} ${i} null`;case"array":s=(0,ue._)`Array.isArray(${e})`;break;case"object":s=(0,ue._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":s=o((0,ue._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":s=o();break;default:return(0,ue._)`typeof ${e} ${i} ${t}`}return n===Gr.Correct?s:(0,ue.not)(s);function o(a=ue.nil){return(0,ue.and)((0,ue._)`typeof ${e} == "number"`,a,r?(0,ue._)`isFinite(${e})`:ue.nil)}}Ze.checkDataType=Vo;function Jo(t,e,r,n){if(t.length===1)return Vo(t[0],e,r,n);let i,s=(0,Cl.toHash)(t);if(s.array&&s.object){let o=(0,ue._)`typeof ${e} != "object"`;i=s.null?o:(0,ue._)`!${e} || ${o}`,delete s.null,delete s.array,delete s.object}else i=ue.nil;s.number&&delete s.integer;for(let o in s)i=(0,ue.and)(i,Vo(o,e,r,n));return i}Ze.checkDataTypes=Jo;var cg={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,ue._)`{type: ${t}}`:(0,ue._)`{type: ${e}}`};function Ho(t){let e=fg(t);(0,ng.reportError)(e,cg)}Ze.reportTypeError=Ho;function fg(t){let{gen:e,data:r,schema:n}=t,i=(0,Cl.schemaRefOrVal)(t,n,"type");return{gen:e,keyword:"type",data:r,schema:n.type,schemaCode:i,schemaValue:i,parentSchema:n,params:{},it:t}}});var Bl=Q(Ri=>{"use strict";I();R();T();Object.defineProperty(Ri,"__esModule",{value:!0});Ri.assignDefaults=void 0;var Fr=de(),lg=be();function dg(t,e){let{properties:r,items:n}=t.schema;if(e==="object"&&r)for(let i in r)Dl(t,i,r[i].default);else e==="array"&&Array.isArray(n)&&n.forEach((i,s)=>Dl(t,s,i.default))}Ri.assignDefaults=dg;function Dl(t,e,r){let{gen:n,compositeRule:i,data:s,opts:o}=t;if(r===void 0)return;let a=(0,Fr._)`${s}${(0,Fr.getProperty)(e)}`;if(i){(0,lg.checkStrictMode)(t,`default is ignored for: ${a}`);return}let c=(0,Fr._)`${a} === undefined`;o.useDefaults==="empty"&&(c=(0,Fr._)`${c} || ${a} === null || ${a} === ""`),n.if(c,(0,Fr._)`${a} = ${(0,Fr.stringify)(r)}`)}});var pt=Q(Oe=>{"use strict";I();R();T();Object.defineProperty(Oe,"__esModule",{value:!0});Oe.validateUnion=Oe.validateArray=Oe.usePattern=Oe.callValidateCode=Oe.schemaProperties=Oe.allSchemaProperties=Oe.noPropertyInData=Oe.propertyInData=Oe.isOwnProperty=Oe.hasPropFunc=Oe.reportMissingProp=Oe.checkMissingProp=Oe.checkReportMissingProp=void 0;var qe=de(),Wo=be(),Jt=Bt(),hg=be();function pg(t,e){let{gen:r,data:n,it:i}=t;r.if(Yo(r,n,e,i.opts.ownProperties),()=>{t.setParams({missingProperty:(0,qe._)`${e}`},!0),t.error()})}Oe.checkReportMissingProp=pg;function mg({gen:t,data:e,it:{opts:r}},n,i){return(0,qe.or)(...n.map(s=>(0,qe.and)(Yo(t,e,s,r.ownProperties),(0,qe._)`${i} = ${s}`)))}Oe.checkMissingProp=mg;function vg(t,e){t.setParams({missingProperty:e},!0),t.error()}Oe.reportMissingProp=vg;function Ll(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,qe._)`Object.prototype.hasOwnProperty`})}Oe.hasPropFunc=Ll;function Qo(t,e,r){return(0,qe._)`${Ll(t)}.call(${e}, ${r})`}Oe.isOwnProperty=Qo;function yg(t,e,r,n){let i=(0,qe._)`${e}${(0,qe.getProperty)(r)} !== undefined`;return n?(0,qe._)`${i} && ${Qo(t,e,r)}`:i}Oe.propertyInData=yg;function Yo(t,e,r,n){let i=(0,qe._)`${e}${(0,qe.getProperty)(r)} === undefined`;return n?(0,qe.or)(i,(0,qe.not)(Qo(t,e,r))):i}Oe.noPropertyInData=Yo;function Ml(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}Oe.allSchemaProperties=Ml;function gg(t,e){return Ml(e).filter(r=>!(0,Wo.alwaysValidSchema)(t,e[r]))}Oe.schemaProperties=gg;function _g({schemaCode:t,data:e,it:{gen:r,topSchemaRef:n,schemaPath:i,errorPath:s},it:o},a,c,d){let m=d?(0,qe._)`${t}, ${e}, ${n}${i}`:e,f=[[Jt.default.instancePath,(0,qe.strConcat)(Jt.default.instancePath,s)],[Jt.default.parentData,o.parentData],[Jt.default.parentDataProperty,o.parentDataProperty],[Jt.default.rootData,Jt.default.rootData]];o.opts.dynamicRef&&f.push([Jt.default.dynamicAnchors,Jt.default.dynamicAnchors]);let g=(0,qe._)`${m}, ${r.object(...f)}`;return c!==qe.nil?(0,qe._)`${a}.call(${c}, ${g})`:(0,qe._)`${a}(${g})`}Oe.callValidateCode=_g;var wg=(0,qe._)`new RegExp`;function bg({gen:t,it:{opts:e}},r){let n=e.unicodeRegExp?"u":"",{regExp:i}=e.code,s=i(r,n);return t.scopeValue("pattern",{key:s.toString(),ref:s,code:(0,qe._)`${i.code==="new RegExp"?wg:(0,hg.useFunc)(t,i)}(${r}, ${n})`})}Oe.usePattern=bg;function Eg(t){let{gen:e,data:r,keyword:n,it:i}=t,s=e.name("valid");if(i.allErrors){let a=e.let("valid",!0);return o(()=>e.assign(a,!1)),a}return e.var(s,!0),o(()=>e.break()),s;function o(a){let c=e.const("len",(0,qe._)`${r}.length`);e.forRange("i",0,c,d=>{t.subschema({keyword:n,dataProp:d,dataPropType:Wo.Type.Num},s),e.if((0,qe.not)(s),a)})}}Oe.validateArray=Eg;function $g(t){let{gen:e,schema:r,keyword:n,it:i}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,Wo.alwaysValidSchema)(i,c))&&!i.opts.unevaluated)return;let o=e.let("valid",!1),a=e.name("_valid");e.block(()=>r.forEach((c,d)=>{let m=t.subschema({keyword:n,schemaProp:d,compositeRule:!0},a);e.assign(o,(0,qe._)`${o} || ${a}`),t.mergeValidEvaluated(m,a)||e.if((0,qe.not)(o))})),t.result(o,()=>t.reset(),()=>t.error(!0))}Oe.validateUnion=$g});var Fl=Q(It=>{"use strict";I();R();T();Object.defineProperty(It,"__esModule",{value:!0});It.validateKeywordUsage=It.validSchemaType=It.funcKeywordCode=It.macroKeywordCode=void 0;var rt=de(),_r=Bt(),Sg=pt(),Pg=wn();function Og(t,e){let{gen:r,keyword:n,schema:i,parentSchema:s,it:o}=t,a=e.macro.call(o.self,i,s,o),c=Gl(r,n,a);o.opts.validateSchema!==!1&&o.self.validateSchema(a,!0);let d=r.name("valid");t.subschema({schema:a,schemaPath:rt.nil,errSchemaPath:`${o.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},d),t.pass(d,()=>t.error(!0))}It.macroKeywordCode=Og;function Ag(t,e){var r;let{gen:n,keyword:i,schema:s,parentSchema:o,$data:a,it:c}=t;Tg(c,e);let d=!a&&e.compile?e.compile.call(c.self,s,o,c):e.validate,m=Gl(n,i,d),f=n.let("valid");t.block$data(f,g),t.ok((r=e.valid)!==null&&r!==void 0?r:f);function g(){if(e.errors===!1)P(),e.modifying&&Ul(t),S(()=>t.error());else{let y=e.async?_():E();e.modifying&&Ul(t),S(()=>Ig(t,y))}}function _(){let y=n.let("ruleErrs",null);return n.try(()=>P((0,rt._)`await `),w=>n.assign(f,!1).if((0,rt._)`${w} instanceof ${c.ValidationError}`,()=>n.assign(y,(0,rt._)`${w}.errors`),()=>n.throw(w))),y}function E(){let y=(0,rt._)`${m}.errors`;return n.assign(y,null),P(rt.nil),y}function P(y=e.async?(0,rt._)`await `:rt.nil){let w=c.opts.passContext?_r.default.this:_r.default.self,p=!("compile"in e&&!a||e.schema===!1);n.assign(f,(0,rt._)`${y}${(0,Sg.callValidateCode)(t,m,w,p)}`,e.modifying)}function S(y){var w;n.if((0,rt.not)((w=e.valid)!==null&&w!==void 0?w:f),y)}}It.funcKeywordCode=Ag;function Ul(t){let{gen:e,data:r,it:n}=t;e.if(n.parentData,()=>e.assign(r,(0,rt._)`${n.parentData}[${n.parentDataProperty}]`))}function Ig(t,e){let{gen:r}=t;r.if((0,rt._)`Array.isArray(${e})`,()=>{r.assign(_r.default.vErrors,(0,rt._)`${_r.default.vErrors} === null ? ${e} : ${_r.default.vErrors}.concat(${e})`).assign(_r.default.errors,(0,rt._)`${_r.default.vErrors}.length`),(0,Pg.extendErrors)(t)},()=>t.error())}function Tg({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function Gl(t,e,r){if(r===void 0)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,rt.stringify)(r)})}function Rg(t,e,r=!1){return!e.length||e.some(n=>n==="array"?Array.isArray(t):n==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==n||r&&typeof t>"u")}It.validSchemaType=Rg;function qg({schema:t,opts:e,self:r,errSchemaPath:n},i,s){if(Array.isArray(i.keyword)?!i.keyword.includes(s):i.keyword!==s)throw new Error("ajv implementation error");let o=i.dependencies;if(o?.some(a=>!Object.prototype.hasOwnProperty.call(t,a)))throw new Error(`parent schema must have dependencies of ${s}: ${o.join(",")}`);if(i.validateSchema&&!i.validateSchema(t[s])){let c=`keyword "${s}" value is invalid at path "${n}": `+r.errorsText(i.validateSchema.errors);if(e.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}It.validateKeywordUsage=qg});var zl=Q(Ht=>{"use strict";I();R();T();Object.defineProperty(Ht,"__esModule",{value:!0});Ht.extendSubschemaMode=Ht.extendSubschemaData=Ht.getSubschema=void 0;var Tt=de(),Kl=be();function Ng(t,{keyword:e,schemaProp:r,schema:n,schemaPath:i,errSchemaPath:s,topSchemaRef:o}){if(e!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){let a=t.schema[e];return r===void 0?{schema:a,schemaPath:(0,Tt._)`${t.schemaPath}${(0,Tt.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:a[r],schemaPath:(0,Tt._)`${t.schemaPath}${(0,Tt.getProperty)(e)}${(0,Tt.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,Kl.escapeFragment)(r)}`}}if(n!==void 0){if(i===void 0||s===void 0||o===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:i,topSchemaRef:o,errSchemaPath:s}}throw new Error('either "keyword" or "schema" must be passed')}Ht.getSubschema=Ng;function kg(t,e,{dataProp:r,dataPropType:n,data:i,dataTypes:s,propertyName:o}){if(i!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=e;if(r!==void 0){let{errorPath:d,dataPathArr:m,opts:f}=e,g=a.let("data",(0,Tt._)`${e.data}${(0,Tt.getProperty)(r)}`,!0);c(g),t.errorPath=(0,Tt.str)`${d}${(0,Kl.getErrorPath)(r,n,f.jsPropertySyntax)}`,t.parentDataProperty=(0,Tt._)`${r}`,t.dataPathArr=[...m,t.parentDataProperty]}if(i!==void 0){let d=i instanceof Tt.Name?i:a.let("data",i,!0);c(d),o!==void 0&&(t.propertyName=o)}s&&(t.dataTypes=s);function c(d){t.data=d,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,d]}}Ht.extendSubschemaData=kg;function Cg(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:n,createErrors:i,allErrors:s}){n!==void 0&&(t.compositeRule=n),i!==void 0&&(t.createErrors=i),s!==void 0&&(t.allErrors=s),t.jtdDiscriminator=e,t.jtdMetadata=r}Ht.extendSubschemaMode=Cg});var Xo=Q((z$,Vl)=>{"use strict";I();R();T();Vl.exports=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var n,i,s;if(Array.isArray(e)){if(n=e.length,n!=r.length)return!1;for(i=n;i--!==0;)if(!t(e[i],r[i]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(s=Object.keys(e),n=s.length,n!==Object.keys(r).length)return!1;for(i=n;i--!==0;)if(!Object.prototype.hasOwnProperty.call(r,s[i]))return!1;for(i=n;i--!==0;){var o=s[i];if(!t(e[o],r[o]))return!1}return!0}return e!==e&&r!==r}});var Hl=Q((W$,Jl)=>{"use strict";I();R();T();var Wt=Jl.exports=function(t,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var n=typeof r=="function"?r:r.pre||function(){},i=r.post||function(){};qi(e,n,i,t,"",t)};Wt.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Wt.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Wt.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Wt.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function qi(t,e,r,n,i,s,o,a,c,d){if(n&&typeof n=="object"&&!Array.isArray(n)){e(n,i,s,o,a,c,d);for(var m in n){var f=n[m];if(Array.isArray(f)){if(m in Wt.arrayKeywords)for(var g=0;g<f.length;g++)qi(t,e,r,f[g],i+"/"+m+"/"+g,s,i,m,n,g)}else if(m in Wt.propsKeywords){if(f&&typeof f=="object")for(var _ in f)qi(t,e,r,f[_],i+"/"+m+"/"+xg(_),s,i,m,n,_)}else(m in Wt.keywords||t.allKeys&&!(m in Wt.skipKeywords))&&qi(t,e,r,f,i+"/"+m,s,i,m,n)}r(n,i,s,o,a,c,d)}}function xg(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}});var En=Q(at=>{"use strict";I();R();T();Object.defineProperty(at,"__esModule",{value:!0});at.getSchemaRefs=at.resolveUrl=at.normalizeId=at._getFullPath=at.getFullPath=at.inlineRef=void 0;var jg=be(),Dg=Xo(),Bg=Hl(),Lg=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function Mg(t,e=!0){return typeof t=="boolean"?!0:e===!0?!Zo(t):e?Wl(t)<=e:!1}at.inlineRef=Mg;var Ug=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function Zo(t){for(let e in t){if(Ug.has(e))return!0;let r=t[e];if(Array.isArray(r)&&r.some(Zo)||typeof r=="object"&&Zo(r))return!0}return!1}function Wl(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!Lg.has(r)&&(typeof t[r]=="object"&&(0,jg.eachItem)(t[r],n=>e+=Wl(n)),e===1/0))return 1/0}return e}function Ql(t,e="",r){r!==!1&&(e=Kr(e));let n=t.parse(e);return Yl(t,n)}at.getFullPath=Ql;function Yl(t,e){return t.serialize(e).split("#")[0]+"#"}at._getFullPath=Yl;var Gg=/#\/?$/;function Kr(t){return t?t.replace(Gg,""):""}at.normalizeId=Kr;function Fg(t,e,r){return r=Kr(r),t.resolve(e,r)}at.resolveUrl=Fg;var Kg=/^[a-z_][-a-z0-9._]*$/i;function zg(t,e){if(typeof t=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,i=Kr(t[r]||e),s={"":i},o=Ql(n,i,!1),a={},c=new Set;return Bg(t,{allKeys:!0},(f,g,_,E)=>{if(E===void 0)return;let P=o+g,S=s[E];typeof f[r]=="string"&&(S=y.call(this,f[r])),w.call(this,f.$anchor),w.call(this,f.$dynamicAnchor),s[g]=S;function y(p){let h=this.opts.uriResolver.resolve;if(p=Kr(S?h(S,p):p),c.has(p))throw m(p);c.add(p);let v=this.refs[p];return typeof v=="string"&&(v=this.refs[v]),typeof v=="object"?d(f,v.schema,p):p!==Kr(P)&&(p[0]==="#"?(d(f,a[p],p),a[p]=f):this.refs[p]=P),p}function w(p){if(typeof p=="string"){if(!Kg.test(p))throw new Error(`invalid anchor "${p}"`);y.call(this,`#${p}`)}}}),a;function d(f,g,_){if(g!==void 0&&!Dg(f,g))throw m(_)}function m(f){return new Error(`reference "${f}" resolves to more than one schema`)}}at.getSchemaRefs=zg});var Pn=Q(Qt=>{"use strict";I();R();T();Object.defineProperty(Qt,"__esModule",{value:!0});Qt.getData=Qt.KeywordCxt=Qt.validateFunctionCode=void 0;var rd=ql(),Xl=bn(),ta=zo(),Ni=bn(),Vg=Bl(),Sn=Fl(),ea=zl(),te=de(),se=Bt(),Jg=En(),Lt=be(),$n=wn();function Hg(t){if(sd(t)&&(od(t),id(t))){Yg(t);return}nd(t,()=>(0,rd.topBoolOrEmptySchema)(t))}Qt.validateFunctionCode=Hg;function nd({gen:t,validateName:e,schema:r,schemaEnv:n,opts:i},s){i.code.es5?t.func(e,(0,te._)`${se.default.data}, ${se.default.valCxt}`,n.$async,()=>{t.code((0,te._)`"use strict"; ${Zl(r,i)}`),Qg(t,i),t.code(s)}):t.func(e,(0,te._)`${se.default.data}, ${Wg(i)}`,n.$async,()=>t.code(Zl(r,i)).code(s))}function Wg(t){return(0,te._)`{${se.default.instancePath}="", ${se.default.parentData}, ${se.default.parentDataProperty}, ${se.default.rootData}=${se.default.data}${t.dynamicRef?(0,te._)`, ${se.default.dynamicAnchors}={}`:te.nil}}={}`}function Qg(t,e){t.if(se.default.valCxt,()=>{t.var(se.default.instancePath,(0,te._)`${se.default.valCxt}.${se.default.instancePath}`),t.var(se.default.parentData,(0,te._)`${se.default.valCxt}.${se.default.parentData}`),t.var(se.default.parentDataProperty,(0,te._)`${se.default.valCxt}.${se.default.parentDataProperty}`),t.var(se.default.rootData,(0,te._)`${se.default.valCxt}.${se.default.rootData}`),e.dynamicRef&&t.var(se.default.dynamicAnchors,(0,te._)`${se.default.valCxt}.${se.default.dynamicAnchors}`)},()=>{t.var(se.default.instancePath,(0,te._)`""`),t.var(se.default.parentData,(0,te._)`undefined`),t.var(se.default.parentDataProperty,(0,te._)`undefined`),t.var(se.default.rootData,se.default.data),e.dynamicRef&&t.var(se.default.dynamicAnchors,(0,te._)`{}`)})}function Yg(t){let{schema:e,opts:r,gen:n}=t;nd(t,()=>{r.$comment&&e.$comment&&ud(t),r_(t),n.let(se.default.vErrors,null),n.let(se.default.errors,0),r.unevaluated&&Xg(t),ad(t),s_(t)})}function Xg(t){let{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",(0,te._)`${r}.evaluated`),e.if((0,te._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,te._)`${t.evaluated}.props`,(0,te._)`undefined`)),e.if((0,te._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,te._)`${t.evaluated}.items`,(0,te._)`undefined`))}function Zl(t,e){let r=typeof t=="object"&&t[e.schemaId];return r&&(e.code.source||e.code.process)?(0,te._)`/*# sourceURL=${r} */`:te.nil}function Zg(t,e){if(sd(t)&&(od(t),id(t))){e_(t,e);return}(0,rd.boolOrEmptySchema)(t,e)}function id({schema:t,self:e}){if(typeof t=="boolean")return!t;for(let r in t)if(e.RULES.all[r])return!0;return!1}function sd(t){return typeof t.schema!="boolean"}function e_(t,e){let{schema:r,gen:n,opts:i}=t;i.$comment&&r.$comment&&ud(t),n_(t),i_(t);let s=n.const("_errs",se.default.errors);ad(t,s),n.var(e,(0,te._)`${s} === ${se.default.errors}`)}function od(t){(0,Lt.checkUnknownRules)(t),t_(t)}function ad(t,e){if(t.opts.jtd)return ed(t,[],!1,e);let r=(0,Xl.getSchemaTypes)(t.schema),n=(0,Xl.coerceAndCheckDataType)(t,r);ed(t,r,!n,e)}function t_(t){let{schema:e,errSchemaPath:r,opts:n,self:i}=t;e.$ref&&n.ignoreKeywordsWithRef&&(0,Lt.schemaHasRulesButRef)(e,i.RULES)&&i.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function r_(t){let{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,Lt.checkStrictMode)(t,"default is ignored in the schema root")}function n_(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,Jg.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function i_(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function ud({gen:t,schemaEnv:e,schema:r,errSchemaPath:n,opts:i}){let s=r.$comment;if(i.$comment===!0)t.code((0,te._)`${se.default.self}.logger.log(${s})`);else if(typeof i.$comment=="function"){let o=(0,te.str)`${n}/$comment`,a=t.scopeValue("root",{ref:e.root});t.code((0,te._)`${se.default.self}.opts.$comment(${s}, ${o}, ${a}.schema)`)}}function s_(t){let{gen:e,schemaEnv:r,validateName:n,ValidationError:i,opts:s}=t;r.$async?e.if((0,te._)`${se.default.errors} === 0`,()=>e.return(se.default.data),()=>e.throw((0,te._)`new ${i}(${se.default.vErrors})`)):(e.assign((0,te._)`${n}.errors`,se.default.vErrors),s.unevaluated&&o_(t),e.return((0,te._)`${se.default.errors} === 0`))}function o_({gen:t,evaluated:e,props:r,items:n}){r instanceof te.Name&&t.assign((0,te._)`${e}.props`,r),n instanceof te.Name&&t.assign((0,te._)`${e}.items`,n)}function ed(t,e,r,n){let{gen:i,schema:s,data:o,allErrors:a,opts:c,self:d}=t,{RULES:m}=d;if(s.$ref&&(c.ignoreKeywordsWithRef||!(0,Lt.schemaHasRulesButRef)(s,m))){i.block(()=>fd(t,"$ref",m.all.$ref.definition));return}c.jtd||a_(t,e),i.block(()=>{for(let g of m.rules)f(g);f(m.post)});function f(g){(0,ta.shouldUseGroup)(s,g)&&(g.type?(i.if((0,Ni.checkDataType)(g.type,o,c.strictNumbers)),td(t,g),e.length===1&&e[0]===g.type&&r&&(i.else(),(0,Ni.reportTypeError)(t)),i.endIf()):td(t,g),a||i.if((0,te._)`${se.default.errors} === ${n||0}`))}}function td(t,e){let{gen:r,schema:n,opts:{useDefaults:i}}=t;i&&(0,Vg.assignDefaults)(t,e.type),r.block(()=>{for(let s of e.rules)(0,ta.shouldUseRule)(n,s)&&fd(t,s.keyword,s.definition,e.type)})}function a_(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(u_(t,e),t.opts.allowUnionTypes||c_(t,e),f_(t,t.dataTypes))}function u_(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{cd(t.dataTypes,r)||ra(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),d_(t,e)}}function c_(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&ra(t,"use allowUnionTypes to allow union type keyword")}function f_(t,e){let r=t.self.RULES.all;for(let n in r){let i=r[n];if(typeof i=="object"&&(0,ta.shouldUseRule)(t.schema,i)){let{type:s}=i.definition;s.length&&!s.some(o=>l_(e,o))&&ra(t,`missing type "${s.join(",")}" for keyword "${n}"`)}}}function l_(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function cd(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function d_(t,e){let r=[];for(let n of t.dataTypes)cd(e,n)?r.push(n):e.includes("integer")&&n==="number"&&r.push("integer");t.dataTypes=r}function ra(t,e){let r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,Lt.checkStrictMode)(t,e,t.opts.strictTypes)}var ki=class{constructor(e,r,n){if((0,Sn.validateKeywordUsage)(e,r,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=r.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Lt.schemaRefOrVal)(e,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=r,this.$data)this.schemaCode=e.gen.const("vSchema",ld(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,Sn.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=e.gen.const("_errs",se.default.errors))}result(e,r,n){this.failResult((0,te.not)(e),r,n)}failResult(e,r,n){this.gen.if(e),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,r){this.failResult((0,te.not)(e),void 0,r)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:r}=this;this.fail((0,te._)`${r} !== undefined && (${(0,te.or)(this.invalid$data(),e)})`)}error(e,r,n){if(r){this.setParams(r),this._error(e,n),this.setParams({});return}this._error(e,n)}_error(e,r){(e?$n.reportExtraError:$n.reportError)(this,this.def.error,r)}$dataError(){(0,$n.reportError)(this,this.def.$dataError||$n.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,$n.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,r){r?Object.assign(this.params,e):this.params=e}block$data(e,r,n=te.nil){this.gen.block(()=>{this.check$data(e,n),r()})}check$data(e=te.nil,r=te.nil){if(!this.$data)return;let{gen:n,schemaCode:i,schemaType:s,def:o}=this;n.if((0,te.or)((0,te._)`${i} === undefined`,r)),e!==te.nil&&n.assign(e,!0),(s.length||o.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==te.nil&&n.assign(e,!1)),n.else()}invalid$data(){let{gen:e,schemaCode:r,schemaType:n,def:i,it:s}=this;return(0,te.or)(o(),a());function o(){if(n.length){if(!(r instanceof te.Name))throw new Error("ajv implementation error");let c=Array.isArray(n)?n:[n];return(0,te._)`${(0,Ni.checkDataTypes)(c,r,s.opts.strictNumbers,Ni.DataType.Wrong)}`}return te.nil}function a(){if(i.validateSchema){let c=e.scopeValue("validate$data",{ref:i.validateSchema});return(0,te._)`!${c}(${r})`}return te.nil}}subschema(e,r){let n=(0,ea.getSubschema)(this.it,e);(0,ea.extendSubschemaData)(n,this.it,e),(0,ea.extendSubschemaMode)(n,e);let i={...this.it,...n,items:void 0,props:void 0};return Zg(i,r),i}mergeEvaluated(e,r){let{it:n,gen:i}=this;n.opts.unevaluated&&(n.props!==!0&&e.props!==void 0&&(n.props=Lt.mergeEvaluated.props(i,e.props,n.props,r)),n.items!==!0&&e.items!==void 0&&(n.items=Lt.mergeEvaluated.items(i,e.items,n.items,r)))}mergeValidEvaluated(e,r){let{it:n,gen:i}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return i.if(r,()=>this.mergeEvaluated(e,te.Name)),!0}};Qt.KeywordCxt=ki;function fd(t,e,r,n){let i=new ki(t,r,e);"code"in r?r.code(i,n):i.$data&&r.validate?(0,Sn.funcKeywordCode)(i,r):"macro"in r?(0,Sn.macroKeywordCode)(i,r):(r.compile||r.validate)&&(0,Sn.funcKeywordCode)(i,r)}var h_=/^\/(?:[^~]|~0|~1)*$/,p_=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function ld(t,{dataLevel:e,dataNames:r,dataPathArr:n}){let i,s;if(t==="")return se.default.rootData;if(t[0]==="/"){if(!h_.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);i=t,s=se.default.rootData}else{let d=p_.exec(t);if(!d)throw new Error(`Invalid JSON-pointer: ${t}`);let m=+d[1];if(i=d[2],i==="#"){if(m>=e)throw new Error(c("property/index",m));return n[e-m]}if(m>e)throw new Error(c("data",m));if(s=r[e-m],!i)return s}let o=s,a=i.split("/");for(let d of a)d&&(s=(0,te._)`${s}${(0,te.getProperty)((0,Lt.unescapeJsonPointer)(d))}`,o=(0,te._)`${o} && ${s}`);return o;function c(d,m){return`Cannot access ${d} ${m} levels up, current level is ${e}`}}Qt.getData=ld});var Ci=Q(ia=>{"use strict";I();R();T();Object.defineProperty(ia,"__esModule",{value:!0});var na=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};ia.default=na});var On=Q(aa=>{"use strict";I();R();T();Object.defineProperty(aa,"__esModule",{value:!0});var sa=En(),oa=class extends Error{constructor(e,r,n,i){super(i||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,sa.resolveUrl)(e,r,n),this.missingSchema=(0,sa.normalizeId)((0,sa.getFullPath)(e,this.missingRef))}};aa.default=oa});var ji=Q(mt=>{"use strict";I();R();T();Object.defineProperty(mt,"__esModule",{value:!0});mt.resolveSchema=mt.getCompilingSchema=mt.resolveRef=mt.compileSchema=mt.SchemaEnv=void 0;var bt=de(),m_=Ci(),wr=Bt(),Et=En(),dd=be(),v_=Pn(),zr=class{constructor(e){var r;this.refs={},this.dynamicAnchors={};let n;typeof e.schema=="object"&&(n=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(r=e.baseId)!==null&&r!==void 0?r:(0,Et.normalizeId)(n?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=n?.$async,this.refs={}}};mt.SchemaEnv=zr;function ca(t){let e=hd.call(this,t);if(e)return e;let r=(0,Et.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:n,lines:i}=this.opts.code,{ownProperties:s}=this.opts,o=new bt.CodeGen(this.scope,{es5:n,lines:i,ownProperties:s}),a;t.$async&&(a=o.scopeValue("Error",{ref:m_.default,code:(0,bt._)`require("ajv/dist/runtime/validation_error").default`}));let c=o.scopeName("validate");t.validateName=c;let d={gen:o,allErrors:this.opts.allErrors,data:wr.default.data,parentData:wr.default.parentData,parentDataProperty:wr.default.parentDataProperty,dataNames:[wr.default.data],dataPathArr:[bt.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:o.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,bt.stringify)(t.schema)}:{ref:t.schema}),validateName:c,ValidationError:a,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:bt.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,bt._)`""`,opts:this.opts,self:this},m;try{this._compilations.add(t),(0,v_.validateFunctionCode)(d),o.optimize(this.opts.code.optimize);let f=o.toString();m=`${o.scopeRefs(wr.default.scope)}return ${f}`,this.opts.code.process&&(m=this.opts.code.process(m,t));let _=new Function(`${wr.default.self}`,`${wr.default.scope}`,m)(this,this.scope.get());if(this.scope.value(c,{ref:_}),_.errors=null,_.schema=t.schema,_.schemaEnv=t,t.$async&&(_.$async=!0),this.opts.code.source===!0&&(_.source={validateName:c,validateCode:f,scopeValues:o._values}),this.opts.unevaluated){let{props:E,items:P}=d;_.evaluated={props:E instanceof bt.Name?void 0:E,items:P instanceof bt.Name?void 0:P,dynamicProps:E instanceof bt.Name,dynamicItems:P instanceof bt.Name},_.source&&(_.source.evaluated=(0,bt.stringify)(_.evaluated))}return t.validate=_,t}catch(f){throw delete t.validate,delete t.validateName,m&&this.logger.error("Error compiling schema, function code:",m),f}finally{this._compilations.delete(t)}}mt.compileSchema=ca;function y_(t,e,r){var n;r=(0,Et.resolveUrl)(this.opts.uriResolver,e,r);let i=t.refs[r];if(i)return i;let s=w_.call(this,t,r);if(s===void 0){let o=(n=t.localRefs)===null||n===void 0?void 0:n[r],{schemaId:a}=this.opts;o&&(s=new zr({schema:o,schemaId:a,root:t,baseId:e}))}if(s!==void 0)return t.refs[r]=g_.call(this,s)}mt.resolveRef=y_;function g_(t){return(0,Et.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:ca.call(this,t)}function hd(t){for(let e of this._compilations)if(__(e,t))return e}mt.getCompilingSchema=hd;function __(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function w_(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||xi.call(this,t,e)}function xi(t,e){let r=this.opts.uriResolver.parse(e),n=(0,Et._getFullPath)(this.opts.uriResolver,r),i=(0,Et.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&n===i)return ua.call(this,r,t);let s=(0,Et.normalizeId)(n),o=this.refs[s]||this.schemas[s];if(typeof o=="string"){let a=xi.call(this,t,o);return typeof a?.schema!="object"?void 0:ua.call(this,r,a)}if(typeof o?.schema=="object"){if(o.validate||ca.call(this,o),s===(0,Et.normalizeId)(e)){let{schema:a}=o,{schemaId:c}=this.opts,d=a[c];return d&&(i=(0,Et.resolveUrl)(this.opts.uriResolver,i,d)),new zr({schema:a,schemaId:c,root:t,baseId:i})}return ua.call(this,r,o)}}mt.resolveSchema=xi;var b_=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function ua(t,{baseId:e,schema:r,root:n}){var i;if(((i=t.fragment)===null||i===void 0?void 0:i[0])!=="/")return;for(let a of t.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,dd.unescapeFragment)(a)];if(c===void 0)return;r=c;let d=typeof r=="object"&&r[this.opts.schemaId];!b_.has(a)&&d&&(e=(0,Et.resolveUrl)(this.opts.uriResolver,e,d))}let s;if(typeof r!="boolean"&&r.$ref&&!(0,dd.schemaHasRulesButRef)(r,this.RULES)){let a=(0,Et.resolveUrl)(this.opts.uriResolver,e,r.$ref);s=xi.call(this,n,a)}let{schemaId:o}=this.opts;if(s=s||new zr({schema:r,schemaId:o,root:n,baseId:e}),s.schema!==s.root.schema)return s}});var pd=Q((_S,E_)=>{E_.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var vd=Q((wS,md)=>{"use strict";I();R();T();var $_={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};md.exports={HEX:$_}});var Sd=Q((SS,$d)=>{"use strict";I();R();T();var{HEX:S_}=vd(),P_=/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u;function wd(t){if(Ed(t,".")<3)return{host:t,isIPV4:!1};let e=t.match(P_)||[],[r]=e;return r?{host:A_(r,"."),isIPV4:!0}:{host:t,isIPV4:!1}}function fa(t,e=!1){let r="",n=!0;for(let i of t){if(S_[i]===void 0)return;i!=="0"&&n===!0&&(n=!1),n||(r+=i)}return e&&r.length===0&&(r="0"),r}function O_(t){let e=0,r={error:!1,address:"",zone:""},n=[],i=[],s=!1,o=!1,a=!1;function c(){if(i.length){if(s===!1){let d=fa(i);if(d!==void 0)n.push(d);else return r.error=!0,!1}i.length=0}return!0}for(let d=0;d<t.length;d++){let m=t[d];if(!(m==="["||m==="]"))if(m===":"){if(o===!0&&(a=!0),!c())break;if(e++,n.push(":"),e>7){r.error=!0;break}d-1>=0&&t[d-1]===":"&&(o=!0);continue}else if(m==="%"){if(!c())break;s=!0}else{i.push(m);continue}}return i.length&&(s?r.zone=i.join(""):a?n.push(i.join("")):n.push(fa(i))),r.address=n.join(""),r}function bd(t){if(Ed(t,":")<2)return{host:t,isIPV6:!1};let e=O_(t);if(e.error)return{host:t,isIPV6:!1};{let r=e.address,n=e.address;return e.zone&&(r+="%"+e.zone,n+="%25"+e.zone),{host:r,escapedHost:n,isIPV6:!0}}}function A_(t,e){let r="",n=!0,i=t.length;for(let s=0;s<i;s++){let o=t[s];o==="0"&&n?(s+1<=i&&t[s+1]===e||s+1===i)&&(r+=o,n=!1):(o===e?n=!0:n=!1,r+=o)}return r}function Ed(t,e){let r=0;for(let n=0;n<t.length;n++)t[n]===e&&r++;return r}var yd=/^\.\.?\//u,gd=/^\/\.(?:\/|$)/u,_d=/^\/\.\.(?:\/|$)/u,I_=/^\/?(?:.|\n)*?(?=\/|$)/u;function T_(t){let e=[];for(;t.length;)if(t.match(yd))t=t.replace(yd,"");else if(t.match(gd))t=t.replace(gd,"/");else if(t.match(_d))t=t.replace(_d,"/"),e.pop();else if(t==="."||t==="..")t="";else{let r=t.match(I_);if(r){let n=r[0];t=t.slice(n.length),e.push(n)}else throw new Error("Unexpected dot segment condition")}return e.join("")}function R_(t,e){let r=e!==!0?escape:unescape;return t.scheme!==void 0&&(t.scheme=r(t.scheme)),t.userinfo!==void 0&&(t.userinfo=r(t.userinfo)),t.host!==void 0&&(t.host=r(t.host)),t.path!==void 0&&(t.path=r(t.path)),t.query!==void 0&&(t.query=r(t.query)),t.fragment!==void 0&&(t.fragment=r(t.fragment)),t}function q_(t){let e=[];if(t.userinfo!==void 0&&(e.push(t.userinfo),e.push("@")),t.host!==void 0){let r=unescape(t.host),n=wd(r);if(n.isIPV4)r=n.host;else{let i=bd(n.host);i.isIPV6===!0?r=`[${i.escapedHost}]`:r=t.host}e.push(r)}return(typeof t.port=="number"||typeof t.port=="string")&&(e.push(":"),e.push(String(t.port))),e.length?e.join(""):void 0}$d.exports={recomposeAuthority:q_,normalizeComponentEncoding:R_,removeDotSegments:T_,normalizeIPv4:wd,normalizeIPv6:bd,stringArrayToHexStripped:fa}});var Rd=Q((IS,Td)=>{"use strict";I();R();T();var N_=/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu,k_=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;function Pd(t){return typeof t.secure=="boolean"?t.secure:String(t.scheme).toLowerCase()==="wss"}function Od(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function Ad(t){let e=String(t.scheme).toLowerCase()==="https";return(t.port===(e?443:80)||t.port==="")&&(t.port=void 0),t.path||(t.path="/"),t}function C_(t){return t.secure=Pd(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function x_(t){if((t.port===(Pd(t)?443:80)||t.port==="")&&(t.port=void 0),typeof t.secure=="boolean"&&(t.scheme=t.secure?"wss":"ws",t.secure=void 0),t.resourceName){let[e,r]=t.resourceName.split("?");t.path=e&&e!=="/"?e:void 0,t.query=r,t.resourceName=void 0}return t.fragment=void 0,t}function j_(t,e){if(!t.path)return t.error="URN can not be parsed",t;let r=t.path.match(k_);if(r){let n=e.scheme||t.scheme||"urn";t.nid=r[1].toLowerCase(),t.nss=r[2];let i=`${n}:${e.nid||t.nid}`,s=la[i];t.path=void 0,s&&(t=s.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function D_(t,e){let r=e.scheme||t.scheme||"urn",n=t.nid.toLowerCase(),i=`${r}:${e.nid||n}`,s=la[i];s&&(t=s.serialize(t,e));let o=t,a=t.nss;return o.path=`${n||e.nid}:${a}`,e.skipEscape=!0,o}function B_(t,e){let r=t;return r.uuid=r.nss,r.nss=void 0,!e.tolerant&&(!r.uuid||!N_.test(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function L_(t){let e=t;return e.nss=(t.uuid||"").toLowerCase(),e}var Id={scheme:"http",domainHost:!0,parse:Od,serialize:Ad},M_={scheme:"https",domainHost:Id.domainHost,parse:Od,serialize:Ad},Di={scheme:"ws",domainHost:!0,parse:C_,serialize:x_},U_={scheme:"wss",domainHost:Di.domainHost,parse:Di.parse,serialize:Di.serialize},G_={scheme:"urn",parse:j_,serialize:D_,skipNormalize:!0},F_={scheme:"urn:uuid",parse:B_,serialize:L_,skipNormalize:!0},la={http:Id,https:M_,ws:Di,wss:U_,urn:G_,"urn:uuid":F_};Td.exports=la});var Nd=Q((NS,Li)=>{"use strict";I();R();T();var{normalizeIPv6:K_,normalizeIPv4:z_,removeDotSegments:An,recomposeAuthority:V_,normalizeComponentEncoding:Bi}=Sd(),da=Rd();function J_(t,e){return typeof t=="string"?t=Rt(Mt(t,e),e):typeof t=="object"&&(t=Mt(Rt(t,e),e)),t}function H_(t,e,r){let n=Object.assign({scheme:"null"},r),i=qd(Mt(t,n),Mt(e,n),n,!0);return Rt(i,{...n,skipEscape:!0})}function qd(t,e,r,n){let i={};return n||(t=Mt(Rt(t,r),r),e=Mt(Rt(e,r),r)),r=r||{},!r.tolerant&&e.scheme?(i.scheme=e.scheme,i.userinfo=e.userinfo,i.host=e.host,i.port=e.port,i.path=An(e.path||""),i.query=e.query):(e.userinfo!==void 0||e.host!==void 0||e.port!==void 0?(i.userinfo=e.userinfo,i.host=e.host,i.port=e.port,i.path=An(e.path||""),i.query=e.query):(e.path?(e.path.charAt(0)==="/"?i.path=An(e.path):((t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)&&!t.path?i.path="/"+e.path:t.path?i.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+e.path:i.path=e.path,i.path=An(i.path)),i.query=e.query):(i.path=t.path,e.query!==void 0?i.query=e.query:i.query=t.query),i.userinfo=t.userinfo,i.host=t.host,i.port=t.port),i.scheme=t.scheme),i.fragment=e.fragment,i}function W_(t,e,r){return typeof t=="string"?(t=unescape(t),t=Rt(Bi(Mt(t,r),!0),{...r,skipEscape:!0})):typeof t=="object"&&(t=Rt(Bi(t,!0),{...r,skipEscape:!0})),typeof e=="string"?(e=unescape(e),e=Rt(Bi(Mt(e,r),!0),{...r,skipEscape:!0})):typeof e=="object"&&(e=Rt(Bi(e,!0),{...r,skipEscape:!0})),t.toLowerCase()===e.toLowerCase()}function Rt(t,e){let r={host:t.host,scheme:t.scheme,userinfo:t.userinfo,port:t.port,path:t.path,query:t.query,nid:t.nid,nss:t.nss,uuid:t.uuid,fragment:t.fragment,reference:t.reference,resourceName:t.resourceName,secure:t.secure,error:""},n=Object.assign({},e),i=[],s=da[(n.scheme||r.scheme||"").toLowerCase()];s&&s.serialize&&s.serialize(r,n),r.path!==void 0&&(n.skipEscape?r.path=unescape(r.path):(r.path=escape(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),n.reference!=="suffix"&&r.scheme&&i.push(r.scheme,":");let o=V_(r);if(o!==void 0&&(n.reference!=="suffix"&&i.push("//"),i.push(o),r.path&&r.path.charAt(0)!=="/"&&i.push("/")),r.path!==void 0){let a=r.path;!n.absolutePath&&(!s||!s.absolutePath)&&(a=An(a)),o===void 0&&(a=a.replace(/^\/\//u,"/%2F")),i.push(a)}return r.query!==void 0&&i.push("?",r.query),r.fragment!==void 0&&i.push("#",r.fragment),i.join("")}var Q_=Array.from({length:127},(t,e)=>/[^!"$&'()*+,\-.;=_`a-z{}~]/u.test(String.fromCharCode(e)));function Y_(t){let e=0;for(let r=0,n=t.length;r<n;++r)if(e=t.charCodeAt(r),e>126||Q_[e])return!0;return!1}var X_=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function Mt(t,e){let r=Object.assign({},e),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},i=t.indexOf("%")!==-1,s=!1;r.reference==="suffix"&&(t=(r.scheme?r.scheme+":":"")+"//"+t);let o=t.match(X_);if(o){if(n.scheme=o[1],n.userinfo=o[3],n.host=o[4],n.port=parseInt(o[5],10),n.path=o[6]||"",n.query=o[7],n.fragment=o[8],isNaN(n.port)&&(n.port=o[5]),n.host){let c=z_(n.host);if(c.isIPV4===!1){let d=K_(c.host);n.host=d.host.toLowerCase(),s=d.isIPV6}else n.host=c.host,s=!0}n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&n.query===void 0&&!n.path?n.reference="same-document":n.scheme===void 0?n.reference="relative":n.fragment===void 0?n.reference="absolute":n.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==n.reference&&(n.error=n.error||"URI is not a "+r.reference+" reference.");let a=da[(r.scheme||n.scheme||"").toLowerCase()];if(!r.unicodeSupport&&(!a||!a.unicodeSupport)&&n.host&&(r.domainHost||a&&a.domainHost)&&s===!1&&Y_(n.host))try{n.host=URL.domainToASCII(n.host.toLowerCase())}catch(c){n.error=n.error||"Host's domain name can not be converted to ASCII: "+c}(!a||a&&!a.skipNormalize)&&(i&&n.scheme!==void 0&&(n.scheme=unescape(n.scheme)),i&&n.host!==void 0&&(n.host=unescape(n.host)),n.path&&(n.path=escape(unescape(n.path))),n.fragment&&(n.fragment=encodeURI(decodeURIComponent(n.fragment)))),a&&a.parse&&a.parse(n,r)}else n.error=n.error||"URI can not be parsed.";return n}var ha={SCHEMES:da,normalize:J_,resolve:H_,resolveComponents:qd,equal:W_,serialize:Rt,parse:Mt};Li.exports=ha;Li.exports.default=ha;Li.exports.fastUri=ha});var Cd=Q(pa=>{"use strict";I();R();T();Object.defineProperty(pa,"__esModule",{value:!0});var kd=Nd();kd.code='require("ajv/dist/runtime/uri").default';pa.default=kd});var Gd=Q(Ve=>{"use strict";I();R();T();Object.defineProperty(Ve,"__esModule",{value:!0});Ve.CodeGen=Ve.Name=Ve.nil=Ve.stringify=Ve.str=Ve._=Ve.KeywordCxt=void 0;var Z_=Pn();Object.defineProperty(Ve,"KeywordCxt",{enumerable:!0,get:function(){return Z_.KeywordCxt}});var Vr=de();Object.defineProperty(Ve,"_",{enumerable:!0,get:function(){return Vr._}});Object.defineProperty(Ve,"str",{enumerable:!0,get:function(){return Vr.str}});Object.defineProperty(Ve,"stringify",{enumerable:!0,get:function(){return Vr.stringify}});Object.defineProperty(Ve,"nil",{enumerable:!0,get:function(){return Vr.nil}});Object.defineProperty(Ve,"Name",{enumerable:!0,get:function(){return Vr.Name}});Object.defineProperty(Ve,"CodeGen",{enumerable:!0,get:function(){return Vr.CodeGen}});var e0=Ci(),Ld=On(),t0=Ko(),In=ji(),r0=de(),Tn=En(),Mi=bn(),va=be(),xd=pd(),n0=Cd(),Md=(t,e)=>new RegExp(t,e);Md.code="new RegExp";var i0=["removeAdditional","useDefaults","coerceTypes"],s0=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),o0={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},a0={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},jd=200;function u0(t){var e,r,n,i,s,o,a,c,d,m,f,g,_,E,P,S,y,w,p,h,v,b,N,C,j;let G=t.strict,H=(e=t.code)===null||e===void 0?void 0:e.optimize,re=H===!0||H===void 0?1:H||0,Y=(n=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:Md,Z=(i=t.uriResolver)!==null&&i!==void 0?i:n0.default;return{strictSchema:(o=(s=t.strictSchema)!==null&&s!==void 0?s:G)!==null&&o!==void 0?o:!0,strictNumbers:(c=(a=t.strictNumbers)!==null&&a!==void 0?a:G)!==null&&c!==void 0?c:!0,strictTypes:(m=(d=t.strictTypes)!==null&&d!==void 0?d:G)!==null&&m!==void 0?m:"log",strictTuples:(g=(f=t.strictTuples)!==null&&f!==void 0?f:G)!==null&&g!==void 0?g:"log",strictRequired:(E=(_=t.strictRequired)!==null&&_!==void 0?_:G)!==null&&E!==void 0?E:!1,code:t.code?{...t.code,optimize:re,regExp:Y}:{optimize:re,regExp:Y},loopRequired:(P=t.loopRequired)!==null&&P!==void 0?P:jd,loopEnum:(S=t.loopEnum)!==null&&S!==void 0?S:jd,meta:(y=t.meta)!==null&&y!==void 0?y:!0,messages:(w=t.messages)!==null&&w!==void 0?w:!0,inlineRefs:(p=t.inlineRefs)!==null&&p!==void 0?p:!0,schemaId:(h=t.schemaId)!==null&&h!==void 0?h:"$id",addUsedSchema:(v=t.addUsedSchema)!==null&&v!==void 0?v:!0,validateSchema:(b=t.validateSchema)!==null&&b!==void 0?b:!0,validateFormats:(N=t.validateFormats)!==null&&N!==void 0?N:!0,unicodeRegExp:(C=t.unicodeRegExp)!==null&&C!==void 0?C:!0,int32range:(j=t.int32range)!==null&&j!==void 0?j:!0,uriResolver:Z}}var Rn=class{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...u0(e)};let{es5:r,lines:n}=this.opts.code;this.scope=new r0.ValueScope({scope:{},prefixes:s0,es5:r,lines:n}),this.logger=p0(e.logger);let i=e.validateFormats;e.validateFormats=!1,this.RULES=(0,t0.getRules)(),Dd.call(this,o0,e,"NOT SUPPORTED"),Dd.call(this,a0,e,"DEPRECATED","warn"),this._metaOpts=d0.call(this),e.formats&&f0.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&l0.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),c0.call(this),e.validateFormats=i}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:n}=this.opts,i=xd;n==="id"&&(i={...xd},i.id=i.$id,delete i.$id),r&&e&&this.addMetaSchema(i,i[n],!1)}defaultMeta(){let{meta:e,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[r]||e:void 0}validate(e,r){let n;if(typeof e=="string"){if(n=this.getSchema(e),!n)throw new Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let i=n(r);return"$async"in n||(this.errors=n.errors),i}compile(e,r){let n=this._addSchema(e,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return i.call(this,e,r);async function i(m,f){await s.call(this,m.$schema);let g=this._addSchema(m,f);return g.validate||o.call(this,g)}async function s(m){m&&!this.getSchema(m)&&await i.call(this,{$ref:m},!0)}async function o(m){try{return this._compileSchemaEnv(m)}catch(f){if(!(f instanceof Ld.default))throw f;return a.call(this,f),await c.call(this,f.missingSchema),o.call(this,m)}}function a({missingSchema:m,missingRef:f}){if(this.refs[m])throw new Error(`AnySchema ${m} is loaded but ${f} cannot be resolved`)}async function c(m){let f=await d.call(this,m);this.refs[m]||await s.call(this,f.$schema),this.refs[m]||this.addSchema(f,m,r)}async function d(m){let f=this._loading[m];if(f)return f;try{return await(this._loading[m]=n(m))}finally{delete this._loading[m]}}}addSchema(e,r,n,i=this.opts.validateSchema){if(Array.isArray(e)){for(let o of e)this.addSchema(o,void 0,n,i);return this}let s;if(typeof e=="object"){let{schemaId:o}=this.opts;if(s=e[o],s!==void 0&&typeof s!="string")throw new Error(`schema ${o} must be string`)}return r=(0,Tn.normalizeId)(r||s),this._checkUnique(r),this.schemas[r]=this._addSchema(e,n,r,i,!0),this}addMetaSchema(e,r,n=this.opts.validateSchema){return this.addSchema(e,r,!0,n),this}validateSchema(e,r){if(typeof e=="boolean")return!0;let n;if(n=e.$schema,n!==void 0&&typeof n!="string")throw new Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let i=this.validate(n,e);if(!i&&r){let s="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(s);else throw new Error(s)}return i}getSchema(e){let r;for(;typeof(r=Bd.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:n}=this.opts,i=new In.SchemaEnv({schema:{},schemaId:n});if(r=In.resolveSchema.call(this,i,e),!r)return;this.refs[e]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=Bd.call(this,e);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{let r=e;this._cache.delete(r);let n=e[this.opts.schemaId];return n&&(n=(0,Tn.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let r of e)this.addKeyword(r);return this}addKeyword(e,r){let n;if(typeof e=="string")n=e,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof e=="object"&&r===void 0){if(r=e,n=r.keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(v0.call(this,n,r),!r)return(0,va.eachItem)(n,s=>ma.call(this,s)),this;g0.call(this,r);let i={...r,type:(0,Mi.getJSONTypes)(r.type),schemaType:(0,Mi.getJSONTypes)(r.schemaType)};return(0,va.eachItem)(n,i.type.length===0?s=>ma.call(this,s,i):s=>i.type.forEach(o=>ma.call(this,s,i,o))),this}getKeyword(e){let r=this.RULES.all[e];return typeof r=="object"?r.definition:!!r}removeKeyword(e){let{RULES:r}=this;delete r.keywords[e],delete r.all[e];for(let n of r.rules){let i=n.rules.findIndex(s=>s.keyword===e);i>=0&&n.rules.splice(i,1)}return this}addFormat(e,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[e]=r,this}errorsText(e=this.errors,{separator:r=", ",dataVar:n="data"}={}){return!e||e.length===0?"No errors":e.map(i=>`${n}${i.instancePath} ${i.message}`).reduce((i,s)=>i+r+s)}$dataMetaSchema(e,r){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let i of r){let s=i.split("/").slice(1),o=e;for(let a of s)o=o[a];for(let a in n){let c=n[a];if(typeof c!="object")continue;let{$data:d}=c.definition,m=o[a];d&&m&&(o[a]=Ud(m))}}return e}_removeAllSchemas(e,r){for(let n in e){let i=e[n];(!r||r.test(n))&&(typeof i=="string"?delete e[n]:i&&!i.meta&&(this._cache.delete(i.schema),delete e[n]))}}_addSchema(e,r,n,i=this.opts.validateSchema,s=this.opts.addUsedSchema){let o,{schemaId:a}=this.opts;if(typeof e=="object")o=e[a];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof e!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(e);if(c!==void 0)return c;n=(0,Tn.normalizeId)(o||n);let d=Tn.getSchemaRefs.call(this,e,n);return c=new In.SchemaEnv({schema:e,schemaId:a,meta:r,baseId:n,localRefs:d}),this._cache.set(c.schema,c),s&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=c),i&&this.validateSchema(e,!0),c}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):In.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let r=this.opts;this.opts=this._metaOpts;try{In.compileSchema.call(this,e)}finally{this.opts=r}}};Rn.ValidationError=e0.default;Rn.MissingRefError=Ld.default;Ve.default=Rn;function Dd(t,e,r,n="error"){for(let i in t){let s=i;s in e&&this.logger[n](`${r}: option ${i}. ${t[s]}`)}}function Bd(t){return t=(0,Tn.normalizeId)(t),this.schemas[t]||this.refs[t]}function c0(){let t=this.opts.schemas;if(t)if(Array.isArray(t))this.addSchema(t);else for(let e in t)this.addSchema(t[e],e)}function f0(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function l0(t){if(Array.isArray(t)){this.addVocabulary(t);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let e in t){let r=t[e];r.keyword||(r.keyword=e),this.addKeyword(r)}}function d0(){let t={...this.opts};for(let e of i0)delete t[e];return t}var h0={log(){},warn(){},error(){}};function p0(t){if(t===!1)return h0;if(t===void 0)return console;if(t.log&&t.warn&&t.error)return t;throw new Error("logger must implement log, warn and error methods")}var m0=/^[a-z_$][a-z0-9_$:-]*$/i;function v0(t,e){let{RULES:r}=this;if((0,va.eachItem)(t,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!m0.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!e&&e.$data&&!("code"in e||"validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function ma(t,e,r){var n;let i=e?.post;if(r&&i)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:s}=this,o=i?s.post:s.rules.find(({type:c})=>c===r);if(o||(o={type:r,rules:[]},s.rules.push(o)),s.keywords[t]=!0,!e)return;let a={keyword:t,definition:{...e,type:(0,Mi.getJSONTypes)(e.type),schemaType:(0,Mi.getJSONTypes)(e.schemaType)}};e.before?y0.call(this,o,a,e.before):o.rules.push(a),s.all[t]=a,(n=e.implements)===null||n===void 0||n.forEach(c=>this.addKeyword(c))}function y0(t,e,r){let n=t.rules.findIndex(i=>i.keyword===r);n>=0?t.rules.splice(n,0,e):(t.rules.push(e),this.logger.warn(`rule ${r} is not defined`))}function g0(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=Ud(e)),t.validateSchema=this.compile(e,!0))}var _0={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function Ud(t){return{anyOf:[t,_0]}}});var Fd=Q(ya=>{"use strict";I();R();T();Object.defineProperty(ya,"__esModule",{value:!0});var w0={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};ya.default=w0});var Jd=Q(br=>{"use strict";I();R();T();Object.defineProperty(br,"__esModule",{value:!0});br.callRef=br.getValidate=void 0;var b0=On(),Kd=pt(),ut=de(),Jr=Bt(),zd=ji(),Ui=be(),E0={keyword:"$ref",schemaType:"string",code(t){let{gen:e,schema:r,it:n}=t,{baseId:i,schemaEnv:s,validateName:o,opts:a,self:c}=n,{root:d}=s;if((r==="#"||r==="#/")&&i===d.baseId)return f();let m=zd.resolveRef.call(c,d,i,r);if(m===void 0)throw new b0.default(n.opts.uriResolver,i,r);if(m instanceof zd.SchemaEnv)return g(m);return _(m);function f(){if(s===d)return Gi(t,o,s,s.$async);let E=e.scopeValue("root",{ref:d});return Gi(t,(0,ut._)`${E}.validate`,d,d.$async)}function g(E){let P=Vd(t,E);Gi(t,P,E,E.$async)}function _(E){let P=e.scopeValue("schema",a.code.source===!0?{ref:E,code:(0,ut.stringify)(E)}:{ref:E}),S=e.name("valid"),y=t.subschema({schema:E,dataTypes:[],schemaPath:ut.nil,topSchemaRef:P,errSchemaPath:r},S);t.mergeEvaluated(y),t.ok(S)}}};function Vd(t,e){let{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,ut._)`${r.scopeValue("wrapper",{ref:e})}.validate`}br.getValidate=Vd;function Gi(t,e,r,n){let{gen:i,it:s}=t,{allErrors:o,schemaEnv:a,opts:c}=s,d=c.passContext?Jr.default.this:ut.nil;n?m():f();function m(){if(!a.$async)throw new Error("async schema referenced by sync schema");let E=i.let("valid");i.try(()=>{i.code((0,ut._)`await ${(0,Kd.callValidateCode)(t,e,d)}`),_(e),o||i.assign(E,!0)},P=>{i.if((0,ut._)`!(${P} instanceof ${s.ValidationError})`,()=>i.throw(P)),g(P),o||i.assign(E,!1)}),t.ok(E)}function f(){t.result((0,Kd.callValidateCode)(t,e,d),()=>_(e),()=>g(e))}function g(E){let P=(0,ut._)`${E}.errors`;i.assign(Jr.default.vErrors,(0,ut._)`${Jr.default.vErrors} === null ? ${P} : ${Jr.default.vErrors}.concat(${P})`),i.assign(Jr.default.errors,(0,ut._)`${Jr.default.vErrors}.length`)}function _(E){var P;if(!s.opts.unevaluated)return;let S=(P=r?.validate)===null||P===void 0?void 0:P.evaluated;if(s.props!==!0)if(S&&!S.dynamicProps)S.props!==void 0&&(s.props=Ui.mergeEvaluated.props(i,S.props,s.props));else{let y=i.var("props",(0,ut._)`${E}.evaluated.props`);s.props=Ui.mergeEvaluated.props(i,y,s.props,ut.Name)}if(s.items!==!0)if(S&&!S.dynamicItems)S.items!==void 0&&(s.items=Ui.mergeEvaluated.items(i,S.items,s.items));else{let y=i.var("items",(0,ut._)`${E}.evaluated.items`);s.items=Ui.mergeEvaluated.items(i,y,s.items,ut.Name)}}}br.callRef=Gi;br.default=E0});var Hd=Q(ga=>{"use strict";I();R();T();Object.defineProperty(ga,"__esModule",{value:!0});var $0=Fd(),S0=Jd(),P0=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",$0.default,S0.default];ga.default=P0});var Wd=Q(_a=>{"use strict";I();R();T();Object.defineProperty(_a,"__esModule",{value:!0});var Fi=de(),Yt=Fi.operators,Ki={maximum:{okStr:"<=",ok:Yt.LTE,fail:Yt.GT},minimum:{okStr:">=",ok:Yt.GTE,fail:Yt.LT},exclusiveMaximum:{okStr:"<",ok:Yt.LT,fail:Yt.GTE},exclusiveMinimum:{okStr:">",ok:Yt.GT,fail:Yt.LTE}},O0={message:({keyword:t,schemaCode:e})=>(0,Fi.str)`must be ${Ki[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,Fi._)`{comparison: ${Ki[t].okStr}, limit: ${e}}`},A0={keyword:Object.keys(Ki),type:"number",schemaType:"number",$data:!0,error:O0,code(t){let{keyword:e,data:r,schemaCode:n}=t;t.fail$data((0,Fi._)`${r} ${Ki[e].fail} ${n} || isNaN(${r})`)}};_a.default=A0});var Qd=Q(wa=>{"use strict";I();R();T();Object.defineProperty(wa,"__esModule",{value:!0});var qn=de(),I0={message:({schemaCode:t})=>(0,qn.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,qn._)`{multipleOf: ${t}}`},T0={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:I0,code(t){let{gen:e,data:r,schemaCode:n,it:i}=t,s=i.opts.multipleOfPrecision,o=e.let("res"),a=s?(0,qn._)`Math.abs(Math.round(${o}) - ${o}) > 1e-${s}`:(0,qn._)`${o} !== parseInt(${o})`;t.fail$data((0,qn._)`(${n} === 0 || (${o} = ${r}/${n}, ${a}))`)}};wa.default=T0});var Xd=Q(ba=>{"use strict";I();R();T();Object.defineProperty(ba,"__esModule",{value:!0});function Yd(t){let e=t.length,r=0,n=0,i;for(;n<e;)r++,i=t.charCodeAt(n++),i>=55296&&i<=56319&&n<e&&(i=t.charCodeAt(n),(i&64512)===56320&&n++);return r}ba.default=Yd;Yd.code='require("ajv/dist/runtime/ucs2length").default'});var Zd=Q(Ea=>{"use strict";I();R();T();Object.defineProperty(Ea,"__esModule",{value:!0});var Er=de(),R0=be(),q0=Xd(),N0={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return(0,Er.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,Er._)`{limit: ${t}}`},k0={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:N0,code(t){let{keyword:e,data:r,schemaCode:n,it:i}=t,s=e==="maxLength"?Er.operators.GT:Er.operators.LT,o=i.opts.unicode===!1?(0,Er._)`${r}.length`:(0,Er._)`${(0,R0.useFunc)(t.gen,q0.default)}(${r})`;t.fail$data((0,Er._)`${o} ${s} ${n}`)}};Ea.default=k0});var eh=Q($a=>{"use strict";I();R();T();Object.defineProperty($a,"__esModule",{value:!0});var C0=pt(),zi=de(),x0={message:({schemaCode:t})=>(0,zi.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,zi._)`{pattern: ${t}}`},j0={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:x0,code(t){let{data:e,$data:r,schema:n,schemaCode:i,it:s}=t,o=s.opts.unicodeRegExp?"u":"",a=r?(0,zi._)`(new RegExp(${i}, ${o}))`:(0,C0.usePattern)(t,n);t.fail$data((0,zi._)`!${a}.test(${e})`)}};$a.default=j0});var th=Q(Sa=>{"use strict";I();R();T();Object.defineProperty(Sa,"__esModule",{value:!0});var Nn=de(),D0={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return(0,Nn.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,Nn._)`{limit: ${t}}`},B0={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:D0,code(t){let{keyword:e,data:r,schemaCode:n}=t,i=e==="maxProperties"?Nn.operators.GT:Nn.operators.LT;t.fail$data((0,Nn._)`Object.keys(${r}).length ${i} ${n}`)}};Sa.default=B0});var rh=Q(Pa=>{"use strict";I();R();T();Object.defineProperty(Pa,"__esModule",{value:!0});var kn=pt(),Cn=de(),L0=be(),M0={message:({params:{missingProperty:t}})=>(0,Cn.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,Cn._)`{missingProperty: ${t}}`},U0={keyword:"required",type:"object",schemaType:"array",$data:!0,error:M0,code(t){let{gen:e,schema:r,schemaCode:n,data:i,$data:s,it:o}=t,{opts:a}=o;if(!s&&r.length===0)return;let c=r.length>=a.loopRequired;if(o.allErrors?d():m(),a.strictRequired){let _=t.parentSchema.properties,{definedProperties:E}=t.it;for(let P of r)if(_?.[P]===void 0&&!E.has(P)){let S=o.schemaEnv.baseId+o.errSchemaPath,y=`required property "${P}" is not defined at "${S}" (strictRequired)`;(0,L0.checkStrictMode)(o,y,o.opts.strictRequired)}}function d(){if(c||s)t.block$data(Cn.nil,f);else for(let _ of r)(0,kn.checkReportMissingProp)(t,_)}function m(){let _=e.let("missing");if(c||s){let E=e.let("valid",!0);t.block$data(E,()=>g(_,E)),t.ok(E)}else e.if((0,kn.checkMissingProp)(t,r,_)),(0,kn.reportMissingProp)(t,_),e.else()}function f(){e.forOf("prop",n,_=>{t.setParams({missingProperty:_}),e.if((0,kn.noPropertyInData)(e,i,_,a.ownProperties),()=>t.error())})}function g(_,E){t.setParams({missingProperty:_}),e.forOf(_,n,()=>{e.assign(E,(0,kn.propertyInData)(e,i,_,a.ownProperties)),e.if((0,Cn.not)(E),()=>{t.error(),e.break()})},Cn.nil)}}};Pa.default=U0});var nh=Q(Oa=>{"use strict";I();R();T();Object.defineProperty(Oa,"__esModule",{value:!0});var xn=de(),G0={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return(0,xn.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,xn._)`{limit: ${t}}`},F0={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:G0,code(t){let{keyword:e,data:r,schemaCode:n}=t,i=e==="maxItems"?xn.operators.GT:xn.operators.LT;t.fail$data((0,xn._)`${r}.length ${i} ${n}`)}};Oa.default=F0});var Vi=Q(Aa=>{"use strict";I();R();T();Object.defineProperty(Aa,"__esModule",{value:!0});var ih=Xo();ih.code='require("ajv/dist/runtime/equal").default';Aa.default=ih});var sh=Q(Ta=>{"use strict";I();R();T();Object.defineProperty(Ta,"__esModule",{value:!0});var Ia=bn(),Je=de(),K0=be(),z0=Vi(),V0={message:({params:{i:t,j:e}})=>(0,Je.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,Je._)`{i: ${t}, j: ${e}}`},J0={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:V0,code(t){let{gen:e,data:r,$data:n,schema:i,parentSchema:s,schemaCode:o,it:a}=t;if(!n&&!i)return;let c=e.let("valid"),d=s.items?(0,Ia.getSchemaTypes)(s.items):[];t.block$data(c,m,(0,Je._)`${o} === false`),t.ok(c);function m(){let E=e.let("i",(0,Je._)`${r}.length`),P=e.let("j");t.setParams({i:E,j:P}),e.assign(c,!0),e.if((0,Je._)`${E} > 1`,()=>(f()?g:_)(E,P))}function f(){return d.length>0&&!d.some(E=>E==="object"||E==="array")}function g(E,P){let S=e.name("item"),y=(0,Ia.checkDataTypes)(d,S,a.opts.strictNumbers,Ia.DataType.Wrong),w=e.const("indices",(0,Je._)`{}`);e.for((0,Je._)`;${E}--;`,()=>{e.let(S,(0,Je._)`${r}[${E}]`),e.if(y,(0,Je._)`continue`),d.length>1&&e.if((0,Je._)`typeof ${S} == "string"`,(0,Je._)`${S} += "_"`),e.if((0,Je._)`typeof ${w}[${S}] == "number"`,()=>{e.assign(P,(0,Je._)`${w}[${S}]`),t.error(),e.assign(c,!1).break()}).code((0,Je._)`${w}[${S}] = ${E}`)})}function _(E,P){let S=(0,K0.useFunc)(e,z0.default),y=e.name("outer");e.label(y).for((0,Je._)`;${E}--;`,()=>e.for((0,Je._)`${P} = ${E}; ${P}--;`,()=>e.if((0,Je._)`${S}(${r}[${E}], ${r}[${P}])`,()=>{t.error(),e.assign(c,!1).break(y)})))}}};Ta.default=J0});var oh=Q(qa=>{"use strict";I();R();T();Object.defineProperty(qa,"__esModule",{value:!0});var Ra=de(),H0=be(),W0=Vi(),Q0={message:"must be equal to constant",params:({schemaCode:t})=>(0,Ra._)`{allowedValue: ${t}}`},Y0={keyword:"const",$data:!0,error:Q0,code(t){let{gen:e,data:r,$data:n,schemaCode:i,schema:s}=t;n||s&&typeof s=="object"?t.fail$data((0,Ra._)`!${(0,H0.useFunc)(e,W0.default)}(${r}, ${i})`):t.fail((0,Ra._)`${s} !== ${r}`)}};qa.default=Y0});var ah=Q(Na=>{"use strict";I();R();T();Object.defineProperty(Na,"__esModule",{value:!0});var jn=de(),X0=be(),Z0=Vi(),ew={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,jn._)`{allowedValues: ${t}}`},tw={keyword:"enum",schemaType:"array",$data:!0,error:ew,code(t){let{gen:e,data:r,$data:n,schema:i,schemaCode:s,it:o}=t;if(!n&&i.length===0)throw new Error("enum must have non-empty array");let a=i.length>=o.opts.loopEnum,c,d=()=>c??(c=(0,X0.useFunc)(e,Z0.default)),m;if(a||n)m=e.let("valid"),t.block$data(m,f);else{if(!Array.isArray(i))throw new Error("ajv implementation error");let _=e.const("vSchema",s);m=(0,jn.or)(...i.map((E,P)=>g(_,P)))}t.pass(m);function f(){e.assign(m,!1),e.forOf("v",s,_=>e.if((0,jn._)`${d()}(${r}, ${_})`,()=>e.assign(m,!0).break()))}function g(_,E){let P=i[E];return typeof P=="object"&&P!==null?(0,jn._)`${d()}(${r}, ${_}[${E}])`:(0,jn._)`${r} === ${P}`}}};Na.default=tw});var uh=Q(ka=>{"use strict";I();R();T();Object.defineProperty(ka,"__esModule",{value:!0});var rw=Wd(),nw=Qd(),iw=Zd(),sw=eh(),ow=th(),aw=rh(),uw=nh(),cw=sh(),fw=oh(),lw=ah(),dw=[rw.default,nw.default,iw.default,sw.default,ow.default,aw.default,uw.default,cw.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},fw.default,lw.default];ka.default=dw});var xa=Q(Dn=>{"use strict";I();R();T();Object.defineProperty(Dn,"__esModule",{value:!0});Dn.validateAdditionalItems=void 0;var $r=de(),Ca=be(),hw={message:({params:{len:t}})=>(0,$r.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,$r._)`{limit: ${t}}`},pw={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:hw,code(t){let{parentSchema:e,it:r}=t,{items:n}=e;if(!Array.isArray(n)){(0,Ca.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}ch(t,n)}};function ch(t,e){let{gen:r,schema:n,data:i,keyword:s,it:o}=t;o.items=!0;let a=r.const("len",(0,$r._)`${i}.length`);if(n===!1)t.setParams({len:e.length}),t.pass((0,$r._)`${a} <= ${e.length}`);else if(typeof n=="object"&&!(0,Ca.alwaysValidSchema)(o,n)){let d=r.var("valid",(0,$r._)`${a} <= ${e.length}`);r.if((0,$r.not)(d),()=>c(d)),t.ok(d)}function c(d){r.forRange("i",e.length,a,m=>{t.subschema({keyword:s,dataProp:m,dataPropType:Ca.Type.Num},d),o.allErrors||r.if((0,$r.not)(d),()=>r.break())})}}Dn.validateAdditionalItems=ch;Dn.default=pw});var ja=Q(Bn=>{"use strict";I();R();T();Object.defineProperty(Bn,"__esModule",{value:!0});Bn.validateTuple=void 0;var fh=de(),Ji=be(),mw=pt(),vw={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return lh(t,"additionalItems",e);r.items=!0,!(0,Ji.alwaysValidSchema)(r,e)&&t.ok((0,mw.validateArray)(t))}};function lh(t,e,r=t.schema){let{gen:n,parentSchema:i,data:s,keyword:o,it:a}=t;m(i),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=Ji.mergeEvaluated.items(n,r.length,a.items));let c=n.name("valid"),d=n.const("len",(0,fh._)`${s}.length`);r.forEach((f,g)=>{(0,Ji.alwaysValidSchema)(a,f)||(n.if((0,fh._)`${d} > ${g}`,()=>t.subschema({keyword:o,schemaProp:g,dataProp:g},c)),t.ok(c))});function m(f){let{opts:g,errSchemaPath:_}=a,E=r.length,P=E===f.minItems&&(E===f.maxItems||f[e]===!1);if(g.strictTuples&&!P){let S=`"${o}" is ${E}-tuple, but minItems or maxItems/${e} are not specified or different at path "${_}"`;(0,Ji.checkStrictMode)(a,S,g.strictTuples)}}}Bn.validateTuple=lh;Bn.default=vw});var dh=Q(Da=>{"use strict";I();R();T();Object.defineProperty(Da,"__esModule",{value:!0});var yw=ja(),gw={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,yw.validateTuple)(t,"items")};Da.default=gw});var ph=Q(Ba=>{"use strict";I();R();T();Object.defineProperty(Ba,"__esModule",{value:!0});var hh=de(),_w=be(),ww=pt(),bw=xa(),Ew={message:({params:{len:t}})=>(0,hh.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,hh._)`{limit: ${t}}`},$w={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:Ew,code(t){let{schema:e,parentSchema:r,it:n}=t,{prefixItems:i}=r;n.items=!0,!(0,_w.alwaysValidSchema)(n,e)&&(i?(0,bw.validateAdditionalItems)(t,i):t.ok((0,ww.validateArray)(t)))}};Ba.default=$w});var mh=Q(La=>{"use strict";I();R();T();Object.defineProperty(La,"__esModule",{value:!0});var vt=de(),Hi=be(),Sw={message:({params:{min:t,max:e}})=>e===void 0?(0,vt.str)`must contain at least ${t} valid item(s)`:(0,vt.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,vt._)`{minContains: ${t}}`:(0,vt._)`{minContains: ${t}, maxContains: ${e}}`},Pw={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:Sw,code(t){let{gen:e,schema:r,parentSchema:n,data:i,it:s}=t,o,a,{minContains:c,maxContains:d}=n;s.opts.next?(o=c===void 0?1:c,a=d):o=1;let m=e.const("len",(0,vt._)`${i}.length`);if(t.setParams({min:o,max:a}),a===void 0&&o===0){(0,Hi.checkStrictMode)(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&o>a){(0,Hi.checkStrictMode)(s,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,Hi.alwaysValidSchema)(s,r)){let P=(0,vt._)`${m} >= ${o}`;a!==void 0&&(P=(0,vt._)`${P} && ${m} <= ${a}`),t.pass(P);return}s.items=!0;let f=e.name("valid");a===void 0&&o===1?_(f,()=>e.if(f,()=>e.break())):o===0?(e.let(f,!0),a!==void 0&&e.if((0,vt._)`${i}.length > 0`,g)):(e.let(f,!1),g()),t.result(f,()=>t.reset());function g(){let P=e.name("_valid"),S=e.let("count",0);_(P,()=>e.if(P,()=>E(S)))}function _(P,S){e.forRange("i",0,m,y=>{t.subschema({keyword:"contains",dataProp:y,dataPropType:Hi.Type.Num,compositeRule:!0},P),S()})}function E(P){e.code((0,vt._)`${P}++`),a===void 0?e.if((0,vt._)`${P} >= ${o}`,()=>e.assign(f,!0).break()):(e.if((0,vt._)`${P} > ${a}`,()=>e.assign(f,!1).break()),o===1?e.assign(f,!0):e.if((0,vt._)`${P} >= ${o}`,()=>e.assign(f,!0)))}}};La.default=Pw});var gh=Q(qt=>{"use strict";I();R();T();Object.defineProperty(qt,"__esModule",{value:!0});qt.validateSchemaDeps=qt.validatePropertyDeps=qt.error=void 0;var Ma=de(),Ow=be(),Ln=pt();qt.error={message:({params:{property:t,depsCount:e,deps:r}})=>{let n=e===1?"property":"properties";return(0,Ma.str)`must have ${n} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:n}})=>(0,Ma._)`{property: ${t},
|
|
6
7
|
missingProperty: ${n},
|
|
7
8
|
depsCount: ${e},
|
|
8
|
-
deps: ${r}}`};var Og={keyword:"dependencies",type:"object",schemaType:"object",error:At.error,code(t){let[e,r]=Ag(t);Hl(t,e),Wl(t,r)}};function Ag({schema:t}){let e={},r={};for(let n in t){if(n==="__proto__")continue;let i=Array.isArray(t[n])?e:r;i[n]=t[n]}return[e,r]}function Hl(t,e=t.schema){let{gen:r,data:n,it:i}=t;if(Object.keys(e).length===0)return;let s=r.let("missing");for(let o in e){let a=e[o];if(a.length===0)continue;let c=(0,An.propertyInData)(r,n,o,i.opts.ownProperties);t.setParams({property:o,depsCount:a.length,deps:a.join(", ")}),i.allErrors?r.if(c,()=>{for(let d of a)(0,An.checkReportMissingProp)(t,d)}):(r.if((0,xo._)`${c} && (${(0,An.checkMissingProp)(t,a,s)})`),(0,An.reportMissingProp)(t,s),r.else())}}At.validatePropertyDeps=Hl;function Wl(t,e=t.schema){let{gen:r,data:n,keyword:i,it:s}=t,o=r.name("valid");for(let a in e)(0,Pg.alwaysValidSchema)(s,e[a])||(r.if((0,An.propertyInData)(r,n,a,s.opts.ownProperties),()=>{let c=t.subschema({keyword:i,schemaProp:a},o);t.mergeValidEvaluated(c,o)},()=>r.var(o,!0)),t.ok(o))}At.validateSchemaDeps=Wl;At.default=Og});var Xl=Y(No=>{"use strict";I();R();T();Object.defineProperty(No,"__esModule",{value:!0});var Yl=pe(),Ig=be(),Tg={message:"property name must be valid",params:({params:t})=>(0,Yl._)`{propertyName: ${t.propertyName}}`},Rg={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:Tg,code(t){let{gen:e,schema:r,data:n,it:i}=t;if((0,Ig.alwaysValidSchema)(i,r))return;let s=e.name("valid");e.forIn("key",n,o=>{t.setParams({propertyName:o}),t.subschema({keyword:"propertyNames",data:o,dataTypes:["string"],propertyName:o,compositeRule:!0},s),e.if((0,Yl.not)(s),()=>{t.error(!0),i.allErrors||e.break()})}),t.ok(s)}};No.default=Rg});var Do=Y(jo=>{"use strict";I();R();T();Object.defineProperty(jo,"__esModule",{value:!0});var gi=lt(),wt=pe(),qg=Dt(),_i=be(),Cg={message:"must NOT have additional properties",params:({params:t})=>(0,wt._)`{additionalProperty: ${t.additionalProperty}}`},kg={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:Cg,code(t){let{gen:e,schema:r,parentSchema:n,data:i,errsCount:s,it:o}=t;if(!s)throw new Error("ajv implementation error");let{allErrors:a,opts:c}=o;if(o.props=!0,c.removeAdditional!=="all"&&(0,_i.alwaysValidSchema)(o,r))return;let d=(0,gi.allSchemaProperties)(n.properties),m=(0,gi.allSchemaProperties)(n.patternProperties);f(),t.ok((0,wt._)`${s} === ${qg.default.errors}`);function f(){e.forIn("key",i,S=>{!d.length&&!m.length?b(S):e.if(g(S),()=>b(S))})}function g(S){let y;if(d.length>8){let w=(0,_i.schemaRefOrVal)(o,n.properties,"properties");y=(0,gi.isOwnProperty)(e,w,S)}else d.length?y=(0,wt.or)(...d.map(w=>(0,wt._)`${S} === ${w}`)):y=wt.nil;return m.length&&(y=(0,wt.or)(y,...m.map(w=>(0,wt._)`${(0,gi.usePattern)(t,w)}.test(${S})`))),(0,wt.not)(y)}function _(S){e.code((0,wt._)`delete ${i}[${S}]`)}function b(S){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){_(S);return}if(r===!1){t.setParams({additionalProperty:S}),t.error(),a||e.break();return}if(typeof r=="object"&&!(0,_i.alwaysValidSchema)(o,r)){let y=e.name("valid");c.removeAdditional==="failing"?(P(S,y,!1),e.if((0,wt.not)(y),()=>{t.reset(),_(S)})):(P(S,y),a||e.if((0,wt.not)(y),()=>e.break()))}}function P(S,y,w){let p={keyword:"additionalProperties",dataProp:S,dataPropType:_i.Type.Str};w===!1&&Object.assign(p,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(p,y)}}};jo.default=kg});var td=Y(Lo=>{"use strict";I();R();T();Object.defineProperty(Lo,"__esModule",{value:!0});var xg=ii(),Zl=lt(),Bo=be(),ed=Do(),Ng={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,parentSchema:n,data:i,it:s}=t;s.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&ed.default.code(new xg.KeywordCxt(s,ed.default,"additionalProperties"));let o=(0,Zl.allSchemaProperties)(r);for(let f of o)s.definedProperties.add(f);s.opts.unevaluated&&o.length&&s.props!==!0&&(s.props=Bo.mergeEvaluated.props(e,(0,Bo.toHash)(o),s.props));let a=o.filter(f=>!(0,Bo.alwaysValidSchema)(s,r[f]));if(a.length===0)return;let c=e.name("valid");for(let f of a)d(f)?m(f):(e.if((0,Zl.propertyInData)(e,i,f,s.opts.ownProperties)),m(f),s.allErrors||e.else().var(c,!0),e.endIf()),t.it.definedProperties.add(f),t.ok(c);function d(f){return s.opts.useDefaults&&!s.compositeRule&&r[f].default!==void 0}function m(f){t.subschema({keyword:"properties",schemaProp:f,dataProp:f},c)}}};Lo.default=Ng});var sd=Y(Mo=>{"use strict";I();R();T();Object.defineProperty(Mo,"__esModule",{value:!0});var rd=lt(),wi=pe(),nd=be(),id=be(),jg={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,data:n,parentSchema:i,it:s}=t,{opts:o}=s,a=(0,rd.allSchemaProperties)(r),c=a.filter(P=>(0,nd.alwaysValidSchema)(s,r[P]));if(a.length===0||c.length===a.length&&(!s.opts.unevaluated||s.props===!0))return;let d=o.strictSchema&&!o.allowMatchingProperties&&i.properties,m=e.name("valid");s.props!==!0&&!(s.props instanceof wi.Name)&&(s.props=(0,id.evaluatedPropsToName)(e,s.props));let{props:f}=s;g();function g(){for(let P of a)d&&_(P),s.allErrors?b(P):(e.var(m,!0),b(P),e.if(m))}function _(P){for(let S in d)new RegExp(P).test(S)&&(0,nd.checkStrictMode)(s,`property ${S} matches pattern ${P} (use allowMatchingProperties)`)}function b(P){e.forIn("key",n,S=>{e.if((0,wi._)`${(0,rd.usePattern)(t,P)}.test(${S})`,()=>{let y=c.includes(P);y||t.subschema({keyword:"patternProperties",schemaProp:P,dataProp:S,dataPropType:id.Type.Str},m),s.opts.unevaluated&&f!==!0?e.assign((0,wi._)`${f}[${S}]`,!0):!y&&!s.allErrors&&e.if((0,wi.not)(m),()=>e.break())})})}}};Mo.default=jg});var od=Y(Uo=>{"use strict";I();R();T();Object.defineProperty(Uo,"__esModule",{value:!0});var Dg=be(),Bg={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:n}=t;if((0,Dg.alwaysValidSchema)(n,r)){t.fail();return}let i=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},i),t.failResult(i,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};Uo.default=Bg});var ad=Y(Go=>{"use strict";I();R();T();Object.defineProperty(Go,"__esModule",{value:!0});var Lg=lt(),Mg={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Lg.validateUnion,error:{message:"must match a schema in anyOf"}};Go.default=Mg});var ud=Y(Fo=>{"use strict";I();R();T();Object.defineProperty(Fo,"__esModule",{value:!0});var bi=pe(),Ug=be(),Gg={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,bi._)`{passingSchemas: ${t.passing}}`},Fg={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:Gg,code(t){let{gen:e,schema:r,parentSchema:n,it:i}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(i.opts.discriminator&&n.discriminator)return;let s=r,o=e.let("valid",!1),a=e.let("passing",null),c=e.name("_valid");t.setParams({passing:a}),e.block(d),t.result(o,()=>t.reset(),()=>t.error(!0));function d(){s.forEach((m,f)=>{let g;(0,Ug.alwaysValidSchema)(i,m)?e.var(c,!0):g=t.subschema({keyword:"oneOf",schemaProp:f,compositeRule:!0},c),f>0&&e.if((0,bi._)`${c} && ${o}`).assign(o,!1).assign(a,(0,bi._)`[${a}, ${f}]`).else(),e.if(c,()=>{e.assign(o,!0),e.assign(a,f),g&&t.mergeEvaluated(g,bi.Name)})})}}};Fo.default=Fg});var cd=Y(Ko=>{"use strict";I();R();T();Object.defineProperty(Ko,"__esModule",{value:!0});var Kg=be(),zg={keyword:"allOf",schemaType:"array",code(t){let{gen:e,schema:r,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");let i=e.name("valid");r.forEach((s,o)=>{if((0,Kg.alwaysValidSchema)(n,s))return;let a=t.subschema({keyword:"allOf",schemaProp:o},i);t.ok(i),t.mergeEvaluated(a)})}};Ko.default=zg});var dd=Y(zo=>{"use strict";I();R();T();Object.defineProperty(zo,"__esModule",{value:!0});var Ei=pe(),ld=be(),Vg={message:({params:t})=>(0,Ei.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,Ei._)`{failingKeyword: ${t.ifClause}}`},Jg={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:Vg,code(t){let{gen:e,parentSchema:r,it:n}=t;r.then===void 0&&r.else===void 0&&(0,ld.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let i=fd(n,"then"),s=fd(n,"else");if(!i&&!s)return;let o=e.let("valid",!0),a=e.name("_valid");if(c(),t.reset(),i&&s){let m=e.let("ifClause");t.setParams({ifClause:m}),e.if(a,d("then",m),d("else",m))}else i?e.if(a,d("then")):e.if((0,Ei.not)(a),d("else"));t.pass(o,()=>t.error(!0));function c(){let m=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);t.mergeEvaluated(m)}function d(m,f){return()=>{let g=t.subschema({keyword:m},a);e.assign(o,a),t.mergeValidEvaluated(g,o),f?e.assign(f,(0,Ei._)`${m}`):t.setParams({ifClause:m})}}}};function fd(t,e){let r=t.schema[e];return r!==void 0&&!(0,ld.alwaysValidSchema)(t,r)}zo.default=Jg});var hd=Y(Vo=>{"use strict";I();R();T();Object.defineProperty(Vo,"__esModule",{value:!0});var Hg=be(),Wg={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,Hg.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};Vo.default=Wg});var pd=Y(Jo=>{"use strict";I();R();T();Object.defineProperty(Jo,"__esModule",{value:!0});var Qg=To(),Yg=Kl(),Xg=Ro(),Zg=Vl(),e_=Jl(),t_=Ql(),r_=Xl(),n_=Do(),i_=td(),s_=sd(),o_=od(),a_=ad(),u_=ud(),c_=cd(),f_=dd(),l_=hd();function d_(t=!1){let e=[o_.default,a_.default,u_.default,c_.default,f_.default,l_.default,r_.default,n_.default,t_.default,i_.default,s_.default];return t?e.push(Yg.default,Zg.default):e.push(Qg.default,Xg.default),e.push(e_.default),e}Jo.default=d_});var md=Y(Ho=>{"use strict";I();R();T();Object.defineProperty(Ho,"__esModule",{value:!0});var je=pe(),h_={message:({schemaCode:t})=>(0,je.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,je._)`{format: ${t}}`},p_={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:h_,code(t,e){let{gen:r,data:n,$data:i,schema:s,schemaCode:o,it:a}=t,{opts:c,errSchemaPath:d,schemaEnv:m,self:f}=a;if(!c.validateFormats)return;i?g():_();function g(){let b=r.scopeValue("formats",{ref:f.formats,code:c.code.formats}),P=r.const("fDef",(0,je._)`${b}[${o}]`),S=r.let("fType"),y=r.let("format");r.if((0,je._)`typeof ${P} == "object" && !(${P} instanceof RegExp)`,()=>r.assign(S,(0,je._)`${P}.type || "string"`).assign(y,(0,je._)`${P}.validate`),()=>r.assign(S,(0,je._)`"string"`).assign(y,P)),t.fail$data((0,je.or)(w(),p()));function w(){return c.strictSchema===!1?je.nil:(0,je._)`${o} && !${y}`}function p(){let h=m.$async?(0,je._)`(${P}.async ? await ${y}(${n}) : ${y}(${n}))`:(0,je._)`${y}(${n})`,v=(0,je._)`(typeof ${y} == "function" ? ${h} : ${y}.test(${n}))`;return(0,je._)`${y} && ${y} !== true && ${S} === ${e} && !${v}`}}function _(){let b=f.formats[s];if(!b){w();return}if(b===!0)return;let[P,S,y]=p(b);P===e&&t.pass(h());function w(){if(c.strictSchema===!1){f.logger.warn(v());return}throw new Error(v());function v(){return`unknown format "${s}" ignored in schema at path "${d}"`}}function p(v){let E=v instanceof RegExp?(0,je.regexpCode)(v):c.code.formats?(0,je._)`${c.code.formats}${(0,je.getProperty)(s)}`:void 0,C=r.scopeValue("formats",{key:s,ref:v,code:E});return typeof v=="object"&&!(v instanceof RegExp)?[v.type||"string",v.validate,(0,je._)`${C}.validate`]:["string",v,C]}function h(){if(typeof b=="object"&&!(b instanceof RegExp)&&b.async){if(!m.$async)throw new Error("async format in sync schema");return(0,je._)`await ${y}(${n})`}return typeof S=="function"?(0,je._)`${y}(${n})`:(0,je._)`${y}.test(${n})`}}}};Ho.default=p_});var vd=Y(Wo=>{"use strict";I();R();T();Object.defineProperty(Wo,"__esModule",{value:!0});var m_=md(),v_=[m_.default];Wo.default=v_});var yd=Y(Qo=>{"use strict";I();R();T();Object.defineProperty(Qo,"__esModule",{value:!0});var y_=Sl(),g_=Ml(),__=pd(),w_=vd(),b_=["title","description","default"],E_=[y_.default,g_.default,__.default(),w_.default,b_];Qo.default=E_});var _d=Y($i=>{"use strict";I();R();T();Object.defineProperty($i,"__esModule",{value:!0});$i.DiscrError=void 0;var gd;(function(t){t.Tag="tag",t.Mapping="mapping"})(gd||($i.DiscrError=gd={}))});var bd=Y(Xo=>{"use strict";I();R();T();Object.defineProperty(Xo,"__esModule",{value:!0});var Br=pe(),Yo=_d(),wd=ai(),$_=si(),S_=be(),P_={message:({params:{discrError:t,tagName:e}})=>t===Yo.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,Br._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},O_={keyword:"discriminator",type:"object",schemaType:"object",error:P_,code(t){let{gen:e,data:r,schema:n,parentSchema:i,it:s}=t,{oneOf:o}=i;if(!s.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=n.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!o)throw new Error("discriminator: requires oneOf keyword");let c=e.let("valid",!1),d=e.const("tag",(0,Br._)`${r}${(0,Br.getProperty)(a)}`);e.if((0,Br._)`typeof ${d} == "string"`,()=>m(),()=>t.error(!1,{discrError:Yo.DiscrError.Tag,tag:d,tagName:a})),t.ok(c);function m(){let _=g();e.if(!1);for(let b in _)e.elseIf((0,Br._)`${d} === ${b}`),e.assign(c,f(_[b]));e.else(),t.error(!1,{discrError:Yo.DiscrError.Mapping,tag:d,tagName:a}),e.endIf()}function f(_){let b=e.name("valid"),P=t.subschema({keyword:"oneOf",schemaProp:_},b);return t.mergeEvaluated(P,Br.Name),b}function g(){var _;let b={},P=y(i),S=!0;for(let h=0;h<o.length;h++){let v=o[h];if(v?.$ref&&!(0,S_.schemaHasRulesButRef)(v,s.self.RULES)){let C=v.$ref;if(v=wd.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,C),v instanceof wd.SchemaEnv&&(v=v.schema),v===void 0)throw new $_.default(s.opts.uriResolver,s.baseId,C)}let E=(_=v?.properties)===null||_===void 0?void 0:_[a];if(typeof E!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);S=S&&(P||y(v)),w(E,h)}if(!S)throw new Error(`discriminator: "${a}" must be required`);return b;function y({required:h}){return Array.isArray(h)&&h.includes(a)}function w(h,v){if(h.const)p(h.const,v);else if(h.enum)for(let E of h.enum)p(E,v);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function p(h,v){if(typeof h!="string"||h in b)throw new Error(`discriminator: "${a}" values must be unique strings`);b[h]=v}}}};Xo.default=O_});var Ed=Y((cO,A_)=>{A_.exports={id:"http://json-schema.org/draft-04/schema#",$schema:"http://json-schema.org/draft-04/schema#",description:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},positiveInteger:{type:"integer",minimum:0},positiveIntegerDefault0:{allOf:[{$ref:"#/definitions/positiveInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},minItems:1,uniqueItems:!0}},type:"object",properties:{id:{type:"string",format:"uri"},$schema:{type:"string",format:"uri"},title:{type:"string"},description:{type:"string"},default:{},multipleOf:{type:"number",minimum:0,exclusiveMinimum:!0},maximum:{type:"number"},exclusiveMaximum:{type:"boolean",default:!1},minimum:{type:"number"},exclusiveMinimum:{type:"boolean",default:!1},maxLength:{$ref:"#/definitions/positiveInteger"},minLength:{$ref:"#/definitions/positiveIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{anyOf:[{type:"boolean"},{$ref:"#"}],default:{}},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:{}},maxItems:{$ref:"#/definitions/positiveInteger"},minItems:{$ref:"#/definitions/positiveIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxProperties:{$ref:"#/definitions/positiveInteger"},minProperties:{$ref:"#/definitions/positiveIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{anyOf:[{type:"boolean"},{$ref:"#"}],default:{}},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},enum:{type:"array",minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},dependencies:{exclusiveMaximum:["maximum"],exclusiveMinimum:["minimum"]},default:{}}});var Zo=Y((Me,Sd)=>{"use strict";I();R();T();Object.defineProperty(Me,"__esModule",{value:!0});Me.CodeGen=Me.Name=Me.nil=Me.stringify=Me.str=Me._=Me.KeywordCxt=void 0;var I_=gn(),T_=yd(),R_=bd(),$d=Ed(),q_=["/properties"],Si="http://json-schema.org/draft-04/schema",Pi=class extends I_.default{constructor(e={}){super({...e,schemaId:"id"})}_addVocabularies(){super._addVocabularies(),T_.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(R_.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema($d,q_):$d;this.addMetaSchema(e,Si,!1),this.refs["http://json-schema.org/schema"]=Si}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(Si)?Si:void 0)}};Sd.exports=Me=Pi;Object.defineProperty(Me,"__esModule",{value:!0});Me.default=Pi;var C_=gn();Object.defineProperty(Me,"KeywordCxt",{enumerable:!0,get:function(){return C_.KeywordCxt}});var Lr=gn();Object.defineProperty(Me,"_",{enumerable:!0,get:function(){return Lr._}});Object.defineProperty(Me,"str",{enumerable:!0,get:function(){return Lr.str}});Object.defineProperty(Me,"stringify",{enumerable:!0,get:function(){return Lr.stringify}});Object.defineProperty(Me,"nil",{enumerable:!0,get:function(){return Lr.nil}});Object.defineProperty(Me,"Name",{enumerable:!0,get:function(){return Lr.Name}});Object.defineProperty(Me,"CodeGen",{enumerable:!0,get:function(){return Lr.CodeGen}})});var Ad=Y((Pd,Od)=>{I();R();T();(function(t){if(typeof Pd=="object")Od.exports=t();else if(typeof define=="function"&&define.amd)define(t);else{var e;try{e=window}catch{e=self}e.SparkMD5=t()}})(function(t){"use strict";var e=function(y,w){return y+w&4294967295},r=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function n(y,w,p,h,v,E){return w=e(e(w,y),e(h,E)),e(w<<v|w>>>32-v,p)}function i(y,w){var p=y[0],h=y[1],v=y[2],E=y[3];p+=(h&v|~h&E)+w[0]-680876936|0,p=(p<<7|p>>>25)+h|0,E+=(p&h|~p&v)+w[1]-389564586|0,E=(E<<12|E>>>20)+p|0,v+=(E&p|~E&h)+w[2]+606105819|0,v=(v<<17|v>>>15)+E|0,h+=(v&E|~v&p)+w[3]-1044525330|0,h=(h<<22|h>>>10)+v|0,p+=(h&v|~h&E)+w[4]-176418897|0,p=(p<<7|p>>>25)+h|0,E+=(p&h|~p&v)+w[5]+1200080426|0,E=(E<<12|E>>>20)+p|0,v+=(E&p|~E&h)+w[6]-1473231341|0,v=(v<<17|v>>>15)+E|0,h+=(v&E|~v&p)+w[7]-45705983|0,h=(h<<22|h>>>10)+v|0,p+=(h&v|~h&E)+w[8]+1770035416|0,p=(p<<7|p>>>25)+h|0,E+=(p&h|~p&v)+w[9]-1958414417|0,E=(E<<12|E>>>20)+p|0,v+=(E&p|~E&h)+w[10]-42063|0,v=(v<<17|v>>>15)+E|0,h+=(v&E|~v&p)+w[11]-1990404162|0,h=(h<<22|h>>>10)+v|0,p+=(h&v|~h&E)+w[12]+1804603682|0,p=(p<<7|p>>>25)+h|0,E+=(p&h|~p&v)+w[13]-40341101|0,E=(E<<12|E>>>20)+p|0,v+=(E&p|~E&h)+w[14]-1502002290|0,v=(v<<17|v>>>15)+E|0,h+=(v&E|~v&p)+w[15]+1236535329|0,h=(h<<22|h>>>10)+v|0,p+=(h&E|v&~E)+w[1]-165796510|0,p=(p<<5|p>>>27)+h|0,E+=(p&v|h&~v)+w[6]-1069501632|0,E=(E<<9|E>>>23)+p|0,v+=(E&h|p&~h)+w[11]+643717713|0,v=(v<<14|v>>>18)+E|0,h+=(v&p|E&~p)+w[0]-373897302|0,h=(h<<20|h>>>12)+v|0,p+=(h&E|v&~E)+w[5]-701558691|0,p=(p<<5|p>>>27)+h|0,E+=(p&v|h&~v)+w[10]+38016083|0,E=(E<<9|E>>>23)+p|0,v+=(E&h|p&~h)+w[15]-660478335|0,v=(v<<14|v>>>18)+E|0,h+=(v&p|E&~p)+w[4]-405537848|0,h=(h<<20|h>>>12)+v|0,p+=(h&E|v&~E)+w[9]+568446438|0,p=(p<<5|p>>>27)+h|0,E+=(p&v|h&~v)+w[14]-1019803690|0,E=(E<<9|E>>>23)+p|0,v+=(E&h|p&~h)+w[3]-187363961|0,v=(v<<14|v>>>18)+E|0,h+=(v&p|E&~p)+w[8]+1163531501|0,h=(h<<20|h>>>12)+v|0,p+=(h&E|v&~E)+w[13]-1444681467|0,p=(p<<5|p>>>27)+h|0,E+=(p&v|h&~v)+w[2]-51403784|0,E=(E<<9|E>>>23)+p|0,v+=(E&h|p&~h)+w[7]+1735328473|0,v=(v<<14|v>>>18)+E|0,h+=(v&p|E&~p)+w[12]-1926607734|0,h=(h<<20|h>>>12)+v|0,p+=(h^v^E)+w[5]-378558|0,p=(p<<4|p>>>28)+h|0,E+=(p^h^v)+w[8]-2022574463|0,E=(E<<11|E>>>21)+p|0,v+=(E^p^h)+w[11]+1839030562|0,v=(v<<16|v>>>16)+E|0,h+=(v^E^p)+w[14]-35309556|0,h=(h<<23|h>>>9)+v|0,p+=(h^v^E)+w[1]-1530992060|0,p=(p<<4|p>>>28)+h|0,E+=(p^h^v)+w[4]+1272893353|0,E=(E<<11|E>>>21)+p|0,v+=(E^p^h)+w[7]-155497632|0,v=(v<<16|v>>>16)+E|0,h+=(v^E^p)+w[10]-1094730640|0,h=(h<<23|h>>>9)+v|0,p+=(h^v^E)+w[13]+681279174|0,p=(p<<4|p>>>28)+h|0,E+=(p^h^v)+w[0]-358537222|0,E=(E<<11|E>>>21)+p|0,v+=(E^p^h)+w[3]-722521979|0,v=(v<<16|v>>>16)+E|0,h+=(v^E^p)+w[6]+76029189|0,h=(h<<23|h>>>9)+v|0,p+=(h^v^E)+w[9]-640364487|0,p=(p<<4|p>>>28)+h|0,E+=(p^h^v)+w[12]-421815835|0,E=(E<<11|E>>>21)+p|0,v+=(E^p^h)+w[15]+530742520|0,v=(v<<16|v>>>16)+E|0,h+=(v^E^p)+w[2]-995338651|0,h=(h<<23|h>>>9)+v|0,p+=(v^(h|~E))+w[0]-198630844|0,p=(p<<6|p>>>26)+h|0,E+=(h^(p|~v))+w[7]+1126891415|0,E=(E<<10|E>>>22)+p|0,v+=(p^(E|~h))+w[14]-1416354905|0,v=(v<<15|v>>>17)+E|0,h+=(E^(v|~p))+w[5]-57434055|0,h=(h<<21|h>>>11)+v|0,p+=(v^(h|~E))+w[12]+1700485571|0,p=(p<<6|p>>>26)+h|0,E+=(h^(p|~v))+w[3]-1894986606|0,E=(E<<10|E>>>22)+p|0,v+=(p^(E|~h))+w[10]-1051523|0,v=(v<<15|v>>>17)+E|0,h+=(E^(v|~p))+w[1]-2054922799|0,h=(h<<21|h>>>11)+v|0,p+=(v^(h|~E))+w[8]+1873313359|0,p=(p<<6|p>>>26)+h|0,E+=(h^(p|~v))+w[15]-30611744|0,E=(E<<10|E>>>22)+p|0,v+=(p^(E|~h))+w[6]-1560198380|0,v=(v<<15|v>>>17)+E|0,h+=(E^(v|~p))+w[13]+1309151649|0,h=(h<<21|h>>>11)+v|0,p+=(v^(h|~E))+w[4]-145523070|0,p=(p<<6|p>>>26)+h|0,E+=(h^(p|~v))+w[11]-1120210379|0,E=(E<<10|E>>>22)+p|0,v+=(p^(E|~h))+w[2]+718787259|0,v=(v<<15|v>>>17)+E|0,h+=(E^(v|~p))+w[9]-343485551|0,h=(h<<21|h>>>11)+v|0,y[0]=p+y[0]|0,y[1]=h+y[1]|0,y[2]=v+y[2]|0,y[3]=E+y[3]|0}function s(y){var w=[],p;for(p=0;p<64;p+=4)w[p>>2]=y.charCodeAt(p)+(y.charCodeAt(p+1)<<8)+(y.charCodeAt(p+2)<<16)+(y.charCodeAt(p+3)<<24);return w}function o(y){var w=[],p;for(p=0;p<64;p+=4)w[p>>2]=y[p]+(y[p+1]<<8)+(y[p+2]<<16)+(y[p+3]<<24);return w}function a(y){var w=y.length,p=[1732584193,-271733879,-1732584194,271733878],h,v,E,C,x,j;for(h=64;h<=w;h+=64)i(p,s(y.substring(h-64,h)));for(y=y.substring(h-64),v=y.length,E=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],h=0;h<v;h+=1)E[h>>2]|=y.charCodeAt(h)<<(h%4<<3);if(E[h>>2]|=128<<(h%4<<3),h>55)for(i(p,E),h=0;h<16;h+=1)E[h]=0;return C=w*8,C=C.toString(16).match(/(.*?)(.{0,8})$/),x=parseInt(C[2],16),j=parseInt(C[1],16)||0,E[14]=x,E[15]=j,i(p,E),p}function c(y){var w=y.length,p=[1732584193,-271733879,-1732584194,271733878],h,v,E,C,x,j;for(h=64;h<=w;h+=64)i(p,o(y.subarray(h-64,h)));for(y=h-64<w?y.subarray(h-64):new Uint8Array(0),v=y.length,E=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],h=0;h<v;h+=1)E[h>>2]|=y[h]<<(h%4<<3);if(E[h>>2]|=128<<(h%4<<3),h>55)for(i(p,E),h=0;h<16;h+=1)E[h]=0;return C=w*8,C=C.toString(16).match(/(.*?)(.{0,8})$/),x=parseInt(C[2],16),j=parseInt(C[1],16)||0,E[14]=x,E[15]=j,i(p,E),p}function d(y){var w="",p;for(p=0;p<4;p+=1)w+=r[y>>p*8+4&15]+r[y>>p*8&15];return w}function m(y){var w;for(w=0;w<y.length;w+=1)y[w]=d(y[w]);return y.join("")}m(a("hello"))!=="5d41402abc4b2a76b9719d911017c592"&&(e=function(y,w){var p=(y&65535)+(w&65535),h=(y>>16)+(w>>16)+(p>>16);return h<<16|p&65535}),typeof ArrayBuffer<"u"&&!ArrayBuffer.prototype.slice&&function(){function y(w,p){return w=w|0||0,w<0?Math.max(w+p,0):Math.min(w,p)}ArrayBuffer.prototype.slice=function(w,p){var h=this.byteLength,v=y(w,h),E=h,C,x,j,G;return p!==t&&(E=y(p,h)),v>E?new ArrayBuffer(0):(C=E-v,x=new ArrayBuffer(C),j=new Uint8Array(x),G=new Uint8Array(this,v,C),j.set(G),x)}}();function f(y){return/[\u0080-\uFFFF]/.test(y)&&(y=unescape(encodeURIComponent(y))),y}function g(y,w){var p=y.length,h=new ArrayBuffer(p),v=new Uint8Array(h),E;for(E=0;E<p;E+=1)v[E]=y.charCodeAt(E);return w?v:h}function _(y){return String.fromCharCode.apply(null,new Uint8Array(y))}function b(y,w,p){var h=new Uint8Array(y.byteLength+w.byteLength);return h.set(new Uint8Array(y)),h.set(new Uint8Array(w),y.byteLength),p?h:h.buffer}function P(y){var w=[],p=y.length,h;for(h=0;h<p-1;h+=2)w.push(parseInt(y.substr(h,2),16));return String.fromCharCode.apply(String,w)}function S(){this.reset()}return S.prototype.append=function(y){return this.appendBinary(f(y)),this},S.prototype.appendBinary=function(y){this._buff+=y,this._length+=y.length;var w=this._buff.length,p;for(p=64;p<=w;p+=64)i(this._hash,s(this._buff.substring(p-64,p)));return this._buff=this._buff.substring(p-64),this},S.prototype.end=function(y){var w=this._buff,p=w.length,h,v=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],E;for(h=0;h<p;h+=1)v[h>>2]|=w.charCodeAt(h)<<(h%4<<3);return this._finish(v,p),E=m(this._hash),y&&(E=P(E)),this.reset(),E},S.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},S.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},S.prototype.setState=function(y){return this._buff=y.buff,this._length=y.length,this._hash=y.hash,this},S.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},S.prototype._finish=function(y,w){var p=w,h,v,E;if(y[p>>2]|=128<<(p%4<<3),p>55)for(i(this._hash,y),p=0;p<16;p+=1)y[p]=0;h=this._length*8,h=h.toString(16).match(/(.*?)(.{0,8})$/),v=parseInt(h[2],16),E=parseInt(h[1],16)||0,y[14]=v,y[15]=E,i(this._hash,y)},S.hash=function(y,w){return S.hashBinary(f(y),w)},S.hashBinary=function(y,w){var p=a(y),h=m(p);return w?P(h):h},S.ArrayBuffer=function(){this.reset()},S.ArrayBuffer.prototype.append=function(y){var w=b(this._buff.buffer,y,!0),p=w.length,h;for(this._length+=y.byteLength,h=64;h<=p;h+=64)i(this._hash,o(w.subarray(h-64,h)));return this._buff=h-64<p?new Uint8Array(w.buffer.slice(h-64)):new Uint8Array(0),this},S.ArrayBuffer.prototype.end=function(y){var w=this._buff,p=w.length,h=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],v,E;for(v=0;v<p;v+=1)h[v>>2]|=w[v]<<(v%4<<3);return this._finish(h,p),E=m(this._hash),y&&(E=P(E)),this.reset(),E},S.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},S.ArrayBuffer.prototype.getState=function(){var y=S.prototype.getState.call(this);return y.buff=_(y.buff),y},S.ArrayBuffer.prototype.setState=function(y){return y.buff=g(y.buff,!0),S.prototype.setState.call(this,y)},S.ArrayBuffer.prototype.destroy=S.prototype.destroy,S.ArrayBuffer.prototype._finish=S.prototype._finish,S.ArrayBuffer.hash=function(y,w){var p=c(new Uint8Array(y)),h=m(p);return w?P(h):h},S})});var qd=Y(ta=>{"use strict";I();R();T();ta.stringify=function(e){var r=[];r.push({obj:e});for(var n="",i,s,o,a,c,d,m,f,g,_,b;i=r.pop();)if(s=i.obj,o=i.prefix||"",a=i.val||"",n+=o,a)n+=a;else if(typeof s!="object")n+=typeof s>"u"?null:JSON.stringify(s);else if(s===null)n+="null";else if(Array.isArray(s)){for(r.push({val:"]"}),c=s.length-1;c>=0;c--)d=c===0?"":",",r.push({obj:s[c],prefix:d});r.push({val:"["})}else{m=[];for(f in s)s.hasOwnProperty(f)&&m.push(f);for(r.push({val:"}"}),c=m.length-1;c>=0;c--)g=m[c],_=s[g],b=c>0?",":"",b+=JSON.stringify(g)+":",r.push({obj:_,prefix:b});r.push({val:"{"})}return n};function Mr(t,e,r){var n=r[r.length-1];t===n.element&&(r.pop(),n=r[r.length-1]);var i=n.element,s=n.index;if(Array.isArray(i))i.push(t);else if(s===e.length-2){var o=e.pop();i[o]=t}else e.push(t)}ta.parse=function(t){for(var e=[],r=[],n=0,i,s,o,a,c,d,m,f,g;;){if(i=t[n++],i==="}"||i==="]"||typeof i>"u"){if(e.length===1)return e.pop();Mr(e.pop(),e,r);continue}switch(i){case" ":case" ":case`
|
|
9
|
-
`:case":":case",":break;case"n":n+=3,Mr(null,e,r);break;case"t":n+=3,Mr(!0,e,r);break;case"f":n+=4,Mr(!1,e,r);break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"-":for(s="",n--;;)if(o=t[n++],/[\d\.\-e\+]/.test(o))s+=o;else{n--;break}Mr(parseFloat(s),e,r);break;case'"':for(a="",c=void 0,d=0;m=t[n++],m!=='"'||c==="\\"&&d%2===1;)a+=m,c=m,c==="\\"?d++:d=0;Mr(JSON.parse('"'+a+'"'),e,r);break;case"[":f={element:[],index:e.length},e.push(f.element),r.push(f);break;case"{":g={element:{},index:e.length},e.push(g.element),r.push(g);break;default:throw new Error("unexpectedly reached end of input: "+i)}}}});I();R();T();I();R();T();var Nc=class{objectToUri(t){return this.locationToUri(t)}};var Zr=class jc extends Error{constructor(e){super(e),this.name="GraffitiErrorForbidden",Object.setPrototypeOf(this,jc.prototype)}},zn=class Dc extends Error{constructor(e){super(e),this.name="GraffitiErrorNotFound",Object.setPrototypeOf(this,Dc.prototype)}},Bc=class Lc extends Error{constructor(e){super(e),this.name="GraffitiErrorInvalidSchema",Object.setPrototypeOf(this,Lc.prototype)}},Mc=class Uc extends Error{constructor(e){super(e),this.name="GraffitiErrorSchemaMismatch",Object.setPrototypeOf(this,Uc.prototype)}},Gc=class Fc extends Error{constructor(e){super(e),this.name="GraffitiErrorPatchTestFailed",Object.setPrototypeOf(this,Fc.prototype)}},Ar=class Kc extends Error{constructor(e){super(e),this.name="GraffitiErrorPatchError",Object.setPrototypeOf(this,Kc.prototype)}},zc=class Vc extends Error{constructor(e){super(e),this.name="GraffitiErrorInvalidUri",Object.setPrototypeOf(this,Vc.prototype)}};var Xh=Mn(Zo());I();R();T();var Oi=class{sessionEvents=new EventTarget;constructor(){(async()=>{await Promise.resolve();for(let n of this.getLoggedInActors()){let i=new CustomEvent("login",{detail:{session:{actor:n}}});this.sessionEvents.dispatchEvent(i)}let r=new CustomEvent("initialized",{detail:{}});this.sessionEvents.dispatchEvent(r)})()}loggedInActors=[];getLoggedInActors(){if(typeof window<"u"){let e=window.localStorage.getItem("graffiti-actor");return e?e.split(",").map(decodeURIComponent):[]}else return this.loggedInActors}setLoggedInActors(e){typeof window<"u"?window.localStorage.setItem("graffiti-actor",e.map(encodeURIComponent).join(",")):this.loggedInActors=e}login=async e=>{let r=e?.actor;if(!r&&typeof window<"u"){let s=window.prompt(`This is an insecure implementation of the Graffiti API for *demo purposes only*. Do not store any sensitive information here.
|
|
9
|
+
deps: ${r}}`};var Aw={keyword:"dependencies",type:"object",schemaType:"object",error:qt.error,code(t){let[e,r]=Iw(t);vh(t,e),yh(t,r)}};function Iw({schema:t}){let e={},r={};for(let n in t){if(n==="__proto__")continue;let i=Array.isArray(t[n])?e:r;i[n]=t[n]}return[e,r]}function vh(t,e=t.schema){let{gen:r,data:n,it:i}=t;if(Object.keys(e).length===0)return;let s=r.let("missing");for(let o in e){let a=e[o];if(a.length===0)continue;let c=(0,Ln.propertyInData)(r,n,o,i.opts.ownProperties);t.setParams({property:o,depsCount:a.length,deps:a.join(", ")}),i.allErrors?r.if(c,()=>{for(let d of a)(0,Ln.checkReportMissingProp)(t,d)}):(r.if((0,Ma._)`${c} && (${(0,Ln.checkMissingProp)(t,a,s)})`),(0,Ln.reportMissingProp)(t,s),r.else())}}qt.validatePropertyDeps=vh;function yh(t,e=t.schema){let{gen:r,data:n,keyword:i,it:s}=t,o=r.name("valid");for(let a in e)(0,Ow.alwaysValidSchema)(s,e[a])||(r.if((0,Ln.propertyInData)(r,n,a,s.opts.ownProperties),()=>{let c=t.subschema({keyword:i,schemaProp:a},o);t.mergeValidEvaluated(c,o)},()=>r.var(o,!0)),t.ok(o))}qt.validateSchemaDeps=yh;qt.default=Aw});var wh=Q(Ua=>{"use strict";I();R();T();Object.defineProperty(Ua,"__esModule",{value:!0});var _h=de(),Tw=be(),Rw={message:"property name must be valid",params:({params:t})=>(0,_h._)`{propertyName: ${t.propertyName}}`},qw={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:Rw,code(t){let{gen:e,schema:r,data:n,it:i}=t;if((0,Tw.alwaysValidSchema)(i,r))return;let s=e.name("valid");e.forIn("key",n,o=>{t.setParams({propertyName:o}),t.subschema({keyword:"propertyNames",data:o,dataTypes:["string"],propertyName:o,compositeRule:!0},s),e.if((0,_h.not)(s),()=>{t.error(!0),i.allErrors||e.break()})}),t.ok(s)}};Ua.default=qw});var Fa=Q(Ga=>{"use strict";I();R();T();Object.defineProperty(Ga,"__esModule",{value:!0});var Wi=pt(),$t=de(),Nw=Bt(),Qi=be(),kw={message:"must NOT have additional properties",params:({params:t})=>(0,$t._)`{additionalProperty: ${t.additionalProperty}}`},Cw={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:kw,code(t){let{gen:e,schema:r,parentSchema:n,data:i,errsCount:s,it:o}=t;if(!s)throw new Error("ajv implementation error");let{allErrors:a,opts:c}=o;if(o.props=!0,c.removeAdditional!=="all"&&(0,Qi.alwaysValidSchema)(o,r))return;let d=(0,Wi.allSchemaProperties)(n.properties),m=(0,Wi.allSchemaProperties)(n.patternProperties);f(),t.ok((0,$t._)`${s} === ${Nw.default.errors}`);function f(){e.forIn("key",i,S=>{!d.length&&!m.length?E(S):e.if(g(S),()=>E(S))})}function g(S){let y;if(d.length>8){let w=(0,Qi.schemaRefOrVal)(o,n.properties,"properties");y=(0,Wi.isOwnProperty)(e,w,S)}else d.length?y=(0,$t.or)(...d.map(w=>(0,$t._)`${S} === ${w}`)):y=$t.nil;return m.length&&(y=(0,$t.or)(y,...m.map(w=>(0,$t._)`${(0,Wi.usePattern)(t,w)}.test(${S})`))),(0,$t.not)(y)}function _(S){e.code((0,$t._)`delete ${i}[${S}]`)}function E(S){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){_(S);return}if(r===!1){t.setParams({additionalProperty:S}),t.error(),a||e.break();return}if(typeof r=="object"&&!(0,Qi.alwaysValidSchema)(o,r)){let y=e.name("valid");c.removeAdditional==="failing"?(P(S,y,!1),e.if((0,$t.not)(y),()=>{t.reset(),_(S)})):(P(S,y),a||e.if((0,$t.not)(y),()=>e.break()))}}function P(S,y,w){let p={keyword:"additionalProperties",dataProp:S,dataPropType:Qi.Type.Str};w===!1&&Object.assign(p,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(p,y)}}};Ga.default=Cw});var $h=Q(za=>{"use strict";I();R();T();Object.defineProperty(za,"__esModule",{value:!0});var xw=Pn(),bh=pt(),Ka=be(),Eh=Fa(),jw={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,parentSchema:n,data:i,it:s}=t;s.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&Eh.default.code(new xw.KeywordCxt(s,Eh.default,"additionalProperties"));let o=(0,bh.allSchemaProperties)(r);for(let f of o)s.definedProperties.add(f);s.opts.unevaluated&&o.length&&s.props!==!0&&(s.props=Ka.mergeEvaluated.props(e,(0,Ka.toHash)(o),s.props));let a=o.filter(f=>!(0,Ka.alwaysValidSchema)(s,r[f]));if(a.length===0)return;let c=e.name("valid");for(let f of a)d(f)?m(f):(e.if((0,bh.propertyInData)(e,i,f,s.opts.ownProperties)),m(f),s.allErrors||e.else().var(c,!0),e.endIf()),t.it.definedProperties.add(f),t.ok(c);function d(f){return s.opts.useDefaults&&!s.compositeRule&&r[f].default!==void 0}function m(f){t.subschema({keyword:"properties",schemaProp:f,dataProp:f},c)}}};za.default=jw});var Ah=Q(Va=>{"use strict";I();R();T();Object.defineProperty(Va,"__esModule",{value:!0});var Sh=pt(),Yi=de(),Ph=be(),Oh=be(),Dw={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,data:n,parentSchema:i,it:s}=t,{opts:o}=s,a=(0,Sh.allSchemaProperties)(r),c=a.filter(P=>(0,Ph.alwaysValidSchema)(s,r[P]));if(a.length===0||c.length===a.length&&(!s.opts.unevaluated||s.props===!0))return;let d=o.strictSchema&&!o.allowMatchingProperties&&i.properties,m=e.name("valid");s.props!==!0&&!(s.props instanceof Yi.Name)&&(s.props=(0,Oh.evaluatedPropsToName)(e,s.props));let{props:f}=s;g();function g(){for(let P of a)d&&_(P),s.allErrors?E(P):(e.var(m,!0),E(P),e.if(m))}function _(P){for(let S in d)new RegExp(P).test(S)&&(0,Ph.checkStrictMode)(s,`property ${S} matches pattern ${P} (use allowMatchingProperties)`)}function E(P){e.forIn("key",n,S=>{e.if((0,Yi._)`${(0,Sh.usePattern)(t,P)}.test(${S})`,()=>{let y=c.includes(P);y||t.subschema({keyword:"patternProperties",schemaProp:P,dataProp:S,dataPropType:Oh.Type.Str},m),s.opts.unevaluated&&f!==!0?e.assign((0,Yi._)`${f}[${S}]`,!0):!y&&!s.allErrors&&e.if((0,Yi.not)(m),()=>e.break())})})}}};Va.default=Dw});var Ih=Q(Ja=>{"use strict";I();R();T();Object.defineProperty(Ja,"__esModule",{value:!0});var Bw=be(),Lw={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:n}=t;if((0,Bw.alwaysValidSchema)(n,r)){t.fail();return}let i=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},i),t.failResult(i,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};Ja.default=Lw});var Th=Q(Ha=>{"use strict";I();R();T();Object.defineProperty(Ha,"__esModule",{value:!0});var Mw=pt(),Uw={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Mw.validateUnion,error:{message:"must match a schema in anyOf"}};Ha.default=Uw});var Rh=Q(Wa=>{"use strict";I();R();T();Object.defineProperty(Wa,"__esModule",{value:!0});var Xi=de(),Gw=be(),Fw={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,Xi._)`{passingSchemas: ${t.passing}}`},Kw={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:Fw,code(t){let{gen:e,schema:r,parentSchema:n,it:i}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(i.opts.discriminator&&n.discriminator)return;let s=r,o=e.let("valid",!1),a=e.let("passing",null),c=e.name("_valid");t.setParams({passing:a}),e.block(d),t.result(o,()=>t.reset(),()=>t.error(!0));function d(){s.forEach((m,f)=>{let g;(0,Gw.alwaysValidSchema)(i,m)?e.var(c,!0):g=t.subschema({keyword:"oneOf",schemaProp:f,compositeRule:!0},c),f>0&&e.if((0,Xi._)`${c} && ${o}`).assign(o,!1).assign(a,(0,Xi._)`[${a}, ${f}]`).else(),e.if(c,()=>{e.assign(o,!0),e.assign(a,f),g&&t.mergeEvaluated(g,Xi.Name)})})}}};Wa.default=Kw});var qh=Q(Qa=>{"use strict";I();R();T();Object.defineProperty(Qa,"__esModule",{value:!0});var zw=be(),Vw={keyword:"allOf",schemaType:"array",code(t){let{gen:e,schema:r,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");let i=e.name("valid");r.forEach((s,o)=>{if((0,zw.alwaysValidSchema)(n,s))return;let a=t.subschema({keyword:"allOf",schemaProp:o},i);t.ok(i),t.mergeEvaluated(a)})}};Qa.default=Vw});var Ch=Q(Ya=>{"use strict";I();R();T();Object.defineProperty(Ya,"__esModule",{value:!0});var Zi=de(),kh=be(),Jw={message:({params:t})=>(0,Zi.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,Zi._)`{failingKeyword: ${t.ifClause}}`},Hw={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:Jw,code(t){let{gen:e,parentSchema:r,it:n}=t;r.then===void 0&&r.else===void 0&&(0,kh.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let i=Nh(n,"then"),s=Nh(n,"else");if(!i&&!s)return;let o=e.let("valid",!0),a=e.name("_valid");if(c(),t.reset(),i&&s){let m=e.let("ifClause");t.setParams({ifClause:m}),e.if(a,d("then",m),d("else",m))}else i?e.if(a,d("then")):e.if((0,Zi.not)(a),d("else"));t.pass(o,()=>t.error(!0));function c(){let m=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);t.mergeEvaluated(m)}function d(m,f){return()=>{let g=t.subschema({keyword:m},a);e.assign(o,a),t.mergeValidEvaluated(g,o),f?e.assign(f,(0,Zi._)`${m}`):t.setParams({ifClause:m})}}}};function Nh(t,e){let r=t.schema[e];return r!==void 0&&!(0,kh.alwaysValidSchema)(t,r)}Ya.default=Hw});var xh=Q(Xa=>{"use strict";I();R();T();Object.defineProperty(Xa,"__esModule",{value:!0});var Ww=be(),Qw={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,Ww.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};Xa.default=Qw});var jh=Q(Za=>{"use strict";I();R();T();Object.defineProperty(Za,"__esModule",{value:!0});var Yw=xa(),Xw=dh(),Zw=ja(),e1=ph(),t1=mh(),r1=gh(),n1=wh(),i1=Fa(),s1=$h(),o1=Ah(),a1=Ih(),u1=Th(),c1=Rh(),f1=qh(),l1=Ch(),d1=xh();function h1(t=!1){let e=[a1.default,u1.default,c1.default,f1.default,l1.default,d1.default,n1.default,i1.default,r1.default,s1.default,o1.default];return t?e.push(Xw.default,e1.default):e.push(Yw.default,Zw.default),e.push(t1.default),e}Za.default=h1});var Dh=Q(eu=>{"use strict";I();R();T();Object.defineProperty(eu,"__esModule",{value:!0});var Le=de(),p1={message:({schemaCode:t})=>(0,Le.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,Le._)`{format: ${t}}`},m1={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:p1,code(t,e){let{gen:r,data:n,$data:i,schema:s,schemaCode:o,it:a}=t,{opts:c,errSchemaPath:d,schemaEnv:m,self:f}=a;if(!c.validateFormats)return;i?g():_();function g(){let E=r.scopeValue("formats",{ref:f.formats,code:c.code.formats}),P=r.const("fDef",(0,Le._)`${E}[${o}]`),S=r.let("fType"),y=r.let("format");r.if((0,Le._)`typeof ${P} == "object" && !(${P} instanceof RegExp)`,()=>r.assign(S,(0,Le._)`${P}.type || "string"`).assign(y,(0,Le._)`${P}.validate`),()=>r.assign(S,(0,Le._)`"string"`).assign(y,P)),t.fail$data((0,Le.or)(w(),p()));function w(){return c.strictSchema===!1?Le.nil:(0,Le._)`${o} && !${y}`}function p(){let h=m.$async?(0,Le._)`(${P}.async ? await ${y}(${n}) : ${y}(${n}))`:(0,Le._)`${y}(${n})`,v=(0,Le._)`(typeof ${y} == "function" ? ${h} : ${y}.test(${n}))`;return(0,Le._)`${y} && ${y} !== true && ${S} === ${e} && !${v}`}}function _(){let E=f.formats[s];if(!E){w();return}if(E===!0)return;let[P,S,y]=p(E);P===e&&t.pass(h());function w(){if(c.strictSchema===!1){f.logger.warn(v());return}throw new Error(v());function v(){return`unknown format "${s}" ignored in schema at path "${d}"`}}function p(v){let b=v instanceof RegExp?(0,Le.regexpCode)(v):c.code.formats?(0,Le._)`${c.code.formats}${(0,Le.getProperty)(s)}`:void 0,N=r.scopeValue("formats",{key:s,ref:v,code:b});return typeof v=="object"&&!(v instanceof RegExp)?[v.type||"string",v.validate,(0,Le._)`${N}.validate`]:["string",v,N]}function h(){if(typeof E=="object"&&!(E instanceof RegExp)&&E.async){if(!m.$async)throw new Error("async format in sync schema");return(0,Le._)`await ${y}(${n})`}return typeof S=="function"?(0,Le._)`${y}(${n})`:(0,Le._)`${y}.test(${n})`}}}};eu.default=m1});var Bh=Q(tu=>{"use strict";I();R();T();Object.defineProperty(tu,"__esModule",{value:!0});var v1=Dh(),y1=[v1.default];tu.default=y1});var Lh=Q(Hr=>{"use strict";I();R();T();Object.defineProperty(Hr,"__esModule",{value:!0});Hr.contentVocabulary=Hr.metadataVocabulary=void 0;Hr.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];Hr.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var Uh=Q(ru=>{"use strict";I();R();T();Object.defineProperty(ru,"__esModule",{value:!0});var g1=Hd(),_1=uh(),w1=jh(),b1=Bh(),Mh=Lh(),E1=[g1.default,_1.default,(0,w1.default)(),b1.default,Mh.metadataVocabulary,Mh.contentVocabulary];ru.default=E1});var Fh=Q(es=>{"use strict";I();R();T();Object.defineProperty(es,"__esModule",{value:!0});es.DiscrError=void 0;var Gh;(function(t){t.Tag="tag",t.Mapping="mapping"})(Gh||(es.DiscrError=Gh={}))});var zh=Q(iu=>{"use strict";I();R();T();Object.defineProperty(iu,"__esModule",{value:!0});var Wr=de(),nu=Fh(),Kh=ji(),$1=On(),S1=be(),P1={message:({params:{discrError:t,tagName:e}})=>t===nu.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,Wr._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},O1={keyword:"discriminator",type:"object",schemaType:"object",error:P1,code(t){let{gen:e,data:r,schema:n,parentSchema:i,it:s}=t,{oneOf:o}=i;if(!s.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=n.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!o)throw new Error("discriminator: requires oneOf keyword");let c=e.let("valid",!1),d=e.const("tag",(0,Wr._)`${r}${(0,Wr.getProperty)(a)}`);e.if((0,Wr._)`typeof ${d} == "string"`,()=>m(),()=>t.error(!1,{discrError:nu.DiscrError.Tag,tag:d,tagName:a})),t.ok(c);function m(){let _=g();e.if(!1);for(let E in _)e.elseIf((0,Wr._)`${d} === ${E}`),e.assign(c,f(_[E]));e.else(),t.error(!1,{discrError:nu.DiscrError.Mapping,tag:d,tagName:a}),e.endIf()}function f(_){let E=e.name("valid"),P=t.subschema({keyword:"oneOf",schemaProp:_},E);return t.mergeEvaluated(P,Wr.Name),E}function g(){var _;let E={},P=y(i),S=!0;for(let h=0;h<o.length;h++){let v=o[h];if(v?.$ref&&!(0,S1.schemaHasRulesButRef)(v,s.self.RULES)){let N=v.$ref;if(v=Kh.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,N),v instanceof Kh.SchemaEnv&&(v=v.schema),v===void 0)throw new $1.default(s.opts.uriResolver,s.baseId,N)}let b=(_=v?.properties)===null||_===void 0?void 0:_[a];if(typeof b!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);S=S&&(P||y(v)),w(b,h)}if(!S)throw new Error(`discriminator: "${a}" must be required`);return E;function y({required:h}){return Array.isArray(h)&&h.includes(a)}function w(h,v){if(h.const)p(h.const,v);else if(h.enum)for(let b of h.enum)p(b,v);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function p(h,v){if(typeof h!="string"||h in E)throw new Error(`discriminator: "${a}" values must be unique strings`);E[h]=v}}}};iu.default=O1});var Vh=Q((BA,A1)=>{A1.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}});var Hh=Q((Ne,su)=>{"use strict";I();R();T();Object.defineProperty(Ne,"__esModule",{value:!0});Ne.MissingRefError=Ne.ValidationError=Ne.CodeGen=Ne.Name=Ne.nil=Ne.stringify=Ne.str=Ne._=Ne.KeywordCxt=Ne.Ajv=void 0;var I1=Gd(),T1=Uh(),R1=zh(),Jh=Vh(),q1=["/properties"],ts="http://json-schema.org/draft-07/schema",Qr=class extends I1.default{_addVocabularies(){super._addVocabularies(),T1.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(R1.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(Jh,q1):Jh;this.addMetaSchema(e,ts,!1),this.refs["http://json-schema.org/schema"]=ts}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(ts)?ts:void 0)}};Ne.Ajv=Qr;su.exports=Ne=Qr;su.exports.Ajv=Qr;Object.defineProperty(Ne,"__esModule",{value:!0});Ne.default=Qr;var N1=Pn();Object.defineProperty(Ne,"KeywordCxt",{enumerable:!0,get:function(){return N1.KeywordCxt}});var Yr=de();Object.defineProperty(Ne,"_",{enumerable:!0,get:function(){return Yr._}});Object.defineProperty(Ne,"str",{enumerable:!0,get:function(){return Yr.str}});Object.defineProperty(Ne,"stringify",{enumerable:!0,get:function(){return Yr.stringify}});Object.defineProperty(Ne,"nil",{enumerable:!0,get:function(){return Yr.nil}});Object.defineProperty(Ne,"Name",{enumerable:!0,get:function(){return Yr.Name}});Object.defineProperty(Ne,"CodeGen",{enumerable:!0,get:function(){return Yr.CodeGen}});var k1=Ci();Object.defineProperty(Ne,"ValidationError",{enumerable:!0,get:function(){return k1.default}});var C1=On();Object.defineProperty(Ne,"MissingRefError",{enumerable:!0,get:function(){return C1.default}})});I();R();T();I();R();T();var Cc=class{objectToUri(t){return this.locationToUri(t)}},cp={type:"object",properties:{value:{type:"object"},channels:{type:"array",items:{type:"string"}},allowed:{type:"array",items:{type:"string"},nullable:!0},actor:{type:"string"},name:{type:"string"},source:{type:"string"},lastModified:{type:"number"},tombstone:{type:"boolean"}},required:["value","channels","actor","name","source","lastModified","tombstone"]},pb={...cp,required:["value","channels"]};var tn=class xc extends Error{constructor(e){super(e),this.name="GraffitiErrorForbidden",Object.setPrototypeOf(this,xc.prototype)}},Jn=class jc extends Error{constructor(e){super(e),this.name="GraffitiErrorNotFound",Object.setPrototypeOf(this,jc.prototype)}},Dc=class Bc extends Error{constructor(e){super(e),this.name="GraffitiErrorInvalidSchema",Object.setPrototypeOf(this,Bc.prototype)}},Lc=class Mc extends Error{constructor(e){super(e),this.name="GraffitiErrorSchemaMismatch",Object.setPrototypeOf(this,Mc.prototype)}},Uc=class Gc extends Error{constructor(e){super(e),this.name="GraffitiErrorPatchTestFailed",Object.setPrototypeOf(this,Gc.prototype)}},Ar=class Fc extends Error{constructor(e){super(e),this.name="GraffitiErrorPatchError",Object.setPrototypeOf(this,Fc.prototype)}},Kc=class zc extends Error{constructor(e){super(e),this.name="GraffitiErrorInvalidUri",Object.setPrototypeOf(this,zc.prototype)}};I();R();T();var Hn=class{sessionEvents=new EventTarget;constructor(){(async()=>{await Promise.resolve();for(let n of this.getLoggedInActors()){let i=new CustomEvent("login",{detail:{session:{actor:n}}});this.sessionEvents.dispatchEvent(i)}let r=new CustomEvent("initialized",{detail:{}});this.sessionEvents.dispatchEvent(r)})()}loggedInActors=[];getLoggedInActors(){if(typeof window<"u"){let e=window.localStorage.getItem("graffiti-actor");return e?e.split(",").map(decodeURIComponent):[]}else return this.loggedInActors}setLoggedInActors(e){typeof window<"u"?window.localStorage.setItem("graffiti-actor",e.map(encodeURIComponent).join(",")):this.loggedInActors=e}login=async e=>{let r=e?.actor;if(!r&&typeof window<"u"){let s=window.prompt(`This is an insecure implementation of the Graffiti API for *demo purposes only*. Do not store any sensitive information here.
|
|
10
10
|
|
|
11
|
-
Simply choose a username to log in.`);s&&(r=s)}let n;if(!r)n={error:new Error("No actor ID provided to login")};else{let s=this.getLoggedInActors();s.includes(r)||this.setLoggedInActors([...s,r]),n={session:{actor:r}}}let i=new CustomEvent("login",{detail:n});this.sessionEvents.dispatchEvent(i)};logout=async e=>{let r=this.getLoggedInActors(),n=r.includes(e.actor);n&&this.setLoggedInActors(r.filter(o=>o!==e.actor));let i=n?{actor:e.actor}:{actor:e.actor,error:new Error("Not logged in with that actor")},s=new CustomEvent("logout",{detail:i});this.sessionEvents.dispatchEvent(s)}};I();R();T();I();R();T();var xi=Mn(Ad());I();R();T();I();R();T();var Ai,k_=new Uint8Array(16);function ea(){if(!Ai&&(Ai=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!Ai))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ai(k_)}I();R();T();I();R();T();I();R();T();var Id=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function x_(t){return typeof t=="string"&&Id.test(t)}var Td=x_;var Ve=[];for(Ii=0;Ii<256;++Ii)Ve.push((Ii+256).toString(16).substr(1));var Ii;function N_(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=(Ve[t[e+0]]+Ve[t[e+1]]+Ve[t[e+2]]+Ve[t[e+3]]+"-"+Ve[t[e+4]]+Ve[t[e+5]]+"-"+Ve[t[e+6]]+Ve[t[e+7]]+"-"+Ve[t[e+8]]+Ve[t[e+9]]+"-"+Ve[t[e+10]]+Ve[t[e+11]]+Ve[t[e+12]]+Ve[t[e+13]]+Ve[t[e+14]]+Ve[t[e+15]]).toLowerCase();if(!Td(r))throw TypeError("Stringified UUID is invalid");return r}var Rd=N_;I();R();T();function j_(t,e,r){t=t||{};var n=t.random||(t.rng||ea)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){r=r||0;for(var i=0;i<16;++i)e[r+i]=n[i];return e}return Rd(n)}var In=j_;var Da=Mn(qd());I();R();T();var Ti={},Cd=!1;function D_(){if(Cd)return Ti;Cd=!0;var t=typeof Reflect=="object"?Reflect:null,e=t&&typeof t.apply=="function"?t.apply:function(v,E,C){return Function.prototype.apply.call(v,E,C)},r;t&&typeof t.ownKeys=="function"?r=t.ownKeys:Object.getOwnPropertySymbols?r=function(v){return Object.getOwnPropertyNames(v).concat(Object.getOwnPropertySymbols(v))}:r=function(v){return Object.getOwnPropertyNames(v)};function n(h){console&&console.warn&&console.warn(h)}var i=Number.isNaN||function(v){return v!==v};function s(){s.init.call(this)}Ti=s,Ti.once=y,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var o=10;function a(h){if(typeof h!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof h)}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return o},set:function(h){if(typeof h!="number"||h<0||i(h))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+h+".");o=h}}),s.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(v){if(typeof v!="number"||v<0||i(v))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+v+".");return this._maxListeners=v,this};function c(h){return h._maxListeners===void 0?s.defaultMaxListeners:h._maxListeners}s.prototype.getMaxListeners=function(){return c(this)},s.prototype.emit=function(v){for(var E=[],C=1;C<arguments.length;C++)E.push(arguments[C]);var x=v==="error",j=this._events;if(j!==void 0)x=x&&j.error===void 0;else if(!x)return!1;if(x){var G;if(E.length>0&&(G=E[0]),G instanceof Error)throw G;var H=new Error("Unhandled error."+(G?" ("+G.message+")":""));throw H.context=G,H}var re=j[v];if(re===void 0)return!1;if(typeof re=="function")e(re,this,E);else for(var Q=re.length,Z=b(re,Q),C=0;C<Q;++C)e(Z[C],this,E);return!0};function d(h,v,E,C){var x,j,G;if(a(E),j=h._events,j===void 0?(j=h._events=Object.create(null),h._eventsCount=0):(j.newListener!==void 0&&(h.emit("newListener",v,E.listener?E.listener:E),j=h._events),G=j[v]),G===void 0)G=j[v]=E,++h._eventsCount;else if(typeof G=="function"?G=j[v]=C?[E,G]:[G,E]:C?G.unshift(E):G.push(E),x=c(h),x>0&&G.length>x&&!G.warned){G.warned=!0;var H=new Error("Possible EventEmitter memory leak detected. "+G.length+" "+String(v)+" listeners added. Use emitter.setMaxListeners() to increase limit");H.name="MaxListenersExceededWarning",H.emitter=h,H.type=v,H.count=G.length,n(H)}return h}s.prototype.addListener=function(v,E){return d(this,v,E,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(v,E){return d(this,v,E,!0)};function m(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function f(h,v,E){var C={fired:!1,wrapFn:void 0,target:h,type:v,listener:E},x=m.bind(C);return x.listener=E,C.wrapFn=x,x}s.prototype.once=function(v,E){return a(E),this.on(v,f(this,v,E)),this},s.prototype.prependOnceListener=function(v,E){return a(E),this.prependListener(v,f(this,v,E)),this},s.prototype.removeListener=function(v,E){var C,x,j,G,H;if(a(E),x=this._events,x===void 0)return this;if(C=x[v],C===void 0)return this;if(C===E||C.listener===E)--this._eventsCount===0?this._events=Object.create(null):(delete x[v],x.removeListener&&this.emit("removeListener",v,C.listener||E));else if(typeof C!="function"){for(j=-1,G=C.length-1;G>=0;G--)if(C[G]===E||C[G].listener===E){H=C[G].listener,j=G;break}if(j<0)return this;j===0?C.shift():P(C,j),C.length===1&&(x[v]=C[0]),x.removeListener!==void 0&&this.emit("removeListener",v,H||E)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(v){var E,C,x;if(C=this._events,C===void 0)return this;if(C.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):C[v]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete C[v]),this;if(arguments.length===0){var j=Object.keys(C),G;for(x=0;x<j.length;++x)G=j[x],G!=="removeListener"&&this.removeAllListeners(G);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(E=C[v],typeof E=="function")this.removeListener(v,E);else if(E!==void 0)for(x=E.length-1;x>=0;x--)this.removeListener(v,E[x]);return this};function g(h,v,E){var C=h._events;if(C===void 0)return[];var x=C[v];return x===void 0?[]:typeof x=="function"?E?[x.listener||x]:[x]:E?S(x):b(x,x.length)}s.prototype.listeners=function(v){return g(this,v,!0)},s.prototype.rawListeners=function(v){return g(this,v,!1)},s.listenerCount=function(h,v){return typeof h.listenerCount=="function"?h.listenerCount(v):_.call(h,v)},s.prototype.listenerCount=_;function _(h){var v=this._events;if(v!==void 0){var E=v[h];if(typeof E=="function")return 1;if(E!==void 0)return E.length}return 0}s.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]};function b(h,v){for(var E=new Array(v),C=0;C<v;++C)E[C]=h[C];return E}function P(h,v){for(;v+1<h.length;v++)h[v]=h[v+1];h.pop()}function S(h){for(var v=new Array(h.length),E=0;E<v.length;++E)v[E]=h[E].listener||h[E];return v}function y(h,v){return new Promise(function(E,C){function x(G){h.removeListener(v,j),C(G)}function j(){typeof h.removeListener=="function"&&h.removeListener("error",x),E([].slice.call(arguments))}p(h,v,j,{once:!0}),v!=="error"&&w(h,x,{once:!0})})}function w(h,v,E){typeof h.on=="function"&&p(h,"error",v,E)}function p(h,v,E,C){if(typeof h.on=="function")C.once?h.once(v,E):h.on(v,E);else if(typeof h.addEventListener=="function")h.addEventListener(v,function x(j){C.once&&h.removeEventListener(v,x),E(j)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof h)}return Ti}var ut=D_();ut.once;ut.once=function(t,e){return new Promise((r,n)=>{function i(...o){s!==void 0&&t.removeListener("error",s),r(o)}let s;e!=="error"&&(s=o=>{t.removeListener(name,i),n(o)},t.once("error",s)),t.once(e,i)})};ut.on=function(t,e){let r=[],n=[],i=null,s=!1,o={async next(){let d=r.shift();if(d)return createIterResult(d,!1);if(i){let m=Promise.reject(i);return i=null,m}return s?createIterResult(void 0,!0):new Promise((m,f)=>n.push({resolve:m,reject:f}))},async return(){t.removeListener(e,a),t.removeListener("error",c),s=!0;for(let d of n)d.resolve(createIterResult(void 0,!0));return createIterResult(void 0,!0)},throw(d){i=d,t.removeListener(e,a),t.removeListener("error",c)},[Symbol.asyncIterator](){return this}};return t.on(e,a),t.on("error",c),o;function a(...d){let m=n.shift();m?m.resolve(createIterResult(d,!1)):r.push(d)}function c(d){s=!0;let m=n.shift();m?m.reject(d):i=d,o.return()}};var{EventEmitter:ZO,defaultMaxListeners:eA,init:tA,listenerCount:rA,on:nA,once:iA}=ut;function B_(t){return typeof ArrayBuffer<"u"&&t instanceof ArrayBuffer||typeof Blob<"u"&&t instanceof Blob}function L_(t){return t instanceof ArrayBuffer?t.slice(0):t.slice(0,t.size,t.type)}var oh=Function.prototype.toString,M_=oh.call(Object);function U_(t){var e=Object.getPrototypeOf(t);if(e===null)return!0;var r=e.constructor;return typeof r=="function"&&r instanceof r&&oh.call(r)==M_}function Ge(t){var e,r,n;if(!t||typeof t!="object")return t;if(Array.isArray(t)){for(e=[],r=0,n=t.length;r<n;r++)e[r]=Ge(t[r]);return e}if(t instanceof Date&&isFinite(t))return t.toISOString();if(B_(t))return L_(t);if(!U_(t))return t;e={};for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)){var i=Ge(t[r]);typeof i<"u"&&(e[r]=i)}return e}function ah(t){var e=!1;return function(...r){if(e)throw new Error("once called more than once");e=!0,t.apply(this,r)}}function uh(t){return function(...e){e=Ge(e);var r=this,n=typeof e[e.length-1]=="function"?e.pop():!1,i=new Promise(function(s,o){var a;try{var c=ah(function(d,m){d?o(d):s(m)});e.push(c),a=t.apply(r,e),a&&typeof a.then=="function"&&s(a)}catch(d){o(d)}});return n&&i.then(function(s){n(null,s)},n),i}}function G_(t,e,r){if(t.constructor.listeners("debug").length){for(var n=["api",t.name,e],i=0;i<r.length-1;i++)n.push(r[i]);t.constructor.emit("debug",n);var s=r[r.length-1];r[r.length-1]=function(o,a){var c=["api",t.name,e];c=c.concat(o?["error",o]:["success",a]),t.constructor.emit("debug",c),s(o,a)}}}function De(t,e){return uh(function(...r){if(this._closed)return Promise.reject(new Error("database is closed"));if(this._destroyed)return Promise.reject(new Error("database is destroyed"));var n=this;return G_(n,t,r),this.taskqueue.isReady?e.apply(this,r):new Promise(function(i,s){n.taskqueue.addTask(function(o){o?s(o):i(n[t].apply(n,r))})})})}function kn(t,e){for(var r={},n=0,i=e.length;n<i;n++){var s=e[n];s in t&&(r[s]=t[s])}return r}var F_=6;function kd(t){return t}function K_(t){return[{ok:t}]}function ch(t,e,r){var n=e.docs,i=new Map;n.forEach(function(P){i.has(P.id)?i.get(P.id).push(P):i.set(P.id,[P])});var s=i.size,o=0,a=new Array(s);function c(){var P=[];a.forEach(function(S){S.docs.forEach(function(y){P.push({id:S.id,docs:[y]})})}),r(null,{results:P})}function d(){++o===s&&c()}function m(P,S,y){a[P]={id:S,docs:y},d()}var f=[];i.forEach(function(P,S){f.push(S)});var g=0;function _(){if(!(g>=f.length)){var P=Math.min(g+F_,f.length),S=f.slice(g,P);b(S,g),g+=S.length}}function b(P,S){P.forEach(function(y,w){var p=S+w,h=i.get(y),v=kn(h[0],["atts_since","attachments"]);v.open_revs=h.map(function(C){return C.rev}),v.open_revs=v.open_revs.filter(kd);var E=kd;v.open_revs.length===0&&(delete v.open_revs,E=K_),["revs","attachments","binary","ajax","latest"].forEach(function(C){C in e&&(v[C]=e[C])}),t.get(y,v,function(C,x){var j;C?j=[{error:C}]:j=E(x),m(p,y,j),_()})})}_()}var ma;try{localStorage.setItem("_pouch_check_localstorage",1),ma=!!localStorage.getItem("_pouch_check_localstorage")}catch{ma=!1}function Ni(){return ma}var qt=typeof queueMicrotask=="function"?queueMicrotask:function(e){Promise.resolve().then(e)},va=class extends ut{constructor(){super(),this._listeners={},Ni()&&addEventListener("storage",e=>{this.emit(e.key)})}addListener(e,r,n,i){if(this._listeners[r])return;var s=!1,o=this;function a(){if(!o._listeners[r])return;if(s){s="waiting";return}s=!0;var c=kn(i,["style","include_docs","attachments","conflicts","filter","doc_ids","view","since","query_params","binary","return_docs"]);function d(){s=!1}n.changes(c).on("change",function(m){m.seq>i.since&&!i.cancelled&&(i.since=m.seq,i.onChange(m))}).on("complete",function(){s==="waiting"&&qt(a),s=!1}).on("error",d)}this._listeners[r]=a,this.on(e,a)}removeListener(e,r){r in this._listeners&&(super.removeListener(e,this._listeners[r]),delete this._listeners[r])}notifyLocalWindows(e){Ni()&&(localStorage[e]=localStorage[e]==="a"?"b":"a")}notify(e){this.emit(e),this.notifyLocalWindows(e)}};function vt(t){if(typeof console<"u"&&typeof console[t]=="function"){var e=Array.prototype.slice.call(arguments,1);console[t].apply(console,e)}}function z_(t,e){var r=6e5;t=parseInt(t,10)||0,e=parseInt(e,10),e!==e||e<=t?e=(t||1)<<1:e=e+1,e>r&&(t=r>>1,e=r);var n=Math.random(),i=e-t;return~~(i*n+t)}function V_(t){var e=0;return t||(e=2e3),z_(t,e)}function ya(t,e){vt("info","The above "+t+" is totally normal. "+e)}var Te=class extends Error{constructor(e,r,n){super(),this.status=e,this.name=r,this.message=n,this.error=!0}toString(){return JSON.stringify({status:this.status,name:this.name,message:this.message,reason:this.reason})}},lA=new Te(401,"unauthorized","Name or password is incorrect."),J_=new Te(400,"bad_request","Missing JSON list of 'docs'"),pt=new Te(404,"not_found","missing"),Kr=new Te(409,"conflict","Document update conflict"),fh=new Te(400,"bad_request","_id field must contain a string"),H_=new Te(412,"missing_id","_id is required for puts"),W_=new Te(400,"bad_request","Only reserved document ids may start with underscore."),dA=new Te(412,"precondition_failed","Database not open"),Ba=new Te(500,"unknown_error","Database encountered an unknown error"),lh=new Te(500,"badarg","Some query argument is invalid"),hA=new Te(400,"invalid_request","Request was invalid"),Q_=new Te(400,"query_parse_error","Some query parameter is invalid"),xd=new Te(500,"doc_validation","Bad special document member"),zi=new Te(400,"bad_request","Something wrong with the request"),ra=new Te(400,"bad_request","Document must be a JSON object"),pA=new Te(404,"not_found","Database not found"),La=new Te(500,"indexed_db_went_bad","unknown"),mA=new Te(500,"web_sql_went_bad","unknown"),vA=new Te(500,"levelDB_went_went_bad","unknown"),yA=new Te(403,"forbidden","Forbidden by design doc validate_doc_update function"),Ci=new Te(400,"bad_request","Invalid rev format"),gA=new Te(412,"file_exists","The database could not be created, the file already exists."),Y_=new Te(412,"missing_stub","A pre-existing attachment stub wasn't found"),_A=new Te(413,"invalid_url","Provided URL is invalid");function oe(t,e){function r(n){for(var i=Object.getOwnPropertyNames(t),s=0,o=i.length;s<o;s++)typeof t[i[s]]!="function"&&(this[i[s]]=t[i[s]]);this.stack===void 0&&(this.stack=new Error().stack),n!==void 0&&(this.reason=n)}return r.prototype=Te.prototype,new r(e)}function zr(t){if(typeof t!="object"){var e=t;t=Ba,t.data=e}return"error"in t&&t.error==="conflict"&&(t.name="conflict",t.status=409),"name"in t||(t.name=t.error||"unknown"),"status"in t||(t.status=500),"message"in t||(t.message=t.message||t.reason),"stack"in t||(t.stack=new Error().stack),t}function X_(t,e,r){try{return!t(e,r)}catch(i){var n="Filter function threw: "+i.toString();return oe(zi,n)}}function Ma(t){var e={},r=t.filter&&typeof t.filter=="function";return e.query=t.query_params,function(i){i.doc||(i.doc={});var s=r&&X_(t.filter,i.doc,e);if(typeof s=="object")return s;if(s)return!1;if(!t.include_docs)delete i.doc;else if(!t.attachments)for(var o in i.doc._attachments)Object.prototype.hasOwnProperty.call(i.doc._attachments,o)&&(i.doc._attachments[o].stub=!0);return!0}}function dh(t){var e;if(t?typeof t!="string"?e=oe(fh):/^_/.test(t)&&!/^_(design|local)/.test(t)&&(e=oe(W_)):e=oe(H_),e)throw e}function Rt(t){return typeof t._remote=="boolean"?t._remote:typeof t.type=="function"?(vt("warn","db.type() is deprecated and will be removed in a future version of PouchDB"),t.type()==="http"):!1}function Z_(t,e){return"listenerCount"in t?t.listenerCount(e):ut.listenerCount(t,e)}function ga(t){if(!t)return null;var e=t.split("/");return e.length===2?e:e.length===1?[t,t]:null}function Nd(t){var e=ga(t);return e?e.join("/"):null}var jd=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],Dd="queryKey",e0=/(?:^|&)([^&=]*)=?([^&]*)/g,t0=/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/;function hh(t){for(var e=t0.exec(t),r={},n=14;n--;){var i=jd[n],s=e[n]||"",o=["user","password"].indexOf(i)!==-1;r[i]=o?decodeURIComponent(s):s}return r[Dd]={},r[jd[12]].replace(e0,function(a,c,d){c&&(r[Dd][c]=d)}),r}function Ua(t,e){var r=[],n=[];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r.push(i),n.push(e[i]));return r.push(t),Function.apply(null,r).apply(null,n)}function ji(t,e,r){return t.get(e).catch(function(n){if(n.status!==404)throw n;return{}}).then(function(n){var i=n._rev,s=r(n);return s?(s._id=e,s._rev=i,r0(t,s,r)):{updated:!1,rev:i}})}function r0(t,e,r){return t.put(e).then(function(n){return{updated:!0,rev:n.rev}},function(n){if(n.status!==409)throw n;return ji(t,e._id,r)})}var Ga=function(t){return atob(t)},xn=function(t){return btoa(t)};function Fa(t,e){t=t||[],e=e||{};try{return new Blob(t,e)}catch(s){if(s.name!=="TypeError")throw s;for(var r=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,n=new r,i=0;i<t.length;i+=1)n.append(t[i]);return n.getBlob(e.type)}}function n0(t){for(var e=t.length,r=new ArrayBuffer(e),n=new Uint8Array(r),i=0;i<e;i++)n[i]=t.charCodeAt(i);return r}function Ka(t,e){return Fa([n0(t)],{type:e})}function za(t,e){return Ka(Ga(t),e)}function i0(t){for(var e="",r=new Uint8Array(t),n=r.byteLength,i=0;i<n;i++)e+=String.fromCharCode(r[i]);return e}function ph(t,e){var r=new FileReader,n=typeof r.readAsBinaryString=="function";r.onloadend=function(i){var s=i.target.result||"";if(n)return e(s);e(i0(s))},n?r.readAsBinaryString(t):r.readAsArrayBuffer(t)}function mh(t,e){ph(t,function(r){e(r)})}function Va(t,e){mh(t,function(r){e(xn(r))})}function s0(t,e){var r=new FileReader;r.onloadend=function(n){var i=n.target.result||new ArrayBuffer(0);e(i)},r.readAsArrayBuffer(t)}var o0=self.setImmediate||self.setTimeout,a0=32768;function u0(t){return xn(t)}function c0(t,e,r,n,i){(r>0||n<e.size)&&(e=e.slice(r,n)),s0(e,function(s){t.append(s),i()})}function f0(t,e,r,n,i){(r>0||n<e.length)&&(e=e.substring(r,n)),t.appendBinary(e),i()}function Ja(t,e){var r=typeof t=="string",n=r?t.length:t.size,i=Math.min(a0,n),s=Math.ceil(n/i),o=0,a=r?new xi.default:new xi.default.ArrayBuffer,c=r?f0:c0;function d(){o0(f)}function m(){var g=a.end(!0),_=u0(g);e(_),a.destroy()}function f(){var g=o*i,_=g+i;o++,o<s?c(a,t,g,_,d):c(a,t,g,_,m)}f()}function vh(t){return xi.default.hash(t)}function yh(t,e){if(!e)return In().replace(/-/g,"").toLowerCase();var r=Object.assign({},t);return delete r._rev_tree,vh(JSON.stringify(r))}var Vi=In;function _r(t){for(var e,r,n,i=t.rev_tree.slice(),s;s=i.pop();){var o=s.ids,a=o[2],c=s.pos;if(a.length){for(var d=0,m=a.length;d<m;d++)i.push({pos:c+1,ids:a[d]});continue}var f=!!o[1].deleted,g=o[0];(!e||(n!==f?n:r!==c?r<c:e<g))&&(e=g,r=c,n=f)}return r+"-"+e}function wr(t,e){for(var r=t.slice(),n;n=r.pop();)for(var i=n.pos,s=n.ids,o=s[2],a=e(o.length===0,i,s[0],n.ctx,s[1]),c=0,d=o.length;c<d;c++)r.push({pos:i+1,ids:o[c],ctx:a})}function l0(t,e){return t.pos-e.pos}function Ha(t){var e=[];wr(t,function(i,s,o,a,c){i&&e.push({rev:s+"-"+o,pos:s,opts:c})}),e.sort(l0).reverse();for(var r=0,n=e.length;r<n;r++)delete e[r].pos;return e}function Wa(t){for(var e=_r(t),r=Ha(t.rev_tree),n=[],i=0,s=r.length;i<s;i++){var o=r[i];o.rev!==e&&!o.opts.deleted&&n.push(o.rev)}return n}function d0(t){var e=[];return wr(t.rev_tree,function(r,n,i,s,o){o.status==="available"&&!r&&(e.push(n+"-"+i),o.status="missing")}),e}function h0(t,e){let r=[],n=t.slice(),i;for(;i=n.pop();){let{pos:s,ids:o}=i,a=`${s}-${o[0]}`,c=o[2];if(r.push(a),a===e){if(c.length!==0)throw new Error("The requested revision is not a leaf");return r.reverse()}(c.length===0||c.length>1)&&(r=[]);for(let d=0,m=c.length;d<m;d++)n.push({pos:s+1,ids:c[d]})}if(r.length===0)throw new Error("The requested revision does not exist");return r.reverse()}function gh(t){for(var e=[],r=t.slice(),n;n=r.pop();){var i=n.pos,s=n.ids,o=s[0],a=s[1],c=s[2],d=c.length===0,m=n.history?n.history.slice():[];m.push({id:o,opts:a}),d&&e.push({pos:i+1-m.length,ids:m});for(var f=0,g=c.length;f<g;f++)r.push({pos:i+1,ids:c[f],history:m})}return e.reverse()}function p0(t,e){return t.pos-e.pos}function m0(t,e,r){for(var n=0,i=t.length,s;n<i;)s=n+i>>>1,r(t[s],e)<0?n=s+1:i=s;return n}function v0(t,e,r){var n=m0(t,e,r);t.splice(n,0,e)}function Bd(t,e){for(var r,n,i=e,s=t.length;i<s;i++){var o=t[i],a=[o.id,o.opts,[]];n?(n[2].push(a),n=a):r=n=a}return r}function y0(t,e){return t[0]<e[0]?-1:1}function Ld(t,e){for(var r=[{tree1:t,tree2:e}],n=!1;r.length>0;){var i=r.pop(),s=i.tree1,o=i.tree2;(s[1].status||o[1].status)&&(s[1].status=s[1].status==="available"||o[1].status==="available"?"available":"missing");for(var a=0;a<o[2].length;a++){if(!s[2][0]){n="new_leaf",s[2][0]=o[2][a];continue}for(var c=!1,d=0;d<s[2].length;d++)s[2][d][0]===o[2][a][0]&&(r.push({tree1:s[2][d],tree2:o[2][a]}),c=!0);c||(n="new_branch",v0(s[2],o[2][a],y0))}}return{conflicts:n,tree:t}}function _h(t,e,r){var n=[],i=!1,s=!1,o;if(!t.length)return{tree:[e],conflicts:"new_leaf"};for(var a=0,c=t.length;a<c;a++){var d=t[a];if(d.pos===e.pos&&d.ids[0]===e.ids[0])o=Ld(d.ids,e.ids),n.push({pos:d.pos,ids:o.tree}),i=i||o.conflicts,s=!0;else if(r!==!0){var m=d.pos<e.pos?d:e,f=d.pos<e.pos?e:d,g=f.pos-m.pos,_=[],b=[];for(b.push({ids:m.ids,diff:g,parent:null,parentIdx:null});b.length>0;){var P=b.pop();if(P.diff===0){P.ids[0]===f.ids[0]&&_.push(P);continue}for(var S=P.ids[2],y=0,w=S.length;y<w;y++)b.push({ids:S[y],diff:P.diff-1,parent:P.ids,parentIdx:y})}var p=_[0];p?(o=Ld(p.ids,f.ids),p.parent[2][p.parentIdx]=o.tree,n.push({pos:m.pos,ids:m.ids}),i=i||o.conflicts,s=!0):n.push(d)}else n.push(d)}return s||n.push(e),n.sort(p0),{tree:n,conflicts:i||"internal_node"}}function g0(t,e){for(var r=gh(t),n,i,s=0,o=r.length;s<o;s++){var a=r[s],c=a.ids,d;if(c.length>e){n||(n={});var m=c.length-e;d={pos:a.pos+m,ids:Bd(c,m)};for(var f=0;f<m;f++){var g=a.pos+f+"-"+c[f].id;n[g]=!0}}else d={pos:a.pos,ids:Bd(c,0)};i?i=_h(i,d,!0).tree:i=[d]}return n&&wr(i,function(_,b,P){delete n[b+"-"+P]}),{tree:i,revs:n?Object.keys(n):[]}}function wh(t,e,r){var n=_h(t,e),i=g0(n.tree,r);return{tree:i.tree,stemmedRevs:i.revs,conflicts:n.conflicts}}function _0(t,e){for(var r=t.slice(),n=e.split("-"),i=parseInt(n[0],10),s=n[1],o;o=r.pop();){if(o.pos===i&&o.ids[0]===s)return!0;for(var a=o.ids[2],c=0,d=a.length;c<d;c++)r.push({pos:o.pos+1,ids:a[c]})}return!1}function w0(t){return t.ids}function Mt(t,e){e||(e=_r(t));for(var r=e.substring(e.indexOf("-")+1),n=t.rev_tree.map(w0),i;i=n.pop();){if(i[0]===r)return!!i[1].deleted;n=n.concat(i[2])}}function gr(t){return typeof t=="string"&&t.startsWith("_local/")}function b0(t,e){for(var r=e.rev_tree.slice(),n;n=r.pop();){var i=n.pos,s=n.ids,o=s[0],a=s[1],c=s[2],d=c.length===0,m=n.history?n.history.slice():[];if(m.push({id:o,pos:i,opts:a}),d)for(var f=0,g=m.length;f<g;f++){var _=m[f],b=_.pos+"-"+_.id;if(b===t)return i+"-"+o}for(var P=0,S=c.length;P<S;P++)r.push({pos:i+1,ids:c[P],history:m})}throw new Error("Unable to resolve latest revision for id "+e.id+", rev "+t)}function E0(t,e,r,n){try{t.emit("change",e,r,n)}catch(i){vt("error",'Error in .on("change", function):',i)}}function $0(t,e,r){var n=[{rev:t._rev}];r.style==="all_docs"&&(n=Ha(e.rev_tree).map(function(s){return{rev:s.rev}}));var i={id:e.id,changes:n,doc:t};return Mt(e,t._rev)&&(i.deleted=!0),r.conflicts&&(i.doc._conflicts=Wa(e),i.doc._conflicts.length||delete i.doc._conflicts),i}var _a=class extends ut{constructor(e,r,n){super(),this.db=e,r=r?Ge(r):{};var i=r.complete=ah((a,c)=>{a?Z_(this,"error")>0&&this.emit("error",a):this.emit("complete",c),this.removeAllListeners(),e.removeListener("destroyed",s)});n&&(this.on("complete",function(a){n(null,a)}),this.on("error",n));let s=()=>{this.cancel()};e.once("destroyed",s),r.onChange=(a,c,d)=>{this.isCancelled||E0(this,a,c,d)};var o=new Promise(function(a,c){r.complete=function(d,m){d?c(d):a(m)}});this.once("cancel",function(){e.removeListener("destroyed",s),r.complete(null,{status:"cancelled"})}),this.then=o.then.bind(o),this.catch=o.catch.bind(o),this.then(function(a){i(null,a)},i),e.taskqueue.isReady?this.validateChanges(r):e.taskqueue.addTask(a=>{a?r.complete(a):this.isCancelled?this.emit("cancel"):this.validateChanges(r)})}cancel(){this.isCancelled=!0,this.db.taskqueue.isReady&&this.emit("cancel")}validateChanges(e){var r=e.complete;ae._changesFilterPlugin?ae._changesFilterPlugin.validate(e,n=>{if(n)return r(n);this.doChanges(e)}):this.doChanges(e)}doChanges(e){var r=e.complete;if(e=Ge(e),"live"in e&&!("continuous"in e)&&(e.continuous=e.live),e.processChange=$0,e.since==="latest"&&(e.since="now"),e.since||(e.since=0),e.since==="now"){this.db.info().then(i=>{if(this.isCancelled){r(null,{status:"cancelled"});return}e.since=i.update_seq,this.doChanges(e)},r);return}if(ae._changesFilterPlugin){if(ae._changesFilterPlugin.normalize(e),ae._changesFilterPlugin.shouldFilter(this,e))return ae._changesFilterPlugin.filter(this,e)}else["doc_ids","filter","selector","view"].forEach(function(i){i in e&&vt("warn",'The "'+i+'" option was passed in to changes/replicate, but pouchdb-changes-filter plugin is not installed, so it was ignored. Please install the plugin to enable filtering.')});"descending"in e||(e.descending=!1),e.limit=e.limit===0?1:e.limit,e.complete=r;var n=this.db._changes(e);if(n&&typeof n.cancel=="function"){let i=this.cancel;this.cancel=(...s)=>{n.cancel(),i.apply(this,s)}}}};function na(t,e){return function(r,n){r||n[0]&&n[0].error?(r=r||n[0],r.docId=e,t(r)):t(null,n.length?n[0]:n)}}function S0(t){for(var e=0;e<t.length;e++){var r=t[e];if(r._deleted)delete r._attachments;else if(r._attachments)for(var n=Object.keys(r._attachments),i=0;i<n.length;i++){var s=n[i];r._attachments[s]=kn(r._attachments[s],["data","digest","content_type","length","revpos","stub"])}}}function P0(t,e){if(t._id===e._id){let r=t._revisions?t._revisions.start:0,n=e._revisions?e._revisions.start:0;return r-n}return t._id<e._id?-1:1}function O0(t){var e={},r=[];return wr(t,function(n,i,s,o){var a=i+"-"+s;return n&&(e[a]=0),o!==void 0&&r.push({from:o,to:a}),a}),r.reverse(),r.forEach(function(n){e[n.from]===void 0?e[n.from]=1+e[n.to]:e[n.from]=Math.min(e[n.from],1+e[n.to])}),e}function A0(t){var e="limit"in t?t.keys.slice(t.skip,t.limit+t.skip):t.skip>0?t.keys.slice(t.skip):t.keys;t.keys=e,t.skip=0,delete t.limit,t.descending&&(e.reverse(),t.descending=!1)}function bh(t){var e=t._compactionQueue[0],r=e.opts,n=e.callback;t.get("_local/compaction").catch(function(){return!1}).then(function(i){i&&i.last_seq&&(r.last_seq=i.last_seq),t._compact(r,function(s,o){s?n(s):n(null,o),qt(function(){t._compactionQueue.shift(),t._compactionQueue.length&&bh(t)})})})}function I0(t,e,r){return t.get("_local/purges").then(function(n){let i=n.purgeSeq+1;return n.purges.push({docId:e,rev:r,purgeSeq:i}),n.purges.length>self.purged_infos_limit&&n.purges.splice(0,n.purges.length-self.purged_infos_limit),n.purgeSeq=i,n}).catch(function(n){if(n.status!==404)throw n;return{_id:"_local/purges",purges:[{docId:e,rev:r,purgeSeq:0}],purgeSeq:0}}).then(function(n){return t.put(n)})}function T0(t){return t.charAt(0)==="_"?t+" is not a valid attachment name, attachment names cannot start with '_'":!1}function ia(t){return t===null||typeof t!="object"||Array.isArray(t)}var R0=/^\d+-[^-]*$/;function sa(t){return typeof t=="string"&&R0.test(t)}var Di=class extends ut{_setup(){this.post=De("post",function(e,r,n){if(typeof r=="function"&&(n=r,r={}),ia(e))return n(oe(ra));this.bulkDocs({docs:[e]},r,na(n,e._id))}).bind(this),this.put=De("put",function(e,r,n){if(typeof r=="function"&&(n=r,r={}),ia(e))return n(oe(ra));if(dh(e._id),"_rev"in e&&!sa(e._rev))return n(oe(Ci));if(gr(e._id)&&typeof this._putLocal=="function")return e._deleted?this._removeLocal(e,n):this._putLocal(e,n);let i=o=>{typeof this._put=="function"&&r.new_edits!==!1?this._put(e,r,o):this.bulkDocs({docs:[e]},r,na(o,e._id))};r.force&&e._rev?(s(),i(function(o){var a=o?null:{ok:!0,id:e._id,rev:e._rev};n(o,a)})):i(n);function s(){var o=e._rev.split("-"),a=o[1],c=parseInt(o[0],10),d=c+1,m=yh();e._revisions={start:d,ids:[m,a]},e._rev=d+"-"+m,r.new_edits=!1}}).bind(this),this.putAttachment=De("putAttachment",function(e,r,n,i,s){var o=this;typeof s=="function"&&(s=i,i=n,n=null),typeof s>"u"&&(s=i,i=n,n=null),s||vt("warn","Attachment",r,"on document",e,"is missing content_type");function a(c){var d="_rev"in c?parseInt(c._rev,10):0;return c._attachments=c._attachments||{},c._attachments[r]={content_type:s,data:i,revpos:++d},o.put(c)}return o.get(e).then(function(c){if(c._rev!==n)throw oe(Kr);return a(c)},function(c){if(c.reason===pt.message)return a({_id:e});throw c})}).bind(this),this.removeAttachment=De("removeAttachment",function(e,r,n,i){this.get(e,(s,o)=>{if(s){i(s);return}if(o._rev!==n){i(oe(Kr));return}if(!o._attachments)return i();delete o._attachments[r],Object.keys(o._attachments).length===0&&delete o._attachments,this.put(o,i)})}).bind(this),this.remove=De("remove",function(e,r,n,i){var s;typeof r=="string"?(s={_id:e,_rev:r},typeof n=="function"&&(i=n,n={})):(s=e,typeof r=="function"?(i=r,n={}):(i=n,n=r)),n=n||{},n.was_delete=!0;var o={_id:s._id,_rev:s._rev||n.rev};if(o._deleted=!0,gr(o._id)&&typeof this._removeLocal=="function")return this._removeLocal(s,i);this.bulkDocs({docs:[o]},n,na(i,o._id))}).bind(this),this.revsDiff=De("revsDiff",function(e,r,n){typeof r=="function"&&(n=r,r={});var i=Object.keys(e);if(!i.length)return n(null,{});var s=0,o=new Map;function a(d,m){o.has(d)||o.set(d,{missing:[]}),o.get(d).missing.push(m)}function c(d,m){var f=e[d].slice(0);wr(m,function(g,_,b,P,S){var y=_+"-"+b,w=f.indexOf(y);w!==-1&&(f.splice(w,1),S.status!=="available"&&a(d,y))}),f.forEach(function(g){a(d,g)})}i.forEach(function(d){this._getRevisionTree(d,function(m,f){if(m&&m.status===404&&m.message==="missing")o.set(d,{missing:e[d]});else{if(m)return n(m);c(d,f)}if(++s===i.length){var g={};return o.forEach(function(_,b){g[b]=_}),n(null,g)}})},this)}).bind(this),this.bulkGet=De("bulkGet",function(e,r){ch(this,e,r)}).bind(this),this.compactDocument=De("compactDocument",function(e,r,n){this._getRevisionTree(e,(i,s)=>{if(i)return n(i);var o=O0(s),a=[],c=[];Object.keys(o).forEach(function(d){o[d]>r&&a.push(d)}),wr(s,function(d,m,f,g,_){var b=m+"-"+f;_.status==="available"&&a.indexOf(b)!==-1&&c.push(b)}),this._doCompaction(e,c,n)})}).bind(this),this.compact=De("compact",function(e,r){typeof e=="function"&&(r=e,e={}),e=e||{},this._compactionQueue=this._compactionQueue||[],this._compactionQueue.push({opts:e,callback:r}),this._compactionQueue.length===1&&bh(this)}).bind(this),this.get=De("get",function(e,r,n){if(typeof r=="function"&&(n=r,r={}),r=r||{},typeof e!="string")return n(oe(fh));if(gr(e)&&typeof this._getLocal=="function")return this._getLocal(e,n);var i=[];let s=()=>{var c=[],d=i.length;if(!d)return n(null,c);i.forEach(m=>{this.get(e,{rev:m,revs:r.revs,latest:r.latest,attachments:r.attachments,binary:r.binary},function(f,g){if(f)c.push({missing:m});else{for(var _,b=0,P=c.length;b<P;b++)if(c[b].ok&&c[b].ok._rev===g._rev){_=!0;break}_||c.push({ok:g})}d--,d||n(null,c)})})};if(r.open_revs){if(r.open_revs==="all")this._getRevisionTree(e,function(c,d){if(c)return n(c);i=Ha(d).map(function(m){return m.rev}),s()});else if(Array.isArray(r.open_revs)){i=r.open_revs;for(var o=0;o<i.length;o++){var a=i[o];if(!sa(a))return n(oe(Ci))}s()}else return n(oe(Ba,"function_clause"));return}return this._get(e,r,(c,d)=>{if(c)return c.docId=e,n(c);var m=d.doc,f=d.metadata,g=d.ctx;if(r.conflicts){var _=Wa(f);_.length&&(m._conflicts=_)}if(Mt(f,m._rev)&&(m._deleted=!0),r.revs||r.revs_info){for(var b=m._rev.split("-"),P=parseInt(b[0],10),S=b[1],y=gh(f.rev_tree),w=null,p=0;p<y.length;p++){var h=y[p];let Q=h.ids.findIndex(Z=>Z.id===S);var v=Q===P-1;(v||!w&&Q!==-1)&&(w=h)}if(!w)return c=new Error("invalid rev tree"),c.docId=e,n(c);let H=m._rev.split("-")[1],re=w.ids.findIndex(Q=>Q.id===H)+1;var E=w.ids.length-re;if(w.ids.splice(re,E),w.ids.reverse(),r.revs&&(m._revisions={start:w.pos+w.ids.length-1,ids:w.ids.map(function(Q){return Q.id})}),r.revs_info){var C=w.pos+w.ids.length;m._revs_info=w.ids.map(function(Q){return C--,{rev:C+"-"+Q.id,status:Q.opts.status}})}}if(r.attachments&&m._attachments){var x=m._attachments,j=Object.keys(x).length;if(j===0)return n(null,m);Object.keys(x).forEach(H=>{this._getAttachment(m._id,H,x[H],{binary:r.binary,metadata:f,ctx:g},function(re,Q){var Z=m._attachments[H];Z.data=Q,delete Z.stub,delete Z.length,--j||n(null,m)})})}else{if(m._attachments)for(var G in m._attachments)Object.prototype.hasOwnProperty.call(m._attachments,G)&&(m._attachments[G].stub=!0);n(null,m)}})}).bind(this),this.getAttachment=De("getAttachment",function(e,r,n,i){n instanceof Function&&(i=n,n={}),this._get(e,n,(s,o)=>{if(s)return i(s);if(o.doc._attachments&&o.doc._attachments[r])n.ctx=o.ctx,n.binary=!0,n.metadata=o.metadata,this._getAttachment(e,r,o.doc._attachments[r],n,i);else return i(oe(pt))})}).bind(this),this.allDocs=De("allDocs",function(e,r){if(typeof e=="function"&&(r=e,e={}),e.skip=typeof e.skip<"u"?e.skip:0,e.start_key&&(e.startkey=e.start_key),e.end_key&&(e.endkey=e.end_key),"keys"in e){if(!Array.isArray(e.keys))return r(new TypeError("options.keys must be an array"));var n=["startkey","endkey","key"].filter(function(i){return i in e})[0];if(n){r(oe(Q_,"Query parameter `"+n+"` is not compatible with multi-get"));return}if(!Rt(this)&&(A0(e),e.keys.length===0))return this._allDocs({limit:0},r)}return this._allDocs(e,r)}).bind(this),this.close=De("close",function(e){return this._closed=!0,this.emit("closed"),this._close(e)}).bind(this),this.info=De("info",function(e){this._info((r,n)=>{if(r)return e(r);n.db_name=n.db_name||this.name,n.auto_compaction=!!(this.auto_compaction&&!Rt(this)),n.adapter=this.adapter,e(null,n)})}).bind(this),this.id=De("id",function(e){return this._id(e)}).bind(this),this.bulkDocs=De("bulkDocs",function(e,r,n){if(typeof r=="function"&&(n=r,r={}),r=r||{},Array.isArray(e)&&(e={docs:e}),!e||!e.docs||!Array.isArray(e.docs))return n(oe(J_));for(var i=0;i<e.docs.length;++i){let c=e.docs[i];if(ia(c))return n(oe(ra));if("_rev"in c&&!sa(c._rev))return n(oe(Ci))}var s;if(e.docs.forEach(function(c){c._attachments&&Object.keys(c._attachments).forEach(function(d){s=s||T0(d),c._attachments[d].content_type||vt("warn","Attachment",d,"on document",c._id,"is missing content_type")})}),s)return n(oe(zi,s));"new_edits"in r||("new_edits"in e?r.new_edits=e.new_edits:r.new_edits=!0);var o=this;!r.new_edits&&!Rt(o)&&e.docs.sort(P0),S0(e.docs);var a=e.docs.map(function(c){return c._id});this._bulkDocs(e,r,function(c,d){if(c)return n(c);if(r.new_edits||(d=d.filter(function(g){return g.error})),!Rt(o))for(var m=0,f=d.length;m<f;m++)d[m].id=d[m].id||a[m];n(null,d)})}).bind(this),this.registerDependentDatabase=De("registerDependentDatabase",function(e,r){var n=Ge(this.__opts);this.__opts.view_adapter&&(n.adapter=this.__opts.view_adapter);var i=new this.constructor(e,n);function s(o){return o.dependentDbs=o.dependentDbs||{},o.dependentDbs[e]?!1:(o.dependentDbs[e]=!0,o)}ji(this,"_local/_pouch_dependentDbs",s).then(function(){r(null,{db:i})}).catch(r)}).bind(this),this.destroy=De("destroy",function(e,r){typeof e=="function"&&(r=e,e={});var n="use_prefix"in this?this.use_prefix:!0;let i=()=>{this._destroy(e,(s,o)=>{if(s)return r(s);this._destroyed=!0,this.emit("destroyed"),r(null,o||{ok:!0})})};if(Rt(this))return i();this.get("_local/_pouch_dependentDbs",(s,o)=>{if(s)return s.status!==404?r(s):i();var a=o.dependentDbs,c=this.constructor,d=Object.keys(a).map(m=>{var f=n?m.replace(new RegExp("^"+c.prefix),""):m;return new c(f,this.__opts).destroy()});Promise.all(d).then(i,r)})}).bind(this)}_compact(e,r){var n={return_docs:!1,last_seq:e.last_seq||0,since:e.last_seq||0},i=[],s,o=0;let a=m=>{this.activeTasks.update(s,{completed_items:++o}),i.push(this.compactDocument(m.id,0))},c=m=>{this.activeTasks.remove(s,m),r(m)},d=m=>{var f=m.last_seq;Promise.all(i).then(()=>ji(this,"_local/compaction",g=>!g.last_seq||g.last_seq<f?(g.last_seq=f,g):!1)).then(()=>{this.activeTasks.remove(s),r(null,{ok:!0})}).catch(c)};this.info().then(m=>{s=this.activeTasks.add({name:"database_compaction",total_items:m.update_seq-n.last_seq}),this.changes(n).on("change",a).on("complete",d).on("error",c)})}changes(e,r){return typeof e=="function"&&(r=e,e={}),e=e||{},e.return_docs="return_docs"in e?e.return_docs:!e.live,new _a(this,e,r)}type(){return typeof this._type=="function"?this._type():this.adapter}};Di.prototype.purge=De("_purge",function(t,e,r){if(typeof this._purge>"u")return r(oe(Ba,"Purge is not implemented in the "+this.adapter+" adapter."));var n=this;n._getRevisionTree(t,(i,s)=>{if(i)return r(i);if(!s)return r(oe(pt));let o;try{o=h0(s,e)}catch(a){return r(a.message||a)}n._purge(t,o,(a,c)=>{if(a)return r(a);I0(n,t,e).then(function(){return r(null,c)})})})});var wa=class{constructor(){this.isReady=!1,this.failed=!1,this.queue=[]}execute(){var e;if(this.failed)for(;e=this.queue.shift();)e(this.failed);else for(;e=this.queue.shift();)e()}fail(e){this.failed=e,this.execute()}ready(e){this.isReady=!0,this.db=e,this.execute()}addTask(e){this.queue.push(e),this.failed&&this.execute()}};function q0(t,e){var r=t.match(/([a-z-]*):\/\/(.*)/);if(r)return{name:/https?/.test(r[1])?r[1]+"://"+r[2]:r[2],adapter:r[1]};var n=ae.adapters,i=ae.preferredAdapters,s=ae.prefix,o=e.adapter;if(!o)for(var a=0;a<i.length;++a){if(o=i[a],o==="idb"&&"websql"in n&&Ni()&&localStorage["_pouch__websqldb_"+s+t]){vt("log",'PouchDB is downgrading "'+t+'" to WebSQL to avoid data loss, because it was already opened with WebSQL.');continue}break}var c=n[o],d=c&&"use_prefix"in c?c.use_prefix:!0;return{name:d?s+t:t,adapter:o}}function C0(t,e){t.prototype=Object.create(e.prototype,{constructor:{value:t}})}function Eh(t,e){let r=function(...n){if(!(this instanceof r))return new r(...n);e.apply(this,n)};return C0(r,t),r}function k0(t){function e(n){t.removeListener("closed",r),n||t.constructor.emit("destroyed",t.name)}function r(){t.removeListener("destroyed",e),t.constructor.emit("unref",t)}t.once("destroyed",e),t.once("closed",r),t.constructor.emit("ref",t)}var Bi=class extends Di{constructor(e,r){super(),this._setup(e,r)}_setup(e,r){if(super._setup(),r=r||{},e&&typeof e=="object"&&(r=e,e=r.name,delete r.name),r.deterministic_revs===void 0&&(r.deterministic_revs=!0),this.__opts=r=Ge(r),this.auto_compaction=r.auto_compaction,this.purged_infos_limit=r.purged_infos_limit||1e3,this.prefix=ae.prefix,typeof e!="string")throw new Error("Missing/invalid DB name");var n=(r.prefix||"")+e,i=q0(n,r);if(r.name=i.name,r.adapter=r.adapter||i.adapter,this.name=e,this._adapter=r.adapter,ae.emit("debug",["adapter","Picked adapter: ",r.adapter]),!ae.adapters[r.adapter]||!ae.adapters[r.adapter].valid())throw new Error("Invalid Adapter: "+r.adapter);if(r.view_adapter&&(!ae.adapters[r.view_adapter]||!ae.adapters[r.view_adapter].valid()))throw new Error("Invalid View Adapter: "+r.view_adapter);this.taskqueue=new wa,this.adapter=r.adapter,ae.adapters[r.adapter].call(this,r,s=>{if(s)return this.taskqueue.fail(s);k0(this),this.emit("created",this),ae.emit("created",this.name),this.taskqueue.ready(this)})}},ae=Eh(Bi,function(t,e){Bi.prototype._setup.call(this,t,e)}),$h=fetch,Gr=Headers,ba=class{constructor(){this.tasks={}}list(){return Object.values(this.tasks)}add(e){let r=In();return this.tasks[r]={id:r,name:e.name,total_items:e.total_items,created_at:new Date().toJSON()},r}get(e){return this.tasks[e]}remove(e,r){return delete this.tasks[e],this.tasks}update(e,r){let n=this.tasks[e];if(typeof n<"u"){let i={id:n.id,name:n.name,created_at:n.created_at,total_items:r.total_items||n.total_items,completed_items:r.completed_items||n.completed_items,updated_at:new Date().toJSON()};this.tasks[e]=i}return this.tasks}};ae.adapters={};ae.preferredAdapters=[];ae.prefix="_pouch_";var Md=new ut;function x0(t){Object.keys(ut.prototype).forEach(function(r){typeof ut.prototype[r]=="function"&&(t[r]=Md[r].bind(Md))});var e=t._destructionListeners=new Map;t.on("ref",function(n){e.has(n.name)||e.set(n.name,[]),e.get(n.name).push(n)}),t.on("unref",function(n){if(e.has(n.name)){var i=e.get(n.name),s=i.indexOf(n);s<0||(i.splice(s,1),i.length>1?e.set(n.name,i):e.delete(n.name))}}),t.on("destroyed",function(n){if(e.has(n)){var i=e.get(n);e.delete(n),i.forEach(function(s){s.emit("destroyed",!0)})}})}x0(ae);ae.adapter=function(t,e,r){e.valid()&&(ae.adapters[t]=e,r&&ae.preferredAdapters.push(t))};ae.plugin=function(t){if(typeof t=="function")t(ae);else{if(typeof t!="object"||Object.keys(t).length===0)throw new Error('Invalid plugin: got "'+t+'", expected an object or a function');Object.keys(t).forEach(function(e){ae.prototype[e]=t[e]})}return this.__defaults&&(ae.__defaults=Object.assign({},this.__defaults)),ae};ae.defaults=function(t){let e=Eh(ae,function(r,n){n=n||{},r&&typeof r=="object"&&(n=r,r=n.name,delete n.name),n=Object.assign({},e.__defaults,n),ae.call(this,r,n)});return e.preferredAdapters=ae.preferredAdapters.slice(),Object.keys(ae).forEach(function(r){r in e||(e[r]=ae[r])}),e.__defaults=Object.assign({},this.__defaults,t),e};ae.fetch=function(t,e){return $h(t,e)};ae.prototype.activeTasks=ae.activeTasks=new ba;var N0="9.0.0";function Qa(t,e){for(var r=t,n=0,i=e.length;n<i;n++){var s=e[n];if(r=r[s],!r)break}return r}function j0(t,e){return t<e?-1:t>e?1:0}function Ya(t){for(var e=[],r="",n=0,i=t.length;n<i;n++){var s=t[n];n>0&&t[n-1]==="\\"&&(s==="$"||s===".")?r=r.substring(0,r.length-1)+s:s==="."?(e.push(r),r=""):r+=s}return e.push(r),e}var D0=["$or","$nor","$not"];function Sh(t){return D0.indexOf(t)>-1}function Ph(t){return Object.keys(t)[0]}function B0(t){return t[Ph(t)]}function qn(t){var e={},r={$or:!0,$nor:!0};return t.forEach(function(n){Object.keys(n).forEach(function(i){var s=n[i];if(typeof s!="object"&&(s={$eq:s}),Sh(i))if(s instanceof Array){if(r[i]){r[i]=!1,e[i]=s;return}var o=[];e[i].forEach(function(c){Object.keys(s).forEach(function(d){var m=s[d],f=Math.max(Object.keys(c).length,Object.keys(m).length),g=qn([c,m]);Object.keys(g).length<=f||o.push(g)})}),e[i]=o}else e[i]=qn([s]);else{var a=e[i]=e[i]||{};Object.keys(s).forEach(function(c){var d=s[c];if(c==="$gt"||c==="$gte")return L0(c,d,a);if(c==="$lt"||c==="$lte")return M0(c,d,a);if(c==="$ne")return U0(d,a);if(c==="$eq")return G0(d,a);if(c==="$regex")return F0(d,a);a[c]=d})}})}),e}function L0(t,e,r){typeof r.$eq<"u"||(typeof r.$gte<"u"?t==="$gte"?e>r.$gte&&(r.$gte=e):e>=r.$gte&&(delete r.$gte,r.$gt=e):typeof r.$gt<"u"?t==="$gte"?e>r.$gt&&(delete r.$gt,r.$gte=e):e>r.$gt&&(r.$gt=e):r[t]=e)}function M0(t,e,r){typeof r.$eq<"u"||(typeof r.$lte<"u"?t==="$lte"?e<r.$lte&&(r.$lte=e):e<=r.$lte&&(delete r.$lte,r.$lt=e):typeof r.$lt<"u"?t==="$lte"?e<r.$lt&&(delete r.$lt,r.$lte=e):e<r.$lt&&(r.$lt=e):r[t]=e)}function U0(t,e){"$ne"in e?e.$ne.push(t):e.$ne=[t]}function G0(t,e){delete e.$gt,delete e.$gte,delete e.$lt,delete e.$lte,delete e.$ne,e.$eq=t}function F0(t,e){"$regex"in e?e.$regex.push(t):e.$regex=[t]}function Oh(t){for(var e in t){if(Array.isArray(t))for(var r in t)t[r].$and&&(t[r]=qn(t[r].$and));var n=t[e];typeof n=="object"&&Oh(n)}return t}function Ah(t,e){for(var r in t){r==="$and"&&(e=!0);var n=t[r];typeof n=="object"&&(e=Ah(n,e))}return e}function K0(t){var e=Ge(t);Ah(e,!1)&&(e=Oh(e),"$and"in e&&(e=qn(e.$and))),["$or","$nor"].forEach(function(o){o in e&&e[o].forEach(function(a){for(var c=Object.keys(a),d=0;d<c.length;d++){var m=c[d],f=a[m];(typeof f!="object"||f===null)&&(a[m]={$eq:f})}})}),"$not"in e&&(e.$not=qn([e.$not]));for(var r=Object.keys(e),n=0;n<r.length;n++){var i=r[n],s=e[i];(typeof s!="object"||s===null)&&(s={$eq:s}),e[i]=s}return Ea(e),e}function Ea(t){Object.keys(t).forEach(function(e){var r=t[e];Array.isArray(r)?r.forEach(function(n){n&&typeof n=="object"&&Ea(n)}):e==="$ne"?t.$ne=[r]:e==="$regex"?t.$regex=[r]:r&&typeof r=="object"&&Ea(r)})}function z0(t,e,r){for(var n="",i=r-t.length;n.length<i;)n+=e;return n}function V0(t,e,r){var n=z0(t,e,r);return n+t}var Ih=-324,$a=3,Sa="";function Be(t,e){if(t===e)return 0;t=br(t),e=br(e);var r=Pa(t),n=Pa(e);if(r-n!==0)return r-n;switch(typeof t){case"number":return t-e;case"boolean":return t<e?-1:1;case"string":return X0(t,e)}return Array.isArray(t)?Y0(t,e):Z0(t,e)}function br(t){switch(typeof t){case"undefined":return null;case"number":return t===1/0||t===-1/0||isNaN(t)?null:t;case"object":var e=t;if(Array.isArray(t)){var r=t.length;t=new Array(r);for(var n=0;n<r;n++)t[n]=br(e[n])}else{if(t instanceof Date)return t.toJSON();if(t!==null){t={};for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){var s=e[i];typeof s<"u"&&(t[i]=br(s))}}}}return t}function J0(t){if(t!==null)switch(typeof t){case"boolean":return t?1:0;case"number":return ew(t);case"string":return t.replace(/\u0002/g,"").replace(/\u0001/g,"").replace(/\u0000/g,"");case"object":var e=Array.isArray(t),r=e?t:Object.keys(t),n=-1,i=r.length,s="";if(e)for(;++n<i;)s+=Et(r[n]);else for(;++n<i;){var o=r[n];s+=Et(o)+Et(t[o])}return s}return""}function Et(t){var e="\0";return t=br(t),Pa(t)+Sa+J0(t)+e}function H0(t,e){var r=e,n,i=t[e]==="1";if(i)n=0,e++;else{var s=t[e]==="0";e++;var o="",a=t.substring(e,e+$a),c=parseInt(a,10)+Ih;for(s&&(c=-c),e+=$a;;){var d=t[e];if(d==="\0")break;o+=d,e++}o=o.split("."),o.length===1?n=parseInt(o,10):n=parseFloat(o[0]+"."+o[1]),s&&(n=n-10),c!==0&&(n=parseFloat(n+"e"+c))}return{num:n,length:e-r}}function W0(t,e){var r=t.pop();if(e.length){var n=e[e.length-1];r===n.element&&(e.pop(),n=e[e.length-1]);var i=n.element,s=n.index;if(Array.isArray(i))i.push(r);else if(s===t.length-2){var o=t.pop();i[o]=r}else t.push(r)}}function Q0(t){for(var e=[],r=[],n=0;;){var i=t[n++];if(i==="\0"){if(e.length===1)return e.pop();W0(e,r);continue}switch(i){case"1":e.push(null);break;case"2":e.push(t[n]==="1"),n++;break;case"3":var s=H0(t,n);e.push(s.num),n+=s.length;break;case"4":for(var o="";;){var a=t[n];if(a==="\0")break;o+=a,n++}o=o.replace(/\u0001\u0001/g,"\0").replace(/\u0001\u0002/g,"").replace(/\u0002\u0002/g,""),e.push(o);break;case"5":var c={element:[],index:e.length};e.push(c.element),r.push(c);break;case"6":var d={element:{},index:e.length};e.push(d.element),r.push(d);break;default:throw new Error("bad collationIndex or unexpectedly reached end of input: "+i)}}}function Y0(t,e){for(var r=Math.min(t.length,e.length),n=0;n<r;n++){var i=Be(t[n],e[n]);if(i!==0)return i}return t.length===e.length?0:t.length>e.length?1:-1}function X0(t,e){return t===e?0:t>e?1:-1}function Z0(t,e){for(var r=Object.keys(t),n=Object.keys(e),i=Math.min(r.length,n.length),s=0;s<i;s++){var o=Be(r[s],n[s]);if(o!==0||(o=Be(t[r[s]],e[n[s]]),o!==0))return o}return r.length===n.length?0:r.length>n.length?1:-1}function Pa(t){var e=["boolean","number","string","object"],r=e.indexOf(typeof t);if(~r)return t===null?1:Array.isArray(t)?5:r<3?r+2:r+3;if(Array.isArray(t))return 5}function ew(t){if(t===0)return"1";var e=t.toExponential().split(/e\+?/),r=parseInt(e[1],10),n=t<0,i=n?"0":"2",s=(n?-r:r)-Ih,o=V0(s.toString(),"0",$a);i+=Sa+o;var a=Math.abs(parseFloat(e[0]));n&&(a=10-a);var c=a.toFixed(20);return c=c.replace(/\.?0+$/,""),i+=Sa+c,i}function tw(t){function e(r){return t.map(function(n){var i=Ph(n),s=Ya(i),o=Qa(r,s);return o})}return function(r,n){var i=e(r.doc),s=e(n.doc),o=Be(i,s);return o!==0?o:j0(r.doc._id,n.doc._id)}}function rw(t,e,r){if(t=t.filter(function(o){return Fr(o.doc,e.selector,r)}),e.sort){var n=tw(e.sort);t=t.sort(n),typeof e.sort[0]!="string"&&B0(e.sort[0])==="desc"&&(t=t.reverse())}if("limit"in e||"skip"in e){var i=e.skip||0,s=("limit"in e?e.limit:t.length)+i;t=t.slice(i,s)}return t}function Fr(t,e,r){return r.every(function(n){var i=e[n],s=Ya(n),o=Qa(t,s);return Sh(n)?nw(n,i,t):Li(i,t,s,o)})}function Li(t,e,r,n){return t?typeof t=="object"?Object.keys(t).every(function(i){var s=t[i];if(i.indexOf("$")===0)return Ud(i,e,s,r,n);var o=Ya(i);if(n===void 0&&typeof s!="object"&&o.length>0)return!1;var a=Qa(n,o);return typeof s=="object"?Li(s,e,r,a):Ud("$eq",e,s,o,a)}):t===n:!0}function nw(t,e,r){return t==="$or"?e.some(function(n){return Fr(r,n,Object.keys(n))}):t==="$not"?!Fr(r,e,Object.keys(e)):!e.find(function(n){return Fr(r,n,Object.keys(n))})}function Ud(t,e,r,n,i){if(!Fd[t])throw new Error('unknown operator "'+t+'" - should be one of $eq, $lte, $lt, $gt, $gte, $exists, $ne, $in, $nin, $size, $mod, $regex, $elemMatch, $type, $allMatch or $all');return Fd[t](e,r,n,i)}function Tn(t){return typeof t<"u"&&t!==null}function hr(t){return typeof t<"u"}function iw(t,e){if(typeof t!="number"||parseInt(t,10)!==t)return!1;var r=e[0],n=e[1];return t%r===n}function Gd(t,e){return e.some(function(r){return t instanceof Array?t.some(function(n){return Be(r,n)===0}):Be(r,t)===0})}function sw(t,e){return e.every(function(r){return t.some(function(n){return Be(r,n)===0})})}function ow(t,e){return t.length===e}function aw(t,e){var r=new RegExp(e);return r.test(t)}function uw(t,e){switch(e){case"null":return t===null;case"boolean":return typeof t=="boolean";case"number":return typeof t=="number";case"string":return typeof t=="string";case"array":return t instanceof Array;case"object":return{}.toString.call(t)==="[object Object]"}}var Fd={$elemMatch:function(t,e,r,n){return!Array.isArray(n)||n.length===0?!1:typeof n[0]=="object"&&n[0]!==null?n.some(function(i){return Fr(i,e,Object.keys(e))}):n.some(function(i){return Li(e,t,r,i)})},$allMatch:function(t,e,r,n){return!Array.isArray(n)||n.length===0?!1:typeof n[0]=="object"&&n[0]!==null?n.every(function(i){return Fr(i,e,Object.keys(e))}):n.every(function(i){return Li(e,t,r,i)})},$eq:function(t,e,r,n){return hr(n)&&Be(n,e)===0},$gte:function(t,e,r,n){return hr(n)&&Be(n,e)>=0},$gt:function(t,e,r,n){return hr(n)&&Be(n,e)>0},$lte:function(t,e,r,n){return hr(n)&&Be(n,e)<=0},$lt:function(t,e,r,n){return hr(n)&&Be(n,e)<0},$exists:function(t,e,r,n){return e?hr(n):!hr(n)},$mod:function(t,e,r,n){return Tn(n)&&iw(n,e)},$ne:function(t,e,r,n){return e.every(function(i){return Be(n,i)!==0})},$in:function(t,e,r,n){return Tn(n)&&Gd(n,e)},$nin:function(t,e,r,n){return Tn(n)&&!Gd(n,e)},$size:function(t,e,r,n){return Tn(n)&&Array.isArray(n)&&ow(n,e)},$all:function(t,e,r,n){return Array.isArray(n)&&sw(n,e)},$regex:function(t,e,r,n){return Tn(n)&&typeof n=="string"&&e.every(function(i){return aw(n,i)})},$type:function(t,e,r,n){return uw(n,e)}};function cw(t,e){if(typeof e!="object")throw new Error("Selector error: expected a JSON object");e=K0(e);var r={doc:t},n=rw([r],{selector:e},Object.keys(e));return n&&n.length===1}function fw(t){return Ua(`"use strict";
|
|
12
|
-
return `+t+";",{})}function
|
|
13
|
-
`);return Ua(e,{})}function dw(t,e){if(t.selector&&t.filter&&t.filter!=="_selector"){var r=typeof t.filter=="string"?t.filter:"function";return e(new Error('selector invalid for filter "'+r+'"'))}e()}function hw(t){t.view&&!t.filter&&(t.filter="_view"),t.selector&&!t.filter&&(t.filter="_selector"),t.filter&&typeof t.filter=="string"&&(t.filter==="_view"?t.view=Nd(t.view):t.filter=Nd(t.filter))}function pw(t,e){return e.filter&&typeof e.filter=="string"&&!e.doc_ids&&!Rt(t.db)}function mw(t,e){var r=e.complete;if(e.filter==="_view"){if(!e.view||typeof e.view!="string"){var n=oe(zi,"`view` filter parameter not found or invalid.");return r(n)}var i=ga(e.view);t.db.get("_design/"+i[0],function(o,a){if(t.isCancelled)return r(null,{status:"cancelled"});if(o)return r(zr(o));var c=a&&a.views&&a.views[i[1]]&&a.views[i[1]].map;if(!c)return r(oe(pt,a.views?"missing json key: "+i[1]:"missing json key: views"));e.filter=lw(c),t.doChanges(e)})}else if(e.selector)e.filter=function(o){return cw(o,e.selector)},t.doChanges(e);else{var s=ga(e.filter);t.db.get("_design/"+s[0],function(o,a){if(t.isCancelled)return r(null,{status:"cancelled"});if(o)return r(zr(o));var c=a&&a.filters&&a.filters[s[1]];if(!c)return r(oe(pt,a&&a.filters?"missing json key: "+s[1]:"missing json key: filters"));e.filter=fw(c),t.doChanges(e)})}}function vw(t){t._changesFilterPlugin={validate:dw,normalize:hw,shouldFilter:pw,filter:mw}}ae.plugin(vw);ae.version=N0;function yw(t,e,r){return new Promise(function(n){var i=Fa([""]);let s;if(typeof r=="function"){let a=r(i);s=t.objectStore(e).put(a)}else{let o=r;s=t.objectStore(e).put(i,o)}s.onsuccess=function(){var o=navigator.userAgent.match(/Chrome\/(\d+)/),a=navigator.userAgent.match(/Edge\//);n(a||!o||parseInt(o[1],10)>=43)},s.onerror=t.onabort=function(o){o.preventDefault(),o.stopPropagation(),n(!1)}}).catch(function(){return!1})}function Th(t){return t.reduce(function(e,r){return e[r]=!0,e},{})}var gw=Th(["_id","_rev","_access","_attachments","_deleted","_revisions","_revs_info","_conflicts","_deleted_conflicts","_local_seq","_rev_tree","_replication_id","_replication_state","_replication_state_time","_replication_state_reason","_replication_stats","_removed"]),_w=Th(["_access","_attachments","_replication_id","_replication_state","_replication_state_time","_replication_state_reason","_replication_stats"]);function Kd(t){if(!/^\d+-/.test(t))return oe(Ci);var e=t.indexOf("-"),r=t.substring(0,e),n=t.substring(e+1);return{prefix:parseInt(r,10),id:n}}function ww(t,e){for(var r=t.start-t.ids.length+1,n=t.ids,i=[n[0],e,[]],s=1,o=n.length;s<o;s++)i=[n[s],{status:"missing"},[i]];return[{pos:r,ids:i}]}function Rh(t,e,r){r||(r={deterministic_revs:!0});var n,i,s,o={status:"available"};if(t._deleted&&(o.deleted=!0),e)if(t._id||(t._id=Vi()),i=yh(t,r.deterministic_revs),t._rev){if(s=Kd(t._rev),s.error)return s;t._rev_tree=[{pos:s.prefix,ids:[s.id,{status:"missing"},[[i,o,[]]]]}],n=s.prefix+1}else t._rev_tree=[{pos:1,ids:[i,o,[]]}],n=1;else if(t._revisions&&(t._rev_tree=ww(t._revisions,o),n=t._revisions.start,i=t._revisions.ids[0]),!t._rev_tree){if(s=Kd(t._rev),s.error)return s;n=s.prefix,i=s.id,t._rev_tree=[{pos:n,ids:[i,o,[]]}]}dh(t._id),t._rev=n+"-"+i;var a={metadata:{},data:{}};for(var c in t)if(Object.prototype.hasOwnProperty.call(t,c)){var d=c[0]==="_";if(d&&!gw[c]){var m=oe(xd,c);throw m.message=xd.message+": "+c,m}else d&&!_w[c]?a.metadata[c.slice(1)]=t[c]:a.data[c]=t[c]}return a}function bw(t){try{return Ga(t)}catch{var e=oe(lh,"Attachment is not a valid base64 string");return{error:e}}}function Ew(t,e,r){var n=bw(t.data);if(n.error)return r(n.error);t.length=n.length,e==="blob"?t.data=Ka(n,t.content_type):e==="base64"?t.data=xn(n):t.data=n,Ja(n,function(i){t.digest="md5-"+i,r()})}function $w(t,e,r){Ja(t.data,function(n){t.digest="md5-"+n,t.length=t.data.size||t.data.length||0,e==="binary"?mh(t.data,function(i){t.data=i,r()}):e==="base64"?Va(t.data,function(i){t.data=i,r()}):r()})}function Sw(t,e,r){if(t.stub)return r();typeof t.data=="string"?Ew(t,e,r):$w(t,e,r)}function Pw(t,e,r){if(!t.length)return r();var n=0,i;t.forEach(function(o){var a=o.data&&o.data._attachments?Object.keys(o.data._attachments):[],c=0;if(!a.length)return s();function d(f){i=f,c++,c===a.length&&s()}for(var m in o.data._attachments)Object.prototype.hasOwnProperty.call(o.data._attachments,m)&&Sw(o.data._attachments[m],e,d)});function s(){n++,t.length===n&&(i?r(i):r())}}function Ow(t,e,r,n,i,s,o,a){if(_0(e.rev_tree,r.metadata.rev)&&!a)return n[i]=r,s();var c=e.winningRev||_r(e),d="deleted"in e?e.deleted:Mt(e,c),m="deleted"in r.metadata?r.metadata.deleted:Mt(r.metadata),f=/^1-/.test(r.metadata.rev);if(d&&!m&&a&&f){var g=r.data;g._rev=c,g._id=r.metadata.id,r=Rh(g,a)}var _=wh(e.rev_tree,r.metadata.rev_tree[0],t),b=a&&(d&&m&&_.conflicts!=="new_leaf"||!d&&_.conflicts!=="new_leaf"||d&&!m&&_.conflicts==="new_branch");if(b){var P=oe(Kr);return n[i]=P,s()}var S=r.metadata.rev;r.metadata.rev_tree=_.tree,r.stemmedRevs=_.stemmedRevs||[],e.rev_map&&(r.metadata.rev_map=e.rev_map);var y=_r(r.metadata),w=Mt(r.metadata,y),p=d===w?0:d<w?-1:1,h;S===y?h=w:h=Mt(r.metadata,S),o(r,y,w,h,!0,p,i,s)}function Aw(t){return t.metadata.rev_tree[0].ids[1].status==="missing"}function Iw(t,e,r,n,i,s,o,a,c){t=t||1e3;function d(P,S,y){var w=_r(P.metadata),p=Mt(P.metadata,w);if("was_delete"in a&&p)return s[S]=oe(pt,"deleted"),y();var h=m&&Aw(P);if(h){var v=oe(Kr);return s[S]=v,y()}var E=p?0:1;o(P,w,p,p,!1,E,S,y)}var m=a.new_edits,f=new Map,g=0,_=e.length;function b(){++g===_&&c&&c()}e.forEach(function(P,S){if(P._id&&gr(P._id)){var y=P._deleted?"_removeLocal":"_putLocal";r[y](P,{ctx:i},function(p,h){s[S]=p||h,b()});return}var w=P.metadata.id;f.has(w)?(_--,f.get(w).push([P,S])):f.set(w,[[P,S]])}),f.forEach(function(P,S){var y=0;function w(){++y<P.length?p():b()}function p(){var h=P[y],v=h[0],E=h[1];if(n.has(S))Ow(t,n.get(S),v,s,E,w,o,m);else{var C=wh([],v.metadata.rev_tree[0],t);v.metadata.rev_tree=C.tree,v.stemmedRevs=C.stemmedRevs||[],d(v,E,w)}}p()})}var Tw=5,Le="document-store",Je="by-sequence",mt="attach-store",vr="attach-seq-store",rt="meta-store",It="local-store",oa="detect-blob-support";function Rw(t){try{return JSON.parse(t)}catch{return Da.default.parse(t)}}function qw(t){try{return JSON.stringify(t)}catch{return Da.default.stringify(t)}}function Tt(t){return function(e){var r="unknown_error";e.target&&e.target.error&&(r=e.target.error.name||e.target.error.message),t(oe(La,r,e.type))}}function Oa(t,e,r){return{data:qw(t),winningRev:e,deletedOrLocal:r?"1":"0",seq:t.seq,id:t.id}}function yr(t){if(!t)return null;var e=Rw(t.data);return e.winningRev=t.winningRev,e.deleted=t.deletedOrLocal==="1",e.seq=t.seq,e}function Mi(t){if(!t)return t;var e=t._doc_id_rev.lastIndexOf(":");return t._id=t._doc_id_rev.substring(0,e-1),t._rev=t._doc_id_rev.substring(e+1),delete t._doc_id_rev,t}function qh(t,e,r,n){r?n(t?typeof t!="string"?t:za(t,e):Fa([""],{type:e})):t?typeof t!="string"?ph(t,function(i){n(xn(i))}):n(t):n("")}function Ch(t,e,r,n){var i=Object.keys(t._attachments||{});if(!i.length)return n&&n();var s=0;function o(){++s===i.length&&n&&n()}function a(c,d){var m=c._attachments[d],f=m.digest,g=r.objectStore(mt).get(f);g.onsuccess=function(_){m.body=_.target.result.body,o()}}i.forEach(function(c){e.attachments&&e.include_docs?a(t,c):(t._attachments[c].stub=!0,o())})}function Aa(t,e){return Promise.all(t.map(function(r){if(r.doc&&r.doc._attachments){var n=Object.keys(r.doc._attachments);return Promise.all(n.map(function(i){var s=r.doc._attachments[i];if("body"in s){var o=s.body,a=s.content_type;return new Promise(function(c){qh(o,a,e,function(d){r.doc._attachments[i]=Object.assign(kn(s,["digest","content_type"]),{data:d}),c()})})}}))}}))}function kh(t,e,r){var n=[],i=r.objectStore(Je),s=r.objectStore(mt),o=r.objectStore(vr),a=t.length;function c(){a--,a||d()}function d(){n.length&&n.forEach(function(m){var f=o.index("digestSeq").count(IDBKeyRange.bound(m+"::",m+"::\uFFFF",!1,!1));f.onsuccess=function(g){var _=g.target.result;_||s.delete(m)}})}t.forEach(function(m){var f=i.index("_doc_id_rev"),g=e+"::"+m;f.getKey(g).onsuccess=function(_){var b=_.target.result;if(typeof b!="number")return c();i.delete(b);var P=o.index("seq").openCursor(IDBKeyRange.only(b));P.onsuccess=function(S){var y=S.target.result;if(y){var w=y.value.digestSeq.split("::")[0];n.push(w),o.delete(y.primaryKey),y.continue()}else c()}}})}function $t(t,e,r){try{return{txn:t.transaction(e,r)}}catch(n){return{error:n}}}var Rn=new va;function Cw(t,e,r,n,i,s){for(var o=e.docs,a,c,d,m,f,g,_,b,P=0,S=o.length;P<S;P++){var y=o[P];y._id&&gr(y._id)||(y=o[P]=Rh(y,r.new_edits,t),y.error&&!_&&(_=y))}if(_)return s(_);var w=!1,p=0,h=new Array(o.length),v=new Map,E=!1,C=n._meta.blobSupport?"blob":"base64";Pw(o,C,function(B){if(B)return s(B);x()});function x(){var B=[Le,Je,mt,It,vr,rt],F=$t(i,B,"readwrite");if(F.error)return s(F.error);a=F.txn,a.onabort=Tt(s),a.ontimeout=Tt(s),a.oncomplete=Q,c=a.objectStore(Le),d=a.objectStore(Je),m=a.objectStore(mt),f=a.objectStore(vr),g=a.objectStore(rt),g.get(rt).onsuccess=function(X){b=X.target.result,H()},ce(function(X){if(X)return E=!0,s(X);re()})}function j(){w=!0,H()}function G(){Iw(t.revs_limit,o,n,v,a,h,fe,r,j)}function H(){!b||!w||(b.docCount+=p,g.put(b))}function re(){if(!o.length)return;var B=0;function F(){++B===o.length&&G()}function X(W){var ee=yr(W.target.result);ee&&v.set(ee.id,ee),F()}for(var ie=0,J=o.length;ie<J;ie++){var D=o[ie];if(D._id&&gr(D._id)){F();continue}var M=c.get(D.metadata.id);M.onsuccess=X}}function Q(){E||(Rn.notify(n._meta.name),s(null,h))}function Z(B,F){var X=m.get(B);X.onsuccess=function(ie){if(ie.target.result)F();else{var J=oe(Y_,"unknown stub attachment with digest "+B);J.status=412,F(J)}}}function ce(B){var F=[];if(o.forEach(function(D){D.data&&D.data._attachments&&Object.keys(D.data._attachments).forEach(function(M){var W=D.data._attachments[M];W.stub&&F.push(W.digest)})}),!F.length)return B();var X=0,ie;function J(){++X===F.length&&B(ie)}F.forEach(function(D){Z(D,function(M){M&&!ie&&(ie=M),J()})})}function fe(B,F,X,ie,J,D,M,W){B.metadata.winningRev=F,B.metadata.deleted=X;var ee=B.data;ee._id=B.metadata.id,ee._rev=B.metadata.rev,ie&&(ee._deleted=!0);var ne=ee._attachments&&Object.keys(ee._attachments).length;if(ne)return q(B,F,X,J,M,W);p+=D,H(),me(B,F,X,J,M,W)}function me(B,F,X,ie,J,D){var M=B.data,W=B.metadata;M._doc_id_rev=W.id+"::"+W.rev,delete M._id,delete M._rev;function ee(Re){var We=B.stemmedRevs||[];ie&&n.auto_compaction&&(We=We.concat(d0(B.metadata))),We&&We.length&&kh(We,B.metadata.id,a),W.seq=Re.target.result;var ct=Oa(W,F,X),ve=c.put(ct);ve.onsuccess=Ee}function ne(Re){Re.preventDefault(),Re.stopPropagation();var We=d.index("_doc_id_rev"),ct=We.getKey(M._doc_id_rev);ct.onsuccess=function(ve){var ge=d.put(M,ve.target.result);ge.onsuccess=ee}}function Ee(){h[J]={ok:!0,id:W.id,rev:W.rev},v.set(B.metadata.id,B.metadata),k(B,W.seq,D)}var $e=d.put(M);$e.onsuccess=ee,$e.onerror=ne}function q(B,F,X,ie,J,D){var M=B.data,W=0,ee=Object.keys(M._attachments);function ne(){W===ee.length&&me(B,F,X,ie,J,D)}function Ee(){W++,ne()}ee.forEach(function($e){var Re=B.data._attachments[$e];if(Re.stub)W++,ne();else{var We=Re.data;delete Re.data,Re.revpos=parseInt(F,10);var ct=Re.digest;L(ct,We,Ee)}})}function k(B,F,X){var ie=0,J=Object.keys(B.data._attachments||{});if(!J.length)return X();function D(){++ie===J.length&&X()}function M(ee){var ne=B.data._attachments[ee].digest,Ee=f.put({seq:F,digestSeq:ne+"::"+F});Ee.onsuccess=D,Ee.onerror=function($e){$e.preventDefault(),$e.stopPropagation(),D()}}for(var W=0;W<J.length;W++)M(J[W])}function L(B,F,X){var ie=m.count(B);ie.onsuccess=function(J){var D=J.target.result;if(D)return X();var M={digest:B,body:F},W=m.put(M);W.onsuccess=X}}}function xh(t,e,r,n,i){n===-1&&(n=1e3);var s=typeof t.getAll=="function"&&typeof t.getAllKeys=="function"&&n>1&&!r,o,a,c;function d(_){a=_.target.result,o&&i(o,a,c)}function m(_){o=_.target.result,a&&i(o,a,c)}function f(){if(!o.length)return i();var _=o[o.length-1],b;if(e&&e.upper)try{b=IDBKeyRange.bound(_,e.upper,!0,e.upperOpen)}catch(P){if(P.name==="DataError"&&P.code===0)return i()}else b=IDBKeyRange.lowerBound(_,!0);e=b,o=null,a=null,t.getAll(e,n).onsuccess=d,t.getAllKeys(e,n).onsuccess=m}function g(_){var b=_.target.result;if(!b)return i();i([b.key],[b.value],b)}s?(c={continue:f},t.getAll(e,n).onsuccess=d,t.getAllKeys(e,n).onsuccess=m):r?t.openCursor(e,"prev").onsuccess=g:t.openCursor(e).onsuccess=g}function kw(t,e,r){if(typeof t.getAll=="function"){t.getAll(e).onsuccess=r;return}var n=[];function i(s){var o=s.target.result;o?(n.push(o.value),o.continue()):r({target:{result:n}})}t.openCursor(e).onsuccess=i}function xw(t,e,r){var n=new Array(t.length),i=0;t.forEach(function(s,o){e.get(s).onsuccess=function(a){a.target.result?n[o]=a.target.result:n[o]={key:s,error:"not_found"},i++,i===t.length&&r(t,n,{})}})}function Nw(t,e,r,n,i){try{if(t&&e)return i?IDBKeyRange.bound(e,t,!r,!1):IDBKeyRange.bound(t,e,!1,!r);if(t)return i?IDBKeyRange.upperBound(t):IDBKeyRange.lowerBound(t);if(e)return i?IDBKeyRange.lowerBound(e,!r):IDBKeyRange.upperBound(e,!r);if(n)return IDBKeyRange.only(n)}catch(s){return{error:s}}return null}function jw(t,e,r){var n="startkey"in t?t.startkey:!1,i="endkey"in t?t.endkey:!1,s="key"in t?t.key:!1,o="keys"in t?t.keys:!1,a=t.skip||0,c=typeof t.limit=="number"?t.limit:-1,d=t.inclusive_end!==!1,m,f;if(!o&&(m=Nw(n,i,d,s,t.descending),f=m&&m.error,f&&!(f.name==="DataError"&&f.code===0)))return r(oe(La,f.name,f.message));var g=[Le,Je,rt];t.attachments&&g.push(mt);var _=$t(e,g,"readonly");if(_.error)return r(_.error);var b=_.txn;b.oncomplete=re,b.onabort=Tt(r);var P=b.objectStore(Le),S=b.objectStore(Je),y=b.objectStore(rt),w=S.index("_doc_id_rev"),p=[],h,v;y.get(rt).onsuccess=function(Q){h=Q.target.result.docCount},t.update_seq&&(S.openKeyCursor(null,"prev").onsuccess=Q=>{var Z=Q.target.result;Z&&Z.key&&(v=Z.key)});function E(Q,Z,ce){var fe=Q.id+"::"+ce;w.get(fe).onsuccess=function(q){if(Z.doc=Mi(q.target.result)||{},t.conflicts){var k=Wa(Q);k.length&&(Z.doc._conflicts=k)}Ch(Z.doc,t,b)}}function C(Q,Z){var ce={id:Z.id,key:Z.id,value:{rev:Q}},fe=Z.deleted;fe?o&&(p.push(ce),ce.value.deleted=!0,ce.doc=null):a--<=0&&(p.push(ce),t.include_docs&&E(Z,ce,Q))}function x(Q){for(var Z=0,ce=Q.length;Z<ce&&p.length!==c;Z++){var fe=Q[Z];if(fe.error&&o){p.push(fe);continue}var me=yr(fe),q=me.winningRev;C(q,me)}}function j(Q,Z,ce){ce&&(x(Z),p.length<c&&ce.continue())}function G(Q){var Z=Q.target.result;t.descending&&(Z=Z.reverse()),x(Z)}function H(){var Q={total_rows:h,offset:t.skip,rows:p};t.update_seq&&v!==void 0&&(Q.update_seq=v),r(null,Q)}function re(){t.attachments?Aa(p,t.binary).then(H):H()}if(!(f||c===0)){if(o)return xw(o,P,j);if(c===-1)return kw(P,m,G);xh(P,m,t.descending,c+a,j)}}function Dw(t,e){var r=t.objectStore(Le).index("deletedOrLocal");r.count(IDBKeyRange.only("0")).onsuccess=function(n){e(n.target.result)}}var Ia=!1,Ta=[];function Bw(t,e,r,n){try{t(e,r)}catch(i){n.emit("error",i)}}function zd(){Ia||!Ta.length||(Ia=!0,Ta.shift()())}function Lw(t,e,r){Ta.push(function(){t(function(s,o){Bw(e,s,o,r),Ia=!1,qt(function(){zd(r)})})}),zd()}function Mw(t,e,r,n){if(t=Ge(t),t.continuous){var i=r+":"+Vi();return Rn.addListener(r,i,e,t),Rn.notify(r),{cancel:function(){Rn.removeListener(r,i)}}}var s=t.doc_ids&&new Set(t.doc_ids);t.since=t.since||0;var o=t.since,a="limit"in t?t.limit:-1;a===0&&(a=1);var c=[],d=0,m=Ma(t),f=new Map,g,_,b,P;function S(x,j,G){if(!G||!x.length)return;var H=new Array(x.length),re=new Array(x.length);function Q(fe,me){var q=t.processChange(me,fe,t);o=q.seq=fe.seq;var k=m(q);return typeof k=="object"?Promise.reject(k):k?(d++,t.return_docs&&c.push(q),t.attachments&&t.include_docs?new Promise(function(L){Ch(me,t,g,function(){Aa([q],t.binary).then(function(){L(q)})})}):Promise.resolve(q)):Promise.resolve()}function Z(){for(var fe=[],me=0,q=H.length;me<q&&d!==a;me++){var k=H[me];if(k){var L=re[me];fe.push(Q(L,k))}}Promise.all(fe).then(function(B){for(var F=0,X=B.length;F<X;F++)B[F]&&t.onChange(B[F])}).catch(t.complete),d!==a&&G.continue()}var ce=0;j.forEach(function(fe,me){var q=Mi(fe),k=x[me];w(q,k,function(L,B){re[me]=L,H[me]=B,++ce===x.length&&Z()})})}function y(x,j,G,H){if(G.seq!==j)return H();if(G.winningRev===x._rev)return H(G,x);var re=x._id+"::"+G.winningRev,Q=P.get(re);Q.onsuccess=function(Z){H(G,Mi(Z.target.result))}}function w(x,j,G){if(s&&!s.has(x._id))return G();var H=f.get(x._id);if(H)return y(x,j,H,G);b.get(x._id).onsuccess=function(re){H=yr(re.target.result),f.set(x._id,H),y(x,j,H,G)}}function p(){t.complete(null,{results:c,last_seq:o})}function h(){!t.continuous&&t.attachments?Aa(c).then(p):p()}var v=[Le,Je];t.attachments&&v.push(mt);var E=$t(n,v,"readonly");if(E.error)return t.complete(E.error);g=E.txn,g.onabort=Tt(t.complete),g.oncomplete=h,_=g.objectStore(Je),b=g.objectStore(Le),P=_.index("_doc_id_rev");var C=t.since&&!t.descending?IDBKeyRange.lowerBound(t.since,!0):null;xh(_,C,t.descending,a,S)}var Ur=new Map,aa,ua=new Map;function Nh(t,e){var r=this;Lw(function(n){Uw(r,t,n)},e,r.constructor)}function Uw(t,e,r){var n=e.name,i=null,s=null;t._meta=null;function o(S){return function(y,w){y&&y instanceof Error&&!y.reason&&s&&(y.reason=s),S(y,w)}}function a(S){var y=S.createObjectStore(Le,{keyPath:"id"});S.createObjectStore(Je,{autoIncrement:!0}).createIndex("_doc_id_rev","_doc_id_rev",{unique:!0}),S.createObjectStore(mt,{keyPath:"digest"}),S.createObjectStore(rt,{keyPath:"id",autoIncrement:!1}),S.createObjectStore(oa),y.createIndex("deletedOrLocal","deletedOrLocal",{unique:!1}),S.createObjectStore(It,{keyPath:"_id"});var w=S.createObjectStore(vr,{autoIncrement:!0});w.createIndex("seq","seq"),w.createIndex("digestSeq","digestSeq",{unique:!0})}function c(S,y){var w=S.objectStore(Le);w.createIndex("deletedOrLocal","deletedOrLocal",{unique:!1}),w.openCursor().onsuccess=function(p){var h=p.target.result;if(h){var v=h.value,E=Mt(v);v.deletedOrLocal=E?"1":"0",w.put(v),h.continue()}else y()}}function d(S){S.createObjectStore(It,{keyPath:"_id"}).createIndex("_doc_id_rev","_doc_id_rev",{unique:!0})}function m(S,y){var w=S.objectStore(It),p=S.objectStore(Le),h=S.objectStore(Je),v=p.openCursor();v.onsuccess=function(E){var C=E.target.result;if(C){var x=C.value,j=x.id,G=gr(j),H=_r(x);if(G){var re=j+"::"+H,Q=j+"::",Z=j+"::~",ce=h.index("_doc_id_rev"),fe=IDBKeyRange.bound(Q,Z,!1,!1),me=ce.openCursor(fe);me.onsuccess=function(q){if(me=q.target.result,!me)p.delete(C.primaryKey),C.continue();else{var k=me.value;k._doc_id_rev===re&&w.put(k),h.delete(me.primaryKey),me.continue()}}}else C.continue()}else y&&y()}}function f(S){var y=S.createObjectStore(vr,{autoIncrement:!0});y.createIndex("seq","seq"),y.createIndex("digestSeq","digestSeq",{unique:!0})}function g(S,y){var w=S.objectStore(Je),p=S.objectStore(mt),h=S.objectStore(vr),v=p.count();v.onsuccess=function(E){var C=E.target.result;if(!C)return y();w.openCursor().onsuccess=function(x){var j=x.target.result;if(!j)return y();for(var G=j.value,H=j.primaryKey,re=Object.keys(G._attachments||{}),Q={},Z=0;Z<re.length;Z++){var ce=G._attachments[re[Z]];Q[ce.digest]=!0}var fe=Object.keys(Q);for(Z=0;Z<fe.length;Z++){var me=fe[Z];h.put({seq:H,digestSeq:me+"::"+H})}j.continue()}}}function _(S){function y(v){return v.data?yr(v):(v.deleted=v.deletedOrLocal==="1",v)}var w=S.objectStore(Je),p=S.objectStore(Le),h=p.openCursor();h.onsuccess=function(v){var E=v.target.result;if(!E)return;var C=y(E.value);C.winningRev=C.winningRev||_r(C);function x(){var G=C.id+"::",H=C.id+"::\uFFFF",re=w.index("_doc_id_rev").openCursor(IDBKeyRange.bound(G,H)),Q=0;re.onsuccess=function(Z){var ce=Z.target.result;if(!ce)return C.seq=Q,j();var fe=ce.primaryKey;fe>Q&&(Q=fe),ce.continue()}}function j(){var G=Oa(C,C.winningRev,C.deleted),H=p.put(G);H.onsuccess=function(){E.continue()}}if(C.seq)return j();x()}}t._remote=!1,t.type=function(){return"idb"},t._id=uh(function(S){S(null,t._meta.instanceId)}),t._bulkDocs=function(y,w,p){Cw(e,y,w,t,i,o(p))},t._get=function(y,w,p){var h,v,E,C=w.ctx;if(!C){var x=$t(i,[Le,Je,mt],"readonly");if(x.error)return p(x.error);C=x.txn}function j(){p(E,{doc:h,metadata:v,ctx:C})}C.objectStore(Le).get(y).onsuccess=function(G){if(v=yr(G.target.result),!v)return E=oe(pt,"missing"),j();var H;if(w.rev)H=w.latest?b0(w.rev,v):w.rev;else{H=v.winningRev;var re=Mt(v);if(re)return E=oe(pt,"deleted"),j()}var Q=C.objectStore(Je),Z=v.id+"::"+H;Q.index("_doc_id_rev").get(Z).onsuccess=function(ce){if(h=ce.target.result,h&&(h=Mi(h)),!h)return E=oe(pt,"missing"),j();j()}}},t._getAttachment=function(S,y,w,p,h){var v;if(p.ctx)v=p.ctx;else{var E=$t(i,[Le,Je,mt],"readonly");if(E.error)return h(E.error);v=E.txn}var C=w.digest,x=w.content_type;v.objectStore(mt).get(C).onsuccess=function(j){var G=j.target.result.body;qh(G,x,p.binary,function(H){h(null,H)})}},t._info=function(y){var w,p,h=$t(i,[rt,Je],"readonly");if(h.error)return y(h.error);var v=h.txn;v.objectStore(rt).get(rt).onsuccess=function(E){p=E.target.result.docCount},v.objectStore(Je).openKeyCursor(null,"prev").onsuccess=function(E){var C=E.target.result;w=C?C.key:0},v.oncomplete=function(){y(null,{doc_count:p,update_seq:w,idb_attachment_format:t._meta.blobSupport?"binary":"base64"})}},t._allDocs=function(y,w){jw(y,i,o(w))},t._changes=function(y){return Mw(y,t,n,i)},t._close=function(S){i.close(),Ur.delete(n),S()},t._getRevisionTree=function(S,y){var w=$t(i,[Le],"readonly");if(w.error)return y(w.error);var p=w.txn,h=p.objectStore(Le).get(S);h.onsuccess=function(v){var E=yr(v.target.result);E?y(null,E.rev_tree):y(oe(pt))}},t._doCompaction=function(S,y,w){var p=[Le,Je,mt,vr],h=$t(i,p,"readwrite");if(h.error)return w(h.error);var v=h.txn,E=v.objectStore(Le);E.get(S).onsuccess=function(C){var x=yr(C.target.result);wr(x.rev_tree,function(H,re,Q,Z,ce){var fe=re+"-"+Q;y.indexOf(fe)!==-1&&(ce.status="missing")}),kh(y,S,v);var j=x.winningRev,G=x.deleted;v.objectStore(Le).put(Oa(x,j,G))},v.onabort=Tt(w),v.oncomplete=function(){w()}},t._getLocal=function(S,y){var w=$t(i,[It],"readonly");if(w.error)return y(w.error);var p=w.txn,h=p.objectStore(It).get(S);h.onerror=Tt(y),h.onsuccess=function(v){var E=v.target.result;E?(delete E._doc_id_rev,y(null,E)):y(oe(pt))}},t._putLocal=function(S,y,w){typeof y=="function"&&(w=y,y={}),delete S._revisions;var p=S._rev,h=S._id;p?S._rev="0-"+(parseInt(p.split("-")[1],10)+1):S._rev="0-1";var v=y.ctx,E;if(!v){var C=$t(i,[It],"readwrite");if(C.error)return w(C.error);v=C.txn,v.onerror=Tt(w),v.oncomplete=function(){E&&w(null,E)}}var x=v.objectStore(It),j;p?(j=x.get(h),j.onsuccess=function(G){var H=G.target.result;if(!H||H._rev!==p)w(oe(Kr));else{var re=x.put(S);re.onsuccess=function(){E={ok:!0,id:S._id,rev:S._rev},y.ctx&&w(null,E)}}}):(j=x.add(S),j.onerror=function(G){w(oe(Kr)),G.preventDefault(),G.stopPropagation()},j.onsuccess=function(){E={ok:!0,id:S._id,rev:S._rev},y.ctx&&w(null,E)})},t._removeLocal=function(S,y,w){typeof y=="function"&&(w=y,y={});var p=y.ctx;if(!p){var h=$t(i,[It],"readwrite");if(h.error)return w(h.error);p=h.txn,p.oncomplete=function(){v&&w(null,v)}}var v,E=S._id,C=p.objectStore(It),x=C.get(E);x.onerror=Tt(w),x.onsuccess=function(j){var G=j.target.result;!G||G._rev!==S._rev?w(oe(pt)):(C.delete(E),v={ok:!0,id:E,rev:"0-0"},y.ctx&&w(null,v))}},t._destroy=function(S,y){Rn.removeAllListeners(n);var w=ua.get(n);w&&w.result&&(w.result.close(),Ur.delete(n));var p=indexedDB.deleteDatabase(n);p.onsuccess=function(){ua.delete(n),Ni()&&n in localStorage&&delete localStorage[n],y(null,{ok:!0})},p.onerror=Tt(y)};var b=Ur.get(n);if(b)return i=b.idb,t._meta=b.global,qt(function(){r(null,t)});var P=indexedDB.open(n,Tw);ua.set(n,P),P.onupgradeneeded=function(S){var y=S.target.result;if(S.oldVersion<1)return a(y);var w=S.currentTarget.transaction;S.oldVersion<3&&d(y),S.oldVersion<4&&f(y);var p=[c,m,g,_],h=S.oldVersion;function v(){var E=p[h-1];h++,E&&E(w,v)}v()},P.onsuccess=function(S){i=S.target.result,i.onversionchange=function(){i.close(),Ur.delete(n)},i.onabort=function(j){vt("error","Database has a global failure",j.target.error),s=j.target.error,i.close(),Ur.delete(n)};var y=i.transaction([rt,oa,Le],"readwrite"),w=!1,p,h,v,E;function C(){typeof v>"u"||!w||(t._meta={name:n,instanceId:E,blobSupport:v},Ur.set(n,{idb:i,global:t._meta}),r(null,t))}function x(){if(!(typeof h>"u"||typeof p>"u")){var j=n+"_id";j in p?E=p[j]:p[j]=E=Vi(),p.docCount=h,y.objectStore(rt).put(p)}}y.objectStore(rt).get(rt).onsuccess=function(j){p=j.target.result||{id:rt},x()},Dw(y,function(j){h=j,x()}),aa||(aa=yw(y,oa,"key")),aa.then(function(j){v=j,C()}),y.oncomplete=function(){w=!0,C()},y.onabort=Tt(r)},P.onerror=function(S){var y=S.target.error&&S.target.error.message;y?y.indexOf("stored database is a higher version")!==-1&&(y=new Error('This DB was created with the newer "indexeddb" adapter, but you are trying to open it with the older "idb" adapter')):y="Failed to open indexedDB, are you in private browsing mode?",vt("error",y),r(oe(La,y))}}Nh.valid=function(){try{return typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}};function Gw(t){t.adapter("idb",Nh,!0)}function Fw(t,e){return new Promise(function(r,n){var i=0,s=0,o=0,a=t.length,c;function d(){i++,t[s++]().then(f,g)}function m(){++o===a?c?n(c):r():_()}function f(){i--,m()}function g(b){i--,c=c||b,m()}function _(){for(;i<e&&s<a;)d()}_()})}var Kw=25,zw=50,Ri=5e3,Vw=1e4,ca={};function fa(t){let e=t.doc||t.ok,r=e&&e._attachments;r&&Object.keys(r).forEach(function(n){let i=r[n];i.data=za(i.data,i.content_type)})}function pr(t){return/^_design/.test(t)?"_design/"+encodeURIComponent(t.slice(8)):t.startsWith("_local/")?"_local/"+encodeURIComponent(t.slice(7)):encodeURIComponent(t)}function Vd(t){return!t._attachments||!Object.keys(t._attachments)?Promise.resolve():Promise.all(Object.keys(t._attachments).map(function(e){let r=t._attachments[e];if(r.data&&typeof r.data!="string")return new Promise(function(n){Va(r.data,n)}).then(function(n){r.data=n})}))}function Jw(t){if(!t.prefix)return!1;let e=hh(t.prefix).protocol;return e==="http"||e==="https"}function Hw(t,e){if(Jw(e)){let i=e.name.substr(e.prefix.length);t=e.prefix.replace(/\/?$/,"/")+encodeURIComponent(i)}let r=hh(t);(r.user||r.password)&&(r.auth={username:r.user,password:r.password});let n=r.path.replace(/(^\/|\/$)/g,"").split("/");return r.db=n.pop(),r.db.indexOf("%")===-1&&(r.db=encodeURIComponent(r.db)),r.path=n.join("/"),r}function Ue(t,e){return ki(t,t.db+"/"+e)}function ki(t,e){let r=t.path?"/":"";return t.protocol+"://"+t.host+(t.port?":"+t.port:"")+"/"+t.path+r+e}function qi(t){let e=Object.keys(t);return e.length===0?"":"?"+e.map(r=>r+"="+encodeURIComponent(t[r])).join("&")}function Ww(t){let e=typeof navigator<"u"&&navigator.userAgent?navigator.userAgent.toLowerCase():"",r=e.indexOf("msie")!==-1,n=e.indexOf("trident")!==-1,i=e.indexOf("edge")!==-1,s=!("method"in t)||t.method==="GET";return(r||n||i)&&s}function Ra(t,e){let r=this,n=Hw(t.name,t),i=Ue(n,"");t=Ge(t);let s=async function(f,g){if(g=g||{},g.headers=g.headers||new Gr,g.credentials="include",t.auth||n.auth){let P=t.auth||n.auth,S=P.username+":"+P.password,y=xn(unescape(encodeURIComponent(S)));g.headers.set("Authorization","Basic "+y)}let _=t.headers||{};return Object.keys(_).forEach(function(P){g.headers.append(P,_[P])}),Ww(g)&&(f+=(f.indexOf("?")===-1?"?":"&")+"_nonce="+Date.now()),await(t.fetch||$h)(f,g)};function o(f,g){return De(f,function(..._){d().then(function(){return g.apply(this,_)}).catch(function(b){_.pop()(b)})}).bind(r)}async function a(f,g){let _={};g=g||{},g.headers=g.headers||new Gr,g.headers.get("Content-Type")||g.headers.set("Content-Type","application/json"),g.headers.get("Accept")||g.headers.set("Accept","application/json");let b=await s(f,g);_.ok=b.ok,_.status=b.status;let P=await b.json();if(_.data=P,!_.ok)throw _.data.status=_.status,zr(_.data);return Array.isArray(_.data)&&(_.data=_.data.map(function(S){return S.error||S.missing?zr(S):S})),_}let c;async function d(){return t.skip_setup?Promise.resolve():c||(c=a(i).catch(function(f){return f&&f.status&&f.status===404?(ya(404,"PouchDB is just detecting if the remote exists."),a(i,{method:"PUT"})):Promise.reject(f)}).catch(function(f){return f&&f.status&&f.status===412?!0:Promise.reject(f)}),c.catch(function(){c=null}),c)}qt(function(){e(null,r)}),r._remote=!0,r.type=function(){return"http"},r.id=o("id",async function(f){let g;try{g=await(await s(ki(n,""))).json()}catch{g={}}let _=g&&g.uuid?g.uuid+n.db:Ue(n,"");f(null,_)}),r.compact=o("compact",async function(f,g){typeof f=="function"&&(g=f,f={}),f=Ge(f),await a(Ue(n,"_compact"),{method:"POST"});function _(){r.info(function(b,P){P&&!P.compact_running?g(null,{ok:!0}):setTimeout(_,f.interval||200)})}_()}),r.bulkGet=De("bulkGet",function(f,g){let _=this;async function b(w){let p={};f.revs&&(p.revs=!0),f.attachments&&(p.attachments=!0),f.latest&&(p.latest=!0);try{let h=await a(Ue(n,"_bulk_get"+qi(p)),{method:"POST",body:JSON.stringify({docs:f.docs})});f.attachments&&f.binary&&h.data.results.forEach(function(v){v.docs.forEach(fa)}),w(null,h.data)}catch(h){w(h)}}function P(){let w=zw,p=Math.ceil(f.docs.length/w),h=0,v=new Array(p);function E(C){return function(x,j){v[C]=j.results,++h===p&&g(null,{results:v.flat()})}}for(let C=0;C<p;C++){let x=kn(f,["revs","attachments","binary","latest"]);x.docs=f.docs.slice(C*w,Math.min(f.docs.length,(C+1)*w)),ch(_,x,E(C))}}let S=ki(n,""),y=ca[S];typeof y!="boolean"?b(function(w,p){w?(ca[S]=!1,ya(w.status,"PouchDB is just detecting if the remote supports the _bulk_get API."),P()):(ca[S]=!0,g(null,p))}):y?b(g):P()}),r._info=async function(f){try{await d();let _=await(await s(Ue(n,""))).json();_.host=Ue(n,""),f(null,_)}catch(g){f(g)}},r.fetch=async function(f,g){await d();let _=f.substring(0,1)==="/"?ki(n,f.substring(1)):Ue(n,f);return s(_,g)},r.get=o("get",async function(f,g,_){typeof g=="function"&&(_=g,g={}),g=Ge(g);let b={};g.revs&&(b.revs=!0),g.revs_info&&(b.revs_info=!0),g.latest&&(b.latest=!0),g.open_revs&&(g.open_revs!=="all"&&(g.open_revs=JSON.stringify(g.open_revs)),b.open_revs=g.open_revs),g.rev&&(b.rev=g.rev),g.conflicts&&(b.conflicts=g.conflicts),g.update_seq&&(b.update_seq=g.update_seq),f=pr(f);function P(w){let p=w._attachments,h=p&&Object.keys(p);if(!p||!h.length)return;async function v(C){let x=p[C],j=pr(w._id)+"/"+m(C)+"?rev="+w._rev,G=await s(Ue(n,j)),H;"buffer"in G?H=await G.buffer():H=await G.blob();let re;if(g.binary){let Q=Object.getOwnPropertyDescriptor(H.__proto__,"type");(!Q||Q.set)&&(H.type=x.content_type),re=H}else re=await new Promise(function(Q){Va(H,Q)});delete x.stub,delete x.length,x.data=re}let E=h.map(function(C){return function(){return v(C)}});return Fw(E,5)}function S(w){return Array.isArray(w)?Promise.all(w.map(function(p){if(p.ok)return P(p.ok)})):P(w)}let y=Ue(n,f+qi(b));try{let w=await a(y);g.attachments&&await S(w.data),_(null,w.data)}catch(w){w.docId=f,_(w)}}),r.remove=o("remove",async function(f,g,_,b){let P;typeof g=="string"?(P={_id:f,_rev:g},typeof _=="function"&&(b=_,_={})):(P=f,typeof g=="function"?(b=g,_={}):(b=_,_=g));let S=P._rev||_.rev,y=Ue(n,pr(P._id))+"?rev="+S;try{let w=await a(y,{method:"DELETE"});b(null,w.data)}catch(w){b(w)}});function m(f){return f.split("/").map(encodeURIComponent).join("/")}r.getAttachment=o("getAttachment",async function(f,g,_,b){typeof _=="function"&&(b=_,_={});let P=_.rev?"?rev="+_.rev:"",S=Ue(n,pr(f))+"/"+m(g)+P,y;try{let w=await s(S,{method:"GET"});if(!w.ok)throw w;y=w.headers.get("content-type");let p;if(typeof K<"u"&&!K.browser&&typeof w.buffer=="function"?p=await w.buffer():p=await w.blob(),typeof K<"u"&&!K.browser){let h=Object.getOwnPropertyDescriptor(p.__proto__,"type");(!h||h.set)&&(p.type=y)}b(null,p)}catch(w){b(w)}}),r.removeAttachment=o("removeAttachment",async function(f,g,_,b){let P=Ue(n,pr(f)+"/"+m(g))+"?rev="+_;try{let S=await a(P,{method:"DELETE"});b(null,S.data)}catch(S){b(S)}}),r.putAttachment=o("putAttachment",async function(f,g,_,b,P,S){typeof P=="function"&&(S=P,P=b,b=_,_=null);let y=pr(f)+"/"+m(g),w=Ue(n,y);if(_&&(w+="?rev="+_),typeof b=="string"){let p;try{p=Ga(b)}catch{return S(oe(lh,"Attachment is not a valid base64 string"))}b=p?Ka(p,P):""}try{let p=await a(w,{headers:new Gr({"Content-Type":P}),method:"PUT",body:b});S(null,p.data)}catch(p){S(p)}}),r._bulkDocs=async function(f,g,_){f.new_edits=g.new_edits;try{await d(),await Promise.all(f.docs.map(Vd));let b=await a(Ue(n,"_bulk_docs"),{method:"POST",body:JSON.stringify(f)});_(null,b.data)}catch(b){_(b)}},r._put=async function(f,g,_){try{await d(),await Vd(f);let b=await a(Ue(n,pr(f._id)),{method:"PUT",body:JSON.stringify(f)});_(null,b.data)}catch(b){b.docId=f&&f._id,_(b)}},r.allDocs=o("allDocs",async function(f,g){typeof f=="function"&&(g=f,f={}),f=Ge(f);let _={},b,P="GET";f.conflicts&&(_.conflicts=!0),f.update_seq&&(_.update_seq=!0),f.descending&&(_.descending=!0),f.include_docs&&(_.include_docs=!0),f.attachments&&(_.attachments=!0),f.key&&(_.key=JSON.stringify(f.key)),f.start_key&&(f.startkey=f.start_key),f.startkey&&(_.startkey=JSON.stringify(f.startkey)),f.end_key&&(f.endkey=f.end_key),f.endkey&&(_.endkey=JSON.stringify(f.endkey)),typeof f.inclusive_end<"u"&&(_.inclusive_end=!!f.inclusive_end),typeof f.limit<"u"&&(_.limit=f.limit),typeof f.skip<"u"&&(_.skip=f.skip);let S=qi(_);typeof f.keys<"u"&&(P="POST",b={keys:f.keys});try{let y=await a(Ue(n,"_all_docs"+S),{method:P,body:JSON.stringify(b)});f.include_docs&&f.attachments&&f.binary&&y.data.rows.forEach(fa),g(null,y.data)}catch(y){g(y)}}),r._changes=function(f){let g="batch_size"in f?f.batch_size:Kw;f=Ge(f),f.continuous&&!("heartbeat"in f)&&(f.heartbeat=Vw);let _="timeout"in f?f.timeout:30*1e3;"timeout"in f&&f.timeout&&_-f.timeout<Ri&&(_=f.timeout+Ri),"heartbeat"in f&&f.heartbeat&&_-f.heartbeat<Ri&&(_=f.heartbeat+Ri);let b={};"timeout"in f&&f.timeout&&(b.timeout=f.timeout);let P=typeof f.limit<"u"?f.limit:!1,S=P;if(f.style&&(b.style=f.style),(f.include_docs||f.filter&&typeof f.filter=="function")&&(b.include_docs=!0),f.attachments&&(b.attachments=!0),f.continuous&&(b.feed="longpoll"),f.seq_interval&&(b.seq_interval=f.seq_interval),f.conflicts&&(b.conflicts=!0),f.descending&&(b.descending=!0),f.update_seq&&(b.update_seq=!0),"heartbeat"in f&&f.heartbeat&&(b.heartbeat=f.heartbeat),f.filter&&typeof f.filter=="string"&&(b.filter=f.filter),f.view&&typeof f.view=="string"&&(b.filter="_view",b.view=f.view),f.query_params&&typeof f.query_params=="object")for(let x in f.query_params)Object.prototype.hasOwnProperty.call(f.query_params,x)&&(b[x]=f.query_params[x]);let y="GET",w;f.doc_ids?(b.filter="_doc_ids",y="POST",w={doc_ids:f.doc_ids}):f.selector&&(b.filter="_selector",y="POST",w={selector:f.selector});let p=new AbortController,h,v=async function(x,j){if(f.aborted)return;b.since=x,typeof b.since=="object"&&(b.since=JSON.stringify(b.since)),f.descending?P&&(b.limit=S):b.limit=!P||S>g?g:S;let G=Ue(n,"_changes"+qi(b)),H={signal:p.signal,method:y,body:JSON.stringify(w)};if(h=x,!f.aborted)try{await d();let re=await a(G,H);j(null,re.data)}catch(re){j(re)}},E={results:[]},C=function(x,j){if(f.aborted)return;let G=0;if(j&&j.results){G=j.results.length,E.last_seq=j.last_seq;let re=null,Q=null;typeof j.pending=="number"&&(re=j.pending),(typeof E.last_seq=="string"||typeof E.last_seq=="number")&&(Q=E.last_seq);let Z={};Z.query=f.query_params,j.results=j.results.filter(function(ce){S--;let fe=Ma(f)(ce);return fe&&(f.include_docs&&f.attachments&&f.binary&&fa(ce),f.return_docs&&E.results.push(ce),f.onChange(ce,re,Q)),fe})}else if(x){f.aborted=!0,f.complete(x);return}j&&j.last_seq&&(h=j.last_seq);let H=P&&S<=0||j&&G<g||f.descending;f.continuous&&!(P&&S<=0)||!H?qt(function(){v(h,C)}):f.complete(null,E)};return v(f.since||0,C),{cancel:function(){f.aborted=!0,p.abort()}}},r.revsDiff=o("revsDiff",async function(f,g,_){typeof g=="function"&&(_=g,g={});try{let b=await a(Ue(n,"_revs_diff"),{method:"POST",body:JSON.stringify(f)});_(null,b.data)}catch(b){_(b)}}),r._close=function(f){f()},r._destroy=async function(f,g){try{let _=await a(Ue(n,""),{method:"DELETE"});g(null,_)}catch(_){_.status===404?g(null,{ok:!0}):g(_)}}}Ra.valid=function(){return!0};function Qw(t){t.adapter("http",Ra,!1),t.adapter("https",Ra,!1)}var mr=class t extends Error{constructor(e){super(),this.status=400,this.name="query_parse_error",this.message=e,this.error=!0;try{Error.captureStackTrace(this,t)}catch{}}},Ui=class t extends Error{constructor(e){super(),this.status=404,this.name="not_found",this.message=e,this.error=!0;try{Error.captureStackTrace(this,t)}catch{}}},Gi=class t extends Error{constructor(e){super(),this.status=500,this.name="invalid_value",this.message=e,this.error=!0;try{Error.captureStackTrace(this,t)}catch{}}};function jh(t,e){return e&&t.then(function(r){qt(function(){e(null,r)})},function(r){qt(function(){e(r)})}),t}function Yw(t){return function(...e){var r=e.pop(),n=t.apply(this,e);return typeof r=="function"&&jh(n,r),n}}function Xw(t,e){return t.then(function(r){return e().then(function(){return r})},function(r){return e().then(function(){throw r})})}function la(t,e){return function(){var r=arguments,n=this;return t.add(function(){return e.apply(n,r)})}}function Jd(t){var e=new Set(t),r=new Array(e.size),n=-1;return e.forEach(function(i){r[++n]=i}),r}function da(t){var e=new Array(t.size),r=-1;return t.forEach(function(n,i){e[++r]=i}),e}function Hd(t){var e="builtin "+t+" function requires map values to be numbers or number arrays";return new Gi(e)}function qa(t){for(var e=0,r=0,n=t.length;r<n;r++){var i=t[r];if(typeof i!="number")if(Array.isArray(i)){e=typeof e=="number"?[e]:e;for(var s=0,o=i.length;s<o;s++){var a=i[s];if(typeof a!="number")throw Hd("_sum");typeof e[s]>"u"?e.push(a):e[s]+=a}}else throw Hd("_sum");else typeof e=="number"?e+=i:e[0]+=i}return e}var Zw=vt.bind(null,"log"),e1=Array.isArray,t1=JSON.parse;function Dh(t,e){return Ua("return ("+t.replace(/;\s*$/,"")+");",{emit:e,sum:qa,log:Zw,isArray:e1,toJSON:t1})}var Cn=class{constructor(){this.promise=Promise.resolve()}add(e){return this.promise=this.promise.catch(()=>{}).then(()=>e()),this.promise}finish(){return this.promise}};function Wd(t){if(!t)return"undefined";switch(typeof t){case"function":return t.toString();case"string":return t.toString();default:return JSON.stringify(t)}}function r1(t,e){return Wd(t)+Wd(e)+"undefined"}async function Qd(t,e,r,n,i,s){let o=r1(r,n),a;if(!i&&(a=t._cachedViews=t._cachedViews||{},a[o]))return a[o];let c=t.info().then(async function(d){let m=d.db_name+"-mrview-"+(i?"temp":vh(o));function f(S){S.views=S.views||{};let y=e;y.indexOf("/")===-1&&(y=e+"/"+e);let w=S.views[y]=S.views[y]||{};if(!w[m])return w[m]=!0,S}await ji(t,"_local/"+s,f);let _=(await t.registerDependentDatabase(m)).db;_.auto_compaction=!0;let b={name:m,db:_,sourceDB:t,adapter:t.adapter,mapFun:r,reduceFun:n},P;try{P=await b.db.get("_local/lastSeq")}catch(S){if(S.status!==404)throw S}return b.seq=P?P.seq:0,a&&b.db.once("destroyed",function(){delete a[o]}),b});return a&&(a[o]=c),c}var Yd={},Xd=new Cn,n1=50;function ha(t){return t.indexOf("/")===-1?[t,t]:t.split("/")}function i1(t){return t.length===1&&/^1-/.test(t[0].rev)}function Zd(t,e,r){try{t.emit("error",e)}catch{vt("error",`The user's map/reduce function threw an uncaught error.
|
|
11
|
+
Simply choose a username to log in.`);s&&(r=s)}let n;if(!r)n={error:new Error("No actor ID provided to login")};else{let s=this.getLoggedInActors();s.includes(r)||this.setLoggedInActors([...s,r]),n={session:{actor:r}}}let i=new CustomEvent("login",{detail:n});this.sessionEvents.dispatchEvent(i)};logout=async e=>{let r=this.getLoggedInActors(),n=r.includes(e.actor);n&&this.setLoggedInActors(r.filter(o=>o!==e.actor));let i=n?{actor:e.actor}:{actor:e.actor,error:new Error("Not logged in with that actor")},s=new CustomEvent("logout",{detail:i});this.sessionEvents.dispatchEvent(s)}};I();R();T();I();R();T();var ri=ls(Hc());I();R();T();I();R();T();var Wn,fp=new Uint8Array(16);function ms(){if(!Wn&&(Wn=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!Wn))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Wn(fp)}I();R();T();I();R();T();I();R();T();var Wc=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function lp(t){return typeof t=="string"&&Wc.test(t)}var Qc=lp;var Ke=[];for(Qn=0;Qn<256;++Qn)Ke.push((Qn+256).toString(16).substr(1));var Qn;function dp(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=(Ke[t[e+0]]+Ke[t[e+1]]+Ke[t[e+2]]+Ke[t[e+3]]+"-"+Ke[t[e+4]]+Ke[t[e+5]]+"-"+Ke[t[e+6]]+Ke[t[e+7]]+"-"+Ke[t[e+8]]+Ke[t[e+9]]+"-"+Ke[t[e+10]]+Ke[t[e+11]]+Ke[t[e+12]]+Ke[t[e+13]]+Ke[t[e+14]]+Ke[t[e+15]]).toLowerCase();if(!Qc(r))throw TypeError("Stringified UUID is invalid");return r}var Yc=dp;I();R();T();function hp(t,e,r){t=t||{};var n=t.random||(t.rng||ms)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){r=r||0;for(var i=0;i<16;++i)e[r+i]=n[i];return e}return Yc(n)}var rn=hp;var Xs=ls(Xc());I();R();T();var Yn={},Zc=!1;function pp(){if(Zc)return Yn;Zc=!0;var t=typeof Reflect=="object"?Reflect:null,e=t&&typeof t.apply=="function"?t.apply:function(v,b,N){return Function.prototype.apply.call(v,b,N)},r;t&&typeof t.ownKeys=="function"?r=t.ownKeys:Object.getOwnPropertySymbols?r=function(v){return Object.getOwnPropertyNames(v).concat(Object.getOwnPropertySymbols(v))}:r=function(v){return Object.getOwnPropertyNames(v)};function n(h){console&&console.warn&&console.warn(h)}var i=Number.isNaN||function(v){return v!==v};function s(){s.init.call(this)}Yn=s,Yn.once=y,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var o=10;function a(h){if(typeof h!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof h)}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return o},set:function(h){if(typeof h!="number"||h<0||i(h))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+h+".");o=h}}),s.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(v){if(typeof v!="number"||v<0||i(v))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+v+".");return this._maxListeners=v,this};function c(h){return h._maxListeners===void 0?s.defaultMaxListeners:h._maxListeners}s.prototype.getMaxListeners=function(){return c(this)},s.prototype.emit=function(v){for(var b=[],N=1;N<arguments.length;N++)b.push(arguments[N]);var C=v==="error",j=this._events;if(j!==void 0)C=C&&j.error===void 0;else if(!C)return!1;if(C){var G;if(b.length>0&&(G=b[0]),G instanceof Error)throw G;var H=new Error("Unhandled error."+(G?" ("+G.message+")":""));throw H.context=G,H}var re=j[v];if(re===void 0)return!1;if(typeof re=="function")e(re,this,b);else for(var Y=re.length,Z=E(re,Y),N=0;N<Y;++N)e(Z[N],this,b);return!0};function d(h,v,b,N){var C,j,G;if(a(b),j=h._events,j===void 0?(j=h._events=Object.create(null),h._eventsCount=0):(j.newListener!==void 0&&(h.emit("newListener",v,b.listener?b.listener:b),j=h._events),G=j[v]),G===void 0)G=j[v]=b,++h._eventsCount;else if(typeof G=="function"?G=j[v]=N?[b,G]:[G,b]:N?G.unshift(b):G.push(b),C=c(h),C>0&&G.length>C&&!G.warned){G.warned=!0;var H=new Error("Possible EventEmitter memory leak detected. "+G.length+" "+String(v)+" listeners added. Use emitter.setMaxListeners() to increase limit");H.name="MaxListenersExceededWarning",H.emitter=h,H.type=v,H.count=G.length,n(H)}return h}s.prototype.addListener=function(v,b){return d(this,v,b,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(v,b){return d(this,v,b,!0)};function m(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function f(h,v,b){var N={fired:!1,wrapFn:void 0,target:h,type:v,listener:b},C=m.bind(N);return C.listener=b,N.wrapFn=C,C}s.prototype.once=function(v,b){return a(b),this.on(v,f(this,v,b)),this},s.prototype.prependOnceListener=function(v,b){return a(b),this.prependListener(v,f(this,v,b)),this},s.prototype.removeListener=function(v,b){var N,C,j,G,H;if(a(b),C=this._events,C===void 0)return this;if(N=C[v],N===void 0)return this;if(N===b||N.listener===b)--this._eventsCount===0?this._events=Object.create(null):(delete C[v],C.removeListener&&this.emit("removeListener",v,N.listener||b));else if(typeof N!="function"){for(j=-1,G=N.length-1;G>=0;G--)if(N[G]===b||N[G].listener===b){H=N[G].listener,j=G;break}if(j<0)return this;j===0?N.shift():P(N,j),N.length===1&&(C[v]=N[0]),C.removeListener!==void 0&&this.emit("removeListener",v,H||b)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(v){var b,N,C;if(N=this._events,N===void 0)return this;if(N.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):N[v]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete N[v]),this;if(arguments.length===0){var j=Object.keys(N),G;for(C=0;C<j.length;++C)G=j[C],G!=="removeListener"&&this.removeAllListeners(G);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(b=N[v],typeof b=="function")this.removeListener(v,b);else if(b!==void 0)for(C=b.length-1;C>=0;C--)this.removeListener(v,b[C]);return this};function g(h,v,b){var N=h._events;if(N===void 0)return[];var C=N[v];return C===void 0?[]:typeof C=="function"?b?[C.listener||C]:[C]:b?S(C):E(C,C.length)}s.prototype.listeners=function(v){return g(this,v,!0)},s.prototype.rawListeners=function(v){return g(this,v,!1)},s.listenerCount=function(h,v){return typeof h.listenerCount=="function"?h.listenerCount(v):_.call(h,v)},s.prototype.listenerCount=_;function _(h){var v=this._events;if(v!==void 0){var b=v[h];if(typeof b=="function")return 1;if(b!==void 0)return b.length}return 0}s.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]};function E(h,v){for(var b=new Array(v),N=0;N<v;++N)b[N]=h[N];return b}function P(h,v){for(;v+1<h.length;v++)h[v]=h[v+1];h.pop()}function S(h){for(var v=new Array(h.length),b=0;b<v.length;++b)v[b]=h[b].listener||h[b];return v}function y(h,v){return new Promise(function(b,N){function C(G){h.removeListener(v,j),N(G)}function j(){typeof h.removeListener=="function"&&h.removeListener("error",C),b([].slice.call(arguments))}p(h,v,j,{once:!0}),v!=="error"&&w(h,C,{once:!0})})}function w(h,v,b){typeof h.on=="function"&&p(h,"error",v,b)}function p(h,v,b,N){if(typeof h.on=="function")N.once?h.once(v,b):h.on(v,b);else if(typeof h.addEventListener=="function")h.addEventListener(v,function C(j){N.once&&h.removeEventListener(v,C),b(j)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof h)}return Yn}var it=pp();it.once;it.once=function(t,e){return new Promise((r,n)=>{function i(...o){s!==void 0&&t.removeListener("error",s),r(o)}let s;e!=="error"&&(s=o=>{t.removeListener(name,i),n(o)},t.once("error",s)),t.once(e,i)})};it.on=function(t,e){let r=[],n=[],i=null,s=!1,o={async next(){let d=r.shift();if(d)return createIterResult(d,!1);if(i){let m=Promise.reject(i);return i=null,m}return s?createIterResult(void 0,!0):new Promise((m,f)=>n.push({resolve:m,reject:f}))},async return(){t.removeListener(e,a),t.removeListener("error",c),s=!0;for(let d of n)d.resolve(createIterResult(void 0,!0));return createIterResult(void 0,!0)},throw(d){i=d,t.removeListener(e,a),t.removeListener("error",c)},[Symbol.asyncIterator](){return this}};return t.on(e,a),t.on("error",c),o;function a(...d){let m=n.shift();m?m.resolve(createIterResult(d,!1)):r.push(d)}function c(d){s=!0;let m=n.shift();m?m.reject(d):i=d,o.return()}};var{EventEmitter:oE,defaultMaxListeners:aE,init:uE,listenerCount:cE,on:fE,once:lE}=it;function mp(t){return typeof ArrayBuffer<"u"&&t instanceof ArrayBuffer||typeof Blob<"u"&&t instanceof Blob}function vp(t){return t instanceof ArrayBuffer?t.slice(0):t.slice(0,t.size,t.type)}var If=Function.prototype.toString,yp=If.call(Object);function gp(t){var e=Object.getPrototypeOf(t);if(e===null)return!0;var r=e.constructor;return typeof r=="function"&&r instanceof r&&If.call(r)==yp}function Ge(t){var e,r,n;if(!t||typeof t!="object")return t;if(Array.isArray(t)){for(e=[],r=0,n=t.length;r<n;r++)e[r]=Ge(t[r]);return e}if(t instanceof Date&&isFinite(t))return t.toISOString();if(mp(t))return vp(t);if(!gp(t))return t;e={};for(r in t)if(Object.prototype.hasOwnProperty.call(t,r)){var i=Ge(t[r]);typeof i<"u"&&(e[r]=i)}return e}function Tf(t){var e=!1;return function(...r){if(e)throw new Error("once called more than once");e=!0,t.apply(this,r)}}function Rf(t){return function(...e){e=Ge(e);var r=this,n=typeof e[e.length-1]=="function"?e.pop():!1,i=new Promise(function(s,o){var a;try{var c=Tf(function(d,m){d?o(d):s(m)});e.push(c),a=t.apply(r,e),a&&typeof a.then=="function"&&s(a)}catch(d){o(d)}});return n&&i.then(function(s){n(null,s)},n),i}}function _p(t,e,r){if(t.constructor.listeners("debug").length){for(var n=["api",t.name,e],i=0;i<r.length-1;i++)n.push(r[i]);t.constructor.emit("debug",n);var s=r[r.length-1];r[r.length-1]=function(o,a){var c=["api",t.name,e];c=c.concat(o?["error",o]:["success",a]),t.constructor.emit("debug",c),s(o,a)}}}function De(t,e){return Rf(function(...r){if(this._closed)return Promise.reject(new Error("database is closed"));if(this._destroyed)return Promise.reject(new Error("database is destroyed"));var n=this;return _p(n,t,r),this.taskqueue.isReady?e.apply(this,r):new Promise(function(i,s){n.taskqueue.addTask(function(o){o?s(o):i(n[t].apply(n,r))})})})}function un(t,e){for(var r={},n=0,i=e.length;n<i;n++){var s=e[n];s in t&&(r[s]=t[s])}return r}var wp=6;function ef(t){return t}function bp(t){return[{ok:t}]}function qf(t,e,r){var n=e.docs,i=new Map;n.forEach(function(P){i.has(P.id)?i.get(P.id).push(P):i.set(P.id,[P])});var s=i.size,o=0,a=new Array(s);function c(){var P=[];a.forEach(function(S){S.docs.forEach(function(y){P.push({id:S.id,docs:[y]})})}),r(null,{results:P})}function d(){++o===s&&c()}function m(P,S,y){a[P]={id:S,docs:y},d()}var f=[];i.forEach(function(P,S){f.push(S)});var g=0;function _(){if(!(g>=f.length)){var P=Math.min(g+wp,f.length),S=f.slice(g,P);E(S,g),g+=S.length}}function E(P,S){P.forEach(function(y,w){var p=S+w,h=i.get(y),v=un(h[0],["atts_since","attachments"]);v.open_revs=h.map(function(N){return N.rev}),v.open_revs=v.open_revs.filter(ef);var b=ef;v.open_revs.length===0&&(delete v.open_revs,b=bp),["revs","attachments","binary","ajax","latest"].forEach(function(N){N in e&&(v[N]=e[N])}),t.get(y,v,function(N,C){var j;N?j=[{error:N}]:j=b(C),m(p,y,j),_()})})}_()}var Rs;try{localStorage.setItem("_pouch_check_localstorage",1),Rs=!!localStorage.getItem("_pouch_check_localstorage")}catch{Rs=!1}function ni(){return Rs}var At=typeof queueMicrotask=="function"?queueMicrotask:function(e){Promise.resolve().then(e)},qs=class extends it{constructor(){super(),this._listeners={},ni()&&addEventListener("storage",e=>{this.emit(e.key)})}addListener(e,r,n,i){if(this._listeners[r])return;var s=!1,o=this;function a(){if(!o._listeners[r])return;if(s){s="waiting";return}s=!0;var c=un(i,["style","include_docs","attachments","conflicts","filter","doc_ids","view","since","query_params","binary","return_docs"]);function d(){s=!1}n.changes(c).on("change",function(m){m.seq>i.since&&!i.cancelled&&(i.since=m.seq,i.onChange(m))}).on("complete",function(){s==="waiting"&&At(a),s=!1}).on("error",d)}this._listeners[r]=a,this.on(e,a)}removeListener(e,r){r in this._listeners&&(super.removeListener(e,this._listeners[r]),delete this._listeners[r])}notifyLocalWindows(e){ni()&&(localStorage[e]=localStorage[e]==="a"?"b":"a")}notify(e){this.emit(e),this.notifyLocalWindows(e)}};function dt(t){if(typeof console<"u"&&typeof console[t]=="function"){var e=Array.prototype.slice.call(arguments,1);console[t].apply(console,e)}}function Ep(t,e){var r=6e5;t=parseInt(t,10)||0,e=parseInt(e,10),e!==e||e<=t?e=(t||1)<<1:e=e+1,e>r&&(t=r>>1,e=r);var n=Math.random(),i=e-t;return~~(i*n+t)}function $p(t){var e=0;return t||(e=2e3),Ep(t,e)}function Ns(t,e){dt("info","The above "+t+" is totally normal. "+e)}var Ie=class extends Error{constructor(e,r,n){super(),this.status=e,this.name=r,this.message=n,this.error=!0}toString(){return JSON.stringify({status:this.status,name:this.name,message:this.message,reason:this.reason})}},gE=new Ie(401,"unauthorized","Name or password is incorrect."),Sp=new Ie(400,"bad_request","Missing JSON list of 'docs'"),ft=new Ie(404,"not_found","missing"),Nr=new Ie(409,"conflict","Document update conflict"),Nf=new Ie(400,"bad_request","_id field must contain a string"),Pp=new Ie(412,"missing_id","_id is required for puts"),Op=new Ie(400,"bad_request","Only reserved document ids may start with underscore."),_E=new Ie(412,"precondition_failed","Database not open"),Zs=new Ie(500,"unknown_error","Database encountered an unknown error"),kf=new Ie(500,"badarg","Some query argument is invalid"),wE=new Ie(400,"invalid_request","Request was invalid"),Ap=new Ie(400,"query_parse_error","Some query parameter is invalid"),tf=new Ie(500,"doc_validation","Bad special document member"),hi=new Ie(400,"bad_request","Something wrong with the request"),ys=new Ie(400,"bad_request","Document must be a JSON object"),bE=new Ie(404,"not_found","Database not found"),eo=new Ie(500,"indexed_db_went_bad","unknown"),EE=new Ie(500,"web_sql_went_bad","unknown"),$E=new Ie(500,"levelDB_went_went_bad","unknown"),SE=new Ie(403,"forbidden","Forbidden by design doc validate_doc_update function"),ei=new Ie(400,"bad_request","Invalid rev format"),PE=new Ie(412,"file_exists","The database could not be created, the file already exists."),Ip=new Ie(412,"missing_stub","A pre-existing attachment stub wasn't found"),OE=new Ie(413,"invalid_url","Provided URL is invalid");function oe(t,e){function r(n){for(var i=Object.getOwnPropertyNames(t),s=0,o=i.length;s<o;s++)typeof t[i[s]]!="function"&&(this[i[s]]=t[i[s]]);this.stack===void 0&&(this.stack=new Error().stack),n!==void 0&&(this.reason=n)}return r.prototype=Ie.prototype,new r(e)}function kr(t){if(typeof t!="object"){var e=t;t=Zs,t.data=e}return"error"in t&&t.error==="conflict"&&(t.name="conflict",t.status=409),"name"in t||(t.name=t.error||"unknown"),"status"in t||(t.status=500),"message"in t||(t.message=t.message||t.reason),"stack"in t||(t.stack=new Error().stack),t}function Tp(t,e,r){try{return!t(e,r)}catch(i){var n="Filter function threw: "+i.toString();return oe(hi,n)}}function to(t){var e={},r=t.filter&&typeof t.filter=="function";return e.query=t.query_params,function(i){i.doc||(i.doc={});var s=r&&Tp(t.filter,i.doc,e);if(typeof s=="object")return s;if(s)return!1;if(!t.include_docs)delete i.doc;else if(!t.attachments)for(var o in i.doc._attachments)Object.prototype.hasOwnProperty.call(i.doc._attachments,o)&&(i.doc._attachments[o].stub=!0);return!0}}function Cf(t){var e;if(t?typeof t!="string"?e=oe(Nf):/^_/.test(t)&&!/^_(design|local)/.test(t)&&(e=oe(Op)):e=oe(Pp),e)throw e}function Ot(t){return typeof t._remote=="boolean"?t._remote:typeof t.type=="function"?(dt("warn","db.type() is deprecated and will be removed in a future version of PouchDB"),t.type()==="http"):!1}function Rp(t,e){return"listenerCount"in t?t.listenerCount(e):it.listenerCount(t,e)}function ks(t){if(!t)return null;var e=t.split("/");return e.length===2?e:e.length===1?[t,t]:null}function rf(t){var e=ks(t);return e?e.join("/"):null}var nf=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],sf="queryKey",qp=/(?:^|&)([^&=]*)=?([^&]*)/g,Np=/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/;function xf(t){for(var e=Np.exec(t),r={},n=14;n--;){var i=nf[n],s=e[n]||"",o=["user","password"].indexOf(i)!==-1;r[i]=o?decodeURIComponent(s):s}return r[sf]={},r[nf[12]].replace(qp,function(a,c,d){c&&(r[sf][c]=d)}),r}function ro(t,e){var r=[],n=[];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r.push(i),n.push(e[i]));return r.push(t),Function.apply(null,r).apply(null,n)}function ii(t,e,r){return t.get(e).catch(function(n){if(n.status!==404)throw n;return{}}).then(function(n){var i=n._rev,s=r(n);return s?(s._id=e,s._rev=i,kp(t,s,r)):{updated:!1,rev:i}})}function kp(t,e,r){return t.put(e).then(function(n){return{updated:!0,rev:n.rev}},function(n){if(n.status!==409)throw n;return ii(t,e._id,r)})}var no=function(t){return atob(t)},cn=function(t){return btoa(t)};function io(t,e){t=t||[],e=e||{};try{return new Blob(t,e)}catch(s){if(s.name!=="TypeError")throw s;for(var r=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,n=new r,i=0;i<t.length;i+=1)n.append(t[i]);return n.getBlob(e.type)}}function Cp(t){for(var e=t.length,r=new ArrayBuffer(e),n=new Uint8Array(r),i=0;i<e;i++)n[i]=t.charCodeAt(i);return r}function so(t,e){return io([Cp(t)],{type:e})}function oo(t,e){return so(no(t),e)}function xp(t){for(var e="",r=new Uint8Array(t),n=r.byteLength,i=0;i<n;i++)e+=String.fromCharCode(r[i]);return e}function jf(t,e){var r=new FileReader,n=typeof r.readAsBinaryString=="function";r.onloadend=function(i){var s=i.target.result||"";if(n)return e(s);e(xp(s))},n?r.readAsBinaryString(t):r.readAsArrayBuffer(t)}function Df(t,e){jf(t,function(r){e(r)})}function ao(t,e){Df(t,function(r){e(cn(r))})}function jp(t,e){var r=new FileReader;r.onloadend=function(n){var i=n.target.result||new ArrayBuffer(0);e(i)},r.readAsArrayBuffer(t)}var Dp=self.setImmediate||self.setTimeout,Bp=32768;function Lp(t){return cn(t)}function Mp(t,e,r,n,i){(r>0||n<e.size)&&(e=e.slice(r,n)),jp(e,function(s){t.append(s),i()})}function Up(t,e,r,n,i){(r>0||n<e.length)&&(e=e.substring(r,n)),t.appendBinary(e),i()}function uo(t,e){var r=typeof t=="string",n=r?t.length:t.size,i=Math.min(Bp,n),s=Math.ceil(n/i),o=0,a=r?new ri.default:new ri.default.ArrayBuffer,c=r?Up:Mp;function d(){Dp(f)}function m(){var g=a.end(!0),_=Lp(g);e(_),a.destroy()}function f(){var g=o*i,_=g+i;o++,o<s?c(a,t,g,_,d):c(a,t,g,_,m)}f()}function Bf(t){return ri.default.hash(t)}function Lf(t,e){if(!e)return rn().replace(/-/g,"").toLowerCase();var r=Object.assign({},t);return delete r._rev_tree,Bf(JSON.stringify(r))}var pi=rn;function cr(t){for(var e,r,n,i=t.rev_tree.slice(),s;s=i.pop();){var o=s.ids,a=o[2],c=s.pos;if(a.length){for(var d=0,m=a.length;d<m;d++)i.push({pos:c+1,ids:a[d]});continue}var f=!!o[1].deleted,g=o[0];(!e||(n!==f?n:r!==c?r<c:e<g))&&(e=g,r=c,n=f)}return r+"-"+e}function fr(t,e){for(var r=t.slice(),n;n=r.pop();)for(var i=n.pos,s=n.ids,o=s[2],a=e(o.length===0,i,s[0],n.ctx,s[1]),c=0,d=o.length;c<d;c++)r.push({pos:i+1,ids:o[c],ctx:a})}function Gp(t,e){return t.pos-e.pos}function co(t){var e=[];fr(t,function(i,s,o,a,c){i&&e.push({rev:s+"-"+o,pos:s,opts:c})}),e.sort(Gp).reverse();for(var r=0,n=e.length;r<n;r++)delete e[r].pos;return e}function fo(t){for(var e=cr(t),r=co(t.rev_tree),n=[],i=0,s=r.length;i<s;i++){var o=r[i];o.rev!==e&&!o.opts.deleted&&n.push(o.rev)}return n}function Fp(t){var e=[];return fr(t.rev_tree,function(r,n,i,s,o){o.status==="available"&&!r&&(e.push(n+"-"+i),o.status="missing")}),e}function Kp(t,e){let r=[],n=t.slice(),i;for(;i=n.pop();){let{pos:s,ids:o}=i,a=`${s}-${o[0]}`,c=o[2];if(r.push(a),a===e){if(c.length!==0)throw new Error("The requested revision is not a leaf");return r.reverse()}(c.length===0||c.length>1)&&(r=[]);for(let d=0,m=c.length;d<m;d++)n.push({pos:s+1,ids:c[d]})}if(r.length===0)throw new Error("The requested revision does not exist");return r.reverse()}function Mf(t){for(var e=[],r=t.slice(),n;n=r.pop();){var i=n.pos,s=n.ids,o=s[0],a=s[1],c=s[2],d=c.length===0,m=n.history?n.history.slice():[];m.push({id:o,opts:a}),d&&e.push({pos:i+1-m.length,ids:m});for(var f=0,g=c.length;f<g;f++)r.push({pos:i+1,ids:c[f],history:m})}return e.reverse()}function zp(t,e){return t.pos-e.pos}function Vp(t,e,r){for(var n=0,i=t.length,s;n<i;)s=n+i>>>1,r(t[s],e)<0?n=s+1:i=s;return n}function Jp(t,e,r){var n=Vp(t,e,r);t.splice(n,0,e)}function of(t,e){for(var r,n,i=e,s=t.length;i<s;i++){var o=t[i],a=[o.id,o.opts,[]];n?(n[2].push(a),n=a):r=n=a}return r}function Hp(t,e){return t[0]<e[0]?-1:1}function af(t,e){for(var r=[{tree1:t,tree2:e}],n=!1;r.length>0;){var i=r.pop(),s=i.tree1,o=i.tree2;(s[1].status||o[1].status)&&(s[1].status=s[1].status==="available"||o[1].status==="available"?"available":"missing");for(var a=0;a<o[2].length;a++){if(!s[2][0]){n="new_leaf",s[2][0]=o[2][a];continue}for(var c=!1,d=0;d<s[2].length;d++)s[2][d][0]===o[2][a][0]&&(r.push({tree1:s[2][d],tree2:o[2][a]}),c=!0);c||(n="new_branch",Jp(s[2],o[2][a],Hp))}}return{conflicts:n,tree:t}}function Uf(t,e,r){var n=[],i=!1,s=!1,o;if(!t.length)return{tree:[e],conflicts:"new_leaf"};for(var a=0,c=t.length;a<c;a++){var d=t[a];if(d.pos===e.pos&&d.ids[0]===e.ids[0])o=af(d.ids,e.ids),n.push({pos:d.pos,ids:o.tree}),i=i||o.conflicts,s=!0;else if(r!==!0){var m=d.pos<e.pos?d:e,f=d.pos<e.pos?e:d,g=f.pos-m.pos,_=[],E=[];for(E.push({ids:m.ids,diff:g,parent:null,parentIdx:null});E.length>0;){var P=E.pop();if(P.diff===0){P.ids[0]===f.ids[0]&&_.push(P);continue}for(var S=P.ids[2],y=0,w=S.length;y<w;y++)E.push({ids:S[y],diff:P.diff-1,parent:P.ids,parentIdx:y})}var p=_[0];p?(o=af(p.ids,f.ids),p.parent[2][p.parentIdx]=o.tree,n.push({pos:m.pos,ids:m.ids}),i=i||o.conflicts,s=!0):n.push(d)}else n.push(d)}return s||n.push(e),n.sort(zp),{tree:n,conflicts:i||"internal_node"}}function Wp(t,e){for(var r=Mf(t),n,i,s=0,o=r.length;s<o;s++){var a=r[s],c=a.ids,d;if(c.length>e){n||(n={});var m=c.length-e;d={pos:a.pos+m,ids:of(c,m)};for(var f=0;f<m;f++){var g=a.pos+f+"-"+c[f].id;n[g]=!0}}else d={pos:a.pos,ids:of(c,0)};i?i=Uf(i,d,!0).tree:i=[d]}return n&&fr(i,function(_,E,P){delete n[E+"-"+P]}),{tree:i,revs:n?Object.keys(n):[]}}function Gf(t,e,r){var n=Uf(t,e),i=Wp(n.tree,r);return{tree:i.tree,stemmedRevs:i.revs,conflicts:n.conflicts}}function Qp(t,e){for(var r=t.slice(),n=e.split("-"),i=parseInt(n[0],10),s=n[1],o;o=r.pop();){if(o.pos===i&&o.ids[0]===s)return!0;for(var a=o.ids[2],c=0,d=a.length;c<d;c++)r.push({pos:o.pos+1,ids:a[c]})}return!1}function Yp(t){return t.ids}function xt(t,e){e||(e=cr(t));for(var r=e.substring(e.indexOf("-")+1),n=t.rev_tree.map(Yp),i;i=n.pop();){if(i[0]===r)return!!i[1].deleted;n=n.concat(i[2])}}function ur(t){return typeof t=="string"&&t.startsWith("_local/")}function Xp(t,e){for(var r=e.rev_tree.slice(),n;n=r.pop();){var i=n.pos,s=n.ids,o=s[0],a=s[1],c=s[2],d=c.length===0,m=n.history?n.history.slice():[];if(m.push({id:o,pos:i,opts:a}),d)for(var f=0,g=m.length;f<g;f++){var _=m[f],E=_.pos+"-"+_.id;if(E===t)return i+"-"+o}for(var P=0,S=c.length;P<S;P++)r.push({pos:i+1,ids:c[P],history:m})}throw new Error("Unable to resolve latest revision for id "+e.id+", rev "+t)}function Zp(t,e,r,n){try{t.emit("change",e,r,n)}catch(i){dt("error",'Error in .on("change", function):',i)}}function em(t,e,r){var n=[{rev:t._rev}];r.style==="all_docs"&&(n=co(e.rev_tree).map(function(s){return{rev:s.rev}}));var i={id:e.id,changes:n,doc:t};return xt(e,t._rev)&&(i.deleted=!0),r.conflicts&&(i.doc._conflicts=fo(e),i.doc._conflicts.length||delete i.doc._conflicts),i}var Cs=class extends it{constructor(e,r,n){super(),this.db=e,r=r?Ge(r):{};var i=r.complete=Tf((a,c)=>{a?Rp(this,"error")>0&&this.emit("error",a):this.emit("complete",c),this.removeAllListeners(),e.removeListener("destroyed",s)});n&&(this.on("complete",function(a){n(null,a)}),this.on("error",n));let s=()=>{this.cancel()};e.once("destroyed",s),r.onChange=(a,c,d)=>{this.isCancelled||Zp(this,a,c,d)};var o=new Promise(function(a,c){r.complete=function(d,m){d?c(d):a(m)}});this.once("cancel",function(){e.removeListener("destroyed",s),r.complete(null,{status:"cancelled"})}),this.then=o.then.bind(o),this.catch=o.catch.bind(o),this.then(function(a){i(null,a)},i),e.taskqueue.isReady?this.validateChanges(r):e.taskqueue.addTask(a=>{a?r.complete(a):this.isCancelled?this.emit("cancel"):this.validateChanges(r)})}cancel(){this.isCancelled=!0,this.db.taskqueue.isReady&&this.emit("cancel")}validateChanges(e){var r=e.complete;ae._changesFilterPlugin?ae._changesFilterPlugin.validate(e,n=>{if(n)return r(n);this.doChanges(e)}):this.doChanges(e)}doChanges(e){var r=e.complete;if(e=Ge(e),"live"in e&&!("continuous"in e)&&(e.continuous=e.live),e.processChange=em,e.since==="latest"&&(e.since="now"),e.since||(e.since=0),e.since==="now"){this.db.info().then(i=>{if(this.isCancelled){r(null,{status:"cancelled"});return}e.since=i.update_seq,this.doChanges(e)},r);return}if(ae._changesFilterPlugin){if(ae._changesFilterPlugin.normalize(e),ae._changesFilterPlugin.shouldFilter(this,e))return ae._changesFilterPlugin.filter(this,e)}else["doc_ids","filter","selector","view"].forEach(function(i){i in e&&dt("warn",'The "'+i+'" option was passed in to changes/replicate, but pouchdb-changes-filter plugin is not installed, so it was ignored. Please install the plugin to enable filtering.')});"descending"in e||(e.descending=!1),e.limit=e.limit===0?1:e.limit,e.complete=r;var n=this.db._changes(e);if(n&&typeof n.cancel=="function"){let i=this.cancel;this.cancel=(...s)=>{n.cancel(),i.apply(this,s)}}}};function gs(t,e){return function(r,n){r||n[0]&&n[0].error?(r=r||n[0],r.docId=e,t(r)):t(null,n.length?n[0]:n)}}function tm(t){for(var e=0;e<t.length;e++){var r=t[e];if(r._deleted)delete r._attachments;else if(r._attachments)for(var n=Object.keys(r._attachments),i=0;i<n.length;i++){var s=n[i];r._attachments[s]=un(r._attachments[s],["data","digest","content_type","length","revpos","stub"])}}}function rm(t,e){if(t._id===e._id){let r=t._revisions?t._revisions.start:0,n=e._revisions?e._revisions.start:0;return r-n}return t._id<e._id?-1:1}function nm(t){var e={},r=[];return fr(t,function(n,i,s,o){var a=i+"-"+s;return n&&(e[a]=0),o!==void 0&&r.push({from:o,to:a}),a}),r.reverse(),r.forEach(function(n){e[n.from]===void 0?e[n.from]=1+e[n.to]:e[n.from]=Math.min(e[n.from],1+e[n.to])}),e}function im(t){var e="limit"in t?t.keys.slice(t.skip,t.limit+t.skip):t.skip>0?t.keys.slice(t.skip):t.keys;t.keys=e,t.skip=0,delete t.limit,t.descending&&(e.reverse(),t.descending=!1)}function Ff(t){var e=t._compactionQueue[0],r=e.opts,n=e.callback;t.get("_local/compaction").catch(function(){return!1}).then(function(i){i&&i.last_seq&&(r.last_seq=i.last_seq),t._compact(r,function(s,o){s?n(s):n(null,o),At(function(){t._compactionQueue.shift(),t._compactionQueue.length&&Ff(t)})})})}function sm(t,e,r){return t.get("_local/purges").then(function(n){let i=n.purgeSeq+1;return n.purges.push({docId:e,rev:r,purgeSeq:i}),n.purges.length>self.purged_infos_limit&&n.purges.splice(0,n.purges.length-self.purged_infos_limit),n.purgeSeq=i,n}).catch(function(n){if(n.status!==404)throw n;return{_id:"_local/purges",purges:[{docId:e,rev:r,purgeSeq:0}],purgeSeq:0}}).then(function(n){return t.put(n)})}function om(t){return t.charAt(0)==="_"?t+" is not a valid attachment name, attachment names cannot start with '_'":!1}function _s(t){return t===null||typeof t!="object"||Array.isArray(t)}var am=/^\d+-[^-]*$/;function ws(t){return typeof t=="string"&&am.test(t)}var si=class extends it{_setup(){this.post=De("post",function(e,r,n){if(typeof r=="function"&&(n=r,r={}),_s(e))return n(oe(ys));this.bulkDocs({docs:[e]},r,gs(n,e._id))}).bind(this),this.put=De("put",function(e,r,n){if(typeof r=="function"&&(n=r,r={}),_s(e))return n(oe(ys));if(Cf(e._id),"_rev"in e&&!ws(e._rev))return n(oe(ei));if(ur(e._id)&&typeof this._putLocal=="function")return e._deleted?this._removeLocal(e,n):this._putLocal(e,n);let i=o=>{typeof this._put=="function"&&r.new_edits!==!1?this._put(e,r,o):this.bulkDocs({docs:[e]},r,gs(o,e._id))};r.force&&e._rev?(s(),i(function(o){var a=o?null:{ok:!0,id:e._id,rev:e._rev};n(o,a)})):i(n);function s(){var o=e._rev.split("-"),a=o[1],c=parseInt(o[0],10),d=c+1,m=Lf();e._revisions={start:d,ids:[m,a]},e._rev=d+"-"+m,r.new_edits=!1}}).bind(this),this.putAttachment=De("putAttachment",function(e,r,n,i,s){var o=this;typeof s=="function"&&(s=i,i=n,n=null),typeof s>"u"&&(s=i,i=n,n=null),s||dt("warn","Attachment",r,"on document",e,"is missing content_type");function a(c){var d="_rev"in c?parseInt(c._rev,10):0;return c._attachments=c._attachments||{},c._attachments[r]={content_type:s,data:i,revpos:++d},o.put(c)}return o.get(e).then(function(c){if(c._rev!==n)throw oe(Nr);return a(c)},function(c){if(c.reason===ft.message)return a({_id:e});throw c})}).bind(this),this.removeAttachment=De("removeAttachment",function(e,r,n,i){this.get(e,(s,o)=>{if(s){i(s);return}if(o._rev!==n){i(oe(Nr));return}if(!o._attachments)return i();delete o._attachments[r],Object.keys(o._attachments).length===0&&delete o._attachments,this.put(o,i)})}).bind(this),this.remove=De("remove",function(e,r,n,i){var s;typeof r=="string"?(s={_id:e,_rev:r},typeof n=="function"&&(i=n,n={})):(s=e,typeof r=="function"?(i=r,n={}):(i=n,n=r)),n=n||{},n.was_delete=!0;var o={_id:s._id,_rev:s._rev||n.rev};if(o._deleted=!0,ur(o._id)&&typeof this._removeLocal=="function")return this._removeLocal(s,i);this.bulkDocs({docs:[o]},n,gs(i,o._id))}).bind(this),this.revsDiff=De("revsDiff",function(e,r,n){typeof r=="function"&&(n=r,r={});var i=Object.keys(e);if(!i.length)return n(null,{});var s=0,o=new Map;function a(d,m){o.has(d)||o.set(d,{missing:[]}),o.get(d).missing.push(m)}function c(d,m){var f=e[d].slice(0);fr(m,function(g,_,E,P,S){var y=_+"-"+E,w=f.indexOf(y);w!==-1&&(f.splice(w,1),S.status!=="available"&&a(d,y))}),f.forEach(function(g){a(d,g)})}i.forEach(function(d){this._getRevisionTree(d,function(m,f){if(m&&m.status===404&&m.message==="missing")o.set(d,{missing:e[d]});else{if(m)return n(m);c(d,f)}if(++s===i.length){var g={};return o.forEach(function(_,E){g[E]=_}),n(null,g)}})},this)}).bind(this),this.bulkGet=De("bulkGet",function(e,r){qf(this,e,r)}).bind(this),this.compactDocument=De("compactDocument",function(e,r,n){this._getRevisionTree(e,(i,s)=>{if(i)return n(i);var o=nm(s),a=[],c=[];Object.keys(o).forEach(function(d){o[d]>r&&a.push(d)}),fr(s,function(d,m,f,g,_){var E=m+"-"+f;_.status==="available"&&a.indexOf(E)!==-1&&c.push(E)}),this._doCompaction(e,c,n)})}).bind(this),this.compact=De("compact",function(e,r){typeof e=="function"&&(r=e,e={}),e=e||{},this._compactionQueue=this._compactionQueue||[],this._compactionQueue.push({opts:e,callback:r}),this._compactionQueue.length===1&&Ff(this)}).bind(this),this.get=De("get",function(e,r,n){if(typeof r=="function"&&(n=r,r={}),r=r||{},typeof e!="string")return n(oe(Nf));if(ur(e)&&typeof this._getLocal=="function")return this._getLocal(e,n);var i=[];let s=()=>{var c=[],d=i.length;if(!d)return n(null,c);i.forEach(m=>{this.get(e,{rev:m,revs:r.revs,latest:r.latest,attachments:r.attachments,binary:r.binary},function(f,g){if(f)c.push({missing:m});else{for(var _,E=0,P=c.length;E<P;E++)if(c[E].ok&&c[E].ok._rev===g._rev){_=!0;break}_||c.push({ok:g})}d--,d||n(null,c)})})};if(r.open_revs){if(r.open_revs==="all")this._getRevisionTree(e,function(c,d){if(c)return n(c);i=co(d).map(function(m){return m.rev}),s()});else if(Array.isArray(r.open_revs)){i=r.open_revs;for(var o=0;o<i.length;o++){var a=i[o];if(!ws(a))return n(oe(ei))}s()}else return n(oe(Zs,"function_clause"));return}return this._get(e,r,(c,d)=>{if(c)return c.docId=e,n(c);var m=d.doc,f=d.metadata,g=d.ctx;if(r.conflicts){var _=fo(f);_.length&&(m._conflicts=_)}if(xt(f,m._rev)&&(m._deleted=!0),r.revs||r.revs_info){for(var E=m._rev.split("-"),P=parseInt(E[0],10),S=E[1],y=Mf(f.rev_tree),w=null,p=0;p<y.length;p++){var h=y[p];let Y=h.ids.findIndex(Z=>Z.id===S);var v=Y===P-1;(v||!w&&Y!==-1)&&(w=h)}if(!w)return c=new Error("invalid rev tree"),c.docId=e,n(c);let H=m._rev.split("-")[1],re=w.ids.findIndex(Y=>Y.id===H)+1;var b=w.ids.length-re;if(w.ids.splice(re,b),w.ids.reverse(),r.revs&&(m._revisions={start:w.pos+w.ids.length-1,ids:w.ids.map(function(Y){return Y.id})}),r.revs_info){var N=w.pos+w.ids.length;m._revs_info=w.ids.map(function(Y){return N--,{rev:N+"-"+Y.id,status:Y.opts.status}})}}if(r.attachments&&m._attachments){var C=m._attachments,j=Object.keys(C).length;if(j===0)return n(null,m);Object.keys(C).forEach(H=>{this._getAttachment(m._id,H,C[H],{binary:r.binary,metadata:f,ctx:g},function(re,Y){var Z=m._attachments[H];Z.data=Y,delete Z.stub,delete Z.length,--j||n(null,m)})})}else{if(m._attachments)for(var G in m._attachments)Object.prototype.hasOwnProperty.call(m._attachments,G)&&(m._attachments[G].stub=!0);n(null,m)}})}).bind(this),this.getAttachment=De("getAttachment",function(e,r,n,i){n instanceof Function&&(i=n,n={}),this._get(e,n,(s,o)=>{if(s)return i(s);if(o.doc._attachments&&o.doc._attachments[r])n.ctx=o.ctx,n.binary=!0,n.metadata=o.metadata,this._getAttachment(e,r,o.doc._attachments[r],n,i);else return i(oe(ft))})}).bind(this),this.allDocs=De("allDocs",function(e,r){if(typeof e=="function"&&(r=e,e={}),e.skip=typeof e.skip<"u"?e.skip:0,e.start_key&&(e.startkey=e.start_key),e.end_key&&(e.endkey=e.end_key),"keys"in e){if(!Array.isArray(e.keys))return r(new TypeError("options.keys must be an array"));var n=["startkey","endkey","key"].filter(function(i){return i in e})[0];if(n){r(oe(Ap,"Query parameter `"+n+"` is not compatible with multi-get"));return}if(!Ot(this)&&(im(e),e.keys.length===0))return this._allDocs({limit:0},r)}return this._allDocs(e,r)}).bind(this),this.close=De("close",function(e){return this._closed=!0,this.emit("closed"),this._close(e)}).bind(this),this.info=De("info",function(e){this._info((r,n)=>{if(r)return e(r);n.db_name=n.db_name||this.name,n.auto_compaction=!!(this.auto_compaction&&!Ot(this)),n.adapter=this.adapter,e(null,n)})}).bind(this),this.id=De("id",function(e){return this._id(e)}).bind(this),this.bulkDocs=De("bulkDocs",function(e,r,n){if(typeof r=="function"&&(n=r,r={}),r=r||{},Array.isArray(e)&&(e={docs:e}),!e||!e.docs||!Array.isArray(e.docs))return n(oe(Sp));for(var i=0;i<e.docs.length;++i){let c=e.docs[i];if(_s(c))return n(oe(ys));if("_rev"in c&&!ws(c._rev))return n(oe(ei))}var s;if(e.docs.forEach(function(c){c._attachments&&Object.keys(c._attachments).forEach(function(d){s=s||om(d),c._attachments[d].content_type||dt("warn","Attachment",d,"on document",c._id,"is missing content_type")})}),s)return n(oe(hi,s));"new_edits"in r||("new_edits"in e?r.new_edits=e.new_edits:r.new_edits=!0);var o=this;!r.new_edits&&!Ot(o)&&e.docs.sort(rm),tm(e.docs);var a=e.docs.map(function(c){return c._id});this._bulkDocs(e,r,function(c,d){if(c)return n(c);if(r.new_edits||(d=d.filter(function(g){return g.error})),!Ot(o))for(var m=0,f=d.length;m<f;m++)d[m].id=d[m].id||a[m];n(null,d)})}).bind(this),this.registerDependentDatabase=De("registerDependentDatabase",function(e,r){var n=Ge(this.__opts);this.__opts.view_adapter&&(n.adapter=this.__opts.view_adapter);var i=new this.constructor(e,n);function s(o){return o.dependentDbs=o.dependentDbs||{},o.dependentDbs[e]?!1:(o.dependentDbs[e]=!0,o)}ii(this,"_local/_pouch_dependentDbs",s).then(function(){r(null,{db:i})}).catch(r)}).bind(this),this.destroy=De("destroy",function(e,r){typeof e=="function"&&(r=e,e={});var n="use_prefix"in this?this.use_prefix:!0;let i=()=>{this._destroy(e,(s,o)=>{if(s)return r(s);this._destroyed=!0,this.emit("destroyed"),r(null,o||{ok:!0})})};if(Ot(this))return i();this.get("_local/_pouch_dependentDbs",(s,o)=>{if(s)return s.status!==404?r(s):i();var a=o.dependentDbs,c=this.constructor,d=Object.keys(a).map(m=>{var f=n?m.replace(new RegExp("^"+c.prefix),""):m;return new c(f,this.__opts).destroy()});Promise.all(d).then(i,r)})}).bind(this)}_compact(e,r){var n={return_docs:!1,last_seq:e.last_seq||0,since:e.last_seq||0},i=[],s,o=0;let a=m=>{this.activeTasks.update(s,{completed_items:++o}),i.push(this.compactDocument(m.id,0))},c=m=>{this.activeTasks.remove(s,m),r(m)},d=m=>{var f=m.last_seq;Promise.all(i).then(()=>ii(this,"_local/compaction",g=>!g.last_seq||g.last_seq<f?(g.last_seq=f,g):!1)).then(()=>{this.activeTasks.remove(s),r(null,{ok:!0})}).catch(c)};this.info().then(m=>{s=this.activeTasks.add({name:"database_compaction",total_items:m.update_seq-n.last_seq}),this.changes(n).on("change",a).on("complete",d).on("error",c)})}changes(e,r){return typeof e=="function"&&(r=e,e={}),e=e||{},e.return_docs="return_docs"in e?e.return_docs:!e.live,new Cs(this,e,r)}type(){return typeof this._type=="function"?this._type():this.adapter}};si.prototype.purge=De("_purge",function(t,e,r){if(typeof this._purge>"u")return r(oe(Zs,"Purge is not implemented in the "+this.adapter+" adapter."));var n=this;n._getRevisionTree(t,(i,s)=>{if(i)return r(i);if(!s)return r(oe(ft));let o;try{o=Kp(s,e)}catch(a){return r(a.message||a)}n._purge(t,o,(a,c)=>{if(a)return r(a);sm(n,t,e).then(function(){return r(null,c)})})})});var xs=class{constructor(){this.isReady=!1,this.failed=!1,this.queue=[]}execute(){var e;if(this.failed)for(;e=this.queue.shift();)e(this.failed);else for(;e=this.queue.shift();)e()}fail(e){this.failed=e,this.execute()}ready(e){this.isReady=!0,this.db=e,this.execute()}addTask(e){this.queue.push(e),this.failed&&this.execute()}};function um(t,e){var r=t.match(/([a-z-]*):\/\/(.*)/);if(r)return{name:/https?/.test(r[1])?r[1]+"://"+r[2]:r[2],adapter:r[1]};var n=ae.adapters,i=ae.preferredAdapters,s=ae.prefix,o=e.adapter;if(!o)for(var a=0;a<i.length;++a){if(o=i[a],o==="idb"&&"websql"in n&&ni()&&localStorage["_pouch__websqldb_"+s+t]){dt("log",'PouchDB is downgrading "'+t+'" to WebSQL to avoid data loss, because it was already opened with WebSQL.');continue}break}var c=n[o],d=c&&"use_prefix"in c?c.use_prefix:!0;return{name:d?s+t:t,adapter:o}}function cm(t,e){t.prototype=Object.create(e.prototype,{constructor:{value:t}})}function Kf(t,e){let r=function(...n){if(!(this instanceof r))return new r(...n);e.apply(this,n)};return cm(r,t),r}function fm(t){function e(n){t.removeListener("closed",r),n||t.constructor.emit("destroyed",t.name)}function r(){t.removeListener("destroyed",e),t.constructor.emit("unref",t)}t.once("destroyed",e),t.once("closed",r),t.constructor.emit("ref",t)}var oi=class extends si{constructor(e,r){super(),this._setup(e,r)}_setup(e,r){if(super._setup(),r=r||{},e&&typeof e=="object"&&(r=e,e=r.name,delete r.name),r.deterministic_revs===void 0&&(r.deterministic_revs=!0),this.__opts=r=Ge(r),this.auto_compaction=r.auto_compaction,this.purged_infos_limit=r.purged_infos_limit||1e3,this.prefix=ae.prefix,typeof e!="string")throw new Error("Missing/invalid DB name");var n=(r.prefix||"")+e,i=um(n,r);if(r.name=i.name,r.adapter=r.adapter||i.adapter,this.name=e,this._adapter=r.adapter,ae.emit("debug",["adapter","Picked adapter: ",r.adapter]),!ae.adapters[r.adapter]||!ae.adapters[r.adapter].valid())throw new Error("Invalid Adapter: "+r.adapter);if(r.view_adapter&&(!ae.adapters[r.view_adapter]||!ae.adapters[r.view_adapter].valid()))throw new Error("Invalid View Adapter: "+r.view_adapter);this.taskqueue=new xs,this.adapter=r.adapter,ae.adapters[r.adapter].call(this,r,s=>{if(s)return this.taskqueue.fail(s);fm(this),this.emit("created",this),ae.emit("created",this.name),this.taskqueue.ready(this)})}},ae=Kf(oi,function(t,e){oi.prototype._setup.call(this,t,e)}),zf=fetch,Rr=Headers,js=class{constructor(){this.tasks={}}list(){return Object.values(this.tasks)}add(e){let r=rn();return this.tasks[r]={id:r,name:e.name,total_items:e.total_items,created_at:new Date().toJSON()},r}get(e){return this.tasks[e]}remove(e,r){return delete this.tasks[e],this.tasks}update(e,r){let n=this.tasks[e];if(typeof n<"u"){let i={id:n.id,name:n.name,created_at:n.created_at,total_items:r.total_items||n.total_items,completed_items:r.completed_items||n.completed_items,updated_at:new Date().toJSON()};this.tasks[e]=i}return this.tasks}};ae.adapters={};ae.preferredAdapters=[];ae.prefix="_pouch_";var uf=new it;function lm(t){Object.keys(it.prototype).forEach(function(r){typeof it.prototype[r]=="function"&&(t[r]=uf[r].bind(uf))});var e=t._destructionListeners=new Map;t.on("ref",function(n){e.has(n.name)||e.set(n.name,[]),e.get(n.name).push(n)}),t.on("unref",function(n){if(e.has(n.name)){var i=e.get(n.name),s=i.indexOf(n);s<0||(i.splice(s,1),i.length>1?e.set(n.name,i):e.delete(n.name))}}),t.on("destroyed",function(n){if(e.has(n)){var i=e.get(n);e.delete(n),i.forEach(function(s){s.emit("destroyed",!0)})}})}lm(ae);ae.adapter=function(t,e,r){e.valid()&&(ae.adapters[t]=e,r&&ae.preferredAdapters.push(t))};ae.plugin=function(t){if(typeof t=="function")t(ae);else{if(typeof t!="object"||Object.keys(t).length===0)throw new Error('Invalid plugin: got "'+t+'", expected an object or a function');Object.keys(t).forEach(function(e){ae.prototype[e]=t[e]})}return this.__defaults&&(ae.__defaults=Object.assign({},this.__defaults)),ae};ae.defaults=function(t){let e=Kf(ae,function(r,n){n=n||{},r&&typeof r=="object"&&(n=r,r=n.name,delete n.name),n=Object.assign({},e.__defaults,n),ae.call(this,r,n)});return e.preferredAdapters=ae.preferredAdapters.slice(),Object.keys(ae).forEach(function(r){r in e||(e[r]=ae[r])}),e.__defaults=Object.assign({},this.__defaults,t),e};ae.fetch=function(t,e){return zf(t,e)};ae.prototype.activeTasks=ae.activeTasks=new js;var dm="9.0.0";function lo(t,e){for(var r=t,n=0,i=e.length;n<i;n++){var s=e[n];if(r=r[s],!r)break}return r}function hm(t,e){return t<e?-1:t>e?1:0}function ho(t){for(var e=[],r="",n=0,i=t.length;n<i;n++){var s=t[n];n>0&&t[n-1]==="\\"&&(s==="$"||s===".")?r=r.substring(0,r.length-1)+s:s==="."?(e.push(r),r=""):r+=s}return e.push(r),e}var pm=["$or","$nor","$not"];function Vf(t){return pm.indexOf(t)>-1}function Jf(t){return Object.keys(t)[0]}function mm(t){return t[Jf(t)]}function on(t){var e={},r={$or:!0,$nor:!0};return t.forEach(function(n){Object.keys(n).forEach(function(i){var s=n[i];if(typeof s!="object"&&(s={$eq:s}),Vf(i))if(s instanceof Array){if(r[i]){r[i]=!1,e[i]=s;return}var o=[];e[i].forEach(function(c){Object.keys(s).forEach(function(d){var m=s[d],f=Math.max(Object.keys(c).length,Object.keys(m).length),g=on([c,m]);Object.keys(g).length<=f||o.push(g)})}),e[i]=o}else e[i]=on([s]);else{var a=e[i]=e[i]||{};Object.keys(s).forEach(function(c){var d=s[c];if(c==="$gt"||c==="$gte")return vm(c,d,a);if(c==="$lt"||c==="$lte")return ym(c,d,a);if(c==="$ne")return gm(d,a);if(c==="$eq")return _m(d,a);if(c==="$regex")return wm(d,a);a[c]=d})}})}),e}function vm(t,e,r){typeof r.$eq<"u"||(typeof r.$gte<"u"?t==="$gte"?e>r.$gte&&(r.$gte=e):e>=r.$gte&&(delete r.$gte,r.$gt=e):typeof r.$gt<"u"?t==="$gte"?e>r.$gt&&(delete r.$gt,r.$gte=e):e>r.$gt&&(r.$gt=e):r[t]=e)}function ym(t,e,r){typeof r.$eq<"u"||(typeof r.$lte<"u"?t==="$lte"?e<r.$lte&&(r.$lte=e):e<=r.$lte&&(delete r.$lte,r.$lt=e):typeof r.$lt<"u"?t==="$lte"?e<r.$lt&&(delete r.$lt,r.$lte=e):e<r.$lt&&(r.$lt=e):r[t]=e)}function gm(t,e){"$ne"in e?e.$ne.push(t):e.$ne=[t]}function _m(t,e){delete e.$gt,delete e.$gte,delete e.$lt,delete e.$lte,delete e.$ne,e.$eq=t}function wm(t,e){"$regex"in e?e.$regex.push(t):e.$regex=[t]}function Hf(t){for(var e in t){if(Array.isArray(t))for(var r in t)t[r].$and&&(t[r]=on(t[r].$and));var n=t[e];typeof n=="object"&&Hf(n)}return t}function Wf(t,e){for(var r in t){r==="$and"&&(e=!0);var n=t[r];typeof n=="object"&&(e=Wf(n,e))}return e}function bm(t){var e=Ge(t);Wf(e,!1)&&(e=Hf(e),"$and"in e&&(e=on(e.$and))),["$or","$nor"].forEach(function(o){o in e&&e[o].forEach(function(a){for(var c=Object.keys(a),d=0;d<c.length;d++){var m=c[d],f=a[m];(typeof f!="object"||f===null)&&(a[m]={$eq:f})}})}),"$not"in e&&(e.$not=on([e.$not]));for(var r=Object.keys(e),n=0;n<r.length;n++){var i=r[n],s=e[i];(typeof s!="object"||s===null)&&(s={$eq:s}),e[i]=s}return Ds(e),e}function Ds(t){Object.keys(t).forEach(function(e){var r=t[e];Array.isArray(r)?r.forEach(function(n){n&&typeof n=="object"&&Ds(n)}):e==="$ne"?t.$ne=[r]:e==="$regex"?t.$regex=[r]:r&&typeof r=="object"&&Ds(r)})}function Em(t,e,r){for(var n="",i=r-t.length;n.length<i;)n+=e;return n}function $m(t,e,r){var n=Em(t,e,r);return n+t}var Qf=-324,Bs=3,Ls="";function Be(t,e){if(t===e)return 0;t=lr(t),e=lr(e);var r=Ms(t),n=Ms(e);if(r-n!==0)return r-n;switch(typeof t){case"number":return t-e;case"boolean":return t<e?-1:1;case"string":return Tm(t,e)}return Array.isArray(t)?Im(t,e):Rm(t,e)}function lr(t){switch(typeof t){case"undefined":return null;case"number":return t===1/0||t===-1/0||isNaN(t)?null:t;case"object":var e=t;if(Array.isArray(t)){var r=t.length;t=new Array(r);for(var n=0;n<r;n++)t[n]=lr(e[n])}else{if(t instanceof Date)return t.toJSON();if(t!==null){t={};for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){var s=e[i];typeof s<"u"&&(t[i]=lr(s))}}}}return t}function Sm(t){if(t!==null)switch(typeof t){case"boolean":return t?1:0;case"number":return qm(t);case"string":return t.replace(/\u0002/g,"").replace(/\u0001/g,"").replace(/\u0000/g,"");case"object":var e=Array.isArray(t),r=e?t:Object.keys(t),n=-1,i=r.length,s="";if(e)for(;++n<i;)s+=gt(r[n]);else for(;++n<i;){var o=r[n];s+=gt(o)+gt(t[o])}return s}return""}function gt(t){var e="\0";return t=lr(t),Ms(t)+Ls+Sm(t)+e}function Pm(t,e){var r=e,n,i=t[e]==="1";if(i)n=0,e++;else{var s=t[e]==="0";e++;var o="",a=t.substring(e,e+Bs),c=parseInt(a,10)+Qf;for(s&&(c=-c),e+=Bs;;){var d=t[e];if(d==="\0")break;o+=d,e++}o=o.split("."),o.length===1?n=parseInt(o,10):n=parseFloat(o[0]+"."+o[1]),s&&(n=n-10),c!==0&&(n=parseFloat(n+"e"+c))}return{num:n,length:e-r}}function Om(t,e){var r=t.pop();if(e.length){var n=e[e.length-1];r===n.element&&(e.pop(),n=e[e.length-1]);var i=n.element,s=n.index;if(Array.isArray(i))i.push(r);else if(s===t.length-2){var o=t.pop();i[o]=r}else t.push(r)}}function Am(t){for(var e=[],r=[],n=0;;){var i=t[n++];if(i==="\0"){if(e.length===1)return e.pop();Om(e,r);continue}switch(i){case"1":e.push(null);break;case"2":e.push(t[n]==="1"),n++;break;case"3":var s=Pm(t,n);e.push(s.num),n+=s.length;break;case"4":for(var o="";;){var a=t[n];if(a==="\0")break;o+=a,n++}o=o.replace(/\u0001\u0001/g,"\0").replace(/\u0001\u0002/g,"").replace(/\u0002\u0002/g,""),e.push(o);break;case"5":var c={element:[],index:e.length};e.push(c.element),r.push(c);break;case"6":var d={element:{},index:e.length};e.push(d.element),r.push(d);break;default:throw new Error("bad collationIndex or unexpectedly reached end of input: "+i)}}}function Im(t,e){for(var r=Math.min(t.length,e.length),n=0;n<r;n++){var i=Be(t[n],e[n]);if(i!==0)return i}return t.length===e.length?0:t.length>e.length?1:-1}function Tm(t,e){return t===e?0:t>e?1:-1}function Rm(t,e){for(var r=Object.keys(t),n=Object.keys(e),i=Math.min(r.length,n.length),s=0;s<i;s++){var o=Be(r[s],n[s]);if(o!==0||(o=Be(t[r[s]],e[n[s]]),o!==0))return o}return r.length===n.length?0:r.length>n.length?1:-1}function Ms(t){var e=["boolean","number","string","object"],r=e.indexOf(typeof t);if(~r)return t===null?1:Array.isArray(t)?5:r<3?r+2:r+3;if(Array.isArray(t))return 5}function qm(t){if(t===0)return"1";var e=t.toExponential().split(/e\+?/),r=parseInt(e[1],10),n=t<0,i=n?"0":"2",s=(n?-r:r)-Qf,o=$m(s.toString(),"0",Bs);i+=Ls+o;var a=Math.abs(parseFloat(e[0]));n&&(a=10-a);var c=a.toFixed(20);return c=c.replace(/\.?0+$/,""),i+=Ls+c,i}function Nm(t){function e(r){return t.map(function(n){var i=Jf(n),s=ho(i),o=lo(r,s);return o})}return function(r,n){var i=e(r.doc),s=e(n.doc),o=Be(i,s);return o!==0?o:hm(r.doc._id,n.doc._id)}}function km(t,e,r){if(t=t.filter(function(o){return qr(o.doc,e.selector,r)}),e.sort){var n=Nm(e.sort);t=t.sort(n),typeof e.sort[0]!="string"&&mm(e.sort[0])==="desc"&&(t=t.reverse())}if("limit"in e||"skip"in e){var i=e.skip||0,s=("limit"in e?e.limit:t.length)+i;t=t.slice(i,s)}return t}function qr(t,e,r){return r.every(function(n){var i=e[n],s=ho(n),o=lo(t,s);return Vf(n)?Cm(n,i,t):ai(i,t,s,o)})}function ai(t,e,r,n){return t?typeof t=="object"?Object.keys(t).every(function(i){var s=t[i];if(i.indexOf("$")===0)return cf(i,e,s,r,n);var o=ho(i);if(n===void 0&&typeof s!="object"&&o.length>0)return!1;var a=lo(n,o);return typeof s=="object"?ai(s,e,r,a):cf("$eq",e,s,o,a)}):t===n:!0}function Cm(t,e,r){return t==="$or"?e.some(function(n){return qr(r,n,Object.keys(n))}):t==="$not"?!qr(r,e,Object.keys(e)):!e.find(function(n){return qr(r,n,Object.keys(n))})}function cf(t,e,r,n,i){if(!lf[t])throw new Error('unknown operator "'+t+'" - should be one of $eq, $lte, $lt, $gt, $gte, $exists, $ne, $in, $nin, $size, $mod, $regex, $elemMatch, $type, $allMatch or $all');return lf[t](e,r,n,i)}function nn(t){return typeof t<"u"&&t!==null}function nr(t){return typeof t<"u"}function xm(t,e){if(typeof t!="number"||parseInt(t,10)!==t)return!1;var r=e[0],n=e[1];return t%r===n}function ff(t,e){return e.some(function(r){return t instanceof Array?t.some(function(n){return Be(r,n)===0}):Be(r,t)===0})}function jm(t,e){return e.every(function(r){return t.some(function(n){return Be(r,n)===0})})}function Dm(t,e){return t.length===e}function Bm(t,e){var r=new RegExp(e);return r.test(t)}function Lm(t,e){switch(e){case"null":return t===null;case"boolean":return typeof t=="boolean";case"number":return typeof t=="number";case"string":return typeof t=="string";case"array":return t instanceof Array;case"object":return{}.toString.call(t)==="[object Object]"}}var lf={$elemMatch:function(t,e,r,n){return!Array.isArray(n)||n.length===0?!1:typeof n[0]=="object"&&n[0]!==null?n.some(function(i){return qr(i,e,Object.keys(e))}):n.some(function(i){return ai(e,t,r,i)})},$allMatch:function(t,e,r,n){return!Array.isArray(n)||n.length===0?!1:typeof n[0]=="object"&&n[0]!==null?n.every(function(i){return qr(i,e,Object.keys(e))}):n.every(function(i){return ai(e,t,r,i)})},$eq:function(t,e,r,n){return nr(n)&&Be(n,e)===0},$gte:function(t,e,r,n){return nr(n)&&Be(n,e)>=0},$gt:function(t,e,r,n){return nr(n)&&Be(n,e)>0},$lte:function(t,e,r,n){return nr(n)&&Be(n,e)<=0},$lt:function(t,e,r,n){return nr(n)&&Be(n,e)<0},$exists:function(t,e,r,n){return e?nr(n):!nr(n)},$mod:function(t,e,r,n){return nn(n)&&xm(n,e)},$ne:function(t,e,r,n){return e.every(function(i){return Be(n,i)!==0})},$in:function(t,e,r,n){return nn(n)&&ff(n,e)},$nin:function(t,e,r,n){return nn(n)&&!ff(n,e)},$size:function(t,e,r,n){return nn(n)&&Array.isArray(n)&&Dm(n,e)},$all:function(t,e,r,n){return Array.isArray(n)&&jm(n,e)},$regex:function(t,e,r,n){return nn(n)&&typeof n=="string"&&e.every(function(i){return Bm(n,i)})},$type:function(t,e,r,n){return Lm(n,e)}};function Mm(t,e){if(typeof e!="object")throw new Error("Selector error: expected a JSON object");e=bm(e);var r={doc:t},n=km([r],{selector:e},Object.keys(e));return n&&n.length===1}function Um(t){return ro(`"use strict";
|
|
12
|
+
return `+t+";",{})}function Gm(t){var e=["return function(doc) {",' "use strict";'," var emitted = false;"," var emit = function (a, b) {"," emitted = true;"," };"," var view = "+t+";"," view(doc);"," if (emitted) {"," return true;"," }","};"].join(`
|
|
13
|
+
`);return ro(e,{})}function Fm(t,e){if(t.selector&&t.filter&&t.filter!=="_selector"){var r=typeof t.filter=="string"?t.filter:"function";return e(new Error('selector invalid for filter "'+r+'"'))}e()}function Km(t){t.view&&!t.filter&&(t.filter="_view"),t.selector&&!t.filter&&(t.filter="_selector"),t.filter&&typeof t.filter=="string"&&(t.filter==="_view"?t.view=rf(t.view):t.filter=rf(t.filter))}function zm(t,e){return e.filter&&typeof e.filter=="string"&&!e.doc_ids&&!Ot(t.db)}function Vm(t,e){var r=e.complete;if(e.filter==="_view"){if(!e.view||typeof e.view!="string"){var n=oe(hi,"`view` filter parameter not found or invalid.");return r(n)}var i=ks(e.view);t.db.get("_design/"+i[0],function(o,a){if(t.isCancelled)return r(null,{status:"cancelled"});if(o)return r(kr(o));var c=a&&a.views&&a.views[i[1]]&&a.views[i[1]].map;if(!c)return r(oe(ft,a.views?"missing json key: "+i[1]:"missing json key: views"));e.filter=Gm(c),t.doChanges(e)})}else if(e.selector)e.filter=function(o){return Mm(o,e.selector)},t.doChanges(e);else{var s=ks(e.filter);t.db.get("_design/"+s[0],function(o,a){if(t.isCancelled)return r(null,{status:"cancelled"});if(o)return r(kr(o));var c=a&&a.filters&&a.filters[s[1]];if(!c)return r(oe(ft,a&&a.filters?"missing json key: "+s[1]:"missing json key: filters"));e.filter=Um(c),t.doChanges(e)})}}function Jm(t){t._changesFilterPlugin={validate:Fm,normalize:Km,shouldFilter:zm,filter:Vm}}ae.plugin(Jm);ae.version=dm;function Hm(t,e,r){return new Promise(function(n){var i=io([""]);let s;if(typeof r=="function"){let a=r(i);s=t.objectStore(e).put(a)}else{let o=r;s=t.objectStore(e).put(i,o)}s.onsuccess=function(){var o=navigator.userAgent.match(/Chrome\/(\d+)/),a=navigator.userAgent.match(/Edge\//);n(a||!o||parseInt(o[1],10)>=43)},s.onerror=t.onabort=function(o){o.preventDefault(),o.stopPropagation(),n(!1)}}).catch(function(){return!1})}function Yf(t){return t.reduce(function(e,r){return e[r]=!0,e},{})}var Wm=Yf(["_id","_rev","_access","_attachments","_deleted","_revisions","_revs_info","_conflicts","_deleted_conflicts","_local_seq","_rev_tree","_replication_id","_replication_state","_replication_state_time","_replication_state_reason","_replication_stats","_removed"]),Qm=Yf(["_access","_attachments","_replication_id","_replication_state","_replication_state_time","_replication_state_reason","_replication_stats"]);function df(t){if(!/^\d+-/.test(t))return oe(ei);var e=t.indexOf("-"),r=t.substring(0,e),n=t.substring(e+1);return{prefix:parseInt(r,10),id:n}}function Ym(t,e){for(var r=t.start-t.ids.length+1,n=t.ids,i=[n[0],e,[]],s=1,o=n.length;s<o;s++)i=[n[s],{status:"missing"},[i]];return[{pos:r,ids:i}]}function Xf(t,e,r){r||(r={deterministic_revs:!0});var n,i,s,o={status:"available"};if(t._deleted&&(o.deleted=!0),e)if(t._id||(t._id=pi()),i=Lf(t,r.deterministic_revs),t._rev){if(s=df(t._rev),s.error)return s;t._rev_tree=[{pos:s.prefix,ids:[s.id,{status:"missing"},[[i,o,[]]]]}],n=s.prefix+1}else t._rev_tree=[{pos:1,ids:[i,o,[]]}],n=1;else if(t._revisions&&(t._rev_tree=Ym(t._revisions,o),n=t._revisions.start,i=t._revisions.ids[0]),!t._rev_tree){if(s=df(t._rev),s.error)return s;n=s.prefix,i=s.id,t._rev_tree=[{pos:n,ids:[i,o,[]]}]}Cf(t._id),t._rev=n+"-"+i;var a={metadata:{},data:{}};for(var c in t)if(Object.prototype.hasOwnProperty.call(t,c)){var d=c[0]==="_";if(d&&!Wm[c]){var m=oe(tf,c);throw m.message=tf.message+": "+c,m}else d&&!Qm[c]?a.metadata[c.slice(1)]=t[c]:a.data[c]=t[c]}return a}function Xm(t){try{return no(t)}catch{var e=oe(kf,"Attachment is not a valid base64 string");return{error:e}}}function Zm(t,e,r){var n=Xm(t.data);if(n.error)return r(n.error);t.length=n.length,e==="blob"?t.data=so(n,t.content_type):e==="base64"?t.data=cn(n):t.data=n,uo(n,function(i){t.digest="md5-"+i,r()})}function ev(t,e,r){uo(t.data,function(n){t.digest="md5-"+n,t.length=t.data.size||t.data.length||0,e==="binary"?Df(t.data,function(i){t.data=i,r()}):e==="base64"?ao(t.data,function(i){t.data=i,r()}):r()})}function tv(t,e,r){if(t.stub)return r();typeof t.data=="string"?Zm(t,e,r):ev(t,e,r)}function rv(t,e,r){if(!t.length)return r();var n=0,i;t.forEach(function(o){var a=o.data&&o.data._attachments?Object.keys(o.data._attachments):[],c=0;if(!a.length)return s();function d(f){i=f,c++,c===a.length&&s()}for(var m in o.data._attachments)Object.prototype.hasOwnProperty.call(o.data._attachments,m)&&tv(o.data._attachments[m],e,d)});function s(){n++,t.length===n&&(i?r(i):r())}}function nv(t,e,r,n,i,s,o,a){if(Qp(e.rev_tree,r.metadata.rev)&&!a)return n[i]=r,s();var c=e.winningRev||cr(e),d="deleted"in e?e.deleted:xt(e,c),m="deleted"in r.metadata?r.metadata.deleted:xt(r.metadata),f=/^1-/.test(r.metadata.rev);if(d&&!m&&a&&f){var g=r.data;g._rev=c,g._id=r.metadata.id,r=Xf(g,a)}var _=Gf(e.rev_tree,r.metadata.rev_tree[0],t),E=a&&(d&&m&&_.conflicts!=="new_leaf"||!d&&_.conflicts!=="new_leaf"||d&&!m&&_.conflicts==="new_branch");if(E){var P=oe(Nr);return n[i]=P,s()}var S=r.metadata.rev;r.metadata.rev_tree=_.tree,r.stemmedRevs=_.stemmedRevs||[],e.rev_map&&(r.metadata.rev_map=e.rev_map);var y=cr(r.metadata),w=xt(r.metadata,y),p=d===w?0:d<w?-1:1,h;S===y?h=w:h=xt(r.metadata,S),o(r,y,w,h,!0,p,i,s)}function iv(t){return t.metadata.rev_tree[0].ids[1].status==="missing"}function sv(t,e,r,n,i,s,o,a,c){t=t||1e3;function d(P,S,y){var w=cr(P.metadata),p=xt(P.metadata,w);if("was_delete"in a&&p)return s[S]=oe(ft,"deleted"),y();var h=m&&iv(P);if(h){var v=oe(Nr);return s[S]=v,y()}var b=p?0:1;o(P,w,p,p,!1,b,S,y)}var m=a.new_edits,f=new Map,g=0,_=e.length;function E(){++g===_&&c&&c()}e.forEach(function(P,S){if(P._id&&ur(P._id)){var y=P._deleted?"_removeLocal":"_putLocal";r[y](P,{ctx:i},function(p,h){s[S]=p||h,E()});return}var w=P.metadata.id;f.has(w)?(_--,f.get(w).push([P,S])):f.set(w,[[P,S]])}),f.forEach(function(P,S){var y=0;function w(){++y<P.length?p():E()}function p(){var h=P[y],v=h[0],b=h[1];if(n.has(S))nv(t,n.get(S),v,s,b,w,o,m);else{var N=Gf([],v.metadata.rev_tree[0],t);v.metadata.rev_tree=N.tree,v.stemmedRevs=N.stemmedRevs||[],d(v,b,w)}}p()})}var ov=5,Me="document-store",ze="by-sequence",lt="attach-store",or="attach-seq-store",et="meta-store",St="local-store",bs="detect-blob-support";function av(t){try{return JSON.parse(t)}catch{return Xs.default.parse(t)}}function uv(t){try{return JSON.stringify(t)}catch{return Xs.default.stringify(t)}}function Pt(t){return function(e){var r="unknown_error";e.target&&e.target.error&&(r=e.target.error.name||e.target.error.message),t(oe(eo,r,e.type))}}function Us(t,e,r){return{data:uv(t),winningRev:e,deletedOrLocal:r?"1":"0",seq:t.seq,id:t.id}}function ar(t){if(!t)return null;var e=av(t.data);return e.winningRev=t.winningRev,e.deleted=t.deletedOrLocal==="1",e.seq=t.seq,e}function ui(t){if(!t)return t;var e=t._doc_id_rev.lastIndexOf(":");return t._id=t._doc_id_rev.substring(0,e-1),t._rev=t._doc_id_rev.substring(e+1),delete t._doc_id_rev,t}function Zf(t,e,r,n){r?n(t?typeof t!="string"?t:oo(t,e):io([""],{type:e})):t?typeof t!="string"?jf(t,function(i){n(cn(i))}):n(t):n("")}function el(t,e,r,n){var i=Object.keys(t._attachments||{});if(!i.length)return n&&n();var s=0;function o(){++s===i.length&&n&&n()}function a(c,d){var m=c._attachments[d],f=m.digest,g=r.objectStore(lt).get(f);g.onsuccess=function(_){m.body=_.target.result.body,o()}}i.forEach(function(c){e.attachments&&e.include_docs?a(t,c):(t._attachments[c].stub=!0,o())})}function Gs(t,e){return Promise.all(t.map(function(r){if(r.doc&&r.doc._attachments){var n=Object.keys(r.doc._attachments);return Promise.all(n.map(function(i){var s=r.doc._attachments[i];if("body"in s){var o=s.body,a=s.content_type;return new Promise(function(c){Zf(o,a,e,function(d){r.doc._attachments[i]=Object.assign(un(s,["digest","content_type"]),{data:d}),c()})})}}))}}))}function tl(t,e,r){var n=[],i=r.objectStore(ze),s=r.objectStore(lt),o=r.objectStore(or),a=t.length;function c(){a--,a||d()}function d(){n.length&&n.forEach(function(m){var f=o.index("digestSeq").count(IDBKeyRange.bound(m+"::",m+"::\uFFFF",!1,!1));f.onsuccess=function(g){var _=g.target.result;_||s.delete(m)}})}t.forEach(function(m){var f=i.index("_doc_id_rev"),g=e+"::"+m;f.getKey(g).onsuccess=function(_){var E=_.target.result;if(typeof E!="number")return c();i.delete(E);var P=o.index("seq").openCursor(IDBKeyRange.only(E));P.onsuccess=function(S){var y=S.target.result;if(y){var w=y.value.digestSeq.split("::")[0];n.push(w),o.delete(y.primaryKey),y.continue()}else c()}}})}function _t(t,e,r){try{return{txn:t.transaction(e,r)}}catch(n){return{error:n}}}var sn=new qs;function cv(t,e,r,n,i,s){for(var o=e.docs,a,c,d,m,f,g,_,E,P=0,S=o.length;P<S;P++){var y=o[P];y._id&&ur(y._id)||(y=o[P]=Xf(y,r.new_edits,t),y.error&&!_&&(_=y))}if(_)return s(_);var w=!1,p=0,h=new Array(o.length),v=new Map,b=!1,N=n._meta.blobSupport?"blob":"base64";rv(o,N,function(B){if(B)return s(B);C()});function C(){var B=[Me,ze,lt,St,or,et],F=_t(i,B,"readwrite");if(F.error)return s(F.error);a=F.txn,a.onabort=Pt(s),a.ontimeout=Pt(s),a.oncomplete=Y,c=a.objectStore(Me),d=a.objectStore(ze),m=a.objectStore(lt),f=a.objectStore(or),g=a.objectStore(et),g.get(et).onsuccess=function(X){E=X.target.result,H()},ce(function(X){if(X)return b=!0,s(X);re()})}function j(){w=!0,H()}function G(){sv(t.revs_limit,o,n,v,a,h,fe,r,j)}function H(){!E||!w||(E.docCount+=p,g.put(E))}function re(){if(!o.length)return;var B=0;function F(){++B===o.length&&G()}function X(W){var ee=ar(W.target.result);ee&&v.set(ee.id,ee),F()}for(var ie=0,J=o.length;ie<J;ie++){var D=o[ie];if(D._id&&ur(D._id)){F();continue}var M=c.get(D.metadata.id);M.onsuccess=X}}function Y(){b||(sn.notify(n._meta.name),s(null,h))}function Z(B,F){var X=m.get(B);X.onsuccess=function(ie){if(ie.target.result)F();else{var J=oe(Ip,"unknown stub attachment with digest "+B);J.status=412,F(J)}}}function ce(B){var F=[];if(o.forEach(function(D){D.data&&D.data._attachments&&Object.keys(D.data._attachments).forEach(function(M){var W=D.data._attachments[M];W.stub&&F.push(W.digest)})}),!F.length)return B();var X=0,ie;function J(){++X===F.length&&B(ie)}F.forEach(function(D){Z(D,function(M){M&&!ie&&(ie=M),J()})})}function fe(B,F,X,ie,J,D,M,W){B.metadata.winningRev=F,B.metadata.deleted=X;var ee=B.data;ee._id=B.metadata.id,ee._rev=B.metadata.rev,ie&&(ee._deleted=!0);var ne=ee._attachments&&Object.keys(ee._attachments).length;if(ne)return q(B,F,X,J,M,W);p+=D,H(),me(B,F,X,J,M,W)}function me(B,F,X,ie,J,D){var M=B.data,W=B.metadata;M._doc_id_rev=W.id+"::"+W.rev,delete M._id,delete M._rev;function ee(Re){var We=B.stemmedRevs||[];ie&&n.auto_compaction&&(We=We.concat(Fp(B.metadata))),We&&We.length&&tl(We,B.metadata.id,a),W.seq=Re.target.result;var ct=Us(W,F,X),ve=c.put(ct);ve.onsuccess=Ee}function ne(Re){Re.preventDefault(),Re.stopPropagation();var We=d.index("_doc_id_rev"),ct=We.getKey(M._doc_id_rev);ct.onsuccess=function(ve){var ge=d.put(M,ve.target.result);ge.onsuccess=ee}}function Ee(){h[J]={ok:!0,id:W.id,rev:W.rev},v.set(B.metadata.id,B.metadata),k(B,W.seq,D)}var $e=d.put(M);$e.onsuccess=ee,$e.onerror=ne}function q(B,F,X,ie,J,D){var M=B.data,W=0,ee=Object.keys(M._attachments);function ne(){W===ee.length&&me(B,F,X,ie,J,D)}function Ee(){W++,ne()}ee.forEach(function($e){var Re=B.data._attachments[$e];if(Re.stub)W++,ne();else{var We=Re.data;delete Re.data,Re.revpos=parseInt(F,10);var ct=Re.digest;L(ct,We,Ee)}})}function k(B,F,X){var ie=0,J=Object.keys(B.data._attachments||{});if(!J.length)return X();function D(){++ie===J.length&&X()}function M(ee){var ne=B.data._attachments[ee].digest,Ee=f.put({seq:F,digestSeq:ne+"::"+F});Ee.onsuccess=D,Ee.onerror=function($e){$e.preventDefault(),$e.stopPropagation(),D()}}for(var W=0;W<J.length;W++)M(J[W])}function L(B,F,X){var ie=m.count(B);ie.onsuccess=function(J){var D=J.target.result;if(D)return X();var M={digest:B,body:F},W=m.put(M);W.onsuccess=X}}}function rl(t,e,r,n,i){n===-1&&(n=1e3);var s=typeof t.getAll=="function"&&typeof t.getAllKeys=="function"&&n>1&&!r,o,a,c;function d(_){a=_.target.result,o&&i(o,a,c)}function m(_){o=_.target.result,a&&i(o,a,c)}function f(){if(!o.length)return i();var _=o[o.length-1],E;if(e&&e.upper)try{E=IDBKeyRange.bound(_,e.upper,!0,e.upperOpen)}catch(P){if(P.name==="DataError"&&P.code===0)return i()}else E=IDBKeyRange.lowerBound(_,!0);e=E,o=null,a=null,t.getAll(e,n).onsuccess=d,t.getAllKeys(e,n).onsuccess=m}function g(_){var E=_.target.result;if(!E)return i();i([E.key],[E.value],E)}s?(c={continue:f},t.getAll(e,n).onsuccess=d,t.getAllKeys(e,n).onsuccess=m):r?t.openCursor(e,"prev").onsuccess=g:t.openCursor(e).onsuccess=g}function fv(t,e,r){if(typeof t.getAll=="function"){t.getAll(e).onsuccess=r;return}var n=[];function i(s){var o=s.target.result;o?(n.push(o.value),o.continue()):r({target:{result:n}})}t.openCursor(e).onsuccess=i}function lv(t,e,r){var n=new Array(t.length),i=0;t.forEach(function(s,o){e.get(s).onsuccess=function(a){a.target.result?n[o]=a.target.result:n[o]={key:s,error:"not_found"},i++,i===t.length&&r(t,n,{})}})}function dv(t,e,r,n,i){try{if(t&&e)return i?IDBKeyRange.bound(e,t,!r,!1):IDBKeyRange.bound(t,e,!1,!r);if(t)return i?IDBKeyRange.upperBound(t):IDBKeyRange.lowerBound(t);if(e)return i?IDBKeyRange.lowerBound(e,!r):IDBKeyRange.upperBound(e,!r);if(n)return IDBKeyRange.only(n)}catch(s){return{error:s}}return null}function hv(t,e,r){var n="startkey"in t?t.startkey:!1,i="endkey"in t?t.endkey:!1,s="key"in t?t.key:!1,o="keys"in t?t.keys:!1,a=t.skip||0,c=typeof t.limit=="number"?t.limit:-1,d=t.inclusive_end!==!1,m,f;if(!o&&(m=dv(n,i,d,s,t.descending),f=m&&m.error,f&&!(f.name==="DataError"&&f.code===0)))return r(oe(eo,f.name,f.message));var g=[Me,ze,et];t.attachments&&g.push(lt);var _=_t(e,g,"readonly");if(_.error)return r(_.error);var E=_.txn;E.oncomplete=re,E.onabort=Pt(r);var P=E.objectStore(Me),S=E.objectStore(ze),y=E.objectStore(et),w=S.index("_doc_id_rev"),p=[],h,v;y.get(et).onsuccess=function(Y){h=Y.target.result.docCount},t.update_seq&&(S.openKeyCursor(null,"prev").onsuccess=Y=>{var Z=Y.target.result;Z&&Z.key&&(v=Z.key)});function b(Y,Z,ce){var fe=Y.id+"::"+ce;w.get(fe).onsuccess=function(q){if(Z.doc=ui(q.target.result)||{},t.conflicts){var k=fo(Y);k.length&&(Z.doc._conflicts=k)}el(Z.doc,t,E)}}function N(Y,Z){var ce={id:Z.id,key:Z.id,value:{rev:Y}},fe=Z.deleted;fe?o&&(p.push(ce),ce.value.deleted=!0,ce.doc=null):a--<=0&&(p.push(ce),t.include_docs&&b(Z,ce,Y))}function C(Y){for(var Z=0,ce=Y.length;Z<ce&&p.length!==c;Z++){var fe=Y[Z];if(fe.error&&o){p.push(fe);continue}var me=ar(fe),q=me.winningRev;N(q,me)}}function j(Y,Z,ce){ce&&(C(Z),p.length<c&&ce.continue())}function G(Y){var Z=Y.target.result;t.descending&&(Z=Z.reverse()),C(Z)}function H(){var Y={total_rows:h,offset:t.skip,rows:p};t.update_seq&&v!==void 0&&(Y.update_seq=v),r(null,Y)}function re(){t.attachments?Gs(p,t.binary).then(H):H()}if(!(f||c===0)){if(o)return lv(o,P,j);if(c===-1)return fv(P,m,G);rl(P,m,t.descending,c+a,j)}}function pv(t,e){var r=t.objectStore(Me).index("deletedOrLocal");r.count(IDBKeyRange.only("0")).onsuccess=function(n){e(n.target.result)}}var Fs=!1,Ks=[];function mv(t,e,r,n){try{t(e,r)}catch(i){n.emit("error",i)}}function hf(){Fs||!Ks.length||(Fs=!0,Ks.shift()())}function vv(t,e,r){Ks.push(function(){t(function(s,o){mv(e,s,o,r),Fs=!1,At(function(){hf(r)})})}),hf()}function yv(t,e,r,n){if(t=Ge(t),t.continuous){var i=r+":"+pi();return sn.addListener(r,i,e,t),sn.notify(r),{cancel:function(){sn.removeListener(r,i)}}}var s=t.doc_ids&&new Set(t.doc_ids);t.since=t.since||0;var o=t.since,a="limit"in t?t.limit:-1;a===0&&(a=1);var c=[],d=0,m=to(t),f=new Map,g,_,E,P;function S(C,j,G){if(!G||!C.length)return;var H=new Array(C.length),re=new Array(C.length);function Y(fe,me){var q=t.processChange(me,fe,t);o=q.seq=fe.seq;var k=m(q);return typeof k=="object"?Promise.reject(k):k?(d++,t.return_docs&&c.push(q),t.attachments&&t.include_docs?new Promise(function(L){el(me,t,g,function(){Gs([q],t.binary).then(function(){L(q)})})}):Promise.resolve(q)):Promise.resolve()}function Z(){for(var fe=[],me=0,q=H.length;me<q&&d!==a;me++){var k=H[me];if(k){var L=re[me];fe.push(Y(L,k))}}Promise.all(fe).then(function(B){for(var F=0,X=B.length;F<X;F++)B[F]&&t.onChange(B[F])}).catch(t.complete),d!==a&&G.continue()}var ce=0;j.forEach(function(fe,me){var q=ui(fe),k=C[me];w(q,k,function(L,B){re[me]=L,H[me]=B,++ce===C.length&&Z()})})}function y(C,j,G,H){if(G.seq!==j)return H();if(G.winningRev===C._rev)return H(G,C);var re=C._id+"::"+G.winningRev,Y=P.get(re);Y.onsuccess=function(Z){H(G,ui(Z.target.result))}}function w(C,j,G){if(s&&!s.has(C._id))return G();var H=f.get(C._id);if(H)return y(C,j,H,G);E.get(C._id).onsuccess=function(re){H=ar(re.target.result),f.set(C._id,H),y(C,j,H,G)}}function p(){t.complete(null,{results:c,last_seq:o})}function h(){!t.continuous&&t.attachments?Gs(c).then(p):p()}var v=[Me,ze];t.attachments&&v.push(lt);var b=_t(n,v,"readonly");if(b.error)return t.complete(b.error);g=b.txn,g.onabort=Pt(t.complete),g.oncomplete=h,_=g.objectStore(ze),E=g.objectStore(Me),P=_.index("_doc_id_rev");var N=t.since&&!t.descending?IDBKeyRange.lowerBound(t.since,!0):null;rl(_,N,t.descending,a,S)}var Tr=new Map,Es,$s=new Map;function nl(t,e){var r=this;vv(function(n){gv(r,t,n)},e,r.constructor)}function gv(t,e,r){var n=e.name,i=null,s=null;t._meta=null;function o(S){return function(y,w){y&&y instanceof Error&&!y.reason&&s&&(y.reason=s),S(y,w)}}function a(S){var y=S.createObjectStore(Me,{keyPath:"id"});S.createObjectStore(ze,{autoIncrement:!0}).createIndex("_doc_id_rev","_doc_id_rev",{unique:!0}),S.createObjectStore(lt,{keyPath:"digest"}),S.createObjectStore(et,{keyPath:"id",autoIncrement:!1}),S.createObjectStore(bs),y.createIndex("deletedOrLocal","deletedOrLocal",{unique:!1}),S.createObjectStore(St,{keyPath:"_id"});var w=S.createObjectStore(or,{autoIncrement:!0});w.createIndex("seq","seq"),w.createIndex("digestSeq","digestSeq",{unique:!0})}function c(S,y){var w=S.objectStore(Me);w.createIndex("deletedOrLocal","deletedOrLocal",{unique:!1}),w.openCursor().onsuccess=function(p){var h=p.target.result;if(h){var v=h.value,b=xt(v);v.deletedOrLocal=b?"1":"0",w.put(v),h.continue()}else y()}}function d(S){S.createObjectStore(St,{keyPath:"_id"}).createIndex("_doc_id_rev","_doc_id_rev",{unique:!0})}function m(S,y){var w=S.objectStore(St),p=S.objectStore(Me),h=S.objectStore(ze),v=p.openCursor();v.onsuccess=function(b){var N=b.target.result;if(N){var C=N.value,j=C.id,G=ur(j),H=cr(C);if(G){var re=j+"::"+H,Y=j+"::",Z=j+"::~",ce=h.index("_doc_id_rev"),fe=IDBKeyRange.bound(Y,Z,!1,!1),me=ce.openCursor(fe);me.onsuccess=function(q){if(me=q.target.result,!me)p.delete(N.primaryKey),N.continue();else{var k=me.value;k._doc_id_rev===re&&w.put(k),h.delete(me.primaryKey),me.continue()}}}else N.continue()}else y&&y()}}function f(S){var y=S.createObjectStore(or,{autoIncrement:!0});y.createIndex("seq","seq"),y.createIndex("digestSeq","digestSeq",{unique:!0})}function g(S,y){var w=S.objectStore(ze),p=S.objectStore(lt),h=S.objectStore(or),v=p.count();v.onsuccess=function(b){var N=b.target.result;if(!N)return y();w.openCursor().onsuccess=function(C){var j=C.target.result;if(!j)return y();for(var G=j.value,H=j.primaryKey,re=Object.keys(G._attachments||{}),Y={},Z=0;Z<re.length;Z++){var ce=G._attachments[re[Z]];Y[ce.digest]=!0}var fe=Object.keys(Y);for(Z=0;Z<fe.length;Z++){var me=fe[Z];h.put({seq:H,digestSeq:me+"::"+H})}j.continue()}}}function _(S){function y(v){return v.data?ar(v):(v.deleted=v.deletedOrLocal==="1",v)}var w=S.objectStore(ze),p=S.objectStore(Me),h=p.openCursor();h.onsuccess=function(v){var b=v.target.result;if(!b)return;var N=y(b.value);N.winningRev=N.winningRev||cr(N);function C(){var G=N.id+"::",H=N.id+"::\uFFFF",re=w.index("_doc_id_rev").openCursor(IDBKeyRange.bound(G,H)),Y=0;re.onsuccess=function(Z){var ce=Z.target.result;if(!ce)return N.seq=Y,j();var fe=ce.primaryKey;fe>Y&&(Y=fe),ce.continue()}}function j(){var G=Us(N,N.winningRev,N.deleted),H=p.put(G);H.onsuccess=function(){b.continue()}}if(N.seq)return j();C()}}t._remote=!1,t.type=function(){return"idb"},t._id=Rf(function(S){S(null,t._meta.instanceId)}),t._bulkDocs=function(y,w,p){cv(e,y,w,t,i,o(p))},t._get=function(y,w,p){var h,v,b,N=w.ctx;if(!N){var C=_t(i,[Me,ze,lt],"readonly");if(C.error)return p(C.error);N=C.txn}function j(){p(b,{doc:h,metadata:v,ctx:N})}N.objectStore(Me).get(y).onsuccess=function(G){if(v=ar(G.target.result),!v)return b=oe(ft,"missing"),j();var H;if(w.rev)H=w.latest?Xp(w.rev,v):w.rev;else{H=v.winningRev;var re=xt(v);if(re)return b=oe(ft,"deleted"),j()}var Y=N.objectStore(ze),Z=v.id+"::"+H;Y.index("_doc_id_rev").get(Z).onsuccess=function(ce){if(h=ce.target.result,h&&(h=ui(h)),!h)return b=oe(ft,"missing"),j();j()}}},t._getAttachment=function(S,y,w,p,h){var v;if(p.ctx)v=p.ctx;else{var b=_t(i,[Me,ze,lt],"readonly");if(b.error)return h(b.error);v=b.txn}var N=w.digest,C=w.content_type;v.objectStore(lt).get(N).onsuccess=function(j){var G=j.target.result.body;Zf(G,C,p.binary,function(H){h(null,H)})}},t._info=function(y){var w,p,h=_t(i,[et,ze],"readonly");if(h.error)return y(h.error);var v=h.txn;v.objectStore(et).get(et).onsuccess=function(b){p=b.target.result.docCount},v.objectStore(ze).openKeyCursor(null,"prev").onsuccess=function(b){var N=b.target.result;w=N?N.key:0},v.oncomplete=function(){y(null,{doc_count:p,update_seq:w,idb_attachment_format:t._meta.blobSupport?"binary":"base64"})}},t._allDocs=function(y,w){hv(y,i,o(w))},t._changes=function(y){return yv(y,t,n,i)},t._close=function(S){i.close(),Tr.delete(n),S()},t._getRevisionTree=function(S,y){var w=_t(i,[Me],"readonly");if(w.error)return y(w.error);var p=w.txn,h=p.objectStore(Me).get(S);h.onsuccess=function(v){var b=ar(v.target.result);b?y(null,b.rev_tree):y(oe(ft))}},t._doCompaction=function(S,y,w){var p=[Me,ze,lt,or],h=_t(i,p,"readwrite");if(h.error)return w(h.error);var v=h.txn,b=v.objectStore(Me);b.get(S).onsuccess=function(N){var C=ar(N.target.result);fr(C.rev_tree,function(H,re,Y,Z,ce){var fe=re+"-"+Y;y.indexOf(fe)!==-1&&(ce.status="missing")}),tl(y,S,v);var j=C.winningRev,G=C.deleted;v.objectStore(Me).put(Us(C,j,G))},v.onabort=Pt(w),v.oncomplete=function(){w()}},t._getLocal=function(S,y){var w=_t(i,[St],"readonly");if(w.error)return y(w.error);var p=w.txn,h=p.objectStore(St).get(S);h.onerror=Pt(y),h.onsuccess=function(v){var b=v.target.result;b?(delete b._doc_id_rev,y(null,b)):y(oe(ft))}},t._putLocal=function(S,y,w){typeof y=="function"&&(w=y,y={}),delete S._revisions;var p=S._rev,h=S._id;p?S._rev="0-"+(parseInt(p.split("-")[1],10)+1):S._rev="0-1";var v=y.ctx,b;if(!v){var N=_t(i,[St],"readwrite");if(N.error)return w(N.error);v=N.txn,v.onerror=Pt(w),v.oncomplete=function(){b&&w(null,b)}}var C=v.objectStore(St),j;p?(j=C.get(h),j.onsuccess=function(G){var H=G.target.result;if(!H||H._rev!==p)w(oe(Nr));else{var re=C.put(S);re.onsuccess=function(){b={ok:!0,id:S._id,rev:S._rev},y.ctx&&w(null,b)}}}):(j=C.add(S),j.onerror=function(G){w(oe(Nr)),G.preventDefault(),G.stopPropagation()},j.onsuccess=function(){b={ok:!0,id:S._id,rev:S._rev},y.ctx&&w(null,b)})},t._removeLocal=function(S,y,w){typeof y=="function"&&(w=y,y={});var p=y.ctx;if(!p){var h=_t(i,[St],"readwrite");if(h.error)return w(h.error);p=h.txn,p.oncomplete=function(){v&&w(null,v)}}var v,b=S._id,N=p.objectStore(St),C=N.get(b);C.onerror=Pt(w),C.onsuccess=function(j){var G=j.target.result;!G||G._rev!==S._rev?w(oe(ft)):(N.delete(b),v={ok:!0,id:b,rev:"0-0"},y.ctx&&w(null,v))}},t._destroy=function(S,y){sn.removeAllListeners(n);var w=$s.get(n);w&&w.result&&(w.result.close(),Tr.delete(n));var p=indexedDB.deleteDatabase(n);p.onsuccess=function(){$s.delete(n),ni()&&n in localStorage&&delete localStorage[n],y(null,{ok:!0})},p.onerror=Pt(y)};var E=Tr.get(n);if(E)return i=E.idb,t._meta=E.global,At(function(){r(null,t)});var P=indexedDB.open(n,ov);$s.set(n,P),P.onupgradeneeded=function(S){var y=S.target.result;if(S.oldVersion<1)return a(y);var w=S.currentTarget.transaction;S.oldVersion<3&&d(y),S.oldVersion<4&&f(y);var p=[c,m,g,_],h=S.oldVersion;function v(){var b=p[h-1];h++,b&&b(w,v)}v()},P.onsuccess=function(S){i=S.target.result,i.onversionchange=function(){i.close(),Tr.delete(n)},i.onabort=function(j){dt("error","Database has a global failure",j.target.error),s=j.target.error,i.close(),Tr.delete(n)};var y=i.transaction([et,bs,Me],"readwrite"),w=!1,p,h,v,b;function N(){typeof v>"u"||!w||(t._meta={name:n,instanceId:b,blobSupport:v},Tr.set(n,{idb:i,global:t._meta}),r(null,t))}function C(){if(!(typeof h>"u"||typeof p>"u")){var j=n+"_id";j in p?b=p[j]:p[j]=b=pi(),p.docCount=h,y.objectStore(et).put(p)}}y.objectStore(et).get(et).onsuccess=function(j){p=j.target.result||{id:et},C()},pv(y,function(j){h=j,C()}),Es||(Es=Hm(y,bs,"key")),Es.then(function(j){v=j,N()}),y.oncomplete=function(){w=!0,N()},y.onabort=Pt(r)},P.onerror=function(S){var y=S.target.error&&S.target.error.message;y?y.indexOf("stored database is a higher version")!==-1&&(y=new Error('This DB was created with the newer "indexeddb" adapter, but you are trying to open it with the older "idb" adapter')):y="Failed to open indexedDB, are you in private browsing mode?",dt("error",y),r(oe(eo,y))}}nl.valid=function(){try{return typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}};function _v(t){t.adapter("idb",nl,!0)}function wv(t,e){return new Promise(function(r,n){var i=0,s=0,o=0,a=t.length,c;function d(){i++,t[s++]().then(f,g)}function m(){++o===a?c?n(c):r():_()}function f(){i--,m()}function g(E){i--,c=c||E,m()}function _(){for(;i<e&&s<a;)d()}_()})}var bv=25,Ev=50,Xn=5e3,$v=1e4,Ss={};function Ps(t){let e=t.doc||t.ok,r=e&&e._attachments;r&&Object.keys(r).forEach(function(n){let i=r[n];i.data=oo(i.data,i.content_type)})}function ir(t){return/^_design/.test(t)?"_design/"+encodeURIComponent(t.slice(8)):t.startsWith("_local/")?"_local/"+encodeURIComponent(t.slice(7)):encodeURIComponent(t)}function pf(t){return!t._attachments||!Object.keys(t._attachments)?Promise.resolve():Promise.all(Object.keys(t._attachments).map(function(e){let r=t._attachments[e];if(r.data&&typeof r.data!="string")return new Promise(function(n){ao(r.data,n)}).then(function(n){r.data=n})}))}function Sv(t){if(!t.prefix)return!1;let e=xf(t.prefix).protocol;return e==="http"||e==="https"}function Pv(t,e){if(Sv(e)){let i=e.name.substr(e.prefix.length);t=e.prefix.replace(/\/?$/,"/")+encodeURIComponent(i)}let r=xf(t);(r.user||r.password)&&(r.auth={username:r.user,password:r.password});let n=r.path.replace(/(^\/|\/$)/g,"").split("/");return r.db=n.pop(),r.db.indexOf("%")===-1&&(r.db=encodeURIComponent(r.db)),r.path=n.join("/"),r}function Ue(t,e){return ti(t,t.db+"/"+e)}function ti(t,e){let r=t.path?"/":"";return t.protocol+"://"+t.host+(t.port?":"+t.port:"")+"/"+t.path+r+e}function Zn(t){let e=Object.keys(t);return e.length===0?"":"?"+e.map(r=>r+"="+encodeURIComponent(t[r])).join("&")}function Ov(t){let e=typeof navigator<"u"&&navigator.userAgent?navigator.userAgent.toLowerCase():"",r=e.indexOf("msie")!==-1,n=e.indexOf("trident")!==-1,i=e.indexOf("edge")!==-1,s=!("method"in t)||t.method==="GET";return(r||n||i)&&s}function zs(t,e){let r=this,n=Pv(t.name,t),i=Ue(n,"");t=Ge(t);let s=async function(f,g){if(g=g||{},g.headers=g.headers||new Rr,g.credentials="include",t.auth||n.auth){let P=t.auth||n.auth,S=P.username+":"+P.password,y=cn(unescape(encodeURIComponent(S)));g.headers.set("Authorization","Basic "+y)}let _=t.headers||{};return Object.keys(_).forEach(function(P){g.headers.append(P,_[P])}),Ov(g)&&(f+=(f.indexOf("?")===-1?"?":"&")+"_nonce="+Date.now()),await(t.fetch||zf)(f,g)};function o(f,g){return De(f,function(..._){d().then(function(){return g.apply(this,_)}).catch(function(E){_.pop()(E)})}).bind(r)}async function a(f,g){let _={};g=g||{},g.headers=g.headers||new Rr,g.headers.get("Content-Type")||g.headers.set("Content-Type","application/json"),g.headers.get("Accept")||g.headers.set("Accept","application/json");let E=await s(f,g);_.ok=E.ok,_.status=E.status;let P=await E.json();if(_.data=P,!_.ok)throw _.data.status=_.status,kr(_.data);return Array.isArray(_.data)&&(_.data=_.data.map(function(S){return S.error||S.missing?kr(S):S})),_}let c;async function d(){return t.skip_setup?Promise.resolve():c||(c=a(i).catch(function(f){return f&&f.status&&f.status===404?(Ns(404,"PouchDB is just detecting if the remote exists."),a(i,{method:"PUT"})):Promise.reject(f)}).catch(function(f){return f&&f.status&&f.status===412?!0:Promise.reject(f)}),c.catch(function(){c=null}),c)}At(function(){e(null,r)}),r._remote=!0,r.type=function(){return"http"},r.id=o("id",async function(f){let g;try{g=await(await s(ti(n,""))).json()}catch{g={}}let _=g&&g.uuid?g.uuid+n.db:Ue(n,"");f(null,_)}),r.compact=o("compact",async function(f,g){typeof f=="function"&&(g=f,f={}),f=Ge(f),await a(Ue(n,"_compact"),{method:"POST"});function _(){r.info(function(E,P){P&&!P.compact_running?g(null,{ok:!0}):setTimeout(_,f.interval||200)})}_()}),r.bulkGet=De("bulkGet",function(f,g){let _=this;async function E(w){let p={};f.revs&&(p.revs=!0),f.attachments&&(p.attachments=!0),f.latest&&(p.latest=!0);try{let h=await a(Ue(n,"_bulk_get"+Zn(p)),{method:"POST",body:JSON.stringify({docs:f.docs})});f.attachments&&f.binary&&h.data.results.forEach(function(v){v.docs.forEach(Ps)}),w(null,h.data)}catch(h){w(h)}}function P(){let w=Ev,p=Math.ceil(f.docs.length/w),h=0,v=new Array(p);function b(N){return function(C,j){v[N]=j.results,++h===p&&g(null,{results:v.flat()})}}for(let N=0;N<p;N++){let C=un(f,["revs","attachments","binary","latest"]);C.docs=f.docs.slice(N*w,Math.min(f.docs.length,(N+1)*w)),qf(_,C,b(N))}}let S=ti(n,""),y=Ss[S];typeof y!="boolean"?E(function(w,p){w?(Ss[S]=!1,Ns(w.status,"PouchDB is just detecting if the remote supports the _bulk_get API."),P()):(Ss[S]=!0,g(null,p))}):y?E(g):P()}),r._info=async function(f){try{await d();let _=await(await s(Ue(n,""))).json();_.host=Ue(n,""),f(null,_)}catch(g){f(g)}},r.fetch=async function(f,g){await d();let _=f.substring(0,1)==="/"?ti(n,f.substring(1)):Ue(n,f);return s(_,g)},r.get=o("get",async function(f,g,_){typeof g=="function"&&(_=g,g={}),g=Ge(g);let E={};g.revs&&(E.revs=!0),g.revs_info&&(E.revs_info=!0),g.latest&&(E.latest=!0),g.open_revs&&(g.open_revs!=="all"&&(g.open_revs=JSON.stringify(g.open_revs)),E.open_revs=g.open_revs),g.rev&&(E.rev=g.rev),g.conflicts&&(E.conflicts=g.conflicts),g.update_seq&&(E.update_seq=g.update_seq),f=ir(f);function P(w){let p=w._attachments,h=p&&Object.keys(p);if(!p||!h.length)return;async function v(N){let C=p[N],j=ir(w._id)+"/"+m(N)+"?rev="+w._rev,G=await s(Ue(n,j)),H;"buffer"in G?H=await G.buffer():H=await G.blob();let re;if(g.binary){let Y=Object.getOwnPropertyDescriptor(H.__proto__,"type");(!Y||Y.set)&&(H.type=C.content_type),re=H}else re=await new Promise(function(Y){ao(H,Y)});delete C.stub,delete C.length,C.data=re}let b=h.map(function(N){return function(){return v(N)}});return wv(b,5)}function S(w){return Array.isArray(w)?Promise.all(w.map(function(p){if(p.ok)return P(p.ok)})):P(w)}let y=Ue(n,f+Zn(E));try{let w=await a(y);g.attachments&&await S(w.data),_(null,w.data)}catch(w){w.docId=f,_(w)}}),r.remove=o("remove",async function(f,g,_,E){let P;typeof g=="string"?(P={_id:f,_rev:g},typeof _=="function"&&(E=_,_={})):(P=f,typeof g=="function"?(E=g,_={}):(E=_,_=g));let S=P._rev||_.rev,y=Ue(n,ir(P._id))+"?rev="+S;try{let w=await a(y,{method:"DELETE"});E(null,w.data)}catch(w){E(w)}});function m(f){return f.split("/").map(encodeURIComponent).join("/")}r.getAttachment=o("getAttachment",async function(f,g,_,E){typeof _=="function"&&(E=_,_={});let P=_.rev?"?rev="+_.rev:"",S=Ue(n,ir(f))+"/"+m(g)+P,y;try{let w=await s(S,{method:"GET"});if(!w.ok)throw w;y=w.headers.get("content-type");let p;if(typeof K<"u"&&!K.browser&&typeof w.buffer=="function"?p=await w.buffer():p=await w.blob(),typeof K<"u"&&!K.browser){let h=Object.getOwnPropertyDescriptor(p.__proto__,"type");(!h||h.set)&&(p.type=y)}E(null,p)}catch(w){E(w)}}),r.removeAttachment=o("removeAttachment",async function(f,g,_,E){let P=Ue(n,ir(f)+"/"+m(g))+"?rev="+_;try{let S=await a(P,{method:"DELETE"});E(null,S.data)}catch(S){E(S)}}),r.putAttachment=o("putAttachment",async function(f,g,_,E,P,S){typeof P=="function"&&(S=P,P=E,E=_,_=null);let y=ir(f)+"/"+m(g),w=Ue(n,y);if(_&&(w+="?rev="+_),typeof E=="string"){let p;try{p=no(E)}catch{return S(oe(kf,"Attachment is not a valid base64 string"))}E=p?so(p,P):""}try{let p=await a(w,{headers:new Rr({"Content-Type":P}),method:"PUT",body:E});S(null,p.data)}catch(p){S(p)}}),r._bulkDocs=async function(f,g,_){f.new_edits=g.new_edits;try{await d(),await Promise.all(f.docs.map(pf));let E=await a(Ue(n,"_bulk_docs"),{method:"POST",body:JSON.stringify(f)});_(null,E.data)}catch(E){_(E)}},r._put=async function(f,g,_){try{await d(),await pf(f);let E=await a(Ue(n,ir(f._id)),{method:"PUT",body:JSON.stringify(f)});_(null,E.data)}catch(E){E.docId=f&&f._id,_(E)}},r.allDocs=o("allDocs",async function(f,g){typeof f=="function"&&(g=f,f={}),f=Ge(f);let _={},E,P="GET";f.conflicts&&(_.conflicts=!0),f.update_seq&&(_.update_seq=!0),f.descending&&(_.descending=!0),f.include_docs&&(_.include_docs=!0),f.attachments&&(_.attachments=!0),f.key&&(_.key=JSON.stringify(f.key)),f.start_key&&(f.startkey=f.start_key),f.startkey&&(_.startkey=JSON.stringify(f.startkey)),f.end_key&&(f.endkey=f.end_key),f.endkey&&(_.endkey=JSON.stringify(f.endkey)),typeof f.inclusive_end<"u"&&(_.inclusive_end=!!f.inclusive_end),typeof f.limit<"u"&&(_.limit=f.limit),typeof f.skip<"u"&&(_.skip=f.skip);let S=Zn(_);typeof f.keys<"u"&&(P="POST",E={keys:f.keys});try{let y=await a(Ue(n,"_all_docs"+S),{method:P,body:JSON.stringify(E)});f.include_docs&&f.attachments&&f.binary&&y.data.rows.forEach(Ps),g(null,y.data)}catch(y){g(y)}}),r._changes=function(f){let g="batch_size"in f?f.batch_size:bv;f=Ge(f),f.continuous&&!("heartbeat"in f)&&(f.heartbeat=$v);let _="timeout"in f?f.timeout:30*1e3;"timeout"in f&&f.timeout&&_-f.timeout<Xn&&(_=f.timeout+Xn),"heartbeat"in f&&f.heartbeat&&_-f.heartbeat<Xn&&(_=f.heartbeat+Xn);let E={};"timeout"in f&&f.timeout&&(E.timeout=f.timeout);let P=typeof f.limit<"u"?f.limit:!1,S=P;if(f.style&&(E.style=f.style),(f.include_docs||f.filter&&typeof f.filter=="function")&&(E.include_docs=!0),f.attachments&&(E.attachments=!0),f.continuous&&(E.feed="longpoll"),f.seq_interval&&(E.seq_interval=f.seq_interval),f.conflicts&&(E.conflicts=!0),f.descending&&(E.descending=!0),f.update_seq&&(E.update_seq=!0),"heartbeat"in f&&f.heartbeat&&(E.heartbeat=f.heartbeat),f.filter&&typeof f.filter=="string"&&(E.filter=f.filter),f.view&&typeof f.view=="string"&&(E.filter="_view",E.view=f.view),f.query_params&&typeof f.query_params=="object")for(let C in f.query_params)Object.prototype.hasOwnProperty.call(f.query_params,C)&&(E[C]=f.query_params[C]);let y="GET",w;f.doc_ids?(E.filter="_doc_ids",y="POST",w={doc_ids:f.doc_ids}):f.selector&&(E.filter="_selector",y="POST",w={selector:f.selector});let p=new AbortController,h,v=async function(C,j){if(f.aborted)return;E.since=C,typeof E.since=="object"&&(E.since=JSON.stringify(E.since)),f.descending?P&&(E.limit=S):E.limit=!P||S>g?g:S;let G=Ue(n,"_changes"+Zn(E)),H={signal:p.signal,method:y,body:JSON.stringify(w)};if(h=C,!f.aborted)try{await d();let re=await a(G,H);j(null,re.data)}catch(re){j(re)}},b={results:[]},N=function(C,j){if(f.aborted)return;let G=0;if(j&&j.results){G=j.results.length,b.last_seq=j.last_seq;let re=null,Y=null;typeof j.pending=="number"&&(re=j.pending),(typeof b.last_seq=="string"||typeof b.last_seq=="number")&&(Y=b.last_seq);let Z={};Z.query=f.query_params,j.results=j.results.filter(function(ce){S--;let fe=to(f)(ce);return fe&&(f.include_docs&&f.attachments&&f.binary&&Ps(ce),f.return_docs&&b.results.push(ce),f.onChange(ce,re,Y)),fe})}else if(C){f.aborted=!0,f.complete(C);return}j&&j.last_seq&&(h=j.last_seq);let H=P&&S<=0||j&&G<g||f.descending;f.continuous&&!(P&&S<=0)||!H?At(function(){v(h,N)}):f.complete(null,b)};return v(f.since||0,N),{cancel:function(){f.aborted=!0,p.abort()}}},r.revsDiff=o("revsDiff",async function(f,g,_){typeof g=="function"&&(_=g,g={});try{let E=await a(Ue(n,"_revs_diff"),{method:"POST",body:JSON.stringify(f)});_(null,E.data)}catch(E){_(E)}}),r._close=function(f){f()},r._destroy=async function(f,g){try{let _=await a(Ue(n,""),{method:"DELETE"});g(null,_)}catch(_){_.status===404?g(null,{ok:!0}):g(_)}}}zs.valid=function(){return!0};function Av(t){t.adapter("http",zs,!1),t.adapter("https",zs,!1)}var sr=class t extends Error{constructor(e){super(),this.status=400,this.name="query_parse_error",this.message=e,this.error=!0;try{Error.captureStackTrace(this,t)}catch{}}},ci=class t extends Error{constructor(e){super(),this.status=404,this.name="not_found",this.message=e,this.error=!0;try{Error.captureStackTrace(this,t)}catch{}}},fi=class t extends Error{constructor(e){super(),this.status=500,this.name="invalid_value",this.message=e,this.error=!0;try{Error.captureStackTrace(this,t)}catch{}}};function il(t,e){return e&&t.then(function(r){At(function(){e(null,r)})},function(r){At(function(){e(r)})}),t}function Iv(t){return function(...e){var r=e.pop(),n=t.apply(this,e);return typeof r=="function"&&il(n,r),n}}function Tv(t,e){return t.then(function(r){return e().then(function(){return r})},function(r){return e().then(function(){throw r})})}function Os(t,e){return function(){var r=arguments,n=this;return t.add(function(){return e.apply(n,r)})}}function mf(t){var e=new Set(t),r=new Array(e.size),n=-1;return e.forEach(function(i){r[++n]=i}),r}function As(t){var e=new Array(t.size),r=-1;return t.forEach(function(n,i){e[++r]=i}),e}function vf(t){var e="builtin "+t+" function requires map values to be numbers or number arrays";return new fi(e)}function Vs(t){for(var e=0,r=0,n=t.length;r<n;r++){var i=t[r];if(typeof i!="number")if(Array.isArray(i)){e=typeof e=="number"?[e]:e;for(var s=0,o=i.length;s<o;s++){var a=i[s];if(typeof a!="number")throw vf("_sum");typeof e[s]>"u"?e.push(a):e[s]+=a}}else throw vf("_sum");else typeof e=="number"?e+=i:e[0]+=i}return e}var Rv=dt.bind(null,"log"),qv=Array.isArray,Nv=JSON.parse;function sl(t,e){return ro("return ("+t.replace(/;\s*$/,"")+");",{emit:e,sum:Vs,log:Rv,isArray:qv,toJSON:Nv})}var an=class{constructor(){this.promise=Promise.resolve()}add(e){return this.promise=this.promise.catch(()=>{}).then(()=>e()),this.promise}finish(){return this.promise}};function yf(t){if(!t)return"undefined";switch(typeof t){case"function":return t.toString();case"string":return t.toString();default:return JSON.stringify(t)}}function kv(t,e){return yf(t)+yf(e)+"undefined"}async function gf(t,e,r,n,i,s){let o=kv(r,n),a;if(!i&&(a=t._cachedViews=t._cachedViews||{},a[o]))return a[o];let c=t.info().then(async function(d){let m=d.db_name+"-mrview-"+(i?"temp":Bf(o));function f(S){S.views=S.views||{};let y=e;y.indexOf("/")===-1&&(y=e+"/"+e);let w=S.views[y]=S.views[y]||{};if(!w[m])return w[m]=!0,S}await ii(t,"_local/"+s,f);let _=(await t.registerDependentDatabase(m)).db;_.auto_compaction=!0;let E={name:m,db:_,sourceDB:t,adapter:t.adapter,mapFun:r,reduceFun:n},P;try{P=await E.db.get("_local/lastSeq")}catch(S){if(S.status!==404)throw S}return E.seq=P?P.seq:0,a&&E.db.once("destroyed",function(){delete a[o]}),E});return a&&(a[o]=c),c}var _f={},wf=new an,Cv=50;function Is(t){return t.indexOf("/")===-1?[t,t]:t.split("/")}function xv(t){return t.length===1&&/^1-/.test(t[0].rev)}function bf(t,e,r){try{t.emit("error",e)}catch{dt("error",`The user's map/reduce function threw an uncaught error.
|
|
14
14
|
You can debug this error by doing:
|
|
15
15
|
myDatabase.on('error', function (err) { debugger; });
|
|
16
|
-
Please double-check your map/reduce function.`),vt("error",e,r)}}function s1(t,e,r,n){function i(q,k,L){try{k(L)}catch(B){Zd(q,B,{fun:k,doc:L})}}function s(q,k,L,B,F){try{return{output:k(L,B,F)}}catch(X){return Zd(q,X,{fun:k,keys:L,values:B,rereduce:F}),{error:X}}}function o(q,k){let L=Be(q.key,k.key);return L!==0?L:Be(q.value,k.value)}function a(q,k,L){return L=L||0,typeof k=="number"?q.slice(L,k+L):L>0?q.slice(L):q}function c(q){let k=q.value;return k&&typeof k=="object"&&k._id||q.id}function d(q){for(let k of q.rows){let L=k.doc&&k.doc._attachments;if(L)for(let B of Object.keys(L)){let F=L[B];L[B].data=za(F.data,F.content_type)}}}function m(q){return function(k){return q.include_docs&&q.attachments&&q.binary&&d(k),k}}function f(q,k,L,B){let F=k[q];typeof F<"u"&&(B&&(F=encodeURIComponent(JSON.stringify(F))),L.push(q+"="+F))}function g(q){if(typeof q<"u"){let k=Number(q);return!isNaN(k)&&k===parseInt(q,10)?k:q}}function _(q){return q.group_level=g(q.group_level),q.limit=g(q.limit),q.skip=g(q.skip),q}function b(q){if(q){if(typeof q!="number")return new mr(`Invalid value for integer: "${q}"`);if(q<0)return new mr(`Invalid value for positive integer: "${q}"`)}}function P(q,k){let L=q.descending?"endkey":"startkey",B=q.descending?"startkey":"endkey";if(typeof q[L]<"u"&&typeof q[B]<"u"&&Be(q[L],q[B])>0)throw new mr("No rows can match your key range, reverse your start_key and end_key or set {descending : true}");if(k.reduce&&q.reduce!==!1){if(q.include_docs)throw new mr("{include_docs:true} is invalid for reduce");if(q.keys&&q.keys.length>1&&!q.group&&!q.group_level)throw new mr("Multi-key fetches for reduce views must use {group: true}")}for(let F of["group_level","limit","skip"]){let X=b(q[F]);if(X)throw X}}async function S(q,k,L){let B=[],F,X="GET",ie;if(f("reduce",L,B),f("include_docs",L,B),f("attachments",L,B),f("limit",L,B),f("descending",L,B),f("group",L,B),f("group_level",L,B),f("skip",L,B),f("stale",L,B),f("conflicts",L,B),f("startkey",L,B,!0),f("start_key",L,B,!0),f("endkey",L,B,!0),f("end_key",L,B,!0),f("inclusive_end",L,B),f("key",L,B,!0),f("update_seq",L,B),B=B.join("&"),B=B===""?"":"?"+B,typeof L.keys<"u"){let W=`keys=${encodeURIComponent(JSON.stringify(L.keys))}`;W.length+B.length+1<=2e3?B+=(B[0]==="?"?"&":"?")+W:(X="POST",typeof k=="string"?F={keys:L.keys}:k.keys=L.keys)}if(typeof k=="string"){let M=ha(k),W=await q.fetch("_design/"+M[0]+"/_view/"+M[1]+B,{headers:new Gr({"Content-Type":"application/json"}),method:X,body:JSON.stringify(F)});ie=W.ok;let ee=await W.json();if(!ie)throw ee.status=W.status,zr(ee);for(let ne of ee.rows)if(ne.value&&ne.value.error&&ne.value.error==="builtin_reduce_error")throw new Error(ne.reason);return new Promise(function(ne){ne(ee)}).then(m(L))}F=F||{};for(let M of Object.keys(k))Array.isArray(k[M])?F[M]=k[M]:F[M]=k[M].toString();let J=await q.fetch("_temp_view"+B,{headers:new Gr({"Content-Type":"application/json"}),method:"POST",body:JSON.stringify(F)});ie=J.ok;let D=await J.json();if(!ie)throw D.status=J.status,zr(D);return new Promise(function(M){M(D)}).then(m(L))}function y(q,k,L){return new Promise(function(B,F){q._query(k,L,function(X,ie){if(X)return F(X);B(ie)})})}function w(q){return new Promise(function(k,L){q._viewCleanup(function(B,F){if(B)return L(B);k(F)})})}function p(q){return function(k){if(k.status===404)return q;throw k}}async function h(q,k,L){let B="_local/doc_"+q,F={_id:B,keys:[]},X=L.get(q),ie=X[0],J=X[1];function D(){return i1(J)?Promise.resolve(F):k.db.get(B).catch(p(F))}function M(Ee){return Ee.keys.length?k.db.allDocs({keys:Ee.keys,include_docs:!0}):Promise.resolve({rows:[]})}function W(Ee,$e){let Re=[],We=new Set;for(let ve of $e.rows){let ge=ve.doc;if(ge&&(Re.push(ge),We.add(ge._id),ge._deleted=!ie.has(ge._id),!ge._deleted)){let Se=ie.get(ge._id);"value"in Se&&(ge.value=Se.value)}}let ct=da(ie);for(let ve of ct)if(!We.has(ve)){let ge={_id:ve},Se=ie.get(ve);"value"in Se&&(ge.value=Se.value),Re.push(ge)}return Ee.keys=Jd(ct.concat(Ee.keys)),Re.push(Ee),Re}let ee=await D(),ne=await M(ee);return W(ee,ne)}function v(q){return q.sourceDB.get("_local/purges").then(function(k){let L=k.purgeSeq;return q.db.get("_local/purgeSeq").then(function(B){return B._rev}).catch(p(void 0)).then(function(B){return q.db.put({_id:"_local/purgeSeq",_rev:B,purgeSeq:L})})}).catch(function(k){if(k.status!==404)throw k})}function E(q,k,L){var B="_local/lastSeq";return q.db.get(B).catch(p({_id:B,seq:0})).then(function(F){var X=da(k);return Promise.all(X.map(function(ie){return h(ie,q,k)})).then(function(ie){var J=ie.flat();return F.seq=L,J.push(F),q.db.bulkDocs({docs:J})}).then(()=>v(q))})}function C(q){let k=typeof q=="string"?q:q.name,L=Yd[k];return L||(L=Yd[k]=new Cn),L}async function x(q,k){return la(C(q),function(){return j(q,k)})()}async function j(q,k){let L,B,F;function X(ve,ge){let Se={id:B._id,key:br(ve)};typeof ge<"u"&&ge!==null&&(Se.value=br(ge)),L.push(Se)}let ie=e(q.mapFun,X),J=q.seq||0;function D(){return q.sourceDB.info().then(function(ve){F=q.sourceDB.activeTasks.add({name:"view_indexing",total_items:ve.update_seq-J})})}function M(ve,ge){return function(){return E(q,ve,ge)}}let W=0,ee={view:q.name,indexed_docs:W};q.sourceDB.emit("indexing",ee);let ne=new Cn;async function Ee(){let ve=await q.sourceDB.changes({return_docs:!0,conflicts:!0,include_docs:!0,style:"all_docs",since:J,limit:k.changes_batch_size}),ge=await $e();return Re(ve,ge)}function $e(){return q.db.get("_local/purgeSeq").then(function(ve){return ve.purgeSeq}).catch(p(-1)).then(function(ve){return q.sourceDB.get("_local/purges").then(function(ge){let Se=ge.purges.filter(function(Fe,Pe){return Pe>ve}).map(Fe=>Fe.docId),nt=Se.filter(function(Fe,Pe){return Se.indexOf(Fe)===Pe});return Promise.all(nt.map(function(Fe){return q.sourceDB.get(Fe).then(function(Pe){return{docId:Fe,doc:Pe}}).catch(p({docId:Fe}))}))}).catch(p([]))})}function Re(ve,ge){let Se=ve.results;if(!Se.length&&!ge.length)return;for(let Pe of ge)if(Se.findIndex(function(Zt){return Zt.id===Pe.docId})<0){let Zt={_id:Pe.docId,doc:{_id:Pe.docId,_deleted:1},changes:[]};Pe.doc&&(Zt.doc=Pe.doc,Zt.changes.push({rev:Pe.doc._rev})),Se.push(Zt)}let nt=We(Se);ne.add(M(nt,J)),W=W+Se.length;let Fe={view:q.name,last_seq:ve.last_seq,results_count:Se.length,indexed_docs:W};if(q.sourceDB.emit("indexing",Fe),q.sourceDB.activeTasks.update(F,{completed_items:W}),!(Se.length<k.changes_batch_size))return Ee()}function We(ve){let ge=new Map;for(let Se of ve){if(Se.doc._id[0]!=="_"){L=[],B=Se.doc,B._deleted||i(q.sourceDB,ie,B),L.sort(o);let nt=ct(L);ge.set(Se.doc._id,[nt,Se.changes])}J=Se.seq}return ge}function ct(ve){let ge=new Map,Se;for(let nt=0,Fe=ve.length;nt<Fe;nt++){let Pe=ve[nt],Xt=[Pe.key,Pe.id];nt>0&&Be(Pe.key,Se)===0&&Xt.push(nt),ge.set(Et(Xt),Pe),Se=Pe.key}return ge}try{await D(),await Ee(),await ne.finish(),q.seq=J,q.sourceDB.activeTasks.remove(F)}catch(ve){q.sourceDB.activeTasks.remove(F,ve)}}function G(q,k,L){L.group_level===0&&delete L.group_level;let B=L.group||L.group_level,F=r(q.reduceFun),X=[],ie=isNaN(L.group_level)?Number.POSITIVE_INFINITY:L.group_level;for(let J of k){let D=X[X.length-1],M=B?J.key:null;if(B&&Array.isArray(M)&&(M=M.slice(0,ie)),D&&Be(D.groupKey,M)===0){D.keys.push([J.key,J.id]),D.values.push(J.value);continue}X.push({keys:[[J.key,J.id]],values:[J.value],groupKey:M})}k=[];for(let J of X){let D=s(q.sourceDB,F,J.keys,J.values,!1);if(D.error&&D.error instanceof Gi)throw D.error;k.push({value:D.error?null:D.output,key:J.groupKey})}return{rows:a(k,L.limit,L.skip)}}function H(q,k){return la(C(q),function(){return re(q,k)})()}async function re(q,k){let L,B=q.reduceFun&&k.reduce!==!1,F=k.skip||0;typeof k.keys<"u"&&!k.keys.length&&(k.limit=0,delete k.keys);async function X(J){J.include_docs=!0;let D=await q.db.allDocs(J);return L=D.total_rows,D.rows.map(function(M){if("value"in M.doc&&typeof M.doc.value=="object"&&M.doc.value!==null){let ee=Object.keys(M.doc.value).sort(),ne=["id","key","value"];if(!(ee<ne||ee>ne))return M.doc.value}let W=Q0(M.doc._id);return{key:W[0],id:W[1],value:"value"in M.doc?M.doc.value:null}})}async function ie(J){let D;if(B?D=G(q,J,k):typeof k.keys>"u"?D={total_rows:L,offset:F,rows:J}:D={total_rows:L,offset:F,rows:a(J,k.limit,k.skip)},k.update_seq&&(D.update_seq=q.seq),k.include_docs){let M=Jd(J.map(c)),W=await q.sourceDB.allDocs({keys:M,include_docs:!0,conflicts:k.conflicts,attachments:k.attachments,binary:k.binary}),ee=new Map;for(let ne of W.rows)ee.set(ne.id,ne.doc);for(let ne of J){let Ee=c(ne),$e=ee.get(Ee);$e&&(ne.doc=$e)}}return D}if(typeof k.keys<"u"){let D=k.keys.map(function(ee){let ne={startkey:Et([ee]),endkey:Et([ee,{}])};return k.update_seq&&(ne.update_seq=!0),X(ne)}),W=(await Promise.all(D)).flat();return ie(W)}else{let J={descending:k.descending};k.update_seq&&(J.update_seq=!0);let D,M;if("start_key"in k&&(D=k.start_key),"startkey"in k&&(D=k.startkey),"end_key"in k&&(M=k.end_key),"endkey"in k&&(M=k.endkey),typeof D<"u"&&(J.startkey=k.descending?Et([D,{}]):Et([D])),typeof M<"u"){let ee=k.inclusive_end!==!1;k.descending&&(ee=!ee),J.endkey=Et(ee?[M,{}]:[M])}if(typeof k.key<"u"){let ee=Et([k.key]),ne=Et([k.key,{}]);J.descending?(J.endkey=ee,J.startkey=ne):(J.startkey=ee,J.endkey=ne)}B||(typeof k.limit=="number"&&(J.limit=k.limit),J.skip=F);let W=await X(J);return ie(W)}}async function Q(q){return(await q.fetch("_view_cleanup",{headers:new Gr({"Content-Type":"application/json"}),method:"POST"})).json()}async function Z(q){try{let k=await q.get("_local/"+t),L=new Map;for(let D of Object.keys(k.views)){let M=ha(D),W="_design/"+M[0],ee=M[1],ne=L.get(W);ne||(ne=new Set,L.set(W,ne)),ne.add(ee)}let B={keys:da(L),include_docs:!0},F=await q.allDocs(B),X={};for(let D of F.rows){let M=D.key.substring(8);for(let W of L.get(D.key)){let ee=M+"/"+W;k.views[ee]||(ee=W);let ne=Object.keys(k.views[ee]),Ee=D.doc&&D.doc.views&&D.doc.views[W];for(let $e of ne)X[$e]=X[$e]||Ee}}let J=Object.keys(X).filter(function(D){return!X[D]}).map(function(D){return la(C(D),function(){return new q.constructor(D,q.__opts).destroy()})()});return Promise.all(J).then(function(){return{ok:!0}})}catch(k){if(k.status===404)return{ok:!0};throw k}}async function ce(q,k,L){if(typeof q._query=="function")return y(q,k,L);if(Rt(q))return S(q,k,L);let B={changes_batch_size:q.__opts.view_update_changes_batch_size||n1};if(typeof k!="string")return P(L,k),Xd.add(async function(){let F=await Qd(q,"temp_view/temp_view",k.map,k.reduce,!0,t);return Xw(x(F,B).then(function(){return H(F,L)}),function(){return F.db.destroy()})}),Xd.finish();{let F=k,X=ha(F),ie=X[0],J=X[1],D=await q.get("_design/"+ie);if(k=D.views&&D.views[J],!k)throw new Ui(`ddoc ${D._id} has no view named ${J}`);n(D,J),P(L,k);let M=await Qd(q,F,k.map,k.reduce,!1,t);return L.stale==="ok"||L.stale==="update_after"?(L.stale==="update_after"&&qt(function(){x(M,B)}),H(M,L)):(await x(M,B),H(M,L))}}function fe(q,k,L){let B=this;typeof k=="function"&&(L=k,k={}),k=k?_(k):{},typeof q=="function"&&(q={map:q});let F=Promise.resolve().then(function(){return ce(B,q,k)});return jh(F,L),F}let me=Yw(function(){let q=this;return typeof q._viewCleanup=="function"?w(q):Rt(q)?Q(q):Z(q)});return{query:fe,viewCleanup:me}}var pa={_sum:function(t,e){return qa(e)},_count:function(t,e){return e.length},_stats:function(t,e){function r(n){for(var i=0,s=0,o=n.length;s<o;s++){var a=n[s];i+=a*a}return i}return{sum:qa(e),min:Math.min.apply(null,e),max:Math.max.apply(null,e),count:e.length,sumsqr:r(e)}}};function o1(t){if(/^_sum/.test(t))return pa._sum;if(/^_count/.test(t))return pa._count;if(/^_stats/.test(t))return pa._stats;if(/^_/.test(t))throw new Error(t+" is not a supported reduce function.")}function a1(t,e){if(typeof t=="function"&&t.length===2){var r=t;return function(n){return r(n,e)}}else return Dh(t.toString(),e)}function u1(t){var e=t.toString(),r=o1(e);return r||Dh(e)}function c1(t,e){var r=t.views&&t.views[e];if(typeof r.map!="string")throw new Ui("ddoc "+t._id+" has no string view named "+e+", instead found object of type: "+typeof r.map)}var f1="mrviews",Bh=s1(f1,a1,u1,c1);function l1(t,e,r){return Bh.query.call(this,t,e,r)}function d1(t){return Bh.viewCleanup.call(this,t)}var h1={query:l1,viewCleanup:d1};function p1(t,e,r){return!t._attachments||!t._attachments[r]||t._attachments[r].digest!==e._attachments[r].digest}function eh(t,e){var r=Object.keys(e._attachments);return Promise.all(r.map(function(n){return t.getAttachment(e._id,n,{rev:e._rev})}))}function m1(t,e,r){var n=Rt(e)&&!Rt(t),i=Object.keys(r._attachments);return n?t.get(r._id).then(function(s){return Promise.all(i.map(function(o){return p1(s,r,o)?e.getAttachment(r._id,o):t.getAttachment(s._id,o)}))}).catch(function(s){if(s.status!==404)throw s;return eh(e,r)}):eh(e,r)}function v1(t){var e=[];return Object.keys(t).forEach(function(r){var n=t[r].missing;n.forEach(function(i){e.push({id:r,rev:i})})}),{docs:e,revs:!0,latest:!0}}function y1(t,e,r,n){r=Ge(r);var i=[],s=!0;function o(){var c=v1(r);if(c.docs.length)return t.bulkGet(c).then(function(d){if(n.cancelled)throw new Error("cancelled");return Promise.all(d.results.map(function(m){return Promise.all(m.docs.map(function(f){var g=f.ok;return f.error&&(s=!1),!g||!g._attachments?g:m1(e,t,g).then(_=>{var b=Object.keys(g._attachments);return _.forEach(function(P,S){var y=g._attachments[b[S]];delete y.stub,delete y.length,y.data=P}),g})}))})).then(function(m){i=i.concat(m.flat().filter(Boolean))})})}function a(){return{ok:s,docs:i}}return Promise.resolve().then(o).then(a)}var th=1,rh="pouchdb",g1=5,bt=0;function Ca(t,e,r,n,i){return t.get(e).catch(function(s){if(s.status===404)return(t.adapter==="http"||t.adapter==="https")&&ya(404,"PouchDB is just checking if a remote checkpoint exists."),{session_id:n,_id:e,history:[],replicator:rh,version:th};throw s}).then(function(s){if(!i.cancelled&&s.last_seq!==r)return s.history=(s.history||[]).filter(function(o){return o.session_id!==n}),s.history.unshift({last_seq:r,session_id:n}),s.history=s.history.slice(0,g1),s.version=th,s.replicator=rh,s.session_id=n,s.last_seq=r,t.put(s).catch(function(o){if(o.status===409)return Ca(t,e,r,n,i);throw o})})}var Fi=class{constructor(e,r,n,i,s={writeSourceCheckpoint:!0,writeTargetCheckpoint:!0}){this.src=e,this.target=r,this.id=n,this.returnValue=i,this.opts=s,typeof s.writeSourceCheckpoint>"u"&&(s.writeSourceCheckpoint=!0),typeof s.writeTargetCheckpoint>"u"&&(s.writeTargetCheckpoint=!0)}writeCheckpoint(e,r){var n=this;return this.updateTarget(e,r).then(function(){return n.updateSource(e,r)})}updateTarget(e,r){return this.opts.writeTargetCheckpoint?Ca(this.target,this.id,e,r,this.returnValue):Promise.resolve(!0)}updateSource(e,r){if(this.opts.writeSourceCheckpoint){var n=this;return Ca(this.src,this.id,e,r,this.returnValue).catch(function(i){if(ih(i))return n.opts.writeSourceCheckpoint=!1,!0;throw i})}else return Promise.resolve(!0)}getCheckpoint(){var e=this;return!e.opts.writeSourceCheckpoint&&!e.opts.writeTargetCheckpoint?Promise.resolve(bt):e.opts&&e.opts.writeSourceCheckpoint&&!e.opts.writeTargetCheckpoint?e.src.get(e.id).then(function(r){return r.last_seq||bt}).catch(function(r){if(r.status!==404)throw r;return bt}):e.target.get(e.id).then(function(r){return e.opts&&e.opts.writeTargetCheckpoint&&!e.opts.writeSourceCheckpoint?r.last_seq||bt:e.src.get(e.id).then(function(n){if(r.version!==n.version)return bt;var i;return r.version?i=r.version.toString():i="undefined",i in nh?nh[i](r,n):bt},function(n){if(n.status===404&&r.last_seq)return e.src.put({_id:e.id,last_seq:bt}).then(function(){return bt},function(i){return ih(i)?(e.opts.writeSourceCheckpoint=!1,r.last_seq):bt});throw n})}).catch(function(r){if(r.status!==404)throw r;return bt})}},nh={undefined:function(t,e){return Be(t.last_seq,e.last_seq)===0?e.last_seq:0},1:function(t,e){return _1(e,t).last_seq}};function _1(t,e){return t.session_id===e.session_id?{last_seq:t.last_seq,history:t.history}:Lh(t.history,e.history)}function Lh(t,e){var r=t[0],n=t.slice(1),i=e[0],s=e.slice(1);if(!r||e.length===0)return{last_seq:bt,history:[]};var o=r.session_id;if(ka(o,e))return{last_seq:r.last_seq,history:t};var a=i.session_id;return ka(a,n)?{last_seq:i.last_seq,history:s}:Lh(n,s)}function ka(t,e){var r=e[0],n=e.slice(1);return!t||e.length===0?!1:t===r.session_id?!0:ka(t,n)}function ih(t){return typeof t.status=="number"&&Math.floor(t.status/100)===4}function Mh(t,e,r,n,i){return this instanceof Fi?Mh:new Fi(t,e,r,n,i)}var sh=0;function w1(t,e,r,n){if(t.retry===!1){e.emit("error",r),e.removeAllListeners();return}if(typeof t.back_off_function!="function"&&(t.back_off_function=V_),e.emit("requestError",r),e.state==="active"||e.state==="pending"){e.emit("paused",r),e.state="stopped";var i=function(){t.current_back_off=sh},s=function(){e.removeListener("active",i)};e.once("paused",s),e.once("active",i)}t.current_back_off=t.current_back_off||sh,t.current_back_off=t.back_off_function(t.current_back_off),setTimeout(n,t.current_back_off)}function b1(t){return Object.keys(t).sort(Be).reduce(function(e,r){return e[r]=t[r],e},{})}function E1(t,e,r){var n=r.doc_ids?r.doc_ids.sort(Be):"",i=r.filter?r.filter.toString():"",s="",o="",a="";return r.selector&&(a=JSON.stringify(r.selector)),r.filter&&r.query_params&&(s=JSON.stringify(b1(r.query_params))),r.filter&&r.filter==="_view"&&(o=r.view.toString()),Promise.all([t.id(),e.id()]).then(function(c){var d=c[0]+c[1]+i+o+s+n+a;return new Promise(function(m){Ja(d,m)})}).then(function(c){return c=c.replace(/\//g,".").replace(/\+/g,"_"),"_local/"+c})}function Uh(t,e,r,n,i){var s=[],o,a={seq:0,changes:[],docs:[]},c=!1,d=!1,m=!1,f=0,g=0,_=r.continuous||r.live||!1,b=r.batch_size||100,P=r.batches_limit||10,S=r.style||"all_docs",y=!1,w=r.doc_ids,p=r.selector,h,v,E=[],C=Vi(),x;i=i||{ok:!0,start_time:new Date().toISOString(),docs_read:0,docs_written:0,doc_write_failures:0,errors:[]};var j={};n.ready(t,e);function G(){return v?Promise.resolve():E1(t,e,r).then(function(D){h=D;var M={};r.checkpoint===!1?M={writeSourceCheckpoint:!1,writeTargetCheckpoint:!1}:r.checkpoint==="source"?M={writeSourceCheckpoint:!0,writeTargetCheckpoint:!1}:r.checkpoint==="target"?M={writeSourceCheckpoint:!1,writeTargetCheckpoint:!0}:M={writeSourceCheckpoint:!0,writeTargetCheckpoint:!0},v=new Mh(t,e,h,n,M)})}function H(){if(E=[],o.docs.length!==0){var D=o.docs,M={timeout:r.timeout};return e.bulkDocs({docs:D,new_edits:!1},M).then(function(W){if(n.cancelled)throw q(),new Error("cancelled");var ee=Object.create(null);W.forEach(function(Ee){Ee.error&&(ee[Ee.id]=Ee)});var ne=Object.keys(ee).length;i.doc_write_failures+=ne,i.docs_written+=D.length-ne,D.forEach(function(Ee){var $e=ee[Ee._id];if($e){i.errors.push($e);var Re=($e.name||"").toLowerCase();if(Re==="unauthorized"||Re==="forbidden")n.emit("denied",Ge($e));else throw $e}else E.push(Ee)})},function(W){throw i.doc_write_failures+=D.length,W})}}function re(){if(o.error)throw new Error("There was a problem getting docs.");i.last_seq=g=o.seq;var D=Ge(i);return E.length&&(D.docs=E,typeof o.pending=="number"&&(D.pending=o.pending,delete o.pending),n.emit("change",D)),c=!0,t.info().then(function(M){var W=t.activeTasks.get(x);if(!(!o||!W)){var ee=W.completed_items||0,ne=parseInt(M.update_seq,10)-parseInt(f,10);t.activeTasks.update(x,{completed_items:ee+o.changes.length,total_items:ne})}}),v.writeCheckpoint(o.seq,C).then(function(){if(n.emit("checkpoint",{checkpoint:o.seq}),c=!1,n.cancelled)throw q(),new Error("cancelled");o=void 0,F()}).catch(function(M){throw J(M),M})}function Q(){var D={};return o.changes.forEach(function(M){n.emit("checkpoint",{revs_diff:M}),M.id!=="_user/"&&(D[M.id]=M.changes.map(function(W){return W.rev}))}),e.revsDiff(D).then(function(M){if(n.cancelled)throw q(),new Error("cancelled");o.diffs=M})}function Z(){return y1(t,e,o.diffs,n).then(function(D){o.error=!D.ok,D.docs.forEach(function(M){delete o.diffs[M._id],i.docs_read++,o.docs.push(M)})})}function ce(){if(!(n.cancelled||o)){if(s.length===0){fe(!0);return}o=s.shift(),n.emit("checkpoint",{start_next_batch:o.seq}),Q().then(Z).then(H).then(re).then(ce).catch(function(D){me("batch processing terminated with error",D)})}}function fe(D){if(a.changes.length===0){s.length===0&&!o&&((_&&j.live||d)&&(n.state="pending",n.emit("paused")),d&&q());return}(D||d||a.changes.length>=b)&&(s.push(a),a={seq:0,changes:[],docs:[]},(n.state==="pending"||n.state==="stopped")&&(n.state="active",n.emit("active")),ce())}function me(D,M){m||(M.message||(M.message=D),i.ok=!1,i.status="aborting",s=[],a={seq:0,changes:[],docs:[]},q(M))}function q(D){if(!m&&!(n.cancelled&&(i.status="cancelled",c)))if(i.status=i.status||"complete",i.end_time=new Date().toISOString(),i.last_seq=g,m=!0,t.activeTasks.remove(x,D),D){D=oe(D),D.result=i;var M=(D.name||"").toLowerCase();M==="unauthorized"||M==="forbidden"?(n.emit("error",D),n.removeAllListeners()):w1(r,n,D,function(){Uh(t,e,r,n)})}else n.emit("complete",i),n.removeAllListeners()}function k(D,M,W){if(n.cancelled)return q();typeof M=="number"&&(a.pending=M);var ee=Ma(r)(D);if(!ee){var ne=t.activeTasks.get(x);if(ne){var Ee=ne.completed_items||0;t.activeTasks.update(x,{completed_items:++Ee})}return}a.seq=D.seq||W,a.changes.push(D),n.emit("checkpoint",{pending_batch:a.seq}),qt(function(){fe(s.length===0&&j.live)})}function L(D){if(y=!1,n.cancelled)return q();if(D.results.length>0)j.since=D.results[D.results.length-1].seq,F(),fe(!0);else{var M=function(){_?(j.live=!0,F()):d=!0,fe(!0)};!o&&D.results.length===0?(c=!0,v.writeCheckpoint(D.last_seq,C).then(function(){if(c=!1,i.last_seq=g=D.last_seq,n.cancelled)throw q(),new Error("cancelled");M()}).catch(J)):M()}}function B(D){if(y=!1,n.cancelled)return q();me("changes rejected",D)}function F(){if(!(!y&&!d&&s.length<P))return;y=!0;function D(){W.cancel()}function M(){n.removeListener("cancel",D)}n._changes&&(n.removeListener("cancel",n._abortChanges),n._changes.cancel()),n.once("cancel",D);var W=t.changes(j).on("change",k);W.then(M,M),W.then(L).catch(B),r.retry&&(n._changes=W,n._abortChanges=D)}function X(D){return t.info().then(function(M){var W=typeof r.since>"u"?parseInt(M.update_seq,10)-parseInt(D,10):parseInt(M.update_seq,10);return x=t.activeTasks.add({name:`${_?"continuous ":""}replication from ${M.db_name}`,total_items:W}),D})}function ie(){G().then(function(){if(n.cancelled){q();return}return v.getCheckpoint().then(X).then(function(D){g=D,f=D,j={since:g,limit:b,batch_size:b,style:S,doc_ids:w,selector:p,return_docs:!0},r.filter&&(typeof r.filter!="string"?j.include_docs=!0:j.filter=r.filter),"heartbeat"in r&&(j.heartbeat=r.heartbeat),"timeout"in r&&(j.timeout=r.timeout),r.query_params&&(j.query_params=r.query_params),r.view&&(j.view=r.view),F()})}).catch(function(D){me("getCheckpoint rejected with ",D)})}function J(D){c=!1,me("writeCheckpoint completed with error",D)}if(n.cancelled){q();return}n._addedListeners||(n.once("cancel",q),typeof r.complete=="function"&&(n.once("error",r.complete),n.once("complete",function(D){r.complete(null,D)})),n._addedListeners=!0),typeof r.since>"u"?ie():G().then(function(){return c=!0,v.writeCheckpoint(r.since,C)}).then(function(){if(c=!1,n.cancelled){q();return}g=r.since,ie()}).catch(J)}var xa=class extends ut{constructor(){super(),this.cancelled=!1,this.state="pending";let e=new Promise((r,n)=>{this.once("complete",r),this.once("error",n)});this.then=function(r,n){return e.then(r,n)},this.catch=function(r){return e.catch(r)},this.catch(function(){})}cancel(){this.cancelled=!0,this.state="cancelled",this.emit("cancel")}ready(e,r){if(this._readyCalled)return;this._readyCalled=!0;let n=()=>{this.cancel()};e.once("destroyed",n),r.once("destroyed",n);function i(){e.removeListener("destroyed",n),r.removeListener("destroyed",n)}this.once("complete",i),this.once("error",i)}};function Ki(t,e){var r=e.PouchConstructor;return typeof t=="string"?new r(t,e):t}function Na(t,e,r,n){if(typeof r=="function"&&(n=r,r={}),typeof r>"u"&&(r={}),r.doc_ids&&!Array.isArray(r.doc_ids))throw oe(zi,"`doc_ids` filter parameter is not a list.");r.complete=n,r=Ge(r),r.continuous=r.continuous||r.live,r.retry="retry"in r?r.retry:!1,r.PouchConstructor=r.PouchConstructor||this;var i=new xa(r),s=Ki(t,r),o=Ki(e,r);return Uh(s,o,r,i),i}function $1(t,e,r,n){return typeof r=="function"&&(n=r,r={}),typeof r>"u"&&(r={}),r=Ge(r),r.PouchConstructor=r.PouchConstructor||this,t=Ki(t,r),e=Ki(e,r),new ja(t,e,r,n)}var ja=class extends ut{constructor(e,r,n,i){super(),this.canceled=!1;let s=n.push?Object.assign({},n,n.push):n,o=n.pull?Object.assign({},n,n.pull):n;this.push=Na(e,r,s),this.pull=Na(r,e,o),this.pushPaused=!0,this.pullPaused=!0;let a=p=>{this.emit("change",{direction:"pull",change:p})},c=p=>{this.emit("change",{direction:"push",change:p})},d=p=>{this.emit("denied",{direction:"push",doc:p})},m=p=>{this.emit("denied",{direction:"pull",doc:p})},f=()=>{this.pushPaused=!0,this.pullPaused&&this.emit("paused")},g=()=>{this.pullPaused=!0,this.pushPaused&&this.emit("paused")},_=()=>{this.pushPaused=!1,this.pullPaused&&this.emit("active",{direction:"push"})},b=()=>{this.pullPaused=!1,this.pushPaused&&this.emit("active",{direction:"pull"})},P={},S=p=>(h,v)=>{(h==="change"&&(v===a||v===c)||h==="denied"&&(v===m||v===d)||h==="paused"&&(v===g||v===f)||h==="active"&&(v===b||v===_))&&(h in P||(P[h]={}),P[h][p]=!0,Object.keys(P[h]).length===2&&this.removeAllListeners(h))};n.live&&(this.push.on("complete",this.pull.cancel.bind(this.pull)),this.pull.on("complete",this.push.cancel.bind(this.push)));function y(p,h,v){p.listeners(h).indexOf(v)==-1&&p.on(h,v)}this.on("newListener",function(p){p==="change"?(y(this.pull,"change",a),y(this.push,"change",c)):p==="denied"?(y(this.pull,"denied",m),y(this.push,"denied",d)):p==="active"?(y(this.pull,"active",b),y(this.push,"active",_)):p==="paused"&&(y(this.pull,"paused",g),y(this.push,"paused",f))}),this.on("removeListener",function(p){p==="change"?(this.pull.removeListener("change",a),this.push.removeListener("change",c)):p==="denied"?(this.pull.removeListener("denied",m),this.push.removeListener("denied",d)):p==="active"?(this.pull.removeListener("active",b),this.push.removeListener("active",_)):p==="paused"&&(this.pull.removeListener("paused",g),this.push.removeListener("paused",f))}),this.pull.on("removeListener",S("pull")),this.push.on("removeListener",S("push"));let w=Promise.all([this.push,this.pull]).then(p=>{let h={push:p[0],pull:p[1]};return this.emit("complete",h),i&&i(null,h),this.removeAllListeners(),h},p=>{if(this.cancel(),i?i(p):this.emit("error",p),this.removeAllListeners(),i)throw p});this.then=function(p,h){return w.then(p,h)},this.catch=function(p){return w.catch(p)}}cancel(){this.canceled||(this.canceled=!0,this.push.cancel(),this.pull.cancel())}};function S1(t){t.replicate=Na,t.sync=$1,Object.defineProperty(t.prototype,"replicate",{get:function(){var e=this;return typeof this.replicateMethods>"u"&&(this.replicateMethods={from:function(r,n,i){return e.constructor.replicate(r,e,n,i)},to:function(r,n,i){return e.constructor.replicate(e,r,n,i)}}),this.replicateMethods}}),t.prototype.sync=function(e,r,n){return this.constructor.sync(this,e,r,n)}}ae.plugin(Gw).plugin(Qw).plugin(h1).plugin(S1);var Gh=ae;I();R();T();var Vr=t=>`${t.source}/${encodeURIComponent(t.actor)}/${encodeURIComponent(t.name)}`,Xa=t=>{let e=t.split("/"),r=e.pop(),n=e.pop();if(!r||!n||!e.length)throw new zc;return{name:decodeURIComponent(r),actor:decodeURIComponent(n),source:e.join("/")}};function Za(t=16){let e=new Uint8Array(t);return crypto.getRandomValues(e),btoa(String.fromCodePoint(...e)).replace(/\+/g,"-").replace(/\//g,"_").replace(/\=+$/,"")}function Ji(t){return typeof t=="string"?{location:Xa(t),uri:t}:{location:{name:t.name,actor:t.actor,source:t.source},uri:Vr(t)}}function Fh(t,e){return t.lastModified>e.lastModified||t.lastModified===e.lastModified&&!t.tombstone&&e.tombstone}function Kh(t,e,r,n){let i=r[e];if(!(!i||!i.length))try{n[e]=t(n[e],i,!0,!1).newDocument}catch(s){throw typeof s=="object"&&s&&"name"in s&&typeof s.name=="string"&&"message"in s&&typeof s.message=="string"?s.name==="TEST_OPERATION_FAILED"?new Gc(s.message):new Ar(s.name+": "+s.message):s}}function Hi(t,e){try{return t.compile(e)}catch(r){throw new Bc(r instanceof Error?r.message:void 0)}}function eu(t,e,r){t.actor!==r?.actor&&(t.allowed=t.allowed&&r?[r.actor]:void 0,t.channels=t.channels.filter(n=>e.includes(n)))}function tu(t,e){return t.allowed===void 0||t.allowed===null||!!e?.actor&&(t.actor===e.actor||t.allowed.includes(e.actor))}I();R();T();var nu=function(t,e){return nu=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i])},nu(t,e)};function P1(t,e){nu(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function Hr(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(m){try{d(n.next(m))}catch(f){o(f)}}function c(m){try{d(n.throw(m))}catch(f){o(f)}}function d(m){m.done?s(m.value):i(m.value).then(a,c)}d((n=n.apply(t,e||[])).next())})}function Qt(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(d){return function(m){return c([d,m])}}function c(d){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=d[0]&2?i.return:d[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,d[1])).done)return s;switch(i=0,s&&(d=[d[0]&2,s.value]),d[0]){case 0:case 1:s=d;break;case 4:return r.label++,{value:d[1],done:!1};case 5:r.label++,i=d[1],d=[0];continue;case 7:d=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(d[0]===6||d[0]===2)){r=0;continue}if(d[0]===3&&(!s||d[1]>s[0]&&d[1]<s[3])){r.label=d[1];break}if(d[0]===6&&r.label<s[1]){r.label=s[1],s=d;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(d);break}s[2]&&r.ops.pop(),r.trys.pop();continue}d=e.call(t,r)}catch(m){d=[6,m],i=0}finally{n=s=0}if(d[0]&5)throw d[1];return{value:d[0]?d[1]:void 0,done:!0}}}function Wr(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function jn(t){return this instanceof jn?(this.v=t,this):new jn(t)}function O1(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,s=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(g){n[g]&&(i[g]=function(_){return new Promise(function(b,P){s.push([g,_,b,P])>1||a(g,_)})})}function a(g,_){try{c(n[g](_))}catch(b){f(s[0][3],b)}}function c(g){g.value instanceof jn?Promise.resolve(g.value.v).then(d,m):f(s[0][2],g)}function d(g){a("next",g)}function m(g){a("throw",g)}function f(g,_){g(_),s.shift(),s.length&&a(s[0][0],s[0][1])}}var Jh=function(t){P1(e,t);function e(r){var n=t.call(this,r)||this;return Object.defineProperty(n,"name",{value:"RepeaterOverflowError",enumerable:!1}),typeof Object.setPrototypeOf=="function"?Object.setPrototypeOf(n,n.constructor.prototype):n.__proto__=n.constructor.prototype,typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(n,n.constructor),n}return e}(Error),TA=function(){function t(e){if(e<0)throw new RangeError("Capacity may not be less than 0");this._c=e,this._q=[]}return Object.defineProperty(t.prototype,"empty",{get:function(){return this._q.length===0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"full",{get:function(){return this._q.length>=this._c},enumerable:!1,configurable:!0}),t.prototype.add=function(e){if(this.full)throw new Error("Buffer full");this._q.push(e)},t.prototype.remove=function(){if(this.empty)throw new Error("Buffer empty");return this._q.shift()},t}(),RA=function(){function t(e){if(e<1)throw new RangeError("Capacity may not be less than 1");this._c=e,this._q=[]}return Object.defineProperty(t.prototype,"empty",{get:function(){return this._q.length===0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"full",{get:function(){return!1},enumerable:!1,configurable:!0}),t.prototype.add=function(e){for(;this._q.length>=this._c;)this._q.shift();this._q.push(e)},t.prototype.remove=function(){if(this.empty)throw new Error("Buffer empty");return this._q.shift()},t}(),qA=function(){function t(e){if(e<1)throw new RangeError("Capacity may not be less than 1");this._c=e,this._q=[]}return Object.defineProperty(t.prototype,"empty",{get:function(){return this._q.length===0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"full",{get:function(){return!1},enumerable:!1,configurable:!0}),t.prototype.add=function(e){this._q.length<this._c&&this._q.push(e)},t.prototype.remove=function(){if(this.empty)throw new Error("Buffer empty");return this._q.shift()},t}();function iu(t){t!=null&&typeof t.then=="function"&&t.then(Xi,Xi)}var ru=0,zh=1,$r=2,Qi=3,su=4,Yi=1024,Xi=function(){};function Jr(t){var e=t.err,r=Promise.resolve(t.execution).then(function(n){if(e!=null)throw e;return n});return t.err=void 0,t.execution=r.then(function(){},function(){}),t.pending===void 0?r:t.pending.then(function(){return r})}function Er(t,e){var r=t.state>=Qi;return Promise.resolve(e).then(function(n){return!r&&t.state>=su?Jr(t).then(function(i){return{value:i,done:!0}}):{value:n,done:r}})}function ou(t,e){var r,n;if(!(t.state>=$r))if(t.state=$r,t.onnext(),t.onstop(),t.err==null&&(t.err=e),t.pushes.length===0&&(typeof t.buffer>"u"||t.buffer.empty))Nn(t);else try{for(var i=Wr(t.pushes),s=i.next();!s.done;s=i.next()){var o=s.value;o.resolve()}}catch(a){r={error:a}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}}function Nn(t){var e,r;if(!(t.state>=Qi)){t.state<$r&&ou(t),t.state=Qi,t.buffer=void 0;try{for(var n=Wr(t.nexts),i=n.next();!i.done;i=n.next()){var s=i.value,o=t.pending===void 0?Jr(t):t.pending.then(function(){return Jr(t)});s.resolve(Er(t,o))}}catch(a){e={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}t.pushes=[],t.nexts=[]}}function Vh(t){t.state>=su||(t.state<Qi&&Nn(t),t.state=su)}function A1(t,e){if(iu(e),t.pushes.length>=Yi)throw new Jh("No more than "+Yi+" pending calls to push are allowed on a single repeater.");if(t.state>=$r)return Promise.resolve(void 0);var r=t.pending===void 0?Promise.resolve(e):t.pending.then(function(){return e});r=r.catch(function(c){t.state<$r&&(t.err=c),Vh(t)});var n;if(t.nexts.length){var i=t.nexts.shift();i.resolve(Er(t,r)),t.nexts.length?n=Promise.resolve(t.nexts[0].value):typeof t.buffer<"u"&&!t.buffer.full?n=Promise.resolve(void 0):n=new Promise(function(c){return t.onnext=c})}else typeof t.buffer<"u"&&!t.buffer.full?(t.buffer.add(r),n=Promise.resolve(void 0)):n=new Promise(function(c){return t.pushes.push({resolve:c,value:r})});var s=!0,o={},a=n.catch(function(c){if(s)throw c});return o.then=function(c,d){return s=!1,Promise.prototype.then.call(n,c,d)},o.catch=function(c){return s=!1,Promise.prototype.catch.call(n,c)},o.finally=n.finally.bind(n),t.pending=r.then(function(){return a}).catch(function(c){t.err=c,Vh(t)}),o}function I1(t){var e=ou.bind(null,t),r=new Promise(function(n){return t.onstop=n});return e.then=r.then.bind(r),e.catch=r.catch.bind(r),e.finally=r.finally.bind(r),e}function T1(t){if(!(t.state>=zh)){t.state=zh;var e=A1.bind(null,t),r=I1(t);t.execution=new Promise(function(n){return n(t.executor(e,r))}),t.execution.catch(function(){return ou(t)})}}var Wi=new WeakMap,Yt=function(){function t(e,r){Wi.set(this,{executor:e,buffer:r,err:void 0,state:ru,pushes:[],nexts:[],pending:void 0,execution:void 0,onnext:Xi,onstop:Xi})}return t.prototype.next=function(e){iu(e);var r=Wi.get(this);if(r===void 0)throw new Error("WeakMap error");if(r.nexts.length>=Yi)throw new Jh("No more than "+Yi+" pending calls to next are allowed on a single repeater.");if(r.state<=ru&&T1(r),r.onnext(e),typeof r.buffer<"u"&&!r.buffer.empty){var n=Er(r,r.buffer.remove());if(r.pushes.length){var i=r.pushes.shift();r.buffer.add(i.value),r.onnext=i.resolve}return n}else if(r.pushes.length){var s=r.pushes.shift();return r.onnext=s.resolve,Er(r,s.value)}else if(r.state>=$r)return Nn(r),Er(r,Jr(r));return new Promise(function(o){return r.nexts.push({resolve:o,value:e})})},t.prototype.return=function(e){iu(e);var r=Wi.get(this);if(r===void 0)throw new Error("WeakMap error");return Nn(r),r.execution=Promise.resolve(r.execution).then(function(){return e}),Er(r,Jr(r))},t.prototype.throw=function(e){var r=Wi.get(this);if(r===void 0)throw new Error("WeakMap error");return r.state<=ru||r.state>=$r||typeof r.buffer<"u"&&!r.buffer.empty?(Nn(r),r.err==null&&(r.err=e),Er(r,Jr(r))):this.next(Promise.reject(e))},t.prototype[Symbol.asyncIterator]=function(){return this},t.race=R1,t.merge=q1,t.zip=C1,t.latest=k1,t}();function Zi(t,e){var r,n,i=[],s=function(d){d!=null&&typeof d[Symbol.asyncIterator]=="function"?i.push(d[Symbol.asyncIterator]()):d!=null&&typeof d[Symbol.iterator]=="function"?i.push(d[Symbol.iterator]()):i.push(function(){return O1(this,arguments,function(){return Qt(this,function(g){switch(g.label){case 0:return e.yieldValues?[4,jn(d)]:[3,3];case 1:return[4,g.sent()];case 2:g.sent(),g.label=3;case 3:return e.returnValues?[4,jn(d)]:[3,5];case 4:return[2,g.sent()];case 5:return[2]}})})}())};try{for(var o=Wr(t),a=o.next();!a.done;a=o.next()){var c=a.value;s(c)}}catch(d){r={error:d}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return i}function R1(t){var e=this,r=Zi(t,{returnValues:!0});return new Yt(function(n,i){return Hr(e,void 0,void 0,function(){var s,o,a,c,d,m;return Qt(this,function(f){switch(f.label){case 0:if(!r.length)return i(),[2];o=!1,i.then(function(){s(),o=!0}),f.label=1;case 1:f.trys.push([1,,5,7]),c=void 0,d=0,m=function(){var g,_,b,P,S,y;return Qt(this,function(w){switch(w.label){case 0:g=d;try{for(_=(S=void 0,Wr(r)),b=_.next();!b.done;b=_.next())P=b.value,Promise.resolve(P.next()).then(function(p){p.done?(i(),a===void 0&&(a=p)):d===g&&(d++,s(p))},function(p){return i(p)})}catch(p){S={error:p}}finally{try{b&&!b.done&&(y=_.return)&&y.call(_)}finally{if(S)throw S.error}}return[4,new Promise(function(p){return s=p})];case 1:return c=w.sent(),c===void 0?[3,3]:[4,n(c.value)];case 2:w.sent(),w.label=3;case 3:return[2]}})},f.label=2;case 2:return o?[3,4]:[5,m()];case 3:return f.sent(),[3,2];case 4:return[2,a&&a.value];case 5:return i(),[4,Promise.race(r.map(function(g){return g.return&&g.return()}))];case 6:return f.sent(),[7];case 7:return[2]}})})})}function q1(t){var e=this,r=Zi(t,{yieldValues:!0});return new Yt(function(n,i){return Hr(e,void 0,void 0,function(){var s,o,a,c=this;return Qt(this,function(d){switch(d.label){case 0:if(!r.length)return i(),[2];s=[],o=!1,i.then(function(){var m,f;o=!0;try{for(var g=Wr(s),_=g.next();!_.done;_=g.next()){var b=_.value;b()}}catch(P){m={error:P}}finally{try{_&&!_.done&&(f=g.return)&&f.call(g)}finally{if(m)throw m.error}}}),d.label=1;case 1:return d.trys.push([1,,3,4]),[4,Promise.all(r.map(function(m,f){return Hr(c,void 0,void 0,function(){var g,_;return Qt(this,function(b){switch(b.label){case 0:b.trys.push([0,,6,9]),b.label=1;case 1:return o?[3,5]:(Promise.resolve(m.next()).then(function(P){return s[f](P)},function(P){return i(P)}),[4,new Promise(function(P){s[f]=P})]);case 2:return g=b.sent(),g===void 0?[3,4]:g.done?(a=g,[2]):[4,n(g.value)];case 3:b.sent(),b.label=4;case 4:return[3,1];case 5:return[3,9];case 6:return _=m.return,_?[4,m.return()]:[3,8];case 7:_=b.sent(),b.label=8;case 8:return[7];case 9:return[2]}})})}))];case 2:return d.sent(),[2,a&&a.value];case 3:return i(),[7];case 4:return[2]}})})})}function C1(t){var e=this,r=Zi(t,{returnValues:!0});return new Yt(function(n,i){return Hr(e,void 0,void 0,function(){var s,o,a,c;return Qt(this,function(d){switch(d.label){case 0:if(!r.length)return i(),[2,[]];o=!1,i.then(function(){s(),o=!0}),d.label=1;case 1:d.trys.push([1,,6,8]),d.label=2;case 2:return o?[3,5]:(Promise.all(r.map(function(m){return m.next()})).then(function(m){return s(m)},function(m){return i(m)}),[4,new Promise(function(m){return s=m})]);case 3:return a=d.sent(),a===void 0?[2]:(c=a.map(function(m){return m.value}),a.some(function(m){return m.done})?[2,c]:[4,n(c)]);case 4:return d.sent(),[3,2];case 5:return[3,8];case 6:return i(),[4,Promise.all(r.map(function(m){return m.return&&m.return()}))];case 7:return d.sent(),[7];case 8:return[2]}})})})}function k1(t){var e=this,r=Zi(t,{yieldValues:!0,returnValues:!0});return new Yt(function(n,i){return Hr(e,void 0,void 0,function(){var s,o,a,c,d,m=this;return Qt(this,function(f){switch(f.label){case 0:if(!r.length)return i(),[2,[]];o=[],a=!1,i.then(function(){var g,_;s();try{for(var b=Wr(o),P=b.next();!P.done;P=b.next()){var S=P.value;S()}}catch(y){g={error:y}}finally{try{P&&!P.done&&(_=b.return)&&_.call(b)}finally{if(g)throw g.error}}a=!0}),f.label=1;case 1:return f.trys.push([1,,5,7]),Promise.all(r.map(function(g){return g.next()})).then(function(g){return s(g)},function(g){return i(g)}),[4,new Promise(function(g){return s=g})];case 2:return c=f.sent(),c===void 0?[2]:(d=c.map(function(g){return g.value}),c.every(function(g){return g.done})?[2,d]:[4,n(d.slice())]);case 3:return f.sent(),[4,Promise.all(r.map(function(g,_){return Hr(m,void 0,void 0,function(){var b;return Qt(this,function(P){switch(P.label){case 0:if(c[_].done)return[2,c[_].value];P.label=1;case 1:return a?[3,4]:(Promise.resolve(g.next()).then(function(S){return o[_](S)},function(S){return i(S)}),[4,new Promise(function(S){return o[_]=S})]);case 2:return b=P.sent(),b===void 0?[2,c[_].value]:b.done?[2,b.value]:(d[_]=b.value,[4,n(d.slice())]);case 3:return P.sent(),[3,1];case 4:return[2]}})})}))];case 4:return[2,f.sent()];case 5:return i(),[4,Promise.all(r.map(function(g){return g.return&&g.return()}))];case 6:return f.sent(),[7];case 7:return[2]}})})})}var Qh=Mn(Zo());I();R();T();var au={};us(au,{JsonPatchError:()=>Ne,_areEquals:()=>Ln,applyOperation:()=>Sr,applyPatch:()=>Yr,applyReducer:()=>B1,deepClone:()=>j1,getValueByPointer:()=>is,validate:()=>Wh,validator:()=>ss});I();R();T();I();R();T();var x1=function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var s in i)i.hasOwnProperty(s)&&(n[s]=i[s])},t(e,r)};return function(e,r){t(e,r);function n(){this.constructor=e}e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),N1=Object.prototype.hasOwnProperty;function ts(t,e){return N1.call(t,e)}function rs(t){if(Array.isArray(t)){for(var e=new Array(t.length),r=0;r<e.length;r++)e[r]=""+r;return e}if(Object.keys)return Object.keys(t);var n=[];for(var i in t)ts(t,i)&&n.push(i);return n}function He(t){switch(typeof t){case"object":return JSON.parse(JSON.stringify(t));case"undefined":return null;default:return t}}function ns(t){for(var e=0,r=t.length,n;e<r;){if(n=t.charCodeAt(e),n>=48&&n<=57){e++;continue}return!1}return!0}function Ct(t){return t.indexOf("/")===-1&&t.indexOf("~")===-1?t:t.replace(/~/g,"~0").replace(/\//g,"~1")}function Dn(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}function es(t){if(t===void 0)return!0;if(t){if(Array.isArray(t)){for(var e=0,r=t.length;e<r;e++)if(es(t[e]))return!0}else if(typeof t=="object"){for(var n=rs(t),i=n.length,s=0;s<i;s++)if(es(t[n[s]]))return!0}}return!1}function Hh(t,e){var r=[t];for(var n in e){var i=typeof e[n]=="object"?JSON.stringify(e[n],null,2):e[n];typeof i<"u"&&r.push(n+": "+i)}return r.join(`
|
|
17
|
-
`)}var Bn=function(t){x1(e,t);function e(r,n,i,s,o){var a=this.constructor,c=t.call(this,Hh(r,{name:n,index:i,operation:s,tree:o}))||this;return c.name=n,c.index=i,c.operation=s,c.tree=o,Object.setPrototypeOf(c,a.prototype),c.message=Hh(r,{name:n,index:i,operation:s,tree:o}),c}return e}(Error);var Ne=Bn,j1=He,Qr={add:function(t,e,r){return t[e]=this.value,{newDocument:r}},remove:function(t,e,r){var n=t[e];return delete t[e],{newDocument:r,removed:n}},replace:function(t,e,r){var n=t[e];return t[e]=this.value,{newDocument:r,removed:n}},move:function(t,e,r){var n=is(r,this.path);n&&(n=He(n));var i=Sr(r,{op:"remove",path:this.from}).removed;return Sr(r,{op:"add",path:this.path,value:i}),{newDocument:r,removed:n}},copy:function(t,e,r){var n=is(r,this.from);return Sr(r,{op:"add",path:this.path,value:He(n)}),{newDocument:r}},test:function(t,e,r){return{newDocument:r,test:Ln(t[e],this.value)}},_get:function(t,e,r){return this.value=t[e],{newDocument:r}}},D1={add:function(t,e,r){return ns(e)?t.splice(e,0,this.value):t[e]=this.value,{newDocument:r,index:e}},remove:function(t,e,r){var n=t.splice(e,1);return{newDocument:r,removed:n[0]}},replace:function(t,e,r){var n=t[e];return t[e]=this.value,{newDocument:r,removed:n}},move:Qr.move,copy:Qr.copy,test:Qr.test,_get:Qr._get};function is(t,e){if(e=="")return t;var r={op:"_get",path:e};return Sr(t,r),r.value}function Sr(t,e,r,n,i,s){if(r===void 0&&(r=!1),n===void 0&&(n=!0),i===void 0&&(i=!0),s===void 0&&(s=0),r&&(typeof r=="function"?r(e,0,t,e.path):ss(e,0)),e.path===""){var o={newDocument:t};if(e.op==="add")return o.newDocument=e.value,o;if(e.op==="replace")return o.newDocument=e.value,o.removed=t,o;if(e.op==="move"||e.op==="copy")return o.newDocument=is(t,e.from),e.op==="move"&&(o.removed=t),o;if(e.op==="test"){if(o.test=Ln(t,e.value),o.test===!1)throw new Ne("Test operation failed","TEST_OPERATION_FAILED",s,e,t);return o.newDocument=t,o}else{if(e.op==="remove")return o.removed=t,o.newDocument=null,o;if(e.op==="_get")return e.value=t,o;if(r)throw new Ne("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",s,e,t);return o}}else{n||(t=He(t));var a=e.path||"",c=a.split("/"),d=t,m=1,f=c.length,g=void 0,_=void 0,b=void 0;for(typeof r=="function"?b=r:b=ss;;){if(_=c[m],_&&_.indexOf("~")!=-1&&(_=Dn(_)),i&&(_=="__proto__"||_=="prototype"&&m>0&&c[m-1]=="constructor"))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(r&&g===void 0&&(d[_]===void 0?g=c.slice(0,m).join("/"):m==f-1&&(g=e.path),g!==void 0&&b(e,0,t,g)),m++,Array.isArray(d)){if(_==="-")_=d.length;else{if(r&&!ns(_))throw new Ne("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",s,e,t);ns(_)&&(_=~~_)}if(m>=f){if(r&&e.op==="add"&&_>d.length)throw new Ne("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",s,e,t);var o=D1[e.op].call(e,d,_,t);if(o.test===!1)throw new Ne("Test operation failed","TEST_OPERATION_FAILED",s,e,t);return o}}else if(m>=f){var o=Qr[e.op].call(e,d,_,t);if(o.test===!1)throw new Ne("Test operation failed","TEST_OPERATION_FAILED",s,e,t);return o}if(d=d[_],r&&m<f&&(!d||typeof d!="object"))throw new Ne("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",s,e,t)}}}function Yr(t,e,r,n,i){if(n===void 0&&(n=!0),i===void 0&&(i=!0),r&&!Array.isArray(e))throw new Ne("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");n||(t=He(t));for(var s=new Array(e.length),o=0,a=e.length;o<a;o++)s[o]=Sr(t,e[o],r,!0,i,o),t=s[o].newDocument;return s.newDocument=t,s}function B1(t,e,r){var n=Sr(t,e);if(n.test===!1)throw new Ne("Test operation failed","TEST_OPERATION_FAILED",r,e,t);return n.newDocument}function ss(t,e,r,n){if(typeof t!="object"||t===null||Array.isArray(t))throw new Ne("Operation is not an object","OPERATION_NOT_AN_OBJECT",e,t,r);if(Qr[t.op]){if(typeof t.path!="string")throw new Ne("Operation `path` property is not a string","OPERATION_PATH_INVALID",e,t,r);if(t.path.indexOf("/")!==0&&t.path.length>0)throw new Ne('Operation `path` property must start with "/"',"OPERATION_PATH_INVALID",e,t,r);if((t.op==="move"||t.op==="copy")&&typeof t.from!="string")throw new Ne("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",e,t,r);if((t.op==="add"||t.op==="replace"||t.op==="test")&&t.value===void 0)throw new Ne("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",e,t,r);if((t.op==="add"||t.op==="replace"||t.op==="test")&&es(t.value))throw new Ne("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",e,t,r);if(r){if(t.op=="add"){var i=t.path.split("/").length,s=n.split("/").length;if(i!==s+1&&i!==s)throw new Ne("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",e,t,r)}else if(t.op==="replace"||t.op==="remove"||t.op==="_get"){if(t.path!==n)throw new Ne("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",e,t,r)}else if(t.op==="move"||t.op==="copy"){var o={op:"_get",path:t.from,value:void 0},a=Wh([o],r);if(a&&a.name==="OPERATION_PATH_UNRESOLVABLE")throw new Ne("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",e,t,r)}}}else throw new Ne("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",e,t,r)}function Wh(t,e,r){try{if(!Array.isArray(t))throw new Ne("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(e)Yr(He(e),He(t),r||!0);else{r=r||ss;for(var n=0;n<t.length;n++)r(t[n],n,e,void 0)}}catch(i){if(i instanceof Ne)return i;throw i}}function Ln(t,e){if(t===e)return!0;if(t&&e&&typeof t=="object"&&typeof e=="object"){var r=Array.isArray(t),n=Array.isArray(e),i,s,o;if(r&&n){if(s=t.length,s!=e.length)return!1;for(i=s;i--!==0;)if(!Ln(t[i],e[i]))return!1;return!0}if(r!=n)return!1;var a=Object.keys(t);if(s=a.length,s!==Object.keys(e).length)return!1;for(i=s;i--!==0;)if(!e.hasOwnProperty(a[i]))return!1;for(i=s;i--!==0;)if(o=a[i],!Ln(t[o],e[o]))return!1;return!0}return t!==t&&e!==e}var lu={};us(lu,{compare:()=>V1,generate:()=>uu,observe:()=>z1,unobserve:()=>K1});I();R();T();var cu=new WeakMap,L1=function(){function t(e){this.observers=new Map,this.obj=e}return t}(),M1=function(){function t(e,r){this.callback=e,this.observer=r}return t}();function U1(t){return cu.get(t)}function G1(t,e){return t.observers.get(e)}function F1(t,e){t.observers.delete(e.callback)}function K1(t,e){e.unobserve()}function z1(t,e){var r=[],n,i=U1(t);if(!i)i=new L1(t),cu.set(t,i);else{var s=G1(i,e);n=s&&s.observer}if(n)return n;if(n={},i.value=He(t),e){n.callback=e,n.next=null;var o=function(){uu(n)},a=function(){clearTimeout(n.next),n.next=setTimeout(o)};typeof window<"u"&&(window.addEventListener("mouseup",a),window.addEventListener("keyup",a),window.addEventListener("mousedown",a),window.addEventListener("keydown",a),window.addEventListener("change",a))}return n.patches=r,n.object=t,n.unobserve=function(){uu(n),clearTimeout(n.next),F1(i,n),typeof window<"u"&&(window.removeEventListener("mouseup",a),window.removeEventListener("keyup",a),window.removeEventListener("mousedown",a),window.removeEventListener("keydown",a),window.removeEventListener("change",a))},i.observers.set(e,new M1(e,n)),n}function uu(t,e){e===void 0&&(e=!1);var r=cu.get(t.object);fu(r.value,t.object,t.patches,"",e),t.patches.length&&Yr(r.value,t.patches);var n=t.patches;return n.length>0&&(t.patches=[],t.callback&&t.callback(n)),n}function fu(t,e,r,n,i){if(e!==t){typeof e.toJSON=="function"&&(e=e.toJSON());for(var s=rs(e),o=rs(t),a=!1,c=!1,d=o.length-1;d>=0;d--){var m=o[d],f=t[m];if(ts(e,m)&&!(e[m]===void 0&&f!==void 0&&Array.isArray(e)===!1)){var g=e[m];typeof f=="object"&&f!=null&&typeof g=="object"&&g!=null&&Array.isArray(f)===Array.isArray(g)?fu(f,g,r,n+"/"+Ct(m),i):f!==g&&(a=!0,i&&r.push({op:"test",path:n+"/"+Ct(m),value:He(f)}),r.push({op:"replace",path:n+"/"+Ct(m),value:He(g)}))}else Array.isArray(t)===Array.isArray(e)?(i&&r.push({op:"test",path:n+"/"+Ct(m),value:He(f)}),r.push({op:"remove",path:n+"/"+Ct(m)}),c=!0):(i&&r.push({op:"test",path:n,value:t}),r.push({op:"replace",path:n,value:e}),a=!0)}if(!(!c&&s.length==o.length))for(var d=0;d<s.length;d++){var m=s[d];!ts(t,m)&&e[m]!==void 0&&r.push({op:"add",path:n+"/"+Ct(m),value:He(e[m])})}}}function V1(t,e,r){r===void 0&&(r=!1);var n=[];return fu(t,e,n,"",r),n}var QA=Object.assign({},au,lu,{JsonPatchError:Bn,deepClone:He,escapePathComponent:Ct,unescapePathComponent:Dn});var os=class{db;source="local";tombstoneRetention=864e5;ajv;constructor(e,r){this.ajv=r??new Qh.default({strict:!1}),this.source=e?.sourceName??this.source,this.tombstoneRetention=e?.tombstoneRetention??this.tombstoneRetention;let n={name:"graffitiDb",...e?.pouchDBOptions};this.db=new Gh(n.name,n),this.db.put({_id:"_design/indexes",views:{objectsPerChannelAndLastModified:{map:function(i){let s=i.lastModified.toString().padStart(15,"0");i.channels.forEach(function(o){let a=encodeURIComponent(o)+"/"+s;emit(a)})}.toString()},orphansPerActorAndLastModified:{map:function(i){if(i.channels.length===0){let s=i.lastModified.toString().padStart(15,"0"),o=encodeURIComponent(i.actor)+"/"+s;emit(o)}}.toString()},channelStatsPerActor:{map:function(i){i.tombstone||i.channels.forEach(function(s){let o=encodeURIComponent(i.actor)+"/"+encodeURIComponent(s);emit(o,i.lastModified)})}.toString(),reduce:"_stats"}}}).catch(i=>{if(!(i&&typeof i=="object"&&"name"in i&&i.name==="conflict"))throw i})}async queryByLocation(e){let r=Vr(e)+"/";return(await this.db.allDocs({startkey:r,endkey:r+"\uFFFF",include_docs:!0})).rows.map(s=>s.doc).reduce((s,o)=>(o&&s.push(o),s),[])}docId(e){return Vr(e)+"/"+Za()}get=async(...e)=>{let[r,n,i]=e,{location:s}=Ji(r),a=(await this.queryByLocation(s)).filter(_=>tu(_,i));if(!a.length)throw new zn;let c=a.reduce((_,b)=>Fh(_,b)?_:b),{_id:d,_rev:m,...f}=c;if(eu(f,[],i),!Hi(this.ajv,n)(f))throw new Mc;return f};async deleteAtLocation(e,r=!1){let i=(await this.queryByLocation(e)).filter(f=>!f.tombstone);if(!i.length)return;let s=i.map(f=>f.lastModified).reduce((f,g)=>f>g?f:g),o=i.filter(f=>!r||f.lastModified<s),a=i.filter(f=>r&&f.lastModified===s);if(a.length){let f=a.map(_=>_._id).reduce((_,b)=>_>b?_:b),g=a.filter(_=>_._id!==f);o.push(...g)}let c=r?s:new Date().getTime(),d=await this.db.bulkDocs(o.map(f=>({...f,tombstone:!0,lastModified:c}))),m;for(let f of d)if("ok"in f){let{id:g}=f,_=o.find(b=>b._id===g);if(_){let{_id:b,_rev:P,_conflicts:S,_attachments:y,...w}=_;m={...w,tombstone:!0,lastModified:c};break}}return m}delete=async(...e)=>{let[r,n]=e,{location:i}=Ji(r);if(i.actor!==n.actor)throw new Zr;let s=await this.deleteAtLocation(i);if(!s)throw new zn;return s};put=async(...e)=>{let[r,n]=e;if(r.actor&&r.actor!==n.actor)throw new Zr;if(r.source&&r.source!==this.source)throw new Zr("Putting an object that does not match this source");let i={value:r.value,channels:r.channels,allowed:r.allowed,name:r.name??Za(),source:this.source,actor:n.actor,tombstone:!1,lastModified:new Date().getTime()};await this.db.put({_id:this.docId(i),...i});let s=await this.deleteAtLocation(i,!0);return s||{...i,value:{},channels:[],allowed:void 0,tombstone:!0}};patch=async(...e)=>{let[r,n,i]=e,{location:s}=Ji(n);if(s.actor!==i.actor)throw new Zr;let o=await this.get(n,{},i);if(o.tombstone)throw new zn("The object you are trying to patch has been deleted");let a={...o};for(let c of["value","channels","allowed"])Kh(Yr,c,r,a);if(typeof a.value!="object"||Array.isArray(a.value)||!a.value)throw new Ar("value is no longer an object");if(!Array.isArray(a.channels)||!a.channels.every(c=>typeof c=="string"))throw new Ar("channels are no longer an array of strings");if(a.allowed&&(!Array.isArray(a.allowed)||!a.allowed.every(c=>typeof c=="string")))throw new Ar("allowed list is not an array of strings");return a.lastModified=new Date().getTime(),await this.db.put({...a,_id:this.docId(a)}),await this.deleteAtLocation(a,!0),{...o,tombstone:!0,lastModified:a.lastModified}};queryLastModifiedSuffixes(e){let r="",n="\uFFFF",i=e.properties?.lastModified;if(i?.minimum){let s=Math.ceil(i.minimum);s===i.minimum&&i.exclusiveMinimum&&s++,r=s.toString().padStart(15,"0")}if(i?.maximum){let s=Math.floor(i.maximum);s===i.maximum&&i.exclusiveMaximum&&s--,n=s.toString().padStart(15,"0")}return{startKeySuffix:r,endKeySuffix:n}}discover=(...e)=>{let[r,n,i]=e,s=Hi(this.ajv,n),{startKeySuffix:o,endKeySuffix:a}=this.queryLastModifiedSuffixes(n);return new Yt(async(d,m)=>{let f=new Set;for(let g of r){let _=encodeURIComponent(g)+"/",b=_+o,P=_+a,S=await this.db.query("indexes/objectsPerChannelAndLastModified",{startkey:b,endkey:P,include_docs:!0});for(let y of S.rows){let w=y.doc;if(!w)continue;let{_id:p,_rev:h,...v}=w;f.has(p)||(f.add(p),tu(w,i)&&(eu(v,r,i),s(v)&&await d({value:v})))}}return m(),{tombstoneRetention:this.tombstoneRetention}})};recoverOrphans=(e,r)=>{let n=Hi(this.ajv,e),{startKeySuffix:i,endKeySuffix:s}=this.queryLastModifiedSuffixes(e),o=encodeURIComponent(r.actor)+"/",a=o+i,c=o+s;return new Yt(async(m,f)=>{let g=await this.db.query("indexes/orphansPerActorAndLastModified",{startkey:a,endkey:c,include_docs:!0});for(let _ of g.rows){let b=_.doc;if(!b)continue;let{_id:P,_rev:S,...y}=b;n(y)&&await m({value:y})}return f(),{tombstoneRetention:this.tombstoneRetention}})};channelStats=e=>new Yt(async(n,i)=>{let s=encodeURIComponent(e.actor)+"/",o=await this.db.query("indexes/channelStatsPerActor",{startkey:s,endkey:s+"\uFFFF",reduce:!0,group:!0});for(let a of o.rows){let c=a.key.split("/")[1];if(typeof c!="string")continue;let{count:d,max:m}=a.value;typeof d!="number"||typeof m!="number"||await n({value:{channel:decodeURIComponent(c),count:d,lastModified:m}})}i()})};var Yh=class extends Nc{locationToUri=Vr;uriToLocation=Xa;sessionManagerLocal=new Oi;login=this.sessionManagerLocal.login.bind(this.sessionManagerLocal);logout=this.sessionManagerLocal.logout.bind(this.sessionManagerLocal);sessionEvents=this.sessionManagerLocal.sessionEvents;put;get;patch;delete;discover;recoverOrphans;channelStats;constructor(e){super();let r=new Xh.default({strict:!1}),n=new os(e,r);this.put=n.put.bind(n),this.get=n.get.bind(n),this.patch=n.patch.bind(n),this.delete=n.delete.bind(n),this.discover=n.discover.bind(n),this.recoverOrphans=n.recoverOrphans.bind(n),this.channelStats=n.channelStats.bind(n)}};export{Yh as GraffitiLocal};
|
|
16
|
+
Please double-check your map/reduce function.`),dt("error",e,r)}}function jv(t,e,r,n){function i(q,k,L){try{k(L)}catch(B){bf(q,B,{fun:k,doc:L})}}function s(q,k,L,B,F){try{return{output:k(L,B,F)}}catch(X){return bf(q,X,{fun:k,keys:L,values:B,rereduce:F}),{error:X}}}function o(q,k){let L=Be(q.key,k.key);return L!==0?L:Be(q.value,k.value)}function a(q,k,L){return L=L||0,typeof k=="number"?q.slice(L,k+L):L>0?q.slice(L):q}function c(q){let k=q.value;return k&&typeof k=="object"&&k._id||q.id}function d(q){for(let k of q.rows){let L=k.doc&&k.doc._attachments;if(L)for(let B of Object.keys(L)){let F=L[B];L[B].data=oo(F.data,F.content_type)}}}function m(q){return function(k){return q.include_docs&&q.attachments&&q.binary&&d(k),k}}function f(q,k,L,B){let F=k[q];typeof F<"u"&&(B&&(F=encodeURIComponent(JSON.stringify(F))),L.push(q+"="+F))}function g(q){if(typeof q<"u"){let k=Number(q);return!isNaN(k)&&k===parseInt(q,10)?k:q}}function _(q){return q.group_level=g(q.group_level),q.limit=g(q.limit),q.skip=g(q.skip),q}function E(q){if(q){if(typeof q!="number")return new sr(`Invalid value for integer: "${q}"`);if(q<0)return new sr(`Invalid value for positive integer: "${q}"`)}}function P(q,k){let L=q.descending?"endkey":"startkey",B=q.descending?"startkey":"endkey";if(typeof q[L]<"u"&&typeof q[B]<"u"&&Be(q[L],q[B])>0)throw new sr("No rows can match your key range, reverse your start_key and end_key or set {descending : true}");if(k.reduce&&q.reduce!==!1){if(q.include_docs)throw new sr("{include_docs:true} is invalid for reduce");if(q.keys&&q.keys.length>1&&!q.group&&!q.group_level)throw new sr("Multi-key fetches for reduce views must use {group: true}")}for(let F of["group_level","limit","skip"]){let X=E(q[F]);if(X)throw X}}async function S(q,k,L){let B=[],F,X="GET",ie;if(f("reduce",L,B),f("include_docs",L,B),f("attachments",L,B),f("limit",L,B),f("descending",L,B),f("group",L,B),f("group_level",L,B),f("skip",L,B),f("stale",L,B),f("conflicts",L,B),f("startkey",L,B,!0),f("start_key",L,B,!0),f("endkey",L,B,!0),f("end_key",L,B,!0),f("inclusive_end",L,B),f("key",L,B,!0),f("update_seq",L,B),B=B.join("&"),B=B===""?"":"?"+B,typeof L.keys<"u"){let W=`keys=${encodeURIComponent(JSON.stringify(L.keys))}`;W.length+B.length+1<=2e3?B+=(B[0]==="?"?"&":"?")+W:(X="POST",typeof k=="string"?F={keys:L.keys}:k.keys=L.keys)}if(typeof k=="string"){let M=Is(k),W=await q.fetch("_design/"+M[0]+"/_view/"+M[1]+B,{headers:new Rr({"Content-Type":"application/json"}),method:X,body:JSON.stringify(F)});ie=W.ok;let ee=await W.json();if(!ie)throw ee.status=W.status,kr(ee);for(let ne of ee.rows)if(ne.value&&ne.value.error&&ne.value.error==="builtin_reduce_error")throw new Error(ne.reason);return new Promise(function(ne){ne(ee)}).then(m(L))}F=F||{};for(let M of Object.keys(k))Array.isArray(k[M])?F[M]=k[M]:F[M]=k[M].toString();let J=await q.fetch("_temp_view"+B,{headers:new Rr({"Content-Type":"application/json"}),method:"POST",body:JSON.stringify(F)});ie=J.ok;let D=await J.json();if(!ie)throw D.status=J.status,kr(D);return new Promise(function(M){M(D)}).then(m(L))}function y(q,k,L){return new Promise(function(B,F){q._query(k,L,function(X,ie){if(X)return F(X);B(ie)})})}function w(q){return new Promise(function(k,L){q._viewCleanup(function(B,F){if(B)return L(B);k(F)})})}function p(q){return function(k){if(k.status===404)return q;throw k}}async function h(q,k,L){let B="_local/doc_"+q,F={_id:B,keys:[]},X=L.get(q),ie=X[0],J=X[1];function D(){return xv(J)?Promise.resolve(F):k.db.get(B).catch(p(F))}function M(Ee){return Ee.keys.length?k.db.allDocs({keys:Ee.keys,include_docs:!0}):Promise.resolve({rows:[]})}function W(Ee,$e){let Re=[],We=new Set;for(let ve of $e.rows){let ge=ve.doc;if(ge&&(Re.push(ge),We.add(ge._id),ge._deleted=!ie.has(ge._id),!ge._deleted)){let Se=ie.get(ge._id);"value"in Se&&(ge.value=Se.value)}}let ct=As(ie);for(let ve of ct)if(!We.has(ve)){let ge={_id:ve},Se=ie.get(ve);"value"in Se&&(ge.value=Se.value),Re.push(ge)}return Ee.keys=mf(ct.concat(Ee.keys)),Re.push(Ee),Re}let ee=await D(),ne=await M(ee);return W(ee,ne)}function v(q){return q.sourceDB.get("_local/purges").then(function(k){let L=k.purgeSeq;return q.db.get("_local/purgeSeq").then(function(B){return B._rev}).catch(p(void 0)).then(function(B){return q.db.put({_id:"_local/purgeSeq",_rev:B,purgeSeq:L})})}).catch(function(k){if(k.status!==404)throw k})}function b(q,k,L){var B="_local/lastSeq";return q.db.get(B).catch(p({_id:B,seq:0})).then(function(F){var X=As(k);return Promise.all(X.map(function(ie){return h(ie,q,k)})).then(function(ie){var J=ie.flat();return F.seq=L,J.push(F),q.db.bulkDocs({docs:J})}).then(()=>v(q))})}function N(q){let k=typeof q=="string"?q:q.name,L=_f[k];return L||(L=_f[k]=new an),L}async function C(q,k){return Os(N(q),function(){return j(q,k)})()}async function j(q,k){let L,B,F;function X(ve,ge){let Se={id:B._id,key:lr(ve)};typeof ge<"u"&&ge!==null&&(Se.value=lr(ge)),L.push(Se)}let ie=e(q.mapFun,X),J=q.seq||0;function D(){return q.sourceDB.info().then(function(ve){F=q.sourceDB.activeTasks.add({name:"view_indexing",total_items:ve.update_seq-J})})}function M(ve,ge){return function(){return b(q,ve,ge)}}let W=0,ee={view:q.name,indexed_docs:W};q.sourceDB.emit("indexing",ee);let ne=new an;async function Ee(){let ve=await q.sourceDB.changes({return_docs:!0,conflicts:!0,include_docs:!0,style:"all_docs",since:J,limit:k.changes_batch_size}),ge=await $e();return Re(ve,ge)}function $e(){return q.db.get("_local/purgeSeq").then(function(ve){return ve.purgeSeq}).catch(p(-1)).then(function(ve){return q.sourceDB.get("_local/purges").then(function(ge){let Se=ge.purges.filter(function(Fe,Pe){return Pe>ve}).map(Fe=>Fe.docId),nt=Se.filter(function(Fe,Pe){return Se.indexOf(Fe)===Pe});return Promise.all(nt.map(function(Fe){return q.sourceDB.get(Fe).then(function(Pe){return{docId:Fe,doc:Pe}}).catch(p({docId:Fe}))}))}).catch(p([]))})}function Re(ve,ge){let Se=ve.results;if(!Se.length&&!ge.length)return;for(let Pe of ge)if(Se.findIndex(function(Zt){return Zt.id===Pe.docId})<0){let Zt={_id:Pe.docId,doc:{_id:Pe.docId,_deleted:1},changes:[]};Pe.doc&&(Zt.doc=Pe.doc,Zt.changes.push({rev:Pe.doc._rev})),Se.push(Zt)}let nt=We(Se);ne.add(M(nt,J)),W=W+Se.length;let Fe={view:q.name,last_seq:ve.last_seq,results_count:Se.length,indexed_docs:W};if(q.sourceDB.emit("indexing",Fe),q.sourceDB.activeTasks.update(F,{completed_items:W}),!(Se.length<k.changes_batch_size))return Ee()}function We(ve){let ge=new Map;for(let Se of ve){if(Se.doc._id[0]!=="_"){L=[],B=Se.doc,B._deleted||i(q.sourceDB,ie,B),L.sort(o);let nt=ct(L);ge.set(Se.doc._id,[nt,Se.changes])}J=Se.seq}return ge}function ct(ve){let ge=new Map,Se;for(let nt=0,Fe=ve.length;nt<Fe;nt++){let Pe=ve[nt],Xt=[Pe.key,Pe.id];nt>0&&Be(Pe.key,Se)===0&&Xt.push(nt),ge.set(gt(Xt),Pe),Se=Pe.key}return ge}try{await D(),await Ee(),await ne.finish(),q.seq=J,q.sourceDB.activeTasks.remove(F)}catch(ve){q.sourceDB.activeTasks.remove(F,ve)}}function G(q,k,L){L.group_level===0&&delete L.group_level;let B=L.group||L.group_level,F=r(q.reduceFun),X=[],ie=isNaN(L.group_level)?Number.POSITIVE_INFINITY:L.group_level;for(let J of k){let D=X[X.length-1],M=B?J.key:null;if(B&&Array.isArray(M)&&(M=M.slice(0,ie)),D&&Be(D.groupKey,M)===0){D.keys.push([J.key,J.id]),D.values.push(J.value);continue}X.push({keys:[[J.key,J.id]],values:[J.value],groupKey:M})}k=[];for(let J of X){let D=s(q.sourceDB,F,J.keys,J.values,!1);if(D.error&&D.error instanceof fi)throw D.error;k.push({value:D.error?null:D.output,key:J.groupKey})}return{rows:a(k,L.limit,L.skip)}}function H(q,k){return Os(N(q),function(){return re(q,k)})()}async function re(q,k){let L,B=q.reduceFun&&k.reduce!==!1,F=k.skip||0;typeof k.keys<"u"&&!k.keys.length&&(k.limit=0,delete k.keys);async function X(J){J.include_docs=!0;let D=await q.db.allDocs(J);return L=D.total_rows,D.rows.map(function(M){if("value"in M.doc&&typeof M.doc.value=="object"&&M.doc.value!==null){let ee=Object.keys(M.doc.value).sort(),ne=["id","key","value"];if(!(ee<ne||ee>ne))return M.doc.value}let W=Am(M.doc._id);return{key:W[0],id:W[1],value:"value"in M.doc?M.doc.value:null}})}async function ie(J){let D;if(B?D=G(q,J,k):typeof k.keys>"u"?D={total_rows:L,offset:F,rows:J}:D={total_rows:L,offset:F,rows:a(J,k.limit,k.skip)},k.update_seq&&(D.update_seq=q.seq),k.include_docs){let M=mf(J.map(c)),W=await q.sourceDB.allDocs({keys:M,include_docs:!0,conflicts:k.conflicts,attachments:k.attachments,binary:k.binary}),ee=new Map;for(let ne of W.rows)ee.set(ne.id,ne.doc);for(let ne of J){let Ee=c(ne),$e=ee.get(Ee);$e&&(ne.doc=$e)}}return D}if(typeof k.keys<"u"){let D=k.keys.map(function(ee){let ne={startkey:gt([ee]),endkey:gt([ee,{}])};return k.update_seq&&(ne.update_seq=!0),X(ne)}),W=(await Promise.all(D)).flat();return ie(W)}else{let J={descending:k.descending};k.update_seq&&(J.update_seq=!0);let D,M;if("start_key"in k&&(D=k.start_key),"startkey"in k&&(D=k.startkey),"end_key"in k&&(M=k.end_key),"endkey"in k&&(M=k.endkey),typeof D<"u"&&(J.startkey=k.descending?gt([D,{}]):gt([D])),typeof M<"u"){let ee=k.inclusive_end!==!1;k.descending&&(ee=!ee),J.endkey=gt(ee?[M,{}]:[M])}if(typeof k.key<"u"){let ee=gt([k.key]),ne=gt([k.key,{}]);J.descending?(J.endkey=ee,J.startkey=ne):(J.startkey=ee,J.endkey=ne)}B||(typeof k.limit=="number"&&(J.limit=k.limit),J.skip=F);let W=await X(J);return ie(W)}}async function Y(q){return(await q.fetch("_view_cleanup",{headers:new Rr({"Content-Type":"application/json"}),method:"POST"})).json()}async function Z(q){try{let k=await q.get("_local/"+t),L=new Map;for(let D of Object.keys(k.views)){let M=Is(D),W="_design/"+M[0],ee=M[1],ne=L.get(W);ne||(ne=new Set,L.set(W,ne)),ne.add(ee)}let B={keys:As(L),include_docs:!0},F=await q.allDocs(B),X={};for(let D of F.rows){let M=D.key.substring(8);for(let W of L.get(D.key)){let ee=M+"/"+W;k.views[ee]||(ee=W);let ne=Object.keys(k.views[ee]),Ee=D.doc&&D.doc.views&&D.doc.views[W];for(let $e of ne)X[$e]=X[$e]||Ee}}let J=Object.keys(X).filter(function(D){return!X[D]}).map(function(D){return Os(N(D),function(){return new q.constructor(D,q.__opts).destroy()})()});return Promise.all(J).then(function(){return{ok:!0}})}catch(k){if(k.status===404)return{ok:!0};throw k}}async function ce(q,k,L){if(typeof q._query=="function")return y(q,k,L);if(Ot(q))return S(q,k,L);let B={changes_batch_size:q.__opts.view_update_changes_batch_size||Cv};if(typeof k!="string")return P(L,k),wf.add(async function(){let F=await gf(q,"temp_view/temp_view",k.map,k.reduce,!0,t);return Tv(C(F,B).then(function(){return H(F,L)}),function(){return F.db.destroy()})}),wf.finish();{let F=k,X=Is(F),ie=X[0],J=X[1],D=await q.get("_design/"+ie);if(k=D.views&&D.views[J],!k)throw new ci(`ddoc ${D._id} has no view named ${J}`);n(D,J),P(L,k);let M=await gf(q,F,k.map,k.reduce,!1,t);return L.stale==="ok"||L.stale==="update_after"?(L.stale==="update_after"&&At(function(){C(M,B)}),H(M,L)):(await C(M,B),H(M,L))}}function fe(q,k,L){let B=this;typeof k=="function"&&(L=k,k={}),k=k?_(k):{},typeof q=="function"&&(q={map:q});let F=Promise.resolve().then(function(){return ce(B,q,k)});return il(F,L),F}let me=Iv(function(){let q=this;return typeof q._viewCleanup=="function"?w(q):Ot(q)?Y(q):Z(q)});return{query:fe,viewCleanup:me}}var Ts={_sum:function(t,e){return Vs(e)},_count:function(t,e){return e.length},_stats:function(t,e){function r(n){for(var i=0,s=0,o=n.length;s<o;s++){var a=n[s];i+=a*a}return i}return{sum:Vs(e),min:Math.min.apply(null,e),max:Math.max.apply(null,e),count:e.length,sumsqr:r(e)}}};function Dv(t){if(/^_sum/.test(t))return Ts._sum;if(/^_count/.test(t))return Ts._count;if(/^_stats/.test(t))return Ts._stats;if(/^_/.test(t))throw new Error(t+" is not a supported reduce function.")}function Bv(t,e){if(typeof t=="function"&&t.length===2){var r=t;return function(n){return r(n,e)}}else return sl(t.toString(),e)}function Lv(t){var e=t.toString(),r=Dv(e);return r||sl(e)}function Mv(t,e){var r=t.views&&t.views[e];if(typeof r.map!="string")throw new ci("ddoc "+t._id+" has no string view named "+e+", instead found object of type: "+typeof r.map)}var Uv="mrviews",ol=jv(Uv,Bv,Lv,Mv);function Gv(t,e,r){return ol.query.call(this,t,e,r)}function Fv(t){return ol.viewCleanup.call(this,t)}var Kv={query:Gv,viewCleanup:Fv};function zv(t,e,r){return!t._attachments||!t._attachments[r]||t._attachments[r].digest!==e._attachments[r].digest}function Ef(t,e){var r=Object.keys(e._attachments);return Promise.all(r.map(function(n){return t.getAttachment(e._id,n,{rev:e._rev})}))}function Vv(t,e,r){var n=Ot(e)&&!Ot(t),i=Object.keys(r._attachments);return n?t.get(r._id).then(function(s){return Promise.all(i.map(function(o){return zv(s,r,o)?e.getAttachment(r._id,o):t.getAttachment(s._id,o)}))}).catch(function(s){if(s.status!==404)throw s;return Ef(e,r)}):Ef(e,r)}function Jv(t){var e=[];return Object.keys(t).forEach(function(r){var n=t[r].missing;n.forEach(function(i){e.push({id:r,rev:i})})}),{docs:e,revs:!0,latest:!0}}function Hv(t,e,r,n){r=Ge(r);var i=[],s=!0;function o(){var c=Jv(r);if(c.docs.length)return t.bulkGet(c).then(function(d){if(n.cancelled)throw new Error("cancelled");return Promise.all(d.results.map(function(m){return Promise.all(m.docs.map(function(f){var g=f.ok;return f.error&&(s=!1),!g||!g._attachments?g:Vv(e,t,g).then(_=>{var E=Object.keys(g._attachments);return _.forEach(function(P,S){var y=g._attachments[E[S]];delete y.stub,delete y.length,y.data=P}),g})}))})).then(function(m){i=i.concat(m.flat().filter(Boolean))})})}function a(){return{ok:s,docs:i}}return Promise.resolve().then(o).then(a)}var $f=1,Sf="pouchdb",Wv=5,yt=0;function Js(t,e,r,n,i){return t.get(e).catch(function(s){if(s.status===404)return(t.adapter==="http"||t.adapter==="https")&&Ns(404,"PouchDB is just checking if a remote checkpoint exists."),{session_id:n,_id:e,history:[],replicator:Sf,version:$f};throw s}).then(function(s){if(!i.cancelled&&s.last_seq!==r)return s.history=(s.history||[]).filter(function(o){return o.session_id!==n}),s.history.unshift({last_seq:r,session_id:n}),s.history=s.history.slice(0,Wv),s.version=$f,s.replicator=Sf,s.session_id=n,s.last_seq=r,t.put(s).catch(function(o){if(o.status===409)return Js(t,e,r,n,i);throw o})})}var li=class{constructor(e,r,n,i,s={writeSourceCheckpoint:!0,writeTargetCheckpoint:!0}){this.src=e,this.target=r,this.id=n,this.returnValue=i,this.opts=s,typeof s.writeSourceCheckpoint>"u"&&(s.writeSourceCheckpoint=!0),typeof s.writeTargetCheckpoint>"u"&&(s.writeTargetCheckpoint=!0)}writeCheckpoint(e,r){var n=this;return this.updateTarget(e,r).then(function(){return n.updateSource(e,r)})}updateTarget(e,r){return this.opts.writeTargetCheckpoint?Js(this.target,this.id,e,r,this.returnValue):Promise.resolve(!0)}updateSource(e,r){if(this.opts.writeSourceCheckpoint){var n=this;return Js(this.src,this.id,e,r,this.returnValue).catch(function(i){if(Of(i))return n.opts.writeSourceCheckpoint=!1,!0;throw i})}else return Promise.resolve(!0)}getCheckpoint(){var e=this;return!e.opts.writeSourceCheckpoint&&!e.opts.writeTargetCheckpoint?Promise.resolve(yt):e.opts&&e.opts.writeSourceCheckpoint&&!e.opts.writeTargetCheckpoint?e.src.get(e.id).then(function(r){return r.last_seq||yt}).catch(function(r){if(r.status!==404)throw r;return yt}):e.target.get(e.id).then(function(r){return e.opts&&e.opts.writeTargetCheckpoint&&!e.opts.writeSourceCheckpoint?r.last_seq||yt:e.src.get(e.id).then(function(n){if(r.version!==n.version)return yt;var i;return r.version?i=r.version.toString():i="undefined",i in Pf?Pf[i](r,n):yt},function(n){if(n.status===404&&r.last_seq)return e.src.put({_id:e.id,last_seq:yt}).then(function(){return yt},function(i){return Of(i)?(e.opts.writeSourceCheckpoint=!1,r.last_seq):yt});throw n})}).catch(function(r){if(r.status!==404)throw r;return yt})}},Pf={undefined:function(t,e){return Be(t.last_seq,e.last_seq)===0?e.last_seq:0},1:function(t,e){return Qv(e,t).last_seq}};function Qv(t,e){return t.session_id===e.session_id?{last_seq:t.last_seq,history:t.history}:al(t.history,e.history)}function al(t,e){var r=t[0],n=t.slice(1),i=e[0],s=e.slice(1);if(!r||e.length===0)return{last_seq:yt,history:[]};var o=r.session_id;if(Hs(o,e))return{last_seq:r.last_seq,history:t};var a=i.session_id;return Hs(a,n)?{last_seq:i.last_seq,history:s}:al(n,s)}function Hs(t,e){var r=e[0],n=e.slice(1);return!t||e.length===0?!1:t===r.session_id?!0:Hs(t,n)}function Of(t){return typeof t.status=="number"&&Math.floor(t.status/100)===4}function ul(t,e,r,n,i){return this instanceof li?ul:new li(t,e,r,n,i)}var Af=0;function Yv(t,e,r,n){if(t.retry===!1){e.emit("error",r),e.removeAllListeners();return}if(typeof t.back_off_function!="function"&&(t.back_off_function=$p),e.emit("requestError",r),e.state==="active"||e.state==="pending"){e.emit("paused",r),e.state="stopped";var i=function(){t.current_back_off=Af},s=function(){e.removeListener("active",i)};e.once("paused",s),e.once("active",i)}t.current_back_off=t.current_back_off||Af,t.current_back_off=t.back_off_function(t.current_back_off),setTimeout(n,t.current_back_off)}function Xv(t){return Object.keys(t).sort(Be).reduce(function(e,r){return e[r]=t[r],e},{})}function Zv(t,e,r){var n=r.doc_ids?r.doc_ids.sort(Be):"",i=r.filter?r.filter.toString():"",s="",o="",a="";return r.selector&&(a=JSON.stringify(r.selector)),r.filter&&r.query_params&&(s=JSON.stringify(Xv(r.query_params))),r.filter&&r.filter==="_view"&&(o=r.view.toString()),Promise.all([t.id(),e.id()]).then(function(c){var d=c[0]+c[1]+i+o+s+n+a;return new Promise(function(m){uo(d,m)})}).then(function(c){return c=c.replace(/\//g,".").replace(/\+/g,"_"),"_local/"+c})}function cl(t,e,r,n,i){var s=[],o,a={seq:0,changes:[],docs:[]},c=!1,d=!1,m=!1,f=0,g=0,_=r.continuous||r.live||!1,E=r.batch_size||100,P=r.batches_limit||10,S=r.style||"all_docs",y=!1,w=r.doc_ids,p=r.selector,h,v,b=[],N=pi(),C;i=i||{ok:!0,start_time:new Date().toISOString(),docs_read:0,docs_written:0,doc_write_failures:0,errors:[]};var j={};n.ready(t,e);function G(){return v?Promise.resolve():Zv(t,e,r).then(function(D){h=D;var M={};r.checkpoint===!1?M={writeSourceCheckpoint:!1,writeTargetCheckpoint:!1}:r.checkpoint==="source"?M={writeSourceCheckpoint:!0,writeTargetCheckpoint:!1}:r.checkpoint==="target"?M={writeSourceCheckpoint:!1,writeTargetCheckpoint:!0}:M={writeSourceCheckpoint:!0,writeTargetCheckpoint:!0},v=new ul(t,e,h,n,M)})}function H(){if(b=[],o.docs.length!==0){var D=o.docs,M={timeout:r.timeout};return e.bulkDocs({docs:D,new_edits:!1},M).then(function(W){if(n.cancelled)throw q(),new Error("cancelled");var ee=Object.create(null);W.forEach(function(Ee){Ee.error&&(ee[Ee.id]=Ee)});var ne=Object.keys(ee).length;i.doc_write_failures+=ne,i.docs_written+=D.length-ne,D.forEach(function(Ee){var $e=ee[Ee._id];if($e){i.errors.push($e);var Re=($e.name||"").toLowerCase();if(Re==="unauthorized"||Re==="forbidden")n.emit("denied",Ge($e));else throw $e}else b.push(Ee)})},function(W){throw i.doc_write_failures+=D.length,W})}}function re(){if(o.error)throw new Error("There was a problem getting docs.");i.last_seq=g=o.seq;var D=Ge(i);return b.length&&(D.docs=b,typeof o.pending=="number"&&(D.pending=o.pending,delete o.pending),n.emit("change",D)),c=!0,t.info().then(function(M){var W=t.activeTasks.get(C);if(!(!o||!W)){var ee=W.completed_items||0,ne=parseInt(M.update_seq,10)-parseInt(f,10);t.activeTasks.update(C,{completed_items:ee+o.changes.length,total_items:ne})}}),v.writeCheckpoint(o.seq,N).then(function(){if(n.emit("checkpoint",{checkpoint:o.seq}),c=!1,n.cancelled)throw q(),new Error("cancelled");o=void 0,F()}).catch(function(M){throw J(M),M})}function Y(){var D={};return o.changes.forEach(function(M){n.emit("checkpoint",{revs_diff:M}),M.id!=="_user/"&&(D[M.id]=M.changes.map(function(W){return W.rev}))}),e.revsDiff(D).then(function(M){if(n.cancelled)throw q(),new Error("cancelled");o.diffs=M})}function Z(){return Hv(t,e,o.diffs,n).then(function(D){o.error=!D.ok,D.docs.forEach(function(M){delete o.diffs[M._id],i.docs_read++,o.docs.push(M)})})}function ce(){if(!(n.cancelled||o)){if(s.length===0){fe(!0);return}o=s.shift(),n.emit("checkpoint",{start_next_batch:o.seq}),Y().then(Z).then(H).then(re).then(ce).catch(function(D){me("batch processing terminated with error",D)})}}function fe(D){if(a.changes.length===0){s.length===0&&!o&&((_&&j.live||d)&&(n.state="pending",n.emit("paused")),d&&q());return}(D||d||a.changes.length>=E)&&(s.push(a),a={seq:0,changes:[],docs:[]},(n.state==="pending"||n.state==="stopped")&&(n.state="active",n.emit("active")),ce())}function me(D,M){m||(M.message||(M.message=D),i.ok=!1,i.status="aborting",s=[],a={seq:0,changes:[],docs:[]},q(M))}function q(D){if(!m&&!(n.cancelled&&(i.status="cancelled",c)))if(i.status=i.status||"complete",i.end_time=new Date().toISOString(),i.last_seq=g,m=!0,t.activeTasks.remove(C,D),D){D=oe(D),D.result=i;var M=(D.name||"").toLowerCase();M==="unauthorized"||M==="forbidden"?(n.emit("error",D),n.removeAllListeners()):Yv(r,n,D,function(){cl(t,e,r,n)})}else n.emit("complete",i),n.removeAllListeners()}function k(D,M,W){if(n.cancelled)return q();typeof M=="number"&&(a.pending=M);var ee=to(r)(D);if(!ee){var ne=t.activeTasks.get(C);if(ne){var Ee=ne.completed_items||0;t.activeTasks.update(C,{completed_items:++Ee})}return}a.seq=D.seq||W,a.changes.push(D),n.emit("checkpoint",{pending_batch:a.seq}),At(function(){fe(s.length===0&&j.live)})}function L(D){if(y=!1,n.cancelled)return q();if(D.results.length>0)j.since=D.results[D.results.length-1].seq,F(),fe(!0);else{var M=function(){_?(j.live=!0,F()):d=!0,fe(!0)};!o&&D.results.length===0?(c=!0,v.writeCheckpoint(D.last_seq,N).then(function(){if(c=!1,i.last_seq=g=D.last_seq,n.cancelled)throw q(),new Error("cancelled");M()}).catch(J)):M()}}function B(D){if(y=!1,n.cancelled)return q();me("changes rejected",D)}function F(){if(!(!y&&!d&&s.length<P))return;y=!0;function D(){W.cancel()}function M(){n.removeListener("cancel",D)}n._changes&&(n.removeListener("cancel",n._abortChanges),n._changes.cancel()),n.once("cancel",D);var W=t.changes(j).on("change",k);W.then(M,M),W.then(L).catch(B),r.retry&&(n._changes=W,n._abortChanges=D)}function X(D){return t.info().then(function(M){var W=typeof r.since>"u"?parseInt(M.update_seq,10)-parseInt(D,10):parseInt(M.update_seq,10);return C=t.activeTasks.add({name:`${_?"continuous ":""}replication from ${M.db_name}`,total_items:W}),D})}function ie(){G().then(function(){if(n.cancelled){q();return}return v.getCheckpoint().then(X).then(function(D){g=D,f=D,j={since:g,limit:E,batch_size:E,style:S,doc_ids:w,selector:p,return_docs:!0},r.filter&&(typeof r.filter!="string"?j.include_docs=!0:j.filter=r.filter),"heartbeat"in r&&(j.heartbeat=r.heartbeat),"timeout"in r&&(j.timeout=r.timeout),r.query_params&&(j.query_params=r.query_params),r.view&&(j.view=r.view),F()})}).catch(function(D){me("getCheckpoint rejected with ",D)})}function J(D){c=!1,me("writeCheckpoint completed with error",D)}if(n.cancelled){q();return}n._addedListeners||(n.once("cancel",q),typeof r.complete=="function"&&(n.once("error",r.complete),n.once("complete",function(D){r.complete(null,D)})),n._addedListeners=!0),typeof r.since>"u"?ie():G().then(function(){return c=!0,v.writeCheckpoint(r.since,N)}).then(function(){if(c=!1,n.cancelled){q();return}g=r.since,ie()}).catch(J)}var Ws=class extends it{constructor(){super(),this.cancelled=!1,this.state="pending";let e=new Promise((r,n)=>{this.once("complete",r),this.once("error",n)});this.then=function(r,n){return e.then(r,n)},this.catch=function(r){return e.catch(r)},this.catch(function(){})}cancel(){this.cancelled=!0,this.state="cancelled",this.emit("cancel")}ready(e,r){if(this._readyCalled)return;this._readyCalled=!0;let n=()=>{this.cancel()};e.once("destroyed",n),r.once("destroyed",n);function i(){e.removeListener("destroyed",n),r.removeListener("destroyed",n)}this.once("complete",i),this.once("error",i)}};function di(t,e){var r=e.PouchConstructor;return typeof t=="string"?new r(t,e):t}function Qs(t,e,r,n){if(typeof r=="function"&&(n=r,r={}),typeof r>"u"&&(r={}),r.doc_ids&&!Array.isArray(r.doc_ids))throw oe(hi,"`doc_ids` filter parameter is not a list.");r.complete=n,r=Ge(r),r.continuous=r.continuous||r.live,r.retry="retry"in r?r.retry:!1,r.PouchConstructor=r.PouchConstructor||this;var i=new Ws(r),s=di(t,r),o=di(e,r);return cl(s,o,r,i),i}function ey(t,e,r,n){return typeof r=="function"&&(n=r,r={}),typeof r>"u"&&(r={}),r=Ge(r),r.PouchConstructor=r.PouchConstructor||this,t=di(t,r),e=di(e,r),new Ys(t,e,r,n)}var Ys=class extends it{constructor(e,r,n,i){super(),this.canceled=!1;let s=n.push?Object.assign({},n,n.push):n,o=n.pull?Object.assign({},n,n.pull):n;this.push=Qs(e,r,s),this.pull=Qs(r,e,o),this.pushPaused=!0,this.pullPaused=!0;let a=p=>{this.emit("change",{direction:"pull",change:p})},c=p=>{this.emit("change",{direction:"push",change:p})},d=p=>{this.emit("denied",{direction:"push",doc:p})},m=p=>{this.emit("denied",{direction:"pull",doc:p})},f=()=>{this.pushPaused=!0,this.pullPaused&&this.emit("paused")},g=()=>{this.pullPaused=!0,this.pushPaused&&this.emit("paused")},_=()=>{this.pushPaused=!1,this.pullPaused&&this.emit("active",{direction:"push"})},E=()=>{this.pullPaused=!1,this.pushPaused&&this.emit("active",{direction:"pull"})},P={},S=p=>(h,v)=>{(h==="change"&&(v===a||v===c)||h==="denied"&&(v===m||v===d)||h==="paused"&&(v===g||v===f)||h==="active"&&(v===E||v===_))&&(h in P||(P[h]={}),P[h][p]=!0,Object.keys(P[h]).length===2&&this.removeAllListeners(h))};n.live&&(this.push.on("complete",this.pull.cancel.bind(this.pull)),this.pull.on("complete",this.push.cancel.bind(this.push)));function y(p,h,v){p.listeners(h).indexOf(v)==-1&&p.on(h,v)}this.on("newListener",function(p){p==="change"?(y(this.pull,"change",a),y(this.push,"change",c)):p==="denied"?(y(this.pull,"denied",m),y(this.push,"denied",d)):p==="active"?(y(this.pull,"active",E),y(this.push,"active",_)):p==="paused"&&(y(this.pull,"paused",g),y(this.push,"paused",f))}),this.on("removeListener",function(p){p==="change"?(this.pull.removeListener("change",a),this.push.removeListener("change",c)):p==="denied"?(this.pull.removeListener("denied",m),this.push.removeListener("denied",d)):p==="active"?(this.pull.removeListener("active",E),this.push.removeListener("active",_)):p==="paused"&&(this.pull.removeListener("paused",g),this.push.removeListener("paused",f))}),this.pull.on("removeListener",S("pull")),this.push.on("removeListener",S("push"));let w=Promise.all([this.push,this.pull]).then(p=>{let h={push:p[0],pull:p[1]};return this.emit("complete",h),i&&i(null,h),this.removeAllListeners(),h},p=>{if(this.cancel(),i?i(p):this.emit("error",p),this.removeAllListeners(),i)throw p});this.then=function(p,h){return w.then(p,h)},this.catch=function(p){return w.catch(p)}}cancel(){this.canceled||(this.canceled=!0,this.push.cancel(),this.pull.cancel())}};function ty(t){t.replicate=Qs,t.sync=ey,Object.defineProperty(t.prototype,"replicate",{get:function(){var e=this;return typeof this.replicateMethods>"u"&&(this.replicateMethods={from:function(r,n,i){return e.constructor.replicate(r,e,n,i)},to:function(r,n,i){return e.constructor.replicate(e,r,n,i)}}),this.replicateMethods}}),t.prototype.sync=function(e,r,n){return this.constructor.sync(this,e,r,n)}}ae.plugin(_v).plugin(Av).plugin(Kv).plugin(ty);var fl=ae;I();R();T();var Cr=t=>`${t.source}/${encodeURIComponent(t.actor)}/${encodeURIComponent(t.name)}`,po=t=>{let e=t.split("/"),r=e.pop(),n=e.pop();if(!r||!n||!e.length)throw new Kc;return{name:decodeURIComponent(r),actor:decodeURIComponent(n),source:e.join("/")}};function mo(t=16){let e=new Uint8Array(t);return crypto.getRandomValues(e),btoa(String.fromCodePoint(...e)).replace(/\+/g,"-").replace(/\//g,"_").replace(/\=+$/,"")}function mi(t){return typeof t=="string"?{location:po(t),uri:t}:{location:{name:t.name,actor:t.actor,source:t.source},uri:Cr(t)}}function ll(t,e){return t.lastModified>e.lastModified||t.lastModified===e.lastModified&&!t.tombstone&&e.tombstone}function dl(t,e,r,n){let i=r[e];if(!(!i||!i.length))try{n[e]=t(n[e],i,!0,!1).newDocument}catch(s){throw typeof s=="object"&&s&&"name"in s&&typeof s.name=="string"&&"message"in s&&typeof s.message=="string"?s.name==="TEST_OPERATION_FAILED"?new Uc(s.message):new Ar(s.name+": "+s.message):s}}function vi(t,e){try{return t.compile(e)}catch(r){throw new Dc(r instanceof Error?r.message:void 0)}}function vo(t,e,r){t.actor!==r?.actor&&(t.allowed=t.allowed&&r?[r.actor]:void 0,t.channels=t.channels.filter(n=>e.includes(n)))}function yo(t,e){return t.allowed===void 0||t.allowed===null||!!e?.actor&&(t.actor===e.actor||t.allowed.includes(e.actor))}I();R();T();var _o=function(t,e){return _o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)n.hasOwnProperty(i)&&(r[i]=n[i])},_o(t,e)};function ry(t,e){_o(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function jr(t,e,r,n){function i(s){return s instanceof r?s:new r(function(o){o(s)})}return new(r||(r=Promise))(function(s,o){function a(m){try{d(n.next(m))}catch(f){o(f)}}function c(m){try{d(n.throw(m))}catch(f){o(f)}}function d(m){m.done?s(m.value):i(m.value).then(a,c)}d((n=n.apply(t,e||[])).next())})}function Ft(t,e){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(d){return function(m){return c([d,m])}}function c(d){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(s=d[0]&2?i.return:d[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,d[1])).done)return s;switch(i=0,s&&(d=[d[0]&2,s.value]),d[0]){case 0:case 1:s=d;break;case 4:return r.label++,{value:d[1],done:!1};case 5:r.label++,i=d[1],d=[0];continue;case 7:d=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(d[0]===6||d[0]===2)){r=0;continue}if(d[0]===3&&(!s||d[1]>s[0]&&d[1]<s[3])){r.label=d[1];break}if(d[0]===6&&r.label<s[1]){r.label=s[1],s=d;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(d);break}s[2]&&r.ops.pop(),r.trys.pop();continue}d=e.call(t,r)}catch(m){d=[6,m],i=0}finally{n=s=0}if(d[0]&5)throw d[1];return{value:d[0]?d[1]:void 0,done:!0}}}function Dr(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function ln(t){return this instanceof ln?(this.v=t,this):new ln(t)}function ny(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(t,e||[]),i,s=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(g){n[g]&&(i[g]=function(_){return new Promise(function(E,P){s.push([g,_,E,P])>1||a(g,_)})})}function a(g,_){try{c(n[g](_))}catch(E){f(s[0][3],E)}}function c(g){g.value instanceof ln?Promise.resolve(g.value.v).then(d,m):f(s[0][2],g)}function d(g){a("next",g)}function m(g){a("throw",g)}function f(g,_){g(_),s.shift(),s.length&&a(s[0][0],s[0][1])}}var ml=function(t){ry(e,t);function e(r){var n=t.call(this,r)||this;return Object.defineProperty(n,"name",{value:"RepeaterOverflowError",enumerable:!1}),typeof Object.setPrototypeOf=="function"?Object.setPrototypeOf(n,n.constructor.prototype):n.__proto__=n.constructor.prototype,typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(n,n.constructor),n}return e}(Error),jE=function(){function t(e){if(e<0)throw new RangeError("Capacity may not be less than 0");this._c=e,this._q=[]}return Object.defineProperty(t.prototype,"empty",{get:function(){return this._q.length===0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"full",{get:function(){return this._q.length>=this._c},enumerable:!1,configurable:!0}),t.prototype.add=function(e){if(this.full)throw new Error("Buffer full");this._q.push(e)},t.prototype.remove=function(){if(this.empty)throw new Error("Buffer empty");return this._q.shift()},t}(),DE=function(){function t(e){if(e<1)throw new RangeError("Capacity may not be less than 1");this._c=e,this._q=[]}return Object.defineProperty(t.prototype,"empty",{get:function(){return this._q.length===0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"full",{get:function(){return!1},enumerable:!1,configurable:!0}),t.prototype.add=function(e){for(;this._q.length>=this._c;)this._q.shift();this._q.push(e)},t.prototype.remove=function(){if(this.empty)throw new Error("Buffer empty");return this._q.shift()},t}(),BE=function(){function t(e){if(e<1)throw new RangeError("Capacity may not be less than 1");this._c=e,this._q=[]}return Object.defineProperty(t.prototype,"empty",{get:function(){return this._q.length===0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"full",{get:function(){return!1},enumerable:!1,configurable:!0}),t.prototype.add=function(e){this._q.length<this._c&&this._q.push(e)},t.prototype.remove=function(){if(this.empty)throw new Error("Buffer empty");return this._q.shift()},t}();function wo(t){t!=null&&typeof t.then=="function"&&t.then(wi,wi)}var go=0,hl=1,hr=2,gi=3,bo=4,_i=1024,wi=function(){};function xr(t){var e=t.err,r=Promise.resolve(t.execution).then(function(n){if(e!=null)throw e;return n});return t.err=void 0,t.execution=r.then(function(){},function(){}),t.pending===void 0?r:t.pending.then(function(){return r})}function dr(t,e){var r=t.state>=gi;return Promise.resolve(e).then(function(n){return!r&&t.state>=bo?xr(t).then(function(i){return{value:i,done:!0}}):{value:n,done:r}})}function Eo(t,e){var r,n;if(!(t.state>=hr))if(t.state=hr,t.onnext(),t.onstop(),t.err==null&&(t.err=e),t.pushes.length===0&&(typeof t.buffer>"u"||t.buffer.empty))fn(t);else try{for(var i=Dr(t.pushes),s=i.next();!s.done;s=i.next()){var o=s.value;o.resolve()}}catch(a){r={error:a}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}}function fn(t){var e,r;if(!(t.state>=gi)){t.state<hr&&Eo(t),t.state=gi,t.buffer=void 0;try{for(var n=Dr(t.nexts),i=n.next();!i.done;i=n.next()){var s=i.value,o=t.pending===void 0?xr(t):t.pending.then(function(){return xr(t)});s.resolve(dr(t,o))}}catch(a){e={error:a}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}t.pushes=[],t.nexts=[]}}function pl(t){t.state>=bo||(t.state<gi&&fn(t),t.state=bo)}function iy(t,e){if(wo(e),t.pushes.length>=_i)throw new ml("No more than "+_i+" pending calls to push are allowed on a single repeater.");if(t.state>=hr)return Promise.resolve(void 0);var r=t.pending===void 0?Promise.resolve(e):t.pending.then(function(){return e});r=r.catch(function(c){t.state<hr&&(t.err=c),pl(t)});var n;if(t.nexts.length){var i=t.nexts.shift();i.resolve(dr(t,r)),t.nexts.length?n=Promise.resolve(t.nexts[0].value):typeof t.buffer<"u"&&!t.buffer.full?n=Promise.resolve(void 0):n=new Promise(function(c){return t.onnext=c})}else typeof t.buffer<"u"&&!t.buffer.full?(t.buffer.add(r),n=Promise.resolve(void 0)):n=new Promise(function(c){return t.pushes.push({resolve:c,value:r})});var s=!0,o={},a=n.catch(function(c){if(s)throw c});return o.then=function(c,d){return s=!1,Promise.prototype.then.call(n,c,d)},o.catch=function(c){return s=!1,Promise.prototype.catch.call(n,c)},o.finally=n.finally.bind(n),t.pending=r.then(function(){return a}).catch(function(c){t.err=c,pl(t)}),o}function sy(t){var e=Eo.bind(null,t),r=new Promise(function(n){return t.onstop=n});return e.then=r.then.bind(r),e.catch=r.catch.bind(r),e.finally=r.finally.bind(r),e}function oy(t){if(!(t.state>=hl)){t.state=hl;var e=iy.bind(null,t),r=sy(t);t.execution=new Promise(function(n){return n(t.executor(e,r))}),t.execution.catch(function(){return Eo(t)})}}var yi=new WeakMap,Kt=function(){function t(e,r){yi.set(this,{executor:e,buffer:r,err:void 0,state:go,pushes:[],nexts:[],pending:void 0,execution:void 0,onnext:wi,onstop:wi})}return t.prototype.next=function(e){wo(e);var r=yi.get(this);if(r===void 0)throw new Error("WeakMap error");if(r.nexts.length>=_i)throw new ml("No more than "+_i+" pending calls to next are allowed on a single repeater.");if(r.state<=go&&oy(r),r.onnext(e),typeof r.buffer<"u"&&!r.buffer.empty){var n=dr(r,r.buffer.remove());if(r.pushes.length){var i=r.pushes.shift();r.buffer.add(i.value),r.onnext=i.resolve}return n}else if(r.pushes.length){var s=r.pushes.shift();return r.onnext=s.resolve,dr(r,s.value)}else if(r.state>=hr)return fn(r),dr(r,xr(r));return new Promise(function(o){return r.nexts.push({resolve:o,value:e})})},t.prototype.return=function(e){wo(e);var r=yi.get(this);if(r===void 0)throw new Error("WeakMap error");return fn(r),r.execution=Promise.resolve(r.execution).then(function(){return e}),dr(r,xr(r))},t.prototype.throw=function(e){var r=yi.get(this);if(r===void 0)throw new Error("WeakMap error");return r.state<=go||r.state>=hr||typeof r.buffer<"u"&&!r.buffer.empty?(fn(r),r.err==null&&(r.err=e),dr(r,xr(r))):this.next(Promise.reject(e))},t.prototype[Symbol.asyncIterator]=function(){return this},t.race=ay,t.merge=uy,t.zip=cy,t.latest=fy,t}();function bi(t,e){var r,n,i=[],s=function(d){d!=null&&typeof d[Symbol.asyncIterator]=="function"?i.push(d[Symbol.asyncIterator]()):d!=null&&typeof d[Symbol.iterator]=="function"?i.push(d[Symbol.iterator]()):i.push(function(){return ny(this,arguments,function(){return Ft(this,function(g){switch(g.label){case 0:return e.yieldValues?[4,ln(d)]:[3,3];case 1:return[4,g.sent()];case 2:g.sent(),g.label=3;case 3:return e.returnValues?[4,ln(d)]:[3,5];case 4:return[2,g.sent()];case 5:return[2]}})})}())};try{for(var o=Dr(t),a=o.next();!a.done;a=o.next()){var c=a.value;s(c)}}catch(d){r={error:d}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return i}function ay(t){var e=this,r=bi(t,{returnValues:!0});return new Kt(function(n,i){return jr(e,void 0,void 0,function(){var s,o,a,c,d,m;return Ft(this,function(f){switch(f.label){case 0:if(!r.length)return i(),[2];o=!1,i.then(function(){s(),o=!0}),f.label=1;case 1:f.trys.push([1,,5,7]),c=void 0,d=0,m=function(){var g,_,E,P,S,y;return Ft(this,function(w){switch(w.label){case 0:g=d;try{for(_=(S=void 0,Dr(r)),E=_.next();!E.done;E=_.next())P=E.value,Promise.resolve(P.next()).then(function(p){p.done?(i(),a===void 0&&(a=p)):d===g&&(d++,s(p))},function(p){return i(p)})}catch(p){S={error:p}}finally{try{E&&!E.done&&(y=_.return)&&y.call(_)}finally{if(S)throw S.error}}return[4,new Promise(function(p){return s=p})];case 1:return c=w.sent(),c===void 0?[3,3]:[4,n(c.value)];case 2:w.sent(),w.label=3;case 3:return[2]}})},f.label=2;case 2:return o?[3,4]:[5,m()];case 3:return f.sent(),[3,2];case 4:return[2,a&&a.value];case 5:return i(),[4,Promise.race(r.map(function(g){return g.return&&g.return()}))];case 6:return f.sent(),[7];case 7:return[2]}})})})}function uy(t){var e=this,r=bi(t,{yieldValues:!0});return new Kt(function(n,i){return jr(e,void 0,void 0,function(){var s,o,a,c=this;return Ft(this,function(d){switch(d.label){case 0:if(!r.length)return i(),[2];s=[],o=!1,i.then(function(){var m,f;o=!0;try{for(var g=Dr(s),_=g.next();!_.done;_=g.next()){var E=_.value;E()}}catch(P){m={error:P}}finally{try{_&&!_.done&&(f=g.return)&&f.call(g)}finally{if(m)throw m.error}}}),d.label=1;case 1:return d.trys.push([1,,3,4]),[4,Promise.all(r.map(function(m,f){return jr(c,void 0,void 0,function(){var g,_;return Ft(this,function(E){switch(E.label){case 0:E.trys.push([0,,6,9]),E.label=1;case 1:return o?[3,5]:(Promise.resolve(m.next()).then(function(P){return s[f](P)},function(P){return i(P)}),[4,new Promise(function(P){s[f]=P})]);case 2:return g=E.sent(),g===void 0?[3,4]:g.done?(a=g,[2]):[4,n(g.value)];case 3:E.sent(),E.label=4;case 4:return[3,1];case 5:return[3,9];case 6:return _=m.return,_?[4,m.return()]:[3,8];case 7:_=E.sent(),E.label=8;case 8:return[7];case 9:return[2]}})})}))];case 2:return d.sent(),[2,a&&a.value];case 3:return i(),[7];case 4:return[2]}})})})}function cy(t){var e=this,r=bi(t,{returnValues:!0});return new Kt(function(n,i){return jr(e,void 0,void 0,function(){var s,o,a,c;return Ft(this,function(d){switch(d.label){case 0:if(!r.length)return i(),[2,[]];o=!1,i.then(function(){s(),o=!0}),d.label=1;case 1:d.trys.push([1,,6,8]),d.label=2;case 2:return o?[3,5]:(Promise.all(r.map(function(m){return m.next()})).then(function(m){return s(m)},function(m){return i(m)}),[4,new Promise(function(m){return s=m})]);case 3:return a=d.sent(),a===void 0?[2]:(c=a.map(function(m){return m.value}),a.some(function(m){return m.done})?[2,c]:[4,n(c)]);case 4:return d.sent(),[3,2];case 5:return[3,8];case 6:return i(),[4,Promise.all(r.map(function(m){return m.return&&m.return()}))];case 7:return d.sent(),[7];case 8:return[2]}})})})}function fy(t){var e=this,r=bi(t,{yieldValues:!0,returnValues:!0});return new Kt(function(n,i){return jr(e,void 0,void 0,function(){var s,o,a,c,d,m=this;return Ft(this,function(f){switch(f.label){case 0:if(!r.length)return i(),[2,[]];o=[],a=!1,i.then(function(){var g,_;s();try{for(var E=Dr(o),P=E.next();!P.done;P=E.next()){var S=P.value;S()}}catch(y){g={error:y}}finally{try{P&&!P.done&&(_=E.return)&&_.call(E)}finally{if(g)throw g.error}}a=!0}),f.label=1;case 1:return f.trys.push([1,,5,7]),Promise.all(r.map(function(g){return g.next()})).then(function(g){return s(g)},function(g){return i(g)}),[4,new Promise(function(g){return s=g})];case 2:return c=f.sent(),c===void 0?[2]:(d=c.map(function(g){return g.value}),c.every(function(g){return g.done})?[2,d]:[4,n(d.slice())]);case 3:return f.sent(),[4,Promise.all(r.map(function(g,_){return jr(m,void 0,void 0,function(){var E;return Ft(this,function(P){switch(P.label){case 0:if(c[_].done)return[2,c[_].value];P.label=1;case 1:return a?[3,4]:(Promise.resolve(g.next()).then(function(S){return o[_](S)},function(S){return i(S)}),[4,new Promise(function(S){return o[_]=S})]);case 2:return E=P.sent(),E===void 0?[2,c[_].value]:E.done?[2,E.value]:(d[_]=E.value,[4,n(d.slice())]);case 3:return P.sent(),[3,1];case 4:return[2]}})})}))];case 4:return[2,f.sent()];case 5:return i(),[4,Promise.all(r.map(function(g){return g.return&&g.return()}))];case 6:return f.sent(),[7];case 7:return[2]}})})})}var Yh=ls(Hh());I();R();T();var ou={};fs(ou,{JsonPatchError:()=>je,_areEquals:()=>Gn,applyOperation:()=>Sr,applyPatch:()=>Zr,applyReducer:()=>L1,deepClone:()=>D1,getValueByPointer:()=>os,validate:()=>Qh,validator:()=>as});I();R();T();I();R();T();var x1=function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var s in i)i.hasOwnProperty(s)&&(n[s]=i[s])},t(e,r)};return function(e,r){t(e,r);function n(){this.constructor=e}e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),j1=Object.prototype.hasOwnProperty;function ns(t,e){return j1.call(t,e)}function is(t){if(Array.isArray(t)){for(var e=new Array(t.length),r=0;r<e.length;r++)e[r]=""+r;return e}if(Object.keys)return Object.keys(t);var n=[];for(var i in t)ns(t,i)&&n.push(i);return n}function He(t){switch(typeof t){case"object":return JSON.parse(JSON.stringify(t));case"undefined":return null;default:return t}}function ss(t){for(var e=0,r=t.length,n;e<r;){if(n=t.charCodeAt(e),n>=48&&n<=57){e++;continue}return!1}return!0}function Nt(t){return t.indexOf("/")===-1&&t.indexOf("~")===-1?t:t.replace(/~/g,"~0").replace(/\//g,"~1")}function Mn(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}function rs(t){if(t===void 0)return!0;if(t){if(Array.isArray(t)){for(var e=0,r=t.length;e<r;e++)if(rs(t[e]))return!0}else if(typeof t=="object"){for(var n=is(t),i=n.length,s=0;s<i;s++)if(rs(t[n[s]]))return!0}}return!1}function Wh(t,e){var r=[t];for(var n in e){var i=typeof e[n]=="object"?JSON.stringify(e[n],null,2):e[n];typeof i<"u"&&r.push(n+": "+i)}return r.join(`
|
|
17
|
+
`)}var Un=function(t){x1(e,t);function e(r,n,i,s,o){var a=this.constructor,c=t.call(this,Wh(r,{name:n,index:i,operation:s,tree:o}))||this;return c.name=n,c.index=i,c.operation=s,c.tree=o,Object.setPrototypeOf(c,a.prototype),c.message=Wh(r,{name:n,index:i,operation:s,tree:o}),c}return e}(Error);var je=Un,D1=He,Xr={add:function(t,e,r){return t[e]=this.value,{newDocument:r}},remove:function(t,e,r){var n=t[e];return delete t[e],{newDocument:r,removed:n}},replace:function(t,e,r){var n=t[e];return t[e]=this.value,{newDocument:r,removed:n}},move:function(t,e,r){var n=os(r,this.path);n&&(n=He(n));var i=Sr(r,{op:"remove",path:this.from}).removed;return Sr(r,{op:"add",path:this.path,value:i}),{newDocument:r,removed:n}},copy:function(t,e,r){var n=os(r,this.from);return Sr(r,{op:"add",path:this.path,value:He(n)}),{newDocument:r}},test:function(t,e,r){return{newDocument:r,test:Gn(t[e],this.value)}},_get:function(t,e,r){return this.value=t[e],{newDocument:r}}},B1={add:function(t,e,r){return ss(e)?t.splice(e,0,this.value):t[e]=this.value,{newDocument:r,index:e}},remove:function(t,e,r){var n=t.splice(e,1);return{newDocument:r,removed:n[0]}},replace:function(t,e,r){var n=t[e];return t[e]=this.value,{newDocument:r,removed:n}},move:Xr.move,copy:Xr.copy,test:Xr.test,_get:Xr._get};function os(t,e){if(e=="")return t;var r={op:"_get",path:e};return Sr(t,r),r.value}function Sr(t,e,r,n,i,s){if(r===void 0&&(r=!1),n===void 0&&(n=!0),i===void 0&&(i=!0),s===void 0&&(s=0),r&&(typeof r=="function"?r(e,0,t,e.path):as(e,0)),e.path===""){var o={newDocument:t};if(e.op==="add")return o.newDocument=e.value,o;if(e.op==="replace")return o.newDocument=e.value,o.removed=t,o;if(e.op==="move"||e.op==="copy")return o.newDocument=os(t,e.from),e.op==="move"&&(o.removed=t),o;if(e.op==="test"){if(o.test=Gn(t,e.value),o.test===!1)throw new je("Test operation failed","TEST_OPERATION_FAILED",s,e,t);return o.newDocument=t,o}else{if(e.op==="remove")return o.removed=t,o.newDocument=null,o;if(e.op==="_get")return e.value=t,o;if(r)throw new je("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",s,e,t);return o}}else{n||(t=He(t));var a=e.path||"",c=a.split("/"),d=t,m=1,f=c.length,g=void 0,_=void 0,E=void 0;for(typeof r=="function"?E=r:E=as;;){if(_=c[m],_&&_.indexOf("~")!=-1&&(_=Mn(_)),i&&(_=="__proto__"||_=="prototype"&&m>0&&c[m-1]=="constructor"))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(r&&g===void 0&&(d[_]===void 0?g=c.slice(0,m).join("/"):m==f-1&&(g=e.path),g!==void 0&&E(e,0,t,g)),m++,Array.isArray(d)){if(_==="-")_=d.length;else{if(r&&!ss(_))throw new je("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",s,e,t);ss(_)&&(_=~~_)}if(m>=f){if(r&&e.op==="add"&&_>d.length)throw new je("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",s,e,t);var o=B1[e.op].call(e,d,_,t);if(o.test===!1)throw new je("Test operation failed","TEST_OPERATION_FAILED",s,e,t);return o}}else if(m>=f){var o=Xr[e.op].call(e,d,_,t);if(o.test===!1)throw new je("Test operation failed","TEST_OPERATION_FAILED",s,e,t);return o}if(d=d[_],r&&m<f&&(!d||typeof d!="object"))throw new je("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",s,e,t)}}}function Zr(t,e,r,n,i){if(n===void 0&&(n=!0),i===void 0&&(i=!0),r&&!Array.isArray(e))throw new je("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");n||(t=He(t));for(var s=new Array(e.length),o=0,a=e.length;o<a;o++)s[o]=Sr(t,e[o],r,!0,i,o),t=s[o].newDocument;return s.newDocument=t,s}function L1(t,e,r){var n=Sr(t,e);if(n.test===!1)throw new je("Test operation failed","TEST_OPERATION_FAILED",r,e,t);return n.newDocument}function as(t,e,r,n){if(typeof t!="object"||t===null||Array.isArray(t))throw new je("Operation is not an object","OPERATION_NOT_AN_OBJECT",e,t,r);if(Xr[t.op]){if(typeof t.path!="string")throw new je("Operation `path` property is not a string","OPERATION_PATH_INVALID",e,t,r);if(t.path.indexOf("/")!==0&&t.path.length>0)throw new je('Operation `path` property must start with "/"',"OPERATION_PATH_INVALID",e,t,r);if((t.op==="move"||t.op==="copy")&&typeof t.from!="string")throw new je("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",e,t,r);if((t.op==="add"||t.op==="replace"||t.op==="test")&&t.value===void 0)throw new je("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",e,t,r);if((t.op==="add"||t.op==="replace"||t.op==="test")&&rs(t.value))throw new je("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",e,t,r);if(r){if(t.op=="add"){var i=t.path.split("/").length,s=n.split("/").length;if(i!==s+1&&i!==s)throw new je("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",e,t,r)}else if(t.op==="replace"||t.op==="remove"||t.op==="_get"){if(t.path!==n)throw new je("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",e,t,r)}else if(t.op==="move"||t.op==="copy"){var o={op:"_get",path:t.from,value:void 0},a=Qh([o],r);if(a&&a.name==="OPERATION_PATH_UNRESOLVABLE")throw new je("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",e,t,r)}}}else throw new je("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",e,t,r)}function Qh(t,e,r){try{if(!Array.isArray(t))throw new je("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(e)Zr(He(e),He(t),r||!0);else{r=r||as;for(var n=0;n<t.length;n++)r(t[n],n,e,void 0)}}catch(i){if(i instanceof je)return i;throw i}}function Gn(t,e){if(t===e)return!0;if(t&&e&&typeof t=="object"&&typeof e=="object"){var r=Array.isArray(t),n=Array.isArray(e),i,s,o;if(r&&n){if(s=t.length,s!=e.length)return!1;for(i=s;i--!==0;)if(!Gn(t[i],e[i]))return!1;return!0}if(r!=n)return!1;var a=Object.keys(t);if(s=a.length,s!==Object.keys(e).length)return!1;for(i=s;i--!==0;)if(!e.hasOwnProperty(a[i]))return!1;for(i=s;i--!==0;)if(o=a[i],!Gn(t[o],e[o]))return!1;return!0}return t!==t&&e!==e}var fu={};fs(fu,{compare:()=>J1,generate:()=>au,observe:()=>V1,unobserve:()=>z1});I();R();T();var uu=new WeakMap,M1=function(){function t(e){this.observers=new Map,this.obj=e}return t}(),U1=function(){function t(e,r){this.callback=e,this.observer=r}return t}();function G1(t){return uu.get(t)}function F1(t,e){return t.observers.get(e)}function K1(t,e){t.observers.delete(e.callback)}function z1(t,e){e.unobserve()}function V1(t,e){var r=[],n,i=G1(t);if(!i)i=new M1(t),uu.set(t,i);else{var s=F1(i,e);n=s&&s.observer}if(n)return n;if(n={},i.value=He(t),e){n.callback=e,n.next=null;var o=function(){au(n)},a=function(){clearTimeout(n.next),n.next=setTimeout(o)};typeof window<"u"&&(window.addEventListener("mouseup",a),window.addEventListener("keyup",a),window.addEventListener("mousedown",a),window.addEventListener("keydown",a),window.addEventListener("change",a))}return n.patches=r,n.object=t,n.unobserve=function(){au(n),clearTimeout(n.next),K1(i,n),typeof window<"u"&&(window.removeEventListener("mouseup",a),window.removeEventListener("keyup",a),window.removeEventListener("mousedown",a),window.removeEventListener("keydown",a),window.removeEventListener("change",a))},i.observers.set(e,new U1(e,n)),n}function au(t,e){e===void 0&&(e=!1);var r=uu.get(t.object);cu(r.value,t.object,t.patches,"",e),t.patches.length&&Zr(r.value,t.patches);var n=t.patches;return n.length>0&&(t.patches=[],t.callback&&t.callback(n)),n}function cu(t,e,r,n,i){if(e!==t){typeof e.toJSON=="function"&&(e=e.toJSON());for(var s=is(e),o=is(t),a=!1,c=!1,d=o.length-1;d>=0;d--){var m=o[d],f=t[m];if(ns(e,m)&&!(e[m]===void 0&&f!==void 0&&Array.isArray(e)===!1)){var g=e[m];typeof f=="object"&&f!=null&&typeof g=="object"&&g!=null&&Array.isArray(f)===Array.isArray(g)?cu(f,g,r,n+"/"+Nt(m),i):f!==g&&(a=!0,i&&r.push({op:"test",path:n+"/"+Nt(m),value:He(f)}),r.push({op:"replace",path:n+"/"+Nt(m),value:He(g)}))}else Array.isArray(t)===Array.isArray(e)?(i&&r.push({op:"test",path:n+"/"+Nt(m),value:He(f)}),r.push({op:"remove",path:n+"/"+Nt(m)}),c=!0):(i&&r.push({op:"test",path:n,value:t}),r.push({op:"replace",path:n,value:e}),a=!0)}if(!(!c&&s.length==o.length))for(var d=0;d<s.length;d++){var m=s[d];!ns(t,m)&&e[m]!==void 0&&r.push({op:"add",path:n+"/"+Nt(m),value:He(e[m])})}}}function J1(t,e,r){r===void 0&&(r=!1);var n=[];return cu(t,e,n,"",r),n}var rI=Object.assign({},ou,fu,{JsonPatchError:Un,deepClone:He,escapePathComponent:Nt,unescapePathComponent:Mn});var us=class{db;source="local";tombstoneRetention=864e5;ajv;constructor(e){this.ajv=new Yh.default({strict:!1}),this.source=e?.sourceName??this.source,this.tombstoneRetention=e?.tombstoneRetention??this.tombstoneRetention;let r={name:"graffitiDb",...e?.pouchDBOptions};this.db=new fl(r.name,r),this.db.put({_id:"_design/indexes",views:{objectsPerChannelAndLastModified:{map:function(n){let i=n.lastModified.toString().padStart(15,"0");n.channels.forEach(function(s){let o=encodeURIComponent(s)+"/"+i;emit(o)})}.toString()},orphansPerActorAndLastModified:{map:function(n){if(n.channels.length===0){let i=n.lastModified.toString().padStart(15,"0"),s=encodeURIComponent(n.actor)+"/"+i;emit(s)}}.toString()},channelStatsPerActor:{map:function(n){n.tombstone||n.channels.forEach(function(i){let s=encodeURIComponent(n.actor)+"/"+encodeURIComponent(i);emit(s,n.lastModified)})}.toString(),reduce:"_stats"}}}).catch(n=>{if(!(n&&typeof n=="object"&&"name"in n&&n.name==="conflict"))throw n})}async queryByLocation(e){let r=Cr(e)+"/";return(await this.db.allDocs({startkey:r,endkey:r+"\uFFFF",include_docs:!0})).rows.map(s=>s.doc).reduce((s,o)=>(o&&s.push(o),s),[])}docId(e){return Cr(e)+"/"+mo()}get=async(...e)=>{let[r,n,i]=e,{location:s}=mi(r),a=(await this.queryByLocation(s)).filter(P=>yo(P,i));if(!a.length)throw new Jn;let c=a.reduce((P,S)=>ll(P,S)?P:S),{_id:d,_rev:m,_conflicts:f,_attachments:g,..._}=c;if(vo(_,[],i),!vi(this.ajv,n)(_))throw new Lc;return _};async deleteAtLocation(e,r=!1){let i=(await this.queryByLocation(e)).filter(f=>!f.tombstone);if(!i.length)return;let s=i.map(f=>f.lastModified).reduce((f,g)=>f>g?f:g),o=i.filter(f=>!r||f.lastModified<s),a=i.filter(f=>r&&f.lastModified===s);if(a.length){let f=a.map(_=>_._id).reduce((_,E)=>_>E?_:E),g=a.filter(_=>_._id!==f);o.push(...g)}let c=r?s:new Date().getTime(),d=await this.db.bulkDocs(o.map(f=>({...f,tombstone:!0,lastModified:c}))),m;for(let f of d)if("ok"in f){let{id:g}=f,_=o.find(E=>E._id===g);if(_){let{_id:E,_rev:P,_conflicts:S,_attachments:y,...w}=_;m={...w,tombstone:!0,lastModified:c};break}}return m}delete=async(...e)=>{let[r,n]=e,{location:i}=mi(r);if(i.actor!==n.actor)throw new tn;let s=await this.deleteAtLocation(i);if(!s)throw new Jn;return s};put=async(...e)=>{let[r,n]=e;if(r.actor&&r.actor!==n.actor)throw new tn;if(r.source&&r.source!==this.source)throw new tn("Putting an object that does not match this source");let i={value:r.value,channels:r.channels,allowed:r.allowed,name:r.name??mo(),source:this.source,actor:n.actor,tombstone:!1,lastModified:new Date().getTime()};await this.db.put({_id:this.docId(i),...i});let s=await this.deleteAtLocation(i,!0);return s||{...i,value:{},channels:[],allowed:void 0,tombstone:!0}};patch=async(...e)=>{let[r,n,i]=e,{location:s}=mi(n);if(s.actor!==i.actor)throw new tn;let o=await this.get(n,{},i);if(o.tombstone)throw new Jn("The object you are trying to patch has been deleted");let a={...o};for(let c of["value","channels","allowed"])dl(Zr,c,r,a);if(typeof a.value!="object"||Array.isArray(a.value)||!a.value)throw new Ar("value is no longer an object");if(!Array.isArray(a.channels)||!a.channels.every(c=>typeof c=="string"))throw new Ar("channels are no longer an array of strings");if(a.allowed&&(!Array.isArray(a.allowed)||!a.allowed.every(c=>typeof c=="string")))throw new Ar("allowed list is not an array of strings");return a.lastModified=new Date().getTime(),await this.db.put({...a,_id:this.docId(a)}),await this.deleteAtLocation(a,!0),{...o,tombstone:!0,lastModified:a.lastModified}};queryLastModifiedSuffixes(e){let r="",n="\uFFFF";if(typeof e=="object"&&e.properties?.lastModified&&typeof e.properties.lastModified=="object"){let i=e.properties.lastModified,s=i.minimum,o=i.exclusiveMinimum,a;o!==void 0?(a=Math.ceil(o),a===o&&a++):s!==void 0&&(a=Math.ceil(s)),a!==void 0&&(r=a.toString().padStart(15,"0"));let c=i.maximum,d=i.exclusiveMaximum,m;d!==void 0?(m=Math.floor(d),m===d&&m--):c!==void 0&&(m=Math.floor(c)),m!==void 0&&(n=m.toString().padStart(15,"0"))}return{startKeySuffix:r,endKeySuffix:n}}discover=(...e)=>{let[r,n,i]=e,s=vi(this.ajv,n),{startKeySuffix:o,endKeySuffix:a}=this.queryLastModifiedSuffixes(n);return new Kt(async(d,m)=>{let f=new Set;for(let g of r){let _=encodeURIComponent(g)+"/",E=_+o,P=_+a,S=await this.db.query("indexes/objectsPerChannelAndLastModified",{startkey:E,endkey:P,include_docs:!0});for(let y of S.rows){let w=y.doc;if(!w)continue;let{_id:p,_rev:h,...v}=w;f.has(p)||(f.add(p),yo(w,i)&&(vo(v,r,i),s(v)&&await d({value:v})))}}return m(),{tombstoneRetention:this.tombstoneRetention}})};recoverOrphans=(e,r)=>{let n=vi(this.ajv,e),{startKeySuffix:i,endKeySuffix:s}=this.queryLastModifiedSuffixes(e),o=encodeURIComponent(r.actor)+"/",a=o+i,c=o+s;return new Kt(async(m,f)=>{let g=await this.db.query("indexes/orphansPerActorAndLastModified",{startkey:a,endkey:c,include_docs:!0});for(let _ of g.rows){let E=_.doc;if(!E)continue;let{_id:P,_rev:S,...y}=E;n(y)&&await m({value:y})}return f(),{tombstoneRetention:this.tombstoneRetention}})};channelStats=e=>new Kt(async(n,i)=>{let s=encodeURIComponent(e.actor)+"/",o=await this.db.query("indexes/channelStatsPerActor",{startkey:s,endkey:s+"\uFFFF",reduce:!0,group:!0});for(let a of o.rows){let c=a.key.split("/")[1];if(typeof c!="string")continue;let{count:d,max:m}=a.value;typeof d!="number"||typeof m!="number"||await n({value:{channel:decodeURIComponent(c),count:d,lastModified:m}})}i()})};var Xh=class extends Cc{locationToUri=Cr;uriToLocation=po;sessionManagerLocal=new Hn;login=this.sessionManagerLocal.login.bind(this.sessionManagerLocal);logout=this.sessionManagerLocal.logout.bind(this.sessionManagerLocal);sessionEvents=this.sessionManagerLocal.sessionEvents;put;get;patch;delete;discover;recoverOrphans;channelStats;constructor(e){super();let r=new us(e);this.put=r.put.bind(r),this.get=r.get.bind(r),this.patch=r.patch.bind(r),this.delete=r.delete.bind(r),this.discover=r.discover.bind(r),this.recoverOrphans=r.recoverOrphans.bind(r),this.channelStats=r.channelStats.bind(r)}};export{Xh as GraffitiLocal};
|
|
18
18
|
/*! Bundled license information:
|
|
19
19
|
|
|
20
20
|
@jspm/core/nodelibs/browser/chunk-DtuTasat.js:
|