@tspro/web-music-score 5.4.0 → 5.4.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.
Files changed (46) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/LICENSE +1 -1
  3. package/README.md +4 -4
  4. package/dist/audio/index.d.mts +1 -1
  5. package/dist/audio/index.d.ts +1 -1
  6. package/dist/audio/index.js +1 -1
  7. package/dist/audio/index.mjs +3 -3
  8. package/dist/audio-cg/index.js +1 -1
  9. package/dist/audio-cg/index.mjs +3 -3
  10. package/dist/audio-synth/index.js +1 -1
  11. package/dist/audio-synth/index.mjs +3 -3
  12. package/dist/{chunk-MHDBTCVG.mjs → chunk-42IBAVOC.mjs} +3 -3
  13. package/dist/{chunk-QGMOI7AP.mjs → chunk-CVYTUTL6.mjs} +2 -2
  14. package/dist/{chunk-ZWUBO5EW.mjs → chunk-MMWSQGVR.mjs} +3 -3
  15. package/dist/{chunk-AUT4C6TY.mjs → chunk-ROBXPR34.mjs} +2 -2
  16. package/dist/core/index.js +2 -2
  17. package/dist/core/index.mjs +4 -4
  18. package/dist/{guitar-CarHGDAt.d.ts → guitar-CNOxM4ZK.d.ts} +1 -1
  19. package/dist/{guitar-DXlB-9vK.d.mts → guitar-DK18GZ6h.d.mts} +1 -1
  20. package/dist/iife/audio-cg.global.js +1 -1
  21. package/dist/iife/index.global.js +11 -11
  22. package/dist/{music-objects-ONIuVUgs.d.mts → music-objects-DqoO-Sfv.d.mts} +100 -45
  23. package/dist/{music-objects-3Esbz7ij.d.ts → music-objects-T8u8bnNP.d.ts} +100 -45
  24. package/dist/pieces/index.d.mts +3 -3
  25. package/dist/pieces/index.d.ts +3 -3
  26. package/dist/pieces/index.js +1 -1
  27. package/dist/pieces/index.mjs +2 -2
  28. package/dist/react-ui/index.d.mts +5 -5
  29. package/dist/react-ui/index.d.ts +5 -5
  30. package/dist/react-ui/index.js +1 -1
  31. package/dist/react-ui/index.mjs +2 -2
  32. package/dist/{scale-DulPFco_.d.ts → scale-CUYFBo-8.d.ts} +2 -2
  33. package/dist/{scale-C8gHC448.d.mts → scale-DWM4RQco.d.mts} +2 -2
  34. package/dist/score/index.d.mts +5 -5
  35. package/dist/score/index.d.ts +5 -5
  36. package/dist/score/index.js +743 -512
  37. package/dist/score/index.mjs +639 -409
  38. package/dist/{tempo-BlCGZuYg.d.mts → tempo-Cxu8vusu.d.mts} +1 -1
  39. package/dist/{tempo-BnUjm25M.d.ts → tempo-DwuZsv2T.d.ts} +1 -1
  40. package/dist/theory/index.d.mts +6 -6
  41. package/dist/theory/index.d.ts +6 -6
  42. package/dist/theory/index.js +1 -1
  43. package/dist/theory/index.mjs +3 -3
  44. package/package.json +2 -1
  45. /package/dist/{note-CJuq5aBy.d.ts → note-CJuq5aBy.d.mts} +0 -0
  46. /package/dist/{note-RVXvpfyV.d.mts → note-RVXvpfyV.d.ts} +0 -0
@@ -1,4 +1,4 @@
1
- /* WebMusicScore v5.4.0 | (c) 2023 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
1
+ /* WebMusicScore v5.4.2 | (c) 2023-2025 PahkaSoft | MIT License | Includes: Tone.js (MIT License) */
2
2
  "use strict";
3
3
  var __create = Object.create;
4
4
  var __defProp = Object.defineProperty;
@@ -66,13 +66,14 @@ __export(score_exports, {
66
66
  MRest: () => MRest,
67
67
  MRhythmColumn: () => MRhythmColumn,
68
68
  MScoreRow: () => MScoreRow,
69
+ MScoreRowGroup: () => MScoreRowGroup,
69
70
  MSpecialText: () => MSpecialText,
70
71
  MStaff: () => MStaff,
72
+ MStaffBarLine: () => MStaffBarLine,
71
73
  MStaffBeamGroup: () => MStaffBeamGroup,
72
74
  MStaffNoteGroup: () => MStaffNoteGroup,
73
75
  MStaffRest: () => MStaffRest,
74
76
  MStaffSignature: () => MStaffSignature,
75
- MStaffTabBarLine: () => MStaffTabBarLine,
76
77
  MTab: () => MTab,
77
78
  MTabNoteGroup: () => MTabNoteGroup,
78
79
  MTabRhythm: () => MTabRhythm,
@@ -425,7 +426,7 @@ var DivRect = class _DivRect {
425
426
  };
426
427
 
427
428
  // src/score/pub/document-builder.ts
428
- var import_ts_utils_lib32 = require("@tspro/ts-utils-lib");
429
+ var import_ts_utils_lib33 = require("@tspro/ts-utils-lib");
429
430
 
430
431
  // src/score/pub/types.ts
431
432
  var import_ts_utils_lib2 = require("@tspro/ts-utils-lib");
@@ -657,13 +658,52 @@ var MusicObject = class {
657
658
  }
658
659
  updateRect() {
659
660
  }
661
+ forceRectUpdate() {
662
+ this.needRectUpdate = true;
663
+ this.updateRect();
664
+ this.needRectUpdate = false;
665
+ }
660
666
  getRect() {
661
- if (this.needRectUpdate) {
662
- this.updateRect();
663
- this.needRectUpdate = false;
664
- }
667
+ if (this.needRectUpdate)
668
+ this.forceRectUpdate();
665
669
  return this.rect;
666
670
  }
671
+ offsetX(dx) {
672
+ this.offset(dx, 0);
673
+ }
674
+ offsetY(dy) {
675
+ this.offset(0, dy);
676
+ }
677
+ setLeft(x) {
678
+ this.offset(x - this.getRect().left, 0);
679
+ }
680
+ setRight(x) {
681
+ this.offset(x - this.getRect().right, 0);
682
+ }
683
+ setTop(y) {
684
+ this.offset(0, y - this.getRect().top);
685
+ }
686
+ setBottom(y) {
687
+ this.offset(0, y - this.getRect().bottom);
688
+ }
689
+ setAnchor(x, y) {
690
+ this.offset(x - this.getRect().anchorX, y - this.getRect().anchorY);
691
+ }
692
+ setAnchorX(x) {
693
+ this.offset(x - this.getRect().anchorX, 0);
694
+ }
695
+ setAnchorY(y) {
696
+ this.offset(0, y - this.getRect().anchorY);
697
+ }
698
+ setCenter(x, y) {
699
+ this.offset(x - this.getRect().centerX, y - this.getRect().centerY);
700
+ }
701
+ setCenterX(x) {
702
+ this.offset(x - this.getRect().centerX, 0);
703
+ }
704
+ setCenterY(y) {
705
+ this.offset(0, y - this.getRect().centerY);
706
+ }
667
707
  /**
668
708
  * Most objects are simple rects in shape.
669
709
  * Some objects might be more complex consisting of multiple rects.
@@ -707,7 +747,9 @@ var DebugSettings = {
707
747
  };
708
748
  var DocumentSettings = {
709
749
  DocumentScale: 1,
710
- DocumentMinWidth: 75,
750
+ MinStaffWidth: 75,
751
+ MinColumnsWidth: 10,
752
+ ColumnWidthScale: 1.7,
711
753
  PostMeasureBreakWidth: 10,
712
754
  NoteDotSpace: 0.5,
713
755
  NoteAccSpace: 0.5,
@@ -1514,63 +1556,103 @@ var RenderContext = class {
1514
1556
  }
1515
1557
  }
1516
1558
  arc(x, y, radius, startRadians, endRadians) {
1517
- var _a;
1518
- (_a = this.ctx) == null ? void 0 : _a.arc(x, y, radius, startRadians, endRadians);
1559
+ if (this.ctx) this.ctx.arc(x, y, radius, startRadians, endRadians);
1560
+ return this;
1519
1561
  }
1520
1562
  fillCircle(x, y, radius) {
1521
- if (this.ctx) {
1522
- this.ctx.beginPath();
1523
- this.ctx.arc(x, y, radius, 0, 2 * Math.PI);
1524
- this.ctx.fill();
1525
- }
1563
+ if (!this.ctx) return this;
1564
+ this.ctx.beginPath();
1565
+ this.ctx.arc(x, y, radius, 0, 2 * Math.PI);
1566
+ this.ctx.fill();
1567
+ return this;
1526
1568
  }
1527
1569
  strokeLine(startX, startY, endX, endY) {
1528
- if (this.ctx) {
1529
- this.ctx.beginPath();
1530
- this.ctx.moveTo(startX, startY);
1531
- this.ctx.lineTo(endX, endY);
1532
- this.ctx.stroke();
1533
- }
1570
+ if (!this.ctx) return this;
1571
+ this.ctx.beginPath();
1572
+ this.ctx.moveTo(startX, startY);
1573
+ this.ctx.lineTo(endX, endY);
1574
+ this.ctx.stroke();
1575
+ return this;
1534
1576
  }
1535
1577
  strokePartialLine(startX, startY, endX, endY, startT, endT) {
1578
+ if (!this.ctx) return this;
1536
1579
  let x1 = startX + (endX - startX) * startT;
1537
1580
  let y1 = startY + (endY - startY) * startT;
1538
1581
  let x2 = startX + (endX - startX) * endT;
1539
1582
  let y2 = startY + (endY - startY) * endT;
1540
- if (this.ctx) {
1541
- this.ctx.beginPath();
1542
- this.ctx.moveTo(x1, y1);
1543
- this.ctx.lineTo(x2, y2);
1544
- this.ctx.stroke();
1545
- }
1583
+ this.ctx.beginPath();
1584
+ this.ctx.moveTo(x1, y1);
1585
+ this.ctx.lineTo(x2, y2);
1586
+ this.ctx.stroke();
1587
+ return this;
1546
1588
  }
1589
+ /** @deprecated - Use {@link drawBracket} instead. */
1547
1590
  drawBrace(rect, side) {
1548
- if (this.ctx) {
1549
- let { left, right, width, top, bottom, anchorY } = rect;
1550
- if (side === "right") {
1551
- [left, right, width] = [right, left, -width];
1552
- }
1553
- this.ctx.beginPath();
1554
- this.ctx.moveTo(right, top);
1555
- this.ctx.bezierCurveTo(
1556
- left + width * 0.1,
1557
- top,
1558
- left + width * 0.8,
1559
- anchorY,
1560
- left,
1561
- anchorY
1562
- );
1563
- this.ctx.moveTo(right, bottom);
1564
- this.ctx.bezierCurveTo(
1565
- left + width * 0.1,
1566
- bottom,
1567
- left + width * 0.8,
1568
- anchorY,
1569
- left,
1570
- anchorY
1571
- );
1572
- this.ctx.stroke();
1591
+ return this.drawBracket(rect, side === "left" ? "{" : "}");
1592
+ }
1593
+ drawBracket(rect, bracket) {
1594
+ if (!this.ctx) return this;
1595
+ let { left, right, width, top, bottom, height, anchorY } = rect;
1596
+ if ([")", "]", "}", ">"].includes(bracket)) {
1597
+ [left, right, width] = [right, left, -width];
1598
+ }
1599
+ switch (bracket) {
1600
+ case "(":
1601
+ case ")":
1602
+ this.ctx.beginPath();
1603
+ this.ctx.moveTo(right, top);
1604
+ this.ctx.bezierCurveTo(
1605
+ left - width * 0.2,
1606
+ top + height * 0.3,
1607
+ left - width * 0.2,
1608
+ top + height * 0.7,
1609
+ right,
1610
+ bottom
1611
+ );
1612
+ this.ctx.stroke();
1613
+ break;
1614
+ case "{":
1615
+ case "}":
1616
+ this.ctx.beginPath();
1617
+ this.ctx.moveTo(right, top);
1618
+ this.ctx.bezierCurveTo(
1619
+ left + width * 0.1,
1620
+ top,
1621
+ left + width * 0.8,
1622
+ anchorY,
1623
+ left,
1624
+ anchorY
1625
+ );
1626
+ this.ctx.moveTo(right, bottom);
1627
+ this.ctx.bezierCurveTo(
1628
+ left + width * 0.1,
1629
+ bottom,
1630
+ left + width * 0.8,
1631
+ anchorY,
1632
+ left,
1633
+ anchorY
1634
+ );
1635
+ this.ctx.stroke();
1636
+ break;
1637
+ case "[":
1638
+ case "]":
1639
+ this.ctx.beginPath();
1640
+ this.ctx.moveTo(right, top);
1641
+ this.ctx.lineTo(left, top);
1642
+ this.ctx.lineTo(left, bottom);
1643
+ this.ctx.lineTo(right, bottom);
1644
+ this.ctx.stroke();
1645
+ break;
1646
+ case "<":
1647
+ case ">":
1648
+ this.ctx.beginPath();
1649
+ this.ctx.moveTo(right, top);
1650
+ this.ctx.lineTo(left, anchorY);
1651
+ this.ctx.lineTo(right, bottom);
1652
+ this.ctx.stroke();
1653
+ break;
1573
1654
  }
1655
+ return this;
1574
1656
  }
1575
1657
  };
1576
1658
 
@@ -2007,20 +2089,21 @@ var ObjStaffSignature = class extends MusicObject {
2007
2089
  if (this.clefImage) {
2008
2090
  x += paddingX;
2009
2091
  this.clefImage.layout(ctx);
2010
- this.clefImage.offset(x, staff.getDiatonicIdY(staff.clefLineDiatonicId));
2092
+ this.clefImage.setAnchor(x, staff.getDiatonicIdY(staff.clefLineDiatonicId));
2011
2093
  this.rect.expandInPlace(this.clefImage.getRect());
2012
2094
  x = this.rect.right;
2013
2095
  if (this.eightBelowClef) {
2014
2096
  let r = this.clefImage.getRect();
2015
2097
  this.eightBelowClef.layout(ctx);
2016
- this.eightBelowClef.offset(r.centerX, Math.max(r.anchorY + r.height * 0.3, staff.getBottomLineY()));
2098
+ this.eightBelowClef.setCenterX(r.centerX);
2099
+ this.eightBelowClef.setTop(Math.max(r.anchorY + r.height * 0.3, staff.getBottomLineY()));
2017
2100
  this.rect.expandInPlace(this.eightBelowClef.getRect());
2018
2101
  }
2019
2102
  }
2020
2103
  if (this.measureNumber) {
2021
2104
  this.measureNumber.layout(ctx);
2022
- let y = Math.min(staff.getTopLineY(), this.clefImage ? this.clefImage.getRect().top : staff.getTopLineY());
2023
- this.measureNumber.offset(0, y);
2105
+ this.measureNumber.setLeft(0);
2106
+ this.measureNumber.setBottom(Math.min(staff.getTopLineY(), this.clefImage ? this.clefImage.getRect().top : staff.getTopLineY()));
2024
2107
  this.rect.expandInPlace(this.measureNumber.getRect());
2025
2108
  x = Math.max(x, this.rect.right);
2026
2109
  }
@@ -2028,7 +2111,8 @@ var ObjStaffSignature = class extends MusicObject {
2028
2111
  x += paddingX;
2029
2112
  this.ksNeutralizeAccidentals.forEach((objAcc) => {
2030
2113
  objAcc.layout(ctx);
2031
- objAcc.offset(x + objAcc.getRect().leftw, staff.getDiatonicIdY(objAcc.diatonicId));
2114
+ objAcc.setLeft(x);
2115
+ objAcc.setAnchorY(staff.getDiatonicIdY(objAcc.diatonicId));
2032
2116
  this.rect.expandInPlace(objAcc.getRect());
2033
2117
  x = this.rect.right;
2034
2118
  });
@@ -2037,7 +2121,8 @@ var ObjStaffSignature = class extends MusicObject {
2037
2121
  x += paddingX;
2038
2122
  this.ksNewAccidentals.forEach((objAcc) => {
2039
2123
  objAcc.layout(ctx);
2040
- objAcc.offset(x + objAcc.getRect().leftw, staff.getDiatonicIdY(objAcc.diatonicId));
2124
+ objAcc.setLeft(x);
2125
+ objAcc.setAnchorY(staff.getDiatonicIdY(objAcc.diatonicId));
2041
2126
  this.rect.expandInPlace(objAcc.getRect());
2042
2127
  x = this.rect.right;
2043
2128
  });
@@ -2047,24 +2132,34 @@ var ObjStaffSignature = class extends MusicObject {
2047
2132
  (_b = this.beatSizeText) == null ? void 0 : _b.layout(ctx);
2048
2133
  let tsWidth = Math.max((_d = (_c = this.beatCountText) == null ? void 0 : _c.getRect().width) != null ? _d : 0, (_f = (_e = this.beatSizeText) == null ? void 0 : _e.getRect().width) != null ? _f : 0);
2049
2134
  if (this.beatCountText) {
2050
- this.beatCountText.offset(x + tsWidth / 2 + paddingX, staff.getDiatonicIdY(staff.middleLineDiatonicId + 2));
2135
+ this.beatCountText.setCenter(
2136
+ x + tsWidth / 2 + paddingX,
2137
+ staff.getDiatonicIdY(staff.middleLineDiatonicId + 2)
2138
+ );
2051
2139
  this.rect.expandInPlace(this.beatCountText.getRect());
2052
2140
  right = Math.max(right, this.rect.right);
2053
2141
  }
2054
2142
  if (this.beatSizeText) {
2055
- this.beatSizeText.offset(x + tsWidth / 2 + paddingX, staff.getDiatonicIdY(staff.bottomLineDiatonicId + 2));
2143
+ this.beatSizeText.setCenter(
2144
+ x + tsWidth / 2 + paddingX,
2145
+ staff.getDiatonicIdY(staff.bottomLineDiatonicId + 2)
2146
+ );
2056
2147
  this.rect.expandInPlace(this.beatSizeText.getRect());
2057
2148
  right = Math.max(right, this.rect.right);
2058
2149
  }
2059
2150
  x = right;
2060
2151
  if (this.tempoText) {
2061
- let tempoBottom = Math.min(
2062
- this.clefImage ? this.clefImage.getRect().top : staff.getTopLineY(),
2063
- ...this.ksNeutralizeAccidentals.map((o) => o.getRect().top),
2064
- ...this.ksNewAccidentals.map((o) => o.getRect().top)
2065
- );
2066
2152
  this.tempoText.layout(ctx);
2067
- this.tempoText.offset(x, tempoBottom);
2153
+ this.tempoText.setCenterX(x);
2154
+ this.tempoText.setBottom(staff.getTopLineY());
2155
+ if (this.clefImage && import_ts_utils_lib9.AnchoredRect.overlap(this.clefImage.getRect(), this.tempoText.getRect())) {
2156
+ this.tempoText.setBottom(this.clefImage.getRect().top);
2157
+ }
2158
+ [...this.ksNeutralizeAccidentals, ...this.ksNewAccidentals].forEach((acc) => {
2159
+ if (this.tempoText && import_ts_utils_lib9.AnchoredRect.overlap(acc.getRect(), this.tempoText.getRect())) {
2160
+ this.tempoText.setBottom(acc.getRect().top);
2161
+ }
2162
+ });
2068
2163
  this.rect.expandInPlace(this.tempoText.getRect());
2069
2164
  }
2070
2165
  this.rect.right += paddingX;
@@ -2175,7 +2270,8 @@ var ObjTabSignature = class extends MusicObject {
2175
2270
  this.rect = new import_ts_utils_lib9.AnchoredRect();
2176
2271
  if (this.measureNumber) {
2177
2272
  this.measureNumber.layout(ctx);
2178
- this.measureNumber.offset(0, topLineY);
2273
+ this.measureNumber.setLeft(0);
2274
+ this.measureNumber.setBottom(topLineY);
2179
2275
  this.rect.expandInPlace(this.measureNumber.getRect());
2180
2276
  x = Math.max(x, this.rect.right);
2181
2277
  }
@@ -2183,16 +2279,23 @@ var ObjTabSignature = class extends MusicObject {
2183
2279
  (_b = this.beatSizeText) == null ? void 0 : _b.layout(ctx);
2184
2280
  let tsWidth = Math.max((_d = (_c = this.beatCountText) == null ? void 0 : _c.getRect().width) != null ? _d : 0, (_f = (_e = this.beatSizeText) == null ? void 0 : _e.getRect().width) != null ? _f : 0);
2185
2281
  if (this.beatCountText) {
2186
- this.beatCountText.offset(0 + tsWidth / 2 + paddingX, tab.getRect().anchorY - this.beatCountText.getRect().bottomh);
2282
+ this.beatCountText.setCenter(
2283
+ 0 + tsWidth / 2 + paddingX,
2284
+ tab.getRect().anchorY - this.beatCountText.getRect().bottomh
2285
+ );
2187
2286
  this.rect.expandInPlace(this.beatCountText.getRect());
2188
2287
  }
2189
2288
  if (this.beatSizeText) {
2190
- this.beatSizeText.offset(0 + tsWidth / 2 + paddingX, tab.getRect().anchorY + this.beatSizeText.getRect().toph);
2289
+ this.beatSizeText.setCenter(
2290
+ 0 + tsWidth / 2 + paddingX,
2291
+ tab.getRect().anchorY + this.beatSizeText.getRect().toph
2292
+ );
2191
2293
  this.rect.expandInPlace(this.beatSizeText.getRect());
2192
2294
  }
2193
2295
  if (this.tempoText) {
2194
2296
  this.tempoText.layout(ctx);
2195
- this.tempoText.offset(x + unitSize * 2, topLineY);
2297
+ this.tempoText.setLeft(x + unitSize * 2);
2298
+ this.tempoText.setBottom(topLineY);
2196
2299
  this.rect.expandInPlace(this.tempoText.getRect());
2197
2300
  }
2198
2301
  this.rect.right += paddingX;
@@ -2491,7 +2594,7 @@ var _ObjRest = class _ObjRest extends MusicObject {
2491
2594
  let dotY = this.getRestDotVerticalDisplacement(noteSize) * unitSize;
2492
2595
  obj.dotRects.push(import_ts_utils_lib11.AnchoredRect.createCentered(dotX, dotY, dotWidth, dotWidth));
2493
2596
  }
2494
- obj.offset(0, staff.getDiatonicIdY(diatonicId));
2597
+ obj.setAnchor(0, staff.getDiatonicIdY(diatonicId));
2495
2598
  this.staffObjects.push(obj);
2496
2599
  this.measure.addStaticObject(staff, obj);
2497
2600
  });
@@ -2999,7 +3102,10 @@ var ObjNoteGroup = class _ObjNoteGroup extends MusicObject {
2999
3102
  let acc = obj.accidentals[noteIndex] = new ObjAccidental(this, note.diatonicId, note.accidental, this.color);
3000
3103
  if (acc) {
3001
3104
  acc.layout(ctx);
3002
- acc.offset(-noteHeadRect.leftw - unitSize * DocumentSettings.NoteAccSpace - acc.getRect().rightw, noteY);
3105
+ acc.setAnchor(
3106
+ -noteHeadRect.leftw - unitSize * DocumentSettings.NoteAccSpace - acc.getRect().rightw,
3107
+ noteY
3108
+ );
3003
3109
  }
3004
3110
  noteStaff.addObject(acc);
3005
3111
  }
@@ -3063,9 +3169,7 @@ var ObjNoteGroup = class _ObjNoteGroup extends MusicObject {
3063
3169
  let color = fretId < 0 ? "red" : "black";
3064
3170
  let fretNumber = new ObjText(this, { text: String(fretId), color, bgcolor: "white" }, 0.5, 0.5);
3065
3171
  fretNumber.layout(ctx);
3066
- let x = this.col.getRect().anchorX;
3067
- let y = tab.getStringY(stringNumber - 1);
3068
- fretNumber.offset(x, y);
3172
+ fretNumber.setAnchor(this.col.getRect().anchorX, tab.getStringY(stringNumber - 1));
3069
3173
  obj.fretNumbers.push(fretNumber);
3070
3174
  }
3071
3175
  });
@@ -3240,7 +3344,7 @@ var ObjRhythmColumn = class extends MusicObject {
3240
3344
  return Math.max(0, nextPositionTicks - curPositionTicks);
3241
3345
  }
3242
3346
  getShapeRects() {
3243
- this.getRect();
3347
+ this.forceRectUpdate();
3244
3348
  return this.shapeRects;
3245
3349
  }
3246
3350
  get doc() {
@@ -3315,23 +3419,6 @@ var ObjRhythmColumn = class extends MusicObject {
3315
3419
  addLyricsObject(lyricsObj) {
3316
3420
  this.lyricsObject.set(lyricsObj.verse, lyricsObj.line, lyricsObj.vpos, lyricsObj);
3317
3421
  }
3318
- getMinWidth() {
3319
- let maxNoteSize = Math.max(...this.voiceSymbol.mapToArray((s) => s.rhythmProps.noteSize));
3320
- let w = DocumentSettings.NoteHeadWidth;
3321
- switch (maxNoteSize) {
3322
- case 1:
3323
- return w * 5;
3324
- // whole note
3325
- case 2:
3326
- return w * 3;
3327
- // half note
3328
- case 4:
3329
- return w * 2;
3330
- // quarter note
3331
- default:
3332
- return w;
3333
- }
3334
- }
3335
3422
  updateNoteDisplacements() {
3336
3423
  let data = [];
3337
3424
  this.voiceSymbol.forEach((symbol) => {
@@ -3422,13 +3509,11 @@ var ObjRhythmColumn = class extends MusicObject {
3422
3509
  if (!this.needLayout) {
3423
3510
  return;
3424
3511
  }
3425
- this.requestRectUpdate();
3426
- this.rect = new import_ts_utils_lib13.AnchoredRect();
3427
3512
  let { row } = this;
3428
- let { unitSize } = ctx;
3429
- let halfMinWidth = this.getMinWidth() * unitSize / 2;
3430
- let leftw = halfMinWidth;
3431
- let rightw = halfMinWidth;
3513
+ this.rect = new import_ts_utils_lib13.AnchoredRect();
3514
+ this.requestRectUpdate();
3515
+ let leftw = 0;
3516
+ let rightw = 0;
3432
3517
  this.voiceSymbol.forEach((symbol) => {
3433
3518
  symbol.layout(ctx, accState);
3434
3519
  let r = symbol.getRect();
@@ -3436,31 +3521,30 @@ var ObjRhythmColumn = class extends MusicObject {
3436
3521
  rightw = Math.max(rightw, r.rightw);
3437
3522
  });
3438
3523
  if (this.arpeggioDir !== void 0) {
3439
- let arpeggioWidth = 0;
3440
- this.arpeggios = row.getNotationLines().map((line) => {
3441
- let arpeggio = new ObjArpeggio(this, line, this.getArpeggioDir());
3442
- arpeggio.layout(ctx);
3443
- arpeggio.offset(-leftw - arpeggio.getRect().right, line.getRect().anchorY - arpeggio.getRect().anchorY);
3444
- arpeggioWidth = Math.max(arpeggioWidth, arpeggio.getRect().width);
3445
- line.addObject(arpeggio);
3446
- this.measure.addStaticObject(line, arpeggio);
3447
- return arpeggio;
3524
+ this.arpeggios = row.getNotationLines().map((line) => new ObjArpeggio(this, line, this.getArpeggioDir()));
3525
+ this.arpeggios.forEach((a) => a.layout(ctx));
3526
+ const arpeggioWidth = this.arpeggios.map((a) => a.getRect().width).reduce((accState2, cur) => Math.max(accState2, cur)) + ctx.unitSize;
3527
+ this.arpeggios.forEach((a) => {
3528
+ a.setAnchor(-leftw - arpeggioWidth / 2, a.line.getRect().anchorY);
3529
+ a.line.addObject(a);
3530
+ this.measure.addStaticObject(a.line, a);
3448
3531
  });
3449
3532
  leftw += arpeggioWidth;
3450
3533
  } else {
3451
3534
  this.arpeggios = [];
3452
3535
  }
3453
- let widenColumnObjs = this.getAnchoredLayoutObjects().filter((layoutObj) => layoutObj.layoutGroup.widensColumn);
3454
- if (widenColumnObjs.length > 0) {
3455
- widenColumnObjs.forEach((layoutObj) => {
3456
- leftw = Math.max(leftw, layoutObj.musicObj.getRect().leftw);
3457
- rightw = Math.max(rightw, layoutObj.musicObj.getRect().rightw);
3458
- });
3459
- }
3460
- this.voiceSymbol.forEach((symbol) => symbol.updateAccidentalState(accState));
3536
+ const noteSizes = this.voiceSymbol.mapToArray((s) => s.rhythmProps.noteSize);
3537
+ const maxNoteSize = Math.min(8, Math.max(1, ...noteSizes));
3538
+ const MinColumnWidth = Math.ceil(8 / maxNoteSize) * DocumentSettings.NoteHeadWidth * ctx.unitSize * 0.75;
3539
+ leftw = Math.max(leftw, MinColumnWidth / 2);
3540
+ rightw = Math.max(rightw, MinColumnWidth / 2);
3541
+ leftw *= DocumentSettings.ColumnWidthScale;
3542
+ rightw *= DocumentSettings.ColumnWidthScale;
3461
3543
  this.rect.left = -leftw;
3462
3544
  this.rect.anchorX = 0;
3463
3545
  this.rect.right = rightw;
3546
+ this.requestRectUpdate();
3547
+ this.voiceSymbol.forEach((symbol) => symbol.updateAccidentalState(accState));
3464
3548
  this.row.getStaves().forEach((staff) => {
3465
3549
  let minDiatonicId = void 0;
3466
3550
  let maxDiatonicId = void 0;
@@ -3488,12 +3572,48 @@ var ObjRhythmColumn = class extends MusicObject {
3488
3572
  }
3489
3573
  });
3490
3574
  }
3575
+ layoutReserveSpace(ctx) {
3576
+ const columns = this.measure.getColumns();
3577
+ const extraSpace = ctx.unitSize;
3578
+ this.getAnchoredLayoutObjects().forEach((obj) => {
3579
+ if (obj.layoutGroup.reserveSpace) {
3580
+ const i = columns.indexOf(this);
3581
+ if (i < 0) return;
3582
+ const leftOverflow = obj.getRect().leftw - this.getRect().leftw;
3583
+ if (leftOverflow > 0) {
3584
+ const prevCol = columns[i - 1];
3585
+ if (prevCol) {
3586
+ prevCol.getAnchoredLayoutObjects().forEach((prevObj) => {
3587
+ if (prevObj.layoutGroupId === obj.layoutGroupId) {
3588
+ const rightOverflow2 = prevObj.getRect().rightw - prevCol.getRect().rightw;
3589
+ this.rect.left -= Math.max(rightOverflow2 + leftOverflow, 0) + extraSpace;
3590
+ this.requestRectUpdate();
3591
+ }
3592
+ });
3593
+ }
3594
+ }
3595
+ const rightOverflow = obj.getRect().rightw - this.getRect().rightw;
3596
+ if (rightOverflow > 0) {
3597
+ const nextCol = columns[i + 1];
3598
+ if (nextCol) {
3599
+ nextCol.getAnchoredLayoutObjects().forEach((nextObj) => {
3600
+ if (nextObj.layoutGroupId === obj.layoutGroupId) {
3601
+ const leftOverflow2 = nextObj.getRect().leftw - nextCol.getRect().leftw;
3602
+ this.rect.right += Math.max(rightOverflow + leftOverflow2, 0) + extraSpace;
3603
+ this.requestRectUpdate();
3604
+ }
3605
+ });
3606
+ }
3607
+ }
3608
+ }
3609
+ });
3610
+ }
3491
3611
  layoutDone() {
3492
3612
  this.needLayout = false;
3493
3613
  }
3494
3614
  updateRect() {
3495
3615
  this.shapeRects = [
3496
- ...this.voiceSymbol.filter((s) => !!s).mapToArray((s) => s.getRect().clone()),
3616
+ ...this.voiceSymbol.filter((s) => s !== void 0).mapToArray((s) => s.getRect().clone()),
3497
3617
  ...this.arpeggios.map((a) => a.getRect().clone())
3498
3618
  ];
3499
3619
  this.rect.top = Math.min(...this.shapeRects.map((r) => r.top));
@@ -3574,8 +3694,8 @@ var _ObjSpecialText = class _ObjSpecialText extends MusicObject {
3574
3694
  let codaText = this.components[1];
3575
3695
  codaSym.layout(ctx);
3576
3696
  codaText.layout(ctx);
3577
- codaSym.offset(0, codaText.getRect().centerY);
3578
- codaText.offset(codaSym.getRect().right, 0);
3697
+ codaSym.setAnchorY(codaText.getRect().centerY);
3698
+ codaText.setLeft(codaSym.getRect().right);
3579
3699
  this.rect = new import_ts_utils_lib14.AnchoredRect(
3580
3700
  codaSym.getRect().left,
3581
3701
  codaSym.getRect().anchorX,
@@ -3591,8 +3711,8 @@ var _ObjSpecialText = class _ObjSpecialText extends MusicObject {
3591
3711
  let codaSym = this.components[1];
3592
3712
  toCodaText.layout(ctx);
3593
3713
  codaSym.layout(ctx);
3594
- codaSym.offset(0, toCodaText.getRect().centerY);
3595
- toCodaText.offset(codaSym.getRect().left, 0);
3714
+ codaSym.setAnchorY(toCodaText.getRect().centerY);
3715
+ toCodaText.setRight(codaSym.getRect().left);
3596
3716
  this.rect = new import_ts_utils_lib14.AnchoredRect(
3597
3717
  toCodaText.getRect().left,
3598
3718
  codaSym.getRect().anchorX,
@@ -4172,16 +4292,16 @@ var Player = class _Player {
4172
4292
 
4173
4293
  // src/score/engine/obj-bar-line.ts
4174
4294
  var import_ts_utils_lib17 = require("@tspro/ts-utils-lib");
4175
- var ObjStaffTabBarLine = class extends MusicObject {
4295
+ var ObjStaffBarLine = class extends MusicObject {
4176
4296
  constructor(barLine, line) {
4177
4297
  super(line);
4178
4298
  this.barLine = barLine;
4179
4299
  this.line = line;
4180
- __publicField(this, "verticalLines", []);
4300
+ __publicField(this, "vlines", []);
4181
4301
  __publicField(this, "dots", []);
4182
4302
  __publicField(this, "mi");
4183
4303
  line.addObject(this);
4184
- this.mi = new MStaffTabBarLine(this);
4304
+ this.mi = new MStaffBarLine(this);
4185
4305
  }
4186
4306
  getMusicInterface() {
4187
4307
  return this.mi;
@@ -4189,11 +4309,17 @@ var ObjStaffTabBarLine = class extends MusicObject {
4189
4309
  pick(x, y) {
4190
4310
  return this.getRect().contains(x, y) ? [this] : [];
4191
4311
  }
4192
- setRect(r) {
4193
- this.rect = r;
4312
+ updateRect() {
4313
+ this.rect = new import_ts_utils_lib17.AnchoredRect(0, 0, this.line.getTopLineY(), this.line.getBottomLineY());
4314
+ this.vlines.forEach(
4315
+ (l) => this.rect.expandInPlace(new import_ts_utils_lib17.AnchoredRect(l.left, l.left + l.width, this.rect.top, this.rect.bottom))
4316
+ );
4317
+ this.dots.forEach(
4318
+ (d) => this.rect.expandInPlace(new import_ts_utils_lib17.AnchoredRect(d.x - d.r, d.x + d.r, d.y - d.r, d.y + d.r))
4319
+ );
4194
4320
  }
4195
4321
  offset(dx, dy) {
4196
- this.verticalLines.forEach((l) => l.left += dx);
4322
+ this.vlines.forEach((l) => l.left += dx);
4197
4323
  this.dots.forEach((d) => {
4198
4324
  d.x += dx;
4199
4325
  d.y += dy;
@@ -4205,16 +4331,16 @@ var ObjBarLine = class extends MusicObject {
4205
4331
  constructor(measure) {
4206
4332
  super(measure);
4207
4333
  this.measure = measure;
4208
- __publicField(this, "staffTabObjects", []);
4209
- __publicField(this, "staffTabObjectGroups", []);
4334
+ __publicField(this, "notationLineObjects", []);
4335
+ __publicField(this, "notationLineObjectsByGrp", new import_ts_utils_lib17.UniMap());
4210
4336
  __publicField(this, "barLineType", 0 /* None */);
4211
4337
  }
4212
4338
  pick(x, y) {
4213
4339
  if (!this.getRect().contains(x, y)) {
4214
4340
  return [];
4215
4341
  }
4216
- for (let i = 0; i < this.staffTabObjects.length; i++) {
4217
- let arr = this.staffTabObjects[i].pick(x, y);
4342
+ for (let i = 0; i < this.notationLineObjects.length; i++) {
4343
+ let arr = this.notationLineObjects[i].pick(x, y);
4218
4344
  if (arr.length > 0) {
4219
4345
  return [this, ...arr];
4220
4346
  }
@@ -4223,7 +4349,6 @@ var ObjBarLine = class extends MusicObject {
4223
4349
  }
4224
4350
  layout(ctx) {
4225
4351
  this.requestRectUpdate();
4226
- this.staffTabObjects.length = 0;
4227
4352
  this.barLineType = this.solveBarLineType();
4228
4353
  let { unitSize, _lineWidth } = ctx;
4229
4354
  let { measure, barLineType } = this;
@@ -4233,102 +4358,95 @@ var ObjBarLine = class extends MusicObject {
4233
4358
  let spaceW = 0.7 * unitSize;
4234
4359
  let dotW = DocumentSettings.DotSize * unitSize;
4235
4360
  let dotRadius = dotW / 2;
4236
- row.getNotationLines().forEach((line) => {
4237
- let obj = new ObjStaffTabBarLine(this, line);
4238
- let lineCenterY;
4239
- let lineDotOff;
4240
- let top, bottom;
4241
- const addVerticalLine = (left, width) => {
4242
- obj.verticalLines.push({ left, width });
4243
- };
4244
- const addDotPair = (cx) => {
4245
- for (let i = -1; i <= 1; i += 2) {
4246
- let y = lineCenterY + i * lineDotOff;
4247
- obj.dots.push({ x: cx, y, r: dotRadius });
4361
+ this.notationLineObjects = [];
4362
+ this.notationLineObjectsByGrp.clear();
4363
+ row.getRowGroups().forEach((grp) => {
4364
+ grp.lines.forEach((line) => {
4365
+ let obj = new ObjStaffBarLine(this, line);
4366
+ this.notationLineObjects.push(obj);
4367
+ this.notationLineObjectsByGrp.getOrCreate(grp, []).push(obj);
4368
+ let lineCenterY;
4369
+ let lineDotOff;
4370
+ const addVerticalLine = (left, width) => {
4371
+ obj.vlines.push({ left, width });
4372
+ };
4373
+ const addDotPair = (cx) => {
4374
+ for (let i = -1; i <= 1; i += 2) {
4375
+ let y = lineCenterY + i * lineDotOff;
4376
+ obj.dots.push({ x: cx, y, r: dotRadius });
4377
+ }
4378
+ };
4379
+ if (line instanceof ObjStaff) {
4380
+ lineCenterY = line.getMiddleLineY();
4381
+ lineDotOff = line.getDiatonicSpacing();
4382
+ } else {
4383
+ lineCenterY = (line.getBottomLineY() + line.getTopLineY()) / 2;
4384
+ lineDotOff = (line.getBottomLineY() - line.getTopLineY()) / 6;
4248
4385
  }
4249
- };
4250
- if (line instanceof ObjStaff) {
4251
- lineCenterY = line.getMiddleLineY();
4252
- lineDotOff = line.getDiatonicSpacing();
4253
- } else {
4254
- lineCenterY = (line.getBottomLineY() + line.getTopLineY()) / 2;
4255
- lineDotOff = (line.getBottomLineY() - line.getTopLineY()) / 6;
4256
- }
4257
- top = line.getTopLineY();
4258
- bottom = line.getBottomLineY();
4259
- switch (barLineType) {
4260
- case 0 /* None */:
4261
- obj.setRect(new import_ts_utils_lib17.AnchoredRect(0, 0, 0, top, 0, bottom));
4262
- break;
4263
- case 1 /* Single */:
4264
- obj.setRect(new import_ts_utils_lib17.AnchoredRect(-thinW, 0, 0, top, 0, bottom));
4265
- addVerticalLine(-thinW, thinW);
4266
- break;
4267
- case 2 /* Double */:
4268
- obj.setRect(new import_ts_utils_lib17.AnchoredRect(-thinW - spaceW - thinW, 0, 0, top, 0, bottom));
4269
- addVerticalLine(-thinW - spaceW - thinW, thinW);
4270
- addVerticalLine(-thinW, thinW);
4271
- break;
4272
- case 3 /* EndSong */:
4273
- obj.setRect(new import_ts_utils_lib17.AnchoredRect(-thicW - spaceW - thinW, 0, 0, top, 0, bottom));
4274
- addVerticalLine(-thinW - spaceW - thicW, thinW);
4275
- addVerticalLine(-thicW, thicW);
4276
- break;
4277
- case 4 /* StartRepeat */:
4278
- obj.setRect(new import_ts_utils_lib17.AnchoredRect(0, 0, thicW + spaceW + thinW + spaceW + dotW, top, 0, bottom));
4279
- addVerticalLine(0, thicW);
4280
- addVerticalLine(thicW + spaceW, thinW);
4281
- addDotPair(thicW + spaceW + thinW + spaceW + dotRadius);
4282
- break;
4283
- case 5 /* EndRepeat */:
4284
- obj.setRect(new import_ts_utils_lib17.AnchoredRect(-thicW - spaceW - thinW - spaceW - dotW, 0, 0, top, 0, bottom));
4285
- addVerticalLine(-thinW - spaceW - thicW, thinW);
4286
- addVerticalLine(-thicW, thicW);
4287
- addDotPair(-thinW - spaceW - thicW - spaceW - dotRadius);
4288
- break;
4289
- case 6 /* EndStartRepeat */:
4290
- obj.setRect(new import_ts_utils_lib17.AnchoredRect(-dotW - spaceW - thinW - spaceW - thicW / 2, 0, thicW / 2 + spaceW + thinW + spaceW + dotW, top, 0, bottom));
4291
- addVerticalLine(-thicW / 2, thicW);
4292
- addVerticalLine(-thicW / 2 - spaceW - thinW, thinW);
4293
- addVerticalLine(thicW / 2 + spaceW, thinW);
4294
- addDotPair(-thicW / 2 - spaceW - thinW - spaceW - dotRadius);
4295
- addDotPair(thicW / 2 + spaceW + thinW + spaceW + dotRadius);
4296
- break;
4297
- }
4298
- this.staffTabObjects.push(obj);
4386
+ switch (barLineType) {
4387
+ case 0 /* None */:
4388
+ break;
4389
+ case 1 /* Single */:
4390
+ addVerticalLine(-thinW, thinW);
4391
+ break;
4392
+ case 2 /* Double */:
4393
+ addVerticalLine(-thinW - spaceW - thinW, thinW);
4394
+ addVerticalLine(-thinW, thinW);
4395
+ break;
4396
+ case 3 /* EndSong */:
4397
+ addVerticalLine(-thinW - spaceW - thicW, thinW);
4398
+ addVerticalLine(-thicW, thicW);
4399
+ break;
4400
+ case 4 /* StartRepeat */:
4401
+ addVerticalLine(0, thicW);
4402
+ addVerticalLine(thicW + spaceW, thinW);
4403
+ addDotPair(thicW + spaceW + thinW + spaceW + dotRadius);
4404
+ break;
4405
+ case 5 /* EndRepeat */:
4406
+ addVerticalLine(-thinW - spaceW - thicW, thinW);
4407
+ addVerticalLine(-thicW, thicW);
4408
+ addDotPair(-thinW - spaceW - thicW - spaceW - dotRadius);
4409
+ break;
4410
+ case 6 /* EndStartRepeat */:
4411
+ addVerticalLine(-thicW / 2, thicW);
4412
+ addVerticalLine(-thicW / 2 - spaceW - thinW, thinW);
4413
+ addVerticalLine(thicW / 2 + spaceW, thinW);
4414
+ addDotPair(-thicW / 2 - spaceW - thinW - spaceW - dotRadius);
4415
+ addDotPair(thicW / 2 + spaceW + thinW + spaceW + dotRadius);
4416
+ break;
4417
+ }
4418
+ obj.forceRectUpdate();
4419
+ });
4299
4420
  });
4300
- this.staffTabObjectGroups = row.getInstrumentLineGroups().map(
4301
- (lines) => lines.map((line) => this.staffTabObjects.find((obj) => obj.line === line)).filter((obj) => obj !== void 0)
4302
- );
4303
4421
  }
4304
4422
  updateRect() {
4305
- if (this.staffTabObjects.length > 0) {
4306
- this.rect = this.staffTabObjects[0].getRect().clone();
4307
- for (let i = 1; i < this.staffTabObjects.length; i++) {
4308
- this.rect.expandInPlace(this.staffTabObjects[i].getRect());
4423
+ if (this.notationLineObjects.length > 0) {
4424
+ this.rect = this.notationLineObjects[0].getRect().clone();
4425
+ for (let i = 1; i < this.notationLineObjects.length; i++) {
4426
+ this.rect.expandInPlace(this.notationLineObjects[i].getRect());
4309
4427
  }
4310
4428
  } else {
4311
4429
  this.rect = new import_ts_utils_lib17.AnchoredRect();
4312
4430
  }
4313
4431
  }
4314
4432
  offset(dx, dy) {
4315
- this.staffTabObjects.forEach((obj) => obj.offset(dx, 0));
4433
+ this.notationLineObjects.forEach((obj) => obj.offset(dx, 0));
4316
4434
  this.requestRectUpdate();
4317
4435
  }
4318
4436
  draw(ctx) {
4319
- if (this.barLineType === 0 /* None */) {
4437
+ if (this.barLineType === 0 /* None */)
4320
4438
  return;
4321
- }
4322
4439
  ctx.drawDebugRect(this.getRect());
4323
4440
  ctx.color("black");
4324
- this.staffTabObjectGroups.forEach((objs) => {
4325
- if (objs.length > 0) {
4326
- objs.forEach((obj) => obj.dots.forEach((d) => ctx.fillCircle(d.x, d.y, d.r)));
4327
- let top = objs[0].getRect().top;
4328
- let height = objs[objs.length - 1].getRect().bottom - top;
4329
- objs[0].verticalLines.forEach((vline) => ctx.fillRect(vline.left, top, vline.width, height));
4330
- }
4331
- });
4441
+ for (const [grp, objects] of this.notationLineObjectsByGrp) {
4442
+ objects.forEach((obj, i) => {
4443
+ obj.dots.forEach((d) => ctx.fillCircle(d.x, d.y, d.r));
4444
+ if (i === 0) {
4445
+ let { top, height } = obj.barLine.getRect();
4446
+ obj.vlines.forEach((l) => ctx.fillRect(l.left, top, l.width, height));
4447
+ }
4448
+ });
4449
+ }
4332
4450
  }
4333
4451
  };
4334
4452
  var ObjBarLineLeft = class extends ObjBarLine {
@@ -4445,7 +4563,8 @@ var ObjEnding = class extends MusicObject {
4445
4563
  let measureContent = measure.getColumnsContentRect();
4446
4564
  let endingHeight = textRect.height;
4447
4565
  this.rect = new import_ts_utils_lib18.AnchoredRect(measureContent.left + unitSize, measureContent.right - unitSize, -endingHeight, 0);
4448
- this.endingText.offset(this.rect.left + unitSize / 2, this.rect.bottom);
4566
+ this.endingText.setLeft(this.rect.left + unitSize / 2);
4567
+ this.endingText.setBottom(this.rect.bottom);
4449
4568
  this.shapeRects = [
4450
4569
  new import_ts_utils_lib18.AnchoredRect(this.rect.left, this.rect.left + 1, this.rect.top, this.rect.bottom),
4451
4570
  new import_ts_utils_lib18.AnchoredRect(this.rect.left, this.rect.right, this.rect.top, this.rect.top + 1),
@@ -4872,8 +4991,7 @@ var ObjBeamGroup = class _ObjBeamGroup extends MusicObject {
4872
4991
  });
4873
4992
  }
4874
4993
  if (obj.tupletNumber) {
4875
- let y = (left.y + right.y) / 2 + obj.tupletNumberOffsetY;
4876
- obj.tupletNumber.offset(0, -obj.tupletNumber.getRect().anchorY + y);
4994
+ obj.tupletNumber.setAnchorY((left.y + right.y) / 2 + obj.tupletNumberOffsetY);
4877
4995
  }
4878
4996
  });
4879
4997
  }
@@ -5461,7 +5579,7 @@ var ObjLyrics = class extends MusicObject {
5461
5579
  let halign = (lyricsOptions == null ? void 0 : lyricsOptions.align) === "left" /* Left */ ? 0 : (lyricsOptions == null ? void 0 : lyricsOptions.align) === "right" /* Right */ ? 1 : 0.5;
5462
5580
  this.hyphen = import_ts_utils_lib24.Guard.isEnumValue(lyricsOptions == null ? void 0 : lyricsOptions.hyphen, LyricsHyphen) ? lyricsOptions == null ? void 0 : lyricsOptions.hyphen : void 0;
5463
5581
  this.text = new ObjText(this, { text: lyricsText, color: this.color, scale: 0.8 }, halign, 0);
5464
- this.rect = new import_ts_utils_lib24.AnchoredRect();
5582
+ this.rect = this.text.getRect().clone();
5465
5583
  this.mi = new MLyrics(this);
5466
5584
  }
5467
5585
  getMusicInterface() {
@@ -5477,7 +5595,7 @@ var ObjLyrics = class extends MusicObject {
5477
5595
  this.nextLyricsObject = lyricsObj;
5478
5596
  }
5479
5597
  pick(x, y) {
5480
- return this.rect.contains(x, y) ? [this] : [];
5598
+ return this.getRect().contains(x, y) ? [this] : [];
5481
5599
  }
5482
5600
  layout(ctx) {
5483
5601
  this.text.layout(ctx);
@@ -5498,8 +5616,8 @@ var ObjLyrics = class extends MusicObject {
5498
5616
  let maxw = r ? (r.left - l.right) * 0.85 : hyphenw;
5499
5617
  let w = this.hyphen === "-" /* Hyphen */ ? Math.min(hyphenw, maxw) : maxw;
5500
5618
  if (w > 0) {
5501
- let cx = r ? (r.left + l.right) / 2 : l.right + w / 0.85;
5502
- let cy = l.centerY / 2;
5619
+ let cx = r ? (l.right + r.left) / 2 : l.right + w / 0.85;
5620
+ let cy = l.centerY;
5503
5621
  ctx.moveTo(cx - w / 2, cy);
5504
5622
  ctx.lineTo(cx + w / 2, cy);
5505
5623
  ctx.stroke();
@@ -5633,8 +5751,7 @@ var ObjTabRhythm = class extends MusicObject {
5633
5751
  this.tupletPartsTextObjMap.set(text, textObj = new ObjText(this, { text, scale: 0.75 }, 0.5, 0.5));
5634
5752
  textObj.layout(ctx);
5635
5753
  }
5636
- textObj.offset(-textObj.getRect().anchorX, -textObj.getRect().anchorY);
5637
- textObj.offset(cx, stemTop - fontSize / 2);
5754
+ textObj.setCenter(cx, stemTop - fontSize / 2);
5638
5755
  textObj.draw(ctx);
5639
5756
  }
5640
5757
  if (symbols.length > 1) {
@@ -5687,7 +5804,27 @@ function getVerseLayoutGroupId(verse) {
5687
5804
  throw new import_core13.MusicError(import_core13.MusicErrorType.Unknown, "VerseNumber is not 1, 2 or 3.");
5688
5805
  }
5689
5806
  }
5690
- var _ObjMeasure = class _ObjMeasure extends MusicObject {
5807
+ var MeasureRegions = class {
5808
+ constructor() {
5809
+ __publicField(this, "tabTuning_0", 0);
5810
+ __publicField(this, "signature_1", 0);
5811
+ __publicField(this, "leftBarLine_2", 0);
5812
+ __publicField(this, "padding_3", 0);
5813
+ __publicField(this, "columnsMin_4", 0);
5814
+ __publicField(this, "padding_5", 0);
5815
+ __publicField(this, "rightBarLine_6", 0);
5816
+ }
5817
+ get leftSolid() {
5818
+ return this.tabTuning_0 + this.signature_1 + this.leftBarLine_2 + this.padding_3;
5819
+ }
5820
+ get columnsMin() {
5821
+ return this.columnsMin_4;
5822
+ }
5823
+ get rightSolid() {
5824
+ return this.padding_5 + this.rightBarLine_6;
5825
+ }
5826
+ };
5827
+ var ObjMeasure = class extends MusicObject {
5691
5828
  constructor(row, options) {
5692
5829
  super(row);
5693
5830
  this.row = row;
@@ -5707,12 +5844,9 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
5707
5844
  __publicField(this, "barLineRight");
5708
5845
  __publicField(this, "connectives", []);
5709
5846
  __publicField(this, "beamGroups", []);
5710
- __publicField(this, "tabStringNotesWidth", 0);
5711
5847
  __publicField(this, "measureId");
5848
+ __publicField(this, "regions", new MeasureRegions());
5712
5849
  __publicField(this, "needLayout", true);
5713
- __publicField(this, "leftSolidAreaWidth", 0);
5714
- __publicField(this, "minColumnsAreaWidth", 0);
5715
- __publicField(this, "rightSolidAreaWidth", 0);
5716
5850
  __publicField(this, "voiceSymbols", (0, import_ts_utils_lib26.asMulti)(new import_ts_utils_lib26.IndexArray()));
5717
5851
  __publicField(this, "lastAddedRhythmColumn");
5718
5852
  __publicField(this, "lastAddedRhythmSymbol");
@@ -6388,27 +6522,27 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
6388
6522
  this.getRect().bottom
6389
6523
  );
6390
6524
  }
6391
- getLeftSolidAreaWidth() {
6392
- return this.leftSolidAreaWidth;
6525
+ getLeftSolidWidth() {
6526
+ return this.regions.leftSolid;
6393
6527
  }
6394
- getMinColumnsAreaWidth() {
6395
- return this.minColumnsAreaWidth;
6528
+ getMinColumnsWidth() {
6529
+ return this.regions.columnsMin;
6396
6530
  }
6397
- getRightSolidAreaWidth() {
6398
- return this.rightSolidAreaWidth;
6531
+ getRightSolidWidth() {
6532
+ return this.regions.rightSolid;
6399
6533
  }
6400
- getSolidAreaWidth() {
6401
- return this.leftSolidAreaWidth + this.rightSolidAreaWidth;
6534
+ getTotalSolidWidth() {
6535
+ return this.getLeftSolidWidth() + this.getRightSolidWidth();
6402
6536
  }
6403
6537
  getMinWidth() {
6404
- return this.leftSolidAreaWidth + this.minColumnsAreaWidth + this.rightSolidAreaWidth;
6538
+ return this.getLeftSolidWidth() + this.getMinColumnsWidth() + this.getRightSolidWidth();
6405
6539
  }
6406
6540
  getStaffLineLeft() {
6407
6541
  let prev = this.getPrevMeasure();
6408
6542
  if (prev && prev.row === this.row && !prev.hasPostMeasureBreak()) {
6409
6543
  return prev.getStaffLineRight();
6410
6544
  } else {
6411
- return this.getRect().left + this.tabStringNotesWidth;
6545
+ return this.getRect().left + this.regions.tabTuning_0;
6412
6546
  }
6413
6547
  }
6414
6548
  getStaffLineRight() {
@@ -6622,7 +6756,7 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
6622
6756
  this.postMeasureBreakWidth = this.hasPostMeasureBreak() ? DocumentSettings.PostMeasureBreakWidth * unitSize : 0;
6623
6757
  let isFirstMeasureInRow = this === this.row.getFirstMeasure();
6624
6758
  let isAfterMeasureBreak = ((_a = this.getPrevMeasure()) == null ? void 0 : _a.hasPostMeasureBreak()) === true;
6625
- this.tabStringNotesWidth = isFirstMeasureInRow && this.row.hasTab ? unitSize * 4 : 0;
6759
+ this.regions.tabTuning_0 = isFirstMeasureInRow && this.row.hasTab ? unitSize * 4 : 0;
6626
6760
  let showClef = isFirstMeasureInRow || isAfterMeasureBreak;
6627
6761
  let showMeasureNumber = this.options.showNumber === false ? false : this.options.showNumber === true || isFirstMeasureInRow && !this.row.isFirstRow();
6628
6762
  let showKeySignature = isFirstMeasureInRow || isAfterMeasureBreak || !!this.alterKeySignature;
@@ -6659,7 +6793,8 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
6659
6793
  let note = tab.getTuningStrings()[stringId].format(import_theory9.PitchNotation.Helmholtz, import_theory9.SymbolSet.Unicode);
6660
6794
  let obj = new ObjText(this, { text: note, scale: 0.8 }, 1, 0.5);
6661
6795
  obj.layout(ctx);
6662
- obj.offset(this.tabStringNotesWidth * 0.8, tab.getStringY(stringId));
6796
+ obj.setRight(this.regions.tabTuning_0 * 0.8);
6797
+ obj.setCenterY(tab.getStringY(stringId));
6663
6798
  this.tabStringNotes.push(obj);
6664
6799
  tab.addObject(obj);
6665
6800
  }
@@ -6668,17 +6803,21 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
6668
6803
  this.barLineLeft.layout(ctx);
6669
6804
  const accState = new AccidentalState(this);
6670
6805
  this.columns.forEach((col) => col.layout(ctx, accState));
6806
+ this.columns.forEach((col) => col.layoutReserveSpace(ctx));
6671
6807
  this.barLineRight.layout(ctx);
6672
- if (this.endRepeatPlayCountText) {
6808
+ if (this.endRepeatPlayCountText)
6673
6809
  this.endRepeatPlayCountText.layout(ctx);
6674
- }
6675
- this.layoutObjects.forEach((layoutObj) => layoutObj.layout(ctx));
6810
+ this.layoutObjects.forEach((obj) => obj.layout(ctx));
6676
6811
  let padding = ctx.unitSize;
6677
- this.leftSolidAreaWidth = this.tabStringNotesWidth + Math.max(0, ...this.signatures.map((signature) => signature.getRect().width)) + this.barLineLeft.getRect().width + padding;
6678
- this.rightSolidAreaWidth = padding + this.barLineRight.getRect().width;
6679
- this.minColumnsAreaWidth = 0;
6680
- this.columns.forEach((col) => this.minColumnsAreaWidth += col.getRect().width);
6681
- this.minColumnsAreaWidth = Math.max(this.minColumnsAreaWidth, _ObjMeasure.MinFlexContentWidth * unitSize);
6812
+ this.regions.signature_1 = Math.max(0, ...this.signatures.map((signature) => signature.getRect().width));
6813
+ this.regions.leftBarLine_2 = this.barLineLeft.getRect().width;
6814
+ this.regions.padding_3 = padding;
6815
+ this.regions.columnsMin_4 = Math.max(
6816
+ DocumentSettings.MinColumnsWidth * unitSize,
6817
+ this.columns.map((col) => col.getRect().width).reduce((acc, cur) => acc + cur)
6818
+ );
6819
+ this.regions.padding_5 = padding;
6820
+ this.regions.rightBarLine_6 = this.barLineRight.getRect().width;
6682
6821
  }
6683
6822
  layoutWidth(ctx, width) {
6684
6823
  if (!this.needLayout) {
@@ -6688,30 +6827,30 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
6688
6827
  this.rect = new import_ts_utils_lib26.AnchoredRect();
6689
6828
  this.rect.anchorX = this.rect.left + width / 2;
6690
6829
  this.rect.right = this.rect.left + width;
6691
- let rect;
6692
6830
  this.signatures.forEach((signature) => {
6693
- rect = signature.getRect();
6694
- signature.offset(this.rect.left + this.tabStringNotesWidth - rect.left, -rect.anchorY);
6831
+ signature.setLeft(this.rect.left + this.regions.tabTuning_0);
6832
+ signature.setAnchorY(this.rect.anchorY);
6695
6833
  });
6696
6834
  let signaturesWidth = Math.max(0, ...this.signatures.map((signature) => signature.getRect().width));
6697
- rect = this.barLineLeft.getRect();
6698
- this.barLineLeft.offset(this.rect.left + this.tabStringNotesWidth + signaturesWidth - rect.left, -rect.anchorY);
6699
- rect = this.barLineRight.getRect();
6700
- this.barLineRight.offset(this.rect.right - rect.right, -rect.anchorY);
6835
+ this.barLineLeft.setLeft(this.rect.left + this.regions.tabTuning_0 + signaturesWidth);
6836
+ this.barLineLeft.setAnchorY(this.rect.anchorY);
6837
+ this.barLineRight.setRight(this.rect.right);
6838
+ this.barLineRight.setAnchorY(this.rect.anchorY);
6701
6839
  if (this.endRepeatPlayCountText) {
6702
- this.endRepeatPlayCountText.offset(this.barLineRight.getRect().left, this.barLineRight.getRect().top);
6703
- }
6704
- let columnsAreaLeft = this.rect.left + this.leftSolidAreaWidth;
6705
- let columnsAreaRight = this.rect.right - this.rightSolidAreaWidth;
6706
- let columnsAreaWidth = columnsAreaRight - columnsAreaLeft;
6707
- let columnsWidth = import_ts_utils_lib26.Utils.Math.sum(this.columns.map((col) => col.getRect().width));
6708
- let columnScale = columnsAreaWidth / columnsWidth;
6709
- let columnLeft = columnsAreaLeft;
6840
+ this.endRepeatPlayCountText.setCenterX(this.barLineRight.getRect().left);
6841
+ this.endRepeatPlayCountText.setBottom(this.barLineRight.getRect().top);
6842
+ }
6843
+ let columnsLeft = this.rect.left + this.regions.leftSolid;
6844
+ let columnsRight = this.rect.right - this.regions.rightSolid;
6845
+ let columnsWidth = columnsRight - columnsLeft;
6846
+ let columnsMinWidth = this.regions.columnsMin;
6847
+ let columnScale = columnsWidth / columnsMinWidth;
6848
+ let curColumnLeft = columnsLeft;
6710
6849
  this.columns.forEach((col) => {
6711
- rect = col.getRect();
6712
- let columnAnchorX = columnLeft + rect.leftw * columnScale;
6713
- col.offset(columnAnchorX - rect.anchorX, -rect.anchorY);
6714
- columnLeft += rect.width * columnScale;
6850
+ let rect = col.getRect();
6851
+ let columnAnchorX = curColumnLeft + rect.leftw * columnScale;
6852
+ col.setAnchor(columnAnchorX, this.rect.anchorY);
6853
+ curColumnLeft += rect.width * columnScale;
6715
6854
  });
6716
6855
  getVoiceIds().forEach((voiceId) => {
6717
6856
  const symbols = this.getVoiceSymbols(voiceId);
@@ -6719,8 +6858,7 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
6719
6858
  if (!onlyRest) return;
6720
6859
  const isOnlySymbolInCol = getVoiceIds().map((voiceId2) => onlyRest.col.getVoiceSymbol(voiceId2)).filter((sym) => sym !== void 0 && sym !== onlyRest).length === 0;
6721
6860
  if (isOnlySymbolInCol) return;
6722
- const r = this.getColumnsContentRect();
6723
- onlyRest.offset(r.centerX - onlyRest.getRect().anchorX, 0);
6861
+ onlyRest.setAnchorX(this.getColumnsContentRect().centerX);
6724
6862
  });
6725
6863
  }
6726
6864
  layoutConnectives(ctx) {
@@ -6789,9 +6927,8 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
6789
6927
  this.barLineLeft.offset(dx, dy);
6790
6928
  this.columns.forEach((col) => col.offset(dx, dy));
6791
6929
  this.barLineRight.offset(dx, dy);
6792
- if (this.endRepeatPlayCountText) {
6930
+ if (this.endRepeatPlayCountText)
6793
6931
  this.endRepeatPlayCountText.offset(dx, dy);
6794
- }
6795
6932
  this.connectives.forEach((connective) => connective.offset(dx, 0));
6796
6933
  this.beamGroups.forEach((beam) => beam.offset(dx, dy));
6797
6934
  this.layoutObjects.forEach((layoutObj) => layoutObj.offset(dx, 0));
@@ -6828,8 +6965,6 @@ var _ObjMeasure = class _ObjMeasure extends MusicObject {
6828
6965
  this.beamGroups.forEach((beam) => beam.draw(ctx));
6829
6966
  }
6830
6967
  };
6831
- __publicField(_ObjMeasure, "MinFlexContentWidth", 10);
6832
- var ObjMeasure = _ObjMeasure;
6833
6968
 
6834
6969
  // src/score/engine/layout-object.ts
6835
6970
  var import_core14 = require("@tspro/web-music-score/core");
@@ -6850,16 +6985,16 @@ var LayoutGroupId = /* @__PURE__ */ ((LayoutGroupId2) => {
6850
6985
  })(LayoutGroupId || {});
6851
6986
  var LayoutGroupIdAttrs = new import_ts_utils_lib27.UniMap([
6852
6987
  [0 /* TabRhythm */, { rowAlign: true }],
6853
- [1 /* Fermata */, {}],
6854
- [2 /* NoteLabel */, { widen: true }],
6988
+ [1 /* Fermata */, { reserveSpace: true }],
6989
+ [2 /* NoteLabel */, { reserveSpace: true }],
6855
6990
  [3 /* Navigation */, { rowAlign: true }],
6856
6991
  [4 /* Ending */, { rowAlign: true, padding: 2 }],
6857
6992
  [5 /* TempoAnnotation */, { rowAlign: true, padding: 2 }],
6858
6993
  [6 /* DynamicsAnnotation */, { rowAlign: true, padding: 2 }],
6859
- [7 /* ChordLabel */, { widen: true, rowAlign: true }],
6860
- [8 /* LyricsVerse1 */, { rowAlign: true }],
6861
- [9 /* LyricsVerse2 */, { rowAlign: true }],
6862
- [10 /* LyricsVerse3 */, { rowAlign: true }]
6994
+ [7 /* ChordLabel */, { reserveSpace: true, rowAlign: true }],
6995
+ [8 /* LyricsVerse1 */, { reserveSpace: true, rowAlign: true }],
6996
+ [9 /* LyricsVerse2 */, { reserveSpace: true, rowAlign: true }],
6997
+ [10 /* LyricsVerse3 */, { reserveSpace: true, rowAlign: true }]
6863
6998
  ]);
6864
6999
  function requireParentMeasure(p) {
6865
7000
  while (p) {
@@ -6941,6 +7076,9 @@ var LayoutObjectWrapper = class {
6941
7076
  offset(dx, dy) {
6942
7077
  this.musicObj.offset(dx, dy);
6943
7078
  }
7079
+ setAnchorY(y) {
7080
+ this.musicObj.setAnchorY(y);
7081
+ }
6944
7082
  getRect() {
6945
7083
  return this.musicObj.getRect();
6946
7084
  }
@@ -6951,11 +7089,11 @@ var LayoutGroup = class {
6951
7089
  // key = VerticalPos
6952
7090
  __publicField(this, "layoutObject", (0, import_ts_utils_lib27.asMulti)(new import_ts_utils_lib27.IndexArray()));
6953
7091
  __publicField(this, "rowAlign");
6954
- __publicField(this, "widensColumn");
7092
+ __publicField(this, "reserveSpace");
6955
7093
  __publicField(this, "padding");
6956
7094
  var _a, _b, _c, _d;
6957
7095
  this.rowAlign = ((_a = LayoutGroupIdAttrs.get(layoutGroupId)) == null ? void 0 : _a.rowAlign) === true;
6958
- this.widensColumn = ((_b = LayoutGroupIdAttrs.get(layoutGroupId)) == null ? void 0 : _b.widen) === true;
7096
+ this.reserveSpace = ((_b = LayoutGroupIdAttrs.get(layoutGroupId)) == null ? void 0 : _b.reserveSpace) === true;
6959
7097
  this.padding = (_d = (_c = LayoutGroupIdAttrs.get(layoutGroupId)) == null ? void 0 : _c.padding) != null ? _d : 0;
6960
7098
  }
6961
7099
  getLayoutObjects(verticalPos) {
@@ -7011,7 +7149,7 @@ var ObjNotationLine5 = class extends MusicObject {
7011
7149
  if (y === void 0) {
7012
7150
  return;
7013
7151
  }
7014
- layoutObj.offset(0, y - layoutObj.getRect().anchorY);
7152
+ layoutObj.setAnchorY(y - layoutObj.getRect().anchorY);
7015
7153
  layoutObj.setPositionResolved();
7016
7154
  }
7017
7155
  alignObjectsY(ctx, layoutObjects, verticalPos) {
@@ -7032,7 +7170,7 @@ var ObjNotationLine5 = class extends MusicObject {
7032
7170
  if (musicObj instanceof ObjEnding || musicObj instanceof ObjExtensionLine || musicObj instanceof ObjTabRhythm) {
7033
7171
  musicObj.layoutFitToMeasure(ctx);
7034
7172
  } else {
7035
- musicObj.offset(anchor.getRect().anchorX - musicObj.getRect().anchorX, 0);
7173
+ musicObj.setAnchorX(anchor.getRect().anchorX);
7036
7174
  }
7037
7175
  });
7038
7176
  if (layoutGroup.rowAlign) {
@@ -7312,7 +7450,112 @@ var ObjTab = class extends ObjNotationLine5 {
7312
7450
 
7313
7451
  // src/score/engine/obj-score-row.ts
7314
7452
  var import_core16 = require("@tspro/web-music-score/core");
7453
+ var import_ts_utils_lib30 = require("@tspro/ts-utils-lib");
7454
+
7455
+ // src/score/engine/obj-score-row-group.ts
7315
7456
  var import_ts_utils_lib29 = require("@tspro/ts-utils-lib");
7457
+ var ObjScoreRowGroup = class extends MusicObject {
7458
+ constructor(lines) {
7459
+ var _a;
7460
+ super(lines[0].row);
7461
+ this.lines = lines;
7462
+ __publicField(this, "space", 0);
7463
+ __publicField(this, "instrument");
7464
+ __publicField(this, "instrText");
7465
+ __publicField(this, "braceRect", new import_ts_utils_lib29.AnchoredRect());
7466
+ __publicField(this, "mi");
7467
+ this.instrument = (_a = lines[0].getConfig().instrument) != null ? _a : "";
7468
+ this.instrText = new ObjText(this, { text: this.instrument, color: "black", scale: 1 }, 1, 0.5);
7469
+ this.mi = new MScoreRowGroup(this);
7470
+ }
7471
+ getMusicInterface() {
7472
+ return this.mi;
7473
+ }
7474
+ get row() {
7475
+ return this.lines[0].row;
7476
+ }
7477
+ get hasBrace() {
7478
+ return this.hasInstrument && this.lines.length > 1;
7479
+ }
7480
+ get hasInstrument() {
7481
+ return this.instrument.length > 0;
7482
+ }
7483
+ pick(x, y) {
7484
+ if (!this.getRect().contains(x, y))
7485
+ return [];
7486
+ let arr = this.instrText.pick(x, y);
7487
+ if (arr.length > 0) {
7488
+ return [this, ...arr];
7489
+ }
7490
+ return [this];
7491
+ }
7492
+ updateRect() {
7493
+ this.instrText.setRight(this.braceRect.left - this.space);
7494
+ this.instrText.setCenterY(this.braceRect.anchorY);
7495
+ this.rect = this.instrText.getRect().clone().expandInPlace(this.braceRect);
7496
+ }
7497
+ layout(ctx) {
7498
+ this.space = ctx.unitSize;
7499
+ this.instrText.layout(ctx);
7500
+ this.braceRect = new import_ts_utils_lib29.AnchoredRect(-(this.hasBrace ? ctx.unitSize * 5 : 0), 0, 0, 0);
7501
+ this.forceRectUpdate();
7502
+ }
7503
+ layoutToNotationLines() {
7504
+ this.braceRect.top = this.lines[0].getTopLineY();
7505
+ this.braceRect.bottom = this.lines[this.lines.length - 1].getBottomLineY();
7506
+ this.braceRect.anchorY = this.braceRect.centerY;
7507
+ this.forceRectUpdate();
7508
+ }
7509
+ offset(dx, dy) {
7510
+ this.instrText.offset(dx, dy);
7511
+ this.braceRect.offsetInPlace(dx, dy);
7512
+ this.rect.offsetInPlace(dx, dy);
7513
+ }
7514
+ draw(ctx) {
7515
+ this.instrText.draw(ctx);
7516
+ if (this.hasBrace) {
7517
+ ctx.color("brack").lineWidth(1).drawBracket(this.braceRect, "{");
7518
+ }
7519
+ }
7520
+ };
7521
+
7522
+ // src/score/engine/obj-score-row.ts
7523
+ var ScoreRowRegions = class {
7524
+ constructor() {
7525
+ __publicField(this, "instrWidth", 0);
7526
+ __publicField(this, "staffWidth", 0);
7527
+ }
7528
+ resetWidths() {
7529
+ this.instrWidth = this.staffWidth = 0;
7530
+ }
7531
+ addRowInstrWidth(w) {
7532
+ this.instrWidth = Math.max(this.instrWidth, w);
7533
+ }
7534
+ addRowstaffWidth(w) {
7535
+ this.staffWidth = Math.max(this.staffWidth, w);
7536
+ }
7537
+ get instrLeft() {
7538
+ return 0;
7539
+ }
7540
+ get instrRight() {
7541
+ return this.instrWidth;
7542
+ }
7543
+ get staffLeft() {
7544
+ return this.instrRight;
7545
+ }
7546
+ get staffRight() {
7547
+ return this.staffLeft + this.staffWidth;
7548
+ }
7549
+ get left() {
7550
+ return this.instrLeft;
7551
+ }
7552
+ get right() {
7553
+ return this.staffRight;
7554
+ }
7555
+ get width() {
7556
+ return this.instrWidth + this.staffWidth;
7557
+ }
7558
+ };
7316
7559
  var ObjScoreRow = class extends MusicObject {
7317
7560
  constructor(doc, prevRow, scoreConfig) {
7318
7561
  super(doc);
@@ -7320,12 +7563,10 @@ var ObjScoreRow = class extends MusicObject {
7320
7563
  this.prevRow = prevRow;
7321
7564
  this.scoreConfig = scoreConfig;
7322
7565
  __publicField(this, "nextRow");
7323
- __publicField(this, "minWidth", 0);
7324
7566
  __publicField(this, "notationLines");
7325
- __publicField(this, "instrumentLineGroups");
7567
+ __publicField(this, "rowGroups");
7326
7568
  __publicField(this, "staves");
7327
7569
  __publicField(this, "tabs");
7328
- __publicField(this, "instrumentNames");
7329
7570
  __publicField(this, "measures", []);
7330
7571
  __publicField(this, "needLayout", true);
7331
7572
  __publicField(this, "mi");
@@ -7342,10 +7583,7 @@ var ObjScoreRow = class extends MusicObject {
7342
7583
  prevGroup.push(line);
7343
7584
  }
7344
7585
  }
7345
- this.instrumentLineGroups = lineGroups;
7346
- this.instrumentNames = this.instrumentLineGroups.map((lines) => {
7347
- return lines.length > 0 && import_ts_utils_lib29.Guard.isNonEmptyString(lines[0].getConfig().instrument) ? new ObjText(this, String(lines[0].getConfig().instrument), 0, 0.5) : void 0;
7348
- });
7586
+ this.rowGroups = lineGroups.filter((lines) => lines.length > 0).map((lines) => new ObjScoreRowGroup(lines));
7349
7587
  if (this.prevRow) {
7350
7588
  this.prevRow.nextRow = this;
7351
7589
  }
@@ -7369,14 +7607,17 @@ var ObjScoreRow = class extends MusicObject {
7369
7607
  getNotationLines() {
7370
7608
  return this.notationLines;
7371
7609
  }
7372
- getInstrumentLineGroups() {
7373
- return this.instrumentLineGroups;
7610
+ getRowGroups() {
7611
+ return this.rowGroups;
7374
7612
  }
7375
7613
  findMatchingLine(line) {
7376
7614
  return line.row === this ? line : this.notationLines.find(
7377
- (curLine) => import_ts_utils_lib29.Utils.Obj.deepEqual(line.row.scoreConfig, curLine.row.scoreConfig) && line.id === curLine.id || import_ts_utils_lib29.Guard.isNonEmptyString(line.getConfig().name) && line.getConfig().name === curLine.getConfig().name && line.getConfig().type === curLine.getConfig().type
7615
+ (curLine) => import_ts_utils_lib30.Utils.Obj.deepEqual(line.row.scoreConfig, curLine.row.scoreConfig) && line.id === curLine.id || import_ts_utils_lib30.Guard.isNonEmptyString(line.getConfig().name) && line.getConfig().name === curLine.getConfig().name && line.getConfig().type === curLine.getConfig().type
7378
7616
  );
7379
7617
  }
7618
+ get regions() {
7619
+ return this.doc.regions;
7620
+ }
7380
7621
  getStaves() {
7381
7622
  return this.staves;
7382
7623
  }
@@ -7422,7 +7663,6 @@ var ObjScoreRow = class extends MusicObject {
7422
7663
  this.notationLines.forEach((line) => line.layoutLayoutGroups(ctx));
7423
7664
  }
7424
7665
  pick(x, y) {
7425
- var _a, _b;
7426
7666
  if (!this.getRect().contains(x, y)) {
7427
7667
  return [];
7428
7668
  }
@@ -7432,8 +7672,8 @@ var ObjScoreRow = class extends MusicObject {
7432
7672
  return [this, ...arr];
7433
7673
  }
7434
7674
  }
7435
- for (let i = 0; i < this.instrumentNames.length; i++) {
7436
- let arr = (_b = (_a = this.instrumentNames[i]) == null ? void 0 : _a.pick(x, y)) != null ? _b : [];
7675
+ for (let i = 0; i < this.rowGroups.length; i++) {
7676
+ let arr = this.rowGroups[i].pick(x, y);
7437
7677
  if (arr.length > 0) {
7438
7678
  return [this, ...arr];
7439
7679
  }
@@ -7450,7 +7690,7 @@ var ObjScoreRow = class extends MusicObject {
7450
7690
  let r = this.getRect();
7451
7691
  let firstMeasure = this.getFirstMeasure();
7452
7692
  let left = firstMeasure ? firstMeasure.getColumnsContentRect().left : r.left;
7453
- return new import_ts_utils_lib29.AnchoredRect(left, (left + r.right) / 2, r.right, r.top, r.anchorY, r.bottom);
7693
+ return new import_ts_utils_lib30.AnchoredRect(left, (left + r.right) / 2, r.right, r.top, r.anchorY, r.bottom);
7454
7694
  }
7455
7695
  getDiatonicIdAt(y) {
7456
7696
  for (let i = 0; i < this.notationLines.length; i++) {
@@ -7486,9 +7726,6 @@ var ObjScoreRow = class extends MusicObject {
7486
7726
  getLastMeasure() {
7487
7727
  return this.measures.length > 0 ? this.measures[this.measures.length - 1] : void 0;
7488
7728
  }
7489
- getMinWidth() {
7490
- return this.minWidth;
7491
- }
7492
7729
  solveAutoStemDir(symbols) {
7493
7730
  if (symbols.length === 0) {
7494
7731
  return "up" /* Up */;
@@ -7500,14 +7737,11 @@ var ObjScoreRow = class extends MusicObject {
7500
7737
  return "up" /* Up */;
7501
7738
  }
7502
7739
  let diatonicIds = noteGroupDiatonicIds.length > 0 ? noteGroupDiatonicIds : restDiatonicIds;
7503
- let avgDiatonicId = Math.floor(import_ts_utils_lib29.Utils.Math.avg(...diatonicIds));
7740
+ let avgDiatonicId = Math.floor(import_ts_utils_lib30.Utils.Math.avg(...diatonicIds));
7504
7741
  let staves = this.getStaves().filter((staff) => staff.containsVoiceId(voiceId) && staff.containsDiatonicId(avgDiatonicId));
7505
7742
  return staves.length > 0 ? avgDiatonicId >= staves[0].middleLineDiatonicId ? "down" /* Down */ : "up" /* Up */ : "up" /* Up */;
7506
7743
  }
7507
7744
  }
7508
- getInstrumentNameWidth(ctx) {
7509
- return Math.max(0, ...this.instrumentNames.map((obj) => obj ? obj.getRect().width : 0));
7510
- }
7511
7745
  requestLayout() {
7512
7746
  if (!this.needLayout) {
7513
7747
  this.needLayout = true;
@@ -7519,37 +7753,39 @@ var ObjScoreRow = class extends MusicObject {
7519
7753
  return;
7520
7754
  }
7521
7755
  this.requestRectUpdate();
7522
- this.instrumentNames.forEach((obj) => obj == null ? void 0 : obj.layout(ctx));
7523
7756
  this.notationLines.forEach((line) => {
7524
7757
  line.removeObjects();
7525
7758
  line.layoutHeight(ctx);
7526
7759
  });
7527
- this.minWidth = 0;
7528
- this.measures.forEach((m) => {
7529
- m.layout(ctx);
7530
- this.minWidth += m.getMinWidth();
7531
- this.minWidth += m.getPostMeasureBreakWidth();
7760
+ this.rowGroups.forEach((grp) => {
7761
+ grp.layout(ctx);
7762
+ this.regions.addRowInstrWidth(grp.getRect().width);
7532
7763
  });
7764
+ this.measures.forEach((m) => m.layout(ctx));
7765
+ let packedWidth = this.measures.map((m) => m.getMinWidth() + m.getPostMeasureBreakWidth()).reduce((acc, cur) => acc + cur);
7766
+ this.regions.addRowstaffWidth(packedWidth);
7533
7767
  }
7534
- layoutWidth(ctx, left, right) {
7768
+ layoutStretch(ctx) {
7535
7769
  if (!this.needLayout) {
7536
7770
  return;
7537
7771
  }
7538
- this.rect = new import_ts_utils_lib29.AnchoredRect(0, right, 0, 0);
7772
+ this.rect = new import_ts_utils_lib30.AnchoredRect(this.regions.left, this.regions.right, 0, 0);
7539
7773
  this.notationLines.forEach((line) => line.layoutWidth(ctx));
7540
- let targetColumnsAreaWidth = right - left;
7774
+ this.rowGroups.forEach((grp) => grp.setRight(this.regions.instrRight));
7775
+ let targetColumnsAreaWidth = this.regions.staffWidth;
7541
7776
  let minColumnsAreaWidth = 0;
7542
7777
  this.measures.forEach((m) => {
7543
- targetColumnsAreaWidth -= m.getSolidAreaWidth() + m.getPostMeasureBreakWidth();
7544
- minColumnsAreaWidth += m.getMinColumnsAreaWidth();
7778
+ targetColumnsAreaWidth -= m.getTotalSolidWidth() + m.getPostMeasureBreakWidth();
7779
+ minColumnsAreaWidth += m.getMinColumnsWidth();
7545
7780
  });
7546
7781
  let columnsAreaScale = targetColumnsAreaWidth / minColumnsAreaWidth;
7547
- let x = this.doc.getInstrumentGroupSize(ctx).braceRight;
7782
+ let x = this.regions.staffLeft;
7548
7783
  this.measures.forEach((m) => {
7549
- let newMeasureWidth = m.getSolidAreaWidth() + m.getMinColumnsAreaWidth() * columnsAreaScale;
7784
+ let newMeasureWidth = m.getTotalSolidWidth() + m.getMinColumnsWidth() * columnsAreaScale;
7550
7785
  m.layoutWidth(ctx, newMeasureWidth);
7551
7786
  let r = m.getRect();
7552
- m.offset(x - r.left, -r.anchorY);
7787
+ m.setLeft(x);
7788
+ m.setAnchorY(0);
7553
7789
  x += r.width;
7554
7790
  x += m.getPostMeasureBreakWidth();
7555
7791
  });
@@ -7559,11 +7795,20 @@ var ObjScoreRow = class extends MusicObject {
7559
7795
  });
7560
7796
  }
7561
7797
  updateRect() {
7562
- let left = 0;
7563
- let right = this.measures.length > 0 ? this.measures[this.measures.length - 1].getRect().right : left;
7564
- let top = this.measures.length > 0 ? Math.min(...this.measures.map((m) => m.getRect().top)) : 0;
7565
- let bottom = this.measures.length > 0 ? Math.max(...this.measures.map((m) => m.getRect().bottom)) : 0;
7566
- this.rect = new import_ts_utils_lib29.AnchoredRect(left, right, top, bottom);
7798
+ var _a;
7799
+ let left = this.regions.left;
7800
+ let right = this.regions.right;
7801
+ let top = 0;
7802
+ let bottom = 0;
7803
+ const fermata = (_a = this.getLastMeasure()) == null ? void 0 : _a.getBarLineRight().getAnchoredLayoutObjects().map((o) => o.musicObj).find((o) => o instanceof ObjFermata);
7804
+ if (fermata) {
7805
+ right = Math.max(right, fermata.getRect().right);
7806
+ }
7807
+ if (this.measures.length > 0) {
7808
+ top = Math.min(...this.measures.map((m) => m.getRect().top));
7809
+ bottom = Math.max(...this.measures.map((m) => m.getRect().bottom));
7810
+ }
7811
+ this.rect = new import_ts_utils_lib30.AnchoredRect(left, right, top, bottom);
7567
7812
  }
7568
7813
  alignStemsToBeams() {
7569
7814
  this.measures.forEach((m) => m.alignStemsToBeams());
@@ -7575,10 +7820,10 @@ var ObjScoreRow = class extends MusicObject {
7575
7820
  let cur = this.notationLines[i];
7576
7821
  if (prev instanceof ObjStaff && cur instanceof ObjStaff && prev.staffConfig.grandId !== void 0 && prev.staffConfig.grandId === cur.staffConfig.grandId) {
7577
7822
  let dy = prev.getBottomLineY() - cur.getTopLineY() + unitSize * 6;
7578
- cur.offset(0, dy);
7823
+ cur.offsetY(dy);
7579
7824
  } else {
7580
7825
  let dy = prev.calcBottom() - cur.calcTop() + unitSize * 3;
7581
- cur.offset(0, dy);
7826
+ cur.offsetY(dy);
7582
7827
  }
7583
7828
  }
7584
7829
  this.measures.forEach((m) => {
@@ -7593,26 +7838,10 @@ var ObjScoreRow = class extends MusicObject {
7593
7838
  });
7594
7839
  });
7595
7840
  });
7596
- this.instrumentNames.forEach((obj, i) => {
7597
- let grp = this.instrumentLineGroups[i];
7598
- if (obj && grp.length > 0) {
7599
- obj.offset(
7600
- -obj.getRect().left,
7601
- -obj.getRect().anchorY + (grp[0].getRect().top + grp[grp.length - 1].getRect().bottom) / 2
7602
- );
7603
- }
7604
- });
7841
+ this.rowGroups.forEach((grp) => grp.layoutToNotationLines());
7605
7842
  this.alignStemsToBeams();
7606
7843
  this.requestRectUpdate();
7607
7844
  }
7608
- layoutPadding(ctx) {
7609
- let p = ctx.unitSize / 2;
7610
- this.getRect();
7611
- this.rect.left -= p;
7612
- this.rect.right += p;
7613
- this.rect.top -= p;
7614
- this.rect.bottom += p;
7615
- }
7616
7845
  layoutDone() {
7617
7846
  this.measures.forEach((m) => m.layoutDone());
7618
7847
  this.needLayout = false;
@@ -7621,13 +7850,14 @@ var ObjScoreRow = class extends MusicObject {
7621
7850
  this.measures.forEach((m) => m.offset(dx, dy));
7622
7851
  this.rect.offsetInPlace(dx, dy);
7623
7852
  this.notationLines.forEach((l) => l.offset(dx, dy));
7624
- this.instrumentNames.forEach((obj) => obj == null ? void 0 : obj.offset(dx, dy));
7853
+ this.rowGroups.forEach((grp) => grp.offset(dx, dy));
7625
7854
  }
7626
7855
  draw(ctx) {
7627
7856
  ctx.drawDebugRect(this.getRect());
7857
+ const { left, top, width, height } = this.getRect();
7858
+ const p = ctx._lineWidth;
7628
7859
  ctx.save();
7629
- let { left, top, width, height } = this.getRect();
7630
- ctx.rect(left, top, width, height);
7860
+ ctx.rect(left - p, top, width + 2 * p, height);
7631
7861
  ctx.clip();
7632
7862
  if (this.getFirstMeasure() && (this.notationLines.length > 1 || this.notationLines[0] instanceof ObjTab)) {
7633
7863
  let left2 = this.getFirstMeasure().getStaffLineLeft();
@@ -7637,31 +7867,17 @@ var ObjScoreRow = class extends MusicObject {
7637
7867
  }
7638
7868
  this.measures.forEach((m) => m.draw(ctx));
7639
7869
  this.notationLines.forEach((m) => m.draw(ctx));
7640
- let grpSize = this.doc.getInstrumentGroupSize(ctx);
7641
- this.instrumentNames.forEach((obj, i) => {
7642
- let grp = this.instrumentLineGroups[i];
7643
- if (grp.length > 1) {
7644
- let r = new import_ts_utils_lib29.AnchoredRect(
7645
- grpSize.braceLeft,
7646
- grpSize.braceRight,
7647
- grp[0].getTopLineY(),
7648
- grp[grp.length - 1].getBottomLineY()
7649
- );
7650
- ctx.color("brack").lineWidth(1).drawBrace(r, "left");
7651
- }
7652
- if (obj) {
7653
- obj.draw(ctx);
7654
- }
7655
- });
7870
+ this.rowGroups.forEach((grp) => grp.draw(ctx));
7656
7871
  ctx.restore();
7657
7872
  }
7658
7873
  };
7659
7874
 
7660
7875
  // src/score/engine/obj-header.ts
7661
- var import_ts_utils_lib30 = require("@tspro/ts-utils-lib");
7876
+ var import_ts_utils_lib31 = require("@tspro/ts-utils-lib");
7662
7877
  var ObjHeader = class extends MusicObject {
7663
7878
  constructor(doc, title, composer, arranger) {
7664
7879
  super(doc);
7880
+ this.doc = doc;
7665
7881
  this.title = title;
7666
7882
  this.composer = composer;
7667
7883
  this.arranger = arranger;
@@ -7701,24 +7917,29 @@ var ObjHeader = class extends MusicObject {
7701
7917
  }
7702
7918
  return [this];
7703
7919
  }
7704
- layoutWidth(ctx, left, right) {
7920
+ layout(ctx) {
7705
7921
  let top = 0;
7706
- this.rect = new import_ts_utils_lib30.AnchoredRect(left, right, 0, 0);
7922
+ const left = this.doc.regions.staffLeft;
7923
+ const right = this.doc.regions.staffRight;
7924
+ this.rect = new import_ts_utils_lib31.AnchoredRect(left, right, 0, 0);
7707
7925
  if (this.titleText) {
7708
7926
  this.titleText.layout(ctx);
7709
- this.titleText.offset((left + right) / 2, top);
7927
+ this.titleText.setCenterX((left + right) / 2);
7928
+ this.titleText.setTop(top);
7710
7929
  top += this.titleText.getRect().height;
7711
7930
  this.rect.expandInPlace(this.titleText.getRect());
7712
7931
  }
7713
7932
  if (this.composerText) {
7714
7933
  this.composerText.layout(ctx);
7715
- this.composerText.offset(right, top);
7934
+ this.composerText.setRight(right);
7935
+ this.composerText.setTop(top);
7716
7936
  top += this.composerText.getRect().height;
7717
7937
  this.rect.expandInPlace(this.composerText.getRect());
7718
7938
  }
7719
7939
  if (this.arrangerText) {
7720
7940
  this.arrangerText.layout(ctx);
7721
- this.arrangerText.offset(right, top);
7941
+ this.arrangerText.setRight(right);
7942
+ this.arrangerText.setTop(top);
7722
7943
  top += this.arrangerText.getRect().height;
7723
7944
  this.rect.expandInPlace(this.arrangerText.getRect());
7724
7945
  }
@@ -7749,13 +7970,14 @@ var ObjHeader = class extends MusicObject {
7749
7970
  };
7750
7971
 
7751
7972
  // src/score/engine/obj-document.ts
7752
- var import_ts_utils_lib31 = require("@tspro/ts-utils-lib");
7973
+ var import_ts_utils_lib32 = require("@tspro/ts-utils-lib");
7753
7974
  var import_core17 = require("@tspro/web-music-score/core");
7754
7975
  var ObjDocument = class extends MusicObject {
7755
7976
  constructor() {
7756
7977
  super(void 0);
7757
7978
  __publicField(this, "needLayout", true);
7758
7979
  __publicField(this, "ctx");
7980
+ __publicField(this, "regions", new ScoreRowRegions());
7759
7981
  __publicField(this, "rows", []);
7760
7982
  __publicField(this, "measures", []);
7761
7983
  __publicField(this, "measuresPerRow", Infinity);
@@ -7763,7 +7985,7 @@ var ObjDocument = class extends MusicObject {
7763
7985
  __publicField(this, "header");
7764
7986
  __publicField(this, "newRowRequested", false);
7765
7987
  __publicField(this, "allConnectiveProps", []);
7766
- __publicField(this, "staffGroups", new import_ts_utils_lib31.UniMap());
7988
+ __publicField(this, "staffGroups", new import_ts_utils_lib32.UniMap());
7767
7989
  __publicField(this, "mi");
7768
7990
  this.mi = new MDocument2(this);
7769
7991
  }
@@ -7771,7 +7993,7 @@ var ObjDocument = class extends MusicObject {
7771
7993
  return this.mi;
7772
7994
  }
7773
7995
  setScoreConfiguration(config) {
7774
- if (import_ts_utils_lib31.Guard.isEnumValue(config, StaffPreset)) {
7996
+ if (import_ts_utils_lib32.Guard.isEnumValue(config, StaffPreset)) {
7775
7997
  switch (config) {
7776
7998
  default:
7777
7999
  case "treble" /* Treble */:
@@ -7799,7 +8021,7 @@ var ObjDocument = class extends MusicObject {
7799
8021
  ];
7800
8022
  break;
7801
8023
  }
7802
- } else if (import_ts_utils_lib31.Guard.isArray(config)) {
8024
+ } else if (import_ts_utils_lib32.Guard.isArray(config)) {
7803
8025
  this.curScoreConfig = config;
7804
8026
  } else {
7805
8027
  this.curScoreConfig = [config];
@@ -7960,18 +8182,6 @@ var ObjDocument = class extends MusicObject {
7960
8182
  this.ctx.updateCursorRect(cursorRect);
7961
8183
  }
7962
8184
  }
7963
- getInstrumentGroupSize(ctx) {
7964
- let nameWidth = Math.max(0, ...this.rows.map((row) => row.getInstrumentNameWidth(ctx)));
7965
- let hasName = nameWidth > 0;
7966
- let padding = hasName ? ctx.unitSize : 0;
7967
- let braceWidth = hasName ? ctx.unitSize * 5 : 0;
7968
- return {
7969
- nameLeft: 0,
7970
- nameRight: nameWidth,
7971
- braceLeft: nameWidth + padding,
7972
- braceRight: nameWidth + padding + braceWidth + padding
7973
- };
7974
- }
7975
8185
  requestLayout() {
7976
8186
  this.needLayout = true;
7977
8187
  }
@@ -7999,28 +8209,27 @@ var ObjDocument = class extends MusicObject {
7999
8209
  this.allConnectiveProps.forEach((props) => props.removeConnectives());
8000
8210
  this.allConnectiveProps.forEach((props) => props.createConnectives());
8001
8211
  this.rows.forEach((row) => row.resetLayoutGroups(ctx));
8212
+ this.regions.resetWidths();
8213
+ this.regions.addRowstaffWidth(DocumentSettings.MinStaffWidth * unitSize);
8002
8214
  this.rows.forEach((row) => row.layout(ctx));
8003
- let left = this.getInstrumentGroupSize(ctx).braceRight;
8004
- let right = Math.max(
8005
- DocumentSettings.DocumentMinWidth * unitSize,
8006
- ...this.rows.map((row) => 1.4 * row.getMinWidth())
8007
- );
8008
- this.rows.forEach((row) => row.layoutWidth(ctx, left, right));
8215
+ this.rows.forEach((row) => row.layoutStretch(ctx));
8009
8216
  this.rows.forEach((row) => row.layoutLayoutGroups(ctx));
8010
8217
  this.rows.forEach((row) => row.layoutSetNotationLines(ctx));
8011
- this.rows.forEach((row) => row.layoutPadding(ctx));
8012
- this.rect = new import_ts_utils_lib31.AnchoredRect();
8218
+ this.rect = new import_ts_utils_lib32.AnchoredRect();
8013
8219
  if (this.header) {
8014
- this.header.layoutWidth(ctx, left, right);
8220
+ this.header.layout(ctx);
8015
8221
  this.rect.expandInPlace(this.header.getRect());
8016
8222
  }
8017
8223
  this.rows.forEach((row) => {
8018
- row.offset(-this.rect.left, this.rect.bottom + unitSize * 2 - row.getRect().top);
8224
+ row.setLeft(0);
8225
+ row.setTop(this.rect.bottom + unitSize * 2);
8019
8226
  this.rect.expandInPlace(row.getRect());
8020
8227
  });
8021
8228
  this.rows.forEach((row) => row.layoutDone());
8022
8229
  this.needLayout = false;
8023
8230
  }
8231
+ offset(dx, dy) {
8232
+ }
8024
8233
  drawContent() {
8025
8234
  const { ctx } = this;
8026
8235
  if (!ctx) {
@@ -8089,86 +8298,86 @@ function assertArgMsg(condition, msg) {
8089
8298
  function assertBaseConfig(baseConfig) {
8090
8299
  var _a;
8091
8300
  assertArg(
8092
- import_ts_utils_lib32.Guard.isObject(baseConfig),
8093
- import_ts_utils_lib32.Guard.isStringOrUndefined(baseConfig.name),
8094
- import_ts_utils_lib32.Guard.isUndefined(baseConfig.voiceId) || isVoiceId(baseConfig.voiceId) || import_ts_utils_lib32.Guard.isArray(baseConfig.voiceId) && baseConfig.voiceId.every((voiceId) => isVoiceId(voiceId))
8301
+ import_ts_utils_lib33.Guard.isObject(baseConfig),
8302
+ import_ts_utils_lib33.Guard.isStringOrUndefined(baseConfig.name),
8303
+ import_ts_utils_lib33.Guard.isUndefined(baseConfig.voiceId) || isVoiceId(baseConfig.voiceId) || import_ts_utils_lib33.Guard.isArray(baseConfig.voiceId) && baseConfig.voiceId.every((voiceId) => isVoiceId(voiceId))
8095
8304
  );
8096
- if (!import_ts_utils_lib32.Guard.isUndefined(baseConfig.voiceIds)) {
8097
- assertArg(isVoiceId(baseConfig.voiceIds) || import_ts_utils_lib32.Guard.isArray(baseConfig.voiceIds) && baseConfig.voiceIds.every((voiceId) => isVoiceId(voiceId)));
8305
+ if (!import_ts_utils_lib33.Guard.isUndefined(baseConfig.voiceIds)) {
8306
+ assertArg(isVoiceId(baseConfig.voiceIds) || import_ts_utils_lib33.Guard.isArray(baseConfig.voiceIds) && baseConfig.voiceIds.every((voiceId) => isVoiceId(voiceId)));
8098
8307
  console.warn(`Staff/tab config property 'voiceIds' is deprecated, use 'voiceId' instead.`);
8099
- let arr = import_ts_utils_lib32.Utils.Arr.toArray((_a = baseConfig.voiceId) != null ? _a : []);
8100
- import_ts_utils_lib32.Utils.Arr.toArray(baseConfig.voiceIds).forEach((voiceId) => arr.push(voiceId));
8308
+ let arr = import_ts_utils_lib33.Utils.Arr.toArray((_a = baseConfig.voiceId) != null ? _a : []);
8309
+ import_ts_utils_lib33.Utils.Arr.toArray(baseConfig.voiceIds).forEach((voiceId) => arr.push(voiceId));
8101
8310
  baseConfig.voiceId = arr;
8102
8311
  }
8103
- if (import_ts_utils_lib32.Guard.isArray(baseConfig.voiceId)) {
8104
- baseConfig.voiceId = import_ts_utils_lib32.Utils.Arr.removeDuplicates(baseConfig.voiceId);
8312
+ if (import_ts_utils_lib33.Guard.isArray(baseConfig.voiceId)) {
8313
+ baseConfig.voiceId = import_ts_utils_lib33.Utils.Arr.removeDuplicates(baseConfig.voiceId);
8105
8314
  }
8106
- assertArg(import_ts_utils_lib32.Guard.isStringOrUndefined(baseConfig.instrument));
8315
+ assertArg(import_ts_utils_lib33.Guard.isStringOrUndefined(baseConfig.instrument));
8107
8316
  }
8108
8317
  function assertStaffConfig(staffConfig) {
8109
8318
  assertBaseConfig(staffConfig);
8110
8319
  assertArg(
8111
- import_ts_utils_lib32.Guard.isObject(staffConfig),
8112
- import_ts_utils_lib32.Guard.isStrictEqual(staffConfig.type, "staff"),
8113
- import_ts_utils_lib32.Guard.isEnumValue(staffConfig.clef, Clef),
8114
- import_ts_utils_lib32.Guard.isBooleanOrUndefined(staffConfig.isOctaveDown),
8115
- import_ts_utils_lib32.Guard.isUndefined(staffConfig.minNote) || import_theory13.Note.isNote(staffConfig.minNote),
8116
- import_ts_utils_lib32.Guard.isUndefined(staffConfig.maxNote) || import_theory13.Note.isNote(staffConfig.maxNote),
8117
- import_ts_utils_lib32.Guard.isStringOrUndefined(staffConfig.grandId),
8118
- import_ts_utils_lib32.Guard.isBooleanOrUndefined(staffConfig.isGrand)
8320
+ import_ts_utils_lib33.Guard.isObject(staffConfig),
8321
+ import_ts_utils_lib33.Guard.isStrictEqual(staffConfig.type, "staff"),
8322
+ import_ts_utils_lib33.Guard.isEnumValue(staffConfig.clef, Clef),
8323
+ import_ts_utils_lib33.Guard.isBooleanOrUndefined(staffConfig.isOctaveDown),
8324
+ import_ts_utils_lib33.Guard.isUndefined(staffConfig.minNote) || import_theory13.Note.isNote(staffConfig.minNote),
8325
+ import_ts_utils_lib33.Guard.isUndefined(staffConfig.maxNote) || import_theory13.Note.isNote(staffConfig.maxNote),
8326
+ import_ts_utils_lib33.Guard.isStringOrUndefined(staffConfig.grandId),
8327
+ import_ts_utils_lib33.Guard.isBooleanOrUndefined(staffConfig.isGrand)
8119
8328
  );
8120
- if (!import_ts_utils_lib32.Guard.isUndefined(staffConfig.isGrand))
8329
+ if (!import_ts_utils_lib33.Guard.isUndefined(staffConfig.isGrand))
8121
8330
  console.warn(`Staff config property 'isGrand' is deprecated, use 'grandId' instead.`);
8122
8331
  }
8123
8332
  function assertTabConfig(tabConfig) {
8124
8333
  assertBaseConfig(tabConfig);
8125
8334
  assertArg(
8126
- import_ts_utils_lib32.Guard.isObject(tabConfig),
8127
- import_ts_utils_lib32.Guard.isStrictEqual(tabConfig.type, "tab"),
8128
- import_ts_utils_lib32.Guard.isUndefined(tabConfig.tuning) || import_ts_utils_lib32.Guard.isString(tabConfig.tuning) && import_ts_utils_lib32.Guard.isIncluded(tabConfig.tuning, import_theory13.TuningNameList) || import_ts_utils_lib32.Guard.isArray(tabConfig.tuning) && import_ts_utils_lib32.Guard.isStrictEqual(tabConfig.tuning.length, getStringNumbers().length && tabConfig.tuning.every((s) => import_theory13.Note.isNote(s)))
8335
+ import_ts_utils_lib33.Guard.isObject(tabConfig),
8336
+ import_ts_utils_lib33.Guard.isStrictEqual(tabConfig.type, "tab"),
8337
+ import_ts_utils_lib33.Guard.isUndefined(tabConfig.tuning) || import_ts_utils_lib33.Guard.isString(tabConfig.tuning) && import_ts_utils_lib33.Guard.isIncluded(tabConfig.tuning, import_theory13.TuningNameList) || import_ts_utils_lib33.Guard.isArray(tabConfig.tuning) && import_ts_utils_lib33.Guard.isStrictEqual(tabConfig.tuning.length, getStringNumbers().length && tabConfig.tuning.every((s) => import_theory13.Note.isNote(s)))
8129
8338
  );
8130
8339
  }
8131
8340
  function assertNoteOptions(noteOptions) {
8132
8341
  assertArg(
8133
- import_ts_utils_lib32.Guard.isObject(noteOptions),
8134
- import_ts_utils_lib32.Guard.isBooleanOrUndefined(noteOptions.dotted) || import_ts_utils_lib32.Guard.isIntegerGte(noteOptions.dotted, 0),
8135
- import_ts_utils_lib32.Guard.isEnumValueOrUndefined(noteOptions.stem, Stem),
8136
- import_ts_utils_lib32.Guard.isStringOrUndefined(noteOptions.color),
8137
- import_ts_utils_lib32.Guard.isBooleanOrUndefined(noteOptions.arpeggio) || import_ts_utils_lib32.Guard.isEnumValue(noteOptions.arpeggio, Arpeggio),
8138
- import_ts_utils_lib32.Guard.isBooleanOrUndefined(noteOptions.staccato),
8139
- import_ts_utils_lib32.Guard.isBooleanOrUndefined(noteOptions.diamond),
8140
- import_ts_utils_lib32.Guard.isBooleanOrUndefined(noteOptions.triplet),
8141
- import_ts_utils_lib32.Guard.isUndefined(noteOptions.string) || isStringNumber(noteOptions.string) || import_ts_utils_lib32.Guard.isEmptyArray(noteOptions.string) || import_ts_utils_lib32.Guard.isNonEmptyArray(noteOptions.string) && noteOptions.string.every((string) => isStringNumber(string))
8342
+ import_ts_utils_lib33.Guard.isObject(noteOptions),
8343
+ import_ts_utils_lib33.Guard.isBooleanOrUndefined(noteOptions.dotted) || import_ts_utils_lib33.Guard.isIntegerGte(noteOptions.dotted, 0),
8344
+ import_ts_utils_lib33.Guard.isEnumValueOrUndefined(noteOptions.stem, Stem),
8345
+ import_ts_utils_lib33.Guard.isStringOrUndefined(noteOptions.color),
8346
+ import_ts_utils_lib33.Guard.isBooleanOrUndefined(noteOptions.arpeggio) || import_ts_utils_lib33.Guard.isEnumValue(noteOptions.arpeggio, Arpeggio),
8347
+ import_ts_utils_lib33.Guard.isBooleanOrUndefined(noteOptions.staccato),
8348
+ import_ts_utils_lib33.Guard.isBooleanOrUndefined(noteOptions.diamond),
8349
+ import_ts_utils_lib33.Guard.isBooleanOrUndefined(noteOptions.triplet),
8350
+ import_ts_utils_lib33.Guard.isUndefined(noteOptions.string) || isStringNumber(noteOptions.string) || import_ts_utils_lib33.Guard.isEmptyArray(noteOptions.string) || import_ts_utils_lib33.Guard.isNonEmptyArray(noteOptions.string) && noteOptions.string.every((string) => isStringNumber(string))
8142
8351
  );
8143
- assertArgMsg(import_ts_utils_lib32.Guard.isUndefined(noteOptions.tieSpan), `NoteOptions.tieSpan was removed. Use addConnective("tie", tieSpan)`);
8144
- assertArgMsg(import_ts_utils_lib32.Guard.isUndefined(noteOptions.slurSpan), `NoteOptions.slurSpan was removed. Use addConnective("slur", slurSpan)`);
8352
+ assertArgMsg(import_ts_utils_lib33.Guard.isUndefined(noteOptions.tieSpan), `NoteOptions.tieSpan was removed. Use addConnective("tie", tieSpan)`);
8353
+ assertArgMsg(import_ts_utils_lib33.Guard.isUndefined(noteOptions.slurSpan), `NoteOptions.slurSpan was removed. Use addConnective("slur", slurSpan)`);
8145
8354
  }
8146
8355
  function assertRestOptions(restOptions) {
8147
8356
  assertArg(
8148
- import_ts_utils_lib32.Guard.isObject(restOptions),
8149
- import_ts_utils_lib32.Guard.isBooleanOrUndefined(restOptions.dotted) || import_ts_utils_lib32.Guard.isIntegerGte(restOptions.dotted, 0),
8150
- import_ts_utils_lib32.Guard.isStringOrUndefined(restOptions.staffPos) || import_ts_utils_lib32.Guard.isInteger(restOptions.staffPos) || restOptions.staffPos instanceof import_theory13.Note,
8151
- import_ts_utils_lib32.Guard.isStringOrUndefined(restOptions.color),
8152
- import_ts_utils_lib32.Guard.isBooleanOrUndefined(restOptions.hide),
8153
- import_ts_utils_lib32.Guard.isBooleanOrUndefined(restOptions.triplet)
8357
+ import_ts_utils_lib33.Guard.isObject(restOptions),
8358
+ import_ts_utils_lib33.Guard.isBooleanOrUndefined(restOptions.dotted) || import_ts_utils_lib33.Guard.isIntegerGte(restOptions.dotted, 0),
8359
+ import_ts_utils_lib33.Guard.isStringOrUndefined(restOptions.staffPos) || import_ts_utils_lib33.Guard.isInteger(restOptions.staffPos) || restOptions.staffPos instanceof import_theory13.Note,
8360
+ import_ts_utils_lib33.Guard.isStringOrUndefined(restOptions.color),
8361
+ import_ts_utils_lib33.Guard.isBooleanOrUndefined(restOptions.hide),
8362
+ import_ts_utils_lib33.Guard.isBooleanOrUndefined(restOptions.triplet)
8154
8363
  );
8155
8364
  }
8156
8365
  function assertLyricsOptions(lyricsOptions) {
8157
8366
  assertArg(
8158
- import_ts_utils_lib32.Guard.isObject(lyricsOptions),
8159
- import_ts_utils_lib32.Guard.isEnumValueOrUndefined(lyricsOptions.align, LyricsAlign),
8160
- import_ts_utils_lib32.Guard.isEnumValueOrUndefined(lyricsOptions.hyphen, LyricsHyphen)
8367
+ import_ts_utils_lib33.Guard.isObject(lyricsOptions),
8368
+ import_ts_utils_lib33.Guard.isEnumValueOrUndefined(lyricsOptions.align, LyricsAlign),
8369
+ import_ts_utils_lib33.Guard.isEnumValueOrUndefined(lyricsOptions.hyphen, LyricsHyphen)
8161
8370
  );
8162
8371
  }
8163
8372
  function assertMeasureOptions(measureOptions) {
8164
8373
  assertArg(
8165
- import_ts_utils_lib32.Guard.isObject(measureOptions),
8166
- import_ts_utils_lib32.Guard.isBooleanOrUndefined(measureOptions.showNumber)
8374
+ import_ts_utils_lib33.Guard.isObject(measureOptions),
8375
+ import_ts_utils_lib33.Guard.isBooleanOrUndefined(measureOptions.showNumber)
8167
8376
  );
8168
8377
  }
8169
8378
  function assertStaffTabOrGRoups(staffTabOrGroups) {
8170
8379
  assertArg(
8171
- import_ts_utils_lib32.Guard.isStringOrUndefined(staffTabOrGroups) || import_ts_utils_lib32.Guard.isIntegerGte(staffTabOrGroups, 0) || import_ts_utils_lib32.Guard.isNonEmptyArray(staffTabOrGroups) && staffTabOrGroups.every((staffTabOrGroup) => import_ts_utils_lib32.Guard.isString(staffTabOrGroup) || import_ts_utils_lib32.Guard.isIntegerGte(staffTabOrGroup, 0))
8380
+ import_ts_utils_lib33.Guard.isStringOrUndefined(staffTabOrGroups) || import_ts_utils_lib33.Guard.isIntegerGte(staffTabOrGroups, 0) || import_ts_utils_lib33.Guard.isNonEmptyArray(staffTabOrGroups) && staffTabOrGroups.every((staffTabOrGroup) => import_ts_utils_lib33.Guard.isString(staffTabOrGroup) || import_ts_utils_lib33.Guard.isIntegerGte(staffTabOrGroup, 0))
8172
8381
  );
8173
8382
  }
8174
8383
  var _DocumentBuilder = class _DocumentBuilder {
@@ -8182,19 +8391,19 @@ var _DocumentBuilder = class _DocumentBuilder {
8182
8391
  }
8183
8392
  setScoreConfiguration(config) {
8184
8393
  setAssertFunction("setScoreConfiguration", config);
8185
- if (import_ts_utils_lib32.Guard.isEnumValue(config, StaffPreset)) {
8394
+ if (import_ts_utils_lib33.Guard.isEnumValue(config, StaffPreset)) {
8186
8395
  this.doc.setScoreConfiguration(config);
8187
- } else if (import_ts_utils_lib32.Guard.isObject(config) && config.type === "staff") {
8396
+ } else if (import_ts_utils_lib33.Guard.isObject(config) && config.type === "staff") {
8188
8397
  assertStaffConfig(config);
8189
8398
  this.doc.setScoreConfiguration(config);
8190
- } else if (import_ts_utils_lib32.Guard.isObject(config) && config.type === "tab") {
8399
+ } else if (import_ts_utils_lib33.Guard.isObject(config) && config.type === "tab") {
8191
8400
  assertTabConfig(config);
8192
8401
  this.doc.setScoreConfiguration(config);
8193
- } else if (import_ts_utils_lib32.Guard.isNonEmptyArray(config)) {
8402
+ } else if (import_ts_utils_lib33.Guard.isNonEmptyArray(config)) {
8194
8403
  config.forEach((c) => {
8195
- if (import_ts_utils_lib32.Guard.isObject(c) && c.type === "staff") {
8404
+ if (import_ts_utils_lib33.Guard.isObject(c) && c.type === "staff") {
8196
8405
  assertStaffConfig(c);
8197
- } else if (import_ts_utils_lib32.Guard.isObject(c) && c.type === "tab") {
8406
+ } else if (import_ts_utils_lib33.Guard.isObject(c) && c.type === "tab") {
8198
8407
  assertTabConfig(c);
8199
8408
  } else {
8200
8409
  assertArg(false);
@@ -8227,9 +8436,9 @@ var _DocumentBuilder = class _DocumentBuilder {
8227
8436
  setHeader(title, composer, arranger) {
8228
8437
  setAssertFunction("setHeader", title, composer, arranger);
8229
8438
  assertArg(
8230
- import_ts_utils_lib32.Guard.isStringOrUndefined(title),
8231
- import_ts_utils_lib32.Guard.isStringOrUndefined(composer),
8232
- import_ts_utils_lib32.Guard.isStringOrUndefined(arranger)
8439
+ import_ts_utils_lib33.Guard.isStringOrUndefined(title),
8440
+ import_ts_utils_lib33.Guard.isStringOrUndefined(composer),
8441
+ import_ts_utils_lib33.Guard.isStringOrUndefined(arranger)
8233
8442
  );
8234
8443
  this.doc.setHeader(title, composer, arranger);
8235
8444
  return this;
@@ -8241,7 +8450,7 @@ var _DocumentBuilder = class _DocumentBuilder {
8241
8450
  */
8242
8451
  setMeasuresPerRow(measuresPerRow) {
8243
8452
  setAssertFunction("setMeasuresPerRow", measuresPerRow);
8244
- assertArg(import_ts_utils_lib32.Guard.isIntegerGte(measuresPerRow, 1) || import_ts_utils_lib32.Guard.isPosInfinity(measuresPerRow));
8453
+ assertArg(import_ts_utils_lib33.Guard.isIntegerGte(measuresPerRow, 1) || import_ts_utils_lib33.Guard.isPosInfinity(measuresPerRow));
8245
8454
  this.doc.setMeasuresPerRow(measuresPerRow);
8246
8455
  return this;
8247
8456
  }
@@ -8259,7 +8468,7 @@ var _DocumentBuilder = class _DocumentBuilder {
8259
8468
  }
8260
8469
  setKeySignature(...args) {
8261
8470
  setAssertFunction("setKeySignature", ...args);
8262
- assertArg(args[0] instanceof import_theory13.Scale || args[0] instanceof import_theory13.KeySignature || import_ts_utils_lib32.Guard.isNonEmptyString(args[0]) && import_ts_utils_lib32.Guard.isEnumValueOrUndefined(args[1], import_theory13.ScaleType));
8471
+ assertArg(args[0] instanceof import_theory13.Scale || args[0] instanceof import_theory13.KeySignature || import_ts_utils_lib33.Guard.isNonEmptyString(args[0]) && import_ts_utils_lib33.Guard.isEnumValueOrUndefined(args[1], import_theory13.ScaleType));
8263
8472
  this.getMeasure().setKeySignature(...args);
8264
8473
  return this;
8265
8474
  }
@@ -8267,9 +8476,9 @@ var _DocumentBuilder = class _DocumentBuilder {
8267
8476
  setAssertFunction("setTimeSignature", ...args);
8268
8477
  if (args[0] instanceof import_theory13.TimeSignature) {
8269
8478
  this.getMeasure().setTimeSignature(args[0]);
8270
- } else if (import_ts_utils_lib32.Guard.isEnumValue(args[0], import_theory13.TimeSignatures) && import_ts_utils_lib32.Guard.isEnumValueOrUndefined(args[1], import_theory13.BeamGrouping)) {
8479
+ } else if (import_ts_utils_lib33.Guard.isEnumValue(args[0], import_theory13.TimeSignatures) && import_ts_utils_lib33.Guard.isEnumValueOrUndefined(args[1], import_theory13.BeamGrouping)) {
8271
8480
  this.getMeasure().setTimeSignature(new import_theory13.TimeSignature(args[0], args[1]));
8272
- } else if (import_ts_utils_lib32.Guard.isIntegerGte(args[0], 1) && import_ts_utils_lib32.Guard.isIntegerGte(args[1], 1) && import_ts_utils_lib32.Guard.isEnumValueOrUndefined(args[2], import_theory13.BeamGrouping)) {
8481
+ } else if (import_ts_utils_lib33.Guard.isIntegerGte(args[0], 1) && import_ts_utils_lib33.Guard.isIntegerGte(args[1], 1) && import_ts_utils_lib33.Guard.isEnumValueOrUndefined(args[2], import_theory13.BeamGrouping)) {
8273
8482
  this.getMeasure().setTimeSignature(new import_theory13.TimeSignature(args[0], args[1], args[2]));
8274
8483
  } else {
8275
8484
  assertArg(false);
@@ -8279,8 +8488,8 @@ var _DocumentBuilder = class _DocumentBuilder {
8279
8488
  setTempo(beatsPerMinute, beatLength, dotted) {
8280
8489
  setAssertFunction("setTempo", beatsPerMinute, beatLength, dotted);
8281
8490
  assertArg(
8282
- import_ts_utils_lib32.Guard.isIntegerGte(beatsPerMinute, 1),
8283
- import_ts_utils_lib32.Guard.isUndefined(beatLength) && import_ts_utils_lib32.Guard.isUndefined(dotted) || (0, import_theory13.isNoteLength)(beatLength) && (import_ts_utils_lib32.Guard.isBooleanOrUndefined(dotted) || import_ts_utils_lib32.Guard.isIntegerGte(dotted, 0))
8491
+ import_ts_utils_lib33.Guard.isIntegerGte(beatsPerMinute, 1),
8492
+ import_ts_utils_lib33.Guard.isUndefined(beatLength) && import_ts_utils_lib33.Guard.isUndefined(dotted) || (0, import_theory13.isNoteLength)(beatLength) && (import_ts_utils_lib33.Guard.isBooleanOrUndefined(dotted) || import_ts_utils_lib33.Guard.isIntegerGte(dotted, 0))
8284
8493
  );
8285
8494
  this.getMeasure().setTempo(beatsPerMinute, beatLength, dotted);
8286
8495
  return this;
@@ -8297,15 +8506,15 @@ var _DocumentBuilder = class _DocumentBuilder {
8297
8506
  setAssertFunction("addNote", voiceId, note, noteLength, noteOptions);
8298
8507
  assertArg(
8299
8508
  isVoiceId(voiceId),
8300
- note instanceof import_theory13.Note || import_ts_utils_lib32.Guard.isNonEmptyString(note) || import_ts_utils_lib32.Guard.isArray(note) && note.every((note2) => note2 instanceof import_theory13.Note || import_ts_utils_lib32.Guard.isNonEmptyString(note2)),
8509
+ note instanceof import_theory13.Note || import_ts_utils_lib33.Guard.isNonEmptyString(note) || import_ts_utils_lib33.Guard.isArray(note) && note.every((note2) => note2 instanceof import_theory13.Note || import_ts_utils_lib33.Guard.isNonEmptyString(note2)),
8301
8510
  (0, import_theory13.isNoteLength)(noteLength)
8302
8511
  );
8303
8512
  noteOptions != null ? noteOptions : noteOptions = {};
8304
8513
  assertNoteOptions(noteOptions);
8305
- if (import_ts_utils_lib32.Guard.isArray(note)) {
8514
+ if (import_ts_utils_lib33.Guard.isArray(note)) {
8306
8515
  let string = noteOptions.string;
8307
8516
  note.forEach((note2, noteId) => {
8308
- noteOptions.string = import_ts_utils_lib32.Guard.isArray(string) ? string[noteId] : string;
8517
+ noteOptions.string = import_ts_utils_lib33.Guard.isArray(string) ? string[noteId] : string;
8309
8518
  this.getMeasure().addNoteGroup(voiceId, [note2], noteLength, noteOptions);
8310
8519
  });
8311
8520
  } else {
@@ -8325,7 +8534,7 @@ var _DocumentBuilder = class _DocumentBuilder {
8325
8534
  setAssertFunction("addChord", voiceId, notes, noteLength, noteOptions);
8326
8535
  assertArg(
8327
8536
  isVoiceId(voiceId),
8328
- import_ts_utils_lib32.Guard.isNonEmptyArray(notes) && notes.every((note) => note instanceof import_theory13.Note || import_ts_utils_lib32.Guard.isNonEmptyString(note)),
8537
+ import_ts_utils_lib33.Guard.isNonEmptyArray(notes) && notes.every((note) => note instanceof import_theory13.Note || import_ts_utils_lib33.Guard.isNonEmptyString(note)),
8329
8538
  (0, import_theory13.isNoteLength)(noteLength)
8330
8539
  );
8331
8540
  noteOptions != null ? noteOptions : noteOptions = {};
@@ -8370,24 +8579,24 @@ var _DocumentBuilder = class _DocumentBuilder {
8370
8579
  setAssertFunction("addTuplet", voiceId, tupletRatio);
8371
8580
  assertArg(
8372
8581
  isVoiceId(voiceId),
8373
- import_ts_utils_lib32.Guard.isFunction(tupletBuilder),
8374
- (0, import_theory13.isTupletRatio)(tupletRatio) && import_ts_utils_lib32.Guard.isBooleanOrUndefined(tupletRatio.showRatio)
8582
+ import_ts_utils_lib33.Guard.isFunction(tupletBuilder),
8583
+ (0, import_theory13.isTupletRatio)(tupletRatio) && import_ts_utils_lib33.Guard.isBooleanOrUndefined(tupletRatio.showRatio)
8375
8584
  );
8376
8585
  let tupletSymbols = [];
8377
8586
  const helper = {
8378
8587
  addNote: (note, noteLength, noteOptions) => {
8379
8588
  setAssertFunction("addTuplet => addNote", note, noteLength, noteOptions);
8380
8589
  assertArg(
8381
- note instanceof import_theory13.Note || import_ts_utils_lib32.Guard.isNonEmptyString(note) || import_ts_utils_lib32.Guard.isArray(note) && note.every((note2) => note2 instanceof import_theory13.Note || import_ts_utils_lib32.Guard.isNonEmptyString(note2)),
8590
+ note instanceof import_theory13.Note || import_ts_utils_lib33.Guard.isNonEmptyString(note) || import_ts_utils_lib33.Guard.isArray(note) && note.every((note2) => note2 instanceof import_theory13.Note || import_ts_utils_lib33.Guard.isNonEmptyString(note2)),
8382
8591
  (0, import_theory13.isNoteLength)(noteLength)
8383
8592
  );
8384
8593
  noteOptions != null ? noteOptions : noteOptions = {};
8385
8594
  delete noteOptions.triplet;
8386
8595
  assertNoteOptions(noteOptions);
8387
- if (import_ts_utils_lib32.Guard.isArray(note)) {
8596
+ if (import_ts_utils_lib33.Guard.isArray(note)) {
8388
8597
  let string = noteOptions.string;
8389
8598
  note.forEach((note2, noteId) => {
8390
- noteOptions.string = import_ts_utils_lib32.Guard.isArray(string) ? string[noteId] : string;
8599
+ noteOptions.string = import_ts_utils_lib33.Guard.isArray(string) ? string[noteId] : string;
8391
8600
  let s = this.getMeasure().addNoteGroup(voiceId, [note2], noteLength, noteOptions, tupletRatio);
8392
8601
  tupletSymbols.push(s);
8393
8602
  });
@@ -8400,7 +8609,7 @@ var _DocumentBuilder = class _DocumentBuilder {
8400
8609
  addChord: (notes, noteLength, noteOptions) => {
8401
8610
  setAssertFunction("addTuplet => addChord", notes, noteLength, noteOptions);
8402
8611
  assertArg(
8403
- import_ts_utils_lib32.Guard.isNonEmptyArray(notes) && notes.every((note) => note instanceof import_theory13.Note || import_ts_utils_lib32.Guard.isNonEmptyString(note)),
8612
+ import_ts_utils_lib33.Guard.isNonEmptyArray(notes) && notes.every((note) => note instanceof import_theory13.Note || import_ts_utils_lib33.Guard.isNonEmptyString(note)),
8404
8613
  (0, import_theory13.isNoteLength)(noteLength)
8405
8614
  );
8406
8615
  noteOptions != null ? noteOptions : noteOptions = {};
@@ -8430,8 +8639,8 @@ var _DocumentBuilder = class _DocumentBuilder {
8430
8639
  assertStaffTabOrGRoups(staffTabOrGroups);
8431
8640
  assertArg(
8432
8641
  isVerseNumber(verse),
8433
- import_ts_utils_lib32.Guard.isEnumValue(lyricsLength, import_theory13.NoteLength),
8434
- import_ts_utils_lib32.Guard.isString(lyricsText) || import_ts_utils_lib32.Guard.isArray(lyricsText) && lyricsText.every((text) => import_ts_utils_lib32.Guard.isString(text))
8642
+ import_ts_utils_lib33.Guard.isEnumValue(lyricsLength, import_theory13.NoteLength),
8643
+ import_ts_utils_lib33.Guard.isString(lyricsText) || import_ts_utils_lib33.Guard.isArray(lyricsText) && lyricsText.every((text) => import_ts_utils_lib33.Guard.isString(text))
8435
8644
  );
8436
8645
  lyricsOptions != null ? lyricsOptions : lyricsOptions = {};
8437
8646
  assertLyricsOptions(lyricsOptions);
@@ -8440,7 +8649,7 @@ var _DocumentBuilder = class _DocumentBuilder {
8440
8649
  } else {
8441
8650
  (_a = lyricsOptions.align) != null ? _a : lyricsOptions.align = this.currentLyricsAlign;
8442
8651
  }
8443
- if (import_ts_utils_lib32.Guard.isArray(lyricsText)) {
8652
+ if (import_ts_utils_lib33.Guard.isArray(lyricsText)) {
8444
8653
  lyricsText.forEach((text) => this.getMeasure().addLyrics(staffTabOrGroups, verse, lyricsLength, text, lyricsOptions));
8445
8654
  } else {
8446
8655
  this.getMeasure().addLyrics(staffTabOrGroups, verse, lyricsLength, lyricsText, lyricsOptions);
@@ -8474,7 +8683,7 @@ var _DocumentBuilder = class _DocumentBuilder {
8474
8683
  }
8475
8684
  addFermataInternal(staffTabOrGroups, fermata) {
8476
8685
  assertStaffTabOrGRoups(staffTabOrGroups);
8477
- assertArg(import_ts_utils_lib32.Guard.isEnumValue(fermata, Fermata));
8686
+ assertArg(import_ts_utils_lib33.Guard.isEnumValue(fermata, Fermata));
8478
8687
  this.getMeasure().addFermata(staffTabOrGroups, fermata);
8479
8688
  return this;
8480
8689
  }
@@ -8500,7 +8709,7 @@ var _DocumentBuilder = class _DocumentBuilder {
8500
8709
  addNavigationInternal(staffTabOrGroups, navigation, ...args) {
8501
8710
  assertStaffTabOrGRoups(staffTabOrGroups);
8502
8711
  assertArg(
8503
- import_ts_utils_lib32.Guard.isStrictEqual(navigation, "endRepeat" /* EndRepeat */) && import_ts_utils_lib32.Guard.isStrictEqual(args.length, 1) || import_ts_utils_lib32.Guard.isStrictEqual(navigation, "ending" /* Ending */) && import_ts_utils_lib32.Guard.isIntegerGte(args.length, 1) && args.every((passage) => import_ts_utils_lib32.Guard.isIntegerGte(passage, 1)) || import_ts_utils_lib32.Guard.isEnumValue(navigation, Navigation) && import_ts_utils_lib32.Guard.isEmptyArray(args)
8712
+ import_ts_utils_lib33.Guard.isStrictEqual(navigation, "endRepeat" /* EndRepeat */) && import_ts_utils_lib33.Guard.isStrictEqual(args.length, 1) || import_ts_utils_lib33.Guard.isStrictEqual(navigation, "ending" /* Ending */) && import_ts_utils_lib33.Guard.isIntegerGte(args.length, 1) && args.every((passage) => import_ts_utils_lib33.Guard.isIntegerGte(passage, 1)) || import_ts_utils_lib33.Guard.isEnumValue(navigation, Navigation) && import_ts_utils_lib33.Guard.isEmptyArray(args)
8504
8713
  );
8505
8714
  this.getMeasure().addNavigation(staffTabOrGroups, navigation, ...args);
8506
8715
  return this;
@@ -8520,8 +8729,8 @@ var _DocumentBuilder = class _DocumentBuilder {
8520
8729
  }
8521
8730
  assertStaffTabOrGRoups(staffTabOrGroups);
8522
8731
  assertArg(
8523
- import_ts_utils_lib32.Guard.isEnumValue(annotation, Annotation),
8524
- import_ts_utils_lib32.Guard.isNonEmptyString(text)
8732
+ import_ts_utils_lib33.Guard.isEnumValue(annotation, Annotation),
8733
+ import_ts_utils_lib33.Guard.isNonEmptyString(text)
8525
8734
  );
8526
8735
  this.getMeasure().addAnnotation(staffTabOrGroups, annotation, text);
8527
8736
  return this;
@@ -8545,8 +8754,8 @@ var _DocumentBuilder = class _DocumentBuilder {
8545
8754
  addLabelInternal(staffTabOrGroups, label, text) {
8546
8755
  assertStaffTabOrGRoups(staffTabOrGroups);
8547
8756
  assertArg(
8548
- import_ts_utils_lib32.Guard.isEnumValue(label, Label),
8549
- import_ts_utils_lib32.Guard.isNonEmptyString(text)
8757
+ import_ts_utils_lib33.Guard.isEnumValue(label, Label),
8758
+ import_ts_utils_lib33.Guard.isNonEmptyString(text)
8550
8759
  );
8551
8760
  this.getMeasure().addLabel(staffTabOrGroups, label, text);
8552
8761
  return this;
@@ -8574,21 +8783,21 @@ var _DocumentBuilder = class _DocumentBuilder {
8574
8783
  }
8575
8784
  addConnective(connective, ...args) {
8576
8785
  setAssertFunction("addConnective", connective, ...args);
8577
- assertArg(import_ts_utils_lib32.Guard.isEnumValue(connective, Connective));
8786
+ assertArg(import_ts_utils_lib33.Guard.isEnumValue(connective, Connective));
8578
8787
  if (connective === "tie" /* Tie */) {
8579
- assertArg(import_ts_utils_lib32.Guard.isIntegerOrUndefined(args[0]) || import_ts_utils_lib32.Guard.isEnumValue(args[0], TieType));
8580
- assertArg(import_ts_utils_lib32.Guard.isEnumValueOrUndefined(args[1], NoteAnchor));
8788
+ assertArg(import_ts_utils_lib33.Guard.isIntegerOrUndefined(args[0]) || import_ts_utils_lib33.Guard.isEnumValue(args[0], TieType));
8789
+ assertArg(import_ts_utils_lib33.Guard.isEnumValueOrUndefined(args[1], NoteAnchor));
8581
8790
  let tieSpan = args[0];
8582
8791
  let noteAnchor = args[1];
8583
8792
  this.getMeasure().addConnective(connective, tieSpan, noteAnchor);
8584
8793
  } else if (connective === "slur" /* Slur */) {
8585
- assertArg(import_ts_utils_lib32.Guard.isIntegerOrUndefined(args[0]));
8586
- assertArg(import_ts_utils_lib32.Guard.isEnumValueOrUndefined(args[1], NoteAnchor));
8794
+ assertArg(import_ts_utils_lib33.Guard.isIntegerOrUndefined(args[0]));
8795
+ assertArg(import_ts_utils_lib33.Guard.isEnumValueOrUndefined(args[1], NoteAnchor));
8587
8796
  let slurSpan = args[0];
8588
8797
  let noteAnchor = args[1];
8589
8798
  this.getMeasure().addConnective(connective, slurSpan, noteAnchor);
8590
8799
  } else if (connective === "slide" /* Slide */) {
8591
- assertArg(import_ts_utils_lib32.Guard.isEnumValueOrUndefined(args[0], NoteAnchor));
8800
+ assertArg(import_ts_utils_lib33.Guard.isEnumValueOrUndefined(args[0], NoteAnchor));
8592
8801
  let noteAnchor = args[0];
8593
8802
  this.getMeasure().addConnective(connective, noteAnchor);
8594
8803
  }
@@ -8608,20 +8817,20 @@ var _DocumentBuilder = class _DocumentBuilder {
8608
8817
  */
8609
8818
  addExtension(extensionBuilder) {
8610
8819
  setAssertFunction("addExtension");
8611
- assertArgMsg(import_ts_utils_lib32.Guard.isFunctionOrUndefined(extensionBuilder), "addExtension() has new usage, e.g. addExtension(ext => ext.measures(2)).");
8820
+ assertArgMsg(import_ts_utils_lib33.Guard.isFunctionOrUndefined(extensionBuilder), "addExtension() has new usage, e.g. addExtension(ext => ext.measures(2)).");
8612
8821
  let ticks = 0;
8613
8822
  let visible = true;
8614
8823
  const helper = {
8615
8824
  notes: (noteLength, noteCount) => {
8616
8825
  setAssertFunction("addExtension.notes", noteLength, noteCount);
8617
8826
  assertArg((0, import_theory13.isNoteLength)(noteLength));
8618
- assertArg(import_ts_utils_lib32.Guard.isUndefined(noteCount) || import_ts_utils_lib32.Guard.isNumber(noteCount) && noteCount >= 0);
8827
+ assertArg(import_ts_utils_lib33.Guard.isUndefined(noteCount) || import_ts_utils_lib33.Guard.isNumber(noteCount) && noteCount >= 0);
8619
8828
  ticks += import_theory13.RhythmProps.get(noteLength).ticks * (noteCount != null ? noteCount : 1);
8620
8829
  return helper;
8621
8830
  },
8622
8831
  measures: (measureCount) => {
8623
8832
  setAssertFunction("addExtension.measures", measureCount);
8624
- assertArg(import_ts_utils_lib32.Guard.isNumber(measureCount) && measureCount >= 1);
8833
+ assertArg(import_ts_utils_lib33.Guard.isNumber(measureCount) && measureCount >= 1);
8625
8834
  ticks += this.getMeasure().getMeasureTicks() * measureCount;
8626
8835
  return helper;
8627
8836
  },
@@ -8654,9 +8863,9 @@ var _DocumentBuilder = class _DocumentBuilder {
8654
8863
  addStaffGroup(groupName, staffsTabsAndGroups, verticalPosition = "auto" /* Auto */) {
8655
8864
  setAssertFunction("addStaffGroup", groupName, staffsTabsAndGroups, verticalPosition);
8656
8865
  assertArg(
8657
- import_ts_utils_lib32.Guard.isNonEmptyString(groupName),
8658
- import_ts_utils_lib32.Guard.isNonEmptyString(staffsTabsAndGroups) || import_ts_utils_lib32.Guard.isIntegerGte(staffsTabsAndGroups, 0) || import_ts_utils_lib32.Guard.isNonEmptyArray(staffsTabsAndGroups) && staffsTabsAndGroups.every((line) => import_ts_utils_lib32.Guard.isNonEmptyString(line) || import_ts_utils_lib32.Guard.isIntegerGte(line, 0)),
8659
- import_ts_utils_lib32.Guard.isEnumValue(verticalPosition, VerticalPosition)
8866
+ import_ts_utils_lib33.Guard.isNonEmptyString(groupName),
8867
+ import_ts_utils_lib33.Guard.isNonEmptyString(staffsTabsAndGroups) || import_ts_utils_lib33.Guard.isIntegerGte(staffsTabsAndGroups, 0) || import_ts_utils_lib33.Guard.isNonEmptyArray(staffsTabsAndGroups) && staffsTabsAndGroups.every((line) => import_ts_utils_lib33.Guard.isNonEmptyString(line) || import_ts_utils_lib33.Guard.isIntegerGte(line, 0)),
8868
+ import_ts_utils_lib33.Guard.isEnumValue(verticalPosition, VerticalPosition)
8660
8869
  );
8661
8870
  this.doc.addStaffGroup(groupName, staffsTabsAndGroups, verticalPosition);
8662
8871
  return this;
@@ -8696,7 +8905,7 @@ var _DocumentBuilder = class _DocumentBuilder {
8696
8905
  */
8697
8906
  completeRests(voiceId) {
8698
8907
  setAssertFunction("completeRests", voiceId);
8699
- assertArg(import_ts_utils_lib32.Guard.isUndefined(voiceId) || isVoiceId(voiceId) || import_ts_utils_lib32.Guard.isArray(voiceId) && voiceId.every((id) => isVoiceId(id)));
8908
+ assertArg(import_ts_utils_lib33.Guard.isUndefined(voiceId) || isVoiceId(voiceId) || import_ts_utils_lib33.Guard.isArray(voiceId) && voiceId.every((id) => isVoiceId(id)));
8700
8909
  this.getMeasure().completeRests(voiceId);
8701
8910
  return this;
8702
8911
  }
@@ -8710,8 +8919,8 @@ var _DocumentBuilder = class _DocumentBuilder {
8710
8919
  addScaleArpeggio(scale, bottomNote, numOctaves) {
8711
8920
  setAssertFunction("addScaleArpeggio", scale, bottomNote, numOctaves);
8712
8921
  assertArg(
8713
- import_ts_utils_lib32.Guard.isNonEmptyString(bottomNote),
8714
- import_ts_utils_lib32.Guard.isIntegerGte(numOctaves, 1)
8922
+ import_ts_utils_lib33.Guard.isNonEmptyString(bottomNote),
8923
+ import_ts_utils_lib33.Guard.isIntegerGte(numOctaves, 1)
8715
8924
  );
8716
8925
  let ts = this.getMeasure().getTimeSignature();
8717
8926
  let notes = scale.getScaleNotes(bottomNote, numOctaves);
@@ -8798,10 +9007,10 @@ var ScoreObjectEvent = class extends ScoreEvent {
8798
9007
 
8799
9008
  // src/score/pub/music-interface.ts
8800
9009
  var Audio2 = __toESM(require("@tspro/web-music-score/audio"));
8801
- var import_ts_utils_lib34 = require("@tspro/ts-utils-lib");
9010
+ var import_ts_utils_lib35 = require("@tspro/ts-utils-lib");
8802
9011
 
8803
9012
  // src/score/pub/music-objects.ts
8804
- var import_ts_utils_lib33 = require("@tspro/ts-utils-lib");
9013
+ var import_ts_utils_lib34 = require("@tspro/ts-utils-lib");
8805
9014
  var import_core20 = require("@tspro/web-music-score/core");
8806
9015
  function assertArg2(condition, argName, argValue) {
8807
9016
  if (!condition) {
@@ -8982,7 +9191,7 @@ var _MDocument = class _MDocument extends MusicInterface5 {
8982
9191
  * @returns - Player instance.
8983
9192
  */
8984
9193
  play(playStateChangeListener) {
8985
- assertArg2(import_ts_utils_lib33.Guard.isFunctionOrUndefined(playStateChangeListener), "playStateChangeListener", playStateChangeListener);
9194
+ assertArg2(import_ts_utils_lib34.Guard.isFunctionOrUndefined(playStateChangeListener), "playStateChangeListener", playStateChangeListener);
8986
9195
  return new MPlayer(this, playStateChangeListener).play();
8987
9196
  }
8988
9197
  };
@@ -9012,7 +9221,7 @@ var _MEnding = class _MEnding extends MusicInterface5 {
9012
9221
  * @returns - Boolean whether this ending has asked passage number.
9013
9222
  */
9014
9223
  hasPassage(passage) {
9015
- assertArg2(import_ts_utils_lib33.Guard.isIntegerGte(passage, 1), "passage", passage);
9224
+ assertArg2(import_ts_utils_lib34.Guard.isIntegerGte(passage, 1), "passage", passage);
9016
9225
  return this.obj.hasPassage(passage);
9017
9226
  }
9018
9227
  };
@@ -9145,10 +9354,10 @@ var _MBarLineLeft = class _MBarLineLeft extends MusicInterface5 {
9145
9354
  /** Object name. */
9146
9355
  __publicField(_MBarLineLeft, "Name", "BarLineLeft");
9147
9356
  var MBarLineLeft = _MBarLineLeft;
9148
- var _MStaffTabBarLine = class _MStaffTabBarLine extends MusicInterface5 {
9357
+ var _MStaffBarLine = class _MStaffBarLine extends MusicInterface5 {
9149
9358
  /** @internal */
9150
9359
  constructor(obj) {
9151
- super(_MStaffTabBarLine.Name);
9360
+ super(_MStaffBarLine.Name);
9152
9361
  this.obj = obj;
9153
9362
  }
9154
9363
  /** @internal */
@@ -9164,7 +9373,7 @@ var _MStaffTabBarLine = class _MStaffTabBarLine extends MusicInterface5 {
9164
9373
  if (barLine instanceof ObjBarLineLeft || barLine instanceof ObjBarLineRight) {
9165
9374
  return barLine.getMusicInterface();
9166
9375
  } else {
9167
- throw new import_core20.MusicError(import_core20.MusicErrorType.Score, `Bar line not let nor right.`);
9376
+ throw new import_core20.MusicError(import_core20.MusicErrorType.Score, `Bar line not left nor right.`);
9168
9377
  }
9169
9378
  }
9170
9379
  /**
@@ -9176,8 +9385,8 @@ var _MStaffTabBarLine = class _MStaffTabBarLine extends MusicInterface5 {
9176
9385
  }
9177
9386
  };
9178
9387
  /** Object name. */
9179
- __publicField(_MStaffTabBarLine, "Name", "StaffTabBarLine");
9180
- var MStaffTabBarLine = _MStaffTabBarLine;
9388
+ __publicField(_MStaffBarLine, "Name", "StaffBarLine");
9389
+ var MStaffBarLine = _MStaffBarLine;
9181
9390
  var _MNoteGroup = class _MNoteGroup extends MusicInterface5 {
9182
9391
  /** @internal */
9183
9392
  constructor(obj) {
@@ -9458,6 +9667,27 @@ var _MScoreRow = class _MScoreRow extends MusicInterface5 {
9458
9667
  /** Object name. */
9459
9668
  __publicField(_MScoreRow, "Name", "ScoreRow");
9460
9669
  var MScoreRow = _MScoreRow;
9670
+ var _MScoreRowGroup = class _MScoreRowGroup extends MusicInterface5 {
9671
+ /** @internal */
9672
+ constructor(obj) {
9673
+ super(_MScoreRowGroup.Name);
9674
+ this.obj = obj;
9675
+ }
9676
+ /** @internal */
9677
+ getMusicObject() {
9678
+ return this.obj;
9679
+ }
9680
+ /**
9681
+ * Get instrument name.
9682
+ * @returns - instrument name.
9683
+ */
9684
+ getInstrument() {
9685
+ return this.obj.instrument;
9686
+ }
9687
+ };
9688
+ /** Object name. */
9689
+ __publicField(_MScoreRowGroup, "Name", "ScoreRowGroup");
9690
+ var MScoreRowGroup = _MScoreRowGroup;
9461
9691
  var _MStaff = class _MStaff extends MusicInterface5 {
9462
9692
  /** @internal */
9463
9693
  constructor(obj) {
@@ -9699,7 +9929,7 @@ var _MPlayer = class _MPlayer {
9699
9929
  constructor(doc, playStateChangeListener) {
9700
9930
  __publicField(this, "player");
9701
9931
  assertArg3(doc instanceof MDocument2, "doc", doc);
9702
- assertArg3(import_ts_utils_lib34.Guard.isFunctionOrUndefined(playStateChangeListener), "playStateChangeListener", playStateChangeListener);
9932
+ assertArg3(import_ts_utils_lib35.Guard.isFunctionOrUndefined(playStateChangeListener), "playStateChangeListener", playStateChangeListener);
9703
9933
  this.player = new Player();
9704
9934
  this.player.setDocument(doc.getMusicObject());
9705
9935
  this.player.setCursorPositionChangeListener((cursorRect) => {
@@ -9743,7 +9973,7 @@ var _MPlayer = class _MPlayer {
9743
9973
  return this;
9744
9974
  }
9745
9975
  };
9746
- __publicField(_MPlayer, "currentlyPlaying", new import_ts_utils_lib34.ValueSet());
9976
+ __publicField(_MPlayer, "currentlyPlaying", new import_ts_utils_lib35.ValueSet());
9747
9977
  var MPlayer = _MPlayer;
9748
9978
  var MRenderContext2 = class {
9749
9979
  /**
@@ -9759,7 +9989,7 @@ var MRenderContext2 = class {
9759
9989
  * @returns - This render context instance.
9760
9990
  */
9761
9991
  setDocument(doc) {
9762
- assertArg3(import_ts_utils_lib34.Guard.isUndefined(doc) || doc instanceof MDocument2, "doc", doc);
9992
+ assertArg3(import_ts_utils_lib35.Guard.isUndefined(doc) || doc instanceof MDocument2, "doc", doc);
9763
9993
  this.ctx.setDocument(doc);
9764
9994
  return this;
9765
9995
  }
@@ -9769,7 +9999,7 @@ var MRenderContext2 = class {
9769
9999
  * @returns - This render context instance.
9770
10000
  */
9771
10001
  setCanvas(canvas) {
9772
- canvas = require_t(import_ts_utils_lib34.Utils.Dom.getCanvas(canvas), typeof canvas === "string" ? "Cannot set render canvas because invalid canvas id: " + canvas : "Cannot set render canvas because given canvas is undefined.");
10002
+ canvas = require_t(import_ts_utils_lib35.Utils.Dom.getCanvas(canvas), typeof canvas === "string" ? "Cannot set render canvas because invalid canvas id: " + canvas : "Cannot set render canvas because given canvas is undefined.");
9773
10003
  this.ctx.setCanvas(canvas);
9774
10004
  return this;
9775
10005
  }
@@ -9778,7 +10008,7 @@ var MRenderContext2 = class {
9778
10008
  * @param scoreEventListener - Score event listener.
9779
10009
  */
9780
10010
  setScoreEventListener(scoreEventListener) {
9781
- assertArg3(import_ts_utils_lib34.Guard.isFunctionOrUndefined(scoreEventListener), "scoreEventListener", scoreEventListener);
10011
+ assertArg3(import_ts_utils_lib35.Guard.isFunctionOrUndefined(scoreEventListener), "scoreEventListener", scoreEventListener);
9782
10012
  this.ctx.setScoreEventListener(scoreEventListener);
9783
10013
  }
9784
10014
  /**
@@ -9853,7 +10083,7 @@ var _MPlaybackButtons = class _MPlaybackButtons {
9853
10083
  * @returns
9854
10084
  */
9855
10085
  setDocument(doc) {
9856
- assertArg3(import_ts_utils_lib34.Guard.isUndefined(doc) || doc instanceof MDocument2, "doc", doc);
10086
+ assertArg3(import_ts_utils_lib35.Guard.isUndefined(doc) || doc instanceof MDocument2, "doc", doc);
9857
10087
  this.onStop();
9858
10088
  if (doc) {
9859
10089
  this.player = new MPlayer(doc, (playState) => {
@@ -9897,9 +10127,9 @@ var _MPlaybackButtons = class _MPlaybackButtons {
9897
10127
  * @returns - This playback buttons class instance.
9898
10128
  */
9899
10129
  setPlayButton(btn, btnLabel) {
9900
- assertArg3(import_ts_utils_lib34.Guard.isStringOrUndefined(btnLabel), "btnLabel", btnLabel);
10130
+ assertArg3(import_ts_utils_lib35.Guard.isStringOrUndefined(btnLabel), "btnLabel", btnLabel);
9901
10131
  _MPlaybackButtons.removeOnClickListeners(this.playButton, this.onPlay);
9902
- this.playButton = require_t(import_ts_utils_lib34.Utils.Dom.getButton(btn), "Play button required!");
10132
+ this.playButton = require_t(import_ts_utils_lib35.Utils.Dom.getButton(btn), "Play button required!");
9903
10133
  this.playLabel = btnLabel != null ? btnLabel : "Play";
9904
10134
  _MPlaybackButtons.removeOnClickListeners(this.playButton, "all");
9905
10135
  _MPlaybackButtons.addOnClickListener(this.playButton, this.onPlay);
@@ -9913,9 +10143,9 @@ var _MPlaybackButtons = class _MPlaybackButtons {
9913
10143
  * @returns - This playback buttons class instance.
9914
10144
  */
9915
10145
  setStopButton(btn, btnLabel) {
9916
- assertArg3(import_ts_utils_lib34.Guard.isStringOrUndefined(btnLabel), "btnLabel", btnLabel);
10146
+ assertArg3(import_ts_utils_lib35.Guard.isStringOrUndefined(btnLabel), "btnLabel", btnLabel);
9917
10147
  _MPlaybackButtons.removeOnClickListeners(this.stopButton, this.onStop);
9918
- this.stopButton = require_t(import_ts_utils_lib34.Utils.Dom.getButton(btn), "Stop button required!");
10148
+ this.stopButton = require_t(import_ts_utils_lib35.Utils.Dom.getButton(btn), "Stop button required!");
9919
10149
  this.stopLabel = btnLabel != null ? btnLabel : "Stop";
9920
10150
  _MPlaybackButtons.removeOnClickListeners(this.stopButton, "all");
9921
10151
  _MPlaybackButtons.addOnClickListener(this.stopButton, this.onStop);
@@ -9930,10 +10160,10 @@ var _MPlaybackButtons = class _MPlaybackButtons {
9930
10160
  * @returns - This playback buttons class instance.
9931
10161
  */
9932
10162
  setPlayStopButton(btn, playLabel, stopLabel) {
9933
- assertArg3(import_ts_utils_lib34.Guard.isStringOrUndefined(playLabel), "playLabel", playLabel);
9934
- assertArg3(import_ts_utils_lib34.Guard.isStringOrUndefined(stopLabel), "stopLabel", stopLabel);
10163
+ assertArg3(import_ts_utils_lib35.Guard.isStringOrUndefined(playLabel), "playLabel", playLabel);
10164
+ assertArg3(import_ts_utils_lib35.Guard.isStringOrUndefined(stopLabel), "stopLabel", stopLabel);
9935
10165
  _MPlaybackButtons.removeOnClickListeners(this.playStopButton, this.onPlayStop);
9936
- this.playStopButton = require_t(import_ts_utils_lib34.Utils.Dom.getButton(btn), "Play/stop button required!");
10166
+ this.playStopButton = require_t(import_ts_utils_lib35.Utils.Dom.getButton(btn), "Play/stop button required!");
9937
10167
  this.playLabel = playLabel != null ? playLabel : "Play";
9938
10168
  this.stopLabel = stopLabel != null ? stopLabel : "Stop";
9939
10169
  _MPlaybackButtons.removeOnClickListeners(this.playStopButton, "all");
@@ -9948,9 +10178,9 @@ var _MPlaybackButtons = class _MPlaybackButtons {
9948
10178
  * @returns - This playback buttons class instance.
9949
10179
  */
9950
10180
  setPauseButton(btn, btnLabel) {
9951
- assertArg3(import_ts_utils_lib34.Guard.isStringOrUndefined(btnLabel), "btnLabel", btnLabel);
10181
+ assertArg3(import_ts_utils_lib35.Guard.isStringOrUndefined(btnLabel), "btnLabel", btnLabel);
9952
10182
  _MPlaybackButtons.removeOnClickListeners(this.pauseButton, this.onPause);
9953
- this.pauseButton = require_t(import_ts_utils_lib34.Utils.Dom.getButton(btn), "Pause button required!");
10183
+ this.pauseButton = require_t(import_ts_utils_lib35.Utils.Dom.getButton(btn), "Pause button required!");
9954
10184
  this.pauseLabel = btnLabel != null ? btnLabel : "Pause";
9955
10185
  _MPlaybackButtons.removeOnClickListeners(this.pauseButton, "all");
9956
10186
  _MPlaybackButtons.addOnClickListener(this.pauseButton, this.onPause);
@@ -9971,12 +10201,12 @@ var _MPlaybackButtons = class _MPlaybackButtons {
9971
10201
  this.savedOnClickListeners.set(btn, curListeners);
9972
10202
  }
9973
10203
  static addOnClickListener(btn, onClickListener) {
9974
- assertArg3(import_ts_utils_lib34.Guard.isFunction(onClickListener), "onClick", onClickListener);
10204
+ assertArg3(import_ts_utils_lib35.Guard.isFunction(onClickListener), "onClick", onClickListener);
9975
10205
  btn.addEventListener("click", onClickListener);
9976
10206
  this.savedOnClickListeners.getOrCreate(btn, []).push(onClickListener);
9977
10207
  }
9978
10208
  };
9979
- __publicField(_MPlaybackButtons, "savedOnClickListeners", new import_ts_utils_lib34.UniMap());
10209
+ __publicField(_MPlaybackButtons, "savedOnClickListeners", new import_ts_utils_lib35.UniMap());
9980
10210
  var MPlaybackButtons = _MPlaybackButtons;
9981
10211
 
9982
10212
  // src/score/index.ts
@@ -10017,13 +10247,14 @@ var import_core22 = require("@tspro/web-music-score/core");
10017
10247
  MRest,
10018
10248
  MRhythmColumn,
10019
10249
  MScoreRow,
10250
+ MScoreRowGroup,
10020
10251
  MSpecialText,
10021
10252
  MStaff,
10253
+ MStaffBarLine,
10022
10254
  MStaffBeamGroup,
10023
10255
  MStaffNoteGroup,
10024
10256
  MStaffRest,
10025
10257
  MStaffSignature,
10026
- MStaffTabBarLine,
10027
10258
  MTab,
10028
10259
  MTabNoteGroup,
10029
10260
  MTabRhythm,