voice-ring 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +3 -3
- package/dist/index.d.ts +3 -0
- package/dist/index.es.js +465 -459
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useState as Bt, useEffect as It, useRef as
|
|
1
|
+
import { jsx as Xn } from "react/jsx-runtime";
|
|
2
|
+
import { useState as Bt, useEffect as It, useRef as St, useCallback as Gn } from "react";
|
|
3
3
|
let Ut = null;
|
|
4
|
-
function
|
|
4
|
+
function Vn() {
|
|
5
5
|
if (typeof window > "u") return null;
|
|
6
6
|
const t = window;
|
|
7
7
|
return t.AudioContext ?? t.webkitAudioContext ?? null;
|
|
8
8
|
}
|
|
9
|
-
function
|
|
10
|
-
return
|
|
9
|
+
function Re() {
|
|
10
|
+
return Vn() != null;
|
|
11
11
|
}
|
|
12
|
-
function
|
|
13
|
-
const t =
|
|
12
|
+
function Hn() {
|
|
13
|
+
const t = Vn();
|
|
14
14
|
return t ? (Ut || (Ut = new t()), Ut.state === "suspended" && Ut.resume().catch(() => {
|
|
15
15
|
}), Ut) : null;
|
|
16
16
|
}
|
|
17
17
|
const fn = /* @__PURE__ */ new WeakMap();
|
|
18
|
-
function
|
|
19
|
-
const n =
|
|
18
|
+
function ps(t) {
|
|
19
|
+
const n = Hn();
|
|
20
20
|
if (!n || t.getAudioTracks().length === 0) return null;
|
|
21
21
|
let e = fn.get(t);
|
|
22
22
|
e || (e = { node: n.createMediaStreamSource(t), refs: 0 }, fn.set(t, e)), e.refs += 1;
|
|
@@ -47,48 +47,48 @@ const tn = {
|
|
|
47
47
|
positive: { r: 92, g: 224, b: 150 },
|
|
48
48
|
negative: { r: 255, g: 104, b: 104 },
|
|
49
49
|
calm: { r: 104, g: 162, b: 255 }
|
|
50
|
-
},
|
|
50
|
+
}, ms = {
|
|
51
51
|
green: tn.positive,
|
|
52
52
|
red: tn.negative,
|
|
53
53
|
blue: tn.calm
|
|
54
|
-
},
|
|
55
|
-
class
|
|
54
|
+
}, Ms = 0.7, gs = 1.1, bs = 0.6;
|
|
55
|
+
class vs {
|
|
56
56
|
constructor() {
|
|
57
57
|
this.glow = { r: 0, g: 0, b: 0, amount: 0, t: 0, size: 0 };
|
|
58
58
|
}
|
|
59
59
|
/** Advance toward `target` (null: fade out). `still` jumps straight there. */
|
|
60
|
-
step(n, e, s, o,
|
|
61
|
-
const
|
|
62
|
-
if (
|
|
63
|
-
const a =
|
|
64
|
-
|
|
60
|
+
step(n, e, s, o, c) {
|
|
61
|
+
const r = this.glow, l = (a) => c ? 1 : 1 - Math.exp(-n / a), i = e ? 1 : 0;
|
|
62
|
+
if (r.amount += (i - r.amount) * l(i > r.amount ? Ms : gs), e) {
|
|
63
|
+
const a = r.amount < 0.03 ? 1 : l(bs);
|
|
64
|
+
r.r += (e.r - r.r) * a, r.g += (e.g - r.g) * a, r.b += (e.b - r.b) * a;
|
|
65
65
|
}
|
|
66
|
-
return
|
|
66
|
+
return r.t = s, r.size = o, r;
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
const Kn = (t, n) => {
|
|
70
70
|
var e;
|
|
71
71
|
return ((e = t.light) == null ? void 0 : e.r) ?? n * 0.28;
|
|
72
72
|
};
|
|
73
|
-
function
|
|
74
|
-
const o = (Kn(t, n) * 0.7) ** 2,
|
|
75
|
-
const a = e.x - l,
|
|
76
|
-
return [l + a * h, i +
|
|
73
|
+
function xs(t, n, e) {
|
|
74
|
+
const o = (Kn(t, n) * 0.7) ** 2, c = 0.9 * Math.min(1, Math.max(0, e.amount)), r = (l, i) => {
|
|
75
|
+
const a = e.x - l, d = e.y - i, h = c * Math.exp(-(a * a + d * d) / o);
|
|
76
|
+
return [l + a * h, i + d * h];
|
|
77
77
|
};
|
|
78
78
|
return {
|
|
79
79
|
...t,
|
|
80
80
|
strokes: t.strokes.map((l) => {
|
|
81
81
|
const i = l.pts.slice();
|
|
82
|
-
for (let a = 0; a < i.length; a += 2) [i[a], i[a + 1]] =
|
|
82
|
+
for (let a = 0; a < i.length; a += 2) [i[a], i[a + 1]] = r(i[a], i[a + 1]);
|
|
83
83
|
return { ...l, pts: i };
|
|
84
84
|
}),
|
|
85
85
|
dots: t.dots.map((l) => {
|
|
86
|
-
const [i, a] =
|
|
86
|
+
const [i, a] = r(l.x, l.y);
|
|
87
87
|
return { ...l, x: i, y: a };
|
|
88
88
|
})
|
|
89
89
|
};
|
|
90
90
|
}
|
|
91
|
-
const
|
|
91
|
+
const ys = (t, n) => Math.min(1, Math.max(0, (0.8 * n - t) / (0.6 * n))), bt = {
|
|
92
92
|
move: 2,
|
|
93
93
|
pull: 0.7,
|
|
94
94
|
deform: 0.1,
|
|
@@ -99,11 +99,11 @@ const xs = (t, n) => Math.min(1, Math.max(0, (0.8 * n - t) / (0.6 * n))), bt = {
|
|
|
99
99
|
blur: 1,
|
|
100
100
|
bounce: 1
|
|
101
101
|
};
|
|
102
|
-
function
|
|
102
|
+
function ws(t, n) {
|
|
103
103
|
const e = Math.abs(t.move) + Math.abs(t.pull) + 2 * Math.abs(t.deform);
|
|
104
104
|
return e === 0 ? 0 : Math.ceil(n * 0.36 * e) + 2;
|
|
105
105
|
}
|
|
106
|
-
class
|
|
106
|
+
class Es {
|
|
107
107
|
constructor() {
|
|
108
108
|
this.x = 0, this.v = 0, this.landed = !1;
|
|
109
109
|
}
|
|
@@ -113,75 +113,75 @@ class ws {
|
|
|
113
113
|
* never backs off the edge before it has pressed into it.
|
|
114
114
|
*/
|
|
115
115
|
step(n, e) {
|
|
116
|
-
const
|
|
117
|
-
for (let i = 0; i <
|
|
118
|
-
this.v += (15 * 15 * (n - this.x) - 2 * 0.3 * 15 * this.v) *
|
|
116
|
+
const c = Math.max(1, Math.ceil(e * 240)), r = e / c;
|
|
117
|
+
for (let i = 0; i < c; i++)
|
|
118
|
+
this.v += (15 * 15 * (n - this.x) - 2 * 0.3 * 15 * this.v) * r, this.x += this.v * r;
|
|
119
119
|
const l = this.x - n;
|
|
120
120
|
return n <= 0 ? this.landed = !1 : l >= 0 && (this.landed = !0), l < 0 && !this.landed ? 0 : l;
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
|
-
function Ss(t, n, e, s, o = [1 / 0, 1 / 0],
|
|
123
|
+
function Ss(t, n, e, s, o = [1 / 0, 1 / 0], c = 0) {
|
|
124
124
|
if (Math.abs(n) < 2e-3 || s.move === 0 && s.pull === 0 && s.deform === 0) return t;
|
|
125
|
-
const
|
|
126
|
-
const y = (b -
|
|
127
|
-
return n * l * (s.move + s.pull * R * R + s.deform *
|
|
128
|
-
}, h = Math.max(0, Math.min(2, s.lens ?? 1)), f = l * 0.9, m = i > 0 ? o[1] : o[0],
|
|
129
|
-
let M = 1, v = 1 / 0,
|
|
125
|
+
const r = e / 2, l = e * 0.36, i = n < 0 ? -1 : 1, a = Math.abs(n), d = (b, E) => {
|
|
126
|
+
const y = (b - r) / l, I = (E - r) / l, R = Math.max(0, Math.min(1, (y * i + 1) / 2)), G = Math.max(0, y * i);
|
|
127
|
+
return n * l * (s.move + s.pull * R * R + s.deform * G * G * Math.exp(-I * I * 1.5));
|
|
128
|
+
}, h = Math.max(0, Math.min(2, s.lens ?? 1)), f = l * 0.9, m = i > 0 ? o[1] : o[0], p = Number.isFinite(m) ? Math.min(f * 0.45, l * 0.3 * h * Math.max(0, s.stretch ?? 1)) : 0;
|
|
129
|
+
let M = 1, v = 1 / 0, A = 1;
|
|
130
130
|
if (Number.isFinite(m)) {
|
|
131
131
|
v = i > 0 ? e + m : -m;
|
|
132
|
-
const b = (
|
|
133
|
-
|
|
134
|
-
const R =
|
|
135
|
-
R > 1e-9 && (M = Math.min(M, Math.max(0, ((v -
|
|
132
|
+
const b = (E, y, I) => {
|
|
133
|
+
A = Math.max(A, I);
|
|
134
|
+
const R = d(E, y) * i;
|
|
135
|
+
R > 1e-9 && (M = Math.min(M, Math.max(0, ((v - E) * i - I - p) / R)));
|
|
136
136
|
};
|
|
137
|
-
for (const
|
|
138
|
-
for (const
|
|
137
|
+
for (const E of t.dots) b(E.x, E.y, E.r);
|
|
138
|
+
for (const E of t.strokes) for (let y = 0; y < E.pts.length; y += 2) b(E.pts[y], E.pts[y + 1], 1);
|
|
139
139
|
}
|
|
140
|
-
const u = M < 1 ? Math.min(1, (1 - M) / 0.35) : 0, g = u > 0 ?
|
|
141
|
-
let k = 1 / 0,
|
|
142
|
-
const U = (b,
|
|
143
|
-
const y = Math.max(0, Math.min(1, ((b -
|
|
144
|
-
let R = b +
|
|
140
|
+
const u = M < 1 ? Math.min(1, (1 - M) / 0.35) : 0, g = u > 0 ? c * (s.bounce ?? 1) : 0, x = Math.min(1.4, u + Math.max(0, g)), B = l * 0.12 * Math.max(0, -g), S = v - i * A, L = S - i * p, w = l * 0.55 * x * (s.squash ?? 0);
|
|
141
|
+
let k = 1 / 0, _ = -1 / 0, q = !0;
|
|
142
|
+
const U = (b, E) => {
|
|
143
|
+
const y = Math.max(0, Math.min(1, ((b - r) / l * i + 1) / 2)), I = 1 - 0.15 * s.deform * a * M * y;
|
|
144
|
+
let R = b + d(b, E) * M + i * (w * 0.5 - B), G = r + (E - r) * I;
|
|
145
145
|
if (w > 0) {
|
|
146
|
-
const C = (R - (
|
|
146
|
+
const C = (R - (L - i * w)) * i;
|
|
147
147
|
if (C > 0) {
|
|
148
148
|
const F = C / w, T = w * (F / Math.sqrt(1 + F * F));
|
|
149
|
-
R =
|
|
149
|
+
R = L - i * w + i * T, G = r + (G - r) * (1 + 0.18 * x * (s.squash ?? 0) * (T / w));
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
|
-
return
|
|
152
|
+
return q && (L - R) * i < Math.max(w, f * 0.3) && (k = Math.min(k, G), _ = Math.max(_, G)), [R, G];
|
|
153
153
|
};
|
|
154
154
|
for (const b of t.dots)
|
|
155
155
|
[b.x, b.y] = U(b.x, b.y);
|
|
156
156
|
for (const b of t.strokes)
|
|
157
|
-
for (let
|
|
158
|
-
const [y, I] = U(b.pts[
|
|
159
|
-
b.pts[
|
|
157
|
+
for (let E = 0; E < b.pts.length; E += 2) {
|
|
158
|
+
const [y, I] = U(b.pts[E], b.pts[E + 1]);
|
|
159
|
+
b.pts[E] = y, b.pts[E + 1] = I;
|
|
160
160
|
}
|
|
161
|
-
if (u > 0 &&
|
|
161
|
+
if (u > 0 && _ > k) {
|
|
162
162
|
const b = h * x;
|
|
163
163
|
t.contact = {
|
|
164
164
|
side: i,
|
|
165
|
-
x:
|
|
165
|
+
x: S,
|
|
166
166
|
y0: k,
|
|
167
|
-
y1:
|
|
167
|
+
y1: _,
|
|
168
168
|
depth: w,
|
|
169
169
|
press: u,
|
|
170
170
|
lens: b > 0.02 ? {
|
|
171
171
|
zone: f,
|
|
172
172
|
// drawn across the gap as it presses, all the way at full press
|
|
173
|
-
gap:
|
|
173
|
+
gap: p * Math.min(1, x),
|
|
174
174
|
flare: 0.22 * b * Math.max(0, s.stretch ?? 1),
|
|
175
175
|
split: f * 0.1 * b * Math.max(0, s.split ?? 1),
|
|
176
176
|
blur: f * 0.075 * b * Math.max(0, s.blur ?? 1),
|
|
177
|
-
cy:
|
|
177
|
+
cy: r
|
|
178
178
|
} : void 0
|
|
179
179
|
};
|
|
180
180
|
}
|
|
181
|
-
if (
|
|
181
|
+
if (q = !1, t.light) {
|
|
182
182
|
const b = t.light;
|
|
183
183
|
[b.cx, b.cy] = U(b.cx, b.cy);
|
|
184
|
-
for (const
|
|
184
|
+
for (const E of b.spec) [E.x, E.y] = U(E.x, E.y);
|
|
185
185
|
}
|
|
186
186
|
return t;
|
|
187
187
|
}
|
|
@@ -196,170 +196,175 @@ function wn(t, n, e) {
|
|
|
196
196
|
const s = j((e - t) / (n - t));
|
|
197
197
|
return s * s * (3 - 2 * s);
|
|
198
198
|
}
|
|
199
|
-
const jt = (t) => t < 1e-6 ? 1 : Math.sin(t) / t,
|
|
200
|
-
function
|
|
201
|
-
const o = 1 / Math.max(0.05, s),
|
|
202
|
-
return (
|
|
199
|
+
const jt = (t) => t < 1e-6 ? 1 : Math.sin(t) / t, Ts = Math.hypot(2.1, 1.3), Rs = Math.hypot(1.9, 1.7), As = Math.hypot(4.3 - 2.9, -3.7, -3.1), _s = Math.hypot(4.3 + 2.9, 3.7, -3.1);
|
|
200
|
+
function En(t, n, e, s = 1) {
|
|
201
|
+
const o = 1 / Math.max(0.05, s), c = 0.9 * e, r = -0.7 * e + 1.3, l = 2.1 * e, i = -1.6 * e, a = t * (0.55 * Math.sin(c) * jt(Ts * o) + 0.45 * Math.sin(r) * jt(Rs * o)) + n * 0.5 * (Math.cos(l - i) * jt(As * o) - Math.cos(l + i) * jt(_s * o));
|
|
202
|
+
return (d, h, f) => (d *= o, h *= o, f *= o, t * (0.55 * Math.sin(2.1 * d + 1.3 * h + c) + 0.45 * Math.sin(1.7 * f - 1.9 * h + r)) + n * Math.sin(4.3 * d - 3.1 * f + l) * Math.sin(3.7 * h + 2.9 * d + i) - a);
|
|
203
203
|
}
|
|
204
204
|
function Tt(t, n) {
|
|
205
205
|
const e = Math.sin(t * 12.9898 + n * 78.233) * 43758.5453;
|
|
206
206
|
return e - Math.floor(e);
|
|
207
207
|
}
|
|
208
|
-
function
|
|
208
|
+
function Et(t, n, e) {
|
|
209
209
|
const s = Math.sin(t * 127.1 + n * 311.7 + e * 74.7) * 43758.5453;
|
|
210
210
|
return s - Math.floor(s);
|
|
211
211
|
}
|
|
212
212
|
function zt(t, n, e) {
|
|
213
|
-
const s = Math.floor(t), o = Math.floor(n),
|
|
214
|
-
let
|
|
215
|
-
|
|
216
|
-
const a = Ct(
|
|
217
|
-
return Ct(Ct(a,
|
|
213
|
+
const s = Math.floor(t), o = Math.floor(n), c = Math.floor(e);
|
|
214
|
+
let r = t - s, l = n - o, i = e - c;
|
|
215
|
+
r = r * r * (3 - 2 * r), l = l * l * (3 - 2 * l), i = i * i * (3 - 2 * i);
|
|
216
|
+
const a = Ct(Et(s, o, c), Et(s + 1, o, c), r), d = Ct(Et(s, o + 1, c), Et(s + 1, o + 1, c), r), h = Ct(Et(s, o, c + 1), Et(s + 1, o, c + 1), r), f = Ct(Et(s, o + 1, c + 1), Et(s + 1, o + 1, c + 1), r);
|
|
217
|
+
return Ct(Ct(a, d, l), Ct(h, f, l), i);
|
|
218
218
|
}
|
|
219
|
-
function
|
|
220
|
-
const e = Math.PI * (3 - Math.sqrt(5)), s = 1 - 2 * (t + 0.5) / n, o = Math.sqrt(1 - s * s),
|
|
221
|
-
return [o * Math.cos(
|
|
219
|
+
function Sn(t, n) {
|
|
220
|
+
const e = Math.PI * (3 - Math.sqrt(5)), s = 1 - 2 * (t + 0.5) / n, o = Math.sqrt(1 - s * s), c = t * e;
|
|
221
|
+
return [o * Math.cos(c), s, o * Math.sin(c)];
|
|
222
222
|
}
|
|
223
223
|
function nn(t, n, e, s, o) {
|
|
224
|
-
const
|
|
225
|
-
return (a,
|
|
226
|
-
const f = a * i + h * l, m = -a * l + h * i,
|
|
227
|
-
return [e + f * o, s -
|
|
224
|
+
const c = Math.sin(n), r = Math.cos(n), l = Math.sin(t), i = Math.cos(t);
|
|
225
|
+
return (a, d, h) => {
|
|
226
|
+
const f = a * i + h * l, m = -a * l + h * i, p = d * r - m * c, M = d * c + m * r;
|
|
227
|
+
return [e + f * o, s - p * o, M];
|
|
228
228
|
};
|
|
229
229
|
}
|
|
230
230
|
function $t(t, n = 0.6) {
|
|
231
231
|
return (t / 200) ** n;
|
|
232
232
|
}
|
|
233
|
-
function
|
|
233
|
+
function Gt(t, n, e = 0.3) {
|
|
234
234
|
const s = [];
|
|
235
235
|
for (const o of t)
|
|
236
236
|
(o.a ?? 1) < 0.02 || (o.r = Math.max(e, o.r), s.push(o));
|
|
237
|
-
return s.sort((o,
|
|
237
|
+
return s.sort((o, c) => o.z - c.z), { dots: s, strokes: n };
|
|
238
238
|
}
|
|
239
239
|
const Zt = 32;
|
|
240
240
|
function Ps(t, n = 0, e = 0, s = 1) {
|
|
241
|
-
const o = t.r / 255,
|
|
242
|
-
let a = (l + i) / 2,
|
|
241
|
+
const o = t.r / 255, c = t.g / 255, r = t.b / 255, l = Math.max(o, c, r), i = Math.min(o, c, r);
|
|
242
|
+
let a = (l + i) / 2, d = l === i ? 0 : (l - i) / (1 - Math.abs(2 * a - 1)), h = 0;
|
|
243
243
|
if (l !== i) {
|
|
244
244
|
const M = l - i;
|
|
245
|
-
h = l === o ? (
|
|
245
|
+
h = l === o ? (c - r) / M % 6 : l === c ? (r - o) / M + 2 : (o - c) / M + 4, h *= 60;
|
|
246
246
|
}
|
|
247
|
-
h = ((h + n) % 360 + 360) % 360,
|
|
248
|
-
const f = (M) => (M + h / 30) % 12, m =
|
|
249
|
-
return [Math.round(
|
|
247
|
+
h = ((h + n) % 360 + 360) % 360, d = Math.min(1, d * (1 + e)), a = 0.5 + (a - 0.5) * (1 - 0.6 * e), a = Math.max(0, Math.min(1, a * s));
|
|
248
|
+
const f = (M) => (M + h / 30) % 12, m = d * Math.min(a, 1 - a), p = (M) => a - m * Math.max(-1, Math.min(f(M) - 3, 9 - f(M), 1));
|
|
249
|
+
return [Math.round(p(0) * 255), Math.round(p(8) * 255), Math.round(p(4) * 255)];
|
|
250
250
|
}
|
|
251
|
-
function
|
|
252
|
-
const n = Math.max(0, Math.min(1, t.saturation)), e = Math.max(0, Math.min(1, t.neutral)), s = t.start ?? 0.1, o = Math.max(0.05, t.width ?? 0.6),
|
|
251
|
+
function ks(t) {
|
|
252
|
+
const n = Math.max(0, Math.min(1, t.saturation)), e = Math.max(0, Math.min(1, t.neutral)), s = t.start ?? 0.1, o = Math.max(0.05, t.width ?? 0.6), c = [];
|
|
253
253
|
for (let h = 0; h < Zt; h++) {
|
|
254
|
-
const f = h / (Zt - 1), m = Math.max(0, Math.min(1, (f - s) / o)),
|
|
255
|
-
|
|
254
|
+
const f = h / (Zt - 1), m = Math.max(0, Math.min(1, (f - s) / o)), p = m * m * (3 - 2 * m);
|
|
255
|
+
c.push(n * (1 - e * (1 - p)));
|
|
256
256
|
}
|
|
257
|
-
const
|
|
257
|
+
const r = t.angle * Math.PI / 180, l = Math.cos(r), i = Math.sin(r), a = t.size / 2, d = t.size * 0.8;
|
|
258
258
|
return {
|
|
259
259
|
rgb: Ps(t.accent, t.hue, Math.max(0, Math.min(1, t.vivid ?? 0)), t.brightness),
|
|
260
|
-
mix:
|
|
260
|
+
mix: c,
|
|
261
261
|
saturation: n,
|
|
262
262
|
at: (h, f) => {
|
|
263
|
-
const m = ((h - a) * l + (f - a) * i) /
|
|
263
|
+
const m = ((h - a) * l + (f - a) * i) / d + 0.5;
|
|
264
264
|
return Math.max(0, Math.min(Zt - 1, Math.round(m * (Zt - 1))));
|
|
265
265
|
}
|
|
266
266
|
};
|
|
267
267
|
}
|
|
268
|
-
const
|
|
268
|
+
const Cs = [120, 232, 214], Fs = [64, 72, 255];
|
|
269
269
|
function Dn(t, n, e) {
|
|
270
270
|
t /= 255, n /= 255, e /= 255;
|
|
271
|
-
const s = Math.max(t, n, e), o = Math.min(t, n, e),
|
|
272
|
-
if (s === o) return [0, 0,
|
|
273
|
-
const
|
|
274
|
-
return [(s === t ? (n - e) /
|
|
271
|
+
const s = Math.max(t, n, e), o = Math.min(t, n, e), c = (s + o) / 2;
|
|
272
|
+
if (s === o) return [0, 0, c];
|
|
273
|
+
const r = s - o, l = c > 0.5 ? r / (2 - s - o) : r / (s + o);
|
|
274
|
+
return [(s === t ? (n - e) / r + (n < e ? 6 : 0) : s === n ? (e - t) / r + 2 : (t - n) / r + 4) / 6, l, c];
|
|
275
275
|
}
|
|
276
|
-
function
|
|
277
|
-
const s = (
|
|
278
|
-
return [
|
|
276
|
+
function Is(t, n, e) {
|
|
277
|
+
const s = (r) => (r + t * 12) % 12, o = n * Math.min(e, 1 - e), c = (r) => e - o * Math.max(-1, Math.min(s(r) - 3, 9 - s(r), 1));
|
|
278
|
+
return [c(0) * 255, c(8) * 255, c(4) * 255];
|
|
279
279
|
}
|
|
280
|
-
const dn = (t) => (t /= 255) <= 0.04045 ? t / 12.92 : ((t + 0.055) / 1.055) ** 2.4,
|
|
280
|
+
const dn = (t) => (t /= 255) <= 0.04045 ? t / 12.92 : ((t + 0.055) / 1.055) ** 2.4, Ns = (t) => 255 * (t <= 31308e-7 ? 12.92 * t : 1.055 * Math.max(0, t) ** (1 / 2.4) - 0.055);
|
|
281
281
|
function yn(t, n, e) {
|
|
282
|
-
const [s, o,
|
|
282
|
+
const [s, o, c] = [dn(t), dn(n), dn(e)], r = Math.cbrt(0.4122214708 * s + 0.5363325363 * o + 0.0514459929 * c), l = Math.cbrt(0.2119034982 * s + 0.6806995451 * o + 0.1073969566 * c), i = Math.cbrt(0.0883024619 * s + 0.2817188376 * o + 0.6299787005 * c);
|
|
283
283
|
return [
|
|
284
|
-
0.2104542553 *
|
|
285
|
-
1.9779984951 *
|
|
286
|
-
0.0259040371 *
|
|
284
|
+
0.2104542553 * r + 0.793617785 * l - 0.0040720468 * i,
|
|
285
|
+
1.9779984951 * r - 2.428592205 * l + 0.4505937099 * i,
|
|
286
|
+
0.0259040371 * r + 0.7827717662 * l - 0.808675766 * i
|
|
287
287
|
];
|
|
288
288
|
}
|
|
289
|
-
function
|
|
290
|
-
const s = (t + 0.3963377774 * n + 0.2158037573 * e) ** 3, o = (t - 0.1055613458 * n - 0.0638541728 * e) ** 3,
|
|
289
|
+
function Yn(t, n, e) {
|
|
290
|
+
const s = (t + 0.3963377774 * n + 0.2158037573 * e) ** 3, o = (t - 0.1055613458 * n - 0.0638541728 * e) ** 3, c = (t - 0.0894841775 * n - 1.291485548 * e) ** 3, r = (l) => Math.max(0, Math.min(255, Ns(l)));
|
|
291
291
|
return [
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
292
|
+
r(4.0767416621 * s - 3.3077115913 * o + 0.2309699292 * c),
|
|
293
|
+
r(-1.2684380046 * s + 2.6097574011 * o - 0.3413193965 * c),
|
|
294
|
+
r(-0.0041960863 * s - 0.7034186147 * o + 1.707614701 * c)
|
|
295
295
|
];
|
|
296
296
|
}
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
297
|
+
const Bs = 146 / 360, Gs = [81, 136], Ln = 0.1;
|
|
298
|
+
function Ds(t, n = Gs) {
|
|
299
|
+
const e = (n[0] + n[1]) / 720, s = (n[1] - n[0]) / 720, o = Math.abs((t - Bs + 1.5) % 1 - 0.5), c = Math.max(0, 1 - o / (40 / 360));
|
|
300
|
+
return [t + (e - t) * c, Ln + (s - Ln) * c];
|
|
301
|
+
}
|
|
302
|
+
function Ls(t, n, e, s, o) {
|
|
303
|
+
const c = s && s.amount > 5e-3 ? s : void 0;
|
|
304
|
+
return t.map(([r, l, i, a]) => {
|
|
305
|
+
if (e && (l += (e.r - l) * 0.85, i += (e.g - i) * 0.85, a += (e.b - a) * 0.85), c) {
|
|
306
|
+
const [, h, f] = Dn(l, i, a), [m, p] = Ds(Dn(c.r, c.g, c.b)[0], o), M = Is((m + p * Math.sin(2 * Math.PI * r) + 1) % 1, h, f), v = yn(l, i, a), A = yn(M[0], M[1], M[2]), u = c.amount;
|
|
307
|
+
[l, i, a] = Yn(v[0] + (A[0] - v[0]) * u, v[1] + (A[1] - v[1]) * u, v[2] + (A[2] - v[2]) * u);
|
|
303
308
|
}
|
|
304
|
-
const
|
|
305
|
-
return [r,
|
|
309
|
+
const d = n ? 1 : 0.82;
|
|
310
|
+
return [r, l * d, i * d, a * d];
|
|
306
311
|
});
|
|
307
312
|
}
|
|
308
|
-
const
|
|
309
|
-
function
|
|
313
|
+
const jn = (t, n, e) => `rgb(${Math.round(t)},${Math.round(n)},${Math.round(e)})`;
|
|
314
|
+
function qs(t, n = 36) {
|
|
310
315
|
const e = t.filter(([a]) => a < 1), s = e.length;
|
|
311
316
|
if (s < 3) return t;
|
|
312
|
-
const o = e.map(([, a,
|
|
313
|
-
const
|
|
314
|
-
return o[
|
|
317
|
+
const o = e.map(([, a, d, h]) => yn(a, d, h)), c = (a) => (a % s + s) % s, r = (a) => e[c(a)][0] + Math.floor(a / s), l = (a) => {
|
|
318
|
+
const d = r(a + 1) - r(a - 1);
|
|
319
|
+
return o[c(a + 1)].map((h, f) => (h - o[c(a - 1)][f]) / d);
|
|
315
320
|
}, i = [];
|
|
316
321
|
for (let a = 0; a <= n; a++) {
|
|
317
|
-
const
|
|
322
|
+
const d = a / n;
|
|
318
323
|
let h = -1;
|
|
319
|
-
for (; h < s - 1 &&
|
|
320
|
-
const f =
|
|
321
|
-
(w) => (2 * M - 3 *
|
|
322
|
-
), [B,
|
|
323
|
-
i.push([
|
|
324
|
+
for (; h < s - 1 && r(h + 1) <= d; ) h++;
|
|
325
|
+
const f = r(h + 1) - r(h), m = (d - r(h)) / f, p = m * m, M = p * m, v = o[c(h)], A = o[c(h + 1)], u = l(h), g = l(h + 1), x = [0, 1, 2].map(
|
|
326
|
+
(w) => (2 * M - 3 * p + 1) * v[w] + (M - 2 * p + m) * f * u[w] + (-2 * M + 3 * p) * A[w] + (M - p) * f * g[w]
|
|
327
|
+
), [B, S, L] = Yn(x[0], x[1], x[2]);
|
|
328
|
+
i.push([d, B, S, L]);
|
|
324
329
|
}
|
|
325
330
|
return i;
|
|
326
331
|
}
|
|
327
|
-
const
|
|
332
|
+
const Os = 1.5, Zn = typeof CanvasRenderingContext2D == "function" && "filter" in CanvasRenderingContext2D.prototype, qn = /* @__PURE__ */ new WeakMap();
|
|
328
333
|
function pn(t, n) {
|
|
329
334
|
return (typeof OffscreenCanvas == "function" ? new OffscreenCanvas(t, n) : Object.assign(document.createElement("canvas"), { width: t, height: n })).getContext("2d");
|
|
330
335
|
}
|
|
331
|
-
function
|
|
336
|
+
function Us(t) {
|
|
332
337
|
const { width: n, height: e } = t.canvas;
|
|
333
338
|
let s = qn.get(t);
|
|
334
|
-
return (!s || s.full.canvas.width !== n || s.full.canvas.height !== e) && (s = { full: pn(n, e) },
|
|
339
|
+
return (!s || s.full.canvas.width !== n || s.full.canvas.height !== e) && (s = { full: pn(n, e) }, Zn || (s.half = pn(Math.ceil(n / 2), Math.ceil(e / 2)), s.quarter = pn(Math.ceil(n / 4), Math.ceil(e / 4))), qn.set(t, s)), s.full.setTransform(1, 0, 0, 1, 0, 0), s.full.clearRect(0, 0, n, e), s.full.setTransform(t.getTransform()), s;
|
|
335
340
|
}
|
|
336
341
|
function mn(t, n) {
|
|
337
342
|
t.globalCompositeOperation = "copy", t.imageSmoothingEnabled = !0, t.imageSmoothingQuality = "high", t.drawImage(n.canvas, 0, 0, t.canvas.width, t.canvas.height);
|
|
338
343
|
}
|
|
339
|
-
function
|
|
344
|
+
function zs(t, n, e) {
|
|
340
345
|
const s = t.getTransform();
|
|
341
|
-
t.save(), t.setTransform(1, 0, 0, 1, 0, 0), t.globalCompositeOperation = e, t.globalAlpha = 1, t.imageSmoothingEnabled = !0, t.imageSmoothingQuality = "high",
|
|
346
|
+
t.save(), t.setTransform(1, 0, 0, 1, 0, 0), t.globalCompositeOperation = e, t.globalAlpha = 1, t.imageSmoothingEnabled = !0, t.imageSmoothingQuality = "high", Zn ? (t.filter = `blur(${Os * Math.hypot(s.a, s.b)}px)`, t.drawImage(n.full.canvas, 0, 0)) : n.half && n.quarter && (mn(n.half, n.full), mn(n.quarter, n.half), mn(n.half, n.quarter), t.drawImage(n.half.canvas, 0, 0, n.half.canvas.width * 2, n.half.canvas.height * 2)), t.restore();
|
|
342
347
|
}
|
|
343
348
|
function On(t, n, e) {
|
|
344
349
|
const s = typeof t.createConicGradient == "function" ? t.createConicGradient(n.angle, n.cx, n.cy) : t.createLinearGradient(n.cx - n.r, n.cy - n.r, n.cx + n.r, n.cy + n.r);
|
|
345
|
-
for (const [o,
|
|
350
|
+
for (const [o, c, r, l] of e) s.addColorStop(j(o), jn(c, r, l));
|
|
346
351
|
return s;
|
|
347
352
|
}
|
|
348
|
-
function
|
|
349
|
-
const
|
|
353
|
+
function $s(t, n, e, s, o, c) {
|
|
354
|
+
const r = qs(Ls(e.stops, s, o, c, e.green)), l = On(t, e, r), i = n.strokes.map((u) => {
|
|
350
355
|
const g = new Path2D(), x = u.pts.length >> 1;
|
|
351
356
|
let B = 0;
|
|
352
|
-
for (let
|
|
353
|
-
|
|
357
|
+
for (let S = 0; S < x; S++)
|
|
358
|
+
S === 0 ? g.moveTo(u.pts[0], u.pts[1]) : g.lineTo(u.pts[2 * S], u.pts[2 * S + 1]), B += u.a[S];
|
|
354
359
|
return u.closed && g.closePath(), { p: g, a: x ? B / x : 1, w: u.w };
|
|
355
|
-
}), a = Math.max(1, i.length),
|
|
360
|
+
}), a = Math.max(1, i.length), d = e.intensity, h = s ? "lighter" : "source-over", f = (u, g, x = t) => {
|
|
356
361
|
for (const B of i)
|
|
357
362
|
x.lineWidth = u(B.w), x.globalAlpha = j(g(B.a)), x.stroke(B.p);
|
|
358
363
|
}, m = (u, g) => {
|
|
359
364
|
u.lineCap = "round", u.lineJoin = "round", u.globalCompositeOperation = h, u.strokeStyle = g;
|
|
360
|
-
},
|
|
361
|
-
m(M, On(M, e,
|
|
362
|
-
const v = e.halo *
|
|
365
|
+
}, p = Us(t), M = p.full;
|
|
366
|
+
m(M, On(M, e, r));
|
|
367
|
+
const v = e.halo * d * (s ? 1 : 0.2) / a;
|
|
363
368
|
for (const [u, g] of [
|
|
364
369
|
[0.7, 0.045],
|
|
365
370
|
[0.42, 0.075],
|
|
@@ -371,7 +376,7 @@ function Os(t, n, e, s, o, r) {
|
|
|
371
376
|
() => g * v,
|
|
372
377
|
M
|
|
373
378
|
);
|
|
374
|
-
const
|
|
379
|
+
const A = d * (s ? 1 : 0.6);
|
|
375
380
|
for (const [u, g] of [
|
|
376
381
|
[16, 0.05],
|
|
377
382
|
[8, 0.11],
|
|
@@ -379,23 +384,23 @@ function Os(t, n, e, s, o, r) {
|
|
|
379
384
|
])
|
|
380
385
|
f(
|
|
381
386
|
(x) => x * u,
|
|
382
|
-
(x) => g *
|
|
387
|
+
(x) => g * A * x,
|
|
383
388
|
M
|
|
384
389
|
);
|
|
385
|
-
if (
|
|
390
|
+
if (zs(t, p, h), t.save(), m(t, l), s && e.fringe > 0) {
|
|
386
391
|
for (const [u, g, x] of [
|
|
387
|
-
[1 + e.fringe,
|
|
388
|
-
[1 - e.fringe,
|
|
392
|
+
[1 + e.fringe, Cs, 0.16],
|
|
393
|
+
[1 - e.fringe, Fs, 0.22]
|
|
389
394
|
])
|
|
390
|
-
t.save(), t.translate(e.cx, e.cy), t.scale(u, u), t.translate(-e.cx, -e.cy), t.strokeStyle =
|
|
395
|
+
t.save(), t.translate(e.cx, e.cy), t.scale(u, u), t.translate(-e.cx, -e.cy), t.strokeStyle = jn(g[0], g[1], g[2]), f(
|
|
391
396
|
(B) => B * 1.4 / u,
|
|
392
|
-
(B) => x *
|
|
397
|
+
(B) => x * d * B
|
|
393
398
|
), t.restore();
|
|
394
399
|
t.strokeStyle = l;
|
|
395
400
|
}
|
|
396
401
|
if (f(
|
|
397
402
|
(u) => u,
|
|
398
|
-
(u) => 0.7 * u * (0.75 + 0.25 *
|
|
403
|
+
(u) => 0.7 * u * (0.75 + 0.25 * d)
|
|
399
404
|
), s)
|
|
400
405
|
for (const u of e.spec) {
|
|
401
406
|
const g = t.createRadialGradient(u.x, u.y, 0, u.x, u.y, u.r);
|
|
@@ -406,13 +411,13 @@ function Os(t, n, e, s, o, r) {
|
|
|
406
411
|
}
|
|
407
412
|
t.restore();
|
|
408
413
|
}
|
|
409
|
-
const
|
|
414
|
+
const Ws = `
|
|
410
415
|
attribute vec2 aPos;
|
|
411
416
|
varying vec2 vUv;
|
|
412
417
|
void main() {
|
|
413
418
|
vUv = vec2(aPos.x + 1.0, 1.0 - aPos.y) * 0.5;
|
|
414
419
|
gl_Position = vec4(aPos, 0.0, 1.0);
|
|
415
|
-
}`,
|
|
420
|
+
}`, Xs = `
|
|
416
421
|
precision highp float;
|
|
417
422
|
uniform sampler2D uTex;
|
|
418
423
|
uniform vec2 uSize;
|
|
@@ -448,87 +453,87 @@ void main() {
|
|
|
448
453
|
gl_FragColor = vec4(rgb, a) / float(TAPS);
|
|
449
454
|
}`;
|
|
450
455
|
let Jt;
|
|
451
|
-
function
|
|
456
|
+
function Vs() {
|
|
452
457
|
if (typeof document > "u") return null;
|
|
453
458
|
const t = document.createElement("canvas"), n = t.getContext("webgl", { premultipliedAlpha: !0, antialias: !1, depth: !1 });
|
|
454
459
|
if (!n) return null;
|
|
455
460
|
const e = (i, a) => {
|
|
456
|
-
const
|
|
457
|
-
return n.shaderSource(
|
|
461
|
+
const d = n.createShader(i);
|
|
462
|
+
return n.shaderSource(d, a), n.compileShader(d), d;
|
|
458
463
|
}, s = n.createProgram();
|
|
459
|
-
if (n.attachShader(s, e(n.VERTEX_SHADER,
|
|
464
|
+
if (n.attachShader(s, e(n.VERTEX_SHADER, Ws)), n.attachShader(s, e(n.FRAGMENT_SHADER, Xs)), n.linkProgram(s), !n.getProgramParameter(s, n.LINK_STATUS)) return null;
|
|
460
465
|
n.useProgram(s);
|
|
461
466
|
const o = n.createBuffer();
|
|
462
467
|
n.bindBuffer(n.ARRAY_BUFFER, o), n.bufferData(n.ARRAY_BUFFER, new Float32Array([-1, -1, 1, -1, -1, 1, 1, 1]), n.STATIC_DRAW);
|
|
463
|
-
const
|
|
464
|
-
n.enableVertexAttribArray(
|
|
465
|
-
const
|
|
466
|
-
n.bindTexture(n.TEXTURE_2D,
|
|
468
|
+
const c = n.getAttribLocation(s, "aPos");
|
|
469
|
+
n.enableVertexAttribArray(c), n.vertexAttribPointer(c, 2, n.FLOAT, !1, 0, 0);
|
|
470
|
+
const r = n.createTexture();
|
|
471
|
+
n.bindTexture(n.TEXTURE_2D, r), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_WRAP_S, n.CLAMP_TO_EDGE), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_WRAP_T, n.CLAMP_TO_EDGE), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_MIN_FILTER, n.LINEAR), n.texParameteri(n.TEXTURE_2D, n.TEXTURE_MAG_FILTER, n.LINEAR), n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL, !0);
|
|
467
472
|
const l = {};
|
|
468
473
|
for (const i of ["uSize", "uWall", "uSide", "uZone", "uGap", "uFlare", "uSplit", "uBlur", "uCy"])
|
|
469
474
|
l[i] = n.getUniformLocation(s, i);
|
|
470
|
-
return { gl: n, canvas: t, source: document.createElement("canvas"), tex:
|
|
475
|
+
return { gl: n, canvas: t, source: document.createElement("canvas"), tex: r, u: l };
|
|
471
476
|
}
|
|
472
|
-
function
|
|
473
|
-
if (Jt === void 0 && (Jt =
|
|
474
|
-
const { gl: o, canvas:
|
|
477
|
+
function Hs(t, n, e, s) {
|
|
478
|
+
if (Jt === void 0 && (Jt = Vs()), !Jt) return !1;
|
|
479
|
+
const { gl: o, canvas: c, source: r, tex: l, u: i } = Jt, a = t.getTransform(), d = Math.hypot(a.a, a.b) || 1, h = t.canvas.width, f = t.canvas.height, m = a.a * e + a.e, p = s.zone * d, M = s.blur * d, v = Math.max(0, Math.floor(n > 0 ? m - p - 2 * M - 4 : 0)), u = Math.min(h, Math.ceil(n > 0 ? h : m + p + 2 * M + 4)) - v;
|
|
475
480
|
if (u < 2 || f < 2) return !1;
|
|
476
|
-
(
|
|
477
|
-
const g =
|
|
478
|
-
return g.clearRect(0, 0, u, f), g.drawImage(t.canvas, v, 0, u, f, 0, 0, u, f), (
|
|
481
|
+
(r.width !== u || r.height !== f) && (r.width = u, r.height = f);
|
|
482
|
+
const g = r.getContext("2d");
|
|
483
|
+
return g.clearRect(0, 0, u, f), g.drawImage(t.canvas, v, 0, u, f, 0, 0, u, f), (c.width !== u || c.height !== f) && (c.width = u, c.height = f), o.viewport(0, 0, u, f), o.bindTexture(o.TEXTURE_2D, l), o.texImage2D(o.TEXTURE_2D, 0, o.RGBA, o.RGBA, o.UNSIGNED_BYTE, r), o.uniform2f(i.uSize, u, f), o.uniform1f(i.uWall, m - v), o.uniform1f(i.uSide, n), o.uniform1f(i.uZone, p), o.uniform1f(i.uGap, s.gap * d), o.uniform1f(i.uFlare, s.flare), o.uniform1f(i.uSplit, s.split * d), o.uniform1f(i.uBlur, M), o.uniform1f(i.uCy, a.d * s.cy + a.f), o.clearColor(0, 0, 0, 0), o.clear(o.COLOR_BUFFER_BIT), o.drawArrays(o.TRIANGLE_STRIP, 0, 4), t.save(), t.setTransform(1, 0, 0, 1, 0, 0), t.globalCompositeOperation = "copy", t.beginPath(), t.rect(v, 0, u, f), t.clip(), t.drawImage(c, v, 0), t.restore(), !0;
|
|
479
484
|
}
|
|
480
|
-
function
|
|
481
|
-
const o = 2.2 / s.size,
|
|
482
|
-
return s.amount * (0.2 + 0.75 *
|
|
485
|
+
function Jn(t, n, e, s) {
|
|
486
|
+
const o = 2.2 / s.size, c = zt(t * o + s.t * 0.11, n * o - s.t * 0.08, s.t * 0.07), r = wn(0.3, 0.75, c);
|
|
487
|
+
return s.amount * (0.2 + 0.75 * r) * j(1.3 - e);
|
|
483
488
|
}
|
|
484
|
-
function
|
|
485
|
-
const i = Math.round(n * 1e3) / 1e3, a = (
|
|
486
|
-
let h = s ? a(s.r) :
|
|
487
|
-
return
|
|
489
|
+
function Qn(t, n, e, s, o, c = 0, r, l = 0) {
|
|
490
|
+
const i = Math.round(n * 1e3) / 1e3, a = (p) => e ? p * (1 - t) : p + (255 - p) * t, d = (e ? 1 - t : t) * 255;
|
|
491
|
+
let h = s ? a(s.r) : d, f = s ? a(s.g) : d, m = s ? a(s.b) : d;
|
|
492
|
+
return r && l > 0 && (h += (a(r[0]) - h) * l, f += (a(r[1]) - f) * l, m += (a(r[2]) - m) * l), o && c > 0 && (h += (a(o.r) - h) * c, f += (a(o.g) - f) * c, m += (a(o.b) - m) * c), `rgba(${Math.round(h)},${Math.round(f)},${Math.round(m)},${i})`;
|
|
488
493
|
}
|
|
489
|
-
const
|
|
490
|
-
function
|
|
491
|
-
const
|
|
494
|
+
const Un = 24, zn = 8;
|
|
495
|
+
function Ks(t, n, e, s, o, c) {
|
|
496
|
+
const r = o && o.amount > 5e-3 ? o : void 0, l = c && c.saturation > 0 ? c : void 0, i = /* @__PURE__ */ new Map();
|
|
492
497
|
for (const a of n) {
|
|
493
|
-
const
|
|
498
|
+
const d = a.pts.length >> 1, h = a.closed ? d : d - 1;
|
|
494
499
|
let f = "", m;
|
|
495
|
-
for (let
|
|
496
|
-
const M =
|
|
500
|
+
for (let p = 0; p < h; p++) {
|
|
501
|
+
const M = p + 1 === d ? 0 : p + 1, v = Math.round(j((a.a[p] + a.a[M]) / 2) * Un);
|
|
497
502
|
if (v === 0) {
|
|
498
503
|
f = "";
|
|
499
504
|
continue;
|
|
500
505
|
}
|
|
501
|
-
const
|
|
502
|
-
|
|
503
|
-
) : 0, u = l ? l.at((a.pts[2 *
|
|
506
|
+
const A = r ? Math.round(
|
|
507
|
+
Jn((a.pts[2 * p] + a.pts[2 * M]) / 2, (a.pts[2 * p + 1] + a.pts[2 * M + 1]) / 2, a.white, r) * zn
|
|
508
|
+
) : 0, u = l ? l.at((a.pts[2 * p] + a.pts[2 * M]) / 2, (a.pts[2 * p + 1] + a.pts[2 * M + 1]) / 2) : 0, g = `${v}|${a.white}|${Math.round(a.w * 20)}|${A}|${u}`;
|
|
504
509
|
if (g !== f) {
|
|
505
510
|
let x = i.get(g);
|
|
506
|
-
x || (x = { path: new Path2D(), white: a.white, w: a.w, a: v /
|
|
511
|
+
x || (x = { path: new Path2D(), white: a.white, w: a.w, a: v / Un, gw: A / zn, ci: u }, i.set(g, x)), m = x, f = g, x.path.moveTo(a.pts[2 * p], a.pts[2 * p + 1]);
|
|
507
512
|
}
|
|
508
513
|
m.path.lineTo(a.pts[2 * M], a.pts[2 * M + 1]);
|
|
509
514
|
}
|
|
510
515
|
}
|
|
511
516
|
t.lineCap = "round", t.lineJoin = "round";
|
|
512
517
|
for (const a of i.values())
|
|
513
|
-
t.strokeStyle =
|
|
518
|
+
t.strokeStyle = Qn(j(a.white), a.a, e, s, r, a.gw, l == null ? void 0 : l.rgb, l == null ? void 0 : l.mix[a.ci]), t.lineWidth = a.w, t.stroke(a.path);
|
|
514
519
|
}
|
|
515
|
-
function
|
|
516
|
-
const l = o && o.amount > 5e-3 ? o : void 0, i =
|
|
520
|
+
function Ys(t, n, e, s, o, c, r = !1) {
|
|
521
|
+
const l = o && o.amount > 5e-3 ? o : void 0, i = c && c.saturation > 0 ? c : void 0;
|
|
517
522
|
for (const a of n) {
|
|
518
|
-
const
|
|
519
|
-
if (t.fillStyle =
|
|
523
|
+
const d = j(a.white), h = l ? Jn(a.x, a.y, d, l) : 0, f = i ? i.at(a.x, a.y) : 0;
|
|
524
|
+
if (t.fillStyle = Qn(d, j(a.a ?? 1), e, s, l, h, i == null ? void 0 : i.rgb, i == null ? void 0 : i.mix[f]), r) {
|
|
520
525
|
t.fillRect(a.x - a.r, a.y - a.r, 2 * a.r, 2 * a.r);
|
|
521
526
|
continue;
|
|
522
527
|
}
|
|
523
528
|
t.beginPath(), t.arc(a.x, a.y, a.r, 0, Mt), t.fill();
|
|
524
529
|
}
|
|
525
530
|
}
|
|
526
|
-
function
|
|
531
|
+
function js(t, n, e, s, o, c) {
|
|
527
532
|
var l;
|
|
528
|
-
const
|
|
529
|
-
n.light ?
|
|
533
|
+
const r = c && c.saturation > 0 && !n.light ? ks(c) : void 0;
|
|
534
|
+
n.light ? $s(t, n, n.light, e, s, o) : n.strokes.length && Ks(t, n.strokes, e, s, o, r), Ys(t, n.dots, e, s, o, r, n.square), (l = n.contact) != null && l.lens && Hs(t, n.contact.side, n.contact.x, n.contact.lens);
|
|
530
535
|
}
|
|
531
|
-
const
|
|
536
|
+
const Zs = [
|
|
532
537
|
[0, 255, 150, 90],
|
|
533
538
|
[0.12, 255, 110, 120],
|
|
534
539
|
[0.24, 255, 80, 170],
|
|
@@ -540,171 +545,172 @@ const Ks = [
|
|
|
540
545
|
[0.84, 170, 90, 255],
|
|
541
546
|
[0.93, 240, 104, 165],
|
|
542
547
|
[1, 255, 150, 90]
|
|
543
|
-
],
|
|
544
|
-
const o = t / 2,
|
|
545
|
-
let
|
|
548
|
+
], Js = (t, n, e, s) => {
|
|
549
|
+
const o = t / 2, c = e.level, [r, l] = e.softBands, i = e.bands[2], a = e.drive, d = e.processing, h = 0.5 * c + 0.5 * e.soft, f = o * (s.radius ?? 0.56) * (1 + (s.zoom ?? 0.17) * e.soft) * (1 - 0.06 * d), m = s.deform ?? 1.45, p = 0.02 + (0.14 * r + 0.06 * c) * m, M = 0.01 + (0.07 * l + 0.03 * i) * m, v = En(p, M, a, s.deformRadius ?? 1.75), A = Math.max(0.6, (s.lineW ?? 1.85) * $t(t, 0.5)), u = Math.max(1, Math.round(s.rings ?? 6)), g = Math.max(24, Math.round(s.segs ?? 140)), x = s.lean ?? 0.91, B = s.ringGap ?? 0.02, S = [];
|
|
550
|
+
let L = 0, w = 0;
|
|
546
551
|
for (let y = 0; y < u; y++) {
|
|
547
552
|
const I = 0.16 * (0.5 + Tt(y, 2.1)) * (y % 2 ? 1 : -1), R = Math.max(
|
|
548
553
|
0.02,
|
|
549
554
|
x * (0.2 + 0.8 * Tt(y, 3.1)) + 0.03 * Math.sin(n * 0.27 + y * 1.3) + 0.08 * Math.sin(a * 0.35 + y * 1.7)
|
|
550
|
-
),
|
|
551
|
-
for (let
|
|
552
|
-
const st =
|
|
553
|
-
V.push(ut, tt), at.push(dt),
|
|
555
|
+
), G = Tt(y, 7.7) * Mt + n * 0.05 * (y % 2 ? 1 : -1) + a * I, C = Math.sin(R) * Math.cos(G), F = Math.sin(R) * Math.sin(G), T = Math.cos(R), P = Math.hypot(C, T), N = T / P, O = -C / P, z = F * O, W = T * N - C * O, X = -F * N, Q = f * (1 + B * (y - (u - 1) / 2)), Z = Math.sin(R), V = [], at = [], nt = [];
|
|
556
|
+
for (let H = 0; H < g; H++) {
|
|
557
|
+
const st = H / g * Mt, $ = Math.cos(st), ht = Math.sin(st), ut = N * $ + z * ht, tt = W * ht, ft = O * $ + X * ht, dt = v(ut, tt, ft);
|
|
558
|
+
V.push(ut, tt), at.push(dt), L += dt, w++, nt.push(0.62 + 0.38 * j((ft / Z + 1) / 2));
|
|
554
559
|
}
|
|
555
|
-
|
|
560
|
+
S.push({ dirs: V, f: at, a: nt, rk: Q });
|
|
556
561
|
}
|
|
557
|
-
const k = w ?
|
|
558
|
-
let
|
|
559
|
-
for (const { dirs: y, f: I } of
|
|
562
|
+
const k = w ? L / w : 0;
|
|
563
|
+
let _ = 0, q = 0;
|
|
564
|
+
for (const { dirs: y, f: I } of S)
|
|
560
565
|
for (let R = 0; R < I.length; R++) {
|
|
561
|
-
const
|
|
562
|
-
|
|
566
|
+
const G = y[2 * R], C = y[2 * R + 1], F = Math.hypot(G, C) || 1;
|
|
567
|
+
_ += (I[R] - k) * (G / F), q += (I[R] - k) * (C / F);
|
|
563
568
|
}
|
|
564
|
-
|
|
565
|
-
const U =
|
|
569
|
+
_ = w ? 2 * _ / w : 0, q = w ? 2 * q / w : 0;
|
|
570
|
+
const U = S.map(({ dirs: y, f: I, a: R, rk: G }) => {
|
|
566
571
|
const C = [];
|
|
567
572
|
for (let F = 0; F < I.length; F++) {
|
|
568
|
-
const T = y[2 * F], P = y[2 * F + 1], N = Math.hypot(T, P) || 1,
|
|
569
|
-
C.push(o + T *
|
|
573
|
+
const T = y[2 * F], P = y[2 * F + 1], N = Math.hypot(T, P) || 1, O = G * (1 + I[F] - k - _ * (T / N) - q * (P / N));
|
|
574
|
+
C.push(o + T * O, o - P * O);
|
|
570
575
|
}
|
|
571
|
-
return { pts: C, a: R, white: 0, w:
|
|
572
|
-
}), b = 2.3 + 0.25 * Math.sin(n * 0.21) + 2 * e.spin,
|
|
576
|
+
return { pts: C, a: R, white: 0, w: A, closed: !0 };
|
|
577
|
+
}), b = 2.3 + 0.25 * Math.sin(n * 0.21) + 2 * e.spin, E = {
|
|
573
578
|
cx: o,
|
|
574
579
|
cy: o,
|
|
575
580
|
r: f,
|
|
576
|
-
stops:
|
|
581
|
+
stops: Zs,
|
|
577
582
|
// warm at the top, cool below, swaying rather than turning — the
|
|
578
583
|
// spectrum flows with the voice but keeps its sense of up; processing
|
|
579
584
|
// spins it all the way round
|
|
580
585
|
angle: -Math.PI / 2 - 0.35 + 0.5 * Math.sin(n * 0.07) + 0.4 * Math.sin(a * 0.2) + e.spin,
|
|
581
586
|
// processing lights the ring up: brighter bloom and a bigger halo
|
|
582
|
-
intensity: 0.62 + 0.55 * h + 0.5 *
|
|
583
|
-
halo: (s.halo ?? 0.5) * (1 + 0.6 *
|
|
587
|
+
intensity: 0.62 + 0.55 * h + 0.5 * d,
|
|
588
|
+
halo: (s.halo ?? 0.5) * (1 + 0.6 * d),
|
|
584
589
|
spec: [
|
|
585
590
|
{
|
|
586
591
|
x: o + Math.cos(b) * f,
|
|
587
592
|
y: o + Math.sin(b) * f,
|
|
588
|
-
r: f * (0.5 + 0.25 *
|
|
589
|
-
a: 0.5 + 0.35 * h + 0.4 *
|
|
593
|
+
r: f * (0.5 + 0.25 * d),
|
|
594
|
+
a: 0.5 + 0.35 * h + 0.4 * d
|
|
590
595
|
}
|
|
591
596
|
],
|
|
592
|
-
fringe: 0.016 + 0.012 * h
|
|
597
|
+
fringe: 0.016 + 0.012 * h,
|
|
598
|
+
green: [s.greenFrom ?? 81, s.greenTo ?? 136]
|
|
593
599
|
};
|
|
594
|
-
return { ...
|
|
595
|
-
},
|
|
596
|
-
const o = t / 2,
|
|
597
|
-
for (let C = -
|
|
598
|
-
for (let F = -
|
|
599
|
-
const T = o + F * M, P = o + C * M, N = (T - o) / f,
|
|
600
|
+
return { ...Gt([], U), light: E };
|
|
601
|
+
}, ts = -0.45, ns = 0.55, ss = 0.7, Qs = Math.hypot(ts, ns, ss), te = (t, n, e, s) => {
|
|
602
|
+
const o = t / 2, c = e.level, [r, l, i] = e.bands, a = e.drive, d = e.processing, h = o * (s.radius ?? 0.72), f = h * (1 + (s.zoom ?? 0.3) * c) * (1 - 0.06 * d), m = s.rMul ?? 1, p = Math.max(4, Math.round(s.cells ?? 17)), M = 2 * h / p, v = M / 2 - Math.max(0.5, M * (s.gap ?? 0.24) / 2), A = Math.ceil(f * 1.25 / M), u = (s.turn ?? 0.12) * n + 0.1 * a + 0.5 * e.spin, g = Math.sin(u), x = Math.cos(u), B = Math.sin(0.35), S = Math.cos(0.35), L = s.shade ?? 0.7, w = s.texture ?? 0.35, k = s.fade ?? 1.3, _ = s.strength ?? 1.38, q = s.deform ?? 1.7, U = 0.012 + (0.09 * r + 0.03 * c) * q, b = (0.035 * l + 0.025 * i) * q, E = (C) => U * (0.55 * Math.sin(2 * C + 0.9 * a) + 0.45 * Math.sin(3 * C - 0.7 * a + 1.3)) + b * Math.sin(7 * C + 2.3 * a) * Math.sin(5 * C - 1.7 * a), y = 0.95 * Math.sin(n * 1.3), I = e.spectrum, R = I.length, G = [];
|
|
603
|
+
for (let C = -A; C <= A; C++)
|
|
604
|
+
for (let F = -A; F <= A; F++) {
|
|
605
|
+
const T = o + F * M, P = o + C * M, N = (T - o) / f, O = -(P - o) / f, z = E(Math.atan2(O, N)), W = Math.hypot(N, O) / (1 + z);
|
|
600
606
|
if (W >= 1) continue;
|
|
601
|
-
const X = 1 / (1 + z), Q = N * X, Z =
|
|
602
|
-
|
|
607
|
+
const X = 1 / (1 + z), Q = N * X, Z = O * X, V = Math.sqrt(Math.max(0, 1 - Q * Q - Z * Z)), at = j((Q * ts + Z * ns + V * ss) / Qs), nt = 1 - L + L * at, H = Z * S + V * B, st = -Z * B + V * S, $ = Q * x - st * g, ht = Q * g + st * x, ut = 0.65 * zt($ * 2.2 + a * 0.15, H * 2.2, ht * 2.2 - a * 0.1) + 0.35 * zt($ * 4.6 - a * 0.2, H * 4.6 + 7.3, ht * 4.6), tt = 1 - w + w * wn(0.32, 0.68, ut), ft = R ? I[Math.min(R - 1, Math.floor(W * R))] : c, dt = 0.35 * c + 0.85 * ft, Rt = Math.exp(-((Z - y) ** 2) / 0.01) * d, Wt = 1 - 0.4 * k * (1 - V), ct = (0.35 + 0.75 * nt * tt + 0.3 * dt + 0.2 * Rt) * Wt * m, At = 0.22 + 0.62 * nt * tt + 0.22 * dt + 0.3 * Rt;
|
|
608
|
+
G.push({
|
|
603
609
|
x: T,
|
|
604
610
|
y: P,
|
|
605
611
|
z: V * f,
|
|
606
612
|
r: v * Math.min(1, ct),
|
|
607
|
-
white: j(1 - At *
|
|
608
|
-
a: j((1 - 0.75 * k * (1 - Math.sqrt(V))) *
|
|
613
|
+
white: j(1 - At * _),
|
|
614
|
+
a: j((1 - 0.75 * k * (1 - Math.sqrt(V))) * _)
|
|
609
615
|
});
|
|
610
616
|
}
|
|
611
|
-
return { ...
|
|
612
|
-
},
|
|
613
|
-
const o = t / 2,
|
|
617
|
+
return { ...Gt(G, [], s.rMin ?? 0.4), square: !0 };
|
|
618
|
+
}, ne = (t, n, e, s) => {
|
|
619
|
+
const o = t / 2, c = t / 2, r = 0.5 * e.level + 0.5 * e.soft, l = (1 + (s.swell ?? 0.49) * r) * (1 - 0.14 * e.processing), i = t / 2 * (s.radius ?? 0.56), a = s.persp ?? 0.25, d = nn(n * 0.12 + e.drive * 0.03, 0.3, 0, 0, 1), h = $t(t, s.rsPow ?? 0.9) * (s.rMul ?? 1), f = [], m = s.orbitN ?? 12, p = s.particles ?? 6;
|
|
614
620
|
for (let M = 0; M < m; M++) {
|
|
615
|
-
const v = Tt(M, 1.7),
|
|
616
|
-
let k = -
|
|
617
|
-
const
|
|
618
|
-
k /=
|
|
619
|
-
const U = -w *
|
|
620
|
-
for (let I = 0; I <
|
|
621
|
-
const R = e.drive * y + I /
|
|
621
|
+
const v = Tt(M, 1.7), A = Tt(M, 5.2), u = Tt(M, 8.9), g = i * (0.45 + 0.52 * v), x = v * Mt, B = Math.acos(2 * A - 1), S = Math.sin(B) * Math.cos(x), L = Math.cos(B), w = Math.sin(B) * Math.sin(x);
|
|
622
|
+
let k = -L, _ = S;
|
|
623
|
+
const q = Math.max(1e-6, Math.sqrt(k * k + _ * _));
|
|
624
|
+
k /= q, _ /= q;
|
|
625
|
+
const U = -w * _, b = w * k, E = S * _ - L * k, y = (0.25 + 0.55 * u) * (u > 0.5 ? 1 : -1);
|
|
626
|
+
for (let I = 0; I < p; I++) {
|
|
627
|
+
const R = e.drive * y + I / p * Mt + A * 6, G = Math.cos(R), C = Math.sin(R), [F, T, P] = d((k * G + U * C) * g, (_ * G + b * C) * g, E * C * g), N = j((P / i + 1) / 2), O = l / (1 - a * P / i);
|
|
622
628
|
f.push({
|
|
623
|
-
x: o + F *
|
|
624
|
-
y:
|
|
629
|
+
x: o + F * O,
|
|
630
|
+
y: c + T * O,
|
|
625
631
|
z: P,
|
|
626
|
-
r: ((s.partR ?? 0.47) + (s.partRDepth ?? 0.65) * N) * h *
|
|
632
|
+
r: ((s.partR ?? 0.47) + (s.partRDepth ?? 0.65) * N) * h * O,
|
|
627
633
|
white: 0.32 - 0.24 * N
|
|
628
634
|
});
|
|
629
635
|
}
|
|
630
636
|
}
|
|
631
|
-
return
|
|
632
|
-
},
|
|
633
|
-
const o = t / 2,
|
|
637
|
+
return Gt(f, [], s.rMin);
|
|
638
|
+
}, se = (t, n, e, s) => {
|
|
639
|
+
const o = t / 2, c = t / 2, r = e.soft, [l, i] = e.softBands, a = t / 2 * (s.radius ?? 0.66) * (1 + (s.zoom ?? 0.21) * e.level), d = e.drive, h = s.deform ?? 1, f = s.wave ?? 1, m = 0.015 + (0.1 * l + 0.05 * e.level) * h, p = 0.04 * i * h, M = En(m, p, d), v = 0.55 + 0.05 * Math.sin(n * 0.37), A = Math.cos(v), u = Math.sin(v);
|
|
634
640
|
let g = 0;
|
|
635
641
|
for (let T = 0; T < 48; T++) {
|
|
636
642
|
const P = T / 48 * Mt;
|
|
637
|
-
g += M(Math.cos(P), Math.sin(P) *
|
|
643
|
+
g += M(Math.cos(P), Math.sin(P) * A, Math.sin(P) * u);
|
|
638
644
|
}
|
|
639
645
|
g /= 48;
|
|
640
|
-
const x = (T, P, N) => 1 + M(T, P, N) - g,
|
|
641
|
-
for (let T = 0; T <
|
|
642
|
-
const P =
|
|
643
|
-
k.push({ x:
|
|
646
|
+
const x = (T, P, N) => 1 + M(T, P, N) - g, S = nn(0, 0.3, o, c, 1), L = $t(t, s.rsPow ?? 0.6) * (s.rMul ?? 1), w = e.drive, k = [], _ = s.ghostN ?? 60;
|
|
647
|
+
for (let T = 0; T < _; T++) {
|
|
648
|
+
const P = Sn(T, _), N = a * x(P[0], P[1], P[2]), [O, z, W] = S(P[0] * N, P[1] * N, P[2] * N), X = (W / a + 1) / 2;
|
|
649
|
+
k.push({ x: O, y: z, z: W, r: 0.65 * L, white: 0.78, a: 0.1 + 0.22 * X });
|
|
644
650
|
}
|
|
645
|
-
const
|
|
651
|
+
const q = -u, U = A, b = Math.max(1, Math.round(s.lanes ?? 10)), E = Math.max(8, Math.round(s.segs ?? 56)), y = e.processing, I = (s.laneGap ?? 0.062) * (1 + 0.25 * r) * (1 - 0.4 * y), R = w * 1.6, G = 0.15 * (0.55 + 0.9 * l * f) * (1 - 0.6 * y), C = 0.06 * (0.5 + 1.2 * i * f), F = 0.05 + 0.05 * r;
|
|
646
652
|
for (let T = 0; T < b; T++) {
|
|
647
653
|
const P = (T - (b - 1) / 2) * I, N = Math.abs(T - (b - 1) / 2) / Math.max(1, (b - 1) / 2);
|
|
648
|
-
for (let
|
|
649
|
-
const z =
|
|
654
|
+
for (let O = 0; O < E; O++) {
|
|
655
|
+
const z = O / E * Mt, W = G * Math.sin(z * 3 - w * 0.95 + T * 0.18) + C * Math.sin(z * 5 + w * 0.6) + F * Math.sin(z * 2 + n * 0.31 + Math.sin(n * 0.17) * 1.5), X = P + W, Q = Math.cos(z), Z = Math.sin(z), V = Q, at = Z * A + q * X, nt = Z * u + U * X, H = Math.sqrt(V * V + at * at + nt * nt), st = a * x(V / H, at / H, nt / H) / H, [$, ht, ut] = S(V * st, at * st, nt * st), tt = (ut / a + 1) / 2, ft = Math.max(0, W) * r, dt = Math.atan2(Math.sin(z - R), Math.cos(z - R)), Rt = Math.exp(-(dt * dt) / 0.18) * y;
|
|
650
656
|
k.push({
|
|
651
657
|
x: $,
|
|
652
658
|
y: ht,
|
|
653
659
|
z: ut,
|
|
654
|
-
r: ((s.rBase ?? 0.49) + (s.rDepth ?? 0.78) * tt) * (1 - 0.25 * N) * (1 + 1.2 * ft + 0.5 * Rt) *
|
|
660
|
+
r: ((s.rBase ?? 0.49) + (s.rDepth ?? 0.78) * tt) * (1 - 0.25 * N) * (1 + 1.2 * ft + 0.5 * Rt) * L,
|
|
655
661
|
white: 0.52 - 0.44 * tt + 0.18 * N - 0.3 * Rt,
|
|
656
662
|
a: 0.4 + 0.6 * tt
|
|
657
663
|
});
|
|
658
664
|
}
|
|
659
665
|
}
|
|
660
|
-
return
|
|
661
|
-
},
|
|
662
|
-
const o = t / 2,
|
|
663
|
-
for (let
|
|
664
|
-
const
|
|
666
|
+
return Gt(k, [], s.rMin);
|
|
667
|
+
}, ee = (t, n, e, s) => {
|
|
668
|
+
const o = t / 2, c = e.level, [r, l] = e.softBands, i = e.bands[2], a = e.drive, d = o * (s.radius ?? 0.6) * (1 + (s.zoom ?? 0.06) * e.soft) * (1 - 0.08 * e.processing), h = nn((s.yaw ?? 0.42) + 0.08 * Math.sin(n * 0.23), s.tilt ?? 0.32, o, o, 1), f = Math.max(0.4, (s.lineW ?? 0.6) * $t(t, 0.5)), m = (S) => 0.06 + 0.94 * j((S / d + 1) / 2) ** 2, p = s.deform ?? 1, M = 0.02 + (0.14 * r + 0.06 * c) * p, v = 0.01 + (0.07 * l + 0.03 * i) * p, A = En(M, v, a), u = [], g = Math.max(24, Math.round(s.segs ?? 96)), x = Math.max(0, Math.round(s.limbs ?? 2));
|
|
669
|
+
for (let S = 0; S < x; S++) {
|
|
670
|
+
const L = 0.1 + 0.05 * Math.sin(n * 0.31 + S * 2.1), w = n * 0.17 * (S % 2 ? 1 : -1) + S * 2.4, k = Math.sin(L) * Math.cos(w), _ = Math.sin(L) * Math.sin(w), q = Math.cos(L), U = Math.hypot(k, q), b = q / U, E = -k / U, y = _ * E, I = q * b - k * E, R = -_ * b, G = [], C = [];
|
|
665
671
|
for (let F = 0; F < g; F++) {
|
|
666
|
-
const T = F / g * Mt, P = b * Math.cos(T) + y * Math.sin(T), N = I * Math.sin(T),
|
|
667
|
-
|
|
672
|
+
const T = F / g * Mt, P = b * Math.cos(T) + y * Math.sin(T), N = I * Math.sin(T), O = E * Math.cos(T) + R * Math.sin(T), z = d * (1 + 6e-3 * S + A(P, N, O));
|
|
673
|
+
G.push(o + P * z, o - N * z), C.push(0.55 + 0.35 * j((O / Math.sin(L) + 1) / 2));
|
|
668
674
|
}
|
|
669
|
-
u.push({ pts:
|
|
675
|
+
u.push({ pts: G, a: C, white: 0, w: f, closed: !0 });
|
|
670
676
|
}
|
|
671
677
|
const B = Math.max(2, Math.round(s.circles ?? 8));
|
|
672
|
-
for (let
|
|
673
|
-
const [
|
|
678
|
+
for (let S = 0; S < B; S++) {
|
|
679
|
+
const [L, w, k] = Sn(S, B), _ = a * 0.16 * (0.5 + Tt(S, 2.1)) * (S % 2 ? 1 : -1) + Tt(S, 6.6) * Mt, q = w * Math.cos(_) - k * Math.sin(_), U = w * Math.sin(_) + k * Math.cos(_), b = Math.max(1e-6, Math.hypot(U, L)), E = U / b, y = -L / b, I = q * y, R = U * E - L * y, G = -q * E, C = [], F = [];
|
|
674
680
|
for (let T = 0; T < g; T++) {
|
|
675
|
-
const P = T / g * Mt, N =
|
|
681
|
+
const P = T / g * Mt, N = E * Math.cos(P) + I * Math.sin(P), O = R * Math.sin(P), z = y * Math.cos(P) + G * Math.sin(P), W = d * (1 + A(N, O, z)), [X, Q, Z] = h(N * W, O * W, z * W);
|
|
676
682
|
C.push(X, Q), F.push(m(Z));
|
|
677
683
|
}
|
|
678
684
|
u.push({ pts: C, a: F, white: 0, w: f, closed: !0 });
|
|
679
685
|
}
|
|
680
|
-
return
|
|
681
|
-
},
|
|
682
|
-
const o = t / 2,
|
|
683
|
-
let
|
|
686
|
+
return Gt([], u, s.rMin);
|
|
687
|
+
}, oe = (t, n, e, s) => {
|
|
688
|
+
const o = t / 2, c = e.level, [r, l, i] = e.bands, a = e.drive, d = e.processing, h = o * (s.radius ?? 0.6) * (1 + (s.zoom ?? 0.1) * c) * (1 - 0.08 * d), f = 0.95 * Math.sin(n * 1.3), m = nn(n * 0.14, 0.32, o, o, 1), p = $t(t, s.rsPow ?? 0.6) * (s.rMul ?? 1), M = Math.max(40, Math.round(s.dotN ?? 900)), v = s.cloudFreq ?? 2.3, A = s.deform ?? 1, u = 0.018 + (0.12 * r + 0.04 * c) * A, g = (0.045 * l + 0.03 * i) * A, x = [], B = [];
|
|
689
|
+
let S = 0;
|
|
684
690
|
for (let w = 0; w < M; w++) {
|
|
685
|
-
const k =
|
|
686
|
-
x.push(k), B.push(y),
|
|
691
|
+
const k = Sn(w, M), [_, q, U] = k, b = 0.55 * Math.sin(2.1 * _ + 1.3 * q + 0.9 * a) + 0.45 * Math.sin(1.7 * U - 1.9 * q - 0.7 * a + 1.3), E = Math.sin(5.3 * _ - 4.1 * U + 2.3 * a) * Math.sin(4.7 * q + 3.1 * _ - 1.7 * a), y = u * b + g * E;
|
|
692
|
+
x.push(k), B.push(y), S += y / M;
|
|
687
693
|
}
|
|
688
|
-
const
|
|
694
|
+
const L = [];
|
|
689
695
|
for (let w = 0; w < M; w++) {
|
|
690
|
-
const [k,
|
|
691
|
-
|
|
692
|
-
x:
|
|
696
|
+
const [k, _, q] = x[w], U = B[w] - S, b = h * (1 + U), [E, y, I] = m(k * b, _ * b, q * b), R = j((I / h + 1) / 2), G = 0.65 * zt(k * v + a * 0.21, _ * v - a * 0.15, q * v + a * 0.1) + 0.35 * zt(k * v * 2.1 - a * 0.29, _ * v * 2.1 + 7.3, q * v * 2.1 + a * 0.24), C = wn(0.34, 0.68, G), F = Math.exp(-((_ - f) ** 2) / 0.012) * d, T = Math.max(0, U) / 0.16;
|
|
697
|
+
L.push({
|
|
698
|
+
x: E,
|
|
693
699
|
y,
|
|
694
700
|
z: I,
|
|
695
|
-
r: ((s.rBase ?? 0.27) + (s.rDepth ?? 0.84) * R) * (0.22 + 0.95 * C + 0.6 * F) * (1 + 0.5 * T) *
|
|
701
|
+
r: ((s.rBase ?? 0.27) + (s.rDepth ?? 0.84) * R) * (0.22 + 0.95 * C + 0.6 * F) * (1 + 0.5 * T) * p,
|
|
696
702
|
white: 0.62 - 0.52 * R - 0.16 * C - 0.3 * F,
|
|
697
703
|
a: 0.3 + 0.7 * R
|
|
698
704
|
});
|
|
699
705
|
}
|
|
700
|
-
return
|
|
701
|
-
},
|
|
702
|
-
orbit:
|
|
703
|
-
sash:
|
|
704
|
-
signal:
|
|
705
|
-
swell:
|
|
706
|
-
pixel:
|
|
707
|
-
aura:
|
|
706
|
+
return Gt(L, [], s.rMin ?? 0.25);
|
|
707
|
+
}, Ae = ["orbit", "sash", "signal", "swell", "pixel", "aura"], ae = {
|
|
708
|
+
orbit: ne,
|
|
709
|
+
sash: se,
|
|
710
|
+
signal: ee,
|
|
711
|
+
swell: oe,
|
|
712
|
+
pixel: te,
|
|
713
|
+
aura: Js
|
|
708
714
|
}, ot = {
|
|
709
715
|
orbit: {
|
|
710
716
|
speed: 1.05,
|
|
@@ -751,15 +757,15 @@ const Ks = [
|
|
|
751
757
|
counts: { segs: 0.5 }
|
|
752
758
|
}
|
|
753
759
|
};
|
|
754
|
-
function
|
|
755
|
-
const o = t in ot ? t : "orbit",
|
|
756
|
-
for (const [i, a] of Object.entries(
|
|
757
|
-
const
|
|
758
|
-
|
|
760
|
+
function ce(t, n, e = 1, s = 1) {
|
|
761
|
+
const o = t in ot ? t : "orbit", c = ot[o], r = Math.min(1.4, Math.max(0.2, n / 200)) * Math.max(0.1, e), l = { ...c.opts };
|
|
762
|
+
for (const [i, a] of Object.entries(c.counts)) {
|
|
763
|
+
const d = l[i];
|
|
764
|
+
d != null && (l[i] = Math.max(1, Math.round(d * r ** a)));
|
|
759
765
|
}
|
|
760
|
-
return s !== 1 && (l.rMul = Math.max(0.1, s)), { frame:
|
|
766
|
+
return s !== 1 && (l.rMul = Math.max(0.1, s)), { frame: ae[o], speed: c.speed, driveGain: c.driveGain, gain: c.gain ?? 1, opts: l };
|
|
761
767
|
}
|
|
762
|
-
function
|
|
768
|
+
function re(t) {
|
|
763
769
|
let n = t;
|
|
764
770
|
for (; n; ) {
|
|
765
771
|
const e = n.getAttribute("data-theme");
|
|
@@ -771,10 +777,10 @@ function ee(t) {
|
|
|
771
777
|
}
|
|
772
778
|
return null;
|
|
773
779
|
}
|
|
774
|
-
function
|
|
780
|
+
function ie() {
|
|
775
781
|
return typeof matchMedia > "u" || matchMedia("(prefers-color-scheme: dark)").matches;
|
|
776
782
|
}
|
|
777
|
-
function
|
|
783
|
+
function le(t, n) {
|
|
778
784
|
const [e, s] = Bt(!0);
|
|
779
785
|
return It(() => {
|
|
780
786
|
if (t === "dark") {
|
|
@@ -786,23 +792,23 @@ function ae(t, n) {
|
|
|
786
792
|
return;
|
|
787
793
|
}
|
|
788
794
|
const o = () => {
|
|
789
|
-
const i =
|
|
790
|
-
s(i ??
|
|
795
|
+
const i = re(n.current);
|
|
796
|
+
s(i ?? ie());
|
|
791
797
|
};
|
|
792
798
|
o();
|
|
793
|
-
const
|
|
794
|
-
|
|
799
|
+
const c = typeof matchMedia < "u" ? matchMedia("(prefers-color-scheme: dark)") : null, r = () => o();
|
|
800
|
+
c == null || c.addEventListener("change", r);
|
|
795
801
|
let l = null;
|
|
796
802
|
return typeof MutationObserver < "u" && n.current && (l = new MutationObserver(o), l.observe(document.documentElement, {
|
|
797
803
|
attributes: !0,
|
|
798
804
|
attributeFilter: ["class", "data-theme"],
|
|
799
805
|
subtree: !0
|
|
800
806
|
})), () => {
|
|
801
|
-
|
|
807
|
+
c == null || c.removeEventListener("change", r), l == null || l.disconnect();
|
|
802
808
|
};
|
|
803
809
|
}, [t, n]), e;
|
|
804
810
|
}
|
|
805
|
-
function
|
|
811
|
+
function he() {
|
|
806
812
|
const [t, n] = Bt(!1);
|
|
807
813
|
return It(() => {
|
|
808
814
|
if (typeof matchMedia > "u") return;
|
|
@@ -812,24 +818,24 @@ function ce() {
|
|
|
812
818
|
return e.addEventListener("change", s), () => e.removeEventListener("change", s);
|
|
813
819
|
}, []), t;
|
|
814
820
|
}
|
|
815
|
-
const vt = 16,
|
|
821
|
+
const vt = 16, ue = 2.1, fe = 0.3, de = 2.5, pe = 1.6, me = 5, $n = 2.2, Wn = [
|
|
816
822
|
[80, 300],
|
|
817
823
|
[300, 2e3],
|
|
818
824
|
[2e3, 6e3]
|
|
819
|
-
], Mn = 90,
|
|
820
|
-
function
|
|
825
|
+
], Mn = 90, Me = 7e3, gn = Math.PI * 2, bn = 0.35, vn = 0.9;
|
|
826
|
+
function es(t) {
|
|
821
827
|
return t < 0 ? 0 : t > 1 ? 1 : t;
|
|
822
828
|
}
|
|
823
829
|
function xn(t, n) {
|
|
824
830
|
if (t <= n) return 0;
|
|
825
831
|
const e = (t - n) / Math.max(1e-3, 1 - n);
|
|
826
|
-
return
|
|
832
|
+
return es((1 - Math.exp(-3 * e)) / (1 - Math.exp(-3)));
|
|
827
833
|
}
|
|
828
834
|
function Ft(t, n, e, s, o) {
|
|
829
|
-
const
|
|
830
|
-
return t + (n - t) * (1 - Math.exp(-e / Math.max(1e-3,
|
|
835
|
+
const c = n > t ? s : o;
|
|
836
|
+
return t + (n - t) * (1 - Math.exp(-e / Math.max(1e-3, c)));
|
|
831
837
|
}
|
|
832
|
-
class
|
|
838
|
+
class ge {
|
|
833
839
|
constructor() {
|
|
834
840
|
this.clock = 0, this.t = 0, this.drive = 0, this.level = 0, this.bands = [0, 0, 0], this.spectrum = new Float32Array(vt), this.floor = new Float32Array(vt + 3).fill(1), this.heard = 0, this.proc = 0, this.spin = 0, this.pan = 0, this.panVel = 0, this.raw = { level: 0, bands: [0, 0, 0], spectrum: new Float32Array(vt) }, this.timeBuf = null, this.freqBuf = null, this.out = {
|
|
835
841
|
level: 0,
|
|
@@ -846,26 +852,26 @@ class de {
|
|
|
846
852
|
/** Read an analyser: RMS loudness, three voice bands and the spectrum. */
|
|
847
853
|
readAnalyser(n, e, s) {
|
|
848
854
|
(!this.timeBuf || this.timeBuf.length !== n.fftSize) && (this.timeBuf = new Float32Array(n.fftSize)), (!this.freqBuf || this.freqBuf.length !== n.frequencyBinCount) && (this.freqBuf = new Uint8Array(n.frequencyBinCount));
|
|
849
|
-
const o = this.timeBuf,
|
|
855
|
+
const o = this.timeBuf, c = this.freqBuf;
|
|
850
856
|
n.getFloatTimeDomainData(o);
|
|
851
|
-
let
|
|
852
|
-
for (let h = 0; h < o.length; h++)
|
|
853
|
-
this.raw.level = Math.sqrt(
|
|
857
|
+
let r = 0;
|
|
858
|
+
for (let h = 0; h < o.length; h++) r += o[h] * o[h];
|
|
859
|
+
this.raw.level = Math.sqrt(r / o.length) * me * e, n.getByteFrequencyData(c);
|
|
854
860
|
const l = n.context.sampleRate / n.fftSize, i = (h, f) => {
|
|
855
|
-
const m = Math.max(0, Math.floor(h / l)),
|
|
861
|
+
const m = Math.max(0, Math.floor(h / l)), p = Math.max(m, Math.min(c.length - 1, Math.ceil(f / l)));
|
|
856
862
|
let M = 0;
|
|
857
|
-
for (let v = m; v <=
|
|
858
|
-
return M / (
|
|
863
|
+
for (let v = m; v <= p; v++) M += c[v];
|
|
864
|
+
return M / (p - m + 1) / 255;
|
|
859
865
|
}, a = (h, f) => {
|
|
860
866
|
const m = this.floor[h];
|
|
861
867
|
return this.floor[h] = f < m ? f : m + (f - m) * (1 - Math.exp(-s / 8)), Math.max(0, f - this.floor[h]) / Math.max(0.05, 1 - this.floor[h]);
|
|
862
868
|
};
|
|
863
869
|
for (let h = 0; h < 3; h++)
|
|
864
|
-
this.raw.bands[h] = a(h, i(
|
|
865
|
-
const
|
|
870
|
+
this.raw.bands[h] = a(h, i(Wn[h][0], Wn[h][1])) * $n * e;
|
|
871
|
+
const d = Me / Mn;
|
|
866
872
|
for (let h = 0; h < vt; h++) {
|
|
867
|
-
const f = Mn *
|
|
868
|
-
this.raw.spectrum[h] = a(3 + h, i(f, m)) *
|
|
873
|
+
const f = Mn * d ** (h / vt), m = Mn * d ** ((h + 1) / vt);
|
|
874
|
+
this.raw.spectrum[h] = a(3 + h, i(f, m)) * $n * e;
|
|
869
875
|
}
|
|
870
876
|
}
|
|
871
877
|
/**
|
|
@@ -875,11 +881,11 @@ class de {
|
|
|
875
881
|
* spectrum — so a level-driven orb still moves like a voice.
|
|
876
882
|
*/
|
|
877
883
|
readLevel(n, e) {
|
|
878
|
-
const s =
|
|
884
|
+
const s = es(n) * e, o = this.clock;
|
|
879
885
|
this.raw.level = s, this.raw.bands[0] = s, this.raw.bands[1] = s * (0.72 + 0.28 * Math.sin(o * 2.3)), this.raw.bands[2] = s * (0.6 + 0.4 * Math.sin(o * 3.7 + 2));
|
|
880
|
-
const
|
|
886
|
+
const c = 0.28 + 0.1 * Math.sin(o * 2.3) + 0.05 * Math.sin(o * 5.1), r = 0.64 + 0.1 * Math.sin(o * 1.7 + 1);
|
|
881
887
|
for (let l = 0; l < vt; l++) {
|
|
882
|
-
const i = l / (vt - 1), a = Math.exp(-((i -
|
|
888
|
+
const i = l / (vt - 1), a = Math.exp(-((i - c) ** 2) / 0.012) + 0.6 * Math.exp(-((i - r) ** 2) / 8e-3);
|
|
883
889
|
this.raw.spectrum[l] = s * (0.25 + 0.75 * a) * (1 - 0.4 * i);
|
|
884
890
|
}
|
|
885
891
|
}
|
|
@@ -889,88 +895,88 @@ class de {
|
|
|
889
895
|
}
|
|
890
896
|
/** Advance by `dt` real seconds. `still` (reduced motion) holds the clocks. */
|
|
891
897
|
step(n, e, s) {
|
|
892
|
-
const { threshold: o, attack:
|
|
898
|
+
const { threshold: o, attack: c, release: r, rate: l } = e, i = this.proc = Ft(this.proc, e.processing ? 1 : 0, n, 0.35, 0.5), a = e.calm + (1 - e.calm) * Math.min(1, Math.max(this.heard * 2.5, i));
|
|
893
899
|
s || (this.clock += n, this.t += n * l * a * (1 + 0.5 * i));
|
|
894
|
-
const
|
|
895
|
-
this.level = Ft(this.level,
|
|
900
|
+
const d = xn(this.raw.level, o);
|
|
901
|
+
this.level = Ft(this.level, d, n, c, r), this.heard = Ft(this.heard, this.level, n, bn, vn);
|
|
896
902
|
for (let u = 0; u < 3; u++)
|
|
897
|
-
this.bands[u] = Ft(this.bands[u], xn(this.raw.bands[u], o * 0.6), n,
|
|
903
|
+
this.bands[u] = Ft(this.bands[u], xn(this.raw.bands[u], o * 0.6), n, c, r * 1.15);
|
|
898
904
|
for (let u = 0; u < vt; u++)
|
|
899
|
-
this.spectrum[u] = Ft(this.spectrum[u], xn(this.raw.spectrum[u], o * 0.6), n,
|
|
900
|
-
const h = this.clock, f = s ? 0.5 : 0.5 + 0.5 * Math.sin(gn * h / 6), m = e.idle * f * (1 - i),
|
|
901
|
-
|
|
902
|
-
for (let u = 0; u < 3; u++)
|
|
903
|
-
|
|
904
|
-
for (let u = 0; u < 3; u++)
|
|
905
|
-
if (s || (this.drive += n * l * (a + e.driveGain * this.level + 1.3 * i)),
|
|
906
|
-
const u = Math.ceil(this.spin / gn - 1e-6) * gn, g = Math.min(
|
|
907
|
-
this.spin += n * (
|
|
905
|
+
this.spectrum[u] = Ft(this.spectrum[u], xn(this.raw.spectrum[u], o * 0.6), n, c, r);
|
|
906
|
+
const h = this.clock, f = s ? 0.5 : 0.5 + 0.5 * Math.sin(gn * h / 6), m = e.idle * f * (1 - i), p = this.out;
|
|
907
|
+
p.level = this.level + (1 - this.level) * m;
|
|
908
|
+
for (let u = 0; u < 3; u++) p.bands[u] = this.bands[u] + (1 - this.bands[u]) * m * 0.6;
|
|
909
|
+
p.soft = Ft(p.soft, p.level, n, bn, vn);
|
|
910
|
+
for (let u = 0; u < 3; u++) p.softBands[u] = Ft(p.softBands[u], p.bands[u], n, bn, vn);
|
|
911
|
+
if (s || (this.drive += n * l * (a + e.driveGain * this.level + 1.3 * i)), p.drive = this.drive, p.processing = i, !s) {
|
|
912
|
+
const u = Math.ceil(this.spin / gn - 1e-6) * gn, g = Math.min(fe, (u - this.spin) * 0.6);
|
|
913
|
+
this.spin += n * (ue * l * i + g * (1 - i));
|
|
908
914
|
}
|
|
909
|
-
|
|
910
|
-
const M = Math.max(-1, Math.min(1, e.direction || 0)), v = this.heard > 0.06 && !e.processing ? M : 0,
|
|
911
|
-
return this.panVel += (
|
|
915
|
+
p.spin = this.spin;
|
|
916
|
+
const M = Math.max(-1, Math.min(1, e.direction || 0)), v = this.heard > 0.06 && !e.processing ? M : 0, A = Math.abs(v) > Math.abs(this.pan) ? de : pe;
|
|
917
|
+
return this.panVel += (A * A * (v - this.pan) - 2 * A * this.panVel) * n, this.pan += this.panVel * n, p.pan = this.pan, p;
|
|
912
918
|
}
|
|
913
919
|
}
|
|
914
|
-
function
|
|
920
|
+
function be(t) {
|
|
915
921
|
if (!t) return;
|
|
916
922
|
const n = t.trim().match(/^#([0-9a-f]{3}|[0-9a-f]{6})$/i);
|
|
917
923
|
if (n) {
|
|
918
924
|
let s = n[1];
|
|
919
|
-
s.length === 3 && (s = s.replace(/./g, (
|
|
925
|
+
s.length === 3 && (s = s.replace(/./g, (c) => c + c));
|
|
920
926
|
const o = parseInt(s, 16);
|
|
921
927
|
return { r: o >> 16 & 255, g: o >> 8 & 255, b: o & 255 };
|
|
922
928
|
}
|
|
923
929
|
const e = t.trim().match(/^rgba?\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)/i);
|
|
924
930
|
if (e) return { r: Number(e[1]), g: Number(e[2]), b: Number(e[3]) };
|
|
925
931
|
}
|
|
926
|
-
const
|
|
932
|
+
const ve = {
|
|
927
933
|
idle: "Waiting",
|
|
928
934
|
listening: "Listening",
|
|
929
935
|
speaking: "Speaking",
|
|
930
936
|
processing: "Thinking"
|
|
931
|
-
},
|
|
932
|
-
function
|
|
937
|
+
}, xe = 0.55, ye = 1e3 / 62;
|
|
938
|
+
function we({
|
|
933
939
|
type: t = "orbit",
|
|
934
940
|
state: n = "listening",
|
|
935
941
|
size: e = 160,
|
|
936
942
|
stream: s,
|
|
937
943
|
analyser: o,
|
|
938
|
-
level:
|
|
939
|
-
sensitivity:
|
|
944
|
+
level: c,
|
|
945
|
+
sensitivity: r = 0.85,
|
|
940
946
|
threshold: l = 0.04,
|
|
941
947
|
attack: i,
|
|
942
948
|
release: a = 0.32,
|
|
943
|
-
idle:
|
|
949
|
+
idle: d = 0.1,
|
|
944
950
|
calm: h = 0.4,
|
|
945
951
|
voiceSpeed: f,
|
|
946
952
|
emotion: m = null,
|
|
947
|
-
emotionColors:
|
|
953
|
+
emotionColors: p,
|
|
948
954
|
saturation: M = 2,
|
|
949
955
|
accent: v = null,
|
|
950
|
-
gradientAngle:
|
|
956
|
+
gradientAngle: A = 99,
|
|
951
957
|
gradientSpin: u = 12,
|
|
952
958
|
neutral: g = 1,
|
|
953
959
|
colorBrightness: x = 1.02,
|
|
954
960
|
colorHue: B = 0,
|
|
955
|
-
gradientStart:
|
|
956
|
-
gradientWidth:
|
|
961
|
+
gradientStart: S = 0.1,
|
|
962
|
+
gradientWidth: L = 0.6,
|
|
957
963
|
direction: w,
|
|
958
964
|
directionMove: k,
|
|
959
|
-
directionPull:
|
|
960
|
-
directionDeform:
|
|
965
|
+
directionPull: _,
|
|
966
|
+
directionDeform: q,
|
|
961
967
|
directionSquash: U,
|
|
962
968
|
directionLens: b,
|
|
963
|
-
directionStretch:
|
|
969
|
+
directionStretch: E,
|
|
964
970
|
directionSplit: y,
|
|
965
971
|
directionBlur: I,
|
|
966
972
|
directionBounce: R,
|
|
967
|
-
directionMargin:
|
|
973
|
+
directionMargin: G,
|
|
968
974
|
directionBounds: C,
|
|
969
975
|
hoverBend: F = !1,
|
|
970
976
|
theme: T = "auto",
|
|
971
977
|
speed: P = 1,
|
|
972
978
|
paused: N = !1,
|
|
973
|
-
color:
|
|
979
|
+
color: O,
|
|
974
980
|
dots: z = 1,
|
|
975
981
|
dotSize: W,
|
|
976
982
|
opts: X,
|
|
@@ -980,31 +986,31 @@ function be({
|
|
|
980
986
|
"aria-label": at,
|
|
981
987
|
...nt
|
|
982
988
|
}) {
|
|
983
|
-
const
|
|
984
|
-
tt.current || (tt.current = new
|
|
985
|
-
const ft =
|
|
986
|
-
ft.current || (ft.current = new
|
|
987
|
-
const dt = m ? (
|
|
989
|
+
const H = St(null), st = le(T, H), $ = he(), ht = X ? JSON.stringify(X) : "", ut = !!(s || o || c != null || n === "processing"), tt = St(null);
|
|
990
|
+
tt.current || (tt.current = new ge());
|
|
991
|
+
const ft = St(null);
|
|
992
|
+
ft.current || (ft.current = new vs());
|
|
993
|
+
const dt = m ? (p == null ? void 0 : p[m]) ?? tn[m] : null, Rt = {
|
|
988
994
|
saturation: Math.min(1, M),
|
|
989
995
|
vivid: Math.max(0, Math.min(1, M - 1)),
|
|
990
996
|
brightness: x,
|
|
991
997
|
hue: B,
|
|
992
|
-
start:
|
|
993
|
-
width:
|
|
994
|
-
accent: v ?
|
|
995
|
-
angle:
|
|
998
|
+
start: S,
|
|
999
|
+
width: L,
|
|
1000
|
+
accent: v ? ms[v] : null,
|
|
1001
|
+
angle: A,
|
|
996
1002
|
spin: u,
|
|
997
1003
|
neutral: g,
|
|
998
1004
|
size: e
|
|
999
|
-
}, Wt = W ?? ot[t in ot ? t : "orbit"].dotSize ?? 1, ct = ot[t in ot ? t : "orbit"].lean ?? {}, At =
|
|
1005
|
+
}, Wt = W ?? ot[t in ot ? t : "orbit"].dotSize ?? 1, ct = ot[t in ot ? t : "orbit"].lean ?? {}, At = G ?? ot[t in ot ? t : "orbit"].margin ?? 32, Xt = {
|
|
1000
1006
|
state: n,
|
|
1001
|
-
level:
|
|
1007
|
+
level: c,
|
|
1002
1008
|
analyser: o,
|
|
1003
|
-
sensitivity:
|
|
1009
|
+
sensitivity: r,
|
|
1004
1010
|
threshold: l,
|
|
1005
1011
|
attack: i ?? ot[t in ot ? t : "orbit"].attack ?? 0.06,
|
|
1006
1012
|
release: a,
|
|
1007
|
-
idle:
|
|
1013
|
+
idle: d,
|
|
1008
1014
|
calm: h,
|
|
1009
1015
|
voiceSpeed: f ?? ot[t in ot ? t : "orbit"].voiceSpeed ?? 1,
|
|
1010
1016
|
onLevel: Z,
|
|
@@ -1012,92 +1018,92 @@ function be({
|
|
|
1012
1018
|
colors: Rt,
|
|
1013
1019
|
direction: w,
|
|
1014
1020
|
bounds: C,
|
|
1015
|
-
bend: F === !0 ?
|
|
1021
|
+
bend: F === !0 ? xe : typeof F == "number" ? Math.max(0, Math.min(1, F)) : 0,
|
|
1016
1022
|
// each amount: the prop, else the type's own, else the shared default
|
|
1017
1023
|
lean: {
|
|
1018
1024
|
move: k ?? ct.move ?? bt.move,
|
|
1019
|
-
pull:
|
|
1020
|
-
deform:
|
|
1025
|
+
pull: _ ?? ct.pull ?? bt.pull,
|
|
1026
|
+
deform: q ?? ct.deform ?? bt.deform,
|
|
1021
1027
|
squash: U ?? ct.squash ?? bt.squash,
|
|
1022
1028
|
lens: b ?? ct.lens ?? bt.lens,
|
|
1023
|
-
stretch:
|
|
1029
|
+
stretch: E ?? ct.stretch ?? bt.stretch,
|
|
1024
1030
|
split: y ?? ct.split ?? bt.split,
|
|
1025
1031
|
blur: I ?? ct.blur ?? bt.blur,
|
|
1026
1032
|
bounce: R ?? ct.bounce ?? bt.bounce
|
|
1027
1033
|
}
|
|
1028
|
-
}, xt =
|
|
1034
|
+
}, xt = St(Xt);
|
|
1029
1035
|
xt.current = Xt;
|
|
1030
|
-
const Nt = w == null ? 0 :
|
|
1036
|
+
const Nt = w == null ? 0 : ws(Xt.lean, e), [Tn, os] = Bt([1 / 0, 1 / 0]), sn = Math.min(Nt, Tn[0]), en = Math.min(Nt, Tn[1]), rt = Nt ? sn + At : 0, _t = Nt ? en + At : 0, Vt = St({ x: 0, y: 0, over: !1 }), Rn = Xt.bend > 0 && !$;
|
|
1031
1037
|
It(() => {
|
|
1032
|
-
const
|
|
1033
|
-
if (!Rn || !
|
|
1038
|
+
const K = H.current;
|
|
1039
|
+
if (!Rn || !K || typeof matchMedia != "function" || !matchMedia("(hover: hover) and (pointer: fine)").matches) return;
|
|
1034
1040
|
const yt = (it) => {
|
|
1035
1041
|
if (it.pointerType === "touch") return;
|
|
1036
|
-
const Dt =
|
|
1037
|
-
Vt.current = { x: (it.clientX - Dt.left) *
|
|
1038
|
-
},
|
|
1042
|
+
const Dt = K.getBoundingClientRect(), Ht = (e + rt + _t) / (Dt.width || 1);
|
|
1043
|
+
Vt.current = { x: (it.clientX - Dt.left) * Ht - rt, y: (it.clientY - Dt.top) * Ht, over: !0 };
|
|
1044
|
+
}, Pt = () => {
|
|
1039
1045
|
Vt.current.over = !1;
|
|
1040
1046
|
};
|
|
1041
|
-
return window.addEventListener("pointermove", yt, { passive: !0 }), document.documentElement.addEventListener("pointerleave",
|
|
1042
|
-
window.removeEventListener("pointermove", yt), document.documentElement.removeEventListener("pointerleave",
|
|
1047
|
+
return window.addEventListener("pointermove", yt, { passive: !0 }), document.documentElement.addEventListener("pointerleave", Pt), () => {
|
|
1048
|
+
window.removeEventListener("pointermove", yt), document.documentElement.removeEventListener("pointerleave", Pt), Vt.current.over = !1;
|
|
1043
1049
|
};
|
|
1044
|
-
}, [Rn, e, rt,
|
|
1045
|
-
const on =
|
|
1050
|
+
}, [Rn, e, rt, _t]);
|
|
1051
|
+
const on = St(null);
|
|
1046
1052
|
return It(() => {
|
|
1047
1053
|
if (!s) return;
|
|
1048
|
-
const
|
|
1049
|
-
return on.current = (
|
|
1050
|
-
on.current = null,
|
|
1054
|
+
const K = ps(s);
|
|
1055
|
+
return on.current = (K == null ? void 0 : K.analyser) ?? null, () => {
|
|
1056
|
+
on.current = null, K == null || K.release();
|
|
1051
1057
|
};
|
|
1052
1058
|
}, [s]), It(() => {
|
|
1053
|
-
const
|
|
1054
|
-
if (!
|
|
1059
|
+
const K = H.current;
|
|
1060
|
+
if (!K) return;
|
|
1055
1061
|
const yt = Math.min(2, typeof devicePixelRatio < "u" && devicePixelRatio || 1);
|
|
1056
|
-
|
|
1057
|
-
const
|
|
1058
|
-
if (!
|
|
1059
|
-
const it =
|
|
1060
|
-
let An = 0,
|
|
1061
|
-
const
|
|
1062
|
+
K.width = Math.round((e + rt + _t) * yt), K.height = Math.round(e * yt);
|
|
1063
|
+
const Pt = K.getContext("2d");
|
|
1064
|
+
if (!Pt) return;
|
|
1065
|
+
const it = ce(t, e, z, Wt), Dt = X ? { ...it.opts, ...X } : it.opts, Ht = Q ?? it.frame, as = be(O), wt = tt.current, cs = ft.current, rs = new Es();
|
|
1066
|
+
let An = 0, Lt = 0, an = e / 2, cn = e / 2;
|
|
1067
|
+
const is = (J, Y, D) => {
|
|
1062
1068
|
var In;
|
|
1063
|
-
|
|
1064
|
-
const
|
|
1065
|
-
let lt = Ss(
|
|
1069
|
+
Pt.setTransform(yt, 0, 0, yt, rt * yt, 0), Pt.clearRect(-rt, 0, e + rt + _t, e);
|
|
1070
|
+
const qt = N || $ ? 0 : rs.step(An, D);
|
|
1071
|
+
let lt = Ss(Ht(e, wt.t, J, Dt), J.pan, e, xt.current.lean, [sn, en], qt);
|
|
1066
1072
|
An = ((In = lt.contact) == null ? void 0 : In.press) ?? 0;
|
|
1067
1073
|
const gt = xt.current.bend;
|
|
1068
1074
|
if (gt > 0) {
|
|
1069
|
-
const
|
|
1070
|
-
|
|
1071
|
-
const Bn =
|
|
1072
|
-
an += (
|
|
1075
|
+
const Ot = Vt.current, Nn = Kn(lt, e), fs = xt.current.state === "idle" || xt.current.state === "processing", ds = Ot.over && fs && !N && !$ ? ys(Math.hypot(Ot.x - e / 2, Ot.y - e / 2) - Nn, Nn) : 0;
|
|
1076
|
+
Lt += (ds - Lt) * (1 - Math.exp(-D / 0.14));
|
|
1077
|
+
const Bn = Lt < 0.01 ? 1 : 1 - Math.exp(-D / 0.05);
|
|
1078
|
+
an += (Ot.x - an) * Bn, cn += (Ot.y - cn) * Bn, Lt > 2e-3 && (lt = xs(lt, e, { x: an, y: cn, amount: Lt * gt }));
|
|
1073
1079
|
}
|
|
1074
|
-
const pt = xt.current.colors, mt = Y.amount, et = pt.accent,
|
|
1080
|
+
const pt = xt.current.colors, mt = Y.amount, et = pt.accent, hs = et ? { r: et.r + (Y.r - et.r) * mt, g: et.g + (Y.g - et.g) * mt, b: et.b + (Y.b - et.b) * mt } : { r: Y.r, g: Y.g, b: Y.b }, us = {
|
|
1075
1081
|
...pt,
|
|
1076
|
-
accent:
|
|
1082
|
+
accent: hs,
|
|
1077
1083
|
saturation: pt.saturation * (et ? 1 : mt),
|
|
1078
1084
|
angle: pt.angle + pt.spin * wt.clock
|
|
1079
1085
|
};
|
|
1080
|
-
|
|
1086
|
+
js(Pt, lt, st, as, lt.light ? Y : void 0, us);
|
|
1081
1087
|
};
|
|
1082
|
-
let
|
|
1083
|
-
const
|
|
1088
|
+
let _n = -1 / 0;
|
|
1089
|
+
const ls = (J) => {
|
|
1084
1090
|
var pt, mt;
|
|
1085
|
-
if (!Nt || J -
|
|
1086
|
-
|
|
1087
|
-
const Y =
|
|
1088
|
-
Math.max(0, Math.floor(Y -
|
|
1091
|
+
if (!Nt || J - _n < 500) return;
|
|
1092
|
+
_n = J;
|
|
1093
|
+
const Y = K.getBoundingClientRect().left + rt, D = (mt = (pt = xt.current.bounds) == null ? void 0 : pt.current) == null ? void 0 : mt.getBoundingClientRect(), qt = D ? D.left : 0, lt = D ? D.right : document.documentElement.clientWidth, gt = [
|
|
1094
|
+
Math.max(0, Math.floor(Y - qt - At)),
|
|
1089
1095
|
Math.max(0, Math.floor(lt - Y - e - At))
|
|
1090
1096
|
];
|
|
1091
|
-
|
|
1097
|
+
os((et) => Math.abs(et[0] - gt[0]) > 1 || Math.abs(et[1] - gt[1]) > 1 ? gt : et);
|
|
1092
1098
|
};
|
|
1093
|
-
let
|
|
1094
|
-
const
|
|
1099
|
+
let Kt = 0;
|
|
1100
|
+
const Pn = (J) => {
|
|
1095
1101
|
var mt;
|
|
1096
|
-
|
|
1097
|
-
const Y =
|
|
1098
|
-
|
|
1099
|
-
const D = xt.current,
|
|
1100
|
-
|
|
1102
|
+
ls(J);
|
|
1103
|
+
const Y = Kt ? Math.min(0.05, (J - Kt) / 1e3) : 1 / 60;
|
|
1104
|
+
Kt = J;
|
|
1105
|
+
const D = xt.current, qt = D.state === "listening" || D.state === "speaking", lt = on.current ?? D.analyser ?? null;
|
|
1106
|
+
qt ? lt ? wt.readAnalyser(lt, D.sensitivity * it.gain, Y) : D.level != null ? wt.readLevel(typeof D.level == "function" ? D.level() : D.level, D.sensitivity * it.gain) : wt.readSilence() : wt.readSilence();
|
|
1101
1107
|
const gt = wt.step(
|
|
1102
1108
|
Y,
|
|
1103
1109
|
{
|
|
@@ -1115,15 +1121,15 @@ function be({
|
|
|
1115
1121
|
$
|
|
1116
1122
|
);
|
|
1117
1123
|
(mt = D.onLevel) == null || mt.call(D, gt.level);
|
|
1118
|
-
const pt =
|
|
1119
|
-
|
|
1124
|
+
const pt = cs.step(Y, D.emotionTint, wt.clock, e, N || $);
|
|
1125
|
+
is(gt, pt, Y);
|
|
1120
1126
|
};
|
|
1121
|
-
if (
|
|
1127
|
+
if (Pn(performance.now()), N || $ && !ut) return;
|
|
1122
1128
|
let rn = 0, Yt = !1, kn = 0;
|
|
1123
1129
|
const Cn = (J) => {
|
|
1124
|
-
Yt && (rn = requestAnimationFrame(Cn), !(J - kn <
|
|
1130
|
+
Yt && (rn = requestAnimationFrame(Cn), !(J - kn < ye) && (kn = J, Pn(J)));
|
|
1125
1131
|
}, ln = () => {
|
|
1126
|
-
Yt || (Yt = !0,
|
|
1132
|
+
Yt || (Yt = !0, Kt = 0, rn = requestAnimationFrame(Cn));
|
|
1127
1133
|
}, hn = () => {
|
|
1128
1134
|
Yt = !1, cancelAnimationFrame(rn);
|
|
1129
1135
|
};
|
|
@@ -1131,7 +1137,7 @@ function be({
|
|
|
1131
1137
|
const kt = typeof IntersectionObserver < "u" ? new IntersectionObserver(([J]) => {
|
|
1132
1138
|
un = J.isIntersecting, un && document.visibilityState !== "hidden" ? ln() : hn();
|
|
1133
1139
|
}) : null;
|
|
1134
|
-
kt == null || kt.observe(
|
|
1140
|
+
kt == null || kt.observe(K);
|
|
1135
1141
|
const Fn = () => {
|
|
1136
1142
|
document.visibilityState === "hidden" ? hn() : un && ln();
|
|
1137
1143
|
};
|
|
@@ -1145,32 +1151,32 @@ function be({
|
|
|
1145
1151
|
sn,
|
|
1146
1152
|
en,
|
|
1147
1153
|
rt,
|
|
1148
|
-
|
|
1154
|
+
_t,
|
|
1149
1155
|
At,
|
|
1150
1156
|
st,
|
|
1151
1157
|
P,
|
|
1152
1158
|
N,
|
|
1153
1159
|
$,
|
|
1154
1160
|
ut,
|
|
1155
|
-
|
|
1161
|
+
O,
|
|
1156
1162
|
z,
|
|
1157
1163
|
Wt,
|
|
1158
1164
|
ht,
|
|
1159
1165
|
Q,
|
|
1160
1166
|
N || $ ? m : null,
|
|
1161
|
-
N || $ ? `${M}|${v}|${
|
|
1162
|
-
]), /* @__PURE__ */
|
|
1167
|
+
N || $ ? `${M}|${v}|${A}|${u}|${g}|${x}|${B}|${S}|${L}` : null
|
|
1168
|
+
]), /* @__PURE__ */ Xn(
|
|
1163
1169
|
"canvas",
|
|
1164
1170
|
{
|
|
1165
|
-
ref:
|
|
1171
|
+
ref: H,
|
|
1166
1172
|
role: "img",
|
|
1167
|
-
"aria-label": at ??
|
|
1168
|
-
style: { width: e + rt +
|
|
1173
|
+
"aria-label": at ?? ve[n],
|
|
1174
|
+
style: { width: e + rt + _t, height: e, display: "block", marginLeft: -rt, marginRight: -_t, ...V },
|
|
1169
1175
|
...nt
|
|
1170
1176
|
}
|
|
1171
1177
|
);
|
|
1172
1178
|
}
|
|
1173
|
-
const
|
|
1179
|
+
const Ee = {
|
|
1174
1180
|
echoCancellation: !1,
|
|
1175
1181
|
noiseSuppression: !1,
|
|
1176
1182
|
autoGainControl: !1
|
|
@@ -1178,29 +1184,29 @@ const ve = {
|
|
|
1178
1184
|
function Qt() {
|
|
1179
1185
|
return typeof navigator < "u" && typeof navigator.mediaDevices < "u" && typeof navigator.mediaDevices.getUserMedia == "function";
|
|
1180
1186
|
}
|
|
1181
|
-
function
|
|
1182
|
-
const { constraints: n, autoStart: e = !1 } = t, [s, o] = Bt(null), [
|
|
1183
|
-
|
|
1184
|
-
const h =
|
|
1187
|
+
function _e(t = {}) {
|
|
1188
|
+
const { constraints: n, autoStart: e = !1 } = t, [s, o] = Bt(null), [c, r] = Bt(() => Qt() ? "idle" : "unsupported"), [l, i] = Bt(null), a = St(null), d = St(n);
|
|
1189
|
+
d.current = n;
|
|
1190
|
+
const h = Gn(() => {
|
|
1185
1191
|
const m = a.current;
|
|
1186
|
-
a.current = null, m && m.getTracks().forEach((
|
|
1187
|
-
}, []), f =
|
|
1192
|
+
a.current = null, m && m.getTracks().forEach((p) => p.stop()), o(null), r(Qt() ? "idle" : "unsupported");
|
|
1193
|
+
}, []), f = Gn(async () => {
|
|
1188
1194
|
if (!Qt())
|
|
1189
|
-
return
|
|
1195
|
+
return r("unsupported"), null;
|
|
1190
1196
|
if (a.current) return a.current;
|
|
1191
|
-
|
|
1197
|
+
Hn(), r("requesting"), i(null);
|
|
1192
1198
|
try {
|
|
1193
1199
|
const m = await navigator.mediaDevices.getUserMedia({
|
|
1194
|
-
audio: { ...
|
|
1200
|
+
audio: { ...Ee, ...d.current ?? {} }
|
|
1195
1201
|
});
|
|
1196
|
-
a.current = m, o(m),
|
|
1197
|
-
const
|
|
1198
|
-
a.current === m && (a.current = null, o(null),
|
|
1202
|
+
a.current = m, o(m), r("live");
|
|
1203
|
+
const p = () => {
|
|
1204
|
+
a.current === m && (a.current = null, o(null), r("idle"));
|
|
1199
1205
|
};
|
|
1200
|
-
return m.getAudioTracks().forEach((M) => M.addEventListener("ended",
|
|
1206
|
+
return m.getAudioTracks().forEach((M) => M.addEventListener("ended", p)), m;
|
|
1201
1207
|
} catch (m) {
|
|
1202
|
-
const
|
|
1203
|
-
return i(
|
|
1208
|
+
const p = m instanceof Error ? m : new Error(String(m));
|
|
1209
|
+
return i(p), r(p.name === "NotAllowedError" || p.name === "SecurityError" ? "denied" : "error"), null;
|
|
1204
1210
|
}
|
|
1205
1211
|
}, []);
|
|
1206
1212
|
return It(() => {
|
|
@@ -1208,26 +1214,26 @@ function Ee(t = {}) {
|
|
|
1208
1214
|
}, [e]), It(
|
|
1209
1215
|
() => () => {
|
|
1210
1216
|
const m = a.current;
|
|
1211
|
-
a.current = null, m && m.getTracks().forEach((
|
|
1217
|
+
a.current = null, m && m.getTracks().forEach((p) => p.stop());
|
|
1212
1218
|
},
|
|
1213
1219
|
[]
|
|
1214
|
-
), { stream: s, state:
|
|
1220
|
+
), { stream: s, state: c, error: l, supported: Qt(), start: f, stop: h };
|
|
1215
1221
|
}
|
|
1216
|
-
function
|
|
1217
|
-
return /* @__PURE__ */
|
|
1222
|
+
function Pe(t) {
|
|
1223
|
+
return /* @__PURE__ */ Xn(we, { ...t, type: "aura" });
|
|
1218
1224
|
}
|
|
1219
1225
|
export {
|
|
1220
|
-
|
|
1226
|
+
ms as ACCENT_COLORS,
|
|
1221
1227
|
tn as EMOTION_COLORS,
|
|
1222
1228
|
ot as PRESETS,
|
|
1223
1229
|
vt as SPECTRUM_N,
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1230
|
+
Ae as VOICE_ORB_TYPES,
|
|
1231
|
+
ge as VoiceFollower,
|
|
1232
|
+
we as VoiceOrb,
|
|
1233
|
+
Pe as VoiceRing,
|
|
1234
|
+
ps as acquireAnalyser,
|
|
1235
|
+
Hn as getAudioContext,
|
|
1236
|
+
Re as isAudioSupported,
|
|
1237
|
+
ce as resolvePreset,
|
|
1238
|
+
_e as useMicrophone
|
|
1233
1239
|
};
|