@tspro/web-music-score 5.4.2 → 5.5.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/CHANGELOG.md +11 -0
- package/LICENSE +24 -0
- package/README.md +13 -6
- package/dist/audio/index.d.ts +1 -1
- package/dist/audio/index.js +1637 -5
- package/dist/audio/index.mjs +9 -6
- package/dist/audio-cg/index.js +17487 -46
- package/dist/audio-cg/index.mjs +7 -5
- package/dist/audio-synth/index.js +18434 -32
- package/dist/audio-synth/index.mjs +12 -7
- package/dist/{chunk-MMWSQGVR.mjs → chunk-2DCCUAGC.mjs} +3 -3
- package/dist/{chunk-CVYTUTL6.mjs → chunk-2PEB4HWS.mjs} +2 -2
- package/dist/{chunk-42IBAVOC.mjs → chunk-33HIE3HR.mjs} +18 -13
- package/dist/chunk-BMKUAUSJ.mjs +101 -0
- package/dist/chunk-PCQGQM63.mjs +18381 -0
- package/dist/chunk-T6TYLAJE.mjs +3766 -0
- package/dist/core/index.js +2 -2
- package/dist/core/index.mjs +4 -4
- package/dist/{guitar-CNOxM4ZK.d.ts → guitar-CarHGDAt.d.ts} +1 -1
- package/dist/iife/audio-cg.global.js +1 -1
- package/dist/iife/index.global.js +11 -11
- package/dist/{music-objects-DqoO-Sfv.d.mts → music-objects-CcJvZxS6.d.mts} +123 -96
- package/dist/{music-objects-T8u8bnNP.d.ts → music-objects-l5Ai97QA.d.ts} +125 -98
- package/dist/{note-RVXvpfyV.d.ts → note-CJuq5aBy.d.ts} +1 -1
- package/dist/pieces/index.d.mts +12 -6
- package/dist/pieces/index.d.ts +14 -8
- package/dist/pieces/index.js +25 -13
- package/dist/pieces/index.mjs +25 -14
- package/dist/react-ui/index.d.mts +1 -1
- package/dist/react-ui/index.d.ts +5 -5
- package/dist/react-ui/index.js +2163 -22
- package/dist/react-ui/index.mjs +18 -15
- package/dist/{scale-CUYFBo-8.d.ts → scale-DulPFco_.d.ts} +2 -2
- package/dist/score/index.d.mts +51 -3
- package/dist/score/index.d.ts +54 -6
- package/dist/score/index.js +4828 -872
- package/dist/score/index.mjs +1280 -729
- package/dist/{tempo-DwuZsv2T.d.ts → tempo-BnUjm25M.d.ts} +1 -1
- package/dist/theory/index.d.ts +6 -6
- package/dist/theory/index.js +2576 -136
- package/dist/theory/index.mjs +41 -49
- package/package.json +4 -5
- package/dist/chunk-ROBXPR34.mjs +0 -9
package/dist/theory/index.js
CHANGED
|
@@ -1,87 +1,2530 @@
|
|
|
1
|
-
/* WebMusicScore v5.
|
|
1
|
+
/* WebMusicScore v5.5.0 | (c) 2023-2025 PahkaSoft | MIT License | Includes: Tone.js (MIT License), Color Name to Code (MIT License) */
|
|
2
2
|
"use strict";
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __knownSymbol = (name, symbol) => (symbol = Symbol[name]) ? symbol : Symbol.for("Symbol." + name);
|
|
8
|
+
var __typeError = (msg) => {
|
|
9
|
+
throw TypeError(msg);
|
|
10
|
+
};
|
|
7
11
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
12
|
var __export = (target, all) => {
|
|
9
13
|
for (var name in all)
|
|
10
14
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
15
|
};
|
|
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 });
|
|
16
|
+
var __copyProps = (to, from, except, desc) => {
|
|
17
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
18
|
+
for (let key of __getOwnPropNames(from))
|
|
19
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
20
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
21
|
+
}
|
|
22
|
+
return to;
|
|
23
|
+
};
|
|
24
|
+
var __toCommonJS = (mod3) => __copyProps(__defProp({}, "__esModule", { value: true }), mod3);
|
|
25
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
26
|
+
var __await = function(promise, isYieldStar) {
|
|
27
|
+
this[0] = promise;
|
|
28
|
+
this[1] = isYieldStar;
|
|
29
|
+
};
|
|
30
|
+
var __yieldStar = (value) => {
|
|
31
|
+
var obj = value[__knownSymbol("asyncIterator")], isAwait = false, method, it = {};
|
|
32
|
+
if (obj == null) {
|
|
33
|
+
obj = value[__knownSymbol("iterator")]();
|
|
34
|
+
method = (k) => it[k] = (x) => obj[k](x);
|
|
35
|
+
} else {
|
|
36
|
+
obj = obj.call(value);
|
|
37
|
+
method = (k) => it[k] = (v) => {
|
|
38
|
+
if (isAwait) {
|
|
39
|
+
isAwait = false;
|
|
40
|
+
if (k === "throw") throw v;
|
|
41
|
+
return v;
|
|
42
|
+
}
|
|
43
|
+
isAwait = true;
|
|
44
|
+
return {
|
|
45
|
+
done: false,
|
|
46
|
+
value: new __await(new Promise((resolve) => {
|
|
47
|
+
var x = obj[k](v);
|
|
48
|
+
if (!(x instanceof Object)) __typeError("Object expected");
|
|
49
|
+
resolve(x);
|
|
50
|
+
}), 1)
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
return it[__knownSymbol("iterator")] = () => it, method("next"), "throw" in obj ? method("throw") : it.throw = (x) => {
|
|
55
|
+
throw x;
|
|
56
|
+
}, "return" in obj && method("return"), it;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
// src/theory/index.ts
|
|
60
|
+
var theory_exports = {};
|
|
61
|
+
__export(theory_exports, {
|
|
62
|
+
AccidentalType: () => AccidentalType,
|
|
63
|
+
BeamGrouping: () => BeamGrouping,
|
|
64
|
+
Chord: () => Chord,
|
|
65
|
+
DefaultGuitarNoteLabel: () => DefaultGuitarNoteLabel,
|
|
66
|
+
DefaultHandedness: () => DefaultHandedness,
|
|
67
|
+
DefaultPitchNotation: () => DefaultPitchNotation,
|
|
68
|
+
DefaultTuningName: () => DefaultTuningName,
|
|
69
|
+
GuitarNoteLabel: () => GuitarNoteLabel,
|
|
70
|
+
GuitarNoteLabelList: () => GuitarNoteLabelList,
|
|
71
|
+
Handedness: () => Handedness,
|
|
72
|
+
Interval: () => Interval,
|
|
73
|
+
KeySignature: () => KeySignature,
|
|
74
|
+
Mode: () => Mode,
|
|
75
|
+
Note: () => Note,
|
|
76
|
+
NoteLength: () => NoteLength,
|
|
77
|
+
NoteLengthProps: () => NoteLengthProps,
|
|
78
|
+
PitchNotation: () => PitchNotation,
|
|
79
|
+
PitchNotationList: () => PitchNotationList,
|
|
80
|
+
RhythmProps: () => RhythmProps,
|
|
81
|
+
Scale: () => Scale,
|
|
82
|
+
ScaleFactory: () => ScaleFactory,
|
|
83
|
+
ScaleType: () => ScaleType,
|
|
84
|
+
SymbolSet: () => SymbolSet,
|
|
85
|
+
TimeSignature: () => TimeSignature,
|
|
86
|
+
TimeSignatures: () => TimeSignatures,
|
|
87
|
+
TuningNameList: () => TuningNameList,
|
|
88
|
+
Tuplet: () => Tuplet,
|
|
89
|
+
alterTempoSpeed: () => alterTempoSpeed,
|
|
90
|
+
getDefaultKeySignature: () => getDefaultKeySignature,
|
|
91
|
+
getDefaultScale: () => getDefaultScale,
|
|
92
|
+
getDefaultTempo: () => getDefaultTempo,
|
|
93
|
+
getDefaultTimeSignature: () => getDefaultTimeSignature,
|
|
94
|
+
getPitchNotationName: () => getPitchNotationName,
|
|
95
|
+
getScale: () => getScale,
|
|
96
|
+
getScaleFactory: () => getScaleFactory,
|
|
97
|
+
getScaleFactoryList: () => getScaleFactoryList,
|
|
98
|
+
getTempoString: () => getTempoString,
|
|
99
|
+
getTuningStrings: () => getTuningStrings,
|
|
100
|
+
isNoteLength: () => isNoteLength,
|
|
101
|
+
isTupletRatio: () => isTupletRatio,
|
|
102
|
+
validateGuitarNoteLabel: () => validateGuitarNoteLabel,
|
|
103
|
+
validateHandedness: () => validateHandedness,
|
|
104
|
+
validateIntervalQuality: () => validateIntervalQuality,
|
|
105
|
+
validateNoteLength: () => validateNoteLength,
|
|
106
|
+
validatePitchNotation: () => validatePitchNotation,
|
|
107
|
+
validateScaleType: () => validateScaleType,
|
|
108
|
+
validateTuningName: () => validateTuningName,
|
|
109
|
+
validateTupletRatio: () => validateTupletRatio
|
|
110
|
+
});
|
|
111
|
+
module.exports = __toCommonJS(theory_exports);
|
|
112
|
+
|
|
113
|
+
// node_modules/@tspro/ts-utils-lib/dist/index.mjs
|
|
114
|
+
var __defProp2 = Object.defineProperty;
|
|
115
|
+
var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
116
|
+
var __export2 = (target, all) => {
|
|
117
|
+
for (var name in all)
|
|
118
|
+
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
119
|
+
};
|
|
120
|
+
var __publicField2 = (obj, key, value) => __defNormalProp2(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
121
|
+
var assert_exports = {};
|
|
122
|
+
__export2(assert_exports, {
|
|
123
|
+
assert: () => assert,
|
|
124
|
+
doesNotThrow: () => doesNotThrow2,
|
|
125
|
+
doesThrow: () => doesThrow2,
|
|
126
|
+
fail: () => fail,
|
|
127
|
+
isArray: () => isArray2,
|
|
128
|
+
isArrayOrUndefined: () => isArrayOrUndefined2,
|
|
129
|
+
isBigInt: () => isBigInt2,
|
|
130
|
+
isBoolean: () => isBoolean2,
|
|
131
|
+
isBooleanOrUndefined: () => isBooleanOrUndefined2,
|
|
132
|
+
isDeepEqual: () => isDeepEqual2,
|
|
133
|
+
isDefined: () => isDefined2,
|
|
134
|
+
isEmptyArray: () => isEmptyArray2,
|
|
135
|
+
isEmptyArrayOrUndefined: () => isEmptyArrayOrUndefined2,
|
|
136
|
+
isEmptyObject: () => isEmptyObject2,
|
|
137
|
+
isEmptyString: () => isEmptyString2,
|
|
138
|
+
isEmptyStringOrUndefined: () => isEmptyStringOrUndefined2,
|
|
139
|
+
isEnumValue: () => isEnumValue2,
|
|
140
|
+
isEnumValueOrUndefined: () => isEnumValueOrUndefined2,
|
|
141
|
+
isEven: () => isEven2,
|
|
142
|
+
isFalse: () => isFalse2,
|
|
143
|
+
isFalseOrUndefined: () => isFalseOrUndefined2,
|
|
144
|
+
isFinite: () => isFinite3,
|
|
145
|
+
isFloat: () => isFloat2,
|
|
146
|
+
isFunction: () => isFunction2,
|
|
147
|
+
isFunctionOrUndefined: () => isFunctionOrUndefined2,
|
|
148
|
+
isIncluded: () => isIncluded2,
|
|
149
|
+
isIndex: () => isIndex2,
|
|
150
|
+
isInfinity: () => isInfinity2,
|
|
151
|
+
isInteger: () => isInteger2,
|
|
152
|
+
isIntegerBetween: () => isIntegerBetween2,
|
|
153
|
+
isIntegerBetweenExclusive: () => isIntegerBetweenExclusive2,
|
|
154
|
+
isIntegerEq: () => isIntegerEq2,
|
|
155
|
+
isIntegerGt: () => isIntegerGt2,
|
|
156
|
+
isIntegerGte: () => isIntegerGte2,
|
|
157
|
+
isIntegerLt: () => isIntegerLt2,
|
|
158
|
+
isIntegerLte: () => isIntegerLte2,
|
|
159
|
+
isIntegerOrUndefined: () => isIntegerOrUndefined2,
|
|
160
|
+
isMultipleOf: () => isMultipleOf2,
|
|
161
|
+
isNaNValue: () => isNaNValue2,
|
|
162
|
+
isNeg: () => isNeg2,
|
|
163
|
+
isNegInfinity: () => isNegInfinity2,
|
|
164
|
+
isNegZero: () => isNegZero2,
|
|
165
|
+
isNonEmptyArray: () => isNonEmptyArray2,
|
|
166
|
+
isNonEmptyArrayOrUndefined: () => isNonEmptyArrayOrUndefined2,
|
|
167
|
+
isNonEmptyString: () => isNonEmptyString2,
|
|
168
|
+
isNonEmptyStringOrUndefined: () => isNonEmptyStringOrUndefined2,
|
|
169
|
+
isNonNeg: () => isNonNeg2,
|
|
170
|
+
isNonNull: () => isNonNull2,
|
|
171
|
+
isNonPos: () => isNonPos2,
|
|
172
|
+
isNull: () => isNull2,
|
|
173
|
+
isNullish: () => isNullish2,
|
|
174
|
+
isNumber: () => isNumber2,
|
|
175
|
+
isNumberBetween: () => isNumberBetween2,
|
|
176
|
+
isNumberBetweenExclusive: () => isNumberBetweenExclusive2,
|
|
177
|
+
isNumberOrUndefined: () => isNumberOrUndefined2,
|
|
178
|
+
isNumericString: () => isNumericString2,
|
|
179
|
+
isObject: () => isObject2,
|
|
180
|
+
isObjectOrUndefined: () => isObjectOrUndefined2,
|
|
181
|
+
isOdd: () => isOdd2,
|
|
182
|
+
isPlainObject: () => isPlainObject2,
|
|
183
|
+
isPos: () => isPos2,
|
|
184
|
+
isPosInfinity: () => isPosInfinity2,
|
|
185
|
+
isPosZero: () => isPosZero2,
|
|
186
|
+
isPowerOfTwo: () => isPowerOfTwo2,
|
|
187
|
+
isSafeInteger: () => isSafeInteger2,
|
|
188
|
+
isStrictEqual: () => isStrictEqual2,
|
|
189
|
+
isString: () => isString2,
|
|
190
|
+
isStringOrUndefined: () => isStringOrUndefined2,
|
|
191
|
+
isTrue: () => isTrue2,
|
|
192
|
+
isTrueOrUndefined: () => isTrueOrUndefined2,
|
|
193
|
+
isTypedObject: () => isTypedObject2,
|
|
194
|
+
isUndefined: () => isUndefined2,
|
|
195
|
+
isZero: () => isZero2,
|
|
196
|
+
require: () => require2,
|
|
197
|
+
requireDefined: () => requireDefined,
|
|
198
|
+
requireElement: () => requireElement,
|
|
199
|
+
setErrorClass: () => setErrorClass
|
|
200
|
+
});
|
|
201
|
+
var str_exports = {};
|
|
202
|
+
__export2(str_exports, {
|
|
203
|
+
charCount: () => charCount,
|
|
204
|
+
chunkString: () => chunkString,
|
|
205
|
+
insertAt: () => insertAt,
|
|
206
|
+
isString: () => isString,
|
|
207
|
+
makeSentenceFromPascal: () => makeSentenceFromPascal,
|
|
208
|
+
removeAt: () => removeAt,
|
|
209
|
+
repeatString: () => repeatString,
|
|
210
|
+
replaceAt: () => replaceAt,
|
|
211
|
+
stringify: () => stringify,
|
|
212
|
+
toCharArray: () => toCharArray
|
|
213
|
+
});
|
|
214
|
+
var obj_exports = {};
|
|
215
|
+
__export2(obj_exports, {
|
|
216
|
+
deepEqual: () => deepEqual,
|
|
217
|
+
getCtorName: () => getCtorName,
|
|
218
|
+
hasProperties: () => hasProperties,
|
|
219
|
+
isObject: () => isObject
|
|
220
|
+
});
|
|
221
|
+
var guard_exports = {};
|
|
222
|
+
__export2(guard_exports, {
|
|
223
|
+
doesNotThrow: () => doesNotThrow,
|
|
224
|
+
doesThrow: () => doesThrow,
|
|
225
|
+
isArray: () => isArray,
|
|
226
|
+
isArrayOrUndefined: () => isArrayOrUndefined,
|
|
227
|
+
isBigInt: () => isBigInt,
|
|
228
|
+
isBoolean: () => isBoolean,
|
|
229
|
+
isBooleanOrUndefined: () => isBooleanOrUndefined,
|
|
230
|
+
isDeepEqual: () => isDeepEqual,
|
|
231
|
+
isDefined: () => isDefined,
|
|
232
|
+
isEmptyArray: () => isEmptyArray,
|
|
233
|
+
isEmptyArrayOrUndefined: () => isEmptyArrayOrUndefined,
|
|
234
|
+
isEmptyObject: () => isEmptyObject,
|
|
235
|
+
isEmptyString: () => isEmptyString,
|
|
236
|
+
isEmptyStringOrUndefined: () => isEmptyStringOrUndefined,
|
|
237
|
+
isEnumValue: () => isEnumValue,
|
|
238
|
+
isEnumValueOrUndefined: () => isEnumValueOrUndefined,
|
|
239
|
+
isEven: () => isEven,
|
|
240
|
+
isFalse: () => isFalse,
|
|
241
|
+
isFalseOrUndefined: () => isFalseOrUndefined,
|
|
242
|
+
isFinite: () => isFinite2,
|
|
243
|
+
isFloat: () => isFloat,
|
|
244
|
+
isFunction: () => isFunction,
|
|
245
|
+
isFunctionOrUndefined: () => isFunctionOrUndefined,
|
|
246
|
+
isIncluded: () => isIncluded,
|
|
247
|
+
isIndex: () => isIndex,
|
|
248
|
+
isInfinity: () => isInfinity,
|
|
249
|
+
isInteger: () => isInteger,
|
|
250
|
+
isIntegerBetween: () => isIntegerBetween,
|
|
251
|
+
isIntegerBetweenExclusive: () => isIntegerBetweenExclusive,
|
|
252
|
+
isIntegerEq: () => isIntegerEq,
|
|
253
|
+
isIntegerGt: () => isIntegerGt,
|
|
254
|
+
isIntegerGte: () => isIntegerGte,
|
|
255
|
+
isIntegerLt: () => isIntegerLt,
|
|
256
|
+
isIntegerLte: () => isIntegerLte,
|
|
257
|
+
isIntegerOrUndefined: () => isIntegerOrUndefined,
|
|
258
|
+
isMultipleOf: () => isMultipleOf,
|
|
259
|
+
isNaNValue: () => isNaNValue,
|
|
260
|
+
isNeg: () => isNeg,
|
|
261
|
+
isNegInfinity: () => isNegInfinity,
|
|
262
|
+
isNegZero: () => isNegZero,
|
|
263
|
+
isNonEmptyArray: () => isNonEmptyArray,
|
|
264
|
+
isNonEmptyArrayOrUndefined: () => isNonEmptyArrayOrUndefined,
|
|
265
|
+
isNonEmptyString: () => isNonEmptyString,
|
|
266
|
+
isNonEmptyStringOrUndefined: () => isNonEmptyStringOrUndefined,
|
|
267
|
+
isNonNeg: () => isNonNeg,
|
|
268
|
+
isNonNull: () => isNonNull,
|
|
269
|
+
isNonPos: () => isNonPos,
|
|
270
|
+
isNull: () => isNull,
|
|
271
|
+
isNullish: () => isNullish,
|
|
272
|
+
isNumber: () => isNumber,
|
|
273
|
+
isNumberBetween: () => isNumberBetween,
|
|
274
|
+
isNumberBetweenExclusive: () => isNumberBetweenExclusive,
|
|
275
|
+
isNumberOrUndefined: () => isNumberOrUndefined,
|
|
276
|
+
isNumericString: () => isNumericString,
|
|
277
|
+
isObject: () => isObject,
|
|
278
|
+
isObjectOrUndefined: () => isObjectOrUndefined,
|
|
279
|
+
isOdd: () => isOdd,
|
|
280
|
+
isPlainObject: () => isPlainObject,
|
|
281
|
+
isPos: () => isPos,
|
|
282
|
+
isPosInfinity: () => isPosInfinity,
|
|
283
|
+
isPosZero: () => isPosZero,
|
|
284
|
+
isPowerOfTwo: () => isPowerOfTwo,
|
|
285
|
+
isSafeInteger: () => isSafeInteger,
|
|
286
|
+
isStrictEqual: () => isStrictEqual,
|
|
287
|
+
isString: () => isString,
|
|
288
|
+
isStringOrUndefined: () => isStringOrUndefined,
|
|
289
|
+
isTrue: () => isTrue,
|
|
290
|
+
isTrueOrUndefined: () => isTrueOrUndefined,
|
|
291
|
+
isTypedObject: () => isTypedObject,
|
|
292
|
+
isUndefined: () => isUndefined,
|
|
293
|
+
isZero: () => isZero,
|
|
294
|
+
tryOr: () => tryOr
|
|
295
|
+
});
|
|
296
|
+
var enum_exports = {};
|
|
297
|
+
__export2(enum_exports, {
|
|
298
|
+
forEachEnum: () => forEachEnum,
|
|
299
|
+
getEnumEntries: () => getEnumEntries,
|
|
300
|
+
getEnumKey: () => getEnumKey,
|
|
301
|
+
getEnumKeys: () => getEnumKeys,
|
|
302
|
+
getEnumValues: () => getEnumValues
|
|
303
|
+
});
|
|
304
|
+
function getEnumKeys(e) {
|
|
305
|
+
return Object.keys(e).filter((k) => isNaN(Number(k)));
|
|
306
|
+
}
|
|
307
|
+
function getEnumValues(e) {
|
|
308
|
+
return getEnumKeys(e).map((k) => e[k]);
|
|
309
|
+
}
|
|
310
|
+
function getEnumEntries(e) {
|
|
311
|
+
return getEnumKeys(e).map((k) => [k, e[k]]);
|
|
312
|
+
}
|
|
313
|
+
function getEnumKey(e, value) {
|
|
314
|
+
return getEnumKeys(e).find((k) => e[k] === value);
|
|
315
|
+
}
|
|
316
|
+
function forEachEnum(e, callback) {
|
|
317
|
+
for (const [k, v] of getEnumEntries(e)) callback(k, v);
|
|
318
|
+
}
|
|
319
|
+
function isStrictEqual(val1, val2) {
|
|
320
|
+
return val1 === val2;
|
|
321
|
+
}
|
|
322
|
+
function isDeepEqual(val1, val2) {
|
|
323
|
+
return deepEqual(val1, val2);
|
|
324
|
+
}
|
|
325
|
+
function isUndefined(val) {
|
|
326
|
+
return val === void 0;
|
|
327
|
+
}
|
|
328
|
+
function isNull(val) {
|
|
329
|
+
return val === null;
|
|
330
|
+
}
|
|
331
|
+
function isNullish(val) {
|
|
332
|
+
return val === void 0 || val === null;
|
|
333
|
+
}
|
|
334
|
+
function isDefined(val) {
|
|
335
|
+
return val !== void 0;
|
|
336
|
+
}
|
|
337
|
+
function isNonNull(val) {
|
|
338
|
+
return val !== null;
|
|
339
|
+
}
|
|
340
|
+
function isObject(val) {
|
|
341
|
+
return typeof val === "object" && val !== null && !isArray(val);
|
|
342
|
+
}
|
|
343
|
+
function isEmptyObject(val) {
|
|
344
|
+
return isObject(val) && Object.keys(val).length === 0;
|
|
345
|
+
}
|
|
346
|
+
function isObjectOrUndefined(val) {
|
|
347
|
+
return val === void 0 || isObject(val);
|
|
348
|
+
}
|
|
349
|
+
function isPlainObject(val) {
|
|
350
|
+
if (!isObject(val)) return false;
|
|
351
|
+
const proto = Object.getPrototypeOf(val);
|
|
352
|
+
return proto === Object.prototype || proto === null;
|
|
353
|
+
}
|
|
354
|
+
function isTypedObject(val, keys) {
|
|
355
|
+
return isObject(val) && keys.every((k) => k in val);
|
|
356
|
+
}
|
|
357
|
+
function isSet(val) {
|
|
358
|
+
return val instanceof Set;
|
|
359
|
+
}
|
|
360
|
+
function isArray(arr) {
|
|
361
|
+
return !!arr && Object.prototype.toString.call(arr) === "[object Array]";
|
|
362
|
+
}
|
|
363
|
+
function isArrayOrUndefined(arr) {
|
|
364
|
+
return arr === void 0 || isArray(arr);
|
|
365
|
+
}
|
|
366
|
+
function isEmptyArray(arr) {
|
|
367
|
+
return isArray(arr) && arr.length === 0;
|
|
368
|
+
}
|
|
369
|
+
function isNonEmptyArray(arr) {
|
|
370
|
+
return isArray(arr) && arr.length > 0;
|
|
371
|
+
}
|
|
372
|
+
function isEmptyArrayOrUndefined(arr) {
|
|
373
|
+
return isArray(arr) && arr.length === 0 || arr === void 0;
|
|
374
|
+
}
|
|
375
|
+
function isNonEmptyArrayOrUndefined(arr) {
|
|
376
|
+
return isArray(arr) && arr.length > 0 || arr === void 0;
|
|
377
|
+
}
|
|
378
|
+
function isString(val) {
|
|
379
|
+
return typeof val === "string";
|
|
380
|
+
}
|
|
381
|
+
function isEmptyString(val) {
|
|
382
|
+
return typeof val === "string" && val.length === 0;
|
|
383
|
+
}
|
|
384
|
+
function isNonEmptyString(val) {
|
|
385
|
+
return typeof val === "string" && val.length > 0;
|
|
386
|
+
}
|
|
387
|
+
function isStringOrUndefined(val) {
|
|
388
|
+
return val === void 0 || typeof val === "string";
|
|
389
|
+
}
|
|
390
|
+
function isEmptyStringOrUndefined(val) {
|
|
391
|
+
return typeof val === "string" && val.length === 0 || val === void 0;
|
|
392
|
+
}
|
|
393
|
+
function isNonEmptyStringOrUndefined(val) {
|
|
394
|
+
return typeof val === "string" && val.length > 0 || val === void 0;
|
|
395
|
+
}
|
|
396
|
+
function isBoolean(val) {
|
|
397
|
+
return typeof val === "boolean";
|
|
398
|
+
}
|
|
399
|
+
function isBooleanOrUndefined(val) {
|
|
400
|
+
return val === void 0 || typeof val === "boolean";
|
|
401
|
+
}
|
|
402
|
+
function isTrue(val) {
|
|
403
|
+
return val === true;
|
|
404
|
+
}
|
|
405
|
+
function isTrueOrUndefined(val) {
|
|
406
|
+
return val === true || val === void 0;
|
|
407
|
+
}
|
|
408
|
+
function isFalse(val) {
|
|
409
|
+
return val === false;
|
|
410
|
+
}
|
|
411
|
+
function isFalseOrUndefined(val) {
|
|
412
|
+
return val === false || val === void 0;
|
|
413
|
+
}
|
|
414
|
+
function isFunction(val) {
|
|
415
|
+
return typeof val === "function";
|
|
416
|
+
}
|
|
417
|
+
function isFunctionOrUndefined(val) {
|
|
418
|
+
return val === void 0 || typeof val === "function";
|
|
419
|
+
}
|
|
420
|
+
function isEnumValue(val, enumObj) {
|
|
421
|
+
return getEnumValues(enumObj).some((v) => v === val);
|
|
422
|
+
}
|
|
423
|
+
function isEnumValueOrUndefined(val, enumObj) {
|
|
424
|
+
return val === void 0 || getEnumValues(enumObj).some((v) => v === val);
|
|
425
|
+
}
|
|
426
|
+
function isNumericString(val) {
|
|
427
|
+
if (typeof val !== "string" || val.trim() === "") return false;
|
|
428
|
+
const n = +val;
|
|
429
|
+
return Number.isFinite(n);
|
|
430
|
+
}
|
|
431
|
+
function isBigInt(val) {
|
|
432
|
+
return typeof val === "bigint";
|
|
433
|
+
}
|
|
434
|
+
function isNumber(val) {
|
|
435
|
+
return typeof val === "number";
|
|
436
|
+
}
|
|
437
|
+
function isNumberOrUndefined(val) {
|
|
438
|
+
return typeof val === "number" || val === void 0;
|
|
439
|
+
}
|
|
440
|
+
function isFinite2(val) {
|
|
441
|
+
return typeof val === "number" && Number.isFinite(val);
|
|
442
|
+
}
|
|
443
|
+
function isFloat(val) {
|
|
444
|
+
return isFinite2(val) && !isInteger(val);
|
|
445
|
+
}
|
|
446
|
+
function isInteger(val) {
|
|
447
|
+
return typeof val === "number" && isFinite2(val) && val === Math.trunc(val);
|
|
448
|
+
}
|
|
449
|
+
function isSafeInteger(val) {
|
|
450
|
+
return isInteger(val) && Number.isSafeInteger(val);
|
|
451
|
+
}
|
|
452
|
+
function isIntegerOrUndefined(val) {
|
|
453
|
+
return typeof val === "number" && isFinite2(val) && val === Math.trunc(val) || val === void 0;
|
|
454
|
+
}
|
|
455
|
+
function isIntegerEq(val, ref) {
|
|
456
|
+
return isInteger(val) && val === ref;
|
|
457
|
+
}
|
|
458
|
+
function isIntegerGt(val, ref) {
|
|
459
|
+
return isInteger(val) && isNumber(ref) && val > ref;
|
|
460
|
+
}
|
|
461
|
+
function isIntegerGte(val, ref) {
|
|
462
|
+
return isInteger(val) && isNumber(ref) && val >= ref;
|
|
463
|
+
}
|
|
464
|
+
function isIntegerLt(val, ref) {
|
|
465
|
+
return isInteger(val) && isNumber(ref) && val < ref;
|
|
466
|
+
}
|
|
467
|
+
function isIntegerLte(val, ref) {
|
|
468
|
+
return isInteger(val) && isNumber(ref) && val <= ref;
|
|
469
|
+
}
|
|
470
|
+
function isIntegerBetween(val, min, max) {
|
|
471
|
+
return isInteger(val) && isNumber(min) && isNumber(max) && val >= min && val <= max;
|
|
472
|
+
}
|
|
473
|
+
function isIntegerBetweenExclusive(val, min, max) {
|
|
474
|
+
return isInteger(val) && isNumber(min) && isNumber(max) && val > min && val < max;
|
|
475
|
+
}
|
|
476
|
+
function isNumberBetween(val, min, max) {
|
|
477
|
+
return isNumber(val) && isNumber(min) && isNumber(max) && val >= min && val <= max;
|
|
478
|
+
}
|
|
479
|
+
function isNumberBetweenExclusive(val, min, max) {
|
|
480
|
+
return isNumber(val) && isNumber(min) && isNumber(max) && val > min && val < max;
|
|
481
|
+
}
|
|
482
|
+
function isNaNValue(val) {
|
|
483
|
+
return typeof val === "number" && Number.isNaN(val);
|
|
484
|
+
}
|
|
485
|
+
function isInfinity(val) {
|
|
486
|
+
return val === Infinity || val === -Infinity;
|
|
487
|
+
}
|
|
488
|
+
function isPosInfinity(val) {
|
|
489
|
+
return val === Infinity;
|
|
490
|
+
}
|
|
491
|
+
function isNegInfinity(val) {
|
|
492
|
+
return val === -Infinity;
|
|
493
|
+
}
|
|
494
|
+
function isPos(val) {
|
|
495
|
+
return typeof val === "number" && val > 0;
|
|
496
|
+
}
|
|
497
|
+
function isNeg(val) {
|
|
498
|
+
return typeof val === "number" && val < 0;
|
|
499
|
+
}
|
|
500
|
+
function isNonPos(val) {
|
|
501
|
+
return typeof val === "number" && val <= 0;
|
|
502
|
+
}
|
|
503
|
+
function isNonNeg(val) {
|
|
504
|
+
return typeof val === "number" && val >= 0;
|
|
505
|
+
}
|
|
506
|
+
function isZero(val) {
|
|
507
|
+
return typeof val === "number" && val === 0;
|
|
508
|
+
}
|
|
509
|
+
function isPosZero(val) {
|
|
510
|
+
return typeof val === "number" && val === 0 && 1 / val === Infinity;
|
|
511
|
+
}
|
|
512
|
+
function isNegZero(val) {
|
|
513
|
+
return typeof val === "number" && val === 0 && 1 / val === -Infinity;
|
|
514
|
+
}
|
|
515
|
+
function isOdd(val) {
|
|
516
|
+
return isInteger(val) && Math.abs(val) % 2 === 1;
|
|
517
|
+
}
|
|
518
|
+
function isEven(val) {
|
|
519
|
+
return isInteger(val) && val % 2 === 0;
|
|
520
|
+
}
|
|
521
|
+
function isMultipleOf(val, base) {
|
|
522
|
+
return typeof val === "number" && typeof base === "number" && val % base === 0;
|
|
523
|
+
}
|
|
524
|
+
function isPowerOfTwo(val) {
|
|
525
|
+
return isInteger(val) && val > 0 && (val & val - 1) === 0;
|
|
526
|
+
}
|
|
527
|
+
function isIncluded(val, container) {
|
|
528
|
+
if (isArray(container)) {
|
|
529
|
+
return container.includes(val);
|
|
530
|
+
}
|
|
531
|
+
if (isSet(container)) {
|
|
532
|
+
return container.has(val);
|
|
533
|
+
}
|
|
534
|
+
return false;
|
|
535
|
+
}
|
|
536
|
+
function isIndex(index, array) {
|
|
537
|
+
return isArray(array) ? isIntegerBetween(index, 0, array.length - 1) : isIntegerGte(index, 0);
|
|
538
|
+
}
|
|
539
|
+
function doesThrow(throwTestFn) {
|
|
540
|
+
try {
|
|
541
|
+
throwTestFn();
|
|
542
|
+
return false;
|
|
543
|
+
} catch (err) {
|
|
544
|
+
return true;
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
function doesNotThrow(throwTestFn) {
|
|
548
|
+
try {
|
|
549
|
+
throwTestFn();
|
|
550
|
+
return true;
|
|
551
|
+
} catch (err) {
|
|
552
|
+
return false;
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
function tryOr(tryFn, orVal) {
|
|
556
|
+
try {
|
|
557
|
+
return tryFn();
|
|
558
|
+
} catch (err) {
|
|
559
|
+
return isFunction(orVal) ? orVal() : orVal;
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
function hasProperties(obj, props) {
|
|
563
|
+
return isObject(obj) && props.every((p) => p in obj);
|
|
564
|
+
}
|
|
565
|
+
function deepEqual(a, b) {
|
|
566
|
+
if (a === b) return true;
|
|
567
|
+
if (a === null || b === null) return false;
|
|
568
|
+
if (typeof a !== "object" || typeof b !== "object") return false;
|
|
569
|
+
if (Array.isArray(a) && Array.isArray(b)) {
|
|
570
|
+
if (a.length !== b.length) return false;
|
|
571
|
+
return a.every((val, i) => deepEqual(val, b[i]));
|
|
572
|
+
}
|
|
573
|
+
if (Array.isArray(a) !== Array.isArray(b)) return false;
|
|
574
|
+
const keysA = Object.keys(a);
|
|
575
|
+
const keysB = Object.keys(b);
|
|
576
|
+
if (keysA.length !== keysB.length) return false;
|
|
577
|
+
for (const key of keysA) {
|
|
578
|
+
if (!Object.prototype.hasOwnProperty.call(b, key)) return false;
|
|
579
|
+
if (!deepEqual(a[key], b[key])) return false;
|
|
580
|
+
}
|
|
581
|
+
return true;
|
|
582
|
+
}
|
|
583
|
+
function getCtorName(obj) {
|
|
584
|
+
if (obj === null) return "null";
|
|
585
|
+
if (isArray(obj)) return "Array";
|
|
586
|
+
if (typeof obj !== "object") return typeof obj;
|
|
587
|
+
const tag = Object.prototype.toString.call(obj).slice(8, -1);
|
|
588
|
+
return tag || "Object";
|
|
589
|
+
}
|
|
590
|
+
function toCharArray(str2) {
|
|
591
|
+
return str2.split("");
|
|
592
|
+
}
|
|
593
|
+
function repeatString(repeatString2, repeatCount) {
|
|
594
|
+
if (!isInteger(repeatCount) || repeatCount < 0) {
|
|
595
|
+
throw new Error("repeatStr: Invalid repeatCount = " + repeatCount);
|
|
596
|
+
}
|
|
597
|
+
return new Array(repeatCount + 1).join(repeatString2);
|
|
598
|
+
}
|
|
599
|
+
function chunkString(str2, chunkSize) {
|
|
600
|
+
if (!isInteger(chunkSize) || chunkSize < 1) {
|
|
601
|
+
throw new Error("chunckString: Invalid chuckSize = " + chunkSize);
|
|
602
|
+
}
|
|
603
|
+
let result = [];
|
|
604
|
+
for (let i = 0; i < str2.length; i += chunkSize) {
|
|
605
|
+
result.push(str2.slice(i, i + chunkSize));
|
|
606
|
+
}
|
|
607
|
+
return result;
|
|
608
|
+
}
|
|
609
|
+
function replaceAt(str2, pos, removeCount, insert) {
|
|
610
|
+
if (!isInteger(removeCount) || removeCount < 0) {
|
|
611
|
+
throw new Error("replaceAt: Invalid removeCount = " + removeCount);
|
|
612
|
+
} else if (!isInteger(pos) || pos < 0 || pos + removeCount > str2.length) {
|
|
613
|
+
throw new Error("replaceAt: Invalid pos = " + pos + ", removeCount = " + removeCount + ", str.length = " + str2.length);
|
|
614
|
+
} else {
|
|
615
|
+
return str2.substring(0, pos) + insert + str2.substring(pos + removeCount);
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
function insertAt(str2, pos, insertStr) {
|
|
619
|
+
return replaceAt(str2, pos, 0, insertStr);
|
|
620
|
+
}
|
|
621
|
+
function removeAt(str2, pos, removeCount) {
|
|
622
|
+
return replaceAt(str2, pos, removeCount, "");
|
|
623
|
+
}
|
|
624
|
+
function charCount(str2, ch) {
|
|
625
|
+
if (ch.length !== 1 || str2.length === 0) return 0;
|
|
626
|
+
let count = 0;
|
|
627
|
+
for (let i = 0; i < str2.length; i++) {
|
|
628
|
+
if (str2[i] === ch) count++;
|
|
629
|
+
}
|
|
630
|
+
return count;
|
|
631
|
+
}
|
|
632
|
+
function makeSentenceFromPascal(PascalString) {
|
|
633
|
+
if (PascalString === "") {
|
|
634
|
+
return "";
|
|
635
|
+
}
|
|
636
|
+
let word = PascalString.charAt(0);
|
|
637
|
+
let sentence = "";
|
|
638
|
+
const addWord = () => {
|
|
639
|
+
if (word !== "") {
|
|
640
|
+
if (sentence === "") {
|
|
641
|
+
sentence += word.charAt(0).toUpperCase() + word.substring(1);
|
|
642
|
+
} else {
|
|
643
|
+
sentence += " " + word;
|
|
644
|
+
}
|
|
645
|
+
word = "";
|
|
646
|
+
}
|
|
647
|
+
};
|
|
648
|
+
const isLetterAndCapital = (c) => {
|
|
649
|
+
return c.toUpperCase() !== c.toLowerCase() && c === c.toUpperCase();
|
|
650
|
+
};
|
|
651
|
+
for (let i = 1; i < PascalString.length; i++) {
|
|
652
|
+
let c = PascalString.charAt(i);
|
|
653
|
+
if (isLetterAndCapital(c)) {
|
|
654
|
+
addWord();
|
|
655
|
+
}
|
|
656
|
+
word += c.toLowerCase();
|
|
657
|
+
}
|
|
658
|
+
addWord();
|
|
659
|
+
return sentence;
|
|
660
|
+
}
|
|
661
|
+
function stringify(value, maxDepth = 5, seen = /* @__PURE__ */ new WeakSet()) {
|
|
662
|
+
if (value === null) return "null";
|
|
663
|
+
if (value === void 0) return "undefined";
|
|
664
|
+
const t = typeof value;
|
|
665
|
+
switch (t) {
|
|
666
|
+
case "boolean":
|
|
667
|
+
return value ? "true" : "false";
|
|
668
|
+
case "number":
|
|
669
|
+
if (isNaNValue(value)) return "NaN";
|
|
670
|
+
if (!isFinite2(value))
|
|
671
|
+
return value < 0 ? "-Infinity" : "Infinity";
|
|
672
|
+
return value.toString();
|
|
673
|
+
case "bigint":
|
|
674
|
+
return `${value}n`;
|
|
675
|
+
case "string":
|
|
676
|
+
return `"${value}"`;
|
|
677
|
+
case "symbol":
|
|
678
|
+
return value.description ? `Symbol(${value.description})` : "Symbol()";
|
|
679
|
+
case "function":
|
|
680
|
+
return `[Function${value.name ? ` ${value.name}` : ""}]`;
|
|
681
|
+
}
|
|
682
|
+
if (seen.has(value))
|
|
683
|
+
return "[Circular]";
|
|
684
|
+
if (maxDepth <= 0)
|
|
685
|
+
return "[Depth limit]";
|
|
686
|
+
maxDepth--;
|
|
687
|
+
seen.add(value);
|
|
688
|
+
const strfy = (v) => stringify(v, maxDepth, seen);
|
|
689
|
+
if (isArray(value)) {
|
|
690
|
+
const inner = value.map((v) => strfy(v)).join(", ");
|
|
691
|
+
return inner.length === 0 ? "[ ]" : `[ ${inner} ]`;
|
|
692
|
+
}
|
|
693
|
+
if (ArrayBuffer.isView(value)) {
|
|
694
|
+
if (value instanceof DataView)
|
|
695
|
+
return `DataView(${value.byteLength})`;
|
|
696
|
+
const inner = Array.from(value).map((v) => strfy(v)).join(", ");
|
|
697
|
+
return `${value.constructor.name}[ ${inner} ]`;
|
|
698
|
+
}
|
|
699
|
+
if (value instanceof ArrayBuffer)
|
|
700
|
+
return `ArrayBuffer(${value.byteLength})`;
|
|
701
|
+
if (value instanceof Map) {
|
|
702
|
+
const entries = Array.from(value.entries()).map(([k, v]) => `${strfy(k)} => ${strfy(v)}`).join(", ");
|
|
703
|
+
return entries.length === 0 ? `Map(${value.size}){ }` : `Map(${value.size}){ ${entries} }`;
|
|
704
|
+
}
|
|
705
|
+
if (value instanceof Set) {
|
|
706
|
+
const entries = Array.from(value.values()).map((v) => strfy(v)).join(", ");
|
|
707
|
+
return entries.length === 0 ? `Set(${value.size}){ }` : `Set(${value.size}){ ${entries} }`;
|
|
708
|
+
}
|
|
709
|
+
if (value instanceof WeakMap)
|
|
710
|
+
return "WeakMap{ ? }";
|
|
711
|
+
if (value instanceof WeakSet)
|
|
712
|
+
return "WeakSet{ ? }";
|
|
713
|
+
if (value instanceof Date)
|
|
714
|
+
return `Date("${value.toISOString()}")`;
|
|
715
|
+
if (value instanceof RegExp)
|
|
716
|
+
return value.toString();
|
|
717
|
+
if (value instanceof Error)
|
|
718
|
+
return `${value.name}("${value.message}")`;
|
|
719
|
+
if (value instanceof Promise)
|
|
720
|
+
return "Promise{ ? }";
|
|
721
|
+
if (value instanceof URL)
|
|
722
|
+
return `URL("${value.href}")`;
|
|
723
|
+
if (value instanceof URLSearchParams)
|
|
724
|
+
return `URLSearchParams("${value.toString()}")`;
|
|
725
|
+
if (value === Math) return "Math";
|
|
726
|
+
if (value === JSON) return "JSON";
|
|
727
|
+
if (value === Reflect) return "Reflect";
|
|
728
|
+
if (value === Intl) return "Intl";
|
|
729
|
+
const hasCustomToString = typeof (value == null ? void 0 : value.toString) === "function" && value.toString !== Object.prototype.toString;
|
|
730
|
+
if (hasCustomToString) {
|
|
731
|
+
try {
|
|
732
|
+
const str2 = value.toString();
|
|
733
|
+
if (!/^\[object .+\]$/.test(str2)) return str2;
|
|
734
|
+
} catch (e) {
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
if (t === "object") {
|
|
738
|
+
const ctorName = getCtorName(value);
|
|
739
|
+
const entries = Object.entries(value).map(
|
|
740
|
+
([key, val]) => `${strfy(key)}: ${strfy(val)}`
|
|
741
|
+
);
|
|
742
|
+
if (entries.length === 0) return `${ctorName}{ }`;
|
|
743
|
+
return `${ctorName}{ ${entries.join(", ")} }`;
|
|
744
|
+
}
|
|
745
|
+
return String(value);
|
|
746
|
+
}
|
|
747
|
+
var fmt = stringify;
|
|
748
|
+
var errorConstructor = Error;
|
|
749
|
+
function setErrorClass(errorClass) {
|
|
750
|
+
errorConstructor = errorClass != null ? errorClass : Error;
|
|
751
|
+
}
|
|
752
|
+
function _fail(...msgs) {
|
|
753
|
+
let msg = msgs.join(", ");
|
|
754
|
+
throw new errorConstructor("Assertion Failed!" + (msg === "" ? "" : " " + msg));
|
|
755
|
+
}
|
|
756
|
+
function assert(condition, msg) {
|
|
757
|
+
if (!condition) {
|
|
758
|
+
_fail(msg);
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
function require2(val, msg) {
|
|
762
|
+
if (val == null) {
|
|
763
|
+
_fail(`Expected ${fmt(val)} not to be nullish`, msg);
|
|
764
|
+
}
|
|
765
|
+
return val;
|
|
766
|
+
}
|
|
767
|
+
function requireDefined(val, msg) {
|
|
768
|
+
if (val === void 0) {
|
|
769
|
+
_fail(`Expected ${fmt(val)} not to be undefined`, msg);
|
|
770
|
+
}
|
|
771
|
+
return val;
|
|
772
|
+
}
|
|
773
|
+
function requireElement(index, array, msg) {
|
|
774
|
+
if (!guard_exports.isIndex(index, array))
|
|
775
|
+
_fail(`Expected ${index} to be index for array ${fmt(array)}`, msg);
|
|
776
|
+
return array[index];
|
|
777
|
+
}
|
|
778
|
+
function fail(msg) {
|
|
779
|
+
_fail(msg);
|
|
780
|
+
}
|
|
781
|
+
function isStrictEqual2(val1, val2, msg) {
|
|
782
|
+
if (!guard_exports.isStrictEqual(val1, val2))
|
|
783
|
+
_fail(`Expected ${fmt(val1)} to ne strict equal to ${val2}`, msg);
|
|
784
|
+
return val1;
|
|
785
|
+
}
|
|
786
|
+
function isDeepEqual2(val1, val2, msg) {
|
|
787
|
+
if (!guard_exports.isDeepEqual(val1, val2))
|
|
788
|
+
_fail(`Expected ${fmt(val1)} to deep equal with ${fmt(val2)}`, msg);
|
|
789
|
+
return val1;
|
|
790
|
+
}
|
|
791
|
+
function isUndefined2(val, msg) {
|
|
792
|
+
if (!guard_exports.isUndefined(val))
|
|
793
|
+
_fail(`Expected ${fmt(val)} to be undefined`, msg);
|
|
794
|
+
return val;
|
|
795
|
+
}
|
|
796
|
+
function isNull2(val, msg) {
|
|
797
|
+
if (!guard_exports.isNull(val))
|
|
798
|
+
_fail(`Expected ${fmt(val)} to be null`, msg);
|
|
799
|
+
return val;
|
|
800
|
+
}
|
|
801
|
+
function isNullish2(val, msg) {
|
|
802
|
+
if (!guard_exports.isNullish(val))
|
|
803
|
+
_fail(`Expected ${fmt(val)} to be null or undefined`, msg);
|
|
804
|
+
return val;
|
|
805
|
+
}
|
|
806
|
+
function isDefined2(val, msg) {
|
|
807
|
+
if (!guard_exports.isDefined(val)) {
|
|
808
|
+
_fail(`Expected ${fmt(val)} to be defined`, msg);
|
|
809
|
+
}
|
|
810
|
+
return val;
|
|
811
|
+
}
|
|
812
|
+
function isNonNull2(val, msg) {
|
|
813
|
+
if (!guard_exports.isNonNull(val)) {
|
|
814
|
+
_fail(`Expected ${fmt(val)} to be defined`, msg);
|
|
815
|
+
}
|
|
816
|
+
return val;
|
|
817
|
+
}
|
|
818
|
+
function isObject2(val, msg) {
|
|
819
|
+
if (!guard_exports.isObject(val))
|
|
820
|
+
_fail(`Expected ${fmt(val)} to be object`, msg);
|
|
821
|
+
return val;
|
|
822
|
+
}
|
|
823
|
+
function isEmptyObject2(val, msg) {
|
|
824
|
+
if (!guard_exports.isEmptyObject(val))
|
|
825
|
+
_fail(`Expected ${fmt(val)} to be empty object`, msg);
|
|
826
|
+
return val;
|
|
827
|
+
}
|
|
828
|
+
function isPlainObject2(val, msg) {
|
|
829
|
+
if (!guard_exports.isPlainObject(val))
|
|
830
|
+
_fail(`Expected ${fmt(val)} to be plain object`, msg);
|
|
831
|
+
return val;
|
|
832
|
+
}
|
|
833
|
+
function isObjectOrUndefined2(val, msg) {
|
|
834
|
+
if (!guard_exports.isObjectOrUndefined(val))
|
|
835
|
+
_fail(`Expected ${fmt(val)} to be object or undefined`, msg);
|
|
836
|
+
return val;
|
|
837
|
+
}
|
|
838
|
+
function isTypedObject2(val, keys, msg) {
|
|
839
|
+
if (!guard_exports.isTypedObject(val, keys))
|
|
840
|
+
_fail(`Expected ${fmt(val)} to have keys ${fmt(keys)}`, msg);
|
|
841
|
+
return val;
|
|
842
|
+
}
|
|
843
|
+
function isArray2(val, msg) {
|
|
844
|
+
if (!guard_exports.isArray(val))
|
|
845
|
+
_fail(`Expected ${fmt(val)} to be array`, msg);
|
|
846
|
+
return val;
|
|
847
|
+
}
|
|
848
|
+
function isArrayOrUndefined2(val, msg) {
|
|
849
|
+
if (!guard_exports.isArrayOrUndefined(val))
|
|
850
|
+
_fail(`Expected ${fmt(val)} to be array or undefined`, msg);
|
|
851
|
+
return true;
|
|
852
|
+
}
|
|
853
|
+
function isEmptyArray2(val, msg) {
|
|
854
|
+
if (!guard_exports.isEmptyArray(val))
|
|
855
|
+
_fail(`Expected ${fmt(val)} to be empty array`, msg);
|
|
856
|
+
}
|
|
857
|
+
function isNonEmptyArray2(val, msg) {
|
|
858
|
+
if (!guard_exports.isNonEmptyArray(val))
|
|
859
|
+
_fail(`Expected ${fmt(val)} to be non-empty array`, msg);
|
|
860
|
+
}
|
|
861
|
+
function isEmptyArrayOrUndefined2(val, msg) {
|
|
862
|
+
if (!guard_exports.isEmptyArrayOrUndefined(val))
|
|
863
|
+
_fail(`Expected ${fmt(val)} to be empty array or undefined`, msg);
|
|
864
|
+
}
|
|
865
|
+
function isNonEmptyArrayOrUndefined2(val, msg) {
|
|
866
|
+
if (!guard_exports.isNonEmptyArrayOrUndefined(val))
|
|
867
|
+
_fail(`Expected ${fmt(val)} to be non-empty array or undefined`, msg);
|
|
868
|
+
}
|
|
869
|
+
function isString2(val, msg) {
|
|
870
|
+
if (!guard_exports.isString(val))
|
|
871
|
+
_fail(`Expected ${fmt(val)} to be string`, msg);
|
|
872
|
+
return val;
|
|
873
|
+
}
|
|
874
|
+
function isEmptyString2(val, msg) {
|
|
875
|
+
if (!guard_exports.isEmptyString(val))
|
|
876
|
+
_fail(`Expected ${fmt(val)} to be empty string`, msg);
|
|
877
|
+
return val;
|
|
878
|
+
}
|
|
879
|
+
function isNonEmptyString2(val, msg) {
|
|
880
|
+
if (!guard_exports.isNonEmptyString(val))
|
|
881
|
+
_fail(`Expected ${fmt(val)} to be non-empty string`, msg);
|
|
882
|
+
return val;
|
|
883
|
+
}
|
|
884
|
+
function isStringOrUndefined2(val, msg) {
|
|
885
|
+
if (!guard_exports.isStringOrUndefined(val))
|
|
886
|
+
_fail(`Expected ${fmt(val)} to be string or undefined`, msg);
|
|
887
|
+
return val;
|
|
888
|
+
}
|
|
889
|
+
function isEmptyStringOrUndefined2(val, msg) {
|
|
890
|
+
if (!guard_exports.isEmptyStringOrUndefined(val))
|
|
891
|
+
_fail(`Expected ${fmt(val)} to be empty string or undefined`, msg);
|
|
892
|
+
return val;
|
|
893
|
+
}
|
|
894
|
+
function isNonEmptyStringOrUndefined2(val, msg) {
|
|
895
|
+
if (!guard_exports.isNonEmptyStringOrUndefined(val))
|
|
896
|
+
_fail(`Expected ${fmt(val)} to be non-empty string or undefined`, msg);
|
|
897
|
+
return val;
|
|
898
|
+
}
|
|
899
|
+
function isBoolean2(val, msg) {
|
|
900
|
+
if (!guard_exports.isBoolean(val))
|
|
901
|
+
_fail(`Expected ${fmt(val)} to be boolean`, msg);
|
|
902
|
+
return val;
|
|
903
|
+
}
|
|
904
|
+
function isBooleanOrUndefined2(val, msg) {
|
|
905
|
+
if (!guard_exports.isBooleanOrUndefined(val))
|
|
906
|
+
_fail(`Expected ${fmt(val)} to be boolean or undefined`, msg);
|
|
907
|
+
return val;
|
|
908
|
+
}
|
|
909
|
+
function isTrue2(val, msg) {
|
|
910
|
+
if (!guard_exports.isTrue(val))
|
|
911
|
+
_fail(`Expected ${fmt(val)} to be true`, msg);
|
|
912
|
+
return val;
|
|
913
|
+
}
|
|
914
|
+
function isTrueOrUndefined2(val, msg) {
|
|
915
|
+
if (!guard_exports.isTrueOrUndefined(val))
|
|
916
|
+
_fail(`Expected ${fmt(val)} to be true or undefined`, msg);
|
|
917
|
+
return val;
|
|
918
|
+
}
|
|
919
|
+
function isFalse2(val, msg) {
|
|
920
|
+
if (!guard_exports.isFalse(val))
|
|
921
|
+
_fail(`Expected ${fmt(val)} to be false`, msg);
|
|
922
|
+
return val;
|
|
923
|
+
}
|
|
924
|
+
function isFalseOrUndefined2(val, msg) {
|
|
925
|
+
if (!guard_exports.isFalseOrUndefined(val))
|
|
926
|
+
_fail(`Expected ${fmt(val)} to be false or undefined`, msg);
|
|
927
|
+
return val;
|
|
928
|
+
}
|
|
929
|
+
function isFunction2(val, msg) {
|
|
930
|
+
if (!guard_exports.isFunction(val))
|
|
931
|
+
_fail(`Expected ${fmt(val)} to be function`, msg);
|
|
932
|
+
return val;
|
|
933
|
+
}
|
|
934
|
+
function isFunctionOrUndefined2(val, msg) {
|
|
935
|
+
if (!guard_exports.isFunctionOrUndefined(val))
|
|
936
|
+
_fail(`Expected ${fmt(val)} to be function or undefined`, msg);
|
|
937
|
+
return val;
|
|
938
|
+
}
|
|
939
|
+
function isEnumValue2(val, enumObject, msg) {
|
|
940
|
+
if (!guard_exports.isEnumValue(val, enumObject))
|
|
941
|
+
_fail(`Expected ${fmt(val)} to be enum val`, msg);
|
|
942
|
+
return val;
|
|
943
|
+
}
|
|
944
|
+
function isEnumValueOrUndefined2(val, enumObject, msg) {
|
|
945
|
+
if (!guard_exports.isEnumValueOrUndefined(val, enumObject))
|
|
946
|
+
_fail(`Expected ${fmt(val)} to be enum val or undefined`, msg);
|
|
947
|
+
return val;
|
|
948
|
+
}
|
|
949
|
+
function isNumericString2(val, msg) {
|
|
950
|
+
if (!guard_exports.isNumericString(val))
|
|
951
|
+
_fail(`Expected ${fmt(val)} to be numeric string`, msg);
|
|
952
|
+
return val;
|
|
953
|
+
}
|
|
954
|
+
function isBigInt2(val, msg) {
|
|
955
|
+
if (!guard_exports.isBigInt(val))
|
|
956
|
+
_fail(`Expected ${fmt(val)} to be BigInt`, msg);
|
|
957
|
+
return val;
|
|
958
|
+
}
|
|
959
|
+
function isNumber2(val, msg) {
|
|
960
|
+
if (!guard_exports.isNumber(val))
|
|
961
|
+
_fail(`Expected ${fmt(val)} to be number`, msg);
|
|
962
|
+
return val;
|
|
963
|
+
}
|
|
964
|
+
function isNumberOrUndefined2(val, msg) {
|
|
965
|
+
if (!guard_exports.isNumberOrUndefined(val))
|
|
966
|
+
_fail(`Expected ${fmt(val)} to be number or undefined`, msg);
|
|
967
|
+
return val;
|
|
968
|
+
}
|
|
969
|
+
function isFinite3(val, msg) {
|
|
970
|
+
if (!guard_exports.isFinite(val))
|
|
971
|
+
_fail(`Expected ${fmt(val)} to be finite`, msg);
|
|
972
|
+
return val;
|
|
973
|
+
}
|
|
974
|
+
function isFloat2(val, msg) {
|
|
975
|
+
if (!guard_exports.isFloat(val))
|
|
976
|
+
_fail(`Expected ${fmt(val)} to be float`, msg);
|
|
977
|
+
return val;
|
|
978
|
+
}
|
|
979
|
+
function isInteger2(val, msg) {
|
|
980
|
+
if (!guard_exports.isInteger(val))
|
|
981
|
+
_fail(`Expected ${fmt(val)} to be integer`, msg);
|
|
982
|
+
return val;
|
|
983
|
+
}
|
|
984
|
+
function isSafeInteger2(val, msg) {
|
|
985
|
+
if (!guard_exports.isSafeInteger(val))
|
|
986
|
+
_fail(`Expected ${fmt(val)} to be safe integer`, msg);
|
|
987
|
+
return val;
|
|
988
|
+
}
|
|
989
|
+
function isIntegerOrUndefined2(val, msg) {
|
|
990
|
+
if (!guard_exports.isIntegerOrUndefined(val))
|
|
991
|
+
_fail(`Expected ${fmt(val)} to be integer or undefined`, msg);
|
|
992
|
+
return val;
|
|
993
|
+
}
|
|
994
|
+
function isIntegerEq2(val, ref, msg) {
|
|
995
|
+
if (!guard_exports.isIntegerEq(val, ref))
|
|
996
|
+
_fail(`Expected ${fmt(val)} to be integer equal to ${fmt(ref)}`, msg);
|
|
997
|
+
return val;
|
|
998
|
+
}
|
|
999
|
+
function isIntegerGt2(val, ref, msg) {
|
|
1000
|
+
if (!guard_exports.isIntegerGt(val, ref))
|
|
1001
|
+
_fail(`Expected ${fmt(val)} to be integer > ${fmt(ref)}`, msg);
|
|
1002
|
+
return val;
|
|
1003
|
+
}
|
|
1004
|
+
function isIntegerGte2(val, ref, msg) {
|
|
1005
|
+
if (!guard_exports.isIntegerGte(val, ref))
|
|
1006
|
+
_fail(`Expected ${fmt(val)} to be integer >= ${fmt(ref)}`, msg);
|
|
1007
|
+
return val;
|
|
1008
|
+
}
|
|
1009
|
+
function isIntegerLt2(val, ref, msg) {
|
|
1010
|
+
if (!guard_exports.isIntegerLt(val, ref))
|
|
1011
|
+
_fail(`Expected ${fmt(val)} to be integer < ${fmt(ref)}`, msg);
|
|
1012
|
+
return val;
|
|
1013
|
+
}
|
|
1014
|
+
function isIntegerLte2(val, ref, msg) {
|
|
1015
|
+
if (!guard_exports.isIntegerLte(val, ref))
|
|
1016
|
+
_fail(`Expected ${fmt(val)} to be integer <= ${fmt(ref)}`, msg);
|
|
1017
|
+
return val;
|
|
1018
|
+
}
|
|
1019
|
+
function isIntegerBetween2(val, min, max, msg) {
|
|
1020
|
+
if (!guard_exports.isIntegerBetween(val, min, max))
|
|
1021
|
+
_fail(`Expected integer ${fmt(min)} <= ${fmt(val)} <= ${fmt(max)}`, msg);
|
|
1022
|
+
return val;
|
|
1023
|
+
}
|
|
1024
|
+
function isIntegerBetweenExclusive2(val, min, max, msg) {
|
|
1025
|
+
if (!guard_exports.isIntegerBetweenExclusive(val, min, max))
|
|
1026
|
+
_fail(`Expected integer ${fmt(min)} < ${fmt(val)} < ${fmt(max)}`, msg);
|
|
1027
|
+
return val;
|
|
1028
|
+
}
|
|
1029
|
+
function isNumberBetween2(val, min, max, msg) {
|
|
1030
|
+
if (!guard_exports.isNumberBetween(val, min, max))
|
|
1031
|
+
_fail(`Expected number ${fmt(min)} <= ${fmt(val)} <= ${fmt(max)}`, msg);
|
|
1032
|
+
return val;
|
|
1033
|
+
}
|
|
1034
|
+
function isNumberBetweenExclusive2(val, min, max, msg) {
|
|
1035
|
+
if (!guard_exports.isNumberBetweenExclusive(val, min, max))
|
|
1036
|
+
_fail(`Expected number ${fmt(min)} < ${fmt(val)} < ${fmt(max)}`, msg);
|
|
1037
|
+
return val;
|
|
1038
|
+
}
|
|
1039
|
+
function isNaNValue2(val, msg) {
|
|
1040
|
+
if (!guard_exports.isNaNValue(val))
|
|
1041
|
+
_fail(`Expected ${fmt(val)} to be NaN`, msg);
|
|
1042
|
+
return NaN;
|
|
1043
|
+
}
|
|
1044
|
+
function isInfinity2(val, msg) {
|
|
1045
|
+
if (!guard_exports.isInfinity(val))
|
|
1046
|
+
_fail(`Expected ${fmt(val)} to be +-Infinity`, msg);
|
|
1047
|
+
return val;
|
|
1048
|
+
}
|
|
1049
|
+
function isPosInfinity2(val, msg) {
|
|
1050
|
+
if (!guard_exports.isPosInfinity(val))
|
|
1051
|
+
_fail(`Expected ${fmt(val)} to be +Infinity`, msg);
|
|
1052
|
+
return val;
|
|
1053
|
+
}
|
|
1054
|
+
function isNegInfinity2(val, msg) {
|
|
1055
|
+
if (!guard_exports.isNegInfinity(val))
|
|
1056
|
+
_fail(`Expected ${fmt(val)} to be -Infinity`, msg);
|
|
1057
|
+
return val;
|
|
1058
|
+
}
|
|
1059
|
+
function isPos2(val, msg) {
|
|
1060
|
+
if (!guard_exports.isPos(val))
|
|
1061
|
+
_fail(`Expected ${fmt(val)} to be positive (> 0)`, msg);
|
|
1062
|
+
return val;
|
|
1063
|
+
}
|
|
1064
|
+
function isNeg2(val, msg) {
|
|
1065
|
+
if (!guard_exports.isNeg(val))
|
|
1066
|
+
_fail(`Expected ${fmt(val)} to be negative (< 0)`, msg);
|
|
1067
|
+
return val;
|
|
1068
|
+
}
|
|
1069
|
+
function isNonPos2(val, msg) {
|
|
1070
|
+
if (!guard_exports.isNonPos(val))
|
|
1071
|
+
_fail(`Expected ${fmt(val)} to be non-positive (<= 0)`, msg);
|
|
1072
|
+
return val;
|
|
1073
|
+
}
|
|
1074
|
+
function isNonNeg2(val, msg) {
|
|
1075
|
+
if (!guard_exports.isNonNeg(val))
|
|
1076
|
+
_fail(`Expected ${fmt(val)} to be non-negative (>= 0)`, msg);
|
|
1077
|
+
return val;
|
|
1078
|
+
}
|
|
1079
|
+
function isZero2(val, msg) {
|
|
1080
|
+
if (!guard_exports.isZero(val))
|
|
1081
|
+
_fail(`Expected ${fmt(val)} to be 0`, msg);
|
|
1082
|
+
return val;
|
|
1083
|
+
}
|
|
1084
|
+
function isPosZero2(val, msg) {
|
|
1085
|
+
if (!guard_exports.isPosZero(val))
|
|
1086
|
+
_fail(`Expected ${fmt(val)} to be +0`, msg);
|
|
1087
|
+
return val;
|
|
1088
|
+
}
|
|
1089
|
+
function isNegZero2(val, msg) {
|
|
1090
|
+
if (!guard_exports.isNegZero(val))
|
|
1091
|
+
_fail(`Expected ${fmt(val)} to be -0`, msg);
|
|
1092
|
+
return val;
|
|
1093
|
+
}
|
|
1094
|
+
function isOdd2(val, msg) {
|
|
1095
|
+
if (!guard_exports.isOdd(val))
|
|
1096
|
+
_fail(`Expected ${fmt(val)} to odd`, msg);
|
|
1097
|
+
return val;
|
|
1098
|
+
}
|
|
1099
|
+
function isEven2(val, msg) {
|
|
1100
|
+
if (!guard_exports.isEven(val))
|
|
1101
|
+
_fail(`Expected ${fmt(val)} to even`, msg);
|
|
1102
|
+
return val;
|
|
1103
|
+
}
|
|
1104
|
+
function isMultipleOf2(val, base, msg) {
|
|
1105
|
+
if (!guard_exports.isMultipleOf(val, base))
|
|
1106
|
+
_fail(`Expected ${fmt(val)} to be divisble bu ${fmt(base)}`, msg);
|
|
1107
|
+
return val;
|
|
1108
|
+
}
|
|
1109
|
+
function isPowerOfTwo2(val, msg) {
|
|
1110
|
+
if (!guard_exports.isPowerOfTwo(val))
|
|
1111
|
+
_fail(`Expected ${fmt(val)} to be power of two`, msg);
|
|
1112
|
+
return val;
|
|
1113
|
+
}
|
|
1114
|
+
function isIncluded2(val, arr, msg) {
|
|
1115
|
+
if (!guard_exports.isIncluded(val, arr))
|
|
1116
|
+
_fail(`Expected ${fmt(val)} to be included in ${fmt(arr)}`, msg);
|
|
1117
|
+
return val;
|
|
1118
|
+
}
|
|
1119
|
+
function isIndex2(...args) {
|
|
1120
|
+
const index = args.shift();
|
|
1121
|
+
const msg = guard_exports.isString(args[args.length - 1]) ? args.pop() : void 0;
|
|
1122
|
+
const arr = guard_exports.isArray(args[0]) ? args.shift() : void 0;
|
|
1123
|
+
if (!guard_exports.isIndex(index, arr)) {
|
|
1124
|
+
if (arr === void 0)
|
|
1125
|
+
_fail(`Expected ${index} to be index`, msg);
|
|
1126
|
+
else
|
|
1127
|
+
_fail(`Expected ${index} to be index for ${fmt(arr)}`, msg);
|
|
1128
|
+
}
|
|
1129
|
+
return index;
|
|
1130
|
+
}
|
|
1131
|
+
function doesThrow2(throwTestFn, msg) {
|
|
1132
|
+
if (!guard_exports.doesThrow(throwTestFn))
|
|
1133
|
+
_fail(`Expected to throw`, msg);
|
|
1134
|
+
return true;
|
|
1135
|
+
}
|
|
1136
|
+
function doesNotThrow2(throwTestFn, msg) {
|
|
1137
|
+
if (!guard_exports.doesNotThrow(throwTestFn))
|
|
1138
|
+
_fail(`Expected to throw`, msg);
|
|
1139
|
+
return true;
|
|
1140
|
+
}
|
|
1141
|
+
var cookies_exports = {};
|
|
1142
|
+
__export2(cookies_exports, {
|
|
1143
|
+
accept: () => accept,
|
|
1144
|
+
decline: () => decline,
|
|
1145
|
+
erase: () => erase,
|
|
1146
|
+
eraseAll: () => eraseAll,
|
|
1147
|
+
isConsentPending: () => isConsentPending,
|
|
1148
|
+
read: () => read,
|
|
1149
|
+
readBool: () => readBool,
|
|
1150
|
+
readInt: () => readInt,
|
|
1151
|
+
save: () => save,
|
|
1152
|
+
setExpireDays: () => setExpireDays
|
|
1153
|
+
});
|
|
1154
|
+
var ConsentCookieName = "ConsentCookie";
|
|
1155
|
+
var _consent;
|
|
1156
|
+
var _expires;
|
|
1157
|
+
var str = _read(ConsentCookieName);
|
|
1158
|
+
_consent = str === "accept" || str === "decline" ? str : void 0;
|
|
1159
|
+
function _getList() {
|
|
1160
|
+
let s = document.cookie;
|
|
1161
|
+
return s.split(";").map((c) => c.trim());
|
|
1162
|
+
}
|
|
1163
|
+
function _save(name, value) {
|
|
1164
|
+
let cookie = name + "=" + value.toString() + ";sameSite=Lax;";
|
|
1165
|
+
if (_expires) {
|
|
1166
|
+
cookie += "expires=" + _expires.toUTCString() + ";";
|
|
1167
|
+
}
|
|
1168
|
+
document.cookie = cookie;
|
|
1169
|
+
return value;
|
|
1170
|
+
}
|
|
1171
|
+
function _read(name, defaultValue) {
|
|
1172
|
+
let str2 = _getList().find((c) => c.startsWith(name + "="));
|
|
1173
|
+
return str2 === void 0 ? defaultValue : str2.substring(name.length + 1);
|
|
1174
|
+
}
|
|
1175
|
+
function _erase(name) {
|
|
1176
|
+
document.cookie = name + "=;expires=Thu, 01 Jan 1970 00:00:00 UTC;";
|
|
1177
|
+
}
|
|
1178
|
+
function setExpireDays(days) {
|
|
1179
|
+
_expires = /* @__PURE__ */ new Date();
|
|
1180
|
+
_expires.setDate(_expires.getDate() + days);
|
|
1181
|
+
}
|
|
1182
|
+
function isConsentPending() {
|
|
1183
|
+
return _consent === void 0;
|
|
1184
|
+
}
|
|
1185
|
+
function accept() {
|
|
1186
|
+
_consent = "accept";
|
|
1187
|
+
_save(ConsentCookieName, _consent);
|
|
1188
|
+
}
|
|
1189
|
+
function decline() {
|
|
1190
|
+
_consent = "decline";
|
|
1191
|
+
_save(ConsentCookieName, _consent);
|
|
1192
|
+
}
|
|
1193
|
+
function save(name, value) {
|
|
1194
|
+
if (_consent === "accept")
|
|
1195
|
+
_save(name, value);
|
|
1196
|
+
return value;
|
|
1197
|
+
}
|
|
1198
|
+
function read(name, defaultValue) {
|
|
1199
|
+
var _a;
|
|
1200
|
+
if (_consent === "accept")
|
|
1201
|
+
return (_a = _read(name, defaultValue)) != null ? _a : defaultValue;
|
|
1202
|
+
else
|
|
1203
|
+
return defaultValue;
|
|
1204
|
+
}
|
|
1205
|
+
function readInt(name, defaultValue) {
|
|
1206
|
+
if (_consent === "accept") {
|
|
1207
|
+
let str2 = _read(name);
|
|
1208
|
+
return str2 === void 0 ? defaultValue : parseInt(str2);
|
|
1209
|
+
} else {
|
|
1210
|
+
return defaultValue;
|
|
1211
|
+
}
|
|
1212
|
+
}
|
|
1213
|
+
function readBool(name, defaultValue) {
|
|
1214
|
+
if (_consent === "accept") {
|
|
1215
|
+
let str2 = _read(name);
|
|
1216
|
+
return str2 === void 0 ? defaultValue : /true|1/i.test(str2);
|
|
1217
|
+
} else {
|
|
1218
|
+
return defaultValue;
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
1221
|
+
function erase(name) {
|
|
1222
|
+
if (_consent === "accept" || name === ConsentCookieName)
|
|
1223
|
+
_erase(name);
|
|
1224
|
+
}
|
|
1225
|
+
function eraseAll() {
|
|
1226
|
+
document.cookie.split(";").forEach((c) => erase(c.trim().split("=")[0]));
|
|
1227
|
+
}
|
|
1228
|
+
var device_exports = {};
|
|
1229
|
+
__export2(device_exports, {
|
|
1230
|
+
DPI: () => DPI,
|
|
1231
|
+
FontSize: () => FontSize,
|
|
1232
|
+
HostAddress: () => HostAddress,
|
|
1233
|
+
IsMobileDevice: () => IsMobileDevice,
|
|
1234
|
+
IsTouchDevice: () => IsTouchDevice,
|
|
1235
|
+
PxPerMm: () => PxPerMm,
|
|
1236
|
+
ScrollbarWidth: () => ScrollbarWidth,
|
|
1237
|
+
mmToPx: () => mmToPx,
|
|
1238
|
+
pxToMm: () => pxToMm,
|
|
1239
|
+
toPx: () => toPx
|
|
1240
|
+
});
|
|
1241
|
+
function getDPI() {
|
|
1242
|
+
let el = document.createElement("div");
|
|
1243
|
+
el.style.width = "1in";
|
|
1244
|
+
document.body.appendChild(el);
|
|
1245
|
+
let dpi = el.offsetWidth;
|
|
1246
|
+
el.remove();
|
|
1247
|
+
return dpi || 96;
|
|
1248
|
+
}
|
|
1249
|
+
function getScrollBarWidth() {
|
|
1250
|
+
try {
|
|
1251
|
+
let outer = document.createElement("div");
|
|
1252
|
+
outer.style.visibility = "hidden";
|
|
1253
|
+
outer.style.width = "100px";
|
|
1254
|
+
document.body.appendChild(outer);
|
|
1255
|
+
let widthNoScroll = outer.offsetWidth;
|
|
1256
|
+
outer.style.overflow = "scroll";
|
|
1257
|
+
let inner = document.createElement("div");
|
|
1258
|
+
inner.style.width = "100%";
|
|
1259
|
+
outer.appendChild(inner);
|
|
1260
|
+
let widthWithScroll = inner.offsetWidth;
|
|
1261
|
+
if (outer.parentNode) {
|
|
1262
|
+
outer.parentNode.removeChild(outer);
|
|
1263
|
+
}
|
|
1264
|
+
return widthNoScroll - widthWithScroll;
|
|
1265
|
+
} catch (e) {
|
|
1266
|
+
return 0;
|
|
1267
|
+
}
|
|
1268
|
+
}
|
|
1269
|
+
function getSystemFontSize() {
|
|
1270
|
+
let tmpDiv = document.createElement("div");
|
|
1271
|
+
tmpDiv.style.cssText = "display:inline-block; padding:0; line-height:1; position:absolute; visibility:hidden; font-size:1em";
|
|
1272
|
+
tmpDiv.appendChild(document.createTextNode("M"));
|
|
1273
|
+
document.body.appendChild(tmpDiv);
|
|
1274
|
+
let fontsize = tmpDiv.offsetHeight;
|
|
1275
|
+
document.body.removeChild(tmpDiv);
|
|
1276
|
+
return fontsize;
|
|
1277
|
+
}
|
|
1278
|
+
function getIsTouchDevice() {
|
|
1279
|
+
if ("ontouchstart" in window || "DocumentTouch" in window || "createTouch" in document && "createTouchList" in document) {
|
|
1280
|
+
return true;
|
|
1281
|
+
}
|
|
1282
|
+
var prefixes = " -webkit- -moz- -o- -ms- ".split(" ");
|
|
1283
|
+
var mq = function(query2) {
|
|
1284
|
+
return window.matchMedia(query2).matches;
|
|
1285
|
+
};
|
|
1286
|
+
var query = ["(", prefixes.join("touch-enabled),("), "heartz", ")"].join("");
|
|
1287
|
+
return mq(query);
|
|
1288
|
+
}
|
|
1289
|
+
function getIsMobileDevice() {
|
|
1290
|
+
let a = navigator.userAgent || navigator.vendor || window.opera;
|
|
1291
|
+
return /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4));
|
|
1292
|
+
}
|
|
1293
|
+
function getHostAddress() {
|
|
1294
|
+
return location.protocol + "//" + location.host;
|
|
1295
|
+
}
|
|
1296
|
+
var UnitRegExp = /^(mm|cm|in|inch|px|em)$/;
|
|
1297
|
+
var ValueUnitRegExp = /^([0-9\\.]+)(.*)$/;
|
|
1298
|
+
var DPI = getDPI();
|
|
1299
|
+
var PxPerMm = DPI / 25.4;
|
|
1300
|
+
var ScrollbarWidth = getScrollBarWidth();
|
|
1301
|
+
var FontSize = getSystemFontSize();
|
|
1302
|
+
var IsTouchDevice = getIsTouchDevice();
|
|
1303
|
+
var IsMobileDevice = getIsMobileDevice();
|
|
1304
|
+
var HostAddress = getHostAddress();
|
|
1305
|
+
function pxToMm(px) {
|
|
1306
|
+
return px / PxPerMm;
|
|
1307
|
+
}
|
|
1308
|
+
function mmToPx(mm) {
|
|
1309
|
+
return mm * PxPerMm;
|
|
1310
|
+
}
|
|
1311
|
+
function toPx(input) {
|
|
1312
|
+
if (typeof input === "number") {
|
|
1313
|
+
return input;
|
|
1314
|
+
}
|
|
1315
|
+
let value = NaN;
|
|
1316
|
+
let unit = void 0;
|
|
1317
|
+
let match = input.toString().match(ValueUnitRegExp);
|
|
1318
|
+
if (match && match[1]) {
|
|
1319
|
+
value = parseFloat(match[1]);
|
|
1320
|
+
let unitStr = match[2] ? match[2].toLowerCase() : "undefined";
|
|
1321
|
+
let unitStrOk = UnitRegExp.test(unitStr);
|
|
1322
|
+
unit = unitStrOk ? unitStr : void 0;
|
|
1323
|
+
if (!unit) {
|
|
1324
|
+
console.log("Unknown unit '" + unitStr + "' => using 'px'.");
|
|
1325
|
+
}
|
|
1326
|
+
} else {
|
|
1327
|
+
value = parseFloat(input);
|
|
1328
|
+
}
|
|
1329
|
+
assert_exports.isFinite(value, "value in function toPx");
|
|
1330
|
+
switch (unit) {
|
|
1331
|
+
case "mm":
|
|
1332
|
+
return mmToPx(value);
|
|
1333
|
+
case "cm":
|
|
1334
|
+
return mmToPx(value) * 10;
|
|
1335
|
+
case "in":
|
|
1336
|
+
case "inch":
|
|
1337
|
+
return mmToPx(value) * 25.4;
|
|
1338
|
+
case "em":
|
|
1339
|
+
return FontSize * value;
|
|
1340
|
+
default:
|
|
1341
|
+
case "px":
|
|
1342
|
+
return value;
|
|
1343
|
+
}
|
|
1344
|
+
}
|
|
1345
|
+
var utils_exports = {};
|
|
1346
|
+
__export2(utils_exports, {
|
|
1347
|
+
Arr: () => arr_exports,
|
|
1348
|
+
Dom: () => dom_exports,
|
|
1349
|
+
Enum: () => enum_exports,
|
|
1350
|
+
Math: () => math_exports,
|
|
1351
|
+
Obj: () => obj_exports,
|
|
1352
|
+
Str: () => str_exports
|
|
1353
|
+
});
|
|
1354
|
+
var arr_exports = {};
|
|
1355
|
+
__export2(arr_exports, {
|
|
1356
|
+
arrayContains: () => arrayContains,
|
|
1357
|
+
chunckArray: () => chunckArray,
|
|
1358
|
+
duplicate: () => duplicate,
|
|
1359
|
+
fillArray: () => fillArray,
|
|
1360
|
+
getRangeArray: () => getRangeArray,
|
|
1361
|
+
getSequenceArray: () => getSequenceArray,
|
|
1362
|
+
isArray: () => isArray,
|
|
1363
|
+
mapRangeArray: () => mapRangeArray,
|
|
1364
|
+
mapSequenceArray: () => mapSequenceArray,
|
|
1365
|
+
removeDuplicates: () => removeDuplicates,
|
|
1366
|
+
toArray: () => toArray
|
|
1367
|
+
});
|
|
1368
|
+
function toArray(a) {
|
|
1369
|
+
return isArray(a) ? a : [a];
|
|
1370
|
+
}
|
|
1371
|
+
function duplicate(a) {
|
|
1372
|
+
var _a;
|
|
1373
|
+
return (_a = a == null ? void 0 : a.slice()) != null ? _a : [];
|
|
1374
|
+
}
|
|
1375
|
+
function removeDuplicates(arr, compareFn) {
|
|
1376
|
+
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));
|
|
1377
|
+
}
|
|
1378
|
+
function fillArray(fillValue, fillCount) {
|
|
1379
|
+
if (!isInteger(fillCount) || fillCount < 0) {
|
|
1380
|
+
throw new Error("fillArray: Invalid fillCount = " + fillCount);
|
|
1381
|
+
}
|
|
1382
|
+
return new Array(fillCount).fill(fillValue);
|
|
1383
|
+
}
|
|
1384
|
+
function mapSequenceArray(len, fn) {
|
|
1385
|
+
if (!isInteger(len) || len < 0) {
|
|
1386
|
+
throw new Error("mapSequenceArray: Invalid len = " + len);
|
|
1387
|
+
}
|
|
1388
|
+
let arr = new Array(len);
|
|
1389
|
+
for (let i = 0; i < len; i++) {
|
|
1390
|
+
arr[i] = fn(i);
|
|
1391
|
+
}
|
|
1392
|
+
return arr;
|
|
1393
|
+
}
|
|
1394
|
+
function getSequenceArray(len) {
|
|
1395
|
+
return mapSequenceArray(len, (i) => i);
|
|
1396
|
+
}
|
|
1397
|
+
function mapRangeArray(start, end, fn) {
|
|
1398
|
+
if (!isInteger(start)) {
|
|
1399
|
+
throw new Error("mapRangeArray: Invalid start = " + end);
|
|
1400
|
+
}
|
|
1401
|
+
if (!isInteger(end)) {
|
|
1402
|
+
throw new Error("mapRangeArray: Invalid end = " + end);
|
|
1403
|
+
}
|
|
1404
|
+
let len = Math.abs(end - start) + 1;
|
|
1405
|
+
let arr = new Array(len);
|
|
1406
|
+
for (let i = 0, s = start, inc = Math.sign(end - start); i < len; s += inc, i++) {
|
|
1407
|
+
arr[i] = fn(s);
|
|
1408
|
+
}
|
|
1409
|
+
return arr;
|
|
1410
|
+
}
|
|
1411
|
+
function getRangeArray(start, end) {
|
|
1412
|
+
return mapRangeArray(start, end, (i) => i);
|
|
1413
|
+
}
|
|
1414
|
+
function arrayContains(arg, item) {
|
|
1415
|
+
return arg.indexOf(item) >= 0;
|
|
1416
|
+
}
|
|
1417
|
+
function chunckArray(arr, chunckSize) {
|
|
1418
|
+
if (!isInteger(chunckSize) || chunckSize < 1) {
|
|
1419
|
+
throw new Error("chunckArray: Invalid chunckSize = " + chunckSize);
|
|
1420
|
+
}
|
|
1421
|
+
let result = [];
|
|
1422
|
+
for (let i = 0; i < arr.length; i += chunckSize) {
|
|
1423
|
+
result.push(arr.slice(i, i + chunckSize));
|
|
1424
|
+
}
|
|
1425
|
+
return result;
|
|
1426
|
+
}
|
|
1427
|
+
var dom_exports = {};
|
|
1428
|
+
__export2(dom_exports, {
|
|
1429
|
+
addClass: () => addClass,
|
|
1430
|
+
appendTo: () => appendTo,
|
|
1431
|
+
getButton: () => getButton,
|
|
1432
|
+
getCanvas: () => getCanvas,
|
|
1433
|
+
getCanvasTextWidth: () => getCanvasTextWidth,
|
|
1434
|
+
getDimension: () => getDimension,
|
|
1435
|
+
getHeight: () => getHeight,
|
|
1436
|
+
getOffset: () => getOffset,
|
|
1437
|
+
getPadding: () => getPadding,
|
|
1438
|
+
getWidth: () => getWidth,
|
|
1439
|
+
hasClass: () => hasClass,
|
|
1440
|
+
removeClass: () => removeClass,
|
|
1441
|
+
removeFromParent: () => removeFromParent,
|
|
1442
|
+
setHeight: () => setHeight,
|
|
1443
|
+
setOffset: () => setOffset,
|
|
1444
|
+
setRect: () => setRect,
|
|
1445
|
+
setVisibility: () => setVisibility,
|
|
1446
|
+
setWidth: () => setWidth,
|
|
1447
|
+
styleLayoutChanged: () => styleLayoutChanged
|
|
1448
|
+
});
|
|
1449
|
+
function toPx2(value) {
|
|
1450
|
+
return value === void 0 ? void 0 : device_exports.toPx(value);
|
|
1451
|
+
}
|
|
1452
|
+
function hasClass(el, className) {
|
|
1453
|
+
if (className.length === 0) {
|
|
1454
|
+
return false;
|
|
1455
|
+
} else if (el.classList) {
|
|
1456
|
+
return el.classList.contains(className);
|
|
1457
|
+
} else {
|
|
1458
|
+
return !!el.className.match(new RegExp("(\\s|^)" + className + "(\\s|$)"));
|
|
1459
|
+
}
|
|
1460
|
+
}
|
|
1461
|
+
function addClass(el, className) {
|
|
1462
|
+
if (className.length === 0) {
|
|
1463
|
+
return;
|
|
1464
|
+
} else if (el.classList) {
|
|
1465
|
+
el.classList.add(className);
|
|
1466
|
+
} else if (!hasClass(el, className)) {
|
|
1467
|
+
el.className += " " + className;
|
|
1468
|
+
}
|
|
1469
|
+
}
|
|
1470
|
+
function removeClass(el, className) {
|
|
1471
|
+
if (className.length === 0) {
|
|
1472
|
+
return;
|
|
1473
|
+
} else if (el.classList) {
|
|
1474
|
+
el.classList.remove(className);
|
|
1475
|
+
} else if (hasClass(el, className)) {
|
|
1476
|
+
var reg = new RegExp("(\\s|^)" + className + "(\\s|$)");
|
|
1477
|
+
el.className = el.className.replace(reg, " ");
|
|
1478
|
+
}
|
|
1479
|
+
}
|
|
1480
|
+
function setOffset(el, left, top, unit = "px") {
|
|
1481
|
+
el.style.left = left + unit;
|
|
1482
|
+
el.style.top = top + unit;
|
|
1483
|
+
}
|
|
1484
|
+
function getOffset(el) {
|
|
1485
|
+
let box = el.getBoundingClientRect();
|
|
1486
|
+
let docElem = document.documentElement;
|
|
1487
|
+
return {
|
|
1488
|
+
top: box.top + window.pageYOffset - docElem.clientTop,
|
|
1489
|
+
left: box.left + window.pageXOffset - docElem.clientLeft
|
|
1490
|
+
};
|
|
1491
|
+
}
|
|
1492
|
+
function getWidth(el) {
|
|
1493
|
+
if (el instanceof Window) {
|
|
1494
|
+
return el.innerWidth;
|
|
1495
|
+
} else {
|
|
1496
|
+
let w = parseFloat(getComputedStyle(el, null).width.replace("px", ""));
|
|
1497
|
+
return isNaN(w) ? 0 : w;
|
|
1498
|
+
}
|
|
1499
|
+
}
|
|
1500
|
+
function setWidth(el, val) {
|
|
1501
|
+
el.style.width = val + "px";
|
|
1502
|
+
}
|
|
1503
|
+
function getHeight(el) {
|
|
1504
|
+
if (el instanceof Window) {
|
|
1505
|
+
return el.innerHeight;
|
|
1506
|
+
} else {
|
|
1507
|
+
let h = parseFloat(getComputedStyle(el, null).height.replace("px", ""));
|
|
1508
|
+
return isNaN(h) ? 0 : h;
|
|
1509
|
+
}
|
|
1510
|
+
}
|
|
1511
|
+
function setHeight(el, val) {
|
|
1512
|
+
el.style.height = val + "px";
|
|
1513
|
+
}
|
|
1514
|
+
function appendTo(el, to) {
|
|
1515
|
+
to.appendChild(el);
|
|
1516
|
+
}
|
|
1517
|
+
function removeFromParent(el) {
|
|
1518
|
+
el.remove();
|
|
1519
|
+
}
|
|
1520
|
+
function setVisibility(el, visible) {
|
|
1521
|
+
el.style.display = visible ? "block" : "none";
|
|
1522
|
+
}
|
|
1523
|
+
function setRect(el, left, top, width, height, unit = "px") {
|
|
1524
|
+
el.style.left = left + unit;
|
|
1525
|
+
el.style.top = top + unit;
|
|
1526
|
+
el.style.width = width + unit;
|
|
1527
|
+
el.style.height = height + unit;
|
|
1528
|
+
}
|
|
1529
|
+
function getButton(btn) {
|
|
1530
|
+
let el = typeof btn === "string" ? document.getElementById(btn) : btn;
|
|
1531
|
+
return el instanceof HTMLButtonElement ? el : void 0;
|
|
1532
|
+
}
|
|
1533
|
+
function getCanvas(canvas2) {
|
|
1534
|
+
let el = typeof canvas2 === "string" ? document.getElementById(canvas2) : canvas2;
|
|
1535
|
+
return el instanceof HTMLCanvasElement ? el : void 0;
|
|
1536
|
+
}
|
|
1537
|
+
function getPadding(style) {
|
|
1538
|
+
var _a;
|
|
1539
|
+
if (!style) {
|
|
1540
|
+
return { top: 0, right: 0, bottom: 0, left: 0 };
|
|
1541
|
+
}
|
|
1542
|
+
let top = toPx2(style.paddingTop);
|
|
1543
|
+
let right = toPx2(style.paddingRight);
|
|
1544
|
+
let bottom = toPx2(style.paddingBottom);
|
|
1545
|
+
let left = toPx2(style.paddingLeft);
|
|
1546
|
+
let padding = ((_a = style.padding) != null ? _a : "").toString().split(" ").filter((s) => s.length > 0);
|
|
1547
|
+
switch (padding.length) {
|
|
1548
|
+
case 0:
|
|
1549
|
+
break;
|
|
1550
|
+
case 1:
|
|
1551
|
+
top != null ? top : top = toPx2(padding[0]);
|
|
1552
|
+
right != null ? right : right = toPx2(padding[0]);
|
|
1553
|
+
bottom != null ? bottom : bottom = toPx2(padding[0]);
|
|
1554
|
+
left != null ? left : left = toPx2(padding[0]);
|
|
1555
|
+
break;
|
|
1556
|
+
case 2:
|
|
1557
|
+
top != null ? top : top = toPx2(padding[0]);
|
|
1558
|
+
right != null ? right : right = toPx2(padding[1]);
|
|
1559
|
+
bottom != null ? bottom : bottom = toPx2(padding[0]);
|
|
1560
|
+
left != null ? left : left = toPx2(padding[1]);
|
|
1561
|
+
break;
|
|
1562
|
+
case 3:
|
|
1563
|
+
top != null ? top : top = toPx2(padding[0]);
|
|
1564
|
+
right != null ? right : right = toPx2(padding[1]);
|
|
1565
|
+
bottom != null ? bottom : bottom = toPx2(padding[2]);
|
|
1566
|
+
left != null ? left : left = toPx2(padding[1]);
|
|
1567
|
+
break;
|
|
1568
|
+
case 4:
|
|
1569
|
+
default:
|
|
1570
|
+
top != null ? top : top = toPx2(padding[0]);
|
|
1571
|
+
right != null ? right : right = toPx2(padding[1]);
|
|
1572
|
+
bottom != null ? bottom : bottom = toPx2(padding[2]);
|
|
1573
|
+
left != null ? left : left = toPx2(padding[3]);
|
|
1574
|
+
break;
|
|
1575
|
+
}
|
|
1576
|
+
top != null ? top : top = 0;
|
|
1577
|
+
right != null ? right : right = 0;
|
|
1578
|
+
bottom != null ? bottom : bottom = 0;
|
|
1579
|
+
left != null ? left : left = 0;
|
|
1580
|
+
return { top, right, bottom, left };
|
|
1581
|
+
}
|
|
1582
|
+
function getDimension(style) {
|
|
1583
|
+
let left = toPx2(style == null ? void 0 : style.left);
|
|
1584
|
+
let right = toPx2(style == null ? void 0 : style.right);
|
|
1585
|
+
let top = toPx2(style == null ? void 0 : style.top);
|
|
1586
|
+
let bottom = toPx2(style == null ? void 0 : style.bottom);
|
|
1587
|
+
let width = toPx2(style == null ? void 0 : style.width);
|
|
1588
|
+
let height = toPx2(style == null ? void 0 : style.height);
|
|
1589
|
+
if (width === void 0 && left !== void 0 && right !== void 0) {
|
|
1590
|
+
width = right - left;
|
|
1591
|
+
}
|
|
1592
|
+
if (height === void 0 && top !== void 0 && bottom !== void 0) {
|
|
1593
|
+
height = bottom - top;
|
|
1594
|
+
}
|
|
1595
|
+
return { left, top, width, height };
|
|
1596
|
+
}
|
|
1597
|
+
function styleLayoutChanged(style1, style2) {
|
|
1598
|
+
if (!style1 && !style2) {
|
|
1599
|
+
return false;
|
|
1600
|
+
} else if (!style1 || !style2) {
|
|
1601
|
+
return true;
|
|
1602
|
+
} else {
|
|
1603
|
+
return style1.left !== style2.left || style1.top !== style2.top || style1.right !== style2.right || style1.bottom !== style2.bottom || style1.width !== style2.width || style1.height !== style2.height;
|
|
1604
|
+
}
|
|
1605
|
+
}
|
|
1606
|
+
var canvas;
|
|
1607
|
+
function getCanvasTextWidth(text, font) {
|
|
1608
|
+
canvas != null ? canvas : canvas = document.createElement("canvas");
|
|
1609
|
+
let ctx = canvas.getContext("2d");
|
|
1610
|
+
if (!ctx) {
|
|
1611
|
+
return 0;
|
|
1612
|
+
}
|
|
1613
|
+
ctx.font = font;
|
|
1614
|
+
return ctx.measureText(text).width;
|
|
1615
|
+
}
|
|
1616
|
+
var math_exports = {};
|
|
1617
|
+
__export2(math_exports, {
|
|
1618
|
+
avg: () => avg,
|
|
1619
|
+
calcNormal: () => calcNormal,
|
|
1620
|
+
clamp: () => clamp,
|
|
1621
|
+
cmp: () => cmp,
|
|
1622
|
+
interpolateCoord: () => interpolateCoord,
|
|
1623
|
+
interpolateY: () => interpolateY,
|
|
1624
|
+
isInteger: () => isInteger,
|
|
1625
|
+
isNumber: () => isNumber,
|
|
1626
|
+
linearToDecibels: () => linearToDecibels,
|
|
1627
|
+
mod: () => mod,
|
|
1628
|
+
romanize: () => romanize,
|
|
1629
|
+
sum: () => sum,
|
|
1630
|
+
toOrdinalNumber: () => toOrdinalNumber
|
|
1631
|
+
});
|
|
1632
|
+
function linearToDecibels(linearVolume) {
|
|
1633
|
+
if (!isFinite(linearVolume)) {
|
|
1634
|
+
throw new Error("linearToDecibel: Invalid linearVolume = " + linearVolume);
|
|
1635
|
+
} else if (linearVolume <= 0) {
|
|
1636
|
+
return -Infinity;
|
|
1637
|
+
} else {
|
|
1638
|
+
return 20 * Math.log10(linearVolume);
|
|
1639
|
+
}
|
|
1640
|
+
}
|
|
1641
|
+
function mod(m, n) {
|
|
1642
|
+
return (m % n + n) % n;
|
|
1643
|
+
}
|
|
1644
|
+
function romanize(n) {
|
|
1645
|
+
if (!isInteger(n) || n < 0) {
|
|
1646
|
+
throw new Error("romanize: Invalid n = " + n);
|
|
1647
|
+
}
|
|
1648
|
+
var digits = String(+n).split("");
|
|
1649
|
+
var key = [
|
|
1650
|
+
"",
|
|
1651
|
+
"C",
|
|
1652
|
+
"CC",
|
|
1653
|
+
"CCC",
|
|
1654
|
+
"CD",
|
|
1655
|
+
"D",
|
|
1656
|
+
"DC",
|
|
1657
|
+
"DCC",
|
|
1658
|
+
"DCCC",
|
|
1659
|
+
"CM",
|
|
1660
|
+
"",
|
|
1661
|
+
"X",
|
|
1662
|
+
"XX",
|
|
1663
|
+
"XXX",
|
|
1664
|
+
"XL",
|
|
1665
|
+
"L",
|
|
1666
|
+
"LX",
|
|
1667
|
+
"LXX",
|
|
1668
|
+
"LXXX",
|
|
1669
|
+
"XC",
|
|
1670
|
+
"",
|
|
1671
|
+
"I",
|
|
1672
|
+
"II",
|
|
1673
|
+
"III",
|
|
1674
|
+
"IV",
|
|
1675
|
+
"V",
|
|
1676
|
+
"VI",
|
|
1677
|
+
"VII",
|
|
1678
|
+
"VIII",
|
|
1679
|
+
"IX"
|
|
1680
|
+
];
|
|
1681
|
+
var roman = "", i = 3;
|
|
1682
|
+
while (i--) roman = (key[+digits.pop() + i * 10] || "") + roman;
|
|
1683
|
+
return Array(+digits.join("") + 1).join("M") + roman;
|
|
1684
|
+
}
|
|
1685
|
+
function toOrdinalNumber(n) {
|
|
1686
|
+
if (!isInteger(n)) {
|
|
1687
|
+
throw new Error("toOrdinalNumber: Invalid n = " + n);
|
|
1688
|
+
}
|
|
1689
|
+
const nStr = n.toString();
|
|
1690
|
+
const lastDigit = Number(nStr.charAt(nStr.length - 1));
|
|
1691
|
+
if (n === 1 || n >= 20 && lastDigit === 1) {
|
|
1692
|
+
return nStr + "st";
|
|
1693
|
+
} else if (n === 2 || n >= 20 && lastDigit === 2) {
|
|
1694
|
+
return nStr + "nd";
|
|
1695
|
+
} else if (n === 3 || n >= 20 && lastDigit === 3) {
|
|
1696
|
+
return nStr + "rd";
|
|
1697
|
+
} else {
|
|
1698
|
+
return nStr + "th";
|
|
1699
|
+
}
|
|
1700
|
+
}
|
|
1701
|
+
function interpolateCoord(startX, startY, endX, endY, t) {
|
|
1702
|
+
return {
|
|
1703
|
+
x: startX + (endX - startX) * t,
|
|
1704
|
+
y: startY + (endY - startY) * t
|
|
1705
|
+
};
|
|
1706
|
+
}
|
|
1707
|
+
function interpolateY(startX, startY, endX, endY, x) {
|
|
1708
|
+
let t = (x - startX) / (endX - startX);
|
|
1709
|
+
return startY + (endY - startY) * t;
|
|
1710
|
+
}
|
|
1711
|
+
function clamp(num, min, max) {
|
|
1712
|
+
return Math.min(Math.max(num, min), max);
|
|
1713
|
+
}
|
|
1714
|
+
function calcNormal(x1, y1, x2, y2) {
|
|
1715
|
+
let dx = x2 - x1;
|
|
1716
|
+
let dy = y2 - y1;
|
|
1717
|
+
let nx = -dy;
|
|
1718
|
+
let ny = dx;
|
|
1719
|
+
let len = Math.sqrt(nx * nx + ny * ny);
|
|
1720
|
+
if (len > 0) {
|
|
1721
|
+
nx /= len;
|
|
1722
|
+
ny /= len;
|
|
1723
|
+
} else {
|
|
1724
|
+
nx = 0;
|
|
1725
|
+
ny = 1;
|
|
1726
|
+
}
|
|
1727
|
+
return { nx, ny };
|
|
1728
|
+
}
|
|
1729
|
+
function sum(arr) {
|
|
1730
|
+
return arr.reduce((prev, cur) => cur + prev, 0);
|
|
1731
|
+
}
|
|
1732
|
+
function avg(...values) {
|
|
1733
|
+
return sum(values) / values.length;
|
|
1734
|
+
}
|
|
1735
|
+
function cmp(a, b) {
|
|
1736
|
+
return a < b ? -1 : a > b ? 1 : 0;
|
|
1737
|
+
}
|
|
1738
|
+
var DefaultEqualityFn = (a, b) => a === b;
|
|
1739
|
+
var BaseContainer = class {
|
|
1740
|
+
};
|
|
1741
|
+
var LRUCache = class extends BaseContainer {
|
|
1742
|
+
// Maximum key length.
|
|
1743
|
+
constructor(maxSize, maxKeyLength = Infinity) {
|
|
1744
|
+
super();
|
|
1745
|
+
__publicField2(this, "cache");
|
|
1746
|
+
__publicField2(this, "next");
|
|
1747
|
+
__publicField2(this, "prev");
|
|
1748
|
+
__publicField2(this, "head");
|
|
1749
|
+
__publicField2(this, "tail");
|
|
1750
|
+
__publicField2(this, "capacity");
|
|
1751
|
+
__publicField2(this, "size");
|
|
1752
|
+
__publicField2(this, "maxKeyLength");
|
|
1753
|
+
this.cache = /* @__PURE__ */ Object.create(null);
|
|
1754
|
+
this.next = /* @__PURE__ */ Object.create(null);
|
|
1755
|
+
this.prev = /* @__PURE__ */ Object.create(null);
|
|
1756
|
+
this.head = null;
|
|
1757
|
+
this.tail = null;
|
|
1758
|
+
this.capacity = maxSize;
|
|
1759
|
+
this.size = 0;
|
|
1760
|
+
this.maxKeyLength = maxKeyLength;
|
|
1761
|
+
}
|
|
1762
|
+
// Retrieves a value from the cache
|
|
1763
|
+
get(key) {
|
|
1764
|
+
if (key.length > this.maxKeyLength) return void 0;
|
|
1765
|
+
if (this.cache[key] !== void 0) {
|
|
1766
|
+
this.touch(key);
|
|
1767
|
+
return this.cache[key];
|
|
1768
|
+
}
|
|
1769
|
+
return void 0;
|
|
1770
|
+
}
|
|
1771
|
+
set(key, value) {
|
|
1772
|
+
if (key.length > this.maxKeyLength) {
|
|
1773
|
+
return;
|
|
1774
|
+
}
|
|
1775
|
+
if (this.cache[key] !== void 0) {
|
|
1776
|
+
this.cache[key] = value;
|
|
1777
|
+
this.touch(key);
|
|
1778
|
+
return;
|
|
1779
|
+
}
|
|
1780
|
+
if (this.size >= this.capacity) {
|
|
1781
|
+
this.evict();
|
|
1782
|
+
}
|
|
1783
|
+
this.cache[key] = value;
|
|
1784
|
+
this.addToTail(key);
|
|
1785
|
+
this.size++;
|
|
1786
|
+
}
|
|
1787
|
+
// Marks a key as most recently used
|
|
1788
|
+
touch(key) {
|
|
1789
|
+
if (this.tail === key) return;
|
|
1790
|
+
this.removeKey(key);
|
|
1791
|
+
this.addToTail(key);
|
|
1792
|
+
}
|
|
1793
|
+
// Evicts the least recently used item (at the head)
|
|
1794
|
+
evict() {
|
|
1795
|
+
if (this.head !== null) {
|
|
1796
|
+
const oldestKey = this.head;
|
|
1797
|
+
this.removeKey(oldestKey);
|
|
1798
|
+
delete this.cache[oldestKey];
|
|
1799
|
+
this.size--;
|
|
1800
|
+
}
|
|
1801
|
+
}
|
|
1802
|
+
// Removes a key from the linked list
|
|
1803
|
+
removeKey(key) {
|
|
1804
|
+
const prevKey = this.prev[key];
|
|
1805
|
+
const nextKey = this.next[key];
|
|
1806
|
+
if (prevKey !== void 0) {
|
|
1807
|
+
this.next[prevKey] = nextKey;
|
|
1808
|
+
} else {
|
|
1809
|
+
this.head = nextKey != null ? nextKey : null;
|
|
1810
|
+
}
|
|
1811
|
+
if (nextKey !== void 0) {
|
|
1812
|
+
this.prev[nextKey] = prevKey;
|
|
1813
|
+
} else {
|
|
1814
|
+
this.tail = prevKey != null ? prevKey : null;
|
|
1815
|
+
}
|
|
1816
|
+
delete this.prev[key];
|
|
1817
|
+
delete this.next[key];
|
|
1818
|
+
}
|
|
1819
|
+
// Adds a key to the tail (most recently used position)
|
|
1820
|
+
addToTail(key) {
|
|
1821
|
+
if (this.tail !== null) {
|
|
1822
|
+
this.next[this.tail] = key;
|
|
1823
|
+
this.prev[key] = this.tail;
|
|
1824
|
+
} else {
|
|
1825
|
+
this.head = key;
|
|
1826
|
+
}
|
|
1827
|
+
this.tail = key;
|
|
1828
|
+
}
|
|
1829
|
+
*keys() {
|
|
1830
|
+
for (let key = this.head; key != null; key = this.next[key])
|
|
1831
|
+
yield key;
|
|
1832
|
+
}
|
|
1833
|
+
*values() {
|
|
1834
|
+
for (let key = this.head; key != null; key = this.next[key])
|
|
1835
|
+
yield this.cache[key];
|
|
1836
|
+
}
|
|
1837
|
+
*entries() {
|
|
1838
|
+
for (let key = this.head; key != null; key = this.next[key])
|
|
1839
|
+
yield [key, this.cache[key]];
|
|
1840
|
+
}
|
|
1841
|
+
*[Symbol.iterator]() {
|
|
1842
|
+
yield* __yieldStar(this.entries());
|
|
1843
|
+
}
|
|
1844
|
+
toString() {
|
|
1845
|
+
const entries = [...this.entries()];
|
|
1846
|
+
return entries.length === 0 ? `LRUCache(0){ }` : `LRUCache(${entries.length}){ ${entries.map((e) => `${stringify(e[0])}: ${stringify(e[1])}`).join(", ")} }`;
|
|
1847
|
+
}
|
|
1848
|
+
};
|
|
1849
|
+
var IndexArray = class _IndexArray extends BaseContainer {
|
|
1850
|
+
constructor(entries) {
|
|
1851
|
+
super();
|
|
1852
|
+
__publicField2(this, "posVal");
|
|
1853
|
+
__publicField2(this, "hasPos");
|
|
1854
|
+
__publicField2(this, "valCount");
|
|
1855
|
+
if (entries instanceof _IndexArray) {
|
|
1856
|
+
this.posVal = entries.posVal.slice();
|
|
1857
|
+
this.hasPos = entries.hasPos.slice();
|
|
1858
|
+
this.valCount = entries.valCount;
|
|
1859
|
+
} else {
|
|
1860
|
+
this.posVal = [];
|
|
1861
|
+
this.hasPos = [];
|
|
1862
|
+
this.valCount = 0;
|
|
1863
|
+
if (entries) {
|
|
1864
|
+
for (const [id, value] of entries) {
|
|
1865
|
+
this.set(id, value);
|
|
1866
|
+
}
|
|
1867
|
+
}
|
|
1868
|
+
}
|
|
1869
|
+
}
|
|
1870
|
+
static validateIndex(id) {
|
|
1871
|
+
if (!isIntegerGte(id, 0)) throw new Error(`Invalid index ${id} - must be an integer >= 0!`);
|
|
1872
|
+
return id;
|
|
1873
|
+
}
|
|
1874
|
+
get posLen() {
|
|
1875
|
+
return this.hasPos.length;
|
|
1876
|
+
}
|
|
1877
|
+
get size() {
|
|
1878
|
+
return this.valCount;
|
|
1879
|
+
}
|
|
1880
|
+
get length() {
|
|
1881
|
+
return this.hasPos.length;
|
|
1882
|
+
}
|
|
1883
|
+
trimRight() {
|
|
1884
|
+
let newLength = this.length;
|
|
1885
|
+
while (newLength > 0 && this.hasPos[newLength - 1] !== true) newLength--;
|
|
1886
|
+
if (newLength < this.length) this.posVal.length = this.hasPos.length = newLength;
|
|
1887
|
+
}
|
|
1888
|
+
isEmpty() {
|
|
1889
|
+
return this.size === 0;
|
|
1890
|
+
}
|
|
1891
|
+
has(id) {
|
|
1892
|
+
_IndexArray.validateIndex(id);
|
|
1893
|
+
return this.hasPos[id] === true;
|
|
1894
|
+
}
|
|
1895
|
+
set(id, value) {
|
|
1896
|
+
_IndexArray.validateIndex(id);
|
|
1897
|
+
if (this.hasPos[id] !== true) this.valCount++;
|
|
1898
|
+
this.posVal[id] = value;
|
|
1899
|
+
this.hasPos[id] = true;
|
|
1900
|
+
}
|
|
1901
|
+
get(id) {
|
|
1902
|
+
_IndexArray.validateIndex(id);
|
|
1903
|
+
return this.hasPos[id] ? this.posVal[id] : void 0;
|
|
1904
|
+
}
|
|
1905
|
+
getOrDefault(id, defaultValue) {
|
|
1906
|
+
var _a;
|
|
1907
|
+
return (_a = this.get(id)) != null ? _a : defaultValue;
|
|
1908
|
+
}
|
|
1909
|
+
getOrCreate(id, creatorOrValue) {
|
|
1910
|
+
if (!this.has(id)) {
|
|
1911
|
+
const value = isFunction(creatorOrValue) ? creatorOrValue() : creatorOrValue;
|
|
1912
|
+
this.set(id, value);
|
|
1913
|
+
return value;
|
|
1914
|
+
}
|
|
1915
|
+
return this.get(id);
|
|
1916
|
+
}
|
|
1917
|
+
delete(id) {
|
|
1918
|
+
_IndexArray.validateIndex(id);
|
|
1919
|
+
if (!this.hasPos[id]) return false;
|
|
1920
|
+
this.posVal[id] = void 0;
|
|
1921
|
+
this.hasPos[id] = false;
|
|
1922
|
+
this.valCount--;
|
|
1923
|
+
this.trimRight();
|
|
1924
|
+
return true;
|
|
1925
|
+
}
|
|
1926
|
+
clear() {
|
|
1927
|
+
this.posVal = [];
|
|
1928
|
+
this.hasPos = [];
|
|
1929
|
+
this.valCount = 0;
|
|
1930
|
+
}
|
|
1931
|
+
forEach(callbackfn, thisArg) {
|
|
1932
|
+
for (const [id, value] of this.entries()) {
|
|
1933
|
+
callbackfn.call(thisArg, value, id, this);
|
|
1934
|
+
}
|
|
1935
|
+
}
|
|
1936
|
+
*indices() {
|
|
1937
|
+
for (let id = 0; id < this.posLen; id++) {
|
|
1938
|
+
if (this.hasPos[id]) yield id;
|
|
1939
|
+
}
|
|
1940
|
+
}
|
|
1941
|
+
*values() {
|
|
1942
|
+
for (let id = 0; id < this.posLen; id++) {
|
|
1943
|
+
if (this.hasPos[id]) yield this.posVal[id];
|
|
1944
|
+
}
|
|
1945
|
+
}
|
|
1946
|
+
*entries() {
|
|
1947
|
+
for (let id = 0; id < this.posLen; id++) {
|
|
1948
|
+
if (this.hasPos[id]) yield [id, this.posVal[id]];
|
|
1949
|
+
}
|
|
1950
|
+
}
|
|
1951
|
+
indicesArray() {
|
|
1952
|
+
return [...this.indices()];
|
|
1953
|
+
}
|
|
1954
|
+
valuesArray() {
|
|
1955
|
+
return [...this.values()];
|
|
1956
|
+
}
|
|
1957
|
+
entriesArray() {
|
|
1958
|
+
return [...this.entries()];
|
|
1959
|
+
}
|
|
1960
|
+
*kvKeys() {
|
|
1961
|
+
for (const id of this.indices()) {
|
|
1962
|
+
yield [id];
|
|
1963
|
+
}
|
|
1964
|
+
}
|
|
1965
|
+
*kvValues() {
|
|
1966
|
+
for (const value of this.values()) {
|
|
1967
|
+
yield value;
|
|
1968
|
+
}
|
|
1969
|
+
}
|
|
1970
|
+
*kvEntries() {
|
|
1971
|
+
for (const [id, value] of this.entries()) {
|
|
1972
|
+
yield [[id], value];
|
|
1973
|
+
}
|
|
1974
|
+
}
|
|
1975
|
+
*[Symbol.iterator]() {
|
|
1976
|
+
yield* __yieldStar(this.entries());
|
|
1977
|
+
}
|
|
1978
|
+
clone() {
|
|
1979
|
+
return new _IndexArray(this);
|
|
1980
|
+
}
|
|
1981
|
+
merge(other, conflictResolver) {
|
|
1982
|
+
for (const [id, value] of other.entries()) {
|
|
1983
|
+
if (this.has(id) && conflictResolver) {
|
|
1984
|
+
this.set(id, conflictResolver(this.get(id), value, id));
|
|
1985
|
+
} else {
|
|
1986
|
+
this.set(id, value);
|
|
1987
|
+
}
|
|
1988
|
+
}
|
|
1989
|
+
return this;
|
|
1990
|
+
}
|
|
1991
|
+
some(fn) {
|
|
1992
|
+
for (const [id, value] of this.entries()) {
|
|
1993
|
+
if (fn(value, id)) return true;
|
|
1994
|
+
}
|
|
1995
|
+
return false;
|
|
1996
|
+
}
|
|
1997
|
+
every(fn) {
|
|
1998
|
+
for (const [id, value] of this.entries()) {
|
|
1999
|
+
if (!fn(value, id)) return false;
|
|
2000
|
+
}
|
|
2001
|
+
return true;
|
|
2002
|
+
}
|
|
2003
|
+
filter(predicate) {
|
|
2004
|
+
const result = new this.constructor();
|
|
2005
|
+
for (const [id, value] of this.entries()) {
|
|
2006
|
+
if (predicate(value, id, this)) result.set(id, value);
|
|
2007
|
+
}
|
|
2008
|
+
return result;
|
|
2009
|
+
}
|
|
2010
|
+
reduce(fn, init) {
|
|
2011
|
+
let iterator = this.entries();
|
|
2012
|
+
let first = iterator.next();
|
|
2013
|
+
if (first.done) {
|
|
2014
|
+
if (arguments.length < 2) {
|
|
2015
|
+
throw new TypeError("Reduce of empty IndexArray with no initial value!");
|
|
2016
|
+
}
|
|
2017
|
+
return init;
|
|
2018
|
+
}
|
|
2019
|
+
let acc;
|
|
2020
|
+
let start;
|
|
2021
|
+
if (arguments.length < 2) {
|
|
2022
|
+
acc = first.value[1];
|
|
2023
|
+
start = iterator.next();
|
|
2024
|
+
} else {
|
|
2025
|
+
acc = init;
|
|
2026
|
+
start = first;
|
|
2027
|
+
}
|
|
2028
|
+
for (let current = start; !current.done; current = iterator.next()) {
|
|
2029
|
+
const [id, value] = current.value;
|
|
2030
|
+
acc = fn(acc, value, id);
|
|
2031
|
+
}
|
|
2032
|
+
return acc;
|
|
2033
|
+
}
|
|
2034
|
+
mapToArray(fn) {
|
|
2035
|
+
let result = [];
|
|
2036
|
+
for (const [id, value] of this.entries()) {
|
|
2037
|
+
result.push(fn(value, id));
|
|
2038
|
+
}
|
|
2039
|
+
return result;
|
|
2040
|
+
}
|
|
2041
|
+
map(fn) {
|
|
2042
|
+
let result = new _IndexArray();
|
|
2043
|
+
for (const [id, value] of this.entries()) {
|
|
2044
|
+
result.set(id, fn(value, id));
|
|
2045
|
+
}
|
|
2046
|
+
return result;
|
|
2047
|
+
}
|
|
2048
|
+
equals(other, eq) {
|
|
2049
|
+
if (this.size !== other.size) return false;
|
|
2050
|
+
eq != null ? eq : eq = (a, b) => a === b;
|
|
2051
|
+
const posLen = Math.max(this.posLen, other.posLen);
|
|
2052
|
+
for (let i = 0; i < posLen; ++i) {
|
|
2053
|
+
const hasA = this.hasPos[i];
|
|
2054
|
+
const hasB = other.hasPos[i];
|
|
2055
|
+
if (hasA !== hasB) return false;
|
|
2056
|
+
if (hasA && !eq(this.posVal[i], other.posVal[i])) return false;
|
|
2057
|
+
}
|
|
2058
|
+
return true;
|
|
2059
|
+
}
|
|
2060
|
+
toArray() {
|
|
2061
|
+
return this.valuesArray();
|
|
2062
|
+
}
|
|
2063
|
+
toString() {
|
|
2064
|
+
let isRegularArray = true;
|
|
2065
|
+
for (let i = 0; i < this.hasPos.length && isRegularArray; i++)
|
|
2066
|
+
if (!this.hasPos[i]) isRegularArray = false;
|
|
2067
|
+
if (isRegularArray)
|
|
2068
|
+
return stringify(this.posVal.slice(0, this.hasPos.length));
|
|
2069
|
+
const entries = this.entriesArray().map(([id, v]) => `${stringify(id)}: ${stringify(v)}`).join(", ");
|
|
2070
|
+
return entries.length === 0 ? `[ ]` : `[ ${entries} ]`;
|
|
2071
|
+
}
|
|
2072
|
+
};
|
|
2073
|
+
var SignedIndexArray = class _SignedIndexArray extends BaseContainer {
|
|
2074
|
+
constructor(entries) {
|
|
2075
|
+
super();
|
|
2076
|
+
__publicField2(this, "posVal");
|
|
2077
|
+
__publicField2(this, "hasPos");
|
|
2078
|
+
__publicField2(this, "negVal");
|
|
2079
|
+
__publicField2(this, "hasNeg");
|
|
2080
|
+
__publicField2(this, "valCount");
|
|
2081
|
+
if (entries instanceof _SignedIndexArray) {
|
|
2082
|
+
this.negVal = entries.negVal.slice();
|
|
2083
|
+
this.hasNeg = entries.hasNeg.slice();
|
|
2084
|
+
this.posVal = entries.posVal.slice();
|
|
2085
|
+
this.hasPos = entries.hasPos.slice();
|
|
2086
|
+
this.valCount = entries.valCount;
|
|
2087
|
+
} else {
|
|
2088
|
+
this.negVal = [];
|
|
2089
|
+
this.hasNeg = [];
|
|
2090
|
+
this.posVal = [];
|
|
2091
|
+
this.hasPos = [];
|
|
2092
|
+
this.valCount = 0;
|
|
2093
|
+
if (entries) {
|
|
2094
|
+
for (const [id, value] of entries) {
|
|
2095
|
+
this.set(id, value);
|
|
2096
|
+
}
|
|
2097
|
+
}
|
|
2098
|
+
}
|
|
2099
|
+
}
|
|
2100
|
+
static toNegIndex(id) {
|
|
2101
|
+
return -id - 1;
|
|
2102
|
+
}
|
|
2103
|
+
static validateIndex(id) {
|
|
2104
|
+
if (!isInteger(id)) throw new Error(`Invalid index ${id} - must be an integer!`);
|
|
2105
|
+
return id;
|
|
2106
|
+
}
|
|
2107
|
+
get size() {
|
|
2108
|
+
return this.valCount;
|
|
2109
|
+
}
|
|
2110
|
+
isEmpty() {
|
|
2111
|
+
return this.size === 0;
|
|
2112
|
+
}
|
|
2113
|
+
get posLen() {
|
|
2114
|
+
return this.hasPos.length;
|
|
2115
|
+
}
|
|
2116
|
+
get negLen() {
|
|
2117
|
+
return this.hasNeg.length;
|
|
2118
|
+
}
|
|
2119
|
+
has(id) {
|
|
2120
|
+
_SignedIndexArray.validateIndex(id);
|
|
2121
|
+
if (id >= 0) {
|
|
2122
|
+
return this.hasPos[id] === true;
|
|
2123
|
+
} else {
|
|
2124
|
+
return this.hasNeg[_SignedIndexArray.toNegIndex(id)] === true;
|
|
2125
|
+
}
|
|
2126
|
+
}
|
|
2127
|
+
set(id, value) {
|
|
2128
|
+
_SignedIndexArray.validateIndex(id);
|
|
2129
|
+
if (id >= 0) {
|
|
2130
|
+
if (this.hasPos[id] !== true) this.valCount++;
|
|
2131
|
+
this.posVal[id] = value;
|
|
2132
|
+
this.hasPos[id] = true;
|
|
2133
|
+
} else {
|
|
2134
|
+
let negId = _SignedIndexArray.toNegIndex(id);
|
|
2135
|
+
if (this.hasNeg[negId] !== true) this.valCount++;
|
|
2136
|
+
this.negVal[negId] = value;
|
|
2137
|
+
this.hasNeg[negId] = true;
|
|
2138
|
+
}
|
|
2139
|
+
}
|
|
2140
|
+
get(id) {
|
|
2141
|
+
_SignedIndexArray.validateIndex(id);
|
|
2142
|
+
if (id >= 0) {
|
|
2143
|
+
return this.hasPos[id] ? this.posVal[id] : void 0;
|
|
2144
|
+
} else {
|
|
2145
|
+
let negId = _SignedIndexArray.toNegIndex(id);
|
|
2146
|
+
return this.hasNeg[negId] ? this.negVal[negId] : void 0;
|
|
2147
|
+
}
|
|
2148
|
+
}
|
|
2149
|
+
getOrDefault(id, defaultValue) {
|
|
2150
|
+
var _a;
|
|
2151
|
+
return (_a = this.get(id)) != null ? _a : defaultValue;
|
|
2152
|
+
}
|
|
2153
|
+
getOrCreate(id, creatorOrValue) {
|
|
2154
|
+
if (!this.has(id)) {
|
|
2155
|
+
const value = isFunction(creatorOrValue) ? creatorOrValue() : creatorOrValue;
|
|
2156
|
+
this.set(id, value);
|
|
2157
|
+
return value;
|
|
2158
|
+
}
|
|
2159
|
+
return this.get(id);
|
|
2160
|
+
}
|
|
2161
|
+
delete(id) {
|
|
2162
|
+
_SignedIndexArray.validateIndex(id);
|
|
2163
|
+
const isPos3 = id >= 0;
|
|
2164
|
+
const arr = isPos3 ? this.posVal : this.negVal;
|
|
2165
|
+
const has = isPos3 ? this.hasPos : this.hasNeg;
|
|
2166
|
+
const idx = isPos3 ? id : _SignedIndexArray.toNegIndex(id);
|
|
2167
|
+
if (!has[idx]) return false;
|
|
2168
|
+
arr[idx] = void 0;
|
|
2169
|
+
has[idx] = false;
|
|
2170
|
+
this.valCount--;
|
|
2171
|
+
return true;
|
|
2172
|
+
}
|
|
2173
|
+
clear() {
|
|
2174
|
+
this.negVal = [];
|
|
2175
|
+
this.hasNeg = [];
|
|
2176
|
+
this.posVal = [];
|
|
2177
|
+
this.hasPos = [];
|
|
2178
|
+
this.valCount = 0;
|
|
2179
|
+
}
|
|
2180
|
+
forEach(callbackfn, thisArg) {
|
|
2181
|
+
for (const [id, value] of this.entries()) {
|
|
2182
|
+
callbackfn.call(thisArg, value, id, this);
|
|
2183
|
+
}
|
|
2184
|
+
}
|
|
2185
|
+
*indices() {
|
|
2186
|
+
for (let id = this.negLen - 1; id >= 0; id--) {
|
|
2187
|
+
if (this.hasNeg[id]) yield _SignedIndexArray.toNegIndex(id);
|
|
2188
|
+
}
|
|
2189
|
+
for (let id = 0; id < this.posLen; id++) {
|
|
2190
|
+
if (this.hasPos[id]) yield id;
|
|
2191
|
+
}
|
|
2192
|
+
}
|
|
2193
|
+
*values() {
|
|
2194
|
+
for (let id = this.negLen - 1; id >= 0; id--) {
|
|
2195
|
+
if (this.hasNeg[id]) yield this.negVal[id];
|
|
2196
|
+
}
|
|
2197
|
+
for (let id = 0; id < this.posLen; id++) {
|
|
2198
|
+
if (this.hasPos[id]) yield this.posVal[id];
|
|
2199
|
+
}
|
|
2200
|
+
}
|
|
2201
|
+
*entries() {
|
|
2202
|
+
for (let id = this.negLen - 1; id >= 0; id--) {
|
|
2203
|
+
if (this.hasNeg[id]) yield [_SignedIndexArray.toNegIndex(id), this.negVal[id]];
|
|
2204
|
+
}
|
|
2205
|
+
for (let id = 0; id < this.posLen; id++) {
|
|
2206
|
+
if (this.hasPos[id]) yield [id, this.posVal[id]];
|
|
2207
|
+
}
|
|
2208
|
+
}
|
|
2209
|
+
indicesArray() {
|
|
2210
|
+
return [...this.indices()];
|
|
2211
|
+
}
|
|
2212
|
+
valuesArray() {
|
|
2213
|
+
return [...this.values()];
|
|
2214
|
+
}
|
|
2215
|
+
entriesArray() {
|
|
2216
|
+
return [...this.entries()];
|
|
2217
|
+
}
|
|
2218
|
+
*kvKeys() {
|
|
2219
|
+
for (const id of this.indices()) {
|
|
2220
|
+
yield [id];
|
|
2221
|
+
}
|
|
2222
|
+
}
|
|
2223
|
+
*kvValues() {
|
|
2224
|
+
for (const value of this.values()) {
|
|
2225
|
+
yield value;
|
|
2226
|
+
}
|
|
2227
|
+
}
|
|
2228
|
+
*kvEntries() {
|
|
2229
|
+
for (const [id, value] of this.entries()) {
|
|
2230
|
+
yield [[id], value];
|
|
2231
|
+
}
|
|
2232
|
+
}
|
|
2233
|
+
*[Symbol.iterator]() {
|
|
2234
|
+
yield* __yieldStar(this.entries());
|
|
2235
|
+
}
|
|
2236
|
+
clone() {
|
|
2237
|
+
return new _SignedIndexArray(this);
|
|
2238
|
+
}
|
|
2239
|
+
merge(other, conflictResolver) {
|
|
2240
|
+
for (const [id, value] of other.entries()) {
|
|
2241
|
+
if (this.has(id) && conflictResolver) {
|
|
2242
|
+
this.set(id, conflictResolver(this.get(id), value, id));
|
|
2243
|
+
} else {
|
|
2244
|
+
this.set(id, value);
|
|
2245
|
+
}
|
|
2246
|
+
}
|
|
2247
|
+
return this;
|
|
2248
|
+
}
|
|
2249
|
+
some(fn) {
|
|
2250
|
+
for (const [id, value] of this.entries()) {
|
|
2251
|
+
if (fn(value, id)) return true;
|
|
2252
|
+
}
|
|
2253
|
+
return false;
|
|
2254
|
+
}
|
|
2255
|
+
every(fn) {
|
|
2256
|
+
for (const [id, value] of this.entries()) {
|
|
2257
|
+
if (!fn(value, id)) return false;
|
|
2258
|
+
}
|
|
2259
|
+
return true;
|
|
2260
|
+
}
|
|
2261
|
+
filter(predicate) {
|
|
2262
|
+
const result = new this.constructor();
|
|
2263
|
+
for (const [id, value] of this.entries()) {
|
|
2264
|
+
if (predicate(value, id, this)) result.set(id, value);
|
|
2265
|
+
}
|
|
2266
|
+
return result;
|
|
2267
|
+
}
|
|
2268
|
+
reduce(fn, init) {
|
|
2269
|
+
let iterator = this.entries();
|
|
2270
|
+
let first = iterator.next();
|
|
2271
|
+
if (first.done) {
|
|
2272
|
+
if (arguments.length < 2) {
|
|
2273
|
+
throw new TypeError("Reduce of empty SignedIndexArray with no initial value!");
|
|
2274
|
+
}
|
|
2275
|
+
return init;
|
|
2276
|
+
}
|
|
2277
|
+
let acc;
|
|
2278
|
+
let start;
|
|
2279
|
+
if (arguments.length < 2) {
|
|
2280
|
+
acc = first.value[1];
|
|
2281
|
+
start = iterator.next();
|
|
2282
|
+
} else {
|
|
2283
|
+
acc = init;
|
|
2284
|
+
start = first;
|
|
2285
|
+
}
|
|
2286
|
+
for (let current = start; !current.done; current = iterator.next()) {
|
|
2287
|
+
const [id, value] = current.value;
|
|
2288
|
+
acc = fn(acc, value, id);
|
|
2289
|
+
}
|
|
2290
|
+
return acc;
|
|
2291
|
+
}
|
|
2292
|
+
mapToArray(fn) {
|
|
2293
|
+
let result = [];
|
|
2294
|
+
for (const [id, value] of this.entries()) {
|
|
2295
|
+
result.push(fn(value, id));
|
|
2296
|
+
}
|
|
2297
|
+
return result;
|
|
2298
|
+
}
|
|
2299
|
+
map(fn) {
|
|
2300
|
+
let result = new _SignedIndexArray();
|
|
2301
|
+
for (const [id, value] of this.entries()) {
|
|
2302
|
+
result.set(id, fn(value, id));
|
|
2303
|
+
}
|
|
2304
|
+
return result;
|
|
2305
|
+
}
|
|
2306
|
+
equals(other, eq) {
|
|
2307
|
+
if (this.size !== other.size) return false;
|
|
2308
|
+
eq != null ? eq : eq = (a, b) => a === b;
|
|
2309
|
+
const posLen = Math.max(this.posLen, other.posLen);
|
|
2310
|
+
for (let i = 0; i < posLen; ++i) {
|
|
2311
|
+
const hasA = this.hasPos[i];
|
|
2312
|
+
const hasB = other.hasPos[i];
|
|
2313
|
+
if (hasA !== hasB) return false;
|
|
2314
|
+
if (hasA && !eq(this.posVal[i], other.posVal[i])) return false;
|
|
2315
|
+
}
|
|
2316
|
+
const negLen = Math.max(this.negLen, other.negLen);
|
|
2317
|
+
for (let i = 0; i < negLen; ++i) {
|
|
2318
|
+
const hasA = this.hasNeg[i];
|
|
2319
|
+
const hasB = other.hasNeg[i];
|
|
2320
|
+
if (hasA !== hasB) return false;
|
|
2321
|
+
if (hasA && !eq(this.negVal[i], other.negVal[i])) return false;
|
|
2322
|
+
}
|
|
2323
|
+
return true;
|
|
2324
|
+
}
|
|
2325
|
+
toArray() {
|
|
2326
|
+
return this.valuesArray();
|
|
2327
|
+
}
|
|
2328
|
+
toString() {
|
|
2329
|
+
let isRegularArray = this.hasNeg.length === 0;
|
|
2330
|
+
for (let i = 0; i < this.hasPos.length && isRegularArray; i++)
|
|
2331
|
+
if (!this.hasPos[i]) isRegularArray = false;
|
|
2332
|
+
if (isRegularArray)
|
|
2333
|
+
return stringify(this.posVal.slice(0, this.hasPos.length));
|
|
2334
|
+
const entries = this.entriesArray().map(([id, v]) => `${stringify(id)}: ${stringify(v)}`).join(", ");
|
|
2335
|
+
return entries.length === 0 ? `[ ]` : `[ ${entries} ]`;
|
|
2336
|
+
}
|
|
2337
|
+
};
|
|
2338
|
+
var UniMap = class _UniMap extends BaseContainer {
|
|
2339
|
+
constructor(...args) {
|
|
2340
|
+
super();
|
|
2341
|
+
__publicField2(this, "map");
|
|
2342
|
+
__publicField2(this, "keyEquals");
|
|
2343
|
+
const maybeEquals = args.at(-1);
|
|
2344
|
+
this.keyEquals = isFunction(maybeEquals) ? args.pop() : DefaultEqualityFn;
|
|
2345
|
+
const entries = args[0];
|
|
2346
|
+
this.map = new Map(entries);
|
|
2347
|
+
}
|
|
2348
|
+
static createDeep(arg) {
|
|
2349
|
+
return arg ? new _UniMap(arg, isDeepEqual) : new _UniMap(isDeepEqual);
|
|
2350
|
+
}
|
|
2351
|
+
has(key) {
|
|
2352
|
+
if (this.keyEquals === DefaultEqualityFn || this.map.has(key))
|
|
2353
|
+
return this.map.has(key);
|
|
2354
|
+
for (const [k, v] of this.map)
|
|
2355
|
+
if (this.keyEquals(k, key))
|
|
2356
|
+
return true;
|
|
2357
|
+
return false;
|
|
2358
|
+
}
|
|
2359
|
+
set(key, value) {
|
|
2360
|
+
if (this.keyEquals === DefaultEqualityFn || this.map.has(key)) {
|
|
2361
|
+
this.map.set(key, value);
|
|
2362
|
+
return value;
|
|
2363
|
+
}
|
|
2364
|
+
for (const key2 of this.map.keys())
|
|
2365
|
+
if (this.keyEquals(key2, key)) {
|
|
2366
|
+
this.map.set(key2, value);
|
|
2367
|
+
return value;
|
|
2368
|
+
}
|
|
2369
|
+
this.map.set(key, value);
|
|
2370
|
+
return value;
|
|
2371
|
+
}
|
|
2372
|
+
get(key) {
|
|
2373
|
+
if (this.keyEquals === DefaultEqualityFn || this.map.has(key))
|
|
2374
|
+
return this.map.get(key);
|
|
2375
|
+
for (const [k, v] of this.map)
|
|
2376
|
+
if (this.keyEquals(k, key))
|
|
2377
|
+
return v;
|
|
2378
|
+
return void 0;
|
|
2379
|
+
}
|
|
2380
|
+
delete(key) {
|
|
2381
|
+
if (this.keyEquals === DefaultEqualityFn || this.map.has(key))
|
|
2382
|
+
return this.map.delete(key);
|
|
2383
|
+
for (const k of this.map.keys())
|
|
2384
|
+
if (this.keyEquals(k, key))
|
|
2385
|
+
return this.map.delete(k);
|
|
2386
|
+
return this.map.delete(key);
|
|
2387
|
+
}
|
|
2388
|
+
getOrDefault(key, defaultValue) {
|
|
2389
|
+
var _a;
|
|
2390
|
+
return (_a = this.get(key)) != null ? _a : defaultValue;
|
|
2391
|
+
}
|
|
2392
|
+
getOrCreate(key, creatorOrValue) {
|
|
2393
|
+
if (!this.has(key)) {
|
|
2394
|
+
const value = isFunction(creatorOrValue) ? creatorOrValue() : creatorOrValue;
|
|
2395
|
+
return this.set(key, value);
|
|
2396
|
+
}
|
|
2397
|
+
return this.get(key);
|
|
2398
|
+
}
|
|
2399
|
+
clear() {
|
|
2400
|
+
this.map.clear();
|
|
2401
|
+
}
|
|
2402
|
+
get size() {
|
|
2403
|
+
return this.map.size;
|
|
2404
|
+
}
|
|
2405
|
+
isEmpty() {
|
|
2406
|
+
return this.size === 0;
|
|
2407
|
+
}
|
|
2408
|
+
forEach(callbackfn, thisArg) {
|
|
2409
|
+
this.map.forEach((value, key) => callbackfn.call(thisArg, value, key, this));
|
|
2410
|
+
}
|
|
2411
|
+
*keys() {
|
|
2412
|
+
yield* __yieldStar(this.map.keys());
|
|
2413
|
+
}
|
|
2414
|
+
*values() {
|
|
2415
|
+
yield* __yieldStar(this.map.values());
|
|
2416
|
+
}
|
|
2417
|
+
*entries() {
|
|
2418
|
+
for (const [key, value] of this.map)
|
|
2419
|
+
yield [key, value];
|
|
2420
|
+
}
|
|
2421
|
+
keysArray() {
|
|
2422
|
+
return [...this.keys()];
|
|
2423
|
+
}
|
|
2424
|
+
valuesArray() {
|
|
2425
|
+
return [...this.values()];
|
|
2426
|
+
}
|
|
2427
|
+
entriesArray() {
|
|
2428
|
+
return [...this.entries()];
|
|
2429
|
+
}
|
|
2430
|
+
*kvKeys() {
|
|
2431
|
+
for (const key of this.keys()) {
|
|
2432
|
+
yield [key];
|
|
2433
|
+
}
|
|
2434
|
+
}
|
|
2435
|
+
*kvValues() {
|
|
2436
|
+
for (const el of this.values()) {
|
|
2437
|
+
yield el;
|
|
2438
|
+
}
|
|
2439
|
+
}
|
|
2440
|
+
*kvEntries() {
|
|
2441
|
+
for (const [key, el] of this.entries()) {
|
|
2442
|
+
yield [[key], el];
|
|
2443
|
+
}
|
|
2444
|
+
}
|
|
2445
|
+
*[Symbol.iterator]() {
|
|
2446
|
+
yield* __yieldStar(this.entries());
|
|
2447
|
+
}
|
|
2448
|
+
clone() {
|
|
2449
|
+
return new _UniMap(this, this.keyEquals);
|
|
2450
|
+
}
|
|
2451
|
+
merge(other, conflictResolver) {
|
|
2452
|
+
for (const [key, value] of other.entries()) {
|
|
2453
|
+
if (this.has(key) && conflictResolver) {
|
|
2454
|
+
this.set(key, conflictResolver(this.get(key), value, key));
|
|
2455
|
+
} else {
|
|
2456
|
+
this.set(key, value);
|
|
2457
|
+
}
|
|
2458
|
+
}
|
|
2459
|
+
return this;
|
|
2460
|
+
}
|
|
2461
|
+
some(fn) {
|
|
2462
|
+
for (const [key, value] of this.map) {
|
|
2463
|
+
if (fn(value, key)) return true;
|
|
2464
|
+
}
|
|
2465
|
+
return false;
|
|
2466
|
+
}
|
|
2467
|
+
every(fn) {
|
|
2468
|
+
for (const [key, value] of this.map) {
|
|
2469
|
+
if (!fn(value, key)) return false;
|
|
2470
|
+
}
|
|
2471
|
+
return true;
|
|
2472
|
+
}
|
|
2473
|
+
filter(predicate) {
|
|
2474
|
+
const result = new this.constructor();
|
|
2475
|
+
for (const [key, value] of this.map) {
|
|
2476
|
+
if (predicate(value, key, this)) result.set(key, value);
|
|
2477
|
+
}
|
|
2478
|
+
return result;
|
|
2479
|
+
}
|
|
2480
|
+
reduce(fn, init) {
|
|
2481
|
+
let iterator = this.entries();
|
|
2482
|
+
let first = iterator.next();
|
|
2483
|
+
if (first.done) {
|
|
2484
|
+
if (arguments.length < 2) {
|
|
2485
|
+
throw new TypeError("Reduce of empty UniMap with no initial value!");
|
|
2486
|
+
}
|
|
2487
|
+
return init;
|
|
2488
|
+
}
|
|
2489
|
+
let acc;
|
|
2490
|
+
let start;
|
|
2491
|
+
if (arguments.length < 2) {
|
|
2492
|
+
acc = first.value[1];
|
|
2493
|
+
start = iterator.next();
|
|
2494
|
+
} else {
|
|
2495
|
+
acc = init;
|
|
2496
|
+
start = first;
|
|
2497
|
+
}
|
|
2498
|
+
for (let current = start; !current.done; current = iterator.next()) {
|
|
2499
|
+
const [key, value] = current.value;
|
|
2500
|
+
acc = fn(acc, value, key);
|
|
2501
|
+
}
|
|
2502
|
+
return acc;
|
|
2503
|
+
}
|
|
2504
|
+
mapEntries(fn) {
|
|
2505
|
+
let result = [];
|
|
2506
|
+
for (const [key, value] of this.map) {
|
|
2507
|
+
result.push(fn(value, key));
|
|
2508
|
+
}
|
|
2509
|
+
return result;
|
|
2510
|
+
}
|
|
2511
|
+
mapValues(fn) {
|
|
2512
|
+
let result = new _UniMap();
|
|
2513
|
+
for (const [key, value] of this.map) {
|
|
2514
|
+
result.set(key, fn(value, key));
|
|
2515
|
+
}
|
|
2516
|
+
return result;
|
|
2517
|
+
}
|
|
2518
|
+
toMap() {
|
|
2519
|
+
return new Map(this.map);
|
|
2520
|
+
}
|
|
2521
|
+
toString() {
|
|
2522
|
+
const entries = [...this.map].map(([k, v]) => `${stringify(k)} => ${stringify(v)}`).join(", ");
|
|
2523
|
+
return entries.length === 0 ? `Map(${this.size}){ }` : `Map(${this.size}){ ${entries} }`;
|
|
17
2524
|
}
|
|
18
|
-
return to;
|
|
19
2525
|
};
|
|
20
|
-
var __toCommonJS = (mod2) => __copyProps(__defProp({}, "__esModule", { value: true }), mod2);
|
|
21
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
22
|
-
|
|
23
|
-
// src/theory/index.ts
|
|
24
|
-
var theory_exports = {};
|
|
25
|
-
__export(theory_exports, {
|
|
26
|
-
AccidentalType: () => AccidentalType,
|
|
27
|
-
BeamGrouping: () => BeamGrouping,
|
|
28
|
-
Chord: () => Chord,
|
|
29
|
-
DefaultGuitarNoteLabel: () => DefaultGuitarNoteLabel,
|
|
30
|
-
DefaultHandedness: () => DefaultHandedness,
|
|
31
|
-
DefaultPitchNotation: () => DefaultPitchNotation,
|
|
32
|
-
DefaultTuningName: () => DefaultTuningName,
|
|
33
|
-
GuitarNoteLabel: () => GuitarNoteLabel,
|
|
34
|
-
GuitarNoteLabelList: () => GuitarNoteLabelList,
|
|
35
|
-
Handedness: () => Handedness,
|
|
36
|
-
Interval: () => Interval,
|
|
37
|
-
KeySignature: () => KeySignature,
|
|
38
|
-
Mode: () => Mode,
|
|
39
|
-
Note: () => Note,
|
|
40
|
-
NoteLength: () => NoteLength,
|
|
41
|
-
NoteLengthProps: () => NoteLengthProps,
|
|
42
|
-
PitchNotation: () => PitchNotation,
|
|
43
|
-
PitchNotationList: () => PitchNotationList,
|
|
44
|
-
RhythmProps: () => RhythmProps,
|
|
45
|
-
Scale: () => Scale,
|
|
46
|
-
ScaleFactory: () => ScaleFactory,
|
|
47
|
-
ScaleType: () => ScaleType,
|
|
48
|
-
SymbolSet: () => SymbolSet,
|
|
49
|
-
TimeSignature: () => TimeSignature,
|
|
50
|
-
TimeSignatures: () => TimeSignatures,
|
|
51
|
-
TuningNameList: () => TuningNameList,
|
|
52
|
-
Tuplet: () => Tuplet,
|
|
53
|
-
alterTempoSpeed: () => alterTempoSpeed,
|
|
54
|
-
getDefaultKeySignature: () => getDefaultKeySignature,
|
|
55
|
-
getDefaultScale: () => getDefaultScale,
|
|
56
|
-
getDefaultTempo: () => getDefaultTempo,
|
|
57
|
-
getDefaultTimeSignature: () => getDefaultTimeSignature,
|
|
58
|
-
getPitchNotationName: () => getPitchNotationName,
|
|
59
|
-
getScale: () => getScale,
|
|
60
|
-
getScaleFactory: () => getScaleFactory,
|
|
61
|
-
getScaleFactoryList: () => getScaleFactoryList,
|
|
62
|
-
getTempoString: () => getTempoString,
|
|
63
|
-
getTuningStrings: () => getTuningStrings,
|
|
64
|
-
isNoteLength: () => isNoteLength,
|
|
65
|
-
isTupletRatio: () => isTupletRatio,
|
|
66
|
-
validateGuitarNoteLabel: () => validateGuitarNoteLabel,
|
|
67
|
-
validateHandedness: () => validateHandedness,
|
|
68
|
-
validateIntervalQuality: () => validateIntervalQuality,
|
|
69
|
-
validateNoteLength: () => validateNoteLength,
|
|
70
|
-
validatePitchNotation: () => validatePitchNotation,
|
|
71
|
-
validateScaleType: () => validateScaleType,
|
|
72
|
-
validateTuningName: () => validateTuningName,
|
|
73
|
-
validateTupletRatio: () => validateTupletRatio
|
|
74
|
-
});
|
|
75
|
-
module.exports = __toCommonJS(theory_exports);
|
|
76
|
-
|
|
77
|
-
// src/theory/chord.ts
|
|
78
|
-
var import_ts_utils_lib6 = require("@tspro/ts-utils-lib");
|
|
79
|
-
|
|
80
|
-
// src/theory/note.ts
|
|
81
|
-
var import_ts_utils_lib2 = require("@tspro/ts-utils-lib");
|
|
82
2526
|
|
|
83
2527
|
// src/theory/types.ts
|
|
84
|
-
var import_ts_utils_lib = require("@tspro/ts-utils-lib");
|
|
85
2528
|
var import_core = require("@tspro/web-music-score/core");
|
|
86
2529
|
var SymbolSet = /* @__PURE__ */ ((SymbolSet2) => {
|
|
87
2530
|
SymbolSet2[SymbolSet2["Ascii"] = 0] = "Ascii";
|
|
@@ -93,10 +2536,10 @@ var PitchNotation = /* @__PURE__ */ ((PitchNotation2) => {
|
|
|
93
2536
|
PitchNotation2[PitchNotation2["Helmholtz"] = 1] = "Helmholtz";
|
|
94
2537
|
return PitchNotation2;
|
|
95
2538
|
})(PitchNotation || {});
|
|
96
|
-
var PitchNotationList =
|
|
2539
|
+
var PitchNotationList = utils_exports.Enum.getEnumValues(PitchNotation);
|
|
97
2540
|
var DefaultPitchNotation = 0 /* Scientific */;
|
|
98
2541
|
function validatePitchNotation(pn) {
|
|
99
|
-
if (
|
|
2542
|
+
if (guard_exports.isEnumValue(pn, PitchNotation)) {
|
|
100
2543
|
return pn;
|
|
101
2544
|
} else {
|
|
102
2545
|
throw new import_core.MusicError(import_core.MusicErrorType.InvalidArg, `Invalid pitchNotation: ${pn}`);
|
|
@@ -112,9 +2555,9 @@ var GuitarNoteLabel = /* @__PURE__ */ ((GuitarNoteLabel2) => {
|
|
|
112
2555
|
return GuitarNoteLabel2;
|
|
113
2556
|
})(GuitarNoteLabel || {});
|
|
114
2557
|
var DefaultGuitarNoteLabel = "Default" /* Default */;
|
|
115
|
-
var GuitarNoteLabelList =
|
|
2558
|
+
var GuitarNoteLabelList = utils_exports.Enum.getEnumValues(GuitarNoteLabel);
|
|
116
2559
|
function validateGuitarNoteLabel(label) {
|
|
117
|
-
if (
|
|
2560
|
+
if (guard_exports.isEnumValue(label, GuitarNoteLabel)) {
|
|
118
2561
|
return label;
|
|
119
2562
|
} else {
|
|
120
2563
|
throw new import_core.MusicError(import_core.MusicErrorType.Timesignature, `Invalid guitarNoteLabel: ${label}`);
|
|
@@ -123,7 +2566,7 @@ function validateGuitarNoteLabel(label) {
|
|
|
123
2566
|
|
|
124
2567
|
// src/theory/note.ts
|
|
125
2568
|
var import_core2 = require("@tspro/web-music-score/core");
|
|
126
|
-
function
|
|
2569
|
+
function mod2(n, m) {
|
|
127
2570
|
return (n % m + m) % m;
|
|
128
2571
|
}
|
|
129
2572
|
var C0_chromaticId = 12;
|
|
@@ -255,7 +2698,7 @@ var _Note = class _Note {
|
|
|
255
2698
|
}
|
|
256
2699
|
static getDiatonicClass(arg) {
|
|
257
2700
|
if (typeof arg === "number") {
|
|
258
|
-
return
|
|
2701
|
+
return mod2(arg, 7);
|
|
259
2702
|
} else if (typeof arg === "string" && arg.length > 0) {
|
|
260
2703
|
return NoteLetters.indexOf(_Note.validateNoteLetter(arg[0]));
|
|
261
2704
|
} else {
|
|
@@ -285,7 +2728,7 @@ var _Note = class _Note {
|
|
|
285
2728
|
* @returns - Chromatic class.
|
|
286
2729
|
*/
|
|
287
2730
|
static getChromaticClass(chromaticId) {
|
|
288
|
-
return
|
|
2731
|
+
return mod2(chromaticId, 12);
|
|
289
2732
|
}
|
|
290
2733
|
/**
|
|
291
2734
|
* Get octave from chromatic id.
|
|
@@ -325,11 +2768,11 @@ var _Note = class _Note {
|
|
|
325
2768
|
* @param symbolSet - Symbol set.
|
|
326
2769
|
* @returns - String with updated accidental symbols.
|
|
327
2770
|
*/
|
|
328
|
-
static replaceAccidentalSymbols(
|
|
2771
|
+
static replaceAccidentalSymbols(str2, symbolSet) {
|
|
329
2772
|
if (symbolSet === 1 /* Unicode */) {
|
|
330
|
-
return
|
|
2773
|
+
return str2.replace("bb", "\u{1D12B}").replace("b", "\u266D").replace("#", "\u266F").replace("x", "\u{1D12A}");
|
|
331
2774
|
} else {
|
|
332
|
-
return
|
|
2775
|
+
return str2.replace("\u{1D12B}", "bb").replace("\u266D", "b").replace("\u266F", "#").replace("\u{1D12A}", "x");
|
|
333
2776
|
}
|
|
334
2777
|
}
|
|
335
2778
|
/**
|
|
@@ -420,7 +2863,7 @@ var _Note = class _Note {
|
|
|
420
2863
|
* @returns - Valid diatonic id or throws.
|
|
421
2864
|
*/
|
|
422
2865
|
static validateDiatonicId(diatonicId) {
|
|
423
|
-
if (
|
|
2866
|
+
if (guard_exports.isInteger(diatonicId)) {
|
|
424
2867
|
return diatonicId;
|
|
425
2868
|
} else {
|
|
426
2869
|
throw new import_core2.MusicError(import_core2.MusicErrorType.Note, `Invalid diatonicId: ${diatonicId}`);
|
|
@@ -432,7 +2875,7 @@ var _Note = class _Note {
|
|
|
432
2875
|
* @returns - Valid diatonic class or throws.
|
|
433
2876
|
*/
|
|
434
2877
|
static validateDiatonicClass(diatonicClass) {
|
|
435
|
-
if (
|
|
2878
|
+
if (guard_exports.isIntegerBetween(diatonicClass, 0, 6)) {
|
|
436
2879
|
return diatonicClass;
|
|
437
2880
|
} else {
|
|
438
2881
|
throw new import_core2.MusicError(import_core2.MusicErrorType.Note, `Invalid diatonicClass: ${diatonicClass}`);
|
|
@@ -444,7 +2887,7 @@ var _Note = class _Note {
|
|
|
444
2887
|
* @returns - Valid chromatic id, or throws.
|
|
445
2888
|
*/
|
|
446
2889
|
static validateChromaticId(chromaticId) {
|
|
447
|
-
if (
|
|
2890
|
+
if (guard_exports.isInteger(chromaticId)) {
|
|
448
2891
|
return chromaticId;
|
|
449
2892
|
} else {
|
|
450
2893
|
throw new import_core2.MusicError(import_core2.MusicErrorType.Note, `Invalid chromaticId: ${chromaticId}`);
|
|
@@ -456,7 +2899,7 @@ var _Note = class _Note {
|
|
|
456
2899
|
* @returns - Valid chromatic class, or throws.
|
|
457
2900
|
*/
|
|
458
2901
|
static validatechromaticClass(chromaticClass) {
|
|
459
|
-
if (
|
|
2902
|
+
if (guard_exports.isIntegerBetween(chromaticClass, 0, 11)) {
|
|
460
2903
|
return chromaticClass;
|
|
461
2904
|
} else {
|
|
462
2905
|
throw new import_core2.MusicError(import_core2.MusicErrorType.Note, `Invalid chromaticClass: ${chromaticClass}`);
|
|
@@ -480,7 +2923,7 @@ var _Note = class _Note {
|
|
|
480
2923
|
* @returns - Valid octave or throws.
|
|
481
2924
|
*/
|
|
482
2925
|
static validateOctave(octave) {
|
|
483
|
-
if (
|
|
2926
|
+
if (guard_exports.isInteger(octave)) {
|
|
484
2927
|
return octave;
|
|
485
2928
|
} else {
|
|
486
2929
|
throw new import_core2.MusicError(import_core2.MusicErrorType.Note, `Invalid octave: ${octave}`);
|
|
@@ -492,7 +2935,7 @@ var _Note = class _Note {
|
|
|
492
2935
|
* @returns - Valid accidental or thorws.
|
|
493
2936
|
*/
|
|
494
2937
|
static validateAccidental(acc) {
|
|
495
|
-
if (
|
|
2938
|
+
if (guard_exports.isIntegerBetween(acc, -2, 2)) {
|
|
496
2939
|
return acc;
|
|
497
2940
|
} else {
|
|
498
2941
|
throw new import_core2.MusicError(import_core2.MusicErrorType.Note, `Invalid accidental: ${acc}`);
|
|
@@ -542,15 +2985,11 @@ var _Note = class _Note {
|
|
|
542
2985
|
}
|
|
543
2986
|
}
|
|
544
2987
|
};
|
|
545
|
-
__publicField(_Note, "noteCache", new
|
|
546
|
-
__publicField(_Note, "chromaticNoteCache", new
|
|
2988
|
+
__publicField(_Note, "noteCache", new UniMap());
|
|
2989
|
+
__publicField(_Note, "chromaticNoteCache", new UniMap());
|
|
547
2990
|
var Note = _Note;
|
|
548
2991
|
|
|
549
|
-
// src/theory/scale.ts
|
|
550
|
-
var import_ts_utils_lib5 = require("@tspro/ts-utils-lib");
|
|
551
|
-
|
|
552
2992
|
// src/theory/key-signature.ts
|
|
553
|
-
var import_ts_utils_lib3 = require("@tspro/ts-utils-lib");
|
|
554
2993
|
var import_core3 = require("@tspro/web-music-score/core");
|
|
555
2994
|
function getAccidental(chromaticId, diatonicId) {
|
|
556
2995
|
let a = Note.getChromaticClass(chromaticId) - new Note(diatonicId, 0).chromaticClass;
|
|
@@ -571,7 +3010,7 @@ function parseDegree(degree) {
|
|
|
571
3010
|
}
|
|
572
3011
|
let acc = (_b = Note.getAccidental((_a = m[1]) != null ? _a : "")) != null ? _b : 0;
|
|
573
3012
|
let deg = +m[2];
|
|
574
|
-
if (!
|
|
3013
|
+
if (!guard_exports.isInteger(acc) || acc < -2 || acc > 2 || !guard_exports.isInteger(deg) || deg < 1) {
|
|
575
3014
|
throw new import_core3.MusicError(import_core3.MusicErrorType.KeySignature, `Invalid degree: ${degree}`);
|
|
576
3015
|
} else {
|
|
577
3016
|
return { deg, acc };
|
|
@@ -607,7 +3046,7 @@ var _KeySignature = class _KeySignature {
|
|
|
607
3046
|
__publicField(this, "naturalScaleNotes");
|
|
608
3047
|
__publicField(this, "accidentalByDiatonicClass");
|
|
609
3048
|
__publicField(this, "orderedAccidentedNotes");
|
|
610
|
-
if (!
|
|
3049
|
+
if (!guard_exports.isEnumValue(mode, Mode)) {
|
|
611
3050
|
throw new import_core3.MusicError(import_core3.MusicErrorType.KeySignature, `Invalid mode: ${mode}`);
|
|
612
3051
|
}
|
|
613
3052
|
let intervals = [2, 2, 1, 2, 2, 2, 1];
|
|
@@ -725,9 +3164,8 @@ __publicField(_KeySignature, "OrderOfFlats", "BEADGCF");
|
|
|
725
3164
|
var KeySignature = _KeySignature;
|
|
726
3165
|
|
|
727
3166
|
// src/theory/interval.ts
|
|
728
|
-
var import_ts_utils_lib4 = require("@tspro/ts-utils-lib");
|
|
729
3167
|
var import_core4 = require("@tspro/web-music-score/core");
|
|
730
|
-
var IntervalQualityAbbrMap = new
|
|
3168
|
+
var IntervalQualityAbbrMap = new UniMap([
|
|
731
3169
|
["Major", "M"],
|
|
732
3170
|
["minor", "m"],
|
|
733
3171
|
["Perfect", "P"],
|
|
@@ -830,10 +3268,10 @@ function validateIntervalQuality(q) {
|
|
|
830
3268
|
}
|
|
831
3269
|
}
|
|
832
3270
|
function formatQuantity(q) {
|
|
833
|
-
if (!
|
|
3271
|
+
if (!guard_exports.isIntegerGte(q, 1)) {
|
|
834
3272
|
throw new import_core4.MusicError(import_core4.MusicErrorType.InvalidArg, `Invalid interval quantity: ${q}`);
|
|
835
3273
|
} else {
|
|
836
|
-
return
|
|
3274
|
+
return utils_exports.Math.toOrdinalNumber(q);
|
|
837
3275
|
}
|
|
838
3276
|
}
|
|
839
3277
|
var InvalidIntervalException = class extends Error {
|
|
@@ -1010,7 +3448,7 @@ var Scale = class extends KeySignature {
|
|
|
1010
3448
|
__publicField(this, "scaleNotes");
|
|
1011
3449
|
/** Degrees (or undefined) of chromatic classes. */
|
|
1012
3450
|
__publicField(this, "chromaticClassDegree");
|
|
1013
|
-
__publicField(this, "preferredChromaticIdNoteCache", new
|
|
3451
|
+
__publicField(this, "preferredChromaticIdNoteCache", new SignedIndexArray());
|
|
1014
3452
|
switch (scaleType) {
|
|
1015
3453
|
case "Harmonic Minor" /* HarmonicMinor */:
|
|
1016
3454
|
this.scaleDegrees = [1, 2, 3, 4, 5, 6, "#7"];
|
|
@@ -1075,7 +3513,7 @@ var Scale = class extends KeySignature {
|
|
|
1075
3513
|
* @returns - Array of scale notes.
|
|
1076
3514
|
*/
|
|
1077
3515
|
getScaleNotes(bottomNote, numOctaves) {
|
|
1078
|
-
if (!
|
|
3516
|
+
if (!guard_exports.isIntegerGte(numOctaves, 1)) {
|
|
1079
3517
|
throw new import_core5.MusicError(import_core5.MusicErrorType.Scale, `Invalid numOctaves: ${numOctaves}`);
|
|
1080
3518
|
}
|
|
1081
3519
|
let scaleNoteList = [];
|
|
@@ -1104,7 +3542,7 @@ var Scale = class extends KeySignature {
|
|
|
1104
3542
|
let chromaticIds = this.getScaleNotes("C4", 1).map((note) => note.chromaticId);
|
|
1105
3543
|
let steps = [];
|
|
1106
3544
|
for (let i = 0; i < chromaticIds.length - 1; i++) {
|
|
1107
|
-
steps.push(
|
|
3545
|
+
steps.push(utils_exports.Math.mod(chromaticIds[i + 1] - chromaticIds[i], 12));
|
|
1108
3546
|
}
|
|
1109
3547
|
return steps;
|
|
1110
3548
|
}
|
|
@@ -1314,7 +3752,7 @@ var ScaleFactoryList = [
|
|
|
1314
3752
|
function getScaleFactoryList() {
|
|
1315
3753
|
return ScaleFactoryList;
|
|
1316
3754
|
}
|
|
1317
|
-
var ScaleFactoryMap = new
|
|
3755
|
+
var ScaleFactoryMap = new UniMap();
|
|
1318
3756
|
ScaleFactoryList.forEach((factory) => {
|
|
1319
3757
|
if (factory instanceof ScaleFactory) {
|
|
1320
3758
|
ScaleFactoryMap.set(factory.getType(), factory);
|
|
@@ -1329,7 +3767,7 @@ function getScaleFactory(scaleType) {
|
|
|
1329
3767
|
}
|
|
1330
3768
|
}
|
|
1331
3769
|
function validateScaleType(scaleType) {
|
|
1332
|
-
if (
|
|
3770
|
+
if (guard_exports.isEnumValue(scaleType, ScaleType)) {
|
|
1333
3771
|
return scaleType;
|
|
1334
3772
|
} else {
|
|
1335
3773
|
throw new import_core5.MusicError(import_core5.MusicErrorType.Scale, `Invalid scaleType: "${scaleType}"`);
|
|
@@ -1373,7 +3811,7 @@ var OkayRootNoteList = [
|
|
|
1373
3811
|
"B",
|
|
1374
3812
|
"Cb"
|
|
1375
3813
|
].map((noteName) => Note.getNote(noteName + "0"));
|
|
1376
|
-
var okayRootNoteCache = new
|
|
3814
|
+
var okayRootNoteCache = new IndexArray();
|
|
1377
3815
|
function getOkayRootNote(wantedRootNote) {
|
|
1378
3816
|
return okayRootNoteCache.getOrCreate(wantedRootNote.chromaticClass, () => {
|
|
1379
3817
|
let rootNote = OkayRootNoteList.find((note) => isEqualNote(note, wantedRootNote));
|
|
@@ -1389,7 +3827,7 @@ function getChordNoteByDegree(chordRootNote, degree) {
|
|
|
1389
3827
|
return ks.getNoteByDegree(degree);
|
|
1390
3828
|
}
|
|
1391
3829
|
function removeNoteDuplicates(notes) {
|
|
1392
|
-
return
|
|
3830
|
+
return utils_exports.Arr.removeDuplicates(notes, isEqualNote);
|
|
1393
3831
|
}
|
|
1394
3832
|
var ChordInfoList = [
|
|
1395
3833
|
// Power chord
|
|
@@ -1565,7 +4003,7 @@ var Chord = class _Chord {
|
|
|
1565
4003
|
getOmittedDegreesString() {
|
|
1566
4004
|
let omittedStrList = this.omitNotes.map((omit, i) => {
|
|
1567
4005
|
return omit ? this.getDegreeStr(i) + "(" + this.getNoteStr(i) + ")" : void 0;
|
|
1568
|
-
}).filter((
|
|
4006
|
+
}).filter((str2) => str2 !== void 0);
|
|
1569
4007
|
return omittedStrList.length > 0 ? "Omits " + omittedStrList.join(", ") : "";
|
|
1570
4008
|
}
|
|
1571
4009
|
/**
|
|
@@ -1586,9 +4024,6 @@ var Chord = class _Chord {
|
|
|
1586
4024
|
}
|
|
1587
4025
|
};
|
|
1588
4026
|
|
|
1589
|
-
// src/theory/guitar.ts
|
|
1590
|
-
var import_ts_utils_lib7 = require("@tspro/ts-utils-lib");
|
|
1591
|
-
|
|
1592
4027
|
// src/theory/assets/tunings.json
|
|
1593
4028
|
var tunings_default = {
|
|
1594
4029
|
list: [
|
|
@@ -1846,7 +4281,7 @@ var Handedness = /* @__PURE__ */ ((Handedness2) => {
|
|
|
1846
4281
|
})(Handedness || {});
|
|
1847
4282
|
var DefaultHandedness = 0 /* RightHanded */;
|
|
1848
4283
|
function validateHandedness(h) {
|
|
1849
|
-
if (
|
|
4284
|
+
if (guard_exports.isEnumValue(h, Handedness)) {
|
|
1850
4285
|
return h;
|
|
1851
4286
|
} else {
|
|
1852
4287
|
throw new import_core7.MusicError(import_core7.MusicErrorType.InvalidArg, `Invalid handedness: ${h}`);
|
|
@@ -1861,7 +4296,7 @@ function validateTuningName(tuningName) {
|
|
|
1861
4296
|
return tuningName;
|
|
1862
4297
|
}
|
|
1863
4298
|
}
|
|
1864
|
-
var TuningStringsCache = new
|
|
4299
|
+
var TuningStringsCache = new LRUCache(100);
|
|
1865
4300
|
function getTuningStrings(tuningName) {
|
|
1866
4301
|
let tuningStrings = TuningStringsCache.get(tuningName);
|
|
1867
4302
|
if (!tuningStrings) {
|
|
@@ -1870,7 +4305,7 @@ function getTuningStrings(tuningName) {
|
|
|
1870
4305
|
throw new import_core7.MusicError(import_core7.MusicErrorType.InvalidArg, `Invalid tuningName: ${tuningName}`);
|
|
1871
4306
|
}
|
|
1872
4307
|
tuningStrings = tuningData.strings.slice().reverse().map((noteName) => Note.getNote(noteName));
|
|
1873
|
-
if (!
|
|
4308
|
+
if (!guard_exports.isIntegerEq(tuningStrings.length, 6)) {
|
|
1874
4309
|
throw new import_core7.MusicError(import_core7.MusicErrorType.Unknown, `Tuning has ${tuningStrings.length} strings.`);
|
|
1875
4310
|
}
|
|
1876
4311
|
TuningStringsCache.set(tuningName, tuningStrings);
|
|
@@ -1878,11 +4313,7 @@ function getTuningStrings(tuningName) {
|
|
|
1878
4313
|
return tuningStrings;
|
|
1879
4314
|
}
|
|
1880
4315
|
|
|
1881
|
-
// src/theory/time-signature.ts
|
|
1882
|
-
var import_ts_utils_lib9 = require("@tspro/ts-utils-lib");
|
|
1883
|
-
|
|
1884
4316
|
// src/theory/rhythm.ts
|
|
1885
|
-
var import_ts_utils_lib8 = require("@tspro/ts-utils-lib");
|
|
1886
4317
|
var import_core8 = require("@tspro/web-music-score/core");
|
|
1887
4318
|
var MaxTupletRatioValue = 12;
|
|
1888
4319
|
var TicksMultiplier = 12 * 11 * 9 * 7 * 5;
|
|
@@ -1926,7 +4357,7 @@ var NoteLength = /* @__PURE__ */ ((NoteLength3) => {
|
|
|
1926
4357
|
return NoteLength3;
|
|
1927
4358
|
})(NoteLength || {});
|
|
1928
4359
|
function isNoteLength(noteLength) {
|
|
1929
|
-
return
|
|
4360
|
+
return guard_exports.isEnumValue(noteLength, NoteLength);
|
|
1930
4361
|
}
|
|
1931
4362
|
function validateNoteLength(noteLength) {
|
|
1932
4363
|
if (isNoteLength(noteLength)) {
|
|
@@ -1959,7 +4390,7 @@ var _NoteLengthProps = class _NoteLengthProps {
|
|
|
1959
4390
|
this.noteSize = parseInt(noteLength);
|
|
1960
4391
|
this.isTriplet = noteLength.endsWith("t");
|
|
1961
4392
|
this.maxDotCount = this.isTriplet ? 0 : Math.floor(Math.log2(_NoteLengthProps.ShortestNoteSize / this.noteSize));
|
|
1962
|
-
this.dotCount =
|
|
4393
|
+
this.dotCount = utils_exports.Str.charCount(noteLength, ".");
|
|
1963
4394
|
this.flagCount = this.noteSize > 4 ? Math.floor(Math.log2(this.noteSize / 4)) : 0;
|
|
1964
4395
|
this.ticks = TicksMultiplier * _NoteLengthProps.ShortestNoteSize / this.noteSize;
|
|
1965
4396
|
this.hasStem = this.noteSize > 1;
|
|
@@ -1986,7 +4417,7 @@ var _NoteLengthProps = class _NoteLengthProps {
|
|
|
1986
4417
|
*/
|
|
1987
4418
|
static create(noteLength, dotCount = 0) {
|
|
1988
4419
|
let noteSize = typeof noteLength === "number" ? noteLength : this.get(noteLength).noteSize;
|
|
1989
|
-
return this.get(noteSize + (
|
|
4420
|
+
return this.get(noteSize + (guard_exports.isIntegerGte(dotCount, 1) ? ".".repeat(dotCount) : "n"));
|
|
1990
4421
|
}
|
|
1991
4422
|
/**
|
|
1992
4423
|
* Compare note lengths/sizes. Whole (1) > half (2) > quarter (4), etc.
|
|
@@ -1998,7 +4429,7 @@ var _NoteLengthProps = class _NoteLengthProps {
|
|
|
1998
4429
|
static cmp(a, b) {
|
|
1999
4430
|
let aNoteSize = a instanceof _NoteLengthProps ? a.noteSize : typeof a === "number" ? a : _NoteLengthProps.get(a).noteSize;
|
|
2000
4431
|
let bNoteSize = b instanceof _NoteLengthProps ? b.noteSize : typeof b === "number" ? b : _NoteLengthProps.get(b).noteSize;
|
|
2001
|
-
return
|
|
4432
|
+
return utils_exports.Math.cmp(bNoteSize, aNoteSize);
|
|
2002
4433
|
}
|
|
2003
4434
|
/**
|
|
2004
4435
|
* Compare note lengths/sizes for equality.
|
|
@@ -2014,13 +4445,13 @@ var _NoteLengthProps = class _NoteLengthProps {
|
|
|
2014
4445
|
}
|
|
2015
4446
|
};
|
|
2016
4447
|
/** Longest note size (e.g. 1 = whole note). */
|
|
2017
|
-
__publicField(_NoteLengthProps, "LongestNoteSize", Math.min(...
|
|
4448
|
+
__publicField(_NoteLengthProps, "LongestNoteSize", Math.min(...utils_exports.Enum.getEnumValues(NoteLength).map((noteLength) => parseInt(noteLength))));
|
|
2018
4449
|
/** Shortest note size (e.g. 64 = sixtyfourth note). */
|
|
2019
|
-
__publicField(_NoteLengthProps, "ShortestNoteSize", Math.max(...
|
|
2020
|
-
__publicField(_NoteLengthProps, "cache", new
|
|
4450
|
+
__publicField(_NoteLengthProps, "ShortestNoteSize", Math.max(...utils_exports.Enum.getEnumValues(NoteLength).map((noteLength) => parseInt(noteLength))));
|
|
4451
|
+
__publicField(_NoteLengthProps, "cache", new UniMap());
|
|
2021
4452
|
var NoteLengthProps = _NoteLengthProps;
|
|
2022
4453
|
function isTupletRatio(tupletRatio) {
|
|
2023
|
-
return
|
|
4454
|
+
return guard_exports.isObject(tupletRatio) && guard_exports.isIntegerBetween(tupletRatio.parts, 2, MaxTupletRatioValue) && guard_exports.isIntegerBetween(tupletRatio.inTimeOf, 2, MaxTupletRatioValue);
|
|
2024
4455
|
}
|
|
2025
4456
|
function validateTupletRatio(tupletRatio) {
|
|
2026
4457
|
if (isTupletRatio(tupletRatio)) {
|
|
@@ -2063,7 +4494,7 @@ var _RhythmProps = class _RhythmProps {
|
|
|
2063
4494
|
this.dotCount = dotCount != null ? dotCount : p.dotCount;
|
|
2064
4495
|
this.hasStem = p.hasStem;
|
|
2065
4496
|
this.isSolidNoteHead = p.isSolid;
|
|
2066
|
-
if (
|
|
4497
|
+
if (guard_exports.isObject(tupletRatio)) {
|
|
2067
4498
|
this.tupletRatio = validateTupletRatio(tupletRatio);
|
|
2068
4499
|
} else if (p.isTriplet) {
|
|
2069
4500
|
this.tupletRatio = Tuplet.Triplet;
|
|
@@ -2112,7 +4543,7 @@ var _RhythmProps = class _RhythmProps {
|
|
|
2112
4543
|
* @returns - -1: a < b, 0: a === b, +1: a > b (duration comparisons)
|
|
2113
4544
|
*/
|
|
2114
4545
|
static cmp(a, b) {
|
|
2115
|
-
return
|
|
4546
|
+
return utils_exports.Math.cmp(a.ticks, b.ticks);
|
|
2116
4547
|
}
|
|
2117
4548
|
/**
|
|
2118
4549
|
* Compare duration equality of rhythm props.
|
|
@@ -2124,8 +4555,8 @@ var _RhythmProps = class _RhythmProps {
|
|
|
2124
4555
|
return a.ticks === b.ticks;
|
|
2125
4556
|
}
|
|
2126
4557
|
};
|
|
2127
|
-
__publicField(_RhythmProps, "NoteSymbolMap", new
|
|
2128
|
-
__publicField(_RhythmProps, "cache", new
|
|
4558
|
+
__publicField(_RhythmProps, "NoteSymbolMap", new IndexArray([[1, "\u{1D15D}"], [2, "\u{1D15E}"], [4, "\u{1D15F}"], [8, "\u{1D160}"], [16, "\u{1D161}"], [32, "\u{1D162}"], [64, "\u{1D163}"], [128, "\u{1D164}"]]));
|
|
4559
|
+
__publicField(_RhythmProps, "cache", new UniMap());
|
|
2129
4560
|
var RhythmProps = _RhythmProps;
|
|
2130
4561
|
|
|
2131
4562
|
// src/theory/time-signature.ts
|
|
@@ -2162,25 +4593,25 @@ var TimeSignature = class {
|
|
|
2162
4593
|
/** Beam groups (e.g. [[2], [2]] or [[2, 2], [2, 2]] (first try as [[4], [4]])). */
|
|
2163
4594
|
__publicField(this, "beamGroupSizes", []);
|
|
2164
4595
|
let beamGrouping;
|
|
2165
|
-
if (
|
|
4596
|
+
if (guard_exports.isEnumValue(args[0], TimeSignatures)) {
|
|
2166
4597
|
let parts = args[0].split("/");
|
|
2167
4598
|
this.beatCount = +parts[0];
|
|
2168
4599
|
this.beatSize = +parts[1];
|
|
2169
|
-
if (
|
|
4600
|
+
if (guard_exports.isEnumValue(args[1], BeamGrouping)) {
|
|
2170
4601
|
beamGrouping = args[1];
|
|
2171
4602
|
}
|
|
2172
|
-
} else if (
|
|
4603
|
+
} else if (guard_exports.isIntegerGte(args[0], 2) && guard_exports.isIntegerGte(args[1], 2)) {
|
|
2173
4604
|
this.beatCount = args[0];
|
|
2174
4605
|
this.beatSize = args[1];
|
|
2175
|
-
if (
|
|
4606
|
+
if (guard_exports.isEnumValue(args[2], BeamGrouping)) {
|
|
2176
4607
|
beamGrouping = args[2];
|
|
2177
4608
|
}
|
|
2178
4609
|
} else {
|
|
2179
4610
|
throw new import_core9.MusicError(import_core9.MusicErrorType.Timesignature, `Invalid args: ${args}`);
|
|
2180
4611
|
}
|
|
2181
|
-
if (!
|
|
4612
|
+
if (!guard_exports.isIntegerGte(this.beatCount, 1)) {
|
|
2182
4613
|
throw new import_core9.MusicError(import_core9.MusicErrorType.Timesignature, `Invalid beatCount: ${this.beatCount}`);
|
|
2183
|
-
} else if (!
|
|
4614
|
+
} else if (!guard_exports.isIntegerGte(this.beatSize, 1)) {
|
|
2184
4615
|
throw new import_core9.MusicError(import_core9.MusicErrorType.Timesignature, `Invalid beatSize: ${this.beatSize}`);
|
|
2185
4616
|
}
|
|
2186
4617
|
let { noteLength, ticks } = NoteLengthProps.create(this.beatSize);
|
|
@@ -2195,7 +4626,7 @@ var TimeSignature = class {
|
|
|
2195
4626
|
} else if (this.is(3, 8)) {
|
|
2196
4627
|
this.beamGroupSizes = [[3]];
|
|
2197
4628
|
} else if (this.is(5, 8)) {
|
|
2198
|
-
if (!
|
|
4629
|
+
if (!guard_exports.isUndefined(beamGrouping) && beamGrouping !== "2-3" /* _2_3 */ && beamGrouping !== "3-2" /* _3_2 */) {
|
|
2199
4630
|
throw new import_core9.MusicError(import_core9.MusicErrorType.Timesignature, `Invalid beam grouping "${beamGrouping}" for time signature "${this.toString()}".`);
|
|
2200
4631
|
} else {
|
|
2201
4632
|
this.beamGroupSizes = beamGrouping === "3-2" /* _3_2 */ ? [[3], [2]] : [[2], [3]];
|
|
@@ -2204,7 +4635,7 @@ var TimeSignature = class {
|
|
|
2204
4635
|
} else if (this.is(6, 8)) {
|
|
2205
4636
|
this.beamGroupSizes = [[3], [3]];
|
|
2206
4637
|
} else if (this.is(7, 8)) {
|
|
2207
|
-
if (!
|
|
4638
|
+
if (!guard_exports.isUndefined(beamGrouping) && beamGrouping !== "2-2-3" /* _2_2_3 */ && beamGrouping !== "3-2-2" /* _3_2_2 */) {
|
|
2208
4639
|
throw new import_core9.MusicError(import_core9.MusicErrorType.Timesignature, `Invalid beam grouping "${beamGrouping}" for time signature "${this.toString()}".`);
|
|
2209
4640
|
} else {
|
|
2210
4641
|
this.beamGroupSizes = beamGrouping === "3-2-2" /* _3_2_2 */ ? [[3], [2], [2]] : [[2], [2], [3]];
|
|
@@ -2318,4 +4749,13 @@ var import_core10 = require("@tspro/web-music-score/core");
|
|
|
2318
4749
|
validateTuningName,
|
|
2319
4750
|
validateTupletRatio
|
|
2320
4751
|
});
|
|
4752
|
+
/*! Bundled license information:
|
|
4753
|
+
|
|
4754
|
+
@tspro/ts-utils-lib/dist/index.mjs:
|
|
4755
|
+
(*!
|
|
4756
|
+
* TsUtilsLib v2.1.0 (esm)
|
|
4757
|
+
* (c) 2023–2025 PahkaSoft
|
|
4758
|
+
* Licensed under the MIT License
|
|
4759
|
+
*)
|
|
4760
|
+
*/
|
|
2321
4761
|
//# sourceMappingURL=index.js.map
|