full-utils 3.0.5 → 3.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1052,6 +1052,8 @@ declare function isArrFilled<T = unknown>(value: unknown): value is readonly [T,
1052
1052
  */
1053
1053
  declare function isBool(value: unknown): value is boolean;
1054
1054
 
1055
+ declare function isBoolOrBoolTree(value: unknown): boolean;
1056
+
1055
1057
  /**
1056
1058
  * Checks whether a value represents a **valid JavaScript date**.
1057
1059
  *
@@ -2031,6 +2033,9 @@ declare function isObj(value: unknown): value is Record<string, unknown>;
2031
2033
  */
2032
2034
  declare function isObjFilled(value: unknown): value is Record<string, unknown>;
2033
2035
 
2036
+ type Primitive = string | number | boolean | bigint | symbol | null | undefined;
2037
+ declare function isObjFlat(value: unknown): value is Record<string, Primitive>;
2038
+
2034
2039
  /**
2035
2040
  * Validates whether a string meets configurable **password strength requirements**.
2036
2041
  *
@@ -3270,4 +3275,4 @@ declare function urlObj(value?: string): UrlObj;
3270
3275
 
3271
3276
  declare function urlDecode(input: string): string;
3272
3277
 
3273
- export { type JSONLike, type JsonLike, type PasswordOptions, type TimeParts, type UniqueDeepOptions, arrFuncArgs, arrReplaceTemplate, arrSplitBatches, arrUniqueDeep, boolNormalize, dateFloorMin, datePartsSec, dateSecParts, dateStr, env, ipNumStr, ipStrNum, isArr, isArrFilled, isBool, isClass, isDate, isEmail, isExists, isFunc, isIpAddr, isMacAddr, isNum, isNumFloat, isNumN, isNumNZ, isNumP, isNumPZ, isObj, isObjFilled, isPassword, isPhone, isStr, isStrAscDesc, isStrBool, isStrFilled, isVar, jsonDecode, jsonEncode, jsonParse, jsonStrLike, numNormalize, strLowerCase, strNormalCase, strNormalize, strNull, strPhone, strTrim, strUndefined, urlDecode, urlObj, wait };
3278
+ export { type JSONLike, type JsonLike, type PasswordOptions, type TimeParts, type UniqueDeepOptions, arrFuncArgs, arrReplaceTemplate, arrSplitBatches, arrUniqueDeep, boolNormalize, dateFloorMin, datePartsSec, dateSecParts, dateStr, env, ipNumStr, ipStrNum, isArr, isArrFilled, isBool, isBoolOrBoolTree, isClass, isDate, isEmail, isExists, isFunc, isIpAddr, isMacAddr, isNum, isNumFloat, isNumN, isNumNZ, isNumP, isNumPZ, isObj, isObjFilled, isObjFlat, isPassword, isPhone, isStr, isStrAscDesc, isStrBool, isStrFilled, isVar, jsonDecode, jsonEncode, jsonParse, jsonStrLike, numNormalize, strLowerCase, strNormalCase, strNormalize, strNull, strPhone, strTrim, strUndefined, urlDecode, urlObj, wait };
package/dist/index.d.ts CHANGED
@@ -1052,6 +1052,8 @@ declare function isArrFilled<T = unknown>(value: unknown): value is readonly [T,
1052
1052
  */
1053
1053
  declare function isBool(value: unknown): value is boolean;
1054
1054
 
1055
+ declare function isBoolOrBoolTree(value: unknown): boolean;
1056
+
1055
1057
  /**
1056
1058
  * Checks whether a value represents a **valid JavaScript date**.
1057
1059
  *
@@ -2031,6 +2033,9 @@ declare function isObj(value: unknown): value is Record<string, unknown>;
2031
2033
  */
2032
2034
  declare function isObjFilled(value: unknown): value is Record<string, unknown>;
2033
2035
 
2036
+ type Primitive = string | number | boolean | bigint | symbol | null | undefined;
2037
+ declare function isObjFlat(value: unknown): value is Record<string, Primitive>;
2038
+
2034
2039
  /**
2035
2040
  * Validates whether a string meets configurable **password strength requirements**.
2036
2041
  *
@@ -3270,4 +3275,4 @@ declare function urlObj(value?: string): UrlObj;
3270
3275
 
3271
3276
  declare function urlDecode(input: string): string;
3272
3277
 
3273
- export { type JSONLike, type JsonLike, type PasswordOptions, type TimeParts, type UniqueDeepOptions, arrFuncArgs, arrReplaceTemplate, arrSplitBatches, arrUniqueDeep, boolNormalize, dateFloorMin, datePartsSec, dateSecParts, dateStr, env, ipNumStr, ipStrNum, isArr, isArrFilled, isBool, isClass, isDate, isEmail, isExists, isFunc, isIpAddr, isMacAddr, isNum, isNumFloat, isNumN, isNumNZ, isNumP, isNumPZ, isObj, isObjFilled, isPassword, isPhone, isStr, isStrAscDesc, isStrBool, isStrFilled, isVar, jsonDecode, jsonEncode, jsonParse, jsonStrLike, numNormalize, strLowerCase, strNormalCase, strNormalize, strNull, strPhone, strTrim, strUndefined, urlDecode, urlObj, wait };
3278
+ export { type JSONLike, type JsonLike, type PasswordOptions, type TimeParts, type UniqueDeepOptions, arrFuncArgs, arrReplaceTemplate, arrSplitBatches, arrUniqueDeep, boolNormalize, dateFloorMin, datePartsSec, dateSecParts, dateStr, env, ipNumStr, ipStrNum, isArr, isArrFilled, isBool, isBoolOrBoolTree, isClass, isDate, isEmail, isExists, isFunc, isIpAddr, isMacAddr, isNum, isNumFloat, isNumN, isNumNZ, isNumP, isNumPZ, isObj, isObjFilled, isObjFlat, isPassword, isPhone, isStr, isStrAscDesc, isStrBool, isStrFilled, isVar, jsonDecode, jsonEncode, jsonParse, jsonStrLike, numNormalize, strLowerCase, strNormalCase, strNormalize, strNull, strPhone, strTrim, strUndefined, urlDecode, urlObj, wait };
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- function X(t){if(!u(t))return [t];let r=t.trim();if(r==="")return [];if(r.startsWith("[")&&r.endsWith("]")&&(r=r.slice(1,-1).trim(),r===""))return [];let n="",e=false,o=null,i=false,s=0,c=0,p=0,x=[],y=()=>{let m=n.trim();m!==""&&x.push(m),n="";};for(let m=0;m<r.length;m++){let f=r[m];if(e){if(n+=f,i){i=false;continue}if(f==="\\"){i=true;continue}f===o&&(e=false,o=null);continue}if(f==='"'||f==="'"){e=true,o=f,n+=f;continue}if(f==="("){s++,n+=f;continue}if(f===")"){s=Math.max(0,s-1),n+=f;continue}if(f==="["){c++,n+=f;continue}if(f==="]"){c=Math.max(0,c-1),n+=f;continue}if(f==="{"){p++,n+=f;continue}if(f==="}"){p=Math.max(0,p-1),n+=f;continue}if(f===","&&s===0&&c===0&&p===0){y();continue}n+=f;}return n.length&&y(),x.map(m=>{if(m.startsWith("$")&&m.includes("(")&&m.endsWith(")"))return m;if(m==="null")return null;if(m==="undefined")return;if(P(m))return D(m);let f=O(m);if(Number.isFinite(f))return f;if(m==="Infinity")return 1/0;if(m==="-Infinity")return -1/0;let d=String(m||"");if(d.length>=2&&(d.startsWith("'")&&d.endsWith("'")||d.startsWith('"')&&d.endsWith('"')))return d.slice(1,-1).replace(/\\\\/g,"\\").replace(/\\'/g,"'").replace(/\\"/g,'"');if(d.startsWith("{")&&d.endsWith("}")||d.startsWith("[")&&d.endsWith("]"))try{return A(d)}catch{}return d})}function tt(t,r){if(!Number.isInteger(r)||r<=0)return [];let n=[],e=0;for(;e<t.length;)n.push(t.slice(e,e+r)),e+=r;return n}function j(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function U(t){return t==null||typeof t!="object"||t instanceof Date}function B(t,r){return Array.isArray(t)?Array.isArray(r)?r:[r]:r}function N(t,r){if(t==null)return t;if(U(r))return B(t,r);if(Array.isArray(t))return t.map(o=>N(o,r));if(!j(t)||!j(r))return t;let n={...t},e=false;for(let o of Object.keys(r)){if(!(o in t))continue;let i=N(t[o],r[o]);i!==t[o]&&(n[o]=i,e=true);}return e?n:t}function nt(t,r){return N(t,r)}function Z(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)&&!(t instanceof Date)}function V(t){let r=new WeakSet,n=e=>{if(e===null)return "null";let o=typeof e;if(o==="string")return JSON.stringify(e);if(o==="number")return Number.isNaN(e)?'"__NaN__"':String(e);if(o==="boolean")return e?"true":"false";if(o==="undefined")return '"__undefined__"';if(o==="bigint")return `"__bigint__:${String(e)}"`;if(o==="function")return '"__function__"';if(e instanceof Date)return `"__date__:${e.toISOString()}"`;if(Array.isArray(e))return "["+e.map(n).join(",")+"]";if(o==="object"&&e){let i=e;return r.has(i)?'"__circular__"':(r.add(i),"{"+Object.keys(i).sort().map(p=>JSON.stringify(p)+":"+n(i[p])).join(",")+"}")}return JSON.stringify(String(e))};return n(t)}function Q(t){if(t===null)return "null";let r=typeof t;return r==="string"?"s:"+t:r==="number"?"n:"+(Number.isNaN(t)?"__NaN__":t):r==="boolean"?"b:"+t:r==="undefined"?"u:":r==="bigint"?"bi:"+String(t):t instanceof Date?"d:"+t.toISOString():"o:"+V(t)}function ot(t,r){let n=r?.keyFn??Q,e=o=>{if(Array.isArray(o)){let i=o.map(e),s=new Set,c=[];for(let p of i){let x=n(p);s.has(x)||(s.add(x),c.push(p));}return c}if(Z(o)){let i={};for(let s of Object.keys(o))i[s]=e(o[s]);return i}return o};return e(t)}function D(t){switch(true){case b(t):return t;case w(t):return true;case _(t):return false;case(a(t)&&["true","1","yes","on"].includes(String(t??"").trim().toLowerCase())):return true;case(a(t)&&["false","0","no","off"].includes(String(t??"").trim().toLowerCase())):return false}return false}async function ft(t=0){await new Promise(r=>setTimeout(()=>r(true),t));}function ct(t){return process.env[t]}function pt(t=1,r=new Date){let n=Math.min(60,Math.max(1,Math.trunc(Math.abs(t)))),e=r.getMinutes(),o=Math.floor(e/n)*n,i=new Date(r);return i.setMinutes(o,0,0),i}function dt(t=new Date){let r=p=>String(p).padStart(2,"0"),n=t.getFullYear(),e=r(t.getMonth()+1),o=r(t.getDate()),i=r(t.getHours()),s=r(t.getMinutes()),c=r(t.getSeconds());return `${n}-${e}-${o} ${i}:${s}:${c}`}function xt(t){let{days:r=0,hours:n=0,minutes:e=0,seconds:o=0}=t;return r*86400+n*3600+e*60+o}function ht(t){if(!Number.isFinite(t)||t<0)throw new Error("Invalid total seconds");let r=Math.floor(t/86400),n=Math.floor(t%86400/3600),e=Math.floor(t%3600/60),o=t%60;return {days:r,hours:n,minutes:e,seconds:o}}function bt(t){let r=t.split(".").map(i=>Number(i));if(r.length!==4||r.some(i=>!Number.isInteger(i)||i<0||i>255))throw new Error("Invalid IPv4 address");let n=new ArrayBuffer(4),e=new DataView(n),o=0;for(;o<4;)e.setUint8(o,r[o]),o++;return e.getUint32(0,false)}function Tt(t){if(!w(t))return "";let r=new ArrayBuffer(4),n=new DataView(r);n.setUint32(0,t,false);let e=[],o=0;for(;o<4;)e.push(n.getUint8(o)),o++;return e.join(".")}function h(t){return Array.isArray(t)}function I(t){return h(t)&&t.length>0}function b(t){return typeof t=="boolean"}function _t(t){if(t instanceof Date)return !Number.isNaN(t.getTime());if(u(t)||l(t)){let r=new Date(t);return !Number.isNaN(r.getTime())}return false}var q=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z]{2,})+$/;function Lt(t){return a(t)?q.test(t):false}function Et(t){return t!=null}function $(t){return typeof t=="function"}var K=/^(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)$/;function Mt(t){if(!u(t))return false;let r=t.trim();return K.test(r)}function Bt(t){return u(t)&&/^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/.test(t)}function l(t){return typeof t=="number"&&Number.isFinite(t)}function qt(t){return l(t)&&!Number.isInteger(t)}function Yt(t){return l(t)&&t<0}function _(t){return l(t)&&t<=0}function w(t){return l(t)&&t>0}function L(t){return l(t)&&t>=0}function k(t){return typeof t=="object"&&t!==null&&Object.prototype.toString.call(t)==="[object Object]"&&!Array.isArray(t)}function W(t){return k(t)&&Object.keys(t).length>0}function fr(t,{minLength:r=8,maxLength:n=256,requireUppercase:e=true,requireLowercase:o=true,requireDigit:i=true,requireSpecial:s=true}={}){return !(!u(t)||t.length<r||t.length>n||e&&!/[A-ZА-Я]/.test(t)||o&&!/[a-zа-я]/.test(t)||i&&!/\d/.test(t)||s&&!/[~!?@#$%^&*_\-+()\[\]{}><\\\/|"'.,:;=]/.test(t))}function mr(t){if(!a(t)&&!l(t))return false;let r=String(t).trim();return !(r.startsWith("-")||(r.match(/\+/g)||[]).length>1||r.includes("+")&&!r.startsWith("+")||!/^\+?[0-9-]+$/.test(r)||r.length<3||r.length>20||!/[0-9]$/.test(r)||r.includes("--"))}function u(t){return typeof t=="string"}function P(t){if(!a(t))return false;let r=t.trim().toLowerCase();return r==="true"||r==="false"}function a(t){return u(t)&&t.trim().length>0}function kr(t){if(!a(t))return false;let r=t.trim().toLowerCase();return r==="asc"||r==="desc"}function Sr(t){return u(t)&&/^[A-Za-z_][A-Za-z0-9_]*$/.test(t)}function Fr(t){return $(t)&&/^class\s/.test(Function.prototype.toString.call(t))}var H=/^(['"`])([\s\S]*)\1$/;function S(t,r){let n=t.trim(),e=E(n);if(e.ok)return e.value;let o=H.exec(n);return o?o[2]:r?n:null}function E(t){try{return {ok:!0,value:JSON.parse(t)}}catch{}return {ok:false}}function A(t,r=false){if(t===null||l(t)||b(t))return t;if(I(t)){let n=t,e=[];for(let o of n)a(o)?e.push(S(String(o),r)):e.push(o);return e}if(W(t)){let n=t,e={};for(let o of Object.keys(n)){let i=n[o];a(i)?e[o]=S(String(i),r):e[o]=i;}return e}return h(t)||k(t)?t:a(t)?S(String(t),r):null}function Wr(t){try{return k(t)||h(t)?JSON.stringify(t):""}catch{}return ""}function J(t){let r=t.sign<0?"-":"",n=t.digitsInteger.toString();if(t.scale===0)return r+n;let e=t.scale-n.length;if(e>=0)return r+"0."+"0".repeat(e)+n;let o=n.length-t.scale,i=n.slice(0,o),s=n.slice(o);return r+i+"."+s}function R(t){return Number(J(t))}function T(t,r){let n=/^([0-9]+)(?:\.([0-9]*))?e([+\-]?[0-9]+)$/i.exec((()=>{let[i,s]=r.split(/e/i),[c,p=""]=i.split("."),x=c.replace(/^0+/,"")+p,y=parseInt(s,10)-p.length;return `${x||"0"}e${y}`})());if(!n)throw new Error("Failed to parse exponential notation.");let e=n[1],o=parseInt(n[3],10);if(L(o))return e=e+"0".repeat(o),{sign:t,integerPart:e||"0",fractionalPart:""};{let i=-o;if(i>=e.length){let s="0".repeat(i-e.length);return {sign:t,integerPart:"0",fractionalPart:s+e}}else {let s=e.length-i;return {sign:t,integerPart:e.slice(0,s),fractionalPart:e.slice(s)}}}}function C(t){if(typeof t=="bigint"){let r=t<0n?-1:1,n=(t<0n?-t:t).toString();return {sign:r,integerPart:n,fractionalPart:""}}if(typeof t=="number"){if(!Number.isFinite(t))throw new Error("Input number is not finite.");let r=t<0?-1:1,e=Math.abs(t).toExponential(30);return T(r,e)}if(typeof t=="string"){let r=t.trim().replace(",",".");if(!r)throw new Error("Input string is empty.");let n=1;if((r.startsWith("+")||r.startsWith("-"))&&(n=r.startsWith("-")?-1:1,r=r.slice(1)),/^[0-9]*\.?[0-9]*(e[+\-]?[0-9]+)?$/i.test(r)){if(/e/i.test(r))return T(n,r);let[e="0",o=""]=r.split(".");return {sign:n,integerPart:e,fractionalPart:o}}throw new Error("Invalid numeric string.")}throw new Error("Unsupported input type.")}function F(t){let{sign:r,integerPart:n,fractionalPart:e}=C(t),o=n.replace(/^0+/,"")||"0",i=e.replace(/0+$/,""),s=o+i||"0";return {sign:r,digitsInteger:BigInt(s),scale:i.length}}function M(t,r,n="half-up"){let e=Math.max(0,Math.trunc(r));if(t.scale<=e)return {...t};let o=t.scale-e,i=10n**BigInt(o),s=t.digitsInteger/i,c=t.digitsInteger%i;if(n==="trunc"||c===0n)return {sign:t.sign,digitsInteger:s,scale:e};let p=i/2n,y=c>=p?s+1n:s;return {sign:t.sign,digitsInteger:y,scale:e}}function O(t,r=1,n=false){try{return R(r>1?M(F(t),r,"half-up"):F(t))}catch(e){if(n)throw e}return 0}function z(t){if(!u(t))return "";let r=g(t);return a(r)?r.toLowerCase():""}function tn(t){if(!u(t))return "";let r=z(t);return a(r)?r[0].toUpperCase()+r.slice(1):""}function on(t){return u(t)&&g(t)===""||t===void 0?null:t}function fn(t,r="+7"){if(!u(t))return null;let n=g(t).replace(/[\s\-().]/g,"");return /^00\d{8,15}$/.test(n)?n="+"+n.slice(2):/^\d{10}$/.test(n)?n=r+n:/^\d{9,15}$/.test(n)&&!n.startsWith("0")&&(n="+"+n),/^\+\d{10,15}$/.test(n)?n:null}function g(t,r=""){let n=String(u(t)?t.trim().normalize("NFKC").replace(/[\u200B-\u200D\uFEFF]/g,""):"");return r?n.split(r).filter(e=>!!e).join(r):n}function dn(t){return u(t)&&g(t)===""||t===null?void 0:t}var yn=t=>{if(!u(t))return t;let r=String(g(t)||"");return r===""?null:String(r.toLowerCase()||"").replace(/\s+/g," ").replace(/\t+/g,"").replace(/\n+/g,"")};function kn(t=""){return {}}function Sn(t){if(!a(t))return String(t);let r="____RAW_PERCENT____",n=t.replace(/%(?![0-9A-Fa-f]{2})/g,r),e=new Set(["22","7B","7D","3A","2C","5B","5D","5C"]);return n.replace(/%([0-9A-Fa-f]{2})/g,(i,s)=>{let c=s.toUpperCase();return e.has(c)?decodeURIComponent(`%${c}`):`%${c}`}).split(r).join("%")}export{X as arrFuncArgs,nt as arrReplaceTemplate,tt as arrSplitBatches,ot as arrUniqueDeep,D as boolNormalize,pt as dateFloorMin,xt as datePartsSec,ht as dateSecParts,dt as dateStr,ct as env,Tt as ipNumStr,bt as ipStrNum,h as isArr,I as isArrFilled,b as isBool,Fr as isClass,_t as isDate,Lt as isEmail,Et as isExists,$ as isFunc,Mt as isIpAddr,Bt as isMacAddr,l as isNum,qt as isNumFloat,Yt as isNumN,_ as isNumNZ,w as isNumP,L as isNumPZ,k as isObj,W as isObjFilled,fr as isPassword,mr as isPhone,u as isStr,kr as isStrAscDesc,P as isStrBool,a as isStrFilled,Sr as isVar,A as jsonDecode,Wr as jsonEncode,E as jsonParse,S as jsonStrLike,O as numNormalize,z as strLowerCase,tn as strNormalCase,yn as strNormalize,on as strNull,fn as strPhone,g as strTrim,dn as strUndefined,Sn as urlDecode,kn as urlObj,ft as wait};//# sourceMappingURL=index.mjs.map
1
+ function v(t){if(!u(t))return [t];let r=t.trim();if(r==="")return [];if(r.startsWith("[")&&r.endsWith("]")&&(r=r.slice(1,-1).trim(),r===""))return [];let n="",e=false,o=null,i=false,s=0,c=0,p=0,x=[],k=()=>{let m=n.trim();m!==""&&x.push(m),n="";};for(let m=0;m<r.length;m++){let f=r[m];if(e){if(n+=f,i){i=false;continue}if(f==="\\"){i=true;continue}f===o&&(e=false,o=null);continue}if(f==='"'||f==="'"){e=true,o=f,n+=f;continue}if(f==="("){s++,n+=f;continue}if(f===")"){s=Math.max(0,s-1),n+=f;continue}if(f==="["){c++,n+=f;continue}if(f==="]"){c=Math.max(0,c-1),n+=f;continue}if(f==="{"){p++,n+=f;continue}if(f==="}"){p=Math.max(0,p-1),n+=f;continue}if(f===","&&s===0&&c===0&&p===0){k();continue}n+=f;}return n.length&&k(),x.map(m=>{if(m.startsWith("$")&&m.includes("(")&&m.endsWith(")"))return m;if(m==="null")return null;if(m==="undefined")return;if(j(m))return P(m);let f=_(m);if(Number.isFinite(f))return f;if(m==="Infinity")return 1/0;if(m==="-Infinity")return -1/0;let d=String(m||"");if(d.length>=2&&(d.startsWith("'")&&d.endsWith("'")||d.startsWith('"')&&d.endsWith('"')))return d.slice(1,-1).replace(/\\\\/g,"\\").replace(/\\'/g,"'").replace(/\\"/g,'"');if(d.startsWith("{")&&d.endsWith("}")||d.startsWith("[")&&d.endsWith("]"))try{return A(d)}catch{}return d})}function rt(t,r){if(!Number.isInteger(r)||r<=0)return [];let n=[],e=0;for(;e<t.length;)n.push(t.slice(e,e+r)),e+=r;return n}function I(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function B(t){return t==null||typeof t!="object"||t instanceof Date}function U(t,r){return Array.isArray(t)?Array.isArray(r)?r:[r]:r}function F(t,r){if(t==null)return t;if(B(r))return U(t,r);if(Array.isArray(t))return t.map(o=>F(o,r));if(!I(t)||!I(r))return t;let n={...t},e=false;for(let o of Object.keys(r)){if(!(o in t))continue;let i=F(t[o],r[o]);i!==t[o]&&(n[o]=i,e=true);}return e?n:t}function et(t,r){return F(t,r)}function Z(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)&&!(t instanceof Date)}function V(t){let r=new WeakSet,n=e=>{if(e===null)return "null";let o=typeof e;if(o==="string")return JSON.stringify(e);if(o==="number")return Number.isNaN(e)?'"__NaN__"':String(e);if(o==="boolean")return e?"true":"false";if(o==="undefined")return '"__undefined__"';if(o==="bigint")return `"__bigint__:${String(e)}"`;if(o==="function")return '"__function__"';if(e instanceof Date)return `"__date__:${e.toISOString()}"`;if(Array.isArray(e))return "["+e.map(n).join(",")+"]";if(o==="object"&&e){let i=e;return r.has(i)?'"__circular__"':(r.add(i),"{"+Object.keys(i).sort().map(p=>JSON.stringify(p)+":"+n(i[p])).join(",")+"}")}return JSON.stringify(String(e))};return n(t)}function Q(t){if(t===null)return "null";let r=typeof t;return r==="string"?"s:"+t:r==="number"?"n:"+(Number.isNaN(t)?"__NaN__":t):r==="boolean"?"b:"+t:r==="undefined"?"u:":r==="bigint"?"bi:"+String(t):t instanceof Date?"d:"+t.toISOString():"o:"+V(t)}function it(t,r){let n=r?.keyFn??Q,e=o=>{if(Array.isArray(o)){let i=o.map(e),s=new Set,c=[];for(let p of i){let x=n(p);s.has(x)||(s.add(x),c.push(p));}return c}if(Z(o)){let i={};for(let s of Object.keys(o))i[s]=e(o[s]);return i}return o};return e(t)}function P(t){switch(true){case h(t):return t;case S(t):return true;case $(t):return false;case(a(t)&&["true","1","yes","on"].includes(String(t??"").trim().toLowerCase())):return true;case(a(t)&&["false","0","no","off"].includes(String(t??"").trim().toLowerCase())):return false}return false}async function at(t=0){await new Promise(r=>setTimeout(()=>r(true),t));}function mt(t){return process.env[t]}function lt(t=1,r=new Date){let n=Math.min(60,Math.max(1,Math.trunc(Math.abs(t)))),e=r.getMinutes(),o=Math.floor(e/n)*n,i=new Date(r);return i.setMinutes(o,0,0),i}function gt(t=new Date){let r=p=>String(p).padStart(2,"0"),n=t.getFullYear(),e=r(t.getMonth()+1),o=r(t.getDate()),i=r(t.getHours()),s=r(t.getMinutes()),c=r(t.getSeconds());return `${n}-${e}-${o} ${i}:${s}:${c}`}function yt(t){let{days:r=0,hours:n=0,minutes:e=0,seconds:o=0}=t;return r*86400+n*3600+e*60+o}function kt(t){if(!Number.isFinite(t)||t<0)throw new Error("Invalid total seconds");let r=Math.floor(t/86400),n=Math.floor(t%86400/3600),e=Math.floor(t%3600/60),o=t%60;return {days:r,hours:n,minutes:e,seconds:o}}function wt(t){let r=t.split(".").map(i=>Number(i));if(r.length!==4||r.some(i=>!Number.isInteger(i)||i<0||i>255))throw new Error("Invalid IPv4 address");let n=new ArrayBuffer(4),e=new DataView(n),o=0;for(;o<4;)e.setUint8(o,r[o]),o++;return e.getUint32(0,false)}function Ft(t){if(!S(t))return "";let r=new ArrayBuffer(4),n=new DataView(r);n.setUint32(0,t,false);let e=[],o=0;for(;o<4;)e.push(n.getUint8(o)),o++;return e.join(".")}function y(t){return Array.isArray(t)}function L(t){return y(t)&&t.length>0}function h(t){return typeof t=="boolean"}function w(t){return b(t)&&Object.keys(t).length>0}function q(t){if(h(t))return true;if(!w(t))return false;for(let r of Object.keys(t))if(!q(t[r]))return false;return true}function Et(t){if(t instanceof Date)return !Number.isNaN(t.getTime());if(u(t)||l(t)){let r=new Date(t);return !Number.isNaN(r.getTime())}return false}var K=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z]{2,})+$/;function Mt(t){return a(t)?K.test(t):false}function Bt(t){return t!=null}function N(t){return typeof t=="function"}var H=/^(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)$/;function Qt(t){if(!u(t))return false;let r=t.trim();return H.test(r)}function Ht(t){return u(t)&&/^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/.test(t)}function l(t){return typeof t=="number"&&Number.isFinite(t)}function vt(t){return l(t)&&!Number.isInteger(t)}function nr(t){return l(t)&&t<0}function $(t){return l(t)&&t<=0}function S(t){return l(t)&&t>0}function R(t){return l(t)&&t>=0}function b(t){return typeof t=="object"&&t!==null&&Object.prototype.toString.call(t)==="[object Object]"&&!Array.isArray(t)&&!(t instanceof Date)}function gr(t){return w(t)?Object.values(t).every(r=>r===null||!b(r)&&!y(r)||!N(r)):false}function br(t,{minLength:r=8,maxLength:n=256,requireUppercase:e=true,requireLowercase:o=true,requireDigit:i=true,requireSpecial:s=true}={}){return !(!u(t)||t.length<r||t.length>n||e&&!/[A-ZА-Я]/.test(t)||o&&!/[a-zа-я]/.test(t)||i&&!/\d/.test(t)||s&&!/[~!?@#$%^&*_\-+()\[\]{}><\\\/|"'.,:;=]/.test(t))}function wr(t){if(!a(t)&&!l(t))return false;let r=String(t).trim();return !(r.startsWith("-")||(r.match(/\+/g)||[]).length>1||r.includes("+")&&!r.startsWith("+")||!/^\+?[0-9-]+$/.test(r)||r.length<3||r.length>20||!/[0-9]$/.test(r)||r.includes("--"))}function u(t){return typeof t=="string"}function j(t){if(!a(t))return false;let r=t.trim().toLowerCase();return r==="true"||r==="false"}function a(t){return u(t)&&t.trim().length>0}function jr(t){if(!a(t))return false;let r=t.trim().toLowerCase();return r==="asc"||r==="desc"}function Ir(t){return u(t)&&/^[A-Za-z_][A-Za-z0-9_]*$/.test(t)}function Rr(t){return N(t)&&/^class\s/.test(Function.prototype.toString.call(t))}var Y=/^(['"`])([\s\S]*)\1$/;function T(t,r){let n=t.trim(),e=W(n);if(e.ok)return e.value;let o=Y.exec(n);return o?o[2]:r?n:null}function W(t){try{return {ok:!0,value:JSON.parse(t)}}catch{}return {ok:false}}function A(t,r=false){if(t===null||l(t)||h(t))return t;if(L(t)){let n=t,e=[];for(let o of n)a(o)?e.push(T(String(o),r)):e.push(o);return e}if(w(t)){let n=t,e={};for(let o of Object.keys(n)){let i=n[o];a(i)?e[o]=T(String(i),r):e[o]=i;}return e}return y(t)||b(t)?t:a(t)?T(String(t),r):null}function Vr(t){try{return b(t)||y(t)?JSON.stringify(t):""}catch{}return ""}function E(t){let r=t.sign<0?"-":"",n=t.digitsInteger.toString();if(t.scale===0)return r+n;let e=t.scale-n.length;if(e>=0)return r+"0."+"0".repeat(e)+n;let o=n.length-t.scale,i=n.slice(0,o),s=n.slice(o);return r+i+"."+s}function J(t){return Number(E(t))}function O(t,r){let n=/^([0-9]+)(?:\.([0-9]*))?e([+\-]?[0-9]+)$/i.exec((()=>{let[i,s]=r.split(/e/i),[c,p=""]=i.split("."),x=c.replace(/^0+/,"")+p,k=parseInt(s,10)-p.length;return `${x||"0"}e${k}`})());if(!n)throw new Error("Failed to parse exponential notation.");let e=n[1],o=parseInt(n[3],10);if(R(o))return e=e+"0".repeat(o),{sign:t,integerPart:e||"0",fractionalPart:""};{let i=-o;if(i>=e.length){let s="0".repeat(i-e.length);return {sign:t,integerPart:"0",fractionalPart:s+e}}else {let s=e.length-i;return {sign:t,integerPart:e.slice(0,s),fractionalPart:e.slice(s)}}}}function C(t){if(typeof t=="bigint"){let r=t<0n?-1:1,n=(t<0n?-t:t).toString();return {sign:r,integerPart:n,fractionalPart:""}}if(typeof t=="number"){if(!Number.isFinite(t))throw new Error("Input number is not finite.");let r=t<0?-1:1,e=Math.abs(t).toExponential(30);return O(r,e)}if(typeof t=="string"){let r=t.trim().replace(",",".");if(!r)throw new Error("Input string is empty.");let n=1;if((r.startsWith("+")||r.startsWith("-"))&&(n=r.startsWith("-")?-1:1,r=r.slice(1)),/^[0-9]*\.?[0-9]*(e[+\-]?[0-9]+)?$/i.test(r)){if(/e/i.test(r))return O(n,r);let[e="0",o=""]=r.split(".");return {sign:n,integerPart:e,fractionalPart:o}}throw new Error("Invalid numeric string.")}throw new Error("Unsupported input type.")}function D(t){let{sign:r,integerPart:n,fractionalPart:e}=C(t),o=n.replace(/^0+/,"")||"0",i=e.replace(/0+$/,""),s=o+i||"0";return {sign:r,digitsInteger:BigInt(s),scale:i.length}}function M(t,r,n="half-up"){let e=Math.max(0,Math.trunc(r));if(t.scale<=e)return {...t};let o=t.scale-e,i=10n**BigInt(o),s=t.digitsInteger/i,c=t.digitsInteger%i;if(n==="trunc"||c===0n)return {sign:t.sign,digitsInteger:s,scale:e};let p=i/2n,k=c>=p?s+1n:s;return {sign:t.sign,digitsInteger:k,scale:e}}function _(t,r=1,n=false){try{return J(r>1?M(D(t),r,"half-up"):D(t))}catch(e){if(n)throw e}return 0}function z(t){if(!u(t))return "";let r=g(t);return a(r)?r.toLowerCase():""}function mn(t){if(!u(t))return "";let r=z(t);return a(r)?r[0].toUpperCase()+r.slice(1):""}function gn(t){return u(t)&&g(t)===""||t===void 0?null:t}function bn(t,r="+7"){if(!u(t))return null;let n=g(t).replace(/[\s\-().]/g,"");return /^00\d{8,15}$/.test(n)?n="+"+n.slice(2):/^\d{10}$/.test(n)?n=r+n:/^\d{9,15}$/.test(n)&&!n.startsWith("0")&&(n="+"+n),/^\+\d{10,15}$/.test(n)?n:null}function g(t,r=""){let n=String(u(t)?t.trim().normalize("NFKC").replace(/[\u200B-\u200D\uFEFF]/g,""):"");return r?n.split(r).filter(e=>!!e).join(r):n}function Tn(t){return u(t)&&g(t)===""||t===null?void 0:t}var Dn=t=>{if(!u(t))return t;let r=String(g(t)||"");return r===""?null:String(r.toLowerCase()||"").replace(/\s+/g," ").replace(/\t+/g,"").replace(/\n+/g,"")};function jn(t=""){return {}}function In(t){if(!a(t))return String(t);let r="____RAW_PERCENT____",n=t.replace(/%(?![0-9A-Fa-f]{2})/g,r),e=new Set(["22","7B","7D","3A","2C","5B","5D","5C"]);return n.replace(/%([0-9A-Fa-f]{2})/g,(i,s)=>{let c=s.toUpperCase();return e.has(c)?decodeURIComponent(`%${c}`):`%${c}`}).split(r).join("%")}export{v as arrFuncArgs,et as arrReplaceTemplate,rt as arrSplitBatches,it as arrUniqueDeep,P as boolNormalize,lt as dateFloorMin,yt as datePartsSec,kt as dateSecParts,gt as dateStr,mt as env,Ft as ipNumStr,wt as ipStrNum,y as isArr,L as isArrFilled,h as isBool,q as isBoolOrBoolTree,Rr as isClass,Et as isDate,Mt as isEmail,Bt as isExists,N as isFunc,Qt as isIpAddr,Ht as isMacAddr,l as isNum,vt as isNumFloat,nr as isNumN,$ as isNumNZ,S as isNumP,R as isNumPZ,b as isObj,w as isObjFilled,gr as isObjFlat,br as isPassword,wr as isPhone,u as isStr,jr as isStrAscDesc,j as isStrBool,a as isStrFilled,Ir as isVar,A as jsonDecode,Vr as jsonEncode,W as jsonParse,T as jsonStrLike,_ as numNormalize,z as strLowerCase,mn as strNormalCase,Dn as strNormalize,gn as strNull,bn as strPhone,g as strTrim,Tn as strUndefined,In as urlDecode,jn as urlObj,at as wait};//# sourceMappingURL=index.mjs.map
2
2
  //# sourceMappingURL=index.mjs.map