musicxml-io 0.5.1 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -127,7 +127,7 @@
127
127
 
128
128
 
129
129
 
130
- var _chunkKABVHR2Pjs = require('./chunk-KABVHR2P.js');
130
+ var _chunkTBGS7OISjs = require('./chunk-TBGS7OIS.js');
131
131
 
132
132
 
133
133
 
@@ -242,8 +242,9 @@ function decodeTree(nodes) {
242
242
  }
243
243
  }
244
244
  }
245
+ var TXML_OPTIONS = { noChildNodes: [] };
245
246
  function parse(xmlString) {
246
- const parsed = _txml.parse.call(void 0, xmlString);
247
+ const parsed = _txml.parse.call(void 0, xmlString, TXML_OPTIONS);
247
248
  decodeTree(parsed);
248
249
  let scorePartwiseVersion;
249
250
  let scorePartwise;
@@ -264,7 +265,8 @@ function parse(xmlString) {
264
265
  return score;
265
266
  }
266
267
  function findElement(elements, tagName) {
267
- for (const el of elements) {
268
+ for (let i = 0; i < elements.length; i++) {
269
+ const el = elements[i];
268
270
  if (typeof el !== "string" && el.tagName === tagName) {
269
271
  return el.children;
270
272
  }
@@ -275,9 +277,12 @@ function getElementContent(elements, tagName) {
275
277
  return findElement(elements, tagName);
276
278
  }
277
279
  function extractText(elements, preserveWhitespace = false) {
278
- for (const item of elements) {
280
+ for (let i = 0; i < elements.length; i++) {
281
+ const item = elements[i];
279
282
  if (typeof item === "string") {
280
- return preserveWhitespace ? item : item.trim();
283
+ if (preserveWhitespace) return item;
284
+ const trimmed = item.trim();
285
+ if (trimmed.length > 0) return trimmed;
281
286
  }
282
287
  }
283
288
  return "";
@@ -296,7 +301,8 @@ function getElementTextAsInt(elements, tagName, defaultValue) {
296
301
  }
297
302
  function collectElements(elements, tagName, parser) {
298
303
  const results = [];
299
- for (const el of elements) {
304
+ for (let i = 0; i < elements.length; i++) {
305
+ const el = elements[i];
300
306
  if (typeof el !== "string" && el.tagName === tagName) {
301
307
  results.push(parser(el.children, el.attributes));
302
308
  }
@@ -304,7 +310,8 @@ function collectElements(elements, tagName, parser) {
304
310
  return results;
305
311
  }
306
312
  function parseFirstElement(elements, tagName, parser) {
307
- for (const el of elements) {
313
+ for (let i = 0; i < elements.length; i++) {
314
+ const el = elements[i];
308
315
  if (typeof el !== "string" && el.tagName === tagName) {
309
316
  return parser(el.children, el.attributes);
310
317
  }
@@ -322,7 +329,7 @@ function parseScorePartwise(elements) {
322
329
  const defaults = parseDefaults(elements);
323
330
  const credits = parseCredits(elements);
324
331
  return {
325
- _id: _chunkKABVHR2Pjs.generateId.call(void 0, ),
332
+ _id: _chunkTBGS7OISjs.generateId.call(void 0, ),
326
333
  metadata,
327
334
  partList,
328
335
  parts,
@@ -579,7 +586,7 @@ function parseSystemLayout(elements) {
579
586
  }
580
587
  function parseCredits(elements) {
581
588
  const credits = collectElements(elements, "credit", (content, attrs) => {
582
- const credit = { _id: _chunkKABVHR2Pjs.generateId.call(void 0, ) };
589
+ const credit = { _id: _chunkTBGS7OISjs.generateId.call(void 0, ) };
583
590
  if (attrs["page"]) credit.page = parseInt(attrs["page"], 10);
584
591
  const types = collectElements(content, "credit-type", (c) => extractText(c));
585
592
  const words = collectElements(content, "credit-words", (c, a) => {
@@ -623,7 +630,7 @@ function parsePartList(elements) {
623
630
  const attrs = el.attributes;
624
631
  const content = el.children;
625
632
  const partInfo = {
626
- _id: _chunkKABVHR2Pjs.generateId.call(void 0, ),
633
+ _id: _chunkTBGS7OISjs.generateId.call(void 0, ),
627
634
  type: "score-part",
628
635
  id: attrs["id"] || ""
629
636
  };
@@ -722,7 +729,7 @@ function parsePartList(elements) {
722
729
  const attrs = el.attributes;
723
730
  const content = el.children;
724
731
  const group = {
725
- _id: _chunkKABVHR2Pjs.generateId.call(void 0, ),
732
+ _id: _chunkTBGS7OISjs.generateId.call(void 0, ),
726
733
  type: "part-group",
727
734
  groupType: attrs["type"] === "stop" ? "stop" : "start"
728
735
  };
@@ -759,7 +766,7 @@ function parseParts(elements) {
759
766
  const attrs = el.attributes;
760
767
  const content = el.children;
761
768
  const part = {
762
- _id: _chunkKABVHR2Pjs.generateId.call(void 0, ),
769
+ _id: _chunkTBGS7OISjs.generateId.call(void 0, ),
763
770
  id: attrs["id"] || "",
764
771
  measures: []
765
772
  };
@@ -778,7 +785,7 @@ function parseParts(elements) {
778
785
  }
779
786
  function parseMeasure(elements, attrs) {
780
787
  const measure = {
781
- _id: _chunkKABVHR2Pjs.generateId.call(void 0, ),
788
+ _id: _chunkTBGS7OISjs.generateId.call(void 0, ),
782
789
  number: attrs["number"] || "0",
783
790
  // Keep as string per MusicXML spec (token type)
784
791
  entries: []
@@ -795,7 +802,7 @@ function parseMeasure(elements, attrs) {
795
802
  measure.attributes = parsedAttrs;
796
803
  } else {
797
804
  const attrEntry = {
798
- _id: _chunkKABVHR2Pjs.generateId.call(void 0, ),
805
+ _id: _chunkTBGS7OISjs.generateId.call(void 0, ),
799
806
  type: "attributes",
800
807
  attributes: parsedAttrs
801
808
  };
@@ -823,7 +830,7 @@ function parseMeasure(elements, attrs) {
823
830
  } else if (el.tagName === "grouping") {
824
831
  const grpAttrs = el.attributes;
825
832
  const grouping = {
826
- _id: _chunkKABVHR2Pjs.generateId.call(void 0, ),
833
+ _id: _chunkTBGS7OISjs.generateId.call(void 0, ),
827
834
  type: "grouping",
828
835
  groupingType: grpAttrs["type"] || "start"
829
836
  };
@@ -877,7 +884,7 @@ function parsePrint(elements, attrs) {
877
884
  return print;
878
885
  }
879
886
  function parseAttributes(elements) {
880
- const attrs = { _id: _chunkKABVHR2Pjs.generateId.call(void 0, ) };
887
+ const attrs = { _id: _chunkTBGS7OISjs.generateId.call(void 0, ) };
881
888
  const divisions = getElementTextAsInt(elements, "divisions");
882
889
  if (divisions !== void 0) attrs.divisions = divisions;
883
890
  const staves = getElementTextAsInt(elements, "staves");
@@ -1043,7 +1050,7 @@ function parseTranspose(elements) {
1043
1050
  }
1044
1051
  function parseNote(elements, attrs) {
1045
1052
  const note = {
1046
- _id: _chunkKABVHR2Pjs.generateId.call(void 0, ),
1053
+ _id: _chunkTBGS7OISjs.generateId.call(void 0, ),
1047
1054
  type: "note",
1048
1055
  duration: 0
1049
1056
  };
@@ -1789,14 +1796,14 @@ function parseLyric(elements, attrs) {
1789
1796
  }
1790
1797
  function parseBackup(elements) {
1791
1798
  return {
1792
- _id: _chunkKABVHR2Pjs.generateId.call(void 0, ),
1799
+ _id: _chunkTBGS7OISjs.generateId.call(void 0, ),
1793
1800
  type: "backup",
1794
1801
  duration: parseInt(getElementText(elements, "duration") || "0", 10)
1795
1802
  };
1796
1803
  }
1797
1804
  function parseForward(elements) {
1798
1805
  const forward = {
1799
- _id: _chunkKABVHR2Pjs.generateId.call(void 0, ),
1806
+ _id: _chunkTBGS7OISjs.generateId.call(void 0, ),
1800
1807
  type: "forward",
1801
1808
  duration: parseInt(getElementText(elements, "duration") || "0", 10)
1802
1809
  };
@@ -1808,7 +1815,7 @@ function parseForward(elements) {
1808
1815
  }
1809
1816
  function parseDirection(elements, attrs) {
1810
1817
  const direction = {
1811
- _id: _chunkKABVHR2Pjs.generateId.call(void 0, ),
1818
+ _id: _chunkTBGS7OISjs.generateId.call(void 0, ),
1812
1819
  type: "direction",
1813
1820
  directionTypes: []
1814
1821
  };
@@ -2233,7 +2240,7 @@ function parseDirectionTypes(elements) {
2233
2240
  }
2234
2241
  function parseBarline(elements, attrs) {
2235
2242
  const location = attrs["location"] || "right";
2236
- const barline = { _id: _chunkKABVHR2Pjs.generateId.call(void 0, ), location };
2243
+ const barline = { _id: _chunkTBGS7OISjs.generateId.call(void 0, ), location };
2237
2244
  const barStyle = getElementText(elements, "bar-style");
2238
2245
  if (barStyle && isValidBarStyle(barStyle)) {
2239
2246
  barline.barStyle = barStyle;
@@ -2465,7 +2472,7 @@ function parseMeasureStyle(elements, attrs) {
2465
2472
  }
2466
2473
  function parseHarmony(elements, attrs) {
2467
2474
  const harmony = {
2468
- _id: _chunkKABVHR2Pjs.generateId.call(void 0, ),
2475
+ _id: _chunkTBGS7OISjs.generateId.call(void 0, ),
2469
2476
  type: "harmony",
2470
2477
  root: { rootStep: "C" },
2471
2478
  kind: "major"
@@ -2605,7 +2612,7 @@ function parseHarmony(elements, attrs) {
2605
2612
  }
2606
2613
  function parseFiguredBass(elements, attrs) {
2607
2614
  const fb = {
2608
- _id: _chunkKABVHR2Pjs.generateId.call(void 0, ),
2615
+ _id: _chunkTBGS7OISjs.generateId.call(void 0, ),
2609
2616
  type: "figured-bass",
2610
2617
  figures: []
2611
2618
  };
@@ -2654,7 +2661,7 @@ function parseFiguredBass(elements, attrs) {
2654
2661
  }
2655
2662
  function parseSound(elements, attrs) {
2656
2663
  const sound = {
2657
- _id: _chunkKABVHR2Pjs.generateId.call(void 0, ),
2664
+ _id: _chunkTBGS7OISjs.generateId.call(void 0, ),
2658
2665
  type: "sound"
2659
2666
  };
2660
2667
  if (attrs["tempo"]) sound.tempo = parseFloat(attrs["tempo"]);
@@ -3686,7 +3693,7 @@ function buildScore(header, voiceTokensList, voiceIds, headerFieldOrder, inlineV
3686
3693
  const headerVoice = _optionalChain([header, 'access', _2 => _2.voices, 'optionalAccess', _3 => _3.find, 'call', _4 => _4((v) => v.id === voiceId)]) || header.voices && header.voices[voiceIndex];
3687
3694
  const voiceName = headerVoice ? headerVoice.name || `Voice ${voiceIndex + 1}` : voiceTokensList.length > 1 ? `Voice ${voiceIndex + 1}` : "Music";
3688
3695
  partListEntries.push({
3689
- _id: _chunkKABVHR2Pjs.generateId.call(void 0, ),
3696
+ _id: _chunkTBGS7OISjs.generateId.call(void 0, ),
3690
3697
  type: "score-part",
3691
3698
  id: partId,
3692
3699
  name: voiceName
@@ -3694,7 +3701,7 @@ function buildScore(header, voiceTokensList, voiceIds, headerFieldOrder, inlineV
3694
3701
  const voiceClef = headerVoice ? abcClefToMusicXml(headerVoice.clef) : void 0;
3695
3702
  const buildResult = buildMeasures(tokens, unitNote, keySignature, timeSignature, measureDuration, voiceClef);
3696
3703
  parts.push({
3697
- _id: _chunkKABVHR2Pjs.generateId.call(void 0, ),
3704
+ _id: _chunkTBGS7OISjs.generateId.call(void 0, ),
3698
3705
  id: partId,
3699
3706
  measures: buildResult.measures
3700
3707
  });
@@ -3747,7 +3754,7 @@ function buildScore(header, voiceTokensList, voiceIds, headerFieldOrder, inlineV
3747
3754
  encoding.encoder = encoderValues;
3748
3755
  }
3749
3756
  return {
3750
- _id: _chunkKABVHR2Pjs.generateId.call(void 0, ),
3757
+ _id: _chunkTBGS7OISjs.generateId.call(void 0, ),
3751
3758
  metadata: {
3752
3759
  movementTitle: header.title,
3753
3760
  creators: creators.length > 0 ? creators : void 0,
@@ -3773,7 +3780,7 @@ function parseTempoToDirection(tempoStr) {
3773
3780
  if (found) beatUnit = found;
3774
3781
  }
3775
3782
  return {
3776
- _id: _chunkKABVHR2Pjs.generateId.call(void 0, ),
3783
+ _id: _chunkTBGS7OISjs.generateId.call(void 0, ),
3777
3784
  type: "direction",
3778
3785
  directionTypes: [{ kind: "metronome", beatUnit, perMinute }],
3779
3786
  placement: "above",
@@ -3829,7 +3836,7 @@ function buildMeasures(tokens, unitNote, keySignature, timeSignature, measureDur
3829
3836
  if (dynDir) currentEntries.push(dynDir);
3830
3837
  } else if (item.kind === "decoration") {
3831
3838
  const decoDir = {
3832
- _id: _chunkKABVHR2Pjs.generateId.call(void 0, ),
3839
+ _id: _chunkTBGS7OISjs.generateId.call(void 0, ),
3833
3840
  type: "direction",
3834
3841
  directionTypes: [{ kind: "words", text: item.value }]
3835
3842
  };
@@ -3840,13 +3847,13 @@ function buildMeasures(tokens, unitNote, keySignature, timeSignature, measureDur
3840
3847
  }
3841
3848
  function finalizeMeasure(endBarType) {
3842
3849
  const measure = {
3843
- _id: _chunkKABVHR2Pjs.generateId.call(void 0, ),
3850
+ _id: _chunkTBGS7OISjs.generateId.call(void 0, ),
3844
3851
  number: String(measureNumber),
3845
3852
  entries: currentEntries
3846
3853
  };
3847
3854
  if (isFirstMeasure) {
3848
3855
  measure.attributes = {
3849
- _id: _chunkKABVHR2Pjs.generateId.call(void 0, ),
3856
+ _id: _chunkTBGS7OISjs.generateId.call(void 0, ),
3850
3857
  divisions: DIVISIONS,
3851
3858
  time: timeSignature,
3852
3859
  key: keySignature,
@@ -3856,7 +3863,7 @@ function buildMeasures(tokens, unitNote, keySignature, timeSignature, measureDur
3856
3863
  }
3857
3864
  if (pendingKeyChange) {
3858
3865
  if (!measure.attributes) {
3859
- measure.attributes = { _id: _chunkKABVHR2Pjs.generateId.call(void 0, ) };
3866
+ measure.attributes = { _id: _chunkTBGS7OISjs.generateId.call(void 0, ) };
3860
3867
  }
3861
3868
  const kValue = pendingKeyChange.replace(/^K:\s*/, "");
3862
3869
  measure.attributes.key = parseKeySignature2(kValue);
@@ -4059,7 +4066,7 @@ function buildMeasures(tokens, unitNote, keySignature, timeSignature, measureDur
4059
4066
  const rightBl = _optionalChain([lastMeasure, 'access', _9 => _9.barlines, 'optionalAccess', _10 => _10.find, 'call', _11 => _11((b) => b.location === "right")]);
4060
4067
  if (rightBl) {
4061
4068
  const endingBarline2 = {
4062
- _id: _chunkKABVHR2Pjs.generateId.call(void 0, ),
4069
+ _id: _chunkTBGS7OISjs.generateId.call(void 0, ),
4063
4070
  location: "left",
4064
4071
  barStyle: rightBl.barStyle,
4065
4072
  repeat: rightBl.repeat,
@@ -4071,7 +4078,7 @@ function buildMeasures(tokens, unitNote, keySignature, timeSignature, measureDur
4071
4078
  }
4072
4079
  }
4073
4080
  const endingBarline = {
4074
- _id: _chunkKABVHR2Pjs.generateId.call(void 0, ),
4081
+ _id: _chunkTBGS7OISjs.generateId.call(void 0, ),
4075
4082
  location: "left",
4076
4083
  ending: {
4077
4084
  number: token.value,
@@ -4174,7 +4181,7 @@ function buildMeasures(tokens, unitNote, keySignature, timeSignature, measureDur
4174
4181
  case "overlay": {
4175
4182
  if (currentPosition > 0) {
4176
4183
  const backupEntry = {
4177
- _id: _chunkKABVHR2Pjs.generateId.call(void 0, ),
4184
+ _id: _chunkTBGS7OISjs.generateId.call(void 0, ),
4178
4185
  type: "backup",
4179
4186
  duration: currentPosition
4180
4187
  };
@@ -4188,7 +4195,7 @@ function buildMeasures(tokens, unitNote, keySignature, timeSignature, measureDur
4188
4195
  if (lMatch) {
4189
4196
  currentUnitNote = { num: parseInt(lMatch[1], 10), den: parseInt(lMatch[2], 10) };
4190
4197
  const inlineEntry = {
4191
- _id: _chunkKABVHR2Pjs.generateId.call(void 0, ),
4198
+ _id: _chunkTBGS7OISjs.generateId.call(void 0, ),
4192
4199
  type: "direction",
4193
4200
  directionTypes: [{ kind: "words", text: `[L:${lMatch[1]}/${lMatch[2]}]` }]
4194
4201
  };
@@ -4207,7 +4214,7 @@ function buildMeasures(tokens, unitNote, keySignature, timeSignature, measureDur
4207
4214
  if (currentEntries.length > 0) {
4208
4215
  const breakText = token.value === "\\\n" ? "__abc_line_cont__" : "__abc_line_break__";
4209
4216
  const lineBreakDir = {
4210
- _id: _chunkKABVHR2Pjs.generateId.call(void 0, ),
4217
+ _id: _chunkTBGS7OISjs.generateId.call(void 0, ),
4211
4218
  type: "direction",
4212
4219
  directionTypes: [{ kind: "words", text: breakText }]
4213
4220
  };
@@ -4311,7 +4318,7 @@ function createNoteEntry(token, unitNote, _hasTieStop, isGrace, tupletState) {
4311
4318
  }
4312
4319
  const { noteType, dots } = durationToNoteType(isGrace ? lengthToDuration(num, den, unitNote) : duration);
4313
4320
  const entry = {
4314
- _id: _chunkKABVHR2Pjs.generateId.call(void 0, ),
4321
+ _id: _chunkTBGS7OISjs.generateId.call(void 0, ),
4315
4322
  type: "note",
4316
4323
  pitch: token.pitch,
4317
4324
  duration,
@@ -4365,7 +4372,7 @@ function createRestEntry(token, unitNote, tupletState, measureDuration) {
4365
4372
  }
4366
4373
  const { noteType, dots } = durationToNoteType(duration);
4367
4374
  const entry = {
4368
- _id: _chunkKABVHR2Pjs.generateId.call(void 0, ),
4375
+ _id: _chunkTBGS7OISjs.generateId.call(void 0, ),
4369
4376
  type: "note",
4370
4377
  rest: isWholeMeasure ? { measure: true } : {},
4371
4378
  duration,
@@ -4380,7 +4387,7 @@ function createRestEntry(token, unitNote, tupletState, measureDuration) {
4380
4387
  }
4381
4388
  function createBarline(barType, location, endingNumber) {
4382
4389
  const barline = {
4383
- _id: _chunkKABVHR2Pjs.generateId.call(void 0, ),
4390
+ _id: _chunkTBGS7OISjs.generateId.call(void 0, ),
4384
4391
  location
4385
4392
  };
4386
4393
  switch (barType) {
@@ -4471,7 +4478,7 @@ function createHarmonyEntry(chordStr) {
4471
4478
  break;
4472
4479
  }
4473
4480
  const entry = {
4474
- _id: _chunkKABVHR2Pjs.generateId.call(void 0, ),
4481
+ _id: _chunkTBGS7OISjs.generateId.call(void 0, ),
4475
4482
  type: "harmony",
4476
4483
  root: { rootStep, rootAlter: rootAlter !== void 0 ? rootAlter : void 0 },
4477
4484
  kind
@@ -4490,7 +4497,7 @@ function createHarmonyEntry(chordStr) {
4490
4497
  function createDynamicsDirection(dynamic) {
4491
4498
  if (!DYNAMICS_VALUES.has(dynamic)) return null;
4492
4499
  return {
4493
- _id: _chunkKABVHR2Pjs.generateId.call(void 0, ),
4500
+ _id: _chunkTBGS7OISjs.generateId.call(void 0, ),
4494
4501
  type: "direction",
4495
4502
  directionTypes: [{
4496
4503
  kind: "dynamics",
@@ -4519,13 +4526,13 @@ function serialize(score, options = {}) {
4519
4526
  const version = options.version || score.version || "4.0";
4520
4527
  const indent = _nullishCoalesce(options.indent, () => ( " "));
4521
4528
  if (options.validate) {
4522
- const result = _chunkKABVHR2Pjs.validate.call(void 0, score, options.validateOptions);
4529
+ const result = _chunkTBGS7OISjs.validate.call(void 0, score, options.validateOptions);
4523
4530
  if (options.onValidation) {
4524
4531
  options.onValidation(result);
4525
4532
  }
4526
4533
  if (!result.valid && options.throwOnValidationError) {
4527
4534
  const errorMessages = result.errors.map((e) => `[${e.code}] ${e.message}`).join("\n");
4528
- throw new (0, _chunkKABVHR2Pjs.ValidationException)(result.errors, `Score validation failed:
4535
+ throw new (0, _chunkTBGS7OISjs.ValidationException)(result.errors, `Score validation failed:
4529
4536
  ${errorMessages}`);
4530
4537
  }
4531
4538
  }
@@ -4533,144 +4540,141 @@ ${errorMessages}`);
4533
4540
  lines.push('<?xml version="1.0" encoding="UTF-8"?>');
4534
4541
  lines.push(`<!DOCTYPE score-partwise PUBLIC "-//Recordare//DTD MusicXML ${version} Partwise//EN" "http://www.musicxml.org/dtds/partwise.dtd">`);
4535
4542
  lines.push(`<score-partwise version="${version}">`);
4536
- lines.push(...serializeMetadata(score.metadata, indent));
4543
+ serializeMetadata(score.metadata, indent, lines);
4537
4544
  if (score.defaults) {
4538
- lines.push(...serializeDefaults(score.defaults, indent));
4545
+ serializeDefaults(score.defaults, indent, lines);
4539
4546
  }
4540
4547
  if (score.credits) {
4541
4548
  for (const credit of score.credits) {
4542
- lines.push(...serializeCredit(credit, indent));
4549
+ serializeCredit(credit, indent, lines);
4543
4550
  }
4544
4551
  }
4545
- lines.push(...serializePartList(score.partList, indent));
4552
+ serializePartList(score.partList, indent, lines);
4546
4553
  for (const part of score.parts) {
4547
- lines.push(...serializePart(part, indent));
4554
+ serializePart(part, indent, lines);
4548
4555
  }
4549
4556
  lines.push("</score-partwise>");
4550
4557
  return lines.join("\n");
4551
4558
  }
4552
- function serializeMetadata(metadata, indent) {
4553
- const lines = [];
4559
+ function serializeMetadata(metadata, indent, out) {
4554
4560
  if (metadata.workTitle !== void 0 || metadata.workNumber !== void 0) {
4555
- lines.push(`${indent}<work>`);
4561
+ out.push(`${indent}<work>`);
4556
4562
  if (metadata.workNumber !== void 0) {
4557
- lines.push(`${indent}${indent}<work-number>${escapeXml(metadata.workNumber)}</work-number>`);
4563
+ out.push(`${indent}${indent}<work-number>${escapeXml(metadata.workNumber)}</work-number>`);
4558
4564
  }
4559
4565
  if (metadata.workTitle !== void 0) {
4560
- lines.push(`${indent}${indent}<work-title>${escapeXml(metadata.workTitle)}</work-title>`);
4566
+ out.push(`${indent}${indent}<work-title>${escapeXml(metadata.workTitle)}</work-title>`);
4561
4567
  }
4562
- lines.push(`${indent}</work>`);
4568
+ out.push(`${indent}</work>`);
4563
4569
  }
4564
4570
  if (metadata.movementNumber !== void 0) {
4565
- lines.push(`${indent}<movement-number>${escapeXml(metadata.movementNumber)}</movement-number>`);
4571
+ out.push(`${indent}<movement-number>${escapeXml(metadata.movementNumber)}</movement-number>`);
4566
4572
  }
4567
4573
  if (metadata.movementTitle !== void 0) {
4568
- lines.push(`${indent}<movement-title>${escapeXml(metadata.movementTitle)}</movement-title>`);
4574
+ out.push(`${indent}<movement-title>${escapeXml(metadata.movementTitle)}</movement-title>`);
4569
4575
  }
4570
4576
  if (metadata.creators || metadata.rights || metadata.encoding || metadata.source || metadata.miscellaneous) {
4571
- lines.push(`${indent}<identification>`);
4577
+ out.push(`${indent}<identification>`);
4572
4578
  if (metadata.creators) {
4573
4579
  for (const creator of metadata.creators) {
4574
4580
  const typeAttr = creator.type ? ` type="${escapeXml(creator.type)}"` : "";
4575
- lines.push(`${indent}${indent}<creator${typeAttr}>${escapeXml(creator.value)}</creator>`);
4581
+ out.push(`${indent}${indent}<creator${typeAttr}>${escapeXml(creator.value)}</creator>`);
4576
4582
  }
4577
4583
  }
4578
4584
  if (metadata.rights) {
4579
4585
  for (const right of metadata.rights) {
4580
- lines.push(`${indent}${indent}<rights>${escapeXml(right)}</rights>`);
4586
+ out.push(`${indent}${indent}<rights>${escapeXml(right)}</rights>`);
4581
4587
  }
4582
4588
  }
4583
4589
  if (metadata.encoding) {
4584
- lines.push(`${indent}${indent}<encoding>`);
4590
+ out.push(`${indent}${indent}<encoding>`);
4585
4591
  if (metadata.encoding.software) {
4586
4592
  for (const sw of metadata.encoding.software) {
4587
- lines.push(`${indent}${indent}${indent}<software>${escapeXml(sw)}</software>`);
4593
+ out.push(`${indent}${indent}${indent}<software>${escapeXml(sw)}</software>`);
4588
4594
  }
4589
4595
  }
4590
4596
  if (metadata.encoding.encodingDate) {
4591
- lines.push(`${indent}${indent}${indent}<encoding-date>${escapeXml(metadata.encoding.encodingDate)}</encoding-date>`);
4597
+ out.push(`${indent}${indent}${indent}<encoding-date>${escapeXml(metadata.encoding.encodingDate)}</encoding-date>`);
4592
4598
  }
4593
4599
  if (metadata.encoding.encoder) {
4594
4600
  for (const enc of metadata.encoding.encoder) {
4595
- lines.push(`${indent}${indent}${indent}<encoder>${escapeXml(enc)}</encoder>`);
4601
+ out.push(`${indent}${indent}${indent}<encoder>${escapeXml(enc)}</encoder>`);
4596
4602
  }
4597
4603
  }
4598
4604
  if (metadata.encoding.encodingDescription) {
4599
- lines.push(`${indent}${indent}${indent}<encoding-description>${escapeXml(metadata.encoding.encodingDescription)}</encoding-description>`);
4605
+ out.push(`${indent}${indent}${indent}<encoding-description>${escapeXml(metadata.encoding.encodingDescription)}</encoding-description>`);
4600
4606
  }
4601
4607
  if (metadata.encoding.supports) {
4602
4608
  for (const support of metadata.encoding.supports) {
4603
4609
  let attrs = ` element="${escapeXml(support.element)}" type="${support.type}"`;
4604
4610
  if (support.attribute) attrs += ` attribute="${escapeXml(support.attribute)}"`;
4605
4611
  if (support.value) attrs += ` value="${escapeXml(support.value)}"`;
4606
- lines.push(`${indent}${indent}${indent}<supports${attrs}/>`);
4612
+ out.push(`${indent}${indent}${indent}<supports${attrs}/>`);
4607
4613
  }
4608
4614
  }
4609
- lines.push(`${indent}${indent}</encoding>`);
4615
+ out.push(`${indent}${indent}</encoding>`);
4610
4616
  }
4611
4617
  if (metadata.source) {
4612
- lines.push(`${indent}${indent}<source>${escapeXml(metadata.source)}</source>`);
4618
+ out.push(`${indent}${indent}<source>${escapeXml(metadata.source)}</source>`);
4613
4619
  }
4614
4620
  if (metadata.miscellaneous) {
4615
- lines.push(`${indent}${indent}<miscellaneous>`);
4621
+ out.push(`${indent}${indent}<miscellaneous>`);
4616
4622
  for (const field of metadata.miscellaneous) {
4617
- lines.push(`${indent}${indent}${indent}<miscellaneous-field name="${escapeXml(field.name)}">${escapeXml(field.value)}</miscellaneous-field>`);
4623
+ out.push(`${indent}${indent}${indent}<miscellaneous-field name="${escapeXml(field.name)}">${escapeXml(field.value)}</miscellaneous-field>`);
4618
4624
  }
4619
- lines.push(`${indent}${indent}</miscellaneous>`);
4625
+ out.push(`${indent}${indent}</miscellaneous>`);
4620
4626
  }
4621
- lines.push(`${indent}</identification>`);
4627
+ out.push(`${indent}</identification>`);
4622
4628
  }
4623
- return lines;
4624
4629
  }
4625
- function serializeDefaults(defaults, indent) {
4626
- const lines = [];
4627
- lines.push(`${indent}<defaults>`);
4630
+ function serializeDefaults(defaults, indent, out) {
4631
+ out.push(`${indent}<defaults>`);
4628
4632
  if (defaults.scaling) {
4629
- lines.push(`${indent}${indent}<scaling>`);
4630
- lines.push(`${indent}${indent}${indent}<millimeters>${defaults.scaling.millimeters}</millimeters>`);
4631
- lines.push(`${indent}${indent}${indent}<tenths>${defaults.scaling.tenths}</tenths>`);
4632
- lines.push(`${indent}${indent}</scaling>`);
4633
+ out.push(`${indent}${indent}<scaling>`);
4634
+ out.push(`${indent}${indent}${indent}<millimeters>${defaults.scaling.millimeters}</millimeters>`);
4635
+ out.push(`${indent}${indent}${indent}<tenths>${defaults.scaling.tenths}</tenths>`);
4636
+ out.push(`${indent}${indent}</scaling>`);
4633
4637
  }
4634
4638
  if (defaults.pageLayout) {
4635
- lines.push(...serializePageLayout(defaults.pageLayout, indent + indent));
4639
+ serializePageLayout(defaults.pageLayout, indent + indent, out);
4636
4640
  }
4637
4641
  if (defaults.systemLayout) {
4638
- lines.push(...serializeSystemLayout(defaults.systemLayout, indent + indent));
4642
+ serializeSystemLayout(defaults.systemLayout, indent + indent, out);
4639
4643
  }
4640
4644
  if (defaults.staffLayout) {
4641
4645
  for (const sl of defaults.staffLayout) {
4642
4646
  const numAttr = sl.number !== void 0 ? ` number="${sl.number}"` : "";
4643
- lines.push(`${indent}${indent}<staff-layout${numAttr}>`);
4647
+ out.push(`${indent}${indent}<staff-layout${numAttr}>`);
4644
4648
  if (sl.staffDistance !== void 0) {
4645
- lines.push(`${indent}${indent}${indent}<staff-distance>${sl.staffDistance}</staff-distance>`);
4649
+ out.push(`${indent}${indent}${indent}<staff-distance>${sl.staffDistance}</staff-distance>`);
4646
4650
  }
4647
- lines.push(`${indent}${indent}</staff-layout>`);
4651
+ out.push(`${indent}${indent}</staff-layout>`);
4648
4652
  }
4649
4653
  }
4650
4654
  if (defaults.appearance) {
4651
- lines.push(`${indent}${indent}<appearance>`);
4655
+ out.push(`${indent}${indent}<appearance>`);
4652
4656
  const app = defaults.appearance;
4653
4657
  if (app["line-widths"]) {
4654
4658
  for (const lw of app["line-widths"]) {
4655
- lines.push(`${indent}${indent}${indent}<line-width type="${escapeXml(lw.type)}">${lw.value}</line-width>`);
4659
+ out.push(`${indent}${indent}${indent}<line-width type="${escapeXml(lw.type)}">${lw.value}</line-width>`);
4656
4660
  }
4657
4661
  }
4658
4662
  if (app["note-sizes"]) {
4659
4663
  for (const ns of app["note-sizes"]) {
4660
- lines.push(`${indent}${indent}${indent}<note-size type="${escapeXml(ns.type)}">${ns.value}</note-size>`);
4664
+ out.push(`${indent}${indent}${indent}<note-size type="${escapeXml(ns.type)}">${ns.value}</note-size>`);
4661
4665
  }
4662
4666
  }
4663
4667
  if (app["distances"]) {
4664
4668
  for (const d of app["distances"]) {
4665
- lines.push(`${indent}${indent}${indent}<distance type="${escapeXml(d.type)}">${d.value}</distance>`);
4669
+ out.push(`${indent}${indent}${indent}<distance type="${escapeXml(d.type)}">${d.value}</distance>`);
4666
4670
  }
4667
4671
  }
4668
4672
  if (app["glyphs"]) {
4669
4673
  for (const g of app["glyphs"]) {
4670
- lines.push(`${indent}${indent}${indent}<glyph type="${escapeXml(g.type)}">${escapeXml(g.value)}</glyph>`);
4674
+ out.push(`${indent}${indent}${indent}<glyph type="${escapeXml(g.type)}">${escapeXml(g.value)}</glyph>`);
4671
4675
  }
4672
4676
  }
4673
- lines.push(`${indent}${indent}</appearance>`);
4677
+ out.push(`${indent}${indent}</appearance>`);
4674
4678
  }
4675
4679
  if (defaults.musicFont) {
4676
4680
  let attrs = "";
@@ -4678,7 +4682,7 @@ function serializeDefaults(defaults, indent) {
4678
4682
  if (defaults.musicFont.fontSize) attrs += ` font-size="${escapeXml(defaults.musicFont.fontSize)}"`;
4679
4683
  if (defaults.musicFont.fontStyle) attrs += ` font-style="${escapeXml(defaults.musicFont.fontStyle)}"`;
4680
4684
  if (defaults.musicFont.fontWeight) attrs += ` font-weight="${escapeXml(defaults.musicFont.fontWeight)}"`;
4681
- lines.push(`${indent}${indent}<music-font${attrs}/>`);
4685
+ out.push(`${indent}${indent}<music-font${attrs}/>`);
4682
4686
  }
4683
4687
  if (defaults.wordFont) {
4684
4688
  let attrs = "";
@@ -4686,7 +4690,7 @@ function serializeDefaults(defaults, indent) {
4686
4690
  if (defaults.wordFont.fontSize) attrs += ` font-size="${escapeXml(defaults.wordFont.fontSize)}"`;
4687
4691
  if (defaults.wordFont.fontStyle) attrs += ` font-style="${escapeXml(defaults.wordFont.fontStyle)}"`;
4688
4692
  if (defaults.wordFont.fontWeight) attrs += ` font-weight="${escapeXml(defaults.wordFont.fontWeight)}"`;
4689
- lines.push(`${indent}${indent}<word-font${attrs}/>`);
4693
+ out.push(`${indent}${indent}<word-font${attrs}/>`);
4690
4694
  }
4691
4695
  if (defaults.lyricFont) {
4692
4696
  for (const lf of defaults.lyricFont) {
@@ -4697,7 +4701,7 @@ function serializeDefaults(defaults, indent) {
4697
4701
  if (lf.fontSize) attrs += ` font-size="${escapeXml(lf.fontSize)}"`;
4698
4702
  if (lf.fontStyle) attrs += ` font-style="${escapeXml(lf.fontStyle)}"`;
4699
4703
  if (lf.fontWeight) attrs += ` font-weight="${escapeXml(lf.fontWeight)}"`;
4700
- lines.push(`${indent}${indent}<lyric-font${attrs}/>`);
4704
+ out.push(`${indent}${indent}<lyric-font${attrs}/>`);
4701
4705
  }
4702
4706
  }
4703
4707
  if (defaults.lyricLanguage) {
@@ -4706,64 +4710,60 @@ function serializeDefaults(defaults, indent) {
4706
4710
  if (ll.number !== void 0) attrs += ` number="${ll.number}"`;
4707
4711
  if (ll.name) attrs += ` name="${escapeXml(ll.name)}"`;
4708
4712
  attrs += ` xml:lang="${escapeXml(ll.xmlLang)}"`;
4709
- lines.push(`${indent}${indent}<lyric-language${attrs}/>`);
4713
+ out.push(`${indent}${indent}<lyric-language${attrs}/>`);
4710
4714
  }
4711
4715
  }
4712
- lines.push(`${indent}</defaults>`);
4713
- return lines;
4716
+ out.push(`${indent}</defaults>`);
4714
4717
  }
4715
- function serializePageLayout(layout, indent) {
4716
- const lines = [];
4717
- lines.push(`${indent}<page-layout>`);
4718
+ function serializePageLayout(layout, indent, out) {
4719
+ out.push(`${indent}<page-layout>`);
4718
4720
  if (layout.pageHeight !== void 0) {
4719
- lines.push(`${indent} <page-height>${layout.pageHeight}</page-height>`);
4721
+ out.push(`${indent} <page-height>${layout.pageHeight}</page-height>`);
4720
4722
  }
4721
4723
  if (layout.pageWidth !== void 0) {
4722
- lines.push(`${indent} <page-width>${layout.pageWidth}</page-width>`);
4724
+ out.push(`${indent} <page-width>${layout.pageWidth}</page-width>`);
4723
4725
  }
4724
4726
  if (layout.pageMargins) {
4725
4727
  for (const m of layout.pageMargins) {
4726
4728
  const typeAttr = m.type ? ` type="${m.type}"` : "";
4727
- lines.push(`${indent} <page-margins${typeAttr}>`);
4729
+ out.push(`${indent} <page-margins${typeAttr}>`);
4728
4730
  if (m.leftMargin !== void 0) {
4729
- lines.push(`${indent} <left-margin>${_nullishCoalesce(m.leftMarginRaw, () => ( m.leftMargin))}</left-margin>`);
4731
+ out.push(`${indent} <left-margin>${_nullishCoalesce(m.leftMarginRaw, () => ( m.leftMargin))}</left-margin>`);
4730
4732
  }
4731
4733
  if (m.rightMargin !== void 0) {
4732
- lines.push(`${indent} <right-margin>${_nullishCoalesce(m.rightMarginRaw, () => ( m.rightMargin))}</right-margin>`);
4734
+ out.push(`${indent} <right-margin>${_nullishCoalesce(m.rightMarginRaw, () => ( m.rightMargin))}</right-margin>`);
4733
4735
  }
4734
4736
  if (m.topMargin !== void 0) {
4735
- lines.push(`${indent} <top-margin>${_nullishCoalesce(m.topMarginRaw, () => ( m.topMargin))}</top-margin>`);
4737
+ out.push(`${indent} <top-margin>${_nullishCoalesce(m.topMarginRaw, () => ( m.topMargin))}</top-margin>`);
4736
4738
  }
4737
4739
  if (m.bottomMargin !== void 0) {
4738
- lines.push(`${indent} <bottom-margin>${_nullishCoalesce(m.bottomMarginRaw, () => ( m.bottomMargin))}</bottom-margin>`);
4740
+ out.push(`${indent} <bottom-margin>${_nullishCoalesce(m.bottomMarginRaw, () => ( m.bottomMargin))}</bottom-margin>`);
4739
4741
  }
4740
- lines.push(`${indent} </page-margins>`);
4742
+ out.push(`${indent} </page-margins>`);
4741
4743
  }
4742
4744
  }
4743
- lines.push(`${indent}</page-layout>`);
4744
- return lines;
4745
+ out.push(`${indent}</page-layout>`);
4745
4746
  }
4746
- function serializeSystemLayout(layout, indent) {
4747
- const lines = [];
4748
- lines.push(`${indent}<system-layout>`);
4747
+ function serializeSystemLayout(layout, indent, out) {
4748
+ out.push(`${indent}<system-layout>`);
4749
4749
  if (layout.systemMargins) {
4750
- lines.push(`${indent} <system-margins>`);
4750
+ out.push(`${indent} <system-margins>`);
4751
4751
  if (layout.systemMargins.leftMargin !== void 0) {
4752
- lines.push(`${indent} <left-margin>${_nullishCoalesce(layout.systemMargins.leftMarginRaw, () => ( layout.systemMargins.leftMargin))}</left-margin>`);
4752
+ out.push(`${indent} <left-margin>${_nullishCoalesce(layout.systemMargins.leftMarginRaw, () => ( layout.systemMargins.leftMargin))}</left-margin>`);
4753
4753
  }
4754
4754
  if (layout.systemMargins.rightMargin !== void 0) {
4755
- lines.push(`${indent} <right-margin>${_nullishCoalesce(layout.systemMargins.rightMarginRaw, () => ( layout.systemMargins.rightMargin))}</right-margin>`);
4755
+ out.push(`${indent} <right-margin>${_nullishCoalesce(layout.systemMargins.rightMarginRaw, () => ( layout.systemMargins.rightMargin))}</right-margin>`);
4756
4756
  }
4757
- lines.push(`${indent} </system-margins>`);
4757
+ out.push(`${indent} </system-margins>`);
4758
4758
  }
4759
4759
  if (layout.systemDistance !== void 0) {
4760
- lines.push(`${indent} <system-distance>${_nullishCoalesce(layout.systemDistanceRaw, () => ( layout.systemDistance))}</system-distance>`);
4760
+ out.push(`${indent} <system-distance>${_nullishCoalesce(layout.systemDistanceRaw, () => ( layout.systemDistance))}</system-distance>`);
4761
4761
  }
4762
4762
  if (layout.topSystemDistance !== void 0) {
4763
- lines.push(`${indent} <top-system-distance>${_nullishCoalesce(layout.topSystemDistanceRaw, () => ( layout.topSystemDistance))}</top-system-distance>`);
4763
+ out.push(`${indent} <top-system-distance>${_nullishCoalesce(layout.topSystemDistanceRaw, () => ( layout.topSystemDistance))}</top-system-distance>`);
4764
4764
  }
4765
4765
  if (layout.systemDividers) {
4766
- lines.push(`${indent} <system-dividers>`);
4766
+ out.push(`${indent} <system-dividers>`);
4767
4767
  if (layout.systemDividers.leftDivider) {
4768
4768
  let attrs = "";
4769
4769
  if (layout.systemDividers.leftDivider.printObject !== void 0) {
@@ -4775,7 +4775,7 @@ function serializeSystemLayout(layout, indent) {
4775
4775
  if (layout.systemDividers.leftDivider.valign) {
4776
4776
  attrs += ` valign="${layout.systemDividers.leftDivider.valign}"`;
4777
4777
  }
4778
- lines.push(`${indent} <left-divider${attrs}/>`);
4778
+ out.push(`${indent} <left-divider${attrs}/>`);
4779
4779
  }
4780
4780
  if (layout.systemDividers.rightDivider) {
4781
4781
  let attrs = "";
@@ -4788,22 +4788,20 @@ function serializeSystemLayout(layout, indent) {
4788
4788
  if (layout.systemDividers.rightDivider.valign) {
4789
4789
  attrs += ` valign="${layout.systemDividers.rightDivider.valign}"`;
4790
4790
  }
4791
- lines.push(`${indent} <right-divider${attrs}/>`);
4791
+ out.push(`${indent} <right-divider${attrs}/>`);
4792
4792
  }
4793
- lines.push(`${indent} </system-dividers>`);
4793
+ out.push(`${indent} </system-dividers>`);
4794
4794
  }
4795
- lines.push(`${indent}</system-layout>`);
4796
- return lines;
4795
+ out.push(`${indent}</system-layout>`);
4797
4796
  }
4798
- function serializeCredit(credit, indent) {
4799
- const lines = [];
4797
+ function serializeCredit(credit, indent, out) {
4800
4798
  let attrs = "";
4801
4799
  if (credit._id) attrs += ` id="${escapeXml(credit._id)}"`;
4802
4800
  if (credit.page !== void 0) attrs += ` page="${credit.page}"`;
4803
- lines.push(`${indent}<credit${attrs}>`);
4801
+ out.push(`${indent}<credit${attrs}>`);
4804
4802
  if (credit.creditType) {
4805
4803
  for (const ct of credit.creditType) {
4806
- lines.push(`${indent}${indent}<credit-type>${escapeXml(ct)}</credit-type>`);
4804
+ out.push(`${indent}${indent}<credit-type>${escapeXml(ct)}</credit-type>`);
4807
4805
  }
4808
4806
  }
4809
4807
  if (credit.creditWords) {
@@ -4821,27 +4819,23 @@ function serializeCredit(credit, indent) {
4821
4819
  if (cw.letterSpacing) attrs2 += ` letter-spacing="${escapeXml(cw.letterSpacing)}"`;
4822
4820
  if (cw.xmlLang) attrs2 += ` xml:lang="${escapeXml(cw.xmlLang)}"`;
4823
4821
  if (cw.xmlSpace) attrs2 += ` xml:space="${escapeXml(cw.xmlSpace)}"`;
4824
- lines.push(`${indent}${indent}<credit-words${attrs2}>${escapeXml(cw.text)}</credit-words>`);
4822
+ out.push(`${indent}${indent}<credit-words${attrs2}>${escapeXml(cw.text)}</credit-words>`);
4825
4823
  }
4826
4824
  }
4827
- lines.push(`${indent}</credit>`);
4828
- return lines;
4825
+ out.push(`${indent}</credit>`);
4829
4826
  }
4830
- function serializePartList(partList, indent) {
4831
- const lines = [];
4832
- lines.push(`${indent}<part-list>`);
4827
+ function serializePartList(partList, indent, out) {
4828
+ out.push(`${indent}<part-list>`);
4833
4829
  for (const entry of partList) {
4834
4830
  if (entry.type === "score-part") {
4835
- lines.push(...serializeScorePart(entry, indent + indent));
4831
+ serializeScorePart(entry, indent + indent, out);
4836
4832
  } else if (entry.type === "part-group") {
4837
- lines.push(...serializePartGroup(entry, indent + indent));
4833
+ serializePartGroup(entry, indent + indent, out);
4838
4834
  }
4839
4835
  }
4840
- lines.push(`${indent}</part-list>`);
4841
- return lines;
4836
+ out.push(`${indent}</part-list>`);
4842
4837
  }
4843
- function serializeDisplayTexts(texts, indent) {
4844
- const lines = [];
4838
+ function serializeDisplayTexts(texts, indent, out) {
4845
4839
  for (const dt of texts) {
4846
4840
  let attrs = "";
4847
4841
  if (dt.fontFamily) attrs += ` font-family="${escapeXml(dt.fontFamily)}"`;
@@ -4849,383 +4843,370 @@ function serializeDisplayTexts(texts, indent) {
4849
4843
  if (dt.fontStyle) attrs += ` font-style="${escapeXml(dt.fontStyle)}"`;
4850
4844
  if (dt.fontWeight) attrs += ` font-weight="${escapeXml(dt.fontWeight)}"`;
4851
4845
  if (dt.xmlSpace) attrs += ` xml:space="${escapeXml(dt.xmlSpace)}"`;
4852
- lines.push(`${indent}<display-text${attrs}>${escapeXml(dt.text)}</display-text>`);
4846
+ out.push(`${indent}<display-text${attrs}>${escapeXml(dt.text)}</display-text>`);
4853
4847
  }
4854
- return lines;
4855
4848
  }
4856
- function serializeScorePart(part, indent) {
4857
- const lines = [];
4858
- lines.push(`${indent}<score-part id="${escapeXml(part.id)}">`);
4849
+ function serializeScorePart(part, indent, out) {
4850
+ out.push(`${indent}<score-part id="${escapeXml(part.id)}">`);
4859
4851
  if (part.name !== void 0) {
4860
4852
  let pnAttrs = "";
4861
4853
  if (part.namePrintObject === false) pnAttrs += ' print-object="no"';
4862
- lines.push(`${indent} <part-name${pnAttrs}>${escapeXml(part.name)}</part-name>`);
4854
+ out.push(`${indent} <part-name${pnAttrs}>${escapeXml(part.name)}</part-name>`);
4863
4855
  }
4864
4856
  if (part.partNameDisplay && part.partNameDisplay.length > 0) {
4865
- lines.push(`${indent} <part-name-display>`);
4866
- lines.push(...serializeDisplayTexts(part.partNameDisplay, indent + " "));
4867
- lines.push(`${indent} </part-name-display>`);
4857
+ out.push(`${indent} <part-name-display>`);
4858
+ serializeDisplayTexts(part.partNameDisplay, indent + " ", out);
4859
+ out.push(`${indent} </part-name-display>`);
4868
4860
  }
4869
4861
  if (part.abbreviation !== void 0) {
4870
4862
  let paAttrs = "";
4871
4863
  if (part.abbreviationPrintObject === false) paAttrs += ' print-object="no"';
4872
- lines.push(`${indent} <part-abbreviation${paAttrs}>${escapeXml(part.abbreviation)}</part-abbreviation>`);
4864
+ out.push(`${indent} <part-abbreviation${paAttrs}>${escapeXml(part.abbreviation)}</part-abbreviation>`);
4873
4865
  }
4874
4866
  if (part.partAbbreviationDisplay && part.partAbbreviationDisplay.length > 0) {
4875
- lines.push(`${indent} <part-abbreviation-display>`);
4876
- lines.push(...serializeDisplayTexts(part.partAbbreviationDisplay, indent + " "));
4877
- lines.push(`${indent} </part-abbreviation-display>`);
4867
+ out.push(`${indent} <part-abbreviation-display>`);
4868
+ serializeDisplayTexts(part.partAbbreviationDisplay, indent + " ", out);
4869
+ out.push(`${indent} </part-abbreviation-display>`);
4878
4870
  }
4879
4871
  if (part.scoreInstruments) {
4880
4872
  for (const inst of part.scoreInstruments) {
4881
- lines.push(`${indent} <score-instrument id="${escapeXml(inst.id)}">`);
4882
- lines.push(`${indent} <instrument-name>${escapeXml(inst.name)}</instrument-name>`);
4873
+ out.push(`${indent} <score-instrument id="${escapeXml(inst.id)}">`);
4874
+ out.push(`${indent} <instrument-name>${escapeXml(inst.name)}</instrument-name>`);
4883
4875
  if (inst.abbreviation) {
4884
- lines.push(`${indent} <instrument-abbreviation>${escapeXml(inst.abbreviation)}</instrument-abbreviation>`);
4876
+ out.push(`${indent} <instrument-abbreviation>${escapeXml(inst.abbreviation)}</instrument-abbreviation>`);
4885
4877
  }
4886
4878
  if (inst.sound) {
4887
- lines.push(`${indent} <instrument-sound>${escapeXml(inst.sound)}</instrument-sound>`);
4879
+ out.push(`${indent} <instrument-sound>${escapeXml(inst.sound)}</instrument-sound>`);
4888
4880
  }
4889
4881
  if (inst.solo) {
4890
- lines.push(`${indent} <solo/>`);
4882
+ out.push(`${indent} <solo/>`);
4891
4883
  }
4892
4884
  if (inst.ensemble !== void 0) {
4893
4885
  if (inst.ensemble === 0) {
4894
- lines.push(`${indent} <ensemble/>`);
4886
+ out.push(`${indent} <ensemble/>`);
4895
4887
  } else {
4896
- lines.push(`${indent} <ensemble>${inst.ensemble}</ensemble>`);
4888
+ out.push(`${indent} <ensemble>${inst.ensemble}</ensemble>`);
4897
4889
  }
4898
4890
  }
4899
- lines.push(`${indent} </score-instrument>`);
4891
+ out.push(`${indent} </score-instrument>`);
4900
4892
  }
4901
4893
  }
4902
4894
  if (part.groups) {
4903
4895
  for (const group of part.groups) {
4904
- lines.push(`${indent} <group>${escapeXml(group)}</group>`);
4896
+ out.push(`${indent} <group>${escapeXml(group)}</group>`);
4905
4897
  }
4906
4898
  }
4907
4899
  if (part.midiInstruments) {
4908
4900
  for (const midi of part.midiInstruments) {
4909
- lines.push(`${indent} <midi-instrument id="${escapeXml(midi.id)}">`);
4901
+ out.push(`${indent} <midi-instrument id="${escapeXml(midi.id)}">`);
4910
4902
  if (midi.channel !== void 0) {
4911
- lines.push(`${indent} <midi-channel>${midi.channel}</midi-channel>`);
4903
+ out.push(`${indent} <midi-channel>${midi.channel}</midi-channel>`);
4912
4904
  }
4913
4905
  if (midi.name) {
4914
- lines.push(`${indent} <midi-name>${escapeXml(midi.name)}</midi-name>`);
4906
+ out.push(`${indent} <midi-name>${escapeXml(midi.name)}</midi-name>`);
4915
4907
  }
4916
4908
  if (midi.bank !== void 0) {
4917
- lines.push(`${indent} <midi-bank>${midi.bank}</midi-bank>`);
4909
+ out.push(`${indent} <midi-bank>${midi.bank}</midi-bank>`);
4918
4910
  }
4919
4911
  if (midi.program !== void 0) {
4920
- lines.push(`${indent} <midi-program>${midi.program}</midi-program>`);
4912
+ out.push(`${indent} <midi-program>${midi.program}</midi-program>`);
4921
4913
  }
4922
4914
  if (midi.unpitched !== void 0) {
4923
- lines.push(`${indent} <midi-unpitched>${midi.unpitched}</midi-unpitched>`);
4915
+ out.push(`${indent} <midi-unpitched>${midi.unpitched}</midi-unpitched>`);
4924
4916
  }
4925
4917
  if (midi.volume !== void 0) {
4926
- lines.push(`${indent} <volume>${midi.volume}</volume>`);
4918
+ out.push(`${indent} <volume>${midi.volume}</volume>`);
4927
4919
  }
4928
4920
  if (midi.pan !== void 0) {
4929
- lines.push(`${indent} <pan>${midi.pan}</pan>`);
4921
+ out.push(`${indent} <pan>${midi.pan}</pan>`);
4930
4922
  }
4931
4923
  if (midi.elevation !== void 0) {
4932
- lines.push(`${indent} <elevation>${midi.elevation}</elevation>`);
4924
+ out.push(`${indent} <elevation>${midi.elevation}</elevation>`);
4933
4925
  }
4934
- lines.push(`${indent} </midi-instrument>`);
4926
+ out.push(`${indent} </midi-instrument>`);
4935
4927
  }
4936
4928
  }
4937
- lines.push(`${indent}</score-part>`);
4938
- return lines;
4929
+ out.push(`${indent}</score-part>`);
4939
4930
  }
4940
- function serializePartGroup(group, indent) {
4941
- const lines = [];
4931
+ function serializePartGroup(group, indent, out) {
4942
4932
  let attrs = ` type="${group.groupType}"`;
4943
4933
  if (group.number !== void 0) attrs += ` number="${group.number}"`;
4944
4934
  if (group._id) attrs += ` id="${escapeXml(group._id)}"`;
4945
- lines.push(`${indent}<part-group${attrs}>`);
4935
+ out.push(`${indent}<part-group${attrs}>`);
4946
4936
  if (group.groupName) {
4947
- lines.push(`${indent} <group-name>${escapeXml(group.groupName)}</group-name>`);
4937
+ out.push(`${indent} <group-name>${escapeXml(group.groupName)}</group-name>`);
4948
4938
  }
4949
4939
  if (group.groupNameDisplay && group.groupNameDisplay.length > 0) {
4950
- lines.push(`${indent} <group-name-display>`);
4951
- lines.push(...serializeDisplayTexts(group.groupNameDisplay, indent + " "));
4952
- lines.push(`${indent} </group-name-display>`);
4940
+ out.push(`${indent} <group-name-display>`);
4941
+ serializeDisplayTexts(group.groupNameDisplay, indent + " ", out);
4942
+ out.push(`${indent} </group-name-display>`);
4953
4943
  }
4954
4944
  if (group.groupAbbreviation) {
4955
- lines.push(`${indent} <group-abbreviation>${escapeXml(group.groupAbbreviation)}</group-abbreviation>`);
4945
+ out.push(`${indent} <group-abbreviation>${escapeXml(group.groupAbbreviation)}</group-abbreviation>`);
4956
4946
  }
4957
4947
  if (group.groupAbbreviationDisplay && group.groupAbbreviationDisplay.length > 0) {
4958
- lines.push(`${indent} <group-abbreviation-display>`);
4959
- lines.push(...serializeDisplayTexts(group.groupAbbreviationDisplay, indent + " "));
4960
- lines.push(`${indent} </group-abbreviation-display>`);
4948
+ out.push(`${indent} <group-abbreviation-display>`);
4949
+ serializeDisplayTexts(group.groupAbbreviationDisplay, indent + " ", out);
4950
+ out.push(`${indent} </group-abbreviation-display>`);
4961
4951
  }
4962
4952
  if (group.groupSymbol) {
4963
4953
  const defaultXAttr = group.groupSymbolDefaultX !== void 0 ? ` default-x="${group.groupSymbolDefaultX}"` : "";
4964
- lines.push(`${indent} <group-symbol${defaultXAttr}>${group.groupSymbol}</group-symbol>`);
4954
+ out.push(`${indent} <group-symbol${defaultXAttr}>${group.groupSymbol}</group-symbol>`);
4965
4955
  }
4966
4956
  if (group.groupBarline) {
4967
- lines.push(`${indent} <group-barline>${group.groupBarline}</group-barline>`);
4957
+ out.push(`${indent} <group-barline>${group.groupBarline}</group-barline>`);
4968
4958
  }
4969
- lines.push(`${indent}</part-group>`);
4970
- return lines;
4959
+ out.push(`${indent}</part-group>`);
4971
4960
  }
4972
- function serializePart(part, indent) {
4973
- const lines = [];
4961
+ function serializePart(part, indent, out) {
4974
4962
  const idAttr = part.id ? ` id="${escapeXml(part.id)}"` : "";
4975
- lines.push(`${indent}<part${idAttr}>`);
4963
+ out.push(`${indent}<part${idAttr}>`);
4976
4964
  for (const measure of part.measures) {
4977
- lines.push(...serializeMeasure(measure, indent + indent));
4965
+ serializeMeasure(measure, indent + indent, out);
4978
4966
  }
4979
- lines.push(`${indent}</part>`);
4980
- return lines;
4967
+ out.push(`${indent}</part>`);
4981
4968
  }
4982
- function serializeMeasure(measure, indent) {
4983
- const lines = [];
4969
+ function serializeMeasure(measure, indent, out) {
4984
4970
  let attrs = ` number="${measure.number}"`;
4985
4971
  if (measure._id) attrs += ` id="${escapeXml(measure._id)}"`;
4986
4972
  if (measure.width !== void 0) attrs += ` width="${measure.width}"`;
4987
4973
  if (measure.implicit) attrs += ` implicit="yes"`;
4988
- lines.push(`${indent}<measure${attrs}>`);
4974
+ out.push(`${indent}<measure${attrs}>`);
4989
4975
  if (measure.print) {
4990
- lines.push(...serializePrint(measure.print, indent + " "));
4976
+ serializePrint(measure.print, indent + " ", out);
4991
4977
  }
4992
4978
  if (measure.attributes) {
4993
- lines.push(...serializeAttributes(measure.attributes, indent + " "));
4979
+ serializeAttributes(measure.attributes, indent + " ", out);
4994
4980
  }
4995
4981
  for (const entry of measure.entries) {
4996
- lines.push(...serializeEntry(entry, indent + " "));
4982
+ serializeEntry(entry, indent + " ", out);
4997
4983
  }
4998
4984
  if (measure.barlines) {
4999
4985
  for (const barline of measure.barlines) {
5000
- lines.push(...serializeBarline(barline, indent + " "));
4986
+ serializeBarline(barline, indent + " ", out);
5001
4987
  }
5002
4988
  }
5003
- lines.push(`${indent}</measure>`);
5004
- return lines;
4989
+ out.push(`${indent}</measure>`);
5005
4990
  }
5006
- function serializePrint(print, indent) {
5007
- const lines = [];
4991
+ function serializePrint(print, indent, out) {
5008
4992
  let attrs = "";
5009
4993
  if (print.newSystem) attrs += ' new-system="yes"';
5010
4994
  if (print.newPage) attrs += ' new-page="yes"';
5011
4995
  if (print.blankPage !== void 0) attrs += ` blank-page="${print.blankPage}"`;
5012
4996
  if (print.pageNumber) attrs += ` page-number="${escapeXml(print.pageNumber)}"`;
5013
- lines.push(`${indent}<print${attrs}>`);
4997
+ out.push(`${indent}<print${attrs}>`);
5014
4998
  if (print.pageLayout) {
5015
- lines.push(...serializePageLayout(print.pageLayout, indent + " "));
4999
+ serializePageLayout(print.pageLayout, indent + " ", out);
5016
5000
  }
5017
5001
  if (print.systemLayout) {
5018
- lines.push(...serializeSystemLayout(print.systemLayout, indent + " "));
5002
+ serializeSystemLayout(print.systemLayout, indent + " ", out);
5019
5003
  }
5020
5004
  if (print.staffLayouts) {
5021
5005
  for (const sl of print.staffLayouts) {
5022
5006
  const numAttr = sl.number !== void 0 ? ` number="${sl.number}"` : "";
5023
- lines.push(`${indent} <staff-layout${numAttr}>`);
5007
+ out.push(`${indent} <staff-layout${numAttr}>`);
5024
5008
  if (sl.staffDistance !== void 0) {
5025
- lines.push(`${indent} <staff-distance>${sl.staffDistance}</staff-distance>`);
5009
+ out.push(`${indent} <staff-distance>${sl.staffDistance}</staff-distance>`);
5026
5010
  }
5027
- lines.push(`${indent} </staff-layout>`);
5011
+ out.push(`${indent} </staff-layout>`);
5028
5012
  }
5029
5013
  }
5030
5014
  if (print.measureLayout) {
5031
- lines.push(`${indent} <measure-layout>`);
5015
+ out.push(`${indent} <measure-layout>`);
5032
5016
  if (print.measureLayout.measureDistance !== void 0) {
5033
- lines.push(`${indent} <measure-distance>${print.measureLayout.measureDistance}</measure-distance>`);
5017
+ out.push(`${indent} <measure-distance>${print.measureLayout.measureDistance}</measure-distance>`);
5034
5018
  }
5035
- lines.push(`${indent} </measure-layout>`);
5019
+ out.push(`${indent} </measure-layout>`);
5036
5020
  }
5037
5021
  if (print.measureNumbering) {
5038
5022
  const mn = print.measureNumbering;
5039
5023
  if (typeof mn === "string") {
5040
- lines.push(`${indent} <measure-numbering>${escapeXml(mn)}</measure-numbering>`);
5024
+ out.push(`${indent} <measure-numbering>${escapeXml(mn)}</measure-numbering>`);
5041
5025
  } else {
5042
5026
  let mnAttrs = "";
5043
5027
  if (mn.system) mnAttrs += ` system="${mn.system}"`;
5044
- lines.push(`${indent} <measure-numbering${mnAttrs}>${escapeXml(mn.value)}</measure-numbering>`);
5028
+ out.push(`${indent} <measure-numbering${mnAttrs}>${escapeXml(mn.value)}</measure-numbering>`);
5045
5029
  }
5046
5030
  }
5047
5031
  if (print.partNameDisplay && print.partNameDisplay.length > 0) {
5048
- lines.push(`${indent} <part-name-display>`);
5049
- lines.push(...serializeDisplayTexts(print.partNameDisplay, indent + " "));
5050
- lines.push(`${indent} </part-name-display>`);
5032
+ out.push(`${indent} <part-name-display>`);
5033
+ serializeDisplayTexts(print.partNameDisplay, indent + " ", out);
5034
+ out.push(`${indent} </part-name-display>`);
5051
5035
  }
5052
5036
  if (print.partAbbreviationDisplay && print.partAbbreviationDisplay.length > 0) {
5053
- lines.push(`${indent} <part-abbreviation-display>`);
5054
- lines.push(...serializeDisplayTexts(print.partAbbreviationDisplay, indent + " "));
5055
- lines.push(`${indent} </part-abbreviation-display>`);
5037
+ out.push(`${indent} <part-abbreviation-display>`);
5038
+ serializeDisplayTexts(print.partAbbreviationDisplay, indent + " ", out);
5039
+ out.push(`${indent} </part-abbreviation-display>`);
5056
5040
  }
5057
- lines.push(`${indent}</print>`);
5058
- return lines;
5041
+ out.push(`${indent}</print>`);
5059
5042
  }
5060
- function serializeAttributes(attrs, indent, id) {
5061
- const lines = [];
5043
+ function serializeAttributes(attrs, indent, out, id) {
5062
5044
  const idAttr = id ? ` id="${escapeXml(id)}"` : "";
5063
- lines.push(`${indent}<attributes${idAttr}>`);
5045
+ out.push(`${indent}<attributes${idAttr}>`);
5064
5046
  if (attrs.divisions !== void 0) {
5065
- lines.push(`${indent} <divisions>${attrs.divisions}</divisions>`);
5047
+ out.push(`${indent} <divisions>${attrs.divisions}</divisions>`);
5066
5048
  }
5067
5049
  if (attrs.keys && attrs.keys.length > 0) {
5068
5050
  for (const key of attrs.keys) {
5069
- lines.push(...serializeKey(key, indent + " "));
5051
+ serializeKey(key, indent + " ", out);
5070
5052
  }
5071
5053
  } else if (attrs.key) {
5072
- lines.push(...serializeKey(attrs.key, indent + " "));
5054
+ serializeKey(attrs.key, indent + " ", out);
5073
5055
  }
5074
5056
  if (attrs.time) {
5075
- lines.push(...serializeTime(attrs.time, indent + " "));
5057
+ serializeTime(attrs.time, indent + " ", out);
5076
5058
  }
5077
5059
  if (attrs.staves !== void 0) {
5078
- lines.push(`${indent} <staves>${attrs.staves}</staves>`);
5060
+ out.push(`${indent} <staves>${attrs.staves}</staves>`);
5079
5061
  }
5080
5062
  if (attrs.instruments !== void 0) {
5081
- lines.push(`${indent} <instruments>${attrs.instruments}</instruments>`);
5063
+ out.push(`${indent} <instruments>${attrs.instruments}</instruments>`);
5082
5064
  }
5083
5065
  if (attrs.clef) {
5084
5066
  for (const clef of attrs.clef) {
5085
- lines.push(...serializeClef(clef, indent + " "));
5067
+ serializeClef(clef, indent + " ", out);
5086
5068
  }
5087
5069
  }
5088
5070
  if (attrs.transpose) {
5089
- lines.push(...serializeTranspose(attrs.transpose, indent + " "));
5071
+ serializeTranspose(attrs.transpose, indent + " ", out);
5090
5072
  }
5091
5073
  if (attrs.staffDetails) {
5092
5074
  for (const sd of attrs.staffDetails) {
5093
- lines.push(...serializeStaffDetails(sd, indent + " "));
5075
+ serializeStaffDetails(sd, indent + " ", out);
5094
5076
  }
5095
5077
  }
5096
5078
  if (attrs.measureStyle) {
5097
5079
  for (const ms of attrs.measureStyle) {
5098
- lines.push(...serializeMeasureStyle(ms, indent + " "));
5080
+ serializeMeasureStyle(ms, indent + " ", out);
5099
5081
  }
5100
5082
  }
5101
- lines.push(`${indent}</attributes>`);
5102
- return lines;
5083
+ out.push(`${indent}</attributes>`);
5103
5084
  }
5104
- function serializeKey(key, indent) {
5105
- const lines = [];
5085
+ function serializeKey(key, indent, out) {
5106
5086
  let keyAttrs = "";
5107
5087
  if (key.number !== void 0) keyAttrs += ` number="${key.number}"`;
5108
5088
  if (key.printObject === false) keyAttrs += ' print-object="no"';
5109
5089
  else if (key.printObject === true) keyAttrs += ' print-object="yes"';
5110
- lines.push(`${indent}<key${keyAttrs}>`);
5090
+ out.push(`${indent}<key${keyAttrs}>`);
5111
5091
  if (key.cancel !== void 0) {
5112
5092
  const locationAttr = key.cancelLocation ? ` location="${key.cancelLocation}"` : "";
5113
- lines.push(`${indent} <cancel${locationAttr}>${key.cancel}</cancel>`);
5093
+ out.push(`${indent} <cancel${locationAttr}>${key.cancel}</cancel>`);
5114
5094
  }
5115
5095
  if (key.keySteps && key.keyAlters && key.keySteps.length > 0) {
5116
5096
  for (let i = 0; i < key.keySteps.length; i++) {
5117
- lines.push(`${indent} <key-step>${key.keySteps[i]}</key-step>`);
5097
+ out.push(`${indent} <key-step>${key.keySteps[i]}</key-step>`);
5118
5098
  if (i < key.keyAlters.length) {
5119
- lines.push(`${indent} <key-alter>${key.keyAlters[i]}</key-alter>`);
5099
+ out.push(`${indent} <key-alter>${key.keyAlters[i]}</key-alter>`);
5120
5100
  }
5121
5101
  }
5122
5102
  if (key.keyOctaves) {
5123
5103
  for (const ko of key.keyOctaves) {
5124
5104
  let koAttrs = ` number="${ko.number}"`;
5125
5105
  if (ko.cancel !== void 0) koAttrs += ` cancel="${ko.cancel ? "yes" : "no"}"`;
5126
- lines.push(`${indent} <key-octave${koAttrs}>${ko.octave}</key-octave>`);
5106
+ out.push(`${indent} <key-octave${koAttrs}>${ko.octave}</key-octave>`);
5127
5107
  }
5128
5108
  }
5129
5109
  } else {
5130
- lines.push(`${indent} <fifths>${key.fifths}</fifths>`);
5110
+ out.push(`${indent} <fifths>${key.fifths}</fifths>`);
5131
5111
  if (key.mode) {
5132
- lines.push(`${indent} <mode>${key.mode}</mode>`);
5112
+ out.push(`${indent} <mode>${key.mode}</mode>`);
5133
5113
  }
5134
5114
  if (key.keyOctaves) {
5135
5115
  for (const ko of key.keyOctaves) {
5136
5116
  let koAttrs = ` number="${ko.number}"`;
5137
5117
  if (ko.cancel !== void 0) koAttrs += ` cancel="${ko.cancel ? "yes" : "no"}"`;
5138
- lines.push(`${indent} <key-octave${koAttrs}>${ko.octave}</key-octave>`);
5118
+ out.push(`${indent} <key-octave${koAttrs}>${ko.octave}</key-octave>`);
5139
5119
  }
5140
5120
  }
5141
5121
  }
5142
- lines.push(`${indent}</key>`);
5143
- return lines;
5122
+ out.push(`${indent}</key>`);
5144
5123
  }
5145
- function serializeTime(time, indent) {
5146
- const lines = [];
5124
+ function serializeTime(time, indent, out) {
5147
5125
  let attrs = "";
5148
5126
  if (time.symbol) attrs += ` symbol="${time.symbol}"`;
5149
5127
  if (time.printObject === false) attrs += ' print-object="no"';
5150
- lines.push(`${indent}<time${attrs}>`);
5128
+ out.push(`${indent}<time${attrs}>`);
5151
5129
  if (time.senzaMisura) {
5152
- lines.push(`${indent} <senza-misura/>`);
5130
+ out.push(`${indent} <senza-misura/>`);
5153
5131
  } else if (time.beatsList && time.beatTypeList && time.beatsList.length > 1) {
5154
5132
  const maxLen = Math.max(time.beatsList.length, time.beatTypeList.length);
5155
5133
  for (let i = 0; i < maxLen; i++) {
5156
5134
  if (i < time.beatsList.length) {
5157
5135
  const beatsValue = time.beatsStrList && i < time.beatsStrList.length ? time.beatsStrList[i] : time.beatsList[i];
5158
- lines.push(`${indent} <beats>${beatsValue}</beats>`);
5136
+ out.push(`${indent} <beats>${beatsValue}</beats>`);
5159
5137
  }
5160
5138
  if (i < time.beatTypeList.length) {
5161
- lines.push(`${indent} <beat-type>${time.beatTypeList[i]}</beat-type>`);
5139
+ out.push(`${indent} <beat-type>${time.beatTypeList[i]}</beat-type>`);
5162
5140
  }
5163
5141
  }
5164
5142
  } else {
5165
- lines.push(`${indent} <beats>${time.beats}</beats>`);
5166
- lines.push(`${indent} <beat-type>${time.beatType}</beat-type>`);
5143
+ out.push(`${indent} <beats>${time.beats}</beats>`);
5144
+ out.push(`${indent} <beat-type>${time.beatType}</beat-type>`);
5167
5145
  }
5168
- lines.push(`${indent}</time>`);
5169
- return lines;
5146
+ out.push(`${indent}</time>`);
5170
5147
  }
5171
- function serializeClef(clef, indent) {
5172
- const lines = [];
5148
+ function serializeClef(clef, indent, out) {
5173
5149
  let attrs = clef.staff ? ` number="${clef.staff}"` : "";
5174
5150
  if (clef.printObject === false) attrs += ' print-object="no"';
5175
5151
  else if (clef.printObject === true) attrs += ' print-object="yes"';
5176
5152
  if (clef.afterBarline) attrs += ' after-barline="yes"';
5177
- lines.push(`${indent}<clef${attrs}>`);
5178
- lines.push(`${indent} <sign>${clef.sign}</sign>`);
5153
+ out.push(`${indent}<clef${attrs}>`);
5154
+ out.push(`${indent} <sign>${clef.sign}</sign>`);
5179
5155
  if (clef.line !== void 0) {
5180
- lines.push(`${indent} <line>${clef.line}</line>`);
5156
+ out.push(`${indent} <line>${clef.line}</line>`);
5181
5157
  }
5182
5158
  if (clef.clefOctaveChange !== void 0) {
5183
- lines.push(`${indent} <clef-octave-change>${clef.clefOctaveChange}</clef-octave-change>`);
5159
+ out.push(`${indent} <clef-octave-change>${clef.clefOctaveChange}</clef-octave-change>`);
5184
5160
  }
5185
- lines.push(`${indent}</clef>`);
5186
- return lines;
5161
+ out.push(`${indent}</clef>`);
5187
5162
  }
5188
- function serializeTranspose(transpose2, indent) {
5189
- const lines = [];
5190
- lines.push(`${indent}<transpose>`);
5191
- lines.push(`${indent} <diatonic>${transpose2.diatonic}</diatonic>`);
5192
- lines.push(`${indent} <chromatic>${transpose2.chromatic}</chromatic>`);
5163
+ function serializeTranspose(transpose2, indent, out) {
5164
+ out.push(`${indent}<transpose>`);
5165
+ out.push(`${indent} <diatonic>${transpose2.diatonic}</diatonic>`);
5166
+ out.push(`${indent} <chromatic>${transpose2.chromatic}</chromatic>`);
5193
5167
  if (transpose2.octaveChange !== void 0) {
5194
- lines.push(`${indent} <octave-change>${transpose2.octaveChange}</octave-change>`);
5168
+ out.push(`${indent} <octave-change>${transpose2.octaveChange}</octave-change>`);
5195
5169
  }
5196
- lines.push(`${indent}</transpose>`);
5197
- return lines;
5170
+ out.push(`${indent}</transpose>`);
5198
5171
  }
5199
- function serializeEntry(entry, indent) {
5172
+ function serializeEntry(entry, indent, out) {
5200
5173
  switch (entry.type) {
5201
5174
  case "note":
5202
- return serializeNote(entry, indent);
5175
+ serializeNote(entry, indent, out);
5176
+ break;
5203
5177
  case "backup":
5204
- return serializeBackup(entry, indent);
5178
+ serializeBackup(entry, indent, out);
5179
+ break;
5205
5180
  case "forward":
5206
- return serializeForward(entry, indent);
5181
+ serializeForward(entry, indent, out);
5182
+ break;
5207
5183
  case "direction":
5208
- return serializeDirection(entry, indent);
5184
+ serializeDirection(entry, indent, out);
5185
+ break;
5209
5186
  case "harmony":
5210
- return serializeHarmony(entry, indent);
5187
+ serializeHarmony(entry, indent, out);
5188
+ break;
5211
5189
  case "figured-bass":
5212
- return serializeFiguredBass(entry, indent);
5190
+ serializeFiguredBass(entry, indent, out);
5191
+ break;
5213
5192
  case "sound":
5214
- return serializeSound(entry, indent);
5193
+ serializeSound(entry, indent, out);
5194
+ break;
5215
5195
  case "attributes":
5216
- return serializeAttributes(entry.attributes, indent, entry._id);
5196
+ serializeAttributes(entry.attributes, indent, out, entry._id);
5197
+ break;
5217
5198
  case "grouping": {
5218
5199
  const grp = entry;
5219
5200
  let grpAttrs = ` type="${grp.groupingType}"`;
5220
5201
  if (grp.number) grpAttrs += ` number="${grp.number}"`;
5221
- return [`${indent}<grouping${grpAttrs}/>`];
5202
+ out.push(`${indent}<grouping${grpAttrs}/>`);
5203
+ break;
5222
5204
  }
5223
5205
  default:
5224
- return [];
5206
+ break;
5225
5207
  }
5226
5208
  }
5227
- function serializeNote(note, indent) {
5228
- const lines = [];
5209
+ function serializeNote(note, indent, out) {
5229
5210
  const noteAttrs = buildAttrs({
5230
5211
  "id": note._id,
5231
5212
  "default-x": note.defaultX,
@@ -5237,74 +5218,74 @@ function serializeNote(note, indent) {
5237
5218
  "print-dot": note.printDot !== void 0 ? note.printDot : void 0,
5238
5219
  "print-spacing": note.printSpacing
5239
5220
  });
5240
- lines.push(`${indent}<note${noteAttrs}>`);
5221
+ out.push(`${indent}<note${noteAttrs}>`);
5241
5222
  if (note.grace) {
5242
5223
  const graceAttrs = buildAttrs({
5243
5224
  "slash": note.grace.slash !== void 0 ? note.grace.slash : void 0,
5244
5225
  "steal-time-previous": note.grace.stealTimePrevious,
5245
5226
  "steal-time-following": note.grace.stealTimeFollowing
5246
5227
  });
5247
- lines.push(`${indent} <grace${graceAttrs}/>`);
5228
+ out.push(`${indent} <grace${graceAttrs}/>`);
5248
5229
  }
5249
5230
  if (note.cue) {
5250
- lines.push(`${indent} <cue/>`);
5231
+ out.push(`${indent} <cue/>`);
5251
5232
  }
5252
5233
  if (note.chord) {
5253
- lines.push(`${indent} <chord/>`);
5234
+ out.push(`${indent} <chord/>`);
5254
5235
  }
5255
5236
  if (note.pitch) {
5256
- lines.push(...serializePitch(note.pitch, indent + " "));
5237
+ serializePitch(note.pitch, indent + " ", out);
5257
5238
  } else if (note.rest) {
5258
5239
  let restAttrs = "";
5259
5240
  if (note.rest.measure) restAttrs += ' measure="yes"';
5260
5241
  if (note.rest.displayStep || note.rest.displayOctave !== void 0) {
5261
- lines.push(`${indent} <rest${restAttrs}>`);
5242
+ out.push(`${indent} <rest${restAttrs}>`);
5262
5243
  if (note.rest.displayStep) {
5263
- lines.push(`${indent} <display-step>${note.rest.displayStep}</display-step>`);
5244
+ out.push(`${indent} <display-step>${note.rest.displayStep}</display-step>`);
5264
5245
  }
5265
5246
  if (note.rest.displayOctave !== void 0) {
5266
- lines.push(`${indent} <display-octave>${note.rest.displayOctave}</display-octave>`);
5247
+ out.push(`${indent} <display-octave>${note.rest.displayOctave}</display-octave>`);
5267
5248
  }
5268
- lines.push(`${indent} </rest>`);
5249
+ out.push(`${indent} </rest>`);
5269
5250
  } else {
5270
- lines.push(`${indent} <rest${restAttrs}/>`);
5251
+ out.push(`${indent} <rest${restAttrs}/>`);
5271
5252
  }
5272
5253
  } else if (note.unpitched) {
5273
5254
  if (note.unpitched.displayStep || note.unpitched.displayOctave !== void 0) {
5274
- lines.push(`${indent} <unpitched>`);
5255
+ out.push(`${indent} <unpitched>`);
5275
5256
  if (note.unpitched.displayStep) {
5276
- lines.push(`${indent} <display-step>${note.unpitched.displayStep}</display-step>`);
5257
+ out.push(`${indent} <display-step>${note.unpitched.displayStep}</display-step>`);
5277
5258
  }
5278
5259
  if (note.unpitched.displayOctave !== void 0) {
5279
- lines.push(`${indent} <display-octave>${note.unpitched.displayOctave}</display-octave>`);
5260
+ out.push(`${indent} <display-octave>${note.unpitched.displayOctave}</display-octave>`);
5280
5261
  }
5281
- lines.push(`${indent} </unpitched>`);
5262
+ out.push(`${indent} </unpitched>`);
5282
5263
  } else {
5283
- lines.push(`${indent} <unpitched/>`);
5264
+ out.push(`${indent} <unpitched/>`);
5284
5265
  }
5285
5266
  } else {
5286
- lines.push(`${indent} <rest/>`);
5267
+ out.push(`${indent} <rest/>`);
5287
5268
  }
5288
5269
  if (!note.grace) {
5289
- lines.push(`${indent} <duration>${note.duration}</duration>`);
5270
+ out.push(`${indent} <duration>${note.duration}</duration>`);
5290
5271
  }
5291
5272
  if (note.ties && note.ties.length > 0) {
5292
5273
  for (const tie of note.ties) {
5293
- lines.push(`${indent} <tie type="${tie.type}"/>`);
5274
+ out.push(`${indent} <tie type="${tie.type}"/>`);
5294
5275
  }
5295
5276
  } else if (note.tie) {
5296
- lines.push(`${indent} <tie type="${note.tie.type}"/>`);
5277
+ out.push(`${indent} <tie type="${note.tie.type}"/>`);
5297
5278
  }
5298
5279
  if (note.voice !== void 0) {
5299
- lines.push(`${indent} <voice>${note.voice}</voice>`);
5280
+ out.push(`${indent} <voice>${note.voice}</voice>`);
5300
5281
  }
5301
5282
  if (note.noteType) {
5302
5283
  const typeAttrs = note.noteTypeSize ? ` size="${escapeXml(note.noteTypeSize)}"` : "";
5303
- lines.push(`${indent} <type${typeAttrs}>${note.noteType}</type>`);
5284
+ out.push(`${indent} <type${typeAttrs}>${note.noteType}</type>`);
5304
5285
  }
5305
5286
  if (note.dots) {
5306
5287
  for (let i = 0; i < note.dots; i++) {
5307
- lines.push(`${indent} <dot/>`);
5288
+ out.push(`${indent} <dot/>`);
5308
5289
  }
5309
5290
  }
5310
5291
  if (note.accidental) {
@@ -5319,74 +5300,70 @@ function serializeNote(note, indent) {
5319
5300
  "size": note.accidental.size,
5320
5301
  "font-size": note.accidental.fontSize
5321
5302
  });
5322
- lines.push(`${indent} <accidental${accAttrs}>${note.accidental.value}</accidental>`);
5303
+ out.push(`${indent} <accidental${accAttrs}>${note.accidental.value}</accidental>`);
5323
5304
  }
5324
5305
  if (note.timeModification) {
5325
- lines.push(`${indent} <time-modification>`);
5326
- lines.push(`${indent} <actual-notes>${note.timeModification.actualNotes}</actual-notes>`);
5327
- lines.push(`${indent} <normal-notes>${note.timeModification.normalNotes}</normal-notes>`);
5306
+ out.push(`${indent} <time-modification>`);
5307
+ out.push(`${indent} <actual-notes>${note.timeModification.actualNotes}</actual-notes>`);
5308
+ out.push(`${indent} <normal-notes>${note.timeModification.normalNotes}</normal-notes>`);
5328
5309
  if (note.timeModification.normalType) {
5329
- lines.push(`${indent} <normal-type>${note.timeModification.normalType}</normal-type>`);
5310
+ out.push(`${indent} <normal-type>${note.timeModification.normalType}</normal-type>`);
5330
5311
  }
5331
5312
  if (note.timeModification.normalDots) {
5332
5313
  for (let i = 0; i < note.timeModification.normalDots; i++) {
5333
- lines.push(`${indent} <normal-dot/>`);
5314
+ out.push(`${indent} <normal-dot/>`);
5334
5315
  }
5335
5316
  }
5336
- lines.push(`${indent} </time-modification>`);
5317
+ out.push(`${indent} </time-modification>`);
5337
5318
  }
5338
5319
  if (note.stem) {
5339
5320
  const stemAttrs = buildAttrs({
5340
5321
  "default-x": note.stem.defaultX,
5341
5322
  "default-y": note.stem.defaultY
5342
5323
  });
5343
- lines.push(`${indent} <stem${stemAttrs}>${note.stem.value}</stem>`);
5324
+ out.push(`${indent} <stem${stemAttrs}>${note.stem.value}</stem>`);
5344
5325
  }
5345
5326
  if (note.notehead) {
5346
5327
  const nhAttrs = buildAttrs({
5347
5328
  "filled": note.notehead.filled,
5348
5329
  "parentheses": note.notehead.parentheses || void 0
5349
5330
  });
5350
- lines.push(`${indent} <notehead${nhAttrs}>${note.notehead.value}</notehead>`);
5331
+ out.push(`${indent} <notehead${nhAttrs}>${note.notehead.value}</notehead>`);
5351
5332
  }
5352
5333
  if (note.staff !== void 0) {
5353
- lines.push(`${indent} <staff>${note.staff}</staff>`);
5334
+ out.push(`${indent} <staff>${note.staff}</staff>`);
5354
5335
  }
5355
5336
  if (note.instrument) {
5356
- lines.push(`${indent} <instrument id="${escapeXml(note.instrument)}"/>`);
5337
+ out.push(`${indent} <instrument id="${escapeXml(note.instrument)}"/>`);
5357
5338
  }
5358
5339
  if (note.beam) {
5359
5340
  for (const beam of note.beam) {
5360
- lines.push(...serializeBeam(beam, indent + " "));
5341
+ serializeBeam(beam, indent + " ", out);
5361
5342
  }
5362
5343
  }
5363
5344
  if (note.notations && note.notations.length > 0) {
5364
- lines.push(...serializeNotations(note.notations, indent + " "));
5345
+ serializeNotations(note.notations, indent + " ", out);
5365
5346
  }
5366
5347
  if (note.lyrics) {
5367
5348
  for (const lyric of note.lyrics) {
5368
- lines.push(...serializeLyric(lyric, indent + " "));
5349
+ serializeLyric(lyric, indent + " ", out);
5369
5350
  }
5370
5351
  }
5371
- lines.push(`${indent}</note>`);
5372
- return lines;
5352
+ out.push(`${indent}</note>`);
5373
5353
  }
5374
- function serializePitch(pitch, indent) {
5375
- const lines = [];
5376
- lines.push(`${indent}<pitch>`);
5377
- lines.push(`${indent} <step>${pitch.step}</step>`);
5354
+ function serializePitch(pitch, indent, out) {
5355
+ out.push(`${indent}<pitch>`);
5356
+ out.push(`${indent} <step>${pitch.step}</step>`);
5378
5357
  if (pitch.alter !== void 0 && pitch.alter !== 0) {
5379
- lines.push(`${indent} <alter>${pitch.alter}</alter>`);
5358
+ out.push(`${indent} <alter>${pitch.alter}</alter>`);
5380
5359
  }
5381
- lines.push(`${indent} <octave>${pitch.octave}</octave>`);
5382
- lines.push(`${indent}</pitch>`);
5383
- return lines;
5360
+ out.push(`${indent} <octave>${pitch.octave}</octave>`);
5361
+ out.push(`${indent}</pitch>`);
5384
5362
  }
5385
- function serializeBeam(beam, indent) {
5386
- return [`${indent}<beam number="${beam.number}">${beam.type}</beam>`];
5363
+ function serializeBeam(beam, indent, out) {
5364
+ out.push(`${indent}<beam number="${beam.number}">${beam.type}</beam>`);
5387
5365
  }
5388
- function serializeNotations(notations, indent) {
5389
- const lines = [];
5366
+ function serializeNotations(notations, indent, out) {
5390
5367
  const notationsGroups = /* @__PURE__ */ new Map();
5391
5368
  for (const notation of notations) {
5392
5369
  const idx = _nullishCoalesce(notation.notationsIndex, () => ( 0));
@@ -5398,13 +5375,11 @@ function serializeNotations(notations, indent) {
5398
5375
  const sortedIndices = Array.from(notationsGroups.keys()).sort((a, b) => a - b);
5399
5376
  for (const notationsIdx of sortedIndices) {
5400
5377
  const groupNotations = notationsGroups.get(notationsIdx);
5401
- lines.push(...serializeNotationsGroup(groupNotations, indent));
5378
+ serializeNotationsGroup(groupNotations, indent, out);
5402
5379
  }
5403
- return lines;
5404
5380
  }
5405
- function serializeNotationsGroup(notations, indent) {
5406
- const lines = [];
5407
- lines.push(`${indent}<notations>`);
5381
+ function serializeNotationsGroup(notations, indent, out) {
5382
+ out.push(`${indent}<notations>`);
5408
5383
  const chunks = [];
5409
5384
  for (const notation of notations) {
5410
5385
  if (notation.type === "articulation") {
@@ -5435,25 +5410,23 @@ function serializeNotationsGroup(notations, indent) {
5435
5410
  }
5436
5411
  for (const chunk of chunks) {
5437
5412
  if (chunk.kind === "standalone") {
5438
- lines.push(...serializeStandaloneNotation(chunk.notation, indent));
5413
+ serializeStandaloneNotation(chunk.notation, indent, out);
5439
5414
  } else if (chunk.kind === "articulations") {
5440
- lines.push(...serializeArticulationsGroup(chunk.items, indent));
5415
+ serializeArticulationsGroup(chunk.items, indent, out);
5441
5416
  } else if (chunk.kind === "ornaments") {
5442
- lines.push(...serializeOrnamentsGroup(chunk.items, indent));
5417
+ serializeOrnamentsGroup(chunk.items, indent, out);
5443
5418
  } else if (chunk.kind === "technical") {
5444
- lines.push(...serializeTechnicalGroup(chunk.items, indent));
5419
+ serializeTechnicalGroup(chunk.items, indent, out);
5445
5420
  }
5446
5421
  }
5447
- lines.push(`${indent}</notations>`);
5448
- return lines;
5422
+ out.push(`${indent}</notations>`);
5449
5423
  }
5450
- function serializeStandaloneNotation(notation, indent) {
5451
- const lines = [];
5424
+ function serializeStandaloneNotation(notation, indent, out) {
5452
5425
  if (notation.type === "tied") {
5453
5426
  let attrs = ` type="${notation.tiedType}"`;
5454
5427
  if (notation.number !== void 0) attrs += ` number="${notation.number}"`;
5455
5428
  if (notation.orientation) attrs += ` orientation="${notation.orientation}"`;
5456
- lines.push(`${indent} <tied${attrs}/>`);
5429
+ out.push(`${indent} <tied${attrs}/>`);
5457
5430
  } else if (notation.type === "slur") {
5458
5431
  let attrs = "";
5459
5432
  if (notation.number !== void 0) attrs += ` number="${notation.number}"`;
@@ -5467,7 +5440,7 @@ function serializeStandaloneNotation(notation, indent) {
5467
5440
  if (notation.bezierX2 !== void 0) attrs += ` bezier-x2="${notation.bezierX2}"`;
5468
5441
  if (notation.bezierY2 !== void 0) attrs += ` bezier-y2="${notation.bezierY2}"`;
5469
5442
  if (notation.placement) attrs += ` placement="${notation.placement}"`;
5470
- lines.push(`${indent} <slur${attrs}/>`);
5443
+ out.push(`${indent} <slur${attrs}/>`);
5471
5444
  } else if (notation.type === "tuplet") {
5472
5445
  let attrs = ` type="${notation.tupletType}"`;
5473
5446
  if (notation.number !== void 0) attrs += ` number="${notation.number}"`;
@@ -5478,51 +5451,51 @@ function serializeStandaloneNotation(notation, indent) {
5478
5451
  if (notation.placement) attrs += ` placement="${notation.placement}"`;
5479
5452
  const tup = notation;
5480
5453
  if (tup.tupletActual || tup.tupletNormal) {
5481
- lines.push(`${indent} <tuplet${attrs}>`);
5454
+ out.push(`${indent} <tuplet${attrs}>`);
5482
5455
  if (tup.tupletActual) {
5483
- lines.push(`${indent} <tuplet-actual>`);
5456
+ out.push(`${indent} <tuplet-actual>`);
5484
5457
  if (tup.tupletActual.tupletNumber !== void 0) {
5485
- lines.push(`${indent} <tuplet-number>${tup.tupletActual.tupletNumber}</tuplet-number>`);
5458
+ out.push(`${indent} <tuplet-number>${tup.tupletActual.tupletNumber}</tuplet-number>`);
5486
5459
  }
5487
5460
  if (tup.tupletActual.tupletType) {
5488
- lines.push(`${indent} <tuplet-type>${tup.tupletActual.tupletType}</tuplet-type>`);
5461
+ out.push(`${indent} <tuplet-type>${tup.tupletActual.tupletType}</tuplet-type>`);
5489
5462
  }
5490
5463
  if (tup.tupletActual.tupletDots) {
5491
5464
  for (let i = 0; i < tup.tupletActual.tupletDots; i++) {
5492
- lines.push(`${indent} <tuplet-dot/>`);
5465
+ out.push(`${indent} <tuplet-dot/>`);
5493
5466
  }
5494
5467
  }
5495
- lines.push(`${indent} </tuplet-actual>`);
5468
+ out.push(`${indent} </tuplet-actual>`);
5496
5469
  }
5497
5470
  if (tup.tupletNormal) {
5498
- lines.push(`${indent} <tuplet-normal>`);
5471
+ out.push(`${indent} <tuplet-normal>`);
5499
5472
  if (tup.tupletNormal.tupletNumber !== void 0) {
5500
- lines.push(`${indent} <tuplet-number>${tup.tupletNormal.tupletNumber}</tuplet-number>`);
5473
+ out.push(`${indent} <tuplet-number>${tup.tupletNormal.tupletNumber}</tuplet-number>`);
5501
5474
  }
5502
5475
  if (tup.tupletNormal.tupletType) {
5503
- lines.push(`${indent} <tuplet-type>${tup.tupletNormal.tupletType}</tuplet-type>`);
5476
+ out.push(`${indent} <tuplet-type>${tup.tupletNormal.tupletType}</tuplet-type>`);
5504
5477
  }
5505
5478
  if (tup.tupletNormal.tupletDots) {
5506
5479
  for (let i = 0; i < tup.tupletNormal.tupletDots; i++) {
5507
- lines.push(`${indent} <tuplet-dot/>`);
5480
+ out.push(`${indent} <tuplet-dot/>`);
5508
5481
  }
5509
5482
  }
5510
- lines.push(`${indent} </tuplet-normal>`);
5483
+ out.push(`${indent} </tuplet-normal>`);
5511
5484
  }
5512
- lines.push(`${indent} </tuplet>`);
5485
+ out.push(`${indent} </tuplet>`);
5513
5486
  } else {
5514
- lines.push(`${indent} <tuplet${attrs}/>`);
5487
+ out.push(`${indent} <tuplet${attrs}/>`);
5515
5488
  }
5516
5489
  } else if (notation.type === "dynamics") {
5517
5490
  const placementAttr = notation.placement ? ` placement="${notation.placement}"` : "";
5518
- lines.push(`${indent} <dynamics${placementAttr}>`);
5491
+ out.push(`${indent} <dynamics${placementAttr}>`);
5519
5492
  for (const dyn of notation.dynamics) {
5520
- lines.push(`${indent} <${dyn}/>`);
5493
+ out.push(`${indent} <${dyn}/>`);
5521
5494
  }
5522
5495
  if (notation.otherDynamics) {
5523
- lines.push(`${indent} <other-dynamics>${escapeXml(notation.otherDynamics)}</other-dynamics>`);
5496
+ out.push(`${indent} <other-dynamics>${escapeXml(notation.otherDynamics)}</other-dynamics>`);
5524
5497
  }
5525
- lines.push(`${indent} </dynamics>`);
5498
+ out.push(`${indent} </dynamics>`);
5526
5499
  } else if (notation.type === "fermata") {
5527
5500
  let attrs = "";
5528
5501
  if (notation.fermataType) attrs += ` type="${notation.fermataType}"`;
@@ -5530,9 +5503,9 @@ function serializeStandaloneNotation(notation, indent) {
5530
5503
  if (notation.defaultX !== void 0) attrs += ` default-x="${notation.defaultX}"`;
5531
5504
  if (notation.defaultY !== void 0) attrs += ` default-y="${notation.defaultY}"`;
5532
5505
  if (notation.shape) {
5533
- lines.push(`${indent} <fermata${attrs}>${notation.shape}</fermata>`);
5506
+ out.push(`${indent} <fermata${attrs}>${notation.shape}</fermata>`);
5534
5507
  } else {
5535
- lines.push(`${indent} <fermata${attrs}/>`);
5508
+ out.push(`${indent} <fermata${attrs}/>`);
5536
5509
  }
5537
5510
  } else if (notation.type === "arpeggiate") {
5538
5511
  let attrs = "";
@@ -5540,40 +5513,38 @@ function serializeStandaloneNotation(notation, indent) {
5540
5513
  if (notation.number !== void 0) attrs += ` number="${notation.number}"`;
5541
5514
  if (notation.defaultX !== void 0) attrs += ` default-x="${notation.defaultX}"`;
5542
5515
  if (notation.defaultY !== void 0) attrs += ` default-y="${notation.defaultY}"`;
5543
- lines.push(`${indent} <arpeggiate${attrs}/>`);
5516
+ out.push(`${indent} <arpeggiate${attrs}/>`);
5544
5517
  } else if (notation.type === "non-arpeggiate") {
5545
5518
  let attrs = ` type="${notation.nonArpeggiateType}"`;
5546
5519
  if (notation.number !== void 0) attrs += ` number="${notation.number}"`;
5547
5520
  if (notation.placement) attrs += ` placement="${notation.placement}"`;
5548
- lines.push(`${indent} <non-arpeggiate${attrs}/>`);
5521
+ out.push(`${indent} <non-arpeggiate${attrs}/>`);
5549
5522
  } else if (notation.type === "accidental-mark") {
5550
5523
  let attrs = "";
5551
5524
  if (notation.placement) attrs += ` placement="${notation.placement}"`;
5552
- lines.push(`${indent} <accidental-mark${attrs}>${escapeXml(notation.value)}</accidental-mark>`);
5525
+ out.push(`${indent} <accidental-mark${attrs}>${escapeXml(notation.value)}</accidental-mark>`);
5553
5526
  } else if (notation.type === "glissando") {
5554
5527
  let attrs = ` type="${notation.glissandoType}"`;
5555
5528
  if (notation.number !== void 0) attrs += ` number="${notation.number}"`;
5556
5529
  if (notation.lineType) attrs += ` line-type="${notation.lineType}"`;
5557
5530
  if (notation.text) {
5558
- lines.push(`${indent} <glissando${attrs}>${escapeXml(notation.text)}</glissando>`);
5531
+ out.push(`${indent} <glissando${attrs}>${escapeXml(notation.text)}</glissando>`);
5559
5532
  } else {
5560
- lines.push(`${indent} <glissando${attrs}/>`);
5533
+ out.push(`${indent} <glissando${attrs}/>`);
5561
5534
  }
5562
5535
  } else if (notation.type === "slide") {
5563
5536
  let attrs = ` type="${notation.slideType}"`;
5564
5537
  if (notation.number !== void 0) attrs += ` number="${notation.number}"`;
5565
5538
  if (notation.lineType) attrs += ` line-type="${notation.lineType}"`;
5566
5539
  if (notation.text) {
5567
- lines.push(`${indent} <slide${attrs}>${escapeXml(notation.text)}</slide>`);
5540
+ out.push(`${indent} <slide${attrs}>${escapeXml(notation.text)}</slide>`);
5568
5541
  } else {
5569
- lines.push(`${indent} <slide${attrs}/>`);
5542
+ out.push(`${indent} <slide${attrs}/>`);
5570
5543
  }
5571
5544
  }
5572
- return lines;
5573
5545
  }
5574
- function serializeArticulationsGroup(artGroup, indent) {
5575
- const lines = [];
5576
- lines.push(`${indent} <articulations>`);
5546
+ function serializeArticulationsGroup(artGroup, indent, out) {
5547
+ out.push(`${indent} <articulations>`);
5577
5548
  for (const art of artGroup) {
5578
5549
  if (art.type === "articulation") {
5579
5550
  let artAttrs = art.placement ? ` placement="${art.placement}"` : "";
@@ -5582,19 +5553,17 @@ function serializeArticulationsGroup(artGroup, indent) {
5582
5553
  }
5583
5554
  if (art.defaultX !== void 0) artAttrs += ` default-x="${art.defaultX}"`;
5584
5555
  if (art.defaultY !== void 0) artAttrs += ` default-y="${art.defaultY}"`;
5585
- lines.push(`${indent} <${art.articulation}${artAttrs}/>`);
5556
+ out.push(`${indent} <${art.articulation}${artAttrs}/>`);
5586
5557
  }
5587
5558
  }
5588
- lines.push(`${indent} </articulations>`);
5589
- return lines;
5559
+ out.push(`${indent} </articulations>`);
5590
5560
  }
5591
- function serializeOrnamentsGroup(ornaments, indent) {
5592
- const lines = [];
5561
+ function serializeOrnamentsGroup(ornaments, indent, out) {
5593
5562
  const hasOnlyEmptyMarker = ornaments.length === 1 && ornaments[0].type === "ornament" && ornaments[0].ornament === "empty";
5594
5563
  if (hasOnlyEmptyMarker) {
5595
- lines.push(`${indent} <ornaments/>`);
5564
+ out.push(`${indent} <ornaments/>`);
5596
5565
  } else {
5597
- lines.push(`${indent} <ornaments>`);
5566
+ out.push(`${indent} <ornaments>`);
5598
5567
  const allAccidentalMarks = [];
5599
5568
  for (const orn of ornaments) {
5600
5569
  if (orn.type === "ornament") {
@@ -5606,7 +5575,7 @@ function serializeOrnamentsGroup(ornaments, indent) {
5606
5575
  if (orn.number !== void 0) wlAttrs += ` number="${orn.number}"`;
5607
5576
  wlAttrs += placementAttr;
5608
5577
  if (orn.defaultY !== void 0) wlAttrs += ` default-y="${orn.defaultY}"`;
5609
- lines.push(`${indent} <wavy-line${wlAttrs}/>`);
5578
+ out.push(`${indent} <wavy-line${wlAttrs}/>`);
5610
5579
  } else if (orn.ornament === "tremolo") {
5611
5580
  let tremAttrs = "";
5612
5581
  if (orn.tremoloType) tremAttrs += ` type="${orn.tremoloType}"`;
@@ -5614,14 +5583,14 @@ function serializeOrnamentsGroup(ornaments, indent) {
5614
5583
  if (orn.defaultX !== void 0) tremAttrs += ` default-x="${orn.defaultX}"`;
5615
5584
  if (orn.defaultY !== void 0) tremAttrs += ` default-y="${orn.defaultY}"`;
5616
5585
  if (orn.tremoloMarks !== void 0) {
5617
- lines.push(`${indent} <tremolo${tremAttrs}>${orn.tremoloMarks}</tremolo>`);
5586
+ out.push(`${indent} <tremolo${tremAttrs}>${orn.tremoloMarks}</tremolo>`);
5618
5587
  } else {
5619
- lines.push(`${indent} <tremolo${tremAttrs}/>`);
5588
+ out.push(`${indent} <tremolo${tremAttrs}/>`);
5620
5589
  }
5621
5590
  } else {
5622
5591
  let ornAttrs = placementAttr;
5623
5592
  if (orn.defaultY !== void 0) ornAttrs += ` default-y="${orn.defaultY}"`;
5624
- lines.push(`${indent} <${orn.ornament}${ornAttrs}/>`);
5593
+ out.push(`${indent} <${orn.ornament}${ornAttrs}/>`);
5625
5594
  }
5626
5595
  if (orn.accidentalMarks) {
5627
5596
  allAccidentalMarks.push(...orn.accidentalMarks);
@@ -5630,15 +5599,13 @@ function serializeOrnamentsGroup(ornaments, indent) {
5630
5599
  }
5631
5600
  for (const am of allAccidentalMarks) {
5632
5601
  const amPlacement = am.placement ? ` placement="${am.placement}"` : "";
5633
- lines.push(`${indent} <accidental-mark${amPlacement}>${am.value}</accidental-mark>`);
5602
+ out.push(`${indent} <accidental-mark${amPlacement}>${am.value}</accidental-mark>`);
5634
5603
  }
5635
- lines.push(`${indent} </ornaments>`);
5604
+ out.push(`${indent} </ornaments>`);
5636
5605
  }
5637
- return lines;
5638
5606
  }
5639
- function serializeTechnicalGroup(technicals, indent) {
5640
- const lines = [];
5641
- lines.push(`${indent} <technical>`);
5607
+ function serializeTechnicalGroup(technicals, indent, out) {
5608
+ out.push(`${indent} <technical>`);
5642
5609
  for (const tech of technicals) {
5643
5610
  if (tech.type === "technical") {
5644
5611
  let placementAttr = tech.placement ? ` placement="${tech.placement}"` : "";
@@ -5646,32 +5613,32 @@ function serializeTechnicalGroup(technicals, indent) {
5646
5613
  if (techNotation.defaultX !== void 0) placementAttr += ` default-x="${techNotation.defaultX}"`;
5647
5614
  if (techNotation.defaultY !== void 0) placementAttr += ` default-y="${techNotation.defaultY}"`;
5648
5615
  if (tech.technical === "bend" && (techNotation.bendAlter !== void 0 || techNotation.preBend || techNotation.release)) {
5649
- lines.push(`${indent} <bend${placementAttr}>`);
5616
+ out.push(`${indent} <bend${placementAttr}>`);
5650
5617
  if (techNotation.bendAlter !== void 0) {
5651
- lines.push(`${indent} <bend-alter>${techNotation.bendAlter}</bend-alter>`);
5618
+ out.push(`${indent} <bend-alter>${techNotation.bendAlter}</bend-alter>`);
5652
5619
  }
5653
5620
  if (techNotation.preBend) {
5654
- lines.push(`${indent} <pre-bend/>`);
5621
+ out.push(`${indent} <pre-bend/>`);
5655
5622
  }
5656
5623
  if (techNotation.release) {
5657
- lines.push(`${indent} <release/>`);
5624
+ out.push(`${indent} <release/>`);
5658
5625
  }
5659
5626
  if (techNotation.withBar) {
5660
- lines.push(`${indent} <with-bar/>`);
5627
+ out.push(`${indent} <with-bar/>`);
5661
5628
  }
5662
- lines.push(`${indent} </bend>`);
5629
+ out.push(`${indent} </bend>`);
5663
5630
  } else if (tech.technical === "harmonic") {
5664
5631
  const hasChildren = techNotation.harmonicNatural || techNotation.harmonicArtificial || techNotation.basePitch || techNotation.touchingPitch || techNotation.soundingPitch;
5665
5632
  if (hasChildren) {
5666
- lines.push(`${indent} <harmonic${placementAttr}>`);
5667
- if (techNotation.harmonicNatural) lines.push(`${indent} <natural/>`);
5668
- if (techNotation.harmonicArtificial) lines.push(`${indent} <artificial/>`);
5669
- if (techNotation.basePitch) lines.push(`${indent} <base-pitch/>`);
5670
- if (techNotation.touchingPitch) lines.push(`${indent} <touching-pitch/>`);
5671
- if (techNotation.soundingPitch) lines.push(`${indent} <sounding-pitch/>`);
5672
- lines.push(`${indent} </harmonic>`);
5633
+ out.push(`${indent} <harmonic${placementAttr}>`);
5634
+ if (techNotation.harmonicNatural) out.push(`${indent} <natural/>`);
5635
+ if (techNotation.harmonicArtificial) out.push(`${indent} <artificial/>`);
5636
+ if (techNotation.basePitch) out.push(`${indent} <base-pitch/>`);
5637
+ if (techNotation.touchingPitch) out.push(`${indent} <touching-pitch/>`);
5638
+ if (techNotation.soundingPitch) out.push(`${indent} <sounding-pitch/>`);
5639
+ out.push(`${indent} </harmonic>`);
5673
5640
  } else {
5674
- lines.push(`${indent} <harmonic${placementAttr}/>`);
5641
+ out.push(`${indent} <harmonic${placementAttr}/>`);
5675
5642
  }
5676
5643
  } else if (tech.technical === "hammer-on" || tech.technical === "pull-off") {
5677
5644
  let attrs = "";
@@ -5679,39 +5646,37 @@ function serializeTechnicalGroup(technicals, indent) {
5679
5646
  if (techNotation.startStop) attrs += ` type="${techNotation.startStop}"`;
5680
5647
  attrs += placementAttr;
5681
5648
  if (techNotation.text !== void 0) {
5682
- lines.push(`${indent} <${tech.technical}${attrs}>${escapeXml(techNotation.text)}</${tech.technical}>`);
5649
+ out.push(`${indent} <${tech.technical}${attrs}>${escapeXml(techNotation.text)}</${tech.technical}>`);
5683
5650
  } else {
5684
- lines.push(`${indent} <${tech.technical}${attrs}/>`);
5651
+ out.push(`${indent} <${tech.technical}${attrs}/>`);
5685
5652
  }
5686
5653
  } else if (tech.technical === "string" && techNotation.string !== void 0) {
5687
- lines.push(`${indent} <string${placementAttr}>${techNotation.string}</string>`);
5654
+ out.push(`${indent} <string${placementAttr}>${techNotation.string}</string>`);
5688
5655
  } else if (tech.technical === "fret" && techNotation.fret !== void 0) {
5689
- lines.push(`${indent} <fret${placementAttr}>${techNotation.fret}</fret>`);
5656
+ out.push(`${indent} <fret${placementAttr}>${techNotation.fret}</fret>`);
5690
5657
  } else if (tech.technical === "fingering") {
5691
5658
  let fAttrs = placementAttr;
5692
5659
  if (techNotation.fingeringSubstitution) fAttrs += ' substitution="yes"';
5693
5660
  if (techNotation.fingeringAlternate) fAttrs += ' alternate="yes"';
5694
5661
  if (techNotation.text !== void 0) {
5695
- lines.push(`${indent} <fingering${fAttrs}>${escapeXml(techNotation.text)}</fingering>`);
5662
+ out.push(`${indent} <fingering${fAttrs}>${escapeXml(techNotation.text)}</fingering>`);
5696
5663
  } else {
5697
- lines.push(`${indent} <fingering${fAttrs}/>`);
5664
+ out.push(`${indent} <fingering${fAttrs}/>`);
5698
5665
  }
5699
5666
  } else if (tech.technical === "heel" || tech.technical === "toe") {
5700
5667
  let htAttrs = placementAttr;
5701
5668
  if (techNotation.substitution) htAttrs += ' substitution="yes"';
5702
- lines.push(`${indent} <${tech.technical}${htAttrs}/>`);
5669
+ out.push(`${indent} <${tech.technical}${htAttrs}/>`);
5703
5670
  } else if (techNotation.text !== void 0) {
5704
- lines.push(`${indent} <${tech.technical}${placementAttr}>${escapeXml(techNotation.text)}</${tech.technical}>`);
5671
+ out.push(`${indent} <${tech.technical}${placementAttr}>${escapeXml(techNotation.text)}</${tech.technical}>`);
5705
5672
  } else {
5706
- lines.push(`${indent} <${tech.technical}${placementAttr}/>`);
5673
+ out.push(`${indent} <${tech.technical}${placementAttr}/>`);
5707
5674
  }
5708
5675
  }
5709
5676
  }
5710
- lines.push(`${indent} </technical>`);
5711
- return lines;
5677
+ out.push(`${indent} </technical>`);
5712
5678
  }
5713
- function serializeLyric(lyric, indent) {
5714
- const lines = [];
5679
+ function serializeLyric(lyric, indent, out) {
5715
5680
  let attrs = "";
5716
5681
  if (lyric.number) attrs += ` number="${lyric.number}"`;
5717
5682
  if (lyric.name) attrs += ` name="${escapeXml(lyric.name)}"`;
@@ -5719,78 +5684,72 @@ function serializeLyric(lyric, indent) {
5719
5684
  if (lyric.relativeX !== void 0) attrs += ` relative-x="${lyric.relativeX}"`;
5720
5685
  if (lyric.justify) attrs += ` justify="${escapeXml(lyric.justify)}"`;
5721
5686
  if (lyric.placement) attrs += ` placement="${lyric.placement}"`;
5722
- lines.push(`${indent}<lyric${attrs}>`);
5687
+ out.push(`${indent}<lyric${attrs}>`);
5723
5688
  if (lyric.textElements && lyric.textElements.length > 1) {
5724
5689
  for (let i = 0; i < lyric.textElements.length; i++) {
5725
5690
  const te = lyric.textElements[i];
5726
5691
  if (te.syllabic) {
5727
- lines.push(`${indent} <syllabic>${te.syllabic}</syllabic>`);
5692
+ out.push(`${indent} <syllabic>${te.syllabic}</syllabic>`);
5728
5693
  }
5729
- lines.push(`${indent} <text>${escapeXml(te.text)}</text>`);
5694
+ out.push(`${indent} <text>${escapeXml(te.text)}</text>`);
5730
5695
  if (i < lyric.textElements.length - 1) {
5731
- lines.push(`${indent} <elision/>`);
5696
+ out.push(`${indent} <elision/>`);
5732
5697
  }
5733
5698
  }
5734
5699
  } else if (lyric.syllabic || lyric.text) {
5735
5700
  if (lyric.syllabic) {
5736
- lines.push(`${indent} <syllabic>${lyric.syllabic}</syllabic>`);
5701
+ out.push(`${indent} <syllabic>${lyric.syllabic}</syllabic>`);
5737
5702
  }
5738
- lines.push(`${indent} <text>${escapeXml(lyric.text)}</text>`);
5703
+ out.push(`${indent} <text>${escapeXml(lyric.text)}</text>`);
5739
5704
  }
5740
5705
  if (lyric.extend) {
5741
5706
  if (typeof lyric.extend === "object" && lyric.extend.type) {
5742
- lines.push(`${indent} <extend type="${lyric.extend.type}"/>`);
5707
+ out.push(`${indent} <extend type="${lyric.extend.type}"/>`);
5743
5708
  } else {
5744
- lines.push(`${indent} <extend/>`);
5709
+ out.push(`${indent} <extend/>`);
5745
5710
  }
5746
5711
  }
5747
5712
  if (lyric.endLine) {
5748
- lines.push(`${indent} <end-line/>`);
5713
+ out.push(`${indent} <end-line/>`);
5749
5714
  }
5750
5715
  if (lyric.endParagraph) {
5751
- lines.push(`${indent} <end-paragraph/>`);
5716
+ out.push(`${indent} <end-paragraph/>`);
5752
5717
  }
5753
- lines.push(`${indent}</lyric>`);
5754
- return lines;
5718
+ out.push(`${indent}</lyric>`);
5755
5719
  }
5756
- function serializeBackup(backup, indent) {
5757
- return [
5758
- `${indent}<backup>`,
5759
- `${indent} <duration>${backup.duration}</duration>`,
5760
- `${indent}</backup>`
5761
- ];
5720
+ function serializeBackup(backup, indent, out) {
5721
+ out.push(`${indent}<backup>`);
5722
+ out.push(`${indent} <duration>${backup.duration}</duration>`);
5723
+ out.push(`${indent}</backup>`);
5762
5724
  }
5763
- function serializeForward(forward, indent) {
5764
- const lines = [];
5725
+ function serializeForward(forward, indent, out) {
5765
5726
  const idAttr = forward._id ? ` id="${escapeXml(forward._id)}"` : "";
5766
- lines.push(`${indent}<forward${idAttr}>`);
5767
- lines.push(`${indent} <duration>${forward.duration}</duration>`);
5727
+ out.push(`${indent}<forward${idAttr}>`);
5728
+ out.push(`${indent} <duration>${forward.duration}</duration>`);
5768
5729
  if (forward.voice !== void 0) {
5769
- lines.push(`${indent} <voice>${forward.voice}</voice>`);
5730
+ out.push(`${indent} <voice>${forward.voice}</voice>`);
5770
5731
  }
5771
5732
  if (forward.staff !== void 0) {
5772
- lines.push(`${indent} <staff>${forward.staff}</staff>`);
5733
+ out.push(`${indent} <staff>${forward.staff}</staff>`);
5773
5734
  }
5774
- lines.push(`${indent}</forward>`);
5775
- return lines;
5735
+ out.push(`${indent}</forward>`);
5776
5736
  }
5777
- function serializeDirection(direction, indent) {
5778
- const lines = [];
5737
+ function serializeDirection(direction, indent, out) {
5779
5738
  let attrs = "";
5780
5739
  if (direction._id) attrs += ` id="${escapeXml(direction._id)}"`;
5781
5740
  if (direction.placement) attrs += ` placement="${direction.placement}"`;
5782
5741
  if (direction.directive) attrs += ' directive="yes"';
5783
5742
  if (direction.system) attrs += ` system="${direction.system}"`;
5784
- lines.push(`${indent}<direction${attrs}>`);
5743
+ out.push(`${indent}<direction${attrs}>`);
5785
5744
  for (const dirType of direction.directionTypes) {
5786
- lines.push(...serializeDirectionType(dirType, indent + " "));
5745
+ serializeDirectionType(dirType, indent + " ", out);
5787
5746
  }
5788
5747
  if (direction.offset !== void 0) {
5789
5748
  const soundAttr = direction.offsetSound ? ' sound="yes"' : "";
5790
- lines.push(`${indent} <offset${soundAttr}>${direction.offset}</offset>`);
5749
+ out.push(`${indent} <offset${soundAttr}>${direction.offset}</offset>`);
5791
5750
  }
5792
5751
  if (direction.staff !== void 0) {
5793
- lines.push(`${indent} <staff>${direction.staff}</staff>`);
5752
+ out.push(`${indent} <staff>${direction.staff}</staff>`);
5794
5753
  }
5795
5754
  if (direction.sound) {
5796
5755
  const attrs2 = [];
@@ -5811,33 +5770,31 @@ function serializeDirection(direction, indent) {
5811
5770
  }
5812
5771
  const attrStr = attrs2.length > 0 ? ` ${attrs2.join(" ")}` : "";
5813
5772
  if (direction.sound.midiInstrument) {
5814
- lines.push(`${indent} <sound${attrStr}>`);
5773
+ out.push(`${indent} <sound${attrStr}>`);
5815
5774
  const midi = direction.sound.midiInstrument;
5816
- lines.push(`${indent} <midi-instrument id="${escapeXml(midi.id)}">`);
5775
+ out.push(`${indent} <midi-instrument id="${escapeXml(midi.id)}">`);
5817
5776
  if (midi.midiChannel !== void 0) {
5818
- lines.push(`${indent} <midi-channel>${midi.midiChannel}</midi-channel>`);
5777
+ out.push(`${indent} <midi-channel>${midi.midiChannel}</midi-channel>`);
5819
5778
  }
5820
5779
  if (midi.midiProgram !== void 0) {
5821
- lines.push(`${indent} <midi-program>${midi.midiProgram}</midi-program>`);
5780
+ out.push(`${indent} <midi-program>${midi.midiProgram}</midi-program>`);
5822
5781
  }
5823
5782
  if (midi.volume !== void 0) {
5824
- lines.push(`${indent} <volume>${midi.volume}</volume>`);
5783
+ out.push(`${indent} <volume>${midi.volume}</volume>`);
5825
5784
  }
5826
5785
  if (midi.pan !== void 0) {
5827
- lines.push(`${indent} <pan>${midi.pan}</pan>`);
5786
+ out.push(`${indent} <pan>${midi.pan}</pan>`);
5828
5787
  }
5829
- lines.push(`${indent} </midi-instrument>`);
5830
- lines.push(`${indent} </sound>`);
5788
+ out.push(`${indent} </midi-instrument>`);
5789
+ out.push(`${indent} </sound>`);
5831
5790
  } else if (attrs2.length > 0) {
5832
- lines.push(`${indent} <sound${attrStr}/>`);
5791
+ out.push(`${indent} <sound${attrStr}/>`);
5833
5792
  }
5834
5793
  }
5835
- lines.push(`${indent}</direction>`);
5836
- return lines;
5794
+ out.push(`${indent}</direction>`);
5837
5795
  }
5838
- function serializeDirectionType(dirType, indent) {
5839
- const lines = [];
5840
- lines.push(`${indent}<direction-type>`);
5796
+ function serializeDirectionType(dirType, indent, out) {
5797
+ out.push(`${indent}<direction-type>`);
5841
5798
  switch (dirType.kind) {
5842
5799
  case "dynamics": {
5843
5800
  let dynAttrs = "";
@@ -5845,14 +5802,14 @@ function serializeDirectionType(dirType, indent) {
5845
5802
  if (dirType.defaultY !== void 0) dynAttrs += ` default-y="${dirType.defaultY}"`;
5846
5803
  if (dirType.relativeX !== void 0) dynAttrs += ` relative-x="${dirType.relativeX}"`;
5847
5804
  if (dirType.halign) dynAttrs += ` halign="${dirType.halign}"`;
5848
- lines.push(`${indent} <dynamics${dynAttrs}>`);
5805
+ out.push(`${indent} <dynamics${dynAttrs}>`);
5849
5806
  if (dirType.value) {
5850
- lines.push(`${indent} <${dirType.value}/>`);
5807
+ out.push(`${indent} <${dirType.value}/>`);
5851
5808
  }
5852
5809
  if (dirType.otherDynamics) {
5853
- lines.push(`${indent} <other-dynamics>${escapeXml(dirType.otherDynamics)}</other-dynamics>`);
5810
+ out.push(`${indent} <other-dynamics>${escapeXml(dirType.otherDynamics)}</other-dynamics>`);
5854
5811
  }
5855
- lines.push(`${indent} </dynamics>`);
5812
+ out.push(`${indent} </dynamics>`);
5856
5813
  break;
5857
5814
  }
5858
5815
  case "wedge": {
@@ -5860,7 +5817,7 @@ function serializeDirectionType(dirType, indent) {
5860
5817
  if (dirType.spread !== void 0) wedgeAttrs += ` spread="${dirType.spread}"`;
5861
5818
  if (dirType.defaultY !== void 0) wedgeAttrs += ` default-y="${dirType.defaultY}"`;
5862
5819
  if (dirType.relativeX !== void 0) wedgeAttrs += ` relative-x="${dirType.relativeX}"`;
5863
- lines.push(`${indent} <wedge${wedgeAttrs}/>`);
5820
+ out.push(`${indent} <wedge${wedgeAttrs}/>`);
5864
5821
  break;
5865
5822
  }
5866
5823
  case "metronome": {
@@ -5870,21 +5827,21 @@ function serializeDirectionType(dirType, indent) {
5870
5827
  if (dirType.defaultY !== void 0) metAttrs += ` default-y="${dirType.defaultY}"`;
5871
5828
  if (dirType.fontFamily) metAttrs += ` font-family="${escapeXml(dirType.fontFamily)}"`;
5872
5829
  if (dirType.fontSize) metAttrs += ` font-size="${escapeXml(dirType.fontSize)}"`;
5873
- lines.push(`${indent} <metronome${metAttrs}>`);
5874
- lines.push(`${indent} <beat-unit>${dirType.beatUnit}</beat-unit>`);
5830
+ out.push(`${indent} <metronome${metAttrs}>`);
5831
+ out.push(`${indent} <beat-unit>${dirType.beatUnit}</beat-unit>`);
5875
5832
  if (dirType.beatUnitDot) {
5876
- lines.push(`${indent} <beat-unit-dot/>`);
5833
+ out.push(`${indent} <beat-unit-dot/>`);
5877
5834
  }
5878
5835
  if (dirType.beatUnit2) {
5879
- lines.push(`${indent} <beat-unit>${dirType.beatUnit2}</beat-unit>`);
5836
+ out.push(`${indent} <beat-unit>${dirType.beatUnit2}</beat-unit>`);
5880
5837
  if (dirType.beatUnitDot2) {
5881
- lines.push(`${indent} <beat-unit-dot/>`);
5838
+ out.push(`${indent} <beat-unit-dot/>`);
5882
5839
  }
5883
5840
  }
5884
5841
  if (dirType.perMinute !== void 0) {
5885
- lines.push(`${indent} <per-minute>${dirType.perMinute}</per-minute>`);
5842
+ out.push(`${indent} <per-minute>${dirType.perMinute}</per-minute>`);
5886
5843
  }
5887
- lines.push(`${indent} </metronome>`);
5844
+ out.push(`${indent} </metronome>`);
5888
5845
  break;
5889
5846
  }
5890
5847
  case "words": {
@@ -5902,7 +5859,7 @@ function serializeDirectionType(dirType, indent) {
5902
5859
  if (dirType.color) wordAttrs += ` color="${escapeXml(dirType.color)}"`;
5903
5860
  if (dirType.xmlSpace) wordAttrs += ` xml:space="${escapeXml(dirType.xmlSpace)}"`;
5904
5861
  if (dirType.halign) wordAttrs += ` halign="${escapeXml(dirType.halign)}"`;
5905
- lines.push(`${indent} <words${wordAttrs}>${escapeXml(dirType.text)}</words>`);
5862
+ out.push(`${indent} <words${wordAttrs}>${escapeXml(dirType.text)}</words>`);
5906
5863
  break;
5907
5864
  }
5908
5865
  case "rehearsal": {
@@ -5912,7 +5869,7 @@ function serializeDirectionType(dirType, indent) {
5912
5869
  if (dirType.defaultY !== void 0) rehAttrs += ` default-y="${dirType.defaultY}"`;
5913
5870
  if (dirType.fontSize) rehAttrs += ` font-size="${escapeXml(dirType.fontSize)}"`;
5914
5871
  if (dirType.fontWeight) rehAttrs += ` font-weight="${escapeXml(dirType.fontWeight)}"`;
5915
- lines.push(`${indent} <rehearsal${rehAttrs}>${escapeXml(dirType.text)}</rehearsal>`);
5872
+ out.push(`${indent} <rehearsal${rehAttrs}>${escapeXml(dirType.text)}</rehearsal>`);
5916
5873
  break;
5917
5874
  }
5918
5875
  case "bracket": {
@@ -5922,7 +5879,7 @@ function serializeDirectionType(dirType, indent) {
5922
5879
  if (dirType.lineType) bracketAttrs += ` line-type="${dirType.lineType}"`;
5923
5880
  if (dirType.defaultY !== void 0) bracketAttrs += ` default-y="${dirType.defaultY}"`;
5924
5881
  if (dirType.relativeX !== void 0) bracketAttrs += ` relative-x="${dirType.relativeX}"`;
5925
- lines.push(`${indent} <bracket${bracketAttrs}/>`);
5882
+ out.push(`${indent} <bracket${bracketAttrs}/>`);
5926
5883
  break;
5927
5884
  }
5928
5885
  case "dashes": {
@@ -5931,25 +5888,25 @@ function serializeDirectionType(dirType, indent) {
5931
5888
  if (dirType.dashLength !== void 0) dashAttrs += ` dash-length="${dirType.dashLength}"`;
5932
5889
  if (dirType.defaultY !== void 0) dashAttrs += ` default-y="${dirType.defaultY}"`;
5933
5890
  if (dirType.spaceLength !== void 0) dashAttrs += ` space-length="${dirType.spaceLength}"`;
5934
- lines.push(`${indent} <dashes${dashAttrs}/>`);
5891
+ out.push(`${indent} <dashes${dashAttrs}/>`);
5935
5892
  break;
5936
5893
  }
5937
5894
  case "accordion-registration":
5938
- lines.push(`${indent} <accordion-registration>`);
5895
+ out.push(`${indent} <accordion-registration>`);
5939
5896
  if (dirType.high) {
5940
- lines.push(`${indent} <accordion-high/>`);
5897
+ out.push(`${indent} <accordion-high/>`);
5941
5898
  }
5942
5899
  if (dirType.middlePresent || dirType.middle !== void 0) {
5943
5900
  if (dirType.middle !== void 0) {
5944
- lines.push(`${indent} <accordion-middle>${dirType.middle}</accordion-middle>`);
5901
+ out.push(`${indent} <accordion-middle>${dirType.middle}</accordion-middle>`);
5945
5902
  } else {
5946
- lines.push(`${indent} <accordion-middle/>`);
5903
+ out.push(`${indent} <accordion-middle/>`);
5947
5904
  }
5948
5905
  }
5949
5906
  if (dirType.low) {
5950
- lines.push(`${indent} <accordion-low/>`);
5907
+ out.push(`${indent} <accordion-low/>`);
5951
5908
  }
5952
- lines.push(`${indent} </accordion-registration>`);
5909
+ out.push(`${indent} </accordion-registration>`);
5953
5910
  break;
5954
5911
  case "other-direction":
5955
5912
  {
@@ -5958,60 +5915,60 @@ function serializeDirectionType(dirType, indent) {
5958
5915
  if (dirType.defaultY !== void 0) otherAttrs += ` default-y="${dirType.defaultY}"`;
5959
5916
  if (dirType.halign) otherAttrs += ` halign="${escapeXml(dirType.halign)}"`;
5960
5917
  if (dirType.printObject === false) otherAttrs += ' print-object="no"';
5961
- lines.push(`${indent} <other-direction${otherAttrs}>${escapeXml(dirType.text)}</other-direction>`);
5918
+ out.push(`${indent} <other-direction${otherAttrs}>${escapeXml(dirType.text)}</other-direction>`);
5962
5919
  }
5963
5920
  break;
5964
5921
  case "segno":
5965
- lines.push(`${indent} <segno/>`);
5922
+ out.push(`${indent} <segno/>`);
5966
5923
  break;
5967
5924
  case "coda":
5968
- lines.push(`${indent} <coda/>`);
5925
+ out.push(`${indent} <coda/>`);
5969
5926
  break;
5970
5927
  case "eyeglasses":
5971
- lines.push(`${indent} <eyeglasses/>`);
5928
+ out.push(`${indent} <eyeglasses/>`);
5972
5929
  break;
5973
5930
  case "damp":
5974
- lines.push(`${indent} <damp/>`);
5931
+ out.push(`${indent} <damp/>`);
5975
5932
  break;
5976
5933
  case "damp-all":
5977
- lines.push(`${indent} <damp-all/>`);
5934
+ out.push(`${indent} <damp-all/>`);
5978
5935
  break;
5979
5936
  case "scordatura":
5980
5937
  if (dirType.accords && dirType.accords.length > 0) {
5981
- lines.push(`${indent} <scordatura>`);
5938
+ out.push(`${indent} <scordatura>`);
5982
5939
  for (const accord of dirType.accords) {
5983
- lines.push(`${indent} <accord string="${accord.string}">`);
5984
- lines.push(`${indent} <tuning-step>${accord.tuningStep}</tuning-step>`);
5940
+ out.push(`${indent} <accord string="${accord.string}">`);
5941
+ out.push(`${indent} <tuning-step>${accord.tuningStep}</tuning-step>`);
5985
5942
  if (accord.tuningAlter !== void 0) {
5986
- lines.push(`${indent} <tuning-alter>${accord.tuningAlter}</tuning-alter>`);
5943
+ out.push(`${indent} <tuning-alter>${accord.tuningAlter}</tuning-alter>`);
5987
5944
  }
5988
- lines.push(`${indent} <tuning-octave>${accord.tuningOctave}</tuning-octave>`);
5989
- lines.push(`${indent} </accord>`);
5945
+ out.push(`${indent} <tuning-octave>${accord.tuningOctave}</tuning-octave>`);
5946
+ out.push(`${indent} </accord>`);
5990
5947
  }
5991
- lines.push(`${indent} </scordatura>`);
5948
+ out.push(`${indent} </scordatura>`);
5992
5949
  } else {
5993
- lines.push(`${indent} <scordatura/>`);
5950
+ out.push(`${indent} <scordatura/>`);
5994
5951
  }
5995
5952
  break;
5996
5953
  case "harp-pedals":
5997
5954
  if (dirType.pedalTunings && dirType.pedalTunings.length > 0) {
5998
- lines.push(`${indent} <harp-pedals>`);
5955
+ out.push(`${indent} <harp-pedals>`);
5999
5956
  for (const pt of dirType.pedalTunings) {
6000
- lines.push(`${indent} <pedal-tuning>`);
6001
- lines.push(`${indent} <pedal-step>${pt.pedalStep}</pedal-step>`);
6002
- lines.push(`${indent} <pedal-alter>${pt.pedalAlter}</pedal-alter>`);
6003
- lines.push(`${indent} </pedal-tuning>`);
5957
+ out.push(`${indent} <pedal-tuning>`);
5958
+ out.push(`${indent} <pedal-step>${pt.pedalStep}</pedal-step>`);
5959
+ out.push(`${indent} <pedal-alter>${pt.pedalAlter}</pedal-alter>`);
5960
+ out.push(`${indent} </pedal-tuning>`);
6004
5961
  }
6005
- lines.push(`${indent} </harp-pedals>`);
5962
+ out.push(`${indent} </harp-pedals>`);
6006
5963
  } else {
6007
- lines.push(`${indent} <harp-pedals/>`);
5964
+ out.push(`${indent} <harp-pedals/>`);
6008
5965
  }
6009
5966
  break;
6010
5967
  case "image":
6011
5968
  let imgAttrs = "";
6012
5969
  if (dirType.source) imgAttrs += ` source="${escapeXml(dirType.source)}"`;
6013
5970
  if (dirType.type) imgAttrs += ` type="${escapeXml(dirType.type)}"`;
6014
- lines.push(`${indent} <image${imgAttrs}/>`);
5971
+ out.push(`${indent} <image${imgAttrs}/>`);
6015
5972
  break;
6016
5973
  case "pedal": {
6017
5974
  let pedalAttrs = ` type="${dirType.type}"`;
@@ -6019,68 +5976,76 @@ function serializeDirectionType(dirType, indent) {
6019
5976
  if (dirType.defaultY !== void 0) pedalAttrs += ` default-y="${dirType.defaultY}"`;
6020
5977
  if (dirType.relativeX !== void 0) pedalAttrs += ` relative-x="${dirType.relativeX}"`;
6021
5978
  if (dirType.halign) pedalAttrs += ` halign="${dirType.halign}"`;
6022
- lines.push(`${indent} <pedal${pedalAttrs}/>`);
5979
+ out.push(`${indent} <pedal${pedalAttrs}/>`);
6023
5980
  break;
6024
5981
  }
6025
5982
  case "octave-shift": {
6026
5983
  const sizeAttr = dirType.size !== void 0 ? ` size="${dirType.size}"` : "";
6027
- lines.push(`${indent} <octave-shift type="${dirType.type}"${sizeAttr}/>`);
5984
+ out.push(`${indent} <octave-shift type="${dirType.type}"${sizeAttr}/>`);
6028
5985
  break;
6029
5986
  }
6030
5987
  case "swing":
6031
- lines.push(`${indent} <swing>`);
5988
+ out.push(`${indent} <swing>`);
6032
5989
  if (dirType.straight) {
6033
- lines.push(`${indent} <straight/>`);
5990
+ out.push(`${indent} <straight/>`);
6034
5991
  } else {
6035
5992
  if (dirType.first !== void 0) {
6036
- lines.push(`${indent} <first>${dirType.first}</first>`);
5993
+ out.push(`${indent} <first>${dirType.first}</first>`);
6037
5994
  }
6038
5995
  if (dirType.second !== void 0) {
6039
- lines.push(`${indent} <second>${dirType.second}</second>`);
5996
+ out.push(`${indent} <second>${dirType.second}</second>`);
6040
5997
  }
6041
5998
  if (dirType.swingType) {
6042
- lines.push(`${indent} <swing-type>${dirType.swingType}</swing-type>`);
5999
+ out.push(`${indent} <swing-type>${dirType.swingType}</swing-type>`);
6043
6000
  }
6044
6001
  }
6045
- lines.push(`${indent} </swing>`);
6002
+ out.push(`${indent} </swing>`);
6046
6003
  break;
6047
6004
  }
6048
- lines.push(`${indent}</direction-type>`);
6049
- return lines;
6005
+ out.push(`${indent}</direction-type>`);
6050
6006
  }
6051
- function serializeBarline(barline, indent) {
6052
- const lines = [];
6007
+ function serializeBarline(barline, indent, out) {
6053
6008
  let attrs = ` location="${barline.location}"`;
6054
6009
  if (barline._id) attrs += ` id="${escapeXml(barline._id)}"`;
6055
- lines.push(`${indent}<barline${attrs}>`);
6010
+ out.push(`${indent}<barline${attrs}>`);
6056
6011
  if (barline.barStyle) {
6057
- lines.push(`${indent} <bar-style>${barline.barStyle}</bar-style>`);
6012
+ out.push(`${indent} <bar-style>${barline.barStyle}</bar-style>`);
6058
6013
  }
6059
6014
  if (barline.ending) {
6060
6015
  let endingAttrs = ` number="${barline.ending.number}" type="${barline.ending.type}"`;
6061
6016
  if (barline.ending.defaultY !== void 0) endingAttrs += ` default-y="${barline.ending.defaultY}"`;
6062
6017
  if (barline.ending.endLength !== void 0) endingAttrs += ` end-length="${barline.ending.endLength}"`;
6063
6018
  if (barline.ending.text) {
6064
- lines.push(`${indent} <ending${endingAttrs}>${escapeXml(barline.ending.text)}</ending>`);
6019
+ out.push(`${indent} <ending${endingAttrs}>${escapeXml(barline.ending.text)}</ending>`);
6065
6020
  } else {
6066
- lines.push(`${indent} <ending${endingAttrs}/>`);
6021
+ out.push(`${indent} <ending${endingAttrs}/>`);
6067
6022
  }
6068
6023
  }
6069
6024
  if (barline.repeat) {
6070
6025
  let repeatAttrs = ` direction="${barline.repeat.direction}"`;
6071
6026
  if (barline.repeat.times !== void 0) repeatAttrs += ` times="${barline.repeat.times}"`;
6072
6027
  if (barline.repeat.winged) repeatAttrs += ` winged="${barline.repeat.winged}"`;
6073
- lines.push(`${indent} <repeat${repeatAttrs}/>`);
6028
+ out.push(`${indent} <repeat${repeatAttrs}/>`);
6074
6029
  }
6075
- lines.push(`${indent}</barline>`);
6076
- return lines;
6030
+ out.push(`${indent}</barline>`);
6077
6031
  }
6032
+ var XML_ESCAPE_RE = /[&<>"']/g;
6033
+ var XML_ESCAPE_MAP = {
6034
+ "&": "&amp;",
6035
+ "<": "&lt;",
6036
+ ">": "&gt;",
6037
+ '"': "&quot;",
6038
+ "'": "&apos;"
6039
+ };
6040
+ var XML_ESCAPE_TEST = /[&<>"']/;
6078
6041
  function escapeXml(str) {
6079
- return str.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;");
6042
+ if (!XML_ESCAPE_TEST.test(str)) return str;
6043
+ return str.replace(XML_ESCAPE_RE, (ch) => XML_ESCAPE_MAP[ch]);
6080
6044
  }
6081
6045
  function buildAttrs(attrs) {
6082
6046
  let result = "";
6083
- for (const [key, value] of Object.entries(attrs)) {
6047
+ for (const key in attrs) {
6048
+ const value = attrs[key];
6084
6049
  if (value === void 0) continue;
6085
6050
  if (typeof value === "boolean") {
6086
6051
  result += ` ${key}="${value ? "yes" : "no"}"`;
@@ -6098,48 +6063,45 @@ function pushOptionalElement(lines, indent, tag, value) {
6098
6063
  lines.push(`${indent}<${tag}>${escaped}</${tag}>`);
6099
6064
  }
6100
6065
  }
6101
- function serializeStaffDetails(sd, indent) {
6102
- const lines = [];
6066
+ function serializeStaffDetails(sd, indent, out) {
6103
6067
  const attrs = buildAttrs({
6104
6068
  "number": sd.number,
6105
6069
  "show-frets": sd.showFrets,
6106
6070
  "print-object": sd.printObject,
6107
6071
  "print-spacing": sd.printSpacing
6108
6072
  });
6109
- lines.push(`${indent}<staff-details${attrs}>`);
6110
- pushOptionalElement(lines, `${indent} `, "staff-type", sd.staffType);
6111
- pushOptionalElement(lines, `${indent} `, "staff-lines", sd.staffLines);
6073
+ out.push(`${indent}<staff-details${attrs}>`);
6074
+ pushOptionalElement(out, `${indent} `, "staff-type", sd.staffType);
6075
+ pushOptionalElement(out, `${indent} `, "staff-lines", sd.staffLines);
6112
6076
  if (sd.staffTuning) {
6113
6077
  for (const tuning of sd.staffTuning) {
6114
- lines.push(`${indent} <staff-tuning${buildAttrs({ line: tuning.line })}>`);
6115
- lines.push(`${indent} <tuning-step>${tuning.tuningStep}</tuning-step>`);
6116
- pushOptionalElement(lines, `${indent} `, "tuning-alter", tuning.tuningAlter);
6117
- lines.push(`${indent} <tuning-octave>${tuning.tuningOctave}</tuning-octave>`);
6118
- lines.push(`${indent} </staff-tuning>`);
6078
+ out.push(`${indent} <staff-tuning${buildAttrs({ line: tuning.line })}>`);
6079
+ out.push(`${indent} <tuning-step>${tuning.tuningStep}</tuning-step>`);
6080
+ pushOptionalElement(out, `${indent} `, "tuning-alter", tuning.tuningAlter);
6081
+ out.push(`${indent} <tuning-octave>${tuning.tuningOctave}</tuning-octave>`);
6082
+ out.push(`${indent} </staff-tuning>`);
6119
6083
  }
6120
6084
  }
6121
- pushOptionalElement(lines, `${indent} `, "capo", sd.capo);
6085
+ pushOptionalElement(out, `${indent} `, "capo", sd.capo);
6122
6086
  if (sd.staffSize !== void 0) {
6123
6087
  const attrs2 = buildAttrs({ scaling: sd.staffSizeScaling });
6124
- lines.push(`${indent} <staff-size${attrs2}>${sd.staffSize}</staff-size>`);
6088
+ out.push(`${indent} <staff-size${attrs2}>${sd.staffSize}</staff-size>`);
6125
6089
  }
6126
- lines.push(`${indent}</staff-details>`);
6127
- return lines;
6090
+ out.push(`${indent}</staff-details>`);
6128
6091
  }
6129
- function serializeMeasureStyle(ms, indent) {
6130
- const lines = [];
6131
- lines.push(`${indent}<measure-style${buildAttrs({ number: ms.number })}>`);
6132
- pushOptionalElement(lines, `${indent} `, "multiple-rest", ms.multipleRest);
6092
+ function serializeMeasureStyle(ms, indent, out) {
6093
+ out.push(`${indent}<measure-style${buildAttrs({ number: ms.number })}>`);
6094
+ pushOptionalElement(out, `${indent} `, "multiple-rest", ms.multipleRest);
6133
6095
  if (ms.measureRepeat) {
6134
6096
  const mrAttrs = buildAttrs({
6135
6097
  type: ms.measureRepeat.type,
6136
6098
  slashes: ms.measureRepeat.slashes
6137
6099
  });
6138
- lines.push(`${indent} <measure-repeat${mrAttrs}/>`);
6100
+ out.push(`${indent} <measure-repeat${mrAttrs}/>`);
6139
6101
  }
6140
6102
  if (ms.beatRepeat) {
6141
6103
  const brAttrs = buildAttrs({ type: ms.beatRepeat.type, slashes: ms.beatRepeat.slashes });
6142
- lines.push(`${indent} <beat-repeat${brAttrs}/>`);
6104
+ out.push(`${indent} <beat-repeat${brAttrs}/>`);
6143
6105
  }
6144
6106
  if (ms.slash) {
6145
6107
  const slAttrs = buildAttrs({
@@ -6147,13 +6109,11 @@ function serializeMeasureStyle(ms, indent) {
6147
6109
  "use-dots": ms.slash.useDots,
6148
6110
  "use-stems": ms.slash.useStems
6149
6111
  });
6150
- lines.push(`${indent} <slash${slAttrs}/>`);
6112
+ out.push(`${indent} <slash${slAttrs}/>`);
6151
6113
  }
6152
- lines.push(`${indent}</measure-style>`);
6153
- return lines;
6114
+ out.push(`${indent}</measure-style>`);
6154
6115
  }
6155
- function serializeHarmony(harmony, indent) {
6156
- const lines = [];
6116
+ function serializeHarmony(harmony, indent, out) {
6157
6117
  const attrs = buildAttrs({
6158
6118
  id: harmony._id,
6159
6119
  placement: harmony.placement,
@@ -6162,114 +6122,110 @@ function serializeHarmony(harmony, indent) {
6162
6122
  halign: harmony.halign,
6163
6123
  "font-size": harmony.fontSize
6164
6124
  });
6165
- lines.push(`${indent}<harmony${attrs}>`);
6166
- lines.push(`${indent} <root>`);
6167
- lines.push(`${indent} <root-step>${harmony.root.rootStep}</root-step>`);
6125
+ out.push(`${indent}<harmony${attrs}>`);
6126
+ out.push(`${indent} <root>`);
6127
+ out.push(`${indent} <root-step>${harmony.root.rootStep}</root-step>`);
6168
6128
  if (harmony.root.rootAlter !== void 0) {
6169
- lines.push(`${indent} <root-alter>${harmony.root.rootAlter}</root-alter>`);
6129
+ out.push(`${indent} <root-alter>${harmony.root.rootAlter}</root-alter>`);
6170
6130
  }
6171
- lines.push(`${indent} </root>`);
6131
+ out.push(`${indent} </root>`);
6172
6132
  let kindAttrs = "";
6173
6133
  if (harmony.kindText !== void 0) kindAttrs += ` text="${escapeXml(harmony.kindText)}"`;
6174
6134
  if (harmony.kindHalign) kindAttrs += ` halign="${escapeXml(harmony.kindHalign)}"`;
6175
- lines.push(`${indent} <kind${kindAttrs}>${escapeXml(harmony.kind)}</kind>`);
6135
+ out.push(`${indent} <kind${kindAttrs}>${escapeXml(harmony.kind)}</kind>`);
6176
6136
  if (harmony.bass) {
6177
6137
  let bassAttrs = "";
6178
6138
  if (harmony.bass.arrangement) bassAttrs += ` arrangement="${escapeXml(harmony.bass.arrangement)}"`;
6179
- lines.push(`${indent} <bass${bassAttrs}>`);
6180
- lines.push(`${indent} <bass-step>${harmony.bass.bassStep}</bass-step>`);
6139
+ out.push(`${indent} <bass${bassAttrs}>`);
6140
+ out.push(`${indent} <bass-step>${harmony.bass.bassStep}</bass-step>`);
6181
6141
  if (harmony.bass.bassAlter !== void 0) {
6182
- lines.push(`${indent} <bass-alter>${harmony.bass.bassAlter}</bass-alter>`);
6142
+ out.push(`${indent} <bass-alter>${harmony.bass.bassAlter}</bass-alter>`);
6183
6143
  }
6184
- lines.push(`${indent} </bass>`);
6144
+ out.push(`${indent} </bass>`);
6185
6145
  }
6186
6146
  if (harmony.inversion !== void 0) {
6187
- lines.push(`${indent} <inversion>${harmony.inversion}</inversion>`);
6147
+ out.push(`${indent} <inversion>${harmony.inversion}</inversion>`);
6188
6148
  }
6189
6149
  if (harmony.degrees) {
6190
6150
  for (const deg of harmony.degrees) {
6191
- lines.push(`${indent} <degree>`);
6192
- lines.push(`${indent} <degree-value>${deg.degreeValue}</degree-value>`);
6151
+ out.push(`${indent} <degree>`);
6152
+ out.push(`${indent} <degree-value>${deg.degreeValue}</degree-value>`);
6193
6153
  if (deg.degreeAlter !== void 0) {
6194
- lines.push(`${indent} <degree-alter>${deg.degreeAlter}</degree-alter>`);
6154
+ out.push(`${indent} <degree-alter>${deg.degreeAlter}</degree-alter>`);
6195
6155
  }
6196
- lines.push(`${indent} <degree-type>${deg.degreeType}</degree-type>`);
6197
- lines.push(`${indent} </degree>`);
6156
+ out.push(`${indent} <degree-type>${deg.degreeType}</degree-type>`);
6157
+ out.push(`${indent} </degree>`);
6198
6158
  }
6199
6159
  }
6200
6160
  if (harmony.frame) {
6201
- lines.push(`${indent} <frame>`);
6161
+ out.push(`${indent} <frame>`);
6202
6162
  if (harmony.frame.frameStrings !== void 0) {
6203
- lines.push(`${indent} <frame-strings>${harmony.frame.frameStrings}</frame-strings>`);
6163
+ out.push(`${indent} <frame-strings>${harmony.frame.frameStrings}</frame-strings>`);
6204
6164
  }
6205
6165
  if (harmony.frame.frameFrets !== void 0) {
6206
- lines.push(`${indent} <frame-frets>${harmony.frame.frameFrets}</frame-frets>`);
6166
+ out.push(`${indent} <frame-frets>${harmony.frame.frameFrets}</frame-frets>`);
6207
6167
  }
6208
6168
  if (harmony.frame.firstFret !== void 0) {
6209
6169
  let ffAttrs = "";
6210
6170
  if (harmony.frame.firstFretText) ffAttrs += ` text="${escapeXml(harmony.frame.firstFretText)}"`;
6211
6171
  if (harmony.frame.firstFretLocation) ffAttrs += ` location="${harmony.frame.firstFretLocation}"`;
6212
- lines.push(`${indent} <first-fret${ffAttrs}>${harmony.frame.firstFret}</first-fret>`);
6172
+ out.push(`${indent} <first-fret${ffAttrs}>${harmony.frame.firstFret}</first-fret>`);
6213
6173
  }
6214
6174
  if (harmony.frame.frameNotes) {
6215
6175
  for (const fn of harmony.frame.frameNotes) {
6216
- lines.push(`${indent} <frame-note>`);
6217
- lines.push(`${indent} <string>${fn.string}</string>`);
6218
- lines.push(`${indent} <fret>${fn.fret}</fret>`);
6176
+ out.push(`${indent} <frame-note>`);
6177
+ out.push(`${indent} <string>${fn.string}</string>`);
6178
+ out.push(`${indent} <fret>${fn.fret}</fret>`);
6219
6179
  if (fn.fingering) {
6220
- lines.push(`${indent} <fingering>${escapeXml(fn.fingering)}</fingering>`);
6180
+ out.push(`${indent} <fingering>${escapeXml(fn.fingering)}</fingering>`);
6221
6181
  }
6222
6182
  if (fn.barre) {
6223
- lines.push(`${indent} <barre type="${fn.barre}"/>`);
6183
+ out.push(`${indent} <barre type="${fn.barre}"/>`);
6224
6184
  }
6225
- lines.push(`${indent} </frame-note>`);
6185
+ out.push(`${indent} </frame-note>`);
6226
6186
  }
6227
6187
  }
6228
- lines.push(`${indent} </frame>`);
6188
+ out.push(`${indent} </frame>`);
6229
6189
  }
6230
6190
  if (harmony.offset !== void 0) {
6231
- lines.push(`${indent} <offset>${harmony.offset}</offset>`);
6191
+ out.push(`${indent} <offset>${harmony.offset}</offset>`);
6232
6192
  }
6233
6193
  if (harmony.staff !== void 0) {
6234
- lines.push(`${indent} <staff>${harmony.staff}</staff>`);
6194
+ out.push(`${indent} <staff>${harmony.staff}</staff>`);
6235
6195
  }
6236
- lines.push(`${indent}</harmony>`);
6237
- return lines;
6196
+ out.push(`${indent}</harmony>`);
6238
6197
  }
6239
- function serializeFiguredBass(fb, indent) {
6240
- const lines = [];
6198
+ function serializeFiguredBass(fb, indent, out) {
6241
6199
  let attrs = "";
6242
6200
  if (fb._id) attrs += ` id="${escapeXml(fb._id)}"`;
6243
6201
  if (fb.parentheses) attrs += ' parentheses="yes"';
6244
- lines.push(`${indent}<figured-bass${attrs}>`);
6202
+ out.push(`${indent}<figured-bass${attrs}>`);
6245
6203
  for (const fig of fb.figures) {
6246
- lines.push(`${indent} <figure>`);
6204
+ out.push(`${indent} <figure>`);
6247
6205
  if (fig.prefix) {
6248
- lines.push(`${indent} <prefix>${escapeXml(fig.prefix)}</prefix>`);
6206
+ out.push(`${indent} <prefix>${escapeXml(fig.prefix)}</prefix>`);
6249
6207
  }
6250
6208
  if (fig.figureNumber) {
6251
- lines.push(`${indent} <figure-number>${escapeXml(fig.figureNumber)}</figure-number>`);
6209
+ out.push(`${indent} <figure-number>${escapeXml(fig.figureNumber)}</figure-number>`);
6252
6210
  }
6253
6211
  if (fig.suffix) {
6254
- lines.push(`${indent} <suffix>${escapeXml(fig.suffix)}</suffix>`);
6212
+ out.push(`${indent} <suffix>${escapeXml(fig.suffix)}</suffix>`);
6255
6213
  }
6256
6214
  if (fig.extend) {
6257
6215
  if (typeof fig.extend === "object" && fig.extend.type) {
6258
- lines.push(`${indent} <extend type="${fig.extend.type}"/>`);
6216
+ out.push(`${indent} <extend type="${fig.extend.type}"/>`);
6259
6217
  } else {
6260
- lines.push(`${indent} <extend/>`);
6218
+ out.push(`${indent} <extend/>`);
6261
6219
  }
6262
6220
  }
6263
- lines.push(`${indent} </figure>`);
6221
+ out.push(`${indent} </figure>`);
6264
6222
  }
6265
6223
  if (fb.duration !== void 0) {
6266
- lines.push(`${indent} <duration>${fb.duration}</duration>`);
6224
+ out.push(`${indent} <duration>${fb.duration}</duration>`);
6267
6225
  }
6268
- lines.push(`${indent}</figured-bass>`);
6269
- return lines;
6226
+ out.push(`${indent}</figured-bass>`);
6270
6227
  }
6271
- function serializeSound(sound, indent) {
6272
- const lines = [];
6228
+ function serializeSound(sound, indent, out) {
6273
6229
  const attrs = [];
6274
6230
  if (sound._id) attrs.push(`id="${escapeXml(sound._id)}"`);
6275
6231
  if (sound.tempo !== void 0) attrs.push(`tempo="${sound.tempo}"`);
@@ -6286,29 +6242,28 @@ function serializeSound(sound, indent) {
6286
6242
  if (sound.sostenutoPedal) attrs.push(`sostenuto-pedal="${sound.sostenutoPedal === true ? "yes" : sound.sostenutoPedal}"`);
6287
6243
  const attrStr = attrs.length > 0 ? ` ${attrs.join(" ")}` : "";
6288
6244
  if (sound.swing) {
6289
- lines.push(`${indent}<sound${attrStr}>`);
6290
- lines.push(`${indent} <swing>`);
6245
+ out.push(`${indent}<sound${attrStr}>`);
6246
+ out.push(`${indent} <swing>`);
6291
6247
  if (sound.swing.straight) {
6292
- lines.push(`${indent} <straight/>`);
6248
+ out.push(`${indent} <straight/>`);
6293
6249
  } else {
6294
6250
  if (sound.swing.first !== void 0) {
6295
- lines.push(`${indent} <first>${sound.swing.first}</first>`);
6251
+ out.push(`${indent} <first>${sound.swing.first}</first>`);
6296
6252
  }
6297
6253
  if (sound.swing.second !== void 0) {
6298
- lines.push(`${indent} <second>${sound.swing.second}</second>`);
6254
+ out.push(`${indent} <second>${sound.swing.second}</second>`);
6299
6255
  }
6300
6256
  if (sound.swing.swingType) {
6301
- lines.push(`${indent} <swing-type>${sound.swing.swingType}</swing-type>`);
6257
+ out.push(`${indent} <swing-type>${sound.swing.swingType}</swing-type>`);
6302
6258
  }
6303
6259
  }
6304
- lines.push(`${indent} </swing>`);
6305
- lines.push(`${indent}</sound>`);
6260
+ out.push(`${indent} </swing>`);
6261
+ out.push(`${indent}</sound>`);
6306
6262
  } else if (attrs.length === 0 && !sound._id) {
6307
- lines.push(`${indent}<sound/>`);
6263
+ out.push(`${indent}<sound/>`);
6308
6264
  } else {
6309
- lines.push(`${indent}<sound${attrStr}/>`);
6265
+ out.push(`${indent}<sound${attrStr}/>`);
6310
6266
  }
6311
- return lines;
6312
6267
  }
6313
6268
 
6314
6269
  // src/exporters/musicxml-compressed.ts
@@ -8194,4 +8149,4 @@ async function serializeToFile(score, filePath, options = {}) {
8194
8149
 
8195
8150
 
8196
8151
 
8197
- exports.STEPS = _chunkVE2KCZMAjs.STEPS; exports.STEP_SEMITONES = _chunkVE2KCZMAjs.STEP_SEMITONES; exports.ValidationException = _chunkKABVHR2Pjs.ValidationException; exports.addArticulation = _chunkKABVHR2Pjs.addArticulation; exports.addBeam = _chunkKABVHR2Pjs.addBeam; exports.addBowing = _chunkKABVHR2Pjs.addBowing; exports.addBreathMark = _chunkKABVHR2Pjs.addBreathMark; exports.addCaesura = _chunkKABVHR2Pjs.addCaesura; exports.addChord = _chunkKABVHR2Pjs.addChord; exports.addChordNote = _chunkKABVHR2Pjs.addChordNote; exports.addChordNoteChecked = _chunkKABVHR2Pjs.addChordNoteChecked; exports.addChordSymbol = _chunkKABVHR2Pjs.addChordSymbol; exports.addCoda = _chunkKABVHR2Pjs.addCoda; exports.addDaCapo = _chunkKABVHR2Pjs.addDaCapo; exports.addDalSegno = _chunkKABVHR2Pjs.addDalSegno; exports.addDynamics = _chunkKABVHR2Pjs.addDynamics; exports.addEnding = _chunkKABVHR2Pjs.addEnding; exports.addFermata = _chunkKABVHR2Pjs.addFermata; exports.addFine = _chunkKABVHR2Pjs.addFine; exports.addFingering = _chunkKABVHR2Pjs.addFingering; exports.addGraceNote = _chunkKABVHR2Pjs.addGraceNote; exports.addHarmony = _chunkKABVHR2Pjs.addHarmony; exports.addLyric = _chunkKABVHR2Pjs.addLyric; exports.addNote = _chunkKABVHR2Pjs.addNote; exports.addNoteChecked = _chunkKABVHR2Pjs.addNoteChecked; exports.addOctaveShift = _chunkKABVHR2Pjs.addOctaveShift; exports.addOrnament = _chunkKABVHR2Pjs.addOrnament; exports.addPart = _chunkKABVHR2Pjs.addPart; exports.addPedal = _chunkKABVHR2Pjs.addPedal; exports.addRehearsalMark = _chunkKABVHR2Pjs.addRehearsalMark; exports.addRepeat = _chunkKABVHR2Pjs.addRepeat; exports.addRepeatBarline = _chunkKABVHR2Pjs.addRepeatBarline; exports.addSegno = _chunkKABVHR2Pjs.addSegno; exports.addSlur = _chunkKABVHR2Pjs.addSlur; exports.addStringNumber = _chunkKABVHR2Pjs.addStringNumber; exports.addTempo = _chunkKABVHR2Pjs.addTempo; exports.addText = _chunkKABVHR2Pjs.addText; exports.addTextDirection = _chunkKABVHR2Pjs.addTextDirection; exports.addTie = _chunkKABVHR2Pjs.addTie; exports.addToCoda = _chunkKABVHR2Pjs.addToCoda; exports.addVoice = _chunkKABVHR2Pjs.addVoice; exports.addWedge = _chunkKABVHR2Pjs.addWedge; exports.assertMeasureValid = _chunkKABVHR2Pjs.assertMeasureValid; exports.assertValid = _chunkKABVHR2Pjs.assertValid; exports.autoBeam = _chunkKABVHR2Pjs.autoBeam; exports.buildVoiceToStaffMap = _chunkVE2KCZMAjs.buildVoiceToStaffMap; exports.buildVoiceToStaffMapForPart = _chunkVE2KCZMAjs.buildVoiceToStaffMapForPart; exports.changeBarline = _chunkKABVHR2Pjs.changeBarline; exports.changeClef = _chunkKABVHR2Pjs.changeClef; exports.changeKey = _chunkKABVHR2Pjs.changeKey; exports.changeNoteDuration = _chunkKABVHR2Pjs.changeNoteDuration; exports.changeTime = _chunkKABVHR2Pjs.changeTime; exports.convertToGrace = _chunkKABVHR2Pjs.convertToGrace; exports.copyNotes = _chunkKABVHR2Pjs.copyNotes; exports.copyNotesMultiMeasure = _chunkKABVHR2Pjs.copyNotesMultiMeasure; exports.countNotes = _chunkVE2KCZMAjs.countNotes; exports.createTuplet = _chunkKABVHR2Pjs.createTuplet; exports.cutNotes = _chunkKABVHR2Pjs.cutNotes; exports.decodeBuffer = decodeBuffer; exports.deleteMeasure = _chunkKABVHR2Pjs.deleteMeasure; exports.deleteNote = _chunkKABVHR2Pjs.deleteNote; exports.deleteNoteChecked = _chunkKABVHR2Pjs.deleteNoteChecked; exports.duplicatePart = _chunkKABVHR2Pjs.duplicatePart; exports.exportMidi = exportMidi; exports.findBarlines = _chunkVE2KCZMAjs.findBarlines; exports.findDirectionsByType = _chunkVE2KCZMAjs.findDirectionsByType; exports.findNotes = _chunkVE2KCZMAjs.findNotes; exports.findNotesWithNotation = _chunkVE2KCZMAjs.findNotesWithNotation; exports.formatLocation = _chunkKABVHR2Pjs.formatLocation; exports.generateId = _chunkKABVHR2Pjs.generateId; exports.getAbsolutePosition = _chunkVE2KCZMAjs.getAbsolutePosition; exports.getAdjacentNotes = _chunkVE2KCZMAjs.getAdjacentNotes; exports.getAllNotes = _chunkVE2KCZMAjs.getAllNotes; exports.getAllPartInfos = getAllPartInfos; exports.getAttributesAtMeasure = _chunkVE2KCZMAjs.getAttributesAtMeasure; exports.getBeamGroups = _chunkVE2KCZMAjs.getBeamGroups; exports.getChordProgression = _chunkVE2KCZMAjs.getChordProgression; exports.getChords = _chunkVE2KCZMAjs.getChords; exports.getClefChanges = _chunkVE2KCZMAjs.getClefChanges; exports.getClefForStaff = _chunkVE2KCZMAjs.getClefForStaff; exports.getDirectionOfKind = getDirectionOfKind; exports.getDirections = _chunkVE2KCZMAjs.getDirections; exports.getDirectionsAtPosition = _chunkVE2KCZMAjs.getDirectionsAtPosition; exports.getDirectionsOfKind = getDirectionsOfKind; exports.getDivisions = _chunkVE2KCZMAjs.getDivisions; exports.getDuration = _chunkVE2KCZMAjs.getDuration; exports.getDynamics = _chunkVE2KCZMAjs.getDynamics; exports.getEffectiveStaff = _chunkVE2KCZMAjs.getEffectiveStaff; exports.getEndings = _chunkVE2KCZMAjs.getEndings; exports.getEntriesAtPosition = _chunkVE2KCZMAjs.getEntriesAtPosition; exports.getEntriesForStaff = _chunkVE2KCZMAjs.getEntriesForStaff; exports.getEntriesInRange = _chunkVE2KCZMAjs.getEntriesInRange; exports.getHarmonies = _chunkVE2KCZMAjs.getHarmonies; exports.getHarmonyAtPosition = _chunkVE2KCZMAjs.getHarmonyAtPosition; exports.getKeyChanges = _chunkVE2KCZMAjs.getKeyChanges; exports.getLyricText = _chunkVE2KCZMAjs.getLyricText; exports.getLyrics = _chunkVE2KCZMAjs.getLyrics; exports.getMeasure = _chunkVE2KCZMAjs.getMeasure; exports.getMeasureByIndex = _chunkVE2KCZMAjs.getMeasureByIndex; exports.getMeasureContext = _chunkKABVHR2Pjs.getMeasureContext; exports.getMeasureCount = _chunkVE2KCZMAjs.getMeasureCount; exports.getMeasureEndPosition = _chunkVE2KCZMAjs.getMeasureEndPosition; exports.getNextNote = _chunkVE2KCZMAjs.getNextNote; exports.getNormalizedDuration = _chunkVE2KCZMAjs.getNormalizedDuration; exports.getNormalizedPosition = _chunkVE2KCZMAjs.getNormalizedPosition; exports.getNotesAtPosition = _chunkVE2KCZMAjs.getNotesAtPosition; exports.getNotesForStaff = _chunkVE2KCZMAjs.getNotesForStaff; exports.getNotesForVoice = _chunkVE2KCZMAjs.getNotesForVoice; exports.getNotesInRange = _chunkVE2KCZMAjs.getNotesInRange; exports.getOctaveShifts = _chunkVE2KCZMAjs.getOctaveShifts; exports.getPartAbbreviation = getPartAbbreviation; exports.getPartById = _chunkVE2KCZMAjs.getPartById; exports.getPartByIndex = _chunkVE2KCZMAjs.getPartByIndex; exports.getPartCount = _chunkVE2KCZMAjs.getPartCount; exports.getPartIds = _chunkVE2KCZMAjs.getPartIds; exports.getPartIndex = _chunkVE2KCZMAjs.getPartIndex; exports.getPartInfo = getPartInfo; exports.getPartName = getPartName; exports.getPartNameMap = getPartNameMap; exports.getPedalMarkings = _chunkVE2KCZMAjs.getPedalMarkings; exports.getPrevNote = _chunkVE2KCZMAjs.getPrevNote; exports.getRepeatStructure = _chunkVE2KCZMAjs.getRepeatStructure; exports.getSlurSpans = _chunkVE2KCZMAjs.getSlurSpans; exports.getSoundDamperPedal = getSoundDamperPedal; exports.getSoundDynamics = getSoundDynamics; exports.getSoundSoftPedal = getSoundSoftPedal; exports.getSoundSostenutoPedal = getSoundSostenutoPedal; exports.getSoundTempo = getSoundTempo; exports.getStaffRange = _chunkVE2KCZMAjs.getStaffRange; exports.getStaveCount = _chunkVE2KCZMAjs.getStaveCount; exports.getStaves = _chunkVE2KCZMAjs.getStaves; exports.getStructuralChanges = _chunkVE2KCZMAjs.getStructuralChanges; exports.getTempoMarkings = _chunkVE2KCZMAjs.getTempoMarkings; exports.getTiedNoteGroups = _chunkVE2KCZMAjs.getTiedNoteGroups; exports.getTimeChanges = _chunkVE2KCZMAjs.getTimeChanges; exports.getTupletGroups = _chunkVE2KCZMAjs.getTupletGroups; exports.getVerseCount = _chunkVE2KCZMAjs.getVerseCount; exports.getVerticalSlice = _chunkVE2KCZMAjs.getVerticalSlice; exports.getVoiceLine = _chunkVE2KCZMAjs.getVoiceLine; exports.getVoiceLineInRange = _chunkVE2KCZMAjs.getVoiceLineInRange; exports.getVoices = _chunkVE2KCZMAjs.getVoices; exports.getVoicesForStaff = _chunkVE2KCZMAjs.getVoicesForStaff; exports.getWedges = _chunkVE2KCZMAjs.getWedges; exports.groupByStaff = _chunkVE2KCZMAjs.groupByStaff; exports.groupByVoice = _chunkVE2KCZMAjs.groupByVoice; exports.hasBeam = hasBeam; exports.hasDirectionOfKind = hasDirectionOfKind; exports.hasLyrics = hasLyrics; exports.hasMultipleStaves = _chunkVE2KCZMAjs.hasMultipleStaves; exports.hasNotations = hasNotations; exports.hasNotes = _chunkVE2KCZMAjs.hasNotes; exports.hasTie = hasTie; exports.hasTieStart = hasTieStart; exports.hasTieStop = hasTieStop; exports.hasTuplet = hasTuplet; exports.inferStaff = _chunkVE2KCZMAjs.inferStaff; exports.insertClefChange = _chunkKABVHR2Pjs.insertClefChange; exports.insertMeasure = _chunkKABVHR2Pjs.insertMeasure; exports.insertNote = _chunkKABVHR2Pjs.insertNote; exports.isChordNote = isChordNote; exports.isCompressed = isCompressed; exports.isCueNote = isCueNote; exports.isGraceNote = isGraceNote; exports.isPartInfo = isPartInfo; exports.isPitchedNote = isPitchedNote; exports.isRest = isRest; exports.isRestMeasure = _chunkVE2KCZMAjs.isRestMeasure; exports.isUnpitchedNote = isUnpitchedNote; exports.isValid = _chunkKABVHR2Pjs.isValid; exports.iterateEntries = _chunkVE2KCZMAjs.iterateEntries; exports.iterateNotes = _chunkVE2KCZMAjs.iterateNotes; exports.lowerAccidental = _chunkKABVHR2Pjs.lowerAccidental; exports.measureRoundtrip = _chunkVE2KCZMAjs.measureRoundtrip; exports.modifyDynamics = _chunkKABVHR2Pjs.modifyDynamics; exports.modifyNoteDuration = _chunkKABVHR2Pjs.modifyNoteDuration; exports.modifyNoteDurationChecked = _chunkKABVHR2Pjs.modifyNoteDurationChecked; exports.modifyNotePitch = _chunkKABVHR2Pjs.modifyNotePitch; exports.modifyNotePitchChecked = _chunkKABVHR2Pjs.modifyNotePitchChecked; exports.modifyTempo = _chunkKABVHR2Pjs.modifyTempo; exports.moveNoteToStaff = _chunkKABVHR2Pjs.moveNoteToStaff; exports.parse = parse; exports.parseAbc = parseAbc; exports.parseAuto = parseAuto; exports.parseCompressed = parseCompressed; exports.parseFile = parseFile; exports.pasteNotes = _chunkKABVHR2Pjs.pasteNotes; exports.pasteNotesMultiMeasure = _chunkKABVHR2Pjs.pasteNotesMultiMeasure; exports.pitchToSemitone = _chunkVE2KCZMAjs.pitchToSemitone; exports.raiseAccidental = _chunkKABVHR2Pjs.raiseAccidental; exports.removeArticulation = _chunkKABVHR2Pjs.removeArticulation; exports.removeBeam = _chunkKABVHR2Pjs.removeBeam; exports.removeBowing = _chunkKABVHR2Pjs.removeBowing; exports.removeBreathMark = _chunkKABVHR2Pjs.removeBreathMark; exports.removeCaesura = _chunkKABVHR2Pjs.removeCaesura; exports.removeChordSymbol = _chunkKABVHR2Pjs.removeChordSymbol; exports.removeDynamics = _chunkKABVHR2Pjs.removeDynamics; exports.removeEnding = _chunkKABVHR2Pjs.removeEnding; exports.removeFermata = _chunkKABVHR2Pjs.removeFermata; exports.removeFingering = _chunkKABVHR2Pjs.removeFingering; exports.removeGraceNote = _chunkKABVHR2Pjs.removeGraceNote; exports.removeHarmony = _chunkKABVHR2Pjs.removeHarmony; exports.removeLyric = _chunkKABVHR2Pjs.removeLyric; exports.removeNote = _chunkKABVHR2Pjs.removeNote; exports.removeOctaveShift = _chunkKABVHR2Pjs.removeOctaveShift; exports.removeOrnament = _chunkKABVHR2Pjs.removeOrnament; exports.removePart = _chunkKABVHR2Pjs.removePart; exports.removePedal = _chunkKABVHR2Pjs.removePedal; exports.removeRepeat = _chunkKABVHR2Pjs.removeRepeat; exports.removeRepeatBarline = _chunkKABVHR2Pjs.removeRepeatBarline; exports.removeSlur = _chunkKABVHR2Pjs.removeSlur; exports.removeStringNumber = _chunkKABVHR2Pjs.removeStringNumber; exports.removeTempo = _chunkKABVHR2Pjs.removeTempo; exports.removeTie = _chunkKABVHR2Pjs.removeTie; exports.removeTuplet = _chunkKABVHR2Pjs.removeTuplet; exports.removeWedge = _chunkKABVHR2Pjs.removeWedge; exports.scoresEqual = _chunkVE2KCZMAjs.scoresEqual; exports.serialize = serialize; exports.serializeAbc = serializeAbc; exports.serializeCompressed = serializeCompressed; exports.serializeToFile = serializeToFile; exports.setBarline = _chunkKABVHR2Pjs.setBarline; exports.setBeaming = _chunkKABVHR2Pjs.setBeaming; exports.setNotePitch = _chunkKABVHR2Pjs.setNotePitch; exports.setNotePitchBySemitone = _chunkKABVHR2Pjs.setNotePitchBySemitone; exports.setStaves = _chunkKABVHR2Pjs.setStaves; exports.shiftNotePitch = _chunkKABVHR2Pjs.shiftNotePitch; exports.stopOctaveShift = _chunkKABVHR2Pjs.stopOctaveShift; exports.transpose = _chunkKABVHR2Pjs.transpose; exports.transposeChecked = _chunkKABVHR2Pjs.transposeChecked; exports.updateChordSymbol = _chunkKABVHR2Pjs.updateChordSymbol; exports.updateHarmony = _chunkKABVHR2Pjs.updateHarmony; exports.updateLyric = _chunkKABVHR2Pjs.updateLyric; exports.validate = _chunkKABVHR2Pjs.validate; exports.validateBackupForward = _chunkKABVHR2Pjs.validateBackupForward; exports.validateBeams = _chunkKABVHR2Pjs.validateBeams; exports.validateDivisions = _chunkKABVHR2Pjs.validateDivisions; exports.validateMeasureDuration = _chunkKABVHR2Pjs.validateMeasureDuration; exports.validateMeasureLocal = _chunkKABVHR2Pjs.validateMeasureLocal; exports.validatePartReferences = _chunkKABVHR2Pjs.validatePartReferences; exports.validatePartStructure = _chunkKABVHR2Pjs.validatePartStructure; exports.validateSlurs = _chunkKABVHR2Pjs.validateSlurs; exports.validateSlursAcrossMeasures = _chunkKABVHR2Pjs.validateSlursAcrossMeasures; exports.validateStaffStructure = _chunkKABVHR2Pjs.validateStaffStructure; exports.validateTies = _chunkKABVHR2Pjs.validateTies; exports.validateTiesAcrossMeasures = _chunkKABVHR2Pjs.validateTiesAcrossMeasures; exports.validateTuplets = _chunkKABVHR2Pjs.validateTuplets; exports.validateVoiceStaff = _chunkKABVHR2Pjs.validateVoiceStaff; exports.withAbsolutePositions = _chunkVE2KCZMAjs.withAbsolutePositions;
8152
+ exports.STEPS = _chunkVE2KCZMAjs.STEPS; exports.STEP_SEMITONES = _chunkVE2KCZMAjs.STEP_SEMITONES; exports.ValidationException = _chunkTBGS7OISjs.ValidationException; exports.addArticulation = _chunkTBGS7OISjs.addArticulation; exports.addBeam = _chunkTBGS7OISjs.addBeam; exports.addBowing = _chunkTBGS7OISjs.addBowing; exports.addBreathMark = _chunkTBGS7OISjs.addBreathMark; exports.addCaesura = _chunkTBGS7OISjs.addCaesura; exports.addChord = _chunkTBGS7OISjs.addChord; exports.addChordNote = _chunkTBGS7OISjs.addChordNote; exports.addChordNoteChecked = _chunkTBGS7OISjs.addChordNoteChecked; exports.addChordSymbol = _chunkTBGS7OISjs.addChordSymbol; exports.addCoda = _chunkTBGS7OISjs.addCoda; exports.addDaCapo = _chunkTBGS7OISjs.addDaCapo; exports.addDalSegno = _chunkTBGS7OISjs.addDalSegno; exports.addDynamics = _chunkTBGS7OISjs.addDynamics; exports.addEnding = _chunkTBGS7OISjs.addEnding; exports.addFermata = _chunkTBGS7OISjs.addFermata; exports.addFine = _chunkTBGS7OISjs.addFine; exports.addFingering = _chunkTBGS7OISjs.addFingering; exports.addGraceNote = _chunkTBGS7OISjs.addGraceNote; exports.addHarmony = _chunkTBGS7OISjs.addHarmony; exports.addLyric = _chunkTBGS7OISjs.addLyric; exports.addNote = _chunkTBGS7OISjs.addNote; exports.addNoteChecked = _chunkTBGS7OISjs.addNoteChecked; exports.addOctaveShift = _chunkTBGS7OISjs.addOctaveShift; exports.addOrnament = _chunkTBGS7OISjs.addOrnament; exports.addPart = _chunkTBGS7OISjs.addPart; exports.addPedal = _chunkTBGS7OISjs.addPedal; exports.addRehearsalMark = _chunkTBGS7OISjs.addRehearsalMark; exports.addRepeat = _chunkTBGS7OISjs.addRepeat; exports.addRepeatBarline = _chunkTBGS7OISjs.addRepeatBarline; exports.addSegno = _chunkTBGS7OISjs.addSegno; exports.addSlur = _chunkTBGS7OISjs.addSlur; exports.addStringNumber = _chunkTBGS7OISjs.addStringNumber; exports.addTempo = _chunkTBGS7OISjs.addTempo; exports.addText = _chunkTBGS7OISjs.addText; exports.addTextDirection = _chunkTBGS7OISjs.addTextDirection; exports.addTie = _chunkTBGS7OISjs.addTie; exports.addToCoda = _chunkTBGS7OISjs.addToCoda; exports.addVoice = _chunkTBGS7OISjs.addVoice; exports.addWedge = _chunkTBGS7OISjs.addWedge; exports.assertMeasureValid = _chunkTBGS7OISjs.assertMeasureValid; exports.assertValid = _chunkTBGS7OISjs.assertValid; exports.autoBeam = _chunkTBGS7OISjs.autoBeam; exports.buildVoiceToStaffMap = _chunkVE2KCZMAjs.buildVoiceToStaffMap; exports.buildVoiceToStaffMapForPart = _chunkVE2KCZMAjs.buildVoiceToStaffMapForPart; exports.changeBarline = _chunkTBGS7OISjs.changeBarline; exports.changeClef = _chunkTBGS7OISjs.changeClef; exports.changeKey = _chunkTBGS7OISjs.changeKey; exports.changeNoteDuration = _chunkTBGS7OISjs.changeNoteDuration; exports.changeTime = _chunkTBGS7OISjs.changeTime; exports.convertToGrace = _chunkTBGS7OISjs.convertToGrace; exports.copyNotes = _chunkTBGS7OISjs.copyNotes; exports.copyNotesMultiMeasure = _chunkTBGS7OISjs.copyNotesMultiMeasure; exports.countNotes = _chunkVE2KCZMAjs.countNotes; exports.createTuplet = _chunkTBGS7OISjs.createTuplet; exports.cutNotes = _chunkTBGS7OISjs.cutNotes; exports.decodeBuffer = decodeBuffer; exports.deleteMeasure = _chunkTBGS7OISjs.deleteMeasure; exports.deleteNote = _chunkTBGS7OISjs.deleteNote; exports.deleteNoteChecked = _chunkTBGS7OISjs.deleteNoteChecked; exports.duplicatePart = _chunkTBGS7OISjs.duplicatePart; exports.exportMidi = exportMidi; exports.findBarlines = _chunkVE2KCZMAjs.findBarlines; exports.findDirectionsByType = _chunkVE2KCZMAjs.findDirectionsByType; exports.findNotes = _chunkVE2KCZMAjs.findNotes; exports.findNotesWithNotation = _chunkVE2KCZMAjs.findNotesWithNotation; exports.formatLocation = _chunkTBGS7OISjs.formatLocation; exports.generateId = _chunkTBGS7OISjs.generateId; exports.getAbsolutePosition = _chunkVE2KCZMAjs.getAbsolutePosition; exports.getAdjacentNotes = _chunkVE2KCZMAjs.getAdjacentNotes; exports.getAllNotes = _chunkVE2KCZMAjs.getAllNotes; exports.getAllPartInfos = getAllPartInfos; exports.getAttributesAtMeasure = _chunkVE2KCZMAjs.getAttributesAtMeasure; exports.getBeamGroups = _chunkVE2KCZMAjs.getBeamGroups; exports.getChordProgression = _chunkVE2KCZMAjs.getChordProgression; exports.getChords = _chunkVE2KCZMAjs.getChords; exports.getClefChanges = _chunkVE2KCZMAjs.getClefChanges; exports.getClefForStaff = _chunkVE2KCZMAjs.getClefForStaff; exports.getDirectionOfKind = getDirectionOfKind; exports.getDirections = _chunkVE2KCZMAjs.getDirections; exports.getDirectionsAtPosition = _chunkVE2KCZMAjs.getDirectionsAtPosition; exports.getDirectionsOfKind = getDirectionsOfKind; exports.getDivisions = _chunkVE2KCZMAjs.getDivisions; exports.getDuration = _chunkVE2KCZMAjs.getDuration; exports.getDynamics = _chunkVE2KCZMAjs.getDynamics; exports.getEffectiveStaff = _chunkVE2KCZMAjs.getEffectiveStaff; exports.getEndings = _chunkVE2KCZMAjs.getEndings; exports.getEntriesAtPosition = _chunkVE2KCZMAjs.getEntriesAtPosition; exports.getEntriesForStaff = _chunkVE2KCZMAjs.getEntriesForStaff; exports.getEntriesInRange = _chunkVE2KCZMAjs.getEntriesInRange; exports.getHarmonies = _chunkVE2KCZMAjs.getHarmonies; exports.getHarmonyAtPosition = _chunkVE2KCZMAjs.getHarmonyAtPosition; exports.getKeyChanges = _chunkVE2KCZMAjs.getKeyChanges; exports.getLyricText = _chunkVE2KCZMAjs.getLyricText; exports.getLyrics = _chunkVE2KCZMAjs.getLyrics; exports.getMeasure = _chunkVE2KCZMAjs.getMeasure; exports.getMeasureByIndex = _chunkVE2KCZMAjs.getMeasureByIndex; exports.getMeasureContext = _chunkTBGS7OISjs.getMeasureContext; exports.getMeasureCount = _chunkVE2KCZMAjs.getMeasureCount; exports.getMeasureEndPosition = _chunkVE2KCZMAjs.getMeasureEndPosition; exports.getNextNote = _chunkVE2KCZMAjs.getNextNote; exports.getNormalizedDuration = _chunkVE2KCZMAjs.getNormalizedDuration; exports.getNormalizedPosition = _chunkVE2KCZMAjs.getNormalizedPosition; exports.getNotesAtPosition = _chunkVE2KCZMAjs.getNotesAtPosition; exports.getNotesForStaff = _chunkVE2KCZMAjs.getNotesForStaff; exports.getNotesForVoice = _chunkVE2KCZMAjs.getNotesForVoice; exports.getNotesInRange = _chunkVE2KCZMAjs.getNotesInRange; exports.getOctaveShifts = _chunkVE2KCZMAjs.getOctaveShifts; exports.getPartAbbreviation = getPartAbbreviation; exports.getPartById = _chunkVE2KCZMAjs.getPartById; exports.getPartByIndex = _chunkVE2KCZMAjs.getPartByIndex; exports.getPartCount = _chunkVE2KCZMAjs.getPartCount; exports.getPartIds = _chunkVE2KCZMAjs.getPartIds; exports.getPartIndex = _chunkVE2KCZMAjs.getPartIndex; exports.getPartInfo = getPartInfo; exports.getPartName = getPartName; exports.getPartNameMap = getPartNameMap; exports.getPedalMarkings = _chunkVE2KCZMAjs.getPedalMarkings; exports.getPrevNote = _chunkVE2KCZMAjs.getPrevNote; exports.getRepeatStructure = _chunkVE2KCZMAjs.getRepeatStructure; exports.getSlurSpans = _chunkVE2KCZMAjs.getSlurSpans; exports.getSoundDamperPedal = getSoundDamperPedal; exports.getSoundDynamics = getSoundDynamics; exports.getSoundSoftPedal = getSoundSoftPedal; exports.getSoundSostenutoPedal = getSoundSostenutoPedal; exports.getSoundTempo = getSoundTempo; exports.getStaffRange = _chunkVE2KCZMAjs.getStaffRange; exports.getStaveCount = _chunkVE2KCZMAjs.getStaveCount; exports.getStaves = _chunkVE2KCZMAjs.getStaves; exports.getStructuralChanges = _chunkVE2KCZMAjs.getStructuralChanges; exports.getTempoMarkings = _chunkVE2KCZMAjs.getTempoMarkings; exports.getTiedNoteGroups = _chunkVE2KCZMAjs.getTiedNoteGroups; exports.getTimeChanges = _chunkVE2KCZMAjs.getTimeChanges; exports.getTupletGroups = _chunkVE2KCZMAjs.getTupletGroups; exports.getVerseCount = _chunkVE2KCZMAjs.getVerseCount; exports.getVerticalSlice = _chunkVE2KCZMAjs.getVerticalSlice; exports.getVoiceLine = _chunkVE2KCZMAjs.getVoiceLine; exports.getVoiceLineInRange = _chunkVE2KCZMAjs.getVoiceLineInRange; exports.getVoices = _chunkVE2KCZMAjs.getVoices; exports.getVoicesForStaff = _chunkVE2KCZMAjs.getVoicesForStaff; exports.getWedges = _chunkVE2KCZMAjs.getWedges; exports.groupByStaff = _chunkVE2KCZMAjs.groupByStaff; exports.groupByVoice = _chunkVE2KCZMAjs.groupByVoice; exports.hasBeam = hasBeam; exports.hasDirectionOfKind = hasDirectionOfKind; exports.hasLyrics = hasLyrics; exports.hasMultipleStaves = _chunkVE2KCZMAjs.hasMultipleStaves; exports.hasNotations = hasNotations; exports.hasNotes = _chunkVE2KCZMAjs.hasNotes; exports.hasTie = hasTie; exports.hasTieStart = hasTieStart; exports.hasTieStop = hasTieStop; exports.hasTuplet = hasTuplet; exports.inferStaff = _chunkVE2KCZMAjs.inferStaff; exports.insertClefChange = _chunkTBGS7OISjs.insertClefChange; exports.insertMeasure = _chunkTBGS7OISjs.insertMeasure; exports.insertNote = _chunkTBGS7OISjs.insertNote; exports.isChordNote = isChordNote; exports.isCompressed = isCompressed; exports.isCueNote = isCueNote; exports.isGraceNote = isGraceNote; exports.isPartInfo = isPartInfo; exports.isPitchedNote = isPitchedNote; exports.isRest = isRest; exports.isRestMeasure = _chunkVE2KCZMAjs.isRestMeasure; exports.isUnpitchedNote = isUnpitchedNote; exports.isValid = _chunkTBGS7OISjs.isValid; exports.iterateEntries = _chunkVE2KCZMAjs.iterateEntries; exports.iterateNotes = _chunkVE2KCZMAjs.iterateNotes; exports.lowerAccidental = _chunkTBGS7OISjs.lowerAccidental; exports.measureRoundtrip = _chunkVE2KCZMAjs.measureRoundtrip; exports.modifyDynamics = _chunkTBGS7OISjs.modifyDynamics; exports.modifyNoteDuration = _chunkTBGS7OISjs.modifyNoteDuration; exports.modifyNoteDurationChecked = _chunkTBGS7OISjs.modifyNoteDurationChecked; exports.modifyNotePitch = _chunkTBGS7OISjs.modifyNotePitch; exports.modifyNotePitchChecked = _chunkTBGS7OISjs.modifyNotePitchChecked; exports.modifyTempo = _chunkTBGS7OISjs.modifyTempo; exports.moveNoteToStaff = _chunkTBGS7OISjs.moveNoteToStaff; exports.parse = parse; exports.parseAbc = parseAbc; exports.parseAuto = parseAuto; exports.parseCompressed = parseCompressed; exports.parseFile = parseFile; exports.pasteNotes = _chunkTBGS7OISjs.pasteNotes; exports.pasteNotesMultiMeasure = _chunkTBGS7OISjs.pasteNotesMultiMeasure; exports.pitchToSemitone = _chunkVE2KCZMAjs.pitchToSemitone; exports.raiseAccidental = _chunkTBGS7OISjs.raiseAccidental; exports.removeArticulation = _chunkTBGS7OISjs.removeArticulation; exports.removeBeam = _chunkTBGS7OISjs.removeBeam; exports.removeBowing = _chunkTBGS7OISjs.removeBowing; exports.removeBreathMark = _chunkTBGS7OISjs.removeBreathMark; exports.removeCaesura = _chunkTBGS7OISjs.removeCaesura; exports.removeChordSymbol = _chunkTBGS7OISjs.removeChordSymbol; exports.removeDynamics = _chunkTBGS7OISjs.removeDynamics; exports.removeEnding = _chunkTBGS7OISjs.removeEnding; exports.removeFermata = _chunkTBGS7OISjs.removeFermata; exports.removeFingering = _chunkTBGS7OISjs.removeFingering; exports.removeGraceNote = _chunkTBGS7OISjs.removeGraceNote; exports.removeHarmony = _chunkTBGS7OISjs.removeHarmony; exports.removeLyric = _chunkTBGS7OISjs.removeLyric; exports.removeNote = _chunkTBGS7OISjs.removeNote; exports.removeOctaveShift = _chunkTBGS7OISjs.removeOctaveShift; exports.removeOrnament = _chunkTBGS7OISjs.removeOrnament; exports.removePart = _chunkTBGS7OISjs.removePart; exports.removePedal = _chunkTBGS7OISjs.removePedal; exports.removeRepeat = _chunkTBGS7OISjs.removeRepeat; exports.removeRepeatBarline = _chunkTBGS7OISjs.removeRepeatBarline; exports.removeSlur = _chunkTBGS7OISjs.removeSlur; exports.removeStringNumber = _chunkTBGS7OISjs.removeStringNumber; exports.removeTempo = _chunkTBGS7OISjs.removeTempo; exports.removeTie = _chunkTBGS7OISjs.removeTie; exports.removeTuplet = _chunkTBGS7OISjs.removeTuplet; exports.removeWedge = _chunkTBGS7OISjs.removeWedge; exports.scoresEqual = _chunkVE2KCZMAjs.scoresEqual; exports.serialize = serialize; exports.serializeAbc = serializeAbc; exports.serializeCompressed = serializeCompressed; exports.serializeToFile = serializeToFile; exports.setBarline = _chunkTBGS7OISjs.setBarline; exports.setBeaming = _chunkTBGS7OISjs.setBeaming; exports.setNotePitch = _chunkTBGS7OISjs.setNotePitch; exports.setNotePitchBySemitone = _chunkTBGS7OISjs.setNotePitchBySemitone; exports.setStaves = _chunkTBGS7OISjs.setStaves; exports.shiftNotePitch = _chunkTBGS7OISjs.shiftNotePitch; exports.stopOctaveShift = _chunkTBGS7OISjs.stopOctaveShift; exports.transpose = _chunkTBGS7OISjs.transpose; exports.transposeChecked = _chunkTBGS7OISjs.transposeChecked; exports.updateChordSymbol = _chunkTBGS7OISjs.updateChordSymbol; exports.updateHarmony = _chunkTBGS7OISjs.updateHarmony; exports.updateLyric = _chunkTBGS7OISjs.updateLyric; exports.validate = _chunkTBGS7OISjs.validate; exports.validateBackupForward = _chunkTBGS7OISjs.validateBackupForward; exports.validateBeams = _chunkTBGS7OISjs.validateBeams; exports.validateDivisions = _chunkTBGS7OISjs.validateDivisions; exports.validateMeasureDuration = _chunkTBGS7OISjs.validateMeasureDuration; exports.validateMeasureLocal = _chunkTBGS7OISjs.validateMeasureLocal; exports.validatePartReferences = _chunkTBGS7OISjs.validatePartReferences; exports.validatePartStructure = _chunkTBGS7OISjs.validatePartStructure; exports.validateSlurs = _chunkTBGS7OISjs.validateSlurs; exports.validateSlursAcrossMeasures = _chunkTBGS7OISjs.validateSlursAcrossMeasures; exports.validateStaffStructure = _chunkTBGS7OISjs.validateStaffStructure; exports.validateTies = _chunkTBGS7OISjs.validateTies; exports.validateTiesAcrossMeasures = _chunkTBGS7OISjs.validateTiesAcrossMeasures; exports.validateTuplets = _chunkTBGS7OISjs.validateTuplets; exports.validateVoiceStaff = _chunkTBGS7OISjs.validateVoiceStaff; exports.withAbsolutePositions = _chunkVE2KCZMAjs.withAbsolutePositions;