UNPKG

@minionorg/share

Version:
3 lines (2 loc) 22.5 kB
(function(f,m){typeof exports=="object"&&typeof module<"u"?m(exports):typeof define=="function"&&define.amd?define(["exports"],m):(f=typeof globalThis<"u"?globalThis:f||self,m(f.index={}))})(this,function(f){"use strict";var Yt=Object.defineProperty;var Ht=(f,m,l)=>m in f?Yt(f,m,{enumerable:!0,configurable:!0,writable:!0,value:l}):f[m]=l;var b=(f,m,l)=>(Ht(f,typeof m!="symbol"?m+"":m,l),l);function m(e){return e.charAt(0).toUpperCase()+e.slice(1)}function l(e){if(!e)throw new SyntaxError("type is must");return function(t){return Object.prototype.toString.call(t)===`[object ${m(e)}]`}}function ce(e,t,n){if(!l("Array")(e))throw new TypeError("The list must be array");if(n===void 0)e.push(t);else if(l("Number")(n))e.splice(n,0,t);else throw new TypeError("The index must be number");return e}function ae(e,...t){const n=l("Array");if(n(e)){if(t.length===0)return[...e];let r=[...e];for(const i of t){if(!n(i))throw new SyntaxError(`The ${i} must be array in rest`);r=[...r,...i]}return r}else throw new SyntaxError("The ary must be array")}function C(e){if(!e)throw new SyntaxError("type is must");return function(t){return Object.prototype.toString.call(t)===`[object ${m(e)}]`}}function fe(e,t){const n=new RegExp("(^|&)"+t+"=([^&]*)(&|$)"),r=e.match(n);return r!==null?r[2]:null}function he(e,t="."){if(!e)return!1;const n=e.trim().split(t);for(const r of n)if(!r||/\s/.test(r))return!1;return!0}function ge(e,t,n=void 0,r="."){if(!l("String")(t))throw new TypeError(`${t} is not string type`);if(!he(t,r))throw new Error(`Invalid: ${t}`);const i=t.trim().split(r);let o=e;for(const s of i)if(Array.isArray(o)&&/^\d+$/.test(s)){const u=parseInt(s,10);if(u<o.length)o=o[u];else return n}else if(typeof o=="object"&&s in o)o=o[s];else return n;return o}const de="[\\u2700-\\u27BF]",me="[\\uE000-\\uF8FF]",we="\\uD83C[\\uDC00-\\uDFFF]",ye="\\uD83D[\\uDC00-\\uDFFF]",$e="[\\u2011-\\u26FF]",pe="\\uD83E[\\uDD10-\\uDDFF]";function Se(e){return RegExp(`(${de}|${me}|${we}|${ye}|${$e}|${pe})`,"g").test(e)}function be(e){return/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(e)}class g{constructor(){}static notNull(t,n){if(t===null)throw new SyntaxError(n||"The value must not be empty")}static notEmpty(t,n){if(t.length===0)throw new SyntaxError(n||"The String must not be empty")}static errMsg(t){return function(n){return`${t}: ${n}`}}static isString(t){if(t===null)return null;if(l("string")(t))return t;throw new TypeError("The parameter type is string")}static isValidDateFormat(t){return/(^(y{4}|y{2})[.\u002f-](m{1,2})[.\u002f-](d{1,2})$)|(^(m{1,2})[.\u002f-](d{1,2})[.\u002f-]((y{4}|y{2})$))|(^(d{1,2})[.\u002f-](m{1,2})[.\u002f-]((y{4}|y{2})$))/gi.test(t)}static isTimeFormat(t){return/(^(h{1,2}):(m{1,2}):(s{1,2})$)|(^(h{1,2}):(m{1,2})$)/gi.test(t)}}b(g,"DEFAULT_NOT_NAN_EX_MESSAGE","\u9A8C\u8BC1\u7684\u503C\u4E0D\u662F\u6570\u5B57");const N="(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])",$=`(${N}[.]){3}${N}`,Ee=new RegExp(`^${$}$`);function P(e){return g.isString(e)===null?!1:Ee.test(e)}function I(e,t,n=!1){if(e!==null&&t!==null){const r=t.length;return r>e.length?!1:Te(e,n,0,t,0,r)}else return e===t}function Te(e,t,n,r,i,o){t&&(e=e.toLowerCase(),r=r.toLowerCase());const s=n+o;let u=0;for(let c=n;c<s;c++){if(e.charAt(c)!==r.charAt(i+u))return!1;u++}return!0}const Ae=/^\d{1,3}$/;function De(e){if(g.isString(e)===null)return!1;const n=e.split("/");return n.length!==2||!Ae.test(n[1])||n[1].length>1&&I(n[1],"0")||!P(n[0])?!1:Number(n[1])<=32&&Number(n[1])>=0}const h="(?:[0-9a-fA-F]{1,4})",xe=new RegExp(`^((?:${h}:){7}(?:${h}|:)|(?:${h}:){6}(?:${$}|:${h}|:)|(?:${h}:){5}(?::${$}|(:${h}){1,2}|:)|(?:${h}:){4}(?:(:${h}){0,1}:${$}|(:${h}){1,3}|:)|(?:${h}:){3}(?:(:${h}){0,2}:${$}|(:${h}){1,4}|:)|(?:${h}:){2}(?:(:${h}){0,3}:${$}|(:${h}){1,5}|:)|(?:${h}:){1}(?:(:${h}){0,4}:${$}|(:${h}){1,6}|:)|(?::((?::${h}){0,5}:${$}|(?::${h}){1,7}|:)))(%[0-9a-zA-Z-.:]{1,})?$`);function O(e){return g.isString(e)===null?!1:xe.test(e)}const Fe=/^\d{1,3}$/;function Ce(e){if(g.isString(e)===null)return!1;const n=e.split("/");return n.length!==2||!Fe.test(n[1])||n[1].length>1&&I(n[1],"0")||!O(n[0])?!1:Number(n[1])<=128&&Number(n[1])>=0}function Ie(e){return/^((\+86)|(86))?(1)\d{10}$/.test(""+e)}function Me(e){return/^(\(\d{3,4}\)|\d{3,4}(-|\s)?)?\d{7,8}(-\d{1,4})?$/.test(""+e)}function w(e,t){if(g.isString(e)===null)return!1;const r=/^(?:[-+]?(?:0|[1-9][0-9]*))$/,i=/^[-+]?[0-9]+$/,o=t||{},s=Object.prototype.hasOwnProperty,c=(Object.prototype.hasOwnProperty.call(o,"zeroes")&&!o.zeroes?r:i).test(e),a=parseInt(e,10);return c&&(!s.call(o,"min")||a>=o.min)&&(!s.call(o,"max")||a<=o.max)&&(!s.call(o,"lt")||a<o.lt)&&(!s.call(o,"gt")||a>o.gt)}function ve(e){return w(e,{min:0,max:65535})}function Ne(e){return/^\d{6}$/.test(""+e)}const Pe=C("Function");class p{constructor(t,n="nextSuccessor"){b(this,"fn");b(this,"nextNode");b(this,"nextFlag");if(!Pe(t))throw new Error(`${t} is no a function`);this.fn=t,this.nextNode=null,this.nextFlag=n}after(t,n=this.nextFlag){const r=t instanceof p;return this.nextNode=r?t:new p(t,n)}start(...t){const n=this.fn.apply(this,t);return n===this.nextFlag?this.next.apply(this,t):n}next(){return this.nextNode&&this.nextNode.start.apply(this.nextNode,arguments)}}const Oe=C("Object"),Re=function(e){return Object.getOwnPropertyNames(e).length===0?!0:"nextSuccessor"},Ue=function(e){return Object.keys(e).length===0};function E(e){if(!Oe(e))throw new Error(`${e} is no a object type`);const t=new p(Re);return t.after(Ue),t.start(e)}function Le(e){const t=/([^?=&]+)=([^&]*)/gi,n={};return e.replace(t,(r,i,o)=>{n[i]=o}),E(n)?"nextSuccessor":n}function _e(e){const t=e.split("?")[1],n={},r=t&&t.split("&");return r&&r.reduce((i,o)=>{const s=o.split("=");return i[s[0]]=s[1],i},n),E(n)?"nextSuccessor":n}function je(e){const t=e.split("?")[1],n=new URLSearchParams(t),r={};for(const i of n)r[i[0]]=i[1];return E(r)?null:r}function Ye(e){const t=new p(Le);return t.after(_e).after(je),t.start(e)}const R={createType:C,getURLValueByKey:fe,getValue:ge,hasEmoji:Se,isEmail:be,isIPv4:P,isIPv4Range:De,isIPv6:O,isIPv6Range:Ce,isMobile:Ie,isPhone:Me,isPort:ve,isPostalCode:Ne,queryURLParams:Ye,validateTypeHoc:l};function He(e){if(e===null)return null;if(!l("Array")(e))throw new TypeError("The ary must be array");return[...e]}function qe(e,t){if(!l("Array")(e))throw new TypeError("The list must be array");if(e.length===0)return e;if(t===void 0)throw new SyntaxError("The index must be required");if(l("Number")(t))t<0?t=0:t>=e.length?t=e.length-1:t=Math.floor(t);else throw new TypeError("The index must be number");return e.splice(t,1),e}function Be(e,t,n){if(!l("Array")(e))throw new TypeError("The list must be array");const r=[...e];if(n===void 0)r.push(t);else if(l("Number")(n))r.splice(n,0,t);else throw new TypeError("The index must be number");return r}function Ze(e,t){if(!l("Array")(e))throw new TypeError("The list must be array");const n=[...e];if(n.length===0)return n;if(t===void 0)throw new SyntaxError("The index must be required");if(l("Number")(t))t<0?t=0:t>=n.length?t=n.length-1:t=Math.floor(t);else throw new TypeError("The index must be number");return n.splice(t,1),n}const U={add:ce,addAll:ae,clone:He,remove:qe,toAdded:Be,toRemoved:Ze};function y(e,t){if(!l("string")(e))throw new TypeError("The parameter type is string");return t!==void 0&&e.length===0?t:e.charAt(0)}function ze(e,t){const n=y(e),r=y(t);return Number.isNaN(n.charCodeAt(0))&&Number.isNaN(r.charCodeAt(0))?0:n.charCodeAt(0)-r.charCodeAt(0)}function Ve(e){return y(e).charCodeAt(0)<128}function L(e){const t=y(e);return t>="A"&&t<="Z"}function _(e){const t=y(e);return t>="a"&&t<="z"}function j(e){return L(e)||_(e)}function M(e){const t=y(e);return t>="0"&&t<="9"}function ke(e){return j(e)||M(e)}function Ge(e){const t=y(e);return t<" "||t.charCodeAt(0)<32||t.charCodeAt(0)===127}function Ke(e){const t=y(e);return(t>=" "||t.charCodeAt(0)>=32)&&t.charCodeAt(0)<127}function v(e){const t=y(e);return t===" "||t===` `||t==="\r"||t===" "||t==="\f"}function Xe(e,t){if(!M(e)){if(t!==void 0)return t;throw new RangeError("The character "+e+" is not in the range '0' - '9'")}return e.charCodeAt(0)-48}const T=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function Je(e){const t=y(e).charCodeAt(0);return"\\u"+T[t>>12&15]+T[t>>8&15]+T[t>>4&15]+T[t&15]}function Qe(e){return e.replace(/\\u([\d\w]{4})/gi,function(t,n){return String.fromCharCode(parseInt(n,16))})}const Y={compare:ze,isAscii:Ve,isAsciiAlpha:j,isAsciiAlphaLower:_,isAsciiAlphanumeric:ke,isAsciiAlphaUpper:L,isAsciiControl:Ge,isAsciiNumeric:M,isAsciiPrintable:Ke,isWhitespace:v,toChar:y,toIntValue:Xe,unicodeEscaped:Je,unicodeUnescaped:Qe};function H(e,t){if(!l("Date")(e))throw new TypeError(`Invalid date: ${e}`);if(!w(t+""))throw new SyntaxError(`Invalid number: ${t}`);const n=new Date(e.getTime());return n.setDate(n.getDate()+(l("Number")(t)?t:+t)),n}function q(e,t){if(!l("Date")(e))throw new TypeError(`Invalid date: ${e}`);if(!w(t+""))throw new SyntaxError(`Invalid number: ${t}`);const n=new Date(e.getTime());return n.setHours(n.getHours()+(l("Number")(t)?t:+t)),n}function B(e,t){if(!l("Date")(e))throw new TypeError(`Invalid date: ${e}`);if(!w(t+""))throw new SyntaxError(`Invalid number: ${t}`);const n=new Date(e.getTime());return n.setMinutes(n.getMinutes()+(l("Number")(t)?t:+t)),n}function Z(e,t){if(!l("Date")(e))throw new TypeError(`Invalid date: ${e}`);if(!w(t+""))throw new SyntaxError(`Invalid number: ${t}`);const n=new Date(e.getTime());return n.setMonth(n.getMonth()+(l("Number")(t)?t:+t)),n}function z(e,t){if(!l("Date")(e))throw new TypeError(`Invalid date: ${e}`);if(!w(t+""))throw new SyntaxError(`Invalid number: ${t}`);const n=new Date(e.getTime());return n.setSeconds(n.getSeconds()+(l("Number")(t)?t:+t)),n}function V(e,t){if(!l("Date")(e))throw new TypeError(`Invalid date: ${e}`);if(!w(t+""))throw new SyntaxError(`Invalid number: ${t}`);const n=new Date(e.getTime());return n.setFullYear(n.getFullYear()+(l("Number")(t)?t:+t)),n}function We(e,t){if(!l("Date")(e))throw new TypeError(`Invalid date: ${e}`);const n={years:0,months:0,days:0,hours:0,mins:0,secs:0},{years:r,months:i,days:o,hours:s,mins:u,secs:c}={...n,...t};if(!w(r+"")||!w(i+"")||!w(o+"")||!w(s+"")||!w(u+"")||!w(c+""))throw new SyntaxError("Invalid time values");let a=new Date(e.getTime());return a=V(a,r),a=Z(a,i),a=H(a,o),a=q(a,s),a=B(a,u),a=z(a,c),a}function et(e){return/(^(y{4}|y{2})[.\u002f-](m{1,2})[.\u002f-](d{1,2})$)|(^(m{1,2})[.\u002f-](d{1,2})[.\u002f-]((y{4}|y{2})$))|(^(d{1,2})[.\u002f-](m{1,2})[.\u002f-]((y{4}|y{2})$))/gi.test(e)}function tt(e,t){const n=[],r=Math.min(e.length,t.length);for(let i=0;i<r;i++)n.push([e[i],t[i]]);return n}function A(e,t){if(t={format:"YYYY/MM/DD",delimiters:["/","-"],strictMode:!1,...t},l("String")(e)&&et(t.format)){const n=t.delimiters.find(s=>t.format.indexOf(s)!==-1),r=t.strictMode?n:t.delimiters.find(s=>e.indexOf(s)!==-1),i=tt(e.split(r),t.format.toLowerCase().split(n)),o={};for(const[s,u]of i){if(s.length!==u.length)return!1;o[u.charAt(0)]=s}return new Date(`${o.m}/${o.d}/${o.y}`).getDate()===+o.d}return t.strictMode?!1:l("Date")(e)}function nt(e,t){const n=[],r=Math.min(e.length,t.length);for(let i=0;i<r;i++)n.push([e[i],t[i]]);return n}function rt(e,t,n){const r=t.delimiters.find(u=>t.format.indexOf(u)!==-1),i=t.strictMode?r:t.delimiters.find(u=>e.indexOf(u)!==-1),o=nt(e.split(i),t.format.toLowerCase().split(r)),s={};for(const[u,c]of o){if(u.length!==c.length)throw new SyntaxError(`${t.format} format is error`);s[c.charAt(0)]=u}return n.format.replace(/(y{4}|y{2})/gi,s.y).replace(/(m{1,2})/gi,s.m).replace(/(d{1,2})/gi,s.d)}function it(e,t){const n=e.getFullYear();return t.format.replace(/(y{4}|y{2})/gi,n+"").replace(/(m{1,2})/gi,i=>i.length===1?String(e.getMonth()+1):String(e.getMonth()+1).padStart(2,"0")).replace(/(d{1,2})/gi,i=>i.length===1?String(e.getDate()):String(e.getDate()).padStart(2,"0"))}function k(e){if(!g.isValidDateFormat(e.format))throw new SyntaxError(`${e.format} is not valid date format`);return function(t,n){if(n={format:"YYYY/MM/DD",delimiters:["/","-"],strictMode:!1,...n},!A(t,n))throw new SyntaxError(`${t} is not valid date`);if(l("String")(t))return rt(t,n,e);if(l("Date")(t))return it(t,e)}}function ot(e,t,n){const r=n||{start:void 0,finish:void 0};if(!A(e,r.start)||!A(t,r.finish))throw new SyntaxError("Invalid date values");const i=k({format:"YYYY/MM/DD"}),o=24*60*60*1e3,s=new Date(i(e,r.start)),u=new Date(i(t,r.finish)),c=Math.abs(u.getTime()-s.getTime());return Math.ceil(c/o)}function G(e){return new Date(e.getFullYear(),2,0).getDate()===29}function st(e){switch(e.getMonth()){case 0:case 2:case 4:case 6:case 7:case 9:case 11:return 31;case 1:return G(e)?29:28;default:return 30}}function ut(e){return new Date(e.getFullYear(),e.getMonth(),1)}function lt(e){return new Date(e.getFullYear(),e.getMonth()+1,0)}const ct={24:{default:/^([01]?\d|2[0-3]):([0-5]\d)$/,hasSecond:/^([01]?\d|2[0-3]):([0-5]\d):([0-5]\d)$/},12:{default:/^(0?\d|1[0-2]):([0-5]\d) (A|P)M$/,hasSecond:/^(0?\d|1[0-2]):([0-5]\d):([0-5]\d) (A|P)M$/}};function at(e,t){if(!l("String")(e))return!1;if(t={format:"HH:MM:SS",mode:24,...t},!g.isTimeFormat(t.format))throw new SyntaxError(`${t.format} is not valid format`);if(![24,12].includes(t.mode))throw new SyntaxError(`${t.mode} is not valid mode`);const n=t.format.match(/s/ig),r=n&&n.length>0;return ct[t.mode][r?"hasSecond":"default"].test(e)}const ft={24:{default:/^([01]?\d|2[0-3]):([0-5]\d)$/,hasSecond:/^([01]?\d|2[0-3]):([0-5]\d):([0-5]\d)$/},12:{default:/^(0?\d|1[0-2]):([0-5]\d) (A|P)M$/,hasSecond:/^(0?\d|1[0-2]):([0-5]\d):([0-5]\d) (A|P)M$/}};function K(e,t,n){let r;for(const i in t)if(["12","24"].includes(i)){const o=K(e,t[i],i);o&&(r=o)}else if(t[i].test(e))return{mode:n,format:i,matches:e.match(t[i])};return r}function ht(e){if(!g.isTimeFormat(e.format))throw new SyntaxError(`${e.format} is not valid format`);if(![24,12].includes(e.mode))throw new SyntaxError(`${e.mode} is not valid mode`);return function(t){const n=K(t,ft,void 0);if(!n)throw new SyntaxError(`${t} is not valid time`);const r={h:"",m:"",s:"",b:""};if(n.mode==="12"){const[o,s,u,c]=[...n.matches].splice(1,4);r.h=o,r.m=s,r.s=u,r.b=c,e.mode===24&&c==="P"&&(r.h=+o+12+"")}else if(n.mode==="24"){const[o,s,u]=[...n.matches].splice(1,3);r.h=o,r.m=s,r.s=u}if(e.mode===12&&!r.b){const o=+r.h;o>12?(r.h=o-12+"",r.b="P"):r.b="A"}let i=e.format.replace(/(h{1,2})/gi,r.h).replace(/(m{1,2})/gi,r.m).replace(r.s?/(s{1,2})/gi:/:(s{1,2})/gi,r.s?r.s:"");return e.mode===12&&r.b&&(i+=` ${r.b}M`),i}}function gt(e){const t=new Date(e.getTime()),n=t.getUTCFullYear(),r=String(t.getUTCMonth()+1).padStart(2,"0"),i=String(t.getUTCDate()).padStart(2,"0"),o=String(t.getUTCHours()).padStart(2,"0"),s=String(t.getUTCMinutes()).padStart(2,"0"),u=String(t.getUTCSeconds()).padStart(2,"0"),c=String((t.getUTCMilliseconds()/1e3).toFixed(3).slice(2,5)).padStart(3,"0");return`${n}-${r}-${i}T${o}:${s}:${u}.${c}Z`}const X={addDays:H,addHours:q,addMinutes:B,addMonths:Z,addSecs:z,addTime:We,addYears:V,dateFormatHoc:k,getDatePeriod:ot,getDaysInMonth:st,getFirstDateInMonth:ut,getLastDateInMonth:lt,isDate:A,isLeapYear:G,isTime:at,timeFormatHoc:ht,toISOString:gt};function dt(e,t){const n=g.isString(e);if([null,"",".",",","-","+"].includes(n))return!1;const r=new RegExp("^(?:[-+])?(?:[0-9]+)?(?:\\.[0-9]*)?(?:[eE][\\+\\-]?(?:[0-9]+))?$"),i=t||{},o=Object.prototype.hasOwnProperty,s=parseFloat(n.replace(",","."));return r.test(e)&&(!o.call(i,"min")||s>=i.min)&&(!o.call(i,"max")||s<=i.max)&&(!o.call(i,"lt")||s<i.lt)&&(!o.call(i,"gt")||s>i.gt)}const J={isFloat:dt,isInteger:w};function Q(...e){if(e===null)return!1;for(const t of e)if(t===null)return!1;return!0}const W={allNotNull:Q,isEmpty:E};function S(e,t){const n=g.isString(e),r=g.isString(t);return n===r}function d(e){const t=g.isString(e);return t===null||t.length===0}function ee(...e){if(e.length===0)return!1;for(const t of e)if(d(t))return!0;return!1}function D(e){const t=g.isString(e);return t===null?0:t.length}function te(e,t=0,n=0){if(e===null)return e;const r=l("Number");if(!r(t)||!r(n))throw new TypeError("The start or end paramter type is number");const i=D(e);return n<0&&(n=i+n),t<0&&(t=i+t),n>i&&(n=i),t>n?"":(t<0&&(t=0),n<0&&(n=0),e.substring(t,n))}function ne(e,t,n,r){if(!d(e)&&S("",t)&&t.length>0)return te(e,0,r);if(ee(e,t))return e;{const i=t.length,o=i+1,s=i+i+1;if(r<o)throw new RangeError(`Minimum abbreviation width is ${o}`);{const u=e.length;if(u<=r)return e;if(n>u&&(n=u),u-n<r-i&&(n=u-(r-i)),n<=i+1)return e.substring(0,r-i)+t;if(r<s)throw new RangeError(`Minimum abbreviation width with offset is ${s}`);return n+r-i<u?t+ne(e.substring(n),t,0,r-i):t+e.substring(u-(r-i))}}}function mt(e,t,n){return n?(n+e+n).indexOf(n+t+n)>-1:e.indexOf(t)>-1}function wt(e,...t){if(t.length!==0){for(const n of t)if(S(e,n))return!0}return!1}function re(e,t){if(S(e,t))return!0;if(e!==null&&t!==null){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!S(e.charAt(n).toUpperCase(),t.charAt(n).toUpperCase()))return!1;return!0}else return!1}function yt(e,...t){if(t.length!==0){for(const n of t)if(re(e,n))return!0}return!1}function $t(e){return e.replace(/[&<>'"]/g,t=>({"&":"&amp;","<":"&lt;",">":"&gt;","'":"&#39;",'"':"&quot;"})[t]||t)}function x(e){const t=g.isString(e);return t===null?null:t.replace(/(^\s*)|(\s*$)/g,"")}function ie(e){return new RegExp("[A-Za-z]+","g").test(e)}const pt=function(e,t){let n=0;for(let r=0;r<e.length;r++)ie(e[r])?n++:n+=t;return n};function St(e,t=!1,n=2){return t?pt(x(e),n):e.length}function bt(e){return new RegExp("[\\u4E00-\\u9FFF]+","g").test(e)}function Et(e){const t=g.isString(e);return t===null?null:t.replace(/(^\s*)/g,"")}function Tt(e){const t=g.isString(e);return t===null?null:t.replace(/(\s*$)/g,"")}function oe(e,t=null){let n=D(e);if(n===0)return e;{const r=g.isString(t);if(r===null)for(;n!==0&&v(e.charAt(n-1));)--n;else{if(r.length===0)return e;for(;n!==0&&r.indexOf(e.charAt(n-1))!==-1;)--n}return e.substring(0,n)}}function se(e,t=null){const n=D(e);if(n===0)return e;{let r=0;const i=g.isString(t);if(i===null)for(;r!==n&&v(e.charAt(r));)++r;else{if(i.length===0)return e;for(;r!==n&&i.indexOf(e.charAt(r))!==-1;)++r}return e.substring(r)}}function F(e,t=null){return e=se(e,t),oe(e,t)}function At(e,t=null){if(e===null)return null;if(!Array.isArray(e))throw new TypeError("The paramter type is array");const n=e.length;if(n===0)return e;const r=[];for(let i=0;i<n;i++)r.push(F(e[i],t));return r}function Dt(e){return e===null?"":F(e,null)}function xt(e){return e===null?null:(e=F(e,null),e.length===0?null:e)}function Ft(e,t=null){if(d(e))return e;if(typeof t=="number")if(t>=32&&t<127){const n=String.fromCharCode(t),r=e.indexOf(n);return r===-1?"":e.substring(r+1)}else throw new RangeError("The separator decimal numbers not in 7-bit ASCII displayable characters");else{if(d(t))return"";if(typeof t=="string"){const n=e.indexOf(t);return n===-1?"":e.substring(n+t.length)}else throw new TypeError("The separator type is string | number | null")}}function Ct(e,t=null){if(d(e))return e;if(typeof t=="number")if(t>=32&&t<127){const n=String.fromCharCode(t),r=e.lastIndexOf(n);return r!==-1&&r!==e.length-1?e.substring(r+1):""}else throw new RangeError("The separator decimal numbers not in 7-bit ASCII displayable characters");else{if(d(t))return"";if(typeof t=="string"){const n=e.lastIndexOf(t);return n!==-1&&n!==e.length-t.length?e.substring(n+t.length):""}else throw new TypeError("The separator type is string | number | null")}}function It(e,t=null){if(d(e))return e;if(typeof t=="number")if(t>=32&&t<127){const n=String.fromCharCode(t),r=e.indexOf(n);return r==-1?e:e.substring(0,r)}else throw new RangeError("The separator decimal numbers not in 7-bit ASCII displayable characters");else{if(d(t))return"";if(typeof t=="string"){const n=e.indexOf(t);return n==-1?e:e.substring(0,n)}else throw new TypeError("The separator type is string | number | null")}}function Mt(e,t=null){if(d(e))return e;if(typeof t=="number")if(t>=32&&t<127){const n=String.fromCharCode(t),r=e.lastIndexOf(n);return r===-1?e:e.substring(0,r)}else throw new RangeError("The separator decimal numbers not in 7-bit ASCII displayable characters");else{if(d(t))return"";if(typeof t=="string"){const n=e.lastIndexOf(t);return n===-1?e:e.substring(0,n)}else throw new TypeError("The separator type is string | number | null")}}function vt(e,t,n){if(Q(e,t,n)){const r=e.indexOf(t);if(r!==-1){const i=e.indexOf(n,r+t.length);if(i!==-1)return e.substring(r+t.length,i)}return null}else return null}function Nt(e,t,n){if(e===null||d(t)||d(n))return null;const r=e.length;if(r===0)return[];{const i=n.length,o=t.length,s=[];let u;for(let c=0;c<r-i;c=u+i){const a=e.indexOf(t,c);if(a<0)break;const le=a+o;if(u=e.indexOf(n,le),u<0)break;s.push(e.substring(le,u))}return s.length===0?null:s}}function Pt(e){return e===null?"":x(e)}function Ot(e){const t=x(e);return d(t)?null:t}function Rt(e,t,n){if(t<0)throw new RangeError("offset cannot be negative");if(n<0)throw new RangeError("maxWith cannot be negative");if(e===null)return null;if(t>e.length)return"";if(e.length>n){const r=Math.min(t+n,e.length);return e.substring(t,r)}else return e.substring(t)}function Ut(e){return e.replace(/&amp;|&lt;|&gt;|&#39;|&quot;/g,t=>({"&amp;":"&","&lt;":"<","&gt;":">","&#39;":"'","&quot;":'"'})[t]||t)}function Lt(e,t){return d(e)||d(t)?e:t.concat(e).concat(t)}function _t(e,t){if(d(e)||d(t))return e;const n=!e.startsWith(t),r=!e.endsWith(t);if(!n&&!r)return e;{let i="";return n&&(i=i.concat(t)),i=i.concat(e),r&&(i=i.concat(t)),i}}const ue={abbreviate:ne,contains:mt,equals:S,equalsAny:wt,equalsAnyIgnoreCase:yt,equalsIgnoreCase:re,escapeHTML:$t,getStrLength:St,isAnyEmpty:ee,isEmpty:d,isEN:ie,isZH:bt,length:D,ltrim:Et,rtrim:Tt,startsWith:I,strip:F,stripAll:At,stripEnd:oe,stripStart:se,stripToEmpty:Dt,stripToNull:xt,substring:te,substringAfter:Ft,substringAfterLast:Ct,substringBefore:It,substringBeforeLast:Mt,substringBetween:vt,substringsBetween:Nt,trim:x,trimToEmpty:Pt,trimToNull:Ot,truncate:Rt,unescapeHTML:Ut,upperCase:m,wrap:Lt,wrapIfMissing:_t},jt={ArrayUtils:U,CharUtils:Y,DateUtils:X,DutyLink:p,NumberUtils:J,ObjectUtils:W,StringUtils:ue,Utils:R};f.ArrayUtils=U,f.CharUtils=Y,f.DateUtils=X,f.DutyLink=p,f.NumberUtils=J,f.ObjectUtils=W,f.StringUtils=ue,f.Utils=R,f.default=jt,Object.defineProperties(f,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});