es-toolkit 1.13.1-dev.344 → 1.13.1-dev.346

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.
Files changed (41) hide show
  1. package/dist/browser.global.js +1 -1
  2. package/dist/browser.global.js.map +1 -1
  3. package/dist/compat/index.d.mts +4 -1
  4. package/dist/compat/index.d.ts +4 -1
  5. package/dist/compat/index.js +3 -0
  6. package/dist/compat/index.js.map +1 -1
  7. package/dist/compat/index.mjs +4 -1
  8. package/dist/compat/index.mjs.map +1 -1
  9. package/dist/function/before.d.mts +31 -0
  10. package/dist/function/before.d.ts +31 -0
  11. package/dist/function/before.mjs +15 -0
  12. package/dist/function/before.mjs.map +1 -0
  13. package/dist/function/index.d.mts +1 -0
  14. package/dist/function/index.d.ts +1 -0
  15. package/dist/function/index.js +14 -0
  16. package/dist/function/index.js.map +1 -1
  17. package/dist/function/index.mjs +1 -0
  18. package/dist/function/index.mjs.map +1 -1
  19. package/dist/index.d.mts +4 -1
  20. package/dist/index.d.ts +4 -1
  21. package/dist/index.js +3 -0
  22. package/dist/index.js.map +1 -1
  23. package/dist/index.mjs +4 -1
  24. package/dist/index.mjs.map +1 -1
  25. package/dist/object/cloneDeep.mjs +1 -2
  26. package/dist/object/cloneDeep.mjs.map +1 -1
  27. package/dist/object/index.d.mts +3 -1
  28. package/dist/object/index.d.ts +3 -1
  29. package/dist/object/index.js +50 -27
  30. package/dist/object/index.js.map +1 -1
  31. package/dist/object/index.mjs +3 -1
  32. package/dist/object/index.mjs.map +1 -1
  33. package/dist/object/mapKeys.d.mts +21 -0
  34. package/dist/object/mapKeys.d.ts +21 -0
  35. package/dist/object/mapKeys.mjs +13 -0
  36. package/dist/object/mapKeys.mjs.map +1 -0
  37. package/dist/object/mapValues.d.mts +21 -0
  38. package/dist/object/mapValues.d.ts +21 -0
  39. package/dist/object/mapValues.mjs +13 -0
  40. package/dist/object/mapValues.mjs.map +1 -0
  41. package/package.json +1 -1
@@ -1,2 +1,2 @@
1
- var _=function(t){"use strict";function n(t,n){const e=new Set(n);return t.filter((t=>!e.has(t)))}function e(t,n,e){const r=new Set(n.map((t=>e(t))));return t.filter((t=>!r.has(e(t))))}function r(t,n,e){return t.filter((t=>n.every((n=>!e(t,n)))))}function o(t,n=1){const e=[],r=Math.floor(n),o=(t,n)=>{for(const i of t)Array.isArray(i)&&n<r?o(i,n+1):e.push(i)};return o(t,0),e}function i(t,n){const e=new Set(n);return t.filter((t=>e.has(t)))}function u(t,n,e){const r=new Set(n.map(e));return t.filter((t=>r.has(e(t))))}function c(t,n,e){return t.filter((t=>n.some((n=>e(t,n)))))}function f(t,n){if(null==n&&(n=t,t=0),t>=n)throw new Error("Invalid input: The maximum value must be greater than the minimum value.");return Math.random()*(n-t)+t}function s(t,n){return Math.floor(f(t,n))}function a(t){return Array.from(new Set(t))}function l(t,n){return a(t.concat(n))}function h(t,n,e){const r=new Map;for(const o of[...t,...n]){const t=e(o);r.has(t)||r.set(t,o)}return Array.from(r.values())}function g(t,n){const e=[];for(const r of t){e.every((t=>!n(t,r)))&&e.push(r)}return e}function y(t,n,e){return g(t.concat(n),e)}function p(...t){const n=[],e=Math.max(...t.map((t=>t.length)));for(let r=0;r<e;r++){const e=[];for(const n of t)e.push(n[r]);n.push(e)}return n}function m(t){return t[0]}class b extends Error{constructor(t="The operation was aborted"){super(t),this.name="AbortError"}}class w extends Error{constructor(t="The operation was timed out"){super(t),this.name="TimeoutError"}}function A(t){let n=0;for(let e=0;e<t.length;e++)n+=t[e];return n}function d(t){return A(t)/t.length}function j(t){if(null==(n=t)||"object"!=typeof n&&"function"!=typeof n)return t;var n;if(Array.isArray(t))return t.map((t=>j(t)));if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp)return new RegExp(t.source,t.flags);if(t instanceof Map){const n=new Map;for(const[e,r]of t.entries())n.set(e,j(r));return n}if(t instanceof Set){const n=new Set;for(const e of t.values())n.add(j(e));return n}if(function(t){return t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Uint16Array||t instanceof Uint32Array||t instanceof BigUint64Array||t instanceof Int8Array||t instanceof Int16Array||t instanceof Int32Array||t instanceof BigInt64Array||t instanceof Float32Array||t instanceof Float64Array}(t)){const n=new(Object.getPrototypeOf(t).constructor)(t.length);for(let e=0;e<t.length;e++)n[e]=j(t[e]);return n}if(t instanceof ArrayBuffer||"undefined"!=typeof SharedArrayBuffer&&t instanceof SharedArrayBuffer)return t.slice(0);if(t instanceof DataView){const n=new DataView(t.buffer.slice(0));return O(t,n),n}if("undefined"!=typeof File&&t instanceof File){const n=new File([t],t.name,{type:t.type});return O(t,n),n}if(t instanceof Blob){const n=new Blob([t],{type:t.type});return O(t,n),n}if(t instanceof Error){const n=new t.constructor;return n.message=t.message,n.name=t.name,n.stack=t.stack,n.cause=t.cause,O(t,n),n}if("object"==typeof t&&null!==t){const n={};return O(t,n),n}return t}function O(t,n){const e=Object.keys(t);for(let r=0;r<e.length;r++){const o=e[r],i=Object.getOwnPropertyDescriptor(t,o);(i?.writable||i?.set)&&(n[o]=j(t[o]))}}function M(t){if("object"!=typeof t)return!1;if(null==t)return!1;if(null===Object.getPrototypeOf(t))return!0;if("[object Object]"!==t.toString())return!1;let n=t;for(;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return Object.getPrototypeOf(t)===n}function x(t,n=""){const e={},r=Object.keys(t);for(let o=0;o<r.length;o++){const i=r[o],u=t[i],c=n?`${n}.${i}`:i;if(M(u)&&Object.keys(u).length>0)Object.assign(e,x(u,c));else if(Array.isArray(u))for(let t=0;t<u.length;t++)e[`${c}.${t}`]=u[t];else e[c]=u}return e}function E(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=Number.MAX_SAFE_INTEGER}function S(t){return null==t||"object"!=typeof t&&"function"!=typeof t}function v(t,{signal:n}={}){return new Promise(((e,r)=>{const o=()=>{r(new b)};if(n?.aborted)return o();const i=setTimeout(e,t);n?.addEventListener("abort",(()=>{clearTimeout(i),o()}),{once:!0})}))}async function B(t){throw await v(t),new w}const T=t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase(),k=/[A-Z]?[a-z]+|[0-9]+|[A-Z]+(?![a-z])/g;function I(t){return Array.from(t.match(k)??[])}const P=/^(?:0|[1-9]\d*)$/;function z(t){switch(typeof t){case"number":return Number.isInteger(t)&&t>=0&&t<Number.MAX_SAFE_INTEGER;case"symbol":return!1;case"string":return P.test(t)}}function C(t){const n=/\\(\\)?/g,e=RegExp("[^.[\\]]+|\\[(?:([^\"'][^[]*)|([\"'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))","g"),r=[];let o;"."===t[0]&&r.push("");let i=0;for(;null!==(o=e.exec(t));){let t=o[0];const u=o[1],c=o[2],f=o[3];c?t=f.replace(n,"$1"):u&&(t=u),r.push(t),e.lastIndex===i?e.lastIndex++:i=e.lastIndex}return r}function R(t,n,e){const r=Array.isArray(n)?n:"string"==typeof n?C(n):[n];let o=t;for(let t=0;t<r.length-1;t++){const n=r[t],e=r[t+1];null==o[n]&&(o[n]=z(e)?[]:{}),o=o[n]}return o[r[r.length-1]]=e,t}const W=/^\w*$/,D=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/;function U(t,n){if(0===n.length)return!0;if(!Array.isArray(t))return!1;const e=new Set;for(let r=0;r<n.length;r++){const o=n[r],i=t.findIndex(((t,n)=>N(t,o)&&!e.has(n)));if(-1===i)return!1;e.add(i)}return!0}function N(t,n){if(n===t)return!0;switch(typeof n){case"object":{if(null==n)return!0;n=n??{};const e=Object.keys(n);if(null==t)return 0===e.length;if(Array.isArray(n))return U(t,n);if(n instanceof Map)return function(t,n){if(0===n.size)return!0;if(!(t instanceof Map))return!1;for(const[e,r]of n.entries())if(!N(t.get(e),r))return!1;return!0}(t,n);if(n instanceof Set)return function(t,n){return 0===n.size||t instanceof Set&&U([...t],[...n])}(t,n);for(let r=0;r<e.length;r++){const o=e[r];if(!S(t)&&!(o in t))return!1;if(void 0===n[o]&&void 0!==t[o])return!1;if(!N(t[o],n[o]))return!1}return!0}case"function":return Object.keys(n).length>0&&N(t,{...n});default:return!n}}return t.AbortError=b,t.TimeoutError=w,t.after=(t,n)=>{if(!Number.isInteger(t)||t<0)throw new Error("n must be a non-negative integer.");let e=0;return(...r)=>{if(++e>=t)return n(...r)}},t.camelCase=function(t){const n=I(t);if(0===n.length)return"";const[e,...r]=n;return`${e.toLowerCase()}${r.map((t=>T(t))).join("")}`},t.capitalize=T,t.chunk=function(t,n=1){return 0===(n=Math.max(Math.floor(n),0))?[]:function(t,n){if(!Number.isInteger(n)||n<=0)throw new Error("Size must be an integer greater than zero.");const e=Math.ceil(t.length/n),r=Array(e);for(let o=0;o<e;o++){const e=o*n,i=e+n;r[o]=t.slice(e,i)}return r}(t,n)},t.clamp=function(t,n,e){return null==e?Math.min(t,n):Math.min(Math.max(t,n),e)},t.clone=function(t){if(null==(n=t)||"object"!=typeof n&&"function"!=typeof n)return t;var n;if(Array.isArray(t))return t.slice();if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp)return new RegExp(t.source,t.flags);if(t instanceof Map){const n=new Map;for(const[e,r]of t)n.set(e,r);return n}if(t instanceof Set){const n=new Set;for(const e of t)n.add(e);return n}if("object"==typeof t){const n=Object.getPrototypeOf(t),e=Object.create(n);return Object.assign(e,t)}return t},t.cloneDeep=j,t.compact=function(t){const n=[];for(const e of t)e&&n.push(e);return n},t.concat=function(...t){return o(t)},t.countBy=function(t,n){const e={};for(const r of t){const t=n(r);e[t]=(e[t]??0)+1}return e},t.debounce=function(t,n,{signal:e}={}){let r=null;const o=function(...o){null!==r&&clearTimeout(r),e?.aborted||(r=setTimeout((()=>{t(...o),r=null}),n))};return o.cancel=function(){null!==r&&(clearTimeout(r),r=null)},e?.addEventListener("abort",(function(){o.cancel()}),{once:!0}),o},t.delay=v,t.difference=function(t,...e){return n(t,o(e))},t.differenceBy=e,t.differenceWith=r,t.drop=function(t,n){return n=Math.max(n,0),t.slice(n)},t.dropRight=function(t,n){return 0===(n=Math.min(-n,0))?t.slice():t.slice(0,n)},t.dropRightWhile=function(t,n){for(let e=t.length-1;e>=0;e--)if(!n(t[e]))return t.slice(0,e+1);return[]},t.dropWhile=function(t,n){const e=t.findIndex((t=>!n(t)));return-1===e?[]:t.slice(e)},t.endsWith=(t,n,e=t.length)=>t.endsWith(n,e),t.fill=function(t,n,e=0,r=t.length){return(e=Math.floor(e))||(e=0),(r=Math.floor(r))||(r=0),function(t,n,e=0,r=t.length){const o=t.length,i=Math.max(e>=0?e:o+e,0),u=Math.min(r>=0?r:o+r,o);for(let e=i;e<u;e++)t[e]=n;return t}(t,n,e,r)},t.first=m,t.flatMap=function(t,n,e=1){return o(t.map((t=>n(t))),e)},t.flatten=o,t.flattenDeep=function(t){return o(t,1/0)},t.flattenObject=function(t){return x(t)},t.forEachRight=function(t,n){for(let e=t.length-1;e>=0;e--){n(t[e],e,t)}},t.get=function(t,n,e){let r;if(r=Array.isArray(n)?n:"string"==typeof n&&function(t){switch(typeof t){case"number":case"symbol":return!1;case"string":return!W.test(t)&&D.test(t)}}(n)&&null==t?.[n]?C(n):[n],0===r.length)return e;let o,i=t;for(o=0;o<r.length&&null!=i;o++){let t=r[o];Object.is(t.valueOf(),-0)&&(t="-0"),i=i[t]}return null===i&&o===r.length?i:i??e},t.groupBy=function(t,n){const e={};for(const r of t){const t=n(r);null==e[t]&&(e[t]=[]),e[t].push(r)}return e},t.head=m,t.inRange=function(t,n,e){if(null==e&&(e=n,n=0),n>=e)throw new Error("The maximum value must be greater than the minimum value.");return n<=t&&t<e},t.initial=function(t){return t.length<=1?[]:t.slice(0,-1)},t.intersection=i,t.intersectionBy=u,t.intersectionWith=c,t.invert=function(t){const n={},e=Object.keys(t);for(let r=0;r<e.length;r++){const o=e[r];n[t[o]]=o}return n},t.isArray=function(t){return Array.isArray(t)},t.isArrayLike=function(t){return null!=t&&"function"!=typeof t&&E(t.length)},t.isEqual=function t(n,e){if(Object.is(n,e))return!0;if(n instanceof Date&&e instanceof Date)return n.getTime()===e.getTime();if(n instanceof RegExp&&e instanceof RegExp)return n.source===e.source&&n.flags===e.flags;if("object"!=typeof n||"object"!=typeof e||null===n||null===e)return!1;const r=Object.keys(n),o=Object.keys(e);if(r.length!==o.length)return!1;if(l(r,o).length!==r.length)return!1;for(let o=0;o<r.length;o++){const i=r[o];if(!t(n[i],e[i]))return!1}return!0},t.isFunction=function(t){return"function"==typeof t},t.isLength=E,t.isMatch=N,t.isNil=function(t){return null==t},t.isNotNil=function(t){return null!=t},t.isNull=function(t){return null===t},t.isPlainObject=function(t){if("object"!=typeof t)return!1;if(null==t)return!1;if(null===Object.getPrototypeOf(t))return!0;if("[object Object]"!==t.toString()){const n=t[Symbol.toStringTag];if(null==n)return!1;return!!Object.getOwnPropertyDescriptor(t,Symbol.toStringTag)?.writable&&t.toString()===`[object ${n}]`}let n=t;for(;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return Object.getPrototypeOf(t)===n},t.isPrimitive=S,t.isTypedArray=function(t){return function(t){return t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Uint16Array||t instanceof Uint32Array||t instanceof BigUint64Array||t instanceof Int8Array||t instanceof Int16Array||t instanceof Int32Array||t instanceof BigInt64Array||t instanceof Float32Array||t instanceof Float64Array}(t)},t.isUndefined=function(t){return void 0===t},t.kebabCase=t=>I(t).map((t=>t.toLowerCase())).join("-"),t.keyBy=function(t,n){const e={};for(const r of t){e[n(r)]=r}return e},t.last=function(t){return t[t.length-1]},t.lowerCase=t=>I(t).map((t=>t.toLowerCase())).join(" "),t.matches=function(t){return t=j(t),n=>N(n,t)},t.max=function(t=[]){let n,e=t[0];for(const r of t)(null==n||r>n)&&(n=r,e=r);return e},t.maxBy=function(t,n){let e=t[0],r=-1/0;for(const o of t){const t=n(o);t>r&&(r=t,e=o)}return e},t.mean=d,t.meanBy=function(t,n){return d(t.map((t=>n(t))))},t.min=function(t=[]){let n,e=t[0];for(const r of t)(null==n||r<n)&&(n=r,e=r);return e},t.minBy=function(t,n){let e=t[0],r=1/0;for(const o of t){const t=n(o);t<r&&(r=t,e=o)}return e},t.negate=function(t){return(...n)=>!t(...n)},t.noop=function(){},t.omit=function(t,n){const e={...t};for(const t of n)delete e[t];return e},t.omitBy=function(t,n){const e={};for(const[r,o]of Object.entries(t))n(o,r)||(e[r]=o);return e},t.once=function(t){let n,e=!1;return function(){if(e)return n;const r=t();return e=!0,n=r,r}},t.orderBy=function(t,n,e){const r=(t,n,e)=>t<n?"asc"===e?-1:1:t>n?"asc"===e?1:-1:0,o=n.map(((t,n)=>e[n]||e[e.length-1]));return t.slice().sort(((t,e)=>{for(let i=0;i<n.length;i++){const u=n[i],c=o[i],f=r(t[u],e[u],c);if(0!==f)return f}return 0}))},t.partition=function(t,n){const e=[],r=[];for(const o of t)n(o)?e.push(o):r.push(o);return[e,r]},t.pick=function(t,n){const e={};for(const r of n)e[r]=t[r];return e},t.pickBy=function(t,n){const e={};for(const[r,o]of Object.entries(t))n(o,r)&&(e[r]=o);return e},t.random=f,t.randomInt=s,t.range=function(t,n,e){if(null==n&&(n=t,t=0),null==e&&(e=1),!Number.isInteger(e)||0===e)throw new Error("The step value must be a non-zero integer.");const r=Math.max(Math.ceil((n-t)/e),0),o=new Array(r);for(let n=0;n<r;n++)o[n]=t+n*e;return o},t.round=function(t,n=0){if(!Number.isInteger(n))throw new Error("Precision must be an integer.");const e=Math.pow(10,n);return Math.round(t*e)/e},t.sample=function(t){return t[Math.floor(Math.random()*t.length)]},t.sampleSize=function(t,n){if(n>t.length)throw new Error("Size must be less than or equal to the length of array.");const e=new Array(n),r=new Set;for(let o=t.length-n,i=0;o<t.length;o++,i++){let n=s(0,o+1);r.has(n)&&(n=o),r.add(n),e[i]=t[n]}return e},t.set=R,t.shuffle=function(t){const n=t.slice();for(let t=n.length-1;t>=1;t--){const e=Math.floor(Math.random()*(t+1));[n[t],n[e]]=[n[e],n[t]]}return n},t.snakeCase=t=>I(t).map((t=>t.toLowerCase())).join("_"),t.startCase=function(t){const n=I(t.trim());let e="";for(const t of n)e&&(e+=" "),t===t.toUpperCase()?e+=t:e+=t[0].toUpperCase()+t.slice(1).toLowerCase();return e},t.startsWith=(t,n,e=0)=>t.startsWith(n,e),t.sum=A,t.sumBy=function(t,n){return A(t.map((t=>n(t))))},t.tail=function(t){const n=t.length;if(n<=1)return[];const e=new Array(n-1);for(let r=1;r<n;r++)e[r-1]=t[r];return e},t.take=function(t,n){return t.slice(0,n)},t.takeRight=function(t,n=1){return n<=0?[]:t.slice(-n)},t.takeRightWhile=function(t,n){for(let e=t.length-1;e>=0;e--)if(!n(t[e]))return t.slice(e+1);return t.slice()},t.takeWhile=function(t,n){const e=[];for(const r of t){if(!n(r))break;e.push(r)}return e},t.throttle=function(t,n){let e;return function(...r){const o=Date.now();(null==e||o-e>=n)&&(e=o,t(...r))}},t.toFilled=function(t,n,e=0,r=t.length){const o=t.length,i=Math.max(e>=0?e:o+e,0),u=Math.min(r>=0?r:o+r,o),c=t.slice();for(let t=i;t<u;t++)c[t]=n;return c},t.union=l,t.unionBy=h,t.unionWith=y,t.uniq=a,t.uniqBy=function(t,n){const e=new Map;for(const r of t){const t=n(r);e.has(t)||e.set(t,r)}return Array.from(e.values())},t.uniqWith=g,t.unzip=function(t){let n=0;for(let e=0;e<t.length;e++)t[e].length>n&&(n=t[e].length);const e=new Array(n);for(let r=0;r<n;r++){e[r]=new Array(t.length);for(let n=0;n<t.length;n++)e[r][n]=t[n][r]}return e},t.unzipWith=function(t,n){const e=Math.max(...t.map((t=>t.length))),r=new Array(e);for(let o=0;o<e;o++){const e=new Array(t.length);for(let n=0;n<t.length;n++)e[n]=t[n][o];r[o]=n(...e)}return r},t.withTimeout=async function(t,n){return Promise.race([t(),B(n)])},t.without=function(t,...n){const e=new Set(n);return t.filter((t=>!e.has(t)))},t.xor=function(t,e){return n(l(t,e),i(t,e))},t.xorBy=function(t,n,r){return e(h(t,n,r),u(t,n,r),r)},t.xorWith=function(t,n,e){return r(y(t,n,e),c(t,n,e),e)},t.zip=p,t.zipObject=function(t,n){const e={};for(let r=0;r<t.length;r++)e[t[r]]=n[r];return e},t.zipObjectDeep=function(t,n){const e={},r=p(t,n);for(let t=0;t<r.length;t++){const[n,o]=r[t];null!=n&&R(e,n,o)}return e},t.zipWith=function(t,...n){const e=[t,...n.slice(0,-1)],r=n[n.length-1],o=[],i=Math.max(...e.map((t=>t.length)));for(let t=0;t<i;t++){const n=e.map((n=>n[t]));o.push(r(...n))}return o},Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),t}({});
1
+ var _=function(t){"use strict";function n(t,n){const e=new Set(n);return t.filter((t=>!e.has(t)))}function e(t,n,e){const r=new Set(n.map((t=>e(t))));return t.filter((t=>!r.has(e(t))))}function r(t,n,e){return t.filter((t=>n.every((n=>!e(t,n)))))}function o(t,n=1){const e=[],r=Math.floor(n),o=(t,n)=>{for(const i of t)Array.isArray(i)&&n<r?o(i,n+1):e.push(i)};return o(t,0),e}function i(t,n){const e=new Set(n);return t.filter((t=>e.has(t)))}function u(t,n,e){const r=new Set(n.map(e));return t.filter((t=>r.has(e(t))))}function c(t,n,e){return t.filter((t=>n.some((n=>e(t,n)))))}function f(t,n){if(null==n&&(n=t,t=0),t>=n)throw new Error("Invalid input: The maximum value must be greater than the minimum value.");return Math.random()*(n-t)+t}function s(t,n){return Math.floor(f(t,n))}function a(t){return Array.from(new Set(t))}function l(t,n){return a(t.concat(n))}function h(t,n,e){const r=new Map;for(const o of[...t,...n]){const t=e(o);r.has(t)||r.set(t,o)}return Array.from(r.values())}function g(t,n){const e=[];for(const r of t){e.every((t=>!n(t,r)))&&e.push(r)}return e}function y(t,n,e){return g(t.concat(n),e)}function p(...t){const n=[],e=Math.max(...t.map((t=>t.length)));for(let r=0;r<e;r++){const e=[];for(const n of t)e.push(n[r]);n.push(e)}return n}function m(t){return t[0]}class b extends Error{constructor(t="The operation was aborted"){super(t),this.name="AbortError"}}class w extends Error{constructor(t="The operation was timed out"){super(t),this.name="TimeoutError"}}function A(t){let n=0;for(let e=0;e<t.length;e++)n+=t[e];return n}function d(t){return A(t)/t.length}function j(t){if("object"!=typeof t)return!1;if(null==t)return!1;if(null===Object.getPrototypeOf(t))return!0;if("[object Object]"!==t.toString())return!1;let n=t;for(;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return Object.getPrototypeOf(t)===n}function O(t,n=""){const e={},r=Object.keys(t);for(let o=0;o<r.length;o++){const i=r[o],u=t[i],c=n?`${n}.${i}`:i;if(j(u)&&Object.keys(u).length>0)Object.assign(e,O(u,c));else if(Array.isArray(u))for(let t=0;t<u.length;t++)e[`${c}.${t}`]=u[t];else e[c]=u}return e}function M(t){if(null==(n=t)||"object"!=typeof n&&"function"!=typeof n)return t;var n;if(Array.isArray(t))return t.map((t=>M(t)));if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp)return new RegExp(t.source,t.flags);if(t instanceof Map){const n=new Map;for(const[e,r]of t.entries())n.set(e,M(r));return n}if(t instanceof Set){const n=new Set;for(const e of t.values())n.add(M(e));return n}if(function(t){return t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Uint16Array||t instanceof Uint32Array||t instanceof BigUint64Array||t instanceof Int8Array||t instanceof Int16Array||t instanceof Int32Array||t instanceof BigInt64Array||t instanceof Float32Array||t instanceof Float64Array}(t)){const n=new(Object.getPrototypeOf(t).constructor)(t.length);for(let e=0;e<t.length;e++)n[e]=M(t[e]);return n}if(t instanceof ArrayBuffer||"undefined"!=typeof SharedArrayBuffer&&t instanceof SharedArrayBuffer)return t.slice(0);if(t instanceof DataView){const n=new DataView(t.buffer.slice(0));return E(t,n),n}if("undefined"!=typeof File&&t instanceof File){const n=new File([t],t.name,{type:t.type});return E(t,n),n}if(t instanceof Blob){const n=new Blob([t],{type:t.type});return E(t,n),n}if(t instanceof Error){const n=new t.constructor;return n.message=t.message,n.name=t.name,n.stack=t.stack,n.cause=t.cause,E(t,n),n}if("object"==typeof t&&null!==t){const n={};return E(t,n),n}return t}function E(t,n){const e=Object.keys(t);for(let r=0;r<e.length;r++){const o=e[r],i=Object.getOwnPropertyDescriptor(t,o);(i?.writable||i?.set)&&(n[o]=M(t[o]))}}function x(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=Number.MAX_SAFE_INTEGER}function S(t){return null==t||"object"!=typeof t&&"function"!=typeof t}function v(t,{signal:n}={}){return new Promise(((e,r)=>{const o=()=>{r(new b)};if(n?.aborted)return o();const i=setTimeout(e,t);n?.addEventListener("abort",(()=>{clearTimeout(i),o()}),{once:!0})}))}async function k(t){throw await v(t),new w}const B=t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase(),I=/[A-Z]?[a-z]+|[0-9]+|[A-Z]+(?![a-z])/g;function T(t){return Array.from(t.match(I)??[])}const P=/^(?:0|[1-9]\d*)$/;function z(t){switch(typeof t){case"number":return Number.isInteger(t)&&t>=0&&t<Number.MAX_SAFE_INTEGER;case"symbol":return!1;case"string":return P.test(t)}}function C(t){const n=/\\(\\)?/g,e=RegExp("[^.[\\]]+|\\[(?:([^\"'][^[]*)|([\"'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))","g"),r=[];let o;"."===t[0]&&r.push("");let i=0;for(;null!==(o=e.exec(t));){let t=o[0];const u=o[1],c=o[2],f=o[3];c?t=f.replace(n,"$1"):u&&(t=u),r.push(t),e.lastIndex===i?e.lastIndex++:i=e.lastIndex}return r}function R(t,n,e){const r=Array.isArray(n)?n:"string"==typeof n?C(n):[n];let o=t;for(let t=0;t<r.length-1;t++){const n=r[t],e=r[t+1];null==o[n]&&(o[n]=z(e)?[]:{}),o=o[n]}return o[r[r.length-1]]=e,t}const W=/^\w*$/,D=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/;function N(t,n){if(0===n.length)return!0;if(!Array.isArray(t))return!1;const e=new Set;for(let r=0;r<n.length;r++){const o=n[r],i=t.findIndex(((t,n)=>U(t,o)&&!e.has(n)));if(-1===i)return!1;e.add(i)}return!0}function U(t,n){if(n===t)return!0;switch(typeof n){case"object":{if(null==n)return!0;n=n??{};const e=Object.keys(n);if(null==t)return 0===e.length;if(Array.isArray(n))return N(t,n);if(n instanceof Map)return function(t,n){if(0===n.size)return!0;if(!(t instanceof Map))return!1;for(const[e,r]of n.entries())if(!U(t.get(e),r))return!1;return!0}(t,n);if(n instanceof Set)return function(t,n){return 0===n.size||t instanceof Set&&N([...t],[...n])}(t,n);for(let r=0;r<e.length;r++){const o=e[r];if(!S(t)&&!(o in t))return!1;if(void 0===n[o]&&void 0!==t[o])return!1;if(!U(t[o],n[o]))return!1}return!0}case"function":return Object.keys(n).length>0&&U(t,{...n});default:return!n}}return t.AbortError=b,t.TimeoutError=w,t.after=(t,n)=>{if(!Number.isInteger(t)||t<0)throw new Error("n must be a non-negative integer.");let e=0;return(...r)=>{if(++e>=t)return n(...r)}},t.before=(t,n)=>{if(!Number.isInteger(t)||t<0)throw new Error("n must be a non-negative integer.");let e=0;return(...r)=>{if(++e<t)return n(...r)}},t.camelCase=function(t){const n=T(t);if(0===n.length)return"";const[e,...r]=n;return`${e.toLowerCase()}${r.map((t=>B(t))).join("")}`},t.capitalize=B,t.chunk=function(t,n=1){return 0===(n=Math.max(Math.floor(n),0))?[]:function(t,n){if(!Number.isInteger(n)||n<=0)throw new Error("Size must be an integer greater than zero.");const e=Math.ceil(t.length/n),r=Array(e);for(let o=0;o<e;o++){const e=o*n,i=e+n;r[o]=t.slice(e,i)}return r}(t,n)},t.clamp=function(t,n,e){return null==e?Math.min(t,n):Math.min(Math.max(t,n),e)},t.clone=function(t){if(null==(n=t)||"object"!=typeof n&&"function"!=typeof n)return t;var n;if(Array.isArray(t))return t.slice();if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp)return new RegExp(t.source,t.flags);if(t instanceof Map){const n=new Map;for(const[e,r]of t)n.set(e,r);return n}if(t instanceof Set){const n=new Set;for(const e of t)n.add(e);return n}if("object"==typeof t){const n=Object.getPrototypeOf(t),e=Object.create(n);return Object.assign(e,t)}return t},t.cloneDeep=M,t.compact=function(t){const n=[];for(const e of t)e&&n.push(e);return n},t.concat=function(...t){return o(t)},t.countBy=function(t,n){const e={};for(const r of t){const t=n(r);e[t]=(e[t]??0)+1}return e},t.debounce=function(t,n,{signal:e}={}){let r=null;const o=function(...o){null!==r&&clearTimeout(r),e?.aborted||(r=setTimeout((()=>{t(...o),r=null}),n))};return o.cancel=function(){null!==r&&(clearTimeout(r),r=null)},e?.addEventListener("abort",(function(){o.cancel()}),{once:!0}),o},t.delay=v,t.difference=function(t,...e){return n(t,o(e))},t.differenceBy=e,t.differenceWith=r,t.drop=function(t,n){return n=Math.max(n,0),t.slice(n)},t.dropRight=function(t,n){return 0===(n=Math.min(-n,0))?t.slice():t.slice(0,n)},t.dropRightWhile=function(t,n){for(let e=t.length-1;e>=0;e--)if(!n(t[e]))return t.slice(0,e+1);return[]},t.dropWhile=function(t,n){const e=t.findIndex((t=>!n(t)));return-1===e?[]:t.slice(e)},t.endsWith=(t,n,e=t.length)=>t.endsWith(n,e),t.fill=function(t,n,e=0,r=t.length){return(e=Math.floor(e))||(e=0),(r=Math.floor(r))||(r=0),function(t,n,e=0,r=t.length){const o=t.length,i=Math.max(e>=0?e:o+e,0),u=Math.min(r>=0?r:o+r,o);for(let e=i;e<u;e++)t[e]=n;return t}(t,n,e,r)},t.first=m,t.flatMap=function(t,n,e=1){return o(t.map((t=>n(t))),e)},t.flatten=o,t.flattenDeep=function(t){return o(t,1/0)},t.flattenObject=function(t){return O(t)},t.forEachRight=function(t,n){for(let e=t.length-1;e>=0;e--){n(t[e],e,t)}},t.get=function(t,n,e){let r;if(r=Array.isArray(n)?n:"string"==typeof n&&function(t){switch(typeof t){case"number":case"symbol":return!1;case"string":return!W.test(t)&&D.test(t)}}(n)&&null==t?.[n]?C(n):[n],0===r.length)return e;let o,i=t;for(o=0;o<r.length&&null!=i;o++){let t=r[o];Object.is(t.valueOf(),-0)&&(t="-0"),i=i[t]}return null===i&&o===r.length?i:i??e},t.groupBy=function(t,n){const e={};for(const r of t){const t=n(r);null==e[t]&&(e[t]=[]),e[t].push(r)}return e},t.head=m,t.inRange=function(t,n,e){if(null==e&&(e=n,n=0),n>=e)throw new Error("The maximum value must be greater than the minimum value.");return n<=t&&t<e},t.initial=function(t){return t.length<=1?[]:t.slice(0,-1)},t.intersection=i,t.intersectionBy=u,t.intersectionWith=c,t.invert=function(t){const n={},e=Object.keys(t);for(let r=0;r<e.length;r++){const o=e[r];n[t[o]]=o}return n},t.isArray=function(t){return Array.isArray(t)},t.isArrayLike=function(t){return null!=t&&"function"!=typeof t&&x(t.length)},t.isEqual=function t(n,e){if(Object.is(n,e))return!0;if(n instanceof Date&&e instanceof Date)return n.getTime()===e.getTime();if(n instanceof RegExp&&e instanceof RegExp)return n.source===e.source&&n.flags===e.flags;if("object"!=typeof n||"object"!=typeof e||null===n||null===e)return!1;const r=Object.keys(n),o=Object.keys(e);if(r.length!==o.length)return!1;if(l(r,o).length!==r.length)return!1;for(let o=0;o<r.length;o++){const i=r[o];if(!t(n[i],e[i]))return!1}return!0},t.isFunction=function(t){return"function"==typeof t},t.isLength=x,t.isMatch=U,t.isNil=function(t){return null==t},t.isNotNil=function(t){return null!=t},t.isNull=function(t){return null===t},t.isPlainObject=function(t){if("object"!=typeof t)return!1;if(null==t)return!1;if(null===Object.getPrototypeOf(t))return!0;if("[object Object]"!==t.toString()){const n=t[Symbol.toStringTag];if(null==n)return!1;return!!Object.getOwnPropertyDescriptor(t,Symbol.toStringTag)?.writable&&t.toString()===`[object ${n}]`}let n=t;for(;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return Object.getPrototypeOf(t)===n},t.isPrimitive=S,t.isTypedArray=function(t){return function(t){return t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Uint16Array||t instanceof Uint32Array||t instanceof BigUint64Array||t instanceof Int8Array||t instanceof Int16Array||t instanceof Int32Array||t instanceof BigInt64Array||t instanceof Float32Array||t instanceof Float64Array}(t)},t.isUndefined=function(t){return void 0===t},t.kebabCase=t=>T(t).map((t=>t.toLowerCase())).join("-"),t.keyBy=function(t,n){const e={};for(const r of t){e[n(r)]=r}return e},t.last=function(t){return t[t.length-1]},t.lowerCase=t=>T(t).map((t=>t.toLowerCase())).join(" "),t.mapKeys=function(t,n){const e={},r=Object.keys(t);for(let o=0;o<r.length;o++){const i=r[o],u=t[i];e[n(u,i,t)]=u}return e},t.mapValues=function(t,n){const e={},r=Object.keys(t);for(let o=0;o<r.length;o++){const i=r[o],u=t[i];e[i]=n(u,i,t)}return e},t.matches=function(t){return t=M(t),n=>U(n,t)},t.max=function(t=[]){let n,e=t[0];for(const r of t)(null==n||r>n)&&(n=r,e=r);return e},t.maxBy=function(t,n){let e=t[0],r=-1/0;for(const o of t){const t=n(o);t>r&&(r=t,e=o)}return e},t.mean=d,t.meanBy=function(t,n){return d(t.map((t=>n(t))))},t.min=function(t=[]){let n,e=t[0];for(const r of t)(null==n||r<n)&&(n=r,e=r);return e},t.minBy=function(t,n){let e=t[0],r=1/0;for(const o of t){const t=n(o);t<r&&(r=t,e=o)}return e},t.negate=function(t){return(...n)=>!t(...n)},t.noop=function(){},t.omit=function(t,n){const e={...t};for(const t of n)delete e[t];return e},t.omitBy=function(t,n){const e={};for(const[r,o]of Object.entries(t))n(o,r)||(e[r]=o);return e},t.once=function(t){let n,e=!1;return function(){if(e)return n;const r=t();return e=!0,n=r,r}},t.orderBy=function(t,n,e){const r=(t,n,e)=>t<n?"asc"===e?-1:1:t>n?"asc"===e?1:-1:0,o=n.map(((t,n)=>e[n]||e[e.length-1]));return t.slice().sort(((t,e)=>{for(let i=0;i<n.length;i++){const u=n[i],c=o[i],f=r(t[u],e[u],c);if(0!==f)return f}return 0}))},t.partition=function(t,n){const e=[],r=[];for(const o of t)n(o)?e.push(o):r.push(o);return[e,r]},t.pick=function(t,n){const e={};for(const r of n)e[r]=t[r];return e},t.pickBy=function(t,n){const e={};for(const[r,o]of Object.entries(t))n(o,r)&&(e[r]=o);return e},t.random=f,t.randomInt=s,t.range=function(t,n,e){if(null==n&&(n=t,t=0),null==e&&(e=1),!Number.isInteger(e)||0===e)throw new Error("The step value must be a non-zero integer.");const r=Math.max(Math.ceil((n-t)/e),0),o=new Array(r);for(let n=0;n<r;n++)o[n]=t+n*e;return o},t.round=function(t,n=0){if(!Number.isInteger(n))throw new Error("Precision must be an integer.");const e=Math.pow(10,n);return Math.round(t*e)/e},t.sample=function(t){return t[Math.floor(Math.random()*t.length)]},t.sampleSize=function(t,n){if(n>t.length)throw new Error("Size must be less than or equal to the length of array.");const e=new Array(n),r=new Set;for(let o=t.length-n,i=0;o<t.length;o++,i++){let n=s(0,o+1);r.has(n)&&(n=o),r.add(n),e[i]=t[n]}return e},t.set=R,t.shuffle=function(t){const n=t.slice();for(let t=n.length-1;t>=1;t--){const e=Math.floor(Math.random()*(t+1));[n[t],n[e]]=[n[e],n[t]]}return n},t.snakeCase=t=>T(t).map((t=>t.toLowerCase())).join("_"),t.startCase=function(t){const n=T(t.trim());let e="";for(const t of n)e&&(e+=" "),t===t.toUpperCase()?e+=t:e+=t[0].toUpperCase()+t.slice(1).toLowerCase();return e},t.startsWith=(t,n,e=0)=>t.startsWith(n,e),t.sum=A,t.sumBy=function(t,n){return A(t.map((t=>n(t))))},t.tail=function(t){const n=t.length;if(n<=1)return[];const e=new Array(n-1);for(let r=1;r<n;r++)e[r-1]=t[r];return e},t.take=function(t,n){return t.slice(0,n)},t.takeRight=function(t,n=1){return n<=0?[]:t.slice(-n)},t.takeRightWhile=function(t,n){for(let e=t.length-1;e>=0;e--)if(!n(t[e]))return t.slice(e+1);return t.slice()},t.takeWhile=function(t,n){const e=[];for(const r of t){if(!n(r))break;e.push(r)}return e},t.throttle=function(t,n){let e;return function(...r){const o=Date.now();(null==e||o-e>=n)&&(e=o,t(...r))}},t.toFilled=function(t,n,e=0,r=t.length){const o=t.length,i=Math.max(e>=0?e:o+e,0),u=Math.min(r>=0?r:o+r,o),c=t.slice();for(let t=i;t<u;t++)c[t]=n;return c},t.union=l,t.unionBy=h,t.unionWith=y,t.uniq=a,t.uniqBy=function(t,n){const e=new Map;for(const r of t){const t=n(r);e.has(t)||e.set(t,r)}return Array.from(e.values())},t.uniqWith=g,t.unzip=function(t){let n=0;for(let e=0;e<t.length;e++)t[e].length>n&&(n=t[e].length);const e=new Array(n);for(let r=0;r<n;r++){e[r]=new Array(t.length);for(let n=0;n<t.length;n++)e[r][n]=t[n][r]}return e},t.unzipWith=function(t,n){const e=Math.max(...t.map((t=>t.length))),r=new Array(e);for(let o=0;o<e;o++){const e=new Array(t.length);for(let n=0;n<t.length;n++)e[n]=t[n][o];r[o]=n(...e)}return r},t.withTimeout=async function(t,n){return Promise.race([t(),k(n)])},t.without=function(t,...n){const e=new Set(n);return t.filter((t=>!e.has(t)))},t.xor=function(t,e){return n(l(t,e),i(t,e))},t.xorBy=function(t,n,r){return e(h(t,n,r),u(t,n,r),r)},t.xorWith=function(t,n,e){return r(y(t,n,e),c(t,n,e),e)},t.zip=p,t.zipObject=function(t,n){const e={};for(let r=0;r<t.length;r++)e[t[r]]=n[r];return e},t.zipObjectDeep=function(t,n){const e={},r=p(t,n);for(let t=0;t<r.length;t++){const[n,o]=r[t];null!=n&&R(e,n,o)}return e},t.zipWith=function(t,...n){const e=[t,...n.slice(0,-1)],r=n[n.length-1],o=[],i=Math.max(...e.map((t=>t.length)));for(let t=0;t<i;t++){const n=e.map((n=>n[t]));o.push(r(...n))}return o},Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),t}({});
2
2
  //# sourceMappingURL=browser.global.js.map