@lobehub/ui 6.17.1 → 6.19.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.
Files changed (119) hide show
  1. package/es/AgentAvatar/AgentAvatar.mjs +89 -139
  2. package/es/AgentAvatar/AgentAvatar.mjs.map +1 -1
  3. package/es/AgentAvatar/AgentAvatarPicker.d.mts +3 -0
  4. package/es/AgentAvatar/AgentAvatarPicker.mjs +109 -0
  5. package/es/AgentAvatar/AgentAvatarPicker.mjs.map +1 -0
  6. package/es/AgentAvatar/createAgentAvatarTab.d.mts +4 -0
  7. package/es/AgentAvatar/createAgentAvatarTab.mjs +46 -0
  8. package/es/AgentAvatar/createAgentAvatarTab.mjs.map +1 -0
  9. package/es/AgentAvatar/eyes.mjs +83 -0
  10. package/es/AgentAvatar/eyes.mjs.map +1 -0
  11. package/es/AgentAvatar/index.d.mts +5 -2
  12. package/es/AgentAvatar/index.mjs +4 -1
  13. package/es/AgentAvatar/liveLoop.mjs +97 -0
  14. package/es/AgentAvatar/liveLoop.mjs.map +1 -0
  15. package/es/AgentAvatar/look.mjs +193 -0
  16. package/es/AgentAvatar/look.mjs.map +1 -0
  17. package/es/AgentAvatar/painter.mjs +114 -0
  18. package/es/AgentAvatar/painter.mjs.map +1 -0
  19. package/es/AgentAvatar/pickerStyle.mjs +68 -0
  20. package/es/AgentAvatar/pickerStyle.mjs.map +1 -0
  21. package/es/AgentAvatar/scene.mjs +91 -0
  22. package/es/AgentAvatar/scene.mjs.map +1 -0
  23. package/es/AgentAvatar/shapes.mjs +215 -180
  24. package/es/AgentAvatar/shapes.mjs.map +1 -1
  25. package/es/AgentAvatar/stable.mjs +11 -1
  26. package/es/AgentAvatar/stable.mjs.map +1 -1
  27. package/es/AgentAvatar/still.mjs +39 -0
  28. package/es/AgentAvatar/still.mjs.map +1 -0
  29. package/es/AgentAvatar/stills.generated.mjs +126 -0
  30. package/es/AgentAvatar/stills.generated.mjs.map +1 -0
  31. package/es/AgentAvatar/style.mjs +13 -146
  32. package/es/AgentAvatar/style.mjs.map +1 -1
  33. package/es/AgentAvatar/type.d.mts +64 -14
  34. package/es/AgentAvatar/useLiveAvatar.mjs +91 -0
  35. package/es/AgentAvatar/useLiveAvatar.mjs.map +1 -0
  36. package/es/AgentAvatar/utils.d.mts +2 -2
  37. package/es/AgentAvatar/utils.mjs +49 -45
  38. package/es/AgentAvatar/utils.mjs.map +1 -1
  39. package/es/AgentAvatar/value.d.mts +5 -0
  40. package/es/AgentAvatar/value.mjs +18 -0
  41. package/es/AgentAvatar/value.mjs.map +1 -0
  42. package/es/AutoComplete/style.d.mts +1 -1
  43. package/es/EditorSlashMenu/atoms.mjs +1 -2
  44. package/es/EditorSlashMenu/atoms.mjs.map +1 -1
  45. package/es/EmojiPicker/EmojiPicker.mjs +27 -19
  46. package/es/EmojiPicker/EmojiPicker.mjs.map +1 -1
  47. package/es/EmojiPicker/index.d.mts +2 -2
  48. package/es/EmojiPicker/type.d.mts +24 -1
  49. package/es/brand/Lobot/Lobot.d.mts +3 -0
  50. package/es/brand/Lobot/Lobot.mjs +74 -0
  51. package/es/brand/Lobot/Lobot.mjs.map +1 -0
  52. package/es/brand/Lobot/index.d.mts +3 -0
  53. package/es/brand/Lobot/stable.mjs +15 -0
  54. package/es/brand/Lobot/stable.mjs.map +1 -0
  55. package/es/brand/Lobot/type.d.mts +18 -0
  56. package/es/brand/LobotBrandLoading/LobotBrandLoading.d.mts +11 -0
  57. package/es/brand/LobotBrandLoading/LobotBrandLoading.mjs +130 -0
  58. package/es/brand/LobotBrandLoading/LobotBrandLoading.mjs.map +1 -0
  59. package/es/brand/LobotBrandLoading/index.d.mts +3 -0
  60. package/es/brand/LobotBrandLoading/stable.mjs +13 -0
  61. package/es/brand/LobotBrandLoading/stable.mjs.map +1 -0
  62. package/es/brand/LobotBrandLoading/style.mjs +111 -0
  63. package/es/brand/LobotBrandLoading/style.mjs.map +1 -0
  64. package/es/brand/LobotBrandLoading/type.d.mts +9 -0
  65. package/es/brand/LobotBrandLoading3d/LobotBrandLoading3d.d.mts +9 -0
  66. package/es/brand/LobotBrandLoading3d/LobotBrandLoading3d.mjs +87 -0
  67. package/es/brand/LobotBrandLoading3d/LobotBrandLoading3d.mjs.map +1 -0
  68. package/es/brand/LobotBrandLoading3d/choreography.mjs +120 -0
  69. package/es/brand/LobotBrandLoading3d/choreography.mjs.map +1 -0
  70. package/es/brand/LobotBrandLoading3d/index.d.mts +3 -0
  71. package/es/brand/LobotBrandLoading3d/live.mjs +72 -0
  72. package/es/brand/LobotBrandLoading3d/live.mjs.map +1 -0
  73. package/es/brand/LobotBrandLoading3d/stable.mjs +14 -0
  74. package/es/brand/LobotBrandLoading3d/stable.mjs.map +1 -0
  75. package/es/brand/LobotBrandLoading3d/style.mjs +38 -0
  76. package/es/brand/LobotBrandLoading3d/style.mjs.map +1 -0
  77. package/es/brand/LobotBrandLoading3d/type.d.mts +9 -0
  78. package/es/brand/LobotBrandLoading3d/useLiveLoading.mjs +58 -0
  79. package/es/brand/LobotBrandLoading3d/useLiveLoading.mjs.map +1 -0
  80. package/es/brand/LobotMono/LobotMono.d.mts +8 -0
  81. package/es/brand/LobotMono/LobotMono.mjs +46 -0
  82. package/es/brand/LobotMono/LobotMono.mjs.map +1 -0
  83. package/es/brand/LobotMono/index.d.mts +3 -0
  84. package/es/brand/LobotMono/stable.mjs +9 -0
  85. package/es/brand/LobotMono/stable.mjs.map +1 -0
  86. package/es/brand/LobotMono/type.d.mts +8 -0
  87. package/es/brand/LobotText/LobotText.d.mts +4 -0
  88. package/es/brand/LobotText/LobotText.mjs +20 -0
  89. package/es/brand/LobotText/LobotText.mjs.map +1 -0
  90. package/es/brand/LobotText/index.d.mts +3 -0
  91. package/es/brand/LobotText/stable.mjs +9 -0
  92. package/es/brand/LobotText/stable.mjs.map +1 -0
  93. package/es/brand/LobotText/type.d.mts +8 -0
  94. package/es/brand/index.d.mts +16 -1
  95. package/es/brand/index.mjs +6 -1
  96. package/es/chat/ChatItem/type.d.mts +2 -2
  97. package/es/css/AgentAvatar.css +686 -199
  98. package/es/css/brand/Lobot.css +27 -0
  99. package/es/css/brand/LobotBrandLoading.css +219 -0
  100. package/es/css/brand/LobotBrandLoading3d.css +61 -0
  101. package/es/css/brand/LobotMono.css +15 -0
  102. package/es/css/brand/LobotText.css +15 -0
  103. package/es/i18n/resources/en/agentAvatar.d.mts +39 -0
  104. package/es/i18n/resources/en/agentAvatar.mjs +42 -0
  105. package/es/i18n/resources/en/agentAvatar.mjs.map +1 -0
  106. package/es/i18n/resources/en/index.d.mts +19 -18
  107. package/es/i18n/resources/en/index.mjs +3 -1
  108. package/es/i18n/resources/en/index.mjs.map +1 -1
  109. package/es/i18n/resources/zhCn/agentAvatar.d.mts +39 -0
  110. package/es/i18n/resources/zhCn/agentAvatar.mjs +42 -0
  111. package/es/i18n/resources/zhCn/agentAvatar.mjs.map +1 -0
  112. package/es/i18n/resources/zhCn/index.d.mts +19 -18
  113. package/es/i18n/resources/zhCn/index.mjs +3 -1
  114. package/es/i18n/resources/zhCn/index.mjs.map +1 -1
  115. package/es/i18n/types.d.mts +18 -17
  116. package/es/index.d.mts +48 -45
  117. package/es/index.mjs +6 -3
  118. package/es/style.css +201 -242
  119. package/package.json +3 -1
@@ -1,236 +1,271 @@
1
1
  // src/AgentAvatar/shapes.ts
2
2
  const round = (value) => Math.round(value * 100) / 100;
3
- const polygon = (points) => `M${points.map(([x, y]) => `${round(x)} ${round(y)}`).join("L")}Z`;
4
- /** Closed curve sampled from a polar radius function around (cx, cy). */
5
- const polar = (radius, cx = 50, cy = 50, steps = 240) => polygon(Array.from({ length: steps }, (_, index) => {
6
- const angle = index / steps * Math.PI * 2;
7
- const r = radius(angle);
8
- return [cx + r * Math.cos(angle), cy + r * Math.sin(angle)];
9
- }));
10
- const superellipse = (cx, cy, a, b, n) => polygon(Array.from({ length: 120 }, (_, index) => {
11
- const angle = index / 120 * Math.PI * 2;
12
- const cos = Math.cos(angle);
13
- const sin = Math.sin(angle);
14
- return [cx + a * Math.sign(cos) * Math.abs(cos) ** (2 / n), cy + b * Math.sign(sin) * Math.abs(sin) ** (2 / n)];
15
- }));
16
- /** The LobeHub logo face: a ball cut flat at the top, with a slightly domed top edge. */
17
- const facePath = () => {
18
- const r = 44;
19
- const cx = 50;
20
- const cy = 40.5;
21
- const cut = 15.5;
22
- const fillet = .24;
23
- const inset = 9;
24
- const a0 = Math.asin(25 / r);
25
- const at = (angle) => [cx + r * Math.cos(angle), cy - r * Math.sin(angle)];
26
- const [rx, ry] = at(a0 - fillet);
27
- const [lx, ly] = at(Math.PI - a0 + fillet);
28
- const hx = Math.sqrt(1311);
29
- return `M${round(cx - hx + inset)} ${cut}Q${cx} 14 ${round(cx + hx - inset)} ${cut}Q${round(cx + hx)} ${cut} ${round(rx)} ${round(ry)}A${r} ${r} 0 1 1 ${round(lx)} ${round(ly)}Q${round(cx - hx)} ${cut} ${round(cx - hx + inset)} ${cut}Z`;
30
- };
31
- /** Flat top with rounded corners and a U-shaped superellipse bottom. */
32
- const bowlPath = () => {
33
- const n = 2.6;
34
- const points = [];
35
- for (let index = 1; index <= 40; index++) {
36
- const angle = index / 40 * Math.PI;
37
- const cos = Math.cos(angle);
38
- points.push(`${round(50 + 41 * Math.sign(cos) * Math.abs(cos) ** (2 / n))} ${round(52 + 42 * Math.sin(angle) ** (2 / n))}`);
39
- }
40
- return `M6 30Q6 14 22 14H78Q94 14 94 30L91 52L${points.join("L")}L6 30Z`;
41
- };
42
- /** Outline of the union of three circles, sampled by casting rays from the center. */
43
- const cloudPath = () => {
44
- const circles = [
45
- [
46
- 34,
47
- 54,
48
- 30
49
- ],
50
- [
51
- 66,
52
- 54,
53
- 30
54
- ],
55
- [
56
- 50,
57
- 34,
58
- 27
59
- ]
60
- ];
61
- const points = [];
62
- for (let index = 0; index < 180; index++) {
63
- const angle = index / 180 * Math.PI * 2 - Math.PI / 2;
64
- const dx = Math.cos(angle);
65
- const dy = Math.sin(angle);
66
- let far = 0;
67
- for (const [cx, cy, r] of circles) {
68
- const fx = 50 - cx;
69
- const fy = 50 - cy;
70
- const b = 2 * (fx * dx + fy * dy);
71
- const disc = b * b - 4 * (fx * fx + fy * fy - r * r);
72
- if (disc >= 0) far = Math.max(far, (-b + Math.sqrt(disc)) / 2);
73
- }
74
- points.push([50 + far * dx, 50 + far * dy]);
75
- }
76
- return polygon(points);
77
- };
78
- const hexPath = () => {
79
- const vertices = Array.from({ length: 6 }, (_, index) => {
80
- const angle = Math.PI / 6 + index * Math.PI / 3;
81
- return [50 + 44 * Math.cos(angle), 50 + 44 * Math.sin(angle)];
82
- });
83
- const lerp = (a, b, t) => [a[0] + (b[0] - a[0]) * t, a[1] + (b[1] - a[1]) * t];
3
+ /** Closed polygon with each corner rounded; `t` is the share of each edge the corner uses. */
4
+ const roundedPolygon = (vertices, t) => {
5
+ const lerp = (a, b, k) => [a[0] + (b[0] - a[0]) * k, a[1] + (b[1] - a[1]) * k];
84
6
  let d = "";
85
7
  for (const [index, corner] of vertices.entries()) {
86
- const start = lerp(corner, vertices[(index + 5) % 6], .22);
87
- const end = lerp(corner, vertices[(index + 1) % 6], .22);
8
+ const start = lerp(corner, vertices[(index + vertices.length - 1) % vertices.length], t);
9
+ const end = lerp(corner, vertices[(index + 1) % vertices.length], t);
88
10
  d += `${index === 0 ? "M" : "L"}${round(start[0])} ${round(start[1])}Q${round(corner[0])} ${round(corner[1])} ${round(end[0])} ${round(end[1])}`;
89
11
  }
90
12
  return `${d}Z`;
91
13
  };
92
- const ghostPath = () => {
93
- let d = "M14 42A36 36 0 0 1 86 42V84";
94
- for (let index = 0; index < 3; index++) d += `A12 9 0 0 1 ${86 - (index + 1) * 24} 84`;
95
- return `${d}Z`;
14
+ const hexPath = () => roundedPolygon(Array.from({ length: 6 }, (_, index) => {
15
+ const angle = -Math.PI / 2 + index * Math.PI / 3;
16
+ return [50 + 45 * Math.cos(angle), 50 + 45 * Math.sin(angle)];
17
+ }), .3);
18
+ const starPath = () => roundedPolygon(Array.from({ length: 10 }, (_, index) => {
19
+ const angle = -Math.PI / 2 + index * Math.PI / 5;
20
+ const radius = index % 2 === 0 ? 47 : 29.5;
21
+ return [50 + radius * Math.cos(angle), 53 + radius * Math.sin(angle)];
22
+ }), .28);
23
+ /** A clockwise ellipse as one closed subpath. */
24
+ const ellipse = (cx, cy, rx, ry, rotation = 0) => `M${round(cx - rx * Math.cos(rotation * Math.PI / 180))} ${round(cy - rx * Math.sin(rotation * Math.PI / 180))}A${rx} ${ry} ${rotation} 1 1 ${round(cx + rx * Math.cos(rotation * Math.PI / 180))} ${round(cy + rx * Math.sin(rotation * Math.PI / 180))}A${rx} ${ry} ${rotation} 1 1 ${round(cx - rx * Math.cos(rotation * Math.PI / 180))} ${round(cy - rx * Math.sin(rotation * Math.PI / 180))}Z`;
25
+ /** The logo's head outline in its own 446 × 469 coordinates. */
26
+ const LOGO_HEAD = "M125.436 127.784C137.593 75.2061 188.685 39.7239 243.897 47.3418C280.292 52.3634 309.891 74.9284 325.114 105.166C340.495 94.3117 359.563 89.0506 379.298 91.7734C421.81 97.6394 451.315 138.336 445.197 182.672C442.807 199.998 435.329 215.315 424.569 227.198C430.651 244.902 433.934 263.76 433.934 283.327C433.933 385.548 344.373 468.414 233.897 468.414C123.42 468.414 33.8606 385.548 33.8604 283.327C33.8604 277.825 34.1196 272.378 34.628 266.997C10.4918 250.502 -3.60641 220.437 0.802757 188.48C6.92004 144.145 46.3427 112.958 88.8555 118.824C100.518 120.433 111.202 124.663 120.439 130.871C122.087 129.819 123.753 128.791 125.436 127.784Z";
27
+ /** The logo fitted to the canvas. */
28
+ const LOGO_SCALE = 84 / 469;
29
+ const logoX = (value) => 50 + (value - 223) * LOGO_SCALE;
30
+ const logoY = (value) => 8 + value * LOGO_SCALE;
31
+ /** The logo's head on the canvas. Its path only uses absolute `M`, `C` and `Z`. */
32
+ const lobotPath = () => {
33
+ let isX = true;
34
+ return LOGO_HEAD.replaceAll(/-?\d+(?:\.\d+)?/g, (value) => {
35
+ const mapped = isX ? logoX(Number(value)) : logoY(Number(value));
36
+ isX = !isX;
37
+ return String(round(mapped));
38
+ });
96
39
  };
40
+ /** The two small dots floating above the logo's head. */
41
+ const lobotDots = () => [[
42
+ 96.5,
43
+ 79.73,
44
+ 18.51
45
+ ], [
46
+ 352.07,
47
+ 32.03,
48
+ 32.03
49
+ ]].map(([x, y, r]) => ellipse(round(logoX(x)), round(logoY(y)), round(r * LOGO_SCALE), round(r * LOGO_SCALE))).join("");
97
50
  const SHAPE_GEOMETRY = {
98
- bowl: {
99
- badge: [91, 9],
100
- d: bowlPath(),
51
+ bear: {
52
+ d: "M12 24C12 16 18 11 25 11C30 11 35 14 37 19C41 18 45 17 50 17C55 17 59 18 63 19C65 14 70 11 75 11C82 11 88 16 88 24C88 29 86 33 82 36C86 42 89 49 89 57C89 76 72 89 50 89C28 89 11 76 11 57C11 49 14 42 18 36C14 33 12 29 12 24Z",
101
53
  eyes: {
102
54
  gap: 34,
103
- r: 16,
104
- y: 46
105
- },
106
- thought: [70, 2]
55
+ x: 50,
56
+ y: 58
57
+ }
58
+ },
59
+ book: {
60
+ d: "M50 24C58 17 72 14 86 16C89 16 91 18 91 21V76C91 79 89 81 86 81C72 80 59 82 50 89C41 82 28 80 14 81C11 81 9 79 9 76V21C9 18 11 16 14 16C28 14 42 17 50 24Z",
61
+ eyes: {
62
+ gap: 37,
63
+ x: 50,
64
+ y: 50
65
+ }
66
+ },
67
+ bowl: {
68
+ d: "M16 26H84A8 8 0 0 1 92 34V36A8 8 0 0 1 86.8 43.5C85 63 74 78 63 83V87A4 4 0 0 1 59 91H41A4 4 0 0 1 37 87V83C26 78 15 63 13.2 43.5A8 8 0 0 1 8 36V34A8 8 0 0 1 16 26Z",
69
+ eyes: {
70
+ gap: 31,
71
+ x: 50,
72
+ y: 50
73
+ }
74
+ },
75
+ bulb: {
76
+ d: "M50 9C69 9 84 24 84 43C84 55 78 63 71 69C67 72 65 75 65 78V83C65 87 61 90 57 90H43C39 90 35 87 35 83V78C35 75 33 72 29 69C22 63 16 55 16 43C16 24 31 9 50 9Z",
77
+ eyes: {
78
+ gap: 29,
79
+ x: 50,
80
+ y: 42
81
+ }
107
82
  },
108
83
  capsule: {
109
- badge: [88, 14],
110
- d: "M36 20H64A30 30 0 0 1 64 80H36A30 30 0 0 1 36 20Z",
84
+ d: "M36 22H64A28 28 0 0 1 64 78H36A28 28 0 0 1 36 22Z",
111
85
  eyes: {
112
- gap: 34,
113
- r: 16,
114
- y: 49
115
- },
116
- thought: [70, 2]
86
+ gap: 38,
87
+ x: 50,
88
+ y: 52
89
+ }
117
90
  },
118
91
  cat: {
119
- badge: [91, 91],
120
- d: "M12 57A38 38 0 1 1 88 57A38 38 0 1 1 12 57ZM19 40L17 12Q17 6 22.5 8.5L44 21ZM56 21L77.5 8.5Q83 6 83 12L81 40Z",
92
+ d: "M14 16C14 10 19 9 23 12L39 25C43 24 46 24 50 24C54 24 57 24 61 25L77 12C81 9 86 10 86 16L87 44C89 49 90 54 90 59C90 77 72 89 50 89C28 89 10 77 10 59C10 54 11 49 13 44Z",
121
93
  eyes: {
122
- gap: 30,
123
- r: 14,
124
- y: 56
125
- },
126
- thought: [48, 0],
127
- thoughtFlip: true,
128
- thoughtHalo: false
94
+ gap: 36,
95
+ x: 50,
96
+ y: 60
97
+ }
98
+ },
99
+ chat: {
100
+ d: "M26 15H74C84 15 91 22 91 32V56C91 66 84 73 74 73H46L30 87C27 89 24 88 25 84L28 73H26C16 73 9 66 9 56V32C9 22 16 15 26 15Z",
101
+ eyes: {
102
+ gap: 37,
103
+ x: 50,
104
+ y: 44
105
+ }
129
106
  },
130
107
  cloud: {
131
- badge: [88, 14],
132
- d: cloudPath(),
108
+ d: "M27 80C15 80 8 71 8 61C8 51 15 44 24 43C25 30 36 20 50 20C60 20 69 26 73 35C84 35 92 45 92 57C92 70 83 80 71 80Z",
133
109
  eyes: {
134
- gap: 34,
135
- r: 16,
136
- y: 52
137
- },
138
- thought: [70, 2]
110
+ gap: 31,
111
+ x: 52,
112
+ y: 60
113
+ }
139
114
  },
140
115
  cookie: {
141
- badge: [89, 9],
142
- d: polar((angle) => 39.5 + 4.5 * Math.abs(Math.cos(5 * angle)) ** .55, 50, 50, 400),
116
+ d: "M47 10C50 10 53 10 56 11C55 17 59 22 65 22C65 28 70 33 76 32C77 37 82 40 89 39C90 43 90 47 90 50C90 72 72 90 50 90C28 90 10 72 10 50C10 28 25 10 47 10Z",
143
117
  eyes: {
144
- gap: 31,
145
- r: 14.5,
146
- y: 48
147
- },
148
- thought: [70, 2]
118
+ gap: 34,
119
+ x: 49,
120
+ y: 56
121
+ }
149
122
  },
150
123
  face: {
151
- badge: [91, 9],
152
- d: facePath(),
124
+ d: "M50 12C73 12 90 29 90 51C90 73 73 89 50 89C27 89 10 73 10 51C10 29 27 12 50 12Z",
125
+ eyes: {
126
+ gap: 36,
127
+ x: 50,
128
+ y: 52
129
+ }
130
+ },
131
+ frog: {
132
+ d: "M10 62C10 52 14 44 20 38C18 26 26 16 36 16C42 16 47 19 50 24C53 19 58 16 64 16C74 16 82 26 80 38C86 44 90 52 90 62C90 78 72 88 50 88C28 88 10 78 10 62Z",
153
133
  eyes: {
154
134
  gap: 34,
155
- r: 16,
156
- y: 42
157
- },
158
- thought: [70, 2]
135
+ x: 50,
136
+ y: 58
137
+ }
159
138
  },
160
139
  ghost: {
161
- badge: [91, 9],
162
- d: ghostPath(),
140
+ d: "M50 9C70 9 86 25 86 45V82C86 88 80 91 75 87C72 84 68 83 65 86C61 90 56 91 53 88C51 86 49 86 47 88C44 91 39 90 35 86C32 83 28 84 25 87C20 91 14 88 14 82V45C14 25 30 9 50 9Z",
163
141
  eyes: {
164
- gap: 29,
165
- r: 13.5,
142
+ gap: 31,
143
+ x: 50,
166
144
  y: 46
167
- },
168
- thought: [70, 2]
145
+ }
169
146
  },
170
147
  hex: {
171
- badge: [89, 13],
172
148
  d: hexPath(),
149
+ eyes: {
150
+ gap: 35,
151
+ x: 50,
152
+ y: 52
153
+ }
154
+ },
155
+ lobot: {
156
+ d: lobotPath(),
157
+ extra: lobotDots(),
173
158
  eyes: {
174
159
  gap: 27,
175
- r: 12.5,
176
- y: 47
177
- },
178
- thought: [70, 2]
160
+ x: 54,
161
+ y: 58
162
+ }
163
+ },
164
+ magnifier: {
165
+ d: "M45 8C64 8 80 24 80 43C80 50 78 56 74.5 61.5L88 75C92 79 92 84.5 88.5 88C85 91.5 79.5 92 75.5 88L62 74.5C57 77 51 78 45 78C26 78 10 62 10 43C10 24 26 8 45 8Z",
166
+ eyes: {
167
+ gap: 30,
168
+ x: 45,
169
+ y: 43
170
+ }
171
+ },
172
+ mug: {
173
+ d: "M18 18H68C72 18 75 21 75 25V36H77C86 36 92 43 92 52C92 62 86 68 77 68H75V72C75 82 67 90 57 90H28C18 90 10 82 10 72V26C10 21 13 18 18 18ZM75 45V59H77C81 59 84 56 84 52C84 48 81 45 77 45Z",
174
+ eyes: {
175
+ gap: 27,
176
+ x: 42,
177
+ y: 52
178
+ }
179
179
  },
180
180
  pudding: {
181
- badge: [91, 9],
182
- d: "M30 14H70Q79 14 81 23Q87 50 93 80Q95 92 83 92H17Q5 92 7 80Q13 50 19 23Q21 14 30 14Z",
181
+ d: "M32 15H68C76 15 81 20 82 28L86 65C91 66 92 71 92 75C92 81 88 85 82 85H18C12 85 8 81 8 75C8 71 9 66 14 65L18 28C19 20 24 15 32 15Z",
183
182
  eyes: {
184
183
  gap: 29,
185
- r: 13.5,
186
- y: 52
187
- },
188
- thought: [70, 2]
184
+ x: 50,
185
+ y: 48
186
+ }
189
187
  },
190
- shield: {
191
- badge: [91, 9],
192
- d: "M18 18Q18 8 28 8H72Q82 8 82 18L88 48Q90 72 50 94Q10 72 12 48Z",
188
+ robot: {
189
+ d: "M50 9A7 7 0 0 1 53 22.3V30H74C82 30 87 35 87 43V50H89A3 3 0 0 1 92 53V67A3 3 0 0 1 89 70H87V76C87 84 82 89 74 89H26C18 89 13 84 13 76V70H11A3 3 0 0 1 8 67V53A3 3 0 0 1 11 50H13V43C13 35 18 30 26 30H47V22.3A7 7 0 0 1 50 9Z",
190
+ eyes: {
191
+ gap: 36,
192
+ x: 50,
193
+ y: 61
194
+ }
195
+ },
196
+ rocket: {
197
+ d: "M50 8C54 8 58 10 62 14C74 25 81 39 81 54C81 58 80.5 61 80 64L88 73C91 76 92 79 92 83V85C92 88 89 90 86 88L76 81C74 83 71 84 68 84H63C62 88 57 92 50 92C43 92 38 88 37 84H32C29 84 26 83 24 81L14 88C11 90 8 88 8 85V83C8 79 9 76 12 73L20 64C19.5 61 19 58 19 54C19 39 26 25 38 14C42 10 46 8 50 8Z",
193
198
  eyes: {
194
199
  gap: 26,
195
- r: 12,
200
+ x: 50,
201
+ y: 53
202
+ }
203
+ },
204
+ shield: {
205
+ d: "M50 9C60 15 72 18 86 18C88 18 88 20 88 22V45C88 66 72 82 50 92C28 82 12 66 12 45V22C12 20 12 18 14 18C28 18 40 15 50 9Z",
206
+ eyes: {
207
+ gap: 34,
208
+ x: 50,
196
209
  y: 42
197
- },
198
- thought: [70, 2]
210
+ }
211
+ },
212
+ sprout: {
213
+ d: "M18 42H38C28 38 20 30 17 21C16 17 19 15 22 16C34 18 44 26 49 37C53 25 63 15 77 12C81 11 84 14 83 18C80 29 72 38 62 42H82C87 42 89 46 88 50L81 83C80 88 76 91 71 91H29C24 91 20 88 19 83L12 50C11 46 13 42 18 42Z",
214
+ eyes: {
215
+ gap: 30,
216
+ x: 50,
217
+ y: 65
218
+ }
199
219
  },
200
220
  star: {
201
- badge: [88, 14],
202
- d: polar((angle) => 45 * (.76 + .24 * Math.abs(Math.cos(2 * angle)) ** 2.2)),
221
+ d: starPath(),
203
222
  eyes: {
204
- gap: 27,
205
- r: 12.5,
206
- y: 49
207
- },
208
- thought: [70, 2]
223
+ gap: 29,
224
+ x: 50,
225
+ y: 50
226
+ }
227
+ },
228
+ bunny: {
229
+ d: "M27 12C29 8 34 8 37 12C42 19 44 30 44 40C46 40 48 39.5 50 39.5C52 39.5 54 40 56 40C56 30 58 19 63 12C66 8 71 8 73 12C77 20 76 34 72 45C81 50 88 58 88 67C88 81 71 90 50 90C29 90 12 81 12 67C12 58 19 50 28 45C24 34 23 20 27 12Z",
230
+ eyes: {
231
+ gap: 31,
232
+ x: 50,
233
+ y: 68
234
+ }
209
235
  },
210
236
  tile: {
211
- badge: [91, 9],
212
- d: superellipse(50, 50, 42, 42, 5),
237
+ d: "M30 11H70C83 11 89 17 89 30V70C89 83 83 89 70 89H30C17 89 11 83 11 70V30C11 17 17 11 30 11Z",
213
238
  eyes: {
214
- gap: 33,
215
- r: 15.5,
216
- y: 46
217
- },
218
- thought: [70, 2]
239
+ gap: 35,
240
+ x: 50,
241
+ y: 50
242
+ }
219
243
  }
220
244
  };
221
- /** Share of the sclera bottom shaved off by the cheek, as in the logo. */
222
- const CHEEK = .74;
223
- /** Eye white: a circle whose bottom is cut by a shallow arc. */
224
- const scleraPath = (x, y, r) => {
225
- const cut = y + r * CHEEK;
226
- const half = Math.sqrt(r * r - (r * CHEEK) ** 2);
227
- return `M${round(x - half)} ${round(cut)}A${r} ${r} 0 1 1 ${round(x + half)} ${round(cut)}Q${round(x)} ${round(cut - r * .2)} ${round(x - half)} ${round(cut)}Z`;
228
- };
229
- /** Closed "smiling" eye arc used by the `done` state. */
230
- const happyEyePath = (x, y, r) => {
231
- const k = r / 14.5;
232
- return `M${round(x - 9.5 * k)} ${round(y + 4 * k)}Q${round(x)} ${round(y - 10 * k)} ${round(x + 9.5 * k)} ${round(y + 4 * k)}`;
245
+ /** Size of the engine's eye placeholder: it only anchors the eye plane, the logo eyes are ours. */
246
+ const ENGINE_EYE_SCALE = 1.4;
247
+ const definitions = /* @__PURE__ */ new Map();
248
+ /** The engine definition of a shape. One object per shape, so its volume is built only once. */
249
+ const getShapeDefinition = (shape) => {
250
+ let definition = definitions.get(shape);
251
+ if (!definition) {
252
+ const { d, eyes } = SHAPE_GEOMETRY[shape];
253
+ definition = {
254
+ body: { path: d },
255
+ eyes: {
256
+ scale: ENGINE_EYE_SCALE,
257
+ spacing: eyes.gap,
258
+ x: eyes.x,
259
+ y: eyes.y
260
+ },
261
+ id: shape,
262
+ name: shape,
263
+ version: 1
264
+ };
265
+ definitions.set(shape, definition);
266
+ }
267
+ return definition;
233
268
  };
234
- export { SHAPE_GEOMETRY, happyEyePath, scleraPath };
269
+ export { SHAPE_GEOMETRY, getShapeDefinition };
235
270
 
236
271
  //# sourceMappingURL=shapes.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"shapes.mjs","names":[],"sources":["../../src/AgentAvatar/shapes.ts"],"sourcesContent":["/**\n * Silhouette and eye geometry on a 100 × 100 canvas. Every silhouette fits the 6–94 box and\n * shares the same construction: a flat body plus the big logo eyes, no mouth, no backing plate.\n */\nimport type { AgentAvatarShape } from './type';\n\ntype Point = [number, number];\n\nconst round = (value: number) => Math.round(value * 100) / 100;\n\nconst polygon = (points: Point[]) =>\n `M${points.map(([x, y]) => `${round(x)} ${round(y)}`).join('L')}Z`;\n\n/** Closed curve sampled from a polar radius function around (cx, cy). */\nconst polar = (radius: (angle: number) => number, cx = 50, cy = 50, steps = 240) =>\n polygon(\n Array.from({ length: steps }, (_, index) => {\n const angle = (index / steps) * Math.PI * 2;\n const r = radius(angle);\n return [cx + r * Math.cos(angle), cy + r * Math.sin(angle)];\n }),\n );\n\nconst superellipse = (cx: number, cy: number, a: number, b: number, n: number) =>\n polygon(\n Array.from({ length: 120 }, (_, index) => {\n const angle = (index / 120) * Math.PI * 2;\n const cos = Math.cos(angle);\n const sin = Math.sin(angle);\n return [\n cx + a * Math.sign(cos) * Math.abs(cos) ** (2 / n),\n cy + b * Math.sign(sin) * Math.abs(sin) ** (2 / n),\n ];\n }),\n );\n\n/** The LobeHub logo face: a ball cut flat at the top, with a slightly domed top edge. */\nconst facePath = () => {\n const r = 44;\n const cx = 50;\n const cy = 40.5;\n const cut = 15.5;\n const fillet = 0.24;\n const inset = 9;\n const a0 = Math.asin((cy - cut) / r);\n const at = (angle: number): Point => [cx + r * Math.cos(angle), cy - r * Math.sin(angle)];\n const [rx, ry] = at(a0 - fillet);\n const [lx, ly] = at(Math.PI - a0 + fillet);\n const hx = Math.sqrt(r * r - (cy - cut) ** 2);\n return `M${round(cx - hx + inset)} ${cut}Q${cx} ${cut - 1.5} ${round(cx + hx - inset)} ${cut}Q${round(cx + hx)} ${cut} ${round(rx)} ${round(ry)}A${r} ${r} 0 1 1 ${round(lx)} ${round(ly)}Q${round(cx - hx)} ${cut} ${round(cx - hx + inset)} ${cut}Z`;\n};\n\n/** Flat top with rounded corners and a U-shaped superellipse bottom. */\nconst bowlPath = () => {\n const n = 2.6;\n const points: string[] = [];\n for (let index = 1; index <= 40; index++) {\n const angle = (index / 40) * Math.PI;\n const cos = Math.cos(angle);\n points.push(\n `${round(50 + 41 * Math.sign(cos) * Math.abs(cos) ** (2 / n))} ${round(52 + 42 * Math.sin(angle) ** (2 / n))}`,\n );\n }\n return `M6 30Q6 14 22 14H78Q94 14 94 30L91 52L${points.join('L')}L6 30Z`;\n};\n\n/** Outline of the union of three circles, sampled by casting rays from the center. */\nconst cloudPath = () => {\n const circles: [number, number, number][] = [\n [34, 54, 30],\n [66, 54, 30],\n [50, 34, 27],\n ];\n const points: Point[] = [];\n for (let index = 0; index < 180; index++) {\n const angle = (index / 180) * Math.PI * 2 - Math.PI / 2;\n const dx = Math.cos(angle);\n const dy = Math.sin(angle);\n let far = 0;\n for (const [cx, cy, r] of circles) {\n const fx = 50 - cx;\n const fy = 50 - cy;\n const b = 2 * (fx * dx + fy * dy);\n const disc = b * b - 4 * (fx * fx + fy * fy - r * r);\n if (disc >= 0) far = Math.max(far, (-b + Math.sqrt(disc)) / 2);\n }\n points.push([50 + far * dx, 50 + far * dy]);\n }\n return polygon(points);\n};\n\nconst hexPath = () => {\n const vertices = Array.from({ length: 6 }, (_, index): Point => {\n const angle = Math.PI / 6 + (index * Math.PI) / 3;\n return [50 + 44 * Math.cos(angle), 50 + 44 * Math.sin(angle)];\n });\n const lerp = (a: Point, b: Point, t: number): Point => [\n a[0] + (b[0] - a[0]) * t,\n a[1] + (b[1] - a[1]) * t,\n ];\n let d = '';\n for (const [index, corner] of vertices.entries()) {\n const start = lerp(corner, vertices[(index + 5) % 6], 0.22);\n const end = lerp(corner, vertices[(index + 1) % 6], 0.22);\n d += `${index === 0 ? 'M' : 'L'}${round(start[0])} ${round(start[1])}Q${round(corner[0])} ${round(corner[1])} ${round(end[0])} ${round(end[1])}`;\n }\n return `${d}Z`;\n};\n\nconst ghostPath = () => {\n let d = 'M14 42A36 36 0 0 1 86 42V84';\n for (let index = 0; index < 3; index++) d += `A12 9 0 0 1 ${86 - (index + 1) * 24} 84`;\n return `${d}Z`;\n};\n\nexport interface AgentAvatarShapeGeometry {\n /**\n * Centre of the `blocked` badge. The badge does not tilt; the position is picked per shape so\n * it never covers a feature (cat ears, star points) at any seeded tilt and stays inside the\n * 100×100 canvas. On shapes that fill their corners the background ring may cut into a plain\n * edge.\n */\n badge: Point;\n /** Silhouette path. */\n d: string;\n /** Eyes: center height, sclera radius and the distance between the two eye centers. */\n eyes: { gap: number; r: number; y: number };\n /** Anchor of the `thinking` thought bubbles (center of the largest bubble, minus its drop). */\n thought: Point;\n /** Rise towards the top-left instead of the top-right. */\n thoughtFlip?: boolean;\n /**\n * Outline the bubbles with the background color where they cross the silhouette.\n * @default true\n */\n thoughtHalo?: boolean;\n}\n\nexport const SHAPE_GEOMETRY: Record<AgentAvatarShape, AgentAvatarShapeGeometry> = {\n bowl: { badge: [91, 9], d: bowlPath(), eyes: { gap: 34, r: 16, y: 46 }, thought: [70, 2] },\n capsule: {\n badge: [88, 14],\n d: 'M36 20H64A30 30 0 0 1 64 80H36A30 30 0 0 1 36 20Z',\n eyes: { gap: 34, r: 16, y: 49 },\n thought: [70, 2],\n },\n cat: {\n badge: [91, 91],\n d: 'M12 57A38 38 0 1 1 88 57A38 38 0 1 1 12 57ZM19 40L17 12Q17 6 22.5 8.5L44 21ZM56 21L77.5 8.5Q83 6 83 12L81 40Z',\n eyes: { gap: 30, r: 14, y: 56 },\n thought: [48, 0],\n thoughtFlip: true,\n thoughtHalo: false,\n },\n cloud: { badge: [88, 14], d: cloudPath(), eyes: { gap: 34, r: 16, y: 52 }, thought: [70, 2] },\n cookie: {\n badge: [89, 9],\n d: polar((angle) => 39.5 + 4.5 * Math.abs(Math.cos(5 * angle)) ** 0.55, 50, 50, 400),\n eyes: { gap: 31, r: 14.5, y: 48 },\n thought: [70, 2],\n },\n face: { badge: [91, 9], d: facePath(), eyes: { gap: 34, r: 16, y: 42 }, thought: [70, 2] },\n ghost: { badge: [91, 9], d: ghostPath(), eyes: { gap: 29, r: 13.5, y: 46 }, thought: [70, 2] },\n hex: { badge: [89, 13], d: hexPath(), eyes: { gap: 27, r: 12.5, y: 47 }, thought: [70, 2] },\n pudding: {\n badge: [91, 9],\n d: 'M30 14H70Q79 14 81 23Q87 50 93 80Q95 92 83 92H17Q5 92 7 80Q13 50 19 23Q21 14 30 14Z',\n eyes: { gap: 29, r: 13.5, y: 52 },\n thought: [70, 2],\n },\n shield: {\n badge: [91, 9],\n d: 'M18 18Q18 8 28 8H72Q82 8 82 18L88 48Q90 72 50 94Q10 72 12 48Z',\n eyes: { gap: 26, r: 12, y: 42 },\n thought: [70, 2],\n },\n star: {\n badge: [88, 14],\n d: polar((angle) => 45 * (0.76 + 0.24 * Math.abs(Math.cos(2 * angle)) ** 2.2)),\n eyes: { gap: 27, r: 12.5, y: 49 },\n thought: [70, 2],\n },\n tile: {\n badge: [91, 9],\n d: superellipse(50, 50, 42, 42, 5),\n eyes: { gap: 33, r: 15.5, y: 46 },\n thought: [70, 2],\n },\n};\n\n/** Share of the sclera bottom shaved off by the cheek, as in the logo. */\nconst CHEEK = 0.74;\n\n/** Eye white: a circle whose bottom is cut by a shallow arc. */\nexport const scleraPath = (x: number, y: number, r: number) => {\n const cut = y + r * CHEEK;\n const half = Math.sqrt(r * r - (r * CHEEK) ** 2);\n return `M${round(x - half)} ${round(cut)}A${r} ${r} 0 1 1 ${round(x + half)} ${round(cut)}Q${round(x)} ${round(cut - r * 0.2)} ${round(x - half)} ${round(cut)}Z`;\n};\n\n/** Closed \"smiling\" eye arc used by the `done` state. */\nexport const happyEyePath = (x: number, y: number, r: number) => {\n const k = r / 14.5;\n return `M${round(x - 9.5 * k)} ${round(y + 4 * k)}Q${round(x)} ${round(y - 10 * k)} ${round(x + 9.5 * k)} ${round(y + 4 * k)}`;\n};\n"],"mappings":";AAQA,MAAM,SAAS,UAAkB,KAAK,MAAM,QAAQ,GAAG,IAAI;AAE3D,MAAM,WAAW,WACf,IAAI,OAAO,KAAK,CAAC,GAAG,OAAO,GAAG,MAAM,CAAC,EAAE,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,GAAG,EAAE;;AAGlE,MAAM,SAAS,QAAmC,KAAK,IAAI,KAAK,IAAI,QAAQ,QAC1E,QACE,MAAM,KAAK,EAAE,QAAQ,MAAM,IAAI,GAAG,UAAU;CAC1C,MAAM,QAAS,QAAQ,QAAS,KAAK,KAAK;CAC1C,MAAM,IAAI,OAAO,KAAK;CACtB,OAAO,CAAC,KAAK,IAAI,KAAK,IAAI,KAAK,GAAG,KAAK,IAAI,KAAK,IAAI,KAAK,CAAC;AAC5D,CAAC,CACH;AAEF,MAAM,gBAAgB,IAAY,IAAY,GAAW,GAAW,MAClE,QACE,MAAM,KAAK,EAAE,QAAQ,IAAI,IAAI,GAAG,UAAU;CACxC,MAAM,QAAS,QAAQ,MAAO,KAAK,KAAK;CACxC,MAAM,MAAM,KAAK,IAAI,KAAK;CAC1B,MAAM,MAAM,KAAK,IAAI,KAAK;CAC1B,OAAO,CACL,KAAK,IAAI,KAAK,KAAK,GAAG,IAAI,KAAK,IAAI,GAAG,MAAM,IAAI,IAChD,KAAK,IAAI,KAAK,KAAK,GAAG,IAAI,KAAK,IAAI,GAAG,MAAM,IAAI,EAClD;AACF,CAAC,CACH;;AAGF,MAAM,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CAAC,IAAI,CAAC;CACjB;AACF;;AAGA,MAAM,QAAQ;;AAGd,MAAa,cAAc,GAAW,GAAW,MAAc;CAC7D,MAAM,MAAM,IAAI,IAAI;CACpB,MAAM,OAAO,KAAK,KAAK,IAAI,KAAK,IAAI,UAAU,CAAC;CAC/C,OAAO,IAAI,MAAM,IAAI,IAAI,EAAE,GAAG,MAAM,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,SAAS,MAAM,IAAI,IAAI,EAAE,GAAG,MAAM,GAAG,EAAE,GAAG,MAAM,CAAC,EAAE,GAAG,MAAM,MAAM,IAAI,EAAG,EAAE,GAAG,MAAM,IAAI,IAAI,EAAE,GAAG,MAAM,GAAG,EAAE;AACjK;;AAGA,MAAa,gBAAgB,GAAW,GAAW,MAAc;CAC/D,MAAM,IAAI,IAAI;CACd,OAAO,IAAI,MAAM,IAAI,MAAM,CAAC,EAAE,GAAG,MAAM,IAAI,IAAI,CAAC,EAAE,GAAG,MAAM,CAAC,EAAE,GAAG,MAAM,IAAI,KAAK,CAAC,EAAE,GAAG,MAAM,IAAI,MAAM,CAAC,EAAE,GAAG,MAAM,IAAI,IAAI,CAAC;AAC7H"}
1
+ {"version":3,"file":"shapes.mjs","names":[],"sources":["../../src/AgentAvatar/shapes.ts"],"sourcesContent":["/**\n * Silhouettes on a 100 × 100 canvas, kept inside the 8–92 box the volume engine requires. Each one\n * is a recognizable object or creature with one dominant mass that carries the big logo eyes.\n * Outlines wind clockwise and holes counter-clockwise, so the nonzero fill rule cuts the holes.\n */\nimport type { AvatarDefinition } from 'open-bot-avatar';\n\nimport type { AgentAvatarShape } from './type';\n\ntype Point = [number, number];\n\nconst round = (value: number) => Math.round(value * 100) / 100;\n\n/** Closed polygon with each corner rounded; `t` is the share of each edge the corner uses. */\nconst roundedPolygon = (vertices: Point[], t: number) => {\n const lerp = (a: Point, b: Point, k: number): Point => [\n a[0] + (b[0] - a[0]) * k,\n a[1] + (b[1] - a[1]) * k,\n ];\n let d = '';\n for (const [index, corner] of vertices.entries()) {\n const start = lerp(corner, vertices[(index + vertices.length - 1) % vertices.length], t);\n const end = lerp(corner, vertices[(index + 1) % vertices.length], t);\n d += `${index === 0 ? 'M' : 'L'}${round(start[0])} ${round(start[1])}Q${round(corner[0])} ${round(corner[1])} ${round(end[0])} ${round(end[1])}`;\n }\n return `${d}Z`;\n};\n\nconst hexPath = () =>\n roundedPolygon(\n Array.from({ length: 6 }, (_, index): Point => {\n const angle = -Math.PI / 2 + (index * Math.PI) / 3;\n return [50 + 45 * Math.cos(angle), 50 + 45 * Math.sin(angle)];\n }),\n 0.3,\n );\n\nconst starPath = () =>\n roundedPolygon(\n Array.from({ length: 10 }, (_, index): Point => {\n const angle = -Math.PI / 2 + (index * Math.PI) / 5;\n const radius = index % 2 === 0 ? 47 : 29.5;\n return [50 + radius * Math.cos(angle), 53 + radius * Math.sin(angle)];\n }),\n 0.28,\n );\n\n/** A clockwise ellipse as one closed subpath. */\nconst ellipse = (cx: number, cy: number, rx: number, ry: number, rotation = 0) =>\n `M${round(cx - rx * Math.cos((rotation * Math.PI) / 180))} ${round(cy - rx * Math.sin((rotation * Math.PI) / 180))}A${rx} ${ry} ${rotation} 1 1 ${round(cx + rx * Math.cos((rotation * Math.PI) / 180))} ${round(cy + rx * Math.sin((rotation * Math.PI) / 180))}A${rx} ${ry} ${rotation} 1 1 ${round(cx - rx * Math.cos((rotation * Math.PI) / 180))} ${round(cy - rx * Math.sin((rotation * Math.PI) / 180))}Z`;\n\n/** The logo's head outline in its own 446 × 469 coordinates. */\nconst LOGO_HEAD =\n 'M125.436 127.784C137.593 75.2061 188.685 39.7239 243.897 47.3418C280.292 52.3634 309.891 74.9284 325.114 105.166C340.495 94.3117 359.563 89.0506 379.298 91.7734C421.81 97.6394 451.315 138.336 445.197 182.672C442.807 199.998 435.329 215.315 424.569 227.198C430.651 244.902 433.934 263.76 433.934 283.327C433.933 385.548 344.373 468.414 233.897 468.414C123.42 468.414 33.8606 385.548 33.8604 283.327C33.8604 277.825 34.1196 272.378 34.628 266.997C10.4918 250.502 -3.60641 220.437 0.802757 188.48C6.92004 144.145 46.3427 112.958 88.8555 118.824C100.518 120.433 111.202 124.663 120.439 130.871C122.087 129.819 123.753 128.791 125.436 127.784Z';\n\n/** The logo fitted to the canvas. */\nconst LOGO_SCALE = 84 / 469;\nconst logoX = (value: number) => 50 + (value - 223) * LOGO_SCALE;\nconst logoY = (value: number) => 8 + value * LOGO_SCALE;\n\n/** The logo's head on the canvas. Its path only uses absolute `M`, `C` and `Z`. */\nconst lobotPath = () => {\n let isX = true;\n return LOGO_HEAD.replaceAll(/-?\\d+(?:\\.\\d+)?/g, (value) => {\n const mapped = isX ? logoX(Number(value)) : logoY(Number(value));\n isX = !isX;\n return String(round(mapped));\n });\n};\n\n/** The two small dots floating above the logo's head. */\nconst lobotDots = () =>\n [\n [96.5, 79.73, 18.51],\n [352.07, 32.03, 32.03],\n ]\n .map(([x, y, r]) =>\n ellipse(round(logoX(x)), round(logoY(y)), round(r * LOGO_SCALE), round(r * LOGO_SCALE)),\n )\n .join('');\n\nexport interface AgentAvatarShapeGeometry {\n /**\n * Silhouette path. One outline (plus holes): the engine inflates a single outline into a soft\n * pillow, while separate parts turn like cylinders and carry large flat eyes off their edge.\n */\n d: string;\n /** Small detached details that float with the face plane, outside the volume. */\n extra?: string;\n /** Eyes: center of the pair and the distance between the two eye centers. */\n eyes: { gap: number; x: number; y: number };\n}\n\nexport const SHAPE_GEOMETRY: Record<AgentAvatarShape, AgentAvatarShapeGeometry> = {\n bear: {\n d: 'M12 24C12 16 18 11 25 11C30 11 35 14 37 19C41 18 45 17 50 17C55 17 59 18 63 19C65 14 70 11 75 11C82 11 88 16 88 24C88 29 86 33 82 36C86 42 89 49 89 57C89 76 72 89 50 89C28 89 11 76 11 57C11 49 14 42 18 36C14 33 12 29 12 24Z',\n eyes: { gap: 34, x: 50, y: 58 },\n },\n book: {\n d: 'M50 24C58 17 72 14 86 16C89 16 91 18 91 21V76C91 79 89 81 86 81C72 80 59 82 50 89C41 82 28 80 14 81C11 81 9 79 9 76V21C9 18 11 16 14 16C28 14 42 17 50 24Z',\n eyes: { gap: 37, x: 50, y: 50 },\n },\n bowl: {\n d: 'M16 26H84A8 8 0 0 1 92 34V36A8 8 0 0 1 86.8 43.5C85 63 74 78 63 83V87A4 4 0 0 1 59 91H41A4 4 0 0 1 37 87V83C26 78 15 63 13.2 43.5A8 8 0 0 1 8 36V34A8 8 0 0 1 16 26Z',\n eyes: { gap: 31, x: 50, y: 50 },\n },\n bulb: {\n d: 'M50 9C69 9 84 24 84 43C84 55 78 63 71 69C67 72 65 75 65 78V83C65 87 61 90 57 90H43C39 90 35 87 35 83V78C35 75 33 72 29 69C22 63 16 55 16 43C16 24 31 9 50 9Z',\n eyes: { gap: 29, x: 50, y: 42 },\n },\n capsule: {\n d: 'M36 22H64A28 28 0 0 1 64 78H36A28 28 0 0 1 36 22Z',\n eyes: { gap: 38, x: 50, y: 52 },\n },\n cat: {\n d: 'M14 16C14 10 19 9 23 12L39 25C43 24 46 24 50 24C54 24 57 24 61 25L77 12C81 9 86 10 86 16L87 44C89 49 90 54 90 59C90 77 72 89 50 89C28 89 10 77 10 59C10 54 11 49 13 44Z',\n eyes: { gap: 36, x: 50, y: 60 },\n },\n chat: {\n d: 'M26 15H74C84 15 91 22 91 32V56C91 66 84 73 74 73H46L30 87C27 89 24 88 25 84L28 73H26C16 73 9 66 9 56V32C9 22 16 15 26 15Z',\n eyes: { gap: 37, x: 50, y: 44 },\n },\n cloud: {\n d: 'M27 80C15 80 8 71 8 61C8 51 15 44 24 43C25 30 36 20 50 20C60 20 69 26 73 35C84 35 92 45 92 57C92 70 83 80 71 80Z',\n eyes: { gap: 31, x: 52, y: 60 },\n },\n cookie: {\n d: 'M47 10C50 10 53 10 56 11C55 17 59 22 65 22C65 28 70 33 76 32C77 37 82 40 89 39C90 43 90 47 90 50C90 72 72 90 50 90C28 90 10 72 10 50C10 28 25 10 47 10Z',\n eyes: { gap: 34, x: 49, y: 56 },\n },\n face: {\n d: 'M50 12C73 12 90 29 90 51C90 73 73 89 50 89C27 89 10 73 10 51C10 29 27 12 50 12Z',\n eyes: { gap: 36, x: 50, y: 52 },\n },\n frog: {\n d: 'M10 62C10 52 14 44 20 38C18 26 26 16 36 16C42 16 47 19 50 24C53 19 58 16 64 16C74 16 82 26 80 38C86 44 90 52 90 62C90 78 72 88 50 88C28 88 10 78 10 62Z',\n eyes: { gap: 34, x: 50, y: 58 },\n },\n ghost: {\n d: 'M50 9C70 9 86 25 86 45V82C86 88 80 91 75 87C72 84 68 83 65 86C61 90 56 91 53 88C51 86 49 86 47 88C44 91 39 90 35 86C32 83 28 84 25 87C20 91 14 88 14 82V45C14 25 30 9 50 9Z',\n eyes: { gap: 31, x: 50, y: 46 },\n },\n hex: { d: hexPath(), eyes: { gap: 35, x: 50, y: 52 } },\n lobot: { d: lobotPath(), extra: lobotDots(), eyes: { gap: 27, x: 54, y: 58 } },\n magnifier: {\n d: 'M45 8C64 8 80 24 80 43C80 50 78 56 74.5 61.5L88 75C92 79 92 84.5 88.5 88C85 91.5 79.5 92 75.5 88L62 74.5C57 77 51 78 45 78C26 78 10 62 10 43C10 24 26 8 45 8Z',\n eyes: { gap: 30, x: 45, y: 43 },\n },\n mug: {\n d: 'M18 18H68C72 18 75 21 75 25V36H77C86 36 92 43 92 52C92 62 86 68 77 68H75V72C75 82 67 90 57 90H28C18 90 10 82 10 72V26C10 21 13 18 18 18ZM75 45V59H77C81 59 84 56 84 52C84 48 81 45 77 45Z',\n eyes: { gap: 27, x: 42, y: 52 },\n },\n pudding: {\n d: 'M32 15H68C76 15 81 20 82 28L86 65C91 66 92 71 92 75C92 81 88 85 82 85H18C12 85 8 81 8 75C8 71 9 66 14 65L18 28C19 20 24 15 32 15Z',\n eyes: { gap: 29, x: 50, y: 48 },\n },\n robot: {\n d: 'M50 9A7 7 0 0 1 53 22.3V30H74C82 30 87 35 87 43V50H89A3 3 0 0 1 92 53V67A3 3 0 0 1 89 70H87V76C87 84 82 89 74 89H26C18 89 13 84 13 76V70H11A3 3 0 0 1 8 67V53A3 3 0 0 1 11 50H13V43C13 35 18 30 26 30H47V22.3A7 7 0 0 1 50 9Z',\n eyes: { gap: 36, x: 50, y: 61 },\n },\n rocket: {\n d: 'M50 8C54 8 58 10 62 14C74 25 81 39 81 54C81 58 80.5 61 80 64L88 73C91 76 92 79 92 83V85C92 88 89 90 86 88L76 81C74 83 71 84 68 84H63C62 88 57 92 50 92C43 92 38 88 37 84H32C29 84 26 83 24 81L14 88C11 90 8 88 8 85V83C8 79 9 76 12 73L20 64C19.5 61 19 58 19 54C19 39 26 25 38 14C42 10 46 8 50 8Z',\n eyes: { gap: 26, x: 50, y: 53 },\n },\n shield: {\n d: 'M50 9C60 15 72 18 86 18C88 18 88 20 88 22V45C88 66 72 82 50 92C28 82 12 66 12 45V22C12 20 12 18 14 18C28 18 40 15 50 9Z',\n eyes: { gap: 34, x: 50, y: 42 },\n },\n sprout: {\n d: 'M18 42H38C28 38 20 30 17 21C16 17 19 15 22 16C34 18 44 26 49 37C53 25 63 15 77 12C81 11 84 14 83 18C80 29 72 38 62 42H82C87 42 89 46 88 50L81 83C80 88 76 91 71 91H29C24 91 20 88 19 83L12 50C11 46 13 42 18 42Z',\n eyes: { gap: 30, x: 50, y: 65 },\n },\n star: { d: starPath(), eyes: { gap: 29, x: 50, y: 50 } },\n bunny: {\n d: 'M27 12C29 8 34 8 37 12C42 19 44 30 44 40C46 40 48 39.5 50 39.5C52 39.5 54 40 56 40C56 30 58 19 63 12C66 8 71 8 73 12C77 20 76 34 72 45C81 50 88 58 88 67C88 81 71 90 50 90C29 90 12 81 12 67C12 58 19 50 28 45C24 34 23 20 27 12Z',\n eyes: { gap: 31, x: 50, y: 68 },\n },\n tile: {\n d: 'M30 11H70C83 11 89 17 89 30V70C89 83 83 89 70 89H30C17 89 11 83 11 70V30C11 17 17 11 30 11Z',\n eyes: { gap: 35, x: 50, y: 50 },\n },\n};\n\n/** Size of the engine's eye placeholder: it only anchors the eye plane, the logo eyes are ours. */\nconst ENGINE_EYE_SCALE = 1.4;\n\nconst definitions = new Map<AgentAvatarShape, AvatarDefinition>();\n\n/** The engine definition of a shape. One object per shape, so its volume is built only once. */\nexport const getShapeDefinition = (shape: AgentAvatarShape): AvatarDefinition => {\n let definition = definitions.get(shape);\n if (!definition) {\n const { d, eyes } = SHAPE_GEOMETRY[shape];\n definition = {\n body: { path: d },\n eyes: { scale: ENGINE_EYE_SCALE, spacing: eyes.gap, x: eyes.x, y: eyes.y },\n id: shape,\n name: shape,\n version: 1,\n };\n definitions.set(shape, definition);\n }\n return definition;\n};\n"],"mappings":";AAWA,MAAM,SAAS,UAAkB,KAAK,MAAM,QAAQ,GAAG,IAAI;;AAG3D,MAAM,kBAAkB,UAAmB,MAAc;CACvD,MAAM,QAAQ,GAAU,GAAU,MAAqB,CACrD,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GACvB,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CACzB;CACA,IAAI,IAAI;CACR,KAAK,MAAM,CAAC,OAAO,WAAW,SAAS,QAAQ,GAAG;EAChD,MAAM,QAAQ,KAAK,QAAQ,UAAU,QAAQ,SAAS,SAAS,KAAK,SAAS,SAAS,CAAC;EACvF,MAAM,MAAM,KAAK,QAAQ,UAAU,QAAQ,KAAK,SAAS,SAAS,CAAC;EACnE,KAAK,GAAG,UAAU,IAAI,MAAM,MAAM,MAAM,MAAM,EAAE,EAAE,GAAG,MAAM,MAAM,EAAE,EAAE,GAAG,MAAM,OAAO,EAAE,EAAE,GAAG,MAAM,OAAO,EAAE,EAAE,GAAG,MAAM,IAAI,EAAE,EAAE,GAAG,MAAM,IAAI,EAAE;CAC/I;CACA,OAAO,GAAG,EAAE;AACd;AAEA,MAAM,gBACJ,eACE,MAAM,KAAK,EAAE,QAAQ,EAAE,IAAI,GAAG,UAAiB;CAC7C,MAAM,QAAQ,CAAC,KAAK,KAAK,IAAK,QAAQ,K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E,MAAa,sBAAsB,UAA8C;CAC/E,IAAI,aAAa,YAAY,IAAI,KAAK;CACtC,IAAI,CAAC,YAAY;EACf,MAAM,EAAE,GAAG,SAAS,eAAe;EACnC,aAAa;GACX,MAAM,EAAE,MAAM,EAAE;GAChB,MAAM;IAAE,OAAO;IAAkB,SAAS,KAAK;IAAK,GAAG,KAAK;IAAG,GAAG,KAAK;GAAE;GACzE,IAAI;GACJ,MAAM;GACN,SAAS;EACX;EACA,YAAY,IAAI,OAAO,UAAU;CACnC;CACA,OAAO;AACT"}
@@ -15,6 +15,16 @@ const agentAvatarClasses = stableClasses({
15
15
  "thought"
16
16
  ]
17
17
  });
18
- export { agentAvatarClasses };
18
+ const agentAvatarPickerClasses = stableClasses({
19
+ block: "agent-avatar-picker",
20
+ elements: [
21
+ "preview",
22
+ "shapes",
23
+ "shape",
24
+ "colors",
25
+ "color"
26
+ ]
27
+ });
28
+ export { agentAvatarClasses, agentAvatarPickerClasses };
19
29
 
20
30
  //# sourceMappingURL=stable.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"stable.mjs","names":[],"sources":["../../src/AgentAvatar/stable.ts"],"sourcesContent":["import { stableClasses } from '@/utils/bem';\n\nexport const agentAvatarClasses = stableClasses({\n block: 'agent-avatar',\n dataAttributes: ['shape', 'color', 'state', 'animated'],\n elements: ['body', 'eyes', 'badge', 'thought'],\n});\n"],"mappings":";;AAEA,MAAa,qBAAqB,cAAc;CAC9C,OAAO;CACP,gBAAgB;EAAC;EAAS;EAAS;EAAS;CAAU;CACtD,UAAU;EAAC;EAAQ;EAAQ;EAAS;CAAS;AAC/C,CAAC"}
1
+ {"version":3,"file":"stable.mjs","names":[],"sources":["../../src/AgentAvatar/stable.ts"],"sourcesContent":["import { stableClasses } from '@/utils/bem';\n\nexport const agentAvatarClasses = stableClasses({\n block: 'agent-avatar',\n dataAttributes: ['shape', 'color', 'state', 'animated'],\n elements: ['body', 'eyes', 'badge', 'thought'],\n});\n\nexport const agentAvatarPickerClasses = stableClasses({\n block: 'agent-avatar-picker',\n elements: ['preview', 'shapes', 'shape', 'colors', 'color'],\n});\n"],"mappings":";;AAEA,MAAa,qBAAqB,cAAc;CAC9C,OAAO;CACP,gBAAgB;EAAC;EAAS;EAAS;EAAS;CAAU;CACtD,UAAU;EAAC;EAAQ;EAAQ;EAAS;CAAS;AAC/C,CAAC;AAED,MAAa,2BAA2B,cAAc;CACpD,OAAO;CACP,UAAU;EAAC;EAAW;EAAU;EAAS;EAAU;CAAO;AAC5D,CAAC"}
@@ -0,0 +1,39 @@
1
+ import { LOGO_EYE, drawEye } from "./eyes.mjs";
2
+ import { REST_GAZE_X, lookMatrix, matrixTransform, stateLook } from "./look.mjs";
3
+ import { SHAPE_GEOMETRY } from "./shapes.mjs";
4
+ import { AGENT_AVATAR_STILLS } from "./stills.generated.mjs";
5
+ // src/AgentAvatar/still.ts
6
+ /**
7
+ * The still avatar, drawn from the baked table: no volume engine, so it is cheap to render in long
8
+ * lists and on the server.
9
+ */
10
+ const buildStillScene = (shape, state) => {
11
+ const still = AGENT_AVATAR_STILLS[shape];
12
+ const { extra, eyes } = SHAPE_GEOMETRY[shape];
13
+ const look = stateLook(state, 0, true);
14
+ const rx = eyes.gap / LOGO_EYE.gap;
15
+ const gazeX = look.gazeMix ? look.gazeX : REST_GAZE_X;
16
+ return {
17
+ body: still.d,
18
+ extra: extra ? {
19
+ d: extra,
20
+ transform: still.eyes[0]
21
+ } : null,
22
+ eyes: [-1, 1].map((side, index) => ({
23
+ ...drawEye(eyes.x + side * eyes.gap / 2, eyes.y, rx, side, {
24
+ arc: look.arc,
25
+ blink: 0,
26
+ gazeX,
27
+ gazeY: look.gazeY,
28
+ slit: look.slit,
29
+ squint: side === -1 ? look.squintL : look.squintR,
30
+ wide: look.wide
31
+ }),
32
+ transform: still.eyes[index]
33
+ })),
34
+ stage: matrixTransform(lookMatrix(look))
35
+ };
36
+ };
37
+ export { buildStillScene };
38
+
39
+ //# sourceMappingURL=still.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"still.mjs","names":[],"sources":["../../src/AgentAvatar/still.ts"],"sourcesContent":["/**\n * The still avatar, drawn from the baked table: no volume engine, so it is cheap to render in long\n * lists and on the server.\n */\nimport { drawEye, type EyeDrawing, LOGO_EYE } from './eyes';\nimport { lookMatrix, matrixTransform, REST_GAZE_X, stateLook } from './look';\nimport { SHAPE_GEOMETRY } from './shapes';\nimport { AGENT_AVATAR_STILLS } from './stills.generated';\nimport type { AgentAvatarShape, AgentAvatarState } from './type';\n\nexport interface AgentAvatarStill {\n /** The projected body silhouette at rest. */\n d: string;\n /** Face-plane transforms of the left and right eye. */\n eyes: readonly string[];\n /** Fingerprint of the geometry this entry was baked from. */\n key: string;\n}\n\nexport interface StillScene {\n /** Body silhouette. */\n body: string;\n extra: { d: string; transform: string } | null;\n eyes: (EyeDrawing & { transform: string })[];\n /** The state's body pose. */\n stage: string;\n}\n\nexport const buildStillScene = (shape: AgentAvatarShape, state: AgentAvatarState): StillScene => {\n const still = AGENT_AVATAR_STILLS[shape];\n const { extra, eyes } = SHAPE_GEOMETRY[shape];\n const look = stateLook(state, 0, true);\n const rx = eyes.gap / LOGO_EYE.gap;\n const gazeX = look.gazeMix ? look.gazeX : REST_GAZE_X;\n\n return {\n body: still.d,\n extra: extra ? { d: extra, transform: still.eyes[0] } : null,\n eyes: ([-1, 1] as const).map((side, index) => ({\n ...drawEye(eyes.x + (side * eyes.gap) / 2, eyes.y, rx, side, {\n arc: look.arc,\n blink: 0,\n gazeX,\n gazeY: look.gazeY,\n slit: look.slit,\n squint: side === -1 ? look.squintL : look.squintR,\n wide: look.wide,\n }),\n transform: still.eyes[index],\n })),\n stage: matrixTransform(lookMatrix(look)),\n };\n};\n"],"mappings":";;;;;;;;;AA4BA,MAAa,mBAAmB,OAAyB,UAAwC;CAC/F,MAAM,QAAQ,oBAAoB;CAClC,MAAM,EAAE,OAAO,SAAS,eAAe;CACvC,MAAM,OAAO,UAAU,OAAO,GAAG,IAAI;CACrC,MAAM,KAAK,KAAK,MAAM,SAAS;CAC/B,MAAM,QAAQ,KAAK,UAAU,KAAK,QAAQ;CAE1C,OAAO;EACL,MAAM,MAAM;EACZ,OAAO,QAAQ;GAAE,GAAG;GAAO,WAAW,MAAM,KAAK;EAAG,IAAI;EACxD,MAAO,CAAC,IAAI,CAAC,CAAC,CAAW,KAAK,MAAM,WAAW;GAC7C,GAAG,QAAQ,KAAK,IAAK,OAAO,KAAK,MAAO,GAAG,KAAK,GAAG,IAAI,MAAM;IAC3D,KAAK,KAAK;IACV,OAAO;IACP;IACA,OAAO,KAAK;IACZ,MAAM,KAAK;IACX,QAAQ,SAAS,KAAK,KAAK,UAAU,KAAK;IAC1C,MAAM,KAAK;GACb,CAAC;GACD,WAAW,MAAM,KAAK;EACxB,EAAE;EACF,OAAO,gBAAgB,WAAW,IAAI,CAAC;CACzC;AACF"}