zeed 0.9.21 → 0.9.23

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