@flemist/simple-utils 1.0.1 → 1.0.3
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/node/index.cjs +1 -1
- package/build/node/index.mjs +1 -1
- package/build/{urlGet-DAHy2Rar.mjs → urlGet-CW30yZvt.mjs} +204 -216
- package/build/urlGet-Dr4stTPz.js +11 -0
- package/package.json +5 -5
- package/build/urlGet-CtceHOCG.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-Dr4stTPz.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.sha256=e.sha256;exports.sha256Buffer=e.sha256Buffer;exports.timeoutAbortController=e.timeoutAbortController;exports.toHex=e.toHex;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 { F as s, M as o, N as t, R as n, U as r, E as m, G as l, q as d, l as u, o as i, z as c, A as p, B as g, C as I, x as R, y as T, I as f, u as x, v as h, w as E, p as L, D as M, d as N, g as P, J as U, b as k, m as q, c as A, n as C, f as D, k as F, r as G, h as S, e as y, i as B, j as O, a as b, s as w, K as z, t as J, V as _, X as v, W as H, O as W, T as j, P as Q, S as X, Q as K, H as V, L as Z } from "../urlGet-
|
|
1
|
+
import { F as s, M as o, N as t, R as n, U as r, E as m, G as l, q as d, l as u, o as i, z as c, A as p, B as g, C as I, x as R, y as T, I as f, u as x, v as h, w as E, p as L, D as M, d as N, g as P, J as U, b as k, m as q, c as A, n as C, f as D, k as F, r as G, h as S, e as y, i as B, j as O, a as b, s as w, K as z, t as J, V as _, X as v, W as H, O as W, T as j, P as Q, S as X, Q as K, H as V, L as Z } from "../urlGet-CW30yZvt.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-Dr4stTPz.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.sha256=e.sha256;exports.sha256Buffer=e.sha256Buffer;exports.timeoutAbortController=e.timeoutAbortController;exports.toHex=e.toHex;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 { F as s, M as o, N as t, R as n, U as r, E as m, G as l, q as d, l as u, o as i, z as c, A as p, B as g, C as I, x as R, y as T, I as f, u as x, v as h, w as E, p as L, D as M, d as N, g as P, J as U, b as k, m as q, c as A, n as C, f as D, k as F, r as G, h as S, e as y, i as B, j as O, a as b, s as w, K as z, t as J, V as _, X as v, W as H, O as W, T as j, P as Q, S as X, Q as K, H as V, L as Z } from "../urlGet-
|
|
1
|
+
import { F as s, M as o, N as t, R as n, U as r, E as m, G as l, q as d, l as u, o as i, z as c, A as p, B as g, C as I, x as R, y as T, I as f, u as x, v as h, w as E, p as L, D as M, d as N, g as P, J as U, b as k, m as q, c as A, n as C, f as D, k as F, r as G, h as S, e as y, i as B, j as O, a as b, s as w, K as z, t as J, V as _, X as v, W as H, O as W, T as j, P as Q, S as X, Q as K, H as V, L as Z } from "../urlGet-CW30yZvt.mjs";
|
|
2
2
|
export {
|
|
3
3
|
s as ConsoleMessageLevel,
|
|
4
4
|
o as Lazy,
|
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-Dr4stTPz.js"),N=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),z=j(ee),g=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 N.Locker,I.set(n,a)),a}function re(e){const{filePath:n,func:a}=e;return ne(n).lock(()=>S.poolRunWait({pool:g,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,u=e.pool??g,p=e.handleError,d=e.priority??W.priorityCreate(0),c=e.walkLinks??!1,m=e.log,F=e.handlePath,C=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 N.useAbortController(async L=>{const E=N.combineAbortSignals(r,L),T={totalSize:0,maxFileDateModified:0,countFiles:0,countDirs:0,countLinks:0};function q(f,y){if(Y(y.totalSize)){const s=`${y.totalSize.toLocaleString("en-US").replace(/,/g," ").padStart(19)}: ${f}`;m?.handleLog?m.handleLog(s):console.log(s)}}async function G(f,y,k,s){return F?await S.poolRunWait({pool:u,func:async()=>{try{return await F({level:a,path:f,stat:y,itemStat:k,totalStat:T,abortSignal:E})}catch(l){return await R(l),!1}},count:1,priority:s,abortSignal:E}):!0}async function O(f,y,k,s){s||(s=f);const l=await S.poolRunWait({pool:u,func:()=>z.promises.lstat(f).catch(R),count:1,priority:W.priorityCreate(y,W.priorityCreate(1,d)),abortSignal:E});if(!l||!k&&l.isFile())return null;const U=H(f,l);if(i.has(U))return null;i.add(U);let o={totalSize:l.size,maxFileDateModified:l.isDirectory()?0:l.mtimeMs,countFiles:0,countDirs:0,countLinks:0};const M=W.priorityCreate(y,W.priorityCreate(l.isDirectory()?2:3,d));if(l.isSymbolicLink()){if(c){const h=await S.poolRunWait({pool:u,func:()=>z.promises.readlink(f).catch(R).then(D=>D??null),count:1,priority:M,abortSignal:E});if(h){const D=w.isAbsolute(h)?h:w.resolve(w.dirname(s),h),v=await O(D,y,k,s);v&&(o=v)}}return(k||o.countFiles+o.countDirs+o.countLinks>=1)&&(o.countLinks+=1,await G(s,l,o,M)&&(_(T,o),q(s,o))),o}else if(l.isDirectory()){const h=await S.poolRunWait({pool:u,func:()=>z.promises.readdir(f).catch(R),count:1,priority:d,abortSignal:E});if(h){for(let D=0,v=h.length;D<v;D++)h[D]=w.join(s,h[D]);o=await Q({...e,paths:h,abortSignal:E,priority:M,level:a+1,walkedIds:i})}}return(k||o.countFiles+o.countDirs+o.countLinks>=1)&&(l.isDirectory()?o.countDirs+=1:l.isFile()&&(o.countFiles+=1),await G(s,l,o,M)&&(_(T,o),q(s,o))),o}const A=[];for(let f=0,y=n.length;f<y;f++){const k=$(n[f]),s=C?C(k):!0;s!==!1&&A.push(O(k,f,s))}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 u=r.startsWith("^");u&&(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:u,negative:p,debugInfo:d,match:c})}),function(u){u=x(u);let p=null,d=!1;for(let c=0,m=i.length;c<m;c++){const F=i[c];F.match(u)&&(F.exclude?d=!F.negative:(p=!F.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 z.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 oe(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:g,count:1,func:async()=>{const u=w.resolve(n,r.value),p=await K(u),d=w.relative(n,w.dirname(u));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.sha256=t.sha256;exports.sha256Buffer=t.sha256Buffer;exports.timeoutAbortController=t.timeoutAbortController;exports.toHex=t.toHex;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=oe;exports.loadGlobsFromFile=K;exports.pathNormalize=x;exports.pathResolve=$;exports.poolFs=g;exports.walkPathHandleErrorDefault=J;exports.walkPaths=ae;
|
package/build/node/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { F as mt, M as ht, N as pt, R as kt, U as wt, E as yt, G as xt, q as Lt, l as Dt, o as Ft, z as St, A as Et, B as Wt, C as zt, x as vt, y as Mt, I as Tt, u as It, v as Rt, w as Ct, p as Nt, D as At, d as Gt, g as Ut, J 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 Pt, e as Qt, i as Xt, j as gt, a as Kt, s as Zt, K as Yt, t as Vt, V as bt, X as te, W as ee, O as ne, T as se, P as ae, S as re, Q as ie, H as oe, L as ce } from "../urlGet-
|
|
1
|
+
import { F as mt, M as ht, N as pt, R as kt, U as wt, E as yt, G as xt, q as Lt, l as Dt, o as Ft, z as St, A as Et, B as Wt, C as zt, x as vt, y as Mt, I as Tt, u as It, v as Rt, w as Ct, p as Nt, D as At, d as Gt, g as Ut, J 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 Pt, e as Qt, i as Xt, j as gt, a as Kt, s as Zt, K as Yt, t as Vt, V as bt, X as te, W as ee, O as ne, T as se, P as ae, S as re, Q as ie, H as oe, L as ce } from "../urlGet-CW30yZvt.mjs";
|
|
2
2
|
import { Locker as j, useAbortController as H, combineAbortSignals as J } from "@flemist/async-utils";
|
|
3
3
|
import { Pool as P, poolRunWait as F } from "@flemist/time-limits";
|
|
4
4
|
import Q from "node:os";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { AbortControllerFast as
|
|
2
|
-
import { isPromiseLike as
|
|
1
|
+
import { AbortControllerFast as tt, toAbortSignal as at, AbortError as ft } from "@flemist/abort-controller-fast";
|
|
2
|
+
import { isPromiseLike as b } from "@flemist/async-utils";
|
|
3
3
|
import { timeControllerDefault as ct } from "@flemist/time-controller";
|
|
4
4
|
let P = null;
|
|
5
|
-
function
|
|
5
|
+
function ht() {
|
|
6
6
|
if (!P) {
|
|
7
7
|
P = new Array(256);
|
|
8
8
|
for (let t = 0; t < 256; t++)
|
|
@@ -10,14 +10,14 @@ function ft() {
|
|
|
10
10
|
}
|
|
11
11
|
return P;
|
|
12
12
|
}
|
|
13
|
-
function
|
|
14
|
-
const e =
|
|
13
|
+
function mt(t) {
|
|
14
|
+
const e = ht(), r = new Uint8Array(t.buffer, t.byteOffset, t.byteLength);
|
|
15
15
|
let n = "";
|
|
16
16
|
for (let o = 0, s = r.length; o < s; o++)
|
|
17
17
|
n += e[r[o]];
|
|
18
18
|
return n;
|
|
19
19
|
}
|
|
20
|
-
let G = null,
|
|
20
|
+
let G = null, et = null, L = null, rt = null;
|
|
21
21
|
function pt() {
|
|
22
22
|
G || (G = new Uint32Array([
|
|
23
23
|
1116352408,
|
|
@@ -84,17 +84,17 @@ function pt() {
|
|
|
84
84
|
2756734187,
|
|
85
85
|
3204031479,
|
|
86
86
|
3329325298
|
|
87
|
-
]),
|
|
87
|
+
]), et = new Uint32Array(64), rt = new TextEncoder(), L = new Uint8Array(65536));
|
|
88
88
|
}
|
|
89
|
-
function
|
|
89
|
+
function dt(t) {
|
|
90
90
|
if (t == null)
|
|
91
91
|
return null;
|
|
92
92
|
pt();
|
|
93
|
-
const e = G, r =
|
|
93
|
+
const e = G, r = et, n = rt;
|
|
94
94
|
let o = L, s;
|
|
95
95
|
if (typeof t == "string") {
|
|
96
|
-
const
|
|
97
|
-
o.length <
|
|
96
|
+
const h = t.length * 3;
|
|
97
|
+
o.length < h + 128 && (o = L = new Uint8Array(h + 128));
|
|
98
98
|
const f = n.encodeInto(t, o);
|
|
99
99
|
s = o.subarray(0, f.written);
|
|
100
100
|
} else if (t instanceof Uint8Array)
|
|
@@ -109,73 +109,73 @@ function mt(t) {
|
|
|
109
109
|
throw new Error(
|
|
110
110
|
`[sha256Buffer] Unsupported content type: ${typeof t}`
|
|
111
111
|
);
|
|
112
|
-
const
|
|
113
|
-
o.length < a && (o = L = new Uint8Array(a)), s !== o && o.set(s), o[
|
|
114
|
-
for (let
|
|
115
|
-
o[
|
|
116
|
-
const
|
|
117
|
-
o[a - 8] =
|
|
118
|
-
let
|
|
119
|
-
for (let
|
|
120
|
-
for (let
|
|
121
|
-
const
|
|
122
|
-
r[
|
|
112
|
+
const m = s.length, a = m + 72 >>> 6 << 6;
|
|
113
|
+
o.length < a && (o = L = new Uint8Array(a)), s !== o && o.set(s), o[m] = 128;
|
|
114
|
+
for (let h = m + 1; h < a; h++)
|
|
115
|
+
o[h] = 0;
|
|
116
|
+
const U = m * 8, C = U / 4294967296 | 0, T = U | 0;
|
|
117
|
+
o[a - 8] = C >>> 24, o[a - 7] = C >>> 16, o[a - 6] = C >>> 8, o[a - 5] = C, o[a - 4] = T >>> 24, o[a - 3] = T >>> 16, o[a - 2] = T >>> 8, o[a - 1] = T;
|
|
118
|
+
let $ = 1779033703, u = -1150833019, i = 1013904242, l = -1521486534, y = 1359893119, p = -1694144372, w = 528734635, g = 1541459225;
|
|
119
|
+
for (let h = 0; h < a; h += 64) {
|
|
120
|
+
for (let c = 0; c < 16; c++) {
|
|
121
|
+
const d = h + (c << 2);
|
|
122
|
+
r[c] = o[d] << 24 | o[d + 1] << 16 | o[d + 2] << 8 | o[d + 3];
|
|
123
123
|
}
|
|
124
|
-
for (let
|
|
125
|
-
const
|
|
126
|
-
r[
|
|
124
|
+
for (let c = 16; c < 64; c++) {
|
|
125
|
+
const d = r[c - 15], A = r[c - 2], F = (d >>> 7 | d << 25) ^ (d >>> 18 | d << 14) ^ d >>> 3, D = (A >>> 17 | A << 15) ^ (A >>> 19 | A << 13) ^ A >>> 10;
|
|
126
|
+
r[c] = r[c - 16] + F + r[c - 7] + D | 0;
|
|
127
127
|
}
|
|
128
|
-
let f =
|
|
129
|
-
for (let
|
|
130
|
-
for (let
|
|
131
|
-
const
|
|
132
|
-
|
|
128
|
+
let f = $, _ = u, M = i, z = l, O = y, N = p, I = w, q = g;
|
|
129
|
+
for (let c = 0; c < 64; c += 4)
|
|
130
|
+
for (let d = 0; d < 4; d++) {
|
|
131
|
+
const A = c + d, F = (O >>> 6 | O << 26) ^ (O >>> 11 | O << 21) ^ (O >>> 25 | O << 7), D = q + F + (I ^ O & (N ^ I)) + e[A] + r[A] | 0, lt = ((f >>> 2 | f << 30) ^ (f >>> 13 | f << 19) ^ (f >>> 22 | f << 10)) + (f & _ ^ M & (f ^ _)) | 0;
|
|
132
|
+
q = I, I = N, N = O, O = z + D | 0, z = M, M = _, _ = f, f = D + lt | 0;
|
|
133
133
|
}
|
|
134
|
-
|
|
134
|
+
$ = $ + f | 0, u = u + _ | 0, i = i + M | 0, l = l + z | 0, y = y + O | 0, p = p + N | 0, w = w + I | 0, g = g + q | 0;
|
|
135
135
|
}
|
|
136
|
-
const
|
|
137
|
-
for (let
|
|
138
|
-
const f =
|
|
139
|
-
|
|
136
|
+
const S = new Uint8Array(32), B = [$, u, i, l, y, p, w, g];
|
|
137
|
+
for (let h = 0; h < 8; h++) {
|
|
138
|
+
const f = B[h], _ = h << 2;
|
|
139
|
+
S[_] = f >>> 24, S[_ + 1] = f >>> 16 & 255, S[_ + 2] = f >>> 8 & 255, S[_ + 3] = f & 255;
|
|
140
140
|
}
|
|
141
|
-
return
|
|
141
|
+
return S;
|
|
142
142
|
}
|
|
143
143
|
function Pt(t) {
|
|
144
|
-
const e =
|
|
145
|
-
return e ?
|
|
144
|
+
const e = dt(t);
|
|
145
|
+
return e ? mt(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
150
|
function wt(t, e) {
|
|
151
151
|
return t == null ? e : e == null ? t : Math.max(t, e);
|
|
152
152
|
}
|
|
153
153
|
function Lt(t, e, r) {
|
|
154
|
-
return wt(
|
|
154
|
+
return wt(yt(t, e), r);
|
|
155
155
|
}
|
|
156
156
|
function Vt(t, e) {
|
|
157
157
|
return (t % e + e) % e;
|
|
158
158
|
}
|
|
159
|
-
function
|
|
159
|
+
function gt(t) {
|
|
160
160
|
return function() {
|
|
161
161
|
let r = t += 1831565813;
|
|
162
162
|
return r = Math.imul(r ^ r >>> 15, r | 1), r ^= r + Math.imul(r ^ r >>> 7, r | 61), (r ^ r >>> 14) / 4294967296 + 0.5;
|
|
163
163
|
};
|
|
164
164
|
}
|
|
165
|
-
function
|
|
165
|
+
function St() {
|
|
166
166
|
return Math.random();
|
|
167
167
|
}
|
|
168
|
-
function
|
|
168
|
+
function Bt() {
|
|
169
169
|
return Math.random() * 2 ** 32 >>> 0;
|
|
170
170
|
}
|
|
171
|
-
function
|
|
172
|
-
return t != null ?
|
|
171
|
+
function _t(t) {
|
|
172
|
+
return t != null ? gt(t) : St;
|
|
173
173
|
}
|
|
174
174
|
class J {
|
|
175
175
|
_seed;
|
|
176
176
|
_rnd;
|
|
177
177
|
constructor(e) {
|
|
178
|
-
this._seed = e, this._rnd =
|
|
178
|
+
this._seed = e, this._rnd = _t(e);
|
|
179
179
|
}
|
|
180
180
|
get seed() {
|
|
181
181
|
return this._seed;
|
|
@@ -193,23 +193,23 @@ class J {
|
|
|
193
193
|
return new J(this._seed);
|
|
194
194
|
}
|
|
195
195
|
}
|
|
196
|
-
function
|
|
196
|
+
function nt(t, e, r) {
|
|
197
197
|
if (r == null && (r = e, e = 0), r <= e)
|
|
198
198
|
throw new Error(
|
|
199
199
|
`[random][randomFloat] toExclusive (${r}) must be greater than from (${e})`
|
|
200
200
|
);
|
|
201
201
|
return t.next() * (r - e) + e;
|
|
202
202
|
}
|
|
203
|
-
function
|
|
204
|
-
return Math.floor(
|
|
203
|
+
function Ot(t, e, r) {
|
|
204
|
+
return Math.floor(nt(t, e, r));
|
|
205
205
|
}
|
|
206
|
-
function
|
|
206
|
+
function zt(t, e) {
|
|
207
207
|
return t.next() < (e ?? 0.5);
|
|
208
208
|
}
|
|
209
|
-
function
|
|
209
|
+
function qt(t, e, r) {
|
|
210
210
|
if (Array.isArray(e)) {
|
|
211
211
|
const s = e;
|
|
212
|
-
e = s.length, r = (
|
|
212
|
+
e = s.length, r = (m) => s[m];
|
|
213
213
|
}
|
|
214
214
|
if (!r)
|
|
215
215
|
throw new Error("[random][randomIndexWeighted] getWeight is required");
|
|
@@ -218,16 +218,16 @@ function zt(t, e, r) {
|
|
|
218
218
|
n += r(s);
|
|
219
219
|
if (n === 0)
|
|
220
220
|
return -1;
|
|
221
|
-
let o =
|
|
221
|
+
let o = nt(t, n);
|
|
222
222
|
for (let s = 0; s < e; s++)
|
|
223
223
|
if (o -= r(s), o < 0)
|
|
224
224
|
return s;
|
|
225
225
|
return e - 1;
|
|
226
226
|
}
|
|
227
|
-
function
|
|
227
|
+
function ot(t, e) {
|
|
228
228
|
if (e.length === 0)
|
|
229
229
|
throw new Error("[random][randomItem] items is empty");
|
|
230
|
-
const r =
|
|
230
|
+
const r = Ot(t, e.length);
|
|
231
231
|
return e[r];
|
|
232
232
|
}
|
|
233
233
|
function Ft(t, e, r) {
|
|
@@ -235,14 +235,14 @@ function Ft(t, e, r) {
|
|
|
235
235
|
throw new Error("[random][randomItems] items is empty");
|
|
236
236
|
const n = [];
|
|
237
237
|
for (let o = 0; o < r; o++)
|
|
238
|
-
n.push(
|
|
238
|
+
n.push(ot(t, e));
|
|
239
239
|
return n;
|
|
240
240
|
}
|
|
241
241
|
function Ht(t, e, r) {
|
|
242
242
|
let n = Object.values(e);
|
|
243
|
-
return r && (n = n.filter(r)),
|
|
243
|
+
return r && (n = n.filter(r)), ot(t, n);
|
|
244
244
|
}
|
|
245
|
-
const
|
|
245
|
+
const st = 1073741789, H = (st >> 2) - 1;
|
|
246
246
|
function Wt(t = H, e) {
|
|
247
247
|
if (t <= 0)
|
|
248
248
|
throw new Error(`[random][PseudoRandom] count(${t}) must be > 0`);
|
|
@@ -256,13 +256,13 @@ function Wt(t = H, e) {
|
|
|
256
256
|
);
|
|
257
257
|
let r = e;
|
|
258
258
|
return function() {
|
|
259
|
-
return r = (r +
|
|
259
|
+
return r = (r + st) % t, r;
|
|
260
260
|
};
|
|
261
261
|
}
|
|
262
|
-
let
|
|
262
|
+
let x = null;
|
|
263
263
|
function Gt() {
|
|
264
264
|
const t = Date.now();
|
|
265
|
-
return
|
|
265
|
+
return x == null || t > x ? (x = t, t) : (x++, x);
|
|
266
266
|
}
|
|
267
267
|
async function Jt({
|
|
268
268
|
url: t,
|
|
@@ -271,13 +271,13 @@ async function Jt({
|
|
|
271
271
|
t || (t = typeof window < "u" ? "/" : "https://google.com");
|
|
272
272
|
let r;
|
|
273
273
|
try {
|
|
274
|
-
const n = new
|
|
274
|
+
const n = new tt();
|
|
275
275
|
r = e ? setTimeout(() => {
|
|
276
276
|
n.abort();
|
|
277
277
|
}, e) : null;
|
|
278
278
|
const o = await fetch(t, {
|
|
279
279
|
method: "HEAD",
|
|
280
|
-
signal:
|
|
280
|
+
signal: at(n.signal)
|
|
281
281
|
}), s = o.headers.get("date");
|
|
282
282
|
if (!s)
|
|
283
283
|
throw new Error(
|
|
@@ -288,7 +288,7 @@ async function Jt({
|
|
|
288
288
|
r && clearTimeout(r);
|
|
289
289
|
}
|
|
290
290
|
}
|
|
291
|
-
function
|
|
291
|
+
function it(t, e, r) {
|
|
292
292
|
const n = e == null ? t : new Date(
|
|
293
293
|
t.toLocaleString("en-US", {
|
|
294
294
|
timeZone: e
|
|
@@ -302,120 +302,118 @@ function st(t, e, r) {
|
|
|
302
302
|
t.getTime() + o.getTime() - n.getTime()
|
|
303
303
|
);
|
|
304
304
|
}
|
|
305
|
-
function
|
|
306
|
-
t =
|
|
307
|
-
const r = t.getUTCFullYear().toString().padStart(4, "0"), n = (t.getUTCMonth() + 1).toString().padStart(2, "0"), o = t.getUTCDate().toString().padStart(2, "0"), s = t.getUTCHours().toString().padStart(2, "0"),
|
|
308
|
-
return `${r}-${n}-${o} ${s}:${
|
|
305
|
+
function $t(t, e) {
|
|
306
|
+
t = it(t, "UTC", e);
|
|
307
|
+
const r = t.getUTCFullYear().toString().padStart(4, "0"), n = (t.getUTCMonth() + 1).toString().padStart(2, "0"), o = t.getUTCDate().toString().padStart(2, "0"), s = t.getUTCHours().toString().padStart(2, "0"), m = t.getUTCMinutes().toString().padStart(2, "0"), a = t.getUTCSeconds().toString().padStart(2, "0");
|
|
308
|
+
return `${r}-${n}-${o} ${s}:${m}:${a}`;
|
|
309
309
|
}
|
|
310
|
-
let
|
|
310
|
+
let At = 0;
|
|
311
311
|
const W = /* @__PURE__ */ new WeakMap();
|
|
312
|
-
function
|
|
312
|
+
function R(t) {
|
|
313
313
|
if (W.has(t))
|
|
314
314
|
return W.get(t);
|
|
315
|
-
const e =
|
|
315
|
+
const e = At++;
|
|
316
316
|
return W.set(t, e), e;
|
|
317
317
|
}
|
|
318
|
-
function
|
|
318
|
+
function Y(t, e) {
|
|
319
319
|
try {
|
|
320
320
|
return t[e];
|
|
321
321
|
} catch (r) {
|
|
322
|
-
return "Error: " + (r
|
|
322
|
+
return "Error: " + (r instanceof Error ? r.message : String(r));
|
|
323
323
|
}
|
|
324
324
|
}
|
|
325
325
|
function k(t, e = {}, r = [], n = /* @__PURE__ */ new Set()) {
|
|
326
326
|
const {
|
|
327
327
|
pretty: o,
|
|
328
328
|
filter: s,
|
|
329
|
-
maxDepth:
|
|
329
|
+
maxDepth: m,
|
|
330
330
|
maxItems: a,
|
|
331
|
-
showObjectId:
|
|
332
|
-
showArrayIndex:
|
|
333
|
-
customToString:
|
|
331
|
+
showObjectId: U,
|
|
332
|
+
showArrayIndex: C,
|
|
333
|
+
customToString: T
|
|
334
334
|
} = e;
|
|
335
|
-
if (
|
|
336
|
-
const
|
|
337
|
-
if (
|
|
338
|
-
return
|
|
335
|
+
if (T) {
|
|
336
|
+
const u = T(t, (i) => k(i, e, r, n));
|
|
337
|
+
if (u != null)
|
|
338
|
+
return u;
|
|
339
339
|
}
|
|
340
|
-
const
|
|
340
|
+
const $ = r.length;
|
|
341
341
|
if (typeof t == "string")
|
|
342
342
|
return JSON.stringify(t);
|
|
343
343
|
if (t == null || typeof t != "object")
|
|
344
344
|
return String(t);
|
|
345
|
-
if (
|
|
346
|
-
return `${t.constructor
|
|
345
|
+
if (t instanceof ArrayBuffer || ArrayBuffer.isView(t))
|
|
346
|
+
return `${t.constructor?.name ?? ""}#${R(t)}[${t.byteLength}]`;
|
|
347
347
|
if (t instanceof RegExp)
|
|
348
348
|
return String(t);
|
|
349
|
+
if (t instanceof Date)
|
|
350
|
+
return $t(t);
|
|
351
|
+
if (t instanceof Object) {
|
|
352
|
+
if (n.has(t) || m != null && $ >= m)
|
|
353
|
+
return `${t.constructor === Object ? "" : t.constructor?.name ?? ""}#${R(t)}`;
|
|
354
|
+
n.add(t);
|
|
355
|
+
}
|
|
349
356
|
if (t instanceof Error)
|
|
350
357
|
return t.stack || t.message || String(t);
|
|
351
|
-
if (t instanceof Date)
|
|
352
|
-
return Ot(t);
|
|
353
358
|
if (Array.isArray(t)) {
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
let
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
const
|
|
364
|
-
if (s != null && !s(
|
|
359
|
+
const u = o ? " ".repeat($) : "";
|
|
360
|
+
let i = "";
|
|
361
|
+
U && (i += `#${R(t)} `), i += "[";
|
|
362
|
+
let l = 0, y = !1;
|
|
363
|
+
for (let p = 0; p < t.length; p++) {
|
|
364
|
+
if (a != null && l >= a) {
|
|
365
|
+
y = !0;
|
|
366
|
+
break;
|
|
367
|
+
}
|
|
368
|
+
const w = [...r, String(p)], g = Y(t, p);
|
|
369
|
+
if (s != null && !s(w, g))
|
|
365
370
|
continue;
|
|
366
|
-
const
|
|
367
|
-
|
|
368
|
-
`)
|
|
371
|
+
const S = k(g, e, w, n);
|
|
372
|
+
l > 0 && (i += ","), o && (i += `
|
|
373
|
+
`), o && (i += `${u} `), C && (i += `${p}: `), i += `${S}`, l++;
|
|
369
374
|
}
|
|
370
|
-
return l > 0 && o
|
|
371
|
-
|
|
372
|
-
` : "..."
|
|
375
|
+
return y ? (l > 0 && (i += ","), o ? (i += `
|
|
376
|
+
`, i += `${u} ...
|
|
377
|
+
`) : i += "...", i += u, i += "]") : (l > 0 && o && (i += `
|
|
378
|
+
${u}`), i += "]"), i;
|
|
373
379
|
}
|
|
374
380
|
if (t instanceof Map) {
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
let i = "";
|
|
378
|
-
return A && (i += `#${$(t)} `), i += "Map", i += k(Array.from(t.entries()), e, r, n), i;
|
|
381
|
+
let u = "";
|
|
382
|
+
return U && (u += `#${R(t)} `), u += "Map", u += k(Array.from(t.entries()), e, r, n), u;
|
|
379
383
|
}
|
|
380
384
|
if (t instanceof Set) {
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
let i = "";
|
|
384
|
-
return A && (i += `#${$(t)} `), i += "Set", i += k(Array.from(t.values()), e, r, n), i;
|
|
385
|
+
let u = "";
|
|
386
|
+
return U && (u += `#${R(t)} `), u += "Set", u += k(Array.from(t.values()), e, r, n), u;
|
|
385
387
|
}
|
|
386
388
|
{
|
|
387
|
-
const
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
let d = 0;
|
|
395
|
-
for (const g in t) {
|
|
396
|
-
if (d === 0 && o && (l += `
|
|
397
|
-
`), d >= m) {
|
|
398
|
-
d > 0 && (l += ","), l += o ? `${u} ...
|
|
399
|
-
` : "...";
|
|
389
|
+
const u = t.constructor === Object ? "" : t.constructor?.name ?? "", i = o ? " ".repeat($) : "";
|
|
390
|
+
let l = u ? `${u} ` : "";
|
|
391
|
+
U && (l += `#${R(t)} `), l += "{";
|
|
392
|
+
let y = 0, p = !1;
|
|
393
|
+
for (const w in t) {
|
|
394
|
+
if (a != null && y >= a) {
|
|
395
|
+
p = !0;
|
|
400
396
|
break;
|
|
401
397
|
}
|
|
402
|
-
const
|
|
403
|
-
if (s != null && !s(
|
|
398
|
+
const g = [...r, w], S = Y(t, w);
|
|
399
|
+
if (s != null && !s(g, S))
|
|
404
400
|
continue;
|
|
405
|
-
const
|
|
406
|
-
|
|
407
|
-
`)
|
|
401
|
+
const B = k(S, e, g, n);
|
|
402
|
+
y > 0 && (l += ","), o && (l += `
|
|
403
|
+
`), o && (l += `${i} `), l += `${w}: ${B}`, y++;
|
|
408
404
|
}
|
|
409
|
-
return
|
|
410
|
-
|
|
405
|
+
return p && (y > 0 && (l += ","), o ? (l += `
|
|
406
|
+
`, l += `${i} ...
|
|
407
|
+
`) : l += "...", l += i), y > 0 && o && !p && (l += `
|
|
408
|
+
${i}`), l += "}", l;
|
|
411
409
|
}
|
|
412
410
|
}
|
|
413
|
-
function
|
|
414
|
-
t =
|
|
415
|
-
const r = t.getUTCFullYear().toString().padStart(4, "0"), n = (t.getUTCMonth() + 1).toString().padStart(2, "0"), o = t.getUTCDate().toString().padStart(2, "0"), s = t.getUTCHours().toString().padStart(2, "0"),
|
|
416
|
-
return `${r}-${n}-${o}_${s}-${
|
|
411
|
+
function bt(t, e) {
|
|
412
|
+
t = it(t, "UTC", e);
|
|
413
|
+
const r = t.getUTCFullYear().toString().padStart(4, "0"), n = (t.getUTCMonth() + 1).toString().padStart(2, "0"), o = t.getUTCDate().toString().padStart(2, "0"), s = t.getUTCHours().toString().padStart(2, "0"), m = t.getUTCMinutes().toString().padStart(2, "0"), a = t.getUTCSeconds().toString().padStart(2, "0");
|
|
414
|
+
return `${r}-${n}-${o}_${s}-${m}-${a}`;
|
|
417
415
|
}
|
|
418
|
-
function
|
|
416
|
+
function Xt(t) {
|
|
419
417
|
return t == null ? null : t.replace(/[&<>"']/g, (e) => {
|
|
420
418
|
switch (e) {
|
|
421
419
|
case "&":
|
|
@@ -431,26 +429,24 @@ function Yt(t) {
|
|
|
431
429
|
}
|
|
432
430
|
});
|
|
433
431
|
}
|
|
434
|
-
function
|
|
432
|
+
function Yt(t) {
|
|
435
433
|
return t == null ? null : t?.replace(/[/\\^$*+?.()|[\]{}]/g, "\\$&");
|
|
436
434
|
}
|
|
437
|
-
function
|
|
435
|
+
function K(t) {
|
|
438
436
|
if (t == null)
|
|
439
437
|
return null;
|
|
440
438
|
if (Array.isArray(t)) {
|
|
441
439
|
const e = t.length, r = [];
|
|
442
440
|
for (let n = 0; n < e; n++)
|
|
443
|
-
r.push(
|
|
441
|
+
r.push(K(t[n]));
|
|
444
442
|
return r;
|
|
445
443
|
}
|
|
446
444
|
if (typeof t == "object") {
|
|
447
445
|
if (t.constructor && t.constructor !== Object)
|
|
448
|
-
|
|
449
|
-
`[deepCloneJsonLike] unexpected behavior: value.constructor (${t.constructor}) !== Object`
|
|
450
|
-
);
|
|
446
|
+
return t;
|
|
451
447
|
const e = {};
|
|
452
448
|
for (const r in t)
|
|
453
|
-
Object.prototype.hasOwnProperty.call(t, r) && (e[r] =
|
|
449
|
+
Object.prototype.hasOwnProperty.call(t, r) && (e[r] = K(t[r]));
|
|
454
450
|
return e;
|
|
455
451
|
}
|
|
456
452
|
return t;
|
|
@@ -474,16 +470,8 @@ function V(t, e) {
|
|
|
474
470
|
return !0;
|
|
475
471
|
}
|
|
476
472
|
if (typeof t == "object") {
|
|
477
|
-
if (typeof e != "object")
|
|
473
|
+
if (typeof e != "object" || t.constructor && t.constructor !== Object || e.constructor && e.constructor !== Object)
|
|
478
474
|
return !1;
|
|
479
|
-
if (t.constructor && t.constructor !== Object)
|
|
480
|
-
throw new Error(
|
|
481
|
-
`[deepEqual] unexpected behavior: a.constructor (${t.constructor}) !== Object`
|
|
482
|
-
);
|
|
483
|
-
if (e.constructor && e.constructor !== Object)
|
|
484
|
-
throw new Error(
|
|
485
|
-
`[deepEqual] unexpected behavior: b.constructor (${e.constructor}) !== Object`
|
|
486
|
-
);
|
|
487
475
|
for (const r in t)
|
|
488
476
|
if (Object.prototype.hasOwnProperty.call(t, r) && !V(
|
|
489
477
|
t[r],
|
|
@@ -516,9 +504,9 @@ function Qt(t, e) {
|
|
|
516
504
|
return !1;
|
|
517
505
|
return !0;
|
|
518
506
|
}
|
|
519
|
-
function
|
|
520
|
-
return !t || typeof t != "object" ? t : Array.isArray(t) ? t.map(
|
|
521
|
-
const n =
|
|
507
|
+
function Q(t) {
|
|
508
|
+
return !t || typeof t != "object" ? t : Array.isArray(t) ? t.map(Q) : t && Object.keys(t).sort().reduce((e, r) => {
|
|
509
|
+
const n = Q(t[r]);
|
|
522
510
|
return n != null && (e[r] = n), e;
|
|
523
511
|
}, {});
|
|
524
512
|
}
|
|
@@ -528,39 +516,39 @@ function Zt(t) {
|
|
|
528
516
|
window.alert = e;
|
|
529
517
|
};
|
|
530
518
|
}
|
|
531
|
-
var
|
|
532
|
-
const
|
|
533
|
-
function
|
|
519
|
+
var ut = /* @__PURE__ */ ((t) => (t.log = "log", t.warn = "warn", t.error = "error", t.info = "info", t.debug = "debug", t.trace = "trace", t.assert = "assert", t))(ut || {});
|
|
520
|
+
const Z = Object.values(ut);
|
|
521
|
+
function E(t) {
|
|
534
522
|
return function() {
|
|
535
523
|
t.apply(console, arguments);
|
|
536
524
|
};
|
|
537
525
|
}
|
|
538
|
-
const
|
|
539
|
-
log:
|
|
540
|
-
warn:
|
|
541
|
-
error:
|
|
542
|
-
info:
|
|
543
|
-
debug:
|
|
544
|
-
trace:
|
|
545
|
-
assert:
|
|
526
|
+
const v = {
|
|
527
|
+
log: E(console.log),
|
|
528
|
+
warn: E(console.warn),
|
|
529
|
+
error: E(console.error),
|
|
530
|
+
info: E(console.info),
|
|
531
|
+
debug: E(console.debug),
|
|
532
|
+
trace: E(console.trace),
|
|
533
|
+
assert: E(console.assert)
|
|
546
534
|
};
|
|
547
|
-
function
|
|
548
|
-
return
|
|
535
|
+
function Ut(t) {
|
|
536
|
+
return Z.forEach((e) => {
|
|
549
537
|
console[e] = (...r) => {
|
|
550
|
-
t(
|
|
538
|
+
t(v, e, r);
|
|
551
539
|
};
|
|
552
540
|
}), () => {
|
|
553
|
-
|
|
554
|
-
console[e] =
|
|
541
|
+
Z.forEach((e) => {
|
|
542
|
+
console[e] = v[e];
|
|
555
543
|
});
|
|
556
544
|
};
|
|
557
545
|
}
|
|
558
546
|
function vt(t) {
|
|
559
547
|
return function(r) {
|
|
560
|
-
const n =
|
|
548
|
+
const n = Ut(t);
|
|
561
549
|
try {
|
|
562
550
|
const o = r();
|
|
563
|
-
return
|
|
551
|
+
return b(o) ? o.then(
|
|
564
552
|
(s) => (n(), s),
|
|
565
553
|
(s) => {
|
|
566
554
|
throw n(), s;
|
|
@@ -571,7 +559,7 @@ function vt(t) {
|
|
|
571
559
|
}
|
|
572
560
|
};
|
|
573
561
|
}
|
|
574
|
-
function
|
|
562
|
+
function Tt() {
|
|
575
563
|
let t = new Error().stack;
|
|
576
564
|
if (t != null) {
|
|
577
565
|
const e = t.indexOf(`
|
|
@@ -582,7 +570,7 @@ function Et() {
|
|
|
582
570
|
}
|
|
583
571
|
function jt(t) {
|
|
584
572
|
return function(...e) {
|
|
585
|
-
const r =
|
|
573
|
+
const r = Tt();
|
|
586
574
|
try {
|
|
587
575
|
return t.apply(this, e);
|
|
588
576
|
} catch (n) {
|
|
@@ -591,14 +579,14 @@ function jt(t) {
|
|
|
591
579
|
}
|
|
592
580
|
};
|
|
593
581
|
}
|
|
594
|
-
function
|
|
582
|
+
function Et(t) {
|
|
595
583
|
if (!t || t.timeout == null)
|
|
596
584
|
return null;
|
|
597
|
-
const e = new
|
|
585
|
+
const e = new tt(), r = t.timeController ?? ct;
|
|
598
586
|
if (t.timeout) {
|
|
599
587
|
const n = r.setTimeout(() => {
|
|
600
588
|
e.abort(
|
|
601
|
-
new
|
|
589
|
+
new ft(
|
|
602
590
|
`[timeoutAbortController] Timeout error: ${t.timeout}ms`
|
|
603
591
|
)
|
|
604
592
|
);
|
|
@@ -612,7 +600,7 @@ function Tt(t) {
|
|
|
612
600
|
}), e;
|
|
613
601
|
}
|
|
614
602
|
async function te(t, e) {
|
|
615
|
-
const r =
|
|
603
|
+
const r = Et(e);
|
|
616
604
|
try {
|
|
617
605
|
return await t(r?.signal ?? e?.abortSignal ?? null);
|
|
618
606
|
} finally {
|
|
@@ -632,7 +620,7 @@ class ee {
|
|
|
632
620
|
const r = (o) => (this._options.persist ? this._promiseOrValue = o : (this._promiseOrValue = null, this._hasValue = !1), o), n = (o) => {
|
|
633
621
|
throw this._options.persist || (this._promiseOrValue = null, this._hasValue = !1), o;
|
|
634
622
|
};
|
|
635
|
-
if (
|
|
623
|
+
if (b(e))
|
|
636
624
|
e = e.then(r, n);
|
|
637
625
|
else if (!this._options.persist)
|
|
638
626
|
return e;
|
|
@@ -659,7 +647,7 @@ class re {
|
|
|
659
647
|
const n = (s) => (this._options.persist ? this._promiseOrValues.set(e, s) : this._promiseOrValues.delete(e), s), o = (s) => {
|
|
660
648
|
throw this._options.persist || this._promiseOrValues.delete(e), s;
|
|
661
649
|
};
|
|
662
|
-
if (
|
|
650
|
+
if (b(r))
|
|
663
651
|
r = r.then(n, o);
|
|
664
652
|
else if (!this._options.persist)
|
|
665
653
|
return r;
|
|
@@ -673,66 +661,66 @@ class re {
|
|
|
673
661
|
this._promiseOrValues.set(e, r);
|
|
674
662
|
}
|
|
675
663
|
}
|
|
676
|
-
function
|
|
664
|
+
function j(t) {
|
|
677
665
|
return t.replace(/\W/g, "").toLowerCase();
|
|
678
666
|
}
|
|
679
667
|
function Ct(t) {
|
|
680
668
|
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();
|
|
681
669
|
}
|
|
682
|
-
function
|
|
670
|
+
function Rt(t) {
|
|
683
671
|
return t == null ? null : (t = t.toLowerCase().trim(), t === "true" || t === "1" || t === "yes" ? !0 : t === "false" || t === "0" || t === "no" ? !1 : null);
|
|
684
672
|
}
|
|
685
|
-
function
|
|
673
|
+
function It(t) {
|
|
686
674
|
if (t == null)
|
|
687
675
|
return null;
|
|
688
676
|
t = t.trim();
|
|
689
677
|
const e = parseInt(t, 10);
|
|
690
678
|
return isNaN(e) ? null : e;
|
|
691
679
|
}
|
|
692
|
-
function
|
|
680
|
+
function xt(t) {
|
|
693
681
|
if (t == null)
|
|
694
682
|
return null;
|
|
695
683
|
t = t.trim();
|
|
696
684
|
const e = parseFloat(t);
|
|
697
685
|
return isNaN(e) ? null : e;
|
|
698
686
|
}
|
|
699
|
-
function
|
|
700
|
-
const r = Ct(e), n =
|
|
687
|
+
function X(t, e) {
|
|
688
|
+
const r = Ct(e), n = j(t);
|
|
701
689
|
for (const [o, s] of r.entries())
|
|
702
|
-
if (
|
|
690
|
+
if (j(o) === n)
|
|
703
691
|
return s;
|
|
704
692
|
return null;
|
|
705
693
|
}
|
|
706
694
|
function ne(t, e) {
|
|
707
|
-
return
|
|
695
|
+
return Rt(X(t, e));
|
|
708
696
|
}
|
|
709
697
|
function oe(t, e) {
|
|
710
|
-
return
|
|
698
|
+
return It(X(t, e));
|
|
711
699
|
}
|
|
712
700
|
function se(t, e) {
|
|
713
|
-
return
|
|
701
|
+
return xt(X(t, e));
|
|
714
702
|
}
|
|
715
703
|
export {
|
|
716
704
|
V as A,
|
|
717
705
|
Kt as B,
|
|
718
706
|
Qt as C,
|
|
719
|
-
|
|
707
|
+
Q as D,
|
|
720
708
|
Zt as E,
|
|
721
|
-
|
|
722
|
-
|
|
709
|
+
ut as F,
|
|
710
|
+
Ut as G,
|
|
723
711
|
vt as H,
|
|
724
712
|
jt as I,
|
|
725
|
-
|
|
726
|
-
|
|
713
|
+
Tt as J,
|
|
714
|
+
Et as K,
|
|
727
715
|
te as L,
|
|
728
716
|
ee as M,
|
|
729
717
|
re as N,
|
|
730
718
|
Ct as O,
|
|
731
|
-
|
|
732
|
-
|
|
719
|
+
Rt as P,
|
|
720
|
+
It as Q,
|
|
733
721
|
J as R,
|
|
734
|
-
|
|
735
|
-
|
|
722
|
+
xt as S,
|
|
723
|
+
X as T,
|
|
736
724
|
H as U,
|
|
737
725
|
ne as V,
|
|
738
726
|
oe as W,
|
|
@@ -740,27 +728,27 @@ export {
|
|
|
740
728
|
Pt as a,
|
|
741
729
|
wt as b,
|
|
742
730
|
Lt as c,
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
731
|
+
_t as d,
|
|
732
|
+
Ot as e,
|
|
733
|
+
zt as f,
|
|
734
|
+
Bt as g,
|
|
735
|
+
qt as h,
|
|
736
|
+
ot as i,
|
|
749
737
|
Ft as j,
|
|
750
738
|
Ht as k,
|
|
751
739
|
Wt as l,
|
|
752
|
-
|
|
740
|
+
yt as m,
|
|
753
741
|
Vt as n,
|
|
754
742
|
Gt as o,
|
|
755
743
|
Jt as p,
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
744
|
+
it as q,
|
|
745
|
+
nt as r,
|
|
746
|
+
dt as s,
|
|
747
|
+
mt as t,
|
|
760
748
|
k as u,
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
749
|
+
$t as v,
|
|
750
|
+
bt as w,
|
|
751
|
+
Xt as x,
|
|
752
|
+
Yt as y,
|
|
753
|
+
K as z
|
|
766
754
|
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";const F=require("@flemist/abort-controller-fast"),Z=require("@flemist/async-utils"),$t=require("@flemist/time-controller");let L=null;function At(){if(!L){L=new Array(256);for(let t=0;t<256;t++)L[t]=t.toString(16).padStart(2,"0")}return L}function it(t){const e=At(),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 X=null,st=null,q=null,ut=null;function Tt(){X||(X=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]),st=new Uint32Array(64),ut=new TextEncoder,q=new Uint8Array(65536))}function lt(t){if(t==null)return null;Tt();const e=X,r=st,n=ut;let o=q,i;if(typeof t=="string"){const h=t.length*3;o.length<h+128&&(o=q=new Uint8Array(h+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=q=new Uint8Array(a)),i!==o&&o.set(i),o[m]=128;for(let h=m+1;h<a;h++)o[h]=0;const A=m*8,C=A/4294967296|0,T=A|0;o[a-8]=C>>>24,o[a-7]=C>>>16,o[a-6]=C>>>8,o[a-5]=C,o[a-4]=T>>>24,o[a-3]=T>>>16,o[a-2]=T>>>8,o[a-1]=T;let U=1779033703,u=-1150833019,s=1013904242,l=-1521486534,y=1359893119,d=-1694144372,g=528734635,w=1541459225;for(let h=0;h<a;h+=64){for(let f=0;f<16;f++){const p=h+(f<<2);r[f]=o[p]<<24|o[p+1]<<16|o[p+2]<<8|o[p+3]}for(let f=16;f<64;f++){const p=r[f-15],$=r[f-2],b=(p>>>7|p<<25)^(p>>>18|p<<14)^p>>>3,D=($>>>17|$<<15)^($>>>19|$<<13)^$>>>10;r[f]=r[f-16]+b+r[f-7]+D|0}let c=U,_=u,N=s,H=l,O=y,P=d,k=g,W=w;for(let f=0;f<64;f+=4)for(let p=0;p<4;p++){const $=f+p,b=(O>>>6|O<<26)^(O>>>11|O<<21)^(O>>>25|O<<7),D=W+b+(k^O&(P^k))+e[$]+r[$]|0,Ut=((c>>>2|c<<30)^(c>>>13|c<<19)^(c>>>22|c<<10))+(c&_^N&(c^_))|0;W=k,k=P,P=O,O=H+D|0,H=N,N=_,_=c,c=D+Ut|0}U=U+c|0,u=u+_|0,s=s+N|0,l=l+H|0,y=y+O|0,d=d+P|0,g=g+k|0,w=w+W|0}const S=new Uint8Array(32),G=[U,u,s,l,y,d,g,w];for(let h=0;h<8;h++){const c=G[h],_=h<<2;S[_]=c>>>24,S[_+1]=c>>>16&255,S[_+2]=c>>>8&255,S[_+3]=c&255}return S}function Et(t){const e=lt(t);return e?it(e):null}function at(t,e){return t==null?e:e==null?t:Math.min(t,e)}function ct(t,e){return t==null?e:e==null?t:Math.max(t,e)}function Ct(t,e,r){return ct(at(t,e),r)}function Rt(t,e){return(t%e+e)%e}function It(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 kt(){return Math.random()}function xt(){return Math.random()*2**32>>>0}function ft(t){return t!=null?It(t):kt}class V{_seed;_rnd;constructor(e){this._seed=e,this._rnd=ft(e)}get seed(){return this._seed}nextSeed(){return this.next()*2**32>>>0}nextRandom(){return new V(this.nextSeed())}next(){return this._rnd()}clone(){return new V(this._seed)}}function K(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 ht(t,e,r){return Math.floor(K(t,e,r))}function Mt(t,e){return t.next()<(e??.5)}function Nt(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=K(t,n);for(let i=0;i<e;i++)if(o-=r(i),o<0)return i;return e-1}function v(t,e){if(e.length===0)throw new Error("[random][randomItem] items is empty");const r=ht(t,e.length);return e[r]}function Pt(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(v(t,e));return n}function Dt(t,e,r){let n=Object.values(e);return r&&(n=n.filter(r)),v(t,n)}const mt=1073741789,B=(mt>>2)-1;function Lt(t=B,e){if(t<=0)throw new Error(`[random][PseudoRandom] count(${t}) must be > 0`);if(t>B)throw new Error(`[random][PseudoRandom] count(${t}) must be <= ${B}`);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+mt)%t,r}}let x=null;function qt(){const t=Date.now();return x==null||t>x?(x=t,t):(x++,x)}async function Bt({url:t,timeout:e}={}){t||(t=typeof window<"u"?"/":"https://google.com");let r;try{const n=new F.AbortControllerFast;r=e?setTimeout(()=>{n.abort()},e):null;const o=await fetch(t,{method:"HEAD",signal:F.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 j(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 dt(t,e){t=j(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 Ft=0;const J=new WeakMap;function R(t){if(J.has(t))return J.get(t);const e=Ft++;return J.set(t,e),e}function et(t,e){try{return t[e]}catch(r){return"Error: "+(r instanceof Error?r.message:String(r))}}function I(t,e={},r=[],n=new Set){const{pretty:o,filter:i,maxDepth:m,maxItems:a,showObjectId:A,showArrayIndex:C,customToString:T}=e;if(T){const u=T(t,s=>I(s,e,r,n));if(u!=null)return u}const U=r.length;if(typeof t=="string")return JSON.stringify(t);if(t==null||typeof t!="object")return String(t);if(t instanceof ArrayBuffer||ArrayBuffer.isView(t))return`${t.constructor?.name??""}#${R(t)}[${t.byteLength}]`;if(t instanceof RegExp)return String(t);if(t instanceof Date)return dt(t);if(t instanceof Object){if(n.has(t)||m!=null&&U>=m)return`${t.constructor===Object?"":t.constructor?.name??""}#${R(t)}`;n.add(t)}if(t instanceof Error)return t.stack||t.message||String(t);if(Array.isArray(t)){const u=o?" ".repeat(U):"";let s="";A&&(s+=`#${R(t)} `),s+="[";let l=0,y=!1;for(let d=0;d<t.length;d++){if(a!=null&&l>=a){y=!0;break}const g=[...r,String(d)],w=et(t,d);if(i!=null&&!i(g,w))continue;const S=I(w,e,g,n);l>0&&(s+=","),o&&(s+=`
|
|
2
|
+
`),o&&(s+=`${u} `),C&&(s+=`${d}: `),s+=`${S}`,l++}return y?(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 A&&(u+=`#${R(t)} `),u+="Map",u+=I(Array.from(t.entries()),e,r,n),u}if(t instanceof Set){let u="";return A&&(u+=`#${R(t)} `),u+="Set",u+=I(Array.from(t.values()),e,r,n),u}{const u=t.constructor===Object?"":t.constructor?.name??"",s=o?" ".repeat(U):"";let l=u?`${u} `:"";A&&(l+=`#${R(t)} `),l+="{";let y=0,d=!1;for(const g in t){if(a!=null&&y>=a){d=!0;break}const w=[...r,g],S=et(t,g);if(i!=null&&!i(w,S))continue;const G=I(S,e,w,n);y>0&&(l+=","),o&&(l+=`
|
|
6
|
+
`),o&&(l+=`${s} `),l+=`${g}: ${G}`,y++}return d&&(y>0&&(l+=","),o?(l+=`
|
|
7
|
+
`,l+=`${s} ...
|
|
8
|
+
`):l+="...",l+=s),y>0&&o&&!d&&(l+=`
|
|
9
|
+
${s}`),l+="}",l}}function Vt(t,e){t=j(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 zt(t){return t==null?null:t.replace(/[&<>"']/g,e=>{switch(e){case"&":return"&";case"<":return"<";case">":return"&rt;";case'"':return""";default:return"'"}})}function Gt(t){return t==null?null:t?.replace(/[/\\^$*+?.()|[\]{}]/g,"\\$&")}function Y(t){if(t==null)return null;if(Array.isArray(t)){const e=t.length,r=[];for(let n=0;n<e;n++)r.push(Y(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]=Y(t[r]));return e}return t}function M(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(!M(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)&&!M(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)&&!M(e[r],null))return!1;return!0}return!1}function Ht(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(!M(n,e.get(r)))return!1;return!0}function Wt(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 Q(t){return!t||typeof t!="object"?t:Array.isArray(t)?t.map(Q):t&&Object.keys(t).sort().reduce((e,r)=>{const n=Q(t[r]);return n!=null&&(e[r]=n),e},{})}function bt(t){const e=alert;return window.alert=r=>t(e,r),()=>{window.alert=e}}var tt=(t=>(t.log="log",t.warn="warn",t.error="error",t.info="info",t.debug="debug",t.trace="trace",t.assert="assert",t))(tt||{});const rt=Object.values(tt);function E(t){return function(){t.apply(console,arguments)}}const nt={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 pt(t){return rt.forEach(e=>{console[e]=(...r)=>{t(nt,e,r)}}),()=>{rt.forEach(e=>{console[e]=nt[e]})}}function Jt(t){return function(r){const n=pt(t);try{const o=r();return Z.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 Xt(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 gt(t){if(!t||t.timeout==null)return null;const e=new F.AbortControllerFast,r=t.timeController??$t.timeControllerDefault;if(t.timeout){const n=r.setTimeout(()=>{e.abort(new F.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 Yt(t,e){const r=gt(e);try{return await t(r?.signal??e?.abortSignal??null)}finally{r?.abort()}}class Qt{_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(Z.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 Zt{_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(Z.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 ot(t){return t.replace(/\W/g,"").toLowerCase()}function wt(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 St(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 _t(t){if(t==null)return null;t=t.trim();const e=parseInt(t,10);return isNaN(e)?null:e}function Ot(t){if(t==null)return null;t=t.trim();const e=parseFloat(t);return isNaN(e)?null:e}function z(t,e){const r=wt(e),n=ot(t);for(const[o,i]of r.entries())if(ot(o)===n)return i;return null}function Kt(t,e){return St(z(t,e))}function vt(t,e){return _t(z(t,e))}function jt(t,e){return Ot(z(t,e))}exports.ConsoleMessageLevel=tt;exports.Lazy=Qt;exports.LazyWithId=Zt;exports.Random=V;exports.UNIQUE_PSEUDO_RANDOM_MAX_COUNT=B;exports.alertReplace=bt;exports.consoleReplace=pt;exports.convertTimeZone=j;exports.createUniquePseudoRandom=Lt;exports.dateNowUnique=qt;exports.deepCloneJsonLike=Y;exports.deepEqualJsonLike=M;exports.deepEqualJsonLikeMap=Ht;exports.equalArray=Wt;exports.escapeHtml=zt;exports.escapeRegExp=Gt;exports.fixStackTrace=Xt;exports.formatAny=I;exports.formatDate=dt;exports.formatDateFileName=Vt;exports.getDateInet=Bt;exports.getNormalizedObject=Q;exports.getRandomFunc=ft;exports.getRandomSeed=xt;exports.getStackTrace=yt;exports.max=ct;exports.min=at;exports.minMax=Ct;exports.numberMod=Rt;exports.randomBoolean=Mt;exports.randomEnum=Dt;exports.randomFloat=K;exports.randomIndexWeighted=Nt;exports.randomInt=ht;exports.randomItem=v;exports.randomItems=Pt;exports.sha256=Et;exports.sha256Buffer=lt;exports.timeoutAbortController=gt;exports.toHex=it;exports.urlGetBoolean=Kt;exports.urlGetFloat=jt;exports.urlGetInt=vt;exports.urlGetParams=wt;exports.urlGetString=z;exports.urlParamToBoolean=St;exports.urlParamToFloat=Ot;exports.urlParamToInt=_t;exports.withConsoleReplace=Jt;exports.withTimeout=Yt;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flemist/simple-utils",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Simple simple utils",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"types": "build/common/index.d.ts",
|
|
@@ -119,10 +119,10 @@
|
|
|
119
119
|
"check:types": "tsc --noEmit",
|
|
120
120
|
"check": "run-p audit check:types lint",
|
|
121
121
|
"========================= test =========================": "",
|
|
122
|
-
"test:node": "vitest --run --config
|
|
123
|
-
"test:browser": "vitest --run --config
|
|
124
|
-
"test:chrome": "vitest --run --config
|
|
125
|
-
"test:all": "vitest --run --config
|
|
122
|
+
"test:node": "vitest --run --config vite.projects.ts --project node --bail 3",
|
|
123
|
+
"test:browser": "vitest --run --config vite.projects.ts --project browser --bail 3",
|
|
124
|
+
"test:chrome": "vitest --run --config vite.projects.ts --project browser --browser chromium --bail 3",
|
|
125
|
+
"test:all": "vitest --run --config vite.projects.ts --bail 3",
|
|
126
126
|
"test": "run-s test:node test:browser",
|
|
127
127
|
"========================= dev =========================": "",
|
|
128
128
|
"kill-node": "taskkill /F /IM node.exe",
|
package/build/urlGet-CtceHOCG.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";const B=require("@flemist/abort-controller-fast"),Z=require("@flemist/async-utils"),$t=require("@flemist/time-controller");let D=null;function Ut(){if(!D){D=new Array(256);for(let t=0;t<256;t++)D[t]=t.toString(16).padStart(2,"0")}return D}function ot(t){const e=Ut(),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 X=null,it=null,q=null,st=null;function Tt(){X||(X=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]),it=new Uint32Array(64),st=new TextEncoder,q=new Uint8Array(65536))}function ut(t){if(t==null)return null;Tt();const e=X,r=it,n=st;let o=q,i;if(typeof t=="string"){const m=t.length*3;o.length<m+128&&(o=q=new Uint8Array(m+128));const f=n.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=q=new Uint8Array(a)),i!==o&&o.set(i),o[c]=128;for(let m=c+1;m<a;m++)o[m]=0;const T=c*8,R=T/4294967296|0,A=T|0;o[a-8]=R>>>24,o[a-7]=R>>>16,o[a-6]=R>>>8,o[a-5]=R,o[a-4]=A>>>24,o[a-3]=A>>>16,o[a-2]=A>>>8,o[a-1]=A;let y=1779033703,s=-1150833019,u=1013904242,l=-1521486534,p=1359893119,d=-1694144372,w=528734635,O=1541459225;for(let m=0;m<a;m+=64){for(let h=0;h<16;h++){const g=m+(h<<2);r[h]=o[g]<<24|o[g+1]<<16|o[g+2]<<8|o[g+3]}for(let h=16;h<64;h++){const g=r[h-15],U=r[h-2],J=(g>>>7|g<<25)^(g>>>18|g<<14)^g>>>3,L=(U>>>17|U<<15)^(U>>>19|U<<13)^U>>>10;r[h]=r[h-16]+J+r[h-7]+L|0}let f=y,S=s,N=u,H=l,_=p,P=d,x=w,W=O;for(let h=0;h<64;h+=4)for(let g=0;g<4;g++){const U=h+g,J=(_>>>6|_<<26)^(_>>>11|_<<21)^(_>>>25|_<<7),L=W+J+(x^_&(P^x))+e[U]+r[U]|0,Ot=((f>>>2|f<<30)^(f>>>13|f<<19)^(f>>>22|f<<10))+(f&S^N&(f^S))|0;W=x,x=P,P=_,_=H+L|0,H=N,N=S,S=f,f=L+Ot|0}y=y+f|0,s=s+S|0,u=u+N|0,l=l+H|0,p=p+_|0,d=d+P|0,w=w+x|0,O=O+W|0}const E=new Uint8Array(32),G=[y,s,u,l,p,d,w,O];for(let m=0;m<8;m++){const f=G[m],S=m<<2;E[S]=f>>>24,E[S+1]=f>>>16&255,E[S+2]=f>>>8&255,E[S+3]=f&255}return E}function At(t){const e=ut(t);return e?ot(e):null}function lt(t,e){return t==null?e:e==null?t:Math.min(t,e)}function at(t,e){return t==null?e:e==null?t:Math.max(t,e)}function Et(t,e,r){return at(lt(t,e),r)}function Ct(t,e){return(t%e+e)%e}function Rt(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 It(){return Math.random()}function xt(){return Math.random()*2**32>>>0}function ct(t){return t!=null?Rt(t):It}class V{_seed;_rnd;constructor(e){this._seed=e,this._rnd=ct(e)}get seed(){return this._seed}nextSeed(){return this.next()*2**32>>>0}nextRandom(){return new V(this.nextSeed())}next(){return this._rnd()}clone(){return new V(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 ft(t,e,r){return Math.floor(v(t,e,r))}function kt(t,e){return t.next()<(e??.5)}function Mt(t,e,r){if(Array.isArray(e)){const i=e;e=i.length,r=c=>i[c]}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 K(t,e){if(e.length===0)throw new Error("[random][randomItem] items is empty");const r=ft(t,e.length);return e[r]}function Nt(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(K(t,e));return n}function Pt(t,e,r){let n=Object.values(e);return r&&(n=n.filter(r)),K(t,n)}const ht=1073741789,F=(ht>>2)-1;function Lt(t=F,e){if(t<=0)throw new Error(`[random][PseudoRandom] count(${t}) must be > 0`);if(t>F)throw new Error(`[random][PseudoRandom] count(${t}) must be <= ${F}`);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+ht)%t,r}}let k=null;function Dt(){const t=Date.now();return k==null||t>k?(k=t,t):(k++,k)}async function qt({url:t,timeout:e}={}){t||(t=typeof window<"u"?"/":"https://google.com");let r;try{const n=new B.AbortControllerFast;r=e?setTimeout(()=>{n.abort()},e):null;const o=await fetch(t,{method:"HEAD",signal:B.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 j(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 mt(t,e){t=j(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"),c=t.getUTCMinutes().toString().padStart(2,"0"),a=t.getUTCSeconds().toString().padStart(2,"0");return`${r}-${n}-${o} ${i}:${c}:${a}`}let Ft=0;const b=new WeakMap;function $(t){if(b.has(t))return b.get(t);const e=Ft++;return b.set(t,e),e}function Bt(t,e){try{return t[e]}catch(r){return"Error: "+(r?.message||String(r))}}function I(t,e={},r=[],n=new Set){const{pretty:o,filter:i,maxDepth:c,maxItems:a,showObjectId:T,showArrayIndex:R,customToString:A}=e;if(A){const s=A(t,u=>I(u,e,r,n));if(s!=null)return s}const y=r.length;if(typeof t=="string")return JSON.stringify(t);if(t==null||typeof t!="object")return String(t);if(typeof t.byteLength=="number")return`${t.constructor.name}#${$(t)}[${t.byteLength}]`;if(t instanceof RegExp)return String(t);if(t instanceof Error)return t.stack||t.message||String(t);if(t instanceof Date)return mt(t);if(Array.isArray(t)){if(n.has(t)||c!=null&&y>=c)return`#${$(t)}`;const s=o?" ".repeat(y):"";let u="";T&&(u+=`#${$(t)} `),u+="[";const l=a!=null?Math.min(t.length,a):t.length;l>0&&o&&(u+=`
|
|
2
|
-
`);for(let p=0;p<l;p++){const d=[...r,String(p)];if(i!=null&&!i(d,t[p]))continue;const w=t[p],O=I(w,e,d);p>0&&(u+=",",o&&(u+=`
|
|
3
|
-
`)),o&&(u+=`${s} `),R&&(u+=`${p}: `),u+=`${O}`}return l>0&&o&&(u+=`
|
|
4
|
-
`),t.length>l&&(l>0&&(u+=","),u+=o?`${s} ...
|
|
5
|
-
`:"..."),l>0&&o&&(u+=s),u+="]",u}if(t instanceof Map){if(n.has(t)||c!=null&&y>=c)return`#${$(t)}`;let s="";return T&&(s+=`#${$(t)} `),s+="Map",s+=I(Array.from(t.entries()),e,r,n),s}if(t instanceof Set){if(n.has(t)||c!=null&&y>=c)return`#${$(t)}`;let s="";return T&&(s+=`#${$(t)} `),s+="Set",s+=I(Array.from(t.values()),e,r,n),s}{const s=t.prototype?.constructor===Object?"":t.prototype?.constructor.name;if(n.has(t)||c!=null&&y>=c)return`${s}#${$(t)}`;const u=o?" ".repeat(y):"";let l=s?`${s} `:"";T&&(l+=`#${$(t)} `),l+="{";const p=a!=null?Math.min(t.length,a):t.length;let d=0;for(const w in t){if(d===0&&o&&(l+=`
|
|
6
|
-
`),d>=p){d>0&&(l+=","),l+=o?`${u} ...
|
|
7
|
-
`:"...";break}const O=[...r,w];if(i!=null&&!i(O,t[w]))continue;const E=Bt(t,w),G=I(E,e,O);d>0&&(l+=",",o&&(l+=`
|
|
8
|
-
`)),o&&(l+=`${u} `),l+=`${w}: ${G}`,d++}return d>0&&o&&(l+=`
|
|
9
|
-
${u}`),l+="}",l}}function Vt(t,e){t=j(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"),c=t.getUTCMinutes().toString().padStart(2,"0"),a=t.getUTCSeconds().toString().padStart(2,"0");return`${r}-${n}-${o}_${i}-${c}-${a}`}function zt(t){return t==null?null:t.replace(/[&<>"']/g,e=>{switch(e){case"&":return"&";case"<":return"<";case">":return"&rt;";case'"':return""";default:return"'"}})}function Gt(t){return t==null?null:t?.replace(/[/\\^$*+?.()|[\]{}]/g,"\\$&")}function Y(t){if(t==null)return null;if(Array.isArray(t)){const e=t.length,r=[];for(let n=0;n<e;n++)r.push(Y(t[n]));return r}if(typeof t=="object"){if(t.constructor&&t.constructor!==Object)throw new Error(`[deepCloneJsonLike] unexpected behavior: value.constructor (${t.constructor}) !== Object`);const e={};for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=Y(t[r]));return e}return t}function M(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(!M(t[n],e[n]))return!1;return!0}if(typeof t=="object"){if(typeof e!="object")return!1;if(t.constructor&&t.constructor!==Object)throw new Error(`[deepEqual] unexpected behavior: a.constructor (${t.constructor}) !== Object`);if(e.constructor&&e.constructor!==Object)throw new Error(`[deepEqual] unexpected behavior: b.constructor (${e.constructor}) !== Object`);for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&!M(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)&&!M(e[r],null))return!1;return!0}return!1}function Ht(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(!M(n,e.get(r)))return!1;return!0}function Wt(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 Q(t){return!t||typeof t!="object"?t:Array.isArray(t)?t.map(Q):t&&Object.keys(t).sort().reduce((e,r)=>{const n=Q(t[r]);return n!=null&&(e[r]=n),e},{})}function Jt(t){const e=alert;return window.alert=r=>t(e,r),()=>{window.alert=e}}var tt=(t=>(t.log="log",t.warn="warn",t.error="error",t.info="info",t.debug="debug",t.trace="trace",t.assert="assert",t))(tt||{});const et=Object.values(tt);function C(t){return function(){t.apply(console,arguments)}}const rt={log:C(console.log),warn:C(console.warn),error:C(console.error),info:C(console.info),debug:C(console.debug),trace:C(console.trace),assert:C(console.assert)};function pt(t){return et.forEach(e=>{console[e]=(...r)=>{t(rt,e,r)}}),()=>{et.forEach(e=>{console[e]=rt[e]})}}function bt(t){return function(r){const n=pt(t);try{const o=r();return Z.isPromiseLike(o)?o.then(i=>(n(),i),i=>{throw n(),i}):o}finally{n()}}}function dt(){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 Xt(t){return function(...e){const r=dt();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 gt(t){if(!t||t.timeout==null)return null;const e=new B.AbortControllerFast,r=t.timeController??$t.timeControllerDefault;if(t.timeout){const n=r.setTimeout(()=>{e.abort(new B.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 Yt(t,e){const r=gt(e);try{return await t(r?.signal??e?.abortSignal??null)}finally{r?.abort()}}class Qt{_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(Z.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 Zt{_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(Z.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 nt(t){return t.replace(/\W/g,"").toLowerCase()}function yt(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 wt(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 St(t){if(t==null)return null;t=t.trim();const e=parseInt(t,10);return isNaN(e)?null:e}function _t(t){if(t==null)return null;t=t.trim();const e=parseFloat(t);return isNaN(e)?null:e}function z(t,e){const r=yt(e),n=nt(t);for(const[o,i]of r.entries())if(nt(o)===n)return i;return null}function vt(t,e){return wt(z(t,e))}function Kt(t,e){return St(z(t,e))}function jt(t,e){return _t(z(t,e))}exports.ConsoleMessageLevel=tt;exports.Lazy=Qt;exports.LazyWithId=Zt;exports.Random=V;exports.UNIQUE_PSEUDO_RANDOM_MAX_COUNT=F;exports.alertReplace=Jt;exports.consoleReplace=pt;exports.convertTimeZone=j;exports.createUniquePseudoRandom=Lt;exports.dateNowUnique=Dt;exports.deepCloneJsonLike=Y;exports.deepEqualJsonLike=M;exports.deepEqualJsonLikeMap=Ht;exports.equalArray=Wt;exports.escapeHtml=zt;exports.escapeRegExp=Gt;exports.fixStackTrace=Xt;exports.formatAny=I;exports.formatDate=mt;exports.formatDateFileName=Vt;exports.getDateInet=qt;exports.getNormalizedObject=Q;exports.getRandomFunc=ct;exports.getRandomSeed=xt;exports.getStackTrace=dt;exports.max=at;exports.min=lt;exports.minMax=Et;exports.numberMod=Ct;exports.randomBoolean=kt;exports.randomEnum=Pt;exports.randomFloat=v;exports.randomIndexWeighted=Mt;exports.randomInt=ft;exports.randomItem=K;exports.randomItems=Nt;exports.sha256=At;exports.sha256Buffer=ut;exports.timeoutAbortController=gt;exports.toHex=ot;exports.urlGetBoolean=vt;exports.urlGetFloat=jt;exports.urlGetInt=Kt;exports.urlGetParams=yt;exports.urlGetString=z;exports.urlParamToBoolean=wt;exports.urlParamToFloat=_t;exports.urlParamToInt=St;exports.withConsoleReplace=bt;exports.withTimeout=Yt;
|