@idosgames/characters 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +38 -2
- package/dist/PartsManager-CAVBKvp6.d.ts +589 -0
- package/dist/PartsManager-Cn3MU-VS.d.cts +589 -0
- package/dist/chunk-64D567CX.js +1 -0
- package/dist/chunk-BU66AZ2Z.js +1 -0
- package/dist/chunk-CGF2TQVK.js +1 -0
- package/dist/chunk-OF4BH3JZ.js +2 -0
- package/dist/chunk-WKHHFTK2.js +1 -0
- package/dist/chunk-Z5I76WRJ.js +1 -0
- package/dist/contract-DhZuKNIf.d.cts +24 -0
- package/dist/contract-DhZuKNIf.d.ts +24 -0
- package/dist/gltf/index.cjs +1 -0
- package/dist/gltf/index.d.cts +150 -0
- package/dist/gltf/index.d.ts +150 -0
- package/dist/gltf/index.js +1 -0
- package/dist/image-D5NaQeFz.d.cts +8 -0
- package/dist/image-D5NaQeFz.d.ts +8 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +65 -0
- package/dist/index.d.ts +65 -0
- package/dist/index.js +1 -0
- package/dist/rig2d/editor/index.cjs +81 -0
- package/dist/rig2d/editor/index.d.cts +25 -0
- package/dist/rig2d/editor/index.d.ts +25 -0
- package/dist/rig2d/editor/index.js +81 -0
- package/dist/rig2d/index.cjs +17 -0
- package/dist/rig2d/index.d.cts +190 -0
- package/dist/rig2d/index.d.ts +190 -0
- package/dist/rig2d/index.js +17 -0
- package/dist/rig2d/phaser/index.cjs +2 -0
- package/dist/rig2d/phaser/index.d.cts +106 -0
- package/dist/rig2d/phaser/index.d.ts +106 -0
- package/dist/rig2d/phaser/index.js +1 -0
- package/dist/rig2d/three/index.cjs +2 -0
- package/dist/rig2d/three/index.d.cts +63 -0
- package/dist/rig2d/three/index.d.ts +63 -0
- package/dist/rig2d/three/index.js +1 -0
- package/dist/thumbnail-BhGEEXux.d.cts +49 -0
- package/dist/thumbnail-Bp-jK70T.d.ts +49 -0
- package/dist/voxel/index.cjs +54 -0
- package/dist/voxel/index.d.cts +972 -0
- package/dist/voxel/index.d.ts +972 -0
- package/dist/voxel/index.js +54 -0
- package/package.json +101 -4
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
'use strict';var _=require('three');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var ___namespace=/*#__PURE__*/_interopNamespace(_);function we(t){let e=t>>>0;return function(){e|=0,e=e+1831565813|0;let r=Math.imul(e^e>>>15,1|e);return r=r+Math.imul(r^r>>>7,61|r)^r,((r^r>>>14)>>>0)/4294967296}}function ae(t){let e=2166136261;for(let r=0;r<t.length;r++)e^=t.charCodeAt(r),e=Math.imul(e,16777619);return e>>>0}var Bt=["ru","kk","uk","be","ky","uz","tg"],Dt="idos:language",jt="idos:language";function Vt(){try{let e=globalThis.localStorage?.getItem(Dt);if(e==="en"||e==="ru")return e}catch{}if(typeof navigator>"u")return "en";let t=(navigator.language||"").toLowerCase();return Bt.some(e=>t.startsWith(e))?"ru":"en"}var lt=Vt();typeof window<"u"&&window.addEventListener(jt,t=>{let e=t.detail;(e==="en"||e==="ru")&&(lt=e);});function A(t,e){let r=typeof t=="string"?t:t[lt]??t.en;if(e)for(let[o,s]of Object.entries(e))r=r.split(`{${o}}`).join(String(s));return r}function ct(t){let e=t.trim(),r=/```(?:json)?\s*([\s\S]*?)(?:```|$)/i.exec(e);r&&r[1]!==void 0&&(e=r[1]);let o=e.indexOf("{");if(o<0)return {ok:false,error:A({en:"the answer has no JSON object",ru:"\u0432 \u043E\u0442\u0432\u0435\u0442\u0435 \u043D\u0435\u0442 JSON-\u043E\u0431\u044A\u0435\u043A\u0442\u0430"}),truncated:false};let s=0,a=false,n=false,i=-1;for(let l=o;l<e.length;l++){let c=e[l];if(a){n?n=false:c==="\\"?n=true:c==='"'&&(a=false);continue}if(c==='"')a=true;else if(c==="{"||c==="[")s++;else if((c==="}"||c==="]")&&(s--,s===0)){i=l;break}}if(i<0)return {ok:false,error:A({en:"the JSON is cut off",ru:"JSON \u043E\u0431\u043E\u0440\u0432\u0430\u043D"}),truncated:true};try{return {ok:!0,value:JSON.parse(e.slice(o,i+1))}}catch{return {ok:false,error:A({en:"invalid JSON",ru:"\u043D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u044B\u0439 JSON"}),truncated:false}}}var pt={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 mt={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 dt={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 Oo=["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"],Po=["handR","handL","headTop","face","back","waist","shoulders"],be=["humanoid","quadruped","flyer","blob"];var J={humanoid:mt,quadruped:dt,flyer:ht,blob:pt};var ut=1,De=["front","back","left","right","top","bottom"],je=["neutral","blink","happy","sad","angry","surprised","scared","tired","hurt","talk"],Ve=["normal","bouncy","heavy","sneaky","robotic"],Ge=["calm","fidgety","proud"],yt={parts:64,bones:16,palette:32,textures:48,texturePixels:32768,textureSide:32,partSide:32,coord:64},he={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 He(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 Ee(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 ft={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 bt(t){if(typeof t!="string")return null;let e=t.trim().toLowerCase();if(ft[e])return ft[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(["."," "]),gt=t=>/^[A-Za-z0-9_]{1,24}$/.test(t),Gt={human:"humanoid",biped:"humanoid",person:"humanoid",animal:"quadruped",four_legs:"quadruped",quadrupedal:"quadruped",bird:"flyer",winged:"flyer",dragon:"flyer",slime:"blob",ghost:"blob"};function Ut(t){if(typeof t!="string")return "humanoid";let e=t.trim().toLowerCase().replace(/[\s-]+/g,"_");return be.includes(e)?e:Gt[e]??"humanoid"}function xt(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 q(t){if(typeof t=="string"){let m=ct(t);if(!m.ok)return {ok:false,error:m.error,truncated:m.truncated};t=m.value;}if(!j(t))return {ok:false,error:A({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=yt,o=[];typeof e.version=="number"&&e.version>ut&&o.push(A({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=Ut(e.rig),a=J[s],n={};if(j(e.palette))for(let[m,k]of Object.entries(e.palette)){if(Object.keys(n).length>=r.palette){o.push(A({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=bt(k);if(m.length!==1||ye.has(m)||!y){o.push(A({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=bt(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 h=[...i].find(d=>!n[d]);return h?(n[h]=y,h):k},c={},u=0;if(j(e.textures))for(let[m,k]of Object.entries(e.textures)){if(!gt(m)){o.push(A({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).length>=r.textures){o.push(A({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=$t(k,n,o,m);if(y){if(u+y.w*y.h>r.texturePixels){o.push(A({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[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||!gt(k))continue;let y=Ee(m.pivot,r.coord);if(!y||g.some(x=>x.name===k))continue;if(g.length>=r.bones){o.push(A({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),h=te(m.parent,"",24),d=M?a.bones.find(x=>x.name===k).parent??"":b.has(h)||g.some(x=>x.name===h)?h:a.bones.find(x=>x.role==="body").name;g.push({name:k,parent:d,pivot:y,role:M?"static":He(m.role,ke,"static")}),b.add(k);}let E=Object.keys(n)[0]??"s",R=[];for(let m of ge(e.parts)){if(R.length>=r.parts){o.push(A({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=Ee(m.size,r.partSide),y=Ee(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(A({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 h={bone:M,size:k,pos:y,color:l(m.color,E)};if(j(m.faces)){let f={};for(let O of De){let I=m.faces[O];if(typeof I=="string")if(c[I])f[O]=I;else {let V=l(I,"");V&&(f[O]=V);}}Object.keys(f).length&&(h.faces=f);}let d=Ee(m.rot??m.rotation,180);d&&d.some(f=>f!==0)&&(h.rot=d),(m.mirror===true||m.mirror==="x")&&(h.mirror=true);let x=te(m.name,"",24);x&&(h.name=x),R.push(h);}if(!R.length){for(let[m,k]of Object.entries(Wt))n[m]||(n[m]=k);R.push(...a.defaultParts.map(Kt));}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(h=>Math.round(W(h,NaN,0,r.partSide))),M={};if(j(m.expressions))for(let h of je){let d=m.expressions[h];typeof d=="string"&&c[d]&&(M[h]=d);}if(!M.neutral){let h=Object.values(M)[0];h&&(M.neutral=h);}if(M.neutral){let h=c[M.neutral];F={bone:k,rect:y.length===4&&y.every(Number.isFinite)&&y[2]>0&&y[3]>0?y:[0,0,h.w,h.h],expressions:M};}else Object.keys(m).length&&o.push(A({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:{},L=j(e.finish)?e.finish:{};return {ok:true,spec:{version:ut,name:te(e.name,Re(),40)||Re(),description:te(e.description,"",300),rig:s,scale:W(e.scale,1,.25,3),palette:n,textures:c,parts:R,bones:g,face:F,style:{walk:He(K.walk,Ve,"normal"),idle:He(K.idle,Ge,"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(L.noise,he.noise,0,1),outline:W(L.outline,he.outline,0,1),shade:W(L.shade,he.shade,0,1),density:Math.round(W(L.density,he.density,1,4))}},warnings:o}}var Wt={s:"#c69c7c",t:"#3a8fd6",p:"#2c3e6b"};function Kt(t){return JSON.parse(JSON.stringify(t))}function $t(t,e,r,o){let s=Array.isArray(t)?{rows:t}:j(t)?t:null;if(!s)return null;let a=yt.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=false;for(n=n.slice(0,i).map(u=>{let b="";for(let g=0;g<l;g++){let E=u[g]??".";ye.has(E)||e[E]?b+=E===" "?".":E:(c=true,b+=".");}return b});n.length<i;)n.push(".".repeat(l));return c&&r.push(A({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=ae(e),o=ae("~"+e);return r.toString(16).padStart(8,"0")+o.toString(16).padStart(8,"0")}function Uo(t){return J[t.rig]}function wt(t){let r=J[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 Re(){return A({en:"Character",ru:"\u041F\u0435\u0440\u0441\u043E\u043D\u0430\u0436"})}var Wo=t=>t==="\u041F\u0435\u0440\u0441\u043E\u043D\u0430\u0436"||t==="Character";var Yt={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 kt(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 Xt(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 Et(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 Jt(t,e,r,o,s,a,n,i){let c=1+(.55*Et(n,e,r)+.45*Et(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 qt(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:xt(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 St(t){let e=J[t.rig],r=wt(t),o=h=>r.some(d=>d.name===h),s=qt(t,o),a=t.finish??he,n=new Map,i=(h,d)=>{let x=h.faces?.[d],f=x!==void 0?t.textures[x]:void 0,O=x!==void 0&&t.palette[x]?x:h.color,[I,V]=d==="front"||d==="back"?[h.size[0],h.size[1]]:d==="left"||d==="right"?[h.size[2],h.size[1]]:[h.size[0],h.size[2]],C=(pe,oe)=>Math.max(1,Math.min(64,oe*Math.max(1,Math.round(pe*a.density/oe)))),H=f?C(I,f.w):C(I,1),B=f?C(V,f.h):C(V,1),P=d==="top"?"t":d==="bottom"?"b":"s",N=(f?"t:"+x:"c:"+O)+"|"+H+"x"+B+P,D=n.get(N);if(D)return D;let Q=ae(N),ee=f?null:Ue(t.palette[O]??"#ff00ff");return D={key:N,w:H,h:B,x:0,y:0,paint:(pe,oe,Ne,ne,se)=>{for(let X=0;X<B;X++)for(let U=0;U<H;U++){let st=ee;if(f){let at=f.rows[Math.floor(X*f.h/B)][Math.floor(U*f.w/H)];if(ye.has(at))continue;let it=t.palette[at];if(!it)continue;st=Ue(it);}kt(pe,oe,Ne,ne+U,se+X,Jt(st,U,X,H,B,P,Q,a));}}},n.set(N,D),D},l=(h,d)=>{let x="e:"+h,f=n.get(x);return f||(f={key:x,w:d.w,h:d.h,x:0,y:0,paint:(O,I,V,C,H)=>{for(let B=0;B<d.h;B++)for(let P=0;P<d.w;P++){let N=d.rows[B][P];if(ye.has(N))continue;let D=t.palette[N];D&&kt(O,I,V,C+P,H+B,Ue(D));}}},n.set(x,f)),f},c=s.map(h=>({p:h,faces:De.map(d=>({f:d,cell:i(h,d)}))})),u=t.face,b=[];if(u)for(let[h,d]of Object.entries(u.expressions)){let x=t.textures[d];x&&b.push([h,l(d,x)]);}let{w:g,h:E}=Xt([...n.values()]),R=new Uint8Array(g*E*4);for(let h of n.values())h.paint(R,g,E,h.x,h.y);let F=.01,K=h=>[(h.x+F)/g,1-(h.y+F)/E,(h.x+h.w-F)/g,1-(h.y+h.h-F)/E],T=new Map;for(let h of r)T.set(h.name,{pos:[],nrm:[],uv:[],idx:[]});let L=0;for(let{p:h,faces:d}of c){let x=T.get(h.bone),f=r.find(I=>I.name===h.bone).pivot,O=[h.size[0]/2,h.size[1]/2,h.size[2]/2];L=Math.max(L,h.pos[1]+O[1]);for(let{f:I,cell:V}of d){let C=Yt[I],H=(ne,se)=>{let X=[O[0]*(C.tl[0]+2*(C.u[0]*ne+C.d[0]*se)),O[1]*(C.tl[1]+2*(C.u[1]*ne+C.d[1]*se)),O[2]*(C.tl[2]+2*(C.u[2]*ne+C.d[2]*se))],U=Rt(X,h.rot);return [h.pos[0]+U[0]-f[0],h.pos[1]+U[1]-f[1],h.pos[2]+U[2]-f[2]]},B=Rt(C.n,h.rot),P=x.pos.length/3,[N,D,Q,ee]=K(V),[pe,oe]=h.flip?[Q,N]:[N,Q],Ne=[[0,0,pe,D],[1,0,oe,D],[1,1,oe,ee],[0,1,pe,ee]];for(let[ne,se,X,U]of Ne)x.pos.push(...H(ne,se)),x.nrm.push(...B),x.uv.push(X,U);x.idx.push(P,P+2,P+1,P,P+3,P+2);}}let G=r.map(h=>{let d=T.get(h.name);return {name:h.name,role:h.role,parent:h.parent,pivot:h.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.length){let d=t.parts.filter(f=>f.bone===u.bone).sort((f,O)=>O.size[0]*O.size[1]*O.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,O,I,V]=u.rect,C=d.pos[0]+d.size[0]/2-f,H=d.pos[1]+d.size[1]/2-O,B=d.pos[2]-d.size[2]/2-.05,P=x.pivot,N=(Q,ee)=>[Q-P[0],ee-P[1],B-P[2]],D={};for(let[Q,ee]of b)D[Q]=K(ee);m={bone:u.bone,corners:Float32Array.from([...N(C,H),...N(C-I,H),...N(C-I,H-V),...N(C,H-V)]),uv:D};}}let k=e.sockets.filter(h=>o(h.bone)).map(h=>{let d=e.bones.find(x=>x.name===h.bone);return {name:h.name,bone:h.bone,at:[h.at[0]-d.pivot[0],h.at[1]-d.pivot[1],h.at[2]-d.pivot[2]]}}),y=Math.max(1,L),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:G,atlas:{w:g,h:E,data:R},face:m,sockets:k,height:y,scale:t.scale*M,eye:e.eye*y/Zt(t.rig)}}function Zt(t){let e=1;for(let r of J[t].defaultParts)e=Math.max(e,r.pos[1]+r.size[1]/2);return e}var Ke=new Map;function Qt(t){let e=new Map;for(let n of t.bones){if(!n.indices.length){e.set(n.name,null);continue}let i=new ___namespace.BufferGeometry;i.setAttribute("position",new ___namespace.BufferAttribute(n.positions,3)),i.setAttribute("normal",new ___namespace.BufferAttribute(n.normals,3)),i.setAttribute("uv",new ___namespace.BufferAttribute(n.uvs,2)),i.setIndex(new ___namespace.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 ___namespace.DataTexture(s,r,o,___namespace.RGBAFormat);return a.magFilter=___namespace.NearestFilter,a.minFilter=___namespace.NearestFilter,a.generateMipmaps=false,a.colorSpace=___namespace.SRGBColorSpace,a.needsUpdate=true,{layout:t,geometries:e,texture:a,refs:0}}function $e(t){let e=Ke.get(me(t));return e||(e=Qt(St(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 er={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 Z(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 Xe(t,e){let r={...t};return e.skin&&(r.s=e.skin,r.S=Z(e.skin,.86),r.m=Z(e.skin,.66)),e.hair&&(r.h=e.hair,r.H=Z(e.hair,1.25),r.k=Z(e.hair,.6)),e.shirt&&(r.t=e.shirt,r.T=Z(e.shirt,1.15),r.D=Z(e.shirt,.8)),e.pants&&(r.p=e.pants,r.P=Z(e.pants,.8)),e.boots&&(r.z=e.boots,r.Z=Z(e.boots,.78)),e.eyes&&(r.b=e.eyes),r}var tr=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"),vt=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"),rr=vt.flipped(),or=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"),nr=new w(16,16,"h").where((t,e)=>(t+2*e)%5===0,"H").where((t,e)=>(3*t+e)%9===0,"k"),sr=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"),ar=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"),ir=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"),lr=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"),cr=new w(16,2,"B").rect(7,0,2,2,"g").px(3,0,"k").px(12,0,"k"),pr=new w(6,24,"s").row(23,0,5,"S").col(2,21,23,"S"),hr=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"),mr=new w(8,24,"p").col(4,1,21,"P").row(0,0,7,"P"),dr=new w(8,24,"p").col(3,0,21,"P").row(0,0,7,"P"),ur=new w(8,24,"p").col(3,0,21,"P"),fr=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"),br=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 Ct={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"})},gr=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"),yr=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"),xr=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"),wr=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"),kr=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"),Er=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"),Rr=ve(new w(8,24,"t"),6).where((t,e)=>e>=18&&e<=19,"D").rect(0,20,8,4,"p"),Sr=ve(new w(8,22,"t"),9).where((t,e)=>e>=19&&t%2===0,"D"),Tt=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"),vr=Tt(4),Cr=Tt(3),Tr=new w(9,5,"z").row(1,3,5,"l").rect(0,3,9,2,"l"),Mr=new w(10,5,"z").row(1,3,6,"Z").rect(0,3,10,2,"l"),Ar=new w(17,6,"a").rect(0,4,17,2,"A"),Lr=new w(22,22,"a").where((t,e)=>(t*3+e*5)%11===0,"A"),Or=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(),Mt=["shirt","tee","sweater"],At=["pants","shorts"],Lt=["boots","sneakers"],nn=["short","long","curly","none"],ie=(t,e={})=>({front:t,back:t,left:t,right:t,...e});function Je(t={}){let e=t.top??"shirt",r=t.bottom??"pants",o=t.shoes??"boots",s=t.hair??"short",a=Xe(er,t.colors??{});a={...a,a:t.colors?.hat??"#d9c9a3"},a.A=Z(a.a,.72);let n={head_front:S(tr),head_left:S(vt),head_right:S(rr),head_back:S(or),hair_top:S(nr),hair_band:S(sr),arm_skin:S(pr),...Object.fromEntries(Object.entries(Ct).map(([R,F])=>[R,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[R,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:[R,33.9,F],color:"h",faces:ie("hair_band",{top:"hair_top"})});s==="long"?(n.hair_long=S(Or),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(Ar),n.hat_brim=S(Lr),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:[ar,ir,lr],tee:[gr,yr,xr],sweater:[kr,Er,Rr]},[c,u,b]=l[e];n.top_front=S(c),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(cr),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"?Sr:e==="tee"?wr:hr),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(vr),n.leg_side=S(Cr)):(n.leg_front=S(mr),n.leg_back=S(dr),n.leg_side=S(ur)),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(fr),n.shoe_side=S(br)):(n.shoe_front=S(Tr),n.shoe_side=S(Mr));let E=o==="boots"?4.5:2.5;return i.push({name:"shoe",bone:"legL",size:[4.6,E,5.2],pos:[-2,E/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??A({en:"Traveler",ru:"\u041F\u0443\u0442\u043D\u0438\u043A"}),description:t.description??A({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(Ct).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 qe=Je(),Ye=null;function le(){if(!Ye){let t=q(qe);if(!t.ok)throw new Error(t.error);Ye=t.spec;}return Ye}function Ot(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 ___namespace.CanvasTexture(e),s=new ___namespace.Sprite(new ___namespace.SpriteMaterial({map:o,depthTest:false,transparent:true}));return s.scale.set(1.6,.3,1),s.renderOrder=10,s}function Ze(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},ln=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 Y(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 p(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 cn=["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 pn=["swing","hurt","place","land","jump","throw"];var xe=1/16,Ae=class{group=new ___namespace.Group;root=new ___namespace.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 ___namespace.MeshLambertMaterial({alphaTest:.5}),this.decalMat=new ___namespace.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 ___namespace.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 E=new ___namespace.Mesh(g,this.material);E.castShadow=E.receiveShadow=this.shadows,E.layers.set(this.layer),this.meshes.push(E),i.add(E);}}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 ___namespace.BufferGeometry;n.setAttribute("position",new ___namespace.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 ___namespace.BufferAttribute(i,3)),n.setAttribute("uv",new ___namespace.BufferAttribute(new Float32Array(8),2)),n.setIndex([0,2,1,0,3,2]),this.decal=new ___namespace.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 ___namespace.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&&Ze(this.label),this.label=e?Ot(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&&Ze(this.label),this.label=null,this.material.dispose(),this.decalMat.dispose(),Se(this.asset);}};var Le=new Map,Qe=new Set;function yn(t){let e=me(t);if(!Le.has(e)){Le.set(e,t);for(let r of Qe)r(e);}return e}function xn(t){return typeof t=="string"?Le.get(t):void 0}function wn(t){let e={};for(let r of t){let o=Le.get(r);o&&(e[r]=o);}return e}function kn(t){return Qe.add(t),()=>Qe.delete(t)}var Pr=["#b08a62","#8a6a4a","#c8a878","#9a9a92","#7a5c44"],_r=["#f1c9a5","#e6b892","#d9a982","#c08e68","#a0704c","#7a5238"],Ir=["#6b4a2f","#4a3424","#8a5a3a","#c27a48","#d8b878","#2e2622","#a07850","#9a9690"],zr=["#a7bea9","#e6e0cc","#d9c9a3","#b9a083","#a9b8c4","#c8b4a0","#9fb0a0","#d8d2c4","#b98f74","#8fa3b5"],Fr=["#8c9ca6","#a9b8b4","#8a8e94","#9fb3ad","#7d8a8f","#b0a58f"],Nr=["#d9c9a3","#c8b48a","#a08a6a","#e6e0cc"];function Cn(t,e="",r=""){let o=we(ae("npc:"+t+"|"+e)),s=i=>i[Math.floor(o()*i.length)],a=Je({top:s(Mt),bottom:s(At),shoes:s(Lt),hair:s(["short","short","long","curly"]),hat:o()<.2,colors:{skin:s(_r),hair:s(Ir),shirt:s(zr),pants:s(Fr),boots:s(Pr),hat:s(Nr)}});a.name=t.slice(0,40),a.description=[e,r].filter(Boolean).join(" \u2014 ").slice(0,300),a.style={walk:s(["normal","normal","bouncy","heavy","sneaky"]),idle:s(["calm","calm","fidgety","proud"]),energy:Math.round(o()*10)/10},a.tags=["npc",...e?[e.slice(0,24)]:[]];let n=q(a);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 Hr(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 Br(t,e){let{width:r,height:o,data:s}=t,a=(T,L)=>{let G=(L*r+T)*4;return [s[G],s[G+1],s[G+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((L,G)=>L+G[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 L=0;L<r;L+=2)l(a(L,T))&&(c=Math.min(c,L),u=Math.max(u,L),b=Math.min(b,T),g=Math.max(g,T));u<0&&(c=0,u=r-1,b=0,g=o-1);let E=g-b+1,R=u-c+1,F=c+Math.floor(R*.3),K=c+Math.ceil(R*.7);return e.map(([T,L])=>{let G=[];for(let m=b+Math.floor(E*T);m<b+Math.ceil(E*L);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)&&G.push(y);}return Hr(G)})}var Dr=[[0,.06],[.1,.22],[.3,.52],[.6,.86],[.92,1]];function On(t,e="humanoid",r=Re()){let[o,s,a,n,i]=Br(t,Dr);if(e==="humanoid"){let c=JSON.parse(JSON.stringify(qe));c.palette=Xe(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=q(c);return u.ok?u.spec:le()}let l=q({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 jr={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}},Vr={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,...jr[t.walk],...Vr[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;p(t,"legL","rx",o),p(t,"legR","rx",-o),p(t,"legFL","rx",o),p(t,"legBR","rx",o),p(t,"legFR","rx",-o),p(t,"legBL","rx",-o);}function ot(t,e,r){let o=tt(e)*r;p(t,"armL","rx",-o),p(t,"armR","rx",o);}var Gr=(t,e)=>{let r=Math.sin(e.clock*2)*e.style.breath;p(t,"armL","rz",-0.04-.03*r),p(t,"armR","rz",.04+.03*r),p(t,"head","rx",.03*Math.sin(e.clock*1.7)+e.style.chest),p(t,"body","rx",e.style.chest*-0.5),e.style.fidget&&(p(t,"head","ry",.35*Math.sin(e.clock*.7)*Math.sin(e.clock*.31)),p(t,"root","ry",.05*Math.sin(e.clock*.9))),p(t,"body","sy",1+.04*Math.sin(e.clock*3));},Ur=(t,e)=>{rt(t,e,e.style.amp),ot(t,e,e.style.arm),p(t,"root","py",e.style.bob*Math.abs(Math.cos(e.phase))),p(t,"body","rz",e.style.sway*tt(e));},Wr=(t,e)=>{rt(t,e,e.style.amp*1.3),ot(t,e,e.style.arm*1.6),p(t,"body","rx",-0.18),p(t,"head","rx",.18),p(t,"root","py",(.8+e.style.bob)*Math.abs(Math.cos(e.phase)));},Kr=(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)),p(t,"body","rx",-0.45),p(t,"head","rx",.45),Y(t,"armL","rx",.25),Y(t,"armR","rx",.25),p(t,"root","py",-1.5);},$r=(t,e)=>{p(t,"root","rx",-1.3),p(t,"head","rx",1),p(t,"armL","rx",Math.PI-.5+.5*Math.sin(e.t*3)),p(t,"armR","rx",Math.PI-.5+.5*Math.sin(e.t*3+Math.PI)),p(t,"legL","rx",.3*Math.sin(e.t*8)),p(t,"legR","rx",-0.3*Math.sin(e.t*8));},Yr=(t,e)=>{p(t,"legL","rx",.15),p(t,"legR","rx",.1),p(t,"armL","rz",-0.15),p(t,"armR","rz",.15),p(t,"root","py",.6*Math.sin(e.t*2));},Xr=t=>{p(t,"root","rx",-1.35),p(t,"head","rx",1.1),p(t,"armL","rz",-1.3),p(t,"armR","rz",1.3);},Jr=(t,e)=>{let r=.15*Math.sin(e.t*10);p(t,"armL","rz",-0.6-r),p(t,"armR","rz",.6+r),p(t,"legL","rx",.25),p(t,"legR","rx",-0.25);},qr=t=>{p(t,"legL","rx",1.45),p(t,"legR","rx",1.45),p(t,"legL","ry",.1),p(t,"legR","ry",-0.1),p(t,"root","py",-10),p(t,"body","rx",.4),p(t,"legBL","rx",1.2),p(t,"legBR","rx",1.2);},Zr=t=>{p(t,"legL","rx",1.4),p(t,"legR","rx",1.4),p(t,"legL","rz",-0.3),p(t,"legR","rz",.3),p(t,"armL","rx",.45),p(t,"armR","rx",.45);},Qr=t=>{p(t,"root","rx",Math.PI/2),p(t,"root","py",2);},eo=t=>{p(t,"root","rz",Math.PI/2),p(t,"root","py",2);},to=(t,e)=>{let r=Math.sin(e.phase*.5);p(t,"root","py",6*Math.max(0,r));let o=r<0?.2*-r:0;p(t,"body","sy",1-o+.1*Math.max(0,r)),p(t,"body","sx",1+o*.6),p(t,"body","sz",1+o*.6);},ro=(t,e)=>{let r=Math.sin(Math.PI*e.k);p(t,"armR","rx",1.9*r),p(t,"armR","ry",.3*r),p(t,"body","ry",-0.3*r);},oo=(t,e)=>{let r=Math.sin(Math.PI*e.k);p(t,"armR","rx",.9*r);},no=(t,e)=>{let r=e.k<.4?-1.5*(e.k/.4):-1.5+3.5*((e.k-.4)/.6);p(t,"armR","rx",e.k>.9?r*(1-e.k)*10:r);},so=(t,e)=>{let r=Math.sin(Math.PI*e.k);p(t,"body","rx",.15*r),p(t,"head","rx",.2*r),p(t,"root","rz",.05*r);},ao=(t,e)=>{let r=Math.sin(Math.PI*e.k);p(t,"root","py",-1.5*r),p(t,"legL","rx",.2*r),p(t,"legR","rx",.2*r),p(t,"body","sy",1-.2*r),p(t,"body","sx",1+.12*r),p(t,"body","sz",1+.12*r);},io=(t,e)=>{p(t,"armR","rx",1.3+.1*Math.sin(e.t*16)),p(t,"armR","ry",-0.5),p(t,"head","rx",-0.1+.08*Math.sin(e.t*16));},lo=t=>{p(t,"armR","rx",2),p(t,"armR","ry",-0.4),p(t,"head","rx",.35);},co=t=>{p(t,"armR","rx",1.57),p(t,"armR","ry",-0.1),p(t,"armL","rx",1.57),p(t,"armL","ry",.35);},po=t=>{p(t,"armL","rx",.9),p(t,"armL","ry",-0.6);},Oe={idle:Gr,walk:Ur,run:Wr,sneak:Kr,swim:$r,fly:Yr,glide:Xr,fall:Jr,sit:qr,ride:Zr,sleep:Qr,dead:eo,hop:to,swing:ro,place:oo,throw:no,hurt:so,land:ao,eat:io,drink:lo,draw:co,block:po},_t={blob:{walk:"hop",run:"hop",sneak:"hop"}},It={swing:.3,place:.2,throw:.45,hurt:.3,land:.22};var Pe=Math.PI,_e={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,Pe*.46],[1,Pe*.46]],"legR.rx":[[0,Pe*.46],[1,Pe*.46]],"root.py":[[0,-10],[1,-10]]}}},Fn=Object.keys(_e);function Nn(t){return typeof t=="string"&&t in _e}function ho(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 zt(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&&p(t,i,l,ho(a,o));}}var Ie=["neutral","happy","sad","angry","surprised","scared","tired","hurt"];function mo(t){return typeof t=="string"&&Ie.includes(t)}var Ft={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 Nt(t,e,r){if(!(r<=0))for(let[o,s]of Object.entries(nt[e].add)){let a=o.lastIndexOf(".");Y(t,o.slice(0,a),o.slice(a+1),(s??0)*r);}}var Vn={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 Gn(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 uo=[{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}],fo=new Set(["hurt","land"]),bo={eat:"eat",drink:"drink",draw:"draw",block:"block"},go={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)]]},ze=t=>{let e=Math.max(0,Math.min(1,t));return e*e*(3-2*e)},Fe=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:_e[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:It[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=uo.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(Oe[n](this.loco,i),ce(this.pose),this.blendT<this.blendDur?(this.blendT+=e,Pt(this.pose,this.from,this.loco,ze(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?ze(c.t/.15):ze(Math.min(c.t/.15,(c.def.duration-c.t)/.15));ce(this.tmp),zt(this.tmp,c.def,c.t),this.overlay(this.tmp,g,false);}}let l=r.use?bo[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),Oe[this.useClip](this.tmp,{...i,t:this.clock}),this.overlay(this.tmp,ze(this.useW),false)):r.held!=="none"&&!this.emote&&Y(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),Oe[c.clip](this.tmp,{...i,t:c.t,k:u}),this.overlay(this.tmp,1,fo.has(c.clip));}this.actions=this.actions.filter(c=>c.t<c.dur),this.state!=="dead"&&this.state!=="sleep"&&(Y(this.pose,"head","ry",Math.max(-1.1,Math.min(1.1,r.lookYaw))),Y(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 Ie){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"&&Nt(this.pose,c,b);}for(let[c,u]of Object.entries(go))for(let[b,g]of u(r,this.clock)){let E=c+"."+b,R=this.springs.get(E);R||this.springs.set(E,R={x:g,v:0});let F=60,K=9;R.v+=(F*(g-R.x)-K*R.v)*e,R.x+=R.v*e,Y(this.pose,c,b,R.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(Ft[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 yo={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"}},xo={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=yo[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(xo[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 Fe(e.rig,e.style,this.view.expressions);return r.setRandom(we(this.seed)),r}};var wo=be.map(t=>{let e=J[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
|
+
`),os=`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
|
+
${wo}
|
|
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": ${Ve.map(t=>`"${t}"`).join(" | ")}, "idle": ${Ge.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 is=["cat","dog","fox","bear","rabbit","bird","dragon","slime","ghost","robot"],ko=t=>({k:"#2a1c14",w:"#f4f4ef",b:t,m:"#7a3a30",o:"#3a1a14"});function Eo(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,...ko(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,E,R={})=>s.push({name:c,bone:u,size:b,pos:g,color:E,...R});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 ls(t){let e=q(Eo(t));if(!e.ok)throw new Error(`${t.kind}: ${e.error}`);return e.spec}exports.ACTION_TIME=It;exports.ANIM_EVENTS=pn;exports.Animator=Fe;exports.Art=w;exports.BONE_ROLES=Oo;exports.CH=v;exports.CHANNELS=ln;exports.CHARACTER_LIMITS=yt;exports.CHARACTER_SPEC_VERSION=ut;exports.CLEAR=ye;exports.CLIPS=Oe;exports.CREATURE_KINDS=is;exports.CharacterView=Ae;exports.DEFAULT_CHARACTER_SOURCE=qe;exports.DEFAULT_COLORS=Wt;exports.DEFAULT_FINISH=he;exports.EMOTES=_e;exports.EMOTE_IDS=Fn;exports.EMOTIONS=Ie;exports.EMOTION_EVENTS=Vn;exports.EXPRESSIONS=je;exports.EXPRESSION_CHAIN=Ft;exports.EXTRA_BONE_ROLES=ke;exports.FACE_NAMES=De;exports.HELD_KINDS=cn;exports.HUMAN_BOTTOMS=At;exports.HUMAN_HAIR=nn;exports.HUMAN_SHOES=Lt;exports.HUMAN_TOPS=Mt;exports.IDLE_STYLES=Ge;exports.LOCOMOTION=uo;exports.POSTURE=nt;exports.REST=ue;exports.RIGS=J;exports.RIG_CLIPS=_t;exports.RIG_IDS=be;exports.SOCKETS=Po;exports.VOXEL_CHARACTER_SYSTEM_PROMPT=os;exports.VoxelActor=Ht;exports.WALK_STYLES=Ve;exports.acquireCharacter=$e;exports.add=Y;exports.applyPosture=Nt;exports.bandColors=Br;exports.bone=fe;exports.bonesOf=wt;exports.characterFromImage=On;exports.characterOf=xn;exports.characterSpecs=wn;exports.clearPose=ce;exports.copyPose=Te;exports.creatureCharacter=ls;exports.creatureSource=Eo;exports.defaultCharacter=le;exports.defaultCharacterName=Re;exports.disposeNameplate=Ze;exports.emotionFromText=Gn;exports.humanSource=Je;exports.isDefaultCharacterName=Wo;exports.isEmote=Nn;exports.isEmotion=mo;exports.isObj=j;exports.layoutCharacter=St;exports.lerpPose=Pt;exports.mirrorBone=xt;exports.nameplate=Ot;exports.newAnimInput=Me;exports.normColor=bt;exports.npcCharacter=Cn;exports.num=W;exports.onCharacterKnown=kn;exports.parseCharacterSpec=q;exports.pick=He;exports.recolor=Xe;exports.registerCharacter=yn;exports.releaseCharacter=Se;exports.rigOfSpec=Uo;exports.sampleEmote=zt;exports.sampleTrack=ho;exports.setCh=p;exports.specHash=me;exports.stableStringify=Be;exports.standardFace=Ce;exports.styleParams=et;exports.vec3=Ee;
|