@flemist/simple-utils 2.0.0 → 2.0.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.
- package/build/browser/index.cjs +1 -1
- package/build/browser/index.mjs +1 -1
- package/build/common/index.cjs +1 -1
- package/build/common/index.mjs +1 -1
- package/build/common/string/format/truncateString.d.ts +3 -1
- package/build/node/index.cjs +1 -1
- package/build/node/index.mjs +1 -1
- package/build/urlGet-BQjIy5xj.js +11 -0
- package/build/{urlGet-A6tzime-.mjs → urlGet-DynBzL4r.mjs} +219 -214
- package/package.json +1 -1
- package/build/urlGet-Be7wEmXE.js +0 -11
package/build/browser/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../urlGet-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../urlGet-BQjIy5xj.js");exports.ConsoleMessageLevel=e.ConsoleMessageLevel;exports.Lazy=e.Lazy;exports.LazyWithId=e.LazyWithId;exports.Random=e.Random;exports.UNIQUE_PSEUDO_RANDOM_MAX_COUNT=e.UNIQUE_PSEUDO_RANDOM_MAX_COUNT;exports.alertReplace=e.alertReplace;exports.consoleReplace=e.consoleReplace;exports.convertTimeZone=e.convertTimeZone;exports.createUniquePseudoRandom=e.createUniquePseudoRandom;exports.dateNowUnique=e.dateNowUnique;exports.deepCloneJsonLike=e.deepCloneJsonLike;exports.deepEqualJsonLike=e.deepEqualJsonLike;exports.deepEqualJsonLikeMap=e.deepEqualJsonLikeMap;exports.equalArray=e.equalArray;exports.escapeHtml=e.escapeHtml;exports.escapeRegExp=e.escapeRegExp;exports.fixStackTrace=e.fixStackTrace;exports.formatAny=e.formatAny;exports.formatDate=e.formatDate;exports.formatDateFileName=e.formatDateFileName;exports.getDateInet=e.getDateInet;exports.getNormalizedObject=e.getNormalizedObject;exports.getRandomFunc=e.getRandomFunc;exports.getRandomSeed=e.getRandomSeed;exports.getStackTrace=e.getStackTrace;exports.max=e.max;exports.min=e.min;exports.minMax=e.minMax;exports.numberMod=e.numberMod;exports.randomBoolean=e.randomBoolean;exports.randomEnum=e.randomEnum;exports.randomFloat=e.randomFloat;exports.randomIndexWeighted=e.randomIndexWeighted;exports.randomInt=e.randomInt;exports.randomItem=e.randomItem;exports.randomItems=e.randomItems;exports.setFuncName=e.setFuncName;exports.sha256=e.sha256;exports.sha256Buffer=e.sha256Buffer;exports.timeoutAbortController=e.timeoutAbortController;exports.toHex=e.toHex;exports.truncateString=e.truncateString;exports.urlGetBoolean=e.urlGetBoolean;exports.urlGetFloat=e.urlGetFloat;exports.urlGetInt=e.urlGetInt;exports.urlGetParams=e.urlGetParams;exports.urlGetString=e.urlGetString;exports.urlParamToBoolean=e.urlParamToBoolean;exports.urlParamToFloat=e.urlParamToFloat;exports.urlParamToInt=e.urlParamToInt;exports.withConsoleReplace=e.withConsoleReplace;exports.withTimeout=e.withTimeout;
|
package/build/browser/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { H as s, O as o, P as t, R as n, U as r, G as m, I as l, q as d, l as u, o as i, A as c, B as p, C as g, D as I, y as R, z as T, K as f, u as x, v as N, w as h, p as E, E as F, d as L, g as M, L as P, b as S, m as U, c as k, n as q, f as A, k as C, r as D, h as G, e as y, i as B, j as O, F as b, a as w, s as z, M as J, t as _, x as v, X as H, Z as W, Y as j, Q, W as X, S as Z, V as K, T as V, J as Y, N as $ } from "../urlGet-
|
|
1
|
+
import { H as s, O as o, P as t, R as n, U as r, G as m, I as l, q as d, l as u, o as i, A as c, B as p, C as g, D as I, y as R, z as T, K as f, u as x, v as N, w as h, p as E, E as F, d as L, g as M, L as P, b as S, m as U, c as k, n as q, f as A, k as C, r as D, h as G, e as y, i as B, j as O, F as b, a as w, s as z, M as J, t as _, x as v, X as H, Z as W, Y as j, Q, W as X, S as Z, V as K, T as V, J as Y, N as $ } from "../urlGet-DynBzL4r.mjs";
|
|
2
2
|
export {
|
|
3
3
|
s as ConsoleMessageLevel,
|
|
4
4
|
o as Lazy,
|
package/build/common/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../urlGet-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../urlGet-BQjIy5xj.js");exports.ConsoleMessageLevel=e.ConsoleMessageLevel;exports.Lazy=e.Lazy;exports.LazyWithId=e.LazyWithId;exports.Random=e.Random;exports.UNIQUE_PSEUDO_RANDOM_MAX_COUNT=e.UNIQUE_PSEUDO_RANDOM_MAX_COUNT;exports.alertReplace=e.alertReplace;exports.consoleReplace=e.consoleReplace;exports.convertTimeZone=e.convertTimeZone;exports.createUniquePseudoRandom=e.createUniquePseudoRandom;exports.dateNowUnique=e.dateNowUnique;exports.deepCloneJsonLike=e.deepCloneJsonLike;exports.deepEqualJsonLike=e.deepEqualJsonLike;exports.deepEqualJsonLikeMap=e.deepEqualJsonLikeMap;exports.equalArray=e.equalArray;exports.escapeHtml=e.escapeHtml;exports.escapeRegExp=e.escapeRegExp;exports.fixStackTrace=e.fixStackTrace;exports.formatAny=e.formatAny;exports.formatDate=e.formatDate;exports.formatDateFileName=e.formatDateFileName;exports.getDateInet=e.getDateInet;exports.getNormalizedObject=e.getNormalizedObject;exports.getRandomFunc=e.getRandomFunc;exports.getRandomSeed=e.getRandomSeed;exports.getStackTrace=e.getStackTrace;exports.max=e.max;exports.min=e.min;exports.minMax=e.minMax;exports.numberMod=e.numberMod;exports.randomBoolean=e.randomBoolean;exports.randomEnum=e.randomEnum;exports.randomFloat=e.randomFloat;exports.randomIndexWeighted=e.randomIndexWeighted;exports.randomInt=e.randomInt;exports.randomItem=e.randomItem;exports.randomItems=e.randomItems;exports.setFuncName=e.setFuncName;exports.sha256=e.sha256;exports.sha256Buffer=e.sha256Buffer;exports.timeoutAbortController=e.timeoutAbortController;exports.toHex=e.toHex;exports.truncateString=e.truncateString;exports.urlGetBoolean=e.urlGetBoolean;exports.urlGetFloat=e.urlGetFloat;exports.urlGetInt=e.urlGetInt;exports.urlGetParams=e.urlGetParams;exports.urlGetString=e.urlGetString;exports.urlParamToBoolean=e.urlParamToBoolean;exports.urlParamToFloat=e.urlParamToFloat;exports.urlParamToInt=e.urlParamToInt;exports.withConsoleReplace=e.withConsoleReplace;exports.withTimeout=e.withTimeout;
|
package/build/common/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { H as s, O as o, P as t, R as n, U as r, G as m, I as l, q as d, l as u, o as i, A as c, B as p, C as g, D as I, y as R, z as T, K as f, u as x, v as N, w as h, p as E, E as F, d as L, g as M, L as P, b as S, m as U, c as k, n as q, f as A, k as C, r as D, h as G, e as y, i as B, j as O, F as b, a as w, s as z, M as J, t as _, x as v, X as H, Z as W, Y as j, Q, W as X, S as Z, V as K, T as V, J as Y, N as $ } from "../urlGet-
|
|
1
|
+
import { H as s, O as o, P as t, R as n, U as r, G as m, I as l, q as d, l as u, o as i, A as c, B as p, C as g, D as I, y as R, z as T, K as f, u as x, v as N, w as h, p as E, E as F, d as L, g as M, L as P, b as S, m as U, c as k, n as q, f as A, k as C, r as D, h as G, e as y, i as B, j as O, F as b, a as w, s as z, M as J, t as _, x as v, X as H, Z as W, Y as j, Q, W as X, S as Z, V as K, T as V, J as Y, N as $ } from "../urlGet-DynBzL4r.mjs";
|
|
2
2
|
export {
|
|
3
3
|
s as ConsoleMessageLevel,
|
|
4
4
|
o as Lazy,
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export type TruncateStringOptions = {
|
|
2
|
-
fromStart?: boolean;
|
|
2
|
+
fromStart?: null | boolean;
|
|
3
|
+
appendEllipsis?: null | boolean;
|
|
4
|
+
appendTruncatedLength?: null | boolean;
|
|
3
5
|
};
|
|
4
6
|
export declare function truncateString(str: string, maxLength: number | null | undefined, options?: null | TruncateStringOptions): string;
|
|
5
7
|
export declare function truncateString(str: string | null | undefined, maxLength: number | null | undefined, options?: null | TruncateStringOptions): string | null;
|
package/build/node/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../urlGet-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("../urlGet-BQjIy5xj.js"),C=require("@flemist/async-utils"),S=require("@flemist/time-limits"),b=require("node:os"),V=require("path"),W=require("@flemist/priority-queue"),ee=require("fs"),te=require("picomatch");function j(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const a in e)if(a!=="default"){const i=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(n,a,i.get?i:{enumerable:!0,get:()=>e[a]})}}return n.default=e,Object.freeze(n)}const w=j(V),g=j(ee),z=new S.Pool(b.cpus().length);function x(e){return e.replace(/\\/g,"/")}let I=null;function ne(e){I==null&&(I=new Map);const n=x(e);let a=I.get(n);return a==null&&(a=new C.Locker,I.set(n,a)),a}function re(e){const{filePath:n,func:a}=e;return ne(n).lock(()=>S.poolRunWait({pool:z,count:1,func:a}))}function B(e){return e.match(/^[/\\]?[^/\\]+/)[0]}function H(e,n){return B(e)+"|"+n.ino}function $(e){return e.endsWith(":")&&(e+="/"),w.resolve(e)}function _(e,n){e.totalSize+=n.totalSize,e.maxFileDateModified=Math.max(e.maxFileDateModified,n.maxFileDateModified),e.countFiles+=n.countFiles,e.countDirs+=n.countDirs,e.countLinks+=n.countLinks}const J=function(n){return n.code==="ENOENT"};function Q(e){const n=e.paths;if(!n||n.length===0)return Promise.resolve({totalSize:0,maxFileDateModified:0,countFiles:0,countDirs:0,countLinks:0});const a=e.level??0,i=e.walkedIds??new Set,r=e.abortSignal,l=e.pool??z,p=e.handleError,d=e.priority??W.priorityCreate(0),c=e.walkLinks??!1,m=e.log,D=e.handlePath,N=e.matchPath;async function R(L){if(!(p&&await p(L))&&!J(L))throw L}function Y(L){return!(!m||m.minTotalContentSize!=null&&L<m.minTotalContentSize||m.maxNestedLevel!=null&&a>m.maxNestedLevel)}return C.useAbortController(async L=>{const E=C.combineAbortSignals(r,L),T={totalSize:0,maxFileDateModified:0,countFiles:0,countDirs:0,countLinks:0};function q(f,y){if(Y(y.totalSize)){const o=`${y.totalSize.toLocaleString("en-US").replace(/,/g," ").padStart(19)}: ${f}`;m?.handleLog?m.handleLog(o):console.log(o)}}async function G(f,y,k,o){return D?await S.poolRunWait({pool:l,func:async()=>{try{return await D({level:a,path:f,stat:y,itemStat:k,totalStat:T,abortSignal:E})}catch(u){return await R(u),!1}},count:1,priority:o,abortSignal:E}):!0}async function O(f,y,k,o){o||(o=f);const u=await S.poolRunWait({pool:l,func:()=>g.promises.lstat(f).catch(R),count:1,priority:W.priorityCreate(y,W.priorityCreate(1,d)),abortSignal:E});if(!u||!k&&u.isFile())return null;const U=H(f,u);if(i.has(U))return null;i.add(U);let s={totalSize:u.size,maxFileDateModified:u.isDirectory()?0:u.mtimeMs,countFiles:0,countDirs:0,countLinks:0};const M=W.priorityCreate(y,W.priorityCreate(u.isDirectory()?2:3,d));if(u.isSymbolicLink()){if(c){const h=await S.poolRunWait({pool:l,func:()=>g.promises.readlink(f).catch(R).then(F=>F??null),count:1,priority:M,abortSignal:E});if(h){const F=w.isAbsolute(h)?h:w.resolve(w.dirname(o),h),v=await O(F,y,k,o);v&&(s=v)}}return(k||s.countFiles+s.countDirs+s.countLinks>=1)&&(s.countLinks+=1,await G(o,u,s,M)&&(_(T,s),q(o,s))),s}else if(u.isDirectory()){const h=await S.poolRunWait({pool:l,func:()=>g.promises.readdir(f).catch(R),count:1,priority:d,abortSignal:E});if(h){for(let F=0,v=h.length;F<v;F++)h[F]=w.join(o,h[F]);s=await Q({...e,paths:h,abortSignal:E,priority:M,level:a+1,walkedIds:i})}}return(k||s.countFiles+s.countDirs+s.countLinks>=1)&&(u.isDirectory()?s.countDirs+=1:u.isFile()&&(s.countFiles+=1),await G(o,u,s,M)&&(_(T,s),q(o,s))),s}const A=[];for(let f=0,y=n.length;f<y;f++){const k=$(n[f]),o=N?N(k):!0;o!==!1&&A.push(O(k,f,o))}return await Promise.all(A),T})}function ae(e){return Q(e)}function ie({globs:e,rootDir:n,noCase:a}){const i=[];return e.forEach(r=>{r=x(r).trim();const l=r.startsWith("^");l&&(r=r.substring(1).trim());const p=r.startsWith("!");if(p&&(r=r.substring(1).trim()),r.startsWith("!")||r.startsWith("^"))throw new Error(`Invalid glob pattern: "${r}". The syntax '${r.substring(0,2)}' is not supported. Valid glob patterns use: * (match any characters), ** (match any directories), ? (match single character), [abc] (character class), ! (negate pattern), ^ (exclude if included). Examples of valid patterns: "*.js", "src/**/*.ts", "!node_modules", "^dist". Avoid starting with '!' after '^' or multiple special prefixes.`);r.startsWith("/")&&(r="."+r);const d=x(n?w.resolve(n,r):r);if(!d)return;let c;try{c=te(d,{nocase:a??!1,dot:!0,strictBrackets:!0})}catch(m){throw new Error(`Invalid glob pattern: "${r}". ${m instanceof Error?m.message:"Unknown error"}. Valid glob patterns use: * (match any characters), ** (match any directories), ? (match single character), [abc] (character class with balanced brackets), ! (negate pattern), ^ (exclude if included). Examples: "*.js", "src/**/*.ts", "!node_modules", "[abc]def.txt". Ensure all brackets [ ] are properly closed and balanced.`)}i.push({exclude:l,negative:p,debugInfo:d,match:c})}),function(l){l=x(l);let p=null,d=!1;for(let c=0,m=i.length;c<m;c++){const D=i[c];D.match(l)&&(D.exclude?d=!D.negative:(p=!D.negative,d=!1))}return d?!1:p}}function X(e){const n=e.startsWith("!");return n&&(e=e.substring(1)),e.startsWith("/")?e=e.substring(1):!e.startsWith("**")&&!e.startsWith("../")&&(e=`**/${e}`),n&&(e="!"+e),e}function Z(e,n){if(!n||n===".")return e;const a=e.startsWith("^");a&&(e=e.substring(1));const i=e.startsWith("!");return i&&(e=e.substring(1)),e.startsWith("/")?(n.endsWith("/")&&(n=n.substring(0,n.length-1)),e=n+e):(n.endsWith("/")||(n+="/"),e.startsWith("./")?e=n+e.substring(2):e.startsWith("../")?e=n+e:(n.startsWith("..")&&(n=""),e.startsWith("**")?e=n+e:e=n+"**/"+e)),e=x(w.normalize(e)),i&&(e="!"+e),a&&(e="^"+e),e}function P(e){return"^"+e}async function K(e){const a=(await g.promises.readFile(e,"utf-8")).split(`
|
|
2
2
|
`),i=[];return a.forEach(r=>{r=r.trim(),!(!r||r.startsWith("#"))&&i.push(r)}),i}async function se(e){const n=e.rootDir??".",a=[];if(!e.globs?.length)return a;const i=[];return e.globs.forEach(r=>{r.value&&(r.valueType==="file-contains-patterns"?i.push(r):r.valueType==="pattern"&&a.push(r.exclude?P(r.value):r.value))}),i.length&&await Promise.all(i.map(async r=>{await S.poolRunWait({pool:z,count:1,func:async()=>{const l=w.resolve(n,r.value),p=await K(l),d=w.relative(n,w.dirname(l));p.forEach(c=>{c=X(c),c=Z(c,d),a.push(r.exclude?P(c):c)})}})})),a}exports.ConsoleMessageLevel=t.ConsoleMessageLevel;exports.Lazy=t.Lazy;exports.LazyWithId=t.LazyWithId;exports.Random=t.Random;exports.UNIQUE_PSEUDO_RANDOM_MAX_COUNT=t.UNIQUE_PSEUDO_RANDOM_MAX_COUNT;exports.alertReplace=t.alertReplace;exports.consoleReplace=t.consoleReplace;exports.convertTimeZone=t.convertTimeZone;exports.createUniquePseudoRandom=t.createUniquePseudoRandom;exports.dateNowUnique=t.dateNowUnique;exports.deepCloneJsonLike=t.deepCloneJsonLike;exports.deepEqualJsonLike=t.deepEqualJsonLike;exports.deepEqualJsonLikeMap=t.deepEqualJsonLikeMap;exports.equalArray=t.equalArray;exports.escapeHtml=t.escapeHtml;exports.escapeRegExp=t.escapeRegExp;exports.fixStackTrace=t.fixStackTrace;exports.formatAny=t.formatAny;exports.formatDate=t.formatDate;exports.formatDateFileName=t.formatDateFileName;exports.getDateInet=t.getDateInet;exports.getNormalizedObject=t.getNormalizedObject;exports.getRandomFunc=t.getRandomFunc;exports.getRandomSeed=t.getRandomSeed;exports.getStackTrace=t.getStackTrace;exports.max=t.max;exports.min=t.min;exports.minMax=t.minMax;exports.numberMod=t.numberMod;exports.randomBoolean=t.randomBoolean;exports.randomEnum=t.randomEnum;exports.randomFloat=t.randomFloat;exports.randomIndexWeighted=t.randomIndexWeighted;exports.randomInt=t.randomInt;exports.randomItem=t.randomItem;exports.randomItems=t.randomItems;exports.setFuncName=t.setFuncName;exports.sha256=t.sha256;exports.sha256Buffer=t.sha256Buffer;exports.timeoutAbortController=t.timeoutAbortController;exports.toHex=t.toHex;exports.truncateString=t.truncateString;exports.urlGetBoolean=t.urlGetBoolean;exports.urlGetFloat=t.urlGetFloat;exports.urlGetInt=t.urlGetInt;exports.urlGetParams=t.urlGetParams;exports.urlGetString=t.urlGetString;exports.urlParamToBoolean=t.urlParamToBoolean;exports.urlParamToFloat=t.urlParamToFloat;exports.urlParamToInt=t.urlParamToInt;exports.withConsoleReplace=t.withConsoleReplace;exports.withTimeout=t.withTimeout;exports.createMatchPath=ie;exports.fileLock=re;exports.getDrive=B;exports.getFileId=H;exports.globGitIgnoreToPicomatch=X;exports.globToRelative=Z;exports.loadGlobs=se;exports.loadGlobsFromFile=K;exports.pathNormalize=x;exports.pathResolve=$;exports.poolFs=z;exports.walkPathHandleErrorDefault=J;exports.walkPaths=ae;
|
package/build/node/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { H as mt, O as ht, P as pt, R as kt, U as wt, G as yt, I as xt, q as Ft, l as Lt, o as Dt, A as St, B as Et, C as Wt, D as zt, y as vt, z as Mt, K as Tt, u as It, v as Nt, w as Rt, p as Ct, E as At, d as Gt, g as Ut, L as Ot, b as $t, m as qt, c as Bt, n as _t, f as jt, k as Ht, r as Jt, h as gt, e as Pt, i as Qt, j as Xt, F as Zt, a as Kt, s as Yt, M as Vt, t as bt, x as te, X as ee, Z as ne, Y as se, Q as ae, W as re, S as ie, V as oe, T as ce, J as ue, N as le } from "../urlGet-
|
|
1
|
+
import { H as mt, O as ht, P as pt, R as kt, U as wt, G as yt, I as xt, q as Ft, l as Lt, o as Dt, A as St, B as Et, C as Wt, D as zt, y as vt, z as Mt, K as Tt, u as It, v as Nt, w as Rt, p as Ct, E as At, d as Gt, g as Ut, L as Ot, b as $t, m as qt, c as Bt, n as _t, f as jt, k as Ht, r as Jt, h as gt, e as Pt, i as Qt, j as Xt, F as Zt, a as Kt, s as Yt, M as Vt, t as bt, x as te, X as ee, Z as ne, Y as se, Q as ae, W as re, S as ie, V as oe, T as ce, J as ue, N as le } from "../urlGet-DynBzL4r.mjs";
|
|
2
2
|
import { Locker as j, useAbortController as H, combineAbortSignals as J } from "@flemist/async-utils";
|
|
3
3
|
import { Pool as g, poolRunWait as D } from "@flemist/time-limits";
|
|
4
4
|
import P from "node:os";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";const z=require("@flemist/abort-controller-fast"),K=require("@flemist/async-utils"),Ut=require("@flemist/time-controller");let q=null;function At(){if(!q){q=new Array(256);for(let t=0;t<256;t++)q[t]=t.toString(16).padStart(2,"0")}return q}function st(t){const e=At(),n=new Uint8Array(t.buffer,t.byteOffset,t.byteLength);let r="";for(let o=0,i=n.length;o<i;o++)r+=e[n[o]];return r}let Y=null,ut=null,B=null,lt=null;function Et(){Y||(Y=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]),ut=new Uint32Array(64),lt=new TextEncoder,B=new Uint8Array(65536))}function at(t){if(t==null)return null;Et();const e=Y,n=ut,r=lt;let o=B,i;if(typeof t=="string"){const h=t.length*3;o.length<h+128&&(o=B=new Uint8Array(h+128));const f=r.encodeInto(t,o);i=o.subarray(0,f.written)}else if(t instanceof Uint8Array)i=t;else if(ArrayBuffer.isView(t))i=new Uint8Array(t.buffer,t.byteOffset,t.byteLength);else throw new Error(`[sha256Buffer] Unsupported content type: ${typeof t}`);const c=i.length,a=c+72>>>6<<6;o.length<a&&(o=B=new Uint8Array(a)),i!==o&&o.set(i),o[c]=128;for(let h=c+1;h<a;h++)o[h]=0;const U=c*8,O=U/4294967296|0,C=U|0;o[a-8]=O>>>24,o[a-7]=O>>>16,o[a-6]=O>>>8,o[a-5]=O,o[a-4]=C>>>24,o[a-3]=C>>>16,o[a-2]=C>>>8,o[a-1]=C;let A=1779033703,T=-1150833019,u=1013904242,s=-1521486534,l=1359893119,g=-1694144372,d=528734635,y=1541459225;for(let h=0;h<a;h+=64){for(let m=0;m<16;m++){const p=h+(m<<2);n[m]=o[p]<<24|o[p+1]<<16|o[p+2]<<8|o[p+3]}for(let m=16;m<64;m++){const p=n[m-15],$=n[m-2],b=(p>>>7|p<<25)^(p>>>18|p<<14)^p>>>3,F=($>>>17|$<<15)^($>>>19|$<<13)^$>>>10;n[m]=n[m-16]+b+n[m-7]+F|0}let f=A,S=T,L=u,W=s,_=l,D=g,x=d,J=y;for(let m=0;m<64;m+=4)for(let p=0;p<4;p++){const $=m+p,b=(_>>>6|_<<26)^(_>>>11|_<<21)^(_>>>25|_<<7),F=J+b+(x^_&(D^x))+e[$]+n[$]|0,$t=((f>>>2|f<<30)^(f>>>13|f<<19)^(f>>>22|f<<10))+(f&S^L&(f^S))|0;J=x,x=D,D=_,_=W+F|0,W=L,L=S,S=f,f=F+$t|0}A=A+f|0,T=T+S|0,u=u+L|0,s=s+W|0,l=l+_|0,g=g+D|0,d=d+x|0,y=y+J|0}const w=new Uint8Array(32),R=[A,T,u,s,l,g,d,y];for(let h=0;h<8;h++){const f=R[h],S=h<<2;w[S]=f>>>24,w[S+1]=f>>>16&255,w[S+2]=f>>>8&255,w[S+3]=f&255}return w}function Ct(t){const e=at(t);return e?st(e):null}function ct(t,e){return t==null?e:e==null?t:Math.min(t,e)}function ft(t,e){return t==null?e:e==null?t:Math.max(t,e)}function Rt(t,e,n){return ft(ct(t,e),n)}function It(t,e){return(t%e+e)%e}function kt(t){return function(){let n=t+=1831565813;return n=Math.imul(n^n>>>15,n|1),n^=n+Math.imul(n^n>>>7,n|61),(n^n>>>14)/4294967296+.5}}function xt(){return Math.random()}function Nt(){return Math.random()*2**32>>>0}function ht(t){return t!=null?kt(t):xt}class G{_seed;_rnd;constructor(e){this._seed=e,this._rnd=ht(e)}get seed(){return this._seed}nextSeed(){return this.next()*2**32>>>0}nextRandom(){return new G(this.nextSeed())}next(){return this._rnd()}clone(){return new G(this._seed)}}function v(t,e,n){if(n==null&&(n=e,e=0),n<=e)throw new Error(`[random][randomFloat] toExclusive (${n}) must be greater than from (${e})`);return t.next()*(n-e)+e}function mt(t,e,n){return Math.floor(v(t,e,n))}function Mt(t,e){return t.next()<(e??.5)}function Pt(t,e,n){if(Array.isArray(e)){const i=e;e=i.length,n=c=>i[c]}if(!n)throw new Error("[random][randomIndexWeighted] getWeight is required");let r=0;for(let i=0;i<e;i++)r+=n(i);if(r===0)return-1;let o=v(t,r);for(let i=0;i<e;i++)if(o-=n(i),o<0)return i;return e-1}function j(t,e){if(e.length===0)throw new Error("[random][randomItem] items is empty");const n=mt(t,e.length);return e[n]}function Lt(t,e,n){if(e.length===0)throw new Error("[random][randomItems] items is empty");const r=[];for(let o=0;o<n;o++)r.push(j(t,e));return r}function Dt(t,e,n){let r=Object.values(e);return n&&(r=r.filter(n)),j(t,r)}const dt=1073741789,V=(dt>>2)-1;function Ft(t=V,e){if(t<=0)throw new Error(`[random][PseudoRandom] count(${t}) must be > 0`);if(t>V)throw new Error(`[random][PseudoRandom] count(${t}) must be <= ${V}`);if(e==null&&(e=Math.floor(Math.random()*t)),e>=t)throw new Error(`[random][PseudoRandom] startFrom(${e}) must be < count(${t})`);let n=e;return function(){return n=(n+dt)%t,n}}let N=null;function qt(){const t=Date.now();return N==null||t>N?(N=t,t):(N++,N)}async function Bt({url:t,timeout:e}={}){t||(t=typeof window<"u"?"/":"https://google.com");let n;try{const r=new z.AbortControllerFast;n=e?setTimeout(()=>{r.abort()},e):null;const o=await fetch(t,{method:"HEAD",signal:z.toAbortSignal(r.signal)}),i=o.headers.get("date");if(!i)throw new Error(`[Now][getDateInet] No date header in response: ${o.status} ${t}`);return new Date(i).getTime()}finally{n&&clearTimeout(n)}}function tt(t,e,n){const r=e==null?t:new Date(t.toLocaleString("en-US",{timeZone:e})),o=n==null?t:new Date(t.toLocaleString("en-US",{timeZone:n}));return new Date(t.getTime()+o.getTime()-r.getTime())}function pt(t,e){t=tt(t,"UTC",e);const n=t.getUTCFullYear().toString().padStart(4,"0"),r=(t.getUTCMonth()+1).toString().padStart(2,"0"),o=t.getUTCDate().toString().padStart(2,"0"),i=t.getUTCHours().toString().padStart(2,"0"),c=t.getUTCMinutes().toString().padStart(2,"0"),a=t.getUTCSeconds().toString().padStart(2,"0");return`${n}-${r}-${o} ${i}:${c}:${a}`}let Vt=0;const X=new WeakMap;function I(t){if(X.has(t))return X.get(t);const e=Vt++;return X.set(t,e),e}function M(t,e,n){if(t==null)return null;if(e==null||t.length<=e)return t;const r=n?.appendEllipsis?"…":"",o=r.length+(n?.appendTruncatedLength?String(t.length).length+2:0),i=Math.max(0,e-o),c=n?.appendTruncatedLength?`(${t.length-i})`:"";return i<=0?c+r:n?.fromStart?c+r+t.slice(t.length-i):t.slice(0,i)+r+c}function nt(t,e){try{return t[e]}catch(n){return"Error: "+(n instanceof Error?n.message:String(n))}}function k(t,e,n,r){const{pretty:o,filter:i,maxDepth:c,maxItems:a,maxStringLength:U,showObjectId:O,showArrayIndex:C,customToString:A}=e??{};if(n==null&&(n=[]),r==null&&(r=new Set),A){const u=A(t,n,s=>k(s,e,n,r));if(u!=null)return M(u,U)}const T=n.length;if(typeof t=="string")return t=M(t,U),r.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??""}#${I(t)}[${t.byteLength}]`;if(t instanceof RegExp)return M(String(t),U);if(t instanceof Date)return pt(t);if(t instanceof Object){if(r.has(t)||c!=null&&T>=c)return`${t.constructor===Object?"":t.constructor?.name??""}#${I(t)}`;r.add(t)}if(t instanceof Error)return M(t.stack||t.message||String(t),U);if(Array.isArray(t)){const u=o?" ".repeat(T):"";let s="";O&&(s+=`#${I(t)} `),s+="[";let l=0,g=!1;for(let d=0;d<t.length;d++){if(a!=null&&l>=a){g=!0;break}const y=[...n,String(d)],w=nt(t,d);if(i!=null&&!i(y,w))continue;const R=k(w,e,y,r);l>0&&(s+=","),o&&(s+=`
|
|
2
|
+
`),o&&(s+=`${u} `),C&&(s+=`${d}: `),s+=`${R}`,l++}return g?(l>0&&(s+=","),o?(s+=`
|
|
3
|
+
`,s+=`${u} ...
|
|
4
|
+
`):s+="...",s+=u,s+="]"):(l>0&&o&&(s+=`
|
|
5
|
+
${u}`),s+="]"),s}if(t instanceof Map){let u="";return O&&(u+=`#${I(t)} `),u+="Map",u+=k(Array.from(t.entries()),e,n,r),u}if(t instanceof Set){let u="";return O&&(u+=`#${I(t)} `),u+="Set",u+=k(Array.from(t.values()),e,n,r),u}{const u=t.constructor===Object?"":t.constructor?.name??"",s=o?" ".repeat(T):"";let l=u?`${u} `:"";O&&(l+=`#${I(t)} `),l+="{";let g=0,d=!1;for(const y in t){if(a!=null&&g>=a){d=!0;break}const w=[...n,y],R=nt(t,y);if(i!=null&&!i(w,R))continue;const h=k(R,e,w,r);g>0&&(l+=","),o&&(l+=`
|
|
6
|
+
`),o&&(l+=`${s} `),l+=`${y}: ${h}`,g++}return d&&(g>0&&(l+=","),o?(l+=`
|
|
7
|
+
`,l+=`${s} ...
|
|
8
|
+
`):l+="...",l+=s),g>0&&o&&!d&&(l+=`
|
|
9
|
+
${s}`),l+="}",l}}function zt(t,e){t=tt(t,"UTC",e);const n=t.getUTCFullYear().toString().padStart(4,"0"),r=(t.getUTCMonth()+1).toString().padStart(2,"0"),o=t.getUTCDate().toString().padStart(2,"0"),i=t.getUTCHours().toString().padStart(2,"0"),c=t.getUTCMinutes().toString().padStart(2,"0"),a=t.getUTCSeconds().toString().padStart(2,"0");return`${n}-${r}-${o}_${i}-${c}-${a}`}function Gt(t){return t==null?null:t.replace(/[&<>"']/g,e=>{switch(e){case"&":return"&";case"<":return"<";case">":return"&rt;";case'"':return""";default:return"'"}})}function Ht(t){return t==null?null:t?.replace(/[/\\^$*+?.()|[\]{}]/g,"\\$&")}function Q(t){if(t==null)return null;if(Array.isArray(t)){const e=t.length,n=[];for(let r=0;r<e;r++)n.push(Q(t[r]));return n}if(typeof t=="object"){if(t.constructor&&t.constructor!==Object)return t;const e={};for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=Q(t[n]));return e}return t}function P(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 n=t.length;if(n!==e.length)return!1;for(let r=0;r<n;r++)if(!P(t[r],e[r]))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 n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&!P(t[n],Object.prototype.hasOwnProperty.call(e,n)?e[n]:null))return!1;for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&!Object.prototype.hasOwnProperty.call(t,n)&&!P(e[n],null))return!1;return!0}return!1}function Wt(t,e){if(t==null||e==null)return t==null==(e==null);if(t.size!==e.size)return!1;for(const[n,r]of t)if(!P(r,e.get(n)))return!1;return!0}function Jt(t,e){const n=t.length;if(n!==e.length)return!1;for(let r=0;r<n;r++)if(t[r]!==e[r])return!1;return!0}function Z(t){return!t||typeof t!="object"?t:Array.isArray(t)?t.map(Z):t&&Object.keys(t).sort().reduce((e,n)=>{const r=Z(t[n]);return r!=null&&(e[n]=r),e},{})}function bt(t,e){return Object.defineProperty(t,"name",{value:e,configurable:!0}),t}function Xt(t){const e=alert;return window.alert=n=>t(e,n),()=>{window.alert=e}}var et=(t=>(t.log="log",t.warn="warn",t.error="error",t.info="info",t.debug="debug",t.trace="trace",t.assert="assert",t))(et||{});const rt=Object.values(et);function E(t){return function(){t.apply(console,arguments)}}const ot={log:E(console.log),warn:E(console.warn),error:E(console.error),info:E(console.info),debug:E(console.debug),trace:E(console.trace),assert:E(console.assert)};function gt(t){return rt.forEach(e=>{console[e]=(...n)=>{t(ot,e,n)}}),()=>{rt.forEach(e=>{console[e]=ot[e]})}}function Yt(t){return function(n){const r=gt(t);try{const o=n();return K.isPromiseLike(o)?o.then(i=>(r(),i),i=>{throw r(),i}):o}finally{r()}}}function yt(){let t=new Error().stack;if(t!=null){const e=t.indexOf(`
|
|
10
|
+
`);e!=null&&e>=0&&(t=t.substring(e+1))}return t??""}function Qt(t){return function(...e){const n=yt();try{return t.apply(this,e)}catch(r){throw r instanceof Error||(r=new Error(String(r))),r.stack=r.stack?r.stack+`
|
|
11
|
+
`+n:n,r}}}function wt(t){if(!t||t.timeout==null)return null;const e=new z.AbortControllerFast,n=t.timeController??Ut.timeControllerDefault;if(t.timeout){const r=n.setTimeout(()=>{e.abort(new z.AbortError(`[timeoutAbortController] Timeout error: ${t.timeout}ms`))},t.timeout);e.signal.subscribe(()=>{clearTimeout(r)})}return t.abortSignal?.subscribe(r=>{e.abort(r)}),e}async function Zt(t,e){const n=wt(e);try{return await t(n?.signal??e?.abortSignal??null)}finally{n?.abort()}}class Kt{_options;_hasValue=!1;_promiseOrValue=null;constructor(e){this._options=e}run(){if(!this._hasValue){let e=this._options.func();const n=o=>(this._options.persist?this._promiseOrValue=o:(this._promiseOrValue=null,this._hasValue=!1),o),r=o=>{throw this._options.persist||(this._promiseOrValue=null,this._hasValue=!1),o};if(K.isPromiseLike(e))e=e.then(n,r);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 vt{_options;_promiseOrValues=new Map;constructor(e){this._options=e}run(e){if(this._promiseOrValues.has(e))return this._promiseOrValues.get(e);let n=this._options.func(e);const r=i=>(this._options.persist?this._promiseOrValues.set(e,i):this._promiseOrValues.delete(e),i),o=i=>{throw this._options.persist||this._promiseOrValues.delete(e),i};if(K.isPromiseLike(n))n=n.then(r,o);else if(!this._options.persist)return n;return this._promiseOrValues.set(e,n),n}set(e,n){if(!this._options.persist)throw new Error("[LazyWithId][set] Cannot set value when persist is false");this._promiseOrValues.set(e,n)}}function it(t){return t.replace(/\W/g,"").toLowerCase()}function St(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 _t(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 Ot(t){if(t==null)return null;t=t.trim();const e=parseInt(t,10);return isNaN(e)?null:e}function Tt(t){if(t==null)return null;t=t.trim();const e=parseFloat(t);return isNaN(e)?null:e}function H(t,e){const n=St(e),r=it(t);for(const[o,i]of n.entries())if(it(o)===r)return i;return null}function jt(t,e){return _t(H(t,e))}function te(t,e){return Ot(H(t,e))}function ee(t,e){return Tt(H(t,e))}exports.ConsoleMessageLevel=et;exports.Lazy=Kt;exports.LazyWithId=vt;exports.Random=G;exports.UNIQUE_PSEUDO_RANDOM_MAX_COUNT=V;exports.alertReplace=Xt;exports.consoleReplace=gt;exports.convertTimeZone=tt;exports.createUniquePseudoRandom=Ft;exports.dateNowUnique=qt;exports.deepCloneJsonLike=Q;exports.deepEqualJsonLike=P;exports.deepEqualJsonLikeMap=Wt;exports.equalArray=Jt;exports.escapeHtml=Gt;exports.escapeRegExp=Ht;exports.fixStackTrace=Qt;exports.formatAny=k;exports.formatDate=pt;exports.formatDateFileName=zt;exports.getDateInet=Bt;exports.getNormalizedObject=Z;exports.getRandomFunc=ht;exports.getRandomSeed=Nt;exports.getStackTrace=yt;exports.max=ft;exports.min=ct;exports.minMax=Rt;exports.numberMod=It;exports.randomBoolean=Mt;exports.randomEnum=Dt;exports.randomFloat=v;exports.randomIndexWeighted=Pt;exports.randomInt=mt;exports.randomItem=j;exports.randomItems=Lt;exports.setFuncName=bt;exports.sha256=Ct;exports.sha256Buffer=at;exports.timeoutAbortController=wt;exports.toHex=st;exports.truncateString=M;exports.urlGetBoolean=jt;exports.urlGetFloat=ee;exports.urlGetInt=te;exports.urlGetParams=St;exports.urlGetString=H;exports.urlParamToBoolean=_t;exports.urlParamToFloat=Tt;exports.urlParamToInt=Ot;exports.withConsoleReplace=Yt;exports.withTimeout=Zt;
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { AbortControllerFast as et, toAbortSignal as ft, AbortError as ct } from "@flemist/abort-controller-fast";
|
|
2
2
|
import { isPromiseLike as X } from "@flemist/async-utils";
|
|
3
3
|
import { timeControllerDefault as ht } from "@flemist/time-controller";
|
|
4
|
-
let
|
|
4
|
+
let L = null;
|
|
5
5
|
function mt() {
|
|
6
|
-
if (!
|
|
7
|
-
|
|
6
|
+
if (!L) {
|
|
7
|
+
L = new Array(256);
|
|
8
8
|
for (let t = 0; t < 256; t++)
|
|
9
|
-
|
|
9
|
+
L[t] = t.toString(16).padStart(2, "0");
|
|
10
10
|
}
|
|
11
|
-
return
|
|
11
|
+
return L;
|
|
12
12
|
}
|
|
13
13
|
function pt(t) {
|
|
14
|
-
const e = mt(),
|
|
15
|
-
let
|
|
16
|
-
for (let o = 0, s =
|
|
17
|
-
|
|
18
|
-
return
|
|
19
|
-
}
|
|
20
|
-
let J = null,
|
|
21
|
-
function
|
|
14
|
+
const e = mt(), n = new Uint8Array(t.buffer, t.byteOffset, t.byteLength);
|
|
15
|
+
let r = "";
|
|
16
|
+
for (let o = 0, s = n.length; o < s; o++)
|
|
17
|
+
r += e[n[o]];
|
|
18
|
+
return r;
|
|
19
|
+
}
|
|
20
|
+
let J = null, nt = null, B = null, rt = null;
|
|
21
|
+
function gt() {
|
|
22
22
|
J || (J = new Uint32Array([
|
|
23
23
|
1116352408,
|
|
24
24
|
1899447441,
|
|
@@ -84,19 +84,19 @@ function dt() {
|
|
|
84
84
|
2756734187,
|
|
85
85
|
3204031479,
|
|
86
86
|
3329325298
|
|
87
|
-
]),
|
|
87
|
+
]), nt = new Uint32Array(64), rt = new TextEncoder(), B = new Uint8Array(65536));
|
|
88
88
|
}
|
|
89
|
-
function
|
|
89
|
+
function dt(t) {
|
|
90
90
|
if (t == null)
|
|
91
91
|
return null;
|
|
92
|
-
|
|
93
|
-
const e = J,
|
|
92
|
+
gt();
|
|
93
|
+
const e = J, n = nt, r = rt;
|
|
94
94
|
let o = B, s;
|
|
95
95
|
if (typeof t == "string") {
|
|
96
|
-
const
|
|
97
|
-
o.length <
|
|
98
|
-
const
|
|
99
|
-
s = o.subarray(0,
|
|
96
|
+
const h = t.length * 3;
|
|
97
|
+
o.length < h + 128 && (o = B = new Uint8Array(h + 128));
|
|
98
|
+
const c = r.encodeInto(t, o);
|
|
99
|
+
s = o.subarray(0, c.written);
|
|
100
100
|
} else if (t instanceof Uint8Array)
|
|
101
101
|
s = t;
|
|
102
102
|
else if (ArrayBuffer.isView(t))
|
|
@@ -109,57 +109,57 @@ function yt(t) {
|
|
|
109
109
|
throw new Error(
|
|
110
110
|
`[sha256Buffer] Unsupported content type: ${typeof t}`
|
|
111
111
|
);
|
|
112
|
-
const
|
|
113
|
-
o.length < a && (o = B = new Uint8Array(a)), s !== o && o.set(s), o[
|
|
114
|
-
for (let
|
|
115
|
-
o[
|
|
116
|
-
const
|
|
112
|
+
const f = s.length, a = f + 72 >>> 6 << 6;
|
|
113
|
+
o.length < a && (o = B = new Uint8Array(a)), s !== o && o.set(s), o[f] = 128;
|
|
114
|
+
for (let h = f + 1; h < a; h++)
|
|
115
|
+
o[h] = 0;
|
|
116
|
+
const T = f * 8, O = T / 4294967296 | 0, C = T | 0;
|
|
117
117
|
o[a - 8] = O >>> 24, o[a - 7] = O >>> 16, o[a - 6] = O >>> 8, o[a - 5] = O, o[a - 4] = C >>> 24, o[a - 3] = C >>> 16, o[a - 2] = C >>> 8, o[a - 1] = C;
|
|
118
|
-
let
|
|
119
|
-
for (let
|
|
120
|
-
for (let
|
|
121
|
-
const
|
|
122
|
-
|
|
118
|
+
let U = 1779033703, $ = -1150833019, u = 1013904242, i = -1521486534, l = 1359893119, d = -1694144372, p = 528734635, y = 1541459225;
|
|
119
|
+
for (let h = 0; h < a; h += 64) {
|
|
120
|
+
for (let m = 0; m < 16; m++) {
|
|
121
|
+
const g = h + (m << 2);
|
|
122
|
+
n[m] = o[g] << 24 | o[g + 1] << 16 | o[g + 2] << 8 | o[g + 3];
|
|
123
123
|
}
|
|
124
|
-
for (let
|
|
125
|
-
const
|
|
126
|
-
|
|
124
|
+
for (let m = 16; m < 64; m++) {
|
|
125
|
+
const g = n[m - 15], A = n[m - 2], H = (g >>> 7 | g << 25) ^ (g >>> 18 | g << 14) ^ g >>> 3, D = (A >>> 17 | A << 15) ^ (A >>> 19 | A << 13) ^ A >>> 10;
|
|
126
|
+
n[m] = n[m - 16] + H + n[m - 7] + D | 0;
|
|
127
127
|
}
|
|
128
|
-
let
|
|
129
|
-
for (let
|
|
130
|
-
for (let
|
|
131
|
-
const A =
|
|
132
|
-
q =
|
|
128
|
+
let c = U, S = $, N = u, F = i, _ = l, P = d, x = p, q = y;
|
|
129
|
+
for (let m = 0; m < 64; m += 4)
|
|
130
|
+
for (let g = 0; g < 4; g++) {
|
|
131
|
+
const A = m + g, H = (_ >>> 6 | _ << 26) ^ (_ >>> 11 | _ << 21) ^ (_ >>> 25 | _ << 7), D = q + H + (x ^ _ & (P ^ x)) + e[A] + n[A] | 0, at = ((c >>> 2 | c << 30) ^ (c >>> 13 | c << 19) ^ (c >>> 22 | c << 10)) + (c & S ^ N & (c ^ S)) | 0;
|
|
132
|
+
q = x, x = P, P = _, _ = F + D | 0, F = N, N = S, S = c, c = D + at | 0;
|
|
133
133
|
}
|
|
134
|
-
|
|
134
|
+
U = U + c | 0, $ = $ + S | 0, u = u + N | 0, i = i + F | 0, l = l + _ | 0, d = d + P | 0, p = p + x | 0, y = y + q | 0;
|
|
135
135
|
}
|
|
136
|
-
const
|
|
137
|
-
for (let
|
|
138
|
-
const
|
|
139
|
-
|
|
136
|
+
const w = new Uint8Array(32), R = [U, $, u, i, l, d, p, y];
|
|
137
|
+
for (let h = 0; h < 8; h++) {
|
|
138
|
+
const c = R[h], S = h << 2;
|
|
139
|
+
w[S] = c >>> 24, w[S + 1] = c >>> 16 & 255, w[S + 2] = c >>> 8 & 255, w[S + 3] = c & 255;
|
|
140
140
|
}
|
|
141
|
-
return
|
|
141
|
+
return w;
|
|
142
142
|
}
|
|
143
|
-
function
|
|
144
|
-
const e =
|
|
143
|
+
function Lt(t) {
|
|
144
|
+
const e = dt(t);
|
|
145
145
|
return e ? pt(e) : null;
|
|
146
146
|
}
|
|
147
|
-
function
|
|
147
|
+
function yt(t, e) {
|
|
148
148
|
return t == null ? e : e == null ? t : Math.min(t, e);
|
|
149
149
|
}
|
|
150
|
-
function
|
|
150
|
+
function wt(t, e) {
|
|
151
151
|
return t == null ? e : e == null ? t : Math.max(t, e);
|
|
152
152
|
}
|
|
153
|
-
function
|
|
154
|
-
return
|
|
153
|
+
function Vt(t, e, n) {
|
|
154
|
+
return wt(yt(t, e), n);
|
|
155
155
|
}
|
|
156
156
|
function Bt(t, e) {
|
|
157
157
|
return (t % e + e) % e;
|
|
158
158
|
}
|
|
159
159
|
function St(t) {
|
|
160
160
|
return function() {
|
|
161
|
-
let
|
|
162
|
-
return
|
|
161
|
+
let n = t += 1831565813;
|
|
162
|
+
return n = Math.imul(n ^ n >>> 15, n | 1), n ^= n + Math.imul(n ^ n >>> 7, n | 61), (n ^ n >>> 14) / 4294967296 + 0.5;
|
|
163
163
|
};
|
|
164
164
|
}
|
|
165
165
|
function _t() {
|
|
@@ -193,54 +193,54 @@ class Y {
|
|
|
193
193
|
return new Y(this._seed);
|
|
194
194
|
}
|
|
195
195
|
}
|
|
196
|
-
function ot(t, e,
|
|
197
|
-
if (
|
|
196
|
+
function ot(t, e, n) {
|
|
197
|
+
if (n == null && (n = e, e = 0), n <= e)
|
|
198
198
|
throw new Error(
|
|
199
|
-
`[random][randomFloat] toExclusive (${
|
|
199
|
+
`[random][randomFloat] toExclusive (${n}) must be greater than from (${e})`
|
|
200
200
|
);
|
|
201
|
-
return t.next() * (
|
|
201
|
+
return t.next() * (n - e) + e;
|
|
202
202
|
}
|
|
203
|
-
function $t(t, e,
|
|
204
|
-
return Math.floor(ot(t, e,
|
|
203
|
+
function $t(t, e, n) {
|
|
204
|
+
return Math.floor(ot(t, e, n));
|
|
205
205
|
}
|
|
206
206
|
function Ft(t, e) {
|
|
207
207
|
return t.next() < (e ?? 0.5);
|
|
208
208
|
}
|
|
209
|
-
function qt(t, e,
|
|
209
|
+
function qt(t, e, n) {
|
|
210
210
|
if (Array.isArray(e)) {
|
|
211
211
|
const s = e;
|
|
212
|
-
e = s.length,
|
|
212
|
+
e = s.length, n = (f) => s[f];
|
|
213
213
|
}
|
|
214
|
-
if (!
|
|
214
|
+
if (!n)
|
|
215
215
|
throw new Error("[random][randomIndexWeighted] getWeight is required");
|
|
216
|
-
let
|
|
216
|
+
let r = 0;
|
|
217
217
|
for (let s = 0; s < e; s++)
|
|
218
|
-
|
|
219
|
-
if (
|
|
218
|
+
r += n(s);
|
|
219
|
+
if (r === 0)
|
|
220
220
|
return -1;
|
|
221
|
-
let o = ot(t,
|
|
221
|
+
let o = ot(t, r);
|
|
222
222
|
for (let s = 0; s < e; s++)
|
|
223
|
-
if (o -=
|
|
223
|
+
if (o -= n(s), o < 0)
|
|
224
224
|
return s;
|
|
225
225
|
return e - 1;
|
|
226
226
|
}
|
|
227
227
|
function st(t, e) {
|
|
228
228
|
if (e.length === 0)
|
|
229
229
|
throw new Error("[random][randomItem] items is empty");
|
|
230
|
-
const
|
|
231
|
-
return e[
|
|
230
|
+
const n = $t(t, e.length);
|
|
231
|
+
return e[n];
|
|
232
232
|
}
|
|
233
|
-
function Ht(t, e,
|
|
233
|
+
function Ht(t, e, n) {
|
|
234
234
|
if (e.length === 0)
|
|
235
235
|
throw new Error("[random][randomItems] items is empty");
|
|
236
|
-
const
|
|
237
|
-
for (let o = 0; o <
|
|
238
|
-
|
|
239
|
-
return
|
|
236
|
+
const r = [];
|
|
237
|
+
for (let o = 0; o < n; o++)
|
|
238
|
+
r.push(st(t, e));
|
|
239
|
+
return r;
|
|
240
240
|
}
|
|
241
|
-
function Wt(t, e,
|
|
242
|
-
let
|
|
243
|
-
return
|
|
241
|
+
function Wt(t, e, n) {
|
|
242
|
+
let r = Object.values(e);
|
|
243
|
+
return n && (r = r.filter(n)), st(t, r);
|
|
244
244
|
}
|
|
245
245
|
const it = 1073741789, W = (it >> 2) - 1;
|
|
246
246
|
function Gt(t = W, e) {
|
|
@@ -254,30 +254,30 @@ function Gt(t = W, e) {
|
|
|
254
254
|
throw new Error(
|
|
255
255
|
`[random][PseudoRandom] startFrom(${e}) must be < count(${t})`
|
|
256
256
|
);
|
|
257
|
-
let
|
|
257
|
+
let n = e;
|
|
258
258
|
return function() {
|
|
259
|
-
return
|
|
259
|
+
return n = (n + it) % t, n;
|
|
260
260
|
};
|
|
261
261
|
}
|
|
262
|
-
let
|
|
262
|
+
let k = null;
|
|
263
263
|
function Jt() {
|
|
264
264
|
const t = Date.now();
|
|
265
|
-
return
|
|
265
|
+
return k == null || t > k ? (k = t, t) : (k++, k);
|
|
266
266
|
}
|
|
267
267
|
async function Yt({
|
|
268
268
|
url: t,
|
|
269
269
|
timeout: e
|
|
270
270
|
} = {}) {
|
|
271
271
|
t || (t = typeof window < "u" ? "/" : "https://google.com");
|
|
272
|
-
let
|
|
272
|
+
let n;
|
|
273
273
|
try {
|
|
274
|
-
const
|
|
275
|
-
|
|
276
|
-
|
|
274
|
+
const r = new et();
|
|
275
|
+
n = e ? setTimeout(() => {
|
|
276
|
+
r.abort();
|
|
277
277
|
}, e) : null;
|
|
278
278
|
const o = await fetch(t, {
|
|
279
279
|
method: "HEAD",
|
|
280
|
-
signal: ft(
|
|
280
|
+
signal: ft(r.signal)
|
|
281
281
|
}), s = o.headers.get("date");
|
|
282
282
|
if (!s)
|
|
283
283
|
throw new Error(
|
|
@@ -285,144 +285,149 @@ async function Yt({
|
|
|
285
285
|
);
|
|
286
286
|
return new Date(s).getTime();
|
|
287
287
|
} finally {
|
|
288
|
-
|
|
288
|
+
n && clearTimeout(n);
|
|
289
289
|
}
|
|
290
290
|
}
|
|
291
|
-
function ut(t, e,
|
|
292
|
-
const
|
|
291
|
+
function ut(t, e, n) {
|
|
292
|
+
const r = e == null ? t : new Date(
|
|
293
293
|
t.toLocaleString("en-US", {
|
|
294
294
|
timeZone: e
|
|
295
295
|
})
|
|
296
|
-
), o =
|
|
296
|
+
), o = n == null ? t : new Date(
|
|
297
297
|
t.toLocaleString("en-US", {
|
|
298
|
-
timeZone:
|
|
298
|
+
timeZone: n
|
|
299
299
|
})
|
|
300
300
|
);
|
|
301
301
|
return new Date(
|
|
302
|
-
t.getTime() + o.getTime() -
|
|
302
|
+
t.getTime() + o.getTime() - r.getTime()
|
|
303
303
|
);
|
|
304
304
|
}
|
|
305
305
|
function At(t, e) {
|
|
306
306
|
t = ut(t, "UTC", e);
|
|
307
|
-
const
|
|
308
|
-
return `${
|
|
307
|
+
const n = t.getUTCFullYear().toString().padStart(4, "0"), r = (t.getUTCMonth() + 1).toString().padStart(2, "0"), o = t.getUTCDate().toString().padStart(2, "0"), s = t.getUTCHours().toString().padStart(2, "0"), f = t.getUTCMinutes().toString().padStart(2, "0"), a = t.getUTCSeconds().toString().padStart(2, "0");
|
|
308
|
+
return `${n}-${r}-${o} ${s}:${f}:${a}`;
|
|
309
309
|
}
|
|
310
|
-
let
|
|
310
|
+
let Tt = 0;
|
|
311
311
|
const G = /* @__PURE__ */ new WeakMap();
|
|
312
312
|
function I(t) {
|
|
313
313
|
if (G.has(t))
|
|
314
314
|
return G.get(t);
|
|
315
|
-
const e =
|
|
315
|
+
const e = Tt++;
|
|
316
316
|
return G.set(t, e), e;
|
|
317
317
|
}
|
|
318
|
-
function
|
|
319
|
-
|
|
318
|
+
function V(t, e, n) {
|
|
319
|
+
if (t == null)
|
|
320
|
+
return null;
|
|
321
|
+
if (e == null || t.length <= e)
|
|
322
|
+
return t;
|
|
323
|
+
const r = n?.appendEllipsis ? "…" : "", o = r.length + (n?.appendTruncatedLength ? String(t.length).length + 2 : 0), s = Math.max(0, e - o), f = n?.appendTruncatedLength ? `(${t.length - s})` : "";
|
|
324
|
+
return s <= 0 ? f + r : n?.fromStart ? f + r + t.slice(t.length - s) : t.slice(0, s) + r + f;
|
|
320
325
|
}
|
|
321
326
|
function K(t, e) {
|
|
322
327
|
try {
|
|
323
328
|
return t[e];
|
|
324
|
-
} catch (
|
|
325
|
-
return "Error: " + (
|
|
329
|
+
} catch (n) {
|
|
330
|
+
return "Error: " + (n instanceof Error ? n.message : String(n));
|
|
326
331
|
}
|
|
327
332
|
}
|
|
328
|
-
function
|
|
333
|
+
function M(t, e, n, r) {
|
|
329
334
|
const {
|
|
330
335
|
pretty: o,
|
|
331
336
|
filter: s,
|
|
332
|
-
maxDepth:
|
|
337
|
+
maxDepth: f,
|
|
333
338
|
maxItems: a,
|
|
334
|
-
maxStringLength:
|
|
339
|
+
maxStringLength: T,
|
|
335
340
|
showObjectId: O,
|
|
336
341
|
showArrayIndex: C,
|
|
337
|
-
customToString:
|
|
342
|
+
customToString: U
|
|
338
343
|
} = e ?? {};
|
|
339
|
-
if (
|
|
340
|
-
const u =
|
|
344
|
+
if (n == null && (n = []), r == null && (r = /* @__PURE__ */ new Set()), U) {
|
|
345
|
+
const u = U(
|
|
341
346
|
t,
|
|
342
|
-
|
|
343
|
-
(i) =>
|
|
347
|
+
n,
|
|
348
|
+
(i) => M(i, e, n, r)
|
|
344
349
|
);
|
|
345
350
|
if (u != null)
|
|
346
|
-
return
|
|
351
|
+
return V(u, T);
|
|
347
352
|
}
|
|
348
|
-
const $ =
|
|
353
|
+
const $ = n.length;
|
|
349
354
|
if (typeof t == "string")
|
|
350
|
-
return t =
|
|
355
|
+
return t = V(t, T), r.size > 0 && (t = JSON.stringify(t)), t;
|
|
351
356
|
if (t == null || typeof t != "object")
|
|
352
357
|
return String(t);
|
|
353
358
|
if (t instanceof ArrayBuffer || ArrayBuffer.isView(t))
|
|
354
359
|
return `${t.constructor?.name ?? ""}#${I(t)}[${t.byteLength}]`;
|
|
355
360
|
if (t instanceof RegExp)
|
|
356
|
-
return
|
|
361
|
+
return V(String(t), T);
|
|
357
362
|
if (t instanceof Date)
|
|
358
363
|
return At(t);
|
|
359
364
|
if (t instanceof Object) {
|
|
360
|
-
if (
|
|
365
|
+
if (r.has(t) || f != null && $ >= f)
|
|
361
366
|
return `${t.constructor === Object ? "" : t.constructor?.name ?? ""}#${I(t)}`;
|
|
362
|
-
|
|
367
|
+
r.add(t);
|
|
363
368
|
}
|
|
364
369
|
if (t instanceof Error)
|
|
365
|
-
return
|
|
370
|
+
return V(
|
|
366
371
|
t.stack || t.message || String(t),
|
|
367
|
-
|
|
372
|
+
T
|
|
368
373
|
);
|
|
369
374
|
if (Array.isArray(t)) {
|
|
370
375
|
const u = o ? " ".repeat($) : "";
|
|
371
376
|
let i = "";
|
|
372
377
|
O && (i += `#${I(t)} `), i += "[";
|
|
373
|
-
let l = 0,
|
|
378
|
+
let l = 0, d = !1;
|
|
374
379
|
for (let p = 0; p < t.length; p++) {
|
|
375
380
|
if (a != null && l >= a) {
|
|
376
|
-
|
|
381
|
+
d = !0;
|
|
377
382
|
break;
|
|
378
383
|
}
|
|
379
|
-
const
|
|
380
|
-
if (s != null && !s(
|
|
384
|
+
const y = [...n, String(p)], w = K(t, p);
|
|
385
|
+
if (s != null && !s(y, w))
|
|
381
386
|
continue;
|
|
382
|
-
const R =
|
|
387
|
+
const R = M(w, e, y, r);
|
|
383
388
|
l > 0 && (i += ","), o && (i += `
|
|
384
389
|
`), o && (i += `${u} `), C && (i += `${p}: `), i += `${R}`, l++;
|
|
385
390
|
}
|
|
386
|
-
return
|
|
391
|
+
return d ? (l > 0 && (i += ","), o ? (i += `
|
|
387
392
|
`, i += `${u} ...
|
|
388
393
|
`) : i += "...", i += u, i += "]") : (l > 0 && o && (i += `
|
|
389
394
|
${u}`), i += "]"), i;
|
|
390
395
|
}
|
|
391
396
|
if (t instanceof Map) {
|
|
392
397
|
let u = "";
|
|
393
|
-
return O && (u += `#${I(t)} `), u += "Map", u +=
|
|
398
|
+
return O && (u += `#${I(t)} `), u += "Map", u += M(Array.from(t.entries()), e, n, r), u;
|
|
394
399
|
}
|
|
395
400
|
if (t instanceof Set) {
|
|
396
401
|
let u = "";
|
|
397
|
-
return O && (u += `#${I(t)} `), u += "Set", u +=
|
|
402
|
+
return O && (u += `#${I(t)} `), u += "Set", u += M(Array.from(t.values()), e, n, r), u;
|
|
398
403
|
}
|
|
399
404
|
{
|
|
400
405
|
const u = t.constructor === Object ? "" : t.constructor?.name ?? "", i = o ? " ".repeat($) : "";
|
|
401
406
|
let l = u ? `${u} ` : "";
|
|
402
407
|
O && (l += `#${I(t)} `), l += "{";
|
|
403
|
-
let
|
|
404
|
-
for (const
|
|
405
|
-
if (a != null &&
|
|
408
|
+
let d = 0, p = !1;
|
|
409
|
+
for (const y in t) {
|
|
410
|
+
if (a != null && d >= a) {
|
|
406
411
|
p = !0;
|
|
407
412
|
break;
|
|
408
413
|
}
|
|
409
|
-
const
|
|
410
|
-
if (s != null && !s(
|
|
414
|
+
const w = [...n, y], R = K(t, y);
|
|
415
|
+
if (s != null && !s(w, R))
|
|
411
416
|
continue;
|
|
412
|
-
const
|
|
413
|
-
|
|
414
|
-
`), o && (l += `${i} `), l += `${
|
|
417
|
+
const h = M(R, e, w, r);
|
|
418
|
+
d > 0 && (l += ","), o && (l += `
|
|
419
|
+
`), o && (l += `${i} `), l += `${y}: ${h}`, d++;
|
|
415
420
|
}
|
|
416
|
-
return p && (
|
|
421
|
+
return p && (d > 0 && (l += ","), o ? (l += `
|
|
417
422
|
`, l += `${i} ...
|
|
418
|
-
`) : l += "...", l += i),
|
|
423
|
+
`) : l += "...", l += i), d > 0 && o && !p && (l += `
|
|
419
424
|
${i}`), l += "}", l;
|
|
420
425
|
}
|
|
421
426
|
}
|
|
422
427
|
function Xt(t, e) {
|
|
423
428
|
t = ut(t, "UTC", e);
|
|
424
|
-
const
|
|
425
|
-
return `${
|
|
429
|
+
const n = t.getUTCFullYear().toString().padStart(4, "0"), r = (t.getUTCMonth() + 1).toString().padStart(2, "0"), o = t.getUTCDate().toString().padStart(2, "0"), s = t.getUTCHours().toString().padStart(2, "0"), f = t.getUTCMinutes().toString().padStart(2, "0"), a = t.getUTCSeconds().toString().padStart(2, "0");
|
|
430
|
+
return `${n}-${r}-${o}_${s}-${f}-${a}`;
|
|
426
431
|
}
|
|
427
432
|
function bt(t) {
|
|
428
433
|
return t == null ? null : t.replace(/[&<>"']/g, (e) => {
|
|
@@ -447,17 +452,17 @@ function Q(t) {
|
|
|
447
452
|
if (t == null)
|
|
448
453
|
return null;
|
|
449
454
|
if (Array.isArray(t)) {
|
|
450
|
-
const e = t.length,
|
|
451
|
-
for (let
|
|
452
|
-
|
|
453
|
-
return
|
|
455
|
+
const e = t.length, n = [];
|
|
456
|
+
for (let r = 0; r < e; r++)
|
|
457
|
+
n.push(Q(t[r]));
|
|
458
|
+
return n;
|
|
454
459
|
}
|
|
455
460
|
if (typeof t == "object") {
|
|
456
461
|
if (t.constructor && t.constructor !== Object)
|
|
457
462
|
return t;
|
|
458
463
|
const e = {};
|
|
459
|
-
for (const
|
|
460
|
-
Object.prototype.hasOwnProperty.call(t,
|
|
464
|
+
for (const n in t)
|
|
465
|
+
Object.prototype.hasOwnProperty.call(t, n) && (e[n] = Q(t[n]));
|
|
461
466
|
return e;
|
|
462
467
|
}
|
|
463
468
|
return t;
|
|
@@ -472,25 +477,25 @@ function z(t, e) {
|
|
|
472
477
|
if (Array.isArray(t)) {
|
|
473
478
|
if (!Array.isArray(e))
|
|
474
479
|
return !1;
|
|
475
|
-
const
|
|
476
|
-
if (
|
|
480
|
+
const n = t.length;
|
|
481
|
+
if (n !== e.length)
|
|
477
482
|
return !1;
|
|
478
|
-
for (let
|
|
479
|
-
if (!z(t[
|
|
483
|
+
for (let r = 0; r < n; r++)
|
|
484
|
+
if (!z(t[r], e[r]))
|
|
480
485
|
return !1;
|
|
481
486
|
return !0;
|
|
482
487
|
}
|
|
483
488
|
if (typeof t == "object") {
|
|
484
489
|
if (typeof e != "object" || t.constructor && t.constructor !== Object || e.constructor && e.constructor !== Object)
|
|
485
490
|
return !1;
|
|
486
|
-
for (const
|
|
487
|
-
if (Object.prototype.hasOwnProperty.call(t,
|
|
488
|
-
t[
|
|
489
|
-
Object.prototype.hasOwnProperty.call(e,
|
|
491
|
+
for (const n in t)
|
|
492
|
+
if (Object.prototype.hasOwnProperty.call(t, n) && !z(
|
|
493
|
+
t[n],
|
|
494
|
+
Object.prototype.hasOwnProperty.call(e, n) ? e[n] : null
|
|
490
495
|
))
|
|
491
496
|
return !1;
|
|
492
|
-
for (const
|
|
493
|
-
if (Object.prototype.hasOwnProperty.call(e,
|
|
497
|
+
for (const n in e)
|
|
498
|
+
if (Object.prototype.hasOwnProperty.call(e, n) && !Object.prototype.hasOwnProperty.call(t, n) && !z(e[n], null))
|
|
494
499
|
return !1;
|
|
495
500
|
return !0;
|
|
496
501
|
}
|
|
@@ -501,24 +506,24 @@ function Qt(t, e) {
|
|
|
501
506
|
return t == null == (e == null);
|
|
502
507
|
if (t.size !== e.size)
|
|
503
508
|
return !1;
|
|
504
|
-
for (const [
|
|
505
|
-
if (!z(
|
|
509
|
+
for (const [n, r] of t)
|
|
510
|
+
if (!z(r, e.get(n)))
|
|
506
511
|
return !1;
|
|
507
512
|
return !0;
|
|
508
513
|
}
|
|
509
514
|
function Zt(t, e) {
|
|
510
|
-
const
|
|
511
|
-
if (
|
|
515
|
+
const n = t.length;
|
|
516
|
+
if (n !== e.length)
|
|
512
517
|
return !1;
|
|
513
|
-
for (let
|
|
514
|
-
if (t[
|
|
518
|
+
for (let r = 0; r < n; r++)
|
|
519
|
+
if (t[r] !== e[r])
|
|
515
520
|
return !1;
|
|
516
521
|
return !0;
|
|
517
522
|
}
|
|
518
523
|
function Z(t) {
|
|
519
|
-
return !t || typeof t != "object" ? t : Array.isArray(t) ? t.map(Z) : t && Object.keys(t).sort().reduce((e,
|
|
520
|
-
const
|
|
521
|
-
return
|
|
524
|
+
return !t || typeof t != "object" ? t : Array.isArray(t) ? t.map(Z) : t && Object.keys(t).sort().reduce((e, n) => {
|
|
525
|
+
const r = Z(t[n]);
|
|
526
|
+
return r != null && (e[n] = r), e;
|
|
522
527
|
}, {});
|
|
523
528
|
}
|
|
524
529
|
function vt(t, e) {
|
|
@@ -526,7 +531,7 @@ function vt(t, e) {
|
|
|
526
531
|
}
|
|
527
532
|
function jt(t) {
|
|
528
533
|
const e = alert;
|
|
529
|
-
return window.alert = (
|
|
534
|
+
return window.alert = (n) => t(e, n), () => {
|
|
530
535
|
window.alert = e;
|
|
531
536
|
};
|
|
532
537
|
}
|
|
@@ -546,10 +551,10 @@ const j = {
|
|
|
546
551
|
trace: E(console.trace),
|
|
547
552
|
assert: E(console.assert)
|
|
548
553
|
};
|
|
549
|
-
function
|
|
554
|
+
function Ut(t) {
|
|
550
555
|
return v.forEach((e) => {
|
|
551
|
-
console[e] = (...
|
|
552
|
-
t(j, e,
|
|
556
|
+
console[e] = (...n) => {
|
|
557
|
+
t(j, e, n);
|
|
553
558
|
};
|
|
554
559
|
}), () => {
|
|
555
560
|
v.forEach((e) => {
|
|
@@ -558,18 +563,18 @@ function Tt(t) {
|
|
|
558
563
|
};
|
|
559
564
|
}
|
|
560
565
|
function te(t) {
|
|
561
|
-
return function(
|
|
562
|
-
const
|
|
566
|
+
return function(n) {
|
|
567
|
+
const r = Ut(t);
|
|
563
568
|
try {
|
|
564
|
-
const o =
|
|
569
|
+
const o = n();
|
|
565
570
|
return X(o) ? o.then(
|
|
566
|
-
(s) => (
|
|
571
|
+
(s) => (r(), s),
|
|
567
572
|
(s) => {
|
|
568
|
-
throw
|
|
573
|
+
throw r(), s;
|
|
569
574
|
}
|
|
570
575
|
) : o;
|
|
571
576
|
} finally {
|
|
572
|
-
|
|
577
|
+
r();
|
|
573
578
|
}
|
|
574
579
|
};
|
|
575
580
|
}
|
|
@@ -584,21 +589,21 @@ function Et() {
|
|
|
584
589
|
}
|
|
585
590
|
function ee(t) {
|
|
586
591
|
return function(...e) {
|
|
587
|
-
const
|
|
592
|
+
const n = Et();
|
|
588
593
|
try {
|
|
589
594
|
return t.apply(this, e);
|
|
590
|
-
} catch (
|
|
591
|
-
throw
|
|
592
|
-
` +
|
|
595
|
+
} catch (r) {
|
|
596
|
+
throw r instanceof Error || (r = new Error(String(r))), r.stack = r.stack ? r.stack + `
|
|
597
|
+
` + n : n, r;
|
|
593
598
|
}
|
|
594
599
|
};
|
|
595
600
|
}
|
|
596
601
|
function Ct(t) {
|
|
597
602
|
if (!t || t.timeout == null)
|
|
598
603
|
return null;
|
|
599
|
-
const e = new et(),
|
|
604
|
+
const e = new et(), n = t.timeController ?? ht;
|
|
600
605
|
if (t.timeout) {
|
|
601
|
-
const
|
|
606
|
+
const r = n.setTimeout(() => {
|
|
602
607
|
e.abort(
|
|
603
608
|
new ct(
|
|
604
609
|
`[timeoutAbortController] Timeout error: ${t.timeout}ms`
|
|
@@ -606,22 +611,22 @@ function Ct(t) {
|
|
|
606
611
|
);
|
|
607
612
|
}, t.timeout);
|
|
608
613
|
e.signal.subscribe(() => {
|
|
609
|
-
clearTimeout(
|
|
614
|
+
clearTimeout(r);
|
|
610
615
|
});
|
|
611
616
|
}
|
|
612
|
-
return t.abortSignal?.subscribe((
|
|
613
|
-
e.abort(
|
|
617
|
+
return t.abortSignal?.subscribe((r) => {
|
|
618
|
+
e.abort(r);
|
|
614
619
|
}), e;
|
|
615
620
|
}
|
|
616
|
-
async function
|
|
617
|
-
const
|
|
621
|
+
async function ne(t, e) {
|
|
622
|
+
const n = Ct(e);
|
|
618
623
|
try {
|
|
619
|
-
return await t(
|
|
624
|
+
return await t(n?.signal ?? e?.abortSignal ?? null);
|
|
620
625
|
} finally {
|
|
621
|
-
|
|
626
|
+
n?.abort();
|
|
622
627
|
}
|
|
623
628
|
}
|
|
624
|
-
class
|
|
629
|
+
class re {
|
|
625
630
|
_options;
|
|
626
631
|
_hasValue = !1;
|
|
627
632
|
_promiseOrValue = null;
|
|
@@ -631,11 +636,11 @@ class ne {
|
|
|
631
636
|
run() {
|
|
632
637
|
if (!this._hasValue) {
|
|
633
638
|
let e = this._options.func();
|
|
634
|
-
const
|
|
639
|
+
const n = (o) => (this._options.persist ? this._promiseOrValue = o : (this._promiseOrValue = null, this._hasValue = !1), o), r = (o) => {
|
|
635
640
|
throw this._options.persist || (this._promiseOrValue = null, this._hasValue = !1), o;
|
|
636
641
|
};
|
|
637
642
|
if (X(e))
|
|
638
|
-
e = e.then(
|
|
643
|
+
e = e.then(n, r);
|
|
639
644
|
else if (!this._options.persist)
|
|
640
645
|
return e;
|
|
641
646
|
this._promiseOrValue = e, this._hasValue = !0;
|
|
@@ -657,22 +662,22 @@ class oe {
|
|
|
657
662
|
run(e) {
|
|
658
663
|
if (this._promiseOrValues.has(e))
|
|
659
664
|
return this._promiseOrValues.get(e);
|
|
660
|
-
let
|
|
661
|
-
const
|
|
665
|
+
let n = this._options.func(e);
|
|
666
|
+
const r = (s) => (this._options.persist ? this._promiseOrValues.set(e, s) : this._promiseOrValues.delete(e), s), o = (s) => {
|
|
662
667
|
throw this._options.persist || this._promiseOrValues.delete(e), s;
|
|
663
668
|
};
|
|
664
|
-
if (X(
|
|
665
|
-
|
|
669
|
+
if (X(n))
|
|
670
|
+
n = n.then(r, o);
|
|
666
671
|
else if (!this._options.persist)
|
|
667
|
-
return
|
|
668
|
-
return this._promiseOrValues.set(e,
|
|
672
|
+
return n;
|
|
673
|
+
return this._promiseOrValues.set(e, n), n;
|
|
669
674
|
}
|
|
670
|
-
set(e,
|
|
675
|
+
set(e, n) {
|
|
671
676
|
if (!this._options.persist)
|
|
672
677
|
throw new Error(
|
|
673
678
|
"[LazyWithId][set] Cannot set value when persist is false"
|
|
674
679
|
);
|
|
675
|
-
this._promiseOrValues.set(e,
|
|
680
|
+
this._promiseOrValues.set(e, n);
|
|
676
681
|
}
|
|
677
682
|
}
|
|
678
683
|
function tt(t) {
|
|
@@ -684,14 +689,14 @@ function Rt(t) {
|
|
|
684
689
|
function It(t) {
|
|
685
690
|
return t == null ? null : (t = t.toLowerCase().trim(), t === "true" || t === "1" || t === "yes" ? !0 : t === "false" || t === "0" || t === "no" ? !1 : null);
|
|
686
691
|
}
|
|
687
|
-
function
|
|
692
|
+
function xt(t) {
|
|
688
693
|
if (t == null)
|
|
689
694
|
return null;
|
|
690
695
|
t = t.trim();
|
|
691
696
|
const e = parseInt(t, 10);
|
|
692
697
|
return isNaN(e) ? null : e;
|
|
693
698
|
}
|
|
694
|
-
function
|
|
699
|
+
function kt(t) {
|
|
695
700
|
if (t == null)
|
|
696
701
|
return null;
|
|
697
702
|
t = t.trim();
|
|
@@ -699,9 +704,9 @@ function Nt(t) {
|
|
|
699
704
|
return isNaN(e) ? null : e;
|
|
700
705
|
}
|
|
701
706
|
function b(t, e) {
|
|
702
|
-
const
|
|
703
|
-
for (const [o, s] of
|
|
704
|
-
if (tt(o) ===
|
|
707
|
+
const n = Rt(e), r = tt(t);
|
|
708
|
+
for (const [o, s] of n.entries())
|
|
709
|
+
if (tt(o) === r)
|
|
705
710
|
return s;
|
|
706
711
|
return null;
|
|
707
712
|
}
|
|
@@ -709,10 +714,10 @@ function se(t, e) {
|
|
|
709
714
|
return It(b(t, e));
|
|
710
715
|
}
|
|
711
716
|
function ie(t, e) {
|
|
712
|
-
return
|
|
717
|
+
return xt(b(t, e));
|
|
713
718
|
}
|
|
714
719
|
function ue(t, e) {
|
|
715
|
-
return
|
|
720
|
+
return kt(b(t, e));
|
|
716
721
|
}
|
|
717
722
|
export {
|
|
718
723
|
Q as A,
|
|
@@ -723,27 +728,27 @@ export {
|
|
|
723
728
|
vt as F,
|
|
724
729
|
jt as G,
|
|
725
730
|
lt as H,
|
|
726
|
-
|
|
731
|
+
Ut as I,
|
|
727
732
|
te as J,
|
|
728
733
|
ee as K,
|
|
729
734
|
Et as L,
|
|
730
735
|
Ct as M,
|
|
731
|
-
|
|
732
|
-
|
|
736
|
+
ne as N,
|
|
737
|
+
re as O,
|
|
733
738
|
oe as P,
|
|
734
739
|
Rt as Q,
|
|
735
740
|
Y as R,
|
|
736
741
|
It as S,
|
|
737
|
-
|
|
742
|
+
xt as T,
|
|
738
743
|
W as U,
|
|
739
|
-
|
|
744
|
+
kt as V,
|
|
740
745
|
b as W,
|
|
741
746
|
se as X,
|
|
742
747
|
ie as Y,
|
|
743
748
|
ue as Z,
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
749
|
+
Lt as a,
|
|
750
|
+
wt as b,
|
|
751
|
+
Vt as c,
|
|
747
752
|
Ot as d,
|
|
748
753
|
$t as e,
|
|
749
754
|
Ft as f,
|
|
@@ -753,18 +758,18 @@ export {
|
|
|
753
758
|
Ht as j,
|
|
754
759
|
Wt as k,
|
|
755
760
|
Gt as l,
|
|
756
|
-
|
|
761
|
+
yt as m,
|
|
757
762
|
Bt as n,
|
|
758
763
|
Jt as o,
|
|
759
764
|
Yt as p,
|
|
760
765
|
ut as q,
|
|
761
766
|
ot as r,
|
|
762
|
-
|
|
767
|
+
dt as s,
|
|
763
768
|
pt as t,
|
|
764
|
-
|
|
769
|
+
M as u,
|
|
765
770
|
At as v,
|
|
766
771
|
Xt as w,
|
|
767
|
-
|
|
772
|
+
V as x,
|
|
768
773
|
bt as y,
|
|
769
774
|
Kt as z
|
|
770
775
|
};
|
package/package.json
CHANGED
package/build/urlGet-Be7wEmXE.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";const z=require("@flemist/abort-controller-fast"),K=require("@flemist/async-utils"),At=require("@flemist/time-controller");let q=null;function Tt(){if(!q){q=new Array(256);for(let t=0;t<256;t++)q[t]=t.toString(16).padStart(2,"0")}return q}function st(t){const e=Tt(),r=new Uint8Array(t.buffer,t.byteOffset,t.byteLength);let n="";for(let o=0,i=r.length;o<i;o++)n+=e[r[o]];return n}let Y=null,ut=null,B=null,lt=null;function Et(){Y||(Y=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]),ut=new Uint32Array(64),lt=new TextEncoder,B=new Uint8Array(65536))}function at(t){if(t==null)return null;Et();const e=Y,r=ut,n=lt;let o=B,i;if(typeof t=="string"){const f=t.length*3;o.length<f+128&&(o=B=new Uint8Array(f+128));const c=n.encodeInto(t,o);i=o.subarray(0,c.written)}else if(t instanceof Uint8Array)i=t;else if(ArrayBuffer.isView(t))i=new Uint8Array(t.buffer,t.byteOffset,t.byteLength);else throw new Error(`[sha256Buffer] Unsupported content type: ${typeof t}`);const m=i.length,a=m+72>>>6<<6;o.length<a&&(o=B=new Uint8Array(a)),i!==o&&o.set(i),o[m]=128;for(let f=m+1;f<a;f++)o[f]=0;const A=m*8,O=A/4294967296|0,C=A|0;o[a-8]=O>>>24,o[a-7]=O>>>16,o[a-6]=O>>>8,o[a-5]=O,o[a-4]=C>>>24,o[a-3]=C>>>16,o[a-2]=C>>>8,o[a-1]=C;let T=1779033703,U=-1150833019,u=1013904242,s=-1521486534,l=1359893119,g=-1694144372,d=528734635,y=1541459225;for(let f=0;f<a;f+=64){for(let h=0;h<16;h++){const p=f+(h<<2);r[h]=o[p]<<24|o[p+1]<<16|o[p+2]<<8|o[p+3]}for(let h=16;h<64;h++){const p=r[h-15],$=r[h-2],b=(p>>>7|p<<25)^(p>>>18|p<<14)^p>>>3,F=($>>>17|$<<15)^($>>>19|$<<13)^$>>>10;r[h]=r[h-16]+b+r[h-7]+F|0}let c=T,S=U,D=u,W=s,_=l,L=g,N=d,J=y;for(let h=0;h<64;h+=4)for(let p=0;p<4;p++){const $=h+p,b=(_>>>6|_<<26)^(_>>>11|_<<21)^(_>>>25|_<<7),F=J+b+(N^_&(L^N))+e[$]+r[$]|0,$t=((c>>>2|c<<30)^(c>>>13|c<<19)^(c>>>22|c<<10))+(c&S^D&(c^S))|0;J=N,N=L,L=_,_=W+F|0,W=D,D=S,S=c,c=F+$t|0}T=T+c|0,U=U+S|0,u=u+D|0,s=s+W|0,l=l+_|0,g=g+L|0,d=d+N|0,y=y+J|0}const w=new Uint8Array(32),R=[T,U,u,s,l,g,d,y];for(let f=0;f<8;f++){const c=R[f],S=f<<2;w[S]=c>>>24,w[S+1]=c>>>16&255,w[S+2]=c>>>8&255,w[S+3]=c&255}return w}function Ct(t){const e=at(t);return e?st(e):null}function ct(t,e){return t==null?e:e==null?t:Math.min(t,e)}function ft(t,e){return t==null?e:e==null?t:Math.max(t,e)}function Rt(t,e,r){return ft(ct(t,e),r)}function It(t,e){return(t%e+e)%e}function kt(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 Nt(){return Math.random()}function Pt(){return Math.random()*2**32>>>0}function ht(t){return t!=null?kt(t):Nt}class G{_seed;_rnd;constructor(e){this._seed=e,this._rnd=ht(e)}get seed(){return this._seed}nextSeed(){return this.next()*2**32>>>0}nextRandom(){return new G(this.nextSeed())}next(){return this._rnd()}clone(){return new G(this._seed)}}function v(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 mt(t,e,r){return Math.floor(v(t,e,r))}function Mt(t,e){return t.next()<(e??.5)}function xt(t,e,r){if(Array.isArray(e)){const i=e;e=i.length,r=m=>i[m]}if(!r)throw new Error("[random][randomIndexWeighted] getWeight is required");let n=0;for(let i=0;i<e;i++)n+=r(i);if(n===0)return-1;let o=v(t,n);for(let i=0;i<e;i++)if(o-=r(i),o<0)return i;return e-1}function j(t,e){if(e.length===0)throw new Error("[random][randomItem] items is empty");const r=mt(t,e.length);return e[r]}function Dt(t,e,r){if(e.length===0)throw new Error("[random][randomItems] items is empty");const n=[];for(let o=0;o<r;o++)n.push(j(t,e));return n}function Lt(t,e,r){let n=Object.values(e);return r&&(n=n.filter(r)),j(t,n)}const dt=1073741789,V=(dt>>2)-1;function Ft(t=V,e){if(t<=0)throw new Error(`[random][PseudoRandom] count(${t}) must be > 0`);if(t>V)throw new Error(`[random][PseudoRandom] count(${t}) must be <= ${V}`);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+dt)%t,r}}let P=null;function qt(){const t=Date.now();return P==null||t>P?(P=t,t):(P++,P)}async function Bt({url:t,timeout:e}={}){t||(t=typeof window<"u"?"/":"https://google.com");let r;try{const n=new z.AbortControllerFast;r=e?setTimeout(()=>{n.abort()},e):null;const o=await fetch(t,{method:"HEAD",signal:z.toAbortSignal(n.signal)}),i=o.headers.get("date");if(!i)throw new Error(`[Now][getDateInet] No date header in response: ${o.status} ${t}`);return new Date(i).getTime()}finally{r&&clearTimeout(r)}}function tt(t,e,r){const n=e==null?t:new Date(t.toLocaleString("en-US",{timeZone:e})),o=r==null?t:new Date(t.toLocaleString("en-US",{timeZone:r}));return new Date(t.getTime()+o.getTime()-n.getTime())}function pt(t,e){t=tt(t,"UTC",e);const r=t.getUTCFullYear().toString().padStart(4,"0"),n=(t.getUTCMonth()+1).toString().padStart(2,"0"),o=t.getUTCDate().toString().padStart(2,"0"),i=t.getUTCHours().toString().padStart(2,"0"),m=t.getUTCMinutes().toString().padStart(2,"0"),a=t.getUTCSeconds().toString().padStart(2,"0");return`${r}-${n}-${o} ${i}:${m}:${a}`}let Vt=0;const X=new WeakMap;function I(t){if(X.has(t))return X.get(t);const e=Vt++;return X.set(t,e),e}function M(t,e,r){return t==null?t??null:e==null?t:t.length>e?e<=0?"…":r?.fromStart?"…"+t.slice(t.length-e+1):t.slice(0,e-1)+"…":t}function rt(t,e){try{return t[e]}catch(r){return"Error: "+(r instanceof Error?r.message:String(r))}}function k(t,e,r,n){const{pretty:o,filter:i,maxDepth:m,maxItems:a,maxStringLength:A,showObjectId:O,showArrayIndex:C,customToString:T}=e??{};if(r==null&&(r=[]),n==null&&(n=new Set),T){const u=T(t,r,s=>k(s,e,r,n));if(u!=null)return M(u,A)}const U=r.length;if(typeof t=="string")return t=M(t,A),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??""}#${I(t)}[${t.byteLength}]`;if(t instanceof RegExp)return M(String(t),A);if(t instanceof Date)return pt(t);if(t instanceof Object){if(n.has(t)||m!=null&&U>=m)return`${t.constructor===Object?"":t.constructor?.name??""}#${I(t)}`;n.add(t)}if(t instanceof Error)return M(t.stack||t.message||String(t),A);if(Array.isArray(t)){const u=o?" ".repeat(U):"";let s="";O&&(s+=`#${I(t)} `),s+="[";let l=0,g=!1;for(let d=0;d<t.length;d++){if(a!=null&&l>=a){g=!0;break}const y=[...r,String(d)],w=rt(t,d);if(i!=null&&!i(y,w))continue;const R=k(w,e,y,n);l>0&&(s+=","),o&&(s+=`
|
|
2
|
-
`),o&&(s+=`${u} `),C&&(s+=`${d}: `),s+=`${R}`,l++}return g?(l>0&&(s+=","),o?(s+=`
|
|
3
|
-
`,s+=`${u} ...
|
|
4
|
-
`):s+="...",s+=u,s+="]"):(l>0&&o&&(s+=`
|
|
5
|
-
${u}`),s+="]"),s}if(t instanceof Map){let u="";return O&&(u+=`#${I(t)} `),u+="Map",u+=k(Array.from(t.entries()),e,r,n),u}if(t instanceof Set){let u="";return O&&(u+=`#${I(t)} `),u+="Set",u+=k(Array.from(t.values()),e,r,n),u}{const u=t.constructor===Object?"":t.constructor?.name??"",s=o?" ".repeat(U):"";let l=u?`${u} `:"";O&&(l+=`#${I(t)} `),l+="{";let g=0,d=!1;for(const y in t){if(a!=null&&g>=a){d=!0;break}const w=[...r,y],R=rt(t,y);if(i!=null&&!i(w,R))continue;const f=k(R,e,w,n);g>0&&(l+=","),o&&(l+=`
|
|
6
|
-
`),o&&(l+=`${s} `),l+=`${y}: ${f}`,g++}return d&&(g>0&&(l+=","),o?(l+=`
|
|
7
|
-
`,l+=`${s} ...
|
|
8
|
-
`):l+="...",l+=s),g>0&&o&&!d&&(l+=`
|
|
9
|
-
${s}`),l+="}",l}}function zt(t,e){t=tt(t,"UTC",e);const r=t.getUTCFullYear().toString().padStart(4,"0"),n=(t.getUTCMonth()+1).toString().padStart(2,"0"),o=t.getUTCDate().toString().padStart(2,"0"),i=t.getUTCHours().toString().padStart(2,"0"),m=t.getUTCMinutes().toString().padStart(2,"0"),a=t.getUTCSeconds().toString().padStart(2,"0");return`${r}-${n}-${o}_${i}-${m}-${a}`}function Gt(t){return t==null?null:t.replace(/[&<>"']/g,e=>{switch(e){case"&":return"&";case"<":return"<";case">":return"&rt;";case'"':return""";default:return"'"}})}function Ht(t){return t==null?null:t?.replace(/[/\\^$*+?.()|[\]{}]/g,"\\$&")}function Q(t){if(t==null)return null;if(Array.isArray(t)){const e=t.length,r=[];for(let n=0;n<e;n++)r.push(Q(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]=Q(t[r]));return e}return t}function x(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(!x(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)&&!x(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)&&!x(e[r],null))return!1;return!0}return!1}function Wt(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(!x(n,e.get(r)))return!1;return!0}function Jt(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 Z(t){return!t||typeof t!="object"?t:Array.isArray(t)?t.map(Z):t&&Object.keys(t).sort().reduce((e,r)=>{const n=Z(t[r]);return n!=null&&(e[r]=n),e},{})}function bt(t,e){return Object.defineProperty(t,"name",{value:e,configurable:!0}),t}function Xt(t){const e=alert;return window.alert=r=>t(e,r),()=>{window.alert=e}}var et=(t=>(t.log="log",t.warn="warn",t.error="error",t.info="info",t.debug="debug",t.trace="trace",t.assert="assert",t))(et||{});const nt=Object.values(et);function E(t){return function(){t.apply(console,arguments)}}const ot={log:E(console.log),warn:E(console.warn),error:E(console.error),info:E(console.info),debug:E(console.debug),trace:E(console.trace),assert:E(console.assert)};function gt(t){return nt.forEach(e=>{console[e]=(...r)=>{t(ot,e,r)}}),()=>{nt.forEach(e=>{console[e]=ot[e]})}}function Yt(t){return function(r){const n=gt(t);try{const o=r();return K.isPromiseLike(o)?o.then(i=>(n(),i),i=>{throw n(),i}):o}finally{n()}}}function yt(){let t=new Error().stack;if(t!=null){const e=t.indexOf(`
|
|
10
|
-
`);e!=null&&e>=0&&(t=t.substring(e+1))}return t??""}function Qt(t){return function(...e){const r=yt();try{return t.apply(this,e)}catch(n){throw n instanceof Error||(n=new Error(String(n))),n.stack=n.stack?n.stack+`
|
|
11
|
-
`+r:r,n}}}function wt(t){if(!t||t.timeout==null)return null;const e=new z.AbortControllerFast,r=t.timeController??At.timeControllerDefault;if(t.timeout){const n=r.setTimeout(()=>{e.abort(new z.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 Zt(t,e){const r=wt(e);try{return await t(r?.signal??e?.abortSignal??null)}finally{r?.abort()}}class Kt{_options;_hasValue=!1;_promiseOrValue=null;constructor(e){this._options=e}run(){if(!this._hasValue){let e=this._options.func();const r=o=>(this._options.persist?this._promiseOrValue=o:(this._promiseOrValue=null,this._hasValue=!1),o),n=o=>{throw this._options.persist||(this._promiseOrValue=null,this._hasValue=!1),o};if(K.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 vt{_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=i=>(this._options.persist?this._promiseOrValues.set(e,i):this._promiseOrValues.delete(e),i),o=i=>{throw this._options.persist||this._promiseOrValues.delete(e),i};if(K.isPromiseLike(r))r=r.then(n,o);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)}}function it(t){return t.replace(/\W/g,"").toLowerCase()}function St(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 _t(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 Ot(t){if(t==null)return null;t=t.trim();const e=parseInt(t,10);return isNaN(e)?null:e}function Ut(t){if(t==null)return null;t=t.trim();const e=parseFloat(t);return isNaN(e)?null:e}function H(t,e){const r=St(e),n=it(t);for(const[o,i]of r.entries())if(it(o)===n)return i;return null}function jt(t,e){return _t(H(t,e))}function te(t,e){return Ot(H(t,e))}function ee(t,e){return Ut(H(t,e))}exports.ConsoleMessageLevel=et;exports.Lazy=Kt;exports.LazyWithId=vt;exports.Random=G;exports.UNIQUE_PSEUDO_RANDOM_MAX_COUNT=V;exports.alertReplace=Xt;exports.consoleReplace=gt;exports.convertTimeZone=tt;exports.createUniquePseudoRandom=Ft;exports.dateNowUnique=qt;exports.deepCloneJsonLike=Q;exports.deepEqualJsonLike=x;exports.deepEqualJsonLikeMap=Wt;exports.equalArray=Jt;exports.escapeHtml=Gt;exports.escapeRegExp=Ht;exports.fixStackTrace=Qt;exports.formatAny=k;exports.formatDate=pt;exports.formatDateFileName=zt;exports.getDateInet=Bt;exports.getNormalizedObject=Z;exports.getRandomFunc=ht;exports.getRandomSeed=Pt;exports.getStackTrace=yt;exports.max=ft;exports.min=ct;exports.minMax=Rt;exports.numberMod=It;exports.randomBoolean=Mt;exports.randomEnum=Lt;exports.randomFloat=v;exports.randomIndexWeighted=xt;exports.randomInt=mt;exports.randomItem=j;exports.randomItems=Dt;exports.setFuncName=bt;exports.sha256=Ct;exports.sha256Buffer=at;exports.timeoutAbortController=wt;exports.toHex=st;exports.truncateString=M;exports.urlGetBoolean=jt;exports.urlGetFloat=ee;exports.urlGetInt=te;exports.urlGetParams=St;exports.urlGetString=H;exports.urlParamToBoolean=_t;exports.urlParamToFloat=Ut;exports.urlParamToInt=Ot;exports.withConsoleReplace=Yt;exports.withTimeout=Zt;
|