chordsheetjs 12.1.2 → 12.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/bundle.js CHANGED
@@ -46,6 +46,7 @@ var ChordSheetJS = (() => {
46
46
  $parcel$export(module.exports, "TextFormatter", () => $992b73e4d56a0aef$export$2e2bcd8739ae039);
47
47
  $parcel$export(module.exports, "UltimateGuitarParser", () => $a5a21ced491ea51f$export$2e2bcd8739ae039);
48
48
  $parcel$export(module.exports, "templateHelpers", () => $f9c5006b26957916$export$2e2bcd8739ae039);
49
+ $parcel$export(module.exports, "version", () => $ae92e002ce14f11a$export$2e2bcd8739ae039);
49
50
  $parcel$export(module.exports, "ABC", () => $dce48cb70c4120bb$export$92249c36c213e508);
50
51
  $parcel$export(module.exports, "CHORUS", () => $dce48cb70c4120bb$export$8db6c706fc9142b2);
51
52
  $parcel$export(module.exports, "INDETERMINATE", () => $dce48cb70c4120bb$export$c5a6fe907430212e);
@@ -2724,6 +2725,9 @@ var ChordSheetJS = (() => {
2724
2725
  "": ""
2725
2726
  };
2726
2727
  var $5f19a6aa6bc347f1$export$2e2bcd8739ae039 = $5f19a6aa6bc347f1$var$mapping;
2728
+ function $28a2fcb6fb95a147$export$79570e60478bce41(value, functions) {
2729
+ return functions.reduce((acc, fn) => fn(acc), value);
2730
+ }
2727
2731
  function $28a2fcb6fb95a147$export$d332d76d125f0cbe(line) {
2728
2732
  return line.items.some((item) => item instanceof (0, $551a223fc13b5c10$export$2e2bcd8739ae039) && !!item.chords);
2729
2733
  }
@@ -2803,7 +2807,8 @@ ${error.stack}`);
2803
2807
  const grades = (0, $3d106a0ee348cfa8$export$40141681ebb03523)[type][mode];
2804
2808
  return new $28a2fcb6fb95a147$var$GradeSet(grades).determineGrade(modifier, preferredModifier, grade);
2805
2809
  }
2806
- function $28a2fcb6fb95a147$export$65f5b958d546bb3f({ type, modifier, preferredModifier, grade, minor }) {
2810
+ function $28a2fcb6fb95a147$export$65f5b958d546bb3f(options) {
2811
+ const { type, modifier, preferredModifier, grade, minor } = options;
2807
2812
  let key = $28a2fcb6fb95a147$var$determineKey({
2808
2813
  type,
2809
2814
  modifier,
@@ -2811,13 +2816,7 @@ ${error.stack}`);
2811
2816
  grade,
2812
2817
  minor
2813
2818
  });
2814
- if (!key) throw new Error(`Could not resolve
2815
- type=${type}
2816
- modifier=${modifier}
2817
- grade=${grade}
2818
- preferredModifier=${preferredModifier}
2819
- minor=${minor}
2820
- to a key`);
2819
+ if (!key) throw new Error(`Could not resolve ${options} to a key`);
2821
2820
  if (minor && type === (0, $dce48cb70c4120bb$export$1321df9b16c30c6a)) key = key.toLowerCase();
2822
2821
  return key;
2823
2822
  }
@@ -2896,6 +2895,7 @@ to a key`);
2896
2895
  modifier: modifier || null
2897
2896
  });
2898
2897
  }
2898
+ /* eslint-disable-next-line max-lines-per-function */
2899
2899
  static resolve({ key, keyType, minor, modifier }) {
2900
2900
  const keyString = `${key}`;
2901
2901
  const isMinor = this.isMinor(keyString, keyType, minor);
@@ -5241,10 +5241,26 @@ to a key`);
5241
5241
  return line.items.map((item) => this.formatItem(item, metadata)).join("");
5242
5242
  }
5243
5243
  formatItem(item, metadata) {
5244
- if (item instanceof (0, $7251dad5f4a4c35f$export$2e2bcd8739ae039)) return this.formatTag(item);
5245
- if (item instanceof (0, $551a223fc13b5c10$export$2e2bcd8739ae039)) return this.formatChordLyricsPair(item);
5246
- if (item instanceof (0, $0bd084786477abba$export$2e2bcd8739ae039)) return this.formatComment(item);
5247
- if (item instanceof (0, $4b6dd3e4b817bd81$export$2e2bcd8739ae039)) return "\\ ";
5244
+ const handlers = /* @__PURE__ */ new Map([
5245
+ [
5246
+ (0, $7251dad5f4a4c35f$export$2e2bcd8739ae039),
5247
+ (i) => this.formatTag(i)
5248
+ ],
5249
+ [
5250
+ (0, $551a223fc13b5c10$export$2e2bcd8739ae039),
5251
+ (i) => this.formatChordLyricsPair(i)
5252
+ ],
5253
+ [
5254
+ (0, $0bd084786477abba$export$2e2bcd8739ae039),
5255
+ (i) => this.formatComment(i)
5256
+ ],
5257
+ [
5258
+ (0, $4b6dd3e4b817bd81$export$2e2bcd8739ae039),
5259
+ (_i) => "\\ "
5260
+ ]
5261
+ ]);
5262
+ const handler = handlers.get(item.constructor);
5263
+ if (handler) return handler(item);
5248
5264
  if ("evaluate" in item) return this.formatOrEvaluateItem(item, metadata);
5249
5265
  throw new Error(`Don't know how to format a ${item}`);
5250
5266
  }
@@ -5397,16 +5413,17 @@ to a key`);
5397
5413
  function $51ced2cf8b50f946$var$combinableChordLyricsPairs(itemA, itemB) {
5398
5414
  return $51ced2cf8b50f946$var$isChordLyricsPair(itemA) && $51ced2cf8b50f946$var$isChordLyricsPair(itemB) && itemA.chords.length > 0 && itemB.chords.length === 0;
5399
5415
  }
5416
+ function $51ced2cf8b50f946$var$combineLyrics(pairA, pairB) {
5417
+ return {
5418
+ ...pairA,
5419
+ lyrics: `${pairA.lyrics}${pairB.lyrics}`
5420
+ };
5421
+ }
5400
5422
  function $51ced2cf8b50f946$export$ce8f3be11402ed10(items, chopFirstWord) {
5401
5423
  if (chopFirstWord !== false) return items;
5402
5424
  const combinedItems = [];
5403
5425
  for (let i = 0, { length } = items; i < length; i += 1) if ($51ced2cf8b50f946$var$combinableChordLyricsPairs(items[i], items[i + 1])) {
5404
- const item = items[i];
5405
- const nextItem = items[i + 1];
5406
- combinedItems.push({
5407
- ...item,
5408
- lyrics: `${item.lyrics}${nextItem.lyrics}`
5409
- });
5426
+ combinedItems.push($51ced2cf8b50f946$var$combineLyrics(items[i], items[i + 1]));
5410
5427
  i += 1;
5411
5428
  } else combinedItems.push(items[i]);
5412
5429
  return combinedItems;
@@ -9703,6 +9720,9 @@ to a key`);
9703
9720
  this.metadata[key] = value;
9704
9721
  return;
9705
9722
  }
9723
+ this.appendValue(key, value);
9724
+ }
9725
+ appendValue(key, value) {
9706
9726
  const currentValue = this.metadata[key];
9707
9727
  if (currentValue === value) return;
9708
9728
  if (currentValue instanceof Array) {
@@ -10044,64 +10064,93 @@ to a key`);
10044
10064
  }
10045
10065
  };
10046
10066
  var $69c885ea9d252cfd$export$2e2bcd8739ae039 = $69c885ea9d252cfd$var$SongBuilder;
10067
+ var $e02a17f5a26edf19$var$defaultConstructorOptions = {
10068
+ capo: 0,
10069
+ contextKey: null,
10070
+ decapo: false,
10071
+ normalizeChords: true,
10072
+ renderKey: null,
10073
+ songKey: null,
10074
+ style: null,
10075
+ transposeKey: null,
10076
+ useUnicodeModifier: false
10077
+ };
10078
+ var $e02a17f5a26edf19$var$ChordRenderer = class {
10079
+ constructor(options = {}) {
10080
+ const config = {
10081
+ ...$e02a17f5a26edf19$var$defaultConstructorOptions,
10082
+ ...options
10083
+ };
10084
+ this.capo = config.decapo ? config.capo : 0;
10085
+ this.contextKey = config.contextKey;
10086
+ this.normalizeChords = config.normalizeChords;
10087
+ this.renderKey = config.renderKey;
10088
+ this.songKey = config.songKey;
10089
+ this.style = config.style;
10090
+ this.transposeKey = config.transposeKey;
10091
+ this.useUnicodeModifier = config.useUnicodeModifier;
10092
+ }
10093
+ render(chordString) {
10094
+ const chord = (0, $177a605b8569b31c$export$2e2bcd8739ae039).parse(chordString);
10095
+ if (!chord) return chordString;
10096
+ return (0, $28a2fcb6fb95a147$export$79570e60478bce41)(chord, [
10097
+ (c) => c.transpose(this.effectiveTransposeDistance),
10098
+ (c) => this.modifier ? c.useModifier(this.modifier) : c,
10099
+ (c) => this.normalizeChords ? c.normalize(this.effectiveKey) : c,
10100
+ (c) => this.changeChordType(c)
10101
+ ]).toString({
10102
+ useUnicodeModifier: this.useUnicodeModifier
10103
+ });
10104
+ }
10105
+ changeChordType(chord) {
10106
+ switch (this.style) {
10107
+ case "symbol":
10108
+ return chord.toChordSymbol(this.effectiveKey);
10109
+ case "solfege":
10110
+ return chord.toChordSolfege(this.effectiveKey);
10111
+ case "numeral":
10112
+ return chord.toNumeral(this.effectiveKey);
10113
+ case "number":
10114
+ return chord.toNumeric(this.effectiveKey);
10115
+ default:
10116
+ return chord;
10117
+ }
10118
+ }
10119
+ get modifier() {
10120
+ return this.renderKey?.modifier || this.contextKey?.modifier || null;
10121
+ }
10122
+ get effectiveKey() {
10123
+ if (this.renderKey) return this.renderKey;
10124
+ if (!this.contextKey) return null;
10125
+ return this.contextKey.transpose(this.effectiveTransposeDistance);
10126
+ }
10127
+ get effectiveTransposeDistance() {
10128
+ let transpose = -1 * this.capo;
10129
+ if (this.songKey) {
10130
+ if (this.transposeKey) transpose += (0, $2ce1086ce25c9ac0$export$fd31a53e6281557e)(this.transposeKey, this.songKey);
10131
+ if (this.renderKey) transpose += (0, $c2d6ab25ad00308f$export$2e2bcd8739ae039).distance(this.songKey, this.renderKey);
10132
+ }
10133
+ return transpose;
10134
+ }
10135
+ };
10136
+ var $e02a17f5a26edf19$export$2e2bcd8739ae039 = $e02a17f5a26edf19$var$ChordRenderer;
10047
10137
  function $2ce1086ce25c9ac0$export$fd31a53e6281557e(transposeKey, songKey) {
10048
10138
  if (/^\d+$/.test(transposeKey)) return parseInt(transposeKey, 10);
10049
10139
  return (0, $c2d6ab25ad00308f$export$2e2bcd8739ae039).distance(songKey, transposeKey);
10050
10140
  }
10051
- function $2ce1086ce25c9ac0$var$chordTransposeDistance(capo, transposeKey, songKey, renderKey) {
10052
- let transpose = -1 * (capo || 0);
10053
- if (songKey) {
10054
- if (transposeKey) transpose += $2ce1086ce25c9ac0$export$fd31a53e6281557e(transposeKey, songKey);
10055
- if (renderKey) transpose += (0, $c2d6ab25ad00308f$export$2e2bcd8739ae039).distance(songKey, renderKey);
10056
- }
10057
- return transpose;
10058
- }
10059
- function $2ce1086ce25c9ac0$var$changeChordType(chord, type, referenceKey) {
10060
- switch (type) {
10061
- case "symbol":
10062
- return chord.toChordSymbol(referenceKey);
10063
- case "solfege":
10064
- return chord.toChordSolfege(referenceKey);
10065
- case "numeral":
10066
- return chord.toNumeral(referenceKey);
10067
- case "number":
10068
- return chord.toNumeric(referenceKey);
10069
- default:
10070
- return chord;
10071
- }
10072
- }
10073
- function $2ce1086ce25c9ac0$var$effectiveModifier(renderKey, contextKey) {
10074
- if (renderKey?.modifier) return renderKey.modifier;
10075
- if (contextKey?.modifier) return contextKey.modifier;
10076
- return null;
10077
- }
10078
- function $2ce1086ce25c9ac0$var$shapeChord({ chord, effectiveTransposeDistance, modifier, normalizeChords, effectiveKey, chordStyle }) {
10079
- const transposedChord = chord.transpose(effectiveTransposeDistance);
10080
- const correctedChord = modifier ? transposedChord.useModifier(modifier) : transposedChord;
10081
- const normalizedChord = normalizeChords ? correctedChord.normalize(effectiveKey) : transposedChord;
10082
- return $2ce1086ce25c9ac0$var$changeChordType(normalizedChord, chordStyle, effectiveKey);
10083
- }
10084
10141
  function $2ce1086ce25c9ac0$export$596ec52955da9472(chordString, line, song, { renderKey = null, useUnicodeModifier = false, normalizeChords = true, decapo = false } = {}) {
10085
- const chord = (0, $177a605b8569b31c$export$2e2bcd8739ae039).parse(chordString);
10086
- if (!chord) return chordString;
10087
- const songKey = song.key;
10088
10142
  const capoString = song.metadata.getSingle((0, $d21c5c7a462f3c34$export$866f445d49bad88e));
10089
- const capo = decapo && capoString ? parseInt(capoString, 10) : null;
10090
- const chordStyle = song.metadata.getSingle((0, $d21c5c7a462f3c34$export$d8cbdf44b1f66df1));
10091
- const effectiveTransposeDistance = $2ce1086ce25c9ac0$var$chordTransposeDistance(capo, line.transposeKey, songKey, renderKey);
10092
- const contextKey = (0, $c2d6ab25ad00308f$export$2e2bcd8739ae039).wrap(line.key || song.key);
10093
- const modifier = $2ce1086ce25c9ac0$var$effectiveModifier(renderKey, contextKey);
10094
- const effectiveKey = renderKey || contextKey?.transpose(effectiveTransposeDistance) || null;
10095
- return $2ce1086ce25c9ac0$var$shapeChord({
10096
- chord,
10097
- effectiveTransposeDistance,
10098
- modifier,
10143
+ return new (0, $e02a17f5a26edf19$export$2e2bcd8739ae039)({
10144
+ capo: capoString ? parseInt(capoString, 10) : 0,
10145
+ contextKey: (0, $c2d6ab25ad00308f$export$2e2bcd8739ae039).wrap(line.key || song.key),
10146
+ decapo,
10099
10147
  normalizeChords,
10100
- effectiveKey,
10101
- chordStyle
10102
- }).toString({
10148
+ renderKey,
10149
+ songKey: (0, $c2d6ab25ad00308f$export$2e2bcd8739ae039).wrap(song.key),
10150
+ style: song.metadata.getSingle((0, $d21c5c7a462f3c34$export$d8cbdf44b1f66df1)),
10151
+ transposeKey: line.transposeKey,
10103
10152
  useUnicodeModifier
10104
- });
10153
+ }).render(chordString);
10105
10154
  }
10106
10155
  function $2ce1086ce25c9ac0$export$efb38dd75b8e2957({ selector, isNegated }, { configuration, metadata }) {
10107
10156
  if (selector === configuration.instrument?.type) return !isNegated;
@@ -10143,6 +10192,44 @@ to a key`);
10143
10192
  }
10144
10193
  };
10145
10194
  var $4ff43932a550a629$export$2e2bcd8739ae039 = $4ff43932a550a629$var$ChordDefinitionSet;
10195
+ var $cbaaf2a368d4190f$var$LineExpander = class _$cbaaf2a368d4190f$var$LineExpander {
10196
+ static expand(line, song) {
10197
+ return new _$cbaaf2a368d4190f$var$LineExpander(line, song).expand();
10198
+ }
10199
+ constructor(line, song) {
10200
+ this.line = line;
10201
+ this.song = song;
10202
+ }
10203
+ expand() {
10204
+ const expandedLines = this.line.items.flatMap((item) => {
10205
+ if (item instanceof (0, $7251dad5f4a4c35f$export$2e2bcd8739ae039) && item.name === (0, $dce48cb70c4120bb$export$8db6c706fc9142b2)) return this.getLastChorusBefore(this.line.lineNumber);
10206
+ return [];
10207
+ });
10208
+ return [
10209
+ this.line,
10210
+ ...expandedLines
10211
+ ];
10212
+ }
10213
+ getLastChorusBefore(lineNumber) {
10214
+ const lines = [];
10215
+ if (!lineNumber) return lines;
10216
+ for (let i = lineNumber - 1; i >= 0; i -= 1) {
10217
+ const line = this.song.lines[i];
10218
+ if (line.type !== (0, $dce48cb70c4120bb$export$8db6c706fc9142b2) && lines.length > 0) break;
10219
+ if (line.type === (0, $dce48cb70c4120bb$export$8db6c706fc9142b2) && (line.isEmpty() || this.lineHasMoreThanChorusDirectives(line))) lines.unshift(line);
10220
+ }
10221
+ return lines;
10222
+ }
10223
+ lineHasMoreThanChorusDirectives(line) {
10224
+ return line.items.some((item) => {
10225
+ if (item instanceof (0, $7251dad5f4a4c35f$export$2e2bcd8739ae039)) {
10226
+ if (item.name === (0, $d21c5c7a462f3c34$export$4f5168acae064e01) || item.name === (0, $d21c5c7a462f3c34$export$473c1a4819e5180b)) return false;
10227
+ }
10228
+ return true;
10229
+ });
10230
+ }
10231
+ };
10232
+ var $cbaaf2a368d4190f$export$2e2bcd8739ae039 = $cbaaf2a368d4190f$var$LineExpander;
10146
10233
  var $c53141c05fae8382$var$Song = class _$c53141c05fae8382$var$Song extends (0, $9047ab737bb447ce$export$2e2bcd8739ae039) {
10147
10234
  /**
10148
10235
  * Creates a new {Song} instance
@@ -10182,36 +10269,6 @@ to a key`);
10182
10269
  while (copy.length && !copy[0].hasRenderableItems()) copy.shift();
10183
10270
  return copy;
10184
10271
  }
10185
- expandLine(line) {
10186
- const expandedLines = line.items.flatMap((item) => {
10187
- if (item instanceof (0, $7251dad5f4a4c35f$export$2e2bcd8739ae039) && item.name === (0, $dce48cb70c4120bb$export$8db6c706fc9142b2)) return this.getLastChorusBefore(line.lineNumber);
10188
- return [];
10189
- });
10190
- return [
10191
- line,
10192
- ...expandedLines
10193
- ];
10194
- }
10195
- getLastChorusBefore(lineNumber) {
10196
- const lines = [];
10197
- if (!lineNumber) return lines;
10198
- for (let i = lineNumber - 1; i >= 0; i -= 1) {
10199
- const line = this.lines[i];
10200
- if (line.type === (0, $dce48cb70c4120bb$export$8db6c706fc9142b2)) {
10201
- const filteredLine = this.filterChorusStartEndDirectives(line);
10202
- if (!(line.isNotEmpty() && filteredLine.isEmpty())) lines.unshift(line);
10203
- } else if (lines.length > 0) break;
10204
- }
10205
- return lines;
10206
- }
10207
- filterChorusStartEndDirectives(line) {
10208
- return line.mapItems((item) => {
10209
- if (item instanceof (0, $7251dad5f4a4c35f$export$2e2bcd8739ae039)) {
10210
- if (item.name === (0, $d21c5c7a462f3c34$export$4f5168acae064e01) || item.name === (0, $d21c5c7a462f3c34$export$473c1a4819e5180b)) return null;
10211
- }
10212
- return item;
10213
- });
10214
- }
10215
10272
  /**
10216
10273
  * The {@link Paragraph} items of which the song consists
10217
10274
  * @member {Paragraph[]}
@@ -10224,7 +10281,7 @@ to a key`);
10224
10281
  * @type {Paragraph[]}
10225
10282
  */
10226
10283
  get expandedBodyParagraphs() {
10227
- return this.selectRenderableItems(this.linesToParagraphs(this.lines.flatMap((line) => this.expandLine(line))));
10284
+ return this.selectRenderableItems(this.linesToParagraphs(this.lines.flatMap((line) => (0, $cbaaf2a368d4190f$export$2e2bcd8739ae039).expand(line, this))));
10228
10285
  }
10229
10286
  linesToParagraphs(lines) {
10230
10287
  let currentParagraph = new (0, $8906e348466806fd$export$2e2bcd8739ae039)();
@@ -10309,16 +10366,23 @@ to a key`);
10309
10366
  value: transposedKey.toString()
10310
10367
  });
10311
10368
  }
10312
- if (item instanceof (0, $551a223fc13b5c10$export$2e2bcd8739ae039)) {
10313
- let chord = item.transpose(delta, transposedKey, {
10314
- normalizeChordSuffix
10315
- });
10316
- if (modifier) chord = chord.useModifier(modifier);
10317
- return chord;
10318
- }
10369
+ if (item instanceof (0, $551a223fc13b5c10$export$2e2bcd8739ae039)) return _$c53141c05fae8382$var$Song.transposeChordLyricsPair({
10370
+ item,
10371
+ delta,
10372
+ transposedKey,
10373
+ normalizeChordSuffix,
10374
+ modifier: modifier || null
10375
+ });
10319
10376
  return item;
10320
10377
  });
10321
10378
  }
10379
+ static transposeChordLyricsPair({ item, delta, transposedKey, normalizeChordSuffix, modifier }) {
10380
+ let chord = item.transpose(delta, transposedKey, {
10381
+ normalizeChordSuffix
10382
+ });
10383
+ if (modifier) chord = chord.useModifier(modifier);
10384
+ return chord;
10385
+ }
10322
10386
  /**
10323
10387
  * Transposes the song up by one semitone. It will:
10324
10388
  * - transpose all chords, see: {@link Chord#transpose}
@@ -10359,11 +10423,9 @@ to a key`);
10359
10423
  const currentKey = this.requireCurrentKey();
10360
10424
  const targetKey = (0, $c2d6ab25ad00308f$export$2e2bcd8739ae039).wrapOrFail(newKey);
10361
10425
  const delta = currentKey.distanceTo(targetKey);
10362
- const transposedSong = this.transpose(delta, {
10426
+ return this.transpose(delta, {
10363
10427
  modifier: targetKey.modifier
10364
10428
  });
10365
- if (targetKey.modifier) return transposedSong.useModifier(targetKey.modifier);
10366
- return transposedSong;
10367
10429
  }
10368
10430
  /**
10369
10431
  * Returns a copy of the song with all chords changed to the specified modifier.
@@ -10599,15 +10661,37 @@ Or set the song key before changing key:
10599
10661
  };
10600
10662
  }
10601
10663
  serializeItem(item) {
10602
- if (item instanceof (0, $7251dad5f4a4c35f$export$2e2bcd8739ae039)) return this.serializeTag(item);
10603
- if (item instanceof (0, $551a223fc13b5c10$export$2e2bcd8739ae039)) return this.serializeChordLyricsPair(item);
10604
- if (item instanceof (0, $15f1d40e3d1ed3a0$export$2e2bcd8739ae039)) return this.serializeTernary(item);
10605
- if (item instanceof (0, $11953cb6035032a3$export$2e2bcd8739ae039)) return this.serializeLiteral(item);
10606
- if (item instanceof (0, $0bd084786477abba$export$2e2bcd8739ae039)) return this.serializeComment(item);
10607
- if (item instanceof (0, $4b6dd3e4b817bd81$export$2e2bcd8739ae039)) return {
10608
- type: $8b93ef43471b6ed2$var$SOFT_LINE_BREAK
10609
- };
10610
- throw new Error(`Don't know how to serialize ${item.constructor.name}`);
10664
+ const serializers = /* @__PURE__ */ new Map([
10665
+ [
10666
+ (0, $7251dad5f4a4c35f$export$2e2bcd8739ae039),
10667
+ this.serializeTag.bind(this)
10668
+ ],
10669
+ [
10670
+ (0, $551a223fc13b5c10$export$2e2bcd8739ae039),
10671
+ this.serializeChordLyricsPair.bind(this)
10672
+ ],
10673
+ [
10674
+ (0, $15f1d40e3d1ed3a0$export$2e2bcd8739ae039),
10675
+ this.serializeTernary.bind(this)
10676
+ ],
10677
+ [
10678
+ (0, $11953cb6035032a3$export$2e2bcd8739ae039),
10679
+ this.serializeLiteral.bind(this)
10680
+ ],
10681
+ [
10682
+ (0, $0bd084786477abba$export$2e2bcd8739ae039),
10683
+ this.serializeComment.bind(this)
10684
+ ],
10685
+ [
10686
+ (0, $4b6dd3e4b817bd81$export$2e2bcd8739ae039),
10687
+ () => ({
10688
+ type: $8b93ef43471b6ed2$var$SOFT_LINE_BREAK
10689
+ })
10690
+ ]
10691
+ ]);
10692
+ const serializer = serializers.get(item.constructor);
10693
+ if (!serializer) throw new Error(`Don't know how to serialize ${item.constructor.name}`);
10694
+ return serializer(item);
10611
10695
  }
10612
10696
  serializeChordDefinition(chordDefinition) {
10613
10697
  return {
@@ -23708,23 +23792,32 @@ Or set the song key before changing key:
23708
23792
  }
23709
23793
  parseLine(line) {
23710
23794
  if (this.isSectionEnd()) this.endSection();
23711
- if ($a5a21ced491ea51f$var$VERSE_LINE_REGEX.test(line)) {
23712
- this.startNewLine();
23713
- const label = line.match($a5a21ced491ea51f$var$VERSE_LINE_REGEX)[1];
23714
- this.startSection((0, $dce48cb70c4120bb$export$4b194284baed1659), label);
23715
- } else if ($a5a21ced491ea51f$var$CHORUS_LINE_REGEX.test(line)) {
23716
- this.startNewLine();
23717
- const label = line.match($a5a21ced491ea51f$var$CHORUS_LINE_REGEX)[1];
23718
- this.startSection((0, $dce48cb70c4120bb$export$8db6c706fc9142b2), label);
23719
- } else if ($a5a21ced491ea51f$var$OTHER_METADATA_LINE_REGEX.test(line)) this.parseMetadataLine(line);
23720
- else super.parseLine(line);
23721
- }
23722
- parseMetadataLine(line) {
23795
+ if (!(this.parseVerseDirective(line) || this.parseChorusDirective(line) || this.parseMetadata(line))) super.parseLine(line);
23796
+ }
23797
+ parseVerseDirective(line) {
23798
+ const match = line.match($a5a21ced491ea51f$var$VERSE_LINE_REGEX);
23799
+ if (!match) return false;
23800
+ this.startNewLine();
23801
+ const label = match[1];
23802
+ this.startSection((0, $dce48cb70c4120bb$export$4b194284baed1659), label);
23803
+ return true;
23804
+ }
23805
+ parseChorusDirective(line) {
23806
+ const match = line.match($a5a21ced491ea51f$var$CHORUS_LINE_REGEX);
23807
+ if (!match) return false;
23808
+ this.startNewLine();
23809
+ const label = match[1];
23810
+ this.startSection((0, $dce48cb70c4120bb$export$8db6c706fc9142b2), label);
23811
+ return true;
23812
+ }
23813
+ parseMetadata(line) {
23814
+ const match = line.match($a5a21ced491ea51f$var$OTHER_METADATA_LINE_REGEX);
23815
+ if (!match) return false;
23723
23816
  this.startNewLine();
23724
23817
  this.endSection();
23725
- const comment = line.match($a5a21ced491ea51f$var$OTHER_METADATA_LINE_REGEX)[1];
23726
23818
  if (!this.songLine) throw new Error("Expected this.songLine to be present");
23727
- this.songLine.addTag(new (0, $7251dad5f4a4c35f$export$2e2bcd8739ae039)((0, $d21c5c7a462f3c34$export$a29989082612d0d9), comment));
23819
+ this.songLine.addTag(new (0, $7251dad5f4a4c35f$export$2e2bcd8739ae039)((0, $d21c5c7a462f3c34$export$a29989082612d0d9), match[1]));
23820
+ return true;
23728
23821
  }
23729
23822
  isSectionEnd() {
23730
23823
  return this.songLine !== null && this.songLine.isEmpty() && this.songBuilder.previousLine !== null && !this.songBuilder.previousLine.isEmpty();
@@ -23755,6 +23848,7 @@ Or set the song key before changing key:
23755
23848
  }
23756
23849
  };
23757
23850
  var $a5a21ced491ea51f$export$2e2bcd8739ae039 = $a5a21ced491ea51f$var$UltimateGuitarParser;
23851
+ var $ae92e002ce14f11a$export$2e2bcd8739ae039 = "12.1.3";
23758
23852
  var $892913528e7f60f9$export$2e2bcd8739ae039 = {
23759
23853
  CHORUS: $dce48cb70c4120bb$export$8db6c706fc9142b2,
23760
23854
  Chord: $177a605b8569b31c$export$2e2bcd8739ae039,
@@ -23785,6 +23879,7 @@ Or set the song key before changing key:
23785
23879
  TextFormatter: $992b73e4d56a0aef$export$2e2bcd8739ae039,
23786
23880
  UltimateGuitarParser: $a5a21ced491ea51f$export$2e2bcd8739ae039,
23787
23881
  VERSE: $dce48cb70c4120bb$export$4b194284baed1659,
23882
+ version: "1.2.3",
23788
23883
  templateHelpers: {
23789
23884
  isEvaluatable: $28a2fcb6fb95a147$export$e3f63561d52b936d,
23790
23885
  isChordLyricsPair: $f9c5006b26957916$export$17c9e635b932873b,