@algorisys/tinyfly 0.74.1 → 0.76.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,4 +1,6 @@
1
- const k = {
1
+ import { s as X, p as oe, a as ne } from "./sketch-CB6VNfnR.js";
2
+ import { b as ht, c as at } from "./sketch-CB6VNfnR.js";
3
+ const Y = {
2
4
  lean: 0,
3
5
  headTilt: 0,
4
6
  leftShoulder: 18,
@@ -19,12 +21,15 @@ const k = {
19
21
  rightBrow: 0,
20
22
  browTilt: 0,
21
23
  lookX: 0,
22
- lookY: 0
24
+ lookY: 0,
25
+ stretch: 1,
26
+ turn: 0,
27
+ sit: 0
23
28
  };
24
- function p(t) {
25
- return { ...k, ...t };
29
+ function P(e) {
30
+ return { ...Y, ...e };
26
31
  }
27
- const v = {
32
+ const le = {
28
33
  mouth: 0,
29
34
  smile: 0,
30
35
  mouthWidth: 1,
@@ -35,177 +40,532 @@ const v = {
35
40
  browTilt: 0,
36
41
  lookX: 0,
37
42
  lookY: 0
38
- }, a = (t) => ({ ...v, ...t }), b = {
39
- neutral: v,
40
- happy: a({ smile: 0.9, leftBrow: 0.2, rightBrow: 0.2 }),
41
- joyful: a({ mouth: 0.6, smile: 1, mouthWidth: 1.2, leftEye: 0, rightEye: 0, leftBrow: 0.4, rightBrow: 0.4 }),
42
- sad: a({ smile: -0.8, leftEye: 0.8, rightEye: 0.8, browTilt: 0.9, leftBrow: -0.1, rightBrow: -0.1, lookY: 0.6 }),
43
- crying: a({ mouth: 0.45, smile: -1, leftEye: 0, rightEye: 0, browTilt: 1, lookY: 0.4 }),
44
- surprised: a({ mouth: 0.7, mouthWidth: 0.7, leftEye: 1.5, rightEye: 1.5, leftBrow: 1, rightBrow: 1 }),
45
- shocked: a({ mouth: 1, mouthWidth: 0.8, leftEye: 1.6, rightEye: 1.6, leftBrow: 1, rightBrow: 1, browTilt: 0.4 }),
46
- angry: a({ smile: -0.6, mouthWidth: 0.9, leftEye: 0.8, rightEye: 0.8, leftBrow: -0.6, rightBrow: -0.6, browTilt: -1 }),
47
- furious: a({ mouth: 0.5, smile: -1, mouthWidth: 1.3, leftEye: 0.9, rightEye: 0.9, leftBrow: -0.9, rightBrow: -0.9, browTilt: -1 }),
48
- worried: a({ smile: -0.3, mouthWidth: 0.8, leftEye: 1.1, rightEye: 1.1, leftBrow: 0.3, rightBrow: 0.3, browTilt: 0.8, lookX: -0.5 }),
49
- scared: a({ mouth: 0.35, smile: -0.5, mouthWidth: 0.8, leftEye: 1.45, rightEye: 1.45, leftBrow: 0.8, rightBrow: 0.8, browTilt: 0.9 }),
50
- confused: a({ smile: -0.2, mouthWidth: 0.8, leftEye: 0.9, rightEye: 1.15, leftBrow: -0.3, rightBrow: 0.8, lookX: 0.5, lookY: -0.4 }),
51
- skeptical: a({ smile: -0.1, leftEye: 0.6, rightEye: 1, leftBrow: -0.4, rightBrow: 0.7, lookX: 0.4 }),
52
- thinking: a({ smile: 0, mouthWidth: 0.7, leftBrow: 0.3, rightBrow: 0.5, lookX: 0.6, lookY: -0.8 }),
53
- sleepy: a({ smile: 0.1, leftEye: 0.25, rightEye: 0.25, leftBrow: -0.3, rightBrow: -0.3, lookY: 0.5 }),
54
- disgusted: a({ smile: -0.7, mouthWidth: 0.9, leftEye: 0.6, rightEye: 0.75, leftBrow: -0.5, rightBrow: -0.2, browTilt: -0.4, lookX: -0.6 }),
55
- smug: a({ smile: 0.6, mouthWidth: 0.9, leftEye: 0.6, rightEye: 0.6, leftBrow: 0.1, rightBrow: 0.5, lookX: 0.5 }),
56
- wink: a({ smile: 0.9, leftEye: 0, rightEye: 1, leftBrow: -0.2, rightBrow: 0.3 })
43
+ }, p = (e) => ({ ...le, ...e }), H = {
44
+ neutral: le,
45
+ happy: p({ smile: 0.9, leftBrow: 0.2, rightBrow: 0.2 }),
46
+ joyful: p({ mouth: 0.6, smile: 1, mouthWidth: 1.2, leftEye: 0, rightEye: 0, leftBrow: 0.4, rightBrow: 0.4 }),
47
+ sad: p({ smile: -0.8, leftEye: 0.8, rightEye: 0.8, browTilt: 0.9, leftBrow: -0.1, rightBrow: -0.1, lookY: 0.6 }),
48
+ crying: p({ mouth: 0.45, smile: -1, leftEye: 0, rightEye: 0, browTilt: 1, lookY: 0.4 }),
49
+ surprised: p({ mouth: 0.7, mouthWidth: 0.7, leftEye: 1.5, rightEye: 1.5, leftBrow: 1, rightBrow: 1 }),
50
+ shocked: p({ mouth: 1, mouthWidth: 0.8, leftEye: 1.6, rightEye: 1.6, leftBrow: 1, rightBrow: 1, browTilt: 0.4 }),
51
+ angry: p({ smile: -0.6, mouthWidth: 0.9, leftEye: 0.8, rightEye: 0.8, leftBrow: -0.6, rightBrow: -0.6, browTilt: -1 }),
52
+ furious: p({ mouth: 0.5, smile: -1, mouthWidth: 1.3, leftEye: 0.9, rightEye: 0.9, leftBrow: -0.9, rightBrow: -0.9, browTilt: -1 }),
53
+ worried: p({ smile: -0.3, mouthWidth: 0.8, leftEye: 1.1, rightEye: 1.1, leftBrow: 0.3, rightBrow: 0.3, browTilt: 0.8, lookX: -0.5 }),
54
+ scared: p({ mouth: 0.35, smile: -0.5, mouthWidth: 0.8, leftEye: 1.45, rightEye: 1.45, leftBrow: 0.8, rightBrow: 0.8, browTilt: 0.9 }),
55
+ confused: p({ smile: -0.2, mouthWidth: 0.8, leftEye: 0.9, rightEye: 1.15, leftBrow: -0.3, rightBrow: 0.8, lookX: 0.5, lookY: -0.4 }),
56
+ skeptical: p({ smile: -0.1, leftEye: 0.6, rightEye: 1, leftBrow: -0.4, rightBrow: 0.7, lookX: 0.4 }),
57
+ thinking: p({ smile: 0, mouthWidth: 0.7, leftBrow: 0.3, rightBrow: 0.5, lookX: 0.6, lookY: -0.8 }),
58
+ sleepy: p({ smile: 0.1, leftEye: 0.25, rightEye: 0.25, leftBrow: -0.3, rightBrow: -0.3, lookY: 0.5 }),
59
+ disgusted: p({ smile: -0.7, mouthWidth: 0.9, leftEye: 0.6, rightEye: 0.75, leftBrow: -0.5, rightBrow: -0.2, browTilt: -0.4, lookX: -0.6 }),
60
+ smug: p({ smile: 0.6, mouthWidth: 0.9, leftEye: 0.6, rightEye: 0.6, leftBrow: 0.1, rightBrow: 0.5, lookX: 0.5 }),
61
+ wink: p({ smile: 0.9, leftEye: 0, rightEye: 1, leftBrow: -0.2, rightBrow: 0.3 })
57
62
  };
58
- function R(t, e) {
59
- return { ...t, ...typeof e == "string" ? b[e] : e };
60
- }
61
- const A = {
62
- rest: k,
63
- wave: p({ rightShoulder: 135, rightElbow: 30, headTilt: 6, ...b.happy }),
64
- cheer: p({ leftShoulder: 125, leftElbow: 20, rightShoulder: 125, rightElbow: 20, ...b.joyful }),
65
- shrug: p({ leftShoulder: 30, leftElbow: 85, rightShoulder: 30, rightElbow: 85, headTilt: -10, ...b.confused, lookX: 0, lookY: 0 }),
66
- point: p({ rightShoulder: 90, rightElbow: 0, lean: 4, smile: 0.4 }),
63
+ function Ee(e, t) {
64
+ return { ...e, ...typeof t == "string" ? H[t] : t };
65
+ }
66
+ const pe = {
67
+ rest: Y,
68
+ wave: P({ rightShoulder: 135, rightElbow: 30, headTilt: 6, ...H.happy }),
69
+ cheer: P({ leftShoulder: 125, leftElbow: 20, rightShoulder: 125, rightElbow: 20, ...H.joyful }),
70
+ shrug: P({ leftShoulder: 30, leftElbow: 85, rightShoulder: 30, rightElbow: 85, headTilt: -10, ...H.confused, lookX: 0, lookY: 0 }),
71
+ point: P({ rightShoulder: 90, rightElbow: 0, lean: 4, smile: 0.4 }),
67
72
  // The forearm passes 180° to fold back in, so the hand reaches the chin.
68
- think: p({ rightShoulder: 60, rightElbow: 150, headTilt: 10, ...b.thinking }),
69
- handsOnHips: p({ leftShoulder: 45, leftElbow: -100, rightShoulder: 45, rightElbow: -100, leftHip: 14, rightHip: 14, smile: 0.8 }),
70
- sad: p({ leftShoulder: 14, rightShoulder: 14, leftElbow: -4, rightElbow: -4, headTilt: -14, lean: -3, ...b.sad }),
71
- surprised: p({ leftShoulder: 70, leftElbow: 60, rightShoulder: 70, rightElbow: 60, ...b.surprised })
72
- }, I = Object.keys(k);
73
- function O(t, e, o) {
74
- const l = { ...t };
75
- for (const h of I) l[h] = t[h] + (e[h] - t[h]) * o;
73
+ think: P({ rightShoulder: 60, rightElbow: 150, headTilt: 10, ...H.thinking }),
74
+ handsOnHips: P({ leftShoulder: 45, leftElbow: -100, rightShoulder: 45, rightElbow: -100, leftHip: 14, rightHip: 14, smile: 0.8 }),
75
+ sad: P({ leftShoulder: 14, rightShoulder: 14, leftElbow: -4, rightElbow: -4, headTilt: -14, lean: -3, ...H.sad }),
76
+ surprised: P({ leftShoulder: 70, leftElbow: 60, rightShoulder: 70, rightElbow: 60, ...H.surprised }),
77
+ // Squash and stretch: the wind-up before a jump (or the landing), and the jump itself.
78
+ crouch: P({ stretch: 0.72, leftShoulder: 35, rightShoulder: 35, leftElbow: -50, rightElbow: -50, leftHip: 22, rightHip: 22, headTilt: -4 }),
79
+ // Seated, hands resting on the knees. Arm angles spread outward per side, so
80
+ // reaching forward (+x, the way the figure faces) is negative for the left arm.
81
+ sit: P({ sit: 1, turn: 0.5, leftShoulder: -25, rightShoulder: 25, leftElbow: -55, rightElbow: 55 }),
82
+ jump: P({ stretch: 1.22, leftShoulder: 140, rightShoulder: 140, leftElbow: 20, rightElbow: 20, leftHip: 4, rightHip: 4, ...H.joyful })
83
+ }, re = Object.keys(Y);
84
+ function Me(e, t, o) {
85
+ const l = { ...e };
86
+ for (const n of re) l[n] = e[n] + (t[n] - e[n]) * o;
76
87
  return l;
77
88
  }
78
- const P = 24, _ = 40;
79
- function F(t, e = k, o = 1) {
80
- const l = Math.sin(t * Math.PI * 2) * o, h = Math.cos(t * Math.PI * 2) * o, u = (g) => g <= _ ? 22 * l : g;
89
+ const K = 24, Q = 4, Z = 28, Se = 40;
90
+ function Te(e, t = Y, o = 1) {
91
+ const l = Math.sin(e * Math.PI * 2) * o, n = Math.cos(e * Math.PI * 2) * o, s = (a) => a <= Se, h = (a) => s(a) ? 22 * l : a, i = s(t.leftShoulder) ? t.leftElbow - Z * Math.max(0, -l) : t.leftElbow, r = s(t.rightShoulder) ? t.rightElbow + Z * Math.max(0, l) : t.rightElbow;
81
92
  return {
82
- ...e,
93
+ ...t,
94
+ // Lean into the walk, and keep the head a little more level than the body.
95
+ lean: t.lean + Q * o,
96
+ headTilt: t.headTilt - Q * 0.5 * o,
97
+ leftElbow: i,
98
+ rightElbow: r,
83
99
  // Left foot forward while swing > 0, right foot back; then the other way.
84
- leftHip: -P * l,
85
- rightHip: -P * l,
100
+ leftHip: -K * l,
101
+ rightHip: -K * l,
86
102
  // The leg swinging forward lifts, its shin trailing backward (-x). A positive
87
103
  // knee folds toward the centre, which is backward only for the right leg.
88
- leftKnee: -30 * Math.max(0, h),
89
- rightKnee: 30 * Math.max(0, -h),
104
+ leftKnee: -30 * Math.max(0, n),
105
+ rightKnee: 30 * Math.max(0, -n),
90
106
  // Arms swing against the legs: left arm back while the left foot is forward.
91
- leftShoulder: u(e.leftShoulder),
92
- rightShoulder: u(e.rightShoulder)
107
+ leftShoulder: h(t.leftShoulder),
108
+ rightShoulder: h(t.rightShoulder)
93
109
  };
94
110
  }
95
- function U(t, e = 1) {
96
- return 4 * ((Y + H) * t) * Math.sin(P * e * Math.PI / 180);
111
+ function Qe(e, t = 1) {
112
+ return 4 * ((C + N) * e) * Math.sin(K * t * Math.PI / 180);
113
+ }
114
+ function ke(e) {
115
+ const t = Math.abs(Math.sin(e / 65)), o = 0.55 + 0.45 * Math.sin(e / 310);
116
+ return t * o;
97
117
  }
98
- function K(t) {
99
- const e = Math.abs(Math.sin(t / 65)), o = 0.55 + 0.45 * Math.sin(t / 310);
100
- return e * o;
118
+ const se = 0.12, $ = 0.46, Pe = 1 - 2 * se, ve = 0.1, Be = 0.21, Ie = 0.19, C = 0.24, N = 0.22, ie = 0.12, We = 0.14, he = 0.33, V = 0.7, j = 0.3, He = 0.35, Re = [1.7, 1.05], Ye = [1.3, 0.75], ee = [1.45, 0.85], _e = [1.15, 0.75], te = 0.06, Ae = 0.65, Oe = 0.3, Le = 0.02, Fe = 0.012, Ne = 12, L = 90, xe = 0.25, Xe = 0.01, O = (e) => Math.min(1, Math.max(0, e ?? 0));
119
+ function Ze(e, t = 1) {
120
+ return N * e * t;
101
121
  }
102
- const C = 0.12, N = 0.1, L = 0.21, q = 0.19, Y = 0.24, H = 0.22, M = (t) => t * Math.PI / 180, G = (t, e) => ({ x: e * Math.sin(M(t)), y: Math.cos(M(t)) });
103
- function j(t, e, o, l, h, u) {
104
- const g = Math.max(1, u * 0.6), i = 0.12 * o, n = l - 0.12 * o, E = i + e.lookX * 0.08 * o, y = e.lookY * 0.07 * o, S = [
105
- { x: -0.34 * o, open: e.leftEye, brow: e.leftBrow, side: -1 },
106
- { x: 0.34 * o, open: e.rightEye, brow: e.rightBrow, side: 1 }
122
+ const D = -0.12, ae = 0.4, W = (e) => e * Math.PI / 180, Ke = (e, t) => ({ x: t * Math.sin(W(e)), y: Math.cos(W(e)) }), fe = (e, t) => Math.max(0, e) * (1 - Math.min(1, Math.max(0, t))), ce = (e, t, o, l) => e - 0.3 * t - o * 0.14 * t - Math.max(0, l - 1) * 0.12 * t;
123
+ function Ce(e, t, o, l, n, s) {
124
+ const h = Math.max(1, Math.min(s * 0.6, We * o)), i = O(t.turn), r = (ie + he * i) * o, a = l + D * o, f = r + t.lookX * 0.08 * o, y = t.lookY * 0.07 * o, w = [
125
+ // The left eye is on the far side; turning closes it up more than the near one.
126
+ { x: -0.34 * o * (1 - V * i), squeeze: 1 - V * i, open: t.leftEye, brow: t.leftBrow, side: -1 },
127
+ { x: 0.34 * o * (1 - j * i), squeeze: 1 - j * i, open: t.rightEye, brow: t.rightBrow, side: 1 }
107
128
  ];
108
- t.fillStyle = h, t.strokeStyle = h, t.lineWidth = g;
109
- for (const s of S) {
110
- const f = Math.max(0, s.open) * (1 - Math.min(1, Math.max(0, e.blink)));
111
- if (f < 0.2) {
112
- const T = e.smile > 0.5 ? -0.12 * o : 0.06 * o;
113
- t.beginPath(), t.moveTo(s.x + i - 0.12 * o, n), t.quadraticCurveTo(s.x + i, n + T, s.x + i + 0.12 * o, n), t.stroke();
129
+ e.fillStyle = n, e.strokeStyle = n, e.lineWidth = h;
130
+ for (const u of w) {
131
+ const c = fe(u.open, t.blink);
132
+ if (c < 0.2) {
133
+ const B = t.smile > 0.5 ? -0.12 * o : 0.06 * o;
134
+ e.beginPath(), e.moveTo(u.x + r - 0.12 * o, a), e.quadraticCurveTo(u.x + r, a + B, u.x + r + 0.12 * o, a), e.stroke();
114
135
  } else {
115
- if (f > 1.2) {
116
- const W = 0.13 * o * f;
117
- t.beginPath(), t.ellipse(s.x + i, n, W * 0.85, W, 0, 0, Math.PI * 2), t.fillStyle = "#ffffff", t.fill(), t.stroke(), t.fillStyle = h;
136
+ if (c > 1.2) {
137
+ const _ = 0.13 * o * c;
138
+ e.beginPath(), e.ellipse(u.x + r, a, _ * 0.85, _, 0, 0, Math.PI * 2), e.fillStyle = "#ffffff", e.fill(), e.stroke(), e.fillStyle = n;
118
139
  }
119
- const T = f > 1.2 ? 0.075 * o : 0.1 * o;
120
- t.beginPath(), t.ellipse(s.x + E, n + y, T, T * 1.1 * Math.min(f, 1), 0, 0, Math.PI * 2), t.fill();
140
+ const B = c > 1.2 ? 0.075 * o : 0.1 * o;
141
+ e.beginPath(), e.ellipse(u.x + f, a + y, B, B * 1.1 * Math.min(c, 1), 0, 0, Math.PI * 2), e.fill();
121
142
  }
122
- const c = n - 0.3 * o - s.brow * 0.14 * o - Math.max(0, f - 1) * 0.12 * o, B = s.x + i - s.side * 0.13 * o, X = s.x + i + s.side * 0.13 * o;
123
- t.beginPath(), t.moveTo(X, c), t.lineTo(B, c - e.browTilt * 0.1 * o), t.stroke();
143
+ const g = ce(a, o, u.brow, c), v = u.x + r - u.side * 0.13 * o * u.squeeze, R = u.x + r + u.side * 0.13 * o * u.squeeze;
144
+ e.beginPath(), e.moveTo(R, g), e.lineTo(v, g - t.browTilt * 0.1 * o), e.stroke();
124
145
  }
125
- const w = l + 0.4 * o, m = 0.25 * o * Math.max(0.3, e.mouthWidth), d = Math.min(1, Math.max(0, e.mouth));
126
- if (t.beginPath(), d <= 0.05) {
127
- t.moveTo(i - m, w), t.quadraticCurveTo(i, w + e.smile * 0.25 * o, i + m, w), t.stroke();
146
+ const d = l + ae * o, m = 0.25 * o * Math.max(0.3, t.mouthWidth) * (1 - He * i), b = Math.min(1, Math.max(0, t.mouth));
147
+ if (e.beginPath(), b <= 0.05) {
148
+ e.moveTo(r - m, d), e.quadraticCurveTo(r, d + t.smile * 0.25 * o, r + m, d), e.stroke();
128
149
  return;
129
150
  }
130
- const r = 0.3 * o * d;
131
- e.smile > 0.3 ? (t.moveTo(i - m, w - 0.05 * o), t.lineTo(i + m, w - 0.05 * o), t.quadraticCurveTo(i, w + r * 2, i - m, w - 0.05 * o)) : e.smile < -0.3 ? (t.moveTo(i - m, w + r * 0.6), t.lineTo(i + m, w + r * 0.6), t.quadraticCurveTo(i, w - r * 1.4, i - m, w + r * 0.6)) : t.ellipse(i, w, m * 0.8, r, 0, 0, Math.PI * 2), t.fill();
132
- }
133
- function D(t, e, o = {}) {
134
- const l = o.height ?? 300, h = o.color ?? "#1e293b", u = (o.facing ?? 1) < 0 ? -1 : 1, g = C * l, i = -0.46 * l, n = -0.76 * l;
135
- t.save(), t.scale(u, 1), t.strokeStyle = h, t.lineWidth = o.lineWidth ?? l * 0.025, t.lineCap = "round", t.lineJoin = "round";
136
- const E = (d, r, s, f, c) => {
137
- const B = G(s, f);
138
- return { x: d + B.x * c * l, y: r + B.y * c * l };
139
- }, y = (...d) => {
140
- t.beginPath(), t.moveTo(d[0].x, d[0].y);
141
- for (const r of d.slice(1)) t.lineTo(r.x, r.y);
142
- t.stroke();
151
+ const E = 0.3 * o * b;
152
+ t.smile > 0.3 ? (e.moveTo(r - m, d - 0.05 * o), e.lineTo(r + m, d - 0.05 * o), e.quadraticCurveTo(r, d + E * 2, r - m, d - 0.05 * o)) : t.smile < -0.3 ? (e.moveTo(r - m, d + E * 0.6), e.lineTo(r + m, d + E * 0.6), e.quadraticCurveTo(r, d - E * 1.4, r - m, d + E * 0.6)) : e.ellipse(r, d, m * 0.8, E, 0, 0, Math.PI * 2), e.fill();
153
+ }
154
+ function U(e, t, o, l, n = 16) {
155
+ const s = { x: 2 * t.x - (e.x + o.x) / 2, y: 2 * t.y - (e.y + o.y) / 2 }, h = [];
156
+ for (let i = 0; i <= n; i++) {
157
+ const r = i / n, a = r < 0.5 ? { x: e.x + (t.x - e.x) * 2 * r, y: e.y + (t.y - e.y) * 2 * r } : { x: t.x + (o.x - t.x) * (2 * r - 1), y: t.y + (o.y - t.y) * (2 * r - 1) }, f = 1 - r, y = {
158
+ x: f * f * e.x + 2 * f * r * s.x + r * r * o.x,
159
+ y: f * f * e.y + 2 * f * r * s.y + r * r * o.y
160
+ };
161
+ h.push({ x: a.x + (y.x - a.x) * l, y: a.y + (y.y - a.y) * l });
162
+ }
163
+ return h;
164
+ }
165
+ function ye(e, t) {
166
+ const o = t.height ?? 300, l = Math.min(3, Math.max(0.3, e.stretch ?? 1)), n = Math.sqrt(l), s = (t.headSize ?? 2 * se) / 2, h = t.headSize === void 0 ? Pe : 1 - 2 * s, i = s * o, r = O(e.sit), a = e.leftHip + (-L - e.leftHip) * r, f = e.leftKnee + (-L - e.leftKnee) * r, y = e.rightHip + (L - e.rightHip) * r, w = e.rightKnee + (L - e.rightKnee) * r, d = t.classic === !0, m = (M, T) => {
167
+ const k = W(M - T) / 2;
168
+ return d ? { x: 0, y: 0 } : { x: Math.cos(k) * te, y: Math.abs(Math.sin(k)) * te };
143
169
  };
144
- for (const [d, r, s] of [
145
- [-1, e.leftHip, e.leftKnee],
146
- [1, e.rightHip, e.rightKnee]
147
- ]) {
148
- const f = E(0, i, r, d, Y);
149
- y({ x: 0, y: i }, f, E(f.x, f.y, r - s, d, H));
170
+ let b = 0;
171
+ if (r > 0 || !d) {
172
+ const M = (S, I) => C * Math.cos(W(S)) + N * Math.cos(W(S - I)) + m(S, I).y, T = Math.max(M(a, f), M(y, w)), k = d ? Math.min(1, r / xe) : 1;
173
+ b = ($ - T) * k * o * l;
150
174
  }
151
- t.translate(0, i), t.rotate(M(e.lean)), t.translate(0, -i), y({ x: 0, y: i }, { x: 0, y: n });
152
- const S = n + N * l;
153
- for (const [d, r, s] of [
154
- [-1, e.leftShoulder, e.leftElbow],
155
- [1, e.rightShoulder, e.rightElbow]
175
+ const E = -$ * o * l + b, u = -h * o * l + b, c = d ? 0 : (Le * O(e.turn) + Fe * r) * o * l, g = c === 0 ? [{ x: 0, y: E }, { x: 0, y: u }] : U({ x: 0, y: E }, { x: -c, y: (E + u) / 2 }, { x: 0, y: u }, 1, 8), v = u + ve * o * l, R = (t.shoulderWidth ?? 0) * o * Math.cos(O(e.turn) * Math.PI / 2), B = (M, T, k, S, I) => {
176
+ const z = Ke(k, S);
177
+ return { x: M + z.x * I * o, y: T + z.y * I * o };
178
+ }, _ = (M, T, k) => {
179
+ const S = B(0, E, T, M, C * l);
180
+ return { root: { x: 0, y: E }, joint: S, end: B(S.x, S.y, T - k, M, N * l) };
181
+ }, G = (M, T, k) => {
182
+ const S = { x: M * R, y: v }, I = B(S.x, S.y, T, M, Be * n);
183
+ return { root: S, joint: I, end: B(I.x, I.y, T + k, M, Ie * n) };
184
+ }, x = { left: _(-1, a, f), right: _(1, y, w) }, J = (M, T, k) => {
185
+ const S = m(T, k);
186
+ return { x: M.end.x + S.x * o * l, y: M.end.y + S.y * o * l };
187
+ };
188
+ return {
189
+ height: o,
190
+ facing: (t.facing ?? 1) < 0 ? -1 : 1,
191
+ stretch: l,
192
+ lineWidth: t.lineWidth ?? o * 0.025,
193
+ rubber: Math.min(1, Math.max(d ? 0 : Oe, t.rubber ?? 0)),
194
+ r: i,
195
+ // The head keeps its area: taller and narrower when stretched.
196
+ headRx: i / Math.sqrt(l),
197
+ headRy: i * Math.sqrt(l),
198
+ hipY: E,
199
+ neckY: u,
200
+ drop: b,
201
+ lean: d ? e.lean : e.lean + Ne * Math.sin(Math.PI * r),
202
+ classic: d,
203
+ legs: x,
204
+ toes: { left: J(x.left, a, f), right: J(x.right, y, w) },
205
+ spine: g,
206
+ arms: {
207
+ left: G(-1, e.leftShoulder, e.leftElbow),
208
+ right: G(1, e.rightShoulder, e.rightElbow)
209
+ }
210
+ };
211
+ }
212
+ const A = (e, t) => t === 0 ? [e.root, e.joint, e.end] : U(e.root, e.joint, e.end, t);
213
+ function q(e, t, o) {
214
+ const l = Math.cos(o), n = Math.sin(o), s = e.x - t.x, h = e.y - t.y;
215
+ return { x: t.x + s * l - h * n, y: t.y + s * n + h * l };
216
+ }
217
+ function de(e, t) {
218
+ const o = W(e.lean), l = W(t.headTilt), n = { x: 0, y: e.hipY }, s = (u) => ({ x: e.facing * u.x, y: u.y }), h = (u) => s(q(u, n, o)), i = (u) => h(q({ x: u.x, y: u.y + e.neckY }, { x: 0, y: e.neckY }, l)), r = A(e.arms.left, e.rubber).map(h), a = A(e.arms.right, e.rubber).map(h), f = (u) => {
219
+ const [c, g] = u.slice(-2);
220
+ return Math.atan2(g.y - c.y, g.x - c.x);
221
+ };
222
+ let y = 1 / 0;
223
+ for (const [u, c] of [
224
+ [t.leftBrow, t.leftEye],
225
+ [t.rightBrow, t.rightEye]
156
226
  ]) {
157
- const f = E(0, S, r, d, L);
158
- y({ x: 0, y: S }, f, E(f.x, f.y, r + s, d, q));
227
+ const g = ce(D, 1, u, fe(c, t.blink));
228
+ y = Math.min(y, g, g - t.browTilt * 0.1);
159
229
  }
160
- t.translate(0, n), t.rotate(M(e.headTilt));
161
- const w = -g;
162
- t.beginPath(), t.arc(0, w, g, 0, Math.PI * 2);
163
- const m = o.headFill ?? "#ffffff";
164
- m !== "none" && (t.fillStyle = m, t.fill()), t.stroke(), j(t, e, g, w, h, o.lineWidth ?? l * 0.025), t.restore(), o.label && (t.save(), t.fillStyle = h, t.font = o.labelFont ?? `700 ${Math.round(l * 0.11)}px sans-serif`, t.textAlign = "center", t.textBaseline = "bottom", t.fillText(o.label, 0, -l - 0.04 * l), t.restore());
165
- }
166
- function $(t) {
167
- const e = t.style ?? {}, o = e.height ?? 300, l = o * 0.8, h = { ...p(t.pose ?? {}), walk: 0, walking: 0, talk: 0 };
230
+ const w = { left: s(e.legs.left.end), right: s(e.legs.right.end) }, d = { left: s(e.toes.left), right: s(e.toes.right) }, m = { left: Math.max(w.left.y, d.left.y), right: Math.max(w.right.y, d.right.y) }, b = Math.max(m.left, m.right), E = Xe * e.height;
231
+ return {
232
+ facing: e.facing,
233
+ height: e.height,
234
+ stretch: e.stretch,
235
+ lineWidth: e.lineWidth,
236
+ hip: n,
237
+ neck: h({ x: 0, y: e.neckY }),
238
+ shoulders: { left: h(e.arms.left.root), right: h(e.arms.right.root) },
239
+ elbows: { left: h(e.arms.left.joint), right: h(e.arms.right.joint) },
240
+ hands: { left: h(e.arms.left.end), right: h(e.arms.right.end) },
241
+ knees: { left: s(e.legs.left.joint), right: s(e.legs.right.joint) },
242
+ feet: w,
243
+ toes: d,
244
+ feetY: b,
245
+ grounded: { left: m.left >= b - E, right: m.right >= b - E },
246
+ handAngle: { left: f(r), right: f(a) },
247
+ limbs: {
248
+ leftArm: r,
249
+ rightArm: a,
250
+ leftLeg: A(e.legs.left, e.rubber).map(s),
251
+ rightLeg: A(e.legs.right, e.rubber).map(s),
252
+ spine: e.spine.map(h)
253
+ },
254
+ head: {
255
+ center: i({ x: 0, y: -e.headRy }),
256
+ rx: e.headRx,
257
+ ry: e.headRy,
258
+ // Mirroring a turn reverses it.
259
+ angle: e.facing * (o + l),
260
+ eyeY: D,
261
+ browTopY: y,
262
+ mouthY: ae,
263
+ faceX: e.facing * (ie + he * O(t.turn))
264
+ }
265
+ };
266
+ }
267
+ function De(e, t = {}) {
268
+ return de(ye(e, t), e);
269
+ }
270
+ function $e(e, t, o) {
271
+ return q({ x: e.center.x + t * e.rx, y: e.center.y + o * e.ry }, e.center, e.angle);
272
+ }
273
+ function qe(e, t, o) {
274
+ const l = (s) => ({ x: s.x + t, y: s.y + o }), n = (s) => ({ left: l(s.left), right: l(s.right) });
275
+ return {
276
+ ...e,
277
+ hip: l(e.hip),
278
+ neck: l(e.neck),
279
+ shoulders: n(e.shoulders),
280
+ elbows: n(e.elbows),
281
+ hands: n(e.hands),
282
+ knees: n(e.knees),
283
+ feet: n(e.feet),
284
+ toes: n(e.toes),
285
+ feetY: e.feetY + o,
286
+ grounded: { ...e.grounded },
287
+ handAngle: { ...e.handAngle },
288
+ limbs: {
289
+ leftArm: e.limbs.leftArm.map(l),
290
+ rightArm: e.limbs.rightArm.map(l),
291
+ leftLeg: e.limbs.leftLeg.map(l),
292
+ rightLeg: e.limbs.rightLeg.map(l),
293
+ spine: e.limbs.spine.map(l)
294
+ },
295
+ head: { ...e.head, center: l(e.head.center) }
296
+ };
297
+ }
298
+ function Ue(e, t, o, l) {
299
+ const n = t.length;
300
+ if (n < 2) return;
301
+ const s = [], h = [], i = (r) => o + (l - o) * r / (n - 1);
302
+ t.forEach((r, a) => {
303
+ const f = t[Math.max(0, a - 1)], y = t[Math.min(n - 1, a + 1)], w = Math.hypot(y.x - f.x, y.y - f.y) || 1, d = i(a) / 2, m = -(y.y - f.y) / w * d, b = (y.x - f.x) / w * d;
304
+ s.push({ x: r.x + m, y: r.y + b }), h.push({ x: r.x - m, y: r.y - b });
305
+ }), e.beginPath(), e.moveTo(s[0].x, s[0].y);
306
+ for (const r of s.slice(1)) e.lineTo(r.x, r.y);
307
+ for (const r of h.reverse()) e.lineTo(r.x, r.y);
308
+ e.closePath(), e.fill(), t.forEach((r, a) => {
309
+ a !== 0 && a !== n - 1 && n > 3 || (e.beginPath(), e.arc(r.x, r.y, i(a) / 2, 0, Math.PI * 2), e.fill());
310
+ });
311
+ }
312
+ function Ge(e, t, o = {}, l = 0) {
313
+ const n = ye(t, o), s = o.color ?? "#1e293b", h = o.layers ?? {}, i = o.layers ? de(n, t) : void 0, r = o.sketch ? X(e, o.sketch, l) : void 0, a = o.sketch && o.layers ? X(e, o.sketch, l) : void 0, f = (c) => {
314
+ e.save(), c(), e.restore();
315
+ }, y = (c) => {
316
+ c && i && f(() => c(e, i, l, a));
317
+ }, w = () => e.scale(n.facing, 1), d = () => {
318
+ w(), e.translate(0, n.hipY), e.rotate(W(n.lean)), e.translate(0, -n.hipY);
319
+ }, m = (c, g, v) => {
320
+ if (r) return g ? r.curve(c) : r.line(c);
321
+ if (n.classic) {
322
+ e.beginPath(), e.moveTo(c[0].x, c[0].y);
323
+ for (const R of c.slice(1)) e.lineTo(R.x, R.y);
324
+ e.stroke();
325
+ return;
326
+ }
327
+ Ue(e, c, v[0] * n.lineWidth, v[1] * n.lineWidth);
328
+ }, b = (c, g) => m(A(c, n.rubber), n.rubber > 0, g), E = (c) => {
329
+ n.classic || m([n.legs[c].end, n.toes[c]], !1, _e);
330
+ }, u = (c) => {
331
+ if (n.classic || r) return;
332
+ const g = n.arms[c].end;
333
+ e.beginPath(), e.arc(g.x, g.y, Ae * n.lineWidth, 0, Math.PI * 2), e.fill();
334
+ };
335
+ e.save(), e.strokeStyle = s, e.fillStyle = s, e.lineWidth = n.lineWidth, e.lineCap = "round", e.lineJoin = "round", y(h.behind), f(() => {
336
+ w(), b(n.legs.left, ee), E("left"), b(n.legs.right, ee), E("right");
337
+ }), f(() => {
338
+ d(), m(n.spine, n.spine.length > 2, Re);
339
+ const { left: c, right: g } = { left: n.arms.left.root, right: n.arms.right.root };
340
+ if (c.x !== g.x)
341
+ if (n.classic) m([c, g], !1, [1, 1]);
342
+ else {
343
+ const v = { x: (c.x + g.x) / 2, y: c.y - 0.3 * Math.abs(g.x - c.x) };
344
+ m(U(c, v, g, 1, 8), !0, [1.1, 1.1]);
345
+ }
346
+ }), y(h.body);
347
+ for (const c of ["left", "right"]) {
348
+ f(() => {
349
+ d(), b(n.arms[c], Ye), u(c);
350
+ });
351
+ const g = h.sleeve;
352
+ g && i && f(() => g(e, i, c, l, a));
353
+ }
354
+ y(h.behindHead), f(() => {
355
+ d(), e.translate(0, n.neckY), e.rotate(W(t.headTilt));
356
+ const c = -n.headRy;
357
+ e.beginPath(), e.ellipse(0, c, n.headRx, n.headRy, 0, 0, Math.PI * 2);
358
+ const g = o.headFill ?? "#ffffff";
359
+ if (g !== "none" && (e.fillStyle = g, e.fill()), r) {
360
+ r.ellipse(0, c, n.headRx, n.headRy);
361
+ const v = r.nudge();
362
+ e.translate(v.x, v.y);
363
+ } else
364
+ e.stroke();
365
+ e.translate(0, c), e.scale(n.headRx / n.r, n.headRy / n.r), Ce(e, t, n.r, 0, s, n.lineWidth);
366
+ }), y(h.overHead), y(h.front), e.restore(), o.label && (e.save(), e.fillStyle = s, e.font = o.labelFont ?? `700 ${Math.round(n.height * 0.11)}px sans-serif`, e.textAlign = "center", e.textBaseline = "bottom", e.fillText(o.label, 0, -n.height * n.stretch - 0.04 * n.height + n.drop), e.restore());
367
+ }
368
+ function ue(e, t) {
369
+ const o = { ...e };
370
+ let l = e.walking > 0 ? Me(o, Te(e.walk, o), e.walking) : o;
371
+ return e.talk > 0 && (l = { ...l, mouth: Math.max(l.mouth, e.talk * ke(t)) }), l;
372
+ }
373
+ function Ve(e) {
374
+ const t = e.style ?? {}, o = t.height ?? 300, l = o * 0.8, n = { ...P(e.pose ?? {}), walk: 0, walking: 0, talk: 0, rubber: t.rubber ?? 0 };
168
375
  return {
169
376
  type: "custom",
170
- x: t.x - l / 2,
171
- y: t.y - o,
377
+ x: e.x - l / 2,
378
+ y: e.y - o,
172
379
  width: l,
173
380
  height: o,
174
- props: { ...h },
175
- draw(u, g, i) {
176
- const n = g.props, E = { ...n };
177
- let y = n.walking > 0 ? O(E, F(n.walk, E), n.walking) : E;
178
- n.talk > 0 && (y = { ...y, mouth: Math.max(y.mouth, n.talk * K(i)) }), u.translate(l / 2, o), D(u, y, e);
381
+ props: { ...n },
382
+ figureStyle: t,
383
+ draw(s, h, i) {
384
+ const r = h.props;
385
+ s.translate(l / 2, o), Ge(s, ue(r, i), { ...t, rubber: r.rubber }, i);
179
386
  }
180
387
  };
181
388
  }
182
- function J(t, e) {
389
+ function je(e, t, o) {
390
+ const l = e.figureStyle;
391
+ if (!l) throw new Error("stickFigureAt: the target was not made by stickFigureTarget");
392
+ const n = { ...e.props };
393
+ let s = 0, h = 0;
394
+ for (const [a, f] of t.state?.values.get(o) ?? [])
395
+ typeof f == "number" && (a === "x" || a === "motionPathX" ? s = f : a === "y" || a === "motionPathY" ? h = f : a in n && (n[a] = f));
396
+ const i = ue(n, t.time), r = De(i, { ...l, rubber: n.rubber });
397
+ return { pose: i, joints: qe(r, e.x + s + e.width / 2, e.y + h + e.height) };
398
+ }
399
+ function et(e, t) {
183
400
  const o = [];
184
- return e.forEach((l, h) => {
185
- const u = h === 0 ? k : o[h - 1], g = typeof l.pose == "string" ? A[l.pose] : { ...u, ...l.pose };
186
- o.push(l.expression ? R(g, l.expression) : g);
187
- }), I.filter((l) => o.some((h) => h[l] !== k[l])).map((l) => ({
188
- id: `${t}-${l}`,
189
- target: t,
401
+ return t.forEach((l, n) => {
402
+ const s = n === 0 ? Y : o[n - 1], h = typeof l.pose == "string" ? pe[l.pose] : { ...s, ...l.pose };
403
+ o.push(l.expression ? Ee(h, l.expression) : h);
404
+ }), re.filter((l) => o.some((n) => n[l] !== Y[l])).map((l) => ({
405
+ id: `${e}-${l}`,
406
+ target: e,
190
407
  property: l,
191
- keyframes: e.map((h, u) => ({
192
- time: h.time,
193
- value: o[u][l],
194
- ...h.easing ? { easing: h.easing } : {}
408
+ keyframes: t.map((n, s) => ({
409
+ time: n.time,
410
+ value: o[s][l],
411
+ ...n.easing ? { easing: n.easing } : {}
195
412
  }))
196
413
  }));
197
414
  }
415
+ function Je(e, t, o = {}, l) {
416
+ const n = o.length ?? 240, s = 9, h = 28, i = n - 22;
417
+ e.save(), e.translate(t.x, t.y), e.rotate((o.angle ?? -30) * Math.PI / 180), e.fillStyle = o.color ?? "#f4c542", e.fillRect(h, -s, i - h, 2 * s), e.fillStyle = "#e8b4a0", e.fillRect(i, -s, n - i, 2 * s), e.fillStyle = "#f1dcbf", e.beginPath(), e.moveTo(0, 0), e.lineTo(h, -s), e.lineTo(h, s), e.closePath(), e.fill(), e.fillStyle = o.outline ?? "#2f2f33", e.beginPath(), e.moveTo(0, 0), e.lineTo(h * 0.35, -s * 0.35), e.lineTo(h * 0.35, s * 0.35), e.closePath(), e.fill(), e.strokeStyle = o.outline ?? "#2f2f33", e.lineWidth = 3, e.lineJoin = "round", e.lineCap = "round";
418
+ const r = [
419
+ [{ x: 0, y: 0 }, { x: h, y: -s }, { x: n, y: -s }, { x: n, y: s }, { x: h, y: s }, { x: 0, y: 0 }],
420
+ [{ x: h, y: -s }, { x: h, y: s }],
421
+ [{ x: i, y: -s }, { x: i, y: s }]
422
+ ];
423
+ for (const a of r) we(e, a, l);
424
+ e.restore();
425
+ }
426
+ function me(e, t, o = {}, l) {
427
+ const n = o.length ?? 90, s = o.thickness ?? 34;
428
+ e.save(), e.translate(t.x, t.y), e.rotate((o.angle ?? -35) * Math.PI / 180);
429
+ const h = -s / 2;
430
+ e.fillStyle = o.color ?? "#f4a7b9", e.fillRect(0, h, n, s), e.fillStyle = "#e9edf2", e.fillRect(n * 0.45, h, n * 0.55, s), e.strokeStyle = o.outline ?? "#2f2f33", e.lineWidth = 3, e.lineJoin = "round";
431
+ const i = [
432
+ { x: 0, y: h },
433
+ { x: n, y: h },
434
+ { x: n, y: -h },
435
+ { x: 0, y: -h },
436
+ { x: 0, y: h }
437
+ ], r = [{ x: n * 0.45, y: h }, { x: n * 0.45, y: -h }];
438
+ if (l)
439
+ l.line(i), l.line(r);
440
+ else
441
+ for (const a of [i, r]) {
442
+ e.beginPath(), e.moveTo(a[0].x, a[0].y);
443
+ for (const f of a.slice(1)) e.lineTo(f.x, f.y);
444
+ e.stroke();
445
+ }
446
+ e.restore();
447
+ }
448
+ function ge(e, t, o = {}, l) {
449
+ const n = o.tool ?? "pencil", s = o.skin ?? "#f1c9a5", h = o.outline ?? "#2f2f33", i = n === "eraser" ? 17 : 9, r = n === "eraser" ? -40 : 0, a = l ? l.nudge(0.6) : { x: 0, y: 0 };
450
+ e.save(), e.translate(t.x + a.x, t.y + a.y), e.rotate((o.angle ?? -30) * Math.PI / 180), e.scale(o.scale ?? 1, o.scale ?? 1), e.lineCap = "round", e.lineJoin = "round";
451
+ const f = (d, m, b, E) => {
452
+ for (const [u, c] of [
453
+ [h, b + 6],
454
+ [E, b]
455
+ ])
456
+ e.strokeStyle = u, e.lineWidth = c, e.beginPath(), e.moveTo(d.x, d.y), e.lineTo(m.x, m.y), e.stroke();
457
+ };
458
+ e.save(), e.translate(r, 0);
459
+ const y = { x: 165, y: -i - 26 }, w = (d) => ({ x: y.x + d * 0.8, y: y.y + d * 0.6 });
460
+ f(y, w(2e3), 64, s), f(w(110), w(2e3), 92, o.sleeve ?? "#5b7db1"), e.fillStyle = s, e.strokeStyle = h, e.lineWidth = 3, e.beginPath(), e.ellipse(y.x, y.y, 54, 40, 0.25, 0, Math.PI * 2), e.fill(), e.stroke(), e.restore(), n === "eraser" ? me(e, { x: 0, y: 0 }, { angle: 0, outline: h }, l) : Je(e, { x: 0, y: 0 }, { angle: 0, outline: h }, l), e.translate(r, 0), f({ x: 150, y: i + 8 }, { x: 92, y: i + 12 }, 22, s), f({ x: 140, y: -i - 18 }, { x: 58, y: -i - 6 }, 20, s), f({ x: 150, y: -i - 30 }, { x: 112, y: -i + 2 }, 20, s), f({ x: 172, y: -i - 30 }, { x: 140, y: -i + 4 }, 20, s), e.restore();
461
+ }
462
+ function tt(e, t, o, l = 0.08, n = 32) {
463
+ const s = Math.PI * 2 * (1 + l), h = [];
464
+ for (let i = 0; i <= n; i++) {
465
+ const r = -Math.PI / 2 + s * i / n;
466
+ h.push({ x: e + Math.cos(r) * o, y: t + Math.sin(r) * o });
467
+ }
468
+ return h;
469
+ }
470
+ function ot(e) {
471
+ const { path: t } = e, o = t.map((i) => i.x), l = t.map((i) => i.y), n = Math.min(...o), s = Math.min(...l), h = e.hand === !1 ? void 0 : e.hand === !0 || e.hand === void 0 ? {} : e.hand;
472
+ return {
473
+ type: "custom",
474
+ x: n,
475
+ y: s,
476
+ width: Math.max(1, Math.max(...o) - n),
477
+ height: Math.max(1, Math.max(...l) - s),
478
+ props: { draw: 0 },
479
+ draw(i, r, a) {
480
+ const f = Math.min(1, Math.max(0, Number(r.props?.draw ?? 0)));
481
+ i.translate(-n, -s), i.strokeStyle = e.color ?? "#2f2f33", i.lineWidth = e.lineWidth ?? 5, i.lineCap = "round", i.lineJoin = "round";
482
+ const y = e.sketch ? X(i, e.sketch, a) : void 0;
483
+ f > 0 && (y ? e.smooth ? y.curve(t, f) : y.line(t, f) : we(i, oe(t, f))), h && f > 0 && f < 1 && ge(i, ne(t, f), h, y);
484
+ }
485
+ };
486
+ }
487
+ function we(e, t, o) {
488
+ if (!(t.length < 2)) {
489
+ if (o) return o.line(t);
490
+ e.beginPath(), e.moveTo(t[0].x, t[0].y);
491
+ for (const l of t.slice(1)) e.lineTo(l.x, l.y);
492
+ e.stroke();
493
+ }
494
+ }
495
+ const F = 1e5;
496
+ function nt(e, t, o, l, n = 6) {
497
+ const s = [], h = Math.max(1, Math.round(n));
498
+ for (let i = 0; i <= h; i++)
499
+ s.push({ x: i % 2 === 0 ? e : e + o, y: t + l * i / h });
500
+ return s;
501
+ }
502
+ function be(e, t, o, l) {
503
+ if (l <= 0 || t.length === 0) return;
504
+ const n = oe(t, l), s = o / 2, h = (i) => {
505
+ e.beginPath(), e.rect(-F, -F, 2 * F, 2 * F), i(), e.clip("evenodd");
506
+ };
507
+ for (const i of n)
508
+ h(() => {
509
+ e.moveTo(i.x + s, i.y), e.arc(i.x, i.y, s, 0, Math.PI * 2);
510
+ });
511
+ for (let i = 1; i < n.length; i++) {
512
+ const r = n[i - 1], a = n[i], f = Math.hypot(a.x - r.x, a.y - r.y);
513
+ if (f === 0) continue;
514
+ const y = -(a.y - r.y) / f * s, w = (a.x - r.x) / f * s;
515
+ h(() => {
516
+ e.moveTo(r.x + y, r.y + w), e.lineTo(a.x + y, a.y + w), e.lineTo(a.x - y, a.y - w), e.lineTo(r.x - y, r.y - w), e.closePath();
517
+ });
518
+ }
519
+ }
520
+ function lt(e, t, o, l, n) {
521
+ e.save(), be(e, t, o, l), n(), e.restore();
522
+ }
523
+ function rt(e, t) {
524
+ const o = t.width ?? 40, l = t.hand === !0 ? {} : t.hand || void 0, n = t.eraser === !1 ? void 0 : t.eraser === !0 || t.eraser === void 0 ? {} : t.eraser;
525
+ return {
526
+ ...e,
527
+ props: { ...e.props, erase: 0 },
528
+ draw(s, h, i) {
529
+ const r = Number(h.props?.erase ?? 0);
530
+ if (s.save(), be(s, t.path, o, r), e.draw(s, h, i), s.restore(), !n || r <= 0 || r >= 1) return;
531
+ const a = ne(t.path, r);
532
+ l ? ge(s, a, { ...l, tool: "eraser" }) : me(s, a, n);
533
+ }
534
+ };
535
+ }
198
536
  export {
199
- b as EXPRESSIONS,
200
- A as POSES,
201
- k as REST_POSE,
202
- O as blendPose,
203
- D as drawStickFigure,
204
- p as pose,
205
- J as poseTracks,
206
- $ as stickFigureTarget,
207
- U as strideLength,
208
- K as talkingMouth,
209
- F as walkPose,
210
- R as withExpression
537
+ H as EXPRESSIONS,
538
+ pe as POSES,
539
+ Y as REST_POSE,
540
+ Me as blendPose,
541
+ ht as boilFrame,
542
+ tt as circlePath,
543
+ be as clipErased,
544
+ me as drawEraser,
545
+ ge as drawHand,
546
+ Je as drawPencil,
547
+ Ge as drawStickFigure,
548
+ ot as drawnPathTarget,
549
+ rt as erasable,
550
+ $e as headPoint,
551
+ qe as jointsToScene,
552
+ oe as partialPath,
553
+ at as pathLength,
554
+ ne as pointAlong,
555
+ P as pose,
556
+ et as poseTracks,
557
+ ue as resolveStickPose,
558
+ U as rubberLimb,
559
+ nt as scrubPath,
560
+ Ze as seatHeight,
561
+ X as sketchPen,
562
+ je as stickFigureAt,
563
+ De as stickFigureJoints,
564
+ Ve as stickFigureTarget,
565
+ Qe as strideLength,
566
+ ke as talkingMouth,
567
+ Ue as taperedLine,
568
+ Te as walkPose,
569
+ lt as withErased,
570
+ Ee as withExpression
211
571
  };