@music-lyric-player/base 0.9.0 → 0.12.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.
@@ -1,32 +1,1207 @@
1
+ import { freezeObjectDeep as or, ConfigManager as lr, Event as cr } from "@music-lyric-player/utils";
1
2
  import "lodash-es";
2
- import { ConfigManager as c, Event as d } from "@music-lyric-player/utils";
3
- const o = {
4
- driver: "timer"
5
- }, m = "0.5.1";
6
- class r {
7
- get version() {
8
- return m;
9
- }
10
- type = "Incorrect";
3
+ const Wt = or({
4
+ driver: "animation",
5
+ bridgeActive: !0,
6
+ offset: {
7
+ global: 0,
8
+ useMeta: !0,
9
+ resetTempOnLyricChange: !0
10
+ }
11
+ }), es = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
12
+ __proto__: null,
13
+ DEFAULT: Wt
14
+ }, Symbol.toStringTag, { value: "Module" })), We = (t = 8) => {
15
+ const n = new Uint8Array(t);
16
+ if (typeof globalThis.crypto?.getRandomValues == "function")
17
+ crypto.getRandomValues(n);
18
+ else
19
+ for (let r = 0; r < n.length; r++)
20
+ n[r] = Math.floor(Math.random() * 256);
21
+ return Array.from(n).map((r) => r.toString(16).padStart(2, "0")).join("");
22
+ };
23
+ class W {
24
+ start = 0;
25
+ end = 0;
26
+ get duration() {
27
+ return this.end - this.start;
28
+ }
29
+ toJSON() {
30
+ return {
31
+ start: this.start,
32
+ end: this.end,
33
+ duration: this.duration
34
+ };
35
+ }
36
+ }
37
+ var Ye = /* @__PURE__ */ ((t) => (t.Normal = "Normal", t.Space = "Space", t))(Ye || {});
38
+ class Yt {
39
+ stress = !1;
40
+ }
41
+ class ur {
42
+ type = "Normal";
43
+ time = new W();
44
+ content = "";
45
+ extended = [];
46
+ config = new Yt();
47
+ }
48
+ class fr {
49
+ type = "Space";
50
+ count = 1;
51
+ }
52
+ var zt = /* @__PURE__ */ ((t) => (t.Unknown = "Unknown", t.Translate = "Translate", t.Roman = "Roman", t))(zt || {});
53
+ class hr {
54
+ type = "Unknown";
55
+ content = "";
56
+ }
57
+ var Jt = /* @__PURE__ */ ((t) => (t.Normal = "Normal", t.Interlude = "Interlude", t))(Jt || {});
58
+ class pr {
59
+ id = We(4).toUpperCase();
60
+ type = "Interlude";
61
+ time = new W();
62
+ }
63
+ class Kt {
64
+ words = [];
65
+ extended = [];
66
+ get original() {
67
+ return this.words.map((n) => n.type === Ye.Normal ? n.content : " ".repeat(n.count)).join("");
68
+ }
69
+ toJSON() {
70
+ return {
71
+ words: this.words,
72
+ extended: this.extended,
73
+ original: this.original
74
+ };
75
+ }
76
+ }
77
+ class Zt {
78
+ type = "Normal";
79
+ id = We(4).toUpperCase();
80
+ time = new W();
81
+ content = new Kt();
82
+ agent;
83
+ }
84
+ class Er extends Zt {
85
+ }
86
+ class mr extends Zt {
87
+ background;
88
+ }
89
+ var Qt = /* @__PURE__ */ ((t) => (t.Offset = "Offset", t.Duration = "Duration", t.Title = "Title", t.Singer = "Singer", t.Album = "Album", t.Creator = "Creator", t.Unknown = "Unknown", t))(Qt || {});
90
+ class F {
91
+ id = We(4).toUpperCase();
92
+ }
93
+ class dr extends F {
94
+ type = "Offset";
95
+ content = 0;
96
+ }
97
+ class Rr extends F {
98
+ type = "Duration";
99
+ content = 0;
100
+ }
101
+ class vr extends F {
102
+ type = "Title";
103
+ content = "";
104
+ }
105
+ class Ir extends F {
106
+ type = "Singer";
107
+ content = "";
108
+ }
109
+ class $r extends F {
110
+ type = "Album";
111
+ content = "";
112
+ }
113
+ class gr extends F {
114
+ type = "Creator";
115
+ content = {
116
+ role: "",
117
+ name: []
118
+ };
119
+ }
120
+ class Lr extends F {
121
+ type = "Unknown";
122
+ content = "";
123
+ }
124
+ class Tr {
125
+ id = "";
126
+ name = "";
127
+ count = 0;
128
+ }
129
+ class er {
130
+ // index in global
131
+ global = 0;
132
+ // index in block
133
+ block = 0;
134
+ }
135
+ class Nr {
136
+ id = "";
137
+ index = new er();
138
+ }
139
+ const tr = "0.6.0";
140
+ var rr = /* @__PURE__ */ ((t) => (t.Invalid = "Invalid", t.Normal = "Normal", t.Syllable = "Syllable", t.Pure = "Pure", t.Empty = "Empty", t.NoTime = "NoTime", t))(rr || {});
141
+ class Or {
142
+ version = tr;
143
+ type = "Invalid";
11
144
  metas = [];
12
145
  lines = [];
13
146
  agents = [];
14
- toJSON() {
15
- return {
16
- version: this.version,
17
- type: this.type,
18
- metas: this.metas,
19
- lines: this.lines,
20
- agents: this.agents
147
+ }
148
+ const M = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
149
+ __proto__: null,
150
+ Agent: Tr,
151
+ Extended: hr,
152
+ ExtendedType: zt,
153
+ Info: Or,
154
+ InfoType: rr,
155
+ LineAgent: Nr,
156
+ LineAgentIndex: er,
157
+ LineInterlude: pr,
158
+ LineNormal: mr,
159
+ LineNormalBackground: Er,
160
+ LineNormalContent: Kt,
161
+ LineType: Jt,
162
+ MetaAlbum: $r,
163
+ MetaCreator: gr,
164
+ MetaDuration: Rr,
165
+ MetaOffset: dr,
166
+ MetaSinger: Ir,
167
+ MetaTitle: vr,
168
+ MetaType: Qt,
169
+ MetaUnknown: Lr,
170
+ Time: W,
171
+ Version: tr,
172
+ WordNormal: ur,
173
+ WordNormalConfig: Yt,
174
+ WordSpace: fr,
175
+ WordType: Ye
176
+ }, Symbol.toStringTag, { value: "Module" }));
177
+ var H = { exports: {} }, se, tt;
178
+ function Y() {
179
+ if (tt) return se;
180
+ tt = 1;
181
+ const t = "2.0.0", n = 256, r = Number.MAX_SAFE_INTEGER || /* istanbul ignore next */
182
+ 9007199254740991, s = 16, i = n - 6;
183
+ return se = {
184
+ MAX_LENGTH: n,
185
+ MAX_SAFE_COMPONENT_LENGTH: s,
186
+ MAX_SAFE_BUILD_LENGTH: i,
187
+ MAX_SAFE_INTEGER: r,
188
+ RELEASE_TYPES: [
189
+ "major",
190
+ "premajor",
191
+ "minor",
192
+ "preminor",
193
+ "patch",
194
+ "prepatch",
195
+ "prerelease"
196
+ ],
197
+ SEMVER_SPEC_VERSION: t,
198
+ FLAG_INCLUDE_PRERELEASE: 1,
199
+ FLAG_LOOSE: 2
200
+ }, se;
201
+ }
202
+ var ne, rt;
203
+ function z() {
204
+ return rt || (rt = 1, ne = typeof process == "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...n) => console.error("SEMVER", ...n) : () => {
205
+ }), ne;
206
+ }
207
+ var st;
208
+ function B() {
209
+ return st || (st = 1, (function(t, n) {
210
+ const {
211
+ MAX_SAFE_COMPONENT_LENGTH: r,
212
+ MAX_SAFE_BUILD_LENGTH: s,
213
+ MAX_LENGTH: i
214
+ } = Y(), u = z();
215
+ n = t.exports = {};
216
+ const l = n.re = [], h = n.safeRe = [], o = n.src = [], a = n.safeSrc = [], e = n.t = {};
217
+ let c = 0;
218
+ const f = "[a-zA-Z0-9-]", d = [
219
+ ["\\s", 1],
220
+ ["\\d", i],
221
+ [f, s]
222
+ ], O = (N) => {
223
+ for (const [A, G] of d)
224
+ N = N.split(`${A}*`).join(`${A}{0,${G}}`).split(`${A}+`).join(`${A}{1,${G}}`);
225
+ return N;
226
+ }, E = (N, A, G) => {
227
+ const w = O(A), x = c++;
228
+ u(N, x, A), e[N] = x, o[x] = A, a[x] = w, l[x] = new RegExp(A, G ? "g" : void 0), h[x] = new RegExp(w, G ? "g" : void 0);
21
229
  };
230
+ E("NUMERICIDENTIFIER", "0|[1-9]\\d*"), E("NUMERICIDENTIFIERLOOSE", "\\d+"), E("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${f}*`), E("MAINVERSION", `(${o[e.NUMERICIDENTIFIER]})\\.(${o[e.NUMERICIDENTIFIER]})\\.(${o[e.NUMERICIDENTIFIER]})`), E("MAINVERSIONLOOSE", `(${o[e.NUMERICIDENTIFIERLOOSE]})\\.(${o[e.NUMERICIDENTIFIERLOOSE]})\\.(${o[e.NUMERICIDENTIFIERLOOSE]})`), E("PRERELEASEIDENTIFIER", `(?:${o[e.NONNUMERICIDENTIFIER]}|${o[e.NUMERICIDENTIFIER]})`), E("PRERELEASEIDENTIFIERLOOSE", `(?:${o[e.NONNUMERICIDENTIFIER]}|${o[e.NUMERICIDENTIFIERLOOSE]})`), E("PRERELEASE", `(?:-(${o[e.PRERELEASEIDENTIFIER]}(?:\\.${o[e.PRERELEASEIDENTIFIER]})*))`), E("PRERELEASELOOSE", `(?:-?(${o[e.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${o[e.PRERELEASEIDENTIFIERLOOSE]})*))`), E("BUILDIDENTIFIER", `${f}+`), E("BUILD", `(?:\\+(${o[e.BUILDIDENTIFIER]}(?:\\.${o[e.BUILDIDENTIFIER]})*))`), E("FULLPLAIN", `v?${o[e.MAINVERSION]}${o[e.PRERELEASE]}?${o[e.BUILD]}?`), E("FULL", `^${o[e.FULLPLAIN]}$`), E("LOOSEPLAIN", `[v=\\s]*${o[e.MAINVERSIONLOOSE]}${o[e.PRERELEASELOOSE]}?${o[e.BUILD]}?`), E("LOOSE", `^${o[e.LOOSEPLAIN]}$`), E("GTLT", "((?:<|>)?=?)"), E("XRANGEIDENTIFIERLOOSE", `${o[e.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`), E("XRANGEIDENTIFIER", `${o[e.NUMERICIDENTIFIER]}|x|X|\\*`), E("XRANGEPLAIN", `[v=\\s]*(${o[e.XRANGEIDENTIFIER]})(?:\\.(${o[e.XRANGEIDENTIFIER]})(?:\\.(${o[e.XRANGEIDENTIFIER]})(?:${o[e.PRERELEASE]})?${o[e.BUILD]}?)?)?`), E("XRANGEPLAINLOOSE", `[v=\\s]*(${o[e.XRANGEIDENTIFIERLOOSE]})(?:\\.(${o[e.XRANGEIDENTIFIERLOOSE]})(?:\\.(${o[e.XRANGEIDENTIFIERLOOSE]})(?:${o[e.PRERELEASELOOSE]})?${o[e.BUILD]}?)?)?`), E("XRANGE", `^${o[e.GTLT]}\\s*${o[e.XRANGEPLAIN]}$`), E("XRANGELOOSE", `^${o[e.GTLT]}\\s*${o[e.XRANGEPLAINLOOSE]}$`), E("COERCEPLAIN", `(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?`), E("COERCE", `${o[e.COERCEPLAIN]}(?:$|[^\\d])`), E("COERCEFULL", o[e.COERCEPLAIN] + `(?:${o[e.PRERELEASE]})?(?:${o[e.BUILD]})?(?:$|[^\\d])`), E("COERCERTL", o[e.COERCE], !0), E("COERCERTLFULL", o[e.COERCEFULL], !0), E("LONETILDE", "(?:~>?)"), E("TILDETRIM", `(\\s*)${o[e.LONETILDE]}\\s+`, !0), n.tildeTrimReplace = "$1~", E("TILDE", `^${o[e.LONETILDE]}${o[e.XRANGEPLAIN]}$`), E("TILDELOOSE", `^${o[e.LONETILDE]}${o[e.XRANGEPLAINLOOSE]}$`), E("LONECARET", "(?:\\^)"), E("CARETTRIM", `(\\s*)${o[e.LONECARET]}\\s+`, !0), n.caretTrimReplace = "$1^", E("CARET", `^${o[e.LONECARET]}${o[e.XRANGEPLAIN]}$`), E("CARETLOOSE", `^${o[e.LONECARET]}${o[e.XRANGEPLAINLOOSE]}$`), E("COMPARATORLOOSE", `^${o[e.GTLT]}\\s*(${o[e.LOOSEPLAIN]})$|^$`), E("COMPARATOR", `^${o[e.GTLT]}\\s*(${o[e.FULLPLAIN]})$|^$`), E("COMPARATORTRIM", `(\\s*)${o[e.GTLT]}\\s*(${o[e.LOOSEPLAIN]}|${o[e.XRANGEPLAIN]})`, !0), n.comparatorTrimReplace = "$1$2$3", E("HYPHENRANGE", `^\\s*(${o[e.XRANGEPLAIN]})\\s+-\\s+(${o[e.XRANGEPLAIN]})\\s*$`), E("HYPHENRANGELOOSE", `^\\s*(${o[e.XRANGEPLAINLOOSE]})\\s+-\\s+(${o[e.XRANGEPLAINLOOSE]})\\s*$`), E("STAR", "(<|>)?=?\\s*\\*"), E("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$"), E("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
231
+ })(H, H.exports)), H.exports;
232
+ }
233
+ var ie, nt;
234
+ function ze() {
235
+ if (nt) return ie;
236
+ nt = 1;
237
+ const t = Object.freeze({ loose: !0 }), n = Object.freeze({});
238
+ return ie = (s) => s ? typeof s != "object" ? t : s : n, ie;
239
+ }
240
+ var ae, it;
241
+ function sr() {
242
+ if (it) return ae;
243
+ it = 1;
244
+ const t = /^[0-9]+$/, n = (s, i) => {
245
+ if (typeof s == "number" && typeof i == "number")
246
+ return s === i ? 0 : s < i ? -1 : 1;
247
+ const u = t.test(s), l = t.test(i);
248
+ return u && l && (s = +s, i = +i), s === i ? 0 : u && !l ? -1 : l && !u ? 1 : s < i ? -1 : 1;
249
+ };
250
+ return ae = {
251
+ compareIdentifiers: n,
252
+ rcompareIdentifiers: (s, i) => n(i, s)
253
+ }, ae;
254
+ }
255
+ var oe, at;
256
+ function b() {
257
+ if (at) return oe;
258
+ at = 1;
259
+ const t = z(), { MAX_LENGTH: n, MAX_SAFE_INTEGER: r } = Y(), { safeRe: s, t: i } = B(), u = ze(), { compareIdentifiers: l } = sr();
260
+ class h {
261
+ constructor(a, e) {
262
+ if (e = u(e), a instanceof h) {
263
+ if (a.loose === !!e.loose && a.includePrerelease === !!e.includePrerelease)
264
+ return a;
265
+ a = a.version;
266
+ } else if (typeof a != "string")
267
+ throw new TypeError(`Invalid version. Must be a string. Got type "${typeof a}".`);
268
+ if (a.length > n)
269
+ throw new TypeError(
270
+ `version is longer than ${n} characters`
271
+ );
272
+ t("SemVer", a, e), this.options = e, this.loose = !!e.loose, this.includePrerelease = !!e.includePrerelease;
273
+ const c = a.trim().match(e.loose ? s[i.LOOSE] : s[i.FULL]);
274
+ if (!c)
275
+ throw new TypeError(`Invalid Version: ${a}`);
276
+ if (this.raw = a, this.major = +c[1], this.minor = +c[2], this.patch = +c[3], this.major > r || this.major < 0)
277
+ throw new TypeError("Invalid major version");
278
+ if (this.minor > r || this.minor < 0)
279
+ throw new TypeError("Invalid minor version");
280
+ if (this.patch > r || this.patch < 0)
281
+ throw new TypeError("Invalid patch version");
282
+ c[4] ? this.prerelease = c[4].split(".").map((f) => {
283
+ if (/^[0-9]+$/.test(f)) {
284
+ const d = +f;
285
+ if (d >= 0 && d < r)
286
+ return d;
287
+ }
288
+ return f;
289
+ }) : this.prerelease = [], this.build = c[5] ? c[5].split(".") : [], this.format();
290
+ }
291
+ format() {
292
+ return this.version = `${this.major}.${this.minor}.${this.patch}`, this.prerelease.length && (this.version += `-${this.prerelease.join(".")}`), this.version;
293
+ }
294
+ toString() {
295
+ return this.version;
296
+ }
297
+ compare(a) {
298
+ if (t("SemVer.compare", this.version, this.options, a), !(a instanceof h)) {
299
+ if (typeof a == "string" && a === this.version)
300
+ return 0;
301
+ a = new h(a, this.options);
302
+ }
303
+ return a.version === this.version ? 0 : this.compareMain(a) || this.comparePre(a);
304
+ }
305
+ compareMain(a) {
306
+ return a instanceof h || (a = new h(a, this.options)), this.major < a.major ? -1 : this.major > a.major ? 1 : this.minor < a.minor ? -1 : this.minor > a.minor ? 1 : this.patch < a.patch ? -1 : this.patch > a.patch ? 1 : 0;
307
+ }
308
+ comparePre(a) {
309
+ if (a instanceof h || (a = new h(a, this.options)), this.prerelease.length && !a.prerelease.length)
310
+ return -1;
311
+ if (!this.prerelease.length && a.prerelease.length)
312
+ return 1;
313
+ if (!this.prerelease.length && !a.prerelease.length)
314
+ return 0;
315
+ let e = 0;
316
+ do {
317
+ const c = this.prerelease[e], f = a.prerelease[e];
318
+ if (t("prerelease compare", e, c, f), c === void 0 && f === void 0)
319
+ return 0;
320
+ if (f === void 0)
321
+ return 1;
322
+ if (c === void 0)
323
+ return -1;
324
+ if (c === f)
325
+ continue;
326
+ return l(c, f);
327
+ } while (++e);
328
+ }
329
+ compareBuild(a) {
330
+ a instanceof h || (a = new h(a, this.options));
331
+ let e = 0;
332
+ do {
333
+ const c = this.build[e], f = a.build[e];
334
+ if (t("build compare", e, c, f), c === void 0 && f === void 0)
335
+ return 0;
336
+ if (f === void 0)
337
+ return 1;
338
+ if (c === void 0)
339
+ return -1;
340
+ if (c === f)
341
+ continue;
342
+ return l(c, f);
343
+ } while (++e);
344
+ }
345
+ // preminor will bump the version up to the next minor release, and immediately
346
+ // down to pre-release. premajor and prepatch work the same way.
347
+ inc(a, e, c) {
348
+ if (a.startsWith("pre")) {
349
+ if (!e && c === !1)
350
+ throw new Error("invalid increment argument: identifier is empty");
351
+ if (e) {
352
+ const f = `-${e}`.match(this.options.loose ? s[i.PRERELEASELOOSE] : s[i.PRERELEASE]);
353
+ if (!f || f[1] !== e)
354
+ throw new Error(`invalid identifier: ${e}`);
355
+ }
356
+ }
357
+ switch (a) {
358
+ case "premajor":
359
+ this.prerelease.length = 0, this.patch = 0, this.minor = 0, this.major++, this.inc("pre", e, c);
360
+ break;
361
+ case "preminor":
362
+ this.prerelease.length = 0, this.patch = 0, this.minor++, this.inc("pre", e, c);
363
+ break;
364
+ case "prepatch":
365
+ this.prerelease.length = 0, this.inc("patch", e, c), this.inc("pre", e, c);
366
+ break;
367
+ // If the input is a non-prerelease version, this acts the same as
368
+ // prepatch.
369
+ case "prerelease":
370
+ this.prerelease.length === 0 && this.inc("patch", e, c), this.inc("pre", e, c);
371
+ break;
372
+ case "release":
373
+ if (this.prerelease.length === 0)
374
+ throw new Error(`version ${this.raw} is not a prerelease`);
375
+ this.prerelease.length = 0;
376
+ break;
377
+ case "major":
378
+ (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) && this.major++, this.minor = 0, this.patch = 0, this.prerelease = [];
379
+ break;
380
+ case "minor":
381
+ (this.patch !== 0 || this.prerelease.length === 0) && this.minor++, this.patch = 0, this.prerelease = [];
382
+ break;
383
+ case "patch":
384
+ this.prerelease.length === 0 && this.patch++, this.prerelease = [];
385
+ break;
386
+ // This probably shouldn't be used publicly.
387
+ // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
388
+ case "pre": {
389
+ const f = Number(c) ? 1 : 0;
390
+ if (this.prerelease.length === 0)
391
+ this.prerelease = [f];
392
+ else {
393
+ let d = this.prerelease.length;
394
+ for (; --d >= 0; )
395
+ typeof this.prerelease[d] == "number" && (this.prerelease[d]++, d = -2);
396
+ if (d === -1) {
397
+ if (e === this.prerelease.join(".") && c === !1)
398
+ throw new Error("invalid increment argument: identifier already exists");
399
+ this.prerelease.push(f);
400
+ }
401
+ }
402
+ if (e) {
403
+ let d = [e, f];
404
+ c === !1 && (d = [e]), l(this.prerelease[0], e) === 0 ? isNaN(this.prerelease[1]) && (this.prerelease = d) : this.prerelease = d;
405
+ }
406
+ break;
407
+ }
408
+ default:
409
+ throw new Error(`invalid increment argument: ${a}`);
410
+ }
411
+ return this.raw = this.format(), this.build.length && (this.raw += `+${this.build.join(".")}`), this;
412
+ }
22
413
  }
414
+ return oe = h, oe;
415
+ }
416
+ var le, ot;
417
+ function V() {
418
+ if (ot) return le;
419
+ ot = 1;
420
+ const t = b();
421
+ return le = (r, s, i = !1) => {
422
+ if (r instanceof t)
423
+ return r;
424
+ try {
425
+ return new t(r, s);
426
+ } catch (u) {
427
+ if (!i)
428
+ return null;
429
+ throw u;
430
+ }
431
+ }, le;
432
+ }
433
+ var ce, lt;
434
+ function Sr() {
435
+ if (lt) return ce;
436
+ lt = 1;
437
+ const t = V();
438
+ return ce = (r, s) => {
439
+ const i = t(r, s);
440
+ return i ? i.version : null;
441
+ }, ce;
442
+ }
443
+ var ue, ct;
444
+ function Ar() {
445
+ if (ct) return ue;
446
+ ct = 1;
447
+ const t = V();
448
+ return ue = (r, s) => {
449
+ const i = t(r.trim().replace(/^[=v]+/, ""), s);
450
+ return i ? i.version : null;
451
+ }, ue;
452
+ }
453
+ var fe, ut;
454
+ function wr() {
455
+ if (ut) return fe;
456
+ ut = 1;
457
+ const t = b();
458
+ return fe = (r, s, i, u, l) => {
459
+ typeof i == "string" && (l = u, u = i, i = void 0);
460
+ try {
461
+ return new t(
462
+ r instanceof t ? r.version : r,
463
+ i
464
+ ).inc(s, u, l).version;
465
+ } catch {
466
+ return null;
467
+ }
468
+ }, fe;
469
+ }
470
+ var he, ft;
471
+ function yr() {
472
+ if (ft) return he;
473
+ ft = 1;
474
+ const t = V();
475
+ return he = (r, s) => {
476
+ const i = t(r, null, !0), u = t(s, null, !0), l = i.compare(u);
477
+ if (l === 0)
478
+ return null;
479
+ const h = l > 0, o = h ? i : u, a = h ? u : i, e = !!o.prerelease.length;
480
+ if (!!a.prerelease.length && !e) {
481
+ if (!a.patch && !a.minor)
482
+ return "major";
483
+ if (a.compareMain(o) === 0)
484
+ return a.minor && !a.patch ? "minor" : "patch";
485
+ }
486
+ const f = e ? "pre" : "";
487
+ return i.major !== u.major ? f + "major" : i.minor !== u.minor ? f + "minor" : i.patch !== u.patch ? f + "patch" : "prerelease";
488
+ }, he;
489
+ }
490
+ var pe, ht;
491
+ function Cr() {
492
+ if (ht) return pe;
493
+ ht = 1;
494
+ const t = b();
495
+ return pe = (r, s) => new t(r, s).major, pe;
496
+ }
497
+ var Ee, pt;
498
+ function qr() {
499
+ if (pt) return Ee;
500
+ pt = 1;
501
+ const t = b();
502
+ return Ee = (r, s) => new t(r, s).minor, Ee;
503
+ }
504
+ var me, Et;
505
+ function Pr() {
506
+ if (Et) return me;
507
+ Et = 1;
508
+ const t = b();
509
+ return me = (r, s) => new t(r, s).patch, me;
510
+ }
511
+ var de, mt;
512
+ function Gr() {
513
+ if (mt) return de;
514
+ mt = 1;
515
+ const t = V();
516
+ return de = (r, s) => {
517
+ const i = t(r, s);
518
+ return i && i.prerelease.length ? i.prerelease : null;
519
+ }, de;
520
+ }
521
+ var Re, dt;
522
+ function U() {
523
+ if (dt) return Re;
524
+ dt = 1;
525
+ const t = b();
526
+ return Re = (r, s, i) => new t(r, i).compare(new t(s, i)), Re;
527
+ }
528
+ var ve, Rt;
529
+ function xr() {
530
+ if (Rt) return ve;
531
+ Rt = 1;
532
+ const t = U();
533
+ return ve = (r, s, i) => t(s, r, i), ve;
534
+ }
535
+ var Ie, vt;
536
+ function Dr() {
537
+ if (vt) return Ie;
538
+ vt = 1;
539
+ const t = U();
540
+ return Ie = (r, s) => t(r, s, !0), Ie;
541
+ }
542
+ var $e, It;
543
+ function Je() {
544
+ if (It) return $e;
545
+ It = 1;
546
+ const t = b();
547
+ return $e = (r, s, i) => {
548
+ const u = new t(r, i), l = new t(s, i);
549
+ return u.compare(l) || u.compareBuild(l);
550
+ }, $e;
551
+ }
552
+ var ge, $t;
553
+ function br() {
554
+ if ($t) return ge;
555
+ $t = 1;
556
+ const t = Je();
557
+ return ge = (r, s) => r.sort((i, u) => t(i, u, s)), ge;
23
558
  }
24
- class v {
25
- config = new c(o);
26
- event = new d();
559
+ var Le, gt;
560
+ function _r() {
561
+ if (gt) return Le;
562
+ gt = 1;
563
+ const t = Je();
564
+ return Le = (r, s) => r.sort((i, u) => t(u, i, s)), Le;
565
+ }
566
+ var Te, Lt;
567
+ function J() {
568
+ if (Lt) return Te;
569
+ Lt = 1;
570
+ const t = U();
571
+ return Te = (r, s, i) => t(r, s, i) > 0, Te;
572
+ }
573
+ var Ne, Tt;
574
+ function Ke() {
575
+ if (Tt) return Ne;
576
+ Tt = 1;
577
+ const t = U();
578
+ return Ne = (r, s, i) => t(r, s, i) < 0, Ne;
579
+ }
580
+ var Oe, Nt;
581
+ function nr() {
582
+ if (Nt) return Oe;
583
+ Nt = 1;
584
+ const t = U();
585
+ return Oe = (r, s, i) => t(r, s, i) === 0, Oe;
586
+ }
587
+ var Se, Ot;
588
+ function ir() {
589
+ if (Ot) return Se;
590
+ Ot = 1;
591
+ const t = U();
592
+ return Se = (r, s, i) => t(r, s, i) !== 0, Se;
593
+ }
594
+ var Ae, St;
595
+ function Ze() {
596
+ if (St) return Ae;
597
+ St = 1;
598
+ const t = U();
599
+ return Ae = (r, s, i) => t(r, s, i) >= 0, Ae;
600
+ }
601
+ var we, At;
602
+ function Qe() {
603
+ if (At) return we;
604
+ At = 1;
605
+ const t = U();
606
+ return we = (r, s, i) => t(r, s, i) <= 0, we;
607
+ }
608
+ var ye, wt;
609
+ function ar() {
610
+ if (wt) return ye;
611
+ wt = 1;
612
+ const t = nr(), n = ir(), r = J(), s = Ze(), i = Ke(), u = Qe();
613
+ return ye = (h, o, a, e) => {
614
+ switch (o) {
615
+ case "===":
616
+ return typeof h == "object" && (h = h.version), typeof a == "object" && (a = a.version), h === a;
617
+ case "!==":
618
+ return typeof h == "object" && (h = h.version), typeof a == "object" && (a = a.version), h !== a;
619
+ case "":
620
+ case "=":
621
+ case "==":
622
+ return t(h, a, e);
623
+ case "!=":
624
+ return n(h, a, e);
625
+ case ">":
626
+ return r(h, a, e);
627
+ case ">=":
628
+ return s(h, a, e);
629
+ case "<":
630
+ return i(h, a, e);
631
+ case "<=":
632
+ return u(h, a, e);
633
+ default:
634
+ throw new TypeError(`Invalid operator: ${o}`);
635
+ }
636
+ }, ye;
637
+ }
638
+ var Ce, yt;
639
+ function Ur() {
640
+ if (yt) return Ce;
641
+ yt = 1;
642
+ const t = b(), n = V(), { safeRe: r, t: s } = B();
643
+ return Ce = (u, l) => {
644
+ if (u instanceof t)
645
+ return u;
646
+ if (typeof u == "number" && (u = String(u)), typeof u != "string")
647
+ return null;
648
+ l = l || {};
649
+ let h = null;
650
+ if (!l.rtl)
651
+ h = u.match(l.includePrerelease ? r[s.COERCEFULL] : r[s.COERCE]);
652
+ else {
653
+ const d = l.includePrerelease ? r[s.COERCERTLFULL] : r[s.COERCERTL];
654
+ let O;
655
+ for (; (O = d.exec(u)) && (!h || h.index + h[0].length !== u.length); )
656
+ (!h || O.index + O[0].length !== h.index + h[0].length) && (h = O), d.lastIndex = O.index + O[1].length + O[2].length;
657
+ d.lastIndex = -1;
658
+ }
659
+ if (h === null)
660
+ return null;
661
+ const o = h[2], a = h[3] || "0", e = h[4] || "0", c = l.includePrerelease && h[5] ? `-${h[5]}` : "", f = l.includePrerelease && h[6] ? `+${h[6]}` : "";
662
+ return n(`${o}.${a}.${e}${c}${f}`, l);
663
+ }, Ce;
664
+ }
665
+ var qe, Ct;
666
+ function jr() {
667
+ if (Ct) return qe;
668
+ Ct = 1;
669
+ class t {
670
+ constructor() {
671
+ this.max = 1e3, this.map = /* @__PURE__ */ new Map();
672
+ }
673
+ get(r) {
674
+ const s = this.map.get(r);
675
+ if (s !== void 0)
676
+ return this.map.delete(r), this.map.set(r, s), s;
677
+ }
678
+ delete(r) {
679
+ return this.map.delete(r);
680
+ }
681
+ set(r, s) {
682
+ if (!this.delete(r) && s !== void 0) {
683
+ if (this.map.size >= this.max) {
684
+ const u = this.map.keys().next().value;
685
+ this.delete(u);
686
+ }
687
+ this.map.set(r, s);
688
+ }
689
+ return this;
690
+ }
691
+ }
692
+ return qe = t, qe;
693
+ }
694
+ var Pe, qt;
695
+ function j() {
696
+ if (qt) return Pe;
697
+ qt = 1;
698
+ const t = /\s+/g;
699
+ class n {
700
+ constructor(p, I) {
701
+ if (I = i(I), p instanceof n)
702
+ return p.loose === !!I.loose && p.includePrerelease === !!I.includePrerelease ? p : new n(p.raw, I);
703
+ if (p instanceof u)
704
+ return this.raw = p.value, this.set = [[p]], this.formatted = void 0, this;
705
+ if (this.options = I, this.loose = !!I.loose, this.includePrerelease = !!I.includePrerelease, this.raw = p.trim().replace(t, " "), this.set = this.raw.split("||").map((R) => this.parseRange(R.trim())).filter((R) => R.length), !this.set.length)
706
+ throw new TypeError(`Invalid SemVer Range: ${this.raw}`);
707
+ if (this.set.length > 1) {
708
+ const R = this.set[0];
709
+ if (this.set = this.set.filter(($) => !E($[0])), this.set.length === 0)
710
+ this.set = [R];
711
+ else if (this.set.length > 1) {
712
+ for (const $ of this.set)
713
+ if ($.length === 1 && N($[0])) {
714
+ this.set = [$];
715
+ break;
716
+ }
717
+ }
718
+ }
719
+ this.formatted = void 0;
720
+ }
721
+ get range() {
722
+ if (this.formatted === void 0) {
723
+ this.formatted = "";
724
+ for (let p = 0; p < this.set.length; p++) {
725
+ p > 0 && (this.formatted += "||");
726
+ const I = this.set[p];
727
+ for (let R = 0; R < I.length; R++)
728
+ R > 0 && (this.formatted += " "), this.formatted += I[R].toString().trim();
729
+ }
730
+ }
731
+ return this.formatted;
732
+ }
733
+ format() {
734
+ return this.range;
735
+ }
736
+ toString() {
737
+ return this.range;
738
+ }
739
+ parseRange(p) {
740
+ const R = ((this.options.includePrerelease && d) | (this.options.loose && O)) + ":" + p, $ = s.get(R);
741
+ if ($)
742
+ return $;
743
+ const v = this.options.loose, g = v ? o[a.HYPHENRANGELOOSE] : o[a.HYPHENRANGE];
744
+ p = p.replace(g, te(this.options.includePrerelease)), l("hyphen replace", p), p = p.replace(o[a.COMPARATORTRIM], e), l("comparator trim", p), p = p.replace(o[a.TILDETRIM], c), l("tilde trim", p), p = p.replace(o[a.CARETTRIM], f), l("caret trim", p);
745
+ let S = p.split(" ").map((q) => G(q, this.options)).join(" ").split(/\s+/).map((q) => ee(q, this.options));
746
+ v && (S = S.filter((q) => (l("loose invalid filter", q, this.options), !!q.match(o[a.COMPARATORLOOSE])))), l("range list", S);
747
+ const T = /* @__PURE__ */ new Map(), y = S.map((q) => new u(q, this.options));
748
+ for (const q of y) {
749
+ if (E(q))
750
+ return [q];
751
+ T.set(q.value, q);
752
+ }
753
+ T.size > 1 && T.has("") && T.delete("");
754
+ const D = [...T.values()];
755
+ return s.set(R, D), D;
756
+ }
757
+ intersects(p, I) {
758
+ if (!(p instanceof n))
759
+ throw new TypeError("a Range is required");
760
+ return this.set.some((R) => A(R, I) && p.set.some(($) => A($, I) && R.every((v) => $.every((g) => v.intersects(g, I)))));
761
+ }
762
+ // if ANY of the sets match ALL of its comparators, then pass
763
+ test(p) {
764
+ if (!p)
765
+ return !1;
766
+ if (typeof p == "string")
767
+ try {
768
+ p = new h(p, this.options);
769
+ } catch {
770
+ return !1;
771
+ }
772
+ for (let I = 0; I < this.set.length; I++)
773
+ if (re(this.set[I], p, this.options))
774
+ return !0;
775
+ return !1;
776
+ }
777
+ }
778
+ Pe = n;
779
+ const r = jr(), s = new r(), i = ze(), u = K(), l = z(), h = b(), {
780
+ safeRe: o,
781
+ t: a,
782
+ comparatorTrimReplace: e,
783
+ tildeTrimReplace: c,
784
+ caretTrimReplace: f
785
+ } = B(), { FLAG_INCLUDE_PRERELEASE: d, FLAG_LOOSE: O } = Y(), E = (m) => m.value === "<0.0.0-0", N = (m) => m.value === "", A = (m, p) => {
786
+ let I = !0;
787
+ const R = m.slice();
788
+ let $ = R.pop();
789
+ for (; I && R.length; )
790
+ I = R.every((v) => $.intersects(v, p)), $ = R.pop();
791
+ return I;
792
+ }, G = (m, p) => (m = m.replace(o[a.BUILD], ""), l("comp", m, p), m = C(m, p), l("caret", m), m = x(m, p), l("tildes", m), m = L(m, p), l("xrange", m), m = Q(m, p), l("stars", m), m), w = (m) => !m || m.toLowerCase() === "x" || m === "*", x = (m, p) => m.trim().split(/\s+/).map((I) => _(I, p)).join(" "), _ = (m, p) => {
793
+ const I = p.loose ? o[a.TILDELOOSE] : o[a.TILDE];
794
+ return m.replace(I, (R, $, v, g, S) => {
795
+ l("tilde", m, R, $, v, g, S);
796
+ let T;
797
+ return w($) ? T = "" : w(v) ? T = `>=${$}.0.0 <${+$ + 1}.0.0-0` : w(g) ? T = `>=${$}.${v}.0 <${$}.${+v + 1}.0-0` : S ? (l("replaceTilde pr", S), T = `>=${$}.${v}.${g}-${S} <${$}.${+v + 1}.0-0`) : T = `>=${$}.${v}.${g} <${$}.${+v + 1}.0-0`, l("tilde return", T), T;
798
+ });
799
+ }, C = (m, p) => m.trim().split(/\s+/).map((I) => P(I, p)).join(" "), P = (m, p) => {
800
+ l("caret", m, p);
801
+ const I = p.loose ? o[a.CARETLOOSE] : o[a.CARET], R = p.includePrerelease ? "-0" : "";
802
+ return m.replace(I, ($, v, g, S, T) => {
803
+ l("caret", m, $, v, g, S, T);
804
+ let y;
805
+ return w(v) ? y = "" : w(g) ? y = `>=${v}.0.0${R} <${+v + 1}.0.0-0` : w(S) ? v === "0" ? y = `>=${v}.${g}.0${R} <${v}.${+g + 1}.0-0` : y = `>=${v}.${g}.0${R} <${+v + 1}.0.0-0` : T ? (l("replaceCaret pr", T), v === "0" ? g === "0" ? y = `>=${v}.${g}.${S}-${T} <${v}.${g}.${+S + 1}-0` : y = `>=${v}.${g}.${S}-${T} <${v}.${+g + 1}.0-0` : y = `>=${v}.${g}.${S}-${T} <${+v + 1}.0.0-0`) : (l("no pr"), v === "0" ? g === "0" ? y = `>=${v}.${g}.${S}${R} <${v}.${g}.${+S + 1}-0` : y = `>=${v}.${g}.${S}${R} <${v}.${+g + 1}.0-0` : y = `>=${v}.${g}.${S} <${+v + 1}.0.0-0`), l("caret return", y), y;
806
+ });
807
+ }, L = (m, p) => (l("replaceXRanges", m, p), m.split(/\s+/).map((I) => k(I, p)).join(" ")), k = (m, p) => {
808
+ m = m.trim();
809
+ const I = p.loose ? o[a.XRANGELOOSE] : o[a.XRANGE];
810
+ return m.replace(I, (R, $, v, g, S, T) => {
811
+ l("xRange", m, R, $, v, g, S, T);
812
+ const y = w(v), D = y || w(g), q = D || w(S), X = q;
813
+ return $ === "=" && X && ($ = ""), T = p.includePrerelease ? "-0" : "", y ? $ === ">" || $ === "<" ? R = "<0.0.0-0" : R = "*" : $ && X ? (D && (g = 0), S = 0, $ === ">" ? ($ = ">=", D ? (v = +v + 1, g = 0, S = 0) : (g = +g + 1, S = 0)) : $ === "<=" && ($ = "<", D ? v = +v + 1 : g = +g + 1), $ === "<" && (T = "-0"), R = `${$ + v}.${g}.${S}${T}`) : D ? R = `>=${v}.0.0${T} <${+v + 1}.0.0-0` : q && (R = `>=${v}.${g}.0${T} <${v}.${+g + 1}.0-0`), l("xRange return", R), R;
814
+ });
815
+ }, Q = (m, p) => (l("replaceStars", m, p), m.trim().replace(o[a.STAR], "")), ee = (m, p) => (l("replaceGTE0", m, p), m.trim().replace(o[p.includePrerelease ? a.GTE0PRE : a.GTE0], "")), te = (m) => (p, I, R, $, v, g, S, T, y, D, q, X) => (w(R) ? I = "" : w($) ? I = `>=${R}.0.0${m ? "-0" : ""}` : w(v) ? I = `>=${R}.${$}.0${m ? "-0" : ""}` : g ? I = `>=${I}` : I = `>=${I}${m ? "-0" : ""}`, w(y) ? T = "" : w(D) ? T = `<${+y + 1}.0.0-0` : w(q) ? T = `<${y}.${+D + 1}.0-0` : X ? T = `<=${y}.${D}.${q}-${X}` : m ? T = `<${y}.${D}.${+q + 1}-0` : T = `<=${T}`, `${I} ${T}`.trim()), re = (m, p, I) => {
816
+ for (let R = 0; R < m.length; R++)
817
+ if (!m[R].test(p))
818
+ return !1;
819
+ if (p.prerelease.length && !I.includePrerelease) {
820
+ for (let R = 0; R < m.length; R++)
821
+ if (l(m[R].semver), m[R].semver !== u.ANY && m[R].semver.prerelease.length > 0) {
822
+ const $ = m[R].semver;
823
+ if ($.major === p.major && $.minor === p.minor && $.patch === p.patch)
824
+ return !0;
825
+ }
826
+ return !1;
827
+ }
828
+ return !0;
829
+ };
830
+ return Pe;
831
+ }
832
+ var Ge, Pt;
833
+ function K() {
834
+ if (Pt) return Ge;
835
+ Pt = 1;
836
+ const t = /* @__PURE__ */ Symbol("SemVer ANY");
837
+ class n {
838
+ static get ANY() {
839
+ return t;
840
+ }
841
+ constructor(e, c) {
842
+ if (c = r(c), e instanceof n) {
843
+ if (e.loose === !!c.loose)
844
+ return e;
845
+ e = e.value;
846
+ }
847
+ e = e.trim().split(/\s+/).join(" "), l("comparator", e, c), this.options = c, this.loose = !!c.loose, this.parse(e), this.semver === t ? this.value = "" : this.value = this.operator + this.semver.version, l("comp", this);
848
+ }
849
+ parse(e) {
850
+ const c = this.options.loose ? s[i.COMPARATORLOOSE] : s[i.COMPARATOR], f = e.match(c);
851
+ if (!f)
852
+ throw new TypeError(`Invalid comparator: ${e}`);
853
+ this.operator = f[1] !== void 0 ? f[1] : "", this.operator === "=" && (this.operator = ""), f[2] ? this.semver = new h(f[2], this.options.loose) : this.semver = t;
854
+ }
855
+ toString() {
856
+ return this.value;
857
+ }
858
+ test(e) {
859
+ if (l("Comparator.test", e, this.options.loose), this.semver === t || e === t)
860
+ return !0;
861
+ if (typeof e == "string")
862
+ try {
863
+ e = new h(e, this.options);
864
+ } catch {
865
+ return !1;
866
+ }
867
+ return u(e, this.operator, this.semver, this.options);
868
+ }
869
+ intersects(e, c) {
870
+ if (!(e instanceof n))
871
+ throw new TypeError("a Comparator is required");
872
+ return this.operator === "" ? this.value === "" ? !0 : new o(e.value, c).test(this.value) : e.operator === "" ? e.value === "" ? !0 : new o(this.value, c).test(e.semver) : (c = r(c), c.includePrerelease && (this.value === "<0.0.0-0" || e.value === "<0.0.0-0") || !c.includePrerelease && (this.value.startsWith("<0.0.0") || e.value.startsWith("<0.0.0")) ? !1 : !!(this.operator.startsWith(">") && e.operator.startsWith(">") || this.operator.startsWith("<") && e.operator.startsWith("<") || this.semver.version === e.semver.version && this.operator.includes("=") && e.operator.includes("=") || u(this.semver, "<", e.semver, c) && this.operator.startsWith(">") && e.operator.startsWith("<") || u(this.semver, ">", e.semver, c) && this.operator.startsWith("<") && e.operator.startsWith(">")));
873
+ }
874
+ }
875
+ Ge = n;
876
+ const r = ze(), { safeRe: s, t: i } = B(), u = ar(), l = z(), h = b(), o = j();
877
+ return Ge;
878
+ }
879
+ var xe, Gt;
880
+ function Z() {
881
+ if (Gt) return xe;
882
+ Gt = 1;
883
+ const t = j();
884
+ return xe = (r, s, i) => {
885
+ try {
886
+ s = new t(s, i);
887
+ } catch {
888
+ return !1;
889
+ }
890
+ return s.test(r);
891
+ }, xe;
892
+ }
893
+ var De, xt;
894
+ function Fr() {
895
+ if (xt) return De;
896
+ xt = 1;
897
+ const t = j();
898
+ return De = (r, s) => new t(r, s).set.map((i) => i.map((u) => u.value).join(" ").trim().split(" ")), De;
899
+ }
900
+ var be, Dt;
901
+ function Vr() {
902
+ if (Dt) return be;
903
+ Dt = 1;
904
+ const t = b(), n = j();
905
+ return be = (s, i, u) => {
906
+ let l = null, h = null, o = null;
907
+ try {
908
+ o = new n(i, u);
909
+ } catch {
910
+ return null;
911
+ }
912
+ return s.forEach((a) => {
913
+ o.test(a) && (!l || h.compare(a) === -1) && (l = a, h = new t(l, u));
914
+ }), l;
915
+ }, be;
916
+ }
917
+ var _e, bt;
918
+ function kr() {
919
+ if (bt) return _e;
920
+ bt = 1;
921
+ const t = b(), n = j();
922
+ return _e = (s, i, u) => {
923
+ let l = null, h = null, o = null;
924
+ try {
925
+ o = new n(i, u);
926
+ } catch {
927
+ return null;
928
+ }
929
+ return s.forEach((a) => {
930
+ o.test(a) && (!l || h.compare(a) === 1) && (l = a, h = new t(l, u));
931
+ }), l;
932
+ }, _e;
933
+ }
934
+ var Ue, _t;
935
+ function Xr() {
936
+ if (_t) return Ue;
937
+ _t = 1;
938
+ const t = b(), n = j(), r = J();
939
+ return Ue = (i, u) => {
940
+ i = new n(i, u);
941
+ let l = new t("0.0.0");
942
+ if (i.test(l) || (l = new t("0.0.0-0"), i.test(l)))
943
+ return l;
944
+ l = null;
945
+ for (let h = 0; h < i.set.length; ++h) {
946
+ const o = i.set[h];
947
+ let a = null;
948
+ o.forEach((e) => {
949
+ const c = new t(e.semver.version);
950
+ switch (e.operator) {
951
+ case ">":
952
+ c.prerelease.length === 0 ? c.patch++ : c.prerelease.push(0), c.raw = c.format();
953
+ /* fallthrough */
954
+ case "":
955
+ case ">=":
956
+ (!a || r(c, a)) && (a = c);
957
+ break;
958
+ case "<":
959
+ case "<=":
960
+ break;
961
+ /* istanbul ignore next */
962
+ default:
963
+ throw new Error(`Unexpected operation: ${e.operator}`);
964
+ }
965
+ }), a && (!l || r(l, a)) && (l = a);
966
+ }
967
+ return l && i.test(l) ? l : null;
968
+ }, Ue;
969
+ }
970
+ var je, Ut;
971
+ function Mr() {
972
+ if (Ut) return je;
973
+ Ut = 1;
974
+ const t = j();
975
+ return je = (r, s) => {
976
+ try {
977
+ return new t(r, s).range || "*";
978
+ } catch {
979
+ return null;
980
+ }
981
+ }, je;
982
+ }
983
+ var Fe, jt;
984
+ function et() {
985
+ if (jt) return Fe;
986
+ jt = 1;
987
+ const t = b(), n = K(), { ANY: r } = n, s = j(), i = Z(), u = J(), l = Ke(), h = Qe(), o = Ze();
988
+ return Fe = (e, c, f, d) => {
989
+ e = new t(e, d), c = new s(c, d);
990
+ let O, E, N, A, G;
991
+ switch (f) {
992
+ case ">":
993
+ O = u, E = h, N = l, A = ">", G = ">=";
994
+ break;
995
+ case "<":
996
+ O = l, E = o, N = u, A = "<", G = "<=";
997
+ break;
998
+ default:
999
+ throw new TypeError('Must provide a hilo val of "<" or ">"');
1000
+ }
1001
+ if (i(e, c, d))
1002
+ return !1;
1003
+ for (let w = 0; w < c.set.length; ++w) {
1004
+ const x = c.set[w];
1005
+ let _ = null, C = null;
1006
+ if (x.forEach((P) => {
1007
+ P.semver === r && (P = new n(">=0.0.0")), _ = _ || P, C = C || P, O(P.semver, _.semver, d) ? _ = P : N(P.semver, C.semver, d) && (C = P);
1008
+ }), _.operator === A || _.operator === G || (!C.operator || C.operator === A) && E(e, C.semver))
1009
+ return !1;
1010
+ if (C.operator === G && N(e, C.semver))
1011
+ return !1;
1012
+ }
1013
+ return !0;
1014
+ }, Fe;
1015
+ }
1016
+ var Ve, Ft;
1017
+ function Br() {
1018
+ if (Ft) return Ve;
1019
+ Ft = 1;
1020
+ const t = et();
1021
+ return Ve = (r, s, i) => t(r, s, ">", i), Ve;
1022
+ }
1023
+ var ke, Vt;
1024
+ function Hr() {
1025
+ if (Vt) return ke;
1026
+ Vt = 1;
1027
+ const t = et();
1028
+ return ke = (r, s, i) => t(r, s, "<", i), ke;
1029
+ }
1030
+ var Xe, kt;
1031
+ function Wr() {
1032
+ if (kt) return Xe;
1033
+ kt = 1;
1034
+ const t = j();
1035
+ return Xe = (r, s, i) => (r = new t(r, i), s = new t(s, i), r.intersects(s, i)), Xe;
1036
+ }
1037
+ var Me, Xt;
1038
+ function Yr() {
1039
+ if (Xt) return Me;
1040
+ Xt = 1;
1041
+ const t = Z(), n = U();
1042
+ return Me = (r, s, i) => {
1043
+ const u = [];
1044
+ let l = null, h = null;
1045
+ const o = r.sort((f, d) => n(f, d, i));
1046
+ for (const f of o)
1047
+ t(f, s, i) ? (h = f, l || (l = f)) : (h && u.push([l, h]), h = null, l = null);
1048
+ l && u.push([l, null]);
1049
+ const a = [];
1050
+ for (const [f, d] of u)
1051
+ f === d ? a.push(f) : !d && f === o[0] ? a.push("*") : d ? f === o[0] ? a.push(`<=${d}`) : a.push(`${f} - ${d}`) : a.push(`>=${f}`);
1052
+ const e = a.join(" || "), c = typeof s.raw == "string" ? s.raw : String(s);
1053
+ return e.length < c.length ? e : s;
1054
+ }, Me;
1055
+ }
1056
+ var Be, Mt;
1057
+ function zr() {
1058
+ if (Mt) return Be;
1059
+ Mt = 1;
1060
+ const t = j(), n = K(), { ANY: r } = n, s = Z(), i = U(), u = (c, f, d = {}) => {
1061
+ if (c === f)
1062
+ return !0;
1063
+ c = new t(c, d), f = new t(f, d);
1064
+ let O = !1;
1065
+ e: for (const E of c.set) {
1066
+ for (const N of f.set) {
1067
+ const A = o(E, N, d);
1068
+ if (O = O || A !== null, A)
1069
+ continue e;
1070
+ }
1071
+ if (O)
1072
+ return !1;
1073
+ }
1074
+ return !0;
1075
+ }, l = [new n(">=0.0.0-0")], h = [new n(">=0.0.0")], o = (c, f, d) => {
1076
+ if (c === f)
1077
+ return !0;
1078
+ if (c.length === 1 && c[0].semver === r) {
1079
+ if (f.length === 1 && f[0].semver === r)
1080
+ return !0;
1081
+ d.includePrerelease ? c = l : c = h;
1082
+ }
1083
+ if (f.length === 1 && f[0].semver === r) {
1084
+ if (d.includePrerelease)
1085
+ return !0;
1086
+ f = h;
1087
+ }
1088
+ const O = /* @__PURE__ */ new Set();
1089
+ let E, N;
1090
+ for (const L of c)
1091
+ L.operator === ">" || L.operator === ">=" ? E = a(E, L, d) : L.operator === "<" || L.operator === "<=" ? N = e(N, L, d) : O.add(L.semver);
1092
+ if (O.size > 1)
1093
+ return null;
1094
+ let A;
1095
+ if (E && N) {
1096
+ if (A = i(E.semver, N.semver, d), A > 0)
1097
+ return null;
1098
+ if (A === 0 && (E.operator !== ">=" || N.operator !== "<="))
1099
+ return null;
1100
+ }
1101
+ for (const L of O) {
1102
+ if (E && !s(L, String(E), d) || N && !s(L, String(N), d))
1103
+ return null;
1104
+ for (const k of f)
1105
+ if (!s(L, String(k), d))
1106
+ return !1;
1107
+ return !0;
1108
+ }
1109
+ let G, w, x, _, C = N && !d.includePrerelease && N.semver.prerelease.length ? N.semver : !1, P = E && !d.includePrerelease && E.semver.prerelease.length ? E.semver : !1;
1110
+ C && C.prerelease.length === 1 && N.operator === "<" && C.prerelease[0] === 0 && (C = !1);
1111
+ for (const L of f) {
1112
+ if (_ = _ || L.operator === ">" || L.operator === ">=", x = x || L.operator === "<" || L.operator === "<=", E) {
1113
+ if (P && L.semver.prerelease && L.semver.prerelease.length && L.semver.major === P.major && L.semver.minor === P.minor && L.semver.patch === P.patch && (P = !1), L.operator === ">" || L.operator === ">=") {
1114
+ if (G = a(E, L, d), G === L && G !== E)
1115
+ return !1;
1116
+ } else if (E.operator === ">=" && !s(E.semver, String(L), d))
1117
+ return !1;
1118
+ }
1119
+ if (N) {
1120
+ if (C && L.semver.prerelease && L.semver.prerelease.length && L.semver.major === C.major && L.semver.minor === C.minor && L.semver.patch === C.patch && (C = !1), L.operator === "<" || L.operator === "<=") {
1121
+ if (w = e(N, L, d), w === L && w !== N)
1122
+ return !1;
1123
+ } else if (N.operator === "<=" && !s(N.semver, String(L), d))
1124
+ return !1;
1125
+ }
1126
+ if (!L.operator && (N || E) && A !== 0)
1127
+ return !1;
1128
+ }
1129
+ return !(E && x && !N && A !== 0 || N && _ && !E && A !== 0 || P || C);
1130
+ }, a = (c, f, d) => {
1131
+ if (!c)
1132
+ return f;
1133
+ const O = i(c.semver, f.semver, d);
1134
+ return O > 0 ? c : O < 0 || f.operator === ">" && c.operator === ">=" ? f : c;
1135
+ }, e = (c, f, d) => {
1136
+ if (!c)
1137
+ return f;
1138
+ const O = i(c.semver, f.semver, d);
1139
+ return O < 0 ? c : O > 0 || f.operator === "<" && c.operator === "<=" ? f : c;
1140
+ };
1141
+ return Be = u, Be;
1142
+ }
1143
+ var He, Bt;
1144
+ function Jr() {
1145
+ if (Bt) return He;
1146
+ Bt = 1;
1147
+ const t = B(), n = Y(), r = b(), s = sr(), i = V(), u = Sr(), l = Ar(), h = wr(), o = yr(), a = Cr(), e = qr(), c = Pr(), f = Gr(), d = U(), O = xr(), E = Dr(), N = Je(), A = br(), G = _r(), w = J(), x = Ke(), _ = nr(), C = ir(), P = Ze(), L = Qe(), k = ar(), Q = Ur(), ee = K(), te = j(), re = Z(), m = Fr(), p = Vr(), I = kr(), R = Xr(), $ = Mr(), v = et(), g = Br(), S = Hr(), T = Wr(), y = Yr(), D = zr();
1148
+ return He = {
1149
+ parse: i,
1150
+ valid: u,
1151
+ clean: l,
1152
+ inc: h,
1153
+ diff: o,
1154
+ major: a,
1155
+ minor: e,
1156
+ patch: c,
1157
+ prerelease: f,
1158
+ compare: d,
1159
+ rcompare: O,
1160
+ compareLoose: E,
1161
+ compareBuild: N,
1162
+ sort: A,
1163
+ rsort: G,
1164
+ gt: w,
1165
+ lt: x,
1166
+ eq: _,
1167
+ neq: C,
1168
+ gte: P,
1169
+ lte: L,
1170
+ cmp: k,
1171
+ coerce: Q,
1172
+ Comparator: ee,
1173
+ Range: te,
1174
+ satisfies: re,
1175
+ toComparators: m,
1176
+ maxSatisfying: p,
1177
+ minSatisfying: I,
1178
+ minVersion: R,
1179
+ validRange: $,
1180
+ outside: v,
1181
+ gtr: g,
1182
+ ltr: S,
1183
+ intersects: T,
1184
+ simplifyRange: y,
1185
+ subset: D,
1186
+ SemVer: r,
1187
+ re: t.re,
1188
+ src: t.src,
1189
+ tokens: t.t,
1190
+ SEMVER_SPEC_VERSION: n.SEMVER_SPEC_VERSION,
1191
+ RELEASE_TYPES: n.RELEASE_TYPES,
1192
+ compareIdentifiers: s.compareIdentifiers,
1193
+ rcompareIdentifiers: s.rcompareIdentifiers
1194
+ }, He;
1195
+ }
1196
+ var Kr = Jr();
1197
+ const Ht = `^${M.Version}`;
1198
+ class ts {
1199
+ config = new lr(Wt);
1200
+ event = new cr();
27
1201
  state;
28
1202
  active;
29
1203
  time;
1204
+ offset;
30
1205
  info;
31
1206
  constructor() {
32
1207
  this.state = {
@@ -40,99 +1215,161 @@ class v {
40
1215
  }, this.time = {
41
1216
  start: 0,
42
1217
  seek: 0
43
- }, this.info = new r();
1218
+ }, this.offset = {
1219
+ temp: 0,
1220
+ meta: 0
1221
+ }, this.info = new M.Info(), this.config.event.add("update", this.onConfigUpdate);
44
1222
  }
1223
+ onConfigUpdate = (n) => {
1224
+ const r = n.has("offset.useMeta");
1225
+ r && this.handleRefreshOffset(), (r || n.has("offset.global")) && this.handleSyncTime();
1226
+ };
1227
+ // Get current playback time.
45
1228
  handleGetCurrentTime() {
46
1229
  return this.state.playing ? this.time.seek + (performance.now() - this.time.start) : this.time.seek;
47
1230
  }
48
- handleGetLineTime(e) {
49
- if (e < 0 || e >= this.info.lines.length)
1231
+ // Real playback time shifted by the combined offset; all lyric matching runs against this.
1232
+ handleGetEffectiveTime() {
1233
+ return this.handleGetCurrentTime() + this.currentOffset;
1234
+ }
1235
+ // Refresh meta offset.
1236
+ handleRefreshOffset() {
1237
+ if (this.config.current.offset.useMeta) {
1238
+ const r = this.info.metas.find((i) => i.type === M.MetaType.Offset)?.content, s = typeof r == "number" && Number.isFinite(r) ? r : 0;
1239
+ this.offset.meta = s;
1240
+ } else
1241
+ this.offset.meta = 0;
1242
+ }
1243
+ handleGetLineTime(n) {
1244
+ if (n < 0 || n >= this.info.lines.length)
50
1245
  return 0;
51
- if (e === this.info.lines.length - 1)
1246
+ if (n === this.info.lines.length - 1)
52
1247
  return 1 / 0;
53
- const s = this.info.lines[e], n = this.info.lines[e + 1];
54
- return Math.max(s.time.end, n.time.start);
1248
+ const r = this.info.lines[n], s = this.info.lines[n + 1];
1249
+ return Math.max(r.time.end, s.time.start);
55
1250
  }
56
1251
  handleGetActiveIndex() {
57
1252
  return this.active.index.length > 0 ? this.active.index[0] : -1;
58
1253
  }
59
- handleSyncTime(e) {
60
- const s = [], n = [];
1254
+ handleBridgeActive(n, r) {
1255
+ if (!this.config.current.bridgeActive || r.length < 2)
1256
+ return { lines: n, index: r };
1257
+ const s = r[0], i = r[r.length - 1];
1258
+ if (i - s + 1 === r.length)
1259
+ return { lines: n, index: r };
1260
+ const u = /* @__PURE__ */ new Map();
1261
+ for (let o = 0; o < r.length; o++)
1262
+ u.set(r[o], n[o]);
1263
+ const l = [], h = [];
1264
+ for (let o = s; o <= i; o++) {
1265
+ const a = u.get(o) ?? this.info.lines[o];
1266
+ a && (l.push(a), h.push(o));
1267
+ }
1268
+ return { lines: l, index: h };
1269
+ }
1270
+ handleEmitLinesUpdate(n) {
1271
+ const r = this.handleBridgeActive(this.active.lines, this.active.index);
1272
+ this.event.emit("linesUpdate", r.lines, r.index, this.handleGetActiveIndex(), n);
1273
+ }
1274
+ handleSyncTime(n) {
1275
+ if (!this.info.lines.length || (n === void 0 && (n = this.handleGetEffectiveTime()), !Number.isFinite(n)))
1276
+ return;
1277
+ const r = [], s = [];
61
1278
  let i = this.info.lines.length;
62
- for (let t = 0; t < this.info.lines.length; t++) {
63
- const a = this.info.lines[t];
64
- if (a.time.start > e) {
65
- i = t;
1279
+ for (let u = 0; u < this.info.lines.length; u++) {
1280
+ const l = this.info.lines[u];
1281
+ if (l.time.start > n) {
1282
+ i = u;
66
1283
  break;
67
1284
  }
68
- this.handleGetLineTime(t) > e && (s.push(a), n.push(t));
1285
+ this.handleGetLineTime(u) > n && (r.push(l), s.push(u));
69
1286
  }
70
- this.state.scanIndex = i, this.active.lines = s, this.active.index = n, this.event.emit("linesUpdate", [...this.active.lines], [...this.active.index], this.handleGetActiveIndex(), !0);
1287
+ this.state.scanIndex = i, this.active.lines = r, this.active.index = s, this.handleEmitLinesUpdate(!0);
71
1288
  }
72
- handleUpdateActiveLines(e) {
73
- let s = !1;
74
- const n = [], i = [];
75
- for (let t = 0; t < this.active.lines.length; t++) {
76
- const a = this.active.lines[t], h = this.active.index[t];
77
- e >= this.handleGetLineTime(h) ? s = !0 : (n.push(a), i.push(h));
1289
+ handleUpdateActiveLines(n) {
1290
+ let r = !1;
1291
+ const s = [], i = [];
1292
+ for (let u = 0; u < this.active.lines.length; u++) {
1293
+ const l = this.active.lines[u], h = this.active.index[u];
1294
+ n >= this.handleGetLineTime(h) ? r = !0 : (s.push(l), i.push(h));
78
1295
  }
79
1296
  for (; this.state.scanIndex < this.info.lines.length; ) {
80
- const t = this.info.lines[this.state.scanIndex];
81
- if (e >= t.time.start)
82
- e < this.handleGetLineTime(this.state.scanIndex) && (n.push(t), i.push(this.state.scanIndex), s = !0), this.state.scanIndex++;
1297
+ const u = this.info.lines[this.state.scanIndex];
1298
+ if (n >= u.time.start)
1299
+ n < this.handleGetLineTime(this.state.scanIndex) && (s.push(u), i.push(this.state.scanIndex), r = !0), this.state.scanIndex++;
83
1300
  else
84
1301
  break;
85
1302
  }
86
- s && (this.active.lines = n, this.active.index = i, this.event.emit("linesUpdate", [...this.active.lines], [...this.active.index], this.handleGetActiveIndex(), !1));
1303
+ r && (this.active.lines = s, this.active.index = i, this.handleEmitLinesUpdate(!1));
87
1304
  }
88
1305
  onTick = () => {
89
1306
  if (!this.state.playing)
90
1307
  return;
91
- const e = this.handleGetCurrentTime();
92
- switch (this.handleUpdateActiveLines(e), this.config.current.driver) {
1308
+ const n = this.handleGetEffectiveTime();
1309
+ switch (this.handleUpdateActiveLines(n), this.config.current.driver) {
93
1310
  case "animation":
94
- this.state.frameId = window.requestAnimationFrame(this.onTick);
1311
+ this.state.frameId = globalThis.requestAnimationFrame(this.onTick);
95
1312
  break;
96
1313
  case "timer":
97
- this.state.timerId = window.setTimeout(this.onTick, 16);
1314
+ this.state.timerId = globalThis.setTimeout(this.onTick, 16);
98
1315
  break;
99
1316
  }
100
1317
  };
101
- updateLyric(e) {
102
- e && (this.pause(), this.info = e, this.active.lines = [], this.active.index = [], this.state.scanIndex = 0, this.time.seek = 0, this.event.emit("lyricUpdate", e), this.event.emit("linesUpdate", [], [], -1, !1));
1318
+ updateLyric(n) {
1319
+ if (!n)
1320
+ return;
1321
+ let r = n;
1322
+ Kr.satisfies(n.version, Ht) || (console.warn(`[music-lyric-player] ignored lyric with incompatible version "${n.version}", expected "${Ht}"`), r = new M.Info()), this.pause(), this.info = r, this.handleRefreshOffset(), this.config.current.offset.resetTempOnLyricChange && (this.offset.temp = 0), this.active.lines = [], this.active.index = [], this.state.scanIndex = 0, this.time.seek = 0, this.event.emit("lyricUpdate", r), this.event.emit("linesUpdate", [], [], -1, !1);
103
1323
  }
104
1324
  /**
105
1325
  * Start playback
106
1326
  * @param time Optional time in ms to seek to before starting playback. If not provided, playback will start from the current position.
107
1327
  */
108
- play(e) {
109
- this.pause(), typeof e == "number" && !Number.isNaN(e) && (this.time.seek = e, this.handleSyncTime(e)), this.time.start = performance.now(), this.state.playing = !0, this.onTick(), this.event.emit("play", this.handleGetCurrentTime());
1328
+ play(n) {
1329
+ this.pause(), typeof n == "number" && Number.isFinite(n) && (this.time.seek = n, this.handleSyncTime()), this.time.start = performance.now(), this.state.playing = !0, this.onTick(), this.event.emit("play", this.handleGetCurrentTime());
110
1330
  }
111
1331
  /**
112
1332
  * Pause playback
113
1333
  */
114
1334
  pause() {
115
- this.state.playing && (this.time.seek = this.handleGetCurrentTime(), this.state.playing = !1), this.state.frameId !== null && (cancelAnimationFrame(this.state.frameId), this.state.frameId = null), this.state.timerId !== null && (clearTimeout(this.state.timerId), this.state.timerId = null), this.event.emit("pause", this.handleGetCurrentTime());
1335
+ this.state.playing && (this.time.seek = this.handleGetCurrentTime(), this.state.playing = !1, this.event.emit("pause", this.time.seek)), this.state.frameId !== null && (globalThis.cancelAnimationFrame(this.state.frameId), this.state.frameId = null), this.state.timerId !== null && (globalThis.clearTimeout(this.state.timerId), this.state.timerId = null);
116
1336
  }
117
1337
  /**
118
1338
  * Stop playback
119
1339
  */
120
1340
  dispose() {
121
- this.pause(), this.event.clear(), this.active.lines = [], this.active.index = [], this.info = new r();
1341
+ this.pause(), this.event.clear(), this.config.event.remove("update", this.onConfigUpdate), this.active.lines = [], this.active.index = [], this.info = new M.Info();
1342
+ }
1343
+ /**
1344
+ * Update the temp offset in ms (the user's temporary adjustment).
1345
+ * Stacked on top of the global config offset and the lyric's meta offset, then resyncs immediately.
1346
+ * @param value temp offset in ms; non-finite values are treated as 0.
1347
+ */
1348
+ updateTempOffset(n) {
1349
+ this.offset.temp = Number.isFinite(n) ? n : 0, this.handleSyncTime();
122
1350
  }
123
1351
  /**
124
1352
  * Find all active lines at the given time (ms). Does not mutate internal state.
1353
+ * Assumes `info.lines` is sorted by `time.start` ascending.
125
1354
  * @param time time in ms to find active lines for.
126
1355
  */
127
- matchLinesWithTime(e) {
128
- const s = [], n = [];
129
- for (let i = 0; i < this.info.lines.length; i++) {
130
- const t = this.info.lines[i];
131
- if (t.time.start > e)
1356
+ matchLinesWithTime(n) {
1357
+ const r = n + this.currentOffset, s = [], i = [];
1358
+ for (let u = 0; u < this.info.lines.length; u++) {
1359
+ const l = this.info.lines[u];
1360
+ if (l.time.start > r)
132
1361
  break;
133
- this.handleGetLineTime(i) > e && (s.push(t), n.push(i));
1362
+ this.handleGetLineTime(u) > r && (s.push(l), i.push(u));
134
1363
  }
135
- return { lines: s, index: n };
1364
+ return this.handleBridgeActive(s, i);
1365
+ }
1366
+ /**
1367
+ * Convert a content (lyric) time to the playback clock by removing the active offset.
1368
+ * Seeking playback to the returned time makes a line at `contentTime` become active.
1369
+ * @param contentTime content time in ms (e.g. a line's start).
1370
+ */
1371
+ convertContentTime(n) {
1372
+ return n - this.currentOffset;
136
1373
  }
137
1374
  /**
138
1375
  * Whether the player is currently playing.
@@ -144,13 +1381,13 @@ class v {
144
1381
  * Current active lines.
145
1382
  */
146
1383
  get currentLines() {
147
- return [...this.active.lines];
1384
+ return this.handleBridgeActive(this.active.lines, this.active.index).lines;
148
1385
  }
149
1386
  /**
150
1387
  * Indices of currently active lines.
151
1388
  */
152
1389
  get currentIndex() {
153
- return [...this.active.index];
1390
+ return this.handleBridgeActive(this.active.lines, this.active.index).index;
154
1391
  }
155
1392
  /**
156
1393
  * The index of the primary active line, or -1 if none.
@@ -170,8 +1407,16 @@ class v {
170
1407
  get currentTime() {
171
1408
  return this.handleGetCurrentTime();
172
1409
  }
1410
+ /**
1411
+ * The current effective lyric offset in ms (config offset + lyric meta offset + temp offset).
1412
+ */
1413
+ get currentOffset() {
1414
+ const n = this.config.current.offset.global + this.offset.meta + this.offset.temp;
1415
+ return Number.isFinite(n) ? n : 0;
1416
+ }
173
1417
  }
174
1418
  export {
175
- v as BaseLyricPlayer
1419
+ ts as BaseLyricPlayer,
1420
+ es as BaseLyricPlayerConfig
176
1421
  };
177
1422
  //# sourceMappingURL=index.ecma.js.map