@creejs/commons-lang 2.1.12 → 2.1.13

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,2 +1,2 @@
1
- !function(t,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r((t="undefined"!=typeof globalThis?globalThis:t||self).CommonsLang={})}(this,function(t){"use strict";var r={constructorName:e,defaults:function(t,...r){if(null==t)throw new TypeError('"target" must not be null or undefined');for(const e of r)if(null!=e)for(const r in e)void 0===t[r]&&(t[r]=e[r]);return t},extend:n,extends:n,equals:function(t,r){if(t===r)return!0;if("function"==typeof t?.equals)return t.equals(r);if("function"==typeof r?.equals)return r.equals(t);return!1},isBrowser:o,isNode:function(){return!o()}};function e(t){return t?.constructor?.name}function n(t,...r){if(null==t)throw new TypeError('"target" must not be null or undefined');for(const e of r)if(null!=e)for(const r in e)t[r]=e[r];return t}function o(){return"undefined"!=typeof window&&"undefined"!=typeof document}var i={isArray:s,isBoolean:u,isBuffer:function(t){return null!=t&&Buffer.isBuffer(t)},isFunction:f,isInstance:a,isIterable:function(t){return null!=t&&"function"==typeof t[Symbol.iterator]},isDate:function(t){return null!=t&&t instanceof Date},isError:function(t){return null!=t&&t instanceof Error},isMap:function(t){return null!=t&&"object"==typeof t&&t.constructor===Map},isWeakMap:function(t){return null!=t&&"object"==typeof t&&t.constructor===WeakMap},isNumber:w,isPositive:l,isNegative:p,isNotNegative:y,isNil:c,isNullOrUndefined:function(t){return null==t},isNull:g,isUndefined:h,isPlainObject:m,isObject:d,isPromise:b,isRegExp:function(t){return null!=t&&"object"==typeof t&&t.constructor===RegExp},isSet:function(t){return null!=t&&"object"==typeof t&&t.constructor===Set},isWeakSet:function(t){return null!=t&&"object"==typeof t&&t.constructor===WeakSet},isStream:function(t){return null!=t&&"function"==typeof t.pipe},isString:A,isSymbol:N,isPrimitive:function(t){return null!==t&&("string"==typeof t||"number"==typeof t||"boolean"==typeof t)},isInt8Array:$,isUint8Array:E,isUint8ClampedArray:v,isInt16Array:U,isUint16Array:S,isInt32Array:x,isUint32Array:P,isFloat32Array:j,isFloat64Array:B,isBigInt64Array:I,isBigUint64Array:T,isTypedArray:O,isArrayBuffer:L};function s(t){return Array.isArray(t)}function u(t){return"boolean"==typeof t}function f(t){return"function"==typeof t}function a(t){return null!=t&&"object"==typeof t&&!m(t)}function c(t){return null==t}function l(t){return!!w(t)&&t>0}function y(t){return!!w(t)&&t>=0}function p(t){return!!w(t)&&t<0}function g(t){return null===t}function h(t){return void 0===t}function w(t){return null!=t&&"number"==typeof t}function d(t){return null!=t&&"object"==typeof t}function m(t){return null!==t&&"object"==typeof t&&(t.constructor===Object||void 0===t.constructor)}function b(t){return null!=t&&"function"==typeof t.then}function A(t){return null!=t&&"string"==typeof t}function N(t){return null!=t&&"symbol"==typeof t}function O(t){return ArrayBuffer.isView(t)&&t.constructor!==DataView}function $(t){return t instanceof Int8Array}function E(t){return t instanceof Uint8Array}function v(t){return t instanceof Uint8ClampedArray}function U(t){return t instanceof Int16Array}function S(t){return t instanceof Uint16Array}function x(t){return t instanceof Int32Array}function P(t){return t instanceof Uint32Array}function j(t){return t instanceof Float32Array}function B(t){return t instanceof Float64Array}function I(t){return t instanceof BigInt64Array}function T(t){return t instanceof BigUint64Array}function L(t){return t instanceof ArrayBuffer}var k={assertNumber:M,assertPositive:D,assertNegative:function(t,r){if(!p(t))throw new Error(`${r?'"'+r+'" ':" "}Not Negative: ${t}`)},assertNotNegative:F,assertBoolean:function(t,r){if(!u(t))throw new Error(`${r?'"'+r+'" ':" "}Not Boolean: type=${typeof t} value=${JSON.stringify(t)}`)},assertObject:q,assertPlainObject:function(t,r){if(!m(t))throw new Error(`${r?'"'+r+'" ':" "}Not PlainObject: type=${typeof t} value=${JSON.stringify(t)}`)},assertSymbol:function(t,r){if(!N(t))throw new Error(`${r?'"'+r+'" ':" "}Not Symbol: type=${typeof t} value=${JSON.stringify(t)}`)},assertFunction:R,assertInstance:function(t,r){if(!a(t))throw new Error(`${r?'"'+r+'" ':" "}Not Class Instance: type=${typeof t} value=${JSON.stringify(t)}`)},assertPromise:W,assertNil:function(t,r){if(!c(t))throw new Error(`${r?'"'+r+'" ':" "}Neither Null nor Undefined: type=${typeof t} value=${JSON.stringify(t)}`)},assertNotNil:H,assertNull:function(t,r){if(!g(t))throw new Error(`${r?'"'+r+'" ':" "}Not Null: type=${typeof t} value=${JSON.stringify(t)}`)},assertNotNull:function(t,r){if(g(t))throw new Error((r?'"'+r+'" ':" ")+"Should Not Null")},assertUndefined:function(t,r){if(!h(t))throw new Error(`${r?'"'+r+'" ':" "}Not Undefined: type=${typeof t} value=${JSON.stringify(t)}`)},assertString:C,assertArray:J,assertStringOrSymbol:function(t,r){if(!A(t)&&!N(t))throw new Error(`${r?'"'+r+'" ':" "}Not String or Symbol: type=${typeof t} value=${JSON.stringify(t)}`)},assertInt8Array:function(t,r){if($(t))throw new Error((r?'"'+r+'" ':" ")+"Not Int8Array")},assertUint8Array:function(t,r){if(E(t))throw new Error((r?'"'+r+'" ':" ")+"Not Uint8Array")},assertUint8ClampedArray:function(t,r){if(v(t))throw new Error((r?'"'+r+'" ':" ")+"Not Uint8ClampedArray")},assertInt16Array:function(t,r){if(U(t))throw new Error((r?'"'+r+'" ':" ")+"Not Int16Array")},assertUint16Array:function(t,r){if(S(t))throw new Error((r?'"'+r+'" ':" ")+"Not Uint16Array")},assertInt32Array:function(t,r){if(x(t))throw new Error((r?'"'+r+'" ':" ")+"Not Int32Array")},assertUint32Array:function(t,r){if(P(t))throw new Error((r?'"'+r+'" ':" ")+"Not Uint32Array")},assertFloat32Array:function(t,r){if(j(t))throw new Error((r?'"'+r+'" ':" ")+"Not Float32Array")},assertFloat64Array:function(t,r){if(B(t))throw new Error((r?'"'+r+'" ':" ")+"Not Float64Array")},assertBigInt64Array:function(t,r){if(I(t))throw new Error((r?'"'+r+'" ':" ")+"Not BigInt64Array")},assertBigUint64Array:function(t,r){if(T(t))throw new Error((r?'"'+r+'" ':" ")+"Not BigUint64Array")},assertTypedArray:function(t,r){if(O(t))throw new Error((r?'"'+r+'" ':" ")+"Not TypedArray")},assertArrayBuffer:V};function J(t,r){if(!Array.isArray(t))throw new Error(`${r?'"'+r+'" ':" "}Not Array: type=${typeof t} value=${JSON.stringify(t)}`)}function C(t,r){if(!A(t))throw new Error(`${r?'"'+r+'" ':" "}Not String: type=${typeof t} value=${JSON.stringify(t)}`)}function M(t,r){if(!w(t))throw new Error(`${r?'"'+r+'" ':" "}Not Number: type=${typeof t} value=${JSON.stringify(t)}`)}function D(t,r){if(!l(t))throw new Error(`${r?'"'+r+'" ':" "}Not Positive: ${t}`)}function F(t,r){if(!y(t))throw new Error(`${r?'"'+r+'" ':" "}Not "0 or Positive": ${t}`)}function q(t,r){if(!d(t))throw new Error(`${r?'"'+r+'" ':" "}Not Object: type=${typeof t} value=${JSON.stringify(t)}`)}function R(t,r){if(!f(t))throw new Error(`${r?'"'+r+'" ':" "}Not Function: type=${typeof t} value=${JSON.stringify(t)}`)}function W(t,r){if(!b(t))throw new Error(`${r?'"'+r+'" ':" "}Not Promise: type=${typeof t} value=${JSON.stringify(t)}`)}function H(t,r){if(c(t))throw new Error((r?'"'+r+'" ':" ")+"Should Not Nil")}function V(t,r){if(!L(t))throw new Error((r?'"'+r+'" ':" ")+"Not ArrayBuffer")}var z={isEmpty:_,assertNotEmpty:G,isBlank:K,assertNotBlank:function(t){if(K(t))throw new Error(`Blank String: ${t}`)},capitalize:function(t){if(C(t),0===t.length)return t;const r=t.charAt(0),e=r.toUpperCase();return r===e?t:e+t.slice(1)},decapitalize:function(t){if(C(t),0===t.length)return t;const r=t.charAt(0),e=r.toLowerCase();return r===e?t:e+t.slice(1)},splitWithFixedLength:function(t,r,e=" "){if(C(t),M(r),C(e),0===t.length)return[];if(r<=0)throw new Error("length muse >=0");if(t.length<r)return[t.padEnd(r,e)];const n=[];for(let o=0;o<t.length;o+=r){const i=t.substring(o,o+r);n.push(i.padEnd(r,e))}return n},split:function(t,...r){C(t);if(0===t.length)return[];const e=[...r];0===r.length&&r.push(",");const n=Q(t,...e);if(0===n.length)return[];const o=[];let i="",s=0;for(const{marker:r,index:e}of n)i=t.substring(s,e),o.push(i),s=e+r.length;return i=t.substring(s),o.push(i),o},findMarkerPositions:function(t,...r){if(C(t),0===r.length)throw new Error("At least one marker must be provided");const e=[];for(const n of new Set(r)){if(_(n))continue;C(n);let r=t.indexOf(n);for(;-1!==r;)e.push({marker:n,index:r}),r=t.indexOf(n,r+n.length)}return e.sort((t,r)=>t.index-r.index),e},findMarkerPositionsRegex:Q,substringBefore:function(t,r){if(C(t),C(r),0===t.length||0===r.length)return;const e=t.indexOf(r);if(-1===e)return;return t.substring(0,e)},substringBeforeLast:function(t,r){if(C(t),C(r),0===t.length||0===r.length)return;const e=t.lastIndexOf(r);if(-1===e)return;return t.substring(0,e)},substringAfter:function(t,r){if(C(t),C(r),0===t.length||0===r.length)return;const e=t.indexOf(r);if(-1===e)return;return t.substring(e+r.length)},substringAfterLast:function(t,r){if(C(t),C(r),0===t.length||0===r.length)return;const e=t.lastIndexOf(r);if(-1===e)return;return t.substring(e+r.length)},substringBetween:function(t,r,e){G(t),G(r),G(e);const n=t.indexOf(r);if(-1===n)return;const o=t.indexOf(e,n+r.length);if(-1===o)return;return t.substring(n+r.length,o)},substringBetweenGreedy:function(t,r,e){G(t),G(r),G(e);const n=t.indexOf(r);if(-1===n)return;const o=t.lastIndexOf(e);if(-1===o||o<=n)return;return t.substring(n+r.length,o)},substringsBetween:function(t,r,e){G(t),G(r),G(e);const n=[];let o=0;for(;;){const i=t.indexOf(r,o);if(-1===i)break;const s=t.indexOf(e,i+r.length);if(-1===s)break;n.push(t.substring(i+r.length,s)),o=s+e.length}return n}};function _(t){return null==t||(C(t),0===t.length)}function G(t){if(_(t))throw new Error(`Empty String: ${t}`)}function K(t){return null==t||(C(t),0===t.trim().length)}function Q(t,...r){if(C(t),0===r.length)throw new Error("At least one marker must be provided");const e=[...new Set(r.filter(t=>null!=t))].map(t=>(C(t),t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"))),n=new RegExp(e.map(t=>`(${t})`).join("|"),"g"),o=[];let i=null;for(;null!==(i=n.exec(t));){for(let t=1;t<i.length;t++)if(i[t]){o.push({marker:r[t-1],index:i.index});break}0===i[0].length&&n.lastIndex++}return o}var X={quiet:function(t){R(t);try{const r=t();return b(r)?r.catch(()=>{}):r}catch(t){}},quietKeepError:function(t,r){R(t),J(r);try{const e=t();return b(e)?e.catch(t=>r.push(t)):e}catch(t){r.push(t)}}},Y={defer:Z,delay:function(t,r){w(t)?(r=t,t=Promise.resolve()):null==t&&null==r&&(r=1,t=Promise.resolve());null!=t&&W(t),M(r=r??1e3);const e=Z(),n=Date.now();return t.then((...t)=>{const o=Date.now()-n;o<r?setTimeout(()=>e.resolve(...t),r-o):e.resolve(...t)}).catch(t=>{const o=Date.now()-n;o<r?setTimeout(()=>e.reject(t),r-o):e.reject(t)}),e.promise},timeout:function(t,r,e){W(t),M(r=r??1);const n=Z(r,e),o=Date.now();return t.then((...t)=>{Date.now()-o<=r?n.resolve(...t):n.reject(new Error(e??`Promise Timeout: ${r}ms`))}).catch(t=>{!n.resolved&&!n.rejected&&n.reject(t)}),n.promise},allSettled:tt,returnValuePromised:rt,series:async function(t){J(t);const r=[];for(const e of t)R(e),r.push(await e());return r},seriesAllSettled:async function(t){J(t);const r=[];for(const e of t){R(e);try{r.push({ok:!0,result:await e()})}catch(t){r.push({ok:!1,result:t})}}return r},parallel:async function(t,r=5){if(J(t),M(r),r<=0)throw new Error(`Invalid maxParallel: ${r}, should > 0`);t.forEach(t=>R(t));const e=[];if(t.length<=r){const r=await Promise.all(t.map(t=>rt(t)));return e.push(...r),e}const n=[];for(const o of t)if(R(o),n.push(o),n.length>=r){const t=await Promise.all(n.map(t=>rt(t)));e.push(...t),n.length=0}if(n.length>0&&n.length<r){const t=await Promise.all(n.map(t=>rt(t)));e.push(...t)}return e},parallelAllSettled:async function(t,r=5){if(J(t),M(r),r<=0)throw new Error(`Invalid maxParallel: ${r}, should > 0`);t.forEach(t=>R(t));const e=[];if(t.length<=r){const r=await tt(t.map(t=>rt(t)));return e.push(...r),e}const n=[];for(const o of t)if(R(o),n.push(o),n.length>=r){const t=await tt(n.map(t=>rt(t)));e.push(...t),n.length=0}if(n.length>0&&n.length<r){const t=await tt(n.map(t=>rt(t)));e.push(...t)}return e}};function Z(t=-1,r){M(t);const e={};let n;return t>=0&&(e.timerHandler=n=setTimeout(()=>{clearTimeout(n),e.timerCleared=!0,e.reject(new Error(r??`Promise Timeout: ${t}ms`))},t),e.timerHandler=n),e.promise=new Promise((t,r)=>{e.resolve=(...r)=>{null!=n&&(clearTimeout(n),e.timerCleared=!0),e.resolved=!0,t(...r)},e.reject=t=>{null!=n&&(clearTimeout(n),e.timerCleared=!0),e.rejected=!0,r(t)}}),e.promise.cancel=()=>{null!=n&&(clearTimeout(n),e.timerCleared=!0),e.rejected=!0,e.canceled=e.promise.canceled=!0,e.reject(new Error("Cancelled"))},e}async function tt(t){J(t);const r=await Promise.allSettled(t),e=[];for(const t of r)"fulfilled"===t.status&&e.push({ok:!0,result:t.value}),"rejected"===t.status&&e.push({ok:!1,result:t.reason});return e}function rt(t){try{const r=t();return b(r)?r:Promise.resolve(r)}catch(t){return Promise.reject(t)}}const{isPlainObject:et}=i;var nt={proxy:ot,newProxyInstance:function(t,r,e,n=!0){const o=ot(t,e,n);return Reflect.construct(o,r??[])}};function ot(t,r,e=!0){if("function"!=typeof t)throw new TypeError(`Not Class: type=${typeof t}, value=${JSON.stringify(t)}`);if(null!=r){if(!et(r))throw new TypeError(`Not PropertyHandler: type=${typeof r}, value=${JSON.stringify(r)}`);const{get:t,set:e}=r;if(null!=t&&"function"!=typeof t)throw new TypeError(`Not PropertyHandler.get: type=${typeof t}, value=${JSON.stringify(t)}`);if(null!=e&&"function"!=typeof e)throw new TypeError(`Not PropertyHandler.set: type=${typeof e}, value=${JSON.stringify(e)}`)}const n={construct(t,n,o){const i=Reflect.construct(t,n);return new Proxy(e?Object.preventExtensions(i):i,r??{})}};return new Proxy(t,n)}var it={proxy:function(t,r,e=!0){if(c(t)||!d(t)||s(t))throw new TypeError(`Not Object: type=${typeof t}, value=${JSON.stringify(t)}`);return new Proxy(e?Object.preventExtensions(t):t,r??{})}};function st(t){q(t,"obj");const r=new Set;let e=t;for(;e&&e!==Object.prototype;){const n=Object.getOwnPropertyNames(e);for(const e of n)"constructor"!==e&&"function"==typeof t[e]&&r.add(e);e=Object.getPrototypeOf(e)}return[...new Set(r)]}var ut={getMethodsOfClass:function(t){R(t,"cls");const r=new Set;let e=t.prototype;for(;e&&e!==Object.prototype;){const t=Object.getOwnPropertyNames(e);for(const n of t)"constructor"!==n&&"function"==typeof e[n]&&r.add(n);e=Object.getPrototypeOf(e)}return[...new Set(r)]},getStaticMethodsOfClass:function(t){R(t,"cls");const r=new Set;let e=t;for(;e&&e!==Object.getPrototypeOf(Object);){const t=Object.getOwnPropertyNames(e);for(const n of t)"function"==typeof e[n]&&r.add(n);e=Object.getPrototypeOf(e)}return[...r]},getMethods:st,getMethodsOfObject:st},ft={startsWith:function(t,r){H(t,"src"),H(r,"searching");return ct(t.subarray(0,r.length),r)},isSameType:at,equals:ct};function at(t,r){return H(t,"src"),H(r,"target"),e(t)===e(r)}function ct(t,r){if(H(t,"src"),H(r,"target"),!at(t,r))return!1;if(t.byteLength!==r.byteLength)return!1;const e=new DataView(t.buffer,t.byteOffset,t.byteLength),n=new DataView(r.buffer,r.byteOffset,r.byteLength);for(let r=0;r<t.byteLength;r++)if(e.getUint8(r)!==n.getUint8(r))return!1;return!0}var lt={readString:function(t,r=0,e){if(V(t),F(r),r>=t.byteLength)return;let n=null;null!=e?(D(e),n=r+e>=t.byteLength?new Uint8Array(t,r):new Uint8Array(t,r,e)):n=new Uint8Array(t,r);return yt.decode(n)},writeString:function(t,r,e=0){V(t,"buffer"),C(r,"str"),F(e,"offset");const n=pt.encode(r),o=n.byteLength;if(e+o>t.byteLength)throw new Error(`offset + str.byteLength > buffer.byteLength:${e+o} > ${t.byteLength}`);new Uint8Array(t,e,n.byteLength).set(n)},writeArrayBuffer:function(t,r,e=0,n=0,o){V(t),V(r),M(e),M(n);const i=t.byteLength;if(e<-1*i)e=0;else if(e<0)e+=i;else if(e>=i)throw new Error(`Out of target Bounds: targetOffset(${e}) >= targetLength(${i})`);const s=r.byteLength;if(n<-1*s)n=0;else if(n<0)n+=s;else if(n>=s)throw new Error(`Out of data Bounds: dataOffset(${n}) >= dataArrayBufferLength(${s})`);null!=o&&(D(o,"dataLength"),n+o>s&&(o=void 0));const u=new Uint8Array(r,n,o);if(u.byteLength>i-e)throw new Error(`Out of target Bounds: from targetOffset(${e}), No Space to store dataArrayBuffer(${n}, ${o??"NoLimit"})`);new Uint8Array(t).set(u,e)}};const yt=new TextDecoder,pt=new TextEncoder;const gt=1e6;var ht={s2ns:1e9,ms2ns:gt,timestamp64:wt,lapseNano:dt,lapseMillis:mt,timeoutNano:function(t,r){return dt(t)>r},timeoutMillis:function(t,r){return mt(t)>r}};function wt(){if("undefined"!=typeof performance&&"number"==typeof performance.timeOrigin){const t=performance.timeOrigin,r=performance.now();return BigInt((t+r)*gt)}return BigInt(Date.now()*gt)}function dt(t,r){return(r??wt())-t}function mt(t,r){r=r??wt();return BigInt(r-t)/BigInt(gt)}var bt={first:function(t,r){return J(t,"arr"),t[0]??r},last:function(t,r){return J(t,"arr"),t[t.length-1]??r},equals:function(t,r,e){if(!Array.isArray(t)||!Array.isArray(r))return!1;if(t.length!==r.length)return!1;for(let n=0;n<t.length;n++)if(e){if(0!==e(t[n],r[n]))return!1}else if(t[n]!==r[n])return!1;return!0},equalsIgnoreOrder:function(t,r,e){if(!Array.isArray(t)||!Array.isArray(r))return!1;if(t.length!==r.length)return!1;t.sort(e),r.sort(e);for(let n=0;n<t.length;n++)if(e){if(0!==e(t[n],r[n]))return!1}else if(t[n]!==r[n])return!1;return!0}};var At={LangUtils:r,StringUtils:z,TypeUtils:i,TypeAssert:k,ExecUtils:X,PromiseUtils:Y,Lang:r,Type:i,Exec:X,ClassProxyUtils:nt,InstanceProxyUtils:it,ReflectUtils:ut,TypedArrayUtils:ft,ArrayBufferUtils:lt,TimeUtils:ht,ArrayUtils:bt};t.ArrayBufferUtils=lt,t.ArrayUtils=bt,t.ClassProxyUtils=nt,t.Exec=X,t.ExecUtils=X,t.InstanceProxyUtils=it,t.Lang=r,t.LangUtils=r,t.PromiseUtils=Y,t.ReflectUtils=ut,t.StringUtils=z,t.TimeUtils=ht,t.Type=i,t.TypeAssert=k,t.TypeUtils=i,t.TypedArrayUtils=ft,t.default=At,Object.defineProperty(t,"__esModule",{value:!0})});
1
+ !function(t,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r((t="undefined"!=typeof globalThis?globalThis:t||self).CommonsLang={})}(this,function(t){"use strict";var r={constructorName:e,defaults:function(t,...r){if(null==t)throw new TypeError('"target" must not be null or undefined');for(const e of r)if(null!=e)for(const r in e)void 0===t[r]&&(t[r]=e[r]);return t},extend:n,extends:n,equals:function(t,r){if(t===r)return!0;if("function"==typeof t?.equals)return t.equals(r);if("function"==typeof r?.equals)return r.equals(t);return!1},isBrowser:o,isNode:function(){return!o()}};function e(t){return t?.constructor?.name}function n(t,...r){if(null==t)throw new TypeError('"target" must not be null or undefined');for(const e of r)if(null!=e)for(const r in e)t[r]=e[r];return t}function o(){return"undefined"!=typeof window&&"undefined"!=typeof document}var i={isArray:s,isBoolean:u,isBuffer:function(t){return null!=t&&Buffer.isBuffer(t)},isFunction:f,isInstance:a,isIterable:function(t){return null!=t&&"function"==typeof t[Symbol.iterator]},isDate:function(t){return null!=t&&t instanceof Date},isError:function(t){return null!=t&&t instanceof Error},isMap:function(t){return null!=t&&"object"==typeof t&&t.constructor===Map},isWeakMap:function(t){return null!=t&&"object"==typeof t&&t.constructor===WeakMap},isNumber:w,isPositive:l,isNegative:p,isNotNegative:y,isNil:c,isNullOrUndefined:function(t){return null==t},isNull:g,isUndefined:h,isPlainObject:m,isObject:d,isPromise:b,isRegExp:function(t){return null!=t&&"object"==typeof t&&t.constructor===RegExp},isSet:function(t){return null!=t&&"object"==typeof t&&t.constructor===Set},isWeakSet:function(t){return null!=t&&"object"==typeof t&&t.constructor===WeakSet},isStream:function(t){return null!=t&&"function"==typeof t.pipe},isString:A,isSymbol:N,isPrimitive:function(t){return null!==t&&("string"==typeof t||"number"==typeof t||"boolean"==typeof t)},isInt8Array:$,isUint8Array:E,isUint8ClampedArray:v,isInt16Array:U,isUint16Array:S,isInt32Array:x,isUint32Array:P,isFloat32Array:j,isFloat64Array:B,isBigInt64Array:I,isBigUint64Array:T,isTypedArray:O,isArrayBuffer:L};function s(t){return Array.isArray(t)}function u(t){return"boolean"==typeof t}function f(t){return"function"==typeof t}function a(t){return null!=t&&"object"==typeof t&&!m(t)}function c(t){return null==t}function l(t){return!!w(t)&&t>0}function y(t){return!!w(t)&&t>=0}function p(t){return!!w(t)&&t<0}function g(t){return null===t}function h(t){return void 0===t}function w(t){return null!=t&&"number"==typeof t}function d(t){return null!=t&&"object"==typeof t}function m(t){return null!==t&&"object"==typeof t&&(t.constructor===Object||void 0===t.constructor)}function b(t){return null!=t&&"function"==typeof t.then}function A(t){return null!=t&&"string"==typeof t}function N(t){return null!=t&&"symbol"==typeof t}function O(t){return ArrayBuffer.isView(t)&&t.constructor!==DataView}function $(t){return t instanceof Int8Array}function E(t){return t instanceof Uint8Array}function v(t){return t instanceof Uint8ClampedArray}function U(t){return t instanceof Int16Array}function S(t){return t instanceof Uint16Array}function x(t){return t instanceof Int32Array}function P(t){return t instanceof Uint32Array}function j(t){return t instanceof Float32Array}function B(t){return t instanceof Float64Array}function I(t){return t instanceof BigInt64Array}function T(t){return t instanceof BigUint64Array}function L(t){return t instanceof ArrayBuffer}var k={assertNumber:M,assertPositive:D,assertNegative:function(t,r){if(!p(t))throw new Error(`${r?'"'+r+'" ':" "}Not Negative: ${t}`)},assertNotNegative:F,assertBoolean:function(t,r){if(!u(t))throw new Error(`${r?'"'+r+'" ':" "}Not Boolean: type=${typeof t} value=${JSON.stringify(t)}`)},assertObject:q,assertPlainObject:function(t,r){if(!m(t))throw new Error(`${r?'"'+r+'" ':" "}Not PlainObject: type=${typeof t} value=${JSON.stringify(t)}`)},assertSymbol:function(t,r){if(!N(t))throw new Error(`${r?'"'+r+'" ':" "}Not Symbol: type=${typeof t} value=${JSON.stringify(t)}`)},assertFunction:R,assertInstance:function(t,r){if(!a(t))throw new Error(`${r?'"'+r+'" ':" "}Not Class Instance: type=${typeof t} value=${JSON.stringify(t)}`)},assertPromise:W,assertNil:function(t,r){if(!c(t))throw new Error(`${r?'"'+r+'" ':" "}Neither Null nor Undefined: type=${typeof t} value=${JSON.stringify(t)}`)},assertNotNil:V,assertNull:function(t,r){if(!g(t))throw new Error(`${r?'"'+r+'" ':" "}Not Null: type=${typeof t} value=${JSON.stringify(t)}`)},assertNotNull:function(t,r){if(g(t))throw new Error((r?'"'+r+'" ':" ")+"Should Not Null")},assertUndefined:function(t,r){if(!h(t))throw new Error(`${r?'"'+r+'" ':" "}Not Undefined: type=${typeof t} value=${JSON.stringify(t)}`)},assertString:C,assertArray:J,assertStringOrSymbol:function(t,r){if(!A(t)&&!N(t))throw new Error(`${r?'"'+r+'" ':" "}Not String or Symbol: type=${typeof t} value=${JSON.stringify(t)}`)},assertInt8Array:function(t,r){if($(t))throw new Error((r?'"'+r+'" ':" ")+"Not Int8Array")},assertUint8Array:function(t,r){if(E(t))throw new Error((r?'"'+r+'" ':" ")+"Not Uint8Array")},assertUint8ClampedArray:function(t,r){if(v(t))throw new Error((r?'"'+r+'" ':" ")+"Not Uint8ClampedArray")},assertInt16Array:function(t,r){if(U(t))throw new Error((r?'"'+r+'" ':" ")+"Not Int16Array")},assertUint16Array:function(t,r){if(S(t))throw new Error((r?'"'+r+'" ':" ")+"Not Uint16Array")},assertInt32Array:function(t,r){if(x(t))throw new Error((r?'"'+r+'" ':" ")+"Not Int32Array")},assertUint32Array:function(t,r){if(P(t))throw new Error((r?'"'+r+'" ':" ")+"Not Uint32Array")},assertFloat32Array:function(t,r){if(j(t))throw new Error((r?'"'+r+'" ':" ")+"Not Float32Array")},assertFloat64Array:function(t,r){if(B(t))throw new Error((r?'"'+r+'" ':" ")+"Not Float64Array")},assertBigInt64Array:function(t,r){if(I(t))throw new Error((r?'"'+r+'" ':" ")+"Not BigInt64Array")},assertBigUint64Array:function(t,r){if(T(t))throw new Error((r?'"'+r+'" ':" ")+"Not BigUint64Array")},assertTypedArray:function(t,r){if(O(t))throw new Error((r?'"'+r+'" ':" ")+"Not TypedArray")},assertArrayBuffer:H};function J(t,r){if(!Array.isArray(t))throw new Error(`${r?'"'+r+'" ':" "}Not Array: type=${typeof t} value=${JSON.stringify(t)}`)}function C(t,r){if(!A(t))throw new Error(`${r?'"'+r+'" ':" "}Not String: type=${typeof t} value=${JSON.stringify(t)}`)}function M(t,r){if(!w(t))throw new Error(`${r?'"'+r+'" ':" "}Not Number: type=${typeof t} value=${JSON.stringify(t)}`)}function D(t,r){if(!l(t))throw new Error(`${r?'"'+r+'" ':" "}Not Positive: ${t}`)}function F(t,r){if(!y(t))throw new Error(`${r?'"'+r+'" ':" "}Not "0 or Positive": ${t}`)}function q(t,r){if(!d(t))throw new Error(`${r?'"'+r+'" ':" "}Not Object: type=${typeof t} value=${JSON.stringify(t)}`)}function R(t,r){if(!f(t))throw new Error(`${r?'"'+r+'" ':" "}Not Function: type=${typeof t} value=${JSON.stringify(t)}`)}function W(t,r){if(!b(t))throw new Error(`${r?'"'+r+'" ':" "}Not Promise: type=${typeof t} value=${JSON.stringify(t)}`)}function V(t,r){if(c(t))throw new Error((r?'"'+r+'" ':" ")+"Should Not Nil")}function H(t,r){if(!L(t))throw new Error((r?'"'+r+'" ':" ")+"Not ArrayBuffer")}var z={isEmpty:_,assertNotEmpty:G,isBlank:K,assertNotBlank:function(t){if(K(t))throw new Error(`Blank String: ${t}`)},capitalize:function(t){if(C(t),0===t.length)return t;const r=t.charAt(0),e=r.toUpperCase();return r===e?t:e+t.slice(1)},decapitalize:function(t){if(C(t),0===t.length)return t;const r=t.charAt(0),e=r.toLowerCase();return r===e?t:e+t.slice(1)},splitWithFixedLength:function(t,r,e=" "){if(C(t),M(r),C(e),0===t.length)return[];if(r<=0)throw new Error("length muse >=0");if(t.length<r)return[t.padEnd(r,e)];const n=[];for(let o=0;o<t.length;o+=r){const i=t.substring(o,o+r);n.push(i.padEnd(r,e))}return n},split:function(t,...r){C(t);if(0===t.length)return[];const e=[...r];0===r.length&&r.push(",");const n=Q(t,...e);if(0===n.length)return[];const o=[];let i="",s=0;for(const{marker:r,index:e}of n)i=t.substring(s,e),o.push(i),s=e+r.length;return i=t.substring(s),o.push(i),o},findMarkerPositions:function(t,...r){if(C(t),0===r.length)throw new Error("At least one marker must be provided");const e=[];for(const n of new Set(r)){if(_(n))continue;C(n);let r=t.indexOf(n);for(;-1!==r;)e.push({marker:n,index:r}),r=t.indexOf(n,r+n.length)}return e.sort((t,r)=>t.index-r.index),e},findMarkerPositionsRegex:Q,substringBefore:function(t,r){if(C(t),C(r),0===t.length||0===r.length)return;const e=t.indexOf(r);if(-1===e)return;return t.substring(0,e)},substringBeforeLast:function(t,r){if(C(t),C(r),0===t.length||0===r.length)return;const e=t.lastIndexOf(r);if(-1===e)return;return t.substring(0,e)},substringAfter:function(t,r){if(C(t),C(r),0===t.length||0===r.length)return;const e=t.indexOf(r);if(-1===e)return;return t.substring(e+r.length)},substringAfterLast:function(t,r){if(C(t),C(r),0===t.length||0===r.length)return;const e=t.lastIndexOf(r);if(-1===e)return;return t.substring(e+r.length)},substringBetween:function(t,r,e){G(t),G(r),G(e);const n=t.indexOf(r);if(-1===n)return;const o=t.indexOf(e,n+r.length);if(-1===o)return;return t.substring(n+r.length,o)},substringBetweenGreedy:function(t,r,e){G(t),G(r),G(e);const n=t.indexOf(r);if(-1===n)return;const o=t.lastIndexOf(e);if(-1===o||o<=n)return;return t.substring(n+r.length,o)},substringsBetween:function(t,r,e){G(t),G(r),G(e);const n=[];let o=0;for(;;){const i=t.indexOf(r,o);if(-1===i)break;const s=t.indexOf(e,i+r.length);if(-1===s)break;n.push(t.substring(i+r.length,s)),o=s+e.length}return n}};function _(t){return null==t||(C(t),0===t.length)}function G(t){if(_(t))throw new Error(`Empty String: ${t}`)}function K(t){return null==t||(C(t),0===t.trim().length)}function Q(t,...r){if(C(t),0===r.length)throw new Error("At least one marker must be provided");const e=[...new Set(r.filter(t=>null!=t))].map(t=>(C(t),t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"))),n=new RegExp(e.map(t=>`(${t})`).join("|"),"g"),o=[];let i=null;for(;null!==(i=n.exec(t));){for(let t=1;t<i.length;t++)if(i[t]){o.push({marker:r[t-1],index:i.index});break}0===i[0].length&&n.lastIndex++}return o}var X={quiet:function(t){R(t);try{const r=t();return b(r)?r.catch(()=>{}):r}catch(t){}},quietKeepError:function(t,r){R(t),J(r);try{const e=t();return b(e)?e.catch(t=>r.push(t)):e}catch(t){r.push(t)}}},Y={defer:Z,delay:function(t,r){w(t)?(r=t,t=Promise.resolve()):null==t&&null==r&&(r=1,t=Promise.resolve());null!=t&&W(t),M(r=r??1e3);const e=Z(),n=Date.now();return t.then((...t)=>{const o=Date.now()-n;o<r?setTimeout(()=>e.resolve(...t),r-o):e.resolve(...t)}).catch(t=>{const o=Date.now()-n;o<r?setTimeout(()=>e.reject(t),r-o):e.reject(t)}),e.promise},timeout:function(t,r,e){W(t),M(r=r??1);const n=Z(r,e),o=Date.now();return t.then((...t)=>{Date.now()-o<=r?n.resolve(...t):n.reject(new Error(e??`Promise Timeout: ${r}ms`))}).catch(t=>{!n.resolved&&!n.rejected&&n.reject(t)}),n.promise},allSettled:tt,returnValuePromised:rt,series:async function(t){J(t);const r=[];for(const e of t)R(e),r.push(await e());return r},seriesAllSettled:async function(t){J(t);const r=[];for(const e of t){R(e);try{r.push({ok:!0,result:await e()})}catch(t){r.push({ok:!1,result:t})}}return r},parallel:async function(t,r=5){if(J(t),M(r),r<=0)throw new Error(`Invalid maxParallel: ${r}, should > 0`);t.forEach(t=>R(t));const e=[];if(t.length<=r){const r=await Promise.all(t.map(t=>rt(t)));return e.push(...r),e}const n=[];for(const o of t)if(R(o),n.push(o),n.length>=r){const t=await Promise.all(n.map(t=>rt(t)));e.push(...t),n.length=0}if(n.length>0&&n.length<r){const t=await Promise.all(n.map(t=>rt(t)));e.push(...t)}return e},parallelAllSettled:async function(t,r=5){if(J(t),M(r),r<=0)throw new Error(`Invalid maxParallel: ${r}, should > 0`);t.forEach(t=>R(t));const e=[];if(t.length<=r){const r=await tt(t.map(t=>rt(t)));return e.push(...r),e}const n=[];for(const o of t)if(R(o),n.push(o),n.length>=r){const t=await tt(n.map(t=>rt(t)));e.push(...t),n.length=0}if(n.length>0&&n.length<r){const t=await tt(n.map(t=>rt(t)));e.push(...t)}return e}};function Z(t=-1,r){M(t);const e={};let n;return t>=0&&(e.timerHandler=n=setTimeout(()=>{clearTimeout(n),e.timerCleared=!0,e.reject(new Error(r??`Promise Timeout: ${t}ms`))},t)),e.promise=new Promise((t,r)=>{e.resolve=r=>{null!=n&&(clearTimeout(n),e.timerCleared=!0),e.resolved=!0,t(r)},e.reject=t=>{null!=n&&(clearTimeout(n),e.timerCleared=!0),e.rejected=!0,r(t)}}),e.promise.cancel=()=>{null!=n&&(clearTimeout(n),e.timerCleared=!0),e.rejected=!0,e.canceled=e.promise.canceled=!0,e.reject(new Error("Cancelled"))},e}async function tt(t){J(t);const r=await Promise.allSettled(t),e=[];for(const t of r)"fulfilled"===t.status&&e.push({ok:!0,result:t.value}),"rejected"===t.status&&e.push({ok:!1,result:t.reason});return e}function rt(t){try{const r=t();return b(r)?r:Promise.resolve(r)}catch(t){return Promise.reject(t)}}const{isPlainObject:et}=i;var nt={proxy:ot,newProxyInstance:function(t,r,e,n=!0){const o=ot(t,e,n);return Reflect.construct(o,r??[])}};function ot(t,r,e=!0){if("function"!=typeof t)throw new TypeError(`Not Class: type=${typeof t}, value=${JSON.stringify(t)}`);if(null!=r){if(!et(r))throw new TypeError(`Not PropertyHandler: type=${typeof r}, value=${JSON.stringify(r)}`);const{get:t,set:e}=r;if(null!=t&&"function"!=typeof t)throw new TypeError(`Not PropertyHandler.get: type=${typeof t}, value=${JSON.stringify(t)}`);if(null!=e&&"function"!=typeof e)throw new TypeError(`Not PropertyHandler.set: type=${typeof e}, value=${JSON.stringify(e)}`)}const n={construct(t,n,o){const i=Reflect.construct(t,n);return new Proxy(e?Object.preventExtensions(i):i,r??{})}};return new Proxy(t,n)}var it={proxy:function(t,r,e=!0){if(c(t)||!d(t)||s(t))throw new TypeError(`Not Object: type=${typeof t}, value=${JSON.stringify(t)}`);return new Proxy(e?Object.preventExtensions(t):t,r??{})}};function st(t){q(t,"obj");const r=new Set;let e=t;for(;e&&e!==Object.prototype;){const n=Object.getOwnPropertyNames(e);for(const e of n)"constructor"!==e&&"function"==typeof t[e]&&r.add(e);e=Object.getPrototypeOf(e)}return[...new Set(r)]}var ut={getMethodsOfClass:function(t){R(t,"cls");const r=new Set;let e=t.prototype;for(;e&&e!==Object.prototype;){const t=Object.getOwnPropertyNames(e);for(const n of t)"constructor"!==n&&"function"==typeof e[n]&&r.add(n);e=Object.getPrototypeOf(e)}return[...new Set(r)]},getStaticMethodsOfClass:function(t){R(t,"cls");const r=new Set;let e=t;for(;e&&e!==Object.getPrototypeOf(Object);){const t=Object.getOwnPropertyNames(e);for(const n of t)"function"==typeof e[n]&&r.add(n);e=Object.getPrototypeOf(e)}return[...r]},getMethods:st,getMethodsOfObject:st},ft={startsWith:function(t,r){V(t,"src"),V(r,"searching");return ct(t.subarray(0,r.length),r)},isSameType:at,equals:ct};function at(t,r){return V(t,"src"),V(r,"target"),e(t)===e(r)}function ct(t,r){if(V(t,"src"),V(r,"target"),!at(t,r))return!1;if(t.byteLength!==r.byteLength)return!1;const e=new DataView(t.buffer,t.byteOffset,t.byteLength),n=new DataView(r.buffer,r.byteOffset,r.byteLength);for(let r=0;r<t.byteLength;r++)if(e.getUint8(r)!==n.getUint8(r))return!1;return!0}var lt={readString:function(t,r=0,e){if(H(t),F(r),r>=t.byteLength)return;let n=null;null!=e?(D(e),n=r+e>=t.byteLength?new Uint8Array(t,r):new Uint8Array(t,r,e)):n=new Uint8Array(t,r);return yt.decode(n)},writeString:function(t,r,e=0){H(t,"buffer"),C(r,"str"),F(e,"offset");const n=pt.encode(r),o=n.byteLength;if(e+o>t.byteLength)throw new Error(`offset + str.byteLength > buffer.byteLength:${e+o} > ${t.byteLength}`);new Uint8Array(t,e,n.byteLength).set(n)},writeArrayBuffer:function(t,r,e=0,n=0,o){H(t),H(r),M(e),M(n);const i=t.byteLength;if(e<-1*i)e=0;else if(e<0)e+=i;else if(e>=i)throw new Error(`Out of target Bounds: targetOffset(${e}) >= targetLength(${i})`);const s=r.byteLength;if(n<-1*s)n=0;else if(n<0)n+=s;else if(n>=s)throw new Error(`Out of data Bounds: dataOffset(${n}) >= dataArrayBufferLength(${s})`);null!=o&&(D(o,"dataLength"),n+o>s&&(o=void 0));const u=new Uint8Array(r,n,o);if(u.byteLength>i-e)throw new Error(`Out of target Bounds: from targetOffset(${e}), No Space to store dataArrayBuffer(${n}, ${o??"NoLimit"})`);new Uint8Array(t).set(u,e)}};const yt=new TextDecoder,pt=new TextEncoder;const gt=1e6;var ht={s2ns:1e9,ms2ns:gt,timestamp64:wt,lapseNano:dt,lapseMillis:mt,timeoutNano:function(t,r){return dt(t)>r},timeoutMillis:function(t,r){return mt(t)>r}};function wt(){if("undefined"!=typeof performance&&"number"==typeof performance.timeOrigin){const t=performance.timeOrigin,r=performance.now();return BigInt((t+r)*gt)}return BigInt(Date.now()*gt)}function dt(t,r){return(r??wt())-t}function mt(t,r){r=r??wt();return BigInt(r-t)/BigInt(gt)}var bt={first:function(t,r){return J(t,"arr"),t[0]??r},last:function(t,r){return J(t,"arr"),t[t.length-1]??r},equals:function(t,r,e){if(!Array.isArray(t)||!Array.isArray(r))return!1;if(t.length!==r.length)return!1;for(let n=0;n<t.length;n++)if(e){if(0!==e(t[n],r[n]))return!1}else if(t[n]!==r[n])return!1;return!0},equalsIgnoreOrder:function(t,r,e){if(!Array.isArray(t)||!Array.isArray(r))return!1;if(t.length!==r.length)return!1;t.sort(e),r.sort(e);for(let n=0;n<t.length;n++)if(e){if(0!==e(t[n],r[n]))return!1}else if(t[n]!==r[n])return!1;return!0}};var At={LangUtils:r,StringUtils:z,TypeUtils:i,TypeAssert:k,ExecUtils:X,PromiseUtils:Y,Lang:r,Type:i,Exec:X,ClassProxyUtils:nt,InstanceProxyUtils:it,ReflectUtils:ut,TypedArrayUtils:ft,ArrayBufferUtils:lt,TimeUtils:ht,ArrayUtils:bt};t.ArrayBufferUtils=lt,t.ArrayUtils=bt,t.ClassProxyUtils=nt,t.Exec=X,t.ExecUtils=X,t.InstanceProxyUtils=it,t.Lang=r,t.LangUtils=r,t.PromiseUtils=Y,t.ReflectUtils=ut,t.StringUtils=z,t.TimeUtils=ht,t.Type=i,t.TypeAssert=k,t.TypeUtils=i,t.TypedArrayUtils=ft,t.default=At,Object.defineProperty(t,"__esModule",{value:!0})});
2
2
  //# sourceMappingURL=index.min.js.map