react-ai-avatar 0.1.2 → 0.2.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.
- package/README.md +188 -142
- package/dist/lib/components/AvatarCaption.d.ts +25 -0
- package/dist/lib/components/RealtimeAvatar.d.ts +18 -1
- package/dist/lib/components/SquirrelAvatar.d.ts +8 -1
- package/dist/lib/index.cjs +4 -4
- package/dist/lib/index.js +661 -552
- package/dist/lib/lib/index.d.ts +2 -2
- package/dist/lib/react-ai-avatar.css +1 -1
- package/package.json +1 -1
package/dist/lib/index.js
CHANGED
|
@@ -1,114 +1,114 @@
|
|
|
1
1
|
import { jsx as e, jsxs as o } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import { u as
|
|
4
|
-
import { S as
|
|
5
|
-
import { motion as
|
|
6
|
-
const
|
|
2
|
+
import ae, { useRef as Z, useEffect as X, useId as me, useState as ce, Suspense as he } from "react";
|
|
3
|
+
import { u as oe, c as de, a as Ae } from "./useReducedMotion-BDcEizfP.js";
|
|
4
|
+
import { S as rt, i as lt } from "./useReducedMotion-BDcEizfP.js";
|
|
5
|
+
import { motion as ne, AnimatePresence as Ne, useMotionValue as ue } from "motion/react";
|
|
6
|
+
const Le = {
|
|
7
7
|
idle: "#4b5563",
|
|
8
8
|
listening: "#3b82f6",
|
|
9
9
|
thinking: "#8b5cf6",
|
|
10
10
|
speaking: "#10b981",
|
|
11
11
|
working: "#f59e0b"
|
|
12
12
|
};
|
|
13
|
-
function
|
|
14
|
-
const l =
|
|
13
|
+
function Se(t, r) {
|
|
14
|
+
const l = oe(), c = Z(r);
|
|
15
15
|
c.current = r;
|
|
16
|
-
const a =
|
|
17
|
-
|
|
16
|
+
const a = Z({ x: 0, y: 0 });
|
|
17
|
+
X(() => {
|
|
18
18
|
if (l) return;
|
|
19
|
-
const
|
|
20
|
-
a.current.x = Math.max(-1, Math.min(1,
|
|
19
|
+
const i = (s) => {
|
|
20
|
+
a.current.x = Math.max(-1, Math.min(1, s.clientX / window.innerWidth * 2 - 1)), a.current.y = Math.max(-1, Math.min(1, s.clientY / window.innerHeight * 2 - 1));
|
|
21
21
|
};
|
|
22
|
-
return window.addEventListener("mousemove",
|
|
23
|
-
}, [l]),
|
|
24
|
-
const
|
|
25
|
-
if (
|
|
26
|
-
const
|
|
27
|
-
let
|
|
28
|
-
const
|
|
29
|
-
var
|
|
30
|
-
|
|
31
|
-
const
|
|
22
|
+
return window.addEventListener("mousemove", i), () => window.removeEventListener("mousemove", i);
|
|
23
|
+
}, [l]), X(() => {
|
|
24
|
+
const i = t.current;
|
|
25
|
+
if (i === null || typeof window > "u") return;
|
|
26
|
+
const s = (E, $) => $ > 0 ? Math.round(E / $) * $ : E;
|
|
27
|
+
let d = null, f = null, u = null, p = [], n = [], B = [], F = !1, _ = 3, U = 9, M = 0, x = 1, I = [], h = [], v = [];
|
|
28
|
+
const N = () => {
|
|
29
|
+
var C;
|
|
30
|
+
d = i.querySelector("#rra-ring"), f = i.querySelector("#rra-mouth"), u = i.querySelector("#rra-think"), p = u ? Array.from(u.querySelectorAll("circle, rect")) : [], n = Array.from(i.querySelectorAll(".rra-pupil")), B = Array.from(i.querySelectorAll(".rra-lid")), F = (f == null ? void 0 : f.tagName.toLowerCase()) === "rect", _ = f ? parseFloat(f.getAttribute(F ? "height" : "ry") ?? "3") : 3, U = f ? parseFloat(f.getAttribute(F ? "width" : "rx") ?? "9") : 9, M = f ? parseFloat(f.getAttribute("data-quantize") ?? "0") : 0, I = n.map((w) => {
|
|
31
|
+
const O = w.tagName.toLowerCase() === "rect";
|
|
32
32
|
return {
|
|
33
|
-
isRect:
|
|
34
|
-
x: parseFloat(
|
|
35
|
-
y: parseFloat(
|
|
36
|
-
quantize: parseFloat(
|
|
33
|
+
isRect: O,
|
|
34
|
+
x: parseFloat(w.getAttribute("data-base-x") ?? w.getAttribute(O ? "x" : "cx") ?? "0"),
|
|
35
|
+
y: parseFloat(w.getAttribute("data-base-y") ?? w.getAttribute(O ? "y" : "cy") ?? "0"),
|
|
36
|
+
quantize: parseFloat(w.getAttribute("data-quantize") ?? "0")
|
|
37
37
|
};
|
|
38
|
-
}),
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
}, y = () => (
|
|
42
|
-
|
|
43
|
-
let L = null, J = null,
|
|
44
|
-
const
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
const
|
|
48
|
-
if (
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
let
|
|
52
|
-
if (
|
|
53
|
-
const
|
|
54
|
-
|
|
38
|
+
}), h = B.map((w) => parseFloat(w.getAttribute("data-max-height") ?? "16")), v = n.map(() => ({ x: 0, y: 0 }));
|
|
39
|
+
const E = i.querySelector("svg"), $ = parseFloat(((C = E == null ? void 0 : E.getAttribute("viewBox")) == null ? void 0 : C.split(/[\s,]+/)[2]) ?? "200");
|
|
40
|
+
x = $ > 0 ? $ / 200 : 1;
|
|
41
|
+
}, y = () => (f ? !f.isConnected : i.querySelector("#rra-mouth") !== null) || (d ? !d.isConnected : i.querySelector("#rra-ring") !== null);
|
|
42
|
+
N();
|
|
43
|
+
let L = null, J = null, te = !1, Q = 0, R = 1, g = 1, b = 1500 + Math.random() * 2e3, q = 0, k = !1, z = 0, ee = 0, Y = 0, P = performance.now();
|
|
44
|
+
const j = (E) => {
|
|
45
|
+
const $ = Math.min(100, E - P);
|
|
46
|
+
P = E, y() && N();
|
|
47
|
+
const C = c.current, { state: w } = C, O = { ...Le, ...C.stateColors }, H = (C.maxMouthOpening ?? 30) * x, G = l ? 0 : C.mouseTrackingIntensity ?? 1, ie = C.blinkIntervalMin ?? 2e3, V = C.blinkIntervalMax ?? 6e3, le = C.blinkDuration ?? 100;
|
|
48
|
+
if (d == null || d.setAttribute("stroke", O[w]), f) {
|
|
49
|
+
const S = w === "speaking";
|
|
50
|
+
S && (!te || J !== C.analyser) && (L = de(C.analyser), J = C.analyser, te = !0), S || (te = !1);
|
|
51
|
+
let m = 0, W = 1, A = 1;
|
|
52
|
+
if (S && L) {
|
|
53
|
+
const T = L.read();
|
|
54
|
+
m = T.level, T.shape === "e" ? (W = 1.35, A = 0.55) : T.shape === "o" && (W = 0.65, A = 1.35);
|
|
55
55
|
}
|
|
56
|
-
if (
|
|
57
|
-
const
|
|
58
|
-
|
|
56
|
+
if (Q += (m - Q) * 0.3, R += (W - R) * 0.25, g += (A - g) * 0.25, F) {
|
|
57
|
+
const T = s(_ + Q * g * H * 0.4, M);
|
|
58
|
+
f.setAttribute("height", String(Math.max(_, T)));
|
|
59
59
|
} else
|
|
60
|
-
|
|
60
|
+
f.setAttribute("ry", String(_ + Q * g * H * 0.4)), f.setAttribute("rx", String(U * (1 + (R - 1) * Math.min(1, Q * 2))));
|
|
61
61
|
}
|
|
62
|
-
if (!l &&
|
|
63
|
-
|
|
64
|
-
const
|
|
65
|
-
|
|
62
|
+
if (!l && B.length > 0) {
|
|
63
|
+
k ? (q += $ / le, q >= 2 && (k = !1, q = 0, b = ie + Math.random() * Math.max(0, V - ie))) : (b -= $, b <= 0 && (k = !0, q = 0));
|
|
64
|
+
const S = k ? 1 - Math.abs(1 - Math.min(2, q)) : 0;
|
|
65
|
+
B.forEach((m, W) => m.setAttribute("height", String(S * h[W])));
|
|
66
66
|
}
|
|
67
67
|
if (n.length > 0) {
|
|
68
|
-
let
|
|
69
|
-
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
const
|
|
73
|
-
|
|
68
|
+
let S = a.current.x * 3 * G, m = a.current.y * 2.2 * G;
|
|
69
|
+
w === "thinking" ? (S = -2.5, m = -3) : w === "working" ? (S = 0, m = 3.5) : w === "listening" && !l && (S += Math.sin(E * 21e-4) * 0.5, m += Math.cos(E * 17e-4) * 0.4), S *= x, m *= x, n.forEach((W, A) => {
|
|
70
|
+
const T = I[A];
|
|
71
|
+
v[A].x += (S - v[A].x) * 0.12, v[A].y += (m - v[A].y) * 0.12;
|
|
72
|
+
const K = T.x + s(v[A].x, T.quantize), re = T.y + s(v[A].y, T.quantize);
|
|
73
|
+
T.isRect ? (W.setAttribute("x", String(K)), W.setAttribute("y", String(re))) : (W.setAttribute("cx", String(K)), W.setAttribute("cy", String(re)));
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
|
-
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
})) :
|
|
76
|
+
u && (z += ((w === "thinking" ? 1 : 0) - z) * 0.12, u.setAttribute("opacity", String(z < 0.01 ? 0 : z)), w === "thinking" && !l ? (ee += $ * 4e-3, p.forEach((m, W) => {
|
|
77
|
+
const A = 0.35 + 0.65 * Math.max(0, Math.sin(ee - W * 0.9));
|
|
78
|
+
m.setAttribute("opacity", String(A));
|
|
79
|
+
})) : p.forEach((m) => m.setAttribute("opacity", "1"))), Y = requestAnimationFrame(j);
|
|
80
80
|
};
|
|
81
|
-
return
|
|
82
|
-
}, [
|
|
81
|
+
return Y = requestAnimationFrame(j), () => cancelAnimationFrame(Y);
|
|
82
|
+
}, [t, l]);
|
|
83
83
|
}
|
|
84
|
-
function
|
|
85
|
-
state:
|
|
84
|
+
function pe({
|
|
85
|
+
state: t,
|
|
86
86
|
analyser: r,
|
|
87
87
|
size: l = 300,
|
|
88
88
|
className: c = "",
|
|
89
89
|
style: a,
|
|
90
|
-
maxMouthOpening:
|
|
91
|
-
mouseTrackingIntensity:
|
|
92
|
-
blinkIntervalMin:
|
|
93
|
-
blinkIntervalMax:
|
|
94
|
-
blinkDuration:
|
|
95
|
-
stateColors:
|
|
90
|
+
maxMouthOpening: i,
|
|
91
|
+
mouseTrackingIntensity: s,
|
|
92
|
+
blinkIntervalMin: d,
|
|
93
|
+
blinkIntervalMax: f,
|
|
94
|
+
blinkDuration: u,
|
|
95
|
+
stateColors: p,
|
|
96
96
|
children: n
|
|
97
97
|
}) {
|
|
98
|
-
const
|
|
99
|
-
return
|
|
100
|
-
state:
|
|
98
|
+
const B = Z(null);
|
|
99
|
+
return Se(B, {
|
|
100
|
+
state: t,
|
|
101
101
|
analyser: r,
|
|
102
|
-
stateColors:
|
|
103
|
-
maxMouthOpening:
|
|
104
|
-
mouseTrackingIntensity:
|
|
105
|
-
blinkIntervalMin:
|
|
106
|
-
blinkIntervalMax:
|
|
107
|
-
blinkDuration:
|
|
102
|
+
stateColors: p,
|
|
103
|
+
maxMouthOpening: i,
|
|
104
|
+
mouseTrackingIntensity: s,
|
|
105
|
+
blinkIntervalMin: d,
|
|
106
|
+
blinkIntervalMax: f,
|
|
107
|
+
blinkDuration: u
|
|
108
108
|
}), /* @__PURE__ */ e(
|
|
109
109
|
"div",
|
|
110
110
|
{
|
|
111
|
-
ref:
|
|
111
|
+
ref: B,
|
|
112
112
|
className: `relative flex items-center justify-center ${c}`,
|
|
113
113
|
style: { width: l, height: l, ...a },
|
|
114
114
|
children: n
|
|
@@ -116,59 +116,59 @@ function ue({
|
|
|
116
116
|
);
|
|
117
117
|
}
|
|
118
118
|
function ge({
|
|
119
|
-
size:
|
|
119
|
+
size: t = 300,
|
|
120
120
|
customization: r,
|
|
121
121
|
mouthColor: l = "#7a3b2e",
|
|
122
122
|
className: c,
|
|
123
123
|
style: a
|
|
124
124
|
}) {
|
|
125
125
|
const {
|
|
126
|
-
skinColor:
|
|
127
|
-
hairColor:
|
|
128
|
-
clothingColor:
|
|
129
|
-
hoodieColor:
|
|
130
|
-
bgColor:
|
|
131
|
-
glasses:
|
|
126
|
+
skinColor: i = "#f5c7a9",
|
|
127
|
+
hairColor: s = "#2c2c2c",
|
|
128
|
+
clothingColor: d = "#3b7b9b",
|
|
129
|
+
hoodieColor: f = "#3a3e45",
|
|
130
|
+
bgColor: u = "#88c0b7",
|
|
131
|
+
glasses: p = !0,
|
|
132
132
|
glassesColor: n = "#2c2c2c",
|
|
133
|
-
headphones:
|
|
134
|
-
headphonesColor:
|
|
133
|
+
headphones: B = !0,
|
|
134
|
+
headphonesColor: F = "#3a3b40"
|
|
135
135
|
} = r ?? {};
|
|
136
136
|
return /* @__PURE__ */ o(
|
|
137
137
|
"svg",
|
|
138
138
|
{
|
|
139
139
|
viewBox: "0 0 200 200",
|
|
140
|
-
width:
|
|
141
|
-
height:
|
|
140
|
+
width: t,
|
|
141
|
+
height: t,
|
|
142
142
|
xmlns: "http://www.w3.org/2000/svg",
|
|
143
143
|
role: "img",
|
|
144
144
|
"aria-label": "Avatar",
|
|
145
145
|
className: c,
|
|
146
146
|
style: a,
|
|
147
147
|
children: [
|
|
148
|
-
/* @__PURE__ */ e("circle", { cx: "100", cy: "100", r: "78", fill:
|
|
148
|
+
/* @__PURE__ */ e("circle", { cx: "100", cy: "100", r: "78", fill: u }),
|
|
149
149
|
/* @__PURE__ */ e("clipPath", { id: "rra-clip", children: /* @__PURE__ */ e("circle", { cx: "100", cy: "100", r: "78" }) }),
|
|
150
150
|
/* @__PURE__ */ o("g", { clipPath: "url(#rra-clip)", children: [
|
|
151
|
-
/* @__PURE__ */ e("rect", { id: "rra-clothing", x: "48", y: "150", width: "104", height: "60", rx: "20", fill:
|
|
152
|
-
/* @__PURE__ */ e("path", { id: "rra-hoodie", d: "M52 168 Q52 140 100 140 Q148 140 148 168 L148 210 L52 210 Z", fill:
|
|
153
|
-
/* @__PURE__ */ e("rect", { id: "rra-neck", x: "88", y: "120", width: "24", height: "28", rx: "10", fill:
|
|
154
|
-
/* @__PURE__ */ e("ellipse", { id: "rra-head", cx: "100", cy: "92", rx: "42", ry: "46", fill:
|
|
155
|
-
/* @__PURE__ */ e("path", { id: "rra-hair", d: "M58 88 Q56 44 100 44 Q144 44 142 88 Q142 70 128 62 Q120 76 100 74 Q80 76 72 62 Q58 70 58 88 Z", fill:
|
|
156
|
-
|
|
157
|
-
/* @__PURE__ */ e("rect", { x: "50", y: "84", width: "12", height: "26", rx: "6", fill:
|
|
158
|
-
/* @__PURE__ */ e("rect", { x: "138", y: "84", width: "12", height: "26", rx: "6", fill:
|
|
159
|
-
/* @__PURE__ */ e("path", { d: "M56 90 Q56 50 100 50 Q144 50 144 90", fill: "none", stroke:
|
|
151
|
+
/* @__PURE__ */ e("rect", { id: "rra-clothing", x: "48", y: "150", width: "104", height: "60", rx: "20", fill: d }),
|
|
152
|
+
/* @__PURE__ */ e("path", { id: "rra-hoodie", d: "M52 168 Q52 140 100 140 Q148 140 148 168 L148 210 L52 210 Z", fill: f }),
|
|
153
|
+
/* @__PURE__ */ e("rect", { id: "rra-neck", x: "88", y: "120", width: "24", height: "28", rx: "10", fill: i, opacity: "0.85" }),
|
|
154
|
+
/* @__PURE__ */ e("ellipse", { id: "rra-head", cx: "100", cy: "92", rx: "42", ry: "46", fill: i }),
|
|
155
|
+
/* @__PURE__ */ e("path", { id: "rra-hair", d: "M58 88 Q56 44 100 44 Q144 44 142 88 Q142 70 128 62 Q120 76 100 74 Q80 76 72 62 Q58 70 58 88 Z", fill: s }),
|
|
156
|
+
B && /* @__PURE__ */ o("g", { id: "rra-headphones", children: [
|
|
157
|
+
/* @__PURE__ */ e("rect", { x: "50", y: "84", width: "12", height: "26", rx: "6", fill: F }),
|
|
158
|
+
/* @__PURE__ */ e("rect", { x: "138", y: "84", width: "12", height: "26", rx: "6", fill: F }),
|
|
159
|
+
/* @__PURE__ */ e("path", { d: "M56 90 Q56 50 100 50 Q144 50 144 90", fill: "none", stroke: F, strokeWidth: "7", strokeLinecap: "round" })
|
|
160
160
|
] }),
|
|
161
161
|
/* @__PURE__ */ o("g", { id: "rra-eyeL", children: [
|
|
162
162
|
/* @__PURE__ */ e("ellipse", { cx: "84", cy: "90", rx: "9", ry: "7", fill: "#ffffff" }),
|
|
163
163
|
/* @__PURE__ */ e("circle", { className: "rra-pupil", "data-base-x": "84", "data-base-y": "90", cx: "84", cy: "90", r: "4", fill: "#2c2c2c" }),
|
|
164
|
-
/* @__PURE__ */ e("rect", { className: "rra-lid", "data-max-height": "17", x: "74", y: "80", width: "20", height: "0", fill:
|
|
164
|
+
/* @__PURE__ */ e("rect", { className: "rra-lid", "data-max-height": "17", x: "74", y: "80", width: "20", height: "0", fill: i })
|
|
165
165
|
] }),
|
|
166
166
|
/* @__PURE__ */ o("g", { id: "rra-eyeR", children: [
|
|
167
167
|
/* @__PURE__ */ e("ellipse", { cx: "116", cy: "90", rx: "9", ry: "7", fill: "#ffffff" }),
|
|
168
168
|
/* @__PURE__ */ e("circle", { className: "rra-pupil", "data-base-x": "116", "data-base-y": "90", cx: "116", cy: "90", r: "4", fill: "#2c2c2c" }),
|
|
169
|
-
/* @__PURE__ */ e("rect", { className: "rra-lid", "data-max-height": "17", x: "106", y: "80", width: "20", height: "0", fill:
|
|
169
|
+
/* @__PURE__ */ e("rect", { className: "rra-lid", "data-max-height": "17", x: "106", y: "80", width: "20", height: "0", fill: i })
|
|
170
170
|
] }),
|
|
171
|
-
|
|
171
|
+
p && /* @__PURE__ */ o("g", { id: "rra-glasses", children: [
|
|
172
172
|
/* @__PURE__ */ e("rect", { x: "72", y: "82", width: "24", height: "16", rx: "6", fill: "none", stroke: n, strokeWidth: "2.5" }),
|
|
173
173
|
/* @__PURE__ */ e("rect", { x: "104", y: "82", width: "24", height: "16", rx: "6", fill: "none", stroke: n, strokeWidth: "2.5" }),
|
|
174
174
|
/* @__PURE__ */ e("line", { x1: "96", y1: "90", x2: "104", y2: "90", stroke: n, strokeWidth: "2.5" })
|
|
@@ -184,23 +184,23 @@ function ge({
|
|
|
184
184
|
}
|
|
185
185
|
);
|
|
186
186
|
}
|
|
187
|
-
function
|
|
188
|
-
size:
|
|
187
|
+
function Qe({
|
|
188
|
+
size: t = 300,
|
|
189
189
|
customization: r,
|
|
190
190
|
className: l,
|
|
191
191
|
style: c
|
|
192
192
|
}) {
|
|
193
193
|
const {
|
|
194
194
|
skinColor: a = "#f6c8a8",
|
|
195
|
-
hairColor:
|
|
196
|
-
bgColor:
|
|
197
|
-
} = r ?? {},
|
|
195
|
+
hairColor: i = "#5b3a23",
|
|
196
|
+
bgColor: s = "#dbe7f4"
|
|
197
|
+
} = r ?? {}, d = me().replace(/[^a-zA-Z0-9]/g, ""), f = `rra-skin-${d}`, u = `rra-bg-${d}`, p = `rra-hair-${d}`, n = `rra-mouthg-${d}`;
|
|
198
198
|
return /* @__PURE__ */ o(
|
|
199
199
|
"svg",
|
|
200
200
|
{
|
|
201
201
|
viewBox: "0 0 200 200",
|
|
202
|
-
width:
|
|
203
|
-
height:
|
|
202
|
+
width: t,
|
|
203
|
+
height: t,
|
|
204
204
|
xmlns: "http://www.w3.org/2000/svg",
|
|
205
205
|
role: "img",
|
|
206
206
|
"aria-label": "Avatar",
|
|
@@ -208,30 +208,30 @@ function Le({
|
|
|
208
208
|
style: c,
|
|
209
209
|
children: [
|
|
210
210
|
/* @__PURE__ */ o("defs", { children: [
|
|
211
|
-
/* @__PURE__ */ o("radialGradient", { id:
|
|
211
|
+
/* @__PURE__ */ o("radialGradient", { id: f, cx: "0.38", cy: "0.32", r: "0.85", children: [
|
|
212
212
|
/* @__PURE__ */ e("stop", { offset: "0%", stopColor: "#ffffff", stopOpacity: "0.55" }),
|
|
213
213
|
/* @__PURE__ */ e("stop", { offset: "35%", stopColor: a }),
|
|
214
214
|
/* @__PURE__ */ e("stop", { offset: "100%", stopColor: a, stopOpacity: "1" })
|
|
215
215
|
] }),
|
|
216
|
-
/* @__PURE__ */ o("radialGradient", { id:
|
|
216
|
+
/* @__PURE__ */ o("radialGradient", { id: u, cx: "0.5", cy: "0.35", r: "0.9", children: [
|
|
217
217
|
/* @__PURE__ */ e("stop", { offset: "0%", stopColor: "#ffffff", stopOpacity: "0.9" }),
|
|
218
|
-
/* @__PURE__ */ e("stop", { offset: "100%", stopColor:
|
|
218
|
+
/* @__PURE__ */ e("stop", { offset: "100%", stopColor: s })
|
|
219
219
|
] }),
|
|
220
|
-
/* @__PURE__ */ o("linearGradient", { id:
|
|
221
|
-
/* @__PURE__ */ e("stop", { offset: "0%", stopColor:
|
|
222
|
-
/* @__PURE__ */ e("stop", { offset: "100%", stopColor:
|
|
220
|
+
/* @__PURE__ */ o("linearGradient", { id: p, x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
|
221
|
+
/* @__PURE__ */ e("stop", { offset: "0%", stopColor: i, stopOpacity: "0.85" }),
|
|
222
|
+
/* @__PURE__ */ e("stop", { offset: "100%", stopColor: i })
|
|
223
223
|
] }),
|
|
224
224
|
/* @__PURE__ */ o("linearGradient", { id: n, x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
|
225
225
|
/* @__PURE__ */ e("stop", { offset: "0%", stopColor: "#7c2f33" }),
|
|
226
226
|
/* @__PURE__ */ e("stop", { offset: "100%", stopColor: "#52181c" })
|
|
227
227
|
] })
|
|
228
228
|
] }),
|
|
229
|
-
/* @__PURE__ */ e("circle", { cx: "100", cy: "100", r: "78", fill: `url(#${
|
|
230
|
-
/* @__PURE__ */ e("clipPath", { id: `rra-memoji-clip-${
|
|
231
|
-
/* @__PURE__ */ o("g", { clipPath: `url(#rra-memoji-clip-${
|
|
229
|
+
/* @__PURE__ */ e("circle", { cx: "100", cy: "100", r: "78", fill: `url(#${u})` }),
|
|
230
|
+
/* @__PURE__ */ e("clipPath", { id: `rra-memoji-clip-${d}`, children: /* @__PURE__ */ e("circle", { cx: "100", cy: "100", r: "78" }) }),
|
|
231
|
+
/* @__PURE__ */ o("g", { clipPath: `url(#rra-memoji-clip-${d})`, children: [
|
|
232
232
|
/* @__PURE__ */ e("rect", { x: "86", y: "128", width: "28", height: "30", rx: "12", fill: a }),
|
|
233
233
|
/* @__PURE__ */ e("ellipse", { cx: "100", cy: "178", rx: "52", ry: "28", fill: "#ffffff", opacity: "0.85" }),
|
|
234
|
-
/* @__PURE__ */ e("ellipse", { id: "rra-head", cx: "100", cy: "94", rx: "44", ry: "48", fill: `url(#${
|
|
234
|
+
/* @__PURE__ */ e("ellipse", { id: "rra-head", cx: "100", cy: "94", rx: "44", ry: "48", fill: `url(#${f})` }),
|
|
235
235
|
/* @__PURE__ */ e("ellipse", { cx: "100", cy: "132", rx: "20", ry: "7", fill: "#000000", opacity: "0.06" }),
|
|
236
236
|
/* @__PURE__ */ e("ellipse", { cx: "55", cy: "96", rx: "7", ry: "11", fill: a }),
|
|
237
237
|
/* @__PURE__ */ e("ellipse", { cx: "145", cy: "96", rx: "7", ry: "11", fill: a }),
|
|
@@ -240,11 +240,11 @@ function Le({
|
|
|
240
240
|
{
|
|
241
241
|
id: "rra-hair",
|
|
242
242
|
d: "M54 92 Q50 38 100 40 Q150 38 146 92 Q146 66 126 58 Q120 72 96 68 Q72 72 66 58 Q54 66 54 92 Z",
|
|
243
|
-
fill: `url(#${
|
|
243
|
+
fill: `url(#${p})`
|
|
244
244
|
}
|
|
245
245
|
),
|
|
246
|
-
/* @__PURE__ */ e("path", { d: "M70 76 Q82 70 92 75", fill: "none", stroke:
|
|
247
|
-
/* @__PURE__ */ e("path", { d: "M108 75 Q118 70 130 76", fill: "none", stroke:
|
|
246
|
+
/* @__PURE__ */ e("path", { d: "M70 76 Q82 70 92 75", fill: "none", stroke: i, strokeWidth: "4", strokeLinecap: "round", opacity: "0.9" }),
|
|
247
|
+
/* @__PURE__ */ e("path", { d: "M108 75 Q118 70 130 76", fill: "none", stroke: i, strokeWidth: "4", strokeLinecap: "round", opacity: "0.9" }),
|
|
248
248
|
/* @__PURE__ */ o("g", { id: "rra-eyeL", children: [
|
|
249
249
|
/* @__PURE__ */ e("ellipse", { cx: "81", cy: "92", rx: "10.5", ry: "8.5", fill: "#ffffff" }),
|
|
250
250
|
/* @__PURE__ */ e("circle", { className: "rra-pupil", "data-base-x": "81", "data-base-y": "92", cx: "81", cy: "92", r: "5", fill: "#3d2c20" }),
|
|
@@ -271,24 +271,24 @@ function Le({
|
|
|
271
271
|
}
|
|
272
272
|
);
|
|
273
273
|
}
|
|
274
|
-
function
|
|
275
|
-
size:
|
|
274
|
+
function We({
|
|
275
|
+
size: t = 300,
|
|
276
276
|
customization: r,
|
|
277
277
|
className: l,
|
|
278
278
|
style: c
|
|
279
279
|
}) {
|
|
280
280
|
const {
|
|
281
281
|
skinColor: a = "#f0b58a",
|
|
282
|
-
hairColor:
|
|
283
|
-
clothingColor:
|
|
284
|
-
bgColor:
|
|
282
|
+
hairColor: i = "#3a2a1e",
|
|
283
|
+
clothingColor: s = "#2f6f8f",
|
|
284
|
+
bgColor: d = "#9ad1c8"
|
|
285
285
|
} = r ?? {};
|
|
286
286
|
return /* @__PURE__ */ o(
|
|
287
287
|
"svg",
|
|
288
288
|
{
|
|
289
289
|
viewBox: "0 0 32 32",
|
|
290
|
-
width:
|
|
291
|
-
height:
|
|
290
|
+
width: t,
|
|
291
|
+
height: t,
|
|
292
292
|
xmlns: "http://www.w3.org/2000/svg",
|
|
293
293
|
role: "img",
|
|
294
294
|
"aria-label": "Avatar",
|
|
@@ -296,17 +296,17 @@ function Se({
|
|
|
296
296
|
style: { imageRendering: "pixelated", ...c },
|
|
297
297
|
shapeRendering: "crispEdges",
|
|
298
298
|
children: [
|
|
299
|
-
/* @__PURE__ */ e("rect", { x: "2", y: "2", width: "28", height: "28", fill:
|
|
300
|
-
/* @__PURE__ */ e("rect", { id: "rra-clothing", x: "8", y: "26", width: "16", height: "4", fill:
|
|
301
|
-
/* @__PURE__ */ e("rect", { x: "10", y: "25", width: "12", height: "1", fill:
|
|
299
|
+
/* @__PURE__ */ e("rect", { x: "2", y: "2", width: "28", height: "28", fill: d }),
|
|
300
|
+
/* @__PURE__ */ e("rect", { id: "rra-clothing", x: "8", y: "26", width: "16", height: "4", fill: s }),
|
|
301
|
+
/* @__PURE__ */ e("rect", { x: "10", y: "25", width: "12", height: "1", fill: s }),
|
|
302
302
|
/* @__PURE__ */ e("rect", { x: "14", y: "23", width: "4", height: "3", fill: a }),
|
|
303
303
|
/* @__PURE__ */ e("rect", { id: "rra-head", x: "9", y: "7", width: "14", height: "16", fill: a }),
|
|
304
304
|
/* @__PURE__ */ o("g", { id: "rra-hair", children: [
|
|
305
|
-
/* @__PURE__ */ e("rect", { x: "8", y: "4", width: "16", height: "4", fill:
|
|
306
|
-
/* @__PURE__ */ e("rect", { x: "8", y: "8", width: "2", height: "5", fill:
|
|
307
|
-
/* @__PURE__ */ e("rect", { x: "22", y: "8", width: "2", height: "5", fill:
|
|
308
|
-
/* @__PURE__ */ e("rect", { x: "11", y: "8", width: "3", height: "1", fill:
|
|
309
|
-
/* @__PURE__ */ e("rect", { x: "17", y: "8", width: "4", height: "1", fill:
|
|
305
|
+
/* @__PURE__ */ e("rect", { x: "8", y: "4", width: "16", height: "4", fill: i }),
|
|
306
|
+
/* @__PURE__ */ e("rect", { x: "8", y: "8", width: "2", height: "5", fill: i }),
|
|
307
|
+
/* @__PURE__ */ e("rect", { x: "22", y: "8", width: "2", height: "5", fill: i }),
|
|
308
|
+
/* @__PURE__ */ e("rect", { x: "11", y: "8", width: "3", height: "1", fill: i }),
|
|
309
|
+
/* @__PURE__ */ e("rect", { x: "17", y: "8", width: "4", height: "1", fill: i })
|
|
310
310
|
] }),
|
|
311
311
|
/* @__PURE__ */ o("g", { id: "rra-eyeL", children: [
|
|
312
312
|
/* @__PURE__ */ e("rect", { x: "11", y: "12", width: "3", height: "2", fill: "#ffffff" }),
|
|
@@ -329,32 +329,32 @@ function Se({
|
|
|
329
329
|
}
|
|
330
330
|
);
|
|
331
331
|
}
|
|
332
|
-
function
|
|
333
|
-
size:
|
|
332
|
+
function $e({
|
|
333
|
+
size: t = 300,
|
|
334
334
|
customization: r,
|
|
335
335
|
inkColor: l = "#2f2a26",
|
|
336
336
|
className: c,
|
|
337
337
|
style: a
|
|
338
338
|
}) {
|
|
339
339
|
const {
|
|
340
|
-
skinColor:
|
|
340
|
+
skinColor: i = "#fdf6ec",
|
|
341
341
|
// paper tone by default
|
|
342
|
-
hairColor:
|
|
343
|
-
bgColor:
|
|
342
|
+
hairColor: s = "#2f2a26",
|
|
343
|
+
bgColor: d = "#fffdf8"
|
|
344
344
|
} = r ?? {};
|
|
345
345
|
return /* @__PURE__ */ o(
|
|
346
346
|
"svg",
|
|
347
347
|
{
|
|
348
348
|
viewBox: "0 0 200 200",
|
|
349
|
-
width:
|
|
350
|
-
height:
|
|
349
|
+
width: t,
|
|
350
|
+
height: t,
|
|
351
351
|
xmlns: "http://www.w3.org/2000/svg",
|
|
352
352
|
role: "img",
|
|
353
353
|
"aria-label": "Avatar",
|
|
354
354
|
className: c,
|
|
355
355
|
style: a,
|
|
356
356
|
children: [
|
|
357
|
-
/* @__PURE__ */ e("circle", { cx: "100", cy: "100", r: "79", fill:
|
|
357
|
+
/* @__PURE__ */ e("circle", { cx: "100", cy: "100", r: "79", fill: d }),
|
|
358
358
|
/* @__PURE__ */ e("clipPath", { id: "rra-doodle-clip", children: /* @__PURE__ */ e("circle", { cx: "100", cy: "100", r: "79" }) }),
|
|
359
359
|
/* @__PURE__ */ o("g", { clipPath: "url(#rra-doodle-clip)", children: [
|
|
360
360
|
/* @__PURE__ */ e("path", { d: "M52 182 Q60 148 100 146 Q140 148 148 182", fill: "#ffffff", stroke: l, strokeWidth: "3", strokeLinecap: "round" }),
|
|
@@ -369,13 +369,13 @@ function Qe({
|
|
|
369
369
|
Q101 143 79 133
|
|
370
370
|
Q56 121 58 88
|
|
371
371
|
Q62 45 100 46 Z`,
|
|
372
|
-
fill:
|
|
372
|
+
fill: i,
|
|
373
373
|
stroke: l,
|
|
374
374
|
strokeWidth: "3.5",
|
|
375
375
|
strokeLinecap: "round"
|
|
376
376
|
}
|
|
377
377
|
),
|
|
378
|
-
/* @__PURE__ */ o("g", { id: "rra-hair", fill: "none", stroke:
|
|
378
|
+
/* @__PURE__ */ o("g", { id: "rra-hair", fill: "none", stroke: s, strokeWidth: "3", strokeLinecap: "round", children: [
|
|
379
379
|
/* @__PURE__ */ e("path", { d: "M62 84 Q58 52 88 47 Q72 56 74 64 Q80 50 104 46 Q92 54 96 60 Q106 48 126 52 Q116 58 120 64 Q130 56 140 78 Q132 66 122 68" }),
|
|
380
380
|
/* @__PURE__ */ e("path", { d: "M66 76 Q70 62 82 58", opacity: "0.7" }),
|
|
381
381
|
/* @__PURE__ */ e("path", { d: "M118 56 Q130 62 134 76", opacity: "0.7" })
|
|
@@ -385,12 +385,12 @@ function Qe({
|
|
|
385
385
|
/* @__PURE__ */ o("g", { id: "rra-eyeL", children: [
|
|
386
386
|
/* @__PURE__ */ e("ellipse", { cx: "82", cy: "92", rx: "9", ry: "7.5", fill: "#ffffff", stroke: l, strokeWidth: "2.5" }),
|
|
387
387
|
/* @__PURE__ */ e("circle", { className: "rra-pupil", "data-base-x": "82", "data-base-y": "92", cx: "82", cy: "92", r: "3.4", fill: l }),
|
|
388
|
-
/* @__PURE__ */ e("rect", { className: "rra-lid", "data-max-height": "17", x: "72", y: "83", width: "20", height: "0", fill:
|
|
388
|
+
/* @__PURE__ */ e("rect", { className: "rra-lid", "data-max-height": "17", x: "72", y: "83", width: "20", height: "0", fill: i })
|
|
389
389
|
] }),
|
|
390
390
|
/* @__PURE__ */ o("g", { id: "rra-eyeR", children: [
|
|
391
391
|
/* @__PURE__ */ e("ellipse", { cx: "118", cy: "92", rx: "9", ry: "7.5", fill: "#ffffff", stroke: l, strokeWidth: "2.5" }),
|
|
392
392
|
/* @__PURE__ */ e("circle", { className: "rra-pupil", "data-base-x": "118", "data-base-y": "92", cx: "118", cy: "92", r: "3.4", fill: l }),
|
|
393
|
-
/* @__PURE__ */ e("rect", { className: "rra-lid", "data-max-height": "17", x: "108", y: "83", width: "20", height: "0", fill:
|
|
393
|
+
/* @__PURE__ */ e("rect", { className: "rra-lid", "data-max-height": "17", x: "108", y: "83", width: "20", height: "0", fill: i })
|
|
394
394
|
] }),
|
|
395
395
|
/* @__PURE__ */ e("path", { d: "M99 100 Q96 110 103 112", fill: "none", stroke: l, strokeWidth: "2.5", strokeLinecap: "round" }),
|
|
396
396
|
/* @__PURE__ */ e("ellipse", { id: "rra-mouth", cx: "100", cy: "122", rx: "9", ry: "2.5", fill: "#3a2e28", stroke: l, strokeWidth: "2" }),
|
|
@@ -405,10 +405,10 @@ function Qe({
|
|
|
405
405
|
}
|
|
406
406
|
);
|
|
407
407
|
}
|
|
408
|
-
function fe(
|
|
409
|
-
return
|
|
408
|
+
function fe(t) {
|
|
409
|
+
return t.replace(/-([a-z])/g, (r, l) => l.toUpperCase());
|
|
410
410
|
}
|
|
411
|
-
const
|
|
411
|
+
const Re = [
|
|
412
412
|
["pixel-art", "Pixel Art"],
|
|
413
413
|
["pixel-art-neutral", "Pixel Art Neutral"],
|
|
414
414
|
["lorelei", "Lorelei"],
|
|
@@ -417,24 +417,24 @@ const We = [
|
|
|
417
417
|
["notionists-neutral", "Notionists Neutral"],
|
|
418
418
|
["open-peeps", "Open Peeps"],
|
|
419
419
|
["thumbs", "Thumbs"]
|
|
420
|
-
].map(([
|
|
421
|
-
id:
|
|
422
|
-
exportName: fe(
|
|
420
|
+
].map(([t, r]) => ({
|
|
421
|
+
id: t,
|
|
422
|
+
exportName: fe(t),
|
|
423
423
|
label: r,
|
|
424
424
|
license: "CC0 1.0"
|
|
425
425
|
}));
|
|
426
|
-
function
|
|
426
|
+
function xe(t, r) {
|
|
427
427
|
const l = /* @__PURE__ */ new Set(), c = /\bid="([^"]+)"/g;
|
|
428
428
|
let a;
|
|
429
|
-
for (; a = c.exec(
|
|
430
|
-
let
|
|
431
|
-
for (const
|
|
432
|
-
const
|
|
433
|
-
|
|
429
|
+
for (; a = c.exec(t); ) l.add(a[1]);
|
|
430
|
+
let i = t;
|
|
431
|
+
for (const s of l) {
|
|
432
|
+
const d = s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
433
|
+
i = i.replace(new RegExp(`id="${d}"`, "g"), `id="${r}-${s}"`).replace(new RegExp(`url\\(#${d}\\)`, "g"), `url(#${r}-${s})`).replace(new RegExp(`(xlink:href|href)="#${d}"`, "g"), `$1="#${r}-${s}"`);
|
|
434
434
|
}
|
|
435
|
-
return
|
|
435
|
+
return i;
|
|
436
436
|
}
|
|
437
|
-
const
|
|
437
|
+
const Ee = {
|
|
438
438
|
"pixel-art": { part: "mouth", visemes: ["happy01", "happy11", "happy12"] },
|
|
439
439
|
"pixel-art-neutral": { part: "mouth", visemes: ["happy01", "happy11", "happy12"] },
|
|
440
440
|
lorelei: { part: "mouth", visemes: ["happy01", "happy08", "happy06"] },
|
|
@@ -468,190 +468,190 @@ const $e = {
|
|
|
468
468
|
{ collection: "pixel-art", seed: "smmje3r6" },
|
|
469
469
|
{ collection: "pixel-art", seed: "wxhz14w1" },
|
|
470
470
|
{ collection: "pixel-art", seed: "uovelmrj" }
|
|
471
|
-
],
|
|
472
|
-
let
|
|
473
|
-
function
|
|
474
|
-
return
|
|
471
|
+
], Te = ye[0].collection, Be = ye[0].seed, Ye = Object.fromEntries(Re.map((t) => [t.id, t]));
|
|
472
|
+
let se = null;
|
|
473
|
+
function be() {
|
|
474
|
+
return se || (se = Promise.all([
|
|
475
475
|
import("@dicebear/core"),
|
|
476
476
|
import("@dicebear/collection")
|
|
477
|
-
]).then(([
|
|
478
|
-
createAvatar:
|
|
477
|
+
]).then(([t, r]) => ({
|
|
478
|
+
createAvatar: t.createAvatar,
|
|
479
479
|
collection: r
|
|
480
|
-
}))),
|
|
480
|
+
}))), se;
|
|
481
481
|
}
|
|
482
|
-
async function
|
|
483
|
-
const { createAvatar: c, collection: a } = await
|
|
484
|
-
if (!
|
|
485
|
-
return c(
|
|
482
|
+
async function Fe(t, r, l = {}) {
|
|
483
|
+
const { createAvatar: c, collection: a } = await be(), i = a[fe(String(t))];
|
|
484
|
+
if (!i) throw new Error(`Unknown DiceBear style "${t}"`);
|
|
485
|
+
return c(i, { seed: r, ...l }).toString();
|
|
486
486
|
}
|
|
487
|
-
function
|
|
488
|
-
const
|
|
489
|
-
key:
|
|
490
|
-
html:
|
|
487
|
+
function Ce(t, r, l, c, a) {
|
|
488
|
+
const i = [], s = (d, f) => i.push({
|
|
489
|
+
key: d,
|
|
490
|
+
html: xe(t(r, { ...l, ...f }).toString(), `${a}-${d}`)
|
|
491
491
|
});
|
|
492
492
|
if (c.part === "face")
|
|
493
|
-
c.visemes.forEach((
|
|
493
|
+
c.visemes.forEach((d, f) => s(`m${f}`, { face: [d] })), c.faceBlink && s("blink", { face: [c.faceBlink] });
|
|
494
494
|
else {
|
|
495
|
-
const
|
|
495
|
+
const d = c.blink ? [
|
|
496
496
|
["o", { eyes: [c.blink.open] }],
|
|
497
497
|
["c", { eyes: [c.blink.closed] }]
|
|
498
498
|
] : [["o", {}]];
|
|
499
|
-
c.visemes.forEach((
|
|
500
|
-
for (const [
|
|
499
|
+
c.visemes.forEach((f, u) => {
|
|
500
|
+
for (const [p, n] of d) s(`m${u}-${p}`, { [c.part]: [f], ...n });
|
|
501
501
|
});
|
|
502
502
|
}
|
|
503
|
-
return
|
|
503
|
+
return i;
|
|
504
504
|
}
|
|
505
|
-
function
|
|
506
|
-
state:
|
|
505
|
+
function _e({
|
|
506
|
+
state: t,
|
|
507
507
|
analyser: r,
|
|
508
508
|
size: l = 300,
|
|
509
|
-
collection: c =
|
|
510
|
-
seed: a =
|
|
511
|
-
backgroundColor:
|
|
512
|
-
radius:
|
|
513
|
-
className:
|
|
514
|
-
style:
|
|
515
|
-
maxMouthOpening:
|
|
516
|
-
stateColors:
|
|
509
|
+
collection: c = Te,
|
|
510
|
+
seed: a = Be,
|
|
511
|
+
backgroundColor: i,
|
|
512
|
+
radius: s,
|
|
513
|
+
className: d = "",
|
|
514
|
+
style: f,
|
|
515
|
+
maxMouthOpening: u = 30,
|
|
516
|
+
stateColors: p
|
|
517
517
|
}) {
|
|
518
|
-
const n =
|
|
519
|
-
L.current = { state:
|
|
520
|
-
const J = (
|
|
521
|
-
|
|
522
|
-
let
|
|
523
|
-
return
|
|
524
|
-
if (
|
|
525
|
-
const
|
|
526
|
-
if (
|
|
518
|
+
const n = oe(), F = `rra-db-${me().replace(/[^a-zA-Z0-9]/g, "")}`, _ = Z(null), U = Z(/* @__PURE__ */ new Map()), M = Z(null), [x, I] = ce(null), [h, v] = ce(null), [N, y] = ce(null), L = Z({ state: t, analyser: r, maxMouthOpening: u });
|
|
519
|
+
L.current = { state: t, analyser: r, maxMouthOpening: u };
|
|
520
|
+
const J = (i == null ? void 0 : i.join(",")) ?? "";
|
|
521
|
+
X(() => {
|
|
522
|
+
let Q = !1;
|
|
523
|
+
return I(null), y(null), be().then(({ createAvatar: R, collection: g }) => {
|
|
524
|
+
if (Q) return;
|
|
525
|
+
const b = g[fe(String(c))];
|
|
526
|
+
if (!b) {
|
|
527
527
|
y(`Unknown DiceBear style "${c}"`);
|
|
528
528
|
return;
|
|
529
529
|
}
|
|
530
|
-
const
|
|
531
|
-
|
|
532
|
-
const
|
|
533
|
-
|
|
534
|
-
}).catch((
|
|
535
|
-
if (
|
|
536
|
-
const
|
|
537
|
-
y(/Cannot find module|Failed to (resolve|fetch)|dicebear/i.test(
|
|
530
|
+
const q = { seed: a };
|
|
531
|
+
i && i.length && (q.backgroundColor = i), s != null && (q.radius = s);
|
|
532
|
+
const k = Ee[String(c)] ?? null;
|
|
533
|
+
U.current = /* @__PURE__ */ new Map(), k ? (v(k), I(Ce(R, b, q, k, F))) : (v(null), I([{ key: "base", html: xe(R(b, q).toString(), `${F}-base`) }]));
|
|
534
|
+
}).catch((R) => {
|
|
535
|
+
if (Q) return;
|
|
536
|
+
const g = (R == null ? void 0 : R.message) || String(R);
|
|
537
|
+
y(/Cannot find module|Failed to (resolve|fetch)|dicebear/i.test(g) ? "missing" : g);
|
|
538
538
|
}), () => {
|
|
539
|
-
|
|
539
|
+
Q = !0;
|
|
540
540
|
};
|
|
541
|
-
}, [c, a,
|
|
542
|
-
const
|
|
543
|
-
if (!
|
|
544
|
-
const
|
|
545
|
-
let
|
|
546
|
-
const
|
|
547
|
-
if (
|
|
548
|
-
const
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
}),
|
|
552
|
-
},
|
|
553
|
-
const
|
|
554
|
-
|
|
555
|
-
const { state:
|
|
556
|
-
if (
|
|
557
|
-
let
|
|
558
|
-
if (
|
|
559
|
-
|
|
541
|
+
}, [c, a, s, J]), X(() => {
|
|
542
|
+
const Q = _.current;
|
|
543
|
+
if (!Q || !x || x.length === 0 || typeof window > "u") return;
|
|
544
|
+
const R = U.current, g = !!(h && (h.blink || h.faceBlink));
|
|
545
|
+
let b = null, q = null, k = 0, z = 0, ee = 1500 + Math.random() * 2500, Y = 0, P = !1, j = 0, E = "", $ = performance.now();
|
|
546
|
+
const C = (O) => {
|
|
547
|
+
if (O === E) return;
|
|
548
|
+
const H = R.get(O) ?? R.get(x[0].key);
|
|
549
|
+
R.forEach((G) => {
|
|
550
|
+
G.style.visibility = G === H ? "visible" : "hidden";
|
|
551
|
+
}), E = O;
|
|
552
|
+
}, w = (O) => {
|
|
553
|
+
const H = Math.min(100, O - $);
|
|
554
|
+
$ = O;
|
|
555
|
+
const { state: G, analyser: ie, maxMouthOpening: V } = L.current, le = G === "speaking", S = V / 30;
|
|
556
|
+
if (le ? ((!b || q !== ie) && (b = de(ie), q = ie), k += (b.read().level - k) * 0.3) : (b = null, q = null, k += (0 - k) * 0.25), g && !n && (P ? (Y += H, Y >= 160 && (P = !1, ee = 1800 + Math.random() * 3500)) : (ee -= H, ee <= 0 && (P = !0, Y = 0))), h) {
|
|
557
|
+
let m = j;
|
|
558
|
+
if (j === 0 ? k > 0.07 && (m = k > 0.22 ? 2 : 1) : j === 1 ? k > 0.22 ? m = 2 : k < 0.05 && (m = 0) : k < 0.06 ? m = 0 : k < 0.18 && (m = 1), j = le ? m : 0, h.part === "face")
|
|
559
|
+
C(P && h.faceBlink ? "blink" : `m${j}`);
|
|
560
560
|
else {
|
|
561
|
-
const
|
|
562
|
-
|
|
561
|
+
const Me = P && h.blink ? "c" : "o";
|
|
562
|
+
C(`m${j}-${Me}`);
|
|
563
563
|
}
|
|
564
|
-
let
|
|
565
|
-
n || (
|
|
566
|
-
const
|
|
567
|
-
|
|
564
|
+
let W = 0, A = 0;
|
|
565
|
+
n || (z += H * 2e-3, W = Math.sin(z) * 8e-3, G === "listening" && (A = Math.sin(z * 1.6) * 1.2));
|
|
566
|
+
const T = k * 4 * S, K = 1 + k * 0.04 * S + W, re = 1 - k * 0.02 * S + W;
|
|
567
|
+
Q.style.transform = `translateY(${(-T + A).toFixed(2)}px) scale(${re.toFixed(4)}, ${K.toFixed(4)})`;
|
|
568
568
|
} else {
|
|
569
|
-
let
|
|
570
|
-
n || (
|
|
571
|
-
const
|
|
572
|
-
|
|
569
|
+
let m = 0;
|
|
570
|
+
n || (z += H * 2e-3, m = Math.sin(z) * 0.012);
|
|
571
|
+
const W = k * 10 * S, A = 1 + k * 0.1 * S + m, T = 1 - k * 0.05 * S + m, K = G === "thinking" && !n ? -4 : 0;
|
|
572
|
+
Q.style.transform = `translateY(${(-W).toFixed(2)}px) scale(${T.toFixed(4)}, ${A.toFixed(4)}) rotate(${K}deg)`;
|
|
573
573
|
}
|
|
574
|
-
|
|
574
|
+
M.current = requestAnimationFrame(w);
|
|
575
575
|
};
|
|
576
|
-
return
|
|
577
|
-
|
|
576
|
+
return Q.style.transformOrigin = "center bottom", M.current = requestAnimationFrame(w), () => {
|
|
577
|
+
M.current && cancelAnimationFrame(M.current);
|
|
578
578
|
};
|
|
579
|
-
}, [
|
|
580
|
-
const
|
|
579
|
+
}, [x, h, n]);
|
|
580
|
+
const te = (p == null ? void 0 : p[t]) ?? "#10b981";
|
|
581
581
|
return /* @__PURE__ */ o(
|
|
582
582
|
"div",
|
|
583
583
|
{
|
|
584
|
-
className: `relative flex items-center justify-center ${
|
|
585
|
-
style: { width: l, height: l, ...
|
|
584
|
+
className: `relative flex items-center justify-center ${d}`,
|
|
585
|
+
style: { width: l, height: l, ...f },
|
|
586
586
|
children: [
|
|
587
|
-
|
|
587
|
+
x && /* @__PURE__ */ e("div", { ref: _, className: "relative w-full h-full", role: "img", "aria-label": "Avatar", children: x.map((Q, R) => /* @__PURE__ */ e(
|
|
588
588
|
"div",
|
|
589
589
|
{
|
|
590
|
-
ref: (
|
|
591
|
-
|
|
590
|
+
ref: (g) => {
|
|
591
|
+
g ? U.current.set(Q.key, g) : U.current.delete(Q.key);
|
|
592
592
|
},
|
|
593
|
-
dangerouslySetInnerHTML: { __html:
|
|
593
|
+
dangerouslySetInnerHTML: { __html: Q.html },
|
|
594
594
|
className: "absolute inset-0 [&>svg]:w-full [&>svg]:h-full",
|
|
595
|
-
style: { visibility:
|
|
595
|
+
style: { visibility: R === 0 ? "visible" : "hidden" }
|
|
596
596
|
},
|
|
597
|
-
|
|
597
|
+
Q.key
|
|
598
598
|
)) }),
|
|
599
|
-
!
|
|
599
|
+
!x && !N && /* @__PURE__ */ o("div", { className: "absolute inset-0 flex flex-col items-center justify-center", children: [
|
|
600
600
|
/* @__PURE__ */ e(
|
|
601
601
|
"div",
|
|
602
602
|
{
|
|
603
603
|
className: "w-8 h-8 border-4 rounded-full animate-spin mb-2",
|
|
604
|
-
style: { borderColor: `${
|
|
604
|
+
style: { borderColor: `${te}33`, borderTopColor: te }
|
|
605
605
|
}
|
|
606
606
|
),
|
|
607
607
|
/* @__PURE__ */ e("span", { className: "text-[10px] font-mono font-bold tracking-widest text-zinc-400 animate-pulse", children: "GENERATING AVATAR…" })
|
|
608
608
|
] }),
|
|
609
|
-
|
|
609
|
+
N === "missing" && /* @__PURE__ */ o("div", { className: "absolute inset-0 flex flex-col items-center justify-center bg-zinc-950/90 backdrop-blur-md rounded-2xl p-4 text-center", children: [
|
|
610
610
|
/* @__PURE__ */ e("span", { className: "text-xs font-mono font-bold text-amber-400 uppercase tracking-wider mb-2", children: "DiceBear not installed" }),
|
|
611
611
|
/* @__PURE__ */ e("p", { className: "text-[10px] text-zinc-500 max-w-[220px] leading-relaxed mb-2", children: "Install the optional peer dependencies to use this variant:" }),
|
|
612
612
|
/* @__PURE__ */ e("code", { className: "text-[10px] text-zinc-300 bg-zinc-900 px-2 py-1 rounded border border-zinc-800 break-all", children: "npm i @dicebear/core @dicebear/collection" })
|
|
613
613
|
] }),
|
|
614
|
-
|
|
614
|
+
N && N !== "missing" && /* @__PURE__ */ o("div", { className: "absolute inset-0 flex flex-col items-center justify-center bg-zinc-950/90 backdrop-blur-md rounded-2xl p-4 text-center", children: [
|
|
615
615
|
/* @__PURE__ */ e("span", { className: "text-xs font-mono font-bold text-red-400 uppercase tracking-wider mb-2", children: "Failed to generate" }),
|
|
616
|
-
/* @__PURE__ */ e("p", { className: "text-[10px] text-zinc-500 max-w-[220px] leading-relaxed break-all", children:
|
|
616
|
+
/* @__PURE__ */ e("p", { className: "text-[10px] text-zinc-500 max-w-[220px] leading-relaxed break-all", children: N })
|
|
617
617
|
] })
|
|
618
618
|
]
|
|
619
619
|
}
|
|
620
620
|
);
|
|
621
621
|
}
|
|
622
|
-
function
|
|
623
|
-
if (!
|
|
624
|
-
let r =
|
|
622
|
+
function ke(t) {
|
|
623
|
+
if (!t) return "";
|
|
624
|
+
let r = t;
|
|
625
625
|
r = r.replace(/```[^\n]*\n?([\s\S]*?)```/g, "$1"), r = r.replace(/```[^\n]*\n?/g, ""), r = r.split(`
|
|
626
626
|
`).filter((l) => {
|
|
627
627
|
const c = l.trim();
|
|
628
628
|
if (!c) return !0;
|
|
629
|
-
const a = /^\|.*\|?\s*$/.test(c) && c.includes("|"),
|
|
630
|
-
return !(a ||
|
|
629
|
+
const a = /^\|.*\|?\s*$/.test(c) && c.includes("|"), i = /^\|?[\s:|-]+\|[\s:|-]*$/.test(c) && c.includes("-");
|
|
630
|
+
return !(a || i);
|
|
631
631
|
}).join(`
|
|
632
632
|
`), r = r.replace(/!\[([^\]]*)\]\([^)]*\)/g, "$1"), r = r.replace(/\[([^\]]+)\]\([^)]*\)/g, "$1"), r = r.replace(/`([^`]+)`/g, "$1"), r = r.replace(/^\s{0,3}#{1,6}\s+/gm, ""), r = r.replace(/^\s{0,3}>\s?/gm, ""), r = r.replace(/^\s{0,3}[-*+]\s+/gm, ""), r = r.replace(/^\s{0,3}\d+\.\s+/gm, "");
|
|
633
633
|
for (let l = 0; l < 2; l++)
|
|
634
634
|
r = r.replace(/\*\*([^*]+)\*\*/g, "$1").replace(/\*([^*]+)\*/g, "$1").replace(/__([^_]+)__/g, "$1").replace(/_([^_]+)_/g, "$1").replace(/~~([^~]+)~~/g, "$1");
|
|
635
635
|
return r = r.replace(/[*_~]{1,3}(?=\s|$)/g, "").replace(/(^|\s)[*_~]{1,3}/g, "$1"), r = r.replace(/^\s{0,3}([-*_])\1{2,}\s*$/gm, ""), r = r.replace(/\s*\n\s*/g, " ").replace(/[ \t]{2,}/g, " "), r.trim();
|
|
636
636
|
}
|
|
637
|
-
function we(
|
|
638
|
-
const l = r.maxChars ?? 160, c =
|
|
637
|
+
function we(t, r = {}) {
|
|
638
|
+
const l = r.maxChars ?? 160, c = t.trim();
|
|
639
639
|
if (c.length <= l) return c;
|
|
640
|
-
const a = c.slice(c.length - l),
|
|
641
|
-
if (
|
|
642
|
-
return "…" + a.slice(
|
|
643
|
-
const
|
|
644
|
-
return "…" + a.slice(
|
|
640
|
+
const a = c.slice(c.length - l), i = a.search(new RegExp("(?<=[.!?…])\\s+"));
|
|
641
|
+
if (i !== -1 && i < l * 0.6)
|
|
642
|
+
return "…" + a.slice(i).trimStart();
|
|
643
|
+
const s = a.indexOf(" "), d = s === -1 ? 0 : s + 1;
|
|
644
|
+
return "…" + a.slice(d);
|
|
645
645
|
}
|
|
646
|
-
function
|
|
647
|
-
const a = we(
|
|
646
|
+
function Ie({ text: t, maxChars: r = 160, className: l = "", style: c }) {
|
|
647
|
+
const a = we(ke(t ?? ""), { maxChars: r });
|
|
648
648
|
return a ? /* @__PURE__ */ e(
|
|
649
649
|
"div",
|
|
650
650
|
{
|
|
651
651
|
className: `rra-caption w-full flex justify-center pointer-events-none ${l}`,
|
|
652
652
|
style: c,
|
|
653
653
|
children: /* @__PURE__ */ e(
|
|
654
|
-
|
|
654
|
+
ne.span,
|
|
655
655
|
{
|
|
656
656
|
initial: { opacity: 0, y: 4 },
|
|
657
657
|
animate: { opacity: 1, y: 0 },
|
|
@@ -672,15 +672,15 @@ function Ce({ text: i, maxChars: r = 160, className: l = "", style: c }) {
|
|
|
672
672
|
) : null;
|
|
673
673
|
}
|
|
674
674
|
function qe({
|
|
675
|
-
text:
|
|
675
|
+
text: t,
|
|
676
676
|
maxChars: r = 220,
|
|
677
677
|
label: l = "Thought process",
|
|
678
678
|
className: c = "",
|
|
679
679
|
style: a
|
|
680
680
|
}) {
|
|
681
|
-
const
|
|
682
|
-
return
|
|
683
|
-
|
|
681
|
+
const i = we(ke(t ?? ""), { maxChars: r });
|
|
682
|
+
return i ? /* @__PURE__ */ e(
|
|
683
|
+
ne.div,
|
|
684
684
|
{
|
|
685
685
|
initial: { opacity: 0, y: 8, scale: 0.98 },
|
|
686
686
|
animate: { opacity: 1, y: 0, scale: 1 },
|
|
@@ -692,228 +692,335 @@ function qe({
|
|
|
692
692
|
/* @__PURE__ */ e("span", { className: "w-1.5 h-1.5 rounded-full bg-purple-400 animate-pulse" }),
|
|
693
693
|
l
|
|
694
694
|
] }),
|
|
695
|
-
/* @__PURE__ */ e("p", { className: "leading-relaxed text-zinc-200", children:
|
|
695
|
+
/* @__PURE__ */ e("p", { className: "leading-relaxed text-zinc-200", children: i })
|
|
696
696
|
] })
|
|
697
697
|
}
|
|
698
698
|
) : null;
|
|
699
699
|
}
|
|
700
|
-
|
|
701
|
-
|
|
700
|
+
const ve = [
|
|
701
|
+
"🤔",
|
|
702
|
+
"💭",
|
|
703
|
+
"📚",
|
|
704
|
+
"🔍",
|
|
705
|
+
"🌐",
|
|
706
|
+
"💡",
|
|
707
|
+
"🧠",
|
|
708
|
+
"📝",
|
|
709
|
+
"⚙️"
|
|
710
|
+
];
|
|
711
|
+
function ze({
|
|
712
|
+
emojis: t = ve,
|
|
713
|
+
interval: r = 900,
|
|
714
|
+
size: l = 64,
|
|
715
|
+
className: c = "",
|
|
716
|
+
style: a
|
|
717
|
+
}) {
|
|
718
|
+
const i = oe(), [s, d] = ce(0);
|
|
719
|
+
if (X(() => {
|
|
720
|
+
if (i || t.length <= 1) return;
|
|
721
|
+
const u = setInterval(() => {
|
|
722
|
+
d((p) => (p + 1) % t.length);
|
|
723
|
+
}, Math.max(200, r));
|
|
724
|
+
return () => clearInterval(u);
|
|
725
|
+
}, [i, t.length, r]), t.length === 0) return null;
|
|
726
|
+
const f = t[s % t.length];
|
|
727
|
+
return /* @__PURE__ */ e(
|
|
728
|
+
ne.div,
|
|
729
|
+
{
|
|
730
|
+
initial: { opacity: 0, y: 8, scale: 0.9 },
|
|
731
|
+
animate: { opacity: 1, y: 0, scale: 1 },
|
|
732
|
+
transition: { duration: 0.3 },
|
|
733
|
+
className: `rra-thought-emoji flex justify-center pointer-events-none ${c}`,
|
|
734
|
+
style: a,
|
|
735
|
+
role: "status",
|
|
736
|
+
"aria-live": "off",
|
|
737
|
+
"aria-label": "Thinking",
|
|
738
|
+
children: /* @__PURE__ */ e(
|
|
739
|
+
"div",
|
|
740
|
+
{
|
|
741
|
+
className: "relative flex items-center justify-center rounded-full bg-zinc-900/90 backdrop-blur-xl border border-purple-500/25 shadow-[0_10px_30px_rgba(139,92,246,0.25)]",
|
|
742
|
+
style: { width: l, height: l },
|
|
743
|
+
children: /* @__PURE__ */ e(Ne, { mode: "wait", initial: !1, children: /* @__PURE__ */ e(
|
|
744
|
+
ne.span,
|
|
745
|
+
{
|
|
746
|
+
initial: i ? !1 : { opacity: 0, scale: 0.6, rotate: -15 },
|
|
747
|
+
animate: { opacity: 1, scale: 1, rotate: 0 },
|
|
748
|
+
exit: i ? void 0 : { opacity: 0, scale: 0.6, rotate: 15 },
|
|
749
|
+
transition: { duration: 0.18 },
|
|
750
|
+
className: "absolute leading-none select-none",
|
|
751
|
+
style: { fontSize: Math.round(l * 0.5) },
|
|
752
|
+
children: f
|
|
753
|
+
},
|
|
754
|
+
s
|
|
755
|
+
) })
|
|
756
|
+
}
|
|
757
|
+
)
|
|
758
|
+
}
|
|
759
|
+
);
|
|
760
|
+
}
|
|
761
|
+
function Pe(t, r) {
|
|
762
|
+
return r === t ? { type: "none" } : r.length > t.length && r.startsWith(t) ? { type: "push", text: r.slice(t.length) } : { type: "reset", seed: r };
|
|
702
763
|
}
|
|
703
|
-
function
|
|
704
|
-
const r =
|
|
705
|
-
r.current === null && (r.current =
|
|
706
|
-
const l =
|
|
707
|
-
return
|
|
708
|
-
if (
|
|
709
|
-
const c = r.current, a =
|
|
710
|
-
a.type === "push" ? c.push(a.text) : a.type === "reset" && (c.reset(), a.seed && c.push(a.seed)), l.current =
|
|
711
|
-
}, [
|
|
764
|
+
function De(t) {
|
|
765
|
+
const r = Z(null);
|
|
766
|
+
r.current === null && (r.current = Ae());
|
|
767
|
+
const l = Z("");
|
|
768
|
+
return X(() => {
|
|
769
|
+
if (t === void 0) return;
|
|
770
|
+
const c = r.current, a = Pe(l.current, t);
|
|
771
|
+
a.type === "push" ? c.push(a.text) : a.type === "reset" && (c.reset(), a.seed && c.push(a.seed)), l.current = t;
|
|
772
|
+
}, [t]), t === void 0 ? null : r.current;
|
|
712
773
|
}
|
|
713
|
-
function
|
|
714
|
-
if (!
|
|
715
|
-
const l =
|
|
716
|
-
let c = 0, a = 0,
|
|
717
|
-
return l.length === 3 ? (c = parseInt(l[0] + l[0], 16), a = parseInt(l[1] + l[1], 16),
|
|
774
|
+
function D(t, r) {
|
|
775
|
+
if (!t || !t.startsWith("#")) return t || "transparent";
|
|
776
|
+
const l = t.replace("#", "");
|
|
777
|
+
let c = 0, a = 0, i = 0;
|
|
778
|
+
return l.length === 3 ? (c = parseInt(l[0] + l[0], 16), a = parseInt(l[1] + l[1], 16), i = parseInt(l[2] + l[2], 16)) : l.length === 6 && (c = parseInt(l.substring(0, 2), 16), a = parseInt(l.substring(2, 4), 16), i = parseInt(l.substring(4, 6), 16)), `rgba(${c}, ${a}, ${i}, ${r})`;
|
|
718
779
|
}
|
|
719
|
-
const
|
|
720
|
-
() => import("./VrmAvatar-Dw0gf27E.js").then((
|
|
721
|
-
),
|
|
722
|
-
() => import("./GlbArkitAvatar-CjfIOQ2P.js").then((
|
|
780
|
+
const Ze = ae.lazy(
|
|
781
|
+
() => import("./VrmAvatar-Dw0gf27E.js").then((t) => ({ default: t.VrmAvatar }))
|
|
782
|
+
), je = ae.lazy(
|
|
783
|
+
() => import("./GlbArkitAvatar-CjfIOQ2P.js").then((t) => ({ default: t.GlbArkitAvatar }))
|
|
723
784
|
);
|
|
724
|
-
function
|
|
725
|
-
state:
|
|
785
|
+
function He({
|
|
786
|
+
state: t,
|
|
726
787
|
analyser: r = null,
|
|
727
788
|
speechActivity: l,
|
|
728
789
|
streamingText: c,
|
|
729
790
|
size: a = 280,
|
|
730
|
-
variant:
|
|
731
|
-
children:
|
|
732
|
-
vrmUrl:
|
|
733
|
-
glbUrl:
|
|
734
|
-
subtitle:
|
|
735
|
-
thought:
|
|
791
|
+
variant: i = "geometric",
|
|
792
|
+
children: s,
|
|
793
|
+
vrmUrl: d,
|
|
794
|
+
glbUrl: f,
|
|
795
|
+
subtitle: u,
|
|
796
|
+
thought: p,
|
|
736
797
|
tool: n,
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
798
|
+
thinkingEmojis: B,
|
|
799
|
+
thinkingEmojiInterval: F = 900,
|
|
800
|
+
thinkingEmojiSize: _,
|
|
801
|
+
showGlow: U = !0,
|
|
802
|
+
showStatePill: M = !0,
|
|
803
|
+
showThought: x = !0,
|
|
804
|
+
showSubtitle: I = !0,
|
|
805
|
+
className: h = "",
|
|
806
|
+
style: v,
|
|
807
|
+
dicebearCollection: N,
|
|
808
|
+
dicebearSeed: y,
|
|
809
|
+
maxMouthOpening: L,
|
|
810
|
+
blinkIntervalMin: J,
|
|
811
|
+
blinkIntervalMax: te,
|
|
812
|
+
blinkDuration: Q,
|
|
813
|
+
mouseTrackingIntensity: R,
|
|
814
|
+
stateColors: g,
|
|
815
|
+
stateLabels: b,
|
|
816
|
+
customization: q
|
|
753
817
|
}) {
|
|
754
|
-
const
|
|
755
|
-
state:
|
|
756
|
-
analyser:
|
|
818
|
+
const k = De(c), z = l ?? k, ee = z ?? r, Y = {
|
|
819
|
+
state: t,
|
|
820
|
+
analyser: ee,
|
|
757
821
|
size: a,
|
|
758
|
-
maxMouthOpening:
|
|
759
|
-
blinkIntervalMin:
|
|
760
|
-
blinkIntervalMax:
|
|
761
|
-
blinkDuration:
|
|
762
|
-
mouseTrackingIntensity:
|
|
763
|
-
stateColors:
|
|
764
|
-
customization:
|
|
822
|
+
maxMouthOpening: L,
|
|
823
|
+
blinkIntervalMin: J,
|
|
824
|
+
blinkIntervalMax: te,
|
|
825
|
+
blinkDuration: Q,
|
|
826
|
+
mouseTrackingIntensity: R,
|
|
827
|
+
stateColors: g,
|
|
828
|
+
customization: q
|
|
765
829
|
};
|
|
766
|
-
let
|
|
767
|
-
if (
|
|
768
|
-
|
|
769
|
-
else if (
|
|
770
|
-
|
|
771
|
-
else if (
|
|
772
|
-
|
|
773
|
-
|
|
830
|
+
let P;
|
|
831
|
+
if (i === "vrm")
|
|
832
|
+
P = /* @__PURE__ */ e(he, { fallback: null, children: /* @__PURE__ */ e(Ze, { ...Y, vrmUrl: d }) });
|
|
833
|
+
else if (i === "glb")
|
|
834
|
+
P = /* @__PURE__ */ e(he, { fallback: null, children: /* @__PURE__ */ e(je, { ...Y, glbUrl: f }) });
|
|
835
|
+
else if (i === "dicebear")
|
|
836
|
+
P = /* @__PURE__ */ e(
|
|
837
|
+
_e,
|
|
774
838
|
{
|
|
775
|
-
state:
|
|
776
|
-
analyser:
|
|
839
|
+
state: t,
|
|
840
|
+
analyser: ee,
|
|
777
841
|
size: a,
|
|
778
|
-
maxMouthOpening:
|
|
779
|
-
stateColors:
|
|
780
|
-
collection:
|
|
781
|
-
seed:
|
|
842
|
+
maxMouthOpening: L,
|
|
843
|
+
stateColors: g,
|
|
844
|
+
collection: N,
|
|
845
|
+
seed: y
|
|
782
846
|
}
|
|
783
847
|
);
|
|
784
|
-
else if (
|
|
785
|
-
|
|
848
|
+
else if (i === "byos")
|
|
849
|
+
P = /* @__PURE__ */ e(pe, { ...Y, children: s });
|
|
786
850
|
else {
|
|
787
|
-
const
|
|
851
|
+
const S = {
|
|
788
852
|
geometric: ge,
|
|
789
|
-
memoji:
|
|
790
|
-
pixelart:
|
|
791
|
-
doodle:
|
|
792
|
-
}[
|
|
793
|
-
|
|
794
|
-
/* @__PURE__ */ e(
|
|
853
|
+
memoji: Qe,
|
|
854
|
+
pixelart: We,
|
|
855
|
+
doodle: $e
|
|
856
|
+
}[i] ?? ge;
|
|
857
|
+
P = // Keyed by variant so switching presets remounts the runtime cleanly
|
|
858
|
+
/* @__PURE__ */ e(pe, { ...Y, children: /* @__PURE__ */ e(S, { size: a, customization: q, state: t }) }, i);
|
|
795
859
|
}
|
|
796
|
-
const
|
|
797
|
-
idle: (
|
|
860
|
+
const j = ue(1), E = ue(0.15), $ = Z(null), C = oe(), w = {
|
|
861
|
+
idle: (g == null ? void 0 : g.idle) ?? "#4b5563",
|
|
798
862
|
// gray-600
|
|
799
|
-
listening: (
|
|
863
|
+
listening: (g == null ? void 0 : g.listening) ?? "#3b82f6",
|
|
800
864
|
// blue-500
|
|
801
|
-
thinking: (
|
|
865
|
+
thinking: (g == null ? void 0 : g.thinking) ?? "#8b5cf6",
|
|
802
866
|
// purple-500
|
|
803
|
-
speaking: (
|
|
867
|
+
speaking: (g == null ? void 0 : g.speaking) ?? "#10b981",
|
|
804
868
|
// emerald-500
|
|
805
|
-
working: (
|
|
869
|
+
working: (g == null ? void 0 : g.working) ?? "#f59e0b"
|
|
806
870
|
// amber-500
|
|
807
|
-
},
|
|
808
|
-
idle: (
|
|
809
|
-
listening: (
|
|
810
|
-
thinking: (
|
|
811
|
-
speaking: (
|
|
812
|
-
working: (
|
|
813
|
-
},
|
|
814
|
-
idle:
|
|
815
|
-
listening:
|
|
816
|
-
thinking:
|
|
817
|
-
speaking:
|
|
818
|
-
working:
|
|
871
|
+
}, O = {
|
|
872
|
+
idle: (b == null ? void 0 : b.idle) ?? "Idle",
|
|
873
|
+
listening: (b == null ? void 0 : b.listening) ?? "Listening",
|
|
874
|
+
thinking: (b == null ? void 0 : b.thinking) ?? "Thinking...",
|
|
875
|
+
speaking: (b == null ? void 0 : b.speaking) ?? "Speaking",
|
|
876
|
+
working: (b == null ? void 0 : b.working) ?? "Working"
|
|
877
|
+
}, H = {
|
|
878
|
+
idle: D(w.idle, 0.15),
|
|
879
|
+
listening: D(w.listening, 0.35),
|
|
880
|
+
thinking: D(w.thinking, 0.4),
|
|
881
|
+
speaking: D(w.speaking, 0.45),
|
|
882
|
+
working: D(w.working, 0.4)
|
|
819
883
|
};
|
|
820
|
-
|
|
821
|
-
if (!(r && (
|
|
822
|
-
|
|
884
|
+
X(() => {
|
|
885
|
+
if (!(r && (t === "speaking" || t === "listening")) && !(!r && z && t === "speaking")) {
|
|
886
|
+
j.set(t === "thinking" || t === "working" ? 1.05 : 1), E.set(t === "thinking" || t === "working" ? 0.35 : 0.15), $.current && cancelAnimationFrame($.current);
|
|
823
887
|
return;
|
|
824
888
|
}
|
|
825
|
-
const
|
|
826
|
-
let
|
|
827
|
-
if (r &&
|
|
828
|
-
r.getByteTimeDomainData(
|
|
829
|
-
let
|
|
830
|
-
for (let
|
|
831
|
-
const
|
|
832
|
-
|
|
889
|
+
const m = r ? new Uint8Array(r.frequencyBinCount) : null, W = () => {
|
|
890
|
+
let A;
|
|
891
|
+
if (r && m) {
|
|
892
|
+
r.getByteTimeDomainData(m);
|
|
893
|
+
let T = 0;
|
|
894
|
+
for (let K = 0; K < m.length; K++) {
|
|
895
|
+
const re = Math.abs(m[K] - 128);
|
|
896
|
+
re > T && (T = re);
|
|
833
897
|
}
|
|
834
|
-
|
|
898
|
+
A = Math.min(1, T / 128);
|
|
835
899
|
} else
|
|
836
|
-
|
|
837
|
-
|
|
900
|
+
A = z ? z.sample() : 0;
|
|
901
|
+
j.set(1 + A * 0.35), E.set(0.15 + A * 0.35), $.current = requestAnimationFrame(W);
|
|
838
902
|
};
|
|
839
|
-
return
|
|
840
|
-
|
|
903
|
+
return $.current = requestAnimationFrame(W), () => {
|
|
904
|
+
$.current && cancelAnimationFrame($.current);
|
|
841
905
|
};
|
|
842
|
-
}, [r,
|
|
843
|
-
|
|
844
|
-
|
|
906
|
+
}, [r, z, t, j, E]);
|
|
907
|
+
const G = Array.isArray(B) ? B : B ? ve : null, ie = t === "thinking" && !!G && G.length > 0, V = _ ?? Math.round(a * 0.28);
|
|
908
|
+
return /* @__PURE__ */ o("div", { className: `relative flex flex-col items-center justify-center ${h}`, style: { width: a, height: a, ...v }, children: [
|
|
909
|
+
U && /* @__PURE__ */ e(
|
|
910
|
+
ne.div,
|
|
845
911
|
{
|
|
846
912
|
className: "absolute rounded-[1.75rem] pointer-events-none filter blur-2xl",
|
|
847
913
|
style: {
|
|
848
914
|
width: a * 0.9,
|
|
849
915
|
height: a * 0.9,
|
|
850
|
-
backgroundColor:
|
|
851
|
-
scale:
|
|
852
|
-
opacity:
|
|
916
|
+
backgroundColor: w[t],
|
|
917
|
+
scale: j,
|
|
918
|
+
opacity: E
|
|
853
919
|
}
|
|
854
920
|
}
|
|
855
921
|
),
|
|
856
|
-
/* @__PURE__ */ e("div", { className: "w-full h-full relative flex items-center justify-center z-10", children:
|
|
857
|
-
|
|
858
|
-
|
|
922
|
+
/* @__PURE__ */ e("div", { className: "w-full h-full relative flex items-center justify-center z-10", children: P }),
|
|
923
|
+
ie ? /* @__PURE__ */ e(
|
|
924
|
+
"div",
|
|
925
|
+
{
|
|
926
|
+
className: "absolute z-40",
|
|
927
|
+
style: { top: Math.round(a * 0.02), right: Math.round(a * 0.02) },
|
|
928
|
+
children: /* @__PURE__ */ o("div", { className: "relative", children: [
|
|
929
|
+
/* @__PURE__ */ e(
|
|
930
|
+
ze,
|
|
931
|
+
{
|
|
932
|
+
emojis: G,
|
|
933
|
+
interval: F,
|
|
934
|
+
size: V
|
|
935
|
+
}
|
|
936
|
+
),
|
|
937
|
+
/* @__PURE__ */ e(
|
|
938
|
+
"div",
|
|
939
|
+
{
|
|
940
|
+
className: "absolute rounded-full bg-zinc-900/90 border border-purple-500/25 shadow-md backdrop-blur-md",
|
|
941
|
+
style: {
|
|
942
|
+
width: V * 0.22,
|
|
943
|
+
height: V * 0.22,
|
|
944
|
+
bottom: -V * 0.14,
|
|
945
|
+
left: -V * 0.02
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
),
|
|
949
|
+
/* @__PURE__ */ e(
|
|
950
|
+
"div",
|
|
951
|
+
{
|
|
952
|
+
className: "absolute rounded-full bg-zinc-900/90 border border-purple-500/20 shadow-sm backdrop-blur-md",
|
|
953
|
+
style: {
|
|
954
|
+
width: V * 0.14,
|
|
955
|
+
height: V * 0.14,
|
|
956
|
+
bottom: -V * 0.3,
|
|
957
|
+
left: -V * 0.18
|
|
958
|
+
}
|
|
959
|
+
}
|
|
960
|
+
)
|
|
961
|
+
] })
|
|
962
|
+
}
|
|
963
|
+
) : x && p && /* @__PURE__ */ e("div", { className: "absolute bottom-[108%] left-1/2 -translate-x-1/2 w-[90vw] max-w-[340px] md:max-w-[420px] z-40", children: /* @__PURE__ */ o("div", { className: "relative", children: [
|
|
964
|
+
/* @__PURE__ */ e(qe, { text: p, className: "max-w-none" }),
|
|
859
965
|
/* @__PURE__ */ e("div", { className: "absolute -bottom-3 left-1/2 -translate-x-1/2 w-4 h-4 bg-zinc-900/90 rounded-full border border-purple-500/20 shadow-md backdrop-blur-md" }),
|
|
860
966
|
/* @__PURE__ */ e("div", { className: "absolute -bottom-6 left-[48%] -translate-x-1/2 w-2.5 h-2.5 bg-zinc-900/90 rounded-full border border-purple-500/15 shadow-sm backdrop-blur-md" }),
|
|
861
967
|
/* @__PURE__ */ e("div", { className: "absolute -bottom-8 left-[47%] -translate-x-1/2 w-1.5 h-1.5 bg-zinc-900/90 rounded-full border border-purple-500/10 backdrop-blur-md" })
|
|
862
968
|
] }) }),
|
|
863
|
-
|
|
864
|
-
|
|
969
|
+
M && /* @__PURE__ */ e(
|
|
970
|
+
ne.div,
|
|
865
971
|
{
|
|
866
972
|
role: "status",
|
|
867
973
|
"aria-live": "polite",
|
|
868
974
|
className: "absolute -bottom-6 px-4 py-1.5 rounded-full text-xs font-bold text-white uppercase tracking-widest shadow-lg z-30 cursor-default select-none border border-white/10",
|
|
869
975
|
animate: {
|
|
870
|
-
backgroundColor:
|
|
871
|
-
boxShadow: `0 4px 14px rgba(0,0,0,0.4), 0 0 16px ${
|
|
976
|
+
backgroundColor: w[t],
|
|
977
|
+
boxShadow: `0 4px 14px rgba(0,0,0,0.4), 0 0 16px ${H[t]}`
|
|
872
978
|
},
|
|
873
979
|
transition: { duration: 0.3 },
|
|
874
980
|
children: /* @__PURE__ */ o("span", { className: "flex items-center gap-1.5", children: [
|
|
875
|
-
/* @__PURE__ */ e("span", { className: `w-2 h-2 rounded-full bg-white ${!
|
|
876
|
-
|
|
981
|
+
/* @__PURE__ */ e("span", { className: `w-2 h-2 rounded-full bg-white ${!C && (t === "speaking" || t === "thinking") ? "animate-ping" : ""}` }),
|
|
982
|
+
t === "working" && n ? `Working: ${n}` : O[t]
|
|
877
983
|
] })
|
|
878
984
|
}
|
|
879
985
|
),
|
|
880
|
-
|
|
986
|
+
I && u && /* @__PURE__ */ e("div", { className: "absolute top-[115%] left-1/2 -translate-x-1/2 w-[90vw] max-w-[500px] md:max-w-[640px] z-50 pb-8", children: /* @__PURE__ */ e(Ie, { text: u }) })
|
|
881
987
|
] });
|
|
882
988
|
}
|
|
883
|
-
function
|
|
884
|
-
size:
|
|
989
|
+
function Ke({
|
|
990
|
+
size: t = "100%",
|
|
885
991
|
customization: r,
|
|
886
992
|
state: l,
|
|
887
|
-
|
|
888
|
-
|
|
993
|
+
poses: c = !1,
|
|
994
|
+
className: a,
|
|
995
|
+
style: i
|
|
889
996
|
}) {
|
|
890
997
|
const {
|
|
891
|
-
skinColor:
|
|
998
|
+
skinColor: s = "#cf6b34",
|
|
892
999
|
// fur — also used for the eyelids
|
|
893
1000
|
bgColor: d = "#6fb3bd"
|
|
894
|
-
} = r ?? {}, [
|
|
1001
|
+
} = r ?? {}, [f, u] = ae.useState(
|
|
895
1002
|
() => Math.random() < 0.5 ? "wires" : "paper"
|
|
896
|
-
), p =
|
|
897
|
-
return
|
|
898
|
-
l === "working" && p.current !== "working" &&
|
|
1003
|
+
), p = ae.useRef(l);
|
|
1004
|
+
return ae.useEffect(() => {
|
|
1005
|
+
l === "working" && p.current !== "working" && u(Math.random() < 0.5 ? "wires" : "paper"), p.current = l;
|
|
899
1006
|
}, [l]), /* @__PURE__ */ o(
|
|
900
1007
|
"svg",
|
|
901
1008
|
{
|
|
902
1009
|
viewBox: "0 0 200 200",
|
|
903
|
-
width:
|
|
904
|
-
height:
|
|
1010
|
+
width: t,
|
|
1011
|
+
height: t,
|
|
905
1012
|
xmlns: "http://www.w3.org/2000/svg",
|
|
906
1013
|
role: "img",
|
|
907
1014
|
"aria-label": "Avatar",
|
|
908
|
-
className:
|
|
909
|
-
style:
|
|
1015
|
+
className: a,
|
|
1016
|
+
style: i,
|
|
910
1017
|
children: [
|
|
911
1018
|
/* @__PURE__ */ e("circle", { cx: "100", cy: "100", r: "79", fill: d }),
|
|
912
1019
|
/* @__PURE__ */ e("clipPath", { id: "rra-squirrel-clip", children: /* @__PURE__ */ e("circle", { cx: "100", cy: "100", r: "79" }) }),
|
|
913
1020
|
/* @__PURE__ */ o("g", { clipPath: "url(#rra-squirrel-clip)", children: [
|
|
914
|
-
/* @__PURE__ */ e("path", { d: "M150 158 C182 150 188 96 162 66 C150 52 130 52 124 66 C140 70 150 92 146 110 C142 132 132 148 150 158 Z", fill:
|
|
1021
|
+
/* @__PURE__ */ e("path", { d: "M150 158 C182 150 188 96 162 66 C150 52 130 52 124 66 C140 70 150 92 146 110 C142 132 132 148 150 158 Z", fill: s }),
|
|
915
1022
|
/* @__PURE__ */ e("path", { d: "M150 150 C172 142 176 100 156 76 C150 90 156 104 152 120 C148 134 140 142 150 150 Z", fill: "#e3a368" }),
|
|
916
|
-
/* @__PURE__ */ e("path", { d: "M84 118 Q82 140 78 150 L122 150 Q118 140 116 118 Z", fill:
|
|
1023
|
+
/* @__PURE__ */ e("path", { d: "M84 118 Q82 140 78 150 L122 150 Q118 140 116 118 Z", fill: s }),
|
|
917
1024
|
/* @__PURE__ */ e("path", { d: "M85 122 Q100 133 115 122 Q100 129 85 122 Z", fill: "#b05418", opacity: "0.55" }),
|
|
918
1025
|
/* @__PURE__ */ e("path", { d: "M36 182 Q42 148 72 144 Q86 158 100 158 Q114 158 128 144 Q158 148 164 182 Z", fill: "#2b2f36" }),
|
|
919
1026
|
/* @__PURE__ */ e("path", { d: "M78 146 Q100 156 122 146", fill: "none", stroke: "#3c424b", strokeWidth: "3", strokeLinecap: "round" }),
|
|
@@ -923,18 +1030,18 @@ function Ue({
|
|
|
923
1030
|
/* @__PURE__ */ e("circle", { cx: "100", cy: "162", r: "1.4", fill: "#6cc0ee", stroke: "none" })
|
|
924
1031
|
] }),
|
|
925
1032
|
/* @__PURE__ */ e("path", { d: "M96 150 L94 170 M104 150 L106 170", stroke: "#e9eef2", strokeWidth: "1.6", strokeLinecap: "round", fill: "none" }),
|
|
926
|
-
/* @__PURE__ */ o("g", { id: "rra-squirrel-head", transform: l === "thinking" ? "rotate(6 100 120)" : void 0, children: [
|
|
927
|
-
/* @__PURE__ */ e("path", { d: "M66 80 L58 42 Q74 50 86 72 Z", fill:
|
|
928
|
-
/* @__PURE__ */ e("path", { d: "M134 80 L142 42 Q126 50 114 72 Z", fill:
|
|
1033
|
+
/* @__PURE__ */ o("g", { id: "rra-squirrel-head", transform: c && l === "thinking" ? "rotate(6 100 120)" : void 0, children: [
|
|
1034
|
+
/* @__PURE__ */ e("path", { d: "M66 80 L58 42 Q74 50 86 72 Z", fill: s }),
|
|
1035
|
+
/* @__PURE__ */ e("path", { d: "M134 80 L142 42 Q126 50 114 72 Z", fill: s }),
|
|
929
1036
|
/* @__PURE__ */ e("path", { d: "M68 74 L63 52 Q72 56 80 70 Z", fill: "#a8451c" }),
|
|
930
1037
|
/* @__PURE__ */ e("path", { d: "M132 74 L137 52 Q128 56 120 70 Z", fill: "#a8451c" }),
|
|
931
1038
|
/* @__PURE__ */ o("g", { stroke: "#f0d9b8", strokeWidth: "1.4", strokeLinecap: "round", fill: "none", children: [
|
|
932
1039
|
/* @__PURE__ */ e("path", { d: "M60 46 L57 38 M63 47 L62 39 M66 49 L66 41" }),
|
|
933
1040
|
/* @__PURE__ */ e("path", { d: "M140 46 L143 38 M137 47 L138 39 M134 49 L134 41" })
|
|
934
1041
|
] }),
|
|
935
|
-
/* @__PURE__ */ e("ellipse", { cx: "100", cy: "98", rx: "40", ry: "37", fill:
|
|
936
|
-
/* @__PURE__ */ e("path", { d: "M62 96 Q54 90 58 100 Q56 108 64 106 Z", fill:
|
|
937
|
-
/* @__PURE__ */ e("path", { d: "M138 96 Q146 90 142 100 Q144 108 136 106 Z", fill:
|
|
1042
|
+
/* @__PURE__ */ e("ellipse", { cx: "100", cy: "98", rx: "40", ry: "37", fill: s }),
|
|
1043
|
+
/* @__PURE__ */ e("path", { d: "M62 96 Q54 90 58 100 Q56 108 64 106 Z", fill: s }),
|
|
1044
|
+
/* @__PURE__ */ e("path", { d: "M138 96 Q146 90 142 100 Q144 108 136 106 Z", fill: s }),
|
|
938
1045
|
/* @__PURE__ */ e("ellipse", { cx: "100", cy: "112", rx: "23", ry: "18", fill: "#ecc090" }),
|
|
939
1046
|
/* @__PURE__ */ e("path", { d: "M64 78 Q60 50 86 46 Q78 54 82 60 Q92 44 110 48 Q102 56 106 60 Q120 50 134 74 Q124 62 112 66 Q100 56 88 66 Q76 64 64 78 Z", fill: "#3a2820" }),
|
|
940
1047
|
/* @__PURE__ */ o("g", { stroke: "#5a3a22", strokeWidth: "3", strokeLinecap: "round", fill: "none", children: [
|
|
@@ -950,17 +1057,17 @@ function Ue({
|
|
|
950
1057
|
/* @__PURE__ */ e("circle", { cx: "118", cy: "92", r: "13.5", fill: "#fbf7ef", stroke: "#1a1a1a", strokeWidth: "3" }),
|
|
951
1058
|
/* @__PURE__ */ o("g", { children: [
|
|
952
1059
|
/* @__PURE__ */ e("ellipse", { cx: "82", cy: "93", rx: "8", ry: "8.5", fill: "#ffffff" }),
|
|
953
|
-
/* @__PURE__ */ e("g", { transform: l === "thinking" ? "translate(5, 0)" : void 0, children: /* @__PURE__ */ e("circle", { className: "rra-pupil", "data-base-x": 82, "data-base-y": 93, cx: "82", cy: "93", r: "4.6", fill: "#2b1b12" }) }),
|
|
1060
|
+
/* @__PURE__ */ e("g", { transform: c && l === "thinking" ? "translate(5, 0)" : void 0, children: /* @__PURE__ */ e("circle", { className: "rra-pupil", "data-base-x": 82, "data-base-y": 93, cx: "82", cy: "93", r: "4.6", fill: "#2b1b12" }) }),
|
|
954
1061
|
/* @__PURE__ */ e("circle", { cx: "84", cy: "90", r: "1.5", fill: "#ffffff" }),
|
|
955
|
-
/* @__PURE__ */ e("rect", { className: "rra-lid", "data-max-height": "18", x: "73", y: "83", width: "18", height: "0", fill:
|
|
1062
|
+
/* @__PURE__ */ e("rect", { className: "rra-lid", "data-max-height": "18", x: "73", y: "83", width: "18", height: "0", fill: s })
|
|
956
1063
|
] }),
|
|
957
1064
|
/* @__PURE__ */ o("g", { children: [
|
|
958
1065
|
/* @__PURE__ */ e("ellipse", { cx: "118", cy: "93", rx: "8", ry: "8.5", fill: "#ffffff" }),
|
|
959
|
-
/* @__PURE__ */ e("g", { transform: l === "thinking" ? "translate(5, 0)" : void 0, children: /* @__PURE__ */ e("circle", { className: "rra-pupil", "data-base-x": 118, "data-base-y": 93, cx: "118", cy: "93", r: "4.6", fill: "#2b1b12" }) }),
|
|
1066
|
+
/* @__PURE__ */ e("g", { transform: c && l === "thinking" ? "translate(5, 0)" : void 0, children: /* @__PURE__ */ e("circle", { className: "rra-pupil", "data-base-x": 118, "data-base-y": 93, cx: "118", cy: "93", r: "4.6", fill: "#2b1b12" }) }),
|
|
960
1067
|
/* @__PURE__ */ e("circle", { cx: "120", cy: "90", r: "1.5", fill: "#ffffff" }),
|
|
961
|
-
/* @__PURE__ */ e("rect", { className: "rra-lid", "data-max-height": "18", x: "109", y: "83", width: "18", height: "0", fill:
|
|
1068
|
+
/* @__PURE__ */ e("rect", { className: "rra-lid", "data-max-height": "18", x: "109", y: "83", width: "18", height: "0", fill: s })
|
|
962
1069
|
] }),
|
|
963
|
-
l === "working" &&
|
|
1070
|
+
c && l === "working" && f === "wires" && /* @__PURE__ */ o("g", { id: "rra-safety-goggles", children: [
|
|
964
1071
|
/* @__PURE__ */ e("path", { d: "M 52 92 C 45 92, 45 96, 40 96 M 148 92 C 155 92, 155 96, 160 96", fill: "none", stroke: "#2d3748", strokeWidth: "4", strokeLinecap: "round" }),
|
|
965
1072
|
/* @__PURE__ */ e("rect", { x: "58", y: "78", width: "84", height: "28", rx: "14", fill: "none", stroke: "#e2e8f0", strokeWidth: "4" }),
|
|
966
1073
|
/* @__PURE__ */ e("rect", { x: "60", y: "80", width: "80", height: "24", rx: "12", fill: "#e0f2fe", fillOpacity: "0.15" }),
|
|
@@ -971,7 +1078,7 @@ function Ue({
|
|
|
971
1078
|
/* @__PURE__ */ e("path", { d: "M100 113 L100 118", stroke: "#7a4a32", strokeWidth: "1.6", strokeLinecap: "round" }),
|
|
972
1079
|
/* @__PURE__ */ e("ellipse", { id: "rra-mouth", cx: "100", cy: "121", rx: "7", ry: "2.3", fill: "#5a3324" }),
|
|
973
1080
|
/* @__PURE__ */ e("g", { stroke: "#caa074", strokeWidth: "1", strokeLinecap: "round", opacity: "0.8", fill: "none", children: /* @__PURE__ */ e("path", { d: "M80 116 L62 113 M80 120 L62 121 M120 116 L138 113 M120 120 L138 121" }) }),
|
|
974
|
-
l === "thinking" && /* @__PURE__ */ o("g", { id: "rra-thinking-hand", children: [
|
|
1081
|
+
c && l === "thinking" && /* @__PURE__ */ o("g", { id: "rra-thinking-hand", children: [
|
|
975
1082
|
/* @__PURE__ */ e(
|
|
976
1083
|
"path",
|
|
977
1084
|
{
|
|
@@ -981,14 +1088,14 @@ function Ue({
|
|
|
981
1088
|
strokeWidth: "1.2"
|
|
982
1089
|
}
|
|
983
1090
|
),
|
|
984
|
-
/* @__PURE__ */ o("g", { fill:
|
|
1091
|
+
/* @__PURE__ */ o("g", { fill: s, stroke: "#b05418", strokeWidth: "1.2", strokeLinejoin: "round", strokeLinecap: "round", children: [
|
|
985
1092
|
/* @__PURE__ */ e("path", { d: "M112 144 C110 138, 107 130, 105 124 C104 121, 108 121, 109 124 C111 130, 113 136, 115 141" }),
|
|
986
1093
|
/* @__PURE__ */ e("path", { d: "M115 141 C117 139, 120 140, 119 143 C121 142, 123 144, 121 147 C122 147, 123 149, 121 151 C120 152, 116 150, 115 145" }),
|
|
987
1094
|
/* @__PURE__ */ e("path", { d: "M110 139 C104 139, 96 135, 92 132 C90 130, 93 128, 95 130 C100 133, 106 135, 110 136" })
|
|
988
1095
|
] })
|
|
989
1096
|
] })
|
|
990
1097
|
] }),
|
|
991
|
-
l === "working" &&
|
|
1098
|
+
c && l === "working" && f === "wires" && /* @__PURE__ */ o("g", { id: "rra-working-workspace-wires", children: [
|
|
992
1099
|
/* @__PURE__ */ e("circle", { cx: "100", cy: "162", r: "22", fill: "#fef08a", fillOpacity: "0.25", children: /* @__PURE__ */ e("animate", { attributeName: "opacity", values: "1;0.2;0.9;0.1;0.8;0.3;1", dur: "1.2s", repeatCount: "indefinite" }) }),
|
|
993
1100
|
/* @__PURE__ */ e("rect", { x: "94", y: "172", width: "12", height: "8", fill: "#94a3b8", rx: "1" }),
|
|
994
1101
|
/* @__PURE__ */ e("rect", { x: "96", y: "175", width: "8", height: "2", fill: "#64748b" }),
|
|
@@ -1007,7 +1114,7 @@ function Ue({
|
|
|
1007
1114
|
),
|
|
1008
1115
|
/* @__PURE__ */ e("path", { d: "M36 182 L55 162 L64 168 L45 182 Z", fill: "#2b2f36", stroke: "#1e293b", strokeWidth: "1" }),
|
|
1009
1116
|
/* @__PURE__ */ e("path", { d: "M 45 180 C 45 165, 80 170, 94 174", fill: "none", stroke: "#ef4444", strokeWidth: "2.5", strokeLinecap: "round" }),
|
|
1010
|
-
/* @__PURE__ */ o("g", { fill:
|
|
1117
|
+
/* @__PURE__ */ o("g", { fill: s, stroke: "#b05418", strokeWidth: "1", children: [
|
|
1011
1118
|
/* @__PURE__ */ e("rect", { x: "58", y: "160", width: "10", height: "12", rx: "4", transform: "rotate(-10 63 166)" }),
|
|
1012
1119
|
/* @__PURE__ */ e("rect", { x: "62", y: "163", width: "9", height: "10", rx: "3", transform: "rotate(-15 66.5 168)" })
|
|
1013
1120
|
] })
|
|
@@ -1025,13 +1132,13 @@ function Ue({
|
|
|
1025
1132
|
),
|
|
1026
1133
|
/* @__PURE__ */ e("path", { d: "M164 182 L145 162 L136 168 L155 182 Z", fill: "#2b2f36", stroke: "#1e293b", strokeWidth: "1" }),
|
|
1027
1134
|
/* @__PURE__ */ e("path", { d: "M 155 180 C 155 165, 120 170, 106 174", fill: "none", stroke: "#1e293b", strokeWidth: "2.5", strokeLinecap: "round" }),
|
|
1028
|
-
/* @__PURE__ */ o("g", { fill:
|
|
1135
|
+
/* @__PURE__ */ o("g", { fill: s, stroke: "#b05418", strokeWidth: "1", children: [
|
|
1029
1136
|
/* @__PURE__ */ e("rect", { x: "132", y: "160", width: "10", height: "12", rx: "4", transform: "rotate(10 137 166)" }),
|
|
1030
1137
|
/* @__PURE__ */ e("rect", { x: "129", y: "163", width: "9", height: "10", rx: "3", transform: "rotate(15 133.5 168)" })
|
|
1031
1138
|
] })
|
|
1032
1139
|
] })
|
|
1033
1140
|
] }),
|
|
1034
|
-
l === "working" &&
|
|
1141
|
+
c && l === "working" && f === "paper" && /* @__PURE__ */ o("g", { id: "rra-working-workspace-paper", children: [
|
|
1035
1142
|
/* @__PURE__ */ e(
|
|
1036
1143
|
"animateTransform",
|
|
1037
1144
|
{
|
|
@@ -1052,13 +1159,13 @@ function Ue({
|
|
|
1052
1159
|
/* @__PURE__ */ e("path", { d: "M100 148 C 84 136 68 130 52 126 L 60 182 C 78 178 90 177 100 176 Z", fill: "#20242b", stroke: "#0f1216", strokeWidth: "1.5" }),
|
|
1053
1160
|
/* @__PURE__ */ e("path", { d: "M100 148 C 116 136 132 130 148 126 L 140 182 C 122 178 110 177 100 176 Z", fill: "#20242b", stroke: "#0f1216", strokeWidth: "1.5" }),
|
|
1054
1161
|
/* @__PURE__ */ e("line", { x1: "100", y1: "134", x2: "100", y2: "176", stroke: "#0f1216", strokeWidth: "1.4" }),
|
|
1055
|
-
/* @__PURE__ */ o("g", { fill:
|
|
1162
|
+
/* @__PURE__ */ o("g", { fill: s, stroke: "#b05418", strokeWidth: "1", children: [
|
|
1056
1163
|
/* @__PURE__ */ e("circle", { cx: "60", cy: "180", r: "7" }),
|
|
1057
1164
|
/* @__PURE__ */ e("rect", { x: "57", y: "170", width: "7", height: "12", rx: "3" }),
|
|
1058
1165
|
/* @__PURE__ */ e("rect", { x: "62", y: "172", width: "7", height: "11", rx: "3" }),
|
|
1059
1166
|
/* @__PURE__ */ e("rect", { x: "67", y: "173", width: "6", height: "10", rx: "3" })
|
|
1060
1167
|
] }),
|
|
1061
|
-
/* @__PURE__ */ o("g", { fill:
|
|
1168
|
+
/* @__PURE__ */ o("g", { fill: s, stroke: "#b05418", strokeWidth: "1", children: [
|
|
1062
1169
|
/* @__PURE__ */ e("circle", { cx: "140", cy: "180", r: "7" }),
|
|
1063
1170
|
/* @__PURE__ */ e("rect", { x: "136", y: "170", width: "7", height: "12", rx: "3" }),
|
|
1064
1171
|
/* @__PURE__ */ e("rect", { x: "131", y: "172", width: "7", height: "11", rx: "3" }),
|
|
@@ -1075,18 +1182,18 @@ function Ue({
|
|
|
1075
1182
|
}
|
|
1076
1183
|
);
|
|
1077
1184
|
}
|
|
1078
|
-
function
|
|
1079
|
-
const [a,
|
|
1080
|
-
return
|
|
1081
|
-
let
|
|
1082
|
-
return
|
|
1083
|
-
|
|
1185
|
+
function Xe({ collection: t, seed: r, size: l = 44, className: c = "" }) {
|
|
1186
|
+
const [a, i] = ce(null);
|
|
1187
|
+
return X(() => {
|
|
1188
|
+
let s = !1;
|
|
1189
|
+
return i(null), Fe(t, r).then((d) => {
|
|
1190
|
+
s || i(d);
|
|
1084
1191
|
}).catch(() => {
|
|
1085
|
-
|
|
1192
|
+
s || i(null);
|
|
1086
1193
|
}), () => {
|
|
1087
|
-
|
|
1194
|
+
s = !0;
|
|
1088
1195
|
};
|
|
1089
|
-
}, [
|
|
1196
|
+
}, [t, r]), /* @__PURE__ */ e(
|
|
1090
1197
|
"div",
|
|
1091
1198
|
{
|
|
1092
1199
|
className: `flex items-center justify-center overflow-hidden ${c}`,
|
|
@@ -1102,97 +1209,97 @@ function Ye({ collection: i, seed: r, size: l = 44, className: c = "" }) {
|
|
|
1102
1209
|
}
|
|
1103
1210
|
);
|
|
1104
1211
|
}
|
|
1105
|
-
function
|
|
1106
|
-
analyser:
|
|
1212
|
+
function Je({
|
|
1213
|
+
analyser: t,
|
|
1107
1214
|
state: r,
|
|
1108
1215
|
height: l = 80,
|
|
1109
1216
|
className: c = "",
|
|
1110
1217
|
style: a,
|
|
1111
|
-
stateColors:
|
|
1218
|
+
stateColors: i
|
|
1112
1219
|
}) {
|
|
1113
|
-
const
|
|
1114
|
-
idle: (
|
|
1115
|
-
listening: (
|
|
1116
|
-
thinking: (
|
|
1117
|
-
speaking: (
|
|
1118
|
-
working: (
|
|
1220
|
+
const s = Z(null), d = Z(null), f = Z(0), u = {
|
|
1221
|
+
idle: (i == null ? void 0 : i.idle) ?? "#9ca3af",
|
|
1222
|
+
listening: (i == null ? void 0 : i.listening) ?? "#3b82f6",
|
|
1223
|
+
thinking: (i == null ? void 0 : i.thinking) ?? "#8b5cf6",
|
|
1224
|
+
speaking: (i == null ? void 0 : i.speaking) ?? "#10b981",
|
|
1225
|
+
working: (i == null ? void 0 : i.working) ?? "#f59e0b"
|
|
1119
1226
|
};
|
|
1120
|
-
return
|
|
1121
|
-
const
|
|
1122
|
-
if (!
|
|
1123
|
-
const n =
|
|
1227
|
+
return X(() => {
|
|
1228
|
+
const p = s.current;
|
|
1229
|
+
if (!p) return;
|
|
1230
|
+
const n = p.getContext("2d");
|
|
1124
1231
|
if (!n) return;
|
|
1125
|
-
const
|
|
1126
|
-
const
|
|
1127
|
-
|
|
1232
|
+
const B = () => {
|
|
1233
|
+
const M = window.devicePixelRatio || 1, x = p.getBoundingClientRect();
|
|
1234
|
+
p.width = x.width * M, p.height = x.height * M, n.scale(M, M);
|
|
1128
1235
|
};
|
|
1129
|
-
|
|
1130
|
-
let
|
|
1131
|
-
|
|
1132
|
-
const
|
|
1133
|
-
const
|
|
1134
|
-
n.fillStyle = "rgba(9, 9, 11, 0.2)", n.fillRect(0, 0,
|
|
1135
|
-
const
|
|
1136
|
-
if (r === "speaking" &&
|
|
1137
|
-
|
|
1138
|
-
const
|
|
1139
|
-
let
|
|
1140
|
-
for (let
|
|
1141
|
-
const y =
|
|
1142
|
-
|
|
1236
|
+
B(), window.addEventListener("resize", B);
|
|
1237
|
+
let F = 0, _ = new Uint8Array(0);
|
|
1238
|
+
t && (t.fftSize = 128, F = t.frequencyBinCount, _ = new Uint8Array(F));
|
|
1239
|
+
const U = () => {
|
|
1240
|
+
const M = p.width / (window.devicePixelRatio || 1), x = p.height / (window.devicePixelRatio || 1);
|
|
1241
|
+
n.fillStyle = "rgba(9, 9, 11, 0.2)", n.fillRect(0, 0, M, x), f.current += 0.05;
|
|
1242
|
+
const I = f.current;
|
|
1243
|
+
if (r === "speaking" && t) {
|
|
1244
|
+
t.getByteFrequencyData(_), n.lineWidth = 3, n.strokeStyle = u.speaking, n.shadowBlur = 15, n.shadowColor = D(u.speaking, 0.6), n.beginPath();
|
|
1245
|
+
const h = M / F;
|
|
1246
|
+
let v = 0;
|
|
1247
|
+
for (let N = 0; N < F; N++) {
|
|
1248
|
+
const y = _[N] / 255, L = x / 2 + Math.sin(N * 0.15 + I * 2) * (y * x * 0.4);
|
|
1249
|
+
N === 0 ? n.moveTo(v, L) : n.lineTo(v, L), v += h;
|
|
1143
1250
|
}
|
|
1144
|
-
n.lineTo(
|
|
1251
|
+
n.lineTo(M, x / 2), n.stroke(), n.shadowBlur = 0;
|
|
1145
1252
|
} else if (r === "listening") {
|
|
1146
|
-
let
|
|
1147
|
-
if (
|
|
1148
|
-
|
|
1253
|
+
let h = 0;
|
|
1254
|
+
if (t && _.length > 0) {
|
|
1255
|
+
t.getByteTimeDomainData(_);
|
|
1149
1256
|
let y = 0;
|
|
1150
|
-
for (let L = 0; L <
|
|
1151
|
-
const J = Math.abs(
|
|
1257
|
+
for (let L = 0; L < _.length; L++) {
|
|
1258
|
+
const J = Math.abs(_[L] - 128);
|
|
1152
1259
|
J > y && (y = J);
|
|
1153
1260
|
}
|
|
1154
|
-
|
|
1261
|
+
h = Math.min(1, y / 128);
|
|
1155
1262
|
}
|
|
1156
|
-
const
|
|
1157
|
-
n.shadowBlur = 12, n.lineWidth = 2.5, n.strokeStyle =
|
|
1158
|
-
for (let y = 0; y <
|
|
1159
|
-
const L =
|
|
1263
|
+
const v = 4 + h * 36, N = 3 + h * 27;
|
|
1264
|
+
n.shadowBlur = 12, n.lineWidth = 2.5, n.strokeStyle = D(u.listening, 0.7), n.shadowColor = D(u.listening, 0.4), n.beginPath();
|
|
1265
|
+
for (let y = 0; y < M; y++) {
|
|
1266
|
+
const L = x / 2 + Math.sin(y * 0.02 + I * 1.5) * Math.sin(y * 5e-3) * v;
|
|
1160
1267
|
y === 0 ? n.moveTo(y, L) : n.lineTo(y, L);
|
|
1161
1268
|
}
|
|
1162
|
-
n.stroke(), n.strokeStyle =
|
|
1163
|
-
for (let y = 0; y <
|
|
1164
|
-
const L =
|
|
1269
|
+
n.stroke(), n.strokeStyle = D(u.listening, 0.5), n.shadowColor = D(u.listening, 0.3), n.beginPath();
|
|
1270
|
+
for (let y = 0; y < M; y++) {
|
|
1271
|
+
const L = x / 2 + Math.sin(y * 0.015 - I * 1.2 + Math.PI) * Math.sin(y * 5e-3) * N;
|
|
1165
1272
|
y === 0 ? n.moveTo(y, L) : n.lineTo(y, L);
|
|
1166
1273
|
}
|
|
1167
1274
|
n.stroke(), n.shadowBlur = 0;
|
|
1168
1275
|
} else if (r === "thinking") {
|
|
1169
|
-
n.shadowBlur = 10, n.shadowColor =
|
|
1170
|
-
for (let
|
|
1171
|
-
const
|
|
1172
|
-
|
|
1276
|
+
n.shadowBlur = 10, n.shadowColor = D(u.thinking, 0.4), n.lineWidth = 2, n.strokeStyle = D(u.thinking, 0.7), n.beginPath();
|
|
1277
|
+
for (let h = 0; h < M; h++) {
|
|
1278
|
+
const v = x / 2 + Math.sin(h * 0.03 + I) * 5 + Math.sin(h * 0.01 - I * 0.5) * 8;
|
|
1279
|
+
h === 0 ? n.moveTo(h, v) : n.lineTo(h, v);
|
|
1173
1280
|
}
|
|
1174
1281
|
n.stroke(), n.shadowBlur = 0;
|
|
1175
1282
|
} else if (r === "working") {
|
|
1176
|
-
n.shadowBlur = 10, n.shadowColor =
|
|
1177
|
-
for (let
|
|
1178
|
-
const
|
|
1179
|
-
|
|
1283
|
+
n.shadowBlur = 10, n.shadowColor = D(u.working, 0.4), n.lineWidth = 2, n.strokeStyle = D(u.working, 0.7), n.beginPath();
|
|
1284
|
+
for (let h = 0; h < M; h += 8) {
|
|
1285
|
+
const v = x / 2 + Math.sin(h * 0.04 + I * 2.5) * 12 + Math.cos(h * 0.01 - I) * 6, N = x / 2 + Math.round((v - x / 2) / 6) * 6;
|
|
1286
|
+
h === 0 ? n.moveTo(h, N) : (n.lineTo(h, N), n.lineTo(Math.min(M, h + 8), N));
|
|
1180
1287
|
}
|
|
1181
1288
|
n.stroke(), n.shadowBlur = 0;
|
|
1182
1289
|
} else {
|
|
1183
|
-
n.lineWidth = 1.5, n.strokeStyle =
|
|
1184
|
-
for (let
|
|
1185
|
-
const
|
|
1186
|
-
|
|
1290
|
+
n.lineWidth = 1.5, n.strokeStyle = D(u.idle, 0.3), n.beginPath();
|
|
1291
|
+
for (let h = 0; h < M; h++) {
|
|
1292
|
+
const v = x / 2 + Math.sin(h * 0.01 + I * 0.2) * 2;
|
|
1293
|
+
h === 0 ? n.moveTo(h, v) : n.lineTo(h, v);
|
|
1187
1294
|
}
|
|
1188
1295
|
n.stroke();
|
|
1189
1296
|
}
|
|
1190
|
-
|
|
1297
|
+
d.current = requestAnimationFrame(U);
|
|
1191
1298
|
};
|
|
1192
|
-
return
|
|
1193
|
-
window.removeEventListener("resize",
|
|
1299
|
+
return U(), () => {
|
|
1300
|
+
window.removeEventListener("resize", B), d.current && cancelAnimationFrame(d.current);
|
|
1194
1301
|
};
|
|
1195
|
-
}, [
|
|
1302
|
+
}, [t, r, i]), /* @__PURE__ */ o("div", { className: `w-full bg-zinc-950/80 border border-zinc-800/40 rounded-xl overflow-hidden p-2 ${c}`, style: a, children: [
|
|
1196
1303
|
/* @__PURE__ */ o("div", { className: "flex justify-between items-center px-2 mb-1", children: [
|
|
1197
1304
|
/* @__PURE__ */ e("span", { className: "text-[10px] text-zinc-500 uppercase tracking-widest font-mono font-bold", children: "Audio Waveform Telemetry" }),
|
|
1198
1305
|
/* @__PURE__ */ o("span", { className: "flex h-2 w-2 relative", children: [
|
|
@@ -1200,14 +1307,14 @@ function He({
|
|
|
1200
1307
|
"span",
|
|
1201
1308
|
{
|
|
1202
1309
|
className: "animate-ping absolute inline-flex h-full w-full rounded-full opacity-75",
|
|
1203
|
-
style: { backgroundColor:
|
|
1310
|
+
style: { backgroundColor: u[r] }
|
|
1204
1311
|
}
|
|
1205
1312
|
),
|
|
1206
1313
|
/* @__PURE__ */ e(
|
|
1207
1314
|
"span",
|
|
1208
1315
|
{
|
|
1209
1316
|
className: "relative inline-flex rounded-full h-2 w-2",
|
|
1210
|
-
style: { backgroundColor:
|
|
1317
|
+
style: { backgroundColor: u[r] }
|
|
1211
1318
|
}
|
|
1212
1319
|
)
|
|
1213
1320
|
] })
|
|
@@ -1215,63 +1322,65 @@ function He({
|
|
|
1215
1322
|
/* @__PURE__ */ e(
|
|
1216
1323
|
"canvas",
|
|
1217
1324
|
{
|
|
1218
|
-
ref:
|
|
1325
|
+
ref: s,
|
|
1219
1326
|
className: "w-full block",
|
|
1220
1327
|
style: { height: l }
|
|
1221
1328
|
}
|
|
1222
1329
|
)
|
|
1223
1330
|
] });
|
|
1224
1331
|
}
|
|
1225
|
-
function
|
|
1226
|
-
const a =
|
|
1227
|
-
a.current = l,
|
|
1228
|
-
var
|
|
1332
|
+
function et({ analyser: t, enabled: r, onFrame: l, onStop: c }) {
|
|
1333
|
+
const a = Z(l), i = Z(c);
|
|
1334
|
+
a.current = l, i.current = c, X(() => {
|
|
1335
|
+
var u;
|
|
1229
1336
|
if (!r) {
|
|
1230
|
-
(
|
|
1337
|
+
(u = i.current) == null || u.call(i);
|
|
1231
1338
|
return;
|
|
1232
1339
|
}
|
|
1233
|
-
const
|
|
1234
|
-
let
|
|
1235
|
-
const
|
|
1236
|
-
a.current(
|
|
1340
|
+
const s = de(t);
|
|
1341
|
+
let d;
|
|
1342
|
+
const f = () => {
|
|
1343
|
+
a.current(s.read()), d = requestAnimationFrame(f);
|
|
1237
1344
|
};
|
|
1238
|
-
return
|
|
1239
|
-
var
|
|
1240
|
-
cancelAnimationFrame(
|
|
1345
|
+
return d = requestAnimationFrame(f), () => {
|
|
1346
|
+
var p;
|
|
1347
|
+
cancelAnimationFrame(d), (p = i.current) == null || p.call(i);
|
|
1241
1348
|
};
|
|
1242
|
-
}, [
|
|
1349
|
+
}, [t, r]);
|
|
1243
1350
|
}
|
|
1244
1351
|
export {
|
|
1245
|
-
|
|
1246
|
-
|
|
1352
|
+
Je as AudioVisualizer,
|
|
1353
|
+
Ie as AvatarCaption,
|
|
1247
1354
|
qe as AvatarThought,
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1355
|
+
pe as ContractAvatar,
|
|
1356
|
+
Te as DEFAULT_DICEBEAR_COLLECTION,
|
|
1357
|
+
Be as DEFAULT_DICEBEAR_SEED,
|
|
1358
|
+
ve as DEFAULT_THINKING_EMOJIS,
|
|
1251
1359
|
ye as DICEBEAR_FEATURED_FACES,
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1360
|
+
Ee as DICEBEAR_RIGS,
|
|
1361
|
+
Re as DICEBEAR_STYLES,
|
|
1362
|
+
Ye as DICEBEAR_STYLE_BY_ID,
|
|
1363
|
+
_e as DiceBearAvatar,
|
|
1364
|
+
Xe as DiceBearThumb,
|
|
1365
|
+
$e as DoodleAvatar,
|
|
1258
1366
|
ge as GeometricAvatar,
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1367
|
+
Qe as MemojiAvatar,
|
|
1368
|
+
We as PixelArtAvatar,
|
|
1369
|
+
He as RealtimeAvatar,
|
|
1370
|
+
rt as SPEECH_ACTIVITY_BRAND,
|
|
1371
|
+
Ke as SquirrelAvatar,
|
|
1372
|
+
ze as ThoughtEmojiBubble,
|
|
1264
1373
|
fe as collectionExportName,
|
|
1265
1374
|
de as createMouthEngine,
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1375
|
+
Ae as createSpeechActivity,
|
|
1376
|
+
lt as isSpeechActivity,
|
|
1377
|
+
be as loadDiceBear,
|
|
1378
|
+
Fe as renderDiceBearSvg,
|
|
1379
|
+
xe as scopeSvgIds,
|
|
1271
1380
|
we as tailWindow,
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1381
|
+
ke as toPlainText,
|
|
1382
|
+
et as useAudioMouth,
|
|
1383
|
+
Se as useAvatarRuntime,
|
|
1384
|
+
oe as useReducedMotion,
|
|
1385
|
+
De as useStreamingTextActivity
|
|
1277
1386
|
};
|