@hairy/utils 1.31.0 → 1.33.0

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.
package/dist/index.cjs CHANGED
@@ -31,11 +31,12 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
31
31
  var index_exports = {};
32
32
  __export(index_exports, {
33
33
  BIG_INTS: () => BIG_INTS,
34
- BigNum: () => BigNum,
35
34
  Bignumber: () => import_bignumber.default,
36
35
  Deferred: () => Deferred,
37
36
  arange: () => arange,
38
37
  average: () => average,
38
+ bignum: () => bignum,
39
+ call: () => call,
39
40
  camelCase: () => camelCase,
40
41
  capitalCase: () => capitalCase,
41
42
  clone: () => clone_default,
@@ -53,25 +54,34 @@ __export(index_exports, {
53
54
  dotCase: () => dotCase,
54
55
  downloadBlobFile: () => downloadBlobFile,
55
56
  downloadNetworkFile: () => downloadNetworkFile,
57
+ ensurePrefix: () => ensurePrefix,
58
+ ensureSuffix: () => ensureSuffix,
56
59
  find: () => find_default,
57
60
  formToObject: () => formToObject,
58
61
  formatNumeric: () => formatNumeric,
59
62
  formatSize: () => formatSize,
60
63
  formatUnit: () => formatUnit,
61
64
  getTypeof: () => getTypeof,
65
+ groupBy: () => groupBy_default,
62
66
  gt: () => gt,
63
67
  gte: () => gte,
64
68
  integer: () => integer,
65
69
  isAndroid: () => isAndroid,
70
+ isArguments: () => isArguments_default,
66
71
  isArray: () => isArray_default,
72
+ isArrayBuffer: () => isArrayBuffer_default,
67
73
  isArrayLike: () => isArrayLike_default,
74
+ isArrayLikeObject: () => isArrayLikeObject_default,
68
75
  isBoolean: () => isBoolean_default,
69
76
  isBrowser: () => isBrowser,
77
+ isBuffer: () => isBuffer_default,
70
78
  isChrome: () => isChrome,
71
79
  isDate: () => isDate_default,
72
80
  isEdge: () => isEdge,
81
+ isElement: () => isElement_default,
73
82
  isEmpty: () => isEmpty_default,
74
83
  isEqual: () => isEqual_default,
84
+ isEqualWith: () => isEqualWith_default,
75
85
  isError: () => isError_default,
76
86
  isFF: () => isFF,
77
87
  isFormData: () => isFormData,
@@ -80,18 +90,28 @@ __export(index_exports, {
80
90
  isIE11: () => isIE11,
81
91
  isIE9: () => isIE9,
82
92
  isIOS: () => isIOS,
93
+ isInteger: () => isInteger_default,
94
+ isMap: () => isMap_default,
95
+ isMatch: () => isMatch_default,
96
+ isMatchWith: () => isMatchWith_default,
83
97
  isMobile: () => isMobile,
84
98
  isNaN: () => isNaN_default,
85
99
  isNative: () => isNative_default,
86
100
  isNull: () => isNull_default,
87
101
  isNumber: () => isNumber_default,
88
102
  isObject: () => isObject_default,
103
+ isObjectLike: () => isObjectLike_default,
89
104
  isPhantomJS: () => isPhantomJS,
90
105
  isPlainObject: () => isPlainObject_default,
106
+ isRegexp: () => isRegExp_default,
107
+ isSet: () => isSet_default,
91
108
  isString: () => isString_default,
109
+ isSymbol: () => isSymbol_default,
92
110
  isTruthy: () => isTruthy,
93
111
  isTypeof: () => isTypeof,
94
112
  isUndefined: () => isUndefined_default,
113
+ isWeakMap: () => isWeakMap_default,
114
+ isWeakSet: () => isWeakSet_default,
95
115
  isWeex: () => isWeex,
96
116
  isWindow: () => isWindow,
97
117
  join: () => join_default,
@@ -105,7 +125,7 @@ __export(index_exports, {
105
125
  mergeWith: () => mergeWith_default,
106
126
  noCase: () => noCase,
107
127
  noop: () => noop2,
108
- numerfix: () => numerfix,
128
+ numfix: () => numfix,
109
129
  objectToForm: () => objectToForm,
110
130
  off: () => off,
111
131
  on: () => on,
@@ -118,7 +138,8 @@ __export(index_exports, {
118
138
  plus: () => plus,
119
139
  proxy: () => proxy,
120
140
  randomArray: () => randomArray,
121
- randomNumer: () => randomNumer,
141
+ randomNumber: () => randomNumber,
142
+ randomString: () => randomString,
122
143
  readFileReader: () => readFileReader,
123
144
  redirectTo: () => redirectTo,
124
145
  riposte: () => riposte,
@@ -126,10 +147,13 @@ __export(index_exports, {
126
147
  sentenceCase: () => sentenceCase,
127
148
  showOpenFilePicker: () => showOpenFilePicker,
128
149
  showOpenImagePicker: () => showOpenImagePicker,
150
+ slash: () => slash,
129
151
  snakeCase: () => snakeCase,
152
+ template: () => template,
130
153
  to: () => to,
131
154
  trainCase: () => trainCase,
132
155
  truncate: () => truncate_default,
156
+ unindent: () => unindent,
133
157
  uniq: () => uniq_default,
134
158
  uniqBy: () => uniqBy_default,
135
159
  uniqWith: () => uniqWith_default,
@@ -216,142 +240,6 @@ function off(obj, ...args) {
216
240
  obj.removeEventListener(...args);
217
241
  }
218
242
 
219
- // ../../node_modules/.pnpm/change-case@5.4.4/node_modules/change-case/dist/index.js
220
- var SPLIT_LOWER_UPPER_RE = /([\p{Ll}\d])(\p{Lu})/gu;
221
- var SPLIT_UPPER_UPPER_RE = /(\p{Lu})([\p{Lu}][\p{Ll}])/gu;
222
- var SPLIT_SEPARATE_NUMBER_RE = /(\d)\p{Ll}|(\p{L})\d/u;
223
- var DEFAULT_STRIP_REGEXP = /[^\p{L}\d]+/giu;
224
- var SPLIT_REPLACE_VALUE = "$1\0$2";
225
- var DEFAULT_PREFIX_SUFFIX_CHARACTERS = "";
226
- function split(value) {
227
- let result = value.trim();
228
- result = result.replace(SPLIT_LOWER_UPPER_RE, SPLIT_REPLACE_VALUE).replace(SPLIT_UPPER_UPPER_RE, SPLIT_REPLACE_VALUE);
229
- result = result.replace(DEFAULT_STRIP_REGEXP, "\0");
230
- let start = 0;
231
- let end = result.length;
232
- while (result.charAt(start) === "\0")
233
- start++;
234
- if (start === end)
235
- return [];
236
- while (result.charAt(end - 1) === "\0")
237
- end--;
238
- return result.slice(start, end).split(/\0/g);
239
- }
240
- function splitSeparateNumbers(value) {
241
- const words = split(value);
242
- for (let i = 0; i < words.length; i++) {
243
- const word = words[i];
244
- const match = SPLIT_SEPARATE_NUMBER_RE.exec(word);
245
- if (match) {
246
- const offset = match.index + (match[1] ?? match[2]).length;
247
- words.splice(i, 1, word.slice(0, offset), word.slice(offset));
248
- }
249
- }
250
- return words;
251
- }
252
- function noCase(input, options) {
253
- const [prefix, words, suffix] = splitPrefixSuffix(input, options);
254
- return prefix + words.map(lowerFactory(options?.locale)).join(options?.delimiter ?? " ") + suffix;
255
- }
256
- function camelCase(input, options) {
257
- const [prefix, words, suffix] = splitPrefixSuffix(input, options);
258
- const lower = lowerFactory(options?.locale);
259
- const upper = upperFactory(options?.locale);
260
- const transform = options?.mergeAmbiguousCharacters ? capitalCaseTransformFactory(lower, upper) : pascalCaseTransformFactory(lower, upper);
261
- return prefix + words.map((word, index) => {
262
- if (index === 0)
263
- return lower(word);
264
- return transform(word, index);
265
- }).join(options?.delimiter ?? "") + suffix;
266
- }
267
- function pascalCase(input, options) {
268
- const [prefix, words, suffix] = splitPrefixSuffix(input, options);
269
- const lower = lowerFactory(options?.locale);
270
- const upper = upperFactory(options?.locale);
271
- const transform = options?.mergeAmbiguousCharacters ? capitalCaseTransformFactory(lower, upper) : pascalCaseTransformFactory(lower, upper);
272
- return prefix + words.map(transform).join(options?.delimiter ?? "") + suffix;
273
- }
274
- function pascalSnakeCase(input, options) {
275
- return capitalCase(input, { delimiter: "_", ...options });
276
- }
277
- function capitalCase(input, options) {
278
- const [prefix, words, suffix] = splitPrefixSuffix(input, options);
279
- const lower = lowerFactory(options?.locale);
280
- const upper = upperFactory(options?.locale);
281
- return prefix + words.map(capitalCaseTransformFactory(lower, upper)).join(options?.delimiter ?? " ") + suffix;
282
- }
283
- function constantCase(input, options) {
284
- const [prefix, words, suffix] = splitPrefixSuffix(input, options);
285
- return prefix + words.map(upperFactory(options?.locale)).join(options?.delimiter ?? "_") + suffix;
286
- }
287
- function dotCase(input, options) {
288
- return noCase(input, { delimiter: ".", ...options });
289
- }
290
- function kebabCase(input, options) {
291
- return noCase(input, { delimiter: "-", ...options });
292
- }
293
- function pathCase(input, options) {
294
- return noCase(input, { delimiter: "/", ...options });
295
- }
296
- function sentenceCase(input, options) {
297
- const [prefix, words, suffix] = splitPrefixSuffix(input, options);
298
- const lower = lowerFactory(options?.locale);
299
- const upper = upperFactory(options?.locale);
300
- const transform = capitalCaseTransformFactory(lower, upper);
301
- return prefix + words.map((word, index) => {
302
- if (index === 0)
303
- return transform(word);
304
- return lower(word);
305
- }).join(options?.delimiter ?? " ") + suffix;
306
- }
307
- function snakeCase(input, options) {
308
- return noCase(input, { delimiter: "_", ...options });
309
- }
310
- function trainCase(input, options) {
311
- return capitalCase(input, { delimiter: "-", ...options });
312
- }
313
- function lowerFactory(locale) {
314
- return locale === false ? (input) => input.toLowerCase() : (input) => input.toLocaleLowerCase(locale);
315
- }
316
- function upperFactory(locale) {
317
- return locale === false ? (input) => input.toUpperCase() : (input) => input.toLocaleUpperCase(locale);
318
- }
319
- function capitalCaseTransformFactory(lower, upper) {
320
- return (word) => `${upper(word[0])}${lower(word.slice(1))}`;
321
- }
322
- function pascalCaseTransformFactory(lower, upper) {
323
- return (word, index) => {
324
- const char0 = word[0];
325
- const initial = index > 0 && char0 >= "0" && char0 <= "9" ? "_" + char0 : upper(char0);
326
- return initial + lower(word.slice(1));
327
- };
328
- }
329
- function splitPrefixSuffix(input, options = {}) {
330
- const splitFn = options.split ?? (options.separateNumbers ? splitSeparateNumbers : split);
331
- const prefixCharacters = options.prefixCharacters ?? DEFAULT_PREFIX_SUFFIX_CHARACTERS;
332
- const suffixCharacters = options.suffixCharacters ?? DEFAULT_PREFIX_SUFFIX_CHARACTERS;
333
- let prefixIndex = 0;
334
- let suffixIndex = input.length;
335
- while (prefixIndex < input.length) {
336
- const char = input.charAt(prefixIndex);
337
- if (!prefixCharacters.includes(char))
338
- break;
339
- prefixIndex++;
340
- }
341
- while (suffixIndex > prefixIndex) {
342
- const index = suffixIndex - 1;
343
- const char = input.charAt(index);
344
- if (!suffixCharacters.includes(char))
345
- break;
346
- suffixIndex = index;
347
- }
348
- return [
349
- input.slice(0, prefixIndex),
350
- splitFn(input.slice(prefixIndex, suffixIndex)),
351
- input.slice(suffixIndex)
352
- ];
353
- }
354
-
355
243
  // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_freeGlobal.js
356
244
  var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
357
245
  var freeGlobal_default = freeGlobal;
@@ -2527,6 +2415,17 @@ function baseIteratee(value) {
2527
2415
  }
2528
2416
  var baseIteratee_default = baseIteratee;
2529
2417
 
2418
+ // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arrayAggregator.js
2419
+ function arrayAggregator(array, setter, iteratee, accumulator) {
2420
+ var index = -1, length = array == null ? 0 : array.length;
2421
+ while (++index < length) {
2422
+ var value = array[index];
2423
+ setter(accumulator, value, iteratee(value), array);
2424
+ }
2425
+ return accumulator;
2426
+ }
2427
+ var arrayAggregator_default = arrayAggregator;
2428
+
2530
2429
  // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_createBaseFor.js
2531
2430
  function createBaseFor(fromRight) {
2532
2431
  return function(object, iteratee, keysFunc) {
@@ -2546,6 +2445,54 @@ var createBaseFor_default = createBaseFor;
2546
2445
  var baseFor = createBaseFor_default();
2547
2446
  var baseFor_default = baseFor;
2548
2447
 
2448
+ // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseForOwn.js
2449
+ function baseForOwn(object, iteratee) {
2450
+ return object && baseFor_default(object, iteratee, keys_default);
2451
+ }
2452
+ var baseForOwn_default = baseForOwn;
2453
+
2454
+ // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_createBaseEach.js
2455
+ function createBaseEach(eachFunc, fromRight) {
2456
+ return function(collection, iteratee) {
2457
+ if (collection == null) {
2458
+ return collection;
2459
+ }
2460
+ if (!isArrayLike_default(collection)) {
2461
+ return eachFunc(collection, iteratee);
2462
+ }
2463
+ var length = collection.length, index = fromRight ? length : -1, iterable = Object(collection);
2464
+ while (fromRight ? index-- : ++index < length) {
2465
+ if (iteratee(iterable[index], index, iterable) === false) {
2466
+ break;
2467
+ }
2468
+ }
2469
+ return collection;
2470
+ };
2471
+ }
2472
+ var createBaseEach_default = createBaseEach;
2473
+
2474
+ // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseEach.js
2475
+ var baseEach = createBaseEach_default(baseForOwn_default);
2476
+ var baseEach_default = baseEach;
2477
+
2478
+ // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseAggregator.js
2479
+ function baseAggregator(collection, setter, iteratee, accumulator) {
2480
+ baseEach_default(collection, function(value, key, collection2) {
2481
+ setter(accumulator, value, iteratee(value), collection2);
2482
+ });
2483
+ return accumulator;
2484
+ }
2485
+ var baseAggregator_default = baseAggregator;
2486
+
2487
+ // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_createAggregator.js
2488
+ function createAggregator(setter, initializer) {
2489
+ return function(collection, iteratee) {
2490
+ var func = isArray_default(collection) ? arrayAggregator_default : baseAggregator_default, accumulator = initializer ? initializer() : {};
2491
+ return func(collection, setter, baseIteratee_default(iteratee, 2), accumulator);
2492
+ };
2493
+ }
2494
+ var createAggregator_default = createAggregator;
2495
+
2549
2496
  // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/now.js
2550
2497
  var now = function() {
2551
2498
  return root_default.Date.now();
@@ -2791,6 +2738,18 @@ var findIndex_default = findIndex;
2791
2738
  var find = createFind_default(findIndex_default);
2792
2739
  var find_default = find;
2793
2740
 
2741
+ // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/groupBy.js
2742
+ var objectProto17 = Object.prototype;
2743
+ var hasOwnProperty14 = objectProto17.hasOwnProperty;
2744
+ var groupBy = createAggregator_default(function(result, value, key) {
2745
+ if (hasOwnProperty14.call(result, key)) {
2746
+ result[key].push(value);
2747
+ } else {
2748
+ baseAssignValue_default(result, key, [value]);
2749
+ }
2750
+ });
2751
+ var groupBy_default = groupBy;
2752
+
2794
2753
  // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isString.js
2795
2754
  var stringTag5 = "[object String]";
2796
2755
  function isString(value) {
@@ -2812,6 +2771,18 @@ function values(object) {
2812
2771
  }
2813
2772
  var values_default = values;
2814
2773
 
2774
+ // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIsArrayBuffer.js
2775
+ var arrayBufferTag5 = "[object ArrayBuffer]";
2776
+ function baseIsArrayBuffer(value) {
2777
+ return isObjectLike_default(value) && baseGetTag_default(value) == arrayBufferTag5;
2778
+ }
2779
+ var baseIsArrayBuffer_default = baseIsArrayBuffer;
2780
+
2781
+ // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isArrayBuffer.js
2782
+ var nodeIsArrayBuffer = nodeUtil_default && nodeUtil_default.isArrayBuffer;
2783
+ var isArrayBuffer = nodeIsArrayBuffer ? baseUnary_default(nodeIsArrayBuffer) : baseIsArrayBuffer_default;
2784
+ var isArrayBuffer_default = isArrayBuffer;
2785
+
2815
2786
  // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isBoolean.js
2816
2787
  var boolTag5 = "[object Boolean]";
2817
2788
  function isBoolean(value) {
@@ -2831,11 +2802,17 @@ var nodeIsDate = nodeUtil_default && nodeUtil_default.isDate;
2831
2802
  var isDate = nodeIsDate ? baseUnary_default(nodeIsDate) : baseIsDate_default;
2832
2803
  var isDate_default = isDate;
2833
2804
 
2805
+ // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isElement.js
2806
+ function isElement(value) {
2807
+ return isObjectLike_default(value) && value.nodeType === 1 && !isPlainObject_default(value);
2808
+ }
2809
+ var isElement_default = isElement;
2810
+
2834
2811
  // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isEmpty.js
2835
2812
  var mapTag7 = "[object Map]";
2836
2813
  var setTag7 = "[object Set]";
2837
- var objectProto17 = Object.prototype;
2838
- var hasOwnProperty14 = objectProto17.hasOwnProperty;
2814
+ var objectProto18 = Object.prototype;
2815
+ var hasOwnProperty15 = objectProto18.hasOwnProperty;
2839
2816
  function isEmpty(value) {
2840
2817
  if (value == null) {
2841
2818
  return true;
@@ -2851,7 +2828,7 @@ function isEmpty(value) {
2851
2828
  return !baseKeys_default(value).length;
2852
2829
  }
2853
2830
  for (var key in value) {
2854
- if (hasOwnProperty14.call(value, key)) {
2831
+ if (hasOwnProperty15.call(value, key)) {
2855
2832
  return false;
2856
2833
  }
2857
2834
  }
@@ -2865,6 +2842,33 @@ function isEqual(value, other) {
2865
2842
  }
2866
2843
  var isEqual_default = isEqual;
2867
2844
 
2845
+ // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isEqualWith.js
2846
+ function isEqualWith(value, other, customizer) {
2847
+ customizer = typeof customizer == "function" ? customizer : void 0;
2848
+ var result = customizer ? customizer(value, other) : void 0;
2849
+ return result === void 0 ? baseIsEqual_default(value, other, void 0, customizer) : !!result;
2850
+ }
2851
+ var isEqualWith_default = isEqualWith;
2852
+
2853
+ // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isInteger.js
2854
+ function isInteger(value) {
2855
+ return typeof value == "number" && value == toInteger_default(value);
2856
+ }
2857
+ var isInteger_default = isInteger;
2858
+
2859
+ // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isMatch.js
2860
+ function isMatch(object, source) {
2861
+ return object === source || baseIsMatch_default(object, source, getMatchData_default(source));
2862
+ }
2863
+ var isMatch_default = isMatch;
2864
+
2865
+ // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isMatchWith.js
2866
+ function isMatchWith(object, source, customizer) {
2867
+ customizer = typeof customizer == "function" ? customizer : void 0;
2868
+ return baseIsMatch_default(object, source, getMatchData_default(source), customizer);
2869
+ }
2870
+ var isMatchWith_default = isMatchWith;
2871
+
2868
2872
  // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isNumber.js
2869
2873
  var numberTag5 = "[object Number]";
2870
2874
  function isNumber(value) {
@@ -2916,6 +2920,20 @@ function isUndefined(value) {
2916
2920
  }
2917
2921
  var isUndefined_default = isUndefined;
2918
2922
 
2923
+ // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isWeakMap.js
2924
+ var weakMapTag4 = "[object WeakMap]";
2925
+ function isWeakMap(value) {
2926
+ return isObjectLike_default(value) && getTag_default(value) == weakMapTag4;
2927
+ }
2928
+ var isWeakMap_default = isWeakMap;
2929
+
2930
+ // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isWeakSet.js
2931
+ var weakSetTag = "[object WeakSet]";
2932
+ function isWeakSet(value) {
2933
+ return isObjectLike_default(value) && baseGetTag_default(value) == weakSetTag;
2934
+ }
2935
+ var isWeakSet_default = isWeakSet;
2936
+
2919
2937
  // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/join.js
2920
2938
  var arrayProto2 = Array.prototype;
2921
2939
  var nativeJoin = arrayProto2.join;
@@ -3093,6 +3111,161 @@ function uniqWith(array, comparator) {
3093
3111
  }
3094
3112
  var uniqWith_default = uniqWith;
3095
3113
 
3114
+ // src/is/index.ts
3115
+ var isBrowser = () => typeof window !== "undefined";
3116
+ var isWeex = () => typeof WXEnvironment !== "undefined" && !!WXEnvironment.platform;
3117
+ var weexPlatform = () => isWeex() && WXEnvironment.platform.toLowerCase();
3118
+ var UA = () => isBrowser() && window.navigator.userAgent.toLowerCase() || "";
3119
+ var isIE = () => UA() && /msie|trident/.test(UA());
3120
+ var isIE9 = () => UA() && UA().indexOf("msie 9.0") > 0;
3121
+ var isIE11 = () => isBrowser() && navigator.userAgent.includes("Trident") && navigator.userAgent.includes("rv:11.0");
3122
+ var isEdge = () => UA() && UA().indexOf("edge/") > 0;
3123
+ var isAndroid = () => UA() && UA().indexOf("android") > 0 || weexPlatform() === "android";
3124
+ var isIOS = () => UA() && /iphone|ipad|ipod|ios/.test(UA()) || weexPlatform() === "ios";
3125
+ var isChrome = () => UA() && /chrome\/\d+/.test(UA()) && !isEdge();
3126
+ var isPhantomJS = () => UA() && /phantomjs/.test(UA());
3127
+ var isFF = () => typeof UA() === "string" && UA().match(/firefox\/(\d+)/);
3128
+ var isMobile = () => isBrowser() && navigator.userAgent.toLowerCase().includes("mobile");
3129
+ var isFormData = (value) => isObject_default(value) && isBrowser() && value instanceof FormData;
3130
+ var isWindow = (value) => typeof window !== "undefined" && toString.call(value) === "[object Window]";
3131
+ var isTruthy = (value) => Boolean(value);
3132
+
3133
+ // ../../node_modules/.pnpm/change-case@5.4.4/node_modules/change-case/dist/index.js
3134
+ var SPLIT_LOWER_UPPER_RE = /([\p{Ll}\d])(\p{Lu})/gu;
3135
+ var SPLIT_UPPER_UPPER_RE = /(\p{Lu})([\p{Lu}][\p{Ll}])/gu;
3136
+ var SPLIT_SEPARATE_NUMBER_RE = /(\d)\p{Ll}|(\p{L})\d/u;
3137
+ var DEFAULT_STRIP_REGEXP = /[^\p{L}\d]+/giu;
3138
+ var SPLIT_REPLACE_VALUE = "$1\0$2";
3139
+ var DEFAULT_PREFIX_SUFFIX_CHARACTERS = "";
3140
+ function split(value) {
3141
+ let result = value.trim();
3142
+ result = result.replace(SPLIT_LOWER_UPPER_RE, SPLIT_REPLACE_VALUE).replace(SPLIT_UPPER_UPPER_RE, SPLIT_REPLACE_VALUE);
3143
+ result = result.replace(DEFAULT_STRIP_REGEXP, "\0");
3144
+ let start = 0;
3145
+ let end = result.length;
3146
+ while (result.charAt(start) === "\0")
3147
+ start++;
3148
+ if (start === end)
3149
+ return [];
3150
+ while (result.charAt(end - 1) === "\0")
3151
+ end--;
3152
+ return result.slice(start, end).split(/\0/g);
3153
+ }
3154
+ function splitSeparateNumbers(value) {
3155
+ const words = split(value);
3156
+ for (let i = 0; i < words.length; i++) {
3157
+ const word = words[i];
3158
+ const match = SPLIT_SEPARATE_NUMBER_RE.exec(word);
3159
+ if (match) {
3160
+ const offset = match.index + (match[1] ?? match[2]).length;
3161
+ words.splice(i, 1, word.slice(0, offset), word.slice(offset));
3162
+ }
3163
+ }
3164
+ return words;
3165
+ }
3166
+ function noCase(input, options) {
3167
+ const [prefix, words, suffix] = splitPrefixSuffix(input, options);
3168
+ return prefix + words.map(lowerFactory(options?.locale)).join(options?.delimiter ?? " ") + suffix;
3169
+ }
3170
+ function camelCase(input, options) {
3171
+ const [prefix, words, suffix] = splitPrefixSuffix(input, options);
3172
+ const lower = lowerFactory(options?.locale);
3173
+ const upper = upperFactory(options?.locale);
3174
+ const transform = options?.mergeAmbiguousCharacters ? capitalCaseTransformFactory(lower, upper) : pascalCaseTransformFactory(lower, upper);
3175
+ return prefix + words.map((word, index) => {
3176
+ if (index === 0)
3177
+ return lower(word);
3178
+ return transform(word, index);
3179
+ }).join(options?.delimiter ?? "") + suffix;
3180
+ }
3181
+ function pascalCase(input, options) {
3182
+ const [prefix, words, suffix] = splitPrefixSuffix(input, options);
3183
+ const lower = lowerFactory(options?.locale);
3184
+ const upper = upperFactory(options?.locale);
3185
+ const transform = options?.mergeAmbiguousCharacters ? capitalCaseTransformFactory(lower, upper) : pascalCaseTransformFactory(lower, upper);
3186
+ return prefix + words.map(transform).join(options?.delimiter ?? "") + suffix;
3187
+ }
3188
+ function pascalSnakeCase(input, options) {
3189
+ return capitalCase(input, { delimiter: "_", ...options });
3190
+ }
3191
+ function capitalCase(input, options) {
3192
+ const [prefix, words, suffix] = splitPrefixSuffix(input, options);
3193
+ const lower = lowerFactory(options?.locale);
3194
+ const upper = upperFactory(options?.locale);
3195
+ return prefix + words.map(capitalCaseTransformFactory(lower, upper)).join(options?.delimiter ?? " ") + suffix;
3196
+ }
3197
+ function constantCase(input, options) {
3198
+ const [prefix, words, suffix] = splitPrefixSuffix(input, options);
3199
+ return prefix + words.map(upperFactory(options?.locale)).join(options?.delimiter ?? "_") + suffix;
3200
+ }
3201
+ function dotCase(input, options) {
3202
+ return noCase(input, { delimiter: ".", ...options });
3203
+ }
3204
+ function kebabCase(input, options) {
3205
+ return noCase(input, { delimiter: "-", ...options });
3206
+ }
3207
+ function pathCase(input, options) {
3208
+ return noCase(input, { delimiter: "/", ...options });
3209
+ }
3210
+ function sentenceCase(input, options) {
3211
+ const [prefix, words, suffix] = splitPrefixSuffix(input, options);
3212
+ const lower = lowerFactory(options?.locale);
3213
+ const upper = upperFactory(options?.locale);
3214
+ const transform = capitalCaseTransformFactory(lower, upper);
3215
+ return prefix + words.map((word, index) => {
3216
+ if (index === 0)
3217
+ return transform(word);
3218
+ return lower(word);
3219
+ }).join(options?.delimiter ?? " ") + suffix;
3220
+ }
3221
+ function snakeCase(input, options) {
3222
+ return noCase(input, { delimiter: "_", ...options });
3223
+ }
3224
+ function trainCase(input, options) {
3225
+ return capitalCase(input, { delimiter: "-", ...options });
3226
+ }
3227
+ function lowerFactory(locale) {
3228
+ return locale === false ? (input) => input.toLowerCase() : (input) => input.toLocaleLowerCase(locale);
3229
+ }
3230
+ function upperFactory(locale) {
3231
+ return locale === false ? (input) => input.toUpperCase() : (input) => input.toLocaleUpperCase(locale);
3232
+ }
3233
+ function capitalCaseTransformFactory(lower, upper) {
3234
+ return (word) => `${upper(word[0])}${lower(word.slice(1))}`;
3235
+ }
3236
+ function pascalCaseTransformFactory(lower, upper) {
3237
+ return (word, index) => {
3238
+ const char0 = word[0];
3239
+ const initial = index > 0 && char0 >= "0" && char0 <= "9" ? "_" + char0 : upper(char0);
3240
+ return initial + lower(word.slice(1));
3241
+ };
3242
+ }
3243
+ function splitPrefixSuffix(input, options = {}) {
3244
+ const splitFn = options.split ?? (options.separateNumbers ? splitSeparateNumbers : split);
3245
+ const prefixCharacters = options.prefixCharacters ?? DEFAULT_PREFIX_SUFFIX_CHARACTERS;
3246
+ const suffixCharacters = options.suffixCharacters ?? DEFAULT_PREFIX_SUFFIX_CHARACTERS;
3247
+ let prefixIndex = 0;
3248
+ let suffixIndex = input.length;
3249
+ while (prefixIndex < input.length) {
3250
+ const char = input.charAt(prefixIndex);
3251
+ if (!prefixCharacters.includes(char))
3252
+ break;
3253
+ prefixIndex++;
3254
+ }
3255
+ while (suffixIndex > prefixIndex) {
3256
+ const index = suffixIndex - 1;
3257
+ const char = input.charAt(index);
3258
+ if (!suffixCharacters.includes(char))
3259
+ break;
3260
+ suffixIndex = index;
3261
+ }
3262
+ return [
3263
+ input.slice(0, prefixIndex),
3264
+ splitFn(input.slice(prefixIndex, suffixIndex)),
3265
+ input.slice(suffixIndex)
3266
+ ];
3267
+ }
3268
+
3096
3269
  // src/number/index.ts
3097
3270
  var import_bignumber = __toESM(require("bignumber.js"), 1);
3098
3271
  var BIG_INTS = {
@@ -3101,40 +3274,43 @@ var BIG_INTS = {
3101
3274
  m: { v: 10 ** 6, d: 7, n: "m" },
3102
3275
  k: { v: 10 ** 3, d: 4, n: "k" }
3103
3276
  };
3104
- function BigNum(num = "0") {
3105
- return new import_bignumber.default(numerfix(num));
3277
+ function bignum(n = "0") {
3278
+ return new import_bignumber.default(numfix(n));
3106
3279
  }
3107
- function gte(num, n) {
3108
- return BigNum(num).gte(BigNum(n));
3280
+ function numfix(value) {
3281
+ return Number.isNaN(Number(value)) || value.toString() === "NaN" ? "0" : String(value);
3109
3282
  }
3110
- function gt(num, n) {
3111
- return BigNum(num).gt(BigNum(n));
3283
+ function gte(a, b) {
3284
+ return bignum(a).gte(bignum(b));
3112
3285
  }
3113
- function lte(num, n) {
3114
- return BigNum(num).lte(BigNum(n));
3286
+ function gt(a, b) {
3287
+ return bignum(a).gt(bignum(b));
3115
3288
  }
3116
- function lt(num, n) {
3117
- return BigNum(num).lt(BigNum(n));
3289
+ function lte(a, b) {
3290
+ return bignum(a).lte(bignum(b));
3291
+ }
3292
+ function lt(a, b) {
3293
+ return bignum(a).lt(bignum(b));
3118
3294
  }
3119
3295
  function plus(array, options) {
3120
3296
  const rounding = options?.r || import_bignumber.default.ROUND_DOWN;
3121
3297
  const decimal2 = options?.d || 0;
3122
- return array.filter((v) => BigNum(v).gt(0)).reduce((t, v) => t.plus(BigNum(v)), BigNum(0)).toFixed(decimal2, rounding);
3298
+ return array.filter((v) => bignum(v).gt(0)).reduce((t, v) => t.plus(bignum(v)), bignum(0)).toFixed(decimal2, rounding);
3123
3299
  }
3124
3300
  function average(array, options) {
3125
3301
  const rounding = options?.r || import_bignumber.default.ROUND_DOWN;
3126
3302
  const decimal2 = options?.d || 0;
3127
3303
  if (array.length === 0)
3128
3304
  return "0";
3129
- return BigNum(plus(array)).div(array.length).toFixed(decimal2, rounding);
3305
+ return bignum(plus(array)).div(array.length).toFixed(decimal2, rounding);
3130
3306
  }
3131
3307
  function percentage(total, count, options) {
3132
3308
  options ??= { d: 3, r: import_bignumber.default.ROUND_DOWN };
3133
3309
  const rounding = options?.r || import_bignumber.default.ROUND_DOWN;
3134
3310
  const decimal2 = options?.d || 3;
3135
- if (BigNum(total).lte(0) || BigNum(count).lte(0))
3311
+ if (bignum(total).lte(0) || bignum(count).lte(0))
3136
3312
  return "0";
3137
- return BigNum(count).div(BigNum(total)).times(100).toFixed(decimal2, rounding);
3313
+ return bignum(count).div(bignum(total)).times(100).toFixed(decimal2, rounding);
3138
3314
  }
3139
3315
  function zerofill(value, n = 2, type = "positive") {
3140
3316
  const _value = integer(value);
@@ -3150,15 +3326,11 @@ function zerofill(value, n = 2, type = "positive") {
3150
3326
  function zeromove(value) {
3151
3327
  return value.toString().replace(/\.?0+$/, "");
3152
3328
  }
3153
- function numerfix(value) {
3154
- const _isNaN = Number.isNaN(Number(value)) || value.toString() === "NaN";
3155
- return _isNaN ? "0" : String(value);
3156
- }
3157
3329
  function integer(value) {
3158
- return new import_bignumber.default(numerfix(value)).toFixed(0);
3330
+ return new import_bignumber.default(numfix(value)).toFixed(0);
3159
3331
  }
3160
3332
  function decimal(value, n = 2) {
3161
- let [integer2, decimal2] = numerfix(value).split(".");
3333
+ let [integer2, decimal2] = numfix(value).split(".");
3162
3334
  if (n <= 0)
3163
3335
  return integer2;
3164
3336
  if (!decimal2)
@@ -3176,7 +3348,7 @@ function parseNumeric(num, delimiters = ["t", "b", "m"]) {
3176
3348
  ];
3177
3349
  let options;
3178
3350
  for (const analy of mappings) {
3179
- const opts = analy && analy(BigNum(num).toFixed(0));
3351
+ const opts = analy && analy(bignum(num).toFixed(0));
3180
3352
  opts && (options = opts);
3181
3353
  }
3182
3354
  return options || { v: 1, d: 0, n: "" };
@@ -3189,7 +3361,7 @@ function formatNumeric(value = "0", options) {
3189
3361
  decimals = 2
3190
3362
  } = options || {};
3191
3363
  const config = parseNumeric(value, delimiters || []);
3192
- let number = BigNum(value).div(config.v).toFormat(decimals, rounding, {
3364
+ let number = bignum(value).div(config.v).toFormat(decimals, rounding, {
3193
3365
  decimalSeparator: ".",
3194
3366
  groupSeparator: ",",
3195
3367
  groupSize: 3,
@@ -3224,6 +3396,51 @@ function formatSize(dimension, unit) {
3224
3396
  function cover(value, mode, symbol = "*") {
3225
3397
  return value.slice(0, mode[0]) + symbol.repeat(mode[1]) + value.slice(-mode[2]);
3226
3398
  }
3399
+ function slash(str) {
3400
+ return str.replace(/\\/g, "/");
3401
+ }
3402
+ function ensurePrefix(prefix, str) {
3403
+ if (!str.startsWith(prefix))
3404
+ return prefix + str;
3405
+ return str;
3406
+ }
3407
+ function ensureSuffix(suffix, str) {
3408
+ if (!str.endsWith(suffix))
3409
+ return str + suffix;
3410
+ return str;
3411
+ }
3412
+ function template(str, ...args) {
3413
+ const [firstArg, fallback] = args;
3414
+ if (isObject_default(firstArg)) {
3415
+ const vars = firstArg;
3416
+ return str.replace(/\{(\w+)\}/g, (_, key) => vars[key] || ((typeof fallback === "function" ? fallback(key) : fallback) ?? key));
3417
+ } else {
3418
+ return str.replace(/\{(\d+)\}/g, (_, key) => {
3419
+ const index = Number(key);
3420
+ if (Number.isNaN(index))
3421
+ return key;
3422
+ return args[index];
3423
+ });
3424
+ }
3425
+ }
3426
+ var _reFullWs = /^\s*$/;
3427
+ function unindent(str) {
3428
+ const lines = (typeof str === "string" ? str : str[0]).split("\n");
3429
+ const whitespaceLines = lines.map((line) => _reFullWs.test(line));
3430
+ const commonIndent = lines.reduce((min, line, idx) => {
3431
+ if (whitespaceLines[idx])
3432
+ return min;
3433
+ const indent = line.match(/^\s*/)?.[0].length;
3434
+ return indent === void 0 ? min : Math.min(min, indent);
3435
+ }, Number.POSITIVE_INFINITY);
3436
+ let emptyLinesHead = 0;
3437
+ while (emptyLinesHead < lines.length && whitespaceLines[emptyLinesHead])
3438
+ emptyLinesHead++;
3439
+ let emptyLinesTail = 0;
3440
+ while (emptyLinesTail < lines.length && whitespaceLines[lines.length - emptyLinesTail - 1])
3441
+ emptyLinesTail++;
3442
+ return lines.slice(emptyLinesHead, lines.length - emptyLinesTail).map((line) => line.slice(commonIndent)).join("\n");
3443
+ }
3227
3444
 
3228
3445
  // src/typeof/index.ts
3229
3446
  function getTypeof(target) {
@@ -3294,25 +3511,6 @@ function delay(ms) {
3294
3511
  return new Promise((resolve) => setTimeout(resolve, ms));
3295
3512
  }
3296
3513
 
3297
- // src/util/is.ts
3298
- var isBrowser = () => typeof window !== "undefined";
3299
- var isWeex = () => typeof WXEnvironment !== "undefined" && !!WXEnvironment.platform;
3300
- var weexPlatform = () => isWeex() && WXEnvironment.platform.toLowerCase();
3301
- var UA = () => isBrowser() && window.navigator.userAgent.toLowerCase() || "";
3302
- var isIE = () => UA() && /msie|trident/.test(UA());
3303
- var isIE9 = () => UA() && UA().indexOf("msie 9.0") > 0;
3304
- var isIE11 = () => isBrowser() && navigator.userAgent.includes("Trident") && navigator.userAgent.includes("rv:11.0");
3305
- var isEdge = () => UA() && UA().indexOf("edge/") > 0;
3306
- var isAndroid = () => UA() && UA().indexOf("android") > 0 || weexPlatform() === "android";
3307
- var isIOS = () => UA() && /iphone|ipad|ipod|ios/.test(UA()) || weexPlatform() === "ios";
3308
- var isChrome = () => UA() && /chrome\/\d+/.test(UA()) && !isEdge();
3309
- var isPhantomJS = () => UA() && /phantomjs/.test(UA());
3310
- var isFF = () => typeof UA() === "string" && UA().match(/firefox\/(\d+)/);
3311
- var isMobile = () => isBrowser() && navigator.userAgent.toLowerCase().includes("mobile");
3312
- var isFormData = (value) => isObject_default(value) && isBrowser() && value instanceof FormData;
3313
- var isWindow = (value) => typeof window !== "undefined" && toString.call(value) === "[object Window]";
3314
- var isTruthy = (value) => Boolean(value);
3315
-
3316
3514
  // src/util/json.ts
3317
3515
  function jsonTryParse(text) {
3318
3516
  try {
@@ -3395,12 +3593,21 @@ proxy.resolve = (target) => {
3395
3593
  };
3396
3594
 
3397
3595
  // src/util/random.ts
3398
- function randomNumer(min, max) {
3399
- return Math.random() * (max - min) + min;
3400
- }
3401
3596
  function randomArray(array) {
3402
3597
  return array[Math.floor(Math.random() * array.length)];
3403
3598
  }
3599
+ function randomNumber(min, max) {
3600
+ return Math.random() * (max - min) + min;
3601
+ }
3602
+ var urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
3603
+ function randomString(size, chars = urlAlphabet) {
3604
+ let id = "";
3605
+ let i = size;
3606
+ const len = chars.length;
3607
+ while (i--)
3608
+ id += chars[Math.random() * len | 0];
3609
+ return id;
3610
+ }
3404
3611
 
3405
3612
  // src/util/to.ts
3406
3613
  async function to(promise, error) {
@@ -3434,14 +3641,18 @@ function unwrap(value) {
3434
3641
  function whenever(value, callback) {
3435
3642
  return value ? callback(value) : void 0;
3436
3643
  }
3644
+ function call(fn, ...args) {
3645
+ return fn(...args);
3646
+ }
3437
3647
  // Annotate the CommonJS export names for ESM import in node:
3438
3648
  0 && (module.exports = {
3439
3649
  BIG_INTS,
3440
- BigNum,
3441
3650
  Bignumber,
3442
3651
  Deferred,
3443
3652
  arange,
3444
3653
  average,
3654
+ bignum,
3655
+ call,
3445
3656
  camelCase,
3446
3657
  capitalCase,
3447
3658
  clone,
@@ -3459,25 +3670,34 @@ function whenever(value, callback) {
3459
3670
  dotCase,
3460
3671
  downloadBlobFile,
3461
3672
  downloadNetworkFile,
3673
+ ensurePrefix,
3674
+ ensureSuffix,
3462
3675
  find,
3463
3676
  formToObject,
3464
3677
  formatNumeric,
3465
3678
  formatSize,
3466
3679
  formatUnit,
3467
3680
  getTypeof,
3681
+ groupBy,
3468
3682
  gt,
3469
3683
  gte,
3470
3684
  integer,
3471
3685
  isAndroid,
3686
+ isArguments,
3472
3687
  isArray,
3688
+ isArrayBuffer,
3473
3689
  isArrayLike,
3690
+ isArrayLikeObject,
3474
3691
  isBoolean,
3475
3692
  isBrowser,
3693
+ isBuffer,
3476
3694
  isChrome,
3477
3695
  isDate,
3478
3696
  isEdge,
3697
+ isElement,
3479
3698
  isEmpty,
3480
3699
  isEqual,
3700
+ isEqualWith,
3481
3701
  isError,
3482
3702
  isFF,
3483
3703
  isFormData,
@@ -3486,18 +3706,28 @@ function whenever(value, callback) {
3486
3706
  isIE11,
3487
3707
  isIE9,
3488
3708
  isIOS,
3709
+ isInteger,
3710
+ isMap,
3711
+ isMatch,
3712
+ isMatchWith,
3489
3713
  isMobile,
3490
3714
  isNaN,
3491
3715
  isNative,
3492
3716
  isNull,
3493
3717
  isNumber,
3494
3718
  isObject,
3719
+ isObjectLike,
3495
3720
  isPhantomJS,
3496
3721
  isPlainObject,
3722
+ isRegexp,
3723
+ isSet,
3497
3724
  isString,
3725
+ isSymbol,
3498
3726
  isTruthy,
3499
3727
  isTypeof,
3500
3728
  isUndefined,
3729
+ isWeakMap,
3730
+ isWeakSet,
3501
3731
  isWeex,
3502
3732
  isWindow,
3503
3733
  join,
@@ -3511,7 +3741,7 @@ function whenever(value, callback) {
3511
3741
  mergeWith,
3512
3742
  noCase,
3513
3743
  noop,
3514
- numerfix,
3744
+ numfix,
3515
3745
  objectToForm,
3516
3746
  off,
3517
3747
  on,
@@ -3524,7 +3754,8 @@ function whenever(value, callback) {
3524
3754
  plus,
3525
3755
  proxy,
3526
3756
  randomArray,
3527
- randomNumer,
3757
+ randomNumber,
3758
+ randomString,
3528
3759
  readFileReader,
3529
3760
  redirectTo,
3530
3761
  riposte,
@@ -3532,10 +3763,13 @@ function whenever(value, callback) {
3532
3763
  sentenceCase,
3533
3764
  showOpenFilePicker,
3534
3765
  showOpenImagePicker,
3766
+ slash,
3535
3767
  snakeCase,
3768
+ template,
3536
3769
  to,
3537
3770
  trainCase,
3538
3771
  truncate,
3772
+ unindent,
3539
3773
  uniq,
3540
3774
  uniqBy,
3541
3775
  uniqWith,