@yam8d/m8-sdk 0.5.5 → 0.5.7
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 +805 -803
- package/dist/index.js +712 -662
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/types/engine/cursorTargets.d.ts +7 -0
- package/types/fxInsight.d.ts +39 -15
package/dist/index.js
CHANGED
|
@@ -517,11 +517,11 @@ var D = (e) => {
|
|
|
517
517
|
let { terminated: n, data: r } = await e();
|
|
518
518
|
if (r && t.dispatch(r, r.byteLength), n) break;
|
|
519
519
|
}
|
|
520
|
-
},
|
|
520
|
+
}, ee = {
|
|
521
521
|
serial: "Web Serial",
|
|
522
522
|
usb: "WebUSB",
|
|
523
523
|
midi: "Web MIDI"
|
|
524
|
-
},
|
|
524
|
+
}, k = () => {
|
|
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) => {
|
|
@@ -609,7 +609,7 @@ var D = (e) => {
|
|
|
609
609
|
available: o,
|
|
610
610
|
connect: async ({ transport: e = "auto", prompt: s = !0 } = {}) => {
|
|
611
611
|
let c = e === "auto" ? t ? "serial" : n ? "usb" : "midi" : e;
|
|
612
|
-
if (!o[c]) throw Error(`This browser does not support ${
|
|
612
|
+
if (!o[c]) throw Error(`This browser does not support ${ee[c]}`);
|
|
613
613
|
let l = await (c === "serial" ? i(s) : c === "usb" ? r(s) : a(s)), u = d(), f = !1, p = O(l.reader, u);
|
|
614
614
|
return {
|
|
615
615
|
transport: l.transport,
|
|
@@ -1005,7 +1005,33 @@ var D = (e) => {
|
|
|
1005
1005
|
last: i,
|
|
1006
1006
|
numberWidth: n
|
|
1007
1007
|
};
|
|
1008
|
-
}, ve =
|
|
1008
|
+
}, ve = [
|
|
1009
|
+
"song",
|
|
1010
|
+
"chain",
|
|
1011
|
+
"phrase"
|
|
1012
|
+
], ye = Object.fromEntries(Object.entries(I.views).flatMap(([e, t]) => ve.includes(e) && t.columns ? [[e, t.columns]] : [])), be = (e) => !!e && e in ye, xe = (e, t, n) => {
|
|
1013
|
+
let r = e ? ye[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 = F(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
|
+
}, Se = (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
|
+
}, Ce = (e, t) => Math.round((e.y - t.offY) / t.cellH), we = (e, t) => Math.round(e / t.cellW) >= 40 ? he : null, Te = (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(" "), Ee = (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
|
+
}), De = (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
|
+
}, Oe = (e, t, n) => {
|
|
1071
|
+
let r = Ce(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
|
+
}, ke = (e, t, n, r) => Math.max(0, Math.min(t, r) - Math.max(e, n)), Ae = (e, t, n) => ke(e.x, e.x + e.w, t.x, t.x + t.w) >= Math.min(n.cellW, t.w) / 2, je = (e, t, n) => ke(e.y, e.y + e.h, t.y, t.y + t.h) >= Math.min(n.cellH, t.h) / 2, Me = (e, t, n) => Ae(e, t, n) && je(e, t, n), Ne = (e) => ({
|
|
1048
1074
|
x: e.x + e.w / 2,
|
|
1049
1075
|
y: e.y + e.h / 2
|
|
1050
|
-
}),
|
|
1051
|
-
let n =
|
|
1076
|
+
}), Pe = (e, t) => {
|
|
1077
|
+
let n = Ne(e), r = Ne(t), i = Math.max(0, Math.abs(n.x - r.x) - (e.w + t.w) / 2 + fe), a = Math.max(0, Math.abs(n.y - r.y) - (e.h + t.h) / 2 + fe);
|
|
1052
1078
|
return Math.hypot(i, a) + .01 * Math.hypot(n.x - r.x, n.y - r.y);
|
|
1053
|
-
},
|
|
1079
|
+
}, Fe = (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
|
+
}), Ie = (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
|
+
}), Le = (e, t, n) => e.kind === "cell" && F(t) === e.id || Me(t, e.rect, n), Re = (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(Ce(i, n)) && Oe(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 = Ee(e, t, n);
|
|
1098
|
+
return o.some((e) => Me(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: De(t, n, r, s).filter((e) => a(e.row) && !c(e))
|
|
1077
1103
|
};
|
|
1078
|
-
},
|
|
1079
|
-
let { cells: c, runs: l } =
|
|
1104
|
+
}, ze = (e, t, n, r, i, a = null, o = /* @__PURE__ */ new Set(), s = !1) => {
|
|
1105
|
+
let { cells: c, runs: l } = Re(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: Ee(n.row, i, r),
|
|
1094
1120
|
run: n.rect,
|
|
1095
1121
|
row: n.row
|
|
1096
1122
|
},
|
|
@@ -1100,7 +1126,7 @@ 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 } =
|
|
1129
|
+
let { dx: n, dy: i } = Fe(e, t);
|
|
1104
1130
|
if (i > 0 || n > me * r.cellW) return !1;
|
|
1105
1131
|
let a = Math.round((t.x - r.offX) / r.cellW);
|
|
1106
1132
|
if (a <= p) return !0;
|
|
@@ -1108,17 +1134,17 @@ var D = (e) => {
|
|
|
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 } = Fe(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 * pe) - (t.kind === "cell" ? .001 : 0) - (a ? .5 : 0), c =
|
|
1139
|
+
let a = n.x > e.x, o = Math.hypot(r, i * pe) - (t.kind === "cell" ? .001 : 0) - (a ? .5 : 0), c = Ne(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 ?? Ie(e);
|
|
1147
|
+
}, L = {
|
|
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
|
+
}, Be = ({ 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 |= L.Left), t && (c |= L.Right), n && (c |= L.Up), r && (c |= L.Down), i && (c |= L.Shift), a && (c |= L.Play), o && (c |= L.Opt), s && (c |= L.Edit), c;
|
|
1159
|
+
}, Ve = {
|
|
1160
|
+
up: L.Up,
|
|
1161
|
+
down: L.Down,
|
|
1162
|
+
left: L.Left,
|
|
1163
|
+
right: L.Right
|
|
1164
|
+
}, He = L.Up | L.Down | L.Left | L.Right, Ue = L.Edit | L.Opt | L.Shift | L.Play, We = He | L.Edit | L.Opt | L.Shift, Ge = 48, Ke = 40, qe = 16, Je = 4, Ye = 150, Xe = 300, Ze = 200, Qe = (e, t) => !!e && !!t && e.x === t.x && e.y === t.y && e.w === t.w && e.h === t.h, $e = (e) => {
|
|
1165
|
+
if (e & Ue) return null;
|
|
1166
|
+
let t = Object.keys(Ve).filter((t) => e & Ve[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
|
+
}, et = ({ bus: e, store: t, getScreenLines: n = () => [], cursorMap: r = oe() }) => {
|
|
1169
|
+
let i = null, a = 0, o = 0, s = !1, c = null, l = null, u = () => t.get("cellMetrics"), d = () => we(t.get("systemInfo")?.screenWidth ?? 480, u()), f = () => {
|
|
1144
1170
|
let e = t.get("cursorRect");
|
|
1145
|
-
return e ?
|
|
1171
|
+
return e ? Se(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
|
+
Te(n(), d())
|
|
1155
1181
|
].join("|");
|
|
1156
1182
|
}, m = () => {
|
|
1157
1183
|
c &&= (clearTimeout(c), null);
|
|
1158
|
-
}, h = (e =
|
|
1184
|
+
}, h = (e = Ye) => {
|
|
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 & ~We, 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 | Ve[t]), e.commands.sendKeys(o);
|
|
1194
|
+
}, v = (e, t, n) => e.goal.kind === "cell" ? t === e.goal.id : !!n && Le(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 je(e, t.rect, u()) || n.push(t.rect.y + t.rect.h / 2 < r ? "up" : "down"), Ae(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 = Ce(t, u());
|
|
1174
1200
|
return n === "up" && r <= e.grid.first || n === "down" && r >= e.grid.last;
|
|
1175
|
-
}, x = (e, t) => {
|
|
1176
|
-
let n = F(t),
|
|
1177
|
-
if (
|
|
1178
|
-
let t = de(
|
|
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 = F(t), r = x(e);
|
|
1203
|
+
if (r) {
|
|
1204
|
+
let t = de(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 >= Ke || 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 = Pe(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 && !se(t,
|
|
1198
|
-
dir:
|
|
1222
|
+
let n = r?.cells.get(l);
|
|
1223
|
+
if (n && !se(t, s, n) && Pe(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 >= Ke ? null : {
|
|
1229
|
+
dir: s,
|
|
1204
1230
|
expected: void 0,
|
|
1205
1231
|
guessed: !0
|
|
1206
1232
|
};
|
|
1207
1233
|
}
|
|
1208
|
-
return
|
|
1209
|
-
},
|
|
1234
|
+
return o;
|
|
1235
|
+
}, C = (e, t, n) => {
|
|
1210
1236
|
_(n.dir), e.steps += 1, n.guessed && (e.explored += 1), e.tried.add(`${F(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" && Me(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 = je(t, a, u()), s = a.x + a.w / 2 < t.x + t.w / 2, c = Ce(t, u()), l = i < c ? "up" : "down", f = Math.abs(i - c) === 1 && x(e)?.moves.get(F(t))?.[l] === null, p = o || f ? Re(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 = ze(e.point, x(e), n(), u(), d(), e.grid, e.failedTexts, !0);
|
|
1253
|
+
if (e.goals < Je && 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 = Re(x(e), n(), u(), d(), e.grid).cells, s = t;
|
|
1264
|
+
if (o.length > 0) for (let e of o) Pe(e.rect, a) < Pe(s, a) - 1e-6 && (s = e.rect);
|
|
1265
|
+
else for (let t of e.visited.values()) Pe(t, e.goal.rect) < Pe(s, e.goal.rect) - 1e-6 && (s = t);
|
|
1266
|
+
if (!Qe(s, t)) {
|
|
1241
1267
|
e.goal, e.phase = "return", e.goal = {
|
|
1242
1268
|
kind: "cell",
|
|
1243
1269
|
id: F(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 (Le(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" ? Ge : qe)) {
|
|
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 < Ke);
|
|
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);
|
|
1297
|
+
e.layoutKey && i === e.layoutKey && !e.fixed && r.recordMove(e.layoutKey, t.from, t.dir, n);
|
|
1272
1298
|
let a = n ? F(n) : null;
|
|
1273
1299
|
!t.guessed && t.expected !== void 0 && a !== t.expected && e.distrust.add(`${F(t.from)}:${t.dir}`), n && e.visited.set(F(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 (!Qe(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(Xe);
|
|
1285
1311
|
return;
|
|
1286
|
-
} else if (e === "timeout")
|
|
1287
|
-
|
|
1312
|
+
} else if (e === "timeout") {
|
|
1313
|
+
let e = `${F(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 & ~We;
|
|
1326
|
+
let t = $e(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
|
+
}, ee = () => {
|
|
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 || be(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 <= Ze)) {
|
|
1345
|
+
let t = n();
|
|
1346
|
+
!Qe(o.from, e) && Oe(o.from, t, u()) && Oe(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 k = t.sub("cursorRect",
|
|
1349
|
+
e.protocol.eventBus.on("key", O);
|
|
1350
|
+
let k = t.sub("cursorRect", ee);
|
|
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 = _e(t.get("viewName"), v), b = _ ? xe(t.get("viewName"), y, u()) : null, x = b?.cells.has(F(m)) ? b : null, S = x ?? (_ ? r.get(_) : void 0), C = t.get("selectionMode") ? Ie(e) : ze(e, S, v, u(), d(), y);
|
|
1364
|
+
_ && !x && Oe(m, v, u()) && r.recordCell(_, m), g || (o = a & ~We), 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,6 +1374,7 @@ 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
1379
|
visited: /* @__PURE__ */ new Map([[F(m), m]]),
|
|
1350
1380
|
failedTexts: /* @__PURE__ */ new Set(),
|
|
@@ -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), k();
|
|
1362
1392
|
}
|
|
1363
1393
|
};
|
|
1364
|
-
},
|
|
1394
|
+
}, R = (e) => e?.trim().toLowerCase() ?? "", tt = /\.m[a-z0-9]{2}$/i, nt = (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("|"), rt = (e) => e.textUnderCursor?.trim() || e.currentLine?.trim() || null, it = (e) => {
|
|
1402
|
+
let t = R(e.viewName), n = R(e.viewTitle);
|
|
1373
1403
|
return t.includes("load") || t.includes("save") || n.includes("load") || n.includes("save");
|
|
1374
|
-
},
|
|
1404
|
+
}, at = (e) => R(e) === "/..", ot = (e) => !!e?.trim().startsWith("/"), st = (e) => !!e && !ot(e) && tt.test(e.trim()), ct = (e) => {
|
|
1375
1405
|
let t = e?.trim() ?? "";
|
|
1376
1406
|
if (!t) return [];
|
|
1377
|
-
let n =
|
|
1407
|
+
let n = R(t), r = R(t.replace(tt, ""));
|
|
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
|
+
}, lt = (e) => at(e) ? "parent" : ot(e) ? /^\/[^/]+$/.test(e.trim()) ? "dir" : "other" : st(e) ? "file" : "other", ut = (e, t) => {
|
|
1410
|
+
let n = (t) => e[t]?.trim() ?? "", r = t.cursorPos?.y ?? null, i = R(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 && R(t) === i || s.push({
|
|
1389
1419
|
row: e,
|
|
1390
1420
|
text: t,
|
|
1391
|
-
key:
|
|
1392
|
-
kind:
|
|
1421
|
+
key: R(t),
|
|
1422
|
+
kind: lt(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
|
+
}, dt = (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
|
+
}, ft = (e) => e.split(/[^a-z0-9]+/).filter((e) => e.length >= 3), pt = /* @__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
|
+
]), mt = (e, t) => ({
|
|
1475
|
+
target: ft(R(e).replace(tt, "")),
|
|
1476
|
+
title: ft(R(t)).filter((e) => !pt.has(e))
|
|
1477
|
+
}), ht = (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
|
+
}, z = (e) => new Promise((t) => setTimeout(t, e)), gt = ({ 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 z(t), a(0), await z(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 = nt(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
|
+
nt(e) !== f && p(e);
|
|
1499
1529
|
}, h = c();
|
|
1500
|
-
|
|
1530
|
+
nt(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
|
+
}, B = (e, t) => {
|
|
1507
1537
|
t === void 0 ? console.log("[M8SDK browseFile]", e) : console.log("[M8SDK browseFile]", e, t);
|
|
1508
|
-
},
|
|
1538
|
+
}, _t = 8, vt = 8, yt = 64, bt = 512, xt = () => ({
|
|
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
|
+
}), St = (e) => e === "up" ? "down" : "up", Ct = (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 = R(e);
|
|
1523
1553
|
if (!u) return !1;
|
|
1524
|
-
let d =
|
|
1525
|
-
|
|
1554
|
+
let d = tt.test(u), f = mt(e, r().viewTitle);
|
|
1555
|
+
B("start", {
|
|
1526
1556
|
targetText: e,
|
|
1527
1557
|
normalizedTarget: u,
|
|
1528
1558
|
exact: l
|
|
1529
1559
|
});
|
|
1530
|
-
let p = () =>
|
|
1560
|
+
let p = () => it(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: nt(o) !== nt(a),
|
|
1536
1566
|
snapshot: o
|
|
1537
1567
|
};
|
|
1538
|
-
}, h = (e) => e === "up" ?
|
|
1568
|
+
}, h = (e) => e === "up" ? L.Up : L.Down, g = (e) => L.Opt | h(e), _ = async () => {
|
|
1539
1569
|
let e = r();
|
|
1540
|
-
|
|
1541
|
-
}, v = (e) =>
|
|
1570
|
+
B("apply alphabetical sort"), await n(L.Shift | L.Opt, 35), await z(180), await i(e, 300);
|
|
1571
|
+
}, v = (e) => st(e) ? ct(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(tt, "");
|
|
1574
|
+
}, b = (e) => R(y(e)), x = y(e), S = async () => {
|
|
1545
1575
|
for (let e = 0;; e += 1) {
|
|
1546
|
-
let t =
|
|
1576
|
+
let t = ut(a(), r());
|
|
1547
1577
|
if (t.consistent || e >= 2) return t;
|
|
1548
|
-
await
|
|
1578
|
+
await z(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 = dt(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 = R(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(vt, 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 < _t; 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, B("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 < _t && (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) >= _t ? g(i) : h(i), 250)).changed) return null;
|
|
1590
1620
|
r = await S(), C(e, r);
|
|
1591
1621
|
continue;
|
|
1592
1622
|
}
|
|
@@ -1594,40 +1624,40 @@ 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 = St(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 = rt(r());
|
|
1634
|
+
return a && v(o) ? (B("match found", {
|
|
1605
1635
|
entry: o,
|
|
1606
1636
|
y: a.cursorRow
|
|
1607
|
-
}), await m(
|
|
1637
|
+
}), await m(L.Edit, 500), "found") : (B("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 {
|
|
1611
1641
|
ci: b(n),
|
|
1612
1642
|
raw: y(n)
|
|
1613
1643
|
};
|
|
1614
|
-
}),
|
|
1644
|
+
}), ee = (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, B("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: R(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
|
+
}, k = (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), te = (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;
|
|
@@ -1635,20 +1665,20 @@ var D = (e) => {
|
|
|
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 = ht(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
|
-
}, M = async (e, t) => await E(e, "/..", t) ? (
|
|
1646
|
-
if (e >
|
|
1675
|
+
}, M = async (e, t) => await E(e, "/..", t) ? (B("navigate to parent directory"), (await m(L.Edit, 500)).changed && p()) : (B("parent directory entry unreachable"), !1), N = async (e) => {
|
|
1676
|
+
if (e > yt || !p()) return B("search aborted", {
|
|
1647
1677
|
depth: e,
|
|
1648
1678
|
active: p()
|
|
1649
1679
|
}), "aborted";
|
|
1650
|
-
let t =
|
|
1651
|
-
C(t, n),
|
|
1680
|
+
let t = xt(), n = await S();
|
|
1681
|
+
C(t, n), B("search directory", {
|
|
1652
1682
|
depth: e,
|
|
1653
1683
|
entries: n.entries.length,
|
|
1654
1684
|
complete: t.top && t.bottom
|
|
@@ -1656,7 +1686,7 @@ 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)),
|
|
1689
|
+
if (i === "failed" && (n = await S(), C(t, n)), ee(t), k(t) && (B("rest of listing is past the target", { depth: e }), t.bottom = !0), t.top && t.bottom || r >= bt) break;
|
|
1660
1690
|
let a = await w(t, n, A(t, n));
|
|
1661
1691
|
a && (n = a);
|
|
1662
1692
|
}
|
|
@@ -1664,14 +1694,14 @@ var D = (e) => {
|
|
|
1664
1694
|
let r = j(t, n);
|
|
1665
1695
|
if (!r) break;
|
|
1666
1696
|
if (t.visited.add(r), !await E(t, r, n)) {
|
|
1667
|
-
|
|
1697
|
+
B("directory unreachable", { directory: r }), n = await S(), C(t, n);
|
|
1668
1698
|
continue;
|
|
1669
1699
|
}
|
|
1670
|
-
|
|
1700
|
+
B("enter directory", {
|
|
1671
1701
|
directory: r,
|
|
1672
1702
|
depth: e
|
|
1673
1703
|
});
|
|
1674
|
-
let i = await m(
|
|
1704
|
+
let i = await m(L.Edit, 500);
|
|
1675
1705
|
if (!p()) return "aborted";
|
|
1676
1706
|
if (!i.changed) {
|
|
1677
1707
|
n = await S(), C(t, n);
|
|
@@ -1686,12 +1716,12 @@ var D = (e) => {
|
|
|
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
1718
|
let P = await N(0);
|
|
1689
|
-
return P !== "found" &&
|
|
1719
|
+
return P !== "found" && B("search failed", {
|
|
1690
1720
|
targetText: e,
|
|
1691
1721
|
outcome: P
|
|
1692
1722
|
}), P === "found";
|
|
1693
1723
|
};
|
|
1694
|
-
},
|
|
1724
|
+
}, wt = (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
|
+
}, Tt = (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
|
+
}, Et = /[+-]?\d+\.\d+/g, Dt = (e) => {
|
|
1711
1741
|
if (!e) return [];
|
|
1712
1742
|
let t = [];
|
|
1713
|
-
|
|
1714
|
-
let n =
|
|
1743
|
+
Et.lastIndex = 0;
|
|
1744
|
+
let n = Et.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 = Et.exec(e);
|
|
1726
1756
|
}
|
|
1727
1757
|
return t;
|
|
1728
|
-
},
|
|
1758
|
+
}, Ot = (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
|
+
}, kt = (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
|
+
}, At = (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, jt = (e, t, n) => {
|
|
1749
1779
|
let r = n?.trim() ?? "";
|
|
1750
|
-
return !r || !e[t] ||
|
|
1751
|
-
},
|
|
1780
|
+
return !r || !e[t] || At(e[t], r) ? !1 : e.some((e, n) => n !== t && At(e, r));
|
|
1781
|
+
}, V = (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
|
+
}, Mt = [
|
|
1755
1785
|
"C-",
|
|
1756
1786
|
"C#",
|
|
1757
1787
|
"D-",
|
|
@@ -1764,35 +1794,35 @@ var D = (e) => {
|
|
|
1764
1794
|
"A-",
|
|
1765
1795
|
"A#",
|
|
1766
1796
|
"B-"
|
|
1767
|
-
],
|
|
1797
|
+
], H = (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 = Mt.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
|
+
}, Nt = (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 = Dt(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 = Dt(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 = Ot(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
|
-
if (p.ticks === m) return n("[M8SDK] Already at target float value:",
|
|
1795
|
-
n("[M8SDK] Setting float value from",
|
|
1824
|
+
if (p.ticks === m) return n("[M8SDK] Already at target float value:", V(m, l)), !0;
|
|
1825
|
+
n("[M8SDK] Setting float value from", V(p.ticks, l), "to", V(m, l)), await a(L.Edit), await z(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 = kt(p, t.get("textUnderCursor")) ?? "int";
|
|
1810
1840
|
n("[M8SDK] Float cursor focus:", y);
|
|
1811
|
-
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,
|
|
1812
|
-
let n = e === "upDown" ?
|
|
1813
|
-
return
|
|
1814
|
-
},
|
|
1815
|
-
let a = g[y][e], o =
|
|
1816
|
-
for (let e = 0; e < r; e++) i(o), await
|
|
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, ee = (e, t) => {
|
|
1842
|
+
let n = e === "upDown" ? L.Up : L.Right, r = e === "upDown" ? L.Down : L.Left;
|
|
1843
|
+
return L.Edit | (t >= 0 ? n : r);
|
|
1844
|
+
}, k = async (e, n, r) => {
|
|
1845
|
+
let a = g[y][e], o = ee(e, n * a.bias), c = t.get("currentLine");
|
|
1846
|
+
for (let e = 0; e < r; e++) i(o), await z(22);
|
|
1817
1847
|
await s(c, 350);
|
|
1818
1848
|
}, te = async (e) => {
|
|
1819
|
-
let n = () =>
|
|
1849
|
+
let n = () => kt(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" ? L.Right : L.Left, s = e === "dec" ? L.Left : L.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 (jt(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
|
}
|
|
@@ -1849,7 +1879,7 @@ var D = (e) => {
|
|
|
1849
1879
|
if (C = S, S = e.ticks, y !== "full" && !b) {
|
|
1850
1880
|
let e = i >= _ ? "int" : "dec";
|
|
1851
1881
|
if (e !== y && !await te(e)) {
|
|
1852
|
-
if (
|
|
1882
|
+
if (jt(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,16 +1888,16 @@ 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,
|
|
1862
|
-
await
|
|
1891
|
+
let v = r > 0 ? 1 : -1, ee = e.ticks, A = y, j = p;
|
|
1892
|
+
await k(p, v, h);
|
|
1863
1893
|
let M = d();
|
|
1864
1894
|
if (!M) {
|
|
1865
1895
|
O = !0;
|
|
1866
1896
|
break;
|
|
1867
1897
|
}
|
|
1868
|
-
let N = M.ticks -
|
|
1898
|
+
let N = M.ticks - ee;
|
|
1869
1899
|
if (N === 0) {
|
|
1870
|
-
E += 1, E >= 4 && (console.warn(`[M8SDK] Float value stopped reacting at ${
|
|
1900
|
+
E += 1, E >= 4 && (console.warn(`[M8SDK] Float value stopped reacting at ${V(M.ticks, l)} (target ${V(m, l)} may be out of range)`), O = !0);
|
|
1871
1901
|
continue;
|
|
1872
1902
|
}
|
|
1873
1903
|
E = 0;
|
|
@@ -1884,16 +1914,16 @@ var D = (e) => {
|
|
|
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 k(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(
|
|
1922
|
+
x || await a(L.Edit);
|
|
1893
1923
|
let A = d(), j = !!A && A.ticks === m;
|
|
1894
|
-
return n(`[M8SDK] Float setting ${j ? "succeeded" : "failed"}: "${A?.raw ?? "N/A"}" (${A ?
|
|
1924
|
+
return n(`[M8SDK] Float setting ${j ? "succeeded" : "failed"}: "${A?.raw ?? "N/A"}" (${A ? V(A.ticks, l) : "N/A"})`), j;
|
|
1895
1925
|
};
|
|
1896
|
-
},
|
|
1926
|
+
}, Pt = {
|
|
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
|
+
}, Ft = { 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(".") }, It = (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
|
+
}, Lt = null, Rt = null, zt = () => (Lt ??= It(Pt), Lt), Bt = () => {
|
|
2410
|
+
if (!Rt) {
|
|
2411
|
+
let e = Array.isArray(Ft.views) ? Ft.views : [];
|
|
2412
|
+
Rt = new Set(e.map((e) => String(e).trim().toLowerCase()).filter((e) => !!e));
|
|
2383
2413
|
}
|
|
2384
|
-
return
|
|
2385
|
-
},
|
|
2414
|
+
return Rt;
|
|
2415
|
+
}, Vt = 50, Ht = {
|
|
2386
2416
|
x: 0,
|
|
2387
2417
|
y: 0,
|
|
2388
2418
|
w: 1,
|
|
2389
2419
|
h: 1
|
|
2390
|
-
},
|
|
2420
|
+
}, Ut = class {
|
|
2391
2421
|
constructor() {
|
|
2392
|
-
this.assemblies = [], this.selectionRectSamples = [], this.lastCursor =
|
|
2422
|
+
this.assemblies = [], this.selectionRectSamples = [], this.lastCursor = Ht, 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 Ht;
|
|
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
|
+
}, Wt = (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 Gt(e, t) {
|
|
2637
|
+
let n = new Ut();
|
|
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(Bt());
|
|
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
|
+
}, Vt)));
|
|
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(Wt(t?.fg)), o.push(Wt(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 && Wt(l) !== Wt(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 Kt = (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
|
+
}, qt = (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
|
+
}, Jt = (e) => Be({
|
|
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
|
+
}), Yt = ({ 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(qt(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(Jt(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(Jt(e));
|
|
2882
2912
|
}),
|
|
2883
|
-
getState: async () =>
|
|
2913
|
+
getState: async () => Kt(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
|
+
}, Xt = 6, Zt = (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 % Xt === 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
|
+
}, Qt = (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 ? L.Up : L.Down, s = L.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 ? L.Right : L.Left, t = L.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
|
+
}, $t = (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 ? L.Up : L.Down;
|
|
3035
|
+
n.push(L.Edit | e), n.push(0), r += i * 12;
|
|
3006
3036
|
} else {
|
|
3007
|
-
let e = i > 0 ?
|
|
3008
|
-
n.push(
|
|
3037
|
+
let e = i > 0 ? L.Right : L.Left;
|
|
3038
|
+
n.push(L.Edit | e), n.push(0), r += i;
|
|
3009
3039
|
}
|
|
3010
3040
|
if (n.length > 2048) break;
|
|
3011
3041
|
}
|
|
3012
3042
|
return n;
|
|
3013
|
-
},
|
|
3043
|
+
}, en = (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 = wt(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(L.Edit), await o(e, 250);
|
|
3058
|
+
let r = t.get("textUnderCursor"), i = wt(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(L.Edit), !1;
|
|
3030
3060
|
u = i;
|
|
3031
3061
|
} else {
|
|
3032
3062
|
let e = s;
|
|
3033
|
-
await a(
|
|
3063
|
+
await a(L.Edit), await o(e, 250);
|
|
3034
3064
|
}
|
|
3035
|
-
let d =
|
|
3065
|
+
let d = Qt(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 z(30);
|
|
3038
3068
|
await o(s, 250);
|
|
3039
|
-
let f = t.get("textUnderCursor"), p =
|
|
3069
|
+
let f = t.get("textUnderCursor"), p = wt(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 ? L.Up : L.Down, t = L.Edit | e;
|
|
3047
3077
|
await a(t);
|
|
3048
3078
|
} else if (s > 0) {
|
|
3049
|
-
let e = c > 0 ?
|
|
3079
|
+
let e = c > 0 ? L.Right : L.Left, t = L.Edit | e;
|
|
3050
3080
|
await a(t);
|
|
3051
3081
|
}
|
|
3052
3082
|
await o(l, 250);
|
|
3053
|
-
let u =
|
|
3083
|
+
let u = wt(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 = wt(t.get("textUnderCursor"));
|
|
3057
3087
|
}
|
|
3058
|
-
await a(
|
|
3088
|
+
await a(L.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 = Tt(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(L.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 ? L.Up : L.Down;
|
|
3104
|
+
await a(L.Edit | e, 35);
|
|
3075
3105
|
} else {
|
|
3076
|
-
let e = i > 0 ?
|
|
3077
|
-
await a(
|
|
3106
|
+
let e = i > 0 ? L.Right : L.Left;
|
|
3107
|
+
await a(L.Edit | e, 35);
|
|
3078
3108
|
}
|
|
3079
3109
|
await o(d, 250);
|
|
3080
|
-
let p =
|
|
3110
|
+
let p = Tt(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 ? L.Up : L.Down;
|
|
3124
|
+
await a(L.Edit | e, 35);
|
|
3095
3125
|
} else {
|
|
3096
|
-
let e = r > 0 ?
|
|
3097
|
-
await a(
|
|
3126
|
+
let e = r > 0 ? L.Right : L.Left;
|
|
3127
|
+
await a(L.Edit | e, 35);
|
|
3098
3128
|
}
|
|
3099
3129
|
await o(i, 250);
|
|
3100
|
-
let l =
|
|
3130
|
+
let l = Tt(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(L.Edit), Tt(t.get("textUnderCursor")) === e;
|
|
3106
3136
|
},
|
|
3107
3137
|
setNote: async (e) => {
|
|
3108
3138
|
if (!r()) return !1;
|
|
@@ -3110,27 +3140,27 @@ 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(L.Opt | L.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(L.Opt | L.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;
|
|
3119
3149
|
}
|
|
3120
|
-
let c =
|
|
3150
|
+
let c = H(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(
|
|
3124
|
-
let u =
|
|
3153
|
+
(l?.trim() === "---" || l?.trim().toUpperCase() === "OFF") && (n("[M8SDK] Initial note is \"---\" or \"OFF\", priming with edit key"), await a(L.Edit), await o(l, 250), l = t.get("textUnderCursor"));
|
|
3154
|
+
let u = H(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(L.Edit), await o(l, 250);
|
|
3158
|
+
let d = $t(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 z(25);
|
|
3131
3161
|
await o(l, 280);
|
|
3132
|
-
let e =
|
|
3133
|
-
if (e?.semitoneIndex === c.semitoneIndex) return await a(
|
|
3162
|
+
let e = H(t.get("textUnderCursor"));
|
|
3163
|
+
if (e?.semitoneIndex === c.semitoneIndex) return await a(L.Edit), !0;
|
|
3134
3164
|
u = e ?? u;
|
|
3135
3165
|
}
|
|
3136
3166
|
let f = /* @__PURE__ */ new Set();
|
|
@@ -3139,42 +3169,42 @@ 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(
|
|
3144
|
-
let m =
|
|
3172
|
+
let n = Math.abs(e) >= 12, r = e > 0, i = n ? r ? L.Up : L.Down : r ? L.Right : L.Left, s = n ? r ? L.Down : L.Up : r ? L.Left : L.Right, l = u, d = Math.abs(l.semitoneIndex - c.semitoneIndex), p = t.get("textUnderCursor");
|
|
3173
|
+
await a(L.Edit | i, 35), await o(p, 250);
|
|
3174
|
+
let m = H(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(
|
|
3149
|
-
let n =
|
|
3178
|
+
await a(L.Edit | s, 35), await o(e, 250);
|
|
3179
|
+
let n = H(t.get("textUnderCursor"));
|
|
3150
3180
|
n && (u = n);
|
|
3151
3181
|
break;
|
|
3152
3182
|
}
|
|
3153
3183
|
if (f.has(u.label)) break;
|
|
3154
3184
|
f.add(u.label);
|
|
3155
3185
|
}
|
|
3156
|
-
return await a(
|
|
3186
|
+
return await a(L.Edit), H(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 = R(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 = R(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(L.Edit), await o(d, 250));
|
|
3169
3199
|
let f = t.get("textUnderCursor");
|
|
3170
|
-
if (await a(
|
|
3200
|
+
if (await a(L.Edit), await o(f, 250), u(l())) return await a(L.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 = R(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(L.Edit | L.Down, 35);
|
|
3187
3217
|
let i = await o(r, 250);
|
|
3188
|
-
if (
|
|
3218
|
+
if (R(i) === R(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(L.Edit), !0;
|
|
3224
|
+
let n = R(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(L.Edit | L.Right, 35), R(await o(r, 250)) === n) break;
|
|
3201
3231
|
}
|
|
3202
|
-
return await a(
|
|
3232
|
+
return await a(L.Edit), !1;
|
|
3203
3233
|
}
|
|
3204
3234
|
};
|
|
3205
|
-
},
|
|
3235
|
+
}, tn = ({ 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
|
+
}, nn = () => ({
|
|
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
|
+
}), rn = (e = {}) => {
|
|
3277
3307
|
let t = {
|
|
3278
|
-
...
|
|
3308
|
+
...nn(),
|
|
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
|
+
}, an = () => 0, on = () => 1;
|
|
3332
|
+
function sn(e, t, n, r = an, i = on) {
|
|
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 cn = 20, ln = 700, un = 80, dn = 4e3, fn = 120, pn = (e, t) => {
|
|
3378
|
+
let n = !!t?.shift, r = L.Shift, i = {
|
|
3379
|
+
up: (n ? r : 0) | L.Up,
|
|
3380
|
+
down: (n ? r : 0) | L.Down,
|
|
3381
|
+
left: (n ? r : 0) | L.Left,
|
|
3382
|
+
right: (n ? r : 0) | L.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
|
+
}, mn = (e) => [{
|
|
3358
3388
|
from: e,
|
|
3359
3389
|
to: "",
|
|
3360
3390
|
kind: "exit",
|
|
3361
|
-
keys: [
|
|
3391
|
+
keys: [L.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: [L.Shift | L.Up, 0]
|
|
3398
|
+
}], hn = (e) => `${e.kind}:${e.dir ?? ""}:${e.keys.join(",")}:${e.cursor ? `${e.cursor.x},${e.cursor.y}` : ""}`, gn = (e) => e[e.length - 1] === 0 ? e.slice() : [...e, 0], _n = "#goal", vn = (e, t) => `${e}<${t}`, yn = (e) => new Promise((t) => setTimeout(t, e)), bn = ({ store: e, runner: t, getScreenLines: n, moveCursor: r }) => {
|
|
3399
|
+
let i = Bt(), 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}|${hn(e)}`, v = (e, t) => {
|
|
3378
3408
|
let n = /* @__PURE__ */ new Map();
|
|
3379
|
-
for (let t of
|
|
3409
|
+
for (let t of zt().graph.get(e) ?? []) {
|
|
3380
3410
|
if (t.kind === "button" && !r) continue;
|
|
3381
|
-
let e =
|
|
3411
|
+
let e = hn(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([[_n, []]]), i = [[e, t]];
|
|
3436
|
+
for (r.set(vn(e, t), []); i.length;) {
|
|
3437
|
+
let [e, t] = i.shift(), a = r.get(vn(e, t));
|
|
3408
3438
|
if (e === n) a.push({
|
|
3409
|
-
to:
|
|
3439
|
+
to: _n,
|
|
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 = vn(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 = sn(y(e, u, t), vn(e, u), _n);
|
|
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 = zt().graph.get(e) ?? [];
|
|
3462
|
+
return r.length && !r.some((e) => e.kind === "exit") ? null : mn(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), yn(dn)]), await yn(fn)), 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(gn(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 >= cn) {
|
|
3498
3528
|
console.warn("Navigation aborted: max steps reached", {
|
|
3499
3529
|
startTitle: r,
|
|
3500
3530
|
goalTitle: n,
|
|
@@ -3529,15 +3559,15 @@ 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 ? gn(i.keys) : pn([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
|
-
},
|
|
3540
|
-
}, O = e.sub("viewName", D),
|
|
3569
|
+
}, ln) : setTimeout(() => w(e.get("viewName") || ""), i ? un : ln));
|
|
3570
|
+
}, O = e.sub("viewName", D), ee = e.sub("macroStatus", D);
|
|
3541
3571
|
return {
|
|
3542
3572
|
navigateToView: (t) => new Promise((n) => {
|
|
3543
3573
|
let r = g(t);
|
|
@@ -3547,10 +3577,10 @@ var tn = 20, nn = 700, rn = 80, an = 4e3, on = 120, sn = (e, t) => {
|
|
|
3547
3577
|
}), E()) : n(!1);
|
|
3548
3578
|
}),
|
|
3549
3579
|
dispose: () => {
|
|
3550
|
-
f(), O(),
|
|
3580
|
+
f(), O(), ee(), c += 1, C(!1);
|
|
3551
3581
|
}
|
|
3552
3582
|
};
|
|
3553
|
-
},
|
|
3583
|
+
}, xn = /* @__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
|
+
]), Sn = (e, t = {}) => {
|
|
3592
|
+
let n = t.store ?? rn(), 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 = Gt(e.protocol.eventBus, n), s = tn({
|
|
3567
3597
|
bus: e,
|
|
3568
3598
|
store: n,
|
|
3569
3599
|
cancelOnKeydown: t.cancelMacroOnKeydown
|
|
3570
|
-
}), c =
|
|
3600
|
+
}), c = et({
|
|
3571
3601
|
bus: e,
|
|
3572
3602
|
store: n,
|
|
3573
3603
|
getScreenLines: o.getScreenLines,
|
|
3574
3604
|
cursorMap: t.cursorMap ?? oe()
|
|
3575
|
-
}), l =
|
|
3605
|
+
}), l = bn({
|
|
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(qt(n, e, t))
|
|
3610
|
+
}), u = Zt((e) => a("transport", e)), d = gt({
|
|
3581
3611
|
getKeySink: () => e.commands,
|
|
3582
3612
|
store: n,
|
|
3583
3613
|
debugLog: r,
|
|
3584
3614
|
getScreenLines: o.getScreenLines
|
|
3585
|
-
}), f =
|
|
3615
|
+
}), f = Yt({
|
|
3586
3616
|
io: d,
|
|
3587
|
-
editors:
|
|
3588
|
-
setValueFloat:
|
|
3589
|
-
browseFile:
|
|
3617
|
+
editors: en(d),
|
|
3618
|
+
setValueFloat: Nt(d),
|
|
3619
|
+
browseFile: Ct(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) => xn.has(e)) && a("stateChanged", Kt(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: () => Kt(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
|
+
}, Cn = {
|
|
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
|
+
}, wn = Cn.views, Tn = Cn.instrumentTypes, En = Cn.instrumentTypeNames, Dn = {};
|
|
3696
|
+
for (let [e, t] of Object.entries(wn)) {
|
|
3667
3697
|
let { extends: n, ...r } = t;
|
|
3668
|
-
|
|
3669
|
-
...
|
|
3698
|
+
Dn[e] = n ? {
|
|
3699
|
+
...wn[n],
|
|
3670
3700
|
...r
|
|
3671
3701
|
} : r;
|
|
3672
3702
|
}
|
|
3673
|
-
function
|
|
3674
|
-
return
|
|
3703
|
+
function On(e) {
|
|
3704
|
+
return Dn[e] ?? null;
|
|
3675
3705
|
}
|
|
3676
|
-
var
|
|
3677
|
-
function
|
|
3678
|
-
let n = e.width ?? e.text?.length ?? 1, r =
|
|
3706
|
+
var U = (e, t, n) => t >= e.length ? "" : e.slice(t, t + n);
|
|
3707
|
+
function kn(e, t) {
|
|
3708
|
+
let n = e.width ?? e.text?.length ?? 1, r = U(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 An(e, t) {
|
|
3682
3712
|
let n = e.sections;
|
|
3683
3713
|
if (!n) return null;
|
|
3684
3714
|
for (let e of t) {
|
|
@@ -3687,57 +3717,57 @@ function wn(e, t) {
|
|
|
3687
3717
|
}
|
|
3688
3718
|
return null;
|
|
3689
3719
|
}
|
|
3690
|
-
function
|
|
3720
|
+
function jn(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");
|
|
3694
3724
|
for (let e of n) {
|
|
3695
|
-
let t =
|
|
3725
|
+
let t = U(e, r.labelX, r.labelWidth).trim();
|
|
3696
3726
|
if (i.test(t)) return t.toUpperCase();
|
|
3697
3727
|
}
|
|
3698
3728
|
return null;
|
|
3699
3729
|
}
|
|
3700
|
-
function
|
|
3730
|
+
function Mn(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(En).find((e) => t.startsWith(e));
|
|
3734
|
+
return n ? En[n] : null;
|
|
3705
3735
|
}
|
|
3706
|
-
function
|
|
3736
|
+
function Nn(e) {
|
|
3707
3737
|
for (let t of e) if (t.toUpperCase().startsWith("TYPE")) {
|
|
3708
|
-
let e =
|
|
3738
|
+
let e = U(t, 8, 13).trim();
|
|
3709
3739
|
return e ? {
|
|
3710
3740
|
text: e,
|
|
3711
|
-
key:
|
|
3741
|
+
key: Mn(e)
|
|
3712
3742
|
} : null;
|
|
3713
3743
|
}
|
|
3714
3744
|
return null;
|
|
3715
3745
|
}
|
|
3716
|
-
function
|
|
3717
|
-
let t =
|
|
3746
|
+
function Pn(e) {
|
|
3747
|
+
let t = Tn[e];
|
|
3718
3748
|
return t ? {
|
|
3719
3749
|
name: t.name,
|
|
3720
3750
|
description: t.description
|
|
3721
3751
|
} : null;
|
|
3722
3752
|
}
|
|
3723
|
-
function
|
|
3753
|
+
function Fn(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(Tn).filter((e) => e !== "common")];
|
|
3728
3758
|
for (let e of i) {
|
|
3729
|
-
let t =
|
|
3759
|
+
let t = Tn[e]?.params[r];
|
|
3730
3760
|
if (t) return t;
|
|
3731
3761
|
}
|
|
3732
3762
|
return null;
|
|
3733
3763
|
}
|
|
3734
|
-
var
|
|
3764
|
+
var In = (e) => e.toLowerCase().replace(/[^a-z0-9]+(.)?/g, (e, t) => t ? t.toUpperCase() : "").replace(/^[^a-z]+/, ""), Ln = /^[A-Z][A-Z0-9.:#/ -]*$/, Rn = {
|
|
3735
3765
|
RATIO: "ratio",
|
|
3736
3766
|
"LEV/FB": "levFb",
|
|
3737
3767
|
MOD: "mod"
|
|
3738
|
-
},
|
|
3739
|
-
function
|
|
3740
|
-
let r =
|
|
3768
|
+
}, zn = /^(?:-----|[1-4]>[A-Z]{3})$/i;
|
|
3769
|
+
function Bn(e, t, n) {
|
|
3770
|
+
let r = U(t, 0, e.x).trim().toUpperCase(), i = e.letters.map((t, n) => ({
|
|
3741
3771
|
letter: t,
|
|
3742
3772
|
x: e.x + n * e.step
|
|
3743
3773
|
})), a = (e, t, n, i, a) => ({
|
|
@@ -3750,10 +3780,10 @@ function Pn(e, t, n) {
|
|
|
3750
3780
|
paramLabel: r || e,
|
|
3751
3781
|
operator: a
|
|
3752
3782
|
}
|
|
3753
|
-
}), o =
|
|
3783
|
+
}), o = Rn[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" ? Vn(t, 1, n) : t, i)) : null;
|
|
3757
3787
|
}
|
|
3758
3788
|
if (r) return null;
|
|
3759
3789
|
if (/^\s+[A-D] \S/i.test(t)) {
|
|
@@ -3776,10 +3806,10 @@ function Pn(e, t, n) {
|
|
|
3776
3806
|
}
|
|
3777
3807
|
return r.length ? r : null;
|
|
3778
3808
|
}
|
|
3779
|
-
let s = i.map(({ x: n }) =>
|
|
3780
|
-
return c && s.every((e) =>
|
|
3809
|
+
let s = i.map(({ x: n }) => U(t, n, e.width).trim()), c = n.params.MOD;
|
|
3810
|
+
return c && s.every((e) => zn.test(e)) && !U(t, 0, e.x).trim() ? i.map(({ letter: t, x: r }) => a("mod2", r, e.width, Vn(c, 2, n), t)) : null;
|
|
3781
3811
|
}
|
|
3782
|
-
function
|
|
3812
|
+
function Vn(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 Hn = /^(CC[A-J])(?: CC:VAL)? +(?=\S)/i, Un = 6;
|
|
3824
|
+
function Wn(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) => kn(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 = Bn(e.operators, t, Tn[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 =
|
|
3846
|
-
if (u && (s = u[1].toUpperCase(), c = u[0].length, l =
|
|
3847
|
-
let d = r[o + 1], f = d != null &&
|
|
3848
|
-
if (!
|
|
3849
|
-
let m =
|
|
3875
|
+
let s = U(t, a.labelX, a.labelWidth).trim().toUpperCase(), c = a.x, l = null, u = o === 0 ? Hn.exec(t) : null;
|
|
3876
|
+
if (u && (s = u[1].toUpperCase(), c = u[0].length, l = Un), !Ln.test(s)) return;
|
|
3877
|
+
let d = r[o + 1], f = d != null && U(t, d.labelX - 1, 1).trim() === "" && Ln.test(U(t, d.labelX, d.labelWidth).trim().toUpperCase()), p = l ?? (d && f ? Math.max(1, d.labelX - 1 - c) : a.width);
|
|
3878
|
+
if (!U(t, c, p).trim()) return;
|
|
3879
|
+
let m = Fn(e, s, n.instrumentKey), h = In(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,
|
|
@@ -3868,19 +3898,19 @@ function Rn(e, t, n) {
|
|
|
3868
3898
|
cells: i
|
|
3869
3899
|
};
|
|
3870
3900
|
}
|
|
3871
|
-
var
|
|
3901
|
+
var W = {
|
|
3872
3902
|
hexValue: null,
|
|
3873
3903
|
numericValue: null,
|
|
3874
3904
|
values: null,
|
|
3875
3905
|
text: null
|
|
3876
3906
|
};
|
|
3877
|
-
function
|
|
3907
|
+
function Gn(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 Kn(e, t) {
|
|
3881
3911
|
let n = e.trim();
|
|
3882
|
-
if (!n) return
|
|
3883
|
-
switch (t === "auto" ?
|
|
3912
|
+
if (!n) return W;
|
|
3913
|
+
switch (t === "auto" ? Gn(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 {
|
|
@@ -3893,7 +3923,7 @@ function Bn(e, t) {
|
|
|
3893
3923
|
case "hexOption": {
|
|
3894
3924
|
let e = /^([0-9A-F]{2})\s?(.*)$/i.exec(n);
|
|
3895
3925
|
if (!e) return {
|
|
3896
|
-
...
|
|
3926
|
+
...W,
|
|
3897
3927
|
text: n
|
|
3898
3928
|
};
|
|
3899
3929
|
let t = parseInt(e[1], 16);
|
|
@@ -3907,7 +3937,7 @@ function Bn(e, t) {
|
|
|
3907
3937
|
case "hexPair": {
|
|
3908
3938
|
let e = /^([0-9A-F]{2})[:/]([0-9A-F]{2})/i.exec(n);
|
|
3909
3939
|
if (!e) return {
|
|
3910
|
-
...
|
|
3940
|
+
...W,
|
|
3911
3941
|
text: n
|
|
3912
3942
|
};
|
|
3913
3943
|
let t = [parseInt(e[1], 16), parseInt(e[2], 16)];
|
|
@@ -3921,7 +3951,7 @@ function Bn(e, t) {
|
|
|
3921
3951
|
case "decimal": {
|
|
3922
3952
|
let e = parseInt(n, 10);
|
|
3923
3953
|
return Number.isNaN(e) ? {
|
|
3924
|
-
...
|
|
3954
|
+
...W,
|
|
3925
3955
|
text: n
|
|
3926
3956
|
} : {
|
|
3927
3957
|
hexValue: null,
|
|
@@ -3933,7 +3963,7 @@ function Bn(e, t) {
|
|
|
3933
3963
|
case "decimalPair": {
|
|
3934
3964
|
let e = /^(\d+):(\d+)/.exec(n);
|
|
3935
3965
|
if (!e) return {
|
|
3936
|
-
...
|
|
3966
|
+
...W,
|
|
3937
3967
|
text: n
|
|
3938
3968
|
};
|
|
3939
3969
|
let t = [parseInt(e[1], 10), parseInt(e[2], 10)];
|
|
@@ -3947,7 +3977,7 @@ function Bn(e, t) {
|
|
|
3947
3977
|
case "float": {
|
|
3948
3978
|
let e = parseFloat(n.replace(",", "."));
|
|
3949
3979
|
return Number.isNaN(e) ? {
|
|
3950
|
-
...
|
|
3980
|
+
...W,
|
|
3951
3981
|
text: n
|
|
3952
3982
|
} : {
|
|
3953
3983
|
hexValue: null,
|
|
@@ -3957,12 +3987,12 @@ function Bn(e, t) {
|
|
|
3957
3987
|
};
|
|
3958
3988
|
}
|
|
3959
3989
|
default: return {
|
|
3960
|
-
...
|
|
3990
|
+
...W,
|
|
3961
3991
|
text: n
|
|
3962
3992
|
};
|
|
3963
3993
|
}
|
|
3964
3994
|
}
|
|
3965
|
-
function
|
|
3995
|
+
function qn(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 Jn = I.fxCommands, Yn = I.instrumentFx.types, Xn = Object.entries(Yn).filter(([, e]) => e.verified).map(([e]) => e);
|
|
4005
|
+
function Zn(e) {
|
|
4006
|
+
let t = Xn.filter((t) => Yn[t].commands.includes(e));
|
|
4007
|
+
return t.length === 0 || t.length === Xn.length ? null : t;
|
|
3978
4008
|
}
|
|
3979
|
-
function
|
|
4009
|
+
function Qn(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 = Jn[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" ? Zn(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 ? Jn.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",
|
|
@@ -4001,25 +4031,22 @@ function Kn(e) {
|
|
|
4001
4031
|
slot: Number(n[2])
|
|
4002
4032
|
};
|
|
4003
4033
|
}
|
|
4004
|
-
function
|
|
4005
|
-
return
|
|
4034
|
+
function G(e) {
|
|
4035
|
+
return Qn(e)?.relative === !0;
|
|
4006
4036
|
}
|
|
4007
|
-
function
|
|
4008
|
-
let t =
|
|
4037
|
+
function $n(e) {
|
|
4038
|
+
let t = Yn[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
|
|
4017
|
-
return
|
|
4018
|
-
}
|
|
4019
|
-
function Qn(e) {
|
|
4020
|
-
return e > 127 ? `−${J(256 - e)}` : `+${J(e)}`;
|
|
4045
|
+
var er = I.instrumentFx.relativeCommands.description, K = (e) => e.toString(16).toUpperCase().padStart(2, "0"), q = (e) => e.toString(16).toUpperCase(), tr = (e) => e === 1 ? "once" : e === 2 ? "twice" : `${e} times`, J = (e) => e > 127 ? e - 256 : e, Y = (e) => `${e > 0 ? "+" : e < 0 ? "−" : "±"}${Math.abs(e)}`, nr = (e) => Y(J(e)), X = 4, rr = 1020, ir = (e) => J(e);
|
|
4046
|
+
function ar(e) {
|
|
4047
|
+
return Y(ir(e) / X);
|
|
4021
4048
|
}
|
|
4022
|
-
var
|
|
4049
|
+
var or = [
|
|
4023
4050
|
"C-",
|
|
4024
4051
|
"C#",
|
|
4025
4052
|
"D-",
|
|
@@ -4033,16 +4060,16 @@ var $n = [
|
|
|
4033
4060
|
"A#",
|
|
4034
4061
|
"B-"
|
|
4035
4062
|
];
|
|
4036
|
-
function
|
|
4063
|
+
function sr(e) {
|
|
4037
4064
|
let t = /^([A-G])([#-])(\d)$/.exec((e ?? "").trim().toUpperCase());
|
|
4038
4065
|
if (!t) return null;
|
|
4039
|
-
let n =
|
|
4066
|
+
let n = or.indexOf(`${t[1]}${t[2]}`);
|
|
4040
4067
|
return n < 0 ? null : Number(t[3]) * 12 + n;
|
|
4041
4068
|
}
|
|
4042
|
-
function
|
|
4043
|
-
return `${
|
|
4069
|
+
function cr(e) {
|
|
4070
|
+
return `${or[(e % 12 + 12) % 12]}${Math.floor(e / 12)}`;
|
|
4044
4071
|
}
|
|
4045
|
-
var
|
|
4072
|
+
var lr = [
|
|
4046
4073
|
"C",
|
|
4047
4074
|
"C#",
|
|
4048
4075
|
"D",
|
|
@@ -4055,14 +4082,14 @@ var nr = [
|
|
|
4055
4082
|
"A",
|
|
4056
4083
|
"A#",
|
|
4057
4084
|
"B"
|
|
4058
|
-
],
|
|
4059
|
-
function
|
|
4060
|
-
return e ===
|
|
4085
|
+
], ur = 6;
|
|
4086
|
+
function dr(e) {
|
|
4087
|
+
return e === ur ? "one row per step" : ur % e === 0 ? `${ur / e} rows per step` : e % ur === 0 ? `one row every ${e / ur} steps` : "";
|
|
4061
4088
|
}
|
|
4062
|
-
function
|
|
4089
|
+
function fr(e, t) {
|
|
4063
4090
|
if (e === 0) return `${t} moves one row each time the instrument is triggered`;
|
|
4064
4091
|
if (e <= 251) {
|
|
4065
|
-
let n =
|
|
4092
|
+
let n = dr(e);
|
|
4066
4093
|
return `${t} moves one row every ${e} tick${e === 1 ? "" : "s"}${n ? ` (${n})` : ""}`;
|
|
4067
4094
|
}
|
|
4068
4095
|
return [
|
|
@@ -4072,12 +4099,12 @@ function ar(e, t) {
|
|
|
4072
4099
|
`${t} moves one row every 5 ms (200 Hz)`
|
|
4073
4100
|
][e - 252] ?? null;
|
|
4074
4101
|
}
|
|
4075
|
-
function
|
|
4102
|
+
function pr(e, t, n = {}) {
|
|
4076
4103
|
let r = e.toUpperCase(), i = t >> 4, a = t & 15, o = (e) => `${e} tick${e === 1 ? "" : "s"}`;
|
|
4077
4104
|
switch (r) {
|
|
4078
4105
|
case "ARP": {
|
|
4079
|
-
let e =
|
|
4080
|
-
return e == null ? `plays the note, then ${t}` : `${t}: ${
|
|
4106
|
+
let e = sr(n.note), t = `+${i} and +${a} semitones`;
|
|
4107
|
+
return e == null ? `plays the note, then ${t}` : `${t}: ${cr(e)} ${cr(e + i)} ${cr(e + a)}`;
|
|
4081
4108
|
}
|
|
4082
4109
|
case "ARC": return `arp mode ${i}, speed ${o(a)}`;
|
|
4083
4110
|
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)`;
|
|
@@ -4085,16 +4112,16 @@ function or(e, t, n = {}) {
|
|
|
4085
4112
|
case "KIL": return `stops the note after ${o(t)}`;
|
|
4086
4113
|
case "OFF": return `note off after ${o(t)}`;
|
|
4087
4114
|
case "PSL": return `portamento over ${o(t)}`;
|
|
4088
|
-
case "GRV": return `track uses groove ${
|
|
4089
|
-
case "GGR": return `all tracks use groove ${
|
|
4090
|
-
case "INS": return `switches to instrument ${
|
|
4091
|
-
case "TBL": return `instrument uses table ${
|
|
4092
|
-
case "TBX": return t === 0 ? "stops the auxiliary table" : `plays table ${
|
|
4093
|
-
case "THO": return n.inTable ? `every column of the table jumps to row ${
|
|
4094
|
-
case "HOP": return n.inTable ? a === n.row ? i === 0 ? `this column stops on row ${
|
|
4115
|
+
case "GRV": return `track uses groove ${K(t)}`;
|
|
4116
|
+
case "GGR": return `all tracks use groove ${K(t)}`;
|
|
4117
|
+
case "INS": return `switches to instrument ${K(t)}`;
|
|
4118
|
+
case "TBL": return `instrument uses table ${K(t)}`;
|
|
4119
|
+
case "TBX": return t === 0 ? "stops the auxiliary table" : `plays table ${K(t)} alongside the instrument table`;
|
|
4120
|
+
case "THO": return n.inTable ? `every column of the table jumps to row ${q(a)}` : `the instrument's table jumps to row ${q(a)} (the aux table when a TBX is on this step)`;
|
|
4121
|
+
case "HOP": return n.inTable ? a === n.row ? i === 0 ? `this column stops on row ${q(a)}` : `holds this column on row ${q(a)} ${tr(i)}` : i === 0 ? `always jumps back to row ${q(a)}: the rows in between loop` : `jumps to row ${q(a)} ${tr(i)}, then the column runs on past it` : t === 255 ? "stops this track" : `jumps to row ${q(a)} of the next phrase`;
|
|
4095
4122
|
case "REP": return !n.inTable || t === 0 ? null : `plays the command above it ${t} more time${t === 1 ? "" : "s"}, one row each`;
|
|
4096
|
-
case "RTO": return n.inTable ? `repeats the relative command above it until it has added ${t > 127 ? `${
|
|
4097
|
-
case "RMX": return `tracks to its left (selection ${
|
|
4123
|
+
case "RTO": return n.inTable ? `repeats the relative command above it until it has added ${t > 127 ? `${K(t)} (${J(t)})` : K(t)} in total` : null;
|
|
4124
|
+
case "RMX": return `tracks to its left (selection ${q(i)}) jump to phrase row ${q(a)}`;
|
|
4098
4125
|
case "RND": return `randomises the previous FX: left range ${i}, right range ${a} (0 none, F full)`;
|
|
4099
4126
|
case "RNL": return `randomises the FX to its left: left range ${i}, right range ${a} (0 none, F full)`;
|
|
4100
4127
|
case "RET": return a === 0 ? `single retrig after ${o(i)}` : `retrigs every ${o(a)}, volume ${i < 8 ? "falls" : "rises"} on each retrig (ramp ${i})`;
|
|
@@ -4103,76 +4130,92 @@ function or(e, t, n = {}) {
|
|
|
4103
4130
|
case "PBN": return t < 128 ? `pitch slides up by ${t}` : `pitch slides down by ${256 - t}`;
|
|
4104
4131
|
case "SCA":
|
|
4105
4132
|
case "SCG": {
|
|
4106
|
-
let e =
|
|
4133
|
+
let e = lr[i];
|
|
4107
4134
|
return `${r === "SCA" ? "track" : "song"} scale ${a.toString(16).toUpperCase()}${e ? `, key ${e}` : ""}`;
|
|
4108
4135
|
}
|
|
4109
|
-
case "SNG": return `moves the song position by ${
|
|
4110
|
-
case "SED": return `random seed ${
|
|
4111
|
-
case "NXT": return `plays instrument ${
|
|
4136
|
+
case "SNG": return `moves the song position by ${Y(J(t))} row(s)`;
|
|
4137
|
+
case "SED": return `random seed ${K(t)}`;
|
|
4138
|
+
case "NXT": return `plays instrument ${K(t)} on the next track`;
|
|
4112
4139
|
case "MTT": {
|
|
4113
4140
|
if (n.inTable) return "no effect in a table";
|
|
4114
|
-
let e =
|
|
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 ${
|
|
4141
|
+
let e = J(t);
|
|
4142
|
+
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 ${Y(e)}/8 tick`;
|
|
4116
4143
|
}
|
|
4117
4144
|
case "TPO": return `${t} BPM`;
|
|
4118
|
-
case "TSP": return `transposes the song by ${
|
|
4119
|
-
case "TIC": return
|
|
4145
|
+
case "TSP": return `transposes the song by ${Y(J(t))} semitones`;
|
|
4146
|
+
case "TIC": return fr(t, n.inTable ? "this column" : "the instrument's table");
|
|
4120
4147
|
case "XRZ": return t > 0 ? "reverb freeze on" : "reverb freeze off";
|
|
4121
4148
|
}
|
|
4122
|
-
if (
|
|
4123
|
-
let e =
|
|
4124
|
-
return r === "PIT" ? e === 0 ? "no change" : `${
|
|
4149
|
+
if (G(r)) {
|
|
4150
|
+
let e = J(t);
|
|
4151
|
+
return r === "PIT" ? e === 0 ? "no change" : `${Y(e)} semitones` : e === 0 ? "no change" : Y(e);
|
|
4125
4152
|
}
|
|
4126
4153
|
return null;
|
|
4127
4154
|
}
|
|
4128
|
-
function
|
|
4129
|
-
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
|
|
4155
|
+
function mr(e, t, n, r) {
|
|
4156
|
+
if (t) return {
|
|
4157
|
+
q: e + n,
|
|
4158
|
+
held: null
|
|
4159
|
+
};
|
|
4160
|
+
let i = e + n, a = null;
|
|
4161
|
+
if (r != null) {
|
|
4162
|
+
let t = r * X;
|
|
4163
|
+
(n > 0 && i >= t && e <= t || n < 0 && i <= t && e >= t) && (i = t, a = "limit");
|
|
4164
|
+
}
|
|
4165
|
+
return i >= rr && n > 0 ? (i = rr, a = "max") : i <= 0 && n < 0 && (i = 0, a = "min"), {
|
|
4166
|
+
q: i,
|
|
4167
|
+
held: a
|
|
4133
4168
|
};
|
|
4134
4169
|
}
|
|
4135
|
-
function
|
|
4136
|
-
let i = null, a =
|
|
4137
|
-
for (let n = 0; n <=
|
|
4138
|
-
let
|
|
4139
|
-
if (
|
|
4140
|
-
let e =
|
|
4141
|
-
e === "REP" ? t ? !i && !r ?
|
|
4170
|
+
function hr(e, t, n, r = !1) {
|
|
4171
|
+
let i = null, a = !1, o = null, s = null, c = null, l = r, u = null, d = null, f = "none", p = Math.min(n, e.length - 1);
|
|
4172
|
+
for (let n = 0; n <= p; n += 1) {
|
|
4173
|
+
let p = e[n].fields[`fx${t}cmd`], m = e[n].fields[`fx${t}val`];
|
|
4174
|
+
if (f = "none", p && !p.isEmpty) {
|
|
4175
|
+
let e = p.rawValue.toUpperCase(), t = m && !m.isEmpty ? m.hexValue : null;
|
|
4176
|
+
e === "REP" ? t ? !i && !r ? f = "orphan" : (f = l ? "repChange" : "rep", l || (d = n), l = !0, s = t, o != null && ({q: o, held: u} = mr(o, a, ir(s), c))) : (f = "repStop", l = !1, s = null, u = null) : e === "RTO" ? (f = "rto", c = t) : (f = l ? "replace" : "set", i = {
|
|
4142
4177
|
cmd: e,
|
|
4143
4178
|
value: t,
|
|
4144
4179
|
step: n
|
|
4145
|
-
}, a = t,
|
|
4146
|
-
} else
|
|
4180
|
+
}, a = G(e), o = t == null ? null : (a ? J(t) : t) * X, l = !1, s = null, c = null, u = null, d = null);
|
|
4181
|
+
} else l && (f = "continue", o != null && s != null && ({q: o, held: u} = mr(o, a, ir(s), c)));
|
|
4147
4182
|
}
|
|
4183
|
+
let m = l && o != null;
|
|
4148
4184
|
return {
|
|
4149
4185
|
lane: t,
|
|
4150
4186
|
step: n,
|
|
4151
|
-
event:
|
|
4187
|
+
event: f,
|
|
4152
4188
|
source: i,
|
|
4153
|
-
active:
|
|
4154
|
-
increment:
|
|
4155
|
-
limit:
|
|
4156
|
-
value:
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
|
|
4189
|
+
active: l,
|
|
4190
|
+
increment: s,
|
|
4191
|
+
limit: c,
|
|
4192
|
+
value: m && !a && o != null ? Math.floor(o / X) : null,
|
|
4193
|
+
offset: m && a && o != null ? o / X : null,
|
|
4194
|
+
held: l ? u : null,
|
|
4195
|
+
atLimit: l && u === "limit",
|
|
4196
|
+
repStartStep: d,
|
|
4197
|
+
carried: l && !i
|
|
4160
4198
|
};
|
|
4161
4199
|
}
|
|
4162
|
-
function
|
|
4163
|
-
let t = e.source, n =
|
|
4200
|
+
function gr(e) {
|
|
4201
|
+
let t = e.source, n = e.increment == null ? "" : ar(e.increment), r = e.limit == null ? "" : `, or at the RTO value ${K(e.limit)} (${e.limit})`, i = () => {
|
|
4202
|
+
if (e.offset != null) return `${t?.cmd} is ${Y(e.offset)} from the instrument's own value on this row`;
|
|
4203
|
+
if (e.value == null) return `${t?.cmd} has no value to shift`;
|
|
4204
|
+
let n = e.held === "limit" ? ", held at the RTO value" : e.held === "max" ? ", it cannot go above FF" : e.held === "min" ? ", it cannot go below 00" : "";
|
|
4205
|
+
return `${t?.cmd} is ${K(e.value)} (${e.value}) on this row${n}`;
|
|
4206
|
+
};
|
|
4164
4207
|
switch (e.event) {
|
|
4165
4208
|
case "rep":
|
|
4166
|
-
case "repChange": return e.carried ? `REP ${
|
|
4167
|
-
case "continue": return e.carried ? "REP from a previous phrase is still active in this lane (^^)" : `REP still active
|
|
4168
|
-
case "repStop": return t ? `REP00 stops the
|
|
4169
|
-
case "orphan": return "REP has no earlier command in this lane of the phrase to
|
|
4170
|
-
case "rto": return e.
|
|
4171
|
-
case "replace": return t ? `replaces the running REP (${t.cmd} is no longer
|
|
4209
|
+
case "repChange": return e.carried ? `REP ${n} per row continues the shift from the previous phrase` : `${e.event === "rep" ? "shifts" : "now shifts"} ${t?.cmd} by ${n} per row: ${i()}; it stops at 00 and FF${r}, without wrapping`;
|
|
4210
|
+
case "continue": return e.carried ? "REP from a previous phrase is still active in this lane (^^)" : `REP still active (${n} per row since step ${e.repStartStep?.toString(16).toUpperCase()}): ${i()}`;
|
|
4211
|
+
case "repStop": return t ? `REP00 stops the shifting of ${t.cmd}` : "REP00 stops the shifting";
|
|
4212
|
+
case "orphan": return "REP has no earlier command in this lane of the phrase to shift";
|
|
4213
|
+
case "rto": return e.limit == null ? "sets the value a REP stops at" : `sets the value a REP stops at: ${K(e.limit)} (${e.limit}), an absolute value, not a shift`;
|
|
4214
|
+
case "replace": return t ? `replaces the running REP (${t.cmd} is no longer shifted)` : null;
|
|
4172
4215
|
default: return null;
|
|
4173
4216
|
}
|
|
4174
4217
|
}
|
|
4175
|
-
function
|
|
4218
|
+
function _r(e) {
|
|
4176
4219
|
let t = e.fields.inst;
|
|
4177
4220
|
return t && !t.isEmpty ? "instrument" : [
|
|
4178
4221
|
1,
|
|
@@ -4183,10 +4226,10 @@ function ur(e) {
|
|
|
4183
4226
|
return n != null && !n.isEmpty && n.rawValue.toUpperCase() === "RET";
|
|
4184
4227
|
}) ? "ret" : null;
|
|
4185
4228
|
}
|
|
4186
|
-
function
|
|
4229
|
+
function vr(e, t, n = null) {
|
|
4187
4230
|
let r = {}, i = null, a = null, o = Math.min(t, e.length - 1);
|
|
4188
4231
|
for (let t = 0; t <= o; t += 1) {
|
|
4189
|
-
let o =
|
|
4232
|
+
let o = _r(e[t]);
|
|
4190
4233
|
if (o) {
|
|
4191
4234
|
for (let e of Object.keys(r)) delete r[e];
|
|
4192
4235
|
i = t, a = o;
|
|
@@ -4196,10 +4239,10 @@ function dr(e, t, n = null) {
|
|
|
4196
4239
|
2,
|
|
4197
4240
|
3
|
|
4198
4241
|
]) {
|
|
4199
|
-
let s =
|
|
4200
|
-
if (!c || s.carried || !
|
|
4242
|
+
let s = hr(e, o, t, n === o), c = s.source;
|
|
4243
|
+
if (!c || s.carried || !G(c.cmd)) continue;
|
|
4201
4244
|
let l = null, u = !1;
|
|
4202
|
-
if (s.event === "set" || s.event === "replace" ? l = c.value : (s.event === "rep" || s.event === "repChange" || s.event === "continue") && (l = s.
|
|
4245
|
+
if (s.event === "set" || s.event === "replace" ? l = c.value == null ? null : J(c.value) : (s.event === "rep" || s.event === "repChange" || s.event === "continue") && s.increment != null && c.value != null && (l = ir(s.increment) / X, u = !0), l == null) continue;
|
|
4203
4246
|
let d = r[c.cmd];
|
|
4204
4247
|
d || (d = {
|
|
4205
4248
|
cmd: c.cmd,
|
|
@@ -4208,26 +4251,26 @@ function dr(e, t, n = null) {
|
|
|
4208
4251
|
resetStep: i,
|
|
4209
4252
|
resetBy: a,
|
|
4210
4253
|
viaRep: !1
|
|
4211
|
-
}, r[c.cmd] = d), d.total +=
|
|
4254
|
+
}, r[c.cmd] = d), d.total += l, d.count += 1, d.viaRep ||= u;
|
|
4212
4255
|
}
|
|
4213
4256
|
}
|
|
4214
4257
|
return r;
|
|
4215
4258
|
}
|
|
4216
|
-
var
|
|
4217
|
-
function
|
|
4259
|
+
var yr = (e) => Y(e);
|
|
4260
|
+
function br(e) {
|
|
4218
4261
|
if (e.resetStep == null) return "the start of this phrase (earlier state unknown)";
|
|
4219
4262
|
let t = e.resetStep.toString(16).toUpperCase();
|
|
4220
4263
|
return e.resetBy === "ret" ? `the RET on step ${t}` : `the instrument number on step ${t}`;
|
|
4221
4264
|
}
|
|
4222
|
-
var
|
|
4223
|
-
function
|
|
4224
|
-
if (!e || e.count <= 1) return `relative: ${
|
|
4225
|
-
let t = e.viaRep ? ",
|
|
4226
|
-
return `relative: ${e.cmd} ${n} over ${e.count}
|
|
4265
|
+
var xr = "stays until a note with an instrument number (I) or a RET resets it";
|
|
4266
|
+
function Sr(e) {
|
|
4267
|
+
if (!e || e.count <= 1) return `relative: ${xr}`;
|
|
4268
|
+
let t = e.viaRep ? ", REP steps included" : "", n = e.total === 0 ? "has had no net effect" : `has moved by ${yr(e.total)}`;
|
|
4269
|
+
return `relative: ${e.cmd} ${n} over ${e.count} rows since ${br(e)}${t}; ${xr}`;
|
|
4227
4270
|
}
|
|
4228
|
-
function
|
|
4271
|
+
function Cr(e) {
|
|
4229
4272
|
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} ${
|
|
4273
|
+
return t.length ? `triggers the instrument again: resets the relative changes still in force (${t.map((e) => `${e.cmd} ${yr(e.total)}`).join(", ")})` : null;
|
|
4231
4274
|
}
|
|
4232
4275
|
//#endregion
|
|
4233
4276
|
//#region src/scaleInsight.ts
|
|
@@ -4244,7 +4287,7 @@ var Z = [
|
|
|
4244
4287
|
"A",
|
|
4245
4288
|
"A#",
|
|
4246
4289
|
"B"
|
|
4247
|
-
],
|
|
4290
|
+
], wr = [
|
|
4248
4291
|
{
|
|
4249
4292
|
name: "Major (Ionian)",
|
|
4250
4293
|
steps: [
|
|
@@ -4462,7 +4505,7 @@ var Z = [
|
|
|
4462
4505
|
11
|
|
4463
4506
|
]
|
|
4464
4507
|
}
|
|
4465
|
-
],
|
|
4508
|
+
], Tr = [
|
|
4466
4509
|
"the root",
|
|
4467
4510
|
"a minor 2nd",
|
|
4468
4511
|
"a major 2nd",
|
|
@@ -4476,26 +4519,26 @@ var Z = [
|
|
|
4476
4519
|
"a minor 7th",
|
|
4477
4520
|
"a major 7th"
|
|
4478
4521
|
];
|
|
4479
|
-
function
|
|
4522
|
+
function Er(e) {
|
|
4480
4523
|
let t = e.replace(/[-\s]/g, "").toUpperCase();
|
|
4481
4524
|
return Z.includes(t) ? t : null;
|
|
4482
4525
|
}
|
|
4483
|
-
function
|
|
4526
|
+
function Dr(e) {
|
|
4484
4527
|
let t = Z.indexOf(e);
|
|
4485
|
-
return t <= 0 ? t === 0 ? "the first row (the scale root)" : e : `${
|
|
4528
|
+
return t <= 0 ? t === 0 ? "the first row (the scale root)" : e : `${Tr[t]} (+${t} semitones above C)`;
|
|
4486
4529
|
}
|
|
4487
|
-
function
|
|
4530
|
+
function Or(e) {
|
|
4488
4531
|
let t = new Set(e);
|
|
4489
4532
|
if (t.size === 0) return [];
|
|
4490
4533
|
let n = [];
|
|
4491
|
-
for (let e of
|
|
4534
|
+
for (let e of wr) 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
4535
|
root: r,
|
|
4493
4536
|
name: e.name
|
|
4494
4537
|
});
|
|
4495
4538
|
return n.sort((e, t) => e.root - t.root), n.map((e) => e.root === 0 ? e.name : `${e.name} from ${Z[e.root]}`);
|
|
4496
4539
|
}
|
|
4497
|
-
function
|
|
4498
|
-
let t = e.filter((e) => e.enabled === !0), n = t.map((e) => e.interval), r =
|
|
4540
|
+
function kr(e) {
|
|
4541
|
+
let t = e.filter((e) => e.enabled === !0), n = t.map((e) => e.interval), r = Or(t.map((e) => e.semitone)), i = e.filter((e) => e.enabled === !0 && e.offset != null && e.offset !== 0).map((e) => ({
|
|
4499
4542
|
interval: e.interval,
|
|
4500
4543
|
offset: e.offset
|
|
4501
4544
|
}));
|
|
@@ -4504,47 +4547,47 @@ function Sr(e) {
|
|
|
4504
4547
|
enabled: n,
|
|
4505
4548
|
shapes: r,
|
|
4506
4549
|
detuned: i,
|
|
4507
|
-
summary:
|
|
4550
|
+
summary: Ar({
|
|
4508
4551
|
enabled: n,
|
|
4509
4552
|
shapes: r,
|
|
4510
4553
|
detuned: i
|
|
4511
4554
|
}).join(" — ")
|
|
4512
4555
|
};
|
|
4513
4556
|
}
|
|
4514
|
-
function
|
|
4557
|
+
function Ar(e) {
|
|
4515
4558
|
let { enabled: t, shapes: n, detuned: r } = e;
|
|
4516
4559
|
if (!t.length) return ["no notes enabled"];
|
|
4517
4560
|
let i = n[0] ?? `${t.length} notes, custom scale`;
|
|
4518
|
-
return r.length && (i += `; detuned: ${r.map((e) => `${e.interval} ${
|
|
4561
|
+
return r.length && (i += `; detuned: ${r.map((e) => `${e.interval} ${jr(e.offset)}`).join(", ")}`), [t.join(" "), i];
|
|
4519
4562
|
}
|
|
4520
|
-
function
|
|
4563
|
+
function jr(e) {
|
|
4521
4564
|
return `${e > 0 ? "+" : e < 0 ? "−" : ""}${Math.abs(e).toFixed(2)} st`;
|
|
4522
4565
|
}
|
|
4523
4566
|
//#endregion
|
|
4524
4567
|
//#region src/viewContext.ts
|
|
4525
|
-
var
|
|
4568
|
+
var Mr = /* @__PURE__ */ new Set([
|
|
4526
4569
|
"--",
|
|
4527
4570
|
"---",
|
|
4528
4571
|
"---00",
|
|
4529
4572
|
"----",
|
|
4530
4573
|
"-"
|
|
4531
4574
|
]);
|
|
4532
|
-
function
|
|
4533
|
-
return !e ||
|
|
4575
|
+
function Nr(e) {
|
|
4576
|
+
return !e || Mr.has(e) || /^-+$/.test(e);
|
|
4534
4577
|
}
|
|
4535
|
-
function
|
|
4578
|
+
function Pr(e) {
|
|
4536
4579
|
let t = e.trim();
|
|
4537
|
-
if (!t ||
|
|
4580
|
+
if (!t || Nr(t)) return null;
|
|
4538
4581
|
let n = parseInt(t, 16);
|
|
4539
4582
|
return Number.isNaN(n) ? null : n;
|
|
4540
4583
|
}
|
|
4541
|
-
function
|
|
4584
|
+
function Fr(e, t, n) {
|
|
4542
4585
|
return t >= e.length ? "" : e.slice(t, Math.min(t + n, e.length));
|
|
4543
4586
|
}
|
|
4544
|
-
function
|
|
4545
|
-
return
|
|
4587
|
+
function Ir(e) {
|
|
4588
|
+
return Lr(e);
|
|
4546
4589
|
}
|
|
4547
|
-
function
|
|
4590
|
+
function Lr(e) {
|
|
4548
4591
|
if (!e) return {
|
|
4549
4592
|
viewId: null,
|
|
4550
4593
|
isUnsaved: !1,
|
|
@@ -4557,7 +4600,7 @@ function Ar(e) {
|
|
|
4557
4600
|
marker: r
|
|
4558
4601
|
};
|
|
4559
4602
|
}
|
|
4560
|
-
function
|
|
4603
|
+
function Rr(e) {
|
|
4561
4604
|
return e.length > 0 && /^[^a-zA-Z0-9 ]/.test(e[0]) ? {
|
|
4562
4605
|
line: e.slice(1),
|
|
4563
4606
|
offset: 1
|
|
@@ -4566,12 +4609,12 @@ function jr(e) {
|
|
|
4566
4609
|
offset: 0
|
|
4567
4610
|
};
|
|
4568
4611
|
}
|
|
4569
|
-
function
|
|
4570
|
-
let n =
|
|
4612
|
+
function zr(e, t) {
|
|
4613
|
+
let n = Fr(t, e.x, e.width).trim();
|
|
4571
4614
|
n.includes("^") && (e.type === "fxCommand" || e.type === "fxValue") && (n = "");
|
|
4572
|
-
let r =
|
|
4615
|
+
let r = Nr(n);
|
|
4573
4616
|
if (e.format) {
|
|
4574
|
-
let t = r ? null :
|
|
4617
|
+
let t = r ? null : Kn(n, e.format), i = e.type === "name" || e.type === "fileEntry", a = t?.text != null && !i ? t.text.toUpperCase() : t?.text ?? null;
|
|
4575
4618
|
return {
|
|
4576
4619
|
key: e.key,
|
|
4577
4620
|
label: e.label,
|
|
@@ -4586,8 +4629,8 @@ function Mr(e, t) {
|
|
|
4586
4629
|
values: t?.values ?? null,
|
|
4587
4630
|
parts: e.parts,
|
|
4588
4631
|
unit: e.unit,
|
|
4589
|
-
valueDescription: !r &&
|
|
4590
|
-
fileKind: e.type === "fileEntry" ?
|
|
4632
|
+
valueDescription: !r && qn(e.options, a ?? n) || void 0,
|
|
4633
|
+
fileKind: e.type === "fileEntry" ? Br(n) : void 0
|
|
4591
4634
|
};
|
|
4592
4635
|
}
|
|
4593
4636
|
let i = [
|
|
@@ -4607,7 +4650,7 @@ function Mr(e, t) {
|
|
|
4607
4650
|
if (a.includes(e.type)) {
|
|
4608
4651
|
let e = parseInt(n, 10);
|
|
4609
4652
|
o = Number.isNaN(e) ? null : e;
|
|
4610
|
-
} else o =
|
|
4653
|
+
} else o = Pr(n);
|
|
4611
4654
|
}
|
|
4612
4655
|
return {
|
|
4613
4656
|
key: e.key,
|
|
@@ -4619,20 +4662,20 @@ function Mr(e, t) {
|
|
|
4619
4662
|
meta: e.meta
|
|
4620
4663
|
};
|
|
4621
4664
|
}
|
|
4622
|
-
function
|
|
4665
|
+
function Br(e) {
|
|
4623
4666
|
if (e === "/..") return "parent";
|
|
4624
4667
|
if (e.startsWith("/")) return "directory";
|
|
4625
4668
|
let t = /\.([a-z0-9]+)$/i.exec(e)?.[1]?.toLowerCase();
|
|
4626
4669
|
return t === "m8i" ? "instrumentPreset" : t === "wav" ? "sample" : t?.startsWith("m8") ? "m8file" : "file";
|
|
4627
4670
|
}
|
|
4628
|
-
function
|
|
4629
|
-
let n =
|
|
4671
|
+
function Vr(e, t) {
|
|
4672
|
+
let n = Fr(e, t.x, t.width).trim();
|
|
4630
4673
|
if (!n) return null;
|
|
4631
|
-
if (t.parse === "hex") return
|
|
4674
|
+
if (t.parse === "hex") return Pr(n);
|
|
4632
4675
|
let r = parseInt(n, 10);
|
|
4633
4676
|
return Number.isNaN(r) ? null : r;
|
|
4634
4677
|
}
|
|
4635
|
-
function
|
|
4678
|
+
function Hr(e, t) {
|
|
4636
4679
|
for (let n of e) if (t >= n.x && t < n.x + n.width) return n;
|
|
4637
4680
|
let n = null, r = 2;
|
|
4638
4681
|
for (let i of e) {
|
|
@@ -4641,9 +4684,9 @@ function Fr(e, t) {
|
|
|
4641
4684
|
}
|
|
4642
4685
|
return n;
|
|
4643
4686
|
}
|
|
4644
|
-
function
|
|
4687
|
+
function Ur(e, t) {
|
|
4645
4688
|
let n = {};
|
|
4646
|
-
for (let r of e.columns ?? []) n[r.key] =
|
|
4689
|
+
for (let r of e.columns ?? []) n[r.key] = zr(r, t);
|
|
4647
4690
|
for (let e of Object.keys(n)) {
|
|
4648
4691
|
let t = /^fx(\d)cmd$/.exec(e)?.[1], r = t ? n[`fx${t}val`] : void 0;
|
|
4649
4692
|
r && n[e].isEmpty && (n[`fx${t}val`] = {
|
|
@@ -4652,27 +4695,27 @@ function Ir(e, t) {
|
|
|
4652
4695
|
});
|
|
4653
4696
|
}
|
|
4654
4697
|
return {
|
|
4655
|
-
rowIndex: e.rowField ?
|
|
4698
|
+
rowIndex: e.rowField ? Vr(t, e.rowField) : null,
|
|
4656
4699
|
rowKey: e.rowField?.key ?? "row",
|
|
4657
4700
|
rowId: null,
|
|
4658
4701
|
fields: n
|
|
4659
4702
|
};
|
|
4660
4703
|
}
|
|
4661
|
-
var
|
|
4662
|
-
function
|
|
4704
|
+
var Wr = (e) => e.replace(/\s+/g, ""), Gr = 1, Q = (e) => e.slice(1);
|
|
4705
|
+
function Kr(e, t) {
|
|
4663
4706
|
if (!t || !e.cursorPos || !e.currentLine) return !1;
|
|
4664
4707
|
let n = t.lines[e.cursorPos.y];
|
|
4665
|
-
return n != null &&
|
|
4708
|
+
return n != null && Wr(n) === Wr(e.currentLine);
|
|
4666
4709
|
}
|
|
4667
|
-
var
|
|
4668
|
-
function
|
|
4710
|
+
var qr = 16, Jr = 4, Yr = 21;
|
|
4711
|
+
function Xr(e, t) {
|
|
4669
4712
|
let n = I.views[e];
|
|
4670
4713
|
if (n?.type !== "grid" || !n.rowField) return [];
|
|
4671
|
-
let r = [], i = Math.min(
|
|
4672
|
-
for (let e =
|
|
4714
|
+
let r = [], i = Math.min(Yr, t.lines.length - 1);
|
|
4715
|
+
for (let e = Jr; e <= i; e += 1) {
|
|
4673
4716
|
let i = Q(t.lines[e] ?? ""), a = n.rowField;
|
|
4674
|
-
if (i.length <= a.x + a.width || !
|
|
4675
|
-
let o =
|
|
4717
|
+
if (i.length <= a.x + a.width || !Zr(i[a.x + a.width])) continue;
|
|
4718
|
+
let o = Ur(n, i);
|
|
4676
4719
|
o.rowIndex != null && r.push({
|
|
4677
4720
|
...o,
|
|
4678
4721
|
screenRow: e
|
|
@@ -4680,11 +4723,11 @@ function Ur(e, t) {
|
|
|
4680
4723
|
}
|
|
4681
4724
|
return r;
|
|
4682
4725
|
}
|
|
4683
|
-
var
|
|
4684
|
-
function
|
|
4726
|
+
var Zr = (e) => e === " " || /^[^a-zA-Z0-9-]$/.test(e);
|
|
4727
|
+
function Qr(e, t) {
|
|
4685
4728
|
let n = I.views[e];
|
|
4686
4729
|
if (n?.type !== "grid") return null;
|
|
4687
|
-
let r =
|
|
4730
|
+
let r = Xr(e, t), i = (e) => !!e && e !== " " && Zr(e);
|
|
4688
4731
|
if (e === "song") return {
|
|
4689
4732
|
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
4733
|
row: null
|
|
@@ -4698,25 +4741,25 @@ function Gr(e, t) {
|
|
|
4698
4741
|
row: null
|
|
4699
4742
|
};
|
|
4700
4743
|
}
|
|
4701
|
-
function
|
|
4744
|
+
function $r(e, t, n, r) {
|
|
4702
4745
|
let i = (t.cursorPos?.y ?? -1) - r;
|
|
4703
4746
|
if (i < 0) return null;
|
|
4704
4747
|
let a = [], o = null;
|
|
4705
|
-
for (let t = 0; t <
|
|
4748
|
+
for (let t = 0; t < qr; t += 1) {
|
|
4706
4749
|
let r = n.lines[i + t];
|
|
4707
4750
|
if (r == null) return null;
|
|
4708
|
-
let s = Q(r), c =
|
|
4751
|
+
let s = Q(r), c = Ur(e, s);
|
|
4709
4752
|
if (c.rowIndex !== t) return null;
|
|
4710
4753
|
a.push(c);
|
|
4711
4754
|
let l = s.indexOf("^^");
|
|
4712
|
-
o == null && l >= 0 && (o =
|
|
4755
|
+
o == null && l >= 0 && (o = ei(e, l));
|
|
4713
4756
|
}
|
|
4714
4757
|
return {
|
|
4715
4758
|
steps: a,
|
|
4716
4759
|
carriedRepLane: o
|
|
4717
4760
|
};
|
|
4718
4761
|
}
|
|
4719
|
-
function
|
|
4762
|
+
function ei(e, t) {
|
|
4720
4763
|
let n = [];
|
|
4721
4764
|
for (let r = 1; r <= 3; r += 1) {
|
|
4722
4765
|
let i = e.columns?.find((e) => e.key === `fx${r}cmd`), a = e.columns?.find((e) => e.key === `fx${r}val`);
|
|
@@ -4730,8 +4773,8 @@ function qr(e, t) {
|
|
|
4730
4773
|
let r = Math.min(...n.map((e) => e.dist)), i = n.filter((e) => e.dist === r);
|
|
4731
4774
|
return r <= 1 && i.length === 1 ? i[0].lane : null;
|
|
4732
4775
|
}
|
|
4733
|
-
function
|
|
4734
|
-
let t =
|
|
4776
|
+
function ti(e) {
|
|
4777
|
+
let t = Er(e.fields.interval?.rawValue ?? "");
|
|
4735
4778
|
if (!t) return null;
|
|
4736
4779
|
let n = e.fields.en?.rawValue.toUpperCase(), r = parseFloat(e.fields.offset?.rawValue ?? "");
|
|
4737
4780
|
return {
|
|
@@ -4741,15 +4784,15 @@ function Jr(e) {
|
|
|
4741
4784
|
offset: Number.isNaN(r) ? null : r
|
|
4742
4785
|
};
|
|
4743
4786
|
}
|
|
4744
|
-
function
|
|
4787
|
+
function ni(e, t) {
|
|
4745
4788
|
let n = /* @__PURE__ */ new Map();
|
|
4746
4789
|
for (let r of t.lines) {
|
|
4747
|
-
let t =
|
|
4790
|
+
let t = Ur(e, Q(r)), i = ti(t), a = t.fields.en?.rawValue.toUpperCase();
|
|
4748
4791
|
!i || a !== "ON" && a !== "OFF" && a !== "--" || n.has(i.interval) || n.set(i.interval, i);
|
|
4749
4792
|
}
|
|
4750
4793
|
return n.size === Z.length ? Z.map((e) => n.get(e)) : null;
|
|
4751
4794
|
}
|
|
4752
|
-
function
|
|
4795
|
+
function ri(e, t, n, r) {
|
|
4753
4796
|
let i = {
|
|
4754
4797
|
...r,
|
|
4755
4798
|
isGridView: !1,
|
|
@@ -4766,40 +4809,40 @@ function Xr(e, t, n, r) {
|
|
|
4766
4809
|
resetsRelative: null,
|
|
4767
4810
|
scaleNote: null,
|
|
4768
4811
|
scale: null
|
|
4769
|
-
}, a = e.cursorPos, o = a ? a.x - 1 : 0, s = a &&
|
|
4812
|
+
}, a = e.cursorPos, o = a ? a.x - 1 : 0, s = a && Kr(e, t) ? t : null, c = s && a ? Q(s.lines[a.y] ?? "") : e.currentLine ?? "";
|
|
4770
4813
|
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" ?
|
|
4814
|
+
let l = s && a ? s.lines.slice(0, a.y + 1).reverse().map(Q) : [c], u = r.viewName === "inst" ? Nn(s ? s.lines.map(Q) : [c]) : null, d = {
|
|
4772
4815
|
instrumentKey: u?.key ?? null,
|
|
4773
4816
|
entryText: e.textUnderCursor
|
|
4774
4817
|
};
|
|
4775
4818
|
if (!s && a && n.kind == null) for (let e = 0; e <= Math.min(o, 24); e += 1) {
|
|
4776
4819
|
let t = " ".repeat(e) + c;
|
|
4777
|
-
if (
|
|
4820
|
+
if (Wn(n, t, {
|
|
4778
4821
|
...d,
|
|
4779
|
-
section:
|
|
4822
|
+
section: An(n, [t])
|
|
4780
4823
|
}).cells.some((e) => o >= e.x && o < e.x + e.width)) {
|
|
4781
4824
|
c = t;
|
|
4782
4825
|
break;
|
|
4783
4826
|
}
|
|
4784
4827
|
}
|
|
4785
|
-
let f =
|
|
4828
|
+
let f = An(n, s ? l : [c]), { rowId: p, cells: m } = Wn(n, c, {
|
|
4786
4829
|
...d,
|
|
4787
4830
|
section: f
|
|
4788
4831
|
}), h = {};
|
|
4789
|
-
for (let e of m) h[e.key] =
|
|
4832
|
+
for (let e of m) h[e.key] = zr(e, c);
|
|
4790
4833
|
let g = {
|
|
4791
4834
|
rowIndex: null,
|
|
4792
4835
|
rowKey: "param",
|
|
4793
4836
|
rowId: p,
|
|
4794
4837
|
fields: h
|
|
4795
|
-
}, _ = null, v = a ?
|
|
4838
|
+
}, _ = null, v = a ? Hr(m, o) : null;
|
|
4796
4839
|
v && (_ = {
|
|
4797
4840
|
...h[v.key],
|
|
4798
4841
|
viewName: r.viewName,
|
|
4799
4842
|
rowIndex: null
|
|
4800
4843
|
});
|
|
4801
4844
|
let y = v?.meta?.zone;
|
|
4802
|
-
return s && typeof y == "string" && (f =
|
|
4845
|
+
return s && typeof y == "string" && (f = jn(n, y, l) ?? f), {
|
|
4803
4846
|
...i,
|
|
4804
4847
|
section: f,
|
|
4805
4848
|
instrumentType: u,
|
|
@@ -4808,10 +4851,10 @@ function Xr(e, t, n, r) {
|
|
|
4808
4851
|
lineText: c.trim()
|
|
4809
4852
|
};
|
|
4810
4853
|
}
|
|
4811
|
-
function
|
|
4854
|
+
function ii(e, t) {
|
|
4812
4855
|
let n = e.viewName;
|
|
4813
4856
|
if (!n) return null;
|
|
4814
|
-
let r = I.views[n] ?? null, i = r?.type === "grid", a = r?.title ?? null, o = r?.description ?? null, { viewId: s, isUnsaved: c } =
|
|
4857
|
+
let r = I.views[n] ?? null, i = r?.type === "grid", a = r?.title ?? null, o = r?.description ?? null, { viewId: s, isUnsaved: c } = Lr(e.viewTitle), l = {
|
|
4815
4858
|
viewName: n,
|
|
4816
4859
|
viewTitle: a,
|
|
4817
4860
|
viewDescription: o,
|
|
@@ -4830,8 +4873,8 @@ function Zr(e, t) {
|
|
|
4830
4873
|
resetsRelative: null,
|
|
4831
4874
|
scaleNote: null,
|
|
4832
4875
|
scale: null
|
|
4833
|
-
}, d = r?.type === "parameter" ?
|
|
4834
|
-
if (d) return
|
|
4876
|
+
}, d = r?.type === "parameter" ? On(n) : null;
|
|
4877
|
+
if (d) return ri(e, t, d, l);
|
|
4835
4878
|
if (!i || !r) return {
|
|
4836
4879
|
...u,
|
|
4837
4880
|
isGridView: !1,
|
|
@@ -4845,11 +4888,11 @@ function Zr(e, t) {
|
|
|
4845
4888
|
row: null,
|
|
4846
4889
|
activeField: null
|
|
4847
4890
|
};
|
|
4848
|
-
let { line: p } =
|
|
4849
|
-
if (g) return
|
|
4891
|
+
let { line: p } = Rr(f), m = e.cursorPos ? e.cursorPos.x - 1 : 0, h = Ur(r, p), g = n === "scale" && !Er(h.fields.interval?.rawValue ?? "") ? On(n) : null;
|
|
4892
|
+
if (g) return ri(e, t, g, l);
|
|
4850
4893
|
let _ = null;
|
|
4851
4894
|
if (e.cursorPos) {
|
|
4852
|
-
let e =
|
|
4895
|
+
let e = Hr(r.columns ?? [], m);
|
|
4853
4896
|
if (e) {
|
|
4854
4897
|
let t = h.fields[e.key];
|
|
4855
4898
|
t && (_ = {
|
|
@@ -4860,20 +4903,20 @@ function Zr(e, t) {
|
|
|
4860
4903
|
}
|
|
4861
4904
|
}
|
|
4862
4905
|
let v = null, y = null, b = null, x = null, S = null, C = null;
|
|
4863
|
-
if (
|
|
4906
|
+
if (Kr(e, t)) {
|
|
4864
4907
|
if (n === "phrase" && h.rowIndex != null) {
|
|
4865
|
-
let n =
|
|
4908
|
+
let n = $r(r, e, t, h.rowIndex);
|
|
4866
4909
|
if (n) {
|
|
4867
4910
|
v = n.steps, y = n.carriedRepLane;
|
|
4868
4911
|
let e = _ ? /^fx(\d)(cmd|val)$/.exec(_.key)?.[1] : void 0;
|
|
4869
|
-
e && (b =
|
|
4912
|
+
e && (b = hr(v, Number(e), h.rowIndex, y === Number(e))), x = vr(v, h.rowIndex, y), h.rowIndex > 0 && _r(h) && (S = vr(v, h.rowIndex - 1, y));
|
|
4870
4913
|
}
|
|
4871
4914
|
} else if (n === "scale") {
|
|
4872
|
-
let e =
|
|
4873
|
-
e && (C =
|
|
4915
|
+
let e = ni(r, t);
|
|
4916
|
+
e && (C = kr(e));
|
|
4874
4917
|
}
|
|
4875
4918
|
}
|
|
4876
|
-
let w = n === "scale" ?
|
|
4919
|
+
let w = n === "scale" ? ti(h) : null;
|
|
4877
4920
|
return {
|
|
4878
4921
|
...u,
|
|
4879
4922
|
isGridView: !0,
|
|
@@ -4889,25 +4932,25 @@ function Zr(e, t) {
|
|
|
4889
4932
|
scale: C
|
|
4890
4933
|
};
|
|
4891
4934
|
}
|
|
4892
|
-
function
|
|
4893
|
-
if (e.isParameterView) return
|
|
4935
|
+
function ai(e) {
|
|
4936
|
+
if (e.isParameterView) return hi(e);
|
|
4894
4937
|
if (e.viewName === "scale") {
|
|
4895
|
-
let t =
|
|
4938
|
+
let t = gi(e);
|
|
4896
4939
|
if (t) return t;
|
|
4897
4940
|
}
|
|
4898
4941
|
if (!e.activeField) return $(["location", e.viewTitle ?? e.viewName]);
|
|
4899
|
-
let { activeField: t, row: n } = e, r = $(["field", `${t.label}: ${
|
|
4942
|
+
let { activeField: t, row: n } = e, r = $(["field", `${t.label}: ${oi(t, n)}`]), i = (t.type === "fxCommand" || t.type === "fxValue") && n ? ci(e, t, n) : [...di(e, t), ...fi(e, t)], a = i.length > 0;
|
|
4900
4943
|
if (t.type === "fxCommand" && !t.isEmpty) {
|
|
4901
|
-
let e = a && /^(REP|RTO)$/i.test(t.rawValue) ? void 0 :
|
|
4944
|
+
let e = a && /^(REP|RTO)$/i.test(t.rawValue) ? void 0 : Qn(t.rawValue);
|
|
4902
4945
|
e && r.push({
|
|
4903
4946
|
kind: "fxInfo",
|
|
4904
|
-
text: `(${
|
|
4947
|
+
text: `(${li(e)})`
|
|
4905
4948
|
});
|
|
4906
4949
|
}
|
|
4907
4950
|
if (t.type === "fxValue" && n) {
|
|
4908
4951
|
let e = t.key.replace("val", "cmd"), i = n.fields[e];
|
|
4909
4952
|
if (i && !i.isEmpty) {
|
|
4910
|
-
let e = a && /^(REP|RTO)$/i.test(i.rawValue) ? void 0 :
|
|
4953
|
+
let e = a && /^(REP|RTO)$/i.test(i.rawValue) ? void 0 : Qn(i.rawValue), t = e ? `${i.rawValue} (${li(e)})` : i.rawValue;
|
|
4911
4954
|
r.push({
|
|
4912
4955
|
kind: "fxTarget",
|
|
4913
4956
|
text: `for ${t}`
|
|
@@ -4926,8 +4969,15 @@ function Qr(e) {
|
|
|
4926
4969
|
}
|
|
4927
4970
|
return r;
|
|
4928
4971
|
}
|
|
4929
|
-
function
|
|
4930
|
-
|
|
4972
|
+
function oi(e, t) {
|
|
4973
|
+
if (e.type === "fxValue" && !e.isEmpty && e.hexValue != null && t) {
|
|
4974
|
+
let n = t.fields[e.key.replace("val", "cmd")];
|
|
4975
|
+
if (n && !n.isEmpty && G(n.rawValue)) return `${e.rawValue.toUpperCase()}h (dec ${nr(e.hexValue)})`;
|
|
4976
|
+
}
|
|
4977
|
+
return vi(e);
|
|
4978
|
+
}
|
|
4979
|
+
function si(e) {
|
|
4980
|
+
return ai(e).map((e) => e.text).join(" — ");
|
|
4931
4981
|
}
|
|
4932
4982
|
function $(...e) {
|
|
4933
4983
|
return e.flatMap(([e, t]) => t ? [{
|
|
@@ -4935,33 +4985,33 @@ function $(...e) {
|
|
|
4935
4985
|
text: t
|
|
4936
4986
|
}] : []);
|
|
4937
4987
|
}
|
|
4938
|
-
function
|
|
4988
|
+
function ci(e, t, n) {
|
|
4939
4989
|
let r = /^fx(\d)/.exec(t.key)?.[1];
|
|
4940
4990
|
if (!r) return [];
|
|
4941
4991
|
let i = n.fields[`fx${r}cmd`], a = n.fields[`fx${r}val`];
|
|
4942
4992
|
if (!i || i.isEmpty) {
|
|
4943
4993
|
if (e.fxLane?.event !== "continue") return [];
|
|
4944
|
-
let t = e.fxLane.source?.cmd, n = t &&
|
|
4945
|
-
return $(["fxLane",
|
|
4994
|
+
let t = e.fxLane.source?.cmd, n = t && G(t) ? Sr(e.relativeFx?.[t]) : null;
|
|
4995
|
+
return $(["fxLane", gr(e.fxLane)], ["relative", n]);
|
|
4946
4996
|
}
|
|
4947
|
-
let o = i.rawValue.toUpperCase(), s = e.fxLane && e.fxLane.event !== "none" && e.fxLane.event !== "set" ?
|
|
4997
|
+
let o = i.rawValue.toUpperCase(), s = e.fxLane && e.fxLane.event !== "none" && e.fxLane.event !== "set" ? gr(e.fxLane) : null;
|
|
4948
4998
|
if ((o === "REP" || o === "RTO") && e.viewName !== "table") {
|
|
4949
|
-
let t = e.fxLane?.source?.cmd, n = o === "REP" && e.fxLane?.active && t &&
|
|
4999
|
+
let t = e.fxLane?.source?.cmd, n = o === "REP" && e.fxLane?.active && t && G(t) ? Sr(e.relativeFx?.[t]) : null;
|
|
4950
5000
|
return $(["fxLane", s], ["relative", n]);
|
|
4951
5001
|
}
|
|
4952
5002
|
if (!a || a.isEmpty || a.hexValue == null) return $(["fxLane", s]);
|
|
4953
|
-
let c = t.type === "fxCommand" ? `value ${
|
|
5003
|
+
let c = t.type === "fxCommand" ? `value ${a.rawValue.toUpperCase()}: ` : "", l = pr(o, a.hexValue, {
|
|
4954
5004
|
note: n.fields.note?.isEmpty ? null : n.fields.note?.rawValue,
|
|
4955
5005
|
inTable: e.viewName === "table",
|
|
4956
5006
|
row: n.rowIndex
|
|
4957
5007
|
}), u = null;
|
|
4958
|
-
return
|
|
5008
|
+
return G(o) ? u = Sr(e.relativeFx?.[o]) : o === "RET" && e.resetsRelative && (u = Cr(e.resetsRelative)), $(["meaning", l ? `${c}${l}` : null], ["fxLane", s], ["relative", u]);
|
|
4959
5009
|
}
|
|
4960
|
-
function
|
|
5010
|
+
function li(e) {
|
|
4961
5011
|
let t = e.description.replace(/\.$/, "");
|
|
4962
|
-
return e.instrumentTypes ? `${t}; offered by ${e.instrumentTypes.map((e) =>
|
|
5012
|
+
return e.instrumentTypes ? `${t}; offered by ${e.instrumentTypes.map((e) => ui[e] ?? e).join(", ")} instruments` : t;
|
|
4963
5013
|
}
|
|
4964
|
-
var
|
|
5014
|
+
var ui = {
|
|
4965
5015
|
sampler: "Sampler",
|
|
4966
5016
|
macrosynth: "Macrosynth",
|
|
4967
5017
|
fmsynth: "FM Synth",
|
|
@@ -4970,17 +5020,17 @@ var ni = {
|
|
|
4970
5020
|
external: "External",
|
|
4971
5021
|
midiout: "MIDI Out"
|
|
4972
5022
|
};
|
|
4973
|
-
function
|
|
4974
|
-
return t.type !== "instrumentRef" || t.isEmpty || !e.resetsRelative ? [] : $(["relative",
|
|
5023
|
+
function di(e, t) {
|
|
5024
|
+
return t.type !== "instrumentRef" || t.isEmpty || !e.resetsRelative ? [] : $(["relative", Cr(e.resetsRelative)]);
|
|
4975
5025
|
}
|
|
4976
|
-
function
|
|
5026
|
+
function fi(e, t) {
|
|
4977
5027
|
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
5028
|
}
|
|
4979
|
-
var
|
|
5029
|
+
var pi = {
|
|
4980
5030
|
MODFX: "ModFX",
|
|
4981
5031
|
DELAY: "Delay",
|
|
4982
5032
|
REVERB: "Reverb"
|
|
4983
|
-
},
|
|
5033
|
+
}, mi = {
|
|
4984
5034
|
parent: "goes up to the parent directory",
|
|
4985
5035
|
directory: "directory: [EDIT] opens it",
|
|
4986
5036
|
instrumentPreset: "instrument preset: [EDIT] selects it",
|
|
@@ -4988,30 +5038,30 @@ var ai = {
|
|
|
4988
5038
|
m8file: "M8 file: [EDIT] selects it",
|
|
4989
5039
|
file: "file: [EDIT] selects it"
|
|
4990
5040
|
};
|
|
4991
|
-
function
|
|
5041
|
+
function hi(e) {
|
|
4992
5042
|
let t = `${e.viewTitle ?? e.viewName}${e.viewId ? ` ${e.viewId}` : ""}`, n = e.activeField;
|
|
4993
5043
|
if (!n) return $(["location", t], ["line", e.lineText]);
|
|
4994
|
-
let r = e.instrumentType?.key ?
|
|
4995
|
-
return $(["field", `${n.label}: ${
|
|
5044
|
+
let r = e.instrumentType?.key ? Pn(e.instrumentType.key) : null;
|
|
5045
|
+
return $(["field", `${n.label}: ${vi(n)}`], ["optionInfo", n.valueDescription], ["fieldInfo", n.description], ["fileInfo", n.fileKind && mi[n.fileKind]], ["instrument", e.instrumentType && `${r?.name ?? e.instrumentType.text} instrument`], ["section", e.section && (pi[e.section] ?? e.section)], ["location", t]);
|
|
4996
5046
|
}
|
|
4997
|
-
function
|
|
5047
|
+
function gi(e) {
|
|
4998
5048
|
let t = `${e.viewTitle ?? e.viewName}${e.viewId ? ` ${e.viewId}` : ""}`, n = e.activeField, r = e.scaleNote;
|
|
4999
5049
|
if (!n || !r) return e.lineText ? $(["location", t], ["line", e.lineText]) : null;
|
|
5000
5050
|
let { interval: i, enabled: a, offset: o } = r, s;
|
|
5001
5051
|
if (n.key === "offset") {
|
|
5002
|
-
let e = o == null ? `detune of ${i}` : o === 0 ? `${i} is not detuned` : `${i} is detuned by ${
|
|
5052
|
+
let e = o == null ? `detune of ${i}` : o === 0 ? `${i} is not detuned` : `${i} is detuned by ${jr(o)}`;
|
|
5003
5053
|
s = $(["field", `${n.label}: ${n.rawValue || "(empty)"}`], ["meaning", e], ["meaning", a === !1 ? "(note is OFF)" : null]);
|
|
5004
5054
|
} else {
|
|
5005
5055
|
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",
|
|
5056
|
+
s = $(["field", `${n.label}: ${n.key === "en" ? n.rawValue.toUpperCase() || "(unset)" : i}`], ["meaning", i], ["meaning", Dr(i)], ["meaning", `${e} the scale`]);
|
|
5007
5057
|
}
|
|
5008
5058
|
if (e.scale) {
|
|
5009
|
-
let [t, n] =
|
|
5059
|
+
let [t, n] = Ar(e.scale);
|
|
5010
5060
|
s.push(...$(["scale", `Scale: ${t}`], ["scale", n]));
|
|
5011
5061
|
}
|
|
5012
5062
|
return [...s, ...$(["location", `${t} row ${i}`])];
|
|
5013
5063
|
}
|
|
5014
|
-
function
|
|
5064
|
+
function _i(e) {
|
|
5015
5065
|
let t = e.unit ?? "";
|
|
5016
5066
|
if (e.values && e.parts) {
|
|
5017
5067
|
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 +5069,7 @@ function li(e) {
|
|
|
5019
5069
|
}
|
|
5020
5070
|
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
5071
|
}
|
|
5022
|
-
function
|
|
5072
|
+
function vi(e) {
|
|
5023
5073
|
if (e.isEmpty) return "(empty)";
|
|
5024
5074
|
let t = e.type === "name" || e.type === "fileEntry" ? e : {
|
|
5025
5075
|
...e,
|
|
@@ -5046,26 +5096,26 @@ function ui(e) {
|
|
|
5046
5096
|
case "fileEntry": return t.text ?? t.rawValue;
|
|
5047
5097
|
case "name": return `"${t.rawValue}"`;
|
|
5048
5098
|
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 ${
|
|
5099
|
+
case "parameter": return _i(t);
|
|
5100
|
+
case "noteInterval": return `Interval ${Er(t.rawValue) ?? t.rawValue}`;
|
|
5051
5101
|
case "semitoneOffset": return t.isEmpty ? "(empty)" : `${t.rawValue} st`;
|
|
5052
5102
|
default: return t.rawValue;
|
|
5053
5103
|
}
|
|
5054
5104
|
}
|
|
5055
5105
|
//#endregion
|
|
5056
5106
|
//#region src/client.ts
|
|
5057
|
-
var
|
|
5107
|
+
var yi = "yam8d-external-app", bi = 3e3, xi = (e) => {
|
|
5058
5108
|
let t = e.remoteHandle();
|
|
5059
5109
|
return {
|
|
5060
5110
|
call: (e, ...n) => t.call(e, ...n),
|
|
5061
5111
|
on: (e, n) => (t.addEventListener(e, n), () => t.removeEventListener(e, n)),
|
|
5062
5112
|
close: () => e.close()
|
|
5063
5113
|
};
|
|
5064
|
-
},
|
|
5114
|
+
}, Si = (e) => ({
|
|
5065
5115
|
call: (t, ...n) => e.methods[t](...n),
|
|
5066
5116
|
on: (t, n) => e.on(t, n),
|
|
5067
5117
|
close: () => e.dispose()
|
|
5068
|
-
}),
|
|
5118
|
+
}), Ci = (e) => {
|
|
5069
5119
|
let t = [];
|
|
5070
5120
|
return {
|
|
5071
5121
|
messenger: {
|
|
@@ -5079,21 +5129,21 @@ var di = "yam8d-external-app", fi = 3e3, pi = (e) => {
|
|
|
5079
5129
|
for (let e of t.splice(0)) e();
|
|
5080
5130
|
}
|
|
5081
5131
|
};
|
|
5082
|
-
},
|
|
5132
|
+
}, wi = () => {
|
|
5083
5133
|
if (typeof window > "u") return !1;
|
|
5084
5134
|
try {
|
|
5085
5135
|
return window.parent !== window;
|
|
5086
5136
|
} catch {
|
|
5087
5137
|
return !0;
|
|
5088
5138
|
}
|
|
5089
|
-
},
|
|
5139
|
+
}, Ti = (e) => e instanceof DOMException && (e.name === "NotFoundError" || e.name === "AbortError"), Ei = () => {
|
|
5090
5140
|
let e = typeof navigator > "u" ? null : navigator;
|
|
5091
5141
|
return {
|
|
5092
5142
|
serial: !!e && "serial" in e,
|
|
5093
5143
|
usb: !!e && "usb" in e,
|
|
5094
5144
|
midi: !!e && "requestMIDIAccess" in e
|
|
5095
5145
|
};
|
|
5096
|
-
},
|
|
5146
|
+
}, Di = () => ({
|
|
5097
5147
|
viewName: null,
|
|
5098
5148
|
viewTitle: null,
|
|
5099
5149
|
minimapKey: null,
|
|
@@ -5110,9 +5160,9 @@ var di = "yam8d-external-app", fi = 3e3, pi = (e) => {
|
|
|
5110
5160
|
fontMode: null,
|
|
5111
5161
|
systemInfo: null,
|
|
5112
5162
|
macroRunning: !1
|
|
5113
|
-
}),
|
|
5163
|
+
}), Oi = class {
|
|
5114
5164
|
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 =
|
|
5165
|
+
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 = Di(), this._screen = null, this.screenRefreshing = !1, this.screenDirty = !1, this.config = e;
|
|
5116
5166
|
}
|
|
5117
5167
|
get state() {
|
|
5118
5168
|
return this._state;
|
|
@@ -5134,11 +5184,11 @@ var di = "yam8d-external-app", fi = 3e3, pi = (e) => {
|
|
|
5134
5184
|
}
|
|
5135
5185
|
async resolveMode() {
|
|
5136
5186
|
let e = this.config.mode ?? "auto";
|
|
5137
|
-
if (e === "standalone" || e === "auto" && !
|
|
5187
|
+
if (e === "standalone" || e === "auto" && !wi()) {
|
|
5138
5188
|
await this.startStandalone();
|
|
5139
5189
|
return;
|
|
5140
5190
|
}
|
|
5141
|
-
let t = typeof window < "u" && window.name === "yam8d-external-app", n = e === "host" || t ? null : this.config.handshakeTimeoutMs ??
|
|
5191
|
+
let t = typeof window < "u" && window.name === "yam8d-external-app", n = e === "host" || t ? null : this.config.handshakeTimeoutMs ?? bi;
|
|
5142
5192
|
await this.handshake(n) || (this.config.debug && console.log("[M8 SDK] No yam8d host answered, switching to standalone mode"), await this.startStandalone());
|
|
5143
5193
|
}
|
|
5144
5194
|
async handshake(r) {
|
|
@@ -5150,10 +5200,10 @@ var di = "yam8d-external-app", fi = 3e3, pi = (e) => {
|
|
|
5150
5200
|
this.config.debug && (i = t(i, (e, ...t) => {
|
|
5151
5201
|
console.log("[M8 SDK]", e, ...t);
|
|
5152
5202
|
}));
|
|
5153
|
-
let a =
|
|
5203
|
+
let a = Ci(i), o = e(a.messenger, { ping: async () => "pong" }), s, c = new Promise((e) => {
|
|
5154
5204
|
r !== null && (s = setTimeout(() => e(null), r));
|
|
5155
5205
|
}), l = await Promise.race([o, c]);
|
|
5156
|
-
return clearTimeout(s), l ? (this._mode = "host", await this.attach(
|
|
5206
|
+
return clearTimeout(s), l ? (this._mode = "host", await this.attach(xi(l)), l.localHandle().emit("ready", void 0), !0) : (a.dispose(), !1);
|
|
5157
5207
|
}
|
|
5158
5208
|
async startStandalone() {
|
|
5159
5209
|
if (this._mode = "standalone", this.config.autoConnect !== !1) try {
|
|
@@ -5163,7 +5213,7 @@ var di = "yam8d-external-app", fi = 3e3, pi = (e) => {
|
|
|
5163
5213
|
}
|
|
5164
5214
|
}
|
|
5165
5215
|
async openDevice(e, t) {
|
|
5166
|
-
let n =
|
|
5216
|
+
let n = k();
|
|
5167
5217
|
if (!n.browserSupport) throw Error("This browser has no Web Serial, WebUSB or Web MIDI: the M8 cannot be reached from this page");
|
|
5168
5218
|
let r = e === "auto" && !t ? [
|
|
5169
5219
|
"serial",
|
|
@@ -5179,14 +5229,14 @@ var di = "yam8d-external-app", fi = 3e3, pi = (e) => {
|
|
|
5179
5229
|
});
|
|
5180
5230
|
break;
|
|
5181
5231
|
} catch (r) {
|
|
5182
|
-
if (a = r, t && !
|
|
5232
|
+
if (a = r, t && !Ti(r) && (i = await te(() => n.connect({
|
|
5183
5233
|
transport: e,
|
|
5184
5234
|
prompt: !1
|
|
5185
5235
|
}), { maxAttempts: 2 }), i)) break;
|
|
5186
5236
|
}
|
|
5187
5237
|
if (!i) throw a;
|
|
5188
|
-
let o =
|
|
5189
|
-
this.device = i, await this.attach(
|
|
5238
|
+
let o = Sn(i, { debug: this.config.debug });
|
|
5239
|
+
this.device = i, await this.attach(Si(o)), i.commands.resetScreen();
|
|
5190
5240
|
let s = i;
|
|
5191
5241
|
i.closed.then(() => {
|
|
5192
5242
|
this.device === s && (this.config.debug && console.log("[M8 SDK] Device connection ended"), this.device = null, this.detach());
|
|
@@ -5336,7 +5386,7 @@ var di = "yam8d-external-app", fi = 3e3, pi = (e) => {
|
|
|
5336
5386
|
}, e;
|
|
5337
5387
|
}
|
|
5338
5388
|
async captureSnapshot() {
|
|
5339
|
-
let [e, t] = await Promise.all([this.fetchState(), this.getScreen()]), n =
|
|
5389
|
+
let [e, t] = await Promise.all([this.fetchState(), this.getScreen()]), n = ii(e, t);
|
|
5340
5390
|
return {
|
|
5341
5391
|
capturedAt: Date.now(),
|
|
5342
5392
|
state: {
|
|
@@ -5349,8 +5399,8 @@ var di = "yam8d-external-app", fi = 3e3, pi = (e) => {
|
|
|
5349
5399
|
deviceModel: e.deviceModel
|
|
5350
5400
|
},
|
|
5351
5401
|
semantic: n,
|
|
5352
|
-
description: n ?
|
|
5353
|
-
descriptionParts: n ?
|
|
5402
|
+
description: n ? si(n) : null,
|
|
5403
|
+
descriptionParts: n ? ai(n) : null,
|
|
5354
5404
|
screen: t
|
|
5355
5405
|
};
|
|
5356
5406
|
}
|
|
@@ -5379,23 +5429,23 @@ var di = "yam8d-external-app", fi = 3e3, pi = (e) => {
|
|
|
5379
5429
|
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
5430
|
}
|
|
5381
5431
|
getSemanticContext() {
|
|
5382
|
-
return
|
|
5432
|
+
return ii(this._state, this._screen);
|
|
5383
5433
|
}
|
|
5384
5434
|
describeContext() {
|
|
5385
|
-
let e =
|
|
5386
|
-
return e ?
|
|
5435
|
+
let e = ii(this._state, this._screen);
|
|
5436
|
+
return e ? si(e) : null;
|
|
5387
5437
|
}
|
|
5388
5438
|
describeContextParts() {
|
|
5389
|
-
let e =
|
|
5390
|
-
return e ?
|
|
5439
|
+
let e = ii(this._state, this._screen);
|
|
5440
|
+
return e ? ai(e) : null;
|
|
5391
5441
|
}
|
|
5392
5442
|
};
|
|
5393
|
-
async function
|
|
5394
|
-
let t = new
|
|
5443
|
+
async function ki(e = {}) {
|
|
5444
|
+
let t = new Oi(e);
|
|
5395
5445
|
return await t.connect(), t;
|
|
5396
5446
|
}
|
|
5397
|
-
function
|
|
5398
|
-
let t = new
|
|
5447
|
+
function Ai(e = {}) {
|
|
5448
|
+
let t = new Oi(e);
|
|
5399
5449
|
return {
|
|
5400
5450
|
client: t,
|
|
5401
5451
|
connect: async () => {
|
|
@@ -5403,10 +5453,10 @@ function Si(e = {}) {
|
|
|
5403
5453
|
}
|
|
5404
5454
|
};
|
|
5405
5455
|
}
|
|
5406
|
-
var
|
|
5407
|
-
createM8Client:
|
|
5408
|
-
createM8ClientSync:
|
|
5409
|
-
},
|
|
5456
|
+
var ji = {
|
|
5457
|
+
createM8Client: ki,
|
|
5458
|
+
createM8ClientSync: Ai
|
|
5459
|
+
}, Mi = [
|
|
5410
5460
|
{
|
|
5411
5461
|
role: "background",
|
|
5412
5462
|
label: "BACKGROUND"
|
|
@@ -5459,7 +5509,7 @@ var Ci = {
|
|
|
5459
5509
|
role: "meterPeak",
|
|
5460
5510
|
label: "METER PEAK"
|
|
5461
5511
|
}
|
|
5462
|
-
],
|
|
5512
|
+
], Ni = "themesettings", Pi = (e) => e.replace(/\s+/g, "").toUpperCase(), Fi = (e) => Math.max(0, Math.min(255, Math.round(e))).toString(16).padStart(2, "0"), Ii = (e, t, n) => `#${Fi(e)}${Fi(t)}${Fi(n)}`, Li = (e, t, n) => {
|
|
5463
5513
|
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
5514
|
[
|
|
5465
5515
|
a,
|
|
@@ -5492,14 +5542,14 @@ var Ci = {
|
|
|
5492
5542
|
l
|
|
5493
5543
|
]
|
|
5494
5544
|
][o];
|
|
5495
|
-
return
|
|
5496
|
-
},
|
|
5497
|
-
function
|
|
5545
|
+
return Ii(d * 255, f * 255, p * 255);
|
|
5546
|
+
}, Ri = new Map(Mi.map(({ role: e, label: t }) => [Pi(t), e]));
|
|
5547
|
+
function zi(e) {
|
|
5498
5548
|
let t = "rgb", n = null, r = {};
|
|
5499
5549
|
for (let i of e.lines) {
|
|
5500
5550
|
let e = i.replace(/[{}]/g, "0"), a = /^\s*MODE\s+([A-Z])\s+([A-Z])\s+([A-Z])\b/i.exec(e);
|
|
5501
5551
|
if (a) {
|
|
5502
|
-
t =
|
|
5552
|
+
t = Pi(a.slice(1).join("")) === "HSV" ? "hsv" : "rgb";
|
|
5503
5553
|
continue;
|
|
5504
5554
|
}
|
|
5505
5555
|
let o = /^\s*THEME\s+NAME\s+(\S.*?)\s*$/i.exec(e);
|
|
@@ -5510,23 +5560,23 @@ function ji(e) {
|
|
|
5510
5560
|
}
|
|
5511
5561
|
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
5562
|
if (!s) continue;
|
|
5513
|
-
let c =
|
|
5563
|
+
let c = Ri.get(Pi(s[1]));
|
|
5514
5564
|
if (!c || r[c]) continue;
|
|
5515
5565
|
let [l, u, d] = s.slice(2, 5).map((e) => parseInt(e, 16));
|
|
5516
|
-
r[c] = t === "hsv" ?
|
|
5566
|
+
r[c] = t === "hsv" ? Li(l, u, d) : Ii(l, u, d);
|
|
5517
5567
|
}
|
|
5518
|
-
return
|
|
5568
|
+
return Mi.some(({ role: e }) => !r[e]) ? null : {
|
|
5519
5569
|
colors: r,
|
|
5520
5570
|
mode: t,
|
|
5521
5571
|
name: n
|
|
5522
5572
|
};
|
|
5523
5573
|
}
|
|
5524
|
-
var
|
|
5525
|
-
function
|
|
5526
|
-
let t = {}, n =
|
|
5574
|
+
var Bi = (e) => e ? Ii(e.r, e.g, e.b) : void 0;
|
|
5575
|
+
function Vi(e) {
|
|
5576
|
+
let t = {}, n = Bi(e.backgroundColor), r = Bi(e.titleColor);
|
|
5527
5577
|
return n && (t.background = n), r && (t.textTitles = r), t;
|
|
5528
5578
|
}
|
|
5529
5579
|
//#endregion
|
|
5530
|
-
export {
|
|
5580
|
+
export { L as M8KeyMask, A as M8_AUDIO_CAPTURE_CONSTRAINTS, Mi as M8_THEME_ROLES, Ni as M8_THEME_VIEW, er as RELATIVE_FX_RULE, Gr as SCREEN_MARGIN, yi as YAM8D_FRAME_NAME, P as createM8Audio, ki as createM8Client, Ai as createM8ClientSync, k as createM8Connection, Sn as createM8Engine, ji as default, si as describeContext, ai as describeContextParts, vi as formatFieldValue, Ei as getDeviceSupport, $n as getInstrumentFxCommands, N as getM8InputStream, ii as getSemanticContext, Qn as lookupFxCommand, Vi as observeThemeColors, Xr as parseGridScreen, zi as parseThemeScreen, Ir as parseViewTitle, Be as pressKeys, Qr as readPlayPositions };
|
|
5531
5581
|
|
|
5532
5582
|
//# sourceMappingURL=index.js.map
|