@idosgames/characters 0.1.7 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/{PartsManager-CmrzoyJR.d.cts → PartsManager-CjsNhtVp.d.cts} +1 -1
  2. package/dist/{PartsManager-BpAUMQXw.d.ts → PartsManager-DzJD-pyV.d.ts} +1 -1
  3. package/dist/{chunk-JZU255IQ.js → chunk-7P4UMCIQ.js} +1 -1
  4. package/dist/chunk-MNDPJKUD.js +1 -0
  5. package/dist/chunk-UFZRW76X.js +2 -0
  6. package/dist/{chunk-CMQ6UYQV.js → chunk-XUQ63CSO.js} +1 -1
  7. package/dist/{chunk-I7UPBAMR.js → chunk-YXOP7OHP.js} +1 -1
  8. package/dist/contract-BtI1o_ow.d.cts +49 -0
  9. package/dist/contract-BtI1o_ow.d.ts +49 -0
  10. package/dist/gltf/index.cjs +1 -1
  11. package/dist/gltf/index.d.cts +1 -1
  12. package/dist/gltf/index.d.ts +1 -1
  13. package/dist/gltf/index.js +1 -1
  14. package/dist/index.cjs +1 -1
  15. package/dist/index.d.cts +2 -2
  16. package/dist/index.d.ts +2 -2
  17. package/dist/index.js +1 -1
  18. package/dist/rig2d/editor/index.cjs +2 -2
  19. package/dist/rig2d/editor/index.d.cts +3 -3
  20. package/dist/rig2d/editor/index.d.ts +3 -3
  21. package/dist/rig2d/editor/index.js +1 -1
  22. package/dist/rig2d/index.cjs +4 -4
  23. package/dist/rig2d/index.d.cts +4 -4
  24. package/dist/rig2d/index.d.ts +4 -4
  25. package/dist/rig2d/index.js +1 -1
  26. package/dist/rig2d/phaser/index.cjs +2 -2
  27. package/dist/rig2d/phaser/index.d.cts +2 -2
  28. package/dist/rig2d/phaser/index.d.ts +2 -2
  29. package/dist/rig2d/phaser/index.js +1 -1
  30. package/dist/rig2d/three/index.cjs +2 -2
  31. package/dist/rig2d/three/index.d.cts +2 -2
  32. package/dist/rig2d/three/index.d.ts +2 -2
  33. package/dist/rig2d/three/index.js +1 -1
  34. package/dist/{thumbnail-B7wrQe1B.d.ts → thumbnail-BRsomuLZ.d.ts} +1 -1
  35. package/dist/{thumbnail-B1WjbWcW.d.cts → thumbnail-CTpr-C1A.d.cts} +1 -1
  36. package/dist/voxel/index.cjs +31 -8
  37. package/dist/voxel/index.d.cts +1082 -27
  38. package/dist/voxel/index.d.ts +1082 -27
  39. package/dist/voxel/index.js +31 -8
  40. package/package.json +1 -1
  41. package/dist/chunk-64D567CX.js +0 -1
  42. package/dist/chunk-UUX4NEC2.js +0 -2
  43. package/dist/contract-DhZuKNIf.d.cts +0 -24
  44. package/dist/contract-DhZuKNIf.d.ts +0 -24
@@ -1,19 +1,42 @@
1
- import {a as a$1}from'../chunk-64D567CX.js';export{a as EMOTIONS,b as isEmotion}from'../chunk-64D567CX.js';import {c,d}from'../chunk-YOAPVGXE.js';import {b,a}from'../chunk-CGF2TQVK.js';import*as _ from'three';import {mergeGeometries}from'three/examples/jsm/utils/BufferGeometryUtils.js';var ar={id:"avatar",label:"\u0410\u0432\u0430\u0442\u0430\u0440",hint:"the iDos Games account avatar: soft blocks with elbows and knees",bones:[{name:"body",role:"body",parent:null,pivot:[0,12.4,0]},{name:"head",role:"head",parent:"body",pivot:[0,22.4,0]},{name:"armL",role:"armL",parent:"body",pivot:[-6.3,21.4,0]},{name:"armR",role:"armR",parent:"body",pivot:[6.3,21.4,0]},{name:"foreArmL",role:"foreArmL",parent:"armL",pivot:[-6.3,17.2,0]},{name:"foreArmR",role:"foreArmR",parent:"armR",pivot:[6.3,17.2,0]},{name:"legL",role:"legL",parent:null,pivot:[-2.1,12.4,0]},{name:"legR",role:"legR",parent:null,pivot:[2.1,12.4,0]},{name:"shinL",role:"shinL",parent:"legL",pivot:[-2.1,6.4,0]},{name:"shinR",role:"shinR",parent:"legR",pivot:[2.1,6.4,0]}],sockets:[{name:"handR",bone:"foreArmR",at:[6.3,11.6,-1]},{name:"handL",bone:"foreArmL",at:[-6.3,11.6,-1]},{name:"headTop",bone:"head",at:[0,30.3,0]},{name:"face",bone:"head",at:[0,26.7,-4]},{name:"back",bone:"body",at:[0,18.5,2.3]},{name:"waist",bone:"body",at:[0,12.8,0]},{name:"shoulders",bone:"body",at:[0,22.4,0]}],hitbox:{w:.6,h:1.9},eye:26.4,height:{min:24,max:40},faceBone:"head",defaultParts:[{bone:"head",size:[8.5,7.5,8],pos:[0,26.5,0],color:"s",name:"head"},{bone:"head",size:[2.9,.8,2.7],pos:[0,22.6,0],color:"s",name:"neck"},{bone:"body",size:[9,6,4.6],pos:[0,19.4,0],color:"t",name:"torso"},{bone:"body",size:[8.5,5.2,4.3],pos:[0,15,0],color:"t",name:"torso"},{bone:"armL",size:[3.6,5,3.6],pos:[-6.3,19.7,0],color:"s",name:"sleeveL"},{bone:"armR",size:[3.6,5,3.6],pos:[6.3,19.7,0],color:"s",name:"sleeveR"},{bone:"foreArmL",size:[3.45,5.4,3.45],pos:[-6.3,15.7,0],color:"s",name:"forearmL"},{bone:"foreArmR",size:[3.45,5.4,3.45],pos:[6.3,15.7,0],color:"s",name:"forearmR"},{bone:"foreArmL",size:[3.3,3,3.3],pos:[-6.3,12.7,0],color:"s",name:"handL"},{bone:"foreArmR",size:[3.3,3,3.3],pos:[6.3,12.7,0],color:"s",name:"handR"},{bone:"legL",size:[4.2,6,4.2],pos:[-2.1,9.4,0],color:"p",name:"legL"},{bone:"legR",size:[4.2,6,4.2],pos:[2.1,9.4,0],color:"p",name:"legR"},{bone:"shinL",size:[4.05,7.2,4.05],pos:[-2.1,4,0],color:"p",name:"legL"},{bone:"shinR",size:[4.05,7.2,4.05],pos:[2.1,4,0],color:"p",name:"legR"},{bone:"shinL",size:[4.2,1.6,5.2],pos:[-2.1,.8,-0.5],color:"p",name:"footL"},{bone:"shinR",size:[4.2,1.6,5.2],pos:[2.1,.8,-0.5],color:"p",name:"footR"}]};var sr={id:"blob",label:"\u041A\u0430\u043F\u043B\u044F",hint:"slimes, ghosts, spirits, living objects \u2014 one body with a face, moves by hopping",bones:[{name:"body",role:"body",parent:null,pivot:[0,0,0]}],sockets:[{name:"headTop",bone:"body",at:[0,12,0]},{name:"face",bone:"body",at:[0,7,-6]},{name:"back",bone:"body",at:[0,6,6]},{name:"waist",bone:"body",at:[0,3,0]},{name:"shoulders",bone:"body",at:[0,10,0]},{name:"handR",bone:"body",at:[6,5,-2]},{name:"handL",bone:"body",at:[-6,5,-2]}],hitbox:{w:.8,h:.8},eye:8,height:{min:4,max:40},faceBone:"body",defaultParts:[{bone:"body",size:[12,12,12],pos:[0,6,0],color:"t"}]};var ir={id:"flyer",label:"\u041A\u0440\u044B\u043B\u0430\u0442\u044B\u0439",hint:"birds, bats, dragons, fairies, insects \u2014 creatures whose wings matter",bones:[{name:"body",role:"body",parent:null,pivot:[0,6,0]},{name:"head",role:"head",parent:"body",pivot:[0,11,-3]},{name:"wingL",role:"wingL",parent:"body",pivot:[-3,10,0]},{name:"wingR",role:"wingR",parent:"body",pivot:[3,10,0]},{name:"legL",role:"legL",parent:null,pivot:[-1.5,4,0]},{name:"legR",role:"legR",parent:null,pivot:[1.5,4,0]},{name:"tail",role:"tail",parent:"body",pivot:[0,8,4]}],sockets:[{name:"headTop",bone:"head",at:[0,16,-4]},{name:"face",bone:"head",at:[0,13,-7]},{name:"back",bone:"body",at:[0,11,1]},{name:"waist",bone:"body",at:[0,6,0]},{name:"shoulders",bone:"body",at:[0,10,-2]},{name:"handR",bone:"legR",at:[1.5,0,-1]},{name:"handL",bone:"legL",at:[-1.5,0,-1]}],hitbox:{w:.6,h:.9},eye:14,height:{min:6,max:40},faceBone:"head",defaultParts:[{bone:"body",size:[6,6,8],pos:[0,8,0],color:"t"},{bone:"head",size:[5,5,5],pos:[0,13,-4],color:"s"},{bone:"wingL",size:[8,1,6],pos:[-7,10,0],color:"t"},{bone:"wingR",size:[8,1,6],pos:[7,10,0],color:"t"},{bone:"legL",size:[1,4,1],pos:[-1.5,2,0],color:"p"},{bone:"legR",size:[1,4,1],pos:[1.5,2,0],color:"p"},{bone:"tail",size:[4,1,4],pos:[0,8,6],color:"t"}]};var lr={id:"humanoid",label:"\u0427\u0435\u043B\u043E\u0432\u0435\u043A",hint:"people, humanoids, robots, elves, zombies \u2014 anything on two legs with two arms",bones:[{name:"body",role:"body",parent:null,pivot:[0,12,0]},{name:"head",role:"head",parent:"body",pivot:[0,24,0]},{name:"armL",role:"armL",parent:"body",pivot:[-6,22,0]},{name:"armR",role:"armR",parent:"body",pivot:[6,22,0]},{name:"legL",role:"legL",parent:null,pivot:[-2,12,0]},{name:"legR",role:"legR",parent:null,pivot:[2,12,0]}],sockets:[{name:"handR",bone:"armR",at:[6,11,-1]},{name:"handL",bone:"armL",at:[-6,11,-1]},{name:"headTop",bone:"head",at:[0,32,0]},{name:"face",bone:"head",at:[0,28,-4]},{name:"back",bone:"body",at:[0,18,2]},{name:"waist",bone:"body",at:[0,12,0]},{name:"shoulders",bone:"body",at:[0,24,0]}],hitbox:{w:.6,h:1.8},eye:27,height:{min:16,max:48},faceBone:"head",defaultParts:[{bone:"head",size:[8,8,8],pos:[0,28,0],color:"s"},{bone:"body",size:[8,12,4],pos:[0,18,0],color:"t"},{bone:"armL",size:[4,12,4],pos:[-6,18,0],color:"s"},{bone:"armR",size:[4,12,4],pos:[6,18,0],color:"s"},{bone:"legL",size:[4,12,4],pos:[-2,6,0],color:"p"},{bone:"legR",size:[4,12,4],pos:[2,6,0],color:"p"}]};var cr={id:"quadruped",label:"\u0427\u0435\u0442\u0432\u0435\u0440\u043E\u043D\u043E\u0433\u043E\u0435",hint:"dogs, cats, horses, wolves, bears, lizards \u2014 any animal on four legs",bones:[{name:"body",role:"body",parent:null,pivot:[0,12,0]},{name:"head",role:"head",parent:"body",pivot:[0,14,-8]},{name:"legFL",role:"legFL",parent:null,pivot:[-3,8,-6]},{name:"legFR",role:"legFR",parent:null,pivot:[3,8,-6]},{name:"legBL",role:"legBL",parent:null,pivot:[-3,8,6]},{name:"legBR",role:"legBR",parent:null,pivot:[3,8,6]},{name:"tail",role:"tail",parent:"body",pivot:[0,14,8]}],sockets:[{name:"headTop",bone:"head",at:[0,20,-12]},{name:"face",bone:"head",at:[0,16,-16]},{name:"back",bone:"body",at:[0,16,0]},{name:"waist",bone:"body",at:[0,12,4]},{name:"shoulders",bone:"body",at:[0,16,-6]},{name:"handR",bone:"head",at:[2,13,-16]},{name:"handL",bone:"head",at:[-2,13,-16]}],hitbox:{w:.9,h:1},eye:17,height:{min:8,max:40},faceBone:"head",defaultParts:[{bone:"body",size:[8,8,16],pos:[0,12,0],color:"t"},{bone:"head",size:[8,8,8],pos:[0,16,-12],color:"s"},{bone:"legFL",size:[3,8,3],pos:[-3,4,-6],color:"p"},{bone:"legFR",size:[3,8,3],pos:[3,4,-6],color:"p"},{bone:"legBL",size:[3,8,3],pos:[-3,4,6],color:"p"},{bone:"legBR",size:[3,8,3],pos:[3,4,6],color:"p"},{bone:"tail",size:[2,2,8],pos:[0,14,12],color:"t"}]};var qa=["root","body","head","armL","armR","legL","legR","foreArmL","foreArmR","shinL","shinR","legFL","legFR","legBL","legBR","tail","wingL","wingR","ear","hair","cape","antenna","static"],et=["tail","wingL","wingR","ear","hair","cape","antenna","static"],$a=["handR","handL","headTop","face","back","waist","shoulders"],He=["humanoid","quadruped","flyer","blob"],Pe="avatar";var ae={humanoid:lr,quadruped:cr,flyer:ir,blob:sr,avatar:ar};var pr=1,ue=["front","back","left","right","top","bottom"],Be=["neutral","blink","happy","sad","angry","surprised","scared","tired","hurt","talk"],Mt=["normal","bouncy","heavy","sneaky","robotic"],It=["calm","fidgety","proud"],dr={parts:64,bones:16,palette:32,textures:48,texturePixels:32768,textureSide:32,partSide:32,coord:64},Le={noise:.5,outline:.4,shade:.25,density:2},H=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),De=e=>Array.isArray(e)?e:[];function Q(e,t,r,o){let n=typeof e=="number"?e:typeof e=="string"?Number(e):NaN;return Number.isFinite(n)?Math.min(o,Math.max(r,n)):t}function Tt(e,t,r){if(typeof e!="string")return r;let o=e.trim();if(t.includes(o))return o;let n=o.toLowerCase().replace(/[\s-]+/g,"_");return t.find(i=>i.toLowerCase()===n)??r}function de(e,t,r){return typeof e=="string"?e.trim().slice(0,r):t}function tt(e,t,r=null){if(!Array.isArray(e)||e.length<3)return r;let o=e.slice(0,3).map(n=>Q(n,NaN,-t,t));return o.every(Number.isFinite)?o:r}var hr={black:"#1d1d21",white:"#f0f0f0",gray:"#808080",grey:"#808080",red:"#c0392b",green:"#3c9a3c",blue:"#2f5fd0",yellow:"#f2d33c",orange:"#e8862a",purple:"#8a4fc4",pink:"#f08cb4",brown:"#7a4f2a",cyan:"#2ab0c0",gold:"#d8b030",silver:"#c0c4c8",skin:"#c69c7c"};function fe(e){if(typeof e!="string")return null;let t=e.trim().toLowerCase();if(hr[t])return hr[t];let r=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/.exec(t);if(!r)return null;let o=r[1];return "#"+(o.length===3?o.split("").map(n=>n+n).join(""):o)}var be=new Set(["."," "]),mr=e=>/^[A-Za-z0-9_]{1,24}$/.test(e),to={human:"humanoid",biped:"humanoid",person:"humanoid",animal:"quadruped",four_legs:"quadruped",quadrupedal:"quadruped",bird:"flyer",winged:"flyer",dragon:"flyer",slime:"blob",ghost:"blob"};function ro(e){if(typeof e!="string")return "humanoid";let t=e.trim().toLowerCase().replace(/[\s-]+/g,"_");return He.includes(t)?t:t===Pe?Pe:to[t]??"humanoid"}function fr(e,t){let r=/^(.*?)(L|R)$/.exec(e);if(!r)return e;let o=r[1]+(r[2]==="L"?"R":"L");return t(o)?o:e}function se(e){if(typeof e=="string"){let d$1=d(e);if(!d$1.ok)return {ok:false,error:d$1.error,truncated:d$1.truncated};e=d$1.value;}if(!H(e))return {ok:false,error:c({en:"the character recipe is not an object",ru:"\u0440\u0435\u0446\u0435\u043F\u0442 \u043F\u0435\u0440\u0441\u043E\u043D\u0430\u0436\u0430 \u2014 \u043D\u0435 \u043E\u0431\u044A\u0435\u043A\u0442"})};if(!("parts"in e)&&!("rig"in e)){let d=e.character??e.spec??e.characterSpec;H(d)&&(e=d);}let t=e,r=dr,o=[];typeof t.version=="number"&&t.version>pr&&o.push(c({en:"recipe version {v} is newer than the game \u2014 read what could be read",ru:"\u0440\u0435\u0446\u0435\u043F\u0442 \u0432\u0435\u0440\u0441\u0438\u0438 {v} \u2014 \u043D\u043E\u0432\u0435\u0435 \u0438\u0433\u0440\u044B, \u0440\u0430\u0437\u043E\u0431\u0440\u0430\u043D\u043E \u0447\u0442\u043E \u043F\u043E\u043D\u044F\u0442\u043D\u043E"},{v:t.version}));let n=ro(t.rig),a=ae[n],i={};if(H(t.palette))for(let[d,x]of Object.entries(t.palette)){if(Object.keys(i).length>=r.palette){o.push(c({en:"the palette is longer than {n} \u2014 the rest was dropped",ru:"\u043F\u0430\u043B\u0438\u0442\u0440\u0430 \u0434\u043B\u0438\u043D\u043D\u0435\u0435 {n} \u2014 \u043B\u0438\u0448\u043D\u0435\u0435 \u043E\u0442\u0431\u0440\u043E\u0448\u0435\u043D\u043E"},{n:r.palette}));break}let E=fe(x);if(d.length!==1||be.has(d)||!E){o.push(c({en:"palette colour \xAB{k}\xBB was not understood",ru:"\u0446\u0432\u0435\u0442 \u043F\u0430\u043B\u0438\u0442\u0440\u044B \xAB{k}\xBB \u043D\u0435 \u043F\u043E\u043D\u044F\u0442"},{k:d}));continue}i[d]=E;}let c$1="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",s=(d,x)=>{if(typeof d!="string")return x;if(d.length===1&&i[d])return d;let E=fe(d);if(!E)return x;let R=Object.entries(i).find(([,P])=>P===E);if(R)return R[0];if(Object.keys(i).length>=r.palette)return x;let C=[...c$1].find(P=>!i[P]);return C?(i[C]=E,C):x},l={},h=0;if(H(t.textures))for(let[d,x]of Object.entries(t.textures)){if(!mr(d)){o.push(c({en:"texture name \xAB{id}\xBB does not fit",ru:"\u0438\u043C\u044F \u0442\u0435\u043A\u0441\u0442\u0443\u0440\u044B \xAB{id}\xBB \u043D\u0435 \u043F\u043E\u0434\u0445\u043E\u0434\u0438\u0442"},{id:d.slice(0,30)}));continue}if(Object.keys(l).length>=r.textures){o.push(c({en:"more than {n} textures \u2014 the rest were dropped",ru:"\u0442\u0435\u043A\u0441\u0442\u0443\u0440 \u0431\u043E\u043B\u044C\u0448\u0435 {n} \u2014 \u043B\u0438\u0448\u043D\u0438\u0435 \u043E\u0442\u0431\u0440\u043E\u0448\u0435\u043D\u044B"},{n:r.textures}));break}let E=ao(x,i,o,d);if(E){if(h+E.w*E.h>r.texturePixels){o.push(c({en:"texture \xAB{id}\xBB did not fit the pixel limit",ru:"\u0442\u0435\u043A\u0441\u0442\u0443\u0440\u0430 \xAB{id}\xBB \u043D\u0435 \u0432\u043B\u0435\u0437\u043B\u0430 \u0432 \u043B\u0438\u043C\u0438\u0442 \u043F\u0438\u043A\u0441\u0435\u043B\u0435\u0439"},{id:d}));continue}h+=E.w*E.h,l[d]=E;}}let m=new Set(a.bones.map(d=>d.name)),p=[];for(let d of De(t.bones)){if(!H(d))continue;let x=de(d.name,"",24);if(!x||!mr(x))continue;let E=tt(d.pivot,r.coord);if(!E||p.some(z=>z.name===x))continue;if(p.length>=r.bones){o.push(c({en:"more than {n} bones \u2014 the rest were dropped",ru:"\u043A\u043E\u0441\u0442\u0435\u0439 \u0431\u043E\u043B\u044C\u0448\u0435 {n} \u2014 \u043B\u0438\u0448\u043D\u0438\u0435 \u043E\u0442\u0431\u0440\u043E\u0448\u0435\u043D\u044B"},{n:r.bones}));break}let R=m.has(x),C=de(d.parent,"",24),P=R?a.bones.find(z=>z.name===x).parent??"":m.has(C)||p.some(z=>z.name===C)?C:a.bones.find(z=>z.role==="body").name;p.push({name:x,parent:P,pivot:E,role:R?"static":Tt(d.role,et,"static")}),m.add(x);}let b=Object.keys(i)[0]??"s",g=[];for(let d of De(t.parts)){if(g.length>=r.parts){o.push(c({en:"more than {n} parts \u2014 the rest were dropped",ru:"\u0434\u0435\u0442\u0430\u043B\u0435\u0439 \u0431\u043E\u043B\u044C\u0448\u0435 {n} \u2014 \u043B\u0438\u0448\u043D\u0438\u0435 \u043E\u0442\u0431\u0440\u043E\u0448\u0435\u043D\u044B"},{n:r.parts}));break}if(!H(d))continue;let x=tt(d.size,r.partSide),E=tt(d.pos??d.center??d.at,r.coord);if(!x||!E||x.some(j=>j<=0))continue;let R=de(d.bone,"",24);m.has(R)||(R&&o.push(c({en:"bone \xAB{b}\xBB not found \u2014 the part is on the body",ru:"\u043A\u043E\u0441\u0442\u044C \xAB{b}\xBB \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u0430 \u2014 \u0434\u0435\u0442\u0430\u043B\u044C \u043D\u0430 \u0442\u0435\u043B\u0435"},{b:R})),R=a.bones.find(j=>j.role==="body").name);let C={bone:R,size:x,pos:E,color:s(d.color,b)};if(H(d.faces)){let j={};for(let v of ue){let k=d.faces[v];if(typeof k=="string")if(l[k])j[v]=k;else {let M=s(k,"");M&&(j[v]=M);}}Object.keys(j).length&&(C.faces=j);}let P=tt(d.rot??d.rotation,180);P&&P.some(j=>j!==0)&&(C.rot=P),(d.mirror===true||d.mirror==="x")&&(C.mirror=true);let z=de(d.name,"",24);z&&(C.name=z),g.push(C);}if(!g.length){for(let[d,x]of Object.entries(oo))i[d]||(i[d]=x);g.push(...a.defaultParts.map(no));}let y=null;if(H(t.face)){let d=t.face,x=m.has(de(d.bone,"",24))?de(d.bone,"",24):a.faceBone,E=De(d.rect).map(C=>Math.round(Q(C,NaN,0,r.partSide)*10)/10),R={};if(H(d.expressions))for(let C of Be){let P=d.expressions[C];typeof P=="string"&&l[P]&&(R[C]=P);}if(!R.neutral){let C=Object.values(R)[0];C&&(R.neutral=C);}if(R.neutral){let C=l[R.neutral];y={bone:x,rect:E.length===4&&E.every(Number.isFinite)&&E[2]>0&&E[3]>0?E:[0,0,C.w,C.h],expressions:R};}else Object.keys(d).length&&o.push(c({en:"the face has no pictures \u2014 no face is drawn",ru:"\u0443 \u043B\u0438\u0446\u0430 \u043D\u0435\u0442 \u043D\u0438 \u043E\u0434\u043D\u043E\u0439 \u043A\u0430\u0440\u0442\u0438\u043D\u043A\u0438 \u2014 \u043B\u0438\u0446\u043E \u043D\u0435 \u043D\u0430\u0440\u0438\u0441\u043E\u0432\u0430\u043D\u043E"}));}let T=H(t.style)?t.style:{},A=H(t.voice)?t.voice:{},w=H(t.finish)?t.finish:{},f={version:pr,name:de(t.name,rt(),40)||rt(),description:de(t.description,"",300),rig:n,scale:Q(t.scale,1,.25,3),palette:i,textures:l,parts:g,bones:p,face:y,style:{walk:Tt(T.walk,Mt,"normal"),idle:Tt(T.idle,It,"calm"),energy:Q(T.energy,.5,0,1)},voice:{pitch:Q(A.pitch,1,.5,2)},tags:De(t.tags).filter(d=>typeof d=="string"&&!!d.trim()).slice(0,8).map(d=>d.trim().slice(0,24)),finish:{noise:Q(w.noise,Le.noise,0,1),outline:Q(w.outline,Le.outline,0,1),shade:Q(w.shade,Le.shade,0,1),density:Math.round(Q(w.density,Le.density,1,4))}},S=Q(w.round,0,0,1);return S>0&&(f.finish.round=S),{ok:true,spec:f,warnings:o}}var oo={s:"#c69c7c",t:"#3a8fd6",p:"#2c3e6b"};function no(e){return JSON.parse(JSON.stringify(e))}function ao(e,t,r,o){let n=Array.isArray(e)?{rows:e}:H(e)?e:null;if(!n)return null;let a=dr.textureSide,i=De(n.rows??n.pixels).filter(h=>typeof h=="string");if(!i.length)return null;let c$1=Math.round(Q(n.h??n.height,i.length,1,a)),s=Math.round(Q(n.w??n.width,Math.max(...i.map(h=>h.length)),1,a)),l=false;for(i=i.slice(0,c$1).map(h=>{let m="";for(let p=0;p<s;p++){let b=h[p]??".";be.has(b)||t[b]?m+=b===" "?".":b:(l=true,m+=".");}return m});i.length<c$1;)i.push(".".repeat(s));return l&&r.push(c({en:"texture \xAB{id}\xBB has symbols not in the palette \u2014 they became transparent",ru:"\u0432 \u0442\u0435\u043A\u0441\u0442\u0443\u0440\u0435 \xAB{id}\xBB \u0441\u0438\u043C\u0432\u043E\u043B\u044B \u043D\u0435 \u0438\u0437 \u043F\u0430\u043B\u0438\u0442\u0440\u044B \u2014 \u0441\u0442\u0430\u043B\u0438 \u043F\u0440\u043E\u0437\u0440\u0430\u0447\u043D\u044B\u043C\u0438"},{id:o})),{w:s,h:c$1,rows:i}}function Ct(e){return Array.isArray(e)?"["+e.map(Ct).join(",")+"]":H(e)?"{"+Object.keys(e).filter(t=>e[t]!==void 0).sort().map(t=>JSON.stringify(t)+":"+Ct(e[t])).join(",")+"}":JSON.stringify(e)}function _e(e){let t=Ct(e),r=b(t),o=b("~"+t);return r.toString(16).padStart(8,"0")+o.toString(16).padStart(8,"0")}function ss(e){return ae[e.rig]}function ur(e){let r=ae[e.rig].bones.map(o=>{let n=e.bones.find(a=>a.name===o.name);return {name:o.name,role:o.role,parent:o.parent,pivot:(n?.pivot??o.pivot).slice()}});for(let o of e.bones)r.some(n=>n.name===o.name)||r.push({name:o.name,role:o.role,parent:o.parent,pivot:o.pivot.slice()});return r}function rt(){return c({en:"Character",ru:"\u041F\u0435\u0440\u0441\u043E\u043D\u0430\u0436"})}var is=e=>e==="\u041F\u0435\u0440\u0441\u043E\u043D\u0430\u0436"||e==="Character";var so={front:{tl:[1,1,-1],u:[-1,0,0],d:[0,-1,0],n:[0,0,-1]},back:{tl:[-1,1,1],u:[1,0,0],d:[0,-1,0],n:[0,0,1]},right:{tl:[1,1,1],u:[0,0,-1],d:[0,-1,0],n:[1,0,0]},left:{tl:[-1,1,-1],u:[0,0,1],d:[0,-1,0],n:[-1,0,0]},top:{tl:[1,1,1],u:[-1,0,0],d:[0,0,-1],n:[0,1,0]},bottom:{tl:[-1,-1,1],u:[1,0,0],d:[0,0,-1],n:[0,-1,0]}};function Pt(e){let t=parseInt(e.slice(1),16);return [t>>16&255,t>>8&255,t&255]}function br(e,t,r,o,n,a){let i=((r-1-n)*t+o)*4;e[i]=a[0],e[i+1]=a[1],e[i+2]=a[2],e[i+3]=255;}function io(e,t=0){e.sort((r,o)=>o.h-r.h||o.w-r.w||(r.key<o.key?-1:1));for(let r=16;;r*=2){let o=0,n=0,a=0;for(let c of e)o+c.w+t*2>r&&(o=0,n+=a,a=0),c.x=o+t,c.y=n+t,o+=c.w+t*2,a=Math.max(a,c.h+t*2);let i=n+a;if(i<=r||r>=1024){let c=16;for(;c<i;)c*=2;return {w:r,h:c}}}}function lo(e,t,r,o,n){let a=(i,c)=>((r-1-o.y-c)*t+o.x+i)*4;for(let i=-n;i<o.h+n;i++)for(let c=-n;c<o.w+n;c++){let s=Math.max(0,Math.min(o.w-1,c)),l=Math.max(0,Math.min(o.h-1,i));if(s===c&&l===i)continue;let h=a(s,l);e.copyWithin(a(c,i),h,h+4);}}function yr(e,t,r){let o=Math.imul(t,374761393)+Math.imul(r,668265263)+Math.imul(e,2246822519);return o=Math.imul(o^o>>>13,1274126177),((o^o>>>16)>>>0)/4294967296}function co(e,t,r,o,n,a,i,c){let l=1+(.55*yr(i,t,r)+.45*yr(i^1540483477,Math.floor(t/3),Math.floor(r/3))-.5)*2*c.noise*.14;return a==="s"?l+=c.shade*.16*(.5-(r+.5)/n):a==="t"?l+=c.shade*.08:l-=c.shade*.2,o>=3&&n>=3&&(t===0||r===0||t===o-1||r===n-1)&&(l*=1-.5*c.outline),[Math.max(0,Math.min(255,e[0]*l)),Math.max(0,Math.min(255,e[1]*l)),Math.max(0,Math.min(255,e[2]*l))]}var ze=Math.PI/180;function ot(e,t){if(!t)return e;let[r,o,n]=e,[a,i,c]=[t[0]*ze,t[1]*ze,t[2]*ze],s=Math.cos(c),l=Math.sin(c);return [r,o]=[r*s-o*l,r*l+o*s],s=Math.cos(i),l=Math.sin(i),[r,n]=[r*s+n*l,-r*l+n*s],s=Math.cos(a),l=Math.sin(a),[o,n]=[o*s-n*l,o*l+n*s],[r,o,n]}function po(e,t){let r=[];for(let o of e.parts){if(r.push({...o,flip:false}),!o.mirror)continue;let n=o.faces?{...o.faces,left:o.faces.right,right:o.faces.left}:void 0;n&&(n.left===void 0&&delete n.left,n.right===void 0&&delete n.right);let a={...o,bone:fr(o.bone,t),pos:[-o.pos[0],o.pos[1],o.pos[2]],flip:true};n?a.faces=n:delete a.faces,o.rot&&(a.rot=[o.rot[0],-o.rot[1],-o.rot[2]]),r.push(a);}return r}function xr(e){let t=ae[e.rig],r=ur(e),o=v=>r.some(k=>k.name===v),n=po(e,o),a=e.finish??Le,i=a.round??0,c=new Map,s=(v,k)=>{let M=v.faces?.[k],I=M!==void 0?e.textures[M]:void 0,O=M!==void 0&&e.palette[M]?M:v.color,[K,re]=k==="front"||k==="back"?[v.size[0],v.size[1]]:k==="left"||k==="right"?[v.size[2],v.size[1]]:[v.size[0],v.size[2]],Y=(Ie,ge)=>Math.max(1,Math.min(64,ge*Math.max(1,Math.round(Ie*a.density/ge)))),W=I?Y(K,I.w):Y(K,1),F=I?Y(re,I.h):Y(re,1),ee=k==="top"?"t":k==="bottom"?"b":"s",X=(I?"t:"+M:"c:"+O)+"|"+W+"x"+F+ee,q=c.get(X);if(q)return q;let he=b(X),me=I?null:Pt(e.palette[O]??"#ff00ff");return q={key:X,w:W,h:F,x:0,y:0,paint:(Ie,ge,Je,Ze,kt)=>{for(let J=0;J<F;J++)for(let Z=0;Z<W;Z++){let ce=me;if(I){let ne=I.rows[Math.floor(J*I.h/F)][Math.floor(Z*I.w/W)];if(be.has(ne))continue;let or=e.palette[ne];if(!or)continue;ce=Pt(or);}br(Ie,ge,Je,Ze+Z,kt+J,co(ce,Z,J,W,F,ee,he,a));}}},c.set(X,q),q},l=(v,k)=>{let M="e:"+v,I=c.get(M);return I||(I={key:M,w:k.w,h:k.h,x:0,y:0,paint:(O,K,re,Y,W)=>{for(let F=0;F<k.h;F++)for(let ee=0;ee<k.w;ee++){let X=k.rows[F][ee];if(be.has(X))continue;let q=e.palette[X];q&&br(O,K,re,Y+ee,W+F,Pt(q));}}},c.set(M,I)),I},h=n.map(v=>({p:v,faces:ue.map(k=>({f:k,cell:s(v,k)}))})),m=e.face,p=[];if(m)for(let[v,k]of Object.entries(m.expressions)){let M=e.textures[k];M&&p.push([v,l(k,M)]);}let b$1=i>0?2:0,{w:g,h:y}=io([...c.values()],b$1),T=new Uint8Array(g*y*4);for(let v of c.values())v.paint(T,g,y,v.x,v.y),b$1&&lo(T,g,y,v,b$1);let A=.01,w=(v,k=A)=>[(v.x+k)/g,1-(v.y+k)/y,(v.x+v.w-k)/g,1-(v.y+v.h-k)/y],f=new Map;for(let v of r)f.set(v.name,{pos:[],nrm:[],uv:[],idx:[]});let S=new Map,d=v=>{let k=S.get(v);if(k===void 0){k=true;for(let M=0;M<v.h&&k;M++)for(let I=0;I<v.w;I++)if(T[((y-1-v.y-M)*g+v.x+I)*4+3]<128){k=false;break}S.set(v,k);}return k},x=new Map;for(let{p:v,faces:k}of h)if(k.every(({cell:M})=>d(M))){let M=x.get(v.bone)??[];M.push(v),x.set(v.bone,M);}let E=0;for(let{p:v,faces:k}of h){let M=f.get(v.bone),I=r.find(Y=>Y.name===v.bone).pivot,O=[v.size[0]/2,v.size[1]/2,v.size[2]/2];E=Math.max(E,v.pos[1]+O[1]);let K=(x.get(v.bone)??[]).filter(Y=>Y!==v),re=(Y,W)=>{let F=so[Y],ee=(J,Z)=>{let ce=[O[0]*(F.tl[0]+2*(F.u[0]*J+F.d[0]*Z)),O[1]*(F.tl[1]+2*(F.u[1]*J+F.d[1]*Z)),O[2]*(F.tl[2]+2*(F.u[2]*J+F.d[2]*Z))],ne=ot(ce,v.rot);return [v.pos[0]+ne[0]-I[0],v.pos[1]+ne[1]-I[1],v.pos[2]+ne[2]-I[2]]},X=ot(F.n,v.rot),q=M.pos.length/3,[he,me,Ie,ge]=w(W),[Je,Ze]=v.flip?[Ie,he]:[he,Ie];if(i>0){let[J,Z,ce,ne]=w(W,.5);mo(M,v,O,F,I,i,v.flip?[ce,Z,J,ne]:[J,Z,ce,ne]);return}let kt=[[0,0,Je,me],[1,0,Ze,me],[1,1,Ze,ge],[0,1,Je,ge]];for(let[J,Z,ce,ne]of kt)M.pos.push(...ee(J,Z)),M.nrm.push(...X),M.uv.push(ce,ne);M.idx.push(q,q+2,q+1,q,q+3,q+2);};for(let{f:Y,cell:W}of k){let F=[M.pos.length,M.nrm.length,M.uv.length,M.idx.length];re(Y,W),K.length&&uo(M.pos,F[0],I,K,i)&&(M.pos.length=F[0],M.nrm.length=F[1],M.uv.length=F[2],M.idx.length=F[3]);}}let R=r.map(v=>{let k=f.get(v.name);return {name:v.name,role:v.role,parent:v.parent,pivot:v.pivot,positions:Float32Array.from(k.pos),normals:Float32Array.from(k.nrm),uvs:Float32Array.from(k.uv),indices:Uint16Array.from(k.idx)}}),C=null;if(m&&p.length){let k=e.parts.filter(I=>I.bone===m.bone).sort((I,O)=>O.size[0]*O.size[1]*O.size[2]-I.size[0]*I.size[1]*I.size[2])[0],M=r.find(I=>I.name===m.bone);if(k&&M){let[I,O,K,re]=m.rect,Y=k.pos[0]+k.size[0]/2-I,W=k.pos[1]+k.size[1]/2-O,F=k.pos[2]-k.size[2]/2-.05,ee=M.pivot,X=(he,me)=>[he-ee[0],me-ee[1],F-ee[2]],q={};for(let[he,me]of p)q[he]=w(me);C={bone:m.bone,corners:Float32Array.from([...X(Y,W),...X(Y-K,W),...X(Y-K,W-re),...X(Y,W-re)]),uv:q};}}let P=t.sockets.filter(v=>o(v.bone)).map(v=>{let k=t.bones.find(M=>M.name===v.bone);return {name:v.name,bone:v.bone,at:[v.at[0]-k.pivot[0],v.at[1]-k.pivot[1],v.at[2]-k.pivot[2]]}}),z=Math.max(1,E),j=z>t.height.max?t.height.max/z:z<t.height.min?t.height.min/z:1;return {hash:_e(e),rig:e.rig,bones:R,atlas:{w:g,h:y,data:T},face:C,sockets:P,height:z,scale:e.scale*j,eye:t.eye*z/bo(e.rig)}}var vr=3,ho=2.5,gr=1,wr=0;function mo(e,t,r,o,n,a,i){let c=Math.min(r[0],r[1],r[2]),s=Math.min(c,a*vr),l=Math.min(c,s*ho),h=[r[0]-s,r[1]-s,r[2]-s],m=[r[0]-l,r[1]-l,r[2]-l],p=x=>Math.abs(x[0])*t.size[0]+Math.abs(x[1])*t.size[1]+Math.abs(x[2])*t.size[2],b=x=>{let E=[];for(let C=0;C<=gr;C++)E.push(Math.min(.5,s*C/gr/x));for(let C=1;C<=wr;C++)E.push(Math.min(.5,(s+(l-s)*C/wr)/x));let R=[...E,...E.map(C=>1-C)].sort((C,P)=>C-P);return R.filter((C,P)=>P===0||C-R[P-1]>1e-6)},g=b(p(o.u)),y=b(p(o.d)),T=e.pos.length/3,[A,w,f,S]=i;for(let x of y)for(let E of g){let R=[0,0,0],C=[0,0,0],P=[0,0,0];for(let O=0;O<3;O++){let K=r[O]*(o.tl[O]+2*(o.u[O]*E+o.d[O]*x)),re=Math.max(-h[O],Math.min(h[O],K));C[O]=K-re,R[O]=re,P[O]=K-Math.max(-m[O],Math.min(m[O],K));}let z=Math.hypot(C[0],C[1],C[2]),j=z>1e-9?[C[0]/z,C[1]/z,C[2]/z]:[o.n[0],o.n[1],o.n[2]],v=Math.hypot(P[0],P[1],P[2]),k=v>1e-9?[P[0]/v,P[1]/v,P[2]/v]:j,M=[R[0]+j[0]*s,R[1]+j[1]*s,R[2]+j[2]*s],I=ot(M,t.rot);e.pos.push(t.pos[0]+I[0]-n[0],t.pos[1]+I[1]-n[1],t.pos[2]+I[2]-n[2]),e.nrm.push(...ot(k,t.rot)),e.uv.push(A+(f-A)*E,w+(S-w)*x);}let d=g.length;for(let x=0;x+1<y.length;x++)for(let E=0;E+1<d;E++){let R=T+x*d+E;e.idx.push(R,R+d+1,R+1,R,R+d,R+d+1);}}function fo(e,t){if(!t)return e;let[r,o,n]=e,[a,i,c]=[-t[0]*ze,-t[1]*ze,-t[2]*ze],s=Math.cos(a),l=Math.sin(a);return [o,n]=[o*s-n*l,o*l+n*s],s=Math.cos(i),l=Math.sin(i),[r,n]=[r*s+n*l,-r*l+n*s],s=Math.cos(c),l=Math.sin(c),[r,o]=[r*s-o*l,r*l+o*s],[r,o,n]}function uo(e,t,r,o,n){for(let i of o){let c=[i.size[0]/2,i.size[1]/2,i.size[2]/2],s=n>0?Math.min(c[0],c[1],c[2],n*vr):0,l=true;for(let h=t;h<e.length&&l;h+=3){let m=fo([e[h]+r[0]-i.pos[0],e[h+1]+r[1]-i.pos[1],e[h+2]+r[2]-i.pos[2]],i.rot),p=Math.abs(m[0])-(c[0]-s),b=Math.abs(m[1])-(c[1]-s),g=Math.abs(m[2])-(c[2]-s);Math.hypot(Math.max(p,0),Math.max(b,0),Math.max(g,0))+Math.min(Math.max(p,b,g),0)-s>=-0.01&&(l=false);}if(l)return true}return false}function bo(e){let t=1;for(let r of ae[e].defaultParts)t=Math.max(t,r.pos[1]+r.size[1]/2);return t}var Lt=new Map;function yo(e){let t=new Map;for(let c of e.bones){if(!c.indices.length){t.set(c.name,null);continue}let s=new _.BufferGeometry;s.setAttribute("position",new _.BufferAttribute(c.positions,3)),s.setAttribute("normal",new _.BufferAttribute(c.normals,3)),s.setAttribute("uv",new _.BufferAttribute(c.uvs,2)),s.setIndex(new _.BufferAttribute(c.indices,1)),s.computeBoundingSphere(),s.userData.shared=true,t.set(c.name,s);}let r=go(e),{w:o,h:n,data:a}=e.atlas,i=new _.DataTexture(a,o,n,_.RGBAFormat);return i.magFilter=_.NearestFilter,i.minFilter=_.NearestFilter,i.generateMipmaps=false,i.colorSpace=_.SRGBColorSpace,i.needsUpdate=true,{layout:e,geometries:t,skinned:r,texture:i,refs:0}}function go(e){let t=0,r=0;for(let p of e.bones)t+=p.positions.length/3,r+=p.indices.length;if(!r)return null;let o=new Float32Array(t*3),n=new Float32Array(t*3),a=new Float32Array(t*2),i=new Uint16Array(t*4),c=new Float32Array(t*4),s=t>65535?new Uint32Array(r):new Uint16Array(r),l=0,h=0;e.bones.forEach((p,b)=>{let g=p.positions.length/3;for(let y=0;y<g;y++)o[(l+y)*3]=p.positions[y*3]+p.pivot[0],o[(l+y)*3+1]=p.positions[y*3+1]+p.pivot[1],o[(l+y)*3+2]=p.positions[y*3+2]+p.pivot[2],i[(l+y)*4]=b,c[(l+y)*4]=1;n.set(p.normals,l*3),a.set(p.uvs,l*2);for(let y=0;y<p.indices.length;y++)s[h+y]=p.indices[y]+l;l+=g,h+=p.indices.length;});let m=new _.BufferGeometry;return m.setAttribute("position",new _.BufferAttribute(o,3)),m.setAttribute("normal",new _.BufferAttribute(n,3)),m.setAttribute("uv",new _.BufferAttribute(a,2)),m.setAttribute("skinIndex",new _.Uint16BufferAttribute(i,4)),m.setAttribute("skinWeight",new _.BufferAttribute(c,4)),m.setIndex(new _.BufferAttribute(s,1)),m.computeBoundingSphere(),m.userData.shared=true,m}function _t(e){let t=Lt.get(_e(e));return t||(t=yo(xr(e)),Lt.set(t.layout.hash,t)),t.refs++,t}function nt(e){if(!(--e.refs>0)){Lt.delete(e.layout.hash);for(let t of e.geometries.values())t?.dispose();e.skinned?.dispose(),e.texture.dispose();}}var L=class e{constructor(t,r,o="."){this.w=t;this.h=r;this.g=Array.from({length:r},()=>new Array(t).fill(o));}w;h;g;px(t,r,o){return t>=0&&r>=0&&t<this.w&&r<this.h&&(this.g[r][t]=o),this}rect(t,r,o,n,a){for(let i=r;i<r+n;i++)for(let c=t;c<t+o;c++)this.px(c,i,a);return this}row(t,r,o,n){return this.rect(r,t,o-r+1,1,n)}col(t,r,o,n){return this.rect(t,r,1,o-r+1,n)}where(t,r){for(let o=0;o<this.h;o++)for(let n=0;n<this.w;n++)t(n,o)&&this.px(n,o,r);return this}flipped(){let t=new e(this.w,this.h);for(let r=0;r<this.h;r++)for(let o=0;o<this.w;o++)t.px(this.w-1-o,r,this.g[r][o]);return t}tex(){return {w:this.w,h:this.h,rows:this.g.map(t=>t.join(""))}}};var wo={s:"#d9a982",S:"#bf8d68",h:"#6b4a2f",H:"#8a6644",k:"#3a2818",w:"#f4f4ef",b:"#3f8f9c",m:"#9a5544",o:"#4a2219",t:"#a7bea9",T:"#c4d6c4",D:"#84a08a",u:"#ece6d2",B:"#6a4e33",g:"#d8c48c",p:"#8c9ca6",P:"#6f808a",z:"#a07a55",Z:"#7c5c3f",l:"#e9e3cf"};function pe(e,t){let r=parseInt(e.slice(1),16);return "#"+[r>>16&255,r>>8&255,r&255].map(n=>Math.max(0,Math.min(255,Math.round(n*t)))).map(n=>n.toString(16).padStart(2,"0")).join("")}function Ot(e,t){let r={...e};return t.skin&&(r.s=t.skin,r.S=pe(t.skin,.86),r.m=pe(t.skin,.66)),t.hair&&(r.h=t.hair,r.H=pe(t.hair,1.25),r.k=pe(t.hair,.6)),t.shirt&&(r.t=t.shirt,r.T=pe(t.shirt,1.15),r.D=pe(t.shirt,.8)),t.pants&&(r.p=t.pants,r.P=pe(t.pants,.8)),t.boots&&(r.z=t.boots,r.Z=pe(t.boots,.78)),t.eyes&&(r.b=t.eyes),r}var xo=new L(16,16,"s").rect(0,0,16,3,"h").row(3,0,4,"h").row(3,10,15,"h").row(4,0,1,"h").row(4,13,15,"h").col(0,5,8,"h").col(15,5,8,"h").row(1,3,6,"H").row(1,9,12,"H").row(15,2,13,"S"),Rr=new L(16,16,"s").rect(0,0,16,4,"h").rect(7,4,9,7,"h").rect(10,11,6,2,"h").rect(5,7,2,3,"S").row(1,2,13,"H").where((e,t)=>t>4&&t<11&&e>8&&(e+t)%4===0,"k"),vo=Rr.flipped(),Ro=new L(16,16,"h").where((e,t)=>(e+2*t)%5===0,"H").where((e,t)=>t>8&&(e*3+t)%7===0,"k").rect(4,14,8,2,"s"),Eo=new L(16,16,"h").where((e,t)=>(e+2*t)%5===0,"H").where((e,t)=>(3*e+t)%9===0,"k"),Ao=new L(18,4,"h").where((e,t)=>(e*7+t*3)%5===0,"H").where((e,t)=>t===3&&e*5%3===0,"k"),So=new L(16,24,"t").row(0,6,9,"s").row(1,7,8,"s").row(0,3,5,"T").row(0,10,12,"T").row(1,4,6,"T").row(1,9,11,"T").row(2,5,6,"T").row(2,9,10,"T").col(8,2,19,"D").px(7,5,"u").px(7,9,"u").px(7,13,"u").px(7,17,"u").row(6,2,5,"D").col(2,7,10,"D").col(5,7,10,"D").row(10,2,5,"D").px(4,7,"u").row(6,10,13,"D").col(10,7,10,"D").col(13,7,10,"D").row(10,10,13,"D").px(11,7,"u").row(19,0,15,"D").rect(0,20,16,2,"B").rect(7,20,2,2,"g").rect(0,22,16,2,"p"),ko=new L(16,24,"t").row(5,0,15,"D").col(8,6,19,"D").row(19,0,15,"D").rect(0,20,16,2,"B").rect(0,22,16,2,"p"),To=new L(8,24,"t").col(4,0,19,"D").row(19,0,7,"D").rect(0,20,8,2,"B").rect(0,22,8,2,"p"),Co=new L(16,2,"B").rect(7,0,2,2,"g").px(3,0,"k").px(12,0,"k"),Mo=new L(6,24,"s").row(23,0,5,"S").col(2,21,23,"S"),Io=new L(8,13,"t").col(0,0,9,"D").row(9,0,7,"D").rect(0,10,8,3,"T").row(12,0,7,"D"),Po=new L(8,24,"p").col(4,1,21,"P").row(0,0,7,"P"),Lo=new L(8,24,"p").col(3,0,21,"P").row(0,0,7,"P"),_o=new L(8,24,"p").col(3,0,21,"P"),zo=new L(10,9,"z").row(0,0,9,"Z").row(2,3,6,"l").row(4,3,6,"l").row(6,3,6,"l").col(2,1,6,"Z").col(7,1,6,"Z").rect(0,7,10,2,"Z"),Oo=new L(10,9,"z").row(0,0,9,"Z").rect(0,7,10,2,"Z").col(5,1,6,"Z");function ie(e){let t=new L(16,10,"."),r=(n,a,i)=>{if(e.brows==="flat")t.row(1,n,n+2,"k");else if(e.brows==="high")t.row(0,n,n+2,"k");else {let c=e.brows==="down"?1:0,s=1-c;t.px(a,c,"k").px(n+1,e.brows==="down"?0:1,"k"),t.px(i,s,"k");}};r(3,5,3),r(10,10,12);let o=n=>{if(e.eyes===0){t.row(3,n,n+2,"k");return}let a=e.eyes===3||e.eyes===2?2:3;for(let i=a;i<a+e.eyes;i++)t.px(n,i,"w").px(n+1,i,"b").px(n+2,i,"w");};switch(o(3),o(10),e.mouth){case "line":t.row(7,6,9,"m");break;case "smile":t.px(5,6,"m").px(10,6,"m").row(7,6,9,"m");break;case "frown":t.row(7,6,9,"m").px(5,8,"m").px(10,8,"m");break;case "open":t.rect(6,7,4,2,"o");break;case "small":t.rect(7,7,2,2,"o");break;case "wide":t.row(7,5,10,"m").rect(6,8,4,1,"o");break}return t}var Er={f_neutral:ie({brows:"flat",eyes:2,mouth:"line"}),f_blink:ie({brows:"flat",eyes:0,mouth:"line"}),f_happy:ie({brows:"high",eyes:2,mouth:"smile"}),f_sad:ie({brows:"up",eyes:2,mouth:"frown"}),f_angry:ie({brows:"down",eyes:1,mouth:"wide"}),f_surprised:ie({brows:"high",eyes:3,mouth:"small"}),f_scared:ie({brows:"up",eyes:3,mouth:"open"}),f_tired:ie({brows:"flat",eyes:1,mouth:"line"}),f_hurt:ie({brows:"down",eyes:0,mouth:"open"}),f_talk:ie({brows:"flat",eyes:2,mouth:"open"})},Fo=new L(16,24,"t").row(0,5,10,"s").row(1,6,9,"s").px(5,1,"T").px(10,1,"T").row(7,0,15,"D").row(10,0,15,"D").rect(0,18,16,2,"T").rect(0,20,16,4,"p").row(20,0,15,"P"),No=new L(16,24,"t").row(0,5,10,"T").row(7,0,15,"D").row(10,0,15,"D").rect(0,18,16,2,"T").rect(0,20,16,4,"p").row(20,0,15,"P"),Ho=new L(8,24,"t").row(7,0,7,"D").row(10,0,7,"D").rect(0,18,8,2,"T").rect(0,20,8,4,"p").row(20,0,7,"P"),Do=new L(8,9,"t").row(3,0,7,"D").rect(0,7,8,2,"T"),at=(e,t)=>e.row(t-1,0,e.w-1,"D").where((r,o)=>o>=t&&o<=t+3&&(r+o)%2===0,"T").row(t+4,0,e.w-1,"D"),Bo=at(new L(16,24,"t"),6).row(0,6,9,"s").row(0,4,5,"T").row(0,10,11,"T").row(1,4,11,"T").where((e,t)=>t>=18&&t<=19&&e%2===0,"D").where((e,t)=>t>=18&&t<=19&&e%2===1,"T").rect(0,20,16,4,"p"),Vo=at(new L(16,24,"t"),6).row(0,4,11,"T").where((e,t)=>t>=18&&t<=19,"D").rect(0,20,16,4,"p"),jo=at(new L(8,24,"t"),6).where((e,t)=>t>=18&&t<=19,"D").rect(0,20,8,4,"p"),Go=at(new L(8,22,"t"),9).where((e,t)=>t>=19&&e%2===0,"D"),Ar=e=>new L(8,24,"s").rect(0,0,8,12,"p").col(e,1,10,"P").row(11,0,7,"P").row(12,0,7,"S").rect(0,19,8,5,"l"),Uo=Ar(4),Yo=Ar(3),qo=new L(9,5,"z").row(1,3,5,"l").rect(0,3,9,2,"l"),$o=new L(10,5,"z").row(1,3,6,"Z").rect(0,3,10,2,"l"),Wo=new L(17,6,"a").rect(0,4,17,2,"A"),Ko=new L(22,22,"a").where((e,t)=>(e*3+t*5)%11===0,"A"),Xo=new L(17,20,"h").where((e,t)=>(e*5+t)%4===0,"H").where((e,t)=>t>10&&(e*3+t*2)%7===0,"k"),D=e=>e.tex(),Sr=["shirt","tee","sweater"],kr=["pants","shorts"],Tr=["boots","sneakers"],xs=["short","long","curly","none"],ve=(e,t={})=>({front:e,back:e,left:e,right:e,...t});function Ft(e={}){let t=e.top??"shirt",r=e.bottom??"pants",o=e.shoes??"boots",n=e.hair??"short",a=Ot(wo,e.colors??{});a={...a,a:e.colors?.hat??"#d9c9a3"},a.A=pe(a.a,.72);let i={head_front:D(xo),head_left:D(Rr),head_right:D(vo),head_back:D(Ro),hair_top:D(Eo),hair_band:D(Ao),arm_skin:D(Mo),...Object.fromEntries(Object.entries(Er).map(([g,y])=>[g,D(y)]))},c$1=[{name:"head",bone:"head",size:[8,8,8],pos:[0,28,0],color:"s",faces:{front:"head_front",left:"head_left",right:"head_right",back:"head_back",top:"hair_top"}},{name:"nose",bone:"head",size:[1,1.5,.8],pos:[0,26.9,-4.4],color:"S",faces:{front:"s"}}];if(n!=="none"){if(e.hat||c$1.push({name:"hair",bone:"head",size:n==="curly"?[9,2.2,9]:[8.6,1.6,8.6],pos:[0,n==="curly"?32.5:32.2,.15],color:"h",faces:ve("hair_band",{top:"hair_top"})}),n==="curly"&&!e.hat)for(let[g,y]of [[-2,-1.5],[2,.5],[-0.5,2.5]])c$1.push({name:"curl",bone:"head",size:[3.2,1.4,3.2],pos:[g,33.9,y],color:"h",faces:ve("hair_band",{top:"hair_top"})});n==="long"?(i.hair_long=D(Xo),c$1.push({name:"hairLong",bone:"head",size:[8.8,10,1],pos:[0,27,4.4],color:"h",faces:ve("hair_long",{top:"hair_top"})},{name:"hairSide",bone:"head",size:[.8,9,6],pos:[-4.4,27.5,1],color:"h",faces:ve("hair_long",{top:"hair_top"}),mirror:true})):c$1.push({name:"hairBack",bone:"head",size:[8.6,5,.8],pos:[0,29.6,4.25],color:"h",faces:{back:"head_back",left:"hair_band",right:"hair_band"}});}e.hat&&(i.hat_crown=D(Wo),i.hat_brim=D(Ko),c$1.push({name:"hatBrim",bone:"head",size:[11,.8,11],pos:[0,32.4,0],color:"a",faces:{top:"hat_brim",bottom:"hat_brim"}},{name:"hatCrown",bone:"head",size:[8.4,3,8.4],pos:[0,34.3,0],color:"a",faces:ve("hat_crown")}));let s={shirt:[So,ko,To],tee:[Fo,No,Ho],sweater:[Bo,Vo,jo]},[l,h,m]=s[t];i.top_front=D(l),i.top_back=D(h),i.top_side=D(m),c$1.push({name:"torso",bone:"body",size:[8,12,4],pos:[0,18,0],color:"t",faces:{front:"top_front",back:"top_back",left:"top_side",right:"top_side",bottom:"p"}}),t==="shirt"&&(i.belt=D(Co),c$1.push({name:"belt",bone:"body",size:[8.4,1,4.4],pos:[0,13.5,0],color:"B",faces:{front:"belt",back:"belt"}})),c$1.push({name:"arm",bone:"armL",size:[3,12,3],pos:[-5.5,18,0],color:"s",faces:ve("arm_skin",{top:"t",bottom:"S"}),mirror:true});let p=t==="sweater"?11:t==="tee"?4.5:6.5;i.sleeve=D(t==="sweater"?Go:t==="tee"?Do:Io),c$1.push({name:"sleeve",bone:"armL",size:[3.6,p,3.6],pos:[-5.5,24-p/2,0],color:"t",faces:ve("sleeve",{bottom:"D"}),mirror:true}),r==="shorts"?(i.leg_front=D(Uo),i.leg_side=D(Yo)):(i.leg_front=D(Po),i.leg_back=D(Lo),i.leg_side=D(_o)),c$1.push({name:"leg",bone:"legL",size:[4,12,4],pos:[-2,6,0],color:"p",faces:{front:"leg_front",back:r==="shorts"?"leg_front":"leg_back",left:"leg_side",right:"leg_side"},mirror:true}),o==="boots"?(i.shoe_front=D(zo),i.shoe_side=D(Oo)):(i.shoe_front=D(qo),i.shoe_side=D($o));let b=o==="boots"?4.5:2.5;return c$1.push({name:"shoe",bone:"legL",size:[4.6,b,5.2],pos:[-2,b/2,-0.3],color:"z",faces:{front:"shoe_front",back:"shoe_side",left:"shoe_side",right:"shoe_side",bottom:"Z"},mirror:true}),{version:1,name:e.name??c({en:"Traveler",ru:"\u041F\u0443\u0442\u043D\u0438\u043A"}),description:e.description??c({en:"A traveler in a shirt with pockets, trousers and laced boots",ru:"\u041F\u0443\u0442\u043D\u0438\u043A \u0432 \u0440\u0443\u0431\u0430\u0448\u043A\u0435 \u0441 \u043A\u0430\u0440\u043C\u0430\u043D\u0430\u043C\u0438, \u0431\u0440\u044E\u043A\u0430\u0445 \u0438 \u0448\u043D\u0443\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0445 \u0431\u043E\u0442\u0438\u043D\u043A\u0430\u0445"}),rig:"humanoid",palette:a,textures:i,parts:c$1,face:{bone:"head",rect:[0,3,8,5],expressions:{neutral:"f_neutral",blink:"f_blink",happy:"f_happy",sad:"f_sad",angry:"f_angry",surprised:"f_surprised",scared:"f_scared",tired:"f_tired",hurt:"f_hurt",talk:"f_talk"}},style:{walk:"normal",idle:"calm",energy:.5},finish:{noise:.5,outline:.4,shade:.25,density:2},tags:e.tags??["player"]}}function st(e,t){return {textures:Object.fromEntries(Object.entries(Er).map(([r,o])=>[r,D(o)])),face:{bone:e,rect:t,expressions:{neutral:"f_neutral",blink:"f_blink",happy:"f_happy",sad:"f_sad",angry:"f_angry",surprised:"f_surprised",scared:"f_scared",tired:"f_tired",hurt:"f_hurt",talk:"f_talk"}}}}var Nt=Ft(),zt=null;function Re(){if(!zt){let e=se(Nt);if(!e.ok)throw new Error(e.error);zt=e.spec;}return zt}function Cr(e){let t=document.createElement("canvas");t.width=256,t.height=48;let r=t.getContext("2d");r&&(r.fillStyle="rgba(0,0,0,0.45)",r.fillRect(0,0,256,48),r.font="bold 28px sans-serif",r.fillStyle="#fff",r.textAlign="center",r.textBaseline="middle",r.fillText(e.slice(0,18),128,25));let o=new _.CanvasTexture(t),n=new _.Sprite(new _.SpriteMaterial({map:o,depthTest:false,transparent:true}));return n.scale.set(1.6,.3,1),n.renderOrder=10,n}function Ht(e){e.removeFromParent(),e.material.map?.dispose(),e.material.dispose();}var V={rx:0,ry:1,rz:2,px:3,py:4,pz:5,sx:6,sy:7,sz:8},Es=Object.keys(V),Fe=[0,0,0,0,0,0,1,1,1];function Ne(e,t){let r=e.get(t);return r||(r=Float64Array.from(Fe),e.set(t,r)),r}function le(e,t,r,o){let n=Ne(e,t),a=V[r];a>=6?n[a]=n[a]*o:n[a]=n[a]+o;}function u(e,t,r,o){Ne(e,t)[V[r]]=o;}function Ee(e){for(let t of e.values())t.set(Fe);}function Mr(e,t,r,o){let n=new Set([...t.keys(),...r.keys()]);for(let a of n){let i=t.get(a)??Fe,c=r.get(a)??Fe,s=Ne(e,a);for(let l=0;l<9;l++)s[l]=i[l]+(c[l]-i[l])*o;}}function it(e,t){Ee(e);for(let[r,o]of t)Ne(e,r).set(o);}var As=["none","block","tool","sword","bow","shield","food","staff","item"];function lt(){return {speed:0,vy:0,onGround:true,inWater:false,flying:false,gliding:false,sneaking:false,sprinting:false,riding:false,sitting:false,sleeping:false,dead:false,lookYaw:0,lookPitch:0,yawRate:0,held:"none",use:null,talk:false}}var Ss=["swing","hurt","place","land","jump","throw"];var Ve=1/16,Ir=5921370;function Zo(e){let t=(r,o)=>r.replace(`#include <${o}>`,_.ShaderChunk[o].replace("varying vec2 vMapUv","centroid varying vec2 vMapUv"));e.vertexShader=t(e.vertexShader,"uv_pars_vertex"),e.fragmentShader=t(e.fragmentShader,"uv_pars_fragment");}var ct=class{group=new _.Group;root=new _.Group;asset;spec;bones=new Map;byRole=new Map;meshes=[];material;decalMat;decal=null;expression=null;sockets=new Map;attached=new Map;label=null;shadows;layer;brightness=1;painter;prints=[];printMeshes=[];printMats=new Map;constructor(t=Re(),r={}){this.spec=t,this.shadows=r.shadows??true,this.layer=r.layer??0,this.painter=r.facePainter??null,this.material=new _.MeshLambertMaterial({alphaTest:.5}),this.material.onBeforeCompile=Zo,this.decalMat=new _.MeshLambertMaterial({alphaTest:.5,polygonOffset:true,polygonOffsetFactor:-2,polygonOffsetUnits:-2}),this.group.add(this.root),this.asset=_t(t),this.build(),r.name&&this.setName(r.name);}get height(){let t=this.asset.layout;return t.height*t.scale*Ve}get eye(){let t=this.asset.layout;return t.eye*t.scale*Ve}get expressions(){return Object.keys(this.asset.layout.face?.uv??{})}get hash(){return this.asset.layout.hash}setSpec(t){let r=_t(t);if(r===this.asset){nt(r);return}this.clear(),nt(this.asset),this.asset=r,this.spec=t,this.build();}build(){let{layout:t,skinned:r,texture:o}=this.asset;this.material.map=o,this.material.needsUpdate=true,this.useFaceMap(),this.root.scale.setScalar(t.scale*Ve);let n=new Map(t.bones.map(s=>[s.name,s.pivot])),a=[],i=[];for(let s of t.bones){let l=new _.Bone;a.push(l),i.push(new _.Matrix4().makeTranslation(-s.pivot[0],-s.pivot[1],-s.pivot[2]));let h=s.parent?n.get(s.parent)??[0,0,0]:[0,0,0],m=[s.pivot[0]-h[0],s.pivot[1]-h[1],s.pivot[2]-h[2]];l.position.set(...m);let p={name:s.name,role:s.role,group:l,rest:m};this.bones.set(s.name,p);let b=this.byRole.get(s.role)??[];b.push(p),this.byRole.set(s.role,b);}for(let s of t.bones){let l=this.bones.get(s.name);((s.parent?this.bones.get(s.parent):void 0)?.group??this.root).add(l.group);}if(r){let s=new _.SkinnedMesh(r,this.material);s.bind(new _.Skeleton(a,i),new _.Matrix4);let l=r.boundingSphere;l&&(s.boundingSphere=new _.Sphere(l.center.clone(),l.radius*1.6)),s.castShadow=s.receiveShadow=this.shadows,s.layers.set(this.layer),this.meshes.push(s),this.root.add(s);}let c=t.face;if(c){let s=new _.BufferGeometry;s.setAttribute("position",new _.BufferAttribute(c.corners,3));let l=new Float32Array(12);for(let h=0;h<4;h++)l[h*3+2]=-1;s.setAttribute("normal",new _.BufferAttribute(l,3)),s.setAttribute("uv",new _.BufferAttribute(new Float32Array(8),2)),s.setIndex([0,2,1,0,3,2]),this.decal=new _.Mesh(s,this.decalMat),this.decal.layers.set(this.layer),this.bones.get(c.bone)?.group.add(this.decal),this.expression=null,this.setExpression("neutral");}for(let s of t.sockets){let l=new _.Object3D;l.position.set(...s.at),l.scale.setScalar(1/(t.scale*Ve)),this.bones.get(s.bone)?.group.add(l),this.sockets.set(s.name,l);let h=this.attached.get(s.name);h&&l.add(h);}this.buildPrints(),this.placeLabel(),this.setBrightness(this.brightness);}setPrints(t){this.prints=t??[],this.buildPrints(),this.setBrightness(this.brightness);}buildPrints(){for(let o of this.printMeshes)o.removeFromParent(),o.geometry.dispose();this.printMeshes=[];let t=new Set,r=new Map;for(let o of this.prints){let n=this.bones.get(o.bone),a=this.asset.layout.bones.find(h=>h.name===o.bone);if(!n||!a)continue;let i=this.printMats.get(o.texture);i||(i=new _.MeshLambertMaterial({map:o.texture,emissiveMap:o.texture,emissive:Ir,transparent:true,alphaTest:.02,polygonOffset:true,polygonOffsetFactor:-2,polygonOffsetUnits:-2}),this.printMats.set(o.texture,i)),t.add(o.texture);let c=new _.PlaneGeometry(o.w,o.h);o.facing==="front"&&c.rotateY(Math.PI),c.translate(o.center[0]-a.pivot[0],o.center[1]-a.pivot[1],o.center[2]-a.pivot[2]);let s=`${o.bone}|${o.texture.uuid}`,l=r.get(s)??{node:n,mat:i,geos:[]};l.geos.push(c),r.set(s,l);}for(let{node:o,mat:n,geos:a}of r.values()){let i=a.length===1?a[0]:mergeGeometries(a)??a[0];if(i!==a[0])for(let s of a)s.dispose();let c=new _.Mesh(i,n);c.layers.set(this.layer),o.group.add(c),this.printMeshes.push(c);}for(let[o,n]of this.printMats)t.has(o)||(n.dispose(),this.printMats.delete(o));}clear(){for(let t of this.sockets.values())for(let r of [...t.children])t.remove(r);this.root.clear();for(let t of this.printMeshes)t.geometry.dispose();this.printMeshes=[],this.decal?.geometry.dispose(),this.decal=null;for(let t of this.meshes)t instanceof _.SkinnedMesh&&t.skeleton.dispose();this.meshes=[],this.bones=new Map,this.byRole=new Map,this.sockets.clear();}applyPose(t){let r=t.get("root");if(r){this.root.rotation.set(r[V.rx],r[V.ry],r[V.rz]);let o=this.asset.layout.scale*Ve;this.root.position.set(r[V.px]*o,r[V.py]*o,r[V.pz]*o);}else this.root.rotation.set(0,0,0),this.root.position.set(0,0,0);for(let[o,n]of this.byRole){let a=t.get(o);for(let i of n){let c=i.group;if(!a){c.rotation.set(0,0,0),c.position.set(...i.rest),c.scale.set(1,1,1);continue}c.rotation.set(a[V.rx],a[V.ry],a[V.rz]),c.position.set(i.rest[0]+a[V.px],i.rest[1]+a[V.py],i.rest[2]+a[V.pz]),c.scale.set(a[V.sx],a[V.sy],a[V.sz]);}}}setFacePainter(t){if(t===this.painter)return;this.painter=t,this.useFaceMap();let r=this.expression??"neutral";this.expression=null,this.setExpression(r);}useFaceMap(){let t=this.painter;this.decalMat.map=t?t.texture:this.asset.texture,this.decalMat.transparent=!!t,this.decalMat.alphaTest=t?.02:.5,this.decalMat.needsUpdate=true;}setExpression(t){if(t===this.expression||!this.decal)return;let r=this.asset.layout.face?.uv,o=this.painter?[0,1,1,0]:r?.[t]??r?.neutral;if(!o)return;this.expression=t,this.painter?.paint(t);let[n,a,i,c]=o,s=this.decal.geometry.getAttribute("uv");s.setXY(0,n,a),s.setXY(1,i,a),s.setXY(2,i,c),s.setXY(3,n,c),s.needsUpdate=true;}materials(){return [this.material,this.decalMat]}setBrightness(t){this.brightness=t,this.material.color.setScalar(t),this.decalMat.color.setScalar(t);for(let r of this.printMats.values())r.color.setScalar(t);}setEmissive(t){if(this.material.emissive.getHex()!==t){this.material.emissive.setHex(t),this.decalMat.emissive.setHex(t);for(let r of this.printMats.values())r.emissive.setHex(t||Ir);}}setShadows(t){if(t!==this.shadows){this.shadows=t;for(let r of this.meshes)r.castShadow=t;}}attach(t,r){let o=this.attached.get(t);if(o!==r){if(o&&o.removeFromParent(),!r){this.attached.delete(t);return}this.attached.set(t,r),this.sockets.get(t)?.add(r);}}attachedAt(t){return this.attached.get(t)??null}setName(t){this.label&&Ht(this.label),this.label=t?Cr(t):null,this.label&&this.group.add(this.label),this.placeLabel();}setLabelVisible(t){this.label&&(this.label.visible=t);}placeLabel(){this.label&&(this.label.position.y=this.height+.25);}forEachMesh(t){for(let r of this.meshes)t(r);this.decal&&t(this.decal);for(let r of this.printMeshes)t(r);}dispose(){this.group.removeFromParent();for(let t of this.attached.values())t.removeFromParent();this.attached.clear(),this.clear(),this.label&&Ht(this.label),this.label=null,this.material.dispose(),this.decalMat.dispose();for(let t of this.printMats.values())t.dispose();this.printMats.clear(),nt(this.asset);}};var pt=new Map,Dt=new Set;function zs(e){let t=_e(e);if(!pt.has(t)){pt.set(t,e);for(let r of Dt)r(t);}return t}function Os(e){return typeof e=="string"?pt.get(e):void 0}function Fs(e){let t={};for(let r of e){let o=pt.get(r);o&&(t[r]=o);}return t}function Ns(e){return Dt.add(e),()=>Dt.delete(e)}var Qo=["#b08a62","#8a6a4a","#c8a878","#9a9a92","#7a5c44"],en=["#f1c9a5","#e6b892","#d9a982","#c08e68","#a0704c","#7a5238"],tn=["#6b4a2f","#4a3424","#8a5a3a","#c27a48","#d8b878","#2e2622","#a07850","#9a9690"],rn=["#a7bea9","#e6e0cc","#d9c9a3","#b9a083","#a9b8c4","#c8b4a0","#9fb0a0","#d8d2c4","#b98f74","#8fa3b5"],on=["#8c9ca6","#a9b8b4","#8a8e94","#9fb3ad","#7d8a8f","#b0a58f"],nn=["#d9c9a3","#c8b48a","#a08a6a","#e6e0cc"];function js(e,t="",r=""){let o=a(b("npc:"+e+"|"+t)),n=c=>c[Math.floor(o()*c.length)],a$1=Ft({top:n(Sr),bottom:n(kr),shoes:n(Tr),hair:n(["short","short","long","curly"]),hat:o()<.2,colors:{skin:n(en),hair:n(tn),shirt:n(rn),pants:n(on),boots:n(Qo),hat:n(nn)}});a$1.name=e.slice(0,40),a$1.description=[t,r].filter(Boolean).join(" \u2014 ").slice(0,300),a$1.style={walk:n(["normal","normal","bouncy","heavy","sneaky"]),idle:n(["calm","calm","fidgety","proud"]),energy:Math.round(o()*10)/10},a$1.tags=["npc",...t?[t.slice(0,24)]:[]];let i=se(a$1);return i.ok?i.spec:Re()}var ye=([e,t,r])=>"#"+[e,t,r].map(o=>Math.round(o).toString(16).padStart(2,"0")).join("");function an(e){if(!e.length)return null;let t=r=>{let o=e.map(n=>n[r]).sort((n,a)=>n-a);return o[o.length>>1]};return [t(0),t(1),t(2)]}function sn(e,t){let{width:r,height:o,data:n}=e,a=(A,w)=>{let f=(w*r+A)*4;return [n[f],n[f+1],n[f+2]]},i=[a(0,0),a(r-1,0),a(0,o-1),a(r-1,o-1)],c=[0,1,2].map(A=>i.reduce((w,f)=>w+f[A],0)/4),s=A=>Math.abs(A[0]-c[0])+Math.abs(A[1]-c[1])+Math.abs(A[2]-c[2])>60,l=r,h=-1,m=o,p=-1;for(let A=0;A<o;A+=2)for(let w=0;w<r;w+=2)s(a(w,A))&&(l=Math.min(l,w),h=Math.max(h,w),m=Math.min(m,A),p=Math.max(p,A));h<0&&(l=0,h=r-1,m=0,p=o-1);let b=p-m+1,g=h-l+1,y=l+Math.floor(g*.3),T=l+Math.ceil(g*.7);return t.map(([A,w])=>{let f=[];for(let S=m+Math.floor(b*A);S<m+Math.ceil(b*w);S++)for(let d=y;d<T;d++){if(S<0||S>=o||d<0||d>=r)continue;let x=a(d,S);s(x)&&f.push(x);}return an(f)})}var ln=[[0,.06],[.1,.22],[.3,.52],[.6,.86],[.92,1]];function $s(e,t="humanoid",r=rt()){let[o,n,a,i,c]=sn(e,ln);if(t==="humanoid"){let l=JSON.parse(JSON.stringify(Nt));l.palette=Ot(l.palette,{...o?{hair:ye(o)}:{},...n?{skin:ye(n)}:{},...a?{shirt:ye(a)}:{},...i?{pants:ye(i)}:{},...c?{boots:ye(c)}:{}}),l.name=r,l.tags=[];let h=se(l);return h.ok?h.spec:Re()}let s=se({name:r,rig:t,palette:{s:ye(n??o??[198,156,124]),t:ye(a??[58,143,214]),p:ye(i??c??[44,62,107]),w:"#f4f4f4",b:"#1d1d21"},textures:{f_neutral:{w:4,h:2,rows:["wbbw","...."]},f_blink:{w:4,h:2,rows:["bbbb","...."]}},face:{rect:t==="blob"?[4,4,4,2]:t==="flyer"?[0,1,4,2]:[2,2,4,2],expressions:{neutral:"f_neutral",blink:"f_blink"}}});return s.ok?s.spec:Re()}var cn={normal:{},bouncy:{amp:.9,arm:.8,bob:1.6,tempo:1.1,sway:.04},heavy:{amp:.6,arm:.4,bob:.6,tempo:.8,sway:.12},sneaky:{amp:.5,arm:.3,tempo:1.2},robotic:{amp:.7,arm:.7,quant:true}},pn={calm:{},fidgety:{fidget:1,breath:1.3},proud:{chest:.08,breath:.8}};function Bt(e){let t={amp:.8,arm:.6,bob:0,tempo:1,sway:0,quant:false,breath:1,fidget:0,chest:0,...cn[e.walk],...pn[e.idle]};return t.tempo*=.8+.4*e.energy,t.amp*=.85+.3*e.energy,t}function ht(e,t=0){let r=Math.sin(e.phase+t);return e.style.quant?Math.max(-1,Math.min(1,r*3)):r}function Vt(e,t,r){let o=ht(t)*r;u(e,"legL","rx",o),u(e,"legR","rx",-o),u(e,"legFL","rx",o),u(e,"legBR","rx",o),u(e,"legFR","rx",-o),u(e,"legBL","rx",-o);}function jt(e,t,r){let o=ht(t)*r;u(e,"armL","rx",-o),u(e,"armR","rx",o);}function Gt(e,t,r,o){let n=ht(t),a=Math.max(0,Math.cos(t.phase))*Math.max(0,-n+.3),i=Math.max(0,-Math.cos(t.phase))*Math.max(0,n+.3);u(e,"shinL","rx",-r*(.15+a)),u(e,"shinR","rx",-r*(.15+i)),u(e,"foreArmL","rx",o*(.6+.4*Math.max(0,-n))),u(e,"foreArmR","rx",o*(.6+.4*Math.max(0,n)));}var hn=(e,t)=>{let r=Math.sin(t.clock*2)*t.style.breath;u(e,"armL","rz",-0.04-.03*r),u(e,"armR","rz",.04+.03*r),u(e,"foreArmL","rx",.12+.02*r),u(e,"foreArmR","rx",.12+.02*r),u(e,"head","rx",.03*Math.sin(t.clock*1.7)+t.style.chest),u(e,"body","rx",t.style.chest*-0.5),t.style.fidget&&(u(e,"head","ry",.35*Math.sin(t.clock*.7)*Math.sin(t.clock*.31)),u(e,"root","ry",.05*Math.sin(t.clock*.9))),u(e,"body","sy",1+.04*Math.sin(t.clock*3));},mn=(e,t)=>{Vt(e,t,t.style.amp),jt(e,t,t.style.arm),Gt(e,t,t.style.amp*1.1,.35),u(e,"root","py",t.style.bob*Math.abs(Math.cos(t.phase))),u(e,"body","rz",t.style.sway*ht(t));},dn=(e,t)=>{Vt(e,t,t.style.amp*1.3),jt(e,t,t.style.arm*1.6),Gt(e,t,t.style.amp*1.6,1.1),u(e,"body","rx",-0.18),u(e,"head","rx",.18),u(e,"root","py",(.8+t.style.bob)*Math.abs(Math.cos(t.phase)));},fn=(e,t)=>{Vt(e,t,t.style.amp*.5*Math.min(1,t.input.speed)),jt(e,t,t.style.arm*.4*Math.min(1,t.input.speed)),u(e,"body","rx",-0.45),u(e,"head","rx",.45),le(e,"armL","rx",.25),le(e,"armR","rx",.25),Gt(e,t,.9,.6),u(e,"root","py",-1.5);},un=(e,t)=>{u(e,"root","rx",-1.3),u(e,"head","rx",1),u(e,"armL","rx",Math.PI-.5+.5*Math.sin(t.t*3)),u(e,"armR","rx",Math.PI-.5+.5*Math.sin(t.t*3+Math.PI)),u(e,"legL","rx",.3*Math.sin(t.t*8)),u(e,"legR","rx",-0.3*Math.sin(t.t*8));},bn=(e,t)=>{u(e,"legL","rx",.15),u(e,"legR","rx",.1),u(e,"armL","rz",-0.15),u(e,"armR","rz",.15),u(e,"root","py",.6*Math.sin(t.t*2));},yn=e=>{u(e,"root","rx",-1.35),u(e,"head","rx",1.1),u(e,"armL","rz",-1.3),u(e,"armR","rz",1.3);},gn=(e,t)=>{let r=.15*Math.sin(t.t*10);u(e,"armL","rz",-0.6-r),u(e,"armR","rz",.6+r),u(e,"legL","rx",.25),u(e,"legR","rx",-0.25),u(e,"shinL","rx",-0.5),u(e,"shinR","rx",-0.3),u(e,"foreArmL","rx",.4),u(e,"foreArmR","rx",.4);},wn=e=>{u(e,"legL","rx",1.45),u(e,"legR","rx",1.45),u(e,"legL","ry",.1),u(e,"legR","ry",-0.1),u(e,"shinL","rx",-1.45),u(e,"shinR","rx",-1.45),u(e,"root","py",-10),u(e,"body","rx",.4),u(e,"legBL","rx",1.2),u(e,"legBR","rx",1.2);},xn=e=>{u(e,"legL","rx",1.4),u(e,"legR","rx",1.4),u(e,"legL","rz",-0.3),u(e,"legR","rz",.3),u(e,"armL","rx",.45),u(e,"armR","rx",.45),u(e,"shinL","rx",-1.2),u(e,"shinR","rx",-1.2),u(e,"foreArmL","rx",.5),u(e,"foreArmR","rx",.5);},vn=e=>{u(e,"root","rx",Math.PI/2),u(e,"root","py",2);},Rn=e=>{u(e,"root","rz",Math.PI/2),u(e,"root","py",2);},En=(e,t)=>{let r=Math.sin(t.phase*.5);u(e,"root","py",6*Math.max(0,r));let o=r<0?.2*-r:0;u(e,"body","sy",1-o+.1*Math.max(0,r)),u(e,"body","sx",1+o*.6),u(e,"body","sz",1+o*.6);},An=(e,t)=>{let r=Math.sin(Math.PI*t.k);u(e,"armR","rx",1.9*r),u(e,"armR","ry",.3*r),u(e,"body","ry",-0.3*r),u(e,"foreArmR","rx",.6*r);},Sn=(e,t)=>{let r=Math.sin(Math.PI*t.k);u(e,"armR","rx",.9*r);},kn=(e,t)=>{let r=t.k<.4?-1.5*(t.k/.4):-1.5+3.5*((t.k-.4)/.6);u(e,"armR","rx",t.k>.9?r*(1-t.k)*10:r);},Tn=(e,t)=>{let r=Math.sin(Math.PI*t.k);u(e,"body","rx",.15*r),u(e,"head","rx",.2*r),u(e,"root","rz",.05*r);},Cn=(e,t)=>{let r=Math.sin(Math.PI*t.k);u(e,"root","py",-1.5*r),u(e,"legL","rx",.2*r),u(e,"legR","rx",.2*r),u(e,"shinL","rx",-0.5*r),u(e,"shinR","rx",-0.5*r),u(e,"body","sy",1-.2*r),u(e,"body","sx",1+.12*r),u(e,"body","sz",1+.12*r);},Mn=(e,t)=>{u(e,"armR","rx",1.3+.1*Math.sin(t.t*16)),u(e,"armR","ry",-0.5),u(e,"head","rx",-0.1+.08*Math.sin(t.t*16));},In=e=>{u(e,"armR","rx",2),u(e,"armR","ry",-0.4),u(e,"head","rx",.35);},Pn=e=>{u(e,"armR","rx",1.57),u(e,"armR","ry",-0.1),u(e,"armL","rx",1.57),u(e,"armL","ry",.35);},Ln=e=>{u(e,"armL","rx",.9),u(e,"armL","ry",-0.6);},mt={idle:hn,walk:mn,run:dn,sneak:fn,swim:un,fly:bn,glide:yn,fall:gn,sit:wn,ride:xn,sleep:vn,dead:Rn,hop:En,swing:An,place:Sn,throw:kn,hurt:Tn,land:Cn,eat:Mn,drink:In,draw:Pn,block:Ln},Pr={blob:{walk:"hop",run:"hop",sneak:"hop"}},Lr={swing:.3,place:.2,throw:.45,hurt:.3,land:.22};var dt=Math.PI,ft={wave:{label:"\u041F\u043E\u043C\u0430\u0445\u0430\u0442\u044C",duration:2,emotion:"happy",tracks:{"armR.rz":[[0,0],[.25,2.7],[.5,2.3],[.75,2.8],[1,2.3],[1.25,2.8],[1.5,2.4],[2,0]],"armR.rx":[[0,0],[.25,.2],[1.75,.2],[2,0]],"head.rz":[[0,0],[.5,.1],[1.5,.1],[2,0]]}},cheer:{label:"\u0423\u0440\u0430!",duration:1.6,emotion:"happy",tracks:{"armL.rz":[[0,0],[.25,-2.8],[1.35,-2.8],[1.6,0]],"armR.rz":[[0,0],[.25,2.8],[1.35,2.8],[1.6,0]],"root.py":[[0,0],[.3,3],[.55,0],[.8,3],[1.05,0]]}},dance:{label:"\u0422\u0430\u043D\u0435\u0446",duration:2,loop:true,emotion:"happy",tracks:{"root.ry":[[0,.3],[.5,-0.3],[1,.3],[1.5,-0.3],[2,.3]],"armL.rz":[[0,-0.4],[.5,-2.4],[1,-0.4],[1.5,-2.4],[2,-0.4]],"armR.rz":[[0,2.4],[.5,.4],[1,2.4],[1.5,.4],[2,2.4]],"legL.rx":[[0,0],[.5,.5],[1,0],[2,0]],"legR.rx":[[0,0],[1,0],[1.5,.5],[2,0]],"root.py":[[0,0],[.25,1.5],[.5,0],[.75,1.5],[1,0],[1.25,1.5],[1.5,0],[1.75,1.5],[2,0]],"tail.ry":[[0,.6],[.5,-0.6],[1,.6],[1.5,-0.6],[2,.6]]}},point:{label:"\u0423\u043A\u0430\u0437\u0430\u0442\u044C",duration:1.6,tracks:{"armR.rx":[[0,0],[.2,1.55],[1.4,1.55],[1.6,0]]}},laugh:{label:"\u0421\u043C\u0435\u0445",duration:1.6,emotion:"happy",tracks:{"body.rx":[[0,0],[.2,.15],[.4,.05],[.6,.15],[.8,.05],[1,.15],[1.2,.05],[1.6,0]],"head.rx":[[0,0],[.2,.3],[1.4,.3],[1.6,0]],"armL.rx":[[0,0],[.2,.5],[1.4,.5],[1.6,0]],"armR.rx":[[0,0],[.2,.5],[1.4,.5],[1.6,0]]}},cry:{label:"\u041F\u043B\u0430\u043A\u0430\u0442\u044C",duration:2.4,emotion:"sad",tracks:{"head.rx":[[0,0],[.3,-0.4],[2.1,-0.4],[2.4,0]],"head.rz":[[0,0],[.6,.08],[.9,-0.08],[1.2,.08],[1.5,-0.08],[2.4,0]],"armR.rx":[[0,0],[.3,2.3],[2.1,2.3],[2.4,0]],"armR.ry":[[0,0],[.3,-0.6],[2.1,-0.6],[2.4,0]],"armL.rx":[[0,0],[.3,2.3],[2.1,2.3],[2.4,0]],"armL.ry":[[0,0],[.3,.6],[2.1,.6],[2.4,0]]}},bow:{label:"\u041F\u043E\u043A\u043B\u043E\u043D",duration:1.4,tracks:{"body.rx":[[0,0],[.4,-0.7],[1,-0.7],[1.4,0]],"armR.rx":[[0,0],[.4,.5],[1,.5],[1.4,0]]}},shrug:{label:"\u041F\u043E\u0436\u0430\u0442\u044C \u043F\u043B\u0435\u0447\u0430\u043C\u0438",duration:1.2,tracks:{"armL.rz":[[0,0],[.3,-0.5],[.9,-0.5],[1.2,0]],"armR.rz":[[0,0],[.3,.5],[.9,.5],[1.2,0]],"armL.rx":[[0,0],[.3,.6],[.9,.6],[1.2,0]],"armR.rx":[[0,0],[.3,.6],[.9,.6],[1.2,0]],"head.rz":[[0,0],[.3,.25],[.9,.25],[1.2,0]]}},facepalm:{label:"\u0420\u0443\u043A\u0430-\u043B\u0438\u0446\u043E",duration:1.6,emotion:"tired",tracks:{"armR.rx":[[0,0],[.3,2.5],[1.3,2.5],[1.6,0]],"armR.rz":[[0,0],[.3,-0.4],[1.3,-0.4],[1.6,0]],"head.rx":[[0,0],[.3,-0.35],[1.3,-0.35],[1.6,0]]}},sit:{label:"\u0421\u0435\u0441\u0442\u044C",duration:1,loop:true,tracks:{"legL.rx":[[0,dt*.46],[1,dt*.46]],"legR.rx":[[0,dt*.46],[1,dt*.46]],"root.py":[[0,-10],[1,-10]]}}},Zs=Object.keys(ft);function Qs(e){return typeof e=="string"&&e in ft}function _n(e,t){let r=e[0];if(t<=r[0])return r[1];for(let o=1;o<e.length;o++){let n=e[o];if(t<=n[0]){let a=e[o-1],i=(t-a[0])/Math.max(1e-6,n[0]-a[0]),c=i*i*(3-2*i);return a[1]+(n[1]-a[1])*c}}return e[e.length-1][1]}function _r(e,t,r){let o=t.loop?r%t.duration:Math.min(r,t.duration);for(let[n,a]of Object.entries(t.tracks)){let i=n.lastIndexOf("."),c=n.slice(0,i),s=n.slice(i+1);s in V&&u(e,c,s,_n(a,o));}}var zr={neutral:["neutral"],happy:["happy","neutral"],sad:["sad","tired","neutral"],angry:["angry","neutral"],surprised:["surprised","scared","neutral"],scared:["scared","surprised","sad","neutral"],tired:["tired","sad","neutral"],hurt:["hurt","angry","sad","neutral"]},Ut={neutral:{add:{},tempo:1},happy:{add:{"head.rx":.08},tempo:1.1},sad:{add:{"head.rx":-0.3,"body.rx":-0.08,"tail.rx":.5},tempo:.8},angry:{add:{"body.rx":-0.12,"head.rx":.1,"armL.rz":-0.1,"armR.rz":.1},tempo:1.1},surprised:{add:{"head.rx":.15,"body.rx":.05},tempo:1},scared:{add:{"body.rx":-0.1,"head.rx":-0.1,"armL.rx":.3,"armR.rx":.3,"tail.rx":.6},tempo:1.3},tired:{add:{"head.rx":-0.35,"body.rx":-0.12},tempo:.7},hurt:{add:{"body.rx":-0.1},tempo:1}};function Or(e,t,r){if(!(r<=0))for(let[o,n]of Object.entries(Ut[t].add)){let a=o.lastIndexOf(".");le(e,o.slice(0,a),o.slice(a+1),(n??0)*r);}}var oi={damaged:{emotion:"hurt",seconds:.8},lowHealth:{emotion:"tired"},nearDeath:{emotion:"scared"},achievement:{emotion:"happy",seconds:3},bossKilled:{emotion:"happy",seconds:5},tamed:{emotion:"happy",seconds:3},traded:{emotion:"happy",seconds:2},petDied:{emotion:"sad",seconds:6},explosion:{emotion:"surprised",seconds:1.5}};function ni(e){let t=[[/(>:\(|😠|😡|🤬)/u,"angry"],[/(:'\(|😢|😭)/u,"sad"],[/(:\(|☹|🙁|😞)/u,"sad"],[/(:o|:O|😮|😲)/u,"surprised"],[/(😱|😨)/u,"scared"],[/(-_-|😴|😩|🥱)/u,"tired"],[/(:\)|:D|\^\^|😀|😃|😄|😁|🙂|😊|😂)/u,"happy"]];for(let[r,o]of t)if(r.test(e))return o;return null}var zn=[{state:"dead",when:e=>e.dead,clip:"dead",blend:.25},{state:"sleep",when:e=>e.sleeping,clip:"sleep",blend:.3},{state:"ride",when:e=>e.riding,clip:"ride",blend:.2},{state:"sit",when:e=>e.sitting,clip:"sit",blend:.3},{state:"swim",when:e=>e.inWater&&!e.onGround&&!e.flying,clip:"swim",blend:.3},{state:"glide",when:e=>e.gliding,clip:"glide",blend:.25},{state:"fly",when:e=>e.flying,clip:"fly",blend:.25},{state:"fall",when:(e,t)=>t.airTime>.35&&e.vy<-4,clip:"fall",blend:.2},{state:"sneak",when:e=>e.sneaking,clip:"sneak",blend:.15},{state:"run",when:e=>e.sprinting&&e.speed>3||e.speed>6.5,clip:"run",blend:.15},{state:"walk",when:e=>e.speed>.4,clip:"walk",blend:.15},{state:"idle",when:()=>true,clip:"idle",blend:.2}],On=new Set(["hurt","land"]),Fn={eat:"eat",drink:"drink",draw:"draw",block:"block"},Nn={tail:(e,t)=>[["ry",-e.yawRate*.25+.12*Math.sin(t*2)],["rx",-(.1+Math.min(e.speed,8)*.06)]],cape:(e,t)=>[["rx",-(.05+Math.min(e.speed,8)*.12)-(e.speed>1?.06*Math.sin(t*9):0)-(e.vy<-3?.4:0)]],hair:e=>[["rx",-Math.min(e.speed,8)*.03]],ear:(e,t)=>[["rz",.08*Math.sin(t*1.3)+Math.min(e.speed,6)*.02]],antenna:(e,t)=>[["rx",.1*Math.sin(t*3)-e.vy*.02]],wingL:(e,t)=>e.flying||e.gliding||!e.onGround&&!e.inWater?[["rz",e.gliding?-0.05:-0.7*Math.sin(t*12)]]:[["rz",1.1+.05*Math.sin(t*1.5)]],wingR:(e,t)=>e.flying||e.gliding||!e.onGround&&!e.inWater?[["rz",e.gliding?.05:.7*Math.sin(t*12)]]:[["rz",-1.1-.05*Math.sin(t*1.5)]]},ut=e=>{let t=Math.max(0,Math.min(1,e));return t*t*(3-2*t)},bt=class{rig;style;faces;pose=new Map;expression="neutral";state="idle";stateT=0;clock=0;phase=0;airTime=0;wasOnGround=true;loco=new Map;from=new Map;lastLoco=new Map;blendT=1;blendDur=.2;tmp=new Map;actions=[];useClip=null;useW=0;emote=null;mood="neutral";moodOverGestures=false;flash=null;postureW=new Map;blinkT=3;blinking=0;talkT=0;springs=new Map;constructor(t,r,o=[]){this.rig=t,this.style=Bt(r),this.faces=new Set(o);}setRandom(t){this.random=t;}random=Math.random;setStyle(t){this.style=Bt(t);}setEmotion(t,r){r&&r>0?this.flash={emotion:t,left:r}:this.mood=t;}get emotion(){return this.emote?.def.emotion&&!this.moodOverGestures?this.emote.def.emotion:this.flash?.emotion??this.mood}get emoting(){return this.emote?.id??null}playEmote(t){this.emote={id:t,def:ft[t],t:0};}stopEmote(){this.emote=null;}trigger(t){switch(t){case "swing":case "place":case "throw":case "hurt":case "land":{let r=t;this.actions=this.actions.filter(o=>o.clip!==r),this.actions.push({clip:r,t:0,dur:Lr[r]??.3}),t==="hurt"&&this.setEmotion("hurt",.8);break}}}update(t,r=lt()){t=Math.min(t,.1),this.clock+=t;let o=this.emotion,n=Ut[o].tempo*this.style.tempo;!r.onGround&&!r.inWater?this.airTime+=t:(!this.wasOnGround&&this.airTime>.3&&r.onGround&&this.trigger("land"),this.airTime=0),this.wasOnGround=r.onGround,this.phase+=r.speed*t*3.5*n;let a=zn.find(l=>l.when(r,this));a.state!==this.state&&(it(this.from,this.lastLoco),this.state=a.state,this.stateT=0,this.blendT=0,this.blendDur=a.blend),this.stateT+=t,Ee(this.loco);let i=Pr[this.rig]?.[a.clip]??a.clip,c={t:this.stateT,k:0,phase:this.phase,input:r,style:this.style,clock:this.clock*n};if(mt[i](this.loco,c),Ee(this.pose),this.blendT<this.blendDur?(this.blendT+=t,Mr(this.pose,this.from,this.loco,ut(this.blendT/this.blendDur))):it(this.pose,this.loco),it(this.lastLoco,this.pose),this.emote){let l=this.emote;if(l.t+=t,r.speed>1||this.state!=="idle"||!l.def.loop&&l.t>=l.def.duration)this.emote=null;else {let p=l.def.loop?ut(l.t/.15):ut(Math.min(l.t/.15,(l.def.duration-l.t)/.15));Ee(this.tmp),_r(this.tmp,l.def,l.t),this.overlay(this.tmp,p,false);}}let s=r.use?Fn[r.use]:null;s&&(this.useClip=s),this.useW=Math.max(0,Math.min(1,this.useW+(s?t:-t)*8)),this.useClip&&this.useW>0?(Ee(this.tmp),mt[this.useClip](this.tmp,{...c,t:this.clock}),this.overlay(this.tmp,ut(this.useW),false)):r.held!=="none"&&!this.emote&&le(this.pose,"armR","rx",r.held==="staff"?.35:.2);for(let l of this.actions){l.t+=t;let h=Math.min(1,l.t/l.dur);Ee(this.tmp),mt[l.clip](this.tmp,{...c,t:l.t,k:h}),this.overlay(this.tmp,1,On.has(l.clip));}this.actions=this.actions.filter(l=>l.t<l.dur),this.state!=="dead"&&this.state!=="sleep"&&(le(this.pose,"head","ry",Math.max(-1.1,Math.min(1.1,r.lookYaw))),le(this.pose,"head","rx",Math.max(-1.2,Math.min(1.2,r.lookPitch)))),this.flash&&(this.flash.left-=t)<=0&&(this.flash=null);for(let l of a$1){let h=this.postureW.get(l)??0,m=h+((l===o?1:0)-h)*Math.min(1,t*6);this.postureW.set(l,m),this.state!=="dead"&&Or(this.pose,l,m);}for(let[l,h]of Object.entries(Nn))for(let[m,p]of h(r,this.clock)){let b=l+"."+m,g=this.springs.get(b);g||this.springs.set(b,g={x:p,v:0});let y=60,T=9;g.v+=(y*(p-g.x)-T*g.v)*t,g.x+=g.v*t,le(this.pose,l,m,g.x);}return this.expression=this.face(r,t,o),this.pose}overlay(t,r,o){for(let[n,a]of t){let i=Ne(this.pose,n);for(let c=0;c<9;c++)o?c>=V.sx?i[c]=i[c]*(1+(a[c]-1)*r):i[c]=i[c]+(a[c]-Fe[c])*r:i[c]=i[c]+(a[c]-i[c])*r;}}face(t,r,o){let n=i=>i.find(c=>this.faces.has(c))??"neutral";if(t.dead||this.state==="dead"||t.sleeping)return n(["blink","hurt","neutral"]);let a=n(zr[o]);return t.viseme!==void 0?(this.talkT=0,t.viseme!=="rest"&&t.viseme!=="MBP"?n(["talk",a]):a):t.talk?(this.talkT+=r,Math.floor(this.talkT/.12)%2===0?n(["talk",a]):a):(this.talkT=0,this.blinking>0?(this.blinking-=r,n(["blink",a])):(this.blinkT-=r,this.blinkT<=0&&(this.blinkT=2.5+this.random()*3,o!=="surprised"&&o!=="scared"&&o!=="hurt"&&(this.blinking=.13)),a))}};var Hn={idle:{},talk:{},walk:{speed:1.6},run:{speed:5.2},surprised:{emote:"shrug"},point:{emote:"point"},sit:{sitting:true},wave:{emote:"wave"},jump:{air:true},fall:{emote:"facepalm"},dance:{emote:"dance"}},Dn={handR:"handR",handL:"handL",head:"headTop"},yt=class{view;animator;input=lt();seed;pose="idle";jumpT=-1;constructor(t,r={}){this.view=new ct(t,{shadows:false,...r}),this.seed=r.seed??1,this.animator=this.newAnimator();}get group(){return this.view.group}get height(){return this.view.height}setSpec(t){let r=this.view.hash;this.view.setSpec(t),this.view.hash!==r&&(this.animator=this.newAnimator());}setEmotion(t){this.animator.setEmotion(t);}setViseme(t){this.input.viseme=t;}setPose(t){if(t===this.pose)return;this.pose=t;let r=Hn[t];this.input.speed=r.speed??0,this.input.sitting=!!r.sitting,r.emote&&this.animator.playEmote(r.emote),r.air&&(this.jumpT=0,this.animator.trigger("jump"));}playEmote(t){this.animator.playEmote(t);}trigger(t){if(t==="jump"){this.jumpT=0,this.animator.trigger("jump");return}this.animator.trigger(t);}attach(t,r){this.view.attach(Dn[t],r);}update(t){let r=this.input;this.jumpT>=0&&(this.jumpT+=t,r.onGround=this.jumpT>.6,r.vy=this.jumpT<.3?4:-4,r.onGround&&(this.jumpT=-1,r.vy=0,this.animator.trigger("land")));let o=this.animator.update(t,r);this.view.applyPose(o),this.view.setExpression(this.animator.expression);}dispose(){this.view.dispose();}newAnimator(){let t=this.view.spec,r=new bt(t.rig,t.style,this.view.expressions);return r.setRandom(a(this.seed)),r}};var Bn=He.map(e=>{let t=ae[e],r=t.bones.map(n=>`${n.name}@[${n.pivot.join(",")}]`).join(" "),o=t.defaultParts.map(n=>`${n.bone} ${n.size.join("x")} at [${n.pos.join(",")}]`).join("; ");return `- "${e}" \u2014 ${t.hint}. Bones (name@pivot): ${r}. Default body: ${o}.`}).join(`
2
- `),gi=`You design blocky voxel characters for a Minecraft-like game. Reply with ONE JSON object \u2014 a CharacterSpec \u2014 and nothing else: no markdown, no comments, no explanations.
1
+ import {c,d}from'../chunk-YOAPVGXE.js';import {b,a}from'../chunk-CGF2TQVK.js';import {i,b as b$1,d as d$1}from'../chunk-MNDPJKUD.js';export{b as EMOTIONS,c as isEmotion}from'../chunk-MNDPJKUD.js';import*as V from'three';import {mergeGeometries}from'three/examples/jsm/utils/BufferGeometryUtils.js';import {RoomEnvironment}from'three/examples/jsm/environments/RoomEnvironment.js';var za={id:"avatar",label:"\u0410\u0432\u0430\u0442\u0430\u0440",hint:"the iDos Games account avatar: soft blocks with elbows and knees",bones:[{name:"body",role:"body",parent:null,pivot:[0,12.4,0]},{name:"head",role:"head",parent:"body",pivot:[0,22.4,0]},{name:"armL",role:"armL",parent:"body",pivot:[-6.3,21.4,0]},{name:"armR",role:"armR",parent:"body",pivot:[6.3,21.4,0]},{name:"foreArmL",role:"foreArmL",parent:"armL",pivot:[-6.3,17.2,0]},{name:"foreArmR",role:"foreArmR",parent:"armR",pivot:[6.3,17.2,0]},{name:"legL",role:"legL",parent:null,pivot:[-2.1,12.4,0]},{name:"legR",role:"legR",parent:null,pivot:[2.1,12.4,0]},{name:"shinL",role:"shinL",parent:"legL",pivot:[-2.1,6.4,0]},{name:"shinR",role:"shinR",parent:"legR",pivot:[2.1,6.4,0]}],sockets:[{name:"handR",bone:"foreArmR",at:[6.3,11.6,-1]},{name:"handL",bone:"foreArmL",at:[-6.3,11.6,-1]},{name:"headTop",bone:"head",at:[0,30.3,0]},{name:"face",bone:"head",at:[0,26.7,-4]},{name:"back",bone:"body",at:[0,18.5,2.3]},{name:"waist",bone:"body",at:[0,12.8,0]},{name:"shoulders",bone:"body",at:[0,22.4,0]}],hitbox:{w:.6,h:1.9},eye:26.4,height:{min:24,max:40},faceBone:"head",defaultParts:[{bone:"head",size:[8.5,7.5,8],pos:[0,26.5,0],color:"s",name:"head"},{bone:"head",size:[2.9,.8,2.7],pos:[0,22.6,0],color:"s",name:"neck"},{bone:"body",size:[9,6,4.6],pos:[0,19.4,0],color:"t",name:"torso"},{bone:"body",size:[8.5,5.2,4.3],pos:[0,15,0],color:"t",name:"torso"},{bone:"armL",size:[3.6,5,3.6],pos:[-6.3,19.7,0],color:"s",name:"sleeveL"},{bone:"armR",size:[3.6,5,3.6],pos:[6.3,19.7,0],color:"s",name:"sleeveR"},{bone:"foreArmL",size:[3.45,5.4,3.45],pos:[-6.3,15.7,0],color:"s",name:"forearmL"},{bone:"foreArmR",size:[3.45,5.4,3.45],pos:[6.3,15.7,0],color:"s",name:"forearmR"},{bone:"foreArmL",size:[3.3,3,3.3],pos:[-6.3,12.7,0],color:"s",name:"handL"},{bone:"foreArmR",size:[3.3,3,3.3],pos:[6.3,12.7,0],color:"s",name:"handR"},{bone:"legL",size:[4.2,6,4.2],pos:[-2.1,9.4,0],color:"p",name:"legL"},{bone:"legR",size:[4.2,6,4.2],pos:[2.1,9.4,0],color:"p",name:"legR"},{bone:"shinL",size:[4.05,7.2,4.05],pos:[-2.1,4,0],color:"p",name:"legL"},{bone:"shinR",size:[4.05,7.2,4.05],pos:[2.1,4,0],color:"p",name:"legR"},{bone:"shinL",size:[4.2,1.6,5.2],pos:[-2.1,.8,-0.5],color:"p",name:"footL"},{bone:"shinR",size:[4.2,1.6,5.2],pos:[2.1,.8,-0.5],color:"p",name:"footR"}]};var Pa={id:"blob",label:"\u041A\u0430\u043F\u043B\u044F",hint:"slimes, ghosts, spirits, living objects \u2014 one body with a face, moves by hopping",bones:[{name:"body",role:"body",parent:null,pivot:[0,0,0]}],sockets:[{name:"headTop",bone:"body",at:[0,12,0]},{name:"face",bone:"body",at:[0,7,-6]},{name:"back",bone:"body",at:[0,6,6]},{name:"waist",bone:"body",at:[0,3,0]},{name:"shoulders",bone:"body",at:[0,10,0]},{name:"handR",bone:"body",at:[6,5,-2]},{name:"handL",bone:"body",at:[-6,5,-2]}],hitbox:{w:.8,h:.8},eye:8,height:{min:4,max:40},faceBone:"body",defaultParts:[{bone:"body",size:[12,12,12],pos:[0,6,0],color:"t"}]};var Ia={id:"flyer",label:"\u041A\u0440\u044B\u043B\u0430\u0442\u044B\u0439",hint:"birds, bats, dragons, fairies, insects \u2014 creatures whose wings matter",bones:[{name:"body",role:"body",parent:null,pivot:[0,6,0]},{name:"head",role:"head",parent:"body",pivot:[0,11,-3]},{name:"wingL",role:"wingL",parent:"body",pivot:[-3,10,0]},{name:"wingR",role:"wingR",parent:"body",pivot:[3,10,0]},{name:"legL",role:"legL",parent:null,pivot:[-1.5,4,0]},{name:"legR",role:"legR",parent:null,pivot:[1.5,4,0]},{name:"tail",role:"tail",parent:"body",pivot:[0,8,4]}],sockets:[{name:"headTop",bone:"head",at:[0,16,-4]},{name:"face",bone:"head",at:[0,13,-7]},{name:"back",bone:"body",at:[0,11,1]},{name:"waist",bone:"body",at:[0,6,0]},{name:"shoulders",bone:"body",at:[0,10,-2]},{name:"handR",bone:"legR",at:[1.5,0,-1]},{name:"handL",bone:"legL",at:[-1.5,0,-1]}],hitbox:{w:.6,h:.9},eye:14,height:{min:6,max:40},faceBone:"head",defaultParts:[{bone:"body",size:[6,6,8],pos:[0,8,0],color:"t"},{bone:"head",size:[5,5,5],pos:[0,13,-4],color:"s"},{bone:"wingL",size:[8,1,6],pos:[-7,10,0],color:"t"},{bone:"wingR",size:[8,1,6],pos:[7,10,0],color:"t"},{bone:"legL",size:[1,4,1],pos:[-1.5,2,0],color:"p"},{bone:"legR",size:[1,4,1],pos:[1.5,2,0],color:"p"},{bone:"tail",size:[4,1,4],pos:[0,8,6],color:"t"}]};var _a={id:"humanoid",label:"\u0427\u0435\u043B\u043E\u0432\u0435\u043A",hint:"people, humanoids, robots, elves, zombies \u2014 anything on two legs with two arms",bones:[{name:"body",role:"body",parent:null,pivot:[0,12,0]},{name:"head",role:"head",parent:"body",pivot:[0,24,0]},{name:"armL",role:"armL",parent:"body",pivot:[-6,22,0]},{name:"armR",role:"armR",parent:"body",pivot:[6,22,0]},{name:"legL",role:"legL",parent:null,pivot:[-2,12,0]},{name:"legR",role:"legR",parent:null,pivot:[2,12,0]}],sockets:[{name:"handR",bone:"armR",at:[6,11,-1]},{name:"handL",bone:"armL",at:[-6,11,-1]},{name:"headTop",bone:"head",at:[0,32,0]},{name:"face",bone:"head",at:[0,28,-4]},{name:"back",bone:"body",at:[0,18,2]},{name:"waist",bone:"body",at:[0,12,0]},{name:"shoulders",bone:"body",at:[0,24,0]}],hitbox:{w:.6,h:1.8},eye:27,height:{min:16,max:48},faceBone:"head",defaultParts:[{bone:"head",size:[8,8,8],pos:[0,28,0],color:"s"},{bone:"body",size:[8,12,4],pos:[0,18,0],color:"t"},{bone:"armL",size:[4,12,4],pos:[-6,18,0],color:"s"},{bone:"armR",size:[4,12,4],pos:[6,18,0],color:"s"},{bone:"legL",size:[4,12,4],pos:[-2,6,0],color:"p"},{bone:"legR",size:[4,12,4],pos:[2,6,0],color:"p"}]};var Oa={id:"quadruped",label:"\u0427\u0435\u0442\u0432\u0435\u0440\u043E\u043D\u043E\u0433\u043E\u0435",hint:"dogs, cats, horses, wolves, bears, lizards \u2014 any animal on four legs",bones:[{name:"body",role:"body",parent:null,pivot:[0,12,0]},{name:"head",role:"head",parent:"body",pivot:[0,14,-8]},{name:"legFL",role:"legFL",parent:null,pivot:[-3,8,-6]},{name:"legFR",role:"legFR",parent:null,pivot:[3,8,-6]},{name:"legBL",role:"legBL",parent:null,pivot:[-3,8,6]},{name:"legBR",role:"legBR",parent:null,pivot:[3,8,6]},{name:"tail",role:"tail",parent:"body",pivot:[0,14,8]}],sockets:[{name:"headTop",bone:"head",at:[0,20,-12]},{name:"face",bone:"head",at:[0,16,-16]},{name:"back",bone:"body",at:[0,16,0]},{name:"waist",bone:"body",at:[0,12,4]},{name:"shoulders",bone:"body",at:[0,16,-6]},{name:"handR",bone:"head",at:[2,13,-16]},{name:"handL",bone:"head",at:[-2,13,-16]}],hitbox:{w:.9,h:1},eye:17,height:{min:8,max:40},faceBone:"head",defaultParts:[{bone:"body",size:[8,8,16],pos:[0,12,0],color:"t"},{bone:"head",size:[8,8,8],pos:[0,16,-12],color:"s"},{bone:"legFL",size:[3,8,3],pos:[-3,4,-6],color:"p"},{bone:"legFR",size:[3,8,3],pos:[3,4,-6],color:"p"},{bone:"legBL",size:[3,8,3],pos:[-3,4,6],color:"p"},{bone:"legBR",size:[3,8,3],pos:[3,4,6],color:"p"},{bone:"tail",size:[2,2,8],pos:[0,14,12],color:"t"}]};var Fa={id:"swimmer",label:"\u041F\u043B\u043E\u0432\u0435\u0446",hint:"fish, sharks, dolphins, whales \u2014 creatures that swim with a tail",bones:[{name:"body",role:"body",parent:null,pivot:[0,6,0]},{name:"head",role:"head",parent:"body",pivot:[0,6,-4]},{name:"tail",role:"tail",parent:"body",pivot:[0,6,4]},{name:"finL",role:"ear",parent:"body",pivot:[-3,5,-1]},{name:"finR",role:"ear",parent:"body",pivot:[3,5,-1]}],sockets:[{name:"headTop",bone:"head",at:[0,10,-6]},{name:"face",bone:"head",at:[0,7,-9]},{name:"back",bone:"body",at:[0,10,0]},{name:"waist",bone:"body",at:[0,6,0]},{name:"shoulders",bone:"body",at:[0,9,-3]},{name:"handR",bone:"head",at:[1,4,-9]},{name:"handL",bone:"head",at:[-1,4,-9]}],hitbox:{w:.7,h:.6},eye:8,height:{min:4,max:40},faceBone:"head",defaultParts:[{bone:"body",size:[5,7,9],pos:[0,6,0],color:"t"},{bone:"head",size:[5,6,4],pos:[0,6,-6.5],color:"s"},{bone:"tail",size:[1,6,4],pos:[0,6,7],color:"t"},{bone:"finL",size:[3,.6,2],pos:[-4,5,-1],color:"p"},{bone:"finR",size:[3,.6,2],pos:[4,5,-1],color:"p"}]};var N0=["root","body","head","armL","armR","legL","legR","foreArmL","foreArmR","shinL","shinR","legFL","legFR","legBL","legBR","tail","wingL","wingR","ear","hair","cape","antenna","static"],fr=["tail","wingL","wingR","ear","hair","cape","antenna","static"],B0=["handR","handL","headTop","face","back","waist","shoulders"],Ht=["humanoid","quadruped","flyer","blob","swimmer"],At="avatar";var Ie={humanoid:_a,quadruped:Oa,flyer:Ia,blob:Pa,swimmer:Fa,avatar:za};var Da=1,Ke=["front","back","left","right","top","bottom"],Gt=["neutral","blink","happy","sad","angry","surprised","scared","tired","hurt","talk"],Ut=["normal","bouncy","heavy","sneaky","robotic","swagger","skip","ninja","zombie","catwalk"],qt=["calm","fidgety","proud","cool","shy","ready","bored"],Va={parts:96,bones:16,palette:32,textures:48,texturePixels:32768,textureSide:32,partSide:32,coord:64},St=["glass","metal","glow"],Q0=["cylinder"],kt={noise:.5,outline:.4,shade:.25,density:2},$=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),jt=e=>Array.isArray(e)?e:[];function ke(e,t,r,a){let o=typeof e=="number"?e:typeof e=="string"?Number(e):NaN;return Number.isFinite(o)?Math.min(a,Math.max(r,o)):t}function Hr(e,t,r){if(typeof e!="string")return r;let a=e.trim();if(t.includes(a))return a;let o=a.toLowerCase().replace(/[\s-]+/g,"_");return t.find(s=>s.toLowerCase()===o)??r}function _e(e,t,r){return typeof e=="string"?e.trim().slice(0,r):t}function br(e,t,r=null){if(!Array.isArray(e)||e.length<3)return r;let a=e.slice(0,3).map(o=>ke(o,NaN,-t,t));return a.every(Number.isFinite)?a:r}var Na={black:"#1d1d21",white:"#f0f0f0",gray:"#808080",grey:"#808080",red:"#c0392b",green:"#3c9a3c",blue:"#2f5fd0",yellow:"#f2d33c",orange:"#e8862a",purple:"#8a4fc4",pink:"#f08cb4",brown:"#7a4f2a",cyan:"#2ab0c0",gold:"#d8b030",silver:"#c0c4c8",skin:"#c69c7c"};function je(e){if(typeof e!="string")return null;let t=e.trim().toLowerCase();if(Na[t])return Na[t];let r=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/.exec(t);if(!r)return null;let a=r[1];return "#"+(a.length===3?a.split("").map(o=>o+o).join(""):a)}var Xe=new Set(["."," "]),Ba=e=>/^[A-Za-z0-9_]{1,24}$/.test(e),sn={human:"humanoid",biped:"humanoid",person:"humanoid",animal:"quadruped",four_legs:"quadruped",quadrupedal:"quadruped",bird:"flyer",winged:"flyer",dragon:"flyer",slime:"blob",ghost:"blob",fish:"swimmer",shark:"swimmer",aquatic:"swimmer"};function ln(e){if(typeof e!="string")return "humanoid";let t=e.trim().toLowerCase().replace(/[\s-]+/g,"_");return Ht.includes(t)?t:t===At?At:sn[t]??"humanoid"}function Ha(e,t){let r=/^(.*?)(L|R)$/.exec(e);if(!r)return e;let a=r[1]+(r[2]==="L"?"R":"L");return t(a)?a:e}function Oe(e){if(typeof e=="string"){let y=d(e);if(!y.ok)return {ok:false,error:y.error,truncated:y.truncated};e=y.value;}if(!$(e))return {ok:false,error:c({en:"the character recipe is not an object",ru:"\u0440\u0435\u0446\u0435\u043F\u0442 \u043F\u0435\u0440\u0441\u043E\u043D\u0430\u0436\u0430 \u2014 \u043D\u0435 \u043E\u0431\u044A\u0435\u043A\u0442"})};if(!("parts"in e)&&!("rig"in e)){let y=e.character??e.spec??e.characterSpec;$(y)&&(e=y);}let t=e,r=Va,a=[];typeof t.version=="number"&&t.version>Da&&a.push(c({en:"recipe version {v} is newer than the game \u2014 read what could be read",ru:"\u0440\u0435\u0446\u0435\u043F\u0442 \u0432\u0435\u0440\u0441\u0438\u0438 {v} \u2014 \u043D\u043E\u0432\u0435\u0435 \u0438\u0433\u0440\u044B, \u0440\u0430\u0437\u043E\u0431\u0440\u0430\u043D\u043E \u0447\u0442\u043E \u043F\u043E\u043D\u044F\u0442\u043D\u043E"},{v:t.version}));let o=ln(t.rig),n=Ie[o],s={};if($(t.palette))for(let[y,z]of Object.entries(t.palette)){if(Object.keys(s).length>=r.palette){a.push(c({en:"the palette is longer than {n} \u2014 the rest was dropped",ru:"\u043F\u0430\u043B\u0438\u0442\u0440\u0430 \u0434\u043B\u0438\u043D\u043D\u0435\u0435 {n} \u2014 \u043B\u0438\u0448\u043D\u0435\u0435 \u043E\u0442\u0431\u0440\u043E\u0448\u0435\u043D\u043E"},{n:r.palette}));break}let C=je(z);if(y.length!==1||Xe.has(y)||!C){a.push(c({en:"palette colour \xAB{k}\xBB was not understood",ru:"\u0446\u0432\u0435\u0442 \u043F\u0430\u043B\u0438\u0442\u0440\u044B \xAB{k}\xBB \u043D\u0435 \u043F\u043E\u043D\u044F\u0442"},{k:y}));continue}s[y]=C;}let l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",i=(y,z)=>{if(typeof y!="string")return z;if(y.length===1&&s[y])return y;let C=je(y);if(!C)return z;let L=Object.entries(s).find(([,_])=>_===C);if(L)return L[0];if(Object.keys(s).length>=r.palette)return z;let I=[...l].find(_=>!s[_]);return I?(s[I]=C,I):z},d$1={},c$1=0;if($(t.textures))for(let[y,z]of Object.entries(t.textures)){if(!Ba(y)){a.push(c({en:"texture name \xAB{id}\xBB does not fit",ru:"\u0438\u043C\u044F \u0442\u0435\u043A\u0441\u0442\u0443\u0440\u044B \xAB{id}\xBB \u043D\u0435 \u043F\u043E\u0434\u0445\u043E\u0434\u0438\u0442"},{id:y.slice(0,30)}));continue}if(Object.keys(d$1).length>=r.textures){a.push(c({en:"more than {n} textures \u2014 the rest were dropped",ru:"\u0442\u0435\u043A\u0441\u0442\u0443\u0440 \u0431\u043E\u043B\u044C\u0448\u0435 {n} \u2014 \u043B\u0438\u0448\u043D\u0438\u0435 \u043E\u0442\u0431\u0440\u043E\u0448\u0435\u043D\u044B"},{n:r.textures}));break}let C=pn(z,s,a,y);if(C){if(c$1+C.w*C.h>r.texturePixels){a.push(c({en:"texture \xAB{id}\xBB did not fit the pixel limit",ru:"\u0442\u0435\u043A\u0441\u0442\u0443\u0440\u0430 \xAB{id}\xBB \u043D\u0435 \u0432\u043B\u0435\u0437\u043B\u0430 \u0432 \u043B\u0438\u043C\u0438\u0442 \u043F\u0438\u043A\u0441\u0435\u043B\u0435\u0439"},{id:y}));continue}c$1+=C.w*C.h,d$1[y]=C;}}let h=new Set(n.bones.map(y=>y.name)),p=[];for(let y of jt(t.bones)){if(!$(y))continue;let z=_e(y.name,"",24);if(!z||!Ba(z))continue;let C=br(y.pivot,r.coord);if(!C||p.some(T=>T.name===z))continue;if(p.length>=r.bones){a.push(c({en:"more than {n} bones \u2014 the rest were dropped",ru:"\u043A\u043E\u0441\u0442\u0435\u0439 \u0431\u043E\u043B\u044C\u0448\u0435 {n} \u2014 \u043B\u0438\u0448\u043D\u0438\u0435 \u043E\u0442\u0431\u0440\u043E\u0448\u0435\u043D\u044B"},{n:r.bones}));break}let L=h.has(z),I=_e(y.parent,"",24),_=L?n.bones.find(T=>T.name===z).parent??"":h.has(I)||p.some(T=>T.name===I)?I:n.bones.find(T=>T.role==="body").name;p.push({name:z,parent:_,pivot:C,role:L?"static":Hr(y.role,fr,"static")}),h.add(z);}let m=Object.keys(s)[0]??"s",g=[];for(let y of jt(t.parts)){if(g.length>=r.parts){a.push(c({en:"more than {n} parts \u2014 the rest were dropped",ru:"\u0434\u0435\u0442\u0430\u043B\u0435\u0439 \u0431\u043E\u043B\u044C\u0448\u0435 {n} \u2014 \u043B\u0438\u0448\u043D\u0438\u0435 \u043E\u0442\u0431\u0440\u043E\u0448\u0435\u043D\u044B"},{n:r.parts}));break}if(!$(y))continue;let z=br(y.size,r.partSide),C=br(y.pos??y.center??y.at,r.coord);if(!z||!C||z.some(D=>D<=0))continue;let L=_e(y.bone,"",24);h.has(L)||(L&&a.push(c({en:"bone \xAB{b}\xBB not found \u2014 the part is on the body",ru:"\u043A\u043E\u0441\u0442\u044C \xAB{b}\xBB \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u0430 \u2014 \u0434\u0435\u0442\u0430\u043B\u044C \u043D\u0430 \u0442\u0435\u043B\u0435"},{b:L})),L=n.bones.find(D=>D.role==="body").name);let I={bone:L,size:z,pos:C,color:i(y.color,m)};if($(y.faces)){let D={};for(let W of Ke){let Q=y.faces[W];if(typeof Q=="string")if(d$1[Q])D[W]=Q;else {let Ee=i(Q,"");Ee&&(D[W]=Ee);}}Object.keys(D).length&&(I.faces=D);}let _=br(y.rot??y.rotation,180);_&&_.some(D=>D!==0)&&(I.rot=_),(y.mirror===true||y.mirror==="x")&&(I.mirror=true);let T=_e(y.name,"",24);T&&(I.name=T),y.shape==="cylinder"&&(I.shape="cylinder"),typeof y.mat=="string"&&St.includes(y.mat)&&(I.mat=y.mat),y.wrap===true&&(I.wrap=true),g.push(I);}if(!g.length){for(let[y,z]of Object.entries(cn))s[y]||(s[y]=z);g.push(...n.defaultParts.map(mn));}let b=null;if($(t.face)){let y=t.face,z=h.has(_e(y.bone,"",24))?_e(y.bone,"",24):n.faceBone,C=jt(y.rect).map(I=>Math.round(ke(I,NaN,0,r.partSide)*10)/10),L={};if($(y.expressions))for(let I of Gt){let _=y.expressions[I];typeof _=="string"&&d$1[_]&&(L[I]=_);}if(!L.neutral){let I=Object.values(L)[0];I&&(L.neutral=I);}if(L.neutral){let I=d$1[L.neutral];if(b={bone:z,rect:C.length===4&&C.every(Number.isFinite)&&C[2]>0&&C[3]>0?C:[0,0,I.w,I.h],expressions:L},$(y.drawn)){let _=y.drawn;b.drawn={eyes:_e(_.eyes,"round",16),brows:_e(_.brows,"none",16),mouth:_e(_.mouth,"smile",16),eyeColor:je(_.eyeColor)??"#3b2a20",cheeks:_.cheeks===true};}}else Object.keys(y).length&&a.push(c({en:"the face has no pictures \u2014 no face is drawn",ru:"\u0443 \u043B\u0438\u0446\u0430 \u043D\u0435\u0442 \u043D\u0438 \u043E\u0434\u043D\u043E\u0439 \u043A\u0430\u0440\u0442\u0438\u043D\u043A\u0438 \u2014 \u043B\u0438\u0446\u043E \u043D\u0435 \u043D\u0430\u0440\u0438\u0441\u043E\u0432\u0430\u043D\u043E"}));}let v=$(t.style)?t.style:{},E=$(t.voice)?t.voice:{},M=$(t.finish)?t.finish:{},R={version:Da,name:_e(t.name,yr(),40)||yr(),description:_e(t.description,"",300),rig:o,scale:ke(t.scale,1,.25,3),palette:s,textures:d$1,parts:g,bones:p,face:b,style:{walk:Hr(v.walk,Ut,"normal"),idle:Hr(v.idle,qt,"calm"),energy:ke(v.energy,.5,0,1)},voice:{pitch:ke(E.pitch,1,.5,2)},tags:jt(t.tags).filter(y=>typeof y=="string"&&!!y.trim()).slice(0,8).map(y=>y.trim().slice(0,24)),finish:{noise:ke(M.noise,kt.noise,0,1),outline:ke(M.outline,kt.outline,0,1),shade:ke(M.shade,kt.shade,0,1),density:Math.round(ke(M.density,kt.density,1,4))}},k=ke(M.round,0,0,1);return k>0&&(R.finish.round=k),{ok:true,spec:R,warnings:a}}var cn={s:"#c69c7c",t:"#3a8fd6",p:"#2c3e6b"};function mn(e){return JSON.parse(JSON.stringify(e))}function pn(e,t,r,a){let o=Array.isArray(e)?{rows:e}:$(e)?e:null;if(!o)return null;let n=Va.textureSide,s=jt(o.rows??o.pixels).filter(c=>typeof c=="string");if(!s.length)return null;let l=Math.round(ke(o.h??o.height,s.length,1,n)),i=Math.round(ke(o.w??o.width,Math.max(...s.map(c=>c.length)),1,n)),d=false;for(s=s.slice(0,l).map(c=>{let h="";for(let p=0;p<i;p++){let m=c[p]??".";Xe.has(m)||t[m]?h+=m===" "?".":m:(d=true,h+=".");}return h});s.length<l;)s.push(".".repeat(i));return d&&r.push(c({en:"texture \xAB{id}\xBB has symbols not in the palette \u2014 they became transparent",ru:"\u0432 \u0442\u0435\u043A\u0441\u0442\u0443\u0440\u0435 \xAB{id}\xBB \u0441\u0438\u043C\u0432\u043E\u043B\u044B \u043D\u0435 \u0438\u0437 \u043F\u0430\u043B\u0438\u0442\u0440\u044B \u2014 \u0441\u0442\u0430\u043B\u0438 \u043F\u0440\u043E\u0437\u0440\u0430\u0447\u043D\u044B\u043C\u0438"},{id:a})),{w:i,h:l,rows:s}}function jr(e){return Array.isArray(e)?"["+e.map(jr).join(",")+"]":$(e)?"{"+Object.keys(e).filter(t=>e[t]!==void 0).sort().map(t=>JSON.stringify(t)+":"+jr(e[t])).join(",")+"}":JSON.stringify(e)}function vt(e){let t=jr(e),r=b(t),a=b("~"+t);return r.toString(16).padStart(8,"0")+a.toString(16).padStart(8,"0")}function el(e){return Ie[e.rig]}function ja(e){let r=Ie[e.rig].bones.map(a=>{let o=e.bones.find(n=>n.name===a.name);return {name:a.name,role:a.role,parent:a.parent,pivot:(o?.pivot??a.pivot).slice()}});for(let a of e.bones)r.some(o=>o.name===a.name)||r.push({name:a.name,role:a.role,parent:a.parent,pivot:a.pivot.slice()});return r}function yr(){return c({en:"Character",ru:"\u041F\u0435\u0440\u0441\u043E\u043D\u0430\u0436"})}var tl=e=>e==="\u041F\u0435\u0440\u0441\u043E\u043D\u0430\u0436"||e==="Character";var Ga={front:{tl:[1,1,-1],u:[-1,0,0],d:[0,-1,0],n:[0,0,-1]},back:{tl:[-1,1,1],u:[1,0,0],d:[0,-1,0],n:[0,0,1]},right:{tl:[1,1,1],u:[0,0,-1],d:[0,-1,0],n:[1,0,0]},left:{tl:[-1,1,-1],u:[0,0,1],d:[0,-1,0],n:[-1,0,0]},top:{tl:[1,1,1],u:[-1,0,0],d:[0,0,-1],n:[0,1,0]},bottom:{tl:[-1,-1,1],u:[1,0,0],d:[0,0,-1],n:[0,-1,0]}};function Gr(e){let t=parseInt(e.slice(1),16);return [t>>16&255,t>>8&255,t&255]}function Ua(e,t,r,a,o,n){let s=((r-1-o)*t+a)*4;e[s]=n[0],e[s+1]=n[1],e[s+2]=n[2],e[s+3]=255;}function dn(e,t=0){e.sort((r,a)=>a.h-r.h||a.w-r.w||(r.key<a.key?-1:1));for(let r=16;;r*=2){let a=0,o=0,n=0;for(let l of e)a+l.w+t*2>r&&(a=0,o+=n,n=0),l.x=a+t,l.y=o+t,a+=l.w+t*2,n=Math.max(n,l.h+t*2);let s=o+n;if(s<=r||r>=1024){let l=16;for(;l<s;)l*=2;return {w:r,h:l}}}}function hn(e,t,r,a,o){let n=(s,l)=>((r-1-a.y-l)*t+a.x+s)*4;for(let s=-o;s<a.h+o;s++)for(let l=-o;l<a.w+o;l++){let i=Math.max(0,Math.min(a.w-1,l)),d=Math.max(0,Math.min(a.h-1,s));if(i===l&&d===s)continue;let c=n(i,d);e.copyWithin(n(l,s),c,c+4);}}function qa(e,t,r){let a=Math.imul(t,374761393)+Math.imul(r,668265263)+Math.imul(e,2246822519);return a=Math.imul(a^a>>>13,1274126177),((a^a>>>16)>>>0)/4294967296}function un(e,t,r,a,o,n,s,l){let d=1+(.55*qa(s,t,r)+.45*qa(s^1540483477,Math.floor(t/3),Math.floor(r/3))-.5)*2*l.noise*.14;return n==="s"?d+=l.shade*.16*(.5-(r+.5)/o):n==="t"?d+=l.shade*.08:d-=l.shade*.2,a>=3&&o>=3&&(t===0||r===0||t===a-1||r===o-1)&&(d*=1-.5*l.outline),[Math.max(0,Math.min(255,e[0]*d)),Math.max(0,Math.min(255,e[1]*d)),Math.max(0,Math.min(255,e[2]*d))]}var Et=Math.PI/180;function Tt(e,t){if(!t)return e;let[r,a,o]=e,[n,s,l]=[t[0]*Et,t[1]*Et,t[2]*Et],i=Math.cos(l),d=Math.sin(l);return [r,a]=[r*i-a*d,r*d+a*i],i=Math.cos(s),d=Math.sin(s),[r,o]=[r*i+o*d,-r*d+o*i],i=Math.cos(n),d=Math.sin(n),[a,o]=[a*i-o*d,a*d+o*i],[r,a,o]}function fn(e,t){let r=[];for(let a of e.parts){if(r.push({...a,flip:false}),!a.mirror)continue;let o=a.faces?{...a.faces,left:a.faces.right,right:a.faces.left}:void 0;o&&(o.left===void 0&&delete o.left,o.right===void 0&&delete o.right);let n={...a,bone:Ha(a.bone,t),pos:[-a.pos[0],a.pos[1],a.pos[2]],flip:true};o?n.faces=o:delete n.faces,a.rot&&(n.rot=[a.rot[0],-a.rot[1],-a.rot[2]]),r.push(n);}return r}function Ka(e){let t=Ie[e.rig],r=ja(e),a=x=>r.some(P=>P.name===x),o=fn(e,a),n=e.finish??kt,s=n.round??0,l=new Map,i=(x,P)=>{let F=x.faces?.[P],B=F!==void 0?e.textures[F]:void 0,oe=F!==void 0&&e.palette[F]?F:x.color,[xe,Le]=P==="front"||P==="back"?[x.size[0],x.size[1]]:P==="left"||P==="right"?[x.size[2],x.size[1]]:[x.size[0],x.size[2]],Re=(Bt,ze)=>Math.max(1,Math.min(64,ze*Math.max(1,Math.round(Bt*n.density/ze)))),fe=B?Re(xe,B.w):Re(xe,1),Ae=B?Re(Le,B.h):Re(Le,1),Te=P==="top"?"t":P==="bottom"?"b":"s",ee=(B?"t:"+F:"c:"+oe)+"|"+fe+"x"+Ae+Te,se=l.get(ee);if(se)return se;let Y=b(ee),st=B?null:Gr(e.palette[oe]??"#ff00ff");return se={key:ee,w:fe,h:Ae,x:0,y:0,paint:(Bt,ze,mr,pr,dr)=>{for(let Ue=0;Ue<Ae;Ue++)for(let qe=0;qe<fe;qe++){let Vt=st;if(B){let hr=B.rows[Math.floor(Ue*B.h/Ae)][Math.floor(qe*B.w/fe)];if(Xe.has(hr))continue;let Pe=e.palette[hr];if(!Pe)continue;Vt=Gr(Pe);}Ua(Bt,ze,mr,pr+qe,dr+Ue,un(Vt,qe,Ue,fe,Ae,Te,Y,n));}}},l.set(ee,se),se},d=(x,P)=>{let F="e:"+x,B=l.get(F);return B||(B={key:F,w:P.w,h:P.h,x:0,y:0,paint:(oe,xe,Le,Re,fe)=>{for(let Ae=0;Ae<P.h;Ae++)for(let Te=0;Te<P.w;Te++){let ee=P.rows[Ae][Te];if(Xe.has(ee))continue;let se=e.palette[ee];se&&Ua(oe,xe,Le,Re+Te,fe+Ae,Gr(se));}}},l.set(F,B)),B},c=o.map(x=>({p:x,faces:Ke.map(P=>({f:P,cell:i(x,P)}))})),h=e.face,p=[];if(h)for(let[x,P]of Object.entries(h.expressions)){let F=e.textures[P];F&&p.push([x,d(P,F)]);}let m=s>0?2:0,{w:g,h:b$1}=dn([...l.values()],m),v=new Uint8Array(g*b$1*4);for(let x of l.values())x.paint(v,g,b$1,x.x,x.y),m&&hn(v,g,b$1,x,m);let E=.01,M=(x,P=E)=>[(x.x+P)/g,1-(x.y+P)/b$1,(x.x+x.w-P)/g,1-(x.y+x.h-P)/b$1],R=new Map;for(let x of r)R.set(x.name,{pos:[],nrm:[],uv:[],idx:[]});let k=new Map,y=x=>{let P=k.get(x);if(P===void 0){P=true;for(let F=0;F<x.h&&P;F++)for(let B=0;B<x.w;B++)if(v[((b$1-1-x.y-F)*g+x.x+B)*4+3]<128){P=false;break}k.set(x,P);}return P},z=new Map;for(let{p:x}of c)x.shape==="cylinder"&&!z.has(x.bone)&&z.set(x.bone,x);let C=x=>!!x.wrap&&z.has(x.bone),L=new Map;for(let{p:x,faces:P}of c)if(x.shape!=="cylinder"&&x.mat!=="glass"&&P.every(({cell:F})=>y(F))){let F=L.get(x.bone)??[];F.push(x),L.set(x.bone,F);}let I=new Map,_=x=>{if(!x.mat)return R.get(x.bone);let P=x.mat+"|"+x.bone,F=I.get(P);return F||I.set(P,F={bone:x.bone,mat:x.mat,pos:[],nrm:[],uv:[],idx:[]}),F},T=0;for(let{p:x,faces:P}of c){let F=_(x),B=r.find(ee=>ee.name===x.bone).pivot,oe=[x.size[0]/2,x.size[1]/2,x.size[2]/2];if(T=Math.max(T,x.pos[1]+oe[1]),x.shape==="cylinder"){for(let{f:ee,cell:se}of P)Sn(F,x,oe,Ga[ee],B,M(se,.5));continue}let xe=C(x),Le=xe?z.get(x.bone):void 0,Re=(L.get(x.bone)??[]).filter(ee=>ee!==x&&C(ee)===xe),fe=Math.min(x.size[0],x.size[1],x.size[2])<Wa?0:s,Ae=Math.min(x.size[0],x.size[1],x.size[2])>=wn?gn:yn,Te=(ee,se)=>{let Y=Ga[ee],st=(Pe,Ye)=>{let Rt=[oe[0]*(Y.tl[0]+2*(Y.u[0]*Pe+Y.d[0]*Ye)),oe[1]*(Y.tl[1]+2*(Y.u[1]*Pe+Y.d[1]*Ye)),oe[2]*(Y.tl[2]+2*(Y.u[2]*Pe+Y.d[2]*Ye))],$e=Tt(Rt,x.rot);return [x.pos[0]+$e[0]-B[0],x.pos[1]+$e[1]-B[1],x.pos[2]+$e[2]-B[2]]},Bt=Tt(Y.n,x.rot),ze=F.pos.length/3,[mr,pr,dr,Ue]=M(se),[qe,Vt]=x.flip?[dr,mr]:[mr,dr];if(fe>0||xe){let[Pe,Ye,Rt,$e]=M(se,.5);xn(F,x,oe,Y,B,fe,Ae,x.flip?[Rt,Ye,Pe,$e]:[Pe,Ye,Rt,$e],xe);return}let hr=[[0,0,qe,pr],[1,0,Vt,pr],[1,1,Vt,Ue],[0,1,qe,Ue]];for(let[Pe,Ye,Rt,$e]of hr)F.pos.push(...st(Pe,Ye)),F.nrm.push(...Bt),F.uv.push(Rt,$e);F.idx.push(ze,ze+2,ze+1,ze,ze+3,ze+2);};for(let{f:ee,cell:se}of P){let Y=[F.pos.length,F.nrm.length,F.uv.length,F.idx.length];Te(ee,se),Re.length&&Fn(F.pos,Y[0],B,Re,s)?(F.pos.length=Y[0],F.nrm.length=Y[1],F.uv.length=Y[2],F.idx.length=Y[3]):Le&&(zn(F,Y[0],B,Le,Ln(x,oe,Le)),Cn(F.pos,Y[0],B,Le)&&(F.pos.length=Y[0],F.nrm.length=Y[1],F.uv.length=Y[2],F.idx.length=Y[3]));}}let D=r.map(x=>{let P=R.get(x.name);return {name:x.name,role:x.role,parent:x.parent,pivot:x.pivot,positions:Float32Array.from(P.pos),normals:Float32Array.from(P.nrm),uvs:Float32Array.from(P.uv),indices:Uint16Array.from(P.idx)}}),W=[...I.values()].map(x=>({bone:x.bone,mat:x.mat,positions:Float32Array.from(x.pos),normals:Float32Array.from(x.nrm),uvs:Float32Array.from(x.uv),indices:Uint16Array.from(x.idx)})),Q=null;if(h&&p.length){let x=e.parts.filter(B=>B.bone===h.bone),P=x.find(B=>B.name===h.bone)??x.sort((B,oe)=>oe.size[0]*oe.size[1]*oe.size[2]-B.size[0]*B.size[1]*B.size[2])[0],F=r.find(B=>B.name===h.bone);if(P&&F&&P.shape==="cylinder"){let B={};for(let[oe,xe]of p)B[oe]=M(xe);Q=_n(h.bone,P,h.rect,F.pivot,B);}else if(P&&F){let[B,oe,xe,Le]=h.rect,Re=P.pos[0]+P.size[0]/2-B,fe=P.pos[1]+P.size[1]/2-oe,Ae=P.pos[2]-P.size[2]/2-.05,Te=F.pivot,ee=(Y,st)=>[Y-Te[0],st-Te[1],Ae-Te[2]],se={};for(let[Y,st]of p)se[Y]=M(st);Q={bone:h.bone,corners:Float32Array.from([...ee(Re,fe),...ee(Re-xe,fe),...ee(Re-xe,fe-Le),...ee(Re,fe-Le)]),uv:se};}}let Ee=t.sockets.filter(x=>a(x.bone)).map(x=>{let P=t.bones.find(F=>F.name===x.bone);return {name:x.name,bone:x.bone,at:[x.at[0]-P.pivot[0],x.at[1]-P.pivot[1],x.at[2]-P.pivot[2]]}}),ue=Math.max(1,T),me=ue>t.height.max?t.height.max/ue:ue<t.height.min?t.height.min/ue:1;return {hash:vt(e),rig:e.rig,bones:D,mats:W,atlas:{w:g,h:b$1,data:v},face:Q,sockets:Ee,height:ue,scale:e.scale*me,eye:t.eye*ue/Dn(e.rig)}}var Xa=3,bn=2.5,yn=1,Ya=0,gn=2,wn=4.1;function xn(e,t,r,a,o,n,s,l,i=false){let d=Math.min(r[0],r[1],r[2]),c=i?0:Math.min(d,n*Xa),h=Math.min(d,c*bn),p=[r[0]-c,r[1]-c,r[2]-c],m=[r[0]-h,r[1]-h,r[2]-h],g=L=>Math.abs(L[0])*t.size[0]+Math.abs(L[1])*t.size[1]+Math.abs(L[2])*t.size[2],b=L=>{let I=[];for(let T=0;T<=s;T++)I.push(Math.min(.5,c*T/s/L));if(!i)for(let T=1;T<=Ya;T++)I.push(Math.min(.5,(c+(h-c)*T/Ya)/L));if(i){let T=Math.max(1,Math.min(An,Math.ceil(L/Rn)));for(let D=1;D<T;D++)I.push(qr(D/T));}let _=[...I,...I.map(T=>1-T)].sort((T,D)=>T-D);return _.filter((T,D)=>D===0||T-_[D-1]>1e-6)},v=b(g(a.u)),E=b(g(a.d)),M=e.pos.length/3,[R,k,y,z]=l;for(let L of E)for(let I of v){let _=[0,0,0],T=[0,0,0],D=[0,0,0];for(let P=0;P<3;P++){let F=r[P]*(a.tl[P]+2*(a.u[P]*I+a.d[P]*L)),B=Math.max(-p[P],Math.min(p[P],F));T[P]=F-B,_[P]=B,D[P]=F-Math.max(-m[P],Math.min(m[P],F));}let W=Math.hypot(T[0],T[1],T[2]),Q=W>1e-9?[T[0]/W,T[1]/W,T[2]/W]:[a.n[0],a.n[1],a.n[2]],Ee=Math.hypot(D[0],D[1],D[2]),ue=Ee>1e-9?[D[0]/Ee,D[1]/Ee,D[2]/Ee]:Q,me=[_[0]+Q[0]*c,_[1]+Q[1]*c,_[2]+Q[2]*c],x=Tt(me,t.rot);e.pos.push(t.pos[0]+x[0]-o[0],t.pos[1]+x[1]-o[1],t.pos[2]+x[2]-o[2]),e.nrm.push(...Tt(ue,t.rot)),e.uv.push(R+(y-R)*I,k+(z-k)*L);}let C=v.length;for(let L=0;L+1<E.length;L++)for(let I=0;I+1<C;I++){let _=M+L*C+I;e.idx.push(_,_+C+1,_+1,_,_+C,_+C+1);}}var Wa=.45,Rn=1.5,An=5,kn=10,$a=.6,qr=e=>(1-$a)*e+$a*(.5+.5*Math.sin(Math.PI*(e-.5))),Yt=4,gr=1.12,Ja=.35;function Za(e,t,r){let a=e*e,o=t*t,n=r*r;return [e*Math.sqrt(Math.max(0,1-o/2-n/2+o*n/3)),t*Math.sqrt(Math.max(0,1-n/2-a/2+n*a/3)),r*Math.sqrt(Math.max(0,1-a/2-o/2+a*o/3))]}function Qa(e){let t=Yt,r=Math.pow(Math.pow(e[0]*e[0]+e[2]*e[2],t/2)+Math.pow(Math.abs(e[1]),t),1/t)||1;return [e[0]/r,e[1]/r,e[2]/r]}function Yr(e,t){let r=Yt,a=Math.pow(e[0]*e[0]+e[2]*e[2],(r-2)/2),o=[e[0]*a,Math.sign(e[1])*Math.pow(Math.abs(e[1]),r-1),e[2]*a],n=[o[0]/t[0],o[1]/t[1],o[2]/t[2]],s=Math.hypot(n[0],n[1],n[2])||1;return [n[0]/s,n[1]/s,n[2]/s]}function Sn(e,t,r,a,o,n){let s=kn,l=e.pos.length/3,[i,d,c,h]=n;for(let m=0;m<=s;m++)for(let g=0;g<=s;g++){let b=qr(g/s),v=qr(m/s),E=[0,0,0];for(let k=0;k<3;k++)E[k]=a.tl[k]+2*(a.u[k]*b+a.d[k]*v);let M=Qa(Za(E[0],E[1],E[2])),R=Tt([r[0]*M[0],r[1]*M[1],r[2]*M[2]],t.rot);e.pos.push(t.pos[0]+R[0]-o[0],t.pos[1]+R[1]-o[1],t.pos[2]+R[2]-o[2]),e.nrm.push(...Tt(Yr(M,r),t.rot)),e.uv.push(i+(c-i)*b,d+(h-d)*v);}let p=s+1;for(let m=0;m<s;m++)for(let g=0;g<s;g++){let b=l+m*p+g;e.idx.push(b,b+p+1,b+1,b,b+p,b+p+1);}}function vn(e,t){let r=[t.size[0]/2,t.size[1]/2,t.size[2]/2],a=[(e[0]-t.pos[0])/r[0],(e[1]-t.pos[1])/r[1],(e[2]-t.pos[2])/r[2]],o=Math.max(Math.abs(a[0]),Math.abs(a[1]),Math.abs(a[2]));if(o<1e-6)return {p:e,w:0,s:[0,1,0]};let n=Qa(Za(a[0]/o,a[1]/o,a[2]/o)),s=o<=gr?1:Math.max(0,1-(o-gr)/Ja),l=s*s*(3-2*s),i=[t.pos[0]+r[0]*n[0]*o,t.pos[1]+r[1]*n[1]*o,t.pos[2]+r[2]*n[2]*o];return {p:[e[0]+(i[0]-e[0])*l,e[1]+(i[1]-e[1])*l,e[2]+(i[2]-e[2])*l],w:l,s:n}}var En=1.25,Tn=.85;function Ln(e,t,r){if(e.rot)return false;let a=(e.pos[1]+t[1]-r.pos[1])/(r.size[1]/2),o=Math.max(t[0]/(r.size[0]/2),t[2]/(r.size[2]/2));return a>En&&o>=Tn}function Mn(e,t){let r=t.size[0]/2,a=t.size[2]/2,o=(e[0]-t.pos[0])/r,n=(e[2]-t.pos[2])/a,s=Math.max(Math.abs(o),Math.abs(n));if(s<1e-6)return {p:e,w:0,s:[0,1,0]};let l=o/s,i=n/s,d=l*Math.sqrt(Math.max(0,1-i*i/2)),c=i*Math.sqrt(Math.max(0,1-l*l/2)),h=s<=gr?1:Math.max(0,1-(s-gr)/Ja),p=h*h*(3-2*h),m=t.pos[0]+r*d*s,g=t.pos[2]+a*c*s;return {p:[e[0]+(m-e[0])*p,e[1],e[2]+(g-e[2])*p],w:p,s:[d,0,c]}}function Cn(e,t,r,a){let o=Yt;for(let n=t;n<e.length;n+=3){let s=(e[n]+r[0]-a.pos[0])/(a.size[0]/2),l=(e[n+1]+r[1]-a.pos[1])/(a.size[1]/2),i=(e[n+2]+r[2]-a.pos[2])/(a.size[2]/2);if(Math.pow(Math.pow(s*s+i*i,o/2)+Math.pow(Math.abs(l),o),1/o)>.97)return false}return true}function zn(e,t,r,a,o=false){let n=[a.size[0]/2,a.size[1]/2,a.size[2]/2];for(let s=t;s<e.pos.length;s+=3){let l=[e.pos[s]+r[0],e.pos[s+1]+r[1],e.pos[s+2]+r[2]],{p:i,w:d,s:c}=o?Mn(l,a):vn(l,a);if(e.pos[s]=i[0]-r[0],e.pos[s+1]=i[1]-r[1],e.pos[s+2]=i[2]-r[2],d<=0)continue;let h=[e.nrm[s],e.nrm[s+1],e.nrm[s+2]],p=[l[0]-a.pos[0],l[1]-a.pos[1],l[2]-a.pos[2]],m=Math.hypot(p[0],p[1],p[2])||1;if((h[0]*p[0]+h[1]*p[1]+h[2]*p[2])/m<.3||o&&Math.abs(h[1])>.7)continue;let g=Yr(c,n),b=[h[0]+(g[0]-h[0])*d,h[1]+(g[1]-h[1])*d,h[2]+(g[2]-h[2])*d],v=Math.hypot(b[0],b[1],b[2])||1;e.nrm[s]=b[0]/v,e.nrm[s+1]=b[1]/v,e.nrm[s+2]=b[2]/v;}}var Ur=.16,Pn=12,In=12;function _n(e,t,r,a,o){let n=[t.size[0]/2,t.size[1]/2,t.size[2]/2],[s,l,i,d]=r,c=t.pos[0]+n[0]-s,h=t.pos[1]+n[1]-l,p=Pn,m=In,g=new Float32Array((p+1)*(m+1)*3),b=new Float32Array((p+1)*(m+1)*3),v=new Float32Array((p+1)*(m+1)*2),E=0;for(let R=0;R<=m;R++)for(let k=0;k<=p;k++){let y=k/p,z=R/m,C=c-i*y,L=h-d*z,I=(C-t.pos[0])/n[0],_=(L-t.pos[1])/n[1],T=Math.pow(Math.max(0,1-Math.pow(Math.min(1,Math.abs(_)),Yt)),1/Yt),D=-Math.sqrt(Math.max(.02,T*T-I*I)),W=Yr([I,_,D],n);g[E*3]=C+W[0]*Ur-a[0],g[E*3+1]=L+W[1]*Ur-a[1],g[E*3+2]=t.pos[2]+n[2]*D+W[2]*Ur-a[2],b.set(W,E*3),v[E*2]=y,v[E*2+1]=z,E++;}let M=(R,k)=>[R-a[0],k-a[1],t.pos[2]-n[2]-a[2]];return {bone:e,corners:Float32Array.from([...M(c,h),...M(c-i,h),...M(c-i,h-d),...M(c,h-d)]),uv:o,grid:{cols:p,rows:m,positions:g,normals:b,t:v}}}function On(e,t){if(!t)return e;let[r,a,o]=e,[n,s,l]=[-t[0]*Et,-t[1]*Et,-t[2]*Et],i=Math.cos(n),d=Math.sin(n);return [a,o]=[a*i-o*d,a*d+o*i],i=Math.cos(s),d=Math.sin(s),[r,o]=[r*i+o*d,-r*d+o*i],i=Math.cos(l),d=Math.sin(l),[r,a]=[r*i-a*d,r*d+a*i],[r,a,o]}function Fn(e,t,r,a,o){for(let s of a){let l=[s.size[0]/2,s.size[1]/2,s.size[2]/2],i=Math.min(s.size[0],s.size[1],s.size[2])<Wa?0:o,d=i>0?Math.min(l[0],l[1],l[2],i*Xa):0,c=true;for(let h=t;h<e.length&&c;h+=3){let p=On([e[h]+r[0]-s.pos[0],e[h+1]+r[1]-s.pos[1],e[h+2]+r[2]-s.pos[2]],s.rot),m=Math.abs(p[0])-(l[0]-d),g=Math.abs(p[1])-(l[1]-d),b=Math.abs(p[2])-(l[2]-d);Math.hypot(Math.max(m,0),Math.max(g,0),Math.max(b,0))+Math.min(Math.max(m,g,b),0)-d>=-0.01&&(c=false);}if(c)return true}return false}function Dn(e){let t=1;for(let r of Ie[e].defaultParts)t=Math.max(t,r.pos[1]+r.size[1]/2);return t}var $r=new Map;function Nn(e){let t=new Map;for(let i of e.bones){if(!i.indices.length){t.set(i.name,null);continue}let d=new V.BufferGeometry;d.setAttribute("position",new V.BufferAttribute(i.positions,3)),d.setAttribute("normal",new V.BufferAttribute(i.normals,3)),d.setAttribute("uv",new V.BufferAttribute(i.uvs,2)),d.setIndex(new V.BufferAttribute(i.indices,1)),d.computeBoundingSphere(),d.userData.shared=true,t.set(i.name,d);}let r=eo(e.bones,e),a=new Map;for(let i of new Set(e.mats.map(d=>d.mat))){let d=e.mats.filter(h=>h.mat===i).map(h=>({...h,pivot:e.bones.find(p=>p.name===h.bone).pivot})),c=eo(d,e);c&&a.set(i,c);}let{w:o,h:n,data:s}=e.atlas,l=new V.DataTexture(s,o,n,V.RGBAFormat);return l.magFilter=V.NearestFilter,l.minFilter=V.NearestFilter,l.generateMipmaps=false,l.colorSpace=V.SRGBColorSpace,l.needsUpdate=true,{layout:e,geometries:t,skinned:r,skinnedMats:a,texture:l,refs:0}}function eo(e,t){let r=g=>t.bones.findIndex(b=>b.name===(g.bone??g.name)),a=0,o=0;for(let g of e)a+=g.positions.length/3,o+=g.indices.length;if(!o)return null;let n=new Float32Array(a*3),s=new Float32Array(a*3),l=new Float32Array(a*2),i=new Uint16Array(a*4),d=new Float32Array(a*4),c=a>65535?new Uint32Array(o):new Uint16Array(o),h=0,p=0;e.forEach(g=>{let b=r(g),v=g.positions.length/3;for(let E=0;E<v;E++)n[(h+E)*3]=g.positions[E*3]+g.pivot[0],n[(h+E)*3+1]=g.positions[E*3+1]+g.pivot[1],n[(h+E)*3+2]=g.positions[E*3+2]+g.pivot[2],i[(h+E)*4]=b,d[(h+E)*4]=1;s.set(g.normals,h*3),l.set(g.uvs,h*2);for(let E=0;E<g.indices.length;E++)c[p+E]=g.indices[E]+h;h+=v,p+=g.indices.length;});let m=new V.BufferGeometry;return m.setAttribute("position",new V.BufferAttribute(n,3)),m.setAttribute("normal",new V.BufferAttribute(s,3)),m.setAttribute("uv",new V.BufferAttribute(l,2)),m.setAttribute("skinIndex",new V.Uint16BufferAttribute(i,4)),m.setAttribute("skinWeight",new V.BufferAttribute(d,4)),m.setIndex(new V.BufferAttribute(c,1)),m.computeBoundingSphere(),m.userData.shared=true,m}function Kr(e){let t=$r.get(vt(e));return t||(t=Nn(Ka(e)),$r.set(t.layout.hash,t)),t.refs++,t}function wr(e){if(!(--e.refs>0)){$r.delete(e.layout.hash);for(let t of e.geometries.values())t?.dispose();e.skinned?.dispose();for(let t of e.skinnedMats.values())t.dispose();e.texture.dispose();}}var G=class e{constructor(t,r,a="."){this.w=t;this.h=r;this.g=Array.from({length:r},()=>new Array(t).fill(a));}w;h;g;px(t,r,a){return t>=0&&r>=0&&t<this.w&&r<this.h&&(this.g[r][t]=a),this}rect(t,r,a,o,n){for(let s=r;s<r+o;s++)for(let l=t;l<t+a;l++)this.px(l,s,n);return this}row(t,r,a,o){return this.rect(r,t,a-r+1,1,o)}col(t,r,a,o){return this.rect(t,r,1,a-r+1,o)}where(t,r){for(let a=0;a<this.h;a++)for(let o=0;o<this.w;o++)t(o,a)&&this.px(o,a,r);return this}flipped(){let t=new e(this.w,this.h);for(let r=0;r<this.h;r++)for(let a=0;a<this.w;a++)t.px(this.w-1-a,r,this.g[r][a]);return t}tex(){return {w:this.w,h:this.h,rows:this.g.map(t=>t.join(""))}}};var Bn={s:"#d9a982",S:"#bf8d68",h:"#6b4a2f",H:"#8a6644",k:"#3a2818",w:"#f4f4ef",b:"#3f8f9c",m:"#9a5544",o:"#4a2219",t:"#a7bea9",T:"#c4d6c4",D:"#84a08a",u:"#ece6d2",B:"#6a4e33",g:"#d8c48c",p:"#8c9ca6",P:"#6f808a",z:"#a07a55",Z:"#7c5c3f",l:"#e9e3cf"};function Ge(e,t){let r=parseInt(e.slice(1),16);return "#"+[r>>16&255,r>>8&255,r&255].map(o=>Math.max(0,Math.min(255,Math.round(o*t)))).map(o=>o.toString(16).padStart(2,"0")).join("")}function Wr(e,t){let r={...e};return t.skin&&(r.s=t.skin,r.S=Ge(t.skin,.86),r.m=Ge(t.skin,.66)),t.hair&&(r.h=t.hair,r.H=Ge(t.hair,1.25),r.k=Ge(t.hair,.6)),t.shirt&&(r.t=t.shirt,r.T=Ge(t.shirt,1.15),r.D=Ge(t.shirt,.8)),t.pants&&(r.p=t.pants,r.P=Ge(t.pants,.8)),t.boots&&(r.z=t.boots,r.Z=Ge(t.boots,.78)),t.eyes&&(r.b=t.eyes),r}var Vn=new G(16,16,"s").rect(0,0,16,3,"h").row(3,0,4,"h").row(3,10,15,"h").row(4,0,1,"h").row(4,13,15,"h").col(0,5,8,"h").col(15,5,8,"h").row(1,3,6,"H").row(1,9,12,"H").row(15,2,13,"S"),to=new G(16,16,"s").rect(0,0,16,4,"h").rect(7,4,9,7,"h").rect(10,11,6,2,"h").rect(5,7,2,3,"S").row(1,2,13,"H").where((e,t)=>t>4&&t<11&&e>8&&(e+t)%4===0,"k"),Hn=to.flipped(),jn=new G(16,16,"h").where((e,t)=>(e+2*t)%5===0,"H").where((e,t)=>t>8&&(e*3+t)%7===0,"k").rect(4,14,8,2,"s"),Gn=new G(16,16,"h").where((e,t)=>(e+2*t)%5===0,"H").where((e,t)=>(3*e+t)%9===0,"k"),Un=new G(18,4,"h").where((e,t)=>(e*7+t*3)%5===0,"H").where((e,t)=>t===3&&e*5%3===0,"k"),qn=new G(16,24,"t").row(0,6,9,"s").row(1,7,8,"s").row(0,3,5,"T").row(0,10,12,"T").row(1,4,6,"T").row(1,9,11,"T").row(2,5,6,"T").row(2,9,10,"T").col(8,2,19,"D").px(7,5,"u").px(7,9,"u").px(7,13,"u").px(7,17,"u").row(6,2,5,"D").col(2,7,10,"D").col(5,7,10,"D").row(10,2,5,"D").px(4,7,"u").row(6,10,13,"D").col(10,7,10,"D").col(13,7,10,"D").row(10,10,13,"D").px(11,7,"u").row(19,0,15,"D").rect(0,20,16,2,"B").rect(7,20,2,2,"g").rect(0,22,16,2,"p"),Yn=new G(16,24,"t").row(5,0,15,"D").col(8,6,19,"D").row(19,0,15,"D").rect(0,20,16,2,"B").rect(0,22,16,2,"p"),$n=new G(8,24,"t").col(4,0,19,"D").row(19,0,7,"D").rect(0,20,8,2,"B").rect(0,22,8,2,"p"),Kn=new G(16,2,"B").rect(7,0,2,2,"g").px(3,0,"k").px(12,0,"k"),Xn=new G(6,24,"s").row(23,0,5,"S").col(2,21,23,"S"),Wn=new G(8,13,"t").col(0,0,9,"D").row(9,0,7,"D").rect(0,10,8,3,"T").row(12,0,7,"D"),Jn=new G(8,24,"p").col(4,1,21,"P").row(0,0,7,"P"),Zn=new G(8,24,"p").col(3,0,21,"P").row(0,0,7,"P"),Qn=new G(8,24,"p").col(3,0,21,"P"),es=new G(10,9,"z").row(0,0,9,"Z").row(2,3,6,"l").row(4,3,6,"l").row(6,3,6,"l").col(2,1,6,"Z").col(7,1,6,"Z").rect(0,7,10,2,"Z"),ts=new G(10,9,"z").row(0,0,9,"Z").rect(0,7,10,2,"Z").col(5,1,6,"Z");function De(e){let t=new G(16,10,"."),r=(o,n,s)=>{if(e.brows==="flat")t.row(1,o,o+2,"k");else if(e.brows==="high")t.row(0,o,o+2,"k");else {let l=e.brows==="down"?1:0,i=1-l;t.px(n,l,"k").px(o+1,e.brows==="down"?0:1,"k"),t.px(s,i,"k");}};r(3,5,3),r(10,10,12);let a=o=>{if(e.eyes===0){t.row(3,o,o+2,"k");return}let n=e.eyes===3||e.eyes===2?2:3;for(let s=n;s<n+e.eyes;s++)t.px(o,s,"w").px(o+1,s,"b").px(o+2,s,"w");};switch(a(3),a(10),e.mouth){case "line":t.row(7,6,9,"m");break;case "smile":t.px(5,6,"m").px(10,6,"m").row(7,6,9,"m");break;case "frown":t.row(7,6,9,"m").px(5,8,"m").px(10,8,"m");break;case "open":t.rect(6,7,4,2,"o");break;case "small":t.rect(7,7,2,2,"o");break;case "wide":t.row(7,5,10,"m").rect(6,8,4,1,"o");break}return t}var ro={f_neutral:De({brows:"flat",eyes:2,mouth:"line"}),f_blink:De({brows:"flat",eyes:0,mouth:"line"}),f_happy:De({brows:"high",eyes:2,mouth:"smile"}),f_sad:De({brows:"up",eyes:2,mouth:"frown"}),f_angry:De({brows:"down",eyes:1,mouth:"wide"}),f_surprised:De({brows:"high",eyes:3,mouth:"small"}),f_scared:De({brows:"up",eyes:3,mouth:"open"}),f_tired:De({brows:"flat",eyes:1,mouth:"line"}),f_hurt:De({brows:"down",eyes:0,mouth:"open"}),f_talk:De({brows:"flat",eyes:2,mouth:"open"})},rs=new G(16,24,"t").row(0,5,10,"s").row(1,6,9,"s").px(5,1,"T").px(10,1,"T").row(7,0,15,"D").row(10,0,15,"D").rect(0,18,16,2,"T").rect(0,20,16,4,"p").row(20,0,15,"P"),as=new G(16,24,"t").row(0,5,10,"T").row(7,0,15,"D").row(10,0,15,"D").rect(0,18,16,2,"T").rect(0,20,16,4,"p").row(20,0,15,"P"),os=new G(8,24,"t").row(7,0,7,"D").row(10,0,7,"D").rect(0,18,8,2,"T").rect(0,20,8,4,"p").row(20,0,7,"P"),ns=new G(8,9,"t").row(3,0,7,"D").rect(0,7,8,2,"T"),xr=(e,t)=>e.row(t-1,0,e.w-1,"D").where((r,a)=>a>=t&&a<=t+3&&(r+a)%2===0,"T").row(t+4,0,e.w-1,"D"),ss=xr(new G(16,24,"t"),6).row(0,6,9,"s").row(0,4,5,"T").row(0,10,11,"T").row(1,4,11,"T").where((e,t)=>t>=18&&t<=19&&e%2===0,"D").where((e,t)=>t>=18&&t<=19&&e%2===1,"T").rect(0,20,16,4,"p"),is=xr(new G(16,24,"t"),6).row(0,4,11,"T").where((e,t)=>t>=18&&t<=19,"D").rect(0,20,16,4,"p"),ls=xr(new G(8,24,"t"),6).where((e,t)=>t>=18&&t<=19,"D").rect(0,20,8,4,"p"),cs=xr(new G(8,22,"t"),9).where((e,t)=>t>=19&&e%2===0,"D"),ao=e=>new G(8,24,"s").rect(0,0,8,12,"p").col(e,1,10,"P").row(11,0,7,"P").row(12,0,7,"S").rect(0,19,8,5,"l"),ms=ao(4),ps=ao(3),ds=new G(9,5,"z").row(1,3,5,"l").rect(0,3,9,2,"l"),hs=new G(10,5,"z").row(1,3,6,"Z").rect(0,3,10,2,"l"),us=new G(17,6,"a").rect(0,4,17,2,"A"),fs=new G(22,22,"a").where((e,t)=>(e*3+t*5)%11===0,"A"),bs=new G(17,20,"h").where((e,t)=>(e*5+t)%4===0,"H").where((e,t)=>t>10&&(e*3+t*2)%7===0,"k"),K=e=>e.tex(),oo=["shirt","tee","sweater"],no=["pants","shorts"],so=["boots","sneakers"],ul=["short","long","curly","none"],ct=(e,t={})=>({front:e,back:e,left:e,right:e,...t});function Jr(e={}){let t=e.top??"shirt",r=e.bottom??"pants",a=e.shoes??"boots",o=e.hair??"short",n=Wr(Bn,e.colors??{});n={...n,a:e.colors?.hat??"#d9c9a3"},n.A=Ge(n.a,.72);let s={head_front:K(Vn),head_left:K(to),head_right:K(Hn),head_back:K(jn),hair_top:K(Gn),hair_band:K(Un),arm_skin:K(Xn),...Object.fromEntries(Object.entries(ro).map(([g,b])=>[g,K(b)]))},l=[{name:"head",bone:"head",size:[8,8,8],pos:[0,28,0],color:"s",faces:{front:"head_front",left:"head_left",right:"head_right",back:"head_back",top:"hair_top"}},{name:"nose",bone:"head",size:[1,1.5,.8],pos:[0,26.9,-4.4],color:"S",faces:{front:"s"}}];if(o!=="none"){if(e.hat||l.push({name:"hair",bone:"head",size:o==="curly"?[9,2.2,9]:[8.6,1.6,8.6],pos:[0,o==="curly"?32.5:32.2,.15],color:"h",faces:ct("hair_band",{top:"hair_top"})}),o==="curly"&&!e.hat)for(let[g,b]of [[-2,-1.5],[2,.5],[-0.5,2.5]])l.push({name:"curl",bone:"head",size:[3.2,1.4,3.2],pos:[g,33.9,b],color:"h",faces:ct("hair_band",{top:"hair_top"})});o==="long"?(s.hair_long=K(bs),l.push({name:"hairLong",bone:"head",size:[8.8,10,1],pos:[0,27,4.4],color:"h",faces:ct("hair_long",{top:"hair_top"})},{name:"hairSide",bone:"head",size:[.8,9,6],pos:[-4.4,27.5,1],color:"h",faces:ct("hair_long",{top:"hair_top"}),mirror:true})):l.push({name:"hairBack",bone:"head",size:[8.6,5,.8],pos:[0,29.6,4.25],color:"h",faces:{back:"head_back",left:"hair_band",right:"hair_band"}});}e.hat&&(s.hat_crown=K(us),s.hat_brim=K(fs),l.push({name:"hatBrim",bone:"head",size:[11,.8,11],pos:[0,32.4,0],color:"a",faces:{top:"hat_brim",bottom:"hat_brim"}},{name:"hatCrown",bone:"head",size:[8.4,3,8.4],pos:[0,34.3,0],color:"a",faces:ct("hat_crown")}));let i={shirt:[qn,Yn,$n],tee:[rs,as,os],sweater:[ss,is,ls]},[d,c$1,h]=i[t];s.top_front=K(d),s.top_back=K(c$1),s.top_side=K(h),l.push({name:"torso",bone:"body",size:[8,12,4],pos:[0,18,0],color:"t",faces:{front:"top_front",back:"top_back",left:"top_side",right:"top_side",bottom:"p"}}),t==="shirt"&&(s.belt=K(Kn),l.push({name:"belt",bone:"body",size:[8.4,1,4.4],pos:[0,13.5,0],color:"B",faces:{front:"belt",back:"belt"}})),l.push({name:"arm",bone:"armL",size:[3,12,3],pos:[-5.5,18,0],color:"s",faces:ct("arm_skin",{top:"t",bottom:"S"}),mirror:true});let p=t==="sweater"?11:t==="tee"?4.5:6.5;s.sleeve=K(t==="sweater"?cs:t==="tee"?ns:Wn),l.push({name:"sleeve",bone:"armL",size:[3.6,p,3.6],pos:[-5.5,24-p/2,0],color:"t",faces:ct("sleeve",{bottom:"D"}),mirror:true}),r==="shorts"?(s.leg_front=K(ms),s.leg_side=K(ps)):(s.leg_front=K(Jn),s.leg_back=K(Zn),s.leg_side=K(Qn)),l.push({name:"leg",bone:"legL",size:[4,12,4],pos:[-2,6,0],color:"p",faces:{front:"leg_front",back:r==="shorts"?"leg_front":"leg_back",left:"leg_side",right:"leg_side"},mirror:true}),a==="boots"?(s.shoe_front=K(es),s.shoe_side=K(ts)):(s.shoe_front=K(ds),s.shoe_side=K(hs));let m=a==="boots"?4.5:2.5;return l.push({name:"shoe",bone:"legL",size:[4.6,m,5.2],pos:[-2,m/2,-0.3],color:"z",faces:{front:"shoe_front",back:"shoe_side",left:"shoe_side",right:"shoe_side",bottom:"Z"},mirror:true}),{version:1,name:e.name??c({en:"Traveler",ru:"\u041F\u0443\u0442\u043D\u0438\u043A"}),description:e.description??c({en:"A traveler in a shirt with pockets, trousers and laced boots",ru:"\u041F\u0443\u0442\u043D\u0438\u043A \u0432 \u0440\u0443\u0431\u0430\u0448\u043A\u0435 \u0441 \u043A\u0430\u0440\u043C\u0430\u043D\u0430\u043C\u0438, \u0431\u0440\u044E\u043A\u0430\u0445 \u0438 \u0448\u043D\u0443\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0445 \u0431\u043E\u0442\u0438\u043D\u043A\u0430\u0445"}),rig:"humanoid",palette:n,textures:s,parts:l,face:{bone:"head",rect:[0,3,8,5],expressions:{neutral:"f_neutral",blink:"f_blink",happy:"f_happy",sad:"f_sad",angry:"f_angry",surprised:"f_surprised",scared:"f_scared",tired:"f_tired",hurt:"f_hurt",talk:"f_talk"}},style:{walk:"normal",idle:"calm",energy:.5},finish:{noise:.5,outline:.4,shade:.25,density:2},tags:e.tags??["player"]}}function $t(e,t){return {textures:Object.fromEntries(Object.entries(ro).map(([r,a])=>[r,K(a)])),face:{bone:e,rect:t,expressions:{neutral:"f_neutral",blink:"f_blink",happy:"f_happy",sad:"f_sad",angry:"f_angry",surprised:"f_surprised",scared:"f_scared",tired:"f_tired",hurt:"f_hurt",talk:"f_talk"}}}}var Zr=Jr(),Xr=null;function mt(){if(!Xr){let e=Oe(Zr);if(!e.ok)throw new Error(e.error);Xr=e.spec;}return Xr}function io(e){let t=document.createElement("canvas");t.width=256,t.height=48;let r=t.getContext("2d");r&&(r.fillStyle="rgba(0,0,0,0.45)",r.fillRect(0,0,256,48),r.font="bold 28px sans-serif",r.fillStyle="#fff",r.textAlign="center",r.textBaseline="middle",r.fillText(e.slice(0,18),128,25));let a=new V.CanvasTexture(t),o=new V.Sprite(new V.SpriteMaterial({map:a,depthTest:false,transparent:true}));return o.scale.set(1.6,.3,1),o.renderOrder=10,o}function Qr(e){e.removeFromParent(),e.material.map?.dispose(),e.material.dispose();}var te={rx:0,ry:1,rz:2,px:3,py:4,pz:5,sx:6,sy:7,sz:8},yl=Object.keys(te),Mt=[0,0,0,0,0,0,1,1,1];function Ct(e,t){let r=e.get(t);return r||(r=Float64Array.from(Mt),e.set(t,r)),r}function pe(e,t,r,a){let o=Ct(e,t),n=te[r];n>=6?o[n]=o[n]*a:o[n]=o[n]+a;}function f(e,t,r,a){Ct(e,t)[te[r]]=a;}function pt(e){for(let t of e.values())t.set(Mt);}function lo(e,t,r,a){let o=new Set([...t.keys(),...r.keys()]);for(let n of o){let s=t.get(n)??Mt,l=r.get(n)??Mt,i=Ct(e,n);for(let d=0;d<9;d++)i[d]=s[d]+(l[d]-s[d])*a;}}function Rr(e,t){pt(e);for(let[r,a]of t)Ct(e,r).set(a);}var gl=["none","block","tool","sword","bow","shield","food","staff","item"];function Ar(){return {speed:0,vy:0,onGround:true,inWater:false,flying:false,gliding:false,sneaking:false,sprinting:false,riding:false,sitting:false,sleeping:false,dead:false,lookYaw:0,lookPitch:0,yawRate:0,held:"none",use:null,talk:false}}var wl=["swing","hurt","place","land","jump","throw"];var Kt=1/16,gs=.68,co=.85,ws=1.2,xs=1.03,Rs=1.1,As=.12,ks=.1,Ss=.1;function kr(e){let t=r=>r.toFixed(4);e.fragmentShader=e.fragmentShader.replace("#include <tonemapping_fragment>",`{
2
+ vec3 c = gl_FragColor.rgb;
3
+ float l = dot(c, vec3(0.2126, 0.7152, 0.0722));
4
+ c = mix(vec3(l), c, ${t(ws)});
5
+ #ifdef TONE_MAPPING
6
+ c = (c - 0.5) * ${t(xs)} + 0.5;
7
+ #else
8
+ c = (c - 0.5) * ${t(Rs)} + 0.5;
9
+ #endif
10
+ gl_FragColor.rgb = clamp(c, 0.0, 1.0);
11
+ }
12
+ #include <tonemapping_fragment>
13
+ #ifdef TONE_MAPPING
14
+ {
15
+ vec3 c = gl_FragColor.rgb;
16
+ float avg = (c.r + c.g + c.b) / 3.0;
17
+ c += (avg - c) * (1.0 - 1.0 / (1.001 - ${t(As)}));
18
+ c = min(c, 1.0);
19
+ c = clamp((c - 0.5) / (1.0 - ${t(ks)}) + 0.5, 0.0, 1.0);
20
+ float lu = dot(c, vec3(0.2126, 0.7152, 0.0722));
21
+ c += ${t(Ss)} * lu * lu;
22
+ gl_FragColor.rgb = clamp(c, 0.0, 1.0);
23
+ }
24
+ #endif`);}function ea(e,t,r){if(!e)return new V.MeshLambertMaterial(r);let a=new V.MeshStandardMaterial({...r,roughness:t,metalness:0});return a.onBeforeCompile=kr,a}function vs(e,t){if(e==="glass"){if(!t)return new V.MeshLambertMaterial({transparent:true,opacity:.5,depthWrite:false});let a=new V.MeshStandardMaterial({transparent:true,opacity:.42,depthWrite:false,roughness:.08,metalness:.2});return a.onBeforeCompile=kr,a}if(e==="glow"){let a={emissive:16777215,emissiveIntensity:.85};return t?new V.MeshStandardMaterial({...a,roughness:.6}):new V.MeshLambertMaterial(a)}if(!t)return new V.MeshLambertMaterial({alphaTest:.5});let r=new V.MeshStandardMaterial({alphaTest:.5,roughness:.28,metalness:.85});return r.onBeforeCompile=kr,r}var mo=5921370;function po(e){let t=(r,a)=>r.replace(`#include <${a}>`,V.ShaderChunk[a].replace("varying vec2 vMapUv","centroid varying vec2 vMapUv"));e.vertexShader=t(e.vertexShader,"uv_pars_vertex"),e.fragmentShader=t(e.fragmentShader,"uv_pars_fragment");}function Es(e){po(e),kr(e);}var Sr=class{group=new V.Group;root=new V.Group;asset;spec;bones=new Map;byRole=new Map;meshes=[];material;decalMat;gloss;decal=null;expression=null;sockets=new Map;attached=new Map;label=null;shadows;layer;brightness=1;painter;prints=[];printMeshes=[];printMats=new Map;partMats=new Map;emotion;constructor(t=mt(),r={}){this.spec=t,this.shadows=r.shadows??true,this.layer=r.layer??0,this.painter=r.facePainter??null,this.gloss=r.gloss??false,this.material=ea(this.gloss,gs,{alphaTest:.5}),this.material.onBeforeCompile=this.gloss?Es:po,this.decalMat=ea(this.gloss,co,{alphaTest:.5,polygonOffset:true,polygonOffsetFactor:-2,polygonOffsetUnits:-2}),this.group.add(this.root),this.asset=Kr(t),this.build(),r.name&&this.setName(r.name);}get height(){let t=this.asset.layout;return t.height*t.scale*Kt}get eye(){let t=this.asset.layout;return t.eye*t.scale*Kt}get expressions(){return Object.keys(this.asset.layout.face?.uv??{})}get hash(){return this.asset.layout.hash}setSpec(t){let r=Kr(t);if(r===this.asset){wr(r);return}this.clear(),wr(this.asset),this.asset=r,this.spec=t,this.build();}build(){let{layout:t,skinned:r,texture:a}=this.asset;this.material.map=a,this.material.needsUpdate=true,this.useFaceMap(),this.root.scale.setScalar(t.scale*Kt);let o=new Map(t.bones.map(c=>[c.name,c.pivot])),n=[],s=[];for(let c of t.bones){let h=new V.Bone;n.push(h),s.push(new V.Matrix4().makeTranslation(-c.pivot[0],-c.pivot[1],-c.pivot[2]));let p=c.parent?o.get(c.parent)??[0,0,0]:[0,0,0],m=[c.pivot[0]-p[0],c.pivot[1]-p[1],c.pivot[2]-p[2]];h.position.set(...m);let g={name:c.name,role:c.role,group:h,rest:m};this.bones.set(c.name,g);let b=this.byRole.get(c.role)??[];b.push(g),this.byRole.set(c.role,b);}for(let c of t.bones){let h=this.bones.get(c.name);((c.parent?this.bones.get(c.parent):void 0)?.group??this.root).add(h.group);}let l=new V.Skeleton(n,s),i=(c,h,p)=>{let m=new V.SkinnedMesh(c,h);m.bind(l,new V.Matrix4);let g=(r??c).boundingSphere;g&&(m.boundingSphere=new V.Sphere(g.center.clone(),g.radius*1.6)),m.castShadow=p&&this.shadows,m.receiveShadow=this.shadows,m.layers.set(this.layer),this.meshes.push(m),this.root.add(m);};r&&i(r,this.material,true);for(let[c,h]of this.asset.skinnedMats){let p=this.partMats.get(c);p||this.partMats.set(c,p=vs(c,this.gloss)),p.map=this.asset.texture,c==="glow"&&(p.emissiveMap=this.asset.texture),p.needsUpdate=true,i(h,p,c!=="glass");}let d=t.face;if(d){let c=new V.BufferGeometry,h=d.grid;if(h){c.setAttribute("position",new V.BufferAttribute(h.positions,3)),c.setAttribute("normal",new V.BufferAttribute(h.normals,3)),c.setAttribute("uv",new V.BufferAttribute(new Float32Array(h.t.length),2));let p=[],m=h.cols+1;for(let g=0;g<h.rows;g++)for(let b=0;b<h.cols;b++){let v=g*m+b;p.push(v,v+m+1,v+1,v,v+m,v+m+1);}c.setIndex(p);}else {c.setAttribute("position",new V.BufferAttribute(d.corners,3));let p=new Float32Array(12);for(let m=0;m<4;m++)p[m*3+2]=-1;c.setAttribute("normal",new V.BufferAttribute(p,3)),c.setAttribute("uv",new V.BufferAttribute(new Float32Array(8),2)),c.setIndex([0,2,1,0,3,2]);}this.decal=new V.Mesh(c,this.decalMat),this.decal.layers.set(this.layer),this.bones.get(d.bone)?.group.add(this.decal),this.expression=null,this.setExpression("neutral");}for(let c of t.sockets){let h=new V.Object3D;h.position.set(...c.at),h.scale.setScalar(1/(t.scale*Kt)),this.bones.get(c.bone)?.group.add(h),this.sockets.set(c.name,h);let p=this.attached.get(c.name);p&&h.add(p);}this.buildPrints(),this.placeLabel(),this.setBrightness(this.brightness);}setPrints(t){this.prints=t??[],this.buildPrints(),this.setBrightness(this.brightness);}buildPrints(){for(let a of this.printMeshes)a.removeFromParent(),a.geometry.dispose();this.printMeshes=[];let t=new Set,r=new Map;for(let a of this.prints){let o=this.bones.get(a.bone),n=this.asset.layout.bones.find(c=>c.name===a.bone);if(!o||!n)continue;let s=this.printMats.get(a.texture);s||(s=ea(this.gloss,co,{map:a.texture,emissiveMap:a.texture,emissive:mo,transparent:true,alphaTest:.02,polygonOffset:true,polygonOffsetFactor:-2,polygonOffsetUnits:-2}),this.printMats.set(a.texture,s)),t.add(a.texture);let l=new V.PlaneGeometry(a.w,a.h);a.facing==="front"&&l.rotateY(Math.PI),l.translate(a.center[0]-n.pivot[0],a.center[1]-n.pivot[1],a.center[2]-n.pivot[2]);let i=`${a.bone}|${a.texture.uuid}`,d=r.get(i)??{node:o,mat:s,geos:[]};d.geos.push(l),r.set(i,d);}for(let{node:a,mat:o,geos:n}of r.values()){let s=n.length===1?n[0]:mergeGeometries(n)??n[0];if(s!==n[0])for(let i of n)i.dispose();let l=new V.Mesh(s,o);l.layers.set(this.layer),a.group.add(l),this.printMeshes.push(l);}for(let[a,o]of this.printMats)t.has(a)||(o.dispose(),this.printMats.delete(a));}clear(){for(let t of this.sockets.values())for(let r of [...t.children])t.remove(r);this.root.clear();for(let t of this.printMeshes)t.geometry.dispose();this.printMeshes=[],this.decal?.geometry.dispose(),this.decal=null;for(let t of this.meshes)t instanceof V.SkinnedMesh&&t.skeleton.dispose();this.meshes=[],this.bones=new Map,this.byRole=new Map,this.sockets.clear();}applyPose(t){let r=t.get("root");if(r){this.root.rotation.set(r[te.rx],r[te.ry],r[te.rz]);let a=this.asset.layout.scale*Kt;this.root.position.set(r[te.px]*a,r[te.py]*a,r[te.pz]*a);}else this.root.rotation.set(0,0,0),this.root.position.set(0,0,0);for(let[a,o]of this.byRole){let n=t.get(a);for(let s of o){let l=s.group;if(!n){l.rotation.set(0,0,0),l.position.set(...s.rest),l.scale.set(1,1,1);continue}l.rotation.set(n[te.rx],n[te.ry],n[te.rz]),l.position.set(s.rest[0]+n[te.px],s.rest[1]+n[te.py],s.rest[2]+n[te.pz]),l.scale.set(n[te.sx],n[te.sy],n[te.sz]);}}}setFacePainter(t){if(t===this.painter)return;this.painter=t,this.useFaceMap();let r=this.expression??"neutral";this.expression=null,this.setExpression(r);}useFaceMap(){let t=this.painter;this.decalMat.map=t?t.texture:this.asset.texture,this.decalMat.transparent=!!t,this.decalMat.alphaTest=t?.02:.5,this.decalMat.needsUpdate=true;}setExpression(t,r){if(t===this.expression&&(!this.painter||r===this.emotion)||!this.decal)return;let a=this.asset.layout.face?.uv,o=this.painter?[0,1,1,0]:a?.[t]??a?.neutral;if(!o)return;this.expression=t,this.emotion=r,this.painter?.paint(t,r);let[n,s,l,i]=o,d=this.decal.geometry.getAttribute("uv"),c=this.asset.layout.face?.grid;if(c)for(let h=0;h<d.count;h++)d.setXY(h,n+(l-n)*c.t[h*2],s+(i-s)*c.t[h*2+1]);else d.setXY(0,n,s),d.setXY(1,l,s),d.setXY(2,l,i),d.setXY(3,n,i);d.needsUpdate=true;}materials(){return [this.material,this.decalMat,...this.partMats.values()]}setBrightness(t){this.brightness=t,this.material.color.setScalar(t),this.decalMat.color.setScalar(t);for(let r of this.printMats.values())r.color.setScalar(t);for(let r of this.partMats.values())r.color.setScalar(t);}setEmissive(t){if(this.material.emissive.getHex()!==t){this.material.emissive.setHex(t),this.decalMat.emissive.setHex(t);for(let r of this.printMats.values())r.emissive.setHex(t||mo);for(let[r,a]of this.partMats)r!=="glow"&&a.emissive.setHex(t);}}setShadows(t){if(t!==this.shadows){this.shadows=t;for(let r of this.meshes)r.castShadow=t&&!r.material.transparent;}}attach(t,r){let a=this.attached.get(t);if(a!==r){if(a&&a.removeFromParent(),!r){this.attached.delete(t);return}this.attached.set(t,r),this.sockets.get(t)?.add(r);}}attachedAt(t){return this.attached.get(t)??null}setName(t){this.label&&Qr(this.label),this.label=t?io(t):null,this.label&&this.group.add(this.label),this.placeLabel();}setLabelVisible(t){this.label&&(this.label.visible=t);}placeLabel(){this.label&&(this.label.position.y=this.height+.25);}forEachMesh(t){for(let r of this.meshes)t(r);this.decal&&t(this.decal);for(let r of this.printMeshes)t(r);}dispose(){this.group.removeFromParent();for(let t of this.attached.values())t.removeFromParent();this.attached.clear(),this.clear(),this.label&&Qr(this.label),this.label=null,this.material.dispose(),this.decalMat.dispose();for(let t of this.printMats.values())t.dispose();this.printMats.clear();for(let t of this.partMats.values())t.dispose();this.partMats.clear(),wr(this.asset);}};var vr=new Map,ta=new Set;function Ll(e){let t=vt(e);if(!vr.has(t)){vr.set(t,e);for(let r of ta)r(t);}return t}function Ml(e){return typeof e=="string"?vr.get(e):void 0}function Cl(e){let t={};for(let r of e){let a=vr.get(r);a&&(t[r]=a);}return t}function zl(e){return ta.add(e),()=>ta.delete(e)}var Ts=["#b08a62","#8a6a4a","#c8a878","#9a9a92","#7a5c44"],Ls=["#f1c9a5","#e6b892","#d9a982","#c08e68","#a0704c","#7a5238"],Ms=["#6b4a2f","#4a3424","#8a5a3a","#c27a48","#d8b878","#2e2622","#a07850","#9a9690"],Cs=["#a7bea9","#e6e0cc","#d9c9a3","#b9a083","#a9b8c4","#c8b4a0","#9fb0a0","#d8d2c4","#b98f74","#8fa3b5"],zs=["#8c9ca6","#a9b8b4","#8a8e94","#9fb3ad","#7d8a8f","#b0a58f"],Ps=["#d9c9a3","#c8b48a","#a08a6a","#e6e0cc"];function Fl(e,t="",r=""){let a$1=a(b("npc:"+e+"|"+t)),o=l=>l[Math.floor(a$1()*l.length)],n=Jr({top:o(oo),bottom:o(no),shoes:o(so),hair:o(["short","short","long","curly"]),hat:a$1()<.2,colors:{skin:o(Ls),hair:o(Ms),shirt:o(Cs),pants:o(zs),boots:o(Ts),hat:o(Ps)}});n.name=e.slice(0,40),n.description=[t,r].filter(Boolean).join(" \u2014 ").slice(0,300),n.style={walk:o(["normal","normal","bouncy","heavy","sneaky"]),idle:o(["calm","calm","fidgety","proud"]),energy:Math.round(a$1()*10)/10},n.tags=["npc",...t?[t.slice(0,24)]:[]];let s=Oe(n);return s.ok?s.spec:mt()}var We=([e,t,r])=>"#"+[e,t,r].map(a=>Math.round(a).toString(16).padStart(2,"0")).join("");function Is(e){if(!e.length)return null;let t=r=>{let a=e.map(o=>o[r]).sort((o,n)=>o-n);return a[a.length>>1]};return [t(0),t(1),t(2)]}function _s(e,t){let{width:r,height:a,data:o}=e,n=(E,M)=>{let R=(M*r+E)*4;return [o[R],o[R+1],o[R+2]]},s=[n(0,0),n(r-1,0),n(0,a-1),n(r-1,a-1)],l=[0,1,2].map(E=>s.reduce((M,R)=>M+R[E],0)/4),i=E=>Math.abs(E[0]-l[0])+Math.abs(E[1]-l[1])+Math.abs(E[2]-l[2])>60,d=r,c=-1,h=a,p=-1;for(let E=0;E<a;E+=2)for(let M=0;M<r;M+=2)i(n(M,E))&&(d=Math.min(d,M),c=Math.max(c,M),h=Math.min(h,E),p=Math.max(p,E));c<0&&(d=0,c=r-1,h=0,p=a-1);let m=p-h+1,g=c-d+1,b=d+Math.floor(g*.3),v=d+Math.ceil(g*.7);return t.map(([E,M])=>{let R=[];for(let k=h+Math.floor(m*E);k<h+Math.ceil(m*M);k++)for(let y=b;y<v;y++){if(k<0||k>=a||y<0||y>=r)continue;let z=n(y,k);i(z)&&R.push(z);}return Is(R)})}var Os=[[0,.06],[.1,.22],[.3,.52],[.6,.86],[.92,1]];function Hl(e,t="humanoid",r=yr()){let[a,o,n,s,l]=_s(e,Os);if(t==="humanoid"){let d=JSON.parse(JSON.stringify(Zr));d.palette=Wr(d.palette,{...a?{hair:We(a)}:{},...o?{skin:We(o)}:{},...n?{shirt:We(n)}:{},...s?{pants:We(s)}:{},...l?{boots:We(l)}:{}}),d.name=r,d.tags=[];let c=Oe(d);return c.ok?c.spec:mt()}let i=Oe({name:r,rig:t,palette:{s:We(o??a??[198,156,124]),t:We(n??[58,143,214]),p:We(s??l??[44,62,107]),w:"#f4f4f4",b:"#1d1d21"},textures:{f_neutral:{w:4,h:2,rows:["wbbw","...."]},f_blink:{w:4,h:2,rows:["bbbb","...."]}},face:{rect:t==="blob"?[4,4,4,2]:t==="flyer"?[0,1,4,2]:[2,2,4,2],expressions:{neutral:"f_neutral",blink:"f_blink"}}});return i.ok?i.spec:mt()}var Fs={normal:{},bouncy:{amp:.9,arm:.8,bob:1.6,tempo:1.1,sway:.04},heavy:{amp:.6,arm:.4,bob:.6,tempo:.8,sway:.12},sneaky:{amp:.5,arm:.3,tempo:1.2},robotic:{amp:.7,arm:.7,quant:true},swagger:{amp:.7,arm:.5,bob:.8,tempo:.85,sway:.1,swagger:.22},skip:{amp:.9,arm:.9,bob:1.2,tempo:1.05,skip:1},ninja:{amp:.6,arm:.2,tempo:1.25,crouch:2.2},zombie:{amp:.45,arm:.05,tempo:.6,sway:.14,reach:1.45},catwalk:{amp:.7,arm:.45,tempo:.95,sway:.08,cross:.12}},Ds={calm:{},fidgety:{fidget:1,breath:1.3},proud:{chest:.08,breath:.8},cool:{pose:"hips",chest:.04,breath:.8},shy:{pose:"shy",breath:1.1},ready:{pose:"ready",breath:1.4},bored:{pose:"bored",breath:.7,fidget:.4}};function ra(e){let t={amp:.8,arm:.6,bob:0,tempo:1,sway:0,quant:false,breath:1,fidget:0,chest:0,reach:0,crouch:0,skip:0,cross:0,swagger:0,pose:"none",...Fs[e.walk],...Ds[e.idle]};return t.tempo*=.8+.4*e.energy,t.amp*=.85+.3*e.energy,t}function dt(e,t=0){let r=Math.sin(e.phase+t);return e.style.quant?Math.max(-1,Math.min(1,r*3)):r}function aa(e,t,r){let a=dt(t)*r;f(e,"legL","rx",a),f(e,"legR","rx",-a),f(e,"legFL","rx",a),f(e,"legBR","rx",a),f(e,"legFR","rx",-a),f(e,"legBL","rx",-a);}function oa(e,t,r){let a=dt(t)*r;f(e,"armL","rx",-a),f(e,"armR","rx",a);}function na(e,t,r,a){let o=dt(t),n=Math.max(0,Math.cos(t.phase))*Math.max(0,-o+.3),s=Math.max(0,-Math.cos(t.phase))*Math.max(0,o+.3);f(e,"shinL","rx",-r*(.15+n)),f(e,"shinR","rx",-r*(.15+s)),f(e,"foreArmL","rx",a*(.6+.4*Math.max(0,-o))),f(e,"foreArmR","rx",a*(.6+.4*Math.max(0,o)));}var Ns=(e,t)=>{let r=Math.sin(t.clock*2)*t.style.breath;f(e,"armL","rz",-0.04-.03*r),f(e,"armR","rz",.04+.03*r),f(e,"foreArmL","rx",.12+.02*r),f(e,"foreArmR","rx",.12+.02*r),f(e,"head","rx",.03*Math.sin(t.clock*1.7)+t.style.chest),f(e,"body","rx",t.style.chest*-0.5),t.style.fidget&&(f(e,"head","ry",.35*Math.sin(t.clock*.7)*Math.sin(t.clock*.31)),f(e,"root","ry",.05*Math.sin(t.clock*.9))),f(e,"body","sy",1+.04*Math.sin(t.clock*3)),Bs(e,t);};function Bs(e,t){let r=Math.sin(t.clock*2);switch(t.style.pose){case "hips":f(e,"armL","rz",-0.75),f(e,"armR","rz",.75),f(e,"foreArmL","rx",.2),f(e,"foreArmR","rx",.2),f(e,"foreArmL","rz",1.5),f(e,"foreArmR","rz",-1.5),f(e,"legL","rz",-0.06),f(e,"legR","rz",.06);break;case "shy":f(e,"armL","rx",-0.35),f(e,"armR","rx",-0.35),f(e,"foreArmL","rx",.5),f(e,"foreArmR","rx",.5),f(e,"head","rx",-0.15+.03*r),f(e,"legR","rx",.15+.08*Math.sin(t.clock*1.3)),f(e,"shinR","rx",-0.3);break;case "ready":f(e,"legL","rz",-0.16),f(e,"legR","rz",.16),f(e,"legL","rx",.25),f(e,"legR","rx",-0.15),f(e,"shinL","rx",-0.35),f(e,"shinR","rx",-0.25),f(e,"armL","rx",.9),f(e,"armR","rx",.7),f(e,"foreArmL","rx",1.4),f(e,"foreArmR","rx",1.5),f(e,"root","py",-0.6+.3*Math.abs(Math.sin(t.clock*3.2)));break;case "bored":f(e,"root","rz",.04),f(e,"legL","rz",-0.04),f(e,"shinR","rx",-0.25),f(e,"legR","rx",.12),f(e,"head","rz",.12+.03*r),f(e,"body","rx",-0.06);break;}}var Vs=(e,t)=>{aa(e,t,t.style.amp),oa(e,t,t.style.arm),na(e,t,t.style.amp*1.1,.35);let r=t.style.bob*Math.abs(Math.cos(t.phase));f(e,"root","py",r),f(e,"body","rz",t.style.sway*dt(t)),Hs(e,t);};function Hs(e,t){let r=t.style;if(r.reach&&(f(e,"armL","rx",r.reach+.05*Math.sin(t.phase)),f(e,"armR","rx",r.reach-.05*Math.sin(t.phase)),f(e,"foreArmL","rx",.1),f(e,"foreArmR","rx",.1),f(e,"head","rz",.15*Math.sin(t.phase*.5))),r.crouch&&(f(e,"root","py",-r.crouch),f(e,"body","rx",-0.3),f(e,"head","rx",.25),pe(e,"shinL","rx",-0.5),pe(e,"shinR","rx",-0.5),pe(e,"legL","rx",.35),pe(e,"legR","rx",.35),f(e,"armL","rx",-0.9),f(e,"armR","rx",-0.9)),r.skip){let a=Math.max(0,Math.sin(t.phase));pe(e,"root","py",2.2*r.skip*a*a),pe(e,"armL","rz",-0.3*a),pe(e,"armR","rz",.3*a);}r.cross&&(f(e,"legL","rz",r.cross),f(e,"legR","rz",-r.cross),f(e,"root","ry",.12*dt(t))),r.swagger&&(f(e,"body","ry",r.swagger*dt(t)),f(e,"head","rz",-0.5*r.swagger*dt(t)),f(e,"armL","rz",-0.2),f(e,"armR","rz",.2));}var js=(e,t)=>{aa(e,t,t.style.amp*1.3),oa(e,t,t.style.arm*1.6),na(e,t,t.style.amp*1.6,1.1),f(e,"body","rx",-0.18),f(e,"head","rx",.18),f(e,"root","py",(.8+t.style.bob)*Math.abs(Math.cos(t.phase)));},Gs=(e,t)=>{aa(e,t,t.style.amp*.5*Math.min(1,t.input.speed)),oa(e,t,t.style.arm*.4*Math.min(1,t.input.speed)),f(e,"body","rx",-0.45),f(e,"head","rx",.45),pe(e,"armL","rx",.25),pe(e,"armR","rx",.25),na(e,t,.9,.6),f(e,"root","py",-1.5);},Us=(e,t)=>{f(e,"root","rx",-1.3),f(e,"head","rx",1),f(e,"armL","rx",Math.PI-.5+.5*Math.sin(t.t*3)),f(e,"armR","rx",Math.PI-.5+.5*Math.sin(t.t*3+Math.PI)),f(e,"legL","rx",.3*Math.sin(t.t*8)),f(e,"legR","rx",-0.3*Math.sin(t.t*8));},qs=(e,t)=>{f(e,"legL","rx",.15),f(e,"legR","rx",.1),f(e,"armL","rz",-0.15),f(e,"armR","rz",.15),f(e,"root","py",.6*Math.sin(t.t*2));},Ys=e=>{f(e,"root","rx",-1.35),f(e,"head","rx",1.1),f(e,"armL","rz",-1.3),f(e,"armR","rz",1.3);},$s=(e,t)=>{let r=.15*Math.sin(t.t*10);f(e,"armL","rz",-0.6-r),f(e,"armR","rz",.6+r),f(e,"legL","rx",.25),f(e,"legR","rx",-0.25),f(e,"shinL","rx",-0.5),f(e,"shinR","rx",-0.3),f(e,"foreArmL","rx",.4),f(e,"foreArmR","rx",.4);},Ks=e=>{f(e,"legL","rx",1.45),f(e,"legR","rx",1.45),f(e,"legL","ry",.1),f(e,"legR","ry",-0.1),f(e,"shinL","rx",-1.45),f(e,"shinR","rx",-1.45),f(e,"root","py",-10),f(e,"body","rx",.4),f(e,"legBL","rx",1.2),f(e,"legBR","rx",1.2);},Xs=e=>{f(e,"legL","rx",1.4),f(e,"legR","rx",1.4),f(e,"legL","rz",-0.3),f(e,"legR","rz",.3),f(e,"armL","rx",.45),f(e,"armR","rx",.45),f(e,"shinL","rx",-1.2),f(e,"shinR","rx",-1.2),f(e,"foreArmL","rx",.5),f(e,"foreArmR","rx",.5);},Ws=e=>{f(e,"root","rx",Math.PI/2),f(e,"root","py",2);},Js=e=>{f(e,"root","rz",Math.PI/2),f(e,"root","py",2);},Zs=(e,t)=>{let r=Math.sin(t.phase*.5);f(e,"root","py",6*Math.max(0,r));let a=r<0?.2*-r:0;f(e,"body","sy",1-a+.1*Math.max(0,r)),f(e,"body","sx",1+a*.6),f(e,"body","sz",1+a*.6);},Qs=(e,t)=>{let r=Math.min(t.input.speed,8),a=Math.sin(t.clock*(3+r*1.2)),o=.25+r*.04;f(e,"tail","ry",o*1.6*a),f(e,"body","ry",-o*.35*a),f(e,"root","py",.4*Math.sin(t.clock*1.6));},ei=(e,t)=>{let r=Math.sin(Math.PI*t.k);f(e,"armR","rx",1.9*r),f(e,"armR","ry",.3*r),f(e,"body","ry",-0.3*r),f(e,"foreArmR","rx",.6*r);},ti=(e,t)=>{let r=Math.sin(Math.PI*t.k);f(e,"armR","rx",.9*r);},ri=(e,t)=>{let r=t.k<.4?-1.5*(t.k/.4):-1.5+3.5*((t.k-.4)/.6);f(e,"armR","rx",t.k>.9?r*(1-t.k)*10:r);},ai=(e,t)=>{let r=Math.sin(Math.PI*t.k);f(e,"body","rx",.15*r),f(e,"head","rx",.2*r),f(e,"root","rz",.05*r);},oi=(e,t)=>{let r=Math.sin(Math.PI*t.k);f(e,"root","py",-1.5*r),f(e,"legL","rx",.2*r),f(e,"legR","rx",.2*r),f(e,"shinL","rx",-0.5*r),f(e,"shinR","rx",-0.5*r),f(e,"body","sy",1-.2*r),f(e,"body","sx",1+.12*r),f(e,"body","sz",1+.12*r);},ni=(e,t)=>{f(e,"armR","rx",1.3+.1*Math.sin(t.t*16)),f(e,"armR","ry",-0.5),f(e,"head","rx",-0.1+.08*Math.sin(t.t*16));},si=e=>{f(e,"armR","rx",2),f(e,"armR","ry",-0.4),f(e,"head","rx",.35);},ii=e=>{f(e,"armR","rx",1.57),f(e,"armR","ry",-0.1),f(e,"armL","rx",1.57),f(e,"armL","ry",.35);},li=e=>{f(e,"armL","rx",.9),f(e,"armL","ry",-0.6);},Er={idle:Ns,walk:Vs,run:js,sneak:Gs,swim:Us,fly:qs,glide:Ys,fall:$s,sit:Ks,ride:Xs,sleep:Ws,dead:Js,hop:Zs,swing:ei,place:ti,throw:ri,hurt:ai,land:oi,eat:ni,drink:si,draw:ii,block:li,fin:Qs},ho={blob:{walk:"hop",run:"hop",sneak:"hop"},swimmer:{idle:"fin",walk:"fin",run:"fin",sneak:"fin",swim:"fin",fall:"fin"}},uo={swing:.3,place:.2,throw:.45,hurt:.3,land:.22};function re(e,t,r=.3){let a={};for(let[o,n]of Object.entries(t))a[o]=[[0,0],[r,n],[Math.max(r,e-r),n],[e,0]];return a}function N(e,t){let r={};for(let[a,o]of Object.entries(t))r[a]=[[0,o],[e,o]];return r}function w(e,t,r,a,o,n=0,s=false){let l=Math.max(8,Math.round(o*8)),i=[];for(let d=0;d<=l;d++){let c=d/l,h=s?Math.min(1,c/.15,(1-c)/.15):1;i.push([e*c,(r+a*Math.sin(Math.PI*2*o*c+n))*h]);}return {[t]:i}}function Je(e,t){return [[0,t],[e,t]]}function S(e,t){return t.map(([r,a])=>[e*r,a])}function O(...e){return Object.assign({},...e)}var fo={"legL.rx":1.5,"legR.rx":1.5,"shinL.rx":-1.5,"shinR.rx":-1.5,"root.py":-6.2},ci=4.1,bo={"legL.rx":1.45,"legR.rx":1.45,"legL.ry":.75,"legR.ry":-0.75,"shinL.rx":-2.5,"shinR.rx":-2.5,"shinL.ry":-0.6,"shinR.ry":.6,"root.py":-10.2},Xt={"root.rx":Math.PI/2,"root.py":2.3,"root.pz":0};var ie=Math.PI,wo={"armR.rx":.55,"foreArmR.rx":1.35,"armR.rz":-0.15},Wt={"armL.rx":.55,"foreArmL.rx":1.35,"armL.rz":.15},yo={...wo,...Wt},go={"armL.rx":.75,"armR.rx":.75,"foreArmL.rx":.85,"foreArmR.rx":.85,"head.rx":-0.2},be=(e,t)=>N(e,{...fo,...t}),Tr=(e,t,r,a)=>O(w(e,"legL.rx",0,r,t),w(e,"legR.rx",0,r,t,ie),w(e,"shinL.rx",-a,a,t,-ie/2),w(e,"shinR.rx",-a,a,t,ie/2)),sa={tiptoe:{label:"\u041D\u0430 \u0446\u044B\u043F\u043E\u0447\u043A\u0430\u0445",en:"Tiptoe",duration:1.6,loop:true,tracks:O(Tr(1.6,2,.35,.35),N(1.6,{"root.py":.6,"body.rx":-0.12,"armL.rx":.6,"armR.rx":.6,"foreArmL.rx":1.4,"foreArmR.rx":1.4}),w(1.6,"head.ry",0,.25,1))},limp:{label:"\u041A\u043E\u0432\u044B\u043B\u044F\u0442\u044C",en:"Limp",duration:1.6,loop:true,emotion:"hurt",tracks:{"legL.rx":S(1.6,[[0,.4],[.5,-0.3],[1,.4]]),"legR.rx":S(1.6,[[0,-0.15],[.5,.15],[1,-0.15]]),"shinL.rx":S(1.6,[[0,-0.2],[.25,-0.9],[.5,-0.1],[1,-0.2]]),"root.py":S(1.6,[[0,0],[.5,-1],[1,0]]),"body.rz":S(1.6,[[0,.04],[.5,-0.1],[1,.04]]),"armR.rz":Je(1.6,.2)}},crawl:{label:"\u041F\u043E\u043B\u0437\u0442\u0438",en:"Crawl",duration:1.6,loop:true,tracks:O(N(1.6,{"root.rx":-1.35,"root.py":3.2,"head.rx":1.1,"legL.rx":1.3,"legR.rx":1.3,"shinL.rx":-1.4,"shinR.rx":-1.4}),w(1.6,"armL.rx",2,.4,2),w(1.6,"armR.rx",2,.4,2,ie),w(1.6,"legL.ry",0,.15,2,ie),w(1.6,"legR.ry",0,.15,2))},climb:{label:"\u041B\u0435\u0437\u0442\u044C \u043F\u043E \u043B\u0435\u0441\u0442\u043D\u0438\u0446\u0435",en:"Climb",duration:1.6,loop:true,tracks:O(w(1.6,"armL.rx",2.6,.4,1),w(1.6,"armR.rx",2.6,.4,1,ie),w(1.6,"legL.rx",.7,.6,1,ie),w(1.6,"legR.rx",.7,.6,1),w(1.6,"shinL.rx",-1,.6,1,ie),w(1.6,"shinR.rx",-1,.6,1),N(1.6,{"head.rx":.4,"foreArmL.rx":.5,"foreArmR.rx":.5}))},jog:{label:"\u0411\u0435\u0433 \u0442\u0440\u0443\u0441\u0446\u043E\u0439",en:"Jog",duration:.9,loop:true,tracks:O(Tr(.9,1,.6,.6),w(.9,"armL.rx",0,.6,1,ie),w(.9,"armR.rx",0,.6,1),N(.9,{"foreArmL.rx":1.4,"foreArmR.rx":1.4,"body.rx":-0.1}),w(.9,"root.py",.8,.8,2))},carry:{label:"\u041D\u0435\u0441\u0442\u0438 \u043A\u043E\u0440\u043E\u0431\u043A\u0443",en:"Carry",duration:1,loop:true,layer:"upper",tracks:N(1,{"armL.rx":.9,"armR.rx":.9,"foreArmL.rx":.7,"foreArmR.rx":.7,"armL.rz":-0.25,"armR.rz":.25,"body.rx":.08})},push:{label:"\u0422\u043E\u043B\u043A\u0430\u0442\u044C",en:"Push",duration:1.4,loop:true,emotion:"determined",tracks:O(Tr(1.4,1,.3,.5),N(1.4,{"body.rx":-0.45,"head.rx":.4,"armL.rx":1.4,"armR.rx":1.4,"foreArmL.rx":.5,"foreArmR.rx":.5,"root.py":-0.8}))},pull:{label:"\u0422\u044F\u043D\u0443\u0442\u044C",en:"Pull",duration:1.4,loop:true,emotion:"determined",tracks:O(Tr(1.4,1,.25,.4),N(1.4,{"body.rx":.25,"armL.rx":1.2,"armR.rx":1.2,"foreArmL.rx":.3,"foreArmR.rx":.3,"root.py":-0.6}))},sitChair:{label:"\u0421\u0438\u0434\u0435\u0442\u044C \u043D\u0430 \u0441\u0442\u0443\u043B\u0435",en:"Sit on a chair",duration:2,loop:true,tracks:O(be(2,{"armL.rx":.4,"armR.rx":.4,"foreArmL.rx":.5,"foreArmR.rx":.5}),w(2,"head.rz",0,.04,1))},sitFloor:{label:"\u041F\u043E-\u0442\u0443\u0440\u0435\u0446\u043A\u0438",en:"Sit cross-legged",duration:2,loop:true,tracks:N(2,{...bo,"armL.rx":.5,"armR.rx":.5,"foreArmL.rx":.6,"foreArmR.rx":.6})},sitKneel:{label:"\u041D\u0430 \u043A\u043E\u043B\u0435\u043D\u044F\u0445",en:"Kneel",duration:2,loop:true,tracks:N(2,{"shinL.rx":-1.5,"shinR.rx":-1.5,"root.py":-6.1,"armL.rx":.2,"armR.rx":.2})},sitEdge:{label:"\u041D\u0430 \u043A\u0440\u0430\u044E",en:"Sit on the edge",duration:2.4,loop:true,tracks:O(be(2.4,{"armL.rz":-0.3,"armR.rz":.3,"armL.rx":-0.2,"armR.rx":-0.2}),w(2.4,"shinL.rx",-1.2,.3,2),w(2.4,"shinR.rx",-1.2,.3,2,ie))},sitLounge:{label:"\u0420\u0430\u0437\u0432\u0430\u043B\u0438\u0432\u0448\u0438\u0441\u044C",en:"Lounge",duration:2,loop:true,emotion:"cool",tracks:be(2,{"body.rx":.35,"head.rx":-0.2,"legL.rx":1.2,"shinL.rx":-0.6,"armL.rz":-2.6,"armR.rz":2.6,"foreArmL.rz":1.8,"foreArmR.rz":-1.8,"root.py":-6.8})},sitHug:{label:"\u041E\u0431\u0445\u0432\u0430\u0442\u0438\u0432 \u043A\u043E\u043B\u0435\u043D\u0438",en:"Hug knees",duration:2,loop:true,emotion:"sad",tracks:N(2,{"legL.rx":2.4,"legR.rx":2.4,"shinL.rx":-2.6,"shinR.rx":-2.6,"root.py":-10.2,"armL.rx":1,"armR.rx":1,"foreArmL.rx":.9,"foreArmR.rx":.9,"head.rx":-0.15,"body.rx":-0.15})},squat:{label:"\u041D\u0430 \u043A\u043E\u0440\u0442\u043E\u0447\u043A\u0430\u0445",en:"Squat",duration:2,loop:true,tracks:N(2,{"legL.rx":2,"legR.rx":2,"legL.rz":-0.2,"legR.rz":.2,"shinL.rx":-2.5,"shinR.rx":-2.5,"root.py":-7,"body.rx":-0.35,"head.rx":.3,"armL.rx":.7,"armR.rx":.7,"foreArmL.rx":.6,"foreArmR.rx":.6})},sitEat:{label:"\u0415\u0441\u0442\u044C \u0441\u0438\u0434\u044F",en:"Eat (seated)",duration:1.2,loop:true,tracks:O(be(1.2,{...Wt,"armR.rx":.9}),w(1.2,"foreArmR.rx",1.5,.45,1),w(1.2,"head.rx",-0.1,.06,2))},sitDrink:{label:"\u041F\u0438\u0442\u044C \u0441\u0438\u0434\u044F",en:"Drink (seated)",duration:2.4,loop:true,tracks:O(be(2.4,{}),{"armR.rx":S(2.4,[[0,.6],[.3,1.2],[.6,1.2],[1,.6]]),"foreArmR.rx":S(2.4,[[0,1.3],[.3,2],[.6,2],[1,1.3]]),"head.rx":S(2.4,[[0,0],[.3,.3],[.6,.3],[1,0]])})},sitRead:{label:"\u0427\u0438\u0442\u0430\u0442\u044C \u0441\u0438\u0434\u044F",en:"Read (seated)",duration:3,loop:true,tracks:O(be(3,{...yo,"head.rx":-0.3}),w(3,"head.ry",0,.08,1))},sitLaptop:{label:"\u0417\u0430 \u043D\u043E\u0443\u0442\u0431\u0443\u043A\u043E\u043C",en:"Laptop",duration:1.2,loop:true,tracks:O(be(1.2,go),w(1.2,"foreArmL.rx",.85,.08,4),w(1.2,"foreArmR.rx",.85,.08,4,ie))},sitWrite:{label:"\u041F\u0438\u0441\u0430\u0442\u044C \u0441\u0438\u0434\u044F",en:"Write (seated)",duration:1.6,loop:true,tracks:O(be(1.6,{...go,"armL.rx":.6}),w(1.6,"foreArmR.rz",0,.15,3),w(1.6,"head.rz",0,.05,1))},sitTalk:{label:"\u0413\u043E\u0432\u043E\u0440\u0438\u0442\u044C \u0441\u0438\u0434\u044F",en:"Talk (seated)",duration:2.4,loop:true,tracks:O(be(2.4,{"armL.rx":.6,"foreArmL.rx":1}),w(2.4,"armR.rx",.8,.3,2),w(2.4,"foreArmR.rx",1.2,.4,3),w(2.4,"head.rz",0,.08,2))},sitLaugh:{label:"\u0421\u043C\u0435\u044F\u0442\u044C\u0441\u044F \u0441\u0438\u0434\u044F",en:"Laugh (seated)",duration:1.6,loop:true,emotion:"happy",tracks:O(be(1.6,{"armL.rx":.5,"armR.rx":.5,"foreArmL.rx":1,"foreArmR.rx":1}),w(1.6,"body.rx",.12,.1,4),w(1.6,"head.rx",.2,.1,4))},sitCry:{label:"\u041F\u043B\u0430\u043A\u0430\u0442\u044C \u0441\u0438\u0434\u044F",en:"Cry (seated)",duration:2.4,loop:true,emotion:"crying",tracks:O(be(2.4,{"armL.rx":2.2,"armR.rx":2.2,"foreArmL.rx":1.5,"foreArmR.rx":1.5,"head.rx":-0.45,"body.rx":-0.25}),w(2.4,"body.sy",1,.02,4))},sitDoze:{label:"\u041A\u043B\u0435\u0432\u0430\u0442\u044C \u043D\u043E\u0441\u043E\u043C",en:"Doze",duration:3,loop:true,emotion:"sleepy",tracks:O(be(3,{"armL.rx":.3,"armR.rx":.3}),{"head.rx":S(3,[[0,-0.15],[.6,-0.6],[.7,-0.1],[1,-0.15]])})},sitDrive:{label:"\u0420\u0443\u043B\u0438\u0442\u044C",en:"Drive",duration:2.4,loop:true,tracks:O(be(2.4,{"armL.rx":1.2,"armR.rx":1.2,"foreArmL.rx":.5,"foreArmR.rx":.5}),w(2.4,"armL.rz",.2,.2,1),w(2.4,"armR.rz",-0.2,.2,1),w(2.4,"body.rz",0,.05,1,ie))},sitGamepad:{label:"\u0418\u0433\u0440\u0430\u0442\u044C \u0441 \u0433\u0435\u0439\u043C\u043F\u0430\u0434\u043E\u043C",en:"Gamepad",duration:1.2,loop:true,emotion:"determined",tracks:O(be(1.2,{"armL.rx":.8,"armR.rx":.8,"foreArmL.rx":1.2,"foreArmR.rx":1.2,"armL.rz":.25,"armR.rz":-0.25,"body.rx":-0.15,"head.rx":-0.05}),w(1.2,"foreArmL.rz",0,.08,4),w(1.2,"body.rz",0,.05,1))},sitClap:{label:"\u0425\u043B\u043E\u043F\u0430\u0442\u044C \u0441\u0438\u0434\u044F",en:"Clap (seated)",duration:1.2,loop:true,emotion:"happy",tracks:O(be(1.2,{"armL.rx":1.1,"armR.rx":1.1,"foreArmL.rx":.6,"foreArmR.rx":.6}),w(1.2,"foreArmL.rz",.55,.35,4),w(1.2,"foreArmR.rz",-0.55,-0.35,4))},lieBack:{label:"\u041B\u0435\u0436\u0430\u0442\u044C \u043D\u0430 \u0441\u043F\u0438\u043D\u0435",en:"Lie on the back",duration:3,loop:true,tracks:O(N(3,{...Xt,"armL.rz":-2.6,"armR.rz":2.6,"foreArmL.rz":1.6,"foreArmR.rz":-1.6,"legL.rx":.1}),w(3,"body.sy",1,.02,1))},lieSide:{label:"\u0421\u043F\u0430\u0442\u044C \u043D\u0430 \u0431\u043E\u043A\u0443",en:"Sleep on the side",duration:3,loop:true,emotion:"sleepy",tracks:O(N(3,{"root.rz":ie/2,"root.py":4.6,"legL.rx":.7,"legR.rx":.4,"shinL.rx":-0.9,"shinR.rx":-0.6,"armL.rx":1.2,"armR.rx":.9,"foreArmL.rx":1.2,"head.rz":-0.2}),w(3,"body.sy",1,.02,1))},lieFront:{label:"\u041D\u0430 \u0436\u0438\u0432\u043E\u0442\u0435",en:"Lie on the front",duration:2.4,loop:true,tracks:O(N(2.4,{"root.rx":-ie/2,"root.py":2.3,"head.rx":.9,"armL.rx":2.6,"armR.rx":2.6,"foreArmL.rx":1.6,"foreArmR.rx":1.6,"shinR.rx":-1.4}),w(2.4,"shinL.rx",-1.2,.5,1))},getUp:{label:"\u0412\u0441\u0442\u0430\u0442\u044C \u0441 \u043F\u043E\u043B\u0430",en:"Get up",duration:1.8,tracks:{"root.rx":S(1.8,[[0,ie/2],[.3,.6],[.6,0],[1,0]]),"root.py":S(1.8,[[0,2.3],[.3,-6],[.6,-6],[1,0]]),"legL.rx":S(1.8,[[0,0],[.3,1.8],[.6,1.5],[1,0]]),"legR.rx":S(1.8,[[0,0],[.3,.2],[.6,-0.1],[1,0]]),"shinL.rx":S(1.8,[[0,0],[.3,-2],[.6,-1.5],[1,0]]),"shinR.rx":S(1.8,[[0,0],[.3,-1.6],[.6,-1.4],[1,0]]),"armL.rx":S(1.8,[[0,0],[.3,-0.6],[.6,.4],[1,0]])}},phone:{label:"\u0413\u043E\u0432\u043E\u0440\u0438\u0442\u044C \u043F\u043E \u0442\u0435\u043B\u0435\u0444\u043E\u043D\u0443",en:"Phone call",duration:2.4,loop:true,layer:"upper",tracks:O(N(2.4,{"armR.rx":2.1,"armR.rz":-0.08,"head.rz":-0.15}),w(2.4,"head.rx",0,.05,2),w(2.4,"armL.rz",-0.15,.15,2))},phoneScroll:{label:"\u041B\u0438\u0441\u0442\u0430\u0442\u044C \u0442\u0435\u043B\u0435\u0444\u043E\u043D",en:"Scroll phone",duration:1.6,loop:true,layer:"upper",tracks:O(N(1.6,{...wo,"armL.rx":.5,"foreArmL.rx":1.4,"armL.rz":.3,"head.rx":-0.4}),w(1.6,"foreArmL.rz",.1,.06,2))},selfie:{label:"\u0421\u0435\u043B\u0444\u0438",en:"Selfie",duration:2,loop:true,emotion:"happy",layer:"upper",tracks:O(N(2,{"armR.rx":1.8,"armR.rz":.6,"foreArmR.rx":.2,"head.rz":-0.15,"armL.rz":-1.4,"foreArmL.rz":1.2}),w(2,"head.ry",.2,.05,1))},photo:{label:"\u0424\u043E\u0442\u043E\u0433\u0440\u0430\u0444\u0438\u0440\u043E\u0432\u0430\u0442\u044C",en:"Take a photo",duration:2,loop:true,layer:"upper",tracks:N(2,{"armL.rx":1.4,"armR.rx":1.4,"foreArmL.rx":1.2,"foreArmR.rx":1.2,"armL.rz":.35,"armR.rz":-0.35,"head.rx":.05})},drinkCup:{label:"\u041F\u0438\u0442\u044C \u0438\u0437 \u043A\u0440\u0443\u0436\u043A\u0438",en:"Drink from a cup",duration:2.4,loop:true,layer:"upper",tracks:{"armR.rx":S(2.4,[[0,.55],[.3,1.2],[.6,1.2],[1,.55]]),"foreArmR.rx":S(2.4,[[0,1.35],[.3,2.1],[.6,2.1],[1,1.35]]),"head.rx":S(2.4,[[0,0],[.3,.3],[.6,.3],[1,0]])}},eat:{label:"\u0415\u0441\u0442\u044C",en:"Eat",duration:1.2,loop:true,layer:"upper",tracks:O(N(1.2,{...Wt,"armR.rx":.9}),w(1.2,"foreArmR.rx",1.5,.45,1),w(1.2,"head.rx",-0.1,.06,2))},read:{label:"\u0427\u0438\u0442\u0430\u0442\u044C",en:"Read",duration:3,loop:true,layer:"upper",tracks:O(N(3,{...yo,"head.rx":-0.35}),w(3,"head.ry",0,.08,1))},board:{label:"\u041F\u0438\u0441\u0430\u0442\u044C \u043D\u0430 \u0434\u043E\u0441\u043A\u0435",en:"Write on a board",duration:2,loop:true,tracks:O(N(2,{"armR.rx":2,"foreArmR.rx":.4,"body.ry":.15,"head.rx":.2}),w(2,"armR.rz",0,.25,2),w(2,"foreArmR.rz",0,.2,4))},cook:{label:"\u0413\u043E\u0442\u043E\u0432\u0438\u0442\u044C",en:"Cook",duration:1.6,loop:true,layer:"upper",tracks:O(N(1.6,{...Wt,"armR.rx":.9,"foreArmR.rx":.9,"head.rx":-0.3}),w(1.6,"armR.rz",0,.2,2),w(1.6,"armR.ry",0,.3,2,ie/2))},dishes:{label:"\u041C\u044B\u0442\u044C \u043F\u043E\u0441\u0443\u0434\u0443",en:"Wash dishes",duration:1.6,loop:true,tracks:O(N(1.6,{"armL.rx":.9,"armR.rx":.9,"foreArmL.rx":.6,"foreArmR.rx":.6,"head.rx":-0.35,"body.rx":-0.1}),w(1.6,"armR.rz",0,.15,3),w(1.6,"armL.rz",0,.12,3,ie))},sweep:{label:"\u041F\u043E\u0434\u043C\u0435\u0442\u0430\u0442\u044C",en:"Sweep",duration:1.6,loop:true,tracks:O(N(1.6,{"armL.rx":.6,"armR.rx":.4,"foreArmL.rx":.9,"foreArmR.rx":.5,"body.rx":-0.15,"head.rx":-0.2}),w(1.6,"body.ry",0,.3,2),w(1.6,"armL.rz",0,.25,2))},water:{label:"\u041F\u043E\u043B\u0438\u0432\u0430\u0442\u044C \u0446\u0432\u0435\u0442\u044B",en:"Water plants",duration:2.4,loop:true,tracks:O(N(2.4,{"armR.rx":.9,"foreArmR.rx":.5,"body.rx":-0.1,"head.rx":-0.3}),w(2.4,"armR.rz",-0.1,.25,1))},dig:{label:"\u041A\u043E\u043F\u0430\u0442\u044C",en:"Dig",duration:1.6,loop:true,emotion:"determined",tracks:{"body.rx":S(1.6,[[0,-0.1],[.4,-0.6],[.7,0],[1,-0.1]]),"armL.rx":S(1.6,[[0,.6],[.4,1.4],[.7,.5],[1,.6]]),"armR.rx":S(1.6,[[0,.4],[.4,.9],[.7,.2],[1,.4]]),"foreArmL.rx":Je(1.6,.8),"foreArmR.rx":Je(1.6,.6),"shinL.rx":S(1.6,[[0,0],[.4,-0.5],[.7,0],[1,0]]),"shinR.rx":S(1.6,[[0,0],[.4,-0.5],[.7,0],[1,0]]),"root.py":S(1.6,[[0,0],[.4,-1],[.7,0],[1,0]])}},fish:{label:"\u0420\u044B\u0431\u0430\u0447\u0438\u0442\u044C",en:"Fish",duration:3,loop:true,tracks:O(N(3,{"armL.rx":.9,"armR.rx":.9,"foreArmL.rx":.9,"foreArmR.rx":.7,"head.rx":.05}),w(3,"armR.rx",.9,.08,2))},paint:{label:"\u0420\u0438\u0441\u043E\u0432\u0430\u0442\u044C \u043D\u0430 \u043C\u043E\u043B\u044C\u0431\u0435\u0440\u0442\u0435",en:"Paint",duration:2,loop:true,layer:"upper",tracks:O(N(2,{"armR.rx":1.4,"foreArmR.rx":.6,...Wt,"head.rz":.1}),w(2,"armR.rz",0,.2,2),w(2,"foreArmR.rx",.6,.25,3))},brushTeeth:{label:"\u0427\u0438\u0441\u0442\u0438\u0442\u044C \u0437\u0443\u0431\u044B",en:"Brush teeth",duration:1.2,loop:true,layer:"upper",tracks:O(N(1.2,{"armR.rx":1,"foreArmR.rx":2,"armR.rz":-0.2,"head.rx":.05}),w(1.2,"armR.ry",0,.2,6))},washFace:{label:"\u0423\u043C\u044B\u0432\u0430\u0442\u044C\u0441\u044F",en:"Wash face",duration:1.6,loop:true,tracks:O(N(1.6,{"armL.rx":1.4,"armR.rx":1.4,"foreArmL.rx":1.9,"foreArmR.rx":1.9,"body.rx":-0.45,"head.rx":-0.3}),w(1.6,"foreArmL.rx",1.9,.25,3),w(1.6,"foreArmR.rx",1.9,.25,3))},openDoor:{label:"\u041E\u0442\u043A\u0440\u044B\u0442\u044C \u0434\u0432\u0435\u0440\u044C",en:"Open a door",duration:1.6,layer:"upper",tracks:{"armR.rx":S(1.6,[[0,0],[.3,1.3],[.6,1.3],[.9,.6],[1,0]]),"foreArmR.rx":S(1.6,[[0,0],[.3,.4],[.6,.4],[1,0]]),"armR.ry":S(1.6,[[0,0],[.3,0],[.45,-0.5],[.9,-0.6],[1,0]]),"body.ry":S(1.6,[[0,0],[.6,-0.2],[1,0]])}},knock:{label:"\u041F\u043E\u0441\u0442\u0443\u0447\u0430\u0442\u044C",en:"Knock",duration:1.4,layer:"upper",tracks:O({"armR.rx":S(1.4,[[0,0],[.2,1.3],[.85,1.3],[1,0]])},w(1.4,"foreArmR.rx",1.4,.35,3,0,true),{"head.rz":S(1.4,[[0,0],[.3,.1],[1,0]])})},checkWatch:{label:"\u041F\u043E\u0441\u043C\u043E\u0442\u0440\u0435\u0442\u044C \u043D\u0430 \u0447\u0430\u0441\u044B",en:"Check the time",duration:1.6,layer:"upper",tracks:{"armL.rx":S(1.6,[[0,0],[.25,.9],[.8,.9],[1,0]]),"foreArmL.rx":S(1.6,[[0,0],[.25,1.4],[.8,1.4],[1,0]]),"armL.rz":S(1.6,[[0,0],[.25,.4],[.8,.4],[1,0]]),"head.rx":S(1.6,[[0,0],[.3,-0.4],[.8,-0.4],[1,0]]),"head.ry":S(1.6,[[0,0],[.3,-0.25],[.8,-0.25],[1,0]])}},wait:{label:"\u0416\u0434\u0430\u0442\u044C",en:"Wait",duration:1.2,loop:true,emotion:"tired",tracks:O(N(1.2,{"armL.rz":-0.8,"armR.rz":.8,"foreArmL.rz":1.5,"foreArmR.rz":-1.5}),{"legR.rx":S(1.2,[[0,.15],[.25,.15],[.5,.15],[1,.15]]),"shinR.rx":S(1.2,[[0,-0.2],[.2,-0.45],[.4,-0.2],[.6,-0.45],[.8,-0.2],[1,-0.2]])})},pockets:{label:"\u0420\u0443\u043A\u0438 \u0432 \u043A\u0430\u0440\u043C\u0430\u043D\u0430\u0445",en:"Hands in pockets",duration:2,loop:true,emotion:"cool",layer:"upper",tracks:N(2,{"armL.rx":-0.25,"armR.rx":-0.25,"armL.rz":-0.12,"armR.rz":.12,"foreArmL.rx":.5,"foreArmR.rx":.5,"head.rx":.05})},armsCrossed:{label:"\u0420\u0443\u043A\u0438 \u0441\u043A\u0440\u0435\u0449\u0435\u043D\u044B",en:"Arms crossed",duration:2,loop:true,layer:"upper",tracks:N(2,{"armL.rx":.6,"armR.rx":.6,"armL.rz":.35,"armR.rz":-0.35,"foreArmL.rx":1.6,"foreArmR.rx":1.6,"foreArmL.ry":-0.7,"foreArmR.ry":.7,"head.rx":.08})},lean:{label:"\u041E\u0431\u043B\u043E\u043A\u043E\u0442\u0438\u0442\u044C\u0441\u044F \u043D\u0430 \u0441\u0442\u0435\u043D\u0443",en:"Lean on a wall",duration:2,loop:true,emotion:"cool",tracks:N(2,{"root.rz":-0.12,"root.px":-1,"legL.rx":.15,"legL.ry":.2,"shinL.rx":-0.4,"armR.rz":1.5,"foreArmR.rz":-1.4,"armL.rx":-0.2,"foreArmL.rx":.4,"head.rz":.06})},shiver:{label:"\u0414\u0440\u043E\u0436\u0430\u0442\u044C \u043E\u0442 \u0445\u043E\u043B\u043E\u0434\u0430",en:"Shiver",duration:1.2,loop:true,emotion:"scared",layer:"upper",tracks:O(N(1.2,{"armL.rx":.8,"armR.rx":.8,"armL.rz":.5,"armR.rz":-0.5,"foreArmL.rx":1.4,"foreArmR.rx":1.4,"head.rx":-0.15}),w(1.2,"body.rz",0,.03,10),w(1.2,"head.rz",0,.04,9))},fan:{label:"\u041E\u0431\u043C\u0430\u0445\u0438\u0432\u0430\u0442\u044C\u0441\u044F",en:"Fan yourself",duration:1.2,loop:true,emotion:"tired",layer:"upper",tracks:O(N(1.2,{"armR.rx":.9,"foreArmR.rx":1.7,"head.rx":.15}),w(1.2,"foreArmR.rz",0,.4,4))},sneeze:{label:"\u0427\u0438\u0445\u043D\u0443\u0442\u044C",en:"Sneeze",duration:1.4,tracks:{"head.rx":S(1.4,[[0,0],[.45,.4],[.55,-0.4],[.8,-0.2],[1,0]]),"body.rx":S(1.4,[[0,0],[.45,.1],[.55,-0.35],[.8,-0.1],[1,0]]),"armR.rx":S(1.4,[[0,0],[.4,1.3],[.8,1.3],[1,0]]),"foreArmR.rx":S(1.4,[[0,0],[.4,1.9],[.8,1.9],[1,0]])}},cough:{label:"\u041A\u0430\u0448\u043B\u044F\u0442\u044C",en:"Cough",duration:1.4,layer:"upper",tracks:O({"armR.rx":S(1.4,[[0,0],[.2,1.2],[.85,1.2],[1,0]]),"foreArmR.rx":S(1.4,[[0,0],[.2,2],[.85,2],[1,0]])},w(1.4,"body.rx",-0.1,.1,3,0,true),w(1.4,"head.rx",-0.1,.12,3,0,true))},hug:{label:"\u041E\u0431\u043D\u044F\u0442\u044C",en:"Hug",duration:2,loop:true,emotion:"love",layer:"upper",tracks:N(2,{"armL.rx":1.3,"armR.rx":1.3,"armL.rz":-0.4,"armR.rz":.4,"foreArmL.rz":1,"foreArmR.rz":-1,"foreArmL.rx":.4,"foreArmR.rx":.4,"head.rz":.1})},handshake:{label:"\u0420\u0443\u043A\u043E\u043F\u043E\u0436\u0430\u0442\u0438\u0435",en:"Handshake",duration:1.6,loop:true,emotion:"happy",layer:"upper",tracks:O(N(1.6,{"armR.rx":.9,"foreArmR.rx":.5}),w(1.6,"foreArmR.rx",.5,.15,3))},highFive:{label:"\u0414\u0430\u0442\u044C \u043F\u044F\u0442\u044C",en:"High five",duration:1.2,emotion:"excited",layer:"upper",tracks:{"armR.rz":S(1.2,[[0,0],[.3,.35],[1,0]]),"armR.rx":S(1.2,[[0,0],[.3,2.8],[.45,2.5],[.8,2.5],[1,0]]),"body.ry":S(1.2,[[0,0],[.4,-0.15],[1,0]])}},throw:{label:"\u0411\u0440\u043E\u0441\u0438\u0442\u044C",en:"Throw",duration:1.2,layer:"upper",tracks:{"armR.rx":S(1.2,[[0,0],[.35,-0.6],[.5,2.2],[.7,1.2],[1,0]]),"armR.rz":S(1.2,[[0,0],[.35,.8],[.5,.2],[1,0]]),"body.ry":S(1.2,[[0,0],[.35,.35],[.55,-0.3],[1,0]]),"armL.rx":S(1.2,[[0,0],[.35,1],[.55,.2],[1,0]])}},catch:{label:"\u041F\u043E\u0439\u043C\u0430\u0442\u044C",en:"Catch",duration:1.2,emotion:"surprised",layer:"upper",tracks:{"armL.rx":S(1.2,[[0,0],[.3,1.6],[.5,1.4],[.8,.9],[1,0]]),"armR.rx":S(1.2,[[0,0],[.3,1.6],[.5,1.4],[.8,.9],[1,0]]),"foreArmL.rx":S(1.2,[[0,0],[.5,.4],[.8,1.2],[1,0]]),"foreArmR.rx":S(1.2,[[0,0],[.5,.4],[.8,1.2],[1,0]]),"body.rx":S(1.2,[[0,0],[.5,.08],[1,0]])}},juggle:{label:"\u041F\u043E\u0434\u043A\u0438\u0434\u044B\u0432\u0430\u0442\u044C \u043C\u044F\u0447",en:"Juggle",duration:1.2,loop:true,layer:"upper",tracks:O(N(1.2,{"armL.rx":.7,"armR.rx":.7,"head.rx":.35}),w(1.2,"foreArmL.rx",1.2,.35,2),w(1.2,"foreArmR.rx",1.2,.35,2,ie))}};var ht=Math.PI,ia={clap:{label:"\u0425\u043B\u043E\u043F\u0430\u0442\u044C",en:"Clap",duration:1.8,emotion:"happy",layer:"upper",tracks:O(re(1.8,{"armL.rx":1.2,"armR.rx":1.2,"armL.rz":.25,"armR.rz":-0.25},.2),w(1.8,"foreArmL.rz",.55,.35,5,0,true),w(1.8,"foreArmR.rz",-0.55,-0.35,5,0,true),re(1.8,{"foreArmL.rx":.6,"foreArmR.rx":.6},.2))},salute:{label:"\u041E\u0442\u0434\u0430\u0442\u044C \u0447\u0435\u0441\u0442\u044C",en:"Salute",duration:1.6,layer:"upper",tracks:re(1.6,{"armR.rx":2.6,"armR.rz":-0.12,"head.rx":.08},.25)},thumbsUp:{label:"\u041A\u043B\u0430\u0441\u0441",en:"Thumbs up",duration:1.4,emotion:"happy",layer:"upper",tracks:re(1.4,{"armR.rx":1,"armR.rz":.3,"foreArmR.rx":1.2,"head.rz":-0.1},.2)},heartHands:{label:"\u0421\u0435\u0440\u0434\u0446\u0435 \u0440\u0443\u043A\u0430\u043C\u0438",en:"Heart hands",duration:2,emotion:"love",layer:"upper",tracks:re(2,{"armL.rz":-2.3,"armR.rz":2.3,"armL.rx":.4,"armR.rx":.4,"foreArmL.rz":1.3,"foreArmR.rz":-1.3,"head.rz":.12})},think:{label:"\u0414\u0443\u043C\u0430\u0442\u044C",en:"Think",duration:2.4,emotion:"confused",layer:"upper",tracks:O(re(2.4,{"armR.rx":.9,"armR.rz":-0.2,"foreArmR.rx":2.1,"armL.rx":.5,"foreArmL.rx":1.4,"armL.rz":.3}),w(2.4,"head.rz",.12,.05,2,0,true),re(2.4,{"head.rx":.15}))},nod:{label:"\u0414\u0430",en:"Yes",duration:1.2,layer:"upper",tracks:w(1.2,"head.rx",-0.1,.22,3,0,true)},headShake:{label:"\u041D\u0435\u0442",en:"No",duration:1.2,layer:"upper",tracks:w(1.2,"head.ry",0,.4,3,0,true)},beckon:{label:"\u0418\u0434\u0438 \u0441\u044E\u0434\u0430",en:"Come here",duration:1.8,layer:"upper",tracks:O(re(1.8,{"armR.rx":1.3,"armR.rz":.2}),w(1.8,"foreArmR.rx",1,.6,3,0,true),re(1.8,{"head.rz":.1}))},stop:{label:"\u0421\u0442\u043E\u043F",en:"Stop",duration:1.4,emotion:"determined",layer:"upper",tracks:re(1.4,{"armR.rx":1.55,"foreArmR.rx":1.2,"body.rx":.06},.15)},yawn:{label:"\u0417\u0435\u0432\u043D\u0443\u0442\u044C",en:"Yawn",duration:2.4,emotion:"sleepy",layer:"upper",tracks:re(2.4,{"armR.rx":1.4,"foreArmR.rx":1.9,"armR.rz":-0.25,"armL.rz":-0.35,"armL.rx":-0.15,"head.rx":.35,"body.rx":.08},.5)},stretch:{label:"\u041F\u043E\u0442\u044F\u043D\u0443\u0442\u044C\u0441\u044F",en:"Stretch",duration:2.6,emotion:"sleepy",tracks:O(re(2.6,{"armL.rz":-2.9,"armR.rz":2.9,"head.rx":.3,"body.rx":.12},.6),{"root.py":S(2.6,[[0,0],[.3,.8],[.7,.8],[1,0]])})},flex:{label:"\u0421\u0438\u043B\u0430",en:"Flex",duration:1.8,emotion:"determined",layer:"upper",tracks:O(re(1.8,{"armL.rz":-1.5,"armR.rz":1.5,"foreArmL.rz":-1.6,"foreArmR.rz":1.6,"body.rx":.08},.25),w(1.8,"body.ry",0,.15,2,0,true))},jumpJoy:{label:"\u041F\u0440\u044B\u0436\u043E\u043A \u0440\u0430\u0434\u043E\u0441\u0442\u0438",en:"Jump for joy",duration:1.4,emotion:"excited",tracks:{"root.py":S(1.4,[[0,0],[.15,-1.5],[.4,6],[.6,6],[.8,0],[.9,-1],[1,0]]),"armL.rz":S(1.4,[[0,0],[.4,-2.8],[.7,-2.8],[1,0]]),"armR.rz":S(1.4,[[0,0],[.4,2.8],[.7,2.8],[1,0]]),"shinL.rx":S(1.4,[[0,0],[.15,-0.6],[.45,-1.4],[.7,-1.2],[.85,-0.4],[1,0]]),"shinR.rx":S(1.4,[[0,0],[.15,-0.6],[.45,-1.4],[.7,-1.2],[.85,-0.4],[1,0]])}},spin:{label:"\u041A\u0440\u0443\u0436\u0438\u0442\u044C\u0441\u044F",en:"Spin",duration:1.6,emotion:"happy",tracks:{"root.ry":S(1.6,[[0,0],[1,ht*2]]),"armL.rz":S(1.6,[[0,0],[.2,-1.5],[.8,-1.5],[1,0]]),"armR.rz":S(1.6,[[0,0],[.2,1.5],[.8,1.5],[1,0]])}},victory:{label:"\u041F\u043E\u0431\u0435\u0434\u0430",en:"Victory",duration:2,emotion:"excited",tracks:O(re(2,{"armR.rz":2.9,"armL.rz":-0.4,"foreArmL.rx":1.3,"armL.rx":.3,"head.rx":.2,"body.rx":.08}),{"root.py":S(2,[[0,0],[.2,3],[.35,0],[1,0]])})},airGuitar:{label:"\u0413\u0438\u0442\u0430\u0440\u0430",en:"Air guitar",duration:2.4,loop:true,emotion:"excited",tracks:O(N(2.4,{"armL.rx":1.2,"armL.rz":-0.5,"foreArmL.rz":.7,"armR.rx":.5,"foreArmR.rx":1.2,"legL.rx":.3,"shinL.rx":-0.4}),w(2.4,"foreArmR.rz",-0.2,.35,8),w(2.4,"head.rx",-0.1,.18,4),w(2.4,"body.rx",-0.05,.06,4))},drum:{label:"\u0411\u0430\u0440\u0430\u0431\u0430\u043D",en:"Drum",duration:1.6,loop:true,emotion:"excited",tracks:O(N(1.6,{"armL.rx":.7,"armR.rx":.7}),w(1.6,"foreArmL.rx",1,.5,4),w(1.6,"foreArmR.rx",1,.5,4,ht),w(1.6,"head.rx",0,.12,4))},pushups:{label:"\u041E\u0442\u0436\u0438\u043C\u0430\u043D\u0438\u044F",en:"Push-ups",duration:2,loop:true,emotion:"determined",tracks:O(N(2,{"root.rx":-1.35,"armL.rx":1.45,"armR.rx":1.45,"head.rx":1.1}),w(2,"root.py",3.4,1.2,2),w(2,"foreArmL.rx",-0.5,.5,2),w(2,"foreArmR.rx",-0.5,.5,2))},kneel:{label:"\u041D\u0430 \u043A\u043E\u043B\u0435\u043D\u043E",en:"Kneel",duration:2.4,tracks:re(2.4,{"legR.rx":-0.15,"shinR.rx":-1.4,"legL.rx":1.5,"shinL.rx":-1.5,"root.py":-6,"armR.rx":.9,"foreArmR.rx":1.4,"head.rx":-0.15},.5)},curtsy:{label:"\u0420\u0435\u0432\u0435\u0440\u0430\u043D\u0441",en:"Curtsy",duration:1.6,tracks:re(1.6,{"legR.rx":-0.4,"shinL.rx":-0.6,"shinR.rx":-0.6,"root.py":-1.4,"armL.rz":-0.5,"armR.rz":.5,"body.rx":-0.15,"head.rx":-0.2},.4)},scratchHead:{label:"\u041F\u043E\u0447\u0435\u0441\u0430\u0442\u044C \u0437\u0430\u0442\u044B\u043B\u043E\u043A",en:"Scratch head",duration:1.8,emotion:"confused",layer:"upper",tracks:O(re(1.8,{"armR.rx":3.05,"armR.rz":-0.35,"head.rz":.15,"head.rx":.2}),w(1.8,"foreArmR.rx",.35,.25,5,0,true))},hide:{label:"\u0421\u043F\u0440\u044F\u0442\u0430\u0442\u044C\u0441\u044F",en:"Hide",duration:2,emotion:"scared",tracks:re(2,{"armL.rx":2.4,"armR.rx":2.4,"foreArmL.rx":1.4,"foreArmR.rx":1.4,"body.rx":-0.35,"head.rx":-0.4,"shinL.rx":-0.5,"shinR.rx":-0.5,"root.py":-1.5},.2)},stomp:{label:"\u0422\u043E\u043F\u043D\u0443\u0442\u044C",en:"Stomp",duration:1.2,emotion:"angry",tracks:O(re(1.2,{"armL.rz":-0.35,"armR.rz":.35,"body.rx":-0.1},.15),{"legR.rx":S(1.2,[[0,0],[.3,.8],[.45,0],[.65,.8],[.8,0],[1,0]]),"shinR.rx":S(1.2,[[0,0],[.3,-1],[.45,0],[.65,-1],[.8,0],[1,0]])})},slump:{label:"\u041F\u043E\u043D\u0438\u043A",en:"Slump",duration:2.4,emotion:"sad",tracks:re(2.4,{"body.rx":-0.35,"head.rx":-0.45,"armL.rz":.05,"armR.rz":-0.05,"shinL.rx":-0.15,"shinR.rx":-0.15},.6)},rollLaugh:{label:"\u0412\u0430\u043B\u044F\u0442\u044C\u0441\u044F \u043E\u0442 \u0441\u043C\u0435\u0445\u0430",en:"Rolling with laughter",duration:2.4,loop:true,emotion:"happy",tracks:O(N(2.4,{...Xt,"armL.rx":1.2,"armR.rx":1.2,"foreArmL.rx":1.2,"foreArmR.rx":1.2}),w(2.4,"root.rz",0,.35,2),w(2.4,"legL.rx",1,.5,4),w(2.4,"legR.rx",1,.5,4,ht),w(2.4,"head.rx",.2,.15,6))},blowKiss:{label:"\u0412\u043E\u0437\u0434\u0443\u0448\u043D\u044B\u0439 \u043F\u043E\u0446\u0435\u043B\u0443\u0439",en:"Blow a kiss",duration:1.6,emotion:"love",layer:"upper",tracks:{"armR.rx":S(1.6,[[0,0],[.3,1.2],[.55,1.2],[.75,1.6],[1,0]]),"foreArmR.rx":S(1.6,[[0,0],[.3,2],[.55,2],[.75,.3],[1,0]]),"armR.rz":S(1.6,[[0,0],[.3,-0.2],[.75,.4],[1,0]]),"head.rz":S(1.6,[[0,0],[.3,.12],[.9,.12],[1,0]])}},phew:{label:"\u0424\u0443\u0445",en:"Phew",duration:1.6,emotion:"tired",layer:"upper",tracks:{"armR.rz":S(1.6,[[0,0],[.3,1.7],[.7,2.1],[1,0]]),"foreArmR.rz":S(1.6,[[0,0],[.3,-1.4],[.7,-1.6],[1,0]]),"head.rx":S(1.6,[[0,0],[.3,.2],[.7,-0.2],[1,0]]),"body.rx":S(1.6,[[0,0],[.6,-0.08],[1,0]])}},lookAround:{label:"\u041E\u0441\u043C\u043E\u0442\u0440\u0435\u0442\u044C\u0441\u044F",en:"Look around",duration:2.6,layer:"upper",tracks:{"head.ry":S(2.6,[[0,0],[.2,.9],[.45,.9],[.65,-0.9],[.85,-0.9],[1,0]]),"body.ry":S(2.6,[[0,0],[.2,.25],[.45,.25],[.65,-0.25],[.85,-0.25],[1,0]]),"armR.rx":S(2.6,[[0,0],[.2,2.6],[.85,2.6],[1,0]]),"foreArmR.rx":S(2.6,[[0,0],[.2,.9],[.85,.9],[1,0]])}},karate:{label:"\u041A\u0430\u0440\u0430\u0442\u044D",en:"Karate",duration:1.8,emotion:"determined",tracks:{"armR.rx":S(1.8,[[0,.6],[.2,.6],[.3,1.57],[.45,.6],[1,0]]),"foreArmR.rx":S(1.8,[[0,1.6],[.2,1.6],[.3,0],[.45,1.6],[1,0]]),"armL.rx":S(1.8,[[0,.6],[.45,.6],[.55,1.57],[.7,.6],[1,0]]),"foreArmL.rx":S(1.8,[[0,1.6],[.45,1.6],[.55,0],[.7,1.6],[1,0]]),"legR.rx":S(1.8,[[0,0],[.7,0],[.8,1.4],[.9,0],[1,0]]),"body.ry":S(1.8,[[0,0],[.3,-0.3],[.55,.3],[.8,0],[1,0]]),"root.py":S(1.8,[[0,-1],[.9,-1],[1,0]])}},nap:{label:"\u0423\u0441\u043D\u0443\u0442\u044C",en:"Nap",duration:3,loop:true,emotion:"sleepy",tracks:O(N(3,{...Xt,"armL.rz":-0.3,"armR.rz":2.4,"foreArmR.rz":-1.4,"legL.rx":.15}),w(3,"body.sy",1,.03,1))},danceRobot:{label:"\u0422\u0430\u043D\u0435\u0446 \xAB\u0420\u043E\u0431\u043E\u0442\xBB",en:"Robot dance",duration:2,loop:true,emotion:"cool",tracks:{"armL.rx":S(2,[[0,1.57],[.25,1.57],[.26,0],[.5,0],[.51,1.57],[.75,1.57],[.76,0],[1,1.57]]),"foreArmL.rx":S(2,[[0,0],[.25,0],[.26,1.57],[.5,1.57],[.51,0],[1,0]]),"armR.rx":S(2,[[0,0],[.25,0],[.26,1.57],[.5,1.57],[.51,0],[.75,0],[.76,1.57],[1,0]]),"foreArmR.rx":S(2,[[0,1.57],[.25,1.57],[.26,0],[.75,0],[.76,1.57],[1,1.57]]),"head.ry":S(2,[[0,.4],[.25,.4],[.26,-0.4],[.75,-0.4],[.76,.4],[1,.4]]),"root.py":S(2,[[0,0],[.25,-0.8],[.5,0],[.75,-0.8],[1,0]])}},danceHop:{label:"\u0422\u0430\u043D\u0435\u0446 \xAB\u041F\u0440\u044B\u0433-\u0441\u043A\u043E\u043A\xBB",en:"Hop dance",duration:1.6,loop:true,emotion:"excited",tracks:O(w(1.6,"root.py",1.2,1.2,4),w(1.6,"legL.rx",.25,.35,2),w(1.6,"legR.rx",.25,.35,2,ht),w(1.6,"shinL.rx",-0.5,.3,2),w(1.6,"shinR.rx",-0.5,.3,2,ht),w(1.6,"armL.rz",-1.6,.9,2),w(1.6,"armR.rz",1.6,.9,2))},danceSway:{label:"\u0422\u0430\u043D\u0435\u0446 \xAB\u041F\u043E\u043A\u0430\u0447\u0438\u0432\u0430\u043D\u0438\u0435\xBB",en:"Sway dance",duration:2.4,loop:true,emotion:"happy",tracks:O(w(2.4,"body.rz",0,.12,2),w(2.4,"head.rz",0,.16,2,ht),w(2.4,"root.px",0,1.2,2),w(2.4,"armL.rz",-0.6,.4,2),w(2.4,"armR.rz",.6,.4,2),N(2.4,{"foreArmL.rx":1.1,"foreArmR.rx":1.1}),w(2.4,"shinL.rx",-0.2,.2,2),w(2.4,"shinR.rx",-0.2,.2,2,ht))},danceDisco:{label:"\u0422\u0430\u043D\u0435\u0446 \xAB\u0414\u0438\u0441\u043A\u043E\xBB",en:"Disco dance",duration:2,loop:true,emotion:"cool",tracks:{"armR.rz":S(2,[[0,2.6],[.25,.2],[.5,2.6],[.75,.2],[1,2.6]]),"armR.rx":S(2,[[0,.6],[.25,.9],[.5,.6],[.75,.9],[1,.6]]),"armL.rz":Je(2,-0.3),"armL.rx":Je(2,.4),"foreArmL.rx":Je(2,1.3),"body.ry":S(2,[[0,.3],[.25,-0.2],[.5,.3],[.75,-0.2],[1,.3]]),"root.py":S(2,[[0,0],[.125,-0.8],[.25,0],[.375,-0.8],[.5,0],[.625,-0.8],[.75,0],[.875,-0.8],[1,0]]),"legL.rz":S(2,[[0,0],[.25,-0.2],[.5,0],[.75,-0.2],[1,0]])}},danceWave:{label:"\u0422\u0430\u043D\u0435\u0446 \xAB\u0412\u043E\u043B\u043D\u0430\xBB",en:"Wave dance",duration:2,loop:true,emotion:"happy",tracks:O(w(2,"armL.rz",-1.57,.35,2,0),w(2,"foreArmL.rz",0,.6,2,.8),w(2,"armR.rz",1.57,-0.35,2,1.6),w(2,"foreArmR.rz",0,-0.6,2,2.4),w(2,"body.rz",0,.08,2,1.2),w(2,"head.rz",0,.12,2,2),w(2,"root.py",-0.4,.4,4))}};var Lr=Math.PI,xo={wave:{label:"\u041F\u043E\u043C\u0430\u0445\u0430\u0442\u044C",duration:2,emotion:"happy",tracks:{"armR.rz":[[0,0],[.25,2.7],[.5,2.3],[.75,2.8],[1,2.3],[1.25,2.8],[1.5,2.4],[2,0]],"armR.rx":[[0,0],[.25,.2],[1.75,.2],[2,0]],"head.rz":[[0,0],[.5,.1],[1.5,.1],[2,0]]}},cheer:{label:"\u0423\u0440\u0430!",duration:1.6,emotion:"happy",tracks:{"armL.rz":[[0,0],[.25,-2.8],[1.35,-2.8],[1.6,0]],"armR.rz":[[0,0],[.25,2.8],[1.35,2.8],[1.6,0]],"root.py":[[0,0],[.3,3],[.55,0],[.8,3],[1.05,0]]}},dance:{label:"\u0422\u0430\u043D\u0435\u0446",duration:2,loop:true,emotion:"happy",tracks:{"root.ry":[[0,.3],[.5,-0.3],[1,.3],[1.5,-0.3],[2,.3]],"armL.rz":[[0,-0.4],[.5,-2.4],[1,-0.4],[1.5,-2.4],[2,-0.4]],"armR.rz":[[0,2.4],[.5,.4],[1,2.4],[1.5,.4],[2,2.4]],"legL.rx":[[0,0],[.5,.5],[1,0],[2,0]],"legR.rx":[[0,0],[1,0],[1.5,.5],[2,0]],"root.py":[[0,0],[.25,1.5],[.5,0],[.75,1.5],[1,0],[1.25,1.5],[1.5,0],[1.75,1.5],[2,0]],"tail.ry":[[0,.6],[.5,-0.6],[1,.6],[1.5,-0.6],[2,.6]]}},point:{label:"\u0423\u043A\u0430\u0437\u0430\u0442\u044C",duration:1.6,tracks:{"armR.rx":[[0,0],[.2,1.55],[1.4,1.55],[1.6,0]]}},laugh:{label:"\u0421\u043C\u0435\u0445",duration:1.6,emotion:"happy",tracks:{"body.rx":[[0,0],[.2,.15],[.4,.05],[.6,.15],[.8,.05],[1,.15],[1.2,.05],[1.6,0]],"head.rx":[[0,0],[.2,.3],[1.4,.3],[1.6,0]],"armL.rx":[[0,0],[.2,.5],[1.4,.5],[1.6,0]],"armR.rx":[[0,0],[.2,.5],[1.4,.5],[1.6,0]]}},cry:{label:"\u041F\u043B\u0430\u043A\u0430\u0442\u044C",duration:2.4,emotion:"sad",tracks:{"head.rx":[[0,0],[.3,-0.4],[2.1,-0.4],[2.4,0]],"head.rz":[[0,0],[.6,.08],[.9,-0.08],[1.2,.08],[1.5,-0.08],[2.4,0]],"armR.rx":[[0,0],[.3,2.3],[2.1,2.3],[2.4,0]],"armR.ry":[[0,0],[.3,-0.6],[2.1,-0.6],[2.4,0]],"armL.rx":[[0,0],[.3,2.3],[2.1,2.3],[2.4,0]],"armL.ry":[[0,0],[.3,.6],[2.1,.6],[2.4,0]]}},bow:{label:"\u041F\u043E\u043A\u043B\u043E\u043D",duration:1.4,tracks:{"body.rx":[[0,0],[.4,-0.7],[1,-0.7],[1.4,0]],"armR.rx":[[0,0],[.4,.5],[1,.5],[1.4,0]]}},shrug:{label:"\u041F\u043E\u0436\u0430\u0442\u044C \u043F\u043B\u0435\u0447\u0430\u043C\u0438",duration:1.2,tracks:{"armL.rz":[[0,0],[.3,-0.5],[.9,-0.5],[1.2,0]],"armR.rz":[[0,0],[.3,.5],[.9,.5],[1.2,0]],"armL.rx":[[0,0],[.3,.6],[.9,.6],[1.2,0]],"armR.rx":[[0,0],[.3,.6],[.9,.6],[1.2,0]],"head.rz":[[0,0],[.3,.25],[.9,.25],[1.2,0]]}},facepalm:{label:"\u0420\u0443\u043A\u0430-\u043B\u0438\u0446\u043E",duration:1.6,emotion:"tired",tracks:{"armR.rx":[[0,0],[.3,2.5],[1.3,2.5],[1.6,0]],"armR.rz":[[0,0],[.3,-0.4],[1.3,-0.4],[1.6,0]],"head.rx":[[0,0],[.3,-0.35],[1.3,-0.35],[1.6,0]]}},sit:{label:"\u0421\u0435\u0441\u0442\u044C",duration:1,loop:true,tracks:{"legL.rx":[[0,Lr*.46],[1,Lr*.46]],"legR.rx":[[0,Lr*.46],[1,Lr*.46]],"root.py":[[0,-10],[1,-10]]}}},Ne={...xo,...ia,...sa},Ql=[...Object.keys(xo),...Object.keys(ia)],ec=Object.keys(sa),tc=Object.keys(Ne);function Ro(e){return typeof e=="string"&&Object.prototype.hasOwnProperty.call(Ne,e)}function rc(e,t){let r=Ne[e];return t?r.label:r.en??e}function mi(e,t){let r=e[0];if(t<=r[0])return r[1];for(let a=1;a<e.length;a++){let o=e[a];if(t<=o[0]){let n=e[a-1],s=(t-n[0])/Math.max(1e-6,o[0]-n[0]),l=s*s*(3-2*s);return n[1]+(o[1]-n[1])*l}}return e[e.length-1][1]}function Ao(e,t,r){let a=t.loop?r%t.duration:Math.min(r,t.duration);for(let[o,n]of Object.entries(t.tracks)){let s=o.lastIndexOf("."),l=o.slice(0,s),i=o.slice(s+1);i in te&&f(e,l,i,mi(n,a));}}var zt={neutral:["neutral"],happy:["happy","neutral"],sad:["sad","tired","neutral"],angry:["angry","neutral"],surprised:["surprised","scared","neutral"],scared:["scared","surprised","sad","neutral"],tired:["tired","sad","neutral"],hurt:["hurt","angry","sad","neutral"],love:["happy","neutral"],excited:["happy","surprised","neutral"],smug:["happy","neutral"],confused:["surprised","neutral"],embarrassed:["happy","sad","neutral"],silly:["happy","neutral"],cool:["neutral"],disgusted:["angry","sad","neutral"],determined:["angry","neutral"],crying:["sad","tired","neutral"],dizzy:["hurt","tired","neutral"],sleepy:["tired","blink","neutral"],wink:["happy","neutral"]},la={neutral:{add:{},tempo:1},happy:{add:{"head.rx":.08},tempo:1.1},sad:{add:{"head.rx":-0.3,"body.rx":-0.08,"tail.rx":.5},tempo:.8},angry:{add:{"body.rx":-0.12,"head.rx":.1,"armL.rz":-0.1,"armR.rz":.1},tempo:1.1},surprised:{add:{"head.rx":.15,"body.rx":.05},tempo:1},scared:{add:{"body.rx":-0.1,"head.rx":-0.1,"armL.rx":.3,"armR.rx":.3,"tail.rx":.6},tempo:1.3},tired:{add:{"head.rx":-0.35,"body.rx":-0.12},tempo:.7},hurt:{add:{"body.rx":-0.1},tempo:1},love:{add:{"head.rz":.12,"head.rx":.06},tempo:.9},excited:{add:{"head.rx":.12,"body.rx":.04},tempo:1.3},smug:{add:{"head.rx":.14,"head.rz":-0.08},tempo:.9},confused:{add:{"head.rz":.22},tempo:.9},embarrassed:{add:{"head.rx":-0.2,"head.ry":.25,"armL.rx":.15,"armR.rx":.15},tempo:.9},silly:{add:{"head.rz":-0.18},tempo:1.2},cool:{add:{"head.rx":.06,"body.rx":.04},tempo:.85},disgusted:{add:{"head.rx":.1,"head.ry":-0.3,"body.rx":.06},tempo:1},determined:{add:{"body.rx":-0.06,"armL.rz":-0.08,"armR.rz":.08},tempo:1.15},crying:{add:{"head.rx":-0.35,"body.rx":-0.1,"tail.rx":.5},tempo:.75},dizzy:{add:{"head.rz":.15,"body.rz":-0.05},tempo:.8},sleepy:{add:{"head.rx":-0.4,"head.rz":.1,"body.rx":-0.1},tempo:.6},wink:{add:{"head.rz":.1},tempo:1.05}};function ko(e,t,r){if(!(r<=0))for(let[a,o]of Object.entries(la[t].add)){let n=a.lastIndexOf(".");pe(e,a.slice(0,n),a.slice(n+1),(o??0)*r);}}var ic={damaged:{emotion:"hurt",seconds:.8},lowHealth:{emotion:"tired"},nearDeath:{emotion:"scared"},achievement:{emotion:"happy",seconds:3},bossKilled:{emotion:"happy",seconds:5},tamed:{emotion:"happy",seconds:3},traded:{emotion:"happy",seconds:2},petDied:{emotion:"sad",seconds:6},explosion:{emotion:"surprised",seconds:1.5}};function lc(e){let t=[[/(😍|🥰|😘|❤|💕)/u,"love"],[/(🤩|🥳)/u,"excited"],[/(😏)/u,"smug"],[/(😕|🤔|😵‍💫)/u,"confused"],[/(😳|☺)/u,"embarrassed"],[/(😜|😝|😛|:P|:p)/u,"silly"],[/(😎)/u,"cool"],[/(🤢|🤮)/u,"disgusted"],[/(😤|💪)/u,"determined"],[/(😭)/u,"crying"],[/(😵)/u,"dizzy"],[/(😴|💤)/u,"sleepy"],[/(😉|;\))/u,"wink"],[/(>:\(|😠|😡|🤬)/u,"angry"],[/(:'\(|😢)/u,"sad"],[/(:\(|☹|🙁|😞)/u,"sad"],[/(:o|:O|😮|😲)/u,"surprised"],[/(😱|😨)/u,"scared"],[/(-_-|😩|🥱)/u,"tired"],[/(:\)|:D|\^\^|😀|😃|😄|😁|🙂|😊|😂)/u,"happy"]];for(let[r,a]of t)if(r.test(e))return a;return null}var pi=[{state:"dead",when:e=>e.dead,clip:"dead",blend:.25},{state:"sleep",when:e=>e.sleeping,clip:"sleep",blend:.3},{state:"ride",when:e=>e.riding,clip:"ride",blend:.2},{state:"sit",when:e=>e.sitting,clip:"sit",blend:.3},{state:"swim",when:e=>e.inWater&&!e.onGround&&!e.flying,clip:"swim",blend:.3},{state:"glide",when:e=>e.gliding,clip:"glide",blend:.25},{state:"fly",when:e=>e.flying,clip:"fly",blend:.25},{state:"fall",when:(e,t)=>t.airTime>.35&&e.vy<-4,clip:"fall",blend:.2},{state:"sneak",when:e=>e.sneaking,clip:"sneak",blend:.15},{state:"run",when:e=>e.sprinting&&e.speed>3||e.speed>6.5,clip:"run",blend:.15},{state:"walk",when:e=>e.speed>.4,clip:"walk",blend:.15},{state:"idle",when:()=>true,clip:"idle",blend:.2}],di=new Set(["hurt","land"]),hi={eat:"eat",drink:"drink",draw:"draw",block:"block"},ui={tail:(e,t)=>[["ry",-e.yawRate*.25+.12*Math.sin(t*2)],["rx",-(.1+Math.min(e.speed,8)*.06)]],cape:(e,t)=>[["rx",-(.05+Math.min(e.speed,8)*.12)-(e.speed>1?.06*Math.sin(t*9):0)-(e.vy<-3?.4:0)]],hair:e=>[["rx",-Math.min(e.speed,8)*.03]],ear:(e,t)=>[["rz",.08*Math.sin(t*1.3)+Math.min(e.speed,6)*.02]],antenna:(e,t)=>[["rx",.1*Math.sin(t*3)-e.vy*.02]],wingL:(e,t)=>e.flying||e.gliding||!e.onGround&&!e.inWater?[["rz",e.gliding?-0.05:-0.7*Math.sin(t*12)]]:[["rz",1.1+.05*Math.sin(t*1.5)]],wingR:(e,t)=>e.flying||e.gliding||!e.onGround&&!e.inWater?[["rz",e.gliding?.05:.7*Math.sin(t*12)]]:[["rz",-1.1-.05*Math.sin(t*1.5)]]},Mr=e=>{let t=Math.max(0,Math.min(1,e));return t*t*(3-2*t)},Cr=class{rig;style;faces;pose=new Map;expression="neutral";state="idle";stateT=0;clock=0;phase=0;airTime=0;wasOnGround=true;loco=new Map;from=new Map;lastLoco=new Map;blendT=1;blendDur=.2;tmp=new Map;actions=[];useClip=null;useW=0;emote=null;mood="neutral";moodOverGestures=false;flash=null;postureW=new Map;blinkT=3;blinking=0;talkT=0;springs=new Map;constructor(t,r,a=[]){this.rig=t,this.style=ra(r),this.faces=new Set(a);}setRandom(t){this.random=t;}random=Math.random;setStyle(t){this.style=ra(t);}setEmotion(t,r){r&&r>0?this.flash={emotion:t,left:r}:this.mood=t;}get emotion(){return this.emote?.def.emotion&&!this.moodOverGestures?this.emote.def.emotion:this.flash?.emotion??this.mood}get emoting(){return this.emote?.id??null}playEmote(t){this.emote={id:t,def:Ne[t],t:0};}stopEmote(){this.emote=null;}trigger(t){switch(t){case "swing":case "place":case "throw":case "hurt":case "land":{let r=t;this.actions=this.actions.filter(a=>a.clip!==r),this.actions.push({clip:r,t:0,dur:uo[r]??.3}),t==="hurt"&&this.setEmotion("hurt",.8);break}}}update(t,r=Ar()){t=Math.min(t,.1),this.clock+=t;let a=this.emotion,o=la[a].tempo*this.style.tempo;!r.onGround&&!r.inWater?this.airTime+=t:(!this.wasOnGround&&this.airTime>.3&&r.onGround&&this.trigger("land"),this.airTime=0),this.wasOnGround=r.onGround,this.phase+=r.speed*t*3.5*o;let n=pi.find(d=>d.when(r,this));n.state!==this.state&&(Rr(this.from,this.lastLoco),this.state=n.state,this.stateT=0,this.blendT=0,this.blendDur=n.blend),this.stateT+=t,pt(this.loco);let s=ho[this.rig]?.[n.clip]??n.clip,l={t:this.stateT,k:0,phase:this.phase,input:r,style:this.style,clock:this.clock*o};if(Er[s](this.loco,l),pt(this.pose),this.blendT<this.blendDur?(this.blendT+=t,lo(this.pose,this.from,this.loco,Mr(this.blendT/this.blendDur))):Rr(this.pose,this.loco),Rr(this.lastLoco,this.pose),this.emote){let d=this.emote;if(d.t+=t,(d.def.layer==="upper"?!(this.state==="idle"||this.state==="walk"||this.state==="run"||this.state==="sneak"):r.speed>1||this.state!=="idle")||!d.def.loop&&d.t>=d.def.duration)this.emote=null;else {let m=d.def.loop?Mr(d.t/.15):Mr(Math.min(d.t/.15,(d.def.duration-d.t)/.15));pt(this.tmp),Ao(this.tmp,d.def,d.t),this.overlay(this.tmp,m,false);}}let i=r.use?hi[r.use]:null;i&&(this.useClip=i),this.useW=Math.max(0,Math.min(1,this.useW+(i?t:-t)*8)),this.useClip&&this.useW>0?(pt(this.tmp),Er[this.useClip](this.tmp,{...l,t:this.clock}),this.overlay(this.tmp,Mr(this.useW),false)):r.held!=="none"&&!this.emote&&pe(this.pose,"armR","rx",r.held==="staff"?.35:.2);for(let d of this.actions){d.t+=t;let c=Math.min(1,d.t/d.dur);pt(this.tmp),Er[d.clip](this.tmp,{...l,t:d.t,k:c}),this.overlay(this.tmp,1,di.has(d.clip));}this.actions=this.actions.filter(d=>d.t<d.dur),this.state!=="dead"&&this.state!=="sleep"&&(pe(this.pose,"head","ry",Math.max(-1.1,Math.min(1.1,r.lookYaw))),pe(this.pose,"head","rx",Math.max(-1.2,Math.min(1.2,r.lookPitch)))),this.flash&&(this.flash.left-=t)<=0&&(this.flash=null);for(let d of b$1){let c=this.postureW.get(d)??0,h=c+((d===a?1:0)-c)*Math.min(1,t*6);this.postureW.set(d,h),this.state!=="dead"&&ko(this.pose,d,h);}for(let[d,c]of Object.entries(ui))for(let[h,p]of c(r,this.clock)){let m=d+"."+h,g=this.springs.get(m);g||this.springs.set(m,g={x:p,v:0});let b=60,v=9;g.v+=(b*(p-g.x)-v*g.v)*t,g.x+=g.v*t,pe(this.pose,d,h,g.x);}return this.expression=this.face(r,t,a),this.pose}overlay(t,r,a){for(let[o,n]of t){let s=Ct(this.pose,o);for(let l=0;l<9;l++)a?l>=te.sx?s[l]=s[l]*(1+(n[l]-1)*r):s[l]=s[l]+(n[l]-Mt[l])*r:s[l]=s[l]+(n[l]-s[l])*r;}}face(t,r,a){let o=s=>s.find(l=>this.faces.has(l))??"neutral";if(t.dead||this.state==="dead"||t.sleeping)return o(["blink","hurt","neutral"]);let n=o(zt[a]);return t.viseme!==void 0?(this.talkT=0,t.viseme!=="rest"&&t.viseme!=="MBP"?o(["talk",n]):n):t.talk?(this.talkT+=r,Math.floor(this.talkT/.12)%2===0?o(["talk",n]):n):(this.talkT=0,this.blinking>0?(this.blinking-=r,o(["blink",n])):(this.blinkT-=r,this.blinkT<=0&&(this.blinkT=2.5+this.random()*3,a!=="surprised"&&a!=="scared"&&a!=="hurt"&&(this.blinking=.13)),n))}};var Me="voxel-v1",ft=1,bt=["hair","top","bottom","shoes","hands","waist","back","neck","faceAcc","hat"],pa=["head","torso","sleeveL","sleeveR","forearmL","forearmR","handL","handR","legL","legR","footL","footR"],da={sleeves:["sleeveL","sleeveR"],forearms:["forearmL","forearmR"],arms:["sleeveL","sleeveR","forearmL","forearmR"],hands:["handL","handR"],legs:["legL","legR"],feet:["footL","footR"]},ut="@skin",ha={hair:{bones:["head"],paint:["head"],paintFaces:["top","back","left","right"],parts:8,box:{min:[-6,22,-6],max:[6,35.5,6]}},hat:{bones:["head"],paint:[],parts:8,box:{min:[-7,21,-8],max:[7,38,7]}},top:{bones:["body","armL","armR","foreArmL","foreArmR"],paint:["torso","sleeveL","sleeveR","forearmL","forearmR"],parts:6,box:{min:[-10,9.5,-6],max:[10,26,6]}},bottom:{bones:["body","legL","legR","shinL","shinR"],paint:["legL","legR"],parts:4,box:{min:[-6.5,.5,-4.5],max:[6.5,17,4.5]}},shoes:{bones:["legL","legR","shinL","shinR"],paint:["footL","footR"],parts:4,box:{min:[-5.5,-0.5,-4.5],max:[5.5,7,4]}},hands:{bones:["armL","armR","foreArmL","foreArmR"],paint:["handL","handR"],parts:2,box:{min:[-10,9.5,-4],max:[10,16,4]}},waist:{bones:["body"],paint:[],parts:4,box:{min:[-7,9.5,-4],max:[7,16.5,4]}},back:{bones:["body"],paint:[],parts:8,box:{min:[-13.5,6,1.5],max:[13.5,36.5,13]}},faceAcc:{bones:["head"],paint:[],parts:8,box:{min:[-6,21,-6.5],max:[6,30.5,5]}},neck:{bones:["body"],paint:[],parts:6,box:{min:[-6,15,-4.5],max:[6,24.5,4.5]}}},yt={palette:5,textures:4,textureSide:32,texturePixels:2048,id:40,textureId:12,name:40},Zt=["round","sparkle","wide","cat","sleepy","dot","anime","almond","button","narrow","starry","glam"],Qt=["soft","thick","arched","none","straight","angled","bushy","thin"],er=["smile","grin","cat","small","smirk","open","teeth","fang","tongue","pout"],tr=["none","freckles","mole","scar","plaster","whiskers","star"],rr=["block","round"],ua="round",fa=Ut,ba=qt,Qe={walk:"bouncy",idle:"calm"},et=[.5,1.8,7.5,5.4],fi={eyes:"round",eyeColor:"#3b2a20",brows:"soft",browColor:"#3b2a20",mouth:"smile",cheeks:true,marks:"none",emotion:"neutral"},Jt={min:.9,max:1.1},Ze=(e,t,r)=>typeof e=="string"&&t.includes(e)?e:r,ma=e=>typeof e=="string"&&bt.includes(e);function Pt(e){let t=$(e)?e:{},r=$(t.body)?t.body:{},a=$(t.face)?t.face:{},o=$(t.anim)?t.anim:{},n=fi,s={};if($(t.wear))for(let[i,d]of Object.entries(t.wear))ma(i)&&typeof d=="string"&&d.trim()&&(s[i]=d.trim().slice(0,yt.id));let l={};if($(t.tint))for(let[i,d]of Object.entries(t.tint)){let c=je(d);ma(i)&&c&&(l[i]=c);}return {version:ft,style:Me,body:{skin:je(r.skin)??"#f2c9a0",height:Math.round(ke(r.height,1,Jt.min,Jt.max)*1e3)/1e3,head:Ze(r.head,rr,ua)},face:{eyes:Ze(a.eyes,Zt,n.eyes),eyeColor:je(a.eyeColor)??n.eyeColor,brows:Ze(a.brows,Qt,n.brows),browColor:je(a.browColor)??n.browColor,mouth:Ze(a.mouth,er,n.mouth),cheeks:typeof a.cheeks=="boolean"?a.cheeks:n.cheeks,marks:Ze(a.marks,tr,"none"),emotion:Ze(a.emotion,b$1,n.emotion)},anim:{walk:Ze(o.walk,fa,Qe.walk),idle:Ze(o.idle,ba,Qe.idle)},wear:s,tint:l}}var bi=/^[a-z0-9][a-z0-9_.-]*$/,yi=/^[A-Za-z0-9]+$/;function ca(e){return !Array.isArray(e)||e.length!==3?null:e.every(t=>typeof t=="number"&&Number.isFinite(t))?e:null}function gi(e,t){if(!t||t.every(a=>a===0))return [e[0]/2,e[1]/2,e[2]/2];let r=Math.hypot(e[0],e[1],e[2])/2;return [r,r,r]}function It(e){let t=[],r=(M,R,k)=>t.push(c({en:M,ru:R},k));if(!$(e))return {ok:false,errors:[c({en:"the item is not an object",ru:"\u0432\u0435\u0449\u044C: \u043D\u0435 \u043E\u0431\u044A\u0435\u043A\u0442"})]};let a=e,o=yt;a.style!==void 0&&a.style!==Me&&r("style \xAB{s}\xBB is not {need}","\u0441\u0442\u0438\u043B\u044C \xAB{s}\xBB: \u043D\u0435 {need}",{s:String(a.style),need:Me});let n=typeof a.id=="string"?a.id.trim():"";if((!n||n.length>o.id||!bi.test(n))&&r("id must be 1, {n} characters: a-z, 0-9, _ . -","id: 1, {n} \u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432: a-z, 0-9, _ . -",{n:o.id}),!ma(a.slot))return r("unknown slot \xAB{s}\xBB","\u043D\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043D\u044B\u0439 \u0441\u043B\u043E\u0442 \xAB{s}\xBB",{s:String(a.slot)}),{ok:false,errors:t};let s=a.slot,l=ha[s],i=typeof a.name=="string"&&a.name.trim()?a.name.trim().slice(0,o.name):n,d={};if(!$(a.palette)||!Object.keys(a.palette).length)r("the palette is empty","\u043F\u0430\u043B\u0438\u0442\u0440\u0430 \u043F\u0443\u0441\u0442\u0430");else {let M=Object.entries(a.palette);M.length>o.palette&&r("more than {n} colours in the palette","\u0432 \u043F\u0430\u043B\u0438\u0442\u0440\u0435 \u0431\u043E\u043B\u044C\u0448\u0435 {n} \u0446\u0432\u0435\u0442\u043E\u0432",{n:o.palette});for(let[R,k]of M){let y=k===ut?ut:je(k);R.length!==1||Xe.has(R)||!y?r("palette colour \xAB{k}\xBB is not valid","\u0446\u0432\u0435\u0442 \u043F\u0430\u043B\u0438\u0442\u0440\u044B \xAB{k}\xBB \u043D\u0435 \u0433\u043E\u0434\u0438\u0442\u0441\u044F",{k:R}):d[R]=y;}}let c$1=typeof a.tint=="string"&&a.tint?a.tint:null;c$1!==null&&(!d[c$1]||d[c$1]===ut)&&r("tint \xAB{k}\xBB is not a colour of the palette","\u043F\u0435\u0440\u0435\u043A\u0440\u0430\u0441\u043A\u0430 \xAB{k}\xBB: \u043D\u0435 \u0446\u0432\u0435\u0442 \u043F\u0430\u043B\u0438\u0442\u0440\u044B",{k:c$1});let h={},p=0;if(a.textures!==void 0)if(!$(a.textures))r("textures is not an object","textures: \u043D\u0435 \u043E\u0431\u044A\u0435\u043A\u0442");else {let M=Object.entries(a.textures);M.length>o.textures&&r("more than {n} textures","\u0442\u0435\u043A\u0441\u0442\u0443\u0440 \u0431\u043E\u043B\u044C\u0448\u0435 {n}",{n:o.textures});for(let[R,k]of M){if(R.length>o.textureId||!yi.test(R)){r("texture id \xAB{id}\xBB must be 1, {n} letters or digits","id \u0442\u0435\u043A\u0441\u0442\u0443\u0440\u044B \xAB{id}\xBB: 1, {n} \u0431\u0443\u043A\u0432 \u0438\u043B\u0438 \u0446\u0438\u0444\u0440",{id:R.slice(0,20),n:o.textureId});continue}let y=$(k)?k:null,z=y&&Array.isArray(y.rows)?y.rows:null,C=y?y.w:void 0,L=y?y.h:void 0;if(!z||typeof C!="number"||typeof L!="number"||!Number.isInteger(C)||!Number.isInteger(L)||C<1||L<1||C>o.textureSide||L>o.textureSide||z.length!==L||z.some(_=>typeof _!="string"||_.length!==C)){r("texture \xAB{id}\xBB must be w\xD7h \u2264 {n} with exactly h rows of w symbols","\u0442\u0435\u043A\u0441\u0442\u0443\u0440\u0430 \xAB{id}\xBB: w\xD7h \u2264 {n}, \u0440\u043E\u0432\u043D\u043E h \u0441\u0442\u0440\u043E\u043A \u043F\u043E w \u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432",{id:R,n:o.textureSide});continue}z.some(_=>[..._].some(T=>!Xe.has(T)&&!d[T]))&&r("texture \xAB{id}\xBB uses symbols outside the palette","\u0432 \u0442\u0435\u043A\u0441\u0442\u0443\u0440\u0435 \xAB{id}\xBB \u0441\u0438\u043C\u0432\u043E\u043B\u044B \u043D\u0435 \u0438\u0437 \u043F\u0430\u043B\u0438\u0442\u0440\u044B",{id:R}),p+=C*L,h[R]={w:C,h:L,rows:z.map(_=>_.replace(/ /g,"."))};}p>o.texturePixels&&r("textures take {p} pixels, the limit is {n}","\u0442\u0435\u043A\u0441\u0442\u0443\u0440\u044B \u0437\u0430\u043D\u0438\u043C\u0430\u044E\u0442 {p} \u043F\u0438\u043A\u0441\u0435\u043B\u0435\u0439, \u043F\u0440\u0435\u0434\u0435\u043B {n}",{p,n:o.texturePixels});}let m=(M,R)=>typeof M!="string"?null:h[M]||d[M]?M:(r("{w}: \xAB{v}\xBB is neither a texture nor a palette colour","{w}: \xAB{v}\xBB: \u043D\u0438 \u0442\u0435\u043A\u0441\u0442\u0443\u0440\u0430, \u043D\u0438 \u0446\u0432\u0435\u0442 \u043F\u0430\u043B\u0438\u0442\u0440\u044B",{w:R,v:M}),null),g=(M,R,k=Ke)=>{if(M===void 0)return;if(!$(M)){r("{w}: faces is not an object","{w}: faces: \u043D\u0435 \u043E\u0431\u044A\u0435\u043A\u0442",{w:R});return}let y={};for(let[z,C]of Object.entries(M)){if(!Ke.includes(z)){r("{w}: unknown face \xAB{f}\xBB","{w}: \u043D\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043D\u0430\u044F \u0433\u0440\u0430\u043D\u044C \xAB{f}\xBB",{w:R,f:z});continue}if(!k.includes(z)){r("{w}: the {slot} slot may not paint the \xAB{f}\xBB face","{w}: \u0441\u043B\u043E\u0442 {slot} \u043D\u0435 \u043A\u0440\u0430\u0441\u0438\u0442 \u0433\u0440\u0430\u043D\u044C \xAB{f}\xBB",{w:R,slot:s,f:z});continue}let L=m(C,R);L&&(y[z]=L);}return Object.keys(y).length?y:void 0},b=[];a.paint!==void 0&&!Array.isArray(a.paint)&&r("paint is not a list","paint: \u043D\u0435 \u0441\u043F\u0438\u0441\u043E\u043A");for(let[M,R]of (Array.isArray(a.paint)?a.paint:[]).entries()){let k=`paint[${M}]`;if(!$(R)){r("{w} is not an object","{w}: \u043D\u0435 \u043E\u0431\u044A\u0435\u043A\u0442",{w:k});continue}let y=typeof R.region=="string"?R.region:"",z=da[y]??(pa.includes(y)?[y]:[]);if(!z.length){r("{w}: unknown region \xAB{r}\xBB","{w}: \u043D\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043D\u0430\u044F \u043E\u0431\u043B\u0430\u0441\u0442\u044C \xAB{r}\xBB",{w:k,r:y});continue}let C=z.filter(_=>!l.paint.includes(_));if(C.length){r("{w}: the {slot} slot may not paint \xAB{r}\xBB","{w}: \u0441\u043B\u043E\u0442 {slot} \u043D\u0435 \u043A\u0440\u0430\u0441\u0438\u0442 \xAB{r}\xBB",{w:k,slot:s,r:C.join(", ")});continue}let L=typeof R.color=="string"&&d[R.color]?R.color:null;L||r("{w}: colour is not in the palette","{w}: \u0446\u0432\u0435\u0442\u0430 \u043D\u0435\u0442 \u0432 \u043F\u0430\u043B\u0438\u0442\u0440\u0435",{w:k});let I=g(R.faces,k,l.paintFaces);if(L)for(let _ of z){let T={region:_,color:L};I&&(T.faces={...I}),b.push(T);}}let v=[];a.parts!==void 0&&!Array.isArray(a.parts)&&r("parts is not a list","parts: \u043D\u0435 \u0441\u043F\u0438\u0441\u043E\u043A");let E=Array.isArray(a.parts)?a.parts:[];E.length>l.parts&&r("the {slot} slot allows {n} boxes, the item has {m}","\u0441\u043B\u043E\u0442\u0443 {slot} \u043C\u043E\u0436\u043D\u043E {n} \u043A\u043E\u0440\u043E\u0431\u043E\u043A, \u0443 \u0432\u0435\u0449\u0438 {m}",{slot:s,n:l.parts,m:E.length});for(let[M,R]of E.entries()){let k=`parts[${M}]`;if(!$(R)){r("{w} is not an object","{w}: \u043D\u0435 \u043E\u0431\u044A\u0435\u043A\u0442",{w:k});continue}let y=typeof R.bone=="string"?R.bone:"";if(!l.bones.includes(y)){r("{w}: the {slot} slot puts boxes only on {b}","{w}: \u0441\u043B\u043E\u0442 {slot} \u0441\u0442\u0430\u0432\u0438\u0442 \u043A\u043E\u0440\u043E\u0431\u043A\u0438 \u0442\u043E\u043B\u044C\u043A\u043E \u043D\u0430 {b}",{w:k,slot:s,b:l.bones.join(", ")});continue}let z=ca(R.size),C=ca(R.pos);if(!z||!C||z.some(me=>me<=0)){r("{w}: size and pos must be [x, y, z]","{w}: size \u0438 pos: [x, y, z]",{w:k});continue}let L=R.rot===void 0?void 0:ca(R.rot);R.rot!==void 0&&!L&&r("{w}: rot must be [x, y, z]","{w}: rot: [x, y, z]",{w:k});let I=R.mirror===true,_=gi(z,L??void 0),D=(I?[C[0],-C[0]]:[C[0]]).some(me=>me-_[0]<l.box.min[0]-1e-6||me+_[0]>l.box.max[0]+1e-6)||[1,2].some(me=>C[me]-_[me]<l.box.min[me]-1e-6||C[me]+_[me]>l.box.max[me]+1e-6);D&&r("{w}: the box leaves the {slot} slot frame","{w}: \u043A\u043E\u0440\u043E\u0431\u043A\u0430 \u0432\u044B\u0445\u043E\u0434\u0438\u0442 \u0437\u0430 \u0440\u0430\u043C\u043A\u0443 \u0441\u043B\u043E\u0442\u0430 {slot}",{w:k,slot:s});let W=typeof R.color=="string"&&d[R.color]?R.color:null;W||r("{w}: colour is not in the palette","{w}: \u0446\u0432\u0435\u0442\u0430 \u043D\u0435\u0442 \u0432 \u043F\u0430\u043B\u0438\u0442\u0440\u0435",{w:k});let Q=g(R.faces,k),Ee;if(R.mat!==void 0&&(typeof R.mat=="string"&&St.includes(R.mat)?Ee=R.mat:r("{w}: material \xAB{m}\xBB is not {list}","{w}: \u043C\u0430\u0442\u0435\u0440\u0438\u0430\u043B \xAB{m}\xBB: \u043D\u0435 {list}",{w:k,m:String(R.mat),list:St.join(", ")})),!W||D)continue;let ue={bone:y,size:[...z],pos:[...C],color:W};Q&&(ue.faces=Q),L&&L.some(me=>me!==0)&&(ue.rot=[...L]),I&&(ue.mirror=true),typeof R.name=="string"&&R.name.trim()&&(ue.name=R.name.trim().slice(0,24)),Ee&&(ue.mat=Ee),v.push(ue);}return !E.length&&!(Array.isArray(a.paint)&&a.paint.length)&&r("the item neither paints nor adds anything","\u0432\u0435\u0449\u044C \u043D\u0438\u0447\u0435\u0433\u043E \u043D\u0435 \u043A\u0440\u0430\u0441\u0438\u0442 \u0438 \u043D\u0435 \u0434\u043E\u0431\u0430\u0432\u043B\u044F\u0435\u0442"),t.length?{ok:false,errors:t}:{ok:true,item:{version:ft,style:Me,id:n,slot:s,name:i,palette:d,tint:c$1,textures:h,paint:b,parts:v}}}var Se="#2b2140",Be="#7a2e2e",gt="#e8707a",wi={neutral:{eye:"open",iris:1,white:1,lidOuter:0,lidInner:0,browUp:0,browInner:0,tear:false},happy:{eye:"happy",iris:1,white:1,lidOuter:0,lidInner:0,browUp:.04,browInner:0,tear:false},sad:{eye:"open",iris:1,white:1,lidOuter:.38,lidInner:.12,browUp:0,browInner:.09,tear:true},angry:{eye:"open",iris:.9,white:.95,lidOuter:.1,lidInner:.42,browUp:-0.02,browInner:-0.1,tear:false},surprised:{eye:"open",iris:.55,white:1.15,lidOuter:0,lidInner:0,browUp:.1,browInner:0,tear:false},scared:{eye:"open",iris:.42,white:1.08,lidOuter:0,lidInner:0,browUp:.08,browInner:.07,tear:false},tired:{eye:"open",iris:1,white:1,lidOuter:.5,lidInner:.5,browUp:-0.02,browInner:-0.02,tear:false},hurt:{eye:"hurt",iris:1,white:1,lidOuter:0,lidInner:0,browUp:0,browInner:-0.07,tear:false},love:{eye:"heart",iris:1,white:1,lidOuter:0,lidInner:0,browUp:.05,browInner:.03,tear:false,blush:.6},excited:{eye:"star",iris:1,white:1,lidOuter:0,lidInner:0,browUp:.09,browInner:0,tear:false},smug:{eye:"open",iris:.95,white:1,lidOuter:.42,lidInner:.36,browUp:0,browInner:-0.03,tear:false,look:.25,browTilt:.06},confused:{eye:"open",iris:.8,white:1.05,lidOuter:0,lidInner:0,browUp:.03,browInner:.04,tear:false,browTilt:.1,sweat:true},embarrassed:{eye:"happy",iris:1,white:1,lidOuter:0,lidInner:0,browUp:.02,browInner:.08,tear:false,blush:1,sweat:true},silly:{eye:"happy",iris:1,white:1,lidOuter:0,lidInner:0,browUp:.06,browInner:0,tear:false,wink:true},cool:{eye:"open",iris:.9,white:1,lidOuter:.38,lidInner:.38,browUp:-0.01,browInner:-0.02,tear:false},disgusted:{eye:"open",iris:.85,white:.95,lidOuter:.3,lidInner:.45,browUp:-0.02,browInner:-0.08,tear:false,look:-0.3},determined:{eye:"open",iris:1,white:1,lidOuter:.15,lidInner:.34,browUp:-0.01,browInner:-0.12,tear:false},crying:{eye:"closed",iris:1,white:1,lidOuter:0,lidInner:0,browUp:.02,browInner:.12,tear:false,stream:true},dizzy:{eye:"spiral",iris:1,white:1,lidOuter:0,lidInner:0,browUp:.04,browInner:.05,tear:false},sleepy:{eye:"closed",iris:1,white:1,lidOuter:0,lidInner:0,browUp:-0.02,browInner:0,tear:false,zzz:true},wink:{eye:"open",iris:1,white:1,lidOuter:0,lidInner:0,browUp:.04,browInner:0,tear:false,wink:true}};function ya(e,t,r,a,o,n="neutral"){let s=o==="blink"||o==="talk"?n==="blink"||n==="talk"?"neutral":n:o,l=wi[s];e.clearRect(0,0,t,r),e.lineCap="round",e.lineJoin="round";let i=r*.5,d=t*.105,c=r*.2,h=o==="blink"?"closed":l.eye;if(a.cheeks&&s!=="scared"&&(e.fillStyle=s==="happy"?"rgba(236,110,140,0.5)":"rgba(236,120,140,0.32)",H(e,t*.12,r*.8,t*.07,r*.075),e.fill(),H(e,t*.88,r*.8,t*.07,r*.075),e.fill()),l.blush){e.fillStyle=`rgba(236,90,120,${.35*l.blush})`,H(e,t*.13,r*.8,t*.085,r*.09),e.fill(),H(e,t*.87,r*.8,t*.085,r*.09),e.fill(),e.strokeStyle=`rgba(200,60,90,${.7*l.blush})`,e.lineWidth=t*.008;for(let p of [t*.13,t*.87])for(let m=-1;m<=1;m++)e.beginPath(),e.moveTo(p+m*t*.025-t*.01,r*.84),e.lineTo(p+m*t*.025+t*.01,r*.76),e.stroke();}xi(e,t,r,a);for(let p of [-1,1]){let m=t*(.5+p*.22),g=l.wink&&p===1&&h!=="closed"?"happy":h;Ai(e,m,i,d,c,p,a,g,l);let b=(l.browTilt??0)*(p===1?1:-0.4);ki(e,m,i-c-r*.07-r*b,t,r,p,a,l);}if(l.stream&&o!=="blink"){e.fillStyle="rgba(133,183,235,0.85)";for(let p of [-1,1]){let m=t*(.5+p*.22);e.beginPath(),e.moveTo(m-t*.03,i+c*.35),e.quadraticCurveTo(m-t*.045,r*.8,m-t*.025,r),e.lineTo(m+t*.025,r),e.quadraticCurveTo(m+t*.04,r*.8,m+t*.03,i+c*.35),e.closePath(),e.fill();}}if(l.sweat){e.fillStyle="#9fd3f5";let p=t*.95,m=r*.2;e.beginPath(),e.moveTo(p,m-r*.09),e.quadraticCurveTo(p+t*.035,m+r*.02,p,m+r*.05),e.quadraticCurveTo(p-t*.035,m+r*.02,p,m-r*.09),e.fill();}if(l.zzz){e.strokeStyle=Se,e.lineWidth=t*.012;let p=(m,g,b)=>{e.beginPath(),e.moveTo(m,g),e.lineTo(m+b,g),e.lineTo(m,g+b),e.lineTo(m+b,g+b),e.stroke();};p(t*.8,r*.12,t*.05),p(t*.88,r*.02,t*.035);}if(l.tear&&h==="open"){e.fillStyle="#85b7eb";let p=t*.5-t*.22-d*.6,m=i+c*1.05;e.beginPath(),e.moveTo(p,m-r*.07),e.quadraticCurveTo(p+t*.03,m,p,m+r*.04),e.quadraticCurveTo(p-t*.03,m,p,m-r*.07),e.fill();}Si(e,t*.5,r*.86,t,r,a,o==="talk"?"talk":s);}function xi(e,t,r,a){let o=a.marks;if(!(!o||o==="none"))switch(o){case "freckles":{e.fillStyle="rgba(150,90,50,0.55)";let n=[[.08,.7],[.13,.66],[.18,.71],[.11,.76],[.16,.78],[.92,.7],[.87,.66],[.82,.71],[.89,.76],[.84,.78]];for(let[s,l]of n)H(e,t*s,r*l,t*.009,t*.009),e.fill();return}case "mole":e.fillStyle="#4a2e22",H(e,t*.64,r*.82,t*.011,t*.011),e.fill();return;case "scar":{e.strokeStyle="rgba(150,60,60,0.75)",e.lineWidth=t*.012,e.beginPath(),e.moveTo(t*.2,r*.12),e.lineTo(t*.32,r*.78),e.stroke(),e.lineWidth=t*.007;for(let n=1;n<=4;n++){let s=n/5,l=t*(.2+.12*s),i=r*(.12+.66*s);e.beginPath(),e.moveTo(l-t*.025,i+r*.005),e.lineTo(l+t*.025,i-r*.005),e.stroke();}return}case "plaster":{e.save(),e.translate(t*.84,r*.74),e.rotate(-0.5),e.fillStyle="#f1d3a8",e.fillRect(-t*.07,-r*.04,t*.14,r*.08),e.fillStyle="#e3b98a",e.fillRect(-t*.025,-r*.04,t*.05,r*.08),e.restore();return}case "whiskers":{e.strokeStyle=Se,e.lineWidth=t*.008;for(let n of [-1,1])for(let s of [-0.04,0,.04])e.beginPath(),e.moveTo(t*(.5+n*.24),r*(.78+s)),e.lineTo(t*(.5+n*.42),r*(.75+s*1.8)),e.stroke();return}case "star":zr(e,t*.84,r*.74,t*.045),e.fillStyle="#f2c14e",e.fill();return}}function Ri(e,t,r,a){e.beginPath(),e.moveTo(t,r+a*.9),e.bezierCurveTo(t-a*1.4,r-a*.1,t-a*.7,r-a*1.1,t,r-a*.4),e.bezierCurveTo(t+a*.7,r-a*1.1,t+a*1.4,r-a*.1,t,r+a*.9),e.closePath();}function H(e,t,r,a,o){e.beginPath(),e.ellipse(t,r,Math.max(.1,a),Math.max(.1,o),0,0,Math.PI*2);}function Ai(e,t,r,a,o,n,s,l,i){let d=a*.26;if(e.strokeStyle=Se,e.lineWidth=d,l==="closed"){e.beginPath(),e.moveTo(t-a,r+o*.1),e.quadraticCurveTo(t,r+o*.55,t+a,r+o*.1),e.stroke(),s.eyes==="wide"&&So(e,t,r+o*.15,a,o*.3,n,d);return}if(l==="happy"){e.lineWidth=d*1.2,e.beginPath(),e.moveTo(t-a,r+o*.35),e.quadraticCurveTo(t,r-o*.75,t+a,r+o*.35),e.stroke();return}if(l==="heart"){Ri(e,t,r,a*1.05),e.fillStyle="#e8436b",e.fill(),e.fillStyle="rgba(255,255,255,0.8)",H(e,t-a*.38,r-o*.25,a*.2,a*.16),e.fill();return}if(l==="star"){zr(e,t,r,Math.min(a,o)*1.15),e.fillStyle="#f2c14e",e.fill(),e.lineWidth=d*.6,e.stroke();return}if(l==="spiral"){e.lineWidth=d*.9,e.beginPath();for(let _=0;_<=36;_++){let T=_/36*Math.PI*4*n,D=_/36*Math.min(a,o)*.95,W=t+Math.cos(T)*D,Q=r+Math.sin(T)*D;_?e.lineTo(W,Q):e.moveTo(W,Q);}e.stroke();return}if(l==="hurt"){let _=t-n*a*.6,T=t+n*a*.8;e.lineWidth=d*1.2,e.beginPath(),e.moveTo(T,r-o*.55),e.lineTo(_,r),e.lineTo(T,r+o*.55),e.stroke();return}let c=s.eyes==="anime"?1.12:s.eyes==="narrow"?1.15:1,h=s.eyes==="anime"?1.25:s.eyes==="narrow"?.55:1,p=a*i.white*c,m=o*i.white*h,g=s.eyes==="sleepy"?.32:0,b=Math.max(i.lidOuter,g),v=Math.max(i.lidInner,g),E=r-m,M=t+n*(p+d),R=t-n*(p+d),k=E+2*m*b,y=E+2*m*v,z=b>0||v>0;e.save(),z&&(e.beginPath(),e.moveTo(M,k),e.lineTo(R,y),e.lineTo(R,r+m*2),e.lineTo(M,r+m*2),e.closePath(),e.clip());let C=Math.min(p,m)*.8*i.iris*(s.eyes==="narrow"?1.5:1),L=r+m*.12,I=(i.look??0)*p*.45;switch(s.eyes){case "button":{e.fillStyle=Se,H(e,t+I,r+m*.05,p*.72,m*.8),e.fill(),e.fillStyle="#ffffff",H(e,t+I-p*.28,r-m*.25,p*.2,p*.2),e.fill(),H(e,t+I+p*.25,r+m*.3,p*.09,p*.09),e.fill();break}case "almond":{e.fillStyle="#ffffff",_t(e,t,r,p*1.05,m*.8,n),e.fill(),e.save(),_t(e,t,r,p*1.05,m*.8,n),e.clip(),e.fillStyle=s.eyeColor,H(e,t+I,L,C*1.05,C*1.05),e.fill(),e.fillStyle=Se,H(e,t+I,L,C*.5,C*.5),e.fill(),e.fillStyle="#ffffff",H(e,t+I-C*.38,L-C*.4,C*.28,C*.28),e.fill(),e.restore(),e.strokeStyle=Se,e.lineWidth=d*1.1,_t(e,t,r,p*1.05,m*.8,n),e.stroke();break}case "anime":case "starry":case "glam":case "narrow":{e.fillStyle="#ffffff",H(e,t,r,p,m),e.fill(),e.save(),H(e,t,r,p,m),e.clip();let _=s.eyes==="anime"?1.3:s.eyes==="narrow"?1:1.12,T=C*_,D=t+I;e.fillStyle=s.eyeColor,H(e,D,L,T*.95,T*(s.eyes==="anime"?1.25:1)),e.fill(),e.fillStyle="rgba(255,255,255,0.22)",H(e,D,L+T*.5,T*.7,T*.45),e.fill(),s.eyes==="starry"?(zr(e,D,L,T*.62),e.fillStyle="#fff3b0",e.fill()):(e.fillStyle=Se,H(e,D,L,T*.46,T*(s.eyes==="anime"?.62:.5)),e.fill()),e.fillStyle="#ffffff",H(e,D-T*.38,L-T*.45,T*(s.eyes==="anime"?.38:.3),T*.3),e.fill(),H(e,D+T*.4,L+T*.4,T*.16,T*.16),e.fill(),e.restore(),e.strokeStyle=Se,e.lineWidth=s.eyes==="anime"||s.eyes==="glam"?d*1.6:d,e.beginPath(),e.ellipse(t,r,p,m,0,Math.PI*1.05,Math.PI*1.95),e.stroke(),s.eyes==="glam"&&(e.beginPath(),e.moveTo(t+n*p*.85,r-m*.45),e.lineTo(t+n*p*1.45,r-m*.95),e.stroke());break}case "dot":{e.fillStyle=Se,H(e,t+I,r+m*.1,p*.55,m*.72),e.fill(),e.fillStyle="#ffffff",H(e,t+I-p*.18,r-m*.18,p*.17,p*.17),e.fill();break}case "cat":{e.fillStyle="#ffffff",_t(e,t,r,p*1.08,m*.85,n),e.fill(),e.save(),_t(e,t,r,p*1.08,m*.85,n),e.clip(),e.fillStyle=s.eyeColor,H(e,t,L,C*1.05,C*1.2),e.fill(),e.fillStyle=Se,H(e,t,L,C*.22*(i.iris<1?1.5:1),C*.95),e.fill(),e.fillStyle="#ffffff",H(e,t-C*.4,L-C*.45,C*.25,C*.25),e.fill(),e.restore(),e.strokeStyle=Se,e.lineWidth=d,_t(e,t,r,p*1.08,m*.85,n),e.stroke();break}default:{let _=s.eyes==="sparkle"||s.eyes==="wide";e.fillStyle="#ffffff",H(e,t,r,p,m),e.fill(),e.save(),H(e,t,r,p,m),e.clip();let T=_?C*1.18:C;e.fillStyle=s.eyeColor,H(e,t+I,L,T*.95,T*(s.eyes==="sparkle"?1.15:1)),e.fill(),e.fillStyle="rgba(255,255,255,0.18)",H(e,t+I,L+T*.45,T*.7,T*.45),e.fill(),e.fillStyle=Se,H(e,t+I,L,T*.48,T*.52),e.fill(),e.fillStyle="#ffffff",H(e,t+I-T*.38,L-T*.42,T*.32,T*.32),e.fill(),H(e,t+I+T*.38,L+T*.38,T*.14,T*.14),e.fill(),s.eyes==="sparkle"&&(zr(e,t+I+T*.3,L-T*.55,T*.22),e.fill()),e.restore(),e.strokeStyle=Se,e.lineWidth=d,e.beginPath(),e.ellipse(t,r,p,m,0,Math.PI*1.08,Math.PI*1.92),e.stroke();break}}if(e.restore(),z){e.strokeStyle=Se,e.lineWidth=d;let _=Q=>(Q-M)/(R-M),T=Q=>k+(y-k)*_(Q),D=t-p*.95,W=t+p*.95;e.beginPath(),e.moveTo(D,T(D)),e.lineTo(W,T(W)),e.stroke();}(s.eyes==="wide"||s.eyes==="glam")&&So(e,t,r-m*.55,p,m*.45,n,d);}function _t(e,t,r,a,o,n){let s=t+n*a,l=t-n*a;e.beginPath(),e.moveTo(l,r+o*.15),e.quadraticCurveTo(t,r-o*1.5,s,r-o*.35),e.quadraticCurveTo(t,r+o*1.4,l,r+o*.15),e.closePath();}function So(e,t,r,a,o,n,s){e.lineWidth=s*.8;let l=t+n*a;for(let i=0;i<2;i++){let d=r+i*o*.6;e.beginPath(),e.moveTo(l-n*a*.1,d),e.lineTo(l+n*a*.35,d-o*(.7-i*.2)),e.stroke();}}function zr(e,t,r,a){e.beginPath();for(let o=0;o<8;o++){let n=o%2?a*.35:a,s=o*Math.PI/4-Math.PI/2,l=t+Math.cos(s)*n,i=r+Math.sin(s)*n;o?e.lineTo(l,i):e.moveTo(l,i);}e.closePath(),e.fillStyle="#ffffff";}function ki(e,t,r,a,o,n,s,l){if(s.brows==="none")return;let i=a*.095,d=r-o*l.browUp,c=t-n*i,h=t+n*i,p=d-o*l.browInner,m=d+o*l.browInner*.3;if(e.strokeStyle=s.browColor,e.fillStyle=s.browColor,s.brows==="bushy"){let b=o*.085;e.beginPath(),e.moveTo(h+n*a*.01,m+b*.2),e.quadraticCurveTo(t,Math.min(m,p)-b*.9,c,p-b*.1),e.lineTo(c,p+b*.8);for(let v=1;v<=4;v++){let E=c+(h-c)*v/4;e.lineTo(E-n*a*.01,p+(m-p)*(v/4)+b*(v%2?.5:.85));}e.closePath(),e.fill();return}if(s.brows==="straight"||s.brows==="thin"){e.lineWidth=a*(s.brows==="thin"?.014:.03),e.beginPath(),e.moveTo(h,m),e.lineTo(c,p),e.stroke();return}if(s.brows==="angled"){e.lineWidth=a*.028;let b=t+n*i*.3;e.beginPath(),e.moveTo(c,p),e.lineTo(b,Math.min(m,p)-o*.06),e.lineTo(h,m+o*.02),e.stroke();return}if(s.brows==="thick"){let b=o*.06;e.beginPath(),e.moveTo(h,m),e.quadraticCurveTo(t,Math.min(m,p)-b*.6,c,p),e.lineTo(c,p+b),e.quadraticCurveTo(t,Math.min(m,p)+b*.5,h,m+b*.6),e.closePath(),e.fill();return}e.lineWidth=a*(s.brows==="arched"?.026:.032),e.beginPath(),e.moveTo(h,m);let g=s.brows==="arched"?o*.09:o*.035;e.quadraticCurveTo(t+n*i*.2,Math.min(m,p)-g,c,p),e.stroke();}function Si(e,t,r,a,o,n,s){let l=a*.026;e.strokeStyle=Be,e.lineWidth=l;let i=a*(n.mouth==="small"||n.mouth==="pout"?.06:n.mouth==="grin"?.12:.09),d=(c,h=4)=>{e.beginPath();for(let p=0;p<=h;p++){let m=t-i+2*i*p/h,g=r+(p%2?-1:1)*o*c;p?e.lineTo(m,g):e.moveTo(m,g);}e.stroke();};switch(s){case "love":case "wink":case "embarrassed":if(s==="embarrassed"){d(.025,4);return}e.beginPath(),e.moveTo(t-i,r-o*.04),e.quadraticCurveTo(t,r+o*.09,t+i,r-o*.04),e.stroke();return;case "excited":case "silly":{let c=Math.max(i,a*.11);e.fillStyle=Be,e.beginPath(),e.moveTo(t-c,r-o*.07),e.quadraticCurveTo(t,r-o*.03,t+c,r-o*.07),e.quadraticCurveTo(t,r+o*.22,t-c,r-o*.07),e.closePath(),e.fill(),s==="silly"?(e.fillStyle=gt,H(e,t+c*.25,r+o*.11,c*.4,o*.08),e.fill(),e.strokeStyle="#c4505c",e.lineWidth=l*.5,e.beginPath(),e.moveTo(t+c*.25,r+o*.06),e.lineTo(t+c*.25,r+o*.14),e.stroke()):(e.save(),e.clip(),e.fillStyle=gt,H(e,t,r+o*.12,c*.55,o*.06),e.fill(),e.restore());return}case "smug":case "cool":e.beginPath(),e.moveTo(t-i,r+o*.01),e.quadraticCurveTo(t+i*.3,r+o*.03,t+i*1.05,r-o*.06),e.stroke();return;case "confused":case "dizzy":d(s==="dizzy"?.035:.02,s==="dizzy"?6:4);return;case "disgusted":{e.beginPath(),e.moveTo(t-i,r+o*.05),e.lineTo(t-i*.3,r-o*.02),e.lineTo(t+i*.4,r+o*.03),e.lineTo(t+i,r-o*.01),e.stroke(),e.fillStyle=gt,H(e,t-i*.1,r+o*.045,i*.3,o*.03),e.fill();return}case "determined":{e.fillStyle="#ffffff",e.fillRect(t-i,r-o*.035,i*2,o*.07),e.strokeStyle=Be,e.lineWidth=l*.7,e.strokeRect(t-i,r-o*.035,i*2,o*.07),e.beginPath(),e.moveTo(t-i,r),e.lineTo(t+i,r),e.stroke();return}case "crying":{let c=Math.max(i,a*.1);e.fillStyle=Be,e.beginPath(),e.moveTo(t-c,r+o*.09),e.quadraticCurveTo(t,r-o*.14,t+c,r+o*.09),e.closePath(),e.fill();return}case "sleepy":e.fillStyle=Be,H(e,t,r+o*.01,a*.025,o*.035),e.fill();return;case "happy":{let c=Math.max(i,a*.1);e.fillStyle=Be,e.beginPath(),e.moveTo(t-c,r-o*.06),e.quadraticCurveTo(t,r-o*.02,t+c,r-o*.06),e.quadraticCurveTo(t,r+o*.2,t-c,r-o*.06),e.closePath(),e.fill(),e.save(),e.clip(),e.fillStyle=gt,H(e,t,r+o*.1,c*.55,o*.06),e.fill(),n.mouth==="grin"&&(e.fillStyle="#ffffff",e.fillRect(t-c,r-o*.08,c*2,o*.045)),e.restore();return}case "surprised":e.fillStyle=Be,H(e,t,r,a*.045,o*.085),e.fill();return;case "talk":e.fillStyle=Be,H(e,t,r,Math.max(i*.7,a*.06),o*.07),e.fill(),e.save(),e.clip(),e.fillStyle=gt,H(e,t,r+o*.06,a*.045,o*.035),e.fill(),e.restore();return;case "sad":e.beginPath(),e.moveTo(t-i,r+o*.04),e.quadraticCurveTo(t,r-o*.07,t+i,r+o*.04),e.stroke();return;case "angry":e.beginPath(),e.moveTo(t-i,r+o*.01),e.quadraticCurveTo(t,r-o*.03,t+i,r+o*.01),e.stroke();return;case "scared":{e.beginPath();let c=4;for(let h=0;h<=c;h++){let p=t-i+2*i*h/c,m=r+(h%2?-1:1)*o*.022;h?e.lineTo(p,m):e.moveTo(p,m);}e.stroke();return}case "tired":e.beginPath(),e.moveTo(t-i*.6,r),e.lineTo(t+i*.6,r),e.stroke();return;case "hurt":{e.beginPath();let c=4;for(let h=0;h<=c;h++){let p=t-i+2*i*h/c,m=r+(h%2?-1:1)*o*.04;h?e.lineTo(p,m):e.moveTo(p,m);}e.stroke();return}}if(n.mouth==="smirk"){e.beginPath(),e.moveTo(t-i,r),e.quadraticCurveTo(t+i*.3,r+o*.03,t+i,r-o*.06),e.stroke();return}if(n.mouth==="pout"){e.lineWidth=l*.9,e.beginPath(),e.moveTo(t-i*.15,r-o*.05),e.quadraticCurveTo(t+i*.9,r-o*.03,t-i*.05,r),e.quadraticCurveTo(t+i*.9,r+o*.03,t-i*.15,r+o*.05),e.stroke();return}if(n.mouth==="open"||n.mouth==="teeth"||n.mouth==="fang"||n.mouth==="tongue"){e.fillStyle=Be,e.beginPath(),e.moveTo(t-i,r-o*.04),e.quadraticCurveTo(t,r-o*.02,t+i,r-o*.04),e.quadraticCurveTo(t,r+o*.13,t-i,r-o*.04),e.closePath(),e.fill(),e.save(),e.clip(),n.mouth==="teeth"?(e.fillStyle="#ffffff",e.fillRect(t-i,r-o*.06,i*2,o*.045)):n.mouth!=="fang"&&(e.fillStyle=gt,H(e,t,r+o*.07,i*.55,o*.05),e.fill()),e.restore(),n.mouth==="fang"&&(e.fillStyle="#ffffff",e.beginPath(),e.moveTo(t+i*.35,r-o*.035),e.lineTo(t+i*.6,r-o*.035),e.lineTo(t+i*.47,r+o*.03),e.closePath(),e.fill()),n.mouth==="tongue"&&(e.fillStyle=gt,H(e,t+i*.3,r+o*.07,i*.32,o*.05),e.fill());return}if(n.mouth==="cat"){e.beginPath(),e.moveTo(t-i,r-o*.03),e.quadraticCurveTo(t-i*.5,r+o*.06,t,r-o*.01),e.quadraticCurveTo(t+i*.5,r+o*.06,t+i,r-o*.03),e.stroke();return}if(n.mouth==="grin"){e.fillStyle=Be,e.beginPath(),e.moveTo(t-i,r-o*.04),e.quadraticCurveTo(t,r-o*.01,t+i,r-o*.04),e.quadraticCurveTo(t,r+o*.12,t-i,r-o*.04),e.closePath(),e.fill(),e.save(),e.clip(),e.fillStyle="#ffffff",e.fillRect(t-i,r-o*.06,i*2,o*.04),e.restore();return}e.beginPath(),e.moveTo(t-i,r-o*.03),e.quadraticCurveTo(t,r+o*.06,t+i,r-o*.03),e.stroke();}var vo=16;function vi(e,t){if(typeof document<"u"){let r=document.createElement("canvas");return r.width=e,r.height=t,r}return new OffscreenCanvas(e,t)}var Ot=class{texture;g;w;h;face;current="neutral";base="neutral";constructor(t,r=et){this.face=t,this.w=Math.round(r[2]*vo),this.h=Math.round(r[3]*vo);let a=vi(this.w,this.h),o=a.getContext("2d");if(!o)throw new Error("DrawnFace: no 2D canvas");this.g=o,this.texture=new V.CanvasTexture(a),this.texture.colorSpace=V.SRGBColorSpace,this.texture.anisotropy=4,this.paint("neutral");}paint(t,r){let a=r&&t!=="blink"&&t!=="talk"&&zt[r].includes(t)?r:t;a!=="blink"&&a!=="talk"?this.base=a:r&&(this.base=r),this.current=a,ya(this.g,this.w,this.h,this.face,a,this.base),this.texture.needsUpdate=true;}setFace(t){this.face=t,ya(this.g,this.w,this.h,this.face,this.current,this.base),this.texture.needsUpdate=true;}dispose(){this.texture.dispose();}};var Ei={idle:{},talk:{},walk:{speed:1.6},run:{speed:5.2},surprised:{emote:"shrug"},point:{emote:"point"},sit:{sitting:true},wave:{emote:"wave"},jump:{air:true},fall:{emote:"facepalm"},dance:{emote:"dance"},carry:{speed:1.4,emote:"carry"},jog:{speed:3.4}},Ti=Object.fromEntries(i.map(e=>[e,Ei[e]??(Ro(e)?{emote:e}:{})])),Li={handR:"handR",handL:"handL",head:"headTop"},Ir=class{view;animator;input=Ar();seed;ownFace;drawn=null;pose="idle";jumpT=-1;constructor(t,r={}){this.ownFace=!r.facePainter,this.ownFace&&(this.drawn=Eo(t)),this.view=new Sr(t,{shadows:false,gloss:!!t?.face?.drawn,...r,facePainter:r.facePainter??this.drawn}),this.seed=r.seed??1,this.animator=this.newAnimator();}get group(){return this.view.group}get height(){return this.view.height}setSpec(t){let r=this.view.hash;if(this.view.setSpec(t),this.view.hash!==r&&(this.animator=this.newAnimator(),this.ownFace)){let a=this.drawn;this.drawn=Eo(t),this.view.setFacePainter(this.drawn),a?.dispose();}}setEmotion(t){this.animator.setEmotion(t);}setViseme(t){this.input.viseme=t;}setPose(t){if(t===this.pose)return;this.pose=t;let r=Ti[t];if(this.input.speed=r.speed??0,this.input.sitting=!!r.sitting,r.emote)this.animator.playEmote(r.emote);else {let a=this.animator.emoting;a&&"loop"in Ne[a]&&Ne[a].loop&&this.animator.stopEmote();}r.air&&(this.jumpT=0,this.animator.trigger("jump"));}playEmote(t){this.animator.playEmote(t);}stopEmote(){this.animator.stopEmote();}trigger(t){if(t==="jump"){this.jumpT=0,this.animator.trigger("jump");return}this.animator.trigger(t);}attach(t,r){this.view.attach(Li[t],r);}update(t){let r=this.input;this.jumpT>=0&&(this.jumpT+=t,r.onGround=this.jumpT>.6,r.vy=this.jumpT<.3?4:-4,r.onGround&&(this.jumpT=-1,r.vy=0,this.animator.trigger("land")));let a=this.animator.update(t,r);this.view.applyPose(a),this.view.setExpression(this.animator.expression,this.animator.emotion);}dispose(){this.view.dispose(),this.drawn?.dispose();}newAnimator(){let t=this.view.spec,r=new Cr(t.rig,t.style,this.view.expressions);return r.setRandom(a(this.seed)),r}};function Eo(e){let t=e?.face?.drawn;if(!t)return null;try{let{face:r}=Pt({face:{...t,brows:t.brows,browColor:"#2a1c14"}});return new Ot({...r,emotion:"neutral"},e.face.rect)}catch{return null}}var Mi=Ht.map(e=>{let t=Ie[e],r=t.bones.map(o=>`${o.name}@[${o.pivot.join(",")}]`).join(" "),a=t.defaultParts.map(o=>`${o.bone} ${o.size.join("x")} at [${o.pos.join(",")}]`).join("; ");return `- "${e}" \u2014 ${t.hint}. Bones (name@pivot): ${r}. Default body: ${a}.`}).join(`
25
+ `),Oc=`You design blocky voxel characters for a Minecraft-like game. Reply with ONE JSON object \u2014 a CharacterSpec \u2014 and nothing else: no markdown, no comments, no explanations.
3
26
 
4
27
  The game builds and animates the character from your recipe. You give the SHAPE (boxes on a skeleton), the COLOURS (a palette) and small PIXEL-ART pictures for faces and clothes. Animations (walk, run, sneak, swim, fly, emotes, emotions) come from the skeleton \u2014 you never animate.
5
28
 
6
29
  COORDINATES are in model PIXELS (16 px = 1 block): x to the character's RIGHT hand, y UP (y = 0 is the soles of the feet), z BACKWARDS \u2014 the character LOOKS TOWARD -z (its face is on the -z side). A normal person is 32 px tall.
7
30
 
8
31
  SKELETONS ("rig"):
9
- ${Bn}
32
+ ${Mi}
10
33
 
11
34
  CharacterSpec:
12
35
  {
13
36
  "version": 1,
14
37
  "name": string (<= 40 chars, in the player's language),
15
38
  "description": string (<= 200 chars),
16
- "rig": ${He.map(e=>`"${e}"`).join(" | ")},
39
+ "rig": ${Ht.map(e=>`"${e}"`).join(" | ")},
17
40
  "scale": 0.25..3 (overall size; 1 = normal),
18
41
  "palette": { "<one character>": "#rrggbb", ... } (<= 32 colours; "." and " " are transparent),
19
42
  "textures": { "<id>": { "w": 1..32, "h": 1..32, "rows": [ "<w palette characters>", ... h rows, top row first ] } },
@@ -25,11 +48,11 @@ CharacterSpec:
25
48
  "mirror": true (also adds the mirrored copy on the paired bone: armL -> armR, legFL -> legFR),
26
49
  "name": string } ],
27
50
  "bones": [ <= 16 EXTRA bones for tails, ears, wings, capes, hair, antennas:
28
- { "name": string, "parent": "<bone>", "pivot": [x, y, z], "role": ${et.map(e=>`"${e}"`).join(" | ")} } ]
51
+ { "name": string, "parent": "<bone>", "pivot": [x, y, z], "role": ${fr.map(e=>`"${e}"`).join(" | ")} } ]
29
52
  (a role makes the bone move by itself: a tail sways, ears twitch, a cape flutters when running, wings flap in flight; "static" \u2014 no motion),
30
53
  "face": { "bone": "head", "rect": [x, y, w, h] (where the face sits on the FRONT face of the head box, px from its top-left corner as seen by a viewer),
31
- "expressions": { ${Be.map(e=>`"${e}"`).join(", ")}: "<texture id of size w x h>" } } \u2014 eyes and mouth, drawn over the head; "neutral" is required, draw as many others as you can (at least blink, happy, sad, angry, surprised),
32
- "style": { "walk": ${Mt.map(e=>`"${e}"`).join(" | ")}, "idle": ${It.map(e=>`"${e}"`).join(" | ")}, "energy": 0..1 },
54
+ "expressions": { ${Gt.map(e=>`"${e}"`).join(", ")}: "<texture id of size w x h>" } } \u2014 eyes and mouth, drawn over the head; "neutral" is required, draw as many others as you can (at least blink, happy, sad, angry, surprised),
55
+ "style": { "walk": ${Ut.map(e=>`"${e}"`).join(" | ")}, "idle": ${qt.map(e=>`"${e}"`).join(" | ")}, "energy": 0..1 },
33
56
  "voice": { "pitch": 0.5..2 },
34
57
  "tags": [ <= 8 short words ],
35
58
  "finish": { "noise": 0..1, "outline": 0..1, "shade": 0..1, "density": 1..4 } (optional; defaults 0.5 / 0.4 / 0.25 / 2 \u2014 the game adds fabric noise, a dark outline on the edge of every box face and top-to-bottom shading by itself; set 0 for a clean flat look)
@@ -51,4 +74,4 @@ HOW TO BUILD A GOOD, DETAILED CHARACTER (the game's style: blocky people with fi
51
74
  - Clothes in the textures: a shirt front with a collar, a button placket and pockets; a striped t-shirt; a knitted sweater with a pattern band and a ribbed hem; trousers with a crease; shorts with skin below and socks; the belt with a buckle.
52
75
  - The head front texture: hair on the top rows and the sides, skin elsewhere, a slightly darker chin row; the eyes, brows and mouth go into "face" (e.g. rect [0, 3, 8, 5] with 16x10 pictures): white eyes 3 texels wide with a coloured iris in the middle, brows above them, a 4-texel mouth \u2014 one picture per expression, the same size, transparent where the skin shows through.
53
76
  - Add detail with extra boxes: hair fringe, a hood, armour plates, a crown, horns, a tail (an extra bone with role "tail").
54
- - When the player sends pictures (possibly of ONE character from different angles: front, side, back) study EVERY picture: get the silhouette, proportions, colours, clothes and the face right. Pictures can be photos, drawings or 3D renders \u2014 turn them into a clean blocky version.`;var Ri=["cat","dog","fox","bear","rabbit","bird","dragon","slime","ghost","robot"],Vn=e=>({k:"#2a1c14",w:"#f4f4ef",b:e,m:"#7a3a30",o:"#3a1a14"});function jn(e){let t=e.light??e.body,r=e.accent??e.body,o={t:e.body,s:e.body,l:t,a:r,p:r,...Vn(e.eyes??"#3f6f3a")},n=[],a="quadruped",i=st("head",[0,3,8,5]),c={walk:"normal",idle:"calm",energy:.6},s=(l,h,m,p,b,g={})=>n.push({name:l,bone:h,size:m,pos:p,color:b,...g});switch(e.kind){case "cat":case "fox":case "dog":case "bear":case "rabbit":{let l=e.kind;s("body","body",[8,8,16],[0,12,0],"t"),s("belly","body",[6,1,12],[0,8,0],"l"),s("head","head",[8,8,8],[0,16,-12],"s");for(let h of ["legFL","legFR","legBL","legBR"]){let m=h.endsWith("L")?-3:3,p=h.startsWith("legF")?-6:6;s(h,h,[3,8,3],[m,4,p],"t"),s(`${h}Paw`,h,[3.2,1.5,3.2],[m,.75,p],"a");}l==="cat"?(s("ear","head",[2,2.5,1],[-2.5,21,-11],"a",{mirror:true}),s("tail","tail",[1.6,1.6,10],[0,15,13],"t",{rot:[20,0,0]}),c={walk:"sneaky",idle:"calm",energy:.5}):l==="fox"?(s("ear","head",[2.4,3.2,1],[-2.5,21.4,-11],"t",{mirror:true}),s("snout","head",[4,3,3],[0,14.5,-17],"l"),s("nose","head",[1.2,1,.6],[0,15.6,-18.6],"a"),s("tail","tail",[3.5,3.5,10],[0,14,13],"t",{rot:[15,0,0]}),s("tailTip","tail",[3.6,3.6,2.5],[0,15.2,18],"l"),c={walk:"bouncy",idle:"fidgety",energy:.7}):l==="dog"?(s("ear","head",[1.5,4,3],[-4.6,17.5,-11.5],"a",{mirror:true}),s("snout","head",[4,3,3],[0,14.5,-17],"l"),s("nose","head",[1.6,1.2,.6],[0,15.8,-18.6],"a"),s("tail","tail",[2,2,7],[0,16,11],"t",{rot:[40,0,0]}),c={walk:"bouncy",idle:"fidgety",energy:.9}):l==="bear"?(s("ear","head",[2,2,1],[-3,20.6,-10.5],"a",{mirror:true}),s("snout","head",[4,3,2.5],[0,14.5,-16.8],"l"),s("nose","head",[1.6,1.2,.6],[0,15.8,-18.2],"a"),s("tail","tail",[2,2,2],[0,14,9],"t"),c={walk:"heavy",idle:"proud",energy:.4}):(s("ear","head",[1.6,7,1],[-1.8,23.5,-11],"t",{mirror:true}),s("earInner","head",[.8,5.5,.4],[-1.8,23.5,-11.6],"l",{mirror:true}),s("tail","tail",[3,3,3],[0,14,9.5],"l"),c={walk:"bouncy",idle:"fidgety",energy:.8});break}case "bird":case "dragon":{a="flyer",i=st("head",[0,1,5,3]);let l=e.kind==="dragon";s("body","body",[6,6,8],[0,8,0],"t"),s("belly","body",[4.6,4,1],[0,7.5,-4.2],"l"),s("head","head",[5,5,5],[0,13,-4],"s"),s("wing","wingL",[8,1,6],[-7,10,0],"a",{mirror:true}),s("leg","legL",[1,4,1],[-1.5,2,0],"a",{mirror:true}),l?(s("horn","head",[.8,2,.8],[-1.4,16.4,-3],"l",{mirror:true}),s("snout","head",[3,2,2.4],[0,12.2,-7.4],"s"),s("tail","tail",[2,2,8],[0,7,7],"t"),s("spike","body",[1,1.5,6],[0,11.6,0],"a"),c={walk:"heavy",idle:"proud",energy:.6}):(s("beak","head",[1.6,1.2,2],[0,12.4,-7.2],"a"),s("tail","tail",[4,1,4],[0,8,6],"a"),s("crest","head",[1,2,2],[0,16.2,-3.6],"a"),c={walk:"bouncy",idle:"fidgety",energy:.8});break}case "slime":case "ghost":case "robot":{a="blob",i=st("body",[2,3,8,5]),e.kind==="slime"?(s("body","body",[12,10,12],[0,5,0],"t"),s("shine","body",[3,2,.4],[-3,8,-6.2],"l"),c={walk:"bouncy",idle:"fidgety",energy:.9}):e.kind==="ghost"?(s("body","body",[10,12,10],[0,7,0],"t"),s("hem","body",[10.4,2,10.4],[0,1,0],"l"),c={walk:"sneaky",idle:"calm",energy:.4}):(s("body","body",[11,11,10],[0,5.5,0],"t"),s("antenna","body",[.8,3,.8],[0,12.5,0],"a"),s("bulb","body",[1.6,1.6,1.6],[0,14.6,0],"l"),s("screen","body",[9,6,.4],[0,6.5,-5.2],"l"),c={walk:"robotic",idle:"calm",energy:.5});break}}return {version:1,name:e.name,description:e.description??"",rig:a,palette:o,textures:i.textures,parts:n,face:i.face,style:c,finish:{noise:.45,outline:.4,shade:.25,density:2},tags:e.tags??[e.kind]}}function Ei(e){let t=se(jn(e));if(!t.ok)throw new Error(`${e.kind}: ${t.error}`);return t.spec}var oe="voxel-v1",Se=1,ke=["hair","top","bottom","shoes","hands","waist","back","faceAcc","hat"],$t=["head","torso","sleeveL","sleeveR","forearmL","forearmR","handL","handR","legL","legR","footL","footR"],Wt={sleeves:["sleeveL","sleeveR"],forearms:["forearmL","forearmR"],arms:["sleeveL","sleeveR","forearmL","forearmR"],hands:["handL","handR"],legs:["legL","legR"],feet:["footL","footR"]},Ae="@skin",Kt={hair:{bones:["head"],paint:["head"],paintFaces:["top","back","left","right"],parts:8,box:{min:[-6,22,-6],max:[6,35.5,6]}},hat:{bones:["head"],paint:[],parts:8,box:{min:[-7,26,-8],max:[7,38,7]}},top:{bones:["body","armL","armR","foreArmL","foreArmR"],paint:["torso","sleeveL","sleeveR","forearmL","forearmR"],parts:6,box:{min:[-10,9.5,-6],max:[10,26,6]}},bottom:{bones:["body","legL","legR","shinL","shinR"],paint:["legL","legR"],parts:4,box:{min:[-6.5,.5,-4.5],max:[6.5,17,4.5]}},shoes:{bones:["legL","legR","shinL","shinR"],paint:["footL","footR"],parts:4,box:{min:[-5.5,-0.5,-4.5],max:[5.5,7,4]}},hands:{bones:["armL","armR","foreArmL","foreArmR"],paint:["handL","handR"],parts:2,box:{min:[-10,9.5,-4],max:[10,16,4]}},waist:{bones:["body"],paint:[],parts:4,box:{min:[-7,9.5,-4],max:[7,16.5,4]}},back:{bones:["body"],paint:[],parts:8,box:{min:[-13.5,6,1.5],max:[13.5,36.5,13]}},faceAcc:{bones:["head"],paint:[],parts:4,box:{min:[-6,22.5,-6],max:[6,30.5,-2]}}},Te={palette:5,textures:4,textureSide:32,texturePixels:2048,id:40,textureId:12,name:40},Ge=["round","sparkle","wide","cat","sleepy","dot"],Ue=["soft","thick","arched","none"],Ye=["smile","grin","cat","small"],qe=[.5,1.8,7.5,5.4],Gn={eyes:"round",eyeColor:"#3b2a20",brows:"soft",browColor:"#3b2a20",mouth:"smile",cheeks:true,emotion:"neutral"},je={min:.9,max:1.1},gt=(e,t,r)=>typeof e=="string"&&t.includes(e)?e:r,qt=e=>typeof e=="string"&&ke.includes(e);function wt(e){let t=H(e)?e:{},r=H(t.body)?t.body:{},o=H(t.face)?t.face:{},n=Gn,a={};if(H(t.wear))for(let[c,s]of Object.entries(t.wear))qt(c)&&typeof s=="string"&&s.trim()&&(a[c]=s.trim().slice(0,Te.id));let i={};if(H(t.tint))for(let[c,s]of Object.entries(t.tint)){let l=fe(s);qt(c)&&l&&(i[c]=l);}return {version:Se,style:oe,body:{skin:fe(r.skin)??"#f2c9a0",height:Math.round(Q(r.height,1,je.min,je.max)*1e3)/1e3},face:{eyes:gt(o.eyes,Ge,n.eyes),eyeColor:fe(o.eyeColor)??n.eyeColor,brows:gt(o.brows,Ue,n.brows),browColor:fe(o.browColor)??n.browColor,mouth:gt(o.mouth,Ye,n.mouth),cheeks:typeof o.cheeks=="boolean"?o.cheeks:n.cheeks,emotion:gt(o.emotion,a$1,n.emotion)},wear:a,tint:i}}var Un=/^[a-z0-9][a-z0-9_.-]*$/,Yn=/^[A-Za-z0-9]+$/;function Yt(e){return !Array.isArray(e)||e.length!==3?null:e.every(t=>typeof t=="number"&&Number.isFinite(t))?e:null}function qn(e,t){if(!t||t.every(o=>o===0))return [e[0]/2,e[1]/2,e[2]/2];let r=Math.hypot(e[0],e[1],e[2])/2;return [r,r,r]}function xt(e){let t=[],r=(w,f,S)=>t.push(c({en:w,ru:f},S));if(!H(e))return {ok:false,errors:[c({en:"the item is not an object",ru:"\u0432\u0435\u0449\u044C: \u043D\u0435 \u043E\u0431\u044A\u0435\u043A\u0442"})]};let o=e,n=Te;o.style!==void 0&&o.style!==oe&&r("style \xAB{s}\xBB is not {need}","\u0441\u0442\u0438\u043B\u044C \xAB{s}\xBB: \u043D\u0435 {need}",{s:String(o.style),need:oe});let a=typeof o.id=="string"?o.id.trim():"";if((!a||a.length>n.id||!Un.test(a))&&r("id must be 1, {n} characters: a-z, 0-9, _ . -","id: 1, {n} \u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432: a-z, 0-9, _ . -",{n:n.id}),!qt(o.slot))return r("unknown slot \xAB{s}\xBB","\u043D\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043D\u044B\u0439 \u0441\u043B\u043E\u0442 \xAB{s}\xBB",{s:String(o.slot)}),{ok:false,errors:t};let i=o.slot,c$1=Kt[i],s=typeof o.name=="string"&&o.name.trim()?o.name.trim().slice(0,n.name):a,l={};if(!H(o.palette)||!Object.keys(o.palette).length)r("the palette is empty","\u043F\u0430\u043B\u0438\u0442\u0440\u0430 \u043F\u0443\u0441\u0442\u0430");else {let w=Object.entries(o.palette);w.length>n.palette&&r("more than {n} colours in the palette","\u0432 \u043F\u0430\u043B\u0438\u0442\u0440\u0435 \u0431\u043E\u043B\u044C\u0448\u0435 {n} \u0446\u0432\u0435\u0442\u043E\u0432",{n:n.palette});for(let[f,S]of w){let d=S===Ae?Ae:fe(S);f.length!==1||be.has(f)||!d?r("palette colour \xAB{k}\xBB is not valid","\u0446\u0432\u0435\u0442 \u043F\u0430\u043B\u0438\u0442\u0440\u044B \xAB{k}\xBB \u043D\u0435 \u0433\u043E\u0434\u0438\u0442\u0441\u044F",{k:f}):l[f]=d;}}let h=typeof o.tint=="string"&&o.tint?o.tint:null;h!==null&&(!l[h]||l[h]===Ae)&&r("tint \xAB{k}\xBB is not a colour of the palette","\u043F\u0435\u0440\u0435\u043A\u0440\u0430\u0441\u043A\u0430 \xAB{k}\xBB: \u043D\u0435 \u0446\u0432\u0435\u0442 \u043F\u0430\u043B\u0438\u0442\u0440\u044B",{k:h});let m={},p=0;if(o.textures!==void 0)if(!H(o.textures))r("textures is not an object","textures: \u043D\u0435 \u043E\u0431\u044A\u0435\u043A\u0442");else {let w=Object.entries(o.textures);w.length>n.textures&&r("more than {n} textures","\u0442\u0435\u043A\u0441\u0442\u0443\u0440 \u0431\u043E\u043B\u044C\u0448\u0435 {n}",{n:n.textures});for(let[f,S]of w){if(f.length>n.textureId||!Yn.test(f)){r("texture id \xAB{id}\xBB must be 1, {n} letters or digits","id \u0442\u0435\u043A\u0441\u0442\u0443\u0440\u044B \xAB{id}\xBB: 1, {n} \u0431\u0443\u043A\u0432 \u0438\u043B\u0438 \u0446\u0438\u0444\u0440",{id:f.slice(0,20),n:n.textureId});continue}let d=H(S)?S:null,x=d&&Array.isArray(d.rows)?d.rows:null,E=d?d.w:void 0,R=d?d.h:void 0;if(!x||typeof E!="number"||typeof R!="number"||!Number.isInteger(E)||!Number.isInteger(R)||E<1||R<1||E>n.textureSide||R>n.textureSide||x.length!==R||x.some(P=>typeof P!="string"||P.length!==E)){r("texture \xAB{id}\xBB must be w\xD7h \u2264 {n} with exactly h rows of w symbols","\u0442\u0435\u043A\u0441\u0442\u0443\u0440\u0430 \xAB{id}\xBB: w\xD7h \u2264 {n}, \u0440\u043E\u0432\u043D\u043E h \u0441\u0442\u0440\u043E\u043A \u043F\u043E w \u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432",{id:f,n:n.textureSide});continue}x.some(P=>[...P].some(z=>!be.has(z)&&!l[z]))&&r("texture \xAB{id}\xBB uses symbols outside the palette","\u0432 \u0442\u0435\u043A\u0441\u0442\u0443\u0440\u0435 \xAB{id}\xBB \u0441\u0438\u043C\u0432\u043E\u043B\u044B \u043D\u0435 \u0438\u0437 \u043F\u0430\u043B\u0438\u0442\u0440\u044B",{id:f}),p+=E*R,m[f]={w:E,h:R,rows:x.map(P=>P.replace(/ /g,"."))};}p>n.texturePixels&&r("textures take {p} pixels, the limit is {n}","\u0442\u0435\u043A\u0441\u0442\u0443\u0440\u044B \u0437\u0430\u043D\u0438\u043C\u0430\u044E\u0442 {p} \u043F\u0438\u043A\u0441\u0435\u043B\u0435\u0439, \u043F\u0440\u0435\u0434\u0435\u043B {n}",{p,n:n.texturePixels});}let b=(w,f)=>typeof w!="string"?null:m[w]||l[w]?w:(r("{w}: \xAB{v}\xBB is neither a texture nor a palette colour","{w}: \xAB{v}\xBB: \u043D\u0438 \u0442\u0435\u043A\u0441\u0442\u0443\u0440\u0430, \u043D\u0438 \u0446\u0432\u0435\u0442 \u043F\u0430\u043B\u0438\u0442\u0440\u044B",{w:f,v:w}),null),g=(w,f,S=ue)=>{if(w===void 0)return;if(!H(w)){r("{w}: faces is not an object","{w}: faces: \u043D\u0435 \u043E\u0431\u044A\u0435\u043A\u0442",{w:f});return}let d={};for(let[x,E]of Object.entries(w)){if(!ue.includes(x)){r("{w}: unknown face \xAB{f}\xBB","{w}: \u043D\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043D\u0430\u044F \u0433\u0440\u0430\u043D\u044C \xAB{f}\xBB",{w:f,f:x});continue}if(!S.includes(x)){r("{w}: the {slot} slot may not paint the \xAB{f}\xBB face","{w}: \u0441\u043B\u043E\u0442 {slot} \u043D\u0435 \u043A\u0440\u0430\u0441\u0438\u0442 \u0433\u0440\u0430\u043D\u044C \xAB{f}\xBB",{w:f,slot:i,f:x});continue}let R=b(E,f);R&&(d[x]=R);}return Object.keys(d).length?d:void 0},y=[];o.paint!==void 0&&!Array.isArray(o.paint)&&r("paint is not a list","paint: \u043D\u0435 \u0441\u043F\u0438\u0441\u043E\u043A");for(let[w,f]of (Array.isArray(o.paint)?o.paint:[]).entries()){let S=`paint[${w}]`;if(!H(f)){r("{w} is not an object","{w}: \u043D\u0435 \u043E\u0431\u044A\u0435\u043A\u0442",{w:S});continue}let d=typeof f.region=="string"?f.region:"",x=Wt[d]??($t.includes(d)?[d]:[]);if(!x.length){r("{w}: unknown region \xAB{r}\xBB","{w}: \u043D\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043D\u0430\u044F \u043E\u0431\u043B\u0430\u0441\u0442\u044C \xAB{r}\xBB",{w:S,r:d});continue}let E=x.filter(P=>!c$1.paint.includes(P));if(E.length){r("{w}: the {slot} slot may not paint \xAB{r}\xBB","{w}: \u0441\u043B\u043E\u0442 {slot} \u043D\u0435 \u043A\u0440\u0430\u0441\u0438\u0442 \xAB{r}\xBB",{w:S,slot:i,r:E.join(", ")});continue}let R=typeof f.color=="string"&&l[f.color]?f.color:null;R||r("{w}: colour is not in the palette","{w}: \u0446\u0432\u0435\u0442\u0430 \u043D\u0435\u0442 \u0432 \u043F\u0430\u043B\u0438\u0442\u0440\u0435",{w:S});let C=g(f.faces,S,c$1.paintFaces);if(R)for(let P of x){let z={region:P,color:R};C&&(z.faces={...C}),y.push(z);}}let T=[];o.parts!==void 0&&!Array.isArray(o.parts)&&r("parts is not a list","parts: \u043D\u0435 \u0441\u043F\u0438\u0441\u043E\u043A");let A=Array.isArray(o.parts)?o.parts:[];A.length>c$1.parts&&r("the {slot} slot allows {n} boxes, the item has {m}","\u0441\u043B\u043E\u0442\u0443 {slot} \u043C\u043E\u0436\u043D\u043E {n} \u043A\u043E\u0440\u043E\u0431\u043E\u043A, \u0443 \u0432\u0435\u0449\u0438 {m}",{slot:i,n:c$1.parts,m:A.length});for(let[w,f]of A.entries()){let S=`parts[${w}]`;if(!H(f)){r("{w} is not an object","{w}: \u043D\u0435 \u043E\u0431\u044A\u0435\u043A\u0442",{w:S});continue}let d=typeof f.bone=="string"?f.bone:"";if(!c$1.bones.includes(d)){r("{w}: the {slot} slot puts boxes only on {b}","{w}: \u0441\u043B\u043E\u0442 {slot} \u0441\u0442\u0430\u0432\u0438\u0442 \u043A\u043E\u0440\u043E\u0431\u043A\u0438 \u0442\u043E\u043B\u044C\u043A\u043E \u043D\u0430 {b}",{w:S,slot:i,b:c$1.bones.join(", ")});continue}let x=Yt(f.size),E=Yt(f.pos);if(!x||!E||x.some(I=>I<=0)){r("{w}: size and pos must be [x, y, z]","{w}: size \u0438 pos: [x, y, z]",{w:S});continue}let R=f.rot===void 0?void 0:Yt(f.rot);f.rot!==void 0&&!R&&r("{w}: rot must be [x, y, z]","{w}: rot: [x, y, z]",{w:S});let C=f.mirror===true,P=qn(x,R??void 0),j=(C?[E[0],-E[0]]:[E[0]]).some(I=>I-P[0]<c$1.box.min[0]-1e-6||I+P[0]>c$1.box.max[0]+1e-6)||[1,2].some(I=>E[I]-P[I]<c$1.box.min[I]-1e-6||E[I]+P[I]>c$1.box.max[I]+1e-6);j&&r("{w}: the box leaves the {slot} slot frame","{w}: \u043A\u043E\u0440\u043E\u0431\u043A\u0430 \u0432\u044B\u0445\u043E\u0434\u0438\u0442 \u0437\u0430 \u0440\u0430\u043C\u043A\u0443 \u0441\u043B\u043E\u0442\u0430 {slot}",{w:S,slot:i});let v=typeof f.color=="string"&&l[f.color]?f.color:null;v||r("{w}: colour is not in the palette","{w}: \u0446\u0432\u0435\u0442\u0430 \u043D\u0435\u0442 \u0432 \u043F\u0430\u043B\u0438\u0442\u0440\u0435",{w:S});let k=g(f.faces,S);if(!v||j)continue;let M={bone:d,size:[...x],pos:[...E],color:v};k&&(M.faces=k),R&&R.some(I=>I!==0)&&(M.rot=[...R]),C&&(M.mirror=true),typeof f.name=="string"&&f.name.trim()&&(M.name=f.name.trim().slice(0,24)),T.push(M);}return !A.length&&!(Array.isArray(o.paint)&&o.paint.length)&&r("the item neither paints nor adds anything","\u0432\u0435\u0449\u044C \u043D\u0438\u0447\u0435\u0433\u043E \u043D\u0435 \u043A\u0440\u0430\u0441\u0438\u0442 \u0438 \u043D\u0435 \u0434\u043E\u0431\u0430\u0432\u043B\u044F\u0435\u0442"),t.length?{ok:false,errors:t}:{ok:true,item:{version:Se,style:oe,id:a,slot:i,name:s,palette:l,tint:h,textures:m,paint:y,parts:T}}}var Fr={torso:"#d9d3c5",legs:"#5f6b7a"},$n="#2b2140",Wn="#7a2e2e",Kn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",Xn=32,Jn=[10,7],Zn={noise:0,outline:0,shade:.12,density:4,round:.35},Qn=["front","back","left","right"];function Nr(e){let t=parseInt(e.slice(1),16);return [t>>16&255,t>>8&255,t&255]}var Xt=class{map={};next=0;key(t){let r=Object.entries(this.map).find(([,s])=>s===t);if(r)return r[0];if(this.next<Xn){let s=Kn[this.next++];return this.map[s]=t,s}let[o,n,a]=Nr(t),i=Object.keys(this.map)[0],c=1/0;for(let[s,l]of Object.entries(this.map)){let[h,m,p]=Nr(l),b=(o-h)**2+(n-m)**2+(a-p)**2;b<c&&(c=b,i=s);}return i}};function ea(e,t){return (typeof e=="function"?e(t):e[t])??null}function ta(e){let[t,r]=Jn,o=new L(t,r),n=a=>{a(1),a(6);};switch(e){case "blink":case "tired":n(a=>o.row(3,a,a+2,"k"));break;case "happy":n(a=>o.px(a,3,"k").px(a+1,2,"k").px(a+2,3,"k"));break;case "hurt":o.px(1,2,"k").px(2,3,"k").px(1,4,"k"),o.px(8,2,"k").px(7,3,"k").px(8,4,"k");break;case "surprised":case "scared":n(a=>o.rect(a,2,3,3,"w").px(a+1,3,"k"));break;default:n(a=>o.rect(a,2,3,3,"w").rect(a+1,3,2,2,"e").px(a+1,3,"k"));}switch(e==="angry"&&o.px(1,1,"k").px(2,1,"k").px(3,2,"k").px(8,1,"k").px(7,1,"k").px(6,2,"k"),e==="sad"&&o.px(3,1,"k").px(2,1,"k").px(6,1,"k").px(7,1,"k"),e){case "happy":case "talk":o.rect(4,5,2,2,"m");break;case "surprised":o.rect(4,5,2,2,"m");break;case "sad":o.px(3,6,"m").row(5,4,5,"m").px(6,6,"m");break;case "angry":case "tired":case "scared":case "hurt":o.row(6,4,5,"m");break;default:o.px(3,5,"m").row(6,4,5,"m").px(6,5,"m");}return o.tex()}function Jt(e,t){let r=ae[Pe],o=new Xt,n=o.key(e.body.skin),a=r.defaultParts.map(p=>({...p,size:[...p.size],pos:[...p.pos],color:p.name==="torso"?o.key(Fr.torso):p.name?.startsWith("leg")||p.name?.startsWith("foot")?o.key(Fr.legs):n})),i=new Map;for(let p of a){let b=i.get(p.name)??[];b.push(p),i.set(p.name,b);}for(let p of i.values())p.sort((b,g)=>g.pos[1]+g.size[1]/2-(b.pos[1]+b.size[1]/2));let c={},s={k:o.key($n),w:o.key("#ffffff"),e:o.key(e.face.eyeColor),m:o.key(Wn)},l={};for(let p of Be){let b=ta(p),g="face_"+p;c[g]={...b,rows:b.rows.map(y=>[...y].map(T=>s[T]??T).join(""))},l[p]=g;}l.neutral=l[e.face.emotion]??l.neutral;for(let p of ke){let b=e.wear[p];if(!b)continue;let g=ea(t,b);if(!g||g.slot!==p||g.style!==oe)continue;let y={};for(let[w,f]of Object.entries(g.palette))y[w]=f===Ae?n:o.key(w===g.tint&&e.tint[p]?e.tint[p]:f);let T={};for(let[w,f]of Object.entries(g.textures)){let S=`${p}_${w}`;T[w]=S,c[S]={w:f.w,h:f.h,rows:f.rows.map(d=>[...d].map(x=>y[x]??x).join(""))};}let A=w=>{if(!w)return;let f={};for(let[S,d]of Object.entries(w)){let x=T[d]??y[d];x&&(f[S]=x);}return Object.keys(f).length?f:void 0};for(let w of g.paint){let f=i.get(w.region);if(!f)continue;let S=y[w.color],d=A(w.faces);f.forEach((x,E)=>{S&&(x.color=S);let R=d&&ra(d,f,E,c);R?x.faces=R:delete x.faces;});}for(let w of g.parts){let f={bone:w.bone,size:[...w.size],pos:[...w.pos],color:y[w.color]??n},S=A(w.faces);S&&(f.faces=S),w.rot&&(f.rot=[...w.rot]),w.mirror&&(f.mirror=true),w.name&&(f.name=w.name),a.push(f);}}let h={version:1,name:"Avatar",description:"",rig:Pe,scale:e.body.height,palette:o.map,textures:c,parts:a,bones:[],face:{bone:r.faceBone,rect:[...qe],expressions:l},style:{walk:"bouncy",idle:"calm",energy:.6},voice:{pitch:1},tags:["avatar",oe],finish:{...Zn}},m=se(h);if(!m.ok)throw new Error("composeAvatar: "+m.error);return m.spec}function ra(e,t,r,o){if(t.length===1)return {...e};let n=t[0].pos[1]+t[0].size[1]/2,a=Math.min(...t.map(l=>l.pos[1]-l.size[1]/2)),i=Math.max(1e-6,n-a),c=l=>l<=0?0:l>=t.length?1:(n-(t[l-1].pos[1]-t[l-1].size[1]/2))/i,s={};for(let[l,h]of Object.entries(e)){let m=o[h];if(!m){s[l]=h;continue}if(l==="top"){r===0&&(s[l]=h);continue}if(l==="bottom"){r===t.length-1&&(s[l]=h);continue}if(!Qn.includes(l))continue;let p=Math.min(m.h-1,Math.round(c(r)*m.h)),b=Math.max(p+1,Math.round(c(r+1)*m.h)),g=`${h}_${r}`;o[g]||(o[g]={w:m.w,h:b-p,rows:m.rows.slice(p,b)}),s[l]=g;}return Object.keys(s).length?s:void 0}var Ce="#2b2140",$e="#7a2e2e",Hr="#e8707a",oa={neutral:{eye:"open",iris:1,white:1,lidOuter:0,lidInner:0,browUp:0,browInner:0,tear:false},happy:{eye:"happy",iris:1,white:1,lidOuter:0,lidInner:0,browUp:.04,browInner:0,tear:false},sad:{eye:"open",iris:1,white:1,lidOuter:.38,lidInner:.12,browUp:0,browInner:.09,tear:true},angry:{eye:"open",iris:.9,white:.95,lidOuter:.1,lidInner:.42,browUp:-0.02,browInner:-0.1,tear:false},surprised:{eye:"open",iris:.55,white:1.15,lidOuter:0,lidInner:0,browUp:.1,browInner:0,tear:false},scared:{eye:"open",iris:.42,white:1.08,lidOuter:0,lidInner:0,browUp:.08,browInner:.07,tear:false},tired:{eye:"open",iris:1,white:1,lidOuter:.5,lidInner:.5,browUp:-0.02,browInner:-0.02,tear:false},hurt:{eye:"hurt",iris:1,white:1,lidOuter:0,lidInner:0,browUp:0,browInner:-0.07,tear:false}};function Br(e,t,r,o,n,a="neutral"){let i=n==="blink"||n==="talk"?a==="blink"||a==="talk"?"neutral":a:n,c=oa[i];e.clearRect(0,0,t,r),e.lineCap="round",e.lineJoin="round";let s=r*.5,l=t*.105,h=r*.2,m=n==="blink"?"closed":c.eye;o.cheeks&&i!=="scared"&&(e.fillStyle=i==="happy"?"rgba(236,110,140,0.5)":"rgba(236,120,140,0.32)",$(e,t*.12,r*.8,t*.07,r*.075),e.fill(),$(e,t*.88,r*.8,t*.07,r*.075),e.fill());for(let p of [-1,1]){let b=t*(.5+p*.22);na(e,b,s,l,h,p,o,m,c),sa(e,b,s-h-r*.07,t,r,p,o,c);}if(c.tear&&m==="open"){e.fillStyle="#85b7eb";let p=t*.5-t*.22-l*.6,b=s+h*1.05;e.beginPath(),e.moveTo(p,b-r*.07),e.quadraticCurveTo(p+t*.03,b,p,b+r*.04),e.quadraticCurveTo(p-t*.03,b,p,b-r*.07),e.fill();}ia(e,t*.5,r*.86,t,r,o,n==="talk"?"talk":i);}function $(e,t,r,o,n){e.beginPath(),e.ellipse(t,r,Math.max(.1,o),Math.max(.1,n),0,0,Math.PI*2);}function na(e,t,r,o,n,a,i,c,s){let l=o*.26;if(e.strokeStyle=Ce,e.lineWidth=l,c==="closed"){e.beginPath(),e.moveTo(t-o,r+n*.1),e.quadraticCurveTo(t,r+n*.55,t+o,r+n*.1),e.stroke(),i.eyes==="wide"&&Dr(e,t,r+n*.15,o,n*.3,a,l);return}if(c==="happy"){e.lineWidth=l*1.2,e.beginPath(),e.moveTo(t-o,r+n*.35),e.quadraticCurveTo(t,r-n*.75,t+o,r+n*.35),e.stroke();return}if(c==="hurt"){let E=t-a*o*.6,R=t+a*o*.8;e.lineWidth=l*1.2,e.beginPath(),e.moveTo(R,r-n*.55),e.lineTo(E,r),e.lineTo(R,r+n*.55),e.stroke();return}let h=o*s.white,m=n*s.white,p=i.eyes==="sleepy"?.32:0,b=Math.max(s.lidOuter,p),g=Math.max(s.lidInner,p),y=r-m,T=t+a*(h+l),A=t-a*(h+l),w=y+2*m*b,f=y+2*m*g,S=b>0||g>0;e.save(),S&&(e.beginPath(),e.moveTo(T,w),e.lineTo(A,f),e.lineTo(A,r+m*2),e.lineTo(T,r+m*2),e.closePath(),e.clip());let d=Math.min(h,m)*.8*s.iris,x=r+m*.12;switch(i.eyes){case "dot":{e.fillStyle=Ce,$(e,t,r+m*.1,h*.55,m*.72),e.fill(),e.fillStyle="#ffffff",$(e,t-h*.18,r-m*.18,h*.17,h*.17),e.fill();break}case "cat":{e.fillStyle="#ffffff",Zt(e,t,r,h*1.08,m*.85,a),e.fill(),e.save(),Zt(e,t,r,h*1.08,m*.85,a),e.clip(),e.fillStyle=i.eyeColor,$(e,t,x,d*1.05,d*1.2),e.fill(),e.fillStyle=Ce,$(e,t,x,d*.22*(s.iris<1?1.5:1),d*.95),e.fill(),e.fillStyle="#ffffff",$(e,t-d*.4,x-d*.45,d*.25,d*.25),e.fill(),e.restore(),e.strokeStyle=Ce,e.lineWidth=l,Zt(e,t,r,h*1.08,m*.85,a),e.stroke();break}default:{let E=i.eyes==="sparkle"||i.eyes==="wide";e.fillStyle="#ffffff",$(e,t,r,h,m),e.fill(),e.save(),$(e,t,r,h,m),e.clip();let R=E?d*1.18:d;e.fillStyle=i.eyeColor,$(e,t,x,R*.95,R*(i.eyes==="sparkle"?1.15:1)),e.fill(),e.fillStyle="rgba(255,255,255,0.18)",$(e,t,x+R*.45,R*.7,R*.45),e.fill(),e.fillStyle=Ce,$(e,t,x,R*.48,R*.52),e.fill(),e.fillStyle="#ffffff",$(e,t-R*.38,x-R*.42,R*.32,R*.32),e.fill(),$(e,t+R*.38,x+R*.38,R*.14,R*.14),e.fill(),i.eyes==="sparkle"&&(aa(e,t+R*.3,x-R*.55,R*.22),e.fill()),e.restore(),e.strokeStyle=Ce,e.lineWidth=l,e.beginPath(),e.ellipse(t,r,h,m,0,Math.PI*1.08,Math.PI*1.92),e.stroke();break}}if(e.restore(),S){e.strokeStyle=Ce,e.lineWidth=l;let E=z=>(z-T)/(A-T),R=z=>w+(f-w)*E(z),C=t-h*.95,P=t+h*.95;e.beginPath(),e.moveTo(C,R(C)),e.lineTo(P,R(P)),e.stroke();}i.eyes==="wide"&&Dr(e,t,r-m*.55,h,m*.45,a,l);}function Zt(e,t,r,o,n,a){let i=t+a*o,c=t-a*o;e.beginPath(),e.moveTo(c,r+n*.15),e.quadraticCurveTo(t,r-n*1.5,i,r-n*.35),e.quadraticCurveTo(t,r+n*1.4,c,r+n*.15),e.closePath();}function Dr(e,t,r,o,n,a,i){e.lineWidth=i*.8;let c=t+a*o;for(let s=0;s<2;s++){let l=r+s*n*.6;e.beginPath(),e.moveTo(c-a*o*.1,l),e.lineTo(c+a*o*.35,l-n*(.7-s*.2)),e.stroke();}}function aa(e,t,r,o){e.beginPath();for(let n=0;n<8;n++){let a=n%2?o*.35:o,i=n*Math.PI/4-Math.PI/2,c=t+Math.cos(i)*a,s=r+Math.sin(i)*a;n?e.lineTo(c,s):e.moveTo(c,s);}e.closePath(),e.fillStyle="#ffffff";}function sa(e,t,r,o,n,a,i,c){if(i.brows==="none")return;let s=o*.095,l=r-n*c.browUp,h=t-a*s,m=t+a*s,p=l-n*c.browInner,b=l+n*c.browInner*.3;if(e.strokeStyle=i.browColor,e.fillStyle=i.browColor,i.brows==="thick"){let y=n*.06;e.beginPath(),e.moveTo(m,b),e.quadraticCurveTo(t,Math.min(b,p)-y*.6,h,p),e.lineTo(h,p+y),e.quadraticCurveTo(t,Math.min(b,p)+y*.5,m,b+y*.6),e.closePath(),e.fill();return}e.lineWidth=o*(i.brows==="arched"?.026:.032),e.beginPath(),e.moveTo(m,b);let g=i.brows==="arched"?n*.09:n*.035;e.quadraticCurveTo(t+a*s*.2,Math.min(b,p)-g,h,p),e.stroke();}function ia(e,t,r,o,n,a,i){let c=o*.026;e.strokeStyle=$e,e.lineWidth=c;let s=o*(a.mouth==="small"?.06:a.mouth==="grin"?.12:.09);switch(i){case "happy":{let l=Math.max(s,o*.1);e.fillStyle=$e,e.beginPath(),e.moveTo(t-l,r-n*.06),e.quadraticCurveTo(t,r-n*.02,t+l,r-n*.06),e.quadraticCurveTo(t,r+n*.2,t-l,r-n*.06),e.closePath(),e.fill(),e.save(),e.clip(),e.fillStyle=Hr,$(e,t,r+n*.1,l*.55,n*.06),e.fill(),a.mouth==="grin"&&(e.fillStyle="#ffffff",e.fillRect(t-l,r-n*.08,l*2,n*.045)),e.restore();return}case "surprised":e.fillStyle=$e,$(e,t,r,o*.045,n*.085),e.fill();return;case "talk":e.fillStyle=$e,$(e,t,r,Math.max(s*.7,o*.06),n*.07),e.fill(),e.save(),e.clip(),e.fillStyle=Hr,$(e,t,r+n*.06,o*.045,n*.035),e.fill(),e.restore();return;case "sad":e.beginPath(),e.moveTo(t-s,r+n*.04),e.quadraticCurveTo(t,r-n*.07,t+s,r+n*.04),e.stroke();return;case "angry":e.beginPath(),e.moveTo(t-s,r+n*.01),e.quadraticCurveTo(t,r-n*.03,t+s,r+n*.01),e.stroke();return;case "scared":{e.beginPath();let l=4;for(let h=0;h<=l;h++){let m=t-s+2*s*h/l,p=r+(h%2?-1:1)*n*.022;h?e.lineTo(m,p):e.moveTo(m,p);}e.stroke();return}case "tired":e.beginPath(),e.moveTo(t-s*.6,r),e.lineTo(t+s*.6,r),e.stroke();return;case "hurt":{e.beginPath();let l=4;for(let h=0;h<=l;h++){let m=t-s+2*s*h/l,p=r+(h%2?-1:1)*n*.04;h?e.lineTo(m,p):e.moveTo(m,p);}e.stroke();return}}if(a.mouth==="cat"){e.beginPath(),e.moveTo(t-s,r-n*.03),e.quadraticCurveTo(t-s*.5,r+n*.06,t,r-n*.01),e.quadraticCurveTo(t+s*.5,r+n*.06,t+s,r-n*.03),e.stroke();return}if(a.mouth==="grin"){e.fillStyle=$e,e.beginPath(),e.moveTo(t-s,r-n*.04),e.quadraticCurveTo(t,r-n*.01,t+s,r-n*.04),e.quadraticCurveTo(t,r+n*.12,t-s,r-n*.04),e.closePath(),e.fill(),e.save(),e.clip(),e.fillStyle="#ffffff",e.fillRect(t-s,r-n*.06,s*2,n*.04),e.restore();return}e.beginPath(),e.moveTo(t-s,r-n*.03),e.quadraticCurveTo(t,r+n*.06,t+s,r-n*.03),e.stroke();}var Vr=16;function la(e,t){if(typeof document<"u"){let r=document.createElement("canvas");return r.width=e,r.height=t,r}return new OffscreenCanvas(e,t)}var vt=class{texture;g;w;h;face;current="neutral";base="neutral";constructor(t){this.face=t,this.w=Math.round(qe[2]*Vr),this.h=Math.round(qe[3]*Vr);let r=la(this.w,this.h),o=r.getContext("2d");if(!o)throw new Error("DrawnFace: no 2D canvas");this.g=o,this.texture=new _.CanvasTexture(r),this.texture.colorSpace=_.SRGBColorSpace,this.texture.anisotropy=4,this.paint("neutral");}paint(t){t!=="blink"&&t!=="talk"&&(this.base=t),this.current=t,Br(this.g,this.w,this.h,this.face,t,this.base),this.texture.needsUpdate=true;}setFace(t){this.face=t,this.paint(this.current);}dispose(){this.texture.dispose();}};var ca={paths:[{x:243,y:-2,d:"M147.333 12.333c-13.6 2.534-12.533 1.2-12.933 15.067l-.4 12.267-4.533-11.067c-2.534-6-5.067-10.933-5.734-10.933-2.666 0-27.866 8.666-36.533 12.666-11.733 5.334-26.667 14.8-36.133 22.934l-6.934 5.866L51.6 69.267c8.133 11.066 7.333 11.466-5.067 2.933-7.6-5.067-8.4-5.333-11.466-3.733-3.467 1.866-18.4 17.333-20.4 21.2-.8 1.6 7.066 8.8 33.733 30.933l34.667 28.933 8.8-8.266c14.666-13.867 28.666-22 48.133-28.267 9.067-2.933 14.8-3.733 28.533-4.4 34.267-1.333 60 7.467 81.6 28.133 21.6 20.4 34.934 49.6 37.467 81.734l.8 11.2 14.8 4.533c8.133 2.533 23.733 7.333 34.667 10.8 10.933 3.333 20.4 5.6 21.066 4.933 1.6-1.6 6.134-20.533 7.734-32.666.8-6 1.333-17.6 1.066-25.6l-.4-14.667-8-1.067c-4.4-.533-10.133-1.466-12.666-1.866l-4.667-.8 4.667-1.2c16.933-4.534 18.666-5.2 18.666-8 0-5.467-9.6-31.334-16.666-44.8-4-7.6-10.667-18.667-14.934-24.667-9.866-13.867-31.333-35.467-45.2-45.2-10.4-7.467-34.4-20.933-37.2-21.067-.8 0-4 4-7.333 8.8-3.2 4.8-6.133 8.134-6.4 7.334s.4-5.6 1.6-10.667c1.2-5.2 2.133-9.6 2.133-9.867 0-.933-19.866-6.133-34.4-9.066-14.8-2.934-49.333-4.4-59.6-2.534"},{x:243,y:-2,d:"M157.867 125.533c-21.067 3.334-42.134 14.8-57.467 31.334-13.333 14.133-13.733 12.8 5.6 22 9.2 4.4 16.667 8.266 16.667 8.533s-1.334.4-2.934.133c-13.866-2.133-41.6-5.866-41.733-5.6-.267.267-7.467 28.534-16.267 63.067l-16 62.667 7.334.4c4 .266 7.466.266 7.6 0 .266-.267 3.866-13.867 8.133-30.4 4.267-16.534 8.267-30.8 8.933-31.734.934-1.2 11.067-1.6 42.4-1.6 32.134 0 41.2.4 41.2 1.6 0 .934-1.733 4.667-3.866 8.4L153.733 261l-35.066 6.933c-19.334 3.867-35.2 7.2-35.467 7.467-.667.667-29.867 113.467-29.467 113.867.267.133 23.734-3.6 52.4-8.534l52-8.8 20.4-39.866c11.2-22 20.667-39.734 20.934-39.467.4.533-1.334 26.8-2.8 40.8l-.667 6.933 6.267-3.2c21.2-10.666 52.4-13.466 86.933-8l5.867.934-5.6-7.334C286.4 318.6 281.2 310.6 278 304.867c-5.867-10.134-6-10.8-6-21.867 0-6.267 1.467-20 3.333-30.667 1.867-10.666 3.334-19.466 3.334-19.466 0-.134-9.067-4.267-20.134-9.334s-19.466-9.333-18.8-9.6c.8-.266 7.734.8 15.6 2.267 7.734 1.6 14.4 2.8 14.8 2.8 1.2 0 .4-10.533-1.466-18-7.2-27.733-28-53.467-53.734-66-16.4-8-40.8-12-57.066-9.467"},{x:243,y:-2,d:"M235.6 346.333c-24 4.534-44.133 13.867-68.267 31.467-14 10.267-28.533 18.133-47.733 25.867-23.467 9.466-52.8 32.666-64.4 50.666l-2.533 4L58 454.2c9.333-7.333 30.133-19.467 49.333-28.667C173.733 393.667 246.4 382.2 312.8 393c11.2 1.733 39.2 8.533 45.067 10.8 2.266.8 2.266.667.8-2.267-4-7.6-15.6-21.866-25.867-31.466-12-11.467-24.667-18.934-37.6-22.4-11.467-3.067-46.267-3.867-59.6-1.334"},{x:-460,y:467,d:"M721.533 34.467c-14.933 5.466-22 17.466-22.933 38.666-.933 24.134 3.467 32.8 30.267 59.867 19.6 19.867 22.933 25.2 22.933 37.867.133 13.466-6.133 20.133-16.933 18.4-9.067-1.467-12.534-7.867-12.534-22.667V159H696.6l.667 13.333c.533 11.467 1.2 14.4 4.933 22 7.067 14.267 16.8 19.6 36.4 19.734 10.667.133 12.267-.134 20.667-4.4 7.6-3.867 9.733-5.867 13.2-11.734 7.6-12.533 9.066-32 3.733-47.6-3.733-11.066-10.667-20.4-27.867-37.2-19.866-19.6-22.533-24.133-22.666-38.4 0-8.933.4-10.533 3.2-13.6 6.266-6.666 18.266-5.6 22.133 2 1.067 2 2 7.067 2 11.2v7.334h27.067l-.934-9.2c-1.6-18.267-8.266-30.267-20-36.4-7.2-3.867-29.2-4.8-37.6-1.6M630.067 34.867c-11.734 4.666-18 11.6-21.734 24.4-1.866 6.4-2 15.333-1.733 67.2l.4 59.866 3.733 7.6c6.8 13.867 18.534 20.267 36.934 20.267 13.733 0 22.933-3.333 30.666-11.067 10.934-11.066 11.2-12.533 11.734-74.666.266-35.734-.134-56.934-1.067-62.8-2.667-16.134-11.6-27.467-24.8-31.467-8.933-2.667-26.4-2.267-34.133.667m28.666 26.8 3.6 4v56.666c0 40.934-.4 57.467-1.6 60-3.6 8-15.6 9.734-22.666 3.467l-4.4-3.867-.4-56.533c-.267-51.733-.134-56.8 2-61.067 3.066-5.866 7.6-8.266 14.4-7.466 3.733.4 6.4 1.866 9.066 4.8M511.667 123.133v89.334l29.066-.4c28.8-.4 28.934-.4 36.667-4.267 9.467-4.533 14.4-10.933 17.467-22.4 2-7.333 2.266-15.467 1.866-65.733l-.4-57.334-4.266-8.8c-8.267-16.666-17.2-19.866-55.334-19.866h-25.066zm53.6-60.266 4.4 3.866.4 52.8c.266 35.067-.134 54.4-1.067 58-2 7.467-5.733 9.6-18.667 10.4l-10.666.8V59h10.666c9.867 0 10.934.267 14.934 3.867M471.667 145v67.333h26.666V77.667h-26.666zM471.667 48.333V63h26.666V33.667h-26.666z"},{x:-106,y:244,d:"M893.4 259.733c-6.8 3.467-9.2 5.6-12.667 11.467-10.666 17.733-9.2 42.933 3.467 62.267 2.8 4.266 12.267 14.8 20.933 23.333 9.867 9.467 17.067 17.733 18.934 21.6 5.6 11.333 5.2 25.333-.934 30.8-3.466 3.067-11.333 4.133-16.133 2.133-5.867-2.4-8-7.466-8-19.333v-10h-27.067l.8 11.6c1.2 15.867 3.867 24.133 10.267 31.333 7.467 8.534 16.4 12.134 30 12.267 19.067.133 30.133-5.733 37.333-19.867 3.734-7.466 4-8.666 4-24 0-16 0-16.133-5.2-26.666-4.4-9.2-7.733-13.2-23.066-28.534-21.067-21.066-24.8-27.066-24.934-40.4-.133-10.4 2.8-15.6 9.734-17.6 10.133-2.933 17.2 3.334 18.4 16.267l.8 8.267H955.4l-.8-10.8c-.533-8.4-1.6-12.667-4.8-19.2-7.067-14.134-16.667-19.334-36.133-19.334-10.667 0-12.534.4-20.267 4.4M791 346v89.333h76v-24h-48v-54.666h37.333v-24H819V282h48v-25.333h-76zM661.667 346v89.333h22.666l.134-63.066c0-34.534.533-61.734 1.066-60.267.534 1.467 5.467 29.867 10.8 62.933l9.867 60.4h13.067c7.2 0 13.066-.4 13.066-1.066 0-3.067 18.8-124.8 19.334-125.334.4-.4.666 27.867.666 62.8v63.6h25.334V256.667h-38l-9.2 61.6c-5.067 34-9.6 62.133-10 62.666-.534.534-5.334-26.4-10.667-60-5.467-33.466-10.133-61.733-10.533-62.666-.4-1.2-5.467-1.6-19.067-1.6h-18.533zM586.467 258.267c-.8 2.666-27.467 172.4-27.467 174.933 0 1.867 1.733 2.133 12 2.133h11.867l.8-4.4c.533-2.266 1.6-9.333 2.4-15.6l1.6-11.333 17.6-.4 17.466-.4 1.467 8.4c.8 4.667 1.733 11.867 2.267 16l.933 7.733h13.733c7.6 0 13.867-.266 13.867-.666 0-.8-26.533-168.134-27.467-173.734l-.8-4.266h-19.866c-14.8 0-20.134.4-20.4 1.6M613 336.533c3.333 23.067 5.867 42.134 5.6 42.4-.4.267-6.533.267-13.867.134l-13.2-.4 4.934-33.334c2.8-18.4 5.733-38.4 6.666-44.666C604.2 292.533 605 290.133 605.8 292c.533 1.467 3.867 21.467 7.2 44.533M497.267 257.2c-10.134 3.733-15.2 8.267-19.867 17.733L473 284l-.4 59.067c-.4 51.2-.133 60.133 1.733 66.533 5.6 19.333 17.067 27.333 39.467 27.467 10.267.133 12.267-.267 20.133-4.134 9.334-4.533 13.867-9.733 17.867-20.266 2-4.934 2.4-12 2.933-41.067l.534-34.933h-38.934v23.866l6.4.4 6.267.4v19.334c0 13.466-.533 20.666-1.867 23.733-5.066 12-23.333 10.4-26.8-2.4-.933-3.6-1.333-23.2-1.066-59.067.4-48.533.666-54.133 2.666-57.333 3.334-4.8 11.2-7.067 17.6-4.933 6.934 2.266 9.067 7.2 9.867 22.933l.667 13.067H555.4l-.8-15.734c-.8-18-3.067-25.6-9.867-33.466-7.466-8.8-13.466-11.2-29.066-11.734-9.067-.266-14.934.134-18.4 1.467"}]},pa={helmet:{paths:[0,1,2],box:[258,10,353,447]},wordmark:{paths:[3,4],box:[12,499,837,182]}},ha={"top.idos":{color:"#f8f8fc",faces:["front","back"],layers:[{art:"helmet",y:19.4,z:2.3,height:3.9},{art:"wordmark",y:14.85,z:2.15,width:6.2}]}},jr=512,Ur=.02,Gr=new Map;function ma(e,t){if(typeof document<"u"){let r=document.createElement("canvas");return r.width=e,r.height=t,r}return new OffscreenCanvas(e,t)}function da(e,t,r){let o=`${e}:${r}`,n=Gr.get(o);if(n)return n;if(typeof Path2D>"u")return null;let[a,i,c,s]=t.box,l=s*Ur,h=jr/(s+2*l),m=ma(Math.round((c+2*l)*h),jr),p=m.getContext("2d");if(!p)return null;p.clearRect(0,0,m.width,m.height),p.fillStyle=r;for(let g of t.paths){let y=ca.paths[g];p.setTransform(h,0,0,h,(y.x-a+l)*h,(y.y-i+l)*h),p.fill(new Path2D(y.d));}let b=new _.CanvasTexture(m);return b.colorSpace=_.SRGBColorSpace,b.anisotropy=4,Gr.set(o,b),b}function Qt(e){let t=[];for(let r of ke){let o=e.wear[r],n=o?ha[o]:void 0;if(n)for(let a of n.layers){let i=pa[a.art],c=da(a.art,i,n.color);if(!c)continue;let[,,s,l]=i.box,h=s/l,m=a.height??(a.width??1)/h,p=a.width??m*h,b=2*Ur*m;for(let g of n.faces){let y=(g==="front"?-1:1)*(a.z+.03),T=[0,a.y,y];t.push({bone:"body",center:T,w:p+b,h:m+b,facing:g,texture:c});}}}return t}var At=class extends yt{face;rest;mood="neutral";constructor(t,r,o={}){let n=new vt(t.face);super(Jt(t,r),{...o,facePainter:n}),this.face=n,this.rest=t.face.emotion,this.view.setPrints(Qt(t)),this.applyMood();}setEmotion(t){this.mood=t,this.applyMood();}setAvatar(t,r){this.face.setFace(t.face),this.rest=t.face.emotion,this.setSpec(Jt(t,r)),this.view.setPrints(Qt(t)),this.applyMood();}applyMood(){super.setEmotion(this.mood==="neutral"?this.rest:this.mood),this.animator.moodOverGestures=this.rest!=="neutral";}dispose(){super.dispose(),this.face.dispose();}};var $i=["#a99cff","#5b4bd6"];function fa(e){e.add(new _.HemisphereLight(16777215,9076856,1.7));let t=new _.DirectionalLight(16777215,1.3);t.position.set(2,4,-3),e.add(t);}function ua(e,t){switch(t){case "full":return {center:new _.Vector3(0,e*.5,0),size:e*1.12,lift:.04};case "torso":return {center:new _.Vector3(0,e*.57,0),size:e*.5,lift:.06};case "legs":return {center:new _.Vector3(0,e*.2,0),size:e*.5,lift:.1};case "feet":return {center:new _.Vector3(0,e*.08,0),size:e*.32,lift:.3};case "face":return {center:new _.Vector3(0,e*.86,0),size:e*.34,lift:.04};case "head":return {center:new _.Vector3(0,e*.88,0),size:e*.5,lift:.08};default:return {center:new _.Vector3(0,e*.8,0),size:e*.56,lift:.08}}}function ba(e){return typeof e=="number"?e:e==="side"?Math.PI/2:e==="back"?Math.PI:.18}function Yr(e,t,r,o,n,a){let i=a.frame??"portrait",c={...o,face:{...o.face,emotion:"neutral"}},s=new At(c,n,{seed:7});try{e.setClearColor(0,0);let l=new _.Scene;fa(l),s.group.rotation.y=ba(a.view),l.add(s.group);for(let f=0;f<20;f++)s.update(1/30);s.view.setExpression(a.expression??o.face.emotion);let{center:h,size:m,lift:p}=ua(s.height,i),b=28,g=new _.PerspectiveCamera(b,1,.05,50),y=m/2/Math.tan(_.MathUtils.degToRad(b/2));g.position.set(h.x,h.y+m*p,h.z-y),g.lookAt(h),e.render(l,g);let T=document.createElement("canvas");T.width=r,T.height=r;let A=T.getContext("2d");if(!A)return t;let w=a.background;if(typeof w=="string")A.fillStyle=w,A.fillRect(0,0,r,r);else if(w){let f=A.createRadialGradient(r*.5,r*.38,r*.05,r*.5,r*.5,r*.72);f.addColorStop(0,w[0]),f.addColorStop(1,w[1]),A.fillStyle=f,A.fillRect(0,0,r,r);}return A.imageSmoothingEnabled=!a.pixelated,A.drawImage(t,0,0),T}finally{s.dispose();}}function qr(e,t){let r=document.createElement("canvas");r.width=e,r.height=e;let o=new _.WebGLRenderer({canvas:r,antialias:!t,alpha:true,preserveDrawingBuffer:true});return o.setPixelRatio(1),o.setSize(e,e,false),{renderer:o,gl:r}}function ya(e,t,r={}){let o=Math.max(16,Math.round(r.size??256)),{renderer:n,gl:a}=qr(o,!!r.pixelated);try{return Yr(n,a,o,e,t,r)}finally{n.dispose(),n.forceContextLoss();}}function $r(e={}){let t=Math.max(16,Math.round(e.size??256)),r=qr(t,!!e.pixelated);return {render(o,n,a={}){if(!r)throw new Error("snapshotter disposed");return Yr(r.renderer,r.gl,t,o,n,{...a,pixelated:e.pixelated})},dispose(){r&&(r.renderer.dispose(),r.renderer.forceContextLoss(),r=null);}}}function Wi(e,t,r={}){let o=ya(e,t,r);return new Promise(n=>o.toBlob(a=>n(a),"image/png"))}function Ki(e){if(!e?.spec)return null;let t={};for(let r of e.items??[])r&&typeof r.id=="string"&&(t[r.id]=r);return {spec:wt(e.spec),items:t}}function te(e){let t=xt(e);if(!t.ok)throw new Error(`avatar shop: ${String(e.id)}: ${t.errors.join("; ")}`);return t.item}var er=e=>({w:e[0].length,h:e.length,rows:e}),ga={bone:"head",size:[9.21,2.05,8.73],pos:[0,29.91,0],color:"a"},wa={bone:"head",size:[9.21,1.7,.73],pos:[0,28.72,-4.36],color:"a"},Wr=[{price:250,item:te({id:"hat.crown",slot:"hat",name:"Crown",palette:{a:"#e8b730",g:"#d23c4a"},tint:"a",parts:[{bone:"head",size:[9.21,1.7,.73],pos:[0,30.93,-4.36],color:"a"},{bone:"head",size:[9.21,1.7,.73],pos:[0,30.93,4.36],color:"a"},{bone:"head",size:[.71,1.7,8.73],pos:[4.6,30.93,0],color:"a",mirror:true},{bone:"head",size:[1.13,1.36,.73],pos:[2.98,32.47,-4.36],color:"a",mirror:true},{bone:"head",size:[1.13,1.77,.73],pos:[0,32.67,-4.36],color:"a"},{bone:"head",size:[.99,.95,.29],pos:[0,30.93,-4.87],color:"g"}]})},{price:250,item:te({id:"back.wings",slot:"back",name:"Angel wings",palette:{a:"#f7f5ff",b:"#d9d4f2"},tint:"a",parts:[{bone:"body",size:[2.25,7.5,1.47],pos:[1.69,21.15,3.04],color:"b",mirror:true},{bone:"body",size:[10.13,3.13,.74],pos:[7.31,26.15,3.86],color:"a",mirror:true},{bone:"body",size:[10.13,3.13,.74],pos:[7.88,23.03,4.05],color:"b",mirror:true},{bone:"body",size:[9,3.13,.74],pos:[8.44,19.9,4.23],color:"a",mirror:true},{bone:"body",size:[6.75,3.13,.74],pos:[9,16.77,4.42],color:"b",mirror:true},{bone:"body",size:[4.5,3.13,.74],pos:[9.56,13.65,4.6],color:"a",mirror:true},{bone:"body",size:[3.38,1.88,.74],pos:[11.25,28.65,3.86],color:"a",mirror:true}]})},{price:200,item:te({id:"hat.wizard",slot:"hat",name:"Wizard hat",palette:{a:"#3c2f8f",s:"#f2c14e"},tint:"a",parts:[{bone:"head",size:[10.63,.55,10.18],pos:[0,30.39,0],color:"a"},{bone:"head",size:[8.5,1.77,8],pos:[0,31.55,0],color:"a"},{bone:"head",size:[6.38,1.77,5.82],pos:[0,33.32,.36],color:"a"},{bone:"head",size:[4.25,1.77,4],pos:[0,35.09,.73],color:"a"},{bone:"head",size:[2.13,1.64,2.18],pos:[0,36.8,1.09],color:"a"},{bone:"head",size:[1.13,1.09,.29],pos:[0,31.61,-4.15],color:"s"}]})},{price:200,item:te({id:"top.armor",slot:"top",name:"Knight armor",palette:{a:"#b8c2cc",b:"#5b6672",g:"#e8b730"},tint:"a",paint:[{region:"torso",color:"b"},{region:"arms",color:"b"}],parts:[{bone:"body",size:[9.67,7.5,.74],pos:[0,18.65,-2.67],color:"a"},{bone:"armR",size:[4.32,2.94,4.32],pos:[6.3,22.38,0],color:"a",mirror:true},{bone:"body",size:[2.25,2.5,.37],pos:[0,19.27,-3.22],color:"g"}]})},{price:200,item:te({id:"back.sword",slot:"back",name:"Sword",palette:{a:"#d8dde4",g:"#e8b730",h:"#5a3a22"},tint:"g",parts:[{bone:"body",size:[1.35,12.5,.55],pos:[2.81,17.4,3.04],color:"a"},{bone:"body",size:[4.5,1.13,.92],pos:[2.81,24.21,3.04],color:"g"},{bone:"body",size:[1.01,3.75,.83],pos:[2.81,26.65,3.04],color:"h"},{bone:"body",size:[1.58,1.5,1.1],pos:[2.81,29.28,3.04],color:"g"}]})},{price:150,item:te({id:"hat.headphones",slot:"hat",name:"Headphones",palette:{a:"#2b2140",b:"#4be0c8"},tint:"b",parts:[{bone:"head",size:[9.63,.82,1.45],pos:[0,31.07,0],color:"a"},{bone:"head",size:[.57,3.41,.87],pos:[4.89,29.57,0],color:"a",mirror:true},{bone:"head",size:[1.13,2.45,2.62],pos:[4.96,27.39,0],color:"a",mirror:true},{bone:"head",size:[.28,1.64,1.75],pos:[5.6,27.39,0],color:"b",mirror:true}]})},{price:150,item:te({id:"hair.mohawk",slot:"hair",name:"Mohawk",palette:{a:"#d4537e"},tint:"a",parts:[{bone:"head",size:[1.84,3.07,8],pos:[0,31.78,0],color:"a"},{bone:"head",size:[1.84,2.05,1.45],pos:[0,31.27,-4.73],color:"a"},{bone:"head",size:[2.13,4.09,.73],pos:[0,28.2,4.36],color:"a"}]})},{price:150,item:te({id:"top.suit",slot:"top",name:"Suit and tie",palette:{a:"#2c2f3a",w:"#f4f1ea",r:"#c0392b"},tint:"a",textures:{front:er(["awwrrwwa","aawrrwaa","aaarraaa","aaarraaa","aaarraaa","aaaaaaaa","aaaaaaaa","aaaaaaaa"])},paint:[{region:"torso",color:"a",faces:{front:"front"}},{region:"arms",color:"a"}],parts:[{bone:"body",size:[1.35,1,.28],pos:[-2.92,19.9,-2.44],color:"w"}]})},{price:120,item:te({id:"hair.ponytail",slot:"hair",name:"Ponytail",palette:{a:"#3b2a20",b:"#d4537e"},tint:"a",parts:[ga,wa,{bone:"head",size:[.71,3.41,7.27],pos:[4.6,27.86,.36],color:"a",mirror:true},{bone:"head",size:[9.21,4.77,.73],pos:[0,27.18,4.36],color:"a"},{bone:"head",size:[2.27,1.02,1.75],pos:[0,28.55,4.95],color:"b"},{bone:"head",size:[1.84,5.45,1.45],pos:[0,25.82,5.09],color:"a"}]})},{price:120,item:te({id:"face.visor",slot:"faceAcc",name:"Cyber visor",palette:{a:"#33e0ff",b:"#1d1d21"},tint:"a",parts:[{bone:"head",size:[7.79,1.77,.36],pos:[0,25.89,-4.29],color:"a"},{bone:"head",size:[.35,1.02,1.89],pos:[4.07,26.16,-3.27],color:"b",mirror:true}]})},{price:100,item:te({id:"shoes.hightops",slot:"shoes",name:"High-tops",palette:{a:"#7f77dd",w:"#f4f1ea",b:"#2b2140"},tint:"a",textures:{toe:er(["aaaa","wwww"]),side:er(["aaaaa","wwwww"])},paint:[{region:"feet",color:"a",faces:{front:"toe",back:"toe",left:"side",right:"side",bottom:"w"}}],parts:[{bone:"shinR",size:[4.62,4.32,4.62],pos:[2.1,3.76,0],color:"b",mirror:true}]})},{price:50,item:te({id:"hands.gauntlets",slot:"hands",name:"Golden gauntlets",palette:{a:"#e8b730",b:"#b8862a"},tint:"a",paint:[{region:"hands",color:"a"}],parts:[{bone:"foreArmR",size:[4.32,1.75,4.32],pos:[6.3,13.78,0],color:"b",mirror:true}]})},{price:50,item:te({id:"waist.pouch",slot:"waist",name:"Belt pouch",palette:{a:"#3a2a22",b:"#7a5233"},tint:"b",parts:[{bone:"body",size:[9.45,1.25,4.97],pos:[0,13.15,0],color:"a"},{bone:"body",size:[2.7,2.5,1.29],pos:[2.93,11.9,-3.04],color:"b"}]})}],Kr=Wr.map(e=>e.item),tr=Object.fromEntries(Wr.map(e=>[e.item.id,e.price])),Xr=e=>Object.prototype.hasOwnProperty.call(tr,e);function N(e){let t=xt(e);if(!t.ok)throw new Error(`avatar catalog: ${String(e.id)}: ${t.errors.join("; ")}`);return t.item}var Me=e=>({w:e[0].length,h:e.length,rows:e}),We={bone:"head",size:[9.21,2.05,8.73],pos:[0,29.91,0],color:"a"},rr={bone:"head",size:[.71,1.7,2.8],pos:[4.5,28.72,-2.9],color:"a",mirror:true},Ke={bone:"head",size:[9.21,1.7,.73],pos:[0,28.72,-4.36],color:"a"},xa=[N({id:"hair.short",slot:"hair",name:"Short",palette:{a:"#3b2a20"},tint:"a",parts:[We,Ke,rr,{bone:"head",size:[.71,3.41,7.58],pos:[4.6,27.86,.51],color:"a",mirror:true},{bone:"head",size:[9.21,4.77,.73],pos:[0,27.18,4.36],color:"a"}]}),N({id:"hair.bob",slot:"hair",name:"Bob",palette:{a:"#3b2a20"},tint:"a",parts:[We,Ke,{bone:"head",size:[1.06,6.13,8.6],pos:[4.78,26.84,.3],color:"a",mirror:true},{bone:"head",size:[9.21,6.14,1.09],pos:[0,26.5,4.55],color:"a"}]}),N({id:"hair.spiky",slot:"hair",name:"Spiky",palette:{a:"#3b2a20"},tint:"a",parts:[We,Ke,{bone:"head",size:[.71,2.73,8.6],pos:[4.6,28.2,0],color:"a",mirror:true},{bone:"head",size:[9.21,2.73,.73],pos:[0,28.2,4.36],color:"a"},{bone:"head",size:[2.13,2.05,2.18],pos:[2.83,31.61,-0.73],color:"a",mirror:true},{bone:"head",size:[2.13,2.73,2.18],pos:[0,31.95,-0.73],color:"a"},{bone:"head",size:[2.13,2.05,2.18],pos:[-1.42,31.61,2.18],color:"a"},{bone:"head",size:[2.13,2.05,2.18],pos:[1.77,31.75,1.82],color:"a"}]}),N({id:"hair.long",slot:"hair",name:"Long",palette:{a:"#3b2a20"},tint:"a",parts:[We,Ke,rr,{bone:"head",size:[1.06,6.82,7.88],pos:[4.78,26.16,.66],color:"a",mirror:true},{bone:"head",size:[9.21,7.5,1.09],pos:[0,26.16,4.55],color:"a"}]}),N({id:"hair.bun",slot:"hair",name:"Bun",palette:{a:"#3b2a20"},tint:"a",parts:[We,Ke,rr,{bone:"head",size:[.71,2.73,6.48],pos:[4.6,28.2,1.06],color:"a",mirror:true},{bone:"head",size:[9.21,4.09,.73],pos:[0,27.52,4.36],color:"a"},{bone:"head",size:[4.25,3.41,3.64],pos:[0,32.64,1.82],color:"a"}]}),N({id:"hair.curly",slot:"hair",name:"Curly",palette:{a:"#3b2a20"},tint:"a",parts:[{bone:"head",size:[9.92,2.39,9.45],pos:[0,30.08,0],color:"a"},{bone:"head",size:[9.21,1.36,.73],pos:[0,28.89,-4.8],color:"a"},{bone:"head",size:[2.83,2.73,2.91],pos:[3.54,28.89,-2.55],color:"a",mirror:true},{bone:"head",size:[2.83,2.73,2.91],pos:[3.54,28.89,1.82],color:"a",mirror:true},{bone:"head",size:[5.67,2.05,5.82],pos:[0,31.61,0],color:"a"},{bone:"head",size:[4.25,4.27,2.18],pos:[2.13,27.27,4],color:"a",mirror:true}]})],va=[N({id:"top.idos",slot:"top",name:"iDos Games tee",palette:{a:"#1565ff"},tint:null,paint:[{region:"torso",color:"a"},{region:"sleeves",color:"a"}]}),N({id:"top.tee",slot:"top",name:"Star tee",palette:{a:"#1d9e75",b:"#f4f1ea"},tint:"a",textures:{print:Me(["aaaaaaaa","aaabbaaa","aabbbbaa","abbbbbba","aabbbbaa","aabaabaa","aaaaaaaa","aaaaaaaa"])},paint:[{region:"torso",color:"a",faces:{front:"print"}},{region:"sleeves",color:"a"}]}),N({id:"top.hoodie",slot:"top",name:"Hoodie",palette:{a:"#378add",b:"#24578f",w:"#f0f0f0"},tint:"a",paint:[{region:"torso",color:"a"},{region:"arms",color:"a"}],parts:[{bone:"body",size:[7.88,4.38,1.84],pos:[0,21.78,3.04],color:"a"},{bone:"body",size:[5.63,2.5,.46],pos:[0,15.52,-2.53],color:"b"},{bone:"body",size:[.56,2.75,.37],pos:[1.24,19.65,-2.48],color:"w",mirror:true}]}),N({id:"top.stripes",slot:"top",name:"Striped sweater",palette:{a:"#d4537e",b:"#f4f1ea"},tint:"a",textures:{st:Me(["aaaaaaaa","aaaaaaaa","bbbbbbbb","aaaaaaaa","aaaaaaaa","bbbbbbbb","aaaaaaaa","aaaaaaaa"]),sl:Me(["aaa","bbb","aaa","bbb","aaa"])},paint:[{region:"torso",color:"a",faces:{front:"st",back:"st",left:"st",right:"st"}},{region:"arms",color:"a",faces:{front:"sl",back:"sl",left:"sl",right:"sl"}}]}),N({id:"top.jacket",slot:"top",name:"Jacket",palette:{a:"#444441",b:"#f4f1ea",c:"#c8c2b4"},tint:"a",textures:{open:Me(["aaabbaaa","aaabbaaa","aaabbaaa","aaabbaaa","aaabbaaa","aacbbcaa","aaabbaaa","aaabbaaa"])},paint:[{region:"torso",color:"a",faces:{front:"open"}},{region:"arms",color:"a"}],parts:[{bone:"body",size:[3.38,1.5,.92],pos:[2.48,22.53,-2.21],color:"a",mirror:true}]}),N({id:"top.tank",slot:"top",name:"Tank top",palette:{a:"#ef9f27"},tint:"a",paint:[{region:"torso",color:"a"}]})],Ra=[N({id:"bottom.jeans",slot:"bottom",name:"Jeans",palette:{a:"#2f5fd0",b:"#24489e"},tint:"a",textures:{seam:Me(["aaab","aaab","aaab","aaab","aaab"])},paint:[{region:"legs",color:"a",faces:{front:"seam"}}]}),N({id:"bottom.shorts",slot:"bottom",name:"Shorts",palette:{a:"#5f6b7a",s:"@skin"},tint:"a",paint:[{region:"legs",color:"s"}],parts:[{bone:"legR",size:[4.62,5.4,4.62],pos:[2.1,9.7,0],color:"a",mirror:true}]}),N({id:"bottom.skirt",slot:"bottom",name:"Skirt",palette:{a:"#7f77dd",s:"@skin"},tint:"a",paint:[{region:"legs",color:"s"}],parts:[{bone:"body",size:[10.13,4.38,5.52],pos:[0,11.46,0],color:"a"}]}),N({id:"bottom.cargo",slot:"bottom",name:"Cargo pants",palette:{a:"#6b6b4a",b:"#55553a"},tint:"a",paint:[{region:"legs",color:"a"}],parts:[{bone:"legR",size:[.84,4.32,2.52],pos:[4.62,7,0],color:"b",mirror:true}]})],Ea=[N({id:"shoes.sneakers",slot:"shoes",name:"Sneakers",palette:{a:"#d84a30",w:"#f4f1ea"},tint:"a",textures:{toe:Me(["aaaa","wwww"]),side:Me(["aaaaa","wwwww"])},paint:[{region:"feet",color:"a",faces:{front:"toe",back:"toe",left:"side",right:"side",bottom:"w"}}]}),N({id:"shoes.boots",slot:"shoes",name:"Boots",palette:{a:"#5a3a22",b:"#3a2414"},tint:"a",paint:[{region:"feet",color:"a",faces:{bottom:"b"}}],parts:[{bone:"shinR",size:[4.83,4.32,4.83],pos:[2.1,3.76,0],color:"a",mirror:true}]}),N({id:"shoes.sandals",slot:"shoes",name:"Sandals",palette:{a:"#b0773a",s:"@skin"},tint:"a",paint:[{region:"feet",color:"s"}],parts:[{bone:"shinR",size:[4.51,.48,5.57],pos:[2.1,.24,-0.53],color:"a",mirror:true},{bone:"shinR",size:[4.51,.4,1.05],pos:[2.1,1.12,-1.89],color:"a",mirror:true}]})],Aa=[N({id:"hands.gloves",slot:"hands",name:"Gloves",palette:{a:"#2b2140"},tint:"a",paint:[{region:"hands",color:"a"}]})],Sa=[N({id:"waist.belt",slot:"waist",name:"Belt",palette:{a:"#5a3a22",g:"#d8b030"},tint:"a",parts:[{bone:"body",size:[9.45,1.25,4.97],pos:[0,13.15,0],color:"a"},{bone:"body",size:[1.8,1.5,.37],pos:[0,13.15,-2.67],color:"g"}]})],ka=[N({id:"back.backpack",slot:"back",name:"Backpack",palette:{a:"#c0612b",b:"#8a3f18"},tint:"a",parts:[{bone:"body",size:[6.75,8.75,2.76],pos:[0,17.4,3.68],color:"a"},{bone:"body",size:[4.5,3.75,.55],pos:[0,14.9,5.34],color:"b"}]}),N({id:"back.cape",slot:"back",name:"Cape",palette:{a:"#a32d2d"},tint:"a",parts:[{bone:"body",size:[10.13,12.5,.55],pos:[0,16.15,2.67],color:"a"}]})],Ta=[N({id:"face.glasses",slot:"faceAcc",name:"Round glasses",palette:{a:"#2b2140"},tint:"a",parts:[{bone:"head",size:[2.41,.27,.29],pos:[1.56,26.84,-4.29],color:"a",mirror:true},{bone:"head",size:[2.41,.27,.29],pos:[1.56,24.73,-4.29],color:"a",mirror:true},{bone:"head",size:[.28,2.39,.29],pos:[2.9,25.78,-4.29],color:"a",mirror:true},{bone:"head",size:[1.13,.27,.29],pos:[0,26.3,-4.29],color:"a"}]}),N({id:"face.shades",slot:"faceAcc",name:"Sunglasses",palette:{a:"#1d1d21"},tint:"a",parts:[{bone:"head",size:[2.55,1.64,.29],pos:[1.56,25.89,-4.29],color:"a",mirror:true},{bone:"head",size:[6.23,.34,.29],pos:[0,26.77,-4.29],color:"a"}]})],Ca=[N({id:"hat.beanie",slot:"hat",name:"Beanie",palette:{a:"#534ab7",w:"#f4f1ea"},tint:"a",parts:[{bone:"head",size:[9.92,3.07,9.45],pos:[0,30.76,0],color:"a"},{bone:"head",size:[10.34,1.36,9.89],pos:[0,29.3,0],color:"a"},{bone:"head",size:[2.13,2.05,2.18],pos:[0,33.18,0],color:"w"}]}),N({id:"hat.cap",slot:"hat",name:"Cap",palette:{a:"#c0392b"},tint:"a",parts:[{bone:"head",size:[9.63,2.73,9.16],pos:[0,30.8,.15],color:"a"},{bone:"head",size:[7.79,.55,3.64],pos:[0,29.57,-5.96],color:"a"}]}),N({id:"hat.bucket",slot:"hat",name:"Bucket hat",palette:{a:"#c8b88a"},tint:"a",parts:[{bone:"head",size:[9.63,2.73,9.16],pos:[0,31.61,0],color:"a"},{bone:"head",size:[11.33,.55,10.91],pos:[0,30.39,0],color:"a"}]})],St=[...xa,...va,...Ra,...Ea,...Aa,...Sa,...ka,...Ta,...Ca,...Kr],tl=Object.fromEntries(St.map(e=>[e.id,e]));function Ma(e){return St.filter(t=>t.slot===e)}function Jr(e){return Ma(e).filter(t=>!Xr(t.id))}var Ia=["#f9e0cf","#f2c9a0","#e2ad80","#c88d62","#9c6844","#6e4a32"],Pa=["#3b2a20","#1d1d21","#f2c14e","#c0612b","#ece6da","#7f77dd","#d4537e","#2ab0a0"],La=["#3b2a20","#2f5fd0","#1d9e75","#7f77dd","#c0392b","#d8b030"],_a=["#1d9e75","#378add","#d4537e","#444441","#ef9f27","#534ab7","#c0392b","#e8e4da"],Qr={version:Se,style:oe,body:{skin:"#f2c9a0",height:1},face:{eyes:"round",eyeColor:"#3b2a20",brows:"soft",browColor:"#3b2a20",mouth:"smile",cheeks:true,emotion:"neutral"},wear:{hair:"hair.short",top:"top.idos",bottom:"bottom.jeans",shoes:"shoes.sneakers"},tint:{}},Zr={hair:.92,top:1,bottom:1,shoes:1,hands:.1,waist:.2,back:.2,faceAcc:.25,hat:.35};function al(e=Math.random){let t=a=>a[Math.floor(e()*a.length)],r=t(Pa),o={},n={};for(let a of Object.keys(Zr)){if(e()>=Zr[a])continue;let i=Jr(a);i.length&&(o[a]=t(i).id,n[a]=a==="hair"?r:t(_a));}return {version:Se,style:oe,body:{skin:t(Ia),height:.95+e()*.1},face:{eyes:t(Ge),eyeColor:t(La),brows:t(Ue),browColor:r==="#ece6da"||r==="#f2c14e"?"#8a6a3a":r,mouth:t(Ye),cheeks:e()<.6,emotion:"neutral"},wear:o,tint:n}}var za={hair:{frame:"portrait",view:.5},hat:{frame:"head",view:.35},faceAcc:{frame:"portrait",view:.2},top:{frame:"torso",view:.3},waist:{frame:"torso",view:.3},hands:{frame:"torso",view:.55},bottom:{frame:"legs",view:.3},shoes:{frame:"feet",view:.6},back:{frame:"full",view:Math.PI-.6}},Oa=["hair","top","bottom","shoes"];function Fa(e,t){let r=wt(JSON.parse(JSON.stringify(Qr)));for(let o of Object.keys(r.wear))Oa.includes(o)||delete r.wear[o];return r.tint={},r.wear[e]=t,r}function pl(e,t){return {key:`item:${e.id}`,make:()=>({spec:Fa(e.slot,e.id),items:{...t,[e.id]:e},opts:za[e.slot]})}}function hl(e={}){let t=e.size??224,r=e.limit??800,o=e.budgetMs??14,n=new Map,a=new Map,i=[],c=null,s=false,l=(p,b)=>{for(n.delete(p),n.set(p,b);n.size>r;){let g=n.keys().next().value;URL.revokeObjectURL(n.get(g)),n.delete(g);}},h=()=>{if(s)return;s=true;let p=globalThis.requestIdleCallback;p?p(m,{timeout:120}):setTimeout(m,16);};function m(){s=false;let p=performance.now();for(;i.length&&performance.now()-p<o;){let b=i.shift(),g=a.get(b);if(g&&(a.delete(b),g.listeners.size!==0))try{c??=$r({size:t});let{spec:y,items:T,opts:A}=g.make(),w=c.render(y,T,A),f=[...g.listeners];w.toBlob(S=>{if(!S)return;let d=URL.createObjectURL(S);l(b,d);for(let x of f)x(d);},"image/png");}catch{c?.dispose(),c=null;}}i.length&&h();}return {peek:p=>n.get(p)??null,request(p,b){let g=n.get(p.key);if(g)return l(p.key,g),b(g),()=>{};let y=a.get(p.key);y||(y={make:p.make,listeners:new Set},a.set(p.key,y),i.push(p.key)),y.listeners.add(b),h();let T=y;return ()=>T.listeners.delete(b)},release(){c?.dispose(),c=null;}}}var Na="voxel-avatar-v1";function gl(){return {standard:Na,style:oe,version:Se,slots:[...ke],eyes:[...Ge],brows:[...Ue],mouths:[...Ye],emotions:[...a$1],height:{min:je.min,max:je.max},items:[...St],shop:{...tr},rules:{slots:{...Kt},limits:{...Te},regions:[...$t],regionPairs:Object.fromEntries(Object.entries(Wt).map(([e,t])=>[e,[...t]])),faces:[...ue],skinColor:Ae}}}var Ha=(e,t,r)=>"#"+[e,t,r].map(o=>Math.max(0,Math.min(255,Math.round(o))).toString(16).padStart(2,"0")).join("");function Da(e,t,r){let o=[];for(let n=0;n<r;n++)for(let a=0;a<t;a++){let i=Math.floor(a*e.width/t),c=Math.max(i+1,Math.floor((a+1)*e.width/t)),s=Math.floor(n*e.height/r),l=Math.max(s+1,Math.floor((n+1)*e.height/r)),h=0,m=0,p=0,b=0,g=0;for(let y=s;y<l;y++)for(let T=i;T<c;T++){let A=(y*e.width+T)*4;g++,!((e.data[A+3]??0)<128)&&(h+=e.data[A]??0,m+=e.data[A+1]??0,p+=e.data[A+2]??0,b++);}o.push(b*2<g?null:[h/b,m/b,p/b]);}return o}var Xe=(e,t)=>(e[0]-t[0])**2+(e[1]-t[1])**2+(e[2]-t[2])**2;function vl(e,t){let r=Te.textureSide,n=Math.min(1,16/Math.max(e.width,e.height,1)),a=Math.max(1,Math.min(r,Math.round(t.w??e.width*n))),i=Math.max(1,Math.min(r,Math.round(t.h??e.height*n))),c=[...new Set(t.symbols)].slice(0,Te.palette);if(!c.length)throw new Error("pixelTextureFromImage: no palette symbols to use");let s=Da(e,a,i),l=s.filter(y=>!!y),h=new Map;for(let y of l){let T=y.map(w=>Math.round(w/8)).join(","),A=h.get(T);A?A.n++:h.set(T,{n:1,c:y});}let m=[...h.values()].sort((y,T)=>T.n-y.n||(y.c.join()<T.c.join()?-1:1)),p=[];for(let y of m){if(p.length>=c.length)break;p.every(T=>Xe(T,y.c)>576)&&p.push([...y.c]);}!p.length&&m[0]&&(p=[[...m[0].c]]);for(let y=0;y<8&&p.length;y++){let T=p.map(()=>[0,0,0,0]);for(let A of l){let w=0;for(let S=1;S<p.length;S++)Xe(A,p[S])<Xe(A,p[w])&&(w=S);let f=T[w];f[0]+=A[0],f[1]+=A[1],f[2]+=A[2],f[3]+=1;}p=p.map((A,w)=>{let f=T[w];return f[3]?[f[0]/f[3],f[1]/f[3],f[2]/f[3]]:A});}let b={};p.forEach((y,T)=>b[c[T]]=Ha(y[0],y[1],y[2]));let g=[];for(let y=0;y<i;y++){let T="";for(let A=0;A<a;A++){let w=s[y*a+A];if(!w||!p.length){T+=".";continue}let f=0;for(let S=1;S<p.length;S++)Xe(w,p[S])<Xe(w,p[f])&&(f=S);T+=c[f];}g.push(T);}return {texture:{w:a,h:i,rows:g},palette:b}}var Ba="ugc.",Rl=e=>e.startsWith(Ba);export{Lr as ACTION_TIME,Ss as ANIM_EVENTS,Ba as AVATAR_AUTHOR_ITEM_PREFIX,Fr as AVATAR_BASE_COLORS,qe as AVATAR_FACE_RECT,je as AVATAR_HEIGHT,tl as AVATAR_ITEMS,Te as AVATAR_ITEM_LIMITS,St as AVATAR_ITEM_LIST,ha as AVATAR_ITEM_PRINTS,za as AVATAR_ITEM_SHOTS,$i as AVATAR_PORTRAIT_BACKGROUND,Pe as AVATAR_RIG_ID,tr as AVATAR_SHOP_DEFAULT_PRICES,Kr as AVATAR_SHOP_ITEM_LIST,ke as AVATAR_SLOTS,Se as AVATAR_SPEC_VERSION,Na as AVATAR_STANDARD_ID,oe as AVATAR_STYLE,bt as Animator,L as Art,At as AvatarActor,$t as BODY_REGIONS,qa as BONE_ROLES,Ue as BROW_STYLES,V as CH,Es as CHANNELS,dr as CHARACTER_LIMITS,pr as CHARACTER_SPEC_VERSION,be as CLEAR,mt as CLIPS,_a as CLOTH_COLORS,Ri as CREATURE_KINDS,ct as CharacterView,Qr as DEFAULT_AVATAR,Gn as DEFAULT_AVATAR_FACE,Nt as DEFAULT_CHARACTER_SOURCE,oo as DEFAULT_COLORS,Le as DEFAULT_FINISH,vt as DrawnFace,ft as EMOTES,Zs as EMOTE_IDS,oi as EMOTION_EVENTS,Be as EXPRESSIONS,zr as EXPRESSION_CHAIN,et as EXTRA_BONE_ROLES,La as EYE_COLORS,Ge as EYE_STYLES,ue as FACE_NAMES,Vr as FACE_TEXELS,Pa as HAIR_COLORS,As as HELD_KINDS,kr as HUMAN_BOTTOMS,xs as HUMAN_HAIR,Tr as HUMAN_SHOES,Sr as HUMAN_TOPS,It as IDLE_STYLES,zn as LOCOMOTION,Ye as MOUTH_STYLES,Ut as POSTURE,Wt as REGION_PAIRS,Fe as REST,ae as RIGS,Pr as RIG_CLIPS,He as RIG_IDS,Ae as SKIN_COLOR,Ia as SKIN_TONES,Kt as SLOT_RULES,$a as SOCKETS,gi as VOXEL_CHARACTER_SYSTEM_PROMPT,yt as VoxelActor,Mt as WALK_STYLES,_t as acquireCharacter,le as add,Or as applyPosture,gl as avatarCatalogExport,Ki as avatarFromServer,pl as avatarItemShot,Ma as avatarItemsForSlot,Fa as avatarMannequinWith,Qt as avatarPrints,sn as bandColors,Ne as bone,ur as bonesOf,$s as characterFromImage,Os as characterOf,Fs as characterSpecs,Ee as clearPose,Jt as composeAvatar,it as copyPose,$r as createAvatarSnapshotter,hl as createAvatarThumbQueue,Ei as creatureCharacter,jn as creatureSource,Re as defaultCharacter,rt as defaultCharacterName,Ht as disposeNameplate,Br as drawAvatarFace,ni as emotionFromText,Jr as freeAvatarItemsForSlot,Ft as humanSource,Rl as isAuthorAvatarItem,Xr as isAvatarShopItem,is as isDefaultCharacterName,Qs as isEmote,H as isObj,xr as layoutCharacter,Mr as lerpPose,fr as mirrorBone,Cr as nameplate,lt as newAnimInput,fe as normColor,js as npcCharacter,Q as num,Ns as onCharacterKnown,wt as parseAvatarSpec,se as parseCharacterSpec,Tt as pick,vl as pixelTextureFromImage,al as randomAvatar,Ot as recolor,zs as registerCharacter,nt as releaseCharacter,ya as renderAvatarCanvas,Wi as renderAvatarImage,ss as rigOfSpec,_r as sampleEmote,_n as sampleTrack,u as setCh,_e as specHash,Ct as stableStringify,st as standardFace,Bt as styleParams,xt as validateAvatarItem,tt as vec3};
77
+ - When the player sends pictures (possibly of ONE character from different angles: front, side, back) study EVERY picture: get the silhouette, proportions, colours, clothes and the face right. Pictures can be photos, drawings or 3D renders \u2014 turn them into a clean blocky version.`;var To=["wolf","lion","tiger","panda","pig","cow","sheep","horse","deer","mouse","raccoon","elephant","hedgehog","turtle","frog","duck","chicken","owl","penguin","bat","bee","eagle","fish","shark"],_r={h:"#efe6cf",n:"#f2a0a8",r:"#d8342c",y:"#f2a630",d:"#2a2a30",g:"#e8f6ff"},U={mirror:true},Ci=["legFL","legFR","legBL","legBR"];function ye(e,t={}){let r=t.body??[8,8,16],a=t.bodyY??12;e("body","body",r,[0,a,0],"t"),t.belly!==false&&e("belly","body",[r[0]-2,1,r[2]-4],[0,a-r[1]/2,0],"l"),e("head","head",[8,8,8],[0,16,-12],t.head??"s");let o=t.leg??[3,8];for(let n of Ci){let s=n.endsWith("L")?-3:3,l=n.startsWith("legF")?-6:6;e(n,n,[o[0],o[1],o[0]],[s,o[1]/2,l],t.legColor??"t"),t.paw!==null&&e(`${n}Paw`,n,[o[0]+.2,1.5,o[0]+.2],[s,.75,l],t.paw??"a");}}var ar=(e,t="a",r=[4,3,3])=>{e("snout","head",r,[0,14.5,-16-r[2]/2+.5],"l"),e("nose","head",[1.4,1,.6],[0,15.6,-16-r[2]+.4],t);};function wt(e,t={}){let r=t.body??[6,6,8];e("body","body",r,[0,8,0],"t"),e("belly","body",[r[0]-1.4,r[1]-2,1],[0,7.5,-r[2]/2-.2],"l"),e("head","head",[5,5,5],[0,13,-4],t.head??"s");let a=t.wing??[8,1,6];e("wing","wingL",a,[-3-a[0]/2,10,0],t.wingColor??"a",U),e("leg","legL",[1,4,1],[-1.5,2,0],t.legColor??"a",U);}var zi={bone:"head",rect:[0,1,5,3]};function Lo(e,t){let r=(o,n,s)=>({rig:"quadruped",style:{walk:o,idle:n,energy:s},palette:_r}),a=(o,n,s)=>({rig:"flyer",style:{walk:o,idle:n,energy:s},face:zi,palette:_r});switch(e){case "wolf":return ye(t),t("ear","head",[2.4,3.4,1],[-2.5,21.5,-10.5],"t",U),ar(t,"d"),t("ruff","body",[9,6,3],[0,13,-6.5],"l"),t("tail","tail",[3,3,10],[0,13,13],"t",{rot:[25,0,0]}),t("tailTip","tail",[3.1,3.1,2],[0,14.6,17.5],"l",{rot:[25,0,0]}),r("sneaky","proud",.6);case "lion":return ye(t),t("mane","head",[12,12,3],[0,16,-9.5],"a"),t("maneTop","head",[10,2,6],[0,21,-11.5],"a"),t("ear","head",[2,2,1],[-3,21.4,-12],"s",U),ar(t,"d",[4,2.6,2]),t("tail","tail",[1.4,1.4,10],[0,13,13],"t",{rot:[30,0,0]}),t("tuft","tail",[2.6,2.6,2.6],[0,15.2,18],"a",{rot:[30,0,0]}),r("heavy","proud",.5);case "tiger":ye(t);for(let o of [-5,-1.5,2,5.5])t(`stripe${o}`,"body",[8.3,1,1.1],[0,12.6,o],"d");return t("stripeHead","head",[8.3,1,3],[0,19.8,-11],"d"),t("ear","head",[2,2,1],[-3,21,-10.5],"t",U),ar(t,"n",[4,2.6,2]),t("tail","tail",[1.8,1.8,10],[0,14,13],"t",{rot:[20,0,0]}),t("tailRing","tail",[2,2,1],[0,15,15],"d",{rot:[20,0,0]}),r("sneaky","proud",.6);case "panda":return ye(t,{body:[9,9,15],legColor:"a",paw:"a"}),t("band","body",[9.2,9.2,4],[0,12,-4.5],"a"),t("ear","head",[2.4,2.4,1.2],[-3,21,-11],"a",U),t("nose","head",[1.6,1,.6],[0,15,-16.3],"a"),t("tail","tail",[2,2,2],[0,14,8.5],"l"),r("heavy","calm",.4);case "pig":return ye(t,{leg:[3,6],paw:"a"}),t("snout","head",[3.6,2.6,1.2],[0,14.6,-16.6],"n"),t("nostril","head",[.6,.8,.2],[-0.8,14.6,-17.3],"a",U),t("ear","head",[2.4,2,1],[-2.6,20.6,-10.5],"n",{mirror:true,rot:[-30,0,0]}),t("tail","tail",[1,1,2.6],[0,15,9],"n",{rot:[-40,0,0]}),r("bouncy","fidgety",.7);case "cow":return ye(t,{body:[9,9,16],paw:"d"}),t("spot","body",[9.2,3.6,4],[0,14,-2],"a"),t("spot2","body",[9.2,3,3],[0,11,5],"a"),t("muzzle","head",[6,3,1.6],[0,13.6,-16.6],"n"),t("horn","head",[1,2.4,1],[-2.8,21.2,-11],"h",U),t("ear","head",[2.6,1.2,1],[-5,18.6,-11],"t",U),t("tail","tail",[1,8,1],[0,11,9],"t"),t("tailTip","tail",[1.6,2,1.6],[0,6.6,9],"a"),r("heavy","calm",.3);case "sheep":return ye(t,{body:[10,9,16],leg:[2.6,7],legColor:"a",paw:"d",head:"a",belly:false}),t("woolTop","body",[9,2,13],[0,17,0],"t"),t("woolHead","head",[8.6,2.4,6],[0,20.4,-11.6],"t"),t("ear","head",[2.6,1,1.6],[-5,18,-11],"a",U),t("tail","tail",[2.6,2.6,2],[0,14,9],"t"),r("bouncy","calm",.5);case "horse":return ye(t,{body:[8,8,17],paw:"d"}),t("muzzle","head",[5,4.6,4],[0,13.8,-17.6],"s"),t("nose","head",[5.2,1.6,1],[0,12.6,-19.6],"l"),t("mane","head",[1.6,3,8],[0,21.4,-9],"a"),t("maneNeck","body",[1.6,3,5],[0,17,-5.5],"a"),t("ear","head",[1.4,2.4,1],[-2.4,21.2,-13.4],"s",U),t("tail","tail",[2.2,10,2.2],[0,10,9.4],"a"),r("normal","proud",.7);case "deer":ye(t,{body:[7,8,15]}),ar(t,"d",[3.6,2.8,2.4]),t("ear","head",[2.6,1.4,1],[-5,19.6,-10.5],"t",U),t("antler","head",[.8,4,.8],[-2.4,22,-10.5],"h",U),t("antlerTine","head",[2.6,.8,.8],[-3.4,23.2,-10.5],"h",U),t("antlerTop","head",[.8,2,.8],[-4.3,24.4,-10.5],"h",U);for(let o of [-3,1,4])t(`spot${o}`,"body",[1.4,.4,1.4],[-1.6,16.1,o],"l",U);return t("tail","tail",[2,2.4,1.4],[0,14.6,8.4],"l"),r("bouncy","calm",.6);case "mouse":return ye(t,{body:[7,6,12],bodyY:11,leg:[2.4,8],paw:"n"}),t("ear","head",[3.4,3.4,.8],[-3.6,21.4,-10.6],"t",U),t("earIn","head",[2.2,2.2,.3],[-3.6,21.4,-11.1],"n",U),t("nose","head",[1.2,1,.6],[0,15,-16.3],"n"),t("tail","tail",[.8,.8,11],[0,12,13],"n",{rot:[15,0,0]}),r("sneaky","fidgety",.9);case "raccoon":ye(t,{paw:"d"}),t("mask","head",[8.3,1.4,8.3],[0,17,-12],"d",{shape:"cylinder"}),ar(t,"d",[3.4,2.4,2]),t("ear","head",[2.2,2.4,1],[-2.8,21.2,-10.5],"a",U),t("tail","tail",[3,3,10],[0,14,13],"t",{rot:[20,0,0]});for(let o of [10,13.4,16.8])t(`ring${o}`,"tail",[3.2,3.2,1.4],[0,14+(o-13)*.36,o],"d",{rot:[20,0,0]});return r("sneaky","fidgety",.7);case "elephant":return ye(t,{body:[10,10,16],leg:[4,8],paw:"l"}),t("ear","head",[1,7,6],[-5,16.4,-10.6],"a",U),t("trunk","head",[2.6,4,2.4],[0,12.6,-17.2],"s"),t("trunk2","head",[2.2,4,2.2],[0,9,-17.6],"s"),t("trunkTip","head",[2,1.6,2.6],[0,6.6,-18],"s"),t("tusk","head",[.8,.8,3],[-2.2,12.6,-17.2],"h",U),t("tail","tail",[.8,6,.8],[0,12,8.4],"t"),r("heavy","calm",.3);case "hedgehog":ye(t,{body:[8,6,12],bodyY:10,leg:[2.4,8],paw:"l"}),t("spines","body",[9.4,5,12],[0,13.6,1],"a");for(let o of [-3,1,5])t(`spike${o}`,"body",[1,1.6,1],[-2.4,16.8,o],"a",U);return t("spikeTop","body",[1,1.8,1],[0,16.9,-1],"a"),t("nose","head",[1.4,1.2,1.4],[0,14.6,-16.6],"d"),t("ear","head",[1.4,1.4,.8],[-3,20.6,-10.6],"l",U),r("sneaky","fidgety",.8);case "turtle":return ye(t,{body:[8,5,12],bodyY:9,leg:[3,8],paw:null}),t("shell","body",[11,6,15],[0,13,.6],"a"),t("shellTop","body",[8,1.6,11],[0,16.6,.6],"a"),t("shellRim","body",[11.4,1,15.4],[0,10.4,.6],"l"),t("tail","tail",[1.4,1.4,2.6],[0,11,9],"t"),r("heavy","calm",.2);case "frog":return ye(t,{body:[9,6,12],bodyY:10,leg:[3,8],paw:"a"}),t("eyeBump","head",[2.6,2.4,2.6],[-2.4,21.2,-13],"t",U),t("eyeBall","head",[1.6,1.6,.4],[-2.4,21.4,-14.5],"w",U),t("pupil","head",[.8,.8,.2],[-2.4,21.4,-14.8],"k",U),t("backLeg","legBL",[3.6,3,5],[-3.4,3.5,7.4],"t",U),r("bouncy","calm",.8);case "duck":return wt(t,{wingColor:"t",legColor:"y"}),t("bill","head",[3,.9,2.6],[0,12,-7.6],"y"),t("tail","tail",[3,1,2.4],[0,9.6,5],"t",{rot:[-25,0,0]}),a("bouncy","fidgety",.6);case "chicken":return wt(t,{wing:[3,4,6],wingColor:"t",legColor:"y"}),t("comb","head",[1,2,3.6],[0,16.4,-4],"r"),t("beak","head",[1.4,1,1.6],[0,12.8,-7.2],"y"),t("wattle","head",[.8,1.4,.6],[0,11.2,-6.8],"r"),t("tail","tail",[3,4,3],[0,11,5],"t",{rot:[20,0,0]}),a("bouncy","fidgety",.9);case "owl":return wt(t,{body:[7,7,7],wingColor:"a"}),t("tuft","head",[1,2,1],[-2,16.4,-4],"a",U),t("beak","head",[1,1.2,1],[0,12.4,-7],"y"),t("tail","tail",[3,1,3],[0,6,5],"a"),a("normal","calm",.3);case "penguin":return wt(t,{body:[7,9,6],wing:[3,6,2],wingColor:"t",legColor:"y"}),t("belly2","body",[5,7,.6],[0,7.6,-3.3],"l"),t("beak","head",[1.4,1,1.8],[0,12.6,-7.2],"y"),t("feet","legL",[2,.6,2.4],[-1.5,.3,-0.8],"y",U),a("heavy","fidgety",.6);case "bat":return wt(t,{body:[5,5,5],wing:[9,.6,5],wingColor:"a",legColor:"d"}),t("ear","head",[1.4,2.6,.8],[-1.6,16.6,-4],"t",U),t("fang","head",[.5,.8,.3],[-0.8,11.2,-6.6],"w",U),a("sneaky","fidgety",.8);case "bee":return wt(t,{body:[6,6,8],wing:[5,.4,4],wingColor:"g",legColor:"d"}),t("stripe","body",[6.2,6.2,1.2],[0,8,0],"d"),t("stripe2","body",[6.2,6.2,1.2],[0,8,2.8],"d"),t("stinger","body",[.8,.8,1.6],[0,7.4,4.6],"d"),t("antenna","head",[.4,2.4,.4],[-1.2,16.4,-4.6],"d",U),t("antennaTip","head",[.8,.8,.8],[-1.2,17.8,-4.6],"d",U),a("bouncy","fidgety",1);case "eagle":return wt(t,{body:[6,7,8],wing:[10,1,6],wingColor:"t",legColor:"y",head:"l"}),t("beak","head",[1.6,1.4,2],[0,12.6,-7.4],"y"),t("beakTip","head",[1,1,.8],[0,11.6,-8],"y"),t("tail","tail",[4,1,4],[0,7.4,6],"l"),a("heavy","proud",.6);case "fish":return t("body","body",[5,7,9],[0,6,0],"t"),t("belly","body",[4,1,7],[0,2.4,0],"l"),t("head","head",[5,6,4],[0,6,-6.5],"s"),t("tailFin","tail",[.8,6,4],[0,6,7],"a"),t("dorsal","body",[.8,2.4,4],[0,10.6,0],"a"),t("fin","finL",[3,.6,2],[-4,5,-1],"a",U),{rig:"swimmer",style:{walk:"normal",idle:"calm",energy:.7},face:{bone:"head",rect:[0,1,5,3]},palette:_r};case "shark":return t("body","body",[7,7,16],[0,6,1],"t"),t("belly","body",[5.6,1,13],[0,2.4,1],"l"),t("head","head",[7,6,6],[0,6,-9],"s"),t("jaw","head",[6,1.4,5],[0,3.4,-9],"l"),t("dorsal","body",[1,5,4],[0,11.6,0],"t"),t("tailFin","tail",[1,9,5],[0,7,11.4],"t"),t("fin","finL",[4,.8,3],[-5,4,-1],"t",U),{rig:"swimmer",style:{walk:"heavy",idle:"proud",energy:.6},face:{bone:"head",rect:[0,1,7,3]},palette:_r}}throw new Error(`unknown creature kind: ${e}`)}var Hc=["cat","dog","fox","bear","rabbit","bird","dragon","slime","ghost","robot",...To],Pi=e=>({k:"#2a1c14",w:"#f4f4ef",b:e,m:"#7a3a30",o:"#3a1a14"});function Ii(e){let t=e.light??e.body,r=e.accent??e.body,a={t:e.body,s:e.body,l:t,a:r,p:r,...Pi(e.eyes??"#3f6f3a")},o=[],n="quadruped",s=$t("head",[0,3,8,5]),l={walk:"normal",idle:"calm",energy:.6},i=(b,v,E,M,R,k={})=>o.push({name:b,bone:v,size:E,pos:M,color:R,...k});switch(e.kind){case "cat":case "fox":case "dog":case "bear":case "rabbit":{let b=e.kind;i("body","body",[8,8,16],[0,12,0],"t"),i("belly","body",[6,1,12],[0,8,0],"l"),i("head","head",[8,8,8],[0,16,-12],"s");for(let v of ["legFL","legFR","legBL","legBR"]){let E=v.endsWith("L")?-3:3,M=v.startsWith("legF")?-6:6;i(v,v,[3,8,3],[E,4,M],"t"),i(`${v}Paw`,v,[3.2,1.5,3.2],[E,.75,M],"a");}b==="cat"?(i("ear","head",[2,2.5,1],[-2.5,21,-11],"a",{mirror:true}),i("tail","tail",[1.6,1.6,10],[0,15,13],"t",{rot:[20,0,0]}),l={walk:"sneaky",idle:"calm",energy:.5}):b==="fox"?(i("ear","head",[2.4,3.2,1],[-2.5,21.4,-11],"t",{mirror:true}),i("snout","head",[4,3,3],[0,14.5,-17],"l"),i("nose","head",[1.2,1,.6],[0,15.6,-18.6],"a"),i("tail","tail",[3.5,3.5,10],[0,14,13],"t",{rot:[15,0,0]}),i("tailTip","tail",[3.6,3.6,2.5],[0,15.2,18],"l"),l={walk:"bouncy",idle:"fidgety",energy:.7}):b==="dog"?(i("ear","head",[1.5,4,3],[-4.6,17.5,-11.5],"a",{mirror:true}),i("snout","head",[4,3,3],[0,14.5,-17],"l"),i("nose","head",[1.6,1.2,.6],[0,15.8,-18.6],"a"),i("tail","tail",[2,2,7],[0,16,11],"t",{rot:[40,0,0]}),l={walk:"bouncy",idle:"fidgety",energy:.9}):b==="bear"?(i("ear","head",[2,2,1],[-3,20.6,-10.5],"a",{mirror:true}),i("snout","head",[4,3,2.5],[0,14.5,-16.8],"l"),i("nose","head",[1.6,1.2,.6],[0,15.8,-18.2],"a"),i("tail","tail",[2,2,2],[0,14,9],"t"),l={walk:"heavy",idle:"proud",energy:.4}):(i("ear","head",[1.6,7,1],[-1.8,23.5,-11],"t",{mirror:true}),i("earInner","head",[.8,5.5,.4],[-1.8,23.5,-11.6],"l",{mirror:true}),i("tail","tail",[3,3,3],[0,14,9.5],"l"),l={walk:"bouncy",idle:"fidgety",energy:.8});break}case "bird":case "dragon":{n="flyer",s=$t("head",[0,1,5,3]);let b=e.kind==="dragon";i("body","body",[6,6,8],[0,8,0],"t"),i("belly","body",[4.6,4,1],[0,7.5,-4.2],"l"),i("head","head",[5,5,5],[0,13,-4],"s"),i("wing","wingL",[8,1,6],[-7,10,0],"a",{mirror:true}),i("leg","legL",[1,4,1],[-1.5,2,0],"a",{mirror:true}),b?(i("horn","head",[.8,2,.8],[-1.4,16.4,-3],"l",{mirror:true}),i("snout","head",[3,2,2.4],[0,12.2,-7.4],"s"),i("tail","tail",[2,2,8],[0,7,7],"t"),i("spike","body",[1,1.5,6],[0,11.6,0],"a"),l={walk:"heavy",idle:"proud",energy:.6}):(i("beak","head",[1.6,1.2,2],[0,12.4,-7.2],"a"),i("tail","tail",[4,1,4],[0,8,6],"a"),i("crest","head",[1,2,2],[0,16.2,-3.6],"a"),l={walk:"bouncy",idle:"fidgety",energy:.8});break}case "slime":case "ghost":case "robot":{n="blob",s=$t("body",[2,3,8,5]),e.kind==="slime"?(i("body","body",[12,10,12],[0,5,0],"t"),l={walk:"bouncy",idle:"fidgety",energy:.9}):e.kind==="ghost"?(i("body","body",[10,12,10],[0,7,0],"t"),i("hem","body",[10.4,2,10.4],[0,1,0],"l",{shape:"cylinder"}),l={walk:"sneaky",idle:"calm",energy:.4}):(i("body","body",[11,11,10],[0,5.5,0],"t"),i("antenna","body",[.8,3,.8],[0,12.5,0],"a"),i("bulb","body",[1.6,1.6,1.6],[0,14.6,0],"l"),i("screen","body",[9,6,.4],[0,6.5,-4.82],"l"),l={walk:"robotic",idle:"calm",energy:.5});break}default:{let b=Lo(e.kind,i);n=b.rig,l=b.style,b.face&&(s=$t(b.face.bone,b.face.rect)),Object.assign(a,b.palette);}}Oi(o);let d=e.kind==="slime"||e.kind==="ghost"?"body":"head";for(let b of o)b.name===d&&b.bone===s.face.bone&&(b.shape="cylinder");let[c,h,p,m]=s.face.rect,g=[c+p*Mo,h,p*(1-2*Mo),m];return {version:1,name:e.name,description:e.description??"",rig:n,palette:a,textures:s.textures,parts:o,face:{...s.face,rect:g,drawn:{...Di(e.kind),eyeColor:e.eyes??Fi}},style:l,finish:_i,tags:e.tags??[e.kind]}}var _i={noise:0,outline:0,shade:.12,density:4,round:.35},Ft=1.5;function Oi(e){let t=e,r=c=>c.size[0]*c.size[1]*c.size[2],a=c=>t.filter(h=>h.bone===c).sort((h,p)=>r(p)-r(h))[0],o=a("body");if(!o)return;let n=(c,h)=>c.pos[h]-c.size[h]/2,s=(c,h)=>c.pos[h]+c.size[h]/2;for(let c of ["legFL","legFR","legBL","legBR","legL","legR"]){let h=a(c);if(!h||s(h,1)>n(o,1)+Ft||s(h,1)<n(o,1)-3)continue;let p=n(h,1),m=n(o,1)+Ft;h.size[1]=m-p,h.pos[1]=(m+p)/2;}let l=(c,h,p)=>{for(let m of t)m.bone===c&&(m.pos[h]=m.pos[h]+p);},i=a("head");if(i&&i.pos[2]<n(o,2)){let c=n(o,2)+Ft-s(i,2);c>0&&l("head",2,c);}let d=a("tail");if(d&&d.pos[2]>s(o,2)){let c=n(d,2)-(s(o,2)-Ft);c>0&&l("tail",2,-c);}for(let c of [a("wingL"),a("finL")]){if(!c)continue;let h=n(o,0)+Ft,p=s(c,0);p<h&&(c.size[0]=c.size[0]+(h-p),c.pos[0]=c.pos[0]+(h-p)/2);}if(i)for(let c of t){if(c.bone!=="head"||c===i)continue;let h=n(c,1)-(s(i,1)-Ft/2);h>0&&n(c,1)<s(i,1)+.6&&(c.pos[1]=c.pos[1]-h);}}var Fi="#2a1c14",Mo=.07;function Di(e){let t=(r,a,o=true)=>({eyes:r,brows:"none",mouth:a,cheeks:o});switch(e){case "cat":case "fox":case "lion":case "tiger":return t("cat","cat");case "dog":case "wolf":case "rabbit":case "mouse":case "raccoon":case "hedgehog":return t("round","cat");case "dragon":return t("almond","fang",false);case "slime":return t("sparkle","smile");case "ghost":return t("round","open",false);case "robot":return t("button","smile",false);case "owl":case "frog":return t("wide","smile");case "shark":return t("narrow","teeth",false);case "fish":return t("round","pout",false);case "bat":return t("round","fang");case "bee":case "turtle":return t("button","smile");default:return t("round","small")}}function jc(e){let t=Oe(Ii(e));if(!t.ok)throw new Error(`${e.kind}: ${t.error}`);return t.spec}var Co={torso:"#d9d3c5",legs:"#5f6b7a"},Ni="#2b2140",Bi="#7a2e2e",Vi="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",Hi=32,ji=[10,7],or=1,Gi={noise:0,outline:0,shade:.12,density:4,round:.35},Ui=["front","back","left","right"];function zo(e){let t=parseInt(e.slice(1),16);return [t>>16&255,t>>8&255,t&255]}var ga=class{map={};next=0;key(t){let r=Object.entries(this.map).find(([,i])=>i===t);if(r)return r[0];if(this.next<Hi){let i=Vi[this.next++];return this.map[i]=t,i}let[a,o,n]=zo(t),s=Object.keys(this.map)[0],l=1/0;for(let[i,d]of Object.entries(this.map)){let[c,h,p]=zo(d),m=(a-c)**2+(o-h)**2+(n-p)**2;m<l&&(l=m,s=i);}return s}};function qi(e,t){return (typeof e=="function"?e(t):e[t])??null}function Yi(e){let[t,r]=ji,a=new G(t,r),o=n=>{n(1),n(6);};switch(e){case "blink":case "tired":o(n=>a.row(3,n,n+2,"k"));break;case "happy":o(n=>a.px(n,3,"k").px(n+1,2,"k").px(n+2,3,"k"));break;case "hurt":a.px(1,2,"k").px(2,3,"k").px(1,4,"k"),a.px(8,2,"k").px(7,3,"k").px(8,4,"k");break;case "surprised":case "scared":o(n=>a.rect(n,2,3,3,"w").px(n+1,3,"k"));break;default:o(n=>a.rect(n,2,3,3,"w").rect(n+1,3,2,2,"e").px(n+1,3,"k"));}switch(e==="angry"&&a.px(1,1,"k").px(2,1,"k").px(3,2,"k").px(8,1,"k").px(7,1,"k").px(6,2,"k"),e==="sad"&&a.px(3,1,"k").px(2,1,"k").px(6,1,"k").px(7,1,"k"),e){case "happy":case "talk":a.rect(4,5,2,2,"m");break;case "surprised":a.rect(4,5,2,2,"m");break;case "sad":a.px(3,6,"m").row(5,4,5,"m").px(6,6,"m");break;case "angry":case "tired":case "scared":case "hurt":a.row(6,4,5,"m");break;default:a.px(3,5,"m").row(6,4,5,"m").px(6,5,"m");}return a.tex()}function wa(e,t){let r=Ie[At],a=new ga,o=a.key(e.body.skin),n=r.defaultParts.map(m=>({...m,size:[...m.size],pos:[...m.pos],color:m.name==="torso"?a.key(Co.torso):m.name?.startsWith("leg")||m.name?.startsWith("foot")?a.key(Co.legs):o})),s=new Map;for(let m of n){let g=s.get(m.name)??[];g.push(m),s.set(m.name,g);}for(let m of s.values())m.sort((g,b)=>b.pos[1]+b.size[1]/2-(g.pos[1]+g.size[1]/2));let l=(e.body.head??ua)==="round";if(l)for(let m of n)m.name==="head"?(m.shape="cylinder",m.size=[m.size[0],m.size[1]+or,m.size[2]],m.pos=[m.pos[0],m.pos[1]+or/2,m.pos[2]]):m.name==="neck"&&(m.size=[2.6,1.8,2.4],m.pos=[0,23.1,0]);let i={},d={k:a.key(Ni),w:a.key("#ffffff"),e:a.key(e.face.eyeColor),m:a.key(Bi)},c={};for(let m of Gt){let g=Yi(m),b="face_"+m;i[b]={...g,rows:g.rows.map(v=>[...v].map(E=>d[E]??E).join(""))},c[m]=b;}c.neutral=c[d$1[e.face.emotion]]??c.neutral;for(let m of bt){let g=e.wear[m];if(!g)continue;let b=qi(t,g);if(!b||b.slot!==m||b.style!==Me)continue;let v={};for(let[k,y]of Object.entries(b.palette))v[k]=y===ut?o:a.key(k===b.tint&&e.tint[m]?e.tint[m]:y);let E={};for(let[k,y]of Object.entries(b.textures)){let z=`${m}_${k}`;E[k]=z,i[z]={w:y.w,h:y.h,rows:y.rows.map(C=>[...C].map(L=>v[L]??L).join(""))};}let M=k=>{if(!k)return;let y={};for(let[z,C]of Object.entries(k)){let L=E[C]??v[C];L&&(y[z]=L);}return Object.keys(y).length?y:void 0};for(let k of b.paint){let y=s.get(k.region);if(!y)continue;let z=v[k.color],C=M(k.faces);y.forEach((L,I)=>{z&&(L.color=z);let _=C&&$i(C,y,I,i);_?L.faces=_:delete L.faces;});}let R=m==="hair"||m==="hat"||m==="faceAcc"&&!b.parts.some(k=>k.mat);for(let k of b.parts){let y={bone:k.bone,size:[...k.size],pos:[...k.pos],color:v[k.color]??o},z=M(k.faces);if(z&&(y.faces=z),k.rot&&(y.rot=[...k.rot]),k.mirror&&(y.mirror=true),k.name&&(y.name=k.name),k.mat&&(y.mat=k.mat),l&&k.bone===r.faceBone){let C=m==="hair"||m==="hat"?or:or/2;y.pos=[y.pos[0],y.pos[1]+C,y.pos[2]],R&&(y.wrap=true);}n.push(y);}}let h={version:1,name:"Avatar",description:"",rig:At,scale:e.body.height,palette:a.map,textures:i,parts:n,bones:[],face:{bone:r.faceBone,rect:l?[et[0],et[1]+or/2,et[2],et[3]]:[...et],expressions:c},style:{walk:e.anim?.walk??Qe.walk,idle:e.anim?.idle??Qe.idle,energy:.6},voice:{pitch:1},tags:["avatar",Me],finish:{...Gi}},p=Oe(h);if(!p.ok)throw new Error("composeAvatar: "+p.error);return p.spec}function $i(e,t,r,a){if(t.length===1)return {...e};let o=t[0].pos[1]+t[0].size[1]/2,n=Math.min(...t.map(d=>d.pos[1]-d.size[1]/2)),s=Math.max(1e-6,o-n),l=d=>d<=0?0:d>=t.length?1:(o-(t[d-1].pos[1]-t[d-1].size[1]/2))/s,i={};for(let[d,c]of Object.entries(e)){let h=a[c];if(!h){i[d]=c;continue}if(d==="top"){r===0&&(i[d]=c);continue}if(d==="bottom"){r===t.length-1&&(i[d]=c);continue}if(!Ui.includes(d))continue;let p=Math.min(h.h-1,Math.round(l(r)*h.h)),m=Math.max(p+1,Math.round(l(r+1)*h.h)),g=`${c}_${r}`;a[g]||(a[g]={w:h.w,h:m-p,rows:h.rows.slice(p,m)}),i[d]=g;}return Object.keys(i).length?i:void 0}var Ki={paths:[{x:243,y:-2,d:"M147.333 12.333c-13.6 2.534-12.533 1.2-12.933 15.067l-.4 12.267-4.533-11.067c-2.534-6-5.067-10.933-5.734-10.933-2.666 0-27.866 8.666-36.533 12.666-11.733 5.334-26.667 14.8-36.133 22.934l-6.934 5.866L51.6 69.267c8.133 11.066 7.333 11.466-5.067 2.933-7.6-5.067-8.4-5.333-11.466-3.733-3.467 1.866-18.4 17.333-20.4 21.2-.8 1.6 7.066 8.8 33.733 30.933l34.667 28.933 8.8-8.266c14.666-13.867 28.666-22 48.133-28.267 9.067-2.933 14.8-3.733 28.533-4.4 34.267-1.333 60 7.467 81.6 28.133 21.6 20.4 34.934 49.6 37.467 81.734l.8 11.2 14.8 4.533c8.133 2.533 23.733 7.333 34.667 10.8 10.933 3.333 20.4 5.6 21.066 4.933 1.6-1.6 6.134-20.533 7.734-32.666.8-6 1.333-17.6 1.066-25.6l-.4-14.667-8-1.067c-4.4-.533-10.133-1.466-12.666-1.866l-4.667-.8 4.667-1.2c16.933-4.534 18.666-5.2 18.666-8 0-5.467-9.6-31.334-16.666-44.8-4-7.6-10.667-18.667-14.934-24.667-9.866-13.867-31.333-35.467-45.2-45.2-10.4-7.467-34.4-20.933-37.2-21.067-.8 0-4 4-7.333 8.8-3.2 4.8-6.133 8.134-6.4 7.334s.4-5.6 1.6-10.667c1.2-5.2 2.133-9.6 2.133-9.867 0-.933-19.866-6.133-34.4-9.066-14.8-2.934-49.333-4.4-59.6-2.534"},{x:243,y:-2,d:"M157.867 125.533c-21.067 3.334-42.134 14.8-57.467 31.334-13.333 14.133-13.733 12.8 5.6 22 9.2 4.4 16.667 8.266 16.667 8.533s-1.334.4-2.934.133c-13.866-2.133-41.6-5.866-41.733-5.6-.267.267-7.467 28.534-16.267 63.067l-16 62.667 7.334.4c4 .266 7.466.266 7.6 0 .266-.267 3.866-13.867 8.133-30.4 4.267-16.534 8.267-30.8 8.933-31.734.934-1.2 11.067-1.6 42.4-1.6 32.134 0 41.2.4 41.2 1.6 0 .934-1.733 4.667-3.866 8.4L153.733 261l-35.066 6.933c-19.334 3.867-35.2 7.2-35.467 7.467-.667.667-29.867 113.467-29.467 113.867.267.133 23.734-3.6 52.4-8.534l52-8.8 20.4-39.866c11.2-22 20.667-39.734 20.934-39.467.4.533-1.334 26.8-2.8 40.8l-.667 6.933 6.267-3.2c21.2-10.666 52.4-13.466 86.933-8l5.867.934-5.6-7.334C286.4 318.6 281.2 310.6 278 304.867c-5.867-10.134-6-10.8-6-21.867 0-6.267 1.467-20 3.333-30.667 1.867-10.666 3.334-19.466 3.334-19.466 0-.134-9.067-4.267-20.134-9.334s-19.466-9.333-18.8-9.6c.8-.266 7.734.8 15.6 2.267 7.734 1.6 14.4 2.8 14.8 2.8 1.2 0 .4-10.533-1.466-18-7.2-27.733-28-53.467-53.734-66-16.4-8-40.8-12-57.066-9.467"},{x:243,y:-2,d:"M235.6 346.333c-24 4.534-44.133 13.867-68.267 31.467-14 10.267-28.533 18.133-47.733 25.867-23.467 9.466-52.8 32.666-64.4 50.666l-2.533 4L58 454.2c9.333-7.333 30.133-19.467 49.333-28.667C173.733 393.667 246.4 382.2 312.8 393c11.2 1.733 39.2 8.533 45.067 10.8 2.266.8 2.266.667.8-2.267-4-7.6-15.6-21.866-25.867-31.466-12-11.467-24.667-18.934-37.6-22.4-11.467-3.067-46.267-3.867-59.6-1.334"},{x:-460,y:467,d:"M721.533 34.467c-14.933 5.466-22 17.466-22.933 38.666-.933 24.134 3.467 32.8 30.267 59.867 19.6 19.867 22.933 25.2 22.933 37.867.133 13.466-6.133 20.133-16.933 18.4-9.067-1.467-12.534-7.867-12.534-22.667V159H696.6l.667 13.333c.533 11.467 1.2 14.4 4.933 22 7.067 14.267 16.8 19.6 36.4 19.734 10.667.133 12.267-.134 20.667-4.4 7.6-3.867 9.733-5.867 13.2-11.734 7.6-12.533 9.066-32 3.733-47.6-3.733-11.066-10.667-20.4-27.867-37.2-19.866-19.6-22.533-24.133-22.666-38.4 0-8.933.4-10.533 3.2-13.6 6.266-6.666 18.266-5.6 22.133 2 1.067 2 2 7.067 2 11.2v7.334h27.067l-.934-9.2c-1.6-18.267-8.266-30.267-20-36.4-7.2-3.867-29.2-4.8-37.6-1.6M630.067 34.867c-11.734 4.666-18 11.6-21.734 24.4-1.866 6.4-2 15.333-1.733 67.2l.4 59.866 3.733 7.6c6.8 13.867 18.534 20.267 36.934 20.267 13.733 0 22.933-3.333 30.666-11.067 10.934-11.066 11.2-12.533 11.734-74.666.266-35.734-.134-56.934-1.067-62.8-2.667-16.134-11.6-27.467-24.8-31.467-8.933-2.667-26.4-2.267-34.133.667m28.666 26.8 3.6 4v56.666c0 40.934-.4 57.467-1.6 60-3.6 8-15.6 9.734-22.666 3.467l-4.4-3.867-.4-56.533c-.267-51.733-.134-56.8 2-61.067 3.066-5.866 7.6-8.266 14.4-7.466 3.733.4 6.4 1.866 9.066 4.8M511.667 123.133v89.334l29.066-.4c28.8-.4 28.934-.4 36.667-4.267 9.467-4.533 14.4-10.933 17.467-22.4 2-7.333 2.266-15.467 1.866-65.733l-.4-57.334-4.266-8.8c-8.267-16.666-17.2-19.866-55.334-19.866h-25.066zm53.6-60.266 4.4 3.866.4 52.8c.266 35.067-.134 54.4-1.067 58-2 7.467-5.733 9.6-18.667 10.4l-10.666.8V59h10.666c9.867 0 10.934.267 14.934 3.867M471.667 145v67.333h26.666V77.667h-26.666zM471.667 48.333V63h26.666V33.667h-26.666z"},{x:-106,y:244,d:"M893.4 259.733c-6.8 3.467-9.2 5.6-12.667 11.467-10.666 17.733-9.2 42.933 3.467 62.267 2.8 4.266 12.267 14.8 20.933 23.333 9.867 9.467 17.067 17.733 18.934 21.6 5.6 11.333 5.2 25.333-.934 30.8-3.466 3.067-11.333 4.133-16.133 2.133-5.867-2.4-8-7.466-8-19.333v-10h-27.067l.8 11.6c1.2 15.867 3.867 24.133 10.267 31.333 7.467 8.534 16.4 12.134 30 12.267 19.067.133 30.133-5.733 37.333-19.867 3.734-7.466 4-8.666 4-24 0-16 0-16.133-5.2-26.666-4.4-9.2-7.733-13.2-23.066-28.534-21.067-21.066-24.8-27.066-24.934-40.4-.133-10.4 2.8-15.6 9.734-17.6 10.133-2.933 17.2 3.334 18.4 16.267l.8 8.267H955.4l-.8-10.8c-.533-8.4-1.6-12.667-4.8-19.2-7.067-14.134-16.667-19.334-36.133-19.334-10.667 0-12.534.4-20.267 4.4M791 346v89.333h76v-24h-48v-54.666h37.333v-24H819V282h48v-25.333h-76zM661.667 346v89.333h22.666l.134-63.066c0-34.534.533-61.734 1.066-60.267.534 1.467 5.467 29.867 10.8 62.933l9.867 60.4h13.067c7.2 0 13.066-.4 13.066-1.066 0-3.067 18.8-124.8 19.334-125.334.4-.4.666 27.867.666 62.8v63.6h25.334V256.667h-38l-9.2 61.6c-5.067 34-9.6 62.133-10 62.666-.534.534-5.334-26.4-10.667-60-5.467-33.466-10.133-61.733-10.533-62.666-.4-1.2-5.467-1.6-19.067-1.6h-18.533zM586.467 258.267c-.8 2.666-27.467 172.4-27.467 174.933 0 1.867 1.733 2.133 12 2.133h11.867l.8-4.4c.533-2.266 1.6-9.333 2.4-15.6l1.6-11.333 17.6-.4 17.466-.4 1.467 8.4c.8 4.667 1.733 11.867 2.267 16l.933 7.733h13.733c7.6 0 13.867-.266 13.867-.666 0-.8-26.533-168.134-27.467-173.734l-.8-4.266h-19.866c-14.8 0-20.134.4-20.4 1.6M613 336.533c3.333 23.067 5.867 42.134 5.6 42.4-.4.267-6.533.267-13.867.134l-13.2-.4 4.934-33.334c2.8-18.4 5.733-38.4 6.666-44.666C604.2 292.533 605 290.133 605.8 292c.533 1.467 3.867 21.467 7.2 44.533M497.267 257.2c-10.134 3.733-15.2 8.267-19.867 17.733L473 284l-.4 59.067c-.4 51.2-.133 60.133 1.733 66.533 5.6 19.333 17.067 27.333 39.467 27.467 10.267.133 12.267-.267 20.133-4.134 9.334-4.533 13.867-9.733 17.867-20.266 2-4.934 2.4-12 2.933-41.067l.534-34.933h-38.934v23.866l6.4.4 6.267.4v19.334c0 13.466-.533 20.666-1.867 23.733-5.066 12-23.333 10.4-26.8-2.4-.933-3.6-1.333-23.2-1.066-59.067.4-48.533.666-54.133 2.666-57.333 3.334-4.8 11.2-7.067 17.6-4.933 6.934 2.266 9.067 7.2 9.867 22.933l.667 13.067H555.4l-.8-15.734c-.8-18-3.067-25.6-9.867-33.466-7.466-8.8-13.466-11.2-29.066-11.734-9.067-.266-14.934.134-18.4 1.467"}]},Xi={helmet:{paths:[0,1,2],box:[258,10,353,447]},wordmark:{paths:[3,4],box:[12,499,837,182]}},Wi={"top.idos":{color:"#f8f8fc",faces:["front","back"],layers:[{art:"helmet",y:19.4,z:2.3,height:3.9},{art:"wordmark",y:14.85,z:2.15,width:6.2}]}},Po=512,_o=.02,Io=new Map;function Ji(e,t){if(typeof document<"u"){let r=document.createElement("canvas");return r.width=e,r.height=t,r}return new OffscreenCanvas(e,t)}function Zi(e,t,r){let a=`${e}:${r}`,o=Io.get(a);if(o)return o;if(typeof Path2D>"u")return null;let[n,s,l,i]=t.box,d=i*_o,c=Po/(i+2*d),h=Ji(Math.round((l+2*d)*c),Po),p=h.getContext("2d");if(!p)return null;p.clearRect(0,0,h.width,h.height),p.fillStyle=r;for(let g of t.paths){let b=Ki.paths[g];p.setTransform(c,0,0,c,(b.x-n+d)*c,(b.y-s+d)*c),p.fill(new Path2D(b.d));}let m=new V.CanvasTexture(h);return m.colorSpace=V.SRGBColorSpace,m.anisotropy=4,Io.set(a,m),m}function xa(e){let t=[];for(let r of bt){let a=e.wear[r],o=a?Wi[a]:void 0;if(o)for(let n of o.layers){let s=Xi[n.art],l=Zi(n.art,s,o.color);if(!l)continue;let[,,i,d]=s.box,c=i/d,h=n.height??(n.width??1)/c,p=n.width??h*c,m=2*_o*h;for(let g of o.faces){let b=(g==="front"?-1:1)*(n.z+.03),v=[0,n.y,b];t.push({bone:"body",center:v,w:p+m,h:h+m,facing:g,texture:l});}}}return t}var Fr=class extends Ir{face;rest;mood="neutral";constructor(t,r,a={}){let o=new Ot(t.face);super(wa(t,r),{gloss:true,shadows:true,...a,facePainter:o}),this.face=o,this.rest=t.face.emotion,this.view.setPrints(xa(t)),this.applyMood();}setEmotion(t){this.mood=t,this.applyMood();}setAvatar(t,r){this.face.setFace(t.face),this.rest=t.face.emotion,this.setSpec(wa(t,r)),this.view.setPrints(xa(t)),this.applyMood();}applyMood(){super.setEmotion(this.mood==="neutral"?this.rest:this.mood),this.animator.moodOverGestures=this.rest!=="neutral";}dispose(){super.dispose(),this.face.dispose();}};var e0=1.12,t0=.25,Oo=1.6;function Fo(e){e.outputColorSpace=V.SRGBColorSpace,e.toneMapping=V.NeutralToneMapping,e.toneMappingExposure=e0,e.shadowMap.enabled=true,e.shadowMap.type=V.PCFShadowMap;let t=new V.PMREMGenerator(e),r=new RoomEnvironment,a=t.fromScene(r,.04).texture;return r.dispose(),t.dispose(),{light(o){o.environment=a,o.environmentIntensity=t0,o.add(new V.HemisphereLight(14543103,8019024,.6));let n=new V.DirectionalLight(16772829,3.4);n.position.set(4,4.4,-2.2),n.castShadow=true;let s=n.shadow.camera;s.left=s.bottom=-Oo,s.right=s.top=Oo,s.near=.5,s.far=12,n.shadow.mapSize.set(1024,1024),n.shadow.bias=-5e-4,n.shadow.normalBias=.02,n.shadow.radius=4,n.shadow.intensity=.55,n.target.position.set(0,1,0),o.add(n,n.target);let l=new V.DirectionalLight(13623551,.45);l.position.set(-3,.8,-3),o.add(l);let i=new V.DirectionalLight(14478591,2.6);i.position.set(-3.2,2.6,2.6),o.add(i);},dispose(){a.dispose();}}}function r0(e){if(e==="walk")return .3;if(e==="idle")return 1.2;let t=Ne[e];return t.loop?1:t.duration*.4}var m1=["#a99cff","#5b4bd6"];function a0(e,t){switch(t){case "full":return {center:new V.Vector3(0,e*.5,0),size:e*1.12,lift:.04};case "torso":return {center:new V.Vector3(0,e*.57,0),size:e*.5,lift:.06};case "legs":return {center:new V.Vector3(0,e*.2,0),size:e*.5,lift:.1};case "feet":return {center:new V.Vector3(0,e*.08,0),size:e*.32,lift:.3};case "face":return {center:new V.Vector3(0,e*.86,0),size:e*.34,lift:.04};case "head":return {center:new V.Vector3(0,e*.88,0),size:e*.5,lift:.08};default:return {center:new V.Vector3(0,e*.8,0),size:e*.56,lift:.08}}}function o0(e){let t=e.view.spec.parts,r=t.find(o=>o.name==="head"),a=0;for(let o of t)a=Math.max(a,o.pos[1]+o.size[1]/2);return !r||a<=0?e.height:Math.min(e.height,e.height*(r.pos[1]+r.size[1]/2)*n0/a)}var n0=1.022;function s0(e){return typeof e=="number"?e:e==="side"?Math.PI/2:e==="back"?Math.PI:.18}function Do(e,t,r,a,o,n,s){let l=s.frame??"portrait",i={...o,face:{...o.face,emotion:"neutral"}},d=new Fr(i,n,{seed:7});try{e.setClearColor(0,0);let c=new V.Scene;t.light(c),d.group.rotation.y=s0(s.view),c.add(d.group);for(let y=0;y<20;y++)d.update(1/30);let h=s.motion;if(h){h==="walk"?d.setPose("walk"):h!=="idle"&&d.playEmote(h);let y=Math.round(Math.max(0,s.at??r0(h))*30);for(let z=0;z<y;z++)d.update(1/30);}if(!h||h==="walk"||h==="idle"||s.expression){let y=s.expression??o.face.emotion;d.view.setExpression(zt[y][0],y);}let{center:p,size:m,lift:g}=a0(l==="full"||l==="head"?d.height:o0(d),l),b=28,v=new V.PerspectiveCamera(b,1,.05,50),E=m/2/Math.tan(V.MathUtils.degToRad(b/2));v.position.set(p.x,p.y+m*g,p.z-E),v.lookAt(p),e.render(c,v);let M=document.createElement("canvas");M.width=a,M.height=a;let R=M.getContext("2d");if(!R)return r;let k=s.background;if(typeof k=="string")R.fillStyle=k,R.fillRect(0,0,a,a);else if(k){let y=R.createRadialGradient(a*.5,a*.38,a*.05,a*.5,a*.5,a*.72);y.addColorStop(0,k[0]),y.addColorStop(1,k[1]),R.fillStyle=y,R.fillRect(0,0,a,a);}return R.imageSmoothingEnabled=!s.pixelated,R.drawImage(r,0,0),M}finally{d.dispose();}}function No(e,t){let r=document.createElement("canvas");r.width=e,r.height=e;let a=new V.WebGLRenderer({canvas:r,antialias:!t,alpha:true,preserveDrawingBuffer:true});return a.setPixelRatio(1),a.setSize(e,e,false),{renderer:a,lighting:Fo(a),gl:r}}function Bo(e){e.lighting.dispose(),e.renderer.dispose(),e.renderer.forceContextLoss();}function i0(e,t,r={}){let a=Math.max(16,Math.round(r.size??256)),o=No(a,!!r.pixelated);try{return Do(o.renderer,o.lighting,o.gl,a,e,t,r)}finally{Bo(o);}}function Vo(e={}){let t=Math.max(16,Math.round(e.size??256)),r=No(t,!!e.pixelated);return {render(a,o,n={}){if(!r)throw new Error("snapshotter disposed");return Do(r.renderer,r.lighting,r.gl,t,a,o,{...n,pixelated:e.pixelated})},dispose(){r&&(Bo(r),r=null);}}}function p1(e,t,r={}){let a=i0(e,t,r);return new Promise(o=>a.toBlob(n=>o(n),"image/png"))}function d1(e){if(!e?.spec)return null;let t={};for(let r of e.items??[])r&&typeof r.id=="string"&&(t[r.id]=r);return {spec:Pt(e.spec),items:t}}function ge(e,t){let r=It(e);if(!r.ok)throw new Error(`avatar set: ${String(e.id)}: ${r.errors.join("; ")}`);return t===void 0?{item:r.item}:{item:r.item,price:t}}var J=e=>({w:e[0].length,h:e.length,rows:e}),u=(e,t,r,a={})=>({bone:"head",size:e,pos:t,color:r,...a}),A=(e,t,r,a={})=>({bone:"body",size:e,pos:t,color:r,...a}),q=(e,t,r,a,o={})=>({bone:e,size:t,pos:r,color:a,mirror:true,...o});var Ve=(e,t,r,a,o,n)=>ge({id:`back.${e}`,slot:"back",name:t,palette:r,tint:a,parts:o},n),tt=(e,t,r,a,o,n)=>ge({id:`neck.${e}`,slot:"neck",name:t,palette:r,tint:a,parts:o},n),ae={mirror:true},Ho=[A([2.25,7.5,1.47],[1.69,21.15,3.04],"b",ae),A([10.13,3.13,.74],[7.31,26.15,3.86],"a",ae),A([10.13,3.13,.74],[7.88,23.03,4.05],"b",ae),A([9,3.13,.74],[8.44,19.9,4.23],"a",ae),A([6.75,3.13,.74],[9,16.77,4.42],"b",ae),A([4.5,3.13,.74],[9.56,13.65,4.6],"a",ae)],jo=[Ve("shield","Round shield",{a:"#a32d2d",b:"#d8b030",c:"#5a3a22"},"a",[A([8,8,.8],[0,17.5,3.4],"a"),A([8.6,.8,1],[0,21.6,3.4],"c"),A([8.6,.8,1],[0,13.4,3.4],"c"),A([2.2,2.2,.8],[0,17.5,4.2],"b",{mat:"metal"})]),Ve("skateboard","Skateboard",{a:"#2ab0c0",b:"#1d1d21",c:"#f4f1ea"},"a",[A([3,11,.5],[0,18,3.4],"a"),A([1,1,1],[1,13.4,3.9],"c",ae),A([1,1,1],[1,22.6,3.9],"c",ae)]),Ve("rocketpack","Rocket pack",{a:"#c8ccd2",b:"#2b2140",f:"#ff8a2a"},null,[A([2.6,7,2.6],[1.6,17.5,3.8],"a",{mirror:true,mat:"metal"}),A([1.8,.8,1.8],[1.6,13.6,3.8],"b",ae),A([1.4,3,1.4],[1.6,11.6,3.8],"f",{mirror:true,mat:"glow"}),A([2.8,.8,2.8],[1.6,21.4,3.8],"b",ae)],250),Ve("guitar","Guitar",{a:"#c0612b",b:"#3a2414",c:"#1d1d21"},"a",[A([5,5,1.4],[0,12.5,3.6],"a"),A([1,9,.8],[0,19.5,3.6],"b"),A([1.6,1.8,.9],[0,24.9,3.6],"b"),A([1.4,1.4,.2],[0,12.8,4.35],"c")],150),Ve("batwings","Bat wings",{a:"#3c2f5a",b:"#241a3a"},"a",Ho,200),Ve("dragonwings","Dragon wings",{a:"#3c9a3c",b:"#2a6a2a",c:"#e8d27a"},"a",[...Ho.slice(0,5),A([1,1.6,1],[12.2,28.3,3.86],"c",ae)],250),Ve("butterfly","Butterfly wings",{a:"#f2a03a",b:"#2b2140"},"a",[A([6,7,.4],[4.2,21,3.2],"a",ae),A([4.6,5,.4],[3.6,15,3.2],"a",ae),A([1.4,1.4,.3],[5,22.4,3.5],"b",ae),A([1,1,.3],[3.8,15,3.5],"b",ae)],180),Ve("fairy","Fairy wings",{a:"#c8f0ff",b:"#f6c8ff"},"a",[A([4.6,7,.3],[3.5,22,3],"a",{mirror:true,mat:"glass"}),A([3.4,4.6,.3],[3,16,3],"b",{mirror:true,mat:"glass"})],200),Ve("quiver","Quiver",{a:"#7a4f2a",b:"#c8ccd2",c:"#f4f1ea"},"a",[A([2.4,8,2.4],[1.8,20,3.8],"a"),A([.4,3,.4],[1.2,25.5,3.6],"b"),A([.4,3,.4],[2.4,25.8,4],"b"),A([.8,.8,.3],[1.2,27.2,3.6],"c"),A([.8,.8,.3],[2.4,27.5,4],"c")],120),Ve("shell","Turtle shell",{a:"#4c8a3a",b:"#2f5a24",c:"#c8b070"},"a",[A([8.6,9,2.8],[0,17.5,3.6],"a"),A([9.2,.9,3],[0,13,3.6],"c"),A([4,4,.4],[0,18,5.15],"b")],150)],Go=[tt("scarf","Scarf",{a:"#c0392b",b:"#f4f1ea"},"a",[A([6,1.8,5.4],[0,22.5,0],"a"),A([1.6,4.5,.6],[1.2,19.4,-2.7],"a"),A([1.6,3.4,.6],[-0.6,19.9,-2.95],"b")]),tt("bowtie","Bow tie",{a:"#c0392b"},"a",[A([.6,.7,.6],[0,21.9,-2.6],"a"),A([1.2,1.2,.4],[.85,21.9,-2.55],"a",ae)]),tt("bandana","Neck scarf",{a:"#2f5fd0"},"a",[A([6,1.4,5],[0,22.4,0],"a"),A([4,1.6,.6],[0,21,-2.6],"a"),A([2.4,1.2,.6],[0,19.8,-2.6],"a"),A([1,.8,.6],[0,19,-2.6],"a")]),tt("chain","Gold chain",{a:"#e8b730"},null,[A([5.4,.5,4.8],[0,22.3,0],"a",{mat:"metal"}),A([.5,2.2,.4],[0,21,-2.55],"a",{mat:"metal"}),A([1.2,1.2,.4],[0,19.6,-2.6],"a",{mat:"metal"})],150),tt("medal","Medal",{a:"#e8b730",b:"#2f5fd0"},"b",[A([5.4,.5,4.8],[0,22.3,0],"b"),A([1.2,3.4,.3],[0,20.4,-2.5],"b"),A([1.6,1.6,.4],[0,18.3,-2.6],"a",{mat:"metal"})],120),tt("heart","Heart pendant",{a:"#e8436b",b:"#c8ccd2"},"a",[A([5.4,.4,4.8],[0,22.3,0],"b",{mat:"metal"}),A([.3,2.4,.3],[0,20.9,-2.5],"b",{mat:"metal"}),A([1.4,1.2,.4],[0,19.3,-2.6],"a"),A([.7,.5,.4],[.35,20,-2.6],"a",ae)],100),tt("lei","Flower lei",{a:"#4c9a4a",b:"#f08cb4",c:"#f2d33c",d:"#f4f1ea",e:"#ef9f27"},null,[A([6,1,5.4],[0,22.4,0],"a"),A([1.3,1.3,1.3],[2.4,21.4,-2.6],"b",ae),A([1.3,1.3,1.3],[0,20.9,-2.8],"c"),A([1.3,1.3,1.3],[3,22,0],"d",ae),A([1.3,1.3,1.3],[2,21.8,2.6],"e",ae)],120),tt("headphones","Headphones on the neck",{a:"#2b2140",b:"#4be0c8"},"b",[A([1.4,2,2.2],[3.6,22.2,-0.2],"a",ae),A([.3,1.4,1.6],[4.35,22.2,-0.2],"b",{mirror:true,mat:"glow"}),A([6,.7,.8],[0,21.6,2.2],"a")],150)];var Ra=e=>({front:e,back:e,left:e,right:e}),He=(e,t,r,a,o,n)=>ge({id:`bottom.${e}`,slot:"bottom",name:t,palette:r,tint:a,textures:o.textures??{},paint:o.paint,parts:o.parts??[]},n),Uo=[He("sweatpants","Sweatpants",{a:"#8a8f98",b:"#6a6f78"},"a",{paint:[{region:"legs",color:"a"}],parts:[q("shinR",[4.4,1,4.4],[2.1,1.4,0],"b")]}),He("leggings","Leggings",{a:"#1d1d21",w:"#f4f1ea"},"a",{textures:{st:J(["aawa","aawa","aawa","aawa"])},paint:[{region:"legs",color:"a",faces:{left:"st",right:"st"}}]}),He("pleated","Pleated skirt",{a:"#2b2140",b:"#3c3450",s:"@skin"},"a",{textures:{pl:J(["abababab","abababab","abababab","abababab"])},paint:[{region:"legs",color:"s"}],parts:[A([10.4,4.8,5.6],[0,11.3,0],"a",{faces:Ra("pl")})]}),He("joggers","Joggers",{a:"#2f5fd0",b:"#1d3f90"},"a",{paint:[{region:"legs",color:"a"}],parts:[q("shinR",[4.3,1.2,4.3],[2.1,1.3,0],"b")]}),He("plaidskirt","Plaid skirt",{a:"#a32d2d",b:"#2b2140",s:"@skin"},"a",{textures:{pl:J(["abaabaab","bbbbbbbb","abaabaab","abaabaab","bbbbbbbb","abaabaab"])},paint:[{region:"legs",color:"s"}],parts:[A([10.13,4.38,5.52],[0,11.46,0],"a",{faces:Ra("pl")})]},100),He("denimshorts","Denim shorts",{a:"#3f6fd8",b:"#6a8fe8",s:"@skin"},"a",{paint:[{region:"legs",color:"s"}],parts:[q("legR",[4.62,5.4,4.62],[2.1,9.7,0],"a"),q("legR",[4.8,.8,4.8],[2.1,7.3,0],"b")]},80),He("ripped","Ripped jeans",{a:"#2f5fd0",s:"@skin"},"a",{textures:{rp:J(["aaaa","asaa","aaaa","aaaa","assa","aaaa"])},paint:[{region:"legs",color:"a",faces:{front:"rp"}}]},100),He("camo","Camo pants",{a:"#5a6b3a",b:"#3a4a28",c:"#8a8a5a"},"a",{textures:{cm:J(["aabbac","abbaac","caabba","ccaaba","abccaa","aabcca"])},paint:[{region:"legs",color:"a",faces:Ra("cm")}]},120),He("tutu","Tutu",{a:"#f08cb4",b:"#ffc0d8",c:"#f4d8e4"},"a",{paint:[{region:"legs",color:"c"}],parts:[A([12,1.6,8],[0,12.5,0],"a"),A([11,1.2,7.2],[0,11.4,0],"b")]},150),He("flares","Flared pants",{a:"#c87f17",b:"#a8670f"},"a",{paint:[{region:"legs",color:"a"}],parts:[q("shinR",[5.2,3,5.2],[2.1,2.3,0],"a")]},100)];var j=-4.75,xt=(e,t="a",r)=>[u([1.7,.3,.3],[3.6,e,j],t,{mirror:true,...r?{mat:r}:{}}),u([.3,.3,4.4],[4.45,e,-2.55],t,{mirror:true,...r?{mat:r}:{}})],we=(e,t,r,a,o,n)=>ge({id:`face.${e}`,slot:"faceAcc",name:t,palette:r,tint:a,parts:o},n),Dt={"face.glasses":we("glasses","Round glasses",{a:"#2b2140",g:"#cfe8ff"},"a",[u([2.6,.3,.3],[1.6,27.1,j],"a",{mirror:true}),u([2.6,.3,.3],[1.6,24.5,j],"a",{mirror:true}),u([.3,2.9,.3],[2.9,25.8,j],"a",{mirror:true}),u([.3,2.9,.3],[.3,25.8,j],"a",{mirror:true}),u([2.3,2.3,.15],[1.6,25.8,j],"g",{mirror:true,mat:"glass"}),...xt(26.6)]).item,"face.shades":we("shades","Sunglasses",{a:"#1d1d21",g:"#2a2a30"},"a",[u([2.8,2.1,.3],[1.6,25.85,j],"g",{mirror:true,mat:"glass"}),u([6.8,.42,.36],[0,26.95,j],"a"),u([.36,1.6,.36],[3.05,26.1,j],"a",{mirror:true}),...xt(26.75)]).item,"face.visor":we("visor","Cyber visor",{a:"#33e0ff",b:"#1d1d21"},"a",[u([8.6,1.8,.35],[0,25.9,-4.6],"a",{mat:"glow"}),u([.4,1.2,2.4],[4.35,26,-3.4],"b",{mirror:true}),u([.3,.6,7.6],[4.45,26.2,.4],"b",{mirror:true}),u([8.9,.6,.3],[0,26.2,4.45],"b")]).item},qo=[we("mask","Face mask",{a:"#9ad0f0",b:"#f4f1ea"},"a",[u([6.4,2.8,.6],[0,23.6,-4.15],"a"),u([.4,2.4,1.6],[3.35,23.7,-3.35],"a",{mirror:true}),u([.25,.25,3],[4.35,24.9,-1.9],"b",{mirror:true})]),we("clownnose","Clown nose",{a:"#e0302a",b:"#ffffff"},"a",[u([1.4,1.3,1.2],[0,24.9,-4.55],"a"),u([.4,.4,.2],[-0.3,25.25,-5.2],"b")]),we("mustache","Mustache",{a:"#3b2a20"},"a",[u([3.4,.7,.5],[0,24.45,-4.25],"a"),u([.9,.9,.5],[1.95,24.3,-4.25],"a",{mirror:true})]),we("beard","Beard",{a:"#3b2a20"},"a",[u([6.4,1.4,1.4],[0,22.2,-3.5],"a"),u([1.3,3.4,5.2],[3.75,23.6,-1.4],"a",{mirror:true}),u([2.4,.8,.5],[0,23.05,-4.25],"a"),u([3.6,.7,.5],[0,24.45,-4.25],"a")],120),we("aviators","Aviators",{a:"#d8b030",g:"#c8843a"},"g",[u([2.6,1.6,.2],[1.6,26,j],"g",{mirror:true,mat:"glass"}),u([2,.8,.2],[1.6,24.85,j],"g",{mirror:true,mat:"glass"}),u([6.8,.25,.3],[0,26.85,j],"a",{mat:"metal"}),u([1,.25,.3],[0,26.35,j],"a",{mat:"metal"}),u([.25,2,.3],[2.95,25.8,j],"a",{mirror:true,mat:"metal"}),...xt(26.7,"a","metal")],150),we("square","Square glasses",{a:"#1d1d21",g:"#e0f0ff"},"a",[u([2.8,.45,.4],[1.6,27,j],"a",{mirror:true}),u([2.8,.45,.4],[1.6,24.6,j],"a",{mirror:true}),u([.45,2.4,.4],[3,25.8,j],"a",{mirror:true}),u([.45,2.4,.4],[.2,25.8,j],"a",{mirror:true}),u([2.2,2,.15],[1.6,25.8,j],"g",{mirror:true,mat:"glass"}),...xt(26.7),u([.6,.3,.3],[0,26.3,j],"a")],100),we("hearts","Heart glasses",{a:"#e8436b",b:"#ff8fb0"},"a",[u([2.6,1.3,.3],[1.6,26.1,j],"b",{mirror:true,mat:"glass"}),u([1.7,.8,.3],[1.6,25.1,j],"b",{mirror:true,mat:"glass"}),u([.8,.6,.3],[1.6,24.5,j],"b",{mirror:true,mat:"glass"}),u([1.1,.7,.32],[1,26.9,j],"a",{mirror:true}),u([1.1,.7,.32],[2.2,26.9,j],"a",{mirror:true}),u([.8,.3,.3],[0,26.3,j],"a"),...xt(26.6)],120),we("stars","Star glasses",{a:"#d8b030",b:"#ffe27a"},"a",[u([2.8,.9,.3],[1.6,26,j],"b",{mirror:true,mat:"glass"}),u([1.2,2.6,.3],[1.6,25.8,j],"b",{mirror:true,mat:"glass"}),u([.6,.7,.32],[1.6,27.3,j],"a",{mirror:true}),u([.8,.3,.3],[0,26.3,j],"a"),...xt(26.6)],120),we("goggles","Ski goggles",{a:"#2f5fd0",g:"#ff9a3c"},"a",[u([7.6,2.4,.4],[0,25.9,-4.8],"g",{mat:"glass"}),u([8.2,.5,.6],[0,27.35,-4.6],"a"),u([8.2,.5,.6],[0,24.45,-4.6],"a"),u([.5,1.4,8.6],[4.5,25.9,0],"a",{mirror:true}),u([9.4,1.4,.5],[0,25.9,4.5],"a")],150),we("monocle","Monocle",{a:"#d8b030",g:"#e0f0ff"},null,[u([2.4,.25,.25],[-1.6,27,j],"a",{mat:"metal"}),u([2.4,.25,.25],[-1.6,24.6,j],"a",{mat:"metal"}),u([.25,2.4,.25],[-2.8,25.8,j],"a",{mat:"metal"}),u([.25,2.4,.25],[-0.4,25.8,j],"a",{mat:"metal"}),u([2.2,2.2,.12],[-1.6,25.8,j],"g",{mat:"glass"}),u([.2,3.2,.2],[-2.9,22.9,-4.7],"a",{mat:"metal"})],150),we("3d","3D glasses",{a:"#f4f1ea",r:"#e0302a",c:"#2f8fe0"},null,[u([6.9,.5,.35],[0,27,j],"a"),u([6.9,.5,.35],[0,24.6,j],"a"),u([.5,2.9,.35],[3.2,25.8,j],"a",{mirror:true}),u([.8,2.9,.35],[0,25.8,j],"a"),u([2.3,1.9,.15],[1.6,25.8,j],"r",{mat:"glass"}),u([2.3,1.9,.15],[-1.6,25.8,j],"c",{mat:"glass"}),...xt(26.6)],100),we("eyepatch","Eye patch",{a:"#1d1d21"},null,[u([2.6,2.4,.4],[1.6,25.9,-4.3],"a"),u([5,.4,.3],[-1,27.3,-4.3],"a"),u([.3,.5,8.6],[4.4,27.3,0],"a",{mirror:true}),u([8.9,.5,.3],[0,27.3,4.4],"a")],100)];var ka=(e,t)=>(r,a,o,n,s,l)=>ge({id:`${t}.${r}`,slot:e,name:a,palette:o,tint:n,textures:s.textures??{},paint:s.paint??[],parts:s.parts??[]},l),rt=ka("shoes","shoes"),Dr=ka("hands","hands"),Nr=ka("waist","waist"),Aa=(e="a")=>A([9.45,1.25,4.97],[0,13.15,0],e),Yo=[rt("bunny","Bunny slippers",{a:"#f4f1ea",b:"#f08cb4"},"b",{paint:[{region:"feet",color:"a"}],parts:[q("shinR",[.6,1.6,.4],[1.3,2.2,-2.4],"a"),q("shinR",[.6,1.6,.4],[2.9,2.2,-2.4],"a"),q("shinR",[.9,.7,.5],[2.1,1.1,-3.3],"b")]}),rt("rainboots","Rain boots",{a:"#f2c14e",b:"#2b2140"},"a",{paint:[{region:"feet",color:"a",faces:{bottom:"b"}}],parts:[q("shinR",[4.6,5,4.6],[2.1,3.5,0],"a")]}),rt("runners","Running shoes",{a:"#2ab0c0",b:"#f4f1ea",c:"#e8436b"},"a",{textures:{sd:J(["aaaaa","acaca","bbbbb"])},paint:[{region:"feet",color:"a",faces:{left:"sd",right:"sd",bottom:"b"}}],parts:[q("shinR",[4.4,.5,5.5],[2.1,.25,-0.5],"b")]}),rt("rollers","Roller skates",{a:"#e8436b",b:"#f4f1ea",c:"#2b2140"},"a",{paint:[{region:"feet",color:"a"}],parts:[q("shinR",[4.5,3,4.6],[2.1,2.6,0],"a"),q("shinR",[3.4,.4,5],[2.1,.2,-0.5],"b"),q("shinR",[3.6,.9,.9],[2.1,-0.05,-2.4],"c"),q("shinR",[3.6,.9,.9],[2.1,-0.05,1.4],"c")]},150),rt("iceskates","Ice skates",{a:"#f4f1ea",b:"#c8ccd2"},"a",{paint:[{region:"feet",color:"a"}],parts:[q("shinR",[4.5,3.2,4.6],[2.1,2.7,0],"a"),q("shinR",[.35,.6,5.8],[2.1,-0.2,-0.5],"b",{mat:"metal"})]},150),rt("cowboy","Cowboy boots",{a:"#7a4f2a",b:"#4a2e1a"},"a",{paint:[{region:"feet",color:"a"}],parts:[q("shinR",[4.7,4.6,4.7],[2.1,3.6,0],"a"),q("shinR",[3,.6,1.4],[2.1,.3,1.6],"b")]},120),rt("space","Space boots",{a:"#f4f1ea",b:"#9aa4ae"},null,{paint:[{region:"feet",color:"a"}],parts:[q("shinR",[5,4.6,5],[2.1,3.3,0],"a"),q("shinR",[4.6,.6,5.8],[2.1,.3,-0.5],"b")]},150),rt("platform","Platform sneakers",{a:"#1d1d21",w:"#f4f1ea"},"a",{textures:{toe:J(["aaaa","wwww"]),side:J(["aaaaa","wwwww"])},paint:[{region:"feet",color:"a",faces:{front:"toe",back:"toe",left:"side",right:"side",bottom:"w"}}],parts:[q("shinR",[4.5,1.2,5.6],[2.1,.6,-0.5],"w")]},100)],$o=[Dr("mittens","Mittens",{a:"#c0392b",b:"#f4f1ea"},"a",{paint:[{region:"hands",color:"a"}],parts:[q("foreArmR",[3.7,.9,3.7],[6.3,14.3,0],"b")]}),Dr("fingerless","Fingerless gloves",{a:"#2b2140",s:"@skin"},"a",{textures:{fl:J(["sss","aaa","aaa"])},paint:[{region:"hands",color:"a",faces:{front:"fl",back:"fl",left:"fl",right:"fl",bottom:"s"}}]}),Dr("wristbands","Wristbands",{a:"#e8436b"},"a",{parts:[q("foreArmR",[3.8,1.2,3.8],[6.3,14.7,0],"a")]}),Dr("boxing","Boxing gloves",{a:"#c0392b",b:"#f4f1ea"},"a",{paint:[{region:"hands",color:"a"}],parts:[q("foreArmR",[4.2,3.6,4.2],[6.3,12.5,-0.2],"a"),q("foreArmR",[3.8,1,3.8],[6.3,14.6,0],"b")]},100)],Ko=[Nr("fannypack","Fanny pack",{a:"#2b2140",b:"#534ab7",m:"#c8ccd2"},"b",{parts:[A([9.45,.8,4.97],[0,13.6,0],"a"),A([4,2,1.6],[0,13.6,-3.1],"b"),A([3.2,.2,.15],[0,14.3,-3.92],"m",{mat:"metal"})]}),Nr("tools","Tool belt",{a:"#5a3a22",b:"#8a5a32",m:"#9aa4ae",h:"#c0612b"},"a",{parts:[Aa(),A([2.2,2.2,1.3],[3.2,12,-2.8],"b",{mirror:true}),A([.5,2.6,.5],[-1.4,11.8,-3.1],"h"),A([1.6,.7,.7],[-1.4,13.2,-3.1],"m",{mat:"metal"})]},80),Nr("sheath","Sword sheath",{a:"#3a2a22",b:"#5a3a22",m:"#c8ccd2"},"a",{parts:[Aa(),A([.9,4.8,1.2],[4.9,12.1,0],"b"),A([1.6,.4,.8],[4.9,14.7,0],"m",{mat:"metal"}),A([.6,1.4,.6],[4.9,15.6,0],"a")]},120),Nr("pouches","Double pouches",{a:"#3a2a22",b:"#6b6b4a"},"b",{parts:[Aa("a"),A([2.4,2.4,1.3],[2.6,11.8,-2.9],"b",{mirror:true})]},60)];var Fe=u([9.21,2.05,8.73],[0,29.91,0],"a"),at=u([9.21,1.7,.73],[0,28.72,-4.36],"a"),nr=u([.71,1.7,2.8],[4.5,28.72,-2.9],"a",{mirror:true}),ot=(e,t)=>u([.71,e,7.58],[4.6,t,.51],"a",{mirror:true}),nt=(e,t)=>u([9.21,e,.73],[0,t,4.36],"a"),he=(e,t,r,a,o={a:"#3b2a20"})=>ge({id:`hair.${e}`,slot:"hair",name:t,palette:o,tint:"a",parts:r},a),Xo=[he("afro","Afro",[u([11.4,4.4,10.2],[0,31.3,.6],"a"),u([10.6,2.2,8.2],[0,27.2,1.5],"a"),u([1.2,4.2,7.4],[5,26.4,1.2],"a",{mirror:true}),u([9.6,4.4,1.3],[0,26.2,4.9],"a"),u([8.6,1.9,.8],[0,28.95,-4.5],"a")]),he("buzz","Buzz cut",[u([8.9,.6,8.4],[0,30.45,0],"a"),u([.4,2.6,7.6],[4.42,28.9,.2],"a",{mirror:true}),u([8.9,3.6,.4],[0,28.4,4.2],"a"),u([8.9,.8,.4],[0,29.75,-4.2],"a")]),he("sidepart","Side part",[Fe,u([5.5,2.4,.9],[-1.85,28.6,-4.4],"a"),u([3.7,1.3,.73],[2.75,29.1,-4.36],"a"),ot(3.41,27.86),nt(4.77,27.18),u([3.2,1,3.4],[-1.6,31.3,-1.4],"a")]),he("pigtails","Pigtails",[Fe,at,nr,ot(3.41,27.86),nt(4.77,27.18),u([1.9,4.6,1.9],[4.9,26,1.6],"a",{mirror:true}),u([2.1,.8,2.1],[4.9,28.4,1.6],"b",{mirror:true})],void 0,{a:"#3b2a20",b:"#d4537e"}),he("braids","Braids",[Fe,at,ot(3.41,27.86),nt(4.77,27.18),u([1.6,5.6,1.6],[3.4,25,3.9],"a",{mirror:true}),u([1.9,.6,1.9],[3.4,22.5,3.9],"b",{mirror:true})],void 0,{a:"#3b2a20",b:"#f2c14e"}),he("bowl","Bowl cut",[u([9.9,3.2,9.4],[0,29,0],"a"),u([9.4,1,8.9],[0,30.9,0],"a"),u([9.6,3.6,.9],[0,27,4.5],"a")]),he("dreads","Dreadlocks",[Fe,at,u([1.3,5,1.3],[4.75,25.6,-1.6],"a",{mirror:true}),u([1.3,5.6,1.3],[4.75,25.3,1.7],"a",{mirror:true}),u([1.3,6,1.3],[2.4,25,4.75],"a",{mirror:true}),u([1.3,6.2,1.3],[0,25.2,4.8],"a"),nt(3.2,28.3)],120),he("longwavy","Long waves",[Fe,at,nr,u([1.06,6.82,7.88],[4.78,26.16,.66],"a",{mirror:true}),u([9.21,7.5,1.09],[0,26.16,4.55],"a"),u([1.3,2,8],[5.1,23.4,.9],"a",{mirror:true}),u([9.8,2,1.4],[0,23.2,4.85],"a")],120),he("topknot","Top knot",[Fe,at,nr,ot(2.73,28.2),nt(4.09,27.52),u([3.2,2.8,3.2],[0,32.3,0],"a"),u([3.5,.6,3.5],[0,31.1,0],"b")],100,{a:"#3b2a20",b:"#1d1d21"}),he("spacebuns","Space buns",[Fe,at,nr,ot(3.41,27.86),nt(4.77,27.18),u([3,3,3],[3,31.8,.5],"a",{mirror:true})],120),he("emo","Swept fringe",[Fe,u([6.5,3.8,.9],[-1.3,27.6,-4.45],"a"),u([2.7,1.3,.73],[3.25,29.1,-4.36],"a"),ot(4.5,27.3),nt(5.4,26.9)],100),he("quiff","Quiff",[Fe,u([8,2.4,3.2],[0,31.4,-2.6],"a"),u([8.6,1.2,1.2],[0,30.6,-4.4],"a"),ot(2.73,28.2),nt(4.09,27.52)],100),he("mullet","Mullet",[Fe,at,nr,ot(2.73,28.2),u([9.21,7,1.09],[0,25.8,4.55],"a"),u([8,2,1.6],[0,23.2,4.9],"a")],80),he("wavybob","Wavy bob",[Fe,at,u([1.06,6.13,8.6],[4.78,26.84,.3],"a",{mirror:true}),u([9.21,6.14,1.09],[0,26.5,4.55],"a"),u([1.5,1.2,8.8],[5.1,24.1,.3],"a",{mirror:true}),u([9.6,1.2,1.5],[0,24.1,4.8],"a")],100),he("curls","Shoulder curls",[u([9.92,2.39,9.45],[0,30.08,0],"a"),u([9.21,1.36,.73],[0,28.89,-4.8],"a"),u([2.83,2.73,2.91],[3.54,28.89,-2.55],"a",{mirror:true}),u([2.83,2.73,2.91],[3.54,28.89,1.82],"a",{mirror:true}),u([5.67,2.05,5.82],[0,31.61,0],"a"),u([4.25,4.27,2.18],[2.13,27.27,4],"a",{mirror:true}),u([2.6,4,2.6],[4.4,24.4,2.4],"a",{mirror:true})],150),he("undercut","Undercut",[u([9.21,2.6,8.73],[0,30.2,0],"a"),u([9.21,1.7,2],[0,29.9,-4.3],"a"),u([.4,2.6,7.6],[4.42,28.2,.2],"b",{mirror:true}),u([8.9,3.4,.4],[0,27.6,4.2],"b")],120,{a:"#3b2a20",b:"#2a1d16"})];var le=(e,t,r,a,o,n)=>ge({id:`hat.${e}`,slot:"hat",name:t,palette:r,tint:a,parts:o},n),Sa=u([9.4,.7,1.2],[0,30.6,0],"c"),Wo=[le("tophat","Top hat",{a:"#1d1d21",b:"#a32d2d"},"a",[u([11.4,.55,11],[0,30.6,0],"a"),u([8.6,6,8.2],[0,33.9,0],"a"),u([8.8,.9,8.4],[0,31.4,0],"b")],150),le("cowboy","Cowboy hat",{a:"#9a6a3a",b:"#4a2e1a"},"a",[u([13,.6,12],[0,30.4,0],"a"),u([.8,1.2,11],[6.1,31,0],"a",{mirror:true}),u([8.4,3.5,8],[0,32.4,0],"a"),u([8.6,.7,8.2],[0,31.1,0],"b")],150),le("tricorn","Tricorn",{a:"#2c2420",b:"#d8b030"},"a",[u([10.4,2.4,10],[0,31.2,0],"a"),u([.8,2.6,8],[5.2,31.6,0],"a",{mirror:true}),u([9,2.6,.8],[0,31.6,4.8],"a"),u([3,2.2,.8],[0,31.4,-5],"a"),u([8,.4,.6],[0,30.2,-5.2],"b",{mat:"metal"})],180),le("chef","Chef hat",{a:"#f6f4ee",b:"#e2ded2"},null,[u([9.8,2,9.4],[0,30.7,0],"b"),u([10.6,4.5,10.2],[0,33.9,0],"a")],100),le("beret","Beret",{a:"#a32d2d"},"a",[u([10,1.6,9.6],[-0.4,31,0],"a"),u([.8,.8,.8],[0,32,0],"a")]),le("hardhat","Hard hat",{a:"#f2c14e",b:"#d8a030"},"a",[u([9.8,3,9.4],[0,31.3,0],"a"),u([9.8,.5,2.5],[0,30,-5.5],"a"),u([1,.8,9.6],[0,33,0],"b")],80),le("viking","Viking helmet",{a:"#9aa4ae",b:"#6a5a3a",c:"#f0e6d0"},"a",[u([9.8,3.2,9.4],[0,31.2,0],"a",{mat:"metal"}),u([10.2,1,9.8],[0,29.9,0],"b"),u([1.4,1.4,1.4],[5.5,31.6,0],"c",{mirror:true}),u([1.1,2.4,1.1],[6.2,33.2,0],"c",{mirror:true}),u([.8,2.2,.5],[0,28.6,-5.05],"a",{mat:"metal"})],200),le("space","Space helmet",{a:"#bfe6ff",b:"#d8dde4",c:"#ff5a3c"},null,[u([11,10.4,10.8],[0,27,0],"a",{mat:"glass"}),u([10,1,9.6],[0,22.3,0],"b",{mat:"metal"}),u([1.2,1.2,.6],[0,32.4,-1.6],"c",{mat:"glow"})],250),le("catears","Cat ears",{a:"#2b2140",b:"#f08cb4",c:"#2b2140"},"a",[Sa,u([2,2.2,1],[2.9,32,0],"a",{mirror:true}),u([1.1,1.3,.4],[2.9,31.8,-0.65],"b",{mirror:true})]),le("bunnyears","Bunny ears",{a:"#f4f1ea",b:"#f08cb4",c:"#f4f1ea"},"a",[Sa,u([1.5,5.4,.9],[1.9,33.6,0],"a",{mirror:true}),u([.8,4.2,.3],[1.9,33.4,-0.55],"b",{mirror:true})],80),le("foxears","Fox ears",{a:"#e8862a",b:"#2a1c14",c:"#2a1c14"},"a",[Sa,u([2.4,2.8,1],[2.8,32.2,0],"a",{mirror:true}),u([2.4,.9,1.05],[2.8,33.55,0],"b",{mirror:true})],80),le("halo","Halo",{a:"#ffe27a"},"a",[u([6,.5,1],[0,33.4,-2.5],"a",{mat:"glow"}),u([6,.5,1],[0,33.4,2.5],"a",{mat:"glow"}),u([1,.5,4],[2.5,33.4,0],"a",{mat:"glow",mirror:true})],250),le("horns","Little horns",{a:"#c0392b",b:"#7a1d1d"},"a",[u([1.4,1.8,1.4],[2.6,31.1,-0.6],"a",{mirror:true}),u([.9,1.2,.9],[2.9,32.5,-0.6],"b",{mirror:true})],120),le("party","Party hat",{a:"#7f77dd",b:"#f2c14e"},"a",[u([6,1.6,6],[0,31.1,0],"a"),u([4.4,1.8,4.4],[0,32.8,0],"b"),u([2.8,1.8,2.8],[0,34.6,0],"a"),u([1.4,1.6,1.4],[0,36.3,0],"b"),u([1.6,1.2,1.6],[0,37.3,0],"a")]),le("flowers","Flower wreath",{a:"#4c9a4a",b:"#f08cb4",c:"#f2d33c",d:"#f4f1ea"},null,[u([9.6,.9,9.2],[0,30.4,0],"a"),u([1.4,1.2,1.4],[3,30.9,-4.4],"b",{mirror:true}),u([1.4,1.2,1.4],[0,31,-4.6],"c"),u([1.4,1.2,1.4],[4.7,30.9,.5],"d",{mirror:true}),u([1.4,1.2,1.4],[2.6,30.9,4.5],"c",{mirror:true})],120),le("bandana","Bandana",{a:"#c0392b"},"a",[u([9.6,2.4,9.2],[0,30.1,0],"a"),u([2,1.6,1.6],[0,29.4,5],"a"),u([1,2.6,.6],[.7,27.6,5.2],"a",{mirror:true})]),le("ninja","Ninja headband",{a:"#2b2140",b:"#c8ccd2"},"a",[u([9.4,1.3,9],[0,28.8,0],"a"),u([3,1.1,.4],[0,28.8,-4.7],"b",{mat:"metal"}),u([.9,3,.5],[.7,27,4.9],"a",{mirror:true})],100),le("propeller","Propeller cap",{a:"#2f5fd0",b:"#f2d33c",c:"#c0392b"},"a",[u([9.63,2.73,9.16],[0,30.8,.15],"a"),u([7.79,.55,3.64],[0,29.57,-5.96],"a"),u([.6,1.2,.6],[0,32.7,0],"b"),u([7,.3,1.2],[0,33.4,0],"c"),u([1.2,.3,7],[0,33.4,0],"b")],150)];var Br=e=>({front:e,back:e,left:e,right:e}),ce=(e,t,r,a,o,n)=>ge({id:`top.${e}`,slot:"top",name:t,palette:r,tint:a,textures:o.textures??{},paint:o.paint,parts:o.parts??[]},n),l0=J(["abaabaab","bbbbbbbb","abaabaab","abaabaab","bbbbbbbb","abaabaab","abaabaab","abaabaab"]),Jo=[ce("flannel","Flannel shirt",{a:"#c0392b",b:"#2b2140"},"a",{textures:{pl:l0},paint:[{region:"torso",color:"a",faces:Br("pl")},{region:"arms",color:"a",faces:Br("pl")}],parts:[A([5.6,.8,.5],[0,22.2,-2.4],"b")]}),ce("polo","Polo shirt",{a:"#1d9e75",w:"#f4f1ea"},"a",{textures:{pk:J(["aaawaaaa","aaawaaaa","aaawaaaa","aaaaaaaa","aaaaaaaa","aaaaaaaa","aaaaaaaa","aaaaaaaa"])},paint:[{region:"torso",color:"a",faces:{front:"pk"}},{region:"sleeves",color:"a"}],parts:[A([4.6,.9,.6],[0,22.4,-2.3],"a")]}),ce("heart","Heart sweater",{a:"#d4537e",b:"#f4f1ea"},"a",{textures:{h:J(["aaaaaaaa","aabaabaa","abbbbbba","abbbbbba","aabbbbaa","aaabbaaa","aaaaaaaa","aaaaaaaa"])},paint:[{region:"torso",color:"a",faces:{front:"h"}},{region:"arms",color:"a"}]}),ce("gamer","Gamepad tee",{a:"#2b2140",b:"#9aa4ae",c:"#33e0ff",d:"#e8436b"},"a",{textures:{g:J(["aaaaaaaa","aaaaaaaa","abbbbbba","bcbbbdbb","bbbbbbbb","abbaabba","aaaaaaaa","aaaaaaaa"])},paint:[{region:"torso",color:"a",faces:{front:"g"}},{region:"sleeves",color:"a"}]}),ce("jersey","Sports jersey",{a:"#2f5fd0",w:"#f4f1ea"},"a",{textures:{n:J(["aaaaaaaa","aawwwwaa","aaaaawaa","aaaawaaa","aaawaaaa","aaawaaaa","aaaaaaaa","aaaaaaaa"]),sl:J(["aaa","www","aaa"])},paint:[{region:"torso",color:"a",faces:{front:"n",back:"n"}},{region:"sleeves",color:"a",faces:Br("sl")}]}),ce("dress","Dress",{a:"#7f77dd",b:"#f4f1ea"},"a",{paint:[{region:"torso",color:"a"},{region:"sleeves",color:"a"}],parts:[A([10.2,5,5.6],[0,12.1,0],"a"),A([9,.8,4.6],[0,14.9,0],"b")]}),ce("bomber","Varsity jacket",{a:"#a32d2d",b:"#f4f1ea",c:"#2b2140"},"a",{textures:{fr:J(["aaabbaaa","aaabbaaa","abaabaaa","abaabaaa","aaabbaaa","aaabbaaa","aaabbaaa","aaabbaaa"]),cf:J(["bbb","bbb","bbb","bbb","ccc"])},paint:[{region:"torso",color:"a",faces:{front:"fr"}},{region:"arms",color:"b",faces:Br("cf")}],parts:[A([8.8,.9,4.6],[0,12.9,0],"c")]},120),ce("puffer","Puffer jacket",{a:"#ef9f27",b:"#c87f17"},"a",{paint:[{region:"torso",color:"a"},{region:"arms",color:"a"}],parts:[A([9.6,3.2,5.2],[0,20.6,0],"a"),A([9.4,3,5],[0,17.4,0],"b"),A([9,3,4.8],[0,14.3,0],"a"),q("armR",[4,2.2,4],[6.3,20.4,0],"a")]},150),ce("overalls","Overalls",{a:"#2f5fd0",b:"#f4f1ea",g:"#d8b030"},"a",{paint:[{region:"torso",color:"b"},{region:"sleeves",color:"b"}],parts:[A([6,5,.5],[0,17.8,-2.4],"a"),A([1.2,4,.5],[2.4,20.6,-2.4],"a",{mirror:true}),A([.6,.6,.3],[2.4,21.7,-2.75],"g",{mirror:true,mat:"metal"}),A([1.2,9,.5],[2.4,17.5,2.4],"a",{mirror:true}),A([8.8,4.4,4.6],[0,14.8,0],"a")]},100),ce("labcoat","Lab coat",{a:"#f4f1ea",b:"#9ad0f0"},null,{paint:[{region:"torso",color:"a"},{region:"arms",color:"a"}],parts:[A([9,4.5,4.8],[0,11.8,0],"a"),A([1.6,4,.4],[1.6,19.8,-2.45],"a",{mirror:true}),A([1.6,1.4,.3],[-2.6,17,-2.4],"b")]},120),ce("ninja","Ninja suit",{a:"#2b2140",r:"#c0392b",g:"#3c3450"},"a",{textures:{wr:J(["agaaaaaa","aagaaaaa","aaagaaaa","aaaagaaa","aaaaagaa","aaaaaaga","aaaaaaaa","aaaaaaaa"])},paint:[{region:"torso",color:"a",faces:{front:"wr"}},{region:"arms",color:"a"}],parts:[A([9.2,1,4.8],[0,14.3,0],"r")]},150),ce("space","Space suit",{a:"#f4f1ea",b:"#9aa4ae",c:"#33e0ff",d:"#e8436b"},null,{paint:[{region:"torso",color:"a"},{region:"arms",color:"a"}],parts:[A([5,3.6,.6],[0,19,-2.5],"b"),A([.6,.6,.3],[-1.2,19.6,-2.9],"c",{mat:"glow"}),A([.6,.6,.3],[1.2,19.6,-2.9],"d",{mat:"glow"}),q("armR",[4.2,1,4.2],[6.3,22.4,0],"b"),A([7,.8,5],[0,22.6,0],"b",{mat:"metal"})]},250),ce("pirate","Pirate shirt",{a:"#f4f1ea",b:"#5a3a22",r:"#a32d2d"},null,{textures:{v:J(["aabbbbaa","aaabbaaa","aabaabaa","aaabbaaa","aaaaaaaa","aaaaaaaa","aaaaaaaa","aaaaaaaa"])},paint:[{region:"torso",color:"a",faces:{front:"v"}},{region:"arms",color:"a"}],parts:[q("foreArmR",[4.2,3,4.2],[6.3,15.6,0],"a"),A([9.2,1.4,4.8],[0,13.6,0],"r")]},120),ce("raincoat","Raincoat",{a:"#f2c14e",b:"#d8a030"},"a",{textures:{bt:J(["aaaaaaaa","aaabaaaa","aaaaaaaa","aaabaaaa","aaaaaaaa","aaabaaaa","aaaaaaaa","aaaaaaaa"])},paint:[{region:"torso",color:"a",faces:{front:"bt"}},{region:"arms",color:"a"}],parts:[A([7,3.6,2],[0,21.5,2.9],"a"),A([9,4,4.8],[0,12,0],"a")]},100),ce("vest","Vest and shirt",{a:"#5a3a22",b:"#f4f1ea"},"a",{paint:[{region:"torso",color:"b"},{region:"arms",color:"b"}],parts:[A([4.2,7,.5],[2.2,17.5,-2.4],"a",{mirror:true}),A([9,9,.5],[0,17.4,2.4],"a")]},80),ce("chef","Chef jacket",{a:"#f6f4ee",b:"#2b2140"},null,{textures:{db:J(["aaaaaaaa","aabaabaa","aaaaaaaa","aabaabaa","aaaaaaaa","aabaabaa","aaaaaaaa","aaaaaaaa"])},paint:[{region:"torso",color:"a",faces:{front:"db"}},{region:"arms",color:"a"}],parts:[A([5,.8,.5],[0,22.3,-2.4],"a")]},80),ce("tuxedo","Tuxedo",{a:"#1d1d21",w:"#f4f1ea"},null,{textures:{tx:J(["aawwwwaa","aaawwaaa","aaawwaaa","aaawwaaa","aaaaaaaa","aaaaaaaa","aaaaaaaa","aaaaaaaa"])},paint:[{region:"torso",color:"a",faces:{front:"tx"}},{region:"arms",color:"a"}],parts:[A([2,1,.4],[0,21.7,-2.6],"a"),A([8.6,4,.6],[0,11.6,2.4],"a")]},200),ce("leather","Leather jacket",{a:"#2a2420",b:"#c8ccd2"},"a",{paint:[{region:"torso",color:"a"},{region:"arms",color:"a"}],parts:[A([2.6,1.6,.6],[2.5,22.1,-2.25],"a",{mirror:true}),A([.4,8,.3],[-0.8,16.8,-2.45],"b",{mat:"metal"})]},180)];var sr=[...Xo,...Jo,...Uo,...Yo,...$o,...Ko,...jo,...Go,...qo,...Wo];function Ce(e){let t=It(e);if(!t.ok)throw new Error(`avatar shop: ${String(e.id)}: ${t.errors.join("; ")}`);return t.item}var va=e=>({w:e[0].length,h:e.length,rows:e}),c0={bone:"head",size:[9.21,2.05,8.73],pos:[0,29.91,0],color:"a"},m0={bone:"head",size:[9.21,1.7,.73],pos:[0,28.72,-4.36],color:"a"},Zo=[{price:250,item:Ce({id:"hat.crown",slot:"hat",name:"Crown",palette:{a:"#e8b730",g:"#d23c4a"},tint:"a",parts:[{bone:"head",size:[9.21,1.7,.73],pos:[0,30.93,-4.36],color:"a"},{bone:"head",size:[9.21,1.7,.73],pos:[0,30.93,4.36],color:"a"},{bone:"head",size:[.71,1.7,8.73],pos:[4.6,30.93,0],color:"a",mirror:true},{bone:"head",size:[1.13,1.36,.73],pos:[2.98,32.47,-4.36],color:"a",mirror:true},{bone:"head",size:[1.13,1.77,.73],pos:[0,32.67,-4.36],color:"a"},{bone:"head",size:[.99,.95,.29],pos:[0,30.93,-4.87],color:"g"}]})},{price:250,item:Ce({id:"back.wings",slot:"back",name:"Angel wings",palette:{a:"#f7f5ff",b:"#d9d4f2"},tint:"a",parts:[{bone:"body",size:[2.25,7.5,1.47],pos:[1.69,21.15,3.04],color:"b",mirror:true},{bone:"body",size:[10.13,3.13,.74],pos:[7.31,26.15,3.86],color:"a",mirror:true},{bone:"body",size:[10.13,3.13,.74],pos:[7.88,23.03,4.05],color:"b",mirror:true},{bone:"body",size:[9,3.13,.74],pos:[8.44,19.9,4.23],color:"a",mirror:true},{bone:"body",size:[6.75,3.13,.74],pos:[9,16.77,4.42],color:"b",mirror:true},{bone:"body",size:[4.5,3.13,.74],pos:[9.56,13.65,4.6],color:"a",mirror:true},{bone:"body",size:[3.38,1.88,.74],pos:[11.25,28.65,3.86],color:"a",mirror:true}]})},{price:200,item:Ce({id:"hat.wizard",slot:"hat",name:"Wizard hat",palette:{a:"#3c2f8f",s:"#f2c14e"},tint:"a",parts:[{bone:"head",size:[10.63,.55,10.18],pos:[0,30.39,0],color:"a"},{bone:"head",size:[8.5,1.77,8],pos:[0,31.55,0],color:"a"},{bone:"head",size:[6.38,1.77,5.82],pos:[0,33.32,.36],color:"a"},{bone:"head",size:[4.25,1.77,4],pos:[0,35.09,.73],color:"a"},{bone:"head",size:[2.13,1.64,2.18],pos:[0,36.8,1.09],color:"a"},{bone:"head",size:[1.13,1.09,.29],pos:[0,31.61,-4.15],color:"s"}]})},{price:200,item:Ce({id:"top.armor",slot:"top",name:"Knight armor",palette:{a:"#b8c2cc",b:"#5b6672",g:"#e8b730"},tint:"a",paint:[{region:"torso",color:"b"},{region:"arms",color:"b"}],parts:[{bone:"body",size:[9.67,7.5,.74],pos:[0,18.65,-2.67],color:"a"},{bone:"armR",size:[4.32,2.94,4.32],pos:[6.3,22.38,0],color:"a",mirror:true},{bone:"body",size:[2.25,2.5,.37],pos:[0,19.27,-3.22],color:"g"}]})},{price:200,item:Ce({id:"back.sword",slot:"back",name:"Sword",palette:{a:"#d8dde4",g:"#e8b730",h:"#5a3a22"},tint:"g",parts:[{bone:"body",size:[1.35,12.5,.55],pos:[2.81,17.4,3.04],color:"a"},{bone:"body",size:[4.5,1.13,.92],pos:[2.81,24.21,3.04],color:"g"},{bone:"body",size:[1.01,3.75,.83],pos:[2.81,26.65,3.04],color:"h"},{bone:"body",size:[1.58,1.5,1.1],pos:[2.81,29.28,3.04],color:"g"}]})},{price:150,item:Ce({id:"hat.headphones",slot:"hat",name:"Headphones",palette:{a:"#2b2140",b:"#4be0c8"},tint:"b",parts:[{bone:"head",size:[9.63,.82,1.45],pos:[0,31.07,0],color:"a"},{bone:"head",size:[.57,3.41,.87],pos:[4.89,29.57,0],color:"a",mirror:true},{bone:"head",size:[1.13,2.45,2.62],pos:[4.96,27.39,0],color:"a",mirror:true},{bone:"head",size:[.28,1.64,1.75],pos:[5.6,27.39,0],color:"b",mirror:true}]})},{price:150,item:Ce({id:"hair.mohawk",slot:"hair",name:"Mohawk",palette:{a:"#d4537e"},tint:"a",parts:[{bone:"head",size:[1.84,3.07,8],pos:[0,31.78,0],color:"a"},{bone:"head",size:[1.84,2.05,1.45],pos:[0,31.27,-4.73],color:"a"},{bone:"head",size:[2.13,4.09,.73],pos:[0,28.2,4.36],color:"a"}]})},{price:150,item:Ce({id:"top.suit",slot:"top",name:"Suit and tie",palette:{a:"#2c2f3a",w:"#f4f1ea",r:"#c0392b"},tint:"a",textures:{front:va(["awwrrwwa","aawrrwaa","aaarraaa","aaarraaa","aaarraaa","aaaaaaaa","aaaaaaaa","aaaaaaaa"])},paint:[{region:"torso",color:"a",faces:{front:"front"}},{region:"arms",color:"a"}],parts:[{bone:"body",size:[1.35,1,.28],pos:[-2.92,19.9,-2.44],color:"w"}]})},{price:120,item:Ce({id:"hair.ponytail",slot:"hair",name:"Ponytail",palette:{a:"#3b2a20",b:"#d4537e"},tint:"a",parts:[c0,m0,{bone:"head",size:[.71,3.41,7.27],pos:[4.6,27.86,.36],color:"a",mirror:true},{bone:"head",size:[9.21,4.77,.73],pos:[0,27.18,4.36],color:"a"},{bone:"head",size:[2.27,1.02,1.75],pos:[0,28.55,4.95],color:"b"},{bone:"head",size:[1.84,5.45,1.45],pos:[0,25.82,5.09],color:"a"}]})},{price:120,item:Dt["face.visor"]},{price:100,item:Ce({id:"shoes.hightops",slot:"shoes",name:"High-tops",palette:{a:"#7f77dd",w:"#f4f1ea",b:"#2b2140"},tint:"a",textures:{toe:va(["aaaa","wwww"]),side:va(["aaaaa","wwwww"])},paint:[{region:"feet",color:"a",faces:{front:"toe",back:"toe",left:"side",right:"side",bottom:"w"}}],parts:[{bone:"shinR",size:[4.62,4.32,4.62],pos:[2.1,3.76,0],color:"b",mirror:true}]})},{price:50,item:Ce({id:"hands.gauntlets",slot:"hands",name:"Golden gauntlets",palette:{a:"#e8b730",b:"#b8862a"},tint:"a",paint:[{region:"hands",color:"a"}],parts:[{bone:"foreArmR",size:[4.32,1.75,4.32],pos:[6.3,13.78,0],color:"b",mirror:true}]})},{price:50,item:Ce({id:"waist.pouch",slot:"waist",name:"Belt pouch",palette:{a:"#3a2a22",b:"#7a5233"},tint:"b",parts:[{bone:"body",size:[9.45,1.25,4.97],pos:[0,13.15,0],color:"a"},{bone:"body",size:[2.7,2.5,1.29],pos:[2.93,11.9,-3.04],color:"b"}]})}],Qo=sr.filter(e=>e.price!==void 0),en=[...Zo,...Qo].map(e=>e.item),Ea=Object.fromEntries([...Zo,...Qo].map(e=>[e.item.id,e.price])),tn=e=>Object.prototype.hasOwnProperty.call(Ea,e);function X(e){let t=It(e);if(!t.ok)throw new Error(`avatar catalog: ${String(e.id)}: ${t.errors.join("; ")}`);return t.item}var Nt=e=>({w:e[0].length,h:e.length,rows:e}),ir={bone:"head",size:[9.21,2.05,8.73],pos:[0,29.91,0],color:"a"},Ta={bone:"head",size:[.71,1.7,2.8],pos:[4.5,28.72,-2.9],color:"a",mirror:true},lr={bone:"head",size:[9.21,1.7,.73],pos:[0,28.72,-4.36],color:"a"},p0=[X({id:"hair.short",slot:"hair",name:"Short",palette:{a:"#3b2a20"},tint:"a",parts:[ir,lr,Ta,{bone:"head",size:[.71,3.41,7.58],pos:[4.6,27.86,.51],color:"a",mirror:true},{bone:"head",size:[9.21,4.77,.73],pos:[0,27.18,4.36],color:"a"}]}),X({id:"hair.bob",slot:"hair",name:"Bob",palette:{a:"#3b2a20"},tint:"a",parts:[ir,lr,{bone:"head",size:[1.06,6.13,8.6],pos:[4.78,26.84,.3],color:"a",mirror:true},{bone:"head",size:[9.21,6.14,1.09],pos:[0,26.5,4.55],color:"a"}]}),X({id:"hair.spiky",slot:"hair",name:"Spiky",palette:{a:"#3b2a20"},tint:"a",parts:[ir,lr,{bone:"head",size:[.71,2.73,8.6],pos:[4.6,28.2,0],color:"a",mirror:true},{bone:"head",size:[9.21,2.73,.73],pos:[0,28.2,4.36],color:"a"},{bone:"head",size:[2.13,2.05,2.18],pos:[2.83,31.61,-0.73],color:"a",mirror:true},{bone:"head",size:[2.13,2.73,2.18],pos:[0,31.95,-0.73],color:"a"},{bone:"head",size:[2.13,2.05,2.18],pos:[-1.42,31.61,2.18],color:"a"},{bone:"head",size:[2.13,2.05,2.18],pos:[1.77,31.75,1.82],color:"a"}]}),X({id:"hair.long",slot:"hair",name:"Long",palette:{a:"#3b2a20"},tint:"a",parts:[ir,lr,Ta,{bone:"head",size:[1.06,6.82,7.88],pos:[4.78,26.16,.66],color:"a",mirror:true},{bone:"head",size:[9.21,7.5,1.09],pos:[0,26.16,4.55],color:"a"}]}),X({id:"hair.bun",slot:"hair",name:"Bun",palette:{a:"#3b2a20"},tint:"a",parts:[ir,lr,Ta,{bone:"head",size:[.71,2.73,6.48],pos:[4.6,28.2,1.06],color:"a",mirror:true},{bone:"head",size:[9.21,4.09,.73],pos:[0,27.52,4.36],color:"a"},{bone:"head",size:[4.25,3.41,3.64],pos:[0,32.64,1.82],color:"a"}]}),X({id:"hair.curly",slot:"hair",name:"Curly",palette:{a:"#3b2a20"},tint:"a",parts:[{bone:"head",size:[9.92,2.39,9.45],pos:[0,30.08,0],color:"a"},{bone:"head",size:[9.21,1.36,.73],pos:[0,28.89,-4.8],color:"a"},{bone:"head",size:[2.83,2.73,2.91],pos:[3.54,28.89,-2.55],color:"a",mirror:true},{bone:"head",size:[2.83,2.73,2.91],pos:[3.54,28.89,1.82],color:"a",mirror:true},{bone:"head",size:[5.67,2.05,5.82],pos:[0,31.61,0],color:"a"},{bone:"head",size:[4.25,4.27,2.18],pos:[2.13,27.27,4],color:"a",mirror:true}]})],d0=[X({id:"top.idos",slot:"top",name:"iDos Games tee",palette:{a:"#1565ff"},tint:null,paint:[{region:"torso",color:"a"},{region:"sleeves",color:"a"}]}),X({id:"top.tee",slot:"top",name:"Star tee",palette:{a:"#1d9e75",b:"#f4f1ea"},tint:"a",textures:{print:Nt(["aaaaaaaa","aaabbaaa","aabbbbaa","abbbbbba","aabbbbaa","aabaabaa","aaaaaaaa","aaaaaaaa"])},paint:[{region:"torso",color:"a",faces:{front:"print"}},{region:"sleeves",color:"a"}]}),X({id:"top.hoodie",slot:"top",name:"Hoodie",palette:{a:"#378add",b:"#24578f",w:"#f0f0f0"},tint:"a",paint:[{region:"torso",color:"a"},{region:"arms",color:"a"}],parts:[{bone:"body",size:[7.88,4.38,1.84],pos:[0,21.78,3.04],color:"a"},{bone:"body",size:[5.63,2.5,.46],pos:[0,15.52,-2.53],color:"b"},{bone:"body",size:[.56,2.75,.37],pos:[1.24,19.65,-2.48],color:"w",mirror:true}]}),X({id:"top.stripes",slot:"top",name:"Striped sweater",palette:{a:"#d4537e",b:"#f4f1ea"},tint:"a",textures:{st:Nt(["aaaaaaaa","aaaaaaaa","bbbbbbbb","aaaaaaaa","aaaaaaaa","bbbbbbbb","aaaaaaaa","aaaaaaaa"]),sl:Nt(["aaa","bbb","aaa","bbb","aaa"])},paint:[{region:"torso",color:"a",faces:{front:"st",back:"st",left:"st",right:"st"}},{region:"arms",color:"a",faces:{front:"sl",back:"sl",left:"sl",right:"sl"}}]}),X({id:"top.jacket",slot:"top",name:"Jacket",palette:{a:"#444441",b:"#f4f1ea",c:"#c8c2b4"},tint:"a",textures:{open:Nt(["aaabbaaa","aaabbaaa","aaabbaaa","aaabbaaa","aaabbaaa","aacbbcaa","aaabbaaa","aaabbaaa"])},paint:[{region:"torso",color:"a",faces:{front:"open"}},{region:"arms",color:"a"}],parts:[{bone:"body",size:[3.38,1.5,.92],pos:[2.48,22.53,-2.21],color:"a",mirror:true}]}),X({id:"top.tank",slot:"top",name:"Tank top",palette:{a:"#ef9f27"},tint:"a",paint:[{region:"torso",color:"a"}]})],h0=[X({id:"bottom.jeans",slot:"bottom",name:"Jeans",palette:{a:"#2f5fd0"},tint:"a",paint:[{region:"legs",color:"a"}]}),X({id:"bottom.shorts",slot:"bottom",name:"Shorts",palette:{a:"#5f6b7a",s:"@skin"},tint:"a",paint:[{region:"legs",color:"s"}],parts:[{bone:"legR",size:[4.62,5.4,4.62],pos:[2.1,9.7,0],color:"a",mirror:true}]}),X({id:"bottom.skirt",slot:"bottom",name:"Skirt",palette:{a:"#7f77dd",s:"@skin"},tint:"a",paint:[{region:"legs",color:"s"}],parts:[{bone:"body",size:[10.13,4.38,5.52],pos:[0,11.46,0],color:"a"}]}),X({id:"bottom.cargo",slot:"bottom",name:"Cargo pants",palette:{a:"#6b6b4a",b:"#55553a"},tint:"a",paint:[{region:"legs",color:"a"}],parts:[{bone:"legR",size:[.84,4.32,2.52],pos:[4.62,7,0],color:"b",mirror:true}]})],u0=[X({id:"shoes.sneakers",slot:"shoes",name:"Sneakers",palette:{a:"#d84a30",w:"#f4f1ea"},tint:"a",textures:{toe:Nt(["aaaa","wwww"]),side:Nt(["aaaaa","wwwww"])},paint:[{region:"feet",color:"a",faces:{front:"toe",back:"toe",left:"side",right:"side",bottom:"w"}}]}),X({id:"shoes.boots",slot:"shoes",name:"Boots",palette:{a:"#5a3a22",b:"#3a2414"},tint:"a",paint:[{region:"feet",color:"a",faces:{bottom:"b"}}],parts:[{bone:"shinR",size:[4.83,4.32,4.83],pos:[2.1,3.76,0],color:"a",mirror:true}]}),X({id:"shoes.sandals",slot:"shoes",name:"Sandals",palette:{a:"#b0773a",s:"@skin"},tint:"a",paint:[{region:"feet",color:"s"}],parts:[{bone:"shinR",size:[4.51,.48,5.57],pos:[2.1,.24,-0.53],color:"a",mirror:true},{bone:"shinR",size:[4.51,.4,1.05],pos:[2.1,1.12,-1.89],color:"a",mirror:true}]})],f0=[X({id:"hands.gloves",slot:"hands",name:"Gloves",palette:{a:"#2b2140"},tint:"a",paint:[{region:"hands",color:"a"}]})],b0=[X({id:"waist.belt",slot:"waist",name:"Belt",palette:{a:"#5a3a22",g:"#d8b030"},tint:"a",parts:[{bone:"body",size:[9.45,1.25,4.97],pos:[0,13.15,0],color:"a"},{bone:"body",size:[1.8,1.5,.37],pos:[0,13.15,-2.67],color:"g"}]})],y0=[X({id:"back.backpack",slot:"back",name:"Backpack",palette:{a:"#c0612b",b:"#8a3f18"},tint:"a",parts:[{bone:"body",size:[6.75,8.75,2.76],pos:[0,17.4,3.68],color:"a"},{bone:"body",size:[4.5,3.75,.55],pos:[0,14.9,5.34],color:"b"}]}),X({id:"back.cape",slot:"back",name:"Cape",palette:{a:"#a32d2d"},tint:"a",parts:[{bone:"body",size:[10.13,12.5,.55],pos:[0,16.15,2.67],color:"a"}]})],g0=[Dt["face.glasses"],Dt["face.shades"]],w0=[X({id:"hat.beanie",slot:"hat",name:"Beanie",palette:{a:"#534ab7",w:"#f4f1ea"},tint:"a",parts:[{bone:"head",size:[9.92,3.07,9.45],pos:[0,30.76,0],color:"a"},{bone:"head",size:[10.34,1.36,9.89],pos:[0,29.3,0],color:"a"},{bone:"head",size:[2.13,2.05,2.18],pos:[0,33.18,0],color:"w"}]}),X({id:"hat.cap",slot:"hat",name:"Cap",palette:{a:"#c0392b"},tint:"a",parts:[{bone:"head",size:[9.63,2.73,9.16],pos:[0,30.8,.15],color:"a"},{bone:"head",size:[7.79,.55,3.64],pos:[0,29.57,-5.96],color:"a"}]}),X({id:"hat.bucket",slot:"hat",name:"Bucket hat",palette:{a:"#c8b88a"},tint:"a",parts:[{bone:"head",size:[9.63,2.73,9.16],pos:[0,31.61,0],color:"a"},{bone:"head",size:[11.33,.55,10.91],pos:[0,30.39,0],color:"a"}]})],Vr=[...p0,...d0,...h0,...u0,...f0,...b0,...y0,...g0,...w0,...en.filter(e=>!sr.some(t=>t.item.id===e.id)),...sr.map(e=>e.item)],q1=Object.fromEntries(Vr.map(e=>[e.id,e]));function x0(e){return Vr.filter(t=>t.slot===e)}function rn(e){return x0(e).filter(t=>!tn(t.id))}var R0=["#f9e0cf","#f2c9a0","#e2ad80","#c88d62","#9c6844","#6e4a32"],A0=["#3b2a20","#1d1d21","#f2c14e","#c0612b","#ece6da","#7f77dd","#d4537e","#2ab0a0"],k0=["#3b2a20","#2f5fd0","#1d9e75","#7f77dd","#c0392b","#d8b030"],S0=["#1d9e75","#378add","#d4537e","#444441","#ef9f27","#534ab7","#c0392b","#e8e4da"],on={version:ft,style:Me,body:{skin:"#f2c9a0",height:1,head:"round"},face:{eyes:"round",eyeColor:"#3b2a20",brows:"soft",browColor:"#3b2a20",mouth:"smile",cheeks:true,marks:"none",emotion:"neutral"},anim:{...Qe},wear:{hair:"hair.short",top:"top.idos",bottom:"bottom.jeans",shoes:"shoes.sneakers"},tint:{}},an={hair:.92,top:1,bottom:1,shoes:1,hands:.1,waist:.2,back:.2,neck:.15,faceAcc:.25,hat:.35};function X1(e=Math.random){let t=n=>n[Math.floor(e()*n.length)],r=t(A0),a={},o={};for(let n of Object.keys(an)){if(e()>=an[n])continue;let s=rn(n);s.length&&(a[n]=t(s).id,o[n]=n==="hair"?r:t(S0));}return {version:ft,style:Me,body:{skin:t(R0),height:.95+e()*.1,head:t(rr)},face:{eyes:t(Zt),eyeColor:t(k0),brows:t(Qt),browColor:r==="#ece6da"||r==="#f2c14e"?"#8a6a3a":r,mouth:t(er),cheeks:e()<.6,marks:e()<.3?t(tr):"none",emotion:"neutral"},anim:{...Qe},wear:a,tint:o}}var v0={hair:{frame:"portrait",view:.5},hat:{frame:"head",view:.35},faceAcc:{frame:"portrait",view:.2},neck:{frame:"portrait",view:.3},top:{frame:"torso",view:.3},waist:{frame:"torso",view:.3},hands:{frame:"torso",view:.55},bottom:{frame:"legs",view:.3},shoes:{frame:"feet",view:.6},back:{frame:"full",view:Math.PI-.6}},E0=["hair","top","bottom","shoes"];function T0(e,t){let r=Pt(JSON.parse(JSON.stringify(on)));for(let a of Object.keys(r.wear))E0.includes(a)||delete r.wear[a];return r.tint={},r.wear[e]=t,r}function em(e,t){return {key:`item:${e.id}`,make:()=>({spec:T0(e.slot,e.id),items:{...t,[e.id]:e},opts:v0[e.slot]})}}function tm(e={}){let t=e.size??224,r=e.limit??800,a=e.budgetMs??14,o=new Map,n=new Map,s=[],l=null,i=false,d=(p,m)=>{for(o.delete(p),o.set(p,m);o.size>r;){let g=o.keys().next().value;URL.revokeObjectURL(o.get(g)),o.delete(g);}},c=()=>{if(i)return;i=true;let p=globalThis.requestIdleCallback;p?p(h,{timeout:120}):setTimeout(h,16);};function h(){i=false;let p=performance.now();for(;s.length&&performance.now()-p<a;){let m=s.shift(),g=n.get(m);if(g&&(n.delete(m),g.listeners.size!==0))try{l??=Vo({size:t});let{spec:b,items:v,opts:E}=g.make(),M=l.render(b,v,E),R=[...g.listeners];M.toBlob(k=>{if(!k)return;let y=URL.createObjectURL(k);d(m,y);for(let z of R)z(y);},"image/png");}catch{l?.dispose(),l=null;}}s.length&&c();}return {peek:p=>o.get(p)??null,request(p,m){let g=o.get(p.key);if(g)return d(p.key,g),m(g),()=>{};let b=n.get(p.key);b||(b={make:p.make,listeners:new Set},n.set(p.key,b),s.push(p.key)),b.listeners.add(m),c();let v=b;return ()=>v.listeners.delete(m)},release(){l?.dispose(),l=null;}}}var L0="voxel-avatar-v1";function lm(){return {standard:L0,style:Me,version:ft,slots:[...bt],eyes:[...Zt],brows:[...Qt],mouths:[...er],emotions:[...b$1],heads:[...rr],marks:[...tr],walks:[...fa],idles:[...ba],height:{min:Jt.min,max:Jt.max},items:[...Vr],shop:{...Ea},rules:{slots:{...ha},limits:{...yt},regions:[...pa],regionPairs:Object.fromEntries(Object.entries(da).map(([e,t])=>[e,[...t]])),faces:[...Ke],skinColor:ut,materials:[...St]}}}var M0=(e,t,r)=>"#"+[e,t,r].map(a=>Math.max(0,Math.min(255,Math.round(a))).toString(16).padStart(2,"0")).join("");function C0(e,t,r){let a=[];for(let o=0;o<r;o++)for(let n=0;n<t;n++){let s=Math.floor(n*e.width/t),l=Math.max(s+1,Math.floor((n+1)*e.width/t)),i=Math.floor(o*e.height/r),d=Math.max(i+1,Math.floor((o+1)*e.height/r)),c=0,h=0,p=0,m=0,g=0;for(let b=i;b<d;b++)for(let v=s;v<l;v++){let E=(b*e.width+v)*4;g++,!((e.data[E+3]??0)<128)&&(c+=e.data[E]??0,h+=e.data[E+1]??0,p+=e.data[E+2]??0,m++);}a.push(m*2<g?null:[c/m,h/m,p/m]);}return a}var cr=(e,t)=>(e[0]-t[0])**2+(e[1]-t[1])**2+(e[2]-t[2])**2;function pm(e,t){let r=yt.textureSide,o=Math.min(1,16/Math.max(e.width,e.height,1)),n=Math.max(1,Math.min(r,Math.round(t.w??e.width*o))),s=Math.max(1,Math.min(r,Math.round(t.h??e.height*o))),l=[...new Set(t.symbols)].slice(0,yt.palette);if(!l.length)throw new Error("pixelTextureFromImage: no palette symbols to use");let i=C0(e,n,s),d=i.filter(b=>!!b),c=new Map;for(let b of d){let v=b.map(M=>Math.round(M/8)).join(","),E=c.get(v);E?E.n++:c.set(v,{n:1,c:b});}let h=[...c.values()].sort((b,v)=>v.n-b.n||(b.c.join()<v.c.join()?-1:1)),p=[];for(let b of h){if(p.length>=l.length)break;p.every(v=>cr(v,b.c)>576)&&p.push([...b.c]);}!p.length&&h[0]&&(p=[[...h[0].c]]);for(let b=0;b<8&&p.length;b++){let v=p.map(()=>[0,0,0,0]);for(let E of d){let M=0;for(let k=1;k<p.length;k++)cr(E,p[k])<cr(E,p[M])&&(M=k);let R=v[M];R[0]+=E[0],R[1]+=E[1],R[2]+=E[2],R[3]+=1;}p=p.map((E,M)=>{let R=v[M];return R[3]?[R[0]/R[3],R[1]/R[3],R[2]/R[3]]:E});}let m={};p.forEach((b,v)=>m[l[v]]=M0(b[0],b[1],b[2]));let g=[];for(let b=0;b<s;b++){let v="";for(let E=0;E<n;E++){let M=i[b*n+E];if(!M||!p.length){v+=".";continue}let R=0;for(let k=1;k<p.length;k++)cr(M,p[k])<cr(M,p[R])&&(R=k);v+=l[R];}g.push(v);}return {texture:{w:n,h:s,rows:g},palette:m}}var z0="ugc.",dm=e=>e.startsWith(z0);export{uo as ACTION_TIME,wl as ANIM_EVENTS,z0 as AVATAR_AUTHOR_ITEM_PREFIX,Co as AVATAR_BASE_COLORS,et as AVATAR_FACE_RECT,rr as AVATAR_HEADS,Jt as AVATAR_HEIGHT,ba as AVATAR_IDLES,q1 as AVATAR_ITEMS,yt as AVATAR_ITEM_LIMITS,Vr as AVATAR_ITEM_LIST,Wi as AVATAR_ITEM_PRINTS,v0 as AVATAR_ITEM_SHOTS,m1 as AVATAR_PORTRAIT_BACKGROUND,At as AVATAR_RIG_ID,Ea as AVATAR_SHOP_DEFAULT_PRICES,en as AVATAR_SHOP_ITEM_LIST,bt as AVATAR_SLOTS,ft as AVATAR_SPEC_VERSION,L0 as AVATAR_STANDARD_ID,Me as AVATAR_STYLE,fa as AVATAR_WALKS,Cr as Animator,G as Art,Fr as AvatarActor,pa as BODY_REGIONS,N0 as BONE_ROLES,Qt as BROW_STYLES,te as CH,yl as CHANNELS,Va as CHARACTER_LIMITS,Da as CHARACTER_SPEC_VERSION,Xe as CLEAR,Er as CLIPS,S0 as CLOTH_COLORS,Hc as CREATURE_KINDS,Sr as CharacterView,on as DEFAULT_AVATAR,Qe as DEFAULT_AVATAR_ANIM,fi as DEFAULT_AVATAR_FACE,ua as DEFAULT_AVATAR_HEAD,Zr as DEFAULT_CHARACTER_SOURCE,cn as DEFAULT_COLORS,kt as DEFAULT_FINISH,Ot as DrawnFace,Ne as EMOTES,tc as EMOTE_IDS,ic as EMOTION_EVENTS,ec as EVERYDAY_IDS,Gt as EXPRESSIONS,zt as EXPRESSION_CHAIN,fr as EXTRA_BONE_ROLES,k0 as EYE_COLORS,Zt as EYE_STYLES,Ke as FACE_NAMES,vo as FACE_TEXELS,Ql as GESTURE_IDS,A0 as HAIR_COLORS,gl as HELD_KINDS,no as HUMAN_BOTTOMS,ul as HUMAN_HAIR,so as HUMAN_SHOES,oo as HUMAN_TOPS,qt as IDLE_STYLES,pi as LOCOMOTION,tr as MARK_STYLES,er as MOUTH_STYLES,St as PART_MATERIALS,Q0 as PART_SHAPES,la as POSTURE,da as REGION_PAIRS,Mt as REST,Ie as RIGS,ho as RIG_CLIPS,Ht as RIG_IDS,ci as SEAT_HEIGHT_PX,ut as SKIN_COLOR,R0 as SKIN_TONES,ha as SLOT_RULES,B0 as SOCKETS,Oc as VOXEL_CHARACTER_SYSTEM_PROMPT,Ir as VoxelActor,Ut as WALK_STYLES,Kr as acquireCharacter,pe as add,ko as applyPosture,lm as avatarCatalogExport,d1 as avatarFromServer,em as avatarItemShot,x0 as avatarItemsForSlot,T0 as avatarMannequinWith,xa as avatarPrints,_s as bandColors,Ct as bone,ja as bonesOf,Hl as characterFromImage,Ml as characterOf,Cl as characterSpecs,pt as clearPose,wa as composeAvatar,Rr as copyPose,Fo as createAvatarLighting,Vo as createAvatarSnapshotter,tm as createAvatarThumbQueue,jc as creatureCharacter,Ii as creatureSource,mt as defaultCharacter,yr as defaultCharacterName,Qr as disposeNameplate,ya as drawAvatarFace,rc as emoteLabelOf,lc as emotionFromText,rn as freeAvatarItemsForSlot,Jr as humanSource,dm as isAuthorAvatarItem,tn as isAvatarShopItem,tl as isDefaultCharacterName,Ro as isEmote,$ as isObj,Ka as layoutCharacter,lo as lerpPose,Ha as mirrorBone,io as nameplate,Ar as newAnimInput,je as normColor,Fl as npcCharacter,ke as num,zl as onCharacterKnown,Pt as parseAvatarSpec,Oe as parseCharacterSpec,Hr as pick,pm as pixelTextureFromImage,X1 as randomAvatar,Wr as recolor,Ll as registerCharacter,wr as releaseCharacter,i0 as renderAvatarCanvas,p1 as renderAvatarImage,el as rigOfSpec,Ao as sampleEmote,mi as sampleTrack,f as setCh,vt as specHash,jr as stableStringify,$t as standardFace,ra as styleParams,It as validateAvatarItem,br as vec3};