@ignaciocabeza/bitface 1.0.0 → 1.0.1

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/react.cjs CHANGED
@@ -1,1155 +1 @@
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/react.tsx
21
- var react_exports = {};
22
- __export(react_exports, {
23
- Avatar: () => Avatar,
24
- generateRandomConfig: () => generateRandomConfig,
25
- useAnimatedAvatar: () => useAnimatedAvatar,
26
- useAvatar: () => useAvatar
27
- });
28
- module.exports = __toCommonJS(react_exports);
29
- var import_react = require("react");
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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, 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/react.tsx
1077
- var import_jsx_runtime = require("react/jsx-runtime");
1078
- function useAvatar(config) {
1079
- const stableConfig = (0, import_react.useRef)(void 0);
1080
- if (!config && !stableConfig.current) {
1081
- stableConfig.current = generateRandomConfig();
1082
- }
1083
- const resolved = config ?? stableConfig.current;
1084
- return (0, import_react.useMemo)(() => generateFace(resolved), [
1085
- resolved.faceShape,
1086
- resolved.eyes,
1087
- resolved.eyebrows,
1088
- resolved.mouth,
1089
- resolved.nose,
1090
- resolved.ears,
1091
- resolved.hair,
1092
- resolved.beard,
1093
- resolved.accessories,
1094
- resolved.skinColor,
1095
- resolved.hairColor,
1096
- resolved.eyeColor,
1097
- resolved.backgroundColor
1098
- ]);
1099
- }
1100
- function useAnimatedAvatar(config, animation) {
1101
- const stableConfig = (0, import_react.useRef)(void 0);
1102
- if (!config && !stableConfig.current) {
1103
- stableConfig.current = generateRandomConfig();
1104
- }
1105
- const resolved = config ?? stableConfig.current;
1106
- const sequence = (0, import_react.useMemo)(() => {
1107
- if (!animation) return void 0;
1108
- if (typeof animation === "string") return ANIMATIONS[animation];
1109
- return animation;
1110
- }, [animation]);
1111
- const [frameIndex, setFrameIndex] = (0, import_react.useState)(0);
1112
- (0, import_react.useEffect)(() => {
1113
- setFrameIndex(0);
1114
- }, [sequence]);
1115
- (0, import_react.useEffect)(() => {
1116
- if (!sequence) return;
1117
- const frame = sequence.frames[frameIndex];
1118
- if (!frame) return;
1119
- const timer = setTimeout(() => {
1120
- setFrameIndex((i) => (i + 1) % sequence.frames.length);
1121
- }, frame.duration);
1122
- return () => clearTimeout(timer);
1123
- }, [sequence, frameIndex]);
1124
- const mergedConfig = (0, import_react.useMemo)(() => {
1125
- if (!sequence) return resolved;
1126
- const frame = sequence.frames[frameIndex];
1127
- if (!frame) return resolved;
1128
- return { ...resolved, ...frame.overrides };
1129
- }, [resolved, sequence, frameIndex]);
1130
- return useAvatar(mergedConfig);
1131
- }
1132
- function Avatar({
1133
- config,
1134
- size = 128,
1135
- className,
1136
- animation
1137
- }) {
1138
- const svg = useAnimatedAvatar(config, animation);
1139
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
1140
- "div",
1141
- {
1142
- className,
1143
- style: { width: size, height: size, imageRendering: "pixelated" },
1144
- dangerouslySetInnerHTML: { __html: svg }
1145
- }
1146
- );
1147
- }
1148
- // Annotate the CommonJS export names for ESM import in node:
1149
- 0 && (module.exports = {
1150
- Avatar,
1151
- generateRandomConfig,
1152
- useAnimatedAvatar,
1153
- useAvatar
1154
- });
1155
- //# sourceMappingURL=react.cjs.map
1
+ "use strict";var M=Object.defineProperty;var q=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var H=Object.prototype.hasOwnProperty;var L=(e,t)=>{for(var o in t)M(e,o,{get:t[o],enumerable:!0})},z=(e,t,o,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of j(t))!H.call(e,r)&&r!==o&&M(e,r,{get:()=>t[r],enumerable:!(s=q(t,r))||s.enumerable});return e};var V=e=>z(M({},"__esModule",{value:!0}),e);var g1={};L(g1,{Avatar:()=>c1,generateRandomConfig:()=>u,useAnimatedAvatar:()=>$,useAvatar:()=>O});module.exports=V(g1);var f=require("react");var U={round:{pixels:[[0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0],[0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0],[0,0,1,1,1,1,1,1,1,1,1,1,1,1,0,0],[0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0],[0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0],[0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0],[0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0],[0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0],[0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0],[0,0,1,1,1,1,1,1,1,1,1,1,1,1,0,0],[0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0],[0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0]],slotMap:{1:"skin",2:"skinShadow"},offsetX:0,offsetY:3},oval:{pixels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1,1,1,1,1,1,0,0,0],[0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0],[0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0],[0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0]],slotMap:{1:"skin",2:"skinShadow"},offsetX:0,offsetY:3},wide:{pixels:[[0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0],[0,0,1,1,1,1,1,1,1,1,1,1,1,1,0,0],[0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0],[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],[0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0],[0,0,1,1,1,1,1,1,1,1,1,1,1,1,0,0],[0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0],[0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0]],slotMap:{1:"skin",2:"skinShadow"},offsetX:0,offsetY:3}},S=U;var W={big:{pixels:[[1,1,0,0,0,0,1,1],[1,2,1,0,0,1,2,1],[1,2,3,0,0,1,2,3],[1,1,0,0,0,0,1,1]],slotMap:{1:"white",2:"eyes",3:"pupil"},offsetX:4,offsetY:7},small:{pixels:[[0,2,0,0,0,0,2,0],[0,3,0,0,0,0,3,0]],slotMap:{2:"eyes",3:"pupil"},offsetX:4,offsetY:8},narrow:{pixels:[[1,2,3,0,0,1,2,3]],slotMap:{1:"white",2:"eyes",3:"pupil"},offsetX:4,offsetY:8},round:{pixels:[[0,1,0,0,0,0,1,0],[1,2,1,0,0,1,2,1],[1,2,3,0,0,1,2,3],[0,1,0,0,0,0,1,0]],slotMap:{1:"white",2:"eyes",3:"pupil"},offsetX:4,offsetY:7},wink:{pixels:[[1,1,0,0,0,0,0,0],[1,2,1,0,0,0,0,0],[1,2,3,0,0,3,3,3],[1,1,0,0,0,0,0,0]],slotMap:{1:"white",2:"eyes",3:"pupil"},offsetX:4,offsetY:7},happy:{pixels:[[0,3,3,0,0,0,3,3],[3,0,0,0,0,3,0,0]],slotMap:{3:"pupil"},offsetX:4,offsetY:8},angry:{pixels:[[1,1,0,0,0,0,1,1],[1,2,3,0,0,3,2,1],[0,1,1,0,0,1,1,0]],slotMap:{1:"white",2:"eyes",3:"pupil"},offsetX:4,offsetY:7},dots:{pixels:[[0,0,3,0,0,0,0,3]],slotMap:{3:"pupil"},offsetX:4,offsetY:9},sleepy:{pixels:[[1,1,0,0,0,0,1,1],[3,3,0,0,0,0,3,3]],slotMap:{1:"white",3:"pupil"},offsetX:4,offsetY:8},cross:{pixels:[[3,0,3,0,0,3,0,3],[0,3,0,0,0,0,3,0],[3,0,3,0,0,3,0,3]],slotMap:{3:"pupil"},offsetX:4,offsetY:7},heart:{pixels:[[2,0,2,0,0,2,0,2],[2,2,2,0,0,2,2,2],[0,2,0,0,0,0,2,0]],slotMap:{2:"eyes"},offsetX:4,offsetY:7}},w=W;var Z={thick:{pixels:[[1,1,1,0,0,1,1,1],[1,1,1,0,0,1,1,1]],slotMap:{1:"hair"},offsetX:4,offsetY:6},thin:{pixels:[[1,1,1,0,0,1,1,1]],slotMap:{1:"hair"},offsetX:4,offsetY:6},arched:{pixels:[[0,1,1,0,0,0,1,1],[1,0,0,0,0,1,0,0]],slotMap:{1:"hair"},offsetX:4,offsetY:5},angry:{pixels:[[1,0,0,0,0,0,0,1],[0,1,1,0,0,1,1,0]],slotMap:{1:"hair"},offsetX:4,offsetY:5},worried:{pixels:[[0,0,1,0,0,1,0,0],[0,1,0,0,0,0,1,0]],slotMap:{1:"hair"},offsetX:4,offsetY:5},unibrow:{pixels:[[1,1,1,1,1,1,1,1],[1,1,0,0,0,0,1,1]],slotMap:{1:"hair"},offsetX:4,offsetY:5},none:{pixels:[],slotMap:{},offsetX:0,offsetY:0}},Y=Z;var J={smile:{pixels:[[1,0,0,0,0,1],[0,1,1,1,1,0]],slotMap:{1:"mouth"},offsetX:5,offsetY:12},frown:{pixels:[[0,1,1,1,1,0],[1,0,0,0,0,1]],slotMap:{1:"mouth"},offsetX:5,offsetY:12},open:{pixels:[[0,1,1,1,1,0],[1,1,1,1,1,1],[0,1,1,1,1,0]],slotMap:{1:"mouth"},offsetX:5,offsetY:11},flat:{pixels:[[1,1,1,1,1,1]],slotMap:{1:"mouth"},offsetX:5,offsetY:12},teeth:{pixels:[[0,1,1,1,1,0],[0,2,2,2,2,0],[0,1,1,1,1,0]],slotMap:{1:"mouth",2:"white"},offsetX:5,offsetY:11},smirk:{pixels:[[0,0,0,0,1,0],[0,1,1,1,0,0]],slotMap:{1:"mouth"},offsetX:5,offsetY:12},grin:{pixels:[[0,1,1,1,1,1,1,0],[0,1,2,2,2,2,1,0],[0,0,1,1,1,1,0,0]],slotMap:{1:"mouth",2:"white"},offsetX:4,offsetY:11},tongue:{pixels:[[0,1,1,1,1,0],[0,0,1,1,0,0],[0,0,0,1,0,0]],slotMap:{1:"mouth"},offsetX:5,offsetY:12},oh:{pixels:[[0,1,1,0],[1,0,0,1],[0,1,1,0]],slotMap:{1:"mouth"},offsetX:6,offsetY:11}},X=J;var Q={small:{pixels:[[0,1,0],[1,0,1]],slotMap:{1:"skinShadow"},offsetX:7,offsetY:10},pointy:{pixels:[[0,1,0],[0,1,0],[1,0,1]],slotMap:{1:"skinShadow"},offsetX:7,offsetY:9},wide:{pixels:[[0,1,1,0],[1,0,0,1],[1,0,0,1]],slotMap:{1:"skinShadow"},offsetX:6,offsetY:9},button:{pixels:[[1,1]],slotMap:{1:"skinShadow"},offsetX:7,offsetY:10},long:{pixels:[[0,1,0],[0,1,0],[0,1,0],[1,0,1]],slotMap:{1:"skinShadow"},offsetX:7,offsetY:8},snub:{pixels:[[0,1],[1,1]],slotMap:{1:"skinShadow"},offsetX:7,offsetY:10}},b=Q;var e1={small:{pixels:[[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],[2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2]],slotMap:{1:"skin",2:"skinShadow"},offsetX:0,offsetY:8},big:{pixels:[[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],[2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2],[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1]],slotMap:{1:"skin",2:"skinShadow"},offsetX:0,offsetY:7},pointed:{pixels:[[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],[2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2]],slotMap:{1:"skin",2:"skinShadow"},offsetX:0,offsetY:5},elf:{pixels:[[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],[1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1],[1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1],[1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1],[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],[2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2]],slotMap:{1:"skin",2:"skinShadow"},offsetX:0,offsetY:4},none:{pixels:[],slotMap:{},offsetX:0,offsetY:0}},A=e1;var t1={short:{pixels:[[0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0],[0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0],[0,0,1,1,1,1,1,1,1,1,1,1,1,1,0,0],[0,1,2,2,0,0,0,0,0,0,0,0,2,2,1,0]],slotMap:{1:"hair",2:"hairShadow"},offsetX:0,offsetY:2},long:{pixels:[[0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0],[0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0],[0,0,1,1,1,1,1,1,1,1,1,1,1,1,0,0],[0,1,1,2,0,0,0,0,0,0,0,0,2,1,1,0],[0,1,2,0,0,0,0,0,0,0,0,0,0,2,1,0],[0,1,2,0,0,0,0,0,0,0,0,0,0,2,1,0],[0,1,1,0,0,0,0,0,0,0,0,0,0,1,1,0],[0,1,1,0,0,0,0,0,0,0,0,0,0,1,1,0],[0,1,1,0,0,0,0,0,0,0,0,0,0,1,1,0],[0,1,1,0,0,0,0,0,0,0,0,0,0,1,1,0],[0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0],[0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0]],slotMap:{1:"hair",2:"hairShadow"},offsetX:0,offsetY:2},curly:{pixels:[[0,0,0,1,0,1,1,1,1,1,1,0,1,0,0,0],[0,0,1,0,1,1,1,1,1,1,1,1,0,1,0,0],[0,1,0,1,1,1,1,1,1,1,1,1,1,0,1,0],[0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0],[1,1,1,0,0,0,0,0,0,0,0,0,0,1,1,1],[1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1],[0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0],[1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,1],[0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0]],slotMap:{1:"hair",2:"hairShadow"},offsetX:0,offsetY:1},mohawk:{pixels:[[0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0],[0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0],[0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0],[0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0],[0,0,0,0,0,2,1,1,1,1,2,0,0,0,0,0]],slotMap:{1:"hair",2:"hairShadow"},offsetX:0,offsetY:0},bald:{pixels:[],slotMap:{},offsetX:0,offsetY:0},ponytail:{pixels:[[0,0,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],[1,1,1,2,0,0,0,0,0,0,0,0,2,1,1,1],[1,1,2,0,0,0,0,0,0,0,0,0,0,2,1,1],[1,2,0,0,0,0,0,0,0,0,0,0,0,0,2,1],[1,2,0,0,0,0,0,0,0,0,0,0,0,0,2,1]],slotMap:{1:"hair",2:"hairShadow"},offsetX:0,offsetY:0},bangs:{pixels:[[0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0],[0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0],[0,0,1,1,1,1,1,1,1,1,1,1,1,1,0,0],[0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0],[0,1,1,1,1,1,1,2,0,0,0,0,2,1,1,0]],slotMap:{1:"hair",2:"hairShadow"},offsetX:0,offsetY:2}},k=t1;var o1={stubble:{pixels:[[0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0],[0,0,0,0,1,0,1,0,1,0,1,0,0,0,0,0]],slotMap:{1:"hair"},offsetX:0,offsetY:13},goatee:{pixels:[[0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0],[0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0]],slotMap:{1:"hair"},offsetX:0,offsetY:13},full:{pixels:[[0,0,1,1,0,0,0,0,0,0,0,0,1,1,0,0],[0,0,0,1,1,0,0,0,0,0,0,1,1,0,0,0],[0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0],[0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0]],slotMap:{1:"hair"},offsetX:0,offsetY:11},mustache:{pixels:[[0,0,1,1,0,0,1,1,0,0],[0,1,0,0,1,1,0,0,1,0]],slotMap:{1:"hair"},offsetX:3,offsetY:11},handlebar:{pixels:[[0,0,1,1,0,0,0,0,1,1,0,0],[0,1,0,0,1,1,1,1,0,0,1,0],[1,0,0,0,0,0,0,0,0,0,0,1]],slotMap:{1:"hair"},offsetX:2,offsetY:11},none:{pixels:[],slotMap:{},offsetX:0,offsetY:0}},P=o1;var r1={glasses:{pixels:[[0,0,1,1,1,1,0,0,1,1,1,1,0,0],[1,1,1,3,3,1,1,1,1,3,3,1,1,1],[0,0,1,1,1,1,0,0,1,1,1,1,0,0]],slotMap:{1:"accessoryPrimary",3:"lens"},offsetX:1,offsetY:7},sunglasses:{pixels:[[0,0,1,1,1,1,1,1,1,1,1,1,0,0],[1,1,1,2,2,1,1,1,1,2,2,1,1,1],[0,0,1,1,1,1,0,0,1,1,1,1,0,0]],slotMap:{1:"accessoryPrimary",2:"accessorySecondary"},offsetX:1,offsetY:7},hat:{pixels:[[0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0],[0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0],[0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0],[0,1,2,2,2,2,2,2,2,2,2,2,2,2,1,0]],slotMap:{1:"accessoryPrimary",2:"accessorySecondary"},offsetX:0,offsetY:0},headband:{pixels:[[0,0,1,1,1,1,1,2,1,1,1,1,1,1,0,0]],slotMap:{1:"accessoryPrimary",2:"accessorySecondary"},offsetX:0,offsetY:5},earrings:{pixels:[[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1]],slotMap:{1:"accessoryPrimary"},offsetX:0,offsetY:11},none:{pixels:[],slotMap:{},offsetX:0,offsetY:0}},E=r1;var F={faceShape:S,eyes:w,eyebrows:Y,mouth:X,nose:b,ears:A,hair:k,beard:P,accessories:E};function v(e,t){return F[e]?.[t]}function c(e){let t=F[e];return t?Object.keys(t):[]}var m={light:"#FDDCB5",medium:"#E8B88A",tan:"#D19A6A",brown:"#A0673C",dark:"#6B4226",pale:"#FFF0E0"},s1={"#FDDCB5":"#E5C49D","#E8B88A":"#CFA072","#D19A6A":"#B98252","#A0673C":"#885524","#6B4226":"#533010","#FFF0E0":"#E7D8C8"},h={black:"#1A1A2E",brown:"#6B3A2A",blonde:"#E8C84A",red:"#B83A1E",gray:"#9E9E9E",white:"#E8E8E8",auburn:"#8B3A1A",strawberry:"#D4713A",platinum:"#E8E0D0",pink:"#E8559E",blue:"#3A6BD5",purple:"#6B3A8B",teal:"#2A9E8B"},y={brown:"#5C3A1E",blue:"#3A7BD5",green:"#3A9D5C",gray:"#7A7A7A"},i1=/^#(?:[0-9a-fA-F]{3,4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/;function x(e,t){return i1.test(e)?e:t}function R(e){return e?m[e]??x(e,m.medium):m.medium}function B(e){return s1[e]??n1(e,30)}function T(e){return e?h[e]??x(e,h.black):h.black}function D(e){return e?y[e]??x(e,y.brown):y.brown}function n1(e,t){let o=parseInt(e.replace("#",""),16),s=Math.max(0,(o>>16)-t),r=Math.max(0,(o>>8&255)-t),i=Math.max(0,(o&255)-t);return`#${(s<<16|r<<8|i).toString(16).padStart(6,"0").toUpperCase()}`}var C=16;function a1(e){let t=R(e.skinColor),o=B(t),s=T(e.hairColor),r=D(e.eyeColor);return{skin:t,skinShadow:o,hair:s,hairShadow:f1(s,25),eyes:r,pupil:"#111111",white:"#FFFFFF",mouth:"#C75050",accessoryPrimary:"#333333",accessorySecondary:"#1A1A1A",lens:"#87CEEB"}}function f1(e,t){let o=parseInt(e.replace("#",""),16),s=Math.max(0,(o>>16)-t),r=Math.max(0,(o>>8&255)-t),i=Math.max(0,(o&255)-t);return`#${(s<<16|r<<8|i).toString(16).padStart(6,"0")}`}function p1(e,t,o){for(let s=0;s<t.pixels.length;s++){let r=t.pixels[s];for(let i=0;i<r.length;i++){let g=r[i];if(g===0)continue;let l=t.slotMap[g];if(!l)continue;let n=o[l];if(!n)continue;let d=t.offsetX+i,p=t.offsetY+s;d>=0&&d<C&&p>=0&&p<C&&(e[p][d]=n)}}}var l1=[{category:"faceShape",configKey:"faceShape"},{category:"ears",configKey:"ears"},{category:"nose",configKey:"nose"},{category:"mouth",configKey:"mouth"},{category:"eyes",configKey:"eyes"},{category:"eyebrows",configKey:"eyebrows"},{category:"hair",configKey:"hair"},{category:"beard",configKey:"beard"},{category:"accessories",configKey:"accessories"}];function I(e){let t=Array.from({length:C},()=>Array.from({length:C},()=>null)),o=a1(e);for(let s of l1){let r=e[s.configKey];if(!r||r==="none")continue;let i=v(s.category,r);i&&p1(t,i,o)}return t}function K(e,t){let o=e.length,s=o>0?e[0].length:0,r=t??"#87CEEB",i=r==="transparent"?"transparent":x(r,"#87CEEB"),g=[];i!=="transparent"&&g.push(`<rect width="${s}" height="${o}" fill="${i}"/>`);for(let l=0;l<o;l++){let n=0;for(;n<s;){let d=e[l][n];if(d===null){n++;continue}let p=1;for(;n+p<s&&e[l][n+p]===d;)p++;g.push(`<rect x="${n}" y="${l}" width="${p}" height="1" fill="${d}"/>`),n+=p}}return[`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${s} ${o}" shape-rendering="crispEdges">`,...g,"</svg>"].join("")}function a(e){return e[Math.floor(Math.random()*e.length)]}function u(){return{faceShape:a(c("faceShape")),eyes:a(c("eyes")),eyebrows:a(c("eyebrows")),mouth:a(c("mouth")),nose:a(c("nose")),ears:a(c("ears")),hair:a(c("hair")),beard:a(c("beard")),accessories:a(c("accessories")),skinColor:a(Object.keys(m)),hairColor:a(Object.keys(h)),eyeColor:a(Object.keys(y))}}function _(e){let t=e??u(),o=I(t);return K(o,t.backgroundColor)}var N={idle:{name:"idle",frames:[{duration:3e3,overrides:{}},{duration:150,overrides:{eyes:"happy"}},{duration:150,overrides:{}}]},talk:{name:"talk",frames:[{duration:200,overrides:{mouth:"smile"}},{duration:200,overrides:{mouth:"open"}},{duration:200,overrides:{mouth:"flat"}},{duration:200,overrides:{mouth:"open"}},{duration:300,overrides:{mouth:"smile"}}]},blink:{name:"blink",frames:[{duration:2500,overrides:{}},{duration:100,overrides:{eyes:"narrow"}},{duration:100,overrides:{eyes:"happy"}},{duration:100,overrides:{eyes:"narrow"}},{duration:200,overrides:{}}]},emote:{name:"emote",frames:[{duration:500,overrides:{}},{duration:400,overrides:{eyebrows:"arched",mouth:"open"}},{duration:400,overrides:{eyebrows:"arched",mouth:"smile"}},{duration:300,overrides:{}}]}};var G=require("react/jsx-runtime");function O(e){let t=(0,f.useRef)(void 0);!e&&!t.current&&(t.current=u());let o=e??t.current;return(0,f.useMemo)(()=>_(o),[o.faceShape,o.eyes,o.eyebrows,o.mouth,o.nose,o.ears,o.hair,o.beard,o.accessories,o.skinColor,o.hairColor,o.eyeColor,o.backgroundColor])}function $(e,t){let o=(0,f.useRef)(void 0);!e&&!o.current&&(o.current=u());let s=e??o.current,r=(0,f.useMemo)(()=>{if(t)return typeof t=="string"?N[t]:t},[t]),[i,g]=(0,f.useState)(0);(0,f.useEffect)(()=>{g(0)},[r]),(0,f.useEffect)(()=>{if(!r)return;let n=r.frames[i];if(!n)return;let d=setTimeout(()=>{g(p=>(p+1)%r.frames.length)},n.duration);return()=>clearTimeout(d)},[r,i]);let l=(0,f.useMemo)(()=>{if(!r)return s;let n=r.frames[i];return n?{...s,...n.overrides}:s},[s,r,i]);return O(l)}function c1({config:e,size:t=128,className:o,animation:s}){let r=$(e,s);return(0,G.jsx)("div",{className:o,style:{width:t,height:t,imageRendering:"pixelated"},dangerouslySetInnerHTML:{__html:r}})}0&&(module.exports={Avatar,generateRandomConfig,useAnimatedAvatar,useAvatar});