@idosgames/characters 0.0.0-stage → 0.1.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 (45) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +34 -2
  3. package/dist/PartsManager-CAVBKvp6.d.ts +589 -0
  4. package/dist/PartsManager-Cn3MU-VS.d.cts +589 -0
  5. package/dist/chunk-64D567CX.js +1 -0
  6. package/dist/chunk-BU66AZ2Z.js +1 -0
  7. package/dist/chunk-CGF2TQVK.js +1 -0
  8. package/dist/chunk-OF4BH3JZ.js +2 -0
  9. package/dist/chunk-WKHHFTK2.js +1 -0
  10. package/dist/chunk-Z5I76WRJ.js +1 -0
  11. package/dist/contract-DhZuKNIf.d.cts +24 -0
  12. package/dist/contract-DhZuKNIf.d.ts +24 -0
  13. package/dist/gltf/index.cjs +1 -0
  14. package/dist/gltf/index.d.cts +150 -0
  15. package/dist/gltf/index.d.ts +150 -0
  16. package/dist/gltf/index.js +1 -0
  17. package/dist/image-D5NaQeFz.d.cts +8 -0
  18. package/dist/image-D5NaQeFz.d.ts +8 -0
  19. package/dist/index.cjs +1 -0
  20. package/dist/index.d.cts +65 -0
  21. package/dist/index.d.ts +65 -0
  22. package/dist/index.js +1 -0
  23. package/dist/rig2d/editor/index.cjs +81 -0
  24. package/dist/rig2d/editor/index.d.cts +25 -0
  25. package/dist/rig2d/editor/index.d.ts +25 -0
  26. package/dist/rig2d/editor/index.js +81 -0
  27. package/dist/rig2d/index.cjs +17 -0
  28. package/dist/rig2d/index.d.cts +190 -0
  29. package/dist/rig2d/index.d.ts +190 -0
  30. package/dist/rig2d/index.js +17 -0
  31. package/dist/rig2d/phaser/index.cjs +2 -0
  32. package/dist/rig2d/phaser/index.d.cts +106 -0
  33. package/dist/rig2d/phaser/index.d.ts +106 -0
  34. package/dist/rig2d/phaser/index.js +1 -0
  35. package/dist/rig2d/three/index.cjs +2 -0
  36. package/dist/rig2d/three/index.d.cts +63 -0
  37. package/dist/rig2d/three/index.d.ts +63 -0
  38. package/dist/rig2d/three/index.js +1 -0
  39. package/dist/thumbnail-BhGEEXux.d.cts +49 -0
  40. package/dist/thumbnail-Bp-jK70T.d.ts +49 -0
  41. package/dist/voxel/index.cjs +54 -0
  42. package/dist/voxel/index.d.cts +972 -0
  43. package/dist/voxel/index.d.ts +972 -0
  44. package/dist/voxel/index.js +54 -0
  45. package/package.json +101 -4
@@ -0,0 +1,54 @@
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-WKHHFTK2.js';import {b,a}from'../chunk-CGF2TQVK.js';import*as _ from'three';var ct={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 ht={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 pt={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 mt={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 Ro=["root","body","head","armL","armR","legL","legR","legFL","legFR","legBL","legBR","tail","wingL","wingR","ear","hair","cape","antenna","static"],ke=["tail","wingL","wingR","ear","hair","cape","antenna","static"],Eo=["handR","handL","headTop","face","back","waist","shoulders"],be=["humanoid","quadruped","flyer","blob"];var q={humanoid:pt,quadruped:mt,flyer:ht,blob:ct};var dt=1,De=["front","back","left","right","top","bottom"],je=["neutral","blink","happy","sad","angry","surprised","scared","tired","hurt","talk"],Ge=["normal","bouncy","heavy","sneaky","robotic"],Ve=["calm","fidgety","proud"],gt={parts:64,bones:16,palette:32,textures:48,texturePixels:32768,textureSide:32,partSide:32,coord:64},pe={noise:.5,outline:.4,shade:.25,density:2},j=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),ge=t=>Array.isArray(t)?t:[];function W(t,e,r,o){let s=typeof t=="number"?t:typeof t=="string"?Number(t):NaN;return Number.isFinite(s)?Math.min(o,Math.max(r,s)):e}function Ne(t,e,r){if(typeof t!="string")return r;let o=t.trim();if(e.includes(o))return o;let s=o.toLowerCase().replace(/[\s-]+/g,"_");return e.find(n=>n.toLowerCase()===s)??r}function te(t,e,r){return typeof t=="string"?t.trim().slice(0,r):e}function Re(t,e,r=null){if(!Array.isArray(t)||t.length<3)return r;let o=t.slice(0,3).map(s=>W(s,NaN,-e,e));return o.every(Number.isFinite)?o:r}var ut={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 ft(t){if(typeof t!="string")return null;let e=t.trim().toLowerCase();if(ut[e])return ut[e];let r=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/.exec(e);if(!r)return null;let o=r[1];return "#"+(o.length===3?o.split("").map(s=>s+s).join(""):o)}var ye=new Set(["."," "]),bt=t=>/^[A-Za-z0-9_]{1,24}$/.test(t),Bt={human:"humanoid",biped:"humanoid",person:"humanoid",animal:"quadruped",four_legs:"quadruped",quadrupedal:"quadruped",bird:"flyer",winged:"flyer",dragon:"flyer",slime:"blob",ghost:"blob"};function Dt(t){if(typeof t!="string")return "humanoid";let e=t.trim().toLowerCase().replace(/[\s-]+/g,"_");return be.includes(e)?e:Bt[e]??"humanoid"}function yt(t,e){let r=/^(.*?)(L|R)$/.exec(t);if(!r)return t;let o=r[1]+(r[2]==="L"?"R":"L");return e(o)?o:t}function Z(t){if(typeof t=="string"){let m=d(t);if(!m.ok)return {ok:false,error:m.error,truncated:m.truncated};t=m.value;}if(!j(t))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 t)&&!("rig"in t)){let m=t.character??t.spec??t.characterSpec;j(m)&&(t=m);}let e=t,r=gt,o=[];typeof e.version=="number"&&e.version>dt&&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:e.version}));let s=Dt(e.rig),a=q[s],n={};if(j(e.palette))for(let[m,k]of Object.entries(e.palette)){if(Object.keys(n).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 y=ft(k);if(m.length!==1||ye.has(m)||!y){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:m}));continue}n[m]=y;}let i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",l=(m,k)=>{if(typeof m!="string")return k;if(m.length===1&&n[m])return m;let y=ft(m);if(!y)return k;let M=Object.entries(n).find(([,d])=>d===y);if(M)return M[0];if(Object.keys(n).length>=r.palette)return k;let p=[...i].find(d=>!n[d]);return p?(n[p]=y,p):k},c$1={},u=0;if(j(e.textures))for(let[m,k]of Object.entries(e.textures)){if(!bt(m)){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:m.slice(0,30)}));continue}if(Object.keys(c$1).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 y=Vt(k,n,o,m);if(y){if(u+y.w*y.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:m}));continue}u+=y.w*y.h,c$1[m]=y;}}let b=new Set(a.bones.map(m=>m.name)),g=[];for(let m of ge(e.bones)){if(!j(m))continue;let k=te(m.name,"",24);if(!k||!bt(k))continue;let y=Re(m.pivot,r.coord);if(!y||g.some(x=>x.name===k))continue;if(g.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 M=b.has(k),p=te(m.parent,"",24),d=M?a.bones.find(x=>x.name===k).parent??"":b.has(p)||g.some(x=>x.name===p)?p:a.bones.find(x=>x.role==="body").name;g.push({name:k,parent:d,pivot:y,role:M?"static":Ne(m.role,ke,"static")}),b.add(k);}let R=Object.keys(n)[0]??"s",E=[];for(let m of ge(e.parts)){if(E.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(!j(m))continue;let k=Re(m.size,r.partSide),y=Re(m.pos??m.center??m.at,r.coord);if(!k||!y||k.some(f=>f<=0))continue;let M=te(m.bone,"",24);b.has(M)||(M&&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:M})),M=a.bones.find(f=>f.role==="body").name);let p={bone:M,size:k,pos:y,color:l(m.color,R)};if(j(m.faces)){let f={};for(let L of De){let I=m.faces[L];if(typeof I=="string")if(c$1[I])f[L]=I;else {let G=l(I,"");G&&(f[L]=G);}}Object.keys(f).length&&(p.faces=f);}let d=Re(m.rot??m.rotation,180);d&&d.some(f=>f!==0)&&(p.rot=d),(m.mirror===true||m.mirror==="x")&&(p.mirror=true);let x=te(m.name,"",24);x&&(p.name=x),E.push(p);}if(!E.length){for(let[m,k]of Object.entries(jt))n[m]||(n[m]=k);E.push(...a.defaultParts.map(Gt));}let F=null;if(j(e.face)){let m=e.face,k=b.has(te(m.bone,"",24))?te(m.bone,"",24):a.faceBone,y=ge(m.rect).map(p=>Math.round(W(p,NaN,0,r.partSide))),M={};if(j(m.expressions))for(let p of je){let d=m.expressions[p];typeof d=="string"&&c$1[d]&&(M[p]=d);}if(!M.neutral){let p=Object.values(M)[0];p&&(M.neutral=p);}if(M.neutral){let p=c$1[M.neutral];F={bone:k,rect:y.length===4&&y.every(Number.isFinite)&&y[2]>0&&y[3]>0?y:[0,0,p.w,p.h],expressions:M};}else Object.keys(m).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 K=j(e.style)?e.style:{},T=j(e.voice)?e.voice:{},A=j(e.finish)?e.finish:{};return {ok:true,spec:{version:dt,name:te(e.name,Ee(),40)||Ee(),description:te(e.description,"",300),rig:s,scale:W(e.scale,1,.25,3),palette:n,textures:c$1,parts:E,bones:g,face:F,style:{walk:Ne(K.walk,Ge,"normal"),idle:Ne(K.idle,Ve,"calm"),energy:W(K.energy,.5,0,1)},voice:{pitch:W(T.pitch,1,.5,2)},tags:ge(e.tags).filter(m=>typeof m=="string"&&!!m.trim()).slice(0,8).map(m=>m.trim().slice(0,24)),finish:{noise:W(A.noise,pe.noise,0,1),outline:W(A.outline,pe.outline,0,1),shade:W(A.shade,pe.shade,0,1),density:Math.round(W(A.density,pe.density,1,4))}},warnings:o}}var jt={s:"#c69c7c",t:"#3a8fd6",p:"#2c3e6b"};function Gt(t){return JSON.parse(JSON.stringify(t))}function Vt(t,e,r,o){let s=Array.isArray(t)?{rows:t}:j(t)?t:null;if(!s)return null;let a=gt.textureSide,n=ge(s.rows??s.pixels).filter(u=>typeof u=="string");if(!n.length)return null;let i=Math.round(W(s.h??s.height,n.length,1,a)),l=Math.round(W(s.w??s.width,Math.max(...n.map(u=>u.length)),1,a)),c$1=false;for(n=n.slice(0,i).map(u=>{let b="";for(let g=0;g<l;g++){let R=u[g]??".";ye.has(R)||e[R]?b+=R===" "?".":R:(c$1=true,b+=".");}return b});n.length<i;)n.push(".".repeat(l));return c$1&&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:l,h:i,rows:n}}function Be(t){return Array.isArray(t)?"["+t.map(Be).join(",")+"]":j(t)?"{"+Object.keys(t).filter(e=>t[e]!==void 0).sort().map(e=>JSON.stringify(e)+":"+Be(t[e])).join(",")+"}":JSON.stringify(t)}function me(t){let e=Be(t),r=b(e),o=b("~"+e);return r.toString(16).padStart(8,"0")+o.toString(16).padStart(8,"0")}function zo(t){return q[t.rig]}function xt(t){let r=q[t.rig].bones.map(o=>{let s=t.bones.find(a=>a.name===o.name);return {name:o.name,role:o.role,parent:o.parent,pivot:(s?.pivot??o.pivot).slice()}});for(let o of t.bones)r.some(s=>s.name===o.name)||r.push({name:o.name,role:o.role,parent:o.parent,pivot:o.pivot.slice()});return r}function Ee(){return c({en:"Character",ru:"\u041F\u0435\u0440\u0441\u043E\u043D\u0430\u0436"})}var Fo=t=>t==="\u041F\u0435\u0440\u0441\u043E\u043D\u0430\u0436"||t==="Character";var Ut={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 Ue(t){let e=parseInt(t.slice(1),16);return [e>>16&255,e>>8&255,e&255]}function wt(t,e,r,o,s,a){let n=((r-1-s)*e+o)*4;t[n]=a[0],t[n+1]=a[1],t[n+2]=a[2],t[n+3]=255;}function Wt(t){t.sort((e,r)=>r.h-e.h||r.w-e.w||(e.key<r.key?-1:1));for(let e=16;;e*=2){let r=0,o=0,s=0;for(let n of t)r+n.w>e&&(r=0,o+=s,s=0),n.x=r,n.y=o,r+=n.w,s=Math.max(s,n.h);let a=o+s;if(a<=e||e>=1024){let n=16;for(;n<a;)n*=2;return {w:e,h:n}}}}function kt(t,e,r){let o=Math.imul(e,374761393)+Math.imul(r,668265263)+Math.imul(t,2246822519);return o=Math.imul(o^o>>>13,1274126177),((o^o>>>16)>>>0)/4294967296}function Kt(t,e,r,o,s,a,n,i){let c=1+(.55*kt(n,e,r)+.45*kt(n^1540483477,Math.floor(e/3),Math.floor(r/3))-.5)*2*i.noise*.14;return a==="s"?c+=i.shade*.16*(.5-(r+.5)/s):a==="t"?c+=i.shade*.08:c-=i.shade*.2,o>=3&&s>=3&&(e===0||r===0||e===o-1||r===s-1)&&(c*=1-.5*i.outline),[Math.max(0,Math.min(255,t[0]*c)),Math.max(0,Math.min(255,t[1]*c)),Math.max(0,Math.min(255,t[2]*c))]}var We=Math.PI/180;function Rt(t,e){if(!e)return t;let[r,o,s]=t,[a,n,i]=[e[0]*We,e[1]*We,e[2]*We],l=Math.cos(i),c=Math.sin(i);return [r,o]=[r*l-o*c,r*c+o*l],l=Math.cos(n),c=Math.sin(n),[r,s]=[r*l+s*c,-r*c+s*l],l=Math.cos(a),c=Math.sin(a),[o,s]=[o*l-s*c,o*c+s*l],[r,o,s]}function $t(t,e){let r=[];for(let o of t.parts){if(r.push({...o,flip:false}),!o.mirror)continue;let s=o.faces?{...o.faces,left:o.faces.right,right:o.faces.left}:void 0;s&&(s.left===void 0&&delete s.left,s.right===void 0&&delete s.right);let a={...o,bone:yt(o.bone,e),pos:[-o.pos[0],o.pos[1],o.pos[2]],flip:true};s?a.faces=s:delete a.faces,o.rot&&(a.rot=[o.rot[0],-o.rot[1],-o.rot[2]]),r.push(a);}return r}function Et(t){let e=q[t.rig],r=xt(t),o=p=>r.some(d=>d.name===p),s=$t(t,o),a=t.finish??pe,n=new Map,i=(p,d)=>{let x=p.faces?.[d],f=x!==void 0?t.textures[x]:void 0,L=x!==void 0&&t.palette[x]?x:p.color,[I,G]=d==="front"||d==="back"?[p.size[0],p.size[1]]:d==="left"||d==="right"?[p.size[2],p.size[1]]:[p.size[0],p.size[2]],C=(he,oe)=>Math.max(1,Math.min(64,oe*Math.max(1,Math.round(he*a.density/oe)))),N=f?C(I,f.w):C(I,1),B=f?C(G,f.h):C(G,1),P=d==="top"?"t":d==="bottom"?"b":"s",H=(f?"t:"+x:"c:"+L)+"|"+N+"x"+B+P,D=n.get(H);if(D)return D;let Q=b(H),ee=f?null:Ue(t.palette[L]??"#ff00ff");return D={key:H,w:N,h:B,x:0,y:0,paint:(he,oe,Fe,ne,se)=>{for(let Y=0;Y<B;Y++)for(let U=0;U<N;U++){let st=ee;if(f){let at=f.rows[Math.floor(Y*f.h/B)][Math.floor(U*f.w/N)];if(ye.has(at))continue;let it=t.palette[at];if(!it)continue;st=Ue(it);}wt(he,oe,Fe,ne+U,se+Y,Kt(st,U,Y,N,B,P,Q,a));}}},n.set(H,D),D},l=(p,d)=>{let x="e:"+p,f=n.get(x);return f||(f={key:x,w:d.w,h:d.h,x:0,y:0,paint:(L,I,G,C,N)=>{for(let B=0;B<d.h;B++)for(let P=0;P<d.w;P++){let H=d.rows[B][P];if(ye.has(H))continue;let D=t.palette[H];D&&wt(L,I,G,C+P,N+B,Ue(D));}}},n.set(x,f)),f},c=s.map(p=>({p,faces:De.map(d=>({f:d,cell:i(p,d)}))})),u=t.face,b$1=[];if(u)for(let[p,d]of Object.entries(u.expressions)){let x=t.textures[d];x&&b$1.push([p,l(d,x)]);}let{w:g,h:R}=Wt([...n.values()]),E=new Uint8Array(g*R*4);for(let p of n.values())p.paint(E,g,R,p.x,p.y);let F=.01,K=p=>[(p.x+F)/g,1-(p.y+F)/R,(p.x+p.w-F)/g,1-(p.y+p.h-F)/R],T=new Map;for(let p of r)T.set(p.name,{pos:[],nrm:[],uv:[],idx:[]});let A=0;for(let{p,faces:d}of c){let x=T.get(p.bone),f=r.find(I=>I.name===p.bone).pivot,L=[p.size[0]/2,p.size[1]/2,p.size[2]/2];A=Math.max(A,p.pos[1]+L[1]);for(let{f:I,cell:G}of d){let C=Ut[I],N=(ne,se)=>{let Y=[L[0]*(C.tl[0]+2*(C.u[0]*ne+C.d[0]*se)),L[1]*(C.tl[1]+2*(C.u[1]*ne+C.d[1]*se)),L[2]*(C.tl[2]+2*(C.u[2]*ne+C.d[2]*se))],U=Rt(Y,p.rot);return [p.pos[0]+U[0]-f[0],p.pos[1]+U[1]-f[1],p.pos[2]+U[2]-f[2]]},B=Rt(C.n,p.rot),P=x.pos.length/3,[H,D,Q,ee]=K(G),[he,oe]=p.flip?[Q,H]:[H,Q],Fe=[[0,0,he,D],[1,0,oe,D],[1,1,oe,ee],[0,1,he,ee]];for(let[ne,se,Y,U]of Fe)x.pos.push(...N(ne,se)),x.nrm.push(...B),x.uv.push(Y,U);x.idx.push(P,P+2,P+1,P,P+3,P+2);}}let V=r.map(p=>{let d=T.get(p.name);return {name:p.name,role:p.role,parent:p.parent,pivot:p.pivot,positions:Float32Array.from(d.pos),normals:Float32Array.from(d.nrm),uvs:Float32Array.from(d.uv),indices:Uint16Array.from(d.idx)}}),m=null;if(u&&b$1.length){let d=t.parts.filter(f=>f.bone===u.bone).sort((f,L)=>L.size[0]*L.size[1]*L.size[2]-f.size[0]*f.size[1]*f.size[2])[0],x=r.find(f=>f.name===u.bone);if(d&&x){let[f,L,I,G]=u.rect,C=d.pos[0]+d.size[0]/2-f,N=d.pos[1]+d.size[1]/2-L,B=d.pos[2]-d.size[2]/2-.05,P=x.pivot,H=(Q,ee)=>[Q-P[0],ee-P[1],B-P[2]],D={};for(let[Q,ee]of b$1)D[Q]=K(ee);m={bone:u.bone,corners:Float32Array.from([...H(C,N),...H(C-I,N),...H(C-I,N-G),...H(C,N-G)]),uv:D};}}let k=e.sockets.filter(p=>o(p.bone)).map(p=>{let d=e.bones.find(x=>x.name===p.bone);return {name:p.name,bone:p.bone,at:[p.at[0]-d.pivot[0],p.at[1]-d.pivot[1],p.at[2]-d.pivot[2]]}}),y=Math.max(1,A),M=y>e.height.max?e.height.max/y:y<e.height.min?e.height.min/y:1;return {hash:me(t),rig:t.rig,bones:V,atlas:{w:g,h:R,data:E},face:m,sockets:k,height:y,scale:t.scale*M,eye:e.eye*y/Xt(t.rig)}}function Xt(t){let e=1;for(let r of q[t].defaultParts)e=Math.max(e,r.pos[1]+r.size[1]/2);return e}var Ke=new Map;function Yt(t){let e=new Map;for(let n of t.bones){if(!n.indices.length){e.set(n.name,null);continue}let i=new _.BufferGeometry;i.setAttribute("position",new _.BufferAttribute(n.positions,3)),i.setAttribute("normal",new _.BufferAttribute(n.normals,3)),i.setAttribute("uv",new _.BufferAttribute(n.uvs,2)),i.setIndex(new _.BufferAttribute(n.indices,1)),i.computeBoundingSphere(),i.userData.shared=true,e.set(n.name,i);}let{w:r,h:o,data:s}=t.atlas,a=new _.DataTexture(s,r,o,_.RGBAFormat);return a.magFilter=_.NearestFilter,a.minFilter=_.NearestFilter,a.generateMipmaps=false,a.colorSpace=_.SRGBColorSpace,a.needsUpdate=true,{layout:t,geometries:e,texture:a,refs:0}}function $e(t){let e=Ke.get(me(t));return e||(e=Yt(Et(t)),Ke.set(e.layout.hash,e)),e.refs++,e}function Se(t){if(!(--t.refs>0)){Ke.delete(t.layout.hash);for(let e of t.geometries.values())e?.dispose();t.texture.dispose();}}var w=class t{constructor(e,r,o="."){this.w=e;this.h=r;this.g=Array.from({length:r},()=>new Array(e).fill(o));}w;h;g;px(e,r,o){return e>=0&&r>=0&&e<this.w&&r<this.h&&(this.g[r][e]=o),this}rect(e,r,o,s,a){for(let n=r;n<r+s;n++)for(let i=e;i<e+o;i++)this.px(i,n,a);return this}row(e,r,o,s){return this.rect(r,e,o-r+1,1,s)}col(e,r,o,s){return this.rect(e,r,1,o-r+1,s)}where(e,r){for(let o=0;o<this.h;o++)for(let s=0;s<this.w;s++)e(s,o)&&this.px(s,o,r);return this}flipped(){let e=new t(this.w,this.h);for(let r=0;r<this.h;r++)for(let o=0;o<this.w;o++)e.px(this.w-1-o,r,this.g[r][o]);return e}tex(){return {w:this.w,h:this.h,rows:this.g.map(e=>e.join(""))}}};var qt={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 J(t,e){let r=parseInt(t.slice(1),16);return "#"+[r>>16&255,r>>8&255,r&255].map(s=>Math.max(0,Math.min(255,Math.round(s*e)))).map(s=>s.toString(16).padStart(2,"0")).join("")}function Ye(t,e){let r={...t};return e.skin&&(r.s=e.skin,r.S=J(e.skin,.86),r.m=J(e.skin,.66)),e.hair&&(r.h=e.hair,r.H=J(e.hair,1.25),r.k=J(e.hair,.6)),e.shirt&&(r.t=e.shirt,r.T=J(e.shirt,1.15),r.D=J(e.shirt,.8)),e.pants&&(r.p=e.pants,r.P=J(e.pants,.8)),e.boots&&(r.z=e.boots,r.Z=J(e.boots,.78)),e.eyes&&(r.b=e.eyes),r}var Zt=new w(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"),St=new w(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((t,e)=>e>4&&e<11&&t>8&&(t+e)%4===0,"k"),Jt=St.flipped(),Qt=new w(16,16,"h").where((t,e)=>(t+2*e)%5===0,"H").where((t,e)=>e>8&&(t*3+e)%7===0,"k").rect(4,14,8,2,"s"),er=new w(16,16,"h").where((t,e)=>(t+2*e)%5===0,"H").where((t,e)=>(3*t+e)%9===0,"k"),tr=new w(18,4,"h").where((t,e)=>(t*7+e*3)%5===0,"H").where((t,e)=>e===3&&t*5%3===0,"k"),rr=new w(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"),or=new w(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"),nr=new w(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"),sr=new w(16,2,"B").rect(7,0,2,2,"g").px(3,0,"k").px(12,0,"k"),ar=new w(6,24,"s").row(23,0,5,"S").col(2,21,23,"S"),ir=new w(8,13,"t").col(0,0,9,"D").row(9,0,7,"D").rect(0,10,8,3,"T").row(12,0,7,"D"),lr=new w(8,24,"p").col(4,1,21,"P").row(0,0,7,"P"),cr=new w(8,24,"p").col(3,0,21,"P").row(0,0,7,"P"),hr=new w(8,24,"p").col(3,0,21,"P"),pr=new w(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"),mr=new w(10,9,"z").row(0,0,9,"Z").rect(0,7,10,2,"Z").col(5,1,6,"Z");function $(t){let e=new w(16,10,"."),r=(s,a,n)=>{if(t.brows==="flat")e.row(1,s,s+2,"k");else if(t.brows==="high")e.row(0,s,s+2,"k");else {let i=t.brows==="down"?1:0,l=1-i;e.px(a,i,"k").px(s+1,t.brows==="down"?0:1,"k"),e.px(n,l,"k");}};r(3,5,3),r(10,10,12);let o=s=>{if(t.eyes===0){e.row(3,s,s+2,"k");return}let a=t.eyes===3||t.eyes===2?2:3;for(let n=a;n<a+t.eyes;n++)e.px(s,n,"w").px(s+1,n,"b").px(s+2,n,"w");};switch(o(3),o(10),t.mouth){case "line":e.row(7,6,9,"m");break;case "smile":e.px(5,6,"m").px(10,6,"m").row(7,6,9,"m");break;case "frown":e.row(7,6,9,"m").px(5,8,"m").px(10,8,"m");break;case "open":e.rect(6,7,4,2,"o");break;case "small":e.rect(7,7,2,2,"o");break;case "wide":e.row(7,5,10,"m").rect(6,8,4,1,"o");break}return e}var vt={f_neutral:$({brows:"flat",eyes:2,mouth:"line"}),f_blink:$({brows:"flat",eyes:0,mouth:"line"}),f_happy:$({brows:"high",eyes:2,mouth:"smile"}),f_sad:$({brows:"up",eyes:2,mouth:"frown"}),f_angry:$({brows:"down",eyes:1,mouth:"wide"}),f_surprised:$({brows:"high",eyes:3,mouth:"small"}),f_scared:$({brows:"up",eyes:3,mouth:"open"}),f_tired:$({brows:"flat",eyes:1,mouth:"line"}),f_hurt:$({brows:"down",eyes:0,mouth:"open"}),f_talk:$({brows:"flat",eyes:2,mouth:"open"})},dr=new w(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"),ur=new w(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"),fr=new w(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"),br=new w(8,9,"t").row(3,0,7,"D").rect(0,7,8,2,"T"),ve=(t,e)=>t.row(e-1,0,t.w-1,"D").where((r,o)=>o>=e&&o<=e+3&&(r+o)%2===0,"T").row(e+4,0,t.w-1,"D"),gr=ve(new w(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((t,e)=>e>=18&&e<=19&&t%2===0,"D").where((t,e)=>e>=18&&e<=19&&t%2===1,"T").rect(0,20,16,4,"p"),yr=ve(new w(16,24,"t"),6).row(0,4,11,"T").where((t,e)=>e>=18&&e<=19,"D").rect(0,20,16,4,"p"),xr=ve(new w(8,24,"t"),6).where((t,e)=>e>=18&&e<=19,"D").rect(0,20,8,4,"p"),wr=ve(new w(8,22,"t"),9).where((t,e)=>e>=19&&t%2===0,"D"),Ct=t=>new w(8,24,"s").rect(0,0,8,12,"p").col(t,1,10,"P").row(11,0,7,"P").row(12,0,7,"S").rect(0,19,8,5,"l"),kr=Ct(4),Rr=Ct(3),Er=new w(9,5,"z").row(1,3,5,"l").rect(0,3,9,2,"l"),Sr=new w(10,5,"z").row(1,3,6,"Z").rect(0,3,10,2,"l"),vr=new w(17,6,"a").rect(0,4,17,2,"A"),Cr=new w(22,22,"a").where((t,e)=>(t*3+e*5)%11===0,"A"),Tr=new w(17,20,"h").where((t,e)=>(t*5+e)%4===0,"H").where((t,e)=>e>10&&(t*3+e*2)%7===0,"k"),S=t=>t.tex(),Tt=["shirt","tee","sweater"],Mt=["pants","shorts"],At=["boots","sneakers"],Yo=["short","long","curly","none"],ie=(t,e={})=>({front:t,back:t,left:t,right:t,...e});function qe(t={}){let e=t.top??"shirt",r=t.bottom??"pants",o=t.shoes??"boots",s=t.hair??"short",a=Ye(qt,t.colors??{});a={...a,a:t.colors?.hat??"#d9c9a3"},a.A=J(a.a,.72);let n={head_front:S(Zt),head_left:S(St),head_right:S(Jt),head_back:S(Qt),hair_top:S(er),hair_band:S(tr),arm_skin:S(ar),...Object.fromEntries(Object.entries(vt).map(([E,F])=>[E,S(F)]))},i=[{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(s!=="none"){if(t.hat||i.push({name:"hair",bone:"head",size:s==="curly"?[9,2.2,9]:[8.6,1.6,8.6],pos:[0,s==="curly"?32.5:32.2,.15],color:"h",faces:ie("hair_band",{top:"hair_top"})}),s==="curly"&&!t.hat)for(let[E,F]of [[-2,-1.5],[2,.5],[-0.5,2.5]])i.push({name:"curl",bone:"head",size:[3.2,1.4,3.2],pos:[E,33.9,F],color:"h",faces:ie("hair_band",{top:"hair_top"})});s==="long"?(n.hair_long=S(Tr),i.push({name:"hairLong",bone:"head",size:[8.8,10,1],pos:[0,27,4.4],color:"h",faces:ie("hair_long",{top:"hair_top"})},{name:"hairSide",bone:"head",size:[.8,9,6],pos:[-4.4,27.5,1],color:"h",faces:ie("hair_long",{top:"hair_top"}),mirror:true})):i.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"}});}t.hat&&(n.hat_crown=S(vr),n.hat_brim=S(Cr),i.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:ie("hat_crown")}));let l={shirt:[rr,or,nr],tee:[dr,ur,fr],sweater:[gr,yr,xr]},[c$1,u,b]=l[e];n.top_front=S(c$1),n.top_back=S(u),n.top_side=S(b),i.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"}}),e==="shirt"&&(n.belt=S(sr),i.push({name:"belt",bone:"body",size:[8.4,1,4.4],pos:[0,13.5,0],color:"B",faces:{front:"belt",back:"belt"}})),i.push({name:"arm",bone:"armL",size:[3,12,3],pos:[-5.5,18,0],color:"s",faces:ie("arm_skin",{top:"t",bottom:"S"}),mirror:true});let g=e==="sweater"?11:e==="tee"?4.5:6.5;n.sleeve=S(e==="sweater"?wr:e==="tee"?br:ir),i.push({name:"sleeve",bone:"armL",size:[3.6,g,3.6],pos:[-5.5,24-g/2,0],color:"t",faces:ie("sleeve",{bottom:"D"}),mirror:true}),r==="shorts"?(n.leg_front=S(kr),n.leg_side=S(Rr)):(n.leg_front=S(lr),n.leg_back=S(cr),n.leg_side=S(hr)),i.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"?(n.shoe_front=S(pr),n.shoe_side=S(mr)):(n.shoe_front=S(Er),n.shoe_side=S(Sr));let R=o==="boots"?4.5:2.5;return i.push({name:"shoe",bone:"legL",size:[4.6,R,5.2],pos:[-2,R/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:t.name??c({en:"Traveler",ru:"\u041F\u0443\u0442\u043D\u0438\u043A"}),description:t.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:n,parts:i,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:t.tags??["player"]}}function Ce(t,e){return {textures:Object.fromEntries(Object.entries(vt).map(([r,o])=>[r,S(o)])),face:{bone:t,rect:e,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 Ze=qe(),Xe=null;function le(){if(!Xe){let t=Z(Ze);if(!t.ok)throw new Error(t.error);Xe=t.spec;}return Xe}function Lt(t){let e=document.createElement("canvas");e.width=256,e.height=48;let r=e.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(t.slice(0,18),128,25));let o=new _.CanvasTexture(e),s=new _.Sprite(new _.SpriteMaterial({map:o,depthTest:false,transparent:true}));return s.scale.set(1.6,.3,1),s.renderOrder=10,s}function Je(t){t.removeFromParent(),t.material.map?.dispose(),t.material.dispose();}var v={rx:0,ry:1,rz:2,px:3,py:4,pz:5,sx:6,sy:7,sz:8},Jo=Object.keys(v),ue=[0,0,0,0,0,0,1,1,1];function fe(t,e){let r=t.get(e);return r||(r=Float64Array.from(ue),t.set(e,r)),r}function X(t,e,r,o){let s=fe(t,e),a=v[r];a>=6?s[a]=s[a]*o:s[a]=s[a]+o;}function h(t,e,r,o){fe(t,e)[v[r]]=o;}function ce(t){for(let e of t.values())e.set(ue);}function Pt(t,e,r,o){let s=new Set([...e.keys(),...r.keys()]);for(let a of s){let n=e.get(a)??ue,i=r.get(a)??ue,l=fe(t,a);for(let c=0;c<9;c++)l[c]=n[c]+(i[c]-n[c])*o;}}function Te(t,e){ce(t);for(let[r,o]of e)fe(t,r).set(o);}var Qo=["none","block","tool","sword","bow","shield","food","staff","item"];function Me(){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 en=["swing","hurt","place","land","jump","throw"];var xe=1/16,Ae=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;constructor(e=le(),r={}){this.spec=e,this.shadows=r.shadows??true,this.layer=r.layer??0,this.material=new _.MeshLambertMaterial({alphaTest:.5}),this.decalMat=new _.MeshLambertMaterial({alphaTest:.5,polygonOffset:true,polygonOffsetFactor:-2,polygonOffsetUnits:-2}),this.group.add(this.root),this.asset=$e(e),this.build(),r.name&&this.setName(r.name);}get height(){let e=this.asset.layout;return e.height*e.scale*xe}get eye(){let e=this.asset.layout;return e.eye*e.scale*xe}get expressions(){return Object.keys(this.asset.layout.face?.uv??{})}get hash(){return this.asset.layout.hash}setSpec(e){let r=$e(e);if(r===this.asset){Se(r);return}this.clear(),Se(this.asset),this.asset=r,this.spec=e,this.build();}build(){let{layout:e,geometries:r,texture:o}=this.asset;this.material.map=o,this.material.needsUpdate=true,this.decalMat.map=o,this.decalMat.needsUpdate=true,this.root.scale.setScalar(e.scale*xe);let s=new Map(e.bones.map(n=>[n.name,n.pivot]));for(let n of e.bones){let i=new _.Group,l=n.parent?s.get(n.parent)??[0,0,0]:[0,0,0],c=[n.pivot[0]-l[0],n.pivot[1]-l[1],n.pivot[2]-l[2]];i.position.set(...c);let u={name:n.name,role:n.role,group:i,rest:c};this.bones.set(n.name,u);let b=this.byRole.get(n.role)??[];b.push(u),this.byRole.set(n.role,b);let g=r.get(n.name);if(g){let R=new _.Mesh(g,this.material);R.castShadow=R.receiveShadow=this.shadows,R.layers.set(this.layer),this.meshes.push(R),i.add(R);}}for(let n of e.bones){let i=this.bones.get(n.name);((n.parent?this.bones.get(n.parent):void 0)?.group??this.root).add(i.group);}let a=e.face;if(a){let n=new _.BufferGeometry;n.setAttribute("position",new _.BufferAttribute(a.corners,3));let i=new Float32Array(12);for(let l=0;l<4;l++)i[l*3+2]=-1;n.setAttribute("normal",new _.BufferAttribute(i,3)),n.setAttribute("uv",new _.BufferAttribute(new Float32Array(8),2)),n.setIndex([0,2,1,0,3,2]),this.decal=new _.Mesh(n,this.decalMat),this.decal.layers.set(this.layer),this.bones.get(a.bone)?.group.add(this.decal),this.expression=null,this.setExpression("neutral");}for(let n of e.sockets){let i=new _.Object3D;i.position.set(...n.at),i.scale.setScalar(1/(e.scale*xe)),this.bones.get(n.bone)?.group.add(i),this.sockets.set(n.name,i);let l=this.attached.get(n.name);l&&i.add(l);}this.placeLabel(),this.setBrightness(this.brightness);}clear(){for(let e of this.sockets.values())for(let r of [...e.children])e.remove(r);this.root.clear(),this.decal?.geometry.dispose(),this.decal=null,this.meshes=[],this.bones=new Map,this.byRole=new Map,this.sockets.clear();}applyPose(e){let r=e.get("root");if(r){this.root.rotation.set(r[v.rx],r[v.ry],r[v.rz]);let o=this.asset.layout.scale*xe;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,s]of this.byRole){let a=e.get(o);for(let n of s){let i=n.group;if(!a){i.rotation.set(0,0,0),i.position.set(...n.rest),i.scale.set(1,1,1);continue}i.rotation.set(a[v.rx],a[v.ry],a[v.rz]),i.position.set(n.rest[0]+a[v.px],n.rest[1]+a[v.py],n.rest[2]+a[v.pz]),i.scale.set(a[v.sx],a[v.sy],a[v.sz]);}}}setExpression(e){if(e===this.expression||!this.decal)return;let r=this.asset.layout.face?.uv,o=r?.[e]??r?.neutral;if(!o)return;this.expression=e;let[s,a,n,i]=o,l=this.decal.geometry.getAttribute("uv");l.setXY(0,s,a),l.setXY(1,n,a),l.setXY(2,n,i),l.setXY(3,s,i),l.needsUpdate=true;}setBrightness(e){this.brightness=e,this.material.color.setScalar(e),this.decalMat.color.setScalar(e);}setEmissive(e){this.material.emissive.getHex()!==e&&(this.material.emissive.setHex(e),this.decalMat.emissive.setHex(e));}setShadows(e){if(e!==this.shadows){this.shadows=e;for(let r of this.meshes)r.castShadow=e;}}attach(e,r){let o=this.attached.get(e);if(o!==r){if(o&&o.removeFromParent(),!r){this.attached.delete(e);return}this.attached.set(e,r),this.sockets.get(e)?.add(r);}}attachedAt(e){return this.attached.get(e)??null}setName(e){this.label&&Je(this.label),this.label=e?Lt(e):null,this.label&&this.group.add(this.label),this.placeLabel();}setLabelVisible(e){this.label&&(this.label.visible=e);}placeLabel(){this.label&&(this.label.position.y=this.height+.25);}forEachMesh(e){for(let r of this.meshes)e(r);this.decal&&e(this.decal);}dispose(){this.group.removeFromParent();for(let e of this.attached.values())e.removeFromParent();this.attached.clear(),this.clear(),this.label&&Je(this.label),this.label=null,this.material.dispose(),this.decalMat.dispose(),Se(this.asset);}};var Le=new Map,Qe=new Set;function cn(t){let e=me(t);if(!Le.has(e)){Le.set(e,t);for(let r of Qe)r(e);}return e}function hn(t){return typeof t=="string"?Le.get(t):void 0}function pn(t){let e={};for(let r of t){let o=Le.get(r);o&&(e[r]=o);}return e}function mn(t){return Qe.add(t),()=>Qe.delete(t)}var Mr=["#b08a62","#8a6a4a","#c8a878","#9a9a92","#7a5c44"],Ar=["#f1c9a5","#e6b892","#d9a982","#c08e68","#a0704c","#7a5238"],Lr=["#6b4a2f","#4a3424","#8a5a3a","#c27a48","#d8b878","#2e2622","#a07850","#9a9690"],Pr=["#a7bea9","#e6e0cc","#d9c9a3","#b9a083","#a9b8c4","#c8b4a0","#9fb0a0","#d8d2c4","#b98f74","#8fa3b5"],_r=["#8c9ca6","#a9b8b4","#8a8e94","#9fb3ad","#7d8a8f","#b0a58f"],Or=["#d9c9a3","#c8b48a","#a08a6a","#e6e0cc"];function gn(t,e="",r=""){let o=a(b("npc:"+t+"|"+e)),s=i=>i[Math.floor(o()*i.length)],a$1=qe({top:s(Tt),bottom:s(Mt),shoes:s(At),hair:s(["short","short","long","curly"]),hat:o()<.2,colors:{skin:s(Ar),hair:s(Lr),shirt:s(Pr),pants:s(_r),boots:s(Mr),hat:s(Or)}});a$1.name=t.slice(0,40),a$1.description=[e,r].filter(Boolean).join(" \u2014 ").slice(0,300),a$1.style={walk:s(["normal","normal","bouncy","heavy","sneaky"]),idle:s(["calm","calm","fidgety","proud"]),energy:Math.round(o()*10)/10},a$1.tags=["npc",...e?[e.slice(0,24)]:[]];let n=Z(a$1);return n.ok?n.spec:le()}var re=([t,e,r])=>"#"+[t,e,r].map(o=>Math.round(o).toString(16).padStart(2,"0")).join("");function Ir(t){if(!t.length)return null;let e=r=>{let o=t.map(s=>s[r]).sort((s,a)=>s-a);return o[o.length>>1]};return [e(0),e(1),e(2)]}function zr(t,e){let{width:r,height:o,data:s}=t,a=(T,A)=>{let V=(A*r+T)*4;return [s[V],s[V+1],s[V+2]]},n=[a(0,0),a(r-1,0),a(0,o-1),a(r-1,o-1)],i=[0,1,2].map(T=>n.reduce((A,V)=>A+V[T],0)/4),l=T=>Math.abs(T[0]-i[0])+Math.abs(T[1]-i[1])+Math.abs(T[2]-i[2])>60,c=r,u=-1,b=o,g=-1;for(let T=0;T<o;T+=2)for(let A=0;A<r;A+=2)l(a(A,T))&&(c=Math.min(c,A),u=Math.max(u,A),b=Math.min(b,T),g=Math.max(g,T));u<0&&(c=0,u=r-1,b=0,g=o-1);let R=g-b+1,E=u-c+1,F=c+Math.floor(E*.3),K=c+Math.ceil(E*.7);return e.map(([T,A])=>{let V=[];for(let m=b+Math.floor(R*T);m<b+Math.ceil(R*A);m++)for(let k=F;k<K;k++){if(m<0||m>=o||k<0||k>=r)continue;let y=a(k,m);l(y)&&V.push(y);}return Ir(V)})}var Fr=[[0,.06],[.1,.22],[.3,.52],[.6,.86],[.92,1]];function Rn(t,e="humanoid",r=Ee()){let[o,s,a,n,i]=zr(t,Fr);if(e==="humanoid"){let c=JSON.parse(JSON.stringify(Ze));c.palette=Ye(c.palette,{...o?{hair:re(o)}:{},...s?{skin:re(s)}:{},...a?{shirt:re(a)}:{},...n?{pants:re(n)}:{},...i?{boots:re(i)}:{}}),c.name=r,c.tags=[];let u=Z(c);return u.ok?u.spec:le()}let l=Z({name:r,rig:e,palette:{s:re(s??o??[198,156,124]),t:re(a??[58,143,214]),p:re(n??i??[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:e==="blob"?[4,4,4,2]:e==="flyer"?[0,1,4,2]:[2,2,4,2],expressions:{neutral:"f_neutral",blink:"f_blink"}}});return l.ok?l.spec:le()}var Hr={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}},Nr={calm:{},fidgety:{fidget:1,breath:1.3},proud:{chest:.08,breath:.8}};function et(t){let e={amp:.8,arm:.6,bob:0,tempo:1,sway:0,quant:false,breath:1,fidget:0,chest:0,...Hr[t.walk],...Nr[t.idle]};return e.tempo*=.8+.4*t.energy,e.amp*=.85+.3*t.energy,e}function tt(t,e=0){let r=Math.sin(t.phase+e);return t.style.quant?Math.max(-1,Math.min(1,r*3)):r}function rt(t,e,r){let o=tt(e)*r;h(t,"legL","rx",o),h(t,"legR","rx",-o),h(t,"legFL","rx",o),h(t,"legBR","rx",o),h(t,"legFR","rx",-o),h(t,"legBL","rx",-o);}function ot(t,e,r){let o=tt(e)*r;h(t,"armL","rx",-o),h(t,"armR","rx",o);}var Br=(t,e)=>{let r=Math.sin(e.clock*2)*e.style.breath;h(t,"armL","rz",-0.04-.03*r),h(t,"armR","rz",.04+.03*r),h(t,"head","rx",.03*Math.sin(e.clock*1.7)+e.style.chest),h(t,"body","rx",e.style.chest*-0.5),e.style.fidget&&(h(t,"head","ry",.35*Math.sin(e.clock*.7)*Math.sin(e.clock*.31)),h(t,"root","ry",.05*Math.sin(e.clock*.9))),h(t,"body","sy",1+.04*Math.sin(e.clock*3));},Dr=(t,e)=>{rt(t,e,e.style.amp),ot(t,e,e.style.arm),h(t,"root","py",e.style.bob*Math.abs(Math.cos(e.phase))),h(t,"body","rz",e.style.sway*tt(e));},jr=(t,e)=>{rt(t,e,e.style.amp*1.3),ot(t,e,e.style.arm*1.6),h(t,"body","rx",-0.18),h(t,"head","rx",.18),h(t,"root","py",(.8+e.style.bob)*Math.abs(Math.cos(e.phase)));},Gr=(t,e)=>{rt(t,e,e.style.amp*.5*Math.min(1,e.input.speed)),ot(t,e,e.style.arm*.4*Math.min(1,e.input.speed)),h(t,"body","rx",-0.45),h(t,"head","rx",.45),X(t,"armL","rx",.25),X(t,"armR","rx",.25),h(t,"root","py",-1.5);},Vr=(t,e)=>{h(t,"root","rx",-1.3),h(t,"head","rx",1),h(t,"armL","rx",Math.PI-.5+.5*Math.sin(e.t*3)),h(t,"armR","rx",Math.PI-.5+.5*Math.sin(e.t*3+Math.PI)),h(t,"legL","rx",.3*Math.sin(e.t*8)),h(t,"legR","rx",-0.3*Math.sin(e.t*8));},Ur=(t,e)=>{h(t,"legL","rx",.15),h(t,"legR","rx",.1),h(t,"armL","rz",-0.15),h(t,"armR","rz",.15),h(t,"root","py",.6*Math.sin(e.t*2));},Wr=t=>{h(t,"root","rx",-1.35),h(t,"head","rx",1.1),h(t,"armL","rz",-1.3),h(t,"armR","rz",1.3);},Kr=(t,e)=>{let r=.15*Math.sin(e.t*10);h(t,"armL","rz",-0.6-r),h(t,"armR","rz",.6+r),h(t,"legL","rx",.25),h(t,"legR","rx",-0.25);},$r=t=>{h(t,"legL","rx",1.45),h(t,"legR","rx",1.45),h(t,"legL","ry",.1),h(t,"legR","ry",-0.1),h(t,"root","py",-10),h(t,"body","rx",.4),h(t,"legBL","rx",1.2),h(t,"legBR","rx",1.2);},Xr=t=>{h(t,"legL","rx",1.4),h(t,"legR","rx",1.4),h(t,"legL","rz",-0.3),h(t,"legR","rz",.3),h(t,"armL","rx",.45),h(t,"armR","rx",.45);},Yr=t=>{h(t,"root","rx",Math.PI/2),h(t,"root","py",2);},qr=t=>{h(t,"root","rz",Math.PI/2),h(t,"root","py",2);},Zr=(t,e)=>{let r=Math.sin(e.phase*.5);h(t,"root","py",6*Math.max(0,r));let o=r<0?.2*-r:0;h(t,"body","sy",1-o+.1*Math.max(0,r)),h(t,"body","sx",1+o*.6),h(t,"body","sz",1+o*.6);},Jr=(t,e)=>{let r=Math.sin(Math.PI*e.k);h(t,"armR","rx",1.9*r),h(t,"armR","ry",.3*r),h(t,"body","ry",-0.3*r);},Qr=(t,e)=>{let r=Math.sin(Math.PI*e.k);h(t,"armR","rx",.9*r);},eo=(t,e)=>{let r=e.k<.4?-1.5*(e.k/.4):-1.5+3.5*((e.k-.4)/.6);h(t,"armR","rx",e.k>.9?r*(1-e.k)*10:r);},to=(t,e)=>{let r=Math.sin(Math.PI*e.k);h(t,"body","rx",.15*r),h(t,"head","rx",.2*r),h(t,"root","rz",.05*r);},ro=(t,e)=>{let r=Math.sin(Math.PI*e.k);h(t,"root","py",-1.5*r),h(t,"legL","rx",.2*r),h(t,"legR","rx",.2*r),h(t,"body","sy",1-.2*r),h(t,"body","sx",1+.12*r),h(t,"body","sz",1+.12*r);},oo=(t,e)=>{h(t,"armR","rx",1.3+.1*Math.sin(e.t*16)),h(t,"armR","ry",-0.5),h(t,"head","rx",-0.1+.08*Math.sin(e.t*16));},no=t=>{h(t,"armR","rx",2),h(t,"armR","ry",-0.4),h(t,"head","rx",.35);},so=t=>{h(t,"armR","rx",1.57),h(t,"armR","ry",-0.1),h(t,"armL","rx",1.57),h(t,"armL","ry",.35);},ao=t=>{h(t,"armL","rx",.9),h(t,"armL","ry",-0.6);},Pe={idle:Br,walk:Dr,run:jr,sneak:Gr,swim:Vr,fly:Ur,glide:Wr,fall:Kr,sit:$r,ride:Xr,sleep:Yr,dead:qr,hop:Zr,swing:Jr,place:Qr,throw:eo,hurt:to,land:ro,eat:oo,drink:no,draw:so,block:ao},_t={blob:{walk:"hop",run:"hop",sneak:"hop"}},Ot={swing:.3,place:.2,throw:.45,hurt:.3,land:.22};var _e=Math.PI,Oe={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,_e*.46],[1,_e*.46]],"legR.rx":[[0,_e*.46],[1,_e*.46]],"root.py":[[0,-10],[1,-10]]}}},Tn=Object.keys(Oe);function Mn(t){return typeof t=="string"&&t in Oe}function io(t,e){let r=t[0];if(e<=r[0])return r[1];for(let o=1;o<t.length;o++){let s=t[o];if(e<=s[0]){let a=t[o-1],n=(e-a[0])/Math.max(1e-6,s[0]-a[0]),i=n*n*(3-2*n);return a[1]+(s[1]-a[1])*i}}return t[t.length-1][1]}function It(t,e,r){let o=e.loop?r%e.duration:Math.min(r,e.duration);for(let[s,a]of Object.entries(e.tracks)){let n=s.lastIndexOf("."),i=s.slice(0,n),l=s.slice(n+1);l in v&&h(t,i,l,io(a,o));}}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"]},nt={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 Ft(t,e,r){if(!(r<=0))for(let[o,s]of Object.entries(nt[e].add)){let a=o.lastIndexOf(".");X(t,o.slice(0,a),o.slice(a+1),(s??0)*r);}}var _n={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 On(t){let e=[[/(>:\(|😠|😡|🤬)/u,"angry"],[/(:'\(|😢|😭)/u,"sad"],[/(:\(|☹|🙁|😞)/u,"sad"],[/(:o|:O|😮|😲)/u,"surprised"],[/(😱|😨)/u,"scared"],[/(-_-|😴|😩|🥱)/u,"tired"],[/(:\)|:D|\^\^|😀|😃|😄|😁|🙂|😊|😂)/u,"happy"]];for(let[r,o]of e)if(r.test(t))return o;return null}var lo=[{state:"dead",when:t=>t.dead,clip:"dead",blend:.25},{state:"sleep",when:t=>t.sleeping,clip:"sleep",blend:.3},{state:"ride",when:t=>t.riding,clip:"ride",blend:.2},{state:"sit",when:t=>t.sitting,clip:"sit",blend:.3},{state:"swim",when:t=>t.inWater&&!t.onGround&&!t.flying,clip:"swim",blend:.3},{state:"glide",when:t=>t.gliding,clip:"glide",blend:.25},{state:"fly",when:t=>t.flying,clip:"fly",blend:.25},{state:"fall",when:(t,e)=>e.airTime>.35&&t.vy<-4,clip:"fall",blend:.2},{state:"sneak",when:t=>t.sneaking,clip:"sneak",blend:.15},{state:"run",when:t=>t.sprinting&&t.speed>3||t.speed>6.5,clip:"run",blend:.15},{state:"walk",when:t=>t.speed>.4,clip:"walk",blend:.15},{state:"idle",when:()=>true,clip:"idle",blend:.2}],co=new Set(["hurt","land"]),ho={eat:"eat",drink:"drink",draw:"draw",block:"block"},po={tail:(t,e)=>[["ry",-t.yawRate*.25+.12*Math.sin(e*2)],["rx",-(.1+Math.min(t.speed,8)*.06)]],cape:(t,e)=>[["rx",-(.05+Math.min(t.speed,8)*.12)-(t.speed>1?.06*Math.sin(e*9):0)-(t.vy<-3?.4:0)]],hair:t=>[["rx",-Math.min(t.speed,8)*.03]],ear:(t,e)=>[["rz",.08*Math.sin(e*1.3)+Math.min(t.speed,6)*.02]],antenna:(t,e)=>[["rx",.1*Math.sin(e*3)-t.vy*.02]],wingL:(t,e)=>t.flying||t.gliding||!t.onGround&&!t.inWater?[["rz",t.gliding?-0.05:-0.7*Math.sin(e*12)]]:[["rz",1.1+.05*Math.sin(e*1.5)]],wingR:(t,e)=>t.flying||t.gliding||!t.onGround&&!t.inWater?[["rz",t.gliding?.05:.7*Math.sin(e*12)]]:[["rz",-1.1-.05*Math.sin(e*1.5)]]},Ie=t=>{let e=Math.max(0,Math.min(1,t));return e*e*(3-2*e)},ze=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";flash=null;postureW=new Map;blinkT=3;blinking=0;talkT=0;springs=new Map;constructor(e,r,o=[]){this.rig=e,this.style=et(r),this.faces=new Set(o);}setRandom(e){this.random=e;}random=Math.random;setStyle(e){this.style=et(e);}setEmotion(e,r){r&&r>0?this.flash={emotion:e,left:r}:this.mood=e;}get emotion(){return this.emote?.def.emotion?this.emote.def.emotion:this.flash?.emotion??this.mood}get emoting(){return this.emote?.id??null}playEmote(e){this.emote={id:e,def:Oe[e],t:0};}stopEmote(){this.emote=null;}trigger(e){switch(e){case "swing":case "place":case "throw":case "hurt":case "land":{let r=e;this.actions=this.actions.filter(o=>o.clip!==r),this.actions.push({clip:r,t:0,dur:Ot[r]??.3}),e==="hurt"&&this.setEmotion("hurt",.8);break}}}update(e,r=Me()){e=Math.min(e,.1),this.clock+=e;let o=this.emotion,s=nt[o].tempo*this.style.tempo;!r.onGround&&!r.inWater?this.airTime+=e:(!this.wasOnGround&&this.airTime>.3&&r.onGround&&this.trigger("land"),this.airTime=0),this.wasOnGround=r.onGround,this.phase+=r.speed*e*3.5*s;let a=lo.find(c=>c.when(r,this));a.state!==this.state&&(Te(this.from,this.lastLoco),this.state=a.state,this.stateT=0,this.blendT=0,this.blendDur=a.blend),this.stateT+=e,ce(this.loco);let n=_t[this.rig]?.[a.clip]??a.clip,i={t:this.stateT,k:0,phase:this.phase,input:r,style:this.style,clock:this.clock*s};if(Pe[n](this.loco,i),ce(this.pose),this.blendT<this.blendDur?(this.blendT+=e,Pt(this.pose,this.from,this.loco,Ie(this.blendT/this.blendDur))):Te(this.pose,this.loco),Te(this.lastLoco,this.pose),this.emote){let c=this.emote;if(c.t+=e,r.speed>1||this.state!=="idle"||!c.def.loop&&c.t>=c.def.duration)this.emote=null;else {let g=c.def.loop?Ie(c.t/.15):Ie(Math.min(c.t/.15,(c.def.duration-c.t)/.15));ce(this.tmp),It(this.tmp,c.def,c.t),this.overlay(this.tmp,g,false);}}let l=r.use?ho[r.use]:null;l&&(this.useClip=l),this.useW=Math.max(0,Math.min(1,this.useW+(l?e:-e)*8)),this.useClip&&this.useW>0?(ce(this.tmp),Pe[this.useClip](this.tmp,{...i,t:this.clock}),this.overlay(this.tmp,Ie(this.useW),false)):r.held!=="none"&&!this.emote&&X(this.pose,"armR","rx",r.held==="staff"?.35:.2);for(let c of this.actions){c.t+=e;let u=Math.min(1,c.t/c.dur);ce(this.tmp),Pe[c.clip](this.tmp,{...i,t:c.t,k:u}),this.overlay(this.tmp,1,co.has(c.clip));}this.actions=this.actions.filter(c=>c.t<c.dur),this.state!=="dead"&&this.state!=="sleep"&&(X(this.pose,"head","ry",Math.max(-1.1,Math.min(1.1,r.lookYaw))),X(this.pose,"head","rx",Math.max(-1.2,Math.min(1.2,r.lookPitch)))),this.flash&&(this.flash.left-=e)<=0&&(this.flash=null);for(let c of a$1){let u=this.postureW.get(c)??0,b=u+((c===o?1:0)-u)*Math.min(1,e*6);this.postureW.set(c,b),this.state!=="dead"&&Ft(this.pose,c,b);}for(let[c,u]of Object.entries(po))for(let[b,g]of u(r,this.clock)){let R=c+"."+b,E=this.springs.get(R);E||this.springs.set(R,E={x:g,v:0});let F=60,K=9;E.v+=(F*(g-E.x)-K*E.v)*e,E.x+=E.v*e,X(this.pose,c,b,E.x);}return this.expression=this.face(r,e,o),this.pose}overlay(e,r,o){for(let[s,a]of e){let n=fe(this.pose,s);for(let i=0;i<9;i++)o?i>=v.sx?n[i]=n[i]*(1+(a[i]-1)*r):n[i]=n[i]+(a[i]-ue[i])*r:n[i]=n[i]+(a[i]-n[i])*r;}}face(e,r,o){let s=n=>n.find(i=>this.faces.has(i))??"neutral";if(e.dead||this.state==="dead"||e.sleeping)return s(["blink","hurt","neutral"]);let a=s(zt[o]);return e.viseme!==void 0?(this.talkT=0,e.viseme!=="rest"&&e.viseme!=="MBP"?s(["talk",a]):a):e.talk?(this.talkT+=r,Math.floor(this.talkT/.12)%2===0?s(["talk",a]):a):(this.talkT=0,this.blinking>0?(this.blinking-=r,s(["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 mo={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"}},uo={handR:"handR",handL:"handL",head:"headTop"},Ht=class{view;animator;input=Me();seed;pose="idle";jumpT=-1;constructor(e,r={}){this.view=new Ae(e,{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(e){let r=this.view.hash;this.view.setSpec(e),this.view.hash!==r&&(this.animator=this.newAnimator());}setEmotion(e){this.animator.setEmotion(e);}setViseme(e){this.input.viseme=e;}setPose(e){if(e===this.pose)return;this.pose=e;let r=mo[e];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(e){this.animator.playEmote(e);}attach(e,r){this.view.attach(uo[e],r);}update(e){let r=this.input;this.jumpT>=0&&(this.jumpT+=e,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(e,r);this.view.applyPose(o),this.view.setExpression(this.animator.expression);}dispose(){this.view.dispose();}newAnimator(){let e=this.view.spec,r=new ze(e.rig,e.style,this.view.expressions);return r.setRandom(a(this.seed)),r}};var fo=be.map(t=>{let e=q[t],r=e.bones.map(s=>`${s.name}@[${s.pivot.join(",")}]`).join(" "),o=e.defaultParts.map(s=>`${s.bone} ${s.size.join("x")} at [${s.pos.join(",")}]`).join("; ");return `- "${t}" \u2014 ${e.hint}. Bones (name@pivot): ${r}. Default body: ${o}.`}).join(`
2
+ `),$n=`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
+
4
+ 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
+
6
+ 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
+
8
+ SKELETONS ("rig"):
9
+ ${fo}
10
+
11
+ CharacterSpec:
12
+ {
13
+ "version": 1,
14
+ "name": string (<= 40 chars, in the player's language),
15
+ "description": string (<= 200 chars),
16
+ "rig": ${be.map(t=>`"${t}"`).join(" | ")},
17
+ "scale": 0.25..3 (overall size; 1 = normal),
18
+ "palette": { "<one character>": "#rrggbb", ... } (<= 32 colours; "." and " " are transparent),
19
+ "textures": { "<id>": { "w": 1..32, "h": 1..32, "rows": [ "<w palette characters>", ... h rows, top row first ] } },
20
+ "parts": [ <= 64 boxes:
21
+ { "bone": "<bone>", "size": [w, h, d] (px, <= 32), "pos": [x, y, z] (the box CENTRE in model px),
22
+ "color": "<palette char>" (faces without a texture),
23
+ "faces": { "front"|"back"|"left"|"right"|"top"|"bottom": "<texture id>" or "<palette char>" },
24
+ "rot": [x, y, z] (degrees, optional tilt around the box centre),
25
+ "mirror": true (also adds the mirrored copy on the paired bone: armL -> armR, legFL -> legFR),
26
+ "name": string } ],
27
+ "bones": [ <= 16 EXTRA bones for tails, ears, wings, capes, hair, antennas:
28
+ { "name": string, "parent": "<bone>", "pivot": [x, y, z], "role": ${ke.map(t=>`"${t}"`).join(" | ")} } ]
29
+ (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
+ "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": { ${je.map(t=>`"${t}"`).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": ${Ge.map(t=>`"${t}"`).join(" | ")}, "idle": ${Ve.map(t=>`"${t}"`).join(" | ")}, "energy": 0..1 },
33
+ "voice": { "pitch": 0.5..2 },
34
+ "tags": [ <= 8 short words ],
35
+ "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)
36
+ }
37
+
38
+ FACES OF A BOX as seen from OUTSIDE: "front" is on the -z side, left/right are the CHARACTER's left (-x) and right (+x). A texture is stretched over the whole face, its first row is the top. On the front face the viewer's LEFT is the character's RIGHT hand side. The top face is seen from above with the back edge as its first row.
39
+
40
+ HOW TO BUILD A GOOD, DETAILED CHARACTER (the game's style: blocky people with fine pixel-art clothes, like a voxel animation):
41
+ - Draw textures at 2 texels per model pixel: an 8x8 head face is a 16x16 texture, an 8x12 torso front is 16x24, a 3x12 arm side is 6x24, a 4x12 leg side is 8x24. Use 2\u20133 shades of every colour (base, lighter, darker) for seams, folds, collars, cuffs and highlights; use soft, natural colours unless the pictures say otherwise.
42
+ - LAYER BOXES for volume \u2014 this is what makes a character look rich:
43
+ hair: a slightly bigger cap over the head (e.g. [8.6, 1.6, 8.6] at y 32.2) plus a thin piece on the back of the head, curls or bangs as small boxes, long hair as thin boxes down the back and the sides;
44
+ a nose: a 1x1.5x0.8 box sticking out of the face; ears, beards, glasses, hats (a wide thin brim + a crown) \u2014 boxes on "head";
45
+ clothes: sleeves as a box slightly bigger than the arm covering its top part (short, rolled or full length, with a lighter cuff band at the bottom); a belt box around the waist; collars, hoods, scarves, vests, armour plates, pockets, backpacks;
46
+ shoes: a box slightly bigger than the bottom of the leg (boots ~4.5 px tall with laces drawn on the front, sneakers ~2.5 px with a white sole).
47
+ Overlay boxes are 0.2\u20130.6 px bigger than what they cover so they never flicker.
48
+ - Slim arms (3 px wide, at x = \xB15.5) look more natural for people; 4 px for strong ones.
49
+ - Start from the default body of the skeleton and change proportions to match the pictures: a big head for cute characters, long legs for elegant ones, a wide body for strong ones. Keep boxes on the right bones \u2014 a hat on "head", a backpack or a cape on "body", a sword hand on "armR".
50
+ - Use "mirror": true for every symmetric pair (arms, legs, sleeves, shoes, ears, wings) \u2014 describe the left one only.
51
+ - 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
+ - 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
+ - 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 Zn=["cat","dog","fox","bear","rabbit","bird","dragon","slime","ghost","robot"],bo=t=>({k:"#2a1c14",w:"#f4f4ef",b:t,m:"#7a3a30",o:"#3a1a14"});function go(t){let e=t.light??t.body,r=t.accent??t.body,o={t:t.body,s:t.body,l:e,a:r,p:r,...bo(t.eyes??"#3f6f3a")},s=[],a="quadruped",n=Ce("head",[0,3,8,5]),i={walk:"normal",idle:"calm",energy:.6},l=(c,u,b,g,R,E={})=>s.push({name:c,bone:u,size:b,pos:g,color:R,...E});switch(t.kind){case "cat":case "fox":case "dog":case "bear":case "rabbit":{let c=t.kind;l("body","body",[8,8,16],[0,12,0],"t"),l("belly","body",[6,1,12],[0,8,0],"l"),l("head","head",[8,8,8],[0,16,-12],"s");for(let u of ["legFL","legFR","legBL","legBR"]){let b=u.endsWith("L")?-3:3,g=u.startsWith("legF")?-6:6;l(u,u,[3,8,3],[b,4,g],"t"),l(`${u}Paw`,u,[3.2,1.5,3.2],[b,.75,g],"a");}c==="cat"?(l("ear","head",[2,2.5,1],[-2.5,21,-11],"a",{mirror:true}),l("tail","tail",[1.6,1.6,10],[0,15,13],"t",{rot:[20,0,0]}),i={walk:"sneaky",idle:"calm",energy:.5}):c==="fox"?(l("ear","head",[2.4,3.2,1],[-2.5,21.4,-11],"t",{mirror:true}),l("snout","head",[4,3,3],[0,14.5,-17],"l"),l("nose","head",[1.2,1,.6],[0,15.6,-18.6],"a"),l("tail","tail",[3.5,3.5,10],[0,14,13],"t",{rot:[15,0,0]}),l("tailTip","tail",[3.6,3.6,2.5],[0,15.2,18],"l"),i={walk:"bouncy",idle:"fidgety",energy:.7}):c==="dog"?(l("ear","head",[1.5,4,3],[-4.6,17.5,-11.5],"a",{mirror:true}),l("snout","head",[4,3,3],[0,14.5,-17],"l"),l("nose","head",[1.6,1.2,.6],[0,15.8,-18.6],"a"),l("tail","tail",[2,2,7],[0,16,11],"t",{rot:[40,0,0]}),i={walk:"bouncy",idle:"fidgety",energy:.9}):c==="bear"?(l("ear","head",[2,2,1],[-3,20.6,-10.5],"a",{mirror:true}),l("snout","head",[4,3,2.5],[0,14.5,-16.8],"l"),l("nose","head",[1.6,1.2,.6],[0,15.8,-18.2],"a"),l("tail","tail",[2,2,2],[0,14,9],"t"),i={walk:"heavy",idle:"proud",energy:.4}):(l("ear","head",[1.6,7,1],[-1.8,23.5,-11],"t",{mirror:true}),l("earInner","head",[.8,5.5,.4],[-1.8,23.5,-11.6],"l",{mirror:true}),l("tail","tail",[3,3,3],[0,14,9.5],"l"),i={walk:"bouncy",idle:"fidgety",energy:.8});break}case "bird":case "dragon":{a="flyer",n=Ce("head",[0,1,5,3]);let c=t.kind==="dragon";l("body","body",[6,6,8],[0,8,0],"t"),l("belly","body",[4.6,4,1],[0,7.5,-4.2],"l"),l("head","head",[5,5,5],[0,13,-4],"s"),l("wing","wingL",[8,1,6],[-7,10,0],"a",{mirror:true}),l("leg","legL",[1,4,1],[-1.5,2,0],"a",{mirror:true}),c?(l("horn","head",[.8,2,.8],[-1.4,16.4,-3],"l",{mirror:true}),l("snout","head",[3,2,2.4],[0,12.2,-7.4],"s"),l("tail","tail",[2,2,8],[0,7,7],"t"),l("spike","body",[1,1.5,6],[0,11.6,0],"a"),i={walk:"heavy",idle:"proud",energy:.6}):(l("beak","head",[1.6,1.2,2],[0,12.4,-7.2],"a"),l("tail","tail",[4,1,4],[0,8,6],"a"),l("crest","head",[1,2,2],[0,16.2,-3.6],"a"),i={walk:"bouncy",idle:"fidgety",energy:.8});break}case "slime":case "ghost":case "robot":{a="blob",n=Ce("body",[2,3,8,5]),t.kind==="slime"?(l("body","body",[12,10,12],[0,5,0],"t"),l("shine","body",[3,2,.4],[-3,8,-6.2],"l"),i={walk:"bouncy",idle:"fidgety",energy:.9}):t.kind==="ghost"?(l("body","body",[10,12,10],[0,7,0],"t"),l("hem","body",[10.4,2,10.4],[0,1,0],"l"),i={walk:"sneaky",idle:"calm",energy:.4}):(l("body","body",[11,11,10],[0,5.5,0],"t"),l("antenna","body",[.8,3,.8],[0,12.5,0],"a"),l("bulb","body",[1.6,1.6,1.6],[0,14.6,0],"l"),l("screen","body",[9,6,.4],[0,6.5,-5.2],"l"),i={walk:"robotic",idle:"calm",energy:.5});break}}return {version:1,name:t.name,description:t.description??"",rig:a,palette:o,textures:n.textures,parts:s,face:n.face,style:i,finish:{noise:.45,outline:.4,shade:.25,density:2},tags:t.tags??[t.kind]}}function Jn(t){let e=Z(go(t));if(!e.ok)throw new Error(`${t.kind}: ${e.error}`);return e.spec}export{Ot as ACTION_TIME,en as ANIM_EVENTS,ze as Animator,w as Art,Ro as BONE_ROLES,v as CH,Jo as CHANNELS,gt as CHARACTER_LIMITS,dt as CHARACTER_SPEC_VERSION,ye as CLEAR,Pe as CLIPS,Zn as CREATURE_KINDS,Ae as CharacterView,Ze as DEFAULT_CHARACTER_SOURCE,jt as DEFAULT_COLORS,pe as DEFAULT_FINISH,Oe as EMOTES,Tn as EMOTE_IDS,_n as EMOTION_EVENTS,je as EXPRESSIONS,zt as EXPRESSION_CHAIN,ke as EXTRA_BONE_ROLES,De as FACE_NAMES,Qo as HELD_KINDS,Mt as HUMAN_BOTTOMS,Yo as HUMAN_HAIR,At as HUMAN_SHOES,Tt as HUMAN_TOPS,Ve as IDLE_STYLES,lo as LOCOMOTION,nt as POSTURE,ue as REST,q as RIGS,_t as RIG_CLIPS,be as RIG_IDS,Eo as SOCKETS,$n as VOXEL_CHARACTER_SYSTEM_PROMPT,Ht as VoxelActor,Ge as WALK_STYLES,$e as acquireCharacter,X as add,Ft as applyPosture,zr as bandColors,fe as bone,xt as bonesOf,Rn as characterFromImage,hn as characterOf,pn as characterSpecs,ce as clearPose,Te as copyPose,Jn as creatureCharacter,go as creatureSource,le as defaultCharacter,Ee as defaultCharacterName,Je as disposeNameplate,On as emotionFromText,qe as humanSource,Fo as isDefaultCharacterName,Mn as isEmote,j as isObj,Et as layoutCharacter,Pt as lerpPose,yt as mirrorBone,Lt as nameplate,Me as newAnimInput,ft as normColor,gn as npcCharacter,W as num,mn as onCharacterKnown,Z as parseCharacterSpec,Ne as pick,Ye as recolor,cn as registerCharacter,Se as releaseCharacter,zo as rigOfSpec,It as sampleEmote,io as sampleTrack,h as setCh,me as specHash,Be as stableStringify,Ce as standardFace,et as styleParams,Re as vec3};
package/package.json CHANGED
@@ -1,6 +1,103 @@
1
1
  {
2
2
  "name": "@idosgames/characters",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "Characters of the iDosGames platform in one standard for games and videos: voxel characters (CharacterSpec recipes on three.js), layered 2D characters on a skeleton with a full wardrobe (clothes, hair, weapons, shields) in vector art, and GLB characters on the humanoid-v1 skeleton — one actor contract (emotions, mouth visemes, poses, sockets) and lip-sync from text.",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "author": "iDos Games",
8
+ "homepage": "https://github.com/iDos-Games/iDosGamesSDK_TS#readme",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/iDos-Games/iDosGamesSDK_TS.git",
12
+ "directory": "packages/characters"
13
+ },
14
+ "bugs": {
15
+ "url": "https://github.com/iDos-Games/iDosGamesSDK_TS/issues"
16
+ },
17
+ "keywords": [
18
+ "idosgames",
19
+ "characters",
20
+ "voxel",
21
+ "2d-skeleton",
22
+ "gltf",
23
+ "lip-sync",
24
+ "three"
25
+ ],
26
+ "publishConfig": {
27
+ "access": "public"
28
+ },
29
+ "sideEffects": false,
30
+ "main": "./dist/index.cjs",
31
+ "module": "./dist/index.js",
32
+ "types": "./dist/index.d.ts",
33
+ "exports": {
34
+ ".": {
35
+ "types": "./dist/index.d.ts",
36
+ "import": "./dist/index.js",
37
+ "require": "./dist/index.cjs"
38
+ },
39
+ "./voxel": {
40
+ "types": "./dist/voxel/index.d.ts",
41
+ "import": "./dist/voxel/index.js",
42
+ "require": "./dist/voxel/index.cjs"
43
+ },
44
+ "./rig2d": {
45
+ "types": "./dist/rig2d/index.d.ts",
46
+ "import": "./dist/rig2d/index.js",
47
+ "require": "./dist/rig2d/index.cjs"
48
+ },
49
+ "./rig2d/phaser": {
50
+ "types": "./dist/rig2d/phaser/index.d.ts",
51
+ "import": "./dist/rig2d/phaser/index.js",
52
+ "require": "./dist/rig2d/phaser/index.cjs"
53
+ },
54
+ "./rig2d/three": {
55
+ "types": "./dist/rig2d/three/index.d.ts",
56
+ "import": "./dist/rig2d/three/index.js",
57
+ "require": "./dist/rig2d/three/index.cjs"
58
+ },
59
+ "./rig2d/editor": {
60
+ "types": "./dist/rig2d/editor/index.d.ts",
61
+ "import": "./dist/rig2d/editor/index.js",
62
+ "require": "./dist/rig2d/editor/index.cjs"
63
+ },
64
+ "./gltf": {
65
+ "types": "./dist/gltf/index.d.ts",
66
+ "import": "./dist/gltf/index.js",
67
+ "require": "./dist/gltf/index.cjs"
68
+ }
69
+ },
70
+ "files": [
71
+ "dist",
72
+ "README.md",
73
+ "LICENSE"
74
+ ],
75
+ "scripts": {
76
+ "build": "tsup",
77
+ "typecheck": "tsc --noEmit -p tsconfig.json"
78
+ },
79
+ "//": "Engines and UI are optional peers, each needed only by its subpath: three — /voxel and /gltf, phaser — /rig2d/phaser and /rig2d/editor, react — /rig2d/editor. The root and /rig2d need none of them.",
80
+ "peerDependencies": {
81
+ "phaser": "^4.2.1",
82
+ "react": "^18.3.1 || ^19.0.0",
83
+ "three": ">=0.185.1 <0.200.0"
84
+ },
85
+ "peerDependenciesMeta": {
86
+ "phaser": {
87
+ "optional": true
88
+ },
89
+ "react": {
90
+ "optional": true
91
+ },
92
+ "three": {
93
+ "optional": true
94
+ }
95
+ },
96
+ "devDependencies": {
97
+ "@types/react": "^19.2.17",
98
+ "@types/three": "0.185.1",
99
+ "phaser": "4.2.1",
100
+ "react": "^19.2.7",
101
+ "three": "0.185.1"
102
+ }
103
+ }