@tspro/ts-utils-lib 1.21.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,103 +1,152 @@
1
- /* TsUtilsLib v1.21.0 | (c) 2023 PahkaSoft | Licensed under the MIT License */
2
- "use strict";
1
+ 'use strict';
2
+
3
+ /*!
4
+ * TsUtilsLib v2.1.0 (cjs)
5
+ * (c) 2023–2025 PahkaSoft
6
+ * Licensed under the MIT License
7
+ */
3
8
  var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
9
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
10
  var __export = (target, all) => {
9
11
  for (var name in all)
10
12
  __defProp(target, name, { get: all[name], enumerable: true });
11
13
  };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toCommonJS = (mod2) => __copyProps(__defProp({}, "__esModule", { value: true }), mod2);
21
14
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
22
15
 
23
- // src/index.ts
24
- var index_exports = {};
25
- __export(index_exports, {
26
- AnchoredRect: () => AnchoredRect,
27
- Assert: () => assert_exports,
28
- BaseContainer: () => BaseContainer,
29
- BiMap: () => BiMap,
30
- Cookies: () => cookies_exports,
31
- DeepSet: () => DeepSet,
32
- DefaultArray: () => DefaultArray,
33
- DefaultEqualityFn: () => DefaultEqualityFn,
34
- Device: () => device_exports,
35
- DivRect: () => DivRect,
36
- Guard: () => guard_exports,
37
- IndexArray: () => IndexArray,
38
- LRUCache: () => LRUCache,
39
- LinkedList: () => LinkedList,
40
- Map1: () => Map1,
41
- Map2: () => Map2,
42
- Map3: () => Map3,
43
- MultiContainer: () => MultiContainer,
44
- Rect: () => Rect,
45
- Set1: () => Set1,
46
- SetBase: () => SetBase,
47
- SignedIndexArray: () => SignedIndexArray,
48
- SmallIntCache: () => SmallIntCache,
49
- Stack: () => Stack,
50
- TriMap: () => TriMap,
51
- UniMap: () => UniMap,
52
- Utils: () => utils_exports,
53
- ValueSet: () => ValueSet,
54
- Vec: () => Vec,
55
- Vec2: () => Vec2,
56
- asMulti: () => asMulti
57
- });
58
- module.exports = __toCommonJS(index_exports);
59
-
60
16
  // src/assert/index.ts
61
17
  var assert_exports = {};
62
18
  __export(assert_exports, {
63
- array_elem: () => array_elem,
64
- array_id: () => array_id,
65
19
  assert: () => assert,
66
- assertEnum: () => assertEnum,
67
- eq: () => eq,
68
- even: () => even,
20
+ doesNotThrow: () => doesNotThrow2,
21
+ doesThrow: () => doesThrow2,
69
22
  fail: () => fail,
70
- finite: () => finite,
71
- in_group: () => in_group,
72
- int: () => int,
73
- int_between: () => int_between,
74
- int_between_exclusive: () => int_between_exclusive,
75
- int_eq: () => int_eq,
76
- int_gt: () => int_gt,
77
- int_gte: () => int_gte,
78
- int_lt: () => int_lt,
79
- int_lte: () => int_lte,
80
- interrupt: () => interrupt,
23
+ isArray: () => isArray2,
24
+ isArrayOrUndefined: () => isArrayOrUndefined2,
25
+ isBigInt: () => isBigInt2,
26
+ isBoolean: () => isBoolean2,
27
+ isBooleanOrUndefined: () => isBooleanOrUndefined2,
28
+ isDeepEqual: () => isDeepEqual2,
29
+ isDefined: () => isDefined2,
30
+ isEmptyArray: () => isEmptyArray2,
31
+ isEmptyArrayOrUndefined: () => isEmptyArrayOrUndefined2,
32
+ isEmptyObject: () => isEmptyObject2,
33
+ isEmptyString: () => isEmptyString2,
34
+ isEmptyStringOrUndefined: () => isEmptyStringOrUndefined2,
35
+ isEnumValue: () => isEnumValue2,
36
+ isEnumValueOrUndefined: () => isEnumValueOrUndefined2,
37
+ isEven: () => isEven2,
38
+ isFalse: () => isFalse2,
39
+ isFalseOrUndefined: () => isFalseOrUndefined2,
40
+ isFinite: () => isFinite3,
41
+ isFloat: () => isFloat2,
42
+ isFunction: () => isFunction2,
43
+ isFunctionOrUndefined: () => isFunctionOrUndefined2,
44
+ isIncluded: () => isIncluded2,
45
+ isIndex: () => isIndex2,
46
+ isInfinity: () => isInfinity2,
47
+ isInteger: () => isInteger2,
48
+ isIntegerBetween: () => isIntegerBetween2,
49
+ isIntegerBetweenExclusive: () => isIntegerBetweenExclusive2,
50
+ isIntegerEq: () => isIntegerEq2,
51
+ isIntegerGt: () => isIntegerGt2,
52
+ isIntegerGte: () => isIntegerGte2,
53
+ isIntegerLt: () => isIntegerLt2,
54
+ isIntegerLte: () => isIntegerLte2,
55
+ isIntegerOrUndefined: () => isIntegerOrUndefined2,
56
+ isMultipleOf: () => isMultipleOf2,
57
+ isNaNValue: () => isNaNValue2,
58
+ isNeg: () => isNeg2,
59
+ isNegInfinity: () => isNegInfinity2,
60
+ isNegZero: () => isNegZero2,
61
+ isNonEmptyArray: () => isNonEmptyArray2,
62
+ isNonEmptyArrayOrUndefined: () => isNonEmptyArrayOrUndefined2,
63
+ isNonEmptyString: () => isNonEmptyString2,
64
+ isNonEmptyStringOrUndefined: () => isNonEmptyStringOrUndefined2,
65
+ isNonNeg: () => isNonNeg2,
66
+ isNonNull: () => isNonNull2,
67
+ isNonPos: () => isNonPos2,
68
+ isNull: () => isNull2,
69
+ isNullish: () => isNullish2,
70
+ isNumber: () => isNumber2,
71
+ isNumberBetween: () => isNumberBetween2,
72
+ isNumberBetweenExclusive: () => isNumberBetweenExclusive2,
73
+ isNumberOrUndefined: () => isNumberOrUndefined2,
74
+ isNumericString: () => isNumericString2,
75
+ isObject: () => isObject2,
76
+ isObjectOrUndefined: () => isObjectOrUndefined2,
77
+ isOdd: () => isOdd2,
78
+ isPlainObject: () => isPlainObject2,
79
+ isPos: () => isPos2,
80
+ isPosInfinity: () => isPosInfinity2,
81
+ isPosZero: () => isPosZero2,
82
+ isPowerOfTwo: () => isPowerOfTwo2,
83
+ isSafeInteger: () => isSafeInteger2,
84
+ isStrictEqual: () => isStrictEqual2,
85
+ isString: () => isString2,
86
+ isStringOrUndefined: () => isStringOrUndefined2,
87
+ isTrue: () => isTrue2,
88
+ isTrueOrUndefined: () => isTrueOrUndefined2,
89
+ isTypedObject: () => isTypedObject2,
90
+ isUndefined: () => isUndefined2,
91
+ isZero: () => isZero2,
92
+ require: () => require2,
93
+ requireDefined: () => requireDefined,
94
+ requireElement: () => requireElement,
95
+ setErrorClass: () => setErrorClass
96
+ });
97
+
98
+ // src/utils/str/index.ts
99
+ var str_exports = {};
100
+ __export(str_exports, {
101
+ charCount: () => charCount,
102
+ chunkString: () => chunkString,
103
+ insertAt: () => insertAt,
104
+ isString: () => isString,
105
+ makeSentenceFromPascal: () => makeSentenceFromPascal,
106
+ removeAt: () => removeAt,
107
+ repeatString: () => repeatString,
108
+ replaceAt: () => replaceAt,
109
+ stringify: () => stringify,
110
+ toCharArray: () => toCharArray
111
+ });
112
+
113
+ // src/utils/obj/index.ts
114
+ var obj_exports = {};
115
+ __export(obj_exports, {
116
+ deepEqual: () => deepEqual,
117
+ getCtorName: () => getCtorName,
118
+ hasProperties: () => hasProperties,
119
+ isObject: () => isObject
120
+ });
121
+
122
+ // src/guard/index.ts
123
+ var guard_exports = {};
124
+ __export(guard_exports, {
125
+ doesNotThrow: () => doesNotThrow,
126
+ doesThrow: () => doesThrow,
81
127
  isArray: () => isArray,
82
- isArrayIndex: () => isArrayIndex,
83
128
  isArrayOrUndefined: () => isArrayOrUndefined,
129
+ isBigInt: () => isBigInt,
84
130
  isBoolean: () => isBoolean,
85
131
  isBooleanOrUndefined: () => isBooleanOrUndefined,
86
132
  isDeepEqual: () => isDeepEqual,
133
+ isDefined: () => isDefined,
87
134
  isEmptyArray: () => isEmptyArray,
88
135
  isEmptyArrayOrUndefined: () => isEmptyArrayOrUndefined,
136
+ isEmptyObject: () => isEmptyObject,
89
137
  isEmptyString: () => isEmptyString,
90
138
  isEmptyStringOrUndefined: () => isEmptyStringOrUndefined,
91
139
  isEnumValue: () => isEnumValue,
92
140
  isEnumValueOrUndefined: () => isEnumValueOrUndefined,
93
- isEqual: () => isEqual,
94
- isEvenNumber: () => isEvenNumber,
141
+ isEven: () => isEven,
95
142
  isFalse: () => isFalse,
96
143
  isFalseOrUndefined: () => isFalseOrUndefined,
97
144
  isFinite: () => isFinite2,
145
+ isFloat: () => isFloat,
98
146
  isFunction: () => isFunction,
99
147
  isFunctionOrUndefined: () => isFunctionOrUndefined,
100
148
  isIncluded: () => isIncluded,
149
+ isIndex: () => isIndex,
101
150
  isInfinity: () => isInfinity,
102
151
  isInteger: () => isInteger,
103
152
  isIntegerBetween: () => isIntegerBetween,
@@ -108,458 +157,944 @@ __export(assert_exports, {
108
157
  isIntegerLt: () => isIntegerLt,
109
158
  isIntegerLte: () => isIntegerLte,
110
159
  isIntegerOrUndefined: () => isIntegerOrUndefined,
160
+ isMultipleOf: () => isMultipleOf,
111
161
  isNaNValue: () => isNaNValue,
162
+ isNeg: () => isNeg,
112
163
  isNegInfinity: () => isNegInfinity,
164
+ isNegZero: () => isNegZero,
113
165
  isNonEmptyArray: () => isNonEmptyArray,
114
166
  isNonEmptyArrayOrUndefined: () => isNonEmptyArrayOrUndefined,
115
167
  isNonEmptyString: () => isNonEmptyString,
116
168
  isNonEmptyStringOrUndefined: () => isNonEmptyStringOrUndefined,
117
- isNotThrowing: () => isNotThrowing,
169
+ isNonNeg: () => isNonNeg,
170
+ isNonNull: () => isNonNull,
171
+ isNonPos: () => isNonPos,
118
172
  isNull: () => isNull,
119
173
  isNullish: () => isNullish,
120
174
  isNumber: () => isNumber,
121
175
  isNumberBetween: () => isNumberBetween,
122
176
  isNumberBetweenExclusive: () => isNumberBetweenExclusive,
123
177
  isNumberOrUndefined: () => isNumberOrUndefined,
178
+ isNumericString: () => isNumericString,
124
179
  isObject: () => isObject,
125
180
  isObjectOrUndefined: () => isObjectOrUndefined,
126
- isOddNumber: () => isOddNumber,
181
+ isOdd: () => isOdd,
182
+ isPlainObject: () => isPlainObject,
183
+ isPos: () => isPos,
127
184
  isPosInfinity: () => isPosInfinity,
185
+ isPosZero: () => isPosZero,
186
+ isPowerOfTwo: () => isPowerOfTwo,
187
+ isSafeInteger: () => isSafeInteger,
188
+ isStrictEqual: () => isStrictEqual,
128
189
  isString: () => isString,
129
190
  isStringOrUndefined: () => isStringOrUndefined,
130
- isThrowing: () => isThrowing,
131
191
  isTrue: () => isTrue,
132
192
  isTrueOrUndefined: () => isTrueOrUndefined,
133
193
  isTypedObject: () => isTypedObject,
134
194
  isUndefined: () => isUndefined,
135
- odd: () => odd,
136
- require: () => require2,
137
- requireDefined: () => requireDefined,
138
- setErrorClass: () => setErrorClass
195
+ isZero: () => isZero,
196
+ tryOr: () => tryOr
139
197
  });
140
- var errorConstructor = Error;
141
- function setErrorClass(errorClass) {
142
- errorConstructor = errorClass ?? Error;
143
- }
144
- function _fail(...msgs) {
145
- let msg = msgs.join(", ");
146
- throw new errorConstructor("Assertion Failed!" + (msg === "" ? "" : " " + msg));
147
- }
148
- function interrupt(msg) {
149
- _fail("Interrupted!");
150
- }
151
- function assertEnum(enumVal, enumObj, name = "value") {
152
- if (!guard_exports.isEnumValue(enumVal, enumObj))
153
- _fail(`Invalid enum value ${enumVal}.`);
198
+
199
+ // src/utils/enum/index.ts
200
+ var enum_exports = {};
201
+ __export(enum_exports, {
202
+ forEachEnum: () => forEachEnum,
203
+ getEnumEntries: () => getEnumEntries,
204
+ getEnumKey: () => getEnumKey,
205
+ getEnumKeys: () => getEnumKeys,
206
+ getEnumValues: () => getEnumValues
207
+ });
208
+ function getEnumKeys(e) {
209
+ return Object.keys(e).filter((k) => isNaN(Number(k)));
154
210
  }
155
- function int(value, msg) {
156
- if (!guard_exports.isInteger(value))
157
- _fail(`Expected ${value} to be integer.`, msg);
158
- return value;
211
+ function getEnumValues(e) {
212
+ return getEnumKeys(e).map((k) => e[k]);
159
213
  }
160
- function eq(value1, value2, msg) {
161
- if (value1 !== value2)
162
- _fail(`Expected ${value1} to equal ${value2}.`, msg);
163
- return value1;
214
+ function getEnumEntries(e) {
215
+ return getEnumKeys(e).map((k) => [k, e[k]]);
164
216
  }
165
- function int_eq(value, compareTo, msg) {
166
- if (!guard_exports.isIntegerEq(value, compareTo))
167
- _fail(`Expected ${value} to be integer equal to ${compareTo}.`, msg);
168
- return value;
217
+ function getEnumKey(e, value) {
218
+ return getEnumKeys(e).find((k) => e[k] === value);
169
219
  }
170
- function int_lt(value, compareTo, msg) {
171
- if (!guard_exports.isIntegerLt(value, compareTo))
172
- _fail(`Expected ${value} to be integer less than ${compareTo}.`, msg);
173
- return value;
220
+ function forEachEnum(e, callback) {
221
+ for (const [k, v] of getEnumEntries(e)) callback(k, v);
174
222
  }
175
- function int_lte(value, compareTo, msg) {
176
- if (!guard_exports.isIntegerLte(value, compareTo))
177
- _fail(`Expected ${value} to be integer less than or equal to ${compareTo}.`, msg);
178
- return value;
223
+
224
+ // src/guard/index.ts
225
+ function isStrictEqual(val1, val2) {
226
+ return val1 === val2;
179
227
  }
180
- function int_gt(value, compareTo, msg) {
181
- if (!guard_exports.isIntegerGt(value, compareTo))
182
- _fail(`Expected ${value} to be integer greater than ${compareTo}.`, msg);
183
- return value;
228
+ function isDeepEqual(val1, val2) {
229
+ return deepEqual(val1, val2);
184
230
  }
185
- function int_gte(value, compareTo, msg) {
186
- if (!guard_exports.isIntegerGte(value, compareTo))
187
- _fail(`Expected ${value} to be integer greater than or equal to ${compareTo}.`, msg);
188
- return value;
231
+ function isUndefined(val) {
232
+ return val === void 0;
189
233
  }
190
- function int_between(value, min, max, msg) {
191
- if (!guard_exports.isIntegerBetween(value, min, max))
192
- _fail(`Expected integer between ${min} <= ${value} <= ${max}.`, msg);
193
- return value;
234
+ function isNull(val) {
235
+ return val === null;
194
236
  }
195
- function int_between_exclusive(value, min, max, msg) {
196
- if (!guard_exports.isIntegerBetweenExclusive(value, min, max))
197
- _fail(`Expected integer between ${min} < ${value} < ${max}.`, msg);
198
- return value;
237
+ function isNullish(val) {
238
+ return val === void 0 || val === null;
199
239
  }
200
- function odd(value, msg) {
201
- if (!guard_exports.isOddNumber(value))
202
- _fail(`Expected ${value} to be odd number.`, msg);
203
- return value;
240
+ function isDefined(val) {
241
+ return val !== void 0;
204
242
  }
205
- function even(value, msg) {
206
- if (!guard_exports.isEvenNumber(value))
207
- _fail(`Expected ${value} to be even number.`, msg);
208
- return value;
243
+ function isNonNull(val) {
244
+ return val !== null;
209
245
  }
210
- function in_group(value, group, msg) {
211
- if (!group.some((e) => e === value))
212
- _fail(`Expected ${value} to be in group [${group.map((v) => String(v)).join(", ")}].`, msg);
213
- return value;
246
+ function isObject(val) {
247
+ return typeof val === "object" && val !== null && !isArray(val);
214
248
  }
215
- function finite(value, msg) {
216
- if (!guard_exports.isFinite(value))
217
- _fail(`Expected ${value} to be finite number.`, msg);
218
- return value;
249
+ function isEmptyObject(val) {
250
+ return isObject(val) && Object.keys(val).length === 0;
219
251
  }
220
- function array_id(array, index, msg) {
221
- if (!guard_exports.isInteger(index) || !guard_exports.isArray(array) || index < 0 || index >= array.length)
222
- _fail(`Expected ${index} to be array index in bounds [0..${array.length - 1}].`, msg);
223
- return index;
252
+ function isObjectOrUndefined(val) {
253
+ return val === void 0 || isObject(val);
224
254
  }
225
- function array_elem(array, index, msg) {
226
- return array[array_id(array, index, msg)];
255
+ function isPlainObject(val) {
256
+ if (!isObject(val)) return false;
257
+ const proto = Object.getPrototypeOf(val);
258
+ return proto === Object.prototype || proto === null;
227
259
  }
228
- function assert(condition, msg) {
229
- if (!condition) {
230
- _fail(msg);
231
- }
260
+ function isTypedObject(val, keys) {
261
+ return isObject(val) && keys.every((k) => k in val);
232
262
  }
233
- function require2(value, msg) {
234
- if (value == null) {
235
- _fail(`Expected ${value} not to be nullish`, msg);
236
- }
237
- return value;
263
+ function isSet(val) {
264
+ return val instanceof Set;
238
265
  }
239
- function requireDefined(value, msg) {
240
- if (value === void 0) {
241
- _fail(`Expected ${value} not to be undefined`, msg);
242
- }
243
- return value;
266
+ function isArray(arr) {
267
+ return !!arr && Object.prototype.toString.call(arr) === "[object Array]";
244
268
  }
245
- function fail(msg) {
246
- _fail(msg);
269
+ function isArrayOrUndefined(arr) {
270
+ return arr === void 0 || isArray(arr);
247
271
  }
248
- function isEqual(value1, value2, msg) {
249
- if (!guard_exports.isEqual(value1, value2))
250
- _fail(`Expected ${value1} to equal with ${value2}`, msg);
251
- return true;
272
+ function isEmptyArray(arr) {
273
+ return isArray(arr) && arr.length === 0;
252
274
  }
253
- function isDeepEqual(value1, value2, msg) {
254
- if (!guard_exports.isDeepEqual(value1, value2))
255
- _fail(`Expected ${value1} to deep equal with ${value2}`, msg);
256
- return true;
275
+ function isNonEmptyArray(arr) {
276
+ return isArray(arr) && arr.length > 0;
257
277
  }
258
- function isUndefined(value, msg) {
259
- if (!guard_exports.isUndefined(value))
260
- _fail(`Expected ${value} to be undefined`, msg);
261
- return true;
278
+ function isEmptyArrayOrUndefined(arr) {
279
+ return isArray(arr) && arr.length === 0 || arr === void 0;
262
280
  }
263
- function isNull(value, msg) {
264
- if (!guard_exports.isNull(value))
265
- _fail(`Expected ${value} to be null`, msg);
266
- return true;
281
+ function isNonEmptyArrayOrUndefined(arr) {
282
+ return isArray(arr) && arr.length > 0 || arr === void 0;
267
283
  }
268
- function isNullish(value, msg) {
269
- if (!guard_exports.isNullish(value))
270
- _fail(`Expected ${value} to be null or undefined`, msg);
271
- return true;
284
+ function isString(val) {
285
+ return typeof val === "string";
272
286
  }
273
- function isObject(value, msg) {
274
- if (!guard_exports.isObject(value))
275
- _fail(`Expected ${value} to be object`, msg);
276
- return true;
287
+ function isEmptyString(val) {
288
+ return typeof val === "string" && val.length === 0;
277
289
  }
278
- function isObjectOrUndefined(value, msg) {
279
- if (!guard_exports.isObjectOrUndefined(value))
280
- _fail(`Expected ${value} to be object or undefined`, msg);
281
- return true;
290
+ function isNonEmptyString(val) {
291
+ return typeof val === "string" && val.length > 0;
282
292
  }
283
- function isTypedObject(obj, keys, msg) {
284
- if (!guard_exports.isTypedObject(obj, keys))
285
- _fail(`Expected ${obj} to be object with keys [${keys.map((key) => `'${String(key)}'`).join(", ")}]`, msg);
286
- return true;
293
+ function isStringOrUndefined(val) {
294
+ return val === void 0 || typeof val === "string";
287
295
  }
288
- function isArray(value, msg) {
289
- if (!guard_exports.isArray(value))
290
- _fail(`Expected ${value} to be array`, msg);
291
- return true;
296
+ function isEmptyStringOrUndefined(val) {
297
+ return typeof val === "string" && val.length === 0 || val === void 0;
292
298
  }
293
- function isArrayOrUndefined(value, msg) {
294
- if (!guard_exports.isArrayOrUndefined(value))
295
- _fail(`Expected ${value} to be array or undefined`, msg);
296
- return true;
299
+ function isNonEmptyStringOrUndefined(val) {
300
+ return typeof val === "string" && val.length > 0 || val === void 0;
297
301
  }
298
- function isEmptyArray(value, msg) {
299
- if (!guard_exports.isEmptyArray(value))
300
- _fail(`Expected ${value} to be empty array`, msg);
301
- return true;
302
+ function isBoolean(val) {
303
+ return typeof val === "boolean";
302
304
  }
303
- function isNonEmptyArray(value, msg) {
304
- if (!guard_exports.isNonEmptyArray(value))
305
- _fail(`Expected ${value} to be non-empty array`, msg);
306
- return true;
305
+ function isBooleanOrUndefined(val) {
306
+ return val === void 0 || typeof val === "boolean";
307
307
  }
308
- function isEmptyArrayOrUndefined(value, msg) {
309
- if (!guard_exports.isEmptyArrayOrUndefined(value))
310
- _fail(`Expected ${value} to be empty array or undefined`, msg);
311
- return true;
308
+ function isTrue(val) {
309
+ return val === true;
312
310
  }
313
- function isNonEmptyArrayOrUndefined(value, msg) {
314
- if (!guard_exports.isNonEmptyArrayOrUndefined(value))
315
- _fail(`Expected ${value} to be non-empty array or undefined`, msg);
316
- return true;
311
+ function isTrueOrUndefined(val) {
312
+ return val === true || val === void 0;
317
313
  }
318
- function isString(value, msg) {
319
- if (!guard_exports.isString(value))
320
- _fail(`Expected ${value} to be string`, msg);
321
- return true;
314
+ function isFalse(val) {
315
+ return val === false;
322
316
  }
323
- function isEmptyString(value, msg) {
324
- if (!guard_exports.isEmptyString(value))
325
- _fail(`Expected ${value} to be empty string`, msg);
326
- return true;
317
+ function isFalseOrUndefined(val) {
318
+ return val === false || val === void 0;
327
319
  }
328
- function isNonEmptyString(value, msg) {
329
- if (!guard_exports.isNonEmptyString(value))
330
- _fail(`Expected ${value} to be non-empty string`, msg);
331
- return true;
320
+ function isFunction(val) {
321
+ return typeof val === "function";
332
322
  }
333
- function isStringOrUndefined(value, msg) {
334
- if (!guard_exports.isStringOrUndefined(value))
335
- _fail(`Expected ${value} to be string or undefined`, msg);
336
- return true;
323
+ function isFunctionOrUndefined(val) {
324
+ return val === void 0 || typeof val === "function";
337
325
  }
338
- function isEmptyStringOrUndefined(value, msg) {
339
- if (!guard_exports.isEmptyStringOrUndefined(value))
340
- _fail(`Expected ${value} to be empty string or undefined`, msg);
341
- return true;
326
+ function isEnumValue(val, enumObj) {
327
+ return getEnumValues(enumObj).some((v) => v === val);
342
328
  }
343
- function isNonEmptyStringOrUndefined(value, msg) {
344
- if (!guard_exports.isNonEmptyStringOrUndefined(value))
345
- _fail(`Expected ${value} to be non-empty string or undefined`, msg);
346
- return true;
329
+ function isEnumValueOrUndefined(val, enumObj) {
330
+ return val === void 0 || getEnumValues(enumObj).some((v) => v === val);
347
331
  }
348
- function isBoolean(value, msg) {
349
- if (!guard_exports.isBoolean(value))
350
- _fail(`Expected ${value} to be boolean`, msg);
351
- return true;
332
+ function isNumericString(val) {
333
+ if (typeof val !== "string" || val.trim() === "") return false;
334
+ const n = +val;
335
+ return Number.isFinite(n);
352
336
  }
353
- function isBooleanOrUndefined(value, msg) {
354
- if (!guard_exports.isBooleanOrUndefined(value))
355
- _fail(`Expected ${value} to be boolean or undefined`, msg);
356
- return true;
337
+ function isBigInt(val) {
338
+ return typeof val === "bigint";
357
339
  }
358
- function isTrue(value, msg) {
359
- if (!guard_exports.isTrue(value))
360
- _fail(`Expected ${value} to be true`, msg);
361
- return true;
340
+ function isNumber(val) {
341
+ return typeof val === "number";
362
342
  }
363
- function isTrueOrUndefined(value, msg) {
364
- if (!guard_exports.isTrueOrUndefined(value))
365
- _fail(`Expected ${value} to be true or undefined`, msg);
366
- return true;
343
+ function isNumberOrUndefined(val) {
344
+ return typeof val === "number" || val === void 0;
367
345
  }
368
- function isFalse(value, msg) {
369
- if (!guard_exports.isFalse(value))
370
- _fail(`Expected ${value} to be false`, msg);
371
- return true;
346
+ function isFinite2(val) {
347
+ return typeof val === "number" && Number.isFinite(val);
372
348
  }
373
- function isFalseOrUndefined(value, msg) {
374
- if (!guard_exports.isFalseOrUndefined(value))
375
- _fail(`Expected ${value} to be false or undefined`, msg);
376
- return true;
349
+ function isFloat(val) {
350
+ return isFinite2(val) && !isInteger(val);
377
351
  }
378
- function isFunction(value, msg) {
379
- if (!guard_exports.isFunction(value))
380
- _fail(`Expected ${value} to be function`, msg);
381
- return true;
352
+ function isInteger(val) {
353
+ return typeof val === "number" && isFinite2(val) && val === Math.trunc(val);
382
354
  }
383
- function isFunctionOrUndefined(value, msg) {
384
- if (!guard_exports.isFunctionOrUndefined(value))
385
- _fail(`Expected ${value} to be function or undefined`, msg);
386
- return true;
355
+ function isSafeInteger(val) {
356
+ return isInteger(val) && Number.isSafeInteger(val);
387
357
  }
388
- function isEnumValue(enumValue, enumObject, msg) {
389
- if (!guard_exports.isEnumValue(enumValue, enumObject))
390
- _fail(`Expected ${enumValue} to be enum value`, msg);
391
- return true;
358
+ function isIntegerOrUndefined(val) {
359
+ return typeof val === "number" && isFinite2(val) && val === Math.trunc(val) || val === void 0;
392
360
  }
393
- function isEnumValueOrUndefined(enumValue, enumObject, msg) {
394
- if (!guard_exports.isEnumValueOrUndefined(enumValue, enumObject))
395
- _fail(`Expected ${enumValue} to be enum value or undefined`, msg);
396
- return true;
361
+ function isIntegerEq(val, ref) {
362
+ return isInteger(val) && val === ref;
397
363
  }
398
- function isNumber(value, msg) {
399
- if (!guard_exports.isNumber(value))
400
- _fail(`Expected ${value} to be number`, msg);
401
- return true;
364
+ function isIntegerGt(val, ref) {
365
+ return isInteger(val) && isNumber(ref) && val > ref;
402
366
  }
403
- function isNumberOrUndefined(value, msg) {
404
- if (!guard_exports.isNumberOrUndefined(value))
405
- _fail(`Expected ${value} to be number or undefined`, msg);
406
- return true;
367
+ function isIntegerGte(val, ref) {
368
+ return isInteger(val) && isNumber(ref) && val >= ref;
407
369
  }
408
- function isFinite2(value, msg) {
409
- if (!guard_exports.isFinite(value))
410
- _fail(`Expected ${value} to be finite`, msg);
411
- return true;
370
+ function isIntegerLt(val, ref) {
371
+ return isInteger(val) && isNumber(ref) && val < ref;
412
372
  }
413
- function isInteger(value, msg) {
414
- if (!guard_exports.isInteger(value))
415
- _fail(`Expected ${value} to be integer`, msg);
416
- return true;
373
+ function isIntegerLte(val, ref) {
374
+ return isInteger(val) && isNumber(ref) && val <= ref;
417
375
  }
418
- function isIntegerOrUndefined(value, msg) {
419
- if (!guard_exports.isIntegerOrUndefined(value))
420
- _fail(`Expected ${value} to be integer or undefined`, msg);
421
- return true;
376
+ function isIntegerBetween(val, min, max) {
377
+ return isInteger(val) && isNumber(min) && isNumber(max) && val >= min && val <= max;
422
378
  }
423
- function isIntegerEq(value, compareTo, msg) {
424
- if (!guard_exports.isIntegerEq(value, compareTo))
425
- _fail(`Expected ${value} to be integer equal to ${compareTo}`, msg);
426
- return true;
379
+ function isIntegerBetweenExclusive(val, min, max) {
380
+ return isInteger(val) && isNumber(min) && isNumber(max) && val > min && val < max;
427
381
  }
428
- function isIntegerGt(value, compareTo, msg) {
429
- if (!guard_exports.isIntegerGt(value, compareTo))
430
- _fail(`Expected ${value} to be integer > ${compareTo}`, msg);
431
- return true;
382
+ function isNumberBetween(val, min, max) {
383
+ return isNumber(val) && isNumber(min) && isNumber(max) && val >= min && val <= max;
432
384
  }
433
- function isIntegerGte(value, compareTo, msg) {
434
- if (!guard_exports.isIntegerGte(value, compareTo))
435
- _fail(`Expected ${value} to be integer >= ${compareTo}`, msg);
436
- return true;
385
+ function isNumberBetweenExclusive(val, min, max) {
386
+ return isNumber(val) && isNumber(min) && isNumber(max) && val > min && val < max;
437
387
  }
438
- function isIntegerLt(value, compareTo, msg) {
439
- if (!guard_exports.isIntegerLt(value, compareTo))
440
- _fail(`Expected ${value} to be integer < ${compareTo}`, msg);
441
- return true;
388
+ function isNaNValue(val) {
389
+ return typeof val === "number" && Number.isNaN(val);
442
390
  }
443
- function isIntegerLte(value, compareTo, msg) {
444
- if (!guard_exports.isIntegerLte(value, compareTo))
445
- _fail(`Expected ${value} to be integer <= ${compareTo}`, msg);
446
- return true;
391
+ function isInfinity(val) {
392
+ return val === Infinity || val === -Infinity;
447
393
  }
448
- function isIntegerBetween(value, min, max, msg) {
449
- if (!guard_exports.isIntegerBetween(value, min, max))
450
- _fail(`Expected integer ${min} <= ${value} <= ${max}.`, msg);
451
- return true;
394
+ function isPosInfinity(val) {
395
+ return val === Infinity;
452
396
  }
453
- function isIntegerBetweenExclusive(value, min, max, msg) {
454
- if (!guard_exports.isIntegerBetweenExclusive(value, min, max))
455
- _fail(`Expected integer ${min} < ${value} < ${max}.`, msg);
456
- return true;
397
+ function isNegInfinity(val) {
398
+ return val === -Infinity;
457
399
  }
458
- function isNumberBetween(value, min, max, msg) {
459
- if (!guard_exports.isNumberBetween(value, min, max))
460
- _fail(`Expected number ${min} <= ${value} <= ${max}.`, msg);
461
- return true;
400
+ function isPos(val) {
401
+ return typeof val === "number" && val > 0;
462
402
  }
463
- function isNumberBetweenExclusive(value, min, max, msg) {
464
- if (!guard_exports.isNumberBetweenExclusive(value, min, max))
465
- _fail(`Expected number ${min} < ${value} < ${max}.`, msg);
466
- return true;
403
+ function isNeg(val) {
404
+ return typeof val === "number" && val < 0;
467
405
  }
468
- function isNaNValue(value, msg) {
469
- if (!guard_exports.isNaNValue(value))
470
- _fail(`Expected ${value} to be NaN.`, msg);
471
- return true;
406
+ function isNonPos(val) {
407
+ return typeof val === "number" && val <= 0;
472
408
  }
473
- function isInfinity(value, msg) {
474
- if (!guard_exports.isInfinity(value))
475
- _fail(`Expected ${value} to be +-Infinity.`, msg);
476
- return true;
409
+ function isNonNeg(val) {
410
+ return typeof val === "number" && val >= 0;
477
411
  }
478
- function isPosInfinity(value, msg) {
479
- if (!guard_exports.isPosInfinity(value))
480
- _fail(`Expected ${value} to be +Infinity.`, msg);
481
- return true;
412
+ function isZero(val) {
413
+ return typeof val === "number" && val === 0;
482
414
  }
483
- function isNegInfinity(value, msg) {
484
- if (!guard_exports.isNegInfinity(value))
485
- _fail(`Expected ${value} to be -Infinity.`, msg);
486
- return true;
415
+ function isPosZero(val) {
416
+ return typeof val === "number" && val === 0 && 1 / val === Infinity;
487
417
  }
488
- function isOddNumber(value, msg) {
489
- if (!guard_exports.isOddNumber(value))
490
- _fail(`Expected ${value} to odd number.`, msg);
491
- return true;
418
+ function isNegZero(val) {
419
+ return typeof val === "number" && val === 0 && 1 / val === -Infinity;
492
420
  }
493
- function isEvenNumber(value, msg) {
494
- if (!guard_exports.isEvenNumber(value))
495
- _fail(`Expected ${value} to even number.`, msg);
496
- return true;
421
+ function isOdd(val) {
422
+ return isInteger(val) && Math.abs(val) % 2 === 1;
497
423
  }
498
- function isIncluded(value, array, msg) {
499
- if (!guard_exports.isIncluded(value, array))
500
- _fail(`Expected ${value} to be included in [${array.map((v) => String(v)).join(", ")}].`, msg);
501
- return true;
424
+ function isEven(val) {
425
+ return isInteger(val) && val % 2 === 0;
502
426
  }
503
- function isArrayIndex(index, array, msg) {
504
- if (!guard_exports.isArrayIndex(index, array))
505
- _fail(`Expected ${index} to be index for array [${array.map((v) => String(v)).join(", ")}]`, msg);
506
- return true;
427
+ function isMultipleOf(val, base) {
428
+ return typeof val === "number" && typeof base === "number" && val % base === 0;
507
429
  }
508
- function isThrowing(throwTestFn, msg) {
509
- if (!guard_exports.isThrowing(throwTestFn))
510
- _fail(`Expected to throw`, msg);
511
- return true;
430
+ function isPowerOfTwo(val) {
431
+ return isInteger(val) && val > 0 && (val & val - 1) === 0;
512
432
  }
513
- function isNotThrowing(throwTestFn, msg) {
514
- if (!guard_exports.isNotThrowing(throwTestFn))
515
- _fail(`Expected to throw`, msg);
516
- return true;
433
+ function isIncluded(val, container) {
434
+ if (isArray(container)) {
435
+ return container.includes(val);
436
+ }
437
+ if (isSet(container)) {
438
+ return container.has(val);
439
+ }
440
+ return false;
517
441
  }
518
-
519
- // src/web/cookies.ts
520
- var cookies_exports = {};
521
- __export(cookies_exports, {
522
- accept: () => accept,
523
- decline: () => decline,
524
- erase: () => erase,
525
- eraseAll: () => eraseAll,
526
- isConsentPending: () => isConsentPending,
527
- read: () => read,
528
- readBool: () => readBool,
529
- readInt: () => readInt,
530
- save: () => save,
531
- setExpireDays: () => setExpireDays
532
- });
533
- var ConsentCookieName = "ConsentCookie";
534
- var _consent;
535
- var _expires;
536
- var str = _read(ConsentCookieName);
537
- _consent = str === "accept" /* Accept */ || str === "decline" /* Decline */ ? str : void 0;
538
- function _getList() {
539
- let s = document.cookie;
540
- return s.split(";").map((c) => c.trim());
442
+ function isIndex(index, array) {
443
+ return isArray(array) ? isIntegerBetween(index, 0, array.length - 1) : isIntegerGte(index, 0);
541
444
  }
542
- function _save(name, value) {
543
- let cookie = name + "=" + value.toString() + ";sameSite=Lax;";
544
- if (_expires) {
545
- cookie += "expires=" + _expires.toUTCString() + ";";
445
+ function doesThrow(throwTestFn) {
446
+ try {
447
+ throwTestFn();
448
+ return false;
449
+ } catch (err) {
450
+ return true;
546
451
  }
547
- document.cookie = cookie;
548
- return value;
549
452
  }
550
- function _read(name, defaultValue) {
551
- let str2 = _getList().find((c) => c.startsWith(name + "="));
552
- return str2 === void 0 ? defaultValue : str2.substring(name.length + 1);
453
+ function doesNotThrow(throwTestFn) {
454
+ try {
455
+ throwTestFn();
456
+ return true;
457
+ } catch (err) {
458
+ return false;
459
+ }
553
460
  }
554
- function _erase(name) {
555
- document.cookie = name + "=;expires=Thu, 01 Jan 1970 00:00:00 UTC;";
461
+ function tryOr(tryFn, orVal) {
462
+ try {
463
+ return tryFn();
464
+ } catch (err) {
465
+ return isFunction(orVal) ? orVal() : orVal;
466
+ }
556
467
  }
557
- function setExpireDays(days) {
558
- _expires = /* @__PURE__ */ new Date();
559
- _expires.setDate(_expires.getDate() + days);
468
+
469
+ // src/utils/obj/index.ts
470
+ function hasProperties(obj, props) {
471
+ return isObject(obj) && props.every((p) => p in obj);
560
472
  }
561
- function isConsentPending() {
562
- return _consent === void 0;
473
+ function deepEqual(a, b) {
474
+ if (a === b) return true;
475
+ if (a === null || b === null) return false;
476
+ if (typeof a !== "object" || typeof b !== "object") return false;
477
+ if (Array.isArray(a) && Array.isArray(b)) {
478
+ if (a.length !== b.length) return false;
479
+ return a.every((val, i) => deepEqual(val, b[i]));
480
+ }
481
+ if (Array.isArray(a) !== Array.isArray(b)) return false;
482
+ const keysA = Object.keys(a);
483
+ const keysB = Object.keys(b);
484
+ if (keysA.length !== keysB.length) return false;
485
+ for (const key of keysA) {
486
+ if (!Object.prototype.hasOwnProperty.call(b, key)) return false;
487
+ if (!deepEqual(a[key], b[key])) return false;
488
+ }
489
+ return true;
490
+ }
491
+ function getCtorName(obj) {
492
+ if (obj === null) return "null";
493
+ if (isArray(obj)) return "Array";
494
+ if (typeof obj !== "object") return typeof obj;
495
+ const tag = Object.prototype.toString.call(obj).slice(8, -1);
496
+ return tag || "Object";
497
+ }
498
+
499
+ // src/utils/str/index.ts
500
+ function toCharArray(str2) {
501
+ return str2.split("");
502
+ }
503
+ function repeatString(repeatString2, repeatCount) {
504
+ if (!isInteger(repeatCount) || repeatCount < 0) {
505
+ throw new Error("repeatStr: Invalid repeatCount = " + repeatCount);
506
+ }
507
+ return new Array(repeatCount + 1).join(repeatString2);
508
+ }
509
+ function chunkString(str2, chunkSize) {
510
+ if (!isInteger(chunkSize) || chunkSize < 1) {
511
+ throw new Error("chunckString: Invalid chuckSize = " + chunkSize);
512
+ }
513
+ let result = [];
514
+ for (let i = 0; i < str2.length; i += chunkSize) {
515
+ result.push(str2.slice(i, i + chunkSize));
516
+ }
517
+ return result;
518
+ }
519
+ function replaceAt(str2, pos, removeCount, insert) {
520
+ if (!isInteger(removeCount) || removeCount < 0) {
521
+ throw new Error("replaceAt: Invalid removeCount = " + removeCount);
522
+ } else if (!isInteger(pos) || pos < 0 || pos + removeCount > str2.length) {
523
+ throw new Error("replaceAt: Invalid pos = " + pos + ", removeCount = " + removeCount + ", str.length = " + str2.length);
524
+ } else {
525
+ return str2.substring(0, pos) + insert + str2.substring(pos + removeCount);
526
+ }
527
+ }
528
+ function insertAt(str2, pos, insertStr) {
529
+ return replaceAt(str2, pos, 0, insertStr);
530
+ }
531
+ function removeAt(str2, pos, removeCount) {
532
+ return replaceAt(str2, pos, removeCount, "");
533
+ }
534
+ function charCount(str2, ch) {
535
+ if (ch.length !== 1 || str2.length === 0) return 0;
536
+ let count = 0;
537
+ for (let i = 0; i < str2.length; i++) {
538
+ if (str2[i] === ch) count++;
539
+ }
540
+ return count;
541
+ }
542
+ function makeSentenceFromPascal(PascalString) {
543
+ if (PascalString === "") {
544
+ return "";
545
+ }
546
+ let word = PascalString.charAt(0);
547
+ let sentence = "";
548
+ const addWord = () => {
549
+ if (word !== "") {
550
+ if (sentence === "") {
551
+ sentence += word.charAt(0).toUpperCase() + word.substring(1);
552
+ } else {
553
+ sentence += " " + word;
554
+ }
555
+ word = "";
556
+ }
557
+ };
558
+ const isLetterAndCapital = (c) => {
559
+ return c.toUpperCase() !== c.toLowerCase() && c === c.toUpperCase();
560
+ };
561
+ for (let i = 1; i < PascalString.length; i++) {
562
+ let c = PascalString.charAt(i);
563
+ if (isLetterAndCapital(c)) {
564
+ addWord();
565
+ }
566
+ word += c.toLowerCase();
567
+ }
568
+ addWord();
569
+ return sentence;
570
+ }
571
+ function stringify(value, maxDepth = 5, seen = /* @__PURE__ */ new WeakSet()) {
572
+ if (value === null) return "null";
573
+ if (value === void 0) return "undefined";
574
+ const t = typeof value;
575
+ switch (t) {
576
+ case "boolean":
577
+ return value ? "true" : "false";
578
+ case "number":
579
+ if (isNaNValue(value)) return "NaN";
580
+ if (!isFinite2(value))
581
+ return value < 0 ? "-Infinity" : "Infinity";
582
+ return value.toString();
583
+ case "bigint":
584
+ return `${value}n`;
585
+ case "string":
586
+ return `"${value}"`;
587
+ case "symbol":
588
+ return value.description ? `Symbol(${value.description})` : "Symbol()";
589
+ case "function":
590
+ return `[Function${value.name ? ` ${value.name}` : ""}]`;
591
+ }
592
+ if (seen.has(value))
593
+ return "[Circular]";
594
+ if (maxDepth <= 0)
595
+ return "[Depth limit]";
596
+ maxDepth--;
597
+ seen.add(value);
598
+ const strfy = (v) => stringify(v, maxDepth, seen);
599
+ if (isArray(value)) {
600
+ const inner = value.map((v) => strfy(v)).join(", ");
601
+ return inner.length === 0 ? "[ ]" : `[ ${inner} ]`;
602
+ }
603
+ if (ArrayBuffer.isView(value)) {
604
+ if (value instanceof DataView)
605
+ return `DataView(${value.byteLength})`;
606
+ const inner = Array.from(value).map((v) => strfy(v)).join(", ");
607
+ return `${value.constructor.name}[ ${inner} ]`;
608
+ }
609
+ if (value instanceof ArrayBuffer)
610
+ return `ArrayBuffer(${value.byteLength})`;
611
+ if (value instanceof Map) {
612
+ const entries = Array.from(value.entries()).map(([k, v]) => `${strfy(k)} => ${strfy(v)}`).join(", ");
613
+ return entries.length === 0 ? `Map(${value.size}){ }` : `Map(${value.size}){ ${entries} }`;
614
+ }
615
+ if (value instanceof Set) {
616
+ const entries = Array.from(value.values()).map((v) => strfy(v)).join(", ");
617
+ return entries.length === 0 ? `Set(${value.size}){ }` : `Set(${value.size}){ ${entries} }`;
618
+ }
619
+ if (value instanceof WeakMap)
620
+ return "WeakMap{ ? }";
621
+ if (value instanceof WeakSet)
622
+ return "WeakSet{ ? }";
623
+ if (value instanceof Date)
624
+ return `Date("${value.toISOString()}")`;
625
+ if (value instanceof RegExp)
626
+ return value.toString();
627
+ if (value instanceof Error)
628
+ return `${value.name}("${value.message}")`;
629
+ if (value instanceof Promise)
630
+ return "Promise{ ? }";
631
+ if (value instanceof URL)
632
+ return `URL("${value.href}")`;
633
+ if (value instanceof URLSearchParams)
634
+ return `URLSearchParams("${value.toString()}")`;
635
+ if (value === Math) return "Math";
636
+ if (value === JSON) return "JSON";
637
+ if (value === Reflect) return "Reflect";
638
+ if (value === Intl) return "Intl";
639
+ const hasCustomToString = typeof value?.toString === "function" && value.toString !== Object.prototype.toString;
640
+ if (hasCustomToString) {
641
+ try {
642
+ const str2 = value.toString();
643
+ if (!/^\[object .+\]$/.test(str2)) return str2;
644
+ } catch {
645
+ }
646
+ }
647
+ if (t === "object") {
648
+ const ctorName = getCtorName(value);
649
+ const entries = Object.entries(value).map(
650
+ ([key, val]) => `${strfy(key)}: ${strfy(val)}`
651
+ );
652
+ if (entries.length === 0) return `${ctorName}{ }`;
653
+ return `${ctorName}{ ${entries.join(", ")} }`;
654
+ }
655
+ return String(value);
656
+ }
657
+
658
+ // src/assert/index.ts
659
+ var fmt = stringify;
660
+ var errorConstructor = Error;
661
+ function setErrorClass(errorClass) {
662
+ errorConstructor = errorClass ?? Error;
663
+ }
664
+ function _fail(...msgs) {
665
+ let msg = msgs.join(", ");
666
+ throw new errorConstructor("Assertion Failed!" + (msg === "" ? "" : " " + msg));
667
+ }
668
+ function assert(condition, msg) {
669
+ if (!condition) {
670
+ _fail(msg);
671
+ }
672
+ }
673
+ function require2(val, msg) {
674
+ if (val == null) {
675
+ _fail(`Expected ${fmt(val)} not to be nullish`, msg);
676
+ }
677
+ return val;
678
+ }
679
+ function requireDefined(val, msg) {
680
+ if (val === void 0) {
681
+ _fail(`Expected ${fmt(val)} not to be undefined`, msg);
682
+ }
683
+ return val;
684
+ }
685
+ function requireElement(index, array, msg) {
686
+ if (!guard_exports.isIndex(index, array))
687
+ _fail(`Expected ${index} to be index for array ${fmt(array)}`, msg);
688
+ return array[index];
689
+ }
690
+ function fail(msg) {
691
+ _fail(msg);
692
+ }
693
+ function isStrictEqual2(val1, val2, msg) {
694
+ if (!guard_exports.isStrictEqual(val1, val2))
695
+ _fail(`Expected ${fmt(val1)} to ne strict equal to ${val2}`, msg);
696
+ return val1;
697
+ }
698
+ function isDeepEqual2(val1, val2, msg) {
699
+ if (!guard_exports.isDeepEqual(val1, val2))
700
+ _fail(`Expected ${fmt(val1)} to deep equal with ${fmt(val2)}`, msg);
701
+ return val1;
702
+ }
703
+ function isUndefined2(val, msg) {
704
+ if (!guard_exports.isUndefined(val))
705
+ _fail(`Expected ${fmt(val)} to be undefined`, msg);
706
+ return val;
707
+ }
708
+ function isNull2(val, msg) {
709
+ if (!guard_exports.isNull(val))
710
+ _fail(`Expected ${fmt(val)} to be null`, msg);
711
+ return val;
712
+ }
713
+ function isNullish2(val, msg) {
714
+ if (!guard_exports.isNullish(val))
715
+ _fail(`Expected ${fmt(val)} to be null or undefined`, msg);
716
+ return val;
717
+ }
718
+ function isDefined2(val, msg) {
719
+ if (!guard_exports.isDefined(val)) {
720
+ _fail(`Expected ${fmt(val)} to be defined`, msg);
721
+ }
722
+ return val;
723
+ }
724
+ function isNonNull2(val, msg) {
725
+ if (!guard_exports.isNonNull(val)) {
726
+ _fail(`Expected ${fmt(val)} to be defined`, msg);
727
+ }
728
+ return val;
729
+ }
730
+ function isObject2(val, msg) {
731
+ if (!guard_exports.isObject(val))
732
+ _fail(`Expected ${fmt(val)} to be object`, msg);
733
+ return val;
734
+ }
735
+ function isEmptyObject2(val, msg) {
736
+ if (!guard_exports.isEmptyObject(val))
737
+ _fail(`Expected ${fmt(val)} to be empty object`, msg);
738
+ return val;
739
+ }
740
+ function isPlainObject2(val, msg) {
741
+ if (!guard_exports.isPlainObject(val))
742
+ _fail(`Expected ${fmt(val)} to be plain object`, msg);
743
+ return val;
744
+ }
745
+ function isObjectOrUndefined2(val, msg) {
746
+ if (!guard_exports.isObjectOrUndefined(val))
747
+ _fail(`Expected ${fmt(val)} to be object or undefined`, msg);
748
+ return val;
749
+ }
750
+ function isTypedObject2(val, keys, msg) {
751
+ if (!guard_exports.isTypedObject(val, keys))
752
+ _fail(`Expected ${fmt(val)} to have keys ${fmt(keys)}`, msg);
753
+ return val;
754
+ }
755
+ function isArray2(val, msg) {
756
+ if (!guard_exports.isArray(val))
757
+ _fail(`Expected ${fmt(val)} to be array`, msg);
758
+ return val;
759
+ }
760
+ function isArrayOrUndefined2(val, msg) {
761
+ if (!guard_exports.isArrayOrUndefined(val))
762
+ _fail(`Expected ${fmt(val)} to be array or undefined`, msg);
763
+ return true;
764
+ }
765
+ function isEmptyArray2(val, msg) {
766
+ if (!guard_exports.isEmptyArray(val))
767
+ _fail(`Expected ${fmt(val)} to be empty array`, msg);
768
+ }
769
+ function isNonEmptyArray2(val, msg) {
770
+ if (!guard_exports.isNonEmptyArray(val))
771
+ _fail(`Expected ${fmt(val)} to be non-empty array`, msg);
772
+ }
773
+ function isEmptyArrayOrUndefined2(val, msg) {
774
+ if (!guard_exports.isEmptyArrayOrUndefined(val))
775
+ _fail(`Expected ${fmt(val)} to be empty array or undefined`, msg);
776
+ }
777
+ function isNonEmptyArrayOrUndefined2(val, msg) {
778
+ if (!guard_exports.isNonEmptyArrayOrUndefined(val))
779
+ _fail(`Expected ${fmt(val)} to be non-empty array or undefined`, msg);
780
+ }
781
+ function isString2(val, msg) {
782
+ if (!guard_exports.isString(val))
783
+ _fail(`Expected ${fmt(val)} to be string`, msg);
784
+ return val;
785
+ }
786
+ function isEmptyString2(val, msg) {
787
+ if (!guard_exports.isEmptyString(val))
788
+ _fail(`Expected ${fmt(val)} to be empty string`, msg);
789
+ return val;
790
+ }
791
+ function isNonEmptyString2(val, msg) {
792
+ if (!guard_exports.isNonEmptyString(val))
793
+ _fail(`Expected ${fmt(val)} to be non-empty string`, msg);
794
+ return val;
795
+ }
796
+ function isStringOrUndefined2(val, msg) {
797
+ if (!guard_exports.isStringOrUndefined(val))
798
+ _fail(`Expected ${fmt(val)} to be string or undefined`, msg);
799
+ return val;
800
+ }
801
+ function isEmptyStringOrUndefined2(val, msg) {
802
+ if (!guard_exports.isEmptyStringOrUndefined(val))
803
+ _fail(`Expected ${fmt(val)} to be empty string or undefined`, msg);
804
+ return val;
805
+ }
806
+ function isNonEmptyStringOrUndefined2(val, msg) {
807
+ if (!guard_exports.isNonEmptyStringOrUndefined(val))
808
+ _fail(`Expected ${fmt(val)} to be non-empty string or undefined`, msg);
809
+ return val;
810
+ }
811
+ function isBoolean2(val, msg) {
812
+ if (!guard_exports.isBoolean(val))
813
+ _fail(`Expected ${fmt(val)} to be boolean`, msg);
814
+ return val;
815
+ }
816
+ function isBooleanOrUndefined2(val, msg) {
817
+ if (!guard_exports.isBooleanOrUndefined(val))
818
+ _fail(`Expected ${fmt(val)} to be boolean or undefined`, msg);
819
+ return val;
820
+ }
821
+ function isTrue2(val, msg) {
822
+ if (!guard_exports.isTrue(val))
823
+ _fail(`Expected ${fmt(val)} to be true`, msg);
824
+ return val;
825
+ }
826
+ function isTrueOrUndefined2(val, msg) {
827
+ if (!guard_exports.isTrueOrUndefined(val))
828
+ _fail(`Expected ${fmt(val)} to be true or undefined`, msg);
829
+ return val;
830
+ }
831
+ function isFalse2(val, msg) {
832
+ if (!guard_exports.isFalse(val))
833
+ _fail(`Expected ${fmt(val)} to be false`, msg);
834
+ return val;
835
+ }
836
+ function isFalseOrUndefined2(val, msg) {
837
+ if (!guard_exports.isFalseOrUndefined(val))
838
+ _fail(`Expected ${fmt(val)} to be false or undefined`, msg);
839
+ return val;
840
+ }
841
+ function isFunction2(val, msg) {
842
+ if (!guard_exports.isFunction(val))
843
+ _fail(`Expected ${fmt(val)} to be function`, msg);
844
+ return val;
845
+ }
846
+ function isFunctionOrUndefined2(val, msg) {
847
+ if (!guard_exports.isFunctionOrUndefined(val))
848
+ _fail(`Expected ${fmt(val)} to be function or undefined`, msg);
849
+ return val;
850
+ }
851
+ function isEnumValue2(val, enumObject, msg) {
852
+ if (!guard_exports.isEnumValue(val, enumObject))
853
+ _fail(`Expected ${fmt(val)} to be enum val`, msg);
854
+ return val;
855
+ }
856
+ function isEnumValueOrUndefined2(val, enumObject, msg) {
857
+ if (!guard_exports.isEnumValueOrUndefined(val, enumObject))
858
+ _fail(`Expected ${fmt(val)} to be enum val or undefined`, msg);
859
+ return val;
860
+ }
861
+ function isNumericString2(val, msg) {
862
+ if (!guard_exports.isNumericString(val))
863
+ _fail(`Expected ${fmt(val)} to be numeric string`, msg);
864
+ return val;
865
+ }
866
+ function isBigInt2(val, msg) {
867
+ if (!guard_exports.isBigInt(val))
868
+ _fail(`Expected ${fmt(val)} to be BigInt`, msg);
869
+ return val;
870
+ }
871
+ function isNumber2(val, msg) {
872
+ if (!guard_exports.isNumber(val))
873
+ _fail(`Expected ${fmt(val)} to be number`, msg);
874
+ return val;
875
+ }
876
+ function isNumberOrUndefined2(val, msg) {
877
+ if (!guard_exports.isNumberOrUndefined(val))
878
+ _fail(`Expected ${fmt(val)} to be number or undefined`, msg);
879
+ return val;
880
+ }
881
+ function isFinite3(val, msg) {
882
+ if (!guard_exports.isFinite(val))
883
+ _fail(`Expected ${fmt(val)} to be finite`, msg);
884
+ return val;
885
+ }
886
+ function isFloat2(val, msg) {
887
+ if (!guard_exports.isFloat(val))
888
+ _fail(`Expected ${fmt(val)} to be float`, msg);
889
+ return val;
890
+ }
891
+ function isInteger2(val, msg) {
892
+ if (!guard_exports.isInteger(val))
893
+ _fail(`Expected ${fmt(val)} to be integer`, msg);
894
+ return val;
895
+ }
896
+ function isSafeInteger2(val, msg) {
897
+ if (!guard_exports.isSafeInteger(val))
898
+ _fail(`Expected ${fmt(val)} to be safe integer`, msg);
899
+ return val;
900
+ }
901
+ function isIntegerOrUndefined2(val, msg) {
902
+ if (!guard_exports.isIntegerOrUndefined(val))
903
+ _fail(`Expected ${fmt(val)} to be integer or undefined`, msg);
904
+ return val;
905
+ }
906
+ function isIntegerEq2(val, ref, msg) {
907
+ if (!guard_exports.isIntegerEq(val, ref))
908
+ _fail(`Expected ${fmt(val)} to be integer equal to ${fmt(ref)}`, msg);
909
+ return val;
910
+ }
911
+ function isIntegerGt2(val, ref, msg) {
912
+ if (!guard_exports.isIntegerGt(val, ref))
913
+ _fail(`Expected ${fmt(val)} to be integer > ${fmt(ref)}`, msg);
914
+ return val;
915
+ }
916
+ function isIntegerGte2(val, ref, msg) {
917
+ if (!guard_exports.isIntegerGte(val, ref))
918
+ _fail(`Expected ${fmt(val)} to be integer >= ${fmt(ref)}`, msg);
919
+ return val;
920
+ }
921
+ function isIntegerLt2(val, ref, msg) {
922
+ if (!guard_exports.isIntegerLt(val, ref))
923
+ _fail(`Expected ${fmt(val)} to be integer < ${fmt(ref)}`, msg);
924
+ return val;
925
+ }
926
+ function isIntegerLte2(val, ref, msg) {
927
+ if (!guard_exports.isIntegerLte(val, ref))
928
+ _fail(`Expected ${fmt(val)} to be integer <= ${fmt(ref)}`, msg);
929
+ return val;
930
+ }
931
+ function isIntegerBetween2(val, min, max, msg) {
932
+ if (!guard_exports.isIntegerBetween(val, min, max))
933
+ _fail(`Expected integer ${fmt(min)} <= ${fmt(val)} <= ${fmt(max)}`, msg);
934
+ return val;
935
+ }
936
+ function isIntegerBetweenExclusive2(val, min, max, msg) {
937
+ if (!guard_exports.isIntegerBetweenExclusive(val, min, max))
938
+ _fail(`Expected integer ${fmt(min)} < ${fmt(val)} < ${fmt(max)}`, msg);
939
+ return val;
940
+ }
941
+ function isNumberBetween2(val, min, max, msg) {
942
+ if (!guard_exports.isNumberBetween(val, min, max))
943
+ _fail(`Expected number ${fmt(min)} <= ${fmt(val)} <= ${fmt(max)}`, msg);
944
+ return val;
945
+ }
946
+ function isNumberBetweenExclusive2(val, min, max, msg) {
947
+ if (!guard_exports.isNumberBetweenExclusive(val, min, max))
948
+ _fail(`Expected number ${fmt(min)} < ${fmt(val)} < ${fmt(max)}`, msg);
949
+ return val;
950
+ }
951
+ function isNaNValue2(val, msg) {
952
+ if (!guard_exports.isNaNValue(val))
953
+ _fail(`Expected ${fmt(val)} to be NaN`, msg);
954
+ return NaN;
955
+ }
956
+ function isInfinity2(val, msg) {
957
+ if (!guard_exports.isInfinity(val))
958
+ _fail(`Expected ${fmt(val)} to be +-Infinity`, msg);
959
+ return val;
960
+ }
961
+ function isPosInfinity2(val, msg) {
962
+ if (!guard_exports.isPosInfinity(val))
963
+ _fail(`Expected ${fmt(val)} to be +Infinity`, msg);
964
+ return val;
965
+ }
966
+ function isNegInfinity2(val, msg) {
967
+ if (!guard_exports.isNegInfinity(val))
968
+ _fail(`Expected ${fmt(val)} to be -Infinity`, msg);
969
+ return val;
970
+ }
971
+ function isPos2(val, msg) {
972
+ if (!guard_exports.isPos(val))
973
+ _fail(`Expected ${fmt(val)} to be positive (> 0)`, msg);
974
+ return val;
975
+ }
976
+ function isNeg2(val, msg) {
977
+ if (!guard_exports.isNeg(val))
978
+ _fail(`Expected ${fmt(val)} to be negative (< 0)`, msg);
979
+ return val;
980
+ }
981
+ function isNonPos2(val, msg) {
982
+ if (!guard_exports.isNonPos(val))
983
+ _fail(`Expected ${fmt(val)} to be non-positive (<= 0)`, msg);
984
+ return val;
985
+ }
986
+ function isNonNeg2(val, msg) {
987
+ if (!guard_exports.isNonNeg(val))
988
+ _fail(`Expected ${fmt(val)} to be non-negative (>= 0)`, msg);
989
+ return val;
990
+ }
991
+ function isZero2(val, msg) {
992
+ if (!guard_exports.isZero(val))
993
+ _fail(`Expected ${fmt(val)} to be 0`, msg);
994
+ return val;
995
+ }
996
+ function isPosZero2(val, msg) {
997
+ if (!guard_exports.isPosZero(val))
998
+ _fail(`Expected ${fmt(val)} to be +0`, msg);
999
+ return val;
1000
+ }
1001
+ function isNegZero2(val, msg) {
1002
+ if (!guard_exports.isNegZero(val))
1003
+ _fail(`Expected ${fmt(val)} to be -0`, msg);
1004
+ return val;
1005
+ }
1006
+ function isOdd2(val, msg) {
1007
+ if (!guard_exports.isOdd(val))
1008
+ _fail(`Expected ${fmt(val)} to odd`, msg);
1009
+ return val;
1010
+ }
1011
+ function isEven2(val, msg) {
1012
+ if (!guard_exports.isEven(val))
1013
+ _fail(`Expected ${fmt(val)} to even`, msg);
1014
+ return val;
1015
+ }
1016
+ function isMultipleOf2(val, base, msg) {
1017
+ if (!guard_exports.isMultipleOf(val, base))
1018
+ _fail(`Expected ${fmt(val)} to be divisble bu ${fmt(base)}`, msg);
1019
+ return val;
1020
+ }
1021
+ function isPowerOfTwo2(val, msg) {
1022
+ if (!guard_exports.isPowerOfTwo(val))
1023
+ _fail(`Expected ${fmt(val)} to be power of two`, msg);
1024
+ return val;
1025
+ }
1026
+ function isIncluded2(val, arr, msg) {
1027
+ if (!guard_exports.isIncluded(val, arr))
1028
+ _fail(`Expected ${fmt(val)} to be included in ${fmt(arr)}`, msg);
1029
+ return val;
1030
+ }
1031
+ function isIndex2(...args) {
1032
+ const index = args.shift();
1033
+ const msg = guard_exports.isString(args[args.length - 1]) ? args.pop() : void 0;
1034
+ const arr = guard_exports.isArray(args[0]) ? args.shift() : void 0;
1035
+ if (!guard_exports.isIndex(index, arr)) {
1036
+ if (arr === void 0)
1037
+ _fail(`Expected ${index} to be index`, msg);
1038
+ else
1039
+ _fail(`Expected ${index} to be index for ${fmt(arr)}`, msg);
1040
+ }
1041
+ return index;
1042
+ }
1043
+ function doesThrow2(throwTestFn, msg) {
1044
+ if (!guard_exports.doesThrow(throwTestFn))
1045
+ _fail(`Expected to throw`, msg);
1046
+ return true;
1047
+ }
1048
+ function doesNotThrow2(throwTestFn, msg) {
1049
+ if (!guard_exports.doesNotThrow(throwTestFn))
1050
+ _fail(`Expected to throw`, msg);
1051
+ return true;
1052
+ }
1053
+
1054
+ // src/web/cookies.ts
1055
+ var cookies_exports = {};
1056
+ __export(cookies_exports, {
1057
+ accept: () => accept,
1058
+ decline: () => decline,
1059
+ erase: () => erase,
1060
+ eraseAll: () => eraseAll,
1061
+ isConsentPending: () => isConsentPending,
1062
+ read: () => read,
1063
+ readBool: () => readBool,
1064
+ readInt: () => readInt,
1065
+ save: () => save,
1066
+ setExpireDays: () => setExpireDays
1067
+ });
1068
+ var ConsentCookieName = "ConsentCookie";
1069
+ var _consent;
1070
+ var _expires;
1071
+ var str = _read(ConsentCookieName);
1072
+ _consent = str === "accept" /* Accept */ || str === "decline" /* Decline */ ? str : void 0;
1073
+ function _getList() {
1074
+ let s = document.cookie;
1075
+ return s.split(";").map((c) => c.trim());
1076
+ }
1077
+ function _save(name, value) {
1078
+ let cookie = name + "=" + value.toString() + ";sameSite=Lax;";
1079
+ if (_expires) {
1080
+ cookie += "expires=" + _expires.toUTCString() + ";";
1081
+ }
1082
+ document.cookie = cookie;
1083
+ return value;
1084
+ }
1085
+ function _read(name, defaultValue) {
1086
+ let str2 = _getList().find((c) => c.startsWith(name + "="));
1087
+ return str2 === void 0 ? defaultValue : str2.substring(name.length + 1);
1088
+ }
1089
+ function _erase(name) {
1090
+ document.cookie = name + "=;expires=Thu, 01 Jan 1970 00:00:00 UTC;";
1091
+ }
1092
+ function setExpireDays(days) {
1093
+ _expires = /* @__PURE__ */ new Date();
1094
+ _expires.setDate(_expires.getDate() + days);
1095
+ }
1096
+ function isConsentPending() {
1097
+ return _consent === void 0;
563
1098
  }
564
1099
  function accept() {
565
1100
  _consent = "accept" /* Accept */;
@@ -723,319 +1258,12 @@ function toPx(input) {
723
1258
  }
724
1259
  }
725
1260
 
726
- // src/guard/index.ts
727
- var guard_exports = {};
728
- __export(guard_exports, {
729
- isArray: () => isArray2,
730
- isArrayIndex: () => isArrayIndex2,
731
- isArrayOrUndefined: () => isArrayOrUndefined2,
732
- isBoolean: () => isBoolean2,
733
- isBooleanOrUndefined: () => isBooleanOrUndefined2,
734
- isDeepEqual: () => isDeepEqual2,
735
- isEmptyArray: () => isEmptyArray2,
736
- isEmptyArrayOrUndefined: () => isEmptyArrayOrUndefined2,
737
- isEmptyString: () => isEmptyString2,
738
- isEmptyStringOrUndefined: () => isEmptyStringOrUndefined2,
739
- isEnumValue: () => isEnumValue3,
740
- isEnumValueOrUndefined: () => isEnumValueOrUndefined2,
741
- isEqual: () => isEqual2,
742
- isEvenNumber: () => isEvenNumber2,
743
- isFalse: () => isFalse2,
744
- isFalseOrUndefined: () => isFalseOrUndefined2,
745
- isFinite: () => isFinite3,
746
- isFunction: () => isFunction2,
747
- isFunctionOrUndefined: () => isFunctionOrUndefined2,
748
- isIncluded: () => isIncluded2,
749
- isInfinity: () => isInfinity2,
750
- isInteger: () => isInteger2,
751
- isIntegerBetween: () => isIntegerBetween2,
752
- isIntegerBetweenExclusive: () => isIntegerBetweenExclusive2,
753
- isIntegerEq: () => isIntegerEq2,
754
- isIntegerGt: () => isIntegerGt2,
755
- isIntegerGte: () => isIntegerGte2,
756
- isIntegerLt: () => isIntegerLt2,
757
- isIntegerLte: () => isIntegerLte2,
758
- isIntegerOrUndefined: () => isIntegerOrUndefined2,
759
- isNaNValue: () => isNaNValue2,
760
- isNegInfinity: () => isNegInfinity2,
761
- isNonEmptyArray: () => isNonEmptyArray2,
762
- isNonEmptyArrayOrUndefined: () => isNonEmptyArrayOrUndefined2,
763
- isNonEmptyString: () => isNonEmptyString2,
764
- isNonEmptyStringOrUndefined: () => isNonEmptyStringOrUndefined2,
765
- isNotThrowing: () => isNotThrowing2,
766
- isNull: () => isNull2,
767
- isNullish: () => isNullish2,
768
- isNumber: () => isNumber2,
769
- isNumberBetween: () => isNumberBetween2,
770
- isNumberBetweenExclusive: () => isNumberBetweenExclusive2,
771
- isNumberOrUndefined: () => isNumberOrUndefined2,
772
- isObject: () => isObject2,
773
- isObjectOrUndefined: () => isObjectOrUndefined2,
774
- isOddNumber: () => isOddNumber2,
775
- isPosInfinity: () => isPosInfinity2,
776
- isString: () => isString2,
777
- isStringOrUndefined: () => isStringOrUndefined2,
778
- isThrowing: () => isThrowing2,
779
- isTrue: () => isTrue2,
780
- isTrueOrUndefined: () => isTrueOrUndefined2,
781
- isTypedObject: () => isTypedObject2,
782
- isUndefined: () => isUndefined2,
783
- tryOr: () => tryOr
784
- });
785
-
786
- // src/utils/obj/index.ts
787
- var obj_exports = {};
788
- __export(obj_exports, {
789
- deepEqual: () => deepEqual,
790
- hasProperties: () => hasProperties,
791
- isObject: () => isObject2
792
- });
793
- function hasProperties(obj, props) {
794
- return isObject2(obj) && props.every((p) => p in obj);
795
- }
796
- function deepEqual(a, b) {
797
- if (a === b) return true;
798
- if (a === null || b === null) return false;
799
- if (typeof a !== "object" || typeof b !== "object") return false;
800
- if (Array.isArray(a) && Array.isArray(b)) {
801
- if (a.length !== b.length) return false;
802
- return a.every((val, i) => deepEqual(val, b[i]));
803
- }
804
- if (Array.isArray(a) !== Array.isArray(b)) return false;
805
- const keysA = Object.keys(a);
806
- const keysB = Object.keys(b);
807
- if (keysA.length !== keysB.length) return false;
808
- for (const key of keysA) {
809
- if (!Object.prototype.hasOwnProperty.call(b, key)) return false;
810
- if (!deepEqual(a[key], b[key])) return false;
811
- }
812
- return true;
813
- }
814
-
815
- // src/utils/enum/index.ts
816
- var enum_exports = {};
817
- __export(enum_exports, {
818
- assertEnumValue: () => assertEnumValue,
819
- forEachEnum: () => forEachEnum,
820
- getEnumEntries: () => getEnumEntries,
821
- getEnumKey: () => getEnumKey,
822
- getEnumKeys: () => getEnumKeys,
823
- getEnumValues: () => getEnumValues,
824
- isEnumValue: () => isEnumValue2
825
- });
826
- function getEnumKeys(e) {
827
- return Object.keys(e).filter((k) => isNaN(Number(k)));
828
- }
829
- function getEnumValues(e) {
830
- return getEnumKeys(e).map((k) => e[k]);
831
- }
832
- function getEnumEntries(e) {
833
- return getEnumKeys(e).map((k) => [k, e[k]]);
834
- }
835
- function getEnumKey(e, value) {
836
- return getEnumKeys(e).find((k) => e[k] === value);
837
- }
838
- function forEachEnum(e, callback) {
839
- for (const [k, v] of getEnumEntries(e)) callback(k, v);
840
- }
841
- function isEnumValue2(e, value) {
842
- return getEnumValues(e).includes(value);
843
- }
844
- function assertEnumValue(e, value) {
845
- if (!isEnumValue2(e, value)) {
846
- throw new TypeError(`Invalid enum value: ${String(value)}`);
847
- }
848
- }
849
-
850
- // src/guard/index.ts
851
- function isEqual2(value1, value2) {
852
- return value1 === value2;
853
- }
854
- function isDeepEqual2(value1, value2) {
855
- return deepEqual(value1, value2);
856
- }
857
- function isUndefined2(value) {
858
- return value === void 0;
859
- }
860
- function isNull2(value) {
861
- return value === null;
862
- }
863
- function isNullish2(value) {
864
- return value === void 0 || value === null;
865
- }
866
- function isObject2(value) {
867
- return typeof value === "object" && value !== null && !isArray2(value);
868
- }
869
- function isObjectOrUndefined2(value) {
870
- return value === void 0 || isObject2(value);
871
- }
872
- function isTypedObject2(obj, keys) {
873
- return isObject2(obj) && keys.every((k) => k in obj);
874
- }
875
- function isArray2(a) {
876
- return !!a && Object.prototype.toString.call(a) === "[object Array]";
877
- }
878
- function isArrayOrUndefined2(value) {
879
- return value === void 0 || isArray2(value);
880
- }
881
- function isEmptyArray2(a) {
882
- return isArray2(a) && a.length === 0;
883
- }
884
- function isNonEmptyArray2(a) {
885
- return isArray2(a) && a.length > 0;
886
- }
887
- function isEmptyArrayOrUndefined2(a) {
888
- return isArray2(a) && a.length === 0 || a === void 0;
889
- }
890
- function isNonEmptyArrayOrUndefined2(a) {
891
- return isArray2(a) && a.length > 0 || a === void 0;
892
- }
893
- function isString2(value) {
894
- return typeof value === "string";
895
- }
896
- function isEmptyString2(value) {
897
- return typeof value === "string" && value.length === 0;
898
- }
899
- function isNonEmptyString2(value) {
900
- return typeof value === "string" && value.length > 0;
901
- }
902
- function isStringOrUndefined2(value) {
903
- return value === void 0 || typeof value === "string";
904
- }
905
- function isEmptyStringOrUndefined2(value) {
906
- return typeof value === "string" && value.length === 0 || value === void 0;
907
- }
908
- function isNonEmptyStringOrUndefined2(value) {
909
- return typeof value === "string" && value.length > 0 || value === void 0;
910
- }
911
- function isBoolean2(value) {
912
- return typeof value === "boolean";
913
- }
914
- function isBooleanOrUndefined2(value) {
915
- return value === void 0 || typeof value === "boolean";
916
- }
917
- function isTrue2(value) {
918
- return value === true;
919
- }
920
- function isTrueOrUndefined2(value) {
921
- return value === true || value === void 0;
922
- }
923
- function isFalse2(value) {
924
- return value === false;
925
- }
926
- function isFalseOrUndefined2(value) {
927
- return value === false || value === void 0;
928
- }
929
- function isFunction2(value) {
930
- return typeof value === "function";
931
- }
932
- function isFunctionOrUndefined2(value) {
933
- return value === void 0 || typeof value === "function";
934
- }
935
- function isEnumValue3(value, enumObj, name = "value") {
936
- return getEnumValues(enumObj).some((v) => v === value);
937
- }
938
- function isEnumValueOrUndefined2(value, enumObj, name = "value") {
939
- return value === void 0 || getEnumValues(enumObj).some((v) => v === value);
940
- }
941
- function isNumber2(value) {
942
- return typeof value === "number";
943
- }
944
- function isNumberOrUndefined2(value) {
945
- return typeof value === "number" || value === void 0;
946
- }
947
- function isFinite3(value) {
948
- return typeof value === "number" && Number.isFinite(value);
949
- }
950
- function isInteger2(n) {
951
- return typeof n === "number" && isFinite3(n) && n === Math.trunc(n);
952
- }
953
- function isIntegerOrUndefined2(n) {
954
- return typeof n === "number" && isFinite3(n) && n === Math.trunc(n) || n === void 0;
955
- }
956
- function isIntegerEq2(value, compareTo) {
957
- return isInteger2(value) && value === compareTo;
958
- }
959
- function isIntegerGt2(value, compareTo) {
960
- return isInteger2(value) && isNumber2(compareTo) && value > compareTo;
961
- }
962
- function isIntegerGte2(value, compareTo) {
963
- return isInteger2(value) && isNumber2(compareTo) && value >= compareTo;
964
- }
965
- function isIntegerLt2(value, compareTo) {
966
- return isInteger2(value) && isNumber2(compareTo) && value < compareTo;
967
- }
968
- function isIntegerLte2(value, compareTo) {
969
- return isInteger2(value) && isNumber2(compareTo) && value <= compareTo;
970
- }
971
- function isIntegerBetween2(value, min, max) {
972
- return isInteger2(value) && isNumber2(min) && isNumber2(max) && value >= min && value <= max;
973
- }
974
- function isIntegerBetweenExclusive2(value, min, max) {
975
- return isInteger2(value) && isNumber2(min) && isNumber2(max) && value > min && value < max;
976
- }
977
- function isNumberBetween2(value, min, max) {
978
- return isNumber2(value) && isNumber2(min) && isNumber2(max) && value >= min && value <= max;
979
- }
980
- function isNumberBetweenExclusive2(value, min, max) {
981
- return isNumber2(value) && isNumber2(min) && isNumber2(max) && value > min && value < max;
982
- }
983
- function isNaNValue2(value) {
984
- return typeof value === "number" && Number.isNaN(value);
985
- }
986
- function isInfinity2(value) {
987
- return typeof value === "number" && Math.abs(value) === Infinity;
988
- }
989
- function isPosInfinity2(value) {
990
- return typeof value === "number" && value === Infinity;
991
- }
992
- function isNegInfinity2(value) {
993
- return typeof value === "number" && value === -Infinity;
994
- }
995
- function isOddNumber2(value) {
996
- return isInteger2(value) && value % 2 === 1;
997
- }
998
- function isEvenNumber2(value) {
999
- return isInteger2(value) && value % 2 === 0;
1000
- }
1001
- function isIncluded2(value, array) {
1002
- return array.includes(value);
1003
- }
1004
- function isArrayIndex2(index, array) {
1005
- return isInteger2(index) && isArray2(array) && index >= 0 && index < array.length;
1006
- }
1007
- function isThrowing2(throwTestFn) {
1008
- try {
1009
- throwTestFn();
1010
- return false;
1011
- } catch (err) {
1012
- return true;
1013
- }
1014
- }
1015
- function isNotThrowing2(throwTestFn) {
1016
- try {
1017
- throwTestFn();
1018
- return true;
1019
- } catch (err) {
1020
- return false;
1021
- }
1022
- }
1023
- function tryOr(tryFn, orVal) {
1024
- try {
1025
- return tryFn();
1026
- } catch (err) {
1027
- return isFunction2(orVal) ? orVal() : orVal;
1028
- }
1029
- }
1030
-
1031
1261
  // src/utils/index.ts
1032
1262
  var utils_exports = {};
1033
1263
  __export(utils_exports, {
1034
1264
  Arr: () => arr_exports,
1035
1265
  Dom: () => dom_exports,
1036
1266
  Enum: () => enum_exports,
1037
- Is: () => Is,
1038
- Map: () => map_exports,
1039
1267
  Math: () => math_exports,
1040
1268
  Obj: () => obj_exports,
1041
1269
  Str: () => str_exports
@@ -1050,33 +1278,29 @@ __export(arr_exports, {
1050
1278
  fillArray: () => fillArray,
1051
1279
  getRangeArray: () => getRangeArray,
1052
1280
  getSequenceArray: () => getSequenceArray,
1053
- isArray: () => isArray2,
1281
+ isArray: () => isArray,
1054
1282
  mapRangeArray: () => mapRangeArray,
1055
1283
  mapSequenceArray: () => mapSequenceArray,
1056
1284
  removeDuplicates: () => removeDuplicates,
1057
- removeDuplicatesCmp: () => removeDuplicatesCmp,
1058
1285
  toArray: () => toArray
1059
1286
  });
1060
1287
  function toArray(a) {
1061
- return isArray2(a) ? a : [a];
1288
+ return isArray(a) ? a : [a];
1062
1289
  }
1063
1290
  function duplicate(a) {
1064
- return a === void 0 ? a : a.slice();
1291
+ return a?.slice() ?? [];
1065
1292
  }
1066
1293
  function removeDuplicates(arr, compareFn) {
1067
1294
  return compareFn !== void 0 ? arr.filter((a, id, self) => id === self.findIndex((b) => compareFn(a, b))) : arr.filter((a, id, self) => id === self.indexOf(a));
1068
1295
  }
1069
- function removeDuplicatesCmp(arr, compareFn) {
1070
- return arr.filter((a, id, self) => id === self.findIndex((b) => compareFn(a, b)));
1071
- }
1072
1296
  function fillArray(fillValue, fillCount) {
1073
- if (!isInteger2(fillCount) || fillCount < 0) {
1297
+ if (!isInteger(fillCount) || fillCount < 0) {
1074
1298
  throw new Error("fillArray: Invalid fillCount = " + fillCount);
1075
1299
  }
1076
1300
  return new Array(fillCount).fill(fillValue);
1077
1301
  }
1078
1302
  function mapSequenceArray(len, fn) {
1079
- if (!isInteger2(len) || len < 0) {
1303
+ if (!isInteger(len) || len < 0) {
1080
1304
  throw new Error("mapSequenceArray: Invalid len = " + len);
1081
1305
  }
1082
1306
  let arr = new Array(len);
@@ -1089,10 +1313,10 @@ function getSequenceArray(len) {
1089
1313
  return mapSequenceArray(len, (i) => i);
1090
1314
  }
1091
1315
  function mapRangeArray(start, end, fn) {
1092
- if (!isInteger2(start)) {
1316
+ if (!isInteger(start)) {
1093
1317
  throw new Error("mapRangeArray: Invalid start = " + end);
1094
1318
  }
1095
- if (!isInteger2(end)) {
1319
+ if (!isInteger(end)) {
1096
1320
  throw new Error("mapRangeArray: Invalid end = " + end);
1097
1321
  }
1098
1322
  let len = Math.abs(end - start) + 1;
@@ -1109,7 +1333,7 @@ function arrayContains(arg, item) {
1109
1333
  return arg.indexOf(item) >= 0;
1110
1334
  }
1111
1335
  function chunckArray(arr, chunckSize) {
1112
- if (!isInteger2(chunckSize) || chunckSize < 1) {
1336
+ if (!isInteger(chunckSize) || chunckSize < 1) {
1113
1337
  throw new Error("chunckArray: Invalid chunckSize = " + chunckSize);
1114
1338
  }
1115
1339
  let result = [];
@@ -1309,15 +1533,6 @@ function getCanvasTextWidth(text, font) {
1309
1533
  return ctx.measureText(text).width;
1310
1534
  }
1311
1535
 
1312
- // src/utils/map/index.ts
1313
- var map_exports = {};
1314
- __export(map_exports, {
1315
- getMapKeys: () => getMapKeys
1316
- });
1317
- function getMapKeys(map) {
1318
- return [...map.keys()];
1319
- }
1320
-
1321
1536
  // src/utils/math/index.ts
1322
1537
  var math_exports = {};
1323
1538
  __export(math_exports, {
@@ -1327,8 +1542,8 @@ __export(math_exports, {
1327
1542
  cmp: () => cmp,
1328
1543
  interpolateCoord: () => interpolateCoord,
1329
1544
  interpolateY: () => interpolateY,
1330
- isInteger: () => isInteger2,
1331
- isNumber: () => isNumber2,
1545
+ isInteger: () => isInteger,
1546
+ isNumber: () => isNumber,
1332
1547
  linearToDecibels: () => linearToDecibels,
1333
1548
  mod: () => mod,
1334
1549
  romanize: () => romanize,
@@ -1348,7 +1563,7 @@ function mod(m, n) {
1348
1563
  return (m % n + n) % n;
1349
1564
  }
1350
1565
  function romanize(n) {
1351
- if (!isInteger2(n) || n < 0) {
1566
+ if (!isInteger(n) || n < 0) {
1352
1567
  throw new Error("romanize: Invalid n = " + n);
1353
1568
  }
1354
1569
  var digits = String(+n).split("");
@@ -1389,7 +1604,7 @@ function romanize(n) {
1389
1604
  return Array(+digits.join("") + 1).join("M") + roman;
1390
1605
  }
1391
1606
  function toOrdinalNumber(n) {
1392
- if (!isInteger2(n)) {
1607
+ if (!isInteger(n)) {
1393
1608
  throw new Error("toOrdinalNumber: Invalid n = " + n);
1394
1609
  }
1395
1610
  const nStr = n.toString();
@@ -1442,21 +1657,6 @@ function cmp(a, b) {
1442
1657
  return a < b ? -1 : a > b ? 1 : 0;
1443
1658
  }
1444
1659
 
1445
- // src/utils/str/index.ts
1446
- var str_exports = {};
1447
- __export(str_exports, {
1448
- charCount: () => charCount,
1449
- chunkString: () => chunkString,
1450
- insertAt: () => insertAt,
1451
- isString: () => isString2,
1452
- makeSentenceFromPascal: () => makeSentenceFromPascal,
1453
- removeAt: () => removeAt,
1454
- repeatString: () => repeatString,
1455
- replaceAt: () => replaceAt,
1456
- stringify: () => stringify,
1457
- toCharArray: () => toCharArray
1458
- });
1459
-
1460
1660
  // src/core/base.ts
1461
1661
  var DefaultEqualityFn = (a, b) => a === b;
1462
1662
  var BaseContainer = class {
@@ -1487,7 +1687,7 @@ var Stack = class extends BaseContainer {
1487
1687
  return this.data.pop();
1488
1688
  }
1489
1689
  popOr(defaultValueOrCreator) {
1490
- return this.isEmpty() ? isFunction2(defaultValueOrCreator) ? defaultValueOrCreator() : defaultValueOrCreator : this.data.pop();
1690
+ return this.isEmpty() ? isFunction(defaultValueOrCreator) ? defaultValueOrCreator() : defaultValueOrCreator : this.data.pop();
1491
1691
  }
1492
1692
  top() {
1493
1693
  return this.data[this.assertId(this.length - 1)];
@@ -1496,7 +1696,7 @@ var Stack = class extends BaseContainer {
1496
1696
  return this.data[this.length - 1];
1497
1697
  }
1498
1698
  topOr(defaultValueOrCreator) {
1499
- return this.isEmpty() ? isFunction2(defaultValueOrCreator) ? defaultValueOrCreator() : defaultValueOrCreator : this.data[this.length - 1];
1699
+ return this.isEmpty() ? isFunction(defaultValueOrCreator) ? defaultValueOrCreator() : defaultValueOrCreator : this.data[this.length - 1];
1500
1700
  }
1501
1701
  peek(depth = 0) {
1502
1702
  return this.data[this.assertId(this.data.length - 1 - depth)];
@@ -1507,7 +1707,7 @@ var Stack = class extends BaseContainer {
1507
1707
  peekOr(depth = 0, defaultValueOrCreator) {
1508
1708
  const id = this.data.length - 1 - depth;
1509
1709
  const value = id < 0 ? void 0 : this.data[id];
1510
- return value === void 0 ? isFunction2(defaultValueOrCreator) ? defaultValueOrCreator() : defaultValueOrCreator : value;
1710
+ return value === void 0 ? isFunction(defaultValueOrCreator) ? defaultValueOrCreator() : defaultValueOrCreator : value;
1511
1711
  }
1512
1712
  *values() {
1513
1713
  for (let id = this.data.length - 1; id >= 0; id--)
@@ -1616,7 +1816,7 @@ var Vec = class _Vec extends BaseContainer {
1616
1816
  if (a.coords.length !== b.coords.length) {
1617
1817
  throw new TypeError("Coordinate length mismatch!");
1618
1818
  }
1619
- if (!isFinite3(t)) {
1819
+ if (!isFinite2(t)) {
1620
1820
  throw new TypeError("Lerp t is not finite!");
1621
1821
  }
1622
1822
  return a.add(b.sub(a).mul(t));
@@ -2167,6 +2367,9 @@ var AnchoredRect = class _AnchoredRect {
2167
2367
  toRect() {
2168
2368
  return new Rect(this.left, this.right, this.width, this.height);
2169
2369
  }
2370
+ toString() {
2371
+ return `Rect(left=${this.left}, anchorX=${this.anchorX}, right=${this.right}, top=${this.top}, anchorY=${this.anchorY}, bottom=${this.bottom})`;
2372
+ }
2170
2373
  };
2171
2374
 
2172
2375
  // src/core/LRU-cache.ts
@@ -2310,7 +2513,7 @@ var IndexArray = class _IndexArray extends BaseContainer {
2310
2513
  }
2311
2514
  }
2312
2515
  static validateIndex(id) {
2313
- if (!isIntegerGte2(id, 0)) throw new Error(`Invalid index ${id} - must be an integer >= 0!`);
2516
+ if (!isIntegerGte(id, 0)) throw new Error(`Invalid index ${id} - must be an integer >= 0!`);
2314
2517
  return id;
2315
2518
  }
2316
2519
  get posLen() {
@@ -2349,7 +2552,7 @@ var IndexArray = class _IndexArray extends BaseContainer {
2349
2552
  }
2350
2553
  getOrCreate(id, creatorOrValue) {
2351
2554
  if (!this.has(id)) {
2352
- const value = isFunction2(creatorOrValue) ? creatorOrValue() : creatorOrValue;
2555
+ const value = isFunction(creatorOrValue) ? creatorOrValue() : creatorOrValue;
2353
2556
  this.set(id, value);
2354
2557
  return value;
2355
2558
  }
@@ -2486,15 +2689,15 @@ var IndexArray = class _IndexArray extends BaseContainer {
2486
2689
  }
2487
2690
  return result;
2488
2691
  }
2489
- equals(other, eq2) {
2692
+ equals(other, eq) {
2490
2693
  if (this.size !== other.size) return false;
2491
- eq2 ?? (eq2 = (a, b) => a === b);
2694
+ eq ?? (eq = (a, b) => a === b);
2492
2695
  const posLen = Math.max(this.posLen, other.posLen);
2493
2696
  for (let i = 0; i < posLen; ++i) {
2494
2697
  const hasA = this.hasPos[i];
2495
2698
  const hasB = other.hasPos[i];
2496
2699
  if (hasA !== hasB) return false;
2497
- if (hasA && !eq2(this.posVal[i], other.posVal[i])) return false;
2700
+ if (hasA && !eq(this.posVal[i], other.posVal[i])) return false;
2498
2701
  }
2499
2702
  return true;
2500
2703
  }
@@ -2547,7 +2750,7 @@ var SignedIndexArray = class _SignedIndexArray extends BaseContainer {
2547
2750
  return -id - 1;
2548
2751
  }
2549
2752
  static validateIndex(id) {
2550
- if (!isInteger2(id)) throw new Error(`Invalid index ${id} - must be an integer!`);
2753
+ if (!isInteger(id)) throw new Error(`Invalid index ${id} - must be an integer!`);
2551
2754
  return id;
2552
2755
  }
2553
2756
  get size() {
@@ -2597,7 +2800,7 @@ var SignedIndexArray = class _SignedIndexArray extends BaseContainer {
2597
2800
  }
2598
2801
  getOrCreate(id, creatorOrValue) {
2599
2802
  if (!this.has(id)) {
2600
- const value = isFunction2(creatorOrValue) ? creatorOrValue() : creatorOrValue;
2803
+ const value = isFunction(creatorOrValue) ? creatorOrValue() : creatorOrValue;
2601
2804
  this.set(id, value);
2602
2805
  return value;
2603
2806
  }
@@ -2605,10 +2808,10 @@ var SignedIndexArray = class _SignedIndexArray extends BaseContainer {
2605
2808
  }
2606
2809
  delete(id) {
2607
2810
  _SignedIndexArray.validateIndex(id);
2608
- const isPos = id >= 0;
2609
- const arr = isPos ? this.posVal : this.negVal;
2610
- const has = isPos ? this.hasPos : this.hasNeg;
2611
- const idx = isPos ? id : _SignedIndexArray.toNegIndex(id);
2811
+ const isPos3 = id >= 0;
2812
+ const arr = isPos3 ? this.posVal : this.negVal;
2813
+ const has = isPos3 ? this.hasPos : this.hasNeg;
2814
+ const idx = isPos3 ? id : _SignedIndexArray.toNegIndex(id);
2612
2815
  if (!has[idx]) return false;
2613
2816
  arr[idx] = void 0;
2614
2817
  has[idx] = false;
@@ -2748,22 +2951,22 @@ var SignedIndexArray = class _SignedIndexArray extends BaseContainer {
2748
2951
  }
2749
2952
  return result;
2750
2953
  }
2751
- equals(other, eq2) {
2954
+ equals(other, eq) {
2752
2955
  if (this.size !== other.size) return false;
2753
- eq2 ?? (eq2 = (a, b) => a === b);
2956
+ eq ?? (eq = (a, b) => a === b);
2754
2957
  const posLen = Math.max(this.posLen, other.posLen);
2755
2958
  for (let i = 0; i < posLen; ++i) {
2756
2959
  const hasA = this.hasPos[i];
2757
2960
  const hasB = other.hasPos[i];
2758
2961
  if (hasA !== hasB) return false;
2759
- if (hasA && !eq2(this.posVal[i], other.posVal[i])) return false;
2962
+ if (hasA && !eq(this.posVal[i], other.posVal[i])) return false;
2760
2963
  }
2761
2964
  const negLen = Math.max(this.negLen, other.negLen);
2762
2965
  for (let i = 0; i < negLen; ++i) {
2763
2966
  const hasA = this.hasNeg[i];
2764
2967
  const hasB = other.hasNeg[i];
2765
2968
  if (hasA !== hasB) return false;
2766
- if (hasA && !eq2(this.negVal[i], other.negVal[i])) return false;
2969
+ if (hasA && !eq(this.negVal[i], other.negVal[i])) return false;
2767
2970
  }
2768
2971
  return true;
2769
2972
  }
@@ -2832,7 +3035,7 @@ var DefaultArray = class _DefaultArray extends BaseContainer {
2832
3035
  }
2833
3036
  getOrCreate(id, creatorOrValue) {
2834
3037
  if (!this.has(id)) {
2835
- const value = isFunction2(creatorOrValue) ? creatorOrValue() : creatorOrValue;
3038
+ const value = isFunction(creatorOrValue) ? creatorOrValue() : creatorOrValue;
2836
3039
  this.set(id, value);
2837
3040
  return value;
2838
3041
  }
@@ -2967,11 +3170,11 @@ var DefaultArray = class _DefaultArray extends BaseContainer {
2967
3170
  }
2968
3171
  return result;
2969
3172
  }
2970
- equals(other, eq2) {
3173
+ equals(other, eq) {
2971
3174
  if (this.size !== other.size) return false;
2972
- eq2 ?? (eq2 = (a, b) => a === b);
3175
+ eq ?? (eq = (a, b) => a === b);
2973
3176
  for (let id = 0; id < this.data.length; ++id) {
2974
- if (!eq2(this.data[id], other.data[id])) return false;
3177
+ if (!eq(this.data[id], other.data[id])) return false;
2975
3178
  }
2976
3179
  return true;
2977
3180
  }
@@ -2990,12 +3193,12 @@ var UniMap = class _UniMap extends BaseContainer {
2990
3193
  __publicField(this, "map");
2991
3194
  __publicField(this, "keyEquals");
2992
3195
  const maybeEquals = args.at(-1);
2993
- this.keyEquals = isFunction2(maybeEquals) ? args.pop() : DefaultEqualityFn;
3196
+ this.keyEquals = isFunction(maybeEquals) ? args.pop() : DefaultEqualityFn;
2994
3197
  const entries = args[0];
2995
3198
  this.map = new Map(entries);
2996
3199
  }
2997
3200
  static createDeep(arg) {
2998
- return arg ? new _UniMap(arg, isDeepEqual2) : new _UniMap(isDeepEqual2);
3201
+ return arg ? new _UniMap(arg, isDeepEqual) : new _UniMap(isDeepEqual);
2999
3202
  }
3000
3203
  has(key) {
3001
3204
  if (this.keyEquals === DefaultEqualityFn || this.map.has(key))
@@ -3039,7 +3242,7 @@ var UniMap = class _UniMap extends BaseContainer {
3039
3242
  }
3040
3243
  getOrCreate(key, creatorOrValue) {
3041
3244
  if (!this.has(key)) {
3042
- const value = isFunction2(creatorOrValue) ? creatorOrValue() : creatorOrValue;
3245
+ const value = isFunction(creatorOrValue) ? creatorOrValue() : creatorOrValue;
3043
3246
  return this.set(key, value);
3044
3247
  }
3045
3248
  return this.get(key);
@@ -3130,7 +3333,7 @@ var UniMap = class _UniMap extends BaseContainer {
3130
3333
  let first = iterator.next();
3131
3334
  if (first.done) {
3132
3335
  if (arguments.length < 2) {
3133
- throw new TypeError("Reduce of empty Map1 with no initial value!");
3336
+ throw new TypeError("Reduce of empty UniMap with no initial value!");
3134
3337
  }
3135
3338
  return init;
3136
3339
  }
@@ -3207,7 +3410,7 @@ var BiMap = class _BiMap extends BaseContainer {
3207
3410
  }
3208
3411
  getOrCreate(key1, key2, creatorOrValue) {
3209
3412
  if (!this.has(key1, key2)) {
3210
- const value = isFunction2(creatorOrValue) ? creatorOrValue() : creatorOrValue;
3413
+ const value = isFunction(creatorOrValue) ? creatorOrValue() : creatorOrValue;
3211
3414
  this.set(key1, key2, value);
3212
3415
  return value;
3213
3416
  }
@@ -3317,7 +3520,7 @@ var BiMap = class _BiMap extends BaseContainer {
3317
3520
  let first = iterator.next();
3318
3521
  if (first.done) {
3319
3522
  if (arguments.length < 2) {
3320
- throw new TypeError("Reduce of empty Map2 with no initial value!");
3523
+ throw new TypeError("Reduce of empty BiMap with no initial value!");
3321
3524
  }
3322
3525
  return init;
3323
3526
  }
@@ -3412,7 +3615,7 @@ var TriMap = class _TriMap extends BaseContainer {
3412
3615
  }
3413
3616
  getOrCreate(key1, key2, key3, creatorOrValue) {
3414
3617
  if (!this.has(key1, key2, key3)) {
3415
- const value = isFunction2(creatorOrValue) ? creatorOrValue() : creatorOrValue;
3618
+ const value = isFunction(creatorOrValue) ? creatorOrValue() : creatorOrValue;
3416
3619
  this.set(key1, key2, key3, value);
3417
3620
  return value;
3418
3621
  }
@@ -3540,7 +3743,7 @@ var TriMap = class _TriMap extends BaseContainer {
3540
3743
  let first = iterator.next();
3541
3744
  if (first.done) {
3542
3745
  if (arguments.length < 2) {
3543
- throw new TypeError("Reduce of empty Map3 with no initial value!");
3746
+ throw new TypeError("Reduce of empty TriMap with no initial value!");
3544
3747
  }
3545
3748
  return init;
3546
3749
  }
@@ -3611,12 +3814,12 @@ var ValueSet = class _ValueSet extends BaseContainer {
3611
3814
  __publicField(this, "data");
3612
3815
  __publicField(this, "equals");
3613
3816
  const maybeEquals = args.at(-1);
3614
- this.equals = isFunction2(maybeEquals) ? args.pop() : DefaultEqualityFn;
3817
+ this.equals = isFunction(maybeEquals) ? args.pop() : DefaultEqualityFn;
3615
3818
  const entries = args[0];
3616
3819
  this.data = new Set(entries);
3617
3820
  }
3618
3821
  static createDeep(arg) {
3619
- return arg ? new _ValueSet(arg, isDeepEqual2) : new _ValueSet(isDeepEqual2);
3822
+ return arg ? new _ValueSet(arg, isDeepEqual) : new _ValueSet(isDeepEqual);
3620
3823
  }
3621
3824
  has(value) {
3622
3825
  if (this.equals === DefaultEqualityFn)
@@ -3644,7 +3847,7 @@ var ValueSet = class _ValueSet extends BaseContainer {
3644
3847
  }
3645
3848
  getOrCreate(key, creatorOrValue) {
3646
3849
  if (!this.has(key)) {
3647
- const value = isFunction2(creatorOrValue) ? creatorOrValue() : creatorOrValue;
3850
+ const value = isFunction(creatorOrValue) ? creatorOrValue() : creatorOrValue;
3648
3851
  this.set(key, value);
3649
3852
  return value;
3650
3853
  }
@@ -3871,7 +4074,7 @@ var LinkedList = class _LinkedList extends BaseContainer {
3871
4074
  __publicField(this, "_size", 0);
3872
4075
  __publicField(this, "equals");
3873
4076
  const maybeEquals = args.at(-1);
3874
- this.equals = isFunction2(maybeEquals) ? args.pop() : DefaultEqualityFn;
4077
+ this.equals = isFunction(maybeEquals) ? args.pop() : DefaultEqualityFn;
3875
4078
  const entries = args[0];
3876
4079
  if (entries) {
3877
4080
  for (const v of entries) {
@@ -3881,9 +4084,9 @@ var LinkedList = class _LinkedList extends BaseContainer {
3881
4084
  }
3882
4085
  static createDeep(entries) {
3883
4086
  if (entries) {
3884
- return new _LinkedList(entries, isDeepEqual2);
4087
+ return new _LinkedList(entries, isDeepEqual);
3885
4088
  } else {
3886
- return new _LinkedList(isDeepEqual2);
4089
+ return new _LinkedList(isDeepEqual);
3887
4090
  }
3888
4091
  }
3889
4092
  get length() {
@@ -4064,1416 +4267,33 @@ var LinkedList = class _LinkedList extends BaseContainer {
4064
4267
  }
4065
4268
  };
4066
4269
 
4067
- // src/utils/str/index.ts
4068
- function toCharArray(str2) {
4069
- return str2.split("");
4070
- }
4071
- function repeatString(repeatString2, repeatCount) {
4072
- if (!isInteger2(repeatCount) || repeatCount < 0) {
4073
- throw new Error("repeatStr: Invalid repeatCount = " + repeatCount);
4074
- }
4075
- return new Array(repeatCount + 1).join(repeatString2);
4076
- }
4077
- function chunkString(str2, chunkSize) {
4078
- if (!isInteger2(chunkSize) || chunkSize < 1) {
4079
- throw new Error("chunckString: Invalid chuckSize = " + chunkSize);
4080
- }
4081
- let result = [];
4082
- for (let i = 0; i < str2.length; i += chunkSize) {
4083
- result.push(str2.slice(i, i + chunkSize));
4084
- }
4085
- return result;
4086
- }
4087
- function replaceAt(str2, pos, removeCount, insert) {
4088
- if (!isInteger2(removeCount) || removeCount < 0) {
4089
- throw new Error("replaceAt: Invalid removeCount = " + removeCount);
4090
- } else if (!isInteger2(pos) || pos < 0 || pos + removeCount > str2.length) {
4091
- throw new Error("replaceAt: Invalid pos = " + pos + ", removeCount = " + removeCount + ", str.length = " + str2.length);
4092
- } else {
4093
- return str2.substring(0, pos) + insert + str2.substring(pos + removeCount);
4094
- }
4095
- }
4096
- function insertAt(str2, pos, insertStr) {
4097
- return replaceAt(str2, pos, 0, insertStr);
4098
- }
4099
- function removeAt(str2, pos, removeCount) {
4100
- return replaceAt(str2, pos, removeCount, "");
4101
- }
4102
- function charCount(str2, ch) {
4103
- if (ch.length !== 1 || str2.length === 0) return 0;
4104
- let count = 0;
4105
- for (let i = 0; i < str2.length; i++) {
4106
- if (str2[i] === ch) count++;
4107
- }
4108
- return count;
4270
+ // src/index.ts
4271
+ function getLibInfo() {
4272
+ return "TsUtilsLib v2.1.0 (cjs)";
4109
4273
  }
4110
- function makeSentenceFromPascal(PascalString) {
4111
- if (PascalString === "") {
4112
- return "";
4113
- }
4114
- let word = PascalString.charAt(0);
4115
- let sentence = "";
4116
- const addWord = () => {
4117
- if (word !== "") {
4118
- if (sentence === "") {
4119
- sentence += word.charAt(0).toUpperCase() + word.substring(1);
4120
- } else {
4121
- sentence += " " + word;
4122
- }
4123
- word = "";
4124
- }
4125
- };
4126
- const isLetterAndCapital = (c) => {
4127
- return c.toUpperCase() !== c.toLowerCase() && c === c.toUpperCase();
4128
- };
4129
- for (let i = 1; i < PascalString.length; i++) {
4130
- let c = PascalString.charAt(i);
4131
- if (isLetterAndCapital(c)) {
4132
- addWord();
4133
- }
4134
- word += c.toLowerCase();
4135
- }
4136
- addWord();
4137
- return sentence;
4138
- }
4139
- function stringify(value, maxDepth = 5, seen = /* @__PURE__ */ new WeakSet()) {
4140
- if (value === null) return "null";
4141
- if (value === void 0) return "undefined";
4142
- const t = typeof value;
4143
- switch (t) {
4144
- case "boolean":
4145
- return value ? "true" : "false";
4146
- case "number":
4147
- if (isNaNValue2(value)) return "NaN";
4148
- if (!isFinite3(value))
4149
- return value < 0 ? "-Infinity" : "Infinity";
4150
- return value.toString();
4151
- case "bigint":
4152
- return `${value}n`;
4153
- case "string":
4154
- return `"${value}"`;
4155
- case "symbol":
4156
- return value.description ? `Symbol(${value.description})` : "Symbol()";
4157
- case "function":
4158
- return `[Function${value.name ? ` ${value.name}` : ""}]`;
4159
- }
4160
- if (seen.has(value))
4161
- return "[Circular]";
4162
- if (maxDepth <= 0)
4163
- return "[Depth limit]";
4164
- maxDepth--;
4165
- seen.add(value);
4166
- const strfy = (v) => stringify(v, maxDepth, seen);
4167
- if (isArray2(value)) {
4168
- const inner = value.map((v) => strfy(v)).join(", ");
4169
- return inner.length === 0 ? "[ ]" : `[ ${inner} ]`;
4170
- }
4171
- if (ArrayBuffer.isView(value)) {
4172
- if (value instanceof DataView)
4173
- return `DataView(${value.byteLength})`;
4174
- const inner = Array.from(value).map((v) => strfy(v)).join(", ");
4175
- return `${value.constructor.name}[ ${inner} ]`;
4176
- }
4177
- if (value instanceof ArrayBuffer)
4178
- return `ArrayBuffer(${value.byteLength})`;
4179
- if (value instanceof Map) {
4180
- const entries = Array.from(value.entries()).map(([k, v]) => `${strfy(k)} => ${strfy(v)}`).join(", ");
4181
- return entries.length === 0 ? `Map(${value.size}){ }` : `Map(${value.size}){ ${entries} }`;
4182
- }
4183
- if (value instanceof Set) {
4184
- const entries = Array.from(value.values()).map((v) => strfy(v)).join(", ");
4185
- return entries.length === 0 ? `Set(${value.size}){ }` : `Set(${value.size}){ ${entries} }`;
4186
- }
4187
- if (value instanceof WeakMap)
4188
- return "WeakMap{ ? }";
4189
- if (value instanceof WeakSet)
4190
- return "WeakSet{ ? }";
4191
- if (typeof BaseContainer !== "undefined" && value instanceof BaseContainer)
4192
- return value.toString();
4193
- if (value instanceof Date)
4194
- return `Date("${value.toISOString()}")`;
4195
- if (value instanceof RegExp)
4196
- return value.toString();
4197
- if (value instanceof Error)
4198
- return `${value.name}("${value.message}")`;
4199
- if (value instanceof Promise)
4200
- return "Promise{ ? }";
4201
- if (value instanceof URL)
4202
- return `URL("${value.href}")`;
4203
- if (value instanceof URLSearchParams)
4204
- return `URLSearchParams("${value.toString()}")`;
4205
- if (value === Math) return "Math";
4206
- if (value === JSON) return "JSON";
4207
- if (value === Reflect) return "Reflect";
4208
- if (value === Intl) return "Intl";
4209
- if (t === "object") {
4210
- const ctorName = value.constructor?.name ?? "Object";
4211
- const entries = Object.entries(value).map(
4212
- ([key, val]) => `${strfy(key)}: ${strfy(val)}`
4213
- );
4214
- if (entries.length === 0) return `${ctorName}{ }`;
4215
- return `${ctorName}{ ${entries.join(", ")} }`;
4216
- }
4217
- return String(value);
4218
- }
4219
-
4220
- // src/utils/index.ts
4221
- var Is = guard_exports;
4222
-
4223
- // src/deprecated/vec2.ts
4224
- var Vec2 = class _Vec2 {
4225
- constructor(x, y) {
4226
- __publicField(this, "x");
4227
- __publicField(this, "y");
4228
- this.x = x ?? 0;
4229
- this.y = y ?? 0;
4230
- }
4231
- length() {
4232
- return Math.sqrt(this.x * this.x + this.y * this.y);
4233
- }
4234
- add(a) {
4235
- return new _Vec2(this.x + a.x, this.y + a.y);
4236
- }
4237
- sub(a) {
4238
- return new _Vec2(this.x - a.x, this.y - a.y);
4239
- }
4240
- mul(a) {
4241
- return new _Vec2(this.x * a, this.y * a);
4242
- }
4243
- div(a) {
4244
- return new _Vec2(this.x / a, this.y / a);
4245
- }
4246
- };
4247
-
4248
- // src/deprecated/small-int-cache.ts
4249
- var SmallIntCache = class {
4250
- // for keys < 0
4251
- constructor() {
4252
- __publicField(this, "pos");
4253
- // for keys >= 0
4254
- __publicField(this, "neg");
4255
- this.pos = [];
4256
- this.neg = [];
4257
- }
4258
- set(key, value) {
4259
- if (!guard_exports.isInteger(key)) {
4260
- throw new Error("Key must be an integer");
4261
- } else if (key >= 0) {
4262
- this.pos[key] = value;
4263
- } else {
4264
- this.neg[-key - 1] = value;
4265
- }
4266
- }
4267
- get(key) {
4268
- if (!guard_exports.isInteger(key)) {
4269
- throw new Error("Key must be an integer");
4270
- } else if (key >= 0) {
4271
- return this.pos[key];
4272
- } else {
4273
- return this.neg[-key - 1];
4274
- }
4275
- }
4276
- has(key) {
4277
- if (!guard_exports.isInteger(key)) {
4278
- return false;
4279
- } else if (key >= 0) {
4280
- return key in this.pos;
4281
- } else {
4282
- return -key - 1 in this.neg;
4283
- }
4284
- }
4285
- delete(key) {
4286
- if (!guard_exports.isInteger(key)) {
4287
- return;
4288
- } else if (key >= 0) {
4289
- delete this.pos[key];
4290
- } else {
4291
- delete this.neg[-key - 1];
4292
- }
4293
- }
4294
- clear() {
4295
- this.pos = [];
4296
- this.neg = [];
4297
- }
4298
- };
4299
-
4300
- // src/deprecated/map1.ts
4301
- var Map1 = class _Map1 extends BaseContainer {
4302
- constructor(entries) {
4303
- super();
4304
- __publicField(this, "map1");
4305
- this.map1 = entries instanceof _Map1 ? new Map(entries.map1) : new Map(entries);
4306
- }
4307
- has(key1) {
4308
- return this.map1.has(key1);
4309
- }
4310
- set(key1, value) {
4311
- this.map1.set(key1, value);
4312
- return value;
4313
- }
4314
- get(key1) {
4315
- return this.map1.get(key1);
4316
- }
4317
- getOrDefault(key1, defaultValue) {
4318
- return this.get(key1) ?? defaultValue;
4319
- }
4320
- getOrCreate(key1, creatorOrValue) {
4321
- if (!this.has(key1)) {
4322
- const value = isFunction2(creatorOrValue) ? creatorOrValue() : creatorOrValue;
4323
- this.set(key1, value);
4324
- return value;
4325
- }
4326
- return this.get(key1);
4327
- }
4328
- delete(key1) {
4329
- return this.map1.delete(key1);
4330
- }
4331
- clear() {
4332
- this.map1.clear();
4333
- }
4334
- get size() {
4335
- return this.map1.size;
4336
- }
4337
- isEmpty() {
4338
- return this.size === 0;
4339
- }
4340
- forEach(callbackfn, thisArg) {
4341
- this.map1.forEach((value, key1) => callbackfn.call(thisArg, value, key1, this));
4342
- }
4343
- *keys() {
4344
- yield* this.map1.keys();
4345
- }
4346
- *values() {
4347
- yield* this.map1.values();
4348
- }
4349
- *entries() {
4350
- for (const [key1, value] of this.map1)
4351
- yield [key1, value];
4352
- }
4353
- keysArray() {
4354
- return [...this.keys()];
4355
- }
4356
- valuesArray() {
4357
- return [...this.values()];
4358
- }
4359
- entriesArray() {
4360
- return [...this.entries()];
4361
- }
4362
- *kvKeys() {
4363
- for (const key of this.keys()) {
4364
- yield [key];
4365
- }
4366
- }
4367
- *kvValues() {
4368
- for (const el of this.values()) {
4369
- yield el;
4370
- }
4371
- }
4372
- *kvEntries() {
4373
- for (const [key, el] of this.entries()) {
4374
- yield [[key], el];
4375
- }
4376
- }
4377
- *[Symbol.iterator]() {
4378
- yield* this.entries();
4379
- }
4380
- clone() {
4381
- return new _Map1(this);
4382
- }
4383
- merge(other, conflictResolver) {
4384
- for (const [key1, value] of other.entries()) {
4385
- if (this.has(key1) && conflictResolver) {
4386
- this.set(key1, conflictResolver(this.get(key1), value, key1));
4387
- } else {
4388
- this.set(key1, value);
4389
- }
4390
- }
4391
- return this;
4392
- }
4393
- some(fn) {
4394
- for (const [key1, value] of this.map1) {
4395
- if (fn(value, key1)) return true;
4396
- }
4397
- return false;
4398
- }
4399
- every(fn) {
4400
- for (const [key1, value] of this.map1) {
4401
- if (!fn(value, key1)) return false;
4402
- }
4403
- return true;
4404
- }
4405
- filter(predicate) {
4406
- const result = new this.constructor();
4407
- for (const [key1, value] of this.map1) {
4408
- if (predicate(value, key1, this)) result.set(key1, value);
4409
- }
4410
- return result;
4411
- }
4412
- reduce(fn, init) {
4413
- let iterator = this.entries();
4414
- let first = iterator.next();
4415
- if (first.done) {
4416
- if (arguments.length < 2) {
4417
- throw new TypeError("Reduce of empty Map1 with no initial value!");
4418
- }
4419
- return init;
4420
- }
4421
- let acc;
4422
- let start;
4423
- if (arguments.length < 2) {
4424
- acc = first.value[1];
4425
- start = iterator.next();
4426
- } else {
4427
- acc = init;
4428
- start = first;
4429
- }
4430
- for (let current = start; !current.done; current = iterator.next()) {
4431
- const [key1, value] = current.value;
4432
- acc = fn(acc, value, key1);
4433
- }
4434
- return acc;
4435
- }
4436
- mapEntries(fn) {
4437
- let result = [];
4438
- for (const [key1, value] of this.map1) {
4439
- result.push(fn(value, key1));
4440
- }
4441
- return result;
4442
- }
4443
- mapValues(fn) {
4444
- let result = new _Map1();
4445
- for (const [key1, value] of this.map1) {
4446
- result.set(key1, fn(value, key1));
4447
- }
4448
- return result;
4449
- }
4450
- toMap() {
4451
- return new Map(this.map1);
4452
- }
4453
- toString() {
4454
- const entries = [...this.map1].map(([k, v]) => `${stringify(k)} => ${stringify(v)}`).join(", ");
4455
- return entries.length === 0 ? `Map(${this.size}){ }` : `Map(${this.size}){ ${entries} }`;
4456
- }
4457
- };
4458
4274
 
4459
- // src/deprecated/map2.ts
4460
- var Map2 = class _Map2 extends BaseContainer {
4461
- constructor(entries) {
4462
- super();
4463
- __publicField(this, "map1", /* @__PURE__ */ new Map());
4464
- if (entries instanceof _Map2) {
4465
- for (const [key1, inner] of entries.map1) {
4466
- this.map1.set(key1, new Map(inner));
4467
- }
4468
- } else if (entries) {
4469
- for (const [key1, key2, value] of entries) {
4470
- this.set(key1, key2, value);
4471
- }
4472
- }
4473
- }
4474
- has(key1, key2) {
4475
- return this.map1.get(key1)?.has(key2) ?? false;
4476
- }
4477
- set(key1, key2, value) {
4478
- let map2 = this.map1.get(key1) ?? this.map1.set(key1, /* @__PURE__ */ new Map()).get(key1);
4479
- map2.set(key2, value);
4480
- return value;
4481
- }
4482
- get(key1, key2) {
4483
- return this.map1.get(key1)?.get(key2);
4484
- }
4485
- getOrDefault(key1, key2, defaultValue) {
4486
- return this.get(key1, key2) ?? defaultValue;
4487
- }
4488
- getOrCreate(key1, key2, creatorOrValue) {
4489
- if (!this.has(key1, key2)) {
4490
- const value = isFunction2(creatorOrValue) ? creatorOrValue() : creatorOrValue;
4491
- this.set(key1, key2, value);
4492
- return value;
4493
- }
4494
- return this.get(key1, key2);
4495
- }
4496
- delete(key1, key2) {
4497
- if (key2 === void 0) return this.map1.delete(key1);
4498
- const map2 = this.map1.get(key1);
4499
- if (!map2) return false;
4500
- return map2.delete(key2);
4501
- }
4502
- clear() {
4503
- this.map1.clear();
4504
- }
4505
- get size() {
4506
- let count = 0;
4507
- for (const map2 of this.map1.values()) {
4508
- count += map2.size;
4509
- }
4510
- return count;
4511
- }
4512
- isEmpty() {
4513
- return this.size === 0;
4514
- }
4515
- forEach(callbackfn, thisArg) {
4516
- this.map1.forEach((map2, key1) => map2.forEach((value, key2) => callbackfn.call(thisArg, value, key1, key2, this)));
4517
- }
4518
- *keys() {
4519
- for (const [key1, map2] of this.map1)
4520
- for (const key2 of map2.keys())
4521
- yield [key1, key2];
4522
- }
4523
- *values() {
4524
- for (const map2 of this.map1.values())
4525
- for (const value of map2.values())
4526
- yield value;
4527
- }
4528
- *entries() {
4529
- for (const [key1, map2] of this.map1)
4530
- for (const [key2, value] of map2)
4531
- yield [key1, key2, value];
4532
- }
4533
- keysArray() {
4534
- return [...this.keys()];
4535
- }
4536
- valuesArray() {
4537
- return [...this.values()];
4538
- }
4539
- entriesArray() {
4540
- return [...this.entries()];
4541
- }
4542
- *kvKeys() {
4543
- for (const [key1, key2] of this.keys())
4544
- yield [key1, key2];
4545
- }
4546
- *kvValues() {
4547
- for (const el of this.values())
4548
- yield el;
4549
- }
4550
- *kvEntries() {
4551
- for (const [key1, key2, el] of this.entries())
4552
- yield [[key1, key2], el];
4553
- }
4554
- *[Symbol.iterator]() {
4555
- yield* this.entries();
4556
- }
4557
- clone() {
4558
- return new _Map2(this);
4559
- }
4560
- merge(other, conflictResolver) {
4561
- for (const [key1, key2, value] of other.entries()) {
4562
- if (this.has(key1, key2) && conflictResolver) {
4563
- this.set(key1, key2, conflictResolver(this.get(key1, key2), value, key1, key2));
4564
- } else {
4565
- this.set(key1, key2, value);
4566
- }
4567
- }
4568
- return this;
4569
- }
4570
- some(fn) {
4571
- for (const [key1, map2] of this.map1) {
4572
- for (const [key2, value] of map2) {
4573
- if (fn(value, key1, key2)) return true;
4574
- }
4575
- }
4576
- return false;
4577
- }
4578
- every(fn) {
4579
- for (const [key1, map2] of this.map1) {
4580
- for (const [key2, value] of map2) {
4581
- if (!fn(value, key1, key2)) return false;
4582
- }
4583
- }
4584
- return true;
4585
- }
4586
- filter(predicate) {
4587
- const result = new this.constructor();
4588
- for (const [key1, map2] of this.map1) {
4589
- for (const [key2, value] of map2) {
4590
- if (predicate(value, key1, key2, this)) result.set(key1, key2, value);
4591
- }
4592
- }
4593
- return result;
4594
- }
4595
- reduce(fn, init) {
4596
- let iterator = this.entries();
4597
- let first = iterator.next();
4598
- if (first.done) {
4599
- if (arguments.length < 2) {
4600
- throw new TypeError("Reduce of empty Map2 with no initial value!");
4601
- }
4602
- return init;
4603
- }
4604
- let acc;
4605
- let start;
4606
- if (arguments.length < 2) {
4607
- acc = first.value[2];
4608
- start = iterator.next();
4609
- } else {
4610
- acc = init;
4611
- start = first;
4612
- }
4613
- for (let current = start; !current.done; current = iterator.next()) {
4614
- const [key1, key2, value] = current.value;
4615
- acc = fn(acc, value, key1, key2);
4616
- }
4617
- return acc;
4618
- }
4619
- mapEntries(fn) {
4620
- let result = [];
4621
- for (const [key1, map2] of this.map1) {
4622
- for (const [key2, value] of map2) {
4623
- result.push(fn(value, key1, key2));
4624
- }
4625
- }
4626
- return result;
4627
- }
4628
- mapValues(fn) {
4629
- let result = new _Map2();
4630
- for (const [key1, map2] of this.map1) {
4631
- for (const [key2, value] of map2) {
4632
- result.set(key1, key2, fn(value, key1, key2));
4633
- }
4634
- }
4635
- return result;
4636
- }
4637
- toMap() {
4638
- let result = /* @__PURE__ */ new Map();
4639
- for (const [key1, map2] of this.map1) {
4640
- for (const [key2, value] of map2) {
4641
- result.set([key1, key2], value);
4642
- }
4643
- }
4644
- return result;
4645
- }
4646
- toString() {
4647
- const entries = [];
4648
- for (const [key1, map2] of this.map1) {
4649
- const inner = [...map2].map(([key2, v]) => `${stringify(key2)} => ${stringify(v)}`).join(", ");
4650
- entries.push(`${stringify(key1)} => { ${inner} }`);
4651
- }
4652
- return entries.length === 0 ? `Map(${this.size}){ }` : `Map(${this.size}){ ${entries} }`;
4653
- }
4654
- };
4655
-
4656
- // src/deprecated/map3.ts
4657
- var Map3 = class _Map3 extends BaseContainer {
4658
- constructor(entries) {
4659
- super();
4660
- __publicField(this, "map1", /* @__PURE__ */ new Map());
4661
- if (entries instanceof _Map3) {
4662
- for (const [key1, map2] of entries.map1) {
4663
- const newMap2 = /* @__PURE__ */ new Map();
4664
- for (const [key2, map3] of map2) {
4665
- newMap2.set(key2, new Map(map3));
4666
- }
4667
- this.map1.set(key1, newMap2);
4668
- }
4669
- } else if (entries) {
4670
- for (const [key1, key2, key3, value] of entries) {
4671
- this.set(key1, key2, key3, value);
4672
- }
4673
- }
4674
- }
4675
- has(key1, key2, key3) {
4676
- return this.map1.get(key1)?.get(key2)?.has(key3) ?? false;
4677
- }
4678
- set(key1, key2, key3, value) {
4679
- let map2 = this.map1.get(key1);
4680
- if (!map2) this.map1.set(key1, map2 = /* @__PURE__ */ new Map());
4681
- let map3 = map2.get(key2);
4682
- if (!map3) map2.set(key2, map3 = /* @__PURE__ */ new Map());
4683
- map3.set(key3, value);
4684
- return value;
4685
- }
4686
- get(key1, key2, key3) {
4687
- return this.map1.get(key1)?.get(key2)?.get(key3);
4688
- }
4689
- getOrDefault(key1, key2, key3, defaultValue) {
4690
- return this.get(key1, key2, key3) ?? defaultValue;
4691
- }
4692
- getOrCreate(key1, key2, key3, creatorOrValue) {
4693
- if (!this.has(key1, key2, key3)) {
4694
- const value = isFunction2(creatorOrValue) ? creatorOrValue() : creatorOrValue;
4695
- this.set(key1, key2, key3, value);
4696
- return value;
4697
- }
4698
- return this.get(key1, key2, key3);
4699
- }
4700
- delete(key1, key2, key3) {
4701
- if (key3 === void 0) {
4702
- if (key2 === void 0) return this.map1.delete(key1);
4703
- const map2 = this.map1.get(key1);
4704
- if (!map2) return false;
4705
- return map2.delete(key2);
4706
- } else {
4707
- if (key2 === void 0) return this.map1.delete(key1);
4708
- const map3 = this.map1.get(key1)?.get(key2);
4709
- if (!map3) return false;
4710
- return map3.delete(key3);
4711
- }
4712
- }
4713
- clear() {
4714
- this.map1.clear();
4715
- }
4716
- get size() {
4717
- let count = 0;
4718
- for (const map2 of this.map1.values()) {
4719
- for (const map3 of map2.values()) {
4720
- count += map3.size;
4721
- }
4722
- }
4723
- return count;
4724
- }
4725
- isEmpty() {
4726
- return this.size === 0;
4727
- }
4728
- forEach(callbackfn, thisArg) {
4729
- this.map1.forEach((map2, key1) => map2.forEach((map3, key2) => map3.forEach((value, key3) => callbackfn.call(thisArg, value, key1, key2, key3, this))));
4730
- }
4731
- *keys() {
4732
- for (const [key1, map2] of this.map1)
4733
- for (const [key2, map3] of map2)
4734
- for (const key3 of map3.keys())
4735
- yield [key1, key2, key3];
4736
- }
4737
- *values() {
4738
- for (const map2 of this.map1.values())
4739
- for (const map3 of map2.values())
4740
- for (const value of map3.values())
4741
- yield value;
4742
- }
4743
- *entries() {
4744
- for (const [key1, map2] of this.map1)
4745
- for (const [key2, map3] of map2)
4746
- for (const [key3, value] of map3)
4747
- yield [key1, key2, key3, value];
4748
- }
4749
- keysArray() {
4750
- return [...this.keys()];
4751
- }
4752
- valuesArray() {
4753
- return [...this.values()];
4754
- }
4755
- entriesArray() {
4756
- return [...this.entries()];
4757
- }
4758
- *kvKeys() {
4759
- for (const [key1, key2, key3] of this.keys())
4760
- yield [key1, key2, key3];
4761
- }
4762
- *kvValues() {
4763
- for (const el of this.values())
4764
- yield el;
4765
- }
4766
- *kvEntries() {
4767
- for (const [key1, key2, key3, el] of this.entries())
4768
- yield [[key1, key2, key3], el];
4769
- }
4770
- *[Symbol.iterator]() {
4771
- yield* this.entries();
4772
- }
4773
- clone() {
4774
- return new _Map3(this);
4775
- }
4776
- merge(other, conflictResolver) {
4777
- for (const [key1, key2, key3, value] of other.entries()) {
4778
- if (this.has(key1, key2, key3) && conflictResolver) {
4779
- this.set(key1, key2, key3, conflictResolver(this.get(key1, key2, key3), value, key1, key2, key3));
4780
- } else {
4781
- this.set(key1, key2, key3, value);
4782
- }
4783
- }
4784
- return this;
4785
- }
4786
- some(fn) {
4787
- for (const [key1, map2] of this.map1) {
4788
- for (const [key2, map3] of map2) {
4789
- for (const [key3, value] of map3) {
4790
- if (fn(value, key1, key2, key3)) return true;
4791
- }
4792
- }
4793
- }
4794
- return false;
4795
- }
4796
- every(fn) {
4797
- for (const [key1, map2] of this.map1) {
4798
- for (const [key2, map3] of map2) {
4799
- for (const [key3, value] of map3) {
4800
- if (!fn(value, key1, key2, key3)) return false;
4801
- }
4802
- }
4803
- }
4804
- return true;
4805
- }
4806
- filter(predicate) {
4807
- const result = new this.constructor();
4808
- for (const [key1, map2] of this.map1) {
4809
- for (const [key2, map3] of map2) {
4810
- for (const [key3, value] of map3) {
4811
- if (predicate(value, key1, key2, key3, this)) result.set(key1, key2, key3, value);
4812
- }
4813
- }
4814
- }
4815
- return result;
4816
- }
4817
- reduce(fn, init) {
4818
- let iterator = this.entries();
4819
- let first = iterator.next();
4820
- if (first.done) {
4821
- if (arguments.length < 2) {
4822
- throw new TypeError("Reduce of empty Map3 with no initial value!");
4823
- }
4824
- return init;
4825
- }
4826
- let acc;
4827
- let start;
4828
- if (arguments.length < 2) {
4829
- acc = first.value[3];
4830
- start = iterator.next();
4831
- } else {
4832
- acc = init;
4833
- start = first;
4834
- }
4835
- for (let current = start; !current.done; current = iterator.next()) {
4836
- const [key1, key2, key3, value] = current.value;
4837
- acc = fn(acc, value, key1, key2, key3);
4838
- }
4839
- return acc;
4840
- }
4841
- mapEntries(fn) {
4842
- let result = [];
4843
- for (const [key1, map2] of this.map1) {
4844
- for (const [key2, map3] of map2) {
4845
- for (const [key3, value] of map3) {
4846
- result.push(fn(value, key1, key2, key3));
4847
- }
4848
- }
4849
- }
4850
- return result;
4851
- }
4852
- mapValues(fn) {
4853
- let result = new _Map3();
4854
- for (const [key1, map2] of this.map1) {
4855
- for (const [key2, map3] of map2) {
4856
- for (const [key3, value] of map3) {
4857
- result.set(key1, key2, key3, fn(value, key1, key2, key3));
4858
- }
4859
- }
4860
- }
4861
- return result;
4862
- }
4863
- toMap() {
4864
- let result = /* @__PURE__ */ new Map();
4865
- for (const [key1, map2] of this.map1) {
4866
- for (const [key2, map3] of map2) {
4867
- for (const [key3, value] of map3) {
4868
- result.set([key1, key2, key3], value);
4869
- }
4870
- }
4871
- }
4872
- return result;
4873
- }
4874
- toString() {
4875
- const entries = [];
4876
- for (const [key1, map2] of this.map1) {
4877
- for (const [key2, map3] of map2) {
4878
- const inner = [...map3].map(([key3, v]) => `${stringify(key3)} => ${stringify(v)}`).join(", ");
4879
- entries.push(`${stringify(key1)} => ${stringify(key2)} => { ${inner} }`);
4880
- }
4881
- }
4882
- return entries.length === 0 ? `Map(${this.size}){ }` : `Map(${this.size}){ ${entries.join(", ")} }`;
4883
- }
4884
- };
4885
-
4886
- // src/deprecated/set.ts
4887
- var SetBase = class extends BaseContainer {
4888
- constructor(entries) {
4889
- super();
4890
- __publicField(this, "data");
4891
- this.data = new Set(entries ?? []);
4892
- }
4893
- has(value) {
4894
- return this.some((v) => this.valueEquals(v, value));
4895
- }
4896
- add(value) {
4897
- if (!this.has(value))
4898
- this.data.add(value);
4899
- return value;
4900
- }
4901
- /** @internal - This method exists only for interface `KVComponent` compatibility.*/
4902
- set(key, value) {
4903
- if (!this.valueEquals(key, value))
4904
- throw new TypeError("SetBase.set() requires key === value.");
4905
- this.add(value);
4906
- }
4907
- /** @internal - This method exists only for interface `KVComponent` compatibility.*/
4908
- get(key) {
4909
- return this.has(key) ? key : void 0;
4910
- }
4911
- /** @internal - This method exists only for interface `KVComponent` compatibility.*/
4912
- getOrDefault(key, defaultValue) {
4913
- return this.get(key) ?? defaultValue;
4914
- }
4915
- getOrCreate(key, creatorOrValue) {
4916
- if (!this.has(key)) {
4917
- const value = isFunction2(creatorOrValue) ? creatorOrValue() : creatorOrValue;
4918
- this.set(key, value);
4919
- return value;
4920
- }
4921
- return this.get(key);
4922
- }
4923
- delete(value) {
4924
- if (!this.has(value)) return false;
4925
- for (const v of this.values()) {
4926
- if (this.valueEquals(v, value)) {
4927
- this.data.delete(v);
4928
- return true;
4929
- }
4930
- }
4931
- return false;
4932
- }
4933
- clear() {
4934
- this.data.clear();
4935
- }
4936
- get size() {
4937
- return this.data.size;
4938
- }
4939
- isEmpty() {
4940
- return this.size === 0;
4941
- }
4942
- forEach(callbackfn, thisArg) {
4943
- this.data.forEach((value) => callbackfn.call(thisArg, value, this));
4944
- }
4945
- *keys() {
4946
- yield* this.data.keys();
4947
- }
4948
- *values() {
4949
- yield* this.data.values();
4950
- }
4951
- *entries() {
4952
- yield* this.data.entries();
4953
- }
4954
- *kvKeys() {
4955
- for (const key of this.keys()) {
4956
- yield [key];
4957
- }
4958
- }
4959
- *kvValues() {
4960
- for (const el of this.values()) {
4961
- yield el;
4962
- }
4963
- }
4964
- *kvEntries() {
4965
- for (const [key, el] of this.entries()) {
4966
- yield [[key], el];
4967
- }
4968
- }
4969
- *[Symbol.iterator]() {
4970
- yield* this.values();
4971
- }
4972
- clone() {
4973
- const result = this.createEmpty();
4974
- for (const v of this.values()) result.add(v);
4975
- return result;
4976
- }
4977
- merge(other) {
4978
- for (const value of other.values()) {
4979
- this.add(value);
4980
- }
4981
- return this;
4982
- }
4983
- some(fn) {
4984
- for (const value of this.data) {
4985
- if (fn(value)) return true;
4986
- }
4987
- return false;
4988
- }
4989
- every(fn) {
4990
- for (const value of this.data) {
4991
- if (!fn(value)) return false;
4992
- }
4993
- return true;
4994
- }
4995
- filter(predicate) {
4996
- const result = this.createEmpty();
4997
- for (const value of this.data)
4998
- if (predicate(value, this)) result.add(value);
4999
- return result;
5000
- }
5001
- reduce(fn, init) {
5002
- let iterator = this.values();
5003
- let first = iterator.next();
5004
- if (first.done) {
5005
- if (arguments.length < 2) {
5006
- throw new TypeError("Reduce of empty SetBase with no initial value!");
5007
- }
5008
- return init;
5009
- }
5010
- let acc;
5011
- let start;
5012
- if (arguments.length < 2) {
5013
- acc = first.value;
5014
- start = iterator.next();
5015
- } else {
5016
- acc = init;
5017
- start = first;
5018
- }
5019
- for (let current = start; !current.done; current = iterator.next()) {
5020
- const value = current.value;
5021
- acc = fn(acc, value);
5022
- }
5023
- return acc;
5024
- }
5025
- mapValues(fn) {
5026
- let result = this.createEmpty();
5027
- for (const value of this.data) {
5028
- result.add(fn(value));
5029
- }
5030
- return result;
5031
- }
5032
- mapToArray(fn) {
5033
- let result = [];
5034
- for (const value of this.values()) {
5035
- result.push(fn(value));
5036
- }
5037
- return result;
5038
- }
5039
- map(fn) {
5040
- let result = this.createEmpty();
5041
- for (const value of this.values()) {
5042
- result.add(fn(value));
5043
- }
5044
- return result;
5045
- }
5046
- toSet() {
5047
- return new Set(this.data);
5048
- }
5049
- toArray() {
5050
- return [...this.values()];
5051
- }
5052
- toString() {
5053
- return stringify(this.data);
5054
- }
5055
- };
5056
- var Set1 = class _Set1 extends SetBase {
5057
- constructor(entries) {
5058
- super(entries);
5059
- }
5060
- createEmpty() {
5061
- return new _Set1();
5062
- }
5063
- valueEquals(a, b) {
5064
- return a === b;
5065
- }
5066
- };
5067
- var DeepSet = class _DeepSet extends SetBase {
5068
- constructor(entries) {
5069
- super(entries);
5070
- }
5071
- createEmpty() {
5072
- return new _DeepSet();
5073
- }
5074
- valueEquals(a, b) {
5075
- return isDeepEqual2(a, b);
5076
- }
5077
- };
5078
-
5079
- // src/deprecated/div-rect.ts
5080
- var DivRect = class _DivRect {
5081
- constructor(...args) {
5082
- __publicField(this, "left");
5083
- __publicField(this, "anchorX");
5084
- __publicField(this, "right");
5085
- __publicField(this, "top");
5086
- __publicField(this, "anchorY");
5087
- __publicField(this, "bottom");
5088
- if (args.length === 6) {
5089
- this.left = args[0];
5090
- this.anchorX = args[1];
5091
- this.right = args[2];
5092
- this.top = args[3];
5093
- this.anchorY = args[4];
5094
- this.bottom = args[5];
5095
- } else if (args.length === 4) {
5096
- this.left = args[0];
5097
- this.right = args[1];
5098
- this.anchorX = (this.left + this.right) / 2;
5099
- this.top = args[2];
5100
- this.bottom = args[3];
5101
- this.anchorY = (this.top + this.bottom) / 2;
5102
- } else if (args.length === 0) {
5103
- this.left = this.anchorX = this.right = 0;
5104
- this.top = this.anchorY = this.bottom = 0;
5105
- } else {
5106
- throw new TypeError(`Invalid DivRect args: ${args}`);
5107
- }
5108
- }
5109
- set(...args) {
5110
- if (args.length === 6) {
5111
- this.left = args[0];
5112
- this.anchorX = args[1];
5113
- this.right = args[2];
5114
- this.top = args[3];
5115
- this.anchorY = args[4];
5116
- this.bottom = args[5];
5117
- } else if (args.length === 4) {
5118
- this.left = args[0];
5119
- this.right = args[1];
5120
- this.anchorX = (this.left + this.right) / 2;
5121
- this.top = args[2];
5122
- this.bottom = args[3];
5123
- this.anchorY = (this.top + this.bottom) / 2;
5124
- } else if (args.length === 0) {
5125
- this.left = this.anchorX = this.right = 0;
5126
- this.top = this.anchorY = this.bottom = 0;
5127
- } else {
5128
- throw new TypeError(`Invalid DivRect args: ${args}`);
5129
- }
5130
- return this;
5131
- }
5132
- /**
5133
- * Create rect from basic left, top, width and height arguments.
5134
- *
5135
- * @param left - Left coordinate.
5136
- * @param top - Top coordinate.
5137
- * @param width - Width.
5138
- * @param height - Height.
5139
- * @returns - DivRect.
5140
- */
5141
- static create(left, top, width, height) {
5142
- return new _DivRect(left, left + width, top, top + height);
5143
- }
5144
- /**
5145
- * Create rect from anchorX, anchorY, width, height arguments.
5146
- *
5147
- * @param centerX - Center x-coordinate.
5148
- * @param centerY - Center y-coordinate.
5149
- * @param width - Width.
5150
- * @param height - Height.
5151
- * @returns - DivRect.
5152
- */
5153
- static createCentered(centerX, centerY, width, height) {
5154
- return new _DivRect(
5155
- centerX - width / 2,
5156
- centerX,
5157
- centerX + width / 2,
5158
- centerY - height / 2,
5159
- centerY,
5160
- centerY + height / 2
5161
- );
5162
- }
5163
- /**
5164
- * Create rect from sections.
5165
- *
5166
- * @param leftw - Left section width.
5167
- * @param rightw - Right section width.
5168
- * @param toph - Top section height.
5169
- * @param bottomh - Bottomsection height.
5170
- * @returns - DivRect.
5171
- */
5172
- static createSections(leftw, rightw, toph, bottomh) {
5173
- return new _DivRect(-leftw, 0, rightw, -toph, 0, bottomh);
5174
- }
5175
- /**
5176
- * @deprecated - Renamed to anchorX. Will be removed in v2.0.0.
5177
- * @private
5178
- * */
5179
- get centerX() {
5180
- return this.anchorX;
5181
- }
5182
- /**
5183
- * @deprecated - Renamed to anchorX. Will be removed in v2.0.0.
5184
- * @private
5185
- * */
5186
- set centerX(x) {
5187
- this.anchorX = x;
5188
- }
5189
- /**
5190
- * @deprecated - Renamed to anchorX. Will be removed in v2.0.0.
5191
- * @private
5192
- * */
5193
- get centerY() {
5194
- return this.anchorY;
5195
- }
5196
- /**
5197
- * @deprecated - Renamed to anchorX. Will be removed in v2.0.0.
5198
- * @private
5199
- * */
5200
- set centerY(y) {
5201
- this.anchorY = y;
5202
- }
5203
- /**
5204
- * Width getter.
5205
- */
5206
- get width() {
5207
- return this.right - this.left;
5208
- }
5209
- /**
5210
- * Height getter.
5211
- */
5212
- get height() {
5213
- return this.bottom - this.top;
5214
- }
5215
- /**
5216
- * Left section width getter.
5217
- */
5218
- get leftw() {
5219
- return this.anchorX - this.left;
5220
- }
5221
- /**
5222
- * Right section width getter.
5223
- */
5224
- get rightw() {
5225
- return this.right - this.anchorX;
5226
- }
5227
- /**
5228
- * Top section height getter.
5229
- */
5230
- get toph() {
5231
- return this.anchorY - this.top;
5232
- }
5233
- /**
5234
- * Bottom section height getter.
5235
- */
5236
- get bottomh() {
5237
- return this.bottom - this.anchorY;
5238
- }
5239
- /**
5240
- * Does this Rect contain given (x, y)-point?
5241
- *
5242
- * @param x - X-coordinate.
5243
- * @param y - Y-coordinate.
5244
- * @returns - True/false.
5245
- */
5246
- contains(x, y) {
5247
- return x >= this.left && x <= this.right && y >= this.top && y <= this.bottom;
5248
- }
5249
- /**
5250
- * Do a and b rects overlap?
5251
- *
5252
- * @param a - DivRect a.
5253
- * @param b - DivRect b.
5254
- * @returns - True/false.
5255
- */
5256
- static overlap(a, b) {
5257
- return a.right > b.left && a.left < b.right && a.bottom > b.top && a.top < b.bottom;
5258
- }
5259
- /**
5260
- * Do horizontal measures of a and b rects overlap?
5261
- *
5262
- * @param a - DivRect a.
5263
- * @param b - DivRect b.
5264
- * @returns - True/false.
5265
- */
5266
- static overlapX(a, b) {
5267
- return a.right > b.left && a.left < b.right;
5268
- }
5269
- /**
5270
- * Check if given rects are equal.
5271
- * @param a - DivRect a.
5272
- * @param b - DivRect b.
5273
- * @returns - True/false.
5274
- */
5275
- static equals(a, b) {
5276
- if (a == null && b == null) {
5277
- return true;
5278
- } else if (a == null || b == null) {
5279
- return false;
5280
- } else {
5281
- return a === b || a.left === b.left && a.anchorX === b.anchorX && a.right === b.right && a.top === b.top && a.anchorY === b.anchorY && a.bottom === b.bottom;
5282
- }
5283
- }
5284
- /**
5285
- * Check if this rect equals with another rect.
5286
- * @param other - The other rect.
5287
- * @returns - True/false.
5288
- */
5289
- equals(other) {
5290
- return _DivRect.equals(this, other);
5291
- }
5292
- /**
5293
- * Check if edges of given rects are equal, ignoring anchorX and anchorY.
5294
- *
5295
- * @param a - DivRect a.
5296
- * @param b - DivRect b.
5297
- * @returns - True/false.
5298
- */
5299
- static equalsEdges(a, b) {
5300
- if (a == null && b == null) {
5301
- return true;
5302
- } else if (a == null || b == null) {
5303
- return false;
5304
- } else {
5305
- return a === b || a.left === b.left && a.right === b.right && a.top === b.top && a.bottom === b.bottom;
5306
- }
5307
- }
5308
- /**
5309
- * Check if edges of this Rect equals with given Rect, ignoring anchorX and anchorY.
5310
- *
5311
- * @param other - The other DivRect.
5312
- * @returns - True/false.
5313
- */
5314
- equalsEdges(other) {
5315
- return _DivRect.equalsEdges(this, other);
5316
- }
5317
- /**
5318
- * @deprecated - Use {@link equalsEdges()} instead. Will be removed in v2.0.0.
5319
- * @private
5320
- */
5321
- static equalsFrame(a, b) {
5322
- return _DivRect.equalsEdges(a, b);
5323
- }
5324
- /**
5325
- * @deprecated - Use {@link clone()} instead. Will be removed in v2.0.0.
5326
- * @private
5327
- */
5328
- copy() {
5329
- return new _DivRect(this.left, this.anchorX, this.right, this.top, this.anchorY, this.bottom);
5330
- }
5331
- /**
5332
- * Created duplicate of this Rect.
5333
- * @returns - Duplicate.
5334
- */
5335
- clone() {
5336
- return new _DivRect(this.left, this.anchorX, this.right, this.top, this.anchorY, this.bottom);
5337
- }
5338
- /**
5339
- * Move this rect by (dx, dy). Modifies this Rect.
5340
- *
5341
- * @param dx - Offset amount in x-direction.
5342
- * @param dy - Offset amount in y-direction.
5343
- * @returns - This DivRect instance.
5344
- */
5345
- offsetInPlace(dx, dy) {
5346
- this.left += dx;
5347
- this.anchorX += dx;
5348
- this.right += dx;
5349
- this.top += dy;
5350
- this.anchorY += dy;
5351
- this.bottom += dy;
5352
- return this;
5353
- }
5354
- /**
5355
- * Move this rect by (dx, dy). Immutable, returns modified copy.
5356
- *
5357
- * @param dx - Offset amount in x-direction.
5358
- * @param dy - Offset amount in y-direction.
5359
- * @returns - DivRect copy with applied offset.
5360
- */
5361
- offsetCopy(dx, dy) {
5362
- return this.clone().offsetInPlace(dx, dy);
5363
- }
5364
- /**
5365
- * Expand this Rect by given Rect. Modifies this Rect.
5366
- *
5367
- * @param rect - DivRect to expand this instance with.
5368
- * @returns - This DivRect instance.
5369
- */
5370
- expandInPlace(rect) {
5371
- this.left = Math.min(this.left, rect.left);
5372
- this.right = Math.max(this.right, rect.right);
5373
- this.top = Math.min(this.top, rect.top);
5374
- this.bottom = Math.max(this.bottom, rect.bottom);
5375
- return this;
5376
- }
5377
- /**
5378
- * Expand this Rect by given Rect. Immutable, returns modified copy.
5379
- *
5380
- * @param rect - DivRect to expand this instance with.
5381
- * @returns - Expanded copy of this DivRect.
5382
- */
5383
- expandCopy(rect) {
5384
- return this.clone().expandInPlace(rect);
5385
- }
5386
- /**
5387
- * Clip this Rect by given Rect. Mmodifies this Rect.
5388
- *
5389
- * @param clipRect - DivRect to clip this instance with.
5390
- * @returns - This DivRect instance.
5391
- */
5392
- clipInPlace(clipRect) {
5393
- this.left = Math.max(this.left, clipRect.left);
5394
- this.right = Math.min(this.right, clipRect.right);
5395
- this.anchorX = clamp(this.anchorX, this.left, this.right);
5396
- this.top = Math.max(this.top, clipRect.top);
5397
- this.bottom = Math.min(this.bottom, clipRect.bottom);
5398
- this.anchorY = clamp(this.anchorY, this.top, this.bottom);
5399
- return this;
5400
- }
5401
- /**
5402
- * Clip this Rect by given Rect. Immutable, return modified copy.
5403
- *
5404
- * @param clipRect - DivRecto to clip this instance with.
5405
- * @returns - Clipped DivRect copy.
5406
- */
5407
- clipCopy(clipRect) {
5408
- return this.clone().clipInPlace(clipRect);
5409
- }
5410
- /**
5411
- * Scale Rect. Anchor pos is (anchorX, anchorY). Modifies this Rect.
5412
- *
5413
- * @param scaleX - Scale x-amount.
5414
- * @param scaleY - Scale y-amount. If undefined then scale x-amount is used.
5415
- * @returns This DivRect instance.
5416
- */
5417
- scaleInPlace(scaleX, scaleY = scaleX) {
5418
- this.left = this.anchorX - this.leftw * scaleX;
5419
- this.right = this.anchorX + this.rightw * scaleX;
5420
- this.top = this.anchorY - this.toph * scaleY;
5421
- this.bottom = this.anchorY + this.bottomh * scaleY;
5422
- return this;
5423
- }
5424
- /**
5425
- * Scale Rect. Anchor pos is (anchorX, anchorY). Immutable, returns modified copy.
5426
- *
5427
- * @param scaleX - Scale x-amount.
5428
- * @param scaleY - Scale y-amount. If undefined then scale x-amount is used.
5429
- * @returns Scaled copy of this DivRect.
5430
- */
5431
- scaleCopy(scaleX, scaleY = scaleX) {
5432
- return this.clone().scaleInPlace(scaleX, scaleY);
5433
- }
5434
- /**
5435
- * Get this DivRect instance.
5436
- * @returns - This DivRect instance.
5437
- */
5438
- getRect() {
5439
- return this;
5440
- }
5441
- toRect() {
5442
- return new Rect(this.left, this.right, this.width, this.height);
5443
- }
5444
- };
5445
- // Annotate the CommonJS export names for ESM import in node:
5446
- 0 && (module.exports = {
5447
- AnchoredRect,
5448
- Assert,
5449
- BaseContainer,
5450
- BiMap,
5451
- Cookies,
5452
- DeepSet,
5453
- DefaultArray,
5454
- DefaultEqualityFn,
5455
- Device,
5456
- DivRect,
5457
- Guard,
5458
- IndexArray,
5459
- LRUCache,
5460
- LinkedList,
5461
- Map1,
5462
- Map2,
5463
- Map3,
5464
- MultiContainer,
5465
- Rect,
5466
- Set1,
5467
- SetBase,
5468
- SignedIndexArray,
5469
- SmallIntCache,
5470
- Stack,
5471
- TriMap,
5472
- UniMap,
5473
- Utils,
5474
- ValueSet,
5475
- Vec,
5476
- Vec2,
5477
- asMulti
5478
- });
4275
+ exports.AnchoredRect = AnchoredRect;
4276
+ exports.Assert = assert_exports;
4277
+ exports.BaseContainer = BaseContainer;
4278
+ exports.BiMap = BiMap;
4279
+ exports.Cookies = cookies_exports;
4280
+ exports.DefaultArray = DefaultArray;
4281
+ exports.DefaultEqualityFn = DefaultEqualityFn;
4282
+ exports.Device = device_exports;
4283
+ exports.Guard = guard_exports;
4284
+ exports.IndexArray = IndexArray;
4285
+ exports.LRUCache = LRUCache;
4286
+ exports.LinkedList = LinkedList;
4287
+ exports.MultiContainer = MultiContainer;
4288
+ exports.Rect = Rect;
4289
+ exports.SignedIndexArray = SignedIndexArray;
4290
+ exports.Stack = Stack;
4291
+ exports.TriMap = TriMap;
4292
+ exports.UniMap = UniMap;
4293
+ exports.Utils = utils_exports;
4294
+ exports.ValueSet = ValueSet;
4295
+ exports.Vec = Vec;
4296
+ exports.asMulti = asMulti;
4297
+ exports.getLibInfo = getLibInfo;
4298
+ //# sourceMappingURL=index.js.map
5479
4299
  //# sourceMappingURL=index.js.map