zeed 0.9.26 → 0.10.1

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.
@@ -0,0 +1,16 @@
1
+ var Be=(e,t)=>t instanceof Object&&!Array.isArray(t)?Object.keys(t).sort().reduce((n,r)=>(n[r]=t[r],n),{}):t;function Zn(e,t=void 0){return JSON.stringify(e,Be,t)}function _t(e,t){let n=[],r=[];return t==null&&(t=function(o,i){return n[0]===i?"[Circular ~]":`[Circular ~.${r.slice(0,n.indexOf(i)).join(".")}]`}),function(o,i){if(n.length>0){let s=n.indexOf(this);~s?n.splice(s+1):n.push(this),~s?r.splice(s,1/0,o):r.push(o),~n.indexOf(i)&&(i=t?.call(this,o,i));}else n.push(i);i=Be(o,i);try{return e==null?i:e.call(this,o,i)}catch{}return String(i)}}function F(e,t,n,r){return JSON.stringify(e,_t(t,r),n)}var Kn=F;function Bt(e){let t=unescape(encodeURIComponent(e)),n=t.length,r=new Uint8Array(n);for(let o=0;o<n;o++)r[o]=t.codePointAt(o)||0;return r}function jt(e){let t=e.length,n="",r=0;for(;t>0;){let o=t<1e4?t:1e4,i=e.subarray(r,r+o);r+=o,n+=String.fromCodePoint.apply(null,i),t-=o;}return decodeURIComponent(escape(n))}var ne;function je(e){if(ne==null&&(ne=Bt,typeof TextEncoder<"u")){let t=new TextEncoder;ne=n=>t.encode(n);}return ne(e.normalize("NFC"))}var re;function He(e){if(re==null&&(re=jt,typeof TextDecoder<"u")){let t=new TextDecoder("utf-8",{ignoreBOM:!0});re=n=>t.decode(n);}return re(e).normalize("NFC")}function R(e){return e instanceof ArrayBuffer?new Uint8Array(e):typeof e=="string"?je(e):e.length?new Uint8Array(e):e}function Xn(...e){let t=0,n=e.flat(1).map(i=>{let s=R(i);return t+=s.length,s}),r=new Uint8Array(t),o=0;for(let i of n)r.set(i,o),o+=i.length;return r}function ze(e){if(typeof Buffer<"u")return Buffer.from(R(e)).toString("hex");let t="0123456789abcdef",n="";for(let r of [...R(e)])n+=t[r>>4]+t[r&15];return n}function Ne(e){return Uint8Array.from(e.match(/.{1,2}/g).map(t=>parseInt(t,16)))}function Ge(e,t=!1){let n=R(e),r="";if(typeof Buffer<"u")r=Buffer.from(n).toString("base64");else {let o="";for(let i=0;i<n.byteLength;i++)o+=String.fromCharCode(n[i]);r=btoa(o);}return t?r.replaceAll("=",""):r}function er(e){let t=R(e);if(typeof Buffer<"u")return Buffer.from(t).toString("base64url").replaceAll("=","");let n="";for(let r=0;r<t.byteLength;r++)n+=String.fromCharCode(t[r]);return btoa(n).replaceAll("+","-").replaceAll("/","_").replaceAll("=","")}function Ht(e){if(e=e.replaceAll("-","+").replaceAll("_","/"),typeof Buffer<"u"){let r=Buffer.from(e,"base64");return new Uint8Array(r.buffer,r.byteOffset,r.byteLength)}let t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}function tr(e){return He(Ht(e))}function Ve(e,t){if(e.byteLength!==t.byteLength)return !1;let n=R(e),r=R(t);for(let o=0;o<n.length;o++)if(n[o]!==r[o])return !1;return !0}function me(e){return je(F(e))}function ye(e){return JSON.parse(He(e))}function qe(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=[],r="0123456789ABCDEF";for(let o=0;o<e.length;o+=t){let i=e.slice(o,Math.min(o+t,e.length)),s=`0000${o.toString(16)}`.slice(-4),a=i.split("").map(c=>{let f=c.charCodeAt(0);return ` ${r[(240&f)>>4]}${r[15&f]}`}).join("");a+=" ".repeat(t-i.length);let u=i.replace(/[\x00-\x1F\x20]/g,".");u+=" ".repeat(t-i.length),n.push(`${s} ${a} ${u}`);}return n.join(`
2
+ `)}function W(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}var We="SHA-256",he="AES-GCM",Je="PBKDF2",zt=1e5;async function or(e,t=We){return R(await crypto.subtle.digest(t,R(e)))}async function ir(e,t={}){let n=R(e),r=await crypto.subtle.importKey("raw",n,Je,!1,["deriveKey"]);return await crypto.subtle.deriveKey({name:Je,salt:t.salt?R(t.salt):new Uint8Array(0),iterations:t.iterations??zt,hash:We},r,{name:he,length:256},!0,["encrypt","decrypt"])}function Ze(){return new Uint8Array([1,1])}async function Ke(e,t){let n=Ze(),r=W(12),o=await crypto.subtle.encrypt({name:he,iv:r},t,e),i=new Uint8Array(o),s=n.length+r.length+i.length,a=new Uint8Array(s),u=0;return a.set(n,u),u+=n.length,a.set(r,u),u+=r.length,a.set(i,u),a}async function Ye(e,t){let n=e.subarray(0,2);if(!Ve(n,Ze()))return Promise.reject(new Error(`Unknown magic ${n}`));let r=e.subarray(2,2+12),o=e.subarray(2+12,e.length),i=await crypto.subtle.decrypt({name:he,iv:r},t,o);return new Uint8Array(i)}function Nt(){return crypto.getRandomValues(new Uint32Array(1))[0]/4294967295}function P(){return typeof crypto<"u"?Nt():Math.random()}function ar(e=.25){return P()<e}function ur(e=100,t=0){return t+Math.floor(P()*(e-t))}function cr(e=100,t=0){return t+P()*(e-t)}function lr(e,t,n){return Math.max(e,Math.min(n,t))}function Gt(e){return e.reduce((t,n)=>t+n,0)}function fr(e){return Gt(e)/e.length}function dr(e){return !/^1?$|^(11+?)\1+$/.test("1".repeat(e))}function pr(e){for(let t=2;t<e;t++)if(e%t===0)return !1;return e>1}var xe=6;function gr(e=0,t=1,n){xe=((n??xe)*9301+49297)%233280;let r=xe/233280;return t+r*(e-t)}function Vt(e=""){let[t="",n="asc"]=e.split(" ");return n=n.toLowerCase(),{field:t,orderby:n,asc:n!=="desc",desc:n==="desc"}}function yr(e,t=!0){return `${e} ${t?"asc":"desc"}`}function be(e,t,n=!0){let r=e||0,o=t||0;return r>o?n?1:-1:r<o?n?-1:1:0}function hr(e,...t){if(t.length>0){let n=t.map(Vt),r=Array.from(e);return r.sort((o,i)=>{for(let{field:s,asc:a}of n){let u=be(o[s],i[s],a);if(u!==0)return u}return 0}),r}return e}function Te(e){return e.filter((t,n)=>e.indexOf(t)===n)}function qt(e,t){return Te(e.filter(n=>!t.includes(n)))}function Jt(...e){return Te(e.reduce((t=[],n)=>t.concat(n),[]))}function Z(...e){return e.flat(1/0)}function Wt(e,t){return Te(e).filter(n=>t.includes(n))}function wr(e,t){return qt(Jt(e,t),Wt(e,t))}function Qe(e,t){if(e&&Array.isArray(e)){let n;for(;(n=e.indexOf(t))!==-1;)e.splice(n,1);return e}return []}function Lr(e,t){return e.includes(t)||e.push(t),e}function we(e,t){return e.splice(0,e.length,...e.filter(t)),e}function Ar(e,t){let n=e.findIndex(r=>r===t);return n>=0?e.splice(n,1):e.push(t),e}function vr(e){return e.splice(0,e.length),e}function Zt(e,t=be){return Array.from(e).sort(t)}function Dr(e){return Zt(e,(t,n)=>t-n)}function Kt(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])}function Xe(e){return e.sort(()=>P()>.5?1:-1),e}function Pr(e){return Xe(Array.from(e))}function Er(e){for(;e.length>1;){let t=Array.from(e);if(Xe(t),!Kt(e,t))return t}return e}function Ur(e){return e[Math.floor(P()*e.length)]}function Mr(...e){return Z(e).reduce((t,n)=>t!=null?n>t?n:t:n,void 0)}function Rr(...e){return Z(e).reduce((t,n)=>t!=null?n<t?n:t:n,void 0)}function Cr(...e){return Z(e).reduce((t,n)=>t+n,0)}function Sr(...e){let t=Z(e);return t.reduce((n,r)=>n+r,0)/t.length}function Fr(e,t){let n=[],r=0,o=e.length;for(;r<o;)n.push(e.slice(r,r+=t));return n}function kr(e=0,t){if(e<=0)return [];let n=new Array(e);for(let r=0;r<e;r++)n[r]=t instanceof Function?t(r):t;return n}var Yt={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 Qt(e){let t=Yt[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 c=0;c<n.length;c++)n[c]=255;for(let c=0;c<t.length;c++){let f=t.charAt(c),l=f.charCodeAt(0);if(n[l]!==255)throw new TypeError(`${f} is ambiguous`);n[l]=c;}let r=t.length,o=t.charAt(0),i=Math.log(r)/Math.log(256),s=Math.log(256)/Math.log(r);function a(c,f=-1){let l=R(c);if(l.byteLength===0)return "";let y=0,h=0,d=l.byteLength;for(;h!==d&&l[h]===0;)h++;let g=(d-h)*s+1>>>0,T=new Uint8Array(g);for(;h!==d;){let E=l[h],I=0;for(let m=g-1;(E!==0||I<y)&&m!==-1;m--,I++)E+=256*T[m]>>>0,T[m]=E%r>>>0,E=E/r>>>0;if(E!==0)throw new Error("Non-zero carry");y=I,h++;}let x=g-y;for(;x!==g&&T[x]===0;)x++;let v="";for(;x<g;++x)v+=t.charAt(T[x]);return f>0?v.padStart(f,o):v}function u(c,f=-1){if(typeof c!="string")throw new TypeError("Expected String");if(c.length===0)return new Uint8Array;c=c.replace(/\s+/gi,"");let l=0,y=0;for(;c[l]===o;)l++;let h=(c.length-l)*i+1>>>0,d=new Uint8Array(h);for(;c[l];){let T=n[c.charCodeAt(l)];if(T===255)throw new Error(`Unsupported character "${c[l]}"`);let x=0;for(let v=h-1;(T!==0||x<y)&&v!==-1;v--,x++)T+=r*d[v]>>>0,d[v]=T%256>>>0,T=T/256>>>0;if(T!==0)throw new Error("Non-zero carry");y=x,l++;}let g=h-y;for(;g!==h&&d[g]===0;)g++;return f>0?new Uint8Array([...new Uint8Array(f-d.length+g),...d.slice(g)]):d.slice(g)}return {encode:a,decode:u}}var oe;function B(e){oe==null&&(oe=new Map);function t(){let o=oe.get(e);return o==null&&(o=Qt(e),oe.set(e,o)),o}function n(o,i=-1){return t().encode(o,i)}function r(o,i=-1){return t().decode(o,i)}return {encode:n,decode:r}}function Le(e,t=-1){return B(32).encode(e,t)}function et(e,t=-1){return B(32).decode(e.toLocaleLowerCase().replaceAll("l","1").replaceAll("s","5").replaceAll("o","0").replaceAll("i","1"),t)}function $r(e,t=-1){return B(16).encode(e,t)}function _r(e,t=-1){return B(16).decode(e,t)}function Br(e,t=-1){return B(58).encode(e,t)}function jr(e,t=-1){return B(58).decode(e,t)}function Ae(e,t=-1){return B(62).encode(e,t)}function tt(e,t=-1){return B(62).decode(e,t)}function Hr(e,t){return Math.ceil(e*(Math.log(256)/Math.log(t)))}var Nr=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);function Xt(e){return e.charAt(0).toUpperCase()+e.toLowerCase().slice(1)}function Gr(e){return e.replace(/\w\S*/g,Xt)}function Vr(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()}var nt=["1","true","yes","y","on"];function Wr(e,t=!1){return e==null||typeof e!="string"?t:nt.includes(String(e).trim().toLowerCase())}function Zr(e,t=0){return e==null||typeof e!="string"?t:parseInt(e.trim(),10)??t}function Kr(e,t=0){return e==null||typeof e!="string"?t:parseFloat(e.trim())??t}function en(e,t=!1){return e==null?t:typeof e=="boolean"?e:typeof e=="number"?e!==0:nt.includes(String(e).trim().toLowerCase())}function tn(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}function nn(e,t=0){return e==null?t:typeof e=="boolean"?e?1:0:typeof e=="number"?Math.floor(e):parseFloat(String(e).trim())??t}function ve(e,t=""){return e==null?t:String(e)??t}var Yr=nn,Qr=tn,Xr=ve,eo=en;function rn(e,t={}){let{trace:n=!0,pretty:r=!0}=t;return e.map(o=>{if(o&&typeof o=="object"){if(r&&(o instanceof Uint8Array||o instanceof ArrayBuffer))return `
3
+ ${qe(o)}
4
+ `;if(o instanceof Error)return n?`${o.name||"Error"}: ${o.message}
5
+ ${o.stack}`:`${o.name||"Error"}: ${o.message}`;try{return r?JSON.stringify(o,null,2):JSON.stringify(o)}catch{}}return String(o)})}function to(e,t={}){return rn(e,t).join(" ")}function no(e){try{return decodeURIComponent(escape(e))}catch{}return e}var rt=864e5;function Pe(e){return Math.floor(e/1e4)}function ot(e){return Math.floor(e/100%100)}function on(e){return Math.floor(e%100)}function oo(e){return [Pe(e),ot(e),on(e)]}function it(e,t=!1){return t?new Date(`${an(e)}T00:00:00.000Z`):new Date(e/1e4,e/100%100-1,e%100)}function st(){return se(new Date)}function io(e,t=!1){if(typeof e=="number")return e<100?void 0:e;if(typeof e=="string")return at(e);if(Array.isArray(e)&&e.length===3){let[n,r,o]=e;return Ee(n,r,o)}else if(e instanceof Date)return se(e,t)}function so(e){return it(e,!0)}function se(e,t=!1){return t?at(e.toISOString()):e.getFullYear()*1e4+(e.getMonth()+1)*100+e.getDate()}function ao(e){return se(e,!0)}function De(e,t=!0){return it(e,t).getTime()}function sn(e,t=!0){return se(new Date(e),t)}function an(e,t="-"){let n=String(e);return n.slice(0,4)+t+n.slice(4,6)+t+n.slice(6,8)}function Ee(e,t=1,n=1){if(!(t<1||t>12||n<1||n>31))return e*1e4+t*100+n}function at(e){let t=String(e).replace(/[^0-9]/g,"").slice(0,8);if(t.length===8)return +t}function uo(e,t=0){let n=Pe(e),r=ot(e);return t!==0&&(r+=t,n+=Math.floor((r-1)/12),r=Math.floor((r-1)%12)+1,r===0&&(r=12)),Ee(n,r,1)}function co(e,t=0){let n=Pe(e);return Ee(n+t,1,1)}function ie(e,t){return sn(De(e)+t*864e5)}function lo(e,t){return Math.round((De(t)-De(e))/864e5)}function fo(e,t){let n=[];for(t==null&&(t=st()),e<0&&(e=ie(t,e+1));e<=t;)n.push(e),e=ie(e,1);return n}function*po(e,t){let n=[];for(t==null&&(t=st()),e<0&&(e=ie(t,e+1));e<=t;)yield e,e=ie(e,1);return n}function ut(){let e,t;return [new Promise((r,o)=>{e=r,t=o;}),e,t]}async function mo(e){return new Promise(t=>setTimeout(t,e))}async function yo(){return new Promise(e=>setTimeout(e,0))}async function ho(e,t,n="timeoutReached"){return new Promise(async(r,o)=>{let i=!1,s=setTimeout(()=>{i=!0,r(n);},t);try{let a=await e;clearTimeout(s),i||r(a);}catch(a){clearTimeout(s),i||o(a);}})}function xo(e){return e==="timeoutReached"||e?.name==="Timeout reached"}async function ct(e,t){return t<=0?await e:new Promise(async(n,r)=>{let o=!1,i=setTimeout(()=>{o=!0,r(new Error("Timeout reached"));},t);try{let s=await e;clearTimeout(i),o||n(s);}catch(s){clearTimeout(i),o||r(s);}})}function bo(e,t,n=1e3){return new Promise((r,o)=>{let i=u=>{a&&(clearTimeout(a),s(),r(u));},s=()=>{a=null,e.off?e.off(t,i):e.removeEventListener&&e.removeEventListener(t,i);},a=setTimeout(()=>{s(),o(new Error("Did not response in time"));},n);e.on?e.on(t,i):e.addEventListener&&e.addEventListener(t,i);})}function C(e){return !!(e&&(e instanceof Promise||typeof e.then=="function"))}function O(e){return Promise.resolve(e)}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[r,o=1,i=1]=t;return o<1||o>12||i<1||i>31?void 0:new L(r*1e4+o*100+i)}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,r=Math.floor((n-1)%12)+1;r===0&&(r=12);let o=Math.floor((n-1)/12);return L.from([this.year+o,r,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)}};async function Lo(e,t,n){let r=L.from(e),o=L.from(t);for(;r&&o&&r?.days<=o?.days;){let i=n(r);C(i)&&await i,r=r.dayOffset(1);}}function Ao(){return new L}function vo(e){return new L(e)}function Do(e){return L.fromDate(new Date(e)).days}function un(e,t=2){return +(+e).toFixed(t)}function Eo(e,t=2){return +(+e/10**t).toFixed(t)}function Uo(e,t=2){return Math.round(+e*10**t)}function Mo(e,t=2){return t*(un(e,t)%1)}function $(e){return e!=null&&typeof e=="object"}function Ue(e){return Object(e)!==e}function _(e){return Array.isArray(e)}function ae(e){return $(e)&&!_(e)}function Co(e){return e?.constructor===Object}function lt(e){return typeof e=="string"}function ft(e){return typeof e=="number"&&!isNaN(e)}function So(e){return ft(e)&&Number.isInteger(e)}function Fo(e){return ft(e)&&Number.isSafeInteger(e)}function dt(e){return typeof e=="boolean"}function ko(e){return e==null}function Io(e){return e==null}function Oo(e){return $(e)&&e.constructor.name==="Uint8Array"}function $o(e){return e!=null}function _o(e){return e!=null&&e!==!1&&e!==!0}function cn(e,t,n=new WeakSet){if(e===t)return !0;if(n.has(t)||(Ue(t)||n.add(t),!(e instanceof Object)||!(t instanceof Object))||e.constructor!==t.constructor||e.length!==t.length)return !1;for(let r in e){if(!e.hasOwnProperty(r))continue;if(!t.hasOwnProperty(r))return !1;let o=e[r],i=t[r];if(!cn(o,i,n))return !1}for(let r in t)if(t.hasOwnProperty(r)&&!e.hasOwnProperty(r))return !1;return !0}function ln(e,t=new WeakSet){if(t.has(e))return "[Circular ~]";if(Ue(e)||t.add(e),ae(e)){for(let n in e)if(e.hasOwnProperty(n)){if(e[n]===void 0){delete e[n];continue}ln(e[n],t);}}else if(_(e))for(let n=e.length-1;n>=0;n--)e[n]===void 0&&e.splice(n,1);return e}function ue(e,...t){for(let n of t)$(e)||(e={}),!(n==null||!$(n))&&Object.keys(n).forEach(r=>{let o=e[r],i=n[r];Array.isArray(o)&&Array.isArray(i)?e[r]=o.concat(i):$(o)&&$(i)?e[r]=ue(Object.assign({},o),i):e[r]=i;});return e}var pt=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/'/g,"&apos;").replace(/"/g,"&quot;"),zo=e=>e.replace(/&lt;/gi,"<").replace(/&gt;/gi,">").replace(/&quot;/gi,'"').replace(/&apos;/gi,"'").replace(/&amp;/gi,"&");function Go(e,t,n=[]){return e.filter(r=>!t.some(o=>!o(r))).map(r=>{for(let o of n)r=o(r);return r}).filter(r=>r!=null)}function Vo(e,t){return e.reduce((n,r)=>{let o=String(r[t]);return (n[o]=n[o]||[]).push(r),n},{})}function qo(e,t){return Array.from(e.reduce((n,r)=>n.add(r[t]),new Set))}function Jo(e,t){return e.map(n=>n[t])}function Ko(e,t){return $(e)?Object.fromEntries(Object.entries(e).map(([n,r])=>{let o=t(n,r);return _(o)&&o.length===2?o:[n,o]}).filter(n=>n!=null)):{}}function Yo(e,t){return t.dispose&&e.dispose&&t.dispose.add(e.dispose),Object.assign(e,t)}function Qo(e){return Object.keys(e).length<=0}var gt=/[\u0000-\u001F\u0080-\u009F]/g,fn=/^\.+/,dn=/\.+$/;function mt(){return /[<>:"/\\|?*\u0000-\u001F]/g}function pn(){return /^(con|prn|aux|nul|com\d|lpt\d)$/i}function ei(e,t="_"){if(typeof e!="string")throw new TypeError("Expected a string");if(mt().test(t)&&gt.test(t))throw new Error("Replacement string cannot contain reserved filename characters");return e=e.replace(mt(),t).replace(gt,t).replace(fn,t).replace(dn,""),e=pn().test(e)?e+t:e,e.slice(0,100)}var gn=/[\\\-\[\]\/{}()*+?.^$|]/g;function yt(e){return e?e instanceof RegExp?e.source:e.replace(gn,"\\$&"):""}var X=e=>Math.abs(e)%1===.5,ht=e=>e%2===0,ri=e=>Math.ceil(e),oi=e=>Math.floor(e),ii=e=>Math.round(e),si=e=>{let t=Math.round(e);return X(e)&&ht(t)?t-1:t},ai=e=>X(e)?Math.sign(e)*Math.ceil(Math.abs(e)):Math.round(e),ui=e=>X(e)?Math.floor(e):Math.round(e),ci=e=>{let t=Math.round(e);return X(e)?ht(t)?t:t-1:t},li=e=>X(e)?Math.sign(e)*Math.floor(Math.abs(e)):Math.round(e);function xt(e){return e.reduce((t,n)=>Math.min(t,n.sort_weight||0),0)-1-P()}function bt(e){return e.reduce((t,n)=>Math.max(t,n.sort_weight||0),0)+1+P()}function pi(e,t,n){let r=n.length,o=e<t;if(r<=0||e>=r-1)return bt(n);if(e<=0)return xt(n);n=mn([...n]);let i=o?-1:0,s=n[e+i].sort_weight||0,u=(n[e+i+1].sort_weight||0)-s;if(u===0)return o?xt(n):bt(n);let c=s+u/2,f=u*.01*(P()-.5);return c+f}function mn(e){return e.sort((t,n)=>(t.sort_weight||0)-(n.sort_weight||0)),e}function yi(e={}){let{getter:t=a=>a.sort}=e;function n(a){return a.sort((u,c)=>(t(u)||0)-(t(c)||0)),a}function r(a){return a.reduce((u,c)=>Math.min(u,t(c)||0),0)-1-P()}function o(a){return a.reduce((u,c)=>Math.max(u,t(c)||0),0)+1+P()}function i(a,u){a==null&&(a=(u??0)-1),u==null&&(u=(a??0)+1);let c=u-a,f=a+c/2,l=c*.01*(P()-.5);return f+l}function s(a,u,c){let f=c.length,l=a<u;if(f<=0||a>=f-1)return o(c);if(a<=0)return r(c);c=n([...c]);let y=l?-1:0,h=t(c[a+y])||0,g=(t(c[a+y+1])||0)-h;if(g===0)return l?r(c):o(c);let T=h+g/2,x=g*.01*(P()-.5);return T+x}return {start:r,end:o,between:i,move:s,items:n}}var yn=/((?:(?:(?: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 bi(e){return e.split(yn).map((t,n)=>{let r=pt(t);return n%2?`<a target="_blank" href="${r}">${hn(r)}</a>`:r}).join("")}function hn(e){return e.replace(/^https?:\/\/(www\.)?/,"").replace(/\/$/,"")}function Tt(e){let t=[];for(let[n,r]of Object.entries(e))if(r!=null){Array.isArray(r)||(r=[r]);for(let o of r)o!=null&&t.push(`${encodeURIComponent(n)}=${encodeURIComponent(String(o))}`);}return t.join("&")}function Ti(e){let t={},n=(e[0]==="?"?e.substr(1):e).split("&");for(let r=0;r<n.length;r++){let o=n[r].split("="),i=decodeURIComponent(o[0]),s=decodeURIComponent(o[1]||"");t[i]!=null?(Array.isArray(t[i])||(t[i]=[t[i]]),t[i].push(s)):t[i]=s;}return t}function Ai(e,t,n){let r=e[t];return r===void 0&&(r=n(t,e),e[t]=r),r}async function vi(e,t,n){let r=e[t];return r===void 0&&(r=await n(t,e),e[t]=r),r}function Di(e){return e!=null?e.size!=null?e.size:e.length!=null?e.length:Object.keys(e).length:0}function Pi(e){return e!=null&&e.length>0?e[e.length-1]:void 0}function Ei(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}function Me(e){return Object(e)!==e?e:JSON.parse(F(e))}function Ui(e){return Object(e)!==e?e:JSON.parse(F(e))}function Mi(e){let t=new Map;return n=>{if(t.has(n))return t.get(n);let r=e(n);return t.set(n,r),r}}function Ri(e){let t=new Map;return async(...n)=>{let r=F(n);if(t.has(r))return t.get(r);let o=await e(...n);return t.set(r,o),o}}function Ci(e,t){let n=[];for(let r=0;r<e;r++)n.push(t(r,e));return n}var xn=/\\\s|\s+|#[^\n]*\n?/gm,bn=/\(\?P?<(\w[\w\d_]+)>|\((?!\?(:|\!|=|<=|<\!))/gm,wt=/^((?:\(\?[\w$]+\))?)\(\?<([=!])([\s\S]*?)\)/gm;function Tn(e){return typeof e=="string"?e:e.source||""}function Fi(e){return e.replace(/[-\[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}var Lt=class{constructor(t,n){this.namedGroups={};this.names=[];let r=n??"",o;if(t instanceof RegExp?(n==null&&(r=t.flags),o=t.source):o=t,r&&r.includes("x")&&(r=r.replace("x",""),o=o.replace(xn,a=>a[0]==="\\"?a:"")),!(t instanceof RegExp)){let a=0;o=o.replace(bn,(u,c)=>(a+=1,c?(c!=="index"&&c!=="length"&&!this.namedGroups[c]&&(this.namedGroups[c]=a),"("):u)),this.names=Object.keys(this.namedGroups);}o=Tn(o),wt.lastIndex=0;let s=wt.exec(o);s&&(this.lookBehind={rx:new RegExp(`${s[3]}$(?!\\s)`),expect:s?s[2]==="=":!s},o=o.substr(s[0].length)),this.rx=new RegExp(o,r);}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=[],r;for(this.rx.lastIndex=0;r=this.exec(t);)n.push(r);return this.rx.lastIndex=0,n}replace(t,n){let r=typeof n=="function"?n:()=>n;return t.replace(this.rx,o=>r(o))}};var wn=",";function Oi(e,t={}){let{separator:n=wn}=t,r="";for(let o=0;o<e.length;o++)r+=`${e[o].map(i=>{if(i==null||i==="")return "";if(dt(i))return i?1:0;let s=String(i);return (ae(i)||_(i))&&(s=F(i)),s.includes('"')||s.includes(`
6
+ `)||s.includes(n)?`"${s.replace(/"/g,'""')}"`:s}).join(n)}
7
+ `;return r}function Ln(e,t={}){let n=/("((?:(?:[^"]*?)(?:"")?)*)"|([^,;\t\n]*))([,;\t]|\n|\r\n)/g;t.separator&&(n=new RegExp(n.source.replaceAll(",;\\t",yt(t.separator)),n.flags));let r=[],o=[],i,s=`${e.replaceAll(`\r
8
+ `,`
9
+ `).trim()}
10
+ `;for(;i=n.exec(s);){let a=i[2]??i[3]??"";a=a.replaceAll('""','"'),o.push(a),i[4]===`
11
+ `&&(r.push(o),o=[]);}return r}function $i(e,t={}){let n=Ln(e,t),r=n[0];return n.slice(1).map(o=>Object.fromEntries(o.map((i,s)=>[r[s],i])))}function An(){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")}function ee(){let e=An();return e._zeedGlobal==null&&(e._zeedGlobal={}),e._zeedGlobal}function le(e={}){let{level:t=void 0,filter:n=void 0}=e,r=K(n),o=ce(t);return i=>{if(!o(i.level)||!r(i.name))return;let s=i.name?`[${i.name}]`:"";switch(i.level){case H:console.info(`I|* ${s}`,...i.messages);break;case z:console.warn(`W|** ${s}`,...i.messages);break;case N:console.error(`E|*** ${s}`,...i.messages);break;default:console.debug(`D| ${s}`,...i.messages);break}}}var j=-1,G=0,H=1,z=2,N=3,fe=4,Y=9007199254740991,At={"*":j,a:j,all:j,d:G,dbg:G,debug:G,i:H,inf:H,info:H,w:z,warn:z,warning:z,e:N,err:N,error:N,fatal:fe,off:Y,"-":Y};function vt(e=""){let t=[le()],n=u=>!0,r=!1,o=s,i=!1;function s(u="",c){let f=Re(c??j);function l(d,g){return f<=d?g:()=>{}}let y=l(G,(...d)=>{h({name:u,messages:d,level:G});});y.label=u,y.extend=function(d){return o(u?`${u}:${d}`:d)};let h=d=>{if(n(u))for(let g of t)g&&g(d);};return y.debug=l(G,(...d)=>{h({name:u,messages:d,level:G});}),y.info=l(H,(...d)=>{h({name:u,messages:d,level:H});}),y.warn=l(z,(...d)=>{h({name:u,messages:d,level:z});}),y.error=l(N,(...d)=>{h({name:u,messages:d,level:N});}),y.fatal=l(fe,(...d)=>{throw h({name:u,messages:d,level:fe}),new Error(`${d.map(String).join(" ")}`)}),y.assert=l(fe,(d,...g)=>{d||y.fatal(...g);}),y}function a(u="",c){let f=o(u,c);return i&&f.debug(`+++ init of logger "${u}" on level "${f.level}".`),f}return a.registerHandler=function(u){t.push(u);},a.setFilter=function(u){n=K(u);},a.setLock=(u=!0)=>r=u,a.setDebug=(u=!0)=>i=u,a.setHandlers=function(u=[]){o!==s&&(o=s),!r&&(t=[...u].filter(c=>typeof c=="function"));},a.level=j,a.setLogLevel=function(u=j){r||(a.level=u);},a.setFactory=function(u){r||(o=u);},a}function vn(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}function Dn(){return vn(typeof process<"u"?process.env.ZEED??process.env.DEBUG:typeof localStorage<"u"?localStorage.zeed??localStorage.debug:"*")}function K(e=Dn()){let t,n=[],r=[];if(!e)t=function(o){return !1};else if(e==="*")t=function(o){return !0};else {let o,i=e.split(/[\s,]+/),s=i.length;for(o=0;o<s;o++){if(!i[o])continue;let a=i[o].replace(/\*/g,".*?");a[0]==="-"?n.push(new RegExp(`^${a.substr(1)}$`)):r.push(new RegExp(`^${a}$`));}t=function(a){if(n.length===0&&r.length===0)return !0;let u,c;for(u=0,c=n.length;u<c;u++)if(n[u].test(a))return !1;for(u=0,c=r.length;u<c;u++)if(r[u].test(a))return !0;return !1};}return t.accept=r,t.reject=n,t.filter=e,t}function Pn(){return 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 Re(e){if(e===!1)return Y;if(typeof e=="number")return e;if(typeof e=="string"){let t=At[e.toLocaleLowerCase().trim()];if(t!=null)return t}return j}function ce(e=Pn()){let t=Re(e);return n=>n>=t}var V;function Ce(e){let t=vt();return e?e(t):t.setHandlers([le()]),t}function En(e){if(V==null)try{let t=ee();t!=null?t?.logger==null?(V=Ce(e),t.logger=V):V=t.logger:V=Ce(e);}catch{V=Ce(e);}return V}function M(e,t){return En()(e,t)}async function Un(e){typeof e=="function"?await O(e()):C(e)?await e:typeof e.dispose=="function"?await O(e.dispose()):C(e.dispose)?await e.dispose:typeof e.cleanup=="function"?await O(e.cleanup()):C(e.cleanup)&&await e.cleanup;}function te(e){let t=e;t!=null&&(lt(t)?t={name:t}:"debug"in t&&"label"in t&&(t={name:t.label,log:t}));let n=t?.name,r=t?.log??M("zeed:dispose"),o=[],i=async u=>{u!=null&&o.includes(u)&&(we(o,c=>c!==u),await Un(u));},s=async()=>{for(n&&r.debug(`dispose "${n}": ${o.length} entries`);o.length>0;)await i(o[0]);},a=u=>{if(u!=null)return o.unshift(u),()=>i(u)};return Object.assign(s,{track:a,add:a,untrack:i,dispose:s,exec:s,getSize(){return o.length},isDisposed(){return o.length<=0}})}var ns=te;function rs(e={}){let{mode:t="fifo"}=e,n=[],r=async(i=!1)=>{for(;n.length>0;){let s=n[0];if(we(n,a=>a!==s),typeof s=="function"){let a=s();if(C(a)){if(i)throw new Error(`Expected sync only function, but found async: ${s}`);await a;}}else if(C(s)){if(i)throw new Error(`Expected sync only function, but found async: ${s}`);await s;}else throw new Error(`Unhandled disposable: ${s}`)}};return Object.assign(r,{add:i=>{t==="lifo"?n.unshift(i):n.push(i);},exec:r,getSize(){return n.length}})}function os(e,t=0){let n=setTimeout(e,t);return ()=>{n&&(clearTimeout(n),n=void 0);}}function is(e,t){let n=setInterval(e,t);return ()=>{n&&(clearInterval(n),n=void 0);}}function ss(e,t,n,...r){return e==null?()=>{}:(e.on?e.on(t,n,...r):e.addEventListener&&e.addEventListener(t,n,...r),()=>{e.off?e.off(t,n,...r):e.removeEventListener&&e.removeEventListener(t,n,...r);})}function cs(){let e=!0;return (t,n)=>{let r=!1;if(e){e=!1;try{t(),r=!0;}finally{e=!0;}}else n!==void 0&&n();return r}}function ls(){let e=!0;return async(t,n)=>{let r=!1;if(e){e=!1;try{let o=t();C(o)&&await o,r=!0;}finally{e=!0;}}else if(n!==void 0){let o=n();C(o)&&await o;}return r}}var S=class{constructor(){this.subscribers={};this.subscribersOnAny=[];this._logEmitter=M("zeed:emitter","error");this.dispose=te();this.call=new Proxy({},{get:(t,n)=>async(...r)=>await this.emit(n,...r)});}async emit(t,...n){let r=!1;try{let o=this.subscribers[t]||[];if(this._logEmitter.debug("emit",this?.constructor?.name,t,...n,o),this.subscribersOnAny.forEach(i=>i(t,...n)),o.length>0){let i=o.map(s=>{try{return O(s(...n))}catch(a){this._logEmitter.warn("emit warning:",a);}return null}).filter(s=>s!=null);r=!0,await Promise.all(i);}}catch(o){this._logEmitter.error("emit exception",o);}return r}onAny(t){this.subscribersOnAny.push(t);}on(t,n){let r=this.subscribers[t]||[];return r.push(n),this.subscribers[t]=r,()=>{this.off(t,n);}}onCall(t){for(let[n,r]of Object.entries(t))this.on(n,r);}once(t,n){let r=async(...o)=>(this.off(t,r),await O(n(...o)));return this.on(t,r),()=>{this.off(t,n);}}off(t,n){return this.subscribers[t]=(this.subscribers[t]||[]).filter(r=>n&&r!==n),this}removeAllListeners(){return this.subscribers={},this}};function hs(){let e=ee().emitter;return e||(e=new S,ee().emitter=e),e}function xs(e,t){let n=Math.round(P()*100),r=[],o,i=(a,u)=>{let c={key:a,obj:u};r.push(c),o&&o();};return t?e.on?e.on(t,a=>{i(t,a);}):e.addEventListener?e.addEventListener(t,a=>{i(t,a);}):e.log.error(n,"Cannot listen to key"):e.onAny?e.onAny((a,u)=>{i(a,u);}):e.log.error(n,"cannot listen to all for",e),(a,u=!0)=>new Promise((c,f)=>{a||(a=t,a||r.length&&(a=r[0].key)),o=()=>{for(;r.length>0;){let l=r.shift();if(l.key===a)o=void 0,c(l.obj);else {if(u)continue;f(new Error(`Expected ${a}, but found ${l.key} with value=${l.obj}`));}break}},o();})}var Dt=()=>Date.now();function Ts(e){return e>999?`${(e/1e3).toFixed(1)}s`:`${e.toFixed(2)}ms`}function ws(...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 r=/(\d\d\d\d)-(\d\d)-(\d\d)/.exec(t);r&&(n=new Date(+r[1],+r[2]-1,+r[3],12,0));}if(n instanceof Date)return n}}}var de=16;function Fe(){return W(de)}function Mn(e=Fe()){return Ae(e,22)}function Rn(e){return Ae(e,22)}function Cn(e){return tt(e,de)}function Sn(e=Fe()){return Le(e,26)}function Fn(e){return Le(e,26)}function kn(e){return et(e,de)}var In="10000000-1000-4000-8000-100000000000",On=function(){return typeof crypto<"u"&&crypto.randomUUID!=null?crypto.randomUUID():In.replace(/[018]/g,e=>(e^W(1)[0]&15>>e/4).toString(16))};function $n(e){let t=ze(e);return `${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16)}`}function _n(e){return Ne(e.replaceAll("-",""))}var Pt=16e11;function Bn(e){let t=new Uint8Array([0,0,0,0,0,0]),n=t.length-1;for(let r=0;r<t.length;r++){let o=e&255;t[n-r]=o,e=(e-o)/256;}return t}function Et(){let e=Dt()-Pt;return new Uint8Array([...Bn(e),...W(10)])}function Es(){return Hn(Et())}function Us(e){return jn(Mt(e))}function jn(e){return new Date(Pt+e.slice(0,6).reduce((t,n)=>t*256+n,0))}function Ms(){return new Uint32Array(W(4))[0]}var ke={base62:{uuid:Mn,uuidDecode:Cn,uuidEncode:Rn},base32:{uuid:Sn,uuidDecode:kn,uuidEncode:Fn},uuidv4:{uuid:On,uuidDecode:_n,uuidEncode:$n}},pe="base62",Ut=!1;function Rs(e,t=!1){pe=e,Ut=t;}function q(){return ke[pe].uuid(Ut?Et():Fe())}function Mt(e){return ke[pe].uuidDecode(e)}function Hn(e){return ke[pe].uuidEncode(e)}function Cs(e){try{return Mt(e).length===de}catch{}return !1}var Se={};function k(e="id"){return Se[e]==null&&(Se[e]=0),`${e}-${Se[e]++}`}var zn=0;function Ss(){return `id-${zn++}`}var Ie=class extends S{constructor(){super(...arguments);this.id=q();}close(){this.dispose();}},ge=class extends Ie{constructor(){super(...arguments);this.isConnected=!0;}postMessage(n){this.other?.emit("message",{data:n,origin:"local",lastEventId:q()});}};function Os(){let e=new ge,t=new ge;return e.other=t,t.other=e,[e,t]}var Rt=class{async encode(t){return t}async decode(t){return t}},Q=class{async encode(t){return me(t)}async decode(t){return ye(t)}},Ct=class{constructor(t){this.key=t;}async encode(t){let n=me(t);return await Ke(n,this.key)}async decode(t){let n=await Ye(t,this.key);return ye(n)}};var St=(e,t,n={})=>new Proxy(n,{get:(r,o)=>o in r?r[o]:(...i)=>e(o,i,t)});function qs(e={}){let{name:t=k("hub"),encoder:n=new Q,retryAfter:r=1e3,ignoreUnhandled:o=!0,logLevel:i=!1}=e,s=M(t,i),a={},u,c=[],f,l={},y=()=>{clearTimeout(f);},h=async()=>{if(clearTimeout(f),u){if(u.isConnected)for(;c.length;){let x=c[0];try{u.postMessage(await n.encode(x)),c.shift();}catch(v){s.warn("postMessage",v);break}}c.length>0&&r>0&&(f=setTimeout(h,r));}},d=async x=>{s("enqueue postMessage",x),c.push(x),await h();},g=async x=>{u=x,u.on("connect",h),u.on("message",async v=>{s("onmessage",typeof v);let{name:E,args:I,id:m,result:p,error:w}=await n.decode(v.data);if(E){s(`name ${E} id ${m}`);try{if(a[E]==null)throw new Error(`handler for ${E} was not found`);let A=a[E](...I);C(A)&&(A=await A),s(`result ${A}`),m&&await d({id:m,result:A});}catch(A){let b=A instanceof Error?A:new Error(ve(A));s.warn("execution error",b.name),await d({id:m,error:{message:b.message,stack:b.stack,name:b.name}});}}else if(m)if(s(`response for id=${m}: result=${p}, error=${w}`),l[m]==null)p===void 0?s(`skip response for ${m}`):s.warn(`no response hook for ${m}`);else {let[A,b]=l[m];if(A&&b)if(delete l[m],w){let D=new Error(w.message);D.stack=w.stack,D.name=w.name,s.warn("reject",D.name),b(D);}else s("resolve",p),A(p);}else o||s.warn("Unhandled message",v);}),await h();},T=async(x,v,E={})=>{let{timeout:I=5e3}=E,m=q();return await d({name:x,args:v,id:m}),ct(new Promise((p,w)=>l[m]=[p,w]),I)};return e.channel&&g(e.channel),{dispose:y,connect:g,listen(x){Object.assign(a,x);},send(){return St(T,{},{options(x){return St(T,{...x})}})}}}var Oe=class extends S{constructor(n){super();this.publish=this.emit.bind(this);this.subscribe=this.on.bind(this);let{name:r,encoder:o=new Q,channel:i,debug:s=!1}=n;this.channel=i,this.encoder=o,this.debug=s,this.name=r??this.channel.id??k("pubsub"),this.log=M(`${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 u=await this.encoder.decode(a);if(this.debug?this.log(`channel message, event=${u?.event}, info=`,u):this.log(`channel message, event=${u?.event}`),u){let{event:c,args:f}=u;await this.emitSuper(c,...f);}});}get shortId(){return this.name.substr(0,6)}async emitSuper(n,...r){return await super.emit(n,...r)}async emit(n,...r){try{if(this.debug?this.log(`emit(${String(n)})`,n):this.log(`emit(${String(n)})`,r.length),!this.channel.isConnected)return this.log.warn("channel not connected"),!1;let o=await this.encoder.encode({event:n,args:r});return this.channel.postMessage(o),!0}catch(o){this.log.warn(`emit(${String(n)})`,o);}return !1}};function Qs(e){return new Oe(e)}var Nn=1;var Ft=e=>e,Gn=Ft;function ea(e,t){let{post:n,on:r,eventNames:o=[],serialize:i=Ft,deserialize:s=Gn}=t,a=new Map;return r(async u=>{let c=s(u),[f,l,y,h]=c;if(f===1||f===2){let d,g;if(h!=null)try{let T=e[h];d=await T(...l);}catch(T){g=String(T);}else g="Method implementation missing";f===1&&y&&n(i(g?[4,g,y]:[3,d,y]));}else if(y){let d=a.get(y);d!=null&&(f===4?d.reject(l):d.resolve(l)),a.delete(y);}}),new Proxy({},{get(u,c){let f=(...y)=>{n(i([2,y,null,c]));};if(t.onlyEvents||o.includes(c))return f.asEvent=f,f;let l=(...y)=>new Promise((h,d)=>{let g=Nn++;a.set(g,{resolve:h,reject:d}),n(i([1,y,g,c]));});return l.asEvent=f,l}})}var J=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??k("progress"),this.dispose.add(async()=>{for(let r of this._children)await r.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 r=new J(n);return this.addChild(r),r}removeChild(n){Qe(this._children,n),this.update();}getTotalUnits(){if(this.isIndeterminate())return 0;let n=this._totalUnits;for(let r of this._children)n+=r.getTotalUnits();return n}getCompletedUnits(){if(this.isIndeterminate())return 0;let n=this._completedUnits;for(let r of this._children)n+=r.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,r){this._totalUnits=n,r!=null&&(this._completedUnits=r),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 r=`${" ".repeat(n)}${this.name}: ${this._completedUnits} of ${this._totalUnits} units, ${Math.floor(this.getFraction()*100)} %, cancel=${this._isCancelled}
12
+ `;for(let o of this._children)r+=o.toString(n+1);return n===0?r.trim():r}};function fa(e={}){let{maxParallel:t=3,name:n=k("pool"),idConflictResolution:r="memoize"}=e,o=new S,i=te();i.add(v);let s=new J({name:n});s.on("progressCancelled",v);let a=0,u=0,c=0,f=0,l={};async function y(){if(a>0){let[m,p]=ut();return o.once("didFinish",p),m}}async function h(){for(let m of Object.keys(l))l[m].state==="finished"&&(await l[m].progress.dispose(),delete l[m]);}function d(){o.emit("didFinish"),a=0,u=0,h(),s.reset();}function g(){let m=0,p=0;for(let{max:w,resolved:A,state:b}of Object.values(l))m+=w,p+=b==="finished"?w:Math.min(w,A);o.emit("didUpdate",a,u,m,p);}function T(){if(g(),a>0&&a===u&&d(),c>=t)return;let m=Object.values(l).filter(p=>p.state==="waiting");if(m.length>0){let p;for(let w of m)w.group!=null&&Object.values(l).some(A=>A.state==="running"&&A.id!==w.id&&A.group===w.group)||(p==null||w.priority<p.priority)&&(p=w);if(p!=null){let w=p.id,A=p.done;p.state="running",++c,o.emit("didStart",w);let b=D=>{p&&(p.result=D,p.state="finished",p.resolved=p.max,p.progress?.setCompleted()),--c,++u,T();};p.task(p).then(D=>{A(D),o.emit("didResolve",w,D),b(D);}).catch(D=>{A(),o.emit("didReject",w,D),b();});}}}function x(m){let p=l[m];p&&p.state==="waiting"&&(l[m].state="finished",++u,o.emit("didCancel",m),l[m].progress.dispose(),g());}function v(){Object.keys(l).forEach(x);}function E(m){return l[m]!=null}function I(m,p={}){let w,A=new Promise(U=>w=U),b=p.id??q();if(l[b]!=null){let U=p.idConflictResolution??r;if(U==="replace")x(b);else if(U==="memoize"||U==="prioritize"){let _e=l[b];return U==="prioritize"&&(_e.priority=++f),{id:b,promise:(async()=>{if(_e.state==="finished")return l[b].result})(),dispose:()=>x(b),cancel:()=>x(b)}}else throw new Error(`Pool task with id=${b} already exists!`)}let D=new J({name:b,totalUnits:p.max??1,completeUnits:p.resolved??0});return s.addChild(D),l[b]={id:b,task:m,priority:++f,group:p.group,state:"waiting",max:p.max??1,resolved:p.resolved??0,done:w,payload:p.payload,progress:D,setMax(U){D.setTotalUnits(U),l[b].max=U,g();},setResolved(U){D.setCompletetedUnits(U),l[b].resolved=U,g();},incResolved(U=1){D.incCompletedUnits(U),l[b].resolved+=U,g();}},++a,T(),{id:b,promise:A,dispose:()=>x(b),cancel:()=>x(b)}}return {events:o,cancel:x,cancelAll:v,hasById:E,progress:s,enqueue:I,dispose:i,waitFinishAll:y}}var kt=class extends S{constructor(n={}){super();this.queue=[];this.waitToFinish=[];this.countMax=0;this.countResolved=0;this.paused=!1;let{name:r=k("queue"),logLevel:o}=n;this.name=r,this.log=M(`zeed:queue:${r}`,o??Y);}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:r,task:o,resolve:i}=n;this.currentTask=o();let s;try{this.log.info(`start task ${r}`),s=await this.currentTask,this.log(`finished task ${r} with result =`,s);}catch(a){this.log.warn("Error performing task",a);}i(s),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,r={}){let{immediate:o=!1,name:i=k(this.name)}=r;return o?(this.log.info(`immediate execution ${i}`),await n()):(this.log(`enqueue ${i}`),new Promise(s=>{this.queue.push({name:i,task:n,resolve:s}),this.countMax+=1,this.emit("didUpdate",this.countMax,this.countResolved),this.performNext();}))}async enqueueReentrant(n,r={}){return this.enqueue(n,{immediate:this.currentTask!=null,name:r.name})}async cancelAll(n=!0){this.log("cancelAll"),this.emit("didCancel");let r=this.queue.map(o=>o.resolve);this.queue=[],r.forEach(o=>o(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}};function ba(e,t={}){let {delay:n=100,trailing:r=!0,leading:o=!0}=t,i=0,s=0,a=0,u;function f(){return i?(clearTimeout(i),i=void 0,!0):!1}function l(...y){let h=Date.now(),d=h-s;let T=()=>{a=0,s=Date.now(),e.apply(this,y);};if(u=T,d>n||!i){o&&(d>n?T():++a);let x=d>n?n:n-d;f(),s=h,i=setTimeout(()=>{i=0,r&&(!o||a>0)&&u?.();},x);}else ++a;}return l.cancel=f,l.stop=()=>{f()&&u&&u();},l.immediate=async function(...h){f(),s=Date.now(),e.apply(this,h);},l.dispose=()=>l.stop(),l}function Ta(e,t={}){let{delay:n=100}=t,r=0,o=!1,i;function s(){r&&(clearTimeout(r),r=0);}async function a(){try{if(s(),i!=null){let f=[...i];i=void 0,o=!0,await O(e(...f)),o=!1,i!=null&&(s(),r=setTimeout(a,n));}}catch{}}function u(...f){i=[...f],s(),o===!1&&(r=setTimeout(a,n));}async function c(...f){s(),i=[...f],await a();}return u.cancel=s,u.dispose=s,u.immediate=c,u}function La(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")}function Da(e){let{level:t=void 0,filter:n=void 0,messages:r=[]}=e,o=K(n),i=ce(t);return s=>{i(s.level)&&o(s.name)&&r.push(s);}}var $e={cache:"no-cache",redirect:"follow",headers:{}};function Vn(e){let t=/:\/\/([^@]*)@/gi.exec(e);if(t&&t[1]){let[n,r]=t[1].split(":",2);return {url:e.replace(`${t[1]}@`,""),username:n,password:r}}}async function It(e,t={},n=fetch){try{_(t)&&(t=ue({},...Z(t)));let r=Vn(String(e));r&&(e=r.url,t=ue({},t,qn(r.username,r.password))),t.headers!=null&&!(t.headers instanceof Headers)&&(t.headers=new Headers(t.headers));let o=await n(String(e),t);if(o.status<400)return o;let i=M("zeed:network");try{i.warn(`Fetch of ${String(e)} returned status=${o.status}. Options:`,t),i.warn(`Response: ${await o.text()}`);}catch(s){i.error("Exception:",s);}}catch(r){M("zeed:network").error("fetchBasic",r);}}async function Ra(e,t={},n=fetch){try{let r=await It(e,[{method:"GET",headers:{Accept:"application/json"}},t],n);if(r)return await r.json()}catch(r){M("zeed:network").error("fetchJSON error:",r);}}async function Ca(e,t={},n=fetch){try{let r=await It(e,[$e,{method:"GET"},t],n);if(r)return await r.text()}catch(r){M("zeed:network").error("fetchHTML error:",r);}}function Sa(e,t="POST"){return {method:t,...$e,headers:{"Content-Type":"application/x-www-form-urlencoded; charset=utf-8"},body:Tt(e)}}function Fa(e,t="POST"){return {method:t,...$e,headers:{"Content-Type":"application/json; charset=utf-8"},body:F(e)}}function qn(e,t){return {headers:{Authorization:`Basic ${Ge(`${e}:${t}`)}`}}}function Ot(){if(typeof window<"u")return window}function Jn(){if(typeof navigator<"u")return navigator}function Ia(){return Ot()??typeof WorkerGlobalScope<"u"?self:typeof global<"u"?global:Function("return this;")()}function Oa(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}){let t=Jn(),n=Ot();return e.ios=t?.platform?.match(/(iPhone|iPod|iPad)/i)!=null,e.macos=!!t?.platform?.startsWith("Mac"),e.windows=!!t?.platform?.startsWith("Win"),e.beaker=n?.beaker!=null,e.electron=(t?.userAgent?.toLowerCase()?.indexOf(" electron/")||-1)>-1&&!e.beaker,e.wkwebview=n?.webkit?.messageHandlers!=null,e.pwa=t?.serviceWorker!=null,e.pwaInstalled=t?.standalone||n?.matchMedia?.("(display-mode: standalone)")?.matches,e.node=typeof process<"u"&&process?.release?.name==="node",e.browser=!e.electron&&!e.wkwebview&&!e.node,e.worker=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,e.jest=typeof jest<"u"||typeof vitest<"u",e.test=e.jest,e.macosNative=e.wkwebview&&e.macos,e.iosNative=e.wkwebview&&e.ios,e.appleNative=e.wkwebview,e.touch=n&&"ontouchstart"in n||(t?.maxTouchPoints||0)>1||t?.msPointerEnabled&&n?.MSGesture||n?.DocumentTouch&&document instanceof DocumentTouch,e}function Wn(){return typeof window<"u"&&globalThis===window}function $a(e){Wn()?window.addEventListener("beforeunload",e):typeof process<"u"&&process.on("exit",()=>e);}var $t=class{constructor(t={}){this.store={};}setItem(t,n){this.store[t]=Me(n);}getItem(t){return Me(this.store[t])}removeItem(t){delete this.store[t];}clear(){this.store={};}allKeys(){return Object.keys(this.store)}};var Ha=()=>{};
13
+
14
+ export { vr as $, De as $a, Yo as $b, En as $c, La as $d, Ke as A, Gr as Aa, Uo as Ab, Ei as Ac, Es as Ad, Ye as B, Vr as Ba, Mo as Bb, Me as Bc, Us as Bd, Nt as C, Wr as Ca, $ as Cb, Ui as Cc, jn as Cd, P as D, Zr as Da, Ue as Db, Mi as Dc, Ms as Dd, ar as E, Kr as Ea, _ as Eb, Ri as Ec, Rs as Ed, ur as F, en as Fa, ae as Fb, Ci as Fc, q as Fd, cr as G, tn as Ga, Co as Gb, Tn as Gc, Mt as Gd, lr as H, nn as Ha, lt as Hb, Fi as Hc, Hn as Hd, Gt as I, ve as Ia, ft as Ib, Lt as Ic, Cs as Id, fr as J, Yr as Ja, So as Jb, Oi as Jc, k as Jd, dr as K, Qr as Ka, Fo as Kb, Ln as Kc, Ss as Kd, pr as L, Xr as La, dt as Lb, $i as Lc, Ie as Ld, gr as M, eo as Ma, ko as Mb, ee as Mc, ge as Md, Vt as N, rn as Na, Io as Nb, vn as Nc, Os as Nd, yr as O, to as Oa, Oo as Ob, K as Oc, Rt as Od, be as P, no as Pa, $o as Pb, Re as Pc, Q as Pd, hr as Q, rt as Qa, _o as Qb, ce as Qc, Ct as Qd, Te as R, Pe as Ra, cn as Rb, le as Rc, St as Rd, qt as S, ot as Sa, ln as Sb, j as Sc, qs as Sd, Jt as T, on as Ta, ue as Tb, G as Tc, Oe as Td, Z as U, oo as Ua, pt as Ub, H as Uc, Qs as Ud, Wt as V, it as Va, zo as Vb, z as Vc, ea as Vd, wr as W, st as Wa, Go as Wb, N as Wc, J as Wd, Qe as X, io as Xa, Vo as Xb, fe as Xc, fa as Xd, Lr as Y, so as Ya, qo as Yb, Y as Yc, kt as Yd, we as Z, se as Za, Jo as Zb, At as Zc, ba as Zd, Ar as _, ao as _a, Ko as _b, vt as _c, Ta as _d, Zn as a, Zt as aa, sn as ab, Qo as ac, M as ad, Da as ae, F as b, Dr as ba, an as bb, ei as bc, te as bd, Vn as be, Kn as c, Kt as ca, Ee as cb, yt as cc, ns as cd, It as ce, Bt as d, Xe as da, at as db, X as dc, rs as dd, Ra as de, jt as e, Pr as ea, uo as eb, ht as ec, os as ed, Ca as ee, je as f, Er as fa, co as fb, ri as fc, is as fd, Sa as fe, He as g, Ur as ga, ie as gb, oi as gc, ss as gd, Fa as ge, R as h, Mr as ha, lo as hb, ii as hc, cs as hd, qn as he, Xn as i, Rr as ia, fo as ib, si as ic, ls as id, Ot as ie, ze as j, Cr as ja, po as jb, ai as jc, S as jd, Jn as je, Ne as k, Sr as ka, ut as kb, ui as kc, hs as kd, Ia as ke, Ge as l, Fr as la, mo as lb, ci as lc, xs as ld, Oa as le, er as m, kr as ma, yo as mb, li as mc, Dt as md, Wn as me, Ht as n, Qt as na, ho as nb, xt as nc, Ts as nd, $a as ne, tr as o, B as oa, xo as ob, bt as oc, ws as od, $t as oe, Ve as p, Le as pa, ct as pb, pi as pc, Fe as pd, Ha as pe, me as q, et as qa, bo as qb, mn as qc, Mn as qd, ye as r, $r as ra, C as rb, yi as rc, Rn as rd, qe as s, _r as sa, O as sb, bi as sc, Cn as sd, W as t, Br as ta, L as tb, hn as tc, Sn as td, We as u, jr as ua, Lo as ub, Tt as uc, Fn as ud, he as v, Ae as va, Ao as vb, Ti as vc, kn as vd, Je as w, tt as wa, vo as wb, Ai as wc, On as wd, zt as x, Hr as xa, Do as xb, vi as xc, $n as xd, or as y, Nr as ya, un as yb, Di as yc, _n as yd, ir as z, Xt as za, Eo as zb, Pi as zc, Et as zd };
15
+ //# sourceMappingURL=out.js.map
16
+ //# sourceMappingURL=chunk-G6V436SG.js.map