@lntvow/utils 4.1.1 → 4.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var ne=Object.create;var j=Object.defineProperty;var oe=Object.getOwnPropertyDescriptor;var ie=Object.getOwnPropertyNames;var se=Object.getPrototypeOf,ae=Object.prototype.hasOwnProperty;var me=(e,t)=>{for(var r in t)j(e,r,{get:t[r],enumerable:!0})},B=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of ie(t))!ae.call(e,o)&&o!==r&&j(e,o,{get:()=>t[o],enumerable:!(n=oe(t,o))||n.enumerable});return e};var I=(e,t,r)=>(r=e!=null?ne(se(e)):{},B(t||!e||!e.__esModule?j(r,"default",{value:e,enumerable:!0}):r,e)),ce=e=>B(j({},"__esModule",{value:!0}),e);var wt={};me(wt,{base64Decode:()=>ye,base64Encode:()=>be,castArray:()=>O,compose:()=>he,composeRight:()=>Oe,debounce:()=>we,debugWarn:()=>z,debugWarnInvalidTypeMessage:()=>Re,decimalToBinary:()=>xe,deepClone:()=>A,deepMerge:()=>W,deprecated:()=>Se,generateRandomArray:()=>Ye,generateRandomColor:()=>Ue,generateRandomDate:()=>D,generateRandomEmail:()=>ee,generateRandomFloat:()=>Be,generateRandomIdCard:()=>Ge,generateRandomMobilePhone:()=>qe,generateRandomStringFromSource:()=>N,getRandomInt:()=>c,getRandomItem:()=>u,getRandomString:()=>d,getRandomUrl:()=>Ve,hasChanged:()=>de,isArray:()=>g,isBoolean:()=>fe,isChineseString:()=>it,isDate:()=>L,isDateString:()=>re,isDef:()=>ge,isEmail:()=>yt,isEmptyString:()=>ht,isEnglishAphabet:()=>Qe,isFloat:()=>st,isFunction:()=>R,isIdCard:()=>Ot,isInteger:()=>ft,isLowerCase:()=>rt,isLowerCaseAndNumber:()=>nt,isLowerCaseAndNumberAndChinese:()=>ot,isMap:()=>Y,isMobilePhone:()=>xt,isNegativeFloat:()=>ct,isNegativeInteger:()=>gt,isNonNegativeFloat:()=>mt,isNonNegativeInteger:()=>lt,isNonPositiveFloat:()=>pt,isNonPositiveInteger:()=>dt,isNull:()=>ue,isNumber:()=>l,isNumberOrNumberString:()=>Xe,isObject:()=>pe,isObjectLike:()=>T,isPlainObject:()=>y,isPositiveFloat:()=>at,isPositiveInteger:()=>ut,isPromise:()=>K,isRegExp:()=>_,isSet:()=>U,isString:()=>v,isSymbol:()=>F,isURL:()=>bt,isUndef:()=>w,isUndefined:()=>le,isUpperCase:()=>Je,isUpperCaseAndNumber:()=>et,isUpperCaseAndNumberAndChinese:()=>tt,objectToString:()=>G,omit:()=>Fe,pick:()=>H,qs:()=>Ee,throttle:()=>ke,throwError:()=>m,throwErrorInvalidTypeMessage:()=>Te,toTypeString:()=>h,toTypeValue:()=>M,validatorChineseOrEnglish:()=>De,validatorChineseOrEnglishOrNumber:()=>Pe,validatorUppercaseOrNumbersOrSpecial:()=>Ne,validatorUppercaseOrNumbersOrUnderline:()=>Ce,withRetry:()=>Ie});module.exports=ce(wt);function pe(e){let t=typeof e;return e!==null&&(t==="object"||t==="function")}function T(e){return e!==null&&typeof e=="object"}var G=Object.prototype.toString,h=e=>G.call(e),M=e=>h(e).slice(8,-1),v=e=>typeof e=="string",l=e=>typeof e=="number"&&Number.isFinite(e),fe=e=>typeof e=="boolean",ue=e=>e===null,le=e=>e===void 0,F=e=>typeof e=="symbol",g=Array.isArray,R=e=>typeof e=="function",Y=e=>h(e)==="[object Map]",U=e=>h(e)==="[object Set]",L=e=>h(e)==="[object Date]",_=e=>h(e)==="[object RegExp]",K=e=>T(e)&&R(e?.then)&&R(e?.catch),w=e=>e==null,ge=e=>e!=null,de=(e,t)=>e!==t;function y(e){return h(e)==="[object Object]"}function O(e){return g(e)?e:[e]}function xe(e){let t=[],r,n="";for(;e>0;)r=Math.floor(e%2),t.push(r),e=Math.floor(e/2);for(;t.length>0;)n+=t.pop().toString();return n}var q="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function be(e){let t="",r="";for(let o=0;o<e.length;o++)r+=e[o].charCodeAt(0).toString(2).padStart(8,"0");for(let o=0;o<r.length;o+=6)t+=q[Number.parseInt(r.slice(o,o+6).padEnd(6,"0"),2)];let n=t.length%4;return n!==0&&(t+="=".repeat(4-n)),t}function ye(e){let t="",r="";for(let n=0;n<e.length&&e[n]!=="=";n++)r+=q.indexOf(e[n]).toString(2).padStart(6,"0");for(let n=0;n<r.length;n+=8){let o=Number.parseInt(r.slice(n,n+8),2);o&&(t+=String.fromCharCode(o))}return t}function he(...e){return e.reduce((t,r)=>function(...n){return r(t(...n))})}function Oe(...e){return e.reduce((t,r)=>function(...n){return t(r(...n))})}function we(e,t=500){let r=null;return function(...n){r&&clearTimeout(r),r=setTimeout(()=>{e.apply(this,n)},t)}}function A(e){let t=new WeakMap;function r(n){if(!T(n))return n;if(L(n))return new Date(n);if(_(n))return new RegExp(n);if(K(n))return n;if(t.has(n))return t.get(n);if(Y(n)){let s=new Map;return t.set(n,s),n.forEach((p,f)=>s.set(r(f),r(p))),s}if(U(n)){let s=new Set;return t.set(n,s),n.forEach(p=>s.add(r(p))),s}let o=g(n)?Object.setPrototypeOf([],Object.getPrototypeOf(n)):Object.create(Object.getPrototypeOf(n));t.set(n,o);let a=Object.getOwnPropertyDescriptors(n);for(let s of Reflect.ownKeys(a)){let p=a[s];p.get||p.set?Object.defineProperty(o,s,p):Object.defineProperty(o,s,{...p,value:r(p.value)})}return o}return r(e)}function W(e,t,r={}){return X(V(e,r),V(t,r),r)}function X(e,t,r){return g(e)?$e(e,t,r):Ae(e,t,r)}function Ae(e,t,r){if(!y(t))return t;let n=Object.getOwnPropertyDescriptors(t);return Reflect.ownKeys(t).forEach(o=>{(y(e[o])||g(e[o]))&&(y(t[o])||g(t[o]))?e[o]=X(e[o],t[o],r):Object.defineProperty(e,o,n[o])}),e}function $e(e,t,r){let{mergeStrategy:n="replace"}=r;if(g(t))switch(n){case"merge":return e.concat(t);case"replace":return t;default:return t}return t}function V(e,t){let{deepClone:r=!0}=t;return r?A(e):e}var E=class extends Error{constructor(t,r="Utils"){super(t),this.name=r}};function m(e,t){throw new E(`[${e}] ${t}`)}function z(e,t){let r=v(e)?new E(`[${e}] ${t}`,"UtilsWarn"):e;console.warn(r)}var Se=({from:e,replacement:t,version:r,type:n="API"})=>{z(`${n}`,`${e} is about to be deprecated in version ${r}, please use ${t} instead.`)};function Te(e,t,r,n){let o=`Invalid params: type check failed for params "${t}". Expected ${r}, got ${M(n)} with value ${n}.`;m(e,o)}function Re(e,t,r,n){let o=`Invalid params: type check failed for params "${t}". Expected ${r}, got ${M(n)} with value ${n}.`;z(e,o)}var k=(e,t,...r)=>{if(!t)return;let n=r.length===0?"":r.length===1?r[0]:r;console[e](`[Log] ${t}:`,n)},P=(e,...t)=>{k("info",e,...t)};P.info=(e,...t)=>{k("info",e,...t)};P.error=(e,...t)=>{k("error",e,...t)};P.warn=(e,...t)=>{k("warn",e,...t)};typeof globalThis<"u"&&(globalThis.log=P);function je(e,t){let{decode:r=!0}=t||{},n={};e.startsWith("?")&&(e=e.slice(1)),e.includes("?")&&(e=e.slice(e.indexOf("?")+1));let o=e.split("&").filter(Boolean);for(let a of o){let[s,p]=a.split("=");n[s]=r?decodeURIComponent(p):p}return n}function Q(e,t){let{encode:r=!0}=t||{},n=[];for(let o in e){let a=e[o];n.push(`${o}=${r?encodeURIComponent(a):a}`)}return n.join("&")}function Me(e,t,r){let n=W({encode:!0},{...r}),o=Q(t,n);return e.includes("?")?e.endsWith("?")||e.endsWith("&")?`${e}${o}`:`${e}&${o}`:`${e}?${o}`}var Ee={parse:je,stringify:Q,appendQueryString:Me};function ke(e,t=500){let r=null;return function(...n){if(w(r))return r=Date.now(),e.apply(this,n);let o=Date.now();if(o-r>=t)return r=o,e.apply(this,n)}}function Pe(e){return!w(e)&&/^[\dA-Z\u4E00-\u9FA5]+$/i.test(e)}function De(e){return!w(e)&&/^[A-Z\u4E00-\u9FA5]+$/i.test(e)}function Ne(e){return!w(e)&&/^[\d!"#$%&'()*+,./:;<=>?@A-Z[\\\]^_`{|}~]+$/.test(e)}function Ce(e){return/^[\dA-Z_]+$/.test(e)}async function Ie(e){let{fn:t,maxAttempts:r=3,retryDelay:n=1e3,enableExponentialBackoff:o=!1,signal:a}=e,s,p=new Promise((b,$)=>{if(a){let S=()=>$(new Error("Operation Cancelled"));a.addEventListener("abort",S),s=()=>a.removeEventListener("abort",S)}}),f=0;try{for(;;){if(console.log("while: ",f),a?.aborted)throw new Error("Operation Cancelled");try{return await Promise.race([t(),p])}catch(b){if(b instanceof Error&&b.message==="Operation Cancelled"||(f++,f>=r))throw b;let $=o?n*2**(f-1):n;await new Promise(S=>setTimeout(S,$))}}}finally{s?.()}}function H(e,t,r={}){let{includeProto:n=!1,includeSymbols:o=!0,includeNonEnum:a=!1}=r,s={};return y(e)&&O(t).forEach(f=>{F(f)&&!o||!(n?f in e:Object.hasOwn(e,f))||!a&&(n?ve(e,f):Object.getOwnPropertyDescriptor(e,f))?.enumerable===!1||(s[f]=A(e[f]))}),s}function ve(e,t){let r=e;for(;r!==null;){let n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=Object.getPrototypeOf(r)}}function Fe(e,t){if(!y(e))return{};let r=A(e),n=O(t),o=Object.keys(r).filter(a=>!n.includes(a));return H(r,o)}function Ye(e,t){return(!l(e)||e<=0)&&m("generateRandomArray","num \u5FC5\u987B\u5927\u4E8E0"),R(t)||m("generateRandomArray","cb \u5FC5\u987B\u662F\u51FD\u6570"),Array.from({length:e}).fill(0).map((r,n)=>t(r,n))}function Ue(){return`#${Math.random().toString(16).slice(2,8).padEnd(6,"0")}`}var x=I(require("dayjs"),1),J=I(require("dayjs/plugin/customParseFormat.js"),1);function u(e){return e[Math.floor(Math.random()*e.length)]}function c(e={}){l(e)&&(e={max:e});let{min:t=1,max:r=u(_e())}=e;Le(t,r);let n=Math.ceil(t),o=Math.floor(r);return Math.floor(Math.random()*(o-n+1)+n)}function Le(e,t){let r=Math.ceil(e),n=Math.floor(t);Number.isSafeInteger(r)||m("getRandomInt",`The minimum value Math.ceil(${e}) should be a safe integer`),Number.isSafeInteger(n)||m("getRandomInt",`The maximum value Math.floor(${t}) should be a safe integer`),n<r&&(t>=e&&m("getRandomInt",`No integer value found between ${e} and ${t}`),m("getRandomInt",`The maximum value ${t} should be greater than the minimum value ${e}`))}function _e(){return Array.from({length:Number.MAX_SAFE_INTEGER.toString().length}).map((e,t)=>{let r=Number.MAX_SAFE_INTEGER.toString().slice(0,t+1);return Number(r)})}x.default.extend(J.default);function D(e={}){let{start:t="1800-01-01 00:00:00",end:r=(0,x.default)().format("YYYY-MM-DD HH:mm:ss"),format:n="YYYY-MM-DD HH:mm:ss"}=e;(!(0,x.default)(t).isValid()||!(0,x.default)(r).isValid())&&m("generateRandomDate","start end \u53C2\u6570\u5FC5\u987B\u662F\u5408\u6CD5\u7684\u65F6\u95F4\u683C\u5F0F");let o=(0,x.default)(t).year(),a=(0,x.default)(r).year(),s=c({min:o,max:a}),p=c({min:1,max:12}),f=c({min:1,max:31}),b=c(23),$=c(59),S=c(59),C=(0,x.default)(`${s}-${p}-${f} ${b}:${$}:${S}`);return C.isBefore((0,x.default)(t))||C.isAfter((0,x.default)(r))?D(e):C.format(n)}function d(e={}){let t=We(e),r=ze(t);He(r);let{length:n}=t;Ze(n.min,n.max);let o=c(n),a=t.prefix||"";for(let s=0;s<o;s++)a+=r.charAt(Math.floor(Math.random()*r.length));return a+(t.suffix||"")}var Ke=16,Z=1;function We(e){let t=l(e);return{lowerCase:!0,upperCase:!0,number:!0,...t?{}:e,length:t?{max:e,min:e}:l(e.length)?{max:e.length,min:e.length}:{max:Ke,min:Z,...e.length},extra:t?[]:[...new Set(O(e.extra||[]))]}}function ze(e){let t="";return e.lowerCase&&(t+="abcdefghijklmnopqrstuvwxyz"),e.upperCase&&(t+="ABCDEFGHIJKLMNOPQRSTUVWXYZ"),e.number&&(t+="0123456789"),t+=O(e.extra).join(""),t}function He(e){e.length===0&&m("getRandomString","At least one character set (lowercase, uppercase, number) must be enabled or extra characters provided")}function Ze(e,t){Number.isInteger(e)||m("getRandomString","min must be an integer"),Number.isInteger(t)||m("getRandomString","max must be an integer"),e<Z&&m("getRandomString",`Minimum length cannot be less than ${Z}`),t<e&&m("getRandomString","Maximum length cannot be less than minimum length")}function ee(){let e=["gmail.com","outlook.com.cn","example.com","qq.com","163.com","test.com.cn"],t=`${d(1)}${d({length:c({max:30,min:1})})}${d(1)}@${u(e)}`;return/\.{2,}/.test(t)?ee():t}function Be(e={}){l(e)&&(e={max:e});let{min:t=0,max:r=1,fractionDigits:n=2}=e;if(t===r)return t;if(t>r)throw new Error(`\u6700\u5927\u503C ${r} \u5E94\u5927\u4E8E\u6700\u5C0F\u503C ${t}`);return Math.random()*(r-t)+t}function N(e,t){(!l(e)||e<=0)&&m("generateRandomStringFromSource","num \u5FC5\u987B\u5927\u4E8E0"),(!g(t)||t.length===0)&&m("generateRandomStringFromSource","source \u4E0D\u80FD\u4E3A\u7A7A\u6570\u7EC4");let r="";for(let n=0;n<e;n++)r+=u(t);return r}function Ge(){let e=c({min:1e5,max:999999}),t=[0,1,2,3,4,5,6,7,8,9];return[e,D({format:"YYYYMMDD"}),N(3,t),N(1,[...t,"X","x"])].join("")}function qe(){return u(["13","14","15","16","17","18","19"])+c(999999999).toString().padEnd(9,"0")}function Ve(){let e=["http://","https://"],t=[".com",".net",".org",".cn",".top"],r=[`?name=${d({length:{min:4,max:8}})}`,`?id=${c()}`,`?page=${d({length:{min:2,max:4}})}`,`?query=${d({length:{min:5,max:6}})}`,`?search=${d({length:{min:1,max:4}})}`,`?token=${d({length:{min:16,max:16}})}`];return`${u(e)}${d({length:{min:5,max:25}})}${u(t)}${u(r)}`}function Xe(e){return/^\d+$/.test(e)}function Qe(e){return/^[A-Z]+$/i.test(e)}function Je(e){return/^[A-Z]+$/.test(e)}function et(e){return/^[\dA-Z]+$/.test(e)}function tt(e){return/^[\dA-Z\u4E00-\u9FA5]+$/.test(e)}function rt(e){return/^[a-z]+$/.test(e)}function nt(e){return/^[\da-z]+$/.test(e)}function ot(e){return/^[\da-z\u4E00-\u9FA5]+$/.test(e)}function it(e){return/^[\u4E00-\u9FA5]+$/.test(e)}function st(e){return/^-?(?:0|[1-9]\d*)\.\d+$/.test(e)}function at(e){return/^(?:0\.0*[1-9]\d*|[1-9]\d*\.\d+)$/.test(e)}function mt(e){return/^(?:0|[1-9]\d*)\.\d+$/.test(e)}function ct(e){return/^-(?:0\.0*[1-9]\d*|[1-9]\d*\.\d+)$/.test(e)}function pt(e){return/^-(?:0|[1-9]\d*)\.\d+$/.test(e)}function ft(e){return/^-?(?:0|[1-9]\d*)$/.test(e)}function ut(e){return/^[1-9]\d*$/.test(e)}function lt(e){return/^(?:0|[1-9]\d*)$/.test(e)&&!Object.is(e,-0)}function gt(e){return/^-[1-9]\d*$/.test(e)}function dt(e){return/^-(?:0|[1-9]\d*)$/.test(e)||Object.is(e,-0)}var te=I(require("dayjs"),1);function xt(e){return/^1[3-9]\d{9}$/.test(e)}function bt(e){return/^https?:\/\/\S+$/i.test(e)}function yt(e){return/^[^\s@]+@[^\s@][^\s.@]*\.[^\s@]+$/.test(e)}function ht(e){return e===""}function re(e,t="YYYY-MM-DD HH:mm:ss"){return(0,te.default)(e,t,!0).isValid()}function Ot(e){return/^[1-9]\d{5}(?:18|19|20)\d{2}(?:0[1-9]|1[0-2])(?:0[1-9]|[12]\d|3[01])\d{3}[\dX]$/i.test(e)&&re(e.slice(6,14),"YYYYMMDD")}0&&(module.exports={base64Decode,base64Encode,castArray,compose,composeRight,debounce,debugWarn,debugWarnInvalidTypeMessage,decimalToBinary,deepClone,deepMerge,deprecated,generateRandomArray,generateRandomColor,generateRandomDate,generateRandomEmail,generateRandomFloat,generateRandomIdCard,generateRandomMobilePhone,generateRandomStringFromSource,getRandomInt,getRandomItem,getRandomString,getRandomUrl,hasChanged,isArray,isBoolean,isChineseString,isDate,isDateString,isDef,isEmail,isEmptyString,isEnglishAphabet,isFloat,isFunction,isIdCard,isInteger,isLowerCase,isLowerCaseAndNumber,isLowerCaseAndNumberAndChinese,isMap,isMobilePhone,isNegativeFloat,isNegativeInteger,isNonNegativeFloat,isNonNegativeInteger,isNonPositiveFloat,isNonPositiveInteger,isNull,isNumber,isNumberOrNumberString,isObject,isObjectLike,isPlainObject,isPositiveFloat,isPositiveInteger,isPromise,isRegExp,isSet,isString,isSymbol,isURL,isUndef,isUndefined,isUpperCase,isUpperCaseAndNumber,isUpperCaseAndNumberAndChinese,objectToString,omit,pick,qs,throttle,throwError,throwErrorInvalidTypeMessage,toTypeString,toTypeValue,validatorChineseOrEnglish,validatorChineseOrEnglishOrNumber,validatorUppercaseOrNumbersOrSpecial,validatorUppercaseOrNumbersOrUnderline,withRetry});
|
|
1
|
+
"use strict";var me=Object.create;var N=Object.defineProperty;var ce=Object.getOwnPropertyDescriptor;var fe=Object.getOwnPropertyNames;var ue=Object.getPrototypeOf,pe=Object.prototype.hasOwnProperty;var le=(e,t)=>{for(var r in t)N(e,r,{get:t[r],enumerable:!0})},V=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of fe(t))!pe.call(e,o)&&o!==r&&N(e,o,{get:()=>t[o],enumerable:!(n=ce(t,o))||n.enumerable});return e};var Y=(e,t,r)=>(r=e!=null?me(ue(e)):{},V(t||!e||!e.__esModule?N(r,"default",{value:e,enumerable:!0}):r,e)),ge=e=>V(N({},"__esModule",{value:!0}),e);var Tt={};le(Tt,{UtilsError:()=>k,base64Decode:()=>we,base64Encode:()=>Oe,castArray:()=>w,compose:()=>Ae,composeRight:()=>$e,debounce:()=>Re,debugWarn:()=>H,debugWarnInvalidTypeMessage:()=>Me,decimalToBinary:()=>he,deepClone:()=>$,deepMerge:()=>G,deprecated:()=>Ee,generateRandomArray:()=>Ke,generateRandomColor:()=>Be,generateRandomDate:()=>v,generateRandomEmail:()=>oe,generateRandomFloat:()=>Ve,generateRandomIdCard:()=>Qe,generateRandomMobilePhone:()=>Je,generateRandomStringFromSource:()=>F,getRandomInt:()=>f,getRandomItem:()=>p,getRandomString:()=>d,getRandomUrl:()=>et,hasChanged:()=>ye,isArray:()=>g,isBoolean:()=>U,isChineseString:()=>ct,isDate:()=>B,isDateString:()=>se,isDef:()=>be,isEmail:()=>$t,isEmptyString:()=>Rt,isEnglishAphabet:()=>rt,isFloat:()=>ft,isFunction:()=>M,isIdCard:()=>St,isInteger:()=>dt,isLowerCase:()=>st,isLowerCaseAndNumber:()=>at,isLowerCaseAndNumberAndChinese:()=>mt,isMap:()=>L,isMobilePhone:()=>wt,isNegativeFloat:()=>lt,isNegativeInteger:()=>yt,isNonNegativeFloat:()=>pt,isNonNegativeInteger:()=>bt,isNonPositiveFloat:()=>gt,isNonPositiveInteger:()=>ht,isNull:()=>xe,isNumber:()=>u,isNumberOrNumberString:()=>tt,isObject:()=>de,isObjectLike:()=>j,isPlainObject:()=>x,isPositiveFloat:()=>ut,isPositiveInteger:()=>xt,isPromise:()=>z,isRegExp:()=>W,isSet:()=>K,isString:()=>P,isStringNumber:()=>Ot,isSymbol:()=>_,isURL:()=>At,isUndef:()=>A,isUndefined:()=>S,isUpperCase:()=>nt,isUpperCaseAndNumber:()=>ot,isUpperCaseAndNumberAndChinese:()=>it,objectToString:()=>Q,omit:()=>Le,pick:()=>Z,qs:()=>Ne,throttle:()=>De,throwError:()=>s,throwErrorInvalidTypeMessage:()=>je,toTypeString:()=>O,toTypeValue:()=>D,validatorChineseOrEnglish:()=>Ce,validatorChineseOrEnglishOrNumber:()=>Ie,validatorUppercaseOrNumbersOrSpecial:()=>ve,validatorUppercaseOrNumbersOrUnderline:()=>Fe,withRetry:()=>Ye});module.exports=ge(Tt);function de(e){let t=typeof e;return e!==null&&(t==="object"||t==="function")}function j(e){return e!==null&&typeof e=="object"}var Q=Object.prototype.toString,O=e=>Q.call(e),D=e=>O(e).slice(8,-1),P=e=>typeof e=="string",u=e=>typeof e=="number"&&Number.isFinite(e),U=e=>typeof e=="boolean",xe=e=>e===null,S=e=>e===void 0,_=e=>typeof e=="symbol",g=Array.isArray,M=e=>typeof e=="function",L=e=>O(e)==="[object Map]",K=e=>O(e)==="[object Set]",B=e=>O(e)==="[object Date]",W=e=>O(e)==="[object RegExp]",z=e=>j(e)&&M(e?.then)&&M(e?.catch),A=e=>e==null,be=e=>e!=null,ye=(e,t)=>e!==t;function x(e){return O(e)==="[object Object]"}function w(e){return g(e)?e:[e]}function he(e){let t=[],r,n="";for(;e>0;)r=Math.floor(e%2),t.push(r),e=Math.floor(e/2);for(;t.length>0;)n+=t.pop().toString();return n}var J="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function Oe(e){let t="",r="";for(let o=0;o<e.length;o++)r+=e[o].charCodeAt(0).toString(2).padStart(8,"0");for(let o=0;o<r.length;o+=6)t+=J[Number.parseInt(r.slice(o,o+6).padEnd(6,"0"),2)];let n=t.length%4;return n!==0&&(t+="=".repeat(4-n)),t}function we(e){let t="",r="";for(let n=0;n<e.length&&e[n]!=="=";n++)r+=J.indexOf(e[n]).toString(2).padStart(6,"0");for(let n=0;n<r.length;n+=8){let o=Number.parseInt(r.slice(n,n+8),2);o&&(t+=String.fromCharCode(o))}return t}function Ae(...e){return e.reduce((t,r)=>function(...n){return r(t(...n))})}function $e(...e){return e.reduce((t,r)=>function(...n){return t(r(...n))})}function Re(e,t=500){let r=null;return function(...n){r&&clearTimeout(r),r=setTimeout(()=>{e.apply(this,n)},t)}}function $(e){let t=new WeakMap;function r(n){if(!j(n))return n;if(B(n))return new Date(n);if(W(n))return new RegExp(n);if(z(n))return n;if(t.has(n))return t.get(n);if(L(n)){let a=new Map;return t.set(n,a),n.forEach((c,l)=>a.set(r(l),r(c))),a}if(K(n)){let a=new Set;return t.set(n,a),n.forEach(c=>a.add(r(c))),a}let o=g(n)?Object.setPrototypeOf([],Object.getPrototypeOf(n)):Object.create(Object.getPrototypeOf(n));t.set(n,o);let m=Object.getOwnPropertyDescriptors(n);for(let a of Reflect.ownKeys(m)){let c=m[a];c.get||c.set?Object.defineProperty(o,a,c):Object.defineProperty(o,a,{...c,value:r(c.value)})}return o}return r(e)}function G(e,t,r={}){return te(ee(e,r),ee(t,r),r)}function te(e,t,r){return g(e)?Te(e,t,r):Se(e,t,r)}function Se(e,t,r){if(!x(t))return t;let n=Object.getOwnPropertyDescriptors(t);return Reflect.ownKeys(t).forEach(o=>{(x(e[o])||g(e[o]))&&(x(t[o])||g(t[o]))?e[o]=te(e[o],t[o],r):Object.defineProperty(e,o,n[o])}),e}function Te(e,t,r){let{mergeStrategy:n="replace"}=r;if(g(t))switch(n){case"merge":return e.concat(t);case"replace":return t;default:return t}return t}function ee(e,t){let{deepClone:r=!0}=t;return r?$(e):e}var k=class extends Error{constructor(t,r="Utils"){super(t),this.name=r}};function s(e,t){throw new k(`[${e}] ${t}`)}function H(e,t){let r=P(e)?new k(`[${e}] ${t}`,"UtilsWarn"):e;console.warn(r)}var Ee=({from:e,replacement:t,version:r,type:n="API"})=>{H(`${n}`,`${e} is about to be deprecated in version ${r}, please use ${t} instead.`)};function je(e,t,r,n){let o=`Invalid params: type check failed for params "${t}". Expected ${r}, got ${D(n)} with value ${n}.`;s(e,o)}function Me(e,t,r,n){let o=`Invalid params: type check failed for params "${t}". Expected ${r}, got ${D(n)} with value ${n}.`;H(e,o)}var I=(e,t,...r)=>{if(!t)return;let n=r.length===0?"":r.length===1?r[0]:r;console[e](`[Log] ${t}:`,n)},C=(e,...t)=>{I("info",e,...t)};C.info=(e,...t)=>{I("info",e,...t)};C.error=(e,...t)=>{I("error",e,...t)};C.warn=(e,...t)=>{I("warn",e,...t)};typeof globalThis<"u"&&(globalThis.log=C);function Pe(e,t){let{decode:r=!0}=t||{},n={};e.startsWith("?")&&(e=e.slice(1)),e.includes("?")&&(e=e.slice(e.indexOf("?")+1));let o=e.split("&").filter(Boolean);for(let m of o){let[a,c]=m.split("=");n[a]=r?decodeURIComponent(c):c}return n}function re(e,t){let{encode:r=!0}=t||{},n=[];for(let o in e){let m=e[o];n.push(`${o}=${r?encodeURIComponent(m):m}`)}return n.join("&")}function ke(e,t,r){let n=G({encode:!0},{...r}),o=re(t,n);return e.includes("?")?e.endsWith("?")||e.endsWith("&")?`${e}${o}`:`${e}&${o}`:`${e}?${o}`}var Ne={parse:Pe,stringify:re,appendQueryString:ke};function De(e,t=500){let r=null;return function(...n){if(A(r))return r=Date.now(),e.apply(this,n);let o=Date.now();if(o-r>=t)return r=o,e.apply(this,n)}}function Ie(e){return!A(e)&&/^[\dA-Z\u4E00-\u9FA5]+$/i.test(e)}function Ce(e){return!A(e)&&/^[A-Z\u4E00-\u9FA5]+$/i.test(e)}function ve(e){return!A(e)&&/^[\d!"#$%&'()*+,./:;<=>?@A-Z[\\\]^_`{|}~]+$/.test(e)}function Fe(e){return/^[\dA-Z_]+$/.test(e)}function Ye(e){Ue(e);let{fn:t,maxAttempts:r=3,retryDelay:n=1e3,enableExponentialBackoff:o=!1,signal:m}=e,a,c=m?new Promise((T,h)=>{let E=()=>h(new Error("Operation Cancelled"));m.addEventListener("abort",E),a=()=>m.removeEventListener("abort",E)}):null;return new Promise((T,h)=>{(async()=>{for(let y=1;y<=r;y++){if(m?.aborted)return h(new Error("Operation Cancelled"));try{let R=await Promise.race(c?[t(),c]:[t()]);return T(R)}catch(R){let q=o?n*2**(y-1):n;if(log("withRetry",`Attempt ${y}/${r} failed. Retrying in ${q}ms...`),R instanceof Error&&R.message==="Operation Cancelled"||y===r)return h(R);await new Promise(ae=>setTimeout(ae,q))}}})()}).finally(()=>a?.())}function Ue(e){x(e)||s("withRetry",'"Options" must be an object'),typeof e.fn!="function"&&s("withRetry",'"fn" must be a function that returns a Promise'),!S(e.maxAttempts)&&(!Number.isInteger(e.maxAttempts)||e.maxAttempts<1)&&s("withRetry",'"maxAttempts" must be a positive integer'),!S(e.retryDelay)&&(!u(e.retryDelay)||e.retryDelay<0)&&s("withRetry",'"retryDelay" must be a non-negative number'),!S(e.enableExponentialBackoff)&&!U(e.enableExponentialBackoff)&&s("withRetry",'"enableExponentialBackoff" must be a boolean'),!S(e.signal)&&typeof e.signal!="object"&&s("withRetry",'"signal" must be an AbortSignal')}function Z(e,t,r={}){let{includeProto:n=!1,includeSymbols:o=!0,includeNonEnum:m=!1}=r,a={};return x(e)&&w(t).forEach(l=>{_(l)&&!o||!(n?l in e:Object.hasOwn(e,l))||!m&&(n?_e(e,l):Object.getOwnPropertyDescriptor(e,l))?.enumerable===!1||(a[l]=$(e[l]))}),a}function _e(e,t){let r=e;for(;r!==null;){let n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=Object.getPrototypeOf(r)}}function Le(e,t){if(!x(e))return{};let r=$(e),n=w(t),o=Object.keys(r).filter(m=>!n.includes(m));return Z(r,o)}function Ke(e,t){return(!u(e)||e<=0)&&s("generateRandomArray","num must be greater than 0"),M(t)||s("generateRandomArray","cb must be a function"),Array.from({length:e}).fill(0).map((r,n)=>t(r,n))}function Be(){return`#${Math.random().toString(16).slice(2,8).padEnd(6,"0")}`}var b=Y(require("dayjs"),1),ne=Y(require("dayjs/plugin/customParseFormat.js"),1);function p(e){return e[Math.floor(Math.random()*e.length)]}function f(e={}){u(e)&&(e={max:e});let{min:t=1,max:r=p(ze())}=e;We(t,r);let n=Math.ceil(t),o=Math.floor(r);return Math.floor(Math.random()*(o-n+1)+n)}function We(e,t){let r=Math.ceil(e),n=Math.floor(t);Number.isSafeInteger(r)||s("getRandomInt",`The minimum value Math.ceil(${e}) should be a safe integer`),Number.isSafeInteger(n)||s("getRandomInt",`The maximum value Math.floor(${t}) should be a safe integer`),n<r&&(t>=e&&s("getRandomInt",`No integer value found between ${e} and ${t}`),s("getRandomInt",`The maximum value ${t} should be greater than the minimum value ${e}`))}function ze(){return Array.from({length:Number.MAX_SAFE_INTEGER.toString().length}).map((e,t)=>{let r=Number.MAX_SAFE_INTEGER.toString().slice(0,t+1);return Number(r)})}b.default.extend(ne.default);function v(e={}){let{start:t="1800-01-01 00:00:00",end:r=(0,b.default)().format("YYYY-MM-DD HH:mm:ss"),format:n="YYYY-MM-DD HH:mm:ss"}=e;(!(0,b.default)(t).isValid()||!(0,b.default)(r).isValid())&&s("generateRandomDate","start and end parameters must be valid date format");let o=(0,b.default)(t).year(),m=(0,b.default)(r).year(),a=f({min:o,max:m}),c=f({min:1,max:12}),l=f({min:1,max:31}),T=f(23),h=f(59),E=f(59),y=(0,b.default)(`${a}-${c}-${l} ${T}:${h}:${E}`);return y.isBefore((0,b.default)(t))||y.isAfter((0,b.default)(r))?v(e):y.format(n)}function d(e={}){let t=He(e),r=Ze(t);Xe(r);let{length:n}=t;qe(n.min,n.max);let o=f(n),m=t.prefix||"";for(let a=0;a<o;a++)m+=r.charAt(Math.floor(Math.random()*r.length));return m+(t.suffix||"")}var Ge=16,X=1;function He(e){let t=u(e);return{lowerCase:!0,upperCase:!0,number:!0,...t?{}:e,length:t?{max:e,min:e}:u(e.length)?{max:e.length,min:e.length}:{max:Ge,min:X,...e.length},extra:t?[]:[...new Set(w(e.extra||[]))]}}function Ze(e){let t="";return e.lowerCase&&(t+="abcdefghijklmnopqrstuvwxyz"),e.upperCase&&(t+="ABCDEFGHIJKLMNOPQRSTUVWXYZ"),e.number&&(t+="0123456789"),t+=w(e.extra).join(""),t}function Xe(e){e.length===0&&s("getRandomString","At least one character set (lowercase, uppercase, number) must be enabled or extra characters provided")}function qe(e,t){Number.isInteger(e)||s("getRandomString","min must be an integer"),Number.isInteger(t)||s("getRandomString","max must be an integer"),e<X&&s("getRandomString",`Minimum length cannot be less than ${X}`),t<e&&s("getRandomString","Maximum length cannot be less than minimum length")}function oe(){let e=["gmail.com","outlook.com.cn","example.com","qq.com","163.com","test.com.cn"],t=`${d(1)}${d({length:f({max:30,min:1})})}${d(1)}@${p(e)}`;return/\.{2,}/.test(t)?oe():t}function Ve(e={}){u(e)&&(e={max:e});let{min:t=0,max:r=1,fractionDigits:n=2}=e;if(t===r)return t;if(t>r)throw new Error(`Maximum value ${r} should be greater than minimum value ${t}`);return Math.random()*(r-t)+t}function F(e,t){(!u(e)||e<=0)&&s("generateRandomStringFromSource","num must be greater than 0"),(!g(t)||t.length===0)&&s("generateRandomStringFromSource","source cannot be empty array");let r="";for(let n=0;n<e;n++)r+=p(t);return r}function Qe(){let e=f({min:1e5,max:999999}),t=[0,1,2,3,4,5,6,7,8,9];return[e,v({format:"YYYYMMDD"}),F(3,t),F(1,[...t,"X","x"])].join("")}function Je(){return p(["13","14","15","16","17","18","19"])+f(999999999).toString().padEnd(9,"0")}function et(){let e=["http://","https://"],t=[".com",".net",".org",".cn",".top"],r=[`?name=${d({length:{min:4,max:8}})}`,`?id=${f()}`,`?page=${d({length:{min:2,max:4}})}`,`?query=${d({length:{min:5,max:6}})}`,`?search=${d({length:{min:1,max:4}})}`,`?token=${d({length:{min:16,max:16}})}`];return`${p(e)}${d({length:{min:5,max:25}})}${p(t)}${p(r)}`}function tt(e){return/^\d+$/.test(e)}function rt(e){return/^[A-Z]+$/i.test(e)}function nt(e){return/^[A-Z]+$/.test(e)}function ot(e){return/^[\dA-Z]+$/.test(e)}function it(e){return/^[\dA-Z\u4E00-\u9FA5]+$/.test(e)}function st(e){return/^[a-z]+$/.test(e)}function at(e){return/^[\da-z]+$/.test(e)}function mt(e){return/^[\da-z\u4E00-\u9FA5]+$/.test(e)}function ct(e){return/^[\u4E00-\u9FA5]+$/.test(e)}function ft(e){return/^-?(?:0|[1-9]\d*)\.\d+$/.test(e)}function ut(e){return/^(?:0\.0*[1-9]\d*|[1-9]\d*\.\d+)$/.test(e)}function pt(e){return/^(?:0|[1-9]\d*)\.\d+$/.test(e)}function lt(e){return/^-(?:0\.0*[1-9]\d*|[1-9]\d*\.\d+)$/.test(e)}function gt(e){return/^-(?:0|[1-9]\d*)\.\d+$/.test(e)}function dt(e){return/^-?(?:0|[1-9]\d*)$/.test(e)}function xt(e){return/^[1-9]\d*$/.test(e)}function bt(e){return/^(?:0|[1-9]\d*)$/.test(e)&&!Object.is(e,-0)}function yt(e){return/^-[1-9]\d*$/.test(e)}function ht(e){return/^-(?:0|[1-9]\d*)$/.test(e)||Object.is(e,-0)}var Ot=e=>{if(!P(e))return!1;let t=e.trim();if(t===""||t.includes("e")||t.includes("E")||t.includes("0x")||t.includes("0X")||t.includes("0o")||t.includes("0O")||t.includes("0b")||t.includes("0B"))return!1;let r=Number(t);return!(!Number.isFinite(r)||r>Number.MAX_SAFE_INTEGER||r<Number.MIN_SAFE_INTEGER)};var ie=Y(require("dayjs"),1);function wt(e){return/^1[3-9]\d{9}$/.test(e)}function At(e){return/^https?:\/\/\S+$/i.test(e)}function $t(e){return/^[^\s@]+@[^\s@][^\s.@]*\.[^\s@]+$/.test(e)}function Rt(e){return e===""}function se(e,t="YYYY-MM-DD HH:mm:ss"){return(0,ie.default)(e,t,!0).isValid()}function St(e){return/^[1-9]\d{5}(?:18|19|20)\d{2}(?:0[1-9]|1[0-2])(?:0[1-9]|[12]\d|3[01])\d{3}[\dX]$/i.test(e)&&se(e.slice(6,14),"YYYYMMDD")}0&&(module.exports={UtilsError,base64Decode,base64Encode,castArray,compose,composeRight,debounce,debugWarn,debugWarnInvalidTypeMessage,decimalToBinary,deepClone,deepMerge,deprecated,generateRandomArray,generateRandomColor,generateRandomDate,generateRandomEmail,generateRandomFloat,generateRandomIdCard,generateRandomMobilePhone,generateRandomStringFromSource,getRandomInt,getRandomItem,getRandomString,getRandomUrl,hasChanged,isArray,isBoolean,isChineseString,isDate,isDateString,isDef,isEmail,isEmptyString,isEnglishAphabet,isFloat,isFunction,isIdCard,isInteger,isLowerCase,isLowerCaseAndNumber,isLowerCaseAndNumberAndChinese,isMap,isMobilePhone,isNegativeFloat,isNegativeInteger,isNonNegativeFloat,isNonNegativeInteger,isNonPositiveFloat,isNonPositiveInteger,isNull,isNumber,isNumberOrNumberString,isObject,isObjectLike,isPlainObject,isPositiveFloat,isPositiveInteger,isPromise,isRegExp,isSet,isString,isStringNumber,isSymbol,isURL,isUndef,isUndefined,isUpperCase,isUpperCaseAndNumber,isUpperCaseAndNumberAndChinese,objectToString,omit,pick,qs,throttle,throwError,throwErrorInvalidTypeMessage,toTypeString,toTypeValue,validatorChineseOrEnglish,validatorChineseOrEnglishOrNumber,validatorUppercaseOrNumbersOrSpecial,validatorUppercaseOrNumbersOrUnderline,withRetry});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var Xt=Object.create;var jt=Object.defineProperty;var qt=Object.getOwnPropertyDescriptor;var Gt=Object.getOwnPropertyNames;var Jt=Object.getPrototypeOf,Qt=Object.prototype.hasOwnProperty;var te=(t,e)=>()=>(t&&(e=t(t=0)),e);var Rt=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var ee=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Gt(e))!Qt.call(t,i)&&i!==n&&jt(t,i,{get:()=>e[i],enumerable:!(r=qt(e,i))||r.enumerable});return t};var $t=(t,e,n)=>(n=t!=null?Xt(Jt(t)):{},ee(e||!t||!t.__esModule?jt(n,"default",{value:t,enumerable:!0}):n,t));import $e from"path";import{fileURLToPath as Me}from"url";var o=te(()=>{"use strict"});var St=Rt((Mt,Ot)=>{"use strict";o();(function(t,e){typeof Mt=="object"&&typeof Ot<"u"?Ot.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs=e()})(Mt,function(){"use strict";var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",$="minute",h="hour",M="day",x="week",A="month",_="quarter",j="year",H="date",ut="Invalid Date",g=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,w=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,v={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(f){var a=["th","st","nd","rd"],s=f%100;return"["+f+(a[(s-20)%10]||a[s]||a[0])+"]"}},S=function(f,a,s){var c=String(f);return!c||c.length>=a?f:""+Array(a+1-c.length).join(s)+f},z={s:S,z:function(f){var a=-f.utcOffset(),s=Math.abs(a),c=Math.floor(s/60),u=s%60;return(a<=0?"+":"-")+S(c,2,"0")+":"+S(u,2,"0")},m:function f(a,s){if(a.date()<s.date())return-f(s,a);var c=12*(s.year()-a.year())+(s.month()-a.month()),u=a.clone().add(c,A),m=s-u<0,p=a.clone().add(c+(m?-1:1),A);return+(-(c+(s-u)/(m?u-p:p-u))||0)},a:function(f){return f<0?Math.ceil(f)||0:Math.floor(f)},p:function(f){return{M:A,y:j,w:x,d:M,D:H,h,m:$,s:i,ms:r,Q:_}[f]||String(f||"").toLowerCase().replace(/s$/,"")},u:function(f){return f===void 0}},P="en",F={};F[P]=v;var X="$isDayjsObject",U=function(f){return f instanceof C||!(!f||!f[X])},I=function f(a,s,c){var u;if(!a)return P;if(typeof a=="string"){var m=a.toLowerCase();F[m]&&(u=m),s&&(F[m]=s,u=m);var p=a.split("-");if(!u&&p.length>1)return f(p[0])}else{var y=a.name;F[y]=a,u=y}return!c&&u&&(P=u),u||!c&&P},O=function(f,a){if(U(f))return f.clone();var s=typeof a=="object"?a:{};return s.date=f,s.args=arguments,new C(s)},b=z;b.l=I,b.i=U,b.w=function(f,a){return O(f,{locale:a.$L,utc:a.$u,x:a.$x,$offset:a.$offset})};var C=function(){function f(s){this.$L=I(s.locale,null,!0),this.parse(s),this.$x=this.$x||s.x||{},this[X]=!0}var a=f.prototype;return a.parse=function(s){this.$d=function(c){var u=c.date,m=c.utc;if(u===null)return new Date(NaN);if(b.u(u))return new Date;if(u instanceof Date)return new Date(u);if(typeof u=="string"&&!/Z$/i.test(u)){var p=u.match(g);if(p){var y=p[2]-1||0,D=(p[7]||"0").substring(0,3);return m?new Date(Date.UTC(p[1],y,p[3]||1,p[4]||0,p[5]||0,p[6]||0,D)):new Date(p[1],y,p[3]||1,p[4]||0,p[5]||0,p[6]||0,D)}}return new Date(u)}(s),this.init()},a.init=function(){var s=this.$d;this.$y=s.getFullYear(),this.$M=s.getMonth(),this.$D=s.getDate(),this.$W=s.getDay(),this.$H=s.getHours(),this.$m=s.getMinutes(),this.$s=s.getSeconds(),this.$ms=s.getMilliseconds()},a.$utils=function(){return b},a.isValid=function(){return this.$d.toString()!==ut},a.isSame=function(s,c){var u=O(s);return this.startOf(c)<=u&&u<=this.endOf(c)},a.isAfter=function(s,c){return O(s)<this.startOf(c)},a.isBefore=function(s,c){return this.endOf(c)<O(s)},a.$g=function(s,c,u){return b.u(s)?this[c]:this.set(u,s)},a.unix=function(){return Math.floor(this.valueOf()/1e3)},a.valueOf=function(){return this.$d.getTime()},a.startOf=function(s,c){var u=this,m=!!b.u(c)||c,p=b.p(s),y=function(q,Y){var W=b.w(u.$u?Date.UTC(u.$y,Y,q):new Date(u.$y,Y,q),u);return m?W:W.endOf(M)},D=function(q,Y){return b.w(u.toDate()[q].apply(u.toDate("s"),(m?[0,0,0,0]:[23,59,59,999]).slice(Y)),u)},T=this.$W,R=this.$M,L=this.$D,tt="set"+(this.$u?"UTC":"");switch(p){case j:return m?y(1,0):y(31,11);case A:return m?y(1,R):y(0,R+1);case x:var J=this.$locale().weekStart||0,rt=(T<J?T+7:T)-J;return y(m?L-rt:L+(6-rt),R);case M:case H:return D(tt+"Hours",0);case h:return D(tt+"Minutes",1);case $:return D(tt+"Seconds",2);case i:return D(tt+"Milliseconds",3);default:return this.clone()}},a.endOf=function(s){return this.startOf(s,!1)},a.$set=function(s,c){var u,m=b.p(s),p="set"+(this.$u?"UTC":""),y=(u={},u[M]=p+"Date",u[H]=p+"Date",u[A]=p+"Month",u[j]=p+"FullYear",u[h]=p+"Hours",u[$]=p+"Minutes",u[i]=p+"Seconds",u[r]=p+"Milliseconds",u)[m],D=m===M?this.$D+(c-this.$W):c;if(m===A||m===j){var T=this.clone().set(H,1);T.$d[y](D),T.init(),this.$d=T.set(H,Math.min(this.$D,T.daysInMonth())).$d}else y&&this.$d[y](D);return this.init(),this},a.set=function(s,c){return this.clone().$set(s,c)},a.get=function(s){return this[b.p(s)]()},a.add=function(s,c){var u,m=this;s=Number(s);var p=b.p(c),y=function(R){var L=O(m);return b.w(L.date(L.date()+Math.round(R*s)),m)};if(p===A)return this.set(A,this.$M+s);if(p===j)return this.set(j,this.$y+s);if(p===M)return y(1);if(p===x)return y(7);var D=(u={},u[$]=e,u[h]=n,u[i]=t,u)[p]||1,T=this.$d.getTime()+s*D;return b.w(T,this)},a.subtract=function(s,c){return this.add(-1*s,c)},a.format=function(s){var c=this,u=this.$locale();if(!this.isValid())return u.invalidDate||ut;var m=s||"YYYY-MM-DDTHH:mm:ssZ",p=b.z(this),y=this.$H,D=this.$m,T=this.$M,R=u.weekdays,L=u.months,tt=u.meridiem,J=function(Y,W,Q,et){return Y&&(Y[W]||Y(c,m))||Q[W].slice(0,et)},rt=function(Y){return b.s(y%12||12,Y,"0")},q=tt||function(Y,W,Q){var et=Y<12?"AM":"PM";return Q?et.toLowerCase():et};return m.replace(w,function(Y,W){return W||function(Q){switch(Q){case"YY":return String(c.$y).slice(-2);case"YYYY":return b.s(c.$y,4,"0");case"M":return T+1;case"MM":return b.s(T+1,2,"0");case"MMM":return J(u.monthsShort,T,L,3);case"MMMM":return J(L,T);case"D":return c.$D;case"DD":return b.s(c.$D,2,"0");case"d":return String(c.$W);case"dd":return J(u.weekdaysMin,c.$W,R,2);case"ddd":return J(u.weekdaysShort,c.$W,R,3);case"dddd":return R[c.$W];case"H":return String(y);case"HH":return b.s(y,2,"0");case"h":return rt(1);case"hh":return rt(2);case"a":return q(y,D,!0);case"A":return q(y,D,!1);case"m":return String(D);case"mm":return b.s(D,2,"0");case"s":return String(c.$s);case"ss":return b.s(c.$s,2,"0");case"SSS":return b.s(c.$ms,3,"0");case"Z":return p}return null}(Y)||p.replace(":","")})},a.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},a.diff=function(s,c,u){var m,p=this,y=b.p(c),D=O(s),T=(D.utcOffset()-this.utcOffset())*e,R=this-D,L=function(){return b.m(p,D)};switch(y){case j:m=L()/12;break;case A:m=L();break;case _:m=L()/3;break;case x:m=(R-T)/6048e5;break;case M:m=(R-T)/864e5;break;case h:m=R/n;break;case $:m=R/e;break;case i:m=R/t;break;default:m=R}return u?m:b.a(m)},a.daysInMonth=function(){return this.endOf(A).$D},a.$locale=function(){return F[this.$L]},a.locale=function(s,c){if(!s)return this.$L;var u=this.clone(),m=I(s,c,!0);return m&&(u.$L=m),u},a.clone=function(){return b.w(this.$d,this)},a.toDate=function(){return new Date(this.valueOf())},a.toJSON=function(){return this.isValid()?this.toISOString():null},a.toISOString=function(){return this.$d.toISOString()},a.toString=function(){return this.$d.toUTCString()},f}(),N=C.prototype;return O.prototype=N,[["$ms",r],["$s",i],["$m",$],["$H",h],["$W",M],["$M",A],["$y",j],["$D",H]].forEach(function(f){N[f[1]]=function(a){return this.$g(a,f[0],f[1])}}),O.extend=function(f,a){return f.$i||(f(a,C,O),f.$i=!0),O},O.locale=I,O.isDayjs=U,O.unix=function(f){return O(1e3*f)},O.en=F[P],O.Ls=F,O.p={},O})});var Kt=Rt((Dt,At)=>{"use strict";o();(function(t,e){typeof Dt=="object"&&typeof At<"u"?At.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs_plugin_customParseFormat=e()})(Dt,function(){"use strict";var t={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},e=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,n=/\d/,r=/\d\d/,i=/\d\d?/,$=/\d*[^-_:/,()\s\d]+/,h={},M=function(g){return(g=+g)+(g>68?1900:2e3)},x=function(g){return function(w){this[g]=+w}},A=[/[+-]\d\d:?(\d\d)?|Z/,function(g){(this.zone||(this.zone={})).offset=function(w){if(!w||w==="Z")return 0;var v=w.match(/([+-]|\d\d)/g),S=60*v[1]+(+v[2]||0);return S===0?0:v[0]==="+"?-S:S}(g)}],_=function(g){var w=h[g];return w&&(w.indexOf?w:w.s.concat(w.f))},j=function(g,w){var v,S=h.meridiem;if(S){for(var z=1;z<=24;z+=1)if(g.indexOf(S(z,0,w))>-1){v=z>12;break}}else v=g===(w?"pm":"PM");return v},H={A:[$,function(g){this.afternoon=j(g,!1)}],a:[$,function(g){this.afternoon=j(g,!0)}],Q:[n,function(g){this.month=3*(g-1)+1}],S:[n,function(g){this.milliseconds=100*+g}],SS:[r,function(g){this.milliseconds=10*+g}],SSS:[/\d{3}/,function(g){this.milliseconds=+g}],s:[i,x("seconds")],ss:[i,x("seconds")],m:[i,x("minutes")],mm:[i,x("minutes")],H:[i,x("hours")],h:[i,x("hours")],HH:[i,x("hours")],hh:[i,x("hours")],D:[i,x("day")],DD:[r,x("day")],Do:[$,function(g){var w=h.ordinal,v=g.match(/\d+/);if(this.day=v[0],w)for(var S=1;S<=31;S+=1)w(S).replace(/\[|\]/g,"")===g&&(this.day=S)}],w:[i,x("week")],ww:[r,x("week")],M:[i,x("month")],MM:[r,x("month")],MMM:[$,function(g){var w=_("months"),v=(_("monthsShort")||w.map(function(S){return S.slice(0,3)})).indexOf(g)+1;if(v<1)throw new Error;this.month=v%12||v}],MMMM:[$,function(g){var w=_("months").indexOf(g)+1;if(w<1)throw new Error;this.month=w%12||w}],Y:[/[+-]?\d+/,x("year")],YY:[r,function(g){this.year=M(g)}],YYYY:[/\d{4}/,x("year")],Z:A,ZZ:A};function ut(g){var w,v;w=g,v=h&&h.formats;for(var S=(g=w.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(O,b,C){var N=C&&C.toUpperCase();return b||v[C]||t[C]||v[N].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(f,a,s){return a||s.slice(1)})})).match(e),z=S.length,P=0;P<z;P+=1){var F=S[P],X=H[F],U=X&&X[0],I=X&&X[1];S[P]=I?{regex:U,parser:I}:F.replace(/^\[|\]$/g,"")}return function(O){for(var b={},C=0,N=0;C<z;C+=1){var f=S[C];if(typeof f=="string")N+=f.length;else{var a=f.regex,s=f.parser,c=O.slice(N),u=a.exec(c)[0];s.call(b,u),O=O.replace(u,"")}}return function(m){var p=m.afternoon;if(p!==void 0){var y=m.hours;p?y<12&&(m.hours+=12):y===12&&(m.hours=0),delete m.afternoon}}(b),b}}return function(g,w,v){v.p.customParseFormat=!0,g&&g.parseTwoDigitYear&&(M=g.parseTwoDigitYear);var S=w.prototype,z=S.parse;S.parse=function(P){var F=P.date,X=P.utc,U=P.args;this.$u=X;var I=U[1];if(typeof I=="string"){var O=U[2]===!0,b=U[3]===!0,C=O||b,N=U[2];b&&(N=U[2]),h=this.$locale(),!O&&N&&(h=v.Ls[N]),this.$d=function(c,u,m,p){try{if(["x","X"].indexOf(u)>-1)return new Date((u==="X"?1e3:1)*c);var y=ut(u)(c),D=y.year,T=y.month,R=y.day,L=y.hours,tt=y.minutes,J=y.seconds,rt=y.milliseconds,q=y.zone,Y=y.week,W=new Date,Q=R||(D||T?1:W.getDate()),et=D||W.getFullYear(),ct=0;D&&!T||(ct=T>0?T-1:W.getMonth());var ft,ht=L||0,yt=tt||0,xt=J||0,bt=rt||0;return q?new Date(Date.UTC(et,ct,Q,ht,yt,xt,bt+60*q.offset*1e3)):m?new Date(Date.UTC(et,ct,Q,ht,yt,xt,bt)):(ft=new Date(et,ct,Q,ht,yt,xt,bt),Y&&(ft=p(ft).week(Y).toDate()),ft)}catch{return new Date("")}}(F,I,X,v),this.init(),N&&N!==!0&&(this.$L=this.locale(N).$L),C&&F!=this.format(I)&&(this.$d=new Date("")),h={}}else if(I instanceof Array)for(var f=I.length,a=1;a<=f;a+=1){U[1]=I[a-1];var s=v.apply(this,U);if(s.isValid()){this.$d=s.$d,this.$L=s.$L,this.init();break}a===f&&(this.$d=new Date(""))}else z.call(this,P)}}})});o();o();o();o();o();function Se(t){let e=typeof t;return t!==null&&(e==="object"||e==="function")}o();function mt(t){return t!==null&&typeof t=="object"}o();o();var ne=Object.prototype.toString,ot=t=>ne.call(t),wt=t=>ot(t).slice(8,-1),Yt=t=>typeof t=="string",K=t=>typeof t=="number"&&Number.isFinite(t),je=t=>typeof t=="boolean",Re=t=>t===null,Ye=t=>t===void 0,Et=t=>typeof t=="symbol",V=Array.isArray,pt=t=>typeof t=="function",Pt=t=>ot(t)==="[object Map]",Ct=t=>ot(t)==="[object Set]",It=t=>ot(t)==="[object Date]",Nt=t=>ot(t)==="[object RegExp]",Lt=t=>mt(t)&&pt(t?.then)&&pt(t?.catch),st=t=>t==null,Ee=t=>t!=null,Pe=(t,e)=>t!==e;function nt(t){return ot(t)==="[object Object]"}function it(t){return V(t)?t:[t]}o();o();o();o();o();function Je(t){let e=[],n,r="";for(;t>0;)n=Math.floor(t%2),e.push(n),t=Math.floor(t/2);for(;e.length>0;)r+=e.pop().toString();return r}var _t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function Qe(t){let e="",n="";for(let i=0;i<t.length;i++)n+=t[i].charCodeAt(0).toString(2).padStart(8,"0");for(let i=0;i<n.length;i+=6)e+=_t[Number.parseInt(n.slice(i,i+6).padEnd(6,"0"),2)];let r=e.length%4;return r!==0&&(e+="=".repeat(4-r)),e}function tn(t){let e="",n="";for(let r=0;r<t.length&&t[r]!=="=";r++)n+=_t.indexOf(t[r]).toString(2).padStart(6,"0");for(let r=0;r<n.length;r+=8){let i=Number.parseInt(n.slice(r,r+8),2);i&&(e+=String.fromCharCode(i))}return e}o();function rn(...t){return t.reduce((e,n)=>function(...r){return n(e(...r))})}function on(...t){return t.reduce((e,n)=>function(...r){return e(n(...r))})}o();function un(t,e=500){let n=null;return function(...r){n&&clearTimeout(n),n=setTimeout(()=>{t.apply(this,r)},e)}}o();function at(t){let e=new WeakMap;function n(r){if(!mt(r))return r;if(It(r))return new Date(r);if(Nt(r))return new RegExp(r);if(Lt(r))return r;if(e.has(r))return e.get(r);if(Pt(r)){let h=new Map;return e.set(r,h),r.forEach((M,x)=>h.set(n(x),n(M))),h}if(Ct(r)){let h=new Set;return e.set(r,h),r.forEach(M=>h.add(n(M))),h}let i=V(r)?Object.setPrototypeOf([],Object.getPrototypeOf(r)):Object.create(Object.getPrototypeOf(r));e.set(r,i);let $=Object.getOwnPropertyDescriptors(r);for(let h of Reflect.ownKeys($)){let M=$[h];M.get||M.set?Object.defineProperty(i,h,M):Object.defineProperty(i,h,{...M,value:n(M.value)})}return i}return n(t)}o();function Ut(t,e,n={}){return Ht(Ft(t,n),Ft(e,n),n)}function Ht(t,e,n){return V(t)?oe(t,e,n):re(t,e,n)}function re(t,e,n){if(!nt(e))return e;let r=Object.getOwnPropertyDescriptors(e);return Reflect.ownKeys(e).forEach(i=>{(nt(t[i])||V(t[i]))&&(nt(e[i])||V(e[i]))?t[i]=Ht(t[i],e[i],n):Object.defineProperty(t,i,r[i])}),t}function oe(t,e,n){let{mergeStrategy:r="replace"}=n;if(V(e))switch(r){case"merge":return t.concat(e);case"replace":return e;default:return e}return e}function Ft(t,e){let{deepClone:n=!0}=e;return n?at(t):t}o();var dt=class extends Error{constructor(e,n="Utils"){super(e),this.name=n}};function k(t,e){throw new dt(`[${t}] ${e}`)}function Wt(t,e){let n=Yt(t)?new dt(`[${t}] ${e}`,"UtilsWarn"):t;console.warn(n)}var bn=({from:t,replacement:e,version:n,type:r="API"})=>{Wt(`${r}`,`${t} is about to be deprecated in version ${n}, please use ${e} instead.`)};function $n(t,e,n,r){let i=`Invalid params: type check failed for params "${e}". Expected ${n}, got ${wt(r)} with value ${r}.`;k(t,i)}function wn(t,e,n,r){let i=`Invalid params: type check failed for params "${e}". Expected ${n}, got ${wt(r)} with value ${r}.`;Wt(t,i)}o();var lt=(t,e,...n)=>{if(!e)return;let r=n.length===0?"":n.length===1?n[0]:n;console[t](`[Log] ${e}:`,r)},gt=(t,...e)=>{lt("info",t,...e)};gt.info=(t,...e)=>{lt("info",t,...e)};gt.error=(t,...e)=>{lt("error",t,...e)};gt.warn=(t,...e)=>{lt("warn",t,...e)};typeof globalThis<"u"&&(globalThis.log=gt);o();function ie(t,e){let{decode:n=!0}=e||{},r={};t.startsWith("?")&&(t=t.slice(1)),t.includes("?")&&(t=t.slice(t.indexOf("?")+1));let i=t.split("&").filter(Boolean);for(let $ of i){let[h,M]=$.split("=");r[h]=n?decodeURIComponent(M):M}return r}function Zt(t,e){let{encode:n=!0}=e||{},r=[];for(let i in t){let $=t[i];r.push(`${i}=${n?encodeURIComponent($):$}`)}return r.join("&")}function se(t,e,n){let r=Ut({encode:!0},{...n}),i=Zt(e,r);return t.includes("?")?t.endsWith("?")||t.endsWith("&")?`${t}${i}`:`${t}&${i}`:`${t}?${i}`}var An={parse:ie,stringify:Zt,appendQueryString:se};o();function jn(t,e=500){let n=null;return function(...r){if(st(n))return n=Date.now(),t.apply(this,r);let i=Date.now();if(i-n>=e)return n=i,t.apply(this,r)}}o();function Pn(t){return!st(t)&&/^[\dA-Z\u4E00-\u9FA5]+$/i.test(t)}function Cn(t){return!st(t)&&/^[A-Z\u4E00-\u9FA5]+$/i.test(t)}function In(t){return!st(t)&&/^[\d!"#$%&'()*+,./:;<=>?@A-Z[\\\]^_`{|}~]+$/.test(t)}function Nn(t){return/^[\dA-Z_]+$/.test(t)}o();async function Fn(t){let{fn:e,maxAttempts:n=3,retryDelay:r=1e3,enableExponentialBackoff:i=!1,signal:$}=t,h,M=new Promise((A,_)=>{if($){let j=()=>_(new Error("Operation Cancelled"));$.addEventListener("abort",j),h=()=>$.removeEventListener("abort",j)}}),x=0;try{for(;;){if(console.log("while: ",x),$?.aborted)throw new Error("Operation Cancelled");try{return await Promise.race([e(),M])}catch(A){if(A instanceof Error&&A.message==="Operation Cancelled"||(x++,x>=n))throw A;let _=i?r*2**(x-1):r;await new Promise(j=>setTimeout(j,_))}}}finally{h?.()}}function zt(t,e,n={}){let{includeProto:r=!1,includeSymbols:i=!0,includeNonEnum:$=!1}=n,h={};return nt(t)&&it(e).forEach(x=>{Et(x)&&!i||!(r?x in t:Object.hasOwn(t,x))||!$&&(r?ae(t,x):Object.getOwnPropertyDescriptor(t,x))?.enumerable===!1||(h[x]=at(t[x]))}),h}function ae(t,e){let n=t;for(;n!==null;){let r=Object.getOwnPropertyDescriptor(n,e);if(r)return r;n=Object.getPrototypeOf(n)}}function mr(t,e){if(!nt(t))return{};let n=at(t),r=it(e),i=Object.keys(n).filter($=>!r.includes($));return zt(n,i)}o();o();function $r(t,e){return(!K(t)||t<=0)&&k("generateRandomArray","num \u5FC5\u987B\u5927\u4E8E0"),pt(e)||k("generateRandomArray","cb \u5FC5\u987B\u662F\u51FD\u6570"),Array.from({length:t}).fill(0).map((n,r)=>e(n,r))}o();function Or(){return`#${Math.random().toString(16).slice(2,8).padEnd(6,"0")}`}o();var G=$t(St(),1),Vt=$t(Kt(),1);o();o();function Z(t){return t[Math.floor(Math.random()*t.length)]}function E(t={}){K(t)&&(t={max:t});let{min:e=1,max:n=Z(ce())}=t;ue(e,n);let r=Math.ceil(e),i=Math.floor(n);return Math.floor(Math.random()*(i-r+1)+r)}function ue(t,e){let n=Math.ceil(t),r=Math.floor(e);Number.isSafeInteger(n)||k("getRandomInt",`The minimum value Math.ceil(${t}) should be a safe integer`),Number.isSafeInteger(r)||k("getRandomInt",`The maximum value Math.floor(${e}) should be a safe integer`),r<n&&(e>=t&&k("getRandomInt",`No integer value found between ${t} and ${e}`),k("getRandomInt",`The maximum value ${e} should be greater than the minimum value ${t}`))}function ce(){return Array.from({length:Number.MAX_SAFE_INTEGER.toString().length}).map((t,e)=>{let n=Number.MAX_SAFE_INTEGER.toString().slice(0,e+1);return Number(n)})}G.default.extend(Vt.default);function vt(t={}){let{start:e="1800-01-01 00:00:00",end:n=(0,G.default)().format("YYYY-MM-DD HH:mm:ss"),format:r="YYYY-MM-DD HH:mm:ss"}=t;(!(0,G.default)(e).isValid()||!(0,G.default)(n).isValid())&&k("generateRandomDate","start end \u53C2\u6570\u5FC5\u987B\u662F\u5408\u6CD5\u7684\u65F6\u95F4\u683C\u5F0F");let i=(0,G.default)(e).year(),$=(0,G.default)(n).year(),h=E({min:i,max:$}),M=E({min:1,max:12}),x=E({min:1,max:31}),A=E(23),_=E(59),j=E(59),H=(0,G.default)(`${h}-${M}-${x} ${A}:${_}:${j}`);return H.isBefore((0,G.default)(e))||H.isAfter((0,G.default)(n))?vt(t):H.format(r)}o();o();function B(t={}){let e=me(t),n=pe(e);de(n);let{length:r}=e;le(r.min,r.max);let i=E(r),$=e.prefix||"";for(let h=0;h<i;h++)$+=n.charAt(Math.floor(Math.random()*n.length));return $+(e.suffix||"")}var fe=16,Tt=1;function me(t){let e=K(t);return{lowerCase:!0,upperCase:!0,number:!0,...e?{}:t,length:e?{max:t,min:t}:K(t.length)?{max:t.length,min:t.length}:{max:fe,min:Tt,...t.length},extra:e?[]:[...new Set(it(t.extra||[]))]}}function pe(t){let e="";return t.lowerCase&&(e+="abcdefghijklmnopqrstuvwxyz"),t.upperCase&&(e+="ABCDEFGHIJKLMNOPQRSTUVWXYZ"),t.number&&(e+="0123456789"),e+=it(t.extra).join(""),e}function de(t){t.length===0&&k("getRandomString","At least one character set (lowercase, uppercase, number) must be enabled or extra characters provided")}function le(t,e){Number.isInteger(t)||k("getRandomString","min must be an integer"),Number.isInteger(e)||k("getRandomString","max must be an integer"),t<Tt&&k("getRandomString",`Minimum length cannot be less than ${Tt}`),e<t&&k("getRandomString","Maximum length cannot be less than minimum length")}function ge(){let t=["gmail.com","outlook.com.cn","example.com","qq.com","163.com","test.com.cn"],e=`${B(1)}${B({length:E({max:30,min:1})})}${B(1)}@${Z(t)}`;return/\.{2,}/.test(e)?ge():e}o();function Gr(t={}){K(t)&&(t={max:t});let{min:e=0,max:n=1,fractionDigits:r=2}=t;if(e===n)return e;if(e>n)throw new Error(`\u6700\u5927\u503C ${n} \u5E94\u5927\u4E8E\u6700\u5C0F\u503C ${e}`);return Math.random()*(n-e)+e}o();o();function kt(t,e){(!K(t)||t<=0)&&k("generateRandomStringFromSource","num \u5FC5\u987B\u5927\u4E8E0"),(!V(e)||e.length===0)&&k("generateRandomStringFromSource","source \u4E0D\u80FD\u4E3A\u7A7A\u6570\u7EC4");let n="";for(let r=0;r<t;r++)n+=Z(e);return n}function uo(){let t=E({min:1e5,max:999999}),e=[0,1,2,3,4,5,6,7,8,9];return[t,vt({format:"YYYYMMDD"}),kt(3,e),kt(1,[...e,"X","x"])].join("")}o();function lo(){return Z(["13","14","15","16","17","18","19"])+E(999999999).toString().padEnd(9,"0")}o();function $o(){let t=["http://","https://"],e=[".com",".net",".org",".cn",".top"],n=[`?name=${B({length:{min:4,max:8}})}`,`?id=${E()}`,`?page=${B({length:{min:2,max:4}})}`,`?query=${B({length:{min:5,max:6}})}`,`?search=${B({length:{min:1,max:4}})}`,`?token=${B({length:{min:16,max:16}})}`];return`${Z(t)}${B({length:{min:5,max:25}})}${Z(e)}${Z(n)}`}o();o();o();o();function Fo(t){return/^\d+$/.test(t)}function Uo(t){return/^[A-Z]+$/i.test(t)}function Ho(t){return/^[A-Z]+$/.test(t)}function Wo(t){return/^[\dA-Z]+$/.test(t)}function Zo(t){return/^[\dA-Z\u4E00-\u9FA5]+$/.test(t)}function zo(t){return/^[a-z]+$/.test(t)}function Ko(t){return/^[\da-z]+$/.test(t)}function Vo(t){return/^[\da-z\u4E00-\u9FA5]+$/.test(t)}function Bo(t){return/^[\u4E00-\u9FA5]+$/.test(t)}o();function Go(t){return/^-?(?:0|[1-9]\d*)\.\d+$/.test(t)}function Jo(t){return/^(?:0\.0*[1-9]\d*|[1-9]\d*\.\d+)$/.test(t)}function Qo(t){return/^(?:0|[1-9]\d*)\.\d+$/.test(t)}function ti(t){return/^-(?:0\.0*[1-9]\d*|[1-9]\d*\.\d+)$/.test(t)}function ei(t){return/^-(?:0|[1-9]\d*)\.\d+$/.test(t)}o();function oi(t){return/^-?(?:0|[1-9]\d*)$/.test(t)}function ii(t){return/^[1-9]\d*$/.test(t)}function si(t){return/^(?:0|[1-9]\d*)$/.test(t)&&!Object.is(t,-0)}function ai(t){return/^-[1-9]\d*$/.test(t)}function ui(t){return/^-(?:0|[1-9]\d*)$/.test(t)||Object.is(t,-0)}o();var Bt=$t(St(),1);function mi(t){return/^1[3-9]\d{9}$/.test(t)}function pi(t){return/^https?:\/\/\S+$/i.test(t)}function di(t){return/^[^\s@]+@[^\s@][^\s.@]*\.[^\s@]+$/.test(t)}function li(t){return t===""}function he(t,e="YYYY-MM-DD HH:mm:ss"){return(0,Bt.default)(t,e,!0).isValid()}function gi(t){return/^[1-9]\d{5}(?:18|19|20)\d{2}(?:0[1-9]|1[0-2])(?:0[1-9]|[12]\d|3[01])\d{3}[\dX]$/i.test(t)&&he(t.slice(6,14),"YYYYMMDD")}export{tn as base64Decode,Qe as base64Encode,it as castArray,rn as compose,on as composeRight,un as debounce,Wt as debugWarn,wn as debugWarnInvalidTypeMessage,Je as decimalToBinary,at as deepClone,Ut as deepMerge,bn as deprecated,$r as generateRandomArray,Or as generateRandomColor,vt as generateRandomDate,ge as generateRandomEmail,Gr as generateRandomFloat,uo as generateRandomIdCard,lo as generateRandomMobilePhone,kt as generateRandomStringFromSource,E as getRandomInt,Z as getRandomItem,B as getRandomString,$o as getRandomUrl,Pe as hasChanged,V as isArray,je as isBoolean,Bo as isChineseString,It as isDate,he as isDateString,Ee as isDef,di as isEmail,li as isEmptyString,Uo as isEnglishAphabet,Go as isFloat,pt as isFunction,gi as isIdCard,oi as isInteger,zo as isLowerCase,Ko as isLowerCaseAndNumber,Vo as isLowerCaseAndNumberAndChinese,Pt as isMap,mi as isMobilePhone,ti as isNegativeFloat,ai as isNegativeInteger,Qo as isNonNegativeFloat,si as isNonNegativeInteger,ei as isNonPositiveFloat,ui as isNonPositiveInteger,Re as isNull,K as isNumber,Fo as isNumberOrNumberString,Se as isObject,mt as isObjectLike,nt as isPlainObject,Jo as isPositiveFloat,ii as isPositiveInteger,Lt as isPromise,Nt as isRegExp,Ct as isSet,Yt as isString,Et as isSymbol,pi as isURL,st as isUndef,Ye as isUndefined,Ho as isUpperCase,Wo as isUpperCaseAndNumber,Zo as isUpperCaseAndNumberAndChinese,ne as objectToString,mr as omit,zt as pick,An as qs,jn as throttle,k as throwError,$n as throwErrorInvalidTypeMessage,ot as toTypeString,wt as toTypeValue,Cn as validatorChineseOrEnglish,Pn as validatorChineseOrEnglishOrNumber,In as validatorUppercaseOrNumbersOrSpecial,Nn as validatorUppercaseOrNumbersOrUnderline,Fn as withRetry};
|
|
1
|
+
var qt=Object.create;var Et=Object.defineProperty;var Jt=Object.getOwnPropertyDescriptor;var Qt=Object.getOwnPropertyNames;var te=Object.getPrototypeOf,ee=Object.prototype.hasOwnProperty;var ne=(t,e)=>()=>(t&&(e=t(t=0)),e);var Yt=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var re=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Qt(e))!ee.call(t,i)&&i!==n&&Et(t,i,{get:()=>e[i],enumerable:!(r=Jt(e,i))||r.enumerable});return t};var Mt=(t,e,n)=>(n=t!=null?qt(te(t)):{},re(e||!t||!t.__esModule?Et(n,"default",{value:t,enumerable:!0}):n,t));import Oe from"path";import{fileURLToPath as De}from"url";var o=ne(()=>{"use strict"});var At=Yt((St,Dt)=>{"use strict";o();(function(t,e){typeof St=="object"&&typeof Dt<"u"?Dt.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs=e()})(St,function(){"use strict";var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",x="minute",h="hour",M="day",$="week",R="month",N="quarter",E="year",k="date",K="Invalid Date",l=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,w=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,v={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(f){var a=["th","st","nd","rd"],s=f%100;return"["+f+(a[(s-20)%10]||a[s]||a[0])+"]"}},D=function(f,a,s){var c=String(f);return!c||c.length>=a?f:""+Array(a+1-c.length).join(s)+f},B={s:D,z:function(f){var a=-f.utcOffset(),s=Math.abs(a),c=Math.floor(s/60),u=s%60;return(a<=0?"+":"-")+D(c,2,"0")+":"+D(u,2,"0")},m:function f(a,s){if(a.date()<s.date())return-f(s,a);var c=12*(s.year()-a.year())+(s.month()-a.month()),u=a.clone().add(c,R),m=s-u<0,p=a.clone().add(c+(m?-1:1),R);return+(-(c+(s-u)/(m?u-p:p-u))||0)},a:function(f){return f<0?Math.ceil(f)||0:Math.floor(f)},p:function(f){return{M:R,y:E,w:$,d:M,D:k,h,m:x,s:i,ms:r,Q:N}[f]||String(f||"").toLowerCase().replace(/s$/,"")},u:function(f){return f===void 0}},C="en",U={};U[C]=v;var G="$isDayjsObject",H=function(f){return f instanceof I||!(!f||!f[G])},_=function f(a,s,c){var u;if(!a)return C;if(typeof a=="string"){var m=a.toLowerCase();U[m]&&(u=m),s&&(U[m]=s,u=m);var p=a.split("-");if(!u&&p.length>1)return f(p[0])}else{var y=a.name;U[y]=a,u=y}return!c&&u&&(C=u),u||!c&&C},S=function(f,a){if(H(f))return f.clone();var s=typeof a=="object"?a:{};return s.date=f,s.args=arguments,new I(s)},b=B;b.l=_,b.i=H,b.w=function(f,a){return S(f,{locale:a.$L,utc:a.$u,x:a.$x,$offset:a.$offset})};var I=function(){function f(s){this.$L=_(s.locale,null,!0),this.parse(s),this.$x=this.$x||s.x||{},this[G]=!0}var a=f.prototype;return a.parse=function(s){this.$d=function(c){var u=c.date,m=c.utc;if(u===null)return new Date(NaN);if(b.u(u))return new Date;if(u instanceof Date)return new Date(u);if(typeof u=="string"&&!/Z$/i.test(u)){var p=u.match(l);if(p){var y=p[2]-1||0,A=(p[7]||"0").substring(0,3);return m?new Date(Date.UTC(p[1],y,p[3]||1,p[4]||0,p[5]||0,p[6]||0,A)):new Date(p[1],y,p[3]||1,p[4]||0,p[5]||0,p[6]||0,A)}}return new Date(u)}(s),this.init()},a.init=function(){var s=this.$d;this.$y=s.getFullYear(),this.$M=s.getMonth(),this.$D=s.getDate(),this.$W=s.getDay(),this.$H=s.getHours(),this.$m=s.getMinutes(),this.$s=s.getSeconds(),this.$ms=s.getMilliseconds()},a.$utils=function(){return b},a.isValid=function(){return this.$d.toString()!==K},a.isSame=function(s,c){var u=S(s);return this.startOf(c)<=u&&u<=this.endOf(c)},a.isAfter=function(s,c){return S(s)<this.startOf(c)},a.isBefore=function(s,c){return this.endOf(c)<S(s)},a.$g=function(s,c,u){return b.u(s)?this[c]:this.set(u,s)},a.unix=function(){return Math.floor(this.valueOf()/1e3)},a.valueOf=function(){return this.$d.getTime()},a.startOf=function(s,c){var u=this,m=!!b.u(c)||c,p=b.p(s),y=function(q,Y){var Z=b.w(u.$u?Date.UTC(u.$y,Y,q):new Date(u.$y,Y,q),u);return m?Z:Z.endOf(M)},A=function(q,Y){return b.w(u.toDate()[q].apply(u.toDate("s"),(m?[0,0,0,0]:[23,59,59,999]).slice(Y)),u)},T=this.$W,j=this.$M,F=this.$D,nt="set"+(this.$u?"UTC":"");switch(p){case E:return m?y(1,0):y(31,11);case R:return m?y(1,j):y(0,j+1);case $:var tt=this.$locale().weekStart||0,ot=(T<tt?T+7:T)-tt;return y(m?F-ot:F+(6-ot),j);case M:case k:return A(nt+"Hours",0);case h:return A(nt+"Minutes",1);case x:return A(nt+"Seconds",2);case i:return A(nt+"Milliseconds",3);default:return this.clone()}},a.endOf=function(s){return this.startOf(s,!1)},a.$set=function(s,c){var u,m=b.p(s),p="set"+(this.$u?"UTC":""),y=(u={},u[M]=p+"Date",u[k]=p+"Date",u[R]=p+"Month",u[E]=p+"FullYear",u[h]=p+"Hours",u[x]=p+"Minutes",u[i]=p+"Seconds",u[r]=p+"Milliseconds",u)[m],A=m===M?this.$D+(c-this.$W):c;if(m===R||m===E){var T=this.clone().set(k,1);T.$d[y](A),T.init(),this.$d=T.set(k,Math.min(this.$D,T.daysInMonth())).$d}else y&&this.$d[y](A);return this.init(),this},a.set=function(s,c){return this.clone().$set(s,c)},a.get=function(s){return this[b.p(s)]()},a.add=function(s,c){var u,m=this;s=Number(s);var p=b.p(c),y=function(j){var F=S(m);return b.w(F.date(F.date()+Math.round(j*s)),m)};if(p===R)return this.set(R,this.$M+s);if(p===E)return this.set(E,this.$y+s);if(p===M)return y(1);if(p===$)return y(7);var A=(u={},u[x]=e,u[h]=n,u[i]=t,u)[p]||1,T=this.$d.getTime()+s*A;return b.w(T,this)},a.subtract=function(s,c){return this.add(-1*s,c)},a.format=function(s){var c=this,u=this.$locale();if(!this.isValid())return u.invalidDate||K;var m=s||"YYYY-MM-DDTHH:mm:ssZ",p=b.z(this),y=this.$H,A=this.$m,T=this.$M,j=u.weekdays,F=u.months,nt=u.meridiem,tt=function(Y,Z,et,rt){return Y&&(Y[Z]||Y(c,m))||et[Z].slice(0,rt)},ot=function(Y){return b.s(y%12||12,Y,"0")},q=nt||function(Y,Z,et){var rt=Y<12?"AM":"PM";return et?rt.toLowerCase():rt};return m.replace(w,function(Y,Z){return Z||function(et){switch(et){case"YY":return String(c.$y).slice(-2);case"YYYY":return b.s(c.$y,4,"0");case"M":return T+1;case"MM":return b.s(T+1,2,"0");case"MMM":return tt(u.monthsShort,T,F,3);case"MMMM":return tt(F,T);case"D":return c.$D;case"DD":return b.s(c.$D,2,"0");case"d":return String(c.$W);case"dd":return tt(u.weekdaysMin,c.$W,j,2);case"ddd":return tt(u.weekdaysShort,c.$W,j,3);case"dddd":return j[c.$W];case"H":return String(y);case"HH":return b.s(y,2,"0");case"h":return ot(1);case"hh":return ot(2);case"a":return q(y,A,!0);case"A":return q(y,A,!1);case"m":return String(A);case"mm":return b.s(A,2,"0");case"s":return String(c.$s);case"ss":return b.s(c.$s,2,"0");case"SSS":return b.s(c.$ms,3,"0");case"Z":return p}return null}(Y)||p.replace(":","")})},a.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},a.diff=function(s,c,u){var m,p=this,y=b.p(c),A=S(s),T=(A.utcOffset()-this.utcOffset())*e,j=this-A,F=function(){return b.m(p,A)};switch(y){case E:m=F()/12;break;case R:m=F();break;case N:m=F()/3;break;case $:m=(j-T)/6048e5;break;case M:m=(j-T)/864e5;break;case h:m=j/n;break;case x:m=j/e;break;case i:m=j/t;break;default:m=j}return u?m:b.a(m)},a.daysInMonth=function(){return this.endOf(R).$D},a.$locale=function(){return U[this.$L]},a.locale=function(s,c){if(!s)return this.$L;var u=this.clone(),m=_(s,c,!0);return m&&(u.$L=m),u},a.clone=function(){return b.w(this.$d,this)},a.toDate=function(){return new Date(this.valueOf())},a.toJSON=function(){return this.isValid()?this.toISOString():null},a.toISOString=function(){return this.$d.toISOString()},a.toString=function(){return this.$d.toUTCString()},f}(),L=I.prototype;return S.prototype=L,[["$ms",r],["$s",i],["$m",x],["$H",h],["$W",M],["$M",R],["$y",E],["$D",k]].forEach(function(f){L[f[1]]=function(a){return this.$g(a,f[0],f[1])}}),S.extend=function(f,a){return f.$i||(f(a,I,S),f.$i=!0),S},S.locale=_,S.isDayjs=H,S.unix=function(f){return S(1e3*f)},S.en=U[C],S.Ls=U,S.p={},S})});var Vt=Yt((vt,Tt)=>{"use strict";o();(function(t,e){typeof vt=="object"&&typeof Tt<"u"?Tt.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs_plugin_customParseFormat=e()})(vt,function(){"use strict";var t={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},e=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,n=/\d/,r=/\d\d/,i=/\d\d?/,x=/\d*[^-_:/,()\s\d]+/,h={},M=function(l){return(l=+l)+(l>68?1900:2e3)},$=function(l){return function(w){this[l]=+w}},R=[/[+-]\d\d:?(\d\d)?|Z/,function(l){(this.zone||(this.zone={})).offset=function(w){if(!w||w==="Z")return 0;var v=w.match(/([+-]|\d\d)/g),D=60*v[1]+(+v[2]||0);return D===0?0:v[0]==="+"?-D:D}(l)}],N=function(l){var w=h[l];return w&&(w.indexOf?w:w.s.concat(w.f))},E=function(l,w){var v,D=h.meridiem;if(D){for(var B=1;B<=24;B+=1)if(l.indexOf(D(B,0,w))>-1){v=B>12;break}}else v=l===(w?"pm":"PM");return v},k={A:[x,function(l){this.afternoon=E(l,!1)}],a:[x,function(l){this.afternoon=E(l,!0)}],Q:[n,function(l){this.month=3*(l-1)+1}],S:[n,function(l){this.milliseconds=100*+l}],SS:[r,function(l){this.milliseconds=10*+l}],SSS:[/\d{3}/,function(l){this.milliseconds=+l}],s:[i,$("seconds")],ss:[i,$("seconds")],m:[i,$("minutes")],mm:[i,$("minutes")],H:[i,$("hours")],h:[i,$("hours")],HH:[i,$("hours")],hh:[i,$("hours")],D:[i,$("day")],DD:[r,$("day")],Do:[x,function(l){var w=h.ordinal,v=l.match(/\d+/);if(this.day=v[0],w)for(var D=1;D<=31;D+=1)w(D).replace(/\[|\]/g,"")===l&&(this.day=D)}],w:[i,$("week")],ww:[r,$("week")],M:[i,$("month")],MM:[r,$("month")],MMM:[x,function(l){var w=N("months"),v=(N("monthsShort")||w.map(function(D){return D.slice(0,3)})).indexOf(l)+1;if(v<1)throw new Error;this.month=v%12||v}],MMMM:[x,function(l){var w=N("months").indexOf(l)+1;if(w<1)throw new Error;this.month=w%12||w}],Y:[/[+-]?\d+/,$("year")],YY:[r,function(l){this.year=M(l)}],YYYY:[/\d{4}/,$("year")],Z:R,ZZ:R};function K(l){var w,v;w=l,v=h&&h.formats;for(var D=(l=w.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(S,b,I){var L=I&&I.toUpperCase();return b||v[I]||t[I]||v[L].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(f,a,s){return a||s.slice(1)})})).match(e),B=D.length,C=0;C<B;C+=1){var U=D[C],G=k[U],H=G&&G[0],_=G&&G[1];D[C]=_?{regex:H,parser:_}:U.replace(/^\[|\]$/g,"")}return function(S){for(var b={},I=0,L=0;I<B;I+=1){var f=D[I];if(typeof f=="string")L+=f.length;else{var a=f.regex,s=f.parser,c=S.slice(L),u=a.exec(c)[0];s.call(b,u),S=S.replace(u,"")}}return function(m){var p=m.afternoon;if(p!==void 0){var y=m.hours;p?y<12&&(m.hours+=12):y===12&&(m.hours=0),delete m.afternoon}}(b),b}}return function(l,w,v){v.p.customParseFormat=!0,l&&l.parseTwoDigitYear&&(M=l.parseTwoDigitYear);var D=w.prototype,B=D.parse;D.parse=function(C){var U=C.date,G=C.utc,H=C.args;this.$u=G;var _=H[1];if(typeof _=="string"){var S=H[2]===!0,b=H[3]===!0,I=S||b,L=H[2];b&&(L=H[2]),h=this.$locale(),!S&&L&&(h=v.Ls[L]),this.$d=function(c,u,m,p){try{if(["x","X"].indexOf(u)>-1)return new Date((u==="X"?1e3:1)*c);var y=K(u)(c),A=y.year,T=y.month,j=y.day,F=y.hours,nt=y.minutes,tt=y.seconds,ot=y.milliseconds,q=y.zone,Y=y.week,Z=new Date,et=j||(A||T?1:Z.getDate()),rt=A||Z.getFullYear(),ft=0;A&&!T||(ft=T>0?T-1:Z.getMonth());var mt,bt=F||0,xt=nt||0,$t=tt||0,wt=ot||0;return q?new Date(Date.UTC(rt,ft,et,bt,xt,$t,wt+60*q.offset*1e3)):m?new Date(Date.UTC(rt,ft,et,bt,xt,$t,wt)):(mt=new Date(rt,ft,et,bt,xt,$t,wt),Y&&(mt=p(mt).week(Y).toDate()),mt)}catch{return new Date("")}}(U,_,G,v),this.init(),L&&L!==!0&&(this.$L=this.locale(L).$L),I&&U!=this.format(_)&&(this.$d=new Date("")),h={}}else if(_ instanceof Array)for(var f=_.length,a=1;a<=f;a+=1){H[1]=_[a-1];var s=v.apply(this,H);if(s.isValid()){this.$d=s.$d,this.$L=s.$L,this.init();break}a===f&&(this.$d=new Date(""))}else B.call(this,C)}}})});o();o();o();o();o();function ve(t){let e=typeof t;return t!==null&&(e==="object"||e==="function")}o();function pt(t){return t!==null&&typeof t=="object"}o();o();var oe=Object.prototype.toString,it=t=>oe.call(t),Ot=t=>it(t).slice(8,-1),dt=t=>typeof t=="string",W=t=>typeof t=="number"&&Number.isFinite(t),Pt=t=>typeof t=="boolean",Ye=t=>t===null,ct=t=>t===void 0,Nt=t=>typeof t=="symbol",V=Array.isArray,lt=t=>typeof t=="function",Ct=t=>it(t)==="[object Map]",It=t=>it(t)==="[object Set]",_t=t=>it(t)==="[object Date]",Lt=t=>it(t)==="[object RegExp]",Ft=t=>pt(t)&<(t?.then)&<(t?.catch),at=t=>t==null,Pe=t=>t!=null,Ne=(t,e)=>t!==e;function J(t){return it(t)==="[object Object]"}function st(t){return V(t)?t:[t]}o();o();o();o();o();function Qe(t){let e=[],n,r="";for(;t>0;)n=Math.floor(t%2),e.push(n),t=Math.floor(t/2);for(;e.length>0;)r+=e.pop().toString();return r}var Ut="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function tn(t){let e="",n="";for(let i=0;i<t.length;i++)n+=t[i].charCodeAt(0).toString(2).padStart(8,"0");for(let i=0;i<n.length;i+=6)e+=Ut[Number.parseInt(n.slice(i,i+6).padEnd(6,"0"),2)];let r=e.length%4;return r!==0&&(e+="=".repeat(4-r)),e}function en(t){let e="",n="";for(let r=0;r<t.length&&t[r]!=="=";r++)n+=Ut.indexOf(t[r]).toString(2).padStart(6,"0");for(let r=0;r<n.length;r+=8){let i=Number.parseInt(n.slice(r,r+8),2);i&&(e+=String.fromCharCode(i))}return e}o();function on(...t){return t.reduce((e,n)=>function(...r){return n(e(...r))})}function sn(...t){return t.reduce((e,n)=>function(...r){return e(n(...r))})}o();function cn(t,e=500){let n=null;return function(...r){n&&clearTimeout(n),n=setTimeout(()=>{t.apply(this,r)},e)}}o();function ut(t){let e=new WeakMap;function n(r){if(!pt(r))return r;if(_t(r))return new Date(r);if(Lt(r))return new RegExp(r);if(Ft(r))return r;if(e.has(r))return e.get(r);if(Ct(r)){let h=new Map;return e.set(r,h),r.forEach((M,$)=>h.set(n($),n(M))),h}if(It(r)){let h=new Set;return e.set(r,h),r.forEach(M=>h.add(n(M))),h}let i=V(r)?Object.setPrototypeOf([],Object.getPrototypeOf(r)):Object.create(Object.getPrototypeOf(r));e.set(r,i);let x=Object.getOwnPropertyDescriptors(r);for(let h of Reflect.ownKeys(x)){let M=x[h];M.get||M.set?Object.defineProperty(i,h,M):Object.defineProperty(i,h,{...M,value:n(M.value)})}return i}return n(t)}o();function Wt(t,e,n={}){return Zt(Ht(t,n),Ht(e,n),n)}function Zt(t,e,n){return V(t)?se(t,e,n):ie(t,e,n)}function ie(t,e,n){if(!J(e))return e;let r=Object.getOwnPropertyDescriptors(e);return Reflect.ownKeys(e).forEach(i=>{(J(t[i])||V(t[i]))&&(J(e[i])||V(e[i]))?t[i]=Zt(t[i],e[i],n):Object.defineProperty(t,i,r[i])}),t}function se(t,e,n){let{mergeStrategy:r="replace"}=n;if(V(e))switch(r){case"merge":return t.concat(e);case"replace":return e;default:return e}return e}function Ht(t,e){let{deepClone:n=!0}=e;return n?ut(t):t}o();var gt=class extends Error{constructor(e,n="Utils"){super(e),this.name=n}};function O(t,e){throw new gt(`[${t}] ${e}`)}function zt(t,e){let n=dt(t)?new gt(`[${t}] ${e}`,"UtilsWarn"):t;console.warn(n)}var $n=({from:t,replacement:e,version:n,type:r="API"})=>{zt(`${r}`,`${t} is about to be deprecated in version ${n}, please use ${e} instead.`)};function wn(t,e,n,r){let i=`Invalid params: type check failed for params "${e}". Expected ${n}, got ${Ot(r)} with value ${r}.`;O(t,i)}function Mn(t,e,n,r){let i=`Invalid params: type check failed for params "${e}". Expected ${n}, got ${Ot(r)} with value ${r}.`;zt(t,i)}o();var ht=(t,e,...n)=>{if(!e)return;let r=n.length===0?"":n.length===1?n[0]:n;console[t](`[Log] ${e}:`,r)},yt=(t,...e)=>{ht("info",t,...e)};yt.info=(t,...e)=>{ht("info",t,...e)};yt.error=(t,...e)=>{ht("error",t,...e)};yt.warn=(t,...e)=>{ht("warn",t,...e)};typeof globalThis<"u"&&(globalThis.log=yt);o();function ae(t,e){let{decode:n=!0}=e||{},r={};t.startsWith("?")&&(t=t.slice(1)),t.includes("?")&&(t=t.slice(t.indexOf("?")+1));let i=t.split("&").filter(Boolean);for(let x of i){let[h,M]=x.split("=");r[h]=n?decodeURIComponent(M):M}return r}function Kt(t,e){let{encode:n=!0}=e||{},r=[];for(let i in t){let x=t[i];r.push(`${i}=${n?encodeURIComponent(x):x}`)}return r.join("&")}function ue(t,e,n){let r=Wt({encode:!0},{...n}),i=Kt(e,r);return t.includes("?")?t.endsWith("?")||t.endsWith("&")?`${t}${i}`:`${t}&${i}`:`${t}?${i}`}var vn={parse:ae,stringify:Kt,appendQueryString:ue};o();function jn(t,e=500){let n=null;return function(...r){if(at(n))return n=Date.now(),t.apply(this,r);let i=Date.now();if(i-n>=e)return n=i,t.apply(this,r)}}o();function Nn(t){return!at(t)&&/^[\dA-Z\u4E00-\u9FA5]+$/i.test(t)}function Cn(t){return!at(t)&&/^[A-Z\u4E00-\u9FA5]+$/i.test(t)}function In(t){return!at(t)&&/^[\d!"#$%&'()*+,./:;<=>?@A-Z[\\\]^_`{|}~]+$/.test(t)}function _n(t){return/^[\dA-Z_]+$/.test(t)}o();function Wn(t){ce(t);let{fn:e,maxAttempts:n=3,retryDelay:r=1e3,enableExponentialBackoff:i=!1,signal:x}=t,h,M=x?new Promise((R,N)=>{let E=()=>N(new Error("Operation Cancelled"));x.addEventListener("abort",E),h=()=>x.removeEventListener("abort",E)}):null;return new Promise((R,N)=>{(async()=>{for(let k=1;k<=n;k++){if(x?.aborted)return N(new Error("Operation Cancelled"));try{let K=await Promise.race(M?[e(),M]:[e()]);return R(K)}catch(K){let l=i?r*2**(k-1):r;if(log("withRetry",`Attempt ${k}/${n} failed. Retrying in ${l}ms...`),K instanceof Error&&K.message==="Operation Cancelled"||k===n)return N(K);await new Promise(w=>setTimeout(w,l))}}})()}).finally(()=>h?.())}function ce(t){J(t)||O("withRetry",'"Options" must be an object'),typeof t.fn!="function"&&O("withRetry",'"fn" must be a function that returns a Promise'),!ct(t.maxAttempts)&&(!Number.isInteger(t.maxAttempts)||t.maxAttempts<1)&&O("withRetry",'"maxAttempts" must be a positive integer'),!ct(t.retryDelay)&&(!W(t.retryDelay)||t.retryDelay<0)&&O("withRetry",'"retryDelay" must be a non-negative number'),!ct(t.enableExponentialBackoff)&&!Pt(t.enableExponentialBackoff)&&O("withRetry",'"enableExponentialBackoff" must be a boolean'),!ct(t.signal)&&typeof t.signal!="object"&&O("withRetry",'"signal" must be an AbortSignal')}function Bt(t,e,n={}){let{includeProto:r=!1,includeSymbols:i=!0,includeNonEnum:x=!1}=n,h={};return J(t)&&st(e).forEach($=>{Nt($)&&!i||!(r?$ in t:Object.hasOwn(t,$))||!x&&(r?fe(t,$):Object.getOwnPropertyDescriptor(t,$))?.enumerable===!1||(h[$]=ut(t[$]))}),h}function fe(t,e){let n=t;for(;n!==null;){let r=Object.getOwnPropertyDescriptor(n,e);if(r)return r;n=Object.getPrototypeOf(n)}}function dr(t,e){if(!J(t))return{};let n=ut(t),r=st(e),i=Object.keys(n).filter(x=>!r.includes(x));return Bt(n,i)}o();o();function Or(t,e){return(!W(t)||t<=0)&&O("generateRandomArray","num must be greater than 0"),lt(e)||O("generateRandomArray","cb must be a function"),Array.from({length:t}).fill(0).map((n,r)=>e(n,r))}o();function Ar(){return`#${Math.random().toString(16).slice(2,8).padEnd(6,"0")}`}o();var Q=Mt(At(),1),Xt=Mt(Vt(),1);o();o();function z(t){return t[Math.floor(Math.random()*t.length)]}function P(t={}){W(t)&&(t={max:t});let{min:e=1,max:n=z(pe())}=t;me(e,n);let r=Math.ceil(e),i=Math.floor(n);return Math.floor(Math.random()*(i-r+1)+r)}function me(t,e){let n=Math.ceil(t),r=Math.floor(e);Number.isSafeInteger(n)||O("getRandomInt",`The minimum value Math.ceil(${t}) should be a safe integer`),Number.isSafeInteger(r)||O("getRandomInt",`The maximum value Math.floor(${e}) should be a safe integer`),r<n&&(e>=t&&O("getRandomInt",`No integer value found between ${t} and ${e}`),O("getRandomInt",`The maximum value ${e} should be greater than the minimum value ${t}`))}function pe(){return Array.from({length:Number.MAX_SAFE_INTEGER.toString().length}).map((t,e)=>{let n=Number.MAX_SAFE_INTEGER.toString().slice(0,e+1);return Number(n)})}Q.default.extend(Xt.default);function Rt(t={}){let{start:e="1800-01-01 00:00:00",end:n=(0,Q.default)().format("YYYY-MM-DD HH:mm:ss"),format:r="YYYY-MM-DD HH:mm:ss"}=t;(!(0,Q.default)(e).isValid()||!(0,Q.default)(n).isValid())&&O("generateRandomDate","start and end parameters must be valid date format");let i=(0,Q.default)(e).year(),x=(0,Q.default)(n).year(),h=P({min:i,max:x}),M=P({min:1,max:12}),$=P({min:1,max:31}),R=P(23),N=P(59),E=P(59),k=(0,Q.default)(`${h}-${M}-${$} ${R}:${N}:${E}`);return k.isBefore((0,Q.default)(e))||k.isAfter((0,Q.default)(n))?Rt(t):k.format(r)}o();o();function X(t={}){let e=de(t),n=ge(e);he(n);let{length:r}=e;ye(r.min,r.max);let i=P(r),x=e.prefix||"";for(let h=0;h<i;h++)x+=n.charAt(Math.floor(Math.random()*n.length));return x+(e.suffix||"")}var le=16,kt=1;function de(t){let e=W(t);return{lowerCase:!0,upperCase:!0,number:!0,...e?{}:t,length:e?{max:t,min:t}:W(t.length)?{max:t.length,min:t.length}:{max:le,min:kt,...t.length},extra:e?[]:[...new Set(st(t.extra||[]))]}}function ge(t){let e="";return t.lowerCase&&(e+="abcdefghijklmnopqrstuvwxyz"),t.upperCase&&(e+="ABCDEFGHIJKLMNOPQRSTUVWXYZ"),t.number&&(e+="0123456789"),e+=st(t.extra).join(""),e}function he(t){t.length===0&&O("getRandomString","At least one character set (lowercase, uppercase, number) must be enabled or extra characters provided")}function ye(t,e){Number.isInteger(t)||O("getRandomString","min must be an integer"),Number.isInteger(e)||O("getRandomString","max must be an integer"),t<kt&&O("getRandomString",`Minimum length cannot be less than ${kt}`),e<t&&O("getRandomString","Maximum length cannot be less than minimum length")}function be(){let t=["gmail.com","outlook.com.cn","example.com","qq.com","163.com","test.com.cn"],e=`${X(1)}${X({length:P({max:30,min:1})})}${X(1)}@${z(t)}`;return/\.{2,}/.test(e)?be():e}o();function to(t={}){W(t)&&(t={max:t});let{min:e=0,max:n=1,fractionDigits:r=2}=t;if(e===n)return e;if(e>n)throw new Error(`Maximum value ${n} should be greater than minimum value ${e}`);return Math.random()*(n-e)+e}o();o();function jt(t,e){(!W(t)||t<=0)&&O("generateRandomStringFromSource","num must be greater than 0"),(!V(e)||e.length===0)&&O("generateRandomStringFromSource","source cannot be empty array");let n="";for(let r=0;r<t;r++)n+=z(e);return n}function mo(){let t=P({min:1e5,max:999999}),e=[0,1,2,3,4,5,6,7,8,9];return[t,Rt({format:"YYYYMMDD"}),jt(3,e),jt(1,[...e,"X","x"])].join("")}o();function yo(){return z(["13","14","15","16","17","18","19"])+P(999999999).toString().padEnd(9,"0")}o();function Oo(){let t=["http://","https://"],e=[".com",".net",".org",".cn",".top"],n=[`?name=${X({length:{min:4,max:8}})}`,`?id=${P()}`,`?page=${X({length:{min:2,max:4}})}`,`?query=${X({length:{min:5,max:6}})}`,`?search=${X({length:{min:1,max:4}})}`,`?token=${X({length:{min:16,max:16}})}`];return`${z(t)}${X({length:{min:5,max:25}})}${z(e)}${z(n)}`}o();o();o();o();function Wo(t){return/^\d+$/.test(t)}function Zo(t){return/^[A-Z]+$/i.test(t)}function zo(t){return/^[A-Z]+$/.test(t)}function Ko(t){return/^[\dA-Z]+$/.test(t)}function Bo(t){return/^[\dA-Z\u4E00-\u9FA5]+$/.test(t)}function Vo(t){return/^[a-z]+$/.test(t)}function Xo(t){return/^[\da-z]+$/.test(t)}function Go(t){return/^[\da-z\u4E00-\u9FA5]+$/.test(t)}function qo(t){return/^[\u4E00-\u9FA5]+$/.test(t)}o();function ti(t){return/^-?(?:0|[1-9]\d*)\.\d+$/.test(t)}function ei(t){return/^(?:0\.0*[1-9]\d*|[1-9]\d*\.\d+)$/.test(t)}function ni(t){return/^(?:0|[1-9]\d*)\.\d+$/.test(t)}function ri(t){return/^-(?:0\.0*[1-9]\d*|[1-9]\d*\.\d+)$/.test(t)}function oi(t){return/^-(?:0|[1-9]\d*)\.\d+$/.test(t)}o();function ai(t){return/^-?(?:0|[1-9]\d*)$/.test(t)}function ui(t){return/^[1-9]\d*$/.test(t)}function ci(t){return/^(?:0|[1-9]\d*)$/.test(t)&&!Object.is(t,-0)}function fi(t){return/^-[1-9]\d*$/.test(t)}function mi(t){return/^-(?:0|[1-9]\d*)$/.test(t)||Object.is(t,-0)}o();var gi=t=>{if(!dt(t))return!1;let e=t.trim();if(e===""||e.includes("e")||e.includes("E")||e.includes("0x")||e.includes("0X")||e.includes("0o")||e.includes("0O")||e.includes("0b")||e.includes("0B"))return!1;let n=Number(e);return!(!Number.isFinite(n)||n>Number.MAX_SAFE_INTEGER||n<Number.MIN_SAFE_INTEGER)};o();var Gt=Mt(At(),1);function bi(t){return/^1[3-9]\d{9}$/.test(t)}function xi(t){return/^https?:\/\/\S+$/i.test(t)}function $i(t){return/^[^\s@]+@[^\s@][^\s.@]*\.[^\s@]+$/.test(t)}function wi(t){return t===""}function xe(t,e="YYYY-MM-DD HH:mm:ss"){return(0,Gt.default)(t,e,!0).isValid()}function Mi(t){return/^[1-9]\d{5}(?:18|19|20)\d{2}(?:0[1-9]|1[0-2])(?:0[1-9]|[12]\d|3[01])\d{3}[\dX]$/i.test(t)&&xe(t.slice(6,14),"YYYYMMDD")}export{gt as UtilsError,en as base64Decode,tn as base64Encode,st as castArray,on as compose,sn as composeRight,cn as debounce,zt as debugWarn,Mn as debugWarnInvalidTypeMessage,Qe as decimalToBinary,ut as deepClone,Wt as deepMerge,$n as deprecated,Or as generateRandomArray,Ar as generateRandomColor,Rt as generateRandomDate,be as generateRandomEmail,to as generateRandomFloat,mo as generateRandomIdCard,yo as generateRandomMobilePhone,jt as generateRandomStringFromSource,P as getRandomInt,z as getRandomItem,X as getRandomString,Oo as getRandomUrl,Ne as hasChanged,V as isArray,Pt as isBoolean,qo as isChineseString,_t as isDate,xe as isDateString,Pe as isDef,$i as isEmail,wi as isEmptyString,Zo as isEnglishAphabet,ti as isFloat,lt as isFunction,Mi as isIdCard,ai as isInteger,Vo as isLowerCase,Xo as isLowerCaseAndNumber,Go as isLowerCaseAndNumberAndChinese,Ct as isMap,bi as isMobilePhone,ri as isNegativeFloat,fi as isNegativeInteger,ni as isNonNegativeFloat,ci as isNonNegativeInteger,oi as isNonPositiveFloat,mi as isNonPositiveInteger,Ye as isNull,W as isNumber,Wo as isNumberOrNumberString,ve as isObject,pt as isObjectLike,J as isPlainObject,ei as isPositiveFloat,ui as isPositiveInteger,Ft as isPromise,Lt as isRegExp,It as isSet,dt as isString,gi as isStringNumber,Nt as isSymbol,xi as isURL,at as isUndef,ct as isUndefined,zo as isUpperCase,Ko as isUpperCaseAndNumber,Bo as isUpperCaseAndNumberAndChinese,oe as objectToString,dr as omit,Bt as pick,vn as qs,jn as throttle,O as throwError,wn as throwErrorInvalidTypeMessage,it as toTypeString,Ot as toTypeValue,Cn as validatorChineseOrEnglish,Nn as validatorChineseOrEnglishOrNumber,In as validatorUppercaseOrNumbersOrSpecial,_n as validatorUppercaseOrNumbersOrUnderline,Wn as withRetry};
|
|
@@ -243,84 +243,84 @@ interface PickOptions {
|
|
|
243
243
|
}
|
|
244
244
|
|
|
245
245
|
/**
|
|
246
|
-
*
|
|
246
|
+
* Generate random array
|
|
247
247
|
* @example generateRandomArray(4, () => 1) => [1, 1, 1, 1]
|
|
248
248
|
* */
|
|
249
249
|
declare function generateRandomArray<T>(num: number, cb: (item?: unknown, index?: number) => T): T[];
|
|
250
250
|
|
|
251
251
|
/**
|
|
252
|
-
*
|
|
252
|
+
* Generate random color
|
|
253
253
|
* @example generateRandomColor() => '#f36a38'
|
|
254
254
|
* */
|
|
255
255
|
declare function generateRandomColor(): string;
|
|
256
256
|
|
|
257
257
|
/**
|
|
258
|
-
*
|
|
258
|
+
* Generate random date
|
|
259
259
|
* @example generateRandomDate() => '2021-07-01 08:51:34'
|
|
260
260
|
* */
|
|
261
261
|
declare function generateRandomDate(options?: GenerateRandomDate): string;
|
|
262
262
|
interface GenerateRandomDate {
|
|
263
263
|
/**
|
|
264
|
-
*
|
|
264
|
+
* Start time
|
|
265
265
|
* @default 1800-01-01 00:00:00
|
|
266
266
|
*/
|
|
267
267
|
start?: string | Date;
|
|
268
268
|
/**
|
|
269
|
-
*
|
|
270
|
-
* @default
|
|
269
|
+
* End time
|
|
270
|
+
* @default Current time
|
|
271
271
|
*/
|
|
272
272
|
end?: string | Date;
|
|
273
273
|
/**
|
|
274
|
-
*
|
|
274
|
+
* Date format
|
|
275
275
|
* @default YYYY-MM-DD HH:mm:ss
|
|
276
276
|
*/
|
|
277
277
|
format?: string;
|
|
278
278
|
}
|
|
279
279
|
|
|
280
280
|
/**
|
|
281
|
-
*
|
|
281
|
+
* Generate random email
|
|
282
282
|
* @example generateRandomEmail() => lZtJqMl0dyTO3WDGzFDO@gmail.com
|
|
283
283
|
*/
|
|
284
284
|
declare function generateRandomEmail(): string;
|
|
285
285
|
|
|
286
286
|
/**
|
|
287
|
-
*
|
|
287
|
+
* Generate random float number within range
|
|
288
288
|
* @example generateRandomFloat() => 0.35
|
|
289
289
|
* */
|
|
290
290
|
declare function generateRandomFloat(options?: GenerateRandomFloat): number;
|
|
291
291
|
type GenerateRandomFloat = number | {
|
|
292
292
|
/**
|
|
293
|
-
*
|
|
293
|
+
* Maximum value
|
|
294
294
|
* @default 1.00
|
|
295
295
|
*/
|
|
296
296
|
max?: number;
|
|
297
297
|
/**
|
|
298
|
-
*
|
|
298
|
+
* Minimum value
|
|
299
299
|
* @default 0.00
|
|
300
300
|
*/
|
|
301
301
|
min?: number;
|
|
302
302
|
/**
|
|
303
|
-
*
|
|
303
|
+
* Fraction digits
|
|
304
304
|
* @default 2
|
|
305
305
|
*/
|
|
306
306
|
fractionDigits?: number;
|
|
307
307
|
};
|
|
308
308
|
|
|
309
309
|
/**
|
|
310
|
-
*
|
|
310
|
+
* Generate random Chinese ID card number
|
|
311
311
|
* @example generateRandomIdCard() => '410304200210165258'
|
|
312
312
|
*/
|
|
313
313
|
declare function generateRandomIdCard(): string;
|
|
314
314
|
|
|
315
315
|
/**
|
|
316
|
-
*
|
|
316
|
+
* Generate random mobile phone number
|
|
317
317
|
* @example generateRandomMobilePhone() => 13012345678
|
|
318
318
|
*/
|
|
319
319
|
declare function generateRandomMobilePhone(): string;
|
|
320
320
|
|
|
321
321
|
/**
|
|
322
|
-
*
|
|
323
|
-
* @param num
|
|
322
|
+
* Generate random string from source
|
|
323
|
+
* @param num Number of times to randomly get items from source
|
|
324
324
|
* @example generateRandomStringFromSource(4, ['1', 'b', 'c', 'd', 'e']) => 'dea1'
|
|
325
325
|
* */
|
|
326
326
|
declare function generateRandomStringFromSource(num: number, source: (number | string)[]): string;
|
|
@@ -356,7 +356,7 @@ type Options$1 = {
|
|
|
356
356
|
| number;
|
|
357
357
|
|
|
358
358
|
/**
|
|
359
|
-
*
|
|
359
|
+
* Get random item from array
|
|
360
360
|
* @example getRandomItem([0, 1, 2, 3, 4]) => 2
|
|
361
361
|
*/
|
|
362
362
|
declare function getRandomItem<T>(list: T[]): T;
|
|
@@ -426,76 +426,125 @@ type Options = {
|
|
|
426
426
|
declare function getRandomUrl(): string;
|
|
427
427
|
|
|
428
428
|
/**
|
|
429
|
-
*
|
|
429
|
+
* Convert decimal to binary
|
|
430
430
|
* @example decimalToBinary(233) => '11101001'
|
|
431
431
|
*/
|
|
432
432
|
declare function decimalToBinary(decNumber: number): string;
|
|
433
433
|
/**
|
|
434
|
-
* Base64
|
|
434
|
+
* Base64 encode
|
|
435
435
|
* @example base64Encode('hello') => 'aGVsbG8='
|
|
436
436
|
*/
|
|
437
437
|
declare function base64Encode(str: string): string;
|
|
438
438
|
/**
|
|
439
|
-
* Base64
|
|
439
|
+
* Base64 decode
|
|
440
440
|
* @example base64Decode('aGVsbG8=') => 'hello'
|
|
441
441
|
*/
|
|
442
442
|
declare function base64Decode(str: string): string;
|
|
443
443
|
|
|
444
444
|
/**
|
|
445
445
|
* compose
|
|
446
|
-
* @param fns
|
|
446
|
+
* @param fns Any functions
|
|
447
447
|
*/
|
|
448
448
|
declare function compose(...fns: ((...args: any[]) => any)[]): (...args: any[]) => any;
|
|
449
449
|
/**
|
|
450
|
-
*
|
|
451
|
-
* @param fns
|
|
450
|
+
* Compose from right to left
|
|
451
|
+
* @param fns Any functions
|
|
452
452
|
*/
|
|
453
453
|
declare function composeRight(...fns: ((...args: any[]) => any)[]): (...args: any[]) => any;
|
|
454
454
|
|
|
455
455
|
/**
|
|
456
|
-
*
|
|
457
|
-
* @param target
|
|
458
|
-
* @param wait
|
|
456
|
+
* Debounce function
|
|
457
|
+
* @param target Target function
|
|
458
|
+
* @param wait Wait time, default 500ms
|
|
459
459
|
* @example debounce(() => console.log('debounce'), 500)
|
|
460
460
|
*/
|
|
461
461
|
declare function debounce(target: Function, wait?: number): (...args: any[]) => void;
|
|
462
462
|
|
|
463
463
|
/**
|
|
464
|
-
*
|
|
465
|
-
*
|
|
466
|
-
*
|
|
464
|
+
* Creates a deep clone of any value, preserving object structure and references.
|
|
465
|
+
*
|
|
466
|
+
* This utility performs a complete deep copy of the input value, handling complex nested structures,
|
|
467
|
+
* circular references, and various JavaScript types. It preserves prototype chains, property descriptors,
|
|
468
|
+
* and handles special objects like Date, RegExp, Map, Set, and more.
|
|
467
469
|
*
|
|
470
|
+
* @example
|
|
468
471
|
* deepClone({ name: 'test' }) => { name: 'test' }
|
|
472
|
+
*
|
|
473
|
+
* @example
|
|
474
|
+
* deepClone({ user: { name: 'John', data: [1, 2] } }) => { user: { name: 'John', data: [1, 2] } }
|
|
475
|
+
*
|
|
476
|
+
* @returns A deep clone of the input value with all nested references copied
|
|
477
|
+
*
|
|
478
|
+
* @remarks
|
|
479
|
+
* - Handles circular references to prevent infinite loops
|
|
480
|
+
* - Preserves prototype chains for objects and arrays
|
|
481
|
+
* - Maintains property descriptors including getters and setters
|
|
482
|
+
* - Supports Symbol properties and Symbol keys
|
|
483
|
+
* - Clones Date objects to new Date instances with same time
|
|
484
|
+
* - Clones RegExp objects maintaining their behavior
|
|
485
|
+
* - Returns Promise objects as-is (promises are not cloned)
|
|
486
|
+
* - Recursively clones Map and Set collections including their keys/values
|
|
487
|
+
* - Handles non-object-like values (primitives) by returning them directly
|
|
488
|
+
* - Preserves array subclass prototypes and custom array-like objects
|
|
489
|
+
* - Maintains all property metadata and descriptors
|
|
469
490
|
*/
|
|
470
491
|
declare function deepClone<T>(target: T): T;
|
|
471
492
|
|
|
472
493
|
/**
|
|
473
|
-
*
|
|
474
|
-
*
|
|
475
|
-
*
|
|
476
|
-
*
|
|
494
|
+
* Recursively merges two objects into a single combined object.
|
|
495
|
+
*
|
|
496
|
+
* This utility performs a deep merge operation, combining properties from a template object
|
|
497
|
+
* (default values) with a source object (user-provided values). The function handles nested
|
|
498
|
+
* objects, arrays, and preserves property descriptors. It supports different merge strategies
|
|
499
|
+
* for arrays and optional deep cloning to prevent mutation of original objects.
|
|
500
|
+
*
|
|
501
|
+
* @example
|
|
502
|
+
* deepMerge({ name: 'John', age: 25 }, { age: 30, city: 'NYC' }) => { name: 'John', age: 30, city: 'NYC' }
|
|
503
|
+
*
|
|
477
504
|
* @example
|
|
505
|
+
* deepMerge({ data: { x: 1 } }, { data: { y: 2 } }) => { data: { x: 1, y: 2 } }
|
|
478
506
|
*
|
|
479
|
-
*
|
|
507
|
+
* @returns A new merged object combining properties from both template and source
|
|
480
508
|
*
|
|
481
|
-
*
|
|
509
|
+
* @remarks
|
|
510
|
+
* - Template object provides default values and structure
|
|
511
|
+
* - Source object values override template values for matching keys
|
|
512
|
+
* - Nested objects are recursively merged rather than replaced
|
|
513
|
+
* - Arrays can be merged or replaced based on mergeStrategy option
|
|
514
|
+
* - Property descriptors (getters, setters, etc.) are preserved
|
|
515
|
+
* - Deep cloning is enabled by default to prevent original object mutation
|
|
516
|
+
* - Non-plain objects in source will replace corresponding template values
|
|
517
|
+
* - Supports Symbol properties and maintains prototype relationships
|
|
482
518
|
*/
|
|
483
519
|
declare function deepMerge(template: AnyObject, source: AnyObject, options?: DeepMergeOptions): any;
|
|
484
520
|
interface DeepMergeOptions {
|
|
485
521
|
/**
|
|
486
|
-
*
|
|
522
|
+
* Controls whether to create deep clones of input objects before merging.
|
|
523
|
+
*
|
|
524
|
+
* When enabled, both template and source objects are deep cloned before the merge
|
|
525
|
+
* operation, ensuring the original objects remain unmodified. When disabled,
|
|
526
|
+
* the merge operates directly on the provided objects, which may result in mutation.
|
|
527
|
+
*
|
|
487
528
|
* @default true
|
|
488
529
|
*/
|
|
489
530
|
deepClone?: boolean;
|
|
490
531
|
/**
|
|
491
|
-
*
|
|
532
|
+
* Determines how arrays should be handled during the merge process.
|
|
533
|
+
*
|
|
534
|
+
* - 'merge': Concatenates arrays from template and source (template + source)
|
|
535
|
+
* - 'replace': Source array completely replaces the template array
|
|
536
|
+
*
|
|
537
|
+
* This only applies when both template and source have arrays at the same key.
|
|
538
|
+
* If only one side has an array, it will be used as-is regardless of strategy.
|
|
539
|
+
*
|
|
492
540
|
* @default 'replace'
|
|
493
|
-
* - 'merge': Merges the arrays
|
|
494
|
-
* - 'replace': Replaces the array with the new one
|
|
495
541
|
*/
|
|
496
542
|
mergeStrategy?: 'merge' | 'replace';
|
|
497
543
|
}
|
|
498
544
|
|
|
545
|
+
declare class UtilsError extends Error {
|
|
546
|
+
constructor(m: string, name?: string);
|
|
547
|
+
}
|
|
499
548
|
declare function throwError(scope: string, message: string): void;
|
|
500
549
|
declare function debugWarn(err: Error): void;
|
|
501
550
|
declare function debugWarn(scope: string, message: string): void;
|
|
@@ -520,9 +569,9 @@ declare global {
|
|
|
520
569
|
}
|
|
521
570
|
|
|
522
571
|
/**
|
|
523
|
-
*
|
|
524
|
-
* @param str
|
|
525
|
-
* @return
|
|
572
|
+
* Parse query string
|
|
573
|
+
* @param str String to convert
|
|
574
|
+
* @return Converted object
|
|
526
575
|
* @example
|
|
527
576
|
*
|
|
528
577
|
* parse('a=1&b=2') => { a: '1', b: '2' }
|
|
@@ -537,9 +586,9 @@ declare global {
|
|
|
537
586
|
*/
|
|
538
587
|
declare function parse(str: string, options?: ParseOptions): Record<string, string>;
|
|
539
588
|
/**
|
|
540
|
-
*
|
|
541
|
-
* @param obj
|
|
542
|
-
* @return
|
|
589
|
+
* Convert object to query string
|
|
590
|
+
* @param obj Object to convert
|
|
591
|
+
* @return Converted string
|
|
543
592
|
* @example
|
|
544
593
|
* stringify({ a: '1', b: '2' }) => 'a=1&b=2'
|
|
545
594
|
* stringify({ from: '中国' }) => 'from=%E4%B8%AD%E5%9B%BD'
|
|
@@ -547,10 +596,10 @@ declare function parse(str: string, options?: ParseOptions): Record<string, stri
|
|
|
547
596
|
*/
|
|
548
597
|
declare function stringify(obj: AnyObject, options?: StringifyOptions): string;
|
|
549
598
|
/**
|
|
550
|
-
*
|
|
599
|
+
* Append query string to URL
|
|
551
600
|
* @param url url
|
|
552
|
-
* @param obj
|
|
553
|
-
* @return
|
|
601
|
+
* @param obj Query string object
|
|
602
|
+
* @return URL with appended query string
|
|
554
603
|
* @example
|
|
555
604
|
* appendQueryString('https://www.baidu.com', { a: '1', b: '2' }) => 'https://www.baidu.com?a=1&b=2'
|
|
556
605
|
* appendQueryString('/pages/index?id=10', { test:'23' }) => '/pages/index?id=10&test=23'
|
|
@@ -563,41 +612,41 @@ declare const qs: {
|
|
|
563
612
|
};
|
|
564
613
|
interface ParseOptions {
|
|
565
614
|
/**
|
|
566
|
-
*
|
|
615
|
+
* Whether to decode
|
|
567
616
|
* @default true
|
|
568
617
|
*/
|
|
569
618
|
decode?: boolean;
|
|
570
619
|
}
|
|
571
620
|
interface StringifyOptions {
|
|
572
621
|
/**
|
|
573
|
-
*
|
|
622
|
+
* Whether to encode
|
|
574
623
|
* @default true
|
|
575
624
|
*/
|
|
576
625
|
encode?: boolean;
|
|
577
626
|
}
|
|
578
627
|
|
|
579
628
|
/**
|
|
580
|
-
*
|
|
581
|
-
* @param target
|
|
582
|
-
* @param wait
|
|
629
|
+
* Throttle function
|
|
630
|
+
* @param target Target function
|
|
631
|
+
* @param wait Wait time, default 500ms
|
|
583
632
|
* @example throttle(() => console.log('hello world'), 500)
|
|
584
633
|
*/
|
|
585
634
|
declare function throttle(target: Function, wait?: number): (...args: any[]) => any;
|
|
586
635
|
|
|
587
636
|
/**
|
|
588
|
-
*
|
|
637
|
+
* Validates Chinese characters, letters, and digits
|
|
589
638
|
*/
|
|
590
639
|
declare function validatorChineseOrEnglishOrNumber(value: string): boolean;
|
|
591
640
|
/**
|
|
592
|
-
*
|
|
641
|
+
* Validates Chinese characters and English letters
|
|
593
642
|
*/
|
|
594
643
|
declare function validatorChineseOrEnglish(value: string): boolean;
|
|
595
644
|
/**
|
|
596
|
-
*
|
|
645
|
+
* Validates uppercase letters, digits, and special characters including !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~
|
|
597
646
|
*/
|
|
598
647
|
declare function validatorUppercaseOrNumbersOrSpecial(value: string): boolean;
|
|
599
648
|
/**
|
|
600
|
-
*
|
|
649
|
+
* Validates uppercase letters, digits, and underscore
|
|
601
650
|
*/
|
|
602
651
|
declare function validatorUppercaseOrNumbersOrUnderline(value: string): boolean;
|
|
603
652
|
|
|
@@ -609,8 +658,11 @@ declare function validatorUppercaseOrNumbersOrUnderline(value: string): boolean;
|
|
|
609
658
|
* The operation can be cancelled early by providing an `AbortSignal`.
|
|
610
659
|
*
|
|
611
660
|
* @example
|
|
661
|
+
* // Basic usage with default settings
|
|
612
662
|
* withRetry({ fn: () => fetch('https://api.example.com/data') })
|
|
613
663
|
*
|
|
664
|
+
* @example
|
|
665
|
+
* // Advanced usage with all options
|
|
614
666
|
* const controller = new AbortController();
|
|
615
667
|
* withRetry({
|
|
616
668
|
* fn: () => fetch('https://api.example.com/data'),
|
|
@@ -619,64 +671,112 @@ declare function validatorUppercaseOrNumbersOrUnderline(value: string): boolean;
|
|
|
619
671
|
* enableExponentialBackoff: true,
|
|
620
672
|
* signal: controller.signal
|
|
621
673
|
* })
|
|
674
|
+
*
|
|
675
|
+
* @example
|
|
676
|
+
* // With exponential backoff (delays: 1s, 2s, 4s, 8s...)
|
|
677
|
+
* withRetry({
|
|
678
|
+
* fn: () => apiCall(),
|
|
679
|
+
* maxAttempts: 4,
|
|
680
|
+
* retryDelay: 1000,
|
|
681
|
+
* enableExponentialBackoff: true
|
|
682
|
+
* })
|
|
683
|
+
*
|
|
684
|
+
* @returns Promise that resolves with the result of the successful function execution
|
|
685
|
+
*
|
|
686
|
+
* @throws {Error} When `options` is not a plain object
|
|
687
|
+
* @throws {Error} When `fn` is not a function that returns a Promise
|
|
688
|
+
* @throws {Error} When `maxAttempts` is not a positive integer
|
|
689
|
+
* @throws {Error} When `retryDelay` is not a non-negative number
|
|
690
|
+
* @throws {Error} When `enableExponentialBackoff` is not a boolean
|
|
691
|
+
* @throws {Error} When `signal` is not an AbortSignal object
|
|
692
|
+
* @throws {Promise rejection Error} "Operation Cancelled" when the operation is aborted via AbortSignal
|
|
693
|
+
* @throws {Promise rejection any} The original error from `fn` when all retry attempts are exhausted
|
|
694
|
+
*
|
|
695
|
+
* @remarks
|
|
696
|
+
* - Uses exponential backoff when enabled: delay × 2^(attempt-1)
|
|
697
|
+
* - Supports cancellation via AbortSignal at any point during execution
|
|
698
|
+
* - Logs retry attempts for debugging purposes
|
|
699
|
+
* - Validates all input parameters and throws descriptive errors
|
|
700
|
+
* - Cleans up event listeners to prevent memory leaks
|
|
701
|
+
* - Returns immediately on first successful execution
|
|
702
|
+
* - Preserves the original error when all retries fail
|
|
622
703
|
*/
|
|
623
704
|
declare function withRetry<T>(options: WithRetryOptions<T>): Promise<T>;
|
|
624
705
|
interface WithRetryOptions<T> {
|
|
625
706
|
/**
|
|
626
|
-
* The asynchronous function to execute
|
|
707
|
+
* The asynchronous function to execute with retry logic.
|
|
708
|
+
*
|
|
709
|
+
* This function should return a Promise and will be called up to `maxAttempts` times
|
|
710
|
+
* if it fails. Each call should be idempotent as it may be executed multiple times.
|
|
627
711
|
*/
|
|
628
712
|
fn: () => Promise<T>;
|
|
629
713
|
/**
|
|
630
714
|
* Maximum number of attempts before failing.
|
|
715
|
+
*
|
|
716
|
+
* Must be a positive integer. If the function fails this many times,
|
|
717
|
+
* the original error from the last attempt will be thrown.
|
|
718
|
+
*
|
|
631
719
|
* @default 3
|
|
632
720
|
*/
|
|
633
721
|
maxAttempts?: number;
|
|
634
722
|
/**
|
|
635
723
|
* Delay in milliseconds before each retry.
|
|
724
|
+
*
|
|
725
|
+
* Must be a non-negative number. When `enableExponentialBackoff` is true,
|
|
726
|
+
* this serves as the base delay for exponential backoff calculation.
|
|
727
|
+
*
|
|
636
728
|
* @default 1000
|
|
637
729
|
*/
|
|
638
730
|
retryDelay?: number;
|
|
639
731
|
/**
|
|
640
|
-
* Whether to use exponential backoff for
|
|
732
|
+
* Whether to use exponential backoff for delays.
|
|
733
|
+
*
|
|
734
|
+
* When enabled, the actual delay will be calculated as: `retryDelay × 2^(attempt-1)`.
|
|
735
|
+
* For example, with retryDelay=1000: 1s, 2s, 4s, 8s, etc.
|
|
736
|
+
*
|
|
641
737
|
* @default false
|
|
642
738
|
*/
|
|
643
739
|
enableExponentialBackoff?: boolean;
|
|
644
740
|
/**
|
|
645
741
|
* Optional AbortSignal to cancel the retry operation early.
|
|
742
|
+
*
|
|
743
|
+
* When the signal is aborted, the operation will be cancelled immediately
|
|
744
|
+
* and an "Operation Cancelled" error will be thrown. The signal is checked
|
|
745
|
+
* before each attempt and during execution via Promise.race.
|
|
646
746
|
*/
|
|
647
747
|
signal?: AbortSignal;
|
|
648
748
|
}
|
|
649
749
|
|
|
650
750
|
/**
|
|
651
|
-
*
|
|
751
|
+
* Validates if the value contains only digits
|
|
652
752
|
*/
|
|
653
753
|
declare function isNumberOrNumberString(val: string): boolean;
|
|
654
754
|
/**
|
|
655
|
-
*
|
|
755
|
+
* Validates if the value contains only English letters
|
|
656
756
|
*/
|
|
657
757
|
declare function isEnglishAphabet(val: string): boolean;
|
|
658
758
|
/**
|
|
659
|
-
*
|
|
759
|
+
* Validates if the value contains only uppercase letters
|
|
660
760
|
*/
|
|
661
761
|
declare function isUpperCase(val: string): boolean;
|
|
662
762
|
/**
|
|
663
|
-
*
|
|
763
|
+
* Validates if the value contains only uppercase letters and digits
|
|
664
764
|
*/
|
|
665
765
|
declare function isUpperCaseAndNumber(val: string): boolean;
|
|
666
766
|
/**
|
|
667
|
-
*
|
|
767
|
+
* Validates if the value contains only uppercase letters, digits and Chinese characters
|
|
668
768
|
*/
|
|
669
769
|
declare function isUpperCaseAndNumberAndChinese(val: string): boolean;
|
|
670
770
|
/**
|
|
671
|
-
*
|
|
771
|
+
* Validates if the value contains only lowercase letters
|
|
672
772
|
*/
|
|
673
773
|
declare function isLowerCase(val: string): boolean;
|
|
674
774
|
/**
|
|
675
|
-
*
|
|
775
|
+
* Validates if the value contains only lowercase letters and digits
|
|
676
776
|
*/
|
|
677
777
|
declare function isLowerCaseAndNumber(val: string): boolean;
|
|
678
778
|
/**
|
|
679
|
-
*
|
|
779
|
+
* Validates if the value contains only lowercase letters, digits and Chinese characters
|
|
680
780
|
*/
|
|
681
781
|
declare function isLowerCaseAndNumberAndChinese(val: string): boolean;
|
|
682
782
|
/**
|
|
@@ -691,145 +791,279 @@ declare function isLowerCaseAndNumberAndChinese(val: string): boolean;
|
|
|
691
791
|
declare function isChineseString(val: string): boolean;
|
|
692
792
|
|
|
693
793
|
/**
|
|
694
|
-
* Validates whether
|
|
794
|
+
* Validates whether a string represents a valid float number.
|
|
695
795
|
*
|
|
696
|
-
*
|
|
796
|
+
* This utility checks if the input string represents a valid float,
|
|
797
|
+
* including positive and negative decimal numbers. It uses strict validation
|
|
798
|
+
* that only accepts decimal float format with at least one digit after the decimal point.
|
|
697
799
|
*
|
|
800
|
+
* @example
|
|
698
801
|
* isFloat('1.23') => true
|
|
699
|
-
*
|
|
700
802
|
* isFloat('-4.56') => true
|
|
701
|
-
*
|
|
702
803
|
* isFloat('0.0') => true
|
|
703
804
|
*
|
|
704
|
-
*
|
|
805
|
+
* @example
|
|
806
|
+
* isFloat('7') => false (integer)
|
|
807
|
+
* isFloat('1.') => false (no decimal digits)
|
|
808
|
+
* isFloat('abc') => false (non-numeric)
|
|
809
|
+
*
|
|
810
|
+
* @returns Returns `true` if the string is a valid float, `false` otherwise
|
|
811
|
+
*
|
|
812
|
+
* @remarks
|
|
813
|
+
* - Accepts positive floats (e.g., "1.23", "999.5")
|
|
814
|
+
* - Accepts negative floats (e.g., "-1.23", "-999.5")
|
|
815
|
+
* - Accepts zero with decimal point (e.g., "0.0", "-0.0")
|
|
816
|
+
* - Rejects integers without decimal point (e.g., "7", "-7")
|
|
817
|
+
* - Rejects numbers with no digits after decimal (e.g., "1.", "-2.")
|
|
818
|
+
* - Rejects non-numeric strings (e.g., "abc", "1.2a")
|
|
705
819
|
*/
|
|
706
820
|
declare function isFloat(val: string): boolean;
|
|
707
821
|
/**
|
|
708
|
-
* Validates whether
|
|
822
|
+
* Validates whether a string represents a positive float (greater than zero).
|
|
709
823
|
*
|
|
710
|
-
*
|
|
824
|
+
* This utility checks if the input string represents a positive float,
|
|
825
|
+
* which excludes zero, negative numbers, and integers. It uses strict validation
|
|
826
|
+
* that only accepts decimal numbers greater than zero.
|
|
711
827
|
*
|
|
828
|
+
* @example
|
|
712
829
|
* isPositiveFloat('1.23') => true
|
|
830
|
+
* isPositiveFloat('0.1') => true
|
|
713
831
|
*
|
|
714
|
-
*
|
|
832
|
+
* @example
|
|
833
|
+
* isPositiveFloat('-4.56') => false (negative)
|
|
834
|
+
* isPositiveFloat('0.0') => false (zero)
|
|
835
|
+
* isPositiveFloat('7') => false (integer)
|
|
715
836
|
*
|
|
716
|
-
*
|
|
837
|
+
* @returns Returns `true` if the string is a positive float, `false` otherwise
|
|
717
838
|
*
|
|
718
|
-
*
|
|
839
|
+
* @remarks
|
|
840
|
+
* - Accepts only positive floats greater than zero (e.g., "1.23", "0.5")
|
|
841
|
+
* - Rejects zero with decimal point (e.g., "0.0", "0.00")
|
|
842
|
+
* - Rejects negative floats (e.g., "-1.23", "-0.5")
|
|
843
|
+
* - Rejects integers (e.g., "7", "-7")
|
|
844
|
+
* - Rejects non-numeric strings (e.g., "abc", "1.2a")
|
|
719
845
|
*/
|
|
720
846
|
declare function isPositiveFloat(val: string): boolean;
|
|
721
847
|
/**
|
|
722
|
-
* Validates whether
|
|
848
|
+
* Validates whether a string represents a non-negative float (zero or greater).
|
|
723
849
|
*
|
|
724
|
-
*
|
|
850
|
+
* This utility checks if the input string represents a non-negative float,
|
|
851
|
+
* which includes zero and all positive decimal numbers. It excludes negative numbers
|
|
852
|
+
* and integers without decimal points.
|
|
725
853
|
*
|
|
854
|
+
* @example
|
|
726
855
|
* isNonNegativeFloat('1.23') => true
|
|
856
|
+
* isNonNegativeFloat('0.0') => true
|
|
727
857
|
*
|
|
728
|
-
*
|
|
858
|
+
* @example
|
|
859
|
+
* isNonNegativeFloat('-4.56') => false (negative)
|
|
860
|
+
* isNonNegativeFloat('7') => false (integer)
|
|
861
|
+
* isNonNegativeFloat('abc') => false (non-numeric)
|
|
729
862
|
*
|
|
730
|
-
*
|
|
863
|
+
* @returns Returns `true` if the string is a non-negative float, `false` otherwise
|
|
731
864
|
*
|
|
732
|
-
*
|
|
865
|
+
* @remarks
|
|
866
|
+
* - Accepts zero with decimal point (e.g., "0.0", "0.00")
|
|
867
|
+
* - Accepts positive floats (e.g., "1.23", "999.5")
|
|
868
|
+
* - Rejects negative floats (e.g., "-1.23", "-0.5")
|
|
869
|
+
* - Rejects integers without decimal point (e.g., "7", "0")
|
|
870
|
+
* - Rejects non-numeric strings (e.g., "abc", "1.2a")
|
|
733
871
|
*/
|
|
734
872
|
declare function isNonNegativeFloat(val: string): boolean;
|
|
735
873
|
/**
|
|
736
|
-
* Validates whether
|
|
874
|
+
* Validates whether a string represents a negative float (less than zero).
|
|
737
875
|
*
|
|
738
|
-
*
|
|
739
|
-
*
|
|
740
|
-
*
|
|
876
|
+
* This utility checks if the input string represents a negative float,
|
|
877
|
+
* which excludes zero, positive numbers, and integers. It uses strict validation
|
|
878
|
+
* that only accepts decimal numbers less than zero.
|
|
741
879
|
*
|
|
880
|
+
* @example
|
|
742
881
|
* isNegativeFloat('-4.56') => true
|
|
882
|
+
* isNegativeFloat('-0.1') => true
|
|
883
|
+
*
|
|
884
|
+
* @example
|
|
885
|
+
* isNegativeFloat('1.23') => false (positive)
|
|
886
|
+
* isNegativeFloat('0.0') => false (zero)
|
|
887
|
+
* isNegativeFloat('-7') => false (integer)
|
|
743
888
|
*
|
|
744
|
-
*
|
|
889
|
+
* @returns Returns `true` if the string is a negative float, `false` otherwise
|
|
745
890
|
*
|
|
746
|
-
*
|
|
891
|
+
* @remarks
|
|
892
|
+
* - Accepts only negative floats less than zero (e.g., "-1.23", "-0.5")
|
|
893
|
+
* - Rejects zero with decimal point (e.g., "0.0", "-0.0")
|
|
894
|
+
* - Rejects positive floats (e.g., "1.23", "0.5")
|
|
895
|
+
* - Rejects integers (e.g., "-7", "7")
|
|
896
|
+
* - Rejects non-numeric strings (e.g., "abc", "-1.2a")
|
|
747
897
|
*/
|
|
748
898
|
declare function isNegativeFloat(val: string): boolean;
|
|
749
899
|
/**
|
|
750
|
-
* Validates whether
|
|
751
|
-
*
|
|
752
|
-
* @example
|
|
900
|
+
* Validates whether a string represents a non-positive float (zero or less).
|
|
753
901
|
*
|
|
754
|
-
*
|
|
902
|
+
* This utility checks if the input string represents a non-positive float,
|
|
903
|
+
* which includes zero and all negative decimal numbers. It excludes positive numbers
|
|
904
|
+
* and integers without decimal points.
|
|
755
905
|
*
|
|
906
|
+
* @example
|
|
756
907
|
* isNonPositiveFloat('-4.56') => true
|
|
757
|
-
*
|
|
758
908
|
* isNonPositiveFloat('0.0') => true
|
|
759
909
|
*
|
|
760
|
-
*
|
|
910
|
+
* @example
|
|
911
|
+
* isNonPositiveFloat('1.23') => false (positive)
|
|
912
|
+
* isNonPositiveFloat('-7') => false (integer)
|
|
913
|
+
* isNonPositiveFloat('abc') => false (non-numeric)
|
|
914
|
+
*
|
|
915
|
+
* @returns Returns `true` if the string is a non-positive float, `false` otherwise
|
|
916
|
+
*
|
|
917
|
+
* @remarks
|
|
918
|
+
* - Accepts zero with decimal point (e.g., "0.0", "-0.0")
|
|
919
|
+
* - Accepts negative floats (e.g., "-1.23", "-999.5")
|
|
920
|
+
* - Rejects positive floats (e.g., "1.23", "0.5")
|
|
921
|
+
* - Rejects integers without decimal point (e.g., "-7", "0")
|
|
922
|
+
* - Rejects non-numeric strings (e.g., "abc", "-1.2a")
|
|
761
923
|
*/
|
|
762
924
|
declare function isNonPositiveFloat(val: string): boolean;
|
|
763
925
|
|
|
764
926
|
/**
|
|
765
|
-
* Validates whether
|
|
927
|
+
* Validates whether a string represents a valid integer number.
|
|
928
|
+
*
|
|
929
|
+
* This utility checks if the input string represents a valid integer,
|
|
930
|
+
* including positive numbers, negative numbers, and zero. It uses strict validation
|
|
931
|
+
* that only accepts decimal integer format without leading zeros (except for "0" itself).
|
|
766
932
|
*
|
|
767
933
|
* @example
|
|
934
|
+
* isInteger('123') => true
|
|
935
|
+
* isInteger('-456') => true
|
|
936
|
+
* isInteger('0') => true
|
|
768
937
|
*
|
|
769
|
-
*
|
|
938
|
+
* @example
|
|
939
|
+
* isInteger('12.5') => false (decimal)
|
|
940
|
+
* isInteger('01') => false (leading zero)
|
|
941
|
+
* isInteger('abc') => false (non-numeric)
|
|
770
942
|
*
|
|
771
|
-
*
|
|
943
|
+
* @returns Returns `true` if the string is a valid integer, `false` otherwise
|
|
772
944
|
*
|
|
773
|
-
*
|
|
945
|
+
* @remarks
|
|
946
|
+
* - Accepts positive integers (e.g., "1", "123", "999")
|
|
947
|
+
* - Accepts negative integers (e.g., "-1", "-123", "-999")
|
|
948
|
+
* - Accepts zero as "0"
|
|
949
|
+
* - Rejects decimal numbers (e.g., "1.5", "-2.3")
|
|
950
|
+
* - Rejects numbers with leading zeros (e.g., "01", "-02")
|
|
951
|
+
* - Rejects non-numeric strings (e.g., "abc", "12a")
|
|
774
952
|
*/
|
|
775
953
|
declare function isInteger(val: string): boolean;
|
|
776
954
|
/**
|
|
777
|
-
* Validates whether
|
|
955
|
+
* Validates whether a string represents a positive integer (greater than zero).
|
|
778
956
|
*
|
|
779
|
-
*
|
|
957
|
+
* This utility checks if the input string represents a positive integer,
|
|
958
|
+
* which excludes zero, negative numbers, and decimal values. It uses strict validation
|
|
959
|
+
* that only accepts integers starting from 1 and above.
|
|
780
960
|
*
|
|
961
|
+
* @example
|
|
781
962
|
* isPositiveInteger('123') => true
|
|
963
|
+
* isPositiveInteger('999') => true
|
|
782
964
|
*
|
|
783
|
-
*
|
|
965
|
+
* @example
|
|
966
|
+
* isPositiveInteger('0') => false (zero)
|
|
967
|
+
* isPositiveInteger('-1') => false (negative)
|
|
968
|
+
* isPositiveInteger('1.5') => false (decimal)
|
|
784
969
|
*
|
|
785
|
-
*
|
|
970
|
+
* @returns Returns `true` if the string is a positive integer, `false` otherwise
|
|
786
971
|
*
|
|
787
|
-
*
|
|
972
|
+
* @remarks
|
|
973
|
+
* - Accepts only positive integers greater than zero (e.g., "1", "123", "999")
|
|
974
|
+
* - Rejects zero ("0")
|
|
975
|
+
* - Rejects negative integers (e.g., "-1", "-123")
|
|
976
|
+
* - Rejects decimal numbers (e.g., "1.5", "2.0")
|
|
977
|
+
* - Rejects numbers with leading zeros (e.g., "01", "02")
|
|
978
|
+
* - Rejects non-numeric strings (e.g., "abc", "12a")
|
|
788
979
|
*/
|
|
789
980
|
declare function isPositiveInteger(val: string): boolean;
|
|
790
981
|
/**
|
|
791
|
-
* Validates whether
|
|
982
|
+
* Validates whether a string represents a non-negative integer (zero or greater).
|
|
792
983
|
*
|
|
793
|
-
*
|
|
984
|
+
* This utility checks if the input string represents a non-negative integer,
|
|
985
|
+
* which includes zero and all positive integers. It excludes negative numbers and decimal
|
|
986
|
+
* values, and handles the special case of negative zero.
|
|
794
987
|
*
|
|
988
|
+
* @example
|
|
795
989
|
* isNonNegativeInteger('456') => true
|
|
796
|
-
*
|
|
797
990
|
* isNonNegativeInteger('0') => true
|
|
798
991
|
*
|
|
799
|
-
*
|
|
992
|
+
* @example
|
|
993
|
+
* isNonNegativeInteger('-1') => false (negative)
|
|
994
|
+
* isNonNegativeInteger('1.5') => false (decimal)
|
|
995
|
+
* isNonNegativeInteger('01') => false (leading zero)
|
|
996
|
+
*
|
|
997
|
+
* @returns Returns `true` if the string is a non-negative integer, `false` otherwise
|
|
800
998
|
*
|
|
801
|
-
*
|
|
999
|
+
* @remarks
|
|
1000
|
+
* - Accepts zero ("0")
|
|
1001
|
+
* - Accepts positive integers (e.g., "1", "123", "999")
|
|
1002
|
+
* - Rejects negative integers (e.g., "-1", "-123")
|
|
1003
|
+
* - Rejects decimal numbers (e.g., "1.5", "-2.3")
|
|
1004
|
+
* - Rejects numbers with leading zeros (e.g., "01", "02")
|
|
1005
|
+
* - Handles negative zero (-0) correctly by rejecting it
|
|
1006
|
+
* - Rejects non-numeric strings (e.g., "abc", "12a")
|
|
802
1007
|
*/
|
|
803
1008
|
declare function isNonNegativeInteger(val: string): boolean;
|
|
804
1009
|
/**
|
|
805
|
-
* Validates whether
|
|
1010
|
+
* Validates whether a string represents a negative integer (less than zero).
|
|
806
1011
|
*
|
|
807
|
-
*
|
|
1012
|
+
* This utility checks if the input string represents a negative integer,
|
|
1013
|
+
* which excludes zero, positive numbers, and decimal values. It uses strict validation
|
|
1014
|
+
* that only accepts integers less than zero.
|
|
808
1015
|
*
|
|
1016
|
+
* @example
|
|
809
1017
|
* isNegativeInteger('-123') => true
|
|
1018
|
+
* isNegativeInteger('-1') => true
|
|
810
1019
|
*
|
|
811
|
-
*
|
|
1020
|
+
* @example
|
|
1021
|
+
* isNegativeInteger('123') => false (positive)
|
|
1022
|
+
* isNegativeInteger('0') => false (zero)
|
|
1023
|
+
* isNegativeInteger('-1.5') => false (decimal)
|
|
812
1024
|
*
|
|
813
|
-
*
|
|
1025
|
+
* @returns Returns `true` if the string is a negative integer, `false` otherwise
|
|
814
1026
|
*
|
|
815
|
-
*
|
|
1027
|
+
* @remarks
|
|
1028
|
+
* - Accepts only negative integers less than zero (e.g., "-1", "-123", "-999")
|
|
1029
|
+
* - Rejects zero ("0")
|
|
1030
|
+
* - Rejects positive integers (e.g., "1", "123")
|
|
1031
|
+
* - Rejects decimal numbers (e.g., "-1.5", "2.3")
|
|
1032
|
+
* - Rejects numbers with leading zeros (e.g., "-01", "-02")
|
|
1033
|
+
* - Rejects non-numeric strings (e.g., "abc", "-12a")
|
|
816
1034
|
*/
|
|
817
1035
|
declare function isNegativeInteger(val: string): boolean;
|
|
818
1036
|
/**
|
|
819
|
-
* Validates whether
|
|
1037
|
+
* Validates whether a string represents a non-positive integer (zero or less).
|
|
820
1038
|
*
|
|
821
|
-
*
|
|
1039
|
+
* This utility checks if the input string represents a non-positive integer,
|
|
1040
|
+
* which includes zero and all negative integers. It excludes positive numbers and decimal
|
|
1041
|
+
* values, and handles the special case of negative zero.
|
|
822
1042
|
*
|
|
1043
|
+
* @example
|
|
823
1044
|
* isNonPositiveInteger('-456') => true
|
|
824
|
-
*
|
|
825
1045
|
* isNonPositiveInteger('0') => true
|
|
826
1046
|
*
|
|
827
|
-
*
|
|
1047
|
+
* @example
|
|
1048
|
+
* isNonPositiveInteger('123') => false (positive)
|
|
1049
|
+
* isNonPositiveInteger('1.5') => false (decimal)
|
|
1050
|
+
* isNonPositiveInteger('-01') => false (leading zero)
|
|
1051
|
+
*
|
|
1052
|
+
* @returns Returns `true` if the string is a non-positive integer, `false` otherwise
|
|
828
1053
|
*
|
|
829
|
-
*
|
|
1054
|
+
* @remarks
|
|
1055
|
+
* - Accepts zero ("0")
|
|
1056
|
+
* - Accepts negative integers (e.g., "-1", "-123", "-999")
|
|
1057
|
+
* - Rejects positive integers (e.g., "1", "123")
|
|
1058
|
+
* - Rejects decimal numbers (e.g., "-1.5", "2.3")
|
|
1059
|
+
* - Rejects numbers with leading zeros (e.g., "-01", "-02")
|
|
1060
|
+
* - Handles negative zero (-0) correctly by accepting it
|
|
1061
|
+
* - Rejects non-numeric strings (e.g., "abc", "-12a")
|
|
830
1062
|
*/
|
|
831
1063
|
declare function isNonPositiveInteger(val: string): boolean;
|
|
832
1064
|
|
|
1065
|
+
declare const isStringNumber: (val: string) => boolean;
|
|
1066
|
+
|
|
833
1067
|
/**
|
|
834
1068
|
* Validates whether the value is a mobile phone number.
|
|
835
1069
|
*
|
|
@@ -865,15 +1099,15 @@ declare function isEmail(val: string): boolean;
|
|
|
865
1099
|
*/
|
|
866
1100
|
declare function isEmptyString(val: unknown): val is "";
|
|
867
1101
|
/**
|
|
868
|
-
*
|
|
869
|
-
* @param format
|
|
1102
|
+
* Validates if the value is a valid date string
|
|
1103
|
+
* @param format Date format
|
|
870
1104
|
* @default 'YYYY-MM-DD HH:mm:ss'
|
|
871
1105
|
* @see https://day.js.org/docs/zh-CN/parse/string-format
|
|
872
1106
|
*/
|
|
873
1107
|
declare function isDateString(val: string, format?: string): boolean;
|
|
874
1108
|
/**
|
|
875
|
-
*
|
|
1109
|
+
* Validates if the value is a valid Chinese ID card number
|
|
876
1110
|
*/
|
|
877
1111
|
declare function isIdCard(val: string): boolean;
|
|
878
1112
|
|
|
879
|
-
export { type AnyObject, type ArrayItem, type Arrayable, type ParseOptions, type PlainObject, type StringNumber, type StringifyOptions, type WithRetryOptions, base64Decode, base64Encode, castArray, compose, composeRight, debounce, debugWarn, debugWarnInvalidTypeMessage, decimalToBinary, deepClone, deepMerge, deprecated, generateRandomArray, generateRandomColor, generateRandomDate, generateRandomEmail, generateRandomFloat, generateRandomIdCard, generateRandomMobilePhone, generateRandomStringFromSource, getRandomInt, getRandomItem, getRandomString, getRandomUrl, hasChanged, isArray, isBoolean, isChineseString, isDate, isDateString, isDef, isEmail, isEmptyString, isEnglishAphabet, isFloat, isFunction, isIdCard, isInteger, isLowerCase, isLowerCaseAndNumber, isLowerCaseAndNumberAndChinese, isMap, isMobilePhone, isNegativeFloat, isNegativeInteger, isNonNegativeFloat, isNonNegativeInteger, isNonPositiveFloat, isNonPositiveInteger, isNull, isNumber, isNumberOrNumberString, isObject, isObjectLike, isPlainObject, isPositiveFloat, isPositiveInteger, isPromise, isRegExp, isSet, isString, isSymbol, isURL, isUndef, isUndefined, isUpperCase, isUpperCaseAndNumber, isUpperCaseAndNumberAndChinese, objectToString, omit, pick, qs, throttle, throwError, throwErrorInvalidTypeMessage, toTypeString, toTypeValue, validatorChineseOrEnglish, validatorChineseOrEnglishOrNumber, validatorUppercaseOrNumbersOrSpecial, validatorUppercaseOrNumbersOrUnderline, withRetry };
|
|
1113
|
+
export { type AnyObject, type ArrayItem, type Arrayable, type DeepMergeOptions, type ParseOptions, type PlainObject, type StringNumber, type StringifyOptions, UtilsError, type WithRetryOptions, base64Decode, base64Encode, castArray, compose, composeRight, debounce, debugWarn, debugWarnInvalidTypeMessage, decimalToBinary, deepClone, deepMerge, deprecated, generateRandomArray, generateRandomColor, generateRandomDate, generateRandomEmail, generateRandomFloat, generateRandomIdCard, generateRandomMobilePhone, generateRandomStringFromSource, getRandomInt, getRandomItem, getRandomString, getRandomUrl, hasChanged, isArray, isBoolean, isChineseString, isDate, isDateString, isDef, isEmail, isEmptyString, isEnglishAphabet, isFloat, isFunction, isIdCard, isInteger, isLowerCase, isLowerCaseAndNumber, isLowerCaseAndNumberAndChinese, isMap, isMobilePhone, isNegativeFloat, isNegativeInteger, isNonNegativeFloat, isNonNegativeInteger, isNonPositiveFloat, isNonPositiveInteger, isNull, isNumber, isNumberOrNumberString, isObject, isObjectLike, isPlainObject, isPositiveFloat, isPositiveInteger, isPromise, isRegExp, isSet, isString, isStringNumber, isSymbol, isURL, isUndef, isUndefined, isUpperCase, isUpperCaseAndNumber, isUpperCaseAndNumberAndChinese, objectToString, omit, pick, qs, throttle, throwError, throwErrorInvalidTypeMessage, toTypeString, toTypeValue, validatorChineseOrEnglish, validatorChineseOrEnglishOrNumber, validatorUppercaseOrNumbersOrSpecial, validatorUppercaseOrNumbersOrUnderline, withRetry };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* @ts-self-types="./esm-bundler.d.ts" */
|
|
2
|
-
function le(e){let t=typeof e;return e!==null&&(t==="object"||t==="function")}function R(e){return e!==null&&typeof e=="object"}var V=Object.prototype.toString,O=e=>V.call(e),D=e=>O(e).slice(8,-1),v=e=>typeof e=="string",g=e=>typeof e=="number"&&Number.isFinite(e),he=e=>typeof e=="boolean",Oe=e=>e===null,we=e=>e===void 0,F=e=>typeof e=="symbol",d=Array.isArray,j=e=>typeof e=="function",Y=e=>O(e)==="[object Map]",U=e=>O(e)==="[object Set]",L=e=>O(e)==="[object Date]",_=e=>O(e)==="[object RegExp]",K=e=>R(e)&&j(e?.then)&&j(e?.catch),S=e=>e==null,Ae=e=>e!=null,$e=(e,t)=>e!==t;function h(e){return O(e)==="[object Object]"}function w(e){return d(e)?e:[e]}function _e(e){let t=[],r,n="";for(;e>0;)r=Math.floor(e%2),t.push(r),e=Math.floor(e/2);for(;t.length>0;)n+=t.pop().toString();return n}var W="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function Ke(e){let t="",r="";for(let o=0;o<e.length;o++)r+=e[o].charCodeAt(0).toString(2).padStart(8,"0");for(let o=0;o<r.length;o+=6)t+=W[Number.parseInt(r.slice(o,o+6).padEnd(6,"0"),2)];let n=t.length%4;return n!==0&&(t+="=".repeat(4-n)),t}function We(e){let t="",r="";for(let n=0;n<e.length&&e[n]!=="=";n++)r+=W.indexOf(e[n]).toString(2).padStart(6,"0");for(let n=0;n<r.length;n+=8){let o=Number.parseInt(r.slice(n,n+8),2);o&&(t+=String.fromCharCode(o))}return t}function Ze(...e){return e.reduce((t,r)=>function(...n){return r(t(...n))})}function Be(...e){return e.reduce((t,r)=>function(...n){return t(r(...n))})}function Ve(e,t=500){let r=null;return function(...n){r&&clearTimeout(r),r=setTimeout(()=>{e.apply(this,n)},t)}}function T(e){let t=new WeakMap;function r(n){if(!R(n))return n;if(L(n))return new Date(n);if(_(n))return new RegExp(n);if(K(n))return n;if(t.has(n))return t.get(n);if(Y(n)){let a=new Map;return t.set(n,a),n.forEach((p,u)=>a.set(r(u),r(p))),a}if(U(n)){let a=new Set;return t.set(n,a),n.forEach(p=>a.add(r(p))),a}let o=d(n)?Object.setPrototypeOf([],Object.getPrototypeOf(n)):Object.create(Object.getPrototypeOf(n));t.set(n,o);let m=Object.getOwnPropertyDescriptors(n);for(let a of Reflect.ownKeys(m)){let p=m[a];p.get||p.set?Object.defineProperty(o,a,p):Object.defineProperty(o,a,{...p,value:r(p.value)})}return o}return r(e)}function H(e,t,r={}){return Z(z(e,r),z(t,r),r)}function Z(e,t,r){return d(e)?Q(e,t,r):X(e,t,r)}function X(e,t,r){if(!h(t))return t;let n=Object.getOwnPropertyDescriptors(t);return Reflect.ownKeys(t).forEach(o=>{(h(e[o])||d(e[o]))&&(h(t[o])||d(t[o]))?e[o]=Z(e[o],t[o],r):Object.defineProperty(e,o,n[o])}),e}function Q(e,t,r){let{mergeStrategy:n="replace"}=r;if(d(t))switch(n){case"merge":return e.concat(t);case"replace":return t;default:return t}return t}function z(e,t){let{deepClone:r=!0}=t;return r?T(e):e}var M=class extends Error{constructor(t,r="Utils"){super(t),this.name=r}};function c(e,t){throw new M(`[${e}] ${t}`)}function B(e,t){let r=v(e)?new M(`[${e}] ${t}`,"UtilsWarn"):e;console.warn(r)}var at=({from:e,replacement:t,version:r,type:n="API"})=>{B(`${n}`,`${e} is about to be deprecated in version ${r}, please use ${t} instead.`)};function mt(e,t,r,n){let o=`Invalid params: type check failed for params "${t}". Expected ${r}, got ${D(n)} with value ${n}.`;c(e,o)}function ct(e,t,r,n){let o=`Invalid params: type check failed for params "${t}". Expected ${r}, got ${D(n)} with value ${n}.`;B(e,o)}var E=(e,t,...r)=>{if(!t)return;let n=r.length===0?"":r.length===1?r[0]:r;console[e](`[Log] ${t}:`,n)},k=(e,...t)=>{E("info",e,...t)};k.info=(e,...t)=>{E("info",e,...t)};k.error=(e,...t)=>{E("error",e,...t)};k.warn=(e,...t)=>{E("warn",e,...t)};typeof globalThis<"u"&&(globalThis.log=k);function J(e,t){let{decode:r=!0}=t||{},n={};e.startsWith("?")&&(e=e.slice(1)),e.includes("?")&&(e=e.slice(e.indexOf("?")+1));let o=e.split("&").filter(Boolean);for(let m of o){let[a,p]=m.split("=");n[a]=r?decodeURIComponent(p):p}return n}function G(e,t){let{encode:r=!0}=t||{},n=[];for(let o in e){let m=e[o];n.push(`${o}=${r?encodeURIComponent(m):m}`)}return n.join("&")}function ee(e,t,r){let n=H({encode:!0},{...r}),o=G(t,n);return e.includes("?")?e.endsWith("?")||e.endsWith("&")?`${e}${o}`:`${e}&${o}`:`${e}?${o}`}var gt={parse:J,stringify:G,appendQueryString:ee};function yt(e,t=500){let r=null;return function(...n){if(S(r))return r=Date.now(),e.apply(this,n);let o=Date.now();if(o-r>=t)return r=o,e.apply(this,n)}}function At(e){return!S(e)&&/^[\dA-Z\u4E00-\u9FA5]+$/i.test(e)}function $t(e){return!S(e)&&/^[A-Z\u4E00-\u9FA5]+$/i.test(e)}function St(e){return!S(e)&&/^[\d!"#$%&'()*+,./:;<=>?@A-Z[\\\]^_`{|}~]+$/.test(e)}function Tt(e){return/^[\dA-Z_]+$/.test(e)}async function Mt(e){let{fn:t,maxAttempts:r=3,retryDelay:n=1e3,enableExponentialBackoff:o=!1,signal:m}=e,a,p=new Promise((b,A)=>{if(m){let $=()=>A(new Error("Operation Cancelled"));m.addEventListener("abort",$),a=()=>m.removeEventListener("abort",$)}}),u=0;try{for(;;){if(console.log("while: ",u),m?.aborted)throw new Error("Operation Cancelled");try{return await Promise.race([t(),p])}catch(b){if(b instanceof Error&&b.message==="Operation Cancelled"||(u++,u>=r))throw b;let A=o?n*2**(u-1):n;await new Promise($=>setTimeout($,A))}}}finally{a?.()}}function q(e,t,r={}){let{includeProto:n=!1,includeSymbols:o=!0,includeNonEnum:m=!1}=r,a={};return h(e)&&w(t).forEach(u=>{F(u)&&!o||!(n?u in e:Object.hasOwn(e,u))||!m&&(n?te(e,u):Object.getOwnPropertyDescriptor(e,u))?.enumerable===!1||(a[u]=T(e[u]))}),a}function te(e,t){let r=e;for(;r!==null;){let n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=Object.getPrototypeOf(r)}}function Jt(e,t){if(!h(e))return{};let r=T(e),n=w(t),o=Object.keys(r).filter(m=>!n.includes(m));return q(r,o)}function mr(e,t){return(!g(e)||e<=0)&&c("generateRandomArray","num \u5FC5\u987B\u5927\u4E8E0"),j(t)||c("generateRandomArray","cb \u5FC5\u987B\u662F\u51FD\u6570"),Array.from({length:e}).fill(0).map((r,n)=>t(r,n))}function fr(){return`#${Math.random().toString(16).slice(2,8).padEnd(6,"0")}`}import y from"dayjs";import oe from"dayjs/plugin/customParseFormat.js";function l(e){return e[Math.floor(Math.random()*e.length)]}function f(e={}){g(e)&&(e={max:e});let{min:t=1,max:r=l(ne())}=e;re(t,r);let n=Math.ceil(t),o=Math.floor(r);return Math.floor(Math.random()*(o-n+1)+n)}function re(e,t){let r=Math.ceil(e),n=Math.floor(t);Number.isSafeInteger(r)||c("getRandomInt",`The minimum value Math.ceil(${e}) should be a safe integer`),Number.isSafeInteger(n)||c("getRandomInt",`The maximum value Math.floor(${t}) should be a safe integer`),n<r&&(t>=e&&c("getRandomInt",`No integer value found between ${e} and ${t}`),c("getRandomInt",`The maximum value ${t} should be greater than the minimum value ${e}`))}function ne(){return Array.from({length:Number.MAX_SAFE_INTEGER.toString().length}).map((e,t)=>{let r=Number.MAX_SAFE_INTEGER.toString().slice(0,t+1);return Number(r)})}y.extend(oe);function N(e={}){let{start:t="1800-01-01 00:00:00",end:r=y().format("YYYY-MM-DD HH:mm:ss"),format:n="YYYY-MM-DD HH:mm:ss"}=e;(!y(t).isValid()||!y(r).isValid())&&c("generateRandomDate","start end \u53C2\u6570\u5FC5\u987B\u662F\u5408\u6CD5\u7684\u65F6\u95F4\u683C\u5F0F");let o=y(t).year(),m=y(r).year(),a=f({min:o,max:m}),p=f({min:1,max:12}),u=f({min:1,max:31}),b=f(23),A=f(59),$=f(59),P=y(`${a}-${p}-${u} ${b}:${A}:${$}`);return P.isBefore(y(t))||P.isAfter(y(r))?N(e):P.format(n)}function x(e={}){let t=se(e),r=ae(t);me(r);let{length:n}=t;ce(n.min,n.max);let o=f(n),m=t.prefix||"";for(let a=0;a<o;a++)m+=r.charAt(Math.floor(Math.random()*r.length));return m+(t.suffix||"")}var ie=16,C=1;function se(e){let t=g(e);return{lowerCase:!0,upperCase:!0,number:!0,...t?{}:e,length:t?{max:e,min:e}:g(e.length)?{max:e.length,min:e.length}:{max:ie,min:C,...e.length},extra:t?[]:[...new Set(w(e.extra||[]))]}}function ae(e){let t="";return e.lowerCase&&(t+="abcdefghijklmnopqrstuvwxyz"),e.upperCase&&(t+="ABCDEFGHIJKLMNOPQRSTUVWXYZ"),e.number&&(t+="0123456789"),t+=w(e.extra).join(""),t}function me(e){e.length===0&&c("getRandomString","At least one character set (lowercase, uppercase, number) must be enabled or extra characters provided")}function ce(e,t){Number.isInteger(e)||c("getRandomString","min must be an integer"),Number.isInteger(t)||c("getRandomString","max must be an integer"),e<C&&c("getRandomString",`Minimum length cannot be less than ${C}`),t<e&&c("getRandomString","Maximum length cannot be less than minimum length")}function pe(){let e=["gmail.com","outlook.com.cn","example.com","qq.com","163.com","test.com.cn"],t=`${x(1)}${x({length:f({max:30,min:1})})}${x(1)}@${l(e)}`;return/\.{2,}/.test(t)?pe():t}function Ur(e={}){g(e)&&(e={max:e});let{min:t=0,max:r=1,fractionDigits:n=2}=e;if(t===r)return t;if(t>r)throw new Error(`\u6700\u5927\u503C ${r} \u5E94\u5927\u4E8E\u6700\u5C0F\u503C ${t}`);return Math.random()*(r-t)+t}function I(e,t){(!g(e)||e<=0)&&c("generateRandomStringFromSource","num \u5FC5\u987B\u5927\u4E8E0"),(!d(t)||t.length===0)&&c("generateRandomStringFromSource","source \u4E0D\u80FD\u4E3A\u7A7A\u6570\u7EC4");let r="";for(let n=0;n<e;n++)r+=l(t);return r}function Vr(){let e=f({min:1e5,max:999999}),t=[0,1,2,3,4,5,6,7,8,9];return[e,N({format:"YYYYMMDD"}),I(3,t),I(1,[...t,"X","x"])].join("")}function tn(){return l(["13","14","15","16","17","18","19"])+f(999999999).toString().padEnd(9,"0")}function mn(){let e=["http://","https://"],t=[".com",".net",".org",".cn",".top"],r=[`?name=${x({length:{min:4,max:8}})}`,`?id=${f()}`,`?page=${x({length:{min:2,max:4}})}`,`?query=${x({length:{min:5,max:6}})}`,`?search=${x({length:{min:1,max:4}})}`,`?token=${x({length:{min:16,max:16}})}`];return`${l(e)}${x({length:{min:5,max:25}})}${l(t)}${l(r)}`}function Mn(e){return/^\d+$/.test(e)}function En(e){return/^[A-Z]+$/i.test(e)}function kn(e){return/^[A-Z]+$/.test(e)}function Pn(e){return/^[\dA-Z]+$/.test(e)}function Dn(e){return/^[\dA-Z\u4E00-\u9FA5]+$/.test(e)}function Nn(e){return/^[a-z]+$/.test(e)}function Cn(e){return/^[\da-z]+$/.test(e)}function In(e){return/^[\da-z\u4E00-\u9FA5]+$/.test(e)}function vn(e){return/^[\u4E00-\u9FA5]+$/.test(e)}function Un(e){return/^-?(?:0|[1-9]\d*)\.\d+$/.test(e)}function Ln(e){return/^(?:0\.0*[1-9]\d*|[1-9]\d*\.\d+)$/.test(e)}function _n(e){return/^(?:0|[1-9]\d*)\.\d+$/.test(e)}function Kn(e){return/^-(?:0\.0*[1-9]\d*|[1-9]\d*\.\d+)$/.test(e)}function Wn(e){return/^-(?:0|[1-9]\d*)\.\d+$/.test(e)}function Zn(e){return/^-?(?:0|[1-9]\d*)$/.test(e)}function Bn(e){return/^[1-9]\d*$/.test(e)}function Gn(e){return/^(?:0|[1-9]\d*)$/.test(e)&&!Object.is(e,-0)}function qn(e){return/^-[1-9]\d*$/.test(e)}function Vn(e){return/^-(?:0|[1-9]\d*)$/.test(e)||Object.is(e,-0)}import fe from"dayjs";function eo(e){return/^1[3-9]\d{9}$/.test(e)}function to(e){return/^https?:\/\/\S+$/i.test(e)}function ro(e){return/^[^\s@]+@[^\s@][^\s.@]*\.[^\s@]+$/.test(e)}function no(e){return e===""}function ue(e,t="YYYY-MM-DD HH:mm:ss"){return fe(e,t,!0).isValid()}function oo(e){return/^[1-9]\d{5}(?:18|19|20)\d{2}(?:0[1-9]|1[0-2])(?:0[1-9]|[12]\d|3[01])\d{3}[\dX]$/i.test(e)&&ue(e.slice(6,14),"YYYYMMDD")}export{We as base64Decode,Ke as base64Encode,w as castArray,Ze as compose,Be as composeRight,Ve as debounce,B as debugWarn,ct as debugWarnInvalidTypeMessage,_e as decimalToBinary,T as deepClone,H as deepMerge,at as deprecated,mr as generateRandomArray,fr as generateRandomColor,N as generateRandomDate,pe as generateRandomEmail,Ur as generateRandomFloat,Vr as generateRandomIdCard,tn as generateRandomMobilePhone,I as generateRandomStringFromSource,f as getRandomInt,l as getRandomItem,x as getRandomString,mn as getRandomUrl,$e as hasChanged,d as isArray,he as isBoolean,vn as isChineseString,L as isDate,ue as isDateString,Ae as isDef,ro as isEmail,no as isEmptyString,En as isEnglishAphabet,Un as isFloat,j as isFunction,oo as isIdCard,Zn as isInteger,Nn as isLowerCase,Cn as isLowerCaseAndNumber,In as isLowerCaseAndNumberAndChinese,Y as isMap,eo as isMobilePhone,Kn as isNegativeFloat,qn as isNegativeInteger,_n as isNonNegativeFloat,Gn as isNonNegativeInteger,Wn as isNonPositiveFloat,Vn as isNonPositiveInteger,Oe as isNull,g as isNumber,Mn as isNumberOrNumberString,le as isObject,R as isObjectLike,h as isPlainObject,Ln as isPositiveFloat,Bn as isPositiveInteger,K as isPromise,_ as isRegExp,U as isSet,v as isString,F as isSymbol,to as isURL,S as isUndef,we as isUndefined,kn as isUpperCase,Pn as isUpperCaseAndNumber,Dn as isUpperCaseAndNumberAndChinese,V as objectToString,Jt as omit,q as pick,gt as qs,yt as throttle,c as throwError,mt as throwErrorInvalidTypeMessage,O as toTypeString,D as toTypeValue,$t as validatorChineseOrEnglish,At as validatorChineseOrEnglishOrNumber,St as validatorUppercaseOrNumbersOrSpecial,Tt as validatorUppercaseOrNumbersOrUnderline,Mt as withRetry};
|
|
2
|
+
function he(e){let t=typeof e;return e!==null&&(t==="object"||t==="function")}function M(e){return e!==null&&typeof e=="object"}var te=Object.prototype.toString,w=e=>te.call(e),C=e=>w(e).slice(8,-1),k=e=>typeof e=="string",p=e=>typeof e=="number"&&Number.isFinite(e),_=e=>typeof e=="boolean",Se=e=>e===null,j=e=>e===void 0,L=e=>typeof e=="symbol",d=Array.isArray,P=e=>typeof e=="function",K=e=>w(e)==="[object Map]",B=e=>w(e)==="[object Set]",W=e=>w(e)==="[object Date]",z=e=>w(e)==="[object RegExp]",G=e=>M(e)&&P(e?.then)&&P(e?.catch),R=e=>e==null,Te=e=>e!=null,Ee=(e,t)=>e!==t;function b(e){return w(e)==="[object Object]"}function A(e){return d(e)?e:[e]}function ze(e){let t=[],r,n="";for(;e>0;)r=Math.floor(e%2),t.push(r),e=Math.floor(e/2);for(;t.length>0;)n+=t.pop().toString();return n}var H="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function Ge(e){let t="",r="";for(let o=0;o<e.length;o++)r+=e[o].charCodeAt(0).toString(2).padStart(8,"0");for(let o=0;o<r.length;o+=6)t+=H[Number.parseInt(r.slice(o,o+6).padEnd(6,"0"),2)];let n=t.length%4;return n!==0&&(t+="=".repeat(4-n)),t}function He(e){let t="",r="";for(let n=0;n<e.length&&e[n]!=="=";n++)r+=H.indexOf(e[n]).toString(2).padStart(6,"0");for(let n=0;n<r.length;n+=8){let o=Number.parseInt(r.slice(n,n+8),2);o&&(t+=String.fromCharCode(o))}return t}function qe(...e){return e.reduce((t,r)=>function(...n){return r(t(...n))})}function Ve(...e){return e.reduce((t,r)=>function(...n){return t(r(...n))})}function et(e,t=500){let r=null;return function(...n){r&&clearTimeout(r),r=setTimeout(()=>{e.apply(this,n)},t)}}function S(e){let t=new WeakMap;function r(n){if(!M(n))return n;if(W(n))return new Date(n);if(z(n))return new RegExp(n);if(G(n))return n;if(t.has(n))return t.get(n);if(K(n)){let m=new Map;return t.set(n,m),n.forEach((f,l)=>m.set(r(l),r(f))),m}if(B(n)){let m=new Set;return t.set(n,m),n.forEach(f=>m.add(r(f))),m}let o=d(n)?Object.setPrototypeOf([],Object.getPrototypeOf(n)):Object.create(Object.getPrototypeOf(n));t.set(n,o);let c=Object.getOwnPropertyDescriptors(n);for(let m of Reflect.ownKeys(c)){let f=c[m];f.get||f.set?Object.defineProperty(o,m,f):Object.defineProperty(o,m,{...f,value:r(f.value)})}return o}return r(e)}function X(e,t,r={}){return q(Z(e,r),Z(t,r),r)}function q(e,t,r){return d(e)?ne(e,t,r):re(e,t,r)}function re(e,t,r){if(!b(t))return t;let n=Object.getOwnPropertyDescriptors(t);return Reflect.ownKeys(t).forEach(o=>{(b(e[o])||d(e[o]))&&(b(t[o])||d(t[o]))?e[o]=q(e[o],t[o],r):Object.defineProperty(e,o,n[o])}),e}function ne(e,t,r){let{mergeStrategy:n="replace"}=r;if(d(t))switch(n){case"merge":return e.concat(t);case"replace":return t;default:return t}return t}function Z(e,t){let{deepClone:r=!0}=t;return r?S(e):e}var N=class extends Error{constructor(t,r="Utils"){super(t),this.name=r}};function a(e,t){throw new N(`[${e}] ${t}`)}function V(e,t){let r=k(e)?new N(`[${e}] ${t}`,"UtilsWarn"):e;console.warn(r)}var ut=({from:e,replacement:t,version:r,type:n="API"})=>{V(`${n}`,`${e} is about to be deprecated in version ${r}, please use ${t} instead.`)};function pt(e,t,r,n){let o=`Invalid params: type check failed for params "${t}". Expected ${r}, got ${C(n)} with value ${n}.`;a(e,o)}function lt(e,t,r,n){let o=`Invalid params: type check failed for params "${t}". Expected ${r}, got ${C(n)} with value ${n}.`;V(e,o)}var D=(e,t,...r)=>{if(!t)return;let n=r.length===0?"":r.length===1?r[0]:r;console[e](`[Log] ${t}:`,n)},I=(e,...t)=>{D("info",e,...t)};I.info=(e,...t)=>{D("info",e,...t)};I.error=(e,...t)=>{D("error",e,...t)};I.warn=(e,...t)=>{D("warn",e,...t)};typeof globalThis<"u"&&(globalThis.log=I);function oe(e,t){let{decode:r=!0}=t||{},n={};e.startsWith("?")&&(e=e.slice(1)),e.includes("?")&&(e=e.slice(e.indexOf("?")+1));let o=e.split("&").filter(Boolean);for(let c of o){let[m,f]=c.split("=");n[m]=r?decodeURIComponent(f):f}return n}function Q(e,t){let{encode:r=!0}=t||{},n=[];for(let o in e){let c=e[o];n.push(`${o}=${r?encodeURIComponent(c):c}`)}return n.join("&")}function ie(e,t,r){let n=X({encode:!0},{...r}),o=Q(t,n);return e.includes("?")?e.endsWith("?")||e.endsWith("&")?`${e}${o}`:`${e}&${o}`:`${e}?${o}`}var yt={parse:oe,stringify:Q,appendQueryString:ie};function At(e,t=500){let r=null;return function(...n){if(R(r))return r=Date.now(),e.apply(this,n);let o=Date.now();if(o-r>=t)return r=o,e.apply(this,n)}}function Tt(e){return!R(e)&&/^[\dA-Z\u4E00-\u9FA5]+$/i.test(e)}function Et(e){return!R(e)&&/^[A-Z\u4E00-\u9FA5]+$/i.test(e)}function jt(e){return!R(e)&&/^[\d!"#$%&'()*+,./:;<=>?@A-Z[\\\]^_`{|}~]+$/.test(e)}function Mt(e){return/^[\dA-Z_]+$/.test(e)}function It(e){se(e);let{fn:t,maxAttempts:r=3,retryDelay:n=1e3,enableExponentialBackoff:o=!1,signal:c}=e,m,f=c?new Promise((T,O)=>{let E=()=>O(new Error("Operation Cancelled"));c.addEventListener("abort",E),m=()=>c.removeEventListener("abort",E)}):null;return new Promise((T,O)=>{(async()=>{for(let y=1;y<=r;y++){if(c?.aborted)return O(new Error("Operation Cancelled"));try{let $=await Promise.race(f?[t(),f]:[t()]);return T($)}catch($){let U=o?n*2**(y-1):n;if(log("withRetry",`Attempt ${y}/${r} failed. Retrying in ${U}ms...`),$ instanceof Error&&$.message==="Operation Cancelled"||y===r)return O($);await new Promise(ee=>setTimeout(ee,U))}}})()}).finally(()=>m?.())}function se(e){b(e)||a("withRetry",'"Options" must be an object'),typeof e.fn!="function"&&a("withRetry",'"fn" must be a function that returns a Promise'),!j(e.maxAttempts)&&(!Number.isInteger(e.maxAttempts)||e.maxAttempts<1)&&a("withRetry",'"maxAttempts" must be a positive integer'),!j(e.retryDelay)&&(!p(e.retryDelay)||e.retryDelay<0)&&a("withRetry",'"retryDelay" must be a non-negative number'),!j(e.enableExponentialBackoff)&&!_(e.enableExponentialBackoff)&&a("withRetry",'"enableExponentialBackoff" must be a boolean'),!j(e.signal)&&typeof e.signal!="object"&&a("withRetry",'"signal" must be an AbortSignal')}function J(e,t,r={}){let{includeProto:n=!1,includeSymbols:o=!0,includeNonEnum:c=!1}=r,m={};return b(e)&&A(t).forEach(l=>{L(l)&&!o||!(n?l in e:Object.hasOwn(e,l))||!c&&(n?ae(e,l):Object.getOwnPropertyDescriptor(e,l))?.enumerable===!1||(m[l]=S(e[l]))}),m}function ae(e,t){let r=e;for(;r!==null;){let n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=Object.getPrototypeOf(r)}}function ir(e,t){if(!b(e))return{};let r=S(e),n=A(t),o=Object.keys(r).filter(c=>!n.includes(c));return J(r,o)}function gr(e,t){return(!p(e)||e<=0)&&a("generateRandomArray","num must be greater than 0"),P(t)||a("generateRandomArray","cb must be a function"),Array.from({length:e}).fill(0).map((r,n)=>t(r,n))}function br(){return`#${Math.random().toString(16).slice(2,8).padEnd(6,"0")}`}import h from"dayjs";import fe from"dayjs/plugin/customParseFormat.js";function g(e){return e[Math.floor(Math.random()*e.length)]}function u(e={}){p(e)&&(e={max:e});let{min:t=1,max:r=g(ce())}=e;me(t,r);let n=Math.ceil(t),o=Math.floor(r);return Math.floor(Math.random()*(o-n+1)+n)}function me(e,t){let r=Math.ceil(e),n=Math.floor(t);Number.isSafeInteger(r)||a("getRandomInt",`The minimum value Math.ceil(${e}) should be a safe integer`),Number.isSafeInteger(n)||a("getRandomInt",`The maximum value Math.floor(${t}) should be a safe integer`),n<r&&(t>=e&&a("getRandomInt",`No integer value found between ${e} and ${t}`),a("getRandomInt",`The maximum value ${t} should be greater than the minimum value ${e}`))}function ce(){return Array.from({length:Number.MAX_SAFE_INTEGER.toString().length}).map((e,t)=>{let r=Number.MAX_SAFE_INTEGER.toString().slice(0,t+1);return Number(r)})}h.extend(fe);function v(e={}){let{start:t="1800-01-01 00:00:00",end:r=h().format("YYYY-MM-DD HH:mm:ss"),format:n="YYYY-MM-DD HH:mm:ss"}=e;(!h(t).isValid()||!h(r).isValid())&&a("generateRandomDate","start and end parameters must be valid date format");let o=h(t).year(),c=h(r).year(),m=u({min:o,max:c}),f=u({min:1,max:12}),l=u({min:1,max:31}),T=u(23),O=u(59),E=u(59),y=h(`${m}-${f}-${l} ${T}:${O}:${E}`);return y.isBefore(h(t))||y.isAfter(h(r))?v(e):y.format(n)}function x(e={}){let t=pe(e),r=le(t);ge(r);let{length:n}=t;de(n.min,n.max);let o=u(n),c=t.prefix||"";for(let m=0;m<o;m++)c+=r.charAt(Math.floor(Math.random()*r.length));return c+(t.suffix||"")}var ue=16,F=1;function pe(e){let t=p(e);return{lowerCase:!0,upperCase:!0,number:!0,...t?{}:e,length:t?{max:e,min:e}:p(e.length)?{max:e.length,min:e.length}:{max:ue,min:F,...e.length},extra:t?[]:[...new Set(A(e.extra||[]))]}}function le(e){let t="";return e.lowerCase&&(t+="abcdefghijklmnopqrstuvwxyz"),e.upperCase&&(t+="ABCDEFGHIJKLMNOPQRSTUVWXYZ"),e.number&&(t+="0123456789"),t+=A(e.extra).join(""),t}function ge(e){e.length===0&&a("getRandomString","At least one character set (lowercase, uppercase, number) must be enabled or extra characters provided")}function de(e,t){Number.isInteger(e)||a("getRandomString","min must be an integer"),Number.isInteger(t)||a("getRandomString","max must be an integer"),e<F&&a("getRandomString",`Minimum length cannot be less than ${F}`),t<e&&a("getRandomString","Maximum length cannot be less than minimum length")}function xe(){let e=["gmail.com","outlook.com.cn","example.com","qq.com","163.com","test.com.cn"],t=`${x(1)}${x({length:u({max:30,min:1})})}${x(1)}@${g(e)}`;return/\.{2,}/.test(t)?xe():t}function zr(e={}){p(e)&&(e={max:e});let{min:t=0,max:r=1,fractionDigits:n=2}=e;if(t===r)return t;if(t>r)throw new Error(`Maximum value ${r} should be greater than minimum value ${t}`);return Math.random()*(r-t)+t}function Y(e,t){(!p(e)||e<=0)&&a("generateRandomStringFromSource","num must be greater than 0"),(!d(t)||t.length===0)&&a("generateRandomStringFromSource","source cannot be empty array");let r="";for(let n=0;n<e;n++)r+=g(t);return r}function rn(){let e=u({min:1e5,max:999999}),t=[0,1,2,3,4,5,6,7,8,9];return[e,v({format:"YYYYMMDD"}),Y(3,t),Y(1,[...t,"X","x"])].join("")}function mn(){return g(["13","14","15","16","17","18","19"])+u(999999999).toString().padEnd(9,"0")}function gn(){let e=["http://","https://"],t=[".com",".net",".org",".cn",".top"],r=[`?name=${x({length:{min:4,max:8}})}`,`?id=${u()}`,`?page=${x({length:{min:2,max:4}})}`,`?query=${x({length:{min:5,max:6}})}`,`?search=${x({length:{min:1,max:4}})}`,`?token=${x({length:{min:16,max:16}})}`];return`${g(e)}${x({length:{min:5,max:25}})}${g(t)}${g(r)}`}function In(e){return/^\d+$/.test(e)}function Cn(e){return/^[A-Z]+$/i.test(e)}function vn(e){return/^[A-Z]+$/.test(e)}function Fn(e){return/^[\dA-Z]+$/.test(e)}function Yn(e){return/^[\dA-Z\u4E00-\u9FA5]+$/.test(e)}function Un(e){return/^[a-z]+$/.test(e)}function _n(e){return/^[\da-z]+$/.test(e)}function Ln(e){return/^[\da-z\u4E00-\u9FA5]+$/.test(e)}function Kn(e){return/^[\u4E00-\u9FA5]+$/.test(e)}function zn(e){return/^-?(?:0|[1-9]\d*)\.\d+$/.test(e)}function Gn(e){return/^(?:0\.0*[1-9]\d*|[1-9]\d*\.\d+)$/.test(e)}function Hn(e){return/^(?:0|[1-9]\d*)\.\d+$/.test(e)}function Zn(e){return/^-(?:0\.0*[1-9]\d*|[1-9]\d*\.\d+)$/.test(e)}function Xn(e){return/^-(?:0|[1-9]\d*)\.\d+$/.test(e)}function Qn(e){return/^-?(?:0|[1-9]\d*)$/.test(e)}function Jn(e){return/^[1-9]\d*$/.test(e)}function eo(e){return/^(?:0|[1-9]\d*)$/.test(e)&&!Object.is(e,-0)}function to(e){return/^-[1-9]\d*$/.test(e)}function ro(e){return/^-(?:0|[1-9]\d*)$/.test(e)||Object.is(e,-0)}var so=e=>{if(!k(e))return!1;let t=e.trim();if(t===""||t.includes("e")||t.includes("E")||t.includes("0x")||t.includes("0X")||t.includes("0o")||t.includes("0O")||t.includes("0b")||t.includes("0B"))return!1;let r=Number(t);return!(!Number.isFinite(r)||r>Number.MAX_SAFE_INTEGER||r<Number.MIN_SAFE_INTEGER)};import be from"dayjs";function fo(e){return/^1[3-9]\d{9}$/.test(e)}function uo(e){return/^https?:\/\/\S+$/i.test(e)}function po(e){return/^[^\s@]+@[^\s@][^\s.@]*\.[^\s@]+$/.test(e)}function lo(e){return e===""}function ye(e,t="YYYY-MM-DD HH:mm:ss"){return be(e,t,!0).isValid()}function go(e){return/^[1-9]\d{5}(?:18|19|20)\d{2}(?:0[1-9]|1[0-2])(?:0[1-9]|[12]\d|3[01])\d{3}[\dX]$/i.test(e)&&ye(e.slice(6,14),"YYYYMMDD")}export{N as UtilsError,He as base64Decode,Ge as base64Encode,A as castArray,qe as compose,Ve as composeRight,et as debounce,V as debugWarn,lt as debugWarnInvalidTypeMessage,ze as decimalToBinary,S as deepClone,X as deepMerge,ut as deprecated,gr as generateRandomArray,br as generateRandomColor,v as generateRandomDate,xe as generateRandomEmail,zr as generateRandomFloat,rn as generateRandomIdCard,mn as generateRandomMobilePhone,Y as generateRandomStringFromSource,u as getRandomInt,g as getRandomItem,x as getRandomString,gn as getRandomUrl,Ee as hasChanged,d as isArray,_ as isBoolean,Kn as isChineseString,W as isDate,ye as isDateString,Te as isDef,po as isEmail,lo as isEmptyString,Cn as isEnglishAphabet,zn as isFloat,P as isFunction,go as isIdCard,Qn as isInteger,Un as isLowerCase,_n as isLowerCaseAndNumber,Ln as isLowerCaseAndNumberAndChinese,K as isMap,fo as isMobilePhone,Zn as isNegativeFloat,to as isNegativeInteger,Hn as isNonNegativeFloat,eo as isNonNegativeInteger,Xn as isNonPositiveFloat,ro as isNonPositiveInteger,Se as isNull,p as isNumber,In as isNumberOrNumberString,he as isObject,M as isObjectLike,b as isPlainObject,Gn as isPositiveFloat,Jn as isPositiveInteger,G as isPromise,z as isRegExp,B as isSet,k as isString,so as isStringNumber,L as isSymbol,uo as isURL,R as isUndef,j as isUndefined,vn as isUpperCase,Fn as isUpperCaseAndNumber,Yn as isUpperCaseAndNumberAndChinese,te as objectToString,ir as omit,J as pick,yt as qs,At as throttle,a as throwError,pt as throwErrorInvalidTypeMessage,w as toTypeString,C as toTypeValue,Et as validatorChineseOrEnglish,Tt as validatorChineseOrEnglishOrNumber,jt as validatorUppercaseOrNumbersOrSpecial,Mt as validatorUppercaseOrNumbersOrUnderline,It as withRetry};
|
package/dist/utils.global.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var lntvowUtils=(()=>{var qt=Object.create;var ft=Object.defineProperty;var Gt=Object.getOwnPropertyDescriptor;var Jt=Object.getOwnPropertyNames;var Qt=Object.getPrototypeOf,te=Object.prototype.hasOwnProperty;var Lt=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),ee=(t,e)=>{for(var n in e)ft(t,n,{get:e[n],enumerable:!0})},_t=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Jt(e))!te.call(t,o)&&o!==n&&ft(t,o,{get:()=>e[o],enumerable:!(r=Gt(e,o))||r.enumerable});return t};var wt=(t,e,n)=>(n=t!=null?qt(Qt(t)):{},_t(e||!t||!t.__esModule?ft(n,"default",{value:t,enumerable:!0}):n,t)),ne=t=>_t(ft({},"__esModule",{value:!0}),t);var Ct=Lt((Rt,Et)=>{"use strict";(function(t,e){typeof Rt=="object"&&typeof Et<"u"?Et.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs=e()})(Rt,function(){"use strict";var t=1e3,e=6e4,n=36e5,r="millisecond",o="second",y="minute",d="hour",b="day",g="week",O="month",I="quarter",A="year",F="date",at="Invalid Date",p=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,x=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,S={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(c){var s=["th","st","nd","rd"],i=c%100;return"["+c+(s[(i-20)%10]||s[i]||s[0])+"]"}},w=function(c,s,i){var u=String(c);return!u||u.length>=s?c:""+Array(s+1-u.length).join(i)+c},z={s:w,z:function(c){var s=-c.utcOffset(),i=Math.abs(s),u=Math.floor(i/60),a=i%60;return(s<=0?"+":"-")+w(u,2,"0")+":"+w(a,2,"0")},m:function c(s,i){if(s.date()<i.date())return-c(i,s);var u=12*(i.year()-s.year())+(i.month()-s.month()),a=s.clone().add(u,O),f=i-a<0,m=s.clone().add(u+(f?-1:1),O);return+(-(u+(i-a)/(f?a-m:m-a))||0)},a:function(c){return c<0?Math.ceil(c)||0:Math.floor(c)},p:function(c){return{M:O,y:A,w:g,d:b,D:F,h:d,m:y,s:o,ms:r,Q:I}[c]||String(c||"").toLowerCase().replace(/s$/,"")},u:function(c){return c===void 0}},Y="en",N={};N[Y]=S;var K="$isDayjsObject",L=function(c){return c instanceof R||!(!c||!c[K])},E=function c(s,i,u){var a;if(!s)return Y;if(typeof s=="string"){var f=s.toLowerCase();N[f]&&(a=f),i&&(N[f]=i,a=f);var m=s.split("-");if(!a&&m.length>1)return c(m[0])}else{var l=s.name;N[l]=s,a=l}return!u&&a&&(Y=a),a||!u&&Y},$=function(c,s){if(L(c))return c.clone();var i=typeof s=="object"?s:{};return i.date=c,i.args=arguments,new R(i)},h=z;h.l=E,h.i=L,h.w=function(c,s){return $(c,{locale:s.$L,utc:s.$u,x:s.$x,$offset:s.$offset})};var R=function(){function c(i){this.$L=E(i.locale,null,!0),this.parse(i),this.$x=this.$x||i.x||{},this[K]=!0}var s=c.prototype;return s.parse=function(i){this.$d=function(u){var a=u.date,f=u.utc;if(a===null)return new Date(NaN);if(h.u(a))return new Date;if(a instanceof Date)return new Date(a);if(typeof a=="string"&&!/Z$/i.test(a)){var m=a.match(p);if(m){var l=m[2]-1||0,M=(m[7]||"0").substring(0,3);return f?new Date(Date.UTC(m[1],l,m[3]||1,m[4]||0,m[5]||0,m[6]||0,M)):new Date(m[1],l,m[3]||1,m[4]||0,m[5]||0,m[6]||0,M)}}return new Date(a)}(i),this.init()},s.init=function(){var i=this.$d;this.$y=i.getFullYear(),this.$M=i.getMonth(),this.$D=i.getDate(),this.$W=i.getDay(),this.$H=i.getHours(),this.$m=i.getMinutes(),this.$s=i.getSeconds(),this.$ms=i.getMilliseconds()},s.$utils=function(){return h},s.isValid=function(){return this.$d.toString()!==at},s.isSame=function(i,u){var a=$(i);return this.startOf(u)<=a&&a<=this.endOf(u)},s.isAfter=function(i,u){return $(i)<this.startOf(u)},s.isBefore=function(i,u){return this.endOf(u)<$(i)},s.$g=function(i,u,a){return h.u(i)?this[u]:this.set(a,i)},s.unix=function(){return Math.floor(this.valueOf()/1e3)},s.valueOf=function(){return this.$d.getTime()},s.startOf=function(i,u){var a=this,f=!!h.u(u)||u,m=h.p(i),l=function(V,j){var H=h.w(a.$u?Date.UTC(a.$y,j,V):new Date(a.$y,j,V),a);return f?H:H.endOf(b)},M=function(V,j){return h.w(a.toDate()[V].apply(a.toDate("s"),(f?[0,0,0,0]:[23,59,59,999]).slice(j)),a)},D=this.$W,T=this.$M,P=this.$D,J="set"+(this.$u?"UTC":"");switch(m){case A:return f?l(1,0):l(31,11);case O:return f?l(1,T):l(0,T+1);case g:var X=this.$locale().weekStart||0,nt=(D<X?D+7:D)-X;return l(f?P-nt:P+(6-nt),T);case b:case F:return M(J+"Hours",0);case d:return M(J+"Minutes",1);case y:return M(J+"Seconds",2);case o:return M(J+"Milliseconds",3);default:return this.clone()}},s.endOf=function(i){return this.startOf(i,!1)},s.$set=function(i,u){var a,f=h.p(i),m="set"+(this.$u?"UTC":""),l=(a={},a[b]=m+"Date",a[F]=m+"Date",a[O]=m+"Month",a[A]=m+"FullYear",a[d]=m+"Hours",a[y]=m+"Minutes",a[o]=m+"Seconds",a[r]=m+"Milliseconds",a)[f],M=f===b?this.$D+(u-this.$W):u;if(f===O||f===A){var D=this.clone().set(F,1);D.$d[l](M),D.init(),this.$d=D.set(F,Math.min(this.$D,D.daysInMonth())).$d}else l&&this.$d[l](M);return this.init(),this},s.set=function(i,u){return this.clone().$set(i,u)},s.get=function(i){return this[h.p(i)]()},s.add=function(i,u){var a,f=this;i=Number(i);var m=h.p(u),l=function(T){var P=$(f);return h.w(P.date(P.date()+Math.round(T*i)),f)};if(m===O)return this.set(O,this.$M+i);if(m===A)return this.set(A,this.$y+i);if(m===b)return l(1);if(m===g)return l(7);var M=(a={},a[y]=e,a[d]=n,a[o]=t,a)[m]||1,D=this.$d.getTime()+i*M;return h.w(D,this)},s.subtract=function(i,u){return this.add(-1*i,u)},s.format=function(i){var u=this,a=this.$locale();if(!this.isValid())return a.invalidDate||at;var f=i||"YYYY-MM-DDTHH:mm:ssZ",m=h.z(this),l=this.$H,M=this.$m,D=this.$M,T=a.weekdays,P=a.months,J=a.meridiem,X=function(j,H,q,Q){return j&&(j[H]||j(u,f))||q[H].slice(0,Q)},nt=function(j){return h.s(l%12||12,j,"0")},V=J||function(j,H,q){var Q=j<12?"AM":"PM";return q?Q.toLowerCase():Q};return f.replace(x,function(j,H){return H||function(q){switch(q){case"YY":return String(u.$y).slice(-2);case"YYYY":return h.s(u.$y,4,"0");case"M":return D+1;case"MM":return h.s(D+1,2,"0");case"MMM":return X(a.monthsShort,D,P,3);case"MMMM":return X(P,D);case"D":return u.$D;case"DD":return h.s(u.$D,2,"0");case"d":return String(u.$W);case"dd":return X(a.weekdaysMin,u.$W,T,2);case"ddd":return X(a.weekdaysShort,u.$W,T,3);case"dddd":return T[u.$W];case"H":return String(l);case"HH":return h.s(l,2,"0");case"h":return nt(1);case"hh":return nt(2);case"a":return V(l,M,!0);case"A":return V(l,M,!1);case"m":return String(M);case"mm":return h.s(M,2,"0");case"s":return String(u.$s);case"ss":return h.s(u.$s,2,"0");case"SSS":return h.s(u.$ms,3,"0");case"Z":return m}return null}(j)||m.replace(":","")})},s.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},s.diff=function(i,u,a){var f,m=this,l=h.p(u),M=$(i),D=(M.utcOffset()-this.utcOffset())*e,T=this-M,P=function(){return h.m(m,M)};switch(l){case A:f=P()/12;break;case O:f=P();break;case I:f=P()/3;break;case g:f=(T-D)/6048e5;break;case b:f=(T-D)/864e5;break;case d:f=T/n;break;case y:f=T/e;break;case o:f=T/t;break;default:f=T}return a?f:h.a(f)},s.daysInMonth=function(){return this.endOf(O).$D},s.$locale=function(){return N[this.$L]},s.locale=function(i,u){if(!i)return this.$L;var a=this.clone(),f=E(i,u,!0);return f&&(a.$L=f),a},s.clone=function(){return h.w(this.$d,this)},s.toDate=function(){return new Date(this.valueOf())},s.toJSON=function(){return this.isValid()?this.toISOString():null},s.toISOString=function(){return this.$d.toISOString()},s.toString=function(){return this.$d.toUTCString()},c}(),C=R.prototype;return $.prototype=C,[["$ms",r],["$s",o],["$m",y],["$H",d],["$W",b],["$M",O],["$y",A],["$D",F]].forEach(function(c){C[c[1]]=function(s){return this.$g(s,c[0],c[1])}}),$.extend=function(c,s){return c.$i||(c(s,R,$),c.$i=!0),$},$.locale=E,$.isDayjs=L,$.unix=function(c){return $(1e3*c)},$.en=N[Y],$.Ls=N,$.p={},$})});var zt=Lt((Pt,It)=>{"use strict";(function(t,e){typeof Pt=="object"&&typeof It<"u"?It.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs_plugin_customParseFormat=e()})(Pt,function(){"use strict";var t={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},e=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,n=/\d/,r=/\d\d/,o=/\d\d?/,y=/\d*[^-_:/,()\s\d]+/,d={},b=function(p){return(p=+p)+(p>68?1900:2e3)},g=function(p){return function(x){this[p]=+x}},O=[/[+-]\d\d:?(\d\d)?|Z/,function(p){(this.zone||(this.zone={})).offset=function(x){if(!x||x==="Z")return 0;var S=x.match(/([+-]|\d\d)/g),w=60*S[1]+(+S[2]||0);return w===0?0:S[0]==="+"?-w:w}(p)}],I=function(p){var x=d[p];return x&&(x.indexOf?x:x.s.concat(x.f))},A=function(p,x){var S,w=d.meridiem;if(w){for(var z=1;z<=24;z+=1)if(p.indexOf(w(z,0,x))>-1){S=z>12;break}}else S=p===(x?"pm":"PM");return S},F={A:[y,function(p){this.afternoon=A(p,!1)}],a:[y,function(p){this.afternoon=A(p,!0)}],Q:[n,function(p){this.month=3*(p-1)+1}],S:[n,function(p){this.milliseconds=100*+p}],SS:[r,function(p){this.milliseconds=10*+p}],SSS:[/\d{3}/,function(p){this.milliseconds=+p}],s:[o,g("seconds")],ss:[o,g("seconds")],m:[o,g("minutes")],mm:[o,g("minutes")],H:[o,g("hours")],h:[o,g("hours")],HH:[o,g("hours")],hh:[o,g("hours")],D:[o,g("day")],DD:[r,g("day")],Do:[y,function(p){var x=d.ordinal,S=p.match(/\d+/);if(this.day=S[0],x)for(var w=1;w<=31;w+=1)x(w).replace(/\[|\]/g,"")===p&&(this.day=w)}],w:[o,g("week")],ww:[r,g("week")],M:[o,g("month")],MM:[r,g("month")],MMM:[y,function(p){var x=I("months"),S=(I("monthsShort")||x.map(function(w){return w.slice(0,3)})).indexOf(p)+1;if(S<1)throw new Error;this.month=S%12||S}],MMMM:[y,function(p){var x=I("months").indexOf(p)+1;if(x<1)throw new Error;this.month=x%12||x}],Y:[/[+-]?\d+/,g("year")],YY:[r,function(p){this.year=b(p)}],YYYY:[/\d{4}/,g("year")],Z:O,ZZ:O};function at(p){var x,S;x=p,S=d&&d.formats;for(var w=(p=x.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function($,h,R){var C=R&&R.toUpperCase();return h||S[R]||t[R]||S[C].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(c,s,i){return s||i.slice(1)})})).match(e),z=w.length,Y=0;Y<z;Y+=1){var N=w[Y],K=F[N],L=K&&K[0],E=K&&K[1];w[Y]=E?{regex:L,parser:E}:N.replace(/^\[|\]$/g,"")}return function($){for(var h={},R=0,C=0;R<z;R+=1){var c=w[R];if(typeof c=="string")C+=c.length;else{var s=c.regex,i=c.parser,u=$.slice(C),a=s.exec(u)[0];i.call(h,a),$=$.replace(a,"")}}return function(f){var m=f.afternoon;if(m!==void 0){var l=f.hours;m?l<12&&(f.hours+=12):l===12&&(f.hours=0),delete f.afternoon}}(h),h}}return function(p,x,S){S.p.customParseFormat=!0,p&&p.parseTwoDigitYear&&(b=p.parseTwoDigitYear);var w=x.prototype,z=w.parse;w.parse=function(Y){var N=Y.date,K=Y.utc,L=Y.args;this.$u=K;var E=L[1];if(typeof E=="string"){var $=L[2]===!0,h=L[3]===!0,R=$||h,C=L[2];h&&(C=L[2]),d=this.$locale(),!$&&C&&(d=S.Ls[C]),this.$d=function(u,a,f,m){try{if(["x","X"].indexOf(a)>-1)return new Date((a==="X"?1e3:1)*u);var l=at(a)(u),M=l.year,D=l.month,T=l.day,P=l.hours,J=l.minutes,X=l.seconds,nt=l.milliseconds,V=l.zone,j=l.week,H=new Date,q=T||(M||D?1:H.getDate()),Q=M||H.getFullYear(),ut=0;M&&!D||(ut=D>0?D-1:H.getMonth());var ct,yt=P||0,xt=J||0,bt=X||0,$t=nt||0;return V?new Date(Date.UTC(Q,ut,q,yt,xt,bt,$t+60*V.offset*1e3)):f?new Date(Date.UTC(Q,ut,q,yt,xt,bt,$t)):(ct=new Date(Q,ut,q,yt,xt,bt,$t),j&&(ct=m(ct).week(j).toDate()),ct)}catch{return new Date("")}}(N,E,K,S),this.init(),C&&C!==!0&&(this.$L=this.locale(C).$L),R&&N!=this.format(E)&&(this.$d=new Date("")),d={}}else if(E instanceof Array)for(var c=E.length,s=1;s<=c;s+=1){L[1]=E[s-1];var i=S.apply(this,L);if(i.isValid()){this.$d=i.$d,this.$L=i.$L,this.init();break}s===c&&(this.$d=new Date(""))}else z.call(this,Y)}}})});var gn={};ee(gn,{base64Decode:()=>me,base64Encode:()=>fe,castArray:()=>et,compose:()=>pe,composeRight:()=>de,debounce:()=>le,debugWarn:()=>jt,debugWarnInvalidTypeMessage:()=>be,decimalToBinary:()=>ce,deepClone:()=>ot,deepMerge:()=>kt,deprecated:()=>ye,generateRandomArray:()=>Ye,generateRandomColor:()=>Re,generateRandomDate:()=>gt,generateRandomEmail:()=>Vt,generateRandomFloat:()=>Fe,generateRandomIdCard:()=>He,generateRandomMobilePhone:()=>Ue,generateRandomStringFromSource:()=>ht,getRandomInt:()=>k,getRandomItem:()=>_,getRandomString:()=>Z,getRandomUrl:()=>We,hasChanged:()=>ue,isArray:()=>W,isBoolean:()=>oe,isChineseString:()=>Je,isDate:()=>vt,isDateString:()=>Xt,isDef:()=>ae,isEmail:()=>pn,isEmptyString:()=>dn,isEnglishAphabet:()=>ze,isFloat:()=>Qe,isFunction:()=>st,isIdCard:()=>ln,isInteger:()=>on,isLowerCase:()=>Xe,isLowerCaseAndNumber:()=>qe,isLowerCaseAndNumberAndChinese:()=>Ge,isMap:()=>St,isMobilePhone:()=>fn,isNegativeFloat:()=>nn,isNegativeInteger:()=>un,isNonNegativeFloat:()=>en,isNonNegativeInteger:()=>an,isNonPositiveFloat:()=>rn,isNonPositiveInteger:()=>cn,isNull:()=>ie,isNumber:()=>U,isNumberOrNumberString:()=>Ze,isObject:()=>re,isObjectLike:()=>it,isPlainObject:()=>G,isPositiveFloat:()=>tn,isPositiveInteger:()=>sn,isPromise:()=>Tt,isRegExp:()=>At,isSet:()=>Dt,isString:()=>Mt,isSymbol:()=>Ot,isURL:()=>mn,isUndef:()=>rt,isUndefined:()=>se,isUpperCase:()=>Ke,isUpperCaseAndNumber:()=>Ve,isUpperCaseAndNumberAndChinese:()=>Be,objectToString:()=>Ft,omit:()=>je,pick:()=>Yt,qs:()=>Me,throttle:()=>Oe,throwError:()=>v,throwErrorInvalidTypeMessage:()=>xe,toTypeString:()=>tt,toTypeValue:()=>mt,validatorChineseOrEnglish:()=>De,validatorChineseOrEnglishOrNumber:()=>Se,validatorUppercaseOrNumbersOrSpecial:()=>ve,validatorUppercaseOrNumbersOrUnderline:()=>Ae,withRetry:()=>Te});function re(t){let e=typeof t;return t!==null&&(e==="object"||e==="function")}function it(t){return t!==null&&typeof t=="object"}var Ft=Object.prototype.toString,tt=t=>Ft.call(t),mt=t=>tt(t).slice(8,-1),Mt=t=>typeof t=="string",U=t=>typeof t=="number"&&Number.isFinite(t),oe=t=>typeof t=="boolean",ie=t=>t===null,se=t=>t===void 0,Ot=t=>typeof t=="symbol",W=Array.isArray,st=t=>typeof t=="function",St=t=>tt(t)==="[object Map]",Dt=t=>tt(t)==="[object Set]",vt=t=>tt(t)==="[object Date]",At=t=>tt(t)==="[object RegExp]",Tt=t=>it(t)&&st(t?.then)&&st(t?.catch),rt=t=>t==null,ae=t=>t!=null,ue=(t,e)=>t!==e;function G(t){return tt(t)==="[object Object]"}function et(t){return W(t)?t:[t]}function ce(t){let e=[],n,r="";for(;t>0;)n=Math.floor(t%2),e.push(n),t=Math.floor(t/2);for(;e.length>0;)r+=e.pop().toString();return r}var Ht="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function fe(t){let e="",n="";for(let o=0;o<t.length;o++)n+=t[o].charCodeAt(0).toString(2).padStart(8,"0");for(let o=0;o<n.length;o+=6)e+=Ht[Number.parseInt(n.slice(o,o+6).padEnd(6,"0"),2)];let r=e.length%4;return r!==0&&(e+="=".repeat(4-r)),e}function me(t){let e="",n="";for(let r=0;r<t.length&&t[r]!=="=";r++)n+=Ht.indexOf(t[r]).toString(2).padStart(6,"0");for(let r=0;r<n.length;r+=8){let o=Number.parseInt(n.slice(r,r+8),2);o&&(e+=String.fromCharCode(o))}return e}function pe(...t){return t.reduce((e,n)=>function(...r){return n(e(...r))})}function de(...t){return t.reduce((e,n)=>function(...r){return e(n(...r))})}function le(t,e=500){let n=null;return function(...r){n&&clearTimeout(n),n=setTimeout(()=>{t.apply(this,r)},e)}}function ot(t){let e=new WeakMap;function n(r){if(!it(r))return r;if(vt(r))return new Date(r);if(At(r))return new RegExp(r);if(Tt(r))return r;if(e.has(r))return e.get(r);if(St(r)){let d=new Map;return e.set(r,d),r.forEach((b,g)=>d.set(n(g),n(b))),d}if(Dt(r)){let d=new Set;return e.set(r,d),r.forEach(b=>d.add(n(b))),d}let o=W(r)?Object.setPrototypeOf([],Object.getPrototypeOf(r)):Object.create(Object.getPrototypeOf(r));e.set(r,o);let y=Object.getOwnPropertyDescriptors(r);for(let d of Reflect.ownKeys(y)){let b=y[d];b.get||b.set?Object.defineProperty(o,d,b):Object.defineProperty(o,d,{...b,value:n(b.value)})}return o}return n(t)}function kt(t,e,n={}){return Wt(Ut(t,n),Ut(e,n),n)}function Wt(t,e,n){return W(t)?he(t,e,n):ge(t,e,n)}function ge(t,e,n){if(!G(e))return e;let r=Object.getOwnPropertyDescriptors(e);return Reflect.ownKeys(e).forEach(o=>{(G(t[o])||W(t[o]))&&(G(e[o])||W(e[o]))?t[o]=Wt(t[o],e[o],n):Object.defineProperty(t,o,r[o])}),t}function he(t,e,n){let{mergeStrategy:r="replace"}=n;if(W(e))switch(r){case"merge":return t.concat(e);case"replace":return e;default:return e}return e}function Ut(t,e){let{deepClone:n=!0}=e;return n?ot(t):t}var pt=class extends Error{constructor(e,n="Utils"){super(e),this.name=n}};function v(t,e){throw new pt(`[${t}] ${e}`)}function jt(t,e){let n=Mt(t)?new pt(`[${t}] ${e}`,"UtilsWarn"):t;console.warn(n)}var ye=({from:t,replacement:e,version:n,type:r="API"})=>{jt(`${r}`,`${t} is about to be deprecated in version ${n}, please use ${e} instead.`)};function xe(t,e,n,r){let o=`Invalid params: type check failed for params "${e}". Expected ${n}, got ${mt(r)} with value ${r}.`;v(t,o)}function be(t,e,n,r){let o=`Invalid params: type check failed for params "${e}". Expected ${n}, got ${mt(r)} with value ${r}.`;jt(t,o)}var dt=(t,e,...n)=>{if(!e)return;let r=n.length===0?"":n.length===1?n[0]:n;console[t](`[Log] ${e}:`,r)},lt=(t,...e)=>{dt("info",t,...e)};lt.info=(t,...e)=>{dt("info",t,...e)};lt.error=(t,...e)=>{dt("error",t,...e)};lt.warn=(t,...e)=>{dt("warn",t,...e)};typeof globalThis<"u"&&(globalThis.log=lt);function $e(t,e){let{decode:n=!0}=e||{},r={};t.startsWith("?")&&(t=t.slice(1)),t.includes("?")&&(t=t.slice(t.indexOf("?")+1));let o=t.split("&").filter(Boolean);for(let y of o){let[d,b]=y.split("=");r[d]=n?decodeURIComponent(b):b}return r}function Zt(t,e){let{encode:n=!0}=e||{},r=[];for(let o in t){let y=t[o];r.push(`${o}=${n?encodeURIComponent(y):y}`)}return r.join("&")}function we(t,e,n){let r=kt({encode:!0},{...n}),o=Zt(e,r);return t.includes("?")?t.endsWith("?")||t.endsWith("&")?`${t}${o}`:`${t}&${o}`:`${t}?${o}`}var Me={parse:$e,stringify:Zt,appendQueryString:we};function Oe(t,e=500){let n=null;return function(...r){if(rt(n))return n=Date.now(),t.apply(this,r);let o=Date.now();if(o-n>=e)return n=o,t.apply(this,r)}}function Se(t){return!rt(t)&&/^[\dA-Z\u4E00-\u9FA5]+$/i.test(t)}function De(t){return!rt(t)&&/^[A-Z\u4E00-\u9FA5]+$/i.test(t)}function ve(t){return!rt(t)&&/^[\d!"#$%&'()*+,./:;<=>?@A-Z[\\\]^_`{|}~]+$/.test(t)}function Ae(t){return/^[\dA-Z_]+$/.test(t)}async function Te(t){let{fn:e,maxAttempts:n=3,retryDelay:r=1e3,enableExponentialBackoff:o=!1,signal:y}=t,d,b=new Promise((O,I)=>{if(y){let A=()=>I(new Error("Operation Cancelled"));y.addEventListener("abort",A),d=()=>y.removeEventListener("abort",A)}}),g=0;try{for(;;){if(console.log("while: ",g),y?.aborted)throw new Error("Operation Cancelled");try{return await Promise.race([e(),b])}catch(O){if(O instanceof Error&&O.message==="Operation Cancelled"||(g++,g>=n))throw O;let I=o?r*2**(g-1):r;await new Promise(A=>setTimeout(A,I))}}}finally{d?.()}}function Yt(t,e,n={}){let{includeProto:r=!1,includeSymbols:o=!0,includeNonEnum:y=!1}=n,d={};return G(t)&&et(e).forEach(g=>{Ot(g)&&!o||!(r?g in t:Object.hasOwn(t,g))||!y&&(r?ke(t,g):Object.getOwnPropertyDescriptor(t,g))?.enumerable===!1||(d[g]=ot(t[g]))}),d}function ke(t,e){let n=t;for(;n!==null;){let r=Object.getOwnPropertyDescriptor(n,e);if(r)return r;n=Object.getPrototypeOf(n)}}function je(t,e){if(!G(t))return{};let n=ot(t),r=et(e),o=Object.keys(n).filter(y=>!r.includes(y));return Yt(n,o)}function Ye(t,e){return(!U(t)||t<=0)&&v("generateRandomArray","num \u5FC5\u987B\u5927\u4E8E0"),st(e)||v("generateRandomArray","cb \u5FC5\u987B\u662F\u51FD\u6570"),Array.from({length:t}).fill(0).map((n,r)=>e(n,r))}function Re(){return`#${Math.random().toString(16).slice(2,8).padEnd(6,"0")}`}var B=wt(Ct(),1),Kt=wt(zt(),1);function _(t){return t[Math.floor(Math.random()*t.length)]}function k(t={}){U(t)&&(t={max:t});let{min:e=1,max:n=_(Ce())}=t;Ee(e,n);let r=Math.ceil(e),o=Math.floor(n);return Math.floor(Math.random()*(o-r+1)+r)}function Ee(t,e){let n=Math.ceil(t),r=Math.floor(e);Number.isSafeInteger(n)||v("getRandomInt",`The minimum value Math.ceil(${t}) should be a safe integer`),Number.isSafeInteger(r)||v("getRandomInt",`The maximum value Math.floor(${e}) should be a safe integer`),r<n&&(e>=t&&v("getRandomInt",`No integer value found between ${t} and ${e}`),v("getRandomInt",`The maximum value ${e} should be greater than the minimum value ${t}`))}function Ce(){return Array.from({length:Number.MAX_SAFE_INTEGER.toString().length}).map((t,e)=>{let n=Number.MAX_SAFE_INTEGER.toString().slice(0,e+1);return Number(n)})}B.default.extend(Kt.default);function gt(t={}){let{start:e="1800-01-01 00:00:00",end:n=(0,B.default)().format("YYYY-MM-DD HH:mm:ss"),format:r="YYYY-MM-DD HH:mm:ss"}=t;(!(0,B.default)(e).isValid()||!(0,B.default)(n).isValid())&&v("generateRandomDate","start end \u53C2\u6570\u5FC5\u987B\u662F\u5408\u6CD5\u7684\u65F6\u95F4\u683C\u5F0F");let o=(0,B.default)(e).year(),y=(0,B.default)(n).year(),d=k({min:o,max:y}),b=k({min:1,max:12}),g=k({min:1,max:31}),O=k(23),I=k(59),A=k(59),F=(0,B.default)(`${d}-${b}-${g} ${O}:${I}:${A}`);return F.isBefore((0,B.default)(e))||F.isAfter((0,B.default)(n))?gt(t):F.format(r)}function Z(t={}){let e=Ie(t),n=Ne(e);Le(n);let{length:r}=e;_e(r.min,r.max);let o=k(r),y=e.prefix||"";for(let d=0;d<o;d++)y+=n.charAt(Math.floor(Math.random()*n.length));return y+(e.suffix||"")}var Pe=16,Nt=1;function Ie(t){let e=U(t);return{lowerCase:!0,upperCase:!0,number:!0,...e?{}:t,length:e?{max:t,min:t}:U(t.length)?{max:t.length,min:t.length}:{max:Pe,min:Nt,...t.length},extra:e?[]:[...new Set(et(t.extra||[]))]}}function Ne(t){let e="";return t.lowerCase&&(e+="abcdefghijklmnopqrstuvwxyz"),t.upperCase&&(e+="ABCDEFGHIJKLMNOPQRSTUVWXYZ"),t.number&&(e+="0123456789"),e+=et(t.extra).join(""),e}function Le(t){t.length===0&&v("getRandomString","At least one character set (lowercase, uppercase, number) must be enabled or extra characters provided")}function _e(t,e){Number.isInteger(t)||v("getRandomString","min must be an integer"),Number.isInteger(e)||v("getRandomString","max must be an integer"),t<Nt&&v("getRandomString",`Minimum length cannot be less than ${Nt}`),e<t&&v("getRandomString","Maximum length cannot be less than minimum length")}function Vt(){let t=["gmail.com","outlook.com.cn","example.com","qq.com","163.com","test.com.cn"],e=`${Z(1)}${Z({length:k({max:30,min:1})})}${Z(1)}@${_(t)}`;return/\.{2,}/.test(e)?Vt():e}function Fe(t={}){U(t)&&(t={max:t});let{min:e=0,max:n=1,fractionDigits:r=2}=t;if(e===n)return e;if(e>n)throw new Error(`\u6700\u5927\u503C ${n} \u5E94\u5927\u4E8E\u6700\u5C0F\u503C ${e}`);return Math.random()*(n-e)+e}function ht(t,e){(!U(t)||t<=0)&&v("generateRandomStringFromSource","num \u5FC5\u987B\u5927\u4E8E0"),(!W(e)||e.length===0)&&v("generateRandomStringFromSource","source \u4E0D\u80FD\u4E3A\u7A7A\u6570\u7EC4");let n="";for(let r=0;r<t;r++)n+=_(e);return n}function He(){let t=k({min:1e5,max:999999}),e=[0,1,2,3,4,5,6,7,8,9];return[t,gt({format:"YYYYMMDD"}),ht(3,e),ht(1,[...e,"X","x"])].join("")}function Ue(){return _(["13","14","15","16","17","18","19"])+k(999999999).toString().padEnd(9,"0")}function We(){let t=["http://","https://"],e=[".com",".net",".org",".cn",".top"],n=[`?name=${Z({length:{min:4,max:8}})}`,`?id=${k()}`,`?page=${Z({length:{min:2,max:4}})}`,`?query=${Z({length:{min:5,max:6}})}`,`?search=${Z({length:{min:1,max:4}})}`,`?token=${Z({length:{min:16,max:16}})}`];return`${_(t)}${Z({length:{min:5,max:25}})}${_(e)}${_(n)}`}function Ze(t){return/^\d+$/.test(t)}function ze(t){return/^[A-Z]+$/i.test(t)}function Ke(t){return/^[A-Z]+$/.test(t)}function Ve(t){return/^[\dA-Z]+$/.test(t)}function Be(t){return/^[\dA-Z\u4E00-\u9FA5]+$/.test(t)}function Xe(t){return/^[a-z]+$/.test(t)}function qe(t){return/^[\da-z]+$/.test(t)}function Ge(t){return/^[\da-z\u4E00-\u9FA5]+$/.test(t)}function Je(t){return/^[\u4E00-\u9FA5]+$/.test(t)}function Qe(t){return/^-?(?:0|[1-9]\d*)\.\d+$/.test(t)}function tn(t){return/^(?:0\.0*[1-9]\d*|[1-9]\d*\.\d+)$/.test(t)}function en(t){return/^(?:0|[1-9]\d*)\.\d+$/.test(t)}function nn(t){return/^-(?:0\.0*[1-9]\d*|[1-9]\d*\.\d+)$/.test(t)}function rn(t){return/^-(?:0|[1-9]\d*)\.\d+$/.test(t)}function on(t){return/^-?(?:0|[1-9]\d*)$/.test(t)}function sn(t){return/^[1-9]\d*$/.test(t)}function an(t){return/^(?:0|[1-9]\d*)$/.test(t)&&!Object.is(t,-0)}function un(t){return/^-[1-9]\d*$/.test(t)}function cn(t){return/^-(?:0|[1-9]\d*)$/.test(t)||Object.is(t,-0)}var Bt=wt(Ct(),1);function fn(t){return/^1[3-9]\d{9}$/.test(t)}function mn(t){return/^https?:\/\/\S+$/i.test(t)}function pn(t){return/^[^\s@]+@[^\s@][^\s.@]*\.[^\s@]+$/.test(t)}function dn(t){return t===""}function Xt(t,e="YYYY-MM-DD HH:mm:ss"){return(0,Bt.default)(t,e,!0).isValid()}function ln(t){return/^[1-9]\d{5}(?:18|19|20)\d{2}(?:0[1-9]|1[0-2])(?:0[1-9]|[12]\d|3[01])\d{3}[\dX]$/i.test(t)&&Xt(t.slice(6,14),"YYYYMMDD")}return ne(gn);})();
|
|
1
|
+
"use strict";var lntvowUtils=(()=>{var Jt=Object.create;var lt=Object.defineProperty;var Qt=Object.getOwnPropertyDescriptor;var te=Object.getOwnPropertyNames;var ee=Object.getPrototypeOf,ne=Object.prototype.hasOwnProperty;var Ft=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),re=(t,e)=>{for(var n in e)lt(t,n,{get:e[n],enumerable:!0})},Ut=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of te(e))!ne.call(t,o)&&o!==n&<(t,o,{get:()=>e[o],enumerable:!(r=Qt(e,o))||r.enumerable});return t};var Ot=(t,e,n)=>(n=t!=null?Jt(ee(t)):{},Ut(e||!t||!t.__esModule?lt(n,"default",{value:t,enumerable:!0}):n,t)),oe=t=>Ut(lt({},"__esModule",{value:!0}),t);var Ct=Ft((Nt,Pt)=>{"use strict";(function(t,e){typeof Nt=="object"&&typeof Pt<"u"?Pt.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs=e()})(Nt,function(){"use strict";var t=1e3,e=6e4,n=36e5,r="millisecond",o="second",h="minute",l="hour",x="day",b="week",A="month",j="quarter",R="year",v="date",z="Invalid Date",p=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,S={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(c){var s=["th","st","nd","rd"],i=c%100;return"["+c+(s[(i-20)%10]||s[i]||s[0])+"]"}},M=function(c,s,i){var u=String(c);return!u||u.length>=s?c:""+Array(s+1-u.length).join(i)+c},B={s:M,z:function(c){var s=-c.utcOffset(),i=Math.abs(s),u=Math.floor(i/60),a=i%60;return(s<=0?"+":"-")+M(u,2,"0")+":"+M(a,2,"0")},m:function c(s,i){if(s.date()<i.date())return-c(i,s);var u=12*(i.year()-s.year())+(i.month()-s.month()),a=s.clone().add(u,A),f=i-a<0,m=s.clone().add(u+(f?-1:1),A);return+(-(u+(i-a)/(f?a-m:m-a))||0)},a:function(c){return c<0?Math.ceil(c)||0:Math.floor(c)},p:function(c){return{M:A,y:R,w:b,d:x,D:v,h:l,m:h,s:o,ms:r,Q:j}[c]||String(c||"").toLowerCase().replace(/s$/,"")},u:function(c){return c===void 0}},Y="en",L={};L[Y]=S;var V="$isDayjsObject",F=function(c){return c instanceof N||!(!c||!c[V])},P=function c(s,i,u){var a;if(!s)return Y;if(typeof s=="string"){var f=s.toLowerCase();L[f]&&(a=f),i&&(L[f]=i,a=f);var m=s.split("-");if(!a&&m.length>1)return c(m[0])}else{var d=s.name;L[d]=s,a=d}return!u&&a&&(Y=a),a||!u&&Y},w=function(c,s){if(F(c))return c.clone();var i=typeof s=="object"?s:{};return i.date=c,i.args=arguments,new N(i)},g=B;g.l=P,g.i=F,g.w=function(c,s){return w(c,{locale:s.$L,utc:s.$u,x:s.$x,$offset:s.$offset})};var N=function(){function c(i){this.$L=P(i.locale,null,!0),this.parse(i),this.$x=this.$x||i.x||{},this[V]=!0}var s=c.prototype;return s.parse=function(i){this.$d=function(u){var a=u.date,f=u.utc;if(a===null)return new Date(NaN);if(g.u(a))return new Date;if(a instanceof Date)return new Date(a);if(typeof a=="string"&&!/Z$/i.test(a)){var m=a.match(p);if(m){var d=m[2]-1||0,O=(m[7]||"0").substring(0,3);return f?new Date(Date.UTC(m[1],d,m[3]||1,m[4]||0,m[5]||0,m[6]||0,O)):new Date(m[1],d,m[3]||1,m[4]||0,m[5]||0,m[6]||0,O)}}return new Date(a)}(i),this.init()},s.init=function(){var i=this.$d;this.$y=i.getFullYear(),this.$M=i.getMonth(),this.$D=i.getDate(),this.$W=i.getDay(),this.$H=i.getHours(),this.$m=i.getMinutes(),this.$s=i.getSeconds(),this.$ms=i.getMilliseconds()},s.$utils=function(){return g},s.isValid=function(){return this.$d.toString()!==z},s.isSame=function(i,u){var a=w(i);return this.startOf(u)<=a&&a<=this.endOf(u)},s.isAfter=function(i,u){return w(i)<this.startOf(u)},s.isBefore=function(i,u){return this.endOf(u)<w(i)},s.$g=function(i,u,a){return g.u(i)?this[u]:this.set(a,i)},s.unix=function(){return Math.floor(this.valueOf()/1e3)},s.valueOf=function(){return this.$d.getTime()},s.startOf=function(i,u){var a=this,f=!!g.u(u)||u,m=g.p(i),d=function(X,E){var H=g.w(a.$u?Date.UTC(a.$y,E,X):new Date(a.$y,E,X),a);return f?H:H.endOf(x)},O=function(X,E){return g.w(a.toDate()[X].apply(a.toDate("s"),(f?[0,0,0,0]:[23,59,59,999]).slice(E)),a)},D=this.$W,T=this.$M,I=this.$D,Q="set"+(this.$u?"UTC":"");switch(m){case R:return f?d(1,0):d(31,11);case A:return f?d(1,T):d(0,T+1);case b:var q=this.$locale().weekStart||0,rt=(D<q?D+7:D)-q;return d(f?I-rt:I+(6-rt),T);case x:case v:return O(Q+"Hours",0);case l:return O(Q+"Minutes",1);case h:return O(Q+"Seconds",2);case o:return O(Q+"Milliseconds",3);default:return this.clone()}},s.endOf=function(i){return this.startOf(i,!1)},s.$set=function(i,u){var a,f=g.p(i),m="set"+(this.$u?"UTC":""),d=(a={},a[x]=m+"Date",a[v]=m+"Date",a[A]=m+"Month",a[R]=m+"FullYear",a[l]=m+"Hours",a[h]=m+"Minutes",a[o]=m+"Seconds",a[r]=m+"Milliseconds",a)[f],O=f===x?this.$D+(u-this.$W):u;if(f===A||f===R){var D=this.clone().set(v,1);D.$d[d](O),D.init(),this.$d=D.set(v,Math.min(this.$D,D.daysInMonth())).$d}else d&&this.$d[d](O);return this.init(),this},s.set=function(i,u){return this.clone().$set(i,u)},s.get=function(i){return this[g.p(i)]()},s.add=function(i,u){var a,f=this;i=Number(i);var m=g.p(u),d=function(T){var I=w(f);return g.w(I.date(I.date()+Math.round(T*i)),f)};if(m===A)return this.set(A,this.$M+i);if(m===R)return this.set(R,this.$y+i);if(m===x)return d(1);if(m===b)return d(7);var O=(a={},a[h]=e,a[l]=n,a[o]=t,a)[m]||1,D=this.$d.getTime()+i*O;return g.w(D,this)},s.subtract=function(i,u){return this.add(-1*i,u)},s.format=function(i){var u=this,a=this.$locale();if(!this.isValid())return a.invalidDate||z;var f=i||"YYYY-MM-DDTHH:mm:ssZ",m=g.z(this),d=this.$H,O=this.$m,D=this.$M,T=a.weekdays,I=a.months,Q=a.meridiem,q=function(E,H,J,tt){return E&&(E[H]||E(u,f))||J[H].slice(0,tt)},rt=function(E){return g.s(d%12||12,E,"0")},X=Q||function(E,H,J){var tt=E<12?"AM":"PM";return J?tt.toLowerCase():tt};return f.replace(y,function(E,H){return H||function(J){switch(J){case"YY":return String(u.$y).slice(-2);case"YYYY":return g.s(u.$y,4,"0");case"M":return D+1;case"MM":return g.s(D+1,2,"0");case"MMM":return q(a.monthsShort,D,I,3);case"MMMM":return q(I,D);case"D":return u.$D;case"DD":return g.s(u.$D,2,"0");case"d":return String(u.$W);case"dd":return q(a.weekdaysMin,u.$W,T,2);case"ddd":return q(a.weekdaysShort,u.$W,T,3);case"dddd":return T[u.$W];case"H":return String(d);case"HH":return g.s(d,2,"0");case"h":return rt(1);case"hh":return rt(2);case"a":return X(d,O,!0);case"A":return X(d,O,!1);case"m":return String(O);case"mm":return g.s(O,2,"0");case"s":return String(u.$s);case"ss":return g.s(u.$s,2,"0");case"SSS":return g.s(u.$ms,3,"0");case"Z":return m}return null}(E)||m.replace(":","")})},s.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},s.diff=function(i,u,a){var f,m=this,d=g.p(u),O=w(i),D=(O.utcOffset()-this.utcOffset())*e,T=this-O,I=function(){return g.m(m,O)};switch(d){case R:f=I()/12;break;case A:f=I();break;case j:f=I()/3;break;case b:f=(T-D)/6048e5;break;case x:f=(T-D)/864e5;break;case l:f=T/n;break;case h:f=T/e;break;case o:f=T/t;break;default:f=T}return a?f:g.a(f)},s.daysInMonth=function(){return this.endOf(A).$D},s.$locale=function(){return L[this.$L]},s.locale=function(i,u){if(!i)return this.$L;var a=this.clone(),f=P(i,u,!0);return f&&(a.$L=f),a},s.clone=function(){return g.w(this.$d,this)},s.toDate=function(){return new Date(this.valueOf())},s.toJSON=function(){return this.isValid()?this.toISOString():null},s.toISOString=function(){return this.$d.toISOString()},s.toString=function(){return this.$d.toUTCString()},c}(),C=N.prototype;return w.prototype=C,[["$ms",r],["$s",o],["$m",h],["$H",l],["$W",x],["$M",A],["$y",R],["$D",v]].forEach(function(c){C[c[1]]=function(s){return this.$g(s,c[0],c[1])}}),w.extend=function(c,s){return c.$i||(c(s,N,w),c.$i=!0),w},w.locale=P,w.isDayjs=F,w.unix=function(c){return w(1e3*c)},w.en=L[Y],w.Ls=L,w.p={},w})});var Kt=Ft((It,_t)=>{"use strict";(function(t,e){typeof It=="object"&&typeof _t<"u"?_t.exports=e():typeof define=="function"&&define.amd?define(e):(t=typeof globalThis<"u"?globalThis:t||self).dayjs_plugin_customParseFormat=e()})(It,function(){"use strict";var t={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},e=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,n=/\d/,r=/\d\d/,o=/\d\d?/,h=/\d*[^-_:/,()\s\d]+/,l={},x=function(p){return(p=+p)+(p>68?1900:2e3)},b=function(p){return function(y){this[p]=+y}},A=[/[+-]\d\d:?(\d\d)?|Z/,function(p){(this.zone||(this.zone={})).offset=function(y){if(!y||y==="Z")return 0;var S=y.match(/([+-]|\d\d)/g),M=60*S[1]+(+S[2]||0);return M===0?0:S[0]==="+"?-M:M}(p)}],j=function(p){var y=l[p];return y&&(y.indexOf?y:y.s.concat(y.f))},R=function(p,y){var S,M=l.meridiem;if(M){for(var B=1;B<=24;B+=1)if(p.indexOf(M(B,0,y))>-1){S=B>12;break}}else S=p===(y?"pm":"PM");return S},v={A:[h,function(p){this.afternoon=R(p,!1)}],a:[h,function(p){this.afternoon=R(p,!0)}],Q:[n,function(p){this.month=3*(p-1)+1}],S:[n,function(p){this.milliseconds=100*+p}],SS:[r,function(p){this.milliseconds=10*+p}],SSS:[/\d{3}/,function(p){this.milliseconds=+p}],s:[o,b("seconds")],ss:[o,b("seconds")],m:[o,b("minutes")],mm:[o,b("minutes")],H:[o,b("hours")],h:[o,b("hours")],HH:[o,b("hours")],hh:[o,b("hours")],D:[o,b("day")],DD:[r,b("day")],Do:[h,function(p){var y=l.ordinal,S=p.match(/\d+/);if(this.day=S[0],y)for(var M=1;M<=31;M+=1)y(M).replace(/\[|\]/g,"")===p&&(this.day=M)}],w:[o,b("week")],ww:[r,b("week")],M:[o,b("month")],MM:[r,b("month")],MMM:[h,function(p){var y=j("months"),S=(j("monthsShort")||y.map(function(M){return M.slice(0,3)})).indexOf(p)+1;if(S<1)throw new Error;this.month=S%12||S}],MMMM:[h,function(p){var y=j("months").indexOf(p)+1;if(y<1)throw new Error;this.month=y%12||y}],Y:[/[+-]?\d+/,b("year")],YY:[r,function(p){this.year=x(p)}],YYYY:[/\d{4}/,b("year")],Z:A,ZZ:A};function z(p){var y,S;y=p,S=l&&l.formats;for(var M=(p=y.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(w,g,N){var C=N&&N.toUpperCase();return g||S[N]||t[N]||S[C].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(c,s,i){return s||i.slice(1)})})).match(e),B=M.length,Y=0;Y<B;Y+=1){var L=M[Y],V=v[L],F=V&&V[0],P=V&&V[1];M[Y]=P?{regex:F,parser:P}:L.replace(/^\[|\]$/g,"")}return function(w){for(var g={},N=0,C=0;N<B;N+=1){var c=M[N];if(typeof c=="string")C+=c.length;else{var s=c.regex,i=c.parser,u=w.slice(C),a=s.exec(u)[0];i.call(g,a),w=w.replace(a,"")}}return function(f){var m=f.afternoon;if(m!==void 0){var d=f.hours;m?d<12&&(f.hours+=12):d===12&&(f.hours=0),delete f.afternoon}}(g),g}}return function(p,y,S){S.p.customParseFormat=!0,p&&p.parseTwoDigitYear&&(x=p.parseTwoDigitYear);var M=y.prototype,B=M.parse;M.parse=function(Y){var L=Y.date,V=Y.utc,F=Y.args;this.$u=V;var P=F[1];if(typeof P=="string"){var w=F[2]===!0,g=F[3]===!0,N=w||g,C=F[2];g&&(C=F[2]),l=this.$locale(),!w&&C&&(l=S.Ls[C]),this.$d=function(u,a,f,m){try{if(["x","X"].indexOf(a)>-1)return new Date((a==="X"?1e3:1)*u);var d=z(a)(u),O=d.year,D=d.month,T=d.day,I=d.hours,Q=d.minutes,q=d.seconds,rt=d.milliseconds,X=d.zone,E=d.week,H=new Date,J=T||(O||D?1:H.getDate()),tt=O||H.getFullYear(),mt=0;O&&!D||(mt=D>0?D-1:H.getMonth());var pt,xt=I||0,$t=Q||0,wt=q||0,Mt=rt||0;return X?new Date(Date.UTC(tt,mt,J,xt,$t,wt,Mt+60*X.offset*1e3)):f?new Date(Date.UTC(tt,mt,J,xt,$t,wt,Mt)):(pt=new Date(tt,mt,J,xt,$t,wt,Mt),E&&(pt=m(pt).week(E).toDate()),pt)}catch{return new Date("")}}(L,P,V,S),this.init(),C&&C!==!0&&(this.$L=this.locale(C).$L),N&&L!=this.format(P)&&(this.$d=new Date("")),l={}}else if(P instanceof Array)for(var c=P.length,s=1;s<=c;s+=1){F[1]=P[s-1];var i=S.apply(this,F);if(i.isValid()){this.$d=i.$d,this.$L=i.$L,this.init();break}s===c&&(this.$d=new Date(""))}else B.call(this,Y)}}})});var bn={};re(bn,{UtilsError:()=>ft,base64Decode:()=>me,base64Encode:()=>fe,castArray:()=>nt,compose:()=>pe,composeRight:()=>le,debounce:()=>de,debugWarn:()=>jt,debugWarnInvalidTypeMessage:()=>xe,decimalToBinary:()=>ce,deepClone:()=>it,deepMerge:()=>Et,deprecated:()=>be,generateRandomArray:()=>je,generateRandomColor:()=>Ye,generateRandomDate:()=>bt,generateRandomEmail:()=>Xt,generateRandomFloat:()=>Ue,generateRandomIdCard:()=>He,generateRandomMobilePhone:()=>We,generateRandomStringFromSource:()=>yt,getRandomInt:()=>k,getRandomItem:()=>U,getRandomString:()=>Z,getRandomUrl:()=>Ze,hasChanged:()=>ue,isArray:()=>W,isBoolean:()=>St,isChineseString:()=>Qe,isDate:()=>Tt,isDateString:()=>qt,isDef:()=>ae,isEmail:()=>dn,isEmptyString:()=>gn,isEnglishAphabet:()=>Be,isFloat:()=>tn,isFunction:()=>ut,isIdCard:()=>hn,isInteger:()=>sn,isLowerCase:()=>Ge,isLowerCaseAndNumber:()=>qe,isLowerCaseAndNumberAndChinese:()=>Je,isMap:()=>At,isMobilePhone:()=>pn,isNegativeFloat:()=>rn,isNegativeInteger:()=>cn,isNonNegativeFloat:()=>nn,isNonNegativeInteger:()=>un,isNonPositiveFloat:()=>on,isNonPositiveInteger:()=>fn,isNull:()=>se,isNumber:()=>_,isNumberOrNumberString:()=>ze,isObject:()=>ie,isObjectLike:()=>at,isPlainObject:()=>K,isPositiveFloat:()=>en,isPositiveInteger:()=>an,isPromise:()=>Rt,isRegExp:()=>kt,isSet:()=>vt,isString:()=>ct,isStringNumber:()=>mn,isSymbol:()=>Dt,isURL:()=>ln,isUndef:()=>ot,isUndefined:()=>st,isUpperCase:()=>Ke,isUpperCaseAndNumber:()=>Ve,isUpperCaseAndNumberAndChinese:()=>Xe,objectToString:()=>Ht,omit:()=>Ee,pick:()=>Yt,qs:()=>Me,throttle:()=>Oe,throwError:()=>$,throwErrorInvalidTypeMessage:()=>ye,toTypeString:()=>et,toTypeValue:()=>dt,validatorChineseOrEnglish:()=>De,validatorChineseOrEnglishOrNumber:()=>Se,validatorUppercaseOrNumbersOrSpecial:()=>Ae,validatorUppercaseOrNumbersOrUnderline:()=>ve,withRetry:()=>Te});function ie(t){let e=typeof t;return t!==null&&(e==="object"||e==="function")}function at(t){return t!==null&&typeof t=="object"}var Ht=Object.prototype.toString,et=t=>Ht.call(t),dt=t=>et(t).slice(8,-1),ct=t=>typeof t=="string",_=t=>typeof t=="number"&&Number.isFinite(t),St=t=>typeof t=="boolean",se=t=>t===null,st=t=>t===void 0,Dt=t=>typeof t=="symbol",W=Array.isArray,ut=t=>typeof t=="function",At=t=>et(t)==="[object Map]",vt=t=>et(t)==="[object Set]",Tt=t=>et(t)==="[object Date]",kt=t=>et(t)==="[object RegExp]",Rt=t=>at(t)&&ut(t?.then)&&ut(t?.catch),ot=t=>t==null,ae=t=>t!=null,ue=(t,e)=>t!==e;function K(t){return et(t)==="[object Object]"}function nt(t){return W(t)?t:[t]}function ce(t){let e=[],n,r="";for(;t>0;)n=Math.floor(t%2),e.push(n),t=Math.floor(t/2);for(;e.length>0;)r+=e.pop().toString();return r}var Wt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function fe(t){let e="",n="";for(let o=0;o<t.length;o++)n+=t[o].charCodeAt(0).toString(2).padStart(8,"0");for(let o=0;o<n.length;o+=6)e+=Wt[Number.parseInt(n.slice(o,o+6).padEnd(6,"0"),2)];let r=e.length%4;return r!==0&&(e+="=".repeat(4-r)),e}function me(t){let e="",n="";for(let r=0;r<t.length&&t[r]!=="=";r++)n+=Wt.indexOf(t[r]).toString(2).padStart(6,"0");for(let r=0;r<n.length;r+=8){let o=Number.parseInt(n.slice(r,r+8),2);o&&(e+=String.fromCharCode(o))}return e}function pe(...t){return t.reduce((e,n)=>function(...r){return n(e(...r))})}function le(...t){return t.reduce((e,n)=>function(...r){return e(n(...r))})}function de(t,e=500){let n=null;return function(...r){n&&clearTimeout(n),n=setTimeout(()=>{t.apply(this,r)},e)}}function it(t){let e=new WeakMap;function n(r){if(!at(r))return r;if(Tt(r))return new Date(r);if(kt(r))return new RegExp(r);if(Rt(r))return r;if(e.has(r))return e.get(r);if(At(r)){let l=new Map;return e.set(r,l),r.forEach((x,b)=>l.set(n(b),n(x))),l}if(vt(r)){let l=new Set;return e.set(r,l),r.forEach(x=>l.add(n(x))),l}let o=W(r)?Object.setPrototypeOf([],Object.getPrototypeOf(r)):Object.create(Object.getPrototypeOf(r));e.set(r,o);let h=Object.getOwnPropertyDescriptors(r);for(let l of Reflect.ownKeys(h)){let x=h[l];x.get||x.set?Object.defineProperty(o,l,x):Object.defineProperty(o,l,{...x,value:n(x.value)})}return o}return n(t)}function Et(t,e,n={}){return zt(Zt(t,n),Zt(e,n),n)}function zt(t,e,n){return W(t)?he(t,e,n):ge(t,e,n)}function ge(t,e,n){if(!K(e))return e;let r=Object.getOwnPropertyDescriptors(e);return Reflect.ownKeys(e).forEach(o=>{(K(t[o])||W(t[o]))&&(K(e[o])||W(e[o]))?t[o]=zt(t[o],e[o],n):Object.defineProperty(t,o,r[o])}),t}function he(t,e,n){let{mergeStrategy:r="replace"}=n;if(W(e))switch(r){case"merge":return t.concat(e);case"replace":return e;default:return e}return e}function Zt(t,e){let{deepClone:n=!0}=e;return n?it(t):t}var ft=class extends Error{constructor(e,n="Utils"){super(e),this.name=n}};function $(t,e){throw new ft(`[${t}] ${e}`)}function jt(t,e){let n=ct(t)?new ft(`[${t}] ${e}`,"UtilsWarn"):t;console.warn(n)}var be=({from:t,replacement:e,version:n,type:r="API"})=>{jt(`${r}`,`${t} is about to be deprecated in version ${n}, please use ${e} instead.`)};function ye(t,e,n,r){let o=`Invalid params: type check failed for params "${e}". Expected ${n}, got ${dt(r)} with value ${r}.`;$(t,o)}function xe(t,e,n,r){let o=`Invalid params: type check failed for params "${e}". Expected ${n}, got ${dt(r)} with value ${r}.`;jt(t,o)}var gt=(t,e,...n)=>{if(!e)return;let r=n.length===0?"":n.length===1?n[0]:n;console[t](`[Log] ${e}:`,r)},ht=(t,...e)=>{gt("info",t,...e)};ht.info=(t,...e)=>{gt("info",t,...e)};ht.error=(t,...e)=>{gt("error",t,...e)};ht.warn=(t,...e)=>{gt("warn",t,...e)};typeof globalThis<"u"&&(globalThis.log=ht);function $e(t,e){let{decode:n=!0}=e||{},r={};t.startsWith("?")&&(t=t.slice(1)),t.includes("?")&&(t=t.slice(t.indexOf("?")+1));let o=t.split("&").filter(Boolean);for(let h of o){let[l,x]=h.split("=");r[l]=n?decodeURIComponent(x):x}return r}function Bt(t,e){let{encode:n=!0}=e||{},r=[];for(let o in t){let h=t[o];r.push(`${o}=${n?encodeURIComponent(h):h}`)}return r.join("&")}function we(t,e,n){let r=Et({encode:!0},{...n}),o=Bt(e,r);return t.includes("?")?t.endsWith("?")||t.endsWith("&")?`${t}${o}`:`${t}&${o}`:`${t}?${o}`}var Me={parse:$e,stringify:Bt,appendQueryString:we};function Oe(t,e=500){let n=null;return function(...r){if(ot(n))return n=Date.now(),t.apply(this,r);let o=Date.now();if(o-n>=e)return n=o,t.apply(this,r)}}function Se(t){return!ot(t)&&/^[\dA-Z\u4E00-\u9FA5]+$/i.test(t)}function De(t){return!ot(t)&&/^[A-Z\u4E00-\u9FA5]+$/i.test(t)}function Ae(t){return!ot(t)&&/^[\d!"#$%&'()*+,./:;<=>?@A-Z[\\\]^_`{|}~]+$/.test(t)}function ve(t){return/^[\dA-Z_]+$/.test(t)}function Te(t){ke(t);let{fn:e,maxAttempts:n=3,retryDelay:r=1e3,enableExponentialBackoff:o=!1,signal:h}=t,l,x=h?new Promise((A,j)=>{let R=()=>j(new Error("Operation Cancelled"));h.addEventListener("abort",R),l=()=>h.removeEventListener("abort",R)}):null;return new Promise((A,j)=>{(async()=>{for(let v=1;v<=n;v++){if(h?.aborted)return j(new Error("Operation Cancelled"));try{let z=await Promise.race(x?[e(),x]:[e()]);return A(z)}catch(z){let p=o?r*2**(v-1):r;if(log("withRetry",`Attempt ${v}/${n} failed. Retrying in ${p}ms...`),z instanceof Error&&z.message==="Operation Cancelled"||v===n)return j(z);await new Promise(y=>setTimeout(y,p))}}})()}).finally(()=>l?.())}function ke(t){K(t)||$("withRetry",'"Options" must be an object'),typeof t.fn!="function"&&$("withRetry",'"fn" must be a function that returns a Promise'),!st(t.maxAttempts)&&(!Number.isInteger(t.maxAttempts)||t.maxAttempts<1)&&$("withRetry",'"maxAttempts" must be a positive integer'),!st(t.retryDelay)&&(!_(t.retryDelay)||t.retryDelay<0)&&$("withRetry",'"retryDelay" must be a non-negative number'),!st(t.enableExponentialBackoff)&&!St(t.enableExponentialBackoff)&&$("withRetry",'"enableExponentialBackoff" must be a boolean'),!st(t.signal)&&typeof t.signal!="object"&&$("withRetry",'"signal" must be an AbortSignal')}function Yt(t,e,n={}){let{includeProto:r=!1,includeSymbols:o=!0,includeNonEnum:h=!1}=n,l={};return K(t)&&nt(e).forEach(b=>{Dt(b)&&!o||!(r?b in t:Object.hasOwn(t,b))||!h&&(r?Re(t,b):Object.getOwnPropertyDescriptor(t,b))?.enumerable===!1||(l[b]=it(t[b]))}),l}function Re(t,e){let n=t;for(;n!==null;){let r=Object.getOwnPropertyDescriptor(n,e);if(r)return r;n=Object.getPrototypeOf(n)}}function Ee(t,e){if(!K(t))return{};let n=it(t),r=nt(e),o=Object.keys(n).filter(h=>!r.includes(h));return Yt(n,o)}function je(t,e){return(!_(t)||t<=0)&&$("generateRandomArray","num must be greater than 0"),ut(e)||$("generateRandomArray","cb must be a function"),Array.from({length:t}).fill(0).map((n,r)=>e(n,r))}function Ye(){return`#${Math.random().toString(16).slice(2,8).padEnd(6,"0")}`}var G=Ot(Ct(),1),Vt=Ot(Kt(),1);function U(t){return t[Math.floor(Math.random()*t.length)]}function k(t={}){_(t)&&(t={max:t});let{min:e=1,max:n=U(Pe())}=t;Ne(e,n);let r=Math.ceil(e),o=Math.floor(n);return Math.floor(Math.random()*(o-r+1)+r)}function Ne(t,e){let n=Math.ceil(t),r=Math.floor(e);Number.isSafeInteger(n)||$("getRandomInt",`The minimum value Math.ceil(${t}) should be a safe integer`),Number.isSafeInteger(r)||$("getRandomInt",`The maximum value Math.floor(${e}) should be a safe integer`),r<n&&(e>=t&&$("getRandomInt",`No integer value found between ${t} and ${e}`),$("getRandomInt",`The maximum value ${e} should be greater than the minimum value ${t}`))}function Pe(){return Array.from({length:Number.MAX_SAFE_INTEGER.toString().length}).map((t,e)=>{let n=Number.MAX_SAFE_INTEGER.toString().slice(0,e+1);return Number(n)})}G.default.extend(Vt.default);function bt(t={}){let{start:e="1800-01-01 00:00:00",end:n=(0,G.default)().format("YYYY-MM-DD HH:mm:ss"),format:r="YYYY-MM-DD HH:mm:ss"}=t;(!(0,G.default)(e).isValid()||!(0,G.default)(n).isValid())&&$("generateRandomDate","start and end parameters must be valid date format");let o=(0,G.default)(e).year(),h=(0,G.default)(n).year(),l=k({min:o,max:h}),x=k({min:1,max:12}),b=k({min:1,max:31}),A=k(23),j=k(59),R=k(59),v=(0,G.default)(`${l}-${x}-${b} ${A}:${j}:${R}`);return v.isBefore((0,G.default)(e))||v.isAfter((0,G.default)(n))?bt(t):v.format(r)}function Z(t={}){let e=Ie(t),n=_e(e);Le(n);let{length:r}=e;Fe(r.min,r.max);let o=k(r),h=e.prefix||"";for(let l=0;l<o;l++)h+=n.charAt(Math.floor(Math.random()*n.length));return h+(e.suffix||"")}var Ce=16,Lt=1;function Ie(t){let e=_(t);return{lowerCase:!0,upperCase:!0,number:!0,...e?{}:t,length:e?{max:t,min:t}:_(t.length)?{max:t.length,min:t.length}:{max:Ce,min:Lt,...t.length},extra:e?[]:[...new Set(nt(t.extra||[]))]}}function _e(t){let e="";return t.lowerCase&&(e+="abcdefghijklmnopqrstuvwxyz"),t.upperCase&&(e+="ABCDEFGHIJKLMNOPQRSTUVWXYZ"),t.number&&(e+="0123456789"),e+=nt(t.extra).join(""),e}function Le(t){t.length===0&&$("getRandomString","At least one character set (lowercase, uppercase, number) must be enabled or extra characters provided")}function Fe(t,e){Number.isInteger(t)||$("getRandomString","min must be an integer"),Number.isInteger(e)||$("getRandomString","max must be an integer"),t<Lt&&$("getRandomString",`Minimum length cannot be less than ${Lt}`),e<t&&$("getRandomString","Maximum length cannot be less than minimum length")}function Xt(){let t=["gmail.com","outlook.com.cn","example.com","qq.com","163.com","test.com.cn"],e=`${Z(1)}${Z({length:k({max:30,min:1})})}${Z(1)}@${U(t)}`;return/\.{2,}/.test(e)?Xt():e}function Ue(t={}){_(t)&&(t={max:t});let{min:e=0,max:n=1,fractionDigits:r=2}=t;if(e===n)return e;if(e>n)throw new Error(`Maximum value ${n} should be greater than minimum value ${e}`);return Math.random()*(n-e)+e}function yt(t,e){(!_(t)||t<=0)&&$("generateRandomStringFromSource","num must be greater than 0"),(!W(e)||e.length===0)&&$("generateRandomStringFromSource","source cannot be empty array");let n="";for(let r=0;r<t;r++)n+=U(e);return n}function He(){let t=k({min:1e5,max:999999}),e=[0,1,2,3,4,5,6,7,8,9];return[t,bt({format:"YYYYMMDD"}),yt(3,e),yt(1,[...e,"X","x"])].join("")}function We(){return U(["13","14","15","16","17","18","19"])+k(999999999).toString().padEnd(9,"0")}function Ze(){let t=["http://","https://"],e=[".com",".net",".org",".cn",".top"],n=[`?name=${Z({length:{min:4,max:8}})}`,`?id=${k()}`,`?page=${Z({length:{min:2,max:4}})}`,`?query=${Z({length:{min:5,max:6}})}`,`?search=${Z({length:{min:1,max:4}})}`,`?token=${Z({length:{min:16,max:16}})}`];return`${U(t)}${Z({length:{min:5,max:25}})}${U(e)}${U(n)}`}function ze(t){return/^\d+$/.test(t)}function Be(t){return/^[A-Z]+$/i.test(t)}function Ke(t){return/^[A-Z]+$/.test(t)}function Ve(t){return/^[\dA-Z]+$/.test(t)}function Xe(t){return/^[\dA-Z\u4E00-\u9FA5]+$/.test(t)}function Ge(t){return/^[a-z]+$/.test(t)}function qe(t){return/^[\da-z]+$/.test(t)}function Je(t){return/^[\da-z\u4E00-\u9FA5]+$/.test(t)}function Qe(t){return/^[\u4E00-\u9FA5]+$/.test(t)}function tn(t){return/^-?(?:0|[1-9]\d*)\.\d+$/.test(t)}function en(t){return/^(?:0\.0*[1-9]\d*|[1-9]\d*\.\d+)$/.test(t)}function nn(t){return/^(?:0|[1-9]\d*)\.\d+$/.test(t)}function rn(t){return/^-(?:0\.0*[1-9]\d*|[1-9]\d*\.\d+)$/.test(t)}function on(t){return/^-(?:0|[1-9]\d*)\.\d+$/.test(t)}function sn(t){return/^-?(?:0|[1-9]\d*)$/.test(t)}function an(t){return/^[1-9]\d*$/.test(t)}function un(t){return/^(?:0|[1-9]\d*)$/.test(t)&&!Object.is(t,-0)}function cn(t){return/^-[1-9]\d*$/.test(t)}function fn(t){return/^-(?:0|[1-9]\d*)$/.test(t)||Object.is(t,-0)}var mn=t=>{if(!ct(t))return!1;let e=t.trim();if(e===""||e.includes("e")||e.includes("E")||e.includes("0x")||e.includes("0X")||e.includes("0o")||e.includes("0O")||e.includes("0b")||e.includes("0B"))return!1;let n=Number(e);return!(!Number.isFinite(n)||n>Number.MAX_SAFE_INTEGER||n<Number.MIN_SAFE_INTEGER)};var Gt=Ot(Ct(),1);function pn(t){return/^1[3-9]\d{9}$/.test(t)}function ln(t){return/^https?:\/\/\S+$/i.test(t)}function dn(t){return/^[^\s@]+@[^\s@][^\s.@]*\.[^\s@]+$/.test(t)}function gn(t){return t===""}function qt(t,e="YYYY-MM-DD HH:mm:ss"){return(0,Gt.default)(t,e,!0).isValid()}function hn(t){return/^[1-9]\d{5}(?:18|19|20)\d{2}(?:0[1-9]|1[0-2])(?:0[1-9]|[12]\d|3[01])\d{3}[\dX]$/i.test(t)&&qt(t.slice(6,14),"YYYYMMDD")}return oe(bn);})();
|