@lowentry/utils 2.0.4 → 2.0.6

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.js CHANGED
@@ -1,13 +1,3101 @@
1
- // Main entry point for @lowentry/utils
2
- // eslint-disable-next-line @typescript-eslint/naming-convention
3
- import * as LeUtilsFunctions from './LeUtils';
4
- export * from './LeTypes';
5
- export * from './LeUtils';
6
- export * from './classes/EventEmitter';
7
- export * from './classes/LinkedList';
8
- export * from './classes/SerializableMap';
9
- export * from './classes/TreeSet';
10
- export const LeUtils = {
11
- ...LeUtilsFunctions,
1
+ var __defProp = Object.defineProperty;
2
+ var __export = (target, all) => {
3
+ for (var name in all)
4
+ __defProp(target, name, { get: all[name], enumerable: true });
5
+ };
6
+
7
+ // src/LeUtils.ts
8
+ var LeUtils_exports = {};
9
+ __export(LeUtils_exports, {
10
+ atob: () => atob,
11
+ base64ToBytes: () => base64ToBytes,
12
+ base64ToHex: () => base64ToHex,
13
+ base64ToUtf8: () => base64ToUtf8,
14
+ btoa: () => btoa,
15
+ bytesToBase64: () => bytesToBase64,
16
+ cachedFetch: () => cachedFetch,
17
+ capitalize: () => capitalize,
18
+ clone: () => clone,
19
+ compare: () => compare,
20
+ compareNaturalStrings: () => compareNaturalStrings,
21
+ compareNumbers: () => compareNumbers,
22
+ compareNumericStrings: () => compareNumericStrings,
23
+ compareTimestampStrings: () => compareTimestampStrings,
24
+ contains: () => contains,
25
+ containsAll: () => containsAll,
26
+ containsAllCaseInsensitive: () => containsAllCaseInsensitive,
27
+ containsAny: () => containsAny,
28
+ containsAnyCaseInsensitive: () => containsAnyCaseInsensitive,
29
+ containsCaseInsensitive: () => containsCaseInsensitive,
30
+ containsNone: () => containsNone,
31
+ containsNoneCaseInsensitive: () => containsNoneCaseInsensitive,
32
+ createTransactionalValue: () => createTransactionalValue,
33
+ createWorkerThread: () => createWorkerThread,
34
+ downloadFile: () => downloadFile,
35
+ each: () => each,
36
+ eachAsync: () => eachAsync,
37
+ eachIterator: () => eachIterator,
38
+ endsWithAny: () => endsWithAny,
39
+ equals: () => equals,
40
+ equalsMapLike: () => equalsMapLike,
41
+ fetch: () => fetch,
42
+ filter: () => filter,
43
+ find: () => find,
44
+ findIndex: () => findIndex,
45
+ findIndexValue: () => findIndexValue,
46
+ flattenArray: () => flattenArray,
47
+ flattenToArray: () => flattenToArray,
48
+ generateNamePermutations: () => generateNamePermutations,
49
+ getColoredImage: () => getColoredImage,
50
+ getDifferenceBetweenLab: () => getDifferenceBetweenLab,
51
+ getDifferenceBetweenRgb: () => getDifferenceBetweenRgb,
52
+ getEmptyImageSrc: () => getEmptyImageSrc,
53
+ getEmptySimplifiedCollection: () => getEmptySimplifiedCollection,
54
+ getImagePixels: () => getImagePixels,
55
+ getObjectFieldsCount: () => getObjectFieldsCount,
56
+ getPercentage: () => getPercentage,
57
+ getRgbBetween: () => getRgbBetween,
58
+ getRgbOfGradient: () => getRgbOfGradient,
59
+ getUserLocale: () => getUserLocale,
60
+ getUserLocaleDateFormat: () => getUserLocaleDateFormat,
61
+ getValueAtIndex: () => getValueAtIndex,
62
+ hexToBase64: () => hexToBase64,
63
+ hexToRgb: () => hexToRgb,
64
+ hslToRgb: () => hslToRgb,
65
+ increaseNumericStringByOne: () => increaseNumericStringByOne,
66
+ isCurrentHostPrivate: () => isCurrentHostPrivate,
67
+ isEmptyObject: () => isEmptyObject,
68
+ isFocusClear: () => isFocusClear,
69
+ isGeneratorFunction: () => isGeneratorFunction,
70
+ isGivenHostPrivate: () => isGivenHostPrivate,
71
+ isTransactionalValueValid: () => isTransactionalValueValid,
72
+ localStorageGet: () => localStorageGet,
73
+ localStorageRemove: () => localStorageRemove,
74
+ localStorageSet: () => localStorageSet,
75
+ map: () => map,
76
+ mapToArray: () => mapToArray,
77
+ mapToArraySorted: () => mapToArraySorted,
78
+ onDomReady: () => onDomReady,
79
+ parseVersionString: () => parseVersionString,
80
+ platformHasCursor: () => platformHasCursor,
81
+ platformIsMobile: () => platformIsMobile,
82
+ promiseAnimationFrameTimeout: () => promiseAnimationFrameTimeout,
83
+ promiseTimeout: () => promiseTimeout,
84
+ purgeEmail: () => purgeEmail,
85
+ purgeErrorMessage: () => purgeErrorMessage,
86
+ purgeSentence: () => purgeSentence,
87
+ rgbToHex: () => rgbToHex,
88
+ rgbToHsl: () => rgbToHsl,
89
+ rgbToLab: () => rgbToLab,
90
+ sendWorkerMessage: () => sendWorkerMessage,
91
+ setAnimationFrameInterval: () => setAnimationFrameInterval,
92
+ setAnimationFrameTimeout: () => setAnimationFrameTimeout,
93
+ setInterval: () => setInterval,
94
+ setTimeout: () => setTimeout,
95
+ sortKeys: () => sortKeys,
96
+ startsWithAny: () => startsWithAny,
97
+ supportsEach: () => supportsEach,
98
+ timestamp: () => timestamp,
99
+ transactionCancelChange: () => transactionCancelChange,
100
+ transactionCommitChange: () => transactionCommitChange,
101
+ transactionGetCommittedValue: () => transactionGetCommittedValue,
102
+ transactionGetValue: () => transactionGetValue,
103
+ transactionIsChangeRelevant: () => transactionIsChangeRelevant,
104
+ transactionSetAndCommit: () => transactionSetAndCommit,
105
+ transactionSetWithoutCommitting: () => transactionSetWithoutCommitting,
106
+ transactionalValueToString: () => transactionalValueToString,
107
+ trim: () => trim,
108
+ trimEnd: () => trimEnd,
109
+ trimStart: () => trimStart,
110
+ uniqueId: () => uniqueId,
111
+ utf8ToBase64: () => utf8ToBase64
112
+ });
113
+
114
+ // src/LeTypes.ts
115
+ function ISSET(value) {
116
+ return value !== null && typeof value !== "undefined";
117
+ }
118
+ function STRING(value) {
119
+ if (!ISSET(value)) {
120
+ return "";
121
+ }
122
+ if (typeof value === "string") {
123
+ return value;
124
+ }
125
+ if (typeof value === "number" || typeof value === "boolean") {
126
+ return String(value);
127
+ }
128
+ if (typeof value === "symbol") {
129
+ return value.description ?? "";
130
+ }
131
+ if (typeof value === "bigint") {
132
+ return value.toString();
133
+ }
134
+ try {
135
+ if (typeof value === "object" && value !== null) {
136
+ if (Object.getPrototypeOf(value) === null) {
137
+ if ("toString" in value && typeof value.toString === "function" && value.toString !== Object.prototype.toString) {
138
+ try {
139
+ const result = value.toString();
140
+ if (typeof result === "string") {
141
+ return result;
142
+ }
143
+ } catch {
144
+ }
145
+ }
146
+ return "";
147
+ }
148
+ return String(value);
149
+ }
150
+ return String(value);
151
+ } catch {
152
+ return "";
153
+ }
154
+ }
155
+ function IS_ARRAY(value) {
156
+ return Array.isArray(value);
157
+ }
158
+ function ARRAY(value) {
159
+ if (Array.isArray(value)) {
160
+ return value;
161
+ }
162
+ if (typeof value === "undefined") {
163
+ return [];
164
+ }
165
+ return [value];
166
+ }
167
+ function IS_OBJECT(value) {
168
+ return typeof value === "object" && value !== null && !Array.isArray(value);
169
+ }
170
+ function OBJECT(value) {
171
+ if (IS_OBJECT(value)) {
172
+ return value;
173
+ }
174
+ return {};
175
+ }
176
+ function FLOAT(value) {
177
+ if (typeof value === "symbol") {
178
+ const v2 = Number(value.description ?? "");
179
+ return isNaN(v2) ? 0 : v2;
180
+ }
181
+ if (typeof value === "bigint") {
182
+ if (value > BigInt(Number.MAX_SAFE_INTEGER)) {
183
+ return Number.MAX_SAFE_INTEGER;
184
+ }
185
+ if (value < BigInt(Number.MIN_SAFE_INTEGER)) {
186
+ return Number.MIN_SAFE_INTEGER;
187
+ }
188
+ return Number(value);
189
+ }
190
+ const v = Number(value);
191
+ if (!isNaN(v)) {
192
+ return v;
193
+ }
194
+ return 0;
195
+ }
196
+ function INT(value) {
197
+ return Math.round(FLOAT(value));
198
+ }
199
+ function STRING_ANY(...values) {
200
+ for (const value of values) {
201
+ if (ISSET(value)) {
202
+ return STRING(value);
203
+ }
204
+ }
205
+ return "";
206
+ }
207
+ function FLOAT_ANY(...values) {
208
+ for (const value of values) {
209
+ if (ISSET(value)) {
210
+ const v = FLOAT(value);
211
+ if (v !== 0 || value === 0 || value === "0") {
212
+ return v;
213
+ }
214
+ }
215
+ }
216
+ return 0;
217
+ }
218
+ function INT_ANY(...values) {
219
+ return Math.round(FLOAT_ANY(...values));
220
+ }
221
+ function BOOL(value) {
222
+ return BOOL_ANY(value);
223
+ }
224
+ function BOOL_ANY(...values) {
225
+ for (const value of values) {
226
+ if (!ISSET(value)) {
227
+ continue;
228
+ }
229
+ if (typeof value === "boolean") {
230
+ return value;
231
+ }
232
+ if (typeof value === "number") {
233
+ if (!isNaN(value)) {
234
+ return value !== 0;
235
+ }
236
+ return false;
237
+ }
238
+ if (typeof value === "string") {
239
+ const s = value.toLowerCase().trim();
240
+ if (s === "" || s === "false" || s === "no" || s === "off" || s === "0") {
241
+ return false;
242
+ }
243
+ if (s === "true" || s === "yes" || s === "on" || s === "1") {
244
+ return true;
245
+ }
246
+ const float = Number(s);
247
+ if (!isNaN(float)) {
248
+ return float !== 0;
249
+ }
250
+ continue;
251
+ }
252
+ if (Array.isArray(value) || typeof value === "object" && value !== null) {
253
+ return true;
254
+ }
255
+ }
256
+ return false;
257
+ }
258
+ var REGEX_ALL_NON_FLOAT_CHARACTERS = /[^0-9.-]/g;
259
+ function FLOAT_LAX(value) {
260
+ if (typeof value === "number") {
261
+ return isNaN(value) ? 0 : value;
262
+ }
263
+ const s = STRING(value).replace(REGEX_ALL_NON_FLOAT_CHARACTERS, "");
264
+ if (s === "") {
265
+ return 0;
266
+ }
267
+ const v = parseFloat(s);
268
+ if (!isNaN(v)) {
269
+ return v;
270
+ }
271
+ return 0;
272
+ }
273
+ function INT_LAX(value) {
274
+ return Math.round(FLOAT_LAX(value));
275
+ }
276
+ function FLOAT_LAX_ANY(...values) {
277
+ for (const value of values) {
278
+ if (ISSET(value)) {
279
+ const v = FLOAT_LAX(value);
280
+ if (v !== 0 || value === 0 || value === "0") {
281
+ return v;
282
+ }
283
+ }
284
+ }
285
+ return 0;
286
+ }
287
+ function INT_LAX_ANY(...values) {
288
+ return Math.round(FLOAT_LAX_ANY(...values));
289
+ }
290
+
291
+ // src/LeUtils.ts
292
+ function safeGetProperty(obj, prop) {
293
+ if (typeof obj !== "object" && typeof obj !== "function" || obj === null) {
294
+ return void 0;
295
+ }
296
+ if (!(prop in obj)) {
297
+ return void 0;
298
+ }
299
+ const desc = Object.getOwnPropertyDescriptor(obj, prop);
300
+ if (desc === void 0) {
301
+ return obj[prop];
302
+ }
303
+ return desc.value;
304
+ }
305
+ function hasNumericLength(val) {
306
+ if (typeof val !== "object" && typeof val !== "function" || val === null) {
307
+ return false;
308
+ }
309
+ if (!("length" in val)) {
310
+ return false;
311
+ }
312
+ const lengthValue = safeGetProperty(val, "length");
313
+ if (typeof lengthValue !== "number") {
314
+ return false;
315
+ }
316
+ return true;
317
+ }
318
+ function isDataViewLike(val) {
319
+ if (typeof val !== "object" && typeof val !== "function" || val === null) {
320
+ return false;
321
+ }
322
+ if (!("byteLength" in val) || !("getUint8" in val)) {
323
+ return false;
324
+ }
325
+ const byteLengthValue = safeGetProperty(val, "byteLength");
326
+ const getUint8Value = safeGetProperty(val, "getUint8");
327
+ if (typeof byteLengthValue !== "number" || typeof getUint8Value !== "function") {
328
+ return false;
329
+ }
330
+ return true;
331
+ }
332
+ function isRegExp(val) {
333
+ return val instanceof RegExp;
334
+ }
335
+ function isRecordLike(val) {
336
+ return (typeof val === "object" || typeof val === "function") && val !== null && !Array.isArray(val) && !(val instanceof Map) && !(val instanceof Set);
337
+ }
338
+ function isUnknownArray(val) {
339
+ return Array.isArray(val);
340
+ }
341
+ function isMapLike(val) {
342
+ return val instanceof Map;
343
+ }
344
+ function isSetLike(val) {
345
+ return val instanceof Set;
346
+ }
347
+ function isArrayBufferView(val) {
348
+ return ArrayBuffer.isView(val);
349
+ }
350
+ function hasConstructor(val) {
351
+ if (typeof val !== "object" && typeof val !== "function" || val === null) {
352
+ return false;
353
+ }
354
+ const constructorValue = safeGetProperty(val, "constructor");
355
+ return typeof constructorValue === "function";
356
+ }
357
+ function isIterable(val) {
358
+ if (typeof val !== "object" && typeof val !== "function" || val === null) {
359
+ return false;
360
+ }
361
+ if (!(Symbol.iterator in val)) {
362
+ return false;
363
+ }
364
+ const desc = Object.getOwnPropertyDescriptor(val, Symbol.iterator);
365
+ if (desc === void 0) {
366
+ return typeof val[Symbol.iterator] === "function";
367
+ }
368
+ return typeof desc.value === "function";
369
+ }
370
+ function hasForEach(val) {
371
+ if (typeof val !== "object" || val === null) {
372
+ return false;
373
+ }
374
+ const forEach = safeGetProperty(val, "forEach");
375
+ return typeof forEach === "function";
376
+ }
377
+ function isPlainObject(val) {
378
+ if (typeof val !== "object" || val === null) {
379
+ return false;
380
+ }
381
+ const constructor = safeGetProperty(val, "constructor");
382
+ return constructor === Object;
383
+ }
384
+ function isPair(val) {
385
+ if (!Array.isArray(val)) {
386
+ return false;
387
+ }
388
+ return val.length === 2;
389
+ }
390
+ function isPromise(val) {
391
+ if (typeof val !== "object" || val === null) {
392
+ return false;
393
+ }
394
+ const then = safeGetProperty(val, "then");
395
+ return typeof then === "function";
396
+ }
397
+ function isTransactionalValue(val) {
398
+ if (typeof val !== "object" || val === null) {
399
+ return false;
400
+ }
401
+ if (!("value" in val)) {
402
+ return false;
403
+ }
404
+ if (!("changes" in val)) {
405
+ return false;
406
+ }
407
+ const changes = safeGetProperty(val, "changes");
408
+ if (!Array.isArray(changes)) {
409
+ return false;
410
+ }
411
+ return true;
412
+ }
413
+ function hasPerformanceTiming(perf) {
414
+ if (typeof perf !== "object" || perf === null) {
415
+ return false;
416
+ }
417
+ return true;
418
+ }
419
+ function hasSetTimeout(global) {
420
+ if (typeof global !== "object" || global === null) {
421
+ return false;
422
+ }
423
+ const setTimeout2 = safeGetProperty(global, "setTimeout");
424
+ return typeof setTimeout2 === "function";
425
+ }
426
+ function hasSetInterval(global) {
427
+ if (typeof global !== "object" || global === null) {
428
+ return false;
429
+ }
430
+ const setInterval2 = safeGetProperty(global, "setInterval");
431
+ return typeof setInterval2 === "function";
432
+ }
433
+ function isNumberArray(val) {
434
+ if (!Array.isArray(val)) {
435
+ return false;
436
+ }
437
+ return val.every((item) => typeof item === "number");
438
+ }
439
+ function hasNavigatorVendor(nav) {
440
+ if (typeof nav !== "object" || nav === null) {
441
+ return false;
442
+ }
443
+ return true;
444
+ }
445
+ function hasOpera(global) {
446
+ if (typeof global !== "object" || global === null) {
447
+ return false;
448
+ }
449
+ return true;
450
+ }
451
+ function hasNavigatorLanguages(nav) {
452
+ if (typeof nav !== "object" || nav === null) {
453
+ return false;
454
+ }
455
+ return true;
456
+ }
457
+ function hasIntl(global) {
458
+ if (typeof global !== "object" || global === null) {
459
+ return false;
460
+ }
461
+ return true;
462
+ }
463
+ function hasId(obj) {
464
+ if (typeof obj !== "object" || obj === null) {
465
+ return false;
466
+ }
467
+ const id = safeGetProperty(obj, "id");
468
+ return typeof id === "string";
469
+ }
470
+ function hasSendMessage(worker) {
471
+ if (typeof worker !== "object" || worker === null) {
472
+ return false;
473
+ }
474
+ const sendMessage = safeGetProperty(worker, "sendMessage");
475
+ return typeof sendMessage === "function";
476
+ }
477
+ function hasErrorMessage(err) {
478
+ if (typeof err !== "object" || err === null) {
479
+ return false;
480
+ }
481
+ const message = safeGetProperty(err, "message");
482
+ return typeof message === "string";
483
+ }
484
+ function isVersionObject(version) {
485
+ if (!IS_OBJECT(version)) {
486
+ return false;
487
+ }
488
+ const major = safeGetProperty(version, "major");
489
+ const minor = safeGetProperty(version, "minor");
490
+ const patch = safeGetProperty(version, "patch");
491
+ return major !== void 0 && minor !== void 0 && patch !== void 0;
492
+ }
493
+ function numberToBytes(num) {
494
+ const size = num === 0 ? 0 : Math.ceil((Math.floor(Math.log2(num)) + 1) / 8);
495
+ const bytes = new Uint8ClampedArray(size);
496
+ let x = num;
497
+ for (let i = size - 1; i >= 0; i--) {
498
+ const rightByte = x & 255;
499
+ bytes[i] = rightByte;
500
+ x = Math.floor(x / 256);
501
+ }
502
+ return bytes;
503
+ }
504
+ function equals(a, b) {
505
+ const seen = /* @__PURE__ */ new WeakSet();
506
+ function recursiveEquals(valA, valB) {
507
+ if (valA === valB) {
508
+ return true;
509
+ }
510
+ if (valA && valB && typeof valA === "object" && typeof valB === "object") {
511
+ if (seen.has(valA)) {
512
+ return true;
513
+ }
514
+ seen.add(valA);
515
+ const constructorAValue = safeGetProperty(valA, "constructor");
516
+ const constructorBValue = safeGetProperty(valB, "constructor");
517
+ if (constructorAValue !== constructorBValue) {
518
+ return false;
519
+ }
520
+ if (Array.isArray(valA)) {
521
+ if (!Array.isArray(valB)) {
522
+ return false;
523
+ }
524
+ const length2 = valA.length;
525
+ if (length2 !== valB.length) {
526
+ return false;
527
+ }
528
+ for (let i = length2; i-- !== 0; ) {
529
+ if (!recursiveEquals(valA[i], valB[i])) {
530
+ return false;
531
+ }
532
+ }
533
+ return true;
534
+ }
535
+ if (valA instanceof Map && valB instanceof Map) {
536
+ if (valA.size !== valB.size) {
537
+ return false;
538
+ }
539
+ for (const [keyA, valueA] of valA.entries()) {
540
+ let found = false;
541
+ let valueB;
542
+ if (valB.has(keyA)) {
543
+ found = true;
544
+ valueB = valB.get(keyA);
545
+ } else {
546
+ for (const [keyB, vb] of valB.entries()) {
547
+ if (recursiveEquals(keyA, keyB)) {
548
+ found = true;
549
+ valueB = vb;
550
+ break;
551
+ }
552
+ }
553
+ }
554
+ if (!found || !recursiveEquals(valueA, valueB)) {
555
+ return false;
556
+ }
557
+ }
558
+ return true;
559
+ }
560
+ if (valA instanceof Set && valB instanceof Set) {
561
+ if (valA.size !== valB.size) {
562
+ return false;
563
+ }
564
+ for (const itemA of valA) {
565
+ if (valB.has(itemA)) {
566
+ continue;
567
+ }
568
+ let found = false;
569
+ for (const itemB of valB) {
570
+ if (recursiveEquals(itemA, itemB)) {
571
+ found = true;
572
+ break;
573
+ }
574
+ }
575
+ if (!found) {
576
+ return false;
577
+ }
578
+ }
579
+ return true;
580
+ }
581
+ if (ArrayBuffer.isView(valA) && ArrayBuffer.isView(valB)) {
582
+ if (hasNumericLength(valA) && hasNumericLength(valB)) {
583
+ const lengthA = valA.length;
584
+ const lengthB = valB.length;
585
+ if (lengthA !== lengthB) {
586
+ return false;
587
+ }
588
+ const a2 = valA;
589
+ const b2 = valB;
590
+ for (let i = lengthA; i-- !== 0; ) {
591
+ if (a2[i] !== b2[i]) {
592
+ return false;
593
+ }
594
+ }
595
+ return true;
596
+ }
597
+ if (isDataViewLike(valA) && isDataViewLike(valB)) {
598
+ const byteLengthA = valA.byteLength;
599
+ const byteLengthB = valB.byteLength;
600
+ if (byteLengthA !== byteLengthB) {
601
+ return false;
602
+ }
603
+ for (let i = byteLengthA; i-- !== 0; ) {
604
+ if (valA.getUint8(i) !== valB.getUint8(i)) {
605
+ return false;
606
+ }
607
+ }
608
+ return true;
609
+ }
610
+ return false;
611
+ }
612
+ if (isRegExp(valA)) {
613
+ if (!isRegExp(valB)) {
614
+ return false;
615
+ }
616
+ return valA.source === valB.source && valA.flags === valB.flags;
617
+ }
618
+ const valueOfA = safeGetProperty(valA, "valueOf");
619
+ if (typeof valueOfA === "function" && valueOfA !== Object.prototype.valueOf) {
620
+ try {
621
+ const valueOfB = safeGetProperty(valB, "valueOf");
622
+ if (typeof valueOfB === "function" && valueOfB !== Object.prototype.valueOf) {
623
+ const resultA = Function.prototype.call.call(valueOfA, valA);
624
+ const resultB = Function.prototype.call.call(valueOfB, valB);
625
+ return resultA === resultB;
626
+ }
627
+ } catch (e) {
628
+ console.error("LeUtils.equals: error calling valueOf - invalid data or implementation", e);
629
+ }
630
+ }
631
+ const toStringA = safeGetProperty(valA, "toString");
632
+ if (typeof toStringA === "function" && toStringA !== Object.prototype.toString) {
633
+ try {
634
+ const toStringB = safeGetProperty(valB, "toString");
635
+ if (typeof toStringB === "function" && toStringB !== Object.prototype.toString) {
636
+ const resultA = Function.prototype.call.call(toStringA, valA);
637
+ const resultB = Function.prototype.call.call(toStringB, valB);
638
+ return resultA === resultB;
639
+ }
640
+ } catch (e) {
641
+ console.error("LeUtils.equals: error calling toString - invalid data or implementation", e);
642
+ }
643
+ }
644
+ const constructorA = safeGetProperty(valA, "constructor");
645
+ const constructorB = safeGetProperty(valB, "constructor");
646
+ if (constructorA !== constructorB) {
647
+ return false;
648
+ }
649
+ if (!isRecordLike(valA) || !isRecordLike(valB)) {
650
+ return false;
651
+ }
652
+ const keys = Object.keys(valA);
653
+ const length = keys.length;
654
+ if (length !== Object.keys(valB).length) {
655
+ return false;
656
+ }
657
+ for (let i = length; i-- !== 0; ) {
658
+ if (!Object.prototype.hasOwnProperty.call(valB, keys[i])) {
659
+ return false;
660
+ }
661
+ }
662
+ for (let i = length; i-- !== 0; ) {
663
+ const key = keys[i];
664
+ const typeofA = safeGetProperty(valA, "$$typeof");
665
+ if (key === "_owner" && typeofA) {
666
+ continue;
667
+ }
668
+ const aVal = valA[key];
669
+ const bVal = valB[key];
670
+ if (!recursiveEquals(aVal, bVal)) {
671
+ return false;
672
+ }
673
+ }
674
+ return true;
675
+ }
676
+ return valA !== valA && valB !== valB;
677
+ }
678
+ return recursiveEquals(a, b);
679
+ }
680
+ function clone(value) {
681
+ const seen = /* @__PURE__ */ new WeakMap();
682
+ function recursiveClone(val) {
683
+ if (val === null || typeof val !== "object") {
684
+ return val;
685
+ }
686
+ if (typeof val === "function") {
687
+ return val;
688
+ }
689
+ if (seen.has(val)) {
690
+ return seen.get(val);
691
+ }
692
+ let result;
693
+ if (isUnknownArray(val)) {
694
+ const resultArray = [];
695
+ result = resultArray;
696
+ seen.set(val, result);
697
+ for (let i = 0; i < val.length; i++) {
698
+ resultArray.push(recursiveClone(val[i]));
699
+ }
700
+ } else if (val instanceof Date) {
701
+ result = new Date(val.getTime());
702
+ seen.set(val, result);
703
+ } else if (isRegExp(val)) {
704
+ result = new RegExp(val.source, val.flags);
705
+ seen.set(val, result);
706
+ } else if (isMapLike(val)) {
707
+ const resultMap = /* @__PURE__ */ new Map();
708
+ result = resultMap;
709
+ seen.set(val, result);
710
+ for (const [k, v] of val.entries()) {
711
+ resultMap.set(recursiveClone(k), recursiveClone(v));
712
+ }
713
+ } else if (isSetLike(val)) {
714
+ const resultSet = /* @__PURE__ */ new Set();
715
+ result = resultSet;
716
+ seen.set(val, result);
717
+ for (const v of val.values()) {
718
+ resultSet.add(recursiveClone(v));
719
+ }
720
+ } else if (isArrayBufferView(val)) {
721
+ if (!hasConstructor(val)) {
722
+ console.error("LeUtils.clone: ArrayBufferView value does not have constructor property");
723
+ return value;
724
+ }
725
+ const Constructor = val.constructor;
726
+ const buffer = val.buffer.slice(val.byteOffset, val.byteOffset + val.byteLength);
727
+ result = new Constructor(buffer);
728
+ seen.set(val, result);
729
+ } else if (isRecordLike(val)) {
730
+ const resultObj = Object.create(Object.getPrototypeOf(val));
731
+ result = resultObj;
732
+ seen.set(val, result);
733
+ for (const key of Object.keys(val)) {
734
+ resultObj[key] = recursiveClone(val[key]);
735
+ }
736
+ } else {
737
+ console.error("LeUtils.clone: unsupported object type, cannot clone properly", val);
738
+ return value;
739
+ }
740
+ return result;
741
+ }
742
+ const cloned = recursiveClone(value);
743
+ if (cloned === void 0 && value !== void 0) {
744
+ console.error("LeUtils.clone: clone returned undefined for non-undefined input - cloning failed");
745
+ return value;
746
+ }
747
+ return cloned;
748
+ }
749
+ function supportsEach(elements) {
750
+ if (elements === null || typeof elements === "undefined" || typeof elements === "string") {
751
+ return false;
752
+ }
753
+ return !!(Array.isArray(elements) || isPlainObject(elements) || isIterable(elements) || hasForEach(elements) || (typeof elements === "object" || typeof elements === "function"));
754
+ }
755
+ function* eachIterator(elements, optionalSkipHasOwnPropertyCheck = false) {
756
+ if (elements === null || typeof elements === "undefined") {
757
+ return;
758
+ }
759
+ if (Array.isArray(elements)) {
760
+ for (let i = 0; i < elements.length; i++) {
761
+ yield [elements[i], i];
762
+ }
763
+ return;
764
+ }
765
+ if (elements instanceof Map) {
766
+ for (const [i, value] of elements) {
767
+ yield [value, i];
768
+ }
769
+ return;
770
+ }
771
+ if (elements instanceof Set) {
772
+ for (const value of elements) {
773
+ yield [value, value];
774
+ }
775
+ return;
776
+ }
777
+ if (isPlainObject(elements)) {
778
+ for (const i in elements) {
779
+ if (optionalSkipHasOwnPropertyCheck === true || Object.prototype.hasOwnProperty.call(elements, i)) {
780
+ yield [elements[i], i];
781
+ }
782
+ }
783
+ return;
784
+ }
785
+ if (typeof elements !== "string") {
786
+ if (isIterable(elements)) {
787
+ let i = 0;
788
+ for (const value of elements) {
789
+ yield [value, i];
790
+ i++;
791
+ }
792
+ return;
793
+ }
794
+ if (hasForEach(elements)) {
795
+ const buffer = [];
796
+ elements.forEach((value, i) => {
797
+ buffer.push([value, i]);
798
+ });
799
+ for (const entry of buffer) {
800
+ yield entry;
801
+ }
802
+ return;
803
+ }
804
+ }
805
+ if (typeof elements === "object" && elements !== null) {
806
+ if (isRecordLike(elements)) {
807
+ for (const i in elements) {
808
+ if (optionalSkipHasOwnPropertyCheck === true || Object.prototype.hasOwnProperty.call(elements, i)) {
809
+ yield [elements[i], i];
810
+ }
811
+ }
812
+ return;
813
+ }
814
+ }
815
+ console.error("LeUtils.eachIterator: executed on invalid/unsupported type", typeof elements, elements);
816
+ }
817
+ function each(elements, callback, optionalSkipHasOwnPropertyCheck = false) {
818
+ if (typeof callback !== "function") {
819
+ throw new TypeError("The given callback is not a function");
820
+ }
821
+ for (const [value, key] of eachIterator(elements, optionalSkipHasOwnPropertyCheck)) {
822
+ if (callback.call(value, value, key) === false) {
823
+ break;
824
+ }
825
+ }
826
+ return elements;
827
+ }
828
+ async function eachAsync(elements, asyncCallback, parallelCount = 1, optionalSkipHasOwnPropertyCheck = false) {
829
+ if (elements === null || typeof elements === "undefined") {
830
+ return elements;
831
+ }
832
+ if (typeof asyncCallback !== "function") {
833
+ throw new TypeError("The given callback is not a function");
834
+ }
835
+ const pCount = INT_LAX(parallelCount);
836
+ if (pCount > 1) {
837
+ const runningPromises = /* @__PURE__ */ new Set();
838
+ let doBreak = false;
839
+ for (const [value, key] of eachIterator(elements, optionalSkipHasOwnPropertyCheck)) {
840
+ if (doBreak) break;
841
+ while (runningPromises.size >= pCount) {
842
+ await Promise.race(runningPromises);
843
+ if (doBreak) break;
844
+ }
845
+ const promise = (async () => {
846
+ if (await asyncCallback.call(value, value, key) === false) {
847
+ doBreak = true;
848
+ }
849
+ })();
850
+ runningPromises.add(promise);
851
+ promise.finally(() => {
852
+ runningPromises.delete(promise);
853
+ });
854
+ }
855
+ await Promise.all(runningPromises);
856
+ } else {
857
+ for (const [value, key] of eachIterator(elements, optionalSkipHasOwnPropertyCheck)) {
858
+ if (await asyncCallback.call(value, value, key) === false) {
859
+ break;
860
+ }
861
+ }
862
+ }
863
+ return elements;
864
+ }
865
+ function getEmptySimplifiedCollection(elements) {
866
+ if (elements === null || typeof elements === "undefined") {
867
+ return [false, [], (_value, _index) => {
868
+ }];
869
+ }
870
+ let collection = null;
871
+ let add = null;
872
+ if (Array.isArray(elements)) {
873
+ const arrayCollection = [];
874
+ collection = arrayCollection;
875
+ add = (value, _index) => {
876
+ arrayCollection.push(value);
877
+ };
878
+ } else if (isPlainObject(elements)) {
879
+ const objectCollection = {};
880
+ collection = objectCollection;
881
+ add = (value, index) => {
882
+ const stringIndex = typeof index === "string" ? index : String(index);
883
+ objectCollection[stringIndex] = value;
884
+ };
885
+ } else if (elements instanceof Map) {
886
+ const mapCollection = /* @__PURE__ */ new Map();
887
+ collection = mapCollection;
888
+ add = (value, index) => {
889
+ mapCollection.set(index, value);
890
+ };
891
+ } else if (typeof elements !== "string" && elements !== null && (isIterable(elements) || hasForEach(elements))) {
892
+ const arrayCollection = [];
893
+ collection = arrayCollection;
894
+ add = (value, _index) => {
895
+ arrayCollection.push(value);
896
+ };
897
+ } else if ((typeof elements === "object" || typeof elements === "function") && elements !== null) {
898
+ const objectCollection = {};
899
+ collection = objectCollection;
900
+ add = (value, index) => {
901
+ const stringIndex = typeof index === "string" ? index : String(index);
902
+ objectCollection[stringIndex] = value;
903
+ };
904
+ } else {
905
+ console.error("LeUtils.getEmptySimplifiedCollection: executed on invalid/unsupported type", typeof elements, elements);
906
+ return [false, [], (_value, _index) => {
907
+ }];
908
+ }
909
+ return [true, collection, add];
910
+ }
911
+ function filter(elements, callback, optionalSkipHasOwnPropertyCheck = false) {
912
+ if (callback && typeof callback !== "function") {
913
+ throw new TypeError("The given callback is not a function");
914
+ }
915
+ const [success, collection, add] = getEmptySimplifiedCollection(elements);
916
+ if (!success) {
917
+ return elements;
918
+ }
919
+ each(elements, (value, index) => {
920
+ if (!callback) {
921
+ if (value) {
922
+ add(value, index);
923
+ }
924
+ } else if (callback.call(value, value, index)) {
925
+ add(value, index);
926
+ }
927
+ }, optionalSkipHasOwnPropertyCheck);
928
+ return collection;
929
+ }
930
+ function map(elements, callback, optionalSkipHasOwnPropertyCheck = false) {
931
+ if (callback && typeof callback !== "function") {
932
+ throw new TypeError("The given callback is not a function");
933
+ }
934
+ const [success, collection, add] = getEmptySimplifiedCollection(elements);
935
+ if (!success) {
936
+ return elements;
937
+ }
938
+ each(elements, (value, index) => {
939
+ if (!callback) {
940
+ add(value, index);
941
+ } else {
942
+ add(callback.call(value, value, index), index);
943
+ }
944
+ }, optionalSkipHasOwnPropertyCheck);
945
+ return collection;
946
+ }
947
+ function mapToArray(elements, callback, optionalSkipHasOwnPropertyCheck = false) {
948
+ if (callback && typeof callback !== "function") {
949
+ throw new TypeError("The given callback is not a function");
950
+ }
951
+ const result = [];
952
+ each(elements, (value, index) => {
953
+ if (!callback) {
954
+ result.push(value);
955
+ } else {
956
+ result.push(callback.call(value, value, index));
957
+ }
958
+ }, optionalSkipHasOwnPropertyCheck);
959
+ return result;
960
+ }
961
+ function sortKeys(elements, comparator, optionalSkipHasOwnPropertyCheck = false) {
962
+ if (typeof comparator !== "function") {
963
+ throw new TypeError("The given comparator is not a function");
964
+ }
965
+ const keys = [];
966
+ each(elements, (_value, index) => {
967
+ keys.push(index);
968
+ }, optionalSkipHasOwnPropertyCheck);
969
+ keys.sort((a, b) => comparator(getValueAtIndex(elements, a, optionalSkipHasOwnPropertyCheck), getValueAtIndex(elements, b, optionalSkipHasOwnPropertyCheck)));
970
+ return keys;
971
+ }
972
+ function getValueAtIndex(elements, index, optionalSkipHasOwnPropertyCheck = false) {
973
+ if (elements === null || typeof elements === "undefined") {
974
+ return void 0;
975
+ }
976
+ if (Array.isArray(elements)) {
977
+ const numIndex = typeof index === "number" ? index : Number(index);
978
+ if (Number.isNaN(numIndex)) {
979
+ console.error("LeUtils.getValueAtIndex: invalid array index (not a number)", index);
980
+ return void 0;
981
+ }
982
+ return elements[numIndex];
983
+ }
984
+ if (elements instanceof Map) {
985
+ return elements.get(index);
986
+ }
987
+ if (elements instanceof Set) {
988
+ return index;
989
+ }
990
+ if (typeof elements !== "string") {
991
+ if (ArrayBuffer.isView(elements) && !(elements instanceof DataView)) {
992
+ if (hasNumericLength(elements)) {
993
+ const numIndex = typeof index === "number" ? index : Number(index);
994
+ if (Number.isNaN(numIndex)) {
995
+ console.error("LeUtils.getValueAtIndex: invalid TypedArray index (not a number)", index);
996
+ return void 0;
997
+ }
998
+ return elements[numIndex];
999
+ }
1000
+ return void 0;
1001
+ }
1002
+ if (isIterable(elements)) {
1003
+ let i = 0;
1004
+ for (const value of elements) {
1005
+ if (i === index) {
1006
+ return value;
1007
+ }
1008
+ i++;
1009
+ }
1010
+ return void 0;
1011
+ }
1012
+ if (hasForEach(elements)) {
1013
+ let result = void 0;
1014
+ let shouldContinue = true;
1015
+ elements.forEach((value, i) => {
1016
+ if (shouldContinue) {
1017
+ if (i === index) {
1018
+ result = value;
1019
+ shouldContinue = false;
1020
+ }
1021
+ }
1022
+ });
1023
+ return result;
1024
+ }
1025
+ }
1026
+ if (typeof elements === "object" || typeof elements === "function") {
1027
+ if (isRecordLike(elements)) {
1028
+ const propertyKey = typeof index === "string" || typeof index === "number" || typeof index === "symbol" ? index : String(index);
1029
+ if (optionalSkipHasOwnPropertyCheck === true || Object.prototype.hasOwnProperty.call(elements, propertyKey)) {
1030
+ const stringKey = typeof propertyKey === "string" ? propertyKey : String(propertyKey);
1031
+ return elements[stringKey];
1032
+ }
1033
+ }
1034
+ return void 0;
1035
+ }
1036
+ return void 0;
1037
+ }
1038
+ function flattenArray(array) {
1039
+ if (!Array.isArray(array)) {
1040
+ return [array];
1041
+ }
1042
+ const result = [];
1043
+ const flattenRecursive = (arr) => {
1044
+ if (!Array.isArray(arr)) {
1045
+ result.push(arr);
1046
+ return;
1047
+ }
1048
+ arr.forEach((entry) => {
1049
+ flattenRecursive(entry);
1050
+ });
1051
+ };
1052
+ array.forEach((entry) => {
1053
+ flattenRecursive(entry);
1054
+ });
1055
+ return result;
1056
+ }
1057
+ function flattenToArray(elements, optionalSkipHasOwnPropertyCheck = false) {
1058
+ const result = [];
1059
+ const flattenRecursive = (value) => {
1060
+ if (Array.isArray(value)) {
1061
+ value.forEach((entry) => {
1062
+ flattenRecursive(entry);
1063
+ });
1064
+ } else if (supportsEach(value)) {
1065
+ each(value, (v) => {
1066
+ flattenRecursive(v);
1067
+ }, optionalSkipHasOwnPropertyCheck);
1068
+ } else {
1069
+ result.push(value);
1070
+ }
1071
+ };
1072
+ flattenRecursive(elements);
1073
+ return result;
1074
+ }
1075
+ function mapToArraySorted(elements, comparator, callback, optionalSkipHasOwnPropertyCheck = false) {
1076
+ if (callback && typeof callback !== "function") {
1077
+ throw new TypeError("The given callback is not a function");
1078
+ }
1079
+ const keys = sortKeys(elements, comparator, optionalSkipHasOwnPropertyCheck);
1080
+ const result = [];
1081
+ for (const key of keys) {
1082
+ const value = getValueAtIndex(elements, key, optionalSkipHasOwnPropertyCheck);
1083
+ if (!callback) {
1084
+ result.push(value);
1085
+ } else {
1086
+ result.push(callback.call(value, value, key));
1087
+ }
1088
+ }
1089
+ return result;
1090
+ }
1091
+ function compare(a, b) {
1092
+ const compareResult = (valueA, valueB) => {
1093
+ if (valueA < valueB) {
1094
+ return -1;
1095
+ }
1096
+ if (valueA > valueB) {
1097
+ return 1;
1098
+ }
1099
+ return 0;
1100
+ };
1101
+ return compareResult(a, b);
1102
+ }
1103
+ function compareNumbers(a, b) {
1104
+ return a - b;
1105
+ }
1106
+ function compareNumericStrings(a, b) {
1107
+ const aParts = STRING(a).split(".");
1108
+ const bParts = STRING(b).split(".");
1109
+ for (let i = 0; i < Math.min(aParts.length, bParts.length); i++) {
1110
+ const aPart = aParts[i].trim();
1111
+ const bPart = bParts[i].trim();
1112
+ if (aPart.length !== bPart.length) {
1113
+ return aPart.length < bPart.length ? -1 : 1;
1114
+ }
1115
+ if (aPart !== bPart) {
1116
+ return aPart < bPart ? -1 : 1;
1117
+ }
1118
+ }
1119
+ if (aParts.length !== bParts.length) {
1120
+ return aParts.length < bParts.length ? -1 : 1;
1121
+ }
1122
+ return 0;
1123
+ }
1124
+ function compareNaturalStrings(a, b) {
1125
+ const re = /(\d+|\D+)/g;
1126
+ const aTokens = a.match(re) ?? [];
1127
+ const bTokens = b.match(re) ?? [];
1128
+ const len = Math.min(aTokens.length, bTokens.length);
1129
+ for (let i = 0; i < len; i++) {
1130
+ const x = aTokens[i];
1131
+ const y = bTokens[i];
1132
+ if (x === y) {
1133
+ continue;
1134
+ }
1135
+ const nx = parseInt(x, 10);
1136
+ const ny = parseInt(y, 10);
1137
+ if (!isNaN(nx) && !isNaN(ny)) {
1138
+ return nx - ny;
1139
+ }
1140
+ return x < y ? -1 : 1;
1141
+ }
1142
+ return aTokens.length - bTokens.length;
1143
+ }
1144
+ function isEmptyObject(obj, optionalSkipHasOwnPropertyCheck = false) {
1145
+ if (obj === null || typeof obj !== "object") {
1146
+ return true;
1147
+ }
1148
+ if (isRecordLike(obj)) {
1149
+ for (const field in obj) {
1150
+ if (optionalSkipHasOwnPropertyCheck === true || Object.prototype.hasOwnProperty.call(obj, field)) {
1151
+ return false;
1152
+ }
1153
+ }
1154
+ }
1155
+ return true;
1156
+ }
1157
+ function getObjectFieldsCount(obj, optionalSkipHasOwnPropertyCheck = false) {
1158
+ if (obj === null || typeof obj !== "object") {
1159
+ return 0;
1160
+ }
1161
+ let count = 0;
1162
+ if (isRecordLike(obj)) {
1163
+ for (const field in obj) {
1164
+ if (optionalSkipHasOwnPropertyCheck === true || Object.prototype.hasOwnProperty.call(obj, field)) {
1165
+ count++;
1166
+ }
1167
+ }
1168
+ }
1169
+ return count;
1170
+ }
1171
+ function capitalize(string) {
1172
+ const str = STRING(string).trim();
1173
+ if (str.length <= 0) {
1174
+ return str;
1175
+ }
1176
+ return str.charAt(0).toUpperCase() + str.slice(1);
1177
+ }
1178
+ function endsWithAny(string, endingCharsStringOrArray) {
1179
+ const str = STRING(string);
1180
+ let endingCharsArray;
1181
+ if (Array.isArray(endingCharsStringOrArray)) {
1182
+ endingCharsArray = endingCharsStringOrArray;
1183
+ } else {
1184
+ endingCharsArray = STRING(endingCharsStringOrArray).split("");
1185
+ }
1186
+ let result = false;
1187
+ each(endingCharsArray, (chars) => {
1188
+ if (str.endsWith(STRING(chars))) {
1189
+ result = true;
1190
+ return false;
1191
+ }
1192
+ });
1193
+ return result;
1194
+ }
1195
+ function startsWithAny(string, startingCharsStringOrArray) {
1196
+ const str = STRING(string);
1197
+ let startingCharsArray;
1198
+ if (Array.isArray(startingCharsStringOrArray)) {
1199
+ startingCharsArray = startingCharsStringOrArray;
1200
+ } else {
1201
+ startingCharsArray = STRING(startingCharsStringOrArray).split("");
1202
+ }
1203
+ let result = false;
1204
+ each(startingCharsArray, (chars) => {
1205
+ if (str.startsWith(STRING(chars))) {
1206
+ result = true;
1207
+ return false;
1208
+ }
1209
+ });
1210
+ return result;
1211
+ }
1212
+ function trimEnd(string, trimCharsStringOrArray) {
1213
+ let str = STRING(string);
1214
+ let endingCharsArray;
1215
+ if (Array.isArray(trimCharsStringOrArray)) {
1216
+ endingCharsArray = trimCharsStringOrArray;
1217
+ } else {
1218
+ endingCharsArray = STRING(trimCharsStringOrArray).split("");
1219
+ }
1220
+ let run = true;
1221
+ const trimChars = (chars) => {
1222
+ const charsStr = STRING(chars);
1223
+ if (str.endsWith(charsStr)) {
1224
+ str = str.substring(0, str.length - charsStr.length);
1225
+ run = true;
1226
+ }
1227
+ };
1228
+ while (run) {
1229
+ run = false;
1230
+ each(endingCharsArray, trimChars);
1231
+ }
1232
+ return str;
1233
+ }
1234
+ function trimStart(string, trimCharsStringOrArray) {
1235
+ let str = STRING(string);
1236
+ let startingCharsArray;
1237
+ if (Array.isArray(trimCharsStringOrArray)) {
1238
+ startingCharsArray = trimCharsStringOrArray;
1239
+ } else {
1240
+ startingCharsArray = STRING(trimCharsStringOrArray).split("");
1241
+ }
1242
+ let run = true;
1243
+ const trimChars = (chars) => {
1244
+ const charsStr = STRING(chars);
1245
+ if (str.startsWith(charsStr)) {
1246
+ str = str.substring(charsStr.length);
1247
+ run = true;
1248
+ }
1249
+ };
1250
+ while (run) {
1251
+ run = false;
1252
+ each(startingCharsArray, trimChars);
1253
+ }
1254
+ return str;
1255
+ }
1256
+ function trim(string, trimCharsStringOrArray) {
1257
+ return trimStart(trimEnd(string, trimCharsStringOrArray), trimCharsStringOrArray);
1258
+ }
1259
+ function contains(array, value) {
1260
+ if (!array) {
1261
+ return false;
1262
+ }
1263
+ let result = false;
1264
+ const valueStr = STRING(value);
1265
+ each(array, (val) => {
1266
+ if (STRING(val) === valueStr) {
1267
+ result = true;
1268
+ return false;
1269
+ }
1270
+ });
1271
+ return result;
1272
+ }
1273
+ function containsCaseInsensitive(array, value) {
1274
+ if (!array) {
1275
+ return false;
1276
+ }
1277
+ let result = false;
1278
+ const valueStr = STRING(value).toLowerCase();
1279
+ each(array, (val) => {
1280
+ if (STRING(val).toLowerCase() === valueStr) {
1281
+ result = true;
1282
+ return false;
1283
+ }
1284
+ });
1285
+ return result;
1286
+ }
1287
+ function containsAll(array, values) {
1288
+ if (!array) {
1289
+ return false;
1290
+ }
1291
+ let result = true;
1292
+ each(values, (value) => {
1293
+ if (!contains(array, value)) {
1294
+ result = false;
1295
+ return false;
1296
+ }
1297
+ });
1298
+ return result;
1299
+ }
1300
+ function containsAny(array, values) {
1301
+ if (!array) {
1302
+ return false;
1303
+ }
1304
+ let result = false;
1305
+ each(values, (value) => {
1306
+ if (contains(array, value)) {
1307
+ result = true;
1308
+ return false;
1309
+ }
1310
+ });
1311
+ return result;
1312
+ }
1313
+ function containsNone(array, values) {
1314
+ if (!array) {
1315
+ return true;
1316
+ }
1317
+ let result = true;
1318
+ each(values, (value) => {
1319
+ if (contains(array, value)) {
1320
+ result = false;
1321
+ return false;
1322
+ }
1323
+ });
1324
+ return result;
1325
+ }
1326
+ function findIndexValue(elements, callback, optionalSkipHasOwnPropertyCheck = false) {
1327
+ if (typeof callback !== "function") {
1328
+ throw new TypeError("The given callback is not a function");
1329
+ }
1330
+ let result = null;
1331
+ each(elements, (value, index) => {
1332
+ if (isRecordLike(elements)) {
1333
+ const propertyKey = typeof index === "string" || typeof index === "number" || typeof index === "symbol" ? index : String(index);
1334
+ const stringKey = typeof propertyKey === "string" ? propertyKey : String(propertyKey);
1335
+ const elementValue = elements[stringKey];
1336
+ if (callback.call(elementValue, elementValue, index)) {
1337
+ result = { index, value };
1338
+ return false;
1339
+ }
1340
+ } else {
1341
+ if (callback.call(value, value, index)) {
1342
+ result = { index, value };
1343
+ return false;
1344
+ }
1345
+ }
1346
+ }, optionalSkipHasOwnPropertyCheck);
1347
+ return result;
1348
+ }
1349
+ function findIndex(elements, callback, optionalSkipHasOwnPropertyCheck = false) {
1350
+ return findIndexValue(elements, callback, optionalSkipHasOwnPropertyCheck)?.index ?? null;
1351
+ }
1352
+ function find(elements, callback, optionalSkipHasOwnPropertyCheck = false) {
1353
+ return findIndexValue(elements, callback, optionalSkipHasOwnPropertyCheck)?.value ?? null;
1354
+ }
1355
+ var uniqueId = /* @__PURE__ */ (() => {
1356
+ let previousUniqueIdsTime = null;
1357
+ const previousUniqueIds = /* @__PURE__ */ new Map();
1358
+ const generateUniqueId = () => {
1359
+ let now = null;
1360
+ try {
1361
+ let timingNavStart = 0;
1362
+ if (hasPerformanceTiming(performance) && "timing" in performance && performance.timing) {
1363
+ const timing = performance.timing;
1364
+ if ("navigationStart" in timing && typeof timing.navigationStart === "number") {
1365
+ timingNavStart = timing.navigationStart;
1366
+ }
1367
+ }
1368
+ const timeOrigin = hasPerformanceTiming(performance) && "timeOrigin" in performance && typeof performance.timeOrigin === "number" ? performance.timeOrigin : 0;
1369
+ const nowFunc = hasPerformanceTiming(performance) && "now" in performance && typeof performance.now === "function" ? performance.now : (() => 0);
1370
+ now = timeOrigin || timingNavStart || 0;
1371
+ now = now + nowFunc();
1372
+ } catch {
1373
+ }
1374
+ now = now || Date.now();
1375
+ now = Math.round(now);
1376
+ const nowBytes = numberToBytes(now);
1377
+ let uuid = null;
1378
+ try {
1379
+ if (typeof crypto?.randomUUID === "function") {
1380
+ uuid = base64ToBytes(hexToBase64(crypto.randomUUID()));
1381
+ }
1382
+ } catch {
1383
+ }
1384
+ if (!uuid) {
1385
+ const bytesChunkA = numberToBytes(Number((Math.random() + " ").substring(2, 12).padEnd(10, "0")));
1386
+ const bytesChunkB = numberToBytes(Number((Math.random() + " ").substring(2, 12).padEnd(10, "0")));
1387
+ const bytesChunkC = numberToBytes(Number((Math.random() + " ").substring(2, 12).padEnd(10, "0")));
1388
+ const bytesChunkD = numberToBytes(Number((Math.random() + " ").substring(2, 12).padEnd(10, "0")));
1389
+ uuid = new Uint8Array(bytesChunkA.length + bytesChunkB.length + bytesChunkC.length + bytesChunkD.length);
1390
+ uuid.set(bytesChunkA, 0);
1391
+ uuid.set(bytesChunkB, bytesChunkA.length);
1392
+ uuid.set(bytesChunkC, bytesChunkA.length + bytesChunkB.length);
1393
+ uuid.set(bytesChunkD, bytesChunkA.length + bytesChunkB.length + bytesChunkC.length);
1394
+ }
1395
+ const bytes = new Uint8Array(nowBytes.length + uuid.length);
1396
+ bytes.set(nowBytes, 0);
1397
+ bytes.set(uuid, nowBytes.length);
1398
+ const finalUuid = bytesToBase64(bytes).replaceAll("=", "").replaceAll("+", "-").replaceAll("/", "_");
1399
+ return {
1400
+ time: now,
1401
+ id: finalUuid
1402
+ };
1403
+ };
1404
+ return () => {
1405
+ while (true) {
1406
+ const result = generateUniqueId();
1407
+ if (previousUniqueIdsTime !== result.time) {
1408
+ previousUniqueIdsTime = result.time;
1409
+ previousUniqueIds.clear();
1410
+ previousUniqueIds.set(result.id, true);
1411
+ return result.id;
1412
+ } else if (previousUniqueIds.get(result.id) !== true) {
1413
+ previousUniqueIds.set(result.id, true);
1414
+ return result.id;
1415
+ }
1416
+ }
1417
+ };
1418
+ })();
1419
+ var timestamp = /* @__PURE__ */ (() => {
1420
+ return (now = null) => {
1421
+ let time;
1422
+ if (ISSET(now)) {
1423
+ time = FLOAT_LAX(now);
1424
+ } else {
1425
+ let performanceNow = null;
1426
+ try {
1427
+ let timingNavStart = 0;
1428
+ if (performance && hasPerformanceTiming(performance) && "timing" in performance) {
1429
+ const timing = safeGetProperty(performance, "timing");
1430
+ if (timing && typeof timing === "object" && timing !== null) {
1431
+ const navStart = safeGetProperty(timing, "navigationStart");
1432
+ if (typeof navStart === "number") {
1433
+ timingNavStart = navStart;
1434
+ }
1435
+ }
1436
+ }
1437
+ const timeOrigin = performance && hasPerformanceTiming(performance) && "timeOrigin" in performance ? safeGetProperty(performance, "timeOrigin") : void 0;
1438
+ const nowFunc = performance && hasPerformanceTiming(performance) && "now" in performance ? safeGetProperty(performance, "now") : void 0;
1439
+ const timeOriginVal = typeof timeOrigin === "number" ? timeOrigin : 0;
1440
+ const nowFuncVal = typeof nowFunc === "function" ? nowFunc() : 0;
1441
+ performanceNow = timeOriginVal || timingNavStart || 0;
1442
+ performanceNow = performanceNow + nowFuncVal;
1443
+ } catch {
1444
+ }
1445
+ time = performanceNow || Date.now();
1446
+ }
1447
+ time = Math.round(time);
1448
+ const nowBytes = numberToBytes(time);
1449
+ return bytesToBase64(nowBytes).replaceAll("=", "").replaceAll("+", "-").replaceAll("/", "_");
1450
+ };
1451
+ })();
1452
+ var isGeneratorFunction = (() => {
1453
+ const GeneratorFunction = (function* () {
1454
+ }).constructor;
1455
+ const AsyncGeneratorFunction = (async function* () {
1456
+ }).constructor;
1457
+ return (func) => {
1458
+ if (typeof func !== "function") {
1459
+ return false;
1460
+ }
1461
+ if (!hasConstructor(func)) {
1462
+ return false;
1463
+ }
1464
+ const constructor = func.constructor;
1465
+ return constructor === GeneratorFunction || constructor === AsyncGeneratorFunction;
1466
+ };
1467
+ })();
1468
+ function btoa(str) {
1469
+ if (typeof globalThis.btoa === "function") {
1470
+ return globalThis.btoa(str);
1471
+ }
1472
+ if (typeof globalThis.Buffer?.from === "function") {
1473
+ return globalThis.Buffer.from(str, "binary").toString("base64");
1474
+ }
1475
+ throw new Error("LeUtils.btoa: No btoa implementation found");
1476
+ }
1477
+ function atob(str) {
1478
+ if (typeof globalThis.atob === "function") {
1479
+ return globalThis.atob(str);
1480
+ }
1481
+ if (typeof globalThis.Buffer?.from === "function") {
1482
+ return globalThis.Buffer.from(str, "base64").toString("binary");
1483
+ }
1484
+ throw new Error("LeUtils.atob: No atob implementation found");
1485
+ }
1486
+ function utf8ToBase64(string) {
1487
+ return btoa(encodeURIComponent(string).replace(/%([0-9A-F]{2})/g, (_match, p1) => String.fromCharCode(parseInt(p1, 16))));
1488
+ }
1489
+ function base64ToUtf8(base64string) {
1490
+ return decodeURIComponent(atob(base64string.trim()).split("").map((c) => "%" + ("00" + c.charCodeAt(0).toString(16)).slice(-2)).join(""));
1491
+ }
1492
+ function base64ToHex(base64string) {
1493
+ return atob(base64string.trim()).split("").map((c) => ("0" + c.charCodeAt(0).toString(16)).slice(-2)).join("");
1494
+ }
1495
+ function hexToBase64(hexstring) {
1496
+ const hexResult = hexstring.replace(/[^0-9A-F]/gi, "").match(/\w{2}/g)?.map((a) => String.fromCharCode(parseInt(a, 16)))?.join("");
1497
+ if (!hexResult) {
1498
+ throw new Error('Invalid hex string: "' + hexstring + '"');
1499
+ }
1500
+ return btoa(hexResult);
1501
+ }
1502
+ function base64ToBytes(base64string) {
1503
+ const binary = atob(base64string.trim());
1504
+ const len = binary.length;
1505
+ const data = new Uint8Array(len);
1506
+ for (let i = 0; i < len; i++) {
1507
+ data[i] = binary.charCodeAt(i);
1508
+ }
1509
+ return data;
1510
+ }
1511
+ function bytesToBase64(arraybuffer) {
1512
+ const bytes = new Uint8Array(arraybuffer);
1513
+ const len = bytes.byteLength;
1514
+ let binary = "";
1515
+ for (let i = 0; i < len; i++) {
1516
+ binary += String.fromCharCode(bytes[i]);
1517
+ }
1518
+ return btoa(binary);
1519
+ }
1520
+ function setTimeout(callback, ms) {
1521
+ if (!globalThis?.setTimeout || !globalThis?.clearTimeout) {
1522
+ console.warn("LeUtils.setTimeout: Not supported.");
1523
+ return { remove: () => {
1524
+ } };
1525
+ }
1526
+ const msVal = FLOAT_LAX(ms);
1527
+ let lastTime = globalThis?.performance?.now?.() ?? 0;
1528
+ if (!hasSetTimeout(globalThis)) {
1529
+ console.error("LeUtils.setTimeout: globalThis.setTimeout is not available");
1530
+ return { remove: () => {
1531
+ } };
1532
+ }
1533
+ let handler = globalThis.setTimeout(() => {
1534
+ const currentTime = globalThis?.performance?.now?.() ?? 0;
1535
+ try {
1536
+ callback((currentTime - lastTime) / 1e3);
1537
+ } catch (e) {
1538
+ console.error(e);
1539
+ }
1540
+ lastTime = currentTime;
1541
+ }, msVal);
1542
+ return {
1543
+ remove: () => {
1544
+ if (handler !== null) {
1545
+ globalThis.clearTimeout(handler);
1546
+ handler = null;
1547
+ }
1548
+ }
1549
+ };
1550
+ }
1551
+ function setInterval(callback, intervalMs = 1e3, fireImmediately = false) {
1552
+ const msVal = FLOAT_LAX_ANY(intervalMs, 1e3);
1553
+ if (fireImmediately) {
1554
+ try {
1555
+ callback(0);
1556
+ } catch (e) {
1557
+ console.error(e);
1558
+ }
1559
+ }
1560
+ if (!globalThis?.setInterval || !globalThis?.clearInterval) {
1561
+ console.warn("LeUtils.setInterval: Not supported.");
1562
+ return { remove: () => {
1563
+ } };
1564
+ }
1565
+ let lastTime = globalThis?.performance?.now?.() ?? 0;
1566
+ if (!hasSetInterval(globalThis)) {
1567
+ console.error("LeUtils.setInterval: globalThis.setInterval is not available");
1568
+ return { remove: () => {
1569
+ } };
1570
+ }
1571
+ let handler = globalThis.setInterval(() => {
1572
+ const currentTime = globalThis?.performance?.now?.() ?? 0;
1573
+ try {
1574
+ callback((currentTime - lastTime) / 1e3);
1575
+ } catch (e) {
1576
+ console.error(e);
1577
+ }
1578
+ lastTime = currentTime;
1579
+ }, msVal);
1580
+ return {
1581
+ remove: () => {
1582
+ if (handler !== null) {
1583
+ globalThis.clearInterval(handler);
1584
+ handler = null;
1585
+ }
1586
+ }
1587
+ };
1588
+ }
1589
+ function setAnimationFrameTimeout(callback, frames = 1) {
1590
+ if (!globalThis?.requestAnimationFrame || !globalThis?.cancelAnimationFrame) {
1591
+ console.warn("LeUtils.setAnimationFrameTimeout: Not supported.");
1592
+ return { remove: () => {
1593
+ } };
1594
+ }
1595
+ let framesLeft = INT_LAX_ANY(frames, 1);
1596
+ let run = true;
1597
+ let requestAnimationFrameId = null;
1598
+ let lastTime = globalThis?.performance?.now?.() ?? 0;
1599
+ const tick = () => {
1600
+ if (run) {
1601
+ if (framesLeft <= 0) {
1602
+ run = false;
1603
+ requestAnimationFrameId = null;
1604
+ const currentTime = globalThis?.performance?.now?.() ?? 0;
1605
+ try {
1606
+ callback((currentTime - lastTime) / 1e3);
1607
+ } catch (e) {
1608
+ console.error(e);
1609
+ }
1610
+ lastTime = currentTime;
1611
+ return;
1612
+ }
1613
+ framesLeft--;
1614
+ requestAnimationFrameId = globalThis.requestAnimationFrame(tick);
1615
+ }
1616
+ };
1617
+ tick();
1618
+ return {
1619
+ remove: () => {
1620
+ run = false;
1621
+ if (requestAnimationFrameId !== null) {
1622
+ globalThis.cancelAnimationFrame(requestAnimationFrameId);
1623
+ requestAnimationFrameId = null;
1624
+ }
1625
+ }
1626
+ };
1627
+ }
1628
+ function setAnimationFrameInterval(callback, intervalFrames = 1, fireImmediately = false) {
1629
+ const iFrames = INT_LAX_ANY(intervalFrames, 1);
1630
+ if (fireImmediately) {
1631
+ try {
1632
+ callback(0);
1633
+ } catch (e) {
1634
+ console.error(e);
1635
+ }
1636
+ }
1637
+ if (!globalThis?.requestAnimationFrame || !globalThis?.cancelAnimationFrame) {
1638
+ console.warn("LeUtils.setAnimationFrameInterval: Not supported.");
1639
+ return { remove: () => {
1640
+ } };
1641
+ }
1642
+ let run = true;
1643
+ let requestAnimationFrameId = null;
1644
+ let lastTimestamp = 0;
1645
+ let totalTime = 0;
1646
+ let frames = iFrames;
1647
+ const tick = (timestampVal) => {
1648
+ if (run) {
1649
+ if (lastTimestamp === 0) {
1650
+ lastTimestamp = timestampVal;
1651
+ }
1652
+ totalTime += timestampVal - lastTimestamp;
1653
+ lastTimestamp = timestampVal;
1654
+ frames--;
1655
+ if (frames <= 0) {
1656
+ try {
1657
+ callback(totalTime / 1e3);
1658
+ } catch (e) {
1659
+ console.error(e);
1660
+ }
1661
+ totalTime = 0;
1662
+ frames = iFrames;
1663
+ }
1664
+ if (run) {
1665
+ requestAnimationFrameId = globalThis.requestAnimationFrame(tick);
1666
+ }
1667
+ }
1668
+ };
1669
+ globalThis.requestAnimationFrame(tick);
1670
+ return {
1671
+ remove: () => {
1672
+ run = false;
1673
+ if (requestAnimationFrameId !== null) {
1674
+ globalThis.cancelAnimationFrame(requestAnimationFrameId);
1675
+ requestAnimationFrameId = null;
1676
+ }
1677
+ }
1678
+ };
1679
+ }
1680
+ function promiseTimeout(ms) {
1681
+ const msVal = FLOAT_LAX(ms);
1682
+ if (msVal <= 0) {
1683
+ return Promise.resolve(0);
1684
+ }
1685
+ return new Promise((resolve) => setTimeout(resolve, msVal));
1686
+ }
1687
+ function promiseAnimationFrameTimeout(frames) {
1688
+ const iFrames = INT_LAX(frames);
1689
+ if (iFrames <= 0) {
1690
+ return Promise.resolve(0);
1691
+ }
1692
+ return new Promise((resolve) => setAnimationFrameTimeout(resolve, iFrames));
1693
+ }
1694
+ function fetch(url, options) {
1695
+ let currentRetries = 0;
1696
+ const retriesValue = isRecordLike(options) && "retries" in options ? options.retries : void 0;
1697
+ const retries = INT_LAX(retriesValue);
1698
+ let controllerAborted = false;
1699
+ let controller = null;
1700
+ if (globalThis?.AbortController) {
1701
+ controller = new AbortController();
1702
+ }
1703
+ let promise = (async () => {
1704
+ const attemptFetch = async () => {
1705
+ if (controllerAborted || controller?.signal?.aborted) {
1706
+ throw new Error("Aborted");
1707
+ }
1708
+ try {
1709
+ const response = await globalThis.fetch(url, {
1710
+ signal: controller?.signal,
1711
+ ...isRecordLike(options) ? options : {},
1712
+ // @ts-ignore -- removing custom options from standard fetch options
1713
+ retries: void 0,
1714
+ // @ts-ignore -- removing custom options from standard fetch options
1715
+ delay: void 0
1716
+ });
1717
+ if (!response.ok) {
1718
+ throw new Error("Network request failed: " + response.status + " " + response.statusText);
1719
+ }
1720
+ return response;
1721
+ } catch (error) {
1722
+ if (controllerAborted || controller?.signal?.aborted) {
1723
+ throw new Error("Aborted");
1724
+ }
1725
+ if (currentRetries >= retries) {
1726
+ throw error;
1727
+ }
1728
+ currentRetries++;
1729
+ const delayValue = isRecordLike(options) && "delay" in options ? options.delay : void 0;
1730
+ const delay = typeof delayValue === "function" ? INT_LAX_ANY(delayValue(currentRetries), 500) : INT_LAX_ANY(delayValue, 500);
1731
+ await promiseTimeout(delay);
1732
+ return await attemptFetch();
1733
+ }
1734
+ };
1735
+ return await attemptFetch();
1736
+ })();
1737
+ const result = {
1738
+ then: () => result,
1739
+ catch: () => result,
1740
+ finally: () => result,
1741
+ remove: () => void 0,
1742
+ isRemoved: () => false
1743
+ };
1744
+ result.then = (...args) => {
1745
+ if (isPromise(promise)) {
1746
+ const thenResult = promise.then(...args);
1747
+ promise = thenResult;
1748
+ }
1749
+ return result;
1750
+ };
1751
+ result.catch = (...args) => {
1752
+ if (isPromise(promise)) {
1753
+ const catchResult = promise.catch(...args);
1754
+ promise = catchResult;
1755
+ }
1756
+ return result;
1757
+ };
1758
+ result.finally = (...args) => {
1759
+ if (isPromise(promise)) {
1760
+ const finallyResult = promise.finally(...args);
1761
+ promise = finallyResult;
1762
+ }
1763
+ return result;
1764
+ };
1765
+ result.remove = (...args) => {
1766
+ controllerAborted = true;
1767
+ if (controller) {
1768
+ controller.abort(...args);
1769
+ }
1770
+ return result;
1771
+ };
1772
+ result.isRemoved = () => controllerAborted || !!controller?.signal?.aborted;
1773
+ return result;
1774
+ }
1775
+ var cachedFetch = /* @__PURE__ */ (() => {
1776
+ const cache = /* @__PURE__ */ new Map();
1777
+ return async (url, options, responseFunction) => {
1778
+ if (cache.has(url)) {
1779
+ const result = cache.get(url);
1780
+ if (isRecordLike(result)) {
1781
+ if ("data" in result && result.data !== void 0) {
1782
+ return result.data;
1783
+ }
1784
+ if ("promise" in result && isPromise(result.promise)) {
1785
+ return await result.promise;
1786
+ }
1787
+ if ("error" in result && result.error !== void 0) {
1788
+ throw result.error;
1789
+ }
1790
+ }
1791
+ return null;
1792
+ }
1793
+ const fetchOptions = isRecordLike(options) ? options : void 0;
1794
+ const fetchPromise = globalThis.fetch(url, fetchOptions);
1795
+ const promise = fetchPromise.then(async (response) => {
1796
+ const data = responseFunction ? await responseFunction(response) : response;
1797
+ if (isRecordLike(options) && "verify" in options) {
1798
+ const verify = options.verify;
1799
+ if (typeof verify === "function") {
1800
+ await verify(data, response);
1801
+ }
1802
+ }
1803
+ return data;
1804
+ }).then((data) => {
1805
+ cache.set(url, { data });
1806
+ return data;
1807
+ }).catch((error) => {
1808
+ cache.set(url, { error });
1809
+ throw error;
1810
+ });
1811
+ if (!cache.has(url)) {
1812
+ cache.set(url, { promise });
1813
+ }
1814
+ return await promise;
1815
+ };
1816
+ })();
1817
+ function createTransactionalValue(value) {
1818
+ return {
1819
+ value: typeof value === "undefined" ? null : value,
1820
+ changes: []
1821
+ };
1822
+ }
1823
+ function isTransactionalValueValid(transactionalValue) {
1824
+ return typeof transactionalValue === "object" && transactionalValue !== null && isTransactionalValue(transactionalValue);
1825
+ }
1826
+ function checkTransactionalValue(transactionalValue) {
1827
+ if (!isTransactionalValueValid(transactionalValue)) {
1828
+ throw new Error("Invalid TransactionalValue provided");
1829
+ }
1830
+ }
1831
+ function findTransactionalValueChange(transactionalValue, changeId) {
1832
+ for (let i = 0; i < transactionalValue.changes.length; i++) {
1833
+ if (transactionalValue.changes[i].id === changeId) {
1834
+ return { change: transactionalValue.changes[i], index: i };
1835
+ }
1836
+ }
1837
+ return null;
1838
+ }
1839
+ function transactionalValueToString(transactionalValue) {
1840
+ if (!isTransactionalValueValid(transactionalValue)) {
1841
+ return STRING(transactionalValue);
1842
+ }
1843
+ if (transactionalValue.changes.length <= 0) {
1844
+ return STRING(transactionalValue.value);
1845
+ }
1846
+ let valuesString = STRING(transactionalValue.value);
1847
+ for (let i = 0; i < transactionalValue.changes.length; i++) {
1848
+ valuesString += " -> " + STRING(transactionalValue.changes[i].value);
1849
+ }
1850
+ return STRING(transactionalValue.changes[transactionalValue.changes.length - 1].value) + " (" + valuesString + ")";
1851
+ }
1852
+ function transactionSetAndCommit(transactionalValue, value) {
1853
+ checkTransactionalValue(transactionalValue);
1854
+ transactionalValue.value = typeof value === "undefined" ? null : value;
1855
+ transactionalValue.changes = [];
1856
+ }
1857
+ function transactionSetWithoutCommitting(transactionalValue, value) {
1858
+ checkTransactionalValue(transactionalValue);
1859
+ const id = uniqueId();
1860
+ transactionalValue.changes.push({ id, value: typeof value === "undefined" ? null : value });
1861
+ return id;
1862
+ }
1863
+ function transactionCommitChange(transactionalValue, changeId) {
1864
+ checkTransactionalValue(transactionalValue);
1865
+ const result = findTransactionalValueChange(transactionalValue, changeId);
1866
+ if (result === null) {
1867
+ return false;
1868
+ }
1869
+ transactionalValue.value = result.change.value;
1870
+ transactionalValue.changes.splice(0, result.index + 1);
1871
+ return true;
1872
+ }
1873
+ function transactionCancelChange(transactionalValue, changeId) {
1874
+ checkTransactionalValue(transactionalValue);
1875
+ const result = findTransactionalValueChange(transactionalValue, changeId);
1876
+ if (result === null) {
1877
+ return false;
1878
+ }
1879
+ transactionalValue.changes.splice(result.index, 1);
1880
+ return true;
1881
+ }
1882
+ function transactionIsChangeRelevant(transactionalValue, changeId) {
1883
+ checkTransactionalValue(transactionalValue);
1884
+ return findTransactionalValueChange(transactionalValue, changeId) !== null;
1885
+ }
1886
+ function transactionGetCommittedValue(transactionalValue) {
1887
+ checkTransactionalValue(transactionalValue);
1888
+ return transactionalValue.value;
1889
+ }
1890
+ function transactionGetValue(transactionalValue) {
1891
+ checkTransactionalValue(transactionalValue);
1892
+ if (transactionalValue.changes.length <= 0) {
1893
+ return transactionalValue.value;
1894
+ }
1895
+ return transactionalValue.changes[transactionalValue.changes.length - 1].value;
1896
+ }
1897
+ function equalsMapLike(elementsA, elementsB, ignoreKeys = []) {
1898
+ const sortKeyValueArrays = (pairA, pairB) => {
1899
+ if (isPair(pairA) && isPair(pairB)) {
1900
+ return compare(pairA[0], pairB[0]);
1901
+ }
1902
+ return 0;
1903
+ };
1904
+ const aArray = mapToArray(elementsA, (value, key) => [key, value]);
1905
+ const bArray = mapToArray(elementsB, (value, key) => [key, value]);
1906
+ const aPairs = (Array.isArray(aArray) ? aArray.filter((item) => isPair(item)) : []).sort(sortKeyValueArrays);
1907
+ const bPairs = (Array.isArray(bArray) ? bArray.filter((item) => isPair(item)) : []).sort(sortKeyValueArrays);
1908
+ const ignore = typeof ignoreKeys === "string" ? ARRAY(ignoreKeys) : mapToArray(ignoreKeys);
1909
+ let i = 0, j = 0;
1910
+ while (i < aPairs.length && j < bPairs.length) {
1911
+ const [ka, va] = aPairs[i];
1912
+ const [kb, vb] = bPairs[j];
1913
+ if (ignore.includes(ka)) {
1914
+ i++;
1915
+ if (ignore.includes(kb)) j++;
1916
+ continue;
1917
+ }
1918
+ if (ignore.includes(kb)) {
1919
+ j++;
1920
+ continue;
1921
+ }
1922
+ if (!equals(ka, kb) || !equals(va, vb)) return false;
1923
+ i++;
1924
+ j++;
1925
+ }
1926
+ while (i < aPairs.length && ignore.includes(aPairs[i][0])) i++;
1927
+ if (i < aPairs.length) return false;
1928
+ while (j < bPairs.length && ignore.includes(bPairs[j][0])) j++;
1929
+ return j >= bPairs.length;
1930
+ }
1931
+ function onDomReady(callback) {
1932
+ if (!globalThis?.document?.addEventListener) {
1933
+ console.warn("LeUtils.onDomReady: No document found.");
1934
+ return { remove: () => {
1935
+ } };
1936
+ }
1937
+ if (globalThis.document.readyState === "interactive" || globalThis.document.readyState === "complete") {
1938
+ return setTimeout(callback, 0);
1939
+ }
1940
+ let listening = true;
1941
+ const wrapper = () => {
1942
+ if (listening) {
1943
+ listening = false;
1944
+ globalThis.document.removeEventListener("DOMContentLoaded", wrapper);
1945
+ callback();
1946
+ }
1947
+ };
1948
+ globalThis.document.addEventListener("DOMContentLoaded", wrapper);
1949
+ return {
1950
+ remove: () => {
1951
+ if (listening) {
1952
+ listening = false;
1953
+ globalThis.document.removeEventListener("DOMContentLoaded", wrapper);
1954
+ }
1955
+ }
1956
+ };
1957
+ }
1958
+ function parseVersionString(version) {
1959
+ if (isVersionObject(version)) {
1960
+ const major2 = INT_LAX(version.major);
1961
+ const minor2 = INT_LAX(version.minor);
1962
+ const patch2 = INT_LAX(version.patch);
1963
+ return {
1964
+ major: major2,
1965
+ minor: minor2,
1966
+ patch: patch2,
1967
+ toString: () => `${major2}.${minor2}.${patch2}`,
1968
+ equals: (other) => {
1969
+ if (!isVersionObject(other)) {
1970
+ return false;
1971
+ }
1972
+ return major2 === INT_LAX(other.major) && minor2 === INT_LAX(other.minor) && patch2 === INT_LAX(other.patch);
1973
+ },
1974
+ largerThan: (other) => {
1975
+ if (!isVersionObject(other)) {
1976
+ return false;
1977
+ }
1978
+ const otherMajor = INT_LAX(other.major);
1979
+ const otherMinor = INT_LAX(other.minor);
1980
+ const otherPatch = INT_LAX(other.patch);
1981
+ return major2 > otherMajor || major2 === otherMajor && minor2 > otherMinor || major2 === otherMajor && minor2 === otherMinor && patch2 > otherPatch;
1982
+ },
1983
+ largerThanOrEquals: (other) => {
1984
+ if (!isVersionObject(other)) {
1985
+ return false;
1986
+ }
1987
+ const otherMajor = INT_LAX(other.major);
1988
+ const otherMinor = INT_LAX(other.minor);
1989
+ const otherPatch = INT_LAX(other.patch);
1990
+ return major2 > otherMajor || major2 === otherMajor && minor2 > otherMinor || major2 === otherMajor && minor2 === otherMinor && patch2 >= otherPatch;
1991
+ },
1992
+ smallerThan: (other) => {
1993
+ if (!isVersionObject(other)) {
1994
+ return false;
1995
+ }
1996
+ const otherMajor = INT_LAX(other.major);
1997
+ const otherMinor = INT_LAX(other.minor);
1998
+ const otherPatch = INT_LAX(other.patch);
1999
+ return !(major2 > otherMajor || major2 === otherMajor && minor2 > otherMinor || major2 === otherMajor && minor2 === otherMinor && patch2 >= otherPatch);
2000
+ },
2001
+ smallerThanOrEquals: (other) => {
2002
+ if (!isVersionObject(other)) {
2003
+ return false;
2004
+ }
2005
+ const otherMajor = INT_LAX(other.major);
2006
+ const otherMinor = INT_LAX(other.minor);
2007
+ const otherPatch = INT_LAX(other.patch);
2008
+ return !(major2 > otherMajor || major2 === otherMajor && minor2 > otherMinor || major2 === otherMajor && minor2 === otherMinor && patch2 > otherPatch);
2009
+ }
2010
+ };
2011
+ }
2012
+ const v = STRING(version).trim();
2013
+ const parts = v.split(" ")[0].split("-")[0].split(".");
2014
+ const major = INT_LAX(parts[0]);
2015
+ const minor = INT_LAX(parts[1]);
2016
+ const patch = INT_LAX(parts[2]);
2017
+ const obj = {
2018
+ major,
2019
+ minor,
2020
+ patch,
2021
+ toString: () => `${major}.${minor}.${patch}`,
2022
+ equals: (other) => {
2023
+ const o = parseVersionString(other);
2024
+ return major === o.major && minor === o.minor && patch === o.patch;
2025
+ },
2026
+ largerThan: (other) => {
2027
+ const o = parseVersionString(other);
2028
+ if (major > o.major) return true;
2029
+ if (major < o.major) return false;
2030
+ if (minor > o.minor) return true;
2031
+ if (minor < o.minor) return false;
2032
+ return patch > o.patch;
2033
+ },
2034
+ largerThanOrEquals: (other) => {
2035
+ const o = parseVersionString(other);
2036
+ if (major > o.major) return true;
2037
+ if (major < o.major) return false;
2038
+ if (minor > o.minor) return true;
2039
+ if (minor < o.minor) return false;
2040
+ return patch >= o.patch;
2041
+ },
2042
+ smallerThan: (other) => {
2043
+ return !obj.largerThanOrEquals(other);
2044
+ },
2045
+ smallerThanOrEquals: (other) => {
2046
+ return !obj.largerThan(other);
2047
+ }
2048
+ };
2049
+ return obj;
2050
+ }
2051
+ function increaseNumericStringByOne(str) {
2052
+ const s = typeof str !== "string" ? String(str) : str;
2053
+ if (!s || /[^0-9]/.test(s)) return "1";
2054
+ const chars = s.split("");
2055
+ for (let i = chars.length - 1; i >= 0; i--) {
2056
+ const n = parseInt(chars[i], 10);
2057
+ if (n < 9) {
2058
+ chars[i] = String(n + 1);
2059
+ return chars.join("");
2060
+ }
2061
+ chars[i] = "0";
2062
+ }
2063
+ return "1" + chars.join("");
2064
+ }
2065
+ function containsAllCaseInsensitive(array, values) {
2066
+ if (!array) return false;
2067
+ let result = true;
2068
+ each(values, (v) => {
2069
+ if (!containsCaseInsensitive(array, v)) {
2070
+ result = false;
2071
+ return false;
2072
+ }
2073
+ });
2074
+ return result;
2075
+ }
2076
+ function containsAnyCaseInsensitive(array, values) {
2077
+ if (!array) return false;
2078
+ let result = false;
2079
+ each(values, (v) => {
2080
+ if (containsCaseInsensitive(array, v)) {
2081
+ result = true;
2082
+ return false;
2083
+ }
2084
+ });
2085
+ return result;
2086
+ }
2087
+ function containsNoneCaseInsensitive(array, values) {
2088
+ if (!array) return true;
2089
+ let result = true;
2090
+ each(values, (v) => {
2091
+ if (containsCaseInsensitive(array, v)) {
2092
+ result = false;
2093
+ return false;
2094
+ }
2095
+ });
2096
+ return result;
2097
+ }
2098
+ function purgeSentence(sentence) {
2099
+ let s = trimEnd(STRING(sentence).trim(), ".: \r\n ");
2100
+ s += endsWithAny(s, "!?;") ? "" : ".";
2101
+ return s;
2102
+ }
2103
+ function purgeErrorMessage(error) {
2104
+ let err = error;
2105
+ if (hasErrorMessage(err)) {
2106
+ err = err.message;
2107
+ }
2108
+ if (typeof err === "string") {
2109
+ const errorParts = err.split("threw an error:");
2110
+ err = errorParts[errorParts.length - 1];
2111
+ } else {
2112
+ try {
2113
+ err = JSON.stringify(err);
2114
+ } catch {
2115
+ err = "An unknown error occurred";
2116
+ }
2117
+ }
2118
+ return STRING(err).trim();
2119
+ }
2120
+ function generateNamePermutations(...names) {
2121
+ const n = flattenToArray(names).map((name) => STRING(name).trim().toLowerCase()).filter((name) => name.length > 0);
2122
+ const results = [];
2123
+ if (n.length > 0) {
2124
+ results.push(n.join(""));
2125
+ results.push(n.map(capitalize).join(""));
2126
+ }
2127
+ if (n.length > 1) {
2128
+ results.push([n[0]].concat(n.slice(1).map(capitalize)).join(""));
2129
+ results.push(n.join("-"));
2130
+ results.push(n.join("_"));
2131
+ }
2132
+ return results;
2133
+ }
2134
+ function compareTimestampStrings(a, b) {
2135
+ try {
2136
+ const ta = base64ToHex(STRING(a).replaceAll("-", "+").replaceAll("_", "/"));
2137
+ const tb = base64ToHex(STRING(b).replaceAll("-", "+").replaceAll("_", "/"));
2138
+ return compare(ta, tb);
2139
+ } catch {
2140
+ return 0;
2141
+ }
2142
+ }
2143
+ function platformIsMobile() {
2144
+ let userAgent = globalThis?.navigator?.userAgent || "";
2145
+ if (!userAgent && globalThis?.navigator && hasNavigatorVendor(globalThis.navigator)) {
2146
+ userAgent = globalThis.navigator.vendor || "";
2147
+ }
2148
+ if (!userAgent && hasOpera(globalThis)) {
2149
+ const operaValue = safeGetProperty(globalThis, "opera");
2150
+ userAgent = typeof operaValue === "string" ? operaValue : "";
2151
+ }
2152
+ const a = STRING(userAgent || "");
2153
+ return !!(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series([46])0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br([ev])w|bumb|bw-([nu])|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do([cp])o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly([-_])|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-([mpt])|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c([- _agpst])|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac([ \-/])|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja([tv])a|jbro|jemu|jigs|kddi|keji|kgt([ /])|klon|kpt |kwc-|kyo([ck])|le(no|xi)|lg( g|\/([klu])|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t([- ov])|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30([02])|n50([025])|n7(0([01])|10)|ne(([cm])-|on|tf|wf|wg|wt)|nok([6i])|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan([adt])|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c([-01])|47|mc|nd|ri)|sgh-|shar|sie([-m])|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel([im])|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c([- ])|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(a));
2154
+ }
2155
+ function platformHasCursor() {
2156
+ return !platformIsMobile() && !globalThis?.matchMedia?.("(any-hover: none)")?.matches;
2157
+ }
2158
+ function purgeEmail(email) {
2159
+ const e = STRING(email).trim().toLowerCase().replace(/\s/g, "");
2160
+ if (!e.includes("@") || !e.includes(".")) {
2161
+ return "";
2162
+ }
2163
+ return e;
2164
+ }
2165
+ var isFocusClear = /* @__PURE__ */ (() => {
2166
+ const inputTypes = ["text", "search", "email", "number", "password", "tel", "time", "url", "week", "month", "date", "datetime-local"];
2167
+ return () => !(globalThis?.document?.activeElement?.tagName?.toLowerCase() === "input" && inputTypes.includes(globalThis?.document?.activeElement?.getAttribute("type")?.toLowerCase() ?? ""));
2168
+ })();
2169
+ var getUserLocale = /* @__PURE__ */ (() => {
2170
+ let userLocale = null;
2171
+ return () => {
2172
+ if (userLocale === null) {
2173
+ userLocale = (() => {
2174
+ let locales = [];
2175
+ if (globalThis?.navigator && hasNavigatorLanguages(globalThis.navigator)) {
2176
+ const navLanguages = safeGetProperty(globalThis.navigator, "languages");
2177
+ if (Array.isArray(navLanguages)) {
2178
+ locales = navLanguages;
2179
+ }
2180
+ }
2181
+ if (!IS_ARRAY(locales) || locales.length <= 0) {
2182
+ return "en-US";
2183
+ }
2184
+ locales = locales.filter((locale) => typeof locale === "string" && locale.includes("-") && locale.toLowerCase() !== "en-us");
2185
+ if (locales.length <= 0) {
2186
+ return "en-US";
2187
+ }
2188
+ const localesNoEnglish = locales.filter((locale) => STRING(locale).toLowerCase().startsWith("en-"));
2189
+ if (localesNoEnglish.length <= 0) {
2190
+ return STRING(locales[0]);
2191
+ }
2192
+ return STRING(localesNoEnglish[0]);
2193
+ })();
2194
+ }
2195
+ return userLocale;
2196
+ };
2197
+ })();
2198
+ var getUserLocaleDateFormat = /* @__PURE__ */ (() => {
2199
+ let userLocaleDateFormat = null;
2200
+ return () => {
2201
+ if (userLocaleDateFormat === null) {
2202
+ userLocaleDateFormat = (() => {
2203
+ let char = "/";
2204
+ if (hasIntl(globalThis) && globalThis.Intl && "DateTimeFormat" in globalThis.Intl) {
2205
+ const DateTimeFormat = safeGetProperty(globalThis.Intl, "DateTimeFormat");
2206
+ if (typeof DateTimeFormat === "function") {
2207
+ const dtfInstance = Function.prototype.apply.call(DateTimeFormat, null, [getUserLocale()]);
2208
+ if ("format" in dtfInstance && typeof dtfInstance.format === "function") {
2209
+ const formattedDate = dtfInstance.format();
2210
+ if (formattedDate.includes("-")) {
2211
+ char = "-";
2212
+ } else if (formattedDate.includes(". ")) {
2213
+ char = ".";
2214
+ } else if (formattedDate.includes(".")) {
2215
+ char = ".";
2216
+ }
2217
+ }
2218
+ }
2219
+ }
2220
+ return "YYYY" + char + "MM" + char + "DD";
2221
+ })();
2222
+ }
2223
+ return userLocaleDateFormat;
2224
+ };
2225
+ })();
2226
+ function getEmptyImageSrc() {
2227
+ return "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";
2228
+ }
2229
+ function getPercentage(part, total) {
2230
+ const p = FLOAT_LAX(part);
2231
+ const t = FLOAT_LAX(total);
2232
+ if (t === 0) {
2233
+ return 100;
2234
+ }
2235
+ return Math.max(0, Math.min(100, p / t * 100));
2236
+ }
2237
+ async function getImagePixels(image) {
2238
+ if (!globalThis?.document?.createElement || !globalThis?.document?.body?.appendChild) {
2239
+ console.warn("LeUtils.getImagePixels: Document is not available, returning empty pixels.");
2240
+ return new Uint8ClampedArray();
2241
+ }
2242
+ const canvas = globalThis.document.createElement("canvas");
2243
+ globalThis.document.body.appendChild(canvas);
2244
+ try {
2245
+ const ctx = canvas.getContext("2d");
2246
+ const width = Math.floor(image.width);
2247
+ const height = Math.floor(image.height);
2248
+ if (!ctx || width <= 0 || height <= 0) {
2249
+ return new Uint8ClampedArray();
2250
+ }
2251
+ canvas.width = width;
2252
+ canvas.height = height;
2253
+ ctx.drawImage(image, 0, 0, canvas.width, canvas.height);
2254
+ return ctx.getImageData(0, 0, canvas.width, canvas.height).data;
2255
+ } finally {
2256
+ canvas?.parentNode?.removeChild(canvas);
2257
+ }
2258
+ }
2259
+ async function getColoredImage(image, color) {
2260
+ if (!globalThis?.document?.createElement || !globalThis?.document?.body?.appendChild) {
2261
+ console.warn("LeUtils.getColoredImage: Document is not available, returning empty image src.");
2262
+ return getEmptyImageSrc();
2263
+ }
2264
+ const canvas = globalThis.document.createElement("canvas");
2265
+ globalThis.document.body.appendChild(canvas);
2266
+ try {
2267
+ const ctx = canvas.getContext("2d");
2268
+ const width = Math.floor(image.width);
2269
+ const height = Math.floor(image.height);
2270
+ if (!ctx || width <= 0 || height <= 0) {
2271
+ return getEmptyImageSrc();
2272
+ }
2273
+ canvas.width = width;
2274
+ canvas.height = height;
2275
+ ctx.drawImage(image, 0, 0, canvas.width, canvas.height);
2276
+ ctx.globalCompositeOperation = "source-in";
2277
+ ctx.fillStyle = color;
2278
+ ctx.fillRect(0, 0, canvas.width, canvas.height);
2279
+ return canvas.toDataURL("image/png");
2280
+ } finally {
2281
+ canvas?.parentNode?.removeChild(canvas);
2282
+ }
2283
+ }
2284
+ function rgbToHex(rgb) {
2285
+ return "#" + rgb.map((x) => {
2286
+ const hex = x.toString(16);
2287
+ return hex.length === 1 ? "0" + hex : hex;
2288
+ }).join("");
2289
+ }
2290
+ function hexToRgb(hexstring) {
2291
+ const initialHexstring = hexstring;
2292
+ const h = STRING(hexstring).replace(/[^0-9A-F]/gi, "");
2293
+ const hasAlpha = h.length === 4 || h.length === 8;
2294
+ let finalH = h;
2295
+ while (finalH.length < 6) {
2296
+ finalH = finalH.replace(/(.)/g, "$1$1");
2297
+ }
2298
+ const result = finalH.match(/\w{2}/g)?.map((a) => parseInt(a, 16));
2299
+ if (!result || result.length < 3) {
2300
+ throw new Error('Invalid hex color: "' + finalH + '" (was given "' + initialHexstring + '")');
2301
+ }
2302
+ return [
2303
+ result[0],
2304
+ result[1],
2305
+ result[2],
2306
+ ...hasAlpha ? [result[3]] : []
2307
+ ];
2308
+ }
2309
+ function rgbToHsl(rgb) {
2310
+ const r = rgb[0] / 255;
2311
+ const g = rgb[1] / 255;
2312
+ const b = rgb[2] / 255;
2313
+ const max = Math.max(r, g, b);
2314
+ const min = Math.min(r, g, b);
2315
+ let h = 0;
2316
+ let s = 0;
2317
+ const l = (max + min) / 2;
2318
+ if (max !== min) {
2319
+ const d = max - min;
2320
+ s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
2321
+ switch (max) {
2322
+ case r:
2323
+ h = (g - b) / d + (g < b ? 6 : 0);
2324
+ break;
2325
+ case g:
2326
+ h = (b - r) / d + 2;
2327
+ break;
2328
+ case b:
2329
+ h = (r - g) / d + 4;
2330
+ break;
2331
+ }
2332
+ h /= 6;
2333
+ }
2334
+ return [h, s, l, ...rgb.length >= 4 ? [rgb[3] / 255] : []];
2335
+ }
2336
+ var hslToRgb = /* @__PURE__ */ (() => {
2337
+ const hue2rgb = (p, q, t) => {
2338
+ if (t < 0) t += 1;
2339
+ if (t > 1) t -= 1;
2340
+ if (t < 1 / 6) return p + (q - p) * 6 * t;
2341
+ if (t < 1 / 2) return q;
2342
+ if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;
2343
+ return p;
2344
+ };
2345
+ return (hsl) => {
2346
+ const h = hsl[0];
2347
+ const s = hsl[1];
2348
+ const l = hsl[2];
2349
+ let r = 1;
2350
+ let g = 1;
2351
+ let b = 1;
2352
+ if (s !== 0) {
2353
+ const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
2354
+ const p = 2 * l - q;
2355
+ r = hue2rgb(p, q, h + 1 / 3);
2356
+ g = hue2rgb(p, q, h);
2357
+ b = hue2rgb(p, q, h - 1 / 3);
2358
+ }
2359
+ return [r * 255, g * 255, b * 255, ...hsl.length >= 4 ? [hsl[3] * 255] : []].map((c) => Math.max(0, Math.min(255, Math.round(c))));
2360
+ };
2361
+ })();
2362
+ function rgbToLab(rgb) {
2363
+ let r = rgb[0] / 255;
2364
+ let g = rgb[1] / 255;
2365
+ let b = rgb[2] / 255;
2366
+ r = r > 0.04045 ? Math.pow((r + 0.055) / 1.055, 2.4) : r / 12.92;
2367
+ g = g > 0.04045 ? Math.pow((g + 0.055) / 1.055, 2.4) : g / 12.92;
2368
+ b = b > 0.04045 ? Math.pow((b + 0.055) / 1.055, 2.4) : b / 12.92;
2369
+ let x = (r * 0.4124 + g * 0.3576 + b * 0.1805) / 0.95047;
2370
+ let y = r * 0.2126 + g * 0.7152 + b * 0.0722;
2371
+ let z = (r * 0.0193 + g * 0.1192 + b * 0.9505) / 1.08883;
2372
+ x = x > 8856e-6 ? Math.pow(x, 1 / 3) : 7.787 * x + 16 / 116;
2373
+ y = y > 8856e-6 ? Math.pow(y, 1 / 3) : 7.787 * y + 16 / 116;
2374
+ z = z > 8856e-6 ? Math.pow(z, 1 / 3) : 7.787 * z + 16 / 116;
2375
+ return [116 * y - 16, 500 * (x - y), 200 * (y - z), ...rgb.length >= 4 ? [rgb[3] / 255] : []];
2376
+ }
2377
+ function getDifferenceBetweenRgb(rgbA, rgbB) {
2378
+ const labA = rgbToLab(rgbA);
2379
+ const labB = rgbToLab(rgbB);
2380
+ return getDifferenceBetweenLab(labA, labB);
2381
+ }
2382
+ function getDifferenceBetweenLab(labA, labB) {
2383
+ const deltaL = labA[0] - labB[0];
2384
+ const deltaA = labA[1] - labB[1];
2385
+ const deltaB = labA[2] - labB[2];
2386
+ const c1 = Math.sqrt(labA[1] * labA[1] + labA[2] * labA[2]);
2387
+ const c2 = Math.sqrt(labB[1] * labB[1] + labB[2] * labB[2]);
2388
+ const deltaC = c1 - c2;
2389
+ let deltaH = deltaA * deltaA + deltaB * deltaB - deltaC * deltaC;
2390
+ deltaH = deltaH < 0 ? 0 : Math.sqrt(deltaH);
2391
+ const sc = 1 + 0.045 * c1;
2392
+ const sh = 1 + 0.015 * c1;
2393
+ const deltaLKlsl = deltaL / 1;
2394
+ const deltaCkcsc = deltaC / sc;
2395
+ const deltaHkhsh = deltaH / sh;
2396
+ const i = deltaLKlsl * deltaLKlsl + deltaCkcsc * deltaCkcsc + deltaHkhsh * deltaHkhsh;
2397
+ return i < 0 ? 0 : Math.sqrt(i);
2398
+ }
2399
+ function getRgbBetween(startRgb, endRgb, percentage) {
2400
+ const p = FLOAT_LAX(percentage);
2401
+ const partEnd = Math.max(0, Math.min(1, p / 100));
2402
+ const partStart = 1 - partEnd;
2403
+ const length = Math.min(startRgb.length, endRgb.length);
2404
+ const result = [];
2405
+ for (let i = 0; i < length; i++) {
2406
+ result.push(Math.max(0, Math.min(255, Math.round(startRgb[i] * partStart + endRgb[i] * partEnd))));
2407
+ }
2408
+ return result;
2409
+ }
2410
+ function getRgbOfGradient(gradient, percentage) {
2411
+ const p = Math.max(0, Math.min(100, FLOAT_LAX(percentage)));
2412
+ let closest = null;
2413
+ each(gradient, (_color, percentStr) => {
2414
+ const percent = INT_LAX(percentStr);
2415
+ if (closest === null) {
2416
+ closest = [percent, Math.abs(p - percent)];
2417
+ } else {
2418
+ const difference = Math.abs(p - percent);
2419
+ if (difference < closest[1]) {
2420
+ closest = [percent, difference];
2421
+ }
2422
+ }
2423
+ });
2424
+ if (closest === null) {
2425
+ return [0, 0, 0];
2426
+ }
2427
+ const closestPercent = closest[0];
2428
+ const HIGHER = 99999;
2429
+ const LOWER = -99999;
2430
+ let higher = HIGHER;
2431
+ let lower = LOWER;
2432
+ each(gradient, (_color, percentStr) => {
2433
+ const percent = INT_LAX(percentStr);
2434
+ if (percent < closestPercent) {
2435
+ if (percent > lower) {
2436
+ lower = percent;
2437
+ }
2438
+ }
2439
+ if (percent > closestPercent) {
2440
+ if (percent < higher) {
2441
+ higher = percent;
2442
+ }
2443
+ }
2444
+ });
2445
+ if (higher === HIGHER && lower === LOWER || higher === lower) {
2446
+ const gradientValue = gradient[closestPercent];
2447
+ if (isNumberArray(gradientValue)) {
2448
+ return gradientValue;
2449
+ }
2450
+ console.error("LeUtils.getRgbFromGradient: gradient entry is not a number array", gradientValue);
2451
+ return [0, 0, 0];
2452
+ } else if (higher !== HIGHER && lower !== LOWER) {
2453
+ const higherDifference = Math.abs(higher - p);
2454
+ const lowerDifference = Math.abs(p - lower);
2455
+ if (higherDifference > lowerDifference) {
2456
+ higher = closestPercent;
2457
+ } else {
2458
+ lower = closestPercent;
2459
+ }
2460
+ } else if (lower === LOWER) {
2461
+ lower = closestPercent;
2462
+ } else {
2463
+ higher = closestPercent;
2464
+ }
2465
+ if (lower > higher) {
2466
+ const tmp = higher;
2467
+ higher = lower;
2468
+ lower = tmp;
2469
+ }
2470
+ const total = higher - lower;
2471
+ const part = p - lower;
2472
+ const lowerGradient = gradient[lower];
2473
+ const higherGradient = gradient[higher];
2474
+ if (!isNumberArray(lowerGradient) || !isNumberArray(higherGradient)) {
2475
+ console.error("LeUtils.getRgbFromGradient: gradient entries are not number arrays", lowerGradient, higherGradient);
2476
+ return [0, 0, 0];
2477
+ }
2478
+ return getRgbBetween(lowerGradient, higherGradient, part / total * 100);
2479
+ }
2480
+ function downloadFile(name, data) {
2481
+ if (!globalThis.document?.createElement || !globalThis.URL?.createObjectURL) return;
2482
+ const a = globalThis.document.createElement("a");
2483
+ a.style.display = "none";
2484
+ const url = typeof data === "string" ? data : globalThis.URL.createObjectURL(data);
2485
+ a.href = url;
2486
+ a.download = name;
2487
+ globalThis.document.body.appendChild(a);
2488
+ a.click();
2489
+ setTimeout(() => {
2490
+ globalThis.document.body.removeChild(a);
2491
+ if (typeof data !== "string") globalThis.URL.revokeObjectURL(url);
2492
+ }, 0);
2493
+ }
2494
+ function localStorageGet(key) {
2495
+ try {
2496
+ return globalThis.localStorage?.getItem(key) ?? null;
2497
+ } catch {
2498
+ return null;
2499
+ }
2500
+ }
2501
+ function localStorageSet(key, value) {
2502
+ try {
2503
+ globalThis.localStorage?.setItem(key, value);
2504
+ } catch {
2505
+ }
2506
+ }
2507
+ function localStorageRemove(key) {
2508
+ try {
2509
+ globalThis.localStorage?.removeItem(key);
2510
+ } catch {
2511
+ }
2512
+ }
2513
+ function isGivenHostPrivate(host) {
2514
+ const h = STRING(host).trim().toLowerCase();
2515
+ return h === "localhost" || h === "127.0.0.1" || h.startsWith("192.168.") || h.startsWith("10.") || /^172\.(1[6-9]|2[0-9]|3[0-1])\./.test(h);
2516
+ }
2517
+ function isCurrentHostPrivate() {
2518
+ return isGivenHostPrivate(globalThis?.location?.hostname);
2519
+ }
2520
+ function createWorkerThread(name) {
2521
+ if (!globalThis?.Worker) {
2522
+ console.warn("LeUtils.createWorkerThread: Workers are not supported, returning a dummy.");
2523
+ return {
2524
+ worker: null,
2525
+ sendMessage: (_data, _options) => Promise.reject("Workers are not supported in this environment")
2526
+ };
2527
+ }
2528
+ const worker = new globalThis.Worker("/workers/" + name + ".worker.js");
2529
+ const listeners = /* @__PURE__ */ new Map();
2530
+ const sendMessage = (data, options) => {
2531
+ return new Promise((resolve, reject) => {
2532
+ const id = uniqueId();
2533
+ listeners.set(id, resolve);
2534
+ globalThis.setTimeout(() => {
2535
+ listeners.delete(id);
2536
+ reject("timeout");
2537
+ }, options?.timeout ?? 1e4);
2538
+ const messageData = isRecordLike(data) ? data : { data };
2539
+ worker.postMessage({ id, ...messageData });
2540
+ });
2541
+ };
2542
+ worker.onerror = (error) => {
2543
+ console.error("Worker " + name + ":", error);
2544
+ };
2545
+ worker.onmessage = (message) => {
2546
+ const data = message.data;
2547
+ if (hasId(data)) {
2548
+ const callback = listeners.get(data.id);
2549
+ if (callback) {
2550
+ listeners.delete(data.id);
2551
+ callback(data);
2552
+ }
2553
+ }
2554
+ };
2555
+ return { worker, sendMessage };
2556
+ }
2557
+ var sendWorkerMessage = /* @__PURE__ */ (() => {
2558
+ const workers = /* @__PURE__ */ new Map();
2559
+ return (workerName, data, options) => {
2560
+ if (!workers.has(workerName)) {
2561
+ workers.set(workerName, createWorkerThread(workerName));
2562
+ }
2563
+ const worker = workers.get(workerName);
2564
+ if (worker && hasSendMessage(worker)) {
2565
+ return worker.sendMessage(data, options);
2566
+ }
2567
+ console.error("LeUtils.createWorkerThread: worker does not have sendMessage method", worker);
2568
+ return Promise.reject(new Error("Worker does not have sendMessage method"));
2569
+ };
2570
+ })();
2571
+
2572
+ // src/classes/EventEmitter.ts
2573
+ var EventEmitter = class {
2574
+ #events;
2575
+ /**
2576
+ * Creates a new EventEmitter instance.
2577
+ */
2578
+ constructor() {
2579
+ this.#events = /* @__PURE__ */ new Map();
2580
+ }
2581
+ /**
2582
+ * Registers a listener for a specific event.
2583
+ *
2584
+ * @param {string} event - The name of the event to listen for.
2585
+ * @param {Function} listener - The function to call when the event is emitted.
2586
+ * @returns {{remove:(()=>void)}}
2587
+ */
2588
+ on(event, listener) {
2589
+ if (!this.#events.has(event)) {
2590
+ this.#events.set(event, /* @__PURE__ */ new Set());
2591
+ }
2592
+ this.#events.get(event).add(listener);
2593
+ return {
2594
+ remove: () => this.off(event, listener)
2595
+ };
2596
+ }
2597
+ /**
2598
+ * Registers a listener for a specific event, this listener will be called only once.
2599
+ *
2600
+ * @param {string} event - The name of the event to listen for.
2601
+ * @param {Function} listener - The function to call when the event is emitted.
2602
+ * @returns {{remove:()=>void}}
2603
+ */
2604
+ once(event, listener) {
2605
+ const wrapper = (...args) => {
2606
+ this.off(event, wrapper);
2607
+ listener(...args);
2608
+ };
2609
+ this.on(event, wrapper);
2610
+ return {
2611
+ remove: () => this.off(event, wrapper)
2612
+ };
2613
+ }
2614
+ /**
2615
+ * Removes a listener for a specific event.
2616
+ *
2617
+ * @param {string} event - The name of the event to stop listening for.
2618
+ * @param {Function} listener - The function to remove from the event listeners.
2619
+ */
2620
+ off(event, listener) {
2621
+ const listeners = this.#events.get(event);
2622
+ if (listeners) {
2623
+ listeners.delete(listener);
2624
+ if (listeners.size === 0) {
2625
+ this.#events.delete(event);
2626
+ }
2627
+ }
2628
+ }
2629
+ /**
2630
+ * Emits an event, calling all registered listeners with the provided arguments.
2631
+ *
2632
+ * @param {string} event - The name of the event to emit.
2633
+ * @param {...*} args - The arguments to pass to the listeners.
2634
+ */
2635
+ emit(event, ...args) {
2636
+ const listeners = this.#events.get(event);
2637
+ if (listeners) {
2638
+ const snapshot = Array.from(listeners);
2639
+ for (const listener of snapshot) {
2640
+ try {
2641
+ listener(...args);
2642
+ } catch (err) {
2643
+ console.error(`Error in listener for "${event}":`, err);
2644
+ }
2645
+ }
2646
+ }
2647
+ }
2648
+ /**
2649
+ * Clears all listeners for a specific event or all events if no event is specified.
2650
+ *
2651
+ * @param {string} [event] - The name of the event to clear listeners for. If not provided, all events will be cleared.
2652
+ */
2653
+ clear(event) {
2654
+ if (typeof event !== "undefined") {
2655
+ this.#events.delete(event);
2656
+ } else {
2657
+ this.#events.clear();
2658
+ }
2659
+ }
2660
+ };
2661
+
2662
+ // src/classes/LinkedList.ts
2663
+ var LinkedListNode = class {
2664
+ value;
2665
+ next = null;
2666
+ previous = null;
2667
+ constructor(value) {
2668
+ this.value = value;
2669
+ }
2670
+ };
2671
+ var LinkedList = class {
2672
+ #head = null;
2673
+ #tail = null;
2674
+ #size = 0;
2675
+ constructor() {
2676
+ }
2677
+ /**
2678
+ * Returns the number of elements in the list.
2679
+ *
2680
+ * @returns {number}
2681
+ */
2682
+ get size() {
2683
+ return this.#size;
2684
+ }
2685
+ /**
2686
+ * Adds a new value to the beginning of the list.
2687
+ *
2688
+ * @param {*} value
2689
+ */
2690
+ unshift(value) {
2691
+ const newNode = new LinkedListNode(value);
2692
+ if (this.#head === null) {
2693
+ this.#head = newNode;
2694
+ this.#tail = newNode;
2695
+ } else {
2696
+ newNode.next = this.#head;
2697
+ this.#head.previous = newNode;
2698
+ this.#head = newNode;
2699
+ }
2700
+ this.#size++;
2701
+ }
2702
+ /**
2703
+ * Adds a new value to the end of the list.
2704
+ *
2705
+ * @param {*} value
2706
+ */
2707
+ push(value) {
2708
+ const newNode = new LinkedListNode(value);
2709
+ if (this.#tail === null) {
2710
+ this.#head = newNode;
2711
+ this.#tail = newNode;
2712
+ } else {
2713
+ newNode.previous = this.#tail;
2714
+ this.#tail.next = newNode;
2715
+ this.#tail = newNode;
2716
+ }
2717
+ this.#size++;
2718
+ }
2719
+ /**
2720
+ * Removes the first value from the list and returns it.
2721
+ *
2722
+ * @returns {*|undefined}
2723
+ */
2724
+ shift() {
2725
+ if (this.#head === null) {
2726
+ return void 0;
2727
+ }
2728
+ const value = this.#head.value;
2729
+ this.#head = this.#head.next;
2730
+ if (this.#head !== null) {
2731
+ this.#head.previous = null;
2732
+ } else {
2733
+ this.#tail = null;
2734
+ }
2735
+ this.#size--;
2736
+ return value;
2737
+ }
2738
+ /**
2739
+ * Removes the last value from the list and returns it.
2740
+ *
2741
+ * @returns {*|undefined}
2742
+ */
2743
+ pop() {
2744
+ if (this.#tail === null) {
2745
+ return void 0;
2746
+ }
2747
+ const value = this.#tail.value;
2748
+ this.#tail = this.#tail.previous;
2749
+ if (this.#tail !== null) {
2750
+ this.#tail.next = null;
2751
+ } else {
2752
+ this.#head = null;
2753
+ }
2754
+ this.#size--;
2755
+ return value;
2756
+ }
2757
+ };
2758
+
2759
+ // src/classes/SerializableMap.ts
2760
+ var SerializableMap = class extends Map {
2761
+ /**
2762
+ * Returns a JSON representation of the map.
2763
+ *
2764
+ * @returns {Record<string, V>}
2765
+ */
2766
+ toJSON() {
2767
+ if (this && typeof this === "object" && Symbol.iterator in this) {
2768
+ const entries = [];
2769
+ for (const [key, value] of this) {
2770
+ const stringKey = typeof key === "string" ? key : String(key);
2771
+ entries.push([stringKey, value]);
2772
+ }
2773
+ return Object.fromEntries(entries);
2774
+ }
2775
+ return {};
2776
+ }
2777
+ };
2778
+
2779
+ // src/classes/TreeSet.ts
2780
+ var TreeSet = class {
2781
+ #elements;
2782
+ #comparator;
2783
+ /**
2784
+ * Creates a new TreeSet with the given elements and comparator.
2785
+ *
2786
+ * @param {*[]} [elements=[]] - The initial elements of the set.
2787
+ * @param {(valueA:*, valueB:*) => number} [comparator=defaultCompare] - The comparator function to use for sorting.
2788
+ */
2789
+ constructor(elements, comparator) {
2790
+ this.#comparator = comparator || compare;
2791
+ this.#elements = elements ? [...elements] : [];
2792
+ this.#elements.sort(this.#comparator);
2793
+ }
2794
+ /**
2795
+ * @param {*} value - The value to search for in the set.
2796
+ * @returns {{found:boolean, index:number, value:*|undefined}} - An object containing whether the value was found, the index where it would be inserted, and the value at that index (if found).
2797
+ * @private
2798
+ */
2799
+ binarySearch(value) {
2800
+ let low = 0;
2801
+ let high = this.#elements.length - 1;
2802
+ while (low <= high) {
2803
+ const mid = Math.floor((low + high) / 2);
2804
+ const midValue = this.#elements[mid];
2805
+ const cmp = this.#comparator(midValue, value);
2806
+ if (cmp < 0) {
2807
+ low = mid + 1;
2808
+ } else if (cmp > 0) {
2809
+ high = mid - 1;
2810
+ } else {
2811
+ return { found: true, index: mid, value: midValue };
2812
+ }
2813
+ }
2814
+ return { found: false, index: low, value: void 0 };
2815
+ }
2816
+ /**
2817
+ * Returns the elements of the set.
2818
+ */
2819
+ getElements() {
2820
+ return this.#elements;
2821
+ }
2822
+ /**
2823
+ * Returns the comparator of the set.
2824
+ *
2825
+ * @returns {(valueA:*, valueB:*) => number}
2826
+ */
2827
+ getComparator() {
2828
+ return this.#comparator;
2829
+ }
2830
+ /**
2831
+ * Returns the size of the set.
2832
+ *
2833
+ * @returns {number}
2834
+ */
2835
+ size() {
2836
+ return this.#elements.length;
2837
+ }
2838
+ /**
2839
+ * Returns true if the set is empty, false otherwise.
2840
+ *
2841
+ * @returns {boolean}
2842
+ */
2843
+ isEmpty() {
2844
+ return this.#elements.length <= 0;
2845
+ }
2846
+ /**
2847
+ * Returns true if the set contains a value that is equal to the given value, returns false otherwise.
2848
+ *
2849
+ * @param {*} value - The value to check for in the set.
2850
+ * @return {boolean} - True if the set contains the value, false otherwise.
2851
+ */
2852
+ contains(value) {
2853
+ return this.binarySearch(value).found;
2854
+ }
2855
+ /**
2856
+ * Returns the first element of the set, or undefined if it is empty.
2857
+ *
2858
+ * @return {*|undefined} - The first element of the set, or undefined if it is empty.
2859
+ */
2860
+ first() {
2861
+ return this.#elements.length > 0 ? this.#elements[0] : void 0;
2862
+ }
2863
+ /**
2864
+ * Returns the last element of the set, or undefined if it is empty.
2865
+ *
2866
+ * @return {*|undefined} - The last element of the set, or undefined if it is empty.
2867
+ */
2868
+ last() {
2869
+ return this.#elements.length > 0 ? this.#elements[this.#elements.length - 1] : void 0;
2870
+ }
2871
+ /**
2872
+ * Removes and returns the first element of the set, or undefined if it is empty.
2873
+ *
2874
+ * @returns {*|undefined} - The first element of the set, or undefined if it is empty.
2875
+ */
2876
+ pollFirst() {
2877
+ return this.#elements.length > 0 ? this.#elements.splice(0, 1)[0] : void 0;
2878
+ }
2879
+ /**
2880
+ * Removes and returns the last element of the set, or undefined if it is empty.
2881
+ *
2882
+ * @returns {*|undefined} - The last element of the set, or undefined if it is empty.
2883
+ */
2884
+ pollLast() {
2885
+ return this.#elements.length > 0 ? this.#elements.splice(this.#elements.length - 1, 1)[0] : void 0;
2886
+ }
2887
+ /**
2888
+ * Adds the given value to the set. Will only do so if no equal value already exists.
2889
+ * @param {*} value - The value to add to the set.
2890
+ */
2891
+ add(value) {
2892
+ const result = this.binarySearch(value);
2893
+ if (result.found) {
2894
+ return;
2895
+ }
2896
+ this.#elements.splice(result.index, 0, value);
2897
+ }
2898
+ /**
2899
+ * Removes the given value from the set.
2900
+ * @param value - The value to remove
2901
+ * @returns true if removed
2902
+ */
2903
+ remove(value) {
2904
+ const result = this.binarySearch(value);
2905
+ if (result.found) {
2906
+ this.#elements.splice(result.index, 1);
2907
+ return true;
2908
+ }
2909
+ return false;
2910
+ }
2911
+ /**
2912
+ * Adds all the given values to the set. Will only do so if no equal value already exists.
2913
+ *
2914
+ * @param {unknown} values - The values to add to the set.
2915
+ */
2916
+ addAll(values) {
2917
+ each(values, (v) => {
2918
+ if (v !== null && v !== void 0) {
2919
+ Function.prototype.apply.call(this.add, this, [v]);
2920
+ }
2921
+ });
2922
+ }
2923
+ /**
2924
+ * Returns an equal value that's already in the tree set, or undefined if no equal values in it exist.
2925
+ *
2926
+ * @param {*} value - The value to search for in the set.
2927
+ * @return {*|undefined} - The equal value if found, or undefined if not found.
2928
+ */
2929
+ getEqualValue(value) {
2930
+ const result = this.binarySearch(value);
2931
+ if (result.found) {
2932
+ return result.value;
2933
+ }
2934
+ return void 0;
2935
+ }
2936
+ /**
2937
+ * Returns an equal value that's already in the tree set. If no equal values in it exist, the given value will be added and returned.
2938
+ *
2939
+ * @param {*} value - The value to search for in the set.
2940
+ * @return {*} - The equal value if found, or the added value if not found.
2941
+ */
2942
+ getEqualValueOrAdd(value) {
2943
+ const result = this.binarySearch(value);
2944
+ if (result.found) {
2945
+ return result.value;
2946
+ }
2947
+ this.#elements.splice(result.index, 0, value);
2948
+ return value;
2949
+ }
2950
+ /**
2951
+ * Returns a string representation of the TreeSet.
2952
+ *
2953
+ * @returns {string} - A string representation of the TreeSet, including its elements and comparator.
2954
+ */
2955
+ toString() {
2956
+ return `TreeSet{elements:${this.#elements}, comparator:${this.#comparator}}`;
2957
+ }
2958
+ /**
2959
+ * Returns a JSON representation of the TreeSet.
2960
+ *
2961
+ * @returns {Object} - An object containing the elements and comparator of the TreeSet.
2962
+ */
2963
+ toJSON() {
2964
+ return {
2965
+ elements: this.#elements,
2966
+ comparator: this.#comparator.toString()
2967
+ };
2968
+ }
2969
+ };
2970
+
2971
+ // src/index.ts
2972
+ var LeUtils = {
2973
+ ...LeUtils_exports
2974
+ };
2975
+ export {
2976
+ ARRAY,
2977
+ BOOL,
2978
+ BOOL_ANY,
2979
+ EventEmitter,
2980
+ FLOAT,
2981
+ FLOAT_ANY,
2982
+ FLOAT_LAX,
2983
+ FLOAT_LAX_ANY,
2984
+ INT,
2985
+ INT_ANY,
2986
+ INT_LAX,
2987
+ INT_LAX_ANY,
2988
+ ISSET,
2989
+ IS_ARRAY,
2990
+ IS_OBJECT,
2991
+ LeUtils,
2992
+ LinkedList,
2993
+ OBJECT,
2994
+ STRING,
2995
+ STRING_ANY,
2996
+ SerializableMap,
2997
+ TreeSet,
2998
+ atob,
2999
+ base64ToBytes,
3000
+ base64ToHex,
3001
+ base64ToUtf8,
3002
+ btoa,
3003
+ bytesToBase64,
3004
+ cachedFetch,
3005
+ capitalize,
3006
+ clone,
3007
+ compare,
3008
+ compareNaturalStrings,
3009
+ compareNumbers,
3010
+ compareNumericStrings,
3011
+ compareTimestampStrings,
3012
+ contains,
3013
+ containsAll,
3014
+ containsAllCaseInsensitive,
3015
+ containsAny,
3016
+ containsAnyCaseInsensitive,
3017
+ containsCaseInsensitive,
3018
+ containsNone,
3019
+ containsNoneCaseInsensitive,
3020
+ createTransactionalValue,
3021
+ createWorkerThread,
3022
+ downloadFile,
3023
+ each,
3024
+ eachAsync,
3025
+ eachIterator,
3026
+ endsWithAny,
3027
+ equals,
3028
+ equalsMapLike,
3029
+ fetch,
3030
+ filter,
3031
+ find,
3032
+ findIndex,
3033
+ findIndexValue,
3034
+ flattenArray,
3035
+ flattenToArray,
3036
+ generateNamePermutations,
3037
+ getColoredImage,
3038
+ getDifferenceBetweenLab,
3039
+ getDifferenceBetweenRgb,
3040
+ getEmptyImageSrc,
3041
+ getEmptySimplifiedCollection,
3042
+ getImagePixels,
3043
+ getObjectFieldsCount,
3044
+ getPercentage,
3045
+ getRgbBetween,
3046
+ getRgbOfGradient,
3047
+ getUserLocale,
3048
+ getUserLocaleDateFormat,
3049
+ getValueAtIndex,
3050
+ hexToBase64,
3051
+ hexToRgb,
3052
+ hslToRgb,
3053
+ increaseNumericStringByOne,
3054
+ isCurrentHostPrivate,
3055
+ isEmptyObject,
3056
+ isFocusClear,
3057
+ isGeneratorFunction,
3058
+ isGivenHostPrivate,
3059
+ isTransactionalValueValid,
3060
+ localStorageGet,
3061
+ localStorageRemove,
3062
+ localStorageSet,
3063
+ map,
3064
+ mapToArray,
3065
+ mapToArraySorted,
3066
+ onDomReady,
3067
+ parseVersionString,
3068
+ platformHasCursor,
3069
+ platformIsMobile,
3070
+ promiseAnimationFrameTimeout,
3071
+ promiseTimeout,
3072
+ purgeEmail,
3073
+ purgeErrorMessage,
3074
+ purgeSentence,
3075
+ rgbToHex,
3076
+ rgbToHsl,
3077
+ rgbToLab,
3078
+ sendWorkerMessage,
3079
+ setAnimationFrameInterval,
3080
+ setAnimationFrameTimeout,
3081
+ setInterval,
3082
+ setTimeout,
3083
+ sortKeys,
3084
+ startsWithAny,
3085
+ supportsEach,
3086
+ timestamp,
3087
+ transactionCancelChange,
3088
+ transactionCommitChange,
3089
+ transactionGetCommittedValue,
3090
+ transactionGetValue,
3091
+ transactionIsChangeRelevant,
3092
+ transactionSetAndCommit,
3093
+ transactionSetWithoutCommitting,
3094
+ transactionalValueToString,
3095
+ trim,
3096
+ trimEnd,
3097
+ trimStart,
3098
+ uniqueId,
3099
+ utf8ToBase64
12
3100
  };
13
3101
  //# sourceMappingURL=index.js.map