@algorisys/tinyfly 0.128.0 → 0.129.0

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.
@@ -1,5 +1,5 @@
1
- import { H as we, A as Ot, R as de, B as _e, D as hn, E as Eo, F as pt, G as Or, I as be, J as Ir, K as so, L as To, M as Hr, N as jr, O as ba, P as Ao, Q as ya, S as Cr, T as _r, U as xr, V as Fe, W as Nr, X as De, Y as wa, Z as ka, _ as Zo, $ as Rr, a0 as We, a1 as Ue, a2 as Ne, a3 as zr, a4 as Wr, a5 as Kr, a6 as va, a7 as He, a8 as Ae, a9 as Sa, aa as Fr, ab as ao, ac as Ke, ad as Ma, ae as Dr, af as Lr, ag as $a, ah as Br, ai as qr, aj as Gr, ak as Yr, al as Ur, i as Xr, h as Vr, c as Jr, j as Zr, f as Qr, d as ei, b as ti, e as ni, C as oi, am as si, an as ai, ao as ri, ap as ii, aq as li, ar as hi, as as ci, at as di } from "./cricket-play-qqm3aXd-.js";
2
- import { au as Uu, av as Xu, aw as Vu, ax as Ju, ay as Zu, az as Qu, aA as eg, aB as tg, aC as ng, aD as og, aE as sg, aF as ag, aG as rg, aH as ig, aI as lg, aJ as hg, aK as cg, aL as dg, aM as fg, aN as ug, aO as gg, aP as pg, aQ as mg, aR as bg, aS as yg, aT as wg, aU as kg, aV as vg, aW as Sg, aX as Mg, aY as $g, aZ as Eg, a_ as Tg, a$ as Ag, b0 as Pg, b1 as Og, b2 as Ig, b3 as Hg, b4 as jg, b5 as Cg, b6 as _g, b7 as xg, b8 as Ng, b9 as Rg, ba as zg, bb as Wg, bc as Kg, bd as Fg, be as Dg, bf as Lg, bg as Bg, bh as qg, bi as Gg, bj as Yg, bk as Ug, bl as Xg, bm as Vg, bn as Jg, bo as Zg, bp as Qg, bq as ep, br as tp, bs as np, bt as op, bu as sp, bv as ap, bw as rp, bx as ip, by as lp, bz as hp, bA as cp, bB as dp, bC as fp, bD as up, bE as gp, bF as pp, bG as mp, bH as bp, bI as yp, bJ as wp, bK as kp, bL as vp } from "./cricket-play-qqm3aXd-.js";
1
+ import { H as we, A as Ot, R as de, B as _e, D as hn, E as Eo, F as pt, G as Or, I as ye, J as Ir, K as so, L as To, M as Hr, N as jr, O as ya, P as Ao, Q as ba, S as Cr, T as _r, U as xr, V as Fe, W as Nr, X as De, Y as wa, Z as ka, _ as Zo, $ as Rr, a0 as We, a1 as Ue, a2 as Ne, a3 as zr, a4 as Wr, a5 as Kr, a6 as va, a7 as He, a8 as Ae, a9 as Sa, aa as Fr, ab as ao, ac as Ke, ad as Ma, ae as Dr, af as Lr, ag as $a, ah as Br, ai as qr, aj as Gr, ak as Yr, al as Ur, i as Xr, h as Vr, c as Jr, j as Zr, f as Qr, d as ei, b as ti, e as ni, C as oi, am as si, an as ai, ao as ri, ap as ii, aq as li, ar as hi, as as ci, at as di } from "./cricket-play-qqm3aXd-.js";
2
+ import { au as Uu, av as Xu, aw as Vu, ax as Ju, ay as Zu, az as Qu, aA as eg, aB as tg, aC as ng, aD as og, aE as sg, aF as ag, aG as rg, aH as ig, aI as lg, aJ as hg, aK as cg, aL as dg, aM as fg, aN as ug, aO as gg, aP as pg, aQ as mg, aR as yg, aS as bg, aT as wg, aU as kg, aV as vg, aW as Sg, aX as Mg, aY as $g, aZ as Eg, a_ as Tg, a$ as Ag, b0 as Pg, b1 as Og, b2 as Ig, b3 as Hg, b4 as jg, b5 as Cg, b6 as _g, b7 as xg, b8 as Ng, b9 as Rg, ba as zg, bb as Wg, bc as Kg, bd as Fg, be as Dg, bf as Lg, bg as Bg, bh as qg, bi as Gg, bj as Yg, bk as Ug, bl as Xg, bm as Vg, bn as Jg, bo as Zg, bp as Qg, bq as ep, br as tp, bs as np, bt as op, bu as sp, bv as ap, bw as rp, bx as ip, by as lp, bz as hp, bA as cp, bB as dp, bC as fp, bD as up, bE as gp, bF as pp, bG as mp, bH as yp, bI as bp, bJ as wp, bK as kp, bL as vp } from "./cricket-play-qqm3aXd-.js";
3
3
  import { getEasingFunction as Et, hashSeed as Xe, mat4 as oe, vec3 as ke, quat as Ge, Timeline as ve, unknownName as ce, createRandom as Tt, springFollow as on, closestName as ro } from "@algorisys/tinyfly";
4
4
  import { f as cn, h as fi, a as Ea } from "./load-scene-oWNsYYC1.js";
5
5
  import { l as Ta, f as Aa } from "./shading-0lPgnXmD.js";
@@ -53,7 +53,7 @@ function mi(e, n, t, o) {
53
53
  hands: { left: hn(i.left, l.left, f), right: hn(i.right, l.right, f) }
54
54
  };
55
55
  }
56
- const bi = [
56
+ const yi = [
57
57
  ["leftShoulder", "rightShoulder"],
58
58
  ["leftElbow", "rightElbow"],
59
59
  ["leftWrist", "rightWrist"],
@@ -63,14 +63,14 @@ const bi = [
63
63
  ["leftFootOut", "rightFootOut"],
64
64
  ["leftEye", "rightEye"],
65
65
  ["leftBrow", "rightBrow"]
66
- ], yi = ["lean", "headTilt", "lookX", "spin"], wi = /* @__PURE__ */ new Set(["leftShoulder", "rightShoulder", "leftElbow", "rightElbow", "leftWrist", "rightWrist", "leftHip", "rightHip", "leftKnee", "rightKnee"]);
66
+ ], bi = ["lean", "headTilt", "lookX", "spin"], wi = /* @__PURE__ */ new Set(["leftShoulder", "rightShoulder", "leftElbow", "rightElbow", "leftWrist", "rightWrist", "leftHip", "rightHip", "leftKnee", "rightKnee"]);
67
67
  function ki(e) {
68
68
  const n = { ...e }, t = (e.turn ?? 0) >= 0.5;
69
- for (const [o, r] of bi) {
69
+ for (const [o, r] of yi) {
70
70
  const a = t && wi.has(o) ? -1 : 1;
71
71
  n[o] = a * e[r], n[r] = a * e[o];
72
72
  }
73
- if (!t) for (const o of yi) n[o] = -e[o];
73
+ if (!t) for (const o of bi) n[o] = -e[o];
74
74
  return n;
75
75
  }
76
76
  const vi = (e) => Math.min(1, Math.max(-1, (0.5 - e) * 4));
@@ -192,18 +192,18 @@ function Ti(e, n, t) {
192
192
  }
193
193
  }
194
194
  return { beat: $, travel: u };
195
- }), g = t.start ?? 0, b = t.x ?? 0;
195
+ }), g = t.start ?? 0, y = t.x ?? 0;
196
196
  return {
197
197
  id: `${e}-x`,
198
198
  target: e,
199
199
  property: "x",
200
- keyframes: p.map(($) => ({ time: g + $.beat * 6e4 / r, value: b + t.height * $.travel, easing: "linear" }))
200
+ keyframes: p.map(($) => ({ time: g + $.beat * 6e4 / r, value: y + t.height * $.travel, easing: "linear" }))
201
201
  };
202
202
  }
203
- function bf(e, n, t = 0) {
203
+ function yf(e, n, t = 0) {
204
204
  return (e - t) * n / 6e4;
205
205
  }
206
- function yf(e, n = {}) {
206
+ function bf(e, n = {}) {
207
207
  return (t) => Io(e, t, n);
208
208
  }
209
209
  function wf(e, n) {
@@ -232,21 +232,21 @@ function wf(e, n) {
232
232
  ];
233
233
  }
234
234
  function kf(e, n, t = {}) {
235
- const o = typeof n == "string" ? at[n] : n, r = t.bpm ?? o.bpm, a = t.beats ?? (t.move ? o.moves[t.move].beats : Ho(o)), s = t.samplesPerBeat ?? 4, i = t.start ?? 0, l = Math.round(a * s), c = Array.from({ length: l + 1 }, (g, b) => {
236
- const $ = b / s;
235
+ const o = typeof n == "string" ? at[n] : n, r = t.bpm ?? o.bpm, a = t.beats ?? (t.move ? o.moves[t.move].beats : Ho(o)), s = t.samplesPerBeat ?? 4, i = t.start ?? 0, l = Math.round(a * s), c = Array.from({ length: l + 1 }, (g, y) => {
236
+ const $ = y / s;
237
237
  return { time: i + $ * 6e4 / r, frame: Io(o, $, t) };
238
- }), h = (g, b) => ({
238
+ }), h = (g, y) => ({
239
239
  id: `${e}-${g}`,
240
240
  target: e,
241
241
  property: g,
242
- keyframes: c.map(($) => ({ time: $.time, value: b($.frame) }))
243
- }), f = Object.keys(de).filter((g) => c.some((b) => b.frame.pose[g] !== c[0].frame.pose[g]) || c[0].frame.pose[g] !== de[g]).map((g) => h(g, (b) => b.pose[g])), u = t.height === void 0 ? void 0 : Ti(e, o, { ...t, bpm: r, beats: a, start: i, height: t.height, fade: 0 });
242
+ keyframes: c.map(($) => ({ time: $.time, value: y($.frame) }))
243
+ }), f = Object.keys(de).filter((g) => c.some((y) => y.frame.pose[g] !== c[0].frame.pose[g]) || c[0].frame.pose[g] !== de[g]).map((g) => h(g, (y) => y.pose[g])), u = t.height === void 0 ? void 0 : Ti(e, o, { ...t, bpm: r, beats: a, start: i, height: t.height, fade: 0 });
244
244
  if (u && f.push(u), t.hands === !1) return f;
245
245
  const p = [];
246
246
  for (const g of ["left", "right"])
247
- for (const b of Object.keys(_e)) {
248
- const $ = (A) => A.hands?.[g]?.[b] ?? _e[b];
249
- c.some((A) => $(A.frame) !== _e[b]) && p.push(h(Or(g, b), $));
247
+ for (const y of Object.keys(_e)) {
248
+ const $ = (A) => A.hands?.[g]?.[y] ?? _e[y];
249
+ c.some((A) => $(A.frame) !== _e[y]) && p.push(h(Or(g, y), $));
250
250
  }
251
251
  return [...f, ...p];
252
252
  }
@@ -863,7 +863,7 @@ const Nt = { type: "back", mode: "out", overshoot: 1.1 }, $e = "ease-out-cubic",
863
863
  ["left", "right"].flatMap((n) => Object.entries(we[e]).map(([t, o]) => [`hand.${n}.${t}`, o]))
864
864
  );
865
865
  function zn(e, n = !1) {
866
- const t = Ir(), o = so(t, be, "arm.left", [0.015, 0.68, 0.2], { height: 1 }), r = so(t, o, "arm.right", [-0.015, 0.68, 0.2], { height: 1 });
866
+ const t = Ir(), o = so(t, ye, "arm.left", [0.015, 0.68, 0.2], { height: 1 }), r = so(t, o, "arm.right", [-0.015, 0.68, 0.2], { height: 1 });
867
867
  return Array.from({ length: 32 }, (a, s) => {
868
868
  const i = s / 4, l = Math.floor(i), c = i - l, h = l % 2 === 0, d = Math.sin(Math.PI * c), f = Math.max(0, ...e.map((p) => 1 - Math.min(mt(i - p, 8), mt(p - i, 8)) / 0.5)), u = {
869
869
  side: (h ? 1 : -1) * 5 * Math.sin(Math.PI * c),
@@ -902,19 +902,19 @@ function Ha(e) {
902
902
  if (!n || !Number.isFinite(n.beats) || n.beats <= 0 || !Array.isArray(n.keys) || !n.keys.length || !Array.isArray(n.strikes) || !n.keys.every((t, o) => Number.isFinite(t.beat) && t.beat >= 0 && t.beat < n.beats && (o === 0 || t.beat > n.keys[o - 1].beat) && t.pose && Object.values(t.pose).every(Number.isFinite)) || !n.strikes.every((t) => Number.isFinite(t) && t >= 0 && t < n.beats)) throw new Error("humanDanceFrame: a dance with positive finite beats, ordered pose keys and strike beats within its loop is required");
903
903
  return n;
904
904
  }
905
- function fn(e, n, t = be) {
905
+ function fn(e, n, t = ye) {
906
906
  const o = Ha(e);
907
907
  if (!Number.isFinite(n)) throw new Error("humanDanceFrame: beat must be finite");
908
908
  const r = mt(n, o.beats);
909
909
  let a = o.keys.length - 1;
910
- for (let b = 0; b < o.keys.length; b++) o.keys[b].beat <= r && (a = b);
911
- const s = o.keys[a], i = o.keys[(a + 1) % o.keys.length], l = s.beat > r ? s.beat - o.beats : s.beat, c = i.beat <= s.beat ? i.beat + o.beats : i.beat, h = ts((r - l) / (c - s.beat)), d = { ...be, ...t };
912
- for (const b of new Set(o.keys.flatMap(($) => Object.keys($.pose)))) {
913
- if (b === "turn" || b === "roll") continue;
914
- const $ = b.match(/^hand\.(?:left|right)\.(.+)$/)?.[1], A = t[b] ?? be[b] ?? ($ ? _e[$] : void 0) ?? 0, k = s.pose[b] ?? A;
915
- d[b] = k + ((i.pose[b] ?? A) - k) * h;
916
- }
917
- const f = Math.floor(n), u = n - f, p = u <= 0.6 ? 1 : 1 - ts((u - 0.6) / 0.4), g = Math.max(0, ...o.strikes.map((b) => 1 - Math.min(mt(r - b, o.beats), mt(b - r, o.beats)) / 0.25));
910
+ for (let y = 0; y < o.keys.length; y++) o.keys[y].beat <= r && (a = y);
911
+ const s = o.keys[a], i = o.keys[(a + 1) % o.keys.length], l = s.beat > r ? s.beat - o.beats : s.beat, c = i.beat <= s.beat ? i.beat + o.beats : i.beat, h = ts((r - l) / (c - s.beat)), d = { ...ye, ...t };
912
+ for (const y of new Set(o.keys.flatMap(($) => Object.keys($.pose)))) {
913
+ if (y === "turn" || y === "roll") continue;
914
+ const $ = y.match(/^hand\.(?:left|right)\.(.+)$/)?.[1], A = t[y] ?? ye[y] ?? ($ ? _e[$] : void 0) ?? 0, k = s.pose[y] ?? A;
915
+ d[y] = k + ((i.pose[y] ?? A) - k) * h;
916
+ }
917
+ const f = Math.floor(n), u = n - f, p = u <= 0.6 ? 1 : 1 - ts((u - 0.6) / 0.4), g = Math.max(0, ...o.strikes.map((y) => 1 - Math.min(mt(r - y, o.beats), mt(y - r, o.beats)) / 0.25));
918
918
  return { pose: d, contact: { side: mt(f, 2) === 0 ? "left" : "right", start: f, weight: p }, strike: g };
919
919
  }
920
920
  function vf(e, n) {
@@ -922,19 +922,19 @@ function vf(e, n) {
922
922
  if (![o, r, a].every((l) => Number.isFinite(l) && l > 0)) throw new Error("humanDanceTracks: bpm, beats and samplesPerBeat must be positive and finite");
923
923
  if (!Number.isFinite(n.start ?? 0)) throw new Error("humanDanceTracks: start must be finite");
924
924
  const s = Math.max(1, Math.ceil(r * a)), i = Array.from({ length: s + 1 }, (l, c) => ({ time: (n.start ?? 0) + r * c / s * 6e4 / o, pose: fn(t, r * c / s, n.pose).pose }));
925
- return Object.keys(i[0].pose).filter((l) => l !== "turn" && l !== "roll" && i.some((c) => c.pose[l] !== (n.pose?.[l] ?? be[l]))).map((l) => ({
925
+ return Object.keys(i[0].pose).filter((l) => l !== "turn" && l !== "roll" && i.some((c) => c.pose[l] !== (n.pose?.[l] ?? ye[l]))).map((l) => ({
926
926
  id: `${e}-dance-${l}`,
927
927
  target: e,
928
928
  property: l,
929
929
  keyframes: i.map((c) => ({ time: c.time, value: c.pose[l], easing: "linear" }))
930
930
  }));
931
931
  }
932
- const Sn = (e, n) => [e[0] + n[0], e[1] + n[1], e[2] + n[2]], Ce = (e, n) => [e[0] - n[0], e[1] - n[1], e[2] - n[2]], un = (e, n) => [e[0] * n, e[1] * n, e[2] * n], jo = (e) => Math.hypot(...e), ja = (e) => un(e, 1 / (jo(e) || 1)), Mn = (e) => ({ ...be, ...e }), Co = (e) => To(e.character.plan, Mn(e.pose), { height: e.character.height, contact: e.character.contact });
932
+ const Sn = (e, n) => [e[0] + n[0], e[1] + n[1], e[2] + n[2]], Ce = (e, n) => [e[0] - n[0], e[1] - n[1], e[2] - n[2]], un = (e, n) => [e[0] * n, e[1] * n, e[2] * n], jo = (e) => Math.hypot(...e), ja = (e) => un(e, 1 / (jo(e) || 1)), Mn = (e) => ({ ...ye, ...e }), Co = (e) => To(e.character.plan, Mn(e.pose), { height: e.character.height, contact: e.character.contact });
933
933
  function St(e, n, t) {
934
934
  return Sn(e.position, Co(e).chains[n][t]);
935
935
  }
936
936
  function Ca(e, n, t) {
937
- const o = Mn(e.pose), r = Co(e).hip, a = Hr(e.character.plan, o, e.character.height), s = Ce(Ce(t, e.position), r), i = jr(s, (o.roll ?? 0) * Math.PI / 180), l = Sn(a.root, ba(i, -(o.turn ?? 0) * Math.PI / 2));
937
+ const o = Mn(e.pose), r = Co(e).hip, a = Hr(e.character.plan, o, e.character.height), s = Ce(Ce(t, e.position), r), i = jr(s, (o.roll ?? 0) * Math.PI / 180), l = Sn(a.root, ya(i, -(o.turn ?? 0) * Math.PI / 2));
938
938
  return so(e.character.plan, o, n, l, { height: e.character.height });
939
939
  }
940
940
  function Ki(e, n, t, o = "toe") {
@@ -960,10 +960,10 @@ function Sf(e, n, t = {}) {
960
960
  const d = ja([a[0] - c.position[0], o * 0.2, a[2] - c.position[2]]), f = Ce(a, un(d, r));
961
961
  let u = Mn(c.pose);
962
962
  for (let g = 0; g < 6; g++) {
963
- const b = { ...c, pose: u }, $ = St(b, `arm.${h}`, 2);
964
- u = Ca(b, `arm.${h}`, Ce(f, Ce(ns(b, h), $)));
963
+ const y = { ...c, pose: u }, $ = St(y, `arm.${h}`, 2);
964
+ u = Ca(y, `arm.${h}`, Ce(f, Ce(ns(y, h), $)));
965
965
  }
966
- for (const [g, b] of Object.entries(we.hold)) u[`hand.${h}.${g}`] = b;
966
+ for (const [g, y] of Object.entries(we.hold)) u[`hand.${h}.${g}`] = y;
967
967
  const p = ns({ ...c, pose: u }, h);
968
968
  return { pose: u, stick: { grip: p, tip: Sn(p, un(d, r)) } };
969
969
  }, i = s(e, t.sideA ?? "right"), l = s(n, t.sideB ?? "right");
@@ -981,8 +981,8 @@ function Fi(e, n) {
981
981
  const r = n.center ?? [0, 0], a = n.direction ?? 1;
982
982
  if (r.length !== 2 || !r.every(Number.isFinite) || !Number.isFinite(n.angle ?? 0) || !Number.isFinite(n.spins ?? 0) || ![1, -1].includes(a) || n.facing !== void 0 && !(typeof n.facing == "number" ? Number.isFinite(n.facing) : ["inward", "outward", "tangent"].includes(n.facing))) throw new Error("danceCircleAt: center, angle, spins and facing must be finite; direction is 1 or -1");
983
983
  const s = n.character ?? Ao({ height: 1.7 }), i = n.style ?? "garba", l = (h, d) => {
984
- const f = (n.angle ?? 0) + 360 * d / t + a * 360 * h / o, u = f * Math.PI / 180, p = n.facing ?? "inward", g = (typeof p == "number" ? p : f + (p === "inward" ? 180 : p === "tangent" ? a * 90 : 0)) + (n.spins ?? 0) * 360 * h / o, b = fn(i, h, { ...n.pose, turn: g / 90 });
985
- return { character: s, position: [r[0] + n.radius * Math.sin(u), 0, r[1] + n.radius * Math.cos(u)], pose: b.pose, heading: g, strike: b.strike };
984
+ const f = (n.angle ?? 0) + 360 * d / t + a * 360 * h / o, u = f * Math.PI / 180, p = n.facing ?? "inward", g = (typeof p == "number" ? p : f + (p === "inward" ? 180 : p === "tangent" ? a * 90 : 0)) + (n.spins ?? 0) * 360 * h / o, y = fn(i, h, { ...n.pose, turn: g / 90 });
985
+ return { character: s, position: [r[0] + n.radius * Math.sin(u), 0, r[1] + n.radius * Math.cos(u)], pose: y.pose, heading: g, strike: y.strike };
986
986
  }, c = fn(i, e).contact;
987
987
  return Array.from({ length: t }, (h, d) => {
988
988
  const f = l(e, d);
@@ -990,7 +990,7 @@ function Fi(e, n) {
990
990
  const u = l(c.start, d), p = St(u, `leg.${c.side}`, 3), g = Ki(f, c.side, p);
991
991
  return {
992
992
  ...f,
993
- pose: ya(f.pose, g.pose, c.weight),
993
+ pose: ba(f.pose, g.pose, c.weight),
994
994
  position: [f.position[0], g.position[1] * c.weight, f.position[2]],
995
995
  planted: g.reached && c.weight === 1
996
996
  };
@@ -1007,7 +1007,7 @@ function Mf(e, n) {
1007
1007
  const f = d.members[c], { turn: u, ...p } = f.pose;
1008
1008
  return { time: d.time, pose: { ...s ? f.pose : p, x: f.position[0], y: f.position[1], z: f.position[2], rotateY: s ? 0 : f.heading } };
1009
1009
  });
1010
- return Object.keys(h[0].pose).filter((d) => i.has(d) || h.some((f) => f.pose[d] !== (n.pose?.[d] ?? be[d]))).map((d) => ({
1010
+ return Object.keys(h[0].pose).filter((d) => i.has(d) || h.some((f) => f.pose[d] !== (n.pose?.[d] ?? ye[d]))).map((d) => ({
1011
1011
  id: `${l}-circle-${d}`,
1012
1012
  target: l,
1013
1013
  property: d,
@@ -1249,7 +1249,7 @@ const $n = {
1249
1249
  ], 1200)
1250
1250
  };
1251
1251
  function Zi(e, n) {
1252
- const t = Math.min(1, Math.max(0, e.turn ?? 0)), o = 1 - t, r = { ...be, turn: t }, a = [
1252
+ const t = Math.min(1, Math.max(0, e.turn ?? 0)), o = 1 - t, r = { ...ye, turn: t }, a = [
1253
1253
  { stick: "right", human: "left", s: 1 },
1254
1254
  { stick: "left", human: "right", s: -1 }
1255
1255
  ];
@@ -1477,19 +1477,19 @@ function dl(e, n, t, o, r) {
1477
1477
  for (const k of t.chains) {
1478
1478
  const m = o.chains[k.id], P = k.id === "spine" ? 1.9 : 1;
1479
1479
  k.bones.forEach((O, v) => {
1480
- const y = m[v], S = m[v + 1], w = ke.distance(y, S), [T, I] = O.width ?? [1, 1], C = h * P * (T + I) / 2;
1480
+ const b = m[v], S = m[v + 1], w = ke.distance(b, S), [T, I] = O.width ?? [1, 1], C = h * P * (T + I) / 2;
1481
1481
  if (w > 1e-6) {
1482
- const j = ke.lerp(y, S, 0.5), W = cl(ke.normalize(ke.subtract(S, y)));
1482
+ const j = ke.lerp(b, S, 0.5), W = cl(ke.normalize(ke.subtract(S, b)));
1483
1483
  f(n.cylinder, oe.multiply(oe.translation(j), oe.multiply(W, oe.scaling([C, w, C]))), i);
1484
1484
  }
1485
- u(y, h * P * T, i), u(S, h * P * I, i);
1485
+ u(b, h * P * T, i), u(S, h * P * I, i);
1486
1486
  }), k.id.startsWith("arm.") && u(m[m.length - 1], h * 1.5, l);
1487
1487
  }
1488
- const { center: p, rx: g, ry: b, axes: $ } = o.head, A = [...$[0], 0, ...$[1], 0, ...$[2], 0, ...p, 1];
1489
- f(n.sphere, oe.multiply(A, oe.scaling([g, b, g])), l);
1488
+ const { center: p, rx: g, ry: y, axes: $ } = o.head, A = [...$[0], 0, ...$[1], 0, ...$[2], 0, ...p, 1];
1489
+ f(n.sphere, oe.multiply(A, oe.scaling([g, y, g])), l);
1490
1490
  for (const k of [-1, 1]) {
1491
- const m = ke.normalize([k * 0.36, 0.15, 0.92]), P = ke.add(p, ke.add(ke.add(ke.scale($[0], m[0] * g * 1.04), ke.scale($[1], m[1] * b * 1.04)), ke.scale($[2], m[2] * g * 1.04))), O = [...$[0], 0, ...$[1], 0, ...$[2], 0, ...P, 1];
1492
- f(n.sphere, oe.multiply(O, oe.scaling([g * 0.11, b * 0.14, g * 0.03])), c);
1491
+ const m = ke.normalize([k * 0.36, 0.15, 0.92]), P = ke.add(p, ke.add(ke.add(ke.scale($[0], m[0] * g * 1.04), ke.scale($[1], m[1] * y * 1.04)), ke.scale($[2], m[2] * g * 1.04))), O = [...$[0], 0, ...$[1], 0, ...$[2], 0, ...P, 1];
1492
+ f(n.sphere, oe.multiply(O, oe.scaling([g * 0.11, y * 0.14, g * 0.03])), c);
1493
1493
  }
1494
1494
  return d;
1495
1495
  }
@@ -1509,36 +1509,36 @@ const Tf = {
1509
1509
  // `lights` may be missing from a scene entry older than this add-on: treated as none.
1510
1510
  resolve({ object: e, prepared: n, values: t, world: o, camera: r, lights: a = [], fog: s, toScreen: i }) {
1511
1511
  const l = e, c = n, h = c.who;
1512
- let d = { ...be, ...l.pose };
1513
- for (const [y, S] of t)
1514
- typeof S == "number" && !rl.has(y) && !il.has(y) && (d[y] = S);
1512
+ let d = { ...ye, ...l.pose };
1513
+ for (const [b, S] of t)
1514
+ typeof S == "number" && !rl.has(b) && !il.has(b) && (d[b] = S);
1515
1515
  const f = Math.max(0, Math.min(1, rs(t.get("walking")) ?? l.walking ?? 0));
1516
1516
  if (f > 0) {
1517
- const y = typeof t.get("gait") == "string" ? t.get("gait") : l.gait, S = _r(y, rs(t.get("walk")) ?? 0, d);
1517
+ const b = typeof t.get("gait") == "string" ? t.get("gait") : l.gait, S = _r(b, rs(t.get("walk")) ?? 0, d);
1518
1518
  d = Object.fromEntries(Object.keys({ ...d, ...S }).map((w) => [w, (d[w] ?? 0) + ((S[w] ?? 0) - (d[w] ?? 0)) * f]));
1519
1519
  }
1520
1520
  const u = l.height ?? ll, p = oe.multiply(r.view, o), g = {
1521
- toView: (y) => oe.transformPoint(p, y),
1522
- toScreen: (y) => i(y)
1521
+ toView: (b) => oe.transformPoint(p, b),
1522
+ toScreen: (b) => i(b)
1523
1523
  }, $ = -g.toView([0, u / 2, 0])[2];
1524
1524
  if ($ <= r.near) return null;
1525
- const A = l.shadow === !1 ? [] : [{ depth: $ + u, draw: (y) => hl(y, g, u * 0.18) }];
1525
+ const A = l.shadow === !1 ? [] : [{ depth: $ + u, draw: (b) => hl(b, g, u * 0.18) }];
1526
1526
  if (l.look === "solid") {
1527
- const y = To(h.plan, d, { height: u, contact: h.contact });
1528
- return { meshes: dl(l, c, h.plan, y, o), drawables: A };
1527
+ const b = To(h.plan, d, { height: u, contact: h.contact });
1528
+ return { meshes: dl(l, c, h.plan, b, o), drawables: A };
1529
1529
  }
1530
- const k = oe.transformPoint(o, [0, u * 0.6, 0]), m = ke.normalize(ke.subtract(r.position, k)), P = Ta(k, m, a).map((y) => Math.min(1, y));
1530
+ const k = oe.transformPoint(o, [0, u * 0.6, 0]), m = ke.normalize(ke.subtract(r.position, k)), P = Ta(k, m, a).map((b) => Math.min(1, b));
1531
1531
  let O = h;
1532
1532
  if (a.length > 0 && h.skin !== "none") {
1533
- const y = za(h.skin, P, Aa(s, ke.distance(k, r.position)), s?.color);
1534
- O = { ...h, skin: y, ...h.body ? { body: { ...h.body, fill: y } } : {} };
1533
+ const b = za(h.skin, P, Aa(s, ke.distance(k, r.position)), s?.color);
1534
+ O = { ...h, skin: b, ...h.body ? { body: { ...h.body, fill: b } } : {} };
1535
1535
  }
1536
1536
  const v = xr(O, d, g, { height: u });
1537
1537
  return {
1538
1538
  drawables: [
1539
1539
  ...A,
1540
1540
  // Ties keep the character's own order.
1541
- ...v.map((y, S) => ({ depth: -(y.sortDepth ?? y.depth) - S * 1e-6, draw: (w, T) => y.draw(w, T.time) }))
1541
+ ...v.map((b, S) => ({ depth: -(b.sortDepth ?? b.depth) - S * 1e-6, draw: (w, T) => b.draw(w, T.time) }))
1542
1542
  ]
1543
1543
  };
1544
1544
  }
@@ -1655,7 +1655,7 @@ function zo(e, n, t, o = {}) {
1655
1655
  let u = f ? [...f.keyframes] : [{ time: 0, value: l(d, 0) }];
1656
1656
  for (const p of t) {
1657
1657
  const g = Ka(p, o)[d];
1658
- g[0] = { ...g[0], value: l(d, p.start) }, g[g.length - 1] = { ...g[g.length - 1], value: l(d, p.end) }, u = [...u.filter((b) => b.time < p.start || b.time > p.end), ...g], u.sort((b, $) => b.time - $.time);
1658
+ g[0] = { ...g[0], value: l(d, p.start) }, g[g.length - 1] = { ...g[g.length - 1], value: l(d, p.end) }, u = [...u.filter((y) => y.time < p.start || y.time > p.end), ...g], u.sort((y, $) => y.time - $.time);
1659
1659
  }
1660
1660
  h.push({ id: f?.id ?? `${e}-${d}`, target: e, property: d, keyframes: u });
1661
1661
  }
@@ -1665,7 +1665,7 @@ const Rt = ([e, n, t]) => {
1665
1665
  const o = Math.hypot(e, n, t) || 1;
1666
1666
  return [e / o, n / o, t / o];
1667
1667
  };
1668
- function bl([e, n, t]) {
1668
+ function yl([e, n, t]) {
1669
1669
  const [o, r, a] = [e / 2, n / 2, t / 2];
1670
1670
  return {
1671
1671
  vertices: [
@@ -1689,7 +1689,7 @@ function bl([e, n, t]) {
1689
1689
  };
1690
1690
  }
1691
1691
  const ct = (e, [n, t, o]) => e === "z" ? [n, t, o] : e === "x" ? [o, t, n] : [n, o, t];
1692
- function yl(e, n, t = "x", o = 20, r = 0) {
1692
+ function bl(e, n, t = "x", o = 20, r = 0) {
1693
1693
  const a = [], s = n / 2;
1694
1694
  for (const c of [-s, s])
1695
1695
  for (let h = 0; h < o; h++) {
@@ -1771,8 +1771,8 @@ function Ml(e, n, t = 8) {
1771
1771
  e.forEach((s, i) => {
1772
1772
  const l = e[Math.min(i + 1, e.length - 1)], c = e[Math.max(i - 1, 0)], h = Rt([l[0] - c[0], l[1] - c[1], l[2] - c[2]]), d = Math.abs(h[1]) < 0.9 ? [0, 1, 0] : [1, 0, 0], f = Rt(gs(h, d)), u = gs(f, h);
1773
1773
  for (let p = 0; p < t; p++) {
1774
- const g = Math.PI * 2 * p / t, b = Math.cos(g) * o(i), $ = Math.sin(g) * o(i);
1775
- r.push([s[0] + f[0] * b + u[0] * $, s[1] + f[1] * b + u[1] * $, s[2] + f[2] * b + u[2] * $]);
1774
+ const g = Math.PI * 2 * p / t, y = Math.cos(g) * o(i), $ = Math.sin(g) * o(i);
1775
+ r.push([s[0] + f[0] * y + u[0] * $, s[1] + f[1] * y + u[1] * $, s[2] + f[2] * y + u[2] * $]);
1776
1776
  }
1777
1777
  });
1778
1778
  for (let s = 0; s < e.length - 1; s++)
@@ -1788,9 +1788,9 @@ function gs(e, n) {
1788
1788
  function $l(e) {
1789
1789
  switch (e.type) {
1790
1790
  case "box":
1791
- return bl(e.size);
1791
+ return yl(e.size);
1792
1792
  case "cylinder":
1793
- return yl(e.radius, e.length, e.axis, e.segments, e.spokes);
1793
+ return bl(e.radius, e.length, e.axis, e.segments, e.spokes);
1794
1794
  case "ellipsoid":
1795
1795
  return wl(e.radii, e.segments);
1796
1796
  case "extrude":
@@ -1806,8 +1806,8 @@ function Fa(e, n) {
1806
1806
  const t = (r) => e[Math.max(0, Math.min(e.length - 1, r))], o = (r) => {
1807
1807
  const a = r * (e.length - 1), s = Math.min(e.length - 2, Math.floor(a)), i = a - s, [l, c, h, d] = [t(s - 1), t(s), t(s + 1), t(s + 2)];
1808
1808
  return [0, 1, 2].map((f) => {
1809
- const u = l[f], p = c[f], g = h[f], b = d[f];
1810
- return 0.5 * (2 * p + (-u + g) * i + (2 * u - 5 * p + 4 * g - b) * i * i + (-u + 3 * p - 3 * g + b) * i * i * i);
1809
+ const u = l[f], p = c[f], g = h[f], y = d[f];
1810
+ return 0.5 * (2 * p + (-u + g) * i + (2 * u - 5 * p + 4 * g - y) * i * i + (-u + 3 * p - 3 * g + y) * i * i * i);
1811
1811
  });
1812
1812
  };
1813
1813
  return Array.from({ length: n }, (r, a) => o(a / (n - 1)));
@@ -1820,7 +1820,7 @@ function Da(e) {
1820
1820
  const n = e.map((t, o) => ({ frame: t, i: o })).sort((t, o) => t.frame.time - o.frame.time || t.i - o.i).map(({ frame: t }) => t);
1821
1821
  return n.filter((t, o) => o + 1 >= n.length || n[o + 1].time !== t.time);
1822
1822
  }
1823
- function bt(e, n) {
1823
+ function yt(e, n) {
1824
1824
  return Math.atan2(n[0] - e[0], n[1] - e[1]) * 180 / Math.PI;
1825
1825
  }
1826
1826
  function La(e) {
@@ -1849,9 +1849,9 @@ function qa(e, n) {
1849
1849
  }
1850
1850
  return (t + o) / 2;
1851
1851
  }
1852
- const Ht = 520, ps = ["do", "at", "for", "to", "through", "toward", "speed", "pose", "gag", "say", "look", "turns", "dance", "bpm", "beats"], El = (e) => Math.max(700, Array.from(e).length * 65), ms = 70, bs = 35;
1852
+ const Ht = 520, ps = ["do", "at", "for", "to", "through", "toward", "speed", "pose", "gag", "say", "look", "turns", "dance", "bpm", "beats"], El = (e) => Math.max(700, Array.from(e).length * 65), ms = 70, ys = 35;
1853
1853
  function Ga(e, n) {
1854
- const t = n[0] - e.x, o = n[1] - e.eyeHeight, r = n[2] - e.z, a = e.heading * Math.PI / 180, s = t * Math.cos(a) - r * Math.sin(a), i = t * Math.sin(a) + r * Math.cos(a), l = Math.atan2(s, i) * 180 / Math.PI, c = Math.hypot(s, i), h = -Math.atan2(o, c) * 180 / Math.PI, d = Math.max(-ms, Math.min(ms, l * 0.75)), f = Math.max(-bs, Math.min(bs, h * 0.7));
1854
+ const t = n[0] - e.x, o = n[1] - e.eyeHeight, r = n[2] - e.z, a = e.heading * Math.PI / 180, s = t * Math.cos(a) - r * Math.sin(a), i = t * Math.sin(a) + r * Math.cos(a), l = Math.atan2(s, i) * 180 / Math.PI, c = Math.hypot(s, i), h = -Math.atan2(o, c) * 180 / Math.PI, d = Math.max(-ms, Math.min(ms, l * 0.75)), f = Math.max(-ys, Math.min(ys, h * 0.7));
1855
1855
  return {
1856
1856
  "head.turn": d,
1857
1857
  "head.nod": f,
@@ -1895,43 +1895,43 @@ function Pf(e, n, t) {
1895
1895
  if (o.length > 0) throw new Error(`characterScript3D: ${o.length} problem(s) in the beats:
1896
1896
  ${o.map((v) => ` beat ${v.beat}: ${v.message}`).join(`
1897
1897
  `)}`);
1898
- const r = t.height ?? 1.7, a = { ...be, ...t.pose }, s = (v, y = a) => {
1898
+ const r = t.height ?? 1.7, a = { ...ye, ...t.pose }, s = (v, b = a) => {
1899
1899
  const S = v.match(/^hand\.(?:left|right)\.(.+)$/)?.[1];
1900
- return y[v] ?? be[v] ?? (S ? _e[S] : void 0) ?? 0;
1900
+ return b[v] ?? ye[v] ?? (S ? _e[S] : void 0) ?? 0;
1901
1901
  };
1902
1902
  let [i, l] = t.position ?? [0, 0], c = t.heading ?? 0, h = 0;
1903
- const d = /* @__PURE__ */ new Map(), f = [], u = (v, y, S, w = "linear") => {
1903
+ const d = /* @__PURE__ */ new Map(), f = [], u = (v, b, S, w = "linear") => {
1904
1904
  const T = d.get(v) ?? [];
1905
- T.push({ time: y, value: S, easing: w }), d.set(v, T);
1906
- }, p = (v, y, S) => {
1905
+ T.push({ time: b, value: S, easing: w }), d.set(v, T);
1906
+ }, p = (v, b, S) => {
1907
1907
  const w = d.get(v) ?? [];
1908
1908
  for (let T = w.length - 1; T >= 0; T--)
1909
- if (w[T].time === y) {
1909
+ if (w[T].time === b) {
1910
1910
  if (w[T].value === S) return;
1911
1911
  break;
1912
1912
  }
1913
- u(v, y, S);
1913
+ u(v, b, S);
1914
1914
  };
1915
1915
  u("x", 0, i), u("z", 0, l), u("rotateY", 0, c);
1916
- const g = (v, y, S) => {
1917
- const w = pn(c, y);
1916
+ const g = (v, b, S) => {
1917
+ const w = pn(c, b);
1918
1918
  if (Math.abs(w) < 1)
1919
1919
  return S !== void 0 && (p("rotateY", v, c), u("rotateY", v + S, c)), v + (S ?? 0);
1920
1920
  const T = S ?? Math.max(Ol, Math.abs(w) * Pl);
1921
1921
  return p("rotateY", v, c), c += w, u("rotateY", v + T, c, "ease-in-out"), v + T;
1922
- }, b = (v, y, S, w = "ease-in-out") => {
1922
+ }, y = (v, b, S, w = "ease-in-out") => {
1923
1923
  for (const [T, I] of Object.entries(S))
1924
- s(T) !== I && (p(T, v, s(T)), u(T, y, I, w), a[T] = I);
1925
- }, $ = (v, y, S) => {
1926
- const w = La([[i, l], ...y.through ?? [y.to]]);
1924
+ s(T) !== I && (p(T, v, s(T)), u(T, b, I, w), a[T] = I);
1925
+ }, $ = (v, b, S) => {
1926
+ const w = La([[i, l], ...b.through ?? [b.to]]);
1927
1927
  if (w.length < 2) return S;
1928
- const T = g(S, bt(w[0].point, w[1].point)), I = w[w.length - 1].at, C = y.speed ?? Tl[v] * Math.sqrt(r / 1.7), j = y.for ?? I / C * 1e3, W = wa(v, r), G = Et("ease-in-out"), Y = Math.min(Il, j / 4);
1928
+ const T = g(S, yt(w[0].point, w[1].point)), I = w[w.length - 1].at, C = b.speed ?? Tl[v] * Math.sqrt(r / 1.7), j = b.for ?? I / C * 1e3, W = wa(v, r), G = Et("ease-in-out"), Y = Math.min(Il, j / 4);
1929
1929
  f.push({ time: T, value: v }), p("walking", T, 0), u("walking", T + Y, 1, "ease-out"), u("walking", T + j - Y, 1), u("walking", T + j, 0, "ease-in");
1930
1930
  const ne = h;
1931
1931
  let B = c;
1932
1932
  for (let H = 0; ; H = Math.min(I, H + Al)) {
1933
1933
  const N = T + qa(G, H / I) * j, { point: R, direction: M } = Ba(w, H);
1934
- B += pn(B, bt([0, 0], M));
1934
+ B += pn(B, yt([0, 0], M));
1935
1935
  const _ = H === 0 ? p : u;
1936
1936
  if (_("x", N, R[0]), _("z", N, R[1]), _("rotateY", N, B), _("walk", N, ne + H / W), H >= I) break;
1937
1937
  }
@@ -1939,56 +1939,56 @@ ${o.map((v) => ` beat ${v.beat}: ${v.message}`).join(`
1939
1939
  }, A = [], k = [];
1940
1940
  let m = 0;
1941
1941
  for (const v of n) {
1942
- const y = v.at ?? m;
1943
- let S = y;
1944
- if (co.includes(v.do)) S = $(v.do, v, y);
1945
- else if (v.do === "face") S = g(y, typeof v.toward == "number" ? v.toward : bt([i, l], v.toward), v.for);
1942
+ const b = v.at ?? m;
1943
+ let S = b;
1944
+ if (co.includes(v.do)) S = $(v.do, v, b);
1945
+ else if (v.do === "face") S = g(b, typeof v.toward == "number" ? v.toward : yt([i, l], v.toward), v.for);
1946
1946
  else if (v.do === "spin")
1947
- S = y + (v.for ?? 1e3), p("rotateY", y, c), c += (v.turns ?? 1) * 360, u("rotateY", S, c, "linear");
1947
+ S = b + (v.for ?? 1e3), p("rotateY", b, c), c += (v.turns ?? 1) * 360, u("rotateY", S, c, "linear");
1948
1948
  else if (v.do === "dance") {
1949
1949
  const w = vt[v.dance], T = v.bpm ?? w.bpm, I = v.beats ?? (v.for !== void 0 ? v.for * T / 6e4 : w.beats);
1950
- S = y + (v.for ?? I * 6e4 / T);
1951
- const C = { ...a }, j = Math.max(1, Math.ceil(I * 16)), W = Array.from({ length: j + 1 }, (Y, ne) => fn(v.dance, I * ne / j, C).pose), G = Math.min(150, (S - y) / 4);
1950
+ S = b + (v.for ?? I * 6e4 / T);
1951
+ const C = { ...a }, j = Math.max(1, Math.ceil(I * 16)), W = Array.from({ length: j + 1 }, (Y, ne) => fn(v.dance, I * ne / j, C).pose), G = Math.min(150, (S - b) / 4);
1952
1952
  for (const Y of Object.keys(W[0])) {
1953
1953
  const ne = s(Y, C);
1954
- Y === "turn" || Y === "roll" || W.every((B) => B[Y] === ne) || (p(Y, y, ne), W.slice(1).forEach((B, H) => {
1955
- const N = y + (S - y) * (H + 1) / j, R = Math.min(1, (N - y) / G), M = R * R * (3 - 2 * R);
1954
+ Y === "turn" || Y === "roll" || W.every((B) => B[Y] === ne) || (p(Y, b, ne), W.slice(1).forEach((B, H) => {
1955
+ const N = b + (S - b) * (H + 1) / j, R = Math.min(1, (N - b) / G), M = R * R * (3 - 2 * R);
1956
1956
  u(Y, N, ne + (B[Y] - ne) * M);
1957
1957
  }), a[Y] = W[j][Y]);
1958
1958
  }
1959
- } else if (v.do === "hold") S = y + (v.for ?? 1e3);
1959
+ } else if (v.do === "hold") S = b + (v.for ?? 1e3);
1960
1960
  else if (v.do === "place")
1961
- p("x", y, i), p("z", y, l), [i, l] = v.to, u("x", y + 1, i), u("z", y + 1, l), typeof v.toward == "number" && (p("rotateY", y, c), c = v.toward, u("rotateY", y + 1, c)), S = y + 1;
1961
+ p("x", b, i), p("z", b, l), [i, l] = v.to, u("x", b + 1, i), u("z", b + 1, l), typeof v.toward == "number" && (p("rotateY", b, c), c = v.toward, u("rotateY", b + 1, c)), S = b + 1;
1962
1962
  else if (v.do === "pose") {
1963
- S = y + (v.for ?? 500);
1963
+ S = b + (v.for ?? 500);
1964
1964
  const w = typeof v.pose == "string" ? Fe[v.pose] : v.pose;
1965
- b(y, S, w);
1965
+ y(b, S, w);
1966
1966
  } else if (v.do === "gag") {
1967
- const w = Nr(v.gag, { at: y, from: { ...a } });
1967
+ const w = Nr(v.gag, { at: b, from: { ...a } });
1968
1968
  let T = w[0];
1969
1969
  for (const I of w.slice(1))
1970
- b(T.time, I.time, Object.fromEntries(Object.entries(I.pose).filter(([C, j]) => a[C] !== j)), I.easing ?? "ease-in-out"), T = I;
1970
+ y(T.time, I.time, Object.fromEntries(Object.entries(I.pose).filter(([C, j]) => a[C] !== j)), I.easing ?? "ease-in-out"), T = I;
1971
1971
  S = T.time;
1972
1972
  } else if (v.do === "say") {
1973
- S = y + (v.for ?? El(v.say)), k.push({ text: v.say, start: y, end: S });
1973
+ S = b + (v.for ?? El(v.say)), k.push({ text: v.say, start: b, end: S });
1974
1974
  const w = { tilt: a["head.tilt"] ?? 0, left: a["brow.left"] ?? 0, right: a["brow.right"] ?? 0 };
1975
1975
  let T = 0;
1976
- for (let I = y + Ht; I < S - Ht / 2; I += Ht, T++) {
1976
+ for (let I = b + Ht; I < S - Ht / 2; I += Ht, T++) {
1977
1977
  const C = T % 2 === 0;
1978
- b(I - Ht / 2, I, { "head.tilt": w.tilt + (C ? 3 : -2), "brow.left": w.left + (C ? 0.25 : 0), "brow.right": w.right + (C ? 0.25 : 0) });
1978
+ y(I - Ht / 2, I, { "head.tilt": w.tilt + (C ? 3 : -2), "brow.left": w.left + (C ? 0.25 : 0), "brow.right": w.right + (C ? 0.25 : 0) });
1979
1979
  }
1980
- T > 0 && b(S - Ht / 2, S, { "head.tilt": w.tilt, "brow.left": w.left, "brow.right": w.right });
1980
+ T > 0 && y(S - Ht / 2, S, { "head.tilt": w.tilt, "brow.left": w.left, "brow.right": w.right });
1981
1981
  } else if (v.do === "look") {
1982
1982
  const w = v.look ?? v.toward, T = r * 0.9, I = w === "camera" ? t.camera ?? [0, 1.6, 8] : w.length === 3 ? w : [w[0], T, w[1]];
1983
- S = y + (v.for ?? 500), b(y, S, Ga({ x: i, z: l, heading: c, eyeHeight: T }, I), "ease-out");
1983
+ S = b + (v.for ?? 500), y(b, S, Ga({ x: i, z: l, heading: c, eyeHeight: T }, I), "ease-out");
1984
1984
  }
1985
- A.push({ do: v.do, start: y, end: S }), m = S;
1985
+ A.push({ do: v.do, start: b, end: S }), m = S;
1986
1986
  }
1987
1987
  const P = `${t.scene}/${e}`;
1988
- let O = [...d].map(([v, y]) => ({ id: `${e}-${v}`, target: P, property: v, keyframes: Da(y) }));
1989
- return f.length > 0 && O.push({ id: `${e}-gait`, target: P, property: "gait", keyframes: f }), k.length > 0 && (O = zo(P, O, k, { rest: { mouth: t.pose?.mouth ?? be.mouth ?? 0, mouthWidth: t.pose?.mouthWidth ?? be.mouthWidth ?? 1 } })), { tracks: O, duration: m, beats: A, end: { position: [i, l], heading: c, pose: { ...a } } };
1988
+ let O = [...d].map(([v, b]) => ({ id: `${e}-${v}`, target: P, property: v, keyframes: Da(b) }));
1989
+ return f.length > 0 && O.push({ id: `${e}-gait`, target: P, property: "gait", keyframes: f }), k.length > 0 && (O = zo(P, O, k, { rest: { mouth: t.pose?.mouth ?? ye.mouth ?? 0, mouthWidth: t.pose?.mouthWidth ?? ye.mouthWidth ?? 1 } })), { tracks: O, duration: m, beats: A, end: { position: [i, l], heading: c, pose: { ...a } } };
1990
1990
  }
1991
- function ys(e, n, t = [0, 0, 0]) {
1991
+ function bs(e, n, t = [0, 0, 0]) {
1992
1992
  const o = e.filter((a) => a.target === n), r = new ve({ id: `${n}-position`, tracks: o });
1993
1993
  return (a) => {
1994
1994
  const s = r.getStateAtTime(a).values.get(n), i = s?.get("position");
@@ -2001,17 +2001,17 @@ function ys(e, n, t = [0, 0, 0]) {
2001
2001
  };
2002
2002
  }
2003
2003
  function Of(e, n) {
2004
- const t = `${n.scene}/${n.character}`, o = n.height ?? 1.7, r = Math.max(1, n.every ?? 66), a = n.objects?.[n.character] ?? [0, 0, 0], s = new ve({ id: `${t}-own`, tracks: e.filter((d) => d.target === t) }), i = n.at, l = typeof i == "function" ? i : Array.isArray(i) ? () => i : "camera" in i ? ys(e, `${n.scene}/${i.camera}`, n.objects?.[i.camera] ?? [0, 1.6, 8]) : (() => {
2005
- const d = ys(e, `${n.scene}/${i.object}`, n.objects?.[i.object] ?? [0, 0, 0]), f = i.eyeHeight ?? o * 0.9;
2004
+ const t = `${n.scene}/${n.character}`, o = n.height ?? 1.7, r = Math.max(1, n.every ?? 66), a = n.objects?.[n.character] ?? [0, 0, 0], s = new ve({ id: `${t}-own`, tracks: e.filter((d) => d.target === t) }), i = n.at, l = typeof i == "function" ? i : Array.isArray(i) ? () => i : "camera" in i ? bs(e, `${n.scene}/${i.camera}`, n.objects?.[i.camera] ?? [0, 1.6, 8]) : (() => {
2005
+ const d = bs(e, `${n.scene}/${i.object}`, n.objects?.[i.object] ?? [0, 0, 0]), f = i.eyeHeight ?? o * 0.9;
2006
2006
  return (u) => {
2007
2007
  const p = d(u);
2008
2008
  return [p[0], p[1] + f, p[2]];
2009
2009
  };
2010
2010
  })(), c = ["head.turn", "head.nod", "lookX", "lookY"], h = { "head.turn": [], "head.nod": [], lookX: [], lookY: [] };
2011
2011
  for (let d = n.start; ; d = Math.min(n.end, d + r)) {
2012
- const f = s.getStateAtTime(d).values.get(t), u = (g, b) => {
2012
+ const f = s.getStateAtTime(d).values.get(t), u = (g, y) => {
2013
2013
  const $ = f?.get(g);
2014
- return typeof $ == "number" ? $ : b;
2014
+ return typeof $ == "number" ? $ : y;
2015
2015
  }, p = Ga({ x: u("x", a[0]), z: u("z", a[2]), heading: u("rotateY", 0), eyeHeight: u("y", a[1]) + o * 0.9 }, l(d));
2016
2016
  for (const g of c) h[g].push({ time: d, value: p[g] ?? 0 });
2017
2017
  if (d >= n.end) break;
@@ -2033,7 +2033,7 @@ function If(e) {
2033
2033
  const d = () => (h ^= h << 13, h >>>= 0, h ^= h >> 17, h ^= h << 5, h >>>= 0, h / 4294967296), f = [];
2034
2034
  for (let u = 0; u < n; u++) {
2035
2035
  let p = [t, o], g = -1 / 0;
2036
- for (let b = 0; b < 24; b++) {
2036
+ for (let y = 0; y < 24; y++) {
2037
2037
  const $ = Math.sqrt(d()) * r * Math.max(1, Math.sqrt(n) * 0.9), A = d() * Math.PI * 2, k = [t + Math.cos(A) * $, o + Math.sin(A) * $], m = f.length === 0 ? 1 / 0 : Math.min(...f.map((P) => Math.hypot(P[0] - k[0], P[1] - k[1])));
2038
2038
  if (m > g && (g = m, p = k), m >= r) break;
2039
2039
  }
@@ -2046,8 +2046,8 @@ function If(e) {
2046
2046
  const d = n === 1 ? 0 : h / (n - 1) - 0.5, f = d * l;
2047
2047
  let u = t + Math.sin(i) * f, p = o + Math.cos(i) * f, g = ((e.heading ?? 90) - 90 + 360) % 360;
2048
2048
  if (a === "arc") {
2049
- const b = (1 - Math.cos(d * c)) * l * 0.5;
2050
- u -= Math.cos(i) * b, p += Math.sin(i) * b, g = (g - d * (e.bend ?? 60) + 360) % 360;
2049
+ const y = (1 - Math.cos(d * c)) * l * 0.5;
2050
+ u -= Math.cos(i) * y, p += Math.sin(i) * y, g = (g - d * (e.bend ?? 60) + 360) % 360;
2051
2051
  }
2052
2052
  s.push({ position: [u, p], heading: g });
2053
2053
  }
@@ -2091,12 +2091,12 @@ function Xa(e, n, t = {}, o) {
2091
2091
  const r = t.tool ?? "pencil", a = t.skin ?? "#f1c9a5", s = t.outline ?? "#2f2f33", i = t.scale ?? 1, l = Math.min(1, Math.max(0, t.lift ?? 0)), c = (t.angle ?? -30) * Math.PI / 180, h = o ? o.nudge(0.6) : { x: 0, y: 0 }, d = Ua * i * (1 + 0.05 * l);
2092
2092
  l > 0 && (e.save(), e.fillStyle = s, e.globalAlpha = 0.15 * l, e.beginPath(), e.ellipse(n.x, n.y, 9 * i, 4 * i, 0, 0, Math.PI * 2), e.fill(), e.restore());
2093
2093
  const f = { x: n.x + h.x + 6 * l * i, y: n.y + h.y - 18 * l * i }, u = we.pencilGrip, p = (v) => {
2094
- const y = v.fingers.thumb, S = v.fingers.index, w = v.fingers.middle, T = ws([y.points[3], S.points[3], w.points[3]]), I = ws([y.points[1], S.points[0]]), C = (y.depths[3] + S.depths[3] + w.depths[3]) / 3;
2094
+ const b = v.fingers.thumb, S = v.fingers.index, w = v.fingers.middle, T = ws([b.points[3], S.points[3], w.points[3]]), I = ws([b.points[1], S.points[0]]), C = (b.depths[3] + S.depths[3] + w.depths[3]) / 3;
2095
2095
  return { pinch: T, direction: Math.atan2(I.y - T.y, I.x - T.x), depth: C };
2096
- }, g = Zo(u, { size: d }), b = c - p(g).direction, $ = Zo(u, { size: d, angle: b * 180 / Math.PI }), A = p($), k = Cl[r] * i, m = { x: A.pinch.x - Math.cos(c) * k, y: A.pinch.y - Math.sin(c) * k }, P = { x: f.x - m.x, y: f.y - m.y }, O = $.axes.up;
2096
+ }, g = Zo(u, { size: d }), y = c - p(g).direction, $ = Zo(u, { size: d, angle: y * 180 / Math.PI }), A = p($), k = Cl[r] * i, m = { x: A.pinch.x - Math.cos(c) * k, y: A.pinch.y - Math.sin(c) * k }, P = { x: f.x - m.x, y: f.y - m.y }, O = $.axes.up;
2097
2097
  _l(e, P, { x: -O.x, y: -O.y }, d, t.arm ?? 300 * i, a, t.sleeve ?? "#5b7db1", s), Rr(e, P, u, {
2098
2098
  size: d,
2099
- angle: b * 180 / Math.PI,
2099
+ angle: y * 180 / Math.PI,
2100
2100
  skin: a,
2101
2101
  ink: s,
2102
2102
  lineWidth: 3 * i,
@@ -2113,30 +2113,30 @@ const ws = (e) => ({
2113
2113
  y: e.reduce((n, t) => n + t.y, 0) / e.length
2114
2114
  });
2115
2115
  function _l(e, n, t, o, r, a, s, i) {
2116
- const l = { x: -t.y, y: t.x }, c = o * 0.15, h = (g, b, $) => ({
2117
- x: n.x + t.x * g + l.x * b * $,
2118
- y: n.y + t.y * g + l.y * b * $
2116
+ const l = { x: -t.y, y: t.x }, c = o * 0.15, h = (g, y, $) => ({
2117
+ x: n.x + t.x * g + l.x * y * $,
2118
+ y: n.y + t.y * g + l.y * y * $
2119
2119
  }), d = h(r, 0, 0), f = (g) => {
2120
- const b = e.createLinearGradient(n.x, n.y, d.x, d.y);
2121
- return b.addColorStop(0, g), b.addColorStop(0.6, g), b.addColorStop(1, xl(g)), b;
2120
+ const y = e.createLinearGradient(n.x, n.y, d.x, d.y);
2121
+ return y.addColorStop(0, g), y.addColorStop(0.6, g), y.addColorStop(1, xl(g)), y;
2122
2122
  }, u = Math.min(o * 0.55, r * 0.35);
2123
2123
  e.save(), e.lineJoin = "round", e.lineCap = "round", e.lineWidth = 3 * (o / Ua), e.beginPath(), e.moveTo(h(-o * 0.1, -1, c).x, h(-o * 0.1, -1, c).y), e.lineTo(h(u + 4, -1, c * 1.1).x, h(u + 4, -1, c * 1.1).y), e.lineTo(h(u + 4, 1, c * 1.1).x, h(u + 4, 1, c * 1.1).y), e.lineTo(h(-o * 0.1, 1, c).x, h(-o * 0.1, 1, c).y), e.closePath(), e.fillStyle = a, e.fill(), e.strokeStyle = i, e.beginPath(), e.moveTo(h(0, -1, c).x, h(0, -1, c).y), e.lineTo(h(u, -1, c * 1.1).x, h(u, -1, c * 1.1).y), e.moveTo(h(0, 1, c).x, h(0, 1, c).y), e.lineTo(h(u, 1, c * 1.1).x, h(u, 1, c * 1.1).y), e.stroke();
2124
2124
  const p = [h(u, -1, c * 1.3), h(r, -1, c * 1.5), h(r, 1, c * 1.5), h(u, 1, c * 1.3)];
2125
- e.beginPath(), p.forEach((g, b) => b ? e.lineTo(g.x, g.y) : e.moveTo(g.x, g.y)), e.closePath(), e.fillStyle = f(s), e.fill(), e.strokeStyle = f(i), e.beginPath(), e.moveTo(p[1].x, p[1].y), e.lineTo(p[0].x, p[0].y), e.lineTo(p[3].x, p[3].y), e.lineTo(p[2].x, p[2].y), e.stroke(), e.restore();
2125
+ e.beginPath(), p.forEach((g, y) => y ? e.lineTo(g.x, g.y) : e.moveTo(g.x, g.y)), e.closePath(), e.fillStyle = f(s), e.fill(), e.strokeStyle = f(i), e.beginPath(), e.moveTo(p[1].x, p[1].y), e.lineTo(p[0].x, p[0].y), e.lineTo(p[3].x, p[3].y), e.lineTo(p[2].x, p[2].y), e.stroke(), e.restore();
2126
2126
  }
2127
2127
  function Hf(e, n, t = {}) {
2128
- const o = t.offstage ?? { x: 2e3, y: 1400 }, r = t.enter ?? 450, a = t.exit ?? 450, s = t.linger ?? 1500, i = [...e].filter((g) => g.path.length > 0).sort((g, b) => g.start - b.start), l = (g) => g.tool ?? "pencil", c = (g) => {
2129
- const b = Math.min(1, Math.max(0, g));
2130
- return b * b * (3 - 2 * b);
2131
- }, h = (g, b, $) => ({ x: g.x + (b.x - g.x) * $, y: g.y + (b.y - g.y) * $ }), d = i.find((g) => n >= g.start && n <= g.end);
2128
+ const o = t.offstage ?? { x: 2e3, y: 1400 }, r = t.enter ?? 450, a = t.exit ?? 450, s = t.linger ?? 1500, i = [...e].filter((g) => g.path.length > 0).sort((g, y) => g.start - y.start), l = (g) => g.tool ?? "pencil", c = (g) => {
2129
+ const y = Math.min(1, Math.max(0, g));
2130
+ return y * y * (3 - 2 * y);
2131
+ }, h = (g, y, $) => ({ x: g.x + (y.x - g.x) * $, y: g.y + (y.y - g.y) * $ }), d = i.find((g) => n >= g.start && n <= g.end);
2132
2132
  if (d) {
2133
- const g = d.end - d.start, b = g > 0 ? (n - d.start) / g : 1;
2134
- return { at: Po(d.path, b), tool: l(d), lift: 0, drawing: !0 };
2133
+ const g = d.end - d.start, y = g > 0 ? (n - d.start) / g : 1;
2134
+ return { at: Po(d.path, y), tool: l(d), lift: 0, drawing: !0 };
2135
2135
  }
2136
2136
  const f = [...i].reverse().find((g) => g.end < n), u = i.find((g) => g.start > n), p = (g) => g.path[g.path.length - 1];
2137
2137
  if (f && u && u.start - f.end <= s) {
2138
- const g = (n - f.end) / (u.start - f.end), b = g < 0.5 ? l(f) : l(u);
2139
- return { at: h(p(f), u.path[0], c(g)), tool: b, lift: Math.sin(Math.PI * g), drawing: !1 };
2138
+ const g = (n - f.end) / (u.start - f.end), y = g < 0.5 ? l(f) : l(u);
2139
+ return { at: h(p(f), u.path[0], c(g)), tool: y, lift: Math.sin(Math.PI * g), drawing: !1 };
2140
2140
  }
2141
2141
  if (u && u.start - n <= r) {
2142
2142
  const g = 1 - (u.start - n) / r;
@@ -2314,20 +2314,20 @@ function Ko(e, n, { ground: t, every: o, floors: r }) {
2314
2314
  const m = (S) => S < 0 ? 0 : r[S].offset(k), P = l(k);
2315
2315
  if (P >= 0) return m(P);
2316
2316
  if (Math.abs(i(k)) < 0.5) return 0;
2317
- const O = (S) => l(S) >= 0 || Math.abs(i(S)) < 0.5, v = [...c].reverse().find((S) => S <= k && O(S)), y = c.find((S) => S >= k && O(S));
2318
- return v === void 0 && y === void 0 ? 0 : v === void 0 ? m(l(y)) : y === void 0 || y === v ? m(l(v)) : m(l(v)) + (m(l(y)) - m(l(v))) * (k - v) / (y - v);
2317
+ const O = (S) => l(S) >= 0 || Math.abs(i(S)) < 0.5, v = [...c].reverse().find((S) => S <= k && O(S)), b = c.find((S) => S >= k && O(S));
2318
+ return v === void 0 && b === void 0 ? 0 : v === void 0 ? m(l(b)) : b === void 0 || b === v ? m(l(v)) : m(l(v)) + (m(l(b)) - m(l(v))) * (k - v) / (b - v);
2319
2319
  }, d = r.flatMap((k) => k.windows), f = (k, m) => d.some((P) => P.start < m && P.end > k) || h(k) !== h(m), u = a ? [...a.keyframes] : [{ time: 0, value: 0 }], p = [{ ...u[0], value: u[0].value + h(u[0].time) }], g = (k, m) => {
2320
2320
  const P = /* @__PURE__ */ new Set([m]);
2321
2321
  for (let O = k + o; O < m; O += o) P.add(O);
2322
2322
  for (const O of d) for (const v of [O.start, O.end]) v > k && v < m && P.add(v);
2323
- for (const O of [...P].sort((v, y) => v - y)) p.push({ time: O, value: i(O) + h(O) });
2323
+ for (const O of [...P].sort((v, b) => v - b)) p.push({ time: O, value: i(O) + h(O) });
2324
2324
  };
2325
2325
  for (let k = 1; k < u.length; k++) {
2326
2326
  const m = u[k - 1].time, P = u[k].time;
2327
2327
  f(m, P) ? g(m, P) : p.push({ ...u[k], value: u[k].value + h(P) });
2328
2328
  }
2329
- const b = u[u.length - 1].time, $ = Math.max(b, ...d.map((k) => k.end));
2330
- $ > b && g(b, $);
2329
+ const y = u[u.length - 1].time, $ = Math.max(y, ...d.map((k) => k.end));
2330
+ $ > y && g(y, $);
2331
2331
  const A = { id: a?.id ?? `${n}-y`, target: n, property: "y", keyframes: p };
2332
2332
  return a ? e.map((k) => k === a ? A : k) : [...e, A];
2333
2333
  }
@@ -2390,9 +2390,9 @@ function Rf(e) {
2390
2390
  const n = { ...Wl, ...e.theme }, t = e.code.replace(/\t/g, " ").replace(/\n$/, "").split(`
2391
2391
  `), o = e.fontSize ?? 16, r = (e.lineHeight ?? 1.6) * o, a = (e.charWidth ?? 0.6) * o, s = e.padding ?? 12, i = e.lineNumbers === !1 ? 0 : (String(t.length).length + 2) * a, l = Math.max(1, ...t.map((H) => H.length)), c = e.width ?? s * 2 + i + l * a, h = s * 2 + t.length * r, d = e.x + s + i, f = new Set(e.hidden ?? []), u = e.language ?? "plain";
2392
2392
  if (!uo.includes(u)) throw new Error(`codePanel: ${ce("language", u, uo)}`);
2393
- const p = t.map((H) => ql(H, u).flatMap((N) => Array.from(N.text, () => n[N.kind]))), g = Lt(), b = Tn(g), $ = [], A = /* @__PURE__ */ new Map(), k = [], m = [], P = (H) => {
2393
+ const p = t.map((H) => ql(H, u).flatMap((N) => Array.from(N.text, () => n[N.kind]))), g = Lt(), y = Tn(g), $ = [], A = /* @__PURE__ */ new Map(), k = [], m = [], P = (H) => {
2394
2394
  if (!Number.isInteger(H) || H < 1 || H > t.length) throw new Error(`codePanel: no line ${H} (it has ${t.length})`);
2395
- }, O = g.tween, v = g.last, y = (H, N, R, M, _, V = 300) => {
2395
+ }, O = g.tween, v = g.last, b = (H, N, R, M, _, V = 300) => {
2396
2396
  P(H), O(`line.${H}.${N}`, R, M, _, V);
2397
2397
  }, S = (H, N) => $.filter((R) => R.line < H && R.closed <= N).length, w = me, T = (H) => e.y + s + (H - 1) * r, I = (H) => Array.isArray(H) ? H : [H], C = (H, N, R) => {
2398
2398
  let M = -1;
@@ -2512,12 +2512,12 @@ function Rf(e) {
2512
2512
  highlight(H, N) {
2513
2513
  for (const R of I(H)) {
2514
2514
  const M = v(`line.${R}.highlight`, 0);
2515
- y(R, "highlight", M, N.on === !1 ? 0 : 1, N, 200);
2515
+ b(R, "highlight", M, N.on === !1 ? 0 : 1, N, 200);
2516
2516
  }
2517
2517
  return B;
2518
2518
  },
2519
2519
  strike(H, N) {
2520
- for (const R of I(H)) y(R, "strike", v(`line.${R}.strike`, 0), 1, N);
2520
+ for (const R of I(H)) b(R, "strike", v(`line.${R}.strike`, 0), 1, N);
2521
2521
  return B;
2522
2522
  },
2523
2523
  remove(H, N) {
@@ -2525,18 +2525,18 @@ function Rf(e) {
2525
2525
  if (!fo.includes(M)) throw new Error(`codePanel.remove: ${ce("style", M, fo)}`);
2526
2526
  const _ = M === "wipe" ? 300 : 450, V = N.at + (N.duration ?? _), ee = N.close ?? 250;
2527
2527
  for (const F of R)
2528
- y(F, "wipe", 0, 1, { ...N, easing: N.easing ?? (M === "fly" ? "ease-in" : void 0) }, _), A.set(F, { style: M, from: N.from ?? "left" }), $.push({ line: F, closed: V + ee });
2528
+ b(F, "wipe", 0, 1, { ...N, easing: N.easing ?? (M === "fly" ? "ease-in" : void 0) }, _), A.set(F, { style: M, from: N.from ?? "left" }), $.push({ line: F, closed: V + ee });
2529
2529
  for (let F = 1; F <= t.length; F++) {
2530
2530
  if (R.includes(F)) continue;
2531
2531
  const Q = R.filter((x) => x < F).length;
2532
2532
  if (Q === 0) continue;
2533
2533
  const ae = v(`line.${F}.shift`, 0);
2534
- y(F, "shift", ae, ae + Q, { at: V, duration: ee, easing: "ease-in-out" });
2534
+ b(F, "shift", ae, ae + Q, { at: V, duration: ee, easing: "ease-in-out" });
2535
2535
  }
2536
2536
  return B;
2537
2537
  },
2538
2538
  type(H, N) {
2539
- return y(H, "reveal", 0, 1, { duration: t[H - 1].length * 45, ...N }), B;
2539
+ return b(H, "reveal", 0, 1, { duration: t[H - 1].length * 45, ...N }), B;
2540
2540
  },
2541
2541
  piece(H, N, R = 1) {
2542
2542
  if (typeof H == "string") {
@@ -2557,13 +2557,13 @@ function Rf(e) {
2557
2557
  return j[`piece.${ee.id}.opacity`] = 1, ee;
2558
2558
  },
2559
2559
  follow(H, N) {
2560
- return b.follow(H, N), B;
2560
+ return y.follow(H, N), B;
2561
2561
  },
2562
2562
  fling(H, N) {
2563
- return b.fling(H, N), B;
2563
+ return y.fling(H, N), B;
2564
2564
  },
2565
2565
  move(H, N) {
2566
- return b.move(H, N), B;
2566
+ return y.move(H, N), B;
2567
2567
  },
2568
2568
  write(H, N, R) {
2569
2569
  return H.written = N, O(`piece.${H.id}.write`, 0, 1, { duration: Math.max(1, N.length) * 70, ...R }), B;
@@ -2583,7 +2583,7 @@ function Rf(e) {
2583
2583
  drop(H, N, R, M) {
2584
2584
  P(N);
2585
2585
  const _ = M.duration ?? 250, V = N === H.line, ee = M.easing ?? (V ? "linear" : "ease-out"), F = B.landing(H, N, R, M.at), Q = { id: m.length + 1, line: N, column: R, chars: H.text.length, at: M.at };
2586
- return m.push(Q), j[`insert.${Q.id}.open`] = 0, O(`insert.${Q.id}.open`, 0, 1, { at: M.at, duration: _, easing: V ? ee : "ease-out" }), O(`piece.${H.id}.away`, v(`piece.${H.id}.away`, 0), 1, { at: M.at, duration: _, easing: V ? ee : "ease-in-out" }), b.cutAfter(H, M.at), B.move(H, { at: M.at, duration: _, easing: ee, to: { x: F.x, y: F.y } }), O(`piece.${H.id}.rotate`, g.valueAt(`piece.${H.id}.rotate`, M.at), 0, { at: M.at, duration: _ }), B;
2586
+ return m.push(Q), j[`insert.${Q.id}.open`] = 0, O(`insert.${Q.id}.open`, 0, 1, { at: M.at, duration: _, easing: V ? ee : "ease-out" }), O(`piece.${H.id}.away`, v(`piece.${H.id}.away`, 0), 1, { at: M.at, duration: _, easing: V ? ee : "ease-in-out" }), y.cutAfter(H, M.at), B.move(H, { at: M.at, duration: _, easing: ee, to: { x: F.x, y: F.y } }), O(`piece.${H.id}.rotate`, g.valueAt(`piece.${H.id}.rotate`, M.at), 0, { at: M.at, duration: _ }), B;
2587
2587
  },
2588
2588
  landing(H, N, R, M = 1 / 0) {
2589
2589
  const _ = B.spot(N, R, H.text.length, M), V = N === H.line && R > H.column ? H.text.length * a : 0;
@@ -2786,15 +2786,15 @@ function zf(e) {
2786
2786
  const n = typeof e.theme == "string" ? e.theme : "whiteboard";
2787
2787
  if (!(n in Vt)) throw new Error(`whiteboard: ${ce("theme", n, Object.keys(Vt))}`);
2788
2788
  const t = typeof e.theme == "object" ? { ...Vt.whiteboard, ...e.theme } : Vt[n], o = e.fontSize ?? 28, r = e.charWidth ?? 0.55, a = (m) => m === void 0 ? t.ink : t.colors[m] ?? m, s = (m) => me(e.x + m.left, e.y + m.top, m.width, m.height), i = Lt(), l = Tn(i), c = {}, h = /* @__PURE__ */ new Map(), d = [], f = [], u = (m, P, O, v) => {
2789
- const y = h.get(m);
2790
- if (!y || y.kind !== "text") throw tt("whiteboard", v, Be, `there is no text "${m}" (texts: ${p().join(", ") || "none"})`);
2789
+ const b = h.get(m);
2790
+ if (!b || b.kind !== "text") throw tt("whiteboard", v, Be, `there is no text "${m}" (texts: ${p().join(", ") || "none"})`);
2791
2791
  let S = -1;
2792
2792
  for (let T = 0; T < O; T++)
2793
- if (S = y.item.text.indexOf(P, S + 1), S < 0) throw tt("whiteboard", v, Be, `text "${m}" has no ${O > 1 ? `${O}th ` : ""}"${P}"`);
2794
- const w = y.size * r;
2795
- return { column: S, box: me(y.box.left + S * w, y.box.top, P.length * w, y.box.height) };
2793
+ if (S = b.item.text.indexOf(P, S + 1), S < 0) throw tt("whiteboard", v, Be, `text "${m}" has no ${O > 1 ? `${O}th ` : ""}"${P}"`);
2794
+ const w = b.size * r;
2795
+ return { column: S, box: me(b.box.left + S * w, b.box.top, P.length * w, b.box.height) };
2796
2796
  }, p = () => [...h.values()].filter((m) => m.kind === "text").map((m) => m.item.id), g = (m) => {
2797
- const { kind: P, rest: O } = $t(m), v = (y) => tt("whiteboard", m, Be, y);
2797
+ const { kind: P, rest: O } = $t(m), v = (b) => tt("whiteboard", m, Be, b);
2798
2798
  if (P === "box") {
2799
2799
  if (O) throw v("box takes no arguments");
2800
2800
  return { kind: P };
@@ -2804,18 +2804,18 @@ function zf(e) {
2804
2804
  return { kind: P, id: O };
2805
2805
  }
2806
2806
  if (P === "term") {
2807
- const y = /^([^:#]+)(?:#(\d+))?:(.+)$/.exec(O);
2808
- if (!y) throw v("write it term:ID:TEXT, or term:ID#K:TEXT for the Kth");
2809
- return { kind: P, id: y[1], occurrence: y[2] ? Number(y[2]) : 1, text: y[3] };
2807
+ const b = /^([^:#]+)(?:#(\d+))?:(.+)$/.exec(O);
2808
+ if (!b) throw v("write it term:ID:TEXT, or term:ID#K:TEXT for the Kth");
2809
+ return { kind: P, id: b[1], occurrence: b[2] ? Number(b[2]) : 1, text: b[3] };
2810
2810
  }
2811
2811
  throw v();
2812
- }, b = (m) => {
2812
+ }, y = (m) => {
2813
2813
  const P = g(m);
2814
2814
  if (P.kind === "box") return me(0, 0, e.width, e.height);
2815
2815
  if (P.kind === "term") return u(P.id, P.text, P.occurrence, m).box;
2816
2816
  const O = h.get(P.id);
2817
2817
  if (!O || O.kind !== P.kind) {
2818
- const v = [...h.values()].filter((y) => y.kind === P.kind).map((y) => y.item.id);
2818
+ const v = [...h.values()].filter((b) => b.kind === P.kind).map((b) => b.item.id);
2819
2819
  throw tt("whiteboard", m, Be, `there is no ${P.kind} "${P.id}" (${P.kind}s: ${v.join(", ") || "none"})`);
2820
2820
  }
2821
2821
  return O.box;
@@ -2832,8 +2832,8 @@ function zf(e) {
2832
2832
  if (!vs.includes(m.mark)) throw new Error(`whiteboard: mark "${m.id}": ${ce("mark", m.mark, vs)}`);
2833
2833
  const P = m.mark === "arrow" ? ["from", "to"] : ["around"];
2834
2834
  for (const S of P) if (typeof m[S] != "string") throw new Error(`whiteboard: ${m.mark} "${m.id}" needs \`${S}\`, a place on the board (an item before it)`);
2835
- const O = new Set([m.from, m.to].filter((S) => typeof S == "string").map((S) => S.split(":")[1])), v = m.mark === "arrow" ? [...h.values()].filter((S) => S.kind === "text" && !O.has(S.item.id)).map((S) => S.box) : [], y = Yl(m, b, o, v);
2836
- h.set(m.id, { kind: "mark", item: m, color: a(m.color), points: y, box: Vl(y) }), c[`mark.${m.id}.draw`] = m.hidden ? 0 : 1, c[`mark.${m.id}.erase`] = 0;
2835
+ const O = new Set([m.from, m.to].filter((S) => typeof S == "string").map((S) => S.split(":")[1])), v = m.mark === "arrow" ? [...h.values()].filter((S) => S.kind === "text" && !O.has(S.item.id)).map((S) => S.box) : [], b = Yl(m, y, o, v);
2836
+ h.set(m.id, { kind: "mark", item: m, color: a(m.color), points: b, box: Vl(b) }), c[`mark.${m.id}.draw`] = m.hidden ? 0 : 1, c[`mark.${m.id}.erase`] = 0;
2837
2837
  }
2838
2838
  const $ = (m) => d.filter((P) => P.item === m), A = {
2839
2839
  type: "custom",
@@ -2851,46 +2851,46 @@ function zf(e) {
2851
2851
  actions: Be.edits
2852
2852
  },
2853
2853
  draw(m, P) {
2854
- const O = P.props ?? {}, v = (y) => Number(O[y] ?? c[y] ?? 0);
2854
+ const O = P.props ?? {}, v = (b) => Number(O[b] ?? c[b] ?? 0);
2855
2855
  if (m.save(), m.fillStyle = t.background, Ts(m, 0, 0, e.width, e.height, 10), m.fill(), m.lineWidth = Math.max(4, e.width * 0.012), m.strokeStyle = t.frame, m.stroke(), t.rule) {
2856
2856
  m.save(), m.beginPath(), Ts(m, 0, 0, e.width, e.height, 10), m.clip(), m.lineWidth = 1, m.strokeStyle = t.rule.color;
2857
- const y = o * (t.rule.spacing ?? 1.55);
2858
- for (let S = y; S < e.height; S += y)
2857
+ const b = o * (t.rule.spacing ?? 1.55);
2858
+ for (let S = b; S < e.height; S += b)
2859
2859
  m.beginPath(), m.moveTo(0, S), m.lineTo(e.width, S), m.stroke();
2860
2860
  t.rule.margin && (m.strokeStyle = t.rule.margin, m.beginPath(), m.moveTo(o * 2.2, 0), m.lineTo(o * 2.2, e.height), m.stroke()), m.restore();
2861
2861
  }
2862
2862
  m.textAlign = "center", m.textBaseline = "middle", m.lineCap = "round", m.lineJoin = "round", m.globalAlpha = t.opacity;
2863
- for (const y of h.values()) {
2864
- if (m.save(), Dn(m, y.box, v(`${y.kind}.${y.item.id}.erase`)), y.kind === "text") {
2865
- const S = $(y.item.id), w = v(`text.${y.item.id}.write`) * y.item.text.length;
2866
- m.font = `${y.size}px ${t.font}`, m.fillStyle = y.color;
2863
+ for (const b of h.values()) {
2864
+ if (m.save(), Dn(m, b.box, v(`${b.kind}.${b.item.id}.erase`)), b.kind === "text") {
2865
+ const S = $(b.item.id), w = v(`text.${b.item.id}.write`) * b.item.text.length;
2866
+ m.font = `${b.size}px ${t.font}`, m.fillStyle = b.color;
2867
2867
  for (let T = 0; T < Math.ceil(w); T++)
2868
- y.item.text[T] === " " || S.some((I) => T >= I.column && T < I.column + I.text.length) || (m.globalAlpha = t.opacity * Math.min(1, w - T), m.fillText(y.item.text[T], y.box.left + (T + 0.5) * y.size * r, y.box.y));
2868
+ b.item.text[T] === " " || S.some((I) => T >= I.column && T < I.column + I.text.length) || (m.globalAlpha = t.opacity * Math.min(1, w - T), m.fillText(b.item.text[T], b.box.left + (T + 0.5) * b.size * r, b.box.y));
2869
2869
  } else
2870
- Es(m, y.points, v(`mark.${y.item.id}.draw`), y.color, o * t.stroke, y.item.mark === "arrow");
2870
+ Es(m, b.points, v(`mark.${b.item.id}.draw`), b.color, o * t.stroke, b.item.mark === "arrow");
2871
2871
  m.restore();
2872
2872
  }
2873
- for (const y of f) {
2874
- const S = v(`strike.${y.id}.draw`);
2873
+ for (const b of f) {
2874
+ const S = v(`strike.${b.id}.draw`);
2875
2875
  if (S <= 0) continue;
2876
- const { box: w } = y, T = w.height * 0.15;
2876
+ const { box: w } = b, T = w.height * 0.15;
2877
2877
  Es(m, [{ x: w.left - 3, y: w.y + T }, { x: w.right + 3, y: w.y - T }], S, t.colors.red ?? t.ink, o * t.stroke * 0.8, !1);
2878
2878
  }
2879
- for (const y of d) {
2880
- const S = h.get(y.item), w = S.size * r;
2879
+ for (const b of d) {
2880
+ const S = h.get(b.item), w = S.size * r;
2881
2881
  m.font = `${S.size}px ${t.font}`, m.fillStyle = S.color;
2882
- const T = y.written;
2882
+ const T = b.written;
2883
2883
  if (T) {
2884
- const W = v(`piece.${y.id}.write`) * T.length, G = y.home.x - e.x - T.length * w / 2;
2884
+ const W = v(`piece.${b.id}.write`) * T.length, G = b.home.x - e.x - T.length * w / 2;
2885
2885
  for (let Y = 0; Y < Math.ceil(W); Y++)
2886
- T[Y] !== " " && (m.globalAlpha = t.opacity * Math.min(1, W - Y), m.fillText(T[Y], G + (Y + 0.5) * w, y.home.y - e.y));
2886
+ T[Y] !== " " && (m.globalAlpha = t.opacity * Math.min(1, W - Y), m.fillText(T[Y], G + (Y + 0.5) * w, b.home.y - e.y));
2887
2887
  }
2888
- const I = v(`piece.${y.id}.opacity`) * Math.min(1, v(`text.${y.item}.write`) * S.item.text.length - y.column);
2888
+ const I = v(`piece.${b.id}.opacity`) * Math.min(1, v(`text.${b.item}.write`) * S.item.text.length - b.column);
2889
2889
  if (I <= 0) continue;
2890
2890
  m.save();
2891
- const C = { x: y.home.x - e.x, y: y.home.y - e.y }, j = { x: v(`piece.${y.id}.x`), y: v(`piece.${y.id}.y`) };
2892
- Dn(m, me(C.x + j.x - y.home.width / 2, C.y + j.y - y.home.height / 2, y.home.width, y.home.height), v(`piece.${y.id}.erase`)), Math.hypot(j.x, j.y) < 1 && Dn(m, S.box, v(`text.${y.item}.erase`)), m.globalAlpha = t.opacity * Math.min(1, I), m.translate(C.x + j.x, C.y + j.y), m.rotate(v(`piece.${y.id}.rotate`) * Math.PI / 180);
2893
- for (let W = 0; W < y.text.length; W++) y.text[W] !== " " && m.fillText(y.text[W], (W + 0.5 - y.text.length / 2) * w, 0);
2891
+ const C = { x: b.home.x - e.x, y: b.home.y - e.y }, j = { x: v(`piece.${b.id}.x`), y: v(`piece.${b.id}.y`) };
2892
+ Dn(m, me(C.x + j.x - b.home.width / 2, C.y + j.y - b.home.height / 2, b.home.width, b.home.height), v(`piece.${b.id}.erase`)), Math.hypot(j.x, j.y) < 1 && Dn(m, S.box, v(`text.${b.item}.erase`)), m.globalAlpha = t.opacity * Math.min(1, I), m.translate(C.x + j.x, C.y + j.y), m.rotate(v(`piece.${b.id}.rotate`) * Math.PI / 180);
2893
+ for (let W = 0; W < b.text.length; W++) b.text[W] !== " " && m.fillText(b.text[W], (W + 0.5 - b.text.length / 2) * w, 0);
2894
2894
  m.restore();
2895
2895
  }
2896
2896
  m.restore();
@@ -2901,13 +2901,13 @@ function zf(e) {
2901
2901
  target: A,
2902
2902
  box: me(e.x, e.y, e.width, e.height),
2903
2903
  anchor(m) {
2904
- return s(b(m));
2904
+ return s(y(m));
2905
2905
  },
2906
2906
  piece(m) {
2907
2907
  const P = g(m);
2908
2908
  if (P.kind !== "term") throw new Error(`whiteboard.piece: a piece is a term, term:ID:TEXT, not "${m}"`);
2909
- const { column: O, box: v } = u(P.id, P.text, P.occurrence, m), y = d.find((w) => w.item === P.id && w.column === O && w.text === P.text);
2910
- if (y) return y;
2909
+ const { column: O, box: v } = u(P.id, P.text, P.occurrence, m), b = d.find((w) => w.item === P.id && w.column === O && w.text === P.text);
2910
+ if (b) return b;
2911
2911
  if (d.some((w) => w.item === P.id && O < w.column + w.text.length && w.column < O + P.text.length))
2912
2912
  throw new Error(`whiteboard: "${P.text}" in "${P.id}" overlaps another piece`);
2913
2913
  const S = { id: d.length + 1, item: P.id, column: O, text: P.text, home: s(v) };
@@ -2918,21 +2918,21 @@ function zf(e) {
2918
2918
  edit(m, P, O) {
2919
2919
  const v = Array.isArray(P) ? P : [P];
2920
2920
  if (v.length === 0) throw new Error(`whiteboard.edit: ${m} takes at least one anchor`);
2921
- const y = v.map((T) => ({ name: T, anchor: g(T) }));
2922
- for (const { name: T } of y) b(T);
2921
+ const b = v.map((T) => ({ name: T, anchor: g(T) }));
2922
+ for (const { name: T } of b) y(T);
2923
2923
  const S = (T, I = !1) => {
2924
- const C = y.find((j) => !T.includes(j.anchor.kind));
2924
+ const C = b.find((j) => !T.includes(j.anchor.kind));
2925
2925
  if (C) throw new Error(`whiteboard.edit: ${m} takes ${T.join(" or ")} anchors, not "${C.name}"`);
2926
- if (I && y.length > 1) throw new Error(`whiteboard.edit: ${m} takes one ${T.join(" or ")} anchor`);
2927
- }, w = () => k.piece(y[0].name);
2926
+ if (I && b.length > 1) throw new Error(`whiteboard.edit: ${m} takes one ${T.join(" or ")} anchor`);
2927
+ }, w = () => k.piece(b[0].name);
2928
2928
  if (m === "write") {
2929
- if (y.some((T) => T.anchor.kind === "term")) {
2929
+ if (b.some((T) => T.anchor.kind === "term")) {
2930
2930
  if (S(["term"], !0), typeof O.text != "string") throw new Error("whiteboard.edit: write into a term needs `text` (the new text)");
2931
2931
  const T = w();
2932
2932
  return T.written = O.text, i.tween(`piece.${T.id}.write`, 0, 1, { duration: Math.max(Ms, O.text.length * Ss), ...O }), k;
2933
2933
  }
2934
2934
  S(["text"]);
2935
- for (const { anchor: T } of y) {
2935
+ for (const { anchor: T } of b) {
2936
2936
  const I = T.id, C = h.get(I).item.text;
2937
2937
  i.tween(`text.${I}.write`, 0, 1, { duration: Math.max(Ms, C.length * Ss), ...O });
2938
2938
  }
@@ -2940,12 +2940,12 @@ function zf(e) {
2940
2940
  }
2941
2941
  if (m === "draw") {
2942
2942
  S(["mark"]);
2943
- for (const { anchor: T } of y) i.tween(`mark.${T.id}.draw`, 0, 1, { duration: 500, ...O });
2943
+ for (const { anchor: T } of b) i.tween(`mark.${T.id}.draw`, 0, 1, { duration: 500, ...O });
2944
2944
  return k;
2945
2945
  }
2946
2946
  if (m === "erase") {
2947
2947
  S(["text", "term", "mark"]);
2948
- for (const T of y) {
2948
+ for (const T of b) {
2949
2949
  const I = T.anchor.kind === "term" ? `piece.${k.piece(T.name).id}.erase` : `${T.anchor.kind}.${T.anchor.id}.erase`;
2950
2950
  i.tween(I, 0, 1, { duration: 400, ...O });
2951
2951
  }
@@ -2953,8 +2953,8 @@ function zf(e) {
2953
2953
  }
2954
2954
  if (m === "strike") {
2955
2955
  S(["text", "term"]);
2956
- for (const T of y) {
2957
- const I = { id: f.length + 1, box: b(T.name) };
2956
+ for (const T of b) {
2957
+ const I = { id: f.length + 1, box: y(T.name) };
2958
2958
  f.push(I), c[`strike.${I.id}.draw`] = 0, i.tween(`strike.${I.id}.draw`, 0, 1, { duration: 250, ...O });
2959
2959
  }
2960
2960
  return k;
@@ -2988,16 +2988,16 @@ function zf(e) {
2988
2988
  function Yl(e, n, t, o = []) {
2989
2989
  const r = Tt(Xe(e.id)), a = (g) => (r.next() * 2 - 1) * g, s = t * Gl;
2990
2990
  if (e.mark === "arrow") {
2991
- const g = n(e.from), b = n(e.to), $ = $s(g, b, s * 0.6), A = $s(b, g, s * 0.6), k = Math.hypot(A.x - $.x, A.y - $.y), m = Xl($, A);
2991
+ const g = n(e.from), y = n(e.to), $ = $s(g, y, s * 0.6), A = $s(y, g, s * 0.6), k = Math.hypot(A.x - $.x, A.y - $.y), m = Xl($, A);
2992
2992
  let P = k * (0.06 + a(0.04));
2993
2993
  if (e.bend !== void 0) P = k * e.bend;
2994
2994
  else {
2995
- const y = Ul($, A, m, o, s);
2996
- y !== 0 && (P = y);
2995
+ const b = Ul($, A, m, o, s);
2996
+ b !== 0 && (P = b);
2997
2997
  }
2998
2998
  const O = { x: ($.x + A.x) / 2 + m.x * P, y: ($.y + A.y) / 2 + m.y * P }, v = [];
2999
- for (let y = 0; y <= 24; y++) {
3000
- const S = y / 24;
2999
+ for (let b = 0; b <= 24; b++) {
3000
+ const S = b / 24;
3001
3001
  v.push({ x: (1 - S) ** 2 * $.x + 2 * (1 - S) * S * O.x + S * S * A.x, y: (1 - S) ** 2 * $.y + 2 * (1 - S) * S * O.y + S * S * A.y });
3002
3002
  }
3003
3003
  return v;
@@ -3012,12 +3012,12 @@ function Yl(e, n, t, o = []) {
3012
3012
  ];
3013
3013
  }
3014
3014
  if (e.mark === "box") {
3015
- const g = i.left - s, b = i.right + s, $ = i.top - s * 0.6, A = i.bottom + s * 0.6, k = (P, O) => ({ x: P + a(s * 0.2), y: O + a(s * 0.2) }), m = k(g, $);
3016
- return [m, k(b, $), k(b, A), k(g, A), m, { x: m.x + s * 0.8, y: m.y + a(2) }];
3015
+ const g = i.left - s, y = i.right + s, $ = i.top - s * 0.6, A = i.bottom + s * 0.6, k = (P, O) => ({ x: P + a(s * 0.2), y: O + a(s * 0.2) }), m = k(g, $);
3016
+ return [m, k(y, $), k(y, A), k(g, A), m, { x: m.x + s * 0.8, y: m.y + a(2) }];
3017
3017
  }
3018
3018
  const l = i.width / 2 + s, c = i.height / 2 + s * 0.6, h = -2.2 + a(0.3), d = r.next() * Math.PI * 2, f = 1.12, u = 64, p = [];
3019
3019
  for (let g = 0; g <= u * f; g++) {
3020
- const b = g / u, $ = h + b * Math.PI * 2, A = 1 + 0.035 * Math.sin(b * Math.PI * 4 + d) + 0.06 * b;
3020
+ const y = g / u, $ = h + y * Math.PI * 2, A = 1 + 0.035 * Math.sin(y * Math.PI * 4 + d) + 0.06 * y;
3021
3021
  p.push({ x: i.x + Math.cos($) * l * A, y: i.y + Math.sin($) * c * A });
3022
3022
  }
3023
3023
  return p;
@@ -3166,17 +3166,17 @@ function Wf(e) {
3166
3166
  }
3167
3167
  const f = o === "bar" ? "bar" : o === "line" ? "point" : "slice", u = Math.max(...e.data.flatMap((E) => s.map((K) => d(E, K)))), p = r ? e.data.reduce((E, K) => E + d(K, s[0]), 0) : e.max ?? sh(u * 1.1);
3168
3168
  if (!r && !(p > 0)) throw new Error(`chart: \`max\` must be above 0 (got ${p})`);
3169
- const g = Math.max(10, Math.min(16, e.height / 20)), b = a && e.legend !== !1, $ = r ? void 0 : e.axis?.x, A = r ? void 0 : e.axis?.y, k = e.title ? g * 2.3 : g * 0.5, m = {
3169
+ const g = Math.max(10, Math.min(16, e.height / 20)), y = a && e.legend !== !1, $ = r ? void 0 : e.axis?.x, A = r ? void 0 : e.axis?.y, k = e.title ? g * 2.3 : g * 0.5, m = {
3170
3170
  left: g * 3.6 + (A ? g * 1.5 : 0),
3171
3171
  right: e.width - g,
3172
- top: (e.title ? g * 3 : g * 1.6) + (b ? g * 1.6 : 0),
3172
+ top: (e.title ? g * 3 : g * 1.6) + (y ? g * 1.6 : 0),
3173
3173
  bottom: e.height - g * 2.4 - ($ ? g * 1.4 : 0)
3174
- }, P = m.bottom - m.top, O = (m.right - m.left) / e.data.length, v = a ? O * 0.72 / s.length : O * 0.6, y = a ? v * 0.86 : v, S = Math.max(4, g * 0.35), w = P / p, T = new Map(e.data.map((E, K) => [E.id, K])), I = (E) => m.left + O * (T.get(E) + 0.5), C = (E, K) => a ? I(E) - O * 0.36 + v * l.get(K) + (v - y) / 2 : I(E) - y / 2, j = (E, K) => C(E, K) + y / 2, W = e.height - g * 1.2, G = {
3174
+ }, P = m.bottom - m.top, O = (m.right - m.left) / e.data.length, v = a ? O * 0.72 / s.length : O * 0.6, b = a ? v * 0.86 : v, S = Math.max(4, g * 0.35), w = P / p, T = new Map(e.data.map((E, K) => [E.id, K])), I = (E) => m.left + O * (T.get(E) + 0.5), C = (E, K) => a ? I(E) - O * 0.36 + v * l.get(K) + (v - b) / 2 : I(E) - b / 2, j = (E, K) => C(E, K) + b / 2, W = e.height - g * 1.2, G = {
3175
3175
  cx: e.width / 2,
3176
3176
  cy: (m.top + W) / 2,
3177
3177
  r: Math.max(10, Math.min(e.width / 2, (W - m.top) / 2) - g * 2.6)
3178
3178
  }, Y = o === "donut" ? G.r * 0.55 : 0, ne = o === "donut" ? (Y + G.r) / 2 : G.r * 0.62, B = /* @__PURE__ */ new Map();
3179
- if (b) {
3179
+ if (y) {
3180
3180
  let E = m.right;
3181
3181
  for (const K of [...s].reverse()) {
3182
3182
  const U = K.label ?? K.id, te = g * 0.62 * U.length + g * 1.9;
@@ -3207,7 +3207,7 @@ function Wf(e) {
3207
3207
  return { kind: "box" };
3208
3208
  }
3209
3209
  if (K === "legend") {
3210
- if (!B.has(U)) throw te(b ? `there is no series "${U}" (series: ${s.map((q) => q.id).join(", ")})` : "only a chart with several series has a legend");
3210
+ if (!B.has(U)) throw te(y ? `there is no series "${U}" (series: ${s.map((q) => q.id).join(", ")})` : "only a chart with several series has a legend");
3211
3211
  return { kind: "legend", series: U };
3212
3212
  }
3213
3213
  if (K === "bar" || K === "point" || K === "slice" || K === "label" || K === "value") {
@@ -3230,7 +3230,7 @@ function Wf(e) {
3230
3230
  return E.kind === "label" ? J : L.sweep >= 0.3 ? me(L.centre.x - g * 1.6, L.centre.y - g * 0.65, g * 3.2, g * 1.3) : me(J.left, J.bottom, J.width, g * 1.3);
3231
3231
  }
3232
3232
  const U = E.kind === "label" ? I(E.id) : j(E.id, E.series), te = m.bottom - V(E.id, E.series, K);
3233
- if (E.kind === "bar") return me(U - y / 2, te, y, m.bottom - te);
3233
+ if (E.kind === "bar") return me(U - b / 2, te, b, m.bottom - te);
3234
3234
  if (E.kind === "point") return me(I(E.id) - S, te - S, S * 2, S * 2);
3235
3235
  if (E.kind === "label") return me(U - O / 2, m.bottom + g * 0.4, O, g * 1.4);
3236
3236
  const q = te - (o === "line" ? S : 0) - g * 0.3, le = a && o === "bar" ? v : O;
@@ -3253,7 +3253,7 @@ function Wf(e) {
3253
3253
  },
3254
3254
  draw(E, K) {
3255
3255
  const U = K.props ?? {}, te = (L) => Number(U[L] ?? R[L] ?? 0);
3256
- if (E.save(), E.fillStyle = t.background, Os(E, 0, 0, e.width, e.height, 8), E.fill(), E.font = `${g}px ${t.font}`, E.textBaseline = "middle", e.title && (E.fillStyle = t.text, E.textAlign = "left", E.font = `600 ${g * 1.2}px ${t.font}`, E.fillText(e.title, r ? g : m.left, g * 1.5), E.font = `${g}px ${t.font}`), b) {
3256
+ if (E.save(), E.fillStyle = t.background, Os(E, 0, 0, e.width, e.height, 8), E.fill(), E.font = `${g}px ${t.font}`, E.textBaseline = "middle", e.title && (E.fillStyle = t.text, E.textAlign = "left", E.font = `600 ${g * 1.2}px ${t.font}`, E.fillText(e.title, r ? g : m.left, g * 1.5), E.font = `${g}px ${t.font}`), y) {
3257
3257
  E.textAlign = "left";
3258
3258
  for (const L of s) {
3259
3259
  const z = B.get(L.id);
@@ -3290,7 +3290,7 @@ function Wf(e) {
3290
3290
  for (const L of e.data) {
3291
3291
  for (const z of s) {
3292
3292
  const J = o === "bar" ? j(L.id, z.id) : I(L.id), he = q(L.id, z.id), fe = te(M(L.id, z.id, "show"));
3293
- if (E.fillStyle = le(L.id, z.id), o === "bar" ? he > 0.5 && (rh(E, J - y / 2, m.bottom - he, y, he, Math.min(6, y / 4)), E.fill()) : fe > 0 && (E.beginPath(), E.arc(J, m.bottom - he, S * Math.min(1, fe * 1.5) * (1 + 0.3 * te(M(L.id, z.id, "highlight"))), 0, Math.PI * 2), E.fill()), e.values !== !1 && fe > 0) {
3293
+ if (E.fillStyle = le(L.id, z.id), o === "bar" ? he > 0.5 && (rh(E, J - b / 2, m.bottom - he, b, he, Math.min(6, b / 4)), E.fill()) : fe > 0 && (E.beginPath(), E.arc(J, m.bottom - he, S * Math.min(1, fe * 1.5) * (1 + 0.3 * te(M(L.id, z.id, "highlight"))), 0, Math.PI * 2), E.fill()), e.values !== !1 && fe > 0) {
3294
3294
  E.globalAlpha = Math.min(1, fe * 2), E.font = `600 ${a ? g * 0.85 : g}px ${t.font}`, E.fillStyle = Ln(t.text, t.highlight, te(M(L.id, z.id, "highlight")));
3295
3295
  const pe = m.bottom - he - (o === "line" ? S : 0) - g * 0.95;
3296
3296
  E.fillText(D(te(M(L.id, z.id, "value"))), J, pe), E.font = `${g}px ${t.font}`, E.globalAlpha = 1;
@@ -3798,24 +3798,24 @@ function Kf(e, n = 300, t = {}) {
3798
3798
  if (!o) throw new Error(`castMember: unknown cast member '${e}'`);
3799
3799
  return { ...o.options, height: Math.round(n * o.scale), ...t };
3800
3800
  }
3801
- const bn = {
3801
+ const yn = {
3802
3802
  handshake: { height: 0.47, spacing: 0.42, lean: 6 },
3803
3803
  highFive: { height: 0.9, spacing: 0.4, lean: 4 },
3804
3804
  fistBump: { height: 0.55, spacing: 0.44, lean: 6 },
3805
3805
  handOver: { height: 0.52, spacing: 0.46, lean: 8 }
3806
3806
  };
3807
3807
  function Ff(e, n, t) {
3808
- return bn[e].spacing * Math.min(n.height, t.height);
3808
+ return yn[e].spacing * Math.min(n.height, t.height);
3809
3809
  }
3810
3810
  const Is = 0.075;
3811
3811
  function Df(e, n, t, o = {}) {
3812
- const r = bn[e];
3813
- if (!r) throw new Error(`meetHands: unknown meeting '${e}' (one of ${Object.keys(bn).join(", ")})`);
3814
- const [a, s] = n.x <= t.x ? [n, t] : [t, n], i = o.view === "side", l = Math.min(a.character.height, s.character.height), c = { x: (a.x + s.x) / 2, y: -(o.height ?? r.height) * l }, h = (b, $) => {
3812
+ const r = yn[e];
3813
+ if (!r) throw new Error(`meetHands: unknown meeting '${e}' (one of ${Object.keys(yn).join(", ")})`);
3814
+ const [a, s] = n.x <= t.x ? [n, t] : [t, n], i = o.view === "side", l = Math.min(a.character.height, s.character.height), c = { x: (a.x + s.x) / 2, y: -(o.height ?? r.height) * l }, h = (y, $) => {
3815
3815
  const A = $ ? i ? 1 : 0.62 : i ? 3 : 3.38;
3816
- let k = { ...be, ...b.pose, turn: A, lean: (b.pose?.lean ?? 0) + r.lean };
3817
- const m = $ ? 1 : -1, P = (O, v, y) => {
3818
- k = Ue(b.character, k, O, { x: c.x + v - b.x, y: c.y, depth: y });
3816
+ let k = { ...ye, ...y.pose, turn: A, lean: (y.pose?.lean ?? 0) + r.lean };
3817
+ const m = $ ? 1 : -1, P = (O, v, b) => {
3818
+ k = Ue(y.character, k, O, { x: c.x + v - y.x, y: c.y, depth: b });
3819
3819
  };
3820
3820
  if (e === "handOver") {
3821
3821
  const O = Is * l;
@@ -3823,9 +3823,9 @@ function Df(e, n, t, o = {}) {
3823
3823
  } else
3824
3824
  P("arm.right", 0, 0);
3825
3825
  return e === "fistBump" && (k = { ...k, "hand.right.index.curl": 1, "hand.right.middle.curl": 1, "hand.right.ring.curl": 1, "hand.right.pinky.curl": 1 }), k;
3826
- }, d = h(a, !0), f = h(s, !1), u = 0.03 * l, p = (b, $) => {
3827
- const A = Ne(b.character, $), k = e === "handOver" ? ["hand.left", "hand.right"] : ["hand.right"], m = e === "handOver" ? Is * l + u : u;
3828
- return k.every((P) => Math.abs(A.points[P].y - c.y) < u && Math.abs(A.points[P].x + b.x - c.x) < m);
3826
+ }, d = h(a, !0), f = h(s, !1), u = 0.03 * l, p = (y, $) => {
3827
+ const A = Ne(y.character, $), k = e === "handOver" ? ["hand.left", "hand.right"] : ["hand.right"], m = e === "handOver" ? Is * l + u : u;
3828
+ return k.every((P) => Math.abs(A.points[P].y - c.y) < u && Math.abs(A.points[P].x + y.x - c.x) < m);
3829
3829
  }, g = p(a, d) && p(s, f);
3830
3830
  return n.x <= t.x ? { a: d, b: f, point: c, reached: g } : { a: f, b: d, point: c, reached: g };
3831
3831
  }
@@ -3834,16 +3834,16 @@ function Lf(e, n) {
3834
3834
  return go.spacing * Math.min(e.height, n.height);
3835
3835
  }
3836
3836
  function Bf(e, n, t = {}) {
3837
- const [o, r] = e.x <= n.x ? [e, n] : [n, e], a = t.view === "side", s = Math.min(o.character.height, r.character.height), i = (p, g, b) => ({
3838
- over: { x: g.x - b * 0.02 * s - p.x, y: -0.72 * s, depth: -0.08 * s },
3839
- round: { x: g.x - b * 0.04 * s - p.x, y: -0.5 * s, depth: 0.06 * s }
3840
- }), l = (p, g, b) => {
3841
- const $ = b ? a ? 1 : 0.62 : a ? 3 : 3.38, A = b ? 1 : -1;
3842
- let k = { ...be, ...p.pose, turn: $, lean: (p.pose?.lean ?? 0) + go.lean, "head.tilt": (p.pose?.["head.tilt"] ?? 0) + A * go.tilt };
3837
+ const [o, r] = e.x <= n.x ? [e, n] : [n, e], a = t.view === "side", s = Math.min(o.character.height, r.character.height), i = (p, g, y) => ({
3838
+ over: { x: g.x - y * 0.02 * s - p.x, y: -0.72 * s, depth: -0.08 * s },
3839
+ round: { x: g.x - y * 0.04 * s - p.x, y: -0.5 * s, depth: 0.06 * s }
3840
+ }), l = (p, g, y) => {
3841
+ const $ = y ? a ? 1 : 0.62 : a ? 3 : 3.38, A = y ? 1 : -1;
3842
+ let k = { ...ye, ...p.pose, turn: $, lean: (p.pose?.lean ?? 0) + go.lean, "head.tilt": (p.pose?.["head.tilt"] ?? 0) + A * go.tilt };
3843
3843
  const { over: m, round: P } = i(p, g, A);
3844
3844
  return k = Ue(p.character, k, "arm.right", m), k = Ue(p.character, k, "arm.left", P), k;
3845
- }, c = l(o, r, !0), h = l(r, o, !1), d = 0.05 * s, f = (p, g, b, $) => {
3846
- const A = Ne(p.character, $).points, { over: k, round: m } = i(p, g, b);
3845
+ }, c = l(o, r, !0), h = l(r, o, !1), d = 0.05 * s, f = (p, g, y, $) => {
3846
+ const A = Ne(p.character, $).points, { over: k, round: m } = i(p, g, y);
3847
3847
  return Math.hypot(A["hand.right"].x - k.x, A["hand.right"].y - k.y) < d && Math.hypot(A["hand.left"].x - m.x, A["hand.left"].y - m.y) < d;
3848
3848
  }, u = f(o, r, 1, c) && f(r, o, -1, h);
3849
3849
  return e.x <= n.x ? { a: c, b: h, reached: u } : { a: h, b: c, reached: u };
@@ -3853,19 +3853,19 @@ function qf(e, n) {
3853
3853
  return gt.spacing * Math.min(e.height, n.height);
3854
3854
  }
3855
3855
  function Gf(e, n, t, o = {}) {
3856
- const r = Math.max(0, Math.min(1, t)), a = o.view === "side", s = e.x <= n.x, i = Math.min(e.character.height, n.character.height), l = { x: (e.x + n.x) / 2, y: -(gt.low + (gt.high - gt.low) * r) * i }, c = (b) => b ? a ? 1 : 0.62 : a ? 3 : 3.38;
3857
- let h = { ...be, ...e.pose, turn: c(s), lean: (e.pose?.lean ?? 0) + gt.helperLean * (1 - r) + 4, bend: (e.pose?.bend ?? 0) + gt.helperBend * (1 - r), "head.nod": 18 * (1 - r) };
3856
+ const r = Math.max(0, Math.min(1, t)), a = o.view === "side", s = e.x <= n.x, i = Math.min(e.character.height, n.character.height), l = { x: (e.x + n.x) / 2, y: -(gt.low + (gt.high - gt.low) * r) * i }, c = (y) => y ? a ? 1 : 0.62 : a ? 3 : 3.38;
3857
+ let h = { ...ye, ...e.pose, turn: c(s), lean: (e.pose?.lean ?? 0) + gt.helperLean * (1 - r) + 4, bend: (e.pose?.bend ?? 0) + gt.helperBend * (1 - r), "head.nod": 18 * (1 - r) };
3858
3858
  h = Ue(e.character, h, "arm.right", { x: l.x - e.x, y: l.y });
3859
- const d = { ...Fe.sitFloor, ...n.pose, turn: c(!s) }, f = { ...be, ...n.pose, turn: c(!s) };
3860
- let u = ya(d, f, r);
3859
+ const d = { ...Fe.sitFloor, ...n.pose, turn: c(!s) }, f = { ...ye, ...n.pose, turn: c(!s) };
3860
+ let u = ba(d, f, r);
3861
3861
  u = Ue(n.character, u, "arm.right", { x: l.x - n.x, y: l.y });
3862
- const p = 0.04 * i, g = (b, $) => {
3863
- const A = Ne(b.character, $).points["hand.right"];
3864
- return Math.hypot(A.x + b.x - l.x, A.y - l.y) < p;
3862
+ const p = 0.04 * i, g = (y, $) => {
3863
+ const A = Ne(y.character, $).points["hand.right"];
3864
+ return Math.hypot(A.x + y.x - l.x, A.y - l.y) < p;
3865
3865
  };
3866
3866
  return { helper: h, sitter: u, point: l, reached: g(e, h) && g(n, u) };
3867
3867
  }
3868
- const dh = 0.7, fh = 50, uh = 1.2, gh = 0.8, ph = 3, mh = 30, bh = 0.8, yh = 0.6, Bn = (e, n) => Math.max(-n, Math.min(n, e)), wh = ["hair.swing", "hair.trail", "hair.lift"];
3868
+ const dh = 0.7, fh = 50, uh = 1.2, gh = 0.8, ph = 3, mh = 30, yh = 0.8, bh = 0.6, Bn = (e, n) => Math.max(-n, Math.min(n, e)), wh = ["hair.swing", "hair.trail", "hair.lift"];
3869
3869
  function kh(e, n) {
3870
3870
  const t = n.start ?? 0, o = n.amount ?? 1, r = Math.max(1e-6, n.headRadius);
3871
3871
  let a = NaN, s = { x: 0, y: 0, turn: 0 };
@@ -3874,7 +3874,7 @@ function kh(e, n) {
3874
3874
  return p.turn * 90 + (p.headTurn ?? 0);
3875
3875
  }, c = { start: t, end: n.end, step: n.step, stiffness: n.stiffness ?? 70, damping: n.damping ?? 6 }, h = on(l, c), d = on((u) => i(u).x, c), f = on((u) => i(u).y, c);
3876
3876
  return h.map((u, p) => {
3877
- const g = i(u.time), b = u.value - l(u.time), $ = d[p].value - g.x - (n.wind ?? 0) * dh * r, A = f[p].value - g.y, k = Math.sin(g.turn * Math.PI / 2), m = Math.cos(g.turn * Math.PI / 2), P = b * ph + $ * m / r * mh, O = -$ * k / r * bh, v = -A / r * yh;
3877
+ const g = i(u.time), y = u.value - l(u.time), $ = d[p].value - g.x - (n.wind ?? 0) * dh * r, A = f[p].value - g.y, k = Math.sin(g.turn * Math.PI / 2), m = Math.cos(g.turn * Math.PI / 2), P = y * ph + $ * m / r * mh, O = -$ * k / r * yh, v = -A / r * bh;
3878
3878
  return {
3879
3879
  time: u.time,
3880
3880
  swing: Bn(P * o, fh),
@@ -3903,7 +3903,7 @@ const Hs = (e) => ({ "hair.swing": e.swing, "hair.trail": e.trail, "hair.lift":
3903
3903
  function Uf(e, n, t, o = {}) {
3904
3904
  const r = t.head.hair;
3905
3905
  if (!r || !zr(r)) return [];
3906
- const a = n.filter((A) => A.target === e), s = a.reduce((A, k) => k.keyframes.reduce((m, P) => Math.max(m, P.time), A), 0), i = be, l = /* @__PURE__ */ new Set(["x", "y", "turn", "head.turn"]), c = new ve({ id: `${e}-hair-follow`, tracks: a.filter((A) => l.has(A.property)) }), h = (A, k, m) => {
3906
+ const a = n.filter((A) => A.target === e), s = a.reduce((A, k) => k.keyframes.reduce((m, P) => Math.max(m, P.time), A), 0), i = ye, l = /* @__PURE__ */ new Set(["x", "y", "turn", "head.turn"]), c = new ve({ id: `${e}-hair-follow`, tracks: a.filter((A) => l.has(A.property)) }), h = (A, k, m) => {
3907
3907
  const P = c.getStateAtTime(A).values.get(e)?.get(k);
3908
3908
  return typeof P == "number" ? P : m;
3909
3909
  }, d = new ve({ id: `${e}-hair-pose`, tracks: a }), f = (A) => d.getStateAtTime(A).values.get(e), u = /* @__PURE__ */ new Map(), p = (A) => {
@@ -3911,7 +3911,7 @@ function Uf(e, n, t, o = {}) {
3911
3911
  let m = u.get(k);
3912
3912
  if (!m) {
3913
3913
  const P = {};
3914
- for (const [v, y] of f(k * dt) ?? []) P[v] = y;
3914
+ for (const [v, b] of f(k * dt) ?? []) P[v] = b;
3915
3915
  const O = Ne(t, Wr(P, i, o.gaits)).head.center;
3916
3916
  u.set(k, m = { x: O.x, y: O.y });
3917
3917
  }
@@ -3919,7 +3919,7 @@ function Uf(e, n, t, o = {}) {
3919
3919
  }, g = (A) => {
3920
3920
  const k = Math.floor(A / dt), m = A / dt - k, P = p(k * dt), O = p((k + 1) * dt);
3921
3921
  return { x: P.x + (O.x - P.x) * m, y: P.y + (O.y - P.y) * m };
3922
- }, b = kh(
3922
+ }, y = kh(
3923
3923
  (A) => {
3924
3924
  const k = g(A);
3925
3925
  return {
@@ -3932,7 +3932,7 @@ function Uf(e, n, t, o = {}) {
3932
3932
  {
3933
3933
  start: 0,
3934
3934
  end: s + (o.settle ?? vh),
3935
- headRadius: Ne(t, be).head.rx,
3935
+ headRadius: Ne(t, ye).head.rx,
3936
3936
  step: o.step,
3937
3937
  stiffness: o.stiffness,
3938
3938
  damping: o.damping,
@@ -3942,18 +3942,18 @@ function Uf(e, n, t, o = {}) {
3942
3942
  ), $ = [];
3943
3943
  for (const A of wh) {
3944
3944
  const k = A.slice(5);
3945
- let m = b.map((O) => ({ time: O.time, value: O[k] }));
3945
+ let m = y.map((O) => ({ time: O.time, value: O[k] }));
3946
3946
  if (m.every((O) => Math.abs(O.value) < 1e-3)) continue;
3947
3947
  const P = a.find((O) => O.property === A);
3948
3948
  if (P) {
3949
- const O = new ve({ id: `${e}-${A}-own`, tracks: [P] }), v = (y) => Number(O.getStateAtTime(y).values.get(e)?.get(A) ?? 0);
3950
- m = m.map((y) => ({ time: y.time, value: y.value + v(y.time) }));
3949
+ const O = new ve({ id: `${e}-${A}-own`, tracks: [P] }), v = (b) => Number(O.getStateAtTime(b).values.get(e)?.get(A) ?? 0);
3950
+ m = m.map((b) => ({ time: b.time, value: b.value + v(b.time) }));
3951
3951
  }
3952
3952
  $.push({ id: `${e}-${A}`, target: e, property: A, keyframes: m });
3953
3953
  }
3954
3954
  return $;
3955
3955
  }
3956
- const yt = {
3956
+ const bt = {
3957
3957
  full: {
3958
3958
  anticipation: 0.12,
3959
3959
  anticipationTime: 0.3,
@@ -4016,10 +4016,10 @@ const yt = {
4016
4016
  }
4017
4017
  };
4018
4018
  function er(e) {
4019
- if (e === void 0) return yt.full;
4020
- if (typeof e == "string") return yt[e];
4019
+ if (e === void 0) return bt.full;
4020
+ if (typeof e == "string") return bt[e];
4021
4021
  const { base: n, ...t } = e;
4022
- return { ...yt[n ?? "full"], ...t };
4022
+ return { ...bt[n ?? "full"], ...t };
4023
4023
  }
4024
4024
  const po = 160, Sh = 120, Mh = 700, qn = 60, $h = 90, Zt = 3200, wt = 1, nt = 1e-6;
4025
4025
  function Fo(e, n, t = {}) {
@@ -4044,28 +4044,28 @@ function Eh(e, n, t, o, r) {
4044
4044
  const p = (n[u].time - n[u - 1].time) / 2;
4045
4045
  return Math.max(-p, Math.min(p, l));
4046
4046
  }, h = [{ time: n[0].time, value: n[0].pose[e] }], d = (u, p, g) => {
4047
- const b = h[h.length - 1];
4048
- if (u <= b.time + wt) {
4049
- h[h.length - 1] = { ...b, value: p, ...g ? { easing: g } : {} };
4047
+ const y = h[h.length - 1];
4048
+ if (u <= y.time + wt) {
4049
+ h[h.length - 1] = { ...y, value: p, ...g ? { easing: g } : {} };
4050
4050
  return;
4051
4051
  }
4052
4052
  h.push({ time: u, value: p, ...g ? { easing: g } : {} });
4053
4053
  };
4054
4054
  let f = n[0].pose[e];
4055
4055
  for (let u = 1; u < n.length; u++) {
4056
- const p = n[u], g = n[u - 1].pose[e], b = p.pose[e], $ = b - g, A = h[h.length - 1].time, k = p.act !== !1;
4056
+ const p = n[u], g = n[u - 1].pose[e], y = p.pose[e], $ = y - g, A = h[h.length - 1].time, k = p.act !== !1;
4057
4057
  if (Math.abs($) <= nt) {
4058
4058
  const T = p.time + (k ? c(u) : 0);
4059
4059
  if (u === n.length - 1)
4060
- Math.abs(f - b) > nt && d(Math.max(T, A + po), b, "ease-in-out"), f = b;
4060
+ Math.abs(f - y) > nt && d(Math.max(T, A + po), y, "ease-in-out"), f = y;
4061
4061
  else if (k && i && o.drift > 0 && t.drift.includes(e) && T - A >= Mh) {
4062
4062
  const I = Xe(`${r}:${e}:${u}`) % 2 === 0 ? 1 : -1;
4063
- f = b + I * o.drift * s, d(T, f, "ease-in-out");
4063
+ f = y + I * o.drift * s, d(T, f, "ease-in-out");
4064
4064
  }
4065
4065
  continue;
4066
4066
  }
4067
4067
  if (!k) {
4068
- d(n[u - 1].time, f), d(p.time, b, p.easing), f = b;
4068
+ d(n[u - 1].time, f), d(p.time, y, p.easing), f = y;
4069
4069
  continue;
4070
4070
  }
4071
4071
  const m = c(u), P = Math.max(n[u - 1].time + m, A);
@@ -4073,22 +4073,22 @@ function Eh(e, n, t, o, r) {
4073
4073
  a && o.eyeDart > 0 && (O = Math.min(O, P + o.eyeDart));
4074
4074
  const v = O - P;
4075
4075
  if (v <= wt) {
4076
- d(p.time, b, p.easing), f = b;
4076
+ d(p.time, y, p.easing), f = y;
4077
4077
  continue;
4078
4078
  }
4079
4079
  d(P, f);
4080
- const y = Math.sign($);
4080
+ const b = Math.sign($);
4081
4081
  if (i && o.anticipation > 0 && s > 0 && v >= po) {
4082
- const T = f - y * Math.min(Math.abs($) * o.anticipation, s), I = P + v * o.anticipationTime;
4082
+ const T = f - b * Math.min(Math.abs($) * o.anticipation, s), I = P + v * o.anticipationTime;
4083
4083
  d(I, T, "ease-in-out"), o.hold > 0 && d(I + v * o.hold, T);
4084
4084
  }
4085
4085
  const S = u + 1 < n.length ? n[u + 1].time - p.time : 1 / 0, w = Math.min(o.settle, S / 2);
4086
4086
  if (i && o.overshoot > 0 && s > 0 && v >= Sh && w > wt) {
4087
4087
  const T = Math.min(Math.abs($) * o.overshoot, s);
4088
- d(O, b + y * T, p.easing ?? o.actionEase), d(O + w, b, o.settleEase);
4088
+ d(O, y + b * T, p.easing ?? o.actionEase), d(O + w, y, o.settleEase);
4089
4089
  } else
4090
- d(O, b, p.easing ?? o.actionEase);
4091
- f = b;
4090
+ d(O, y, p.easing ?? o.actionEase);
4091
+ f = y;
4092
4092
  }
4093
4093
  return h;
4094
4094
  }
@@ -4202,7 +4202,7 @@ function Oh(e) {
4202
4202
  }
4203
4203
  function Ih() {
4204
4204
  const e = {}, n = {};
4205
- for (const t of Object.keys(be)) {
4205
+ for (const t of Object.keys(ye)) {
4206
4206
  const o = Oh(t);
4207
4207
  e[t] = o.depth, o.limit !== void 0 && (n[t] = o.limit);
4208
4208
  }
@@ -4226,7 +4226,7 @@ function jh(e, n, t = {}) {
4226
4226
  return tr(e, Fo(r, t.rig ?? Ph, t));
4227
4227
  }
4228
4228
  function Ch(e, n, t = {}) {
4229
- const o = t.rest ?? be, r = Kr(n, o), a = n.map((s, i) => ({ time: s.time, pose: { ...o, ...r[i] }, easing: s.easing, act: s.act }));
4229
+ const o = t.rest ?? ye, r = Kr(n, o), a = n.map((s, i) => ({ time: s.time, pose: { ...o, ...r[i] }, easing: s.easing, act: s.act }));
4230
4230
  return tr(e, Fo(a, t.rig ?? Hh, t));
4231
4231
  }
4232
4232
  const js = Ae.shocked, _h = Ae.scared, ot = {
@@ -4285,7 +4285,7 @@ function nr(e, n) {
4285
4285
  ...e.map((r) => (o = { ...o, ...r.pose }, { time: n.at + r.after * t, pose: o, act: !1, ...r.easing ? { easing: r.easing } : {} }))
4286
4286
  ];
4287
4287
  }
4288
- function yn(e, n = 1) {
4288
+ function bn(e, n = 1) {
4289
4289
  const t = ot[e](de);
4290
4290
  return t[t.length - 1].after * n;
4291
4291
  }
@@ -4296,8 +4296,8 @@ function xh(e, n, t = {}) {
4296
4296
  for (let i = 0; i < o; i++) {
4297
4297
  const l = (i - (o - 1) / 2) * r, c = Math.floor(Math.abs(l) / Math.max(r, 1) * (n.length / 6));
4298
4298
  for (let h = c + 1; h < n.length; h++) {
4299
- const d = n[h - 1], f = n[h], u = f.x - d.x, p = f.y - d.y, g = Math.hypot(u, p) || 1, b = -p / g, $ = u / g, A = 1 - h / (n.length - 1);
4300
- e.globalAlpha = s * (1 - A), e.lineWidth = a * (1 - A * 0.7), e.beginPath(), e.moveTo(d.x + b * l, d.y + $ * l), e.lineTo(f.x + b * l, f.y + $ * l), e.stroke();
4299
+ const d = n[h - 1], f = n[h], u = f.x - d.x, p = f.y - d.y, g = Math.hypot(u, p) || 1, y = -p / g, $ = u / g, A = 1 - h / (n.length - 1);
4300
+ e.globalAlpha = s * (1 - A), e.lineWidth = a * (1 - A * 0.7), e.beginPath(), e.moveTo(d.x + y * l, d.y + $ * l), e.lineTo(f.x + y * l, f.y + $ * l), e.stroke();
4301
4301
  }
4302
4302
  }
4303
4303
  e.restore();
@@ -4332,9 +4332,9 @@ function Xf(e, n, t, o, r = {}) {
4332
4332
  const p = c.map(u.at);
4333
4333
  let g = 0;
4334
4334
  for (let A = 1; A < p.length; A++) g += Math.hypot(p[A].x - p[A - 1].x, p[A].y - p[A - 1].y);
4335
- const b = g / ((t.time - l) / 1e3);
4336
- if (b <= d) continue;
4337
- const $ = Math.min(1, (b - d) / (d * 0.5));
4335
+ const y = g / ((t.time - l) / 1e3);
4336
+ if (y <= d) continue;
4337
+ const $ = Math.min(1, (y - d) / (d * 0.5));
4338
4338
  xh(e, p, { ...r, opacity: (r.opacity ?? 0.7) * $, spacing: r.spacing ?? h * 0.02 });
4339
4339
  }
4340
4340
  }
@@ -4469,16 +4469,16 @@ function wn(e, n = {}) {
4469
4469
  if (!f.pose || typeof f.pose != "object" || Array.isArray(f.pose))
4470
4470
  h("`pose` is joints to change, an object like { rightShoulder: 90 } (for a named pose, use it as the action).");
4471
4471
  else
4472
- for (const [g, b] of Object.entries(f.pose))
4473
- s.includes(g) ? Je(b) || h(`Pose joint \`${g}\` must be a number (got ${JSON.stringify(b)}).`) : h(ce("pose joint", g, s));
4472
+ for (const [g, y] of Object.entries(f.pose))
4473
+ s.includes(g) ? Je(y) || h(`Pose joint \`${g}\` must be a number (got ${JSON.stringify(y)}).`) : h(ce("pose joint", g, s));
4474
4474
  for (const g of ["at", "for"]) {
4475
- const b = f[g];
4476
- b !== void 0 && !(Je(b) && b >= 0) && h(`\`${g}\` is milliseconds, a number ≥ 0 (got ${JSON.stringify(b)}).`);
4475
+ const y = f[g];
4476
+ y !== void 0 && !(Je(y) && y >= 0) && h(`\`${g}\` is milliseconds, a number ≥ 0 (got ${JSON.stringify(y)}).`);
4477
4477
  }
4478
4478
  Je(f.at) && (f.at < i && d(`\`at\` ${f.at} is before an earlier beat's \`at\` (${i}); beats run in order, so it starts when the one before ends.`), i = f.at);
4479
4479
  for (const g of ["to", "onto"]) {
4480
- const b = f[g];
4481
- b !== void 0 && !Je(b) && h(`\`${g}\` is a scene ${g === "to" ? "x" : "y"} in px, a number (got ${JSON.stringify(b)}).`);
4480
+ const y = f[g];
4481
+ y !== void 0 && !Je(y) && h(`\`${g}\` is a scene ${g === "to" ? "x" : "y"} in px, a number (got ${JSON.stringify(y)}).`);
4482
4482
  }
4483
4483
  if (f.toward !== void 0 && !Je(f.toward) && !Qt.includes(f.toward) && h(`\`toward\` is a scene x or one of ${Qt.join(", ")}${typeof f.toward == "string" && ro(f.toward, Qt) ? ` (did you mean "${ro(f.toward, Qt)}"?)` : ""} (got ${JSON.stringify(f.toward)}).`), f.say !== void 0 && typeof f.say != "string" && h(`\`say\` is the line spoken, a string (got ${JSON.stringify(f.say)}).`), f.target !== void 0) {
4484
4484
  const g = f.target;
@@ -4543,10 +4543,10 @@ function Lo(e, n, t = {}) {
4543
4543
  const _ = t.actions?.[M];
4544
4544
  return _ && "steps" in _ ? _ : void 0;
4545
4545
  }, c = t.from ?? 0, h = t.ground ?? 0, d = t.height ?? 300;
4546
- let f = c, u = h, p = t.facing ?? 1, g = t.start ?? de, b = 0, $ = 0;
4547
- const A = [{ time: 0, pose: g }], k = [{ time: 0, value: 0 }], m = [{ time: 0, value: 0 }], P = [{ time: 0, value: 0 }], O = [{ time: 0, value: 0 }], v = [{ time: 0, value: "walk" }], y = [{ time: 0, value: p }], S = [], w = [], T = [], I = (M, _, V, ee) => {
4546
+ let f = c, u = h, p = t.facing ?? 1, g = t.start ?? de, y = 0, $ = 0;
4547
+ const A = [{ time: 0, pose: g }], k = [{ time: 0, value: 0 }], m = [{ time: 0, value: 0 }], P = [{ time: 0, value: 0 }], O = [{ time: 0, value: 0 }], v = [{ time: 0, value: "walk" }], b = [{ time: 0, value: p }], S = [], w = [], T = [], I = (M, _, V, ee) => {
4548
4548
  g = { ...g, ..._ }, V && (g = pt(g, V)), A.push({ time: M, pose: g, ...ee === !1 ? { act: ee } : {} });
4549
- }, C = (M, _, V) => (I(M + ft / 2, { turn: 0 }, V), y.push({ time: M + ft / 2, value: p }, { time: M + ft / 2 + 1, value: _ }), p = _, I(M + ft, { turn: 1 }), M + ft), j = (M) => M < f ? -1 : 1, W = (M, _, V) => j(_) !== p ? C(M, j(_), V) : M, G = (M, _, V, ee = "arm") => {
4549
+ }, C = (M, _, V) => (I(M + ft / 2, { turn: 0 }, V), b.push({ time: M + ft / 2, value: p }, { time: M + ft / 2 + 1, value: _ }), p = _, I(M + ft, { turn: 1 }), M + ft), j = (M) => M < f ? -1 : 1, W = (M, _, V) => j(_) !== p ? C(M, j(_), V) : M, G = (M, _, V, ee = "arm") => {
4550
4550
  const F = ee === "arm", Q = Ke({ ...M, ...F ? { rightShoulder: 0, rightElbow: 0 } : { rightHip: 0, rightKnee: 0 } }, { height: d, facing: p }), ae = F ? Q.shoulders.right : Q.hip, x = F ? Q.elbows.right : Q.knees.right, X = (se, re) => Math.atan2(p * se, re) * 180 / Math.PI, Z = ((X(_ - (f + ae.x), V - (u + ae.y)) - X(x.x - ae.x, x.y - ae.y)) % 360 + 360) % 360;
4551
4551
  return Z > 270 ? Z - 360 : Z;
4552
4552
  }, Y = (M, _, V, ee) => {
@@ -4574,15 +4574,15 @@ function Lo(e, n, t = {}) {
4574
4574
  let D = _;
4575
4575
  X !== p ? D = C(_, X, M.mood) : g.turn < 1 ? (D = _ + ze, I(D, { turn: 1, ...Q }, M.mood)) : (M.mood || M.pose) && I(_ + ze, Q, M.mood);
4576
4576
  const se = Math.abs(x - f) / ao(s(M.do), d), re = M.for ?? Math.max(ze * 2, se * i(M.do)), ie = D + re;
4577
- v.push({ time: D, value: M.do }), O.push({ time: D, value: 0 }, { time: D + ze, value: 1, easing: "ease-out" }), O.push({ time: ie - ze, value: 1 }, { time: ie, value: 0, easing: "ease-in" }), P.push({ time: D, value: b }, { time: ie, value: b + se }), k.push({ time: D, value: f - c }, { time: ie, value: x - c }), b += se, f = x, I(ie, {}), V = ie;
4577
+ v.push({ time: D, value: M.do }), O.push({ time: D, value: 0 }, { time: D + ze, value: 1, easing: "ease-out" }), O.push({ time: ie - ze, value: 1 }, { time: ie, value: 0, easing: "ease-in" }), P.push({ time: D, value: y }, { time: ie, value: y + se }), k.push({ time: D, value: f - c }, { time: ie, value: x - c }), y += se, f = x, I(ie, {}), V = ie;
4578
4578
  } else if (M.do === "zip") {
4579
4579
  const x = M.to ?? f, X = x === f ? p : j(x);
4580
4580
  let D = _;
4581
4581
  X !== p ? D = C(_, X, M.mood) : g.turn < 1 && (D = _ + ze, I(D, { turn: 1 }, M.mood));
4582
4582
  const Z = Cs("windUp", { at: D, from: M.mood ? pt(g, M.mood) : g });
4583
4583
  A.push(...Z), g = Z[Z.length - 1].pose;
4584
- const se = D + yn("windUp"), re = se + Fh, ie = re + Math.max(Lh, Math.abs(x - f) / Dh);
4585
- v.push({ time: se, value: "run" }), O.push({ time: se, value: 0 }, { time: se + 80, value: 1, easing: "ease-out" }, { time: ie, value: 1 }, { time: ie + 120, value: 0 }), P.push({ time: se, value: b }, { time: re, value: b + Rs, easing: "ease-in" }), b += Rs + (ie - re) / Ns.run * 1.5, P.push({ time: ie, value: b }), k.push({ time: re, value: f - c }, { time: ie, value: x - c, easing: "ease-in" }), T.push({ kind: "dust", time: re, x: f, y: u, length: 900 }), f = x, I(ie, {}), V = ie;
4584
+ const se = D + bn("windUp"), re = se + Fh, ie = re + Math.max(Lh, Math.abs(x - f) / Dh);
4585
+ v.push({ time: se, value: "run" }), O.push({ time: se, value: 0 }, { time: se + 80, value: 1, easing: "ease-out" }, { time: ie, value: 1 }, { time: ie + 120, value: 0 }), P.push({ time: se, value: y }, { time: re, value: y + Rs, easing: "ease-in" }), y += Rs + (ie - re) / Ns.run * 1.5, P.push({ time: ie, value: y }), k.push({ time: re, value: f - c }, { time: ie, value: x - c, easing: "ease-in" }), T.push({ kind: "dust", time: re, x: f, y: u, length: 900 }), f = x, I(ie, {}), V = ie;
4586
4586
  } else if (M.do === "leap") {
4587
4587
  const x = M.to ?? f, X = M.onto ?? u;
4588
4588
  let D = x === f ? _ : W(_, x, M.mood);
@@ -4665,13 +4665,13 @@ function Lo(e, n, t = {}) {
4665
4665
  const x = M.target, X = M.to ?? x.x, D = W(_, f + (X >= x.x ? 1 : -1), M.mood), Z = p === 1 ? x.left ?? x.x : x.right ?? x.x, se = { ...g, turn: 1, lean: 16, bend: 8, rightWrist: 0, leftWrist: 0, lookX: 1, ...Q }, re = Y(se, Z, x.y, "arm"), ie = H(D, re + p * d * 0.06, jt), E = B(se, Z, x.y), K = { ...se, ...E, leftShoulder: -E.rightShoulder, leftElbow: -E.rightElbow }, U = ie + oc;
4666
4666
  I(U, K, M.mood, !1);
4667
4667
  const te = Math.abs(X - x.x), q = U + (M.for ?? Math.max(600, te / sc)), le = te / ao("shove", d);
4668
- v.push({ time: U, value: "shove" }), O.push({ time: U, value: 0 }, { time: U + ze, value: 1, easing: "ease-out" }, { time: q - ze, value: 1 }, { time: q, value: 0, easing: "ease-in" }), P.push({ time: U, value: b }, { time: q, value: b + le }), b += le, k.push({ time: U, value: f - c }, { time: q, value: f + (X - x.x) - c }), f += X - x.x, I(q, {}, void 0, !1), I(q + Xs, { lean: 0, bend: 0, rightShoulder: de.rightShoulder, leftShoulder: de.leftShoulder, rightElbow: de.rightElbow, leftElbow: de.leftElbow }), V = q + Xs, ee = U, F = q;
4668
+ v.push({ time: U, value: "shove" }), O.push({ time: U, value: 0 }, { time: U + ze, value: 1, easing: "ease-out" }, { time: q - ze, value: 1 }, { time: q, value: 0, easing: "ease-in" }), P.push({ time: U, value: y }, { time: q, value: y + le }), y += le, k.push({ time: U, value: f - c }, { time: q, value: f + (X - x.x) - c }), f += X - x.x, I(q, {}, void 0, !1), I(q + Xs, { lean: 0, bend: 0, rightShoulder: de.rightShoulder, leftShoulder: de.leftShoulder, rightElbow: de.rightElbow, leftElbow: de.leftElbow }), V = q + Xs, ee = U, F = q;
4669
4669
  } else if (ae) {
4670
4670
  const x = M.mood ? pt(g, M.mood) : g, X = ae.steps(x, M), D = nr(X, { at: _, from: x });
4671
4671
  A.push(...D), g = D[D.length - 1].pose, V = _ + Math.max(Kh(X), M.for ?? 0);
4672
4672
  } else if (Vs(M.do)) {
4673
4673
  const x = Cs(M.do, { at: _, from: M.mood ? pt(g, M.mood) : g });
4674
- A.push(...x), g = x[x.length - 1].pose, V = _ + yn(M.do), M.do === "take" && T.push({ kind: "dust", time: _ + 900, x: f, y: u, length: 500 }), M.do === "land" && T.push({ kind: "dust", time: _ + 120, x: f, y: u, length: 500 });
4674
+ A.push(...x), g = x[x.length - 1].pose, V = _ + bn(M.do), M.do === "take" && T.push({ kind: "dust", time: _ + 900, x: f, y: u, length: 500 }), M.do === "land" && T.push({ kind: "dust", time: _ + 120, x: f, y: u, length: 500 });
4675
4675
  } else if (M.do === "look" || M.do === "face") {
4676
4676
  const x = M.toward ?? "viewer", X = M.for ?? ac;
4677
4677
  if (x === "viewer") I(_ + Re, { turn: 0, lookX: 0, lookY: 0, ...Q }, M.mood);
@@ -4701,7 +4701,7 @@ function Lo(e, n, t = {}) {
4701
4701
  { id: `${e}-walk`, target: e, property: "walk", keyframes: P },
4702
4702
  { id: `${e}-walking`, target: e, property: "walking", keyframes: O },
4703
4703
  { id: `${e}-gait`, target: e, property: "gait", keyframes: v },
4704
- { id: `${e}-facing`, target: e, property: "facing", keyframes: y }
4704
+ { id: `${e}-facing`, target: e, property: "facing", keyframes: b }
4705
4705
  ].filter(
4706
4706
  (M) => M.keyframes.length > 1 || M.property === "x" || // Starting left is kept even if it never turns: a figure target faces right unless told.
4707
4707
  M.property === "facing" && M.keyframes[0].value === -1
@@ -4742,22 +4742,22 @@ function rr(e, n, t) {
4742
4742
  }
4743
4743
  const zt = ["start", "contact", "release", "end"], gc = ["surface", "edit", "anchor", "at", "until"], pc = ["carry"], an = (e) => !!e && typeof e == "object" && !Array.isArray(e) && "surface" in e && "anchor" in e, mc = (e) => e.then === void 0 ? [] : Array.isArray(e.then) ? e.then : [e.then];
4744
4744
  function Qf(e, n, t, o = {}) {
4745
- const r = bc(t, n, o).filter((f) => f.level === "error");
4745
+ const r = yc(t, n, o).filter((f) => f.level === "error");
4746
4746
  if (r.length > 0)
4747
4747
  throw new Error(`surfaceScript: ${r.length} problem(s) in the beats:
4748
4748
  ${r.map((f) => ` ${f.beat >= 0 ? `beat ${f.beat}: ` : ""}${f.message}`).join(`
4749
4749
  `)}`);
4750
- const a = t.map((f) => ir(f, n)), s = Lo(e, a, o), i = yc(a, s.beats, o), l = o.ground ?? 0, c = (f) => o.ride === !1 ? f : Object.values(n).reduce((u, p) => p.ride(u, e, { ground: l }), f);
4750
+ const a = t.map((f) => ir(f, n)), s = Lo(e, a, o), i = bc(a, s.beats, o), l = o.ground ?? 0, c = (f) => o.ride === !1 ? f : Object.values(n).reduce((u, p) => p.ride(u, e, { ground: l }), f);
4751
4751
  t.forEach((f, u) => {
4752
4752
  for (const p of mc(f)) {
4753
- const g = (m) => new Error(`surfaceScript: beat ${u} (${f.do}), ${p.edit} on ${p.surface}: ${m}`), b = (m, P) => {
4754
- const O = typeof m == "object" ? m.beat : u, v = (typeof m == "object" ? m.at : m) ?? P ?? "start", y = i[O][v];
4755
- if (y === void 0) {
4753
+ const g = (m) => new Error(`surfaceScript: beat ${u} (${f.do}), ${p.edit} on ${p.surface}: ${m}`), y = (m, P) => {
4754
+ const O = typeof m == "object" ? m.beat : u, v = (typeof m == "object" ? m.at : m) ?? P ?? "start", b = i[O][v];
4755
+ if (b === void 0) {
4756
4756
  const S = zt.filter((w) => i[O][w] !== void 0).join(", ");
4757
4757
  throw g(`beat ${O} (${t[O].do}) has no ${v} (it has ${S})`);
4758
4758
  }
4759
- return y;
4760
- }, $ = n[p.surface], A = b(p.at ?? (i[u].contact !== void 0 ? "contact" : "start")), k = p.until === void 0 ? void 0 : b(p.until, "end");
4759
+ return b;
4760
+ }, $ = n[p.surface], A = y(p.at ?? (i[u].contact !== void 0 ? "contact" : "start")), k = p.until === void 0 ? void 0 : y(p.until, "end");
4761
4761
  if (k !== void 0 && k < A) throw g(`it ends (${k} ms) before it starts (${A} ms)`);
4762
4762
  try {
4763
4763
  if (p.edit === "carry") {
@@ -4782,7 +4782,7 @@ ${r.map((f) => ` ${f.beat >= 0 ? `beat ${f.beat}: ` : ""}${f.message}`).join(`
4782
4782
  const h = c(s.tracks), d = Object.entries(n).flatMap(([f, u]) => u.tracks(f));
4783
4783
  return { ...s, tracks: [...h, ...d], figureTracks: h };
4784
4784
  }
4785
- function bc(e, n, t = {}) {
4785
+ function yc(e, n, t = {}) {
4786
4786
  if (!Array.isArray(e)) return wn(e, t);
4787
4787
  const o = [], r = Object.keys(n), a = (c, h, d) => {
4788
4788
  const f = typeof h == "string" ? n[h] : void 0;
@@ -4821,13 +4821,13 @@ function bc(e, n, t = {}) {
4821
4821
  }
4822
4822
  const p = u, g = a(h, p.surface, "`then`");
4823
4823
  if (!g) return;
4824
- const b = `\`then\` (${String(p.edit)} on ${String(p.surface)})`, $ = [...Object.keys(g.about.edits), ...pc];
4824
+ const y = `\`then\` (${String(p.edit)} on ${String(p.surface)})`, $ = [...Object.keys(g.about.edits), ...pc];
4825
4825
  if (typeof p.edit != "string" || !$.includes(p.edit)) {
4826
4826
  o.push({ level: "error", beat: h, message: `\`then\`: ${ce("edit", p.edit, $)}` });
4827
4827
  return;
4828
4828
  }
4829
- for (const A of Array.isArray(p.anchor) ? p.anchor : [p.anchor]) s(h, g, A, b);
4830
- p.edit === "carry" && typeof p.anchor != "string" && o.push({ level: "error", beat: h, message: `${b}: \`carry\` takes one anchor, the piece it carries.` }), p.edit === "carry" && p.until === void 0 && o.push({ level: "error", beat: h, message: `${b}: \`carry\` needs \`until\` (when it lets go, such as { beat: ${h + 1}, at: 'release' }).` }), p.at !== void 0 && i(h, p.at, `${b} \`at\``), p.until !== void 0 && i(h, p.until, `${b} \`until\``), p.until !== void 0 && p.duration !== void 0 && o.push({ level: "error", beat: h, message: `${b}: give \`until\` or \`duration\`, not both.` });
4829
+ for (const A of Array.isArray(p.anchor) ? p.anchor : [p.anchor]) s(h, g, A, y);
4830
+ p.edit === "carry" && typeof p.anchor != "string" && o.push({ level: "error", beat: h, message: `${y}: \`carry\` takes one anchor, the piece it carries.` }), p.edit === "carry" && p.until === void 0 && o.push({ level: "error", beat: h, message: `${y}: \`carry\` needs \`until\` (when it lets go, such as { beat: ${h + 1}, at: 'release' }).` }), p.at !== void 0 && i(h, p.at, `${y} \`at\``), p.until !== void 0 && i(h, p.until, `${y} \`until\``), p.until !== void 0 && p.duration !== void 0 && o.push({ level: "error", beat: h, message: `${y}: give \`until\` or \`duration\`, not both.` });
4831
4831
  });
4832
4832
  });
4833
4833
  const l = e.map((c) => c && typeof c == "object" && !Array.isArray(c) ? ir(c, n, !0) : c);
@@ -4844,7 +4844,7 @@ function ir(e, n, t = !1) {
4844
4844
  }, s = { ...r };
4845
4845
  return an(e.target) && (s.target = a(e.target)), an(e.to) && (s.to = a(e.to).x), an(e.onto) && (s.onto = a(e.onto).top), s;
4846
4846
  }
4847
- function yc(e, n, t) {
4847
+ function bc(e, n, t) {
4848
4848
  let o = 0;
4849
4849
  return e.map((r) => {
4850
4850
  const a = Do([r], t.actions).length, s = n.slice(o, o + a);
@@ -4865,7 +4865,7 @@ function eu(e) {
4865
4865
  if (!o.includes(r)) throw new Error(`persona "${e.name}": ${ce("gait", r, o)}`);
4866
4866
  if (e.mood && !(e.mood in Ae)) throw new Error(`persona "${e.name}": ${ce("mood", e.mood, Object.keys(Ae))}`);
4867
4867
  const a = e.acting ?? "snappy";
4868
- if (typeof a == "string" && !(a in yt)) throw new Error(`persona "${e.name}": ${ce("acting style", a, Object.keys(yt))}`);
4868
+ if (typeof a == "string" && !(a in bt)) throw new Error(`persona "${e.name}": ${ce("acting style", a, Object.keys(bt))}`);
4869
4869
  if (typeof e.stance == "string" && !(e.stance in He)) throw new Error(`persona "${e.name}": ${ce("stance", e.stance, Object.keys(He))}`);
4870
4870
  const s = e.height ?? 120, i = typeof e.stance == "string" ? He[e.stance] : Dr(e.stance ?? {}), l = e.mood ? pt(i, e.mood) : i, c = { ...e.look, height: s }, h = e.summary ?? `${e.name}, a stick figure`;
4871
4871
  return {
@@ -4906,7 +4906,7 @@ function eu(e) {
4906
4906
  }
4907
4907
  const wc = /* @__PURE__ */ new Set(["x", "y", "walking", "gait"]), Js = 0.215 + 0.205;
4908
4908
  function kc(e, n, t = 1) {
4909
- const { points: o } = Ne(e, be), r = o["hip.left"], a = o["knee.left"], s = o["ankle.left"], i = r && a && s ? Math.hypot(a.x - r.x, a.y - r.y) + Math.hypot(s.x - a.x, s.y - a.y) : Js * e.height;
4909
+ const { points: o } = Ne(e, ye), r = o["hip.left"], a = o["knee.left"], s = o["ankle.left"], i = r && a && s ? Math.hypot(a.x - r.x, a.y - r.y) + Math.hypot(s.x - a.x, s.y - a.y) : Js * e.height;
4910
4910
  return wa(n, i / Js, t);
4911
4911
  }
4912
4912
  function tu(e, n, t, o = {}) {
@@ -4943,20 +4943,20 @@ function $c(e, n, t, o, r, a, s) {
4943
4943
  const f = Sc[h.do], u = i[d];
4944
4944
  if (!f || u.contact === void 0 || h.do !== "swipe" && !h.target) return;
4945
4945
  const p = u.contact, g = u.release ?? u.contact;
4946
- e.forEach((b, $) => {
4947
- if (b.time < p - 1 || b.time > g + 1) return;
4948
- const A = a(b.time), k = Ke(n[$], { height: r.height, facing: A < 0 ? -1 : 1 }), m = c(b.time), P = Mc.has(h.do) && h.target ? { x: h.target.x - m.x, y: h.target.y - m.y } : void 0, O = { x: (k.hands.right.x + k.fingertips.right.x) / 2, y: (k.hands.right.y + k.fingertips.right.y) / 2 }, v = P ?? (f === "arm" ? O : k.toes.right), y = A < 0 ? "right" : "left", S = `${f}.${y}`;
4949
- let w = b.pose;
4946
+ e.forEach((y, $) => {
4947
+ if (y.time < p - 1 || y.time > g + 1) return;
4948
+ const A = a(y.time), k = Ke(n[$], { height: r.height, facing: A < 0 ? -1 : 1 }), m = c(y.time), P = Mc.has(h.do) && h.target ? { x: h.target.x - m.x, y: h.target.y - m.y } : void 0, O = { x: (k.hands.right.x + k.fingertips.right.x) / 2, y: (k.hands.right.y + k.fingertips.right.y) / 2 }, v = P ?? (f === "arm" ? O : k.toes.right), b = A < 0 ? "right" : "left", S = `${f}.${b}`;
4949
+ let w = y.pose;
4950
4950
  if (h.do === "point")
4951
4951
  w = Ue(r, w, S, v);
4952
4952
  else if (f === "arm")
4953
- w = Ue(r, Oc(r, w, y, v), S, v);
4953
+ w = Ue(r, Oc(r, w, b, v), S, v);
4954
4954
  else
4955
4955
  for (let T = 0; T < 3; T++) {
4956
- const I = Ne(r, w).points, C = I[`ankle.${y}`], j = I[`toe.${y}`];
4956
+ const I = Ne(r, w).points, C = I[`ankle.${b}`], j = I[`toe.${b}`];
4957
4957
  w = Ue(r, w, S, { x: v.x - (j.x - C.x), y: v.y - (j.y - C.y) });
4958
4958
  }
4959
- e[$] = { ...b, pose: w };
4959
+ e[$] = { ...y, pose: w };
4960
4960
  });
4961
4961
  });
4962
4962
  }
@@ -4985,8 +4985,8 @@ function Ic(e, n, t, o, r) {
4985
4985
  let h = l[0]?.value ?? 0;
4986
4986
  return l.forEach((d, f) => {
4987
4987
  if (f > 0) {
4988
- const u = l[f - 1], p = i((u.time + d.time) / 2), g = ao(p, o.height), b = kc(o, p);
4989
- h += (d.value - u.value) * (b > 0 ? g / b : 1);
4988
+ const u = l[f - 1], p = i((u.time + d.time) / 2), g = ao(p, o.height), y = kc(o, p);
4989
+ h += (d.value - u.value) * (y > 0 ? g / y : 1);
4990
4990
  } else
4991
4991
  h = d.value;
4992
4992
  c.push({ ...d, value: h });
@@ -5039,7 +5039,7 @@ function nu(e, n, t) {
5039
5039
  const l = t.speed ?? 900, c = t.length ?? 34, h = t.slant ?? -8, d = Tt(t.seed ?? 1), f = s + c * 2;
5040
5040
  e.save(), e.beginPath(), e.rect(o, r, a, s), e.clip(), e.strokeStyle = xe(t.color ?? "rgb(190,210,235)", t.opacity ?? 0.35), e.lineWidth = t.lineWidth ?? 2, e.lineCap = "round", e.beginPath();
5041
5041
  for (let u = 0; u < i; u++) {
5042
- const p = o + d.next() * a, g = l * (1 + d.next() * 0.6), b = d.next() * f, $ = n / 1e3 * g + b, A = r - c + ($ % f + f) % f;
5042
+ const p = o + d.next() * a, g = l * (1 + d.next() * 0.6), y = d.next() * f, $ = n / 1e3 * g + y, A = r - c + ($ % f + f) % f;
5043
5043
  e.moveTo(p, A), e.lineTo(p + h, A + c);
5044
5044
  }
5045
5045
  e.stroke(), e.restore();
@@ -5146,9 +5146,9 @@ function uu(e, n, t) {
5146
5146
  e.translate(t.anchor.x + (l === "right" ? h : -h), t.anchor.y + a * 0.6), e.rotate((t.tilt ?? -3.4) * Math.PI / 180), e.globalAlpha *= o, e.font = Me(a, 800, i);
5147
5147
  const d = e.measureText(t.name).width;
5148
5148
  e.font = Me(s, 700, i);
5149
- const f = t.role ? e.measureText(t.role).width : 0, u = a * 0.47, p = Math.max(d, f) + u * 2 + 10, g = -a * 1.1, b = t.role ? a + s + a * 0.95 : a * 1.6, $ = l === "right" ? 0 : -p;
5150
- Pe(e, $, g, p, b, 4), e.fillStyle = t.color ?? At, e.fill(), e.strokeStyle = t.ink ?? rt, e.lineWidth = 5, e.stroke(), e.textAlign = "left", e.textBaseline = "alphabetic", e.fillStyle = "#ffffff", e.font = Me(a, 800, i);
5151
- const A = t.role ? g + a * 1.1 + a * 0.22 : g + b / 2 + a * 0.35;
5149
+ const f = t.role ? e.measureText(t.role).width : 0, u = a * 0.47, p = Math.max(d, f) + u * 2 + 10, g = -a * 1.1, y = t.role ? a + s + a * 0.95 : a * 1.6, $ = l === "right" ? 0 : -p;
5150
+ Pe(e, $, g, p, y, 4), e.fillStyle = t.color ?? At, e.fill(), e.strokeStyle = t.ink ?? rt, e.lineWidth = 5, e.stroke(), e.textAlign = "left", e.textBaseline = "alphabetic", e.fillStyle = "#ffffff", e.font = Me(a, 800, i);
5151
+ const A = t.role ? g + a * 1.1 + a * 0.22 : g + y / 2 + a * 0.35;
5152
5152
  return e.fillText(t.name, $ + u, A), t.role && (e.font = Me(s, 700, i), e.fillStyle = qo, e.fillText(t.role, $ + u, A + s * 1.45)), e.restore(), o;
5153
5153
  }
5154
5154
  function xc(e, n, t, o) {
@@ -5176,9 +5176,9 @@ function gu(e, n, t) {
5176
5176
  }
5177
5177
  e.font = Me(l, 700, c), e.fillStyle = h, e.textBaseline = "alphabetic";
5178
5178
  const p = Nc(f, r);
5179
- return f.forEach((g, b) => {
5179
+ return f.forEach((g, y) => {
5180
5180
  const $ = e.measureText(g).width;
5181
- e.textAlign = "left", e.fillText(p[b], a + s / 2 - $ / 2, u + l * 1.38 + b * d);
5181
+ e.textAlign = "left", e.fillText(p[y], a + s / 2 - $ / 2, u + l * 1.38 + y * d);
5182
5182
  }), e.restore(), o;
5183
5183
  }
5184
5184
  function pu(e, n, t) {
@@ -5186,9 +5186,9 @@ function pu(e, n, t) {
5186
5186
  if (!(n >= o && n <= r + 220) || a <= 0.01) return 0;
5187
5187
  const s = t.size ?? 40, i = t.font ?? st, l = t.ink ?? rt, c = t.fill ?? "#ffffff", h = t.bounds ?? { x: 40, y: 40, width: 1840 }, d = t.tail;
5188
5188
  e.save(), e.font = Me(s, 700, i);
5189
- const f = Bo(e, t.text, t.maxWidth ?? 640), u = s * 1.3, p = Math.max(...f.map((P) => e.measureText(P).width)) + s * 1.75, g = f.length * u + s * 1.25, b = t.speaker ? s * 0.5 : 0, $ = Math.min(h.x + h.width - p / 2, Math.max(h.x + p / 2, d.x));
5189
+ const f = Bo(e, t.text, t.maxWidth ?? 640), u = s * 1.3, p = Math.max(...f.map((P) => e.measureText(P).width)) + s * 1.75, g = f.length * u + s * 1.25, y = t.speaker ? s * 0.5 : 0, $ = Math.min(h.x + h.width - p / 2, Math.max(h.x + p / 2, d.x));
5190
5190
  let A = Math.min(d.y - (t.gap ?? 70) - g / 2, t.maxCenterY ?? 1 / 0);
5191
- A = Math.max(h.y + b + g / 2, A);
5191
+ A = Math.max(h.y + y + g / 2, A);
5192
5192
  const k = { x: d.x + ($ - d.x) * 0.2, y: Math.max(A + g / 2 + 16, d.y - 14) };
5193
5193
  e.translate(k.x, k.y), e.scale(a, a), e.translate(-k.x, -k.y), e.fillStyle = c, e.strokeStyle = l, e.lineWidth = 5, e.lineJoin = "round";
5194
5194
  const m = Math.min(Math.max(k.x, $ - p / 2 + 50), $ + p / 2 - 50);
@@ -5200,7 +5200,7 @@ function pu(e, n, t) {
5200
5200
  }
5201
5201
  return e.font = Me(s, 700, i), e.fillStyle = l, e.textAlign = "center", e.textBaseline = "alphabetic", f.forEach((P, O) => e.fillText(P, $, A - g / 2 + s * 1.65 + O * u)), e.restore(), a;
5202
5202
  }
5203
- const bo = ["photo", "note"], yo = {
5203
+ const yo = ["photo", "note"], bo = {
5204
5204
  cross: "two diagonals across the card, one after the other (ruled out)",
5205
5205
  strike: "one diagonal, bottom-left to top-right (half ruled out)",
5206
5206
  scribble: "a zigzag back and forth across the card (scribbled out)",
@@ -5212,7 +5212,7 @@ function mu(e) {
5212
5212
  if (o.has(c.id)) throw new Error(`caseBoard: two cards have the id "${c.id}"`);
5213
5213
  o.add(c.id);
5214
5214
  const h = c.kind ?? "photo";
5215
- if (!bo.includes(h)) throw new Error(`caseBoard: ${ce("card kind", h, bo)}`);
5215
+ if (!yo.includes(h)) throw new Error(`caseBoard: ${ce("card kind", h, yo)}`);
5216
5216
  const d = (t.next() - 0.5) * 6;
5217
5217
  return {
5218
5218
  id: c.id,
@@ -5231,7 +5231,7 @@ function mu(e) {
5231
5231
  }), a = [...o], s = (c, h) => {
5232
5232
  if (!o.has(c)) throw new Error(`caseBoard: ${h}: ${ce("card", c, a)}`);
5233
5233
  }, i = (e.strings ?? []).map((c, h) => (s(c.from, `strings[${h}].from`), s(c.to, `strings[${h}].to`), { from: c.from, to: c.to, at: c.at ?? 0, duration: c.duration ?? 600, color: c.color ?? "#b91c1c" })), l = (e.marks ?? []).map((c, h) => {
5234
- if (s(c.on, `marks[${h}].on`), !(c.kind in yo)) throw new Error(`caseBoard: marks[${h}]: ${ce("mark", c.kind, Object.keys(yo))}`);
5234
+ if (s(c.on, `marks[${h}].on`), !(c.kind in bo)) throw new Error(`caseBoard: marks[${h}]: ${ce("mark", c.kind, Object.keys(bo))}`);
5235
5235
  return { on: c.on, kind: c.kind, at: c.at, duration: c.duration ?? 1400, color: c.color ?? At, width: c.width ?? (c.kind === "scribble" ? 18 : 16) };
5236
5236
  });
5237
5237
  return {
@@ -5310,7 +5310,7 @@ function Wc(e, n, t, o = {}) {
5310
5310
  for (const a of r.slice(1)) e.lineTo(a.x, a.y);
5311
5311
  return e.stroke(), e.restore(), r[r.length - 1];
5312
5312
  }
5313
- function bu(e, n, t, o = {}) {
5313
+ function yu(e, n, t, o = {}) {
5314
5314
  const { x: r, y: a, width: s, height: i, ink: l } = n;
5315
5315
  e.save(), Pe(e, r, a, s, i, 10), e.fillStyle = n.cork, e.fill(), e.save(), e.clip();
5316
5316
  const c = Tt(n.seed + 7);
@@ -5331,17 +5331,17 @@ function bu(e, n, t, o = {}) {
5331
5331
  if (u <= 0) continue;
5332
5332
  const p = f.width, g = f.height;
5333
5333
  e.save(), e.translate(r + f.x, a + f.y - 40 * (1 - Math.min(1, u))), e.rotate(f.angle * Math.PI / 180), e.scale(u, u), Pe(e, -p / 2, 0, p, g, 3), e.fillStyle = f.color, e.fill(), e.lineWidth = 3, e.strokeStyle = l, e.stroke();
5334
- const b = f.kind === "photo", $ = b ? { x: -p / 2 + 18, y: 18, width: p - 36, height: g * 0.62 } : { x: -p / 2 + 12, y: 14, width: p - 24, height: g * 0.45 };
5335
- b && (e.fillStyle = "#1e2530", e.fillRect($.x, $.y, $.width, $.height)), o.drawCard && (e.save(), e.beginPath(), e.rect($.x, $.y, $.width, $.height), e.clip(), o.drawCard(e, f, $, t), e.restore()), e.textAlign = "center", e.textBaseline = "alphabetic";
5334
+ const y = f.kind === "photo", $ = y ? { x: -p / 2 + 18, y: 18, width: p - 36, height: g * 0.62 } : { x: -p / 2 + 12, y: 14, width: p - 24, height: g * 0.45 };
5335
+ y && (e.fillStyle = "#1e2530", e.fillRect($.x, $.y, $.width, $.height)), o.drawCard && (e.save(), e.beginPath(), e.rect($.x, $.y, $.width, $.height), e.clip(), o.drawCard(e, f, $, t), e.restore()), e.textAlign = "center", e.textBaseline = "alphabetic";
5336
5336
  const A = $.y + $.height;
5337
- if (b)
5337
+ if (y)
5338
5338
  f.title && (e.font = Me(28, 800, n.font), e.fillStyle = l, e.fillText(f.title, 0, A + (g - A) * 0.45, p - 16)), f.note && (e.font = Me(19, 600, n.font), e.fillStyle = "#7f1d1d", e.fillText(f.note, 0, A + (g - A) * 0.8, p - 16));
5339
5339
  else {
5340
5340
  const m = [f.title, f.note].filter(Boolean).join(`
5341
5341
  `);
5342
5342
  e.font = Me(26, 700, n.handFont), e.fillStyle = l;
5343
5343
  const P = Bo(e, m, p - 20), O = o.drawCard ? A + 8 : (g - P.length * 30) / 2;
5344
- P.forEach((v, y) => e.fillText(v, 0, O + 24 + y * 30, p - 12));
5344
+ P.forEach((v, b) => e.fillText(v, 0, O + 24 + b * 30, p - 12));
5345
5345
  }
5346
5346
  f.highlight && t >= f.highlight.at && t <= f.highlight.at + f.highlight.duration && (e.strokeStyle = lr, e.lineWidth = 8, e.globalAlpha *= 0.6 + 0.4 * Math.sin((t - f.highlight.at) / 1e3 * 6), e.strokeRect(-p / 2 - 8, -8, p + 16, g + 16)), e.restore();
5347
5347
  const k = Qn(n, f.id).pin;
@@ -5350,7 +5350,7 @@ function bu(e, n, t, o = {}) {
5350
5350
  for (const f of n.marks) {
5351
5351
  if (t <= f.at) continue;
5352
5352
  const u = hr(n, f), p = cr(u, je(Ee(t, f.at, f.duration)));
5353
- u.forEach((g, b) => Wc(e, g, p[b], { color: f.color, width: f.width }));
5353
+ u.forEach((g, y) => Wc(e, g, p[y], { color: f.color, width: f.width }));
5354
5354
  }
5355
5355
  return e.restore(), Rc(n, t);
5356
5356
  }
@@ -5382,8 +5382,8 @@ const Kc = {
5382
5382
  "drawPushPin(ctx, x, y, { color?, radius? })": "a red push pin",
5383
5383
  "drawMarkerStroke(ctx, points, progress, { color?, width? })": "the first part of a marker stroke; returns the nib"
5384
5384
  },
5385
- cardKinds: bo,
5386
- markKinds: yo,
5385
+ cardKinds: yo,
5386
+ markKinds: bo,
5387
5387
  card: "{ id, x, y (its pin, relative to the board), kind?, title?, note?, width?, height?, angle?, color?, at?, highlight?: { at, duration } }",
5388
5388
  string: "{ from, to, at?, duration?, color? }",
5389
5389
  mark: "{ on, kind, at, duration?, color?, width? }"
@@ -5420,7 +5420,7 @@ const _t = {
5420
5420
  sunset: ["#fb7185", "#f59e0b"],
5421
5421
  ocean: ["#0ea5e9", "#0b2e6b"]
5422
5422
  };
5423
- function yu(e, n) {
5423
+ function bu(e, n) {
5424
5424
  const t = n.sky ? _t[n.sky] : void 0;
5425
5425
  if (n.sky && !t)
5426
5426
  throw new Error(`drawSkyGradient: unknown sky "${n.sky}" (one of ${Object.keys(_t).join(", ")})`);
@@ -5433,8 +5433,8 @@ function wu(e, n, t) {
5433
5433
  const [s, i, l] = In(t.color ?? "#ffffff"), c = t.opacity ?? 0.7, h = t.size ?? 3, d = t.drift ?? { x: 0, y: -14 }, f = t.offset ?? { x: 0, y: 0 }, u = t.seed ?? 1, p = n / 1e3;
5434
5434
  e.save();
5435
5435
  for (let g = 0; g < a; g++) {
5436
- const b = [0.35, 0.65, 1][g % 3], $ = ko(Ie(g, u) * o + (d.x * p + f.x) * b, o), A = ko(Ie(g, u + 1) * r + (d.y * p + f.y) * b, r), k = 0.5 + 0.5 * Math.sin(p * (1.1 + 2.3 * Ie(g, u + 2)) + g);
5437
- e.fillStyle = Hn([s, i, l], c * (0.25 + 0.75 * k) * b), e.beginPath(), e.arc($, A, h * (0.5 + b), 0, Math.PI * 2), e.fill();
5436
+ const y = [0.35, 0.65, 1][g % 3], $ = ko(Ie(g, u) * o + (d.x * p + f.x) * y, o), A = ko(Ie(g, u + 1) * r + (d.y * p + f.y) * y, r), k = 0.5 + 0.5 * Math.sin(p * (1.1 + 2.3 * Ie(g, u + 2)) + g);
5437
+ e.fillStyle = Hn([s, i, l], c * (0.25 + 0.75 * k) * y), e.beginPath(), e.arc($, A, h * (0.5 + y), 0, Math.PI * 2), e.fill();
5438
5438
  }
5439
5439
  e.restore();
5440
5440
  }
@@ -5443,9 +5443,9 @@ function ku(e, n, t) {
5443
5443
  if (a === 0 || o <= 0 || r <= 0) return;
5444
5444
  const [s, i, l] = In(t.color ?? "#ffffff"), c = t.opacity ?? 0.1, h = t.minRadius ?? 60, d = Math.max(h, t.maxRadius ?? 190), f = t.drift ?? 8, u = t.offset ?? { x: 0, y: 0 }, p = t.seed ?? 3, g = n / 1e3;
5445
5445
  e.save();
5446
- for (let b = 0; b < a; b++) {
5447
- const $ = h + (d - h) * Ie(b, p + 5), A = o + $ * 2, k = ko(Ie(b, p) * A + f * g * (0.5 + Ie(b, p + 7)) + u.x * 1.6, A) - $, m = Ie(b, p + 1) * r + 20 * Math.sin(g * 0.4 + b) + u.y * 1.6;
5448
- e.fillStyle = Hn([s, i, l], c * (0.6 + 0.4 * Ie(b, p + 9))), e.beginPath(), e.arc(k, m, $, 0, Math.PI * 2), e.fill();
5446
+ for (let y = 0; y < a; y++) {
5447
+ const $ = h + (d - h) * Ie(y, p + 5), A = o + $ * 2, k = ko(Ie(y, p) * A + f * g * (0.5 + Ie(y, p + 7)) + u.x * 1.6, A) - $, m = Ie(y, p + 1) * r + 20 * Math.sin(g * 0.4 + y) + u.y * 1.6;
5448
+ e.fillStyle = Hn([s, i, l], c * (0.6 + 0.4 * Ie(y, p + 9))), e.beginPath(), e.arc(k, m, $, 0, Math.PI * 2), e.fill();
5449
5449
  }
5450
5450
  e.restore();
5451
5451
  }
@@ -5484,8 +5484,8 @@ function $u(e, n, t) {
5484
5484
  for (let f = 0; f < o; f++) {
5485
5485
  const u = Ie(f, h) * Math.PI * 2 + d * (t.spin ?? 0.15), p = Math.tan((Ie(f, h + 3) - 0.5) * 2.2) * 0.35, g = t.radius * (0.75 + 0.32 * p);
5486
5486
  if (g <= 0) continue;
5487
- const b = 0.5 + 0.5 * Math.sin(d * 7 + f * 1.7);
5488
- e.fillStyle = Hn([r, a, s], i * (0.3 + 0.7 * b)), e.beginPath(), e.arc(t.x + g * Math.cos(u), t.y + g * Math.sin(u) * c, l, 0, Math.PI * 2), e.fill();
5487
+ const y = 0.5 + 0.5 * Math.sin(d * 7 + f * 1.7);
5488
+ e.fillStyle = Hn([r, a, s], i * (0.3 + 0.7 * y)), e.beginPath(), e.arc(t.x + g * Math.cos(u), t.y + g * Math.sin(u) * c, l, 0, Math.PI * 2), e.fill();
5489
5489
  }
5490
5490
  e.restore();
5491
5491
  }
@@ -5667,8 +5667,8 @@ function Zc(e, n, t) {
5667
5667
  for (let i = 0; i + 1 < t.length; i++) {
5668
5668
  const l = [], c = /* @__PURE__ */ new Map(), h = (p) => {
5669
5669
  const g = p.map(($) => Math.round($ * 1e6)).join(",");
5670
- let b = c.get(g);
5671
- return b === void 0 && (b = l.length, l.push(p), c.set(g, b)), b;
5670
+ let y = c.get(g);
5671
+ return y === void 0 && (y = l.length, l.push(p), c.set(g, y)), y;
5672
5672
  }, d = [], f = (p) => p === 0, u = (p, g) => p + 2 === g.length;
5673
5673
  for (const p of o) {
5674
5674
  let g = p.points;
@@ -5766,7 +5766,7 @@ const Bt = {
5766
5766
  }, So = Math.PI / 180;
5767
5767
  function a0(e, n, t) {
5768
5768
  return {
5769
- toView: (o) => Br(ba(o, e * 90 * So), -n * So),
5769
+ toView: (o) => Br(ya(o, e * 90 * So), -n * So),
5770
5770
  toScreen: (o) => ({ x: o[0] * t, y: -o[1] * t })
5771
5771
  };
5772
5772
  }
@@ -5774,22 +5774,22 @@ const aa = /* @__PURE__ */ new WeakMap(), kn = (e) => ln(e), ln = (e) => {
5774
5774
  let n = aa.get(e);
5775
5775
  return n || aa.set(e, n = $l(e)), n;
5776
5776
  };
5777
- function ye(e, n, t) {
5777
+ function be(e, n, t) {
5778
5778
  return n[t] ?? e.controls[t]?.default ?? Bt[t]?.default ?? 0;
5779
5779
  }
5780
5780
  function Ft(e, n) {
5781
- const t = Math.max(0.05, ye(e, n, "squash")), o = 1 / Math.sqrt(t), a = [1, 0, 0, 0, 0, 1, ye(e, n, "lean"), 0, 0, 0, 1, 0, 0, 0, 0, 1];
5781
+ const t = Math.max(0.05, be(e, n, "squash")), o = 1 / Math.sqrt(t), a = [1, 0, 0, 0, 0, 1, be(e, n, "lean"), 0, 0, 0, 1, 0, 0, 0, 0, 1];
5782
5782
  return [
5783
- oe.translation([0, ye(e, n, "lift"), 0]),
5784
- oe.fromQuat(Ge.fromAxisAngle([1, 0, 0], -ye(e, n, "pitch"))),
5785
- oe.fromQuat(Ge.fromAxisAngle([0, 0, 1], ye(e, n, "roll"))),
5783
+ oe.translation([0, be(e, n, "lift"), 0]),
5784
+ oe.fromQuat(Ge.fromAxisAngle([1, 0, 0], -be(e, n, "pitch"))),
5785
+ oe.fromQuat(Ge.fromAxisAngle([0, 0, 1], be(e, n, "roll"))),
5786
5786
  a,
5787
5787
  oe.scaling([o, t, o]),
5788
- oe.scaling(Array(3).fill(Math.max(0, ye(e, n, "size"))))
5788
+ oe.scaling(Array(3).fill(Math.max(0, be(e, n, "size"))))
5789
5789
  ].reduce((s, i) => oe.multiply(s, i));
5790
5790
  }
5791
5791
  function Uo(e, n) {
5792
- const t = Ft(e, n), o = /* @__PURE__ */ new Map(), r = Object.entries(e.controls).flatMap(([s, i]) => (i.bind ?? []).map((l) => ({ value: ye(e, n, s), bind: l }))), a = (s) => {
5792
+ const t = Ft(e, n), o = /* @__PURE__ */ new Map(), r = Object.entries(e.controls).flatMap(([s, i]) => (i.bind ?? []).map((l) => ({ value: be(e, n, s), bind: l }))), a = (s) => {
5793
5793
  const i = o.get(s.id);
5794
5794
  if (i) return i;
5795
5795
  const l = s.parent ? e.parts.find((h) => h.id === s.parent) : void 0;
@@ -5863,7 +5863,7 @@ function mr(e, n, t, o, r = {}) {
5863
5863
  he.marks = E.filter(([ge]) => (ie(ge) >= 0 ? ie(ge) : pe) === J).flatMap(K);
5864
5864
  }
5865
5865
  }
5866
- const q = j.glow ? Math.max(0, Math.min(1, ye(e, a, j.glow.control))) : 0, le = j.fade ? Math.max(0, Math.min(1, ye(e, a, j.fade.control))) : 0, L = j.fade ? Math.max(0, Math.min(1, j.fade.from + (j.fade.to - j.fade.from) * le)) : 1;
5866
+ const q = j.glow ? Math.max(0, Math.min(1, be(e, a, j.glow.control))) : 0, le = j.fade ? Math.max(0, Math.min(1, be(e, a, j.fade.control))) : 0, L = j.fade ? Math.max(0, Math.min(1, j.fade.from + (j.fade.to - j.fade.from) * le)) : 1;
5867
5867
  return {
5868
5868
  part: j,
5869
5869
  depth: B.reduce((z, J) => z + J[2], 0) / Math.max(1, B.length),
@@ -5902,7 +5902,7 @@ function mr(e, n, t, o, r = {}) {
5902
5902
  const Y = t.toView(oe.transformPoint(G, W.at));
5903
5903
  P[j] = { point: t.toScreen(Y), depth: Y[2] };
5904
5904
  }
5905
- const [O, v] = e.footprint ?? [e.length * 0.45, e.length], y = Math.max(0, ye(e, a, "lift")), S = Math.max(0, ye(e, a, "size")) / (1 + y * 0.8), w = Array.from({ length: 24 }, (j, W) => {
5905
+ const [O, v] = e.footprint ?? [e.length * 0.45, e.length], b = Math.max(0, be(e, a, "lift")), S = Math.max(0, be(e, a, "size")) / (1 + b * 0.8), w = Array.from({ length: 24 }, (j, W) => {
5906
5906
  const G = Math.PI * 2 * W / 24;
5907
5907
  return t.toView([Math.cos(G) * O * 0.55 * S, 0, Math.sin(G) * v * 0.55 * S]);
5908
5908
  }), T = r.perspective ? r.near : void 0, I = {
@@ -5930,12 +5930,12 @@ function i0(e) {
5930
5930
  function l0(e, n) {
5931
5931
  const t = e.derive ? { ...n, ...e.derive(n) } : n, o = Uo(e, t), r = oe.invert(Ft(e, t)) ?? oe.identity(), a = (s) => Math.max(0, Math.min(1, s));
5932
5932
  return e.parts.map((s) => {
5933
- const i = s.fade ? a(ye(e, t, s.fade.control)) : 0;
5933
+ const i = s.fade ? a(be(e, t, s.fade.control)) : 0;
5934
5934
  return {
5935
5935
  part: s,
5936
5936
  matrix: o.get(s.id),
5937
5937
  local: oe.multiply(r, o.get(s.id)),
5938
- glow: s.glow ? a(ye(e, t, s.glow.control)) : 0,
5938
+ glow: s.glow ? a(be(e, t, s.glow.control)) : 0,
5939
5939
  opacity: s.fade ? a(s.fade.from + (s.fade.to - s.fade.from) * i) : 1
5940
5940
  };
5941
5941
  });
@@ -5980,14 +5980,14 @@ function ia(e) {
5980
5980
  }
5981
5981
  return t;
5982
5982
  }
5983
- function br(e, n) {
5983
+ function yr(e, n) {
5984
5984
  if (!e.loose?.size) return;
5985
5985
  const t = {};
5986
5986
  for (const [o, r] of e.loose)
5987
5987
  t[o] = { x: n[`piece.${r}.x`] ?? 0, y: n[`piece.${r}.y`] ?? 0, rotate: n[`piece.${r}.rotate`] ?? 0, opacity: n[`piece.${r}.opacity`] ?? 1 };
5988
5988
  return t;
5989
5989
  }
5990
- function yr(e) {
5990
+ function br(e) {
5991
5991
  const n = {};
5992
5992
  for (const [t, o] of Object.entries({ ...Bt, ...e.rig.controls })) {
5993
5993
  const { bind: r, ...a } = o;
@@ -5996,7 +5996,7 @@ function yr(e) {
5996
5996
  return n;
5997
5997
  }
5998
5998
  function u0(e) {
5999
- const { prop: n } = e, t = e.scale ?? 60, o = n.rig.length * t * 1.4, r = n.rig.height * t * 1.6, a = yr(n), s = {};
5999
+ const { prop: n } = e, t = e.scale ?? 60, o = n.rig.length * t * 1.4, r = n.rig.height * t * 1.6, a = br(n), s = {};
6000
6000
  for (const [l, c] of Object.entries(a)) s[l] = e.values?.[l] ?? c.default ?? 0;
6001
6001
  const i = { look: e.look, ink: e.ink, lineWidth: e.lineWidth, pencil: e.pencil, seed: e.seed, style: e.style, paper: e.paper };
6002
6002
  return {
@@ -6017,12 +6017,12 @@ function u0(e) {
6017
6017
  },
6018
6018
  draw(l, c, h) {
6019
6019
  const d = c.props ?? {};
6020
- l.translate(o / 2, r), _a(l, qt(n, d, t), { ...i, time: h, loose: br(c, d) });
6020
+ l.translate(o / 2, r), _a(l, qt(n, d, t), { ...i, time: h, loose: yr(c, d) });
6021
6021
  }
6022
6022
  };
6023
6023
  }
6024
6024
  function qt(e, n, t) {
6025
- const o = a0(ye(e.rig, n, "turn"), ye(e.rig, n, "tilt"), t);
6025
+ const o = a0(be(e.rig, n, "turn"), be(e.rig, n, "tilt"), t);
6026
6026
  return mr(e.rig, n, o, t);
6027
6027
  }
6028
6028
  function Xo(e, n, t) {
@@ -6047,7 +6047,7 @@ function Hu(e, n, t, o, r = {}) {
6047
6047
  return e.save(), e.translate(a.origin.x, a.origin.y), _a(e, a.solved, {
6048
6048
  ...n.propDraw,
6049
6049
  time: t.time,
6050
- loose: br(n, a.values),
6050
+ loose: yr(n, a.values),
6051
6051
  // The rider is drawn in scene px.
6052
6052
  rider: r.rider ? (s) => {
6053
6053
  s.save(), s.translate(-a.origin.x, -a.origin.y), r.rider(s), s.restore();
@@ -6071,59 +6071,59 @@ const xt = {
6071
6071
  }
6072
6072
  }, g0 = 400, p0 = 0.2;
6073
6073
  function ju(e, n = {}) {
6074
- const { prop: t } = e, o = yr(t), r = Object.keys(o), a = Object.keys(t.rig.anchors ?? {}), s = t.rig.parts.map((O) => O.id), i = Lt(), l = Tn(i), c = n.tracks?.length ? new ve({ id: `${t.kind}-surface`, tracks: n.tracks }) : void 0, h = Math.max(0, ...(n.tracks ?? []).flatMap((O) => O.keyframes.map((v) => v.time))), d = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map();
6074
+ const { prop: t } = e, o = br(t), r = Object.keys(o), a = Object.keys(t.rig.anchors ?? {}), s = t.rig.parts.map((O) => O.id), i = Lt(), l = Tn(i), c = n.tracks?.length ? new ve({ id: `${t.kind}-surface`, tracks: n.tracks }) : void 0, h = Math.max(0, ...(n.tracks ?? []).flatMap((O) => O.keyframes.map((v) => v.time))), d = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map();
6075
6075
  e.loose = f;
6076
6076
  const u = e.props, p = (O) => {
6077
6077
  const v = { ...e.props };
6078
- let y = 0, S = 0;
6078
+ let b = 0, S = 0;
6079
6079
  if (c) {
6080
6080
  const w = c.getStateAtTime(Math.min(O, h));
6081
6081
  for (const T of w.values.values())
6082
6082
  for (const [I, C] of T)
6083
- typeof C == "number" && (I === "x" ? y = C : I === "y" ? S = C : I in v && (v[I] = C));
6083
+ typeof C == "number" && (I === "x" ? b = C : I === "y" ? S = C : I in v && (v[I] = C));
6084
6084
  }
6085
6085
  for (const w of r) i.keys(w)?.length && (v[w] = i.valueAt(w, O));
6086
- return { values: v, origin: { x: e.x + e.width / 2 + y, y: e.y + e.height + S } };
6086
+ return { values: v, origin: { x: e.x + e.width / 2 + b, y: e.y + e.height + S } };
6087
6087
  }, g = (O) => {
6088
- const { kind: v, rest: y } = $t(O), S = (w) => tt(t.kind, O, xt, w);
6088
+ const { kind: v, rest: b } = $t(O), S = (w) => tt(t.kind, O, xt, w);
6089
6089
  if (v === "box") {
6090
- if (y) throw S("box takes no arguments");
6090
+ if (b) throw S("box takes no arguments");
6091
6091
  return { kind: v };
6092
6092
  }
6093
6093
  if (v === "anchor") {
6094
- if (!a.includes(y)) throw S(ce(`${t.kind} anchor`, y, a));
6095
- return { kind: v, name: y };
6094
+ if (!a.includes(b)) throw S(ce(`${t.kind} anchor`, b, a));
6095
+ return { kind: v, name: b };
6096
6096
  }
6097
6097
  if (v === "part") {
6098
- if (!s.includes(y)) throw S(ce(`${t.kind} part`, y, s));
6099
- return { kind: v, name: y };
6098
+ if (!s.includes(b)) throw S(ce(`${t.kind} part`, b, s));
6099
+ return { kind: v, name: b };
6100
6100
  }
6101
6101
  if (v === "control") {
6102
- if (!r.includes(y)) throw S(ce(`${t.kind} control`, y, r));
6103
- return { kind: v, name: y };
6102
+ if (!r.includes(b)) throw S(ce(`${t.kind} control`, b, r));
6103
+ return { kind: v, name: b };
6104
6104
  }
6105
6105
  throw S();
6106
- }, b = (O) => {
6107
- const v = (t.rig.controls[O]?.bind ?? []).flatMap((S) => S.parts), y = t.rig.parts.filter((S) => S.glow?.control === O).map((S) => S.id);
6108
- return /* @__PURE__ */ new Set([...v, ...y]);
6106
+ }, y = (O) => {
6107
+ const v = (t.rig.controls[O]?.bind ?? []).flatMap((S) => S.parts), b = t.rig.parts.filter((S) => S.glow?.control === O).map((S) => S.id);
6108
+ return /* @__PURE__ */ new Set([...v, ...b]);
6109
6109
  }, $ = /* @__PURE__ */ new Map(), A = (O) => {
6110
6110
  let v = $.get(O);
6111
6111
  if (!v) {
6112
- const y = p(O);
6113
- $.set(O, v = { ...y, solved: qt(t, y.values, e.propScale) });
6112
+ const b = p(O);
6113
+ $.set(O, v = { ...b, solved: qt(t, b.values, e.propScale) });
6114
6114
  }
6115
6115
  return v;
6116
6116
  }, k = (O, v) => {
6117
- const y = g(O), { values: S, origin: w, solved: T } = A(v);
6118
- if (y.kind === "box") return me(w.x - e.width / 2, w.y - e.height, e.width, e.height);
6119
- if (y.kind === "anchor") {
6120
- const j = T.anchors[y.name].point, W = p0 * e.propScale;
6117
+ const b = g(O), { values: S, origin: w, solved: T } = A(v);
6118
+ if (b.kind === "box") return me(w.x - e.width / 2, w.y - e.height, e.width, e.height);
6119
+ if (b.kind === "anchor") {
6120
+ const j = T.anchors[b.name].point, W = p0 * e.propScale;
6121
6121
  return me(w.x + j.x - W / 2, w.y + j.y - W / 2, W, W);
6122
6122
  }
6123
- if (y.kind === "part") return C(/* @__PURE__ */ new Set([y.name]), `part "${y.name}" is`);
6124
- const I = b(y.name);
6123
+ if (b.kind === "part") return C(/* @__PURE__ */ new Set([b.name]), `part "${b.name}" is`);
6124
+ const I = y(b.name);
6125
6125
  if (I.size === 0) return me(w.x - e.width / 2, w.y - e.height, e.width, e.height);
6126
- return C(I, `the parts control "${y.name}" moves are`);
6126
+ return C(I, `the parts control "${b.name}" moves are`);
6127
6127
  function C(j, W) {
6128
6128
  const G = [...T.under, ...T.over].filter((N) => j.has(N.part.id)).flatMap((N) => N.faces.flatMap((R) => R.points));
6129
6129
  if (G.length === 0) {
@@ -6151,8 +6151,8 @@ function ju(e, n = {}) {
6151
6151
  piece(O) {
6152
6152
  const v = g(O);
6153
6153
  if (v.kind !== "part") throw new Error(`${t.kind}: a piece is a part, part:ID (${s.slice(0, 6).map((T) => `part:${T}`).join(", ")}…), not "${O}"`);
6154
- const y = d.get(v.name);
6155
- if (y) return y;
6154
+ const b = d.get(v.name);
6155
+ if (b) return b;
6156
6156
  const S = [v.name];
6157
6157
  for (let T = 0; T < S.length; T++) for (const I of t.rig.parts) I.parent === S[T] && !S.includes(I.id) && S.push(I.id);
6158
6158
  const w = { id: d.size + 1, part: v.name, home: k(O, 0) };
@@ -6161,18 +6161,18 @@ function ju(e, n = {}) {
6161
6161
  for (const T of ["x", "y", "rotate"]) u[`piece.${w.id}.${T}`] = 0;
6162
6162
  return u[`piece.${w.id}.opacity`] = 1, w;
6163
6163
  },
6164
- edit(O, v, y) {
6164
+ edit(O, v, b) {
6165
6165
  if (!(O in xt.edits)) throw An(t.kind, O, xt);
6166
6166
  const S = Array.isArray(v) ? v : [v];
6167
6167
  if (S.length === 0) throw new Error(`${t.kind}.edit: ${O} takes at least one anchor`);
6168
6168
  if ($.clear(), O === "move" || O === "fling") {
6169
6169
  if (S.length > 1) throw new Error(`${t.kind}.edit: ${O} takes one part anchor`);
6170
6170
  const w = P.piece(S[0]);
6171
- if (O === "fling") return P.fling(w, y);
6172
- const T = y.to;
6171
+ if (O === "fling") return P.fling(w, b);
6172
+ const T = b.to;
6173
6173
  if (!T) throw new Error(`${t.kind}.edit: move needs \`to\`, an anchor name or { x, y }`);
6174
- const I = typeof T == "string" ? k(T, y.at) : void 0;
6175
- return P.move(w, { ...y, to: I ? { x: I.left + I.width / 2, y: I.top + I.height / 2 } : T });
6174
+ const I = typeof T == "string" ? k(T, b.at) : void 0;
6175
+ return P.move(w, { ...b, to: I ? { x: I.left + I.width / 2, y: I.top + I.height / 2 } : T });
6176
6176
  }
6177
6177
  for (const w of S) {
6178
6178
  const T = g(w);
@@ -6180,11 +6180,11 @@ function ju(e, n = {}) {
6180
6180
  const I = o[T.name];
6181
6181
  let C;
6182
6182
  if (O === "set") {
6183
- if (typeof y.value != "number" || !Number.isFinite(y.value)) throw new Error(`${t.kind}.edit: set needs \`value\`, a number (${T.name}: ${I.description})`);
6184
- C = y.value;
6183
+ if (typeof b.value != "number" || !Number.isFinite(b.value)) throw new Error(`${t.kind}.edit: set needs \`value\`, a number (${T.name}: ${I.description})`);
6184
+ C = b.value;
6185
6185
  } else
6186
- C = y.on === !1 ? I.default ?? I.min ?? 0 : I.max ?? 1;
6187
- i.tween(T.name, p(y.at).values[T.name], C, y, g0);
6186
+ C = b.on === !1 ? I.default ?? I.min ?? 0 : I.max ?? 1;
6187
+ i.tween(T.name, p(b.at).values[T.name], C, b, g0);
6188
6188
  }
6189
6189
  return P;
6190
6190
  },
@@ -6197,7 +6197,7 @@ function ju(e, n = {}) {
6197
6197
  move(O, v) {
6198
6198
  return $.clear(), l.move(O, v), P;
6199
6199
  },
6200
- ride(O, v, y) {
6200
+ ride(O, v, b) {
6201
6201
  const S = [
6202
6202
  ...r.flatMap((T) => Kt(i.keys(T))),
6203
6203
  ...(n.tracks ?? []).flatMap((T) => Kt(T.keyframes.filter((I) => typeof I.value == "number")))
@@ -6207,7 +6207,7 @@ function ju(e, n = {}) {
6207
6207
  const I = m(T, 0);
6208
6208
  return I ? [{ top: I.top, offset: (C) => (m(T, C)?.top ?? I.top) - I.top, windows: S }] : [];
6209
6209
  });
6210
- return Ko(O, v, { ground: y.ground, every: y.every ?? et, floors: w });
6210
+ return Ko(O, v, { ground: b.ground, every: b.every ?? et, floors: w });
6211
6211
  },
6212
6212
  tracks: i.tracks
6213
6213
  };
@@ -6251,12 +6251,12 @@ function Ve(e) {
6251
6251
  ink: h.style === "spoked" ? n.tyre : void 0,
6252
6252
  outline: h.style === "spoked" ? 1.3 : 1
6253
6253
  }), h.style !== "spoked")
6254
- for (const b of p === 0 ? [1, -1] : [p])
6254
+ for (const y of p === 0 ? [1, -1] : [p])
6255
6255
  t.push({
6256
- id: `${g}-hub${p === 0 ? b > 0 ? "-left" : "-right" : ""}`,
6256
+ id: `${g}-hub${p === 0 ? y > 0 ? "-left" : "-right" : ""}`,
6257
6257
  parent: g,
6258
6258
  shape: { type: "cylinder", radius: h.radius * 0.55, length: 0.02, axis: "x", segments: 14, spokes: 5 },
6259
- at: [b * (u / 2 + 0.012), 0, 0],
6259
+ at: [y * (u / 2 + 0.012), 0, 0],
6260
6260
  fill: n.hub,
6261
6261
  outline: 0.6
6262
6262
  });
@@ -6272,9 +6272,9 @@ function Ve(e) {
6272
6272
  if (e.door) {
6273
6273
  const { from: h, to: d, low: f, high: u } = e.door, p = [[h, f], [d, f], [d, u], [h, u]];
6274
6274
  for (const g of [1, -1]) {
6275
- const b = g > 0 ? "left" : "right";
6275
+ const y = g > 0 ? "left" : "right";
6276
6276
  t.push({
6277
- id: `doorway-${b}`,
6277
+ id: `doorway-${y}`,
6278
6278
  shape: { type: "panel", points: p, facing: g > 0 ? "left" : "right" },
6279
6279
  at: [g * (e.width / 2 + 4e-3), 0, 0],
6280
6280
  fill: n.inside,
@@ -6283,13 +6283,13 @@ function Ve(e) {
6283
6283
  });
6284
6284
  const $ = h + (d - h) * 0.15, A = h + (d - h) * 0.55;
6285
6285
  t.push({
6286
- id: `seat-back-${b}`,
6286
+ id: `seat-back-${y}`,
6287
6287
  shape: { type: "panel", points: [[$, f + 0.05], [A, f + 0.05], [A - 0.08, u - 0.06], [$ + 0.06, u - 0.04]], facing: g > 0 ? "left" : "right" },
6288
6288
  at: [g * (e.width / 2 + 6e-3), 0, 0],
6289
6289
  fill: n.seat,
6290
6290
  outline: 0.4
6291
6291
  }), t.push({
6292
- id: `door-${b}`,
6292
+ id: `door-${y}`,
6293
6293
  shape: { type: "panel", points: p.map(([k, m]) => [k - d, m]), facing: g > 0 ? "left" : "right" },
6294
6294
  // The panel's origin is at its hinge (its front edge), just outside the body.
6295
6295
  at: [g * (e.width / 2 + 0.01), 0, d],
@@ -6311,9 +6311,9 @@ function Ve(e) {
6311
6311
  };
6312
6312
  }
6313
6313
  if (e.lights) {
6314
- const { across: h, low: d, high: f, front: u, back: p } = e.lights, g = (e.lights.size ?? 0.32) / 2, b = [[-g, d], [g, d], [g, f], [-g, f]];
6314
+ const { across: h, low: d, high: f, front: u, back: p } = e.lights, g = (e.lights.size ?? 0.32) / 2, y = [[-g, d], [g, d], [g, f], [-g, f]];
6315
6315
  for (const $ of [1, -1])
6316
- t.push({ id: `headlight-${$}`, shape: { type: "panel", points: b, facing: "front" }, at: [$ * h, 0, u], fill: n.light, outline: 0.6, glow: { control: "lights", color: "#ffffff" } }), t.push({ id: `taillight-${$}`, shape: { type: "panel", points: b, facing: "back" }, at: [$ * h, 0, p], fill: Ro(n.tail, 0.62), outline: 0.6, glow: { control: "lights", color: n.tail } });
6316
+ t.push({ id: `headlight-${$}`, shape: { type: "panel", points: y, facing: "front" }, at: [$ * h, 0, u], fill: n.light, outline: 0.6, glow: { control: "lights", color: "#ffffff" } }), t.push({ id: `taillight-${$}`, shape: { type: "panel", points: y, facing: "back" }, at: [$ * h, 0, p], fill: Ro(n.tail, 0.62), outline: 0.6, glow: { control: "lights", color: n.tail } });
6317
6317
  l.lights = { description: "Lights on: 0 off, 1 on", unit: "0..1", min: 0, max: 1 };
6318
6318
  }
6319
6319
  e.antenna && (t.push({ id: "antenna", shape: { type: "tube", points: [[0, 0, 0], [0, 0.75, 0]], radius: 0.018, segments: 5 }, at: e.antenna, fill: n.trim, outline: 0.6 }), t.push({ id: "antenna-tip", parent: "antenna", shape: { type: "ellipsoid", radii: [0.05, 0.05, 0.05], segments: 8 }, at: [0, 0.77, 0], fill: n.tail, outline: 0.6 }), l.antenna = {
@@ -6342,8 +6342,8 @@ function Ve(e) {
6342
6342
  family: "vehicle",
6343
6343
  summary: e.summary ?? "A wheeled vehicle",
6344
6344
  rig: c,
6345
- actions: y0(e),
6346
- acting: b0,
6345
+ actions: b0(e),
6346
+ acting: y0,
6347
6347
  colors: { body: n.body, ink: "#26262b" },
6348
6348
  follow: e.antenna ? [{ control: "antenna", of: "x", per: 0.9, stiffness: 140, damping: 7, limit: 35 }] : void 0,
6349
6349
  wheelRadius: s,
@@ -6364,7 +6364,7 @@ function wr(e) {
6364
6364
  ];
6365
6365
  return { forwardMost: Math.max(...n), backMost: Math.min(...n), top: Math.max(...t) };
6366
6366
  }
6367
- const b0 = {
6367
+ const y0 = {
6368
6368
  depth: { turn: 0, lift: 0, lights: 0, pitch: 1, roll: 1, squash: 1, lean: 1, door: 2 },
6369
6369
  limits: { turn: 0.08, pitch: 5, roll: 4, lean: 0.1, squash: 0.06, door: 0.12, lift: 0 },
6370
6370
  eyes: [],
@@ -6376,7 +6376,7 @@ function nn(e, n, t, o, r, a, s = !1) {
6376
6376
  e.set("wheelSpin", n, l), e.move(n, t, o, { easing: r }), e.set("wheelSpin", t, s ? l : l + c / a * (180 / Math.PI), r);
6377
6377
  }
6378
6378
  const la = 0.4;
6379
- function y0(e) {
6379
+ function b0(e) {
6380
6380
  const n = e.wheels[0]?.radius ?? 0.4, { forwardMost: t, backMost: o } = wr(e), r = (t - o) / 2, a = (i, l, c) => {
6381
6381
  const h = i.exaggeration;
6382
6382
  let d = l;
@@ -6404,8 +6404,8 @@ function y0(e) {
6404
6404
  run(i, l, c) {
6405
6405
  const h = Math.sign(l.to - i.x);
6406
6406
  if (h === 0) return { end: c };
6407
- const d = a(i, c, h), f = i.exaggeration, u = i.x, p = Math.abs(l.to - u), g = l.for ?? Math.max(600, p / (l.speed ?? la * 1.2)), b = d + g * 0.55, $ = u + (l.to - u) * 0.65;
6408
- return i.key(d + 140, { pitch: -1.5 * f, squash: 1 + 0.06 * f, lean: 0.14 * f }, { act: !1, easing: "ease-out" }), nn(i, d, b, $, "ease-in", n), i.key(b + 80, { pitch: -7 * f, lean: -0.12 * f, squash: 0.94 }, { act: !1, easing: "ease-out" }), nn(i, b, d + g, l.to, "ease-out", n, !0), i.effect({ kind: "skid", time: b, x: $, toX: l.to, y: i.floor, length: g * 0.45 + 1500 }), i.effect({ kind: "dust", time: d + g, x: l.to + h * r * i.scale, y: i.floor, length: 600, direction: h }), s(i, d + g, !0), { end: d + g + 380, contact: b, release: d + g };
6407
+ const d = a(i, c, h), f = i.exaggeration, u = i.x, p = Math.abs(l.to - u), g = l.for ?? Math.max(600, p / (l.speed ?? la * 1.2)), y = d + g * 0.55, $ = u + (l.to - u) * 0.65;
6408
+ return i.key(d + 140, { pitch: -1.5 * f, squash: 1 + 0.06 * f, lean: 0.14 * f }, { act: !1, easing: "ease-out" }), nn(i, d, y, $, "ease-in", n), i.key(y + 80, { pitch: -7 * f, lean: -0.12 * f, squash: 0.94 }, { act: !1, easing: "ease-out" }), nn(i, y, d + g, l.to, "ease-out", n, !0), i.effect({ kind: "skid", time: y, x: $, toX: l.to, y: i.floor, length: g * 0.45 + 1500 }), i.effect({ kind: "dust", time: d + g, x: l.to + h * r * i.scale, y: i.floor, length: 600, direction: h }), s(i, d + g, !0), { end: d + g + 380, contact: y, release: d + g };
6409
6409
  }
6410
6410
  },
6411
6411
  bump: {
@@ -6691,7 +6691,7 @@ function I0(e = {}) {
6691
6691
  const n = e.width ?? 4, t = e.depth ?? 3.2, o = e.wallHeight ?? 2.5, r = e.roofHeight ?? 1.5, a = e.overhang ?? 0.25, s = { walls: "#f1d9a8", roof: "#b8433a", door: "#7a4b2a", doorway: "#3a2a22", glass: "#bfe3f2", lit: "#ffd66b", chimney: "#9b5a45", ...e.colors }, i = t / 2 + 0.01, l = e.door?.width ?? 0.9, c = e.door?.height ?? 1.9, h = e.door?.at ?? 0, f = (e.door?.hinge ?? "left") === "left" ? 1 : -1, u = h - f * l / 2, p = -80 * f * ((e.door?.opens ?? "out") === "out" ? 1 : -1), g = e.windows ?? [
6692
6692
  { at: -1.25, low: 1, width: 0.8, height: 0.8 },
6693
6693
  { at: 1.25, low: 1, width: 0.8, height: 0.8 }
6694
- ], b = [
6694
+ ], y = [
6695
6695
  { id: "walls", shape: { type: "box", size: [n, o, t] }, at: [0, o / 2, 0], fill: s.walls },
6696
6696
  {
6697
6697
  id: "roof",
@@ -6706,7 +6706,7 @@ function I0(e = {}) {
6706
6706
  { id: "door", shape: { type: "panel", points: [[0, 0], [f * l, 0], [f * l, c], [0, c]], facing: "front" }, at: [u, 0, i + 5e-3], fill: s.door, outline: 0.8, overRider: !0 }
6707
6707
  ];
6708
6708
  g.forEach((k, m) => {
6709
- b.push({
6709
+ y.push({
6710
6710
  id: `window-${m}`,
6711
6711
  shape: { type: "panel", points: [[-k.width / 2, k.low], [k.width / 2, k.low], [k.width / 2, k.low + k.height], [-k.width / 2, k.low + k.height]], facing: "front" },
6712
6712
  // A centimetre out from the wall, as the side windows are: never in its very plane (a depth buffer can't
@@ -6718,7 +6718,7 @@ function I0(e = {}) {
6718
6718
  });
6719
6719
  });
6720
6720
  for (const k of [1, -1])
6721
- b.push({
6721
+ y.push({
6722
6722
  id: `side-window-${k > 0 ? "left" : "right"}`,
6723
6723
  shape: { type: "panel", points: [[-0.4, 1], [0.4, 1], [0.4, 1.8], [-0.4, 1.8]], facing: k > 0 ? "left" : "right" },
6724
6724
  at: [k * (n / 2 + 0.01), 0, 0],
@@ -6729,10 +6729,10 @@ function I0(e = {}) {
6729
6729
  const $ = e.chimney === !1 ? void 0 : { at: e.chimney?.at ?? n * 0.28, back: e.chimney?.back ?? -t * 0.18 };
6730
6730
  if ($) {
6731
6731
  const k = o + r * (1 - Math.abs($.back) / (t / 2 + a)), m = o + r + 0.45;
6732
- b.push({ id: "chimney", shape: { type: "box", size: [0.42, m - k + 0.3, 0.42] }, at: [$.at, (m + k - 0.3) / 2, $.back], fill: s.chimney, layer: 1 });
6732
+ y.push({ id: "chimney", shape: { type: "box", size: [0.42, m - k + 0.3, 0.42] }, at: [$.at, (m + k - 0.3) / 2, $.back], fill: s.chimney, layer: 1 });
6733
6733
  }
6734
6734
  const A = {
6735
- parts: b,
6735
+ parts: y,
6736
6736
  controls: {
6737
6737
  door: { description: "The front door open: 0 shut, 1 open", unit: "0..1", min: 0, max: 1, bind: [{ parts: ["door"], rotate: { axis: "y", degrees: p } }] },
6738
6738
  lights: { description: "The windows lit: 0 dark, 1 lit", unit: "0..1", min: 0, max: 1 }
@@ -7043,18 +7043,18 @@ function L0(e = {}) {
7043
7043
  // Footrests: a bar in front, low, with two plates.
7044
7044
  { id: "footrest", shape: { type: "box", size: [n * 0.8, 0.02, 0.14] }, at: [0, 0.12, l / 2 + 0.22], fill: a.frame }
7045
7045
  ];
7046
- for (const [g, b] of [[-1, "left"], [1, "right"]]) {
7046
+ for (const [g, y] of [[-1, "left"], [1, "right"]]) {
7047
7047
  const $ = g * d, A = (k, m, P = i) => {
7048
7048
  f.push({ id: k, shape: { type: "tube", points: m, radius: P, segments: 6 }, fill: a.frame, outline: 0.7 });
7049
7049
  };
7050
- A(`post-${b}`, [[$, t - 0.1, -l / 2], [$, c + 0.04, -l / 2], [$, c + 0.04, -l / 2 - 0.14]]), A(`rail-${b}`, [[$, t - 0.03, -l / 2], [$, t - 0.03, l / 2]]), A(`leg-${b}`, [[$, t - 0.03, l / 2], [$ * 0.85, r, l / 2 + 0.06]]), A(`strut-${b}`, [[$ * 0.85, r + 0.08, l / 2 + 0.04], [$ * 0.8, 0.13, l / 2 + 0.22]]), A(`armrest-${b}`, [[$, t + 0.22, -l / 2 + 0.02], [$, t + 0.22, l / 2 - 0.08]], i * 1.3), f.push({
7051
- id: `wheel-${b}`,
7050
+ A(`post-${y}`, [[$, t - 0.1, -l / 2], [$, c + 0.04, -l / 2], [$, c + 0.04, -l / 2 - 0.14]]), A(`rail-${y}`, [[$, t - 0.03, -l / 2], [$, t - 0.03, l / 2]]), A(`leg-${y}`, [[$, t - 0.03, l / 2], [$ * 0.85, r, l / 2 + 0.06]]), A(`strut-${y}`, [[$ * 0.85, r + 0.08, l / 2 + 0.04], [$ * 0.8, 0.13, l / 2 + 0.22]]), A(`armrest-${y}`, [[$, t + 0.22, -l / 2 + 0.02], [$, t + 0.22, l / 2 - 0.08]], i * 1.3), f.push({
7051
+ id: `wheel-${y}`,
7052
7052
  shape: { type: "cylinder", radius: o, length: 0.04, axis: "x", segments: 20, spokes: 8 },
7053
7053
  at: [$ + g * 0.03, o, h],
7054
7054
  ink: a.tyre,
7055
7055
  outline: 1.3
7056
- }), f.push({ id: `rim-${b}`, shape: { type: "cylinder", radius: o * 0.9, length: 0.012, axis: "x", segments: 20 }, at: [g * 0.045, 0, 0], parent: `wheel-${b}`, ink: a.frame, outline: 0.8 }), f.push({
7057
- id: `castor-${b}`,
7056
+ }), f.push({ id: `rim-${y}`, shape: { type: "cylinder", radius: o * 0.9, length: 0.012, axis: "x", segments: 20 }, at: [g * 0.045, 0, 0], parent: `wheel-${y}`, ink: a.frame, outline: 0.8 }), f.push({
7057
+ id: `castor-${y}`,
7058
7058
  shape: { type: "cylinder", radius: r, length: 0.03, axis: "x", segments: 12, spokes: 3 },
7059
7059
  at: [$ * 0.85, r, l / 2 + 0.06],
7060
7060
  fill: a.tyre
@@ -7469,7 +7469,7 @@ function J0(e, n) {
7469
7469
  const Oe = Array.from({ length: 7 }, (e, n) => n === 0 ? "tail" : `tail-${n}`);
7470
7470
  function Z0(e, n, t) {
7471
7471
  const o = Fa(e.tail.points, Oe.length + 1), [, r, a] = e.body.radii, s = (e.tail.at[1] - t) / r, i = Math.abs(s) < 1 ? -a * Math.sqrt(1 - s * s) : e.tail.at[2], l = [e.tail.at[0], e.tail.at[1], i + Math.min(0.04, a * 0.08)], c = (u) => e.tail.radius * (1 - 0.5 * u / Oe.length), h = Oe.map((u, p) => {
7472
- const g = o[p], b = o[p + 1], $ = [b[0] - g[0], b[1] - g[1], b[2] - g[2]], A = p === 0 ? void 0 : o[p - 1];
7472
+ const g = o[p], y = o[p + 1], $ = [y[0] - g[0], y[1] - g[1], y[2] - g[2]], A = p === 0 ? void 0 : o[p - 1];
7473
7473
  return {
7474
7474
  id: u,
7475
7475
  ...p > 0 ? { parent: Oe[p - 1] } : {},
@@ -7558,8 +7558,8 @@ function td(e, n) {
7558
7558
  i.facing() !== h && (d = i.turnTo(d, h > 0 ? "right" : "left"));
7559
7559
  const f = i.exaggeration;
7560
7560
  i.key(d + 180, { neck: -12 * f }, { act: !1, easing: "ease-out" });
7561
- const p = Math.abs(l.to - i.x) / i.scale / Vo(n.legLength, s), g = l.for ?? Math.max(500, p * jn[s].cycle * t), b = i.values.walk ?? 0;
7562
- return i.set("gait", d, i.values.gait ?? 0), i.set("gait", d + 1, Gt.indexOf(s)), i.set("walking", d, 0), i.set("walking", d + 240, 1, "ease-out"), i.set("walking", d + g - 240, 1), i.set("walking", d + g, 0, "ease-in"), i.set("walk", d, b), i.move(d, d + g, l.to, { easing: "ease-in-out" }), i.set("walk", d + g, b + p, "ease-in-out"), i.key(d + g + 300, { neck: 0 }), (s === "gallop" || s === "canter") && (i.effect({ kind: "dust", time: d + 200, x: i.x - h * n.legLength * i.scale, y: i.floor, length: 700, direction: -h }), i.effect({ kind: "dust", time: d + g, x: l.to + h * n.legLength * 0.6 * i.scale, y: i.floor, length: 600, direction: h })), { end: d + g + 300, contact: d, release: d + g };
7561
+ const p = Math.abs(l.to - i.x) / i.scale / Vo(n.legLength, s), g = l.for ?? Math.max(500, p * jn[s].cycle * t), y = i.values.walk ?? 0;
7562
+ return i.set("gait", d, i.values.gait ?? 0), i.set("gait", d + 1, Gt.indexOf(s)), i.set("walking", d, 0), i.set("walking", d + 240, 1, "ease-out"), i.set("walking", d + g - 240, 1), i.set("walking", d + g, 0, "ease-in"), i.set("walk", d, y), i.move(d, d + g, l.to, { easing: "ease-in-out" }), i.set("walk", d + g, y + p, "ease-in-out"), i.key(d + g + 300, { neck: 0 }), (s === "gallop" || s === "canter") && (i.effect({ kind: "dust", time: d + 200, x: i.x - h * n.legLength * i.scale, y: i.floor, length: 700, direction: -h }), i.effect({ kind: "dust", time: d + g, x: l.to + h * n.legLength * 0.6 * i.scale, y: i.floor, length: 600, direction: h })), { end: d + g + 300, contact: d, release: d + g };
7563
7563
  }
7564
7564
  }), r = Object.fromEntries(e.gaits.map((s) => [s === "gallop" && !e.gaits.includes("canter") ? "run" : s, o(s)]));
7565
7565
  e.gaits.includes("gallop") && !r.gallop && (r.gallop = o("gallop"));
@@ -8171,7 +8171,7 @@ function md(e = {}) {
8171
8171
  neckReach: 0.04
8172
8172
  });
8173
8173
  }
8174
- function bd(e = {}) {
8174
+ function yd(e = {}) {
8175
8175
  return lt({
8176
8176
  kind: "owl",
8177
8177
  summary: "An owl: a big round head, slow silent wingbeats; hoots, turns its head, flies and lands on a branch.",
@@ -8187,7 +8187,7 @@ function bd(e = {}) {
8187
8187
  stoop: 6
8188
8188
  });
8189
8189
  }
8190
- function yd(e = {}) {
8190
+ function bd(e = {}) {
8191
8191
  return lt({
8192
8192
  kind: "parrot",
8193
8193
  summary: "A parrot: bright, with a big hooked beak and a long tail; squawks, bobs, flies and lands on a perch, gripping it.",
@@ -8203,7 +8203,7 @@ function yd(e = {}) {
8203
8203
  stoop: 10
8204
8204
  });
8205
8205
  }
8206
- const Dt = { car: w0, truck: k0, bus: v0, tractor: S0, cart: M0, trainCar: $0, bike: E0, motorbike: T0, tree: A0, house: I0, chair: C0, desk: N0, bed: z0, door: K0, wheelchair: L0, helicopter: G0, airplane: U0, horse: nd, dog: od, cat: sd, cow: ad, goat: rd, rabbit: id, squirrel: ld, songbird: fd, crow: ud, chicken: gd, pigeon: pd, duck: md, owl: bd, parrot: yd };
8206
+ const Dt = { car: w0, truck: k0, bus: v0, tractor: S0, cart: M0, trainCar: $0, bike: E0, motorbike: T0, tree: A0, house: I0, chair: C0, desk: N0, bed: z0, door: K0, wheelchair: L0, helicopter: G0, airplane: U0, horse: nd, dog: od, cat: sd, cow: ad, goat: rd, rabbit: id, squirrel: ld, songbird: fd, crow: ud, chicken: gd, pigeon: pd, duck: md, owl: yd, parrot: bd };
8207
8207
  function Er(e, n = {}) {
8208
8208
  const t = Dt[e];
8209
8209
  if (!t) throw new Error(ce("prop preset", e, Object.keys(Dt)));
@@ -8267,15 +8267,15 @@ function vd(e, n, t, o = {}) {
8267
8267
  ${r.map((S) => ` beat ${S.beat}: ${S.message}`).join(`
8268
8268
  `)}`);
8269
8269
  const a = o.from ?? 0, s = o.ground ?? 0, i = o.scale ?? 60, l = o.exaggeration ?? 1, c = Jo(n), h = {};
8270
- for (const S of [...Object.keys(Bt), ...Object.keys(n.rig.controls)]) h[S] = o.start?.[S] ?? ye(n.rig, {}, S);
8270
+ for (const S of [...Object.keys(Bt), ...Object.keys(n.rig.controls)]) h[S] = o.start?.[S] ?? be(n.rig, {}, S);
8271
8271
  const d = [{ time: 0, pose: { ...h } }], f = /* @__PURE__ */ new Map(), u = [];
8272
8272
  let p = a, g = s;
8273
- const b = (S, w, T, I) => {
8273
+ const y = (S, w, T, I) => {
8274
8274
  const C = f.get(S) ?? [{ time: 0, value: S === "x" || S === "y" ? 0 : h[S] }];
8275
8275
  C.push({ time: w, value: T, ...I ? { easing: I } : {} }), f.set(S, C), S !== "x" && S !== "y" && (h[S] = T);
8276
8276
  }, $ = (S, w) => {
8277
8277
  const T = S === "x" ? p - a : S === "y" ? g - s : h[S], I = f.get(S);
8278
- (!I || I[I.length - 1].time < w) && b(S, w, T);
8278
+ (!I || I[I.length - 1].time < w) && y(S, w, T);
8279
8279
  }, A = {
8280
8280
  prop: n,
8281
8281
  scale: i,
@@ -8295,10 +8295,10 @@ ${r.map((S) => ` beat ${S.beat}: ${S.message}`).join(`
8295
8295
  Object.assign(h, w), d.push({ time: S, pose: { ...h }, ...T.act === !1 ? { act: !1 } : {}, ...T.easing ? { easing: T.easing } : {} });
8296
8296
  },
8297
8297
  move(S, w, T, I = {}) {
8298
- $("x", S), b("x", w, T - a, I.easing), p = T, I.floor !== void 0 && ($("y", S), b("y", w, I.floor - s, I.easing), g = I.floor);
8298
+ $("x", S), y("x", w, T - a, I.easing), p = T, I.floor !== void 0 && ($("y", S), y("y", w, I.floor - s, I.easing), g = I.floor);
8299
8299
  },
8300
8300
  set(S, w, T, I) {
8301
- b(S, w, T, I);
8301
+ y(S, w, T, I);
8302
8302
  },
8303
8303
  turnTo(S, w) {
8304
8304
  const T = typeof w == "number" ? w : $o[w], I = h.turn, j = [T - 4, T, T + 4].map((G) => ({ t: G, d: Math.abs(G - I) })).sort((G, Y) => G.d - Y.d || Math.abs(G.t) - Math.abs(Y.t))[0];
@@ -8320,21 +8320,21 @@ ${r.map((S) => ` beat ${S.beat}: ${S.message}`).join(`
8320
8320
  const w = Math.max(S.at ?? m, d[d.length - 1].time), T = c[S.do].run(A, S, w);
8321
8321
  T.end > d[d.length - 1].time && d.push({ time: T.end, pose: { ...h } }), k.push({ start: w, end: T.end, ...T.contact !== void 0 ? { contact: T.contact } : {}, ...T.release !== void 0 ? { release: T.release } : {} }), m = T.end;
8322
8322
  }
8323
- const P = er(o.style ?? "snappy"), O = { ...P, anticipation: P.anticipation * l, overshoot: P.overshoot * l }, v = Fo(Ed(d), n.acting, { style: O }), y = [
8323
+ const P = er(o.style ?? "snappy"), O = { ...P, anticipation: P.anticipation * l, overshoot: P.overshoot * l }, v = Fo(Ed(d), n.acting, { style: O }), b = [
8324
8324
  // Controls keyed exactly (wheels, rotors) are not acted.
8325
8325
  ...Object.entries(v).filter(([S]) => !f.has(S)).map(([S, w]) => ({ id: `${e}-${S}`, target: e, property: S, keyframes: w })),
8326
8326
  ...[...f].map(([S, w]) => ({ id: `${e}-${S}`, target: e, property: S, keyframes: Td(w) }))
8327
8327
  ];
8328
- for (const S of Md(e, n, y, m, d[0].pose)) {
8329
- const w = y.findIndex((C) => C.property === S.property);
8328
+ for (const S of Md(e, n, b, m, d[0].pose)) {
8329
+ const w = b.findIndex((C) => C.property === S.property);
8330
8330
  if (w < 0) {
8331
- y.push(S);
8331
+ b.push(S);
8332
8332
  continue;
8333
8333
  }
8334
- const T = new ve({ id: `${e}-own`, tracks: [y[w]] }), I = (C) => Number(T.getStateAtTime(C).values.get(e)?.get(S.property) ?? 0);
8335
- y[w] = { ...S, keyframes: S.keyframes.map((C) => ({ time: C.time, value: Number(C.value) + I(C.time) })) };
8334
+ const T = new ve({ id: `${e}-own`, tracks: [b[w]] }), I = (C) => Number(T.getStateAtTime(C).values.get(e)?.get(S.property) ?? 0);
8335
+ b[w] = { ...S, keyframes: S.keyframes.map((C) => ({ time: C.time, value: Number(C.value) + I(C.time) })) };
8336
8336
  }
8337
- return { tracks: y, duration: m, beats: k, effects: u };
8337
+ return { tracks: b, duration: m, beats: k, effects: u };
8338
8338
  }
8339
8339
  const Sd = 1500;
8340
8340
  function Md(e, n, t, o, r) {
@@ -8382,7 +8382,7 @@ function Pd(e, n = {}) {
8382
8382
  const t = {};
8383
8383
  for (const o of Object.keys(De)) t[o] = { summary: `Walks to \`to\` in the ${o} gait.`, needs: ["to"] };
8384
8384
  for (const o of Object.keys(He)) t[o] = { summary: `Moves into the ${o} pose and holds it (\`for\` ms).` };
8385
- for (const o of Object.keys(ot)) t[o] = { summary: `The ${o} gag (${yn(o)} ms).` };
8385
+ for (const o of Object.keys(ot)) t[o] = { summary: `The ${o} gag (${bn(o)} ms).` };
8386
8386
  for (const [o, r] of Object.entries(Pn)) t[o] = { ...r };
8387
8387
  return {
8388
8388
  sports: { cricket: { actions: { ...oi }, formats: { ...ni }, casts: { ...ti }, fieldingPositions: { ...ei }, markingProfiles: { ...Qr }, cameras: { ...Zr }, decisionCameras: Jr, playComponents: Vr, playExamples: Xr } },
@@ -8412,9 +8412,9 @@ function Pd(e, n = {}) {
8412
8412
  handFields: Gr,
8413
8413
  poses: Object.keys(He),
8414
8414
  expressions: Object.keys(Ae),
8415
- gags: Object.fromEntries(Object.keys(ot).map((o) => [o, yn(o)])),
8415
+ gags: Object.fromEntries(Object.keys(ot).map((o) => [o, bn(o)])),
8416
8416
  gaits: Object.keys(De),
8417
- actingStyles: Object.keys(yt),
8417
+ actingStyles: Object.keys(bt),
8418
8418
  beatFields: mo,
8419
8419
  actions: t,
8420
8420
  dances: Object.fromEntries(Object.entries(at).map(([o, r]) => [o, Object.keys(r.moves)])),
@@ -8503,7 +8503,7 @@ function Pd(e, n = {}) {
8503
8503
  feet: [...qr],
8504
8504
  cast: Object.keys(Qa),
8505
8505
  heldItems: Object.fromEntries(Object.entries(si).map(([o, r]) => [o, r.hands])),
8506
- handMeetings: Object.keys(bn)
8506
+ handMeetings: Object.keys(yn)
8507
8507
  },
8508
8508
  noir: Kc,
8509
8509
  cosmic: Uc,
@@ -8605,7 +8605,8 @@ function Pd(e, n = {}) {
8605
8605
  "tinyfly check <beats.json>": "check a beat script (names, fields) with suggestions",
8606
8606
  "tinyfly validate <timeline.json> [--markup file]": "check a timeline against its markup",
8607
8607
  "tinyfly render <timeline.json> <markup> [--at …]": "a frame as static markup",
8608
- "tinyfly video <scene.mjs> [--stills dir --times …]": "MP4, or PNG stills to look at"
8608
+ "tinyfly video <scene.mjs> [--stills dir --times …]": "MP4, or PNG stills to look at",
8609
+ "tinyfly present <deck.html> [-o out.html]": "a presentation as one offline HTML file"
8609
8610
  }
8610
8611
  };
8611
8612
  }
@@ -8859,8 +8860,8 @@ function Id(e, n, t, o, r, a, s) {
8859
8860
  const i = n.direction ?? 1, l = n.toY ?? n.y + o * 3;
8860
8861
  e.save(), e.lineWidth = Math.max(1, o * 0.02), e.strokeStyle = a, e.fillStyle = r;
8861
8862
  for (let c = 0; c < 4; c++) {
8862
- const h = Xe(`${s}:${c}`) % 1e3 / 1e3, d = Math.min(1, t * (1.1 + h * 0.4)), f = n.x + (h - 0.5) * o * 1.2, u = n.y + (h - 0.3) * o * 0.4, p = d * d * 0.4 + d * 0.6, g = f + i * d * o * (0.6 + h) + Math.sin(d * 9 + h * 6) * o * 0.18, b = Math.min(l - 2, u + (l - u) * p);
8863
- e.globalAlpha = t > 0.85 ? (1 - t) / 0.15 : 1, e.save(), e.translate(g, b), e.rotate(Math.sin(d * 7 + h * 5) * 1.2), e.beginPath(), e.ellipse(0, 0, o * 0.07, o * 0.035, 0, 0, Math.PI * 2), e.fill(), e.stroke(), e.restore();
8863
+ const h = Xe(`${s}:${c}`) % 1e3 / 1e3, d = Math.min(1, t * (1.1 + h * 0.4)), f = n.x + (h - 0.5) * o * 1.2, u = n.y + (h - 0.3) * o * 0.4, p = d * d * 0.4 + d * 0.6, g = f + i * d * o * (0.6 + h) + Math.sin(d * 9 + h * 6) * o * 0.18, y = Math.min(l - 2, u + (l - u) * p);
8864
+ e.globalAlpha = t > 0.85 ? (1 - t) / 0.15 : 1, e.save(), e.translate(g, y), e.rotate(Math.sin(d * 7 + h * 5) * 1.2), e.beginPath(), e.ellipse(0, 0, o * 0.07, o * 0.035, 0, 0, Math.PI * 2), e.fill(), e.stroke(), e.restore();
8864
8865
  }
8865
8866
  e.restore();
8866
8867
  }
@@ -8929,14 +8930,14 @@ function Ku(e) {
8929
8930
  const n = new ve({ id: `${e.leaderId}-tow`, tracks: e.leaderTracks.filter((u) => u.target === e.leaderId) }), t = e.every ?? 33, o = e.towed, r = o.x + o.width / 2, a = o.props, s = o.prop.wheelRadius, i = [], l = [], c = [];
8930
8931
  let h = a.wheelSpin ?? 0, d;
8931
8932
  for (let u = e.start; ; u = Math.min(e.end, u + t)) {
8932
- const p = Xo(e.leader, { state: n.getStateAtTime(u) }, e.leaderId), g = p.anchor(e.hitch), b = p.values.turn, $ = qt(o.prop, { ...a, turn: b }, o.propScale).anchors[e.anchor];
8933
+ const p = Xo(e.leader, { state: n.getStateAtTime(u) }, e.leaderId), g = p.anchor(e.hitch), y = p.values.turn, $ = qt(o.prop, { ...a, turn: y }, o.propScale).anchors[e.anchor];
8933
8934
  if (!$) throw new Error(`propTow: ${o.prop.kind} has no anchor "${e.anchor}"`);
8934
8935
  const A = g.x - $.point.x;
8935
8936
  if (d !== void 0 && s) {
8936
- const k = Math.sin(b * Math.PI / 2);
8937
+ const k = Math.sin(y * Math.PI / 2);
8937
8938
  h += (A - d) * (k || 1) / o.propScale / s * (180 / Math.PI);
8938
8939
  }
8939
- if (d = A, i.push({ time: u, value: A - r }), l.push({ time: u, value: b }), c.push({ time: u, value: h }), u >= e.end) break;
8940
+ if (d = A, i.push({ time: u, value: A - r }), l.push({ time: u, value: y }), c.push({ time: u, value: h }), u >= e.end) break;
8940
8941
  }
8941
8942
  const f = e.towedId;
8942
8943
  return [
@@ -8954,11 +8955,11 @@ function xd(e, n) {
8954
8955
  if (r) return r;
8955
8956
  const a = kn(e), s = { vertices: a.vertices, faces: a.faces.filter((f, u) => !n?.[u]) }, i = s.vertices.flatMap((f) => [f[0], f[1], f[2]]), l = s.vertices.map(() => [0, 0, 0]), c = [];
8956
8957
  s.faces.forEach((f) => {
8957
- for (const g of f.corners) for (const b of [0, 1, 2]) l[g][b] += f.normal[b];
8958
+ for (const g of f.corners) for (const y of [0, 1, 2]) l[g][y] += f.normal[y];
8958
8959
  const [u, ...p] = f.corners;
8959
8960
  for (let g = 0; g + 1 < p.length; g++) {
8960
- const [b, $, A] = [u, p[g], p[g + 1]], [k, m, P] = [s.vertices[b], s.vertices[$], s.vertices[A]], O = [m[0] - k[0], m[1] - k[1], m[2] - k[2]], v = [P[0] - k[0], P[1] - k[1], P[2] - k[2]], y = [O[1] * v[2] - O[2] * v[1], O[2] * v[0] - O[0] * v[2], O[0] * v[1] - O[1] * v[0]], S = y[0] * f.normal[0] + y[1] * f.normal[1] + y[2] * f.normal[2];
8961
- c.push(...S >= 0 ? [b, $, A] : [b, A, $]);
8961
+ const [y, $, A] = [u, p[g], p[g + 1]], [k, m, P] = [s.vertices[y], s.vertices[$], s.vertices[A]], O = [m[0] - k[0], m[1] - k[1], m[2] - k[2]], v = [P[0] - k[0], P[1] - k[1], P[2] - k[2]], b = [O[1] * v[2] - O[2] * v[1], O[2] * v[0] - O[0] * v[2], O[0] * v[1] - O[1] * v[0]], S = b[0] * f.normal[0] + b[1] * f.normal[1] + b[2] * f.normal[2];
8962
+ c.push(...S >= 0 ? [y, $, A] : [y, A, $]);
8962
8963
  }
8963
8964
  });
8964
8965
  const h = l.flatMap((f) => {
@@ -8986,7 +8987,7 @@ function Rd(e, n) {
8986
8987
  }
8987
8988
  const zd = cn(Ea(1, 2e-3, 28));
8988
8989
  function Wd(e, n, t) {
8989
- const o = e.rig, [r, a] = o.footprint ?? [o.length * 0.45, o.length], s = Math.max(0, ye(o, n, "lift")), i = Math.max(0, ye(o, n, "size")) / (1 + s * 0.8);
8990
+ const o = e.rig, [r, a] = o.footprint ?? [o.length * 0.45, o.length], s = Math.max(0, be(o, n, "lift")), i = Math.max(0, be(o, n, "size")) / (1 + s * 0.8);
8990
8991
  return {
8991
8992
  mesh: zd,
8992
8993
  world: oe.multiply(t, oe.compose([0, 4e-3, 0], [0, 0, 0, 1], [r * 0.55 * i || 1e-4, 1, a * 0.55 * i || 1e-4])),
@@ -9024,8 +9025,8 @@ const Kd = /* @__PURE__ */ new Set([
9024
9025
  // `lights` may be missing from a scene entry older than this add-on: treated as none.
9025
9026
  resolve({ object: e, prepared: n, values: t, world: o, camera: r, lights: a = [], fog: s, toScreen: i }) {
9026
9027
  const l = e, c = n, h = { ...l.values };
9027
- for (const [v, y] of t)
9028
- typeof y == "number" && !Kd.has(v) && (h[v] = y);
9028
+ for (const [v, b] of t)
9029
+ typeof b == "number" && !Kd.has(v) && (h[v] = b);
9029
9030
  h.turn = 0, h.tilt = 0;
9030
9031
  const d = oe.multiply(r.view, o), f = {
9031
9032
  toView: (v) => oe.transformPoint(d, v),
@@ -9033,24 +9034,24 @@ const Kd = /* @__PURE__ */ new Set([
9033
9034
  }, u = f.toView([0, c.rig.height / 2, 0]);
9034
9035
  if (-u[2] <= r.near) return null;
9035
9036
  if (l.look === "mesh") {
9036
- const v = l0(c.rig, h), y = v.map(({ part: T, local: I }) => ({ part: T.id, mesh: kn(T.shape), ...Yo(kn(T.shape), I) })), S = gr(y), w = v.map((T, I) => ({ ...T, hidden: pr(T.part.id, y[I].mesh, T.local, y[I].key, S) })).filter(({ opacity: T }) => T > 0.01).map(({ part: T, matrix: I, glow: C, opacity: j, hidden: W }) => ({
9037
+ const v = l0(c.rig, h), b = v.map(({ part: T, local: I }) => ({ part: T.id, mesh: kn(T.shape), ...Yo(kn(T.shape), I) })), S = gr(b), w = v.map((T, I) => ({ ...T, hidden: pr(T.part.id, b[I].mesh, T.local, b[I].key, S) })).filter(({ opacity: T }) => T > 0.01).map(({ part: T, matrix: I, glow: C, opacity: j, hidden: W }) => ({
9037
9038
  mesh: xd(T.shape, W),
9038
9039
  world: oe.multiply(o, I),
9039
9040
  material: Nd(T, { glow: C, opacity: j }, { shading: l.shading, ink: l.ink, outline: l.outline })
9040
9041
  }));
9041
9042
  return { meshes: l.shadow === !1 ? w : [Wd(c, h, o), ...w] };
9042
9043
  }
9043
- const p = i(u), g = i(f.toView([0, c.rig.height / 2 + 1, 0])), b = Math.hypot(g.x - p.x, g.y - p.y), $ = a.length === 0 ? void 0 : (v, y) => {
9044
- const S = oe.transformPoint(o, v), w = [o[0] * y[0] + o[4] * y[1] + o[8] * y[2], o[1] * y[0] + o[5] * y[1] + o[9] * y[2], o[2] * y[0] + o[6] * y[1] + o[10] * y[2]], T = Math.hypot(...w) || 1;
9044
+ const p = i(u), g = i(f.toView([0, c.rig.height / 2 + 1, 0])), y = Math.hypot(g.x - p.x, g.y - p.y), $ = a.length === 0 ? void 0 : (v, b) => {
9045
+ const S = oe.transformPoint(o, v), w = [o[0] * b[0] + o[4] * b[1] + o[8] * b[2], o[1] * b[0] + o[5] * b[1] + o[9] * b[2], o[2] * b[0] + o[6] * b[1] + o[10] * b[2]], T = Math.hypot(...w) || 1;
9045
9046
  return { light: Ta(S, [w[0] / T, w[1] / T, w[2] / T], a), fog: Aa(s, Math.hypot(S[0] - r.position[0], S[1] - r.position[1], S[2] - r.position[2])) };
9046
- }, A = mr(c.rig, h, f, b, { perspective: !0, near: r.near, slice: Fd, light: $ }), k = { look: l.look, style: l.style, ink: l.ink, paper: l.paper, fog: s?.color }, m = xa(A), P = A.cells ?? [], O = Math.max(...P.map((v) => -v.depth), -u[2]);
9047
+ }, A = mr(c.rig, h, f, y, { perspective: !0, near: r.near, slice: Fd, light: $ }), k = { look: l.look, style: l.style, ink: l.ink, paper: l.paper, fog: s?.color }, m = xa(A), P = A.cells ?? [], O = Math.max(...P.map((v) => -v.depth), -u[2]);
9047
9048
  return {
9048
9049
  drawables: [
9049
9050
  ...l.shadow === !1 ? [] : [{ depth: O + c.rig.length, draw: (v) => Na(v, A, k) }],
9050
9051
  ...P.map((v) => ({
9051
9052
  depth: -v.depth,
9052
- draw(y, S) {
9053
- y.lineCap = "round", y.lineJoin = "round", nl(y, v.parts, m, { ...k, time: S.time });
9053
+ draw(b, S) {
9054
+ b.lineCap = "round", b.lineJoin = "round", nl(b, v.parts, m, { ...k, time: S.time });
9054
9055
  }
9055
9056
  }))
9056
9057
  ]
@@ -9082,7 +9083,7 @@ function Du(e, n, t, o) {
9082
9083
  ${r.map((k) => ` beat ${k.beat}: ${k.message}`).join(`
9083
9084
  `)}`);
9084
9085
  const a = {};
9085
- for (const k of [...Object.keys(Bt), ...Object.keys(n.rig.controls)]) a[k] = o.values?.[k] ?? ye(n.rig, {}, k);
9086
+ for (const k of [...Object.keys(Bt), ...Object.keys(n.rig.controls)]) a[k] = o.values?.[k] ?? be(n.rig, {}, k);
9086
9087
  let [s, i] = o.position ?? [0, 0], l = o.heading ?? 0;
9087
9088
  const c = /* @__PURE__ */ new Map(), h = (k, m, P, O = "linear") => {
9088
9089
  const v = c.get(k) ?? [];
@@ -9097,7 +9098,7 @@ ${r.map((k) => ` beat ${k.beat}: ${k.message}`).join(`
9097
9098
  }, u = (k, m, P) => {
9098
9099
  const O = La([[s, i], ...m.through ?? [m.to]]);
9099
9100
  if (O.length < 2) return P;
9100
- const v = f(P, bt(O[0].point, O[1].point)), y = O[O.length - 1].at, S = m.for ?? y / (m.speed ?? k.speed) * 1e3, w = Et("ease-in-out"), T = Math.min(qd, S / 4);
9101
+ const v = f(P, yt(O[0].point, O[1].point)), b = O[O.length - 1].at, S = m.for ?? b / (m.speed ?? k.speed) * 1e3, w = Et("ease-in-out"), T = Math.min(qd, S / 4);
9101
9102
  for (const [Y, ne] of Object.entries(k.set ?? {}))
9102
9103
  d(Y, v, a[Y]), h(Y, v + 1, ne), a[Y] = ne;
9103
9104
  const I = k.flies ? m.height ?? (a.lift > 0.05 ? a.lift : 2) : void 0, C = I !== void 0 && I > 0.05;
@@ -9106,35 +9107,35 @@ ${r.map((k) => ` beat ${k.beat}: ${k.message}`).join(`
9106
9107
  I !== void 0 && (d("lift", v, a.lift), h("lift", v + Math.min(S * 0.35, 1400), I, "ease-out"), h("lift", v + S, I), a.lift = I);
9107
9108
  const j = { ...a };
9108
9109
  let W = l;
9109
- for (let Y = 0; ; Y = Math.min(y, Y + Dd)) {
9110
- const ne = v + qa(w, Y / y) * S, { point: B, direction: H } = Ba(O, Y);
9111
- W += pn(W, bt([0, 0], H)), h("x", ne, B[0]), h("z", ne, B[1]), h("rotateY", ne, W);
9110
+ for (let Y = 0; ; Y = Math.min(b, Y + Dd)) {
9111
+ const ne = v + qa(w, Y / b) * S, { point: B, direction: H } = Ba(O, Y);
9112
+ W += pn(W, yt([0, 0], H)), h("x", ne, B[0]), h("z", ne, B[1]), h("rotateY", ne, W);
9112
9113
  for (const [N, R] of Object.entries(k.perMetre ?? {})) h(N, ne, j[N] + Y * R);
9113
9114
  for (const [N, R] of Object.entries(k.perSecond ?? {})) h(N, ne, j[N] + (ne - v) / 1e3 * R);
9114
- if (Y >= y) break;
9115
+ if (Y >= b) break;
9115
9116
  }
9116
- for (const [Y, ne] of Object.entries(k.perMetre ?? {})) a[Y] = j[Y] + y * ne;
9117
+ for (const [Y, ne] of Object.entries(k.perMetre ?? {})) a[Y] = j[Y] + b * ne;
9117
9118
  for (const [Y, ne] of Object.entries(k.perSecond ?? {})) a[Y] = j[Y] + S / 1e3 * ne;
9118
9119
  return [s, i] = O[O.length - 1].point, l = W, v + S;
9119
9120
  }, p = (k, m) => {
9120
9121
  const P = Object.fromEntries(Object.entries(k).filter(([v]) => !["at", "to", "through", "toward"].includes(v))), O = vd(e, n, [P], { start: { ...a, turn: 1 }, scale: 100, style: o.style, exaggeration: o.exaggeration });
9121
9122
  for (const v of O.tracks) {
9122
9123
  if (Xd.includes(v.property)) continue;
9123
- const y = v.keyframes ?? [], S = a[v.property];
9124
- if (!y.every((w) => w.value === S)) {
9124
+ const b = v.keyframes ?? [], S = a[v.property];
9125
+ if (!b.every((w) => w.value === S)) {
9125
9126
  d(v.property, m, S);
9126
- for (const w of y) w.time > 0 && c.get(v.property).push({ ...w, time: m + w.time });
9127
- a[v.property] = y[y.length - 1].value;
9127
+ for (const w of b) w.time > 0 && c.get(v.property).push({ ...w, time: m + w.time });
9128
+ a[v.property] = b[b.length - 1].value;
9128
9129
  }
9129
9130
  }
9130
9131
  return m + O.duration;
9131
9132
  }, g = [];
9132
- let b = 0;
9133
+ let y = 0;
9133
9134
  for (const k of t) {
9134
- const m = k.at ?? b;
9135
+ const m = k.at ?? y;
9135
9136
  let P = m;
9136
9137
  const O = n.moves?.[k.do];
9137
- O ? P = u(O, k, m) : k.do === "face" ? P = f(m, typeof k.toward == "number" ? k.toward : bt([s, i], k.toward)) : k.do === "hold" ? P = m + (k.for ?? 1e3) : P = p(k, m), g.push({ do: k.do, start: m, end: P }), b = P;
9138
+ O ? P = u(O, k, m) : k.do === "face" ? P = f(m, typeof k.toward == "number" ? k.toward : yt([s, i], k.toward)) : k.do === "hold" ? P = m + (k.for ?? 1e3) : P = p(k, m), g.push({ do: k.do, start: m, end: P }), y = P;
9138
9139
  }
9139
9140
  const $ = `${o.scene}/${e}`;
9140
9141
  return { tracks: [...c].map(([k, m]) => ({
@@ -9142,7 +9143,7 @@ ${r.map((k) => ` beat ${k.beat}: ${k.message}`).join(`
9142
9143
  target: $,
9143
9144
  property: k,
9144
9145
  keyframes: Da(m)
9145
- })), duration: b, beats: g, end: { position: [s, i], heading: l, values: { ...a } } };
9146
+ })), duration: y, beats: g, end: { position: [s, i], heading: l, values: { ...a } } };
9146
9147
  }
9147
9148
  const Xd = ["x", "y", "turn", "facing", "tilt"], Vd = 0.35, Ar = {
9148
9149
  seated: Fe.sit,
@@ -9179,26 +9180,26 @@ const ma = (e, n) => {
9179
9180
  return [e[0] * Math.cos(t) + e[2] * Math.sin(t), e[1], -e[0] * Math.sin(t) + e[2] * Math.cos(t)];
9180
9181
  };
9181
9182
  function Bu(e) {
9182
- const n = `${e.scene}/${e.propId}`, t = new ve({ id: `${e.propId}-ride-3d`, tracks: e.propTracks.filter((b) => b.target === n) }), o = e.placement ?? {}, [r, a, s] = o.position ?? [0, 0, 0], i = e.prop.rig, l = Ao({ ...e.character, height: 1 }), c = { ...be, ...e.pose ?? Ar.seated }, h = To(l.plan, c, { height: e.height ?? 1.7, contact: l.contact }).hip, d = e.facing ?? 0, f = e.every ?? 33, u = { x: [], y: [], z: [], rotateY: [] };
9183
- for (let b = e.start; ; b = Math.min(e.end, b + f)) {
9184
- const $ = t.getStateAtTime(b).values.get(n) ?? /* @__PURE__ */ new Map(), A = (j, W) => {
9183
+ const n = `${e.scene}/${e.propId}`, t = new ve({ id: `${e.propId}-ride-3d`, tracks: e.propTracks.filter((y) => y.target === n) }), o = e.placement ?? {}, [r, a, s] = o.position ?? [0, 0, 0], i = e.prop.rig, l = Ao({ ...e.character, height: 1 }), c = { ...ye, ...e.pose ?? Ar.seated }, h = To(l.plan, c, { height: e.height ?? 1.7, contact: l.contact }).hip, d = e.facing ?? 0, f = e.every ?? 33, u = { x: [], y: [], z: [], rotateY: [] };
9184
+ for (let y = e.start; ; y = Math.min(e.end, y + f)) {
9185
+ const $ = t.getStateAtTime(y).values.get(n) ?? /* @__PURE__ */ new Map(), A = (j, W) => {
9185
9186
  const G = $.get(j);
9186
9187
  return typeof G == "number" ? G : W;
9187
9188
  }, k = { ...o.values };
9188
- for (const j of Object.keys(i.controls)) k[j] = A(j, o.values?.[j] ?? ye(i, {}, j));
9189
- for (const j of ["pitch", "roll", "squash", "lift", "lean", "size"]) k[j] = A(j, o.values?.[j] ?? ye(i, {}, j));
9189
+ for (const j of Object.keys(i.controls)) k[j] = A(j, o.values?.[j] ?? be(i, {}, j));
9190
+ for (const j of ["pitch", "roll", "squash", "lift", "lean", "size"]) k[j] = A(j, o.values?.[j] ?? be(i, {}, j));
9190
9191
  const m = h0(i, k)[e.anchor];
9191
9192
  if (!m) throw new Error(`propRide3D: ${e.prop.kind} has no anchor "${e.anchor}" (it has ${Object.keys(i.anchors ?? {}).join(", ") || "none"})`);
9192
- const P = A("rotateY", o.heading ?? 0), O = ma(m, P), v = [A("x", r) + O[0], A("y", a) + O[1], A("z", s) + O[2]], y = P + d, S = ma(h, y);
9193
+ const P = A("rotateY", o.heading ?? 0), O = ma(m, P), v = [A("x", r) + O[0], A("y", a) + O[1], A("z", s) + O[2]], b = P + d, S = ma(h, b);
9193
9194
  let w = [v[0] - S[0], v[1] - S[1], v[2] - S[2]];
9194
9195
  const T = (j, W) => {
9195
9196
  const G = W * W * (3 - 2 * W);
9196
9197
  return [j[0] + (w[0] - j[0]) * G, w[1] * G + Vd * Math.sin(Math.PI * W), j[1] + (w[2] - j[1]) * G];
9197
9198
  }, I = e.mount ? Math.max(1, e.mount.for ?? 450) : 0, C = e.dismount ? Math.max(1, e.dismount.for ?? 450) : 0;
9198
- if (e.mount && b < e.start + I ? w = T(e.mount.from, (b - e.start) / I) : e.dismount && b > e.end - C && (w = T(e.dismount.to, (e.end - b) / C)), u.x.push({ time: b, value: w[0] }), u.y.push({ time: b, value: w[1] }), u.z.push({ time: b, value: w[2] }), u.rotateY.push({ time: b, value: y }), b >= e.end) break;
9199
+ if (e.mount && y < e.start + I ? w = T(e.mount.from, (y - e.start) / I) : e.dismount && y > e.end - C && (w = T(e.dismount.to, (e.end - y) / C)), u.x.push({ time: y, value: w[0] }), u.y.push({ time: y, value: w[1] }), u.z.push({ time: y, value: w[2] }), u.rotateY.push({ time: y, value: b }), y >= e.end) break;
9199
9200
  }
9200
9201
  const p = e.riderId, g = `${e.scene}/${p}`;
9201
- return Object.keys(u).map((b) => ({ id: `${p}-${b}`, target: g, property: b, keyframes: u[b] }));
9202
+ return Object.keys(u).map((y) => ({ id: `${p}-${y}`, target: g, property: y, keyframes: u[y] }));
9202
9203
  }
9203
9204
  const Zd = {
9204
9205
  ground: "#7fb56a",
@@ -9246,7 +9247,7 @@ const tf = (e, n) => {
9246
9247
  return t <= 12 ? t / 12 : -1;
9247
9248
  }, nf = 9, of = 55, sf = 28;
9248
9249
  function af(e) {
9249
- const { x: n, y: t, width: o, height: r } = e, a = e.kind ?? "sky", s = e.ground ?? t + r * 0.85, i = { ...Zd, ...e.colors }, l = e.horizon ?? "hills", c = e.window !== !1, h = Tt(e.seed ?? 1), d = o * r / 1e5, f = Array.from({ length: Math.ceil(nf * d) + 2 }, () => ({ u: h.next(), v: h.next(), size: 0.6 + h.next() * 0.8, puffs: 2 + Math.floor(h.next() * 3) })), u = Array.from({ length: Math.ceil(of * d) + 4 }, () => ({ u: h.next(), v: h.next(), speed: 0.8 + h.next() * 0.5 })), p = Array.from({ length: Math.ceil(sf * d) + 4 }, () => ({ u: h.next(), v: h.next(), speed: 0.7 + h.next() * 0.6, sway: h.next() * Math.PI * 2, size: 1.5 + h.next() * 2 })), g = Array.from({ length: Math.ceil(30 * d) + 10 }, () => ({ u: h.next(), v: h.next() * 0.6, size: 0.6 + h.next() * 1.2 })), b = Array.from({ length: 6 }, () => ({ phase: h.next() * Math.PI * 2, amp: 0.5 + h.next() })), $ = Array.from({ length: 24 }, () => ({ h: 0.35 + h.next() * 0.65, w: 0.6 + h.next() * 0.8, windows: h.next() > 0.3 })), A = {
9250
+ const { x: n, y: t, width: o, height: r } = e, a = e.kind ?? "sky", s = e.ground ?? t + r * 0.85, i = { ...Zd, ...e.colors }, l = e.horizon ?? "hills", c = e.window !== !1, h = Tt(e.seed ?? 1), d = o * r / 1e5, f = Array.from({ length: Math.ceil(nf * d) + 2 }, () => ({ u: h.next(), v: h.next(), size: 0.6 + h.next() * 0.8, puffs: 2 + Math.floor(h.next() * 3) })), u = Array.from({ length: Math.ceil(of * d) + 4 }, () => ({ u: h.next(), v: h.next(), speed: 0.8 + h.next() * 0.5 })), p = Array.from({ length: Math.ceil(sf * d) + 4 }, () => ({ u: h.next(), v: h.next(), speed: 0.7 + h.next() * 0.6, sway: h.next() * Math.PI * 2, size: 1.5 + h.next() * 2 })), g = Array.from({ length: Math.ceil(30 * d) + 10 }, () => ({ u: h.next(), v: h.next() * 0.6, size: 0.6 + h.next() * 1.2 })), y = Array.from({ length: 6 }, () => ({ phase: h.next() * Math.PI * 2, amp: 0.5 + h.next() })), $ = Array.from({ length: 24 }, () => ({ h: 0.35 + h.next() * 0.65, w: 0.6 + h.next() * 0.8, windows: h.next() > 0.3 })), A = {
9250
9251
  hour: e.hour ?? 12,
9251
9252
  clouds: e.clouds ?? 0.3,
9252
9253
  wind: e.wind ?? 0,
@@ -9285,7 +9286,7 @@ function af(e) {
9285
9286
  for (let Q = 0; Q <= F; Q++) {
9286
9287
  const ae = Q / F;
9287
9288
  let x = 0;
9288
- b.forEach((X, D) => x += Math.sin(ae * Math.PI * (1.5 + D * 0.7) + X.phase) * X.amp), w.lineTo(C.x + ae * C.w, C.ground - Math.max(0, x) * C.h * 0.045 - C.h * 0.03);
9289
+ y.forEach((X, D) => x += Math.sin(ae * Math.PI * (1.5 + D * 0.7) + X.phase) * X.amp), w.lineTo(C.x + ae * C.w, C.ground - Math.max(0, x) * C.h * 0.045 - C.h * 0.03);
9289
9290
  }
9290
9291
  w.lineTo(C.x + C.w, C.ground), w.closePath(), w.fill();
9291
9292
  } else if (l === "city") {
@@ -9418,7 +9419,7 @@ function qu(e, n) {
9418
9419
  return { scenery: o, props: a, ground: o.ground };
9419
9420
  }
9420
9421
  export {
9421
- yt as ACTING_STYLES,
9422
+ bt as ACTING_STYLES,
9422
9423
  vr as AIRCRAFT_ACTING,
9423
9424
  Gt as ANIMAL_GAITS,
9424
9425
  lh as ANIME_CAST,
@@ -9436,8 +9437,8 @@ export {
9436
9437
  Vt as BOARD_THEMES,
9437
9438
  di as BODY_SHAPES,
9438
9439
  pi as CANVAS_PROPERTIES,
9439
- bo as CASE_CARD_KINDS,
9440
- yo as CASE_MARK_KINDS,
9440
+ yo as CASE_CARD_KINDS,
9441
+ bo as CASE_MARK_KINDS,
9441
9442
  _0 as CHAIR_ACTING,
9442
9443
  ps as CHARACTER_BEAT_3D_FIELDS,
9443
9444
  Qa as CHARACTER_CAST,
@@ -9467,7 +9468,7 @@ export {
9467
9468
  We as HAIR_COLORS,
9468
9469
  eg as HAIR_STILL,
9469
9470
  li as HAIR_STYLES,
9470
- bn as HAND_MEETINGS,
9471
+ yn as HAND_MEETINGS,
9471
9472
  _e as HAND_REST,
9472
9473
  we as HAND_SHAPES,
9473
9474
  ai as HAT_STYLES,
@@ -9483,7 +9484,7 @@ export {
9483
9484
  ci as HUMAN_EXPRESSIONS,
9484
9485
  ka as HUMAN_GAGS,
9485
9486
  Fe as HUMAN_POSES,
9486
- be as HUMAN_REST,
9487
+ ye as HUMAN_REST,
9487
9488
  Ep as IDENTITY_CAMERA,
9488
9489
  hh as MANGA_CAST,
9489
9490
  io as MUDRAS,
@@ -9510,7 +9511,7 @@ export {
9510
9511
  og as SOFT_CARTOON_CAST,
9511
9512
  Ph as STICK_ACTING_RIG,
9512
9513
  P0 as TREE_ACTING,
9513
- b0 as VEHICLE_ACTING,
9514
+ y0 as VEHICLE_ACTING,
9514
9515
  Ze as VISEMES,
9515
9516
  B0 as WHEELCHAIR_ACTING,
9516
9517
  Be as WHITEBOARD_SURFACE,
@@ -9535,7 +9536,7 @@ export {
9535
9536
  cg as beanStanding,
9536
9537
  dg as beanTorso,
9537
9538
  fg as beanTorsoOutline,
9538
- bf as beatAt,
9539
+ yf as beatAt,
9539
9540
  z0 as bed,
9540
9541
  E0 as bike,
9541
9542
  lt as bird,
@@ -9543,7 +9544,7 @@ export {
9543
9544
  ug as bodyProfileWidth,
9544
9545
  gg as bodyShapeProfiles,
9545
9546
  Mp as boilFrame,
9546
- bl as boxMesh,
9547
+ yl as boxMesh,
9547
9548
  pg as brushingPose,
9548
9549
  qu as buildScene,
9549
9550
  v0 as bus,
@@ -9565,9 +9566,9 @@ export {
9565
9566
  Kt as changingWindows,
9566
9567
  Ao as character,
9567
9568
  mg as characterAt,
9568
- bg as characterHandPose,
9569
+ yg as characterHandPose,
9569
9570
  Ne as characterJoints,
9570
- yg as characterJointsInView,
9571
+ bg as characterJointsInView,
9571
9572
  Of as characterLookAtTracks,
9572
9573
  Tf as characterObjects,
9573
9574
  xr as characterPartsInView,
@@ -9583,7 +9584,7 @@ export {
9583
9584
  Hl as checkCharacterBeats3D,
9584
9585
  kd as checkPropBeats,
9585
9586
  Ud as checkPropBeats3D,
9586
- bc as checkSurfaceBeats,
9587
+ yc as checkSurfaceBeats,
9587
9588
  Ip as checkTracks,
9588
9589
  gd as chicken,
9589
9590
  jf as circlePath,
@@ -9593,12 +9594,12 @@ export {
9593
9594
  Rf as codePanel,
9594
9595
  ql as codeTokens,
9595
9596
  jc as coneCorners,
9596
- ye as controlValue,
9597
+ be as controlValue,
9597
9598
  wo as cosmicShade,
9598
9599
  ad as cow,
9599
9600
  Cr as createPen,
9600
9601
  ud as crow,
9601
- yl as cylinderMesh,
9602
+ bl as cylinderMesh,
9602
9603
  Fi as danceCircleAt,
9603
9604
  Mf as danceCircleTracks,
9604
9605
  Io as danceFrame,
@@ -9609,7 +9610,7 @@ export {
9609
9610
  wf as danceTracks,
9610
9611
  Rn as danceTravel,
9611
9612
  Ti as danceTravelTrack,
9612
- yf as dancer,
9613
+ bf as dancer,
9613
9614
  Jf as defineAction,
9614
9615
  Zf as defineGait,
9615
9616
  Lc as depthAt,
@@ -9621,7 +9622,7 @@ export {
9621
9622
  ou as drawBlinds,
9622
9623
  ku as drawBokeh,
9623
9624
  Rr as drawCartoonHand,
9624
- bu as drawCaseBoard,
9625
+ yu as drawCaseBoard,
9625
9626
  Sg as drawCharacter,
9626
9627
  Mg as drawCharacterHead,
9627
9628
  $g as drawCharacterInView,
@@ -9652,7 +9653,7 @@ export {
9652
9653
  nu as drawRain,
9653
9654
  Su as drawShadedBall,
9654
9655
  Pu as drawShortCaption,
9655
- yu as drawSkyGradient,
9656
+ bu as drawSkyGradient,
9656
9657
  nl as drawSolvedFaces,
9657
9658
  Ef as drawSolvedPart,
9658
9659
  _a as drawSolvedProp,
@@ -9680,7 +9681,7 @@ export {
9680
9681
  $f as flipTracks,
9681
9682
  Yi as flipTravel,
9682
9683
  Cs as gag,
9683
- yn as gagDuration,
9684
+ bn as gagDuration,
9684
9685
  Pg as gaitBob,
9685
9686
  Og as gaitGive,
9686
9687
  Ig as gaitPose,
@@ -9732,7 +9733,7 @@ export {
9732
9733
  Af as lipSyncTracks,
9733
9734
  za as lit,
9734
9735
  Ga as lookFields,
9735
- br as loosePartsOf,
9736
+ yr as loosePartsOf,
9736
9737
  ed as lyingPose,
9737
9738
  qg as measuredHipWidth,
9738
9739
  Sf as meetDandiya,
@@ -9743,16 +9744,16 @@ export {
9743
9744
  Gg as mittenAt,
9744
9745
  Wa as mixColors,
9745
9746
  hn as mixHandPoses,
9746
- ya as mixPoses,
9747
+ ba as mixPoses,
9747
9748
  T0 as motorbike,
9748
9749
  sh as niceCeiling,
9749
- ys as objectPositionAt,
9750
+ bs as objectPositionAt,
9750
9751
  Yg as organicBodyContours,
9751
9752
  Ug as organicCenterLine,
9752
9753
  Xg as outfitPreset,
9753
- bd as owl,
9754
+ yd as owl,
9754
9755
  Sl as panelMesh,
9755
- yd as parrot,
9756
+ bd as parrot,
9756
9757
  $t as parseAnchor,
9757
9758
  In as parseRgb,
9758
9759
  vn as partialPath,
@@ -9771,7 +9772,7 @@ export {
9771
9772
  Jo as propActions,
9772
9773
  h0 as propAnchors3D,
9773
9774
  Xo as propAt,
9774
- yr as propControls,
9775
+ br as propControls,
9775
9776
  xa as propLineWidth,
9776
9777
  Fu as propObjects,
9777
9778
  l0 as propPartsInSpace,
@@ -9843,8 +9844,8 @@ export {
9843
9844
  mp as strideLength,
9844
9845
  me as surfaceBox,
9845
9846
  Qf as surfaceScript,
9846
- bp as sweepingPose,
9847
- yp as talkingMouth,
9847
+ yp as sweepingPose,
9848
+ bp as talkingMouth,
9848
9849
  wp as taperedLine,
9849
9850
  kp as taperedOutline,
9850
9851
  S0 as tractor,