@yam8d/m8-sdk 0.5.5 → 0.5.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/index.js +676 -646
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/types/engine/cursorTargets.d.ts +7 -0
package/dist/index.js
CHANGED
|
@@ -521,7 +521,7 @@ var D = (e) => {
|
|
|
521
521
|
serial: "Web Serial",
|
|
522
522
|
usb: "WebUSB",
|
|
523
523
|
midi: "Web MIDI"
|
|
524
|
-
},
|
|
524
|
+
}, A = () => {
|
|
525
525
|
let e = "requestMIDIAccess" in navigator, t = "serial" in navigator, n = "usb" in navigator;
|
|
526
526
|
if (!e && !t && !n) return { browserSupport: !1 };
|
|
527
527
|
let r = async (e) => {
|
|
@@ -624,26 +624,26 @@ var D = (e) => {
|
|
|
624
624
|
};
|
|
625
625
|
}
|
|
626
626
|
};
|
|
627
|
-
},
|
|
627
|
+
}, ee = async (e, { maxAttempts: t = 3, retryDelayMs: n = 1500 } = {}) => {
|
|
628
628
|
for (let r = 1; r <= t; r++) try {
|
|
629
629
|
return await e();
|
|
630
630
|
} catch (e) {
|
|
631
631
|
console.warn(`Connection attempt ${r}/${t} failed:`, e), r < t ? await new Promise((e) => setTimeout(e, n)) : console.error("Could not connect to M8 after all attempts:", e);
|
|
632
632
|
}
|
|
633
|
-
},
|
|
633
|
+
}, j = {
|
|
634
634
|
autoGainControl: !1,
|
|
635
635
|
channelCount: { ideal: 2 },
|
|
636
636
|
echoCancellation: !1,
|
|
637
637
|
noiseSuppression: !1
|
|
638
|
-
},
|
|
638
|
+
}, M = async () => {
|
|
639
639
|
let e = (await navigator.mediaDevices.enumerateDevices()).filter((e) => e.kind === "audioinput" && e.label.includes("M8") && e.deviceId !== "default" && e.deviceId !== "communications");
|
|
640
640
|
return e.length > 1 && console.warn("Suspicious: More than one M8 audio input found"), e[0] ?? null;
|
|
641
|
-
},
|
|
641
|
+
}, N = async () => navigator.mediaDevices?.enumerateDevices ? M() : null, P = async ({ requireM8: e = !1 } = {}) => {
|
|
642
642
|
if (!navigator.mediaDevices?.getUserMedia) throw Error("Audio capture is not supported in this browser");
|
|
643
|
-
let t = await
|
|
643
|
+
let t = await N();
|
|
644
644
|
if (!t) {
|
|
645
|
-
let n = await navigator.mediaDevices.getUserMedia({ audio:
|
|
646
|
-
if (t = await
|
|
645
|
+
let n = await navigator.mediaDevices.getUserMedia({ audio: j });
|
|
646
|
+
if (t = await N(), !t) {
|
|
647
647
|
if (!e) return n;
|
|
648
648
|
for (let e of n.getTracks()) e.stop();
|
|
649
649
|
throw Error("No M8 audio input found (is the M8 connected over USB?)");
|
|
@@ -651,10 +651,10 @@ var D = (e) => {
|
|
|
651
651
|
for (let e of n.getTracks()) e.stop();
|
|
652
652
|
}
|
|
653
653
|
return navigator.mediaDevices.getUserMedia({ audio: {
|
|
654
|
-
...
|
|
654
|
+
...j,
|
|
655
655
|
deviceId: { exact: t.deviceId }
|
|
656
656
|
} });
|
|
657
|
-
},
|
|
657
|
+
}, F = () => {
|
|
658
658
|
let e = null, t = null, n = null, r = null, i = (e) => {
|
|
659
659
|
if (e.state !== "suspended" || typeof window > "u") return;
|
|
660
660
|
let t = () => {
|
|
@@ -666,7 +666,7 @@ var D = (e) => {
|
|
|
666
666
|
let r = e;
|
|
667
667
|
e = null, t = null, n = null, await r?.close().catch(() => void 0);
|
|
668
668
|
}, o = async (r) => {
|
|
669
|
-
let o = await
|
|
669
|
+
let o = await P({ requireM8: r }), s = new AudioContext(), c = s.createMediaStreamSource(o), l = s.createMediaStreamDestination();
|
|
670
670
|
c.connect(s.destination), c.connect(l), e = s, t = o, n = l.stream;
|
|
671
671
|
for (let e of o.getAudioTracks()) e.addEventListener("ended", () => {
|
|
672
672
|
t === o && a();
|
|
@@ -688,12 +688,12 @@ var D = (e) => {
|
|
|
688
688
|
return e.length <= 0 ? null : new MediaStream(e.map((e) => e.clone()));
|
|
689
689
|
}
|
|
690
690
|
};
|
|
691
|
-
},
|
|
691
|
+
}, te = [
|
|
692
692
|
"up",
|
|
693
693
|
"down",
|
|
694
694
|
"left",
|
|
695
695
|
"right"
|
|
696
|
-
],
|
|
696
|
+
], ne = 64, I = (e) => `${e.x},${e.y},${e.w},${e.h}`, re = (e) => {
|
|
697
697
|
let [t, n, r, i] = e.split(",").map(Number);
|
|
698
698
|
return [
|
|
699
699
|
t,
|
|
@@ -706,22 +706,22 @@ var D = (e) => {
|
|
|
706
706
|
w: r,
|
|
707
707
|
h: i
|
|
708
708
|
} : null;
|
|
709
|
-
},
|
|
709
|
+
}, ie = () => ({
|
|
710
710
|
cells: /* @__PURE__ */ new Map(),
|
|
711
711
|
moves: /* @__PURE__ */ new Map(),
|
|
712
712
|
unreachable: /* @__PURE__ */ new Set(),
|
|
713
713
|
suspects: /* @__PURE__ */ new Set()
|
|
714
|
-
}),
|
|
714
|
+
}), ae = (e = {}) => {
|
|
715
715
|
let t = /* @__PURE__ */ new Map(), n = () => e.onChange?.(), r = (e) => {
|
|
716
716
|
let n = t.get(e);
|
|
717
|
-
for (n ? t.delete(e) : n =
|
|
717
|
+
for (n ? t.delete(e) : n = ie(), t.set(e, n); t.size > ne;) {
|
|
718
718
|
let e = t.keys().next().value;
|
|
719
719
|
if (e === void 0) break;
|
|
720
720
|
t.delete(e);
|
|
721
721
|
}
|
|
722
722
|
return n;
|
|
723
723
|
}, i = (e, t) => {
|
|
724
|
-
let n =
|
|
724
|
+
let n = I(t);
|
|
725
725
|
return !e.cells.has(n) && (e.cells.set(n, {
|
|
726
726
|
x: t.x,
|
|
727
727
|
y: t.y,
|
|
@@ -732,11 +732,11 @@ var D = (e) => {
|
|
|
732
732
|
if (e.data?.version === 1) for (let t of e.data.layouts ?? []) {
|
|
733
733
|
let e = r(t.key);
|
|
734
734
|
for (let n of t.cells ?? []) {
|
|
735
|
-
let t =
|
|
735
|
+
let t = re(n);
|
|
736
736
|
t && i(e, t);
|
|
737
737
|
}
|
|
738
738
|
for (let [n, r, i] of t.moves ?? []) {
|
|
739
|
-
if (!
|
|
739
|
+
if (!te.includes(r)) continue;
|
|
740
740
|
let t = e.moves.get(n) ?? {};
|
|
741
741
|
t[r] = i, e.moves.set(n, t);
|
|
742
742
|
}
|
|
@@ -751,7 +751,7 @@ var D = (e) => {
|
|
|
751
751
|
recordMove: (e, t, a, o) => {
|
|
752
752
|
let s = r(e);
|
|
753
753
|
i(s, t), o && i(s, o);
|
|
754
|
-
let c =
|
|
754
|
+
let c = I(t), l = o ? I(o) : null, u = s.moves.get(c) ?? {};
|
|
755
755
|
u[a] !== l && (u[a] = l, s.moves.set(c, u), n());
|
|
756
756
|
},
|
|
757
757
|
markUnreachable: (e, t) => {
|
|
@@ -763,7 +763,7 @@ var D = (e) => {
|
|
|
763
763
|
layouts: [...t.entries()].map(([e, t]) => ({
|
|
764
764
|
key: e,
|
|
765
765
|
cells: [...t.cells.keys()],
|
|
766
|
-
moves: [...t.moves.entries()].flatMap(([e, t]) =>
|
|
766
|
+
moves: [...t.moves.entries()].flatMap(([e, t]) => te.filter((e) => t[e] !== void 0).map((n) => [
|
|
767
767
|
e,
|
|
768
768
|
n,
|
|
769
769
|
t[n] ?? null
|
|
@@ -773,13 +773,13 @@ var D = (e) => {
|
|
|
773
773
|
}))
|
|
774
774
|
})
|
|
775
775
|
};
|
|
776
|
-
},
|
|
776
|
+
}, oe = (e, t, n) => t === "up" ? n.y > e.y : t === "down" ? n.y < e.y : t === "left" ? n.x > e.x : n.x < e.x, se = 1.01, ce = (e, t, n, r) => Math.min(t, r) - Math.max(e, n), le = (e, t, n) => {
|
|
777
777
|
let r = t.x + t.w / 2, i = t.y + t.h / 2, a = null;
|
|
778
778
|
for (let [o, s] of e.cells) {
|
|
779
779
|
let e = s.x + s.w / 2 - r, c = s.y + s.h / 2 - i, l, u;
|
|
780
780
|
if (n === "up" || n === "down") {
|
|
781
|
-
if (l = n === "down" ? c : -c, u = Math.abs(e),
|
|
782
|
-
} else if (l = n === "right" ? e : -e, u = Math.abs(c),
|
|
781
|
+
if (l = n === "down" ? c : -c, u = Math.abs(e), ce(t.x, t.x + t.w, s.x, s.x + s.w) <= 0) continue;
|
|
782
|
+
} else if (l = n === "right" ? e : -e, u = Math.abs(c), ce(t.y, t.y + t.h, s.y, s.y + s.h) < Math.min(t.h, s.h) / 2) continue;
|
|
783
783
|
l < Math.min(t.h, s.h) / 2 || (!a || l < a.along - .5 || Math.abs(l - a.along) <= .5 && u < a.across) && (a = {
|
|
784
784
|
id: o,
|
|
785
785
|
along: l,
|
|
@@ -787,7 +787,7 @@ var D = (e) => {
|
|
|
787
787
|
});
|
|
788
788
|
}
|
|
789
789
|
return a?.id ?? null;
|
|
790
|
-
},
|
|
790
|
+
}, ue = (e, t, n, r = /* @__PURE__ */ new Set(), i = () => !1) => {
|
|
791
791
|
if (n(t)) return [];
|
|
792
792
|
let a = /* @__PURE__ */ new Map([[t, 0]]), o = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new Set([t]);
|
|
793
793
|
for (; c.size > 0;) {
|
|
@@ -810,15 +810,15 @@ var D = (e) => {
|
|
|
810
810
|
return e;
|
|
811
811
|
}
|
|
812
812
|
let d = e.cells.get(l), f = e.moves.get(l) ?? {};
|
|
813
|
-
for (let t of
|
|
813
|
+
for (let t of te) {
|
|
814
814
|
if (r.has(`${l}:${t}`) || d && i(d, t)) continue;
|
|
815
815
|
let n = f[t];
|
|
816
816
|
if (n === null) continue;
|
|
817
|
-
let p = n === void 0, m = p ? d ?
|
|
817
|
+
let p = n === void 0, m = p ? d ? le(e, d, t) : null : n;
|
|
818
818
|
if (!m || s.has(m)) continue;
|
|
819
819
|
let h = e.cells.get(m);
|
|
820
|
-
if (!p && d && h &&
|
|
821
|
-
let g = u + (p ?
|
|
820
|
+
if (!p && d && h && oe(d, t, h)) continue;
|
|
821
|
+
let g = u + (p ? se : 1);
|
|
822
822
|
g < (a.get(m) ?? Infinity) && (a.set(m, g), o.set(m, {
|
|
823
823
|
from: l,
|
|
824
824
|
dir: t,
|
|
@@ -827,7 +827,7 @@ var D = (e) => {
|
|
|
827
827
|
}
|
|
828
828
|
}
|
|
829
829
|
return null;
|
|
830
|
-
},
|
|
830
|
+
}, L = {
|
|
831
831
|
version: "1.0",
|
|
832
832
|
description: "Semantic mapping of M8 tracker views: defines the structure of each grid view so cursor position + line text can be interpreted as typed field values.",
|
|
833
833
|
notes: {
|
|
@@ -994,8 +994,8 @@ var D = (e) => {
|
|
|
994
994
|
},
|
|
995
995
|
relativeCommands: { description: "Relative commands add to the instrument parameter's current value (01-7F add, 80-FF subtract) and keep accumulating until a note is triggered with a RET command or with an instrument number in the I column; that resets every parameter to the instrument's own value." }
|
|
996
996
|
}
|
|
997
|
-
},
|
|
998
|
-
let n = e ?
|
|
997
|
+
}, de = 3, fe = 1.5, pe = 12, me = 34, he = Object.fromEntries(Object.entries(L.views).flatMap(([e, t]) => t.rowField ? [[e, t.rowField.width]] : [])), ge = (e, t) => {
|
|
998
|
+
let n = e ? he[e] : void 0;
|
|
999
999
|
if (!n) return null;
|
|
1000
1000
|
let r = -1, i = -1;
|
|
1001
1001
|
return t.forEach((e, t) => {
|
|
@@ -1005,7 +1005,33 @@ var D = (e) => {
|
|
|
1005
1005
|
last: i,
|
|
1006
1006
|
numberWidth: n
|
|
1007
1007
|
};
|
|
1008
|
-
},
|
|
1008
|
+
}, _e = [
|
|
1009
|
+
"song",
|
|
1010
|
+
"chain",
|
|
1011
|
+
"phrase"
|
|
1012
|
+
], ve = Object.fromEntries(Object.entries(L.views).flatMap(([e, t]) => _e.includes(e) && t.columns ? [[e, t.columns]] : [])), ye = (e) => !!e && e in ve, be = (e, t, n) => {
|
|
1013
|
+
let r = e ? ve[e] : void 0;
|
|
1014
|
+
if (!r || !t) return null;
|
|
1015
|
+
let i = {
|
|
1016
|
+
cells: /* @__PURE__ */ new Map(),
|
|
1017
|
+
moves: /* @__PURE__ */ new Map(),
|
|
1018
|
+
unreachable: /* @__PURE__ */ new Set(),
|
|
1019
|
+
suspects: /* @__PURE__ */ new Set()
|
|
1020
|
+
}, a = (e, t) => {
|
|
1021
|
+
let r = {
|
|
1022
|
+
x: (t.x + 1) * n.cellW + n.offX,
|
|
1023
|
+
y: e * n.cellH + n.offY,
|
|
1024
|
+
w: t.width * n.cellW,
|
|
1025
|
+
h: n.cellH
|
|
1026
|
+
}, a = I(r);
|
|
1027
|
+
return i.cells.set(a, r), a;
|
|
1028
|
+
};
|
|
1029
|
+
for (let e = t.first; e <= t.last; e++) r.forEach((n, o) => {
|
|
1030
|
+
let s = {};
|
|
1031
|
+
e > t.first && (s.up = a(e - 1, n)), e < t.last && (s.down = a(e + 1, n)), o > 0 && (s.left = a(e, r[o - 1])), o < r.length - 1 && (s.right = a(e, r[o + 1])), i.moves.set(a(e, n), s);
|
|
1032
|
+
});
|
|
1033
|
+
return i;
|
|
1034
|
+
}, xe = (e, t) => {
|
|
1009
1035
|
let n = Math.round((e.x - t.offX) / t.cellW), r = Math.round((e.y - t.offY) / t.cellH), i = Math.max(1, Math.round(e.w / t.cellW));
|
|
1010
1036
|
return {
|
|
1011
1037
|
x: n * t.cellW + t.offX,
|
|
@@ -1013,15 +1039,15 @@ var D = (e) => {
|
|
|
1013
1039
|
w: i * t.cellW,
|
|
1014
1040
|
h: t.cellH
|
|
1015
1041
|
};
|
|
1016
|
-
},
|
|
1042
|
+
}, Se = (e, t) => Math.round((e.y - t.offY) / t.cellH), Ce = (e, t) => Math.round(e / t.cellW) >= 40 ? me : null, we = (e, t) => e.map((e, n) => {
|
|
1017
1043
|
let r = (t === null ? e : e.slice(0, t)).trim().split(/\s+/)[0] ?? "";
|
|
1018
1044
|
return r.length >= 2 && /[g-z]/i.test(r) ? `${n}${r.toLowerCase()}` : "";
|
|
1019
|
-
}).filter(Boolean).join(" "),
|
|
1045
|
+
}).filter(Boolean).join(" "), Te = (e, t, n) => ({
|
|
1020
1046
|
x: t * n.cellW + n.offX,
|
|
1021
1047
|
y: e * n.cellH + n.offY,
|
|
1022
1048
|
w: n.cellW,
|
|
1023
1049
|
h: n.cellH
|
|
1024
|
-
}),
|
|
1050
|
+
}), Ee = (e, t, n, r = () => !1) => {
|
|
1025
1051
|
let i = [];
|
|
1026
1052
|
return e.forEach((e, a) => {
|
|
1027
1053
|
let o = [...` ${(n === null ? e : e.slice(0, n)).slice(1)}`].map((e, t) => e !== " " && r(a, t) ? " " : e).join("");
|
|
@@ -1041,19 +1067,19 @@ var D = (e) => {
|
|
|
1041
1067
|
});
|
|
1042
1068
|
}
|
|
1043
1069
|
}), i;
|
|
1044
|
-
},
|
|
1045
|
-
let r =
|
|
1070
|
+
}, De = (e, t, n) => {
|
|
1071
|
+
let r = Se(e, n), i = Math.round((e.x - n.offX) / n.cellW), a = Math.floor((e.x + e.w - 1 - n.offX) / n.cellW);
|
|
1046
1072
|
return (t[r] ?? "").slice(Math.max(0, i), a + 1).trim().length > 0;
|
|
1047
|
-
},
|
|
1073
|
+
}, Oe = (e, t, n, r) => Math.max(0, Math.min(t, r) - Math.max(e, n)), ke = (e, t, n) => Oe(e.x, e.x + e.w, t.x, t.x + t.w) >= Math.min(n.cellW, t.w) / 2, Ae = (e, t, n) => Oe(e.y, e.y + e.h, t.y, t.y + t.h) >= Math.min(n.cellH, t.h) / 2, je = (e, t, n) => ke(e, t, n) && Ae(e, t, n), Me = (e) => ({
|
|
1048
1074
|
x: e.x + e.w / 2,
|
|
1049
1075
|
y: e.y + e.h / 2
|
|
1050
|
-
}),
|
|
1051
|
-
let n =
|
|
1076
|
+
}), R = (e, t) => {
|
|
1077
|
+
let n = Me(e), r = Me(t), i = Math.max(0, Math.abs(n.x - r.x) - (e.w + t.w) / 2 + de), a = Math.max(0, Math.abs(n.y - r.y) - (e.h + t.h) / 2 + de);
|
|
1052
1078
|
return Math.hypot(i, a) + .01 * Math.hypot(n.x - r.x, n.y - r.y);
|
|
1053
|
-
},
|
|
1079
|
+
}, Ne = (e, t) => ({
|
|
1054
1080
|
dx: Math.max(0, t.x - e.x, e.x - (t.x + t.w)),
|
|
1055
1081
|
dy: Math.max(0, t.y - e.y, e.y - (t.y + t.h))
|
|
1056
|
-
}),
|
|
1082
|
+
}), Pe = (e) => ({
|
|
1057
1083
|
kind: "point",
|
|
1058
1084
|
rect: {
|
|
1059
1085
|
x: e.x,
|
|
@@ -1061,22 +1087,22 @@ var D = (e) => {
|
|
|
1061
1087
|
w: 1,
|
|
1062
1088
|
h: 1
|
|
1063
1089
|
}
|
|
1064
|
-
}),
|
|
1090
|
+
}), Fe = (e, t, n) => e.kind === "cell" && I(t) === e.id || je(t, e.rect, n), Ie = (e, t, n, r, i = null) => {
|
|
1065
1091
|
let a = (e) => !i || e >= i.first && e <= i.last, o = [];
|
|
1066
|
-
for (let [r, i] of e?.cells ?? []) a(
|
|
1092
|
+
for (let [r, i] of e?.cells ?? []) a(Se(i, n)) && De(i, t, n) && o.push({
|
|
1067
1093
|
id: r,
|
|
1068
1094
|
rect: i
|
|
1069
1095
|
});
|
|
1070
1096
|
let s = (e, t) => {
|
|
1071
|
-
let r =
|
|
1072
|
-
return o.some((e) =>
|
|
1097
|
+
let r = Te(e, t, n);
|
|
1098
|
+
return o.some((e) => je(e.rect, r, n));
|
|
1073
1099
|
}, c = (e) => !!i && e.col === 1 && e.text.length <= i.numberWidth;
|
|
1074
1100
|
return {
|
|
1075
1101
|
cells: o,
|
|
1076
|
-
runs:
|
|
1102
|
+
runs: Ee(t, n, r, s).filter((e) => a(e.row) && !c(e))
|
|
1077
1103
|
};
|
|
1078
|
-
},
|
|
1079
|
-
let { cells: c, runs: l } =
|
|
1104
|
+
}, Le = (e, t, n, r, i, a = null, o = /* @__PURE__ */ new Set(), s = !1) => {
|
|
1105
|
+
let { cells: c, runs: l } = Ie(t, n, r, i, a), u = c.map((e) => ({
|
|
1080
1106
|
goal: {
|
|
1081
1107
|
kind: "cell",
|
|
1082
1108
|
...e
|
|
@@ -1090,7 +1116,7 @@ var D = (e) => {
|
|
|
1090
1116
|
goal: {
|
|
1091
1117
|
kind: "text",
|
|
1092
1118
|
key: n.key,
|
|
1093
|
-
rect:
|
|
1119
|
+
rect: Te(n.row, i, r),
|
|
1094
1120
|
run: n.rect,
|
|
1095
1121
|
row: n.row
|
|
1096
1122
|
},
|
|
@@ -1100,25 +1126,25 @@ var D = (e) => {
|
|
|
1100
1126
|
let d = n[Math.floor((e.y - r.offY) / r.cellH)] ?? "", f = (e) => e > 0 && (d[e] ?? " ") !== " ", p = Math.floor((e.x - r.offX) / r.cellW);
|
|
1101
1127
|
for (; f(p) && (f(p + 1) || f(p + 2));) p += f(p + 1) ? 1 : 2;
|
|
1102
1128
|
let m = (t) => {
|
|
1103
|
-
let { dx: n, dy: i } =
|
|
1104
|
-
if (i > 0 || n >
|
|
1129
|
+
let { dx: n, dy: i } = Ne(e, t);
|
|
1130
|
+
if (i > 0 || n > pe * r.cellW) return !1;
|
|
1105
1131
|
let a = Math.round((t.x - r.offX) / r.cellW);
|
|
1106
1132
|
if (a <= p) return !0;
|
|
1107
1133
|
for (let e = p + 1; e < a; e++) if (f(e)) return !1;
|
|
1108
1134
|
return !0;
|
|
1109
1135
|
}, h = u.some(({ area: e }) => m(e)), g = u.some(({ goal: e }) => e.kind === "cell"), _ = null;
|
|
1110
1136
|
for (let { goal: t, area: n } of u) {
|
|
1111
|
-
let { dx: r, dy: i } =
|
|
1137
|
+
let { dx: r, dy: i } = Ne(e, n);
|
|
1112
1138
|
if (h && !m(n) || s && !h && g && t.kind !== "cell") continue;
|
|
1113
|
-
let a = n.x > e.x, o = Math.hypot(r, i *
|
|
1139
|
+
let a = n.x > e.x, o = Math.hypot(r, i * fe) - (t.kind === "cell" ? .001 : 0) - (a ? .5 : 0), c = Me(n), l = Math.hypot(c.x - e.x, c.y - e.y);
|
|
1114
1140
|
(!_ || o < _.score - 1e-6 || Math.abs(o - _.score) <= 1e-6 && l < _.tie) && (_ = {
|
|
1115
1141
|
goal: t,
|
|
1116
1142
|
score: o,
|
|
1117
1143
|
tie: l
|
|
1118
1144
|
});
|
|
1119
1145
|
}
|
|
1120
|
-
return _?.goal ??
|
|
1121
|
-
},
|
|
1146
|
+
return _?.goal ?? Pe(e);
|
|
1147
|
+
}, z = {
|
|
1122
1148
|
Left: 128,
|
|
1123
1149
|
Up: 64,
|
|
1124
1150
|
Down: 32,
|
|
@@ -1127,22 +1153,22 @@ var D = (e) => {
|
|
|
1127
1153
|
Right: 4,
|
|
1128
1154
|
Opt: 2,
|
|
1129
1155
|
Edit: 1
|
|
1130
|
-
},
|
|
1156
|
+
}, Re = ({ left: e, right: t, up: n, down: r, shift: i, play: a, opt: o, edit: s }) => {
|
|
1131
1157
|
let c = 0;
|
|
1132
|
-
return e && (c |=
|
|
1133
|
-
},
|
|
1134
|
-
up:
|
|
1135
|
-
down:
|
|
1136
|
-
left:
|
|
1137
|
-
right:
|
|
1138
|
-
},
|
|
1139
|
-
if (e &
|
|
1140
|
-
let t = Object.keys(
|
|
1158
|
+
return e && (c |= z.Left), t && (c |= z.Right), n && (c |= z.Up), r && (c |= z.Down), i && (c |= z.Shift), a && (c |= z.Play), o && (c |= z.Opt), s && (c |= z.Edit), c;
|
|
1159
|
+
}, ze = {
|
|
1160
|
+
up: z.Up,
|
|
1161
|
+
down: z.Down,
|
|
1162
|
+
left: z.Left,
|
|
1163
|
+
right: z.Right
|
|
1164
|
+
}, Be = z.Up | z.Down | z.Left | z.Right, Ve = z.Edit | z.Opt | z.Shift | z.Play, He = Be | z.Edit | z.Opt | z.Shift, Ue = 48, We = 40, Ge = 16, Ke = 4, qe = 150, Je = 300, Ye = 200, Xe = (e, t) => !!e && !!t && e.x === t.x && e.y === t.y && e.w === t.w && e.h === t.h, Ze = (e) => {
|
|
1165
|
+
if (e & Ve) return null;
|
|
1166
|
+
let t = Object.keys(ze).filter((t) => e & ze[t]);
|
|
1141
1167
|
return t.length === 1 ? t[0] : null;
|
|
1142
|
-
},
|
|
1143
|
-
let i = null, a = 0, o = 0, s = !1, c = null, l = null, u = () => t.get("cellMetrics"), d = () =>
|
|
1168
|
+
}, Qe = ({ bus: e, store: t, getScreenLines: n = () => [], cursorMap: r = ae() }) => {
|
|
1169
|
+
let i = null, a = 0, o = 0, s = !1, c = null, l = null, u = () => t.get("cellMetrics"), d = () => Ce(t.get("systemInfo")?.screenWidth ?? 480, u()), f = () => {
|
|
1144
1170
|
let e = t.get("cursorRect");
|
|
1145
|
-
return e ?
|
|
1171
|
+
return e ? xe(e, u()) : null;
|
|
1146
1172
|
}, p = () => {
|
|
1147
1173
|
let e = t.get("viewName");
|
|
1148
1174
|
if (!e || t.get("selectionMode")) return null;
|
|
@@ -1151,81 +1177,81 @@ var D = (e) => {
|
|
|
1151
1177
|
e,
|
|
1152
1178
|
r?.model ?? t.get("deviceModel") ?? "?",
|
|
1153
1179
|
r?.fontMode ?? t.get("fontMode") ?? "?",
|
|
1154
|
-
|
|
1180
|
+
we(n(), d())
|
|
1155
1181
|
].join("|");
|
|
1156
1182
|
}, m = () => {
|
|
1157
1183
|
c &&= (clearTimeout(c), null);
|
|
1158
|
-
}, h = (e =
|
|
1184
|
+
}, h = (e = qe) => {
|
|
1159
1185
|
m(), c = setTimeout(() => {
|
|
1160
|
-
c = null,
|
|
1186
|
+
c = null, D("timeout");
|
|
1161
1187
|
}, e);
|
|
1162
1188
|
}, g = (e) => {
|
|
1163
1189
|
if (!i) return;
|
|
1164
1190
|
let { resolve: t } = i;
|
|
1165
|
-
i.goal, f(), i = null, m(), s = !1, o = a & ~
|
|
1191
|
+
i.goal, f(), i = null, m(), s = !1, o = a & ~He, t(e);
|
|
1166
1192
|
}, _ = (t) => {
|
|
1167
|
-
e.commands.sendKeys(o |
|
|
1168
|
-
}, v = (e, t, n) => e.goal.kind === "cell" ? t === e.goal.id : !!n &&
|
|
1193
|
+
e.commands.sendKeys(o | ze[t]), e.commands.sendKeys(o);
|
|
1194
|
+
}, v = (e, t, n) => e.goal.kind === "cell" ? t === e.goal.id : !!n && Fe(e.goal, n, u()), y = (e, t) => {
|
|
1169
1195
|
let n = [], r = e.y + e.h / 2, i = e.x + e.w / 2;
|
|
1170
|
-
return
|
|
1196
|
+
return Ae(e, t.rect, u()) || n.push(t.rect.y + t.rect.h / 2 < r ? "up" : "down"), ke(e, t.rect, u()) || n.push(t.rect.x + t.rect.w / 2 < i ? "left" : "right"), n;
|
|
1171
1197
|
}, b = (e, t, n) => {
|
|
1172
1198
|
if (!e.grid) return !1;
|
|
1173
|
-
let r =
|
|
1199
|
+
let r = Se(t, u());
|
|
1174
1200
|
return n === "up" && r <= e.grid.first || n === "down" && r >= e.grid.last;
|
|
1175
|
-
}, x = (e, t) => {
|
|
1176
|
-
let n =
|
|
1177
|
-
if (
|
|
1178
|
-
let t =
|
|
1179
|
-
if (t && !(t.guessed && (e.explored >=
|
|
1201
|
+
}, x = (e) => e.fixed ?? (e.layoutKey ? r.get(e.layoutKey) : void 0), S = (e, t) => {
|
|
1202
|
+
let n = I(t), r = x(e);
|
|
1203
|
+
if (r) {
|
|
1204
|
+
let t = ue(r, n, (t) => v(e, t, r.cells.get(t)), e.distrust, (t, n) => b(e, t, n))?.[0];
|
|
1205
|
+
if (t && !(t.guessed && (e.explored >= We || e.tried.has(`${n}:${t.dir}`)))) return {
|
|
1180
1206
|
dir: t.dir,
|
|
1181
1207
|
expected: t.to,
|
|
1182
1208
|
guessed: t.guessed
|
|
1183
1209
|
};
|
|
1184
1210
|
}
|
|
1185
|
-
let
|
|
1186
|
-
for (let
|
|
1187
|
-
let c = `${n}:${
|
|
1188
|
-
if (e.tried.has(c) || b(e, t,
|
|
1189
|
-
let l = e.distrust.has(c) ? void 0 :
|
|
1190
|
-
if (l === null)
|
|
1191
|
-
dir:
|
|
1211
|
+
let i = r?.moves.get(n) ?? {}, a = R(t, e.goal.rect), o = null;
|
|
1212
|
+
for (let s of y(t, e.goal)) {
|
|
1213
|
+
let c = `${n}:${s}`;
|
|
1214
|
+
if (e.tried.has(c) || b(e, t, s)) continue;
|
|
1215
|
+
let l = e.distrust.has(c) ? void 0 : i[s];
|
|
1216
|
+
if (l === null) o ??= {
|
|
1217
|
+
dir: s,
|
|
1192
1218
|
expected: null,
|
|
1193
1219
|
guessed: !1
|
|
1194
1220
|
};
|
|
1195
1221
|
else if (l !== void 0) {
|
|
1196
|
-
let n =
|
|
1197
|
-
if (n && !
|
|
1198
|
-
dir:
|
|
1222
|
+
let n = r?.cells.get(l);
|
|
1223
|
+
if (n && !oe(t, s, n) && R(n, e.goal.rect) < a) return {
|
|
1224
|
+
dir: s,
|
|
1199
1225
|
expected: l,
|
|
1200
1226
|
guessed: !1
|
|
1201
1227
|
};
|
|
1202
|
-
} else return e.explored >=
|
|
1203
|
-
dir:
|
|
1228
|
+
} else return e.explored >= We ? null : {
|
|
1229
|
+
dir: s,
|
|
1204
1230
|
expected: void 0,
|
|
1205
1231
|
guessed: !0
|
|
1206
1232
|
};
|
|
1207
1233
|
}
|
|
1208
|
-
return
|
|
1209
|
-
},
|
|
1210
|
-
_(n.dir), e.steps += 1, n.guessed && (e.explored += 1), e.tried.add(`${
|
|
1234
|
+
return o;
|
|
1235
|
+
}, C = (e, t, n) => {
|
|
1236
|
+
_(n.dir), e.steps += 1, n.guessed && (e.explored += 1), e.tried.add(`${I(t)}:${n.dir}`), e.pending = {
|
|
1211
1237
|
from: t,
|
|
1212
1238
|
dir: n.dir,
|
|
1213
1239
|
expected: n.expected,
|
|
1214
1240
|
guessed: n.guessed
|
|
1215
1241
|
}, s = !0, n.dir, n.expected, h();
|
|
1216
|
-
},
|
|
1242
|
+
}, w = (e, t, i) => {
|
|
1217
1243
|
if (e.phase === "seek") {
|
|
1218
|
-
if (e.goal.kind === "text" &&
|
|
1244
|
+
if (e.goal.kind === "text" && je(t, e.goal.run, u())) {
|
|
1219
1245
|
g(!0);
|
|
1220
1246
|
return;
|
|
1221
1247
|
}
|
|
1222
1248
|
if (i && e.goal.kind === "text" && e.layoutKey) {
|
|
1223
|
-
let { row: i, run: a } = e.goal, o =
|
|
1249
|
+
let { row: i, run: a } = e.goal, o = Ae(t, a, u()), s = a.x + a.w / 2 < t.x + t.w / 2, c = Se(t, u()), l = i < c ? "up" : "down", f = Math.abs(i - c) === 1 && x(e)?.moves.get(I(t))?.[l] === null, p = o || f ? Ie(x(e), n(), u(), d(), e.grid).runs.filter((e) => e.row === i).filter((e) => !o || (s ? e.rect.x + e.rect.w <= t.x + 3 : e.rect.x >= t.x + t.w - 3)).map((e) => e.key) : [];
|
|
1224
1250
|
p.includes(e.goal.key) || p.push(e.goal.key);
|
|
1225
1251
|
for (let t of p) e.failedTexts.add(t), e.grid || r.markUnreachable(e.layoutKey, t);
|
|
1226
|
-
let m =
|
|
1227
|
-
if (e.goals <
|
|
1228
|
-
e.goal, e.goal = m, e.goals += 1, e.explored = 0, e.tried.clear(),
|
|
1252
|
+
let m = Le(e.point, x(e), n(), u(), d(), e.grid, e.failedTexts, !0);
|
|
1253
|
+
if (e.goals < Ke && m.kind !== "point" && m.rect !== e.goal.rect) {
|
|
1254
|
+
e.goal, e.goal = m, e.goals += 1, e.explored = 0, e.tried.clear(), T(e);
|
|
1229
1255
|
return;
|
|
1230
1256
|
}
|
|
1231
1257
|
}
|
|
@@ -1234,92 +1260,94 @@ var D = (e) => {
|
|
|
1234
1260
|
y: e.point.y,
|
|
1235
1261
|
w: 1,
|
|
1236
1262
|
h: 1
|
|
1237
|
-
}, o =
|
|
1238
|
-
if (o.length > 0) for (let e of o)
|
|
1239
|
-
else for (let t of e.visited.values())
|
|
1240
|
-
if (!
|
|
1263
|
+
}, o = Ie(x(e), n(), u(), d(), e.grid).cells, s = t;
|
|
1264
|
+
if (o.length > 0) for (let e of o) R(e.rect, a) < R(s, a) - 1e-6 && (s = e.rect);
|
|
1265
|
+
else for (let t of e.visited.values()) R(t, e.goal.rect) < R(s, e.goal.rect) - 1e-6 && (s = t);
|
|
1266
|
+
if (!Xe(s, t)) {
|
|
1241
1267
|
e.goal, e.phase = "return", e.goal = {
|
|
1242
1268
|
kind: "cell",
|
|
1243
|
-
id:
|
|
1269
|
+
id: I(s),
|
|
1244
1270
|
rect: s
|
|
1245
|
-
}, e.steps = 0, e.explored = 0, e.tried.clear(),
|
|
1271
|
+
}, e.steps = 0, e.explored = 0, e.tried.clear(), T(e);
|
|
1246
1272
|
return;
|
|
1247
1273
|
}
|
|
1248
1274
|
}
|
|
1249
1275
|
g(!1);
|
|
1250
1276
|
};
|
|
1251
|
-
function
|
|
1277
|
+
function T(e) {
|
|
1252
1278
|
let t = f();
|
|
1253
1279
|
if (!t) {
|
|
1254
1280
|
g(!1);
|
|
1255
1281
|
return;
|
|
1256
1282
|
}
|
|
1257
|
-
if (
|
|
1283
|
+
if (Fe(e.goal, t, u())) {
|
|
1258
1284
|
g(e.phase === "seek");
|
|
1259
1285
|
return;
|
|
1260
1286
|
}
|
|
1261
|
-
if (e.steps >= (e.phase === "seek" ?
|
|
1262
|
-
|
|
1287
|
+
if (e.steps >= (e.phase === "seek" ? Ue : Ge)) {
|
|
1288
|
+
w(e, t, !1);
|
|
1263
1289
|
return;
|
|
1264
1290
|
}
|
|
1265
|
-
let n =
|
|
1266
|
-
n ?
|
|
1291
|
+
let n = S(e, t);
|
|
1292
|
+
n ? C(e, t, n) : w(e, t, e.explored < We);
|
|
1267
1293
|
}
|
|
1268
|
-
let
|
|
1294
|
+
let E = (e, t, n) => {
|
|
1269
1295
|
e.pending = null, m(), s = !1;
|
|
1270
1296
|
let i = p();
|
|
1271
|
-
e.layoutKey && i === e.layoutKey && r.recordMove(e.layoutKey, t.from, t.dir, n);
|
|
1272
|
-
let a = n ?
|
|
1273
|
-
!t.guessed && t.expected !== void 0 && a !== t.expected && e.distrust.add(`${
|
|
1297
|
+
e.layoutKey && i === e.layoutKey && !e.fixed && r.recordMove(e.layoutKey, t.from, t.dir, n);
|
|
1298
|
+
let a = n ? I(n) : null;
|
|
1299
|
+
!t.guessed && t.expected !== void 0 && a !== t.expected && e.distrust.add(`${I(t.from)}:${t.dir}`), n && e.visited.set(I(n), n);
|
|
1274
1300
|
};
|
|
1275
|
-
function
|
|
1301
|
+
function D(e) {
|
|
1276
1302
|
let n = i;
|
|
1277
1303
|
if (!n) return;
|
|
1278
1304
|
let r = f();
|
|
1279
1305
|
if (!r) g(!1);
|
|
1280
1306
|
else {
|
|
1281
1307
|
if (n.pending) {
|
|
1282
|
-
if (!
|
|
1308
|
+
if (!Xe(n.pending.from, r)) E(n, n.pending, r);
|
|
1283
1309
|
else if (e === "timeout" && !n.pending.graced) {
|
|
1284
|
-
n.pending.graced = !0, h(
|
|
1310
|
+
n.pending.graced = !0, h(Je);
|
|
1285
1311
|
return;
|
|
1286
|
-
} else if (e === "timeout")
|
|
1287
|
-
|
|
1312
|
+
} else if (e === "timeout") {
|
|
1313
|
+
let e = `${I(n.pending.from)}:${n.pending.dir}`;
|
|
1314
|
+
n.grid && !n.retried.has(e) ? (n.retried.add(e), n.tried.delete(e), n.pending = null, s = !1) : E(n, n.pending, null);
|
|
1315
|
+
} else return;
|
|
1288
1316
|
}
|
|
1289
|
-
t.get("viewName") === n.viewName ?
|
|
1317
|
+
t.get("viewName") === n.viewName ? T(n) : g(!1);
|
|
1290
1318
|
}
|
|
1291
1319
|
}
|
|
1292
|
-
let
|
|
1320
|
+
let O = (e) => {
|
|
1293
1321
|
if (a = e.keys ?? 0, i) {
|
|
1294
1322
|
l = null, s && (s = !1, i.pending && h());
|
|
1295
1323
|
return;
|
|
1296
1324
|
}
|
|
1297
|
-
o = a & ~
|
|
1298
|
-
let t =
|
|
1325
|
+
o = a & ~He;
|
|
1326
|
+
let t = Ze(a);
|
|
1299
1327
|
t ? (!l || l.dir !== t || l.releasedAt !== null) && (l = {
|
|
1300
1328
|
dir: t,
|
|
1301
1329
|
from: f(),
|
|
1302
1330
|
layoutKey: p(),
|
|
1303
1331
|
releasedAt: null
|
|
1304
1332
|
}) : a === 0 && l ? l.releasedAt ??= Date.now() : l = null;
|
|
1305
|
-
},
|
|
1333
|
+
}, k = () => {
|
|
1306
1334
|
if (i) {
|
|
1307
|
-
|
|
1335
|
+
D("rect");
|
|
1308
1336
|
return;
|
|
1309
1337
|
}
|
|
1310
|
-
let e = f(),
|
|
1311
|
-
if (!e || !t) {
|
|
1338
|
+
let e = f(), a = p();
|
|
1339
|
+
if (!e || !a || ye(t.get("viewName"))) {
|
|
1312
1340
|
l = null;
|
|
1313
1341
|
return;
|
|
1314
1342
|
}
|
|
1315
|
-
let
|
|
1316
|
-
if (
|
|
1317
|
-
let
|
|
1318
|
-
!
|
|
1343
|
+
let o = l;
|
|
1344
|
+
if (o?.from && o.layoutKey === a && (o.releasedAt === null || Date.now() - o.releasedAt <= Ye)) {
|
|
1345
|
+
let t = n();
|
|
1346
|
+
!Xe(o.from, e) && De(o.from, t, u()) && De(e, t, u()) && r.recordMove(a, o.from, o.dir, e), o.from = e;
|
|
1319
1347
|
} else l = null;
|
|
1320
1348
|
};
|
|
1321
|
-
e.protocol.eventBus.on("key",
|
|
1322
|
-
let
|
|
1349
|
+
e.protocol.eventBus.on("key", O);
|
|
1350
|
+
let A = t.sub("cursorRect", k);
|
|
1323
1351
|
return {
|
|
1324
1352
|
navigateTo: (e) => new Promise((s) => {
|
|
1325
1353
|
let m = f();
|
|
@@ -1332,12 +1360,13 @@ var D = (e) => {
|
|
|
1332
1360
|
let e = i;
|
|
1333
1361
|
i = null, e.resolve(!1);
|
|
1334
1362
|
}
|
|
1335
|
-
let _ = p(), v =
|
|
1336
|
-
_ &&
|
|
1337
|
-
let
|
|
1363
|
+
let _ = p(), v = n(), y = ge(t.get("viewName"), v), b = _ ? be(t.get("viewName"), y, u()) : null, x = b?.cells.has(I(m)) ? b : null, S = x ?? (_ ? r.get(_) : void 0), C = t.get("selectionMode") ? Pe(e) : Le(e, S, v, u(), d(), y);
|
|
1364
|
+
_ && !x && De(m, v, u()) && r.recordCell(_, m), g || (o = a & ~He), l = null;
|
|
1365
|
+
let w = {
|
|
1338
1366
|
point: e,
|
|
1339
|
-
grid:
|
|
1340
|
-
|
|
1367
|
+
grid: y,
|
|
1368
|
+
fixed: x,
|
|
1369
|
+
goal: C,
|
|
1341
1370
|
goals: 1,
|
|
1342
1371
|
phase: "seek",
|
|
1343
1372
|
viewName: t.get("viewName"),
|
|
@@ -1345,8 +1374,9 @@ var D = (e) => {
|
|
|
1345
1374
|
steps: 0,
|
|
1346
1375
|
explored: 0,
|
|
1347
1376
|
tried: /* @__PURE__ */ new Set(),
|
|
1377
|
+
retried: /* @__PURE__ */ new Set(),
|
|
1348
1378
|
distrust: /* @__PURE__ */ new Set(),
|
|
1349
|
-
visited: /* @__PURE__ */ new Map([[
|
|
1379
|
+
visited: /* @__PURE__ */ new Map([[I(m), m]]),
|
|
1350
1380
|
failedTexts: /* @__PURE__ */ new Set(),
|
|
1351
1381
|
pending: g ? {
|
|
1352
1382
|
...g,
|
|
@@ -1355,29 +1385,29 @@ var D = (e) => {
|
|
|
1355
1385
|
} : null,
|
|
1356
1386
|
resolve: s
|
|
1357
1387
|
};
|
|
1358
|
-
i =
|
|
1388
|
+
i = w, g ? c || h() : T(w);
|
|
1359
1389
|
}),
|
|
1360
1390
|
dispose: () => {
|
|
1361
|
-
g(!1), e.protocol.eventBus.off("key",
|
|
1391
|
+
g(!1), e.protocol.eventBus.off("key", O), A();
|
|
1362
1392
|
}
|
|
1363
1393
|
};
|
|
1364
|
-
},
|
|
1394
|
+
}, B = (e) => e?.trim().toLowerCase() ?? "", $e = /\.m[a-z0-9]{2}$/i, et = (e) => [
|
|
1365
1395
|
e.viewName ?? "",
|
|
1366
1396
|
e.viewTitle ?? "",
|
|
1367
1397
|
e.cursorPos?.x ?? "",
|
|
1368
1398
|
e.cursorPos?.y ?? "",
|
|
1369
1399
|
e.textUnderCursor ?? "",
|
|
1370
1400
|
e.currentLine ?? ""
|
|
1371
|
-
].join("|"),
|
|
1372
|
-
let t =
|
|
1401
|
+
].join("|"), tt = (e) => e.textUnderCursor?.trim() || e.currentLine?.trim() || null, nt = (e) => {
|
|
1402
|
+
let t = B(e.viewName), n = B(e.viewTitle);
|
|
1373
1403
|
return t.includes("load") || t.includes("save") || n.includes("load") || n.includes("save");
|
|
1374
|
-
},
|
|
1404
|
+
}, rt = (e) => B(e) === "/..", it = (e) => !!e?.trim().startsWith("/"), at = (e) => !!e && !it(e) && $e.test(e.trim()), ot = (e) => {
|
|
1375
1405
|
let t = e?.trim() ?? "";
|
|
1376
1406
|
if (!t) return [];
|
|
1377
|
-
let n =
|
|
1407
|
+
let n = B(t), r = B(t.replace($e, ""));
|
|
1378
1408
|
return Array.from(new Set([n, r].filter(Boolean)));
|
|
1379
|
-
},
|
|
1380
|
-
let n = (t) => e[t]?.trim() ?? "", r = t.cursorPos?.y ?? null, i =
|
|
1409
|
+
}, st = (e) => rt(e) ? "parent" : it(e) ? /^\/[^/]+$/.test(e.trim()) ? "dir" : "other" : at(e) ? "file" : "other", ct = (e, t) => {
|
|
1410
|
+
let n = (t) => e[t]?.trim() ?? "", r = t.cursorPos?.y ?? null, i = B(t.viewTitle), a = 0, o = e.length - 1;
|
|
1381
1411
|
if (r !== null && n(r)) {
|
|
1382
1412
|
for (a = r; a > 0 && n(a - 1);) --a;
|
|
1383
1413
|
for (o = r; o < e.length - 1 && n(o + 1);) o += 1;
|
|
@@ -1385,11 +1415,11 @@ var D = (e) => {
|
|
|
1385
1415
|
let s = [];
|
|
1386
1416
|
for (let e = a; e <= o; e += 1) {
|
|
1387
1417
|
let t = n(e);
|
|
1388
|
-
!t || i &&
|
|
1418
|
+
!t || i && B(t) === i || s.push({
|
|
1389
1419
|
row: e,
|
|
1390
1420
|
text: t,
|
|
1391
|
-
key:
|
|
1392
|
-
kind:
|
|
1421
|
+
key: B(t),
|
|
1422
|
+
kind: st(t)
|
|
1393
1423
|
});
|
|
1394
1424
|
}
|
|
1395
1425
|
let c = t.textUnderCursor?.trim();
|
|
@@ -1400,7 +1430,7 @@ var D = (e) => {
|
|
|
1400
1430
|
hasParent: s.some((e) => e.kind === "parent"),
|
|
1401
1431
|
consistent: !c || r === null || n(r).includes(c)
|
|
1402
1432
|
};
|
|
1403
|
-
},
|
|
1433
|
+
}, lt = (e, t) => {
|
|
1404
1434
|
if (t.length === 0) return {
|
|
1405
1435
|
order: e,
|
|
1406
1436
|
consistent: !0
|
|
@@ -1434,26 +1464,26 @@ var D = (e) => {
|
|
|
1434
1464
|
order: i,
|
|
1435
1465
|
consistent: !0
|
|
1436
1466
|
};
|
|
1437
|
-
},
|
|
1467
|
+
}, ut = (e) => e.split(/[^a-z0-9]+/).filter((e) => e.length >= 3), dt = /* @__PURE__ */ new Set([
|
|
1438
1468
|
"load",
|
|
1439
1469
|
"save",
|
|
1440
1470
|
"select",
|
|
1441
1471
|
"create",
|
|
1442
1472
|
"directory",
|
|
1443
1473
|
"new"
|
|
1444
|
-
]),
|
|
1445
|
-
target:
|
|
1446
|
-
title:
|
|
1447
|
-
}),
|
|
1474
|
+
]), ft = (e, t) => ({
|
|
1475
|
+
target: ut(B(e).replace($e, "")),
|
|
1476
|
+
title: ut(B(t)).filter((e) => !dt.has(e))
|
|
1477
|
+
}), pt = (e, t) => {
|
|
1448
1478
|
let n = e.replace(/^\//, "");
|
|
1449
1479
|
if (n.length < 3) return 0;
|
|
1450
1480
|
let r = (e) => e.includes(n) || n.includes(e);
|
|
1451
1481
|
return t.target.some(r) ? 2 : +!!t.title.some(r);
|
|
1452
|
-
},
|
|
1482
|
+
}, V = (e) => new Promise((t) => setTimeout(t, e)), mt = ({ getKeySink: e, store: t, debugLog: n, getScreenLines: r }) => {
|
|
1453
1483
|
let i = () => !!e(), a = (t) => {
|
|
1454
1484
|
e()?.sendKeys(t);
|
|
1455
1485
|
}, o = async (e, t = 50) => {
|
|
1456
|
-
a(e), await
|
|
1486
|
+
a(e), await V(t), a(0), await V(t);
|
|
1457
1487
|
}, s = (e, n = 500) => new Promise((r) => {
|
|
1458
1488
|
let i = !1, a = null, o = null, s = (e) => {
|
|
1459
1489
|
i || (i = !0, o !== null && clearTimeout(o), a?.(), r(e));
|
|
@@ -1491,21 +1521,21 @@ var D = (e) => {
|
|
|
1491
1521
|
}),
|
|
1492
1522
|
getFileBrowserSnapshot: c,
|
|
1493
1523
|
waitForFileBrowserSnapshotChange: (e, n = 500) => new Promise((r) => {
|
|
1494
|
-
let i = !1, a = null, o = null, s = null, l = null, u = null, d = null, f =
|
|
1524
|
+
let i = !1, a = null, o = null, s = null, l = null, u = null, d = null, f = et(e), p = (e) => {
|
|
1495
1525
|
i || (i = !0, d !== null && clearTimeout(d), a?.(), o?.(), s?.(), l?.(), u?.(), r(e));
|
|
1496
1526
|
}, m = () => {
|
|
1497
1527
|
let e = c();
|
|
1498
|
-
|
|
1528
|
+
et(e) !== f && p(e);
|
|
1499
1529
|
}, h = c();
|
|
1500
|
-
|
|
1530
|
+
et(h) === f ? (a = t.sub("textUnderCursor", m), o = t.sub("currentLine", m), s = t.sub("cursorPos", m), l = t.sub("viewName", m), u = t.sub("viewTitle", m), d = setTimeout(() => {
|
|
1501
1531
|
p(c());
|
|
1502
1532
|
}, n)) : p(h);
|
|
1503
1533
|
}),
|
|
1504
1534
|
getScreenLines: r
|
|
1505
1535
|
};
|
|
1506
|
-
},
|
|
1536
|
+
}, H = (e, t) => {
|
|
1507
1537
|
t === void 0 ? console.log("[M8SDK browseFile]", e) : console.log("[M8SDK browseFile]", e, t);
|
|
1508
|
-
},
|
|
1538
|
+
}, ht = 8, gt = 8, _t = 64, vt = 512, yt = () => ({
|
|
1509
1539
|
order: [],
|
|
1510
1540
|
kinds: /* @__PURE__ */ new Map(),
|
|
1511
1541
|
names: /* @__PURE__ */ new Map(),
|
|
@@ -1515,52 +1545,52 @@ var D = (e) => {
|
|
|
1515
1545
|
sorted: !1,
|
|
1516
1546
|
visited: /* @__PURE__ */ new Set(),
|
|
1517
1547
|
rejected: /* @__PURE__ */ new Set()
|
|
1518
|
-
}),
|
|
1548
|
+
}), bt = (e) => e === "up" ? "down" : "up", xt = (e) => {
|
|
1519
1549
|
let { hasBus: t, pressAndRelease: n, getFileBrowserSnapshot: r, waitForFileBrowserSnapshotChange: i, getScreenLines: a } = e, o = /* @__PURE__ */ new Map(), s = null, c = null;
|
|
1520
1550
|
return async (e, l = !0) => {
|
|
1521
1551
|
if (!t()) return !1;
|
|
1522
|
-
let u =
|
|
1552
|
+
let u = B(e);
|
|
1523
1553
|
if (!u) return !1;
|
|
1524
|
-
let d =
|
|
1525
|
-
|
|
1554
|
+
let d = $e.test(u), f = ft(e, r().viewTitle);
|
|
1555
|
+
H("start", {
|
|
1526
1556
|
targetText: e,
|
|
1527
1557
|
normalizedTarget: u,
|
|
1528
1558
|
exact: l
|
|
1529
1559
|
});
|
|
1530
|
-
let p = () =>
|
|
1560
|
+
let p = () => nt(r()), m = async (e, t = 350) => {
|
|
1531
1561
|
let a = r();
|
|
1532
1562
|
await n(e, 35);
|
|
1533
1563
|
let o = await i(a, t);
|
|
1534
1564
|
return {
|
|
1535
|
-
changed:
|
|
1565
|
+
changed: et(o) !== et(a),
|
|
1536
1566
|
snapshot: o
|
|
1537
1567
|
};
|
|
1538
|
-
}, h = (e) => e === "up" ?
|
|
1568
|
+
}, h = (e) => e === "up" ? z.Up : z.Down, g = (e) => z.Opt | h(e), _ = async () => {
|
|
1539
1569
|
let e = r();
|
|
1540
|
-
|
|
1541
|
-
}, v = (e) =>
|
|
1570
|
+
H("apply alphabetical sort"), await n(z.Shift | z.Opt, 35), await V(180), await i(e, 300);
|
|
1571
|
+
}, v = (e) => at(e) ? ot(e).some((e) => l ? e === u : e.includes(u)) : !1, y = (e) => {
|
|
1542
1572
|
let t = e.trim();
|
|
1543
|
-
return d ? t : t.replace(
|
|
1544
|
-
}, b = (e) =>
|
|
1573
|
+
return d ? t : t.replace($e, "");
|
|
1574
|
+
}, b = (e) => B(y(e)), x = y(e), S = async () => {
|
|
1545
1575
|
for (let e = 0;; e += 1) {
|
|
1546
|
-
let t =
|
|
1576
|
+
let t = ct(a(), r());
|
|
1547
1577
|
if (t.consistent || e >= 2) return t;
|
|
1548
|
-
await
|
|
1578
|
+
await V(40);
|
|
1549
1579
|
}
|
|
1550
1580
|
}, C = (e, t) => {
|
|
1551
|
-
let n = t.entries.map((e) => e.key), i =
|
|
1581
|
+
let n = t.entries.map((e) => e.key), i = lt(e.order, n);
|
|
1552
1582
|
e.order = i.order, i.consistent || (e.top = !1, e.bottom = !1);
|
|
1553
1583
|
for (let n of t.entries) e.kinds.set(n.key, n.kind), e.names.set(n.key, n.text);
|
|
1554
|
-
let a =
|
|
1584
|
+
let a = B(r().viewName);
|
|
1555
1585
|
if (t.hasParent) e.hasParent = !0, e.top = !0;
|
|
1556
1586
|
else if (e.hasParent && n.length > 0) {
|
|
1557
1587
|
let e = o.get(a);
|
|
1558
1588
|
(e === void 0 || n.length < e) && o.set(a, n.length);
|
|
1559
1589
|
}
|
|
1560
|
-
n.length < Math.max(
|
|
1590
|
+
n.length < Math.max(gt, o.get(a) ?? 0) && (e.top = !0, e.bottom = !0);
|
|
1561
1591
|
}, w = async (e, t, n) => {
|
|
1562
1592
|
let r = (await m(g(n), 280)).changed, i = r, a = !1;
|
|
1563
|
-
if (!r && s !== !0) for (let e = 0; e <
|
|
1593
|
+
if (!r && s !== !0) for (let e = 0; e < ht; e += 1) {
|
|
1564
1594
|
if (!(await m(h(n), 250)).changed) {
|
|
1565
1595
|
a = !0;
|
|
1566
1596
|
break;
|
|
@@ -1568,11 +1598,11 @@ var D = (e) => {
|
|
|
1568
1598
|
i = !0, s = !1;
|
|
1569
1599
|
}
|
|
1570
1600
|
else r || (a = !0);
|
|
1571
|
-
if (a && (n === "up" ? e.top = !0 : e.bottom = !0,
|
|
1601
|
+
if (a && (n === "up" ? e.top = !0 : e.bottom = !0, H("end of list", { direction: n })), !i) return null;
|
|
1572
1602
|
let o = await S();
|
|
1573
1603
|
C(e, o);
|
|
1574
1604
|
let c = t.cursorKey ? e.order.indexOf(t.cursorKey) : -1, l = o.cursorKey ? e.order.indexOf(o.cursorKey) : -1, u = Math.abs(l - c);
|
|
1575
|
-
return r && c >= 0 && l >= 0 && u > 0 && u <
|
|
1605
|
+
return r && c >= 0 && l >= 0 && u > 0 && u < ht && (s = !0), o;
|
|
1576
1606
|
}, T = (e, t, n) => {
|
|
1577
1607
|
if (n === "/..") return "up";
|
|
1578
1608
|
let r = e.order.indexOf(n), i = t.cursorKey ? e.order.indexOf(t.cursorKey) : -1;
|
|
@@ -1586,7 +1616,7 @@ var D = (e) => {
|
|
|
1586
1616
|
let t = n.row - r.cursorRow;
|
|
1587
1617
|
if (t === 0) return r;
|
|
1588
1618
|
let i = t < 0 ? "up" : "down";
|
|
1589
|
-
if (!(await m(Math.abs(t) >=
|
|
1619
|
+
if (!(await m(Math.abs(t) >= ht ? g(i) : h(i), 250)).changed) return null;
|
|
1590
1620
|
r = await S(), C(e, r);
|
|
1591
1621
|
continue;
|
|
1592
1622
|
}
|
|
@@ -1594,17 +1624,17 @@ var D = (e) => {
|
|
|
1594
1624
|
let o = await w(e, r, i);
|
|
1595
1625
|
if (o) r = o;
|
|
1596
1626
|
else if (a) return null;
|
|
1597
|
-
else a = !0, i =
|
|
1627
|
+
else a = !0, i = bt(i);
|
|
1598
1628
|
}
|
|
1599
1629
|
return null;
|
|
1600
1630
|
}, D = async (e, t) => {
|
|
1601
1631
|
let n = t.cursorRow ?? 0, i = t.entries.filter((t) => t.kind === "file" && !e.rejected.has(t.key) && v(t.text)).sort((e, t) => Math.abs(e.row - n) - Math.abs(t.row - n))[0];
|
|
1602
1632
|
if (!i) return "none";
|
|
1603
|
-
let a = await E(e, i.key, t), o =
|
|
1604
|
-
return a && v(o) ? (
|
|
1633
|
+
let a = await E(e, i.key, t), o = tt(r());
|
|
1634
|
+
return a && v(o) ? (H("match found", {
|
|
1605
1635
|
entry: o,
|
|
1606
1636
|
y: a.cursorRow
|
|
1607
|
-
}), await m(
|
|
1637
|
+
}), await m(z.Edit, 500), "found") : (H("match not reachable", { candidate: i.text }), e.rejected.add(i.key), "failed");
|
|
1608
1638
|
}, O = (e) => e.order.filter((t) => e.kinds.get(t) === "file").map((t) => {
|
|
1609
1639
|
let n = e.names.get(t) ?? "";
|
|
1610
1640
|
return {
|
|
@@ -1615,40 +1645,40 @@ var D = (e) => {
|
|
|
1615
1645
|
if (!e.sorted) return;
|
|
1616
1646
|
let t = O(e);
|
|
1617
1647
|
if (t.some((e, n) => n > 0 && (t[n - 1].ci > e.ci || t[n - 1].raw > e.raw))) {
|
|
1618
|
-
e.sorted = !1,
|
|
1648
|
+
e.sorted = !1, H("listing is not alphabetical, order hints disabled");
|
|
1619
1649
|
return;
|
|
1620
1650
|
}
|
|
1621
1651
|
let n = e.order.map((t) => {
|
|
1622
1652
|
let n = (e.names.get(t) ?? "").trim();
|
|
1623
1653
|
return {
|
|
1624
1654
|
kind: e.kinds.get(t),
|
|
1625
|
-
ci:
|
|
1655
|
+
ci: B(n).replace(/^\//, ""),
|
|
1626
1656
|
raw: n.replace(/^\//, "")
|
|
1627
1657
|
};
|
|
1628
1658
|
}), r = n.findIndex((e) => e.kind === "file");
|
|
1629
1659
|
r < 0 || (n.slice(r).some((e) => e.kind === "dir") ? c = !1 : n.some((e, t) => e.kind === "dir" && n.slice(t + 1).some((t) => t.kind === "file" && e.ci > t.ci && e.raw > t.raw)) && c === null && (c = !0));
|
|
1630
|
-
},
|
|
1660
|
+
}, A = (e) => !l || !e.sorted || c !== !0 || !e.top || e.bottom ? !1 : O(e).some((e) => /^[a-z0-9]/.test(e.ci) && e.ci > u && e.raw > x && e.raw > u), ee = (e, t) => {
|
|
1631
1661
|
if (!l || !e.sorted) return null;
|
|
1632
1662
|
let n = t.entries.filter((e) => e.kind === "file").map((e) => b(e.text)), r = n[0], i = n[n.length - 1];
|
|
1633
1663
|
return r === void 0 || i === void 0 ? null : u < r ? "up" : u > i ? "down" : null;
|
|
1634
|
-
},
|
|
1664
|
+
}, j = (e, t) => e.top === e.bottom ? ee(e, t) ?? "up" : e.top ? "down" : "up", M = (e, t) => {
|
|
1635
1665
|
let n = t.cursorKey ? e.order.indexOf(t.cursorKey) : -1, r = null;
|
|
1636
1666
|
for (let [i, a] of e.kinds) {
|
|
1637
1667
|
if (a !== "dir" || e.visited.has(i)) continue;
|
|
1638
|
-
let o = t.entries.find((e) => e.key === i), s = e.order.indexOf(i), c = o && t.cursorRow !== null ? Math.abs(o.row - t.cursorRow) : 100 + (n >= 0 && s >= 0 ? Math.abs(s - n) : 500), l =
|
|
1668
|
+
let o = t.entries.find((e) => e.key === i), s = e.order.indexOf(i), c = o && t.cursorRow !== null ? Math.abs(o.row - t.cursorRow) : 100 + (n >= 0 && s >= 0 ? Math.abs(s - n) : 500), l = pt(i, f) * 1e4 - c;
|
|
1639
1669
|
(!r || l > r.rank) && (r = {
|
|
1640
1670
|
key: i,
|
|
1641
1671
|
rank: l
|
|
1642
1672
|
});
|
|
1643
1673
|
}
|
|
1644
1674
|
return r?.key ?? null;
|
|
1645
|
-
},
|
|
1646
|
-
if (e >
|
|
1675
|
+
}, N = async (e, t) => await E(e, "/..", t) ? (H("navigate to parent directory"), (await m(z.Edit, 500)).changed && p()) : (H("parent directory entry unreachable"), !1), P = async (e) => {
|
|
1676
|
+
if (e > _t || !p()) return H("search aborted", {
|
|
1647
1677
|
depth: e,
|
|
1648
1678
|
active: p()
|
|
1649
1679
|
}), "aborted";
|
|
1650
|
-
let t =
|
|
1651
|
-
C(t, n),
|
|
1680
|
+
let t = yt(), n = await S();
|
|
1681
|
+
C(t, n), H("search directory", {
|
|
1652
1682
|
depth: e,
|
|
1653
1683
|
entries: n.entries.length,
|
|
1654
1684
|
complete: t.top && t.bottom
|
|
@@ -1656,42 +1686,42 @@ var D = (e) => {
|
|
|
1656
1686
|
for (let r = 0;; r += 1) {
|
|
1657
1687
|
let i = await D(t, n);
|
|
1658
1688
|
if (i === "found") return "found";
|
|
1659
|
-
if (i === "failed" && (n = await S(), C(t, n)), k(t),
|
|
1660
|
-
let a = await w(t, n,
|
|
1689
|
+
if (i === "failed" && (n = await S(), C(t, n)), k(t), A(t) && (H("rest of listing is past the target", { depth: e }), t.bottom = !0), t.top && t.bottom || r >= vt) break;
|
|
1690
|
+
let a = await w(t, n, j(t, n));
|
|
1661
1691
|
a && (n = a);
|
|
1662
1692
|
}
|
|
1663
1693
|
for (;;) {
|
|
1664
|
-
let r =
|
|
1694
|
+
let r = M(t, n);
|
|
1665
1695
|
if (!r) break;
|
|
1666
1696
|
if (t.visited.add(r), !await E(t, r, n)) {
|
|
1667
|
-
|
|
1697
|
+
H("directory unreachable", { directory: r }), n = await S(), C(t, n);
|
|
1668
1698
|
continue;
|
|
1669
1699
|
}
|
|
1670
|
-
|
|
1700
|
+
H("enter directory", {
|
|
1671
1701
|
directory: r,
|
|
1672
1702
|
depth: e
|
|
1673
1703
|
});
|
|
1674
|
-
let i = await m(
|
|
1704
|
+
let i = await m(z.Edit, 500);
|
|
1675
1705
|
if (!p()) return "aborted";
|
|
1676
1706
|
if (!i.changed) {
|
|
1677
1707
|
n = await S(), C(t, n);
|
|
1678
1708
|
continue;
|
|
1679
1709
|
}
|
|
1680
|
-
let a = await
|
|
1710
|
+
let a = await P(e + 1);
|
|
1681
1711
|
if (a !== "missed") return a;
|
|
1682
1712
|
n = await S(), C(t, n);
|
|
1683
1713
|
}
|
|
1684
|
-
return e === 0 || await
|
|
1714
|
+
return e === 0 || await N(t, n) ? "missed" : "aborted";
|
|
1685
1715
|
};
|
|
1686
1716
|
if (!p()) return console.warn("[M8SDK] browseFile requires a file browser view (load/save)"), !1;
|
|
1687
1717
|
if (a().length === 0) return console.warn("[M8SDK] browseFile needs the screen reader, which is not available"), !1;
|
|
1688
|
-
let
|
|
1689
|
-
return
|
|
1718
|
+
let F = await P(0);
|
|
1719
|
+
return F !== "found" && H("search failed", {
|
|
1690
1720
|
targetText: e,
|
|
1691
|
-
outcome:
|
|
1692
|
-
}),
|
|
1721
|
+
outcome: F
|
|
1722
|
+
}), F === "found";
|
|
1693
1723
|
};
|
|
1694
|
-
},
|
|
1724
|
+
}, St = (e) => {
|
|
1695
1725
|
if (!e) return null;
|
|
1696
1726
|
let t = e.trim();
|
|
1697
1727
|
if (t === "--") return 0;
|
|
@@ -1699,7 +1729,7 @@ var D = (e) => {
|
|
|
1699
1729
|
if (!n) return null;
|
|
1700
1730
|
let r = parseInt(n[0], 16);
|
|
1701
1731
|
return Number.isNaN(r) ? null : r;
|
|
1702
|
-
},
|
|
1732
|
+
}, Ct = (e) => {
|
|
1703
1733
|
if (!e) return null;
|
|
1704
1734
|
let t = e.trim();
|
|
1705
1735
|
if (t === "--") return 0;
|
|
@@ -1707,11 +1737,11 @@ var D = (e) => {
|
|
|
1707
1737
|
if (!n) return null;
|
|
1708
1738
|
let r = Number.parseInt(n[0], 10);
|
|
1709
1739
|
return Number.isNaN(r) ? null : r;
|
|
1710
|
-
},
|
|
1740
|
+
}, wt = /[+-]?\d+\.\d+/g, Tt = (e) => {
|
|
1711
1741
|
if (!e) return [];
|
|
1712
1742
|
let t = [];
|
|
1713
|
-
|
|
1714
|
-
let n =
|
|
1743
|
+
wt.lastIndex = 0;
|
|
1744
|
+
let n = wt.exec(e);
|
|
1715
1745
|
for (; n !== null;) {
|
|
1716
1746
|
let r = n[0], i = r.startsWith("-"), a = i || r.startsWith("+") ? r.slice(1) : r, o = a.indexOf("."), s = a.slice(0, o), c = a.slice(o + 1), l = Number.parseInt(s || "0", 10), u = Number.parseInt(c || "0", 10), d = 10 ** c.length, f = d > 0 ? 100 / d : 1, p = l * 100 + u * 100 / d;
|
|
1717
1747
|
!Number.isNaN(l) && !Number.isNaN(u) && t.push({
|
|
@@ -1722,16 +1752,16 @@ var D = (e) => {
|
|
|
1722
1752
|
decScale: d,
|
|
1723
1753
|
tickHundredths: f,
|
|
1724
1754
|
ticks: (i ? -1 : 1) * Math.round(p / f)
|
|
1725
|
-
}), n =
|
|
1755
|
+
}), n = wt.exec(e);
|
|
1726
1756
|
}
|
|
1727
1757
|
return t;
|
|
1728
|
-
},
|
|
1758
|
+
}, Et = (e, t) => {
|
|
1729
1759
|
if (e.length <= 1) return 0;
|
|
1730
1760
|
let n = t?.trim() ?? "";
|
|
1731
1761
|
if (!n) return 0;
|
|
1732
1762
|
let r = e.findIndex((e) => e.raw === n || e.raw.replace(/^[+-]/, "") === n || `${e.negative ? "-" : ""}${e.intDigits}` === n || e.intDigits === n || e.decDigits === n);
|
|
1733
1763
|
return r >= 0 ? r : 0;
|
|
1734
|
-
},
|
|
1764
|
+
}, Dt = (e, t) => {
|
|
1735
1765
|
if (!e) return null;
|
|
1736
1766
|
let n = t?.trim() ?? "";
|
|
1737
1767
|
if (!n) return null;
|
|
@@ -1745,13 +1775,13 @@ var D = (e) => {
|
|
|
1745
1775
|
if (r && !t) return "dec";
|
|
1746
1776
|
}
|
|
1747
1777
|
return null;
|
|
1748
|
-
},
|
|
1778
|
+
}, Ot = (e, t) => t.length === 1 ? e.raw === t || e.raw.replace(/^[+-]/, "") === t : e.raw === t || e.raw.replace(/^[+-]/, "") === t || `${e.negative ? "-" : ""}${e.intDigits}` === t || e.intDigits === t || e.decDigits === t, kt = (e, t, n) => {
|
|
1749
1779
|
let r = n?.trim() ?? "";
|
|
1750
|
-
return !r || !e[t] ||
|
|
1780
|
+
return !r || !e[t] || Ot(e[t], r) ? !1 : e.some((e, n) => n !== t && Ot(e, r));
|
|
1751
1781
|
}, U = (e, t) => {
|
|
1752
1782
|
let n = Math.round(e * t), r = n < 0 ? "-" : "", i = Math.abs(n), a = Math.floor(i / 100);
|
|
1753
1783
|
return `${r}${a}.${(i - a * 100).toString().padStart(2, "0")}`;
|
|
1754
|
-
},
|
|
1784
|
+
}, At = [
|
|
1755
1785
|
"C-",
|
|
1756
1786
|
"C#",
|
|
1757
1787
|
"D-",
|
|
@@ -1768,31 +1798,31 @@ var D = (e) => {
|
|
|
1768
1798
|
if (!e) return null;
|
|
1769
1799
|
let t = e.trim().toUpperCase().match(/([A-G][#-][0-9A-F])/);
|
|
1770
1800
|
if (!t) return null;
|
|
1771
|
-
let n = t[1], r = n.slice(0, 2), i = Number.parseInt(n.slice(2, 3), 16), a =
|
|
1801
|
+
let n = t[1], r = n.slice(0, 2), i = Number.parseInt(n.slice(2, 3), 16), a = At.indexOf(r);
|
|
1772
1802
|
return a < 0 || Number.isNaN(i) ? null : {
|
|
1773
1803
|
label: n,
|
|
1774
1804
|
noteName: r,
|
|
1775
1805
|
octave: i,
|
|
1776
1806
|
semitoneIndex: i * 12 + a
|
|
1777
1807
|
};
|
|
1778
|
-
},
|
|
1808
|
+
}, jt = (e) => {
|
|
1779
1809
|
let { store: t, debugLog: n, hasBus: r, sendKeys: i, pressAndRelease: a, waitForTextUnderCursorChange: o, waitForCurrentLineChange: s } = e;
|
|
1780
1810
|
return async (e) => {
|
|
1781
1811
|
if (!r() || !Number.isFinite(e)) return !1;
|
|
1782
1812
|
let c = 0, l = 1, u = [], d = () => {
|
|
1783
|
-
let e =
|
|
1813
|
+
let e = Tt(t.get("currentLine"));
|
|
1784
1814
|
if (u = e, !e.length) return null;
|
|
1785
1815
|
c = Math.min(c, e.length - 1);
|
|
1786
1816
|
let n = e[c];
|
|
1787
1817
|
return n.tickHundredths > 0 && (l = n.tickHundredths), n;
|
|
1788
|
-
}, f =
|
|
1818
|
+
}, f = Tt(t.get("currentLine"));
|
|
1789
1819
|
if (!f.length) return console.warn("[M8SDK] Could not find a float value like \"440.00\" or \"-10.69\" on the current line:", t.get("currentLine")), !1;
|
|
1790
|
-
c =
|
|
1820
|
+
c = Et(f, t.get("textUnderCursor")), f.length > 1 && n("[M8SDK] Multiple float values on line, editing:", f[c]?.raw);
|
|
1791
1821
|
let p = f[c];
|
|
1792
1822
|
l = p.tickHundredths;
|
|
1793
1823
|
let m = Math.round(Math.round(e * 100) / l);
|
|
1794
1824
|
if (p.ticks === m) return n("[M8SDK] Already at target float value:", U(m, l)), !0;
|
|
1795
|
-
n("[M8SDK] Setting float value from", U(p.ticks, l), "to", U(m, l)), await a(
|
|
1825
|
+
n("[M8SDK] Setting float value from", U(p.ticks, l), "to", U(m, l)), await a(z.Edit), await V(80);
|
|
1796
1826
|
let h = () => ({
|
|
1797
1827
|
upDown: {
|
|
1798
1828
|
mag: null,
|
|
@@ -1806,19 +1836,19 @@ var D = (e) => {
|
|
|
1806
1836
|
full: h(),
|
|
1807
1837
|
int: h(),
|
|
1808
1838
|
dec: h()
|
|
1809
|
-
}, _ = p.decScale, v = Date.now(), y =
|
|
1839
|
+
}, _ = p.decScale, v = Date.now(), y = Dt(p, t.get("textUnderCursor")) ?? "int";
|
|
1810
1840
|
n("[M8SDK] Float cursor focus:", y);
|
|
1811
1841
|
let b = !1, x = !1, S = p.ticks, C = null, w = p.ticks, T = Math.abs(p.ticks - m), E = 0, D = !1, O = !1, k = (e, t) => {
|
|
1812
|
-
let n = e === "upDown" ?
|
|
1813
|
-
return
|
|
1814
|
-
},
|
|
1842
|
+
let n = e === "upDown" ? z.Up : z.Right, r = e === "upDown" ? z.Down : z.Left;
|
|
1843
|
+
return z.Edit | (t >= 0 ? n : r);
|
|
1844
|
+
}, A = async (e, n, r) => {
|
|
1815
1845
|
let a = g[y][e], o = k(e, n * a.bias), c = t.get("currentLine");
|
|
1816
|
-
for (let e = 0; e < r; e++) i(o), await
|
|
1846
|
+
for (let e = 0; e < r; e++) i(o), await V(22);
|
|
1817
1847
|
await s(c, 350);
|
|
1818
|
-
},
|
|
1819
|
-
let n = () =>
|
|
1848
|
+
}, ee = async (e) => {
|
|
1849
|
+
let n = () => Dt(d(), t.get("textUnderCursor"));
|
|
1820
1850
|
if (n() === e) return y = e, !0;
|
|
1821
|
-
let r = t.get("textUnderCursor"), i = e === "dec" ?
|
|
1851
|
+
let r = t.get("textUnderCursor"), i = e === "dec" ? z.Right : z.Left, s = e === "dec" ? z.Left : z.Right;
|
|
1822
1852
|
if (await a(i, 35), await o(r, 250), n() === e) return y = e, !0;
|
|
1823
1853
|
await a(s, 35), await o(r, 250);
|
|
1824
1854
|
let c = n() === e;
|
|
@@ -1830,7 +1860,7 @@ var D = (e) => {
|
|
|
1830
1860
|
console.warn("[M8SDK] Float value no longer parseable while editing:", t.get("currentLine")), O = !0;
|
|
1831
1861
|
break;
|
|
1832
1862
|
}
|
|
1833
|
-
if (
|
|
1863
|
+
if (kt(u, c, t.get("textUnderCursor"))) {
|
|
1834
1864
|
console.warn("[M8SDK] Float cursor drifted to another field, aborting to avoid editing the wrong value"), x = !0, O = !0;
|
|
1835
1865
|
break;
|
|
1836
1866
|
}
|
|
@@ -1848,8 +1878,8 @@ var D = (e) => {
|
|
|
1848
1878
|
}
|
|
1849
1879
|
if (C = S, S = e.ticks, y !== "full" && !b) {
|
|
1850
1880
|
let e = i >= _ ? "int" : "dec";
|
|
1851
|
-
if (e !== y && !await
|
|
1852
|
-
if (
|
|
1881
|
+
if (e !== y && !await ee(e)) {
|
|
1882
|
+
if (kt(u, c, t.get("textUnderCursor"))) {
|
|
1853
1883
|
console.warn("[M8SDK] Float cursor drifted to another field, aborting to avoid editing the wrong value"), x = !0, O = !0;
|
|
1854
1884
|
break;
|
|
1855
1885
|
}
|
|
@@ -1858,21 +1888,21 @@ var D = (e) => {
|
|
|
1858
1888
|
}
|
|
1859
1889
|
let s = g[y], f = y === "int" ? Math.max(32, 3 * _) : y === "full" ? _ : 8, p, h = 1;
|
|
1860
1890
|
s.upDown.mag !== null && s.upDown.mag > 0 && i >= s.upDown.mag ? (p = "upDown", h = Math.min(Math.max(1, Math.floor(i / s.upDown.mag)), 96)) : s.upDown.mag === null && i >= f ? (p = "upDown", h = 1) : s.leftRight.mag !== null && s.leftRight.mag > 0 ? (p = "leftRight", h = Math.min(Math.max(1, Math.floor(i / s.leftRight.mag)), 96)) : (p = "leftRight", h = 1);
|
|
1861
|
-
let v = r > 0 ? 1 : -1, k = e.ticks,
|
|
1862
|
-
await
|
|
1863
|
-
let
|
|
1864
|
-
if (!
|
|
1891
|
+
let v = r > 0 ? 1 : -1, k = e.ticks, j = y, M = p;
|
|
1892
|
+
await A(p, v, h);
|
|
1893
|
+
let N = d();
|
|
1894
|
+
if (!N) {
|
|
1865
1895
|
O = !0;
|
|
1866
1896
|
break;
|
|
1867
1897
|
}
|
|
1868
|
-
let
|
|
1869
|
-
if (
|
|
1870
|
-
E += 1, E >= 4 && (console.warn(`[M8SDK] Float value stopped reacting at ${U(
|
|
1898
|
+
let P = N.ticks - k;
|
|
1899
|
+
if (P === 0) {
|
|
1900
|
+
E += 1, E >= 4 && (console.warn(`[M8SDK] Float value stopped reacting at ${U(N.ticks, l)} (target ${U(m, l)} may be out of range)`), O = !0);
|
|
1871
1901
|
continue;
|
|
1872
1902
|
}
|
|
1873
1903
|
E = 0;
|
|
1874
|
-
let
|
|
1875
|
-
|
|
1904
|
+
let F = g[j][M];
|
|
1905
|
+
F.mag = Math.max(1, Math.round(Math.abs(P) / h)), Math.sign(P) !== Math.sign(r) && (n(`[M8SDK] Float ${M} arrows move oppositely in '${j}' focus, inverting mapping`), F.bias *= -1, C = null);
|
|
1876
1906
|
}
|
|
1877
1907
|
if (!D && !x) {
|
|
1878
1908
|
let e = Date.now();
|
|
@@ -1880,20 +1910,20 @@ var D = (e) => {
|
|
|
1880
1910
|
let e = d();
|
|
1881
1911
|
if (!e || e.ticks === w) break;
|
|
1882
1912
|
let t = w - e.ticks, n = Math.abs(t);
|
|
1883
|
-
y !== "full" && !b && n >= _ != (y === "int") && (await
|
|
1913
|
+
y !== "full" && !b && n >= _ != (y === "int") && (await ee(n >= _ ? "int" : "dec") || (b = !0));
|
|
1884
1914
|
let r = g[y], i, a = 1;
|
|
1885
1915
|
r.upDown.mag !== null && r.upDown.mag > 0 && n >= r.upDown.mag ? (i = "upDown", a = Math.min(Math.max(1, Math.floor(n / r.upDown.mag)), 16)) : r.leftRight.mag !== null && r.leftRight.mag > 0 ? (i = "leftRight", a = Math.min(Math.max(1, Math.floor(n / r.leftRight.mag)), 16)) : i = "leftRight";
|
|
1886
1916
|
let o = e.ticks;
|
|
1887
|
-
await
|
|
1917
|
+
await A(i, t > 0 ? 1 : -1, a);
|
|
1888
1918
|
let s = d();
|
|
1889
1919
|
if (!s || s.ticks === o) break;
|
|
1890
1920
|
}
|
|
1891
1921
|
}
|
|
1892
|
-
x || await a(
|
|
1893
|
-
let
|
|
1894
|
-
return n(`[M8SDK] Float setting ${
|
|
1922
|
+
x || await a(z.Edit);
|
|
1923
|
+
let j = d(), M = !!j && j.ticks === m;
|
|
1924
|
+
return n(`[M8SDK] Float setting ${M ? "succeeded" : "failed"}: "${j?.raw ?? "N/A"}" (${j ? U(j.ticks, l) : "N/A"})`), M;
|
|
1895
1925
|
};
|
|
1896
|
-
},
|
|
1926
|
+
}, Mt = {
|
|
1897
1927
|
song: [
|
|
1898
1928
|
{
|
|
1899
1929
|
to: "project",
|
|
@@ -2346,7 +2376,7 @@ var D = (e) => {
|
|
|
2346
2376
|
via: "exit",
|
|
2347
2377
|
keys: [2, 0]
|
|
2348
2378
|
}]
|
|
2349
|
-
},
|
|
2379
|
+
}, Nt = { views: /* @__PURE__ */ "chain.effectsettings.groove.instmods.inst.instrumentpool.mixer.phrase.project.scale.song.table.mixeq.limiterscope.mixscope.modfxeq.delayeq.reverbeq.loadinstrument.selectsavedirectory.createdirectory.systemsettings.midisettings.midimapping.renderaudio.timestats.themesettings.loadproject".split(".") }, Pt = (e) => {
|
|
2350
2380
|
let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
|
|
2351
2381
|
for (let [r, i] of Object.entries(e)) {
|
|
2352
2382
|
let e = r.toLowerCase(), a = [], o = /* @__PURE__ */ new Map();
|
|
@@ -2376,20 +2406,20 @@ var D = (e) => {
|
|
|
2376
2406
|
graph: t,
|
|
2377
2407
|
edgeKeys: n
|
|
2378
2408
|
};
|
|
2379
|
-
},
|
|
2380
|
-
if (!
|
|
2381
|
-
let e = Array.isArray(
|
|
2382
|
-
|
|
2409
|
+
}, Ft = null, It = null, Lt = () => (Ft ??= Pt(Mt), Ft), Rt = () => {
|
|
2410
|
+
if (!It) {
|
|
2411
|
+
let e = Array.isArray(Nt.views) ? Nt.views : [];
|
|
2412
|
+
It = new Set(e.map((e) => String(e).trim().toLowerCase()).filter((e) => !!e));
|
|
2383
2413
|
}
|
|
2384
|
-
return
|
|
2385
|
-
},
|
|
2414
|
+
return It;
|
|
2415
|
+
}, zt = 50, Bt = {
|
|
2386
2416
|
x: 0,
|
|
2387
2417
|
y: 0,
|
|
2388
2418
|
w: 1,
|
|
2389
2419
|
h: 1
|
|
2390
|
-
},
|
|
2420
|
+
}, Vt = class {
|
|
2391
2421
|
constructor() {
|
|
2392
|
-
this.assemblies = [], this.selectionRectSamples = [], this.lastCursor =
|
|
2422
|
+
this.assemblies = [], this.selectionRectSamples = [], this.lastCursor = Bt, this.lastSelectionCursor = null, this.lastCursorColor = null, this.lastSelectionMode = !1, this.lastSelectionSeenAt = 0, this.ASSEMBLY_TIMEOUT = 100, this.SELECTION_SAMPLE_WINDOW = 50, this.SELECTION_HOLD_DURATION = 150;
|
|
2393
2423
|
}
|
|
2394
2424
|
processRect(e) {
|
|
2395
2425
|
if (!e) return {
|
|
@@ -2581,7 +2611,7 @@ var D = (e) => {
|
|
|
2581
2611
|
].filter((e) => e.foundVert || e.foundTip).length >= 2;
|
|
2582
2612
|
}
|
|
2583
2613
|
buildCursorFromAssembly(e) {
|
|
2584
|
-
if (!e.tr || !e.bl || !e.br) return
|
|
2614
|
+
if (!e.tr || !e.bl || !e.br) return Bt;
|
|
2585
2615
|
let t = e.tr.x - e.tl.x - 1, n = e.bl.y - e.tl.y - 1;
|
|
2586
2616
|
return {
|
|
2587
2617
|
x: e.tl.x + 1,
|
|
@@ -2598,19 +2628,19 @@ var D = (e) => {
|
|
|
2598
2628
|
h: 1
|
|
2599
2629
|
}, this.lastSelectionCursor = null, this.lastSelectionMode = !1, this.lastSelectionSeenAt = 0;
|
|
2600
2630
|
}
|
|
2601
|
-
},
|
|
2631
|
+
}, Ht = (e) => e ? `#${[
|
|
2602
2632
|
e.r,
|
|
2603
2633
|
e.g,
|
|
2604
2634
|
e.b
|
|
2605
2635
|
].map((e) => e.toString(16).padStart(2, "0")).join("")}` : null;
|
|
2606
|
-
function
|
|
2607
|
-
let n = new
|
|
2636
|
+
function Ut(e, t) {
|
|
2637
|
+
let n = new Vt();
|
|
2608
2638
|
class r {
|
|
2609
2639
|
constructor() {
|
|
2610
2640
|
this.rowChars = /* @__PURE__ */ new Map(), this.timer = null, this.knownViews = [], this.earlyAccepted = !1;
|
|
2611
2641
|
}
|
|
2612
2642
|
init() {
|
|
2613
|
-
this.knownViews = Array.from(
|
|
2643
|
+
this.knownViews = Array.from(Rt());
|
|
2614
2644
|
}
|
|
2615
2645
|
normForCompare(e) {
|
|
2616
2646
|
return e = e.includes("live") ? "song" : e, e.toLowerCase().trim().replace(/[{}]/g, "0");
|
|
@@ -2654,7 +2684,7 @@ function zt(e, t) {
|
|
|
2654
2684
|
bg: e.background
|
|
2655
2685
|
}), this.tryEarlyAccept(o), this.timer && clearTimeout(this.timer), this.timer = setTimeout(() => {
|
|
2656
2686
|
this.emitStable();
|
|
2657
|
-
},
|
|
2687
|
+
}, zt)));
|
|
2658
2688
|
}
|
|
2659
2689
|
reset() {
|
|
2660
2690
|
this.rowChars.clear(), this.timer &&= (clearTimeout(this.timer), null), this.earlyAccepted = !1;
|
|
@@ -2733,7 +2763,7 @@ function zt(e, t) {
|
|
|
2733
2763
|
let e = this.grid.get(i), a = [], o = [];
|
|
2734
2764
|
for (let n = 0; n < t; n += 1) {
|
|
2735
2765
|
let t = e?.get(n);
|
|
2736
|
-
a.push(
|
|
2766
|
+
a.push(Ht(t?.fg)), o.push(Ht(t?.bg));
|
|
2737
2767
|
}
|
|
2738
2768
|
n.push(a), r.push(o);
|
|
2739
2769
|
}
|
|
@@ -2760,7 +2790,7 @@ function zt(e, t) {
|
|
|
2760
2790
|
if (!e) return;
|
|
2761
2791
|
Date.now() < s && console.log(`[rect] type=${e.type} pos=(${e.pos.x},${e.pos.y}) size=${e.size.width}x${e.size.height}`);
|
|
2762
2792
|
let { cellW: r, cellH: i, offX: a, offY: o } = t.get("cellMetrics"), { cursor: c, cursorColor: l, selectionMode: u } = n.processRect(e);
|
|
2763
|
-
l &&
|
|
2793
|
+
l && Ht(l) !== Ht(t.get("cursorColor")) && t.set("cursorColor", l);
|
|
2764
2794
|
let { x: d, y: f, w: p, h: m } = c, h = Math.round((d - a) / r), g = Math.round((f - o) / i), _ = t.get("cursorPos"), v = t.get("selectionMode");
|
|
2765
2795
|
if (u) {
|
|
2766
2796
|
let e = t.get("cursorRect");
|
|
@@ -2816,7 +2846,7 @@ function zt(e, t) {
|
|
|
2816
2846
|
}
|
|
2817
2847
|
//#endregion
|
|
2818
2848
|
//#region src/engine/host/hostState.ts
|
|
2819
|
-
var
|
|
2849
|
+
var Wt = (e) => {
|
|
2820
2850
|
let t = e.get("macroStatus");
|
|
2821
2851
|
return {
|
|
2822
2852
|
viewName: e.get("viewName"),
|
|
@@ -2838,13 +2868,13 @@ var Bt = (e) => {
|
|
|
2838
2868
|
macroCurrentStep: t.currentStep,
|
|
2839
2869
|
macroSequenceLength: t.sequenceLength
|
|
2840
2870
|
};
|
|
2841
|
-
},
|
|
2871
|
+
}, Gt = (e, t, n) => {
|
|
2842
2872
|
let r = e.get("cellMetrics");
|
|
2843
2873
|
return {
|
|
2844
2874
|
x: t * r.cellW + r.offX + r.cellW / 2,
|
|
2845
2875
|
y: n * r.cellH + r.offY + r.cellH / 2
|
|
2846
2876
|
};
|
|
2847
|
-
},
|
|
2877
|
+
}, Kt = (e) => Re({
|
|
2848
2878
|
left: e.includes("left"),
|
|
2849
2879
|
right: e.includes("right"),
|
|
2850
2880
|
up: e.includes("up"),
|
|
@@ -2853,11 +2883,11 @@ var Bt = (e) => {
|
|
|
2853
2883
|
play: e.includes("play"),
|
|
2854
2884
|
opt: e.includes("opt"),
|
|
2855
2885
|
edit: e.includes("edit")
|
|
2856
|
-
}),
|
|
2886
|
+
}), qt = ({ io: e, editors: t, setValueFloat: n, browseFile: r, navigateToView: i, navigateTo: a, enableMidiTransport: o, getScreenCellColors: s }) => {
|
|
2857
2887
|
let { debugLog: c, hasBus: l, sendKeys: u, pressAndRelease: d, store: f, getScreenLines: p } = e, m = (e, t, n) => async (...r) => l() ? n(...r) : (console.warn(`[M8SDK] ${e}: no bus connection`), t);
|
|
2858
2888
|
return {
|
|
2859
2889
|
navigateToView: m("navigateToView", !1, async (e) => (c("[M8SDK] Executing navigateToView:", e), i(e))),
|
|
2860
|
-
navigateTo: m("navigateTo", !1, async (e, t) => a(
|
|
2890
|
+
navigateTo: m("navigateTo", !1, async (e, t) => a(Gt(f, e, t))),
|
|
2861
2891
|
setValueToHex: m("setValueToHex", !1, async (e) => (c("[M8SDK] Executing setValueToHex:", e), t.setValueToHex(e))),
|
|
2862
2892
|
setValueToInt: m("setValueToInt", !1, async (e) => (c("[M8SDK] Executing setValueToInt:", e), t.setValueToInt(e))),
|
|
2863
2893
|
setValueFloat: m("setValueFloat", !1, async (e) => (c("[M8SDK] Executing setValueFloat:", e), n(e))),
|
|
@@ -2872,15 +2902,15 @@ var Bt = (e) => {
|
|
|
2872
2902
|
exact: t
|
|
2873
2903
|
}), r(e, t))),
|
|
2874
2904
|
sendKeyDown: m("sendKeyDown", void 0, async (e) => {
|
|
2875
|
-
c("[M8SDK] Executing sendKeyDown:", e), u(
|
|
2905
|
+
c("[M8SDK] Executing sendKeyDown:", e), u(Kt(e));
|
|
2876
2906
|
}),
|
|
2877
2907
|
sendKeyUp: m("sendKeyUp", void 0, async () => {
|
|
2878
2908
|
c("[M8SDK] Executing sendKeyUp"), u(0);
|
|
2879
2909
|
}),
|
|
2880
2910
|
sendKeyPress: m("sendKeyPress", void 0, async (e) => {
|
|
2881
|
-
c("[M8SDK] Executing sendKeyPress:", e), await d(
|
|
2911
|
+
c("[M8SDK] Executing sendKeyPress:", e), await d(Kt(e));
|
|
2882
2912
|
}),
|
|
2883
|
-
getState: async () =>
|
|
2913
|
+
getState: async () => Wt(f),
|
|
2884
2914
|
getScreen: async () => ({
|
|
2885
2915
|
width: 40,
|
|
2886
2916
|
height: 24,
|
|
@@ -2894,7 +2924,7 @@ var Bt = (e) => {
|
|
|
2894
2924
|
}),
|
|
2895
2925
|
enableMidiTransport: async () => o()
|
|
2896
2926
|
};
|
|
2897
|
-
},
|
|
2927
|
+
}, Jt = 6, Yt = (e) => {
|
|
2898
2928
|
let t = null, n = 0, r = null, i = null, a = (e) => performance.timeOrigin + e, o = (t) => {
|
|
2899
2929
|
let o = t.data;
|
|
2900
2930
|
if (!o || o.length === 0) return;
|
|
@@ -2905,7 +2935,7 @@ var Bt = (e) => {
|
|
|
2905
2935
|
let e = s - r;
|
|
2906
2936
|
e > 0 && e < 200 && (i = i == null ? e : i * .9 + e * .1);
|
|
2907
2937
|
}
|
|
2908
|
-
r = s, n += 1, n %
|
|
2938
|
+
r = s, n += 1, n % Jt === 0 && e({
|
|
2909
2939
|
kind: "clock",
|
|
2910
2940
|
ticks: n,
|
|
2911
2941
|
at: s,
|
|
@@ -2983,40 +3013,40 @@ var Bt = (e) => {
|
|
|
2983
3013
|
c += 1, s = null, t?.removeEventListener("midimessage", o), t = null;
|
|
2984
3014
|
}
|
|
2985
3015
|
};
|
|
2986
|
-
},
|
|
3016
|
+
}, Xt = (e, t) => {
|
|
2987
3017
|
let n = [], r = e, i = t;
|
|
2988
3018
|
for (; r !== i;) {
|
|
2989
3019
|
let e = i - r, t = Math.abs(e), a = e > 0 ? 1 : -1;
|
|
2990
3020
|
if (t >= 16) {
|
|
2991
|
-
let e = Math.floor(t / 16), o = a > 0 ?
|
|
3021
|
+
let e = Math.floor(t / 16), o = a > 0 ? z.Up : z.Down, s = z.Edit | o, c = Math.min(e, 10);
|
|
2992
3022
|
for (let e = 0; e < c && (n.push(s), n.push(0), r += a * 16, r !== i); e++);
|
|
2993
3023
|
} else if (t > 0) {
|
|
2994
|
-
let e = a > 0 ?
|
|
3024
|
+
let e = a > 0 ? z.Right : z.Left, t = z.Edit | e;
|
|
2995
3025
|
n.push(t), n.push(0), r += a * 1;
|
|
2996
3026
|
} else break;
|
|
2997
3027
|
}
|
|
2998
3028
|
return n;
|
|
2999
|
-
},
|
|
3029
|
+
}, Zt = (e, t) => {
|
|
3000
3030
|
let n = [], r = e;
|
|
3001
3031
|
for (; r !== t;) {
|
|
3002
3032
|
let e = t - r, i = e > 0 ? 1 : -1;
|
|
3003
3033
|
if (Math.abs(e) >= 12) {
|
|
3004
|
-
let e = i > 0 ?
|
|
3005
|
-
n.push(
|
|
3034
|
+
let e = i > 0 ? z.Up : z.Down;
|
|
3035
|
+
n.push(z.Edit | e), n.push(0), r += i * 12;
|
|
3006
3036
|
} else {
|
|
3007
|
-
let e = i > 0 ?
|
|
3008
|
-
n.push(
|
|
3037
|
+
let e = i > 0 ? z.Right : z.Left;
|
|
3038
|
+
n.push(z.Edit | e), n.push(0), r += i;
|
|
3009
3039
|
}
|
|
3010
3040
|
if (n.length > 2048) break;
|
|
3011
3041
|
}
|
|
3012
3042
|
return n;
|
|
3013
|
-
},
|
|
3043
|
+
}, Qt = (e) => {
|
|
3014
3044
|
let { store: t, debugLog: n, hasBus: r, sendKeys: i, pressAndRelease: a, waitForTextUnderCursorChange: o } = e;
|
|
3015
3045
|
return {
|
|
3016
3046
|
setValueToHex: async (e) => {
|
|
3017
3047
|
if (!r()) return !1;
|
|
3018
3048
|
e = Math.max(0, Math.min(255, e));
|
|
3019
|
-
let s = t.get("textUnderCursor"), c =
|
|
3049
|
+
let s = t.get("textUnderCursor"), c = St(s), l = s?.trim() === "--";
|
|
3020
3050
|
if (c === null) return console.warn("[M8SDK] Could not parse current value under cursor:", s), !1;
|
|
3021
3051
|
if (c === e && !l) return n("[M8SDK] Already at target value:", e.toString(16).padStart(2, "0").toUpperCase()), !0;
|
|
3022
3052
|
n(`[M8SDK] Setting value from "${s?.trim() ?? "N/A"}" (${c.toString(16).padStart(2, "0").toUpperCase()}) to ${e.toString(16).padStart(2, "0").toUpperCase()}`);
|
|
@@ -3024,60 +3054,60 @@ var Bt = (e) => {
|
|
|
3024
3054
|
if (l) {
|
|
3025
3055
|
n("[M8SDK] Initial value is \"--\", pressing edit to recall last value");
|
|
3026
3056
|
let e = s;
|
|
3027
|
-
await a(
|
|
3028
|
-
let r = t.get("textUnderCursor"), i =
|
|
3029
|
-
if (n(`[M8SDK] After edit press, value is now: "${r?.trim() ?? "N/A"}" (${i?.toString(16).padStart(2, "0").toUpperCase() ?? "N/A"})`), i === null) return console.warn("[M8SDK] Failed to read value after edit press on \"--\""), await a(
|
|
3057
|
+
await a(z.Edit), await o(e, 250);
|
|
3058
|
+
let r = t.get("textUnderCursor"), i = St(r);
|
|
3059
|
+
if (n(`[M8SDK] After edit press, value is now: "${r?.trim() ?? "N/A"}" (${i?.toString(16).padStart(2, "0").toUpperCase() ?? "N/A"})`), i === null) return console.warn("[M8SDK] Failed to read value after edit press on \"--\""), await a(z.Edit), !1;
|
|
3030
3060
|
u = i;
|
|
3031
3061
|
} else {
|
|
3032
3062
|
let e = s;
|
|
3033
|
-
await a(
|
|
3063
|
+
await a(z.Edit), await o(e, 250);
|
|
3034
3064
|
}
|
|
3035
|
-
let d =
|
|
3065
|
+
let d = Xt(u, e);
|
|
3036
3066
|
n(`[M8SDK] Precalculated ${d.length / 2} key presses from ${u.toString(16).padStart(2, "0").toUpperCase()} to ${e.toString(16).padStart(2, "0").toUpperCase()}`);
|
|
3037
|
-
for (let e of d) i(e), await
|
|
3067
|
+
for (let e of d) i(e), await V(30);
|
|
3038
3068
|
await o(s, 250);
|
|
3039
|
-
let f = t.get("textUnderCursor"), p =
|
|
3069
|
+
let f = t.get("textUnderCursor"), p = St(f);
|
|
3040
3070
|
if (p !== e) {
|
|
3041
3071
|
n("[M8SDK] Precomputation missed target, falling back to iterative mode");
|
|
3042
3072
|
let r = p ?? u, i = Date.now();
|
|
3043
3073
|
for (; r !== e && Date.now() - i < 5e3;) {
|
|
3044
3074
|
let i = e - r, s = Math.abs(i), c = i > 0 ? 1 : -1, l = t.get("textUnderCursor");
|
|
3045
3075
|
if (s >= 16) {
|
|
3046
|
-
let e = c > 0 ?
|
|
3076
|
+
let e = c > 0 ? z.Up : z.Down, t = z.Edit | e;
|
|
3047
3077
|
await a(t);
|
|
3048
3078
|
} else if (s > 0) {
|
|
3049
|
-
let e = c > 0 ?
|
|
3079
|
+
let e = c > 0 ? z.Right : z.Left, t = z.Edit | e;
|
|
3050
3080
|
await a(t);
|
|
3051
3081
|
}
|
|
3052
3082
|
await o(l, 250);
|
|
3053
|
-
let u =
|
|
3083
|
+
let u = St(t.get("textUnderCursor"));
|
|
3054
3084
|
u !== null && (r = u, n(`[M8SDK] Iterative: current value: ${r.toString(16).padStart(2, "0").toUpperCase()}`));
|
|
3055
3085
|
}
|
|
3056
|
-
p =
|
|
3086
|
+
p = St(t.get("textUnderCursor"));
|
|
3057
3087
|
}
|
|
3058
|
-
await a(
|
|
3088
|
+
await a(z.Edit);
|
|
3059
3089
|
let m = p === e;
|
|
3060
3090
|
return n(`[M8SDK] Value setting ${m ? "succeeded" : "failed"}. Final value: "${f?.trim() ?? "N/A"}" (${p?.toString(16).padStart(2, "0").toUpperCase() ?? "N/A"})`), m;
|
|
3061
3091
|
},
|
|
3062
3092
|
setValueToInt: async (e) => {
|
|
3063
3093
|
if (!r()) return !1;
|
|
3064
3094
|
e = Math.floor(e);
|
|
3065
|
-
let n = t.get("textUnderCursor"), i =
|
|
3095
|
+
let n = t.get("textUnderCursor"), i = Ct(n);
|
|
3066
3096
|
if (i === null) return console.warn("[M8SDK] Could not parse current integer value under cursor:", n), !1;
|
|
3067
3097
|
if (i === e) return !0;
|
|
3068
|
-
await a(
|
|
3098
|
+
await a(z.Edit), await o(n, 250);
|
|
3069
3099
|
let s = i, c = i, l = Math.abs(i - e), u = null, d = Date.now();
|
|
3070
3100
|
for (; s !== e && Date.now() - d < 5e3;) {
|
|
3071
3101
|
let n = e - s, r = Math.abs(n), i = n > 0 ? 1 : -1, d = t.get("textUnderCursor"), f = s;
|
|
3072
3102
|
if (r >= 16) {
|
|
3073
|
-
let e = i > 0 ?
|
|
3074
|
-
await a(
|
|
3103
|
+
let e = i > 0 ? z.Up : z.Down;
|
|
3104
|
+
await a(z.Edit | e, 35);
|
|
3075
3105
|
} else {
|
|
3076
|
-
let e = i > 0 ?
|
|
3077
|
-
await a(
|
|
3106
|
+
let e = i > 0 ? z.Right : z.Left;
|
|
3107
|
+
await a(z.Edit | e, 35);
|
|
3078
3108
|
}
|
|
3079
3109
|
await o(d, 250);
|
|
3080
|
-
let p =
|
|
3110
|
+
let p = Ct(t.get("textUnderCursor"));
|
|
3081
3111
|
if (p === null || p === s) break;
|
|
3082
3112
|
let m = Math.abs(p - e);
|
|
3083
3113
|
m < l && (l = m, c = p);
|
|
@@ -3090,19 +3120,19 @@ var Bt = (e) => {
|
|
|
3090
3120
|
for (; s !== c && Date.now() - e < 1500;) {
|
|
3091
3121
|
let e = c - s, n = Math.abs(e), r = e > 0 ? 1 : -1, i = t.get("textUnderCursor");
|
|
3092
3122
|
if (n >= 16) {
|
|
3093
|
-
let e = r > 0 ?
|
|
3094
|
-
await a(
|
|
3123
|
+
let e = r > 0 ? z.Up : z.Down;
|
|
3124
|
+
await a(z.Edit | e, 35);
|
|
3095
3125
|
} else {
|
|
3096
|
-
let e = r > 0 ?
|
|
3097
|
-
await a(
|
|
3126
|
+
let e = r > 0 ? z.Right : z.Left;
|
|
3127
|
+
await a(z.Edit | e, 35);
|
|
3098
3128
|
}
|
|
3099
3129
|
await o(i, 250);
|
|
3100
|
-
let l =
|
|
3130
|
+
let l = Ct(t.get("textUnderCursor"));
|
|
3101
3131
|
if (l === null || l === s) break;
|
|
3102
3132
|
s = l;
|
|
3103
3133
|
}
|
|
3104
3134
|
}
|
|
3105
|
-
return await a(
|
|
3135
|
+
return await a(z.Edit), Ct(t.get("textUnderCursor")) === e;
|
|
3106
3136
|
},
|
|
3107
3137
|
setNote: async (e) => {
|
|
3108
3138
|
if (!r()) return !1;
|
|
@@ -3110,9 +3140,9 @@ var Bt = (e) => {
|
|
|
3110
3140
|
if (s === "---" || s === "OFF") {
|
|
3111
3141
|
let e = t.get("textUnderCursor"), r = e?.trim().toUpperCase() ?? "";
|
|
3112
3142
|
if (r === s) return !0;
|
|
3113
|
-
if (await a(
|
|
3143
|
+
if (await a(z.Opt | z.Edit), await o(e, 250), s === "OFF" && r !== "---") {
|
|
3114
3144
|
let e = t.get("textUnderCursor");
|
|
3115
|
-
e?.trim().toUpperCase() === "---" && (await a(
|
|
3145
|
+
e?.trim().toUpperCase() === "---" && (await a(z.Opt | z.Edit), await o(e, 250));
|
|
3116
3146
|
}
|
|
3117
3147
|
let i = t.get("textUnderCursor")?.trim().toUpperCase();
|
|
3118
3148
|
return n("[M8SDK] setNote special value result:", i), i === s;
|
|
@@ -3120,17 +3150,17 @@ var Bt = (e) => {
|
|
|
3120
3150
|
let c = W(e);
|
|
3121
3151
|
if (!c) return console.warn("[M8SDK] Invalid note format. Expected like C-1, C#1, D#A, ---, OFF:", e), !1;
|
|
3122
3152
|
let l = t.get("textUnderCursor");
|
|
3123
|
-
(l?.trim() === "---" || l?.trim().toUpperCase() === "OFF") && (n("[M8SDK] Initial note is \"---\" or \"OFF\", priming with edit key"), await a(
|
|
3153
|
+
(l?.trim() === "---" || l?.trim().toUpperCase() === "OFF") && (n("[M8SDK] Initial note is \"---\" or \"OFF\", priming with edit key"), await a(z.Edit), await o(l, 250), l = t.get("textUnderCursor"));
|
|
3124
3154
|
let u = W(l);
|
|
3125
3155
|
if (!u) return console.warn("[M8SDK] Could not parse current note under cursor:", l), !1;
|
|
3126
3156
|
if (u.semitoneIndex === c.semitoneIndex) return !0;
|
|
3127
|
-
await a(
|
|
3128
|
-
let d =
|
|
3157
|
+
await a(z.Edit), await o(l, 250);
|
|
3158
|
+
let d = Zt(u.semitoneIndex, c.semitoneIndex);
|
|
3129
3159
|
if (d.length > 0) {
|
|
3130
|
-
for (let e of d) i(e), await
|
|
3160
|
+
for (let e of d) i(e), await V(25);
|
|
3131
3161
|
await o(l, 280);
|
|
3132
3162
|
let e = W(t.get("textUnderCursor"));
|
|
3133
|
-
if (e?.semitoneIndex === c.semitoneIndex) return await a(
|
|
3163
|
+
if (e?.semitoneIndex === c.semitoneIndex) return await a(z.Edit), !0;
|
|
3134
3164
|
u = e ?? u;
|
|
3135
3165
|
}
|
|
3136
3166
|
let f = /* @__PURE__ */ new Set();
|
|
@@ -3139,13 +3169,13 @@ var Bt = (e) => {
|
|
|
3139
3169
|
for (; Date.now() - p < 7e3;) {
|
|
3140
3170
|
let e = c.semitoneIndex - u.semitoneIndex;
|
|
3141
3171
|
if (e === 0) break;
|
|
3142
|
-
let n = Math.abs(e) >= 12, r = e > 0, i = n ? r ?
|
|
3143
|
-
await a(
|
|
3172
|
+
let n = Math.abs(e) >= 12, r = e > 0, i = n ? r ? z.Up : z.Down : r ? z.Right : z.Left, s = n ? r ? z.Down : z.Up : r ? z.Left : z.Right, l = u, d = Math.abs(l.semitoneIndex - c.semitoneIndex), p = t.get("textUnderCursor");
|
|
3173
|
+
await a(z.Edit | i, 35), await o(p, 250);
|
|
3144
3174
|
let m = W(t.get("textUnderCursor"));
|
|
3145
3175
|
if (!m || m.label === l.label) break;
|
|
3146
3176
|
if (u = m, Math.abs(u.semitoneIndex - c.semitoneIndex) > d) {
|
|
3147
3177
|
let e = t.get("textUnderCursor");
|
|
3148
|
-
await a(
|
|
3178
|
+
await a(z.Edit | s, 35), await o(e, 250);
|
|
3149
3179
|
let n = W(t.get("textUnderCursor"));
|
|
3150
3180
|
n && (u = n);
|
|
3151
3181
|
break;
|
|
@@ -3153,28 +3183,28 @@ var Bt = (e) => {
|
|
|
3153
3183
|
if (f.has(u.label)) break;
|
|
3154
3184
|
f.add(u.label);
|
|
3155
3185
|
}
|
|
3156
|
-
return await a(
|
|
3186
|
+
return await a(z.Edit), W(t.get("textUnderCursor"))?.semitoneIndex === c.semitoneIndex;
|
|
3157
3187
|
},
|
|
3158
3188
|
setValueToString: async (e, i = !0, s = !1) => {
|
|
3159
3189
|
if (!r()) return !1;
|
|
3160
|
-
let c =
|
|
3190
|
+
let c = B(e);
|
|
3161
3191
|
if (!c) return !1;
|
|
3162
3192
|
let l = () => s ? t.get("currentLine") : t.get("textUnderCursor"), u = (e) => {
|
|
3163
|
-
let t =
|
|
3193
|
+
let t = B(e);
|
|
3164
3194
|
return t ? i ? t === c : t.includes(c) : !1;
|
|
3165
3195
|
};
|
|
3166
3196
|
if (u(l())) return !0;
|
|
3167
3197
|
let d = t.get("textUnderCursor");
|
|
3168
|
-
d?.trim() === "---" && (n("[M8SDK] Initial string value is \"---\", priming with edit key"), await a(
|
|
3198
|
+
d?.trim() === "---" && (n("[M8SDK] Initial string value is \"---\", priming with edit key"), await a(z.Edit), await o(d, 250));
|
|
3169
3199
|
let f = t.get("textUnderCursor");
|
|
3170
|
-
if (await a(
|
|
3200
|
+
if (await a(z.Edit), await o(f, 250), u(l())) return await a(z.Edit), !0;
|
|
3171
3201
|
let p = t.get("textUnderCursor"), m = 0, h = Date.now(), g = [];
|
|
3172
3202
|
for (let e = 0; e < 512; e++) {
|
|
3173
3203
|
if (Date.now() - h > 2e3) {
|
|
3174
3204
|
n("[M8SDK] Timeout reached while seeking bottom of list");
|
|
3175
3205
|
break;
|
|
3176
3206
|
}
|
|
3177
|
-
let t =
|
|
3207
|
+
let t = B(p);
|
|
3178
3208
|
if (t) {
|
|
3179
3209
|
if (e < 4) g.push(t);
|
|
3180
3210
|
else if (g.includes(t)) {
|
|
@@ -3183,26 +3213,26 @@ var Bt = (e) => {
|
|
|
3183
3213
|
}
|
|
3184
3214
|
}
|
|
3185
3215
|
let r = p;
|
|
3186
|
-
await a(
|
|
3216
|
+
await a(z.Edit | z.Down, 35);
|
|
3187
3217
|
let i = await o(r, 250);
|
|
3188
|
-
if (
|
|
3218
|
+
if (B(i) === B(p) ? m += 1 : (m = 0, p = i), m > 1) break;
|
|
3189
3219
|
}
|
|
3190
3220
|
let _ = /* @__PURE__ */ new Set();
|
|
3191
3221
|
for (let e = 0; e < 1024; e++) {
|
|
3192
3222
|
let e = l();
|
|
3193
|
-
if (u(e)) return await a(
|
|
3194
|
-
let n =
|
|
3223
|
+
if (u(e)) return await a(z.Edit), !0;
|
|
3224
|
+
let n = B(e);
|
|
3195
3225
|
if (n) {
|
|
3196
3226
|
if (_.has(n)) break;
|
|
3197
3227
|
_.add(n);
|
|
3198
3228
|
}
|
|
3199
3229
|
let r = t.get("textUnderCursor");
|
|
3200
|
-
if (await a(
|
|
3230
|
+
if (await a(z.Edit | z.Right, 35), B(await o(r, 250)) === n) break;
|
|
3201
3231
|
}
|
|
3202
|
-
return await a(
|
|
3232
|
+
return await a(z.Edit), !1;
|
|
3203
3233
|
}
|
|
3204
3234
|
};
|
|
3205
|
-
},
|
|
3235
|
+
}, $t = ({ bus: e, store: t, cancelOnKeydown: n = !1 }) => {
|
|
3206
3236
|
let r = [], i = null, a = !1, o = () => {
|
|
3207
3237
|
a && u("preempted by keyboard");
|
|
3208
3238
|
}, s = () => {
|
|
@@ -3250,7 +3280,7 @@ var Bt = (e) => {
|
|
|
3250
3280
|
r = [], i = null, c();
|
|
3251
3281
|
}
|
|
3252
3282
|
};
|
|
3253
|
-
},
|
|
3283
|
+
}, en = () => ({
|
|
3254
3284
|
viewName: null,
|
|
3255
3285
|
viewTitle: null,
|
|
3256
3286
|
minimapKey: null,
|
|
@@ -3273,9 +3303,9 @@ var Bt = (e) => {
|
|
|
3273
3303
|
},
|
|
3274
3304
|
systemInfo: null,
|
|
3275
3305
|
macroStatus: { running: !1 }
|
|
3276
|
-
}),
|
|
3306
|
+
}), tn = (e = {}) => {
|
|
3277
3307
|
let t = {
|
|
3278
|
-
...
|
|
3308
|
+
...en(),
|
|
3279
3309
|
...e
|
|
3280
3310
|
}, n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set();
|
|
3281
3311
|
return {
|
|
@@ -3298,8 +3328,8 @@ var Bt = (e) => {
|
|
|
3298
3328
|
}),
|
|
3299
3329
|
snapshot: () => ({ ...t })
|
|
3300
3330
|
};
|
|
3301
|
-
},
|
|
3302
|
-
function
|
|
3331
|
+
}, nn = () => 0, rn = () => 1;
|
|
3332
|
+
function an(e, t, n, r = nn, i = rn) {
|
|
3303
3333
|
let a = t.trim(), o = n.trim();
|
|
3304
3334
|
if (!e.has(a) || !e.has(o)) return null;
|
|
3305
3335
|
let s = /* @__PURE__ */ new Set([a]), c = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Map();
|
|
@@ -3344,29 +3374,29 @@ function en(e, t, n, r = Qt, i = $t) {
|
|
|
3344
3374
|
}
|
|
3345
3375
|
//#endregion
|
|
3346
3376
|
//#region src/engine/viewNavigation.ts
|
|
3347
|
-
var
|
|
3348
|
-
let n = !!t?.shift, r =
|
|
3349
|
-
up: (n ? r : 0) |
|
|
3350
|
-
down: (n ? r : 0) |
|
|
3351
|
-
left: (n ? r : 0) |
|
|
3352
|
-
right: (n ? r : 0) |
|
|
3377
|
+
var on = 20, sn = 700, cn = 80, ln = 4e3, un = 120, dn = (e, t) => {
|
|
3378
|
+
let n = !!t?.shift, r = z.Shift, i = {
|
|
3379
|
+
up: (n ? r : 0) | z.Up,
|
|
3380
|
+
down: (n ? r : 0) | z.Down,
|
|
3381
|
+
left: (n ? r : 0) | z.Left,
|
|
3382
|
+
right: (n ? r : 0) | z.Right
|
|
3353
3383
|
}, a = [];
|
|
3354
3384
|
n && a.push(r);
|
|
3355
3385
|
for (let t of e) a.push(i[t], n ? r : 0);
|
|
3356
3386
|
return a.push(0), a;
|
|
3357
|
-
},
|
|
3387
|
+
}, fn = (e) => [{
|
|
3358
3388
|
from: e,
|
|
3359
3389
|
to: "",
|
|
3360
3390
|
kind: "exit",
|
|
3361
|
-
keys: [
|
|
3391
|
+
keys: [z.Opt, 0]
|
|
3362
3392
|
}, {
|
|
3363
3393
|
from: e,
|
|
3364
3394
|
to: "",
|
|
3365
3395
|
kind: "shift",
|
|
3366
3396
|
dir: "up",
|
|
3367
|
-
keys: [
|
|
3368
|
-
}],
|
|
3369
|
-
let i =
|
|
3397
|
+
keys: [z.Shift | z.Up, 0]
|
|
3398
|
+
}], pn = (e) => `${e.kind}:${e.dir ?? ""}:${e.keys.join(",")}:${e.cursor ? `${e.cursor.x},${e.cursor.y}` : ""}`, mn = (e) => e[e.length - 1] === 0 ? e.slice() : [...e, 0], hn = "#goal", gn = (e, t) => `${e}<${t}`, _n = (e) => new Promise((t) => setTimeout(t, e)), vn = ({ store: e, runner: t, getScreenLines: n, moveCursor: r }) => {
|
|
3399
|
+
let i = Rt(), a = null, o = 0, s = null, c = 0, l = /* @__PURE__ */ new Map(), u = "", d = e.get("viewName") || "", f = e.sub("viewName", () => {
|
|
3370
3400
|
let t = e.get("viewName") || "";
|
|
3371
3401
|
t && t !== d && (d && (u = d), d = t);
|
|
3372
3402
|
}), p = null, m = null, h = () => {
|
|
@@ -3374,11 +3404,11 @@ var tn = 20, nn = 700, rn = 80, an = 4e3, on = 120, sn = (e, t) => {
|
|
|
3374
3404
|
}, g = (e) => {
|
|
3375
3405
|
let t = (e || "").toLowerCase().trim();
|
|
3376
3406
|
return i.has(t) || console.warn("Target not in viewlist", { goal: t }), t;
|
|
3377
|
-
}, _ = (e, t) => `${e.from}<${t}|${
|
|
3407
|
+
}, _ = (e, t) => `${e.from}<${t}|${pn(e)}`, v = (e, t) => {
|
|
3378
3408
|
let n = /* @__PURE__ */ new Map();
|
|
3379
|
-
for (let t of
|
|
3409
|
+
for (let t of Lt().graph.get(e) ?? []) {
|
|
3380
3410
|
if (t.kind === "button" && !r) continue;
|
|
3381
|
-
let e =
|
|
3411
|
+
let e = pn(t);
|
|
3382
3412
|
n.set(e, [...n.get(e) ?? [], t]);
|
|
3383
3413
|
}
|
|
3384
3414
|
let i = [];
|
|
@@ -3402,11 +3432,11 @@ var tn = 20, nn = 700, rn = 80, an = 4e3, on = 120, sn = (e, t) => {
|
|
|
3402
3432
|
}
|
|
3403
3433
|
return i;
|
|
3404
3434
|
}, y = (e, t, n) => {
|
|
3405
|
-
let r = /* @__PURE__ */ new Map([[
|
|
3406
|
-
for (r.set(
|
|
3407
|
-
let [e, t] = i.shift(), a = r.get(
|
|
3435
|
+
let r = /* @__PURE__ */ new Map([[hn, []]]), i = [[e, t]];
|
|
3436
|
+
for (r.set(gn(e, t), []); i.length;) {
|
|
3437
|
+
let [e, t] = i.shift(), a = r.get(gn(e, t));
|
|
3408
3438
|
if (e === n) a.push({
|
|
3409
|
-
to:
|
|
3439
|
+
to: hn,
|
|
3410
3440
|
weight: 0,
|
|
3411
3441
|
nav: {
|
|
3412
3442
|
from: e,
|
|
@@ -3416,7 +3446,7 @@ var tn = 20, nn = 700, rn = 80, an = 4e3, on = 120, sn = (e, t) => {
|
|
|
3416
3446
|
}
|
|
3417
3447
|
});
|
|
3418
3448
|
else for (let n of v(e, t)) {
|
|
3419
|
-
let t =
|
|
3449
|
+
let t = gn(n.to, e);
|
|
3420
3450
|
a.push({
|
|
3421
3451
|
to: t,
|
|
3422
3452
|
weight: n.weight,
|
|
@@ -3426,10 +3456,10 @@ var tn = 20, nn = 700, rn = 80, an = 4e3, on = 120, sn = (e, t) => {
|
|
|
3426
3456
|
}
|
|
3427
3457
|
return r;
|
|
3428
3458
|
}, b = (e, t) => {
|
|
3429
|
-
let n =
|
|
3459
|
+
let n = an(y(e, u, t), gn(e, u), hn);
|
|
3430
3460
|
if (n?.edges.length) return n.edges[0].nav;
|
|
3431
|
-
let r =
|
|
3432
|
-
return r.length && !r.some((e) => e.kind === "exit") ? null :
|
|
3461
|
+
let r = Lt().graph.get(e) ?? [];
|
|
3462
|
+
return r.length && !r.some((e) => e.kind === "exit") ? null : fn(e).find((e) => !l.has(_(e, u)) && !l.has(_(e, "*"))) ?? null;
|
|
3433
3463
|
}, x = (e) => {
|
|
3434
3464
|
let t = e.cursor;
|
|
3435
3465
|
if (!e.label || !n) return t;
|
|
@@ -3474,12 +3504,12 @@ var tn = 20, nn = 700, rn = 80, an = 4e3, on = 120, sn = (e, t) => {
|
|
|
3474
3504
|
}), E();
|
|
3475
3505
|
}, T = async (n, i) => {
|
|
3476
3506
|
let a = x(n.edge);
|
|
3477
|
-
S(a) || (await Promise.race([r(a.x, a.y),
|
|
3507
|
+
S(a) || (await Promise.race([r(a.x, a.y), _n(ln)]), await _n(un)), i === c && p === n && (e.get("viewName") !== n.from || !S(a) ? (console.warn("Navigation: button not reached", {
|
|
3478
3508
|
from: n.from,
|
|
3479
3509
|
to: n.edge.to,
|
|
3480
3510
|
cell: a,
|
|
3481
3511
|
cursor: e.get("cursorPos")
|
|
3482
|
-
}), w(e.get("viewName") === n.from ? n.from : e.get("viewName") || "")) : (n.phase = "keys", t.cancel("navigation button"), t.start(
|
|
3512
|
+
}), w(e.get("viewName") === n.from ? n.from : e.get("viewName") || "")) : (n.phase = "keys", t.cancel("navigation button"), t.start(mn(n.edge.keys))));
|
|
3483
3513
|
}, E = () => {
|
|
3484
3514
|
let n = a, r = e.get("viewName") || "";
|
|
3485
3515
|
if (!n) return;
|
|
@@ -3494,7 +3524,7 @@ var tn = 20, nn = 700, rn = 80, an = 4e3, on = 120, sn = (e, t) => {
|
|
|
3494
3524
|
}), C(!0);
|
|
3495
3525
|
return;
|
|
3496
3526
|
}
|
|
3497
|
-
if (o >=
|
|
3527
|
+
if (o >= on) {
|
|
3498
3528
|
console.warn("Navigation aborted: max steps reached", {
|
|
3499
3529
|
startTitle: r,
|
|
3500
3530
|
goalTitle: n,
|
|
@@ -3529,14 +3559,14 @@ var tn = 20, nn = 700, rn = 80, an = 4e3, on = 120, sn = (e, t) => {
|
|
|
3529
3559
|
T(s, c);
|
|
3530
3560
|
return;
|
|
3531
3561
|
}
|
|
3532
|
-
let l = i.keys.length ?
|
|
3562
|
+
let l = i.keys.length ? mn(i.keys) : dn([i.dir], { shift: !0 });
|
|
3533
3563
|
t.cancel("iterative navigation step"), t.start(l);
|
|
3534
3564
|
}, D = () => {
|
|
3535
3565
|
if (p?.phase !== "keys") return;
|
|
3536
3566
|
let n = e.get("macroStatus").running, r = e.get("viewName") || "", i = !!r && r !== p.from;
|
|
3537
3567
|
(!n || i) && (h(), m = n ? setTimeout(() => {
|
|
3538
3568
|
t.cancel("navigation: no release echo"), t.start([0]), w(e.get("viewName") || "");
|
|
3539
|
-
},
|
|
3569
|
+
}, sn) : setTimeout(() => w(e.get("viewName") || ""), i ? cn : sn));
|
|
3540
3570
|
}, O = e.sub("viewName", D), k = e.sub("macroStatus", D);
|
|
3541
3571
|
return {
|
|
3542
3572
|
navigateToView: (t) => new Promise((n) => {
|
|
@@ -3550,7 +3580,7 @@ var tn = 20, nn = 700, rn = 80, an = 4e3, on = 120, sn = (e, t) => {
|
|
|
3550
3580
|
f(), O(), k(), c += 1, C(!1);
|
|
3551
3581
|
}
|
|
3552
3582
|
};
|
|
3553
|
-
},
|
|
3583
|
+
}, yn = /* @__PURE__ */ new Set([
|
|
3554
3584
|
"macroStatus",
|
|
3555
3585
|
"deviceModel",
|
|
3556
3586
|
"fontMode",
|
|
@@ -3558,35 +3588,35 @@ var tn = 20, nn = 700, rn = 80, an = 4e3, on = 120, sn = (e, t) => {
|
|
|
3558
3588
|
"titleColor",
|
|
3559
3589
|
"backgroundColor",
|
|
3560
3590
|
"minimapKey"
|
|
3561
|
-
]),
|
|
3562
|
-
let n = t.store ??
|
|
3591
|
+
]), bn = (e, t = {}) => {
|
|
3592
|
+
let n = t.store ?? tn(), r = (...e) => {
|
|
3563
3593
|
t.debug && console.log(...e);
|
|
3564
3594
|
}, i = /* @__PURE__ */ new Map(), a = (e, t) => {
|
|
3565
3595
|
for (let n of [...i.get(e) ?? []]) n(t);
|
|
3566
|
-
}, o =
|
|
3596
|
+
}, o = Ut(e.protocol.eventBus, n), s = $t({
|
|
3567
3597
|
bus: e,
|
|
3568
3598
|
store: n,
|
|
3569
3599
|
cancelOnKeydown: t.cancelMacroOnKeydown
|
|
3570
|
-
}), c =
|
|
3600
|
+
}), c = Qe({
|
|
3571
3601
|
bus: e,
|
|
3572
3602
|
store: n,
|
|
3573
3603
|
getScreenLines: o.getScreenLines,
|
|
3574
|
-
cursorMap: t.cursorMap ??
|
|
3575
|
-
}), l =
|
|
3604
|
+
cursorMap: t.cursorMap ?? ae()
|
|
3605
|
+
}), l = vn({
|
|
3576
3606
|
store: n,
|
|
3577
3607
|
runner: s,
|
|
3578
3608
|
getScreenLines: o.getScreenLines,
|
|
3579
|
-
moveCursor: (e, t) => c.navigateTo(
|
|
3580
|
-
}), u =
|
|
3609
|
+
moveCursor: (e, t) => c.navigateTo(Gt(n, e, t))
|
|
3610
|
+
}), u = Yt((e) => a("transport", e)), d = mt({
|
|
3581
3611
|
getKeySink: () => e.commands,
|
|
3582
3612
|
store: n,
|
|
3583
3613
|
debugLog: r,
|
|
3584
3614
|
getScreenLines: o.getScreenLines
|
|
3585
|
-
}), f =
|
|
3615
|
+
}), f = qt({
|
|
3586
3616
|
io: d,
|
|
3587
|
-
editors:
|
|
3588
|
-
setValueFloat:
|
|
3589
|
-
browseFile:
|
|
3617
|
+
editors: Qt(d),
|
|
3618
|
+
setValueFloat: jt(d),
|
|
3619
|
+
browseFile: xt(d),
|
|
3590
3620
|
navigateToView: (e) => l.navigateToView(e),
|
|
3591
3621
|
navigateTo: (e) => c.navigateTo(e),
|
|
3592
3622
|
enableMidiTransport: () => u.enable(),
|
|
@@ -3616,7 +3646,7 @@ var tn = 20, nn = 700, rn = 80, an = 4e3, on = 120, sn = (e, t) => {
|
|
|
3616
3646
|
};
|
|
3617
3647
|
(!_ || _.textUnderCursor !== e.textUnderCursor || _.currentLine !== e.currentLine) && (_ = e, r("[M8SDK] Text updated:", e.textUnderCursor, e.currentLine), a("textUpdated", e));
|
|
3618
3648
|
}
|
|
3619
|
-
[...e].some((e) =>
|
|
3649
|
+
[...e].some((e) => yn.has(e)) && a("stateChanged", Wt(n));
|
|
3620
3650
|
}, y = n.subAll((e) => {
|
|
3621
3651
|
p.add(e), m || (m = !0, queueMicrotask(v));
|
|
3622
3652
|
}), b = (e) => {
|
|
@@ -3629,7 +3659,7 @@ var tn = 20, nn = 700, rn = 80, an = 4e3, on = 120, sn = (e, t) => {
|
|
|
3629
3659
|
macro: s,
|
|
3630
3660
|
navigateTo: (e) => c.navigateTo(e),
|
|
3631
3661
|
navigateToView: (e) => l.navigateToView(e),
|
|
3632
|
-
getState: () =>
|
|
3662
|
+
getState: () => Wt(n),
|
|
3633
3663
|
getScreenLines: o.getScreenLines,
|
|
3634
3664
|
getScreenCellColors: o.getScreenCellColors,
|
|
3635
3665
|
on: (e, t) => {
|
|
@@ -3642,7 +3672,7 @@ var tn = 20, nn = 700, rn = 80, an = 4e3, on = 120, sn = (e, t) => {
|
|
|
3642
3672
|
e.protocol.eventBus.off("key", b), y(), l.dispose(), c.dispose(), s.dispose(), u.disable(), o.dispose(), i.clear();
|
|
3643
3673
|
}
|
|
3644
3674
|
};
|
|
3645
|
-
},
|
|
3675
|
+
}, xn = {
|
|
3646
3676
|
version: "1.0",
|
|
3647
3677
|
description: "Layouts of the non-grid ('parameter') views: which text at which column is an instrument type, name, parameter, option or action. Column positions were measured on the manual's screenshots (font mode 0, 40 columns) and cross-checked with the phrase view grid; descriptions come from the manual.",
|
|
3648
3678
|
notes: {
|
|
@@ -3662,23 +3692,23 @@ var tn = 20, nn = 700, rn = 80, an = 4e3, on = 120, sn = (e, t) => {
|
|
|
3662
3692
|
EXTERN: "external",
|
|
3663
3693
|
MIDI: "midiout"
|
|
3664
3694
|
}
|
|
3665
|
-
},
|
|
3666
|
-
for (let [e, t] of Object.entries(
|
|
3695
|
+
}, Sn = xn.views, Cn = xn.instrumentTypes, wn = xn.instrumentTypeNames, Tn = {};
|
|
3696
|
+
for (let [e, t] of Object.entries(Sn)) {
|
|
3667
3697
|
let { extends: n, ...r } = t;
|
|
3668
|
-
|
|
3669
|
-
...
|
|
3698
|
+
Tn[e] = n ? {
|
|
3699
|
+
...Sn[n],
|
|
3670
3700
|
...r
|
|
3671
3701
|
} : r;
|
|
3672
3702
|
}
|
|
3673
|
-
function
|
|
3674
|
-
return
|
|
3703
|
+
function En(e) {
|
|
3704
|
+
return Tn[e] ?? null;
|
|
3675
3705
|
}
|
|
3676
3706
|
var G = (e, t, n) => t >= e.length ? "" : e.slice(t, t + n);
|
|
3677
|
-
function
|
|
3707
|
+
function Dn(e, t) {
|
|
3678
3708
|
let n = e.width ?? e.text?.length ?? 1, r = G(t, e.x, n);
|
|
3679
3709
|
return e.text == null ? e.regex != null && new RegExp(e.regex, "i").test(r) : r.toUpperCase() === e.text.toUpperCase();
|
|
3680
3710
|
}
|
|
3681
|
-
function
|
|
3711
|
+
function On(e, t) {
|
|
3682
3712
|
let n = e.sections;
|
|
3683
3713
|
if (!n) return null;
|
|
3684
3714
|
for (let e of t) {
|
|
@@ -3687,7 +3717,7 @@ function wn(e, t) {
|
|
|
3687
3717
|
}
|
|
3688
3718
|
return null;
|
|
3689
3719
|
}
|
|
3690
|
-
function
|
|
3720
|
+
function kn(e, t, n) {
|
|
3691
3721
|
let r = e.zones?.find((e) => e.id === t);
|
|
3692
3722
|
if (!e.slotLabel || !r) return null;
|
|
3693
3723
|
let i = RegExp(`^${e.slotLabel}$`, "i");
|
|
@@ -3697,46 +3727,46 @@ function Tn(e, t, n) {
|
|
|
3697
3727
|
}
|
|
3698
3728
|
return null;
|
|
3699
3729
|
}
|
|
3700
|
-
function
|
|
3730
|
+
function An(e) {
|
|
3701
3731
|
let t = e.toUpperCase().replace(/[^A-Z]/g, "");
|
|
3702
3732
|
if (!t) return null;
|
|
3703
|
-
let n = Object.keys(
|
|
3704
|
-
return n ?
|
|
3733
|
+
let n = Object.keys(wn).find((e) => t.startsWith(e));
|
|
3734
|
+
return n ? wn[n] : null;
|
|
3705
3735
|
}
|
|
3706
|
-
function
|
|
3736
|
+
function jn(e) {
|
|
3707
3737
|
for (let t of e) if (t.toUpperCase().startsWith("TYPE")) {
|
|
3708
3738
|
let e = G(t, 8, 13).trim();
|
|
3709
3739
|
return e ? {
|
|
3710
3740
|
text: e,
|
|
3711
|
-
key:
|
|
3741
|
+
key: An(e)
|
|
3712
3742
|
} : null;
|
|
3713
3743
|
}
|
|
3714
3744
|
return null;
|
|
3715
3745
|
}
|
|
3716
|
-
function
|
|
3717
|
-
let t =
|
|
3746
|
+
function Mn(e) {
|
|
3747
|
+
let t = Cn[e];
|
|
3718
3748
|
return t ? {
|
|
3719
3749
|
name: t.name,
|
|
3720
3750
|
description: t.description
|
|
3721
3751
|
} : null;
|
|
3722
3752
|
}
|
|
3723
|
-
function
|
|
3753
|
+
function Nn(e, t, n) {
|
|
3724
3754
|
let r = t.replace(/^MOD\d$/, "MOD#").replace(/^CC[A-J]$/, "CC#");
|
|
3725
3755
|
if (e.vocabulary) return e.vocabulary[r] ?? null;
|
|
3726
3756
|
if (e.vocabularyFrom !== "instrumentTypes") return null;
|
|
3727
|
-
let i = n ? [n, "common"] : ["common", ...Object.keys(
|
|
3757
|
+
let i = n ? [n, "common"] : ["common", ...Object.keys(Cn).filter((e) => e !== "common")];
|
|
3728
3758
|
for (let e of i) {
|
|
3729
|
-
let t =
|
|
3759
|
+
let t = Cn[e]?.params[r];
|
|
3730
3760
|
if (t) return t;
|
|
3731
3761
|
}
|
|
3732
3762
|
return null;
|
|
3733
3763
|
}
|
|
3734
|
-
var
|
|
3764
|
+
var Pn = (e) => e.toLowerCase().replace(/[^a-z0-9]+(.)?/g, (e, t) => t ? t.toUpperCase() : "").replace(/^[^a-z]+/, ""), Fn = /^[A-Z][A-Z0-9.:#/ -]*$/, In = {
|
|
3735
3765
|
RATIO: "ratio",
|
|
3736
3766
|
"LEV/FB": "levFb",
|
|
3737
3767
|
MOD: "mod"
|
|
3738
|
-
},
|
|
3739
|
-
function
|
|
3768
|
+
}, Ln = /^(?:-----|[1-4]>[A-Z]{3})$/i;
|
|
3769
|
+
function Rn(e, t, n) {
|
|
3740
3770
|
let r = G(t, 0, e.x).trim().toUpperCase(), i = e.letters.map((t, n) => ({
|
|
3741
3771
|
letter: t,
|
|
3742
3772
|
x: e.x + n * e.step
|
|
@@ -3750,10 +3780,10 @@ function Pn(e, t, n) {
|
|
|
3750
3780
|
paramLabel: r || e,
|
|
3751
3781
|
operator: a
|
|
3752
3782
|
}
|
|
3753
|
-
}), o =
|
|
3783
|
+
}), o = In[r];
|
|
3754
3784
|
if (o) {
|
|
3755
3785
|
let t = n.params[r];
|
|
3756
|
-
return t ? i.map(({ letter: i, x: s }) => a(o, s, e.width, r === "MOD" ?
|
|
3786
|
+
return t ? i.map(({ letter: i, x: s }) => a(o, s, e.width, r === "MOD" ? zn(t, 1, n) : t, i)) : null;
|
|
3757
3787
|
}
|
|
3758
3788
|
if (r) return null;
|
|
3759
3789
|
if (/^\s+[A-D] \S/i.test(t)) {
|
|
@@ -3777,9 +3807,9 @@ function Pn(e, t, n) {
|
|
|
3777
3807
|
return r.length ? r : null;
|
|
3778
3808
|
}
|
|
3779
3809
|
let s = i.map(({ x: n }) => G(t, n, e.width).trim()), c = n.params.MOD;
|
|
3780
|
-
return c && s.every((e) =>
|
|
3810
|
+
return c && s.every((e) => Ln.test(e)) && !G(t, 0, e.x).trim() ? i.map(({ letter: t, x: r }) => a("mod2", r, e.width, zn(c, 2, n), t)) : null;
|
|
3781
3811
|
}
|
|
3782
|
-
function
|
|
3812
|
+
function zn(e, t, n) {
|
|
3783
3813
|
let r = {};
|
|
3784
3814
|
for (let [e, t] of Object.entries(n.operatorDestinations ?? {})) for (let n = 1; n <= 4; n += 1) r[`${n}>${e}`] = `MOD${n} ${e}: ${t}`;
|
|
3785
3815
|
return {
|
|
@@ -3790,8 +3820,8 @@ function Fn(e, t, n) {
|
|
|
3790
3820
|
options: r
|
|
3791
3821
|
};
|
|
3792
3822
|
}
|
|
3793
|
-
var
|
|
3794
|
-
function
|
|
3823
|
+
var Bn = /^(CC[A-J])(?: CC:VAL)? +(?=\S)/i, Vn = 6;
|
|
3824
|
+
function Hn(e, t, n) {
|
|
3795
3825
|
if (e.kind === "browser") {
|
|
3796
3826
|
let r = n.entryText?.trim() || t.trim();
|
|
3797
3827
|
return r ? {
|
|
@@ -3829,12 +3859,12 @@ function Rn(e, t, n) {
|
|
|
3829
3859
|
}]
|
|
3830
3860
|
};
|
|
3831
3861
|
}
|
|
3832
|
-
for (let r of e.rows ?? []) if (!(r.section && n.section && r.section !== n.section) && r.match.every((e) =>
|
|
3862
|
+
for (let r of e.rows ?? []) if (!(r.section && n.section && r.section !== n.section) && r.match.every((e) => Dn(e, t))) return {
|
|
3833
3863
|
rowId: r.id,
|
|
3834
3864
|
cells: r.cells
|
|
3835
3865
|
};
|
|
3836
3866
|
if (e.operators && n.instrumentKey === e.operators.instrument) {
|
|
3837
|
-
let n =
|
|
3867
|
+
let n = Rn(e.operators, t, Cn[e.operators.instrument]);
|
|
3838
3868
|
if (n) return {
|
|
3839
3869
|
rowId: "operators",
|
|
3840
3870
|
cells: n
|
|
@@ -3842,11 +3872,11 @@ function Rn(e, t, n) {
|
|
|
3842
3872
|
}
|
|
3843
3873
|
let r = e.zones ?? [], i = [];
|
|
3844
3874
|
return r.forEach((a, o) => {
|
|
3845
|
-
let s = G(t, a.labelX, a.labelWidth).trim().toUpperCase(), c = a.x, l = null, u = o === 0 ?
|
|
3846
|
-
if (u && (s = u[1].toUpperCase(), c = u[0].length, l =
|
|
3847
|
-
let d = r[o + 1], f = d != null && G(t, d.labelX - 1, 1).trim() === "" &&
|
|
3875
|
+
let s = G(t, a.labelX, a.labelWidth).trim().toUpperCase(), c = a.x, l = null, u = o === 0 ? Bn.exec(t) : null;
|
|
3876
|
+
if (u && (s = u[1].toUpperCase(), c = u[0].length, l = Vn), !Fn.test(s)) return;
|
|
3877
|
+
let d = r[o + 1], f = d != null && G(t, d.labelX - 1, 1).trim() === "" && Fn.test(G(t, d.labelX, d.labelWidth).trim().toUpperCase()), p = l ?? (d && f ? Math.max(1, d.labelX - 1 - c) : a.width);
|
|
3848
3878
|
if (!G(t, c, p).trim()) return;
|
|
3849
|
-
let m =
|
|
3879
|
+
let m = Nn(e, s, n.instrumentKey), h = Pn(s) || a.id, g = i.some((e) => e.key === h) ? `${h}${a.id[0].toUpperCase()}${a.id.slice(1)}` : h;
|
|
3850
3880
|
i.push({
|
|
3851
3881
|
x: c,
|
|
3852
3882
|
width: p,
|
|
@@ -3874,13 +3904,13 @@ var K = {
|
|
|
3874
3904
|
values: null,
|
|
3875
3905
|
text: null
|
|
3876
3906
|
};
|
|
3877
|
-
function
|
|
3907
|
+
function Un(e) {
|
|
3878
3908
|
return /^[0-9A-F]{2}$/i.test(e) ? "hex" : /^[0-9A-F]{2}:[0-9A-F]{2}$/i.test(e) ? "hexPair" : /^[+-]?\d+([.,]\d+)?$/.test(e) ? "float" : /^[0-9A-F]{2}\S/i.test(e) ? "hexOption" : "text";
|
|
3879
3909
|
}
|
|
3880
|
-
function
|
|
3910
|
+
function Wn(e, t) {
|
|
3881
3911
|
let n = e.trim();
|
|
3882
3912
|
if (!n) return K;
|
|
3883
|
-
switch (t === "auto" ?
|
|
3913
|
+
switch (t === "auto" ? Un(n) : t) {
|
|
3884
3914
|
case "hex": {
|
|
3885
3915
|
let e = /^([0-9A-F]{2})/i.exec(n), t = e ? parseInt(e[1], 16) : null;
|
|
3886
3916
|
return {
|
|
@@ -3962,7 +3992,7 @@ function Bn(e, t) {
|
|
|
3962
3992
|
};
|
|
3963
3993
|
}
|
|
3964
3994
|
}
|
|
3965
|
-
function
|
|
3995
|
+
function Gn(e, t) {
|
|
3966
3996
|
if (!e || !t) return null;
|
|
3967
3997
|
let n = t.toUpperCase().trim();
|
|
3968
3998
|
if (e[n]) return e[n];
|
|
@@ -3971,28 +4001,28 @@ function Vn(e, t) {
|
|
|
3971
4001
|
}
|
|
3972
4002
|
//#endregion
|
|
3973
4003
|
//#region src/fxCommands.ts
|
|
3974
|
-
var
|
|
3975
|
-
function
|
|
3976
|
-
let t =
|
|
3977
|
-
return t.length === 0 || t.length ===
|
|
4004
|
+
var Kn = L.fxCommands, qn = L.instrumentFx.types, Jn = Object.entries(qn).filter(([, e]) => e.verified).map(([e]) => e);
|
|
4005
|
+
function Yn(e) {
|
|
4006
|
+
let t = Jn.filter((t) => qn[t].commands.includes(e));
|
|
4007
|
+
return t.length === 0 || t.length === Jn.length ? null : t;
|
|
3978
4008
|
}
|
|
3979
|
-
function
|
|
4009
|
+
function Xn(e) {
|
|
3980
4010
|
let t = e.toUpperCase();
|
|
3981
4011
|
for (let e of [
|
|
3982
4012
|
"sequencer",
|
|
3983
4013
|
"instrument",
|
|
3984
4014
|
"mixer"
|
|
3985
4015
|
]) {
|
|
3986
|
-
let n =
|
|
4016
|
+
let n = Kn[e][t];
|
|
3987
4017
|
if (n) return {
|
|
3988
4018
|
description: n.description,
|
|
3989
4019
|
category: e,
|
|
3990
4020
|
relative: n.relative === !0,
|
|
3991
|
-
instrumentTypes: e === "instrument" ?
|
|
4021
|
+
instrumentTypes: e === "instrument" ? Yn(t) : null,
|
|
3992
4022
|
slot: null
|
|
3993
4023
|
};
|
|
3994
4024
|
}
|
|
3995
|
-
let n = /^([A-Z]{2})([1-4])$/.exec(t), r = n ?
|
|
4025
|
+
let n = /^([A-Z]{2})([1-4])$/.exec(t), r = n ? Kn.modulation[n[1]] : void 0;
|
|
3996
4026
|
if (n && r) return {
|
|
3997
4027
|
description: r.description.replace("modulator N", `modulator ${n[2]}`),
|
|
3998
4028
|
category: "modulation",
|
|
@@ -4002,24 +4032,24 @@ function Kn(e) {
|
|
|
4002
4032
|
};
|
|
4003
4033
|
}
|
|
4004
4034
|
function q(e) {
|
|
4005
|
-
return
|
|
4035
|
+
return Xn(e)?.relative === !0;
|
|
4006
4036
|
}
|
|
4007
|
-
function
|
|
4008
|
-
let t =
|
|
4037
|
+
function Zn(e) {
|
|
4038
|
+
let t = qn[e.toLowerCase()];
|
|
4009
4039
|
return t ? {
|
|
4010
4040
|
type: e.toLowerCase(),
|
|
4011
4041
|
verified: t.verified,
|
|
4012
4042
|
commands: [...t.commands]
|
|
4013
4043
|
} : null;
|
|
4014
4044
|
}
|
|
4015
|
-
var
|
|
4016
|
-
function
|
|
4045
|
+
var Qn = L.instrumentFx.relativeCommands.description, J = (e) => e.toString(16).toUpperCase().padStart(2, "0"), Y = (e) => e.toString(16).toUpperCase(), $n = (e) => e === 1 ? "once" : e === 2 ? "twice" : `${e} times`, X = (e) => e > 127 ? e - 256 : e, er = (e) => `${e > 0 ? "+" : e < 0 ? "−" : "±"}${Math.abs(e)}`;
|
|
4046
|
+
function tr(e, t) {
|
|
4017
4047
|
return q(e) && t > 127 ? `${J(t)} (${X(t)})` : J(t);
|
|
4018
4048
|
}
|
|
4019
|
-
function
|
|
4049
|
+
function nr(e) {
|
|
4020
4050
|
return e > 127 ? `−${J(256 - e)}` : `+${J(e)}`;
|
|
4021
4051
|
}
|
|
4022
|
-
var
|
|
4052
|
+
var rr = [
|
|
4023
4053
|
"C-",
|
|
4024
4054
|
"C#",
|
|
4025
4055
|
"D-",
|
|
@@ -4033,16 +4063,16 @@ var $n = [
|
|
|
4033
4063
|
"A#",
|
|
4034
4064
|
"B-"
|
|
4035
4065
|
];
|
|
4036
|
-
function
|
|
4066
|
+
function ir(e) {
|
|
4037
4067
|
let t = /^([A-G])([#-])(\d)$/.exec((e ?? "").trim().toUpperCase());
|
|
4038
4068
|
if (!t) return null;
|
|
4039
|
-
let n =
|
|
4069
|
+
let n = rr.indexOf(`${t[1]}${t[2]}`);
|
|
4040
4070
|
return n < 0 ? null : Number(t[3]) * 12 + n;
|
|
4041
4071
|
}
|
|
4042
|
-
function
|
|
4043
|
-
return `${
|
|
4072
|
+
function ar(e) {
|
|
4073
|
+
return `${rr[(e % 12 + 12) % 12]}${Math.floor(e / 12)}`;
|
|
4044
4074
|
}
|
|
4045
|
-
var
|
|
4075
|
+
var or = [
|
|
4046
4076
|
"C",
|
|
4047
4077
|
"C#",
|
|
4048
4078
|
"D",
|
|
@@ -4055,14 +4085,14 @@ var nr = [
|
|
|
4055
4085
|
"A",
|
|
4056
4086
|
"A#",
|
|
4057
4087
|
"B"
|
|
4058
|
-
],
|
|
4059
|
-
function
|
|
4060
|
-
return e ===
|
|
4088
|
+
], sr = 6;
|
|
4089
|
+
function cr(e) {
|
|
4090
|
+
return e === sr ? "one row per step" : sr % e === 0 ? `${sr / e} rows per step` : e % sr === 0 ? `one row every ${e / sr} steps` : "";
|
|
4061
4091
|
}
|
|
4062
|
-
function
|
|
4092
|
+
function lr(e, t) {
|
|
4063
4093
|
if (e === 0) return `${t} moves one row each time the instrument is triggered`;
|
|
4064
4094
|
if (e <= 251) {
|
|
4065
|
-
let n =
|
|
4095
|
+
let n = cr(e);
|
|
4066
4096
|
return `${t} moves one row every ${e} tick${e === 1 ? "" : "s"}${n ? ` (${n})` : ""}`;
|
|
4067
4097
|
}
|
|
4068
4098
|
return [
|
|
@@ -4072,12 +4102,12 @@ function ar(e, t) {
|
|
|
4072
4102
|
`${t} moves one row every 5 ms (200 Hz)`
|
|
4073
4103
|
][e - 252] ?? null;
|
|
4074
4104
|
}
|
|
4075
|
-
function
|
|
4105
|
+
function ur(e, t, n = {}) {
|
|
4076
4106
|
let r = e.toUpperCase(), i = t >> 4, a = t & 15, o = (e) => `${e} tick${e === 1 ? "" : "s"}`;
|
|
4077
4107
|
switch (r) {
|
|
4078
4108
|
case "ARP": {
|
|
4079
|
-
let e =
|
|
4080
|
-
return e == null ? `plays the note, then ${t}` : `${t}: ${
|
|
4109
|
+
let e = ir(n.note), t = `+${i} and +${a} semitones`;
|
|
4110
|
+
return e == null ? `plays the note, then ${t}` : `${t}: ${ar(e)} ${ar(e + i)} ${ar(e + a)}`;
|
|
4081
4111
|
}
|
|
4082
4112
|
case "ARC": return `arp mode ${i}, speed ${o(a)}`;
|
|
4083
4113
|
case "CHA": return n.inTable ? `everything left of it plays with probability ${t}/255 (00 never, FF always)` : `${i}/15 chance for what is left of it, ${a}/15 for what is right (0 never, F always)`;
|
|
@@ -4091,7 +4121,7 @@ function or(e, t, n = {}) {
|
|
|
4091
4121
|
case "TBL": return `instrument uses table ${J(t)}`;
|
|
4092
4122
|
case "TBX": return t === 0 ? "stops the auxiliary table" : `plays table ${J(t)} alongside the instrument table`;
|
|
4093
4123
|
case "THO": return n.inTable ? `every column of the table jumps to row ${Y(a)}` : `the instrument's table jumps to row ${Y(a)} (the aux table when a TBX is on this step)`;
|
|
4094
|
-
case "HOP": return n.inTable ? a === n.row ? i === 0 ? `this column stops on row ${Y(a)}` : `holds this column on row ${Y(a)} ${
|
|
4124
|
+
case "HOP": return n.inTable ? a === n.row ? i === 0 ? `this column stops on row ${Y(a)}` : `holds this column on row ${Y(a)} ${$n(i)}` : i === 0 ? `always jumps back to row ${Y(a)}: the rows in between loop` : `jumps to row ${Y(a)} ${$n(i)}, then the column runs on past it` : t === 255 ? "stops this track" : `jumps to row ${Y(a)} of the next phrase`;
|
|
4095
4125
|
case "REP": return !n.inTable || t === 0 ? null : `plays the command above it ${t} more time${t === 1 ? "" : "s"}, one row each`;
|
|
4096
4126
|
case "RTO": return n.inTable ? `repeats the relative command above it until it has added ${t > 127 ? `${J(t)} (${X(t)})` : J(t)} in total` : null;
|
|
4097
4127
|
case "RMX": return `tracks to its left (selection ${Y(i)}) jump to phrase row ${Y(a)}`;
|
|
@@ -4103,47 +4133,47 @@ function or(e, t, n = {}) {
|
|
|
4103
4133
|
case "PBN": return t < 128 ? `pitch slides up by ${t}` : `pitch slides down by ${256 - t}`;
|
|
4104
4134
|
case "SCA":
|
|
4105
4135
|
case "SCG": {
|
|
4106
|
-
let e =
|
|
4136
|
+
let e = or[i];
|
|
4107
4137
|
return `${r === "SCA" ? "track" : "song"} scale ${a.toString(16).toUpperCase()}${e ? `, key ${e}` : ""}`;
|
|
4108
4138
|
}
|
|
4109
|
-
case "SNG": return `moves the song position by ${
|
|
4139
|
+
case "SNG": return `moves the song position by ${er(X(t))} row(s)`;
|
|
4110
4140
|
case "SED": return `random seed ${J(t)}`;
|
|
4111
4141
|
case "NXT": return `plays instrument ${J(t)} on the next track`;
|
|
4112
4142
|
case "MTT": {
|
|
4113
4143
|
if (n.inTable) return "no effect in a table";
|
|
4114
4144
|
let e = X(t);
|
|
4115
|
-
return e < 0 && n.row === 0 ? "no effect: a row cannot be moved earlier on the first step" : e === 0 ? "no timing shift" : `shifts the row by ${
|
|
4145
|
+
return e < 0 && n.row === 0 ? "no effect: a row cannot be moved earlier on the first step" : e === 0 ? "no timing shift" : `shifts the row by ${er(e)}/8 tick`;
|
|
4116
4146
|
}
|
|
4117
4147
|
case "TPO": return `${t} BPM`;
|
|
4118
|
-
case "TSP": return `transposes the song by ${
|
|
4119
|
-
case "TIC": return
|
|
4148
|
+
case "TSP": return `transposes the song by ${er(X(t))} semitones`;
|
|
4149
|
+
case "TIC": return lr(t, n.inTable ? "this column" : "the instrument's table");
|
|
4120
4150
|
case "XRZ": return t > 0 ? "reverb freeze on" : "reverb freeze off";
|
|
4121
4151
|
}
|
|
4122
4152
|
if (q(r)) {
|
|
4123
4153
|
let e = X(t);
|
|
4124
|
-
return r === "PIT" ? e === 0 ? "no change" : `${
|
|
4154
|
+
return r === "PIT" ? e === 0 ? "no change" : `${er(e)} semitones` : e === 0 ? "no change" : er(e);
|
|
4125
4155
|
}
|
|
4126
4156
|
return null;
|
|
4127
4157
|
}
|
|
4128
|
-
function
|
|
4158
|
+
function dr(e, t, n) {
|
|
4129
4159
|
let r = e + t & 255;
|
|
4130
4160
|
return n != null && (t < 128 ? r < e || r > n : r > e || r < n) && (r = n), {
|
|
4131
4161
|
value: r,
|
|
4132
4162
|
atLimit: n != null && r === n
|
|
4133
4163
|
};
|
|
4134
4164
|
}
|
|
4135
|
-
function
|
|
4165
|
+
function fr(e, t, n, r = !1) {
|
|
4136
4166
|
let i = null, a = null, o = null, s = null, c = r, l = !1, u = null, d = "none", f = Math.min(n, e.length - 1);
|
|
4137
4167
|
for (let n = 0; n <= f; n += 1) {
|
|
4138
4168
|
let f = e[n].fields[`fx${t}cmd`], p = e[n].fields[`fx${t}val`];
|
|
4139
4169
|
if (d = "none", f && !f.isEmpty) {
|
|
4140
4170
|
let e = f.rawValue.toUpperCase(), t = p && !p.isEmpty ? p.hexValue : null;
|
|
4141
|
-
e === "REP" ? t ? !i && !r ? d = "orphan" : (d = c ? "repChange" : "rep", c || (u = n), c = !0, o = t, a != null && ({value: a, atLimit: l} =
|
|
4171
|
+
e === "REP" ? t ? !i && !r ? d = "orphan" : (d = c ? "repChange" : "rep", c || (u = n), c = !0, o = t, a != null && ({value: a, atLimit: l} = dr(a, o, s))) : (d = "repStop", c = !1, o = null, l = !1) : e === "RTO" ? (d = "rto", s = t) : (d = c ? "replace" : "set", i = {
|
|
4142
4172
|
cmd: e,
|
|
4143
4173
|
value: t,
|
|
4144
4174
|
step: n
|
|
4145
4175
|
}, a = t, c = !1, o = null, s = null, l = !1, u = null);
|
|
4146
|
-
} else c && (d = "continue", a != null && o != null && ({value: a, atLimit: l} =
|
|
4176
|
+
} else c && (d = "continue", a != null && o != null && ({value: a, atLimit: l} = dr(a, o, s)));
|
|
4147
4177
|
}
|
|
4148
4178
|
return {
|
|
4149
4179
|
lane: t,
|
|
@@ -4159,8 +4189,8 @@ function cr(e, t, n, r = !1) {
|
|
|
4159
4189
|
carried: c && !i
|
|
4160
4190
|
};
|
|
4161
4191
|
}
|
|
4162
|
-
function
|
|
4163
|
-
let t = e.source, n = (e) => e == null ? "??" : t ?
|
|
4192
|
+
function pr(e) {
|
|
4193
|
+
let t = e.source, n = (e) => e == null ? "??" : t ? tr(t.cmd, e) : J(e), r = e.increment == null ? "" : nr(e.increment), i = e.atLimit && e.limit != null ? `, held at the RTO limit ${J(e.limit)}` : "";
|
|
4164
4194
|
switch (e.event) {
|
|
4165
4195
|
case "rep":
|
|
4166
4196
|
case "repChange": return e.carried ? `REP ${r} per step continues the repeat from the previous phrase` : `${e.event === "rep" ? "repeats" : "now repeats"} ${t?.cmd} from ${n(t?.value ?? null)} (step ${t?.step.toString(16).toUpperCase()}), ${r} per step → ${n(e.value)} on this step${i}`;
|
|
@@ -4172,7 +4202,7 @@ function lr(e) {
|
|
|
4172
4202
|
default: return null;
|
|
4173
4203
|
}
|
|
4174
4204
|
}
|
|
4175
|
-
function
|
|
4205
|
+
function mr(e) {
|
|
4176
4206
|
let t = e.fields.inst;
|
|
4177
4207
|
return t && !t.isEmpty ? "instrument" : [
|
|
4178
4208
|
1,
|
|
@@ -4183,10 +4213,10 @@ function ur(e) {
|
|
|
4183
4213
|
return n != null && !n.isEmpty && n.rawValue.toUpperCase() === "RET";
|
|
4184
4214
|
}) ? "ret" : null;
|
|
4185
4215
|
}
|
|
4186
|
-
function
|
|
4216
|
+
function hr(e, t, n = null) {
|
|
4187
4217
|
let r = {}, i = null, a = null, o = Math.min(t, e.length - 1);
|
|
4188
4218
|
for (let t = 0; t <= o; t += 1) {
|
|
4189
|
-
let o =
|
|
4219
|
+
let o = mr(e[t]);
|
|
4190
4220
|
if (o) {
|
|
4191
4221
|
for (let e of Object.keys(r)) delete r[e];
|
|
4192
4222
|
i = t, a = o;
|
|
@@ -4196,7 +4226,7 @@ function dr(e, t, n = null) {
|
|
|
4196
4226
|
2,
|
|
4197
4227
|
3
|
|
4198
4228
|
]) {
|
|
4199
|
-
let s =
|
|
4229
|
+
let s = fr(e, o, t, n === o), c = s.source;
|
|
4200
4230
|
if (!c || s.carried || !q(c.cmd)) continue;
|
|
4201
4231
|
let l = null, u = !1;
|
|
4202
4232
|
if (s.event === "set" || s.event === "replace" ? l = c.value : (s.event === "rep" || s.event === "repChange" || s.event === "continue") && (l = s.value, u = !0), l == null) continue;
|
|
@@ -4213,21 +4243,21 @@ function dr(e, t, n = null) {
|
|
|
4213
4243
|
}
|
|
4214
4244
|
return r;
|
|
4215
4245
|
}
|
|
4216
|
-
var
|
|
4217
|
-
function
|
|
4246
|
+
var gr = (e) => e === 0 ? "±00" : `${e > 0 ? "+" : "−"}${J(Math.abs(e))}`;
|
|
4247
|
+
function _r(e) {
|
|
4218
4248
|
if (e.resetStep == null) return "the start of this phrase (earlier state unknown)";
|
|
4219
4249
|
let t = e.resetStep.toString(16).toUpperCase();
|
|
4220
4250
|
return e.resetBy === "ret" ? `the RET on step ${t}` : `the instrument number on step ${t}`;
|
|
4221
4251
|
}
|
|
4222
|
-
var
|
|
4223
|
-
function
|
|
4224
|
-
if (!e || e.count <= 1) return `relative: ${
|
|
4225
|
-
let t = e.viaRep ? ", including REP repeats" : "", n = e.total === 0 ? "has had no net effect" : `has moved by ${
|
|
4226
|
-
return `relative: ${e.cmd} ${n} over ${e.count} steps since ${
|
|
4252
|
+
var vr = "stays until a note with an instrument number (I) or a RET resets it";
|
|
4253
|
+
function yr(e) {
|
|
4254
|
+
if (!e || e.count <= 1) return `relative: ${vr}`;
|
|
4255
|
+
let t = e.viaRep ? ", including REP repeats" : "", n = e.total === 0 ? "has had no net effect" : `has moved by ${gr(e.total)}`;
|
|
4256
|
+
return `relative: ${e.cmd} ${n} over ${e.count} steps since ${_r(e)}${t}; ${vr}`;
|
|
4227
4257
|
}
|
|
4228
|
-
function
|
|
4258
|
+
function br(e) {
|
|
4229
4259
|
let t = Object.values(e).filter((e) => e.total !== 0);
|
|
4230
|
-
return t.length ? `triggers the instrument again: resets the relative changes still in force (${t.map((e) => `${e.cmd} ${
|
|
4260
|
+
return t.length ? `triggers the instrument again: resets the relative changes still in force (${t.map((e) => `${e.cmd} ${gr(e.total)}`).join(", ")})` : null;
|
|
4231
4261
|
}
|
|
4232
4262
|
//#endregion
|
|
4233
4263
|
//#region src/scaleInsight.ts
|
|
@@ -4244,7 +4274,7 @@ var Z = [
|
|
|
4244
4274
|
"A",
|
|
4245
4275
|
"A#",
|
|
4246
4276
|
"B"
|
|
4247
|
-
],
|
|
4277
|
+
], xr = [
|
|
4248
4278
|
{
|
|
4249
4279
|
name: "Major (Ionian)",
|
|
4250
4280
|
steps: [
|
|
@@ -4462,7 +4492,7 @@ var Z = [
|
|
|
4462
4492
|
11
|
|
4463
4493
|
]
|
|
4464
4494
|
}
|
|
4465
|
-
],
|
|
4495
|
+
], Sr = [
|
|
4466
4496
|
"the root",
|
|
4467
4497
|
"a minor 2nd",
|
|
4468
4498
|
"a major 2nd",
|
|
@@ -4476,26 +4506,26 @@ var Z = [
|
|
|
4476
4506
|
"a minor 7th",
|
|
4477
4507
|
"a major 7th"
|
|
4478
4508
|
];
|
|
4479
|
-
function
|
|
4509
|
+
function Cr(e) {
|
|
4480
4510
|
let t = e.replace(/[-\s]/g, "").toUpperCase();
|
|
4481
4511
|
return Z.includes(t) ? t : null;
|
|
4482
4512
|
}
|
|
4483
|
-
function
|
|
4513
|
+
function wr(e) {
|
|
4484
4514
|
let t = Z.indexOf(e);
|
|
4485
|
-
return t <= 0 ? t === 0 ? "the first row (the scale root)" : e : `${
|
|
4515
|
+
return t <= 0 ? t === 0 ? "the first row (the scale root)" : e : `${Sr[t]} (+${t} semitones above C)`;
|
|
4486
4516
|
}
|
|
4487
|
-
function
|
|
4517
|
+
function Tr(e) {
|
|
4488
4518
|
let t = new Set(e);
|
|
4489
4519
|
if (t.size === 0) return [];
|
|
4490
4520
|
let n = [];
|
|
4491
|
-
for (let e of
|
|
4521
|
+
for (let e of xr) if (e.steps.length === t.size) for (let r = 0; r < 12; r += 1) e.steps.every((e) => t.has((e + r) % 12)) && n.push({
|
|
4492
4522
|
root: r,
|
|
4493
4523
|
name: e.name
|
|
4494
4524
|
});
|
|
4495
4525
|
return n.sort((e, t) => e.root - t.root), n.map((e) => e.root === 0 ? e.name : `${e.name} from ${Z[e.root]}`);
|
|
4496
4526
|
}
|
|
4497
|
-
function
|
|
4498
|
-
let t = e.filter((e) => e.enabled === !0), n = t.map((e) => e.interval), r =
|
|
4527
|
+
function Er(e) {
|
|
4528
|
+
let t = e.filter((e) => e.enabled === !0), n = t.map((e) => e.interval), r = Tr(t.map((e) => e.semitone)), i = e.filter((e) => e.enabled === !0 && e.offset != null && e.offset !== 0).map((e) => ({
|
|
4499
4529
|
interval: e.interval,
|
|
4500
4530
|
offset: e.offset
|
|
4501
4531
|
}));
|
|
@@ -4504,47 +4534,47 @@ function Sr(e) {
|
|
|
4504
4534
|
enabled: n,
|
|
4505
4535
|
shapes: r,
|
|
4506
4536
|
detuned: i,
|
|
4507
|
-
summary:
|
|
4537
|
+
summary: Dr({
|
|
4508
4538
|
enabled: n,
|
|
4509
4539
|
shapes: r,
|
|
4510
4540
|
detuned: i
|
|
4511
4541
|
}).join(" — ")
|
|
4512
4542
|
};
|
|
4513
4543
|
}
|
|
4514
|
-
function
|
|
4544
|
+
function Dr(e) {
|
|
4515
4545
|
let { enabled: t, shapes: n, detuned: r } = e;
|
|
4516
4546
|
if (!t.length) return ["no notes enabled"];
|
|
4517
4547
|
let i = n[0] ?? `${t.length} notes, custom scale`;
|
|
4518
|
-
return r.length && (i += `; detuned: ${r.map((e) => `${e.interval} ${
|
|
4548
|
+
return r.length && (i += `; detuned: ${r.map((e) => `${e.interval} ${Or(e.offset)}`).join(", ")}`), [t.join(" "), i];
|
|
4519
4549
|
}
|
|
4520
|
-
function
|
|
4550
|
+
function Or(e) {
|
|
4521
4551
|
return `${e > 0 ? "+" : e < 0 ? "−" : ""}${Math.abs(e).toFixed(2)} st`;
|
|
4522
4552
|
}
|
|
4523
4553
|
//#endregion
|
|
4524
4554
|
//#region src/viewContext.ts
|
|
4525
|
-
var
|
|
4555
|
+
var kr = /* @__PURE__ */ new Set([
|
|
4526
4556
|
"--",
|
|
4527
4557
|
"---",
|
|
4528
4558
|
"---00",
|
|
4529
4559
|
"----",
|
|
4530
4560
|
"-"
|
|
4531
4561
|
]);
|
|
4532
|
-
function
|
|
4533
|
-
return !e ||
|
|
4562
|
+
function Ar(e) {
|
|
4563
|
+
return !e || kr.has(e) || /^-+$/.test(e);
|
|
4534
4564
|
}
|
|
4535
|
-
function
|
|
4565
|
+
function jr(e) {
|
|
4536
4566
|
let t = e.trim();
|
|
4537
|
-
if (!t ||
|
|
4567
|
+
if (!t || Ar(t)) return null;
|
|
4538
4568
|
let n = parseInt(t, 16);
|
|
4539
4569
|
return Number.isNaN(n) ? null : n;
|
|
4540
4570
|
}
|
|
4541
|
-
function
|
|
4571
|
+
function Mr(e, t, n) {
|
|
4542
4572
|
return t >= e.length ? "" : e.slice(t, Math.min(t + n, e.length));
|
|
4543
4573
|
}
|
|
4544
|
-
function
|
|
4545
|
-
return
|
|
4574
|
+
function Nr(e) {
|
|
4575
|
+
return Pr(e);
|
|
4546
4576
|
}
|
|
4547
|
-
function
|
|
4577
|
+
function Pr(e) {
|
|
4548
4578
|
if (!e) return {
|
|
4549
4579
|
viewId: null,
|
|
4550
4580
|
isUnsaved: !1,
|
|
@@ -4557,7 +4587,7 @@ function Ar(e) {
|
|
|
4557
4587
|
marker: r
|
|
4558
4588
|
};
|
|
4559
4589
|
}
|
|
4560
|
-
function
|
|
4590
|
+
function Fr(e) {
|
|
4561
4591
|
return e.length > 0 && /^[^a-zA-Z0-9 ]/.test(e[0]) ? {
|
|
4562
4592
|
line: e.slice(1),
|
|
4563
4593
|
offset: 1
|
|
@@ -4566,12 +4596,12 @@ function jr(e) {
|
|
|
4566
4596
|
offset: 0
|
|
4567
4597
|
};
|
|
4568
4598
|
}
|
|
4569
|
-
function
|
|
4570
|
-
let n =
|
|
4599
|
+
function Ir(e, t) {
|
|
4600
|
+
let n = Mr(t, e.x, e.width).trim();
|
|
4571
4601
|
n.includes("^") && (e.type === "fxCommand" || e.type === "fxValue") && (n = "");
|
|
4572
|
-
let r =
|
|
4602
|
+
let r = Ar(n);
|
|
4573
4603
|
if (e.format) {
|
|
4574
|
-
let t = r ? null :
|
|
4604
|
+
let t = r ? null : Wn(n, e.format), i = e.type === "name" || e.type === "fileEntry", a = t?.text != null && !i ? t.text.toUpperCase() : t?.text ?? null;
|
|
4575
4605
|
return {
|
|
4576
4606
|
key: e.key,
|
|
4577
4607
|
label: e.label,
|
|
@@ -4586,8 +4616,8 @@ function Mr(e, t) {
|
|
|
4586
4616
|
values: t?.values ?? null,
|
|
4587
4617
|
parts: e.parts,
|
|
4588
4618
|
unit: e.unit,
|
|
4589
|
-
valueDescription: !r &&
|
|
4590
|
-
fileKind: e.type === "fileEntry" ?
|
|
4619
|
+
valueDescription: !r && Gn(e.options, a ?? n) || void 0,
|
|
4620
|
+
fileKind: e.type === "fileEntry" ? Lr(n) : void 0
|
|
4591
4621
|
};
|
|
4592
4622
|
}
|
|
4593
4623
|
let i = [
|
|
@@ -4607,7 +4637,7 @@ function Mr(e, t) {
|
|
|
4607
4637
|
if (a.includes(e.type)) {
|
|
4608
4638
|
let e = parseInt(n, 10);
|
|
4609
4639
|
o = Number.isNaN(e) ? null : e;
|
|
4610
|
-
} else o =
|
|
4640
|
+
} else o = jr(n);
|
|
4611
4641
|
}
|
|
4612
4642
|
return {
|
|
4613
4643
|
key: e.key,
|
|
@@ -4619,20 +4649,20 @@ function Mr(e, t) {
|
|
|
4619
4649
|
meta: e.meta
|
|
4620
4650
|
};
|
|
4621
4651
|
}
|
|
4622
|
-
function
|
|
4652
|
+
function Lr(e) {
|
|
4623
4653
|
if (e === "/..") return "parent";
|
|
4624
4654
|
if (e.startsWith("/")) return "directory";
|
|
4625
4655
|
let t = /\.([a-z0-9]+)$/i.exec(e)?.[1]?.toLowerCase();
|
|
4626
4656
|
return t === "m8i" ? "instrumentPreset" : t === "wav" ? "sample" : t?.startsWith("m8") ? "m8file" : "file";
|
|
4627
4657
|
}
|
|
4628
|
-
function
|
|
4629
|
-
let n =
|
|
4658
|
+
function Rr(e, t) {
|
|
4659
|
+
let n = Mr(e, t.x, t.width).trim();
|
|
4630
4660
|
if (!n) return null;
|
|
4631
|
-
if (t.parse === "hex") return
|
|
4661
|
+
if (t.parse === "hex") return jr(n);
|
|
4632
4662
|
let r = parseInt(n, 10);
|
|
4633
4663
|
return Number.isNaN(r) ? null : r;
|
|
4634
4664
|
}
|
|
4635
|
-
function
|
|
4665
|
+
function zr(e, t) {
|
|
4636
4666
|
for (let n of e) if (t >= n.x && t < n.x + n.width) return n;
|
|
4637
4667
|
let n = null, r = 2;
|
|
4638
4668
|
for (let i of e) {
|
|
@@ -4641,9 +4671,9 @@ function Fr(e, t) {
|
|
|
4641
4671
|
}
|
|
4642
4672
|
return n;
|
|
4643
4673
|
}
|
|
4644
|
-
function
|
|
4674
|
+
function Br(e, t) {
|
|
4645
4675
|
let n = {};
|
|
4646
|
-
for (let r of e.columns ?? []) n[r.key] =
|
|
4676
|
+
for (let r of e.columns ?? []) n[r.key] = Ir(r, t);
|
|
4647
4677
|
for (let e of Object.keys(n)) {
|
|
4648
4678
|
let t = /^fx(\d)cmd$/.exec(e)?.[1], r = t ? n[`fx${t}val`] : void 0;
|
|
4649
4679
|
r && n[e].isEmpty && (n[`fx${t}val`] = {
|
|
@@ -4652,27 +4682,27 @@ function Ir(e, t) {
|
|
|
4652
4682
|
});
|
|
4653
4683
|
}
|
|
4654
4684
|
return {
|
|
4655
|
-
rowIndex: e.rowField ?
|
|
4685
|
+
rowIndex: e.rowField ? Rr(t, e.rowField) : null,
|
|
4656
4686
|
rowKey: e.rowField?.key ?? "row",
|
|
4657
4687
|
rowId: null,
|
|
4658
4688
|
fields: n
|
|
4659
4689
|
};
|
|
4660
4690
|
}
|
|
4661
|
-
var
|
|
4662
|
-
function
|
|
4691
|
+
var Vr = (e) => e.replace(/\s+/g, ""), Hr = 1, Q = (e) => e.slice(1);
|
|
4692
|
+
function Ur(e, t) {
|
|
4663
4693
|
if (!t || !e.cursorPos || !e.currentLine) return !1;
|
|
4664
4694
|
let n = t.lines[e.cursorPos.y];
|
|
4665
|
-
return n != null &&
|
|
4695
|
+
return n != null && Vr(n) === Vr(e.currentLine);
|
|
4666
4696
|
}
|
|
4667
|
-
var
|
|
4668
|
-
function
|
|
4669
|
-
let n =
|
|
4697
|
+
var Wr = 16, Gr = 4, Kr = 21;
|
|
4698
|
+
function qr(e, t) {
|
|
4699
|
+
let n = L.views[e];
|
|
4670
4700
|
if (n?.type !== "grid" || !n.rowField) return [];
|
|
4671
|
-
let r = [], i = Math.min(
|
|
4672
|
-
for (let e =
|
|
4701
|
+
let r = [], i = Math.min(Kr, t.lines.length - 1);
|
|
4702
|
+
for (let e = Gr; e <= i; e += 1) {
|
|
4673
4703
|
let i = Q(t.lines[e] ?? ""), a = n.rowField;
|
|
4674
|
-
if (i.length <= a.x + a.width || !
|
|
4675
|
-
let o =
|
|
4704
|
+
if (i.length <= a.x + a.width || !Jr(i[a.x + a.width])) continue;
|
|
4705
|
+
let o = Br(n, i);
|
|
4676
4706
|
o.rowIndex != null && r.push({
|
|
4677
4707
|
...o,
|
|
4678
4708
|
screenRow: e
|
|
@@ -4680,11 +4710,11 @@ function Ur(e, t) {
|
|
|
4680
4710
|
}
|
|
4681
4711
|
return r;
|
|
4682
4712
|
}
|
|
4683
|
-
var
|
|
4684
|
-
function
|
|
4685
|
-
let n =
|
|
4713
|
+
var Jr = (e) => e === " " || /^[^a-zA-Z0-9-]$/.test(e);
|
|
4714
|
+
function Yr(e, t) {
|
|
4715
|
+
let n = L.views[e];
|
|
4686
4716
|
if (n?.type !== "grid") return null;
|
|
4687
|
-
let r =
|
|
4717
|
+
let r = qr(e, t), i = (e) => !!e && e !== " " && Jr(e);
|
|
4688
4718
|
if (e === "song") return {
|
|
4689
4719
|
tracks: (n.columns ?? []).filter((e) => e.type === "chainRef").map((e) => r.find((n) => i(Q(t.lines[n.screenRow] ?? "")[e.x - 1]))?.rowIndex ?? null),
|
|
4690
4720
|
row: null
|
|
@@ -4698,25 +4728,25 @@ function Gr(e, t) {
|
|
|
4698
4728
|
row: null
|
|
4699
4729
|
};
|
|
4700
4730
|
}
|
|
4701
|
-
function
|
|
4731
|
+
function Xr(e, t, n, r) {
|
|
4702
4732
|
let i = (t.cursorPos?.y ?? -1) - r;
|
|
4703
4733
|
if (i < 0) return null;
|
|
4704
4734
|
let a = [], o = null;
|
|
4705
|
-
for (let t = 0; t <
|
|
4735
|
+
for (let t = 0; t < Wr; t += 1) {
|
|
4706
4736
|
let r = n.lines[i + t];
|
|
4707
4737
|
if (r == null) return null;
|
|
4708
|
-
let s = Q(r), c =
|
|
4738
|
+
let s = Q(r), c = Br(e, s);
|
|
4709
4739
|
if (c.rowIndex !== t) return null;
|
|
4710
4740
|
a.push(c);
|
|
4711
4741
|
let l = s.indexOf("^^");
|
|
4712
|
-
o == null && l >= 0 && (o =
|
|
4742
|
+
o == null && l >= 0 && (o = Zr(e, l));
|
|
4713
4743
|
}
|
|
4714
4744
|
return {
|
|
4715
4745
|
steps: a,
|
|
4716
4746
|
carriedRepLane: o
|
|
4717
4747
|
};
|
|
4718
4748
|
}
|
|
4719
|
-
function
|
|
4749
|
+
function Zr(e, t) {
|
|
4720
4750
|
let n = [];
|
|
4721
4751
|
for (let r = 1; r <= 3; r += 1) {
|
|
4722
4752
|
let i = e.columns?.find((e) => e.key === `fx${r}cmd`), a = e.columns?.find((e) => e.key === `fx${r}val`);
|
|
@@ -4730,8 +4760,8 @@ function qr(e, t) {
|
|
|
4730
4760
|
let r = Math.min(...n.map((e) => e.dist)), i = n.filter((e) => e.dist === r);
|
|
4731
4761
|
return r <= 1 && i.length === 1 ? i[0].lane : null;
|
|
4732
4762
|
}
|
|
4733
|
-
function
|
|
4734
|
-
let t =
|
|
4763
|
+
function Qr(e) {
|
|
4764
|
+
let t = Cr(e.fields.interval?.rawValue ?? "");
|
|
4735
4765
|
if (!t) return null;
|
|
4736
4766
|
let n = e.fields.en?.rawValue.toUpperCase(), r = parseFloat(e.fields.offset?.rawValue ?? "");
|
|
4737
4767
|
return {
|
|
@@ -4741,15 +4771,15 @@ function Jr(e) {
|
|
|
4741
4771
|
offset: Number.isNaN(r) ? null : r
|
|
4742
4772
|
};
|
|
4743
4773
|
}
|
|
4744
|
-
function
|
|
4774
|
+
function $r(e, t) {
|
|
4745
4775
|
let n = /* @__PURE__ */ new Map();
|
|
4746
4776
|
for (let r of t.lines) {
|
|
4747
|
-
let t =
|
|
4777
|
+
let t = Br(e, Q(r)), i = Qr(t), a = t.fields.en?.rawValue.toUpperCase();
|
|
4748
4778
|
!i || a !== "ON" && a !== "OFF" && a !== "--" || n.has(i.interval) || n.set(i.interval, i);
|
|
4749
4779
|
}
|
|
4750
4780
|
return n.size === Z.length ? Z.map((e) => n.get(e)) : null;
|
|
4751
4781
|
}
|
|
4752
|
-
function
|
|
4782
|
+
function ei(e, t, n, r) {
|
|
4753
4783
|
let i = {
|
|
4754
4784
|
...r,
|
|
4755
4785
|
isGridView: !1,
|
|
@@ -4766,40 +4796,40 @@ function Xr(e, t, n, r) {
|
|
|
4766
4796
|
resetsRelative: null,
|
|
4767
4797
|
scaleNote: null,
|
|
4768
4798
|
scale: null
|
|
4769
|
-
}, a = e.cursorPos, o = a ? a.x - 1 : 0, s = a &&
|
|
4799
|
+
}, a = e.cursorPos, o = a ? a.x - 1 : 0, s = a && Ur(e, t) ? t : null, c = s && a ? Q(s.lines[a.y] ?? "") : e.currentLine ?? "";
|
|
4770
4800
|
if (!c.trim()) return i;
|
|
4771
|
-
let l = s && a ? s.lines.slice(0, a.y + 1).reverse().map(Q) : [c], u = r.viewName === "inst" ?
|
|
4801
|
+
let l = s && a ? s.lines.slice(0, a.y + 1).reverse().map(Q) : [c], u = r.viewName === "inst" ? jn(s ? s.lines.map(Q) : [c]) : null, d = {
|
|
4772
4802
|
instrumentKey: u?.key ?? null,
|
|
4773
4803
|
entryText: e.textUnderCursor
|
|
4774
4804
|
};
|
|
4775
4805
|
if (!s && a && n.kind == null) for (let e = 0; e <= Math.min(o, 24); e += 1) {
|
|
4776
4806
|
let t = " ".repeat(e) + c;
|
|
4777
|
-
if (
|
|
4807
|
+
if (Hn(n, t, {
|
|
4778
4808
|
...d,
|
|
4779
|
-
section:
|
|
4809
|
+
section: On(n, [t])
|
|
4780
4810
|
}).cells.some((e) => o >= e.x && o < e.x + e.width)) {
|
|
4781
4811
|
c = t;
|
|
4782
4812
|
break;
|
|
4783
4813
|
}
|
|
4784
4814
|
}
|
|
4785
|
-
let f =
|
|
4815
|
+
let f = On(n, s ? l : [c]), { rowId: p, cells: m } = Hn(n, c, {
|
|
4786
4816
|
...d,
|
|
4787
4817
|
section: f
|
|
4788
4818
|
}), h = {};
|
|
4789
|
-
for (let e of m) h[e.key] =
|
|
4819
|
+
for (let e of m) h[e.key] = Ir(e, c);
|
|
4790
4820
|
let g = {
|
|
4791
4821
|
rowIndex: null,
|
|
4792
4822
|
rowKey: "param",
|
|
4793
4823
|
rowId: p,
|
|
4794
4824
|
fields: h
|
|
4795
|
-
}, _ = null, v = a ?
|
|
4825
|
+
}, _ = null, v = a ? zr(m, o) : null;
|
|
4796
4826
|
v && (_ = {
|
|
4797
4827
|
...h[v.key],
|
|
4798
4828
|
viewName: r.viewName,
|
|
4799
4829
|
rowIndex: null
|
|
4800
4830
|
});
|
|
4801
4831
|
let y = v?.meta?.zone;
|
|
4802
|
-
return s && typeof y == "string" && (f =
|
|
4832
|
+
return s && typeof y == "string" && (f = kn(n, y, l) ?? f), {
|
|
4803
4833
|
...i,
|
|
4804
4834
|
section: f,
|
|
4805
4835
|
instrumentType: u,
|
|
@@ -4808,10 +4838,10 @@ function Xr(e, t, n, r) {
|
|
|
4808
4838
|
lineText: c.trim()
|
|
4809
4839
|
};
|
|
4810
4840
|
}
|
|
4811
|
-
function
|
|
4841
|
+
function ti(e, t) {
|
|
4812
4842
|
let n = e.viewName;
|
|
4813
4843
|
if (!n) return null;
|
|
4814
|
-
let r =
|
|
4844
|
+
let r = L.views[n] ?? null, i = r?.type === "grid", a = r?.title ?? null, o = r?.description ?? null, { viewId: s, isUnsaved: c } = Pr(e.viewTitle), l = {
|
|
4815
4845
|
viewName: n,
|
|
4816
4846
|
viewTitle: a,
|
|
4817
4847
|
viewDescription: o,
|
|
@@ -4830,8 +4860,8 @@ function Zr(e, t) {
|
|
|
4830
4860
|
resetsRelative: null,
|
|
4831
4861
|
scaleNote: null,
|
|
4832
4862
|
scale: null
|
|
4833
|
-
}, d = r?.type === "parameter" ?
|
|
4834
|
-
if (d) return
|
|
4863
|
+
}, d = r?.type === "parameter" ? En(n) : null;
|
|
4864
|
+
if (d) return ei(e, t, d, l);
|
|
4835
4865
|
if (!i || !r) return {
|
|
4836
4866
|
...u,
|
|
4837
4867
|
isGridView: !1,
|
|
@@ -4845,11 +4875,11 @@ function Zr(e, t) {
|
|
|
4845
4875
|
row: null,
|
|
4846
4876
|
activeField: null
|
|
4847
4877
|
};
|
|
4848
|
-
let { line: p } =
|
|
4849
|
-
if (g) return
|
|
4878
|
+
let { line: p } = Fr(f), m = e.cursorPos ? e.cursorPos.x - 1 : 0, h = Br(r, p), g = n === "scale" && !Cr(h.fields.interval?.rawValue ?? "") ? En(n) : null;
|
|
4879
|
+
if (g) return ei(e, t, g, l);
|
|
4850
4880
|
let _ = null;
|
|
4851
4881
|
if (e.cursorPos) {
|
|
4852
|
-
let e =
|
|
4882
|
+
let e = zr(r.columns ?? [], m);
|
|
4853
4883
|
if (e) {
|
|
4854
4884
|
let t = h.fields[e.key];
|
|
4855
4885
|
t && (_ = {
|
|
@@ -4860,20 +4890,20 @@ function Zr(e, t) {
|
|
|
4860
4890
|
}
|
|
4861
4891
|
}
|
|
4862
4892
|
let v = null, y = null, b = null, x = null, S = null, C = null;
|
|
4863
|
-
if (
|
|
4893
|
+
if (Ur(e, t)) {
|
|
4864
4894
|
if (n === "phrase" && h.rowIndex != null) {
|
|
4865
|
-
let n =
|
|
4895
|
+
let n = Xr(r, e, t, h.rowIndex);
|
|
4866
4896
|
if (n) {
|
|
4867
4897
|
v = n.steps, y = n.carriedRepLane;
|
|
4868
4898
|
let e = _ ? /^fx(\d)(cmd|val)$/.exec(_.key)?.[1] : void 0;
|
|
4869
|
-
e && (b =
|
|
4899
|
+
e && (b = fr(v, Number(e), h.rowIndex, y === Number(e))), x = hr(v, h.rowIndex, y), h.rowIndex > 0 && mr(h) && (S = hr(v, h.rowIndex - 1, y));
|
|
4870
4900
|
}
|
|
4871
4901
|
} else if (n === "scale") {
|
|
4872
|
-
let e =
|
|
4873
|
-
e && (C =
|
|
4902
|
+
let e = $r(r, t);
|
|
4903
|
+
e && (C = Er(e));
|
|
4874
4904
|
}
|
|
4875
4905
|
}
|
|
4876
|
-
let w = n === "scale" ?
|
|
4906
|
+
let w = n === "scale" ? Qr(h) : null;
|
|
4877
4907
|
return {
|
|
4878
4908
|
...u,
|
|
4879
4909
|
isGridView: !0,
|
|
@@ -4889,25 +4919,25 @@ function Zr(e, t) {
|
|
|
4889
4919
|
scale: C
|
|
4890
4920
|
};
|
|
4891
4921
|
}
|
|
4892
|
-
function
|
|
4893
|
-
if (e.isParameterView) return
|
|
4922
|
+
function ni(e) {
|
|
4923
|
+
if (e.isParameterView) return di(e);
|
|
4894
4924
|
if (e.viewName === "scale") {
|
|
4895
|
-
let t =
|
|
4925
|
+
let t = fi(e);
|
|
4896
4926
|
if (t) return t;
|
|
4897
4927
|
}
|
|
4898
4928
|
if (!e.activeField) return $(["location", e.viewTitle ?? e.viewName]);
|
|
4899
|
-
let { activeField: t, row: n } = e, r = $(["field", `${t.label}: ${
|
|
4929
|
+
let { activeField: t, row: n } = e, r = $(["field", `${t.label}: ${mi(t)}`]), i = (t.type === "fxCommand" || t.type === "fxValue") && n ? ii(e, t, n) : [...si(e, t), ...ci(e, t)], a = i.length > 0;
|
|
4900
4930
|
if (t.type === "fxCommand" && !t.isEmpty) {
|
|
4901
|
-
let e = a && /^(REP|RTO)$/i.test(t.rawValue) ? void 0 :
|
|
4931
|
+
let e = a && /^(REP|RTO)$/i.test(t.rawValue) ? void 0 : Xn(t.rawValue);
|
|
4902
4932
|
e && r.push({
|
|
4903
4933
|
kind: "fxInfo",
|
|
4904
|
-
text: `(${
|
|
4934
|
+
text: `(${ai(e)})`
|
|
4905
4935
|
});
|
|
4906
4936
|
}
|
|
4907
4937
|
if (t.type === "fxValue" && n) {
|
|
4908
4938
|
let e = t.key.replace("val", "cmd"), i = n.fields[e];
|
|
4909
4939
|
if (i && !i.isEmpty) {
|
|
4910
|
-
let e = a && /^(REP|RTO)$/i.test(i.rawValue) ? void 0 :
|
|
4940
|
+
let e = a && /^(REP|RTO)$/i.test(i.rawValue) ? void 0 : Xn(i.rawValue), t = e ? `${i.rawValue} (${ai(e)})` : i.rawValue;
|
|
4911
4941
|
r.push({
|
|
4912
4942
|
kind: "fxTarget",
|
|
4913
4943
|
text: `for ${t}`
|
|
@@ -4926,8 +4956,8 @@ function Qr(e) {
|
|
|
4926
4956
|
}
|
|
4927
4957
|
return r;
|
|
4928
4958
|
}
|
|
4929
|
-
function
|
|
4930
|
-
return
|
|
4959
|
+
function ri(e) {
|
|
4960
|
+
return ni(e).map((e) => e.text).join(" — ");
|
|
4931
4961
|
}
|
|
4932
4962
|
function $(...e) {
|
|
4933
4963
|
return e.flatMap(([e, t]) => t ? [{
|
|
@@ -4935,33 +4965,33 @@ function $(...e) {
|
|
|
4935
4965
|
text: t
|
|
4936
4966
|
}] : []);
|
|
4937
4967
|
}
|
|
4938
|
-
function
|
|
4968
|
+
function ii(e, t, n) {
|
|
4939
4969
|
let r = /^fx(\d)/.exec(t.key)?.[1];
|
|
4940
4970
|
if (!r) return [];
|
|
4941
4971
|
let i = n.fields[`fx${r}cmd`], a = n.fields[`fx${r}val`];
|
|
4942
4972
|
if (!i || i.isEmpty) {
|
|
4943
4973
|
if (e.fxLane?.event !== "continue") return [];
|
|
4944
|
-
let t = e.fxLane.source?.cmd, n = t && q(t) ?
|
|
4945
|
-
return $(["fxLane",
|
|
4974
|
+
let t = e.fxLane.source?.cmd, n = t && q(t) ? yr(e.relativeFx?.[t]) : null;
|
|
4975
|
+
return $(["fxLane", pr(e.fxLane)], ["relative", n]);
|
|
4946
4976
|
}
|
|
4947
|
-
let o = i.rawValue.toUpperCase(), s = e.fxLane && e.fxLane.event !== "none" && e.fxLane.event !== "set" ?
|
|
4977
|
+
let o = i.rawValue.toUpperCase(), s = e.fxLane && e.fxLane.event !== "none" && e.fxLane.event !== "set" ? pr(e.fxLane) : null;
|
|
4948
4978
|
if ((o === "REP" || o === "RTO") && e.viewName !== "table") {
|
|
4949
|
-
let t = e.fxLane?.source?.cmd, n = o === "REP" && e.fxLane?.active && t && q(t) ?
|
|
4979
|
+
let t = e.fxLane?.source?.cmd, n = o === "REP" && e.fxLane?.active && t && q(t) ? yr(e.relativeFx?.[t]) : null;
|
|
4950
4980
|
return $(["fxLane", s], ["relative", n]);
|
|
4951
4981
|
}
|
|
4952
4982
|
if (!a || a.isEmpty || a.hexValue == null) return $(["fxLane", s]);
|
|
4953
|
-
let c = t.type === "fxCommand" ? `value ${
|
|
4983
|
+
let c = t.type === "fxCommand" ? `value ${tr(o, a.hexValue)}: ` : "", l = ur(o, a.hexValue, {
|
|
4954
4984
|
note: n.fields.note?.isEmpty ? null : n.fields.note?.rawValue,
|
|
4955
4985
|
inTable: e.viewName === "table",
|
|
4956
4986
|
row: n.rowIndex
|
|
4957
4987
|
}), u = null;
|
|
4958
|
-
return q(o) ? u =
|
|
4988
|
+
return q(o) ? u = yr(e.relativeFx?.[o]) : o === "RET" && e.resetsRelative && (u = br(e.resetsRelative)), $(["meaning", l ? `${c}${l}` : null], ["fxLane", s], ["relative", u]);
|
|
4959
4989
|
}
|
|
4960
|
-
function
|
|
4990
|
+
function ai(e) {
|
|
4961
4991
|
let t = e.description.replace(/\.$/, "");
|
|
4962
|
-
return e.instrumentTypes ? `${t}; offered by ${e.instrumentTypes.map((e) =>
|
|
4992
|
+
return e.instrumentTypes ? `${t}; offered by ${e.instrumentTypes.map((e) => oi[e] ?? e).join(", ")} instruments` : t;
|
|
4963
4993
|
}
|
|
4964
|
-
var
|
|
4994
|
+
var oi = {
|
|
4965
4995
|
sampler: "Sampler",
|
|
4966
4996
|
macrosynth: "Macrosynth",
|
|
4967
4997
|
fmsynth: "FM Synth",
|
|
@@ -4970,17 +5000,17 @@ var ni = {
|
|
|
4970
5000
|
external: "External",
|
|
4971
5001
|
midiout: "MIDI Out"
|
|
4972
5002
|
};
|
|
4973
|
-
function
|
|
4974
|
-
return t.type !== "instrumentRef" || t.isEmpty || !e.resetsRelative ? [] : $(["relative",
|
|
5003
|
+
function si(e, t) {
|
|
5004
|
+
return t.type !== "instrumentRef" || t.isEmpty || !e.resetsRelative ? [] : $(["relative", br(e.resetsRelative)]);
|
|
4975
5005
|
}
|
|
4976
|
-
function
|
|
5006
|
+
function ci(e, t) {
|
|
4977
5007
|
return e.viewName !== "table" || t.key !== "volume" || t.isEmpty || t.hexValue == null || t.hexValue > 127 ? [] : $(["meaning", `plays at ${Math.round(t.hexValue / 127 * 100)}% of the step's velocity`]);
|
|
4978
5008
|
}
|
|
4979
|
-
var
|
|
5009
|
+
var li = {
|
|
4980
5010
|
MODFX: "ModFX",
|
|
4981
5011
|
DELAY: "Delay",
|
|
4982
5012
|
REVERB: "Reverb"
|
|
4983
|
-
},
|
|
5013
|
+
}, ui = {
|
|
4984
5014
|
parent: "goes up to the parent directory",
|
|
4985
5015
|
directory: "directory: [EDIT] opens it",
|
|
4986
5016
|
instrumentPreset: "instrument preset: [EDIT] selects it",
|
|
@@ -4988,30 +5018,30 @@ var ai = {
|
|
|
4988
5018
|
m8file: "M8 file: [EDIT] selects it",
|
|
4989
5019
|
file: "file: [EDIT] selects it"
|
|
4990
5020
|
};
|
|
4991
|
-
function
|
|
5021
|
+
function di(e) {
|
|
4992
5022
|
let t = `${e.viewTitle ?? e.viewName}${e.viewId ? ` ${e.viewId}` : ""}`, n = e.activeField;
|
|
4993
5023
|
if (!n) return $(["location", t], ["line", e.lineText]);
|
|
4994
|
-
let r = e.instrumentType?.key ?
|
|
4995
|
-
return $(["field", `${n.label}: ${
|
|
5024
|
+
let r = e.instrumentType?.key ? Mn(e.instrumentType.key) : null;
|
|
5025
|
+
return $(["field", `${n.label}: ${mi(n)}`], ["optionInfo", n.valueDescription], ["fieldInfo", n.description], ["fileInfo", n.fileKind && ui[n.fileKind]], ["instrument", e.instrumentType && `${r?.name ?? e.instrumentType.text} instrument`], ["section", e.section && (li[e.section] ?? e.section)], ["location", t]);
|
|
4996
5026
|
}
|
|
4997
|
-
function
|
|
5027
|
+
function fi(e) {
|
|
4998
5028
|
let t = `${e.viewTitle ?? e.viewName}${e.viewId ? ` ${e.viewId}` : ""}`, n = e.activeField, r = e.scaleNote;
|
|
4999
5029
|
if (!n || !r) return e.lineText ? $(["location", t], ["line", e.lineText]) : null;
|
|
5000
5030
|
let { interval: i, enabled: a, offset: o } = r, s;
|
|
5001
5031
|
if (n.key === "offset") {
|
|
5002
|
-
let e = o == null ? `detune of ${i}` : o === 0 ? `${i} is not detuned` : `${i} is detuned by ${
|
|
5032
|
+
let e = o == null ? `detune of ${i}` : o === 0 ? `${i} is not detuned` : `${i} is detuned by ${Or(o)}`;
|
|
5003
5033
|
s = $(["field", `${n.label}: ${n.rawValue || "(empty)"}`], ["meaning", e], ["meaning", a === !1 ? "(note is OFF)" : null]);
|
|
5004
5034
|
} else {
|
|
5005
5035
|
let e = a === !0 ? "is in" : a === !1 ? "is not in" : "is not yet set in";
|
|
5006
|
-
s = $(["field", `${n.label}: ${n.key === "en" ? n.rawValue.toUpperCase() || "(unset)" : i}`], ["meaning", i], ["meaning",
|
|
5036
|
+
s = $(["field", `${n.label}: ${n.key === "en" ? n.rawValue.toUpperCase() || "(unset)" : i}`], ["meaning", i], ["meaning", wr(i)], ["meaning", `${e} the scale`]);
|
|
5007
5037
|
}
|
|
5008
5038
|
if (e.scale) {
|
|
5009
|
-
let [t, n] =
|
|
5039
|
+
let [t, n] = Dr(e.scale);
|
|
5010
5040
|
s.push(...$(["scale", `Scale: ${t}`], ["scale", n]));
|
|
5011
5041
|
}
|
|
5012
5042
|
return [...s, ...$(["location", `${t} row ${i}`])];
|
|
5013
5043
|
}
|
|
5014
|
-
function
|
|
5044
|
+
function pi(e) {
|
|
5015
5045
|
let t = e.unit ?? "";
|
|
5016
5046
|
if (e.values && e.parts) {
|
|
5017
5047
|
let n = e.hexValue != null, r = e.values.map((e) => n ? e.toString(16).toUpperCase().padStart(2, "0") : String(e)), i = e.parts.map((e, n) => `${e} ${r[n] ?? "?"}${t}`).join(", ");
|
|
@@ -5019,7 +5049,7 @@ function li(e) {
|
|
|
5019
5049
|
}
|
|
5020
5050
|
return e.hexValue == null ? e.numericValue == null ? e.text ?? e.rawValue : `${e.rawValue}${t}` : `${e.rawValue.slice(0, 2)}h (dec ${e.hexValue})${e.text ? ` ${e.text}` : ""}`;
|
|
5021
5051
|
}
|
|
5022
|
-
function
|
|
5052
|
+
function mi(e) {
|
|
5023
5053
|
if (e.isEmpty) return "(empty)";
|
|
5024
5054
|
let t = e.type === "name" || e.type === "fileEntry" ? e : {
|
|
5025
5055
|
...e,
|
|
@@ -5046,26 +5076,26 @@ function ui(e) {
|
|
|
5046
5076
|
case "fileEntry": return t.text ?? t.rawValue;
|
|
5047
5077
|
case "name": return `"${t.rawValue}"`;
|
|
5048
5078
|
case "option": return t.hexValue != null && t.text ? `${t.rawValue.slice(0, 2)} ${t.text}` : t.text ?? t.rawValue;
|
|
5049
|
-
case "parameter": return
|
|
5050
|
-
case "noteInterval": return `Interval ${
|
|
5079
|
+
case "parameter": return pi(t);
|
|
5080
|
+
case "noteInterval": return `Interval ${Cr(t.rawValue) ?? t.rawValue}`;
|
|
5051
5081
|
case "semitoneOffset": return t.isEmpty ? "(empty)" : `${t.rawValue} st`;
|
|
5052
5082
|
default: return t.rawValue;
|
|
5053
5083
|
}
|
|
5054
5084
|
}
|
|
5055
5085
|
//#endregion
|
|
5056
5086
|
//#region src/client.ts
|
|
5057
|
-
var
|
|
5087
|
+
var hi = "yam8d-external-app", gi = 3e3, _i = (e) => {
|
|
5058
5088
|
let t = e.remoteHandle();
|
|
5059
5089
|
return {
|
|
5060
5090
|
call: (e, ...n) => t.call(e, ...n),
|
|
5061
5091
|
on: (e, n) => (t.addEventListener(e, n), () => t.removeEventListener(e, n)),
|
|
5062
5092
|
close: () => e.close()
|
|
5063
5093
|
};
|
|
5064
|
-
},
|
|
5094
|
+
}, vi = (e) => ({
|
|
5065
5095
|
call: (t, ...n) => e.methods[t](...n),
|
|
5066
5096
|
on: (t, n) => e.on(t, n),
|
|
5067
5097
|
close: () => e.dispose()
|
|
5068
|
-
}),
|
|
5098
|
+
}), yi = (e) => {
|
|
5069
5099
|
let t = [];
|
|
5070
5100
|
return {
|
|
5071
5101
|
messenger: {
|
|
@@ -5079,21 +5109,21 @@ var di = "yam8d-external-app", fi = 3e3, pi = (e) => {
|
|
|
5079
5109
|
for (let e of t.splice(0)) e();
|
|
5080
5110
|
}
|
|
5081
5111
|
};
|
|
5082
|
-
},
|
|
5112
|
+
}, bi = () => {
|
|
5083
5113
|
if (typeof window > "u") return !1;
|
|
5084
5114
|
try {
|
|
5085
5115
|
return window.parent !== window;
|
|
5086
5116
|
} catch {
|
|
5087
5117
|
return !0;
|
|
5088
5118
|
}
|
|
5089
|
-
},
|
|
5119
|
+
}, xi = (e) => e instanceof DOMException && (e.name === "NotFoundError" || e.name === "AbortError"), Si = () => {
|
|
5090
5120
|
let e = typeof navigator > "u" ? null : navigator;
|
|
5091
5121
|
return {
|
|
5092
5122
|
serial: !!e && "serial" in e,
|
|
5093
5123
|
usb: !!e && "usb" in e,
|
|
5094
5124
|
midi: !!e && "requestMIDIAccess" in e
|
|
5095
5125
|
};
|
|
5096
|
-
},
|
|
5126
|
+
}, Ci = () => ({
|
|
5097
5127
|
viewName: null,
|
|
5098
5128
|
viewTitle: null,
|
|
5099
5129
|
minimapKey: null,
|
|
@@ -5110,9 +5140,9 @@ var di = "yam8d-external-app", fi = 3e3, pi = (e) => {
|
|
|
5110
5140
|
fontMode: null,
|
|
5111
5141
|
systemInfo: null,
|
|
5112
5142
|
macroRunning: !1
|
|
5113
|
-
}),
|
|
5143
|
+
}), wi = class {
|
|
5114
5144
|
constructor(e = {}) {
|
|
5115
|
-
this.backend = null, this.backendUnsubscribers = [], this.device = null, this._mode = null, this.audio = null, this.connecting = null, this.stateCallbacks = /* @__PURE__ */ new Set(), this.viewCallbacks = /* @__PURE__ */ new Set(), this.cursorCallbacks = /* @__PURE__ */ new Set(), this.textCallbacks = /* @__PURE__ */ new Set(), this.keyCallbacks = /* @__PURE__ */ new Set(), this.transportCallbacks = /* @__PURE__ */ new Set(), this.connectionCallbacks = /* @__PURE__ */ new Set(), this._state =
|
|
5145
|
+
this.backend = null, this.backendUnsubscribers = [], this.device = null, this._mode = null, this.audio = null, this.connecting = null, this.stateCallbacks = /* @__PURE__ */ new Set(), this.viewCallbacks = /* @__PURE__ */ new Set(), this.cursorCallbacks = /* @__PURE__ */ new Set(), this.textCallbacks = /* @__PURE__ */ new Set(), this.keyCallbacks = /* @__PURE__ */ new Set(), this.transportCallbacks = /* @__PURE__ */ new Set(), this.connectionCallbacks = /* @__PURE__ */ new Set(), this._state = Ci(), this._screen = null, this.screenRefreshing = !1, this.screenDirty = !1, this.config = e;
|
|
5116
5146
|
}
|
|
5117
5147
|
get state() {
|
|
5118
5148
|
return this._state;
|
|
@@ -5134,11 +5164,11 @@ var di = "yam8d-external-app", fi = 3e3, pi = (e) => {
|
|
|
5134
5164
|
}
|
|
5135
5165
|
async resolveMode() {
|
|
5136
5166
|
let e = this.config.mode ?? "auto";
|
|
5137
|
-
if (e === "standalone" || e === "auto" && !
|
|
5167
|
+
if (e === "standalone" || e === "auto" && !bi()) {
|
|
5138
5168
|
await this.startStandalone();
|
|
5139
5169
|
return;
|
|
5140
5170
|
}
|
|
5141
|
-
let t = typeof window < "u" && window.name === "yam8d-external-app", n = e === "host" || t ? null : this.config.handshakeTimeoutMs ??
|
|
5171
|
+
let t = typeof window < "u" && window.name === "yam8d-external-app", n = e === "host" || t ? null : this.config.handshakeTimeoutMs ?? gi;
|
|
5142
5172
|
await this.handshake(n) || (this.config.debug && console.log("[M8 SDK] No yam8d host answered, switching to standalone mode"), await this.startStandalone());
|
|
5143
5173
|
}
|
|
5144
5174
|
async handshake(r) {
|
|
@@ -5150,10 +5180,10 @@ var di = "yam8d-external-app", fi = 3e3, pi = (e) => {
|
|
|
5150
5180
|
this.config.debug && (i = t(i, (e, ...t) => {
|
|
5151
5181
|
console.log("[M8 SDK]", e, ...t);
|
|
5152
5182
|
}));
|
|
5153
|
-
let a =
|
|
5183
|
+
let a = yi(i), o = e(a.messenger, { ping: async () => "pong" }), s, c = new Promise((e) => {
|
|
5154
5184
|
r !== null && (s = setTimeout(() => e(null), r));
|
|
5155
5185
|
}), l = await Promise.race([o, c]);
|
|
5156
|
-
return clearTimeout(s), l ? (this._mode = "host", await this.attach(
|
|
5186
|
+
return clearTimeout(s), l ? (this._mode = "host", await this.attach(_i(l)), l.localHandle().emit("ready", void 0), !0) : (a.dispose(), !1);
|
|
5157
5187
|
}
|
|
5158
5188
|
async startStandalone() {
|
|
5159
5189
|
if (this._mode = "standalone", this.config.autoConnect !== !1) try {
|
|
@@ -5163,7 +5193,7 @@ var di = "yam8d-external-app", fi = 3e3, pi = (e) => {
|
|
|
5163
5193
|
}
|
|
5164
5194
|
}
|
|
5165
5195
|
async openDevice(e, t) {
|
|
5166
|
-
let n =
|
|
5196
|
+
let n = A();
|
|
5167
5197
|
if (!n.browserSupport) throw Error("This browser has no Web Serial, WebUSB or Web MIDI: the M8 cannot be reached from this page");
|
|
5168
5198
|
let r = e === "auto" && !t ? [
|
|
5169
5199
|
"serial",
|
|
@@ -5179,14 +5209,14 @@ var di = "yam8d-external-app", fi = 3e3, pi = (e) => {
|
|
|
5179
5209
|
});
|
|
5180
5210
|
break;
|
|
5181
5211
|
} catch (r) {
|
|
5182
|
-
if (a = r, t && !
|
|
5212
|
+
if (a = r, t && !xi(r) && (i = await ee(() => n.connect({
|
|
5183
5213
|
transport: e,
|
|
5184
5214
|
prompt: !1
|
|
5185
5215
|
}), { maxAttempts: 2 }), i)) break;
|
|
5186
5216
|
}
|
|
5187
5217
|
if (!i) throw a;
|
|
5188
|
-
let o =
|
|
5189
|
-
this.device = i, await this.attach(
|
|
5218
|
+
let o = bn(i, { debug: this.config.debug });
|
|
5219
|
+
this.device = i, await this.attach(vi(o)), i.commands.resetScreen();
|
|
5190
5220
|
let s = i;
|
|
5191
5221
|
i.closed.then(() => {
|
|
5192
5222
|
this.device === s && (this.config.debug && console.log("[M8 SDK] Device connection ended"), this.device = null, this.detach());
|
|
@@ -5267,7 +5297,7 @@ var di = "yam8d-external-app", fi = 3e3, pi = (e) => {
|
|
|
5267
5297
|
await this.disconnectAudio(), await this.closeDevice();
|
|
5268
5298
|
}
|
|
5269
5299
|
async connectAudio() {
|
|
5270
|
-
await this.connect(), this._mode !== "host" && (this.audio ??=
|
|
5300
|
+
await this.connect(), this._mode !== "host" && (this.audio ??= F(), await this.audio.connect({ requireM8: !0 }));
|
|
5271
5301
|
}
|
|
5272
5302
|
async disconnectAudio() {
|
|
5273
5303
|
await this.audio?.disconnect();
|
|
@@ -5336,7 +5366,7 @@ var di = "yam8d-external-app", fi = 3e3, pi = (e) => {
|
|
|
5336
5366
|
}, e;
|
|
5337
5367
|
}
|
|
5338
5368
|
async captureSnapshot() {
|
|
5339
|
-
let [e, t] = await Promise.all([this.fetchState(), this.getScreen()]), n =
|
|
5369
|
+
let [e, t] = await Promise.all([this.fetchState(), this.getScreen()]), n = ti(e, t);
|
|
5340
5370
|
return {
|
|
5341
5371
|
capturedAt: Date.now(),
|
|
5342
5372
|
state: {
|
|
@@ -5349,8 +5379,8 @@ var di = "yam8d-external-app", fi = 3e3, pi = (e) => {
|
|
|
5349
5379
|
deviceModel: e.deviceModel
|
|
5350
5380
|
},
|
|
5351
5381
|
semantic: n,
|
|
5352
|
-
description: n ?
|
|
5353
|
-
descriptionParts: n ?
|
|
5382
|
+
description: n ? ri(n) : null,
|
|
5383
|
+
descriptionParts: n ? ni(n) : null,
|
|
5354
5384
|
screen: t
|
|
5355
5385
|
};
|
|
5356
5386
|
}
|
|
@@ -5379,23 +5409,23 @@ var di = "yam8d-external-app", fi = 3e3, pi = (e) => {
|
|
|
5379
5409
|
this.audio?.disconnect(), this.closeDevice(), this.detach(), this.stateCallbacks.clear(), this.viewCallbacks.clear(), this.cursorCallbacks.clear(), this.textCallbacks.clear(), this.keyCallbacks.clear(), this.transportCallbacks.clear(), this.connectionCallbacks.clear();
|
|
5380
5410
|
}
|
|
5381
5411
|
getSemanticContext() {
|
|
5382
|
-
return
|
|
5412
|
+
return ti(this._state, this._screen);
|
|
5383
5413
|
}
|
|
5384
5414
|
describeContext() {
|
|
5385
|
-
let e =
|
|
5386
|
-
return e ?
|
|
5415
|
+
let e = ti(this._state, this._screen);
|
|
5416
|
+
return e ? ri(e) : null;
|
|
5387
5417
|
}
|
|
5388
5418
|
describeContextParts() {
|
|
5389
|
-
let e =
|
|
5390
|
-
return e ?
|
|
5419
|
+
let e = ti(this._state, this._screen);
|
|
5420
|
+
return e ? ni(e) : null;
|
|
5391
5421
|
}
|
|
5392
5422
|
};
|
|
5393
|
-
async function
|
|
5394
|
-
let t = new
|
|
5423
|
+
async function Ti(e = {}) {
|
|
5424
|
+
let t = new wi(e);
|
|
5395
5425
|
return await t.connect(), t;
|
|
5396
5426
|
}
|
|
5397
|
-
function
|
|
5398
|
-
let t = new
|
|
5427
|
+
function Ei(e = {}) {
|
|
5428
|
+
let t = new wi(e);
|
|
5399
5429
|
return {
|
|
5400
5430
|
client: t,
|
|
5401
5431
|
connect: async () => {
|
|
@@ -5403,10 +5433,10 @@ function Si(e = {}) {
|
|
|
5403
5433
|
}
|
|
5404
5434
|
};
|
|
5405
5435
|
}
|
|
5406
|
-
var
|
|
5407
|
-
createM8Client:
|
|
5408
|
-
createM8ClientSync:
|
|
5409
|
-
},
|
|
5436
|
+
var Di = {
|
|
5437
|
+
createM8Client: Ti,
|
|
5438
|
+
createM8ClientSync: Ei
|
|
5439
|
+
}, Oi = [
|
|
5410
5440
|
{
|
|
5411
5441
|
role: "background",
|
|
5412
5442
|
label: "BACKGROUND"
|
|
@@ -5459,7 +5489,7 @@ var Ci = {
|
|
|
5459
5489
|
role: "meterPeak",
|
|
5460
5490
|
label: "METER PEAK"
|
|
5461
5491
|
}
|
|
5462
|
-
],
|
|
5492
|
+
], ki = "themesettings", Ai = (e) => e.replace(/\s+/g, "").toUpperCase(), ji = (e) => Math.max(0, Math.min(255, Math.round(e))).toString(16).padStart(2, "0"), Mi = (e, t, n) => `#${ji(e)}${ji(t)}${ji(n)}`, Ni = (e, t, n) => {
|
|
5463
5493
|
let r = e / 256 * 6, i = t / 255, a = n / 255, o = Math.floor(r) % 6, s = r - Math.floor(r), c = a * (1 - i), l = a * (1 - s * i), u = a * (1 - (1 - s) * i), [d, f, p] = [
|
|
5464
5494
|
[
|
|
5465
5495
|
a,
|
|
@@ -5492,14 +5522,14 @@ var Ci = {
|
|
|
5492
5522
|
l
|
|
5493
5523
|
]
|
|
5494
5524
|
][o];
|
|
5495
|
-
return
|
|
5496
|
-
},
|
|
5497
|
-
function
|
|
5525
|
+
return Mi(d * 255, f * 255, p * 255);
|
|
5526
|
+
}, Pi = new Map(Oi.map(({ role: e, label: t }) => [Ai(t), e]));
|
|
5527
|
+
function Fi(e) {
|
|
5498
5528
|
let t = "rgb", n = null, r = {};
|
|
5499
5529
|
for (let i of e.lines) {
|
|
5500
5530
|
let e = i.replace(/[{}]/g, "0"), a = /^\s*MODE\s+([A-Z])\s+([A-Z])\s+([A-Z])\b/i.exec(e);
|
|
5501
5531
|
if (a) {
|
|
5502
|
-
t =
|
|
5532
|
+
t = Ai(a.slice(1).join("")) === "HSV" ? "hsv" : "rgb";
|
|
5503
5533
|
continue;
|
|
5504
5534
|
}
|
|
5505
5535
|
let o = /^\s*THEME\s+NAME\s+(\S.*?)\s*$/i.exec(e);
|
|
@@ -5510,23 +5540,23 @@ function ji(e) {
|
|
|
5510
5540
|
}
|
|
5511
5541
|
let s = /^\s*([A-Z][A-Z:/. ]*?)\s+([0-9A-F]{2})\s+([0-9A-F]{2})\s+([0-9A-F]{2})(?:\s|$)/i.exec(e);
|
|
5512
5542
|
if (!s) continue;
|
|
5513
|
-
let c =
|
|
5543
|
+
let c = Pi.get(Ai(s[1]));
|
|
5514
5544
|
if (!c || r[c]) continue;
|
|
5515
5545
|
let [l, u, d] = s.slice(2, 5).map((e) => parseInt(e, 16));
|
|
5516
|
-
r[c] = t === "hsv" ?
|
|
5546
|
+
r[c] = t === "hsv" ? Ni(l, u, d) : Mi(l, u, d);
|
|
5517
5547
|
}
|
|
5518
|
-
return
|
|
5548
|
+
return Oi.some(({ role: e }) => !r[e]) ? null : {
|
|
5519
5549
|
colors: r,
|
|
5520
5550
|
mode: t,
|
|
5521
5551
|
name: n
|
|
5522
5552
|
};
|
|
5523
5553
|
}
|
|
5524
|
-
var
|
|
5525
|
-
function
|
|
5526
|
-
let t = {}, n =
|
|
5554
|
+
var Ii = (e) => e ? Mi(e.r, e.g, e.b) : void 0;
|
|
5555
|
+
function Li(e) {
|
|
5556
|
+
let t = {}, n = Ii(e.backgroundColor), r = Ii(e.titleColor);
|
|
5527
5557
|
return n && (t.background = n), r && (t.textTitles = r), t;
|
|
5528
5558
|
}
|
|
5529
5559
|
//#endregion
|
|
5530
|
-
export {
|
|
5560
|
+
export { z as M8KeyMask, j as M8_AUDIO_CAPTURE_CONSTRAINTS, Oi as M8_THEME_ROLES, ki as M8_THEME_VIEW, Qn as RELATIVE_FX_RULE, Hr as SCREEN_MARGIN, hi as YAM8D_FRAME_NAME, F as createM8Audio, Ti as createM8Client, Ei as createM8ClientSync, A as createM8Connection, bn as createM8Engine, Di as default, ri as describeContext, ni as describeContextParts, mi as formatFieldValue, Si as getDeviceSupport, Zn as getInstrumentFxCommands, P as getM8InputStream, ti as getSemanticContext, Xn as lookupFxCommand, Li as observeThemeColors, qr as parseGridScreen, Fi as parseThemeScreen, Nr as parseViewTitle, Re as pressKeys, Yr as readPlayPositions };
|
|
5531
5561
|
|
|
5532
5562
|
//# sourceMappingURL=index.js.map
|