zeed 0.8.64 → 0.9.2
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/dist/{chunk-VOUZGWTC.js → chunk-5KHLXHN6.js} +5 -5
- package/dist/chunk-5KHLXHN6.js.map +1 -0
- package/dist/index.all.d.ts +3 -1
- package/dist/index.browser.cjs +3 -3
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.d.ts +2 -2
- package/dist/index.browser.js +1 -1
- package/dist/index.browser.js.map +1 -1
- package/dist/index.node.cjs +9 -9
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.d.ts +2 -2
- package/dist/index.node.js +6 -6
- package/dist/index.node.js.map +1 -1
- package/dist/{uuid-89986670.d.ts → uuid-c2cc7aa0.d.ts} +3 -1
- package/package.json +6 -6
- package/dist/chunk-VOUZGWTC.js.map +0 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
var It=Object.defineProperty;var r=(e,t)=>It(e,"name",{value:t,configurable:!0});function Ct(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;if(typeof globalThis<"u")return globalThis;throw new Error("unable to locate global object")}r(Ct,"_global");function Y(){let e=Ct();return e._zeedGlobal==null&&(e._zeedGlobal={}),e._zeedGlobal}r(Y,"getGlobalContext");function re(e={}){let{level:t=void 0,filter:n=void 0}=e,o=V(n),i=ne(t);return s=>{if(!i(s.level)||!o(s.name))return;let u=s.name?`[${s.name}]`:"";switch(s.level){case 1:console.info(`I|* ${u}`,...s.messages);break;case 2:console.warn(`W|** ${u}`,...s.messages);break;case 3:console.error(`E|*** ${u}`,...s.messages);break;default:console.debug(`D| ${u}`,...s.messages);break}}}r(re,"LoggerConsoleHandler");var Q=(a=>(a[a.all=-1]="all",a[a.debug=0]="debug",a[a.info=1]="info",a[a.warn=2]="warn",a[a.error=3]="error",a[a.fatal=4]="fatal",a[a.off=1/0]="off",a))(Q||{}),_e={"*":-1,a:-1,all:-1,d:0,dbg:0,debug:0,i:1,inf:1,info:1,w:2,warn:2,warning:2,e:3,err:3,error:3,fatal:4,off:1/0,"-":1/0};function ze(e=""){let t=[re()],n=r(c=>!0,"logCheckNamespace"),o=!1,i=u,s=!1;function u(c="",l){let f=me(l??-1);function
|
|
2
|
-
`)}r(Ye,"Uint8ArrayToHexDump");function q(e=16){let t=new Uint8Array(e);if(typeof crypto<"u"&&crypto.getRandomValues)crypto.getRandomValues(t);else for(let n=0;n<e;n++)t[n]=Math.floor(Math.random()*256);return t}r(q,"randomUint8Array");var Xe="SHA-256",be="AES-GCM",Qe="PBKDF2",Gt=1e5;async function Ur(e,t=Xe){return P(await crypto.subtle.digest(t,P(e)))}r(Ur,"digest");async function kr(e,t={}){let n=P(e),o=await crypto.subtle.importKey("raw",n,Qe,!1,["deriveKey"]);return await crypto.subtle.deriveKey({name:Qe,salt:t.salt?P(t.salt):new Uint8Array(0),iterations:t.iterations??Gt,hash:Xe},o,{name:be,length:256},!0,["encrypt","decrypt"])}r(kr,"deriveKeyPbkdf2");var se=new Uint8Array([1,1]);async function et(e,t){let n=q(12),o=await crypto.subtle.encrypt({name:be,iv:n},t,e),i=new Uint8Array(o),s=se.length+n.length+i.length,u=new Uint8Array(s),a=0;return u.set(se,a),a+=se.length,u.set(n,a),a+=n.length,u.set(i,a),u}r(et,"encrypt");async function tt(e,t){let n=e.subarray(0,2);if(!Ke(n,se))return Promise.reject(new Error(`Unknown magic ${n}`));let o=e.subarray(2,2+12),i=e.subarray(2+12,e.length),s=await crypto.subtle.decrypt({name:be,iv:o},t,i);return new Uint8Array(s)}r(tt,"decrypt");function Vt(){return crypto.getRandomValues(new Uint32Array(1))[0]/4294967295}r(Vt,"getSecureRandom");function D(){return typeof crypto<"u"?Vt():Math.random()}r(D,"getSecureRandomIfPossible");function Cr(e=.25){return D()<e}r(Cr,"randomBoolean");function Or(e=100,t=0){return t+Math.floor(D()*(e-t))}r(Or,"randomInt");function $r(e=100,t=0){return t+D()*(e-t)}r($r,"randomFloat");function Br(e,t,n){return Math.max(e,Math.min(n,t))}r(Br,"between");function qt(e){return e.reduce((t,n)=>t+n,0)}r(qt,"sum");function jr(e){return qt(e)/e.length}r(jr,"avg");function Hr(e){return!/^1?$|^(11+?)\1+$/.test("1".repeat(e))}r(Hr,"isPrimeRX");function _r(e){for(let t=2;t<e;t++)if(e%t===0)return!1;return e>1}r(_r,"isPrime");var Te=6;function zr(e=0,t=1,n){Te=((n??Te)*9301+49297)%233280;let o=Te/233280;return t+o*(e-t)}r(zr,"seededRandom");function Jt(e=""){let[t="",n="asc"]=e.split(" ");return n=n.toLowerCase(),{field:t,orderby:n,asc:n!=="desc",desc:n==="desc"}}r(Jt,"parseOrderby");function Vr(e,t=!0){return`${e} ${t?"asc":"desc"}`}r(Vr,"composeOrderby");function we(e,t,n=!0){let o=e||0,i=t||0;return o>i?n?1:-1:o<i?n?-1:1:0}r(we,"cmp");function qr(e,...t){if(t.length>0){let n=t.map(Jt),o=Array.from(e);return o.sort((i,s)=>{for(let{field:u,asc:a}of n){let c=we(i[u],s[u],a);if(c!==0)return c}return 0}),o}return e}r(qr,"sortedOrderby");function Le(e){return e.filter((t,n)=>e.indexOf(t)===n)}r(Le,"arrayUnique");function Zt(e,t){return Le(e.filter(n=>!t.includes(n)))}r(Zt,"arrayMinus");function Wt(...e){return Le(e.reduce((t=[],n)=>t.concat(n),[]))}r(Wt,"arrayUnion");function J(...e){return e.flat(1/0)}r(J,"arrayFlatten");function Kt(e,t){return Le(e).filter(n=>t.includes(n))}r(Kt,"arrayIntersection");function Yr(e,t){return Zt(Wt(e,t),Kt(e,t))}r(Yr,"arraySymmetricDifference");function Qr(e,t){if(e&&Array.isArray(e)){let n;for(;(n=e.indexOf(t))!==-1;)e.splice(n,1);return e}return[]}r(Qr,"arrayRemoveElement");function Xr(e,t){return e.includes(t)||e.push(t),e}r(Xr,"arraySetElement");function Ae(e,t){return e.splice(0,e.length,...e.filter(t)),e}r(Ae,"arrayFilterInPlace");function eo(e,t){let n=e.findIndex(o=>o===t);return n>=0?e.splice(n,1):e.push(t),e}r(eo,"arrayToggleInPlace");function to(e){return e.splice(0,e.length),e}r(to,"arrayEmptyInPlace");function Yt(e,t=we){return Array.from(e).sort(t)}r(Yt,"arraySorted");function no(e){return Yt(e,(t,n)=>t-n)}r(no,"arraySortedNumbers");function Qt(e,t){return e.length===t.length&&e.every((n,o)=>n===t[o])}r(Qt,"arrayIsEqual");function nt(e){return e.sort(()=>D()>.5?1:-1),e}r(nt,"arrayShuffleInPlace");function ro(e){return nt(Array.from(e))}r(ro,"arrayShuffle");function oo(e){for(;e.length>1;){let t=Array.from(e);if(nt(t),!Qt(e,t))return t}return e}r(oo,"arrayShuffleForce");function io(e){return e[Math.floor(D()*e.length)]}r(io,"arrayRandomElement");function so(...e){return J(e).reduce((t,n)=>t!=null?n>t?n:t:n,void 0)}r(so,"arrayMax");function ao(...e){return J(e).reduce((t,n)=>t!=null?n<t?n:t:n,void 0)}r(ao,"arrayMin");function uo(...e){return J(e).reduce((t,n)=>t+n,0)}r(uo,"arraySum");function co(...e){let t=J(e);return t.reduce((n,o)=>n+o,0)/t.length}r(co,"arrayAvg");function lo(e,t){let n=[],o=0,i=e.length;for(;o<i;)n.push(e.slice(o,o+=t));return n}r(lo,"arrayBatches");function fo(e=0,t){if(e<=0)return[];let n=new Array(e);for(let o=0;o<e;o++)n[o]=t instanceof Function?t(o):t;return n}r(fo,"createArray");var Xt=A("zeed:basex","error"),en={2:"01",8:"01234567",11:"0123456789a",16:"0123456789abcdef",32:"0123456789abcdefghjkmnpqrtuvwxyz","32-crockford":"0123456789ABCDEFGHJKMNPQRSTVWXYZ","32-geohash":"0123456789bcdefghjkmnpqrstuvwxyz","32-agnoster":"0123456789abcdefghjkmnpqrtuvwxyz","32-rfc":"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567","32-hex":"0123456789ABCDEFGHIJKLMNOPQRSTUV","32-zbase":"ybndrfg8ejkmcpqxot1uwisza345h769",36:"0123456789abcdefghijklmnopqrstuvwxyz",58:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",62:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",64:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/","64-url":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",66:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.!~",85:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!#$%&()*+-;<=>?@^_`{|}~"};function j(e){let t=en[String(e)];if(!t)if(typeof e=="string")t=e;else throw new Error(`Unknown base ${e}`);if(t.length>=255)throw new TypeError("Alphabet too long");let n=new Uint8Array(256);for(let l=0;l<n.length;l++)n[l]=255;for(let l=0;l<t.length;l++){let f=t.charAt(l),
|
|
1
|
+
var It=Object.defineProperty;var r=(e,t)=>It(e,"name",{value:t,configurable:!0});function Ct(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;if(typeof globalThis<"u")return globalThis;throw new Error("unable to locate global object")}r(Ct,"_global");function Y(){let e=Ct();return e._zeedGlobal==null&&(e._zeedGlobal={}),e._zeedGlobal}r(Y,"getGlobalContext");function re(e={}){let{level:t=void 0,filter:n=void 0}=e,o=V(n),i=ne(t);return s=>{if(!i(s.level)||!o(s.name))return;let u=s.name?`[${s.name}]`:"";switch(s.level){case 1:console.info(`I|* ${u}`,...s.messages);break;case 2:console.warn(`W|** ${u}`,...s.messages);break;case 3:console.error(`E|*** ${u}`,...s.messages);break;default:console.debug(`D| ${u}`,...s.messages);break}}}r(re,"LoggerConsoleHandler");var Q=(a=>(a[a.all=-1]="all",a[a.debug=0]="debug",a[a.info=1]="info",a[a.warn=2]="warn",a[a.error=3]="error",a[a.fatal=4]="fatal",a[a.off=1/0]="off",a))(Q||{}),_e={"*":-1,a:-1,all:-1,d:0,dbg:0,debug:0,i:1,inf:1,info:1,w:2,warn:2,warning:2,e:3,err:3,error:3,fatal:4,off:1/0,"-":1/0};function ze(e=""){let t=[re()],n=r(c=>!0,"logCheckNamespace"),o=!1,i=u,s=!1;function u(c="",l){let f=me(l??-1);function d(m,p){return f<=m?p:()=>{}}r(d,"defineForLogLevel");let h=d(0,(...m)=>{x({name:c,messages:m,level:0})});h.label=c,h.extend=function(m){return i(c?`${c}:${m}`:m)};let x=r(m=>{if(n(c))for(let p of t)p&&p(m)},"emit");return h.debug=d(0,(...m)=>{x({name:c,messages:m,level:0})}),h.info=d(1,(...m)=>{x({name:c,messages:m,level:1})}),h.warn=d(2,(...m)=>{x({name:c,messages:m,level:2})}),h.error=d(3,(...m)=>{x({name:c,messages:m,level:3})}),h.fatal=d(4,(...m)=>{throw x({name:c,messages:m,level:4}),new Error(`${m.map(String).join(" ")}`)}),h.assert=d(4,(m,...p)=>{m||h.fatal(...p)}),h}r(u,"LoggerBaseFactory");function a(c="",l){let f=i(c,l);return s&&f.debug(`+++ init of logger "${c}" on level "${Q[f.level]}".`),f}return r(a,"Logger"),a.registerHandler=function(c){t.push(c)},a.setFilter=function(c){n=V(c)},a.setLock=(c=!0)=>o=c,a.setDebug=(c=!0)=>s=c,a.setHandlers=function(c=[]){i!==u&&(i=u),!o&&(t=[...c].filter(l=>typeof l=="function"))},a.level=-1,a.setLogLevel=function(c=-1){o||(a.level=c)},a.setFactory=function(c){o||(i=c)},a}r(ze,"LoggerContext");function Ot(e){return e===!0||e==="true"||e==="1"||typeof e=="number"&&e!==0?e="*":e===!1||e==="false"||e===0||e==="0"||e==null||e==="null"||e==="undefined"?e="":e=String(e),e}r(Ot,"getNamespaceFilterString");var $t=Ot(typeof process<"u"?process.env.ZEED??process.env.DEBUG:typeof localStorage<"u"?localStorage.zeed??localStorage.debug:"*");function V(e=$t){let t,n=[],o=[];if(!e)t=r(function(i){return!1},"fn");else if(e==="*")t=r(function(i){return!0},"fn");else{let i,s=e.split(/[\s,]+/),u=s.length;for(i=0;i<u;i++){if(!s[i])continue;let a=s[i].replace(/\*/g,".*?");a[0]==="-"?n.push(new RegExp(`^${a.substr(1)}$`)):o.push(new RegExp(`^${a}$`))}t=r(function(a){if(n.length===0&&o.length===0)return!0;let c,l;for(c=0,l=n.length;c<l;c++)if(n[c].test(a))return!1;for(c=0,l=o.length;c<l;c++)if(o[c].test(a))return!0;return!1},"fn")}return t.accept=o,t.reject=n,t.filter=e,t}r(V,"useNamespaceFilter");var Bt=typeof process<"u"?process.env.ZEED_LEVEL??process.env.LEVEL??process.env.DEBUG_LEVEL:typeof localStorage<"u"?localStorage.zeed_level??localStorage.level??localStorage.debug_level:void 0;function me(e){if(e===!1)return 1/0;if(typeof e=="number")return e;if(typeof e=="string"){let t=_e[e.toLocaleLowerCase().trim()];if(t!=null)return t}return-1}r(me,"parseLogLevel");function ne(e=Bt){let t=me(e);return n=>n>=t}r(ne,"useLevelFilter");var B;function ye(){let e=ze();return e.setHandlers([re()]),e}r(ye,"getLoggerContext");function jt(){if(B==null)try{let e=Y();e!=null?e?.logger==null?(B=ye(),e.logger=B):B=e.logger:B=ye()}catch{B=ye()}return B}r(jt,"getGlobalLogger");var A=jt();var Ne=r((e,t)=>t instanceof Object&&!Array.isArray(t)?Object.keys(t).sort().reduce((n,o)=>(n[o]=t[o],n),{}):t,"_sortedReplacer");function br(e,t=void 0){return JSON.stringify(e,Ne,t)}r(br,"jsonStringifySorted");function Ht(e,t){let n=[],o=[];return t==null&&(t=r(function(i,s){return n[0]===s?"[Circular ~]":`[Circular ~.${o.slice(0,n.indexOf(s)).join(".")}]`},"cycleReplacer")),function(i,s){if(n.length>0){let u=n.indexOf(this);~u?n.splice(u+1):n.push(this),~u?o.splice(u,1/0,i):o.push(i),~n.indexOf(s)&&(s=t?.call(this,i,s))}else n.push(s);s=Ne(i,s);try{return e==null?s:e.call(this,i,s)}catch{}return String(s)}}r(Ht,"serializer");function S(e,t,n,o){return JSON.stringify(e,Ht(t,o),n)}r(S,"jsonStringifySafe");var Tr=S;var Ge=A("zeed:bin","error");function _t(e){let t=unescape(encodeURIComponent(e)),n=t.length,o=new Uint8Array(n);for(let i=0;i<n;i++)o[i]=t.codePointAt(i)||0;return o}r(_t,"_encodeUtf8Polyfill");function zt(e){let t=e.length,n="",o=0;for(;t>0;){let i=t<1e4?t:1e4,s=e.subarray(o,o+i);o+=i,n+=String.fromCodePoint.apply(null,s),t-=i}return decodeURIComponent(escape(n))}r(zt,"_decodeUtf8Polyfill");var oe;function Ve(e){if(oe==null&&(oe=_t,typeof TextEncoder<"u")){let t=new TextEncoder;oe=r(n=>t.encode(n),"_textEncoder")}return oe(e.normalize("NFC"))}r(Ve,"stringToUInt8Array");var ie;function qe(e){if(ie==null&&(ie=zt,typeof TextDecoder<"u")){let t=new TextDecoder("utf-8",{ignoreBOM:!0});ie=r(n=>t.decode(n),"_textDecoder")}return ie(e).normalize("NFC")}r(qe,"Uint8ArrayToString");function P(e){return e instanceof ArrayBuffer?new Uint8Array(e):typeof e=="string"?Ve(e):e.length?new Uint8Array(e):e}r(P,"toUint8Array");function Dr(...e){let t=0,n=e.flat(1).map(s=>{let u=P(s);return t+=u.length,u}),o=new Uint8Array(t),i=0;for(let s of n)o.set(s,i),i+=s.length;return o}r(Dr,"joinToUint8Array");function Je(e){if(typeof Buffer<"u")return Buffer.from(P(e)).toString("hex");let t="0123456789abcdef",n="";for(let o of[...P(e)])n+=t[o>>4]+t[o&15];return n}r(Je,"toHex");function Ze(e){return Uint8Array.from(e.match(/.{1,2}/g).map(t=>parseInt(t,16)))}r(Ze,"fromHex");function We(e,t=!1){let n=P(e),o="";if(typeof Buffer<"u")o=Buffer.from(n).toString("base64");else{let i="";for(let s=0;s<n.byteLength;s++)i+=String.fromCharCode(n[s]);o=btoa(i)}return t?o.replaceAll("=",""):o}r(We,"toBase64");function Pr(e){let t=P(e);if(typeof Buffer<"u")return Buffer.from(t).toString("base64url").replaceAll("=","");let n="";for(let o=0;o<t.byteLength;o++)n+=String.fromCharCode(t[o]);return btoa(n).replaceAll("+","-").replaceAll("/","_").replaceAll("=","")}r(Pr,"toBase64Url");function Nt(e){if(e=e.replaceAll("-","+").replaceAll("_","/"),typeof Buffer<"u"){let o=Buffer.from(e,"base64");return new Uint8Array(o.buffer,o.byteOffset,o.byteLength)}let t=atob(e),n=new Uint8Array(t.length);for(let o=0;o<t.length;o++)n[o]=t.charCodeAt(o);return n}r(Nt,"fromBase64");function Er(e){return qe(Nt(e))}r(Er,"fromBase64String");function Ke(e,t){if(e.byteLength!==t.byteLength)return!1;let n=P(e),o=P(t);for(let i=0;i<n.length;i++)if(n[i]!==o[i])return!1;return!0}r(Ke,"equalBinary");function he(e){try{return Ve(S(e))}catch(t){throw Ge.warn("jsonToUint8Array",e),t}}r(he,"jsonToUint8Array");function xe(e){try{return JSON.parse(qe(e))}catch(t){throw Ge.warn("Uint8ArrayToJson",e),t}}r(xe,"Uint8ArrayToJson");function Ye(e,t){if(typeof e!="string")if(e instanceof ArrayBuffer&&e.byteLength!==void 0)e=String.fromCharCode.apply(String,[].slice.call(new Uint8Array(e)));else if(Array.isArray(e))e=String.fromCharCode.apply(String,e);else if(e.constructor===Uint8Array)e=String.fromCharCode.apply(String,[].slice.call(e));else return!1;t=t||16;let n=[],o="0123456789ABCDEF";for(let i=0;i<e.length;i+=t){let s=e.slice(i,Math.min(i+t,e.length)),u=`0000${i.toString(16)}`.slice(-4),a=s.split("").map(l=>{let f=l.charCodeAt(0);return` ${o[(240&f)>>4]}${o[15&f]}`}).join("");a+=" ".repeat(t-s.length);let c=s.replace(/[\x00-\x1F\x20]/g,".");c+=" ".repeat(t-s.length),n.push(`${u} ${a} ${c}`)}return n.join(`
|
|
2
|
+
`)}r(Ye,"Uint8ArrayToHexDump");function q(e=16){let t=new Uint8Array(e);if(typeof crypto<"u"&&crypto.getRandomValues)crypto.getRandomValues(t);else for(let n=0;n<e;n++)t[n]=Math.floor(Math.random()*256);return t}r(q,"randomUint8Array");var Xe="SHA-256",be="AES-GCM",Qe="PBKDF2",Gt=1e5;async function Ur(e,t=Xe){return P(await crypto.subtle.digest(t,P(e)))}r(Ur,"digest");async function kr(e,t={}){let n=P(e),o=await crypto.subtle.importKey("raw",n,Qe,!1,["deriveKey"]);return await crypto.subtle.deriveKey({name:Qe,salt:t.salt?P(t.salt):new Uint8Array(0),iterations:t.iterations??Gt,hash:Xe},o,{name:be,length:256},!0,["encrypt","decrypt"])}r(kr,"deriveKeyPbkdf2");var se=new Uint8Array([1,1]);async function et(e,t){let n=q(12),o=await crypto.subtle.encrypt({name:be,iv:n},t,e),i=new Uint8Array(o),s=se.length+n.length+i.length,u=new Uint8Array(s),a=0;return u.set(se,a),a+=se.length,u.set(n,a),a+=n.length,u.set(i,a),u}r(et,"encrypt");async function tt(e,t){let n=e.subarray(0,2);if(!Ke(n,se))return Promise.reject(new Error(`Unknown magic ${n}`));let o=e.subarray(2,2+12),i=e.subarray(2+12,e.length),s=await crypto.subtle.decrypt({name:be,iv:o},t,i);return new Uint8Array(s)}r(tt,"decrypt");function Vt(){return crypto.getRandomValues(new Uint32Array(1))[0]/4294967295}r(Vt,"getSecureRandom");function D(){return typeof crypto<"u"?Vt():Math.random()}r(D,"getSecureRandomIfPossible");function Cr(e=.25){return D()<e}r(Cr,"randomBoolean");function Or(e=100,t=0){return t+Math.floor(D()*(e-t))}r(Or,"randomInt");function $r(e=100,t=0){return t+D()*(e-t)}r($r,"randomFloat");function Br(e,t,n){return Math.max(e,Math.min(n,t))}r(Br,"between");function qt(e){return e.reduce((t,n)=>t+n,0)}r(qt,"sum");function jr(e){return qt(e)/e.length}r(jr,"avg");function Hr(e){return!/^1?$|^(11+?)\1+$/.test("1".repeat(e))}r(Hr,"isPrimeRX");function _r(e){for(let t=2;t<e;t++)if(e%t===0)return!1;return e>1}r(_r,"isPrime");var Te=6;function zr(e=0,t=1,n){Te=((n??Te)*9301+49297)%233280;let o=Te/233280;return t+o*(e-t)}r(zr,"seededRandom");function Jt(e=""){let[t="",n="asc"]=e.split(" ");return n=n.toLowerCase(),{field:t,orderby:n,asc:n!=="desc",desc:n==="desc"}}r(Jt,"parseOrderby");function Vr(e,t=!0){return`${e} ${t?"asc":"desc"}`}r(Vr,"composeOrderby");function we(e,t,n=!0){let o=e||0,i=t||0;return o>i?n?1:-1:o<i?n?-1:1:0}r(we,"cmp");function qr(e,...t){if(t.length>0){let n=t.map(Jt),o=Array.from(e);return o.sort((i,s)=>{for(let{field:u,asc:a}of n){let c=we(i[u],s[u],a);if(c!==0)return c}return 0}),o}return e}r(qr,"sortedOrderby");function Le(e){return e.filter((t,n)=>e.indexOf(t)===n)}r(Le,"arrayUnique");function Zt(e,t){return Le(e.filter(n=>!t.includes(n)))}r(Zt,"arrayMinus");function Wt(...e){return Le(e.reduce((t=[],n)=>t.concat(n),[]))}r(Wt,"arrayUnion");function J(...e){return e.flat(1/0)}r(J,"arrayFlatten");function Kt(e,t){return Le(e).filter(n=>t.includes(n))}r(Kt,"arrayIntersection");function Yr(e,t){return Zt(Wt(e,t),Kt(e,t))}r(Yr,"arraySymmetricDifference");function Qr(e,t){if(e&&Array.isArray(e)){let n;for(;(n=e.indexOf(t))!==-1;)e.splice(n,1);return e}return[]}r(Qr,"arrayRemoveElement");function Xr(e,t){return e.includes(t)||e.push(t),e}r(Xr,"arraySetElement");function Ae(e,t){return e.splice(0,e.length,...e.filter(t)),e}r(Ae,"arrayFilterInPlace");function eo(e,t){let n=e.findIndex(o=>o===t);return n>=0?e.splice(n,1):e.push(t),e}r(eo,"arrayToggleInPlace");function to(e){return e.splice(0,e.length),e}r(to,"arrayEmptyInPlace");function Yt(e,t=we){return Array.from(e).sort(t)}r(Yt,"arraySorted");function no(e){return Yt(e,(t,n)=>t-n)}r(no,"arraySortedNumbers");function Qt(e,t){return e.length===t.length&&e.every((n,o)=>n===t[o])}r(Qt,"arrayIsEqual");function nt(e){return e.sort(()=>D()>.5?1:-1),e}r(nt,"arrayShuffleInPlace");function ro(e){return nt(Array.from(e))}r(ro,"arrayShuffle");function oo(e){for(;e.length>1;){let t=Array.from(e);if(nt(t),!Qt(e,t))return t}return e}r(oo,"arrayShuffleForce");function io(e){return e[Math.floor(D()*e.length)]}r(io,"arrayRandomElement");function so(...e){return J(e).reduce((t,n)=>t!=null?n>t?n:t:n,void 0)}r(so,"arrayMax");function ao(...e){return J(e).reduce((t,n)=>t!=null?n<t?n:t:n,void 0)}r(ao,"arrayMin");function uo(...e){return J(e).reduce((t,n)=>t+n,0)}r(uo,"arraySum");function co(...e){let t=J(e);return t.reduce((n,o)=>n+o,0)/t.length}r(co,"arrayAvg");function lo(e,t){let n=[],o=0,i=e.length;for(;o<i;)n.push(e.slice(o,o+=t));return n}r(lo,"arrayBatches");function fo(e=0,t){if(e<=0)return[];let n=new Array(e);for(let o=0;o<e;o++)n[o]=t instanceof Function?t(o):t;return n}r(fo,"createArray");var Xt=A("zeed:basex","error"),en={2:"01",8:"01234567",11:"0123456789a",16:"0123456789abcdef",32:"0123456789abcdefghjkmnpqrtuvwxyz","32-crockford":"0123456789ABCDEFGHJKMNPQRSTVWXYZ","32-geohash":"0123456789bcdefghjkmnpqrstuvwxyz","32-agnoster":"0123456789abcdefghjkmnpqrtuvwxyz","32-rfc":"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567","32-hex":"0123456789ABCDEFGHIJKLMNOPQRSTUV","32-zbase":"ybndrfg8ejkmcpqxot1uwisza345h769",36:"0123456789abcdefghijklmnopqrstuvwxyz",58:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",62:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",64:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/","64-url":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",66:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.!~",85:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!#$%&()*+-;<=>?@^_`{|}~"};function j(e){let t=en[String(e)];if(!t)if(typeof e=="string")t=e;else throw new Error(`Unknown base ${e}`);if(t.length>=255)throw new TypeError("Alphabet too long");let n=new Uint8Array(256);for(let l=0;l<n.length;l++)n[l]=255;for(let l=0;l<t.length;l++){let f=t.charAt(l),d=f.charCodeAt(0);if(n[d]!==255)throw new TypeError(`${f} is ambiguous`);n[d]=l}let o=t.length,i=t.charAt(0),s=Math.log(o)/Math.log(256),u=Math.log(256)/Math.log(o);function a(l,f=-1){let d=P(l);if(d.byteLength===0)return"";let h=0,x=0,m=d.byteLength;for(;x!==m&&d[x]===0;)x++;let p=(m-x)*u+1>>>0,g=new Uint8Array(p);for(;x!==m;){let b=d[x],w=0;for(let v=p-1;(b!==0||w<h)&&v!==-1;v--,w++)b+=256*g[v]>>>0,g[v]=b%o>>>0,b=b/o>>>0;if(b!==0)throw Xt.warn("Non-zero carry",d,f,w,p),new Error("Non-zero carry");h=w,x++}let y=p-h;for(;y!==p&&g[y]===0;)y++;let T="";for(;y<p;++y)T+=t.charAt(g[y]);return f>0?T.padStart(f,i):T}r(a,"encode");function c(l,f=-1){if(typeof l!="string")throw new TypeError("Expected String");if(l.length===0)return new Uint8Array;l=l.replace(/\s+/gi,"");let d=0,h=0;for(;l[d]===i;)d++;let x=(l.length-d)*s+1>>>0,m=new Uint8Array(x);for(;l[d];){let g=n[l.charCodeAt(d)];if(g===255)throw new Error(`Unsupported character "${l[d]}"`);let y=0;for(let T=x-1;(g!==0||y<h)&&T!==-1;T--,y++)g+=o*m[T]>>>0,m[T]=g%256>>>0,g=g/256>>>0;if(g!==0)throw new Error("Non-zero carry");h=y,d++}let p=x-h;for(;p!==x&&m[p]===0;)p++;return f>0?new Uint8Array([...new Uint8Array(f-m.length+p),...m.slice(p)]):m.slice(p)}return r(c,"decode"),{encode:a,decode:c}}r(j,"useBase");var{encode:ho,decode:tn}=j(32);function xo(e){return tn(e.toLocaleLowerCase().replaceAll("l","1").replaceAll("s","5").replaceAll("o","0").replaceAll("i","1"))}r(xo,"decodeBase32");var{encode:bo,decode:To}=j(16),{encode:wo,decode:Lo}=j(58),{encode:Ao,decode:vo}=j(62);function Do(e,t){return Math.ceil(e*(Math.log(256)/Math.log(t)))}r(Do,"estimateSizeForBase");var Mo=r(e=>(e.length>0&&(/^[A-Z0-9_\-\ ]*$/g.test(e)&&(e=e.toLowerCase()),e=e.replace(/^[-_\ ]+/gi,"").replace(/[-_\ ]+$/gi,"").replace(/[-_\ ]+([a-z0-9])/gi,(t,n)=>n.toUpperCase()),e=e[0].toLowerCase()+e.substring(1)),e),"toCamelCase");function nn(e){return e.charAt(0).toUpperCase()+e.toLowerCase().slice(1)}r(nn,"toCapitalize");function Ro(e){return e.replace(/\w\S*/g,nn)}r(Ro,"toCapitalizeWords");function So(e,t="-"){return t=typeof t>"u"?"_":t,e.replace(/([a-z\d])([A-Z])/g,`$1${t}$2`).replace(/([A-Z]+)([A-Z][a-z\d]+)/g,`$1${t}$2`).toLowerCase()}r(So,"fromCamelCase");var rt=["1","true","yes","y","on"];function Io(e,t=!1){return e==null||typeof e!="string"?t:rt.includes(String(e).trim().toLowerCase())}r(Io,"stringToBoolean");function Co(e,t=0){return e==null||typeof e!="string"?t:parseInt(e.trim(),10)??t}r(Co,"stringToInteger");function Oo(e,t=0){return e==null||typeof e!="string"?t:parseFloat(e.trim())??t}r(Oo,"stringToFloat");function rn(e,t=!1){return e==null?t:typeof e=="boolean"?e:typeof e=="number"?e!==0:rt.includes(String(e).trim().toLowerCase())}r(rn,"valueToBoolean");function on(e,t=0){return e==null?t:typeof e=="boolean"?e?1:0:typeof e=="number"?Math.floor(e):parseInt(String(e).trim(),10)??t}r(on,"valueToInteger");function sn(e,t=0){return e==null?t:typeof e=="boolean"?e?1:0:typeof e=="number"?Math.floor(e):parseFloat(String(e).trim())??t}r(sn,"valueToFloat");function ve(e,t=""){return e==null?t:String(e)??t}r(ve,"valueToString");var $o=sn,Bo=on,jo=ve,Ho=rn;function an(e,t={}){let{trace:n=!0,pretty:o=!0}=t;return e.map(i=>{if(i&&typeof i=="object"){if(o&&(i instanceof Uint8Array||i instanceof ArrayBuffer))return`
|
|
3
3
|
${Ye(i)}
|
|
4
4
|
`;if(i instanceof Error)return n?`${i.name||"Error"}: ${i.message}
|
|
5
|
-
${i.stack}`:`${i.name||"Error"}: ${i.message}`;try{return o?JSON.stringify(i,null,2):JSON.stringify(i)}catch{}}return String(i)})}r(an,"formatMessages");function _o(e,t={}){return an(e,t).join(" ")}r(_o,"renderMessages");function zo(e){try{return decodeURIComponent(escape(e))}catch{}return e}r(zo,"fixBrokenUth8String");var Pe=864e5;function Ee(e){return Math.floor(e/1e4)}r(Ee,"dayYear");function ot(e){return Math.floor(e/100%100)}r(ot,"dayMonth");function un(e){return Math.floor(e%100)}r(un,"dayDay");function Vo(e){return[Ee(e),ot(e),un(e)]}r(Vo,"dayToParts");function it(e,t=!1){return t?new Date(`${ln(e)}T00:00:00.000Z`):new Date(e/1e4,e/100%100-1,e%100)}r(it,"dayToDate");function st(){return ue(new Date)}r(st,"dayFromToday");function qo(e,t=!1){if(typeof e=="number")return e<100?void 0:e;if(typeof e=="string")return at(e);if(Array.isArray(e)&&e.length===3){let[n,o,i]=e;return Me(n,o,i)}else if(e instanceof Date)return ue(e,t)}r(qo,"dayFromAny");function Jo(e){return it(e,!0)}r(Jo,"dayToDateGMT");function ue(e,t=!1){return t?at(e.toISOString()):e.getFullYear()*1e4+(e.getMonth()+1)*100+e.getDate()}r(ue,"dayFromDate");function Zo(e){return ue(e,!0)}r(Zo,"dayFromDateGMT");function De(e,t=!0){return it(e,t).getTime()}r(De,"dayToTimestamp");function cn(e,t=!0){return ue(new Date(e),t)}r(cn,"dayFromTimestamp");function ln(e,t="-"){let n=String(e);return n.slice(0,4)+t+n.slice(4,6)+t+n.slice(6,8)}r(ln,"dayToString");function Me(e,t=1,n=1){if(!(t<1||t>12||n<1||n>31))return e*1e4+t*100+n}r(Me,"dayFromParts");function at(e){let t=String(e).replace(/[^0-9]/g,"").slice(0,8);if(t.length===8)return+t}r(at,"dayFromString");function Wo(e,t=0){let n=Ee(e),o=ot(e);return t!==0&&(o+=t,n+=Math.floor((o-1)/12),o=Math.floor((o-1)%12)+1,o===0&&(o=12)),Me(n,o,1)}r(Wo,"dayMonthStart");function Ko(e,t=0){let n=Ee(e);return Me(n+t,1,1)}r(Ko,"dayYearStart");function ae(e,t){return cn(De(e)+t*864e5)}r(ae,"dayOffset");function Yo(e,t){return Math.round((De(t)-De(e))/864e5)}r(Yo,"dayDiff");function Qo(e,t){let n=[];for(t==null&&(t=st()),e<0&&(e=ae(t,e+1));e<=t;)n.push(e),e=ae(e,1);return n}r(Qo,"dayRange");function*Xo(e,t){let n=[];for(t==null&&(t=st()),e<0&&(e=ae(t,e+1));e<=t;)yield e,e=ae(e,1);return n}r(Xo,"dayIterator");var{warn:ut}=A("zeed:promise","error");function ct(){let e,t;return[new Promise((o,i)=>{e=o,t=i}),e,t]}r(ct,"createPromise");async function ri(e){return new Promise(t=>setTimeout(t,e))}r(ri,"sleep");async function oi(){return new Promise(e=>setTimeout(e,0))}r(oi,"immediate");var lt=Symbol("timeout");async function ii(e,t,n=lt){return new Promise(async(o,i)=>{let s=!1,u=setTimeout(()=>{s=!0,o(n)},t);try{let a=await e;clearTimeout(u),s||o(a)}catch(a){clearTimeout(u),s||i(a)}})}r(ii,"timeout");var ft=new Error("Timeout reached");function si(e){return e===lt||e===ft}r(si,"isTimeout");async function pt(e,t){return t<=0?await e:new Promise(async(n,o)=>{let i=!1,s=setTimeout(()=>{i=!0,o(ft)},t);try{let u=await e;clearTimeout(s),i||n(u)}catch(u){clearTimeout(s),i||o(u)}})}r(pt,"tryTimeout");function ai(e,t,n=1e3){return new Promise((o,i)=>{let s=r(c=>{a&&(clearTimeout(a),u(),o(c))},"fn"),u=r(()=>{a=null,e.off?e.off(t,s):e.removeEventListener?e.removeEventListener(t,s):ut("No remove listener method found for",e,t)},"done"),a=setTimeout(()=>{u(),i(new Error("Did not response in time"))},n);e.on?e.on(t,s):e.addEventListener?e.addEventListener(t,s):ut("No listener method found for",e)})}r(ai,"waitOn");function E(e){return Boolean(e&&(e instanceof Promise||typeof e.then=="function"))}r(E,"isPromise");function k(e){return Promise.resolve(e)}r(k,"promisify");var L=class{get value(){return this.days}constructor(t){if(typeof t=="number"){this.days=t;return}if(t!=null&&(t=L.from(t)?.days),t==null){let n=new Date;this.days=n.getFullYear()*1e4+(n.getMonth()+1)*100+n.getDate()}else this.days=t}static fromNumber(t){return new L(t)}static fromString(t){return L.from(+t.replace(/[^0-9]/g,"").slice(0,8))}static fromDate(t,n=!1){return n?L.fromString(t.toISOString().substr(0,10)):L.from(t.getFullYear()*1e4+(t.getMonth()+1)*100+t.getDate())}static fromDateGMT(t){return L.fromDate(t,!0)}static from(t,n=!1){if(typeof t=="number")return t<100?void 0:new L(t);if(typeof t=="string")return L.fromString(t);if(Array.isArray(t)&&t.length===3){let[o,i=1,s=1]=t;return i<1||i>12||s<1||s>31?void 0:new L(o*1e4+i*100+s)}else{if(t instanceof Date)return L.fromDate(t,n);if(t instanceof L)return t}}toNumber(){return this.days}toJson(){return this.days}toString(t="-"){let n=String(this.days);return n.slice(0,4)+t+n.slice(4,6)+t+n.slice(6,8)}toDate(t=!1){return t?new Date(`${this.toString()}T00:00:00.000Z`):new Date(this.days/1e4,this.days/100%100-1,this.days%100)}toDateGMT(){return this.toDate(!0)}get year(){return Math.floor(this.days/1e4)}get month(){return Math.floor(this.days/100%100)}get day(){return Math.floor(this.days%100)}dayOffset(t){return L.fromDateGMT(new Date(this.toDateGMT().getTime()+t*864e5))}monthStart(){return L.from([this.year,this.month,1])}yearStart(){return L.from([this.year,1,1])}monthOffset(t){let n=this.month+t,o=Math.floor((n-1)%12)+1;o===0&&(o=12);let i=Math.floor((n-1)/12);return L.from([this.year+i,o,this.day])}daysUntil(t){return Math.round((new L(t)?.toDateGMT().getTime()-this.toDateGMT().getTime())/864e5)}yesterday(){return this.dayOffset(-1)}tomorrow(){return this.dayOffset(1)}};r(L,"Day");async function pi(e,t,n){let o=L.from(e),i=L.from(t);for(;o&&i&&o?.days<=i?.days;){let s=n(o);E(s)&&await s,o=o.dayOffset(1)}}r(pi,"forEachDay");function di(){return new L}r(di,"today");function gi(e){return new L(e)}r(gi,"day");function mi(e){return L.fromDate(new Date(e)).days}r(mi,"dateStringToDays");function fn(e,t=2){return+(+e).toFixed(t)}r(fn,"decimal");function xi(e,t=2){return+(+e/10**t).toFixed(t)}r(xi,"decimalFromCents");function bi(e,t=2){return Math.round(+e*10**t)}r(bi,"decimalToCents");function Ti(e,t=2){return t*(fn(e,t)%1)}r(Ti,"decimalCentsPart");function F(e){return e!=null&&typeof e=="object"}r(F,"isObject");function Re(e){return Object(e)!==e}r(Re,"isPrimitive");function I(e){return Array.isArray(e)}r(I,"isArray");function ce(e){return F(e)&&!I(e)}r(ce,"isRecord");function Ai(e){return e?.constructor===Object}r(Ai,"isRecordPlain");function vi(e){return typeof e=="string"}r(vi,"isString");function Di(e){return typeof e=="number"}r(Di,"isNumber");function Pi(e){return typeof e=="number"&&Number.isInteger(e)}r(Pi,"isInteger");function Ei(e){return typeof e=="number"&&Number.isSafeInteger(e)}r(Ei,"isSafeInteger");function dt(e){return typeof e=="boolean"}r(dt,"isBoolean");function Mi(e){return e==null}r(Mi,"isNullOrUndefined");function Ri(e){return e==null}r(Ri,"isNull");function Si(e){return F(e)&&e.constructor.name==="Uint8Array"}r(Si,"isUint8Array");function Ui(e){return e!=null}r(Ui,"isNotNull");function ki(e){return e!=null&&e!==!1&&e!==!0}r(ki,"isValue");function pn(e,t,n=new WeakSet){if(e===t)return!0;if(n.has(t)||(Re(t)||n.add(t),!(e instanceof Object)||!(t instanceof Object))||e.constructor!==t.constructor||e.length!==t.length)return!1;for(let o in e){if(!e.hasOwnProperty(o))continue;if(!t.hasOwnProperty(o))return!1;let i=e[o],s=t[o];if(!pn(i,s,n))return!1}for(let o in t)if(t.hasOwnProperty(o)&&!e.hasOwnProperty(o))return!1;return!0}r(pn,"deepEqual");function dn(e,t=new WeakSet){if(t.has(e))return"[Circular ~]";if(Re(e)||t.add(e),ce(e)){for(let n in e)if(!!e.hasOwnProperty(n)){if(e[n]===void 0){delete e[n];continue}dn(e[n],t)}}else if(I(e))for(let n=e.length-1;n>=0;n--)e[n]===void 0&&e.splice(n,1);return e}r(dn,"deepStripUndefinedInPlace");function le(e,...t){for(let n of t)F(e)||(e={}),!(n==null||!F(n))&&Object.keys(n).forEach(o=>{let i=e[o],s=n[o];Array.isArray(i)&&Array.isArray(s)?e[o]=i.concat(s):F(i)&&F(s)?e[o]=le(Object.assign({},i),s):e[o]=s});return e}r(le,"deepMerge");var gt=r(e=>e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,"""),"escapeHTML"),Bi=r(e=>e.replace(/</gi,"<").replace(/>/gi,">").replace(/"/gi,'"').replace(/'/gi,"'").replace(/&/gi,"&"),"unescapeHTML");function _i(e,t,n=[]){return e.filter(o=>!t.some(i=>!i(o))).map(o=>{for(let i of n)o=i(o);return o}).filter(o=>o!=null)}r(_i,"listQuery");function zi(e,t){return e.reduce((n,o)=>{let i=String(o[t]);return(n[i]=n[i]||[]).push(o),n},{})}r(zi,"listGroupBy");function Ni(e,t){return Array.from(e.reduce((n,o)=>n.add(o[t]),new Set))}r(Ni,"listDistinctUnion");function Gi(e,t){return e.map(n=>n[t])}r(Gi,"listOfKey");function Zi(e,t){return F(e)?Object.fromEntries(Object.entries(e).map(([n,o])=>{let i=t(n,o);return I(i)&&i.length===2?i:[n,i]}).filter(n=>n!=null)):{}}r(Zi,"objectMap");function Wi(e,t){return t.dispose&&e.dispose&&t.dispose.add(e.dispose),Object.assign(e,t)}r(Wi,"objectMergeDisposable");function Ki(e){return Object.keys(e).length<=0}r(Ki,"objectIsEmpty");var mt=/[\u0000-\u001F\u0080-\u009F]/g,gn=/^\.+/,mn=/\.+$/;function yt(){return/[<>:"/\\|?*\u0000-\u001F]/g}r(yt,"filenameReservedRegex");function yn(){return/^(con|prn|aux|nul|com\d|lpt\d)$/i}r(yn,"windowsReservedNameRegex");function Xi(e,t="_"){if(typeof e!="string")throw new TypeError("Expected a string");if(yt().test(t)&&mt.test(t))throw new Error("Replacement string cannot contain reserved filename characters");return e=e.replace(yt(),t).replace(mt,t).replace(gn,t).replace(mn,""),e=yn().test(e)?e+t:e,e.slice(0,100)}r(Xi,"toValidFilename");var hn=/[\\\-\[\]\/{}()*+?.^$|]/g;function ht(e){return e?e instanceof RegExp?e.source:e.replace(hn,"\\$&"):""}r(ht,"escapeRegExp");var X=r(e=>Math.abs(e)%1===.5,"isHalf"),xt=r(e=>e%2===0,"isEven"),os=r(e=>Math.ceil(e),"roundUp"),is=r(e=>Math.floor(e),"roundDown"),ss=r(e=>Math.round(e),"roundHalfUp"),as=r(e=>{let t=Math.round(e);return X(e)&&xt(t)?t-1:t},"roundHalfOdd"),us=r(e=>X(e)?Math.sign(e)*Math.ceil(Math.abs(e)):Math.round(e),"roundHalfAwayFromZero"),cs=r(e=>X(e)?Math.floor(e):Math.round(e),"roundHalfDown"),ls=r(e=>{let t=Math.round(e);return X(e)?xt(t)?t:t-1:t},"roundHalfEven"),fs=r(e=>X(e)?Math.sign(e)*Math.floor(Math.abs(e)):Math.round(e),"roundHalfTowardsZero");function bt(e){return e.reduce((t,n)=>Math.min(t,n.sort_weight||0),0)-1-D()}r(bt,"startSortWeight");function Tt(e){return e.reduce((t,n)=>Math.max(t,n.sort_weight||0),0)+1+D()}r(Tt,"endSortWeight");function ms(e,t,n){let o=n.length,i=e<t;if(o<=0||e>=o-1)return Tt(n);if(e<=0)return bt(n);n=xn([...n]);let s=i?-1:0,u=n[e+s].sort_weight||0,c=(n[e+s+1].sort_weight||0)-u;if(c===0)return i?bt(n):Tt(n);let l=u+c/2,f=c*.01*(D()-.5);return l+f}r(ms,"moveSortWeight");function xn(e){return e.sort((t,n)=>(t.sort_weight||0)-(n.sort_weight||0)),e}r(xn,"sortedItems");function bs(e={}){let{getter:t=r(a=>a.sort,"getter")}=e;function n(a){return a.sort((c,l)=>(t(c)||0)-(t(l)||0)),a}r(n,"items");function o(a){return a.reduce((c,l)=>Math.min(c,t(l)||0),0)-1-D()}r(o,"start");function i(a){return a.reduce((c,l)=>Math.max(c,t(l)||0),0)+1+D()}r(i,"end");function s(a,c){a==null&&(a=(c??0)-1),c==null&&(c=(a??0)+1);let l=c-a,f=a+l/2,p=l*.01*(D()-.5);return f+p}r(s,"between");function u(a,c,l){let f=l.length,p=a<c;if(f<=0||a>=f-1)return i(l);if(a<=0)return o(l);l=n([...l]);let h=p?-1:0,x=t(l[a+h])||0,d=(t(l[a+h+1])||0)-x;if(d===0)return p?o(l):i(l);let g=x+d/2,y=d*.01*(D()-.5);return g+y}return r(u,"move"),{start:o,end:i,between:s,move:u,items:n}}r(bs,"useSorted");var bn=/((?:(?:(?:https?|ftp):)?\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u00A1-\uFFFF][a-z0-9\u00A1-\uFFFF_-]{0,62})?[a-z0-9\u00A1-\uFFFF]\.)+(?:[a-z\u00A1-\uFFFF]{2,}\.?))(?::\d{2,5})?(?:[/?#]\S*)?)/gim;function As(e){return e.split(bn).map((t,n)=>{let o=gt(t);return n%2?`<a target="_blank" href="${o}">${Tn(o)}</a>`:o}).join("")}r(As,"linkifyPlainText");function Tn(e){return e.replace(/^https?:\/\/(www\.)?/,"").replace(/\/$/,"")}r(Tn,"toHumanReadableUrl");function wt(e){let t=[];for(let[n,o]of Object.entries(e))if(o!=null){Array.isArray(o)||(o=[o]);for(let i of o)i!=null&&t.push(`${encodeURIComponent(n)}=${encodeURIComponent(String(i))}`)}return t.join("&")}r(wt,"encodeQuery");function vs(e){let t={},n=(e[0]==="?"?e.substr(1):e).split("&");for(let o=0;o<n.length;o++){let i=n[o].split("="),s=decodeURIComponent(i[0]),u=decodeURIComponent(i[1]||"");t[s]!=null?(Array.isArray(t[s])||(t[s]=[t[s]]),t[s].push(u)):t[s]=u}return t}r(vs,"parseQuery");function Ms(e,t,n){let o=e[t];return o===void 0&&(o=n(t,e),e[t]=o),o}r(Ms,"ensureKey");async function Rs(e,t,n){let o=e[t];return o===void 0&&(o=await n(t,e),e[t]=o),o}r(Rs,"ensureKeyAsync");function Ss(e){return e!=null?e.size!=null?e.size:e.length!=null?e.length:Object.keys(e).length:0}r(Ss,"size");function Us(e){return e!=null&&e.length>0?e[e.length-1]:void 0}r(Us,"last");function ks(e){try{if(e!=null)return Array.isArray(e)||typeof e=="string"?e.length<=0:e?.size!=null?e.size<=0:Object.keys(e).length<=0}catch(t){console.warn("Failed to check if empty for",e,t)}return!0}r(ks,"empty");function Se(e){return Object(e)!==e?e:JSON.parse(S(e))}r(Se,"cloneObject");function Fs(e){return Object(e)!==e?e:JSON.parse(S(e))}r(Fs,"cloneJsonObject");function Is(e){let t=new Map;return n=>{if(t.has(n))return t.get(n);let o=e(n);return t.set(n,o),o}}r(Is,"memoize");function Cs(e){let t=new Map;return async(...n)=>{let o=S(n);if(t.has(o))return t.get(o);let i=await e(...n);return t.set(o,i),i}}r(Cs,"memoizeAsync");function Os(e,t){let n=[];for(let o=0;o<e;o++)n.push(t(o,e));return n}r(Os,"forTimes");var wn=/\\\s|\s+|#[^\n]*\n?/gm,Ln=/\(\?P?<(\w[\w\d_]+)>|\((?!\?(:|\!|=|<=|<\!))/gm,Lt=/^((?:\(\?[\w$]+\))?)\(\?<([=!])([\s\S]*?)\)/gm,An=A("zeed:xrx","error");function vn(e){return typeof e=="string"?e:e.source||""}r(vn,"regExpString");function Hs(e){return e.replace(/[-\[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}r(Hs,"regExpEscape");var Ue=class{constructor(t,n){this.namedGroups={};this.names=[];let o=n??"",i;if(t instanceof RegExp?(n==null&&(o=t.flags),i=t.source):i=t,o&&o.includes("x")&&(o=o.replace("x",""),i=i.replace(wn,a=>a[0]==="\\"?a:"")),!(t instanceof RegExp)){let a=0;i=i.replace(Ln,(c,l)=>(a+=1,l?(l!=="index"&&l!=="length"&&!this.namedGroups[l]?this.namedGroups[l]=a:An.error(`Unallowed or duplicate group name: ${l}`),"("):c)),this.names=Object.keys(this.namedGroups)}i=vn(i),Lt.lastIndex=0;let u=Lt.exec(i);u&&(this.lookBehind={rx:new RegExp(`${u[3]}$(?!\\s)`),expect:u?u[2]==="=":!u},i=i.substr(u[0].length)),this.rx=new RegExp(i,o)}get lastIndex(){return this.rx.lastIndex}set lastIndex(t){this.rx.lastIndex=t}_handleMatch(t){if(this.lookBehind){let n=t.input.slice(0,t.index);if(this.lookBehind.expect!==this.lookBehind.rx.test(n))return null}for(let n of this.names)t[n]=t[this.namedGroups[n]];return t}exec(t){let n;for(;n=this.rx.exec(t);)if(this.rx.lastIndex===n.index&&this.rx.lastIndex++,n=this._handleMatch(n),n!=null)return n}execAll(t){let n=[],o;for(this.rx.lastIndex=0;o=this.exec(t);)n.push(o);return this.rx.lastIndex=0,n}replace(t,n){let o=typeof n=="function"?n:()=>n;return t.replace(this.rx,i=>o(i))}};r(Ue,"XRX");var Dn=",";function ma(e,t={}){let{separator:n=Dn}=t,o="";for(let i=0;i<e.length;i++)o+=`${e[i].map(s=>{if(s==null||s==="")return"";if(dt(s))return s?1:0;let u=String(s);return(ce(s)||I(s))&&(u=S(s)),u.includes('"')||u.includes(`
|
|
5
|
+
${i.stack}`:`${i.name||"Error"}: ${i.message}`;try{return o?JSON.stringify(i,null,2):JSON.stringify(i)}catch{}}return String(i)})}r(an,"formatMessages");function _o(e,t={}){return an(e,t).join(" ")}r(_o,"renderMessages");function zo(e){try{return decodeURIComponent(escape(e))}catch{}return e}r(zo,"fixBrokenUth8String");var Pe=864e5;function Ee(e){return Math.floor(e/1e4)}r(Ee,"dayYear");function ot(e){return Math.floor(e/100%100)}r(ot,"dayMonth");function un(e){return Math.floor(e%100)}r(un,"dayDay");function Vo(e){return[Ee(e),ot(e),un(e)]}r(Vo,"dayToParts");function it(e,t=!1){return t?new Date(`${ln(e)}T00:00:00.000Z`):new Date(e/1e4,e/100%100-1,e%100)}r(it,"dayToDate");function st(){return ue(new Date)}r(st,"dayFromToday");function qo(e,t=!1){if(typeof e=="number")return e<100?void 0:e;if(typeof e=="string")return at(e);if(Array.isArray(e)&&e.length===3){let[n,o,i]=e;return Me(n,o,i)}else if(e instanceof Date)return ue(e,t)}r(qo,"dayFromAny");function Jo(e){return it(e,!0)}r(Jo,"dayToDateGMT");function ue(e,t=!1){return t?at(e.toISOString()):e.getFullYear()*1e4+(e.getMonth()+1)*100+e.getDate()}r(ue,"dayFromDate");function Zo(e){return ue(e,!0)}r(Zo,"dayFromDateGMT");function De(e,t=!0){return it(e,t).getTime()}r(De,"dayToTimestamp");function cn(e,t=!0){return ue(new Date(e),t)}r(cn,"dayFromTimestamp");function ln(e,t="-"){let n=String(e);return n.slice(0,4)+t+n.slice(4,6)+t+n.slice(6,8)}r(ln,"dayToString");function Me(e,t=1,n=1){if(!(t<1||t>12||n<1||n>31))return e*1e4+t*100+n}r(Me,"dayFromParts");function at(e){let t=String(e).replace(/[^0-9]/g,"").slice(0,8);if(t.length===8)return+t}r(at,"dayFromString");function Wo(e,t=0){let n=Ee(e),o=ot(e);return t!==0&&(o+=t,n+=Math.floor((o-1)/12),o=Math.floor((o-1)%12)+1,o===0&&(o=12)),Me(n,o,1)}r(Wo,"dayMonthStart");function Ko(e,t=0){let n=Ee(e);return Me(n+t,1,1)}r(Ko,"dayYearStart");function ae(e,t){return cn(De(e)+t*864e5)}r(ae,"dayOffset");function Yo(e,t){return Math.round((De(t)-De(e))/864e5)}r(Yo,"dayDiff");function Qo(e,t){let n=[];for(t==null&&(t=st()),e<0&&(e=ae(t,e+1));e<=t;)n.push(e),e=ae(e,1);return n}r(Qo,"dayRange");function*Xo(e,t){let n=[];for(t==null&&(t=st()),e<0&&(e=ae(t,e+1));e<=t;)yield e,e=ae(e,1);return n}r(Xo,"dayIterator");var ut=A("zeed:promise","error");function ct(){let e,t;return[new Promise((o,i)=>{e=o,t=i}),e,t]}r(ct,"createPromise");async function ri(e){return new Promise(t=>setTimeout(t,e))}r(ri,"sleep");async function oi(){return new Promise(e=>setTimeout(e,0))}r(oi,"immediate");var lt=Symbol("timeout");async function ii(e,t,n=lt){return new Promise(async(o,i)=>{let s=!1,u=setTimeout(()=>{s=!0,o(n)},t);try{let a=await e;clearTimeout(u),s||o(a)}catch(a){clearTimeout(u),s||i(a)}})}r(ii,"timeout");var ft=new Error("Timeout reached");function si(e){return e===lt||e===ft}r(si,"isTimeout");async function dt(e,t){return t<=0?await e:new Promise(async(n,o)=>{let i=!1,s=setTimeout(()=>{i=!0,o(ft)},t);try{let u=await e;clearTimeout(s),i||n(u)}catch(u){clearTimeout(s),i||o(u)}})}r(dt,"tryTimeout");function ai(e,t,n=1e3){return new Promise((o,i)=>{let s=r(c=>{a&&(clearTimeout(a),u(),o(c))},"fn"),u=r(()=>{a=null,e.off?e.off(t,s):e.removeEventListener?e.removeEventListener(t,s):ut.warn("No remove listener method found for",e,t)},"done"),a=setTimeout(()=>{u(),i(new Error("Did not response in time"))},n);e.on?e.on(t,s):e.addEventListener?e.addEventListener(t,s):ut.warn("No listener method found for",e)})}r(ai,"waitOn");function E(e){return Boolean(e&&(e instanceof Promise||typeof e.then=="function"))}r(E,"isPromise");function k(e){return Promise.resolve(e)}r(k,"promisify");var L=class{get value(){return this.days}constructor(t){if(typeof t=="number"){this.days=t;return}if(t!=null&&(t=L.from(t)?.days),t==null){let n=new Date;this.days=n.getFullYear()*1e4+(n.getMonth()+1)*100+n.getDate()}else this.days=t}static fromNumber(t){return new L(t)}static fromString(t){return L.from(+t.replace(/[^0-9]/g,"").slice(0,8))}static fromDate(t,n=!1){return n?L.fromString(t.toISOString().substr(0,10)):L.from(t.getFullYear()*1e4+(t.getMonth()+1)*100+t.getDate())}static fromDateGMT(t){return L.fromDate(t,!0)}static from(t,n=!1){if(typeof t=="number")return t<100?void 0:new L(t);if(typeof t=="string")return L.fromString(t);if(Array.isArray(t)&&t.length===3){let[o,i=1,s=1]=t;return i<1||i>12||s<1||s>31?void 0:new L(o*1e4+i*100+s)}else{if(t instanceof Date)return L.fromDate(t,n);if(t instanceof L)return t}}toNumber(){return this.days}toJson(){return this.days}toString(t="-"){let n=String(this.days);return n.slice(0,4)+t+n.slice(4,6)+t+n.slice(6,8)}toDate(t=!1){return t?new Date(`${this.toString()}T00:00:00.000Z`):new Date(this.days/1e4,this.days/100%100-1,this.days%100)}toDateGMT(){return this.toDate(!0)}get year(){return Math.floor(this.days/1e4)}get month(){return Math.floor(this.days/100%100)}get day(){return Math.floor(this.days%100)}dayOffset(t){return L.fromDateGMT(new Date(this.toDateGMT().getTime()+t*864e5))}monthStart(){return L.from([this.year,this.month,1])}yearStart(){return L.from([this.year,1,1])}monthOffset(t){let n=this.month+t,o=Math.floor((n-1)%12)+1;o===0&&(o=12);let i=Math.floor((n-1)/12);return L.from([this.year+i,o,this.day])}daysUntil(t){return Math.round((new L(t)?.toDateGMT().getTime()-this.toDateGMT().getTime())/864e5)}yesterday(){return this.dayOffset(-1)}tomorrow(){return this.dayOffset(1)}};r(L,"Day");async function di(e,t,n){let o=L.from(e),i=L.from(t);for(;o&&i&&o?.days<=i?.days;){let s=n(o);E(s)&&await s,o=o.dayOffset(1)}}r(di,"forEachDay");function pi(){return new L}r(pi,"today");function gi(e){return new L(e)}r(gi,"day");function mi(e){return L.fromDate(new Date(e)).days}r(mi,"dateStringToDays");function fn(e,t=2){return+(+e).toFixed(t)}r(fn,"decimal");function xi(e,t=2){return+(+e/10**t).toFixed(t)}r(xi,"decimalFromCents");function bi(e,t=2){return Math.round(+e*10**t)}r(bi,"decimalToCents");function Ti(e,t=2){return t*(fn(e,t)%1)}r(Ti,"decimalCentsPart");function F(e){return e!=null&&typeof e=="object"}r(F,"isObject");function Re(e){return Object(e)!==e}r(Re,"isPrimitive");function I(e){return Array.isArray(e)}r(I,"isArray");function ce(e){return F(e)&&!I(e)}r(ce,"isRecord");function Ai(e){return e?.constructor===Object}r(Ai,"isRecordPlain");function vi(e){return typeof e=="string"}r(vi,"isString");function Di(e){return typeof e=="number"}r(Di,"isNumber");function Pi(e){return typeof e=="number"&&Number.isInteger(e)}r(Pi,"isInteger");function Ei(e){return typeof e=="number"&&Number.isSafeInteger(e)}r(Ei,"isSafeInteger");function pt(e){return typeof e=="boolean"}r(pt,"isBoolean");function Mi(e){return e==null}r(Mi,"isNullOrUndefined");function Ri(e){return e==null}r(Ri,"isNull");function Si(e){return F(e)&&e.constructor.name==="Uint8Array"}r(Si,"isUint8Array");function Ui(e){return e!=null}r(Ui,"isNotNull");function ki(e){return e!=null&&e!==!1&&e!==!0}r(ki,"isValue");function dn(e,t,n=new WeakSet){if(e===t)return!0;if(n.has(t)||(Re(t)||n.add(t),!(e instanceof Object)||!(t instanceof Object))||e.constructor!==t.constructor||e.length!==t.length)return!1;for(let o in e){if(!e.hasOwnProperty(o))continue;if(!t.hasOwnProperty(o))return!1;let i=e[o],s=t[o];if(!dn(i,s,n))return!1}for(let o in t)if(t.hasOwnProperty(o)&&!e.hasOwnProperty(o))return!1;return!0}r(dn,"deepEqual");function pn(e,t=new WeakSet){if(t.has(e))return"[Circular ~]";if(Re(e)||t.add(e),ce(e)){for(let n in e)if(!!e.hasOwnProperty(n)){if(e[n]===void 0){delete e[n];continue}pn(e[n],t)}}else if(I(e))for(let n=e.length-1;n>=0;n--)e[n]===void 0&&e.splice(n,1);return e}r(pn,"deepStripUndefinedInPlace");function le(e,...t){for(let n of t)F(e)||(e={}),!(n==null||!F(n))&&Object.keys(n).forEach(o=>{let i=e[o],s=n[o];Array.isArray(i)&&Array.isArray(s)?e[o]=i.concat(s):F(i)&&F(s)?e[o]=le(Object.assign({},i),s):e[o]=s});return e}r(le,"deepMerge");var gt=r(e=>e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,"""),"escapeHTML"),Bi=r(e=>e.replace(/</gi,"<").replace(/>/gi,">").replace(/"/gi,'"').replace(/'/gi,"'").replace(/&/gi,"&"),"unescapeHTML");function _i(e,t,n=[]){return e.filter(o=>!t.some(i=>!i(o))).map(o=>{for(let i of n)o=i(o);return o}).filter(o=>o!=null)}r(_i,"listQuery");function zi(e,t){return e.reduce((n,o)=>{let i=String(o[t]);return(n[i]=n[i]||[]).push(o),n},{})}r(zi,"listGroupBy");function Ni(e,t){return Array.from(e.reduce((n,o)=>n.add(o[t]),new Set))}r(Ni,"listDistinctUnion");function Gi(e,t){return e.map(n=>n[t])}r(Gi,"listOfKey");function Zi(e,t){return F(e)?Object.fromEntries(Object.entries(e).map(([n,o])=>{let i=t(n,o);return I(i)&&i.length===2?i:[n,i]}).filter(n=>n!=null)):{}}r(Zi,"objectMap");function Wi(e,t){return t.dispose&&e.dispose&&t.dispose.add(e.dispose),Object.assign(e,t)}r(Wi,"objectMergeDisposable");function Ki(e){return Object.keys(e).length<=0}r(Ki,"objectIsEmpty");var mt=/[\u0000-\u001F\u0080-\u009F]/g,gn=/^\.+/,mn=/\.+$/;function yt(){return/[<>:"/\\|?*\u0000-\u001F]/g}r(yt,"filenameReservedRegex");function yn(){return/^(con|prn|aux|nul|com\d|lpt\d)$/i}r(yn,"windowsReservedNameRegex");function Xi(e,t="_"){if(typeof e!="string")throw new TypeError("Expected a string");if(yt().test(t)&&mt.test(t))throw new Error("Replacement string cannot contain reserved filename characters");return e=e.replace(yt(),t).replace(mt,t).replace(gn,t).replace(mn,""),e=yn().test(e)?e+t:e,e.slice(0,100)}r(Xi,"toValidFilename");var hn=/[\\\-\[\]\/{}()*+?.^$|]/g;function ht(e){return e?e instanceof RegExp?e.source:e.replace(hn,"\\$&"):""}r(ht,"escapeRegExp");var X=r(e=>Math.abs(e)%1===.5,"isHalf"),xt=r(e=>e%2===0,"isEven"),os=r(e=>Math.ceil(e),"roundUp"),is=r(e=>Math.floor(e),"roundDown"),ss=r(e=>Math.round(e),"roundHalfUp"),as=r(e=>{let t=Math.round(e);return X(e)&&xt(t)?t-1:t},"roundHalfOdd"),us=r(e=>X(e)?Math.sign(e)*Math.ceil(Math.abs(e)):Math.round(e),"roundHalfAwayFromZero"),cs=r(e=>X(e)?Math.floor(e):Math.round(e),"roundHalfDown"),ls=r(e=>{let t=Math.round(e);return X(e)?xt(t)?t:t-1:t},"roundHalfEven"),fs=r(e=>X(e)?Math.sign(e)*Math.floor(Math.abs(e)):Math.round(e),"roundHalfTowardsZero");function bt(e){return e.reduce((t,n)=>Math.min(t,n.sort_weight||0),0)-1-D()}r(bt,"startSortWeight");function Tt(e){return e.reduce((t,n)=>Math.max(t,n.sort_weight||0),0)+1+D()}r(Tt,"endSortWeight");function ms(e,t,n){let o=n.length,i=e<t;if(o<=0||e>=o-1)return Tt(n);if(e<=0)return bt(n);n=xn([...n]);let s=i?-1:0,u=n[e+s].sort_weight||0,c=(n[e+s+1].sort_weight||0)-u;if(c===0)return i?bt(n):Tt(n);let l=u+c/2,f=c*.01*(D()-.5);return l+f}r(ms,"moveSortWeight");function xn(e){return e.sort((t,n)=>(t.sort_weight||0)-(n.sort_weight||0)),e}r(xn,"sortedItems");function bs(e={}){let{getter:t=r(a=>a.sort,"getter")}=e;function n(a){return a.sort((c,l)=>(t(c)||0)-(t(l)||0)),a}r(n,"items");function o(a){return a.reduce((c,l)=>Math.min(c,t(l)||0),0)-1-D()}r(o,"start");function i(a){return a.reduce((c,l)=>Math.max(c,t(l)||0),0)+1+D()}r(i,"end");function s(a,c){a==null&&(a=(c??0)-1),c==null&&(c=(a??0)+1);let l=c-a,f=a+l/2,d=l*.01*(D()-.5);return f+d}r(s,"between");function u(a,c,l){let f=l.length,d=a<c;if(f<=0||a>=f-1)return i(l);if(a<=0)return o(l);l=n([...l]);let h=d?-1:0,x=t(l[a+h])||0,p=(t(l[a+h+1])||0)-x;if(p===0)return d?o(l):i(l);let g=x+p/2,y=p*.01*(D()-.5);return g+y}return r(u,"move"),{start:o,end:i,between:s,move:u,items:n}}r(bs,"useSorted");var bn=/((?:(?:(?:https?|ftp):)?\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u00A1-\uFFFF][a-z0-9\u00A1-\uFFFF_-]{0,62})?[a-z0-9\u00A1-\uFFFF]\.)+(?:[a-z\u00A1-\uFFFF]{2,}\.?))(?::\d{2,5})?(?:[/?#]\S*)?)/gim;function As(e){return e.split(bn).map((t,n)=>{let o=gt(t);return n%2?`<a target="_blank" href="${o}">${Tn(o)}</a>`:o}).join("")}r(As,"linkifyPlainText");function Tn(e){return e.replace(/^https?:\/\/(www\.)?/,"").replace(/\/$/,"")}r(Tn,"toHumanReadableUrl");function wt(e){let t=[];for(let[n,o]of Object.entries(e))if(o!=null){Array.isArray(o)||(o=[o]);for(let i of o)i!=null&&t.push(`${encodeURIComponent(n)}=${encodeURIComponent(String(i))}`)}return t.join("&")}r(wt,"encodeQuery");function vs(e){let t={},n=(e[0]==="?"?e.substr(1):e).split("&");for(let o=0;o<n.length;o++){let i=n[o].split("="),s=decodeURIComponent(i[0]),u=decodeURIComponent(i[1]||"");t[s]!=null?(Array.isArray(t[s])||(t[s]=[t[s]]),t[s].push(u)):t[s]=u}return t}r(vs,"parseQuery");function Ms(e,t,n){let o=e[t];return o===void 0&&(o=n(t,e),e[t]=o),o}r(Ms,"ensureKey");async function Rs(e,t,n){let o=e[t];return o===void 0&&(o=await n(t,e),e[t]=o),o}r(Rs,"ensureKeyAsync");function Ss(e){return e!=null?e.size!=null?e.size:e.length!=null?e.length:Object.keys(e).length:0}r(Ss,"size");function Us(e){return e!=null&&e.length>0?e[e.length-1]:void 0}r(Us,"last");function ks(e){try{if(e!=null)return Array.isArray(e)||typeof e=="string"?e.length<=0:e?.size!=null?e.size<=0:Object.keys(e).length<=0}catch(t){console.warn("Failed to check if empty for",e,t)}return!0}r(ks,"empty");function Se(e){return Object(e)!==e?e:JSON.parse(S(e))}r(Se,"cloneObject");function Fs(e){return Object(e)!==e?e:JSON.parse(S(e))}r(Fs,"cloneJsonObject");function Is(e){let t=new Map;return n=>{if(t.has(n))return t.get(n);let o=e(n);return t.set(n,o),o}}r(Is,"memoize");function Cs(e){let t=new Map;return async(...n)=>{let o=S(n);if(t.has(o))return t.get(o);let i=await e(...n);return t.set(o,i),i}}r(Cs,"memoizeAsync");function Os(e,t){let n=[];for(let o=0;o<e;o++)n.push(t(o,e));return n}r(Os,"forTimes");var wn=/\\\s|\s+|#[^\n]*\n?/gm,Ln=/\(\?P?<(\w[\w\d_]+)>|\((?!\?(:|\!|=|<=|<\!))/gm,Lt=/^((?:\(\?[\w$]+\))?)\(\?<([=!])([\s\S]*?)\)/gm,An=A("zeed:xrx","error");function vn(e){return typeof e=="string"?e:e.source||""}r(vn,"regExpString");function Hs(e){return e.replace(/[-\[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}r(Hs,"regExpEscape");var Ue=class{constructor(t,n){this.namedGroups={};this.names=[];let o=n??"",i;if(t instanceof RegExp?(n==null&&(o=t.flags),i=t.source):i=t,o&&o.includes("x")&&(o=o.replace("x",""),i=i.replace(wn,a=>a[0]==="\\"?a:"")),!(t instanceof RegExp)){let a=0;i=i.replace(Ln,(c,l)=>(a+=1,l?(l!=="index"&&l!=="length"&&!this.namedGroups[l]?this.namedGroups[l]=a:An.error(`Unallowed or duplicate group name: ${l}`),"("):c)),this.names=Object.keys(this.namedGroups)}i=vn(i),Lt.lastIndex=0;let u=Lt.exec(i);u&&(this.lookBehind={rx:new RegExp(`${u[3]}$(?!\\s)`),expect:u?u[2]==="=":!u},i=i.substr(u[0].length)),this.rx=new RegExp(i,o)}get lastIndex(){return this.rx.lastIndex}set lastIndex(t){this.rx.lastIndex=t}_handleMatch(t){if(this.lookBehind){let n=t.input.slice(0,t.index);if(this.lookBehind.expect!==this.lookBehind.rx.test(n))return null}for(let n of this.names)t[n]=t[this.namedGroups[n]];return t}exec(t){let n;for(;n=this.rx.exec(t);)if(this.rx.lastIndex===n.index&&this.rx.lastIndex++,n=this._handleMatch(n),n!=null)return n}execAll(t){let n=[],o;for(this.rx.lastIndex=0;o=this.exec(t);)n.push(o);return this.rx.lastIndex=0,n}replace(t,n){let o=typeof n=="function"?n:()=>n;return t.replace(this.rx,i=>o(i))}};r(Ue,"XRX");var Dn=",";function ma(e,t={}){let{separator:n=Dn}=t,o="";for(let i=0;i<e.length;i++)o+=`${e[i].map(s=>{if(s==null||s==="")return"";if(pt(s))return s?1:0;let u=String(s);return(ce(s)||I(s))&&(u=S(s)),u.includes('"')||u.includes(`
|
|
6
6
|
`)||u.includes(n)?`"${u.replace(/"/g,'""')}"`:u}).join(n)}
|
|
7
7
|
`;return o}r(ma,"csvStringify");function Pn(e,t={}){let n=/("((?:(?:[^"]*?)(?:"")?)*)"|([^,;\t\n]*))([,;\t]|\n|\r\n)/g;t.separator&&(n=new RegExp(n.source.replaceAll(",;\\t",ht(t.separator)),n.flags));let o=[],i=[],s,u=`${e.replaceAll(`\r
|
|
8
8
|
`,`
|
|
9
9
|
`).trim()}
|
|
10
10
|
`;for(;s=n.exec(u);){let a=s[2]??s[3]??"";a=a.replaceAll('""','"'),i.push(a),s[4]===`
|
|
11
|
-
`&&(o.push(i),i=[])}return o}r(Pn,"csvParse");function ya(e,t={}){let n=Pn(e,t),o=n[0];return n.slice(1).map(i=>Object.fromEntries(i.map((s,u)=>[o[u],s])))}r(ya,"csvParseToObjects");var En=A("zeed:dispose","error");async function Mn(e){typeof e=="function"?await k(e()):E(e)?await e:typeof e.dispose=="function"?await k(e.dispose()):E(e.dispose)?await e.dispose:typeof e.cleanup=="function"?await k(e.cleanup()):E(e.cleanup)&&await e.cleanup}r(Mn,"callDisposer");function ke(e){let{name:t}=typeof e=="string"?{name:e}:e??{},n=[],o=r(async u=>{u!=null&&n.includes(u)&&(Ae(n,a=>a!==u),await Mn(u))},"untrack"),i=r(async()=>{for(t&&En.debug(`dispose ${t}: ${n.length} entries`);n.length>0;)await o(n[0])},"dispose"),s=r(u=>{if(u!=null)return n.unshift(u),()=>o(u)},"track");return Object.assign(i,{track:s,add:s,untrack:o,dispose:i,exec:i,getSize(){return n.length}})}r(ke,"useDispose");var La=ke;function Aa(e={}){let{mode:t="fifo"}=e,n=[],o=r(async(s=!1)=>{for(;n.length>0;){let u=n[0];if(Ae(n,a=>a!==u),typeof u=="function"){let a=u();if(E(a)){if(s)throw new Error(`Expected sync only function, but found async: ${u}`);await a}}else if(E(u)){if(s)throw new Error(`Expected sync only function, but found async: ${u}`);await u}else throw new Error(`Unhandled disposable: ${u}`)}},"exec");return Object.assign(o,{add:r(s=>{t==="lifo"?n.unshift(s):n.push(s)},"add"),exec:o,getSize(){return n.length}})}r(Aa,"useDefer");function va(e,t=0){let n=setTimeout(e,t);return()=>{n&&(clearTimeout(n),n=void 0)}}r(va,"useTimeout");function Da(e,t){let n=setInterval(e,t);return()=>{n&&(clearInterval(n),n=void 0)}}r(Da,"useInterval");function Pa(e,t,n,...o){return e==null?()=>{}:(e.on?e.on(t,n,...o):e.addEventListener&&e.addEventListener(t,n,...o),()=>{e.off?e.off(t,n,...o):e.removeEventListener&&e.removeEventListener(t,n,...o)})}r(Pa,"useEventListener");function Sa(){let e=!0;return(t,n)=>{let o=!1;if(e){e=!1;try{t(),o=!0}finally{e=!0}}else n!==void 0&&n();return o}}r(Sa,"useMutex");function Ua(){let e=!0;return async(t,n)=>{let o=!1;if(e){e=!1;try{let i=t();E(i)&&await i,o=!0}finally{e=!0}}else if(n!==void 0){let i=n();E(i)&&await i}return o}}r(Ua,"useAsyncMutex");var Z=A("zeed:emitter","error"),M=class{constructor(){this.subscribers={};this.subscribersOnAny=[];this.dispose=ke();this.call=new Proxy({},{get:(t,n)=>async(...o)=>await this.emit(n,...o)})}async emit(t,...n){let o=!1;this.dispose.add(()=>{this.subscribers={},this.subscribersOnAny=[]});try{let i=this.subscribers[t]||[];if(this.subscribersOnAny.forEach(s=>s(t,...n)),i.length>0){let s=i.map(u=>{try{return k(u(...n))}catch(a){Z.warn("emit warning:",a)}return null}).filter(u=>u!=null);o=!0,await Promise.all(s)}}catch(i){Z.error("emit exception",i)}return o}onAny(t){this.subscribersOnAny.push(t)}on(t,n){let o=this.subscribers[t]||[];return o.push(n),this.subscribers[t]=o,()=>{this.off(t,n)}}onCall(t){for(let[n,o]of Object.entries(t))this.on(n,o)}once(t,n){let o=r(async(...i)=>(this.off(t,o),await k(n(...i))),"onceListener");return this.on(t,o),()=>{this.off(t,n)}}off(t,n){return this.subscribers[t]=(this.subscribers[t]||[]).filter(o=>n&&o!==n),this}removeAllListeners(){return this.subscribers={},this}};r(M,"Emitter");function ja(){let e=Y().emitter;return e||(e=new M,Y().emitter=e),e}r(ja,"getGlobalEmitter");var Ha=new M;function _a(e,t){let n=Math.round(D()*100),o=[],i,s=r((a,c)=>{let l={key:a,obj:c};o.push(l),i&&i()},"incoming");return t?e.on?e.on(t,a=>{s(t,a)}):e.addEventListener?e.addEventListener(t,a=>{s(t,a)}):Z.error(n,"Cannot listen to key"):e.onAny?e.onAny((a,c)=>{s(a,c)}):Z.error(n,"cannot listen to all for",e),r((a,c=!0)=>new Promise((l,f)=>{a||(a=t,a||o.length&&(a=o[0].key)),i=r(()=>{for(;o.length>0;){let p=o.shift();if(p.key===a)i=void 0,l(p.obj);else{if(c){Z.warn(n,`Unhandled event ${a} with value: ${p.obj}`);continue}f(new Error(`Expected ${a}, but found ${p.key} with value=${p.obj}`)),Z.error(n,`Unhandled event ${a} with value: ${p.obj}`)}break}},"lazyResolve"),i()}),"on")}r(_a,"lazyListener");var At=r(()=>Date.now(),"getTimestamp");function Ga(e){return e>999?`${(e/1e3).toFixed(1)}s`:`${e.toFixed(2)}ms`}r(Ga,"formatMilliseconds");function Va(...e){for(let t of e){if(t instanceof Date)return t;if(typeof t=="string"){let n=null;if(t.includes(":"))try{n=new Date(t)}catch{}if(!(n instanceof Date)){let o=/(\d\d\d\d)-(\d\d)-(\d\d)/.exec(t);o&&(n=new Date(+o[1],+o[2]-1,+o[3],12,0))}if(n instanceof Date)return n}}}r(Va,"parseDate");var{encode:vt,decode:Rn}=j(62),{encode:Dt,decode:Sn}=j(32),fe=16;function Ie(){return q(fe)}r(Ie,"uuidBytes");function Un(e=Ie()){return vt(e,22)}r(Un,"uuidB62");function kn(e){return vt(e,22)}r(kn,"uuidEncodeB62");function Fn(e){return Rn(e,fe)}r(Fn,"uuidDecodeB62");function In(e=Ie()){return Dt(e,26)}r(In,"uuidB32");function Cn(e){return Dt(e,26)}r(Cn,"uuidEncodeB32");function On(e){return Sn(e,fe)}r(On,"uuidDecodeB32");var $n="10000000-1000-4000-8000-100000000000",Bn=typeof crypto<"u"&&crypto.randomUUID!=null?crypto.randomUUID.bind(crypto):()=>$n.replace(/[018]/g,e=>(e^q(1)[0]&15>>e/4).toString(16));function jn(e){let t=Je(e);return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16)}`}r(jn,"uuidEncodeV4");function Hn(e){return Ze(e.replaceAll("-",""))}r(Hn,"uuidDecodeV4");var Pt=16e11;function _n(e){let t=new Uint8Array([0,0,0,0,0,0]),n=t.length-1;for(let o=0;o<t.length;o++){let i=e&255;t[n-o]=i,e=(e-i)/256}return t}r(_n,"longToByteArray");function Et(){let e=At()-Pt;return new Uint8Array([..._n(e),...q(10)])}r(Et,"suidBytes");function Qa(){return Nn(Et())}r(Qa,"suid");function Xa(e){return zn(Rt(e))}r(Xa,"suidDate");function zn(e){return new Date(Pt+e.slice(0,6).reduce((t,n)=>t*256+n,0))}r(zn,"suidBytesDate");var eu=r(()=>new Uint32Array(q(4))[0],"uuid32bit"),Ce={base62:{uuid:Un,uuidDecode:Fn,uuidEncode:kn},base32:{uuid:In,uuidDecode:On,uuidEncode:Cn},uuidv4:{uuid:Bn,uuidDecode:Hn,uuidEncode:jn}},pe="base62",Mt=!1;function tu(e,t=!1){pe=e,Mt=t}r(tu,"setUuidDefaultEncoding");function H(){return Ce[pe].uuid(Mt?Et():Ie())}r(H,"uuid");function Rt(e){return Ce[pe].uuidDecode(e)}r(Rt,"uuidDecode");function Nn(e){return Ce[pe].uuidEncode(e)}r(Nn,"uuidEncode");function nu(e){try{return Rt(e).length===fe}catch{}return!1}r(nu,"uuidIsValid");var Fe={};function _(e="id"){return Fe[e]==null&&(Fe[e]=0),`${e}-${Fe[e]++}`}r(_,"uname");var Gn=0;function ru(){return`id-${Gn++}`}r(ru,"qid");var Vn=(o=>(o[o.waiting=0]="waiting",o[o.running=1]="running",o[o.finished=2]="finished",o))(Vn||{}),qn=(o=>(o[o.replace=0]="replace",o[o.memoize=1]="memoize",o[o.error=2]="error",o))(qn||{});function cu(e={}){let{maxParallel:t=3}=e,n=new M,o=0,i=0,s=0,u=0,a={};async function c(){if(o>0){let[d,g]=ct();return n.once("didFinish",g),d}}r(c,"waitFinishAll");function l(){n.emit("didFinish"),o=0,i=0}r(l,"didFinish");function f(){let d=0,g=0;for(let{max:y,resolved:T,state:b}of Object.values(a))d+=y,g+=b===2?y:Math.min(y,T);n.emit("didUpdate",o,i,d,g)}r(f,"didUpdate");function p(){if(f(),o>0&&o===i&&l(),s>=t)return;let d=Object.values(a).filter(g=>g.state===0);if(d.length>0){let g;for(let y of d)y.group!=null&&Object.values(a).some(T=>T.state===1&&T.id!==y.id&&T.group===y.group)||(g==null||y.priority<g.priority)&&(g=y);if(g!=null){let y=g.id,T=g.done;g.state=1,++s,n.emit("didStart",y);let b=r(w=>{g&&(g.result=w,g.state=2,g.resolved=g.max),--s,++i,p()},"taskFinished");g.task(g).then(w=>{T(w),n.emit("didResolve",y,w),b(w)}).catch(w=>{T(),n.emit("didReject",y,w),b()})}}}r(p,"performNext");function h(d){let g=a[d];g&&g.state===0&&(a[d].state=2,++i,n.emit("didCancel",d),f())}r(h,"cancel");function x(){Object.keys(a).forEach(h)}r(x,"cancelAll");function m(d,g={}){let y,T=new Promise(w=>y=w),b=g.id??H();if(a[b]!=null){let w=g.idConflictResolution??1;if(w===0)h(b);else if(w===1){let v=a[b];return{id:b,promise:(async()=>{if(v.state===2)return a[b].result})(),dispose:()=>h(b),cancel:()=>h(b)}}else throw new Error(`Pool task with id=${b} already exists!`)}return a[b]={id:b,task:d,priority:++u,group:g.group,state:0,max:g.max??1,resolved:g.resolved??0,done:y,payload:g.payload,setMax(w){a[b].max=w,f()},setResolved(w){a[b].resolved=w,f()},incResolved(w=1){a[b].resolved+=w,f()}},++o,p(),{id:b,promise:T,dispose:()=>h(b),cancel:()=>h(b)}}return r(m,"enqueue"),{events:n,cancel:h,cancelAll:x,enqueue:m,dispose:x,waitFinishAll:c}}r(cu,"usePool");var Oe=class extends M{constructor(n={}){super();this.queue=[];this.waitToFinish=[];this.countMax=0;this.countResolved=0;this.paused=!1;let{name:o=_("queue"),logLevel:i}=n;this.name=o,this.log=A(`zeed:queue:${o}`,i??1/0)}async performNext(){if(this.log("performNext, queue.length =",this.queue.length),this.currentTask!=null){this.log("performNext => skip while another task is running");return}if(this.paused){this.log("performNext => skip while is paused");return}for(;this.currentTask==null&&!this.paused;){let n=this.queue.shift();if(this.log(`performNext => ${n?.name}`),n==null)break;this.countResolved===0&&this.emit("didStart",this.countMax);let{name:o,task:i,resolve:s}=n;this.currentTask=i();let u;try{this.log.info(`start task ${o}`),u=await this.currentTask,this.log(`finished task ${o} with result =`,u)}catch(a){this.log.warn("Error performing task",a)}s(u),this.currentTask=void 0,this.countResolved+=1,this.emit("didUpdate",this.countMax,this.countResolved)}for(this.queue.length===0&&(this.emit("didFinish"),this.countMax=0,this.countResolved=0);this.waitToFinish.length>0;)this.waitToFinish.shift()()}async enqueue(n,o={}){let{immediate:i=!1,name:s=_(this.name)}=o;return i?(this.log.info(`immediate execution ${s}`),await n()):(this.log(`enqueue ${s}`),new Promise(u=>{this.queue.push({name:s,task:n,resolve:u}),this.countMax+=1,this.emit("didUpdate",this.countMax,this.countResolved),this.performNext()}))}async enqueueReentrant(n,o={}){return this.enqueue(n,{immediate:this.currentTask!=null,name:o.name})}async cancelAll(n=!0){this.log("cancelAll"),this.emit("didCancel");let o=this.queue.map(i=>i.resolve);this.queue=[],o.forEach(i=>i(void 0)),await this.wait()}async pause(){this.log("pause"),this.paused=!0,await this.wait()}resume(){this.log("resume"),this.paused=!1,this.performNext()}async wait(){if(this.log("wait"),!(this.currentTask==null&&(this.queue.length===0||this.paused)))return new Promise(n=>{this.waitToFinish.push(n)})}get isPaused(){return this.paused}get hasTasks(){return this.queue.length!==0}};r(Oe,"SerialQueue");var W=!1,U=W?A("zeed:throttle","error"):()=>{};function Tu(e,t={}){let{delay:n=100,trailing:o=!0,leading:i=!0}=t,s=0,u=0,a=0,c,l=Date.now();function f(){return s?(clearTimeout(s),s=void 0,!0):!1}r(f,"clearExistingTimeout");function p(...h){let x=Date.now(),m=x-u;function d(){let y=Date.now();return`total ${(y-l).toFixed(1)}ms - elapsed ${(y-u).toFixed(1)}ms - visited ${a}x`}r(d,"debugElapsed");let g=r(()=>{a=0,u=Date.now(),e.apply(this,h)},"exec");if(c=g,m>n||!s){W&&U("elapsed",d()),i&&(m>n?(W&&U("\u{1F680} leading",d()),g()):++a);let y=m>n?n:n-m;U(`\u23F1 start timeout with ${y.toFixed(1)}ms`,d()),f(),u=x,s=setTimeout(()=>{W&&U("\u23F1 reached timeout",d()),s=0,o&&(!i||a>0)&&(W&&U("\u{1F680} trailing",d()),c?.())},y)}else++a,W&&U("visited",d())}return r(p,"wrapper"),p.cancel=f,p.stop=()=>{f()&&c&&c()},p.immediate=r(async function(...x){f(),u=Date.now(),e.apply(this,x)},"immediate"),p.dispose=()=>p.stop(),p}r(Tu,"throttle");function wu(e,t={}){let{delay:n=100}=t,o=0,i=!1,s;function u(){o&&(U("clear"),clearTimeout(o),o=0)}r(u,"clearExistingTimeout");async function a(){try{if(u(),s!=null){U("exec");let f=[...s];s=void 0,i=!0,await k(e(...f)),i=!1,U("exec done"),s!=null&&(u(),U("exec trigger next"),o=setTimeout(a,n))}}catch{}}r(a,"exec");function c(...f){s=[...f],u(),U("trigger"),i===!1&&(o=setTimeout(a,n))}r(c,"wrapper");async function l(...f){u(),s=[...f],await a()}return r(l,"immediate"),c.cancel=u,c.dispose=u,c.immediate=l,c}r(wu,"debounce");function vu(e=globalThis?.location?.hostname??""){return["::ffff:127.0.0.1","localhost","127.0.0.1","","::1","::"].includes(e)||e.startsWith("192.168.")||e.startsWith("10.0.")||e.endsWith(".local")}r(vu,"isLocalHost");function Mu(e){let{level:t=void 0,filter:n=void 0,messages:o=[]}=e,i=V(n),s=ne(t);return u=>{!s(u.level)||!i(u.name)||o.push(u)}}r(Mu,"LoggerMemoryHandler");var de=class extends M{constructor(){super(...arguments);this.id=H()}close(){this.dispose()}};r(de,"Channel");var ee=class extends de{constructor(){super(...arguments);this.isConnected=!0}postMessage(n){this.other?.emit("message",{data:n,origin:"local",lastEventId:H()})}};r(ee,"LocalChannel");function Fu(){let e=new ee,t=new ee;return e.other=t,t.other=e,[e,t]}r(Fu,"createLocalChannelPair");var $e=class{async encode(t){return t}async decode(t){return t}};r($e,"NoopEncoder");var z=class{async encode(t){return he(t)}async decode(t){return xe(t)}};r(z,"JsonEncoder");var Be=class{constructor(t){this.key=t}async encode(t){let n=he(t);return await et(n,this.key)}async decode(t){let n=await tt(t,this.key);return xe(n)}};r(Be,"CryptoEncoder");var St=r((e,t,n={})=>new Proxy(n,{get:(o,i)=>i in o?o[i]:(...s)=>e(i,s,t)}),"createPromiseProxy");function Vu(e={}){let{name:t=_("hub"),encoder:n=new z,retryAfter:o=1e3,ignoreUnhandled:i=!0,logLevel:s=!1}=e,u=A(t,s),a={},c,l=[],f,p={},h=r(()=>{clearTimeout(f)},"dispose"),x=r(async()=>{if(clearTimeout(f),c){if(c.isConnected)for(;l.length;){let y=l[0];try{c.postMessage(await n.encode(y)),l.shift()}catch(T){u.warn("postMessage",T);break}}l.length>0&&o>0&&(f=setTimeout(x,o))}},"postNext"),m=r(async y=>{u("enqueue postMessage",y),l.push(y),await x()},"postMessage"),d=r(async y=>{c=y,c.on("connect",x),c.on("message",async T=>{u("onmessage",typeof T);let{name:b,args:w,id:v,result:G,error:O}=await n.decode(T.data);if(b){u(`name ${b} id ${v}`);try{if(a[b]==null)throw new Error(`handler for ${b} was not found`);let R=a[b](...w);E(R)&&(R=await R),u(`result ${R}`),v&&m({id:v,result:R})}catch(R){let $=R instanceof Error?R:new Error(ve(R));u.warn("execution error",$.name),m({id:v,error:{message:$.message,stack:$.stack,name:$.name}})}}else if(v)if(u(`response for id=${v}: result=${G}, error=${O}`),p[v]==null)G===void 0?u(`skip response for ${v}`):u.warn(`no response hook for ${v}`);else{let[R,$]=p[v];if(R&&$)if(delete p[v],O){let te=new Error(O.message);te.stack=O.stack,te.name=O.name,u.warn("reject",te.name),$(te)}else u("resolve",G),R(G)}else i||u.warn("Unhandled message",T)}),x()},"connect"),g=r(async(y,T,b={})=>{let{timeout:w=5e3}=b,v=H();return m({name:y,args:T,id:v}),pt(new Promise((G,O)=>p[v]=[G,O]),w)},"fetchMessage");return e.channel&&d(e.channel),{dispose:h,connect:d,listen(y){Object.assign(a,y)},send(){return St(g,{},{options(y){return St(g,{...y})}})}}}r(Vu,"useMessageHub");var ge=class extends M{constructor(n){super();this.publish=this.emit;this.subscribe=this.on;let{name:o,encoder:i=new z,channel:s,debug:u=!1}=n;this.channel=s,this.encoder=i,this.debug=u,this.name=o??this.channel.id??_("pubsub"),this.log=A(`${this.shortId}`),this.debug&&(this.channel.on("connect",()=>{this.log("channel connected")}),this.channel.on("disconnect",()=>{this.log("channel disconnected")})),this.channel.on("message",async({data:a})=>{let c=await this.encoder.decode(a);if(this.debug?this.log(`channel message, event=${c?.event}, info=`,c):this.log(`channel message, event=${c?.event}`),c){let{event:l,args:f}=c;await this.emitSuper(l,...f)}})}get shortId(){return this.name.substr(0,6)}async emitSuper(n,...o){return await super.emit(n,...o)}async emit(n,...o){try{if(this.debug?this.log(`emit(${String(n)})`,n):this.log(`emit(${String(n)})`,o.length),!this.channel.isConnected)return this.log.warn("channel not connected"),!1;let i=await this.encoder.encode({event:n,args:o});return this.channel.postMessage(i),!0}catch(i){this.log.warn(`emit(${String(n)})`,i)}return!1}};r(ge,"PubSub");function Qu(e){return new ge(e)}r(Qu,"usePubSub");var Jn=1;var Ut=r(e=>e,"defaultSerialize"),Zn=Ut;function tc(e,t){let{post:n,on:o,eventNames:i=[],serialize:s=Ut,deserialize:u=Zn}=t,a=new Map;return o(async c=>{let l=u(c),[f,p,h,x]=l;if(f===1||f===2){let m,d;if(x!=null)try{m=await e[x](...p)}catch(g){d=String(g)}else d="Method implementation missing";f===1&&h&&n(s(d?[4,d,h]:[3,m,h]))}else if(h){let m=a.get(h);m!=null&&(f===4?m.reject(p):m.resolve(p)),a.delete(h)}}),new Proxy({},{get(c,l){let f=r((...h)=>{n(s([2,h,null,l]))},"sendEvent");if(t.onlyEvents||i.includes(l))return f.asEvent=f,f;let p=r((...h)=>new Promise((x,m)=>{let d=Jn++;a.set(d,{resolve:x,reject:m}),n(s([1,h,d,l]))}),"sendCall");return p.asEvent=f,p}})}r(tc,"useRPC");var K=A("zeed:network","error"),je={cache:"no-cache",redirect:"follow",headers:{}};function Wn(e){let t=/:\/\/([^@]*)@/gi.exec(e);if(t&&t[1]){let[n,o]=t[1].split(":",2);return{url:e.replace(`${t[1]}@`,""),username:n,password:o}}}r(Wn,"parseBasicAuth");async function kt(e,t={},n=fetch){try{I(t)&&(t=le({},...J(t)));let o=Wn(String(e));o&&(e=o.url,t=le({},t,Kn(o.username,o.password))),t.headers!=null&&!(t.headers instanceof Headers)&&(t.headers=new Headers(t.headers));let i=await n(String(e),t);if(i.status<400)return i;try{K.warn(`Fetch of ${e} with ${t} returned status=${i.status}`),K.warn(`Response: ${await i.text()}`)}catch(s){K.error("Exception:",s)}}catch(o){K.error("fetchBasic",o)}}r(kt,"fetchBasic");async function ac(e,t={},n=fetch){try{let o=await kt(e,[{method:"GET",headers:{Accept:"application/json"}},t],n);if(o)return await o.json()}catch(o){K.error("fetchJSON error:",o)}}r(ac,"fetchJson");async function uc(e,t={},n=fetch){try{let o=await kt(e,[je,{method:"GET"},t],n);if(o)return await o.text()}catch(o){K.error("fetchHTML error:",o)}}r(uc,"fetchText");function cc(e,t="POST"){return{method:t,...je,headers:{"Content-Type":"application/x-www-form-urlencoded; charset=utf-8"},body:wt(e)}}r(cc,"fetchOptionsFormURLEncoded");function lc(e,t="POST"){return{method:t,...je,headers:{"Content-Type":"application/json; charset=utf-8"},body:S(e)}}r(lc,"fetchOptionsJson");function Kn(e,t){return{headers:{Authorization:`Basic ${We(`${e}:${t}`)}`}}}r(Kn,"fetchOptionsBasicAuth");function Ft(){if(typeof window<"u")return window}r(Ft,"getWindow");function Yn(){if(typeof navigator<"u")return navigator}r(Yn,"getNavigator");function dc(){return Ft()??typeof WorkerGlobalScope<"u"?self:typeof global<"u"?global:Function("return this;")()}r(dc,"getGlobal");var C=Yn(),N=Ft();function Qn(e={ios:!1,macos:!1,windows:!1,beaker:!1,electron:!1,wkwebview:!1,pwa:!1,pwaInstalled:!1,browser:!1,node:!1,worker:!1,test:!1,jest:!1,macosNative:!1,iosNative:!1,appleNative:!1,touch:!1}){return e.ios=C?.platform?.match(/(iPhone|iPod|iPad)/i)!=null,e.macos=!!C?.platform?.startsWith("Mac"),e.windows=!!C?.platform?.startsWith("Win"),e.beaker=N?.beaker!=null,e.electron=(C?.userAgent?.toLowerCase()?.indexOf(" electron/")||-1)>-1&&!e.beaker,e.wkwebview=N?.webkit?.messageHandlers!=null,e.pwa=C?.serviceWorker!=null,e.pwaInstalled=C?.standalone||N?.matchMedia?.("(display-mode: standalone)")?.matches,e.node=typeof process<"u"&&process?.release?.name==="node",e.browser=!e.electron&&!e.wkwebview&&!e.node,e.worker=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,e.jest=typeof jest<"u"||typeof vitest<"u",e.test=e.jest,e.macosNative=e.wkwebview&&e.macos,e.iosNative=e.wkwebview&&e.ios,e.appleNative=e.wkwebview,e.touch=N&&"ontouchstart"in N||(C?.maxTouchPoints||0)>1||C?.msPointerEnabled&&N?.MSGesture||N?.DocumentTouch&&document instanceof DocumentTouch,e}r(Qn,"detect");var Xn=r(()=>typeof window<"u"&&globalThis===window,"isBrowser"),gc=Qn();function mc(e){Xn()?window.addEventListener("beforeunload",e):typeof process<"u"&&process.on("exit",()=>e)}r(mc,"useExitHandler");var He=class{constructor(t={}){this.store={}}setItem(t,n){this.store[t]=Se(n)}getItem(t){return Se(this.store[t])}removeItem(t){delete this.store[t]}clear(){this.store={}}allKeys(){return Object.keys(this.store)}};r(He,"MemStorage");export{r as a,Y as b,Ot as c,V as d,me as e,ne as f,re as g,Q as h,_e as i,ze as j,jt as k,A as l,br as m,S as n,Tr as o,_t as p,zt as q,Ve as r,qe as s,P as t,Dr as u,Je as v,Ze as w,We as x,Pr as y,Nt as z,Er as A,Ke as B,he as C,xe as D,Ye as E,q as F,Xe as G,be as H,Qe as I,Gt as J,Ur as K,kr as L,et as M,tt as N,Vt as O,D as P,Cr as Q,Or as R,$r as S,Br as T,qt as U,jr as V,Hr as W,_r as X,zr as Y,Jt as Z,Vr as _,we as $,qr as aa,Le as ba,Zt as ca,Wt as da,J as ea,Kt as fa,Yr as ga,Qr as ha,Xr as ia,Ae as ja,eo as ka,to as la,Yt as ma,no as na,Qt as oa,nt as pa,ro as qa,oo as ra,io as sa,so as ta,ao as ua,uo as va,co as wa,lo as xa,fo as ya,j as za,ho as Aa,xo as Ba,bo as Ca,To as Da,wo as Ea,Lo as Fa,Ao as Ga,vo as Ha,Do as Ia,Mo as Ja,nn as Ka,Ro as La,So as Ma,Io as Na,Co as Oa,Oo as Pa,rn as Qa,on as Ra,sn as Sa,ve as Ta,$o as Ua,Bo as Va,jo as Wa,Ho as Xa,an as Ya,_o as Za,zo as _a,Pe as $a,Ee as ab,ot as bb,un as cb,Vo as db,it as eb,st as fb,qo as gb,Jo as hb,ue as ib,Zo as jb,De as kb,cn as lb,ln as mb,Me as nb,at as ob,Wo as pb,Ko as qb,ae as rb,Yo as sb,Qo as tb,Xo as ub,ct as vb,ri as wb,oi as xb,lt as yb,ii as zb,ft as Ab,si as Bb,pt as Cb,ai as Db,E as Eb,k as Fb,L as Gb,pi as Hb,di as Ib,gi as Jb,mi as Kb,fn as Lb,xi as Mb,bi as Nb,Ti as Ob,F as Pb,Re as Qb,I as Rb,ce as Sb,Ai as Tb,vi as Ub,Di as Vb,Pi as Wb,Ei as Xb,dt as Yb,Mi as Zb,Ri as _b,Si as $b,Ui as ac,ki as bc,pn as cc,dn as dc,le as ec,gt as fc,Bi as gc,_i as hc,zi as ic,Ni as jc,Gi as kc,Zi as lc,Wi as mc,Ki as nc,Xi as oc,ht as pc,X as qc,xt as rc,os as sc,is as tc,ss as uc,as as vc,us as wc,cs as xc,ls as yc,fs as zc,bt as Ac,Tt as Bc,ms as Cc,xn as Dc,bs as Ec,As as Fc,Tn as Gc,wt as Hc,vs as Ic,Ms as Jc,Rs as Kc,Ss as Lc,Us as Mc,ks as Nc,Se as Oc,Fs as Pc,Is as Qc,Cs as Rc,Os as Sc,vn as Tc,Hs as Uc,Ue as Vc,ma as Wc,Pn as Xc,ya as Yc,ke as Zc,La as _c,Aa as $c,va as ad,Da as bd,Pa as cd,Sa as dd,Ua as ed,M as fd,ja as gd,Ha as hd,_a as id,At as jd,Ga as kd,Va as ld,Ie as md,Un as nd,kn as od,Fn as pd,In as qd,Cn as rd,On as sd,Bn as td,jn as ud,Hn as vd,Et as wd,Qa as xd,Xa as yd,zn as zd,eu as Ad,tu as Bd,H as Cd,Rt as Dd,Nn as Ed,nu as Fd,_ as Gd,ru as Hd,Vn as Id,qn as Jd,cu as Kd,Oe as Ld,Tu as Md,wu as Nd,vu as Od,Mu as Pd,de as Qd,ee as Rd,Fu as Sd,$e as Td,z as Ud,Be as Vd,St as Wd,Vu as Xd,ge as Yd,Qu as Zd,tc as _d,Wn as $d,kt as ae,ac as be,uc as ce,cc as de,lc as ee,Kn as fe,Ft as ge,Yn as he,dc as ie,Qn as je,Xn as ke,gc as le,mc as me,He as ne};
|
|
12
|
-
//# sourceMappingURL=chunk-
|
|
11
|
+
`&&(o.push(i),i=[])}return o}r(Pn,"csvParse");function ya(e,t={}){let n=Pn(e,t),o=n[0];return n.slice(1).map(i=>Object.fromEntries(i.map((s,u)=>[o[u],s])))}r(ya,"csvParseToObjects");var En=A("zeed:dispose","error");async function Mn(e){typeof e=="function"?await k(e()):E(e)?await e:typeof e.dispose=="function"?await k(e.dispose()):E(e.dispose)?await e.dispose:typeof e.cleanup=="function"?await k(e.cleanup()):E(e.cleanup)&&await e.cleanup}r(Mn,"callDisposer");function ke(e){let{name:t}=typeof e=="string"?{name:e}:e??{},n=[],o=r(async u=>{u!=null&&n.includes(u)&&(Ae(n,a=>a!==u),await Mn(u))},"untrack"),i=r(async()=>{for(t&&En.debug(`dispose ${t}: ${n.length} entries`);n.length>0;)await o(n[0])},"dispose"),s=r(u=>{if(u!=null)return n.unshift(u),()=>o(u)},"track");return Object.assign(i,{track:s,add:s,untrack:o,dispose:i,exec:i,getSize(){return n.length}})}r(ke,"useDispose");var La=ke;function Aa(e={}){let{mode:t="fifo"}=e,n=[],o=r(async(s=!1)=>{for(;n.length>0;){let u=n[0];if(Ae(n,a=>a!==u),typeof u=="function"){let a=u();if(E(a)){if(s)throw new Error(`Expected sync only function, but found async: ${u}`);await a}}else if(E(u)){if(s)throw new Error(`Expected sync only function, but found async: ${u}`);await u}else throw new Error(`Unhandled disposable: ${u}`)}},"exec");return Object.assign(o,{add:r(s=>{t==="lifo"?n.unshift(s):n.push(s)},"add"),exec:o,getSize(){return n.length}})}r(Aa,"useDefer");function va(e,t=0){let n=setTimeout(e,t);return()=>{n&&(clearTimeout(n),n=void 0)}}r(va,"useTimeout");function Da(e,t){let n=setInterval(e,t);return()=>{n&&(clearInterval(n),n=void 0)}}r(Da,"useInterval");function Pa(e,t,n,...o){return e==null?()=>{}:(e.on?e.on(t,n,...o):e.addEventListener&&e.addEventListener(t,n,...o),()=>{e.off?e.off(t,n,...o):e.removeEventListener&&e.removeEventListener(t,n,...o)})}r(Pa,"useEventListener");function Sa(){let e=!0;return(t,n)=>{let o=!1;if(e){e=!1;try{t(),o=!0}finally{e=!0}}else n!==void 0&&n();return o}}r(Sa,"useMutex");function Ua(){let e=!0;return async(t,n)=>{let o=!1;if(e){e=!1;try{let i=t();E(i)&&await i,o=!0}finally{e=!0}}else if(n!==void 0){let i=n();E(i)&&await i}return o}}r(Ua,"useAsyncMutex");var Z=A("zeed:emitter","error"),M=class{constructor(){this.subscribers={};this.subscribersOnAny=[];this.dispose=ke();this.call=new Proxy({},{get:(t,n)=>async(...o)=>await this.emit(n,...o)})}async emit(t,...n){let o=!1;this.dispose.add(()=>{this.subscribers={},this.subscribersOnAny=[]});try{let i=this.subscribers[t]||[];if(this.subscribersOnAny.forEach(s=>s(t,...n)),i.length>0){let s=i.map(u=>{try{return k(u(...n))}catch(a){Z.warn("emit warning:",a)}return null}).filter(u=>u!=null);o=!0,await Promise.all(s)}}catch(i){Z.error("emit exception",i)}return o}onAny(t){this.subscribersOnAny.push(t)}on(t,n){let o=this.subscribers[t]||[];return o.push(n),this.subscribers[t]=o,()=>{this.off(t,n)}}onCall(t){for(let[n,o]of Object.entries(t))this.on(n,o)}once(t,n){let o=r(async(...i)=>(this.off(t,o),await k(n(...i))),"onceListener");return this.on(t,o),()=>{this.off(t,n)}}off(t,n){return this.subscribers[t]=(this.subscribers[t]||[]).filter(o=>n&&o!==n),this}removeAllListeners(){return this.subscribers={},this}};r(M,"Emitter");function ja(){let e=Y().emitter;return e||(e=new M,Y().emitter=e),e}r(ja,"getGlobalEmitter");var Ha=new M;function _a(e,t){let n=Math.round(D()*100),o=[],i,s=r((a,c)=>{let l={key:a,obj:c};o.push(l),i&&i()},"incoming");return t?e.on?e.on(t,a=>{s(t,a)}):e.addEventListener?e.addEventListener(t,a=>{s(t,a)}):Z.error(n,"Cannot listen to key"):e.onAny?e.onAny((a,c)=>{s(a,c)}):Z.error(n,"cannot listen to all for",e),r((a,c=!0)=>new Promise((l,f)=>{a||(a=t,a||o.length&&(a=o[0].key)),i=r(()=>{for(;o.length>0;){let d=o.shift();if(d.key===a)i=void 0,l(d.obj);else{if(c){Z.warn(n,`Unhandled event ${a} with value: ${d.obj}`);continue}f(new Error(`Expected ${a}, but found ${d.key} with value=${d.obj}`)),Z.error(n,`Unhandled event ${a} with value: ${d.obj}`)}break}},"lazyResolve"),i()}),"on")}r(_a,"lazyListener");var At=r(()=>Date.now(),"getTimestamp");function Ga(e){return e>999?`${(e/1e3).toFixed(1)}s`:`${e.toFixed(2)}ms`}r(Ga,"formatMilliseconds");function Va(...e){for(let t of e){if(t instanceof Date)return t;if(typeof t=="string"){let n=null;if(t.includes(":"))try{n=new Date(t)}catch{}if(!(n instanceof Date)){let o=/(\d\d\d\d)-(\d\d)-(\d\d)/.exec(t);o&&(n=new Date(+o[1],+o[2]-1,+o[3],12,0))}if(n instanceof Date)return n}}}r(Va,"parseDate");var{encode:vt,decode:Rn}=j(62),{encode:Dt,decode:Sn}=j(32),fe=16;function Ie(){return q(fe)}r(Ie,"uuidBytes");function Un(e=Ie()){return vt(e,22)}r(Un,"uuidB62");function kn(e){return vt(e,22)}r(kn,"uuidEncodeB62");function Fn(e){return Rn(e,fe)}r(Fn,"uuidDecodeB62");function In(e=Ie()){return Dt(e,26)}r(In,"uuidB32");function Cn(e){return Dt(e,26)}r(Cn,"uuidEncodeB32");function On(e){return Sn(e,fe)}r(On,"uuidDecodeB32");var $n="10000000-1000-4000-8000-100000000000",Bn=typeof crypto<"u"&&crypto.randomUUID!=null?crypto.randomUUID.bind(crypto):()=>$n.replace(/[018]/g,e=>(e^q(1)[0]&15>>e/4).toString(16));function jn(e){let t=Je(e);return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16)}`}r(jn,"uuidEncodeV4");function Hn(e){return Ze(e.replaceAll("-",""))}r(Hn,"uuidDecodeV4");var Pt=16e11;function _n(e){let t=new Uint8Array([0,0,0,0,0,0]),n=t.length-1;for(let o=0;o<t.length;o++){let i=e&255;t[n-o]=i,e=(e-i)/256}return t}r(_n,"longToByteArray");function Et(){let e=At()-Pt;return new Uint8Array([..._n(e),...q(10)])}r(Et,"suidBytes");function Qa(){return Nn(Et())}r(Qa,"suid");function Xa(e){return zn(Rt(e))}r(Xa,"suidDate");function zn(e){return new Date(Pt+e.slice(0,6).reduce((t,n)=>t*256+n,0))}r(zn,"suidBytesDate");var eu=r(()=>new Uint32Array(q(4))[0],"uuid32bit"),Ce={base62:{uuid:Un,uuidDecode:Fn,uuidEncode:kn},base32:{uuid:In,uuidDecode:On,uuidEncode:Cn},uuidv4:{uuid:Bn,uuidDecode:Hn,uuidEncode:jn}},de="base62",Mt=!1;function tu(e,t=!1){de=e,Mt=t}r(tu,"setUuidDefaultEncoding");function H(){return Ce[de].uuid(Mt?Et():Ie())}r(H,"uuid");function Rt(e){return Ce[de].uuidDecode(e)}r(Rt,"uuidDecode");function Nn(e){return Ce[de].uuidEncode(e)}r(Nn,"uuidEncode");function nu(e){try{return Rt(e).length===fe}catch{}return!1}r(nu,"uuidIsValid");var Fe={};function _(e="id"){return Fe[e]==null&&(Fe[e]=0),`${e}-${Fe[e]++}`}r(_,"uname");var Gn=0;function ru(){return`id-${Gn++}`}r(ru,"qid");var Vn=(o=>(o[o.waiting=0]="waiting",o[o.running=1]="running",o[o.finished=2]="finished",o))(Vn||{}),qn=(o=>(o[o.replace=0]="replace",o[o.memoize=1]="memoize",o[o.error=2]="error",o))(qn||{});function cu(e={}){let{maxParallel:t=3}=e,n=new M,o=0,i=0,s=0,u=0,a={};async function c(){if(o>0){let[p,g]=ct();return n.once("didFinish",g),p}}r(c,"waitFinishAll");function l(){n.emit("didFinish"),o=0,i=0}r(l,"didFinish");function f(){let p=0,g=0;for(let{max:y,resolved:T,state:b}of Object.values(a))p+=y,g+=b===2?y:Math.min(y,T);n.emit("didUpdate",o,i,p,g)}r(f,"didUpdate");function d(){if(f(),o>0&&o===i&&l(),s>=t)return;let p=Object.values(a).filter(g=>g.state===0);if(p.length>0){let g;for(let y of p)y.group!=null&&Object.values(a).some(T=>T.state===1&&T.id!==y.id&&T.group===y.group)||(g==null||y.priority<g.priority)&&(g=y);if(g!=null){let y=g.id,T=g.done;g.state=1,++s,n.emit("didStart",y);let b=r(w=>{g&&(g.result=w,g.state=2,g.resolved=g.max),--s,++i,d()},"taskFinished");g.task(g).then(w=>{T(w),n.emit("didResolve",y,w),b(w)}).catch(w=>{T(),n.emit("didReject",y,w),b()})}}}r(d,"performNext");function h(p){let g=a[p];g&&g.state===0&&(a[p].state=2,++i,n.emit("didCancel",p),f())}r(h,"cancel");function x(){Object.keys(a).forEach(h)}r(x,"cancelAll");function m(p,g={}){let y,T=new Promise(w=>y=w),b=g.id??H();if(a[b]!=null){let w=g.idConflictResolution??1;if(w===0)h(b);else if(w===1){let v=a[b];return{id:b,promise:(async()=>{if(v.state===2)return a[b].result})(),dispose:()=>h(b),cancel:()=>h(b)}}else throw new Error(`Pool task with id=${b} already exists!`)}return a[b]={id:b,task:p,priority:++u,group:g.group,state:0,max:g.max??1,resolved:g.resolved??0,done:y,payload:g.payload,setMax(w){a[b].max=w,f()},setResolved(w){a[b].resolved=w,f()},incResolved(w=1){a[b].resolved+=w,f()}},++o,d(),{id:b,promise:T,dispose:()=>h(b),cancel:()=>h(b)}}return r(m,"enqueue"),{events:n,cancel:h,cancelAll:x,enqueue:m,dispose:x,waitFinishAll:c}}r(cu,"usePool");var Oe=class extends M{constructor(n={}){super();this.queue=[];this.waitToFinish=[];this.countMax=0;this.countResolved=0;this.paused=!1;let{name:o=_("queue"),logLevel:i}=n;this.name=o,this.log=A(`zeed:queue:${o}`,i??1/0)}async performNext(){if(this.log("performNext, queue.length =",this.queue.length),this.currentTask!=null){this.log("performNext => skip while another task is running");return}if(this.paused){this.log("performNext => skip while is paused");return}for(;this.currentTask==null&&!this.paused;){let n=this.queue.shift();if(this.log(`performNext => ${n?.name}`),n==null)break;this.countResolved===0&&this.emit("didStart",this.countMax);let{name:o,task:i,resolve:s}=n;this.currentTask=i();let u;try{this.log.info(`start task ${o}`),u=await this.currentTask,this.log(`finished task ${o} with result =`,u)}catch(a){this.log.warn("Error performing task",a)}s(u),this.currentTask=void 0,this.countResolved+=1,this.emit("didUpdate",this.countMax,this.countResolved)}for(this.queue.length===0&&(this.emit("didFinish"),this.countMax=0,this.countResolved=0);this.waitToFinish.length>0;)this.waitToFinish.shift()()}async enqueue(n,o={}){let{immediate:i=!1,name:s=_(this.name)}=o;return i?(this.log.info(`immediate execution ${s}`),await n()):(this.log(`enqueue ${s}`),new Promise(u=>{this.queue.push({name:s,task:n,resolve:u}),this.countMax+=1,this.emit("didUpdate",this.countMax,this.countResolved),this.performNext()}))}async enqueueReentrant(n,o={}){return this.enqueue(n,{immediate:this.currentTask!=null,name:o.name})}async cancelAll(n=!0){this.log("cancelAll"),this.emit("didCancel");let o=this.queue.map(i=>i.resolve);this.queue=[],o.forEach(i=>i(void 0)),await this.wait()}async pause(){this.log("pause"),this.paused=!0,await this.wait()}resume(){this.log("resume"),this.paused=!1,this.performNext()}async wait(){if(this.log("wait"),!(this.currentTask==null&&(this.queue.length===0||this.paused)))return new Promise(n=>{this.waitToFinish.push(n)})}get isPaused(){return this.paused}get hasTasks(){return this.queue.length!==0}};r(Oe,"SerialQueue");var W=!1,U=W?A("zeed:throttle","error"):()=>{};function Tu(e,t={}){let{delay:n=100,trailing:o=!0,leading:i=!0}=t,s=0,u=0,a=0,c,l=Date.now();function f(){return s?(clearTimeout(s),s=void 0,!0):!1}r(f,"clearExistingTimeout");function d(...h){let x=Date.now(),m=x-u;function p(){let y=Date.now();return`total ${(y-l).toFixed(1)}ms - elapsed ${(y-u).toFixed(1)}ms - visited ${a}x`}r(p,"debugElapsed");let g=r(()=>{a=0,u=Date.now(),e.apply(this,h)},"exec");if(c=g,m>n||!s){W&&U("elapsed",p()),i&&(m>n?(W&&U("\u{1F680} leading",p()),g()):++a);let y=m>n?n:n-m;U(`\u23F1 start timeout with ${y.toFixed(1)}ms`,p()),f(),u=x,s=setTimeout(()=>{W&&U("\u23F1 reached timeout",p()),s=0,o&&(!i||a>0)&&(W&&U("\u{1F680} trailing",p()),c?.())},y)}else++a,W&&U("visited",p())}return r(d,"wrapper"),d.cancel=f,d.stop=()=>{f()&&c&&c()},d.immediate=r(async function(...x){f(),u=Date.now(),e.apply(this,x)},"immediate"),d.dispose=()=>d.stop(),d}r(Tu,"throttle");function wu(e,t={}){let{delay:n=100}=t,o=0,i=!1,s;function u(){o&&(U("clear"),clearTimeout(o),o=0)}r(u,"clearExistingTimeout");async function a(){try{if(u(),s!=null){U("exec");let f=[...s];s=void 0,i=!0,await k(e(...f)),i=!1,U("exec done"),s!=null&&(u(),U("exec trigger next"),o=setTimeout(a,n))}}catch{}}r(a,"exec");function c(...f){s=[...f],u(),U("trigger"),i===!1&&(o=setTimeout(a,n))}r(c,"wrapper");async function l(...f){u(),s=[...f],await a()}return r(l,"immediate"),c.cancel=u,c.dispose=u,c.immediate=l,c}r(wu,"debounce");function vu(e=globalThis?.location?.hostname??""){return["::ffff:127.0.0.1","localhost","127.0.0.1","","::1","::"].includes(e)||e.startsWith("192.168.")||e.startsWith("10.0.")||e.endsWith(".local")}r(vu,"isLocalHost");function Mu(e){let{level:t=void 0,filter:n=void 0,messages:o=[]}=e,i=V(n),s=ne(t);return u=>{!s(u.level)||!i(u.name)||o.push(u)}}r(Mu,"LoggerMemoryHandler");var pe=class extends M{constructor(){super(...arguments);this.id=H()}close(){this.dispose()}};r(pe,"Channel");var ee=class extends pe{constructor(){super(...arguments);this.isConnected=!0}postMessage(n){this.other?.emit("message",{data:n,origin:"local",lastEventId:H()})}};r(ee,"LocalChannel");function Fu(){let e=new ee,t=new ee;return e.other=t,t.other=e,[e,t]}r(Fu,"createLocalChannelPair");var $e=class{async encode(t){return t}async decode(t){return t}};r($e,"NoopEncoder");var z=class{async encode(t){return he(t)}async decode(t){return xe(t)}};r(z,"JsonEncoder");var Be=class{constructor(t){this.key=t}async encode(t){let n=he(t);return await et(n,this.key)}async decode(t){let n=await tt(t,this.key);return xe(n)}};r(Be,"CryptoEncoder");var St=r((e,t,n={})=>new Proxy(n,{get:(o,i)=>i in o?o[i]:(...s)=>e(i,s,t)}),"createPromiseProxy");function Vu(e={}){let{name:t=_("hub"),encoder:n=new z,retryAfter:o=1e3,ignoreUnhandled:i=!0,logLevel:s=!1}=e,u=A(t,s),a={},c,l=[],f,d={},h=r(()=>{clearTimeout(f)},"dispose"),x=r(async()=>{if(clearTimeout(f),c){if(c.isConnected)for(;l.length;){let y=l[0];try{c.postMessage(await n.encode(y)),l.shift()}catch(T){u.warn("postMessage",T);break}}l.length>0&&o>0&&(f=setTimeout(x,o))}},"postNext"),m=r(async y=>{u("enqueue postMessage",y),l.push(y),await x()},"postMessage"),p=r(async y=>{c=y,c.on("connect",x),c.on("message",async T=>{u("onmessage",typeof T);let{name:b,args:w,id:v,result:G,error:O}=await n.decode(T.data);if(b){u(`name ${b} id ${v}`);try{if(a[b]==null)throw new Error(`handler for ${b} was not found`);let R=a[b](...w);E(R)&&(R=await R),u(`result ${R}`),v&&await m({id:v,result:R})}catch(R){let $=R instanceof Error?R:new Error(ve(R));u.warn("execution error",$.name),await m({id:v,error:{message:$.message,stack:$.stack,name:$.name}})}}else if(v)if(u(`response for id=${v}: result=${G}, error=${O}`),d[v]==null)G===void 0?u(`skip response for ${v}`):u.warn(`no response hook for ${v}`);else{let[R,$]=d[v];if(R&&$)if(delete d[v],O){let te=new Error(O.message);te.stack=O.stack,te.name=O.name,u.warn("reject",te.name),$(te)}else u("resolve",G),R(G)}else i||u.warn("Unhandled message",T)}),await x()},"connect"),g=r(async(y,T,b={})=>{let{timeout:w=5e3}=b,v=H();return await m({name:y,args:T,id:v}),dt(new Promise((G,O)=>d[v]=[G,O]),w)},"fetchMessage");return e.channel&&p(e.channel),{dispose:h,connect:p,listen(y){Object.assign(a,y)},send(){return St(g,{},{options(y){return St(g,{...y})}})}}}r(Vu,"useMessageHub");var ge=class extends M{constructor(n){super();this.publish=this.emit.bind(this);this.subscribe=this.on.bind(this);let{name:o,encoder:i=new z,channel:s,debug:u=!1}=n;this.channel=s,this.encoder=i,this.debug=u,this.name=o??this.channel.id??_("pubsub"),this.log=A(`${this.shortId}`),this.debug&&(this.channel.on("connect",()=>{this.log("channel connected")}),this.channel.on("disconnect",()=>{this.log("channel disconnected")})),this.channel.on("message",async({data:a})=>{let c=await this.encoder.decode(a);if(this.debug?this.log(`channel message, event=${c?.event}, info=`,c):this.log(`channel message, event=${c?.event}`),c){let{event:l,args:f}=c;await this.emitSuper(l,...f)}})}get shortId(){return this.name.substr(0,6)}async emitSuper(n,...o){return await super.emit(n,...o)}async emit(n,...o){try{if(this.debug?this.log(`emit(${String(n)})`,n):this.log(`emit(${String(n)})`,o.length),!this.channel.isConnected)return this.log.warn("channel not connected"),!1;let i=await this.encoder.encode({event:n,args:o});return this.channel.postMessage(i),!0}catch(i){this.log.warn(`emit(${String(n)})`,i)}return!1}};r(ge,"PubSub");function Qu(e){return new ge(e)}r(Qu,"usePubSub");var Jn=1;var Ut=r(e=>e,"defaultSerialize"),Zn=Ut;function tc(e,t){let{post:n,on:o,eventNames:i=[],serialize:s=Ut,deserialize:u=Zn}=t,a=new Map;return o(async c=>{let l=u(c),[f,d,h,x]=l;if(f===1||f===2){let m,p;if(x!=null)try{let g=e[x];m=await g(...d)}catch(g){p=String(g)}else p="Method implementation missing";f===1&&h&&n(s(p?[4,p,h]:[3,m,h]))}else if(h){let m=a.get(h);m!=null&&(f===4?m.reject(d):m.resolve(d)),a.delete(h)}}),new Proxy({},{get(c,l){let f=r((...h)=>{n(s([2,h,null,l]))},"sendEvent");if(t.onlyEvents||i.includes(l))return f.asEvent=f,f;let d=r((...h)=>new Promise((x,m)=>{let p=Jn++;a.set(p,{resolve:x,reject:m}),n(s([1,h,p,l]))}),"sendCall");return d.asEvent=f,d}})}r(tc,"useRPC");var K=A("zeed:network","error"),je={cache:"no-cache",redirect:"follow",headers:{}};function Wn(e){let t=/:\/\/([^@]*)@/gi.exec(e);if(t&&t[1]){let[n,o]=t[1].split(":",2);return{url:e.replace(`${t[1]}@`,""),username:n,password:o}}}r(Wn,"parseBasicAuth");async function kt(e,t={},n=fetch){try{I(t)&&(t=le({},...J(t)));let o=Wn(String(e));o&&(e=o.url,t=le({},t,Kn(o.username,o.password))),t.headers!=null&&!(t.headers instanceof Headers)&&(t.headers=new Headers(t.headers));let i=await n(String(e),t);if(i.status<400)return i;try{K.warn(`Fetch of ${String(e)} returned status=${i.status}. Options:`,t),K.warn(`Response: ${await i.text()}`)}catch(s){K.error("Exception:",s)}}catch(o){K.error("fetchBasic",o)}}r(kt,"fetchBasic");async function ac(e,t={},n=fetch){try{let o=await kt(e,[{method:"GET",headers:{Accept:"application/json"}},t],n);if(o)return await o.json()}catch(o){K.error("fetchJSON error:",o)}}r(ac,"fetchJson");async function uc(e,t={},n=fetch){try{let o=await kt(e,[je,{method:"GET"},t],n);if(o)return await o.text()}catch(o){K.error("fetchHTML error:",o)}}r(uc,"fetchText");function cc(e,t="POST"){return{method:t,...je,headers:{"Content-Type":"application/x-www-form-urlencoded; charset=utf-8"},body:wt(e)}}r(cc,"fetchOptionsFormURLEncoded");function lc(e,t="POST"){return{method:t,...je,headers:{"Content-Type":"application/json; charset=utf-8"},body:S(e)}}r(lc,"fetchOptionsJson");function Kn(e,t){return{headers:{Authorization:`Basic ${We(`${e}:${t}`)}`}}}r(Kn,"fetchOptionsBasicAuth");function Ft(){if(typeof window<"u")return window}r(Ft,"getWindow");function Yn(){if(typeof navigator<"u")return navigator}r(Yn,"getNavigator");function pc(){return Ft()??typeof WorkerGlobalScope<"u"?self:typeof global<"u"?global:Function("return this;")()}r(pc,"getGlobal");var C=Yn(),N=Ft();function Qn(e={ios:!1,macos:!1,windows:!1,beaker:!1,electron:!1,wkwebview:!1,pwa:!1,pwaInstalled:!1,browser:!1,node:!1,worker:!1,test:!1,jest:!1,macosNative:!1,iosNative:!1,appleNative:!1,touch:!1}){return e.ios=C?.platform?.match(/(iPhone|iPod|iPad)/i)!=null,e.macos=!!C?.platform?.startsWith("Mac"),e.windows=!!C?.platform?.startsWith("Win"),e.beaker=N?.beaker!=null,e.electron=(C?.userAgent?.toLowerCase()?.indexOf(" electron/")||-1)>-1&&!e.beaker,e.wkwebview=N?.webkit?.messageHandlers!=null,e.pwa=C?.serviceWorker!=null,e.pwaInstalled=C?.standalone||N?.matchMedia?.("(display-mode: standalone)")?.matches,e.node=typeof process<"u"&&process?.release?.name==="node",e.browser=!e.electron&&!e.wkwebview&&!e.node,e.worker=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,e.jest=typeof jest<"u"||typeof vitest<"u",e.test=e.jest,e.macosNative=e.wkwebview&&e.macos,e.iosNative=e.wkwebview&&e.ios,e.appleNative=e.wkwebview,e.touch=N&&"ontouchstart"in N||(C?.maxTouchPoints||0)>1||C?.msPointerEnabled&&N?.MSGesture||N?.DocumentTouch&&document instanceof DocumentTouch,e}r(Qn,"detect");var Xn=r(()=>typeof window<"u"&&globalThis===window,"isBrowser"),gc=Qn();function mc(e){Xn()?window.addEventListener("beforeunload",e):typeof process<"u"&&process.on("exit",()=>e)}r(mc,"useExitHandler");var He=class{constructor(t={}){this.store={}}setItem(t,n){this.store[t]=Se(n)}getItem(t){return Se(this.store[t])}removeItem(t){delete this.store[t]}clear(){this.store={}}allKeys(){return Object.keys(this.store)}};r(He,"MemStorage");var wc=r(()=>{},"noop");export{r as a,Y as b,Ot as c,V as d,me as e,ne as f,re as g,Q as h,_e as i,ze as j,jt as k,A as l,br as m,S as n,Tr as o,_t as p,zt as q,Ve as r,qe as s,P as t,Dr as u,Je as v,Ze as w,We as x,Pr as y,Nt as z,Er as A,Ke as B,he as C,xe as D,Ye as E,q as F,Xe as G,be as H,Qe as I,Gt as J,Ur as K,kr as L,et as M,tt as N,Vt as O,D as P,Cr as Q,Or as R,$r as S,Br as T,qt as U,jr as V,Hr as W,_r as X,zr as Y,Jt as Z,Vr as _,we as $,qr as aa,Le as ba,Zt as ca,Wt as da,J as ea,Kt as fa,Yr as ga,Qr as ha,Xr as ia,Ae as ja,eo as ka,to as la,Yt as ma,no as na,Qt as oa,nt as pa,ro as qa,oo as ra,io as sa,so as ta,ao as ua,uo as va,co as wa,lo as xa,fo as ya,j as za,ho as Aa,xo as Ba,bo as Ca,To as Da,wo as Ea,Lo as Fa,Ao as Ga,vo as Ha,Do as Ia,Mo as Ja,nn as Ka,Ro as La,So as Ma,Io as Na,Co as Oa,Oo as Pa,rn as Qa,on as Ra,sn as Sa,ve as Ta,$o as Ua,Bo as Va,jo as Wa,Ho as Xa,an as Ya,_o as Za,zo as _a,Pe as $a,Ee as ab,ot as bb,un as cb,Vo as db,it as eb,st as fb,qo as gb,Jo as hb,ue as ib,Zo as jb,De as kb,cn as lb,ln as mb,Me as nb,at as ob,Wo as pb,Ko as qb,ae as rb,Yo as sb,Qo as tb,Xo as ub,ct as vb,ri as wb,oi as xb,lt as yb,ii as zb,ft as Ab,si as Bb,dt as Cb,ai as Db,E as Eb,k as Fb,L as Gb,di as Hb,pi as Ib,gi as Jb,mi as Kb,fn as Lb,xi as Mb,bi as Nb,Ti as Ob,F as Pb,Re as Qb,I as Rb,ce as Sb,Ai as Tb,vi as Ub,Di as Vb,Pi as Wb,Ei as Xb,pt as Yb,Mi as Zb,Ri as _b,Si as $b,Ui as ac,ki as bc,dn as cc,pn as dc,le as ec,gt as fc,Bi as gc,_i as hc,zi as ic,Ni as jc,Gi as kc,Zi as lc,Wi as mc,Ki as nc,Xi as oc,ht as pc,X as qc,xt as rc,os as sc,is as tc,ss as uc,as as vc,us as wc,cs as xc,ls as yc,fs as zc,bt as Ac,Tt as Bc,ms as Cc,xn as Dc,bs as Ec,As as Fc,Tn as Gc,wt as Hc,vs as Ic,Ms as Jc,Rs as Kc,Ss as Lc,Us as Mc,ks as Nc,Se as Oc,Fs as Pc,Is as Qc,Cs as Rc,Os as Sc,vn as Tc,Hs as Uc,Ue as Vc,ma as Wc,Pn as Xc,ya as Yc,ke as Zc,La as _c,Aa as $c,va as ad,Da as bd,Pa as cd,Sa as dd,Ua as ed,M as fd,ja as gd,Ha as hd,_a as id,At as jd,Ga as kd,Va as ld,Ie as md,Un as nd,kn as od,Fn as pd,In as qd,Cn as rd,On as sd,Bn as td,jn as ud,Hn as vd,Et as wd,Qa as xd,Xa as yd,zn as zd,eu as Ad,tu as Bd,H as Cd,Rt as Dd,Nn as Ed,nu as Fd,_ as Gd,ru as Hd,Vn as Id,qn as Jd,cu as Kd,Oe as Ld,Tu as Md,wu as Nd,vu as Od,Mu as Pd,pe as Qd,ee as Rd,Fu as Sd,$e as Td,z as Ud,Be as Vd,St as Wd,Vu as Xd,ge as Yd,Qu as Zd,tc as _d,Wn as $d,kt as ae,ac as be,uc as ce,cc as de,lc as ee,Kn as fe,Ft as ge,Yn as he,pc as ie,Qn as je,Xn as ke,gc as le,mc as me,He as ne,wc as oe};
|
|
12
|
+
//# sourceMappingURL=chunk-5KHLXHN6.js.map
|