@devlander/utils
Version:
Comprehensive JavaScript and TypeScript utilities for seamless development. Includes object manipulation, data validation, and more.
1 lines • 52.4 kB
JavaScript
"use strict";var t;exports.AbbreviateNumberSuffix=void 0,(t=exports.AbbreviateNumberSuffix||(exports.AbbreviateNumberSuffix={})).NONE="",t.K="K",t.M="M",t.B="B",t.T="T",t.P="P",t.E="E";function r(t,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))),e.push.apply(e,n)}return e}function e(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?r(Object(n),!0).forEach((function(r){i(t,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))}))}return t}function n(t){var r=function(t,r){if("object"!=typeof t||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,r||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"==typeof r?r:String(r)}function o(t){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o(t)}function i(t,r,e){return(r=n(r))in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}function a(t,r){return function(t){if(Array.isArray(t))return t}(t)||function(t,r){var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=e){var n,o,i,a,u=[],s=!0,f=!1;try{if(i=(e=e.call(t)).next,0===r){if(Object(e)!==e)return;s=!1}else for(;!(s=(n=i.call(e)).done)&&(u.push(n.value),u.length!==r);s=!0);}catch(t){f=!0,o=t}finally{try{if(!s&&null!=e.return&&(a=e.return(),Object(a)!==a))return}finally{if(f)throw o}}return u}}(t,r)||s(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(t){return function(t){if(Array.isArray(t))return f(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||s(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(t,r){if(t){if("string"==typeof t)return f(t,r);var e=Object.prototype.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?f(t,r):void 0}}function f(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e<r;e++)n[e]=t[e];return n}function c(t,r){var e="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=s(t))||r&&t&&"number"==typeof t.length){e&&(t=e);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){e=e.call(t)},n:function(){var t=e.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==e.return||e.return()}finally{if(u)throw i}}}}function l(t,r){"number"==typeof r&&(r=r.toString());for(var e=r.toLowerCase(),n=Object.keys(t),o=n.length;o-- >0;){var i=n[o];if(e===i.toString().toLowerCase())return i}return null}var h=function(t){return"[object Object]"===Object.prototype.toString.call(t)};function p(t,r,n,o){var i=e({},n),a=l(n,r)||r;h(n[a])&&h(t)?n[a]=o(i,r,t):h(t)?n[a]=o({},r,t):Array.isArray(t)?n[a]=t.slice():n[a]=t}var g,d,y;function v(t,r){return function(){for(var e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];return t.apply(r,n)}}exports.SingleItemLabelPrefix=void 0,(g=exports.SingleItemLabelPrefix||(exports.SingleItemLabelPrefix={})).Only="Only",g.Exclusive="Exclusive to",g.Solely="Solely in",exports.MultipleItemsLabelPrefix=void 0,(d=exports.MultipleItemsLabelPrefix||(exports.MultipleItemsLabelPrefix={})).IncludedIn="Included in",d.FoundWithin="Found in",d.PresentIn="Present in",exports.ListConjunction=void 0,(y=exports.ListConjunction||(exports.ListConjunction={})).And="and",y.AsWellAs="as well as",y.AlongWith="along with";var b="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},m=[],w=[],x="undefined"!=typeof Uint8Array?Uint8Array:Array,A=!1;function E(){A=!0;for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=0;r<64;++r)m[r]=t[r],w[t.charCodeAt(r)]=r;w["-".charCodeAt(0)]=62,w["_".charCodeAt(0)]=63}function O(t,r,e){for(var n,o,i=[],a=r;a<e;a+=3)n=(t[a]<<16)+(t[a+1]<<8)+t[a+2],i.push(m[(o=n)>>18&63]+m[o>>12&63]+m[o>>6&63]+m[63&o]);return i.join("")}function S(t){var r;A||E();for(var e=t.length,n=e%3,o="",i=[],a=16383,u=0,s=e-n;u<s;u+=a)i.push(O(t,u,u+a>s?s:u+a));return 1===n?(r=t[e-1],o+=m[r>>2],o+=m[r<<4&63],o+="=="):2===n&&(r=(t[e-2]<<8)+t[e-1],o+=m[r>>10],o+=m[r>>4&63],o+=m[r<<2&63],o+="="),i.push(o),i.join("")}function P(t,r,e,n,o){var i,a,u=8*o-n-1,s=(1<<u)-1,f=s>>1,c=-7,l=e?o-1:0,h=e?-1:1,p=t[r+l];for(l+=h,i=p&(1<<-c)-1,p>>=-c,c+=u;c>0;i=256*i+t[r+l],l+=h,c-=8);for(a=i&(1<<-c)-1,i>>=-c,c+=n;c>0;a=256*a+t[r+l],l+=h,c-=8);if(0===i)i=1-f;else{if(i===s)return a?NaN:1/0*(p?-1:1);a+=Math.pow(2,n),i-=f}return(p?-1:1)*a*Math.pow(2,i-n)}function R(t,r,e,n,o,i){var a,u,s,f=8*i-o-1,c=(1<<f)-1,l=c>>1,h=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:i-1,g=n?1:-1,d=r<0||0===r&&1/r<0?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(u=isNaN(r)?1:0,a=c):(a=Math.floor(Math.log(r)/Math.LN2),r*(s=Math.pow(2,-a))<1&&(a--,s*=2),(r+=a+l>=1?h/s:h*Math.pow(2,1-l))*s>=2&&(a++,s/=2),a+l>=c?(u=0,a=c):a+l>=1?(u=(r*s-1)*Math.pow(2,o),a+=l):(u=r*Math.pow(2,l-1)*Math.pow(2,o),a=0));o>=8;t[e+p]=255&u,p+=g,u/=256,o-=8);for(a=a<<o|u,f+=o;f>0;t[e+p]=255&a,p+=g,a/=256,f-=8);t[e+p-g]|=128*d}var j={}.toString,T=Array.isArray||function(t){return"[object Array]"==j.call(t)};function I(){return L.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function B(t,r){if(I()<r)throw new RangeError("Invalid typed array length");return L.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(r)).__proto__=L.prototype:(null===t&&(t=new L(r)),t.length=r),t}function L(t,r,e){if(!(L.TYPED_ARRAY_SUPPORT||this instanceof L))return new L(t,r,e);if("number"==typeof t){if("string"==typeof r)throw new Error("If encoding is specified then the first argument must be a string");return _(this,t)}return C(this,t,r,e)}function C(t,r,e,n){if("number"==typeof r)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&r instanceof ArrayBuffer?function(t,r,e,n){if(e<0||r.byteLength<e)throw new RangeError("'offset' is out of bounds");if(r.byteLength<e+(n||0))throw new RangeError("'length' is out of bounds");r=void 0===e&&void 0===n?new Uint8Array(r):void 0===n?new Uint8Array(r,e):new Uint8Array(r,e,n);L.TYPED_ARRAY_SUPPORT?(t=r).__proto__=L.prototype:t=M(t,r);return t}(t,r,e,n):"string"==typeof r?function(t,r,e){"string"==typeof e&&""!==e||(e="utf8");if(!L.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var n=0|Y(r,e);t=B(t,n);var o=t.write(r,e);o!==n&&(t=t.slice(0,o));return t}(t,r,e):function(t,r){if(D(r)){var e=0|U(r.length);return 0===(t=B(t,e)).length||r.copy(t,0,0,e),t}if(r){if("undefined"!=typeof ArrayBuffer&&r.buffer instanceof ArrayBuffer||"length"in r)return"number"!=typeof r.length||(n=r.length)!=n?B(t,0):M(t,r);if("Buffer"===r.type&&T(r.data))return M(t,r.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,r)}function N(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function _(t,r){if(N(r),t=B(t,r<0?0:0|U(r)),!L.TYPED_ARRAY_SUPPORT)for(var e=0;e<r;++e)t[e]=0;return t}function M(t,r){var e=r.length<0?0:0|U(r.length);t=B(t,e);for(var n=0;n<e;n+=1)t[n]=255&r[n];return t}function U(t){if(t>=I())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+I().toString(16)+" bytes");return 0|t}function D(t){return!(null==t||!t._isBuffer)}function Y(t,r){if(D(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var e=t.length;if(0===e)return 0;for(var n=!1;;)switch(r){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":case void 0:return ht(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*e;case"hex":return e>>>1;case"base64":return pt(t).length;default:if(n)return ht(t).length;r=(""+r).toLowerCase(),n=!0}}function k(t,r,e){var n=!1;if((void 0===r||r<0)&&(r=0),r>this.length)return"";if((void 0===e||e>this.length)&&(e=this.length),e<=0)return"";if((e>>>=0)<=(r>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return rt(this,r,e);case"utf8":case"utf-8":return q(this,r,e);case"ascii":return Q(this,r,e);case"latin1":case"binary":return tt(this,r,e);case"base64":return Z(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return et(this,r,e);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function F(t,r,e){var n=t[r];t[r]=t[e],t[e]=n}function z(t,r,e,n,o){if(0===t.length)return-1;if("string"==typeof e?(n=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,isNaN(e)&&(e=o?0:t.length-1),e<0&&(e=t.length+e),e>=t.length){if(o)return-1;e=t.length-1}else if(e<0){if(!o)return-1;e=0}if("string"==typeof r&&(r=L.from(r,n)),D(r))return 0===r.length?-1:W(t,r,e,n,o);if("number"==typeof r)return r&=255,L.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,r,e):Uint8Array.prototype.lastIndexOf.call(t,r,e):W(t,[r],e,n,o);throw new TypeError("val must be string, number or Buffer")}function W(t,r,e,n,o){var i,a=1,u=t.length,s=r.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||r.length<2)return-1;a=2,u/=2,s/=2,e/=2}function f(t,r){return 1===a?t[r]:t.readUInt16BE(r*a)}if(o){var c=-1;for(i=e;i<u;i++)if(f(t,i)===f(r,-1===c?0:i-c)){if(-1===c&&(c=i),i-c+1===s)return c*a}else-1!==c&&(i-=i-c),c=-1}else for(e+s>u&&(e=u-s),i=e;i>=0;i--){for(var l=!0,h=0;h<s;h++)if(f(t,i+h)!==f(r,h)){l=!1;break}if(l)return i}return-1}function V(t,r,e,n){e=Number(e)||0;var o=t.length-e;n?(n=Number(n))>o&&(n=o):n=o;var i=r.length;if(i%2!=0)throw new TypeError("Invalid hex string");n>i/2&&(n=i/2);for(var a=0;a<n;++a){var u=parseInt(r.substr(2*a,2),16);if(isNaN(u))return a;t[e+a]=u}return a}function J(t,r,e,n){return gt(ht(r,t.length-e),t,e,n)}function $(t,r,e,n){return gt(function(t){for(var r=[],e=0;e<t.length;++e)r.push(255&t.charCodeAt(e));return r}(r),t,e,n)}function K(t,r,e,n){return $(t,r,e,n)}function H(t,r,e,n){return gt(pt(r),t,e,n)}function G(t,r,e,n){return gt(function(t,r){for(var e,n,o,i=[],a=0;a<t.length&&!((r-=2)<0);++a)n=(e=t.charCodeAt(a))>>8,o=e%256,i.push(o),i.push(n);return i}(r,t.length-e),t,e,n)}function Z(t,r,e){return 0===r&&e===t.length?S(t):S(t.slice(r,e))}function q(t,r,e){e=Math.min(t.length,e);for(var n=[],o=r;o<e;){var i,a,u,s,f=t[o],c=null,l=f>239?4:f>223?3:f>191?2:1;if(o+l<=e)switch(l){case 1:f<128&&(c=f);break;case 2:128==(192&(i=t[o+1]))&&(s=(31&f)<<6|63&i)>127&&(c=s);break;case 3:i=t[o+1],a=t[o+2],128==(192&i)&&128==(192&a)&&(s=(15&f)<<12|(63&i)<<6|63&a)>2047&&(s<55296||s>57343)&&(c=s);break;case 4:i=t[o+1],a=t[o+2],u=t[o+3],128==(192&i)&&128==(192&a)&&128==(192&u)&&(s=(15&f)<<18|(63&i)<<12|(63&a)<<6|63&u)>65535&&s<1114112&&(c=s)}null===c?(c=65533,l=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),o+=l}return function(t){var r=t.length;if(r<=X)return String.fromCharCode.apply(String,t);var e="",n=0;for(;n<r;)e+=String.fromCharCode.apply(String,t.slice(n,n+=X));return e}(n)}L.TYPED_ARRAY_SUPPORT=void 0===b.TYPED_ARRAY_SUPPORT||b.TYPED_ARRAY_SUPPORT,L.poolSize=8192,L._augment=function(t){return t.__proto__=L.prototype,t},L.from=function(t,r,e){return C(null,t,r,e)},L.TYPED_ARRAY_SUPPORT&&(L.prototype.__proto__=Uint8Array.prototype,L.__proto__=Uint8Array),L.alloc=function(t,r,e){return function(t,r,e,n){return N(r),r<=0?B(t,r):void 0!==e?"string"==typeof n?B(t,r).fill(e,n):B(t,r).fill(e):B(t,r)}(null,t,r,e)},L.allocUnsafe=function(t){return _(null,t)},L.allocUnsafeSlow=function(t){return _(null,t)},L.isBuffer=function(t){return null!=t&&(!!t._isBuffer||dt(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&dt(t.slice(0,0))}(t))},L.compare=function(t,r){if(!D(t)||!D(r))throw new TypeError("Arguments must be Buffers");if(t===r)return 0;for(var e=t.length,n=r.length,o=0,i=Math.min(e,n);o<i;++o)if(t[o]!==r[o]){e=t[o],n=r[o];break}return e<n?-1:n<e?1:0},L.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},L.concat=function(t,r){if(!T(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return L.alloc(0);var e;if(void 0===r)for(r=0,e=0;e<t.length;++e)r+=t[e].length;var n=L.allocUnsafe(r),o=0;for(e=0;e<t.length;++e){var i=t[e];if(!D(i))throw new TypeError('"list" argument must be an Array of Buffers');i.copy(n,o),o+=i.length}return n},L.byteLength=Y,L.prototype._isBuffer=!0,L.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;r<t;r+=2)F(this,r,r+1);return this},L.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var r=0;r<t;r+=4)F(this,r,r+3),F(this,r+1,r+2);return this},L.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var r=0;r<t;r+=8)F(this,r,r+7),F(this,r+1,r+6),F(this,r+2,r+5),F(this,r+3,r+4);return this},L.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?q(this,0,t):k.apply(this,arguments)},L.prototype.equals=function(t){if(!D(t))throw new TypeError("Argument must be a Buffer");return this===t||0===L.compare(this,t)},L.prototype.inspect=function(){var t="";return this.length>0&&(t=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(t+=" ... ")),"<Buffer "+t+">"},L.prototype.compare=function(t,r,e,n,o){if(!D(t))throw new TypeError("Argument must be a Buffer");if(void 0===r&&(r=0),void 0===e&&(e=t?t.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),r<0||e>t.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&r>=e)return 0;if(n>=o)return-1;if(r>=e)return 1;if(this===t)return 0;for(var i=(o>>>=0)-(n>>>=0),a=(e>>>=0)-(r>>>=0),u=Math.min(i,a),s=this.slice(n,o),f=t.slice(r,e),c=0;c<u;++c)if(s[c]!==f[c]){i=s[c],a=f[c];break}return i<a?-1:a<i?1:0},L.prototype.includes=function(t,r,e){return-1!==this.indexOf(t,r,e)},L.prototype.indexOf=function(t,r,e){return z(this,t,r,e,!0)},L.prototype.lastIndexOf=function(t,r,e){return z(this,t,r,e,!1)},L.prototype.write=function(t,r,e,n){if(void 0===r)n="utf8",e=this.length,r=0;else if(void 0===e&&"string"==typeof r)n=r,e=this.length,r=0;else{if(!isFinite(r))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");r|=0,isFinite(e)?(e|=0,void 0===n&&(n="utf8")):(n=e,e=void 0)}var o=this.length-r;if((void 0===e||e>o)&&(e=o),t.length>0&&(e<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return V(this,t,r,e);case"utf8":case"utf-8":return J(this,t,r,e);case"ascii":return $(this,t,r,e);case"latin1":case"binary":return K(this,t,r,e);case"base64":return H(this,t,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return G(this,t,r,e);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},L.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var X=4096;function Q(t,r,e){var n="";e=Math.min(t.length,e);for(var o=r;o<e;++o)n+=String.fromCharCode(127&t[o]);return n}function tt(t,r,e){var n="";e=Math.min(t.length,e);for(var o=r;o<e;++o)n+=String.fromCharCode(t[o]);return n}function rt(t,r,e){var n=t.length;(!r||r<0)&&(r=0),(!e||e<0||e>n)&&(e=n);for(var o="",i=r;i<e;++i)o+=lt(t[i]);return o}function et(t,r,e){for(var n=t.slice(r,e),o="",i=0;i<n.length;i+=2)o+=String.fromCharCode(n[i]+256*n[i+1]);return o}function nt(t,r,e){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+r>e)throw new RangeError("Trying to access beyond buffer length")}function ot(t,r,e,n,o,i){if(!D(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>o||r<i)throw new RangeError('"value" argument is out of bounds');if(e+n>t.length)throw new RangeError("Index out of range")}function it(t,r,e,n){r<0&&(r=65535+r+1);for(var o=0,i=Math.min(t.length-e,2);o<i;++o)t[e+o]=(r&255<<8*(n?o:1-o))>>>8*(n?o:1-o)}function at(t,r,e,n){r<0&&(r=4294967295+r+1);for(var o=0,i=Math.min(t.length-e,4);o<i;++o)t[e+o]=r>>>8*(n?o:3-o)&255}function ut(t,r,e,n,o,i){if(e+n>t.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function st(t,r,e,n,o){return o||ut(t,0,e,4),R(t,r,e,n,23,4),e+4}function ft(t,r,e,n,o){return o||ut(t,0,e,8),R(t,r,e,n,52,8),e+8}L.prototype.slice=function(t,r){var e,n=this.length;if((t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(r=void 0===r?n:~~r)<0?(r+=n)<0&&(r=0):r>n&&(r=n),r<t&&(r=t),L.TYPED_ARRAY_SUPPORT)(e=this.subarray(t,r)).__proto__=L.prototype;else{var o=r-t;e=new L(o,void 0);for(var i=0;i<o;++i)e[i]=this[i+t]}return e},L.prototype.readUIntLE=function(t,r,e){t|=0,r|=0,e||nt(t,r,this.length);for(var n=this[t],o=1,i=0;++i<r&&(o*=256);)n+=this[t+i]*o;return n},L.prototype.readUIntBE=function(t,r,e){t|=0,r|=0,e||nt(t,r,this.length);for(var n=this[t+--r],o=1;r>0&&(o*=256);)n+=this[t+--r]*o;return n},L.prototype.readUInt8=function(t,r){return r||nt(t,1,this.length),this[t]},L.prototype.readUInt16LE=function(t,r){return r||nt(t,2,this.length),this[t]|this[t+1]<<8},L.prototype.readUInt16BE=function(t,r){return r||nt(t,2,this.length),this[t]<<8|this[t+1]},L.prototype.readUInt32LE=function(t,r){return r||nt(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},L.prototype.readUInt32BE=function(t,r){return r||nt(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},L.prototype.readIntLE=function(t,r,e){t|=0,r|=0,e||nt(t,r,this.length);for(var n=this[t],o=1,i=0;++i<r&&(o*=256);)n+=this[t+i]*o;return n>=(o*=128)&&(n-=Math.pow(2,8*r)),n},L.prototype.readIntBE=function(t,r,e){t|=0,r|=0,e||nt(t,r,this.length);for(var n=r,o=1,i=this[t+--n];n>0&&(o*=256);)i+=this[t+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*r)),i},L.prototype.readInt8=function(t,r){return r||nt(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},L.prototype.readInt16LE=function(t,r){r||nt(t,2,this.length);var e=this[t]|this[t+1]<<8;return 32768&e?4294901760|e:e},L.prototype.readInt16BE=function(t,r){r||nt(t,2,this.length);var e=this[t+1]|this[t]<<8;return 32768&e?4294901760|e:e},L.prototype.readInt32LE=function(t,r){return r||nt(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},L.prototype.readInt32BE=function(t,r){return r||nt(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},L.prototype.readFloatLE=function(t,r){return r||nt(t,4,this.length),P(this,t,!0,23,4)},L.prototype.readFloatBE=function(t,r){return r||nt(t,4,this.length),P(this,t,!1,23,4)},L.prototype.readDoubleLE=function(t,r){return r||nt(t,8,this.length),P(this,t,!0,52,8)},L.prototype.readDoubleBE=function(t,r){return r||nt(t,8,this.length),P(this,t,!1,52,8)},L.prototype.writeUIntLE=function(t,r,e,n){(t=+t,r|=0,e|=0,n)||ot(this,t,r,e,Math.pow(2,8*e)-1,0);var o=1,i=0;for(this[r]=255&t;++i<e&&(o*=256);)this[r+i]=t/o&255;return r+e},L.prototype.writeUIntBE=function(t,r,e,n){(t=+t,r|=0,e|=0,n)||ot(this,t,r,e,Math.pow(2,8*e)-1,0);var o=e-1,i=1;for(this[r+o]=255&t;--o>=0&&(i*=256);)this[r+o]=t/i&255;return r+e},L.prototype.writeUInt8=function(t,r,e){return t=+t,r|=0,e||ot(this,t,r,1,255,0),L.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[r]=255&t,r+1},L.prototype.writeUInt16LE=function(t,r,e){return t=+t,r|=0,e||ot(this,t,r,2,65535,0),L.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):it(this,t,r,!0),r+2},L.prototype.writeUInt16BE=function(t,r,e){return t=+t,r|=0,e||ot(this,t,r,2,65535,0),L.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):it(this,t,r,!1),r+2},L.prototype.writeUInt32LE=function(t,r,e){return t=+t,r|=0,e||ot(this,t,r,4,4294967295,0),L.TYPED_ARRAY_SUPPORT?(this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=255&t):at(this,t,r,!0),r+4},L.prototype.writeUInt32BE=function(t,r,e){return t=+t,r|=0,e||ot(this,t,r,4,4294967295,0),L.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):at(this,t,r,!1),r+4},L.prototype.writeIntLE=function(t,r,e,n){if(t=+t,r|=0,!n){var o=Math.pow(2,8*e-1);ot(this,t,r,e,o-1,-o)}var i=0,a=1,u=0;for(this[r]=255&t;++i<e&&(a*=256);)t<0&&0===u&&0!==this[r+i-1]&&(u=1),this[r+i]=(t/a>>0)-u&255;return r+e},L.prototype.writeIntBE=function(t,r,e,n){if(t=+t,r|=0,!n){var o=Math.pow(2,8*e-1);ot(this,t,r,e,o-1,-o)}var i=e-1,a=1,u=0;for(this[r+i]=255&t;--i>=0&&(a*=256);)t<0&&0===u&&0!==this[r+i+1]&&(u=1),this[r+i]=(t/a>>0)-u&255;return r+e},L.prototype.writeInt8=function(t,r,e){return t=+t,r|=0,e||ot(this,t,r,1,127,-128),L.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[r]=255&t,r+1},L.prototype.writeInt16LE=function(t,r,e){return t=+t,r|=0,e||ot(this,t,r,2,32767,-32768),L.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):it(this,t,r,!0),r+2},L.prototype.writeInt16BE=function(t,r,e){return t=+t,r|=0,e||ot(this,t,r,2,32767,-32768),L.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):it(this,t,r,!1),r+2},L.prototype.writeInt32LE=function(t,r,e){return t=+t,r|=0,e||ot(this,t,r,4,2147483647,-2147483648),L.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24):at(this,t,r,!0),r+4},L.prototype.writeInt32BE=function(t,r,e){return t=+t,r|=0,e||ot(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),L.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):at(this,t,r,!1),r+4},L.prototype.writeFloatLE=function(t,r,e){return st(this,t,r,!0,e)},L.prototype.writeFloatBE=function(t,r,e){return st(this,t,r,!1,e)},L.prototype.writeDoubleLE=function(t,r,e){return ft(this,t,r,!0,e)},L.prototype.writeDoubleBE=function(t,r,e){return ft(this,t,r,!1,e)},L.prototype.copy=function(t,r,e,n){if(e||(e=0),n||0===n||(n=this.length),r>=t.length&&(r=t.length),r||(r=0),n>0&&n<e&&(n=e),n===e)return 0;if(0===t.length||0===this.length)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(e<0||e>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-r<n-e&&(n=t.length-r+e);var o,i=n-e;if(this===t&&e<r&&r<n)for(o=i-1;o>=0;--o)t[o+r]=this[o+e];else if(i<1e3||!L.TYPED_ARRAY_SUPPORT)for(o=0;o<i;++o)t[o+r]=this[o+e];else Uint8Array.prototype.set.call(t,this.subarray(e,e+i),r);return i},L.prototype.fill=function(t,r,e,n){if("string"==typeof t){if("string"==typeof r?(n=r,r=0,e=this.length):"string"==typeof e&&(n=e,e=this.length),1===t.length){var o=t.charCodeAt(0);o<256&&(t=o)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!L.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof t&&(t&=255);if(r<0||this.length<r||this.length<e)throw new RangeError("Out of range index");if(e<=r)return this;var i;if(r>>>=0,e=void 0===e?this.length:e>>>0,t||(t=0),"number"==typeof t)for(i=r;i<e;++i)this[i]=t;else{var a=D(t)?t:ht(new L(t,n).toString()),u=a.length;for(i=0;i<e-r;++i)this[i+r]=a[i%u]}return this};var ct=/[^+\/0-9A-Za-z-_]/g;function lt(t){return t<16?"0"+t.toString(16):t.toString(16)}function ht(t,r){var e;r=r||1/0;for(var n=t.length,o=null,i=[],a=0;a<n;++a){if((e=t.charCodeAt(a))>55295&&e<57344){if(!o){if(e>56319){(r-=3)>-1&&i.push(239,191,189);continue}if(a+1===n){(r-=3)>-1&&i.push(239,191,189);continue}o=e;continue}if(e<56320){(r-=3)>-1&&i.push(239,191,189),o=e;continue}e=65536+(o-55296<<10|e-56320)}else o&&(r-=3)>-1&&i.push(239,191,189);if(o=null,e<128){if((r-=1)<0)break;i.push(e)}else if(e<2048){if((r-=2)<0)break;i.push(e>>6|192,63&e|128)}else if(e<65536){if((r-=3)<0)break;i.push(e>>12|224,e>>6&63|128,63&e|128)}else{if(!(e<1114112))throw new Error("Invalid code point");if((r-=4)<0)break;i.push(e>>18|240,e>>12&63|128,e>>6&63|128,63&e|128)}}return i}function pt(t){return function(t){var r,e,n,o,i,a;A||E();var u=t.length;if(u%4>0)throw new Error("Invalid string. Length must be a multiple of 4");i="="===t[u-2]?2:"="===t[u-1]?1:0,a=new x(3*u/4-i),n=i>0?u-4:u;var s=0;for(r=0,e=0;r<n;r+=4,e+=3)o=w[t.charCodeAt(r)]<<18|w[t.charCodeAt(r+1)]<<12|w[t.charCodeAt(r+2)]<<6|w[t.charCodeAt(r+3)],a[s++]=o>>16&255,a[s++]=o>>8&255,a[s++]=255&o;return 2===i?(o=w[t.charCodeAt(r)]<<2|w[t.charCodeAt(r+1)]>>4,a[s++]=255&o):1===i&&(o=w[t.charCodeAt(r)]<<10|w[t.charCodeAt(r+1)]<<4|w[t.charCodeAt(r+2)]>>2,a[s++]=o>>8&255,a[s++]=255&o),a}(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(ct,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function gt(t,r,e,n){for(var o=0;o<n&&!(o+e>=r.length||o>=t.length);++o)r[o+e]=t[o];return o}function dt(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}var yt,vt=Object.prototype.toString;exports.DeduplicateInputType=void 0,(yt=exports.DeduplicateInputType||(exports.DeduplicateInputType={})).STRING="string",yt.OBJECT="object",yt.ARRAY="array",yt.NUMBER="number",yt.MATRIX="matrix";function bt(t,r){var e=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).allOwnKeys,n=void 0!==e&&e;if(null!=t)if("object"!==o(t)&&(t=[t]),Array.isArray(t))for(var i=0,a=t.length;i<a;i++)r.call(null,t[i],i,t);else for(var u=n?Object.getOwnPropertyNames(t):Object.keys(t),s=u.length,f=0;f<s;f++){var c=u[f];r.call(null,t[c],c,t)}}var mt=function(t){return function(r){return o(r)===t}};function wt(t){return mt("function")(t)}var xt=["and","to",".","the",",","of","in","for","&","a","an","with","on","at","from","as","by","or","but","into","is","are","was","were","be","being","been","have","has","had","having","do","does","did","doing","will","would","should","can","could","may","might","must","ought","shall","should","there","their","they","them","these","those","this","that","then","than","thus","so","such","if","else","not","no","yes","i","you","he","she","it","we","me","him","her","us","my","your","his","its","our","mine","yours","hers","ours","theirs","who","whom","which","what","when","where","why","how","up","about","into","with","over","before","after","between","among","through","during","above","below","out","off","down","under","again","further","once","here","all","any","both","each","few","more","most","other","some","such","both","each"];var At,Et;exports.RangeOrAmountEnum=void 0,(At=exports.RangeOrAmountEnum||(exports.RangeOrAmountEnum={})).None=" ",At.Range="Range",At.Amount="Amount",exports.PercentagePrefixEnum=void 0,(Et=exports.PercentagePrefixEnum||(exports.PercentagePrefixEnum={})).Empty=" ",Et.UpTo="up to",Et.About="about",Et.Around="around",Et.Approximately="approximately";var Ot,St=function(t,r){var e,n=c(Object.getOwnPropertyNames(t));try{for(n.s();!(e=n.n()).done;){var o=e.value,i=Object.getOwnPropertyDescriptor(t,o);if(i){var a=r(i,o);!1!==a&&Object.defineProperty(t,o,a||i)}}}catch(t){n.e(t)}finally{n.f()}};exports.ProtocolPrefixEnum=void 0,(Ot=exports.ProtocolPrefixEnum||(exports.ProtocolPrefixEnum={})).HTTPS="https://",Ot.HTTP="http://",Ot.NONE="";var Pt;exports.AspectRatioEnum=void 0,(Pt=exports.AspectRatioEnum||(exports.AspectRatioEnum={}))["4:3"]="4:3",Pt["16:9"]="16:9",Pt["1:1"]="1:1",Pt["3:2"]="3:2",Pt["8:5"]="8:5";var Rt=function(t){return null==t||"object"===o(t)&&0===Object.keys(t).length||"string"==typeof t&&0===t.trim().length},jt=function(t,r){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"message";if(!Rt(r)&&Object.prototype.hasOwnProperty.call(r,e)){var n=r[e];if(n&&Array.isArray(n))return n.find((function(r){return r.includes(String(t))}))||null}return null};function Tt(t,r){return r.hasOwnProperty(t)?r[t]:null}var It,Bt,Lt=(It=Object.prototype.hasOwnProperty,function(t,r){return It.call(t,r)}),Ct=mt("undefined"),Nt=(Bt=Object.create(null),function(t){var r=toString.call(t);return Bt[r]||(Bt[r]=r.slice(8,-1).toLowerCase())}),_t=function(t){return t=t.toLowerCase(),function(r){return Nt(r)===t}};var Mt=_t("ArrayBuffer"),Ut="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,Dt=_t("Date");var Yt=_t("File"),kt=function(t){var r=mt("object");return null!==t&&r(t)},Ft=function(t){try{var r="string"==typeof t?t:JSON.stringify(t);return JSON.parse(r)}catch(t){return!1}},zt=mt("number");var Wt=["align-items","align-self","align-content","aspect-ratio","backface-visibility","border-bottom-width","border-end-width","border-left-width","border-right-width","border-start-width","border-top-width","border-width","bottom","color","display","elevation","flex","flex-basis","flex-direction","flex-grow","flex-shrink","flex-wrap","font-family","font-size","font-style","font-weight","height","justify-content","left","letter-spacing","line-height","margin","margin-bottom","margin-end","margin-horizontal","margin-left","margin-right","margin-start","margin-top","margin-vertical","max-height","max-width","min-height","min-width","opacity","overflow","padding","padding-bottom","padding-end","padding-horizontal","padding-left","padding-right","padding-start","padding-top","padding-vertical","position","right","text-align","text-decoration","text-decoration-color","text-decoration-line","text-decoration-style","text-shadow-color","text-shadow-offset","text-shadow-radius","text-transform","top","width","z-index"],Vt=function(t){var r=Ft(t);if(!r)throw new Error("Invalid JSON string.");if("boolean"!=typeof r)return function t(r){for(var e in r){if("string"==typeof r[e]&&r[e].includes("\n"))return!0;if("object"===o(r[e])&&null!==r[e]&&t(r[e]))return!0}return!1}(r);throw new Error("Invalid input: input must be a JSON string or an object.")},Jt={blue:"[34m",green:"[32m",red:"[31m",yellow:"[33m",magenta:"[35m",bgBlue:"[44m",bgGreen:"[42m",bgRed:"[41m",reset:"[0m"},$t=function(t,r,e){var n=Jt[t]||Jt.reset;void 0!==e?console.log("".concat(n,"%s").concat(Jt.reset),r,e):console.log("".concat(n,"%s").concat(Jt.reset),r)},Kt=function(t){$t(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"bgBlue",t)},Ht=function(){console.log("\n==============================================\n")},Gt=function(t,r){for(var e,n=[];null!==(e=t.exec(r));)n.push(e);return n};var Zt=function(t,r){var e={},n=function(t){t.forEach((function(t){e[t]=!0}))};return Array.isArray(t)?n(t):"string"==typeof t&&void 0!==r&&n(String(t).split(r)),console.log(e,"obj"),Object.keys(e).forEach((function(t){t||delete e[t]})),e};var qt=function(t){return t.replace(/\n/g,"")},Xt=function(t){return t.replace(/\s+/g,"")};exports.abbreviateNumber=function(t,r){var e=[exports.AbbreviateNumberSuffix.NONE,exports.AbbreviateNumberSuffix.K,exports.AbbreviateNumberSuffix.M,exports.AbbreviateNumberSuffix.B,exports.AbbreviateNumberSuffix.T,exports.AbbreviateNumberSuffix.P,exports.AbbreviateNumberSuffix.E];if(void 0===t)return"";var n="string"==typeof t?parseFloat(t):t;if(isNaN(n))return"Invalid input";var o=Math.log10(Math.abs(n))/3|0;if(0===o)return n.toString();var i=e[o],a=n/Math.pow(10,3*o);if(null!=r&&r.rounding)switch(r.rounding){case"up":a=Math.ceil(10*a)/10;break;case"down":a=Math.floor(10*a)/10}return"lower"===(null==r?void 0:r.case)?i=i.toLowerCase():"upper"===(null==r?void 0:r.case)&&(i=i.toUpperCase()),a.toFixed(1)+i},exports.arrayToObject=function(t){for(var r={},e=0;e<t.length;e++)r[e.toString()]=t[e];return r},exports.assignValue=p,exports.binaryToHex=function(t){if(!/^[01]+$/.test(t))throw new Error("Invalid binary input");return(t.length%4==0?t:"0".repeat(4-t.length%4)+t).match(/.{1,4}/g).map((function(t){return parseInt(t,2).toString(16)})).join("")},exports.bind=v,exports.calculatePercentage=function(t,r){var e=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if("number"!=typeof t||"number"!=typeof r||0===r)throw new Error("Both inputs must be numbers and 'whole' cannot be zero.");var n=t/r*100;return e?Math.trunc(n):n},exports.composeLabelFromItems=function(t){var r=t.items,e=t.labelKey,n=t.singleItemPrefix,o=void 0===n?exports.SingleItemLabelPrefix.Only:n,i=t.multipleItemsPrefix,a=void 0===i?exports.MultipleItemsLabelPrefix.FoundWithin:i,u=t.conjunctionWord,s=void 0===u?exports.ListConjunction.And:u;if(!r||0===r.length)return"";var f=exports.SingleItemLabelPrefix[o]||o,c=exports.MultipleItemsLabelPrefix[a]||a,l=exports.ListConjunction[s]||s;if(1===r.length)return"".concat(f," ").concat(r[0][e],":");var h=r.map((function(t,n){var o=n===r.length-1,i=t[e];return o?"".concat(l," ").concat(i):i})).join(", ");return"".concat(c," ").concat(h,":")},exports.convertBlobToBase64NativeAsync=function(t){return new Promise((function(r,e){if("undefined"==typeof Blob||!(t instanceof Blob))return e(new Error("The provided value is not a valid Blob."));var n=new FileReader;n.readAsArrayBuffer(t),n.onloadend=function(){var e=n.result,o="data:".concat(t.type,";base64,").concat(L.from(e).toString("base64"));r(o)},n.onerror=function(){e(new Error("Error occurred while reading the Blob."))}}))},exports.convertBlobToBase64WebAsync=function(t){return new Promise((function(r,e){if("undefined"==typeof Blob||!(t instanceof Blob))return e(new Error("The provided value is not a valid Blob."));if("undefined"==typeof FileReader)return e(new Error("FileReader is not available in this environment."));var n=new FileReader;n.readAsDataURL(t),n.onloadend=function(){r(n.result)},n.onerror=function(){e(new Error("Error occurred while reading the Blob."))}}))},exports.convertVideoTimeStampToSeconds=function(t){var r=t.split(":");if(3!==r.length)throw new Error('Invalid timestamp format. Expected format: "HH:MM:SS"');var e=parseInt(r[0],10),n=parseInt(r[1],10),o=parseInt(r[2],10);if(isNaN(e)||isNaN(n)||isNaN(o))throw new Error('Invalid timestamp format. Expected format: "HH:MM:SS"');if(e<0||n<0||o<0)throw new Error("Invalid timestamp. Negative values are not allowed.");return 3600*e+60*n+o},exports.createTransitionalMessage=function(t,r,e){return function(n){var o=n.option,i=n.description,a="[".concat(r," v").concat(t,"] Transitional option '").concat(o,"' ").concat(i);return e?e.replace("{baseMessage}",a):a}},exports.dashToCamelCase=function(t){return t.replace(/^-+/,"").replace(/-+$/,"").toLowerCase().replace(/-([a-z])/g,(function(t,r){return r.toUpperCase()}))},exports.deduplicate=function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:exports.DeduplicateInputType.STRING;return function(){switch(r){case exports.DeduplicateInputType.STRING:case"STRING":if("string"==typeof t)return t.split("").filter((function(t,r,e){return e.indexOf(t)===r})).join("");break;case exports.DeduplicateInputType.ARRAY:case"ARRAY":if(Array.isArray(t))return t.filter((function(t,r,e){return e.indexOf(t)===r}));break;case exports.DeduplicateInputType.OBJECT:case"OBJECT":if("object"===o(t)&&!Array.isArray(t)){var e=new Set,n=Object.entries(t).filter((function(t){var r=a(t,2)[1];return!e.has(r)&&(e.add(r),!0)}));return Object.fromEntries(n)}break;case exports.DeduplicateInputType.NUMBER:case"NUMBER":if("number"==typeof t){var i=t.toString().split("").filter((function(t,r,e){return e.indexOf(t)===r})).join("");return parseInt(i,10)}break;case exports.DeduplicateInputType.MATRIX:case"MATRIX":if(Array.isArray(t)&&t.every(Array.isArray))return t.map((function(t){return Array.from(new Set(t))}))}throw new Error("Unsupported type or input format for: ".concat(r))}()},exports.defaultStopWords=xt,exports.endsWith=function(t,r,e){(void 0===e||e>t.length)&&(e=t.length),e-=r.length;var n=t.indexOf(r,e);return-1!==n&&n===e},exports.ensureValidStyle=function(t){return t.replace(/([a-z-]+)\s+([^;:]+)(;|$)/gi,(function(t,r,e,n){return"".concat(r,": ").concat(e).concat(";"===n?";":"")})).replace(/([^;])\s*$/gm,"$1;")},exports.extend=function(t,r,e){return bt(r,(function(r,n){e&&wt(r)?t[n]=v(r,e):t[n]=r}),{allOwnKeys:(arguments.length>3&&void 0!==arguments[3]?arguments[3]:{}).allOwnKeys}),t},exports.extractKeysAndValues=function(t){return{keys:Object.keys(t),values:Object.values(t)}},exports.filterAndSuggestItems=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:["name"],o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"_id",i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:xt,a=[];if(!t.trim()||!r.length)return a;var u=t.toLowerCase().split(" ").filter((function(t){return t&&!i.includes(t)}));if(0===u.length)return a;var s,f=new Set(Array.isArray(e)?e.map(String):[String(e)]),l=c(r);try{var h=function(){var t=s.value,r=String(t[o]);if(f.has(r))return 1;n.some((function(r){var e=t[r];if(!e||"string"!=typeof e)return!1;var n=e.toLowerCase().split(" ").filter((function(t){return!i.includes(t)}));return u.every((function(t){return n.includes(t)}))}))&&a.push(t)};for(l.s();!(s=l.n()).done;)h()}catch(t){l.e(t)}finally{l.f()}return a},exports.findKey=l,exports.forEach=bt,exports.forEachEntry=function(t,r){if(!t||"function"!=typeof t[Symbol.iterator])throw new TypeError("Object is not iterable");for(var e,n=t[Symbol.iterator]();!(e=n.next()).done;){var o=a(e.value,2),i=o[0],u=o[1];r.call(t,i,u)}},exports.formatRangeOrPercentage=function(t){var r=t.details,e=void 0===r?"":r,n=t.formatAsRangeOrAmount,o=void 0===n?exports.RangeOrAmountEnum.None:n,i=t.percentagePrefix,a=void 0===i?exports.PercentagePrefixEnum.Empty:i,u=t.percentageSuffix,s=void 0===u?"":u,f=t.percent,c=void 0===f?0:f,l=t.minPercent,h=void 0===l?0:l,p=t.maxPercent,g=void 0===p?0:p,d=function(t,r,e){return""!==t.trim()||""!==r.trim()||e===exports.RangeOrAmountEnum.Range||e===exports.RangeOrAmountEnum.Amount}(a,s,o),y=o===exports.RangeOrAmountEnum.Amount?"".concat(c,"%"):o===exports.RangeOrAmountEnum.Range?"".concat(h," - ").concat(g).concat(s.includes("%")?"":"%"):"",v="";return o===exports.RangeOrAmountEnum.Range?v="".concat(d?"(":"").concat(a.trim()?"".concat(a," "):"").concat(y).concat(s.trim()?s:"").concat(d?")":""," ").concat(e.trim()):o===exports.RangeOrAmountEnum.Amount?v="(".concat(a.trim()?"".concat(a," "):"").concat(c,"%").concat(s.trim()?" ".concat(s):"",") ").concat(e.trim()):o===exports.RangeOrAmountEnum.None&&(v=e.trim()),v},exports.freezeMethods=function(t){St(t,(function(r,e){return(!wt(t)||!["arguments","caller","callee"].includes(e))&&(wt(t[e])?(r.enumerable=!1,"writable"in r?r.writable=!1:r.set||(r.set=function(){throw new Error("Cannot rewrite read-only method '".concat(e,"'"))}),r):void 0)}))},exports.generateAllowedOrigins=function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Object.values(exports.ProtocolPrefixEnum),e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{includeWww:!0,validateDomains:!0},n=new Set;return t.forEach((function(t){var o=function(t){return t.replace(/^(https?:\/\/)?(www\.)?/,"").toLowerCase()}(t);!e.validateDomains||function(t){return/^(localhost(:\d+)?|([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.[a-zA-Z]{2,})$/.test(t)}(o)?(r.forEach((function(t){if(!Object.values(exports.ProtocolPrefixEnum).includes(t))throw new Error("Invalid prefix: ".concat(t));n.add("".concat(t).concat(o)),e.includeWww&&!o.startsWith("localhost")&&n.add("".concat(t,"www.").concat(o))})),n.add(o),e.includeWww&&!o.startsWith("localhost")&&n.add("www.".concat(o))):console.warn("Skipping invalid domain: ".concat(t))})),Array.from(n)},exports.generateStripeCard=function(){var t=[{brand:"Visa",number:"4242 4242 4242 4242",cvcLength:3},{brand:"Visa (debit)",number:"4000 0566 5566 5556",cvcLength:3},{brand:"Mastercard",number:"5555 5555 5555 4444",cvcLength:3},{brand:"Mastercard (2-series)",number:"2223 0031 2200 3222",cvcLength:3},{brand:"Mastercard (debit)",number:"5200 8282 8282 8210",cvcLength:3},{brand:"Mastercard (prepaid)",number:"5105 1051 0510 5100",cvcLength:3},{brand:"American Express",number:"3782 822463 10005",cvcLength:4},{brand:"American Express",number:"3714 496353 98431",cvcLength:4},{brand:"Discover",number:"6011 1111 1111 1117",cvcLength:3},{brand:"Discover",number:"6011 0009 9013 9424",cvcLength:3},{brand:"Discover (debit)",number:"6011 9811 1111 1113",cvcLength:3},{brand:"Diners Club",number:"3056 9300 0902 0004",cvcLength:3},{brand:"Diners Club (14-digit card)",number:"3622 720627 1667",cvcLength:3},{brand:"BCcard and DinaCard",number:"6555 9000 0060 4105",cvcLength:3},{brand:"JCB",number:"3566 0020 2036 0505",cvcLength:3},{brand:"UnionPay",number:"6200 0000 0000 0005",cvcLength:3},{brand:"UnionPay (debit)",number:"6200 0000 0000 0047",cvcLength:3},{brand:"UnionPay (19-digit card)",number:"6205 5000 0000 0000 004",cvcLength:3}],r=t[Math.floor(Math.random()*t.length)],e=Array.from({length:r.cvcLength},(function(){return Math.floor(10*Math.random())})).join(""),n=(new Date).getFullYear()+Math.floor(5*Math.random())+1,o=Math.floor(12*Math.random())+1,i="".concat(o.toString().padStart(2,"0"),"/").concat(n);return{brand:r.brand,number:r.number,cvv:e,expirationDate:i}},exports.getAspectRatio=function(t){var r,e=t.width,n=t.orientation,o=void 0===n?"landscape":n,i=t.aspectRatio||exports.AspectRatioEnum["16:9"],u=(null===(r=exports.AspectRatioEnum[i])||void 0===r?void 0:r.split(":").map(Number))||[16,9];switch(i){case"4:3":u=[4,3];break;case"16:9":default:u=[16,9];break;case"1:1":u=[1,1];break;case"3:2":u=[3,2];break;case"8:5":u=[8,5]}var s,f=a(u,2),c=f[0],l=f[1];return s="landscape"===o?e/(c/l):e*(l/c),{width:e,height:Math.round(s)}},exports.getAverage=function(t){if(!Array.isArray(t)||0===t.length)throw new Error("Input must be a non-empty array of numbers.");if(!t.every((function(t){return"number"==typeof t&&!isNaN(t)})))throw new Error("All elements in the array must be valid numbers.");return t.reduce((function(t,r){return t+r}),0)/t.length},exports.getFirstWordCapitalized=function(t){try{var r=t.trim().split(" ");if(0===r.length||""===r[0])return"";if(r&&r.length>1&&r[0]){var e=r[0];return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}return""}catch(t){throw new Error(String(t))}},exports.getMessageByField=function(t,r){var e=function(t){if(!Rt(r)&&Tt(t,r)){var e=Tt(t,r);if("string"==typeof e)return e}else if(!Rt(r)){var n=jt(t,r);if(n)return n}};if("string"==typeof t)return e(t)||void 0;if(Array.isArray(t)){var n,o=c(t);try{for(o.s();!(n=o.n()).done;){var i=e(n.value);if(i)return i}}catch(t){o.e(t)}finally{o.f()}}else;},exports.getMessageFromObject=jt,exports.getRandomValFromArray=function(t,r){var e;return 0===t.length?r:null!==(e=t[Math.floor(Math.random()*t.length)])&&void 0!==e?e:r},exports.getRange=function(t,r){return r<0?[]:Array.apply(0,Array(r)).map((function(r,e){return e+t}))},exports.getUniqueObjects=function(t,r){return t.map((function(t){return t[r]})).filter((function(t,r,e){return e.indexOf(t)===r})).map((function(r,e){return t[e]}))},exports.getValueFromObject=Tt,exports.hasItemByLetterAndFilter=function(t,r){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"name",n=arguments.length>3?arguments[3]:void 0,o=arguments.length>4?arguments[4]:void 0;return r.some((function(r){if(1!==t.length)throw new Error("Letter must be a single character.");var i=r[e]||null;if(!i)return!1;var a=function(t){return!o||[o,o.toLowerCase()].every((function(r){return t.includes(r)}))}(i),u=function(r){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return void 0===e&&(e=0),[r,r.toLowerCase()].some((function(r){return r.charAt(e)===t}))}(i,n);return!(!a||!u)}))},exports.hasOwnProp=Lt,exports.isArrayBuffer=Mt,exports.isArrayBufferView=function(t){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&Mt(t.buffer)},exports.isBoolean=function(t){return!0===t||!1===t},exports.isBuffer=function(t){return null!==t&&!Ct(t)&&null!==t.constructor&&!Ct(t.constructor)&&wt(t.constructor.isBuffer)&&t.constructor.isBuffer(t)},exports.isContextDefined=function(t){return!Ct(t)&&t!==Ut},exports.isDate=Dt,exports.isDeepEqual=function t(r,e){if(r===e)return!0;if("object"!==o(r)||null===r||"object"!==o(e)||null===e)return!1;var n=Object.keys(r),i=Object.keys(e);if(n.length!==i.length)return!1;for(var a=0,u=n;a<u.length;a++){var s=u[a];if(!i.includes(s)||!t(r[s],e[s]))return!1}return!0},exports.isEmpty=Rt,exports.isFile=Yt,exports.isFormData=function(t){var r;return!!t&&("function"==typeof FormData&&t instanceof FormData||kt(t)&&Object.prototype.hasOwnProperty.call(t,"append")&&wt(t.append)&&("formdata"===(r=Nt(t))||"object"===r&&wt(t.toString)&&"[object FormData]"===t.toString()))},exports.isFunction=wt,exports.isGlobalDefined=Ut,exports.isJson=Ft,exports.isNumber=zt,exports.isNumeric=function(t){return"string"==typeof t?""!==t.trim()&&t.trim()===t&&(!isNaN(Number(t))&&isFinite(Number(t))):"number"==typeof t?!isNaN(t)&&isFinite(t):zt(t)},exports.isObject=kt,exports.isPlainObject=h,exports.isRegExp=function(t){return _t("RegExp")(t)},exports.isString=function(t){return mt("string")(t)},exports.isUndefined=Ct,exports.isValidBinary=function(t){return/^[01]+$/.test(t)},exports.isValidBlob=function(t){return"undefined"!=typeof Blob&&t instanceof Blob&&"[object Blob]"===vt.call(t)},exports.isValidStyle=function(t,r){var e=[].concat(u(Wt),u(r||[])),n=new Set(e.map((function(t){return t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()})));if(!(t=t.trim()))return!1;var o=t.split(";").filter((function(t){return t.trim()}));if(t&&!t.endsWith(";"))return!1;var i,s=c(o);try{for(s.s();!(i=s.n()).done;){var f=i.value.split(":").map((function(t){return t.trim()}));if(2!==f.length)return!1;var l=a(f,2),h=l[0],p=l[1];if(!n.has(h)||!p)return!1}}catch(t){s.e(t)}finally{s.f()}return!0},exports.jsonContainsNewLine=Vt,exports.kindOf=Nt,exports.kindOfTest=_t,exports.log=$t,exports.logCondition=function(t,r){$t(r?"green":"red",t)},exports.logEnd=function(t,r){Ht();var e=r?" (".concat(r,")"):"";$t("blue","==== END: ".concat(t).concat(e," ====")),Ht()},exports.logError=function(t,r){var e="string"==typeof r?r:JSON.stringify(r,null,2);Kt("Error in ".concat(t,": ").concat(e),"red")},exports.logFunction=function(t,r,e){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"bgBlue",i="object"===o(r)?JSON.stringify(r,null,2):String(r),a="Function: ".concat(t," ").concat(e?"- ".concat(e):""," | Variables: ").concat(i);$t(n,a)},exports.logMessage=Kt,exports.logSeparator=Ht,exports.logStart=function(t,r){Ht();var e=r?" (".concat(r,")"):"";$t("blue","==== START: ".concat(t).concat(e," ====")),Ht()},exports.matchAll=Gt,exports.merge=function t(){for(var r={},e=function(e,n){p(e,n,r,t)},n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];for(var a=0,u=o;a<u.length;a++){var s=u[a];s&&bt(s,e)}return r},exports.mergeObjects=function t(r,n){var i=e({},r);return Object.keys(n).forEach((function(r){var e=n[r],a=i[r];Array.isArray(e)&&Array.isArray(a)?i[r]=[].concat(u(a),u(e)):"object"!==o(e)||null===e||Array.isArray(e)||"object"!==o(a)||Array.isArray(a)?i[r]=e:i[r]=t(a,e)})),i},exports.parseHeaders=function(t){var r={},e=Zt(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);return null==t||t.split("\n").forEach((function(t){var n=t.indexOf(":"),o=t.substring(0,n).trim().toLowerCase(),i=t.substring(n+1).trim();!o||r[o]&&e[o]||(r[o]="set-cookie"===o?r[o]?[].concat(u(r[o]),[i]):[i]:r[o]?"".concat(r[o],", ").concat(i):i)})),r},exports.parsePropPath=function(t){var r,e=[],n=c(Gt(/\w+|\[(\w*)]/g,t));try{for(n.s();!(r=n.n()).done;){var o=a(r.value,2),i=o[0],u=o[1]||i;e.push(u)}}catch(t){n.e(t)}finally{n.f()}return e},exports.parseQueryString=function(t){return t.startsWith("?")&&(t=t.substring(1)),t.split("&").reduce((function(t,r){var e=a(r.split("=").map(decodeURIComponent),2),n=e[0],o=e[1];if(!n)return t;if(n in t){var i=t[n];Array.isArray(i)?i.push(o):t[n]=[i,o]}else t[n]=o;return t}),{})},exports.pluralize=function(t,r,e){return 1===t?r:e},exports.reduceDescriptors=St,exports.removeNewLinesFromJson=function(t){var r=Ft(t);if(!r||"object"!==o(r)||null===r)throw new Error("Invalid JSON input.");var e=Vt(r)?function t(r){var e=Array.isArray(r)?[]:{};return Object.keys(r).forEach((function(n){var i=r[n];"string"==typeof i?Array.isArray(e)||(e[n]=qt(i)):"object"===o(i)&&null!==i?Array.isArray(e)||(e[n]=t(i)):Array.isArray(e)||(e[n]=i)})),e}(r):r;return e},exports.removeNewLinesFromString=qt,exports.removeSpacesFromJson=function(t){var r=Ft(t);if(!1===r||"object"!==o(r)||null===r)throw new Error("Invalid JSON input.");return function t(r){var e=Array.isArray(r)?[]:{};return Object.keys(r).forEach((function(n){var i=r[n];"string"==typeof i?Array.isArray(e)||(e[n]=Xt(i)):"object"===o(i)&&null!==i?Array.isArr