zeed 0.8.44 → 0.8.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-KIK665GG.js → chunk-SUZNEX7U.js} +1 -1
- package/dist/chunk-SUZNEX7U.js.map +1 -0
- package/dist/index.all.d.ts +2 -0
- package/dist/index.browser.cjs +4 -4
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.d.ts +2 -2
- package/dist/index.browser.js +1 -1
- package/dist/index.browser.js.map +1 -1
- package/dist/index.node.cjs +7 -7
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.d.ts +2 -2
- package/dist/index.node.js +6 -6
- package/dist/index.node.js.map +1 -1
- package/dist/{uuid-39bb6924.d.ts → uuid-21e05dd3.d.ts} +2 -0
- package/package.json +1 -1
- package/dist/chunk-KIK665GG.js.map +0 -1
|
@@ -5,4 +5,4 @@ var Ut=Object.defineProperty;var r=(e,t)=>Ut(e,"name",{value:t,configurable:!0})
|
|
|
5
5
|
${Ke(i)}
|
|
6
6
|
`;if(i instanceof Error)return n?`${i.name||"Error"}: ${i.message}
|
|
7
7
|
${i.stack}`:`${i.name||"Error"}: ${i.message}`;try{return o?JSON.stringify(i,null,2):JSON.stringify(i)}catch{}}return String(i)})}r(an,"formatMessages");function Xo(e,t={}){return an(e,t).join(" ")}r(Xo,"renderMessages");function ei(e){try{return decodeURIComponent(escape(e))}catch{}return e}r(ei,"fixBrokenUth8String");var Ee=864e5;function Pe(e){return Math.floor(e/1e4)}r(Pe,"dayYear");function ot(e){return Math.floor(e/100%100)}r(ot,"dayMonth");function un(e){return Math.floor(e%100)}r(un,"dayDay");function ri(e){return[Pe(e),ot(e),un(e)]}r(ri,"dayToParts");function it(e,t=!1){return t?new Date(`${ln(e)}T00:00:00.000Z`):new Date(e/1e4,e/100%100-1,e%100)}r(it,"dayToDate");function oi(){return ce(new Date)}r(oi,"dayFromToday");function ii(e,t=!1){if(typeof e=="number")return e<100?void 0:e;if(typeof e=="string")return st(e);if(Array.isArray(e)&&e.length===3){let[n,o,i]=e;return Me(n,o,i)}else if(e instanceof Date)return ce(e,t)}r(ii,"dayFromAny");function si(e){return it(e,!0)}r(si,"dayToDateGMT");function ce(e,t=!1){return t?st(e.toISOString()):e.getFullYear()*1e4+(e.getMonth()+1)*100+e.getDate()}r(ce,"dayFromDate");function ai(e){return ce(e,!0)}r(ai,"dayFromDateGMT");function De(e,t=!0){return it(e,t).getTime()}r(De,"dayToTimestamp");function cn(e,t=!0){return ce(new Date(e),t)}r(cn,"dayFromTimestamp");function ln(e,t="-"){let n=String(e);return n.slice(0,4)+t+n.slice(4,6)+t+n.slice(6,8)}r(ln,"dayToString");function Me(e,t=1,n=1){if(!(t<1||t>12||n<1||n>31))return e*1e4+t*100+n}r(Me,"dayFromParts");function st(e){let t=String(e).replace(/[^0-9]/g,"").slice(0,8);if(t.length===8)return+t}r(st,"dayFromString");function ui(e,t=0){let n=Pe(e),o=ot(e);return t!==0&&(o+=t,n+=Math.floor((o-1)/12),o=Math.floor((o-1)%12)+1,o===0&&(o=12)),Me(n,o,1)}r(ui,"dayMonthStart");function ci(e,t=0){let n=Pe(e);return Me(n+t,1,1)}r(ci,"dayYearStart");function li(e,t){return cn(De(e)+t*864e5)}r(li,"dayOffset");function fi(e,t){return Math.round((De(t)-De(e))/864e5)}r(fi,"dayDiff");var{warn:at}=A("zeed:promise");function ut(){let e,t;return[new Promise((o,i)=>{e=o,t=i}),e,t]}r(ut,"createPromise");async function mi(e){return new Promise(t=>setTimeout(t,e))}r(mi,"sleep");async function yi(){return new Promise(e=>setTimeout(e,0))}r(yi,"immediate");var ct=Symbol("timeout");async function hi(e,t,n=ct){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(hi,"timeout");var lt=new Error("Timeout reached");function xi(e){return e===ct||e===lt}r(xi,"isTimeout");async function ft(e,t){return t<=0?await e:new Promise(async(n,o)=>{let i=!1,s=setTimeout(()=>{i=!0,o(lt)},t);try{let u=await e;clearTimeout(s),i||n(u)}catch(u){clearTimeout(s),i||o(u)}})}r(ft,"tryTimeout");function bi(e,t,n=1e3){return new Promise((o,i)=>{let s=r(l=>{a&&(clearTimeout(a),u(),o(l))},"fn"),u=r(()=>{a=null,e.off?e.off(t,s):e.removeEventListener?e.removeEventListener(t,s):at("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):at("No listener method found for",e)})}r(bi,"waitOn");function P(e){return Boolean(e&&(e instanceof Promise||typeof e.then=="function"))}r(P,"isPromise");function B(e){return Promise.resolve(e)}r(B,"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 vi(e,t,n){let o=L.from(e),i=L.from(t);for(;o&&i&&o?.days<=i?.days;){let s=n(o);P(s)&&await s,o=o.dayOffset(1)}}r(vi,"forEachDay");function Di(){return new L}r(Di,"today");function Ei(e){return new L(e)}r(Ei,"day");function Pi(e){return L.fromDate(new Date(e)).days}r(Pi,"dateStringToDays");function fn(e,t=2){return+(+e).toFixed(t)}r(fn,"decimal");function Si(e,t=2){return+(+e/10**t).toFixed(t)}r(Si,"decimalFromCents");function Ui(e,t=2){return Math.round(+e*10**t)}r(Ui,"decimalToCents");function Fi(e,t=2){return t*(fn(e,t)%1)}r(Fi,"decimalCentsPart");var dt=r(e=>e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,"""),"escapeHTML"),Ci=r(e=>e.replace(/</gi,"<").replace(/>/gi,">").replace(/"/gi,'"').replace(/'/gi,"'").replace(/&/gi,"&"),"unescapeHTML");function Hi(e,t){return S(e)?Object.fromEntries(Object.entries(e).map(([n,o])=>{let i=t(n,o);return C(i)&&i.length===2?i:[n,i]}).filter(n=>n!=null)):{}}r(Hi,"objectMap");function ji(e,t){return t.dispose&&e.dispose&&t.dispose.add(e.dispose),Object.assign(e,t)}r(ji,"objectMergeDisposable");function _i(e){return Object.keys(e).length<=0}r(_i,"objectIsEmpty");var pt=/[\u0000-\u001F\u0080-\u009F]/g,dn=/^\.+/,pn=/\.+$/;function gt(){return/[<>:"/\\|?*\u0000-\u001F]/g}r(gt,"filenameReservedRegex");function gn(){return/^(con|prn|aux|nul|com\d|lpt\d)$/i}r(gn,"windowsReservedNameRegex");function qi(e,t="_"){if(typeof e!="string")throw new TypeError("Expected a string");if(gt().test(t)&&pt.test(t))throw new Error("Replacement string cannot contain reserved filename characters");return e=e.replace(gt(),t).replace(pt,t).replace(dn,t).replace(pn,""),e=gn().test(e)?e+t:e,e.slice(0,100)}r(qi,"toValidFilename");var mn=/[\\\-\[\]\/{}()*+?.^$|]/g;function Ji(e){return e?e instanceof RegExp?e.source:e.replace(mn,"\\$&"):""}r(Ji,"escapeRegExp");var X=r(e=>Math.abs(e)%1===.5,"isHalf"),mt=r(e=>e%2===0,"isEven"),Ki=r(e=>Math.ceil(e),"roundUp"),Yi=r(e=>Math.floor(e),"roundDown"),Qi=r(e=>Math.round(e),"roundHalfUp"),Xi=r(e=>{let t=Math.round(e);return X(e)&&mt(t)?t-1:t},"roundHalfOdd"),es=r(e=>X(e)?Math.sign(e)*Math.ceil(Math.abs(e)):Math.round(e),"roundHalfAwayFromZero"),ts=r(e=>X(e)?Math.floor(e):Math.round(e),"roundHalfDown"),ns=r(e=>{let t=Math.round(e);return X(e)?mt(t)?t:t-1:t},"roundHalfEven"),rs=r(e=>X(e)?Math.sign(e)*Math.floor(Math.abs(e)):Math.round(e),"roundHalfTowardsZero");function yt(e){return e.reduce((t,n)=>Math.min(t,n.sort_weight||0),0)-1-D()}r(yt,"startSortWeight");function ht(e){return e.reduce((t,n)=>Math.max(t,n.sort_weight||0),0)+1+D()}r(ht,"endSortWeight");function as(e,t,n){let o=n.length,i=e<t;if(o<=0||e>=o-1)return ht(n);if(e<=0)return yt(n);n=yn([...n]);let s=i?-1:0,u=n[e+s].sort_weight||0,l=(n[e+s+1].sort_weight||0)-u;if(l===0)return i?yt(n):ht(n);let c=u+l/2,g=l*.01*(D()-.5);return c+g}r(as,"moveSortWeight");function yn(e){return e.sort((t,n)=>(t.sort_weight||0)-(n.sort_weight||0)),e}r(yn,"sortedItems");function fs(e={}){let{getter:t=r(a=>a.sort,"getter")}=e;function n(a){return a.sort((l,c)=>(t(l)||0)-(t(c)||0)),a}r(n,"items");function o(a){return a.reduce((l,c)=>Math.min(l,t(c)||0),0)-1-D()}r(o,"start");function i(a){return a.reduce((l,c)=>Math.max(l,t(c)||0),0)+1+D()}r(i,"end");function s(a,l){a==null&&(a=(l??0)-1),l==null&&(l=(a??0)+1);let c=l-a,g=a+c/2,f=c*.01*(D()-.5);return g+f}r(s,"between");function u(a,l,c){let g=c.length,f=a<l;if(g<=0||a>=g-1)return i(c);if(a<=0)return o(c);c=n([...c]);let x=f?-1:0,p=t(c[a+x])||0,m=(t(c[a+x+1])||0)-p;if(m===0)return f?o(c):i(c);let d=p+m/2,y=m*.01*(D()-.5);return d+y}return r(u,"move"),{start:o,end:i,between:s,move:u,items:n}}r(fs,"useSorted");var hn=/((?:(?:(?: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 ms(e){return e.split(hn).map((t,n)=>{let o=dt(t);return n%2?`<a target="_blank" href="${o}">${xn(o)}</a>`:o}).join("")}r(ms,"linkifyPlainText");function xn(e){return e.replace(/^https?:\/\/(www\.)?/,"").replace(/\/$/,"")}r(xn,"toHumanReadableUrl");function xt(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(xt,"encodeQuery");function ys(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(ys,"parseQuery");function Ts(e,t,n){let o=e[t];return o===void 0&&(o=n(t,e),e[t]=o),o}r(Ts,"ensureKey");async function ws(e,t,n){let o=e[t];return o===void 0&&(o=await n(t,e),e[t]=o),o}r(ws,"ensureKeyAsync");function Ls(e){return e!=null?e.size!=null?e.size:e.length!=null?e.length:Object.keys(e).length:0}r(Ls,"size");function As(e){return e!=null&&e.length>0?e[e.length-1]:void 0}r(As,"last");function vs(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(vs,"empty");function Re(e){return Object(e)!==e?e:JSON.parse(U(e))}r(Re,"cloneObject");function Ds(e){return Object(e)!==e?e:JSON.parse(U(e))}r(Ds,"cloneJsonObject");function Es(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(Es,"memoize");function Ps(e){let t=new Map;return async(...n)=>{let o=U(n);if(t.has(o))return t.get(o);let i=await e(...n);return t.set(o,i),i}}r(Ps,"memoizeAsync");function Ms(e,t){let n=[];for(let o=0;o<e;o++)n.push(t(o,e));return n}r(Ms,"forTimes");var bn=/\\\s|\s+|#[^\n]*\n?/gm,Tn=/\(\?P?<(\w[\w\d_]+)>|\((?!\?(:|\!|=|<=|<\!))/gm,bt=/^((?:\(\?[\w$]+\))?)\(\?<([=!])([\s\S]*?)\)/gm,wn=A("zeed:xrx");function Ln(e){return typeof e=="string"?e:e.source||""}r(Ln,"regExpString");function Fs(e){return e.replace(/[-\[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}r(Fs,"regExpEscape");var Se=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(bn,a=>a[0]==="\\"?a:"")),!(t instanceof RegExp)){let a=0;i=i.replace(Tn,(l,c)=>(a+=1,c?(c!=="index"&&c!=="length"&&!this.namedGroups[c]?this.namedGroups[c]=a:wn.error(`Unallowed or duplicate group name: ${c}`),"("):l)),this.names=Object.keys(this.namedGroups)}i=Ln(i),bt.lastIndex=0;let u=bt.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(Se,"XRX");var An=A("zeed:dispose");async function vn(e){typeof e=="function"?await B(e()):P(e)?await e:typeof e.dispose=="function"?await B(e.dispose()):P(e.dispose)?await e.dispose:typeof e.cleanup=="function"?await B(e.cleanup()):P(e.cleanup)&&await e.cleanup}r(vn,"callDisposer");function Ue(e){let{name:t}=typeof e=="string"?{name:e}:e??{},n=[],o=r(async u=>{u!=null&&n.includes(u)&&(Ae(n,a=>a!==u),await vn(u))},"untrack"),i=r(async()=>{for(t&&An.debug(`dispose ${t}: ${n.length} entries`);n.length>0;)await o(n[0])},"dispose"),s=r(u=>{if(u!=null)return n.unshift(u),()=>o(u)},"track");return Object.assign(i,{track:s,add:s,untrack:o,dispose:i,exec:i,getSize(){return n.length}})}r(Ue,"useDispose");var Bs=Ue;function Hs(e={}){let{mode:t="fifo"}=e,n=[],o=r(async(s=!1)=>{for(;n.length>0;){let u=n[0];if(Ae(n,a=>a!==u),typeof u=="function"){let a=u();if(P(a)){if(s)throw new Error(`Expected sync only function, but found async: ${u}`);await a}}else if(P(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(Hs,"useDefer");function js(e,t=0){let n=setTimeout(e,t);return()=>{n&&(clearTimeout(n),n=void 0)}}r(js,"useTimeout");function _s(e,t){let n=setInterval(e,t);return()=>{n&&(clearInterval(n),n=void 0)}}r(_s,"useInterval");function Ns(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(Ns,"useEventListener");function Vs(){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(Vs,"useMutex");function Js(){let e=!0;return async(t,n)=>{let o=!1;if(e){e=!1;try{let i=t();P(i)&&await i,o=!0}finally{e=!0}}else if(n!==void 0){let i=n();P(i)&&await i}return o}}r(Js,"useAsyncMutex");var J=A("zeed:emitter"),M=class{constructor(){this.subscribers={};this.subscribersOnAny=[];this.dispose=Ue();this.call=new Proxy({},{get:(t,n)=>async(...o)=>await this.emit(n,...o)})}async emit(t,...n){let o=!1;this.dispose.add(()=>{this.subscribers={},this.subscribersOnAny=[]});try{let i=this.subscribers[t]||[];if(this.subscribersOnAny.forEach(s=>s(t,...n)),i.length>0){let s=i.map(u=>{try{return B(u(...n))}catch(a){J.warn("emit warning:",a)}return null}).filter(u=>u!=null);o=!0,await Promise.all(s)}}catch(i){J.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 B(n(...i))),"onceListener");return this.on(t,o),()=>{this.off(t,n)}}off(t,n){return this.subscribers[t]=(this.subscribers[t]||[]).filter(o=>n&&o!==n),this}removeAllListeners(){return this.subscribers={},this}};r(M,"Emitter");function ta(){let e=Y().emitter;return e||(e=new M,Y().emitter=e),e}r(ta,"getGlobalEmitter");var na=new M;function ra(e,t){let n=Math.round(D()*100),o=[],i,s=r((a,l)=>{let c={key:a,obj:l};o.push(c),i&&i()},"incoming");return t?e.on?e.on(t,a=>{s(t,a)}):e.addEventListener?e.addEventListener(t,a=>{s(t,a)}):J.error(n,"Cannot listen to key"):e.onAny?e.onAny((a,l)=>{s(a,l)}):J.error(n,"cannot listen to all for",e),r((a,l=!0)=>new Promise((c,g)=>{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,c(f.obj);else{if(l){J.warn(n,`Unhandled event ${a} with value: ${f.obj}`);continue}g(new Error(`Expected ${a}, but found ${f.key} with value=${f.obj}`)),J.error(n,`Unhandled event ${a} with value: ${f.obj}`)}break}},"lazyResolve"),i()}),"on")}r(ra,"lazyListener");var Tt=r(()=>Date.now(),"getTimestamp");function sa(e){return e>999?`${(e/1e3).toFixed(1)}s`:`${e.toFixed(2)}ms`}r(sa,"formatMilliseconds");function aa(...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(aa,"parseDate");var{encode:wt,decode:Dn}=$(62),{encode:Lt,decode:En}=$(32),le=16;function ke(){return G(le)}r(ke,"uuidBytes");function Pn(e=ke()){return wt(e,22)}r(Pn,"uuidB62");function Mn(e){return wt(e,22)}r(Mn,"uuidEncodeB62");function Rn(e){return Dn(e,le)}r(Rn,"uuidDecodeB62");function Sn(e=ke()){return Lt(e,26)}r(Sn,"uuidB32");function Un(e){return Lt(e,26)}r(Un,"uuidEncodeB32");function Fn(e){return En(e,le)}r(Fn,"uuidDecodeB32");var kn="10000000-1000-4000-8000-100000000000",In=typeof crypto<"u"&&crypto.randomUUID!=null?crypto.randomUUID.bind(crypto):()=>kn.replace(/[018]/g,e=>(e^G(1)[0]&15>>e/4).toString(16));function Cn(e){let t=Ve(e);return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16)}`}r(Cn,"uuidEncodeV4");function On(e){return Je(e.replaceAll("-",""))}r(On,"uuidDecodeV4");var At=16e11;function $n(e){let t=new Uint8Array([0,0,0,0,0,0]),n=t.length-1;for(let o=0;o<t.length;o++){let i=e&255;t[n-o]=i,e=(e-i)/256}return t}r($n,"longToByteArray");function vt(){let e=Tt()-At;return new Uint8Array([...$n(e),...G(10)])}r(vt,"suidBytes");function Ba(){return Hn(vt())}r(Ba,"suid");function Ha(e){return Bn(Et(e))}r(Ha,"suidDate");function Bn(e){return new Date(At+e.slice(0,6).reduce((t,n)=>t*256+n,0))}r(Bn,"suidBytesDate");var ja=r(()=>new Uint32Array(G(4))[0],"uuid32bit"),Ie={base62:{uuid:Pn,uuidDecode:Rn,uuidEncode:Mn},base32:{uuid:Sn,uuidDecode:Fn,uuidEncode:Un},uuidv4:{uuid:In,uuidDecode:On,uuidEncode:Cn}},fe="base62",Dt=!1;function _a(e,t=!1){fe=e,Dt=t}r(_a,"setUuidDefaultEncoding");function H(){return Ie[fe].uuid(Dt?vt():ke())}r(H,"uuid");function Et(e){return Ie[fe].uuidDecode(e)}r(Et,"uuidDecode");function Hn(e){return Ie[fe].uuidEncode(e)}r(Hn,"uuidEncode");function Na(e){try{return Et(e).length===le}catch{}return!1}r(Na,"uuidIsValid");var Fe={};function j(e="id"){return Fe[e]==null&&(Fe[e]=0),`${e}-${Fe[e]++}`}r(j,"uname");var jn=0;function za(){return`id-${jn++}`}r(za,"qid");var _n=(o=>(o[o.waiting=0]="waiting",o[o.running=1]="running",o[o.finished=2]="finished",o))(_n||{}),Nn=(o=>(o[o.replace=0]="replace",o[o.memoize=1]="memoize",o[o.error=2]="error",o))(Nn||{});function Wa(e={}){let{maxParallel:t=3}=e,n=new M,o=0,i=0,s=0,u=0,a={};async function l(){if(o>0){let[m,d]=ut();return n.once("didFinish",d),m}}r(l,"waitFinishAll");function c(){n.emit("didFinish"),o=0,i=0}r(c,"didFinish");function g(){let m=0,d=0;for(let{max:y,resolved:T,state:b}of Object.values(a))m+=y,d+=b===2?y:Math.min(y,T);n.emit("didUpdate",o,i,m,d)}r(g,"didUpdate");function f(){if(g(),o>0&&o===i&&c(),s>=t)return;let m=Object.values(a).filter(d=>d.state===0);if(m.length>0){let d;for(let y of m)y.group!=null&&Object.values(a).some(T=>T.state===1&&T.id!==y.id&&T.group===y.group)||(d==null||y.priority<d.priority)&&(d=y);if(d!=null){let y=d.id,T=d.done;d.state=1,++s,n.emit("didStart",y);let b=r(w=>{d&&(d.result=w,d.state=2,d.resolved=d.max),--s,++i,f()},"taskFinished");d.task(d).then(w=>{T(w),n.emit("didResolve",y,w),b(w)}).catch(w=>{T(),n.emit("didReject",y,w),b()})}}}r(f,"performNext");function x(m){let d=a[m];d&&d.state===0&&(a[m].state=2,++i,n.emit("didCancel",m),g())}r(x,"cancel");function p(){Object.keys(a).forEach(x)}r(p,"cancelAll");function h(m,d={}){let y,T=new Promise(w=>y=w),b=d.id??H();if(a[b]!=null){let w=d.idConflictResolution??1;if(w===0)x(b);else if(w===1){let v=a[b];return{id:b,promise:(async()=>{if(v.state===2)return a[b].result})(),dispose:()=>x(b),cancel:()=>x(b)}}else throw new Error(`Pool task with id=${b} already exists!`)}return a[b]={id:b,task:m,priority:++u,group:d.group,state:0,max:d.max??1,resolved:d.resolved??0,done:y,payload:d.payload,setMax(w){a[b].max=w,g()},setResolved(w){a[b].resolved=w,g()},incResolved(w=1){a[b].resolved+=w,g()}},++o,f(),{id:b,promise:T,dispose:()=>x(b),cancel:()=>x(b)}}return r(h,"enqueue"),{events:n,cancel:x,cancelAll:p,enqueue:h,dispose:p,waitFinishAll:l}}r(Wa,"usePool");var Ce=class extends M{constructor(n={}){super();this.queue=[];this.waitToFinish=[];this.countMax=0;this.countResolved=0;this.paused=!1;let{name:o=j("queue"),logLevel:i}=n;this.name=o,this.log=A(`zeed:queue:${o}`,i??1/0)}async performNext(){if(this.log("performNext, queue.length =",this.queue.length),this.currentTask!=null){this.log("performNext => skip while another task is running");return}if(this.paused){this.log("performNext => skip while is paused");return}for(;this.currentTask==null&&!this.paused;){let n=this.queue.shift();if(this.log(`performNext => ${n?.name}`),n==null)break;this.countResolved===0&&this.emit("didStart",this.countMax);let{name:o,task:i,resolve:s}=n;this.currentTask=i();let u;try{this.log.info(`start task ${o}`),u=await this.currentTask,this.log(`finished task ${o} with result =`,u)}catch(a){this.log.warn("Error performing task",a)}s(u),this.currentTask=void 0,this.countResolved+=1,this.emit("didUpdate",this.countMax,this.countResolved)}for(this.queue.length===0&&(this.emit("didFinish"),this.countMax=0,this.countResolved=0);this.waitToFinish.length>0;)this.waitToFinish.shift()()}async enqueue(n,o={}){let{immediate:i=!1,name:s=j(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(Ce,"SerialQueue");var W=!1,Z=W?A("zeed:throttle"):()=>{};function iu(e,t={}){let{delay:n=100,trailing:o=!0,leading:i=!0}=t,s=0,u=0,a=0,l,c=Date.now();function g(){s&&(clearTimeout(s),s=void 0)}r(g,"clearExistingTimeout");function f(...p){let h=Date.now(),m=h-u;function d(){let T=Date.now();return`total ${(T-c).toFixed(1)}ms - elapsed ${(T-u).toFixed(1)}ms - visited ${a}x`}r(d,"debugElapsed");let y=r(()=>{a=0,u=Date.now(),e.apply(this,p)},"exec");if(l=y,m>n||!s){W&&Z("elapsed",d()),i&&(m>n?(W&&Z("\u{1F680} leading",d()),y()):++a);let T=m>n?n:n-m;Z(`\u23F1 start timeout with ${T.toFixed(1)}ms`,d()),g(),u=h,s=setTimeout(()=>{W&&Z("\u23F1 reached timeout",d()),s=0,o&&(!i||a>0)&&(W&&Z("\u{1F680} trailing",d()),l?.())},T)}else++a,W&&Z("visited",d())}r(f,"wrapper");async function x(...p){g(),u=Date.now(),e.apply(this,p)}return r(x,"immediate"),f.cancel=g,f.dispose=g,f.immediate=x,f}r(iu,"throttle");function su(e,t={}){let{delay:n=100}=t,o=0;function i(){o&&(clearTimeout(o),o=0)}r(i,"clearExistingTimeout");function s(...a){i(),o=setTimeout(()=>{o=0,e.apply(this,a)},n)}r(s,"wrapper");async function u(...a){i(),e.apply(this,a)}return r(u,"immediate"),s.cancel=i,s.dispose=i,s.immediate=u,s}r(su,"debounce");function cu(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(cu,"isLocalHost");function pu(e){let{level:t=void 0,filter:n=void 0,messages:o=[]}=e,i=q(n),s=oe(t);return u=>{!s(u.level)||!i(u.name)||o.push(u)}}r(pu,"LoggerMemoryHandler");var de=class extends M{constructor(){super(...arguments);this.id=H()}close(){this.dispose()}};r(de,"Channel");var ee=class extends de{constructor(){super(...arguments);this.isConnected=!0}postMessage(n){this.other?.emit("message",{data:n,origin:"local",lastEventId:H()})}};r(ee,"LocalChannel");function xu(){let e=new ee,t=new ee;return e.other=t,t.other=e,[e,t]}r(xu,"createLocalChannelPair");var Oe=class{async encode(t){return t}async decode(t){return t}};r(Oe,"NoopEncoder");var _=class{async encode(t){return he(t)}async decode(t){return xe(t)}};r(_,"JsonEncoder");var $e=class{constructor(t){this.key=t}async encode(t){let n=he(t);return await Xe(n,this.key)}async decode(t){let n=await et(t,this.key);return xe(n)}};r($e,"CryptoEncoder");var Pt=r((e,t,n={})=>new Proxy(n,{get:(o,i)=>i in o?o[i]:(...s)=>e(i,s,t)}),"createPromiseProxy");function Su(e={}){let{name:t=j("hub"),encoder:n=new _,retryAfter:o=1e3,ignoreUnhandled:i=!0,logLevel:s=!1}=e,u=A(t,s),a={},l,c=[],g,f={},x=r(()=>{clearTimeout(g)},"dispose"),p=r(async()=>{if(clearTimeout(g),l){if(l.isConnected)for(;c.length;){let y=c[0];try{l.postMessage(await n.encode(y)),c.shift()}catch(T){u.warn("postMessage",T);break}}c.length>0&&o>0&&(g=setTimeout(p,o))}},"postNext"),h=r(async y=>{u("enqueue postMessage",y),c.push(y),await p()},"postMessage"),m=r(async y=>{l=y,l.on("connect",p),l.on("message",async T=>{u("onmessage",typeof T);let{name:b,args:w,id:v,result:z,error:k}=await n.decode(T.data);if(b){u(`name ${b} id ${v}`);try{if(a[b]==null)throw new Error(`handler for ${b} was not found`);let R=a[b](...w);P(R)&&(R=await R),u(`result ${R}`),v&&h({id:v,result:R})}catch(R){let I=R instanceof Error?R:new Error(ve(R));u.warn("execution error",I.name),h({id:v,error:{message:I.message,stack:I.stack,name:I.name}})}}else if(v)if(u(`response for id=${v}: result=${z}, error=${k}`),f[v]==null)z===void 0?u(`skip response for ${v}`):u.warn(`no response hook for ${v}`);else{let[R,I]=f[v];if(R&&I)if(delete f[v],k){let te=new Error(k.message);te.stack=k.stack,te.name=k.name,u.warn("reject",te.name),I(te)}else u("resolve",z),R(z)}else i||u.warn("Unhandled message",T)}),p()},"connect"),d=r(async(y,T,b={})=>{let{timeout:w=5e3}=b,v=H();return h({name:y,args:T,id:v}),ft(new Promise((z,k)=>f[v]=[z,k]),w)},"fetchMessage");return e.channel&&m(e.channel),{dispose:x,connect:m,listen(y){Object.assign(a,y)},send(){return Pt(d,{},{options(y){return Pt(d,{...y})}})}}}r(Su,"useMessageHub");var pe=class extends M{constructor(n){super();this.publish=this.emit;this.subscribe=this.on;let{name:o,encoder:i=new _,channel:s,debug:u=!1}=n;this.channel=s,this.encoder=i,this.debug=u,this.name=o??this.channel.id??j("pubsub"),this.log=A(`${this.shortId}`),this.debug&&(this.channel.on("connect",()=>{this.log("channel connected")}),this.channel.on("disconnect",()=>{this.log("channel disconnected")})),this.channel.on("message",async({data:a})=>{let l=await this.encoder.decode(a);if(this.debug?this.log(`channel message, event=${l?.event}, info=`,l):this.log(`channel message, event=${l?.event}`),l){let{event:c,args:g}=l;await this.emitSuper(c,...g)}})}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(pe,"PubSub");function $u(e){return new pe(e)}r($u,"usePubSub");var zn=1;var Mt=r(e=>e,"defaultSerialize"),qn=Mt;function ju(e,t){let{post:n,on:o,eventNames:i=[],serialize:s=Mt,deserialize:u=qn}=t,a=new Map;return o(async l=>{let c=u(l),[g,f,x,p]=c;if(g===1||g===2){let h,m;if(p!=null)try{h=await e[p](...f)}catch(d){m=String(d)}else m="Method implementation missing";g===1&&x&&n(s(m?[4,m,x]:[3,h,x]))}else if(x){let h=a.get(x);h!=null&&(g===4?h.reject(f):h.resolve(f)),a.delete(x)}}),new Proxy({},{get(l,c){let g=r((...x)=>{n(s([2,x,null,c]))},"sendEvent");if(t.onlyEvents||i.includes(c))return g.asEvent=g,g;let f=r((...x)=>new Promise((p,h)=>{let m=zn++;a.set(m,{resolve:p,reject:h}),n(s([1,x,m,c]))}),"sendCall");return f.asEvent=g,f}})}r(ju,"useRPC");var K=A("zeed:network"),Be={cache:"no-cache",redirect:"follow",headers:{}};function Gn(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(Gn,"parseBasicAuth");async function Rt(e,t={},n=fetch){try{C(t)&&(t=re({},...V(t)));let o=Gn(String(e));o&&(e=o.url,t=re({},t,Vn(o.username,o.password))),t.headers!=null&&!(t.headers instanceof Headers)&&(t.headers=new Headers(t.headers));let i=await n(String(e),t);if(i.status<400)return i;try{K.warn(`Fetch of ${e} with ${t} returned status=${i.status}`),K.warn(`Response: ${await i.text()}`)}catch(s){K.error("Exception:",s)}}catch(o){K.error("fetchBasic",o)}}r(Rt,"fetchBasic");async function Vu(e,t={},n=fetch){try{let o=await Rt(e,[{method:"GET",headers:{Accept:"application/json"}},t],n);if(o)return await o.json()}catch(o){K.error("fetchJSON error:",o)}}r(Vu,"fetchJson");async function Ju(e,t={},n=fetch){try{let o=await Rt(e,[Be,{method:"GET"},t],n);if(o)return await o.text()}catch(o){K.error("fetchHTML error:",o)}}r(Ju,"fetchText");function Zu(e,t="POST"){return{method:t,...Be,headers:{"Content-Type":"application/x-www-form-urlencoded; charset=utf-8"},body:xt(e)}}r(Zu,"fetchOptionsFormURLEncoded");function Wu(e,t="POST"){return{method:t,...Be,headers:{"Content-Type":"application/json; charset=utf-8"},body:U(e)}}r(Wu,"fetchOptionsJson");function Vn(e,t){return{headers:{Authorization:`Basic ${Ze(`${e}:${t}`)}`}}}r(Vn,"fetchOptionsBasicAuth");function St(){if(typeof window<"u")return window}r(St,"getWindow");function Jn(){if(typeof navigator<"u")return navigator}r(Jn,"getNavigator");function Qu(){return St()??typeof WorkerGlobalScope<"u"?self:typeof global<"u"?global:Function("return this;")()}r(Qu,"getGlobal");var F=Jn(),N=St();function Zn(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=F?.platform?.match(/(iPhone|iPod|iPad)/i)!=null,e.macos=!!F?.platform?.startsWith("Mac"),e.windows=!!F?.platform?.startsWith("Win"),e.beaker=N?.beaker!=null,e.electron=(F?.userAgent?.toLowerCase()?.indexOf(" electron/")||-1)>-1&&!e.beaker,e.wkwebview=N?.webkit?.messageHandlers!=null,e.pwa=F?.serviceWorker!=null,e.pwaInstalled=F?.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||(F?.maxTouchPoints||0)>1||F?.msPointerEnabled&&N?.MSGesture||N?.DocumentTouch&&document instanceof DocumentTouch,e}r(Zn,"detect");var Wn=r(()=>typeof window<"u"&&globalThis===window,"isBrowser"),Xu=Zn();function ec(e){Wn()?window.addEventListener("beforeunload",e):typeof process<"u"&&process.on("exit",()=>e)}r(ec,"useExitHandler");var He=class{constructor(t={}){this.store={}}setItem(t,n){this.store[t]=Re(n)}getItem(t){return Re(this.store[t])}removeItem(t){delete this.store[t]}clear(){this.store={}}allKeys(){return Object.keys(this.store)}};r(He,"MemStorage");export{r as a,Y as b,S as c,ge as d,C as e,je as f,Xn as g,er as h,tr as i,nr as j,rr as k,or as l,ir as m,ne as n,kt as o,re as p,It as q,q as r,me as s,oe as t,ie as u,Q as v,_e as w,Ne as x,$t as y,A as z,Mr as A,U as B,Rr as C,Ht as D,jt as E,Ge as F,_t as G,E as H,Ir as I,Ve as J,Je as K,Ze as L,Cr as M,Or as N,We as O,he as P,xe as Q,Ke as R,G as S,Qe as T,be as U,Ye as V,Nt as W,jr as X,_r as Y,Xe as Z,et as _,qr as $,Gt as aa,D as ba,Jr as ca,Zr as da,Wr as ea,Kr as fa,Vt as ga,Yr as ha,Qr as ia,Xr as ja,eo as ka,Jt as la,ro as ma,we as na,oo as oa,Le as pa,Zt as qa,Wt as ra,V as sa,Kt as ta,co as ua,lo as va,fo as wa,Ae as xa,po as ya,go as za,Yt as Aa,mo as Ba,Qt as Ca,nt as Da,yo as Ea,ho as Fa,xo as Ga,bo as Ha,To as Ia,wo as Ja,Lo as Ka,Ao as La,vo as Ma,$ as Na,Ro as Oa,So as Pa,Uo as Qa,Fo as Ra,ko as Sa,Io as Ta,Co as Ua,Oo as Va,$o as Wa,jo as Xa,nn as Ya,_o as Za,No as _a,Vo as $a,Jo as ab,Zo as bb,rn as cb,on as db,sn as eb,ve as fb,Wo as gb,Ko as hb,Yo as ib,Qo as jb,an as kb,Xo as lb,ei as mb,Ee as nb,Pe as ob,ot as pb,un as qb,ri as rb,it as sb,oi as tb,ii as ub,si as vb,ce as wb,ai as xb,De as yb,cn as zb,ln as Ab,Me as Bb,st as Cb,ui as Db,ci as Eb,li as Fb,fi as Gb,ut as Hb,mi as Ib,yi as Jb,ct as Kb,hi as Lb,lt as Mb,xi as Nb,ft as Ob,bi as Pb,P as Qb,B as Rb,L as Sb,vi as Tb,Di as Ub,Ei as Vb,Pi as Wb,fn as Xb,Si as Yb,Ui as Zb,Fi as _b,dt as $b,Ci as ac,Hi as bc,ji as cc,_i as dc,qi as ec,Ji as fc,X as gc,mt as hc,Ki as ic,Yi as jc,Qi as kc,Xi as lc,es as mc,ts as nc,ns as oc,rs as pc,yt as qc,ht as rc,as as sc,yn as tc,fs as uc,ms as vc,xn as wc,xt as xc,ys as yc,Ts as zc,ws as Ac,Ls as Bc,As as Cc,vs as Dc,Re as Ec,Ds as Fc,Es as Gc,Ps as Hc,Ms as Ic,Ln as Jc,Fs as Kc,Se as Lc,Ue as Mc,Bs as Nc,Hs as Oc,js as Pc,_s as Qc,Ns as Rc,Vs as Sc,Js as Tc,M as Uc,ta as Vc,na as Wc,ra as Xc,Tt as Yc,sa as Zc,aa as _c,ke as $c,Pn as ad,Mn as bd,Rn as cd,Sn as dd,Un as ed,Fn as fd,In as gd,Cn as hd,On as id,vt as jd,Ba as kd,Ha as ld,Bn as md,ja as nd,_a as od,H as pd,Et as qd,Hn as rd,Na as sd,j as td,za as ud,_n as vd,Nn as wd,Wa as xd,Ce as yd,iu as zd,su as Ad,cu as Bd,pu as Cd,de as Dd,ee as Ed,xu as Fd,Oe as Gd,_ as Hd,$e as Id,Pt as Jd,Su as Kd,pe as Ld,$u as Md,ju as Nd,Gn as Od,Rt as Pd,Vu as Qd,Ju as Rd,Zu as Sd,Wu as Td,Vn as Ud,St as Vd,Jn as Wd,Qu as Xd,Zn as Yd,Wn as Zd,Xu as _d,ec as $d,He as ae};
|
|
8
|
-
//# sourceMappingURL=chunk-
|
|
8
|
+
//# sourceMappingURL=chunk-SUZNEX7U.js.map
|