@ignaciocabeza/bitface 1.0.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/dist/vue.cjs ADDED
@@ -0,0 +1,1165 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/vue.ts
21
+ var vue_exports = {};
22
+ __export(vue_exports, {
23
+ Avatar: () => Avatar,
24
+ generateRandomConfig: () => generateRandomConfig,
25
+ useAnimatedAvatar: () => useAnimatedAvatar,
26
+ useAvatar: () => useAvatar
27
+ });
28
+ module.exports = __toCommonJS(vue_exports);
29
+ var import_vue = require("vue");
30
+
31
+ // src/renderer/parts/face-shapes.ts
32
+ var faceShapes = {
33
+ round: {
34
+ pixels: [
35
+ [0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0],
36
+ [0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0],
37
+ [0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0],
38
+ [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
39
+ [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
40
+ [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
41
+ [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
42
+ [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
43
+ [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
44
+ [0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0],
45
+ [0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0],
46
+ [0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0]
47
+ ],
48
+ slotMap: { 1: "skin", 2: "skinShadow" },
49
+ offsetX: 0,
50
+ offsetY: 3
51
+ },
52
+ oval: {
53
+ pixels: [
54
+ [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0],
55
+ [0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0],
56
+ [0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0],
57
+ [0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0],
58
+ [0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0],
59
+ [0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0],
60
+ [0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0],
61
+ [0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0],
62
+ [0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0],
63
+ [0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0],
64
+ [0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0],
65
+ [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0]
66
+ ],
67
+ slotMap: { 1: "skin", 2: "skinShadow" },
68
+ offsetX: 0,
69
+ offsetY: 3
70
+ },
71
+ square: {
72
+ pixels: [
73
+ [0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0],
74
+ [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
75
+ [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
76
+ [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
77
+ [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
78
+ [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
79
+ [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
80
+ [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
81
+ [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
82
+ [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
83
+ [0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0],
84
+ [0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0]
85
+ ],
86
+ slotMap: { 1: "skin", 2: "skinShadow" },
87
+ offsetX: 0,
88
+ offsetY: 3
89
+ },
90
+ heart: {
91
+ pixels: [
92
+ [0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0],
93
+ [0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0],
94
+ [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
95
+ [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
96
+ [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
97
+ [0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0],
98
+ [0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0],
99
+ [0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0],
100
+ [0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0],
101
+ [0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0],
102
+ [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0],
103
+ [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0]
104
+ ],
105
+ slotMap: { 1: "skin", 2: "skinShadow" },
106
+ offsetX: 0,
107
+ offsetY: 3
108
+ },
109
+ long: {
110
+ pixels: [
111
+ [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0],
112
+ [0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0],
113
+ [0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0],
114
+ [0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0],
115
+ [0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0],
116
+ [0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0],
117
+ [0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0],
118
+ [0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0],
119
+ [0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0],
120
+ [0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0],
121
+ [0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0],
122
+ [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0],
123
+ [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0]
124
+ ],
125
+ slotMap: { 1: "skin", 2: "skinShadow" },
126
+ offsetX: 0,
127
+ offsetY: 2
128
+ },
129
+ diamond: {
130
+ pixels: [
131
+ [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0],
132
+ [0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0],
133
+ [0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0],
134
+ [0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0],
135
+ [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
136
+ [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
137
+ [0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0],
138
+ [0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0],
139
+ [0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0],
140
+ [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0],
141
+ [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0]
142
+ ],
143
+ slotMap: { 1: "skin", 2: "skinShadow" },
144
+ offsetX: 0,
145
+ offsetY: 3
146
+ },
147
+ wide: {
148
+ pixels: [
149
+ [0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0],
150
+ [0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0],
151
+ [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
152
+ [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
153
+ [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
154
+ [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
155
+ [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
156
+ [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
157
+ [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
158
+ [0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0],
159
+ [0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0],
160
+ [0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0]
161
+ ],
162
+ slotMap: { 1: "skin", 2: "skinShadow" },
163
+ offsetX: 0,
164
+ offsetY: 3
165
+ }
166
+ };
167
+ var face_shapes_default = faceShapes;
168
+
169
+ // src/renderer/parts/eyes.ts
170
+ var eyes = {
171
+ big: {
172
+ pixels: [
173
+ [1, 1, 0, 0, 0, 0, 1, 1],
174
+ [1, 2, 1, 0, 0, 1, 2, 1],
175
+ [1, 2, 3, 0, 0, 1, 2, 3],
176
+ [1, 1, 0, 0, 0, 0, 1, 1]
177
+ ],
178
+ slotMap: { 1: "white", 2: "eyes", 3: "pupil" },
179
+ offsetX: 4,
180
+ offsetY: 7
181
+ },
182
+ small: {
183
+ pixels: [
184
+ [0, 2, 0, 0, 0, 0, 2, 0],
185
+ [0, 3, 0, 0, 0, 0, 3, 0]
186
+ ],
187
+ slotMap: { 2: "eyes", 3: "pupil" },
188
+ offsetX: 4,
189
+ offsetY: 8
190
+ },
191
+ narrow: {
192
+ pixels: [
193
+ [1, 2, 3, 0, 0, 1, 2, 3]
194
+ ],
195
+ slotMap: { 1: "white", 2: "eyes", 3: "pupil" },
196
+ offsetX: 4,
197
+ offsetY: 8
198
+ },
199
+ round: {
200
+ pixels: [
201
+ [0, 1, 0, 0, 0, 0, 1, 0],
202
+ [1, 2, 1, 0, 0, 1, 2, 1],
203
+ [1, 2, 3, 0, 0, 1, 2, 3],
204
+ [0, 1, 0, 0, 0, 0, 1, 0]
205
+ ],
206
+ slotMap: { 1: "white", 2: "eyes", 3: "pupil" },
207
+ offsetX: 4,
208
+ offsetY: 7
209
+ },
210
+ wink: {
211
+ pixels: [
212
+ [1, 1, 0, 0, 0, 0, 0, 0],
213
+ [1, 2, 1, 0, 0, 0, 0, 0],
214
+ [1, 2, 3, 0, 0, 3, 3, 3],
215
+ [1, 1, 0, 0, 0, 0, 0, 0]
216
+ ],
217
+ slotMap: { 1: "white", 2: "eyes", 3: "pupil" },
218
+ offsetX: 4,
219
+ offsetY: 7
220
+ },
221
+ happy: {
222
+ pixels: [
223
+ [0, 3, 3, 0, 0, 0, 3, 3],
224
+ [3, 0, 0, 0, 0, 3, 0, 0]
225
+ ],
226
+ slotMap: { 3: "pupil" },
227
+ offsetX: 4,
228
+ offsetY: 8
229
+ },
230
+ angry: {
231
+ pixels: [
232
+ [1, 1, 0, 0, 0, 0, 1, 1],
233
+ [1, 2, 3, 0, 0, 3, 2, 1],
234
+ [0, 1, 1, 0, 0, 1, 1, 0]
235
+ ],
236
+ slotMap: { 1: "white", 2: "eyes", 3: "pupil" },
237
+ offsetX: 4,
238
+ offsetY: 7
239
+ },
240
+ dots: {
241
+ pixels: [
242
+ [0, 0, 3, 0, 0, 0, 0, 3]
243
+ ],
244
+ slotMap: { 3: "pupil" },
245
+ offsetX: 4,
246
+ offsetY: 9
247
+ },
248
+ sleepy: {
249
+ pixels: [
250
+ [1, 1, 0, 0, 0, 0, 1, 1],
251
+ [3, 3, 0, 0, 0, 0, 3, 3]
252
+ ],
253
+ slotMap: { 1: "white", 3: "pupil" },
254
+ offsetX: 4,
255
+ offsetY: 8
256
+ },
257
+ cross: {
258
+ pixels: [
259
+ [3, 0, 3, 0, 0, 3, 0, 3],
260
+ [0, 3, 0, 0, 0, 0, 3, 0],
261
+ [3, 0, 3, 0, 0, 3, 0, 3]
262
+ ],
263
+ slotMap: { 3: "pupil" },
264
+ offsetX: 4,
265
+ offsetY: 7
266
+ },
267
+ heart: {
268
+ pixels: [
269
+ [2, 0, 2, 0, 0, 2, 0, 2],
270
+ [2, 2, 2, 0, 0, 2, 2, 2],
271
+ [0, 2, 0, 0, 0, 0, 2, 0]
272
+ ],
273
+ slotMap: { 2: "eyes" },
274
+ offsetX: 4,
275
+ offsetY: 7
276
+ }
277
+ };
278
+ var eyes_default = eyes;
279
+
280
+ // src/renderer/parts/eyebrows.ts
281
+ var eyebrows = {
282
+ thick: {
283
+ pixels: [
284
+ [1, 1, 1, 0, 0, 1, 1, 1],
285
+ [1, 1, 1, 0, 0, 1, 1, 1]
286
+ ],
287
+ slotMap: { 1: "hair" },
288
+ offsetX: 4,
289
+ offsetY: 6
290
+ },
291
+ thin: {
292
+ pixels: [
293
+ [1, 1, 1, 0, 0, 1, 1, 1]
294
+ ],
295
+ slotMap: { 1: "hair" },
296
+ offsetX: 4,
297
+ offsetY: 6
298
+ },
299
+ arched: {
300
+ pixels: [
301
+ [0, 1, 1, 0, 0, 0, 1, 1],
302
+ [1, 0, 0, 0, 0, 1, 0, 0]
303
+ ],
304
+ slotMap: { 1: "hair" },
305
+ offsetX: 4,
306
+ offsetY: 5
307
+ },
308
+ angry: {
309
+ pixels: [
310
+ [1, 0, 0, 0, 0, 0, 0, 1],
311
+ [0, 1, 1, 0, 0, 1, 1, 0]
312
+ ],
313
+ slotMap: { 1: "hair" },
314
+ offsetX: 4,
315
+ offsetY: 5
316
+ },
317
+ worried: {
318
+ pixels: [
319
+ [0, 0, 1, 0, 0, 1, 0, 0],
320
+ [0, 1, 0, 0, 0, 0, 1, 0]
321
+ ],
322
+ slotMap: { 1: "hair" },
323
+ offsetX: 4,
324
+ offsetY: 5
325
+ },
326
+ unibrow: {
327
+ pixels: [
328
+ [1, 1, 1, 1, 1, 1, 1, 1],
329
+ [1, 1, 0, 0, 0, 0, 1, 1]
330
+ ],
331
+ slotMap: { 1: "hair" },
332
+ offsetX: 4,
333
+ offsetY: 5
334
+ },
335
+ none: {
336
+ pixels: [],
337
+ slotMap: {},
338
+ offsetX: 0,
339
+ offsetY: 0
340
+ }
341
+ };
342
+ var eyebrows_default = eyebrows;
343
+
344
+ // src/renderer/parts/mouth.ts
345
+ var mouth = {
346
+ smile: {
347
+ pixels: [
348
+ [1, 0, 0, 0, 0, 1],
349
+ [0, 1, 1, 1, 1, 0]
350
+ ],
351
+ slotMap: { 1: "mouth" },
352
+ offsetX: 5,
353
+ offsetY: 12
354
+ },
355
+ frown: {
356
+ pixels: [
357
+ [0, 1, 1, 1, 1, 0],
358
+ [1, 0, 0, 0, 0, 1]
359
+ ],
360
+ slotMap: { 1: "mouth" },
361
+ offsetX: 5,
362
+ offsetY: 12
363
+ },
364
+ open: {
365
+ pixels: [
366
+ [0, 1, 1, 1, 1, 0],
367
+ [1, 1, 1, 1, 1, 1],
368
+ [0, 1, 1, 1, 1, 0]
369
+ ],
370
+ slotMap: { 1: "mouth" },
371
+ offsetX: 5,
372
+ offsetY: 11
373
+ },
374
+ flat: {
375
+ pixels: [
376
+ [1, 1, 1, 1, 1, 1]
377
+ ],
378
+ slotMap: { 1: "mouth" },
379
+ offsetX: 5,
380
+ offsetY: 12
381
+ },
382
+ teeth: {
383
+ pixels: [
384
+ [0, 1, 1, 1, 1, 0],
385
+ [0, 2, 2, 2, 2, 0],
386
+ [0, 1, 1, 1, 1, 0]
387
+ ],
388
+ slotMap: { 1: "mouth", 2: "white" },
389
+ offsetX: 5,
390
+ offsetY: 11
391
+ },
392
+ smirk: {
393
+ pixels: [
394
+ [0, 0, 0, 0, 1, 0],
395
+ [0, 1, 1, 1, 0, 0]
396
+ ],
397
+ slotMap: { 1: "mouth" },
398
+ offsetX: 5,
399
+ offsetY: 12
400
+ },
401
+ grin: {
402
+ pixels: [
403
+ [0, 1, 1, 1, 1, 1, 1, 0],
404
+ [0, 1, 2, 2, 2, 2, 1, 0],
405
+ [0, 0, 1, 1, 1, 1, 0, 0]
406
+ ],
407
+ slotMap: { 1: "mouth", 2: "white" },
408
+ offsetX: 4,
409
+ offsetY: 11
410
+ },
411
+ tongue: {
412
+ pixels: [
413
+ [0, 1, 1, 1, 1, 0],
414
+ [0, 0, 1, 1, 0, 0],
415
+ [0, 0, 0, 1, 0, 0]
416
+ ],
417
+ slotMap: { 1: "mouth" },
418
+ offsetX: 5,
419
+ offsetY: 12
420
+ },
421
+ oh: {
422
+ pixels: [
423
+ [0, 1, 1, 0],
424
+ [1, 0, 0, 1],
425
+ [0, 1, 1, 0]
426
+ ],
427
+ slotMap: { 1: "mouth" },
428
+ offsetX: 6,
429
+ offsetY: 11
430
+ }
431
+ };
432
+ var mouth_default = mouth;
433
+
434
+ // src/renderer/parts/nose.ts
435
+ var nose = {
436
+ small: {
437
+ pixels: [
438
+ [0, 1, 0],
439
+ [1, 0, 1]
440
+ ],
441
+ slotMap: { 1: "skinShadow" },
442
+ offsetX: 7,
443
+ offsetY: 10
444
+ },
445
+ pointy: {
446
+ pixels: [
447
+ [0, 1, 0],
448
+ [0, 1, 0],
449
+ [1, 0, 1]
450
+ ],
451
+ slotMap: { 1: "skinShadow" },
452
+ offsetX: 7,
453
+ offsetY: 9
454
+ },
455
+ wide: {
456
+ pixels: [
457
+ [0, 1, 1, 0],
458
+ [1, 0, 0, 1],
459
+ [1, 0, 0, 1]
460
+ ],
461
+ slotMap: { 1: "skinShadow" },
462
+ offsetX: 6,
463
+ offsetY: 9
464
+ },
465
+ button: {
466
+ pixels: [
467
+ [1, 1]
468
+ ],
469
+ slotMap: { 1: "skinShadow" },
470
+ offsetX: 7,
471
+ offsetY: 10
472
+ },
473
+ long: {
474
+ pixels: [
475
+ [0, 1, 0],
476
+ [0, 1, 0],
477
+ [0, 1, 0],
478
+ [1, 0, 1]
479
+ ],
480
+ slotMap: { 1: "skinShadow" },
481
+ offsetX: 7,
482
+ offsetY: 8
483
+ },
484
+ snub: {
485
+ pixels: [
486
+ [0, 1],
487
+ [1, 1]
488
+ ],
489
+ slotMap: { 1: "skinShadow" },
490
+ offsetX: 7,
491
+ offsetY: 10
492
+ }
493
+ };
494
+ var nose_default = nose;
495
+
496
+ // src/renderer/parts/ears.ts
497
+ var ears = {
498
+ small: {
499
+ pixels: [
500
+ [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
501
+ [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
502
+ [2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2]
503
+ ],
504
+ slotMap: { 1: "skin", 2: "skinShadow" },
505
+ offsetX: 0,
506
+ offsetY: 8
507
+ },
508
+ big: {
509
+ pixels: [
510
+ [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
511
+ [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
512
+ [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
513
+ [2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2],
514
+ [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]
515
+ ],
516
+ slotMap: { 1: "skin", 2: "skinShadow" },
517
+ offsetX: 0,
518
+ offsetY: 7
519
+ },
520
+ pointed: {
521
+ pixels: [
522
+ [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
523
+ [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
524
+ [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
525
+ [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
526
+ [2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2]
527
+ ],
528
+ slotMap: { 1: "skin", 2: "skinShadow" },
529
+ offsetX: 0,
530
+ offsetY: 5
531
+ },
532
+ elf: {
533
+ pixels: [
534
+ [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
535
+ [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1],
536
+ [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1],
537
+ [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1],
538
+ [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
539
+ [2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2]
540
+ ],
541
+ slotMap: { 1: "skin", 2: "skinShadow" },
542
+ offsetX: 0,
543
+ offsetY: 4
544
+ },
545
+ none: {
546
+ pixels: [],
547
+ slotMap: {},
548
+ offsetX: 0,
549
+ offsetY: 0
550
+ }
551
+ };
552
+ var ears_default = ears;
553
+
554
+ // src/renderer/parts/hair.ts
555
+ var hair = {
556
+ short: {
557
+ pixels: [
558
+ [0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0],
559
+ [0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0],
560
+ [0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0],
561
+ [0, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 1, 0]
562
+ ],
563
+ slotMap: { 1: "hair", 2: "hairShadow" },
564
+ offsetX: 0,
565
+ offsetY: 2
566
+ },
567
+ long: {
568
+ pixels: [
569
+ [0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0],
570
+ [0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0],
571
+ [0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0],
572
+ [0, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 1, 0],
573
+ [0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 0],
574
+ [0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 0],
575
+ [0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0],
576
+ [0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0],
577
+ [0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0],
578
+ [0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0],
579
+ [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
580
+ [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0]
581
+ ],
582
+ slotMap: { 1: "hair", 2: "hairShadow" },
583
+ offsetX: 0,
584
+ offsetY: 2
585
+ },
586
+ curly: {
587
+ pixels: [
588
+ [0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0],
589
+ [0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0],
590
+ [0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0],
591
+ [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
592
+ [1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1],
593
+ [1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1],
594
+ [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0],
595
+ [1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1],
596
+ [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0]
597
+ ],
598
+ slotMap: { 1: "hair", 2: "hairShadow" },
599
+ offsetX: 0,
600
+ offsetY: 1
601
+ },
602
+ mohawk: {
603
+ pixels: [
604
+ [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0],
605
+ [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0],
606
+ [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0],
607
+ [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0],
608
+ [0, 0, 0, 0, 0, 2, 1, 1, 1, 1, 2, 0, 0, 0, 0, 0]
609
+ ],
610
+ slotMap: { 1: "hair", 2: "hairShadow" },
611
+ offsetX: 0,
612
+ offsetY: 0
613
+ },
614
+ bald: {
615
+ pixels: [],
616
+ slotMap: {},
617
+ offsetX: 0,
618
+ offsetY: 0
619
+ },
620
+ ponytail: {
621
+ pixels: [
622
+ [0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0],
623
+ [0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0],
624
+ [0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0],
625
+ [0, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 1, 0],
626
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1],
627
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1],
628
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0],
629
+ [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0]
630
+ ],
631
+ slotMap: { 1: "hair", 2: "hairShadow" },
632
+ offsetX: 0,
633
+ offsetY: 2
634
+ },
635
+ spiky: {
636
+ pixels: [
637
+ [0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0],
638
+ [0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0],
639
+ [0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0],
640
+ [0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0],
641
+ [0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0],
642
+ [0, 1, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 1, 0]
643
+ ],
644
+ slotMap: { 1: "hair", 2: "hairShadow" },
645
+ offsetX: 0,
646
+ offsetY: 0
647
+ },
648
+ bob: {
649
+ pixels: [
650
+ [0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0],
651
+ [0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0],
652
+ [0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0],
653
+ [0, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 1, 0],
654
+ [0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0],
655
+ [0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0],
656
+ [0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0],
657
+ [0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0]
658
+ ],
659
+ slotMap: { 1: "hair", 2: "hairShadow" },
660
+ offsetX: 0,
661
+ offsetY: 2
662
+ },
663
+ afro: {
664
+ pixels: [
665
+ [0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0],
666
+ [0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0],
667
+ [0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0],
668
+ [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
669
+ [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
670
+ [1, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 1, 1],
671
+ [1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 1],
672
+ [1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1],
673
+ [1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1]
674
+ ],
675
+ slotMap: { 1: "hair", 2: "hairShadow" },
676
+ offsetX: 0,
677
+ offsetY: 0
678
+ },
679
+ bangs: {
680
+ pixels: [
681
+ [0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0],
682
+ [0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0],
683
+ [0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0],
684
+ [0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0],
685
+ [0, 1, 1, 1, 1, 1, 1, 2, 0, 0, 0, 0, 2, 1, 1, 0]
686
+ ],
687
+ slotMap: { 1: "hair", 2: "hairShadow" },
688
+ offsetX: 0,
689
+ offsetY: 2
690
+ }
691
+ };
692
+ var hair_default = hair;
693
+
694
+ // src/renderer/parts/beard.ts
695
+ var beard = {
696
+ stubble: {
697
+ // Sparse dots at chin/jaw edge
698
+ pixels: [
699
+ [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0],
700
+ [0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0]
701
+ ],
702
+ slotMap: { 1: "hair" },
703
+ offsetX: 0,
704
+ offsetY: 13
705
+ },
706
+ goatee: {
707
+ // Small chin patch below the mouth
708
+ pixels: [
709
+ [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0],
710
+ [0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0]
711
+ ],
712
+ slotMap: { 1: "hair" },
713
+ offsetX: 0,
714
+ offsetY: 13
715
+ },
716
+ full: {
717
+ // Jaw outline: sideburns at edges + solid chin, hollow center so mouth shows
718
+ pixels: [
719
+ [0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0],
720
+ [0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0],
721
+ [0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0],
722
+ [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0]
723
+ ],
724
+ slotMap: { 1: "hair" },
725
+ offsetX: 0,
726
+ offsetY: 11
727
+ },
728
+ mustache: {
729
+ // Sits just above the mouth line
730
+ pixels: [
731
+ [0, 0, 1, 1, 0, 0, 1, 1, 0, 0],
732
+ [0, 1, 0, 0, 1, 1, 0, 0, 1, 0]
733
+ ],
734
+ slotMap: { 1: "hair" },
735
+ offsetX: 3,
736
+ offsetY: 11
737
+ },
738
+ handlebar: {
739
+ // Wide curling mustache
740
+ pixels: [
741
+ [0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0],
742
+ [0, 1, 0, 0, 1, 1, 1, 1, 0, 0, 1, 0],
743
+ [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]
744
+ ],
745
+ slotMap: { 1: "hair" },
746
+ offsetX: 2,
747
+ offsetY: 11
748
+ },
749
+ none: {
750
+ pixels: [],
751
+ slotMap: {},
752
+ offsetX: 0,
753
+ offsetY: 0
754
+ }
755
+ };
756
+ var beard_default = beard;
757
+
758
+ // src/renderer/parts/accessories.ts
759
+ var accessories = {
760
+ glasses: {
761
+ pixels: [
762
+ [0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0],
763
+ [1, 1, 1, 3, 3, 1, 1, 1, 1, 3, 3, 1, 1, 1],
764
+ [0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0]
765
+ ],
766
+ slotMap: { 1: "accessoryPrimary", 3: "lens" },
767
+ offsetX: 1,
768
+ offsetY: 7
769
+ },
770
+ sunglasses: {
771
+ pixels: [
772
+ [0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0],
773
+ [1, 1, 1, 2, 2, 1, 1, 1, 1, 2, 2, 1, 1, 1],
774
+ [0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0]
775
+ ],
776
+ slotMap: { 1: "accessoryPrimary", 2: "accessorySecondary" },
777
+ offsetX: 1,
778
+ offsetY: 7
779
+ },
780
+ hat: {
781
+ pixels: [
782
+ [0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0],
783
+ [0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0],
784
+ [0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0],
785
+ [0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 0]
786
+ ],
787
+ slotMap: { 1: "accessoryPrimary", 2: "accessorySecondary" },
788
+ offsetX: 0,
789
+ offsetY: 0
790
+ },
791
+ headband: {
792
+ pixels: [
793
+ [0, 0, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 0, 0]
794
+ ],
795
+ slotMap: { 1: "accessoryPrimary", 2: "accessorySecondary" },
796
+ offsetX: 0,
797
+ offsetY: 5
798
+ },
799
+ earrings: {
800
+ pixels: [
801
+ [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
802
+ [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]
803
+ ],
804
+ slotMap: { 1: "accessoryPrimary" },
805
+ offsetX: 0,
806
+ offsetY: 11
807
+ },
808
+ none: {
809
+ pixels: [],
810
+ slotMap: {},
811
+ offsetX: 0,
812
+ offsetY: 0
813
+ }
814
+ };
815
+ var accessories_default = accessories;
816
+
817
+ // src/renderer/parts/index.ts
818
+ var registry = {
819
+ faceShape: face_shapes_default,
820
+ eyes: eyes_default,
821
+ eyebrows: eyebrows_default,
822
+ mouth: mouth_default,
823
+ nose: nose_default,
824
+ ears: ears_default,
825
+ hair: hair_default,
826
+ beard: beard_default,
827
+ accessories: accessories_default
828
+ };
829
+ function getPart(category, name) {
830
+ return registry[category]?.[name];
831
+ }
832
+ function getVariantNames(category) {
833
+ const cat = registry[category];
834
+ return cat ? Object.keys(cat) : [];
835
+ }
836
+
837
+ // src/renderer/palette.ts
838
+ var SKIN_PRESETS = {
839
+ light: "#FDDCB5",
840
+ medium: "#E8B88A",
841
+ tan: "#D19A6A",
842
+ brown: "#A0673C",
843
+ dark: "#6B4226",
844
+ pale: "#FFF0E0"
845
+ };
846
+ var SKIN_SHADOW_MAP = {
847
+ "#FDDCB5": "#E5C49D",
848
+ "#E8B88A": "#CFA072",
849
+ "#D19A6A": "#B98252",
850
+ "#A0673C": "#885524",
851
+ "#6B4226": "#533010",
852
+ "#FFF0E0": "#E7D8C8"
853
+ };
854
+ var HAIR_PRESETS = {
855
+ black: "#1A1A2E",
856
+ brown: "#6B3A2A",
857
+ blonde: "#E8C84A",
858
+ red: "#B83A1E",
859
+ gray: "#9E9E9E",
860
+ white: "#E8E8E8",
861
+ auburn: "#8B3A1A",
862
+ strawberry: "#D4713A",
863
+ platinum: "#E8E0D0",
864
+ pink: "#E8559E",
865
+ blue: "#3A6BD5",
866
+ purple: "#6B3A8B",
867
+ teal: "#2A9E8B"
868
+ };
869
+ var EYE_PRESETS = {
870
+ brown: "#5C3A1E",
871
+ blue: "#3A7BD5",
872
+ green: "#3A9D5C",
873
+ gray: "#7A7A7A"
874
+ };
875
+ var HEX_COLOR_RE = /^#(?:[0-9a-fA-F]{3,4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/;
876
+ function sanitizeColor(value, fallback) {
877
+ if (HEX_COLOR_RE.test(value)) return value;
878
+ return fallback;
879
+ }
880
+ function resolveSkinColor(value) {
881
+ if (!value) return SKIN_PRESETS.medium;
882
+ return SKIN_PRESETS[value] ?? sanitizeColor(value, SKIN_PRESETS.medium);
883
+ }
884
+ function resolveSkinShadow(skinHex) {
885
+ return SKIN_SHADOW_MAP[skinHex] ?? darken(skinHex, 30);
886
+ }
887
+ function resolveHairColor(value) {
888
+ if (!value) return HAIR_PRESETS.black;
889
+ return HAIR_PRESETS[value] ?? sanitizeColor(value, HAIR_PRESETS.black);
890
+ }
891
+ function resolveEyeColor(value) {
892
+ if (!value) return EYE_PRESETS.brown;
893
+ return EYE_PRESETS[value] ?? sanitizeColor(value, EYE_PRESETS.brown);
894
+ }
895
+ function darken(hex, amount) {
896
+ const num = parseInt(hex.replace("#", ""), 16);
897
+ const r = Math.max(0, (num >> 16) - amount);
898
+ const g = Math.max(0, (num >> 8 & 255) - amount);
899
+ const b = Math.max(0, (num & 255) - amount);
900
+ return `#${(r << 16 | g << 8 | b).toString(16).padStart(6, "0").toUpperCase()}`;
901
+ }
902
+
903
+ // src/renderer/generator.ts
904
+ var BASE_SIZE = 16;
905
+ function buildColorMap(config) {
906
+ const skin = resolveSkinColor(config.skinColor);
907
+ const skinShadow = resolveSkinShadow(skin);
908
+ const hairColor = resolveHairColor(config.hairColor);
909
+ const eyeColor = resolveEyeColor(config.eyeColor);
910
+ return {
911
+ skin,
912
+ skinShadow,
913
+ hair: hairColor,
914
+ hairShadow: darkenColor(hairColor, 25),
915
+ eyes: eyeColor,
916
+ pupil: "#111111",
917
+ white: "#FFFFFF",
918
+ mouth: "#C75050",
919
+ accessoryPrimary: "#333333",
920
+ accessorySecondary: "#1A1A1A",
921
+ lens: "#87CEEB"
922
+ };
923
+ }
924
+ function darkenColor(hex, amount) {
925
+ const num = parseInt(hex.replace("#", ""), 16);
926
+ const r = Math.max(0, (num >> 16) - amount);
927
+ const g = Math.max(0, (num >> 8 & 255) - amount);
928
+ const b = Math.max(0, (num & 255) - amount);
929
+ return `#${(r << 16 | g << 8 | b).toString(16).padStart(6, "0")}`;
930
+ }
931
+ function stampPart(grid, part, colorMap) {
932
+ for (let py = 0; py < part.pixels.length; py++) {
933
+ const row = part.pixels[py];
934
+ for (let px = 0; px < row.length; px++) {
935
+ const slot = row[px];
936
+ if (slot === 0) continue;
937
+ const role = part.slotMap[slot];
938
+ if (!role) continue;
939
+ const color = colorMap[role];
940
+ if (!color) continue;
941
+ const gx = part.offsetX + px;
942
+ const gy = part.offsetY + py;
943
+ if (gx >= 0 && gx < BASE_SIZE && gy >= 0 && gy < BASE_SIZE) {
944
+ grid[gy][gx] = color;
945
+ }
946
+ }
947
+ }
948
+ }
949
+ var LAYER_ORDER = [
950
+ { category: "faceShape", configKey: "faceShape" },
951
+ { category: "ears", configKey: "ears" },
952
+ { category: "nose", configKey: "nose" },
953
+ { category: "mouth", configKey: "mouth" },
954
+ { category: "eyes", configKey: "eyes" },
955
+ { category: "eyebrows", configKey: "eyebrows" },
956
+ { category: "hair", configKey: "hair" },
957
+ { category: "beard", configKey: "beard" },
958
+ { category: "accessories", configKey: "accessories" }
959
+ ];
960
+ function generateGrid(config) {
961
+ const grid = Array.from(
962
+ { length: BASE_SIZE },
963
+ () => Array.from({ length: BASE_SIZE }, () => null)
964
+ );
965
+ const colorMap = buildColorMap(config);
966
+ for (const layer of LAYER_ORDER) {
967
+ const name = config[layer.configKey];
968
+ if (!name || name === "none") continue;
969
+ const part = getPart(layer.category, name);
970
+ if (!part) continue;
971
+ stampPart(grid, part, colorMap);
972
+ }
973
+ return grid;
974
+ }
975
+
976
+ // src/renderer/svg.ts
977
+ function gridToSvg(grid, backgroundColor) {
978
+ const height = grid.length;
979
+ const width = height > 0 ? grid[0].length : 0;
980
+ const raw = backgroundColor ?? "#87CEEB";
981
+ const bg = raw === "transparent" ? "transparent" : sanitizeColor(raw, "#87CEEB");
982
+ const rects = [];
983
+ if (bg !== "transparent") {
984
+ rects.push(`<rect width="${width}" height="${height}" fill="${bg}"/>`);
985
+ }
986
+ for (let y = 0; y < height; y++) {
987
+ let x = 0;
988
+ while (x < width) {
989
+ const color = grid[y][x];
990
+ if (color === null) {
991
+ x++;
992
+ continue;
993
+ }
994
+ let runLen = 1;
995
+ while (x + runLen < width && grid[y][x + runLen] === color) {
996
+ runLen++;
997
+ }
998
+ rects.push(`<rect x="${x}" y="${y}" width="${runLen}" height="1" fill="${color}"/>`);
999
+ x += runLen;
1000
+ }
1001
+ }
1002
+ return [
1003
+ `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${width} ${height}" shape-rendering="crispEdges">`,
1004
+ ...rects,
1005
+ "</svg>"
1006
+ ].join("");
1007
+ }
1008
+
1009
+ // src/renderer/index.ts
1010
+ function pickRandom(arr) {
1011
+ return arr[Math.floor(Math.random() * arr.length)];
1012
+ }
1013
+ function generateRandomConfig() {
1014
+ return {
1015
+ faceShape: pickRandom(getVariantNames("faceShape")),
1016
+ eyes: pickRandom(getVariantNames("eyes")),
1017
+ eyebrows: pickRandom(getVariantNames("eyebrows")),
1018
+ mouth: pickRandom(getVariantNames("mouth")),
1019
+ nose: pickRandom(getVariantNames("nose")),
1020
+ ears: pickRandom(getVariantNames("ears")),
1021
+ hair: pickRandom(getVariantNames("hair")),
1022
+ beard: pickRandom(getVariantNames("beard")),
1023
+ accessories: pickRandom(getVariantNames("accessories")),
1024
+ skinColor: pickRandom(Object.keys(SKIN_PRESETS)),
1025
+ hairColor: pickRandom(Object.keys(HAIR_PRESETS)),
1026
+ eyeColor: pickRandom(Object.keys(EYE_PRESETS))
1027
+ };
1028
+ }
1029
+ function generateFace(config) {
1030
+ const resolved = config ?? generateRandomConfig();
1031
+ const grid = generateGrid(resolved);
1032
+ return gridToSvg(grid, resolved.backgroundColor);
1033
+ }
1034
+
1035
+ // src/renderer/animations.ts
1036
+ var ANIMATIONS = {
1037
+ idle: {
1038
+ name: "idle",
1039
+ frames: [
1040
+ { duration: 3e3, overrides: {} },
1041
+ { duration: 150, overrides: { eyes: "happy" } },
1042
+ { duration: 150, overrides: {} }
1043
+ ]
1044
+ },
1045
+ talk: {
1046
+ name: "talk",
1047
+ frames: [
1048
+ { duration: 200, overrides: { mouth: "smile" } },
1049
+ { duration: 200, overrides: { mouth: "open" } },
1050
+ { duration: 200, overrides: { mouth: "flat" } },
1051
+ { duration: 200, overrides: { mouth: "open" } },
1052
+ { duration: 300, overrides: { mouth: "smile" } }
1053
+ ]
1054
+ },
1055
+ blink: {
1056
+ name: "blink",
1057
+ frames: [
1058
+ { duration: 2500, overrides: {} },
1059
+ { duration: 100, overrides: { eyes: "narrow" } },
1060
+ { duration: 100, overrides: { eyes: "happy" } },
1061
+ { duration: 100, overrides: { eyes: "narrow" } },
1062
+ { duration: 200, overrides: {} }
1063
+ ]
1064
+ },
1065
+ emote: {
1066
+ name: "emote",
1067
+ frames: [
1068
+ { duration: 500, overrides: {} },
1069
+ { duration: 400, overrides: { eyebrows: "arched", mouth: "open" } },
1070
+ { duration: 400, overrides: { eyebrows: "arched", mouth: "smile" } },
1071
+ { duration: 300, overrides: {} }
1072
+ ]
1073
+ }
1074
+ };
1075
+
1076
+ // src/vue.ts
1077
+ function useAvatar(config) {
1078
+ let fallback;
1079
+ return (0, import_vue.computed)(() => {
1080
+ const c = config?.();
1081
+ if (c) return generateFace(c);
1082
+ if (!fallback) fallback = generateRandomConfig();
1083
+ return generateFace(fallback);
1084
+ });
1085
+ }
1086
+ function useAnimatedAvatar(config, animation) {
1087
+ const frameIndex = (0, import_vue.ref)(0);
1088
+ let timer;
1089
+ let fallback;
1090
+ const sequence = (0, import_vue.computed)(() => {
1091
+ const anim = animation();
1092
+ if (!anim) return void 0;
1093
+ if (typeof anim === "string") return ANIMATIONS[anim];
1094
+ return anim;
1095
+ });
1096
+ function scheduleNext() {
1097
+ const seq = sequence.value;
1098
+ if (!seq) return;
1099
+ const frame = seq.frames[frameIndex.value];
1100
+ if (!frame) return;
1101
+ timer = setTimeout(() => {
1102
+ frameIndex.value = (frameIndex.value + 1) % seq.frames.length;
1103
+ scheduleNext();
1104
+ }, frame.duration);
1105
+ }
1106
+ (0, import_vue.watch)(
1107
+ sequence,
1108
+ () => {
1109
+ if (timer !== void 0) clearTimeout(timer);
1110
+ frameIndex.value = 0;
1111
+ scheduleNext();
1112
+ },
1113
+ { immediate: true }
1114
+ );
1115
+ (0, import_vue.onUnmounted)(() => {
1116
+ if (timer !== void 0) clearTimeout(timer);
1117
+ });
1118
+ return (0, import_vue.computed)(() => {
1119
+ const seq = sequence.value;
1120
+ const base = config() ?? (fallback ?? (fallback = generateRandomConfig()));
1121
+ if (!seq) return generateFace(base);
1122
+ const frame = seq.frames[frameIndex.value];
1123
+ if (!frame) return generateFace(base);
1124
+ return generateFace({ ...base, ...frame.overrides });
1125
+ });
1126
+ }
1127
+ var Avatar = (0, import_vue.defineComponent)({
1128
+ name: "Avatar",
1129
+ props: {
1130
+ config: {
1131
+ type: Object,
1132
+ default: void 0
1133
+ },
1134
+ size: {
1135
+ type: Number,
1136
+ default: 128
1137
+ },
1138
+ animation: {
1139
+ type: [String, Object],
1140
+ default: void 0
1141
+ }
1142
+ },
1143
+ setup(props) {
1144
+ const svg = useAnimatedAvatar(
1145
+ () => props.config,
1146
+ () => props.animation
1147
+ );
1148
+ return () => (0, import_vue.h)("div", {
1149
+ innerHTML: svg.value,
1150
+ style: {
1151
+ width: `${props.size}px`,
1152
+ height: `${props.size}px`,
1153
+ imageRendering: "pixelated"
1154
+ }
1155
+ });
1156
+ }
1157
+ });
1158
+ // Annotate the CommonJS export names for ESM import in node:
1159
+ 0 && (module.exports = {
1160
+ Avatar,
1161
+ generateRandomConfig,
1162
+ useAnimatedAvatar,
1163
+ useAvatar
1164
+ });
1165
+ //# sourceMappingURL=vue.cjs.map