@music-lyric-player/base 0.13.0 → 0.15.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,190 +1,660 @@
1
- import { freezeObjectDeep as or, ConfigManager as lr, Event as cr } from "@music-lyric-player/utils";
1
+ import { freezeObjectDeep as fr, ConfigManager as mr, Event as pr } from "@music-lyric-player/utils";
2
2
  import "lodash-es";
3
- const Wt = or({
3
+ const Ht = fr({
4
4
  driver: "animation",
5
5
  bridgeActive: !0,
6
+ mergeWindow: 300,
7
+ mergeLimit: 3,
6
8
  offset: {
7
9
  global: 0,
8
10
  useMeta: !0,
9
11
  resetTempOnLyricChange: !0
10
12
  }
11
- }), es = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
13
+ }), ns = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
12
14
  __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("");
15
+ DEFAULT: Ht
16
+ }, Symbol.toStringTag, { value: "Module" })), B = (s = 8) => {
17
+ let e = "";
18
+ for (; e.length < s; )
19
+ e += Math.random().toString(36).slice(2);
20
+ return e.slice(0, s);
22
21
  };
23
- class W {
22
+ var zt = /* @__PURE__ */ ((s) => (s.ChineseSimplified = "zh-hans", s.ChineseTraditional = "zh-hant", s.English = "en", s.Japanese = "ja", s.Korean = "ko", s.Russian = "ru", s.French = "fr", s.German = "de", s.Spanish = "es", s.Italian = "it", s.Portuguese = "pt", s))(zt || {});
23
+ class dr {
24
+ /**
25
+ * Language tag.
26
+ */
27
+ tag = "";
28
+ /**
29
+ * Share within the lyric, ranging from 0 to 100.
30
+ * Recommended to be computed from word-level language counts.
31
+ */
32
+ percent = 0;
33
+ }
34
+ class Yt {
35
+ /**
36
+ * All languages with their shares.
37
+ */
38
+ list = [];
39
+ /**
40
+ * The language with the highest share.
41
+ */
42
+ get primary() {
43
+ let e;
44
+ for (let t = 0, n = this.list.length; t < n; t++)
45
+ (!e || this.list[t].percent > e.percent) && (e = this.list[t]);
46
+ return e;
47
+ }
48
+ }
49
+ class Kt {
50
+ /**
51
+ * Start time in milliseconds.
52
+ */
24
53
  start = 0;
54
+ /**
55
+ * End time in milliseconds.
56
+ */
25
57
  end = 0;
58
+ /**
59
+ * Duration in milliseconds, derived from end minus start.
60
+ */
26
61
  get duration() {
27
62
  return this.end - this.start;
28
63
  }
29
- toJSON() {
30
- return {
31
- start: this.start,
32
- end: this.end,
33
- duration: this.duration
34
- };
64
+ }
65
+ class Er {
66
+ /**
67
+ * Unique identifier of the token.
68
+ */
69
+ id = B(6).toUpperCase();
70
+ /**
71
+ * Time range of the token.
72
+ */
73
+ time;
74
+ /**
75
+ * Text content of the token.
76
+ */
77
+ content = "";
78
+ }
79
+ class Jt {
80
+ /**
81
+ * Unique identifier of the item.
82
+ */
83
+ id = B(6).toUpperCase();
84
+ /**
85
+ * Time range of the item, independent from its words.
86
+ */
87
+ time;
88
+ /**
89
+ * Tokens composing the item in order.
90
+ */
91
+ words = [];
92
+ /**
93
+ * Language or transliteration scheme of this item.
94
+ * Should be set when multiple languages coexist, since line-level aggregation groups items by it.
95
+ */
96
+ language;
97
+ /**
98
+ * Flat text joined from every word.
99
+ */
100
+ get content() {
101
+ let e = "";
102
+ for (let t = 0, n = this.words.length; t < n; t++)
103
+ e += this.words[t].content;
104
+ return e;
35
105
  }
36
106
  }
37
- var Ye = /* @__PURE__ */ ((t) => (t.Normal = "Normal", t.Space = "Space", t))(Ye || {});
38
- class Yt {
39
- stress = !1;
107
+ class gr extends Jt {
108
+ /**
109
+ * Original annotation type name.
110
+ */
111
+ key = "";
112
+ }
113
+ class Rr {
114
+ /**
115
+ * Ruby annotation such as furigana.
116
+ */
117
+ ruby;
118
+ /**
119
+ * Romanized transliterations.
120
+ */
121
+ romans;
122
+ /**
123
+ * Unknown annotations keyed by their original type name.
124
+ */
125
+ unknowns;
40
126
  }
41
- class ur {
127
+ var k = /* @__PURE__ */ ((s) => (s.Normal = "Normal", s.Space = "Space", s))(k || {});
128
+ class vr {
129
+ /**
130
+ * Unique identifier of the word.
131
+ */
132
+ id = B(6).toUpperCase();
133
+ /**
134
+ * Discriminant marking this as a normal word.
135
+ */
42
136
  type = "Normal";
43
- time = new W();
137
+ /**
138
+ * Time range of the word.
139
+ */
140
+ time;
141
+ /**
142
+ * Text content of the word.
143
+ */
44
144
  content = "";
45
- extended = [];
46
- config = new Yt();
145
+ /**
146
+ * Language of this word.
147
+ */
148
+ language;
149
+ /**
150
+ * Annotations attached to this word.
151
+ */
152
+ annotation;
153
+ /**
154
+ * Whether the word is stressed.
155
+ */
156
+ stress = !1;
47
157
  }
48
- class fr {
158
+ class Ir {
159
+ /**
160
+ * Discriminant marking this as a space.
161
+ */
49
162
  type = "Space";
163
+ /**
164
+ * Number of consecutive space characters.
165
+ */
50
166
  count = 1;
51
167
  }
52
- var zt = /* @__PURE__ */ ((t) => (t.Unknown = "Unknown", t.Translate = "Translate", t.Roman = "Roman", t))(zt || {});
53
- class hr {
54
- type = "Unknown";
168
+ class Y {
169
+ /**
170
+ * Language or transliteration scheme of this item.
171
+ * Should be set when multiple languages coexist, since aggregation from words groups by it.
172
+ */
173
+ language;
174
+ /**
175
+ * Original text.
176
+ */
55
177
  content = "";
56
178
  }
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();
179
+ class Zt extends Y {
180
+ /**
181
+ * Original annotation type name.
182
+ */
183
+ key = "";
62
184
  }
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("");
185
+ class Qt {
186
+ #e;
187
+ constructor(e) {
188
+ this.#e = e;
68
189
  }
69
- toJSON() {
70
- return {
71
- words: this.words,
72
- extended: this.extended,
73
- original: this.original
74
- };
190
+ /**
191
+ * Aggregate one per-word item into a single line item, padding spaces to follow word spacing.
192
+ */
193
+ #i(e) {
194
+ let t = "", n = 0, i, c = !1;
195
+ for (let h = 0, o = this.#e.words.length; h < o; h++) {
196
+ const a = this.#e.words[h];
197
+ if (a.type === k.Space) {
198
+ n += a.count;
199
+ continue;
200
+ }
201
+ const r = e(a);
202
+ r && (c && (t += " ".repeat(n)), t += r.content, i ??= r.language, n = 0, c = !0);
203
+ }
204
+ if (!c)
205
+ return;
206
+ const l = new Y();
207
+ return l.content = t, l.language = i, l;
208
+ }
209
+ /**
210
+ * Aggregate multi-value per-word items into line items, one per language.
211
+ */
212
+ #a(e) {
213
+ const t = [];
214
+ for (let i = 0, c = this.#e.words.length; i < c; i++) {
215
+ const l = this.#e.words[i];
216
+ if (l.type === k.Space)
217
+ continue;
218
+ const h = e(l);
219
+ if (h)
220
+ for (const o of h) {
221
+ const a = o.language ?? "";
222
+ t.includes(a) || t.push(a);
223
+ }
224
+ }
225
+ if (!t.length)
226
+ return;
227
+ const n = [];
228
+ for (const i of t) {
229
+ let c = "", l = 0, h = !1;
230
+ for (let a = 0, r = this.#e.words.length; a < r; a++) {
231
+ const u = this.#e.words[a];
232
+ if (u.type === k.Space) {
233
+ l += u.count;
234
+ continue;
235
+ }
236
+ const f = e(u)?.find((E) => (E.language ?? "") === i);
237
+ f && (h && (c += " ".repeat(l)), c += f.content, l = 0, h = !0);
238
+ }
239
+ const o = new Y();
240
+ o.content = c, o.language = i || void 0, n.push(o);
241
+ }
242
+ return n;
243
+ }
244
+ /**
245
+ * Aggregate unknown per-word items into line items, one per key.
246
+ */
247
+ #o() {
248
+ const e = [];
249
+ for (let n = 0, i = this.#e.words.length; n < i; n++) {
250
+ const c = this.#e.words[n];
251
+ if (c.type === k.Space)
252
+ continue;
253
+ const l = c.annotation?.unknowns;
254
+ if (l)
255
+ for (const h of l)
256
+ e.includes(h.key) || e.push(h.key);
257
+ }
258
+ if (!e.length)
259
+ return;
260
+ const t = [];
261
+ for (const n of e) {
262
+ let i = "", c = 0, l, h = !1;
263
+ for (let a = 0, r = this.#e.words.length; a < r; a++) {
264
+ const u = this.#e.words[a];
265
+ if (u.type === k.Space) {
266
+ c += u.count;
267
+ continue;
268
+ }
269
+ const f = u.annotation?.unknowns?.find((E) => E.key === n);
270
+ f && (h && (i += " ".repeat(c)), i += f.content, l ??= f.language, c = 0, h = !0);
271
+ }
272
+ const o = new Zt();
273
+ o.key = n, o.content = i, o.language = l, t.push(o);
274
+ }
275
+ return t;
276
+ }
277
+ #t;
278
+ /**
279
+ * Ruby annotation: the explicit value, otherwise aggregated from words.
280
+ */
281
+ get ruby() {
282
+ return this.#t ?? this.#i((e) => e.annotation?.ruby);
283
+ }
284
+ /**
285
+ * Override the words-derived ruby with an explicit value.
286
+ */
287
+ set ruby(e) {
288
+ this.#t = e;
289
+ }
290
+ #r;
291
+ /**
292
+ * Romanized transliterations: the explicit value, otherwise aggregated from words grouped by language.
293
+ */
294
+ get romans() {
295
+ return this.#r ?? this.#a((e) => e.annotation?.romans);
75
296
  }
297
+ /**
298
+ * Override the words-derived romans with explicit values.
299
+ */
300
+ set romans(e) {
301
+ this.#r = e;
302
+ }
303
+ #s;
304
+ /**
305
+ * Translations, explicit only since words carry no line-level translation.
306
+ */
307
+ get translates() {
308
+ return this.#s;
309
+ }
310
+ /**
311
+ * Set the explicit translations.
312
+ */
313
+ set translates(e) {
314
+ this.#s = e;
315
+ }
316
+ #n;
317
+ /**
318
+ * Unknown annotations: the explicit value, otherwise aggregated from words grouped by key.
319
+ */
320
+ get unknowns() {
321
+ return this.#n ?? this.#o();
322
+ }
323
+ /**
324
+ * Override the words-derived unknowns with explicit values.
325
+ */
326
+ set unknowns(e) {
327
+ this.#n = e;
328
+ }
329
+ }
330
+ var er = /* @__PURE__ */ ((s) => (s.Normal = "Normal", s.Interlude = "Interlude", s))(er || {});
331
+ class tr {
332
+ /**
333
+ * Unique identifier of the line.
334
+ */
335
+ id = B(6).toUpperCase();
336
+ /**
337
+ * Time range of the line.
338
+ */
339
+ time = new Kt();
76
340
  }
77
- class Zt {
341
+ class rr extends tr {
342
+ /**
343
+ * Discriminant marking this as a normal line.
344
+ */
78
345
  type = "Normal";
79
- id = We(4).toUpperCase();
80
- time = new W();
81
- content = new Kt();
346
+ /**
347
+ * Performing agent of this line.
348
+ */
82
349
  agent;
350
+ /**
351
+ * Words composing the line in order.
352
+ */
353
+ words = [];
354
+ /**
355
+ * Plain text of the line joined from every word.
356
+ */
357
+ get original() {
358
+ let e = "";
359
+ for (let t = 0, n = this.words.length; t < n; t++) {
360
+ const i = this.words[t];
361
+ e += i.type === k.Normal ? i.content : " ".repeat(i.count);
362
+ }
363
+ return e;
364
+ }
365
+ /**
366
+ * Annotations applied to the whole line, derived from words unless set explicitly.
367
+ */
368
+ annotation = new Qt(this);
369
+ #e;
370
+ /**
371
+ * Language tags of this line: the value set explicitly, otherwise collected from words.
372
+ */
373
+ get languages() {
374
+ if (this.#e?.length)
375
+ return this.#e;
376
+ const e = /* @__PURE__ */ new Set();
377
+ for (let t = 0, n = this.words.length; t < n; t++) {
378
+ const i = this.words[t];
379
+ i.type === k.Normal && i.language && e.add(i.language);
380
+ }
381
+ return [...e];
382
+ }
383
+ /**
384
+ * Override the words-derived languages with explicit tags.
385
+ */
386
+ set languages(e) {
387
+ this.#e = e;
388
+ }
83
389
  }
84
- class Er extends Zt {
85
- }
86
- class mr extends Zt {
390
+ class $r extends rr {
391
+ /**
392
+ * Background lines attached to this line.
393
+ */
87
394
  background;
88
395
  }
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
- };
396
+ class Lr extends tr {
397
+ /**
398
+ * Discriminant marking this as an interlude line.
399
+ */
400
+ type = "Interlude";
119
401
  }
120
- class Lr extends F {
121
- type = "Unknown";
122
- content = "";
402
+ var _ = /* @__PURE__ */ ((s) => (s.Offset = "Offset", s.Duration = "Duration", s.Title = "Title", s.Singer = "Singer", s.Album = "Album", s.Creator = "Creator", s.Author = "Author", s.Isrc = "Isrc", s.Unknown = "Unknown", s))(_ || {});
403
+ const Tr = (s, e, t) => ({
404
+ id: B(6).toUpperCase(),
405
+ type: s,
406
+ key: e,
407
+ value: t
408
+ });
409
+ class sr {
410
+ /**
411
+ * All meta entries in order.
412
+ */
413
+ list = [];
414
+ listOf(e) {
415
+ return this.list.filter((t) => t.type === e);
416
+ }
417
+ /**
418
+ * All offset meta entries.
419
+ */
420
+ get offsets() {
421
+ return this.listOf(_.Offset);
422
+ }
423
+ /**
424
+ * All duration meta entries.
425
+ */
426
+ get durations() {
427
+ return this.listOf(_.Duration);
428
+ }
429
+ /**
430
+ * All title meta entries.
431
+ */
432
+ get titles() {
433
+ return this.listOf(_.Title);
434
+ }
435
+ /**
436
+ * All singer meta entries.
437
+ */
438
+ get singers() {
439
+ return this.listOf(_.Singer);
440
+ }
441
+ /**
442
+ * All album meta entries.
443
+ */
444
+ get albums() {
445
+ return this.listOf(_.Album);
446
+ }
447
+ /**
448
+ * All creator meta entries.
449
+ */
450
+ get creators() {
451
+ return this.listOf(_.Creator);
452
+ }
453
+ /**
454
+ * All author meta entries.
455
+ */
456
+ get authors() {
457
+ return this.listOf(_.Author);
458
+ }
459
+ /**
460
+ * All isrc meta entries.
461
+ */
462
+ get isrcs() {
463
+ return this.listOf(_.Isrc);
464
+ }
465
+ /**
466
+ * All unknown meta entries.
467
+ */
468
+ get unknowns() {
469
+ return this.listOf(_.Unknown);
470
+ }
123
471
  }
124
- class Tr {
472
+ var nr = /* @__PURE__ */ ((s) => (s.Person = "Person", s.Group = "Group", s.Other = "Other", s.Unknown = "Unknown", s))(nr || {});
473
+ class Or {
474
+ /**
475
+ * Unique identifier of the agent.
476
+ */
125
477
  id = "";
126
- name = "";
478
+ /**
479
+ * Performing type of the agent.
480
+ */
481
+ type = "Unknown";
482
+ /**
483
+ * Number of lines performed by this agent.
484
+ */
127
485
  count = 0;
486
+ /**
487
+ * Display names of the agent; a group may carry more than one.
488
+ */
489
+ names = [];
128
490
  }
129
- class er {
130
- // index in global
131
- global = 0;
132
- // index in block
133
- block = 0;
134
- }
135
- class Nr {
491
+ class Sr {
492
+ /**
493
+ * Identifier of the referenced Agent.
494
+ */
136
495
  id = "";
137
- index = new er();
496
+ /**
497
+ * Index of this agent occurrence among all lines.
498
+ */
499
+ globalIndex = 0;
500
+ /**
501
+ * Index of this agent occurrence within its block.
502
+ */
503
+ blockIndex = 0;
138
504
  }
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;
505
+ const ir = "0.8.0";
506
+ var ar = /* @__PURE__ */ ((s) => (s.Invalid = "Invalid", s.Empty = "Empty", s.Normal = "Normal", s))(ar || {}), or = /* @__PURE__ */ ((s) => (s.None = "None", s.Line = "Line", s.Syllable = "Syllable", s))(or || {});
507
+ class Nr {
508
+ /**
509
+ * Schema version of this data model.
510
+ */
511
+ version = ir;
512
+ /**
513
+ * Overall classification of the lyric.
514
+ */
143
515
  type = "Invalid";
144
- metas = [];
145
- lines = [];
516
+ /**
517
+ * Timing precision of the lyric.
518
+ */
519
+ timing = "None";
520
+ /**
521
+ * Metadata of the lyric.
522
+ */
523
+ meta = new sr();
524
+ /**
525
+ * Language distribution of the lyric.
526
+ */
527
+ language = new Yt();
528
+ /**
529
+ * Performing agents referenced by lines.
530
+ */
146
531
  agents = [];
532
+ /**
533
+ * Lyric lines in order.
534
+ */
535
+ lines = [];
147
536
  }
148
- const M = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
537
+ const z = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
149
538
  __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
539
+ Agent: Or,
540
+ AgentType: nr,
541
+ Info: Nr,
542
+ InfoTiming: or,
543
+ InfoType: ar,
544
+ Language: Yt,
545
+ LanguageItem: dr,
546
+ LanguageType: zt,
547
+ LineAgent: Sr,
548
+ LineAnnotation: Qt,
549
+ LineAnnotationItem: Y,
550
+ LineInterlude: Lr,
551
+ LineNormal: $r,
552
+ LineNormalBase: rr,
553
+ LineType: er,
554
+ LineUnknownAnnotation: Zt,
555
+ Meta: sr,
556
+ MetaType: _,
557
+ Time: Kt,
558
+ Version: ir,
559
+ WordAnnotation: Rr,
560
+ WordAnnotationContent: Er,
561
+ WordAnnotationItem: Jt,
562
+ WordNormal: vr,
563
+ WordSpace: Ir,
564
+ WordType: k,
565
+ WordUnknownAnnotation: gr,
566
+ createMetaItem: Tr
176
567
  }, Symbol.toStringTag, { value: "Module" }));
177
- var H = { exports: {} }, se, tt;
178
- function Y() {
179
- if (tt) return se;
568
+ class wr {
569
+ lines = [];
570
+ mergedEnd = [];
571
+ /**
572
+ * Raw deactivation time of a line: the later of its own end and the next line's start.
573
+ *
574
+ * The final line never deactivates, and out-of-range indices resolve to 0.
575
+ */
576
+ getRawTime(e) {
577
+ const t = this.lines;
578
+ return e < 0 || e >= t.length ? 0 : e === t.length - 1 ? 1 / 0 : Math.max(t[e].time.end, t[e + 1].time.start);
579
+ }
580
+ /**
581
+ * Rebuild the merged end-time table from the given lines and merge settings.
582
+ */
583
+ build(e, t, n) {
584
+ this.lines = e;
585
+ const i = e.length, c = new Array(i);
586
+ if (i === 0) {
587
+ this.mergedEnd = c;
588
+ return;
589
+ }
590
+ const l = Math.max(0, t), h = n > 0 ? n : 1 / 0;
591
+ let o = this.getRawTime(i - 1);
592
+ c[i - 1] = o;
593
+ let a = 1;
594
+ for (let r = i - 2; r >= 0; r--) {
595
+ const u = this.getRawTime(r);
596
+ l > 0 && a < h && Math.abs(o - u) < l ? (c[r] = Math.max(u, c[r + 1]), a++) : (c[r] = u, a = 1), o = u;
597
+ }
598
+ this.mergedEnd = c;
599
+ }
600
+ /**
601
+ * Merged deactivation time of a line, falling back to the raw time when unbuilt.
602
+ */
603
+ getMergedTime(e) {
604
+ const t = this.mergedEnd[e];
605
+ return t === void 0 ? this.getRawTime(e) : t;
606
+ }
607
+ }
608
+ class Ar {
609
+ temp = 0;
610
+ meta = 0;
611
+ setTemp(e) {
612
+ this.temp = Number.isFinite(e) ? e : 0;
613
+ }
614
+ resetTemp() {
615
+ this.temp = 0;
616
+ }
617
+ refreshFromMeta(e, t) {
618
+ if (!t) {
619
+ this.meta = 0;
620
+ return;
621
+ }
622
+ const n = e.meta.offsets[0]?.value;
623
+ this.meta = typeof n == "number" && Number.isFinite(n) ? n : 0;
624
+ }
625
+ resolve(e) {
626
+ const t = e + this.meta + this.temp;
627
+ return Number.isFinite(t) ? t : 0;
628
+ }
629
+ }
630
+ class yr {
631
+ frameId = null;
632
+ timerId = null;
633
+ schedule(e, t) {
634
+ switch (e) {
635
+ case "animation":
636
+ this.frameId = globalThis.requestAnimationFrame(t);
637
+ break;
638
+ case "timer":
639
+ this.timerId = globalThis.setTimeout(t, 16);
640
+ break;
641
+ }
642
+ }
643
+ cancel() {
644
+ this.frameId !== null && (globalThis.cancelAnimationFrame(this.frameId), this.frameId = null), this.timerId !== null && (globalThis.clearTimeout(this.timerId), this.timerId = null);
645
+ }
646
+ }
647
+ var H = { exports: {} }, ie, tt;
648
+ function K() {
649
+ if (tt) return ie;
180
650
  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,
651
+ const s = "2.0.0", e = 256, t = Number.MAX_SAFE_INTEGER || /* istanbul ignore next */
652
+ 9007199254740991, n = 16, i = e - 6;
653
+ return ie = {
654
+ MAX_LENGTH: e,
655
+ MAX_SAFE_COMPONENT_LENGTH: n,
186
656
  MAX_SAFE_BUILD_LENGTH: i,
187
- MAX_SAFE_INTEGER: r,
657
+ MAX_SAFE_INTEGER: t,
188
658
  RELEASE_TYPES: [
189
659
  "major",
190
660
  "premajor",
@@ -194,99 +664,99 @@ function Y() {
194
664
  "prepatch",
195
665
  "prerelease"
196
666
  ],
197
- SEMVER_SPEC_VERSION: t,
667
+ SEMVER_SPEC_VERSION: s,
198
668
  FLAG_INCLUDE_PRERELEASE: 1,
199
669
  FLAG_LOOSE: 2
200
- }, se;
670
+ }, ie;
201
671
  }
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;
672
+ var ae, rt;
673
+ function J() {
674
+ return rt || (rt = 1, ae = typeof process == "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...e) => console.error("SEMVER", ...e) : () => {
675
+ }), ae;
206
676
  }
207
677
  var st;
208
- function B() {
209
- return st || (st = 1, (function(t, n) {
678
+ function W() {
679
+ return st || (st = 1, (function(s, e) {
210
680
  const {
211
- MAX_SAFE_COMPONENT_LENGTH: r,
212
- MAX_SAFE_BUILD_LENGTH: s,
681
+ MAX_SAFE_COMPONENT_LENGTH: t,
682
+ MAX_SAFE_BUILD_LENGTH: n,
213
683
  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 = [
684
+ } = K(), c = J();
685
+ e = s.exports = {};
686
+ const l = e.re = [], h = e.safeRe = [], o = e.src = [], a = e.safeSrc = [], r = e.t = {};
687
+ let u = 0;
688
+ const f = "[a-zA-Z0-9-]", E = [
219
689
  ["\\s", 1],
220
690
  ["\\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);
691
+ [f, n]
692
+ ], S = (O) => {
693
+ for (const [w, G] of E)
694
+ O = O.split(`${w}*`).join(`${w}{0,${G}}`).split(`${w}+`).join(`${w}{1,${G}}`);
695
+ return O;
696
+ }, p = (O, w, G) => {
697
+ const A = S(w), b = u++;
698
+ c(O, b, w), r[O] = b, o[b] = w, a[b] = A, l[b] = new RegExp(w, G ? "g" : void 0), h[b] = new RegExp(A, G ? "g" : void 0);
229
699
  };
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*$");
700
+ p("NUMERICIDENTIFIER", "0|[1-9]\\d*"), p("NUMERICIDENTIFIERLOOSE", "\\d+"), p("NONNUMERICIDENTIFIER", `\\d*[a-zA-Z-]${f}*`), p("MAINVERSION", `(${o[r.NUMERICIDENTIFIER]})\\.(${o[r.NUMERICIDENTIFIER]})\\.(${o[r.NUMERICIDENTIFIER]})`), p("MAINVERSIONLOOSE", `(${o[r.NUMERICIDENTIFIERLOOSE]})\\.(${o[r.NUMERICIDENTIFIERLOOSE]})\\.(${o[r.NUMERICIDENTIFIERLOOSE]})`), p("PRERELEASEIDENTIFIER", `(?:${o[r.NONNUMERICIDENTIFIER]}|${o[r.NUMERICIDENTIFIER]})`), p("PRERELEASEIDENTIFIERLOOSE", `(?:${o[r.NONNUMERICIDENTIFIER]}|${o[r.NUMERICIDENTIFIERLOOSE]})`), p("PRERELEASE", `(?:-(${o[r.PRERELEASEIDENTIFIER]}(?:\\.${o[r.PRERELEASEIDENTIFIER]})*))`), p("PRERELEASELOOSE", `(?:-?(${o[r.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${o[r.PRERELEASEIDENTIFIERLOOSE]})*))`), p("BUILDIDENTIFIER", `${f}+`), p("BUILD", `(?:\\+(${o[r.BUILDIDENTIFIER]}(?:\\.${o[r.BUILDIDENTIFIER]})*))`), p("FULLPLAIN", `v?${o[r.MAINVERSION]}${o[r.PRERELEASE]}?${o[r.BUILD]}?`), p("FULL", `^${o[r.FULLPLAIN]}$`), p("LOOSEPLAIN", `[v=\\s]*${o[r.MAINVERSIONLOOSE]}${o[r.PRERELEASELOOSE]}?${o[r.BUILD]}?`), p("LOOSE", `^${o[r.LOOSEPLAIN]}$`), p("GTLT", "((?:<|>)?=?)"), p("XRANGEIDENTIFIERLOOSE", `${o[r.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`), p("XRANGEIDENTIFIER", `${o[r.NUMERICIDENTIFIER]}|x|X|\\*`), p("XRANGEPLAIN", `[v=\\s]*(${o[r.XRANGEIDENTIFIER]})(?:\\.(${o[r.XRANGEIDENTIFIER]})(?:\\.(${o[r.XRANGEIDENTIFIER]})(?:${o[r.PRERELEASE]})?${o[r.BUILD]}?)?)?`), p("XRANGEPLAINLOOSE", `[v=\\s]*(${o[r.XRANGEIDENTIFIERLOOSE]})(?:\\.(${o[r.XRANGEIDENTIFIERLOOSE]})(?:\\.(${o[r.XRANGEIDENTIFIERLOOSE]})(?:${o[r.PRERELEASELOOSE]})?${o[r.BUILD]}?)?)?`), p("XRANGE", `^${o[r.GTLT]}\\s*${o[r.XRANGEPLAIN]}$`), p("XRANGELOOSE", `^${o[r.GTLT]}\\s*${o[r.XRANGEPLAINLOOSE]}$`), p("COERCEPLAIN", `(^|[^\\d])(\\d{1,${t}})(?:\\.(\\d{1,${t}}))?(?:\\.(\\d{1,${t}}))?`), p("COERCE", `${o[r.COERCEPLAIN]}(?:$|[^\\d])`), p("COERCEFULL", o[r.COERCEPLAIN] + `(?:${o[r.PRERELEASE]})?(?:${o[r.BUILD]})?(?:$|[^\\d])`), p("COERCERTL", o[r.COERCE], !0), p("COERCERTLFULL", o[r.COERCEFULL], !0), p("LONETILDE", "(?:~>?)"), p("TILDETRIM", `(\\s*)${o[r.LONETILDE]}\\s+`, !0), e.tildeTrimReplace = "$1~", p("TILDE", `^${o[r.LONETILDE]}${o[r.XRANGEPLAIN]}$`), p("TILDELOOSE", `^${o[r.LONETILDE]}${o[r.XRANGEPLAINLOOSE]}$`), p("LONECARET", "(?:\\^)"), p("CARETTRIM", `(\\s*)${o[r.LONECARET]}\\s+`, !0), e.caretTrimReplace = "$1^", p("CARET", `^${o[r.LONECARET]}${o[r.XRANGEPLAIN]}$`), p("CARETLOOSE", `^${o[r.LONECARET]}${o[r.XRANGEPLAINLOOSE]}$`), p("COMPARATORLOOSE", `^${o[r.GTLT]}\\s*(${o[r.LOOSEPLAIN]})$|^$`), p("COMPARATOR", `^${o[r.GTLT]}\\s*(${o[r.FULLPLAIN]})$|^$`), p("COMPARATORTRIM", `(\\s*)${o[r.GTLT]}\\s*(${o[r.LOOSEPLAIN]}|${o[r.XRANGEPLAIN]})`, !0), e.comparatorTrimReplace = "$1$2$3", p("HYPHENRANGE", `^\\s*(${o[r.XRANGEPLAIN]})\\s+-\\s+(${o[r.XRANGEPLAIN]})\\s*$`), p("HYPHENRANGELOOSE", `^\\s*(${o[r.XRANGEPLAINLOOSE]})\\s+-\\s+(${o[r.XRANGEPLAINLOOSE]})\\s*$`), p("STAR", "(<|>)?=?\\s*\\*"), p("GTE0", "^\\s*>=\\s*0\\.0\\.0\\s*$"), p("GTE0PRE", "^\\s*>=\\s*0\\.0\\.0-0\\s*$");
231
701
  })(H, H.exports)), H.exports;
232
702
  }
233
- var ie, nt;
234
- function ze() {
235
- if (nt) return ie;
703
+ var oe, nt;
704
+ function Ye() {
705
+ if (nt) return oe;
236
706
  nt = 1;
237
- const t = Object.freeze({ loose: !0 }), n = Object.freeze({});
238
- return ie = (s) => s ? typeof s != "object" ? t : s : n, ie;
707
+ const s = Object.freeze({ loose: !0 }), e = Object.freeze({});
708
+ return oe = (n) => n ? typeof n != "object" ? s : n : e, oe;
239
709
  }
240
- var ae, it;
241
- function sr() {
242
- if (it) return ae;
710
+ var le, it;
711
+ function lr() {
712
+ if (it) return le;
243
713
  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;
714
+ const s = /^[0-9]+$/, e = (n, i) => {
715
+ if (typeof n == "number" && typeof i == "number")
716
+ return n === i ? 0 : n < i ? -1 : 1;
717
+ const c = s.test(n), l = s.test(i);
718
+ return c && l && (n = +n, i = +i), n === i ? 0 : c && !l ? -1 : l && !c ? 1 : n < i ? -1 : 1;
249
719
  };
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;
720
+ return le = {
721
+ compareIdentifiers: e,
722
+ rcompareIdentifiers: (n, i) => e(i, n)
723
+ }, le;
724
+ }
725
+ var ce, at;
726
+ function x() {
727
+ if (at) return ce;
258
728
  at = 1;
259
- const t = z(), { MAX_LENGTH: n, MAX_SAFE_INTEGER: r } = Y(), { safeRe: s, t: i } = B(), u = ze(), { compareIdentifiers: l } = sr();
729
+ const s = J(), { MAX_LENGTH: e, MAX_SAFE_INTEGER: t } = K(), { safeRe: n, t: i } = W(), c = Ye(), { compareIdentifiers: l } = lr();
260
730
  class h {
261
- constructor(a, e) {
262
- if (e = u(e), a instanceof h) {
263
- if (a.loose === !!e.loose && a.includePrerelease === !!e.includePrerelease)
731
+ constructor(a, r) {
732
+ if (r = c(r), a instanceof h) {
733
+ if (a.loose === !!r.loose && a.includePrerelease === !!r.includePrerelease)
264
734
  return a;
265
735
  a = a.version;
266
736
  } else if (typeof a != "string")
267
737
  throw new TypeError(`Invalid version. Must be a string. Got type "${typeof a}".`);
268
- if (a.length > n)
738
+ if (a.length > e)
269
739
  throw new TypeError(
270
- `version is longer than ${n} characters`
740
+ `version is longer than ${e} characters`
271
741
  );
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)
742
+ s("SemVer", a, r), this.options = r, this.loose = !!r.loose, this.includePrerelease = !!r.includePrerelease;
743
+ const u = a.trim().match(r.loose ? n[i.LOOSE] : n[i.FULL]);
744
+ if (!u)
275
745
  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)
746
+ if (this.raw = a, this.major = +u[1], this.minor = +u[2], this.patch = +u[3], this.major > t || this.major < 0)
277
747
  throw new TypeError("Invalid major version");
278
- if (this.minor > r || this.minor < 0)
748
+ if (this.minor > t || this.minor < 0)
279
749
  throw new TypeError("Invalid minor version");
280
- if (this.patch > r || this.patch < 0)
750
+ if (this.patch > t || this.patch < 0)
281
751
  throw new TypeError("Invalid patch version");
282
- c[4] ? this.prerelease = c[4].split(".").map((f) => {
752
+ u[4] ? this.prerelease = u[4].split(".").map((f) => {
283
753
  if (/^[0-9]+$/.test(f)) {
284
- const d = +f;
285
- if (d >= 0 && d < r)
286
- return d;
754
+ const E = +f;
755
+ if (E >= 0 && E < t)
756
+ return E;
287
757
  }
288
758
  return f;
289
- }) : this.prerelease = [], this.build = c[5] ? c[5].split(".") : [], this.format();
759
+ }) : this.prerelease = [], this.build = u[5] ? u[5].split(".") : [], this.format();
290
760
  }
291
761
  format() {
292
762
  return this.version = `${this.major}.${this.minor}.${this.patch}`, this.prerelease.length && (this.version += `-${this.prerelease.join(".")}`), this.version;
@@ -295,7 +765,7 @@ function b() {
295
765
  return this.version;
296
766
  }
297
767
  compare(a) {
298
- if (t("SemVer.compare", this.version, this.options, a), !(a instanceof h)) {
768
+ if (s("SemVer.compare", this.version, this.options, a), !(a instanceof h)) {
299
769
  if (typeof a == "string" && a === this.version)
300
770
  return 0;
301
771
  a = new h(a, this.options);
@@ -312,62 +782,62 @@ function b() {
312
782
  return 1;
313
783
  if (!this.prerelease.length && !a.prerelease.length)
314
784
  return 0;
315
- let e = 0;
785
+ let r = 0;
316
786
  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)
787
+ const u = this.prerelease[r], f = a.prerelease[r];
788
+ if (s("prerelease compare", r, u, f), u === void 0 && f === void 0)
319
789
  return 0;
320
790
  if (f === void 0)
321
791
  return 1;
322
- if (c === void 0)
792
+ if (u === void 0)
323
793
  return -1;
324
- if (c === f)
794
+ if (u === f)
325
795
  continue;
326
- return l(c, f);
327
- } while (++e);
796
+ return l(u, f);
797
+ } while (++r);
328
798
  }
329
799
  compareBuild(a) {
330
800
  a instanceof h || (a = new h(a, this.options));
331
- let e = 0;
801
+ let r = 0;
332
802
  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)
803
+ const u = this.build[r], f = a.build[r];
804
+ if (s("build compare", r, u, f), u === void 0 && f === void 0)
335
805
  return 0;
336
806
  if (f === void 0)
337
807
  return 1;
338
- if (c === void 0)
808
+ if (u === void 0)
339
809
  return -1;
340
- if (c === f)
810
+ if (u === f)
341
811
  continue;
342
- return l(c, f);
343
- } while (++e);
812
+ return l(u, f);
813
+ } while (++r);
344
814
  }
345
815
  // preminor will bump the version up to the next minor release, and immediately
346
816
  // down to pre-release. premajor and prepatch work the same way.
347
- inc(a, e, c) {
817
+ inc(a, r, u) {
348
818
  if (a.startsWith("pre")) {
349
- if (!e && c === !1)
819
+ if (!r && u === !1)
350
820
  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}`);
821
+ if (r) {
822
+ const f = `-${r}`.match(this.options.loose ? n[i.PRERELEASELOOSE] : n[i.PRERELEASE]);
823
+ if (!f || f[1] !== r)
824
+ throw new Error(`invalid identifier: ${r}`);
355
825
  }
356
826
  }
357
827
  switch (a) {
358
828
  case "premajor":
359
- this.prerelease.length = 0, this.patch = 0, this.minor = 0, this.major++, this.inc("pre", e, c);
829
+ this.prerelease.length = 0, this.patch = 0, this.minor = 0, this.major++, this.inc("pre", r, u);
360
830
  break;
361
831
  case "preminor":
362
- this.prerelease.length = 0, this.patch = 0, this.minor++, this.inc("pre", e, c);
832
+ this.prerelease.length = 0, this.patch = 0, this.minor++, this.inc("pre", r, u);
363
833
  break;
364
834
  case "prepatch":
365
- this.prerelease.length = 0, this.inc("patch", e, c), this.inc("pre", e, c);
835
+ this.prerelease.length = 0, this.inc("patch", r, u), this.inc("pre", r, u);
366
836
  break;
367
837
  // If the input is a non-prerelease version, this acts the same as
368
838
  // prepatch.
369
839
  case "prerelease":
370
- this.prerelease.length === 0 && this.inc("patch", e, c), this.inc("pre", e, c);
840
+ this.prerelease.length === 0 && this.inc("patch", r, u), this.inc("pre", r, u);
371
841
  break;
372
842
  case "release":
373
843
  if (this.prerelease.length === 0)
@@ -386,22 +856,22 @@ function b() {
386
856
  // This probably shouldn't be used publicly.
387
857
  // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
388
858
  case "pre": {
389
- const f = Number(c) ? 1 : 0;
859
+ const f = Number(u) ? 1 : 0;
390
860
  if (this.prerelease.length === 0)
391
861
  this.prerelease = [f];
392
862
  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)
863
+ let E = this.prerelease.length;
864
+ for (; --E >= 0; )
865
+ typeof this.prerelease[E] == "number" && (this.prerelease[E]++, E = -2);
866
+ if (E === -1) {
867
+ if (r === this.prerelease.join(".") && u === !1)
398
868
  throw new Error("invalid increment argument: identifier already exists");
399
869
  this.prerelease.push(f);
400
870
  }
401
871
  }
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;
872
+ if (r) {
873
+ let E = [r, f];
874
+ u === !1 && (E = [r]), l(this.prerelease[0], r) === 0 ? isNaN(this.prerelease[1]) && (this.prerelease = E) : this.prerelease = E;
405
875
  }
406
876
  break;
407
877
  }
@@ -411,206 +881,206 @@ function b() {
411
881
  return this.raw = this.format(), this.build.length && (this.raw += `+${this.build.join(".")}`), this;
412
882
  }
413
883
  }
414
- return oe = h, oe;
884
+ return ce = h, ce;
415
885
  }
416
- var le, ot;
417
- function V() {
418
- if (ot) return le;
886
+ var ue, ot;
887
+ function M() {
888
+ if (ot) return ue;
419
889
  ot = 1;
420
- const t = b();
421
- return le = (r, s, i = !1) => {
422
- if (r instanceof t)
423
- return r;
890
+ const s = x();
891
+ return ue = (t, n, i = !1) => {
892
+ if (t instanceof s)
893
+ return t;
424
894
  try {
425
- return new t(r, s);
426
- } catch (u) {
895
+ return new s(t, n);
896
+ } catch (c) {
427
897
  if (!i)
428
898
  return null;
429
- throw u;
899
+ throw c;
430
900
  }
431
- }, le;
901
+ }, ue;
432
902
  }
433
- var ce, lt;
434
- function Sr() {
435
- if (lt) return ce;
903
+ var he, lt;
904
+ function Cr() {
905
+ if (lt) return he;
436
906
  lt = 1;
437
- const t = V();
438
- return ce = (r, s) => {
439
- const i = t(r, s);
907
+ const s = M();
908
+ return he = (t, n) => {
909
+ const i = s(t, n);
440
910
  return i ? i.version : null;
441
- }, ce;
911
+ }, he;
442
912
  }
443
- var ue, ct;
444
- function Ar() {
445
- if (ct) return ue;
913
+ var fe, ct;
914
+ function Pr() {
915
+ if (ct) return fe;
446
916
  ct = 1;
447
- const t = V();
448
- return ue = (r, s) => {
449
- const i = t(r.trim().replace(/^[=v]+/, ""), s);
917
+ const s = M();
918
+ return fe = (t, n) => {
919
+ const i = s(t.trim().replace(/^[=v]+/, ""), n);
450
920
  return i ? i.version : null;
451
- }, ue;
921
+ }, fe;
452
922
  }
453
- var fe, ut;
454
- function wr() {
455
- if (ut) return fe;
923
+ var me, ut;
924
+ function qr() {
925
+ if (ut) return me;
456
926
  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);
927
+ const s = x();
928
+ return me = (t, n, i, c, l) => {
929
+ typeof i == "string" && (l = c, c = i, i = void 0);
460
930
  try {
461
- return new t(
462
- r instanceof t ? r.version : r,
931
+ return new s(
932
+ t instanceof s ? t.version : t,
463
933
  i
464
- ).inc(s, u, l).version;
934
+ ).inc(n, c, l).version;
465
935
  } catch {
466
936
  return null;
467
937
  }
468
- }, fe;
938
+ }, me;
469
939
  }
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);
940
+ var pe, ht;
941
+ function Gr() {
942
+ if (ht) return pe;
943
+ ht = 1;
944
+ const s = M();
945
+ return pe = (t, n) => {
946
+ const i = s(t, null, !0), c = s(n, null, !0), l = i.compare(c);
477
947
  if (l === 0)
478
948
  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) {
949
+ const h = l > 0, o = h ? i : c, a = h ? c : i, r = !!o.prerelease.length;
950
+ if (!!a.prerelease.length && !r) {
481
951
  if (!a.patch && !a.minor)
482
952
  return "major";
483
953
  if (a.compareMain(o) === 0)
484
954
  return a.minor && !a.patch ? "minor" : "patch";
485
955
  }
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;
956
+ const f = r ? "pre" : "";
957
+ return i.major !== c.major ? f + "major" : i.minor !== c.minor ? f + "minor" : i.patch !== c.patch ? f + "patch" : "prerelease";
958
+ }, pe;
489
959
  }
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;
960
+ var de, ft;
961
+ function br() {
962
+ if (ft) return de;
963
+ ft = 1;
964
+ const s = x();
965
+ return de = (t, n) => new s(t, n).major, de;
510
966
  }
511
- var de, mt;
512
- function Gr() {
513
- if (mt) return de;
967
+ var Ee, mt;
968
+ function Dr() {
969
+ if (mt) return Ee;
514
970
  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;
971
+ const s = x();
972
+ return Ee = (t, n) => new s(t, n).minor, Ee;
973
+ }
974
+ var ge, pt;
975
+ function xr() {
976
+ if (pt) return ge;
977
+ pt = 1;
978
+ const s = x();
979
+ return ge = (t, n) => new s(t, n).patch, ge;
520
980
  }
521
981
  var Re, dt;
522
- function U() {
982
+ function Ur() {
523
983
  if (dt) return Re;
524
984
  dt = 1;
525
- const t = b();
526
- return Re = (r, s, i) => new t(r, i).compare(new t(s, i)), Re;
985
+ const s = M();
986
+ return Re = (t, n) => {
987
+ const i = s(t, n);
988
+ return i && i.prerelease.length ? i.prerelease : null;
989
+ }, Re;
527
990
  }
528
- var ve, Rt;
529
- function xr() {
530
- if (Rt) return ve;
991
+ var ve, Et;
992
+ function F() {
993
+ if (Et) return ve;
994
+ Et = 1;
995
+ const s = x();
996
+ return ve = (t, n, i) => new s(t, i).compare(new s(n, i)), ve;
997
+ }
998
+ var Ie, gt;
999
+ function _r() {
1000
+ if (gt) return Ie;
1001
+ gt = 1;
1002
+ const s = F();
1003
+ return Ie = (t, n, i) => s(n, t, i), Ie;
1004
+ }
1005
+ var $e, Rt;
1006
+ function Fr() {
1007
+ if (Rt) return $e;
531
1008
  Rt = 1;
532
- const t = U();
533
- return ve = (r, s, i) => t(s, r, i), ve;
1009
+ const s = F();
1010
+ return $e = (t, n) => s(t, n, !0), $e;
534
1011
  }
535
- var Ie, vt;
536
- function Dr() {
537
- if (vt) return Ie;
1012
+ var Le, vt;
1013
+ function Ke() {
1014
+ if (vt) return Le;
538
1015
  vt = 1;
539
- const t = U();
540
- return Ie = (r, s) => t(r, s, !0), Ie;
1016
+ const s = x();
1017
+ return Le = (t, n, i) => {
1018
+ const c = new s(t, i), l = new s(n, i);
1019
+ return c.compare(l) || c.compareBuild(l);
1020
+ }, Le;
541
1021
  }
542
- var $e, It;
543
- function Je() {
544
- if (It) return $e;
1022
+ var Te, It;
1023
+ function jr() {
1024
+ if (It) return Te;
545
1025
  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;
1026
+ const s = Ke();
1027
+ return Te = (t, n) => t.sort((i, c) => s(i, c, n)), Te;
551
1028
  }
552
- var ge, $t;
553
- function br() {
554
- if ($t) return ge;
1029
+ var Oe, $t;
1030
+ function kr() {
1031
+ if ($t) return Oe;
555
1032
  $t = 1;
556
- const t = Je();
557
- return ge = (r, s) => r.sort((i, u) => t(i, u, s)), ge;
558
- }
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;
1033
+ const s = Ke();
1034
+ return Oe = (t, n) => t.sort((i, c) => s(c, i, n)), Oe;
565
1035
  }
566
- var Te, Lt;
567
- function J() {
568
- if (Lt) return Te;
1036
+ var Se, Lt;
1037
+ function Z() {
1038
+ if (Lt) return Se;
569
1039
  Lt = 1;
570
- const t = U();
571
- return Te = (r, s, i) => t(r, s, i) > 0, Te;
1040
+ const s = F();
1041
+ return Se = (t, n, i) => s(t, n, i) > 0, Se;
572
1042
  }
573
1043
  var Ne, Tt;
574
- function Ke() {
1044
+ function Je() {
575
1045
  if (Tt) return Ne;
576
1046
  Tt = 1;
577
- const t = U();
578
- return Ne = (r, s, i) => t(r, s, i) < 0, Ne;
1047
+ const s = F();
1048
+ return Ne = (t, n, i) => s(t, n, i) < 0, Ne;
579
1049
  }
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;
1050
+ var we, Ot;
1051
+ function cr() {
1052
+ if (Ot) return we;
590
1053
  Ot = 1;
591
- const t = U();
592
- return Se = (r, s, i) => t(r, s, i) !== 0, Se;
1054
+ const s = F();
1055
+ return we = (t, n, i) => s(t, n, i) === 0, we;
593
1056
  }
594
1057
  var Ae, St;
595
- function Ze() {
1058
+ function ur() {
596
1059
  if (St) return Ae;
597
1060
  St = 1;
598
- const t = U();
599
- return Ae = (r, s, i) => t(r, s, i) >= 0, Ae;
1061
+ const s = F();
1062
+ return Ae = (t, n, i) => s(t, n, i) !== 0, Ae;
600
1063
  }
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;
1064
+ var ye, Nt;
1065
+ function Ze() {
1066
+ if (Nt) return ye;
1067
+ Nt = 1;
1068
+ const s = F();
1069
+ return ye = (t, n, i) => s(t, n, i) >= 0, ye;
607
1070
  }
608
- var ye, wt;
609
- function ar() {
610
- if (wt) return ye;
1071
+ var Ce, wt;
1072
+ function Qe() {
1073
+ if (wt) return Ce;
611
1074
  wt = 1;
612
- const t = nr(), n = ir(), r = J(), s = Ze(), i = Ke(), u = Qe();
613
- return ye = (h, o, a, e) => {
1075
+ const s = F();
1076
+ return Ce = (t, n, i) => s(t, n, i) <= 0, Ce;
1077
+ }
1078
+ var Pe, At;
1079
+ function hr() {
1080
+ if (At) return Pe;
1081
+ At = 1;
1082
+ const s = cr(), e = ur(), t = Z(), n = Ze(), i = Je(), c = Qe();
1083
+ return Pe = (h, o, a, r) => {
614
1084
  switch (o) {
615
1085
  case "===":
616
1086
  return typeof h == "object" && (h = h.version), typeof a == "object" && (a = a.version), h === a;
@@ -619,99 +1089,99 @@ function ar() {
619
1089
  case "":
620
1090
  case "=":
621
1091
  case "==":
622
- return t(h, a, e);
1092
+ return s(h, a, r);
623
1093
  case "!=":
624
- return n(h, a, e);
1094
+ return e(h, a, r);
625
1095
  case ">":
626
- return r(h, a, e);
1096
+ return t(h, a, r);
627
1097
  case ">=":
628
- return s(h, a, e);
1098
+ return n(h, a, r);
629
1099
  case "<":
630
- return i(h, a, e);
1100
+ return i(h, a, r);
631
1101
  case "<=":
632
- return u(h, a, e);
1102
+ return c(h, a, r);
633
1103
  default:
634
1104
  throw new TypeError(`Invalid operator: ${o}`);
635
1105
  }
636
- }, ye;
1106
+ }, Pe;
637
1107
  }
638
- var Ce, yt;
639
- function Ur() {
640
- if (yt) return Ce;
1108
+ var qe, yt;
1109
+ function Mr() {
1110
+ if (yt) return qe;
641
1111
  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")
1112
+ const s = x(), e = M(), { safeRe: t, t: n } = W();
1113
+ return qe = (c, l) => {
1114
+ if (c instanceof s)
1115
+ return c;
1116
+ if (typeof c == "number" && (c = String(c)), typeof c != "string")
647
1117
  return null;
648
1118
  l = l || {};
649
1119
  let h = null;
650
1120
  if (!l.rtl)
651
- h = u.match(l.includePrerelease ? r[s.COERCEFULL] : r[s.COERCE]);
1121
+ h = c.match(l.includePrerelease ? t[n.COERCEFULL] : t[n.COERCE]);
652
1122
  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;
1123
+ const E = l.includePrerelease ? t[n.COERCERTLFULL] : t[n.COERCERTL];
1124
+ let S;
1125
+ for (; (S = E.exec(c)) && (!h || h.index + h[0].length !== c.length); )
1126
+ (!h || S.index + S[0].length !== h.index + h[0].length) && (h = S), E.lastIndex = S.index + S[1].length + S[2].length;
1127
+ E.lastIndex = -1;
658
1128
  }
659
1129
  if (h === null)
660
1130
  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;
1131
+ const o = h[2], a = h[3] || "0", r = h[4] || "0", u = l.includePrerelease && h[5] ? `-${h[5]}` : "", f = l.includePrerelease && h[6] ? `+${h[6]}` : "";
1132
+ return e(`${o}.${a}.${r}${u}${f}`, l);
1133
+ }, qe;
664
1134
  }
665
- var qe, Ct;
666
- function jr() {
667
- if (Ct) return qe;
1135
+ var Ge, Ct;
1136
+ function Vr() {
1137
+ if (Ct) return Ge;
668
1138
  Ct = 1;
669
- class t {
1139
+ class s {
670
1140
  constructor() {
671
1141
  this.max = 1e3, this.map = /* @__PURE__ */ new Map();
672
1142
  }
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;
1143
+ get(t) {
1144
+ const n = this.map.get(t);
1145
+ if (n !== void 0)
1146
+ return this.map.delete(t), this.map.set(t, n), n;
677
1147
  }
678
- delete(r) {
679
- return this.map.delete(r);
1148
+ delete(t) {
1149
+ return this.map.delete(t);
680
1150
  }
681
- set(r, s) {
682
- if (!this.delete(r) && s !== void 0) {
1151
+ set(t, n) {
1152
+ if (!this.delete(t) && n !== void 0) {
683
1153
  if (this.map.size >= this.max) {
684
- const u = this.map.keys().next().value;
685
- this.delete(u);
1154
+ const c = this.map.keys().next().value;
1155
+ this.delete(c);
686
1156
  }
687
- this.map.set(r, s);
1157
+ this.map.set(t, n);
688
1158
  }
689
1159
  return this;
690
1160
  }
691
1161
  }
692
- return qe = t, qe;
1162
+ return Ge = s, Ge;
693
1163
  }
694
- var Pe, qt;
1164
+ var be, Pt;
695
1165
  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)
1166
+ if (Pt) return be;
1167
+ Pt = 1;
1168
+ const s = /\s+/g;
1169
+ class e {
1170
+ constructor(m, v) {
1171
+ if (v = i(v), m instanceof e)
1172
+ return m.loose === !!v.loose && m.includePrerelease === !!v.includePrerelease ? m : new e(m.raw, v);
1173
+ if (m instanceof c)
1174
+ return this.raw = m.value, this.set = [[m]], this.formatted = void 0, this;
1175
+ if (this.options = v, this.loose = !!v.loose, this.includePrerelease = !!v.includePrerelease, this.raw = m.trim().replace(s, " "), this.set = this.raw.split("||").map((g) => this.parseRange(g.trim())).filter((g) => g.length), !this.set.length)
706
1176
  throw new TypeError(`Invalid SemVer Range: ${this.raw}`);
707
1177
  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];
1178
+ const g = this.set[0];
1179
+ if (this.set = this.set.filter((I) => !p(I[0])), this.set.length === 0)
1180
+ this.set = [g];
711
1181
  else if (this.set.length > 1) {
712
- for (const $ of this.set)
713
- if ($.length === 1 && N($[0])) {
714
- this.set = [$];
1182
+ for (const I of this.set)
1183
+ if (I.length === 1 && O(I[0])) {
1184
+ this.set = [I];
715
1185
  break;
716
1186
  }
717
1187
  }
@@ -721,11 +1191,11 @@ function j() {
721
1191
  get range() {
722
1192
  if (this.formatted === void 0) {
723
1193
  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();
1194
+ for (let m = 0; m < this.set.length; m++) {
1195
+ m > 0 && (this.formatted += "||");
1196
+ const v = this.set[m];
1197
+ for (let g = 0; g < v.length; g++)
1198
+ g > 0 && (this.formatted += " "), this.formatted += v[g].toString().trim();
729
1199
  }
730
1200
  }
731
1201
  return this.formatted;
@@ -736,478 +1206,478 @@ function j() {
736
1206
  toString() {
737
1207
  return this.range;
738
1208
  }
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);
1209
+ parseRange(m) {
1210
+ const g = ((this.options.includePrerelease && E) | (this.options.loose && S)) + ":" + m, I = n.get(g);
1211
+ if (I)
1212
+ return I;
1213
+ const R = this.options.loose, $ = R ? o[a.HYPHENRANGELOOSE] : o[a.HYPHENRANGE];
1214
+ m = m.replace($, se(this.options.includePrerelease)), l("hyphen replace", m), m = m.replace(o[a.COMPARATORTRIM], r), l("comparator trim", m), m = m.replace(o[a.TILDETRIM], u), l("tilde trim", m), m = m.replace(o[a.CARETTRIM], f), l("caret trim", m);
1215
+ let N = m.split(" ").map((P) => G(P, this.options)).join(" ").split(/\s+/).map((P) => re(P, this.options));
1216
+ R && (N = N.filter((P) => (l("loose invalid filter", P, this.options), !!P.match(o[a.COMPARATORLOOSE])))), l("range list", N);
1217
+ const T = /* @__PURE__ */ new Map(), y = N.map((P) => new c(P, this.options));
1218
+ for (const P of y) {
1219
+ if (p(P))
1220
+ return [P];
1221
+ T.set(P.value, P);
752
1222
  }
753
1223
  T.size > 1 && T.has("") && T.delete("");
754
1224
  const D = [...T.values()];
755
- return s.set(R, D), D;
1225
+ return n.set(g, D), D;
756
1226
  }
757
- intersects(p, I) {
758
- if (!(p instanceof n))
1227
+ intersects(m, v) {
1228
+ if (!(m instanceof e))
759
1229
  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)))));
1230
+ return this.set.some((g) => w(g, v) && m.set.some((I) => w(I, v) && g.every((R) => I.every(($) => R.intersects($, v)))));
761
1231
  }
762
1232
  // if ANY of the sets match ALL of its comparators, then pass
763
- test(p) {
764
- if (!p)
1233
+ test(m) {
1234
+ if (!m)
765
1235
  return !1;
766
- if (typeof p == "string")
1236
+ if (typeof m == "string")
767
1237
  try {
768
- p = new h(p, this.options);
1238
+ m = new h(m, this.options);
769
1239
  } catch {
770
1240
  return !1;
771
1241
  }
772
- for (let I = 0; I < this.set.length; I++)
773
- if (re(this.set[I], p, this.options))
1242
+ for (let v = 0; v < this.set.length; v++)
1243
+ if (ne(this.set[v], m, this.options))
774
1244
  return !0;
775
1245
  return !1;
776
1246
  }
777
1247
  }
778
- Pe = n;
779
- const r = jr(), s = new r(), i = ze(), u = K(), l = z(), h = b(), {
1248
+ be = e;
1249
+ const t = Vr(), n = new t(), i = Ye(), c = Q(), l = J(), h = x(), {
780
1250
  safeRe: o,
781
1251
  t: a,
782
- comparatorTrimReplace: e,
783
- tildeTrimReplace: c,
1252
+ comparatorTrimReplace: r,
1253
+ tildeTrimReplace: u,
784
1254
  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);
1255
+ } = W(), { FLAG_INCLUDE_PRERELEASE: E, FLAG_LOOSE: S } = K(), p = (d) => d.value === "<0.0.0-0", O = (d) => d.value === "", w = (d, m) => {
1256
+ let v = !0;
1257
+ const g = d.slice();
1258
+ let I = g.pop();
1259
+ for (; v && g.length; )
1260
+ v = g.every((R) => I.intersects(R, m)), I = g.pop();
1261
+ return v;
1262
+ }, G = (d, m) => (d = d.replace(o[a.BUILD], ""), l("comp", d, m), d = C(d, m), l("caret", d), d = b(d, m), l("tildes", d), d = L(d, m), l("xrange", d), d = te(d, m), l("stars", d), d), A = (d) => !d || d.toLowerCase() === "x" || d === "*", b = (d, m) => d.trim().split(/\s+/).map((v) => U(v, m)).join(" "), U = (d, m) => {
1263
+ const v = m.loose ? o[a.TILDELOOSE] : o[a.TILDE];
1264
+ return d.replace(v, (g, I, R, $, N) => {
1265
+ l("tilde", d, g, I, R, $, N);
796
1266
  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;
1267
+ return A(I) ? T = "" : A(R) ? T = `>=${I}.0.0 <${+I + 1}.0.0-0` : A($) ? T = `>=${I}.${R}.0 <${I}.${+R + 1}.0-0` : N ? (l("replaceTilde pr", N), T = `>=${I}.${R}.${$}-${N} <${I}.${+R + 1}.0-0`) : T = `>=${I}.${R}.${$} <${I}.${+R + 1}.0-0`, l("tilde return", T), T;
798
1268
  });
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);
1269
+ }, C = (d, m) => d.trim().split(/\s+/).map((v) => q(v, m)).join(" "), q = (d, m) => {
1270
+ l("caret", d, m);
1271
+ const v = m.loose ? o[a.CARETLOOSE] : o[a.CARET], g = m.includePrerelease ? "-0" : "";
1272
+ return d.replace(v, (I, R, $, N, T) => {
1273
+ l("caret", d, I, R, $, N, T);
804
1274
  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;
1275
+ return A(R) ? y = "" : A($) ? y = `>=${R}.0.0${g} <${+R + 1}.0.0-0` : A(N) ? R === "0" ? y = `>=${R}.${$}.0${g} <${R}.${+$ + 1}.0-0` : y = `>=${R}.${$}.0${g} <${+R + 1}.0.0-0` : T ? (l("replaceCaret pr", T), R === "0" ? $ === "0" ? y = `>=${R}.${$}.${N}-${T} <${R}.${$}.${+N + 1}-0` : y = `>=${R}.${$}.${N}-${T} <${R}.${+$ + 1}.0-0` : y = `>=${R}.${$}.${N}-${T} <${+R + 1}.0.0-0`) : (l("no pr"), R === "0" ? $ === "0" ? y = `>=${R}.${$}.${N}${g} <${R}.${$}.${+N + 1}-0` : y = `>=${R}.${$}.${N}${g} <${R}.${+$ + 1}.0-0` : y = `>=${R}.${$}.${N} <${+R + 1}.0.0-0`), l("caret return", y), y;
806
1276
  });
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;
1277
+ }, L = (d, m) => (l("replaceXRanges", d, m), d.split(/\s+/).map((v) => V(v, m)).join(" ")), V = (d, m) => {
1278
+ d = d.trim();
1279
+ const v = m.loose ? o[a.XRANGELOOSE] : o[a.XRANGE];
1280
+ return d.replace(v, (g, I, R, $, N, T) => {
1281
+ l("xRange", d, g, I, R, $, N, T);
1282
+ const y = A(R), D = y || A($), P = D || A(N), X = P;
1283
+ return I === "=" && X && (I = ""), T = m.includePrerelease ? "-0" : "", y ? I === ">" || I === "<" ? g = "<0.0.0-0" : g = "*" : I && X ? (D && ($ = 0), N = 0, I === ">" ? (I = ">=", D ? (R = +R + 1, $ = 0, N = 0) : ($ = +$ + 1, N = 0)) : I === "<=" && (I = "<", D ? R = +R + 1 : $ = +$ + 1), I === "<" && (T = "-0"), g = `${I + R}.${$}.${N}${T}`) : D ? g = `>=${R}.0.0${T} <${+R + 1}.0.0-0` : P && (g = `>=${R}.${$}.0${T} <${R}.${+$ + 1}.0-0`), l("xRange return", g), g;
814
1284
  });
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))
1285
+ }, te = (d, m) => (l("replaceStars", d, m), d.trim().replace(o[a.STAR], "")), re = (d, m) => (l("replaceGTE0", d, m), d.trim().replace(o[m.includePrerelease ? a.GTE0PRE : a.GTE0], "")), se = (d) => (m, v, g, I, R, $, N, T, y, D, P, X) => (A(g) ? v = "" : A(I) ? v = `>=${g}.0.0${d ? "-0" : ""}` : A(R) ? v = `>=${g}.${I}.0${d ? "-0" : ""}` : $ ? v = `>=${v}` : v = `>=${v}${d ? "-0" : ""}`, A(y) ? T = "" : A(D) ? T = `<${+y + 1}.0.0-0` : A(P) ? T = `<${y}.${+D + 1}.0-0` : X ? T = `<=${y}.${D}.${P}-${X}` : d ? T = `<${y}.${D}.${+P + 1}-0` : T = `<=${T}`, `${v} ${T}`.trim()), ne = (d, m, v) => {
1286
+ for (let g = 0; g < d.length; g++)
1287
+ if (!d[g].test(m))
818
1288
  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)
1289
+ if (m.prerelease.length && !v.includePrerelease) {
1290
+ for (let g = 0; g < d.length; g++)
1291
+ if (l(d[g].semver), d[g].semver !== c.ANY && d[g].semver.prerelease.length > 0) {
1292
+ const I = d[g].semver;
1293
+ if (I.major === m.major && I.minor === m.minor && I.patch === m.patch)
824
1294
  return !0;
825
1295
  }
826
1296
  return !1;
827
1297
  }
828
1298
  return !0;
829
1299
  };
830
- return Pe;
1300
+ return be;
831
1301
  }
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 {
1302
+ var De, qt;
1303
+ function Q() {
1304
+ if (qt) return De;
1305
+ qt = 1;
1306
+ const s = /* @__PURE__ */ Symbol("SemVer ANY");
1307
+ class e {
838
1308
  static get ANY() {
839
- return t;
1309
+ return s;
840
1310
  }
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;
1311
+ constructor(r, u) {
1312
+ if (u = t(u), r instanceof e) {
1313
+ if (r.loose === !!u.loose)
1314
+ return r;
1315
+ r = r.value;
846
1316
  }
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);
1317
+ r = r.trim().split(/\s+/).join(" "), l("comparator", r, u), this.options = u, this.loose = !!u.loose, this.parse(r), this.semver === s ? this.value = "" : this.value = this.operator + this.semver.version, l("comp", this);
848
1318
  }
849
- parse(e) {
850
- const c = this.options.loose ? s[i.COMPARATORLOOSE] : s[i.COMPARATOR], f = e.match(c);
1319
+ parse(r) {
1320
+ const u = this.options.loose ? n[i.COMPARATORLOOSE] : n[i.COMPARATOR], f = r.match(u);
851
1321
  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;
1322
+ throw new TypeError(`Invalid comparator: ${r}`);
1323
+ 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 = s;
854
1324
  }
855
1325
  toString() {
856
1326
  return this.value;
857
1327
  }
858
- test(e) {
859
- if (l("Comparator.test", e, this.options.loose), this.semver === t || e === t)
1328
+ test(r) {
1329
+ if (l("Comparator.test", r, this.options.loose), this.semver === s || r === s)
860
1330
  return !0;
861
- if (typeof e == "string")
1331
+ if (typeof r == "string")
862
1332
  try {
863
- e = new h(e, this.options);
1333
+ r = new h(r, this.options);
864
1334
  } catch {
865
1335
  return !1;
866
1336
  }
867
- return u(e, this.operator, this.semver, this.options);
1337
+ return c(r, this.operator, this.semver, this.options);
868
1338
  }
869
- intersects(e, c) {
870
- if (!(e instanceof n))
1339
+ intersects(r, u) {
1340
+ if (!(r instanceof e))
871
1341
  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(">")));
1342
+ return this.operator === "" ? this.value === "" ? !0 : new o(r.value, u).test(this.value) : r.operator === "" ? r.value === "" ? !0 : new o(this.value, u).test(r.semver) : (u = t(u), u.includePrerelease && (this.value === "<0.0.0-0" || r.value === "<0.0.0-0") || !u.includePrerelease && (this.value.startsWith("<0.0.0") || r.value.startsWith("<0.0.0")) ? !1 : !!(this.operator.startsWith(">") && r.operator.startsWith(">") || this.operator.startsWith("<") && r.operator.startsWith("<") || this.semver.version === r.semver.version && this.operator.includes("=") && r.operator.includes("=") || c(this.semver, "<", r.semver, u) && this.operator.startsWith(">") && r.operator.startsWith("<") || c(this.semver, ">", r.semver, u) && this.operator.startsWith("<") && r.operator.startsWith(">")));
873
1343
  }
874
1344
  }
875
- Ge = n;
876
- const r = ze(), { safeRe: s, t: i } = B(), u = ar(), l = z(), h = b(), o = j();
877
- return Ge;
1345
+ De = e;
1346
+ const t = Ye(), { safeRe: n, t: i } = W(), c = hr(), l = J(), h = x(), o = j();
1347
+ return De;
878
1348
  }
879
1349
  var xe, Gt;
880
- function Z() {
1350
+ function ee() {
881
1351
  if (Gt) return xe;
882
1352
  Gt = 1;
883
- const t = j();
884
- return xe = (r, s, i) => {
1353
+ const s = j();
1354
+ return xe = (t, n, i) => {
885
1355
  try {
886
- s = new t(s, i);
1356
+ n = new s(n, i);
887
1357
  } catch {
888
1358
  return !1;
889
1359
  }
890
- return s.test(r);
1360
+ return n.test(t);
891
1361
  }, xe;
892
1362
  }
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;
1363
+ var Ue, bt;
1364
+ function Xr() {
1365
+ if (bt) return Ue;
1366
+ bt = 1;
1367
+ const s = j();
1368
+ return Ue = (t, n) => new s(t, n).set.map((i) => i.map((c) => c.value).join(" ").trim().split(" ")), Ue;
899
1369
  }
900
- var be, Dt;
901
- function Vr() {
902
- if (Dt) return be;
1370
+ var _e, Dt;
1371
+ function Br() {
1372
+ if (Dt) return _e;
903
1373
  Dt = 1;
904
- const t = b(), n = j();
905
- return be = (s, i, u) => {
1374
+ const s = x(), e = j();
1375
+ return _e = (n, i, c) => {
906
1376
  let l = null, h = null, o = null;
907
1377
  try {
908
- o = new n(i, u);
1378
+ o = new e(i, c);
909
1379
  } catch {
910
1380
  return null;
911
1381
  }
912
- return s.forEach((a) => {
913
- o.test(a) && (!l || h.compare(a) === -1) && (l = a, h = new t(l, u));
1382
+ return n.forEach((a) => {
1383
+ o.test(a) && (!l || h.compare(a) === -1) && (l = a, h = new s(l, c));
914
1384
  }), l;
915
- }, be;
1385
+ }, _e;
916
1386
  }
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) => {
1387
+ var Fe, xt;
1388
+ function Wr() {
1389
+ if (xt) return Fe;
1390
+ xt = 1;
1391
+ const s = x(), e = j();
1392
+ return Fe = (n, i, c) => {
923
1393
  let l = null, h = null, o = null;
924
1394
  try {
925
- o = new n(i, u);
1395
+ o = new e(i, c);
926
1396
  } catch {
927
1397
  return null;
928
1398
  }
929
- return s.forEach((a) => {
930
- o.test(a) && (!l || h.compare(a) === 1) && (l = a, h = new t(l, u));
1399
+ return n.forEach((a) => {
1400
+ o.test(a) && (!l || h.compare(a) === 1) && (l = a, h = new s(l, c));
931
1401
  }), l;
932
- }, _e;
1402
+ }, Fe;
933
1403
  }
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)))
1404
+ var je, Ut;
1405
+ function Hr() {
1406
+ if (Ut) return je;
1407
+ Ut = 1;
1408
+ const s = x(), e = j(), t = Z();
1409
+ return je = (i, c) => {
1410
+ i = new e(i, c);
1411
+ let l = new s("0.0.0");
1412
+ if (i.test(l) || (l = new s("0.0.0-0"), i.test(l)))
943
1413
  return l;
944
1414
  l = null;
945
1415
  for (let h = 0; h < i.set.length; ++h) {
946
1416
  const o = i.set[h];
947
1417
  let a = null;
948
- o.forEach((e) => {
949
- const c = new t(e.semver.version);
950
- switch (e.operator) {
1418
+ o.forEach((r) => {
1419
+ const u = new s(r.semver.version);
1420
+ switch (r.operator) {
951
1421
  case ">":
952
- c.prerelease.length === 0 ? c.patch++ : c.prerelease.push(0), c.raw = c.format();
1422
+ u.prerelease.length === 0 ? u.patch++ : u.prerelease.push(0), u.raw = u.format();
953
1423
  /* fallthrough */
954
1424
  case "":
955
1425
  case ">=":
956
- (!a || r(c, a)) && (a = c);
1426
+ (!a || t(u, a)) && (a = u);
957
1427
  break;
958
1428
  case "<":
959
1429
  case "<=":
960
1430
  break;
961
1431
  /* istanbul ignore next */
962
1432
  default:
963
- throw new Error(`Unexpected operation: ${e.operator}`);
1433
+ throw new Error(`Unexpected operation: ${r.operator}`);
964
1434
  }
965
- }), a && (!l || r(l, a)) && (l = a);
1435
+ }), a && (!l || t(l, a)) && (l = a);
966
1436
  }
967
1437
  return l && i.test(l) ? l : null;
968
- }, Ue;
1438
+ }, je;
969
1439
  }
970
- var je, Ut;
971
- function Mr() {
972
- if (Ut) return je;
973
- Ut = 1;
974
- const t = j();
975
- return je = (r, s) => {
1440
+ var ke, _t;
1441
+ function zr() {
1442
+ if (_t) return ke;
1443
+ _t = 1;
1444
+ const s = j();
1445
+ return ke = (t, n) => {
976
1446
  try {
977
- return new t(r, s).range || "*";
1447
+ return new s(t, n).range || "*";
978
1448
  } catch {
979
1449
  return null;
980
1450
  }
981
- }, je;
1451
+ }, ke;
982
1452
  }
983
- var Fe, jt;
1453
+ var Me, Ft;
984
1454
  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;
1455
+ if (Ft) return Me;
1456
+ Ft = 1;
1457
+ const s = x(), e = Q(), { ANY: t } = e, n = j(), i = ee(), c = Z(), l = Je(), h = Qe(), o = Ze();
1458
+ return Me = (r, u, f, E) => {
1459
+ r = new s(r, E), u = new n(u, E);
1460
+ let S, p, O, w, G;
991
1461
  switch (f) {
992
1462
  case ">":
993
- O = u, E = h, N = l, A = ">", G = ">=";
1463
+ S = c, p = h, O = l, w = ">", G = ">=";
994
1464
  break;
995
1465
  case "<":
996
- O = l, E = o, N = u, A = "<", G = "<=";
1466
+ S = l, p = o, O = c, w = "<", G = "<=";
997
1467
  break;
998
1468
  default:
999
1469
  throw new TypeError('Must provide a hilo val of "<" or ">"');
1000
1470
  }
1001
- if (i(e, c, d))
1471
+ if (i(r, u, E))
1002
1472
  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))
1473
+ for (let A = 0; A < u.set.length; ++A) {
1474
+ const b = u.set[A];
1475
+ let U = null, C = null;
1476
+ if (b.forEach((q) => {
1477
+ q.semver === t && (q = new e(">=0.0.0")), U = U || q, C = C || q, S(q.semver, U.semver, E) ? U = q : O(q.semver, C.semver, E) && (C = q);
1478
+ }), U.operator === w || U.operator === G || (!C.operator || C.operator === w) && p(r, C.semver))
1009
1479
  return !1;
1010
- if (C.operator === G && N(e, C.semver))
1480
+ if (C.operator === G && O(r, C.semver))
1011
1481
  return !1;
1012
1482
  }
1013
1483
  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;
1484
+ }, Me;
1022
1485
  }
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;
1486
+ var Ve, jt;
1487
+ function Yr() {
1488
+ if (jt) return Ve;
1489
+ jt = 1;
1490
+ const s = et();
1491
+ return Ve = (t, n, i) => s(t, n, ">", i), Ve;
1029
1492
  }
1030
1493
  var Xe, kt;
1031
- function Wr() {
1494
+ function Kr() {
1032
1495
  if (kt) return Xe;
1033
1496
  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;
1497
+ const s = et();
1498
+ return Xe = (t, n, i) => s(t, n, "<", i), Xe;
1055
1499
  }
1056
1500
  var Be, Mt;
1057
- function zr() {
1501
+ function Jr() {
1058
1502
  if (Mt) return Be;
1059
1503
  Mt = 1;
1060
- const t = j(), n = K(), { ANY: r } = n, s = Z(), i = U(), u = (c, f, d = {}) => {
1061
- if (c === f)
1504
+ const s = j();
1505
+ return Be = (t, n, i) => (t = new s(t, i), n = new s(n, i), t.intersects(n, i)), Be;
1506
+ }
1507
+ var We, Vt;
1508
+ function Zr() {
1509
+ if (Vt) return We;
1510
+ Vt = 1;
1511
+ const s = ee(), e = F();
1512
+ return We = (t, n, i) => {
1513
+ const c = [];
1514
+ let l = null, h = null;
1515
+ const o = t.sort((f, E) => e(f, E, i));
1516
+ for (const f of o)
1517
+ s(f, n, i) ? (h = f, l || (l = f)) : (h && c.push([l, h]), h = null, l = null);
1518
+ l && c.push([l, null]);
1519
+ const a = [];
1520
+ for (const [f, E] of c)
1521
+ f === E ? a.push(f) : !E && f === o[0] ? a.push("*") : E ? f === o[0] ? a.push(`<=${E}`) : a.push(`${f} - ${E}`) : a.push(`>=${f}`);
1522
+ const r = a.join(" || "), u = typeof n.raw == "string" ? n.raw : String(n);
1523
+ return r.length < u.length ? r : n;
1524
+ }, We;
1525
+ }
1526
+ var He, Xt;
1527
+ function Qr() {
1528
+ if (Xt) return He;
1529
+ Xt = 1;
1530
+ const s = j(), e = Q(), { ANY: t } = e, n = ee(), i = F(), c = (u, f, E = {}) => {
1531
+ if (u === f)
1062
1532
  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)
1533
+ u = new s(u, E), f = new s(f, E);
1534
+ let S = !1;
1535
+ e: for (const p of u.set) {
1536
+ for (const O of f.set) {
1537
+ const w = o(p, O, E);
1538
+ if (S = S || w !== null, w)
1069
1539
  continue e;
1070
1540
  }
1071
- if (O)
1541
+ if (S)
1072
1542
  return !1;
1073
1543
  }
1074
1544
  return !0;
1075
- }, l = [new n(">=0.0.0-0")], h = [new n(">=0.0.0")], o = (c, f, d) => {
1076
- if (c === f)
1545
+ }, l = [new e(">=0.0.0-0")], h = [new e(">=0.0.0")], o = (u, f, E) => {
1546
+ if (u === f)
1077
1547
  return !0;
1078
- if (c.length === 1 && c[0].semver === r) {
1079
- if (f.length === 1 && f[0].semver === r)
1548
+ if (u.length === 1 && u[0].semver === t) {
1549
+ if (f.length === 1 && f[0].semver === t)
1080
1550
  return !0;
1081
- d.includePrerelease ? c = l : c = h;
1551
+ E.includePrerelease ? u = l : u = h;
1082
1552
  }
1083
- if (f.length === 1 && f[0].semver === r) {
1084
- if (d.includePrerelease)
1553
+ if (f.length === 1 && f[0].semver === t) {
1554
+ if (E.includePrerelease)
1085
1555
  return !0;
1086
1556
  f = h;
1087
1557
  }
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)
1558
+ const S = /* @__PURE__ */ new Set();
1559
+ let p, O;
1560
+ for (const L of u)
1561
+ L.operator === ">" || L.operator === ">=" ? p = a(p, L, E) : L.operator === "<" || L.operator === "<=" ? O = r(O, L, E) : S.add(L.semver);
1562
+ if (S.size > 1)
1093
1563
  return null;
1094
- let A;
1095
- if (E && N) {
1096
- if (A = i(E.semver, N.semver, d), A > 0)
1564
+ let w;
1565
+ if (p && O) {
1566
+ if (w = i(p.semver, O.semver, E), w > 0)
1097
1567
  return null;
1098
- if (A === 0 && (E.operator !== ">=" || N.operator !== "<="))
1568
+ if (w === 0 && (p.operator !== ">=" || O.operator !== "<="))
1099
1569
  return null;
1100
1570
  }
1101
- for (const L of O) {
1102
- if (E && !s(L, String(E), d) || N && !s(L, String(N), d))
1571
+ for (const L of S) {
1572
+ if (p && !n(L, String(p), E) || O && !n(L, String(O), E))
1103
1573
  return null;
1104
- for (const k of f)
1105
- if (!s(L, String(k), d))
1574
+ for (const V of f)
1575
+ if (!n(L, String(V), E))
1106
1576
  return !1;
1107
1577
  return !0;
1108
1578
  }
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);
1579
+ let G, A, b, U, C = O && !E.includePrerelease && O.semver.prerelease.length ? O.semver : !1, q = p && !E.includePrerelease && p.semver.prerelease.length ? p.semver : !1;
1580
+ C && C.prerelease.length === 1 && O.operator === "<" && C.prerelease[0] === 0 && (C = !1);
1111
1581
  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)
1582
+ if (U = U || L.operator === ">" || L.operator === ">=", b = b || L.operator === "<" || L.operator === "<=", p) {
1583
+ if (q && L.semver.prerelease && L.semver.prerelease.length && L.semver.major === q.major && L.semver.minor === q.minor && L.semver.patch === q.patch && (q = !1), L.operator === ">" || L.operator === ">=") {
1584
+ if (G = a(p, L, E), G === L && G !== p)
1115
1585
  return !1;
1116
- } else if (E.operator === ">=" && !s(E.semver, String(L), d))
1586
+ } else if (p.operator === ">=" && !n(p.semver, String(L), E))
1117
1587
  return !1;
1118
1588
  }
1119
- if (N) {
1589
+ if (O) {
1120
1590
  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)
1591
+ if (A = r(O, L, E), A === L && A !== O)
1122
1592
  return !1;
1123
- } else if (N.operator === "<=" && !s(N.semver, String(L), d))
1593
+ } else if (O.operator === "<=" && !n(O.semver, String(L), E))
1124
1594
  return !1;
1125
1595
  }
1126
- if (!L.operator && (N || E) && A !== 0)
1596
+ if (!L.operator && (O || p) && w !== 0)
1127
1597
  return !1;
1128
1598
  }
1129
- return !(E && x && !N && A !== 0 || N && _ && !E && A !== 0 || P || C);
1130
- }, a = (c, f, d) => {
1131
- if (!c)
1599
+ return !(p && b && !O && w !== 0 || O && U && !p && w !== 0 || q || C);
1600
+ }, a = (u, f, E) => {
1601
+ if (!u)
1132
1602
  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)
1603
+ const S = i(u.semver, f.semver, E);
1604
+ return S > 0 ? u : S < 0 || f.operator === ">" && u.operator === ">=" ? f : u;
1605
+ }, r = (u, f, E) => {
1606
+ if (!u)
1137
1607
  return f;
1138
- const O = i(c.semver, f.semver, d);
1139
- return O < 0 ? c : O > 0 || f.operator === "<" && c.operator === "<=" ? f : c;
1608
+ const S = i(u.semver, f.semver, E);
1609
+ return S < 0 ? u : S > 0 || f.operator === "<" && u.operator === "<=" ? f : u;
1140
1610
  };
1141
- return Be = u, Be;
1611
+ return He = c, He;
1142
1612
  }
1143
- var He, Bt;
1144
- function Jr() {
1145
- if (Bt) return He;
1613
+ var ze, Bt;
1614
+ function es() {
1615
+ if (Bt) return ze;
1146
1616
  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 = {
1617
+ const s = W(), e = K(), t = x(), n = lr(), i = M(), c = Cr(), l = Pr(), h = qr(), o = Gr(), a = br(), r = Dr(), u = xr(), f = Ur(), E = F(), S = _r(), p = Fr(), O = Ke(), w = jr(), G = kr(), A = Z(), b = Je(), U = cr(), C = ur(), q = Ze(), L = Qe(), V = hr(), te = Mr(), re = Q(), se = j(), ne = ee(), d = Xr(), m = Br(), v = Wr(), g = Hr(), I = zr(), R = et(), $ = Yr(), N = Kr(), T = Jr(), y = Zr(), D = Qr();
1618
+ return ze = {
1149
1619
  parse: i,
1150
- valid: u,
1620
+ valid: c,
1151
1621
  clean: l,
1152
1622
  inc: h,
1153
1623
  diff: o,
1154
1624
  major: a,
1155
- minor: e,
1156
- patch: c,
1625
+ minor: r,
1626
+ patch: u,
1157
1627
  prerelease: f,
1158
- compare: d,
1159
- rcompare: O,
1160
- compareLoose: E,
1161
- compareBuild: N,
1162
- sort: A,
1628
+ compare: E,
1629
+ rcompare: S,
1630
+ compareLoose: p,
1631
+ compareBuild: O,
1632
+ sort: w,
1163
1633
  rsort: G,
1164
- gt: w,
1165
- lt: x,
1166
- eq: _,
1634
+ gt: A,
1635
+ lt: b,
1636
+ eq: U,
1167
1637
  neq: C,
1168
- gte: P,
1638
+ gte: q,
1169
1639
  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,
1640
+ cmp: V,
1641
+ coerce: te,
1642
+ Comparator: re,
1643
+ Range: se,
1644
+ satisfies: ne,
1645
+ toComparators: d,
1646
+ maxSatisfying: m,
1647
+ minSatisfying: v,
1648
+ minVersion: g,
1649
+ validRange: I,
1650
+ outside: R,
1651
+ gtr: $,
1652
+ ltr: N,
1183
1653
  intersects: T,
1184
1654
  simplifyRange: y,
1185
1655
  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();
1656
+ SemVer: t,
1657
+ re: s.re,
1658
+ src: s.src,
1659
+ tokens: s.t,
1660
+ SEMVER_SPEC_VERSION: e.SEMVER_SPEC_VERSION,
1661
+ RELEASE_TYPES: e.RELEASE_TYPES,
1662
+ compareIdentifiers: n.compareIdentifiers,
1663
+ rcompareIdentifiers: n.rcompareIdentifiers
1664
+ }, ze;
1665
+ }
1666
+ var ts = es();
1667
+ const Wt = `^${z.Version}`;
1668
+ class is {
1669
+ config = new mr(Ht);
1670
+ event = new pr();
1201
1671
  state;
1202
1672
  active;
1203
1673
  time;
1204
- offset;
1205
1674
  info;
1675
+ merger = new wr();
1676
+ offset = new Ar();
1677
+ driver = new yr();
1206
1678
  constructor() {
1207
1679
  this.state = {
1208
1680
  playing: !1,
1209
- frameId: null,
1210
- timerId: null,
1211
1681
  scanIndex: 0
1212
1682
  }, this.active = {
1213
1683
  lines: [],
@@ -1215,14 +1685,11 @@ class ts {
1215
1685
  }, this.time = {
1216
1686
  start: 0,
1217
1687
  seek: 0
1218
- }, this.offset = {
1219
- temp: 0,
1220
- meta: 0
1221
- }, this.info = new M.Info(), this.config.event.add("update", this.onConfigUpdate);
1222
- }
1223
- onConfigUpdate = (n) => {
1224
- const r = n.has("offset.useMeta");
1225
- r && this.handleRefreshOffset(), (r || n.has("offset.global")) && this.handleSyncTime();
1688
+ }, this.info = new z.Info(), this.config.event.add("update", this.onConfigUpdate);
1689
+ }
1690
+ onConfigUpdate = (e) => {
1691
+ const t = e.has("offset.useMeta");
1692
+ t && this.offset.refreshFromMeta(this.info, this.config.current.offset.useMeta), (t || e.has("offset.global")) && this.handleSyncTime(), (e.has("mergeWindow") || e.has("mergeLimit")) && (this.handleBuildMergedLineEnd(), this.handleSyncTime());
1226
1693
  };
1227
1694
  // Get current playback time.
1228
1695
  handleGetCurrentTime() {
@@ -1232,144 +1699,134 @@ class ts {
1232
1699
  handleGetEffectiveTime() {
1233
1700
  return this.handleGetCurrentTime() + this.currentOffset;
1234
1701
  }
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)
1245
- return 0;
1246
- if (n === this.info.lines.length - 1)
1247
- return 1 / 0;
1248
- const r = this.info.lines[n], s = this.info.lines[n + 1];
1249
- return Math.max(r.time.end, s.time.start);
1702
+ /**
1703
+ * Rebuild the merged line-end table from the current lyric and merge config.
1704
+ */
1705
+ handleBuildMergedLineEnd() {
1706
+ this.merger.build(this.info.lines, this.config.current.mergeWindow, this.config.current.mergeLimit);
1250
1707
  }
1251
1708
  handleGetActiveIndex() {
1252
1709
  return this.active.index.length > 0 ? this.active.index[0] : -1;
1253
1710
  }
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]);
1711
+ handleBridgeActive(e, t) {
1712
+ if (!this.config.current.bridgeActive || t.length < 2)
1713
+ return { lines: e, index: t };
1714
+ const n = t[0], i = t[t.length - 1];
1715
+ if (i - n + 1 === t.length)
1716
+ return { lines: e, index: t };
1717
+ const c = /* @__PURE__ */ new Map();
1718
+ for (let o = 0; o < t.length; o++)
1719
+ c.set(t[o], e[o]);
1263
1720
  const l = [], h = [];
1264
- for (let o = s; o <= i; o++) {
1265
- const a = u.get(o) ?? this.info.lines[o];
1721
+ for (let o = n; o <= i; o++) {
1722
+ const a = c.get(o) ?? this.info.lines[o];
1266
1723
  a && (l.push(a), h.push(o));
1267
1724
  }
1268
1725
  return { lines: l, index: h };
1269
1726
  }
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);
1727
+ handleEmitLinesUpdate(e) {
1728
+ const t = this.handleBridgeActive(this.active.lines, this.active.index);
1729
+ this.event.emit("linesUpdate", t.lines, t.index, this.handleGetActiveIndex(), e);
1273
1730
  }
1274
- handleSyncTime(n) {
1275
- if (!this.info.lines.length || (n === void 0 && (n = this.handleGetEffectiveTime()), !Number.isFinite(n)))
1731
+ handleSyncTime(e) {
1732
+ if (!this.info.lines.length || (e === void 0 && (e = this.handleGetEffectiveTime()), !Number.isFinite(e)))
1276
1733
  return;
1277
- const r = [], s = [];
1734
+ const t = [], n = [];
1278
1735
  let i = this.info.lines.length;
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;
1736
+ for (let c = 0; c < this.info.lines.length; c++) {
1737
+ const l = this.info.lines[c];
1738
+ if (l.time.start > e) {
1739
+ i = c;
1283
1740
  break;
1284
1741
  }
1285
- this.handleGetLineTime(u) > n && (r.push(l), s.push(u));
1742
+ this.merger.getMergedTime(c) > e && (t.push(l), n.push(c));
1286
1743
  }
1287
- this.state.scanIndex = i, this.active.lines = r, this.active.index = s, this.handleEmitLinesUpdate(!0);
1288
- }
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));
1744
+ this.state.scanIndex = i, this.active.lines = t, this.active.index = n, this.handleEmitLinesUpdate(!0);
1745
+ }
1746
+ handleUpdateActiveLines(e) {
1747
+ let t = !1;
1748
+ const n = [], i = [];
1749
+ for (let c = 0; c < this.active.lines.length; c++) {
1750
+ const l = this.active.lines[c], h = this.active.index[c];
1751
+ e >= this.merger.getMergedTime(h) ? t = !0 : (n.push(l), i.push(h));
1295
1752
  }
1296
1753
  for (; this.state.scanIndex < this.info.lines.length; ) {
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++;
1754
+ const c = this.info.lines[this.state.scanIndex];
1755
+ if (e >= c.time.start)
1756
+ e < this.merger.getMergedTime(this.state.scanIndex) && (n.push(c), i.push(this.state.scanIndex), t = !0), this.state.scanIndex++;
1300
1757
  else
1301
1758
  break;
1302
1759
  }
1303
- r && (this.active.lines = s, this.active.index = i, this.handleEmitLinesUpdate(!1));
1760
+ t && (this.active.lines = n, this.active.index = i, this.handleEmitLinesUpdate(!1));
1304
1761
  }
1305
1762
  onTick = () => {
1306
1763
  if (!this.state.playing)
1307
1764
  return;
1308
- const n = this.handleGetEffectiveTime();
1309
- switch (this.handleUpdateActiveLines(n), this.config.current.driver) {
1310
- case "animation":
1311
- this.state.frameId = globalThis.requestAnimationFrame(this.onTick);
1312
- break;
1313
- case "timer":
1314
- this.state.timerId = globalThis.setTimeout(this.onTick, 16);
1315
- break;
1316
- }
1765
+ const e = this.handleGetEffectiveTime();
1766
+ this.handleUpdateActiveLines(e), this.driver.schedule(this.config.current.driver, this.onTick);
1317
1767
  };
1318
- updateLyric(n) {
1319
- if (!n)
1768
+ updateLyric(e) {
1769
+ if (!e)
1320
1770
  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);
1771
+ let t = e;
1772
+ ts.satisfies(e.version, Wt) || (console.warn(`[music-lyric-player] ignored lyric with incompatible version "${e.version}", expected "${Wt}"`), t = new z.Info()), this.pause(), this.info = t, this.handleBuildMergedLineEnd(), this.offset.refreshFromMeta(this.info, this.config.current.offset.useMeta), this.config.current.offset.resetTempOnLyricChange && this.offset.resetTemp(), this.active.lines = [], this.active.index = [], this.state.scanIndex = 0, this.time.seek = 0, this.event.emit("lyricUpdate", t), this.event.emit("linesUpdate", [], [], -1, !1);
1323
1773
  }
1324
1774
  /**
1325
1775
  * Start playback
1776
+ *
1326
1777
  * @param time Optional time in ms to seek to before starting playback. If not provided, playback will start from the current position.
1327
1778
  */
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());
1779
+ play(e) {
1780
+ this.pause(), typeof e == "number" && Number.isFinite(e) && (this.time.seek = e, this.handleSyncTime()), this.time.start = performance.now(), this.state.playing = !0, this.onTick(), this.event.emit("play", this.handleGetCurrentTime());
1330
1781
  }
1331
1782
  /**
1332
1783
  * Pause playback
1333
1784
  */
1334
1785
  pause() {
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);
1786
+ this.state.playing && (this.time.seek = this.handleGetCurrentTime(), this.state.playing = !1, this.event.emit("pause", this.time.seek)), this.driver.cancel();
1336
1787
  }
1337
1788
  /**
1338
1789
  * Stop playback
1339
1790
  */
1340
1791
  dispose() {
1341
- this.pause(), this.event.clear(), this.config.event.remove("update", this.onConfigUpdate), this.active.lines = [], this.active.index = [], this.info = new M.Info();
1792
+ this.pause(), this.event.clear(), this.config.event.remove("update", this.onConfigUpdate), this.active.lines = [], this.active.index = [], this.info = new z.Info();
1342
1793
  }
1343
1794
  /**
1344
1795
  * Update the temp offset in ms (the user's temporary adjustment).
1796
+ *
1345
1797
  * Stacked on top of the global config offset and the lyric's meta offset, then resyncs immediately.
1798
+ *
1346
1799
  * @param value temp offset in ms; non-finite values are treated as 0.
1347
1800
  */
1348
- updateTempOffset(n) {
1349
- this.offset.temp = Number.isFinite(n) ? n : 0, this.handleSyncTime();
1801
+ updateTempOffset(e) {
1802
+ this.offset.setTemp(e), this.handleSyncTime();
1350
1803
  }
1351
1804
  /**
1352
1805
  * Find all active lines at the given time (ms). Does not mutate internal state.
1806
+ *
1353
1807
  * Assumes `info.lines` is sorted by `time.start` ascending.
1808
+ *
1354
1809
  * @param time time in ms to find active lines for.
1355
1810
  */
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)
1811
+ matchLinesWithTime(e) {
1812
+ const t = e + this.currentOffset, n = [], i = [];
1813
+ for (let c = 0; c < this.info.lines.length; c++) {
1814
+ const l = this.info.lines[c];
1815
+ if (l.time.start > t)
1361
1816
  break;
1362
- this.handleGetLineTime(u) > r && (s.push(l), i.push(u));
1817
+ this.merger.getMergedTime(c) > t && (n.push(l), i.push(c));
1363
1818
  }
1364
- return this.handleBridgeActive(s, i);
1819
+ return this.handleBridgeActive(n, i);
1365
1820
  }
1366
1821
  /**
1367
1822
  * Convert a content (lyric) time to the playback clock by removing the active offset.
1823
+ *
1368
1824
  * Seeking playback to the returned time makes a line at `contentTime` become active.
1825
+ *
1369
1826
  * @param contentTime content time in ms (e.g. a line's start).
1370
1827
  */
1371
- convertContentTime(n) {
1372
- return n - this.currentOffset;
1828
+ convertContentTime(e) {
1829
+ return e - this.currentOffset;
1373
1830
  }
1374
1831
  /**
1375
1832
  * Whether the player is currently playing.
@@ -1411,12 +1868,11 @@ class ts {
1411
1868
  * The current effective lyric offset in ms (config offset + lyric meta offset + temp offset).
1412
1869
  */
1413
1870
  get currentOffset() {
1414
- const n = this.config.current.offset.global + this.offset.meta + this.offset.temp;
1415
- return Number.isFinite(n) ? n : 0;
1871
+ return this.offset.resolve(this.config.current.offset.global);
1416
1872
  }
1417
1873
  }
1418
1874
  export {
1419
- ts as BaseLyricPlayer,
1420
- es as BaseLyricPlayerConfig
1875
+ is as BaseLyricPlayer,
1876
+ ns as BaseLyricPlayerConfig
1421
1877
  };
1422
1878
  //# sourceMappingURL=index.ecma.js.map