@flemist/simple-utils 2.1.5 → 2.1.6

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.
Files changed (46) hide show
  1. package/build/browser/index.cjs +1 -1
  2. package/build/browser/index.mjs +175 -146
  3. package/build/common/async/Locker.d.ts +28 -0
  4. package/build/common/async/index.d.ts +2 -0
  5. package/build/common/async/promise.d.ts +7 -0
  6. package/build/common/cache/Cache.d.ts +46 -0
  7. package/build/common/cache/CacheStats.d.ts +20 -0
  8. package/build/common/cache/MemoryStorage.d.ts +11 -0
  9. package/build/common/cache/getHashKey.d.ts +1 -0
  10. package/build/common/cache/getJsonKey.d.ts +1 -0
  11. package/build/common/cache/index.d.ts +6 -0
  12. package/build/common/cache/types.d.ts +28 -0
  13. package/build/common/converter/converterErrorToBuffer.d.ts +2 -0
  14. package/build/common/converter/converterJson.d.ts +2 -0
  15. package/build/common/converter/converterJsonBuffer.d.ts +2 -0
  16. package/build/common/converter/converterStringToBuffer.d.ts +2 -0
  17. package/build/common/converter/helpers.d.ts +13 -0
  18. package/build/common/converter/index.d.ts +8 -0
  19. package/build/common/converter/mapObjectConverter.d.ts +2 -0
  20. package/build/common/converter/setArrayConverter.d.ts +2 -0
  21. package/build/common/converter/types.d.ts +41 -0
  22. package/build/common/gzip/compressGzip.d.ts +35 -0
  23. package/build/common/gzip/decompressGzip.d.ts +2 -0
  24. package/build/common/gzip/index.d.ts +2 -0
  25. package/build/common/index.cjs +1 -1
  26. package/build/common/index.d.ts +3 -0
  27. package/build/common/index.mjs +175 -146
  28. package/build/common/string/index.d.ts +1 -1
  29. package/build/node/cache/FileStatStorage.d.ts +23 -0
  30. package/build/node/cache/FileStorage.d.ts +29 -0
  31. package/build/node/cache/createConverterSubPath.d.ts +12 -0
  32. package/build/node/cache/createFileCacheOptions.d.ts +15 -0
  33. package/build/node/cache/generateTempFileName.d.ts +1 -0
  34. package/build/node/cache/index.d.ts +6 -0
  35. package/build/node/cache/writeFileThroughTmp.d.ts +2 -0
  36. package/build/node/fs/index.d.ts +1 -0
  37. package/build/node/fs/readDirRecursive.d.ts +6 -0
  38. package/build/node/index.cjs +8 -8
  39. package/build/node/index.d.ts +1 -0
  40. package/build/node/index.mjs +897 -601
  41. package/build/urlGet-BoqnOos7.js +17 -0
  42. package/build/urlGet-OHY_Qdk-.mjs +2416 -0
  43. package/package.json +37 -38
  44. package/build/common/time/dateToString.d.ts +0 -2
  45. package/build/urlGet-CerQ1cKh.js +0 -17
  46. package/build/urlGet-DZEwtNXt.mjs +0 -2000
@@ -0,0 +1,17 @@
1
+ "use strict";const ft=require("@flemist/abort-controller-fast"),Ct=require("@flemist/time-controller"),b=require("@flemist/async-utils"),Jt=require("fflate");function Ht(t){if(!t||t.timeout==null)return null;const e=new ft.AbortControllerFast,r=t.timeController??Ct.timeControllerDefault;if(t.timeout){const n=r.setTimeout(()=>{e.abort(new ft.AbortError(`[timeoutAbortController] Timeout error: ${t.timeout}ms`))},t.timeout);e.signal.subscribe(()=>{clearTimeout(n)})}return t.abortSignal?.subscribe(n=>{e.abort(n)}),e}async function Ye(t,e){const r=Ht(e);try{return await t(r?.signal??e?.abortSignal??null)}finally{r?.abort()}}class Ze{_options;_hasValue=!1;_promiseOrValue=null;constructor(e){this._options=e}run(){if(!this._hasValue){let e=this._options.func();const r=s=>(this._options.persist?this._promiseOrValue=s:(this._promiseOrValue=null,this._hasValue=!1),s),n=s=>{throw this._options.persist||(this._promiseOrValue=null,this._hasValue=!1),s};if(b.isPromiseLike(e))e=e.then(r,n);else if(!this._options.persist)return e;this._promiseOrValue=e,this._hasValue=!0}return this._promiseOrValue}set(e){if(!this._options.persist)throw new Error("[Lazy][set] Cannot set value when persist is false");this._hasValue=!0,this._promiseOrValue=e}}class tr{_options;_promiseOrValues=new Map;constructor(e){this._options=e}run(e){if(this._promiseOrValues.has(e))return this._promiseOrValues.get(e);let r=this._options.func(e);const n=o=>(this._options.persist?this._promiseOrValues.set(e,o):this._promiseOrValues.delete(e),o),s=o=>{throw this._options.persist||this._promiseOrValues.delete(e),o};if(b.isPromiseLike(r))r=r.then(n,s);else if(!this._options.persist)return r;return this._promiseOrValues.set(e,r),r}set(e,r){if(!this._options.persist)throw new Error("[LazyWithId][set] Cannot set value when persist is false");this._promiseOrValues.set(e,r)}}class Qt{_lockPromise=null;get hasQueued(){return this._lockPromise!=null}lock(e){if(this._lockPromise)return b.promiseLikeToPromise(this._lockPromise.then(()=>this.lock(e)));const r=e();if(b.isPromiseLike(r)){const n=r.then(()=>{this._lockPromise===n&&(this._lockPromise=null)},()=>{this._lockPromise===n&&(this._lockPromise=null)});this._lockPromise=n}return b.promiseLikeToPromise(r)}}class Xt{_lockers=new Map;lock(e,r){let n=this._lockers.get(e);n==null&&(n=new Qt,this._lockers.set(e,n));const s=()=>{n.hasQueued||this._lockers.delete(e)};let o;try{o=n.lock(r)}catch(i){throw s(),i}return b.isPromiseLike(o)?o.then(i=>(s(),i),i=>{throw s(),i}):(s(),o)}hasQueued(e){const r=this._lockers.get(e);return r!=null&&r.hasQueued}}var $t=(t=>(t[t.none=0]="none",t[t.error=1]="error",t[t.warn=2]="warn",t[t.debug=3]="debug",t))($t||{});async function er(t){const e=t.abortSignal??null,r=t.timeController??Ct.timeControllerDefault;let n=0;for(;;)try{return await t.func({abortSignal:e})}catch(s){if((t.logLevel==null||t.logLevel>=$t.error)&&console.error("[withRetry] error",s),e?.aborted)throw s;const o=t.delay({error:s,retryCount:n++,abortSignal:e});if(o==null||(typeof o=="number"?await b.delay(o,e??void 0,r):await o(),e?.aborted))throw s}}function rr({maxRetries:t,delays:e,isRetriableError:r}){return function({retryCount:s,error:o}){if(s==null||t!=null&&s>=t)return null;if(r==null||r(o)){if(Array.isArray(e))return e[Math.min(s,e.length-1)];{const i=e.mult??2;return Math.min(e.min*i**s,e.max)}}return null}}async function k(t){const e=await Promise.allSettled(t),r=[];return e.forEach(n=>{if(n.status==="fulfilled")r.push(n.value);else throw n.reason}),r}class Yt{_options;_statsMap=null;_totalSize=null;_initPromise=null;constructor(e){this._options=e}async loadStatsMap(e){const r=await this._options.storage.getEntries(),n=[];r.forEach((s,o)=>{const i=this._options.converter?this._options.converter.from(s):s;b.isPromiseLike(i)?n.push(i.then(u=>{e(o,u)})):e(o,i)}),await Promise.all(n)}init(){return this._initPromise==null&&(this._initPromise=this._init()),this._initPromise}async _init(){const e=new Map;let r=0;await this.loadStatsMap((n,s)=>{e.set(n,s),r+=s.size}),this._statsMap=e,this._totalSize=r}async getTotalSize(){return await this.init(),this._totalSize}async get(e){return await this.init(),this._statsMap.get(e)??null}async set(e,r){if(await this.init(),r!=null){const n=this._options.converter?await this._options.converter.to(r):r;await this._options.storage.set(e,n);const s=this._statsMap.get(e);this._statsMap.set(e,r),this._totalSize+=r.size-(s?.size??0)}else{await this._options.storage.delete(e);const n=this._statsMap.get(e);n!=null&&(this._statsMap.delete(e),this._totalSize-=n.size)}}async getEntries(){return await this.init(),this._statsMap}}function nr(t,e){return t[1].dateUsed!==e[1].dateUsed?t[1].dateUsed<e[1].dateUsed?-1:1:t[1].size!==e[1].size?t[1].size<e[1].size?-1:1:t[1].dateModified!==e[1].dateModified?t[1].dateModified<e[1].dateModified?-1:1:t[0]!==e[0]?t[0]<e[0]?-1:1:0}class sr{_options;_timeController;_locker;_stats;constructor(e){this._options=e,this._timeController=e.timeController??Ct.timeControllerDefault,this._locker=new Xt,this._stats=new Yt({storage:e.storages.stat,converter:e.converterStat})}async freeUpSpace(e,r,n){if(this._options.totalSize==null)return;const s=this._options.totalSize[0],o=this._options.totalSize[1];if(n>o)throw new Error(`[Cache][freeUpSpace] value size (${n}) exceeds maximum total size (${o})`);let i=await this._stats.getTotalSize();if(i+=n-(r??0),i<=o)return;const u=[],a=await this._stats.getEntries(),c=Array.from(a.entries());c.sort(nr),c.forEach(([l,d])=>{if(l===e||this._locker.hasQueued(l))return;const f=-d.size;(i>o||i+f>s)&&(u.push(this._locker.lock(l,async()=>(await k([this._options.storages.value.delete(l),this._options.storages.error.delete(l)]),this._stats.set(l,null)))),i+=f)}),await k(u)}async getOrCreate(e,r){const n=this._options.converterInput?await this._options.converterInput(e):e;return this._locker.lock(n,async()=>{let s=await this._stats.get(n);if(s==null||this._options.isExpired!=null&&this._options.isExpired(s))await k([this._options.storages.value.delete(n),this._options.storages.error.delete(n),this._stats.set(n,null)]),s=null;else{const[p,f]=await Promise.all([this._options.storages.value.get(n),this._options.storages.error.get(n)]),h=this._timeController.now();if(!s.hasError&&p!=null){const m={...s,dateUsed:h},_=this._options.converterValue?await this._options.converterValue.from(p):p;return await this._stats.set(n,m),_}if(s.hasError&&f!=null){const m={...s,dateUsed:h},_=this._options.converterError?await this._options.converterError.from(f):f;throw await this._stats.set(n,m),_}}let o=null,i=null,u=!1;try{o=await r(e)}catch(p){i=p,u=!0}if(u){const p=this._options.converterError?await this._options.converterError.to(i):i,f=this._options.getSize.error(p)+this._options.getSize.stat();await this.freeUpSpace(n,s?.size,f),await k([this._options.storages.error.set(n,p),this._options.storages.value.delete(n)]);const h=this._timeController.now(),m={dateModified:h,dateUsed:h,size:f,hasError:!0};throw await this._stats.set(n,m),i}const a=this._options.converterValue?await this._options.converterValue.to(o):o,c=this._options.getSize.value(a)+this._options.getSize.stat();await this.freeUpSpace(n,s?.size,c),await k([this._options.storages.value.set(n,a),this._options.storages.error.delete(n)]);const l=this._timeController.now(),d={dateModified:l,dateUsed:l,size:c};return await this._stats.set(n,d),o})}async delete(e){const r=this._options.converterInput?await this._options.converterInput(e):e;return this._locker.lock(r,async()=>{await k([this._options.storages.value.delete(r),this._options.storages.error.delete(r),this._stats.set(r,null)])})}async clear(){const[e,r,n]=await Promise.all([this._options.storages.value.getKeys(),this._options.storages.error.getKeys(),this._options.storages.stat.getKeys()]),s=new Set([...e,...r,...n]),o=[];s.forEach(i=>{const u=this._locker.lock(i,async()=>{const a=[],c=this._options.storages.value.delete(i);b.isPromiseLike(c)&&a.push(c);const l=this._options.storages.error.delete(i);b.isPromiseLike(l)&&a.push(l);const d=this._stats.set(i,null);b.isPromiseLike(d)&&a.push(d),await k(a)});b.isPromiseLike(u)&&o.push(u)}),await k(o)}}class or{_cache=new Map;set(e,r){this._cache.set(e,r)}get(e){return this._cache.get(e)}delete(e){this._cache.delete(e)}clear(){this._cache.clear()}getKeys(){return Array.from(this._cache.keys())}getEntries(){return new Map(this._cache)}}function xt(t){if(t==null)return null;if(Array.isArray(t)){const e=t.length,r=[];for(let n=0;n<e;n++)r.push(xt(t[n]));return r}if(typeof t=="object"){if(t.constructor&&t.constructor!==Object)return t;const e={};for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=xt(t[r]));return e}return t}function H(t,e){if(t===e)return!0;if(t==null)return e==null;if(e==null)return!1;if(Array.isArray(t)){if(!Array.isArray(e))return!1;const r=t.length;if(r!==e.length)return!1;for(let n=0;n<r;n++)if(!H(t[n],e[n]))return!1;return!0}if(typeof t=="object"){if(typeof e!="object"||t.constructor&&t.constructor!==Object||e.constructor&&e.constructor!==Object)return!1;for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&!H(t[r],Object.prototype.hasOwnProperty.call(e,r)?e[r]:null))return!1;for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&!Object.prototype.hasOwnProperty.call(t,r)&&!H(e[r],null))return!1;return!0}return!1}function ir(t,e){if(t==null||e==null)return t==null==(e==null);if(t.size!==e.size)return!1;for(const[r,n]of t)if(!H(n,e.get(r)))return!1;return!0}function ur(t,e){const r=t.length;if(r!==e.length)return!1;for(let n=0;n<r;n++)if(t[n]!==e[n])return!1;return!0}function ht(t){return!t||typeof t!="object"?t:Array.isArray(t)?t.map(ht):t&&Object.keys(t).sort().reduce((e,r)=>{const n=ht(t[r]);return n!=null&&(e[r]=n),e},{})}function ar(t,e){return Object.defineProperty(t,"name",{value:e,configurable:!0}),t}function Zt(t){return t=ht(t),JSON.stringify(t??null)}let it=null;function cr(){if(!it){it=new Array(256);for(let t=0;t<256;t++)it[t]=t.toString(16).padStart(2,"0")}return it}function te(t){const e=cr(),r=new Uint8Array(t.buffer,t.byteOffset,t.byteLength);let n="";for(let s=0,o=r.length;s<o;s++)n+=e[r[s]];return n}let Et=null,ee=null,ut=null,re=null;function lr(){Et||(Et=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),ee=new Uint32Array(64),re=new TextEncoder,ut=new Uint8Array(65536))}function ne(t){if(t==null)return null;lr();const e=Et,r=ee,n=re;let s=ut,o;if(typeof t=="string"){const w=t.length*3;s.length<w+128&&(s=ut=new Uint8Array(w+128));const y=n.encodeInto(t,s);o=s.subarray(0,y.written)}else if(t instanceof Uint8Array)o=t;else if(ArrayBuffer.isView(t))o=new Uint8Array(t.buffer,t.byteOffset,t.byteLength);else throw new Error(`[sha256Buffer] Unsupported content type: ${typeof t}`);const i=o.length,u=i+72>>>6<<6;s.length<u&&(s=ut=new Uint8Array(u)),o!==s&&s.set(o),s[i]=128;for(let w=i+1;w<u;w++)s[w]=0;const a=i*8,c=a/4294967296|0,l=a|0;s[u-8]=c>>>24,s[u-7]=c>>>16,s[u-6]=c>>>8,s[u-5]=c,s[u-4]=l>>>24,s[u-3]=l>>>16,s[u-2]=l>>>8,s[u-1]=l;let d=1779033703,p=-1150833019,f=1013904242,h=-1521486534,m=1359893119,_=-1694144372,O=528734635,E=1541459225;for(let w=0;w<u;w+=64){for(let S=0;S<16;S++){const x=w+(S<<2);r[S]=s[x]<<24|s[x+1]<<16|s[x+2]<<8|s[x+3]}for(let S=16;S<64;S++){const x=r[S-15],N=r[S-2],bt=(x>>>7|x<<25)^(x>>>18|x<<14)^x>>>3,ot=(N>>>17|N<<15)^(N>>>19|N<<13)^N>>>10;r[S]=r[S-16]+bt+r[S-7]+ot|0}let y=d,A=p,nt=f,_t=h,T=m,st=_,W=O,wt=E;for(let S=0;S<64;S+=4)for(let x=0;x<4;x++){const N=S+x,bt=(T>>>6|T<<26)^(T>>>11|T<<21)^(T>>>25|T<<7),ot=wt+bt+(W^T&(st^W))+e[N]+r[N]|0,Xe=((y>>>2|y<<30)^(y>>>13|y<<19)^(y>>>22|y<<10))+(y&A^nt&(y^A))|0;wt=W,W=st,st=T,T=_t+ot|0,_t=nt,nt=A,A=y,y=ot+Xe|0}d=d+y|0,p=p+A|0,f=f+nt|0,h=h+_t|0,m=m+T|0,_=_+st|0,O=O+W|0,E=E+wt|0}const M=new Uint8Array(32),K=[d,p,f,h,m,_,O,E];for(let w=0;w<8;w++){const y=K[w],A=w<<2;M[A]=y>>>24,M[A+1]=y>>>16&255,M[A+2]=y>>>8&255,M[A+3]=y&255}return M}function se(t){const e=ne(t);return e?te(e):null}function fr(t){const e=Zt(t);return se(e)}function hr(t,e){return t==null?e:(r,n)=>t(r,s=>e(s,n))}function mr(t,e){return t==null?e:r=>t(r,n=>e(n))}function oe(t,e){return t==null?e:(r,n)=>t(r,s=>e(s,n))}function ie(t,e){return t==null?e:(r,n)=>t(r,s=>e(s,n))}function ue(t,e){return t==null?e:{to:oe((r,n)=>t.to(r,n),(r,n)=>e.to(r,n))}}function ae(t,e){return t==null?e:{from:ie((r,n)=>t.from(r,n),(r,n)=>e.from(r,n))}}function pr(t,e){return t==null?e:{to:ue(t,e).to,from:ae(t,e).from}}function ce(t,e){return t==null?e:r=>t(r,n=>e(n))}function le(t,e){return t==null?e:r=>t(r,n=>e(n))}function fe(t,e){return t==null?e:{to:ce((r,n)=>t.to(r,n),r=>e.to(r))}}function he(t,e){return t==null?e:{from:le((r,n)=>t.from(r,n),r=>e.from(r))}}function dr(t,e){return t==null?e:{to:fe(t,e).to,from:he(t,e).from}}const Mt={to:t=>JSON.stringify(t??null,null,2),from:t=>JSON.parse(t)},Q={to:t=>new TextEncoder().encode(t),from:t=>new TextDecoder().decode(t)},gr={to:t=>{const e=Mt.to(t);return Q.to(e)},from:t=>{const e=Q.from(t);return Mt.from(e)}};function yr(t){return t==null?null:t.replace(/[&<>"']/g,e=>{switch(e){case"&":return"&amp;";case"<":return"&lt;";case">":return"&rt;";case'"':return"&quot;";default:return"&#039;"}})}function _r(t){return t==null?null:t?.replace(/[/\\^$*+?.()|[\]{}]/g,"\\$&")}function At(t,e,r){const n=e==null?t:new Date(t.toLocaleString("en-US",{timeZone:e})),s=r==null?t:new Date(t.toLocaleString("en-US",{timeZone:r}));return new Date(t.getTime()+s.getTime()-n.getTime())}function me(t,e){t=At(t,"UTC",e);const r=t.getUTCFullYear().toString().padStart(4,"0"),n=(t.getUTCMonth()+1).toString().padStart(2,"0"),s=t.getUTCDate().toString().padStart(2,"0"),o=t.getUTCHours().toString().padStart(2,"0"),i=t.getUTCMinutes().toString().padStart(2,"0"),u=t.getUTCSeconds().toString().padStart(2,"0");return`${r}-${n}-${s} ${o}:${i}:${u}`}let wr=0;const St=new WeakMap;function z(t){if(St.has(t))return St.get(t);const e=wr++;return St.set(t,e),e}function q(t,e,r){if(t==null)return null;if(e==null||t.length<=e)return t;const n=r?.appendEllipsis?"…":"",s=n.length+(r?.appendTruncatedLength?String(t.length).length+2:0),o=Math.max(0,e-s),i=r?.appendTruncatedLength?`(${t.length-o})`:"";return o<=0?i+n:r?.fromStart?i+n+t.slice(t.length-o):t.slice(0,o)+n+i}function Wt(t,e){try{return t[e]}catch(r){return"Error: "+(r instanceof Error?r.message:String(r))}}function I(t,e,r,n){const{pretty:s,filter:o,maxDepth:i,maxItems:u,maxStringLength:a,showObjectId:c,showArrayIndex:l,customToString:d}=e??{};if(r==null&&(r=[]),n==null&&(n=new Set),d){const f=d(t,r,h=>I(h,e,r,n));if(f!=null)return q(f,a,e?.truncateOptions)}const p=r.length;if(typeof t=="string")return t=q(t,a,e?.truncateOptions),n.size>0&&(t=JSON.stringify(t)),t;if(t==null||typeof t!="object")return String(t);if(t instanceof ArrayBuffer||ArrayBuffer.isView(t))return`${t.constructor?.name??""}#${z(t)}[${t.byteLength}]`;if(t instanceof RegExp)return q(String(t),a,e?.truncateOptions);if(t instanceof Date)return me(t);if(t instanceof Object){if(n.has(t)||i!=null&&p>=i)return`${t.constructor===Object?"":t.constructor?.name??""}#${z(t)}`;n.add(t)}if(t instanceof Error)return q(t.stack||t.message||String(t),a,e?.truncateOptions);if(Array.isArray(t)){const f=s?" ".repeat(p):"";let h="";c&&(h+=`#${z(t)} `),h+="[";let m=0,_=!1;for(let O=0;O<t.length;O++){if(u!=null&&m>=u){_=!0;break}const E=[...r,String(O)],M=Wt(t,O);if(o!=null&&!o(E,M))continue;const K=I(M,e,E,n);m>0&&(h+=","),s&&(h+=`
2
+ `),s&&(h+=`${f} `),l&&(h+=`${O}: `),h+=`${K}`,m++}return _?(m>0&&(h+=","),s?(h+=`
3
+ `,h+=`${f} ...
4
+ `):h+="...",h+=f,h+="]"):(m>0&&s&&(h+=`
5
+ ${f}`),h+="]"),h}if(t instanceof Map){let f="";return c&&(f+=`#${z(t)} `),f+="Map",f+=I(Array.from(t.entries()),e,r,n),f}if(t instanceof Set){let f="";return c&&(f+=`#${z(t)} `),f+="Set",f+=I(Array.from(t.values()),e,r,n),f}{const f=t.constructor===Object?"":t.constructor?.name??"",h=s?" ".repeat(p):"";let m=f?`${f} `:"";c&&(m+=`#${z(t)} `),m+="{";let _=0,O=!1;for(const E in t){if(u!=null&&_>=u){O=!0;break}const M=[...r,E],K=Wt(t,E);if(o!=null&&!o(M,K))continue;const w=I(K,e,M,n);_>0&&(m+=","),s&&(m+=`
6
+ `),s&&(m+=`${h} `),m+=`${E}: ${w}`,_++}return O&&(_>0&&(m+=","),s?(m+=`
7
+ `,m+=`${h} ...
8
+ `):m+="...",m+=h),_>0&&s&&!O&&(m+=`
9
+ ${h}`),m+="}",m}}function pe(t,e){t=At(t,"UTC",e);const r=t.getUTCFullYear().toString().padStart(4,"0"),n=(t.getUTCMonth()+1).toString().padStart(2,"0"),s=t.getUTCDate().toString().padStart(2,"0"),o=t.getUTCHours().toString().padStart(2,"0"),i=t.getUTCMinutes().toString().padStart(2,"0"),u=t.getUTCSeconds().toString().padStart(2,"0");return`${r}-${n}-${s}_${o}-${i}-${u}`}const br={to:t=>{const e=I(t,{pretty:!0,maxDepth:10,maxItems:50,maxStringLength:1e3});return Q.to(e)},from:t=>Q.from(t)},Sr={to:t=>Array.from(t.entries()).reduce((e,[r,n])=>(e[r]=n,e),{}),from:t=>new Map(Object.entries(t))},Or={to:t=>Array.from(t),from:t=>new Set(t)};async function xr(t,e){return new Promise((r,n)=>{Jt.gzip(t,{level:e.level},(s,o)=>{s?n(s):r(o)})})}function Er(t){return t[0]===31&&t[1]===139}async function Mr(t){return new Promise((e,r)=>{Jt.gunzip(t,(n,s)=>{n?r(n):e(s)})})}function de(t,e){return t==null?e:e==null?t:Math.min(t,e)}function ge(t,e){return t==null?e:e==null?t:Math.max(t,e)}function Cr(t,e,r){return ge(de(t,e),r)}function $r(t,e){return(t%e+e)%e}function Ar(t){return function(){let r=t+=1831565813;return r=Math.imul(r^r>>>15,r|1),r^=r+Math.imul(r^r>>>7,r|61),(r^r>>>14)/4294967296+.5}}function Tr(){return Math.random()}function kr(){return Math.random()*2**32>>>0}function ye(t){return t!=null?Ar(t):Tr}class mt{_seed;_rnd;constructor(e){this._seed=e,this._rnd=ye(e)}get seed(){return this._seed}nextSeed(){return this.next()*2**32>>>0}nextRandom(){return new mt(this.nextSeed())}next(){return this._rnd()}clone(){return new mt(this._seed)}}function Tt(t,e,r){if(r==null&&(r=e,e=0),r<=e)throw new Error(`[random][randomFloat] toExclusive (${r}) must be greater than from (${e})`);return t.next()*(r-e)+e}function _e(t,e,r){return Math.floor(Tt(t,e,r))}function Ir(t,e){return t.next()<(e??.5)}function vr(t,e,r){if(Array.isArray(e)){const o=e;e=o.length,r=i=>o[i]}if(!r)throw new Error("[random][randomIndexWeighted] getWeight is required");let n=0;for(let o=0;o<e;o++)n+=r(o);if(n===0)return-1;let s=Tt(t,n);for(let o=0;o<e;o++)if(s-=r(o),s<0)return o;return e-1}function kt(t,e){if(e.length===0)throw new Error("[random][randomItem] items is empty");const r=_e(t,e.length);return e[r]}function Pr(t,e,r){if(e.length===0)throw new Error("[random][randomItems] items is empty");const n=[];for(let s=0;s<r;s++)n.push(kt(t,e));return n}function Nr(t,e,r){let n=Object.values(e);return r&&(n=n.filter(r)),kt(t,n)}const we=1073741789,at=(we>>2)-1;function Rr(t=at,e){if(t<=0)throw new Error(`[random][PseudoRandom] count(${t}) must be > 0`);if(t>at)throw new Error(`[random][PseudoRandom] count(${t}) must be <= ${at}`);if(e==null&&(e=Math.floor(Math.random()*t)),e>=t)throw new Error(`[random][PseudoRandom] startFrom(${e}) must be < count(${t})`);let r=e;return function(){return r=(r+we)%t,r}}let B=null;function Dr(){const t=Date.now();return B==null||t>B?(B=t,t):(B++,B)}async function Ur({url:t,timeout:e}={}){t||(t=typeof window<"u"?"/":"https://google.com");let r;try{const n=new ft.AbortControllerFast;r=e?setTimeout(()=>{n.abort()},e):null;const s=await fetch(t,{method:"HEAD",signal:ft.toAbortSignal(n.signal)}),o=s.headers.get("date");if(!o)throw new Error(`[Now][getDateInet] No date header in response: ${s.status} ${t}`);return new Date(o).getTime()}finally{r&&clearTimeout(r)}}function Lr(t){const e=alert;return window.alert=r=>t(e,r),()=>{window.alert=e}}var F=(t=>(t.log="log",t.warn="warn",t.error="error",t.info="info",t.debug="debug",t.trace="trace",t.assert="assert",t))(F||{});const Bt=Object.values(F);function L(t){return function(){t.apply(console,arguments)}}const qt={log:L(console.log),warn:L(console.warn),error:L(console.error),info:L(console.info),debug:L(console.debug),trace:L(console.trace),assert:L(console.assert)};function It(t){return Bt.forEach(e=>{console[e]=(...r)=>{t(qt,e,r)}}),()=>{Bt.forEach(e=>{console[e]=qt[e]})}}function zr(t){return function(r){let n=null;const o=It((u,a,c)=>{try{t(u,a,c)}catch(l){throw n||(n=l),l}}),i=()=>{if(o(),n)throw n};try{const u=r();return b.isPromiseLike(u)?u.then(a=>(i(),a),a=>{throw i(),a}):(i(),u)}catch(u){throw i(),u}}}class vt{_listeners=new Map;_listenersAdd=new Map;_startStopNotifier;_emit;_update;_unsubscribeNotifier=null;_emitLast;_hasLast;_last=void 0;_emitting=!1;_subscribing=!1;_actionOnCycle;constructor({emitLastEvent:e,startStopNotifier:r,hasLast:n,last:s,actionOnCycle:o}={}){this._startStopNotifier=r??null,this._emit=r?i=>this.emit(i):null,this._update=r?i=>this.update(i):null,this._emitLast=e??!1,this._hasLast=n??!1,this._last=s,this._actionOnCycle=o??!1}get hasLast(){return this._hasLast}get last(){return this._last}get hasListeners(){return this._listeners.size>0}subscribe(e){const r={};if(this._emitting?this._listenersAdd.set(r,e):this._listeners.set(r,e),this._subscribing&&this._actionOnCycle==="throw")throw new Error("[Rx][Subject] Circular subscription detected");if((this._hasLast||this._subscribing&&this._actionOnCycle==="emitLast")&&e(this._last),this._startStopNotifier&&this._listeners.size+this._listenersAdd.size===1)try{this._subscribing=!0,this._unsubscribeNotifier=this._startStopNotifier(this._emit,this._update)??null}finally{this._subscribing=!1}return()=>{if(this._listeners.delete(r),this._listenersAdd.delete(r),this._startStopNotifier&&this._listeners.size===0&&this._listenersAdd.size===0){const n=this._unsubscribeNotifier;this._unsubscribeNotifier=null,n?.()}}}emit(e){if(this._emitting){if(this._actionOnCycle==="throw")throw new Error("[Rx][Subject] Circular emit detected");this._actionOnCycle==="emitLast"&&(this._last=e,this._hasLast=!0);return}const r=()=>{this._listenersAdd.size>0&&(this._listenersAdd.forEach((n,s)=>{this._listeners.set(s,n)}),this._listenersAdd.clear()),this._emitting=!1};try{this._emitting=!0,this._emitLast&&(this._last=e,this._hasLast=!0);let n;if(this._listeners.forEach(s=>{const o=s(e);b.isPromiseLike(o)&&(n||(n=[]),n.push(o))}),n)return Promise.all(n).then(r,s=>{throw r(),s});r()}catch(n){throw r(),n}}update(e){if(!this._emitLast)throw new Error("[Rx][Subject] update available only for subjects with emitLastEvent");const r=e(this._last);return this.emit(r)}}function jr(t,e){return I(t,{maxDepth:5,maxItems:10,...e})}function Kr(t){return t.map(e=>e&&typeof e=="object"?jr(e):e)}function Fr(t){return`${pe(new Date)} [${t.level.toUpperCase()}] ${Kr(t.args).join(" ")}`}let pt=null,Ot=null;function be(){return Ot||(Ot=new vt({startStopNotifier:t=>(pt=t,()=>{pt=null})})),Ot}function Vr(){return It((t,e,r)=>{e==="assert"&&r[0]===!0||(e===F.error||e===F.warn||e===F.assert)&&(pt&&pt({date:Date.now(),level:e,args:r}),t[e](...r))})}function Wr(t){if(typeof window>"u")return b.EMPTY_FUNC;const{levels:e,predicate:r}=t;return be().subscribe(n=>{if(e&&!e.includes(n.level))return;const s=n.args.join(`
10
+ `);r&&!r({text:s,message:n})||alert(s)})}function Se(){let t=new Error().stack;if(t!=null){const e=t.indexOf(`
11
+ `);e!=null&&e>=0&&(t=t.substring(e+1))}return t??""}function Br(t){return function(...e){const r=Se();try{return t.apply(this,e)}catch(n){throw n instanceof Error||(n=new Error(String(n))),n.stack=n.stack?n.stack+`
12
+ `+r:r,n}}}function qr(t){return t!=null&&typeof t=="object"&&typeof t.subscribe=="function"}class Gr{_subjects=new Map;_getLastEvent;constructor({getLastEvent:e}={}){this._getLastEvent=e}subscribe(e,r){let n=this._subjects.get(e);n||(n=new vt,this._subjects.set(e,n));const s=n.subscribe(r);if(this._getLastEvent){const o=this._getLastEvent(e);r(o)}return()=>{s(),n?.hasListeners||this._subjects.delete(e)}}emit(e,r){const n=this._subjects.get(e);if(n)return n.emit(r)}forEach(e){this._subjects.forEach(e)}observable(e){return{subscribe:r=>this.subscribe(e,r)}}emitter(e){return{emit:r=>this.emit(e,r)}}subject(e){return{subscribe:r=>this.subscribe(e,r),emit:r=>this.emit(e,r)}}}function Jr(t,e,r){return new Promise(n=>{let s=!1,o;function i(l){a?.(),o?.(),s=!0,n(l)}function u(l){a?.(),o?.(),s=!0,n(Promise.reject(l))}const a=r?.subscribe(u);let c=!0;o=t.subscribe(l=>{(!e||e(l,c))&&i(l),c=!1}),s&&o?.()})}class R extends Error{constructor(e){super(e)}}class g{_args;constructor(e){this._args=e&&{...e}}set(e){return this._args={...this._args??{},...e},this}name(e){return this.set({name:e})}toString(e){const r=this._args?.name;return r?typeof r=="string"?r:r(e):this.nameDefault(e)}}function Oe(t,e){return I(t,{maxDepth:1,maxItems:5,...e})}function D(t){return t instanceof g}function Z(t){return Oe(t)}function dt(t,...e){if(t==null)return"";const r=Oe(t,{filter:(n,s)=>{if(n.length===0)return!0;if(n.length!==1)return!1;const o=n[0];return!(o==="name"||o==="expected"||s==null||s===!1||e.includes(o))}});return/^(#\d+\s*)\{}$/.test(r)?"":`(${r})`}function X(t){const{result:e,cause:r,nested:n,error:s}=t;if(s){if(!(s instanceof Error))throw new R(`[test][validateMatchResult] error must be an instance of Error, but it is: ${s}`);if(e!=null)throw new R(`[test][validateMatchResult] result must be null if error is set, but it is: ${e}`);if(r!=null)throw new R(`[test][validateMatchResult] cause must be null if error is set, but it is: ${r}`);if(n!=null)throw new R(`[test][validateMatchResult] nested must be null if error is set, but it is: ${n}`);return t}if(typeof e!="boolean")throw new R(`[test][validateMatchResult] result must be a boolean, but it is: ${e}`);if(typeof r!="string"&&r!=null)throw new R(`[test][validateMatchResult] cause must be a string or null, but it is: ${r}`);if(n!=null&&!(n instanceof Array))throw new R(`[test][validateMatchResult] nested must be an array or null, but it is: ${n}`);return t}function xe(t,e,r){return X({actual:t,expected:e,result:null,cause:null,nested:null,error:r})}function Pt(t,e,r){return X({actual:t,expected:e,result:r,cause:null,nested:null,error:null})}function Nt(t,e,r){return typeof r=="boolean"?Pt(t,e,r):X(typeof r=="string"?{actual:t,expected:e,result:!1,cause:r,nested:null,error:null}:{actual:t,expected:e,result:r.result,cause:r.cause??null,nested:r.nested??null,error:null})}function C(t,e){try{if(D(e)){const r=e.match(t);return Nt(t,e,r)}return Pt(t,e,t===e)}catch(r){return xe(t,e,r)}}class Rt extends g{match(e){const r=this._args.expected,n=C(e,r);return{result:!n.result,nested:[{actualKey:null,result:n}]}}nameDefault(){return"not"}}function Ee(t,e){const r=Dt(t.result,e);return r?{actualKey:t.actualKey,expectedKey:t.expectedKey,result:r}:null}function Dt(t,e){if(e?!t.result:t.result)return null;t.expected instanceof Rt&&(e=!e);let r=null;return t.nested&&t.nested.forEach(n=>{const s=Ee(n,e);s&&(r||(r=[]),r.push(s))}),{actual:t.actual,expected:t.expected,result:t.result,cause:t.cause,nested:r,error:t.error}}function Me(t,e){const r=Ut(t.result,e+" ");return`${e}${t.actualKey==null?"| ":t.actualKey+": "}${r}`}function Ut(t,e){if(t.result)return t.expected.toString();let r="";t.nested&&(r=t.nested.map(s=>Me(s,e)).join(`
13
+ `));let n=t.cause||"";return r?(n||(n=D(t.expected)?t.expected.toString(t.actual):""),`${n}
14
+ ${r}`):`${n}
15
+ ${e}expected: ${D(t.expected)?t.expected.toString(t.actual):t.expected}
16
+ ${e}actual: ${Z(t.actual)}`}class Lt extends Error{constructor(e){super(e)}}function G(t){return function(r,n){const s=C(t,r);if(s.error)throw s.error;const o=Dt(s,!1);if(!o)return;const i=Ut(o,"");console.log(`[test][check] CheckError:
17
+ `+i);const u=new Lt(i);throw n?.(u),u}}function Hr(t){return function(r,n){let s;try{s=t()}catch(o){G(o)(n);return}return b.isPromiseLike(s)?s.then(o=>(G(o)(r),o)).catch(o=>{if(o instanceof Lt)throw o;try{G(o)(n)}catch(i){throw console.error("[test][check] error",i),o}}):(G(s)(r),s)}}const tt=10;class zt extends g{match(e){if(e==null)return`Expected array, got "${e}"`;if(typeof e!="object")return`Expected array, got "${typeof e}"`;if(!(e instanceof Array))return"Expected array";const r=this._args?.expected;if(r==null)return!0;const n=this._args?.maxReportItems??tt,s=this._args?.matchType||"equals";if(s==="equals"){if(e.length!==r.length)return`Expected array length to be ${r.length}, got ${e.length}`;let o=!0,i=0,u=0;const a=[];for(let c=0;c<r.length;c++){const l=e[c],d=r[c],p=C(l,d);if(p.result?(i<n&&a.push({actualKey:c,expectedKey:c,result:p}),i++):(u<n&&a.push({actualKey:c,expectedKey:c,result:p}),u++,o=!1),!o&&i>=n&&u>=n)break}return{result:o,nested:a}}if(s==="includes"){let o=!0;const i=[];let u=0,a=0;for(let c=0;c<r.length;c++){const l=r[c];let d=!1;for(let p=0;p<e.length;p++){const f=e[p],h=C(f,l);if(h.result){d=!0,u<n&&i.push({actualKey:p,expectedKey:c,result:h}),u++;break}}if(d||(o=!1,a<n&&i.push({expectedKey:c,result:{result:!1,actual:void 0,expected:l}}),a++),!o&&u>=n&&a>=n)break}return{result:o,nested:i}}return`Unknown matchType "${s}"`}nameDefault(){return`array ${this._args?.matchType||"equals"} ${Z(this._args?.expected)}`}}class Ce extends g{match(){return!0}nameDefault(){return"any"}}class $e extends g{match(e){if(typeof e!="object")return`Expected array, got "${typeof e}"`;if(!(e instanceof Array))return"Expected array";const r=this._args.expected;let n=!0;const s=[],o=this._args?.maxReportItems??tt;let i=0,u=0;for(let a=0;a<e.length;a++){const c=e[a],l=C(c,r);if(l.result?(i<o&&s.push({actualKey:a,expectedKey:a,result:l}),i++):(u<o&&s.push({actualKey:a,expectedKey:a,result:l}),u++,n=!1),!n&&i>=o&&u>=o)break}return{result:n,nested:s}}nameDefault(){return"array item"}}class Ae extends g{match(e){const{expected:r,convert:n}=this._args,s=C(n(e),r),o=[{result:s}];return{result:s.result,nested:o}}nameDefault(){return"convert"}}class jt extends g{match(e){const{expected:r,nonStrict:n}=this._args;return n?e==r:e===r}nameDefault(){return`is(${Z(this._args.expected)})`}}class Te extends g{match(e){if(e==null)return`Expected number, got "${e}"`;if(typeof e!="number")return`Expected number, got "${typeof e}"`;if(this._args==null)return Number.isFinite(e)?!0:"Expected finite number";if(!this._args.allowNaN&&Number.isNaN(e))return"Expected not NaN";if(!this._args.allowInfinity&&!Number.isFinite(e))return"Expected not Infinity";const{min:r,max:n,float:s}=this._args;return!s&&!Number.isInteger(e)?`Expected integer, got "${e}"`:r!=null&&e<r?`Expected number to be >= ${r}, got ${e}`:n!=null&&e>n?`Expected number to be <= ${n}, got ${e}`:!0}nameDefault(){return`number(${dt(this._args)})`}}class ke extends g{match(e){if(e==null)return`Expected object, got "${e}"`;if(Array.isArray(e))return"Expected object, got array";if(typeof e!="object")return`Expected object, got "${typeof e}"`;const r=this._args?.expected;if(r==null)return!0;let n=!0;const s=[],o=this._args?.maxReportItems??tt;let i=0,u=0;for(const a in r){if(!Object.prototype.hasOwnProperty.call(r,a))continue;const c=e[a],l=r[a],d=C(c,l);if(d.result?(i<o&&s.push({actualKey:a,expectedKey:a,result:d}),i++):(u<o&&s.push({actualKey:a,expectedKey:a,result:d}),u++,n=!1),!n&&i>=o&&u>=o)break}if(!this._args?.ignoreExtraKeys)for(const a in e){if(!Object.prototype.hasOwnProperty.call(e,a)||Object.prototype.hasOwnProperty.call(r,a))continue;const c=e[a];if(u<o&&s.push({actualKey:a,expectedKey:a,result:Nt(c,void 0,"Unexpected key")}),u++,n=!1,u>=o)break}return{result:n,nested:s}}nameDefault(){return"object"+dt(this._args)}}class Ie extends g{match(e){if(e==null)return`Expected string, got ${e}`;if(typeof e!="string")return`Expected string, got "${typeof e}"`;if(this._args==null)return!0;const{pattern:r}=this._args;if(r!=null){if(typeof r=="function")return r(e);if(!r.test(e))return!1}return!0}nameDefault(){return this._args?.pattern?`string(${this._args.pattern})`:"string"}}class ve extends g{match(e){const r=this._args.expected;return e instanceof r?!0:`Expected instance of "${r}", got "${e}"`}nameDefault(){return`instanceOf(${this._args.expected.name})`}}class Pe extends g{constructor(e){super({...e,expected:e.expected instanceof Set?e.expected:new Set(e.expected)})}match(e){return!!this._args.expected.has(e)}nameDefault(){return`in(${Z(this._args.expected)})`}}class et extends g{match(e){const{type:r,expecteds:n,pipe:s}=this._args;let o=r==="and";const i=[];for(let u=0;u<n.length;u++){const a=n[u],c=C(e,a);if(i.push({actualKey:`<${r} ${u}>`,expectedKey:`<${r} ${u}>`,result:c}),r==="or"){if(c.result&&(o=!0,s))break}else if(r==="and"){if(!c.result&&(o=!1,s))break}else throw new Error(`[test][MatcherFew] Unknown type "${r}"`)}return{result:n.length===0||o,nested:i}}nameDefault(){return this._args.type}}class Ne extends g{match(e){const r=this._args.matcher;return D(r)?r.match(e):r(e)}nameDefault(e){const r=this._args.name;return typeof r=="string"?r:r?r(e):"custom"}}class Re extends g{match(){return!1}nameDefault(){return"never"}}class De extends g{match(e){if(e==null)return`Expected object, got "${e}"`;if(Array.isArray(e))return"Expected object, got array";if(typeof e!="object")return`Expected object, got "${typeof e}"`;const r=this._args?.expected;if(r==null)return!0;let n=!0;const s=[],o=this._args?.maxReportItems??tt;let i=0,u=0;for(const a in e){if(!Object.prototype.hasOwnProperty.call(e,a))continue;const c=[a,e[a]],l=C(c,r);if(l.result?(i<o&&s.push({actualKey:a,expectedKey:a,result:l}),i++):(u<o&&s.push({actualKey:a,expectedKey:a,result:l}),u++,n=!1),!n&&i>=o&&u>=o)break}return{result:n,nested:s}}nameDefault(){return"object entries"+dt(this._args)}}class Ue extends g{_hasExpected=!1;_expected=void 0;get expected(){return this._expected}set expected(e){this._expected=e,this._hasExpected=!0}match(e){const r=C(e,this._expected),n=[{result:r}];return{result:r.result,nested:n}}nameDefault(){return"ref"}}function U(t){return new zt({expected:t})}function Qr(t){return new zt({expected:t,matchType:"includes"})}function V(){return new Ce}function Xr(){return new Ue}function Yr(t){return new Re({name:t})}function Zr(t,e){const r=new $e({expected:e});return t==null?r:$(Fe(D(t)||typeof t=="number"?t:rt(t)),r).name("array item")}function v(t,e,r){return new Ae({name:t,convert:e,expected:r})}function Le(t){return new jt({expected:t,nonStrict:!0})}function ze(t){return new jt({expected:t,nonStrict:!1})}function Kt(t){return new Te(t)}function rt(t){return Kt({...t,float:!1})}function tn(t){return Kt({...t,float:!0})}function P(t){return new ke({expected:t})}function ct(t,e,r=null){if(t instanceof g||e&&(t=e(t,r),t instanceof g))return t;if(t==null)return Y();if(Array.isArray(t)){const n=t.map((s,o)=>ct(s,e,o));return U(n)}if(t.constructor===Object){const n={};for(const s in t)Object.prototype.hasOwnProperty.call(t,s)&&(n[s]=ct(t[s],e,s));return P(n)}return t instanceof b.ValueState?qe({...t,value:ct(t.value,e,"value")}):ze(t)}function en(t){return P(t).set({ignoreExtraKeys:!0})}function Ft(t){return new Ie({pattern:t})}function rn(t){return new ve({expected:t})}function je(t){return v("typeof",e=>e===null?"null":typeof e,t)}function nn(t){return v("constructor",e=>e.constructor,t)}function lt(){return je("boolean")}function Y(){return Le(null)}function sn(){return Be(Y())}function on(...t){return new et({expecteds:t,type:"or",pipe:!1})}function un(...t){return new et({expecteds:t,type:"and",pipe:!1})}function Ke(...t){return new et({expecteds:t,type:"or",pipe:!0})}function $(...t){return new et({expecteds:t,type:"and",pipe:!0})}function j(t,e){return e==null?Ke(Y(),t):e?t:Y()}function Fe(t){const e=typeof t=="number"||D(t)?t:rt(t??{min:1});return $(U(),v("length",r=>r.length,e)).name("array length")}function an(t){const e=typeof t=="number"||D(t)?t:rt(t??{min:1});return $(Ft(),v("length",r=>r.length,e)).name("string length")}function cn(t){return $(P(),t)}function ln(t){return $(U(),t)}function fn(t){return $(P(),v("keys",e=>Object.keys(e),t))}function hn(t){return $(P(),v("values",e=>Object.values(e),t))}function mn(t){return $(P(),v("entries",e=>Object.entries(e),t))}function gt(t){return new De({expected:t})}function pn(t){return gt(U([t,V()]))}function dn(t){return gt(U([V(),t]))}function gn(t,e){return gt(U([t,e]))}function yn(t){return $(P(),v("keys not null",e=>Object.keys(e).filter(r=>e[r]!=null),t))}function Ve(t){return new Pe({expected:t})}function _n(t){return Ve(Object.values(t))}function Vt(t,e){return new Ne({matcher:e,name:t})}const wn=Math.ceil(Date.now()-10*365.25*24*60*60*1e3),bn=Math.ceil(Date.now()+10*365.25*24*60*60*1e3);function J(t){return rt({...t,min:t?.min??wn,max:t?.max??bn}).name("int date")}function We(t){const e={min:t?.from?.min??t?.common?.min,max:t?.from?.max??t?.common?.max,float:t?.from?.float??t?.common?.float,optional:t?.from?.optional??t?.common?.optional},r={min:t?.to?.min??t?.common?.min,max:t?.to?.max??t?.common?.max,float:t?.to?.float??t?.common?.float,optional:t?.to?.optional??t?.common?.optional};return $(U([e.optional?j(J()):J(),r.optional?j(J()):J()]),Vt("min <= max",n=>n[0]!=null&&n[1]!=null&&n[0]>n[1]?`Expected range to be [min, max], got [${n.join(", ")}]`:!0)).name("range")}function Sn(t){return We({...t,common:{min:new Date(2020,0,1).getTime(),max:Date.now()+900*1e3,...t?.common}}).name("range date")}function Be(t){return new Rt({expected:t})}function On(){return Ft(/^[\da-f-]{36}|[\da-f]{32}$/i).name("uuid")}function qe(t){return P({[Symbol.toStringTag]:j(V()),loading:j(lt()),hasValue:j(lt()),value:V(),hasError:j(lt()),error:V(),...t})}function xn(t){return t!=null&&typeof t=="string"&&(t=new TextEncoder().encode(t).buffer),Vt("array buffer",e=>{if(e==null||typeof e!="object"||typeof e.byteLength!="number")return`Expected array buffer, got "${e}"`;if(t==null)return!0;if(e.byteLength!==t.byteLength)return`Expected array buffer length to be ${t.byteLength}, got ${e.byteLength}`;for(let r=0,n=t.byteLength;r<n;r++)if(e[r]!==t[r])return`Expected array buffer[${r}] to be ${t[r]}, got ${e[r]}`;return!0})}function Gt(t){return t.replace(/\W/g,"").toLowerCase()}function Ge(t){return t instanceof URL?t.searchParams:t instanceof URLSearchParams?t:typeof t=="string"?new URL(t).searchParams:typeof window<"u"?new URL(window.location.href).searchParams:new URLSearchParams}function Je(t){return t==null?null:(t=t.toLowerCase().trim(),t==="true"||t==="1"||t==="yes"?!0:t==="false"||t==="0"||t==="no"?!1:null)}function He(t){if(t==null)return null;t=t.trim();const e=parseInt(t,10);return isNaN(e)?null:e}function Qe(t){if(t==null)return null;t=t.trim();const e=parseFloat(t);return isNaN(e)?null:e}function yt(t,e){const r=Ge(e),n=Gt(t);for(const[s,o]of r.entries())if(Gt(s)===n)return o;return null}function En(t,e){return Je(yt(t,e))}function Mn(t,e){return He(yt(t,e))}function Cn(t,e){return Qe(yt(t,e))}exports.Cache=sr;exports.CacheStats=Yt;exports.CheckError=Lt;exports.ConsoleMessageLevel=F;exports.Lazy=Ze;exports.LazyWithId=tr;exports.Locker=Qt;exports.LockerWithId=Xt;exports.LogLevel=$t;exports.MAX_REPORT_ITEMS_DEFAULT=tt;exports.MatchInternalError=R;exports.Matcher=g;exports.MatcherAny=Ce;exports.MatcherArray=zt;exports.MatcherArrayItem=$e;exports.MatcherConvert=Ae;exports.MatcherCustom=Ne;exports.MatcherFew=et;exports.MatcherIn=Pe;exports.MatcherInstanceOf=ve;exports.MatcherIs=jt;exports.MatcherNever=Re;exports.MatcherNot=Rt;exports.MatcherNumber=Te;exports.MatcherObject=ke;exports.MatcherObjectEntry=De;exports.MatcherRef=Ue;exports.MatcherString=Ie;exports.MemoryStorage=or;exports.Random=mt;exports.Subject=vt;exports.SubjectWithId=Gr;exports.UNIQUE_PSEUDO_RANDOM_MAX_COUNT=at;exports.alertConsole=Wr;exports.alertReplace=Lr;exports.argsToString=dt;exports.check=G;exports.checkFunc=Hr;exports.compressGzip=xr;exports.consoleIntercept=Vr;exports.consoleMessageToString=Fr;exports.consoleReplace=It;exports.convertTimeZone=At;exports.converterErrorToBuffer=br;exports.converterJson=Mt;exports.converterJsonBuffer=gr;exports.converterStringToBuffer=Q;exports.createMatchResult=Nt;exports.createMatchResultBoolean=Pt;exports.createMatchResultError=xe;exports.createTaskDelayRetry=rr;exports.createUniquePseudoRandom=Rr;exports.dateNowUnique=Dr;exports.decompressGzip=Mr;exports.deepCloneJsonLike=xt;exports.deepEqualJsonLike=H;exports.deepEqualJsonLikeMap=ir;exports.equalArray=ur;exports.escapeHtml=yr;exports.escapeRegExp=_r;exports.expectedToString=Z;exports.filterMatchResult=Dt;exports.filterMatchResultNested=Ee;exports.fixStackTrace=Br;exports.formatAny=I;exports.formatDate=me;exports.formatDateFileName=pe;exports.getConsoleMessages=be;exports.getDateInet=Ur;exports.getHashKey=fr;exports.getJsonKey=Zt;exports.getNormalizedObject=ht;exports.getObjectId=z;exports.getRandomFunc=ye;exports.getRandomSeed=kr;exports.getStackTrace=Se;exports.isGzipCompressed=Er;exports.isMatcher=D;exports.isObservable=qr;exports.mapObjectConverter=Sr;exports.match=C;exports.matchAnd=un;exports.matchAndPipe=$;exports.matchAny=V;exports.matchArray=U;exports.matchArrayBuffer=xn;exports.matchArrayIncludes=Qr;exports.matchArrayItem=Zr;exports.matchArrayLength=Fe;exports.matchArrayWith=ln;exports.matchBoolean=lt;exports.matchConstructor=nn;exports.matchConvert=v;exports.matchCustom=Vt;exports.matchDeep=ct;exports.matchEnum=_n;exports.matchFloat=tn;exports.matchIn=Ve;exports.matchInstanceOf=rn;exports.matchInt=rt;exports.matchIntDate=J;exports.matchIs=ze;exports.matchIsNonStrict=Le;exports.matchNever=Yr;exports.matchNot=Be;exports.matchNotNullish=sn;exports.matchNullish=Y;exports.matchNumber=Kt;exports.matchObject=P;exports.matchObjectEntries=mn;exports.matchObjectEntry=gt;exports.matchObjectKey=pn;exports.matchObjectKeyValue=gn;exports.matchObjectKeys=fn;exports.matchObjectKeysNotNull=yn;exports.matchObjectPartial=en;exports.matchObjectValue=dn;exports.matchObjectValues=hn;exports.matchObjectWith=cn;exports.matchOptional=j;exports.matchOr=on;exports.matchOrPipe=Ke;exports.matchRange=We;exports.matchRangeDate=Sn;exports.matchRef=Xr;exports.matchResultNestedToString=Me;exports.matchResultToString=Ut;exports.matchString=Ft;exports.matchStringLength=an;exports.matchTypeOf=je;exports.matchUuid=On;exports.matchValueState=qe;exports.max=ge;exports.min=de;exports.minMax=Cr;exports.numberMod=$r;exports.promiseAllWait=k;exports.randomBoolean=Ir;exports.randomEnum=Nr;exports.randomFloat=Tt;exports.randomIndexWeighted=vr;exports.randomInt=_e;exports.randomItem=kt;exports.randomItems=Pr;exports.setArrayConverter=Or;exports.setFuncName=ar;exports.sha256=se;exports.sha256Buffer=ne;exports.timeoutAbortController=Ht;exports.toConvertFrom=le;exports.toConvertTo=ce;exports.toConvertWithDefaultFrom=ie;exports.toConvertWithDefaultTo=oe;exports.toConverter=dr;exports.toConverterFrom=he;exports.toConverterTo=fe;exports.toConverterWithDefault=pr;exports.toConverterWithDefaultFrom=ae;exports.toConverterWithDefaultTo=ue;exports.toCorrect=mr;exports.toCorrectWithDefault=hr;exports.toHex=te;exports.truncateString=q;exports.urlGetBoolean=En;exports.urlGetFloat=Cn;exports.urlGetInt=Mn;exports.urlGetParams=Ge;exports.urlGetString=yt;exports.urlParamToBoolean=Je;exports.urlParamToFloat=Qe;exports.urlParamToInt=He;exports.validateMatchResult=X;exports.waitObservable=Jr;exports.withConsoleReplace=zr;exports.withRetry=er;exports.withTimeout=Ye;