audio-mixer-ui 0.5.2 → 0.5.3

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.
@@ -3,10 +3,10 @@ import { defineStore as sl } from "pinia";
3
3
  var gl = function() {
4
4
  if (typeof Map < "u")
5
5
  return Map;
6
- function d(l, U) {
6
+ function Z(l, U) {
7
7
  var F = -1;
8
- return l.some(function(Z, Q) {
9
- return Z[0] === U ? (F = Q, !0) : !1;
8
+ return l.some(function(d, Q) {
9
+ return d[0] === U ? (F = Q, !0) : !1;
10
10
  }), F;
11
11
  }
12
12
  return (
@@ -25,22 +25,22 @@ var gl = function() {
25
25
  enumerable: !0,
26
26
  configurable: !0
27
27
  }), l.prototype.get = function(U) {
28
- var F = d(this.__entries__, U), Z = this.__entries__[F];
29
- return Z && Z[1];
28
+ var F = Z(this.__entries__, U), d = this.__entries__[F];
29
+ return d && d[1];
30
30
  }, l.prototype.set = function(U, F) {
31
- var Z = d(this.__entries__, U);
32
- ~Z ? this.__entries__[Z][1] = F : this.__entries__.push([U, F]);
31
+ var d = Z(this.__entries__, U);
32
+ ~d ? this.__entries__[d][1] = F : this.__entries__.push([U, F]);
33
33
  }, l.prototype.delete = function(U) {
34
- var F = this.__entries__, Z = d(F, U);
35
- ~Z && F.splice(Z, 1);
34
+ var F = this.__entries__, d = Z(F, U);
35
+ ~d && F.splice(d, 1);
36
36
  }, l.prototype.has = function(U) {
37
- return !!~d(this.__entries__, U);
37
+ return !!~Z(this.__entries__, U);
38
38
  }, l.prototype.clear = function() {
39
39
  this.__entries__.splice(0);
40
40
  }, l.prototype.forEach = function(U, F) {
41
41
  F === void 0 && (F = null);
42
- for (var Z = 0, Q = this.__entries__; Z < Q.length; Z++) {
43
- var V = Q[Z];
42
+ for (var d = 0, Q = this.__entries__; d < Q.length; d++) {
43
+ var V = Q[d];
44
44
  U.call(F, V[1], V[0]);
45
45
  }
46
46
  }, l;
@@ -49,16 +49,16 @@ var gl = function() {
49
49
  }(), ul = typeof window < "u" && typeof document < "u" && window.document === document, ml = function() {
50
50
  return typeof global < "u" && global.Math === Math ? global : typeof self < "u" && self.Math === Math ? self : typeof window < "u" && window.Math === Math ? window : Function("return this")();
51
51
  }(), dU = function() {
52
- return typeof requestAnimationFrame == "function" ? requestAnimationFrame.bind(ml) : function(d) {
52
+ return typeof requestAnimationFrame == "function" ? requestAnimationFrame.bind(ml) : function(Z) {
53
53
  return setTimeout(function() {
54
- return d(Date.now());
54
+ return Z(Date.now());
55
55
  }, 1e3 / 60);
56
56
  };
57
57
  }(), ZU = 2;
58
- function QU(d, l) {
59
- var U = !1, F = !1, Z = 0;
58
+ function QU(Z, l) {
59
+ var U = !1, F = !1, d = 0;
60
60
  function Q() {
61
- U && (U = !1, d()), F && t();
61
+ U && (U = !1, Z()), F && t();
62
62
  }
63
63
  function V() {
64
64
  dU(Q);
@@ -66,163 +66,163 @@ function QU(d, l) {
66
66
  function t() {
67
67
  var R = Date.now();
68
68
  if (U) {
69
- if (R - Z < ZU)
69
+ if (R - d < ZU)
70
70
  return;
71
71
  F = !0;
72
72
  } else
73
73
  U = !0, F = !1, setTimeout(V, l);
74
- Z = R;
74
+ d = R;
75
75
  }
76
76
  return t;
77
77
  }
78
78
  var VU = 20, tU = ["top", "right", "bottom", "left", "width", "height", "size", "weight"], RU = typeof MutationObserver < "u", aU = (
79
79
  /** @class */
80
80
  function() {
81
- function d() {
81
+ function Z() {
82
82
  this.connected_ = !1, this.mutationEventsAdded_ = !1, this.mutationsObserver_ = null, this.observers_ = [], this.onTransitionEnd_ = this.onTransitionEnd_.bind(this), this.refresh = QU(this.refresh.bind(this), VU);
83
83
  }
84
- return d.prototype.addObserver = function(l) {
84
+ return Z.prototype.addObserver = function(l) {
85
85
  ~this.observers_.indexOf(l) || this.observers_.push(l), this.connected_ || this.connect_();
86
- }, d.prototype.removeObserver = function(l) {
86
+ }, Z.prototype.removeObserver = function(l) {
87
87
  var U = this.observers_, F = U.indexOf(l);
88
88
  ~F && U.splice(F, 1), !U.length && this.connected_ && this.disconnect_();
89
- }, d.prototype.refresh = function() {
89
+ }, Z.prototype.refresh = function() {
90
90
  var l = this.updateObservers_();
91
91
  l && this.refresh();
92
- }, d.prototype.updateObservers_ = function() {
92
+ }, Z.prototype.updateObservers_ = function() {
93
93
  var l = this.observers_.filter(function(U) {
94
94
  return U.gatherActive(), U.hasActive();
95
95
  });
96
96
  return l.forEach(function(U) {
97
97
  return U.broadcastActive();
98
98
  }), l.length > 0;
99
- }, d.prototype.connect_ = function() {
99
+ }, Z.prototype.connect_ = function() {
100
100
  !ul || this.connected_ || (document.addEventListener("transitionend", this.onTransitionEnd_), window.addEventListener("resize", this.refresh), RU ? (this.mutationsObserver_ = new MutationObserver(this.refresh), this.mutationsObserver_.observe(document, {
101
101
  attributes: !0,
102
102
  childList: !0,
103
103
  characterData: !0,
104
104
  subtree: !0
105
105
  })) : (document.addEventListener("DOMSubtreeModified", this.refresh), this.mutationEventsAdded_ = !0), this.connected_ = !0);
106
- }, d.prototype.disconnect_ = function() {
106
+ }, Z.prototype.disconnect_ = function() {
107
107
  !ul || !this.connected_ || (document.removeEventListener("transitionend", this.onTransitionEnd_), window.removeEventListener("resize", this.refresh), this.mutationsObserver_ && this.mutationsObserver_.disconnect(), this.mutationEventsAdded_ && document.removeEventListener("DOMSubtreeModified", this.refresh), this.mutationsObserver_ = null, this.mutationEventsAdded_ = !1, this.connected_ = !1);
108
- }, d.prototype.onTransitionEnd_ = function(l) {
109
- var U = l.propertyName, F = U === void 0 ? "" : U, Z = tU.some(function(Q) {
108
+ }, Z.prototype.onTransitionEnd_ = function(l) {
109
+ var U = l.propertyName, F = U === void 0 ? "" : U, d = tU.some(function(Q) {
110
110
  return !!~F.indexOf(Q);
111
111
  });
112
- Z && this.refresh();
113
- }, d.getInstance = function() {
114
- return this.instance_ || (this.instance_ = new d()), this.instance_;
115
- }, d.instance_ = null, d;
112
+ d && this.refresh();
113
+ }, Z.getInstance = function() {
114
+ return this.instance_ || (this.instance_ = new Z()), this.instance_;
115
+ }, Z.instance_ = null, Z;
116
116
  }()
117
- ), Hl = function(d, l) {
117
+ ), Hl = function(Z, l) {
118
118
  for (var U = 0, F = Object.keys(l); U < F.length; U++) {
119
- var Z = F[U];
120
- Object.defineProperty(d, Z, {
121
- value: l[Z],
119
+ var d = F[U];
120
+ Object.defineProperty(Z, d, {
121
+ value: l[d],
122
122
  enumerable: !1,
123
123
  writable: !1,
124
124
  configurable: !0
125
125
  });
126
126
  }
127
- return d;
128
- }, dl = function(d) {
129
- var l = d && d.ownerDocument && d.ownerDocument.defaultView;
127
+ return Z;
128
+ }, dl = function(Z) {
129
+ var l = Z && Z.ownerDocument && Z.ownerDocument.defaultView;
130
130
  return l || ml;
131
131
  }, Dl = hl(0, 0, 0, 0);
132
- function Wl(d) {
133
- return parseFloat(d) || 0;
132
+ function Wl(Z) {
133
+ return parseFloat(Z) || 0;
134
134
  }
135
- function Tl(d) {
135
+ function Tl(Z) {
136
136
  for (var l = [], U = 1; U < arguments.length; U++)
137
137
  l[U - 1] = arguments[U];
138
- return l.reduce(function(F, Z) {
139
- var Q = d["border-" + Z + "-width"];
138
+ return l.reduce(function(F, d) {
139
+ var Q = Z["border-" + d + "-width"];
140
140
  return F + Wl(Q);
141
141
  }, 0);
142
142
  }
143
- function nU(d) {
144
- for (var l = ["top", "right", "bottom", "left"], U = {}, F = 0, Z = l; F < Z.length; F++) {
145
- var Q = Z[F], V = d["padding-" + Q];
143
+ function nU(Z) {
144
+ for (var l = ["top", "right", "bottom", "left"], U = {}, F = 0, d = l; F < d.length; F++) {
145
+ var Q = d[F], V = Z["padding-" + Q];
146
146
  U[Q] = Wl(V);
147
147
  }
148
148
  return U;
149
149
  }
150
- function mU(d) {
151
- var l = d.getBBox();
150
+ function mU(Z) {
151
+ var l = Z.getBBox();
152
152
  return hl(0, 0, l.width, l.height);
153
153
  }
154
- function WU(d) {
155
- var l = d.clientWidth, U = d.clientHeight;
154
+ function WU(Z) {
155
+ var l = Z.clientWidth, U = Z.clientHeight;
156
156
  if (!l && !U)
157
157
  return Dl;
158
- var F = dl(d).getComputedStyle(d), Z = nU(F), Q = Z.left + Z.right, V = Z.top + Z.bottom, t = Wl(F.width), R = Wl(F.height);
159
- if (F.boxSizing === "border-box" && (Math.round(t + Q) !== l && (t -= Tl(F, "left", "right") + Q), Math.round(R + V) !== U && (R -= Tl(F, "top", "bottom") + V)), !cU(d)) {
158
+ var F = dl(Z).getComputedStyle(Z), d = nU(F), Q = d.left + d.right, V = d.top + d.bottom, t = Wl(F.width), R = Wl(F.height);
159
+ if (F.boxSizing === "border-box" && (Math.round(t + Q) !== l && (t -= Tl(F, "left", "right") + Q), Math.round(R + V) !== U && (R -= Tl(F, "top", "bottom") + V)), !cU(Z)) {
160
160
  var a = Math.round(t + Q) - l, n = Math.round(R + V) - U;
161
161
  Math.abs(a) !== 1 && (t -= a), Math.abs(n) !== 1 && (R -= n);
162
162
  }
163
- return hl(Z.left, Z.top, t, R);
163
+ return hl(d.left, d.top, t, R);
164
164
  }
165
165
  var bU = /* @__PURE__ */ function() {
166
- return typeof SVGGraphicsElement < "u" ? function(d) {
167
- return d instanceof dl(d).SVGGraphicsElement;
168
- } : function(d) {
169
- return d instanceof dl(d).SVGElement && typeof d.getBBox == "function";
166
+ return typeof SVGGraphicsElement < "u" ? function(Z) {
167
+ return Z instanceof dl(Z).SVGGraphicsElement;
168
+ } : function(Z) {
169
+ return Z instanceof dl(Z).SVGElement && typeof Z.getBBox == "function";
170
170
  };
171
171
  }();
172
- function cU(d) {
173
- return d === dl(d).document.documentElement;
172
+ function cU(Z) {
173
+ return Z === dl(Z).document.documentElement;
174
174
  }
175
- function eU(d) {
176
- return ul ? bU(d) ? mU(d) : WU(d) : Dl;
175
+ function eU(Z) {
176
+ return ul ? bU(Z) ? mU(Z) : WU(Z) : Dl;
177
177
  }
178
- function sU(d) {
179
- var l = d.x, U = d.y, F = d.width, Z = d.height, Q = typeof DOMRectReadOnly < "u" ? DOMRectReadOnly : Object, V = Object.create(Q.prototype);
178
+ function sU(Z) {
179
+ var l = Z.x, U = Z.y, F = Z.width, d = Z.height, Q = typeof DOMRectReadOnly < "u" ? DOMRectReadOnly : Object, V = Object.create(Q.prototype);
180
180
  return Hl(V, {
181
181
  x: l,
182
182
  y: U,
183
183
  width: F,
184
- height: Z,
184
+ height: d,
185
185
  top: U,
186
186
  right: l + F,
187
- bottom: Z + U,
187
+ bottom: d + U,
188
188
  left: l
189
189
  }), V;
190
190
  }
191
- function hl(d, l, U, F) {
192
- return { x: d, y: l, width: U, height: F };
191
+ function hl(Z, l, U, F) {
192
+ return { x: Z, y: l, width: U, height: F };
193
193
  }
194
194
  var hU = (
195
195
  /** @class */
196
196
  function() {
197
- function d(l) {
197
+ function Z(l) {
198
198
  this.broadcastWidth = 0, this.broadcastHeight = 0, this.contentRect_ = hl(0, 0, 0, 0), this.target = l;
199
199
  }
200
- return d.prototype.isActive = function() {
200
+ return Z.prototype.isActive = function() {
201
201
  var l = eU(this.target);
202
202
  return this.contentRect_ = l, l.width !== this.broadcastWidth || l.height !== this.broadcastHeight;
203
- }, d.prototype.broadcastRect = function() {
203
+ }, Z.prototype.broadcastRect = function() {
204
204
  var l = this.contentRect_;
205
205
  return this.broadcastWidth = l.width, this.broadcastHeight = l.height, l;
206
- }, d;
206
+ }, Z;
207
207
  }()
208
208
  ), BU = (
209
209
  /** @class */
210
210
  /* @__PURE__ */ function() {
211
- function d(l, U) {
211
+ function Z(l, U) {
212
212
  var F = sU(U);
213
213
  Hl(this, { target: l, contentRect: F });
214
214
  }
215
- return d;
215
+ return Z;
216
216
  }()
217
217
  ), JU = (
218
218
  /** @class */
219
219
  function() {
220
- function d(l, U, F) {
220
+ function Z(l, U, F) {
221
221
  if (this.activeObservations_ = [], this.observations_ = new gl(), typeof l != "function")
222
222
  throw new TypeError("The callback provided as parameter 1 is not a function.");
223
223
  this.callback_ = l, this.controller_ = U, this.callbackCtx_ = F;
224
224
  }
225
- return d.prototype.observe = function(l) {
225
+ return Z.prototype.observe = function(l) {
226
226
  if (!arguments.length)
227
227
  throw new TypeError("1 argument required, but only 0 present.");
228
228
  if (!(typeof Element > "u" || !(Element instanceof Object))) {
@@ -231,7 +231,7 @@ var hU = (
231
231
  var U = this.observations_;
232
232
  U.has(l) || (U.set(l, new hU(l)), this.controller_.addObserver(this), this.controller_.refresh());
233
233
  }
234
- }, d.prototype.unobserve = function(l) {
234
+ }, Z.prototype.unobserve = function(l) {
235
235
  if (!arguments.length)
236
236
  throw new TypeError("1 argument required, but only 0 present.");
237
237
  if (!(typeof Element > "u" || !(Element instanceof Object))) {
@@ -240,62 +240,62 @@ var hU = (
240
240
  var U = this.observations_;
241
241
  U.has(l) && (U.delete(l), U.size || this.controller_.removeObserver(this));
242
242
  }
243
- }, d.prototype.disconnect = function() {
243
+ }, Z.prototype.disconnect = function() {
244
244
  this.clearActive(), this.observations_.clear(), this.controller_.removeObserver(this);
245
- }, d.prototype.gatherActive = function() {
245
+ }, Z.prototype.gatherActive = function() {
246
246
  var l = this;
247
247
  this.clearActive(), this.observations_.forEach(function(U) {
248
248
  U.isActive() && l.activeObservations_.push(U);
249
249
  });
250
- }, d.prototype.broadcastActive = function() {
250
+ }, Z.prototype.broadcastActive = function() {
251
251
  if (this.hasActive()) {
252
252
  var l = this.callbackCtx_, U = this.activeObservations_.map(function(F) {
253
253
  return new BU(F.target, F.broadcastRect());
254
254
  });
255
255
  this.callback_.call(l, U, l), this.clearActive();
256
256
  }
257
- }, d.prototype.clearActive = function() {
257
+ }, Z.prototype.clearActive = function() {
258
258
  this.activeObservations_.splice(0);
259
- }, d.prototype.hasActive = function() {
259
+ }, Z.prototype.hasActive = function() {
260
260
  return this.activeObservations_.length > 0;
261
- }, d;
261
+ }, Z;
262
262
  }()
263
263
  ), jl = typeof WeakMap < "u" ? /* @__PURE__ */ new WeakMap() : new gl(), Pl = (
264
264
  /** @class */
265
265
  /* @__PURE__ */ function() {
266
- function d(l) {
267
- if (!(this instanceof d))
266
+ function Z(l) {
267
+ if (!(this instanceof Z))
268
268
  throw new TypeError("Cannot call a class as a function.");
269
269
  if (!arguments.length)
270
270
  throw new TypeError("1 argument required, but only 0 present.");
271
271
  var U = aU.getInstance(), F = new JU(l, U, this);
272
272
  jl.set(this, F);
273
273
  }
274
- return d;
274
+ return Z;
275
275
  }()
276
276
  );
277
277
  [
278
278
  "observe",
279
279
  "unobserve",
280
280
  "disconnect"
281
- ].forEach(function(d) {
282
- Pl.prototype[d] = function() {
281
+ ].forEach(function(Z) {
282
+ Pl.prototype[Z] = function() {
283
283
  var l;
284
- return (l = jl.get(this))[d].apply(l, arguments);
284
+ return (l = jl.get(this))[Z].apply(l, arguments);
285
285
  };
286
286
  });
287
287
  var uU = function() {
288
288
  return typeof ml.ResizeObserver < "u" ? ml.ResizeObserver : Pl;
289
289
  }();
290
- function ll(d) {
290
+ function ll(Z) {
291
291
  const l = x(0), U = x(0);
292
292
  let F = null;
293
- const Z = () => {
293
+ const d = () => {
294
294
  F && (F.disconnect(), F = null);
295
295
  };
296
- return v(() => r(d), () => {
297
- Z();
298
- const V = r(d);
296
+ return v(() => r(Z), () => {
297
+ d();
298
+ const V = r(Z);
299
299
  if (!V) return;
300
300
  F = new uU((R) => {
301
301
  const a = R[0];
@@ -303,15 +303,15 @@ function ll(d) {
303
303
  }), F.observe(V);
304
304
  const t = V.getBoundingClientRect();
305
305
  l.value = t.width, U.value = t.height;
306
- }, { immediate: !0 }), UU(Z), {
306
+ }, { immediate: !0 }), UU(d), {
307
307
  width: yl(l),
308
308
  height: yl(U)
309
309
  };
310
310
  }
311
- const g = (d, l) => {
312
- const U = d.__vccOpts || d;
313
- for (const [F, Z] of l)
314
- U[F] = Z;
311
+ const g = (Z, l) => {
312
+ const U = Z.__vccOpts || Z;
313
+ for (const [F, d] of l)
314
+ U[F] = d;
315
315
  return U;
316
316
  }, GU = {
317
317
  key: 0,
@@ -332,7 +332,7 @@ const g = (d, l) => {
332
332
  valueModifiers: {}
333
333
  }),
334
334
  emits: ["update:value"],
335
- setup(d) {
335
+ setup(Z) {
336
336
  $((i) => ({
337
337
  "083f3e45": c.value,
338
338
  d4833630: W.value,
@@ -340,7 +340,7 @@ const g = (d, l) => {
340
340
  12894835: s.value,
341
341
  "3e9a6a44": N.value
342
342
  }));
343
- const l = d, U = O("root"), { width: F, height: Z } = ll(U), Q = G(() => Math.min(F.value, Z.value)), V = G(() => Math.max(F.value, Z.value)), t = G(() => F.value > Z.value), R = G(() => t.value ? "h-slide" : "v-slide"), a = _(d, "value"), n = G(() => Q.value * 0.8), m = G(() => Q.value * l.thumbLength * 0.8), W = G(() => (t.value ? m : n).value + "px"), c = G(() => (t.value ? n : m).value + "px"), s = G(() => Q.value * 0.1 + "px"), N = G(() => (V.value - m.value) * (a.value - l.min) / (l.max - l.min) + "px"), J = G(() => t.value ? "90deg" : "0deg"), p = x(!1), M = x(0), y = (i) => {
343
+ const l = Z, U = O("root"), { width: F, height: d } = ll(U), Q = G(() => Math.min(F.value, d.value)), V = G(() => Math.max(F.value, d.value)), t = G(() => F.value > d.value), R = G(() => t.value ? "h-slide" : "v-slide"), a = _(Z, "value"), n = G(() => Q.value * 0.8), m = G(() => Q.value * l.thumbLength * 0.8), W = G(() => (t.value ? m : n).value + "px"), c = G(() => (t.value ? n : m).value + "px"), s = G(() => Q.value * 0.1 + "px"), N = G(() => (V.value - m.value) * (a.value - l.min) / (l.max - l.min) + "px"), J = G(() => t.value ? "90deg" : "0deg"), p = x(!1), M = x(0), y = (i) => {
344
344
  if (!U.value) return a.value;
345
345
  const z = U.value.getBoundingClientRect(), P = i.touches ? i.touches[0].clientX : i.clientX, B = i.touches ? i.touches[0].clientY : i.clientY;
346
346
  let S;
@@ -382,7 +382,7 @@ const g = (d, l) => {
382
382
  style: { userSelect: "none", touchAction: "none" }
383
383
  }, [
384
384
  z[0] || (z[0] = h("div", { class: "track" }, null, -1)),
385
- d.showLevel ? (X(), Y("div", GU, [
385
+ Z.showLevel ? (X(), Y("div", GU, [
386
386
  (X(), Y(al, null, Sl(10, (P) => h("div", {
387
387
  class: L(["led", "led" + P])
388
388
  }, [
@@ -393,7 +393,7 @@ const g = (d, l) => {
393
393
  ], 2)), 64))
394
394
  ])) : f("", !0),
395
395
  h("div", {
396
- class: L(["thumb", { dragging: p.value, [d.colour]: !0, [d.style]: !0 }])
396
+ class: L(["thumb", { dragging: p.value, [Z.colour]: !0, [Z.style]: !0 }])
397
397
  }, null, 2)
398
398
  ], 34));
399
399
  }
@@ -405,18 +405,18 @@ const g = (d, l) => {
405
405
  default: "left"
406
406
  }
407
407
  },
408
- setup(d) {
408
+ setup(Z) {
409
409
  $((t) => ({
410
410
  "5fddb56d": V.value
411
411
  }));
412
- const l = O("el"), { width: U, height: F } = ll(l), Z = G(() => Math.min(U.value, F.value)), Q = G(() => U.value > F.value ? "h-text" : "v-text"), V = G(() => Z.value * 3 / 4 + "px");
412
+ const l = O("el"), { width: U, height: F } = ll(l), d = G(() => Math.min(U.value, F.value)), Q = G(() => U.value > F.value ? "h-text" : "v-text"), V = G(() => d.value * 3 / 4 + "px");
413
413
  return (t, R) => (X(), Y("div", {
414
414
  ref_key: "el",
415
415
  ref: l,
416
416
  class: "outer"
417
417
  }, [
418
418
  h("div", {
419
- class: L({ [Q.value]: !0, [d.align]: !0 })
419
+ class: L({ [Q.value]: !0, [Z.align]: !0 })
420
420
  }, [
421
421
  Vl(t.$slots, "default", {}, void 0, !0)
422
422
  ], 2)
@@ -431,8 +431,8 @@ const g = (d, l) => {
431
431
  soloModifiers: {}
432
432
  },
433
433
  emits: ["update:mute", "update:solo"],
434
- setup(d) {
435
- const l = _(d, "mute"), U = _(d, "solo"), F = O("outer"), { width: Z, height: Q } = ll(F), V = G(() => Z.value > Q.value * 1.9);
434
+ setup(Z) {
435
+ const l = _(Z, "mute"), U = _(Z, "solo"), F = O("outer"), { width: d, height: Q } = ll(F), V = G(() => d.value > Q.value * 1.9);
436
436
  function t() {
437
437
  l.value = !l.value, U.value = !1;
438
438
  }
@@ -474,7 +474,7 @@ const g = (d, l) => {
474
474
  // Enable other debug/dev features as needed
475
475
  debugMode: !1
476
476
  }
477
- }, kF = () => Gl.enabled, Ol = (d) => Gl.enabled && Gl.features[d], Ul = sl("audioState", {
477
+ }, kF = () => Gl.enabled, Ol = (Z) => Gl.enabled && Gl.features[Z], Ul = sl("audioState", {
478
478
  state: () => ({
479
479
  // Playback state
480
480
  isPlaying: !1,
@@ -502,78 +502,78 @@ const g = (d, l) => {
502
502
  }),
503
503
  getters: {
504
504
  // Format current time as MM:SS
505
- formattedTime: (d) => {
506
- const l = Math.floor(d.currentTime / 60), U = Math.floor(d.currentTime % 60);
505
+ formattedTime: (Z) => {
506
+ const l = Math.floor(Z.currentTime / 60), U = Math.floor(Z.currentTime % 60);
507
507
  return `${l}:${U.toString().padStart(2, "0")}`;
508
508
  },
509
509
  // Get volume for a specific part
510
- getPartVolume: (d) => (l) => d.partVolumes[l] ?? 0.75,
510
+ getPartVolume: (Z) => (l) => Z.partVolumes[l] ?? 0.75,
511
511
  // Check if part is muted
512
- isPartMuted: (d) => (l) => d.partMuted[l] ?? !1,
512
+ isPartMuted: (Z) => (l) => Z.partMuted[l] ?? !1,
513
513
  // Check if part is solo
514
- isPartSolo: (d) => (l) => d.partSolo[l] ?? !1,
514
+ isPartSolo: (Z) => (l) => Z.partSolo[l] ?? !1,
515
515
  // Check if any part has solo enabled (global solo state)
516
- isAnySolo: (d) => Object.values(d.partSolo).some((l) => l === !0),
516
+ isAnySolo: (Z) => Object.values(Z.partSolo).some((l) => l === !0),
517
517
  // Current musical position as string
518
- currentPosition: (d) => {
519
- let l = `${d.currentBar}.${d.currentBeat}`;
520
- return d.currentRepeat > 0 && (l += ` (R${d.currentRepeat})`), l;
518
+ currentPosition: (Z) => {
519
+ let l = `${Z.currentBar}.${Z.currentBeat}`;
520
+ return Z.currentRepeat > 0 && (l += ` (R${Z.currentRepeat})`), l;
521
521
  }
522
522
  },
523
523
  actions: {
524
524
  // Playback state updates
525
- setPlaybackState(d) {
526
- this.isPlaying = d;
525
+ setPlaybackState(Z) {
526
+ this.isPlaying = Z;
527
527
  },
528
- setCurrentTime(d) {
529
- this.currentTime = d;
528
+ setCurrentTime(Z) {
529
+ this.currentTime = Z;
530
530
  },
531
- setPlaybackSpeed(d) {
532
- this.playbackSpeed = d;
531
+ setPlaybackSpeed(Z) {
532
+ this.playbackSpeed = Z;
533
533
  },
534
534
  // Musical position updates
535
- setCurrentBar(d, l = 1, U = 0) {
536
- typeof d == "number" && (this.currentBar = d), typeof l == "number" && (this.currentBeat = l), typeof U == "number" && (this.currentRepeat = U);
535
+ setCurrentBar(Z, l = 1, U = 0) {
536
+ typeof Z == "number" && (this.currentBar = Z), typeof l == "number" && (this.currentBeat = l), typeof U == "number" && (this.currentRepeat = U);
537
537
  },
538
538
  // Volume controls
539
- setMasterVolume(d) {
540
- this.masterVolume = Math.max(0, Math.min(1, d));
539
+ setMasterVolume(Z) {
540
+ this.masterVolume = Math.max(0, Math.min(1, Z));
541
541
  },
542
- setMetronomeVolume(d) {
543
- this.metronomeVolume = Math.max(0, Math.min(1, d));
542
+ setMetronomeVolume(Z) {
543
+ this.metronomeVolume = Math.max(0, Math.min(1, Z));
544
544
  },
545
- setPartVolume(d, l) {
546
- this.partVolumes[d] = Math.max(0, Math.min(1, l));
545
+ setPartVolume(Z, l) {
546
+ this.partVolumes[Z] = Math.max(0, Math.min(1, l));
547
547
  },
548
- setPartMuted(d, l) {
549
- this.partMuted[d] = l;
548
+ setPartMuted(Z, l) {
549
+ this.partMuted[Z] = l;
550
550
  },
551
- setPartSolo(d, l) {
552
- this.partSolo[d] = l;
551
+ setPartSolo(Z, l) {
552
+ this.partSolo[Z] = l;
553
553
  },
554
554
  // Transport features
555
- setLeadInActive(d, l = 1) {
556
- this.isLeadInActive = d, this.leadInBars = l;
555
+ setLeadInActive(Z, l = 1) {
556
+ this.isLeadInActive = Z, this.leadInBars = l;
557
557
  },
558
- setStartingNotesActive(d) {
559
- this.isStartingNotesActive = d;
558
+ setStartingNotesActive(Z) {
559
+ this.isStartingNotesActive = Z;
560
560
  },
561
561
  // Feature toggles
562
- setMetronomeEnabled(d) {
563
- this.metronomeEnabled = d;
562
+ setMetronomeEnabled(Z) {
563
+ this.metronomeEnabled = Z;
564
564
  },
565
- setLeadInEnabled(d) {
566
- this.leadInEnabled = d;
565
+ setLeadInEnabled(Z) {
566
+ this.leadInEnabled = Z;
567
567
  },
568
568
  // Initialize part states
569
- initializeParts(d) {
570
- this.partVolumes = {}, this.partMuted = {}, this.partSolo = {}, d.forEach((l) => {
569
+ initializeParts(Z) {
570
+ this.partVolumes = {}, this.partMuted = {}, this.partSolo = {}, Z.forEach((l) => {
571
571
  this.partVolumes[l.name] = l.volume || 0.75, this.partMuted[l.name] = !1, this.partSolo[l.name] = !1;
572
572
  });
573
573
  },
574
574
  // Initialization state (for blur overlay)
575
- setLoaded(d) {
576
- this.isLoaded = d;
575
+ setLoaded(Z) {
576
+ this.isLoaded = Z;
577
577
  }
578
578
  }
579
579
  }), tl = sl("musicData", {
@@ -592,30 +592,30 @@ const g = (d, l) => {
592
592
  }),
593
593
  getters: {
594
594
  // Get practice mark letters as array
595
- practiceMarkLetters: (d) => Object.keys(d.practiceMarks).sort(),
595
+ practiceMarkLetters: (Z) => Object.keys(Z.practiceMarks).sort(),
596
596
  // Get bar number for practice mark
597
- getBarForMark: (d) => (l) => d.practiceMarks[l],
597
+ getBarForMark: (Z) => (l) => Z.practiceMarks[l],
598
598
  // Get all unique bar numbers
599
- allBars: (d) => {
599
+ allBars: (Z) => {
600
600
  const l = /* @__PURE__ */ new Set();
601
- return d.beats.forEach((U) => {
601
+ return Z.beats.forEach((U) => {
602
602
  U.beat === 1 && l.add(U.bar);
603
603
  }), Array.from(l).sort((U, F) => U - F);
604
604
  },
605
605
  // Check if a bar has repeats
606
- hasRepeats: (d) => (l) => d.beats.some((U) => U.bar === l && U.repeat > 0),
606
+ hasRepeats: (Z) => (l) => Z.beats.some((U) => U.bar === l && U.repeat > 0),
607
607
  // Get the number of repeats for a specific bar
608
- getRepeatCountForBar: (d) => (l) => {
608
+ getRepeatCountForBar: (Z) => (l) => {
609
609
  const U = /* @__PURE__ */ new Set();
610
- return d.beats.forEach((F) => {
610
+ return Z.beats.forEach((F) => {
611
611
  F.bar === l && U.add(F.repeat);
612
612
  }), U.size;
613
613
  }
614
614
  },
615
615
  actions: {
616
616
  // Load musical data
617
- loadMusicData(d) {
618
- this.title = d.title || "Untitled", this.beats = d.beats || [], this.practiceMarks = d.practiceMarks || d.marks || {}, this.parts = (d.parts || []).map((l) => ({
617
+ loadMusicData(Z) {
618
+ this.title = Z.title || "Untitled", this.beats = Z.beats || [], this.practiceMarks = Z.practiceMarks || Z.marks || {}, this.parts = (Z.parts || []).map((l) => ({
619
619
  ...l,
620
620
  solo: l.solo || !1,
621
621
  mute: l.mute || !1
@@ -623,38 +623,38 @@ const g = (d, l) => {
623
623
  },
624
624
  // Calculate total duration from beats
625
625
  calculateDuration() {
626
- this.beats.length > 0 && (this.totalDuration = Math.max(...this.beats.map((d) => d.time)));
626
+ this.beats.length > 0 && (this.totalDuration = Math.max(...this.beats.map((Z) => Z.time)));
627
627
  },
628
628
  // Find the highest bar number
629
629
  calculateMaxBar() {
630
- this.beats.length > 0 && (this.maxBar = Math.max(...this.beats.map((d) => d.bar)));
630
+ this.beats.length > 0 && (this.maxBar = Math.max(...this.beats.map((Z) => Z.bar)));
631
631
  },
632
632
  // Extract time signature from first beat
633
633
  extractTimeSignature() {
634
634
  this.beats.length > 0 && this.beats[0].timeSig && (this.timeSignature = this.beats[0].timeSig), this.beats.length > 0 && this.beats[0].tempo && (this.baseTempo = this.beats[0].tempo);
635
635
  },
636
636
  // Update practice marks
637
- setPracticeMark(d, l) {
638
- this.practiceMarks[d] = l;
637
+ setPracticeMark(Z, l) {
638
+ this.practiceMarks[Z] = l;
639
639
  },
640
- removePracticeMark(d) {
641
- delete this.practiceMarks[d];
640
+ removePracticeMark(Z) {
641
+ delete this.practiceMarks[Z];
642
642
  },
643
643
  // Update beats data (for when MIDI parser provides new beat information)
644
- updateBeats(d) {
645
- console.log("Updating beats in music data store"), this.beats = d, this.calculateDuration(), this.calculateMaxBar(), this.extractTimeSignature();
644
+ updateBeats(Z) {
645
+ console.log("Updating beats in music data store"), this.beats = Z, this.calculateDuration(), this.calculateMaxBar(), this.extractTimeSignature();
646
646
  },
647
647
  // Update total duration (for when audio engine provides actual duration)
648
- setTotalDuration(d) {
649
- console.log("Setting total duration in music data store to:", d), this.totalDuration = d;
648
+ setTotalDuration(Z) {
649
+ console.log("Setting total duration in music data store to:", Z), this.totalDuration = Z;
650
650
  },
651
651
  // Validate bar number
652
- isValidBar(d, l = 0) {
653
- return this.beats.some((U) => U.bar === d && U.repeat === l);
652
+ isValidBar(Z, l = 0) {
653
+ return this.beats.some((U) => U.bar === Z && U.repeat === l);
654
654
  },
655
655
  // Update parts (for when audio engine discovers parts from MIDI)
656
- setParts(d) {
657
- this.parts = d.map((l) => ({
656
+ setParts(Z) {
657
+ this.parts = Z.map((l) => ({
658
658
  name: l.name,
659
659
  volume: l.volume || 0.75,
660
660
  solo: l.solo || !1,
@@ -691,20 +691,20 @@ const g = (d, l) => {
691
691
  }),
692
692
  getters: {
693
693
  // Check if currently playing
694
- isPlaying: (d) => d.transportState === "playing",
694
+ isPlaying: (Z) => Z.transportState === "playing",
695
695
  // Check if paused
696
- isPaused: (d) => d.transportState === "paused",
696
+ isPaused: (Z) => Z.transportState === "paused",
697
697
  // Check if stopped
698
- isStopped: (d) => d.transportState === "stopped",
698
+ isStopped: (Z) => Z.transportState === "stopped",
699
699
  // Check if loop is configured
700
- isLoopConfigured: (d) => d.loopEnabled && d.loopStart && d.loopEnd && d.loopEnd > d.loopStart,
700
+ isLoopConfigured: (Z) => Z.loopEnabled && Z.loopStart && Z.loopEnd && Z.loopEnd > Z.loopStart,
701
701
  // Get loop range as string
702
- loopRange: (d) => !d.loopEnabled || !d.loopStart || !d.loopEnd ? null : `${d.loopStart}-${d.loopEnd}`
702
+ loopRange: (Z) => !Z.loopEnabled || !Z.loopStart || !Z.loopEnd ? null : `${Z.loopStart}-${Z.loopEnd}`
703
703
  },
704
704
  actions: {
705
705
  // Transport controls
706
- setTransportState(d) {
707
- ["stopped", "playing", "paused"].includes(d) && (this.transportState = d);
706
+ setTransportState(Z) {
707
+ ["stopped", "playing", "paused"].includes(Z) && (this.transportState = Z);
708
708
  },
709
709
  play() {
710
710
  this.setTransportState("playing");
@@ -716,55 +716,55 @@ const g = (d, l) => {
716
716
  this.setTransportState("stopped");
717
717
  },
718
718
  // Navigation settings
719
- setAutoPlay(d) {
720
- this.autoPlay = d;
719
+ setAutoPlay(Z) {
720
+ this.autoPlay = Z;
721
721
  },
722
- setLoop(d, l = null, U = null) {
723
- this.loopEnabled = d, l !== null && (this.loopStart = l), U !== null && (this.loopEnd = U);
722
+ setLoop(Z, l = null, U = null) {
723
+ this.loopEnabled = Z, l !== null && (this.loopStart = l), U !== null && (this.loopEnd = U);
724
724
  },
725
- setLoopStart(d) {
726
- this.loopStart = d, this.loopEnd && this.loopEnd <= d && (this.loopEnd = d + 4);
725
+ setLoopStart(Z) {
726
+ this.loopStart = Z, this.loopEnd && this.loopEnd <= Z && (this.loopEnd = Z + 4);
727
727
  },
728
- setLoopEnd(d) {
729
- this.loopEnd = d, this.loopStart && this.loopStart >= d && (this.loopStart = Math.max(1, d - 4));
728
+ setLoopEnd(Z) {
729
+ this.loopEnd = Z, this.loopStart && this.loopStart >= Z && (this.loopStart = Math.max(1, Z - 4));
730
730
  },
731
731
  // Lead-in settings
732
- setLeadInEnabled(d) {
733
- this.leadInEnabled = d;
732
+ setLeadInEnabled(Z) {
733
+ this.leadInEnabled = Z;
734
734
  },
735
- setLeadInBars(d) {
736
- this.leadInBars = Math.max(1, Math.min(4, d));
735
+ setLeadInBars(Z) {
736
+ this.leadInBars = Math.max(1, Math.min(4, Z));
737
737
  },
738
738
  // Starting notes settings
739
- setStartingNotesEnabled(d) {
740
- this.startingNotesEnabled = d;
739
+ setStartingNotesEnabled(Z) {
740
+ this.startingNotesEnabled = Z;
741
741
  },
742
- setStartingNotesSequential(d) {
743
- this.startingNotesSequential = d;
742
+ setStartingNotesSequential(Z) {
743
+ this.startingNotesSequential = Z;
744
744
  },
745
745
  // Metronome settings
746
- setMetronomeEnabled(d) {
747
- this.metronomeEnabled = d;
746
+ setMetronomeEnabled(Z) {
747
+ this.metronomeEnabled = Z;
748
748
  },
749
- setMetronomeVolume(d) {
750
- this.metronomeVolume = Math.max(0, Math.min(1, d));
749
+ setMetronomeVolume(Z) {
750
+ this.metronomeVolume = Math.max(0, Math.min(1, Z));
751
751
  },
752
752
  // UI visibility controls
753
- setTransportControlsVisible(d) {
754
- this.showTransportControls = d;
753
+ setTransportControlsVisible(Z) {
754
+ this.showTransportControls = Z;
755
755
  },
756
- setPartControlsVisible(d) {
757
- this.showPartControls = d;
756
+ setPartControlsVisible(Z) {
757
+ this.showPartControls = Z;
758
758
  },
759
- setNavigationControlsVisible(d) {
760
- this.showNavigationControls = d;
759
+ setNavigationControlsVisible(Z) {
760
+ this.showNavigationControls = Z;
761
761
  },
762
762
  // Position tracking
763
- updateLastBarPosition(d) {
764
- this.lastBarPosition = d;
763
+ updateLastBarPosition(Z) {
764
+ this.lastBarPosition = Z;
765
765
  },
766
- updateLastPracticeMarkUsed(d) {
767
- this.lastPracticeMarkUsed = d;
766
+ updateLastPracticeMarkUsed(Z) {
767
+ this.lastPracticeMarkUsed = Z;
768
768
  },
769
769
  // Reset to defaults
770
770
  resetToDefaults() {
@@ -772,35 +772,35 @@ const g = (d, l) => {
772
772
  }
773
773
  }
774
774
  });
775
- function fl(d) {
776
- return { all: d = d || /* @__PURE__ */ new Map(), on: function(l, U) {
777
- var F = d.get(l);
778
- F ? F.push(U) : d.set(l, [U]);
775
+ function fl(Z) {
776
+ return { all: Z = Z || /* @__PURE__ */ new Map(), on: function(l, U) {
777
+ var F = Z.get(l);
778
+ F ? F.push(U) : Z.set(l, [U]);
779
779
  }, off: function(l, U) {
780
- var F = d.get(l);
781
- F && (U ? F.splice(F.indexOf(U) >>> 0, 1) : d.set(l, []));
780
+ var F = Z.get(l);
781
+ F && (U ? F.splice(F.indexOf(U) >>> 0, 1) : Z.set(l, []));
782
782
  }, emit: function(l, U) {
783
- var F = d.get(l);
784
- F && F.slice().map(function(Z) {
785
- Z(U);
786
- }), (F = d.get("*")) && F.slice().map(function(Z) {
787
- Z(l, U);
783
+ var F = Z.get(l);
784
+ F && F.slice().map(function(d) {
785
+ d(U);
786
+ }), (F = Z.get("*")) && F.slice().map(function(d) {
787
+ d(l, U);
788
788
  });
789
789
  } };
790
790
  }
791
- function Xl(d) {
792
- return { all: d = d || /* @__PURE__ */ new Map(), on: function(l, U) {
793
- var F = d.get(l);
794
- F ? F.push(U) : d.set(l, [U]);
791
+ function Xl(Z) {
792
+ return { all: Z = Z || /* @__PURE__ */ new Map(), on: function(l, U) {
793
+ var F = Z.get(l);
794
+ F ? F.push(U) : Z.set(l, [U]);
795
795
  }, off: function(l, U) {
796
- var F = d.get(l);
797
- F && (U ? F.splice(F.indexOf(U) >>> 0, 1) : d.set(l, []));
796
+ var F = Z.get(l);
797
+ F && (U ? F.splice(F.indexOf(U) >>> 0, 1) : Z.set(l, []));
798
798
  }, emit: function(l, U) {
799
- var F = d.get(l);
800
- F && F.slice().map(function(Z) {
801
- Z(U);
802
- }), (F = d.get("*")) && F.slice().map(function(Z) {
803
- Z(l, U);
799
+ var F = Z.get(l);
800
+ F && F.slice().map(function(d) {
801
+ d(U);
802
+ }), (F = Z.get("*")) && F.slice().map(function(d) {
803
+ d(l, U);
804
804
  });
805
805
  } };
806
806
  }
@@ -840,8 +840,8 @@ class Nl {
840
840
  * @protected
841
841
  */
842
842
  _emitProgress(l, U, F = null) {
843
- const Z = { stage: l, message: U };
844
- F !== null && (Z.progress = Math.max(0, Math.min(1, F))), this.eventBus.emit("initProgress", Z);
843
+ const d = { stage: l, message: U };
844
+ F !== null && (d.progress = Math.max(0, Math.min(1, F))), this.eventBus.emit("initProgress", d);
845
845
  }
846
846
  /**
847
847
  * Initialize the audio engine - load soundfont and set up synthesis
@@ -878,21 +878,21 @@ class Nl {
878
878
  async playMetronomeTick(l, U, F) {
879
879
  try {
880
880
  await this._ensureMetronomeBuffersLoaded();
881
- const Z = U ? this.accentTickBuffer : this.regularTickBuffer;
882
- if (!Z) {
881
+ const d = U ? this.accentTickBuffer : this.regularTickBuffer;
882
+ if (!d) {
883
883
  console.warn("Metronome buffer not available");
884
884
  return;
885
885
  }
886
886
  const Q = this.audioContext.createBufferSource();
887
- Q.buffer = Z;
887
+ Q.buffer = d;
888
888
  const V = this.audioContext.createGain();
889
889
  V.gain.value = F, Q.connect(V);
890
890
  const t = this.getMetronomeOutput();
891
891
  t ? V.connect(t) : V.connect(this.audioContext.destination);
892
892
  const R = Math.max(l, this.audioContext.currentTime);
893
893
  Q.start(R);
894
- } catch (Z) {
895
- console.warn("Buffer metronome playback failed:", Z);
894
+ } catch (d) {
895
+ console.warn("Buffer metronome playback failed:", d);
896
896
  }
897
897
  }
898
898
  /**
@@ -914,12 +914,12 @@ class Nl {
914
914
  const [l, U] = await Promise.all([
915
915
  fetch(pU),
916
916
  fetch(YU)
917
- ]), [F, Z] = await Promise.all([
917
+ ]), [F, d] = await Promise.all([
918
918
  l.arrayBuffer(),
919
919
  U.arrayBuffer()
920
920
  ]), [Q, V] = await Promise.all([
921
921
  this.audioContext.decodeAudioData(F),
922
- this.audioContext.decodeAudioData(Z)
922
+ this.audioContext.decodeAudioData(d)
923
923
  ]);
924
924
  this.regularTickBuffer = Q, this.accentTickBuffer = V;
925
925
  return;
@@ -1012,13 +1012,13 @@ class pl {
1012
1012
  * @param {number} duration - Note duration in seconds
1013
1013
  * @returns {string} Event ID for cancellation
1014
1014
  */
1015
- playNote(l, U, F, Z) {
1015
+ playNote(l, U, F, d) {
1016
1016
  this._validateActive();
1017
1017
  const Q = this.engine.audioContext.currentTime, V = `${this.partId}_${l}_${U}_${Date.now()}`;
1018
- let t = l, R = Z;
1018
+ let t = l, R = d;
1019
1019
  if (l < Q) {
1020
1020
  const c = Q - l;
1021
- t = Q, R = Math.max(0, Z - c);
1021
+ t = Q, R = Math.max(0, d - c);
1022
1022
  }
1023
1023
  if (R <= 0)
1024
1024
  return V;
@@ -1040,11 +1040,11 @@ class pl {
1040
1040
  */
1041
1041
  playPreviewNote(l, U = {}) {
1042
1042
  this._validateActive();
1043
- const F = U.startTime ?? this.engine.audioContext.currentTime + 0.01, Z = U.duration ?? 0.5, Q = U.velocity ?? 100;
1043
+ const F = U.startTime ?? this.engine.audioContext.currentTime + 0.01, d = U.duration ?? 0.5, Q = U.velocity ?? 100;
1044
1044
  let V = null;
1045
- U.instrument !== void 0 && (V = this.getInstrument(), this.setInstrument(U.instrument)), this.playNote(F, l, Q, Z), V !== null && setTimeout(() => {
1045
+ U.instrument !== void 0 && (V = this.getInstrument(), this.setInstrument(U.instrument)), this.playNote(F, l, Q, d), V !== null && setTimeout(() => {
1046
1046
  this.isDestroyed || this.setInstrument(V);
1047
- }, (Z + 0.1) * 1e3);
1047
+ }, (d + 0.1) * 1e3);
1048
1048
  }
1049
1049
  /**
1050
1050
  * Stop all notes on this channel
@@ -1288,7 +1288,7 @@ const Al = {
1288
1288
  helicopter: 125,
1289
1289
  applause: 126,
1290
1290
  gunshot: 127
1291
- }, yU = Object.entries(Al).reduce((d, [l, U]) => (d[U] = l, d), {});
1291
+ }, yU = Object.entries(Al).reduce((Z, [l, U]) => (Z[U] = l, Z), {});
1292
1292
  class EU {
1293
1293
  /**
1294
1294
  * Map common instrument names to MIDI program numbers
@@ -1320,8 +1320,8 @@ class EU {
1320
1320
  }
1321
1321
  }
1322
1322
  class kU extends pl {
1323
- constructor(l, U, F, Z = {}) {
1324
- super(l, U, Z), this.midiChannel = F, this.currentVolume = Z.initialVolume || 1, this.currentInstrument = Z.instrument || "piano", this.outputGain = null, this._setupOutputNode(), this.setVolume(this.currentVolume), Z.instrument && this.setInstrument(Z.instrument);
1323
+ constructor(l, U, F, d = {}) {
1324
+ super(l, U, d), this.midiChannel = F, this.currentVolume = d.initialVolume || 1, this.currentInstrument = d.instrument || "piano", this.outputGain = null, this._setupOutputNode(), this.setVolume(this.currentVolume), d.instrument && this.setInstrument(d.instrument);
1325
1325
  }
1326
1326
  getOutputNode() {
1327
1327
  return this.outputGain;
@@ -1335,8 +1335,8 @@ class kU extends pl {
1335
1335
  _actualNoteOn(l, U) {
1336
1336
  const F = this.engine._getSynthesizer();
1337
1337
  if (F && F.noteOn) {
1338
- const Z = Math.round(U * this.currentVolume);
1339
- F.noteOn(this.midiChannel, l, Z);
1338
+ const d = Math.round(U * this.currentVolume);
1339
+ F.noteOn(this.midiChannel, l, d);
1340
1340
  }
1341
1341
  }
1342
1342
  /**
@@ -1388,7 +1388,7 @@ class kU extends pl {
1388
1388
  * @param {number} duration - Note duration in seconds
1389
1389
  * @returns {string} Event ID for compatibility
1390
1390
  */
1391
- playNote(l, U, F, Z) {
1391
+ playNote(l, U, F, d) {
1392
1392
  this._validateActive();
1393
1393
  const Q = `${this.partId}_${l}_${U}_${Date.now()}`, V = this.engine._getSynthesizer();
1394
1394
  if (V && V.post) {
@@ -1413,13 +1413,13 @@ class kU extends pl {
1413
1413
  channelOffset: 0,
1414
1414
  force: !1,
1415
1415
  options: {
1416
- time: l + Z
1416
+ time: l + d
1417
1417
  // Precise note-off timing!
1418
1418
  }
1419
1419
  }
1420
1420
  });
1421
1421
  } else
1422
- return super.playNote(l, U, F, Z);
1422
+ return super.playNote(l, U, F, d);
1423
1423
  return Q;
1424
1424
  }
1425
1425
  /**
@@ -1475,7 +1475,7 @@ class rU extends Nl {
1475
1475
  this._emitProgress("loading-soundfont", "Soundfont provided"), F = l;
1476
1476
  else
1477
1477
  throw new Error("Invalid soundfont data type. Expected string path or ArrayBuffer.");
1478
- this._emitProgress("loading-worklet", "Loading audio worklet processor..."), await this._loadAudioWorkletSafely(), console.log("AudioWorklet loaded. Note: Worklet processor may persist across page reloads."), this._emitProgress("creating-synth", "Setting up audio channels..."), this._setupIndividualOutputs(), this.dummyTarget = this.audioContext.createGain(), await new Promise((Z) => setTimeout(Z, 50)), this._emitProgress("creating-synth", "Initializing synthesizer..."), this.synthesizer = new U(this.audioContext), this._emitProgress("loading-soundbank", "Loading soundbank into synthesizer..."), await this.synthesizer.soundBankManager.addSoundBank(F, "main"), await this.synthesizer.isReady, this._emitProgress("finalizing", "Finalizing audio setup..."), this._connectIndividualOutputs(), this._initializeMetronomeChannel(), this._emitProgress("ready", "Audio engine ready"), this.isInitialized = !0;
1478
+ this._emitProgress("loading-worklet", "Loading audio worklet processor..."), await this._loadAudioWorkletSafely(), console.log("AudioWorklet loaded. Note: Worklet processor may persist across page reloads."), this._emitProgress("creating-synth", "Setting up audio channels..."), this._setupIndividualOutputs(), this.dummyTarget = this.audioContext.createGain(), await new Promise((d) => setTimeout(d, 50)), this._emitProgress("creating-synth", "Initializing synthesizer..."), this.synthesizer = new U(this.audioContext), this._emitProgress("loading-soundbank", "Loading soundbank into synthesizer..."), await this.synthesizer.soundBankManager.addSoundBank(F, "main"), await this.synthesizer.isReady, this._emitProgress("finalizing", "Finalizing audio setup..."), this._connectIndividualOutputs(), this._initializeMetronomeChannel(), this._emitProgress("ready", "Audio engine ready"), this.isInitialized = !0;
1479
1479
  }
1480
1480
  createChannel(l, U = {}) {
1481
1481
  if (this._validateInitialized(), this.partToMidiChannel.has(l))
@@ -1484,13 +1484,13 @@ class rU extends Nl {
1484
1484
  if (F >= 15)
1485
1485
  throw new Error("Maximum number of musical part channels (15) exceeded. Channel 15 is reserved for metronome.");
1486
1486
  this.channelCounter++, this.partToMidiChannel.set(l, F), this.midiChannelToPart.set(F, l);
1487
- const Z = new kU(
1487
+ const d = new kU(
1488
1488
  this,
1489
1489
  l,
1490
1490
  F,
1491
1491
  U
1492
1492
  );
1493
- return this._registerChannel(Z), U.instrument && Z.setInstrument(U.instrument), Z;
1493
+ return this._registerChannel(d), U.instrument && d.setInstrument(U.instrument), d;
1494
1494
  }
1495
1495
  allSoundsOff() {
1496
1496
  if (this.synthesizer) {
@@ -1588,8 +1588,8 @@ class rU extends Nl {
1588
1588
  const U = await fetch(l);
1589
1589
  if (!U.ok)
1590
1590
  throw new Error(`Failed to load soundfont: ${U.status} ${U.statusText}`);
1591
- const F = U.headers.get("content-length"), Z = F ? parseInt(F, 10) : null;
1592
- if (!Z || !U.body)
1591
+ const F = U.headers.get("content-length"), d = F ? parseInt(F, 10) : null;
1592
+ if (!d || !U.body)
1593
1593
  return await U.arrayBuffer();
1594
1594
  const Q = U.body.getReader();
1595
1595
  let V = 0;
@@ -1598,10 +1598,10 @@ class rU extends Nl {
1598
1598
  const { done: n, value: m } = await Q.read();
1599
1599
  if (n) break;
1600
1600
  t.push(m), V += m.length;
1601
- const W = V / Z, c = Math.round(W * 100);
1601
+ const W = V / d, c = Math.round(W * 100);
1602
1602
  this._emitProgress(
1603
1603
  "loading-soundfont",
1604
- `Downloading soundfont: ${c}% (${Math.round(V / 1024)} KB / ${Math.round(Z / 1024)} KB)`,
1604
+ `Downloading soundfont: ${c}% (${Math.round(V / 1024)} KB / ${Math.round(d / 1024)} KB)`,
1605
1605
  W
1606
1606
  );
1607
1607
  }
@@ -1624,7 +1624,7 @@ class rU extends Nl {
1624
1624
  if (console.warn(`AudioWorklet loading failed (attempt ${l}/5):`, U.message), l === 5)
1625
1625
  throw new Error(`AudioWorklet failed after 5 attempts: ${U.message}`);
1626
1626
  const F = l * 500;
1627
- await new Promise((Z) => setTimeout(Z, F));
1627
+ await new Promise((d) => setTimeout(d, F));
1628
1628
  }
1629
1629
  }
1630
1630
  /**
@@ -1653,8 +1653,8 @@ class rU extends Nl {
1653
1653
  */
1654
1654
  async playMetronomeTick(l, U, F) {
1655
1655
  try {
1656
- const Z = this.getMetronomeChannel(), Q = this._getSynthesizer();
1657
- if (!Z || !Q)
1656
+ const d = this.getMetronomeChannel(), Q = this._getSynthesizer();
1657
+ if (!d || !Q)
1658
1658
  return super.playMetronomeTick(l, U, F);
1659
1659
  const V = 15, t = U ? 86 : 60, R = Math.round(Math.min(127, Math.max(0, F * (U ? 127 : 100)))), a = this.audioContext.currentTime, n = Math.max(l, a), m = n - a;
1660
1660
  Q.post ? (Q.post({
@@ -1688,8 +1688,8 @@ class rU extends Nl {
1688
1688
  Q.noteOff && Q.noteOff(V, t);
1689
1689
  }, 100);
1690
1690
  }, m * 1e3);
1691
- } catch (Z) {
1692
- return console.warn("MIDI metronome failed, falling back to buffers:", Z), super.playMetronomeTick(l, U, F);
1691
+ } catch (d) {
1692
+ return console.warn("MIDI metronome failed, falling back to buffers:", d), super.playMetronomeTick(l, U, F);
1693
1693
  }
1694
1694
  }
1695
1695
  /**
@@ -1775,12 +1775,8 @@ class LU {
1775
1775
  for (const F of l) {
1776
1776
  if (!F.name || !F.url)
1777
1777
  continue;
1778
- const Z = F.name.toLowerCase(), Q = this._parseUrlParams(F.url), V = {};
1779
- if (Q.track !== void 0 && (V.channel = parseInt(Q.track, 10)), Q.prog !== void 0) {
1780
- const t = parseInt(Q.prog, 10);
1781
- t !== 0 && (V.instrument = t);
1782
- }
1783
- V.channel !== void 0 && (U[Z] = V);
1778
+ const d = F.name.toLowerCase(), Q = this._parseUrlParams(F.url), V = {};
1779
+ Q.track !== void 0 && (V.channel = parseInt(Q.track, 10)), Q.prog !== void 0 && (V.instrument = parseInt(Q.prog, 10)), V.channel !== void 0 && (U[d] = V);
1784
1780
  }
1785
1781
  return U;
1786
1782
  }
@@ -1794,8 +1790,8 @@ class LU {
1794
1790
  const U = {}, F = l.indexOf("?");
1795
1791
  if (F === -1)
1796
1792
  return U;
1797
- const Z = l.substring(F + 1).split("&");
1798
- for (const Q of Z) {
1793
+ const d = l.substring(F + 1).split("&");
1794
+ for (const Q of d) {
1799
1795
  const [V, t] = Q.split("=");
1800
1796
  V && t !== void 0 && (U[V] = t);
1801
1797
  }
@@ -1809,8 +1805,8 @@ class LU {
1809
1805
  const U = new Uint8Array(l);
1810
1806
  if (!(U[0] === 77 && U[1] === 84 && U[2] === 104 && U[3] === 100))
1811
1807
  throw new Error("Not a valid MIDI file");
1812
- const F = this._bytesToNumber(U.slice(4, 8)), Z = this._bytesToNumber(U.slice(8, 10)), Q = this._bytesToNumber(U.slice(10, 12)), V = this._bytesToNumber(U.slice(12, 14)), t = V & 32768 ? null : V, R = {
1813
- format: Z,
1808
+ const F = this._bytesToNumber(U.slice(4, 8)), d = this._bytesToNumber(U.slice(8, 10)), Q = this._bytesToNumber(U.slice(10, 12)), V = this._bytesToNumber(U.slice(12, 14)), t = V & 32768 ? null : V, R = {
1809
+ format: d,
1814
1810
  ticksPerBeat: t,
1815
1811
  tracks: [],
1816
1812
  duration: 0
@@ -1836,13 +1832,13 @@ class LU {
1836
1832
  events: [],
1837
1833
  duration: 0
1838
1834
  };
1839
- let F = 0, Z = 0, Q = null;
1835
+ let F = 0, d = 0, Q = null;
1840
1836
  for (; F < l.length; ) {
1841
1837
  let V = 0, t = 0;
1842
1838
  do
1843
1839
  t = l[F++], V = V << 7 | t & 127;
1844
1840
  while (t & 128);
1845
- Z += V, t = l[F++];
1841
+ d += V, t = l[F++];
1846
1842
  let R = t;
1847
1843
  if (t & 128)
1848
1844
  Q = R;
@@ -1863,13 +1859,13 @@ class LU {
1863
1859
  U.events.push({
1864
1860
  type: "text",
1865
1861
  text: this._bytesToString(m),
1866
- tick: Z
1862
+ tick: d
1867
1863
  });
1868
1864
  break;
1869
1865
  case 5:
1870
1866
  U.lyrics.push({
1871
1867
  text: this._bytesToString(m),
1872
- tick: Z
1868
+ tick: d
1873
1869
  });
1874
1870
  break;
1875
1871
  case 81:
@@ -1877,7 +1873,7 @@ class LU {
1877
1873
  U.events.push({
1878
1874
  type: "tempo",
1879
1875
  bpm: c,
1880
- tick: Z
1876
+ tick: d
1881
1877
  });
1882
1878
  break;
1883
1879
  case 88:
@@ -1885,11 +1881,11 @@ class LU {
1885
1881
  type: "timeSignature",
1886
1882
  numerator: m[0],
1887
1883
  denominator: Math.pow(2, m[1]),
1888
- tick: Z
1884
+ tick: d
1889
1885
  });
1890
1886
  break;
1891
1887
  case 47:
1892
- U.duration = Z;
1888
+ U.duration = d;
1893
1889
  break;
1894
1890
  }
1895
1891
  } else if ((R & 240) === 144) {
@@ -1898,12 +1894,12 @@ class LU {
1898
1894
  type: "noteOn",
1899
1895
  noteNumber: n,
1900
1896
  velocity: m,
1901
- tick: Z,
1897
+ tick: d,
1902
1898
  channel: a
1903
1899
  }) : U.notes.push({
1904
1900
  type: "noteOff",
1905
1901
  noteNumber: n,
1906
- tick: Z,
1902
+ tick: d,
1907
1903
  channel: a
1908
1904
  });
1909
1905
  } else if ((R & 240) === 128) {
@@ -1911,7 +1907,7 @@ class LU {
1911
1907
  l[F++], U.notes.push({
1912
1908
  type: "noteOff",
1913
1909
  noteNumber: n,
1914
- tick: Z,
1910
+ tick: d,
1915
1911
  channel: a
1916
1912
  });
1917
1913
  } else if (R === 240 || R === 247) {
@@ -1924,7 +1920,7 @@ class LU {
1924
1920
  controllerNumber: n,
1925
1921
  value: m,
1926
1922
  channel: a,
1927
- tick: Z
1923
+ tick: d
1928
1924
  });
1929
1925
  } else if ((R & 240) === 192) {
1930
1926
  const a = R & 15, n = l[F++];
@@ -1932,7 +1928,7 @@ class LU {
1932
1928
  type: "programChange",
1933
1929
  programNumber: n,
1934
1930
  channel: a,
1935
- tick: Z
1931
+ tick: d
1936
1932
  });
1937
1933
  } else if ((R & 240) === 208) {
1938
1934
  const a = R & 15, n = l[F++];
@@ -1940,7 +1936,7 @@ class LU {
1940
1936
  type: "channelAftertouch",
1941
1937
  pressure: n,
1942
1938
  channel: a,
1943
- tick: Z
1939
+ tick: d
1944
1940
  });
1945
1941
  } else if ((R & 240) === 224) {
1946
1942
  const a = R & 15, n = l[F++], m = (l[F++] << 7 | n) - 8192;
@@ -1948,7 +1944,7 @@ class LU {
1948
1944
  type: "pitchBend",
1949
1945
  value: m,
1950
1946
  channel: a,
1951
- tick: Z
1947
+ tick: d
1952
1948
  });
1953
1949
  } else if ((R & 240) === 160) {
1954
1950
  const a = R & 15, n = l[F++], m = l[F++];
@@ -1957,7 +1953,7 @@ class LU {
1957
1953
  noteNumber: n,
1958
1954
  pressure: m,
1959
1955
  channel: a,
1960
- tick: Z
1956
+ tick: d
1961
1957
  });
1962
1958
  } else
1963
1959
  console.warn(`Unknown event type: ${R.toString(16)} at position ${F - 1}`), F++;
@@ -1976,7 +1972,7 @@ class LU {
1976
1972
  format: l.format,
1977
1973
  ticksPerBeat: l.ticksPerBeat
1978
1974
  };
1979
- l.tracks.forEach((F, Z) => {
1975
+ l.tracks.forEach((F, d) => {
1980
1976
  if (F.name && !U.title && (U.title = F.name), F.events.filter((Q) => Q.type === "text").forEach((Q) => {
1981
1977
  const V = Q.text.toLowerCase();
1982
1978
  (V.includes("compos") || V.includes("by")) && !U.composer && (U.composer = Q.text);
@@ -1985,7 +1981,7 @@ class LU {
1985
1981
  for (const V of this.partNames)
1986
1982
  if (Q.includes(V)) {
1987
1983
  U.partNames.push({
1988
- index: Z,
1984
+ index: d,
1989
1985
  name: F.name
1990
1986
  });
1991
1987
  break;
@@ -2007,15 +2003,15 @@ class LU {
2007
2003
  (m.type === "timeSignature" || m.type === "tempo") && F.push(m);
2008
2004
  });
2009
2005
  }), F.sort((n, m) => n.tick - m.tick);
2010
- let Z = 0;
2006
+ let d = 0;
2011
2007
  l.tracks.forEach((n) => {
2012
2008
  n.notes && n.notes.forEach((m) => {
2013
- m.type === "noteOff" && m.tick > Z && (Z = m.tick);
2009
+ m.type === "noteOff" && m.tick > d && (d = m.tick);
2014
2010
  });
2015
- }), Z === 0 && (Z = U * 8);
2011
+ }), d === 0 && (d = U * 8);
2016
2012
  const Q = [], V = F.filter((n) => n.type === "timeSignature").sort((n, m) => n.tick - m.tick);
2017
2013
  let t = { numerator: 4, denominator: 4 }, R = 0, a = 0;
2018
- for (; R < Z; ) {
2014
+ for (; R < d; ) {
2019
2015
  for (; a < V.length && V[a].tick <= R; )
2020
2016
  t = V[a], a++;
2021
2017
  let n;
@@ -2039,14 +2035,14 @@ class LU {
2039
2035
  _extractParts(l) {
2040
2036
  const U = {}, F = l.ticksPerBeat;
2041
2037
  if (this.metadataOverrides.parts)
2042
- for (const [Z, Q] of Object.entries(this.metadataOverrides.parts)) {
2038
+ for (const [d, Q] of Object.entries(this.metadataOverrides.parts)) {
2043
2039
  if (Q.channel !== void 0 && Q.channel !== null) {
2044
2040
  if (Q.channel === 15) {
2045
- console.error(`Part "${Z}" uses channel 15 which is reserved for metronome. Skipping.`);
2041
+ console.error(`Part "${d}" uses channel 15 which is reserved for metronome. Skipping.`);
2046
2042
  continue;
2047
2043
  }
2048
- if (Q.channel === 9 && console.warn(`Part "${Z}" uses channel 9 (drums/percussion). This may not be appropriate for vocal parts.`), Q.channel < 0 || Q.channel > 15) {
2049
- console.error(`Part "${Z}" has invalid channel ${Q.channel}. MIDI channels must be 0-15. Skipping.`);
2044
+ if (Q.channel === 9 && console.warn(`Part "${d}" uses channel 9 (drums/percussion). This may not be appropriate for vocal parts.`), Q.channel < 0 || Q.channel > 15) {
2045
+ console.error(`Part "${d}" has invalid channel ${Q.channel}. MIDI channels must be 0-15. Skipping.`);
2050
2046
  continue;
2051
2047
  }
2052
2048
  }
@@ -2055,7 +2051,7 @@ class LU {
2055
2051
  let V;
2056
2052
  if (Q.channel !== void 0 && Q.channel !== null) {
2057
2053
  if (V = this._extractPartDataByChannel(Q.channel, l, F), !V || V.notes.length === 0) {
2058
- console.warn(`Part "${Z}" specified channel ${Q.channel} but no notes found on that channel. Skipping.`);
2054
+ console.warn(`Part "${d}" specified channel ${Q.channel} but no notes found on that channel. Skipping.`);
2059
2055
  continue;
2060
2056
  }
2061
2057
  } else if (Q.trackIndex !== void 0 && Q.trackIndex !== null) {
@@ -2064,7 +2060,7 @@ class LU {
2064
2060
  const R = l.tracks[t];
2065
2061
  V = this._extractPartDataFromTrack(R, t, l, F);
2066
2062
  } else {
2067
- console.warn(`Part "${Z}" specified trackIndex ${t} but track not found. Skipping.`);
2063
+ console.warn(`Part "${d}" specified trackIndex ${t} but track not found. Skipping.`);
2068
2064
  continue;
2069
2065
  }
2070
2066
  } else if (Q.trackName) {
@@ -2073,18 +2069,18 @@ class LU {
2073
2069
  const R = l.tracks[t];
2074
2070
  V = this._extractPartDataFromTrack(R, t, l, F);
2075
2071
  } else {
2076
- console.warn(`Part "${Z}" specified trackName "${Q.trackName}" but track not found. Skipping.`);
2072
+ console.warn(`Part "${d}" specified trackName "${Q.trackName}" but track not found. Skipping.`);
2077
2073
  continue;
2078
2074
  }
2079
2075
  }
2080
- V && (Q.instrument !== void 0 && Q.instrument !== null && (V.defaultInstrument = this._resolveInstrument(Q.instrument)), U[Z] = V);
2076
+ V && (Q.instrument !== void 0 && Q.instrument !== null && (V.defaultInstrument = this._resolveInstrument(Q.instrument), V.programChanges = []), U[d] = V);
2081
2077
  }
2082
2078
  else
2083
- l.tracks.forEach((Z, Q) => {
2084
- if (!Z.notes.length) return;
2079
+ l.tracks.forEach((d, Q) => {
2080
+ if (!d.notes.length) return;
2085
2081
  let V = null;
2086
- if (Z.name) {
2087
- const a = Z.name.toLowerCase();
2082
+ if (d.name) {
2083
+ const a = d.name.toLowerCase();
2088
2084
  for (const n of this.partNames)
2089
2085
  if (n.length === 1) {
2090
2086
  if (a === n) {
@@ -2096,11 +2092,11 @@ class LU {
2096
2092
  break;
2097
2093
  }
2098
2094
  }
2099
- V || (V = Z.name || `Track ${Q + 1}`), V === "s" && (V = "soprano"), V === "a" && (V = "alto"), V === "t" && (V = "tenor"), V === "b" && (V = "bass");
2095
+ V || (V = d.name || `Track ${Q + 1}`), V === "s" && (V = "soprano"), V === "a" && (V = "alto"), V === "t" && (V = "tenor"), V === "b" && (V = "bass");
2100
2096
  let t = V, R = 2;
2101
2097
  for (; U[t]; )
2102
2098
  t = `${V} ${R}`, R++;
2103
- V = t, U[V] = this._extractPartDataFromTrack(Z, Q, l, F);
2099
+ V = t, U[V] = this._extractPartDataFromTrack(d, Q, l, F);
2104
2100
  });
2105
2101
  this.parsedData.parts = U;
2106
2102
  }
@@ -2109,7 +2105,7 @@ class LU {
2109
2105
  * @private
2110
2106
  */
2111
2107
  _extractPartDataByChannel(l, U, F) {
2112
- const Z = [], Q = [], V = [], t = [];
2108
+ const d = [], Q = [], V = [], t = [];
2113
2109
  U.tracks.forEach((a, n) => {
2114
2110
  const m = {};
2115
2111
  a.notes.forEach((W) => {
@@ -2121,7 +2117,7 @@ class LU {
2121
2117
  };
2122
2118
  else if (W.type === "noteOff" && m[W.noteNumber]) {
2123
2119
  const c = m[W.noteNumber], s = W.tick - c.tick;
2124
- Z.push({
2120
+ d.push({
2125
2121
  pitch: W.noteNumber,
2126
2122
  name: this._midiNoteToName(W.noteNumber),
2127
2123
  startTick: c.tick,
@@ -2149,10 +2145,10 @@ class LU {
2149
2145
  sourceTrackIndex: n
2150
2146
  });
2151
2147
  }), a.notes.some((W) => W.channel === l) && t.push(n);
2152
- }), Z.sort((a, n) => a.startTick - n.startTick), Q.sort((a, n) => a.tick - n.tick), V.sort((a, n) => a.tick - n.tick);
2148
+ }), d.sort((a, n) => a.startTick - n.startTick), Q.sort((a, n) => a.tick - n.tick), V.sort((a, n) => a.tick - n.tick);
2153
2149
  const R = V.length > 0 ? V[0].programNumber : 0;
2154
2150
  return {
2155
- notes: Z,
2151
+ notes: d,
2156
2152
  lyrics: Q,
2157
2153
  channel: l,
2158
2154
  trackIndices: t,
@@ -2165,7 +2161,7 @@ class LU {
2165
2161
  * Extract part data from a MIDI track
2166
2162
  * @private
2167
2163
  */
2168
- _extractPartDataFromTrack(l, U, F, Z) {
2164
+ _extractPartDataFromTrack(l, U, F, d) {
2169
2165
  const Q = [], V = {};
2170
2166
  l.notes.forEach((n) => {
2171
2167
  if (n.type === "noteOn")
@@ -2194,7 +2190,7 @@ class LU {
2194
2190
  const t = l.lyrics.map((n) => ({
2195
2191
  text: n.text,
2196
2192
  tick: n.tick,
2197
- time: n.tick / Z
2193
+ time: n.tick / d
2198
2194
  // Time in quarter notes
2199
2195
  }));
2200
2196
  Q.sort((n, m) => n.startTick - m.startTick);
@@ -2266,10 +2262,10 @@ class LU {
2266
2262
  * @private
2267
2263
  */
2268
2264
  _readVariableLengthValue(l, U) {
2269
- let F = 0, Z, Q = 0;
2265
+ let F = 0, d, Q = 0;
2270
2266
  do
2271
- Z = l[U + Q++], F = F << 7 | Z & 127;
2272
- while (Z & 128);
2267
+ d = l[U + Q++], F = F << 7 | d & 127;
2268
+ while (d & 128);
2273
2269
  return { value: F, bytesRead: Q };
2274
2270
  }
2275
2271
  /**
@@ -2277,14 +2273,14 @@ class LU {
2277
2273
  * @private
2278
2274
  */
2279
2275
  _ticksToTime(l, U) {
2280
- const F = U.ticksPerBeat || 480, Z = [];
2276
+ const F = U.ticksPerBeat || 480, d = [];
2281
2277
  U.tracks.forEach((R) => {
2282
2278
  R.events.forEach((a) => {
2283
- a.type === "tempo" && Z.push(a);
2279
+ a.type === "tempo" && d.push(a);
2284
2280
  });
2285
- }), Z.sort((R, a) => R.tick - a.tick);
2281
+ }), d.sort((R, a) => R.tick - a.tick);
2286
2282
  let Q = 0, V = 0, t = 120;
2287
- for (const R of Z) {
2283
+ for (const R of d) {
2288
2284
  if (R.tick > l) break;
2289
2285
  if (R.tick > V) {
2290
2286
  const a = (R.tick - V) / F * (60 / t);
@@ -2323,14 +2319,14 @@ class CU {
2323
2319
  * @returns {Array} Bar order with bar numbers and repeat counts
2324
2320
  */
2325
2321
  generateBarOrder(l, U) {
2326
- const F = [], Z = {};
2322
+ const F = [], d = {};
2327
2323
  for (const Q of U) {
2328
2324
  const V = l[Q.section];
2329
2325
  if (!V)
2330
2326
  throw new Error(`Invalid section index: ${Q.section}`);
2331
2327
  const t = Q.section;
2332
- Z[t] || (Z[t] = 0), Z[t]++;
2333
- const R = Z[t], a = Q.from !== void 0 ? Q.from : this._getSectionStartBar(l, Q.section), n = Q.to !== void 0 ? Q.to : V.to, m = Q.as || 1;
2328
+ d[t] || (d[t] = 0), d[t]++;
2329
+ const R = d[t], a = Q.from !== void 0 ? Q.from : this._getSectionStartBar(l, Q.section), n = Q.to !== void 0 ? Q.to : V.to, m = Q.as || 1;
2334
2330
  for (let W = a; W <= n; W++)
2335
2331
  this._shouldPlayBar(V, W, m) && F.push({
2336
2332
  barNumber: W,
@@ -2349,25 +2345,25 @@ class CU {
2349
2345
  */
2350
2346
  generateBarOrderFromLegacyBars(l, U) {
2351
2347
  const F = [];
2352
- let Z = 1, Q = 0, V;
2348
+ let d = 1, Q = 0, V;
2353
2349
  for (const t of l) {
2354
- t.from !== void 0 && (Z = t.from === -1 ? 0 : t.from, Q = 0), t.timeSig !== void 0 && (V = t.timeSig);
2350
+ t.from !== void 0 && (d = t.from === -1 ? 0 : t.from, Q = 0), t.timeSig !== void 0 && (V = t.timeSig);
2355
2351
  const R = t.repeat || 1;
2356
2352
  let a = t.beats;
2357
2353
  for (; a > 0; ) {
2358
- const n = (V !== void 0 ? V : this._getBeatsPerBar(Z, U)) - Q;
2354
+ const n = (V !== void 0 ? V : this._getBeatsPerBar(d, U)) - Q;
2359
2355
  a >= n ? (F.push({
2360
- barNumber: Z,
2356
+ barNumber: d,
2361
2357
  repeat: R,
2362
2358
  sectionIndex: 0,
2363
2359
  // Legacy format doesn't have sections
2364
2360
  voltaTime: 1
2365
2361
  // Legacy format doesn't have voltas
2366
- }), a -= n, Q = 0, Z === 0 ? Z = 1 : Z++) : (Q += a, a = 0);
2362
+ }), a -= n, Q = 0, d === 0 ? d = 1 : d++) : (Q += a, a = 0);
2367
2363
  }
2368
2364
  }
2369
2365
  return Q > 0 && F.push({
2370
- barNumber: Z,
2366
+ barNumber: d,
2371
2367
  repeat: 1,
2372
2368
  sectionIndex: 0,
2373
2369
  voltaTime: 1
@@ -2397,10 +2393,10 @@ class CU {
2397
2393
  */
2398
2394
  _getBeatsPerBar(l, U) {
2399
2395
  const F = U.length > 0 && U[0].sig && U[0].sig[0] <= 2;
2400
- let Z;
2401
- if (F ? Z = l : Z = l - 1, Z < 0 || Z >= U.length)
2396
+ let d;
2397
+ if (F ? d = l : d = l - 1, d < 0 || d >= U.length)
2402
2398
  return 4;
2403
- const Q = U[Z];
2399
+ const Q = U[d];
2404
2400
  return Q.sig ? Q.sig[0] : 4;
2405
2401
  }
2406
2402
  /**
@@ -2411,18 +2407,18 @@ class CU {
2411
2407
  * @returns {Array} Beat table with time, repeat, bar, and beat information
2412
2408
  */
2413
2409
  generateBeatTable(l, U) {
2414
- const F = [], Z = {};
2410
+ const F = [], d = {};
2415
2411
  let Q = 0, V = 0;
2416
2412
  const t = [...U];
2417
2413
  for (; V < l.length && Q < t.length; ) {
2418
2414
  const R = l[V], a = R.barNumber;
2419
- if (Z[a] === void 0) {
2415
+ if (d[a] === void 0) {
2420
2416
  const c = t[Q];
2421
2417
  if (!c || !c.sig)
2422
2418
  throw new Error(`Invalid MIDI bar structure at index ${Q}`);
2423
- Z[a] = c.sig[0];
2419
+ d[a] = c.sig[0];
2424
2420
  }
2425
- const n = Z[a];
2421
+ const n = d[a];
2426
2422
  let m = t[Q], W = m.sig[0];
2427
2423
  for (; W < n && Q + 1 < t.length; ) {
2428
2424
  const c = t[Q + 1], s = [
@@ -2460,8 +2456,8 @@ class CU {
2460
2456
  }
2461
2457
  let n = R ? R.time + a : 0;
2462
2458
  for (; V < l.length; ) {
2463
- const m = l[V], W = m.barNumber, c = Z[W] !== void 0 ? Z[W] : 4;
2464
- Z[W] === void 0 && (Z[W] = c);
2459
+ const m = l[V], W = m.barNumber, c = d[W] !== void 0 ? d[W] : 4;
2460
+ d[W] === void 0 && (d[W] = c);
2465
2461
  const s = [];
2466
2462
  for (let J = 0; J < c; J++)
2467
2463
  s.push(n), n += a;
@@ -2479,18 +2475,18 @@ class CU {
2479
2475
  * Generate beat entries for a single bar
2480
2476
  * @private
2481
2477
  */
2482
- _generateBeatsForBar(l, U, F, Z) {
2478
+ _generateBeatsForBar(l, U, F, d) {
2483
2479
  const { beats: Q } = F;
2484
2480
  if (!Q || !Array.isArray(Q))
2485
2481
  throw new Error(`Invalid MIDI bar: missing beats array. Got: ${JSON.stringify(F)}`);
2486
- const V = Q.slice(0, Z);
2487
- for (let t = 1; t <= Z; t++) {
2482
+ const V = Q.slice(0, d);
2483
+ for (let t = 1; t <= d; t++) {
2488
2484
  const R = {
2489
2485
  time: V[t - 1],
2490
2486
  repeat: U.repeat,
2491
2487
  bar: U.barNumber,
2492
2488
  beat: t,
2493
- timeSig: Z
2489
+ timeSig: d
2494
2490
  };
2495
2491
  l.push(R);
2496
2492
  }
@@ -2509,8 +2505,8 @@ class CU {
2509
2505
  _shouldPlayBar(l, U, F) {
2510
2506
  if (!l.voltas)
2511
2507
  return !0;
2512
- const Z = l.voltas.indexOf(U);
2513
- return Z === -1 ? !0 : Z + 1 === F;
2508
+ const d = l.voltas.indexOf(U);
2509
+ return d === -1 ? !0 : d + 1 === F;
2514
2510
  }
2515
2511
  }
2516
2512
  class Jl {
@@ -2521,11 +2517,11 @@ class Jl {
2521
2517
  * @param {Object} instrumentMap - Mapping of part names to instrument configurations
2522
2518
  * @param {Object} [structureMetadata] - Optional score structure for beat mapping
2523
2519
  */
2524
- constructor(l = null, U, F = null, Z = null) {
2520
+ constructor(l = null, U, F = null, d = null) {
2525
2521
  if (!U)
2526
2522
  throw new Error("Parsed MIDI data is required");
2527
- this.audioEngine = l, this._audioEngineReady = !!(l && l.isInitialized), this.instrumentMap = F || {}, this.parsedData = U, this._isPlaying = !1, this._currentTime = 0, this._totalDuration = 0, this.playbackSpeed = 1, this.partChannels = /* @__PURE__ */ new Map(), this.partOutputs = /* @__PURE__ */ new Map(), this.playbackStartTime = 0, this.lookAheadTime = 0.05, this.scheduleInterval = null, this.partNotePointers = /* @__PURE__ */ new Map(), this.partProgramPointers = /* @__PURE__ */ new Map(), this.eventBus = Xl(), this.beatMapper = new CU(), this.beats = [], this.structureMetadata = Z, this._calculateTotalDuration();
2528
- const Q = Z || this._createDefaultStructureMetadata();
2523
+ this.audioEngine = l, this._audioEngineReady = !!(l && l.isInitialized), this.instrumentMap = F || {}, this.parsedData = U, this._isPlaying = !1, this._currentTime = 0, this._totalDuration = 0, this.playbackSpeed = 1, this.partChannels = /* @__PURE__ */ new Map(), this.partOutputs = /* @__PURE__ */ new Map(), this.playbackStartTime = 0, this.lookAheadTime = 0.05, this.scheduleInterval = null, this.partNotePointers = /* @__PURE__ */ new Map(), this.partProgramPointers = /* @__PURE__ */ new Map(), this.eventBus = Xl(), this.beatMapper = new CU(), this.beats = [], this.structureMetadata = d, this._calculateTotalDuration();
2524
+ const Q = d || this._createDefaultStructureMetadata();
2529
2525
  this.beats = this.beatMapper.mapBeats(U, Q), this._audioEngineReady && (this._setupPartChannels(), this._resetNotePointers(), this._resetProgramPointers());
2530
2526
  }
2531
2527
  // ========================================
@@ -2599,8 +2595,8 @@ class Jl {
2599
2595
  throw new Error("Playback speed must be greater than 0");
2600
2596
  const F = U && this._isPlaying;
2601
2597
  F && this.pause();
2602
- const Z = (this.audioEngine.audioContext.currentTime - this.playbackStartTime) * this.playbackSpeed;
2603
- this.playbackSpeed = l, F ? this.play() : this.playbackStartTime = this.audioEngine.audioContext.currentTime - Z / this.playbackSpeed;
2598
+ const d = (this.audioEngine.audioContext.currentTime - this.playbackStartTime) * this.playbackSpeed;
2599
+ this.playbackSpeed = l, F ? this.play() : this.playbackStartTime = this.audioEngine.audioContext.currentTime - d / this.playbackSpeed;
2604
2600
  }
2605
2601
  /**
2606
2602
  * Navigate to a specific bar position
@@ -2620,7 +2616,7 @@ class Jl {
2620
2616
  getTimeFromBar(l, U = 0) {
2621
2617
  U || (U = 1);
2622
2618
  const F = this.beats.find(
2623
- (Z) => Z.bar === l && Z.beat === 1 && Z.repeat === U
2619
+ (d) => d.bar === l && d.beat === 1 && d.repeat === U
2624
2620
  );
2625
2621
  return F ? F.time : null;
2626
2622
  }
@@ -2710,9 +2706,9 @@ class Jl {
2710
2706
  */
2711
2707
  getAllNextNotes(l) {
2712
2708
  const U = l ?? this.getCurrentTime(), F = {};
2713
- for (const [Z, Q] of Object.entries(this.parsedData.parts)) {
2709
+ for (const [d, Q] of Object.entries(this.parsedData.parts)) {
2714
2710
  const V = Q.notes.find((t) => t.startTime >= U);
2715
- F[Z] = V ? {
2711
+ F[d] = V ? {
2716
2712
  pitch: V.pitch,
2717
2713
  startTime: V.startTime
2718
2714
  } : null;
@@ -2753,10 +2749,10 @@ class Jl {
2753
2749
  */
2754
2750
  _setupPartChannels() {
2755
2751
  Object.keys(this.parsedData.parts).forEach((l) => {
2756
- const U = this.parsedData.parts[l], F = this.instrumentMap[l] || {}, Z = F.instrument !== void 0 ? F.instrument : U.defaultInstrument !== void 0 ? U.defaultInstrument : 0;
2752
+ const U = this.parsedData.parts[l], F = this.instrumentMap[l] || {}, d = F.instrument !== void 0 ? F.instrument : U.defaultInstrument !== void 0 ? U.defaultInstrument : 0;
2757
2753
  try {
2758
2754
  const Q = this.audioEngine.createChannel(l, {
2759
- instrument: Z,
2755
+ instrument: d,
2760
2756
  initialVolume: F.volume || 1
2761
2757
  });
2762
2758
  this.partChannels.set(l, Q);
@@ -2796,7 +2792,7 @@ class Jl {
2796
2792
  this.scheduleInterval || (this.scheduleInterval = setInterval(() => {
2797
2793
  if (!this._isPlaying) return;
2798
2794
  const l = (this.audioEngine.audioContext.currentTime - this.playbackStartTime) * this.playbackSpeed, U = l + this.lookAheadTime;
2799
- for (const [F, Z] of this.partChannels) {
2795
+ for (const [F, d] of this.partChannels) {
2800
2796
  const Q = this.parsedData.parts[F];
2801
2797
  if (Q) {
2802
2798
  if (Q.programChanges && Q.programChanges.length > 0) {
@@ -2806,7 +2802,7 @@ class Jl {
2806
2802
  V++;
2807
2803
  for (; V < t.length && t[V].time <= U; ) {
2808
2804
  const R = t[V];
2809
- Z.setInstrument(R.programNumber), V++;
2805
+ d.setInstrument(R.programNumber), V++;
2810
2806
  }
2811
2807
  this.partProgramPointers.set(F, V);
2812
2808
  }
@@ -2819,7 +2815,7 @@ class Jl {
2819
2815
  const R = t[V];
2820
2816
  if (R.endTime - R.startTime >= 0.01) {
2821
2817
  const a = this.playbackStartTime + R.startTime / this.playbackSpeed, n = (R.endTime - R.startTime) / this.playbackSpeed;
2822
- Z.playNote(a, R.pitch, R.velocity, n);
2818
+ d.playNote(a, R.pitch, R.velocity, n);
2823
2819
  }
2824
2820
  V++;
2825
2821
  }
@@ -2838,10 +2834,10 @@ class Jl {
2838
2834
  for (const [U] of this.partChannels) {
2839
2835
  const F = this.parsedData.parts[U];
2840
2836
  if (!F || !F.notes) continue;
2841
- let Z = 0;
2842
- for (; Z < F.notes.length && F.notes[Z].endTime < l; )
2843
- Z++;
2844
- this.partNotePointers.set(U, Z);
2837
+ let d = 0;
2838
+ for (; d < F.notes.length && F.notes[d].endTime < l; )
2839
+ d++;
2840
+ this.partNotePointers.set(U, d);
2845
2841
  }
2846
2842
  }
2847
2843
  /**
@@ -2851,14 +2847,14 @@ class Jl {
2851
2847
  _resetProgramPointers() {
2852
2848
  const l = this._currentTime;
2853
2849
  for (const [U, F] of this.partChannels) {
2854
- const Z = this.parsedData.parts[U];
2855
- if (!Z || !Z.programChanges) {
2850
+ const d = this.parsedData.parts[U];
2851
+ if (!d || !d.programChanges) {
2856
2852
  this.partProgramPointers.set(U, 0);
2857
2853
  continue;
2858
2854
  }
2859
- let Q = 0, V = Z.defaultInstrument;
2860
- for (; Q < Z.programChanges.length && Z.programChanges[Q].time <= l; )
2861
- V = Z.programChanges[Q].programNumber, Q++;
2855
+ let Q = 0, V = d.defaultInstrument;
2856
+ for (; Q < d.programChanges.length && d.programChanges[Q].time <= l; )
2857
+ V = d.programChanges[Q].programNumber, Q++;
2862
2858
  F.setInstrument(V), this.partProgramPointers.set(U, Q);
2863
2859
  }
2864
2860
  }
@@ -2900,8 +2896,8 @@ class Jl {
2900
2896
  (this.eventBus.all.get(l) || []).forEach((F) => {
2901
2897
  try {
2902
2898
  F(U);
2903
- } catch (Z) {
2904
- console.error(`Error in ${l} event listener:`, Z);
2899
+ } catch (d) {
2900
+ console.error(`Error in ${l} event listener:`, d);
2905
2901
  }
2906
2902
  });
2907
2903
  }
@@ -3310,14 +3306,14 @@ class xU {
3310
3306
  throw new Error("Audio engine not ready. Call setAudioEngine() first.");
3311
3307
  if (this.isCalibrating)
3312
3308
  throw new Error("Calibration already in progress");
3313
- const U = l.measurements || 5, F = l.sampleIntervalMs || 10, Z = l.threshold || 0.01, Q = l.timeout || 3e3, V = l.silent !== void 0 ? l.silent : !0, t = l.updateBaseline !== void 0 ? l.updateBaseline : !0;
3309
+ const U = l.measurements || 5, F = l.sampleIntervalMs || 10, d = l.threshold || 0.01, Q = l.timeout || 3e3, V = l.silent !== void 0 ? l.silent : !0, t = l.updateBaseline !== void 0 ? l.updateBaseline : !0;
3314
3310
  this.isCalibrating = !0;
3315
3311
  try {
3316
3312
  V && await this._setupSilentCalibration();
3317
3313
  const R = await this._performLatencyMeasurement(
3318
3314
  U,
3319
3315
  F,
3320
- Z,
3316
+ d,
3321
3317
  Q
3322
3318
  );
3323
3319
  this.measuredLatencyMs = R, t && await this._updateBaselineLatency(R);
@@ -3427,7 +3423,7 @@ class xU {
3427
3423
  previewNextNotes(l = {}) {
3428
3424
  if (!this.midiPlayer)
3429
3425
  throw new Error("No MIDI data loaded");
3430
- const U = l.delayBetweenParts ?? 0.3, F = l.duration ?? 0.5, Z = l.velocity ?? 100, Q = this.midiPlayer.getAllNextNotes(), V = l.partOrder ?? this.getPartNames();
3426
+ const U = l.delayBetweenParts ?? 0.3, F = l.duration ?? 0.5, d = l.velocity ?? 100, Q = this.midiPlayer.getAllNextNotes(), V = l.partOrder ?? this.getPartNames();
3431
3427
  let t = this.audioEngine.audioContext.currentTime + 0.01;
3432
3428
  const R = [];
3433
3429
  for (const a of V) {
@@ -3439,7 +3435,7 @@ class xU {
3439
3435
  W && W.gain.value === 0 || (m.playPreviewNote(n.pitch, {
3440
3436
  startTime: t,
3441
3437
  duration: F,
3442
- velocity: Z,
3438
+ velocity: d,
3443
3439
  instrument: l.instrument
3444
3440
  }), R.push({
3445
3441
  partName: a,
@@ -3568,10 +3564,10 @@ class xU {
3568
3564
  startBeat: { bar: 1, beat: 1, timeSig: 4 }
3569
3565
  };
3570
3566
  const l = this.midiPlayer.beats, U = this.frozenTime, F = this.leadInConfig.bars;
3571
- let Z = l.length - 1, Q = 0.5;
3572
- for (; l[Z].time > U; ) Z--;
3573
- const V = l[Z], t = l[Z + 1];
3574
- t ? Q = t.time - V.time : Z > 0 && (Q = V.time - l[Z - 1].time);
3567
+ let d = l.length - 1, Q = 0.5;
3568
+ for (; l[d].time > U; ) d--;
3569
+ const V = l[d], t = l[d + 1];
3570
+ t ? Q = t.time - V.time : d > 0 && (Q = V.time - l[d - 1].time);
3575
3571
  const R = this.midiPlayer && this.midiPlayer.playbackSpeed || 1, a = Q / R, n = V.timeSig === 1, m = n && t ? t.timeSig : V.timeSig, W = n ? m - 1 : V.beat > 1 ? V.beat - 1 : 0, c = F * m + W;
3576
3572
  return {
3577
3573
  totalBeats: c,
@@ -3590,10 +3586,10 @@ class xU {
3590
3586
  * @private
3591
3587
  */
3592
3588
  _generateBeatSequence(l, U, F) {
3593
- const Z = [];
3589
+ const d = [];
3594
3590
  for (let Q = 0; Q < l; Q++) {
3595
3591
  const V = Q % F + 1;
3596
- Z.push({
3592
+ d.push({
3597
3593
  beat: V,
3598
3594
  isAccent: V === 1,
3599
3595
  time: Q * U,
@@ -3602,7 +3598,7 @@ class xU {
3602
3598
  // Absolute time (includes startup delay)
3603
3599
  });
3604
3600
  }
3605
- return Z;
3601
+ return d;
3606
3602
  }
3607
3603
  /**
3608
3604
  * Start lead-in tick scheduling using beat-index approach
@@ -3613,9 +3609,9 @@ class xU {
3613
3609
  this.leadInBeatIndex = 0, this.leadInScheduledBeats = /* @__PURE__ */ new Set();
3614
3610
  const U = this.leadInData.beatSequence, F = 10;
3615
3611
  this.leadInStartTime = this.audioEngine.audioContext.currentTime, this.leadInInterval = setInterval(() => {
3616
- const Z = this.audioEngine.audioContext.currentTime - this.leadInStartTime;
3617
- for (this.leadInProgress = Math.min(1, Z / this.leadInData.duration); this.leadInBeatIndex < U.length; ) {
3618
- const Q = U[this.leadInBeatIndex], V = Q.time - Z;
3612
+ const d = this.audioEngine.audioContext.currentTime - this.leadInStartTime;
3613
+ for (this.leadInProgress = Math.min(1, d / this.leadInData.duration); this.leadInBeatIndex < U.length; ) {
3614
+ const Q = U[this.leadInBeatIndex], V = Q.time - d;
3619
3615
  if (V > 0.05)
3620
3616
  break;
3621
3617
  if (!this.leadInScheduledBeats.has(this.leadInBeatIndex) && V >= -0.05 && V <= 0.05) {
@@ -3671,7 +3667,7 @@ class xU {
3671
3667
  this.state = "playing", this._resetMetronomeBeatTracking(), U && this._emitEvent("playbackStarted", {
3672
3668
  startupDelayMs: F ? 0 : this.startupConfig.delayMs
3673
3669
  });
3674
- const Z = () => {
3670
+ const d = () => {
3675
3671
  if (this.state === "playing")
3676
3672
  try {
3677
3673
  this.midiPlayer.play(), l && this._startMetronome();
@@ -3679,7 +3675,7 @@ class xU {
3679
3675
  this.state = "stopped", this._emitEvent("error", Q);
3680
3676
  }
3681
3677
  };
3682
- F ? Z() : setTimeout(Z, this.startupConfig.delayMs), this.timeUpdateInterval || this._startTimeUpdateLoop();
3678
+ F ? d() : setTimeout(d, this.startupConfig.delayMs), this.timeUpdateInterval || this._startTimeUpdateLoop();
3683
3679
  }
3684
3680
  /**
3685
3681
  * Start metronome during MIDI playback
@@ -3718,10 +3714,10 @@ class xU {
3718
3714
  const U = this.midiPlayer.beats;
3719
3715
  if (!U || U.length === 0)
3720
3716
  return;
3721
- const F = this.midiPlayer.getCurrentTime(), Z = 0.1;
3717
+ const F = this.midiPlayer.getCurrentTime(), d = 0.1;
3722
3718
  for (let Q = this.nextBeatIndex; Q < U.length; Q++) {
3723
3719
  const V = U[Q], t = this.midiPlayer.playbackSpeed || 1, R = l + (V.time - F) / t;
3724
- if (R > this.audioEngine.audioContext.currentTime + Z)
3720
+ if (R > this.audioEngine.audioContext.currentTime + d)
3725
3721
  break;
3726
3722
  if (R >= this.audioEngine.audioContext.currentTime - 0.01) {
3727
3723
  const a = Math.max(R, this.audioEngine.audioContext.currentTime + 1e-3), n = V.isDownbeat || V.beat === 1;
@@ -3742,11 +3738,11 @@ class xU {
3742
3738
  this.nextBeatIndex++;
3743
3739
  const F = l + 0.15;
3744
3740
  for (; this.nextBeatIndex < U.length; ) {
3745
- const Z = U[this.nextBeatIndex], Q = Z.time - l;
3746
- if (Z.time > F)
3741
+ const d = U[this.nextBeatIndex], Q = d.time - l;
3742
+ if (d.time > F)
3747
3743
  break;
3748
3744
  if (Q >= -0.025 && Q <= 0.15) {
3749
- const V = this.audioEngine.audioContext.currentTime + 5e-3, t = this.audioEngine.audioContext.currentTime + Math.max(Q, 5e-3), R = Math.max(V, t), a = Z.beat === 1;
3745
+ const V = this.audioEngine.audioContext.currentTime + 5e-3, t = this.audioEngine.audioContext.currentTime + Math.max(Q, 5e-3), R = Math.max(V, t), a = d.beat === 1;
3750
3746
  this._scheduleTickAtTime(R, a);
3751
3747
  }
3752
3748
  this.nextBeatIndex++;
@@ -3851,8 +3847,8 @@ class xU {
3851
3847
  (this.eventBus.all.get(l) || []).forEach((F) => {
3852
3848
  try {
3853
3849
  F(U);
3854
- } catch (Z) {
3855
- console.error(`Error in ${l} event listener:`, Z);
3850
+ } catch (d) {
3851
+ console.error(`Error in ${l} event listener:`, d);
3856
3852
  }
3857
3853
  });
3858
3854
  }
@@ -3921,7 +3917,10 @@ class xU {
3921
3917
  * @private
3922
3918
  */
3923
3919
  _completeMidiPlayerSetup() {
3924
- this._partOutputsMap.clear(), Object.keys(this.midiPlayer.parsedData.parts).forEach((l) => {
3920
+ this._partOutputsMap.clear(), Object.keys(this.midiPlayer.parsedData.parts).sort((l, U) => {
3921
+ const F = this.midiPlayer.parsedData.parts[l], d = this.midiPlayer.parsedData.parts[U], Q = F.channel !== void 0 ? F.channel : F.trackIndex, V = d.channel !== void 0 ? d.channel : d.trackIndex;
3922
+ return Q - V;
3923
+ }).forEach((l) => {
3925
3924
  const U = this.midiPlayer.getPartOutput(l);
3926
3925
  U && this._partOutputsMap.set(l, U);
3927
3926
  }), this._setupEventDelegation(), this.state = "ready";
@@ -3944,12 +3943,20 @@ class xU {
3944
3943
  flute: { instrument: "flute", volume: 0.8 },
3945
3944
  trumpet: { instrument: "trumpet", volume: 0.7 }
3946
3945
  };
3947
- return Object.keys(l).forEach((Z) => {
3948
- const Q = Z.toLowerCase(), V = F[Q] || F.piano;
3949
- U[Z] = {
3950
- instrument: V.instrument,
3951
- volume: V.volume
3952
- };
3946
+ return Object.keys(l).forEach((d) => {
3947
+ const Q = l[d];
3948
+ if (Q.defaultInstrument !== void 0)
3949
+ U[d] = {
3950
+ instrument: Q.defaultInstrument,
3951
+ volume: 1
3952
+ };
3953
+ else {
3954
+ const V = d.toLowerCase(), t = F[V] || F.piano;
3955
+ U[d] = {
3956
+ instrument: t.instrument,
3957
+ volume: t.volume
3958
+ };
3959
+ }
3953
3960
  }), U;
3954
3961
  }
3955
3962
  // ========================================
@@ -3969,19 +3976,19 @@ class xU {
3969
3976
  const U = this.audioEngine.getMetronomeAnalyser();
3970
3977
  if (!U)
3971
3978
  throw new Error("Metronome analyser not available for signal capture");
3972
- const F = l.sampleIntervalMs || 2, Z = l.captureDurationMs || 1500, Q = this.audioEngine.audioContext.currentTime + 0.1;
3979
+ const F = l.sampleIntervalMs || 2, d = l.captureDurationMs || 1500, Q = this.audioEngine.audioContext.currentTime + 0.1;
3973
3980
  await this.audioEngine.playMetronomeTick(Q, !0, 1);
3974
3981
  const V = await this._captureAnalyserTimeSeries(
3975
3982
  U,
3976
3983
  Q,
3977
3984
  F,
3978
- Z
3985
+ d
3979
3986
  );
3980
3987
  return {
3981
3988
  scheduledTime: Q,
3982
3989
  samples: V,
3983
3990
  sampleIntervalMs: F,
3984
- captureDurationMs: Z
3991
+ captureDurationMs: d
3985
3992
  };
3986
3993
  }
3987
3994
  /**
@@ -3993,7 +4000,7 @@ class xU {
3993
4000
  * @returns {Promise<number>} Average latency in milliseconds
3994
4001
  * @private
3995
4002
  */
3996
- async _performLatencyMeasurement(l, U, F, Z) {
4003
+ async _performLatencyMeasurement(l, U, F, d) {
3997
4004
  const Q = this.audioEngine.getMetronomeAnalyser();
3998
4005
  if (!Q)
3999
4006
  throw new Error("Metronome analyser not available for latency measurement");
@@ -4007,7 +4014,7 @@ class xU {
4007
4014
  W,
4008
4015
  U,
4009
4016
  F,
4010
- Z
4017
+ d
4011
4018
  );
4012
4019
  if (c) {
4013
4020
  const s = c.latencyMs;
@@ -4044,7 +4051,7 @@ class xU {
4044
4051
  * @returns {Promise<Object|null>} Detection result {latencyMs, rms, peak} or null if timeout
4045
4052
  * @private
4046
4053
  */
4047
- async _detectOnsetByThreshold(l, U, F, Z, Q) {
4054
+ async _detectOnsetByThreshold(l, U, F, d, Q) {
4048
4055
  const V = this.audioEngine.audioContext, t = l.fftSize, R = new Float32Array(t), a = Math.max(0, (U - V.currentTime) * 1e3 - 20);
4049
4056
  await new Promise((m) => setTimeout(m, a));
4050
4057
  const n = performance.now();
@@ -4061,7 +4068,7 @@ class xU {
4061
4068
  c += R[J] * R[J], p > s && (s = p);
4062
4069
  }
4063
4070
  const N = Math.sqrt(c / t);
4064
- if (N >= Z) {
4071
+ if (N >= d) {
4065
4072
  clearInterval(W);
4066
4073
  const J = V.currentTime, p = (J - U) * 1e3;
4067
4074
  m({
@@ -4083,11 +4090,11 @@ class xU {
4083
4090
  * @returns {Promise<Array>} Array of samples {time, rms, peak, relativeTime}
4084
4091
  * @private
4085
4092
  */
4086
- async _captureAnalyserTimeSeries(l, U, F, Z) {
4093
+ async _captureAnalyserTimeSeries(l, U, F, d) {
4087
4094
  const Q = this.audioEngine.audioContext, V = l.fftSize, t = new Float32Array(V), R = [], a = performance.now(), n = Math.max(0, (U - Q.currentTime) * 1e3 - 20);
4088
4095
  return await new Promise((m) => setTimeout(m, n)), new Promise((m) => {
4089
4096
  const W = setInterval(() => {
4090
- if (performance.now() - a - n >= Z) {
4097
+ if (performance.now() - a - n >= d) {
4091
4098
  clearInterval(W), m(R);
4092
4099
  return;
4093
4100
  }
@@ -4121,8 +4128,8 @@ class MU {
4121
4128
  // Initialize audio system
4122
4129
  async initializeAudioSystem() {
4123
4130
  if (this.isInitialized) return;
4124
- this.audioContext = new (window.AudioContext || window.webkitAudioContext)(), this.audioContext.state === "suspended" && await this.audioContext.resume(), this.audioEngine = new rU(this.audioContext), this.audioEngine.on("initProgress", (Z) => {
4125
- this.eventBus.emit("initProgress", Z);
4131
+ this.audioContext = new (window.AudioContext || window.webkitAudioContext)(), this.audioContext.state === "suspended" && await this.audioContext.resume(), this.audioEngine = new rU(this.audioContext), this.audioEngine.on("initProgress", (d) => {
4132
+ this.eventBus.emit("initProgress", d);
4126
4133
  });
4127
4134
  const l = [
4128
4135
  "/FluidR3Mono_GM.sf3",
@@ -4130,20 +4137,20 @@ class MU {
4130
4137
  "/soundfont.sf2"
4131
4138
  ];
4132
4139
  let U = !1, F = null;
4133
- for (const Z of l)
4140
+ for (const d of l)
4134
4141
  try {
4135
- await this.audioEngine.initialize(Z), console.log(`Loaded soundfont: ${Z}`), U = !0;
4142
+ await this.audioEngine.initialize(d), console.log(`Loaded soundfont: ${d}`), U = !0;
4136
4143
  break;
4137
4144
  } catch (Q) {
4138
- console.warn(`Failed to load soundfont ${Z}:`, Q.message), F = Q;
4145
+ console.warn(`Failed to load soundfont ${d}:`, Q.message), F = Q;
4139
4146
  }
4140
4147
  if (!U) {
4141
- const Z = "No soundfont could be loaded";
4148
+ const d = "No soundfont could be loaded";
4142
4149
  throw this.eventBus.emit("initProgress", {
4143
4150
  stage: "error",
4144
- message: Z,
4151
+ message: d,
4145
4152
  error: F
4146
- }), new Error(Z);
4153
+ }), new Error(d);
4147
4154
  }
4148
4155
  this.setupMasterAudioGraph(), this.isInitialized = !0, console.log("AudioEngineService initialized successfully");
4149
4156
  }
@@ -4158,7 +4165,7 @@ class MU {
4158
4165
  else {
4159
4166
  if (this.beats = l.beats || [], this.practiceMarks = l.marks || l.practiceMarks || {}, this.beats.length > 0) {
4160
4167
  const U = this.beats[this.beats.length - 1], F = U.tempo > 0 ? 60 / U.tempo : 0.75;
4161
- this.songDuration = U.time + F, this.maxBar = Math.max(...this.beats.map((Z) => Z.bar));
4168
+ this.songDuration = U.time + F, this.maxBar = Math.max(...this.beats.map((d) => d.bar));
4162
4169
  } else
4163
4170
  this.songDuration = 0, this.maxBar = 0;
4164
4171
  this.setupLegacyParts(l.parts || []), this.eventBus.emit("initialized", { parts: Array.from(this.parts.values()) });
@@ -4196,8 +4203,8 @@ class MU {
4196
4203
  // Silent calibration
4197
4204
  });
4198
4205
  console.log(`Measured audio latency: ${F} ms`), this.setupPlaybackManagerEventDelegation(), await this.playbackManager.load(l, U);
4199
- const Z = this.playbackManager.getPartNames();
4200
- this.setupMidiParts(Z), this.eventBus.emit("initialized", { parts: Array.from(this.parts.values()) }), await this.setupPartAudioRouting(Z), this.setupMetronomeAudioRouting(), this.extractMusicDataFromPlayer(), this.updateSongDurationFromPlayer(), console.log("MIDI playback with PlaybackManager setup complete");
4206
+ const d = this.playbackManager.getPartNames();
4207
+ this.setupMidiParts(d), this.eventBus.emit("initialized", { parts: Array.from(this.parts.values()) }), await this.setupPartAudioRouting(d), this.setupMetronomeAudioRouting(), this.extractMusicDataFromPlayer(), this.updateSongDurationFromPlayer(), console.log("MIDI playback with PlaybackManager setup complete");
4201
4208
  } catch (F) {
4202
4209
  throw console.error("Failed to setup MIDI playback:", F), F;
4203
4210
  }
@@ -4223,10 +4230,10 @@ class MU {
4223
4230
  for (const [l, U] of this.playbackManager.getPartOutputs()) {
4224
4231
  const F = this.audioContext.createGain();
4225
4232
  F.gain.value = 1;
4226
- const Z = this.audioContext.createAnalyser();
4227
- Z.fftSize = 256, Z.smoothingTimeConstant = 0.3, U.connect(F), F.connect(Z), Z.connect(this.masterGain);
4233
+ const d = this.audioContext.createAnalyser();
4234
+ d.fftSize = 256, d.smoothingTimeConstant = 0.3, U.connect(F), F.connect(d), d.connect(this.masterGain);
4228
4235
  const Q = this.sanitizePartName(l);
4229
- this.partGainNodes.set(Q, F), this.partAnalyserNodes.set(Q, Z), console.log(`Audio routing established for part: ${l}`);
4236
+ this.partGainNodes.set(Q, F), this.partAnalyserNodes.set(Q, d), console.log(`Audio routing established for part: ${l}`);
4230
4237
  }
4231
4238
  }
4232
4239
  // Set up metronome audio routing (separate from parts)
@@ -4274,8 +4281,8 @@ class MU {
4274
4281
  setupPlaybackManagerEventDelegation() {
4275
4282
  this.playbackManager.on("timeupdate", ({ audioTime: l, leadInProgress: U }) => {
4276
4283
  this.currentTime = l, this.eventBus.emit("timeChanged", { currentTime: l, leadInProgress: U });
4277
- }), this.playbackManager.on("beatAudible", ({ bar: l, beat: U, isLeadIn: F, repeat: Z, time: Q }) => {
4278
- this.eventBus.emit("barChanged", { bar: l, beat: U, repeat: Z, time: Q, isLeadIn: F });
4284
+ }), this.playbackManager.on("beatAudible", ({ bar: l, beat: U, isLeadIn: F, repeat: d, time: Q }) => {
4285
+ this.eventBus.emit("barChanged", { bar: l, beat: U, repeat: d, time: Q, isLeadIn: F });
4279
4286
  }), this.playbackManager.on("leadInStarted", ({ totalBeats: l, duration: U, bars: F }) => {
4280
4287
  this.eventBus.emit("leadInStarted", { bars: F, totalBeats: l, duration: U });
4281
4288
  }), this.playbackManager.on("leadInEnded", () => {
@@ -4386,16 +4393,16 @@ class MU {
4386
4393
  return this.metronomeVolume || 0.7;
4387
4394
  }
4388
4395
  setPartVolume(l, U) {
4389
- const F = this.sanitizePartName(l), Z = this.parts.get(F);
4390
- Z ? (Z.volume = Math.max(0, Math.min(1, U)), this.updatePartAudioState(F), this.eventBus.emit("partVolumeChanged", { partName: l, volume: U })) : (console.log(`Part not found: "${l}" (sanitized: "${F}")`), console.log("Available parts:", [...this.parts.keys()]));
4396
+ const F = this.sanitizePartName(l), d = this.parts.get(F);
4397
+ d ? (d.volume = Math.max(0, Math.min(1, U)), this.updatePartAudioState(F), this.eventBus.emit("partVolumeChanged", { partName: l, volume: U })) : (console.log(`Part not found: "${l}" (sanitized: "${F}")`), console.log("Available parts:", [...this.parts.keys()]));
4391
4398
  }
4392
4399
  setPartMuted(l, U) {
4393
- const F = this.sanitizePartName(l), Z = this.parts.get(F);
4394
- Z && (Z.muted = U, this.updatePartAudioState(F), this.eventBus.emit("partMutedChanged", { partName: l, muted: U }));
4400
+ const F = this.sanitizePartName(l), d = this.parts.get(F);
4401
+ d && (d.muted = U, this.updatePartAudioState(F), this.eventBus.emit("partMutedChanged", { partName: l, muted: U }));
4395
4402
  }
4396
4403
  setPartSolo(l, U) {
4397
- const F = this.sanitizePartName(l), Z = this.parts.get(F);
4398
- Z && (Z.solo = U, this.updateAllPartsAudioState(), this.eventBus.emit("partSoloChanged", { partName: l, solo: U }));
4404
+ const F = this.sanitizePartName(l), d = this.parts.get(F);
4405
+ d && (d.solo = U, this.updateAllPartsAudioState(), this.eventBus.emit("partSoloChanged", { partName: l, solo: U }));
4399
4406
  }
4400
4407
  // Helper method to determine if a part should be effectively muted
4401
4408
  isPartEffectivelyMuted(l) {
@@ -4406,8 +4413,8 @@ class MU {
4406
4413
  updatePartAudioState(l) {
4407
4414
  const U = this.parts.get(l), F = this.partGainNodes.get(l);
4408
4415
  if (U && F) {
4409
- const Z = this.isPartEffectivelyMuted(U.name);
4410
- F.gain.value = Z ? 0 : U.volume;
4416
+ const d = this.isPartEffectivelyMuted(U.name);
4417
+ F.gain.value = d ? 0 : U.volume;
4411
4418
  }
4412
4419
  }
4413
4420
  // Update audio state for all parts (needed when solo state changes)
@@ -4424,17 +4431,17 @@ class MU {
4424
4431
  if (!F)
4425
4432
  return 0;
4426
4433
  try {
4427
- const Z = F.frequencyBinCount, Q = new Uint8Array(Z);
4434
+ const d = F.frequencyBinCount, Q = new Uint8Array(d);
4428
4435
  F.getByteFrequencyData(Q);
4429
4436
  let V = 0;
4430
- for (let R = 0; R < Z; R++) {
4437
+ for (let R = 0; R < d; R++) {
4431
4438
  const a = Q[R] / 255;
4432
4439
  V += a * a;
4433
4440
  }
4434
- const t = Math.sqrt(V / Z);
4441
+ const t = Math.sqrt(V / d);
4435
4442
  return Math.min(1, Math.pow(t * 2, 0.7));
4436
- } catch (Z) {
4437
- return console.warn(`Failed to get level for part ${l}:`, Z), 0;
4443
+ } catch (d) {
4444
+ return console.warn(`Failed to get level for part ${l}:`, d), 0;
4438
4445
  }
4439
4446
  }
4440
4447
  // Special features (maintain DummyAudioEngine interface)
@@ -4443,7 +4450,7 @@ class MU {
4443
4450
  }
4444
4451
  playStartingNotes() {
4445
4452
  console.log(this.parts);
4446
- const l = [...this.parts.values()], U = l.some((Z) => Z.solo), F = l.filter((Z) => U ? Z.solo : !Z.muted).map((Z) => Z.name);
4453
+ const l = [...this.parts.values()], U = l.some((d) => d.solo), F = l.filter((d) => U ? d.solo : !d.muted).map((d) => d.name);
4447
4454
  console.log(l, U, F), this.playbackManager.previewNextNotes({
4448
4455
  instrument: "piano",
4449
4456
  // Use piano for clear pitch reference
@@ -4513,55 +4520,55 @@ class MU {
4513
4520
  }
4514
4521
  const e = new MU();
4515
4522
  function Rl() {
4516
- const d = Ul(), l = tl(), U = NU(), F = ({ currentTime: b }) => {
4517
- d.setCurrentTime(b);
4518
- }, Z = ({ isPlaying: b }) => {
4519
- d.setPlaybackState(b), U.setTransportState(b ? "playing" : "stopped");
4523
+ const Z = Ul(), l = tl(), U = NU(), F = ({ currentTime: b }) => {
4524
+ Z.setCurrentTime(b);
4525
+ }, d = ({ isPlaying: b }) => {
4526
+ Z.setPlaybackState(b), U.setTransportState(b ? "playing" : "stopped");
4520
4527
  }, Q = (b) => {
4521
- b && (d.isLeadInActive ? b.isLeadIn && b.beat !== void 0 && d.setCurrentBar(null, b.beat, null) : (d.setCurrentBar(b.bar, b.beat, b.repeat), U.updateLastBarPosition(b.bar)));
4528
+ b && (Z.isLeadInActive ? b.isLeadIn && b.beat !== void 0 && Z.setCurrentBar(null, b.beat, null) : (Z.setCurrentBar(b.bar, b.beat, b.repeat), U.updateLastBarPosition(b.bar)));
4522
4529
  }, V = ({ speed: b }) => {
4523
- d.setPlaybackSpeed(b);
4530
+ Z.setPlaybackSpeed(b);
4524
4531
  }, t = ({ volume: b }) => {
4525
- d.setMasterVolume(b);
4532
+ Z.setMasterVolume(b);
4526
4533
  }, R = ({ partName: b, volume: o }) => {
4527
- d.setPartVolume(b, o);
4534
+ Z.setPartVolume(b, o);
4528
4535
  }, a = ({ partName: b, muted: o }) => {
4529
- d.setPartMuted(b, o);
4536
+ Z.setPartMuted(b, o);
4530
4537
  }, n = ({ partName: b, solo: o }) => {
4531
- d.setPartSolo(b, o);
4538
+ Z.setPartSolo(b, o);
4532
4539
  }, m = ({ bars: b }) => {
4533
- d.setLeadInActive(!0, b);
4540
+ Z.setLeadInActive(!0, b);
4534
4541
  }, W = () => {
4535
- d.setLeadInActive(!1);
4542
+ Z.setLeadInActive(!1);
4536
4543
  }, c = () => {
4537
- d.setStartingNotesActive(!0);
4544
+ Z.setStartingNotesActive(!0);
4538
4545
  }, s = () => {
4539
- d.setStartingNotesActive(!1);
4546
+ Z.setStartingNotesActive(!1);
4540
4547
  }, N = ({ mark: b }) => {
4541
4548
  U.updateLastPracticeMarkUsed(b);
4542
4549
  }, J = ({ parts: b }) => {
4543
- d.initializeParts(b), l.setParts(b);
4550
+ Z.initializeParts(b), l.setParts(b);
4544
4551
  }, p = ({ finalTime: b }) => {
4545
- d.setPlaybackState(!1), U.setTransportState("stopped"), console.log(`Song ended at time: ${b}`);
4552
+ Z.setPlaybackState(!1), U.setTransportState("stopped"), console.log(`Song ended at time: ${b}`);
4546
4553
  }, M = ({ duration: b }) => {
4547
4554
  console.log("Updating total duration in store to:", b), l.setTotalDuration(b);
4548
4555
  }, y = ({ beats: b, practiceMarks: o, maxBar: q }) => {
4549
4556
  console.log(`Updating music data store with ${b.length} beats and ${Object.keys(o).length} practice marks`), l.updateBeats(b), l.practiceMarks = o, l.maxBar = q;
4550
4557
  }, u = () => {
4551
- e.on("timeChanged", F), e.on("playbackStateChanged", Z), e.on("barChanged", Q), e.on("speedChanged", V), e.on("masterVolumeChanged", t), e.on("partVolumeChanged", R), e.on("partMutedChanged", a), e.on("partSoloChanged", n), e.on("leadInStarted", m), e.on("leadInCompleted", W), e.on("startingNotesStarted", c), e.on("startingNotesCompleted", s), e.on("practiceMarkChanged", N), e.on("initialized", J), e.on("songEnded", p), e.on("durationUpdated", M), e.on("musicDataExtracted", y);
4558
+ e.on("timeChanged", F), e.on("playbackStateChanged", d), e.on("barChanged", Q), e.on("speedChanged", V), e.on("masterVolumeChanged", t), e.on("partVolumeChanged", R), e.on("partMutedChanged", a), e.on("partSoloChanged", n), e.on("leadInStarted", m), e.on("leadInCompleted", W), e.on("startingNotesStarted", c), e.on("startingNotesCompleted", s), e.on("practiceMarkChanged", N), e.on("initialized", J), e.on("songEnded", p), e.on("durationUpdated", M), e.on("musicDataExtracted", y);
4552
4559
  }, k = () => {
4553
- e.off("timeChanged", F), e.off("playbackStateChanged", Z), e.off("barChanged", Q), e.off("speedChanged", V), e.off("masterVolumeChanged", t), e.off("partVolumeChanged", R), e.off("partMutedChanged", a), e.off("partSoloChanged", n), e.off("leadInStarted", m), e.off("leadInCompleted", W), e.off("startingNotesStarted", c), e.off("startingNotesCompleted", s), e.off("practiceMarkChanged", N), e.off("initialized", J), e.off("songEnded", p), e.off("durationUpdated", M), e.off("musicDataExtracted", y);
4560
+ e.off("timeChanged", F), e.off("playbackStateChanged", d), e.off("barChanged", Q), e.off("speedChanged", V), e.off("masterVolumeChanged", t), e.off("partVolumeChanged", R), e.off("partMutedChanged", a), e.off("partSoloChanged", n), e.off("leadInStarted", m), e.off("leadInCompleted", W), e.off("startingNotesStarted", c), e.off("startingNotesCompleted", s), e.off("practiceMarkChanged", N), e.off("initialized", J), e.off("songEnded", p), e.off("durationUpdated", M), e.off("musicDataExtracted", y);
4554
4561
  };
4555
4562
  (() => {
4556
4563
  El(() => {
4557
- const b = d.masterVolume;
4564
+ const b = Z.masterVolume;
4558
4565
  try {
4559
4566
  e.getMasterVolume() !== b && e.setMasterVolume(b);
4560
4567
  } catch (o) {
4561
4568
  console.warn("Master volume sync skipped during initialization:", o.message);
4562
4569
  }
4563
4570
  }), El(() => {
4564
- const b = d.metronomeVolume;
4571
+ const b = Z.metronomeVolume;
4565
4572
  try {
4566
4573
  e.getMetronomeVolume() !== b && e.setMetronomeVolume(b);
4567
4574
  } catch (o) {
@@ -4571,13 +4578,13 @@ function Rl() {
4571
4578
  })();
4572
4579
  const H = async (b) => {
4573
4580
  try {
4574
- if (d.setLoaded(!1), u(), l.loadMusicData(b), await e.initialize(b), !b.midiData && b.beats && b.beats.length > 0) {
4581
+ if (Z.setLoaded(!1), u(), l.loadMusicData(b), await e.initialize(b), !b.midiData && b.beats && b.beats.length > 0) {
4575
4582
  const o = b.beats[0];
4576
- d.setCurrentBar(o.bar, o.beat, o.repeat), e.setTime(o.time);
4583
+ Z.setCurrentBar(o.bar, o.beat, o.repeat), e.setTime(o.time);
4577
4584
  }
4578
- e.updateToggleStates(d.metronomeEnabled, d.leadInEnabled), d.setLoaded(!0);
4585
+ e.updateToggleStates(Z.metronomeEnabled, Z.leadInEnabled), Z.setLoaded(!0);
4579
4586
  } catch (o) {
4580
- throw console.error("Failed to initialize audio engine:", o), d.setLoaded(!1), o;
4587
+ throw console.error("Failed to initialize audio engine:", o), Z.setLoaded(!1), o;
4581
4588
  }
4582
4589
  }, A = () => {
4583
4590
  e.play();
@@ -4611,11 +4618,11 @@ function Rl() {
4611
4618
  const q = l.getBarForMark(b);
4612
4619
  q && Yl(q, o);
4613
4620
  }, $l = () => {
4614
- const b = !d.metronomeEnabled;
4615
- return d.setMetronomeEnabled(b), e.setMetronomeEnabled(b), b;
4621
+ const b = !Z.metronomeEnabled;
4622
+ return Z.setMetronomeEnabled(b), e.setMetronomeEnabled(b), b;
4616
4623
  }, lU = () => {
4617
- const b = !d.leadInEnabled;
4618
- return d.setLeadInEnabled(b), e.updateToggleStates(d.metronomeEnabled, b), b;
4624
+ const b = !Z.leadInEnabled;
4625
+ return Z.setLeadInEnabled(b), e.updateToggleStates(Z.metronomeEnabled, b), b;
4619
4626
  };
4620
4627
  return cl(() => {
4621
4628
  k();
@@ -4645,13 +4652,13 @@ function Rl() {
4645
4652
  toggleMetronome: $l,
4646
4653
  toggleLeadIn: lU,
4647
4654
  setMetronomeEnabled: (b) => {
4648
- d.setMetronomeEnabled(b), e.setMetronomeEnabled(b);
4655
+ Z.setMetronomeEnabled(b), e.setMetronomeEnabled(b);
4649
4656
  },
4650
4657
  // Complex operations
4651
4658
  playFromBar: Yl,
4652
4659
  playFromMark: _l,
4653
4660
  // Access to stores for components
4654
- audioState: d,
4661
+ audioState: Z,
4655
4662
  musicData: l,
4656
4663
  playbackState: U,
4657
4664
  // Direct access to engine for advanced use
@@ -4668,7 +4675,7 @@ const zU = {
4668
4675
  level: {
4669
4676
  type: Number,
4670
4677
  default: 0,
4671
- validator: (d) => d >= 0 && d <= 1
4678
+ validator: (Z) => Z >= 0 && Z <= 1
4672
4679
  }
4673
4680
  }, {
4674
4681
  volume: { default: 0.75 },
@@ -4679,16 +4686,16 @@ const zU = {
4679
4686
  soloModifiers: {}
4680
4687
  }),
4681
4688
  emits: ["update:volume", "update:mute", "update:solo"],
4682
- setup(d) {
4689
+ setup(Z) {
4683
4690
  $((c) => ({
4684
4691
  "746d5fc3": a.value
4685
4692
  }));
4686
- const l = d;
4693
+ const l = Z;
4687
4694
  Ul();
4688
- const U = Rl(), F = _(d, "volume"), Z = _(d, "mute"), Q = _(d, "solo");
4695
+ const U = Rl(), F = _(Z, "volume"), d = _(Z, "mute"), Q = _(Z, "solo");
4689
4696
  v(F, (c) => {
4690
4697
  U.setPartVolume(l.name, c);
4691
- }), v(Z, (c) => {
4698
+ }), v(d, (c) => {
4692
4699
  U.setPartMuted(l.name, c);
4693
4700
  }), v(Q, (c) => {
4694
4701
  U.setPartSolo(l.name, c);
@@ -4700,7 +4707,7 @@ const zU = {
4700
4707
  const W = x(0);
4701
4708
  return el(() => {
4702
4709
  m = setInterval(() => {
4703
- if (Z.value)
4710
+ if (d.value)
4704
4711
  W.value = 0;
4705
4712
  else
4706
4713
  try {
@@ -4718,8 +4725,8 @@ const zU = {
4718
4725
  }, [
4719
4726
  C(XU, {
4720
4727
  class: "tri",
4721
- mute: Z.value,
4722
- "onUpdate:mute": s[0] || (s[0] = (N) => Z.value = N),
4728
+ mute: d.value,
4729
+ "onUpdate:mute": s[0] || (s[0] = (N) => d.value = N),
4723
4730
  solo: Q.value,
4724
4731
  "onUpdate:solo": s[1] || (s[1] = (N) => Q.value = N)
4725
4732
  }, null, 8, ["mute", "solo"]),
@@ -4728,7 +4735,7 @@ const zU = {
4728
4735
  class: "name"
4729
4736
  }, {
4730
4737
  default: D(() => [
4731
- ol(K(d.name), 1)
4738
+ ol(K(Z.name), 1)
4732
4739
  ]),
4733
4740
  _: 1
4734
4741
  }),
@@ -4746,12 +4753,12 @@ const zU = {
4746
4753
  class: "mark-grid-container"
4747
4754
  }, jU = { class: "mark-grid" }, PU = ["onClick"], wU = {
4748
4755
  __name: "BarInput",
4749
- setup(d) {
4756
+ setup(Z) {
4750
4757
  $((B) => ({
4751
4758
  b117cda6: p.value,
4752
4759
  "7cd7b1c8": M.value
4753
4760
  }));
4754
- const l = O("el"), U = O("rpt"), { width: F, height: Z } = ll(l), Q = tl(), V = Ul(), t = Rl(), R = x("1"), a = x("A"), n = x(0), m = x(2), W = x(!1), c = x(!1), s = x(!1), N = x(!0);
4761
+ const l = O("el"), U = O("rpt"), { width: F, height: d } = ll(l), Q = tl(), V = Ul(), t = Rl(), R = x("1"), a = x("A"), n = x(0), m = x(2), W = x(!1), c = x(!1), s = x(!1), N = x(!0);
4755
4762
  let J = null;
4756
4763
  v(() => {
4757
4764
  var B;
@@ -4771,7 +4778,7 @@ const zU = {
4771
4778
  }), v(c, () => {
4772
4779
  c.value && P();
4773
4780
  });
4774
- const p = G(() => Math.min(Z.value / 2.25, F.value / 4.5) + "px"), M = G(() => Math.min(F.value / 15, Z.value / 6.4) + "px"), y = G(() => Object.keys(Q.practiceMarks).sort()), u = G(() => y.value.length > 0);
4781
+ const p = G(() => Math.min(d.value / 2.25, F.value / 4.5) + "px"), M = G(() => Math.min(F.value / 15, d.value / 6.4) + "px"), y = G(() => Object.keys(Q.practiceMarks).sort()), u = G(() => y.value.length > 0);
4775
4782
  function k(B) {
4776
4783
  const S = Object.keys(Q.practiceMarks).filter((T) => Q.practiceMarks[T] <= B).sort((T, I) => Q.practiceMarks[I] - Q.practiceMarks[T]);
4777
4784
  S.length > 0 && (a.value = S[0]);
@@ -4917,23 +4924,23 @@ const zU = {
4917
4924
  },
4918
4925
  formatValue: {
4919
4926
  type: Function,
4920
- default: (d) => d.toString()
4927
+ default: (Z) => Z.toString()
4921
4928
  },
4922
4929
  parseValue: {
4923
4930
  type: Function,
4924
- default: (d) => parseFloat(d)
4931
+ default: (Z) => parseFloat(Z)
4925
4932
  },
4926
4933
  validateInput: {
4927
4934
  type: Function,
4928
- default: (d) => d.replace(/[^0-9.]/g, "")
4935
+ default: (Z) => Z.replace(/[^0-9.]/g, "")
4929
4936
  },
4930
4937
  transformSliderToDisplay: {
4931
4938
  type: Function,
4932
- default: (d) => d
4939
+ default: (Z) => Z
4933
4940
  },
4934
4941
  transformDisplayToSlider: {
4935
4942
  type: Function,
4936
- default: (d) => d
4943
+ default: (Z) => Z
4937
4944
  },
4938
4945
  maxChars: {
4939
4946
  type: Number,
@@ -4944,23 +4951,23 @@ const zU = {
4944
4951
  valueModifiers: {}
4945
4952
  }),
4946
4953
  emits: ["update:value"],
4947
- setup(d) {
4954
+ setup(Z) {
4948
4955
  $((n) => ({
4949
- "0d0963e0": d.textColor,
4950
- "4ad34b2f": d.backgroundColor,
4951
- "02156786": d.color,
4956
+ "0d0963e0": Z.textColor,
4957
+ "4ad34b2f": Z.backgroundColor,
4958
+ "02156786": Z.color,
4952
4959
  "715a9528": R.value,
4953
4960
  "30d64f7d": t.value,
4954
- b8fbe65e: d.focusColor
4961
+ b8fbe65e: Z.focusColor
4955
4962
  }));
4956
- const l = d, U = O("el"), { width: F, height: Z } = ll(U), Q = _(d, "value"), V = x(l.formatValue(l.transformSliderToDisplay(Q.value)));
4963
+ const l = Z, U = O("el"), { width: F, height: d } = ll(U), Q = _(Z, "value"), V = x(l.formatValue(l.transformSliderToDisplay(Q.value)));
4957
4964
  v(Q, () => {
4958
4965
  const n = l.transformSliderToDisplay(Q.value);
4959
4966
  V.value = l.formatValue(n);
4960
4967
  }), v(V, () => {
4961
4968
  V.value = l.validateInput(V.value), l.maxChars && V.value.length > l.maxChars && (V.value = V.value.slice(0, l.maxChars));
4962
4969
  });
4963
- const t = G(() => Math.min(Z.value / 2.25, F.value / 2.2) + "px"), R = G(() => Math.min(F.value / 3, Z.value / 6.4) + "px");
4970
+ const t = G(() => Math.min(d.value / 2.25, F.value / 2.2) + "px"), R = G(() => Math.min(F.value / 3, d.value / 6.4) + "px");
4964
4971
  function a() {
4965
4972
  const n = l.parseValue(V.value), m = l.transformDisplayToSlider(n);
4966
4973
  Q.value = Math.min(Math.max(m, l.sliderMin), l.sliderMax);
@@ -4981,27 +4988,27 @@ const zU = {
4981
4988
  }, null, 544), [
4982
4989
  [Kl, V.value]
4983
4990
  ]),
4984
- h("div", fU, K(d.title), 1),
4991
+ h("div", fU, K(Z.title), 1),
4985
4992
  C(bl, {
4986
4993
  class: "slider",
4987
4994
  value: Q.value,
4988
4995
  "onUpdate:value": m[1] || (m[1] = (W) => Q.value = W),
4989
- "thumb-length": d.thumbLength,
4990
- max: d.sliderMax,
4991
- min: d.sliderMin
4996
+ "thumb-length": Z.thumbLength,
4997
+ max: Z.sliderMax,
4998
+ min: Z.sliderMin
4992
4999
  }, null, 8, ["value", "thumb-length", "max", "min"])
4993
5000
  ], 512));
4994
5001
  }
4995
5002
  }, ql = /* @__PURE__ */ g(AU, [["__scopeId", "data-v-79c7a539"]]), qU = {
4996
5003
  __name: "SpeedInput",
4997
- setup(d) {
5004
+ setup(Z) {
4998
5005
  const l = Ul(), U = Rl(), F = G({
4999
5006
  get: () => Math.log2(l.playbackSpeed) * 0.5 + 0.5,
5000
5007
  set: (a) => {
5001
5008
  const n = Math.pow(2, a * 2 - 1);
5002
5009
  U.setPlaybackSpeed(n);
5003
5010
  }
5004
- }), Z = (a) => Math.floor(Math.pow(2, a * 2 - 1) * 100 + 0.5) + "", Q = (a) => parseFloat(a), V = (a) => a.replace(/\D/g, ""), t = (a) => a, R = (a) => {
5011
+ }), d = (a) => Math.floor(Math.pow(2, a * 2 - 1) * 100 + 0.5) + "", Q = (a) => parseFloat(a), V = (a) => a.replace(/\D/g, ""), t = (a) => a, R = (a) => {
5005
5012
  const n = Math.log2(a / 100) * 0.5 + 0.5;
5006
5013
  return Math.min(Math.max(n, 0), 1);
5007
5014
  };
@@ -5011,7 +5018,7 @@ const zU = {
5011
5018
  title: "Speed",
5012
5019
  color: "#336",
5013
5020
  "text-color": "#aad",
5014
- "format-value": Z,
5021
+ "format-value": d,
5015
5022
  "parse-value": Q,
5016
5023
  "validate-input": V,
5017
5024
  "transform-slider-to-display": t,
@@ -5022,8 +5029,8 @@ const zU = {
5022
5029
  }
5023
5030
  }, _U = {
5024
5031
  __name: "TimeInput",
5025
- setup(d) {
5026
- const l = Ul(), U = tl(), F = Rl(), Z = (a) => a.toFixed(1), Q = (a) => parseFloat(a), V = (a) => a.replace(/[^0-9.]/g, ""), t = (a) => a, R = (a) => a;
5032
+ setup(Z) {
5033
+ const l = Ul(), U = tl(), F = Rl(), d = (a) => a.toFixed(1), Q = (a) => parseFloat(a), V = (a) => a.replace(/[^0-9.]/g, ""), t = (a) => a, R = (a) => a;
5027
5034
  return (a, n) => (X(), nl(ql, {
5028
5035
  value: r(l).currentTime,
5029
5036
  "onUpdate:value": [
@@ -5037,7 +5044,7 @@ const zU = {
5037
5044
  "background-color": "#111117",
5038
5045
  "slider-max": r(U).totalDuration,
5039
5046
  "slider-min": 0,
5040
- "format-value": Z,
5047
+ "format-value": d,
5041
5048
  "parse-value": Q,
5042
5049
  "validate-input": V,
5043
5050
  "transform-slider-to-display": t,
@@ -5047,16 +5054,16 @@ const zU = {
5047
5054
  }
5048
5055
  }, $U = { class: "inner" }, lF = {
5049
5056
  __name: "AudioButton",
5050
- setup(d) {
5057
+ setup(Z) {
5051
5058
  const l = x(!1), U = () => l.value = !0, F = () => l.value = !1;
5052
- return (Z, Q) => (X(), Y("div", {
5059
+ return (d, Q) => (X(), Y("div", {
5053
5060
  class: L(["button-outer", { down: l.value }]),
5054
5061
  onPointerdown: U,
5055
5062
  onPointerup: F,
5056
5063
  onPointerleave: F
5057
5064
  }, [
5058
5065
  h("div", $U, [
5059
- Vl(Z.$slots, "default", {}, void 0, !0)
5066
+ Vl(d.$slots, "default", {}, void 0, !0)
5060
5067
  ])
5061
5068
  ], 34));
5062
5069
  }
@@ -5065,9 +5072,9 @@ const zU = {
5065
5072
  viewBox: "0 0 48 48"
5066
5073
  }, QF = ["d"], VF = {
5067
5074
  __name: "MixerControls",
5068
- setup(d) {
5075
+ setup(Z) {
5069
5076
  const l = tl(), U = Ul(), F = Rl();
5070
- function Z() {
5077
+ function d() {
5071
5078
  U.isPlaying ? F.stop() : F.play();
5072
5079
  }
5073
5080
  function Q() {
@@ -5190,7 +5197,7 @@ const zU = {
5190
5197
  }),
5191
5198
  C(Fl, {
5192
5199
  class: "button",
5193
- onClick: Z
5200
+ onClick: d
5194
5201
  }, {
5195
5202
  default: D(() => [
5196
5203
  (X(), Y("svg", ZF, [
@@ -5295,8 +5302,8 @@ const zU = {
5295
5302
  default: null
5296
5303
  }
5297
5304
  },
5298
- setup(d) {
5299
- const l = d, U = G(() => l.progress !== null), F = G(() => l.progress === null ? 0 : Math.max(0, Math.min(100, l.progress * 100))), Z = G(() => l.hasError ? l.errorMessage : l.message);
5305
+ setup(Z) {
5306
+ const l = Z, U = G(() => l.progress !== null), F = G(() => l.progress === null ? 0 : Math.max(0, Math.min(100, l.progress * 100))), d = G(() => l.hasError ? l.errorMessage : l.message);
5300
5307
  return (Q, V) => (X(), Y("div", RF, [
5301
5308
  U.value ? (X(), Y("div", aF, [
5302
5309
  h("div", {
@@ -5306,8 +5313,8 @@ const zU = {
5306
5313
  ])) : f("", !0),
5307
5314
  h("div", nF, [
5308
5315
  h("div", {
5309
- class: L(["message", { error: d.hasError }])
5310
- }, K(Z.value), 3)
5316
+ class: L(["message", { error: Z.hasError }])
5317
+ }, K(d.value), 3)
5311
5318
  ])
5312
5319
  ]));
5313
5320
  }
@@ -5335,15 +5342,15 @@ const zU = {
5335
5342
  * @param {string} event.message - Human-readable message
5336
5343
  * @param {number} [event.progress] - Optional progress (0-1)
5337
5344
  */
5338
- updateProgress(d) {
5339
- this.currentStage = d.stage, this.message = d.message, this.progress = d.progress ?? null, d.stage === "ready" ? (this.isInitializing = !1, this.isReady = !0) : (this.isInitializing = !0, this.isReady = !1), this.hasError = !1, this.errorMessage = null;
5345
+ updateProgress(Z) {
5346
+ this.currentStage = Z.stage, this.message = Z.message, this.progress = Z.progress ?? null, Z.stage === "ready" ? (this.isInitializing = !1, this.isReady = !0) : (this.isInitializing = !0, this.isReady = !1), this.hasError = !1, this.errorMessage = null;
5340
5347
  },
5341
5348
  /**
5342
5349
  * Set error state
5343
5350
  * @param {string} message - Error message
5344
5351
  */
5345
- setError(d) {
5346
- this.hasError = !0, this.errorMessage = d, this.isInitializing = !1, this.isReady = !1;
5352
+ setError(Z) {
5353
+ this.hasError = !0, this.errorMessage = Z, this.isInitializing = !1, this.isReady = !1;
5347
5354
  },
5348
5355
  /**
5349
5356
  * Reset initialization state
@@ -5356,8 +5363,8 @@ const zU = {
5356
5363
  * Should be called once during app startup
5357
5364
  */
5358
5365
  initializeListeners() {
5359
- e.on("initProgress", (d) => {
5360
- this.updateProgress(d);
5366
+ e.on("initProgress", (Z) => {
5367
+ this.updateProgress(Z);
5361
5368
  });
5362
5369
  }
5363
5370
  },
@@ -5365,12 +5372,12 @@ const zU = {
5365
5372
  /**
5366
5373
  * Whether to show the progress indicator
5367
5374
  */
5368
- shouldShowProgress: (d) => d.isInitializing || d.hasError,
5375
+ shouldShowProgress: (Z) => Z.isInitializing || Z.hasError,
5369
5376
  /**
5370
5377
  * Whether the progress bar should be visible
5371
5378
  * Only show for stages that have progress data
5372
5379
  */
5373
- hasProgressBar: (d) => d.progress !== null
5380
+ hasProgressBar: (Z) => Z.progress !== null
5374
5381
  }
5375
5382
  }), cF = { class: "container" }, eF = { class: "panel" }, sF = {
5376
5383
  key: 0,
@@ -5384,15 +5391,15 @@ const zU = {
5384
5391
  default: !0
5385
5392
  }
5386
5393
  },
5387
- setup(d) {
5394
+ setup(Z) {
5388
5395
  $((W) => ({
5389
5396
  "53ffcc08": a.value,
5390
5397
  "53f8f922": n.value,
5391
5398
  "2b0b3d37": m.value
5392
5399
  }));
5393
- const l = d, U = tl(), F = Ul(), Z = bF();
5400
+ const l = Z, U = tl(), F = Ul(), d = bF();
5394
5401
  el(() => {
5395
- Z.initializeListeners();
5402
+ d.initializeListeners();
5396
5403
  });
5397
5404
  const Q = O("container"), { width: V } = ll(Q), t = G(() => F.isLoaded), R = G(() => {
5398
5405
  const W = V.value, c = U.parts.length;
@@ -5453,13 +5460,13 @@ const zU = {
5453
5460
  _: 3
5454
5461
  }, 8, ["title"]),
5455
5462
  t.value ? f("", !0) : (X(), Y("div", sF)),
5456
- l.showInitProgress && r(Z).shouldShowProgress ? (X(), nl(WF, {
5463
+ l.showInitProgress && r(d).shouldShowProgress ? (X(), nl(WF, {
5457
5464
  key: 1,
5458
- stage: r(Z).currentStage,
5459
- message: r(Z).message,
5460
- progress: r(Z).progress,
5461
- "has-error": r(Z).hasError,
5462
- "error-message": r(Z).errorMessage
5465
+ stage: r(d).currentStage,
5466
+ message: r(d).message,
5467
+ progress: r(d).progress,
5468
+ "has-error": r(d).hasError,
5469
+ "error-message": r(d).errorMessage
5463
5470
  }, null, 8, ["stage", "message", "progress", "has-error", "error-message"])) : f("", !0)
5464
5471
  ])
5465
5472
  ])
@@ -5480,14 +5487,14 @@ const zU = {
5480
5487
  default: ""
5481
5488
  }
5482
5489
  },
5483
- setup(d) {
5490
+ setup(Z) {
5484
5491
  return $((l) => ({
5485
- "66bea586": d.colour
5492
+ "66bea586": Z.colour
5486
5493
  })), (l, U) => (X(), Y("div", SF, [
5487
5494
  h("div", oF, [
5488
5495
  h("div", XF, [
5489
- d.text || l.$slots.default ? (X(), Y("div", NF, [
5490
- ol(K(d.text) + " ", 1),
5496
+ Z.text || l.$slots.default ? (X(), Y("div", NF, [
5497
+ ol(K(Z.text) + " ", 1),
5491
5498
  Vl(l.$slots, "default", {}, void 0, !0)
5492
5499
  ])) : f("", !0)
5493
5500
  ])
@@ -5503,7 +5510,7 @@ class YF {
5503
5510
  initialize(l) {
5504
5511
  if (this.musicData = l, this.beats = l.beats || [], this.practiceMarks = l.practiceMarks || {}, this.beats.length > 0) {
5505
5512
  const U = this.beats[this.beats.length - 1], F = U.tempo > 0 ? 60 / U.tempo : 0.75;
5506
- this.songDuration = U.time + F, this.maxBar = Math.max(...this.beats.map((Z) => Z.bar));
5513
+ this.songDuration = U.time + F, this.maxBar = Math.max(...this.beats.map((d) => d.bar));
5507
5514
  } else
5508
5515
  this.songDuration = 0, this.maxBar = 0;
5509
5516
  l.parts && l.parts.forEach((U) => {
@@ -5601,8 +5608,8 @@ class YF {
5601
5608
  return;
5602
5609
  }
5603
5610
  this.eventBus.emit("timeChanged", { currentTime: this.currentTime });
5604
- const Z = this.getBarFromTime(this.currentTime);
5605
- if (Z && (this.eventBus.emit("barChanged", Z), this.maxBar > 0 && Z.bar > this.maxBar)) {
5611
+ const d = this.getBarFromTime(this.currentTime);
5612
+ if (d && (this.eventBus.emit("barChanged", d), this.maxBar > 0 && d.bar > this.maxBar)) {
5606
5613
  this.stop(), this.eventBus.emit("songEnded", { finalTime: this.currentTime });
5607
5614
  return;
5608
5615
  }
@@ -5631,10 +5638,10 @@ class YF {
5631
5638
  getTimeFromBar(l, U = 0) {
5632
5639
  if (!this.beats || this.beats.length === 0) return null;
5633
5640
  let F = this.beats.find(
5634
- (Z) => Z.bar === l && Z.beat === 1 && Z.repeat === U
5641
+ (d) => d.bar === l && d.beat === 1 && d.repeat === U
5635
5642
  );
5636
5643
  return F || (F = this.beats.find(
5637
- (Z) => Z.bar === l && Z.beat === 1
5644
+ (d) => d.bar === l && d.beat === 1
5638
5645
  )), F ? F.time : null;
5639
5646
  }
5640
5647
  destroy() {