@idosgames/characters 0.3.0 → 0.3.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.
@@ -1,11 +1,11 @@
1
- import {c,d}from'../chunk-YOAPVGXE.js';import {b,a}from'../chunk-CGF2TQVK.js';import {i,b as b$1,d as d$1}from'../chunk-MNDPJKUD.js';export{b as EMOTIONS,c as isEmotion}from'../chunk-MNDPJKUD.js';import*as B from'three';import {mergeGeometries}from'three/examples/jsm/utils/BufferGeometryUtils.js';import {RoomEnvironment}from'three/examples/jsm/environments/RoomEnvironment.js';var Ia={id:"avatar",label:"\u0410\u0432\u0430\u0442\u0430\u0440",hint:"the iDos Games account avatar: soft blocks with elbows and knees",bones:[{name:"body",role:"body",parent:null,pivot:[0,12.4,0]},{name:"head",role:"head",parent:"body",pivot:[0,22.4,0]},{name:"armL",role:"armL",parent:"body",pivot:[-6.3,21.4,0]},{name:"armR",role:"armR",parent:"body",pivot:[6.3,21.4,0]},{name:"foreArmL",role:"foreArmL",parent:"armL",pivot:[-6.3,17.2,0]},{name:"foreArmR",role:"foreArmR",parent:"armR",pivot:[6.3,17.2,0]},{name:"legL",role:"legL",parent:null,pivot:[-2.1,12.4,0]},{name:"legR",role:"legR",parent:null,pivot:[2.1,12.4,0]},{name:"shinL",role:"shinL",parent:"legL",pivot:[-2.1,6.4,0]},{name:"shinR",role:"shinR",parent:"legR",pivot:[2.1,6.4,0]}],sockets:[{name:"handR",bone:"foreArmR",at:[6.3,11.6,-1]},{name:"handL",bone:"foreArmL",at:[-6.3,11.6,-1]},{name:"headTop",bone:"head",at:[0,30.3,0]},{name:"face",bone:"head",at:[0,26.7,-4]},{name:"back",bone:"body",at:[0,18.5,2.3]},{name:"waist",bone:"body",at:[0,12.8,0]},{name:"shoulders",bone:"body",at:[0,22.4,0]}],hitbox:{w:.6,h:1.9},eye:26.4,height:{min:24,max:40},faceBone:"head",ik:{feet:[{upper:"legL",lower:"shinL",end:"sole",bend:[-2.6,0]},{upper:"legR",lower:"shinR",end:"sole",bend:[-2.6,0]}],hands:{handR:{upper:"armR",lower:"foreArmR",end:"handR",bend:[0,2.6]},handL:{upper:"armL",lower:"foreArmL",end:"handL",bend:[0,2.6]}},look:{head:"head",body:"body",headYaw:1.1,headPitch:.75,bodyYaw:.5}},ragdoll:{torso:"body",joints:[{bone:"head",parent:"body",kind:"ball",swing:.7,twist:.9,up:true},{bone:"armL",parent:"body",kind:"ball",swing:2.2,twist:1.2,tilt:.5},{bone:"armR",parent:"body",kind:"ball",swing:2.2,twist:1.2,tilt:.5},{bone:"foreArmL",parent:"armL",kind:"hinge",bend:[0,2.5]},{bone:"foreArmR",parent:"armR",kind:"hinge",bend:[0,2.5]},{bone:"legL",parent:"body",kind:"ball",swing:1.1,twist:.6,tilt:.6},{bone:"legR",parent:"body",kind:"ball",swing:1.1,twist:.6,tilt:.6},{bone:"shinL",parent:"legL",kind:"hinge",bend:[-2.5,0]},{bone:"shinR",parent:"legR",kind:"hinge",bend:[-2.5,0]}],stand:["legL","legR","shinL","shinR"]},defaultParts:[{bone:"head",size:[8.5,7.5,8],pos:[0,26.5,0],color:"s",name:"head"},{bone:"head",size:[2.9,.8,2.7],pos:[0,22.6,0],color:"s",name:"neck"},{bone:"body",size:[9,6,4.6],pos:[0,19.4,0],color:"t",name:"torso"},{bone:"body",size:[8.5,5.2,4.3],pos:[0,15,0],color:"t",name:"torso"},{bone:"armL",size:[3.6,5,3.6],pos:[-6.3,19.7,0],color:"s",name:"sleeveL"},{bone:"armR",size:[3.6,5,3.6],pos:[6.3,19.7,0],color:"s",name:"sleeveR"},{bone:"foreArmL",size:[3.45,5.4,3.45],pos:[-6.3,15.7,0],color:"s",name:"forearmL"},{bone:"foreArmR",size:[3.45,5.4,3.45],pos:[6.3,15.7,0],color:"s",name:"forearmR"},{bone:"foreArmL",size:[3.3,3,3.3],pos:[-6.3,12.7,0],color:"s",name:"handL"},{bone:"foreArmR",size:[3.3,3,3.3],pos:[6.3,12.7,0],color:"s",name:"handR"},{bone:"legL",size:[4.2,6,4.2],pos:[-2.1,9.4,0],color:"p",name:"legL"},{bone:"legR",size:[4.2,6,4.2],pos:[2.1,9.4,0],color:"p",name:"legR"},{bone:"shinL",size:[4.05,7.2,4.05],pos:[-2.1,4,0],color:"p",name:"legL"},{bone:"shinR",size:[4.05,7.2,4.05],pos:[2.1,4,0],color:"p",name:"legR"},{bone:"shinL",size:[4.2,1.6,5.2],pos:[-2.1,.8,-0.5],color:"p",name:"footL"},{bone:"shinR",size:[4.2,1.6,5.2],pos:[2.1,.8,-0.5],color:"p",name:"footR"}]};var _a={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 Oa={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",ik:{feet:[{upper:"legL",end:"sole"},{upper:"legR",end:"sole"}],look:{head:"head",headYaw:1.2,headPitch:.6,bodyYaw:0}},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 Va={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",ik:{feet:[{upper:"legL",end:"sole"},{upper:"legR",end:"sole"}],hands:{handR:{upper:"armR",end:"handR"},handL:{upper:"armL",end:"handL"}},look:{head:"head",body:"body",headYaw:1.1,headPitch:.75,bodyYaw:.5}},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 Fa={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",ik:{feet:[{upper:"legFL",end:"sole"},{upper:"legFR",end:"sole"},{upper:"legBL",end:"sole"},{upper:"legBR",end:"sole"}],tilt:{front:["legFL","legFR"],back:["legBL","legBR"],max:.45},look:{head:"head",headYaw:.9,headPitch:.6,bodyYaw:0}},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 Da={id:"swimmer",label:"\u041F\u043B\u043E\u0432\u0435\u0446",hint:"fish, sharks, dolphins, whales \u2014 creatures that swim with a tail",bones:[{name:"body",role:"body",parent:null,pivot:[0,6,0]},{name:"head",role:"head",parent:"body",pivot:[0,6,-4]},{name:"tail",role:"tail",parent:"body",pivot:[0,6,4]},{name:"finL",role:"ear",parent:"body",pivot:[-3,5,-1]},{name:"finR",role:"ear",parent:"body",pivot:[3,5,-1]}],sockets:[{name:"headTop",bone:"head",at:[0,10,-6]},{name:"face",bone:"head",at:[0,7,-9]},{name:"back",bone:"body",at:[0,10,0]},{name:"waist",bone:"body",at:[0,6,0]},{name:"shoulders",bone:"body",at:[0,9,-3]},{name:"handR",bone:"head",at:[1,4,-9]},{name:"handL",bone:"head",at:[-1,4,-9]}],hitbox:{w:.7,h:.6},eye:8,height:{min:4,max:40},faceBone:"head",ik:{look:{head:"head",headYaw:.4,headPitch:.3,bodyYaw:0}},defaultParts:[{bone:"body",size:[5,7,9],pos:[0,6,0],color:"t"},{bone:"head",size:[5,6,4],pos:[0,6,-6.5],color:"s"},{bone:"tail",size:[1,6,4],pos:[0,6,7],color:"t"},{bone:"finL",size:[3,.6,2],pos:[-4,5,-1],color:"p"},{bone:"finR",size:[3,.6,2],pos:[4,5,-1],color:"p"}]};var Hc=["root","body","head","armL","armR","legL","legR","foreArmL","foreArmR","shinL","shinR","legFL","legFR","legBL","legBR","tail","wingL","wingR","ear","hair","cape","antenna","static"],Zr=["tail","wingL","wingR","ear","hair","cape","antenna","static"],jc=["handR","handL","headTop","face","back","waist","shoulders"],gr=["humanoid","quadruped","flyer","blob","swimmer"],Qt="avatar";var Ae={humanoid:Va,quadruped:Fa,flyer:Oa,blob:_a,swimmer:Da,avatar:Ia};var Ba=1,dt=["front","back","left","right","top","bottom"],wr=["neutral","blink","happy","sad","angry","surprised","scared","tired","hurt","talk"],Rr=["normal","bouncy","heavy","sneaky","robotic","swagger","skip","ninja","zombie","catwalk"],kr=["calm","fidgety","proud","cool","shy","ready","bored"],ja={parts:96,bones:16,palette:32,textures:48,texturePixels:32768,textureSide:32,partSide:32,coord:64},er=["glass","metal","glow"],r1=["cylinder"],Zt={noise:.5,outline:.4,shade:.25,density:2},X=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),xr=e=>Array.isArray(e)?e:[];function Ie(e,t,r,o){let a=typeof e=="number"?e:typeof e=="string"?Number(e):NaN;return Number.isFinite(a)?Math.min(o,Math.max(r,a)):t}function Po(e,t,r){if(typeof e!="string")return r;let o=e.trim();if(t.includes(o))return o;let a=o.toLowerCase().replace(/[\s-]+/g,"_");return t.find(s=>s.toLowerCase()===a)??r}function Ke(e,t,r){return typeof e=="string"?e.trim().slice(0,r):t}function eo(e,t,r=null){if(!Array.isArray(e)||e.length<3)return r;let o=e.slice(0,3).map(a=>Ie(a,NaN,-t,t));return o.every(Number.isFinite)?o:r}var Na={black:"#1d1d21",white:"#f0f0f0",gray:"#808080",grey:"#808080",red:"#c0392b",green:"#3c9a3c",blue:"#2f5fd0",yellow:"#f2d33c",orange:"#e8862a",purple:"#8a4fc4",pink:"#f08cb4",brown:"#7a4f2a",cyan:"#2ab0c0",gold:"#d8b030",silver:"#c0c4c8",skin:"#c69c7c"};function ot(e){if(typeof e!="string")return null;let t=e.trim().toLowerCase();if(Na[t])return Na[t];let r=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/.exec(t);if(!r)return null;let o=r[1];return "#"+(o.length===3?o.split("").map(a=>a+a).join(""):o)}var ut=new Set(["."," "]),Ha=e=>/^[A-Za-z0-9_]{1,24}$/.test(e),Vs={human:"humanoid",biped:"humanoid",person:"humanoid",animal:"quadruped",four_legs:"quadruped",quadrupedal:"quadruped",bird:"flyer",winged:"flyer",dragon:"flyer",slime:"blob",ghost:"blob",fish:"swimmer",shark:"swimmer",aquatic:"swimmer"};function Fs(e){if(typeof e!="string")return "humanoid";let t=e.trim().toLowerCase().replace(/[\s-]+/g,"_");return gr.includes(t)?t:t===Qt?Qt:Vs[t]??"humanoid"}function Ga(e,t){let r=/^(.*?)(L|R)$/.exec(e);if(!r)return e;let o=r[1]+(r[2]==="L"?"R":"L");return t(o)?o:e}function Ye(e){if(typeof e=="string"){let f=d(e);if(!f.ok)return {ok:false,error:f.error,truncated:f.truncated};e=f.value;}if(!X(e))return {ok:false,error:c({en:"the character recipe is not an object",ru:"\u0440\u0435\u0446\u0435\u043F\u0442 \u043F\u0435\u0440\u0441\u043E\u043D\u0430\u0436\u0430 \u2014 \u043D\u0435 \u043E\u0431\u044A\u0435\u043A\u0442"})};if(!("parts"in e)&&!("rig"in e)){let f=e.character??e.spec??e.characterSpec;X(f)&&(e=f);}let t=e,r=ja,o=[];typeof t.version=="number"&&t.version>Ba&&o.push(c({en:"recipe version {v} is newer than the game \u2014 read what could be read",ru:"\u0440\u0435\u0446\u0435\u043F\u0442 \u0432\u0435\u0440\u0441\u0438\u0438 {v} \u2014 \u043D\u043E\u0432\u0435\u0435 \u0438\u0433\u0440\u044B, \u0440\u0430\u0437\u043E\u0431\u0440\u0430\u043D\u043E \u0447\u0442\u043E \u043F\u043E\u043D\u044F\u0442\u043D\u043E"},{v:t.version}));let a=Fs(t.rig),n=Ae[a],s={};if(X(t.palette))for(let[f,S]of Object.entries(t.palette)){if(Object.keys(s).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 T=ot(S);if(f.length!==1||ut.has(f)||!T){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:f}));continue}s[f]=T;}let l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",i=(f,S)=>{if(typeof f!="string")return S;if(f.length===1&&s[f])return f;let T=ot(f);if(!T)return S;let C=Object.entries(s).find(([,_])=>_===T);if(C)return C[0];if(Object.keys(s).length>=r.palette)return S;let z=[...l].find(_=>!s[_]);return z?(s[z]=T,z):S},c$1={},p=0;if(X(t.textures))for(let[f,S]of Object.entries(t.textures)){if(!Ha(f)){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:f.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 T=Ns(S,s,o,f);if(T){if(p+T.w*T.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:f}));continue}p+=T.w*T.h,c$1[f]=T;}}let h=new Set(n.bones.map(f=>f.name)),m=[];for(let f of xr(t.bones)){if(!X(f))continue;let S=Ke(f.name,"",24);if(!S||!Ha(S))continue;let T=eo(f.pivot,r.coord);if(!T||m.some(M=>M.name===S))continue;if(m.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 C=h.has(S),z=Ke(f.parent,"",24),_=C?n.bones.find(M=>M.name===S).parent??"":h.has(z)||m.some(M=>M.name===z)?z:n.bones.find(M=>M.role==="body").name;m.push({name:S,parent:_,pivot:T,role:C?"static":Po(f.role,Zr,"static")}),h.add(S);}let d$1=Object.keys(s)[0]??"s",b=[];for(let f of xr(t.parts)){if(b.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(!X(f))continue;let S=eo(f.size,r.partSide),T=eo(f.pos??f.center??f.at,r.coord);if(!S||!T||S.some(V=>V<=0))continue;let C=Ke(f.bone,"",24);h.has(C)||(C&&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:C})),C=n.bones.find(V=>V.role==="body").name);let z={bone:C,size:S,pos:T,color:i(f.color,d$1)};if(X(f.faces)){let V={};for(let q of dt){let Y=f.faces[q];if(typeof Y=="string")if(c$1[Y])V[q]=Y;else {let ce=i(Y,"");ce&&(V[q]=ce);}}Object.keys(V).length&&(z.faces=V);}let _=eo(f.rot??f.rotation,180);_&&_.some(V=>V!==0)&&(z.rot=_),(f.mirror===true||f.mirror==="x")&&(z.mirror=true);let M=Ke(f.name,"",24);M&&(z.name=M),f.shape==="cylinder"&&(z.shape="cylinder"),typeof f.mat=="string"&&er.includes(f.mat)&&(z.mat=f.mat),f.wrap===true&&(z.wrap=true),b.push(z);}if(!b.length){for(let[f,S]of Object.entries(Ds))s[f]||(s[f]=S);b.push(...n.defaultParts.map(Bs));}let u=null;if(X(t.face)){let f=t.face,S=h.has(Ke(f.bone,"",24))?Ke(f.bone,"",24):n.faceBone,T=xr(f.rect).map(z=>Math.round(Ie(z,NaN,0,r.partSide)*10)/10),C={};if(X(f.expressions))for(let z of wr){let _=f.expressions[z];typeof _=="string"&&c$1[_]&&(C[z]=_);}if(!C.neutral){let z=Object.values(C)[0];z&&(C.neutral=z);}if(C.neutral){let z=c$1[C.neutral];if(u={bone:S,rect:T.length===4&&T.every(Number.isFinite)&&T[2]>0&&T[3]>0?T:[0,0,z.w,z.h],expressions:C},X(f.drawn)){let _=f.drawn;u.drawn={eyes:Ke(_.eyes,"round",16),brows:Ke(_.brows,"none",16),mouth:Ke(_.mouth,"smile",16),eyeColor:ot(_.eyeColor)??"#3b2a20",cheeks:_.cheeks===true};}}else Object.keys(f).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 R=X(t.style)?t.style:{},w=X(t.voice)?t.voice:{},A=X(t.finish)?t.finish:{},k={version:Ba,name:Ke(t.name,to(),40)||to(),description:Ke(t.description,"",300),rig:a,scale:Ie(t.scale,1,.25,3),palette:s,textures:c$1,parts:b,bones:m,face:u,style:{walk:Po(R.walk,Rr,"normal"),idle:Po(R.idle,kr,"calm"),energy:Ie(R.energy,.5,0,1)},voice:{pitch:Ie(w.pitch,1,.5,2)},tags:xr(t.tags).filter(f=>typeof f=="string"&&!!f.trim()).slice(0,8).map(f=>f.trim().slice(0,24)),finish:{noise:Ie(A.noise,Zt.noise,0,1),outline:Ie(A.outline,Zt.outline,0,1),shade:Ie(A.shade,Zt.shade,0,1),density:Math.round(Ie(A.density,Zt.density,1,4))}},x=Ie(A.round,0,0,1);return x>0&&(k.finish.round=x),{ok:true,spec:k,warnings:o}}var Ds={s:"#c69c7c",t:"#3a8fd6",p:"#2c3e6b"};function Bs(e){return JSON.parse(JSON.stringify(e))}function Ns(e,t,r,o){let a=Array.isArray(e)?{rows:e}:X(e)?e:null;if(!a)return null;let n=ja.textureSide,s=xr(a.rows??a.pixels).filter(p=>typeof p=="string");if(!s.length)return null;let l=Math.round(Ie(a.h??a.height,s.length,1,n)),i=Math.round(Ie(a.w??a.width,Math.max(...s.map(p=>p.length)),1,n)),c$1=false;for(s=s.slice(0,l).map(p=>{let h="";for(let m=0;m<i;m++){let d=p[m]??".";ut.has(d)||t[d]?h+=d===" "?".":d:(c$1=true,h+=".");}return h});s.length<l;)s.push(".".repeat(i));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:i,h:l,rows:s}}function zo(e){return Array.isArray(e)?"["+e.map(zo).join(",")+"]":X(e)?"{"+Object.keys(e).filter(t=>e[t]!==void 0).sort().map(t=>JSON.stringify(t)+":"+zo(e[t])).join(",")+"}":JSON.stringify(e)}function tr(e){let t=zo(e),r=b(t),o=b("~"+t);return r.toString(16).padStart(8,"0")+o.toString(16).padStart(8,"0")}function o1(e){return Ae[e.rig]}function qa(e){let r=Ae[e.rig].bones.map(o=>{let a=e.bones.find(n=>n.name===o.name);return {name:o.name,role:o.role,parent:o.parent,pivot:(a?.pivot??o.pivot).slice()}});for(let o of e.bones)r.some(a=>a.name===o.name)||r.push({name:o.name,role:o.role,parent:o.parent,pivot:o.pivot.slice()});return r}function to(){return c({en:"Character",ru:"\u041F\u0435\u0440\u0441\u043E\u043D\u0430\u0436"})}var a1=e=>e==="\u041F\u0435\u0440\u0441\u043E\u043D\u0430\u0436"||e==="Character";var Ua={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 Io(e){let t=parseInt(e.slice(1),16);return [t>>16&255,t>>8&255,t&255]}function Ka(e,t,r,o,a,n){let s=((r-1-a)*t+o)*4;e[s]=n[0],e[s+1]=n[1],e[s+2]=n[2],e[s+3]=255;}function Hs(e,t=0){e.sort((r,o)=>o.h-r.h||o.w-r.w||(r.key<o.key?-1:1));for(let r=16;;r*=2){let o=0,a=0,n=0;for(let l of e)o+l.w+t*2>r&&(o=0,a+=n,n=0),l.x=o+t,l.y=a+t,o+=l.w+t*2,n=Math.max(n,l.h+t*2);let s=a+n;if(s<=r||r>=1024){let l=16;for(;l<s;)l*=2;return {w:r,h:l}}}}function js(e,t,r,o,a){let n=(s,l)=>((r-1-o.y-l)*t+o.x+s)*4;for(let s=-a;s<o.h+a;s++)for(let l=-a;l<o.w+a;l++){let i=Math.max(0,Math.min(o.w-1,l)),c=Math.max(0,Math.min(o.h-1,s));if(i===l&&c===s)continue;let p=n(i,c);e.copyWithin(n(l,s),p,p+4);}}function Ya(e,t,r){let o=Math.imul(t,374761393)+Math.imul(r,668265263)+Math.imul(e,2246822519);return o=Math.imul(o^o>>>13,1274126177),((o^o>>>16)>>>0)/4294967296}function Gs(e,t,r,o,a,n,s,l){let c=1+(.55*Ya(s,t,r)+.45*Ya(s^1540483477,Math.floor(t/3),Math.floor(r/3))-.5)*2*l.noise*.14;return n==="s"?c+=l.shade*.16*(.5-(r+.5)/a):n==="t"?c+=l.shade*.08:c-=l.shade*.2,o>=3&&a>=3&&(t===0||r===0||t===o-1||r===a-1)&&(c*=1-.5*l.outline),[Math.max(0,Math.min(255,e[0]*c)),Math.max(0,Math.min(255,e[1]*c)),Math.max(0,Math.min(255,e[2]*c))]}var rr=Math.PI/180;function or(e,t){if(!t)return e;let[r,o,a]=e,[n,s,l]=[t[0]*rr,t[1]*rr,t[2]*rr],i=Math.cos(l),c=Math.sin(l);return [r,o]=[r*i-o*c,r*c+o*i],i=Math.cos(s),c=Math.sin(s),[r,a]=[r*i+a*c,-r*c+a*i],i=Math.cos(n),c=Math.sin(n),[o,a]=[o*i-a*c,o*c+a*i],[r,o,a]}function qs(e,t){let r=[];for(let o of e.parts){if(r.push({...o,flip:false}),!o.mirror)continue;let a=o.faces?{...o.faces,left:o.faces.right,right:o.faces.left}:void 0;a&&(a.left===void 0&&delete a.left,a.right===void 0&&delete a.right);let n={...o,bone:Ga(o.bone,t),pos:[-o.pos[0],o.pos[1],o.pos[2]],flip:true};a?n.faces=a:delete n.faces,o.rot&&(n.rot=[o.rot[0],-o.rot[1],-o.rot[2]]),r.push(n);}return r}function Xa(e){let t=Ae[e.rig],r=qa(e),o=v=>r.some(O=>O.name===v),a=qs(e,o),n=e.finish??Zt,s=n.round??0,l=new Map,i=(v,O)=>{let F=v.faces?.[O],H=F!==void 0?e.textures[F]:void 0,me=F!==void 0&&e.palette[F]?F:v.color,[Ce,Ne]=O==="front"||O==="back"?[v.size[0],v.size[1]]:O==="left"||O==="right"?[v.size[2],v.size[1]]:[v.size[0],v.size[2]],Pe=(br,qe)=>Math.max(1,Math.min(64,qe*Math.max(1,Math.round(br*n.density/qe)))),ve=H?Pe(Ce,H.w):Pe(Ce,1),ze=H?Pe(Ne,H.h):Pe(Ne,1),Fe=O==="top"?"t":O==="bottom"?"b":"s",re=(H?"t:"+F:"c:"+me)+"|"+ve+"x"+ze+Fe,fe=l.get(re);if(fe)return fe;let $=b(re),Pt=H?null:Io(e.palette[me]??"#ff00ff");return fe={key:re,w:ve,h:ze,x:0,y:0,paint:(br,qe,Wr,$r,Xr)=>{for(let ct=0;ct<ze;ct++)for(let pt=0;pt<ve;pt++){let yr=Pt;if(H){let Jr=H.rows[Math.floor(ct*H.h/ze)][Math.floor(pt*H.w/ve)];if(ut.has(Jr))continue;let Ue=e.palette[Jr];if(!Ue)continue;yr=Io(Ue);}Ka(br,qe,Wr,$r+pt,Xr+ct,Gs(yr,pt,ct,ve,ze,Fe,$,n));}}},l.set(re,fe),fe},c=(v,O)=>{let F="e:"+v,H=l.get(F);return H||(H={key:F,w:O.w,h:O.h,x:0,y:0,paint:(me,Ce,Ne,Pe,ve)=>{for(let ze=0;ze<O.h;ze++)for(let Fe=0;Fe<O.w;Fe++){let re=O.rows[ze][Fe];if(ut.has(re))continue;let fe=e.palette[re];fe&&Ka(me,Ce,Ne,Pe+Fe,ve+ze,Io(fe));}}},l.set(F,H)),H},p=a.map(v=>({p:v,faces:dt.map(O=>({f:O,cell:i(v,O)}))})),h=e.face,m=[];if(h)for(let[v,O]of Object.entries(h.expressions)){let F=e.textures[O];F&&m.push([v,c(O,F)]);}let d=s>0?2:0,{w:b$1,h:u}=Hs([...l.values()],d),R=new Uint8Array(b$1*u*4);for(let v of l.values())v.paint(R,b$1,u,v.x,v.y),d&&js(R,b$1,u,v,d);let w=.01,A=(v,O=w)=>[(v.x+O)/b$1,1-(v.y+O)/u,(v.x+v.w-O)/b$1,1-(v.y+v.h-O)/u],k=new Map;for(let v of r)k.set(v.name,{pos:[],nrm:[],uv:[],idx:[]});let x=new Map,f=v=>{let O=x.get(v);if(O===void 0){O=true;for(let F=0;F<v.h&&O;F++)for(let H=0;H<v.w;H++)if(R[((u-1-v.y-F)*b$1+v.x+H)*4+3]<128){O=false;break}x.set(v,O);}return O},S=new Map;for(let{p:v}of p)v.shape==="cylinder"&&!S.has(v.bone)&&S.set(v.bone,v);let T=v=>!!v.wrap&&S.has(v.bone),C=new Map;for(let{p:v,faces:O}of p)if(v.shape!=="cylinder"&&v.mat!=="glass"&&O.every(({cell:F})=>f(F))){let F=C.get(v.bone)??[];F.push(v),C.set(v.bone,F);}let z=new Map,_=v=>{if(!v.mat)return k.get(v.bone);let O=v.mat+"|"+v.bone,F=z.get(O);return F||z.set(O,F={bone:v.bone,mat:v.mat,pos:[],nrm:[],uv:[],idx:[]}),F},M=0;for(let{p:v,faces:O}of p){let F=_(v),H=r.find(re=>re.name===v.bone).pivot,me=[v.size[0]/2,v.size[1]/2,v.size[2]/2];if(M=Math.max(M,v.pos[1]+me[1]),v.shape==="cylinder"){for(let{f:re,cell:fe}of O)Zs(F,v,me,Ua[re],H,A(fe,.5));continue}let Ce=T(v),Ne=Ce?S.get(v.bone):void 0,Pe=(C.get(v.bone)??[]).filter(re=>re!==v&&T(re)===Ce),ve=Math.min(v.size[0],v.size[1],v.size[2])<Qa?0:s,ze=Math.min(v.size[0],v.size[1],v.size[2])>=Ws?Ys:Ks,Fe=(re,fe)=>{let $=Ua[re],Pt=(Ue,mt)=>{let Jt=[me[0]*($.tl[0]+2*($.u[0]*Ue+$.d[0]*mt)),me[1]*($.tl[1]+2*($.u[1]*Ue+$.d[1]*mt)),me[2]*($.tl[2]+2*($.u[2]*Ue+$.d[2]*mt))],ht=or(Jt,v.rot);return [v.pos[0]+ht[0]-H[0],v.pos[1]+ht[1]-H[1],v.pos[2]+ht[2]-H[2]]},br=or($.n,v.rot),qe=F.pos.length/3,[Wr,$r,Xr,ct]=A(fe),[pt,yr]=v.flip?[Xr,Wr]:[Wr,Xr];if(ve>0||Ce){let[Ue,mt,Jt,ht]=A(fe,.5);$s(F,v,me,$,H,ve,ze,v.flip?[Jt,mt,Ue,ht]:[Ue,mt,Jt,ht],Ce);return}let Jr=[[0,0,pt,$r],[1,0,yr,$r],[1,1,yr,ct],[0,1,pt,ct]];for(let[Ue,mt,Jt,ht]of Jr)F.pos.push(...Pt(Ue,mt)),F.nrm.push(...br),F.uv.push(Jt,ht);F.idx.push(qe,qe+2,qe+1,qe,qe+3,qe+2);};for(let{f:re,cell:fe}of O){let $=[F.pos.length,F.nrm.length,F.uv.length,F.idx.length];Fe(re,fe),Pe.length&&mi(F.pos,$[0],H,Pe,s)?(F.pos.length=$[0],F.nrm.length=$[1],F.uv.length=$[2],F.idx.length=$[3]):Ne&&(si(F,$[0],H,Ne,oi(v,me,Ne)),ni(F.pos,$[0],H,Ne)&&(F.pos.length=$[0],F.nrm.length=$[1],F.uv.length=$[2],F.idx.length=$[3]));}}let V=r.map(v=>{let O=k.get(v.name);return {name:v.name,role:v.role,parent:v.parent,pivot:v.pivot,positions:Float32Array.from(O.pos),normals:Float32Array.from(O.nrm),uvs:Float32Array.from(O.uv),indices:Uint16Array.from(O.idx)}}),q=[...z.values()].map(v=>({bone:v.bone,mat:v.mat,positions:Float32Array.from(v.pos),normals:Float32Array.from(v.nrm),uvs:Float32Array.from(v.uv),indices:Uint16Array.from(v.idx)})),Y=null;if(h&&m.length){let v=e.parts.filter(H=>H.bone===h.bone),O=v.find(H=>H.name===h.bone)??v.sort((H,me)=>me.size[0]*me.size[1]*me.size[2]-H.size[0]*H.size[1]*H.size[2])[0],F=r.find(H=>H.name===h.bone);if(O&&F&&O.shape==="cylinder"){let H={};for(let[me,Ce]of m)H[me]=A(Ce);Y=ci(h.bone,O,h.rect,F.pivot,H);}else if(O&&F){let[H,me,Ce,Ne]=h.rect,Pe=O.pos[0]+O.size[0]/2-H,ve=O.pos[1]+O.size[1]/2-me,ze=O.pos[2]-O.size[2]/2-.05,Fe=F.pivot,re=($,Pt)=>[$-Fe[0],Pt-Fe[1],ze-Fe[2]],fe={};for(let[$,Pt]of m)fe[$]=A(Pt);Y={bone:h.bone,corners:Float32Array.from([...re(Pe,ve),...re(Pe-Ce,ve),...re(Pe-Ce,ve-Ne),...re(Pe,ve-Ne)]),uv:fe};}}let ce=t.sockets.filter(v=>o(v.bone)).map(v=>{let O=t.bones.find(F=>F.name===v.bone);return {name:v.name,bone:v.bone,at:[v.at[0]-O.pivot[0],v.at[1]-O.pivot[1],v.at[2]-O.pivot[2]]}}),pe=Math.max(1,M),se=pe>t.height.max?t.height.max/pe:pe<t.height.min?t.height.min/pe:1;return {hash:tr(e),rig:e.rig,bones:V,mats:q,atlas:{w:b$1,h:u,data:R},face:Y,sockets:ce,height:pe,scale:e.scale*se,eye:t.eye*pe/hi(e.rig)}}var Ja=3,Us=2.5,Ks=1,Wa=0,Ys=2,Ws=4.1;function $s(e,t,r,o,a,n,s,l,i=false){let c=Math.min(r[0],r[1],r[2]),p=i?0:Math.min(c,n*Ja),h=Math.min(c,p*Us),m=[r[0]-p,r[1]-p,r[2]-p],d=[r[0]-h,r[1]-h,r[2]-h],b=C=>Math.abs(C[0])*t.size[0]+Math.abs(C[1])*t.size[1]+Math.abs(C[2])*t.size[2],u=C=>{let z=[];for(let M=0;M<=s;M++)z.push(Math.min(.5,p*M/s/C));if(!i)for(let M=1;M<=Wa;M++)z.push(Math.min(.5,(p+(h-p)*M/Wa)/C));if(i){let M=Math.max(1,Math.min(Js,Math.ceil(C/Xs)));for(let V=1;V<M;V++)z.push(Oo(V/M));}let _=[...z,...z.map(M=>1-M)].sort((M,V)=>M-V);return _.filter((M,V)=>V===0||M-_[V-1]>1e-6)},R=u(b(o.u)),w=u(b(o.d)),A=e.pos.length/3,[k,x,f,S]=l;for(let C of w)for(let z of R){let _=[0,0,0],M=[0,0,0],V=[0,0,0];for(let O=0;O<3;O++){let F=r[O]*(o.tl[O]+2*(o.u[O]*z+o.d[O]*C)),H=Math.max(-m[O],Math.min(m[O],F));M[O]=F-H,_[O]=H,V[O]=F-Math.max(-d[O],Math.min(d[O],F));}let q=Math.hypot(M[0],M[1],M[2]),Y=q>1e-9?[M[0]/q,M[1]/q,M[2]/q]:[o.n[0],o.n[1],o.n[2]],ce=Math.hypot(V[0],V[1],V[2]),pe=ce>1e-9?[V[0]/ce,V[1]/ce,V[2]/ce]:Y,se=[_[0]+Y[0]*p,_[1]+Y[1]*p,_[2]+Y[2]*p],v=or(se,t.rot);e.pos.push(t.pos[0]+v[0]-a[0],t.pos[1]+v[1]-a[1],t.pos[2]+v[2]-a[2]),e.nrm.push(...or(pe,t.rot)),e.uv.push(k+(f-k)*z,x+(S-x)*C);}let T=R.length;for(let C=0;C+1<w.length;C++)for(let z=0;z+1<T;z++){let _=A+C*T+z;e.idx.push(_,_+T+1,_+1,_,_+T,_+T+1);}}var Qa=.45,Xs=1.5,Js=5,Qs=10,$a=.6,Oo=e=>(1-$a)*e+$a*(.5+.5*Math.sin(Math.PI*(e-.5))),vr=4,ro=1.12,Za=.35;function en(e,t,r){let o=e*e,a=t*t,n=r*r;return [e*Math.sqrt(Math.max(0,1-a/2-n/2+a*n/3)),t*Math.sqrt(Math.max(0,1-n/2-o/2+n*o/3)),r*Math.sqrt(Math.max(0,1-o/2-a/2+o*a/3))]}function tn(e){let t=vr,r=Math.pow(Math.pow(e[0]*e[0]+e[2]*e[2],t/2)+Math.pow(Math.abs(e[1]),t),1/t)||1;return [e[0]/r,e[1]/r,e[2]/r]}function Vo(e,t){let r=vr,o=Math.pow(e[0]*e[0]+e[2]*e[2],(r-2)/2),a=[e[0]*o,Math.sign(e[1])*Math.pow(Math.abs(e[1]),r-1),e[2]*o],n=[a[0]/t[0],a[1]/t[1],a[2]/t[2]],s=Math.hypot(n[0],n[1],n[2])||1;return [n[0]/s,n[1]/s,n[2]/s]}function Zs(e,t,r,o,a,n){let s=Qs,l=e.pos.length/3,[i,c,p,h]=n;for(let d=0;d<=s;d++)for(let b=0;b<=s;b++){let u=Oo(b/s),R=Oo(d/s),w=[0,0,0];for(let x=0;x<3;x++)w[x]=o.tl[x]+2*(o.u[x]*u+o.d[x]*R);let A=tn(en(w[0],w[1],w[2])),k=or([r[0]*A[0],r[1]*A[1],r[2]*A[2]],t.rot);e.pos.push(t.pos[0]+k[0]-a[0],t.pos[1]+k[1]-a[1],t.pos[2]+k[2]-a[2]),e.nrm.push(...or(Vo(A,r),t.rot)),e.uv.push(i+(p-i)*u,c+(h-c)*R);}let m=s+1;for(let d=0;d<s;d++)for(let b=0;b<s;b++){let u=l+d*m+b;e.idx.push(u,u+m+1,u+1,u,u+m,u+m+1);}}function ei(e,t){let r=[t.size[0]/2,t.size[1]/2,t.size[2]/2],o=[(e[0]-t.pos[0])/r[0],(e[1]-t.pos[1])/r[1],(e[2]-t.pos[2])/r[2]],a=Math.max(Math.abs(o[0]),Math.abs(o[1]),Math.abs(o[2]));if(a<1e-6)return {p:e,w:0,s:[0,1,0]};let n=tn(en(o[0]/a,o[1]/a,o[2]/a)),s=a<=ro?1:Math.max(0,1-(a-ro)/Za),l=s*s*(3-2*s),i=[t.pos[0]+r[0]*n[0]*a,t.pos[1]+r[1]*n[1]*a,t.pos[2]+r[2]*n[2]*a];return {p:[e[0]+(i[0]-e[0])*l,e[1]+(i[1]-e[1])*l,e[2]+(i[2]-e[2])*l],w:l,s:n}}var ti=1.25,ri=.85;function oi(e,t,r){if(e.rot)return false;let o=(e.pos[1]+t[1]-r.pos[1])/(r.size[1]/2),a=Math.max(t[0]/(r.size[0]/2),t[2]/(r.size[2]/2));return o>ti&&a>=ri}function ai(e,t){let r=t.size[0]/2,o=t.size[2]/2,a=(e[0]-t.pos[0])/r,n=(e[2]-t.pos[2])/o,s=Math.max(Math.abs(a),Math.abs(n));if(s<1e-6)return {p:e,w:0,s:[0,1,0]};let l=a/s,i=n/s,c=l*Math.sqrt(Math.max(0,1-i*i/2)),p=i*Math.sqrt(Math.max(0,1-l*l/2)),h=s<=ro?1:Math.max(0,1-(s-ro)/Za),m=h*h*(3-2*h),d=t.pos[0]+r*c*s,b=t.pos[2]+o*p*s;return {p:[e[0]+(d-e[0])*m,e[1],e[2]+(b-e[2])*m],w:m,s:[c,0,p]}}function ni(e,t,r,o){let a=vr;for(let n=t;n<e.length;n+=3){let s=(e[n]+r[0]-o.pos[0])/(o.size[0]/2),l=(e[n+1]+r[1]-o.pos[1])/(o.size[1]/2),i=(e[n+2]+r[2]-o.pos[2])/(o.size[2]/2);if(Math.pow(Math.pow(s*s+i*i,a/2)+Math.pow(Math.abs(l),a),1/a)>.97)return false}return true}function si(e,t,r,o,a=false){let n=[o.size[0]/2,o.size[1]/2,o.size[2]/2];for(let s=t;s<e.pos.length;s+=3){let l=[e.pos[s]+r[0],e.pos[s+1]+r[1],e.pos[s+2]+r[2]],{p:i,w:c,s:p}=a?ai(l,o):ei(l,o);if(e.pos[s]=i[0]-r[0],e.pos[s+1]=i[1]-r[1],e.pos[s+2]=i[2]-r[2],c<=0)continue;let h=[e.nrm[s],e.nrm[s+1],e.nrm[s+2]],m=[l[0]-o.pos[0],l[1]-o.pos[1],l[2]-o.pos[2]],d=Math.hypot(m[0],m[1],m[2])||1;if((h[0]*m[0]+h[1]*m[1]+h[2]*m[2])/d<.3||a&&Math.abs(h[1])>.7)continue;let b=Vo(p,n),u=[h[0]+(b[0]-h[0])*c,h[1]+(b[1]-h[1])*c,h[2]+(b[2]-h[2])*c],R=Math.hypot(u[0],u[1],u[2])||1;e.nrm[s]=u[0]/R,e.nrm[s+1]=u[1]/R,e.nrm[s+2]=u[2]/R;}}var _o=.16,ii=12,li=12;function ci(e,t,r,o,a){let n=[t.size[0]/2,t.size[1]/2,t.size[2]/2],[s,l,i,c]=r,p=t.pos[0]+n[0]-s,h=t.pos[1]+n[1]-l,m=ii,d=li,b=new Float32Array((m+1)*(d+1)*3),u=new Float32Array((m+1)*(d+1)*3),R=new Float32Array((m+1)*(d+1)*2),w=0;for(let k=0;k<=d;k++)for(let x=0;x<=m;x++){let f=x/m,S=k/d,T=p-i*f,C=h-c*S,z=(T-t.pos[0])/n[0],_=(C-t.pos[1])/n[1],M=Math.pow(Math.max(0,1-Math.pow(Math.min(1,Math.abs(_)),vr)),1/vr),V=-Math.sqrt(Math.max(.02,M*M-z*z)),q=Vo([z,_,V],n);b[w*3]=T+q[0]*_o-o[0],b[w*3+1]=C+q[1]*_o-o[1],b[w*3+2]=t.pos[2]+n[2]*V+q[2]*_o-o[2],u.set(q,w*3),R[w*2]=f,R[w*2+1]=S,w++;}let A=(k,x)=>[k-o[0],x-o[1],t.pos[2]-n[2]-o[2]];return {bone:e,corners:Float32Array.from([...A(p,h),...A(p-i,h),...A(p-i,h-c),...A(p,h-c)]),uv:a,grid:{cols:m,rows:d,positions:b,normals:u,t:R}}}function pi(e,t){if(!t)return e;let[r,o,a]=e,[n,s,l]=[-t[0]*rr,-t[1]*rr,-t[2]*rr],i=Math.cos(n),c=Math.sin(n);return [o,a]=[o*i-a*c,o*c+a*i],i=Math.cos(s),c=Math.sin(s),[r,a]=[r*i+a*c,-r*c+a*i],i=Math.cos(l),c=Math.sin(l),[r,o]=[r*i-o*c,r*c+o*i],[r,o,a]}function mi(e,t,r,o,a){for(let s of o){let l=[s.size[0]/2,s.size[1]/2,s.size[2]/2],i=Math.min(s.size[0],s.size[1],s.size[2])<Qa?0:a,c=i>0?Math.min(l[0],l[1],l[2],i*Ja):0,p=true;for(let h=t;h<e.length&&p;h+=3){let m=pi([e[h]+r[0]-s.pos[0],e[h+1]+r[1]-s.pos[1],e[h+2]+r[2]-s.pos[2]],s.rot),d=Math.abs(m[0])-(l[0]-c),b=Math.abs(m[1])-(l[1]-c),u=Math.abs(m[2])-(l[2]-c);Math.hypot(Math.max(d,0),Math.max(b,0),Math.max(u,0))+Math.min(Math.max(d,b,u),0)-c>=-0.01&&(p=false);}if(p)return true}return false}function hi(e){let t=1;for(let r of Ae[e].defaultParts)t=Math.max(t,r.pos[1]+r.size[1]/2);return t}var Fo=new Map;function di(e){let t=new Map;for(let i of e.bones){if(!i.indices.length){t.set(i.name,null);continue}let c=new B.BufferGeometry;c.setAttribute("position",new B.BufferAttribute(i.positions,3)),c.setAttribute("normal",new B.BufferAttribute(i.normals,3)),c.setAttribute("uv",new B.BufferAttribute(i.uvs,2)),c.setIndex(new B.BufferAttribute(i.indices,1)),c.computeBoundingSphere(),c.userData.shared=true,t.set(i.name,c);}let r=rn(e.bones,e),o=new Map;for(let i of new Set(e.mats.map(c=>c.mat))){let c=e.mats.filter(h=>h.mat===i).map(h=>({...h,pivot:e.bones.find(m=>m.name===h.bone).pivot})),p=rn(c,e);p&&o.set(i,p);}let{w:a,h:n,data:s}=e.atlas,l=new B.DataTexture(s,a,n,B.RGBAFormat);return l.magFilter=B.NearestFilter,l.minFilter=B.NearestFilter,l.generateMipmaps=false,l.colorSpace=B.SRGBColorSpace,l.needsUpdate=true,{layout:e,geometries:t,skinned:r,skinnedMats:o,texture:l,refs:0}}function rn(e,t){let r=b=>t.bones.findIndex(u=>u.name===(b.bone??b.name)),o=0,a=0;for(let b of e)o+=b.positions.length/3,a+=b.indices.length;if(!a)return null;let n=new Float32Array(o*3),s=new Float32Array(o*3),l=new Float32Array(o*2),i=new Uint16Array(o*4),c=new Float32Array(o*4),p=o>65535?new Uint32Array(a):new Uint16Array(a),h=0,m=0;e.forEach(b=>{let u=r(b),R=b.positions.length/3;for(let w=0;w<R;w++)n[(h+w)*3]=b.positions[w*3]+b.pivot[0],n[(h+w)*3+1]=b.positions[w*3+1]+b.pivot[1],n[(h+w)*3+2]=b.positions[w*3+2]+b.pivot[2],i[(h+w)*4]=u,c[(h+w)*4]=1;s.set(b.normals,h*3),l.set(b.uvs,h*2);for(let w=0;w<b.indices.length;w++)p[m+w]=b.indices[w]+h;h+=R,m+=b.indices.length;});let d=new B.BufferGeometry;return d.setAttribute("position",new B.BufferAttribute(n,3)),d.setAttribute("normal",new B.BufferAttribute(s,3)),d.setAttribute("uv",new B.BufferAttribute(l,2)),d.setAttribute("skinIndex",new B.Uint16BufferAttribute(i,4)),d.setAttribute("skinWeight",new B.BufferAttribute(c,4)),d.setIndex(new B.BufferAttribute(p,1)),d.computeBoundingSphere(),d.userData.shared=true,d}function Do(e){let t=Fo.get(tr(e));return t||(t=di(Xa(e)),Fo.set(t.layout.hash,t)),t.refs++,t}function oo(e){if(!(--e.refs>0)){Fo.delete(e.layout.hash);for(let t of e.geometries.values())t?.dispose();e.skinned?.dispose();for(let t of e.skinnedMats.values())t.dispose();e.texture.dispose();}}var U=class e{constructor(t,r,o="."){this.w=t;this.h=r;this.g=Array.from({length:r},()=>new Array(t).fill(o));}w;h;g;px(t,r,o){return t>=0&&r>=0&&t<this.w&&r<this.h&&(this.g[r][t]=o),this}rect(t,r,o,a,n){for(let s=r;s<r+a;s++)for(let l=t;l<t+o;l++)this.px(l,s,n);return this}row(t,r,o,a){return this.rect(r,t,o-r+1,1,a)}col(t,r,o,a){return this.rect(t,r,1,o-r+1,a)}where(t,r){for(let o=0;o<this.h;o++)for(let a=0;a<this.w;a++)t(a,o)&&this.px(a,o,r);return this}flipped(){let t=new e(this.w,this.h);for(let r=0;r<this.h;r++)for(let o=0;o<this.w;o++)t.px(this.w-1-o,r,this.g[r][o]);return t}tex(){return {w:this.w,h:this.h,rows:this.g.map(t=>t.join(""))}}};var ui={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 at(e,t){let r=parseInt(e.slice(1),16);return "#"+[r>>16&255,r>>8&255,r&255].map(a=>Math.max(0,Math.min(255,Math.round(a*t)))).map(a=>a.toString(16).padStart(2,"0")).join("")}function No(e,t){let r={...e};return t.skin&&(r.s=t.skin,r.S=at(t.skin,.86),r.m=at(t.skin,.66)),t.hair&&(r.h=t.hair,r.H=at(t.hair,1.25),r.k=at(t.hair,.6)),t.shirt&&(r.t=t.shirt,r.T=at(t.shirt,1.15),r.D=at(t.shirt,.8)),t.pants&&(r.p=t.pants,r.P=at(t.pants,.8)),t.boots&&(r.z=t.boots,r.Z=at(t.boots,.78)),t.eyes&&(r.b=t.eyes),r}var fi=new U(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"),on=new U(16,16,"s").rect(0,0,16,4,"h").rect(7,4,9,7,"h").rect(10,11,6,2,"h").rect(5,7,2,3,"S").row(1,2,13,"H").where((e,t)=>t>4&&t<11&&e>8&&(e+t)%4===0,"k"),bi=on.flipped(),yi=new U(16,16,"h").where((e,t)=>(e+2*t)%5===0,"H").where((e,t)=>t>8&&(e*3+t)%7===0,"k").rect(4,14,8,2,"s"),gi=new U(16,16,"h").where((e,t)=>(e+2*t)%5===0,"H").where((e,t)=>(3*e+t)%9===0,"k"),xi=new U(18,4,"h").where((e,t)=>(e*7+t*3)%5===0,"H").where((e,t)=>t===3&&e*5%3===0,"k"),wi=new U(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"),Ri=new U(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"),ki=new U(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"),vi=new U(16,2,"B").rect(7,0,2,2,"g").px(3,0,"k").px(12,0,"k"),Ai=new U(6,24,"s").row(23,0,5,"S").col(2,21,23,"S"),Ei=new U(8,13,"t").col(0,0,9,"D").row(9,0,7,"D").rect(0,10,8,3,"T").row(12,0,7,"D"),Si=new U(8,24,"p").col(4,1,21,"P").row(0,0,7,"P"),Ti=new U(8,24,"p").col(3,0,21,"P").row(0,0,7,"P"),Mi=new U(8,24,"p").col(3,0,21,"P"),Li=new U(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"),Ci=new U(10,9,"z").row(0,0,9,"Z").rect(0,7,10,2,"Z").col(5,1,6,"Z");function Je(e){let t=new U(16,10,"."),r=(a,n,s)=>{if(e.brows==="flat")t.row(1,a,a+2,"k");else if(e.brows==="high")t.row(0,a,a+2,"k");else {let l=e.brows==="down"?1:0,i=1-l;t.px(n,l,"k").px(a+1,e.brows==="down"?0:1,"k"),t.px(s,i,"k");}};r(3,5,3),r(10,10,12);let o=a=>{if(e.eyes===0){t.row(3,a,a+2,"k");return}let n=e.eyes===3||e.eyes===2?2:3;for(let s=n;s<n+e.eyes;s++)t.px(a,s,"w").px(a+1,s,"b").px(a+2,s,"w");};switch(o(3),o(10),e.mouth){case "line":t.row(7,6,9,"m");break;case "smile":t.px(5,6,"m").px(10,6,"m").row(7,6,9,"m");break;case "frown":t.row(7,6,9,"m").px(5,8,"m").px(10,8,"m");break;case "open":t.rect(6,7,4,2,"o");break;case "small":t.rect(7,7,2,2,"o");break;case "wide":t.row(7,5,10,"m").rect(6,8,4,1,"o");break}return t}var an={f_neutral:Je({brows:"flat",eyes:2,mouth:"line"}),f_blink:Je({brows:"flat",eyes:0,mouth:"line"}),f_happy:Je({brows:"high",eyes:2,mouth:"smile"}),f_sad:Je({brows:"up",eyes:2,mouth:"frown"}),f_angry:Je({brows:"down",eyes:1,mouth:"wide"}),f_surprised:Je({brows:"high",eyes:3,mouth:"small"}),f_scared:Je({brows:"up",eyes:3,mouth:"open"}),f_tired:Je({brows:"flat",eyes:1,mouth:"line"}),f_hurt:Je({brows:"down",eyes:0,mouth:"open"}),f_talk:Je({brows:"flat",eyes:2,mouth:"open"})},Pi=new U(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"),zi=new U(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"),Ii=new U(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"),_i=new U(8,9,"t").row(3,0,7,"D").rect(0,7,8,2,"T"),ao=(e,t)=>e.row(t-1,0,e.w-1,"D").where((r,o)=>o>=t&&o<=t+3&&(r+o)%2===0,"T").row(t+4,0,e.w-1,"D"),Oi=ao(new U(16,24,"t"),6).row(0,6,9,"s").row(0,4,5,"T").row(0,10,11,"T").row(1,4,11,"T").where((e,t)=>t>=18&&t<=19&&e%2===0,"D").where((e,t)=>t>=18&&t<=19&&e%2===1,"T").rect(0,20,16,4,"p"),Vi=ao(new U(16,24,"t"),6).row(0,4,11,"T").where((e,t)=>t>=18&&t<=19,"D").rect(0,20,16,4,"p"),Fi=ao(new U(8,24,"t"),6).where((e,t)=>t>=18&&t<=19,"D").rect(0,20,8,4,"p"),Di=ao(new U(8,22,"t"),9).where((e,t)=>t>=19&&e%2===0,"D"),nn=e=>new U(8,24,"s").rect(0,0,8,12,"p").col(e,1,10,"P").row(11,0,7,"P").row(12,0,7,"S").rect(0,19,8,5,"l"),Bi=nn(4),Ni=nn(3),Hi=new U(9,5,"z").row(1,3,5,"l").rect(0,3,9,2,"l"),ji=new U(10,5,"z").row(1,3,6,"Z").rect(0,3,10,2,"l"),Gi=new U(17,6,"a").rect(0,4,17,2,"A"),qi=new U(22,22,"a").where((e,t)=>(e*3+t*5)%11===0,"A"),Ui=new U(17,20,"h").where((e,t)=>(e*5+t)%4===0,"H").where((e,t)=>t>10&&(e*3+t*2)%7===0,"k"),J=e=>e.tex(),sn=["shirt","tee","sweater"],ln=["pants","shorts"],cn=["boots","sneakers"],y1=["short","long","curly","none"],_t=(e,t={})=>({front:e,back:e,left:e,right:e,...t});function Ho(e={}){let t=e.top??"shirt",r=e.bottom??"pants",o=e.shoes??"boots",a=e.hair??"short",n=No(ui,e.colors??{});n={...n,a:e.colors?.hat??"#d9c9a3"},n.A=at(n.a,.72);let s={head_front:J(fi),head_left:J(on),head_right:J(bi),head_back:J(yi),hair_top:J(gi),hair_band:J(xi),arm_skin:J(Ai),...Object.fromEntries(Object.entries(an).map(([b,u])=>[b,J(u)]))},l=[{name:"head",bone:"head",size:[8,8,8],pos:[0,28,0],color:"s",faces:{front:"head_front",left:"head_left",right:"head_right",back:"head_back",top:"hair_top"}},{name:"nose",bone:"head",size:[1,1.5,.8],pos:[0,26.9,-4.4],color:"S",faces:{front:"s"}}];if(a!=="none"){if(e.hat||l.push({name:"hair",bone:"head",size:a==="curly"?[9,2.2,9]:[8.6,1.6,8.6],pos:[0,a==="curly"?32.5:32.2,.15],color:"h",faces:_t("hair_band",{top:"hair_top"})}),a==="curly"&&!e.hat)for(let[b,u]of [[-2,-1.5],[2,.5],[-0.5,2.5]])l.push({name:"curl",bone:"head",size:[3.2,1.4,3.2],pos:[b,33.9,u],color:"h",faces:_t("hair_band",{top:"hair_top"})});a==="long"?(s.hair_long=J(Ui),l.push({name:"hairLong",bone:"head",size:[8.8,10,1],pos:[0,27,4.4],color:"h",faces:_t("hair_long",{top:"hair_top"})},{name:"hairSide",bone:"head",size:[.8,9,6],pos:[-4.4,27.5,1],color:"h",faces:_t("hair_long",{top:"hair_top"}),mirror:true})):l.push({name:"hairBack",bone:"head",size:[8.6,5,.8],pos:[0,29.6,4.25],color:"h",faces:{back:"head_back",left:"hair_band",right:"hair_band"}});}e.hat&&(s.hat_crown=J(Gi),s.hat_brim=J(qi),l.push({name:"hatBrim",bone:"head",size:[11,.8,11],pos:[0,32.4,0],color:"a",faces:{top:"hat_brim",bottom:"hat_brim"}},{name:"hatCrown",bone:"head",size:[8.4,3,8.4],pos:[0,34.3,0],color:"a",faces:_t("hat_crown")}));let i={shirt:[wi,Ri,ki],tee:[Pi,zi,Ii],sweater:[Oi,Vi,Fi]},[c$1,p,h]=i[t];s.top_front=J(c$1),s.top_back=J(p),s.top_side=J(h),l.push({name:"torso",bone:"body",size:[8,12,4],pos:[0,18,0],color:"t",faces:{front:"top_front",back:"top_back",left:"top_side",right:"top_side",bottom:"p"}}),t==="shirt"&&(s.belt=J(vi),l.push({name:"belt",bone:"body",size:[8.4,1,4.4],pos:[0,13.5,0],color:"B",faces:{front:"belt",back:"belt"}})),l.push({name:"arm",bone:"armL",size:[3,12,3],pos:[-5.5,18,0],color:"s",faces:_t("arm_skin",{top:"t",bottom:"S"}),mirror:true});let m=t==="sweater"?11:t==="tee"?4.5:6.5;s.sleeve=J(t==="sweater"?Di:t==="tee"?_i:Ei),l.push({name:"sleeve",bone:"armL",size:[3.6,m,3.6],pos:[-5.5,24-m/2,0],color:"t",faces:_t("sleeve",{bottom:"D"}),mirror:true}),r==="shorts"?(s.leg_front=J(Bi),s.leg_side=J(Ni)):(s.leg_front=J(Si),s.leg_back=J(Ti),s.leg_side=J(Mi)),l.push({name:"leg",bone:"legL",size:[4,12,4],pos:[-2,6,0],color:"p",faces:{front:"leg_front",back:r==="shorts"?"leg_front":"leg_back",left:"leg_side",right:"leg_side"},mirror:true}),o==="boots"?(s.shoe_front=J(Li),s.shoe_side=J(Ci)):(s.shoe_front=J(Hi),s.shoe_side=J(ji));let d=o==="boots"?4.5:2.5;return l.push({name:"shoe",bone:"legL",size:[4.6,d,5.2],pos:[-2,d/2,-0.3],color:"z",faces:{front:"shoe_front",back:"shoe_side",left:"shoe_side",right:"shoe_side",bottom:"Z"},mirror:true}),{version:1,name:e.name??c({en:"Traveler",ru:"\u041F\u0443\u0442\u043D\u0438\u043A"}),description:e.description??c({en:"A traveler in a shirt with pockets, trousers and laced boots",ru:"\u041F\u0443\u0442\u043D\u0438\u043A \u0432 \u0440\u0443\u0431\u0430\u0448\u043A\u0435 \u0441 \u043A\u0430\u0440\u043C\u0430\u043D\u0430\u043C\u0438, \u0431\u0440\u044E\u043A\u0430\u0445 \u0438 \u0448\u043D\u0443\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0445 \u0431\u043E\u0442\u0438\u043D\u043A\u0430\u0445"}),rig:"humanoid",palette:n,textures:s,parts:l,face:{bone:"head",rect:[0,3,8,5],expressions:{neutral:"f_neutral",blink:"f_blink",happy:"f_happy",sad:"f_sad",angry:"f_angry",surprised:"f_surprised",scared:"f_scared",tired:"f_tired",hurt:"f_hurt",talk:"f_talk"}},style:{walk:"normal",idle:"calm",energy:.5},finish:{noise:.5,outline:.4,shade:.25,density:2},tags:e.tags??["player"]}}function Ar(e,t){return {textures:Object.fromEntries(Object.entries(an).map(([r,o])=>[r,J(o)])),face:{bone:e,rect:t,expressions:{neutral:"f_neutral",blink:"f_blink",happy:"f_happy",sad:"f_sad",angry:"f_angry",surprised:"f_surprised",scared:"f_scared",tired:"f_tired",hurt:"f_hurt",talk:"f_talk"}}}}var jo=Ho(),Bo=null;function Ot(){if(!Bo){let e=Ye(jo);if(!e.ok)throw new Error(e.error);Bo=e.spec;}return Bo}function pn(e){let t=document.createElement("canvas");t.width=256,t.height=48;let r=t.getContext("2d");r&&(r.fillStyle="rgba(0,0,0,0.45)",r.fillRect(0,0,256,48),r.font="bold 28px sans-serif",r.fillStyle="#fff",r.textAlign="center",r.textBaseline="middle",r.fillText(e.slice(0,18),128,25));let o=new B.CanvasTexture(t),a=new B.Sprite(new B.SpriteMaterial({map:o,depthTest:false,transparent:true}));return a.scale.set(1.6,.3,1),a.renderOrder=10,a}function Go(e){e.removeFromParent(),e.material.map?.dispose(),e.material.dispose();}var I={rx:0,ry:1,rz:2,px:3,py:4,pz:5,sx:6,sy:7,sz:8},w1=Object.keys(I),nr=[0,0,0,0,0,0,1,1,1];function oe(e,t){let r=e.get(t);return r||(r=Float64Array.from(nr),e.set(t,r)),r}function de(e,t,r,o){let a=oe(e,t),n=I[r];n>=6?a[n]=a[n]*o:a[n]=a[n]+o;}function y(e,t,r,o){oe(e,t)[I[r]]=o;}function ft(e){for(let t of e.values())t.set(nr);}function mn(e,t,r,o){let a=new Set([...t.keys(),...r.keys()]);for(let n of a){let s=t.get(n)??nr,l=r.get(n)??nr,i=oe(e,n);for(let c=0;c<9;c++)i[c]=s[c]+(l[c]-s[c])*o;}}function De(e,t){ft(e);for(let[r,o]of t)oe(e,r).set(o);}var R1=["none","block","tool","sword","bow","shield","food","staff","item","pistol","rifle"];function no(){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",aiming:false,use:null,talk:false}}var k1=["swing","hurt","place","land","jump","throw","shoot","punch"];var yt=(e,t)=>[e[0]+t[0],e[1]+t[1],e[2]+t[2]],ue=(e,t)=>[e[0]-t[0],e[1]-t[1],e[2]-t[2]],Ft=(e,t)=>[e[0]*t,e[1]*t,e[2]*t],bt=(e,t)=>e[0]*t[0]+e[1]*t[1]+e[2]*t[2],Vt=(e,t)=>[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]],He=e=>Math.hypot(e[0],e[1],e[2]),nt=(e,t)=>He(ue(e,t)),Er=(e,t,r)=>[e[0]+(t[0]-e[0])*r,e[1]+(t[1]-e[1])*r,e[2]+(t[2]-e[2])*r];function sr(e){let t=He(e);return t>1e-12?[e[0]/t,e[1]/t,e[2]/t]:[0,0,0]}var xe=(e,t,r)=>Math.max(t,Math.min(r,e)),qo=[1,0,0,0,1,0,0,0,1];function Be(e,t){return [e[0]*t[0]+e[1]*t[3]+e[2]*t[6],e[0]*t[1]+e[1]*t[4]+e[2]*t[7],e[0]*t[2]+e[1]*t[5]+e[2]*t[8],e[3]*t[0]+e[4]*t[3]+e[5]*t[6],e[3]*t[1]+e[4]*t[4]+e[5]*t[7],e[3]*t[2]+e[4]*t[5]+e[5]*t[8],e[6]*t[0]+e[7]*t[3]+e[8]*t[6],e[6]*t[1]+e[7]*t[4]+e[8]*t[7],e[6]*t[2]+e[7]*t[5]+e[8]*t[8]]}function ae(e,t){return [e[0]*t[0]+e[1]*t[1]+e[2]*t[2],e[3]*t[0]+e[4]*t[1]+e[5]*t[2],e[6]*t[0]+e[7]*t[1]+e[8]*t[2]]}var gt=e=>[e[0],e[3],e[6],e[1],e[4],e[7],e[2],e[5],e[8]];function Qe(e,t,r){let o=Math.cos(e),a=Math.sin(e),n=Math.cos(t),s=Math.sin(t),l=Math.cos(r),i=Math.sin(r),c=o*l,p=o*i,h=a*l,m=a*i;return [n*l,-n*i,s,p+h*s,c-m*s,-a*n,m-c*s,h+p*s,o*n]}function Dt(e){let t=Math.asin(xe(e[2],-1,1));return Math.abs(e[2])<.9999999?[Math.atan2(-e[5],e[8]),t,Math.atan2(-e[1],e[0])]:[Math.atan2(e[7],e[4]),t,0]}function so(e,t){let[r,o,a]=e,n=Math.cos(t),s=Math.sin(t),l=1-n;return [l*r*r+n,l*r*o-s*a,l*r*a+s*o,l*r*o+s*a,l*o*o+n,l*o*a-s*r,l*r*a-s*o,l*o*a+s*r,l*a*a+n]}function Uo(e,t){let r=sr(e),o=sr(t),a=xe(bt(r,o),-1,1),n=Vt(r,o),s=He(n);if(s<1e-9){if(a>0)return [...qo];let l=Math.abs(r[0])<.9?Vt(r,[1,0,0]):Vt(r,[0,1,0]);return so(sr(l),Math.PI)}return so(Ft(n,1/s),Math.atan2(s,a))}function hn(e,t,r){return Math.atan2(bt(Vt(e,t),r),bt(e,t))}function Sr(e){let t=Math.PI*2;return e=(e%t+t)%t,e>Math.PI?e-t:e}function io(e,t,r,o,a){if(a<=0)return e;if(o<=1e-6)return t.v=0,r;let n=2/o,s=n*a,l=1/(1+s+.48*s*s+.235*s*s*s),i=e-r,c=(t.v+n*i)*a;return t.v=(t.v-n*c)*l,r+(i+c)*l}var dn=Float64Array.from([0,0,0,0,0,0,1,1,1]);function We(e,t){let r=new Map(e.map(i=>[i.name,i])),o=new Map,a=t.get("root")??dn,n=Qe(a[I.rx],a[I.ry],a[I.rz]),s={pos:[a[I.px],a[I.py],a[I.pz]],lin:n,rot:n},l=i=>{let c=o.get(i.name);if(c)return c;let p=i.parent?r.get(i.parent):void 0,h=p?l(p):s,m=p?p.pivot:[0,0,0],d=t.get(i.role)??dn,b=[i.pivot[0]-m[0]+d[I.px],i.pivot[1]-m[1]+d[I.py],i.pivot[2]-m[2]+d[I.pz]],u=Qe(d[I.rx],d[I.ry],d[I.rz]),R=[d[I.sx],0,0,0,d[I.sy],0,0,0,d[I.sz]],w={pos:yt(h.pos,ae(h.lin,b)),lin:Be(h.lin,Be(u,R)),rot:Be(h.rot,u),parentRot:h.rot};return o.set(i.name,w),w};for(let i of e)l(i);return o}function Bt(e,t){return yt(e.pos,ae(e.lin,t))}var Ko=.04;function un(e,t,r,o){let[a,n,s]=Dt(Be(gt(r.parentRot),o)),l=oe(e,t);l[I.rx]=a,l[I.ry]=n,l[I.rz]=s;}function Ki(e,t){let r=Ko*t,o=t-r;return e<=o||r<=0?e:o+r*(1-Math.exp(-(e-o)/r))}function Yo(e,t,r){let o=t.upper.node.pos,a=t.lower.node.pos,n=t.end,s=ue(o,a),l=ue(n,a),i=He(s),c=He(l);if(i<1e-9||c<1e-9)return n;let p=sr(ae(t.lower.node.parentRot,[1,0,0])),h=Ft(p,bt(s,p)),m=Ft(p,bt(l,p)),d=ue(s,h),b=ue(l,m),u=He(d),R=He(b),w=nt(o,r),A=nt(o,n),k=w<=A?w:Math.max(A,Ki(w,Math.hypot(He(ue(m,h)),u+R))),x=e.get(t.lower.role)?.[I.rx]??0,f=0;if(u>1e-9&&R>1e-9){let C=hn(d,b,p),z=(i*i+c*c-k*k)/2-bt(h,m),_=xe(z/(u*R),-1,1),M=Math.acos(_),[V,q]=t.bend,Y=v=>{let O=v-x,F=yt(m,yt(Ft(b,Math.cos(O)),Ft(Vt(p,b),Math.sin(O))));return Math.abs(He(ue(F,s))-k)},ce=[Sr(M-C),Sr(-M-C)].flatMap(v=>{let O=x+v;return [O,xe(O,V,q)]}),pe=xe(x,V,q),se=Y(pe);for(let v of ce){if(v<V-1e-9||v>q+1e-9)continue;let O=Y(v);(O<se-1e-6||Math.abs(O-se)<=1e-6&&Math.abs(v-x)<Math.abs(pe-x))&&(pe=v,se=O);}f=pe-x;}oe(e,t.lower.role)[I.rx]=x+f;let S=yt(a,ae(so(p,f),l)),T=Uo(ue(S,o),ue(r,o));return un(e,t.upper.role,t.upper.node,Be(T,t.upper.node.rot)),yt(o,ae(T,ue(S,o)))}function fn(e,t,r,o,a){let n=r.pos,s=sr(ae(r.parentRot,[1,0,0])),l=ue(o,n),i=Ft(s,bt(l,s)),c=ue(l,i),p=Vt(s,c),h=i[1],m=c[1],d=p[1],b=Math.hypot(m,d);if(b<1e-9)return;let u=Math.atan2(d,m),R=xe((a-n[1]-h)/b,-1,1),w=Math.acos(R),A=Sr(u+w),k=Sr(u-w),x=Math.abs(A)<=Math.abs(k)?A:k;oe(e,t)[I.rx]=(e.get(t)?.[I.rx]??0)+x;}function bn(e,t,r,o,a){let n=Uo(ue(o,r.pos),ue(a,r.pos));un(e,t,r,Be(n,r.rot));}var Yi=.25,yn=.07,Wi=.22,$i=.12,Xi=.28,Ji=.6,lo=.45,gn=.03,Qi=.2,Zi=.2,e0=.12,Tr=(e,t,r)=>xe(e+(t?r:-r)/Yi,0,1),xt=e=>e*e*(3-2*e),xn=(e,t,r)=>{e[t]=e[t]+r;},Mr=class{ik;bones;feet=[];hands={};out=new Map;thigh;plant=0;wLook=0;lookAt=null;lookV=[{v:0},{v:0},{v:0}];wSeat=0;lastSeat=null;pelvis=0;pelvisV={v:0};wHand={handR:0,handL:0};lastHand={handR:null,handL:null};wLock=0;constructor(t){this.ik=Ae[t.rig].ik??{},this.bones=t.bones.map(l=>({name:l.name,role:l.role,parent:l.parent,pivot:l.pivot}));let r=We(this.bones,new Map),o=l=>t.bones.find(i=>i.role===l),a=l=>{let i=o(l.upper),c=l.lower?o(l.lower):void 0;if(!i||l.lower&&!c)return null;let p=c??i,h=p.name,m;if(l.end==="sole"){let w=0;for(let A=1;A<p.positions.length;A+=3)w=Math.min(w,p.positions[A]);m=[0,w,0];}else {let w=t.sockets.find(A=>A.name===l.end);if(!w)return null;h=w.bone,m=w.at;}let d=r.get(i.name).pos,b=Bt(r.get(h),m),u=c?nt(d,r.get(c.name).pos)+nt(r.get(c.name).pos,b):nt(d,b),R=w=>({name:w.name,role:w.role,parent:w.parent,pivot:w.pivot});return {def:l,upper:R(i),lower:c?R(c):null,endBone:h,endAt:m,length:u}};for(let l of this.ik.feet??[]){let i=a(l);i&&this.feet.push({...i,g:0,gv:{v:0},lock:null,lockYaw:0,step:null});}for(let l of ["handR","handL"]){let i=this.ik.hands?.[l],c=i&&a(i);c&&(this.hands[l]=c);}let n=2,s=this.feet[0]&&t.bones.find(l=>l.name===this.feet[0].upper.name);if(s&&s.positions.length){let l=1/0,i=-1/0;for(let c=0;c<s.positions.length;c+=3)l=Math.min(l,s.positions[c]),i=Math.max(i,s.positions[c]);n=(i-l)/2;}this.thigh=n;}supports(t){return t==="look"?!!this.ik.look:t==="ground"||t==="seat"?this.feet.length>0:!!this.hands[t]}solve(t,r){let o=Math.max(0,Math.min(r.dt,.1)),a=!!r.ground&&this.feet.length>0;if(this.plant=a?xe(this.plant+(r.plant-this.plant)*Math.min(1,o/.12),0,1):Tr(this.plant,false,o),!a&&this.plant===0&&this.resetFeet(),this.wLook=this.ik.look?Tr(this.wLook,!!r.look,o):0,r.look){let m=this.lookAt;this.lookAt=m?[0,1,2].map(d=>io(m[d],this.lookV[d],r.look[d],e0,o)):[...r.look];}else this.wLook===0&&(this.lookAt=null);this.wSeat=this.feet.length?Tr(this.wSeat,!!r.seat,o):0,r.seat&&(this.lastSeat=r.seat);for(let m of ["handR","handL"])this.wHand[m]=this.hands[m]?Tr(this.wHand[m],!!r[m],o):0,r[m]&&(this.lastHand[m]=r[m]);if(this.plant===0&&this.wLook===0&&this.wSeat===0&&this.wHand.handR===0&&this.wHand.handL===0)return t;let n=this.out;De(n,t);let s=We(this.bones,n),l=m=>s.get(m),i=this.feet.map(m=>Bt(l(m.endBone),m.endAt)),c=xt(this.wSeat);if(c>0&&this.lastSeat){let m=this.feet.slice(0,2).map(w=>l(w.upper.name).pos),d=m.length===2?Er(m[0],m[1],.5):m[0],b=[d[0],d[1]-this.thigh,d[2]],u=ue(this.lastSeat,b),R=oe(n,"root");R[I.px]=R[I.px]+u[0]*c,R[I.py]=R[I.py]+u[1]*c,R[I.pz]=R[I.pz]+u[2]*c;}let p=xt(this.plant);p>0&&(s=this.ground(n,s,i,r,p,c,o));let h=xt(this.wLook);h>0&&this.lookAt&&this.ik.look&&(s=this.look(n,s,this.lookAt,h));for(let m of ["handR","handL"]){let d=this.hands[m],b=xt(this.wHand[m]),u=this.lastHand[m];if(!d||b===0||!u)continue;s=We(this.bones,n);let R=Bt(s.get(d.endBone),d.endAt),w=Er(R,u,b);d.lower?Yo(n,{upper:{role:d.upper.role,node:s.get(d.upper.name)},lower:{role:d.lower.role,node:s.get(d.lower.name)},end:R,bend:d.def.bend??[-Math.PI,Math.PI]},w):bn(n,d.upper.role,s.get(d.upper.name),R,w);}return n}reset(){this.resetFeet(),this.pelvis=0,this.pelvisV.v=0,this.lookAt=null;for(let t of this.lookV)t.v=0;}resetFeet(){for(let t of this.feet)t.g=0,t.gv.v=0,t.lock=null,t.step=null;this.wLock=0;}ground(t,r,o,a,n,s,l){let i=s===0&&a.standing&&this.feet.every(x=>x.lower);if(this.wLock=Tr(this.wLock,i,l),!i&&this.wLock===0)for(let x of this.feet)x.lock=null,x.step=null;let c=this.feet.some(x=>x.step),p=a.toWorld([0,0,0]),h=a.toWorld([0,0,-1]),m=Math.atan2(h[0]-p[0],h[2]-p[2]),d=[];for(let x=0;x<this.feet.length;x++){let f=this.feet[x],S=o[x],T=S[0],C=S[2],z=0;if(i||this.wLock>0){let _=a.toWorld(S),M=xt(this.wLock);if(!f.lock&&!f.step&&(f.lock=_,f.lockYaw=m),f.step){f.step.t=Math.min(1,f.step.t+l/Wi);let V=f.step.t,q=a.toModel(Er(f.step.from,_,xt(V)));T+=(q[0]-T)*M,C+=(q[2]-C)*M,z=Math.sin(Math.PI*V)*$i*f.length*M,V>=1&&(f.lock=_,f.lockYaw=m,f.step=null);}else if(f.lock){let V=a.toModel(f.lock),q=Math.abs(Math.atan2(Math.sin(m-f.lockYaw),Math.cos(m-f.lockYaw)));i&&!c&&(q>Ji||Math.hypot(V[0]-T,V[2]-C)>Xi*f.length)&&(f.step={from:f.lock,t:0},f.lock=null),T+=(V[0]-T)*M,C+=(V[2]-C)*M;}}d.push({x:T,z:C,arc:z});}let b=Math.max(...this.feet.map(x=>x.length));for(let x=0;x<this.feet.length;x++){let f=this.feet[x],S=a.ground?a.ground(d[x].x,0,d[x].z):0;S!==null&&S<-lo*b&&(S=null),f.g=io(f.g,f.gv,S??f.g,yn,l);}let u=this.ik.tilt,R=oe(t,"root");if(u){let x=(M,V)=>{let q=this.feet.map((Y,ce)=>M.includes(Y.upper.role)?ce:-1).filter(Y=>Y>=0);return q.length?q.reduce((Y,ce)=>Y+V(this.feet[ce],ce),0)/q.length:0},f=x(u.front,M=>M.g),S=x(u.back,M=>M.g),T=x(u.front,(M,V)=>o[V][2]),C=x(u.back,(M,V)=>o[V][2]),z=Math.max(1,Math.abs(C-T)),_=xe(Math.atan2(f-S,z),-u.max,u.max);R[I.rx]=R[I.rx]+_*n*(1-s),R[I.py]=R[I.py]+(f+S)/2*n*(1-s);}else {let x=this.feet.map(z=>z.g),f=Math.min(...x),S=x.reduce((z,_)=>z+_,0)/x.length,T=this.feet.every(z=>z.lower)?1-xt(this.wLock):0,C=xe(f+(S-f)*T,-lo*b,lo*b)*(1-s);this.pelvis=io(this.pelvis,this.pelvisV,C,yn,l),R[I.py]=R[I.py]+this.pelvis*n;}r=We(this.bones,t);let w=x=>this.feet.map((f,S)=>{let T=Math.max(0,o[S][1]),C=T+f.g+d[S].arc,z=Bt(x.get(f.endBone),f.endAt)[1],_=Math.max(z,f.g),M=1-xt(xe((T-gn*f.length)/((Qi-gn)*f.length),0,1)),V=_+(C-_)*M,q=Math.max(f.g,z-Zi*f.length);return [d[S].x,V+(q-V)*s,d[S].z]}),A=w(r),k=0;this.feet.forEach((x,f)=>{if(!x.lower)return;let S=r.get(x.upper.name).pos,T=A[f],C=Math.max(nt(S,Bt(r.get(x.endBone),x.endAt)),x.length*(1-Ko)),z=Math.hypot(T[0]-S[0],T[2]-S[2]);z>=C||(k=Math.max(k,S[1]-T[1]-Math.sqrt(C*C-z*z)));}),k>0&&(xn(R,I.py,-Math.min(k,lo*b)*n*(1-s)),r=We(this.bones,t),A=w(r));for(let x=0;x<this.feet.length;x++){let f=this.feet[x],S=Bt(r.get(f.endBone),f.endAt),T=Er(S,A[x],n);nt(T,S)<1e-6||(f.lower?Yo(t,{upper:{role:f.upper.role,node:r.get(f.upper.name)},lower:{role:f.lower.role,node:r.get(f.lower.name)},end:S,bend:f.def.bend??[-Math.PI,Math.PI]},T):fn(t,f.upper.role,r.get(f.upper.name),S,T[1]));}return We(this.bones,t)}look(t,r,o,a){let n=this.ik.look,s=this.bones.find(h=>h.role===n.head);if(!s)return r;let l=h=>{let m=ae(gt(h.parentRot),ue(o,h.pos));return [Math.atan2(-m[0],-m[2]),Math.atan2(m[1],Math.hypot(m[0],m[2]))]};if(He(ue(o,r.get(s.name).pos))<1e-6)return r;let[i,c]=l(r.get(s.name));if(n.body&&n.bodyYaw>0&&this.bones.some(h=>h.role===n.body)){let h=xe(Math.abs(i)-n.headYaw,0,n.bodyYaw)*Math.sign(i);h!==0&&(xn(oe(t,n.body),I.ry,h*a),r=We(this.bones,t),[i,c]=l(r.get(s.name)));}let p=oe(t,n.head);return p[I.ry]=p[I.ry]+(xe(i,-n.headYaw,n.headYaw)-p[I.ry])*a,p[I.rx]=p[I.rx]+(xe(c,-n.headPitch,n.headPitch)-p[I.rx])*a,We(this.bones,t)}};var Ze=(e,t)=>[e[3]*t[0]+e[0]*t[3]+e[1]*t[2]-e[2]*t[1],e[3]*t[1]-e[0]*t[2]+e[1]*t[3]+e[2]*t[0],e[3]*t[2]+e[0]*t[1]-e[1]*t[0]+e[2]*t[3],e[3]*t[3]-e[0]*t[0]-e[1]*t[1]-e[2]*t[2]],it=e=>[-e[0],-e[1],-e[2],e[3]];function Xo(e){let t=Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]+e[3]*e[3]);return t>0?[e[0]/t,e[1]/t,e[2]/t,e[3]/t]:[0,0,0,1]}function ne(e,t){let[r,o,a,n]=e,s=2*(o*t[2]-a*t[1]),l=2*(a*t[0]-r*t[2]),i=2*(r*t[1]-o*t[0]);return [t[0]+n*s+(o*i-a*l),t[1]+n*l+(a*s-r*i),t[2]+n*i+(r*l-o*s)]}var Wo=(e,t)=>ne(it(e),t);function Jo(e){let[t,r,o,a]=e;return [1-2*(r*r+o*o),2*(t*r-o*a),2*(t*o+r*a),2*(t*r+o*a),1-2*(t*t+o*o),2*(r*o-t*a),2*(t*o-r*a),2*(r*o+t*a),1-2*(t*t+r*r)]}function mo(e){let t=e[0]+e[4]+e[8],r;if(t>0){let o=Math.sqrt(t+1)*2;r=[(e[7]-e[5])/o,(e[2]-e[6])/o,(e[3]-e[1])/o,.25*o];}else if(e[0]>e[4]&&e[0]>e[8]){let o=Math.sqrt(1+e[0]-e[4]-e[8])*2;r=[.25*o,(e[1]+e[3])/o,(e[2]+e[6])/o,(e[7]-e[5])/o];}else if(e[4]>e[8]){let o=Math.sqrt(1+e[4]-e[0]-e[8])*2;r=[(e[1]+e[3])/o,.25*o,(e[5]+e[7])/o,(e[2]-e[6])/o];}else {let o=Math.sqrt(1+e[8]-e[0]-e[4])*2;r=[(e[2]+e[6])/o,(e[5]+e[7])/o,.25*o,(e[3]-e[1])/o];}return Xo(r)}function An(e,t,r){let o=e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3],a=o<0?[-t[0],-t[1],-t[2],-t[3]]:t;if(o=Math.abs(o),o>.9995)return Xo([e[0]+(a[0]-e[0])*r,e[1]+(a[1]-e[1])*r,e[2]+(a[2]-e[2])*r,e[3]+(a[3]-e[3])*r]);let n=Math.acos(o),s=Math.sin((1-r)*n)/Math.sin(n),l=Math.sin(r*n)/Math.sin(n);return [e[0]*s+a[0]*l,e[1]*s+a[1]*l,e[2]*s+a[2]*l,e[3]*s+a[3]*l]}var _e=(e,t)=>[e[0]+t[0],e[1]+t[1],e[2]+t[2]],Ee=(e,t)=>[e[0]-t[0],e[1]-t[1],e[2]-t[2]],te=(e,t)=>[e[0]*t,e[1]*t,e[2]*t],we=(e,t)=>e[0]*t[0]+e[1]*t[1]+e[2]*t[2],st=(e,t)=>[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]],Nt=e=>Math.sqrt(we(e,e));function wn(e){let t=Nt(e);return t>1e-12?[e[0]/t,e[1]/t,e[2]/t]:[0,0,0]}function Qo(e,t,r){let o=8*e[0]*e[1]*e[2],a=4*e[0]*e[0],n=4*e[1]*e[1],s=4*e[2]*e[2];return {x:t,q:r,v:[0,0,0],w:[0,0,0],px:t,pq:r,im:1/o,ii:[12/(o*(n+s)),12/(o*(a+s)),12/(o*(a+n))],half:e}}function wt(e,t){let r=Wo(e.q,t);return ne(e.q,[r[0]*e.ii[0],r[1]*e.ii[1],r[2]*e.ii[2]])}function ir(e,t,r){let[o,a,n]=t,s=e.q,l=Ze([o*.5*r,a*.5*r,n*.5*r,0],s);e.q=Xo([s[0]+l[0],s[1]+l[1],s[2]+l[2],s[3]+l[3]]);}function co(e,t,r,o,a){let n=Nt(a);if(n<1e-9)return 0;let s=te(a,1/n),l=st(t,s),i=e.im+we(l,wt(e,l));if(r){let p=st(o,s);i+=r.im+we(p,wt(r,p));}if(i<=0)return 0;let c=te(s,-n/i);return e.x=_e(e.x,te(c,e.im)),ir(e,wt(e,st(t,c)),1),r&&(r.x=Ee(r.x,te(c,r.im)),ir(r,wt(r,st(o,c)),-1)),n}function Lr(e,t,r){let o=Nt(r);if(o<1e-9)return;let a=te(r,1/o),n=we(a,wt(e,a));if(t&&(n+=we(a,wt(t,a))),n<=0)return;let s=te(r,1/n);ir(e,wt(e,s),1),t&&ir(t,wt(t,s),-1);}var $o=[];for(let e of [-1,1])for(let t of [-1,1])for(let r of [-1,1])$o.push([e,t,r]);var En=[];for(let e of [-1,0,1])for(let t of [-1,0,1])for(let r of [-1,0,1])(e||t||r)&&En.push([e,t,r]);var Sn=[];for(let e of $o)for(let t of $o)e<t&&(e[0]!==t[0]?1:0)+(e[1]!==t[1]?1:0)+(e[2]!==t[2]?1:0)==1&&Sn.push([e,t]);var Rn=2,kn=30,Tn={gravity:9.8,friction:.7,linDamp:.1,angDamp:.4,tone:8};function Mn(e,t,r,o,a,n){for(let c of e)c.px=c.x,c.pq=c.q,c.v=[c.v[0],c.v[1]-n.gravity*a,c.v[2]],c.x=_e(c.x,te(c.v,a)),ir(c,c.w,a);let s=Math.min(.5,n.tone*a);for(let c of t)t0(e,c,s);for(let c=0;c<2;c++)for(let p of t)po(e,p);for(let c of e)vn(c,r,o,n.friction,a);for(let c of t)po(e,c);for(let c of e)vn(c,r,o,n.friction,a);for(let c of t)po(e,c);let l=Math.max(0,1-n.linDamp*a),i=Math.max(0,1-n.angDamp*a);for(let c of e){c.v=te(Ee(c.x,c.px),l/a);let p=Nt(c.v);p>kn&&(c.v=te(c.v,kn/p));let h=Ze(c.q,it(c.pq));h[3]<0&&(h=[-h[0],-h[1],-h[2],-h[3]]),c.w=[h[0]*2*i/a,h[1]*2*i/a,h[2]*2*i/a];}}function Ln(e,t,r,o,a){let n=o*o*a,s=Math.max(0,1-2*o*a);e.forEach((l,i)=>{let c=r[i];if(l.px=l.x,l.pq=l.q,l.im===0){l.x=c.x,l.q=c.q;return}l.v=_e(te(l.v,s),te(Ee(c.x,l.x),n));let p=Ze(c.q,it(l.q));p[3]<0&&(p=[-p[0],-p[1],-p[2],-p[3]]),l.w=[l.w[0]*s+2*p[0]*n,l.w[1]*s+2*p[1]*n,l.w[2]*s+2*p[2]*n],l.x=_e(l.x,te(l.v,a)),ir(l,l.w,a);});for(let l=0;l<3;l++)for(let i of t)po(e,i);for(let l of e){l.v=te(Ee(l.x,l.px),1/a);let i=Ze(l.q,it(l.pq));i[3]<0&&(i=[-i[0],-i[1],-i[2],-i[3]]),l.w=[i[0]*2/a,i[1]*2/a,i[2]*2/a];}}function t0(e,t,r){let o=e[t.a],a=e[t.b],n=Ze(o.q,Ze(it(o.pq),a.pq)),s=Ze(n,it(a.q));s[3]<0&&(s=[-s[0],-s[1],-s[2],-s[3]]),Lr(o,a,[-2*s[0]*r,-2*s[1]*r,-2*s[2]*r]);}function po(e,t){let r=e[t.a],o=e[t.b],a=ne(r.q,t.ra),n=ne(o.q,t.rb);co(r,a,o,n,Ee(_e(r.x,a),_e(o.x,n)));let s=t.limit;if(s.kind==="hinge"){let u=ne(r.q,s.hinge),R=ne(o.q,s.hinge);Lr(r,o,st(u,R));let w=ne(r.q,s.hinge),A=ne(o.q,s.axis),k=wn(Ee(A,te(w,we(w,A)))),x=ne(r.q,s.from),f=ne(r.q,s.to);if(we(st(x,k),w)<0||we(st(k,f),w)<0){let S=we(k,x)>we(k,f)?x:f;Lr(r,o,st(S,k));}return}let l=ne(r.q,s.center),i=ne(o.q,s.axis),c=we(l,i);if(c<s.cosSwing){let u=wn(Ee(i,te(l,c))),R=u[0]===0&&u[1]===0&&u[2]===0?l:_e(te(l,s.cosSwing),te(u,s.sinSwing));Lr(r,o,st(R,i));}let p=Ze(it(r.q),o.q);p[3]<0&&(p=[-p[0],-p[1],-p[2],-p[3]]);let h=p[0]*s.axis[0]+p[1]*s.axis[1]+p[2]*s.axis[2],m=Math.sqrt(h*h+p[3]*p[3]);if(m<1e-9)return;let d=p[3]/m,b=Math.abs(h)/m;if(d<s.cosHalfTwist){let u=2*(b*s.cosHalfTwist-d*s.sinHalfTwist),R=ne(o.q,s.axis);Lr(r,o,te(R,(h>0?1:-1)*u));}}function vn(e,t,r,o,a){for(let n of En){let s=[n[0]*e.half[0],n[1]*e.half[1],n[2]*e.half[2]],l=ne(e.q,s),i=_e(e.x,l),c=null,p=0;if(t!==null&&i[1]<t&&(c=[0,1,0],p=t-i[1]),r.length){let R=_e(e.px,ne(e.pq,s));for(let w of r){if(i[0]<=w.min[0]||i[0]>=w.max[0]||i[1]<=w.min[1]||i[1]>=w.max[1]||i[2]<=w.min[2]||i[2]>=w.max[2])continue;let A=[0,1,0],k=w.max[1]-i[1];if(R[1]<w.max[1]-1e-4){let x=[[[1,0,0],w.max[0]-i[0]],[[-1,0,0],i[0]-w.min[0]],[[0,0,1],w.max[2]-i[2]],[[0,0,-1],i[2]-w.min[2]]];(t===null||w.min[1]>t+.05)&&x.push([[0,-1,0],i[1]-w.min[1]]);for(let[f,S]of x)S<k&&(A=f,k=S);}k>p&&(c=A,p=k);}}if(!c)continue;let h=_e(e.px,ne(e.pq,s));if(p=Math.max(0,Math.min(p,we(Ee(h,i),c)+Rn*a)),p<=0)continue;co(e,l,null,[0,0,0],te(c,-p));let m=ne(e.q,s),d=Ee(_e(e.x,m),h),b=Ee(d,te(c,we(d,c))),u=Nt(b);u>1e-9&&co(e,m,null,[0,0,0],te(b,Math.min(1,o*p/u)));}for(let n of r)for(let[s,l]of Sn){let i=T=>[T[0]<0?n.min[0]:n.max[0],T[1]<0?n.min[1]:n.max[1],T[2]<0?n.min[2]:n.max[2]],c=Wo(e.q,Ee(i(s),e.x)),p=Wo(e.q,Ee(i(l),e.x)),h=Ee(p,c),m=we(h,h),d=m>0?Math.max(0,Math.min(1,-we(c,h)/m)):0,b=_e(c,te(h,d)),u=e.half[0]-Math.abs(b[0]),R=e.half[1]-Math.abs(b[1]),w=e.half[2]-Math.abs(b[2]);if(u<=0||R<=0||w<=0)continue;let A=u<R?u<w?0:2:R<w?1:2,k=[0,0,0];k[A]=b[A]>=0?1:-1;let x=A===0?u:A===1?R:w,f=_e(e.x,ne(e.q,b)),S=te(ne(e.q,k),-1);x=Math.min(x,we(Ee(_e(e.px,ne(e.pq,b)),f),S)+Rn*a),!(x<=0)&&co(e,Ee(f,e.x),null,[0,0,0],te(ne(e.q,k),x));}}function Cn(e){let t=Math.max(e.half[0],e.half[1],e.half[2]);return Nt(e.v)+Nt(e.w)*t}var Pn=Math.PI,Zo={"root.rx":[[0,Pn/2],[.3,.6],[.6,0],[1,0]],"root.py":[[0,2.3],[.3,-6],[.6,-6],[1,0]],"legL.rx":[[0,0],[.3,1.8],[.6,1.5],[1,0]],"legR.rx":[[0,0],[.3,.2],[.6,-0.1],[1,0]],"shinL.rx":[[0,0],[.3,-2],[.6,-1.5],[1,0]],"shinR.rx":[[0,0],[.3,-1.6],[.6,-1.4],[1,0]],"armL.rx":[[0,0],[.3,-0.6],[.6,.4],[1,0]],"armR.rx":[[0,0],[.3,-0.6],[.6,.2],[1,0]]},zn={"root.rx":[[0,-Pn/2],[.3,-1.1],[.6,0],[1,0]],"root.py":[[0,2.3],[.3,4.5],[.6,-6],[1,0]],"armL.rx":[[0,1.6],[.3,1.5],[.6,.4],[1,0]],"armR.rx":[[0,1.6],[.3,1.5],[.6,.3],[1,0]],"foreArmL.rx":[[0,1.2],[.3,.1],[.6,.3],[1,0]],"foreArmR.rx":[[0,1.2],[.3,.1],[.6,.3],[1,0]],"legL.rx":[[0,0],[.3,.3],[.6,1.5],[1,0]],"legR.rx":[[0,0],[.3,.2],[.6,-0.1],[1,0]],"shinL.rx":[[0,0],[.3,-0.5],[.6,-1.5],[1,0]],"shinR.rx":[[0,0],[.3,-0.6],[.6,-1.4],[1,0]],"head.rx":[[0,.6],[.3,.3],[.6,0],[1,0]]};function In(e,t){if(t<=e[0][0])return e[0][1];for(let r=1;r<e.length;r++){let[o,a]=e[r];if(t<=o){let[n,s]=e[r-1],l=(t-n)/Math.max(1e-9,o-n);return s+(a-s)*l*l*(3-2*l)}}return e[e.length-1][1]}var lt=1/240,_n=48,r0=.08,o0=.25,a0=6,n0=.6,ho=.35,On=1.8,s0=.3,i0=11,l0=.2,c0=.65,p0=.25,m0=9,h0=14;function Vn(e,t){let r=Math.hypot(e[0],e[1],e[2]);return r>t?[e[0]*t/r,e[1]*t/r,e[2]*t/r]:e}var d0=.6,Fn=20,Dn=(e,t)=>{let r=ae(e.rot,[t[0]*e.scale,t[1]*e.scale,t[2]*e.scale]);return [r[0]+e.origin[0],r[1]+e.origin[1],r[2]+e.origin[2]]},Bn=(e,t)=>{let r=ae(gt(e.rot),[t[0]-e.origin[0],t[1]-e.origin[1],t[2]-e.origin[2]]);return [r[0]/e.scale,r[1]/e.scale,r[2]/e.scale]},Cr=e=>{let t=Math.max(0,Math.min(1,e));return t*t*(3-2*t)},Nn=e=>Qe(0,e,0),Pr=class{supported;defs=[];fkBones;torso;bodies=[];joints=[];st="none";acc=0;still=0;sleeping=false;out=new Map;world={floor:null};frozen=new Map;riseT=0;keys=Zo;yaw0=0;off0=[0,0,0];off1=[0,0,0];driftV=null;flT=0;stand;constructor(t){let r=Ae[t.rig]?.ragdoll;this.fkBones=t.bones.map(n=>({name:n.name,role:n.role,parent:n.parent,pivot:n.pivot})),this.torso=r?.torso??"",this.stand=new Set(r?.stand??[]);let o=new Map(t.bones.map(n=>[n.name,n])),a=r?[r.torso,...r.joints.map(n=>n.bone)]:[];if(this.supported=!!r&&a.every(n=>o.has(n)),!!this.supported)for(let n of a){let s=o.get(n),l=[1/0,1/0,1/0],i=[-1/0,-1/0,-1/0];for(let p=0;p<s.positions.length;p+=3)for(let h=0;h<3;h++){let m=s.positions[p+h];m<l[h]&&(l[h]=m),m>i[h]&&(i[h]=m);}let c=!Number.isFinite(l[0]);this.defs.push({name:n,role:s.role,pivot:s.pivot,c:c?[0,0,0]:[(l[0]+i[0])/2,(l[1]+i[1])/2,(l[2]+i[2])/2],half:c?[.5,.5,.5]:[Math.max(.3,(i[0]-l[0])/2),Math.max(.3,(i[1]-l[1])/2),Math.max(.3,(i[2]-l[2])/2)],joint:r.joints.find(p=>p.bone===n)??null});}}get state(){return this.st}get resting(){return this.st==="fall"&&this.sleeping}get drift(){return this.driftV}clearDrift(){this.driftV=null;}setWorld(t){this.world=t;}start(t,r,o,a){if(!this.supported)return;let n=r.frame.scale,s=this.place(r.pose,r.frame),l=t&&o>0?this.place(t.pose,t.frame):null;this.bodies=this.defs.map((i,c)=>{let p=s[c],h=Qo([i.half[0]*n,i.half[1]*n,i.half[2]*n],p.x,p.q),m=l?.[c];if(m){h.v=Vn([(p.x[0]-m.x[0])/o,(p.x[1]-m.x[1])/o,(p.x[2]-m.x[2])/o],m0);let b=Ze(p.q,it(m.q));b[3]<0&&(b=[-b[0],-b[1],-b[2],-b[3]]),h.w=Vn([2*b[0]/o,2*b[1]/o,2*b[2]/o],h0);}let d=Math.max(.15,Math.min(1,p.y/Fn));return h.v=[h.v[0]+a[0]*d,h.v[1]+a[1]*d,h.v[2]+a[2]*d],h}),this.joints=this.makeJoints(n),this.world.floor===null&&!this.world.boxes&&(this.world={floor:r.frame.origin[1]}),this.st="fall",this.acc=0,this.still=0,this.sleeping=false;}place(t,r){let o=We(this.fkBones,t);return this.defs.map(a=>{let n=o.get(a.name),s=Be(r.rot,n.rot),l=Dn(r,n.pos),i=ae(s,[a.c[0]*r.scale,a.c[1]*r.scale,a.c[2]*r.scale]);return {x:[l[0]+i[0],l[1]+i[1],l[2]+i[2]],q:mo(s),y:n.pos[1]+ae(n.rot,a.c)[1]}})}makeJoints(t){let r=new Map(this.defs.map((o,a)=>[o.name,a]));return this.defs.flatMap((o,a)=>{let n=o.joint;if(!n)return [];let s=r.get(n.parent);if(s===void 0)return [];let l=this.defs[s],i=[(o.pivot[0]-l.pivot[0]-l.c[0])*t,(o.pivot[1]-l.pivot[1]-l.c[1])*t,(o.pivot[2]-l.pivot[2]-l.c[2])*t],c=[-o.c[0]*t,-o.c[1]*t,-o.c[2]*t],p=[0,-1,0];if(n.kind==="hinge"){let[b,u]=n.bend;return [{a:s,b:a,ra:i,rb:c,limit:{kind:"hinge",hinge:[1,0,0],axis:p,from:[0,-Math.cos(b),-Math.sin(b)],to:[0,-Math.cos(u),-Math.sin(u)]}}]}let h=n.up?[0,1,0]:p,m=n.tilt??0,d=[0,h[1]*Math.cos(m),h[1]*Math.sin(m)];return [{a:s,b:a,ra:i,rb:c,limit:{kind:"ball",center:d,axis:h,cosSwing:Math.cos(n.swing),sinSwing:Math.sin(n.swing),cosHalfTwist:Math.cos(n.twist/2),sinHalfTwist:Math.sin(n.twist/2)}}]})}hit(t,r,o){if(!this.supported||this.st==="rise")return;if(this.st==="fall"){this.push(r);return}let a=t.frame,n=this.place(t.pose,a);this.st!=="flinch"&&(this.bodies=this.defs.map((i,c)=>{let p=Qo([i.half[0]*a.scale,i.half[1]*a.scale,i.half[2]*a.scale],n[c].x,n[c].q);return this.stand.has(i.name)&&(p.im=0,p.ii=[0,0,0]),p}),this.joints=this.makeJoints(a.scale),this.acc=0,this.st="flinch"),this.flT=0;let s=-1;if(typeof o=="string")s=this.defs.findIndex(i=>i.name===o);else if(o){let i=1/0;this.bodies.forEach((c,p)=>{let h=(c.x[0]-o[0])**2+(c.x[1]-o[1])**2+(c.x[2]-o[2])**2;c.im>0&&h<i&&(i=h,s=p);});}let l=new Map;for(let i=s,c=1;i>=0&&c>.05;c*=d0){l.set(i,c);let p=this.defs[i].joint?.parent;i=p?this.defs.findIndex(h=>h.name===p):-1;}this.bodies.forEach((i,c)=>{if(i.im===0)return;let p=s>=0?l.get(c)??0:Math.max(.15,Math.min(1,n[c].y/Fn));i.v=[i.v[0]+r[0]*p,i.v[1]+r[1]*p,i.v[2]+r[2]*p];});}push(t){if(this.st==="fall"){for(let r of this.bodies)r.v=[r.v[0]+t[0],r.v[1]+t[1],r.v[2]+t[2]];this.sleeping=false,this.still=0;}}getUp(t){if(this.st!=="fall")return;let r=this.poseNow(t);De(this.frozen,r);let o=r.get("root"),a=Qe(o[I.rx],o[I.ry],o[I.rz]),n=this.defs.find(d=>d.name===this.torso),s=ae(a,[0,1,0]),l=ae(a,[0,0,-1])[1]>=0;this.keys=l?Zo:zn,this.yaw0=l?Math.atan2(s[0],s[2]):Math.atan2(-s[0],-s[2]);let i=d=>{let b=d.get("root"),u=Qe(b[I.rx],b[I.ry],b[I.rz]),R=ae(u,n.pivot);return [R[0]+b[I.px],R[1]+b[I.py],R[2]+b[I.pz]]},c=i(r),p=ae(Nn(this.yaw0),i(this.keyPose(0))),h=i(this.keyPose(1)),m=this.groundUnder(t,c);this.off0=[c[0]-p[0],m,c[2]-p[2]],this.off1=[c[0]-h[0],m,c[2]-h[2]],this.driftV=this.off1,this.st="rise",this.riseT=0;}stop(){this.finish(),this.driftV=null;}finish(){this.st="none",this.bodies=[],this.joints=[];}groundUnder(t,r){let o=Dn(t,r),a=this.world.floor,n=this.world.boxes?.([o[0]-.01,-1e9,o[2]-.01],[o[0]+.01,o[1]+.3,o[2]+.01])??[];for(let s of n)o[0]>=s.min[0]&&o[0]<=s.max[0]&&o[2]>=s.min[2]&&o[2]<=s.max[2]&&s.max[1]<=o[1]+.3&&(a=a===null?s.max[1]:Math.max(a,s.max[1]));return a===null?0:Bn(t,[o[0],a,o[2]])[1]}drive(t,r,o){if(this.st==="none")return null;if(this.st==="flinch")return this.flinch(t,r,o);if(this.st==="fall")return this.sleeping||this.simulate(r),this.poseNow(o);this.riseT+=r;let a=this.riseT;if(a<ho)return ea(this.out,this.frozen,this.placed(0,0),Cr(a/ho));let n=(a-ho)/On;if(n<1)return u0(this.out,this.placed(n,Cr(n)));let s=(a-ho-On)/s0;return s>=1?(this.finish(),null):ea(this.out,this.placed(1,1),t,Cr(s))}flinch(t,r,o){let a=this.place(t,o);this.acc=Math.min(this.acc+r,_n*lt);let n=this.flT;this.flT+=r;let s=0;for(;this.acc>=lt-1e-9;){this.acc-=lt,s++;let c=i0*Cr((n+s*lt)/l0);Ln(this.bodies,this.joints,a,c,lt);}let l=this.poseNow(o),i=(this.flT-c0)/p0;return i<=0?l:i>=1?(this.finish(),null):ea(this.out,l,t,Cr(i))}simulate(t){this.acc=Math.min(this.acc+t,_n*lt);let r=this.nearBoxes();for(;this.acc>=lt-1e-9;)this.acc-=lt,Mn(this.bodies,this.joints,this.world.floor,r,lt,Tn);let o=0;for(let a of this.bodies)o=Math.max(o,Cn(a));if(o<o0){let a=Math.max(0,1-a0*t);for(let n of this.bodies)n.v=[n.v[0]*a,n.v[1]*a,n.v[2]*a],n.w=[n.w[0]*a,n.w[1]*a,n.w[2]*a];}if(this.still=o<r0?this.still+t:0,this.still>=n0){this.sleeping=true;for(let a of this.bodies)a.v=[0,0,0],a.w=[0,0,0];}}nearBoxes(){let t=this.world.boxes;if(!t||!this.bodies.length)return [];let r=[1/0,1/0,1/0],o=[-1/0,-1/0,-1/0];for(let a of this.bodies){let n=Math.max(a.half[0],a.half[1],a.half[2])*1.8+.3;for(let s=0;s<3;s++)r[s]=Math.min(r[s],a.x[s]-n),o[s]=Math.max(o[s],a.x[s]+n);}return t(r,o)}poseNow(t){let r=this.out,o=new Map,a=gt(t.rot);this.defs.forEach((w,A)=>o.set(w.name,Be(a,Jo(this.bodies[A].q))));let n=this.defs.findIndex(w=>w.name===this.torso),s=this.defs[n],l=this.bodies[n],i=o.get(this.torso),c=l.q,p=ne(c,[s.c[0]*t.scale,s.c[1]*t.scale,s.c[2]*t.scale]),h=Bn(t,[l.x[0]-p[0],l.x[1]-p[1],l.x[2]-p[2]]),m=ae(i,s.pivot),d=oe(r,"root"),[b,u,R]=Dt(i);d.set([b,u,R,h[0]-m[0],h[1]-m[1],h[2]-m[2],1,1,1]);for(let w of this.defs){let A=oe(r,w.role);if(w.name===this.torso){A.set([0,0,0,0,0,0,1,1,1]);continue}let k=w.joint?w.joint.parent===this.torso?i:o.get(w.joint.parent):i,[x,f,S]=Dt(Be(gt(k),o.get(w.name)));A.set([x,f,S,0,0,0,1,1,1]);}return r}placed(t,r){let o=this.keyPose(t),a=o.get("root"),n=this.yaw0*(1-r),s=Nn(n),l=Be(s,Qe(a[I.rx],a[I.ry],a[I.rz])),i=ae(s,[a[I.px],a[I.py],a[I.pz]]),[c,p,h]=Dt(l),m=this.off0,d=this.off1;return a.set([c,p,h,i[0]+m[0]+(d[0]-m[0])*r,i[1]+m[1],i[2]+m[2]+(d[2]-m[2])*r,1,1,1]),o}keyPose(t){let r=new Map;oe(r,"root");for(let o of this.defs)oe(r,o.role);for(let[o,a]of Object.entries(this.keys)){let[n,s]=o.split(".");oe(r,n)[I[s]]=In(a,t);}return r}};function u0(e,t){return De(e,t),e}function ea(e,t,r,o){let a=new Set([...t.keys(),...r.keys()]),n=[0,0,0,0,0,0,1,1,1],s=new Map;for(let l of a){let i=t.get(l)??Float64Array.from(n),c=r.get(l)??Float64Array.from(n),p=mo(Qe(i[0],i[1],i[2])),h=mo(Qe(c[0],c[1],c[2])),[m,d,b]=Dt(Jo(An(p,h,o))),u=new Float64Array(9);u[0]=m,u[1]=d,u[2]=b;for(let R=3;R<9;R++)u[R]=i[R]+(c[R]-i[R])*o;s.set(l,u);}return De(e,s),e}var Ht=1/16,b0=.68,Hn=.85,y0=1.2,g0=1.03,x0=1.1,w0=.12,R0=.1,k0=.1;function uo(e){let t=r=>r.toFixed(4);e.fragmentShader=e.fragmentShader.replace("#include <tonemapping_fragment>",`{
1
+ import {c,d}from'../chunk-YOAPVGXE.js';import {b,a}from'../chunk-CGF2TQVK.js';import {i,b as b$1,d as d$1}from'../chunk-MNDPJKUD.js';export{b as EMOTIONS,c as isEmotion}from'../chunk-MNDPJKUD.js';import*as B from'three';import {mergeGeometries}from'three/examples/jsm/utils/BufferGeometryUtils.js';import {RoomEnvironment}from'three/examples/jsm/environments/RoomEnvironment.js';var Oa={id:"avatar",label:"\u0410\u0432\u0430\u0442\u0430\u0440",hint:"the iDos Games account avatar: soft blocks with elbows and knees",bones:[{name:"body",role:"body",parent:null,pivot:[0,12.4,0]},{name:"head",role:"head",parent:"body",pivot:[0,22.4,0]},{name:"armL",role:"armL",parent:"body",pivot:[-6.3,21.4,0]},{name:"armR",role:"armR",parent:"body",pivot:[6.3,21.4,0]},{name:"foreArmL",role:"foreArmL",parent:"armL",pivot:[-6.3,17.2,0]},{name:"foreArmR",role:"foreArmR",parent:"armR",pivot:[6.3,17.2,0]},{name:"legL",role:"legL",parent:null,pivot:[-2.1,12.4,0]},{name:"legR",role:"legR",parent:null,pivot:[2.1,12.4,0]},{name:"shinL",role:"shinL",parent:"legL",pivot:[-2.1,6.4,0]},{name:"shinR",role:"shinR",parent:"legR",pivot:[2.1,6.4,0]}],sockets:[{name:"handR",bone:"foreArmR",at:[6.3,11.6,-1]},{name:"handL",bone:"foreArmL",at:[-6.3,11.6,-1]},{name:"headTop",bone:"head",at:[0,30.3,0]},{name:"face",bone:"head",at:[0,26.7,-4]},{name:"back",bone:"body",at:[0,18.5,2.3]},{name:"waist",bone:"body",at:[0,12.8,0]},{name:"shoulders",bone:"body",at:[0,22.4,0]}],hitbox:{w:.6,h:1.9},eye:26.4,height:{min:24,max:40},faceBone:"head",ik:{feet:[{upper:"legL",lower:"shinL",end:"sole",bend:[-2.6,0]},{upper:"legR",lower:"shinR",end:"sole",bend:[-2.6,0]}],hands:{handR:{upper:"armR",lower:"foreArmR",end:"handR",bend:[0,2.6]},handL:{upper:"armL",lower:"foreArmL",end:"handL",bend:[0,2.6]}},look:{head:"head",body:"body",headYaw:1.1,headPitch:.75,bodyYaw:.5}},ragdoll:{torso:"body",joints:[{bone:"head",parent:"body",kind:"ball",swing:.7,twist:.9,up:true},{bone:"armL",parent:"body",kind:"ball",swing:2.2,twist:1.2,tilt:.5},{bone:"armR",parent:"body",kind:"ball",swing:2.2,twist:1.2,tilt:.5},{bone:"foreArmL",parent:"armL",kind:"hinge",bend:[0,2.5]},{bone:"foreArmR",parent:"armR",kind:"hinge",bend:[0,2.5]},{bone:"legL",parent:"body",kind:"ball",swing:1.1,twist:.6,tilt:.6},{bone:"legR",parent:"body",kind:"ball",swing:1.1,twist:.6,tilt:.6},{bone:"shinL",parent:"legL",kind:"hinge",bend:[-2.5,0]},{bone:"shinR",parent:"legR",kind:"hinge",bend:[-2.5,0]}],stand:["legL","legR","shinL","shinR"]},defaultParts:[{bone:"head",size:[8.5,7.5,8],pos:[0,26.5,0],color:"s",name:"head"},{bone:"head",size:[2.9,.8,2.7],pos:[0,22.6,0],color:"s",name:"neck"},{bone:"body",size:[9,6,4.6],pos:[0,19.4,0],color:"t",name:"torso"},{bone:"body",size:[8.5,5.2,4.3],pos:[0,15,0],color:"t",name:"torso"},{bone:"armL",size:[3.6,5,3.6],pos:[-6.3,19.7,0],color:"s",name:"sleeveL"},{bone:"armR",size:[3.6,5,3.6],pos:[6.3,19.7,0],color:"s",name:"sleeveR"},{bone:"foreArmL",size:[3.45,5.4,3.45],pos:[-6.3,15.7,0],color:"s",name:"forearmL"},{bone:"foreArmR",size:[3.45,5.4,3.45],pos:[6.3,15.7,0],color:"s",name:"forearmR"},{bone:"foreArmL",size:[3.3,3,3.3],pos:[-6.3,12.7,0],color:"s",name:"handL"},{bone:"foreArmR",size:[3.3,3,3.3],pos:[6.3,12.7,0],color:"s",name:"handR"},{bone:"legL",size:[4.2,6,4.2],pos:[-2.1,9.4,0],color:"p",name:"legL"},{bone:"legR",size:[4.2,6,4.2],pos:[2.1,9.4,0],color:"p",name:"legR"},{bone:"shinL",size:[4.05,7.2,4.05],pos:[-2.1,4,0],color:"p",name:"legL"},{bone:"shinR",size:[4.05,7.2,4.05],pos:[2.1,4,0],color:"p",name:"legR"},{bone:"shinL",size:[4.2,1.6,5.2],pos:[-2.1,.8,-0.5],color:"p",name:"footL"},{bone:"shinR",size:[4.2,1.6,5.2],pos:[2.1,.8,-0.5],color:"p",name:"footR"}]};var Va={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 Fa={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",ik:{feet:[{upper:"legL",end:"sole"},{upper:"legR",end:"sole"}],look:{head:"head",headYaw:1.2,headPitch:.6,bodyYaw:0}},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 Da={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",ik:{feet:[{upper:"legL",end:"sole"},{upper:"legR",end:"sole"}],hands:{handR:{upper:"armR",end:"handR"},handL:{upper:"armL",end:"handL"}},look:{head:"head",body:"body",headYaw:1.1,headPitch:.75,bodyYaw:.5}},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 Ba={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",ik:{feet:[{upper:"legFL",end:"sole"},{upper:"legFR",end:"sole"},{upper:"legBL",end:"sole"},{upper:"legBR",end:"sole"}],tilt:{front:["legFL","legFR"],back:["legBL","legBR"],max:.45},look:{head:"head",headYaw:.9,headPitch:.6,bodyYaw:0}},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 Na={id:"swimmer",label:"\u041F\u043B\u043E\u0432\u0435\u0446",hint:"fish, sharks, dolphins, whales \u2014 creatures that swim with a tail",bones:[{name:"body",role:"body",parent:null,pivot:[0,6,0]},{name:"head",role:"head",parent:"body",pivot:[0,6,-4]},{name:"tail",role:"tail",parent:"body",pivot:[0,6,4]},{name:"finL",role:"ear",parent:"body",pivot:[-3,5,-1]},{name:"finR",role:"ear",parent:"body",pivot:[3,5,-1]}],sockets:[{name:"headTop",bone:"head",at:[0,10,-6]},{name:"face",bone:"head",at:[0,7,-9]},{name:"back",bone:"body",at:[0,10,0]},{name:"waist",bone:"body",at:[0,6,0]},{name:"shoulders",bone:"body",at:[0,9,-3]},{name:"handR",bone:"head",at:[1,4,-9]},{name:"handL",bone:"head",at:[-1,4,-9]}],hitbox:{w:.7,h:.6},eye:8,height:{min:4,max:40},faceBone:"head",ik:{look:{head:"head",headYaw:.4,headPitch:.3,bodyYaw:0}},defaultParts:[{bone:"body",size:[5,7,9],pos:[0,6,0],color:"t"},{bone:"head",size:[5,6,4],pos:[0,6,-6.5],color:"s"},{bone:"tail",size:[1,6,4],pos:[0,6,7],color:"t"},{bone:"finL",size:[3,.6,2],pos:[-4,5,-1],color:"p"},{bone:"finR",size:[3,.6,2],pos:[4,5,-1],color:"p"}]};var jc=["root","body","head","armL","armR","legL","legR","foreArmL","foreArmR","shinL","shinR","legFL","legFR","legBL","legBR","tail","wingL","wingR","ear","hair","cape","antenna","static"],to=["tail","wingL","wingR","ear","hair","cape","antenna","static"],Gc=["handR","handL","headTop","face","back","waist","shoulders"],wr=["humanoid","quadruped","flyer","blob","swimmer"],Zt="avatar";var Ae={humanoid:Da,quadruped:Ba,flyer:Fa,blob:Va,swimmer:Na,avatar:Oa};var Ha=1,ut=["front","back","left","right","top","bottom"],kr=["neutral","blink","happy","sad","angry","surprised","scared","tired","hurt","talk"],vr=["normal","bouncy","heavy","sneaky","robotic","swagger","skip","ninja","zombie","catwalk"],Ar=["calm","fidgety","proud","cool","shy","ready","bored"],qa={parts:96,bones:16,palette:32,textures:48,texturePixels:32768,textureSide:32,partSide:32,coord:64},tr=["glass","metal","glow"],o1=["cylinder"],er={noise:.5,outline:.4,shade:.25,density:2},X=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Rr=e=>Array.isArray(e)?e:[];function Ie(e,t,r,o){let a=typeof e=="number"?e:typeof e=="string"?Number(e):NaN;return Number.isFinite(a)?Math.min(o,Math.max(r,a)):t}function Io(e,t,r){if(typeof e!="string")return r;let o=e.trim();if(t.includes(o))return o;let a=o.toLowerCase().replace(/[\s-]+/g,"_");return t.find(s=>s.toLowerCase()===a)??r}function Ke(e,t,r){return typeof e=="string"?e.trim().slice(0,r):t}function ro(e,t,r=null){if(!Array.isArray(e)||e.length<3)return r;let o=e.slice(0,3).map(a=>Ie(a,NaN,-t,t));return o.every(Number.isFinite)?o:r}var ja={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 ot(e){if(typeof e!="string")return null;let t=e.trim().toLowerCase();if(ja[t])return ja[t];let r=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/.exec(t);if(!r)return null;let o=r[1];return "#"+(o.length===3?o.split("").map(a=>a+a).join(""):o)}var ft=new Set(["."," "]),Ga=e=>/^[A-Za-z0-9_]{1,24}$/.test(e),Fs={human:"humanoid",biped:"humanoid",person:"humanoid",animal:"quadruped",four_legs:"quadruped",quadrupedal:"quadruped",bird:"flyer",winged:"flyer",dragon:"flyer",slime:"blob",ghost:"blob",fish:"swimmer",shark:"swimmer",aquatic:"swimmer"};function Ds(e){if(typeof e!="string")return "humanoid";let t=e.trim().toLowerCase().replace(/[\s-]+/g,"_");return wr.includes(t)?t:t===Zt?Zt:Fs[t]??"humanoid"}function Ua(e,t){let r=/^(.*?)(L|R)$/.exec(e);if(!r)return e;let o=r[1]+(r[2]==="L"?"R":"L");return t(o)?o:e}function Ye(e){if(typeof e=="string"){let f=d(e);if(!f.ok)return {ok:false,error:f.error,truncated:f.truncated};e=f.value;}if(!X(e))return {ok:false,error:c({en:"the character recipe is not an object",ru:"\u0440\u0435\u0446\u0435\u043F\u0442 \u043F\u0435\u0440\u0441\u043E\u043D\u0430\u0436\u0430 \u2014 \u043D\u0435 \u043E\u0431\u044A\u0435\u043A\u0442"})};if(!("parts"in e)&&!("rig"in e)){let f=e.character??e.spec??e.characterSpec;X(f)&&(e=f);}let t=e,r=qa,o=[];typeof t.version=="number"&&t.version>Ha&&o.push(c({en:"recipe version {v} is newer than the game \u2014 read what could be read",ru:"\u0440\u0435\u0446\u0435\u043F\u0442 \u0432\u0435\u0440\u0441\u0438\u0438 {v} \u2014 \u043D\u043E\u0432\u0435\u0435 \u0438\u0433\u0440\u044B, \u0440\u0430\u0437\u043E\u0431\u0440\u0430\u043D\u043E \u0447\u0442\u043E \u043F\u043E\u043D\u044F\u0442\u043D\u043E"},{v:t.version}));let a=Ds(t.rig),n=Ae[a],s={};if(X(t.palette))for(let[f,S]of Object.entries(t.palette)){if(Object.keys(s).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 T=ot(S);if(f.length!==1||ft.has(f)||!T){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:f}));continue}s[f]=T;}let l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",i=(f,S)=>{if(typeof f!="string")return S;if(f.length===1&&s[f])return f;let T=ot(f);if(!T)return S;let C=Object.entries(s).find(([,_])=>_===T);if(C)return C[0];if(Object.keys(s).length>=r.palette)return S;let z=[...l].find(_=>!s[_]);return z?(s[z]=T,z):S},c$1={},p=0;if(X(t.textures))for(let[f,S]of Object.entries(t.textures)){if(!Ga(f)){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:f.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 T=Hs(S,s,o,f);if(T){if(p+T.w*T.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:f}));continue}p+=T.w*T.h,c$1[f]=T;}}let h=new Set(n.bones.map(f=>f.name)),m=[];for(let f of Rr(t.bones)){if(!X(f))continue;let S=Ke(f.name,"",24);if(!S||!Ga(S))continue;let T=ro(f.pivot,r.coord);if(!T||m.some(M=>M.name===S))continue;if(m.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 C=h.has(S),z=Ke(f.parent,"",24),_=C?n.bones.find(M=>M.name===S).parent??"":h.has(z)||m.some(M=>M.name===z)?z:n.bones.find(M=>M.role==="body").name;m.push({name:S,parent:_,pivot:T,role:C?"static":Io(f.role,to,"static")}),h.add(S);}let d$1=Object.keys(s)[0]??"s",b=[];for(let f of Rr(t.parts)){if(b.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(!X(f))continue;let S=ro(f.size,r.partSide),T=ro(f.pos??f.center??f.at,r.coord);if(!S||!T||S.some(V=>V<=0))continue;let C=Ke(f.bone,"",24);h.has(C)||(C&&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:C})),C=n.bones.find(V=>V.role==="body").name);let z={bone:C,size:S,pos:T,color:i(f.color,d$1)};if(X(f.faces)){let V={};for(let q of ut){let Y=f.faces[q];if(typeof Y=="string")if(c$1[Y])V[q]=Y;else {let ce=i(Y,"");ce&&(V[q]=ce);}}Object.keys(V).length&&(z.faces=V);}let _=ro(f.rot??f.rotation,180);_&&_.some(V=>V!==0)&&(z.rot=_),(f.mirror===true||f.mirror==="x")&&(z.mirror=true);let M=Ke(f.name,"",24);M&&(z.name=M),f.shape==="cylinder"&&(z.shape="cylinder"),typeof f.mat=="string"&&tr.includes(f.mat)&&(z.mat=f.mat),f.wrap===true&&(z.wrap=true),b.push(z);}if(!b.length){for(let[f,S]of Object.entries(Bs))s[f]||(s[f]=S);b.push(...n.defaultParts.map(Ns));}let u=null;if(X(t.face)){let f=t.face,S=h.has(Ke(f.bone,"",24))?Ke(f.bone,"",24):n.faceBone,T=Rr(f.rect).map(z=>Math.round(Ie(z,NaN,0,r.partSide)*10)/10),C={};if(X(f.expressions))for(let z of kr){let _=f.expressions[z];typeof _=="string"&&c$1[_]&&(C[z]=_);}if(!C.neutral){let z=Object.values(C)[0];z&&(C.neutral=z);}if(C.neutral){let z=c$1[C.neutral];if(u={bone:S,rect:T.length===4&&T.every(Number.isFinite)&&T[2]>0&&T[3]>0?T:[0,0,z.w,z.h],expressions:C},X(f.drawn)){let _=f.drawn;u.drawn={eyes:Ke(_.eyes,"round",16),brows:Ke(_.brows,"none",16),mouth:Ke(_.mouth,"smile",16),eyeColor:ot(_.eyeColor)??"#3b2a20",cheeks:_.cheeks===true};}}else Object.keys(f).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 R=X(t.style)?t.style:{},w=X(t.voice)?t.voice:{},A=X(t.finish)?t.finish:{},k={version:Ha,name:Ke(t.name,oo(),40)||oo(),description:Ke(t.description,"",300),rig:a,scale:Ie(t.scale,1,.25,3),palette:s,textures:c$1,parts:b,bones:m,face:u,style:{walk:Io(R.walk,vr,"normal"),idle:Io(R.idle,Ar,"calm"),energy:Ie(R.energy,.5,0,1)},voice:{pitch:Ie(w.pitch,1,.5,2)},tags:Rr(t.tags).filter(f=>typeof f=="string"&&!!f.trim()).slice(0,8).map(f=>f.trim().slice(0,24)),finish:{noise:Ie(A.noise,er.noise,0,1),outline:Ie(A.outline,er.outline,0,1),shade:Ie(A.shade,er.shade,0,1),density:Math.round(Ie(A.density,er.density,1,4))}},x=Ie(A.round,0,0,1);return x>0&&(k.finish.round=x),{ok:true,spec:k,warnings:o}}var Bs={s:"#c69c7c",t:"#3a8fd6",p:"#2c3e6b"};function Ns(e){return JSON.parse(JSON.stringify(e))}function Hs(e,t,r,o){let a=Array.isArray(e)?{rows:e}:X(e)?e:null;if(!a)return null;let n=qa.textureSide,s=Rr(a.rows??a.pixels).filter(p=>typeof p=="string");if(!s.length)return null;let l=Math.round(Ie(a.h??a.height,s.length,1,n)),i=Math.round(Ie(a.w??a.width,Math.max(...s.map(p=>p.length)),1,n)),c$1=false;for(s=s.slice(0,l).map(p=>{let h="";for(let m=0;m<i;m++){let d=p[m]??".";ft.has(d)||t[d]?h+=d===" "?".":d:(c$1=true,h+=".");}return h});s.length<l;)s.push(".".repeat(i));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:i,h:l,rows:s}}function _o(e){return Array.isArray(e)?"["+e.map(_o).join(",")+"]":X(e)?"{"+Object.keys(e).filter(t=>e[t]!==void 0).sort().map(t=>JSON.stringify(t)+":"+_o(e[t])).join(",")+"}":JSON.stringify(e)}function rr(e){let t=_o(e),r=b(t),o=b("~"+t);return r.toString(16).padStart(8,"0")+o.toString(16).padStart(8,"0")}function a1(e){return Ae[e.rig]}function Ka(e){let r=Ae[e.rig].bones.map(o=>{let a=e.bones.find(n=>n.name===o.name);return {name:o.name,role:o.role,parent:o.parent,pivot:(a?.pivot??o.pivot).slice()}});for(let o of e.bones)r.some(a=>a.name===o.name)||r.push({name:o.name,role:o.role,parent:o.parent,pivot:o.pivot.slice()});return r}function oo(){return c({en:"Character",ru:"\u041F\u0435\u0440\u0441\u043E\u043D\u0430\u0436"})}var n1=e=>e==="\u041F\u0435\u0440\u0441\u043E\u043D\u0430\u0436"||e==="Character";var Ya={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 Oo(e){let t=parseInt(e.slice(1),16);return [t>>16&255,t>>8&255,t&255]}function Wa(e,t,r,o,a,n){let s=((r-1-a)*t+o)*4;e[s]=n[0],e[s+1]=n[1],e[s+2]=n[2],e[s+3]=255;}function js(e,t=0){e.sort((r,o)=>o.h-r.h||o.w-r.w||(r.key<o.key?-1:1));for(let r=16;;r*=2){let o=0,a=0,n=0;for(let l of e)o+l.w+t*2>r&&(o=0,a+=n,n=0),l.x=o+t,l.y=a+t,o+=l.w+t*2,n=Math.max(n,l.h+t*2);let s=a+n;if(s<=r||r>=1024){let l=16;for(;l<s;)l*=2;return {w:r,h:l}}}}function Gs(e,t,r,o,a){let n=(s,l)=>((r-1-o.y-l)*t+o.x+s)*4;for(let s=-a;s<o.h+a;s++)for(let l=-a;l<o.w+a;l++){let i=Math.max(0,Math.min(o.w-1,l)),c=Math.max(0,Math.min(o.h-1,s));if(i===l&&c===s)continue;let p=n(i,c);e.copyWithin(n(l,s),p,p+4);}}function $a(e,t,r){let o=Math.imul(t,374761393)+Math.imul(r,668265263)+Math.imul(e,2246822519);return o=Math.imul(o^o>>>13,1274126177),((o^o>>>16)>>>0)/4294967296}function qs(e,t,r,o,a,n,s,l){let c=1+(.55*$a(s,t,r)+.45*$a(s^1540483477,Math.floor(t/3),Math.floor(r/3))-.5)*2*l.noise*.14;return n==="s"?c+=l.shade*.16*(.5-(r+.5)/a):n==="t"?c+=l.shade*.08:c-=l.shade*.2,o>=3&&a>=3&&(t===0||r===0||t===o-1||r===a-1)&&(c*=1-.5*l.outline),[Math.max(0,Math.min(255,e[0]*c)),Math.max(0,Math.min(255,e[1]*c)),Math.max(0,Math.min(255,e[2]*c))]}var or=Math.PI/180;function ar(e,t){if(!t)return e;let[r,o,a]=e,[n,s,l]=[t[0]*or,t[1]*or,t[2]*or],i=Math.cos(l),c=Math.sin(l);return [r,o]=[r*i-o*c,r*c+o*i],i=Math.cos(s),c=Math.sin(s),[r,a]=[r*i+a*c,-r*c+a*i],i=Math.cos(n),c=Math.sin(n),[o,a]=[o*i-a*c,o*c+a*i],[r,o,a]}function Us(e,t){let r=[];for(let o of e.parts){if(r.push({...o,flip:false}),!o.mirror)continue;let a=o.faces?{...o.faces,left:o.faces.right,right:o.faces.left}:void 0;a&&(a.left===void 0&&delete a.left,a.right===void 0&&delete a.right);let n={...o,bone:Ua(o.bone,t),pos:[-o.pos[0],o.pos[1],o.pos[2]],flip:true};a?n.faces=a:delete n.faces,o.rot&&(n.rot=[o.rot[0],-o.rot[1],-o.rot[2]]),r.push(n);}return r}function Qa(e){let t=Ae[e.rig],r=Ka(e),o=v=>r.some(O=>O.name===v),a=Us(e,o),n=e.finish??er,s=n.round??0,l=new Map,i=(v,O)=>{let F=v.faces?.[O],H=F!==void 0?e.textures[F]:void 0,me=F!==void 0&&e.palette[F]?F:v.color,[Ce,Ne]=O==="front"||O==="back"?[v.size[0],v.size[1]]:O==="left"||O==="right"?[v.size[2],v.size[1]]:[v.size[0],v.size[2]],Pe=(gr,qe)=>Math.max(1,Math.min(64,qe*Math.max(1,Math.round(gr*n.density/qe)))),ve=H?Pe(Ce,H.w):Pe(Ce,1),ze=H?Pe(Ne,H.h):Pe(Ne,1),Fe=O==="top"?"t":O==="bottom"?"b":"s",re=(H?"t:"+F:"c:"+me)+"|"+ve+"x"+ze+Fe,fe=l.get(re);if(fe)return fe;let $=b(re),Pt=H?null:Oo(e.palette[me]??"#ff00ff");return fe={key:re,w:ve,h:ze,x:0,y:0,paint:(gr,qe,Xr,Jr,Qr)=>{for(let pt=0;pt<ze;pt++)for(let mt=0;mt<ve;mt++){let xr=Pt;if(H){let Zr=H.rows[Math.floor(pt*H.h/ze)][Math.floor(mt*H.w/ve)];if(ft.has(Zr))continue;let Ue=e.palette[Zr];if(!Ue)continue;xr=Oo(Ue);}Wa(gr,qe,Xr,Jr+mt,Qr+pt,qs(xr,mt,pt,ve,ze,Fe,$,n));}}},l.set(re,fe),fe},c=(v,O)=>{let F="e:"+v,H=l.get(F);return H||(H={key:F,w:O.w,h:O.h,x:0,y:0,paint:(me,Ce,Ne,Pe,ve)=>{for(let ze=0;ze<O.h;ze++)for(let Fe=0;Fe<O.w;Fe++){let re=O.rows[ze][Fe];if(ft.has(re))continue;let fe=e.palette[re];fe&&Wa(me,Ce,Ne,Pe+Fe,ve+ze,Oo(fe));}}},l.set(F,H)),H},p=a.map(v=>({p:v,faces:ut.map(O=>({f:O,cell:i(v,O)}))})),h=e.face,m=[];if(h)for(let[v,O]of Object.entries(h.expressions)){let F=e.textures[O];F&&m.push([v,c(O,F)]);}let d=s>0?2:0,{w:b$1,h:u}=js([...l.values()],d),R=new Uint8Array(b$1*u*4);for(let v of l.values())v.paint(R,b$1,u,v.x,v.y),d&&Gs(R,b$1,u,v,d);let w=.01,A=(v,O=w)=>[(v.x+O)/b$1,1-(v.y+O)/u,(v.x+v.w-O)/b$1,1-(v.y+v.h-O)/u],k=new Map;for(let v of r)k.set(v.name,{pos:[],nrm:[],uv:[],idx:[]});let x=new Map,f=v=>{let O=x.get(v);if(O===void 0){O=true;for(let F=0;F<v.h&&O;F++)for(let H=0;H<v.w;H++)if(R[((u-1-v.y-F)*b$1+v.x+H)*4+3]<128){O=false;break}x.set(v,O);}return O},S=new Map;for(let{p:v}of p)v.shape==="cylinder"&&!S.has(v.bone)&&S.set(v.bone,v);let T=v=>!!v.wrap&&S.has(v.bone),C=new Map;for(let{p:v,faces:O}of p)if(v.shape!=="cylinder"&&v.mat!=="glass"&&O.every(({cell:F})=>f(F))){let F=C.get(v.bone)??[];F.push(v),C.set(v.bone,F);}let z=new Map,_=v=>{if(!v.mat)return k.get(v.bone);let O=v.mat+"|"+v.bone,F=z.get(O);return F||z.set(O,F={bone:v.bone,mat:v.mat,pos:[],nrm:[],uv:[],idx:[]}),F},M=0;for(let{p:v,faces:O}of p){let F=_(v),H=r.find(re=>re.name===v.bone).pivot,me=[v.size[0]/2,v.size[1]/2,v.size[2]/2];if(M=Math.max(M,v.pos[1]+me[1]),v.shape==="cylinder"){for(let{f:re,cell:fe}of O)ei(F,v,me,Ya[re],H,A(fe,.5));continue}let Ce=T(v),Ne=Ce?S.get(v.bone):void 0,Pe=(C.get(v.bone)??[]).filter(re=>re!==v&&T(re)===Ce),ve=Math.min(v.size[0],v.size[1],v.size[2])<en?0:s,ze=Math.min(v.size[0],v.size[1],v.size[2])>=$s?Ws:Ys,Fe=(re,fe)=>{let $=Ya[re],Pt=(Ue,ht)=>{let Qt=[me[0]*($.tl[0]+2*($.u[0]*Ue+$.d[0]*ht)),me[1]*($.tl[1]+2*($.u[1]*Ue+$.d[1]*ht)),me[2]*($.tl[2]+2*($.u[2]*Ue+$.d[2]*ht))],dt=ar(Qt,v.rot);return [v.pos[0]+dt[0]-H[0],v.pos[1]+dt[1]-H[1],v.pos[2]+dt[2]-H[2]]},gr=ar($.n,v.rot),qe=F.pos.length/3,[Xr,Jr,Qr,pt]=A(fe),[mt,xr]=v.flip?[Qr,Xr]:[Xr,Qr];if(ve>0||Ce){let[Ue,ht,Qt,dt]=A(fe,.5);Xs(F,v,me,$,H,ve,ze,v.flip?[Qt,ht,Ue,dt]:[Ue,ht,Qt,dt],Ce);return}let Zr=[[0,0,mt,Jr],[1,0,xr,Jr],[1,1,xr,pt],[0,1,mt,pt]];for(let[Ue,ht,Qt,dt]of Zr)F.pos.push(...Pt(Ue,ht)),F.nrm.push(...gr),F.uv.push(Qt,dt);F.idx.push(qe,qe+2,qe+1,qe,qe+3,qe+2);};for(let{f:re,cell:fe}of O){let $=[F.pos.length,F.nrm.length,F.uv.length,F.idx.length];Fe(re,fe),Pe.length&&hi(F.pos,$[0],H,Pe,s)?(F.pos.length=$[0],F.nrm.length=$[1],F.uv.length=$[2],F.idx.length=$[3]):Ne&&(ii(F,$[0],H,Ne,ai(v,me,Ne)),si(F.pos,$[0],H,Ne)&&(F.pos.length=$[0],F.nrm.length=$[1],F.uv.length=$[2],F.idx.length=$[3]));}}let V=r.map(v=>{let O=k.get(v.name);return {name:v.name,role:v.role,parent:v.parent,pivot:v.pivot,positions:Float32Array.from(O.pos),normals:Float32Array.from(O.nrm),uvs:Float32Array.from(O.uv),indices:Uint16Array.from(O.idx)}}),q=[...z.values()].map(v=>({bone:v.bone,mat:v.mat,positions:Float32Array.from(v.pos),normals:Float32Array.from(v.nrm),uvs:Float32Array.from(v.uv),indices:Uint16Array.from(v.idx)})),Y=null;if(h&&m.length){let v=e.parts.filter(H=>H.bone===h.bone),O=v.find(H=>H.name===h.bone)??v.sort((H,me)=>me.size[0]*me.size[1]*me.size[2]-H.size[0]*H.size[1]*H.size[2])[0],F=r.find(H=>H.name===h.bone);if(O&&F&&O.shape==="cylinder"){let H={};for(let[me,Ce]of m)H[me]=A(Ce);Y=pi(h.bone,O,h.rect,F.pivot,H);}else if(O&&F){let[H,me,Ce,Ne]=h.rect,Pe=O.pos[0]+O.size[0]/2-H,ve=O.pos[1]+O.size[1]/2-me,ze=O.pos[2]-O.size[2]/2-.05,Fe=F.pivot,re=($,Pt)=>[$-Fe[0],Pt-Fe[1],ze-Fe[2]],fe={};for(let[$,Pt]of m)fe[$]=A(Pt);Y={bone:h.bone,corners:Float32Array.from([...re(Pe,ve),...re(Pe-Ce,ve),...re(Pe-Ce,ve-Ne),...re(Pe,ve-Ne)]),uv:fe};}}let ce=t.sockets.filter(v=>o(v.bone)).map(v=>{let O=t.bones.find(F=>F.name===v.bone);return {name:v.name,bone:v.bone,at:[v.at[0]-O.pivot[0],v.at[1]-O.pivot[1],v.at[2]-O.pivot[2]]}}),pe=Math.max(1,M),se=pe>t.height.max?t.height.max/pe:pe<t.height.min?t.height.min/pe:1;return {hash:rr(e),rig:e.rig,bones:V,mats:q,atlas:{w:b$1,h:u,data:R},face:Y,sockets:ce,height:pe,scale:e.scale*se,eye:t.eye*pe/di(e.rig)}}var Za=3,Ks=2.5,Ys=1,Xa=0,Ws=2,$s=4.1;function Xs(e,t,r,o,a,n,s,l,i=false){let c=Math.min(r[0],r[1],r[2]),p=i?0:Math.min(c,n*Za),h=Math.min(c,p*Ks),m=[r[0]-p,r[1]-p,r[2]-p],d=[r[0]-h,r[1]-h,r[2]-h],b=C=>Math.abs(C[0])*t.size[0]+Math.abs(C[1])*t.size[1]+Math.abs(C[2])*t.size[2],u=C=>{let z=[];for(let M=0;M<=s;M++)z.push(Math.min(.5,p*M/s/C));if(!i)for(let M=1;M<=Xa;M++)z.push(Math.min(.5,(p+(h-p)*M/Xa)/C));if(i){let M=Math.max(1,Math.min(Qs,Math.ceil(C/Js)));for(let V=1;V<M;V++)z.push(Fo(V/M));}let _=[...z,...z.map(M=>1-M)].sort((M,V)=>M-V);return _.filter((M,V)=>V===0||M-_[V-1]>1e-6)},R=u(b(o.u)),w=u(b(o.d)),A=e.pos.length/3,[k,x,f,S]=l;for(let C of w)for(let z of R){let _=[0,0,0],M=[0,0,0],V=[0,0,0];for(let O=0;O<3;O++){let F=r[O]*(o.tl[O]+2*(o.u[O]*z+o.d[O]*C)),H=Math.max(-m[O],Math.min(m[O],F));M[O]=F-H,_[O]=H,V[O]=F-Math.max(-d[O],Math.min(d[O],F));}let q=Math.hypot(M[0],M[1],M[2]),Y=q>1e-9?[M[0]/q,M[1]/q,M[2]/q]:[o.n[0],o.n[1],o.n[2]],ce=Math.hypot(V[0],V[1],V[2]),pe=ce>1e-9?[V[0]/ce,V[1]/ce,V[2]/ce]:Y,se=[_[0]+Y[0]*p,_[1]+Y[1]*p,_[2]+Y[2]*p],v=ar(se,t.rot);e.pos.push(t.pos[0]+v[0]-a[0],t.pos[1]+v[1]-a[1],t.pos[2]+v[2]-a[2]),e.nrm.push(...ar(pe,t.rot)),e.uv.push(k+(f-k)*z,x+(S-x)*C);}let T=R.length;for(let C=0;C+1<w.length;C++)for(let z=0;z+1<T;z++){let _=A+C*T+z;e.idx.push(_,_+T+1,_+1,_,_+T,_+T+1);}}var en=.45,Js=1.5,Qs=5,Zs=10,Ja=.6,Fo=e=>(1-Ja)*e+Ja*(.5+.5*Math.sin(Math.PI*(e-.5))),Er=4,ao=1.12,tn=.35;function rn(e,t,r){let o=e*e,a=t*t,n=r*r;return [e*Math.sqrt(Math.max(0,1-a/2-n/2+a*n/3)),t*Math.sqrt(Math.max(0,1-n/2-o/2+n*o/3)),r*Math.sqrt(Math.max(0,1-o/2-a/2+o*a/3))]}function on(e){let t=Er,r=Math.pow(Math.pow(e[0]*e[0]+e[2]*e[2],t/2)+Math.pow(Math.abs(e[1]),t),1/t)||1;return [e[0]/r,e[1]/r,e[2]/r]}function Do(e,t){let r=Er,o=Math.pow(e[0]*e[0]+e[2]*e[2],(r-2)/2),a=[e[0]*o,Math.sign(e[1])*Math.pow(Math.abs(e[1]),r-1),e[2]*o],n=[a[0]/t[0],a[1]/t[1],a[2]/t[2]],s=Math.hypot(n[0],n[1],n[2])||1;return [n[0]/s,n[1]/s,n[2]/s]}function ei(e,t,r,o,a,n){let s=Zs,l=e.pos.length/3,[i,c,p,h]=n;for(let d=0;d<=s;d++)for(let b=0;b<=s;b++){let u=Fo(b/s),R=Fo(d/s),w=[0,0,0];for(let x=0;x<3;x++)w[x]=o.tl[x]+2*(o.u[x]*u+o.d[x]*R);let A=on(rn(w[0],w[1],w[2])),k=ar([r[0]*A[0],r[1]*A[1],r[2]*A[2]],t.rot);e.pos.push(t.pos[0]+k[0]-a[0],t.pos[1]+k[1]-a[1],t.pos[2]+k[2]-a[2]),e.nrm.push(...ar(Do(A,r),t.rot)),e.uv.push(i+(p-i)*u,c+(h-c)*R);}let m=s+1;for(let d=0;d<s;d++)for(let b=0;b<s;b++){let u=l+d*m+b;e.idx.push(u,u+m+1,u+1,u,u+m,u+m+1);}}function ti(e,t){let r=[t.size[0]/2,t.size[1]/2,t.size[2]/2],o=[(e[0]-t.pos[0])/r[0],(e[1]-t.pos[1])/r[1],(e[2]-t.pos[2])/r[2]],a=Math.max(Math.abs(o[0]),Math.abs(o[1]),Math.abs(o[2]));if(a<1e-6)return {p:e,w:0,s:[0,1,0]};let n=on(rn(o[0]/a,o[1]/a,o[2]/a)),s=a<=ao?1:Math.max(0,1-(a-ao)/tn),l=s*s*(3-2*s),i=[t.pos[0]+r[0]*n[0]*a,t.pos[1]+r[1]*n[1]*a,t.pos[2]+r[2]*n[2]*a];return {p:[e[0]+(i[0]-e[0])*l,e[1]+(i[1]-e[1])*l,e[2]+(i[2]-e[2])*l],w:l,s:n}}var ri=1.25,oi=.85;function ai(e,t,r){if(e.rot)return false;let o=(e.pos[1]+t[1]-r.pos[1])/(r.size[1]/2),a=Math.max(t[0]/(r.size[0]/2),t[2]/(r.size[2]/2));return o>ri&&a>=oi}function ni(e,t){let r=t.size[0]/2,o=t.size[2]/2,a=(e[0]-t.pos[0])/r,n=(e[2]-t.pos[2])/o,s=Math.max(Math.abs(a),Math.abs(n));if(s<1e-6)return {p:e,w:0,s:[0,1,0]};let l=a/s,i=n/s,c=l*Math.sqrt(Math.max(0,1-i*i/2)),p=i*Math.sqrt(Math.max(0,1-l*l/2)),h=s<=ao?1:Math.max(0,1-(s-ao)/tn),m=h*h*(3-2*h),d=t.pos[0]+r*c*s,b=t.pos[2]+o*p*s;return {p:[e[0]+(d-e[0])*m,e[1],e[2]+(b-e[2])*m],w:m,s:[c,0,p]}}function si(e,t,r,o){let a=Er;for(let n=t;n<e.length;n+=3){let s=(e[n]+r[0]-o.pos[0])/(o.size[0]/2),l=(e[n+1]+r[1]-o.pos[1])/(o.size[1]/2),i=(e[n+2]+r[2]-o.pos[2])/(o.size[2]/2);if(Math.pow(Math.pow(s*s+i*i,a/2)+Math.pow(Math.abs(l),a),1/a)>.97)return false}return true}function ii(e,t,r,o,a=false){let n=[o.size[0]/2,o.size[1]/2,o.size[2]/2];for(let s=t;s<e.pos.length;s+=3){let l=[e.pos[s]+r[0],e.pos[s+1]+r[1],e.pos[s+2]+r[2]],{p:i,w:c,s:p}=a?ni(l,o):ti(l,o);if(e.pos[s]=i[0]-r[0],e.pos[s+1]=i[1]-r[1],e.pos[s+2]=i[2]-r[2],c<=0)continue;let h=[e.nrm[s],e.nrm[s+1],e.nrm[s+2]],m=[l[0]-o.pos[0],l[1]-o.pos[1],l[2]-o.pos[2]],d=Math.hypot(m[0],m[1],m[2])||1;if((h[0]*m[0]+h[1]*m[1]+h[2]*m[2])/d<.3||a&&Math.abs(h[1])>.7)continue;let b=Do(p,n),u=[h[0]+(b[0]-h[0])*c,h[1]+(b[1]-h[1])*c,h[2]+(b[2]-h[2])*c],R=Math.hypot(u[0],u[1],u[2])||1;e.nrm[s]=u[0]/R,e.nrm[s+1]=u[1]/R,e.nrm[s+2]=u[2]/R;}}var Vo=.16,li=12,ci=12;function pi(e,t,r,o,a){let n=[t.size[0]/2,t.size[1]/2,t.size[2]/2],[s,l,i,c]=r,p=t.pos[0]+n[0]-s,h=t.pos[1]+n[1]-l,m=li,d=ci,b=new Float32Array((m+1)*(d+1)*3),u=new Float32Array((m+1)*(d+1)*3),R=new Float32Array((m+1)*(d+1)*2),w=0;for(let k=0;k<=d;k++)for(let x=0;x<=m;x++){let f=x/m,S=k/d,T=p-i*f,C=h-c*S,z=(T-t.pos[0])/n[0],_=(C-t.pos[1])/n[1],M=Math.pow(Math.max(0,1-Math.pow(Math.min(1,Math.abs(_)),Er)),1/Er),V=-Math.sqrt(Math.max(.02,M*M-z*z)),q=Do([z,_,V],n);b[w*3]=T+q[0]*Vo-o[0],b[w*3+1]=C+q[1]*Vo-o[1],b[w*3+2]=t.pos[2]+n[2]*V+q[2]*Vo-o[2],u.set(q,w*3),R[w*2]=f,R[w*2+1]=S,w++;}let A=(k,x)=>[k-o[0],x-o[1],t.pos[2]-n[2]-o[2]];return {bone:e,corners:Float32Array.from([...A(p,h),...A(p-i,h),...A(p-i,h-c),...A(p,h-c)]),uv:a,grid:{cols:m,rows:d,positions:b,normals:u,t:R}}}function mi(e,t){if(!t)return e;let[r,o,a]=e,[n,s,l]=[-t[0]*or,-t[1]*or,-t[2]*or],i=Math.cos(n),c=Math.sin(n);return [o,a]=[o*i-a*c,o*c+a*i],i=Math.cos(s),c=Math.sin(s),[r,a]=[r*i+a*c,-r*c+a*i],i=Math.cos(l),c=Math.sin(l),[r,o]=[r*i-o*c,r*c+o*i],[r,o,a]}function hi(e,t,r,o,a){for(let s of o){let l=[s.size[0]/2,s.size[1]/2,s.size[2]/2],i=Math.min(s.size[0],s.size[1],s.size[2])<en?0:a,c=i>0?Math.min(l[0],l[1],l[2],i*Za):0,p=true;for(let h=t;h<e.length&&p;h+=3){let m=mi([e[h]+r[0]-s.pos[0],e[h+1]+r[1]-s.pos[1],e[h+2]+r[2]-s.pos[2]],s.rot),d=Math.abs(m[0])-(l[0]-c),b=Math.abs(m[1])-(l[1]-c),u=Math.abs(m[2])-(l[2]-c);Math.hypot(Math.max(d,0),Math.max(b,0),Math.max(u,0))+Math.min(Math.max(d,b,u),0)-c>=-0.01&&(p=false);}if(p)return true}return false}function di(e){let t=1;for(let r of Ae[e].defaultParts)t=Math.max(t,r.pos[1]+r.size[1]/2);return t}var Bo=new Map;function ui(e){let t=new Map;for(let i of e.bones){if(!i.indices.length){t.set(i.name,null);continue}let c=new B.BufferGeometry;c.setAttribute("position",new B.BufferAttribute(i.positions,3)),c.setAttribute("normal",new B.BufferAttribute(i.normals,3)),c.setAttribute("uv",new B.BufferAttribute(i.uvs,2)),c.setIndex(new B.BufferAttribute(i.indices,1)),c.computeBoundingSphere(),c.userData.shared=true,t.set(i.name,c);}let r=an(e.bones,e),o=new Map;for(let i of new Set(e.mats.map(c=>c.mat))){let c=e.mats.filter(h=>h.mat===i).map(h=>({...h,pivot:e.bones.find(m=>m.name===h.bone).pivot})),p=an(c,e);p&&o.set(i,p);}let{w:a,h:n,data:s}=e.atlas,l=new B.DataTexture(s,a,n,B.RGBAFormat);return l.magFilter=B.NearestFilter,l.minFilter=B.NearestFilter,l.generateMipmaps=false,l.colorSpace=B.SRGBColorSpace,l.needsUpdate=true,{layout:e,geometries:t,skinned:r,skinnedMats:o,texture:l,refs:0}}function an(e,t){let r=b=>t.bones.findIndex(u=>u.name===(b.bone??b.name)),o=0,a=0;for(let b of e)o+=b.positions.length/3,a+=b.indices.length;if(!a)return null;let n=new Float32Array(o*3),s=new Float32Array(o*3),l=new Float32Array(o*2),i=new Uint16Array(o*4),c=new Float32Array(o*4),p=o>65535?new Uint32Array(a):new Uint16Array(a),h=0,m=0;e.forEach(b=>{let u=r(b),R=b.positions.length/3;for(let w=0;w<R;w++)n[(h+w)*3]=b.positions[w*3]+b.pivot[0],n[(h+w)*3+1]=b.positions[w*3+1]+b.pivot[1],n[(h+w)*3+2]=b.positions[w*3+2]+b.pivot[2],i[(h+w)*4]=u,c[(h+w)*4]=1;s.set(b.normals,h*3),l.set(b.uvs,h*2);for(let w=0;w<b.indices.length;w++)p[m+w]=b.indices[w]+h;h+=R,m+=b.indices.length;});let d=new B.BufferGeometry;return d.setAttribute("position",new B.BufferAttribute(n,3)),d.setAttribute("normal",new B.BufferAttribute(s,3)),d.setAttribute("uv",new B.BufferAttribute(l,2)),d.setAttribute("skinIndex",new B.Uint16BufferAttribute(i,4)),d.setAttribute("skinWeight",new B.BufferAttribute(c,4)),d.setIndex(new B.BufferAttribute(p,1)),d.computeBoundingSphere(),d.userData.shared=true,d}function No(e){let t=Bo.get(rr(e));return t||(t=ui(Qa(e)),Bo.set(t.layout.hash,t)),t.refs++,t}function no(e){if(!(--e.refs>0)){Bo.delete(e.layout.hash);for(let t of e.geometries.values())t?.dispose();e.skinned?.dispose();for(let t of e.skinnedMats.values())t.dispose();e.texture.dispose();}}var U=class e{constructor(t,r,o="."){this.w=t;this.h=r;this.g=Array.from({length:r},()=>new Array(t).fill(o));}w;h;g;px(t,r,o){return t>=0&&r>=0&&t<this.w&&r<this.h&&(this.g[r][t]=o),this}rect(t,r,o,a,n){for(let s=r;s<r+a;s++)for(let l=t;l<t+o;l++)this.px(l,s,n);return this}row(t,r,o,a){return this.rect(r,t,o-r+1,1,a)}col(t,r,o,a){return this.rect(t,r,1,o-r+1,a)}where(t,r){for(let o=0;o<this.h;o++)for(let a=0;a<this.w;a++)t(a,o)&&this.px(a,o,r);return this}flipped(){let t=new e(this.w,this.h);for(let r=0;r<this.h;r++)for(let o=0;o<this.w;o++)t.px(this.w-1-o,r,this.g[r][o]);return t}tex(){return {w:this.w,h:this.h,rows:this.g.map(t=>t.join(""))}}};var fi={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 at(e,t){let r=parseInt(e.slice(1),16);return "#"+[r>>16&255,r>>8&255,r&255].map(a=>Math.max(0,Math.min(255,Math.round(a*t)))).map(a=>a.toString(16).padStart(2,"0")).join("")}function jo(e,t){let r={...e};return t.skin&&(r.s=t.skin,r.S=at(t.skin,.86),r.m=at(t.skin,.66)),t.hair&&(r.h=t.hair,r.H=at(t.hair,1.25),r.k=at(t.hair,.6)),t.shirt&&(r.t=t.shirt,r.T=at(t.shirt,1.15),r.D=at(t.shirt,.8)),t.pants&&(r.p=t.pants,r.P=at(t.pants,.8)),t.boots&&(r.z=t.boots,r.Z=at(t.boots,.78)),t.eyes&&(r.b=t.eyes),r}var bi=new U(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"),nn=new U(16,16,"s").rect(0,0,16,4,"h").rect(7,4,9,7,"h").rect(10,11,6,2,"h").rect(5,7,2,3,"S").row(1,2,13,"H").where((e,t)=>t>4&&t<11&&e>8&&(e+t)%4===0,"k"),yi=nn.flipped(),gi=new U(16,16,"h").where((e,t)=>(e+2*t)%5===0,"H").where((e,t)=>t>8&&(e*3+t)%7===0,"k").rect(4,14,8,2,"s"),xi=new U(16,16,"h").where((e,t)=>(e+2*t)%5===0,"H").where((e,t)=>(3*e+t)%9===0,"k"),wi=new U(18,4,"h").where((e,t)=>(e*7+t*3)%5===0,"H").where((e,t)=>t===3&&e*5%3===0,"k"),Ri=new U(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"),ki=new U(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"),vi=new U(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"),Ai=new U(16,2,"B").rect(7,0,2,2,"g").px(3,0,"k").px(12,0,"k"),Ei=new U(6,24,"s").row(23,0,5,"S").col(2,21,23,"S"),Si=new U(8,13,"t").col(0,0,9,"D").row(9,0,7,"D").rect(0,10,8,3,"T").row(12,0,7,"D"),Ti=new U(8,24,"p").col(4,1,21,"P").row(0,0,7,"P"),Mi=new U(8,24,"p").col(3,0,21,"P").row(0,0,7,"P"),Li=new U(8,24,"p").col(3,0,21,"P"),Ci=new U(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"),Pi=new U(10,9,"z").row(0,0,9,"Z").rect(0,7,10,2,"Z").col(5,1,6,"Z");function Je(e){let t=new U(16,10,"."),r=(a,n,s)=>{if(e.brows==="flat")t.row(1,a,a+2,"k");else if(e.brows==="high")t.row(0,a,a+2,"k");else {let l=e.brows==="down"?1:0,i=1-l;t.px(n,l,"k").px(a+1,e.brows==="down"?0:1,"k"),t.px(s,i,"k");}};r(3,5,3),r(10,10,12);let o=a=>{if(e.eyes===0){t.row(3,a,a+2,"k");return}let n=e.eyes===3||e.eyes===2?2:3;for(let s=n;s<n+e.eyes;s++)t.px(a,s,"w").px(a+1,s,"b").px(a+2,s,"w");};switch(o(3),o(10),e.mouth){case "line":t.row(7,6,9,"m");break;case "smile":t.px(5,6,"m").px(10,6,"m").row(7,6,9,"m");break;case "frown":t.row(7,6,9,"m").px(5,8,"m").px(10,8,"m");break;case "open":t.rect(6,7,4,2,"o");break;case "small":t.rect(7,7,2,2,"o");break;case "wide":t.row(7,5,10,"m").rect(6,8,4,1,"o");break}return t}var sn={f_neutral:Je({brows:"flat",eyes:2,mouth:"line"}),f_blink:Je({brows:"flat",eyes:0,mouth:"line"}),f_happy:Je({brows:"high",eyes:2,mouth:"smile"}),f_sad:Je({brows:"up",eyes:2,mouth:"frown"}),f_angry:Je({brows:"down",eyes:1,mouth:"wide"}),f_surprised:Je({brows:"high",eyes:3,mouth:"small"}),f_scared:Je({brows:"up",eyes:3,mouth:"open"}),f_tired:Je({brows:"flat",eyes:1,mouth:"line"}),f_hurt:Je({brows:"down",eyes:0,mouth:"open"}),f_talk:Je({brows:"flat",eyes:2,mouth:"open"})},zi=new U(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"),Ii=new U(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"),_i=new U(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"),Oi=new U(8,9,"t").row(3,0,7,"D").rect(0,7,8,2,"T"),so=(e,t)=>e.row(t-1,0,e.w-1,"D").where((r,o)=>o>=t&&o<=t+3&&(r+o)%2===0,"T").row(t+4,0,e.w-1,"D"),Vi=so(new U(16,24,"t"),6).row(0,6,9,"s").row(0,4,5,"T").row(0,10,11,"T").row(1,4,11,"T").where((e,t)=>t>=18&&t<=19&&e%2===0,"D").where((e,t)=>t>=18&&t<=19&&e%2===1,"T").rect(0,20,16,4,"p"),Fi=so(new U(16,24,"t"),6).row(0,4,11,"T").where((e,t)=>t>=18&&t<=19,"D").rect(0,20,16,4,"p"),Di=so(new U(8,24,"t"),6).where((e,t)=>t>=18&&t<=19,"D").rect(0,20,8,4,"p"),Bi=so(new U(8,22,"t"),9).where((e,t)=>t>=19&&e%2===0,"D"),ln=e=>new U(8,24,"s").rect(0,0,8,12,"p").col(e,1,10,"P").row(11,0,7,"P").row(12,0,7,"S").rect(0,19,8,5,"l"),Ni=ln(4),Hi=ln(3),ji=new U(9,5,"z").row(1,3,5,"l").rect(0,3,9,2,"l"),Gi=new U(10,5,"z").row(1,3,6,"Z").rect(0,3,10,2,"l"),qi=new U(17,6,"a").rect(0,4,17,2,"A"),Ui=new U(22,22,"a").where((e,t)=>(e*3+t*5)%11===0,"A"),Ki=new U(17,20,"h").where((e,t)=>(e*5+t)%4===0,"H").where((e,t)=>t>10&&(e*3+t*2)%7===0,"k"),J=e=>e.tex(),cn=["shirt","tee","sweater"],pn=["pants","shorts"],mn=["boots","sneakers"],g1=["short","long","curly","none"],_t=(e,t={})=>({front:e,back:e,left:e,right:e,...t});function Go(e={}){let t=e.top??"shirt",r=e.bottom??"pants",o=e.shoes??"boots",a=e.hair??"short",n=jo(fi,e.colors??{});n={...n,a:e.colors?.hat??"#d9c9a3"},n.A=at(n.a,.72);let s={head_front:J(bi),head_left:J(nn),head_right:J(yi),head_back:J(gi),hair_top:J(xi),hair_band:J(wi),arm_skin:J(Ei),...Object.fromEntries(Object.entries(sn).map(([b,u])=>[b,J(u)]))},l=[{name:"head",bone:"head",size:[8,8,8],pos:[0,28,0],color:"s",faces:{front:"head_front",left:"head_left",right:"head_right",back:"head_back",top:"hair_top"}},{name:"nose",bone:"head",size:[1,1.5,.8],pos:[0,26.9,-4.4],color:"S",faces:{front:"s"}}];if(a!=="none"){if(e.hat||l.push({name:"hair",bone:"head",size:a==="curly"?[9,2.2,9]:[8.6,1.6,8.6],pos:[0,a==="curly"?32.5:32.2,.15],color:"h",faces:_t("hair_band",{top:"hair_top"})}),a==="curly"&&!e.hat)for(let[b,u]of [[-2,-1.5],[2,.5],[-0.5,2.5]])l.push({name:"curl",bone:"head",size:[3.2,1.4,3.2],pos:[b,33.9,u],color:"h",faces:_t("hair_band",{top:"hair_top"})});a==="long"?(s.hair_long=J(Ki),l.push({name:"hairLong",bone:"head",size:[8.8,10,1],pos:[0,27,4.4],color:"h",faces:_t("hair_long",{top:"hair_top"})},{name:"hairSide",bone:"head",size:[.8,9,6],pos:[-4.4,27.5,1],color:"h",faces:_t("hair_long",{top:"hair_top"}),mirror:true})):l.push({name:"hairBack",bone:"head",size:[8.6,5,.8],pos:[0,29.6,4.25],color:"h",faces:{back:"head_back",left:"hair_band",right:"hair_band"}});}e.hat&&(s.hat_crown=J(qi),s.hat_brim=J(Ui),l.push({name:"hatBrim",bone:"head",size:[11,.8,11],pos:[0,32.4,0],color:"a",faces:{top:"hat_brim",bottom:"hat_brim"}},{name:"hatCrown",bone:"head",size:[8.4,3,8.4],pos:[0,34.3,0],color:"a",faces:_t("hat_crown")}));let i={shirt:[Ri,ki,vi],tee:[zi,Ii,_i],sweater:[Vi,Fi,Di]},[c$1,p,h]=i[t];s.top_front=J(c$1),s.top_back=J(p),s.top_side=J(h),l.push({name:"torso",bone:"body",size:[8,12,4],pos:[0,18,0],color:"t",faces:{front:"top_front",back:"top_back",left:"top_side",right:"top_side",bottom:"p"}}),t==="shirt"&&(s.belt=J(Ai),l.push({name:"belt",bone:"body",size:[8.4,1,4.4],pos:[0,13.5,0],color:"B",faces:{front:"belt",back:"belt"}})),l.push({name:"arm",bone:"armL",size:[3,12,3],pos:[-5.5,18,0],color:"s",faces:_t("arm_skin",{top:"t",bottom:"S"}),mirror:true});let m=t==="sweater"?11:t==="tee"?4.5:6.5;s.sleeve=J(t==="sweater"?Bi:t==="tee"?Oi:Si),l.push({name:"sleeve",bone:"armL",size:[3.6,m,3.6],pos:[-5.5,24-m/2,0],color:"t",faces:_t("sleeve",{bottom:"D"}),mirror:true}),r==="shorts"?(s.leg_front=J(Ni),s.leg_side=J(Hi)):(s.leg_front=J(Ti),s.leg_back=J(Mi),s.leg_side=J(Li)),l.push({name:"leg",bone:"legL",size:[4,12,4],pos:[-2,6,0],color:"p",faces:{front:"leg_front",back:r==="shorts"?"leg_front":"leg_back",left:"leg_side",right:"leg_side"},mirror:true}),o==="boots"?(s.shoe_front=J(Ci),s.shoe_side=J(Pi)):(s.shoe_front=J(ji),s.shoe_side=J(Gi));let d=o==="boots"?4.5:2.5;return l.push({name:"shoe",bone:"legL",size:[4.6,d,5.2],pos:[-2,d/2,-0.3],color:"z",faces:{front:"shoe_front",back:"shoe_side",left:"shoe_side",right:"shoe_side",bottom:"Z"},mirror:true}),{version:1,name:e.name??c({en:"Traveler",ru:"\u041F\u0443\u0442\u043D\u0438\u043A"}),description:e.description??c({en:"A traveler in a shirt with pockets, trousers and laced boots",ru:"\u041F\u0443\u0442\u043D\u0438\u043A \u0432 \u0440\u0443\u0431\u0430\u0448\u043A\u0435 \u0441 \u043A\u0430\u0440\u043C\u0430\u043D\u0430\u043C\u0438, \u0431\u0440\u044E\u043A\u0430\u0445 \u0438 \u0448\u043D\u0443\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0445 \u0431\u043E\u0442\u0438\u043D\u043A\u0430\u0445"}),rig:"humanoid",palette:n,textures:s,parts:l,face:{bone:"head",rect:[0,3,8,5],expressions:{neutral:"f_neutral",blink:"f_blink",happy:"f_happy",sad:"f_sad",angry:"f_angry",surprised:"f_surprised",scared:"f_scared",tired:"f_tired",hurt:"f_hurt",talk:"f_talk"}},style:{walk:"normal",idle:"calm",energy:.5},finish:{noise:.5,outline:.4,shade:.25,density:2},tags:e.tags??["player"]}}function Sr(e,t){return {textures:Object.fromEntries(Object.entries(sn).map(([r,o])=>[r,J(o)])),face:{bone:e,rect:t,expressions:{neutral:"f_neutral",blink:"f_blink",happy:"f_happy",sad:"f_sad",angry:"f_angry",surprised:"f_surprised",scared:"f_scared",tired:"f_tired",hurt:"f_hurt",talk:"f_talk"}}}}var qo=Go(),Ho=null;function Ot(){if(!Ho){let e=Ye(qo);if(!e.ok)throw new Error(e.error);Ho=e.spec;}return Ho}function hn(e){let t=document.createElement("canvas");t.width=256,t.height=48;let r=t.getContext("2d");r&&(r.fillStyle="rgba(0,0,0,0.45)",r.fillRect(0,0,256,48),r.font="bold 28px sans-serif",r.fillStyle="#fff",r.textAlign="center",r.textBaseline="middle",r.fillText(e.slice(0,18),128,25));let o=new B.CanvasTexture(t),a=new B.Sprite(new B.SpriteMaterial({map:o,depthTest:false,transparent:true}));return a.scale.set(1.6,.3,1),a.renderOrder=10,a}function Uo(e){e.removeFromParent(),e.material.map?.dispose(),e.material.dispose();}var I={rx:0,ry:1,rz:2,px:3,py:4,pz:5,sx:6,sy:7,sz:8},R1=Object.keys(I),sr=[0,0,0,0,0,0,1,1,1];function oe(e,t){let r=e.get(t);return r||(r=Float64Array.from(sr),e.set(t,r)),r}function de(e,t,r,o){let a=oe(e,t),n=I[r];n>=6?a[n]=a[n]*o:a[n]=a[n]+o;}function y(e,t,r,o){oe(e,t)[I[r]]=o;}function bt(e){for(let t of e.values())t.set(sr);}function dn(e,t,r,o){let a=new Set([...t.keys(),...r.keys()]);for(let n of a){let s=t.get(n)??sr,l=r.get(n)??sr,i=oe(e,n);for(let c=0;c<9;c++)i[c]=s[c]+(l[c]-s[c])*o;}}function De(e,t){bt(e);for(let[r,o]of t)oe(e,r).set(o);}var k1=["none","block","tool","sword","bow","shield","food","staff","item","pistol","rifle"];function io(){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",aiming:false,use:null,talk:false}}var v1=["swing","hurt","place","land","jump","throw","shoot","punch"];var gt=(e,t)=>[e[0]+t[0],e[1]+t[1],e[2]+t[2]],ue=(e,t)=>[e[0]-t[0],e[1]-t[1],e[2]-t[2]],Ft=(e,t)=>[e[0]*t,e[1]*t,e[2]*t],yt=(e,t)=>e[0]*t[0]+e[1]*t[1]+e[2]*t[2],Vt=(e,t)=>[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]],He=e=>Math.hypot(e[0],e[1],e[2]),nt=(e,t)=>He(ue(e,t)),Tr=(e,t,r)=>[e[0]+(t[0]-e[0])*r,e[1]+(t[1]-e[1])*r,e[2]+(t[2]-e[2])*r];function ir(e){let t=He(e);return t>1e-12?[e[0]/t,e[1]/t,e[2]/t]:[0,0,0]}var xe=(e,t,r)=>Math.max(t,Math.min(r,e)),Ko=[1,0,0,0,1,0,0,0,1];function Be(e,t){return [e[0]*t[0]+e[1]*t[3]+e[2]*t[6],e[0]*t[1]+e[1]*t[4]+e[2]*t[7],e[0]*t[2]+e[1]*t[5]+e[2]*t[8],e[3]*t[0]+e[4]*t[3]+e[5]*t[6],e[3]*t[1]+e[4]*t[4]+e[5]*t[7],e[3]*t[2]+e[4]*t[5]+e[5]*t[8],e[6]*t[0]+e[7]*t[3]+e[8]*t[6],e[6]*t[1]+e[7]*t[4]+e[8]*t[7],e[6]*t[2]+e[7]*t[5]+e[8]*t[8]]}function ae(e,t){return [e[0]*t[0]+e[1]*t[1]+e[2]*t[2],e[3]*t[0]+e[4]*t[1]+e[5]*t[2],e[6]*t[0]+e[7]*t[1]+e[8]*t[2]]}var xt=e=>[e[0],e[3],e[6],e[1],e[4],e[7],e[2],e[5],e[8]];function Qe(e,t,r){let o=Math.cos(e),a=Math.sin(e),n=Math.cos(t),s=Math.sin(t),l=Math.cos(r),i=Math.sin(r),c=o*l,p=o*i,h=a*l,m=a*i;return [n*l,-n*i,s,p+h*s,c-m*s,-a*n,m-c*s,h+p*s,o*n]}function Dt(e){let t=Math.asin(xe(e[2],-1,1));return Math.abs(e[2])<.9999999?[Math.atan2(-e[5],e[8]),t,Math.atan2(-e[1],e[0])]:[Math.atan2(e[7],e[4]),t,0]}function lo(e,t){let[r,o,a]=e,n=Math.cos(t),s=Math.sin(t),l=1-n;return [l*r*r+n,l*r*o-s*a,l*r*a+s*o,l*r*o+s*a,l*o*o+n,l*o*a-s*r,l*r*a-s*o,l*o*a+s*r,l*a*a+n]}function Yo(e,t){let r=ir(e),o=ir(t),a=xe(yt(r,o),-1,1),n=Vt(r,o),s=He(n);if(s<1e-9){if(a>0)return [...Ko];let l=Math.abs(r[0])<.9?Vt(r,[1,0,0]):Vt(r,[0,1,0]);return lo(ir(l),Math.PI)}return lo(Ft(n,1/s),Math.atan2(s,a))}function un(e,t,r){return Math.atan2(yt(Vt(e,t),r),yt(e,t))}function Mr(e){let t=Math.PI*2;return e=(e%t+t)%t,e>Math.PI?e-t:e}function co(e,t,r,o,a){if(a<=0)return e;if(o<=1e-6)return t.v=0,r;let n=2/o,s=n*a,l=1/(1+s+.48*s*s+.235*s*s*s),i=e-r,c=(t.v+n*i)*a;return t.v=(t.v-n*c)*l,r+(i+c)*l}var fn=Float64Array.from([0,0,0,0,0,0,1,1,1]);function We(e,t){let r=new Map(e.map(i=>[i.name,i])),o=new Map,a=t.get("root")??fn,n=Qe(a[I.rx],a[I.ry],a[I.rz]),s={pos:[a[I.px],a[I.py],a[I.pz]],lin:n,rot:n},l=i=>{let c=o.get(i.name);if(c)return c;let p=i.parent?r.get(i.parent):void 0,h=p?l(p):s,m=p?p.pivot:[0,0,0],d=t.get(i.role)??fn,b=[i.pivot[0]-m[0]+d[I.px],i.pivot[1]-m[1]+d[I.py],i.pivot[2]-m[2]+d[I.pz]],u=Qe(d[I.rx],d[I.ry],d[I.rz]),R=[d[I.sx],0,0,0,d[I.sy],0,0,0,d[I.sz]],w={pos:gt(h.pos,ae(h.lin,b)),lin:Be(h.lin,Be(u,R)),rot:Be(h.rot,u),parentRot:h.rot};return o.set(i.name,w),w};for(let i of e)l(i);return o}function Bt(e,t){return gt(e.pos,ae(e.lin,t))}var Wo=.04;function bn(e,t,r,o){let[a,n,s]=Dt(Be(xt(r.parentRot),o)),l=oe(e,t);l[I.rx]=a,l[I.ry]=n,l[I.rz]=s;}function Yi(e,t){let r=Wo*t,o=t-r;return e<=o||r<=0?e:o+r*(1-Math.exp(-(e-o)/r))}function $o(e,t,r){let o=t.upper.node.pos,a=t.lower.node.pos,n=t.end,s=ue(o,a),l=ue(n,a),i=He(s),c=He(l);if(i<1e-9||c<1e-9)return n;let p=ir(ae(t.lower.node.parentRot,[1,0,0])),h=Ft(p,yt(s,p)),m=Ft(p,yt(l,p)),d=ue(s,h),b=ue(l,m),u=He(d),R=He(b),w=nt(o,r),A=nt(o,n),k=w<=A?w:Math.max(A,Yi(w,Math.hypot(He(ue(m,h)),u+R))),x=e.get(t.lower.role)?.[I.rx]??0,f=0;if(u>1e-9&&R>1e-9){let C=un(d,b,p),z=(i*i+c*c-k*k)/2-yt(h,m),_=xe(z/(u*R),-1,1),M=Math.acos(_),[V,q]=t.bend,Y=v=>{let O=v-x,F=gt(m,gt(Ft(b,Math.cos(O)),Ft(Vt(p,b),Math.sin(O))));return Math.abs(He(ue(F,s))-k)},ce=[Mr(M-C),Mr(-M-C)].flatMap(v=>{let O=x+v;return [O,xe(O,V,q)]}),pe=xe(x,V,q),se=Y(pe);for(let v of ce){if(v<V-1e-9||v>q+1e-9)continue;let O=Y(v);(O<se-1e-6||Math.abs(O-se)<=1e-6&&Math.abs(v-x)<Math.abs(pe-x))&&(pe=v,se=O);}f=pe-x;}oe(e,t.lower.role)[I.rx]=x+f;let S=gt(a,ae(lo(p,f),l)),T=Yo(ue(S,o),ue(r,o));return bn(e,t.upper.role,t.upper.node,Be(T,t.upper.node.rot)),gt(o,ae(T,ue(S,o)))}function yn(e,t,r,o,a){let n=r.pos,s=ir(ae(r.parentRot,[1,0,0])),l=ue(o,n),i=Ft(s,yt(l,s)),c=ue(l,i),p=Vt(s,c),h=i[1],m=c[1],d=p[1],b=Math.hypot(m,d);if(b<1e-9)return;let u=Math.atan2(d,m),R=xe((a-n[1]-h)/b,-1,1),w=Math.acos(R),A=Mr(u+w),k=Mr(u-w),x=Math.abs(A)<=Math.abs(k)?A:k;oe(e,t)[I.rx]=(e.get(t)?.[I.rx]??0)+x;}function gn(e,t,r,o,a){let n=Yo(ue(o,r.pos),ue(a,r.pos));bn(e,t,r,Be(n,r.rot));}var Wi=.25,xn=.07,$i=.22,Xi=.12,Ji=.28,Qi=.6,po=.45,wn=.03,Zi=.2,e0=.2,t0=.12,Lr=(e,t,r)=>xe(e+(t?r:-r)/Wi,0,1),wt=e=>e*e*(3-2*e),Rn=(e,t,r)=>{e[t]=e[t]+r;},Cr=class{ik;bones;feet=[];hands={};out=new Map;thigh;plant=0;wLook=0;lookAt=null;lookV=[{v:0},{v:0},{v:0}];wSeat=0;lastSeat=null;pelvis=0;pelvisV={v:0};wHand={handR:0,handL:0};lastHand={handR:null,handL:null};wLock=0;constructor(t){this.ik=Ae[t.rig].ik??{},this.bones=t.bones.map(l=>({name:l.name,role:l.role,parent:l.parent,pivot:l.pivot}));let r=We(this.bones,new Map),o=l=>t.bones.find(i=>i.role===l),a=l=>{let i=o(l.upper),c=l.lower?o(l.lower):void 0;if(!i||l.lower&&!c)return null;let p=c??i,h=p.name,m;if(l.end==="sole"){let w=0;for(let A=1;A<p.positions.length;A+=3)w=Math.min(w,p.positions[A]);m=[0,w,0];}else {let w=t.sockets.find(A=>A.name===l.end);if(!w)return null;h=w.bone,m=w.at;}let d=r.get(i.name).pos,b=Bt(r.get(h),m),u=c?nt(d,r.get(c.name).pos)+nt(r.get(c.name).pos,b):nt(d,b),R=w=>({name:w.name,role:w.role,parent:w.parent,pivot:w.pivot});return {def:l,upper:R(i),lower:c?R(c):null,endBone:h,endAt:m,length:u}};for(let l of this.ik.feet??[]){let i=a(l);i&&this.feet.push({...i,g:0,gv:{v:0},lock:null,lockYaw:0,step:null});}for(let l of ["handR","handL"]){let i=this.ik.hands?.[l],c=i&&a(i);c&&(this.hands[l]=c);}let n=2,s=this.feet[0]&&t.bones.find(l=>l.name===this.feet[0].upper.name);if(s&&s.positions.length){let l=1/0,i=-1/0;for(let c=0;c<s.positions.length;c+=3)l=Math.min(l,s.positions[c]),i=Math.max(i,s.positions[c]);n=(i-l)/2;}this.thigh=n;}supports(t){return t==="look"?!!this.ik.look:t==="ground"||t==="seat"?this.feet.length>0:!!this.hands[t]}solve(t,r){let o=Math.max(0,Math.min(r.dt,.1)),a=!!r.ground&&this.feet.length>0;if(this.plant=a?xe(this.plant+(r.plant-this.plant)*Math.min(1,o/.12),0,1):Lr(this.plant,false,o),!a&&this.plant===0&&this.resetFeet(),this.wLook=this.ik.look?Lr(this.wLook,!!r.look,o):0,r.look){let m=this.lookAt;this.lookAt=m?[0,1,2].map(d=>co(m[d],this.lookV[d],r.look[d],t0,o)):[...r.look];}else this.wLook===0&&(this.lookAt=null);this.wSeat=this.feet.length?Lr(this.wSeat,!!r.seat,o):0,r.seat&&(this.lastSeat=r.seat);for(let m of ["handR","handL"])this.wHand[m]=this.hands[m]?Lr(this.wHand[m],!!r[m],o):0,r[m]&&(this.lastHand[m]=r[m]);if(this.plant===0&&this.wLook===0&&this.wSeat===0&&this.wHand.handR===0&&this.wHand.handL===0)return t;let n=this.out;De(n,t);let s=We(this.bones,n),l=m=>s.get(m),i=this.feet.map(m=>Bt(l(m.endBone),m.endAt)),c=wt(this.wSeat);if(c>0&&this.lastSeat){let m=this.feet.slice(0,2).map(w=>l(w.upper.name).pos),d=m.length===2?Tr(m[0],m[1],.5):m[0],b=[d[0],d[1]-this.thigh,d[2]],u=ue(this.lastSeat,b),R=oe(n,"root");R[I.px]=R[I.px]+u[0]*c,R[I.py]=R[I.py]+u[1]*c,R[I.pz]=R[I.pz]+u[2]*c;}let p=wt(this.plant);p>0&&(s=this.ground(n,s,i,r,p,c,o));let h=wt(this.wLook);h>0&&this.lookAt&&this.ik.look&&(s=this.look(n,s,this.lookAt,h));for(let m of ["handR","handL"]){let d=this.hands[m],b=wt(this.wHand[m]),u=this.lastHand[m];if(!d||b===0||!u)continue;s=We(this.bones,n);let R=Bt(s.get(d.endBone),d.endAt),w=Tr(R,u,b);d.lower?$o(n,{upper:{role:d.upper.role,node:s.get(d.upper.name)},lower:{role:d.lower.role,node:s.get(d.lower.name)},end:R,bend:d.def.bend??[-Math.PI,Math.PI]},w):gn(n,d.upper.role,s.get(d.upper.name),R,w);}return n}reset(){this.resetFeet(),this.pelvis=0,this.pelvisV.v=0,this.lookAt=null;for(let t of this.lookV)t.v=0;}resetFeet(){for(let t of this.feet)t.g=0,t.gv.v=0,t.lock=null,t.step=null;this.wLock=0;}ground(t,r,o,a,n,s,l){let i=s===0&&a.standing&&this.feet.every(x=>x.lower);if(this.wLock=Lr(this.wLock,i,l),!i&&this.wLock===0)for(let x of this.feet)x.lock=null,x.step=null;let c=this.feet.some(x=>x.step),p=a.toWorld([0,0,0]),h=a.toWorld([0,0,-1]),m=Math.atan2(h[0]-p[0],h[2]-p[2]),d=[];for(let x=0;x<this.feet.length;x++){let f=this.feet[x],S=o[x],T=S[0],C=S[2],z=0;if(i||this.wLock>0){let _=a.toWorld(S),M=wt(this.wLock);if(!f.lock&&!f.step&&(f.lock=_,f.lockYaw=m),f.step){f.step.t=Math.min(1,f.step.t+l/$i);let V=f.step.t,q=a.toModel(Tr(f.step.from,_,wt(V)));T+=(q[0]-T)*M,C+=(q[2]-C)*M,z=Math.sin(Math.PI*V)*Xi*f.length*M,V>=1&&(f.lock=_,f.lockYaw=m,f.step=null);}else if(f.lock){let V=a.toModel(f.lock),q=Math.abs(Math.atan2(Math.sin(m-f.lockYaw),Math.cos(m-f.lockYaw)));i&&!c&&(q>Qi||Math.hypot(V[0]-T,V[2]-C)>Ji*f.length)&&(f.step={from:f.lock,t:0},f.lock=null),T+=(V[0]-T)*M,C+=(V[2]-C)*M;}}d.push({x:T,z:C,arc:z});}let b=Math.max(...this.feet.map(x=>x.length));for(let x=0;x<this.feet.length;x++){let f=this.feet[x],S=a.ground?a.ground(d[x].x,0,d[x].z):0;S!==null&&S<-po*b&&(S=null),f.g=co(f.g,f.gv,S??f.g,xn,l);}let u=this.ik.tilt,R=oe(t,"root");if(u){let x=(M,V)=>{let q=this.feet.map((Y,ce)=>M.includes(Y.upper.role)?ce:-1).filter(Y=>Y>=0);return q.length?q.reduce((Y,ce)=>Y+V(this.feet[ce],ce),0)/q.length:0},f=x(u.front,M=>M.g),S=x(u.back,M=>M.g),T=x(u.front,(M,V)=>o[V][2]),C=x(u.back,(M,V)=>o[V][2]),z=Math.max(1,Math.abs(C-T)),_=xe(Math.atan2(f-S,z),-u.max,u.max);R[I.rx]=R[I.rx]+_*n*(1-s),R[I.py]=R[I.py]+(f+S)/2*n*(1-s);}else {let x=this.feet.map(z=>z.g),f=Math.min(...x),S=x.reduce((z,_)=>z+_,0)/x.length,T=this.feet.every(z=>z.lower)?1-wt(this.wLock):0,C=xe(f+(S-f)*T,-po*b,po*b)*(1-s);this.pelvis=co(this.pelvis,this.pelvisV,C,xn,l),R[I.py]=R[I.py]+this.pelvis*n;}r=We(this.bones,t);let w=x=>this.feet.map((f,S)=>{let T=Math.max(0,o[S][1]),C=T+f.g+d[S].arc,z=Bt(x.get(f.endBone),f.endAt)[1],_=Math.max(z,f.g),M=1-wt(xe((T-wn*f.length)/((Zi-wn)*f.length),0,1)),V=_+(C-_)*M,q=Math.max(f.g,z-e0*f.length);return [d[S].x,V+(q-V)*s,d[S].z]}),A=w(r),k=0;this.feet.forEach((x,f)=>{if(!x.lower)return;let S=r.get(x.upper.name).pos,T=A[f],C=Math.max(nt(S,Bt(r.get(x.endBone),x.endAt)),x.length*(1-Wo)),z=Math.hypot(T[0]-S[0],T[2]-S[2]);z>=C||(k=Math.max(k,S[1]-T[1]-Math.sqrt(C*C-z*z)));}),k>0&&(Rn(R,I.py,-Math.min(k,po*b)*n*(1-s)),r=We(this.bones,t),A=w(r));for(let x=0;x<this.feet.length;x++){let f=this.feet[x],S=Bt(r.get(f.endBone),f.endAt),T=Tr(S,A[x],n);nt(T,S)<1e-6||(f.lower?$o(t,{upper:{role:f.upper.role,node:r.get(f.upper.name)},lower:{role:f.lower.role,node:r.get(f.lower.name)},end:S,bend:f.def.bend??[-Math.PI,Math.PI]},T):yn(t,f.upper.role,r.get(f.upper.name),S,T[1]));}return We(this.bones,t)}look(t,r,o,a){let n=this.ik.look,s=this.bones.find(h=>h.role===n.head);if(!s)return r;let l=h=>{let m=ae(xt(h.parentRot),ue(o,h.pos));return [Math.atan2(-m[0],-m[2]),Math.atan2(m[1],Math.hypot(m[0],m[2]))]};if(He(ue(o,r.get(s.name).pos))<1e-6)return r;let[i,c]=l(r.get(s.name));if(n.body&&n.bodyYaw>0&&this.bones.some(h=>h.role===n.body)){let h=xe(Math.abs(i)-n.headYaw,0,n.bodyYaw)*Math.sign(i);h!==0&&(Rn(oe(t,n.body),I.ry,h*a),r=We(this.bones,t),[i,c]=l(r.get(s.name)));}let p=oe(t,n.head);return p[I.ry]=p[I.ry]+(xe(i,-n.headYaw,n.headYaw)-p[I.ry])*a,p[I.rx]=p[I.rx]+(xe(c,-n.headPitch,n.headPitch)-p[I.rx])*a,We(this.bones,t)}};var Ze=(e,t)=>[e[3]*t[0]+e[0]*t[3]+e[1]*t[2]-e[2]*t[1],e[3]*t[1]-e[0]*t[2]+e[1]*t[3]+e[2]*t[0],e[3]*t[2]+e[0]*t[1]-e[1]*t[0]+e[2]*t[3],e[3]*t[3]-e[0]*t[0]-e[1]*t[1]-e[2]*t[2]],it=e=>[-e[0],-e[1],-e[2],e[3]];function Qo(e){let t=Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]+e[3]*e[3]);return t>0?[e[0]/t,e[1]/t,e[2]/t,e[3]/t]:[0,0,0,1]}function ne(e,t){let[r,o,a,n]=e,s=2*(o*t[2]-a*t[1]),l=2*(a*t[0]-r*t[2]),i=2*(r*t[1]-o*t[0]);return [t[0]+n*s+(o*i-a*l),t[1]+n*l+(a*s-r*i),t[2]+n*i+(r*l-o*s)]}var Xo=(e,t)=>ne(it(e),t);function Zo(e){let[t,r,o,a]=e;return [1-2*(r*r+o*o),2*(t*r-o*a),2*(t*o+r*a),2*(t*r+o*a),1-2*(t*t+o*o),2*(r*o-t*a),2*(t*o-r*a),2*(r*o+t*a),1-2*(t*t+r*r)]}function uo(e){let t=e[0]+e[4]+e[8],r;if(t>0){let o=Math.sqrt(t+1)*2;r=[(e[7]-e[5])/o,(e[2]-e[6])/o,(e[3]-e[1])/o,.25*o];}else if(e[0]>e[4]&&e[0]>e[8]){let o=Math.sqrt(1+e[0]-e[4]-e[8])*2;r=[.25*o,(e[1]+e[3])/o,(e[2]+e[6])/o,(e[7]-e[5])/o];}else if(e[4]>e[8]){let o=Math.sqrt(1+e[4]-e[0]-e[8])*2;r=[(e[1]+e[3])/o,.25*o,(e[5]+e[7])/o,(e[2]-e[6])/o];}else {let o=Math.sqrt(1+e[8]-e[0]-e[4])*2;r=[(e[2]+e[6])/o,(e[5]+e[7])/o,.25*o,(e[3]-e[1])/o];}return Qo(r)}function Sn(e,t,r){let o=e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3],a=o<0?[-t[0],-t[1],-t[2],-t[3]]:t;if(o=Math.abs(o),o>.9995)return Qo([e[0]+(a[0]-e[0])*r,e[1]+(a[1]-e[1])*r,e[2]+(a[2]-e[2])*r,e[3]+(a[3]-e[3])*r]);let n=Math.acos(o),s=Math.sin((1-r)*n)/Math.sin(n),l=Math.sin(r*n)/Math.sin(n);return [e[0]*s+a[0]*l,e[1]*s+a[1]*l,e[2]*s+a[2]*l,e[3]*s+a[3]*l]}var _e=(e,t)=>[e[0]+t[0],e[1]+t[1],e[2]+t[2]],Ee=(e,t)=>[e[0]-t[0],e[1]-t[1],e[2]-t[2]],te=(e,t)=>[e[0]*t,e[1]*t,e[2]*t],we=(e,t)=>e[0]*t[0]+e[1]*t[1]+e[2]*t[2],st=(e,t)=>[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]],Nt=e=>Math.sqrt(we(e,e));function kn(e){let t=Nt(e);return t>1e-12?[e[0]/t,e[1]/t,e[2]/t]:[0,0,0]}function ea(e,t,r){let o=8*e[0]*e[1]*e[2],a=4*e[0]*e[0],n=4*e[1]*e[1],s=4*e[2]*e[2];return {x:t,q:r,v:[0,0,0],w:[0,0,0],px:t,pq:r,im:1/o,ii:[12/(o*(n+s)),12/(o*(a+s)),12/(o*(a+n))],half:e}}function Rt(e,t){let r=Xo(e.q,t);return ne(e.q,[r[0]*e.ii[0],r[1]*e.ii[1],r[2]*e.ii[2]])}function lr(e,t,r){let[o,a,n]=t,s=e.q,l=Ze([o*.5*r,a*.5*r,n*.5*r,0],s);e.q=Qo([s[0]+l[0],s[1]+l[1],s[2]+l[2],s[3]+l[3]]);}function mo(e,t,r,o,a){let n=Nt(a);if(n<1e-9)return 0;let s=te(a,1/n),l=st(t,s),i=e.im+we(l,Rt(e,l));if(r){let p=st(o,s);i+=r.im+we(p,Rt(r,p));}if(i<=0)return 0;let c=te(s,-n/i);return e.x=_e(e.x,te(c,e.im)),lr(e,Rt(e,st(t,c)),1),r&&(r.x=Ee(r.x,te(c,r.im)),lr(r,Rt(r,st(o,c)),-1)),n}function Pr(e,t,r){let o=Nt(r);if(o<1e-9)return;let a=te(r,1/o),n=we(a,Rt(e,a));if(t&&(n+=we(a,Rt(t,a))),n<=0)return;let s=te(r,1/n);lr(e,Rt(e,s),1),t&&lr(t,Rt(t,s),-1);}var Jo=[];for(let e of [-1,1])for(let t of [-1,1])for(let r of [-1,1])Jo.push([e,t,r]);var Tn=[];for(let e of [-1,0,1])for(let t of [-1,0,1])for(let r of [-1,0,1])(e||t||r)&&Tn.push([e,t,r]);var Mn=[];for(let e of Jo)for(let t of Jo)e<t&&(e[0]!==t[0]?1:0)+(e[1]!==t[1]?1:0)+(e[2]!==t[2]?1:0)==1&&Mn.push([e,t]);var vn=2,An=30,Ln={gravity:9.8,friction:.7,linDamp:.1,angDamp:.4,tone:8};function Cn(e,t,r,o,a,n){for(let c of e)c.px=c.x,c.pq=c.q,c.v=[c.v[0],c.v[1]-n.gravity*a,c.v[2]],c.x=_e(c.x,te(c.v,a)),lr(c,c.w,a);let s=Math.min(.5,n.tone*a);for(let c of t)r0(e,c,s);for(let c=0;c<2;c++)for(let p of t)ho(e,p);for(let c of e)En(c,r,o,n.friction,a);for(let c of t)ho(e,c);for(let c of e)En(c,r,o,n.friction,a);for(let c of t)ho(e,c);let l=Math.max(0,1-n.linDamp*a),i=Math.max(0,1-n.angDamp*a);for(let c of e){c.v=te(Ee(c.x,c.px),l/a);let p=Nt(c.v);p>An&&(c.v=te(c.v,An/p));let h=Ze(c.q,it(c.pq));h[3]<0&&(h=[-h[0],-h[1],-h[2],-h[3]]),c.w=[h[0]*2*i/a,h[1]*2*i/a,h[2]*2*i/a];}}function Pn(e,t,r,o,a){let n=o*o*a,s=Math.max(0,1-2*o*a);e.forEach((l,i)=>{let c=r[i];if(l.px=l.x,l.pq=l.q,l.im===0){l.x=c.x,l.q=c.q;return}l.v=_e(te(l.v,s),te(Ee(c.x,l.x),n));let p=Ze(c.q,it(l.q));p[3]<0&&(p=[-p[0],-p[1],-p[2],-p[3]]),l.w=[l.w[0]*s+2*p[0]*n,l.w[1]*s+2*p[1]*n,l.w[2]*s+2*p[2]*n],l.x=_e(l.x,te(l.v,a)),lr(l,l.w,a);});for(let l=0;l<3;l++)for(let i of t)ho(e,i);for(let l of e){l.v=te(Ee(l.x,l.px),1/a);let i=Ze(l.q,it(l.pq));i[3]<0&&(i=[-i[0],-i[1],-i[2],-i[3]]),l.w=[i[0]*2/a,i[1]*2/a,i[2]*2/a];}}function r0(e,t,r){let o=e[t.a],a=e[t.b],n=Ze(o.q,Ze(it(o.pq),a.pq)),s=Ze(n,it(a.q));s[3]<0&&(s=[-s[0],-s[1],-s[2],-s[3]]),Pr(o,a,[-2*s[0]*r,-2*s[1]*r,-2*s[2]*r]);}function ho(e,t){let r=e[t.a],o=e[t.b],a=ne(r.q,t.ra),n=ne(o.q,t.rb);mo(r,a,o,n,Ee(_e(r.x,a),_e(o.x,n)));let s=t.limit;if(s.kind==="hinge"){let u=ne(r.q,s.hinge),R=ne(o.q,s.hinge);Pr(r,o,st(u,R));let w=ne(r.q,s.hinge),A=ne(o.q,s.axis),k=kn(Ee(A,te(w,we(w,A)))),x=ne(r.q,s.from),f=ne(r.q,s.to);if(we(st(x,k),w)<0||we(st(k,f),w)<0){let S=we(k,x)>we(k,f)?x:f;Pr(r,o,st(S,k));}return}let l=ne(r.q,s.center),i=ne(o.q,s.axis),c=we(l,i);if(c<s.cosSwing){let u=kn(Ee(i,te(l,c))),R=u[0]===0&&u[1]===0&&u[2]===0?l:_e(te(l,s.cosSwing),te(u,s.sinSwing));Pr(r,o,st(R,i));}let p=Ze(it(r.q),o.q);p[3]<0&&(p=[-p[0],-p[1],-p[2],-p[3]]);let h=p[0]*s.axis[0]+p[1]*s.axis[1]+p[2]*s.axis[2],m=Math.sqrt(h*h+p[3]*p[3]);if(m<1e-9)return;let d=p[3]/m,b=Math.abs(h)/m;if(d<s.cosHalfTwist){let u=2*(b*s.cosHalfTwist-d*s.sinHalfTwist),R=ne(o.q,s.axis);Pr(r,o,te(R,(h>0?1:-1)*u));}}function En(e,t,r,o,a){for(let n of Tn){let s=[n[0]*e.half[0],n[1]*e.half[1],n[2]*e.half[2]],l=ne(e.q,s),i=_e(e.x,l),c=null,p=0;if(t!==null&&i[1]<t&&(c=[0,1,0],p=t-i[1]),r.length){let R=_e(e.px,ne(e.pq,s));for(let w of r){if(i[0]<=w.min[0]||i[0]>=w.max[0]||i[1]<=w.min[1]||i[1]>=w.max[1]||i[2]<=w.min[2]||i[2]>=w.max[2])continue;let A=[0,1,0],k=w.max[1]-i[1];if(R[1]<w.max[1]-1e-4){let x=[[[1,0,0],w.max[0]-i[0]],[[-1,0,0],i[0]-w.min[0]],[[0,0,1],w.max[2]-i[2]],[[0,0,-1],i[2]-w.min[2]]];(t===null||w.min[1]>t+.05)&&x.push([[0,-1,0],i[1]-w.min[1]]);for(let[f,S]of x)S<k&&(A=f,k=S);}k>p&&(c=A,p=k);}}if(!c)continue;let h=_e(e.px,ne(e.pq,s));if(p=Math.max(0,Math.min(p,we(Ee(h,i),c)+vn*a)),p<=0)continue;mo(e,l,null,[0,0,0],te(c,-p));let m=ne(e.q,s),d=Ee(_e(e.x,m),h),b=Ee(d,te(c,we(d,c))),u=Nt(b);u>1e-9&&mo(e,m,null,[0,0,0],te(b,Math.min(1,o*p/u)));}for(let n of r)for(let[s,l]of Mn){let i=T=>[T[0]<0?n.min[0]:n.max[0],T[1]<0?n.min[1]:n.max[1],T[2]<0?n.min[2]:n.max[2]],c=Xo(e.q,Ee(i(s),e.x)),p=Xo(e.q,Ee(i(l),e.x)),h=Ee(p,c),m=we(h,h),d=m>0?Math.max(0,Math.min(1,-we(c,h)/m)):0,b=_e(c,te(h,d)),u=e.half[0]-Math.abs(b[0]),R=e.half[1]-Math.abs(b[1]),w=e.half[2]-Math.abs(b[2]);if(u<=0||R<=0||w<=0)continue;let A=u<R?u<w?0:2:R<w?1:2,k=[0,0,0];k[A]=b[A]>=0?1:-1;let x=A===0?u:A===1?R:w,f=_e(e.x,ne(e.q,b)),S=te(ne(e.q,k),-1);x=Math.min(x,we(Ee(_e(e.px,ne(e.pq,b)),f),S)+vn*a),!(x<=0)&&mo(e,Ee(f,e.x),null,[0,0,0],te(ne(e.q,k),x));}}function zn(e){let t=Math.max(e.half[0],e.half[1],e.half[2]);return Nt(e.v)+Nt(e.w)*t}var In=Math.PI,ta={"root.rx":[[0,In/2],[.3,.6],[.6,0],[1,0]],"root.py":[[0,2.3],[.3,-6],[.6,-6],[1,0]],"legL.rx":[[0,0],[.3,1.8],[.6,1.5],[1,0]],"legR.rx":[[0,0],[.3,.2],[.6,-0.1],[1,0]],"shinL.rx":[[0,0],[.3,-2],[.6,-1.5],[1,0]],"shinR.rx":[[0,0],[.3,-1.6],[.6,-1.4],[1,0]],"armL.rx":[[0,0],[.3,-0.6],[.6,.4],[1,0]],"armR.rx":[[0,0],[.3,-0.6],[.6,.2],[1,0]]},_n={"root.rx":[[0,-In/2],[.3,-1.1],[.6,0],[1,0]],"root.py":[[0,2.3],[.3,4.5],[.6,-6],[1,0]],"armL.rx":[[0,1.6],[.3,1.5],[.6,.4],[1,0]],"armR.rx":[[0,1.6],[.3,1.5],[.6,.3],[1,0]],"foreArmL.rx":[[0,1.2],[.3,.1],[.6,.3],[1,0]],"foreArmR.rx":[[0,1.2],[.3,.1],[.6,.3],[1,0]],"legL.rx":[[0,0],[.3,.3],[.6,1.5],[1,0]],"legR.rx":[[0,0],[.3,.2],[.6,-0.1],[1,0]],"shinL.rx":[[0,0],[.3,-0.5],[.6,-1.5],[1,0]],"shinR.rx":[[0,0],[.3,-0.6],[.6,-1.4],[1,0]],"head.rx":[[0,.6],[.3,.3],[.6,0],[1,0]]};function On(e,t){if(t<=e[0][0])return e[0][1];for(let r=1;r<e.length;r++){let[o,a]=e[r];if(t<=o){let[n,s]=e[r-1],l=(t-n)/Math.max(1e-9,o-n);return s+(a-s)*l*l*(3-2*l)}}return e[e.length-1][1]}var lt=1/240,Vn=48,o0=.08,a0=.25,n0=6,s0=.6,fo=.35,Fn=1.8,i0=.3,l0=11,c0=.2,p0=.65,m0=.25,h0=9,d0=14;function Dn(e,t){let r=Math.hypot(e[0],e[1],e[2]);return r>t?[e[0]*t/r,e[1]*t/r,e[2]*t/r]:e}var u0=.6,Bn=20,Nn=(e,t)=>{let r=ae(e.rot,[t[0]*e.scale,t[1]*e.scale,t[2]*e.scale]);return [r[0]+e.origin[0],r[1]+e.origin[1],r[2]+e.origin[2]]},Hn=(e,t)=>{let r=ae(xt(e.rot),[t[0]-e.origin[0],t[1]-e.origin[1],t[2]-e.origin[2]]);return [r[0]/e.scale,r[1]/e.scale,r[2]/e.scale]},zr=e=>{let t=Math.max(0,Math.min(1,e));return t*t*(3-2*t)},jn=e=>Qe(0,e,0),Ir=class{supported;defs=[];fkBones;torso;bodies=[];joints=[];st="none";acc=0;still=0;sleeping=false;out=new Map;world={floor:null};frozen=new Map;riseT=0;keys=ta;yaw0=0;off0=[0,0,0];off1=[0,0,0];driftV=null;flT=0;stand;constructor(t){let r=Ae[t.rig]?.ragdoll;this.fkBones=t.bones.map(n=>({name:n.name,role:n.role,parent:n.parent,pivot:n.pivot})),this.torso=r?.torso??"",this.stand=new Set(r?.stand??[]);let o=new Map(t.bones.map(n=>[n.name,n])),a=r?[r.torso,...r.joints.map(n=>n.bone)]:[];if(this.supported=!!r&&a.every(n=>o.has(n)),!!this.supported)for(let n of a){let s=o.get(n),l=[1/0,1/0,1/0],i=[-1/0,-1/0,-1/0];for(let p=0;p<s.positions.length;p+=3)for(let h=0;h<3;h++){let m=s.positions[p+h];m<l[h]&&(l[h]=m),m>i[h]&&(i[h]=m);}let c=!Number.isFinite(l[0]);this.defs.push({name:n,role:s.role,pivot:s.pivot,c:c?[0,0,0]:[(l[0]+i[0])/2,(l[1]+i[1])/2,(l[2]+i[2])/2],half:c?[.5,.5,.5]:[Math.max(.3,(i[0]-l[0])/2),Math.max(.3,(i[1]-l[1])/2),Math.max(.3,(i[2]-l[2])/2)],joint:r.joints.find(p=>p.bone===n)??null});}}get state(){return this.st}get resting(){return this.st==="fall"&&this.sleeping}get drift(){return this.driftV}clearDrift(){this.driftV=null;}setWorld(t){this.world=t;}start(t,r,o,a){if(!this.supported)return;let n=r.frame.scale,s=this.place(r.pose,r.frame),l=t&&o>0?this.place(t.pose,t.frame):null;this.bodies=this.defs.map((i,c)=>{let p=s[c],h=ea([i.half[0]*n,i.half[1]*n,i.half[2]*n],p.x,p.q),m=l?.[c];if(m){h.v=Dn([(p.x[0]-m.x[0])/o,(p.x[1]-m.x[1])/o,(p.x[2]-m.x[2])/o],h0);let b=Ze(p.q,it(m.q));b[3]<0&&(b=[-b[0],-b[1],-b[2],-b[3]]),h.w=Dn([2*b[0]/o,2*b[1]/o,2*b[2]/o],d0);}let d=Math.max(.15,Math.min(1,p.y/Bn));return h.v=[h.v[0]+a[0]*d,h.v[1]+a[1]*d,h.v[2]+a[2]*d],h}),this.joints=this.makeJoints(n),this.world.floor===null&&!this.world.boxes&&(this.world={floor:r.frame.origin[1]}),this.st="fall",this.acc=0,this.still=0,this.sleeping=false;}place(t,r){let o=We(this.fkBones,t);return this.defs.map(a=>{let n=o.get(a.name),s=Be(r.rot,n.rot),l=Nn(r,n.pos),i=ae(s,[a.c[0]*r.scale,a.c[1]*r.scale,a.c[2]*r.scale]);return {x:[l[0]+i[0],l[1]+i[1],l[2]+i[2]],q:uo(s),y:n.pos[1]+ae(n.rot,a.c)[1]}})}makeJoints(t){let r=new Map(this.defs.map((o,a)=>[o.name,a]));return this.defs.flatMap((o,a)=>{let n=o.joint;if(!n)return [];let s=r.get(n.parent);if(s===void 0)return [];let l=this.defs[s],i=[(o.pivot[0]-l.pivot[0]-l.c[0])*t,(o.pivot[1]-l.pivot[1]-l.c[1])*t,(o.pivot[2]-l.pivot[2]-l.c[2])*t],c=[-o.c[0]*t,-o.c[1]*t,-o.c[2]*t],p=[0,-1,0];if(n.kind==="hinge"){let[b,u]=n.bend;return [{a:s,b:a,ra:i,rb:c,limit:{kind:"hinge",hinge:[1,0,0],axis:p,from:[0,-Math.cos(b),-Math.sin(b)],to:[0,-Math.cos(u),-Math.sin(u)]}}]}let h=n.up?[0,1,0]:p,m=n.tilt??0,d=[0,h[1]*Math.cos(m),h[1]*Math.sin(m)];return [{a:s,b:a,ra:i,rb:c,limit:{kind:"ball",center:d,axis:h,cosSwing:Math.cos(n.swing),sinSwing:Math.sin(n.swing),cosHalfTwist:Math.cos(n.twist/2),sinHalfTwist:Math.sin(n.twist/2)}}]})}hit(t,r,o){if(!this.supported||this.st==="rise")return;if(this.st==="fall"){this.push(r);return}let a=t.frame,n=this.place(t.pose,a);this.st!=="flinch"&&(this.bodies=this.defs.map((i,c)=>{let p=ea([i.half[0]*a.scale,i.half[1]*a.scale,i.half[2]*a.scale],n[c].x,n[c].q);return this.stand.has(i.name)&&(p.im=0,p.ii=[0,0,0]),p}),this.joints=this.makeJoints(a.scale),this.acc=0,this.st="flinch"),this.flT=0;let s=-1;if(typeof o=="string")s=this.defs.findIndex(i=>i.name===o);else if(o){let i=1/0;this.bodies.forEach((c,p)=>{let h=(c.x[0]-o[0])**2+(c.x[1]-o[1])**2+(c.x[2]-o[2])**2;c.im>0&&h<i&&(i=h,s=p);});}let l=new Map;for(let i=s,c=1;i>=0&&c>.05;c*=u0){l.set(i,c);let p=this.defs[i].joint?.parent;i=p?this.defs.findIndex(h=>h.name===p):-1;}this.bodies.forEach((i,c)=>{if(i.im===0)return;let p=s>=0?l.get(c)??0:Math.max(.15,Math.min(1,n[c].y/Bn));i.v=[i.v[0]+r[0]*p,i.v[1]+r[1]*p,i.v[2]+r[2]*p];});}push(t){if(this.st==="fall"){for(let r of this.bodies)r.v=[r.v[0]+t[0],r.v[1]+t[1],r.v[2]+t[2]];this.sleeping=false,this.still=0;}}getUp(t){if(this.st!=="fall")return;let r=this.poseNow(t);De(this.frozen,r);let o=r.get("root"),a=Qe(o[I.rx],o[I.ry],o[I.rz]),n=this.defs.find(d=>d.name===this.torso),s=ae(a,[0,1,0]),l=ae(a,[0,0,-1])[1]>=0;this.keys=l?ta:_n,this.yaw0=l?Math.atan2(s[0],s[2]):Math.atan2(-s[0],-s[2]);let i=d=>{let b=d.get("root"),u=Qe(b[I.rx],b[I.ry],b[I.rz]),R=ae(u,n.pivot);return [R[0]+b[I.px],R[1]+b[I.py],R[2]+b[I.pz]]},c=i(r),p=ae(jn(this.yaw0),i(this.keyPose(0))),h=i(this.keyPose(1)),m=this.groundUnder(t,c);this.off0=[c[0]-p[0],m,c[2]-p[2]],this.off1=[c[0]-h[0],m,c[2]-h[2]],this.driftV=this.off1,this.st="rise",this.riseT=0;}stop(){this.finish(),this.driftV=null;}finish(){this.st="none",this.bodies=[],this.joints=[];}groundUnder(t,r){let o=Nn(t,r),a=this.world.floor,n=this.world.boxes?.([o[0]-.01,-1e9,o[2]-.01],[o[0]+.01,o[1]+.3,o[2]+.01])??[];for(let s of n)o[0]>=s.min[0]&&o[0]<=s.max[0]&&o[2]>=s.min[2]&&o[2]<=s.max[2]&&s.max[1]<=o[1]+.3&&(a=a===null?s.max[1]:Math.max(a,s.max[1]));return a===null?0:Hn(t,[o[0],a,o[2]])[1]}drive(t,r,o){if(this.st==="none")return null;if(this.st==="flinch")return this.flinch(t,r,o);if(this.st==="fall")return this.sleeping||this.simulate(r),this.poseNow(o);this.riseT+=r;let a=this.riseT;if(a<fo)return ra(this.out,this.frozen,this.placed(0,0),zr(a/fo));let n=(a-fo)/Fn;if(n<1)return f0(this.out,this.placed(n,zr(n)));let s=(a-fo-Fn)/i0;return s>=1?(this.finish(),null):ra(this.out,this.placed(1,1),t,zr(s))}flinch(t,r,o){let a=this.place(t,o);this.acc=Math.min(this.acc+r,Vn*lt);let n=this.flT;this.flT+=r;let s=0;for(;this.acc>=lt-1e-9;){this.acc-=lt,s++;let c=l0*zr((n+s*lt)/c0);Pn(this.bodies,this.joints,a,c,lt);}let l=this.poseNow(o),i=(this.flT-p0)/m0;return i<=0?l:i>=1?(this.finish(),null):ra(this.out,l,t,zr(i))}simulate(t){this.acc=Math.min(this.acc+t,Vn*lt);let r=this.nearBoxes();for(;this.acc>=lt-1e-9;)this.acc-=lt,Cn(this.bodies,this.joints,this.world.floor,r,lt,Ln);let o=0;for(let a of this.bodies)o=Math.max(o,zn(a));if(o<a0){let a=Math.max(0,1-n0*t);for(let n of this.bodies)n.v=[n.v[0]*a,n.v[1]*a,n.v[2]*a],n.w=[n.w[0]*a,n.w[1]*a,n.w[2]*a];}if(this.still=o<o0?this.still+t:0,this.still>=s0){this.sleeping=true;for(let a of this.bodies)a.v=[0,0,0],a.w=[0,0,0];}}nearBoxes(){let t=this.world.boxes;if(!t||!this.bodies.length)return [];let r=[1/0,1/0,1/0],o=[-1/0,-1/0,-1/0];for(let a of this.bodies){let n=Math.max(a.half[0],a.half[1],a.half[2])*1.8+.3;for(let s=0;s<3;s++)r[s]=Math.min(r[s],a.x[s]-n),o[s]=Math.max(o[s],a.x[s]+n);}return t(r,o)}poseNow(t){let r=this.out,o=new Map,a=xt(t.rot);this.defs.forEach((w,A)=>o.set(w.name,Be(a,Zo(this.bodies[A].q))));let n=this.defs.findIndex(w=>w.name===this.torso),s=this.defs[n],l=this.bodies[n],i=o.get(this.torso),c=l.q,p=ne(c,[s.c[0]*t.scale,s.c[1]*t.scale,s.c[2]*t.scale]),h=Hn(t,[l.x[0]-p[0],l.x[1]-p[1],l.x[2]-p[2]]),m=ae(i,s.pivot),d=oe(r,"root"),[b,u,R]=Dt(i);d.set([b,u,R,h[0]-m[0],h[1]-m[1],h[2]-m[2],1,1,1]);for(let w of this.defs){let A=oe(r,w.role);if(w.name===this.torso){A.set([0,0,0,0,0,0,1,1,1]);continue}let k=w.joint?w.joint.parent===this.torso?i:o.get(w.joint.parent):i,[x,f,S]=Dt(Be(xt(k),o.get(w.name)));A.set([x,f,S,0,0,0,1,1,1]);}return r}placed(t,r){let o=this.keyPose(t),a=o.get("root"),n=this.yaw0*(1-r),s=jn(n),l=Be(s,Qe(a[I.rx],a[I.ry],a[I.rz])),i=ae(s,[a[I.px],a[I.py],a[I.pz]]),[c,p,h]=Dt(l),m=this.off0,d=this.off1;return a.set([c,p,h,i[0]+m[0]+(d[0]-m[0])*r,i[1]+m[1],i[2]+m[2]+(d[2]-m[2])*r,1,1,1]),o}keyPose(t){let r=new Map;oe(r,"root");for(let o of this.defs)oe(r,o.role);for(let[o,a]of Object.entries(this.keys)){let[n,s]=o.split(".");oe(r,n)[I[s]]=On(a,t);}return r}};function f0(e,t){return De(e,t),e}function ra(e,t,r,o){let a=new Set([...t.keys(),...r.keys()]),n=[0,0,0,0,0,0,1,1,1],s=new Map;for(let l of a){let i=t.get(l)??Float64Array.from(n),c=r.get(l)??Float64Array.from(n),p=uo(Qe(i[0],i[1],i[2])),h=uo(Qe(c[0],c[1],c[2])),[m,d,b]=Dt(Zo(Sn(p,h,o))),u=new Float64Array(9);u[0]=m,u[1]=d,u[2]=b;for(let R=3;R<9;R++)u[R]=i[R]+(c[R]-i[R])*o;s.set(l,u);}return De(e,s),e}var Ht=1/16,y0=.68,Gn=.85,g0=1.2,x0=1.03,w0=1.1,R0=.12,k0=.1,v0=.1;function bo(e){let t=r=>r.toFixed(4);e.fragmentShader=e.fragmentShader.replace("#include <tonemapping_fragment>",`{
2
2
  vec3 c = gl_FragColor.rgb;
3
3
  float l = dot(c, vec3(0.2126, 0.7152, 0.0722));
4
- c = mix(vec3(l), c, ${t(y0)});
4
+ c = mix(vec3(l), c, ${t(g0)});
5
5
  #ifdef TONE_MAPPING
6
- c = (c - 0.5) * ${t(g0)} + 0.5;
7
- #else
8
6
  c = (c - 0.5) * ${t(x0)} + 0.5;
7
+ #else
8
+ c = (c - 0.5) * ${t(w0)} + 0.5;
9
9
  #endif
10
10
  gl_FragColor.rgb = clamp(c, 0.0, 1.0);
11
11
  }
@@ -14,29 +14,29 @@ import {c,d}from'../chunk-YOAPVGXE.js';import {b,a}from'../chunk-CGF2TQVK.js';im
14
14
  {
15
15
  vec3 c = gl_FragColor.rgb;
16
16
  float avg = (c.r + c.g + c.b) / 3.0;
17
- c += (avg - c) * (1.0 - 1.0 / (1.001 - ${t(w0)}));
17
+ c += (avg - c) * (1.0 - 1.0 / (1.001 - ${t(R0)}));
18
18
  c = min(c, 1.0);
19
- c = clamp((c - 0.5) / (1.0 - ${t(R0)}) + 0.5, 0.0, 1.0);
19
+ c = clamp((c - 0.5) / (1.0 - ${t(k0)}) + 0.5, 0.0, 1.0);
20
20
  float lu = dot(c, vec3(0.2126, 0.7152, 0.0722));
21
- c += ${t(k0)} * lu * lu;
21
+ c += ${t(v0)} * lu * lu;
22
22
  gl_FragColor.rgb = clamp(c, 0.0, 1.0);
23
23
  }
24
- #endif`);}function ta(e,t,r){if(!e)return new B.MeshLambertMaterial(r);let o=new B.MeshStandardMaterial({...r,roughness:t,metalness:0});return o.onBeforeCompile=uo,o}function v0(e,t){if(e==="glass"){if(!t)return new B.MeshLambertMaterial({transparent:true,opacity:.5,depthWrite:false});let o=new B.MeshStandardMaterial({transparent:true,opacity:.42,depthWrite:false,roughness:.08,metalness:.2});return o.onBeforeCompile=uo,o}if(e==="glow"){let o={emissive:16777215,emissiveIntensity:.85};return t?new B.MeshStandardMaterial({...o,roughness:.6}):new B.MeshLambertMaterial(o)}if(!t)return new B.MeshLambertMaterial({alphaTest:.5});let r=new B.MeshStandardMaterial({alphaTest:.5,roughness:.28,metalness:.85});return r.onBeforeCompile=uo,r}var jn=5921370;function Gn(e){let t=(r,o)=>r.replace(`#include <${o}>`,B.ShaderChunk[o].replace("varying vec2 vMapUv","centroid varying vec2 vMapUv"));e.vertexShader=t(e.vertexShader,"uv_pars_vertex"),e.fragmentShader=t(e.fragmentShader,"uv_pars_fragment");}function A0(e){Gn(e),uo(e);}var fo=class{group=new B.Group;root=new B.Group;asset;spec;bones=new Map;byRole=new Map;meshes=[];material;decalMat;gloss;decal=null;expression=null;sockets=new Map;attached=new Map;label=null;shadows;layer;brightness=1;painter;prints=[];printMeshes=[];printMats=new Map;partMats=new Map;emotion;ik=null;ikGoals={ground:null,look:null,handR:null,handL:null,seat:null};toWorldM=new B.Matrix4;toModelM=new B.Matrix4;tmpV=new B.Vector3;ragdoll=null;ragWorld=null;ragPush=null;ragHit=null;ragRise=false;ragOn=false;drifted=new Map;snaps=[null,null];snapDt=0;constructor(t=Ot(),r={}){this.spec=t,this.shadows=r.shadows??true,this.layer=r.layer??0,this.painter=r.facePainter??null,this.gloss=r.gloss??false,this.material=ta(this.gloss,b0,{alphaTest:.5}),this.material.onBeforeCompile=this.gloss?A0:Gn,this.decalMat=ta(this.gloss,Hn,{alphaTest:.5,polygonOffset:true,polygonOffsetFactor:-2,polygonOffsetUnits:-2}),this.group.add(this.root),this.asset=Do(t),this.build(),r.name&&this.setName(r.name);}get height(){let t=this.asset.layout;return t.height*t.scale*Ht}get eye(){let t=this.asset.layout;return t.eye*t.scale*Ht}get expressions(){return Object.keys(this.asset.layout.face?.uv??{})}get hash(){return this.asset.layout.hash}setSpec(t){let r=Do(t);if(r===this.asset){oo(r);return}this.clear(),oo(this.asset),this.asset=r,this.spec=t,this.build();}build(){let{layout:t,skinned:r,texture:o}=this.asset;this.material.map=o,this.material.needsUpdate=true,this.useFaceMap(),this.root.scale.setScalar(t.scale*Ht);let a=new Map(t.bones.map(p=>[p.name,p.pivot])),n=[],s=[];for(let p of t.bones){let h=new B.Bone;n.push(h),s.push(new B.Matrix4().makeTranslation(-p.pivot[0],-p.pivot[1],-p.pivot[2]));let m=p.parent?a.get(p.parent)??[0,0,0]:[0,0,0],d=[p.pivot[0]-m[0],p.pivot[1]-m[1],p.pivot[2]-m[2]];h.position.set(...d);let b={name:p.name,role:p.role,group:h,rest:d};this.bones.set(p.name,b);let u=this.byRole.get(p.role)??[];u.push(b),this.byRole.set(p.role,u);}for(let p of t.bones){let h=this.bones.get(p.name);((p.parent?this.bones.get(p.parent):void 0)?.group??this.root).add(h.group);}let l=new B.Skeleton(n,s),i=(p,h,m)=>{let d=new B.SkinnedMesh(p,h);d.bind(l,new B.Matrix4);let b=(r??p).boundingSphere;b&&(d.boundingSphere=new B.Sphere(b.center.clone(),b.radius*1.6)),d.castShadow=m&&this.shadows,d.receiveShadow=this.shadows,d.layers.set(this.layer),this.meshes.push(d),this.root.add(d);};r&&i(r,this.material,true);for(let[p,h]of this.asset.skinnedMats){let m=this.partMats.get(p);m||this.partMats.set(p,m=v0(p,this.gloss)),m.map=this.asset.texture,p==="glow"&&(m.emissiveMap=this.asset.texture),m.needsUpdate=true,i(h,m,p!=="glass");}let c=t.face;if(c){let p=new B.BufferGeometry,h=c.grid;if(h){p.setAttribute("position",new B.BufferAttribute(h.positions,3)),p.setAttribute("normal",new B.BufferAttribute(h.normals,3)),p.setAttribute("uv",new B.BufferAttribute(new Float32Array(h.t.length),2));let m=[],d=h.cols+1;for(let b=0;b<h.rows;b++)for(let u=0;u<h.cols;u++){let R=b*d+u;m.push(R,R+d+1,R+1,R,R+d,R+d+1);}p.setIndex(m);}else {p.setAttribute("position",new B.BufferAttribute(c.corners,3));let m=new Float32Array(12);for(let d=0;d<4;d++)m[d*3+2]=-1;p.setAttribute("normal",new B.BufferAttribute(m,3)),p.setAttribute("uv",new B.BufferAttribute(new Float32Array(8),2)),p.setIndex([0,2,1,0,3,2]);}this.decal=new B.Mesh(p,this.decalMat),this.decal.layers.set(this.layer),this.bones.get(c.bone)?.group.add(this.decal),this.expression=null,this.setExpression("neutral");}for(let p of t.sockets){let h=new B.Object3D;h.position.set(...p.at),h.scale.setScalar(1/(t.scale*Ht)),this.bones.get(p.bone)?.group.add(h),this.sockets.set(p.name,h);let m=this.attached.get(p.name);m&&h.add(m);}this.buildPrints(),this.placeLabel(),this.ik=new Mr(t),this.ragdoll=new Pr(t),this.ragWorld&&this.ragdoll.setWorld(this.ragWorld),this.ragOn=false,this.snaps=[null,null],this.setBrightness(this.brightness);}setPrints(t){this.prints=t??[],this.buildPrints(),this.setBrightness(this.brightness);}buildPrints(){for(let o of this.printMeshes)o.removeFromParent(),o.geometry.dispose();this.printMeshes=[];let t=new Set,r=new Map;for(let o of this.prints){let a=this.bones.get(o.bone),n=this.asset.layout.bones.find(p=>p.name===o.bone);if(!a||!n)continue;let s=this.printMats.get(o.texture);s||(s=ta(this.gloss,Hn,{map:o.texture,emissiveMap:o.texture,emissive:jn,transparent:true,alphaTest:.02,polygonOffset:true,polygonOffsetFactor:-2,polygonOffsetUnits:-2}),this.printMats.set(o.texture,s)),t.add(o.texture);let l=new B.PlaneGeometry(o.w,o.h);o.facing==="front"&&l.rotateY(Math.PI),l.translate(o.center[0]-n.pivot[0],o.center[1]-n.pivot[1],o.center[2]-n.pivot[2]);let i=`${o.bone}|${o.texture.uuid}`,c=r.get(i)??{node:a,mat:s,geos:[]};c.geos.push(l),r.set(i,c);}for(let{node:o,mat:a,geos:n}of r.values()){let s=n.length===1?n[0]:mergeGeometries(n)??n[0];if(s!==n[0])for(let i of n)i.dispose();let l=new B.Mesh(s,a);l.layers.set(this.layer),o.group.add(l),this.printMeshes.push(l);}for(let[o,a]of this.printMats)t.has(o)||(a.dispose(),this.printMats.delete(o));}clear(){for(let t of this.sockets.values())for(let r of [...t.children])t.remove(r);this.root.clear();for(let t of this.printMeshes)t.geometry.dispose();this.printMeshes=[],this.decal?.geometry.dispose(),this.decal=null;for(let t of this.meshes)t instanceof B.SkinnedMesh&&t.skeleton.dispose();this.meshes=[],this.bones=new Map,this.byRole=new Map,this.sockets.clear();}applyPose(t,r){let o=this.ragdoll?.drift;if(o){De(this.drifted,t);let i=oe(this.drifted,"root");for(let c=0;c<3;c++)i[I.px+c]=i[I.px+c]+o[c];t=this.drifted;}let a=this.ragdoll?.supported?this.ragdoll:null,n=false;a&&(this.ragHit||a.state==="flinch")&&r&&this.ik&&(t=this.solveIK(t,r),n=true);let s=a?this.driveRagdoll(t,r?.dt??0):null;s?t=s:(!n&&r&&this.ik&&(t=this.solveIK(t,r)),this.remember(t,r?.dt??0));let l=t.get("root");if(l){this.root.rotation.set(l[I.rx],l[I.ry],l[I.rz]);let i=this.asset.layout.scale*Ht;this.root.position.set(l[I.px]*i,l[I.py]*i,l[I.pz]*i);}else this.root.rotation.set(0,0,0),this.root.position.set(0,0,0);for(let[i,c]of this.byRole){let p=t.get(i);for(let h of c){let m=h.group;if(!p){m.rotation.set(0,0,0),m.position.set(...h.rest),m.scale.set(1,1,1);continue}m.rotation.set(p[I.rx],p[I.ry],p[I.rz]),m.position.set(h.rest[0]+p[I.px],h.rest[1]+p[I.py],h.rest[2]+p[I.pz]),m.scale.set(p[I.sx],p[I.sy],p[I.sz]);}}}fall(t=[0,0,0]){if(!this.ragdoll?.supported)return false;let r=Array.isArray(t)?[t[0],t[1],t[2]]:[t.x,t.y,t.z];return this.ragdoll.state==="fall"?this.ragdoll.push(r):this.ragPush=r,this.ragRise=false,true}hit(t,r=null){if(!this.ragdoll?.supported)return false;let o=Array.isArray(t)?[t[0],t[1],t[2]]:[t.x,t.y,t.z],a=r===null||typeof r=="string"?r:Array.isArray(r)?[r[0],r[1],r[2]]:[r.x,r.y,r.z];return this.ragdoll.state==="fall"||this.ragPush?this.fall(o):(this.ragHit={push:o,at:a},true)}getUp(){(this.ragdoll?.state==="fall"||this.ragPush)&&(this.ragRise=true);}stopRagdoll(){this.ragdoll?.stop(),this.ragPush=null,this.ragHit=null,this.ragRise=false;}takeRagdollDrift(){let t=this.ragdoll;if(!t||t.state!=="none")return null;let r=this.ragdollDrift;return r?(t.clearDrift(),this.ik?.reset(),this.snaps=[null,null],r):null}get ragdollDrift(){let t=this.ragdoll?.drift;if(!t)return null;let r=this.ragFrame();return ae(r.rot,[t[0]*r.scale,t[1]*r.scale,t[2]*r.scale])}get ragdollState(){return this.ragPush?"fall":this.ragHit?"flinch":this.ragdoll?.state??"none"}get ragdollResting(){return !!this.ragdoll?.resting}supportsRagdoll(){return !!this.ragdoll?.supported}setColliders(t){this.ragWorld=t,this.ragdoll&&this.ragdoll.setWorld(t??{floor:null});}ragFrame(){let t=this.asset.layout.scale*Ht;this.group.updateWorldMatrix(true,false);let r=new B.Vector3,o=new B.Quaternion,a=new B.Vector3;this.group.matrixWorld.decompose(r,o,a);let n=new B.Matrix4().makeRotationFromQuaternion(o).elements;return {rot:[n[0],n[4],n[8],n[1],n[5],n[9],n[2],n[6],n[10]],scale:t*a.x,origin:[r.x,r.y,r.z]}}remember(t,r){if(!this.ragdoll?.supported)return;let a=this.snaps[0]??{pose:new Map,frame:this.ragFrame()};De(a.pose,t),a.frame=this.ragFrame(),this.snaps=[this.snaps[1]??null,a],this.snapDt=r;}driveRagdoll(t,r){let o=this.ragdoll,a=this.ragFrame();if(this.ragPush){let l=this.snaps[1]??{pose:t,frame:a};o.start(this.snaps[1]?this.snaps[0]??null:null,l,this.snapDt,this.ragPush),this.ragPush=null;}this.ragHit&&(o.hit({pose:t,frame:a},this.ragHit.push,this.ragHit.at),this.ragHit=null),this.ragRise&&o.state==="fall"&&(o.getUp(a),this.ragRise=false);let n=o.state==="flinch",s=o.drive(t,r,a);return n||(s?this.ragOn=true:this.ragOn&&(this.ragOn=false,this.ik?.reset(),this.snaps=[null,null])),s}setGround(t){this.ikGoals.ground=t;}lookAt(t){this.ikGoals.look=t;}reach(t,r){this.ikGoals[t]=r;}seat(t){this.ikGoals.seat=t;}supportsIK(t){return !!this.ik?.supports(t)}resetIK(){this.ik?.reset();}solveIK(t,r){let o=this.ikGoals,a=this.asset.layout.scale*Ht;this.group.updateWorldMatrix(true,false),this.toWorldM.copy(this.group.matrixWorld).scale(this.tmpV.set(a,a,a)),this.toModelM.copy(this.toWorldM).invert();let n=this.tmpV,s=h=>(n.set(h[0],h[1],h[2]).applyMatrix4(this.toWorldM),[n.x,n.y,n.z]),l=h=>(n.set(h[0],h[1],h[2]).applyMatrix4(this.toModelM),[n.x,n.y,n.z]),i=h=>{if(!h)return null;let m;return h instanceof B.Vector3?m=h:h instanceof B.Object3D?m=h.getWorldPosition(new B.Vector3):m=h(),m?l([m.x,m.y,m.z]):null},c=o.ground,p=c?(h,m,d)=>{let[b,u,R]=s([h,m,d]),w=c(b,R,u);return w===null?null:l([b,w,R])[1]}:null;return this.ik.solve(t,{dt:r.dt,plant:r.plant,standing:r.standing,ground:p,look:i(o.look),handR:i(o.handR),handL:i(o.handL),seat:i(o.seat),toWorld:s,toModel:l})}setFacePainter(t){if(t===this.painter)return;this.painter=t,this.useFaceMap();let r=this.expression??"neutral";this.expression=null,this.setExpression(r);}useFaceMap(){let t=this.painter;this.decalMat.map=t?t.texture:this.asset.texture,this.decalMat.transparent=!!t,this.decalMat.alphaTest=t?.02:.5,this.decalMat.needsUpdate=true;}setExpression(t,r){if(t===this.expression&&(!this.painter||r===this.emotion)||!this.decal)return;let o=this.asset.layout.face?.uv,a=this.painter?[0,1,1,0]:o?.[t]??o?.neutral;if(!a)return;this.expression=t,this.emotion=r,this.painter?.paint(t,r);let[n,s,l,i]=a,c=this.decal.geometry.getAttribute("uv"),p=this.asset.layout.face?.grid;if(p)for(let h=0;h<c.count;h++)c.setXY(h,n+(l-n)*p.t[h*2],s+(i-s)*p.t[h*2+1]);else c.setXY(0,n,s),c.setXY(1,l,s),c.setXY(2,l,i),c.setXY(3,n,i);c.needsUpdate=true;}materials(){return [this.material,this.decalMat,...this.partMats.values()]}setBrightness(t){this.brightness=t,this.material.color.setScalar(t),this.decalMat.color.setScalar(t);for(let r of this.printMats.values())r.color.setScalar(t);for(let r of this.partMats.values())r.color.setScalar(t);}setEmissive(t){if(this.material.emissive.getHex()!==t){this.material.emissive.setHex(t),this.decalMat.emissive.setHex(t);for(let r of this.printMats.values())r.emissive.setHex(t||jn);for(let[r,o]of this.partMats)r!=="glow"&&o.emissive.setHex(t);}}setShadows(t){if(t!==this.shadows){this.shadows=t;for(let r of this.meshes)r.castShadow=t&&!r.material.transparent;}}attach(t,r){let o=this.attached.get(t);if(o!==r){if(o&&o.removeFromParent(),!r){this.attached.delete(t);return}this.attached.set(t,r),this.sockets.get(t)?.add(r);}}attachedAt(t){return this.attached.get(t)??null}setName(t){this.label&&Go(this.label),this.label=t?pn(t):null,this.label&&this.group.add(this.label),this.placeLabel();}setLabelVisible(t){this.label&&(this.label.visible=t);}placeLabel(){this.label&&(this.label.position.y=this.height+.25);}forEachMesh(t){for(let r of this.meshes)t(r);this.decal&&t(this.decal);for(let r of this.printMeshes)t(r);}dispose(){this.group.removeFromParent();for(let t of this.attached.values())t.removeFromParent();this.attached.clear(),this.clear(),this.label&&Go(this.label),this.label=null,this.material.dispose(),this.decalMat.dispose();for(let t of this.printMats.values())t.dispose();this.printMats.clear();for(let t of this.partMats.values())t.dispose();this.partMats.clear(),oo(this.asset);}};var bo=new Map,ra=new Set;function rp(e){let t=tr(e);if(!bo.has(t)){bo.set(t,e);for(let r of ra)r(t);}return t}function op(e){return typeof e=="string"?bo.get(e):void 0}function ap(e){let t={};for(let r of e){let o=bo.get(r);o&&(t[r]=o);}return t}function np(e){return ra.add(e),()=>ra.delete(e)}var E0=["#b08a62","#8a6a4a","#c8a878","#9a9a92","#7a5c44"],S0=["#f1c9a5","#e6b892","#d9a982","#c08e68","#a0704c","#7a5238"],T0=["#6b4a2f","#4a3424","#8a5a3a","#c27a48","#d8b878","#2e2622","#a07850","#9a9690"],M0=["#a7bea9","#e6e0cc","#d9c9a3","#b9a083","#a9b8c4","#c8b4a0","#9fb0a0","#d8d2c4","#b98f74","#8fa3b5"],L0=["#8c9ca6","#a9b8b4","#8a8e94","#9fb3ad","#7d8a8f","#b0a58f"],C0=["#d9c9a3","#c8b48a","#a08a6a","#e6e0cc"];function pp(e,t="",r=""){let o=a(b("npc:"+e+"|"+t)),a$1=l=>l[Math.floor(o()*l.length)],n=Ho({top:a$1(sn),bottom:a$1(ln),shoes:a$1(cn),hair:a$1(["short","short","long","curly"]),hat:o()<.2,colors:{skin:a$1(S0),hair:a$1(T0),shirt:a$1(M0),pants:a$1(L0),boots:a$1(E0),hat:a$1(C0)}});n.name=e.slice(0,40),n.description=[t,r].filter(Boolean).join(" \u2014 ").slice(0,300),n.style={walk:a$1(["normal","normal","bouncy","heavy","sneaky"]),idle:a$1(["calm","calm","fidgety","proud"]),energy:Math.round(o()*10)/10},n.tags=["npc",...t?[t.slice(0,24)]:[]];let s=Ye(n);return s.ok?s.spec:Ot()}var Rt=([e,t,r])=>"#"+[e,t,r].map(o=>Math.round(o).toString(16).padStart(2,"0")).join("");function P0(e){if(!e.length)return null;let t=r=>{let o=e.map(a=>a[r]).sort((a,n)=>a-n);return o[o.length>>1]};return [t(0),t(1),t(2)]}function z0(e,t){let{width:r,height:o,data:a}=e,n=(w,A)=>{let k=(A*r+w)*4;return [a[k],a[k+1],a[k+2]]},s=[n(0,0),n(r-1,0),n(0,o-1),n(r-1,o-1)],l=[0,1,2].map(w=>s.reduce((A,k)=>A+k[w],0)/4),i=w=>Math.abs(w[0]-l[0])+Math.abs(w[1]-l[1])+Math.abs(w[2]-l[2])>60,c=r,p=-1,h=o,m=-1;for(let w=0;w<o;w+=2)for(let A=0;A<r;A+=2)i(n(A,w))&&(c=Math.min(c,A),p=Math.max(p,A),h=Math.min(h,w),m=Math.max(m,w));p<0&&(c=0,p=r-1,h=0,m=o-1);let d=m-h+1,b=p-c+1,u=c+Math.floor(b*.3),R=c+Math.ceil(b*.7);return t.map(([w,A])=>{let k=[];for(let x=h+Math.floor(d*w);x<h+Math.ceil(d*A);x++)for(let f=u;f<R;f++){if(x<0||x>=o||f<0||f>=r)continue;let S=n(f,x);i(S)&&k.push(S);}return P0(k)})}var I0=[[0,.06],[.1,.22],[.3,.52],[.6,.86],[.92,1]];function fp(e,t="humanoid",r=to()){let[o,a,n,s,l]=z0(e,I0);if(t==="humanoid"){let c=JSON.parse(JSON.stringify(jo));c.palette=No(c.palette,{...o?{hair:Rt(o)}:{},...a?{skin:Rt(a)}:{},...n?{shirt:Rt(n)}:{},...s?{pants:Rt(s)}:{},...l?{boots:Rt(l)}:{}}),c.name=r,c.tags=[];let p=Ye(c);return p.ok?p.spec:Ot()}let i=Ye({name:r,rig:t,palette:{s:Rt(a??o??[198,156,124]),t:Rt(n??[58,143,214]),p:Rt(s??l??[44,62,107]),w:"#f4f4f4",b:"#1d1d21"},textures:{f_neutral:{w:4,h:2,rows:["wbbw","...."]},f_blink:{w:4,h:2,rows:["bbbb","...."]}},face:{rect:t==="blob"?[4,4,4,2]:t==="flyer"?[0,1,4,2]:[2,2,4,2],expressions:{neutral:"f_neutral",blink:"f_blink"}}});return i.ok?i.spec:Ot()}var _0={normal:{},bouncy:{amp:.9,arm:.8,bob:1.6,tempo:1.1,sway:.04},heavy:{amp:.6,arm:.4,bob:.6,tempo:.8,sway:.12},sneaky:{amp:.5,arm:.3,tempo:1.2},robotic:{amp:.7,arm:.7,quant:true},swagger:{amp:.7,arm:.5,bob:.8,tempo:.85,sway:.1,swagger:.22},skip:{amp:.9,arm:.9,bob:1.2,tempo:1.05,skip:1},ninja:{amp:.6,arm:.2,tempo:1.25,crouch:2.2},zombie:{amp:.45,arm:.05,tempo:.6,sway:.14,reach:1.45},catwalk:{amp:.7,arm:.45,tempo:.95,sway:.08,cross:.12}},O0={calm:{},fidgety:{fidget:1,breath:1.3},proud:{chest:.08,breath:.8},cool:{pose:"hips",chest:.04,breath:.8},shy:{pose:"shy",breath:1.1},ready:{pose:"ready",breath:1.4},bored:{pose:"bored",breath:.7,fidget:.4}};function oa(e){let t={amp:.8,arm:.6,bob:0,tempo:1,sway:0,quant:false,breath:1,fidget:0,chest:0,reach:0,crouch:0,skip:0,cross:0,swagger:0,pose:"none",..._0[e.walk],...O0[e.idle]};return t.tempo*=.8+.4*e.energy,t.amp*=.85+.3*e.energy,t}function jt(e,t=0){let r=Math.sin(e.phase+t);return e.style.quant?Math.max(-1,Math.min(1,r*3)):r}function aa(e,t,r){let o=jt(t)*r;y(e,"legL","rx",o),y(e,"legR","rx",-o),y(e,"legFL","rx",o),y(e,"legBR","rx",o),y(e,"legFR","rx",-o),y(e,"legBL","rx",-o);}function na(e,t,r){let o=jt(t)*r;y(e,"armL","rx",-o),y(e,"armR","rx",o);}function sa(e,t,r,o){let a=jt(t),n=Math.max(0,Math.cos(t.phase))*Math.max(0,-a+.3),s=Math.max(0,-Math.cos(t.phase))*Math.max(0,a+.3);y(e,"shinL","rx",-r*(.15+n)),y(e,"shinR","rx",-r*(.15+s)),y(e,"foreArmL","rx",o*(.6+.4*Math.max(0,-a))),y(e,"foreArmR","rx",o*(.6+.4*Math.max(0,a)));}var V0=(e,t)=>{let r=Math.sin(t.clock*2)*t.style.breath;y(e,"armL","rz",-0.04-.03*r),y(e,"armR","rz",.04+.03*r),y(e,"foreArmL","rx",.12+.02*r),y(e,"foreArmR","rx",.12+.02*r),y(e,"head","rx",.03*Math.sin(t.clock*1.7)+t.style.chest),y(e,"body","rx",t.style.chest*-0.5),t.style.fidget&&(y(e,"head","ry",.35*Math.sin(t.clock*.7)*Math.sin(t.clock*.31)),y(e,"root","ry",.05*Math.sin(t.clock*.9))),y(e,"body","sy",1+.04*Math.sin(t.clock*3)),F0(e,t);};function F0(e,t){let r=Math.sin(t.clock*2);switch(t.style.pose){case "hips":y(e,"armL","rz",-0.75),y(e,"armR","rz",.75),y(e,"foreArmL","rx",.2),y(e,"foreArmR","rx",.2),y(e,"foreArmL","rz",1.5),y(e,"foreArmR","rz",-1.5),y(e,"legL","rz",-0.06),y(e,"legR","rz",.06);break;case "shy":y(e,"armL","rx",-0.35),y(e,"armR","rx",-0.35),y(e,"foreArmL","rx",.5),y(e,"foreArmR","rx",.5),y(e,"head","rx",-0.15+.03*r),y(e,"legR","rx",.15+.08*Math.sin(t.clock*1.3)),y(e,"shinR","rx",-0.3);break;case "ready":y(e,"legL","rz",-0.16),y(e,"legR","rz",.16),y(e,"legL","rx",.25),y(e,"legR","rx",-0.15),y(e,"shinL","rx",-0.35),y(e,"shinR","rx",-0.25),y(e,"armL","rx",.9),y(e,"armR","rx",.7),y(e,"foreArmL","rx",1.4),y(e,"foreArmR","rx",1.5),y(e,"root","py",-0.6+.3*Math.abs(Math.sin(t.clock*3.2)));break;case "bored":y(e,"root","rz",.04),y(e,"legL","rz",-0.04),y(e,"shinR","rx",-0.25),y(e,"legR","rx",.12),y(e,"head","rz",.12+.03*r),y(e,"body","rx",-0.06);break;}}var D0=(e,t)=>{aa(e,t,t.style.amp),na(e,t,t.style.arm),sa(e,t,t.style.amp*1.1,.35);let r=t.style.bob*Math.abs(Math.cos(t.phase));y(e,"root","py",r),y(e,"body","rz",t.style.sway*jt(t)),B0(e,t);};function B0(e,t){let r=t.style;if(r.reach&&(y(e,"armL","rx",r.reach+.05*Math.sin(t.phase)),y(e,"armR","rx",r.reach-.05*Math.sin(t.phase)),y(e,"foreArmL","rx",.1),y(e,"foreArmR","rx",.1),y(e,"head","rz",.15*Math.sin(t.phase*.5))),r.crouch&&(y(e,"root","py",-r.crouch),y(e,"body","rx",-0.3),y(e,"head","rx",.25),de(e,"shinL","rx",-0.5),de(e,"shinR","rx",-0.5),de(e,"legL","rx",.35),de(e,"legR","rx",.35),y(e,"armL","rx",-0.9),y(e,"armR","rx",-0.9)),r.skip){let o=Math.max(0,Math.sin(t.phase));de(e,"root","py",2.2*r.skip*o*o),de(e,"armL","rz",-0.3*o),de(e,"armR","rz",.3*o);}r.cross&&(y(e,"legL","rz",r.cross),y(e,"legR","rz",-r.cross),y(e,"root","ry",.12*jt(t))),r.swagger&&(y(e,"body","ry",r.swagger*jt(t)),y(e,"head","rz",-0.5*r.swagger*jt(t)),y(e,"armL","rz",-0.2),y(e,"armR","rz",.2));}var N0=(e,t)=>{aa(e,t,t.style.amp*1.3),na(e,t,t.style.arm*1.6),sa(e,t,t.style.amp*1.6,1.1),y(e,"body","rx",-0.18),y(e,"head","rx",.18),y(e,"root","py",(.8+t.style.bob)*Math.abs(Math.cos(t.phase)));},H0=(e,t)=>{aa(e,t,t.style.amp*.5*Math.min(1,t.input.speed)),na(e,t,t.style.arm*.4*Math.min(1,t.input.speed)),y(e,"body","rx",-0.45),y(e,"head","rx",.45),de(e,"armL","rx",.25),de(e,"armR","rx",.25),sa(e,t,.9,.6),y(e,"root","py",-1.5);},j0=(e,t)=>{y(e,"root","rx",-1.3),y(e,"head","rx",1),y(e,"armL","rx",Math.PI-.5+.5*Math.sin(t.t*3)),y(e,"armR","rx",Math.PI-.5+.5*Math.sin(t.t*3+Math.PI)),y(e,"legL","rx",.3*Math.sin(t.t*8)),y(e,"legR","rx",-0.3*Math.sin(t.t*8));},G0=(e,t)=>{y(e,"legL","rx",.15),y(e,"legR","rx",.1),y(e,"armL","rz",-0.15),y(e,"armR","rz",.15),y(e,"root","py",.6*Math.sin(t.t*2));},q0=e=>{y(e,"root","rx",-1.35),y(e,"head","rx",1.1),y(e,"armL","rz",-1.3),y(e,"armR","rz",1.3);},U0=(e,t)=>{let r=.15*Math.sin(t.t*10);y(e,"armL","rz",-0.6-r),y(e,"armR","rz",.6+r),y(e,"legL","rx",.25),y(e,"legR","rx",-0.25),y(e,"shinL","rx",-0.5),y(e,"shinR","rx",-0.3),y(e,"foreArmL","rx",.4),y(e,"foreArmR","rx",.4);},K0=e=>{y(e,"legL","rx",1.45),y(e,"legR","rx",1.45),y(e,"legL","ry",.1),y(e,"legR","ry",-0.1),y(e,"shinL","rx",-1.45),y(e,"shinR","rx",-1.45),y(e,"root","py",-10),y(e,"body","rx",.4),y(e,"legBL","rx",1.2),y(e,"legBR","rx",1.2);},Y0=e=>{y(e,"legL","rx",1.4),y(e,"legR","rx",1.4),y(e,"legL","rz",-0.3),y(e,"legR","rz",.3),y(e,"armL","rx",.45),y(e,"armR","rx",.45),y(e,"shinL","rx",-1.2),y(e,"shinR","rx",-1.2),y(e,"foreArmL","rx",.5),y(e,"foreArmR","rx",.5);},W0=e=>{y(e,"root","rx",Math.PI/2),y(e,"root","py",2);},$0=e=>{y(e,"root","rz",Math.PI/2),y(e,"root","py",2);},X0=(e,t)=>{let r=Math.sin(t.phase*.5);y(e,"root","py",6*Math.max(0,r));let o=r<0?.2*-r:0;y(e,"body","sy",1-o+.1*Math.max(0,r)),y(e,"body","sx",1+o*.6),y(e,"body","sz",1+o*.6);},J0=(e,t)=>{let r=Math.min(t.input.speed,8),o=Math.sin(t.clock*(3+r*1.2)),a=.25+r*.04;y(e,"tail","ry",a*1.6*o),y(e,"body","ry",-a*.35*o),y(e,"root","py",.4*Math.sin(t.clock*1.6));},Q0=(e,t)=>{let r=Math.sin(Math.PI*t.k);y(e,"armR","rx",1.9*r),y(e,"armR","ry",.3*r),y(e,"body","ry",-0.3*r),y(e,"foreArmR","rx",.6*r);},Z0=(e,t)=>{let r=Math.sin(Math.PI*t.k);y(e,"armR","rx",.9*r);},el=(e,t)=>{let r=t.k<.4?-1.5*(t.k/.4):-1.5+3.5*((t.k-.4)/.6);y(e,"armR","rx",t.k>.9?r*(1-t.k)*10:r);},tl=(e,t)=>{let r=Math.sin(Math.PI*t.k)*(1-t.k);y(e,"armR","rx",.35*r),y(e,"foreArmR","rx",.5*r),y(e,"armL","rx",.2*r),y(e,"body","rx",-0.05*r);},rl=(e,t)=>{let r=t.k<.35?t.k/.35:Math.max(0,1-(t.k-.35)/.65);y(e,"armR","rx",1.55*r),y(e,"armR","ry",-0.15*r),y(e,"foreArmR","rx",.2*(1-r)),y(e,"body","ry",.35*r),y(e,"armL","rx",.6),y(e,"foreArmL","rx",1.2);},ol=e=>{y(e,"armR","rx",1.5),y(e,"foreArmR","rx",.05),y(e,"armL","rx",1.3),y(e,"armL","ry",-0.45),y(e,"foreArmL","rx",.3);},al=e=>{y(e,"armR","rx",1.25),y(e,"armR","ry",.25),y(e,"foreArmR","rx",.9),y(e,"armL","rx",1.45),y(e,"armL","ry",-0.35),y(e,"foreArmL","rx",.25),y(e,"body","ry",.25),y(e,"head","ry",-0.2);},nl=(e,t)=>{let r=Math.sin(Math.PI*t.k);y(e,"body","rx",.15*r),y(e,"head","rx",.2*r),y(e,"root","rz",.05*r);},sl=(e,t)=>{let r=Math.sin(Math.PI*t.k);y(e,"root","py",-1.5*r),y(e,"legL","rx",.2*r),y(e,"legR","rx",.2*r),y(e,"shinL","rx",-0.5*r),y(e,"shinR","rx",-0.5*r),y(e,"body","sy",1-.2*r),y(e,"body","sx",1+.12*r),y(e,"body","sz",1+.12*r);},il=(e,t)=>{y(e,"armR","rx",1.3+.1*Math.sin(t.t*16)),y(e,"armR","ry",-0.5),y(e,"head","rx",-0.1+.08*Math.sin(t.t*16));},ll=e=>{y(e,"armR","rx",2),y(e,"armR","ry",-0.4),y(e,"head","rx",.35);},cl=e=>{y(e,"armR","rx",1.57),y(e,"armR","ry",-0.1),y(e,"armL","rx",1.57),y(e,"armL","ry",.35);},pl=e=>{y(e,"armL","rx",.9),y(e,"armL","ry",-0.6);},zr={idle:V0,walk:D0,run:N0,sneak:H0,swim:j0,fly:G0,glide:q0,fall:U0,sit:K0,ride:Y0,sleep:W0,dead:$0,hop:X0,swing:Q0,place:Z0,throw:el,shoot:tl,punch:rl,aimPistol:ol,aimRifle:al,hurt:nl,land:sl,eat:il,drink:ll,draw:cl,block:pl,fin:J0},qn={blob:{walk:"hop",run:"hop",sneak:"hop"},swimmer:{idle:"fin",walk:"fin",run:"fin",sneak:"fin",swim:"fin",fall:"fin"}},Un={swing:.3,place:.2,throw:.45,shoot:.16,punch:.28,hurt:.3,land:.22};function ie(e,t,r=.3){let o={};for(let[a,n]of Object.entries(t))o[a]=[[0,0],[r,n],[Math.max(r,e-r),n],[e,0]];return o}function N(e,t){let r={};for(let[o,a]of Object.entries(t))r[o]=[[0,a],[e,a]];return r}function E(e,t,r,o,a,n=0,s=false){let l=Math.max(8,Math.round(a*8)),i=[];for(let c=0;c<=l;c++){let p=c/l,h=s?Math.min(1,p/.15,(1-p)/.15):1;i.push([e*p,(r+o*Math.sin(Math.PI*2*a*p+n))*h]);}return {[t]:i}}function kt(e,t){return [[0,t],[e,t]]}function P(e,t){return t.map(([r,o])=>[e*r,o])}function D(...e){return Object.assign({},...e)}var Kn={"legL.rx":1.5,"legR.rx":1.5,"shinL.rx":-1.5,"shinR.rx":-1.5,"root.py":-6.2},ml=4.1,Yn={"legL.rx":1.45,"legR.rx":1.45,"legL.ry":.75,"legR.ry":-0.75,"shinL.rx":-2.5,"shinR.rx":-2.5,"shinL.ry":-0.6,"shinR.ry":.6,"root.py":-10.2},Ir={"root.rx":Math.PI/2,"root.py":2.3,"root.pz":0};var be=Math.PI,Xn={"armR.rx":.55,"foreArmR.rx":1.35,"armR.rz":-0.15},_r={"armL.rx":.55,"foreArmL.rx":1.35,"armL.rz":.15},Wn={...Xn,..._r},$n={"armL.rx":.75,"armR.rx":.75,"foreArmL.rx":.85,"foreArmR.rx":.85,"head.rx":-0.2},Se=(e,t)=>N(e,{...Kn,...t}),yo=(e,t,r,o)=>D(E(e,"legL.rx",0,r,t),E(e,"legR.rx",0,r,t,be),E(e,"shinL.rx",-o,o,t,-be/2),E(e,"shinR.rx",-o,o,t,be/2)),ia={tiptoe:{label:"\u041D\u0430 \u0446\u044B\u043F\u043E\u0447\u043A\u0430\u0445",en:"Tiptoe",duration:1.6,loop:true,tracks:D(yo(1.6,2,.35,.35),N(1.6,{"root.py":.6,"body.rx":-0.12,"armL.rx":.6,"armR.rx":.6,"foreArmL.rx":1.4,"foreArmR.rx":1.4}),E(1.6,"head.ry",0,.25,1))},limp:{label:"\u041A\u043E\u0432\u044B\u043B\u044F\u0442\u044C",en:"Limp",duration:1.6,loop:true,emotion:"hurt",tracks:{"legL.rx":P(1.6,[[0,.4],[.5,-0.3],[1,.4]]),"legR.rx":P(1.6,[[0,-0.15],[.5,.15],[1,-0.15]]),"shinL.rx":P(1.6,[[0,-0.2],[.25,-0.9],[.5,-0.1],[1,-0.2]]),"root.py":P(1.6,[[0,0],[.5,-1],[1,0]]),"body.rz":P(1.6,[[0,.04],[.5,-0.1],[1,.04]]),"armR.rz":kt(1.6,.2)}},crawl:{label:"\u041F\u043E\u043B\u0437\u0442\u0438",en:"Crawl",duration:1.6,loop:true,tracks:D(N(1.6,{"root.rx":-1.35,"root.py":3.2,"head.rx":1.1,"legL.rx":1.3,"legR.rx":1.3,"shinL.rx":-1.4,"shinR.rx":-1.4}),E(1.6,"armL.rx",2,.4,2),E(1.6,"armR.rx",2,.4,2,be),E(1.6,"legL.ry",0,.15,2,be),E(1.6,"legR.ry",0,.15,2))},climb:{label:"\u041B\u0435\u0437\u0442\u044C \u043F\u043E \u043B\u0435\u0441\u0442\u043D\u0438\u0446\u0435",en:"Climb",duration:1.6,loop:true,tracks:D(E(1.6,"armL.rx",2.6,.4,1),E(1.6,"armR.rx",2.6,.4,1,be),E(1.6,"legL.rx",.7,.6,1,be),E(1.6,"legR.rx",.7,.6,1),E(1.6,"shinL.rx",-1,.6,1,be),E(1.6,"shinR.rx",-1,.6,1),N(1.6,{"head.rx":.4,"foreArmL.rx":.5,"foreArmR.rx":.5}))},jog:{label:"\u0411\u0435\u0433 \u0442\u0440\u0443\u0441\u0446\u043E\u0439",en:"Jog",duration:.9,loop:true,tracks:D(yo(.9,1,.6,.6),E(.9,"armL.rx",0,.6,1,be),E(.9,"armR.rx",0,.6,1),N(.9,{"foreArmL.rx":1.4,"foreArmR.rx":1.4,"body.rx":-0.1}),E(.9,"root.py",.8,.8,2))},carry:{label:"\u041D\u0435\u0441\u0442\u0438 \u043A\u043E\u0440\u043E\u0431\u043A\u0443",en:"Carry",duration:1,loop:true,layer:"upper",tracks:N(1,{"armL.rx":.9,"armR.rx":.9,"foreArmL.rx":.7,"foreArmR.rx":.7,"armL.rz":-0.25,"armR.rz":.25,"body.rx":.08})},push:{label:"\u0422\u043E\u043B\u043A\u0430\u0442\u044C",en:"Push",duration:1.4,loop:true,emotion:"determined",tracks:D(yo(1.4,1,.3,.5),N(1.4,{"body.rx":-0.45,"head.rx":.4,"armL.rx":1.4,"armR.rx":1.4,"foreArmL.rx":.5,"foreArmR.rx":.5,"root.py":-0.8}))},pull:{label:"\u0422\u044F\u043D\u0443\u0442\u044C",en:"Pull",duration:1.4,loop:true,emotion:"determined",tracks:D(yo(1.4,1,.25,.4),N(1.4,{"body.rx":.25,"armL.rx":1.2,"armR.rx":1.2,"foreArmL.rx":.3,"foreArmR.rx":.3,"root.py":-0.6}))},sitChair:{label:"\u0421\u0438\u0434\u0435\u0442\u044C \u043D\u0430 \u0441\u0442\u0443\u043B\u0435",en:"Sit on a chair",seat:true,duration:2,loop:true,tracks:D(Se(2,{"armL.rx":.4,"armR.rx":.4,"foreArmL.rx":.5,"foreArmR.rx":.5}),E(2,"head.rz",0,.04,1))},sitFloor:{label:"\u041F\u043E-\u0442\u0443\u0440\u0435\u0446\u043A\u0438",en:"Sit cross-legged",duration:2,loop:true,tracks:N(2,{...Yn,"armL.rx":.5,"armR.rx":.5,"foreArmL.rx":.6,"foreArmR.rx":.6})},sitKneel:{label:"\u041D\u0430 \u043A\u043E\u043B\u0435\u043D\u044F\u0445",en:"Kneel",duration:2,loop:true,tracks:N(2,{"shinL.rx":-1.5,"shinR.rx":-1.5,"root.py":-6.1,"armL.rx":.2,"armR.rx":.2})},sitEdge:{label:"\u041D\u0430 \u043A\u0440\u0430\u044E",en:"Sit on the edge",seat:true,duration:2.4,loop:true,tracks:D(Se(2.4,{"armL.rz":-0.3,"armR.rz":.3,"armL.rx":-0.2,"armR.rx":-0.2}),E(2.4,"shinL.rx",-1.2,.3,2),E(2.4,"shinR.rx",-1.2,.3,2,be))},sitLounge:{label:"\u0420\u0430\u0437\u0432\u0430\u043B\u0438\u0432\u0448\u0438\u0441\u044C",en:"Lounge",seat:true,duration:2,loop:true,emotion:"cool",tracks:Se(2,{"body.rx":.35,"head.rx":-0.2,"legL.rx":1.2,"shinL.rx":-0.6,"armL.rz":-2.6,"armR.rz":2.6,"foreArmL.rz":1.8,"foreArmR.rz":-1.8,"root.py":-6.8})},sitHug:{label:"\u041E\u0431\u0445\u0432\u0430\u0442\u0438\u0432 \u043A\u043E\u043B\u0435\u043D\u0438",en:"Hug knees",duration:2,loop:true,emotion:"sad",tracks:N(2,{"legL.rx":2.4,"legR.rx":2.4,"shinL.rx":-2.6,"shinR.rx":-2.6,"root.py":-10.2,"armL.rx":1,"armR.rx":1,"foreArmL.rx":.9,"foreArmR.rx":.9,"head.rx":-0.15,"body.rx":-0.15})},squat:{label:"\u041D\u0430 \u043A\u043E\u0440\u0442\u043E\u0447\u043A\u0430\u0445",en:"Squat",duration:2,loop:true,tracks:N(2,{"legL.rx":2,"legR.rx":2,"legL.rz":-0.2,"legR.rz":.2,"shinL.rx":-2.5,"shinR.rx":-2.5,"root.py":-7,"body.rx":-0.35,"head.rx":.3,"armL.rx":.7,"armR.rx":.7,"foreArmL.rx":.6,"foreArmR.rx":.6})},sitEat:{label:"\u0415\u0441\u0442\u044C \u0441\u0438\u0434\u044F",en:"Eat (seated)",seat:true,duration:1.2,loop:true,tracks:D(Se(1.2,{..._r,"armR.rx":.9}),E(1.2,"foreArmR.rx",1.5,.45,1),E(1.2,"head.rx",-0.1,.06,2))},sitDrink:{label:"\u041F\u0438\u0442\u044C \u0441\u0438\u0434\u044F",en:"Drink (seated)",seat:true,duration:2.4,loop:true,tracks:D(Se(2.4,{}),{"armR.rx":P(2.4,[[0,.6],[.3,1.2],[.6,1.2],[1,.6]]),"foreArmR.rx":P(2.4,[[0,1.3],[.3,2],[.6,2],[1,1.3]]),"head.rx":P(2.4,[[0,0],[.3,.3],[.6,.3],[1,0]])})},sitRead:{label:"\u0427\u0438\u0442\u0430\u0442\u044C \u0441\u0438\u0434\u044F",en:"Read (seated)",seat:true,duration:3,loop:true,tracks:D(Se(3,{...Wn,"head.rx":-0.3}),E(3,"head.ry",0,.08,1))},sitLaptop:{label:"\u0417\u0430 \u043D\u043E\u0443\u0442\u0431\u0443\u043A\u043E\u043C",en:"Laptop",seat:true,duration:1.2,loop:true,tracks:D(Se(1.2,$n),E(1.2,"foreArmL.rx",.85,.08,4),E(1.2,"foreArmR.rx",.85,.08,4,be))},sitWrite:{label:"\u041F\u0438\u0441\u0430\u0442\u044C \u0441\u0438\u0434\u044F",en:"Write (seated)",seat:true,duration:1.6,loop:true,tracks:D(Se(1.6,{...$n,"armL.rx":.6}),E(1.6,"foreArmR.rz",0,.15,3),E(1.6,"head.rz",0,.05,1))},sitTalk:{label:"\u0413\u043E\u0432\u043E\u0440\u0438\u0442\u044C \u0441\u0438\u0434\u044F",en:"Talk (seated)",seat:true,duration:2.4,loop:true,tracks:D(Se(2.4,{"armL.rx":.6,"foreArmL.rx":1}),E(2.4,"armR.rx",.8,.3,2),E(2.4,"foreArmR.rx",1.2,.4,3),E(2.4,"head.rz",0,.08,2))},sitLaugh:{label:"\u0421\u043C\u0435\u044F\u0442\u044C\u0441\u044F \u0441\u0438\u0434\u044F",en:"Laugh (seated)",seat:true,duration:1.6,loop:true,emotion:"happy",tracks:D(Se(1.6,{"armL.rx":.5,"armR.rx":.5,"foreArmL.rx":1,"foreArmR.rx":1}),E(1.6,"body.rx",.12,.1,4),E(1.6,"head.rx",.2,.1,4))},sitCry:{label:"\u041F\u043B\u0430\u043A\u0430\u0442\u044C \u0441\u0438\u0434\u044F",en:"Cry (seated)",seat:true,duration:2.4,loop:true,emotion:"crying",tracks:D(Se(2.4,{"armL.rx":2.2,"armR.rx":2.2,"foreArmL.rx":1.5,"foreArmR.rx":1.5,"head.rx":-0.45,"body.rx":-0.25}),E(2.4,"body.sy",1,.02,4))},sitDoze:{label:"\u041A\u043B\u0435\u0432\u0430\u0442\u044C \u043D\u043E\u0441\u043E\u043C",en:"Doze",seat:true,duration:3,loop:true,emotion:"sleepy",tracks:D(Se(3,{"armL.rx":.3,"armR.rx":.3}),{"head.rx":P(3,[[0,-0.15],[.6,-0.6],[.7,-0.1],[1,-0.15]])})},sitDrive:{label:"\u0420\u0443\u043B\u0438\u0442\u044C",en:"Drive",seat:true,duration:2.4,loop:true,tracks:D(Se(2.4,{"armL.rx":1.2,"armR.rx":1.2,"foreArmL.rx":.5,"foreArmR.rx":.5}),E(2.4,"armL.rz",.2,.2,1),E(2.4,"armR.rz",-0.2,.2,1),E(2.4,"body.rz",0,.05,1,be))},sitGamepad:{label:"\u0418\u0433\u0440\u0430\u0442\u044C \u0441 \u0433\u0435\u0439\u043C\u043F\u0430\u0434\u043E\u043C",en:"Gamepad",seat:true,duration:1.2,loop:true,emotion:"determined",tracks:D(Se(1.2,{"armL.rx":.8,"armR.rx":.8,"foreArmL.rx":1.2,"foreArmR.rx":1.2,"armL.rz":.25,"armR.rz":-0.25,"body.rx":-0.15,"head.rx":-0.05}),E(1.2,"foreArmL.rz",0,.08,4),E(1.2,"body.rz",0,.05,1))},sitClap:{label:"\u0425\u043B\u043E\u043F\u0430\u0442\u044C \u0441\u0438\u0434\u044F",en:"Clap (seated)",seat:true,duration:1.2,loop:true,emotion:"happy",tracks:D(Se(1.2,{"armL.rx":1.1,"armR.rx":1.1,"foreArmL.rx":.6,"foreArmR.rx":.6}),E(1.2,"foreArmL.rz",.55,.35,4),E(1.2,"foreArmR.rz",-0.55,-0.35,4))},lieBack:{label:"\u041B\u0435\u0436\u0430\u0442\u044C \u043D\u0430 \u0441\u043F\u0438\u043D\u0435",en:"Lie on the back",duration:3,loop:true,tracks:D(N(3,{...Ir,"armL.rz":-2.6,"armR.rz":2.6,"foreArmL.rz":1.6,"foreArmR.rz":-1.6,"legL.rx":.1}),E(3,"body.sy",1,.02,1))},lieSide:{label:"\u0421\u043F\u0430\u0442\u044C \u043D\u0430 \u0431\u043E\u043A\u0443",en:"Sleep on the side",duration:3,loop:true,emotion:"sleepy",tracks:D(N(3,{"root.rz":be/2,"root.py":4.6,"legL.rx":.7,"legR.rx":.4,"shinL.rx":-0.9,"shinR.rx":-0.6,"armL.rx":1.2,"armR.rx":.9,"foreArmL.rx":1.2,"head.rz":-0.2}),E(3,"body.sy",1,.02,1))},lieFront:{label:"\u041D\u0430 \u0436\u0438\u0432\u043E\u0442\u0435",en:"Lie on the front",duration:2.4,loop:true,tracks:D(N(2.4,{"root.rx":-be/2,"root.py":2.3,"head.rx":.9,"armL.rx":2.6,"armR.rx":2.6,"foreArmL.rx":1.6,"foreArmR.rx":1.6,"shinR.rx":-1.4}),E(2.4,"shinL.rx",-1.2,.5,1))},getUp:{label:"\u0412\u0441\u0442\u0430\u0442\u044C \u0441 \u043F\u043E\u043B\u0430",en:"Get up",duration:1.8,tracks:{"root.rx":P(1.8,[[0,be/2],[.3,.6],[.6,0],[1,0]]),"root.py":P(1.8,[[0,2.3],[.3,-6],[.6,-6],[1,0]]),"legL.rx":P(1.8,[[0,0],[.3,1.8],[.6,1.5],[1,0]]),"legR.rx":P(1.8,[[0,0],[.3,.2],[.6,-0.1],[1,0]]),"shinL.rx":P(1.8,[[0,0],[.3,-2],[.6,-1.5],[1,0]]),"shinR.rx":P(1.8,[[0,0],[.3,-1.6],[.6,-1.4],[1,0]]),"armL.rx":P(1.8,[[0,0],[.3,-0.6],[.6,.4],[1,0]])}},phone:{label:"\u0413\u043E\u0432\u043E\u0440\u0438\u0442\u044C \u043F\u043E \u0442\u0435\u043B\u0435\u0444\u043E\u043D\u0443",en:"Phone call",duration:2.4,loop:true,layer:"upper",tracks:D(N(2.4,{"armR.rx":2.1,"armR.rz":-0.08,"head.rz":-0.15}),E(2.4,"head.rx",0,.05,2),E(2.4,"armL.rz",-0.15,.15,2))},phoneScroll:{label:"\u041B\u0438\u0441\u0442\u0430\u0442\u044C \u0442\u0435\u043B\u0435\u0444\u043E\u043D",en:"Scroll phone",duration:1.6,loop:true,layer:"upper",tracks:D(N(1.6,{...Xn,"armL.rx":.5,"foreArmL.rx":1.4,"armL.rz":.3,"head.rx":-0.4}),E(1.6,"foreArmL.rz",.1,.06,2))},selfie:{label:"\u0421\u0435\u043B\u0444\u0438",en:"Selfie",duration:2,loop:true,emotion:"happy",layer:"upper",tracks:D(N(2,{"armR.rx":1.8,"armR.rz":.6,"foreArmR.rx":.2,"head.rz":-0.15,"armL.rz":-1.4,"foreArmL.rz":1.2}),E(2,"head.ry",.2,.05,1))},photo:{label:"\u0424\u043E\u0442\u043E\u0433\u0440\u0430\u0444\u0438\u0440\u043E\u0432\u0430\u0442\u044C",en:"Take a photo",duration:2,loop:true,layer:"upper",tracks:N(2,{"armL.rx":1.4,"armR.rx":1.4,"foreArmL.rx":1.2,"foreArmR.rx":1.2,"armL.rz":.35,"armR.rz":-0.35,"head.rx":.05})},drinkCup:{label:"\u041F\u0438\u0442\u044C \u0438\u0437 \u043A\u0440\u0443\u0436\u043A\u0438",en:"Drink from a cup",duration:2.4,loop:true,layer:"upper",tracks:{"armR.rx":P(2.4,[[0,.55],[.3,1.2],[.6,1.2],[1,.55]]),"foreArmR.rx":P(2.4,[[0,1.35],[.3,2.1],[.6,2.1],[1,1.35]]),"head.rx":P(2.4,[[0,0],[.3,.3],[.6,.3],[1,0]])}},eat:{label:"\u0415\u0441\u0442\u044C",en:"Eat",duration:1.2,loop:true,layer:"upper",tracks:D(N(1.2,{..._r,"armR.rx":.9}),E(1.2,"foreArmR.rx",1.5,.45,1),E(1.2,"head.rx",-0.1,.06,2))},read:{label:"\u0427\u0438\u0442\u0430\u0442\u044C",en:"Read",duration:3,loop:true,layer:"upper",tracks:D(N(3,{...Wn,"head.rx":-0.35}),E(3,"head.ry",0,.08,1))},board:{label:"\u041F\u0438\u0441\u0430\u0442\u044C \u043D\u0430 \u0434\u043E\u0441\u043A\u0435",en:"Write on a board",duration:2,loop:true,tracks:D(N(2,{"armR.rx":2,"foreArmR.rx":.4,"body.ry":.15,"head.rx":.2}),E(2,"armR.rz",0,.25,2),E(2,"foreArmR.rz",0,.2,4))},cook:{label:"\u0413\u043E\u0442\u043E\u0432\u0438\u0442\u044C",en:"Cook",duration:1.6,loop:true,layer:"upper",tracks:D(N(1.6,{..._r,"armR.rx":.9,"foreArmR.rx":.9,"head.rx":-0.3}),E(1.6,"armR.rz",0,.2,2),E(1.6,"armR.ry",0,.3,2,be/2))},dishes:{label:"\u041C\u044B\u0442\u044C \u043F\u043E\u0441\u0443\u0434\u0443",en:"Wash dishes",duration:1.6,loop:true,tracks:D(N(1.6,{"armL.rx":.9,"armR.rx":.9,"foreArmL.rx":.6,"foreArmR.rx":.6,"head.rx":-0.35,"body.rx":-0.1}),E(1.6,"armR.rz",0,.15,3),E(1.6,"armL.rz",0,.12,3,be))},sweep:{label:"\u041F\u043E\u0434\u043C\u0435\u0442\u0430\u0442\u044C",en:"Sweep",duration:1.6,loop:true,tracks:D(N(1.6,{"armL.rx":.6,"armR.rx":.4,"foreArmL.rx":.9,"foreArmR.rx":.5,"body.rx":-0.15,"head.rx":-0.2}),E(1.6,"body.ry",0,.3,2),E(1.6,"armL.rz",0,.25,2))},water:{label:"\u041F\u043E\u043B\u0438\u0432\u0430\u0442\u044C \u0446\u0432\u0435\u0442\u044B",en:"Water plants",duration:2.4,loop:true,tracks:D(N(2.4,{"armR.rx":.9,"foreArmR.rx":.5,"body.rx":-0.1,"head.rx":-0.3}),E(2.4,"armR.rz",-0.1,.25,1))},dig:{label:"\u041A\u043E\u043F\u0430\u0442\u044C",en:"Dig",duration:1.6,loop:true,emotion:"determined",tracks:{"body.rx":P(1.6,[[0,-0.1],[.4,-0.6],[.7,0],[1,-0.1]]),"armL.rx":P(1.6,[[0,.6],[.4,1.4],[.7,.5],[1,.6]]),"armR.rx":P(1.6,[[0,.4],[.4,.9],[.7,.2],[1,.4]]),"foreArmL.rx":kt(1.6,.8),"foreArmR.rx":kt(1.6,.6),"shinL.rx":P(1.6,[[0,0],[.4,-0.5],[.7,0],[1,0]]),"shinR.rx":P(1.6,[[0,0],[.4,-0.5],[.7,0],[1,0]]),"root.py":P(1.6,[[0,0],[.4,-1],[.7,0],[1,0]])}},fish:{label:"\u0420\u044B\u0431\u0430\u0447\u0438\u0442\u044C",en:"Fish",duration:3,loop:true,tracks:D(N(3,{"armL.rx":.9,"armR.rx":.9,"foreArmL.rx":.9,"foreArmR.rx":.7,"head.rx":.05}),E(3,"armR.rx",.9,.08,2))},paint:{label:"\u0420\u0438\u0441\u043E\u0432\u0430\u0442\u044C \u043D\u0430 \u043C\u043E\u043B\u044C\u0431\u0435\u0440\u0442\u0435",en:"Paint",duration:2,loop:true,layer:"upper",tracks:D(N(2,{"armR.rx":1.4,"foreArmR.rx":.6,..._r,"head.rz":.1}),E(2,"armR.rz",0,.2,2),E(2,"foreArmR.rx",.6,.25,3))},brushTeeth:{label:"\u0427\u0438\u0441\u0442\u0438\u0442\u044C \u0437\u0443\u0431\u044B",en:"Brush teeth",duration:1.2,loop:true,layer:"upper",tracks:D(N(1.2,{"armR.rx":1,"foreArmR.rx":2,"armR.rz":-0.2,"head.rx":.05}),E(1.2,"armR.ry",0,.2,6))},washFace:{label:"\u0423\u043C\u044B\u0432\u0430\u0442\u044C\u0441\u044F",en:"Wash face",duration:1.6,loop:true,tracks:D(N(1.6,{"armL.rx":1.4,"armR.rx":1.4,"foreArmL.rx":1.9,"foreArmR.rx":1.9,"body.rx":-0.45,"head.rx":-0.3}),E(1.6,"foreArmL.rx",1.9,.25,3),E(1.6,"foreArmR.rx",1.9,.25,3))},openDoor:{label:"\u041E\u0442\u043A\u0440\u044B\u0442\u044C \u0434\u0432\u0435\u0440\u044C",en:"Open a door",duration:1.6,layer:"upper",tracks:{"armR.rx":P(1.6,[[0,0],[.3,1.3],[.6,1.3],[.9,.6],[1,0]]),"foreArmR.rx":P(1.6,[[0,0],[.3,.4],[.6,.4],[1,0]]),"armR.ry":P(1.6,[[0,0],[.3,0],[.45,-0.5],[.9,-0.6],[1,0]]),"body.ry":P(1.6,[[0,0],[.6,-0.2],[1,0]])}},knock:{label:"\u041F\u043E\u0441\u0442\u0443\u0447\u0430\u0442\u044C",en:"Knock",duration:1.4,layer:"upper",tracks:D({"armR.rx":P(1.4,[[0,0],[.2,1.3],[.85,1.3],[1,0]])},E(1.4,"foreArmR.rx",1.4,.35,3,0,true),{"head.rz":P(1.4,[[0,0],[.3,.1],[1,0]])})},checkWatch:{label:"\u041F\u043E\u0441\u043C\u043E\u0442\u0440\u0435\u0442\u044C \u043D\u0430 \u0447\u0430\u0441\u044B",en:"Check the time",duration:1.6,layer:"upper",tracks:{"armL.rx":P(1.6,[[0,0],[.25,.9],[.8,.9],[1,0]]),"foreArmL.rx":P(1.6,[[0,0],[.25,1.4],[.8,1.4],[1,0]]),"armL.rz":P(1.6,[[0,0],[.25,.4],[.8,.4],[1,0]]),"head.rx":P(1.6,[[0,0],[.3,-0.4],[.8,-0.4],[1,0]]),"head.ry":P(1.6,[[0,0],[.3,-0.25],[.8,-0.25],[1,0]])}},wait:{label:"\u0416\u0434\u0430\u0442\u044C",en:"Wait",duration:1.2,loop:true,emotion:"tired",tracks:D(N(1.2,{"armL.rz":-0.8,"armR.rz":.8,"foreArmL.rz":1.5,"foreArmR.rz":-1.5}),{"legR.rx":P(1.2,[[0,.15],[.25,.15],[.5,.15],[1,.15]]),"shinR.rx":P(1.2,[[0,-0.2],[.2,-0.45],[.4,-0.2],[.6,-0.45],[.8,-0.2],[1,-0.2]])})},pockets:{label:"\u0420\u0443\u043A\u0438 \u0432 \u043A\u0430\u0440\u043C\u0430\u043D\u0430\u0445",en:"Hands in pockets",duration:2,loop:true,emotion:"cool",layer:"upper",tracks:N(2,{"armL.rx":-0.25,"armR.rx":-0.25,"armL.rz":-0.12,"armR.rz":.12,"foreArmL.rx":.5,"foreArmR.rx":.5,"head.rx":.05})},armsCrossed:{label:"\u0420\u0443\u043A\u0438 \u0441\u043A\u0440\u0435\u0449\u0435\u043D\u044B",en:"Arms crossed",duration:2,loop:true,layer:"upper",tracks:N(2,{"armL.rx":.6,"armR.rx":.6,"armL.rz":.35,"armR.rz":-0.35,"foreArmL.rx":1.6,"foreArmR.rx":1.6,"foreArmL.ry":-0.7,"foreArmR.ry":.7,"head.rx":.08})},lean:{label:"\u041E\u0431\u043B\u043E\u043A\u043E\u0442\u0438\u0442\u044C\u0441\u044F \u043D\u0430 \u0441\u0442\u0435\u043D\u0443",en:"Lean on a wall",duration:2,loop:true,emotion:"cool",tracks:N(2,{"root.rz":-0.12,"root.px":-1,"legL.rx":.15,"legL.ry":.2,"shinL.rx":-0.4,"armR.rz":1.5,"foreArmR.rz":-1.4,"armL.rx":-0.2,"foreArmL.rx":.4,"head.rz":.06})},shiver:{label:"\u0414\u0440\u043E\u0436\u0430\u0442\u044C \u043E\u0442 \u0445\u043E\u043B\u043E\u0434\u0430",en:"Shiver",duration:1.2,loop:true,emotion:"scared",layer:"upper",tracks:D(N(1.2,{"armL.rx":.8,"armR.rx":.8,"armL.rz":.5,"armR.rz":-0.5,"foreArmL.rx":1.4,"foreArmR.rx":1.4,"head.rx":-0.15}),E(1.2,"body.rz",0,.03,10),E(1.2,"head.rz",0,.04,9))},fan:{label:"\u041E\u0431\u043C\u0430\u0445\u0438\u0432\u0430\u0442\u044C\u0441\u044F",en:"Fan yourself",duration:1.2,loop:true,emotion:"tired",layer:"upper",tracks:D(N(1.2,{"armR.rx":.9,"foreArmR.rx":1.7,"head.rx":.15}),E(1.2,"foreArmR.rz",0,.4,4))},sneeze:{label:"\u0427\u0438\u0445\u043D\u0443\u0442\u044C",en:"Sneeze",duration:1.4,tracks:{"head.rx":P(1.4,[[0,0],[.45,.4],[.55,-0.4],[.8,-0.2],[1,0]]),"body.rx":P(1.4,[[0,0],[.45,.1],[.55,-0.35],[.8,-0.1],[1,0]]),"armR.rx":P(1.4,[[0,0],[.4,1.3],[.8,1.3],[1,0]]),"foreArmR.rx":P(1.4,[[0,0],[.4,1.9],[.8,1.9],[1,0]])}},cough:{label:"\u041A\u0430\u0448\u043B\u044F\u0442\u044C",en:"Cough",duration:1.4,layer:"upper",tracks:D({"armR.rx":P(1.4,[[0,0],[.2,1.2],[.85,1.2],[1,0]]),"foreArmR.rx":P(1.4,[[0,0],[.2,2],[.85,2],[1,0]])},E(1.4,"body.rx",-0.1,.1,3,0,true),E(1.4,"head.rx",-0.1,.12,3,0,true))},hug:{label:"\u041E\u0431\u043D\u044F\u0442\u044C",en:"Hug",duration:2,loop:true,emotion:"love",layer:"upper",tracks:N(2,{"armL.rx":1.3,"armR.rx":1.3,"armL.rz":-0.4,"armR.rz":.4,"foreArmL.rz":1,"foreArmR.rz":-1,"foreArmL.rx":.4,"foreArmR.rx":.4,"head.rz":.1})},handshake:{label:"\u0420\u0443\u043A\u043E\u043F\u043E\u0436\u0430\u0442\u0438\u0435",en:"Handshake",duration:1.6,loop:true,emotion:"happy",layer:"upper",tracks:D(N(1.6,{"armR.rx":.9,"foreArmR.rx":.5}),E(1.6,"foreArmR.rx",.5,.15,3))},highFive:{label:"\u0414\u0430\u0442\u044C \u043F\u044F\u0442\u044C",en:"High five",duration:1.2,emotion:"excited",layer:"upper",tracks:{"armR.rz":P(1.2,[[0,0],[.3,.35],[1,0]]),"armR.rx":P(1.2,[[0,0],[.3,2.8],[.45,2.5],[.8,2.5],[1,0]]),"body.ry":P(1.2,[[0,0],[.4,-0.15],[1,0]])}},throw:{label:"\u0411\u0440\u043E\u0441\u0438\u0442\u044C",en:"Throw",duration:1.2,layer:"upper",tracks:{"armR.rx":P(1.2,[[0,0],[.35,-0.6],[.5,2.2],[.7,1.2],[1,0]]),"armR.rz":P(1.2,[[0,0],[.35,.8],[.5,.2],[1,0]]),"body.ry":P(1.2,[[0,0],[.35,.35],[.55,-0.3],[1,0]]),"armL.rx":P(1.2,[[0,0],[.35,1],[.55,.2],[1,0]])}},catch:{label:"\u041F\u043E\u0439\u043C\u0430\u0442\u044C",en:"Catch",duration:1.2,emotion:"surprised",layer:"upper",tracks:{"armL.rx":P(1.2,[[0,0],[.3,1.6],[.5,1.4],[.8,.9],[1,0]]),"armR.rx":P(1.2,[[0,0],[.3,1.6],[.5,1.4],[.8,.9],[1,0]]),"foreArmL.rx":P(1.2,[[0,0],[.5,.4],[.8,1.2],[1,0]]),"foreArmR.rx":P(1.2,[[0,0],[.5,.4],[.8,1.2],[1,0]]),"body.rx":P(1.2,[[0,0],[.5,.08],[1,0]])}},juggle:{label:"\u041F\u043E\u0434\u043A\u0438\u0434\u044B\u0432\u0430\u0442\u044C \u043C\u044F\u0447",en:"Juggle",duration:1.2,loop:true,layer:"upper",tracks:D(N(1.2,{"armL.rx":.7,"armR.rx":.7,"head.rx":.35}),E(1.2,"foreArmL.rx",1.2,.35,2),E(1.2,"foreArmR.rx",1.2,.35,2,be))}};var Gt=Math.PI,la={clap:{label:"\u0425\u043B\u043E\u043F\u0430\u0442\u044C",en:"Clap",duration:1.8,emotion:"happy",layer:"upper",tracks:D(ie(1.8,{"armL.rx":1.2,"armR.rx":1.2,"armL.rz":.25,"armR.rz":-0.25},.2),E(1.8,"foreArmL.rz",.55,.35,5,0,true),E(1.8,"foreArmR.rz",-0.55,-0.35,5,0,true),ie(1.8,{"foreArmL.rx":.6,"foreArmR.rx":.6},.2))},salute:{label:"\u041E\u0442\u0434\u0430\u0442\u044C \u0447\u0435\u0441\u0442\u044C",en:"Salute",duration:1.6,layer:"upper",tracks:ie(1.6,{"armR.rx":2.6,"armR.rz":-0.12,"head.rx":.08},.25)},thumbsUp:{label:"\u041A\u043B\u0430\u0441\u0441",en:"Thumbs up",duration:1.4,emotion:"happy",layer:"upper",tracks:ie(1.4,{"armR.rx":1,"armR.rz":.3,"foreArmR.rx":1.2,"head.rz":-0.1},.2)},heartHands:{label:"\u0421\u0435\u0440\u0434\u0446\u0435 \u0440\u0443\u043A\u0430\u043C\u0438",en:"Heart hands",duration:2,emotion:"love",layer:"upper",tracks:ie(2,{"armL.rz":-2.3,"armR.rz":2.3,"armL.rx":.4,"armR.rx":.4,"foreArmL.rz":1.3,"foreArmR.rz":-1.3,"head.rz":.12})},think:{label:"\u0414\u0443\u043C\u0430\u0442\u044C",en:"Think",duration:2.4,emotion:"confused",layer:"upper",tracks:D(ie(2.4,{"armR.rx":.9,"armR.rz":-0.2,"foreArmR.rx":2.1,"armL.rx":.5,"foreArmL.rx":1.4,"armL.rz":.3}),E(2.4,"head.rz",.12,.05,2,0,true),ie(2.4,{"head.rx":.15}))},nod:{label:"\u0414\u0430",en:"Yes",duration:1.2,layer:"upper",tracks:E(1.2,"head.rx",-0.1,.22,3,0,true)},headShake:{label:"\u041D\u0435\u0442",en:"No",duration:1.2,layer:"upper",tracks:E(1.2,"head.ry",0,.4,3,0,true)},beckon:{label:"\u0418\u0434\u0438 \u0441\u044E\u0434\u0430",en:"Come here",duration:1.8,layer:"upper",tracks:D(ie(1.8,{"armR.rx":1.3,"armR.rz":.2}),E(1.8,"foreArmR.rx",1,.6,3,0,true),ie(1.8,{"head.rz":.1}))},stop:{label:"\u0421\u0442\u043E\u043F",en:"Stop",duration:1.4,emotion:"determined",layer:"upper",tracks:ie(1.4,{"armR.rx":1.55,"foreArmR.rx":1.2,"body.rx":.06},.15)},yawn:{label:"\u0417\u0435\u0432\u043D\u0443\u0442\u044C",en:"Yawn",duration:2.4,emotion:"sleepy",layer:"upper",tracks:ie(2.4,{"armR.rx":1.4,"foreArmR.rx":1.9,"armR.rz":-0.25,"armL.rz":-0.35,"armL.rx":-0.15,"head.rx":.35,"body.rx":.08},.5)},stretch:{label:"\u041F\u043E\u0442\u044F\u043D\u0443\u0442\u044C\u0441\u044F",en:"Stretch",duration:2.6,emotion:"sleepy",tracks:D(ie(2.6,{"armL.rz":-2.9,"armR.rz":2.9,"head.rx":.3,"body.rx":.12},.6),{"root.py":P(2.6,[[0,0],[.3,.8],[.7,.8],[1,0]])})},flex:{label:"\u0421\u0438\u043B\u0430",en:"Flex",duration:1.8,emotion:"determined",layer:"upper",tracks:D(ie(1.8,{"armL.rz":-1.5,"armR.rz":1.5,"foreArmL.rz":-1.6,"foreArmR.rz":1.6,"body.rx":.08},.25),E(1.8,"body.ry",0,.15,2,0,true))},jumpJoy:{label:"\u041F\u0440\u044B\u0436\u043E\u043A \u0440\u0430\u0434\u043E\u0441\u0442\u0438",en:"Jump for joy",duration:1.4,emotion:"excited",tracks:{"root.py":P(1.4,[[0,0],[.15,-1.5],[.4,6],[.6,6],[.8,0],[.9,-1],[1,0]]),"armL.rz":P(1.4,[[0,0],[.4,-2.8],[.7,-2.8],[1,0]]),"armR.rz":P(1.4,[[0,0],[.4,2.8],[.7,2.8],[1,0]]),"shinL.rx":P(1.4,[[0,0],[.15,-0.6],[.45,-1.4],[.7,-1.2],[.85,-0.4],[1,0]]),"shinR.rx":P(1.4,[[0,0],[.15,-0.6],[.45,-1.4],[.7,-1.2],[.85,-0.4],[1,0]])}},spin:{label:"\u041A\u0440\u0443\u0436\u0438\u0442\u044C\u0441\u044F",en:"Spin",duration:1.6,emotion:"happy",tracks:{"root.ry":P(1.6,[[0,0],[1,Gt*2]]),"armL.rz":P(1.6,[[0,0],[.2,-1.5],[.8,-1.5],[1,0]]),"armR.rz":P(1.6,[[0,0],[.2,1.5],[.8,1.5],[1,0]])}},victory:{label:"\u041F\u043E\u0431\u0435\u0434\u0430",en:"Victory",duration:2,emotion:"excited",tracks:D(ie(2,{"armR.rz":2.9,"armL.rz":-0.4,"foreArmL.rx":1.3,"armL.rx":.3,"head.rx":.2,"body.rx":.08}),{"root.py":P(2,[[0,0],[.2,3],[.35,0],[1,0]])})},airGuitar:{label:"\u0413\u0438\u0442\u0430\u0440\u0430",en:"Air guitar",duration:2.4,loop:true,emotion:"excited",tracks:D(N(2.4,{"armL.rx":1.2,"armL.rz":-0.5,"foreArmL.rz":.7,"armR.rx":.5,"foreArmR.rx":1.2,"legL.rx":.3,"shinL.rx":-0.4}),E(2.4,"foreArmR.rz",-0.2,.35,8),E(2.4,"head.rx",-0.1,.18,4),E(2.4,"body.rx",-0.05,.06,4))},drum:{label:"\u0411\u0430\u0440\u0430\u0431\u0430\u043D",en:"Drum",duration:1.6,loop:true,emotion:"excited",tracks:D(N(1.6,{"armL.rx":.7,"armR.rx":.7}),E(1.6,"foreArmL.rx",1,.5,4),E(1.6,"foreArmR.rx",1,.5,4,Gt),E(1.6,"head.rx",0,.12,4))},pushups:{label:"\u041E\u0442\u0436\u0438\u043C\u0430\u043D\u0438\u044F",en:"Push-ups",duration:2,loop:true,emotion:"determined",tracks:D(N(2,{"root.rx":-1.35,"armL.rx":1.45,"armR.rx":1.45,"head.rx":1.1}),E(2,"root.py",3.4,1.2,2),E(2,"foreArmL.rx",-0.5,.5,2),E(2,"foreArmR.rx",-0.5,.5,2))},kneel:{label:"\u041D\u0430 \u043A\u043E\u043B\u0435\u043D\u043E",en:"Kneel",duration:2.4,tracks:ie(2.4,{"legR.rx":-0.15,"shinR.rx":-1.4,"legL.rx":1.5,"shinL.rx":-1.5,"root.py":-6,"armR.rx":.9,"foreArmR.rx":1.4,"head.rx":-0.15},.5)},curtsy:{label:"\u0420\u0435\u0432\u0435\u0440\u0430\u043D\u0441",en:"Curtsy",duration:1.6,tracks:ie(1.6,{"legR.rx":-0.4,"shinL.rx":-0.6,"shinR.rx":-0.6,"root.py":-1.4,"armL.rz":-0.5,"armR.rz":.5,"body.rx":-0.15,"head.rx":-0.2},.4)},scratchHead:{label:"\u041F\u043E\u0447\u0435\u0441\u0430\u0442\u044C \u0437\u0430\u0442\u044B\u043B\u043E\u043A",en:"Scratch head",duration:1.8,emotion:"confused",layer:"upper",tracks:D(ie(1.8,{"armR.rx":3.05,"armR.rz":-0.35,"head.rz":.15,"head.rx":.2}),E(1.8,"foreArmR.rx",.35,.25,5,0,true))},hide:{label:"\u0421\u043F\u0440\u044F\u0442\u0430\u0442\u044C\u0441\u044F",en:"Hide",duration:2,emotion:"scared",tracks:ie(2,{"armL.rx":2.4,"armR.rx":2.4,"foreArmL.rx":1.4,"foreArmR.rx":1.4,"body.rx":-0.35,"head.rx":-0.4,"shinL.rx":-0.5,"shinR.rx":-0.5,"root.py":-1.5},.2)},stomp:{label:"\u0422\u043E\u043F\u043D\u0443\u0442\u044C",en:"Stomp",duration:1.2,emotion:"angry",tracks:D(ie(1.2,{"armL.rz":-0.35,"armR.rz":.35,"body.rx":-0.1},.15),{"legR.rx":P(1.2,[[0,0],[.3,.8],[.45,0],[.65,.8],[.8,0],[1,0]]),"shinR.rx":P(1.2,[[0,0],[.3,-1],[.45,0],[.65,-1],[.8,0],[1,0]])})},slump:{label:"\u041F\u043E\u043D\u0438\u043A",en:"Slump",duration:2.4,emotion:"sad",tracks:ie(2.4,{"body.rx":-0.35,"head.rx":-0.45,"armL.rz":.05,"armR.rz":-0.05,"shinL.rx":-0.15,"shinR.rx":-0.15},.6)},rollLaugh:{label:"\u0412\u0430\u043B\u044F\u0442\u044C\u0441\u044F \u043E\u0442 \u0441\u043C\u0435\u0445\u0430",en:"Rolling with laughter",duration:2.4,loop:true,emotion:"happy",tracks:D(N(2.4,{...Ir,"armL.rx":1.2,"armR.rx":1.2,"foreArmL.rx":1.2,"foreArmR.rx":1.2}),E(2.4,"root.rz",0,.35,2),E(2.4,"legL.rx",1,.5,4),E(2.4,"legR.rx",1,.5,4,Gt),E(2.4,"head.rx",.2,.15,6))},blowKiss:{label:"\u0412\u043E\u0437\u0434\u0443\u0448\u043D\u044B\u0439 \u043F\u043E\u0446\u0435\u043B\u0443\u0439",en:"Blow a kiss",duration:1.6,emotion:"love",layer:"upper",tracks:{"armR.rx":P(1.6,[[0,0],[.3,1.2],[.55,1.2],[.75,1.6],[1,0]]),"foreArmR.rx":P(1.6,[[0,0],[.3,2],[.55,2],[.75,.3],[1,0]]),"armR.rz":P(1.6,[[0,0],[.3,-0.2],[.75,.4],[1,0]]),"head.rz":P(1.6,[[0,0],[.3,.12],[.9,.12],[1,0]])}},phew:{label:"\u0424\u0443\u0445",en:"Phew",duration:1.6,emotion:"tired",layer:"upper",tracks:{"armR.rz":P(1.6,[[0,0],[.3,1.7],[.7,2.1],[1,0]]),"foreArmR.rz":P(1.6,[[0,0],[.3,-1.4],[.7,-1.6],[1,0]]),"head.rx":P(1.6,[[0,0],[.3,.2],[.7,-0.2],[1,0]]),"body.rx":P(1.6,[[0,0],[.6,-0.08],[1,0]])}},lookAround:{label:"\u041E\u0441\u043C\u043E\u0442\u0440\u0435\u0442\u044C\u0441\u044F",en:"Look around",duration:2.6,layer:"upper",tracks:{"head.ry":P(2.6,[[0,0],[.2,.9],[.45,.9],[.65,-0.9],[.85,-0.9],[1,0]]),"body.ry":P(2.6,[[0,0],[.2,.25],[.45,.25],[.65,-0.25],[.85,-0.25],[1,0]]),"armR.rx":P(2.6,[[0,0],[.2,2.6],[.85,2.6],[1,0]]),"foreArmR.rx":P(2.6,[[0,0],[.2,.9],[.85,.9],[1,0]])}},karate:{label:"\u041A\u0430\u0440\u0430\u0442\u044D",en:"Karate",duration:1.8,emotion:"determined",tracks:{"armR.rx":P(1.8,[[0,.6],[.2,.6],[.3,1.57],[.45,.6],[1,0]]),"foreArmR.rx":P(1.8,[[0,1.6],[.2,1.6],[.3,0],[.45,1.6],[1,0]]),"armL.rx":P(1.8,[[0,.6],[.45,.6],[.55,1.57],[.7,.6],[1,0]]),"foreArmL.rx":P(1.8,[[0,1.6],[.45,1.6],[.55,0],[.7,1.6],[1,0]]),"legR.rx":P(1.8,[[0,0],[.7,0],[.8,1.4],[.9,0],[1,0]]),"body.ry":P(1.8,[[0,0],[.3,-0.3],[.55,.3],[.8,0],[1,0]]),"root.py":P(1.8,[[0,-1],[.9,-1],[1,0]])}},nap:{label:"\u0423\u0441\u043D\u0443\u0442\u044C",en:"Nap",duration:3,loop:true,emotion:"sleepy",tracks:D(N(3,{...Ir,"armL.rz":-0.3,"armR.rz":2.4,"foreArmR.rz":-1.4,"legL.rx":.15}),E(3,"body.sy",1,.03,1))},danceRobot:{label:"\u0422\u0430\u043D\u0435\u0446 \xAB\u0420\u043E\u0431\u043E\u0442\xBB",en:"Robot dance",duration:2,loop:true,emotion:"cool",tracks:{"armL.rx":P(2,[[0,1.57],[.25,1.57],[.26,0],[.5,0],[.51,1.57],[.75,1.57],[.76,0],[1,1.57]]),"foreArmL.rx":P(2,[[0,0],[.25,0],[.26,1.57],[.5,1.57],[.51,0],[1,0]]),"armR.rx":P(2,[[0,0],[.25,0],[.26,1.57],[.5,1.57],[.51,0],[.75,0],[.76,1.57],[1,0]]),"foreArmR.rx":P(2,[[0,1.57],[.25,1.57],[.26,0],[.75,0],[.76,1.57],[1,1.57]]),"head.ry":P(2,[[0,.4],[.25,.4],[.26,-0.4],[.75,-0.4],[.76,.4],[1,.4]]),"root.py":P(2,[[0,0],[.25,-0.8],[.5,0],[.75,-0.8],[1,0]])}},danceHop:{label:"\u0422\u0430\u043D\u0435\u0446 \xAB\u041F\u0440\u044B\u0433-\u0441\u043A\u043E\u043A\xBB",en:"Hop dance",duration:1.6,loop:true,emotion:"excited",tracks:D(E(1.6,"root.py",1.2,1.2,4),E(1.6,"legL.rx",.25,.35,2),E(1.6,"legR.rx",.25,.35,2,Gt),E(1.6,"shinL.rx",-0.5,.3,2),E(1.6,"shinR.rx",-0.5,.3,2,Gt),E(1.6,"armL.rz",-1.6,.9,2),E(1.6,"armR.rz",1.6,.9,2))},danceSway:{label:"\u0422\u0430\u043D\u0435\u0446 \xAB\u041F\u043E\u043A\u0430\u0447\u0438\u0432\u0430\u043D\u0438\u0435\xBB",en:"Sway dance",duration:2.4,loop:true,emotion:"happy",tracks:D(E(2.4,"body.rz",0,.12,2),E(2.4,"head.rz",0,.16,2,Gt),E(2.4,"root.px",0,1.2,2),E(2.4,"armL.rz",-0.6,.4,2),E(2.4,"armR.rz",.6,.4,2),N(2.4,{"foreArmL.rx":1.1,"foreArmR.rx":1.1}),E(2.4,"shinL.rx",-0.2,.2,2),E(2.4,"shinR.rx",-0.2,.2,2,Gt))},danceDisco:{label:"\u0422\u0430\u043D\u0435\u0446 \xAB\u0414\u0438\u0441\u043A\u043E\xBB",en:"Disco dance",duration:2,loop:true,emotion:"cool",tracks:{"armR.rz":P(2,[[0,2.6],[.25,.2],[.5,2.6],[.75,.2],[1,2.6]]),"armR.rx":P(2,[[0,.6],[.25,.9],[.5,.6],[.75,.9],[1,.6]]),"armL.rz":kt(2,-0.3),"armL.rx":kt(2,.4),"foreArmL.rx":kt(2,1.3),"body.ry":P(2,[[0,.3],[.25,-0.2],[.5,.3],[.75,-0.2],[1,.3]]),"root.py":P(2,[[0,0],[.125,-0.8],[.25,0],[.375,-0.8],[.5,0],[.625,-0.8],[.75,0],[.875,-0.8],[1,0]]),"legL.rz":P(2,[[0,0],[.25,-0.2],[.5,0],[.75,-0.2],[1,0]])}},danceWave:{label:"\u0422\u0430\u043D\u0435\u0446 \xAB\u0412\u043E\u043B\u043D\u0430\xBB",en:"Wave dance",duration:2,loop:true,emotion:"happy",tracks:D(E(2,"armL.rz",-1.57,.35,2,0),E(2,"foreArmL.rz",0,.6,2,.8),E(2,"armR.rz",1.57,-0.35,2,1.6),E(2,"foreArmR.rz",0,-0.6,2,2.4),E(2,"body.rz",0,.08,2,1.2),E(2,"head.rz",0,.12,2,2),E(2,"root.py",-0.4,.4,4))}};var go=Math.PI,Jn={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,go*.46],[1,go*.46]],"legR.rx":[[0,go*.46],[1,go*.46]],"root.py":[[0,-10],[1,-10]]}}},$e={...Jn,...la,...ia},Tp=[...Object.keys(Jn),...Object.keys(la)],Mp=Object.keys(ia),Lp=Object.keys($e);function ca(e){return typeof e=="string"&&Object.prototype.hasOwnProperty.call($e,e)}function Cp(e){return ca(e)&&$e[e].seat===true}function Pp(e,t){let r=$e[e];return t?r.label:r.en??e}function hl(e,t){let r=e[0];if(t<=r[0])return r[1];for(let o=1;o<e.length;o++){let a=e[o];if(t<=a[0]){let n=e[o-1],s=(t-n[0])/Math.max(1e-6,a[0]-n[0]),l=s*s*(3-2*s);return n[1]+(a[1]-n[1])*l}}return e[e.length-1][1]}function Qn(e,t,r){let o=t.loop?r%t.duration:Math.min(r,t.duration);for(let[a,n]of Object.entries(t.tracks)){let s=a.lastIndexOf("."),l=a.slice(0,s),i=a.slice(s+1);i in I&&y(e,l,i,hl(n,o));}}var lr={neutral:["neutral"],happy:["happy","neutral"],sad:["sad","tired","neutral"],angry:["angry","neutral"],surprised:["surprised","scared","neutral"],scared:["scared","surprised","sad","neutral"],tired:["tired","sad","neutral"],hurt:["hurt","angry","sad","neutral"],love:["happy","neutral"],excited:["happy","surprised","neutral"],smug:["happy","neutral"],confused:["surprised","neutral"],embarrassed:["happy","sad","neutral"],silly:["happy","neutral"],cool:["neutral"],disgusted:["angry","sad","neutral"],determined:["angry","neutral"],crying:["sad","tired","neutral"],dizzy:["hurt","tired","neutral"],sleepy:["tired","blink","neutral"],wink:["happy","neutral"]},pa={neutral:{add:{},tempo:1},happy:{add:{"head.rx":.08},tempo:1.1},sad:{add:{"head.rx":-0.3,"body.rx":-0.08,"tail.rx":.5},tempo:.8},angry:{add:{"body.rx":-0.12,"head.rx":.1,"armL.rz":-0.1,"armR.rz":.1},tempo:1.1},surprised:{add:{"head.rx":.15,"body.rx":.05},tempo:1},scared:{add:{"body.rx":-0.1,"head.rx":-0.1,"armL.rx":.3,"armR.rx":.3,"tail.rx":.6},tempo:1.3},tired:{add:{"head.rx":-0.35,"body.rx":-0.12},tempo:.7},hurt:{add:{"body.rx":-0.1},tempo:1},love:{add:{"head.rz":.12,"head.rx":.06},tempo:.9},excited:{add:{"head.rx":.12,"body.rx":.04},tempo:1.3},smug:{add:{"head.rx":.14,"head.rz":-0.08},tempo:.9},confused:{add:{"head.rz":.22},tempo:.9},embarrassed:{add:{"head.rx":-0.2,"head.ry":.25,"armL.rx":.15,"armR.rx":.15},tempo:.9},silly:{add:{"head.rz":-0.18},tempo:1.2},cool:{add:{"head.rx":.06,"body.rx":.04},tempo:.85},disgusted:{add:{"head.rx":.1,"head.ry":-0.3,"body.rx":.06},tempo:1},determined:{add:{"body.rx":-0.06,"armL.rz":-0.08,"armR.rz":.08},tempo:1.15},crying:{add:{"head.rx":-0.35,"body.rx":-0.1,"tail.rx":.5},tempo:.75},dizzy:{add:{"head.rz":.15,"body.rz":-0.05},tempo:.8},sleepy:{add:{"head.rx":-0.4,"head.rz":.1,"body.rx":-0.1},tempo:.6},wink:{add:{"head.rz":.1},tempo:1.05}};function Zn(e,t,r){if(!(r<=0))for(let[o,a]of Object.entries(pa[t].add)){let n=o.lastIndexOf(".");de(e,o.slice(0,n),o.slice(n+1),(a??0)*r);}}var Vp={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 Fp(e){let t=[[/(😍|🥰|😘|❤|💕)/u,"love"],[/(🤩|🥳)/u,"excited"],[/(😏)/u,"smug"],[/(😕|🤔|😵‍💫)/u,"confused"],[/(😳|☺)/u,"embarrassed"],[/(😜|😝|😛|:P|:p)/u,"silly"],[/(😎)/u,"cool"],[/(🤢|🤮)/u,"disgusted"],[/(😤|💪)/u,"determined"],[/(😭)/u,"crying"],[/(😵)/u,"dizzy"],[/(😴|💤)/u,"sleepy"],[/(😉|;\))/u,"wink"],[/(>:\(|😠|😡|🤬)/u,"angry"],[/(:'\(|😢)/u,"sad"],[/(:\(|☹|🙁|😞)/u,"sad"],[/(:o|:O|😮|😲)/u,"surprised"],[/(😱|😨)/u,"scared"],[/(-_-|😩|🥱)/u,"tired"],[/(:\)|:D|\^\^|😀|😃|😄|😁|🙂|😊|😂)/u,"happy"]];for(let[r,o]of t)if(r.test(e))return o;return null}var dl=[{state:"dead",when:e=>e.dead,clip:"dead",blend:.25},{state:"sleep",when:e=>e.sleeping,clip:"sleep",blend:.3},{state:"ride",when:e=>e.riding,clip:"ride",blend:.2},{state:"sit",when:e=>e.sitting,clip:"sit",blend:.3},{state:"swim",when:e=>e.inWater&&!e.onGround&&!e.flying,clip:"swim",blend:.3},{state:"glide",when:e=>e.gliding,clip:"glide",blend:.25},{state:"fly",when:e=>e.flying,clip:"fly",blend:.25},{state:"fall",when:(e,t)=>t.airTime>.35&&e.vy<-4,clip:"fall",blend:.2},{state:"sneak",when:e=>e.sneaking,clip:"sneak",blend:.15},{state:"run",when:e=>e.sprinting&&e.speed>3||e.speed>6.5,clip:"run",blend:.15},{state:"walk",when:e=>e.speed>.4,clip:"walk",blend:.15},{state:"idle",when:()=>true,clip:"idle",blend:.2}],ul=new Set(["idle","walk","run","sneak","sit"]),fl=new Set(["hurt","land","shoot"]),bl={eat:"eat",drink:"drink",draw:"draw",block:"block"},yl={tail:(e,t)=>[["ry",-e.yawRate*.25+.12*Math.sin(t*2)],["rx",-(.1+Math.min(e.speed,8)*.06)]],cape:(e,t)=>[["rx",-(.05+Math.min(e.speed,8)*.12)-(e.speed>1?.06*Math.sin(t*9):0)-(e.vy<-3?.4:0)]],hair:e=>[["rx",-Math.min(e.speed,8)*.03]],ear:(e,t)=>[["rz",.08*Math.sin(t*1.3)+Math.min(e.speed,6)*.02]],antenna:(e,t)=>[["rx",.1*Math.sin(t*3)-e.vy*.02]],wingL:(e,t)=>e.flying||e.gliding||!e.onGround&&!e.inWater?[["rz",e.gliding?-0.05:-0.7*Math.sin(t*12)]]:[["rz",1.1+.05*Math.sin(t*1.5)]],wingR:(e,t)=>e.flying||e.gliding||!e.onGround&&!e.inWater?[["rz",e.gliding?.05:.7*Math.sin(t*12)]]:[["rz",-1.1-.05*Math.sin(t*1.5)]]},xo=e=>{let t=Math.max(0,Math.min(1,e));return t*t*(3-2*t)},wo=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;upperPose=new Map;upperDef=null;actions=[];useClip=null;useW=0;emote=null;mood="neutral";moodOverGestures=false;flash=null;postureW=new Map;blinkT=3;blinking=0;talkT=0;springs=new Map;constructor(t,r,o=[]){this.rig=t,this.style=oa(r),this.faces=new Set(o);}setRandom(t){this.random=t;}random=Math.random;setStyle(t){this.style=oa(t);}setEmotion(t,r){r&&r>0?this.flash={emotion:t,left:r}:this.mood=t;}get emotion(){return this.emote?.def.emotion&&!this.moodOverGestures?this.emote.def.emotion:this.flash?.emotion??this.mood}get emoting(){return this.emote?.id??null}get plant(){return ul.has(this.state)&&this.airTime<.12?1:0}get standing(){return this.state==="idle"&&!this.emote&&this.stateT>.2}playEmote(t){this.emote={id:t,def:$e[t],t:0};}stopEmote(){this.emote=null;}trigger(t){switch(t){case "swing":case "place":case "throw":case "shoot":case "punch":case "hurt":case "land":{let r=t;this.actions=this.actions.filter(o=>o.clip!==r),this.actions.push({clip:r,t:0,dur:Un[r]??.3}),t==="hurt"&&this.setEmotion("hurt",.8);break}}}update(t,r=no()){t=Math.min(t,.1),this.clock+=t;let o=this.emotion,a=pa[o].tempo*this.style.tempo;!r.onGround&&!r.inWater?this.airTime+=t:(!this.wasOnGround&&this.airTime>.3&&r.onGround&&this.trigger("land"),this.airTime=0),this.wasOnGround=r.onGround,this.phase+=r.speed*t*3.5*a;let n=dl.find(c=>c.when(r,this));n.state!==this.state&&(De(this.from,this.lastLoco),this.state=n.state,this.stateT=0,this.blendT=0,this.blendDur=n.blend),this.stateT+=t,ft(this.loco);let s=qn[this.rig]?.[n.clip]??n.clip,l={t:this.stateT,k:0,phase:this.phase,input:r,style:this.style,clock:this.clock*a};if(zr[s](this.loco,l),ft(this.pose),this.blendT<this.blendDur?(this.blendT+=t,mn(this.pose,this.from,this.loco,xo(this.blendT/this.blendDur))):De(this.pose,this.loco),De(this.lastLoco,this.pose),this.emote){let c=this.emote;c.t+=t;let p=c.def.layer==="upper";if((p?!(this.state==="idle"||this.state==="walk"||this.state==="run"||this.state==="sneak"):r.speed>1||this.state!=="idle")||!c.def.loop&&c.t>=c.def.duration)this.emote=null;else {let d=c.def.loop?xo(c.t/.15):xo(Math.min(c.t/.15,(c.def.duration-c.t)/.15)),b=p?this.upperPose:this.tmp;p&&this.upperDef!==c.def&&(b.clear(),this.upperDef=c.def),ft(b),Qn(b,c.def,c.t),this.overlay(b,d,false);}}let i=r.use?bl[r.use]:null;i&&(this.useClip=i),this.useW=Math.max(0,Math.min(1,this.useW+(i?t:-t)*8)),this.useClip&&this.useW>0?(ft(this.tmp),zr[this.useClip](this.tmp,{...l,t:this.clock}),this.overlay(this.tmp,xo(this.useW),false)):r.aiming&&(r.held==="pistol"||r.held==="rifle")?(ft(this.tmp),zr[r.held==="rifle"?"aimRifle":"aimPistol"](this.tmp,l),this.overlay(this.tmp,1,false),de(this.pose,"armR","rx",Math.max(-0.8,Math.min(.8,r.lookPitch))),de(this.pose,"armL","rx",Math.max(-0.8,Math.min(.8,r.lookPitch)))):r.held!=="none"&&!this.emote&&de(this.pose,"armR","rx",r.held==="staff"?.35:.2);for(let c of this.actions){c.t+=t;let p=Math.min(1,c.t/c.dur);ft(this.tmp),zr[c.clip](this.tmp,{...l,t:c.t,k:p}),this.overlay(this.tmp,1,fl.has(c.clip));}this.actions=this.actions.filter(c=>c.t<c.dur),this.state!=="dead"&&this.state!=="sleep"&&(de(this.pose,"head","ry",Math.max(-1.1,Math.min(1.1,r.lookYaw))),de(this.pose,"head","rx",Math.max(-1.2,Math.min(1.2,r.lookPitch)))),this.flash&&(this.flash.left-=t)<=0&&(this.flash=null);for(let c of b$1){let p=this.postureW.get(c)??0,h=p+((c===o?1:0)-p)*Math.min(1,t*6);this.postureW.set(c,h),this.state!=="dead"&&Zn(this.pose,c,h);}for(let[c,p]of Object.entries(yl))for(let[h,m]of p(r,this.clock)){let d=c+"."+h,b=this.springs.get(d);b||this.springs.set(d,b={x:m,v:0});let u=60,R=9;b.v+=(u*(m-b.x)-R*b.v)*t,b.x+=b.v*t,de(this.pose,c,h,b.x);}return this.expression=this.face(r,t,o),this.pose}overlay(t,r,o){for(let[a,n]of t){let s=oe(this.pose,a);for(let l=0;l<9;l++)o?l>=I.sx?s[l]=s[l]*(1+(n[l]-1)*r):s[l]=s[l]+(n[l]-nr[l])*r:s[l]=s[l]+(n[l]-s[l])*r;}}face(t,r,o){let a=s=>s.find(l=>this.faces.has(l))??"neutral";if(t.dead||this.state==="dead"||t.sleeping)return a(["blink","hurt","neutral"]);let n=a(lr[o]);return t.viseme!==void 0?(this.talkT=0,t.viseme!=="rest"&&t.viseme!=="MBP"?a(["talk",n]):n):t.talk?(this.talkT+=r,Math.floor(this.talkT/.12)%2===0?a(["talk",n]):n):(this.talkT=0,this.blinking>0?(this.blinking-=r,a(["blink",n])):(this.blinkT-=r,this.blinkT<=0&&(this.blinkT=2.5+this.random()*3,o!=="surprised"&&o!=="scared"&&o!=="hurt"&&(this.blinking=.13)),n))}};var je="voxel-v1",Ut=1,Kt=["hair","top","bottom","shoes","hands","waist","back","neck","faceAcc","hat"],da=["head","torso","sleeveL","sleeveR","forearmL","forearmR","handL","handR","legL","legR","footL","footR"],ua={sleeves:["sleeveL","sleeveR"],forearms:["forearmL","forearmR"],arms:["sleeveL","sleeveR","forearmL","forearmR"],hands:["handL","handR"],legs:["legL","legR"],feet:["footL","footR"]},qt="@skin",fa={hair:{bones:["head"],paint:["head"],paintFaces:["top","back","left","right"],parts:8,box:{min:[-6,22,-6],max:[6,35.5,6]}},hat:{bones:["head"],paint:[],parts:8,box:{min:[-7,21,-8],max:[7,38,7]}},top:{bones:["body","armL","armR","foreArmL","foreArmR"],paint:["torso","sleeveL","sleeveR","forearmL","forearmR"],parts:6,box:{min:[-10,9.5,-6],max:[10,26,6]}},bottom:{bones:["body","legL","legR","shinL","shinR"],paint:["legL","legR"],parts:4,box:{min:[-6.5,.5,-4.5],max:[6.5,17,4.5]}},shoes:{bones:["legL","legR","shinL","shinR"],paint:["footL","footR"],parts:4,box:{min:[-5.5,-0.5,-4.5],max:[5.5,7,4]}},hands:{bones:["armL","armR","foreArmL","foreArmR"],paint:["handL","handR"],parts:2,box:{min:[-10,9.5,-4],max:[10,16,4]}},waist:{bones:["body"],paint:[],parts:4,box:{min:[-7,9.5,-4],max:[7,16.5,4]}},back:{bones:["body"],paint:[],parts:8,box:{min:[-13.5,6,1.5],max:[13.5,36.5,13]}},faceAcc:{bones:["head"],paint:[],parts:8,box:{min:[-6,21,-6.5],max:[6,30.5,5]}},neck:{bones:["body"],paint:[],parts:6,box:{min:[-6,15,-4.5],max:[6,24.5,4.5]}}},Yt={palette:5,textures:4,textureSide:32,texturePixels:2048,id:40,textureId:12,name:40},Vr=["round","sparkle","wide","cat","sleepy","dot","anime","almond","button","narrow","starry","glam"],Fr=["soft","thick","arched","none","straight","angled","bushy","thin"],Dr=["smile","grin","cat","small","smirk","open","teeth","fang","tongue","pout"],Br=["none","freckles","mole","scar","plaster","whiskers","star"],Nr=["block","round"],ba="round",ya=Rr,ga=kr,At={walk:"bouncy",idle:"calm"},Et=[.5,1.8,7.5,5.4],gl={eyes:"round",eyeColor:"#3b2a20",brows:"soft",browColor:"#3b2a20",mouth:"smile",cheeks:true,marks:"none",emotion:"neutral"},Or={min:.9,max:1.1},vt=(e,t,r)=>typeof e=="string"&&t.includes(e)?e:r,ha=e=>typeof e=="string"&&Kt.includes(e);function cr(e){let t=X(e)?e:{},r=X(t.body)?t.body:{},o=X(t.face)?t.face:{},a=X(t.anim)?t.anim:{},n=gl,s={};if(X(t.wear))for(let[i,c]of Object.entries(t.wear))ha(i)&&typeof c=="string"&&c.trim()&&(s[i]=c.trim().slice(0,Yt.id));let l={};if(X(t.tint))for(let[i,c]of Object.entries(t.tint)){let p=ot(c);ha(i)&&p&&(l[i]=p);}return {version:Ut,style:je,body:{skin:ot(r.skin)??"#f2c9a0",height:Math.round(Ie(r.height,1,Or.min,Or.max)*1e3)/1e3,head:vt(r.head,Nr,ba)},face:{eyes:vt(o.eyes,Vr,n.eyes),eyeColor:ot(o.eyeColor)??n.eyeColor,brows:vt(o.brows,Fr,n.brows),browColor:ot(o.browColor)??n.browColor,mouth:vt(o.mouth,Dr,n.mouth),cheeks:typeof o.cheeks=="boolean"?o.cheeks:n.cheeks,marks:vt(o.marks,Br,"none"),emotion:vt(o.emotion,b$1,n.emotion)},anim:{walk:vt(a.walk,ya,At.walk),idle:vt(a.idle,ga,At.idle)},wear:s,tint:l}}var xl=/^[a-z0-9][a-z0-9_.-]*$/,wl=/^[A-Za-z0-9]+$/;function ma(e){return !Array.isArray(e)||e.length!==3?null:e.every(t=>typeof t=="number"&&Number.isFinite(t))?e:null}function Rl(e,t){if(!t||t.every(o=>o===0))return [e[0]/2,e[1]/2,e[2]/2];let r=Math.hypot(e[0],e[1],e[2])/2;return [r,r,r]}function pr(e){let t=[],r=(A,k,x)=>t.push(c({en:A,ru:k},x));if(!X(e))return {ok:false,errors:[c({en:"the item is not an object",ru:"\u0432\u0435\u0449\u044C: \u043D\u0435 \u043E\u0431\u044A\u0435\u043A\u0442"})]};let o=e,a=Yt;o.style!==void 0&&o.style!==je&&r("style \xAB{s}\xBB is not {need}","\u0441\u0442\u0438\u043B\u044C \xAB{s}\xBB: \u043D\u0435 {need}",{s:String(o.style),need:je});let n=typeof o.id=="string"?o.id.trim():"";if((!n||n.length>a.id||!xl.test(n))&&r("id must be 1, {n} characters: a-z, 0-9, _ . -","id: 1, {n} \u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432: a-z, 0-9, _ . -",{n:a.id}),!ha(o.slot))return r("unknown slot \xAB{s}\xBB","\u043D\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043D\u044B\u0439 \u0441\u043B\u043E\u0442 \xAB{s}\xBB",{s:String(o.slot)}),{ok:false,errors:t};let s=o.slot,l=fa[s],i=typeof o.name=="string"&&o.name.trim()?o.name.trim().slice(0,a.name):n,c$1={};if(!X(o.palette)||!Object.keys(o.palette).length)r("the palette is empty","\u043F\u0430\u043B\u0438\u0442\u0440\u0430 \u043F\u0443\u0441\u0442\u0430");else {let A=Object.entries(o.palette);A.length>a.palette&&r("more than {n} colours in the palette","\u0432 \u043F\u0430\u043B\u0438\u0442\u0440\u0435 \u0431\u043E\u043B\u044C\u0448\u0435 {n} \u0446\u0432\u0435\u0442\u043E\u0432",{n:a.palette});for(let[k,x]of A){let f=x===qt?qt:ot(x);k.length!==1||ut.has(k)||!f?r("palette colour \xAB{k}\xBB is not valid","\u0446\u0432\u0435\u0442 \u043F\u0430\u043B\u0438\u0442\u0440\u044B \xAB{k}\xBB \u043D\u0435 \u0433\u043E\u0434\u0438\u0442\u0441\u044F",{k}):c$1[k]=f;}}let p=typeof o.tint=="string"&&o.tint?o.tint:null;p!==null&&(!c$1[p]||c$1[p]===qt)&&r("tint \xAB{k}\xBB is not a colour of the palette","\u043F\u0435\u0440\u0435\u043A\u0440\u0430\u0441\u043A\u0430 \xAB{k}\xBB: \u043D\u0435 \u0446\u0432\u0435\u0442 \u043F\u0430\u043B\u0438\u0442\u0440\u044B",{k:p});let h={},m=0;if(o.textures!==void 0)if(!X(o.textures))r("textures is not an object","textures: \u043D\u0435 \u043E\u0431\u044A\u0435\u043A\u0442");else {let A=Object.entries(o.textures);A.length>a.textures&&r("more than {n} textures","\u0442\u0435\u043A\u0441\u0442\u0443\u0440 \u0431\u043E\u043B\u044C\u0448\u0435 {n}",{n:a.textures});for(let[k,x]of A){if(k.length>a.textureId||!wl.test(k)){r("texture id \xAB{id}\xBB must be 1, {n} letters or digits","id \u0442\u0435\u043A\u0441\u0442\u0443\u0440\u044B \xAB{id}\xBB: 1, {n} \u0431\u0443\u043A\u0432 \u0438\u043B\u0438 \u0446\u0438\u0444\u0440",{id:k.slice(0,20),n:a.textureId});continue}let f=X(x)?x:null,S=f&&Array.isArray(f.rows)?f.rows:null,T=f?f.w:void 0,C=f?f.h:void 0;if(!S||typeof T!="number"||typeof C!="number"||!Number.isInteger(T)||!Number.isInteger(C)||T<1||C<1||T>a.textureSide||C>a.textureSide||S.length!==C||S.some(_=>typeof _!="string"||_.length!==T)){r("texture \xAB{id}\xBB must be w\xD7h \u2264 {n} with exactly h rows of w symbols","\u0442\u0435\u043A\u0441\u0442\u0443\u0440\u0430 \xAB{id}\xBB: w\xD7h \u2264 {n}, \u0440\u043E\u0432\u043D\u043E h \u0441\u0442\u0440\u043E\u043A \u043F\u043E w \u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432",{id:k,n:a.textureSide});continue}S.some(_=>[..._].some(M=>!ut.has(M)&&!c$1[M]))&&r("texture \xAB{id}\xBB uses symbols outside the palette","\u0432 \u0442\u0435\u043A\u0441\u0442\u0443\u0440\u0435 \xAB{id}\xBB \u0441\u0438\u043C\u0432\u043E\u043B\u044B \u043D\u0435 \u0438\u0437 \u043F\u0430\u043B\u0438\u0442\u0440\u044B",{id:k}),m+=T*C,h[k]={w:T,h:C,rows:S.map(_=>_.replace(/ /g,"."))};}m>a.texturePixels&&r("textures take {p} pixels, the limit is {n}","\u0442\u0435\u043A\u0441\u0442\u0443\u0440\u044B \u0437\u0430\u043D\u0438\u043C\u0430\u044E\u0442 {p} \u043F\u0438\u043A\u0441\u0435\u043B\u0435\u0439, \u043F\u0440\u0435\u0434\u0435\u043B {n}",{p:m,n:a.texturePixels});}let d=(A,k)=>typeof A!="string"?null:h[A]||c$1[A]?A:(r("{w}: \xAB{v}\xBB is neither a texture nor a palette colour","{w}: \xAB{v}\xBB: \u043D\u0438 \u0442\u0435\u043A\u0441\u0442\u0443\u0440\u0430, \u043D\u0438 \u0446\u0432\u0435\u0442 \u043F\u0430\u043B\u0438\u0442\u0440\u044B",{w:k,v:A}),null),b=(A,k,x=dt)=>{if(A===void 0)return;if(!X(A)){r("{w}: faces is not an object","{w}: faces: \u043D\u0435 \u043E\u0431\u044A\u0435\u043A\u0442",{w:k});return}let f={};for(let[S,T]of Object.entries(A)){if(!dt.includes(S)){r("{w}: unknown face \xAB{f}\xBB","{w}: \u043D\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043D\u0430\u044F \u0433\u0440\u0430\u043D\u044C \xAB{f}\xBB",{w:k,f:S});continue}if(!x.includes(S)){r("{w}: the {slot} slot may not paint the \xAB{f}\xBB face","{w}: \u0441\u043B\u043E\u0442 {slot} \u043D\u0435 \u043A\u0440\u0430\u0441\u0438\u0442 \u0433\u0440\u0430\u043D\u044C \xAB{f}\xBB",{w:k,slot:s,f:S});continue}let C=d(T,k);C&&(f[S]=C);}return Object.keys(f).length?f:void 0},u=[];o.paint!==void 0&&!Array.isArray(o.paint)&&r("paint is not a list","paint: \u043D\u0435 \u0441\u043F\u0438\u0441\u043E\u043A");for(let[A,k]of (Array.isArray(o.paint)?o.paint:[]).entries()){let x=`paint[${A}]`;if(!X(k)){r("{w} is not an object","{w}: \u043D\u0435 \u043E\u0431\u044A\u0435\u043A\u0442",{w:x});continue}let f=typeof k.region=="string"?k.region:"",S=ua[f]??(da.includes(f)?[f]:[]);if(!S.length){r("{w}: unknown region \xAB{r}\xBB","{w}: \u043D\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043D\u0430\u044F \u043E\u0431\u043B\u0430\u0441\u0442\u044C \xAB{r}\xBB",{w:x,r:f});continue}let T=S.filter(_=>!l.paint.includes(_));if(T.length){r("{w}: the {slot} slot may not paint \xAB{r}\xBB","{w}: \u0441\u043B\u043E\u0442 {slot} \u043D\u0435 \u043A\u0440\u0430\u0441\u0438\u0442 \xAB{r}\xBB",{w:x,slot:s,r:T.join(", ")});continue}let C=typeof k.color=="string"&&c$1[k.color]?k.color:null;C||r("{w}: colour is not in the palette","{w}: \u0446\u0432\u0435\u0442\u0430 \u043D\u0435\u0442 \u0432 \u043F\u0430\u043B\u0438\u0442\u0440\u0435",{w:x});let z=b(k.faces,x,l.paintFaces);if(C)for(let _ of S){let M={region:_,color:C};z&&(M.faces={...z}),u.push(M);}}let R=[];o.parts!==void 0&&!Array.isArray(o.parts)&&r("parts is not a list","parts: \u043D\u0435 \u0441\u043F\u0438\u0441\u043E\u043A");let w=Array.isArray(o.parts)?o.parts:[];w.length>l.parts&&r("the {slot} slot allows {n} boxes, the item has {m}","\u0441\u043B\u043E\u0442\u0443 {slot} \u043C\u043E\u0436\u043D\u043E {n} \u043A\u043E\u0440\u043E\u0431\u043E\u043A, \u0443 \u0432\u0435\u0449\u0438 {m}",{slot:s,n:l.parts,m:w.length});for(let[A,k]of w.entries()){let x=`parts[${A}]`;if(!X(k)){r("{w} is not an object","{w}: \u043D\u0435 \u043E\u0431\u044A\u0435\u043A\u0442",{w:x});continue}let f=typeof k.bone=="string"?k.bone:"";if(!l.bones.includes(f)){r("{w}: the {slot} slot puts boxes only on {b}","{w}: \u0441\u043B\u043E\u0442 {slot} \u0441\u0442\u0430\u0432\u0438\u0442 \u043A\u043E\u0440\u043E\u0431\u043A\u0438 \u0442\u043E\u043B\u044C\u043A\u043E \u043D\u0430 {b}",{w:x,slot:s,b:l.bones.join(", ")});continue}let S=ma(k.size),T=ma(k.pos);if(!S||!T||S.some(se=>se<=0)){r("{w}: size and pos must be [x, y, z]","{w}: size \u0438 pos: [x, y, z]",{w:x});continue}let C=k.rot===void 0?void 0:ma(k.rot);k.rot!==void 0&&!C&&r("{w}: rot must be [x, y, z]","{w}: rot: [x, y, z]",{w:x});let z=k.mirror===true,_=Rl(S,C??void 0),V=(z?[T[0],-T[0]]:[T[0]]).some(se=>se-_[0]<l.box.min[0]-1e-6||se+_[0]>l.box.max[0]+1e-6)||[1,2].some(se=>T[se]-_[se]<l.box.min[se]-1e-6||T[se]+_[se]>l.box.max[se]+1e-6);V&&r("{w}: the box leaves the {slot} slot frame","{w}: \u043A\u043E\u0440\u043E\u0431\u043A\u0430 \u0432\u044B\u0445\u043E\u0434\u0438\u0442 \u0437\u0430 \u0440\u0430\u043C\u043A\u0443 \u0441\u043B\u043E\u0442\u0430 {slot}",{w:x,slot:s});let q=typeof k.color=="string"&&c$1[k.color]?k.color:null;q||r("{w}: colour is not in the palette","{w}: \u0446\u0432\u0435\u0442\u0430 \u043D\u0435\u0442 \u0432 \u043F\u0430\u043B\u0438\u0442\u0440\u0435",{w:x});let Y=b(k.faces,x),ce;if(k.mat!==void 0&&(typeof k.mat=="string"&&er.includes(k.mat)?ce=k.mat:r("{w}: material \xAB{m}\xBB is not {list}","{w}: \u043C\u0430\u0442\u0435\u0440\u0438\u0430\u043B \xAB{m}\xBB: \u043D\u0435 {list}",{w:x,m:String(k.mat),list:er.join(", ")})),!q||V)continue;let pe={bone:f,size:[...S],pos:[...T],color:q};Y&&(pe.faces=Y),C&&C.some(se=>se!==0)&&(pe.rot=[...C]),z&&(pe.mirror=true),typeof k.name=="string"&&k.name.trim()&&(pe.name=k.name.trim().slice(0,24)),ce&&(pe.mat=ce),R.push(pe);}return !w.length&&!(Array.isArray(o.paint)&&o.paint.length)&&r("the item neither paints nor adds anything","\u0432\u0435\u0449\u044C \u043D\u0438\u0447\u0435\u0433\u043E \u043D\u0435 \u043A\u0440\u0430\u0441\u0438\u0442 \u0438 \u043D\u0435 \u0434\u043E\u0431\u0430\u0432\u043B\u044F\u0435\u0442"),t.length?{ok:false,errors:t}:{ok:true,item:{version:Ut,style:je,id:n,slot:s,name:i,palette:c$1,tint:p,textures:h,paint:u,parts:R}}}var Oe="#2b2140",et="#7a2e2e",Wt="#e8707a",kl={neutral:{eye:"open",iris:1,white:1,lidOuter:0,lidInner:0,browUp:0,browInner:0,tear:false},happy:{eye:"happy",iris:1,white:1,lidOuter:0,lidInner:0,browUp:.04,browInner:0,tear:false},sad:{eye:"open",iris:1,white:1,lidOuter:.38,lidInner:.12,browUp:0,browInner:.09,tear:true},angry:{eye:"open",iris:.9,white:.95,lidOuter:.1,lidInner:.42,browUp:-0.02,browInner:-0.1,tear:false},surprised:{eye:"open",iris:.55,white:1.15,lidOuter:0,lidInner:0,browUp:.1,browInner:0,tear:false},scared:{eye:"open",iris:.42,white:1.08,lidOuter:0,lidInner:0,browUp:.08,browInner:.07,tear:false},tired:{eye:"open",iris:1,white:1,lidOuter:.5,lidInner:.5,browUp:-0.02,browInner:-0.02,tear:false},hurt:{eye:"hurt",iris:1,white:1,lidOuter:0,lidInner:0,browUp:0,browInner:-0.07,tear:false},love:{eye:"heart",iris:1,white:1,lidOuter:0,lidInner:0,browUp:.05,browInner:.03,tear:false,blush:.6},excited:{eye:"star",iris:1,white:1,lidOuter:0,lidInner:0,browUp:.09,browInner:0,tear:false},smug:{eye:"open",iris:.95,white:1,lidOuter:.42,lidInner:.36,browUp:0,browInner:-0.03,tear:false,look:.25,browTilt:.06},confused:{eye:"open",iris:.8,white:1.05,lidOuter:0,lidInner:0,browUp:.03,browInner:.04,tear:false,browTilt:.1,sweat:true},embarrassed:{eye:"happy",iris:1,white:1,lidOuter:0,lidInner:0,browUp:.02,browInner:.08,tear:false,blush:1,sweat:true},silly:{eye:"happy",iris:1,white:1,lidOuter:0,lidInner:0,browUp:.06,browInner:0,tear:false,wink:true},cool:{eye:"open",iris:.9,white:1,lidOuter:.38,lidInner:.38,browUp:-0.01,browInner:-0.02,tear:false},disgusted:{eye:"open",iris:.85,white:.95,lidOuter:.3,lidInner:.45,browUp:-0.02,browInner:-0.08,tear:false,look:-0.3},determined:{eye:"open",iris:1,white:1,lidOuter:.15,lidInner:.34,browUp:-0.01,browInner:-0.12,tear:false},crying:{eye:"closed",iris:1,white:1,lidOuter:0,lidInner:0,browUp:.02,browInner:.12,tear:false,stream:true},dizzy:{eye:"spiral",iris:1,white:1,lidOuter:0,lidInner:0,browUp:.04,browInner:.05,tear:false},sleepy:{eye:"closed",iris:1,white:1,lidOuter:0,lidInner:0,browUp:-0.02,browInner:0,tear:false,zzz:true},wink:{eye:"open",iris:1,white:1,lidOuter:0,lidInner:0,browUp:.04,browInner:0,tear:false,wink:true}};function xa(e,t,r,o,a,n="neutral"){let s=a==="blink"||a==="talk"?n==="blink"||n==="talk"?"neutral":n:a,l=kl[s];e.clearRect(0,0,t,r),e.lineCap="round",e.lineJoin="round";let i=r*.5,c=t*.105,p=r*.2,h=a==="blink"?"closed":l.eye;if(o.cheeks&&s!=="scared"&&(e.fillStyle=s==="happy"?"rgba(236,110,140,0.5)":"rgba(236,120,140,0.32)",j(e,t*.12,r*.8,t*.07,r*.075),e.fill(),j(e,t*.88,r*.8,t*.07,r*.075),e.fill()),l.blush){e.fillStyle=`rgba(236,90,120,${.35*l.blush})`,j(e,t*.13,r*.8,t*.085,r*.09),e.fill(),j(e,t*.87,r*.8,t*.085,r*.09),e.fill(),e.strokeStyle=`rgba(200,60,90,${.7*l.blush})`,e.lineWidth=t*.008;for(let m of [t*.13,t*.87])for(let d=-1;d<=1;d++)e.beginPath(),e.moveTo(m+d*t*.025-t*.01,r*.84),e.lineTo(m+d*t*.025+t*.01,r*.76),e.stroke();}vl(e,t,r,o);for(let m of [-1,1]){let d=t*(.5+m*.22),b=l.wink&&m===1&&h!=="closed"?"happy":h;El(e,d,i,c,p,m,o,b,l);let u=(l.browTilt??0)*(m===1?1:-0.4);Sl(e,d,i-p-r*.07-r*u,t,r,m,o,l);}if(l.stream&&a!=="blink"){e.fillStyle="rgba(133,183,235,0.85)";for(let m of [-1,1]){let d=t*(.5+m*.22);e.beginPath(),e.moveTo(d-t*.03,i+p*.35),e.quadraticCurveTo(d-t*.045,r*.8,d-t*.025,r),e.lineTo(d+t*.025,r),e.quadraticCurveTo(d+t*.04,r*.8,d+t*.03,i+p*.35),e.closePath(),e.fill();}}if(l.sweat){e.fillStyle="#9fd3f5";let m=t*.95,d=r*.2;e.beginPath(),e.moveTo(m,d-r*.09),e.quadraticCurveTo(m+t*.035,d+r*.02,m,d+r*.05),e.quadraticCurveTo(m-t*.035,d+r*.02,m,d-r*.09),e.fill();}if(l.zzz){e.strokeStyle=Oe,e.lineWidth=t*.012;let m=(d,b,u)=>{e.beginPath(),e.moveTo(d,b),e.lineTo(d+u,b),e.lineTo(d,b+u),e.lineTo(d+u,b+u),e.stroke();};m(t*.8,r*.12,t*.05),m(t*.88,r*.02,t*.035);}if(l.tear&&h==="open"){e.fillStyle="#85b7eb";let m=t*.5-t*.22-c*.6,d=i+p*1.05;e.beginPath(),e.moveTo(m,d-r*.07),e.quadraticCurveTo(m+t*.03,d,m,d+r*.04),e.quadraticCurveTo(m-t*.03,d,m,d-r*.07),e.fill();}Tl(e,t*.5,r*.86,t,r,o,a==="talk"?"talk":s);}function vl(e,t,r,o){let a=o.marks;if(!(!a||a==="none"))switch(a){case "freckles":{e.fillStyle="rgba(150,90,50,0.55)";let n=[[.08,.7],[.13,.66],[.18,.71],[.11,.76],[.16,.78],[.92,.7],[.87,.66],[.82,.71],[.89,.76],[.84,.78]];for(let[s,l]of n)j(e,t*s,r*l,t*.009,t*.009),e.fill();return}case "mole":e.fillStyle="#4a2e22",j(e,t*.64,r*.82,t*.011,t*.011),e.fill();return;case "scar":{e.strokeStyle="rgba(150,60,60,0.75)",e.lineWidth=t*.012,e.beginPath(),e.moveTo(t*.2,r*.12),e.lineTo(t*.32,r*.78),e.stroke(),e.lineWidth=t*.007;for(let n=1;n<=4;n++){let s=n/5,l=t*(.2+.12*s),i=r*(.12+.66*s);e.beginPath(),e.moveTo(l-t*.025,i+r*.005),e.lineTo(l+t*.025,i-r*.005),e.stroke();}return}case "plaster":{e.save(),e.translate(t*.84,r*.74),e.rotate(-0.5),e.fillStyle="#f1d3a8",e.fillRect(-t*.07,-r*.04,t*.14,r*.08),e.fillStyle="#e3b98a",e.fillRect(-t*.025,-r*.04,t*.05,r*.08),e.restore();return}case "whiskers":{e.strokeStyle=Oe,e.lineWidth=t*.008;for(let n of [-1,1])for(let s of [-0.04,0,.04])e.beginPath(),e.moveTo(t*(.5+n*.24),r*(.78+s)),e.lineTo(t*(.5+n*.42),r*(.75+s*1.8)),e.stroke();return}case "star":Ro(e,t*.84,r*.74,t*.045),e.fillStyle="#f2c14e",e.fill();return}}function Al(e,t,r,o){e.beginPath(),e.moveTo(t,r+o*.9),e.bezierCurveTo(t-o*1.4,r-o*.1,t-o*.7,r-o*1.1,t,r-o*.4),e.bezierCurveTo(t+o*.7,r-o*1.1,t+o*1.4,r-o*.1,t,r+o*.9),e.closePath();}function j(e,t,r,o,a){e.beginPath(),e.ellipse(t,r,Math.max(.1,o),Math.max(.1,a),0,0,Math.PI*2);}function El(e,t,r,o,a,n,s,l,i){let c=o*.26;if(e.strokeStyle=Oe,e.lineWidth=c,l==="closed"){e.beginPath(),e.moveTo(t-o,r+a*.1),e.quadraticCurveTo(t,r+a*.55,t+o,r+a*.1),e.stroke(),s.eyes==="wide"&&es(e,t,r+a*.15,o,a*.3,n,c);return}if(l==="happy"){e.lineWidth=c*1.2,e.beginPath(),e.moveTo(t-o,r+a*.35),e.quadraticCurveTo(t,r-a*.75,t+o,r+a*.35),e.stroke();return}if(l==="heart"){Al(e,t,r,o*1.05),e.fillStyle="#e8436b",e.fill(),e.fillStyle="rgba(255,255,255,0.8)",j(e,t-o*.38,r-a*.25,o*.2,o*.16),e.fill();return}if(l==="star"){Ro(e,t,r,Math.min(o,a)*1.15),e.fillStyle="#f2c14e",e.fill(),e.lineWidth=c*.6,e.stroke();return}if(l==="spiral"){e.lineWidth=c*.9,e.beginPath();for(let _=0;_<=36;_++){let M=_/36*Math.PI*4*n,V=_/36*Math.min(o,a)*.95,q=t+Math.cos(M)*V,Y=r+Math.sin(M)*V;_?e.lineTo(q,Y):e.moveTo(q,Y);}e.stroke();return}if(l==="hurt"){let _=t-n*o*.6,M=t+n*o*.8;e.lineWidth=c*1.2,e.beginPath(),e.moveTo(M,r-a*.55),e.lineTo(_,r),e.lineTo(M,r+a*.55),e.stroke();return}let p=s.eyes==="anime"?1.12:s.eyes==="narrow"?1.15:1,h=s.eyes==="anime"?1.25:s.eyes==="narrow"?.55:1,m=o*i.white*p,d=a*i.white*h,b=s.eyes==="sleepy"?.32:0,u=Math.max(i.lidOuter,b),R=Math.max(i.lidInner,b),w=r-d,A=t+n*(m+c),k=t-n*(m+c),x=w+2*d*u,f=w+2*d*R,S=u>0||R>0;e.save(),S&&(e.beginPath(),e.moveTo(A,x),e.lineTo(k,f),e.lineTo(k,r+d*2),e.lineTo(A,r+d*2),e.closePath(),e.clip());let T=Math.min(m,d)*.8*i.iris*(s.eyes==="narrow"?1.5:1),C=r+d*.12,z=(i.look??0)*m*.45;switch(s.eyes){case "button":{e.fillStyle=Oe,j(e,t+z,r+d*.05,m*.72,d*.8),e.fill(),e.fillStyle="#ffffff",j(e,t+z-m*.28,r-d*.25,m*.2,m*.2),e.fill(),j(e,t+z+m*.25,r+d*.3,m*.09,m*.09),e.fill();break}case "almond":{e.fillStyle="#ffffff",mr(e,t,r,m*1.05,d*.8,n),e.fill(),e.save(),mr(e,t,r,m*1.05,d*.8,n),e.clip(),e.fillStyle=s.eyeColor,j(e,t+z,C,T*1.05,T*1.05),e.fill(),e.fillStyle=Oe,j(e,t+z,C,T*.5,T*.5),e.fill(),e.fillStyle="#ffffff",j(e,t+z-T*.38,C-T*.4,T*.28,T*.28),e.fill(),e.restore(),e.strokeStyle=Oe,e.lineWidth=c*1.1,mr(e,t,r,m*1.05,d*.8,n),e.stroke();break}case "anime":case "starry":case "glam":case "narrow":{e.fillStyle="#ffffff",j(e,t,r,m,d),e.fill(),e.save(),j(e,t,r,m,d),e.clip();let _=s.eyes==="anime"?1.3:s.eyes==="narrow"?1:1.12,M=T*_,V=t+z;e.fillStyle=s.eyeColor,j(e,V,C,M*.95,M*(s.eyes==="anime"?1.25:1)),e.fill(),e.fillStyle="rgba(255,255,255,0.22)",j(e,V,C+M*.5,M*.7,M*.45),e.fill(),s.eyes==="starry"?(Ro(e,V,C,M*.62),e.fillStyle="#fff3b0",e.fill()):(e.fillStyle=Oe,j(e,V,C,M*.46,M*(s.eyes==="anime"?.62:.5)),e.fill()),e.fillStyle="#ffffff",j(e,V-M*.38,C-M*.45,M*(s.eyes==="anime"?.38:.3),M*.3),e.fill(),j(e,V+M*.4,C+M*.4,M*.16,M*.16),e.fill(),e.restore(),e.strokeStyle=Oe,e.lineWidth=s.eyes==="anime"||s.eyes==="glam"?c*1.6:c,e.beginPath(),e.ellipse(t,r,m,d,0,Math.PI*1.05,Math.PI*1.95),e.stroke(),s.eyes==="glam"&&(e.beginPath(),e.moveTo(t+n*m*.85,r-d*.45),e.lineTo(t+n*m*1.45,r-d*.95),e.stroke());break}case "dot":{e.fillStyle=Oe,j(e,t+z,r+d*.1,m*.55,d*.72),e.fill(),e.fillStyle="#ffffff",j(e,t+z-m*.18,r-d*.18,m*.17,m*.17),e.fill();break}case "cat":{e.fillStyle="#ffffff",mr(e,t,r,m*1.08,d*.85,n),e.fill(),e.save(),mr(e,t,r,m*1.08,d*.85,n),e.clip(),e.fillStyle=s.eyeColor,j(e,t,C,T*1.05,T*1.2),e.fill(),e.fillStyle=Oe,j(e,t,C,T*.22*(i.iris<1?1.5:1),T*.95),e.fill(),e.fillStyle="#ffffff",j(e,t-T*.4,C-T*.45,T*.25,T*.25),e.fill(),e.restore(),e.strokeStyle=Oe,e.lineWidth=c,mr(e,t,r,m*1.08,d*.85,n),e.stroke();break}default:{let _=s.eyes==="sparkle"||s.eyes==="wide";e.fillStyle="#ffffff",j(e,t,r,m,d),e.fill(),e.save(),j(e,t,r,m,d),e.clip();let M=_?T*1.18:T;e.fillStyle=s.eyeColor,j(e,t+z,C,M*.95,M*(s.eyes==="sparkle"?1.15:1)),e.fill(),e.fillStyle="rgba(255,255,255,0.18)",j(e,t+z,C+M*.45,M*.7,M*.45),e.fill(),e.fillStyle=Oe,j(e,t+z,C,M*.48,M*.52),e.fill(),e.fillStyle="#ffffff",j(e,t+z-M*.38,C-M*.42,M*.32,M*.32),e.fill(),j(e,t+z+M*.38,C+M*.38,M*.14,M*.14),e.fill(),s.eyes==="sparkle"&&(Ro(e,t+z+M*.3,C-M*.55,M*.22),e.fill()),e.restore(),e.strokeStyle=Oe,e.lineWidth=c,e.beginPath(),e.ellipse(t,r,m,d,0,Math.PI*1.08,Math.PI*1.92),e.stroke();break}}if(e.restore(),S){e.strokeStyle=Oe,e.lineWidth=c;let _=Y=>(Y-A)/(k-A),M=Y=>x+(f-x)*_(Y),V=t-m*.95,q=t+m*.95;e.beginPath(),e.moveTo(V,M(V)),e.lineTo(q,M(q)),e.stroke();}(s.eyes==="wide"||s.eyes==="glam")&&es(e,t,r-d*.55,m,d*.45,n,c);}function mr(e,t,r,o,a,n){let s=t+n*o,l=t-n*o;e.beginPath(),e.moveTo(l,r+a*.15),e.quadraticCurveTo(t,r-a*1.5,s,r-a*.35),e.quadraticCurveTo(t,r+a*1.4,l,r+a*.15),e.closePath();}function es(e,t,r,o,a,n,s){e.lineWidth=s*.8;let l=t+n*o;for(let i=0;i<2;i++){let c=r+i*a*.6;e.beginPath(),e.moveTo(l-n*o*.1,c),e.lineTo(l+n*o*.35,c-a*(.7-i*.2)),e.stroke();}}function Ro(e,t,r,o){e.beginPath();for(let a=0;a<8;a++){let n=a%2?o*.35:o,s=a*Math.PI/4-Math.PI/2,l=t+Math.cos(s)*n,i=r+Math.sin(s)*n;a?e.lineTo(l,i):e.moveTo(l,i);}e.closePath(),e.fillStyle="#ffffff";}function Sl(e,t,r,o,a,n,s,l){if(s.brows==="none")return;let i=o*.095,c=r-a*l.browUp,p=t-n*i,h=t+n*i,m=c-a*l.browInner,d=c+a*l.browInner*.3;if(e.strokeStyle=s.browColor,e.fillStyle=s.browColor,s.brows==="bushy"){let u=a*.085;e.beginPath(),e.moveTo(h+n*o*.01,d+u*.2),e.quadraticCurveTo(t,Math.min(d,m)-u*.9,p,m-u*.1),e.lineTo(p,m+u*.8);for(let R=1;R<=4;R++){let w=p+(h-p)*R/4;e.lineTo(w-n*o*.01,m+(d-m)*(R/4)+u*(R%2?.5:.85));}e.closePath(),e.fill();return}if(s.brows==="straight"||s.brows==="thin"){e.lineWidth=o*(s.brows==="thin"?.014:.03),e.beginPath(),e.moveTo(h,d),e.lineTo(p,m),e.stroke();return}if(s.brows==="angled"){e.lineWidth=o*.028;let u=t+n*i*.3;e.beginPath(),e.moveTo(p,m),e.lineTo(u,Math.min(d,m)-a*.06),e.lineTo(h,d+a*.02),e.stroke();return}if(s.brows==="thick"){let u=a*.06;e.beginPath(),e.moveTo(h,d),e.quadraticCurveTo(t,Math.min(d,m)-u*.6,p,m),e.lineTo(p,m+u),e.quadraticCurveTo(t,Math.min(d,m)+u*.5,h,d+u*.6),e.closePath(),e.fill();return}e.lineWidth=o*(s.brows==="arched"?.026:.032),e.beginPath(),e.moveTo(h,d);let b=s.brows==="arched"?a*.09:a*.035;e.quadraticCurveTo(t+n*i*.2,Math.min(d,m)-b,p,m),e.stroke();}function Tl(e,t,r,o,a,n,s){let l=o*.026;e.strokeStyle=et,e.lineWidth=l;let i=o*(n.mouth==="small"||n.mouth==="pout"?.06:n.mouth==="grin"?.12:.09),c=(p,h=4)=>{e.beginPath();for(let m=0;m<=h;m++){let d=t-i+2*i*m/h,b=r+(m%2?-1:1)*a*p;m?e.lineTo(d,b):e.moveTo(d,b);}e.stroke();};switch(s){case "love":case "wink":case "embarrassed":if(s==="embarrassed"){c(.025,4);return}e.beginPath(),e.moveTo(t-i,r-a*.04),e.quadraticCurveTo(t,r+a*.09,t+i,r-a*.04),e.stroke();return;case "excited":case "silly":{let p=Math.max(i,o*.11);e.fillStyle=et,e.beginPath(),e.moveTo(t-p,r-a*.07),e.quadraticCurveTo(t,r-a*.03,t+p,r-a*.07),e.quadraticCurveTo(t,r+a*.22,t-p,r-a*.07),e.closePath(),e.fill(),s==="silly"?(e.fillStyle=Wt,j(e,t+p*.25,r+a*.11,p*.4,a*.08),e.fill(),e.strokeStyle="#c4505c",e.lineWidth=l*.5,e.beginPath(),e.moveTo(t+p*.25,r+a*.06),e.lineTo(t+p*.25,r+a*.14),e.stroke()):(e.save(),e.clip(),e.fillStyle=Wt,j(e,t,r+a*.12,p*.55,a*.06),e.fill(),e.restore());return}case "smug":case "cool":e.beginPath(),e.moveTo(t-i,r+a*.01),e.quadraticCurveTo(t+i*.3,r+a*.03,t+i*1.05,r-a*.06),e.stroke();return;case "confused":case "dizzy":c(s==="dizzy"?.035:.02,s==="dizzy"?6:4);return;case "disgusted":{e.beginPath(),e.moveTo(t-i,r+a*.05),e.lineTo(t-i*.3,r-a*.02),e.lineTo(t+i*.4,r+a*.03),e.lineTo(t+i,r-a*.01),e.stroke(),e.fillStyle=Wt,j(e,t-i*.1,r+a*.045,i*.3,a*.03),e.fill();return}case "determined":{e.fillStyle="#ffffff",e.fillRect(t-i,r-a*.035,i*2,a*.07),e.strokeStyle=et,e.lineWidth=l*.7,e.strokeRect(t-i,r-a*.035,i*2,a*.07),e.beginPath(),e.moveTo(t-i,r),e.lineTo(t+i,r),e.stroke();return}case "crying":{let p=Math.max(i,o*.1);e.fillStyle=et,e.beginPath(),e.moveTo(t-p,r+a*.09),e.quadraticCurveTo(t,r-a*.14,t+p,r+a*.09),e.closePath(),e.fill();return}case "sleepy":e.fillStyle=et,j(e,t,r+a*.01,o*.025,a*.035),e.fill();return;case "happy":{let p=Math.max(i,o*.1);e.fillStyle=et,e.beginPath(),e.moveTo(t-p,r-a*.06),e.quadraticCurveTo(t,r-a*.02,t+p,r-a*.06),e.quadraticCurveTo(t,r+a*.2,t-p,r-a*.06),e.closePath(),e.fill(),e.save(),e.clip(),e.fillStyle=Wt,j(e,t,r+a*.1,p*.55,a*.06),e.fill(),n.mouth==="grin"&&(e.fillStyle="#ffffff",e.fillRect(t-p,r-a*.08,p*2,a*.045)),e.restore();return}case "surprised":e.fillStyle=et,j(e,t,r,o*.045,a*.085),e.fill();return;case "talk":e.fillStyle=et,j(e,t,r,Math.max(i*.7,o*.06),a*.07),e.fill(),e.save(),e.clip(),e.fillStyle=Wt,j(e,t,r+a*.06,o*.045,a*.035),e.fill(),e.restore();return;case "sad":e.beginPath(),e.moveTo(t-i,r+a*.04),e.quadraticCurveTo(t,r-a*.07,t+i,r+a*.04),e.stroke();return;case "angry":e.beginPath(),e.moveTo(t-i,r+a*.01),e.quadraticCurveTo(t,r-a*.03,t+i,r+a*.01),e.stroke();return;case "scared":{e.beginPath();let p=4;for(let h=0;h<=p;h++){let m=t-i+2*i*h/p,d=r+(h%2?-1:1)*a*.022;h?e.lineTo(m,d):e.moveTo(m,d);}e.stroke();return}case "tired":e.beginPath(),e.moveTo(t-i*.6,r),e.lineTo(t+i*.6,r),e.stroke();return;case "hurt":{e.beginPath();let p=4;for(let h=0;h<=p;h++){let m=t-i+2*i*h/p,d=r+(h%2?-1:1)*a*.04;h?e.lineTo(m,d):e.moveTo(m,d);}e.stroke();return}}if(n.mouth==="smirk"){e.beginPath(),e.moveTo(t-i,r),e.quadraticCurveTo(t+i*.3,r+a*.03,t+i,r-a*.06),e.stroke();return}if(n.mouth==="pout"){e.lineWidth=l*.9,e.beginPath(),e.moveTo(t-i*.15,r-a*.05),e.quadraticCurveTo(t+i*.9,r-a*.03,t-i*.05,r),e.quadraticCurveTo(t+i*.9,r+a*.03,t-i*.15,r+a*.05),e.stroke();return}if(n.mouth==="open"||n.mouth==="teeth"||n.mouth==="fang"||n.mouth==="tongue"){e.fillStyle=et,e.beginPath(),e.moveTo(t-i,r-a*.04),e.quadraticCurveTo(t,r-a*.02,t+i,r-a*.04),e.quadraticCurveTo(t,r+a*.13,t-i,r-a*.04),e.closePath(),e.fill(),e.save(),e.clip(),n.mouth==="teeth"?(e.fillStyle="#ffffff",e.fillRect(t-i,r-a*.06,i*2,a*.045)):n.mouth!=="fang"&&(e.fillStyle=Wt,j(e,t,r+a*.07,i*.55,a*.05),e.fill()),e.restore(),n.mouth==="fang"&&(e.fillStyle="#ffffff",e.beginPath(),e.moveTo(t+i*.35,r-a*.035),e.lineTo(t+i*.6,r-a*.035),e.lineTo(t+i*.47,r+a*.03),e.closePath(),e.fill()),n.mouth==="tongue"&&(e.fillStyle=Wt,j(e,t+i*.3,r+a*.07,i*.32,a*.05),e.fill());return}if(n.mouth==="cat"){e.beginPath(),e.moveTo(t-i,r-a*.03),e.quadraticCurveTo(t-i*.5,r+a*.06,t,r-a*.01),e.quadraticCurveTo(t+i*.5,r+a*.06,t+i,r-a*.03),e.stroke();return}if(n.mouth==="grin"){e.fillStyle=et,e.beginPath(),e.moveTo(t-i,r-a*.04),e.quadraticCurveTo(t,r-a*.01,t+i,r-a*.04),e.quadraticCurveTo(t,r+a*.12,t-i,r-a*.04),e.closePath(),e.fill(),e.save(),e.clip(),e.fillStyle="#ffffff",e.fillRect(t-i,r-a*.06,i*2,a*.04),e.restore();return}e.beginPath(),e.moveTo(t-i,r-a*.03),e.quadraticCurveTo(t,r+a*.06,t+i,r-a*.03),e.stroke();}var ts=16;function Ml(e,t){if(typeof document<"u"){let r=document.createElement("canvas");return r.width=e,r.height=t,r}return new OffscreenCanvas(e,t)}var hr=class{texture;g;w;h;face;current="neutral";base="neutral";constructor(t,r=Et){this.face=t,this.w=Math.round(r[2]*ts),this.h=Math.round(r[3]*ts);let o=Ml(this.w,this.h),a=o.getContext("2d");if(!a)throw new Error("DrawnFace: no 2D canvas");this.g=a,this.texture=new B.CanvasTexture(o),this.texture.colorSpace=B.SRGBColorSpace,this.texture.anisotropy=4,this.paint("neutral");}paint(t,r){let o=r&&t!=="blink"&&t!=="talk"&&lr[r].includes(t)?r:t;o!=="blink"&&o!=="talk"?this.base=o:r&&(this.base=r),this.current=o,xa(this.g,this.w,this.h,this.face,o,this.base),this.texture.needsUpdate=true;}setFace(t){this.face=t,xa(this.g,this.w,this.h,this.face,this.current,this.base),this.texture.needsUpdate=true;}dispose(){this.texture.dispose();}};var Ll={idle:{},talk:{},walk:{speed:1.6},run:{speed:5.2},surprised:{emote:"shrug"},point:{emote:"point"},sit:{sitting:true},wave:{emote:"wave"},jump:{air:true},fall:{emote:"facepalm"},dance:{emote:"dance"},carry:{speed:1.4,emote:"carry"},jog:{speed:3.4}},Cl=Object.fromEntries(i.map(e=>[e,Ll[e]??(ca(e)?{emote:e}:{})])),Pl={handR:"handR",handL:"handL",head:"headTop"},vo=class{view;animator;input=no();seed;ownFace;drawn=null;pose="idle";jumpT=-1;constructor(t,r={}){this.ownFace=!r.facePainter,this.ownFace&&(this.drawn=rs(t)),this.view=new fo(t,{shadows:false,gloss:!!t?.face?.drawn,...r,facePainter:r.facePainter??this.drawn}),this.seed=r.seed??1,this.animator=this.newAnimator();}get group(){return this.view.group}get height(){return this.view.height}setSpec(t){let r=this.view.hash;if(this.view.setSpec(t),this.view.hash!==r&&(this.animator=this.newAnimator(),this.ownFace)){let o=this.drawn;this.drawn=rs(t),this.view.setFacePainter(this.drawn),o?.dispose();}}setEmotion(t){this.animator.setEmotion(t);}setViseme(t){this.input.viseme=t;}setPose(t){if(t===this.pose)return;this.pose=t;let r=Cl[t];if(this.input.speed=r.speed??0,this.input.sitting=!!r.sitting,r.emote)this.animator.playEmote(r.emote);else {let o=this.animator.emoting;o&&"loop"in $e[o]&&$e[o].loop&&this.animator.stopEmote();}r.air&&(this.jumpT=0,this.animator.trigger("jump"));}playEmote(t){this.animator.playEmote(t);}stopEmote(){this.animator.stopEmote();}trigger(t){if(t==="jump"){this.jumpT=0,this.animator.trigger("jump");return}this.animator.trigger(t);}setGround(t){this.view.setGround(t);}lookAt(t){this.view.lookAt(t);}reach(t,r){this.view.reach(t,r);}seat(t){this.view.seat(t);}fall(t){return this.view.fall(t)}hit(t,r){return this.view.hit(t,r??null)}getUp(){this.view.getUp();}stopRagdoll(){this.view.stopRagdoll();}takeRagdollDrift(){return this.view.takeRagdollDrift()}get ragdollDrift(){return this.view.ragdollDrift}get ragdoll(){return this.view.ragdollState}setColliders(t){this.view.setColliders(t);}attach(t,r){this.view.attach(Pl[t],r);}update(t){let r=this.input;this.jumpT>=0&&(this.jumpT+=t,r.onGround=this.jumpT>.6,r.vy=this.jumpT<.3?4:-4,r.onGround&&(this.jumpT=-1,r.vy=0,this.animator.trigger("land")));let o=this.animator.update(t,r);this.view.applyPose(o,{dt:t,plant:this.animator.plant,standing:this.animator.standing}),this.view.setExpression(this.animator.expression,this.animator.emotion);}dispose(){this.view.dispose(),this.drawn?.dispose();}newAnimator(){let t=this.view.spec,r=new wo(t.rig,t.style,this.view.expressions);return r.setRandom(a(this.seed)),r}};function rs(e){let t=e?.face?.drawn;if(!t)return null;try{let{face:r}=cr({face:{...t,brows:t.brows,browColor:"#2a1c14"}});return new hr({...r,emotion:"neutral"},e.face.rect)}catch{return null}}var zl=gr.map(e=>{let t=Ae[e],r=t.bones.map(a=>`${a.name}@[${a.pivot.join(",")}]`).join(" "),o=t.defaultParts.map(a=>`${a.bone} ${a.size.join("x")} at [${a.pos.join(",")}]`).join("; ");return `- "${e}" \u2014 ${t.hint}. Bones (name@pivot): ${r}. Default body: ${o}.`}).join(`
25
- `),pm=`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.
24
+ #endif`);}function oa(e,t,r){if(!e)return new B.MeshLambertMaterial(r);let o=new B.MeshStandardMaterial({...r,roughness:t,metalness:0});return o.onBeforeCompile=bo,o}function A0(e,t){if(e==="glass"){if(!t)return new B.MeshLambertMaterial({transparent:true,opacity:.5,depthWrite:false});let o=new B.MeshStandardMaterial({transparent:true,opacity:.42,depthWrite:false,roughness:.08,metalness:.2});return o.onBeforeCompile=bo,o}if(e==="glow"){let o={emissive:16777215,emissiveIntensity:.85};return t?new B.MeshStandardMaterial({...o,roughness:.6}):new B.MeshLambertMaterial(o)}if(!t)return new B.MeshLambertMaterial({alphaTest:.5});let r=new B.MeshStandardMaterial({alphaTest:.5,roughness:.28,metalness:.85});return r.onBeforeCompile=bo,r}var qn=5921370;function Un(e){let t=(r,o)=>r.replace(`#include <${o}>`,B.ShaderChunk[o].replace("varying vec2 vMapUv","centroid varying vec2 vMapUv"));e.vertexShader=t(e.vertexShader,"uv_pars_vertex"),e.fragmentShader=t(e.fragmentShader,"uv_pars_fragment");}function E0(e){Un(e),bo(e);}var yo=class{group=new B.Group;root=new B.Group;asset;spec;bones=new Map;byRole=new Map;meshes=[];material;decalMat;gloss;decal=null;expression=null;sockets=new Map;attached=new Map;label=null;shadows;layer;brightness=1;painter;prints=[];printMeshes=[];printMats=new Map;partMats=new Map;emotion;ik=null;ikGoals={ground:null,look:null,handR:null,handL:null,seat:null};toWorldM=new B.Matrix4;toModelM=new B.Matrix4;tmpV=new B.Vector3;ragdoll=null;ragWorld=null;ragPush=null;ragHit=null;ragRise=false;ragOn=false;drifted=new Map;snaps=[null,null];snapDt=0;constructor(t=Ot(),r={}){this.spec=t,this.shadows=r.shadows??true,this.layer=r.layer??0,this.painter=r.facePainter??null,this.gloss=r.gloss??false,this.material=oa(this.gloss,y0,{alphaTest:.5}),this.material.onBeforeCompile=this.gloss?E0:Un,this.decalMat=oa(this.gloss,Gn,{alphaTest:.5,polygonOffset:true,polygonOffsetFactor:-2,polygonOffsetUnits:-2}),this.group.add(this.root),this.asset=No(t),this.build(),r.name&&this.setName(r.name);}get height(){let t=this.asset.layout;return t.height*t.scale*Ht}get eye(){let t=this.asset.layout;return t.eye*t.scale*Ht}get expressions(){return Object.keys(this.asset.layout.face?.uv??{})}get hash(){return this.asset.layout.hash}setSpec(t){let r=No(t);if(r===this.asset){no(r);return}this.clear(),no(this.asset),this.asset=r,this.spec=t,this.build();}build(){let{layout:t,skinned:r,texture:o}=this.asset;this.material.map=o,this.material.needsUpdate=true,this.useFaceMap(),this.root.scale.setScalar(t.scale*Ht);let a=new Map(t.bones.map(p=>[p.name,p.pivot])),n=[],s=[];for(let p of t.bones){let h=new B.Bone;n.push(h),s.push(new B.Matrix4().makeTranslation(-p.pivot[0],-p.pivot[1],-p.pivot[2]));let m=p.parent?a.get(p.parent)??[0,0,0]:[0,0,0],d=[p.pivot[0]-m[0],p.pivot[1]-m[1],p.pivot[2]-m[2]];h.position.set(...d);let b={name:p.name,role:p.role,group:h,rest:d};this.bones.set(p.name,b);let u=this.byRole.get(p.role)??[];u.push(b),this.byRole.set(p.role,u);}for(let p of t.bones){let h=this.bones.get(p.name);((p.parent?this.bones.get(p.parent):void 0)?.group??this.root).add(h.group);}let l=new B.Skeleton(n,s),i=(p,h,m)=>{let d=new B.SkinnedMesh(p,h);d.bind(l,new B.Matrix4);let b=(r??p).boundingSphere;b&&(d.boundingSphere=new B.Sphere(b.center.clone(),b.radius*1.6)),d.castShadow=m&&this.shadows,d.receiveShadow=this.shadows,d.layers.set(this.layer),this.meshes.push(d),this.root.add(d);};r&&i(r,this.material,true);for(let[p,h]of this.asset.skinnedMats){let m=this.partMats.get(p);m||this.partMats.set(p,m=A0(p,this.gloss)),m.map=this.asset.texture,p==="glow"&&(m.emissiveMap=this.asset.texture),m.needsUpdate=true,i(h,m,p!=="glass");}let c=t.face;if(c){let p=new B.BufferGeometry,h=c.grid;if(h){p.setAttribute("position",new B.BufferAttribute(h.positions,3)),p.setAttribute("normal",new B.BufferAttribute(h.normals,3)),p.setAttribute("uv",new B.BufferAttribute(new Float32Array(h.t.length),2));let m=[],d=h.cols+1;for(let b=0;b<h.rows;b++)for(let u=0;u<h.cols;u++){let R=b*d+u;m.push(R,R+d+1,R+1,R,R+d,R+d+1);}p.setIndex(m);}else {p.setAttribute("position",new B.BufferAttribute(c.corners,3));let m=new Float32Array(12);for(let d=0;d<4;d++)m[d*3+2]=-1;p.setAttribute("normal",new B.BufferAttribute(m,3)),p.setAttribute("uv",new B.BufferAttribute(new Float32Array(8),2)),p.setIndex([0,2,1,0,3,2]);}this.decal=new B.Mesh(p,this.decalMat),this.decal.layers.set(this.layer),this.bones.get(c.bone)?.group.add(this.decal),this.expression=null,this.setExpression("neutral");}for(let p of t.sockets){let h=new B.Object3D;h.position.set(...p.at),h.scale.setScalar(1/(t.scale*Ht)),this.bones.get(p.bone)?.group.add(h),this.sockets.set(p.name,h);let m=this.attached.get(p.name);m&&h.add(m);}this.buildPrints(),this.placeLabel(),this.ik=new Cr(t),this.ragdoll=new Ir(t),this.ragWorld&&this.ragdoll.setWorld(this.ragWorld),this.ragOn=false,this.snaps=[null,null],this.setBrightness(this.brightness);}setPrints(t){this.prints=t??[],this.buildPrints(),this.setBrightness(this.brightness);}buildPrints(){for(let o of this.printMeshes)o.removeFromParent(),o.geometry.dispose();this.printMeshes=[];let t=new Set,r=new Map;for(let o of this.prints){let a=this.bones.get(o.bone),n=this.asset.layout.bones.find(p=>p.name===o.bone);if(!a||!n)continue;let s=this.printMats.get(o.texture);s||(s=oa(this.gloss,Gn,{map:o.texture,emissiveMap:o.texture,emissive:qn,transparent:true,alphaTest:.02,polygonOffset:true,polygonOffsetFactor:-2,polygonOffsetUnits:-2}),this.printMats.set(o.texture,s)),t.add(o.texture);let l=new B.PlaneGeometry(o.w,o.h);o.facing==="front"&&l.rotateY(Math.PI),l.translate(o.center[0]-n.pivot[0],o.center[1]-n.pivot[1],o.center[2]-n.pivot[2]);let i=`${o.bone}|${o.texture.uuid}`,c=r.get(i)??{node:a,mat:s,geos:[]};c.geos.push(l),r.set(i,c);}for(let{node:o,mat:a,geos:n}of r.values()){let s=n.length===1?n[0]:mergeGeometries(n)??n[0];if(s!==n[0])for(let i of n)i.dispose();let l=new B.Mesh(s,a);l.layers.set(this.layer),o.group.add(l),this.printMeshes.push(l);}for(let[o,a]of this.printMats)t.has(o)||(a.dispose(),this.printMats.delete(o));}clear(){for(let t of this.sockets.values())for(let r of [...t.children])t.remove(r);this.root.clear();for(let t of this.printMeshes)t.geometry.dispose();this.printMeshes=[],this.decal?.geometry.dispose(),this.decal=null;for(let t of this.meshes)t instanceof B.SkinnedMesh&&t.skeleton.dispose();this.meshes=[],this.bones=new Map,this.byRole=new Map,this.sockets.clear();}applyPose(t,r){let o=this.ragdoll?.drift;if(o){De(this.drifted,t);let i=oe(this.drifted,"root");for(let c=0;c<3;c++)i[I.px+c]=i[I.px+c]+o[c];t=this.drifted;}let a=this.ragdoll?.supported?this.ragdoll:null,n=false;a&&(this.ragHit||a.state==="flinch")&&r&&this.ik&&(t=this.solveIK(t,r),n=true);let s=a?this.driveRagdoll(t,r?.dt??0):null;s?t=s:(!n&&r&&this.ik&&(t=this.solveIK(t,r)),this.remember(t,r?.dt??0));let l=t.get("root");if(l){this.root.rotation.set(l[I.rx],l[I.ry],l[I.rz]);let i=this.asset.layout.scale*Ht;this.root.position.set(l[I.px]*i,l[I.py]*i,l[I.pz]*i);}else this.root.rotation.set(0,0,0),this.root.position.set(0,0,0);for(let[i,c]of this.byRole){let p=t.get(i);for(let h of c){let m=h.group;if(!p){m.rotation.set(0,0,0),m.position.set(...h.rest),m.scale.set(1,1,1);continue}m.rotation.set(p[I.rx],p[I.ry],p[I.rz]),m.position.set(h.rest[0]+p[I.px],h.rest[1]+p[I.py],h.rest[2]+p[I.pz]),m.scale.set(p[I.sx],p[I.sy],p[I.sz]);}}}fall(t=[0,0,0]){if(!this.ragdoll?.supported)return false;let r=Array.isArray(t)?[t[0],t[1],t[2]]:[t.x,t.y,t.z];return this.ragdoll.state==="fall"?this.ragdoll.push(r):this.ragPush=r,this.ragRise=false,true}hit(t,r=null){if(!this.ragdoll?.supported)return false;let o=Array.isArray(t)?[t[0],t[1],t[2]]:[t.x,t.y,t.z],a=r===null||typeof r=="string"?r:Array.isArray(r)?[r[0],r[1],r[2]]:[r.x,r.y,r.z];return this.ragdoll.state==="fall"||this.ragPush?this.fall(o):(this.ragHit={push:o,at:a},true)}getUp(){(this.ragdoll?.state==="fall"||this.ragPush)&&(this.ragRise=true);}stopRagdoll(){this.ragdoll?.stop(),this.ragPush=null,this.ragHit=null,this.ragRise=false;}takeRagdollDrift(){let t=this.ragdoll;if(!t||t.state!=="none")return null;let r=this.ragdollDrift;return r?(t.clearDrift(),this.ik?.reset(),this.snaps=[null,null],r):null}get ragdollDrift(){let t=this.ragdoll?.drift;if(!t)return null;let r=this.ragFrame();return ae(r.rot,[t[0]*r.scale,t[1]*r.scale,t[2]*r.scale])}get ragdollState(){return this.ragPush?"fall":this.ragHit?"flinch":this.ragdoll?.state??"none"}get ragdollResting(){return !!this.ragdoll?.resting}supportsRagdoll(){return !!this.ragdoll?.supported}setColliders(t){this.ragWorld=t,this.ragdoll&&this.ragdoll.setWorld(t??{floor:null});}ragFrame(){let t=this.asset.layout.scale*Ht;this.group.updateWorldMatrix(true,false);let r=new B.Vector3,o=new B.Quaternion,a=new B.Vector3;this.group.matrixWorld.decompose(r,o,a);let n=new B.Matrix4().makeRotationFromQuaternion(o).elements;return {rot:[n[0],n[4],n[8],n[1],n[5],n[9],n[2],n[6],n[10]],scale:t*a.x,origin:[r.x,r.y,r.z]}}remember(t,r){if(!this.ragdoll?.supported)return;let a=this.snaps[0]??{pose:new Map,frame:this.ragFrame()};De(a.pose,t),a.frame=this.ragFrame(),this.snaps=[this.snaps[1]??null,a],this.snapDt=r;}driveRagdoll(t,r){let o=this.ragdoll,a=this.ragFrame();if(this.ragPush){let l=this.snaps[1]??{pose:t,frame:a};o.start(this.snaps[1]?this.snaps[0]??null:null,l,this.snapDt,this.ragPush),this.ragPush=null;}this.ragHit&&(o.hit({pose:t,frame:a},this.ragHit.push,this.ragHit.at),this.ragHit=null),this.ragRise&&o.state==="fall"&&(o.getUp(a),this.ragRise=false);let n=o.state==="flinch",s=o.drive(t,r,a);return n||(s?this.ragOn=true:this.ragOn&&(this.ragOn=false,this.ik?.reset(),this.snaps=[null,null])),s}setGround(t){this.ikGoals.ground=t;}lookAt(t){this.ikGoals.look=t;}reach(t,r){this.ikGoals[t]=r;}seat(t){this.ikGoals.seat=t;}supportsIK(t){return !!this.ik?.supports(t)}resetIK(){this.ik?.reset();}solveIK(t,r){let o=this.ikGoals,a=this.asset.layout.scale*Ht;this.group.updateWorldMatrix(true,false),this.toWorldM.copy(this.group.matrixWorld).scale(this.tmpV.set(a,a,a)),this.toModelM.copy(this.toWorldM).invert();let n=this.tmpV,s=h=>(n.set(h[0],h[1],h[2]).applyMatrix4(this.toWorldM),[n.x,n.y,n.z]),l=h=>(n.set(h[0],h[1],h[2]).applyMatrix4(this.toModelM),[n.x,n.y,n.z]),i=h=>{if(!h)return null;let m;return h instanceof B.Vector3?m=h:h instanceof B.Object3D?m=h.getWorldPosition(new B.Vector3):m=h(),m?l([m.x,m.y,m.z]):null},c=o.ground,p=c?(h,m,d)=>{let[b,u,R]=s([h,m,d]),w=c(b,R,u);return w===null?null:l([b,w,R])[1]}:null;return this.ik.solve(t,{dt:r.dt,plant:r.plant,standing:r.standing,ground:p,look:i(o.look),handR:i(o.handR),handL:i(o.handL),seat:i(o.seat),toWorld:s,toModel:l})}setFacePainter(t){if(t===this.painter)return;this.painter=t,this.useFaceMap();let r=this.expression??"neutral";this.expression=null,this.setExpression(r);}useFaceMap(){let t=this.painter;this.decalMat.map=t?t.texture:this.asset.texture,this.decalMat.transparent=!!t,this.decalMat.alphaTest=t?.02:.5,this.decalMat.needsUpdate=true;}setExpression(t,r){if(t===this.expression&&(!this.painter||r===this.emotion)||!this.decal)return;let o=this.asset.layout.face?.uv,a=this.painter?[0,1,1,0]:o?.[t]??o?.neutral;if(!a)return;this.expression=t,this.emotion=r,this.painter?.paint(t,r);let[n,s,l,i]=a,c=this.decal.geometry.getAttribute("uv"),p=this.asset.layout.face?.grid;if(p)for(let h=0;h<c.count;h++)c.setXY(h,n+(l-n)*p.t[h*2],s+(i-s)*p.t[h*2+1]);else c.setXY(0,n,s),c.setXY(1,l,s),c.setXY(2,l,i),c.setXY(3,n,i);c.needsUpdate=true;}materials(){return [this.material,this.decalMat,...this.partMats.values()]}setBrightness(t){this.brightness=t,this.material.color.setScalar(t),this.decalMat.color.setScalar(t);for(let r of this.printMats.values())r.color.setScalar(t);for(let r of this.partMats.values())r.color.setScalar(t);}setEmissive(t){if(this.material.emissive.getHex()!==t){this.material.emissive.setHex(t),this.decalMat.emissive.setHex(t);for(let r of this.printMats.values())r.emissive.setHex(t||qn);for(let[r,o]of this.partMats)r!=="glow"&&o.emissive.setHex(t);}}setShadows(t){if(t!==this.shadows){this.shadows=t;for(let r of this.meshes)r.castShadow=t&&!r.material.transparent;}}attach(t,r){let o=this.attached.get(t);if(o!==r){if(o&&o.removeFromParent(),!r){this.attached.delete(t);return}this.attached.set(t,r),this.sockets.get(t)?.add(r);}}attachedAt(t){return this.attached.get(t)??null}setName(t){this.label&&Uo(this.label),this.label=t?hn(t):null,this.label&&this.group.add(this.label),this.placeLabel();}setLabelVisible(t){this.label&&(this.label.visible=t);}placeLabel(){this.label&&(this.label.position.y=this.height+.25);}forEachMesh(t){for(let r of this.meshes)t(r);this.decal&&t(this.decal);for(let r of this.printMeshes)t(r);}dispose(){this.group.removeFromParent();for(let t of this.attached.values())t.removeFromParent();this.attached.clear(),this.clear(),this.label&&Uo(this.label),this.label=null,this.material.dispose(),this.decalMat.dispose();for(let t of this.printMats.values())t.dispose();this.printMats.clear();for(let t of this.partMats.values())t.dispose();this.partMats.clear(),no(this.asset);}};var go=new Map,aa=new Set;function op(e){let t=rr(e);if(!go.has(t)){go.set(t,e);for(let r of aa)r(t);}return t}function ap(e){return typeof e=="string"?go.get(e):void 0}function np(e){let t={};for(let r of e){let o=go.get(r);o&&(t[r]=o);}return t}function sp(e){return aa.add(e),()=>aa.delete(e)}var S0=["#b08a62","#8a6a4a","#c8a878","#9a9a92","#7a5c44"],T0=["#f1c9a5","#e6b892","#d9a982","#c08e68","#a0704c","#7a5238"],M0=["#6b4a2f","#4a3424","#8a5a3a","#c27a48","#d8b878","#2e2622","#a07850","#9a9690"],L0=["#a7bea9","#e6e0cc","#d9c9a3","#b9a083","#a9b8c4","#c8b4a0","#9fb0a0","#d8d2c4","#b98f74","#8fa3b5"],C0=["#8c9ca6","#a9b8b4","#8a8e94","#9fb3ad","#7d8a8f","#b0a58f"],P0=["#d9c9a3","#c8b48a","#a08a6a","#e6e0cc"];function mp(e,t="",r=""){let o=a(b("npc:"+e+"|"+t)),a$1=l=>l[Math.floor(o()*l.length)],n=Go({top:a$1(cn),bottom:a$1(pn),shoes:a$1(mn),hair:a$1(["short","short","long","curly"]),hat:o()<.2,colors:{skin:a$1(T0),hair:a$1(M0),shirt:a$1(L0),pants:a$1(C0),boots:a$1(S0),hat:a$1(P0)}});n.name=e.slice(0,40),n.description=[t,r].filter(Boolean).join(" \u2014 ").slice(0,300),n.style={walk:a$1(["normal","normal","bouncy","heavy","sneaky"]),idle:a$1(["calm","calm","fidgety","proud"]),energy:Math.round(o()*10)/10},n.tags=["npc",...t?[t.slice(0,24)]:[]];let s=Ye(n);return s.ok?s.spec:Ot()}var kt=([e,t,r])=>"#"+[e,t,r].map(o=>Math.round(o).toString(16).padStart(2,"0")).join("");function z0(e){if(!e.length)return null;let t=r=>{let o=e.map(a=>a[r]).sort((a,n)=>a-n);return o[o.length>>1]};return [t(0),t(1),t(2)]}function I0(e,t){let{width:r,height:o,data:a}=e,n=(w,A)=>{let k=(A*r+w)*4;return [a[k],a[k+1],a[k+2]]},s=[n(0,0),n(r-1,0),n(0,o-1),n(r-1,o-1)],l=[0,1,2].map(w=>s.reduce((A,k)=>A+k[w],0)/4),i=w=>Math.abs(w[0]-l[0])+Math.abs(w[1]-l[1])+Math.abs(w[2]-l[2])>60,c=r,p=-1,h=o,m=-1;for(let w=0;w<o;w+=2)for(let A=0;A<r;A+=2)i(n(A,w))&&(c=Math.min(c,A),p=Math.max(p,A),h=Math.min(h,w),m=Math.max(m,w));p<0&&(c=0,p=r-1,h=0,m=o-1);let d=m-h+1,b=p-c+1,u=c+Math.floor(b*.3),R=c+Math.ceil(b*.7);return t.map(([w,A])=>{let k=[];for(let x=h+Math.floor(d*w);x<h+Math.ceil(d*A);x++)for(let f=u;f<R;f++){if(x<0||x>=o||f<0||f>=r)continue;let S=n(f,x);i(S)&&k.push(S);}return z0(k)})}var _0=[[0,.06],[.1,.22],[.3,.52],[.6,.86],[.92,1]];function bp(e,t="humanoid",r=oo()){let[o,a,n,s,l]=I0(e,_0);if(t==="humanoid"){let c=JSON.parse(JSON.stringify(qo));c.palette=jo(c.palette,{...o?{hair:kt(o)}:{},...a?{skin:kt(a)}:{},...n?{shirt:kt(n)}:{},...s?{pants:kt(s)}:{},...l?{boots:kt(l)}:{}}),c.name=r,c.tags=[];let p=Ye(c);return p.ok?p.spec:Ot()}let i=Ye({name:r,rig:t,palette:{s:kt(a??o??[198,156,124]),t:kt(n??[58,143,214]),p:kt(s??l??[44,62,107]),w:"#f4f4f4",b:"#1d1d21"},textures:{f_neutral:{w:4,h:2,rows:["wbbw","...."]},f_blink:{w:4,h:2,rows:["bbbb","...."]}},face:{rect:t==="blob"?[4,4,4,2]:t==="flyer"?[0,1,4,2]:[2,2,4,2],expressions:{neutral:"f_neutral",blink:"f_blink"}}});return i.ok?i.spec:Ot()}var O0={normal:{},bouncy:{amp:.9,arm:.8,bob:1.6,tempo:1.1,sway:.04},heavy:{amp:.6,arm:.4,bob:.6,tempo:.8,sway:.12},sneaky:{amp:.5,arm:.3,tempo:1.2},robotic:{amp:.7,arm:.7,quant:true},swagger:{amp:.7,arm:.5,bob:.8,tempo:.85,sway:.1,swagger:.22},skip:{amp:.9,arm:.9,bob:1.2,tempo:1.05,skip:1},ninja:{amp:.6,arm:.2,tempo:1.25,crouch:2.2},zombie:{amp:.45,arm:.05,tempo:.6,sway:.14,reach:1.45},catwalk:{amp:.7,arm:.45,tempo:.95,sway:.08,cross:.12}},V0={calm:{},fidgety:{fidget:1,breath:1.3},proud:{chest:.08,breath:.8},cool:{pose:"hips",chest:.04,breath:.8},shy:{pose:"shy",breath:1.1},ready:{pose:"ready",breath:1.4},bored:{pose:"bored",breath:.7,fidget:.4}};function na(e){let t={amp:.8,arm:.6,bob:0,tempo:1,sway:0,quant:false,breath:1,fidget:0,chest:0,reach:0,crouch:0,skip:0,cross:0,swagger:0,pose:"none",...O0[e.walk],...V0[e.idle]};return t.tempo*=.8+.4*e.energy,t.amp*=.85+.3*e.energy,t}function jt(e,t=0){let r=Math.sin(e.phase+t);return e.style.quant?Math.max(-1,Math.min(1,r*3)):r}function sa(e,t,r){let o=jt(t)*r;y(e,"legL","rx",o),y(e,"legR","rx",-o),y(e,"legFL","rx",o),y(e,"legBR","rx",o),y(e,"legFR","rx",-o),y(e,"legBL","rx",-o);}function ia(e,t,r){let o=jt(t)*r;y(e,"armL","rx",-o),y(e,"armR","rx",o);}function la(e,t,r,o){let a=jt(t),n=Math.max(0,Math.cos(t.phase))*Math.max(0,-a+.3),s=Math.max(0,-Math.cos(t.phase))*Math.max(0,a+.3);y(e,"shinL","rx",-r*(.15+n)),y(e,"shinR","rx",-r*(.15+s)),y(e,"foreArmL","rx",o*(.6+.4*Math.max(0,-a))),y(e,"foreArmR","rx",o*(.6+.4*Math.max(0,a)));}var F0=(e,t)=>{let r=Math.sin(t.clock*2)*t.style.breath;y(e,"armL","rz",-0.04-.03*r),y(e,"armR","rz",.04+.03*r),y(e,"foreArmL","rx",.12+.02*r),y(e,"foreArmR","rx",.12+.02*r),y(e,"head","rx",.03*Math.sin(t.clock*1.7)+t.style.chest),y(e,"body","rx",t.style.chest*-0.5),t.style.fidget&&(y(e,"head","ry",.35*Math.sin(t.clock*.7)*Math.sin(t.clock*.31)),y(e,"root","ry",.05*Math.sin(t.clock*.9))),y(e,"body","sy",1+.04*Math.sin(t.clock*3)),D0(e,t);};function D0(e,t){let r=Math.sin(t.clock*2);switch(t.style.pose){case "hips":y(e,"armL","rz",-0.75),y(e,"armR","rz",.75),y(e,"foreArmL","rx",.2),y(e,"foreArmR","rx",.2),y(e,"foreArmL","rz",1.5),y(e,"foreArmR","rz",-1.5),y(e,"legL","rz",-0.06),y(e,"legR","rz",.06);break;case "shy":y(e,"armL","rx",-0.35),y(e,"armR","rx",-0.35),y(e,"foreArmL","rx",.5),y(e,"foreArmR","rx",.5),y(e,"head","rx",-0.15+.03*r),y(e,"legR","rx",.15+.08*Math.sin(t.clock*1.3)),y(e,"shinR","rx",-0.3);break;case "ready":y(e,"legL","rz",-0.16),y(e,"legR","rz",.16),y(e,"legL","rx",.25),y(e,"legR","rx",-0.15),y(e,"shinL","rx",-0.35),y(e,"shinR","rx",-0.25),y(e,"armL","rx",.9),y(e,"armR","rx",.7),y(e,"foreArmL","rx",1.4),y(e,"foreArmR","rx",1.5),y(e,"root","py",-0.6+.3*Math.abs(Math.sin(t.clock*3.2)));break;case "bored":y(e,"root","rz",.04),y(e,"legL","rz",-0.04),y(e,"shinR","rx",-0.25),y(e,"legR","rx",.12),y(e,"head","rz",.12+.03*r),y(e,"body","rx",-0.06);break;}}var B0=(e,t)=>{sa(e,t,t.style.amp),ia(e,t,t.style.arm),la(e,t,t.style.amp*1.1,.35);let r=t.style.bob*Math.abs(Math.cos(t.phase));y(e,"root","py",r),y(e,"body","rz",t.style.sway*jt(t)),N0(e,t);};function N0(e,t){let r=t.style;if(r.reach&&(y(e,"armL","rx",r.reach+.05*Math.sin(t.phase)),y(e,"armR","rx",r.reach-.05*Math.sin(t.phase)),y(e,"foreArmL","rx",.1),y(e,"foreArmR","rx",.1),y(e,"head","rz",.15*Math.sin(t.phase*.5))),r.crouch&&(y(e,"root","py",-r.crouch),y(e,"body","rx",-0.3),y(e,"head","rx",.25),de(e,"shinL","rx",-0.5),de(e,"shinR","rx",-0.5),de(e,"legL","rx",.35),de(e,"legR","rx",.35),y(e,"armL","rx",-0.9),y(e,"armR","rx",-0.9)),r.skip){let o=Math.max(0,Math.sin(t.phase));de(e,"root","py",2.2*r.skip*o*o),de(e,"armL","rz",-0.3*o),de(e,"armR","rz",.3*o);}r.cross&&(y(e,"legL","rz",r.cross),y(e,"legR","rz",-r.cross),y(e,"root","ry",.12*jt(t))),r.swagger&&(y(e,"body","ry",r.swagger*jt(t)),y(e,"head","rz",-0.5*r.swagger*jt(t)),y(e,"armL","rz",-0.2),y(e,"armR","rz",.2));}var H0=(e,t)=>{sa(e,t,t.style.amp*1.3),ia(e,t,t.style.arm*1.6),la(e,t,t.style.amp*1.6,1.1),y(e,"body","rx",-0.18),y(e,"head","rx",.18),y(e,"root","py",(.8+t.style.bob)*Math.abs(Math.cos(t.phase)));},j0=(e,t)=>{sa(e,t,t.style.amp*.5*Math.min(1,t.input.speed)),ia(e,t,t.style.arm*.4*Math.min(1,t.input.speed)),y(e,"body","rx",-0.45),y(e,"head","rx",.45),de(e,"armL","rx",.25),de(e,"armR","rx",.25),la(e,t,.9,.6),y(e,"root","py",-1.5);},G0=(e,t)=>{y(e,"root","rx",-1.3),y(e,"head","rx",1),y(e,"armL","rx",Math.PI-.5+.5*Math.sin(t.t*3)),y(e,"armR","rx",Math.PI-.5+.5*Math.sin(t.t*3+Math.PI)),y(e,"legL","rx",.3*Math.sin(t.t*8)),y(e,"legR","rx",-0.3*Math.sin(t.t*8));},q0=(e,t)=>{y(e,"legL","rx",.15),y(e,"legR","rx",.1),y(e,"armL","rz",-0.15),y(e,"armR","rz",.15),y(e,"root","py",.6*Math.sin(t.t*2));},U0=e=>{y(e,"root","rx",-1.35),y(e,"head","rx",1.1),y(e,"armL","rz",-1.3),y(e,"armR","rz",1.3);},K0=(e,t)=>{let r=.15*Math.sin(t.t*10);y(e,"armL","rz",-0.6-r),y(e,"armR","rz",.6+r),y(e,"legL","rx",.25),y(e,"legR","rx",-0.25),y(e,"shinL","rx",-0.5),y(e,"shinR","rx",-0.3),y(e,"foreArmL","rx",.4),y(e,"foreArmR","rx",.4);},Y0=e=>{y(e,"legL","rx",1.45),y(e,"legR","rx",1.45),y(e,"legL","ry",.1),y(e,"legR","ry",-0.1),y(e,"shinL","rx",-1.45),y(e,"shinR","rx",-1.45),y(e,"root","py",-10),y(e,"body","rx",.4),y(e,"legBL","rx",1.2),y(e,"legBR","rx",1.2);},W0=e=>{y(e,"legL","rx",1.4),y(e,"legR","rx",1.4),y(e,"legL","rz",-0.3),y(e,"legR","rz",.3),y(e,"armL","rx",.45),y(e,"armR","rx",.45),y(e,"shinL","rx",-1.2),y(e,"shinR","rx",-1.2),y(e,"foreArmL","rx",.5),y(e,"foreArmR","rx",.5);},$0=e=>{y(e,"root","rx",Math.PI/2),y(e,"root","py",2);},X0=e=>{y(e,"root","rz",Math.PI/2),y(e,"root","py",2);},J0=(e,t)=>{let r=Math.sin(t.phase*.5);y(e,"root","py",6*Math.max(0,r));let o=r<0?.2*-r:0;y(e,"body","sy",1-o+.1*Math.max(0,r)),y(e,"body","sx",1+o*.6),y(e,"body","sz",1+o*.6);},Q0=(e,t)=>{let r=Math.min(t.input.speed,8),o=Math.sin(t.clock*(3+r*1.2)),a=.25+r*.04;y(e,"tail","ry",a*1.6*o),y(e,"body","ry",-a*.35*o),y(e,"root","py",.4*Math.sin(t.clock*1.6));},Z0=(e,t)=>{let r=Math.sin(Math.PI*t.k);y(e,"armR","rx",1.9*r),y(e,"armR","ry",.3*r),y(e,"body","ry",-0.3*r),y(e,"foreArmR","rx",.6*r);},el=(e,t)=>{let r=Math.sin(Math.PI*t.k);y(e,"armR","rx",.9*r);},tl=(e,t)=>{let r=t.k<.4?-1.5*(t.k/.4):-1.5+3.5*((t.k-.4)/.6);y(e,"armR","rx",t.k>.9?r*(1-t.k)*10:r);},rl=(e,t)=>{let r=Math.sin(Math.PI*t.k)*(1-t.k);y(e,"armR","rx",.35*r),y(e,"foreArmR","rx",.5*r),y(e,"armL","rx",.2*r),y(e,"body","rx",-0.05*r);},ol=(e,t)=>{let r=t.k<.35?t.k/.35:Math.max(0,1-(t.k-.35)/.65);y(e,"armR","rx",1.55*r),y(e,"armR","ry",-0.15*r),y(e,"foreArmR","rx",.2*(1-r)),y(e,"body","ry",.35*r),y(e,"armL","rx",.6),y(e,"foreArmL","rx",1.2);},al=e=>{y(e,"armR","rx",1.5),y(e,"foreArmR","rx",.05),y(e,"armL","rx",1.3),y(e,"armL","ry",-0.45),y(e,"foreArmL","rx",.3);},nl=e=>{y(e,"armR","rx",1.25),y(e,"armR","ry",.25),y(e,"foreArmR","rx",.9),y(e,"armL","rx",1.45),y(e,"armL","ry",-0.35),y(e,"foreArmL","rx",.25),y(e,"body","ry",.25),y(e,"head","ry",-0.2);},sl=(e,t)=>{let r=Math.sin(Math.PI*t.k);y(e,"body","rx",.15*r),y(e,"head","rx",.2*r),y(e,"root","rz",.05*r);},il=(e,t)=>{let r=Math.sin(Math.PI*t.k);y(e,"root","py",-1.5*r),y(e,"legL","rx",.2*r),y(e,"legR","rx",.2*r),y(e,"shinL","rx",-0.5*r),y(e,"shinR","rx",-0.5*r),y(e,"body","sy",1-.2*r),y(e,"body","sx",1+.12*r),y(e,"body","sz",1+.12*r);},ll=(e,t)=>{y(e,"armR","rx",1.3+.1*Math.sin(t.t*16)),y(e,"armR","ry",-0.5),y(e,"head","rx",-0.1+.08*Math.sin(t.t*16));},cl=e=>{y(e,"armR","rx",2),y(e,"armR","ry",-0.4),y(e,"head","rx",.35);},pl=e=>{y(e,"armR","rx",1.57),y(e,"armR","ry",-0.1),y(e,"armL","rx",1.57),y(e,"armL","ry",.35);},ml=e=>{y(e,"armL","rx",.9),y(e,"armL","ry",-0.6);},_r={idle:F0,walk:B0,run:H0,sneak:j0,swim:G0,fly:q0,glide:U0,fall:K0,sit:Y0,ride:W0,sleep:$0,dead:X0,hop:J0,swing:Z0,place:el,throw:tl,shoot:rl,punch:ol,aimPistol:al,aimRifle:nl,hurt:sl,land:il,eat:ll,drink:cl,draw:pl,block:ml,fin:Q0},Kn={blob:{walk:"hop",run:"hop",sneak:"hop"},swimmer:{idle:"fin",walk:"fin",run:"fin",sneak:"fin",swim:"fin",fall:"fin"}},Yn={swing:.3,place:.2,throw:.45,shoot:.16,punch:.28,hurt:.3,land:.22};function ie(e,t,r=.3){let o={};for(let[a,n]of Object.entries(t))o[a]=[[0,0],[r,n],[Math.max(r,e-r),n],[e,0]];return o}function N(e,t){let r={};for(let[o,a]of Object.entries(t))r[o]=[[0,a],[e,a]];return r}function E(e,t,r,o,a,n=0,s=false){let l=Math.max(8,Math.round(a*8)),i=[];for(let c=0;c<=l;c++){let p=c/l,h=s?Math.min(1,p/.15,(1-p)/.15):1;i.push([e*p,(r+o*Math.sin(Math.PI*2*a*p+n))*h]);}return {[t]:i}}function vt(e,t){return [[0,t],[e,t]]}function P(e,t){return t.map(([r,o])=>[e*r,o])}function D(...e){return Object.assign({},...e)}var Wn={"legL.rx":1.5,"legR.rx":1.5,"shinL.rx":-1.5,"shinR.rx":-1.5,"root.py":-6.2},hl=4.1,$n={"legL.rx":1.45,"legR.rx":1.45,"legL.ry":.75,"legR.ry":-0.75,"shinL.rx":-2.5,"shinR.rx":-2.5,"shinL.ry":-0.6,"shinR.ry":.6,"root.py":-10.2},Or={"root.rx":Math.PI/2,"root.py":2.3,"root.pz":0};var be=Math.PI,Qn={"armR.rx":.55,"foreArmR.rx":1.35,"armR.rz":-0.15},Vr={"armL.rx":.55,"foreArmL.rx":1.35,"armL.rz":.15},Xn={...Qn,...Vr},Jn={"armL.rx":.75,"armR.rx":.75,"foreArmL.rx":.85,"foreArmR.rx":.85,"head.rx":-0.2},Se=(e,t)=>N(e,{...Wn,...t}),xo=(e,t,r,o)=>D(E(e,"legL.rx",0,r,t),E(e,"legR.rx",0,r,t,be),E(e,"shinL.rx",-o,o,t,-be/2),E(e,"shinR.rx",-o,o,t,be/2)),ca={tiptoe:{label:"\u041D\u0430 \u0446\u044B\u043F\u043E\u0447\u043A\u0430\u0445",en:"Tiptoe",duration:1.6,loop:true,tracks:D(xo(1.6,2,.35,.35),N(1.6,{"root.py":.6,"body.rx":-0.12,"armL.rx":.6,"armR.rx":.6,"foreArmL.rx":1.4,"foreArmR.rx":1.4}),E(1.6,"head.ry",0,.25,1))},limp:{label:"\u041A\u043E\u0432\u044B\u043B\u044F\u0442\u044C",en:"Limp",duration:1.6,loop:true,emotion:"hurt",tracks:{"legL.rx":P(1.6,[[0,.4],[.5,-0.3],[1,.4]]),"legR.rx":P(1.6,[[0,-0.15],[.5,.15],[1,-0.15]]),"shinL.rx":P(1.6,[[0,-0.2],[.25,-0.9],[.5,-0.1],[1,-0.2]]),"root.py":P(1.6,[[0,0],[.5,-1],[1,0]]),"body.rz":P(1.6,[[0,.04],[.5,-0.1],[1,.04]]),"armR.rz":vt(1.6,.2)}},crawl:{label:"\u041F\u043E\u043B\u0437\u0442\u0438",en:"Crawl",duration:1.6,loop:true,tracks:D(N(1.6,{"root.rx":-1.35,"root.py":3.2,"head.rx":1.1,"legL.rx":1.3,"legR.rx":1.3,"shinL.rx":-1.4,"shinR.rx":-1.4}),E(1.6,"armL.rx",2,.4,2),E(1.6,"armR.rx",2,.4,2,be),E(1.6,"legL.ry",0,.15,2,be),E(1.6,"legR.ry",0,.15,2))},climb:{label:"\u041B\u0435\u0437\u0442\u044C \u043F\u043E \u043B\u0435\u0441\u0442\u043D\u0438\u0446\u0435",en:"Climb",duration:1.6,loop:true,tracks:D(E(1.6,"armL.rx",2.6,.4,1),E(1.6,"armR.rx",2.6,.4,1,be),E(1.6,"legL.rx",.7,.6,1,be),E(1.6,"legR.rx",.7,.6,1),E(1.6,"shinL.rx",-1,.6,1,be),E(1.6,"shinR.rx",-1,.6,1),N(1.6,{"head.rx":.4,"foreArmL.rx":.5,"foreArmR.rx":.5}))},jog:{label:"\u0411\u0435\u0433 \u0442\u0440\u0443\u0441\u0446\u043E\u0439",en:"Jog",duration:.9,loop:true,tracks:D(xo(.9,1,.6,.6),E(.9,"armL.rx",0,.6,1,be),E(.9,"armR.rx",0,.6,1),N(.9,{"foreArmL.rx":1.4,"foreArmR.rx":1.4,"body.rx":-0.1}),E(.9,"root.py",.8,.8,2))},carry:{label:"\u041D\u0435\u0441\u0442\u0438 \u043A\u043E\u0440\u043E\u0431\u043A\u0443",en:"Carry",duration:1,loop:true,layer:"upper",tracks:N(1,{"armL.rx":.9,"armR.rx":.9,"foreArmL.rx":.7,"foreArmR.rx":.7,"armL.rz":-0.25,"armR.rz":.25,"body.rx":.08})},push:{label:"\u0422\u043E\u043B\u043A\u0430\u0442\u044C",en:"Push",duration:1.4,loop:true,emotion:"determined",tracks:D(xo(1.4,1,.3,.5),N(1.4,{"body.rx":-0.45,"head.rx":.4,"armL.rx":1.4,"armR.rx":1.4,"foreArmL.rx":.5,"foreArmR.rx":.5,"root.py":-0.8}))},pull:{label:"\u0422\u044F\u043D\u0443\u0442\u044C",en:"Pull",duration:1.4,loop:true,emotion:"determined",tracks:D(xo(1.4,1,.25,.4),N(1.4,{"body.rx":.25,"armL.rx":1.2,"armR.rx":1.2,"foreArmL.rx":.3,"foreArmR.rx":.3,"root.py":-0.6}))},sitChair:{label:"\u0421\u0438\u0434\u0435\u0442\u044C \u043D\u0430 \u0441\u0442\u0443\u043B\u0435",en:"Sit on a chair",seat:true,duration:2,loop:true,tracks:D(Se(2,{"armL.rx":.4,"armR.rx":.4,"foreArmL.rx":.5,"foreArmR.rx":.5}),E(2,"head.rz",0,.04,1))},sitFloor:{label:"\u041F\u043E-\u0442\u0443\u0440\u0435\u0446\u043A\u0438",en:"Sit cross-legged",duration:2,loop:true,tracks:N(2,{...$n,"armL.rx":.5,"armR.rx":.5,"foreArmL.rx":.6,"foreArmR.rx":.6})},sitKneel:{label:"\u041D\u0430 \u043A\u043E\u043B\u0435\u043D\u044F\u0445",en:"Kneel",duration:2,loop:true,tracks:N(2,{"shinL.rx":-1.5,"shinR.rx":-1.5,"root.py":-6.1,"armL.rx":.2,"armR.rx":.2})},sitEdge:{label:"\u041D\u0430 \u043A\u0440\u0430\u044E",en:"Sit on the edge",seat:true,duration:2.4,loop:true,tracks:D(Se(2.4,{"armL.rz":-0.3,"armR.rz":.3,"armL.rx":-0.2,"armR.rx":-0.2}),E(2.4,"shinL.rx",-1.2,.3,2),E(2.4,"shinR.rx",-1.2,.3,2,be))},sitLounge:{label:"\u0420\u0430\u0437\u0432\u0430\u043B\u0438\u0432\u0448\u0438\u0441\u044C",en:"Lounge",seat:true,duration:2,loop:true,emotion:"cool",tracks:Se(2,{"body.rx":.35,"head.rx":-0.2,"legL.rx":1.2,"shinL.rx":-0.6,"armL.rz":-2.6,"armR.rz":2.6,"foreArmL.rz":1.8,"foreArmR.rz":-1.8,"root.py":-6.8})},sitHug:{label:"\u041E\u0431\u0445\u0432\u0430\u0442\u0438\u0432 \u043A\u043E\u043B\u0435\u043D\u0438",en:"Hug knees",duration:2,loop:true,emotion:"sad",tracks:N(2,{"legL.rx":2.4,"legR.rx":2.4,"shinL.rx":-2.6,"shinR.rx":-2.6,"root.py":-10.2,"armL.rx":1,"armR.rx":1,"foreArmL.rx":.9,"foreArmR.rx":.9,"head.rx":-0.15,"body.rx":-0.15})},squat:{label:"\u041D\u0430 \u043A\u043E\u0440\u0442\u043E\u0447\u043A\u0430\u0445",en:"Squat",duration:2,loop:true,tracks:N(2,{"legL.rx":2,"legR.rx":2,"legL.rz":-0.2,"legR.rz":.2,"shinL.rx":-2.5,"shinR.rx":-2.5,"root.py":-7,"body.rx":-0.35,"head.rx":.3,"armL.rx":.7,"armR.rx":.7,"foreArmL.rx":.6,"foreArmR.rx":.6})},sitEat:{label:"\u0415\u0441\u0442\u044C \u0441\u0438\u0434\u044F",en:"Eat (seated)",seat:true,duration:1.2,loop:true,tracks:D(Se(1.2,{...Vr,"armR.rx":.9}),E(1.2,"foreArmR.rx",1.5,.45,1),E(1.2,"head.rx",-0.1,.06,2))},sitDrink:{label:"\u041F\u0438\u0442\u044C \u0441\u0438\u0434\u044F",en:"Drink (seated)",seat:true,duration:2.4,loop:true,tracks:D(Se(2.4,{}),{"armR.rx":P(2.4,[[0,.6],[.3,1.2],[.6,1.2],[1,.6]]),"foreArmR.rx":P(2.4,[[0,1.3],[.3,2],[.6,2],[1,1.3]]),"head.rx":P(2.4,[[0,0],[.3,.3],[.6,.3],[1,0]])})},sitRead:{label:"\u0427\u0438\u0442\u0430\u0442\u044C \u0441\u0438\u0434\u044F",en:"Read (seated)",seat:true,duration:3,loop:true,tracks:D(Se(3,{...Xn,"head.rx":-0.3}),E(3,"head.ry",0,.08,1))},sitLaptop:{label:"\u0417\u0430 \u043D\u043E\u0443\u0442\u0431\u0443\u043A\u043E\u043C",en:"Laptop",seat:true,duration:1.2,loop:true,tracks:D(Se(1.2,Jn),E(1.2,"foreArmL.rx",.85,.08,4),E(1.2,"foreArmR.rx",.85,.08,4,be))},sitWrite:{label:"\u041F\u0438\u0441\u0430\u0442\u044C \u0441\u0438\u0434\u044F",en:"Write (seated)",seat:true,duration:1.6,loop:true,tracks:D(Se(1.6,{...Jn,"armL.rx":.6}),E(1.6,"foreArmR.rz",0,.15,3),E(1.6,"head.rz",0,.05,1))},sitTalk:{label:"\u0413\u043E\u0432\u043E\u0440\u0438\u0442\u044C \u0441\u0438\u0434\u044F",en:"Talk (seated)",seat:true,duration:2.4,loop:true,tracks:D(Se(2.4,{"armL.rx":.6,"foreArmL.rx":1}),E(2.4,"armR.rx",.8,.3,2),E(2.4,"foreArmR.rx",1.2,.4,3),E(2.4,"head.rz",0,.08,2))},sitLaugh:{label:"\u0421\u043C\u0435\u044F\u0442\u044C\u0441\u044F \u0441\u0438\u0434\u044F",en:"Laugh (seated)",seat:true,duration:1.6,loop:true,emotion:"happy",tracks:D(Se(1.6,{"armL.rx":.5,"armR.rx":.5,"foreArmL.rx":1,"foreArmR.rx":1}),E(1.6,"body.rx",.12,.1,4),E(1.6,"head.rx",.2,.1,4))},sitCry:{label:"\u041F\u043B\u0430\u043A\u0430\u0442\u044C \u0441\u0438\u0434\u044F",en:"Cry (seated)",seat:true,duration:2.4,loop:true,emotion:"crying",tracks:D(Se(2.4,{"armL.rx":2.2,"armR.rx":2.2,"foreArmL.rx":1.5,"foreArmR.rx":1.5,"head.rx":-0.45,"body.rx":-0.25}),E(2.4,"body.sy",1,.02,4))},sitDoze:{label:"\u041A\u043B\u0435\u0432\u0430\u0442\u044C \u043D\u043E\u0441\u043E\u043C",en:"Doze",seat:true,duration:3,loop:true,emotion:"sleepy",tracks:D(Se(3,{"armL.rx":.3,"armR.rx":.3}),{"head.rx":P(3,[[0,-0.15],[.6,-0.6],[.7,-0.1],[1,-0.15]])})},sitDrive:{label:"\u0420\u0443\u043B\u0438\u0442\u044C",en:"Drive",seat:true,duration:2.4,loop:true,tracks:D(Se(2.4,{"armL.rx":1.2,"armR.rx":1.2,"foreArmL.rx":.5,"foreArmR.rx":.5}),E(2.4,"armL.rz",.2,.2,1),E(2.4,"armR.rz",-0.2,.2,1),E(2.4,"body.rz",0,.05,1,be))},sitGamepad:{label:"\u0418\u0433\u0440\u0430\u0442\u044C \u0441 \u0433\u0435\u0439\u043C\u043F\u0430\u0434\u043E\u043C",en:"Gamepad",seat:true,duration:1.2,loop:true,emotion:"determined",tracks:D(Se(1.2,{"armL.rx":.8,"armR.rx":.8,"foreArmL.rx":1.2,"foreArmR.rx":1.2,"armL.rz":.25,"armR.rz":-0.25,"body.rx":-0.15,"head.rx":-0.05}),E(1.2,"foreArmL.rz",0,.08,4),E(1.2,"body.rz",0,.05,1))},sitClap:{label:"\u0425\u043B\u043E\u043F\u0430\u0442\u044C \u0441\u0438\u0434\u044F",en:"Clap (seated)",seat:true,duration:1.2,loop:true,emotion:"happy",tracks:D(Se(1.2,{"armL.rx":1.1,"armR.rx":1.1,"foreArmL.rx":.6,"foreArmR.rx":.6}),E(1.2,"foreArmL.rz",.55,.35,4),E(1.2,"foreArmR.rz",-0.55,-0.35,4))},lieBack:{label:"\u041B\u0435\u0436\u0430\u0442\u044C \u043D\u0430 \u0441\u043F\u0438\u043D\u0435",en:"Lie on the back",duration:3,loop:true,tracks:D(N(3,{...Or,"armL.rz":-2.6,"armR.rz":2.6,"foreArmL.rz":1.6,"foreArmR.rz":-1.6,"legL.rx":.1}),E(3,"body.sy",1,.02,1))},lieSide:{label:"\u0421\u043F\u0430\u0442\u044C \u043D\u0430 \u0431\u043E\u043A\u0443",en:"Sleep on the side",duration:3,loop:true,emotion:"sleepy",tracks:D(N(3,{"root.rz":be/2,"root.py":4.6,"legL.rx":.7,"legR.rx":.4,"shinL.rx":-0.9,"shinR.rx":-0.6,"armL.rx":1.2,"armR.rx":.9,"foreArmL.rx":1.2,"head.rz":-0.2}),E(3,"body.sy",1,.02,1))},lieFront:{label:"\u041D\u0430 \u0436\u0438\u0432\u043E\u0442\u0435",en:"Lie on the front",duration:2.4,loop:true,tracks:D(N(2.4,{"root.rx":-be/2,"root.py":2.3,"head.rx":.9,"armL.rx":2.6,"armR.rx":2.6,"foreArmL.rx":1.6,"foreArmR.rx":1.6,"shinR.rx":-1.4}),E(2.4,"shinL.rx",-1.2,.5,1))},getUp:{label:"\u0412\u0441\u0442\u0430\u0442\u044C \u0441 \u043F\u043E\u043B\u0430",en:"Get up",duration:1.8,tracks:{"root.rx":P(1.8,[[0,be/2],[.3,.6],[.6,0],[1,0]]),"root.py":P(1.8,[[0,2.3],[.3,-6],[.6,-6],[1,0]]),"legL.rx":P(1.8,[[0,0],[.3,1.8],[.6,1.5],[1,0]]),"legR.rx":P(1.8,[[0,0],[.3,.2],[.6,-0.1],[1,0]]),"shinL.rx":P(1.8,[[0,0],[.3,-2],[.6,-1.5],[1,0]]),"shinR.rx":P(1.8,[[0,0],[.3,-1.6],[.6,-1.4],[1,0]]),"armL.rx":P(1.8,[[0,0],[.3,-0.6],[.6,.4],[1,0]])}},phone:{label:"\u0413\u043E\u0432\u043E\u0440\u0438\u0442\u044C \u043F\u043E \u0442\u0435\u043B\u0435\u0444\u043E\u043D\u0443",en:"Phone call",duration:2.4,loop:true,layer:"upper",tracks:D(N(2.4,{"armR.rx":2.1,"armR.rz":-0.08,"head.rz":-0.15}),E(2.4,"head.rx",0,.05,2),E(2.4,"armL.rz",-0.15,.15,2))},phoneScroll:{label:"\u041B\u0438\u0441\u0442\u0430\u0442\u044C \u0442\u0435\u043B\u0435\u0444\u043E\u043D",en:"Scroll phone",duration:1.6,loop:true,layer:"upper",tracks:D(N(1.6,{...Qn,"armL.rx":.5,"foreArmL.rx":1.4,"armL.rz":.3,"head.rx":-0.4}),E(1.6,"foreArmL.rz",.1,.06,2))},selfie:{label:"\u0421\u0435\u043B\u0444\u0438",en:"Selfie",duration:2,loop:true,emotion:"happy",layer:"upper",tracks:D(N(2,{"armR.rx":1.8,"armR.rz":.6,"foreArmR.rx":.2,"head.rz":-0.15,"armL.rz":-1.4,"foreArmL.rz":1.2}),E(2,"head.ry",.2,.05,1))},photo:{label:"\u0424\u043E\u0442\u043E\u0433\u0440\u0430\u0444\u0438\u0440\u043E\u0432\u0430\u0442\u044C",en:"Take a photo",duration:2,loop:true,layer:"upper",tracks:N(2,{"armL.rx":1.4,"armR.rx":1.4,"foreArmL.rx":1.2,"foreArmR.rx":1.2,"armL.rz":.35,"armR.rz":-0.35,"head.rx":.05})},drinkCup:{label:"\u041F\u0438\u0442\u044C \u0438\u0437 \u043A\u0440\u0443\u0436\u043A\u0438",en:"Drink from a cup",duration:2.4,loop:true,layer:"upper",tracks:{"armR.rx":P(2.4,[[0,.55],[.3,1.2],[.6,1.2],[1,.55]]),"foreArmR.rx":P(2.4,[[0,1.35],[.3,2.1],[.6,2.1],[1,1.35]]),"head.rx":P(2.4,[[0,0],[.3,.3],[.6,.3],[1,0]])}},eat:{label:"\u0415\u0441\u0442\u044C",en:"Eat",duration:1.2,loop:true,layer:"upper",tracks:D(N(1.2,{...Vr,"armR.rx":.9}),E(1.2,"foreArmR.rx",1.5,.45,1),E(1.2,"head.rx",-0.1,.06,2))},read:{label:"\u0427\u0438\u0442\u0430\u0442\u044C",en:"Read",duration:3,loop:true,layer:"upper",tracks:D(N(3,{...Xn,"head.rx":-0.35}),E(3,"head.ry",0,.08,1))},board:{label:"\u041F\u0438\u0441\u0430\u0442\u044C \u043D\u0430 \u0434\u043E\u0441\u043A\u0435",en:"Write on a board",duration:2,loop:true,tracks:D(N(2,{"armR.rx":2,"foreArmR.rx":.4,"body.ry":.15,"head.rx":.2}),E(2,"armR.rz",0,.25,2),E(2,"foreArmR.rz",0,.2,4))},cook:{label:"\u0413\u043E\u0442\u043E\u0432\u0438\u0442\u044C",en:"Cook",duration:1.6,loop:true,layer:"upper",tracks:D(N(1.6,{...Vr,"armR.rx":.9,"foreArmR.rx":.9,"head.rx":-0.3}),E(1.6,"armR.rz",0,.2,2),E(1.6,"armR.ry",0,.3,2,be/2))},dishes:{label:"\u041C\u044B\u0442\u044C \u043F\u043E\u0441\u0443\u0434\u0443",en:"Wash dishes",duration:1.6,loop:true,tracks:D(N(1.6,{"armL.rx":.9,"armR.rx":.9,"foreArmL.rx":.6,"foreArmR.rx":.6,"head.rx":-0.35,"body.rx":-0.1}),E(1.6,"armR.rz",0,.15,3),E(1.6,"armL.rz",0,.12,3,be))},sweep:{label:"\u041F\u043E\u0434\u043C\u0435\u0442\u0430\u0442\u044C",en:"Sweep",duration:1.6,loop:true,tracks:D(N(1.6,{"armL.rx":.6,"armR.rx":.4,"foreArmL.rx":.9,"foreArmR.rx":.5,"body.rx":-0.15,"head.rx":-0.2}),E(1.6,"body.ry",0,.3,2),E(1.6,"armL.rz",0,.25,2))},water:{label:"\u041F\u043E\u043B\u0438\u0432\u0430\u0442\u044C \u0446\u0432\u0435\u0442\u044B",en:"Water plants",duration:2.4,loop:true,tracks:D(N(2.4,{"armR.rx":.9,"foreArmR.rx":.5,"body.rx":-0.1,"head.rx":-0.3}),E(2.4,"armR.rz",-0.1,.25,1))},dig:{label:"\u041A\u043E\u043F\u0430\u0442\u044C",en:"Dig",duration:1.6,loop:true,emotion:"determined",tracks:{"body.rx":P(1.6,[[0,-0.1],[.4,-0.6],[.7,0],[1,-0.1]]),"armL.rx":P(1.6,[[0,.6],[.4,1.4],[.7,.5],[1,.6]]),"armR.rx":P(1.6,[[0,.4],[.4,.9],[.7,.2],[1,.4]]),"foreArmL.rx":vt(1.6,.8),"foreArmR.rx":vt(1.6,.6),"shinL.rx":P(1.6,[[0,0],[.4,-0.5],[.7,0],[1,0]]),"shinR.rx":P(1.6,[[0,0],[.4,-0.5],[.7,0],[1,0]]),"root.py":P(1.6,[[0,0],[.4,-1],[.7,0],[1,0]])}},fish:{label:"\u0420\u044B\u0431\u0430\u0447\u0438\u0442\u044C",en:"Fish",duration:3,loop:true,tracks:D(N(3,{"armL.rx":.9,"armR.rx":.9,"foreArmL.rx":.9,"foreArmR.rx":.7,"head.rx":.05}),E(3,"armR.rx",.9,.08,2))},paint:{label:"\u0420\u0438\u0441\u043E\u0432\u0430\u0442\u044C \u043D\u0430 \u043C\u043E\u043B\u044C\u0431\u0435\u0440\u0442\u0435",en:"Paint",duration:2,loop:true,layer:"upper",tracks:D(N(2,{"armR.rx":1.4,"foreArmR.rx":.6,...Vr,"head.rz":.1}),E(2,"armR.rz",0,.2,2),E(2,"foreArmR.rx",.6,.25,3))},brushTeeth:{label:"\u0427\u0438\u0441\u0442\u0438\u0442\u044C \u0437\u0443\u0431\u044B",en:"Brush teeth",duration:1.2,loop:true,layer:"upper",tracks:D(N(1.2,{"armR.rx":1,"foreArmR.rx":2,"armR.rz":-0.2,"head.rx":.05}),E(1.2,"armR.ry",0,.2,6))},washFace:{label:"\u0423\u043C\u044B\u0432\u0430\u0442\u044C\u0441\u044F",en:"Wash face",duration:1.6,loop:true,tracks:D(N(1.6,{"armL.rx":1.4,"armR.rx":1.4,"foreArmL.rx":1.9,"foreArmR.rx":1.9,"body.rx":-0.45,"head.rx":-0.3}),E(1.6,"foreArmL.rx",1.9,.25,3),E(1.6,"foreArmR.rx",1.9,.25,3))},openDoor:{label:"\u041E\u0442\u043A\u0440\u044B\u0442\u044C \u0434\u0432\u0435\u0440\u044C",en:"Open a door",duration:1.6,layer:"upper",tracks:{"armR.rx":P(1.6,[[0,0],[.3,1.3],[.6,1.3],[.9,.6],[1,0]]),"foreArmR.rx":P(1.6,[[0,0],[.3,.4],[.6,.4],[1,0]]),"armR.ry":P(1.6,[[0,0],[.3,0],[.45,-0.5],[.9,-0.6],[1,0]]),"body.ry":P(1.6,[[0,0],[.6,-0.2],[1,0]])}},knock:{label:"\u041F\u043E\u0441\u0442\u0443\u0447\u0430\u0442\u044C",en:"Knock",duration:1.4,layer:"upper",tracks:D({"armR.rx":P(1.4,[[0,0],[.2,1.3],[.85,1.3],[1,0]])},E(1.4,"foreArmR.rx",1.4,.35,3,0,true),{"head.rz":P(1.4,[[0,0],[.3,.1],[1,0]])})},checkWatch:{label:"\u041F\u043E\u0441\u043C\u043E\u0442\u0440\u0435\u0442\u044C \u043D\u0430 \u0447\u0430\u0441\u044B",en:"Check the time",duration:1.6,layer:"upper",tracks:{"armL.rx":P(1.6,[[0,0],[.25,.9],[.8,.9],[1,0]]),"foreArmL.rx":P(1.6,[[0,0],[.25,1.4],[.8,1.4],[1,0]]),"armL.rz":P(1.6,[[0,0],[.25,.4],[.8,.4],[1,0]]),"head.rx":P(1.6,[[0,0],[.3,-0.4],[.8,-0.4],[1,0]]),"head.ry":P(1.6,[[0,0],[.3,-0.25],[.8,-0.25],[1,0]])}},wait:{label:"\u0416\u0434\u0430\u0442\u044C",en:"Wait",duration:1.2,loop:true,emotion:"tired",tracks:D(N(1.2,{"armL.rz":-0.8,"armR.rz":.8,"foreArmL.rz":1.5,"foreArmR.rz":-1.5}),{"legR.rx":P(1.2,[[0,.15],[.25,.15],[.5,.15],[1,.15]]),"shinR.rx":P(1.2,[[0,-0.2],[.2,-0.45],[.4,-0.2],[.6,-0.45],[.8,-0.2],[1,-0.2]])})},pockets:{label:"\u0420\u0443\u043A\u0438 \u0432 \u043A\u0430\u0440\u043C\u0430\u043D\u0430\u0445",en:"Hands in pockets",duration:2,loop:true,emotion:"cool",layer:"upper",tracks:N(2,{"armL.rx":-0.25,"armR.rx":-0.25,"armL.rz":-0.12,"armR.rz":.12,"foreArmL.rx":.5,"foreArmR.rx":.5,"head.rx":.05})},armsCrossed:{label:"\u0420\u0443\u043A\u0438 \u0441\u043A\u0440\u0435\u0449\u0435\u043D\u044B",en:"Arms crossed",duration:2,loop:true,layer:"upper",tracks:N(2,{"armL.rx":.6,"armR.rx":.6,"armL.rz":.35,"armR.rz":-0.35,"foreArmL.rx":1.6,"foreArmR.rx":1.6,"foreArmL.ry":-0.7,"foreArmR.ry":.7,"head.rx":.08})},lean:{label:"\u041E\u0431\u043B\u043E\u043A\u043E\u0442\u0438\u0442\u044C\u0441\u044F \u043D\u0430 \u0441\u0442\u0435\u043D\u0443",en:"Lean on a wall",duration:2,loop:true,emotion:"cool",tracks:N(2,{"root.rz":-0.12,"root.px":-1,"legL.rx":.15,"legL.ry":.2,"shinL.rx":-0.4,"armR.rz":1.5,"foreArmR.rz":-1.4,"armL.rx":-0.2,"foreArmL.rx":.4,"head.rz":.06})},shiver:{label:"\u0414\u0440\u043E\u0436\u0430\u0442\u044C \u043E\u0442 \u0445\u043E\u043B\u043E\u0434\u0430",en:"Shiver",duration:1.2,loop:true,emotion:"scared",layer:"upper",tracks:D(N(1.2,{"armL.rx":.8,"armR.rx":.8,"armL.rz":.5,"armR.rz":-0.5,"foreArmL.rx":1.4,"foreArmR.rx":1.4,"head.rx":-0.15}),E(1.2,"body.rz",0,.03,10),E(1.2,"head.rz",0,.04,9))},fan:{label:"\u041E\u0431\u043C\u0430\u0445\u0438\u0432\u0430\u0442\u044C\u0441\u044F",en:"Fan yourself",duration:1.2,loop:true,emotion:"tired",layer:"upper",tracks:D(N(1.2,{"armR.rx":.9,"foreArmR.rx":1.7,"head.rx":.15}),E(1.2,"foreArmR.rz",0,.4,4))},sneeze:{label:"\u0427\u0438\u0445\u043D\u0443\u0442\u044C",en:"Sneeze",duration:1.4,tracks:{"head.rx":P(1.4,[[0,0],[.45,.4],[.55,-0.4],[.8,-0.2],[1,0]]),"body.rx":P(1.4,[[0,0],[.45,.1],[.55,-0.35],[.8,-0.1],[1,0]]),"armR.rx":P(1.4,[[0,0],[.4,1.3],[.8,1.3],[1,0]]),"foreArmR.rx":P(1.4,[[0,0],[.4,1.9],[.8,1.9],[1,0]])}},cough:{label:"\u041A\u0430\u0448\u043B\u044F\u0442\u044C",en:"Cough",duration:1.4,layer:"upper",tracks:D({"armR.rx":P(1.4,[[0,0],[.2,1.2],[.85,1.2],[1,0]]),"foreArmR.rx":P(1.4,[[0,0],[.2,2],[.85,2],[1,0]])},E(1.4,"body.rx",-0.1,.1,3,0,true),E(1.4,"head.rx",-0.1,.12,3,0,true))},hug:{label:"\u041E\u0431\u043D\u044F\u0442\u044C",en:"Hug",duration:2,loop:true,emotion:"love",layer:"upper",tracks:N(2,{"armL.rx":1.3,"armR.rx":1.3,"armL.rz":-0.4,"armR.rz":.4,"foreArmL.rz":1,"foreArmR.rz":-1,"foreArmL.rx":.4,"foreArmR.rx":.4,"head.rz":.1})},handshake:{label:"\u0420\u0443\u043A\u043E\u043F\u043E\u0436\u0430\u0442\u0438\u0435",en:"Handshake",duration:1.6,loop:true,emotion:"happy",layer:"upper",tracks:D(N(1.6,{"armR.rx":.9,"foreArmR.rx":.5}),E(1.6,"foreArmR.rx",.5,.15,3))},highFive:{label:"\u0414\u0430\u0442\u044C \u043F\u044F\u0442\u044C",en:"High five",duration:1.2,emotion:"excited",layer:"upper",tracks:{"armR.rz":P(1.2,[[0,0],[.3,.35],[1,0]]),"armR.rx":P(1.2,[[0,0],[.3,2.8],[.45,2.5],[.8,2.5],[1,0]]),"body.ry":P(1.2,[[0,0],[.4,-0.15],[1,0]])}},throw:{label:"\u0411\u0440\u043E\u0441\u0438\u0442\u044C",en:"Throw",duration:1.2,layer:"upper",tracks:{"armR.rx":P(1.2,[[0,0],[.35,-0.6],[.5,2.2],[.7,1.2],[1,0]]),"armR.rz":P(1.2,[[0,0],[.35,.8],[.5,.2],[1,0]]),"body.ry":P(1.2,[[0,0],[.35,.35],[.55,-0.3],[1,0]]),"armL.rx":P(1.2,[[0,0],[.35,1],[.55,.2],[1,0]])}},catch:{label:"\u041F\u043E\u0439\u043C\u0430\u0442\u044C",en:"Catch",duration:1.2,emotion:"surprised",layer:"upper",tracks:{"armL.rx":P(1.2,[[0,0],[.3,1.6],[.5,1.4],[.8,.9],[1,0]]),"armR.rx":P(1.2,[[0,0],[.3,1.6],[.5,1.4],[.8,.9],[1,0]]),"foreArmL.rx":P(1.2,[[0,0],[.5,.4],[.8,1.2],[1,0]]),"foreArmR.rx":P(1.2,[[0,0],[.5,.4],[.8,1.2],[1,0]]),"body.rx":P(1.2,[[0,0],[.5,.08],[1,0]])}},juggle:{label:"\u041F\u043E\u0434\u043A\u0438\u0434\u044B\u0432\u0430\u0442\u044C \u043C\u044F\u0447",en:"Juggle",duration:1.2,loop:true,layer:"upper",tracks:D(N(1.2,{"armL.rx":.7,"armR.rx":.7,"head.rx":.35}),E(1.2,"foreArmL.rx",1.2,.35,2),E(1.2,"foreArmR.rx",1.2,.35,2,be))}};var Gt=Math.PI,pa={clap:{label:"\u0425\u043B\u043E\u043F\u0430\u0442\u044C",en:"Clap",duration:1.8,emotion:"happy",layer:"upper",tracks:D(ie(1.8,{"armL.rx":1.2,"armR.rx":1.2,"armL.rz":.25,"armR.rz":-0.25},.2),E(1.8,"foreArmL.rz",.55,.35,5,0,true),E(1.8,"foreArmR.rz",-0.55,-0.35,5,0,true),ie(1.8,{"foreArmL.rx":.6,"foreArmR.rx":.6},.2))},salute:{label:"\u041E\u0442\u0434\u0430\u0442\u044C \u0447\u0435\u0441\u0442\u044C",en:"Salute",duration:1.6,layer:"upper",tracks:ie(1.6,{"armR.rx":2.6,"armR.rz":-0.12,"head.rx":.08},.25)},thumbsUp:{label:"\u041A\u043B\u0430\u0441\u0441",en:"Thumbs up",duration:1.4,emotion:"happy",layer:"upper",tracks:ie(1.4,{"armR.rx":1,"armR.rz":.3,"foreArmR.rx":1.2,"head.rz":-0.1},.2)},heartHands:{label:"\u0421\u0435\u0440\u0434\u0446\u0435 \u0440\u0443\u043A\u0430\u043C\u0438",en:"Heart hands",duration:2,emotion:"love",layer:"upper",tracks:ie(2,{"armL.rz":-2.3,"armR.rz":2.3,"armL.rx":.4,"armR.rx":.4,"foreArmL.rz":1.3,"foreArmR.rz":-1.3,"head.rz":.12})},think:{label:"\u0414\u0443\u043C\u0430\u0442\u044C",en:"Think",duration:2.4,emotion:"confused",layer:"upper",tracks:D(ie(2.4,{"armR.rx":.9,"armR.rz":-0.2,"foreArmR.rx":2.1,"armL.rx":.5,"foreArmL.rx":1.4,"armL.rz":.3}),E(2.4,"head.rz",.12,.05,2,0,true),ie(2.4,{"head.rx":.15}))},nod:{label:"\u0414\u0430",en:"Yes",duration:1.2,layer:"upper",tracks:E(1.2,"head.rx",-0.1,.22,3,0,true)},headShake:{label:"\u041D\u0435\u0442",en:"No",duration:1.2,layer:"upper",tracks:E(1.2,"head.ry",0,.4,3,0,true)},beckon:{label:"\u0418\u0434\u0438 \u0441\u044E\u0434\u0430",en:"Come here",duration:1.8,layer:"upper",tracks:D(ie(1.8,{"armR.rx":1.3,"armR.rz":.2}),E(1.8,"foreArmR.rx",1,.6,3,0,true),ie(1.8,{"head.rz":.1}))},stop:{label:"\u0421\u0442\u043E\u043F",en:"Stop",duration:1.4,emotion:"determined",layer:"upper",tracks:ie(1.4,{"armR.rx":1.55,"foreArmR.rx":1.2,"body.rx":.06},.15)},yawn:{label:"\u0417\u0435\u0432\u043D\u0443\u0442\u044C",en:"Yawn",duration:2.4,emotion:"sleepy",layer:"upper",tracks:ie(2.4,{"armR.rx":1.4,"foreArmR.rx":1.9,"armR.rz":-0.25,"armL.rz":-0.35,"armL.rx":-0.15,"head.rx":.35,"body.rx":.08},.5)},stretch:{label:"\u041F\u043E\u0442\u044F\u043D\u0443\u0442\u044C\u0441\u044F",en:"Stretch",duration:2.6,emotion:"sleepy",tracks:D(ie(2.6,{"armL.rz":-2.9,"armR.rz":2.9,"head.rx":.3,"body.rx":.12},.6),{"root.py":P(2.6,[[0,0],[.3,.8],[.7,.8],[1,0]])})},flex:{label:"\u0421\u0438\u043B\u0430",en:"Flex",duration:1.8,emotion:"determined",layer:"upper",tracks:D(ie(1.8,{"armL.rz":-1.5,"armR.rz":1.5,"foreArmL.rz":-1.6,"foreArmR.rz":1.6,"body.rx":.08},.25),E(1.8,"body.ry",0,.15,2,0,true))},jumpJoy:{label:"\u041F\u0440\u044B\u0436\u043E\u043A \u0440\u0430\u0434\u043E\u0441\u0442\u0438",en:"Jump for joy",duration:1.4,emotion:"excited",tracks:{"root.py":P(1.4,[[0,0],[.15,-1.5],[.4,6],[.6,6],[.8,0],[.9,-1],[1,0]]),"armL.rz":P(1.4,[[0,0],[.4,-2.8],[.7,-2.8],[1,0]]),"armR.rz":P(1.4,[[0,0],[.4,2.8],[.7,2.8],[1,0]]),"shinL.rx":P(1.4,[[0,0],[.15,-0.6],[.45,-1.4],[.7,-1.2],[.85,-0.4],[1,0]]),"shinR.rx":P(1.4,[[0,0],[.15,-0.6],[.45,-1.4],[.7,-1.2],[.85,-0.4],[1,0]])}},spin:{label:"\u041A\u0440\u0443\u0436\u0438\u0442\u044C\u0441\u044F",en:"Spin",duration:1.6,emotion:"happy",tracks:{"root.ry":P(1.6,[[0,0],[1,Gt*2]]),"armL.rz":P(1.6,[[0,0],[.2,-1.5],[.8,-1.5],[1,0]]),"armR.rz":P(1.6,[[0,0],[.2,1.5],[.8,1.5],[1,0]])}},victory:{label:"\u041F\u043E\u0431\u0435\u0434\u0430",en:"Victory",duration:2,emotion:"excited",tracks:D(ie(2,{"armR.rz":2.9,"armL.rz":-0.4,"foreArmL.rx":1.3,"armL.rx":.3,"head.rx":.2,"body.rx":.08}),{"root.py":P(2,[[0,0],[.2,3],[.35,0],[1,0]])})},airGuitar:{label:"\u0413\u0438\u0442\u0430\u0440\u0430",en:"Air guitar",duration:2.4,loop:true,emotion:"excited",tracks:D(N(2.4,{"armL.rx":1.2,"armL.rz":-0.5,"foreArmL.rz":.7,"armR.rx":.5,"foreArmR.rx":1.2,"legL.rx":.3,"shinL.rx":-0.4}),E(2.4,"foreArmR.rz",-0.2,.35,8),E(2.4,"head.rx",-0.1,.18,4),E(2.4,"body.rx",-0.05,.06,4))},drum:{label:"\u0411\u0430\u0440\u0430\u0431\u0430\u043D",en:"Drum",duration:1.6,loop:true,emotion:"excited",tracks:D(N(1.6,{"armL.rx":.7,"armR.rx":.7}),E(1.6,"foreArmL.rx",1,.5,4),E(1.6,"foreArmR.rx",1,.5,4,Gt),E(1.6,"head.rx",0,.12,4))},pushups:{label:"\u041E\u0442\u0436\u0438\u043C\u0430\u043D\u0438\u044F",en:"Push-ups",duration:2,loop:true,emotion:"determined",tracks:D(N(2,{"root.rx":-1.35,"armL.rx":1.45,"armR.rx":1.45,"head.rx":1.1}),E(2,"root.py",3.4,1.2,2),E(2,"foreArmL.rx",-0.5,.5,2),E(2,"foreArmR.rx",-0.5,.5,2))},kneel:{label:"\u041D\u0430 \u043A\u043E\u043B\u0435\u043D\u043E",en:"Kneel",duration:2.4,tracks:ie(2.4,{"legR.rx":-0.15,"shinR.rx":-1.4,"legL.rx":1.5,"shinL.rx":-1.5,"root.py":-6,"armR.rx":.9,"foreArmR.rx":1.4,"head.rx":-0.15},.5)},curtsy:{label:"\u0420\u0435\u0432\u0435\u0440\u0430\u043D\u0441",en:"Curtsy",duration:1.6,tracks:ie(1.6,{"legR.rx":-0.4,"shinL.rx":-0.6,"shinR.rx":-0.6,"root.py":-1.4,"armL.rz":-0.5,"armR.rz":.5,"body.rx":-0.15,"head.rx":-0.2},.4)},scratchHead:{label:"\u041F\u043E\u0447\u0435\u0441\u0430\u0442\u044C \u0437\u0430\u0442\u044B\u043B\u043E\u043A",en:"Scratch head",duration:1.8,emotion:"confused",layer:"upper",tracks:D(ie(1.8,{"armR.rx":3.05,"armR.rz":-0.35,"head.rz":.15,"head.rx":.2}),E(1.8,"foreArmR.rx",.35,.25,5,0,true))},hide:{label:"\u0421\u043F\u0440\u044F\u0442\u0430\u0442\u044C\u0441\u044F",en:"Hide",duration:2,emotion:"scared",tracks:ie(2,{"armL.rx":2.4,"armR.rx":2.4,"foreArmL.rx":1.4,"foreArmR.rx":1.4,"body.rx":-0.35,"head.rx":-0.4,"shinL.rx":-0.5,"shinR.rx":-0.5,"root.py":-1.5},.2)},stomp:{label:"\u0422\u043E\u043F\u043D\u0443\u0442\u044C",en:"Stomp",duration:1.2,emotion:"angry",tracks:D(ie(1.2,{"armL.rz":-0.35,"armR.rz":.35,"body.rx":-0.1},.15),{"legR.rx":P(1.2,[[0,0],[.3,.8],[.45,0],[.65,.8],[.8,0],[1,0]]),"shinR.rx":P(1.2,[[0,0],[.3,-1],[.45,0],[.65,-1],[.8,0],[1,0]])})},slump:{label:"\u041F\u043E\u043D\u0438\u043A",en:"Slump",duration:2.4,emotion:"sad",tracks:ie(2.4,{"body.rx":-0.35,"head.rx":-0.45,"armL.rz":.05,"armR.rz":-0.05,"shinL.rx":-0.15,"shinR.rx":-0.15},.6)},rollLaugh:{label:"\u0412\u0430\u043B\u044F\u0442\u044C\u0441\u044F \u043E\u0442 \u0441\u043C\u0435\u0445\u0430",en:"Rolling with laughter",duration:2.4,loop:true,emotion:"happy",tracks:D(N(2.4,{...Or,"armL.rx":1.2,"armR.rx":1.2,"foreArmL.rx":1.2,"foreArmR.rx":1.2}),E(2.4,"root.rz",0,.35,2),E(2.4,"legL.rx",1,.5,4),E(2.4,"legR.rx",1,.5,4,Gt),E(2.4,"head.rx",.2,.15,6))},blowKiss:{label:"\u0412\u043E\u0437\u0434\u0443\u0448\u043D\u044B\u0439 \u043F\u043E\u0446\u0435\u043B\u0443\u0439",en:"Blow a kiss",duration:1.6,emotion:"love",layer:"upper",tracks:{"armR.rx":P(1.6,[[0,0],[.3,1.2],[.55,1.2],[.75,1.6],[1,0]]),"foreArmR.rx":P(1.6,[[0,0],[.3,2],[.55,2],[.75,.3],[1,0]]),"armR.rz":P(1.6,[[0,0],[.3,-0.2],[.75,.4],[1,0]]),"head.rz":P(1.6,[[0,0],[.3,.12],[.9,.12],[1,0]])}},phew:{label:"\u0424\u0443\u0445",en:"Phew",duration:1.6,emotion:"tired",layer:"upper",tracks:{"armR.rz":P(1.6,[[0,0],[.3,1.7],[.7,2.1],[1,0]]),"foreArmR.rz":P(1.6,[[0,0],[.3,-1.4],[.7,-1.6],[1,0]]),"head.rx":P(1.6,[[0,0],[.3,.2],[.7,-0.2],[1,0]]),"body.rx":P(1.6,[[0,0],[.6,-0.08],[1,0]])}},lookAround:{label:"\u041E\u0441\u043C\u043E\u0442\u0440\u0435\u0442\u044C\u0441\u044F",en:"Look around",duration:2.6,layer:"upper",tracks:{"head.ry":P(2.6,[[0,0],[.2,.9],[.45,.9],[.65,-0.9],[.85,-0.9],[1,0]]),"body.ry":P(2.6,[[0,0],[.2,.25],[.45,.25],[.65,-0.25],[.85,-0.25],[1,0]]),"armR.rx":P(2.6,[[0,0],[.2,2.6],[.85,2.6],[1,0]]),"foreArmR.rx":P(2.6,[[0,0],[.2,.9],[.85,.9],[1,0]])}},karate:{label:"\u041A\u0430\u0440\u0430\u0442\u044D",en:"Karate",duration:1.8,emotion:"determined",tracks:{"armR.rx":P(1.8,[[0,.6],[.2,.6],[.3,1.57],[.45,.6],[1,0]]),"foreArmR.rx":P(1.8,[[0,1.6],[.2,1.6],[.3,0],[.45,1.6],[1,0]]),"armL.rx":P(1.8,[[0,.6],[.45,.6],[.55,1.57],[.7,.6],[1,0]]),"foreArmL.rx":P(1.8,[[0,1.6],[.45,1.6],[.55,0],[.7,1.6],[1,0]]),"legR.rx":P(1.8,[[0,0],[.7,0],[.8,1.4],[.9,0],[1,0]]),"body.ry":P(1.8,[[0,0],[.3,-0.3],[.55,.3],[.8,0],[1,0]]),"root.py":P(1.8,[[0,-1],[.9,-1],[1,0]])}},nap:{label:"\u0423\u0441\u043D\u0443\u0442\u044C",en:"Nap",duration:3,loop:true,emotion:"sleepy",tracks:D(N(3,{...Or,"armL.rz":-0.3,"armR.rz":2.4,"foreArmR.rz":-1.4,"legL.rx":.15}),E(3,"body.sy",1,.03,1))},danceRobot:{label:"\u0422\u0430\u043D\u0435\u0446 \xAB\u0420\u043E\u0431\u043E\u0442\xBB",en:"Robot dance",duration:2,loop:true,emotion:"cool",tracks:{"armL.rx":P(2,[[0,1.57],[.25,1.57],[.26,0],[.5,0],[.51,1.57],[.75,1.57],[.76,0],[1,1.57]]),"foreArmL.rx":P(2,[[0,0],[.25,0],[.26,1.57],[.5,1.57],[.51,0],[1,0]]),"armR.rx":P(2,[[0,0],[.25,0],[.26,1.57],[.5,1.57],[.51,0],[.75,0],[.76,1.57],[1,0]]),"foreArmR.rx":P(2,[[0,1.57],[.25,1.57],[.26,0],[.75,0],[.76,1.57],[1,1.57]]),"head.ry":P(2,[[0,.4],[.25,.4],[.26,-0.4],[.75,-0.4],[.76,.4],[1,.4]]),"root.py":P(2,[[0,0],[.25,-0.8],[.5,0],[.75,-0.8],[1,0]])}},danceHop:{label:"\u0422\u0430\u043D\u0435\u0446 \xAB\u041F\u0440\u044B\u0433-\u0441\u043A\u043E\u043A\xBB",en:"Hop dance",duration:1.6,loop:true,emotion:"excited",tracks:D(E(1.6,"root.py",1.2,1.2,4),E(1.6,"legL.rx",.25,.35,2),E(1.6,"legR.rx",.25,.35,2,Gt),E(1.6,"shinL.rx",-0.5,.3,2),E(1.6,"shinR.rx",-0.5,.3,2,Gt),E(1.6,"armL.rz",-1.6,.9,2),E(1.6,"armR.rz",1.6,.9,2))},danceSway:{label:"\u0422\u0430\u043D\u0435\u0446 \xAB\u041F\u043E\u043A\u0430\u0447\u0438\u0432\u0430\u043D\u0438\u0435\xBB",en:"Sway dance",duration:2.4,loop:true,emotion:"happy",tracks:D(E(2.4,"body.rz",0,.12,2),E(2.4,"head.rz",0,.16,2,Gt),E(2.4,"root.px",0,1.2,2),E(2.4,"armL.rz",-0.6,.4,2),E(2.4,"armR.rz",.6,.4,2),N(2.4,{"foreArmL.rx":1.1,"foreArmR.rx":1.1}),E(2.4,"shinL.rx",-0.2,.2,2),E(2.4,"shinR.rx",-0.2,.2,2,Gt))},danceDisco:{label:"\u0422\u0430\u043D\u0435\u0446 \xAB\u0414\u0438\u0441\u043A\u043E\xBB",en:"Disco dance",duration:2,loop:true,emotion:"cool",tracks:{"armR.rz":P(2,[[0,2.6],[.25,.2],[.5,2.6],[.75,.2],[1,2.6]]),"armR.rx":P(2,[[0,.6],[.25,.9],[.5,.6],[.75,.9],[1,.6]]),"armL.rz":vt(2,-0.3),"armL.rx":vt(2,.4),"foreArmL.rx":vt(2,1.3),"body.ry":P(2,[[0,.3],[.25,-0.2],[.5,.3],[.75,-0.2],[1,.3]]),"root.py":P(2,[[0,0],[.125,-0.8],[.25,0],[.375,-0.8],[.5,0],[.625,-0.8],[.75,0],[.875,-0.8],[1,0]]),"legL.rz":P(2,[[0,0],[.25,-0.2],[.5,0],[.75,-0.2],[1,0]])}},danceWave:{label:"\u0422\u0430\u043D\u0435\u0446 \xAB\u0412\u043E\u043B\u043D\u0430\xBB",en:"Wave dance",duration:2,loop:true,emotion:"happy",tracks:D(E(2,"armL.rz",-1.57,.35,2,0),E(2,"foreArmL.rz",0,.6,2,.8),E(2,"armR.rz",1.57,-0.35,2,1.6),E(2,"foreArmR.rz",0,-0.6,2,2.4),E(2,"body.rz",0,.08,2,1.2),E(2,"head.rz",0,.12,2,2),E(2,"root.py",-0.4,.4,4))}};var wo=Math.PI,Zn={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,wo*.46],[1,wo*.46]],"legR.rx":[[0,wo*.46],[1,wo*.46]],"root.py":[[0,-10],[1,-10]]}}},$e={...Zn,...pa,...ca},Mp=[...Object.keys(Zn),...Object.keys(pa)],Lp=Object.keys(ca),Cp=Object.keys($e);function ma(e){return typeof e=="string"&&Object.prototype.hasOwnProperty.call($e,e)}function Pp(e){return ma(e)&&$e[e].seat===true}function zp(e,t){let r=$e[e];return t?r.label:r.en??e}function dl(e,t){let r=e[0];if(t<=r[0])return r[1];for(let o=1;o<e.length;o++){let a=e[o];if(t<=a[0]){let n=e[o-1],s=(t-n[0])/Math.max(1e-6,a[0]-n[0]),l=s*s*(3-2*s);return n[1]+(a[1]-n[1])*l}}return e[e.length-1][1]}function es(e,t,r){let o=t.loop?r%t.duration:Math.min(r,t.duration);for(let[a,n]of Object.entries(t.tracks)){let s=a.lastIndexOf("."),l=a.slice(0,s),i=a.slice(s+1);i in I&&y(e,l,i,dl(n,o));}}var cr={neutral:["neutral"],happy:["happy","neutral"],sad:["sad","tired","neutral"],angry:["angry","neutral"],surprised:["surprised","scared","neutral"],scared:["scared","surprised","sad","neutral"],tired:["tired","sad","neutral"],hurt:["hurt","angry","sad","neutral"],love:["happy","neutral"],excited:["happy","surprised","neutral"],smug:["happy","neutral"],confused:["surprised","neutral"],embarrassed:["happy","sad","neutral"],silly:["happy","neutral"],cool:["neutral"],disgusted:["angry","sad","neutral"],determined:["angry","neutral"],crying:["sad","tired","neutral"],dizzy:["hurt","tired","neutral"],sleepy:["tired","blink","neutral"],wink:["happy","neutral"]},ha={neutral:{add:{},tempo:1},happy:{add:{"head.rx":.08},tempo:1.1},sad:{add:{"head.rx":-0.3,"body.rx":-0.08,"tail.rx":.5},tempo:.8},angry:{add:{"body.rx":-0.12,"head.rx":.1,"armL.rz":-0.1,"armR.rz":.1},tempo:1.1},surprised:{add:{"head.rx":.15,"body.rx":.05},tempo:1},scared:{add:{"body.rx":-0.1,"head.rx":-0.1,"armL.rx":.3,"armR.rx":.3,"tail.rx":.6},tempo:1.3},tired:{add:{"head.rx":-0.35,"body.rx":-0.12},tempo:.7},hurt:{add:{"body.rx":-0.1},tempo:1},love:{add:{"head.rz":.12,"head.rx":.06},tempo:.9},excited:{add:{"head.rx":.12,"body.rx":.04},tempo:1.3},smug:{add:{"head.rx":.14,"head.rz":-0.08},tempo:.9},confused:{add:{"head.rz":.22},tempo:.9},embarrassed:{add:{"head.rx":-0.2,"head.ry":.25,"armL.rx":.15,"armR.rx":.15},tempo:.9},silly:{add:{"head.rz":-0.18},tempo:1.2},cool:{add:{"head.rx":.06,"body.rx":.04},tempo:.85},disgusted:{add:{"head.rx":.1,"head.ry":-0.3,"body.rx":.06},tempo:1},determined:{add:{"body.rx":-0.06,"armL.rz":-0.08,"armR.rz":.08},tempo:1.15},crying:{add:{"head.rx":-0.35,"body.rx":-0.1,"tail.rx":.5},tempo:.75},dizzy:{add:{"head.rz":.15,"body.rz":-0.05},tempo:.8},sleepy:{add:{"head.rx":-0.4,"head.rz":.1,"body.rx":-0.1},tempo:.6},wink:{add:{"head.rz":.1},tempo:1.05}};function ts(e,t,r){if(!(r<=0))for(let[o,a]of Object.entries(ha[t].add)){let n=o.lastIndexOf(".");de(e,o.slice(0,n),o.slice(n+1),(a??0)*r);}}var Fp={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 Dp(e){let t=[[/(😍|🥰|😘|❤|💕)/u,"love"],[/(🤩|🥳)/u,"excited"],[/(😏)/u,"smug"],[/(😕|🤔|😵‍💫)/u,"confused"],[/(😳|☺)/u,"embarrassed"],[/(😜|😝|😛|:P|:p)/u,"silly"],[/(😎)/u,"cool"],[/(🤢|🤮)/u,"disgusted"],[/(😤|💪)/u,"determined"],[/(😭)/u,"crying"],[/(😵)/u,"dizzy"],[/(😴|💤)/u,"sleepy"],[/(😉|;\))/u,"wink"],[/(>:\(|😠|😡|🤬)/u,"angry"],[/(:'\(|😢)/u,"sad"],[/(:\(|☹|🙁|😞)/u,"sad"],[/(:o|:O|😮|😲)/u,"surprised"],[/(😱|😨)/u,"scared"],[/(-_-|😩|🥱)/u,"tired"],[/(:\)|:D|\^\^|😀|😃|😄|😁|🙂|😊|😂)/u,"happy"]];for(let[r,o]of t)if(r.test(e))return o;return null}var ul=[{state:"dead",when:e=>e.dead,clip:"dead",blend:.25},{state:"sleep",when:e=>e.sleeping,clip:"sleep",blend:.3},{state:"ride",when:e=>e.riding,clip:"ride",blend:.2},{state:"sit",when:e=>e.sitting,clip:"sit",blend:.3},{state:"swim",when:e=>e.inWater&&!e.onGround&&!e.flying,clip:"swim",blend:.3},{state:"glide",when:e=>e.gliding,clip:"glide",blend:.25},{state:"fly",when:e=>e.flying,clip:"fly",blend:.25},{state:"fall",when:(e,t)=>t.airTime>.35&&e.vy<-4,clip:"fall",blend:.2},{state:"sneak",when:e=>e.sneaking,clip:"sneak",blend:.15},{state:"run",when:e=>e.sprinting&&e.speed>3||e.speed>6.5,clip:"run",blend:.15},{state:"walk",when:e=>e.speed>.4,clip:"walk",blend:.15},{state:"idle",when:()=>true,clip:"idle",blend:.2}],fl=new Set(["idle","walk","run","sneak","sit"]),bl=new Set(["hurt","land","shoot"]),yl={eat:"eat",drink:"drink",draw:"draw",block:"block"},gl={tail:(e,t)=>[["ry",-e.yawRate*.25+.12*Math.sin(t*2)],["rx",-(.1+Math.min(e.speed,8)*.06)]],cape:(e,t)=>[["rx",-(.05+Math.min(e.speed,8)*.12)-(e.speed>1?.06*Math.sin(t*9):0)-(e.vy<-3?.4:0)]],hair:e=>[["rx",-Math.min(e.speed,8)*.03]],ear:(e,t)=>[["rz",.08*Math.sin(t*1.3)+Math.min(e.speed,6)*.02]],antenna:(e,t)=>[["rx",.1*Math.sin(t*3)-e.vy*.02]],wingL:(e,t)=>e.flying||e.gliding||!e.onGround&&!e.inWater?[["rz",e.gliding?-0.05:-0.7*Math.sin(t*12)]]:[["rz",1.1+.05*Math.sin(t*1.5)]],wingR:(e,t)=>e.flying||e.gliding||!e.onGround&&!e.inWater?[["rz",e.gliding?.05:.7*Math.sin(t*12)]]:[["rz",-1.1-.05*Math.sin(t*1.5)]]},Ro=e=>{let t=Math.max(0,Math.min(1,e));return t*t*(3-2*t)},ko=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;upperPose=new Map;upperDef=null;actions=[];useClip=null;useW=0;emote=null;mood="neutral";moodOverGestures=false;flash=null;postureW=new Map;blinkT=3;blinking=0;talkT=0;springs=new Map;constructor(t,r,o=[]){this.rig=t,this.style=na(r),this.faces=new Set(o);}setRandom(t){this.random=t;}random=Math.random;setStyle(t){this.style=na(t);}setEmotion(t,r){r&&r>0?this.flash={emotion:t,left:r}:this.mood=t;}get emotion(){return this.emote?.def.emotion&&!this.moodOverGestures?this.emote.def.emotion:this.flash?.emotion??this.mood}get emoting(){return this.emote?.id??null}get plant(){return fl.has(this.state)&&this.airTime<.12?1:0}get standing(){return this.state==="idle"&&!this.emote&&this.stateT>.2}playEmote(t){this.emote={id:t,def:$e[t],t:0};}stopEmote(){this.emote=null;}trigger(t){switch(t){case "swing":case "place":case "throw":case "shoot":case "punch":case "hurt":case "land":{let r=t;this.actions=this.actions.filter(o=>o.clip!==r),this.actions.push({clip:r,t:0,dur:Yn[r]??.3}),t==="hurt"&&this.setEmotion("hurt",.8);break}}}update(t,r=io()){t=Math.min(t,.1),this.clock+=t;let o=this.emotion,a=ha[o].tempo*this.style.tempo;!r.onGround&&!r.inWater?this.airTime+=t:(!this.wasOnGround&&this.airTime>.3&&r.onGround&&this.trigger("land"),this.airTime=0),this.wasOnGround=r.onGround,this.phase+=r.speed*t*3.5*a;let n=ul.find(c=>c.when(r,this));n.state!==this.state&&(De(this.from,this.lastLoco),this.state=n.state,this.stateT=0,this.blendT=0,this.blendDur=n.blend),this.stateT+=t,bt(this.loco);let s=Kn[this.rig]?.[n.clip]??n.clip,l={t:this.stateT,k:0,phase:this.phase,input:r,style:this.style,clock:this.clock*a};if(_r[s](this.loco,l),bt(this.pose),this.blendT<this.blendDur?(this.blendT+=t,dn(this.pose,this.from,this.loco,Ro(this.blendT/this.blendDur))):De(this.pose,this.loco),De(this.lastLoco,this.pose),this.emote){let c=this.emote;c.t+=t;let p=c.def.layer==="upper";if((p?!(this.state==="idle"||this.state==="walk"||this.state==="run"||this.state==="sneak"):r.speed>1||this.state!=="idle")||!c.def.loop&&c.t>=c.def.duration)this.emote=null;else {let d=c.def.loop?Ro(c.t/.15):Ro(Math.min(c.t/.15,(c.def.duration-c.t)/.15)),b=p?this.upperPose:this.tmp;p&&this.upperDef!==c.def&&(b.clear(),this.upperDef=c.def),bt(b),es(b,c.def,c.t),this.overlay(b,d,false);}}let i=r.use?yl[r.use]:null;i&&(this.useClip=i),this.useW=Math.max(0,Math.min(1,this.useW+(i?t:-t)*8)),this.useClip&&this.useW>0?(bt(this.tmp),_r[this.useClip](this.tmp,{...l,t:this.clock}),this.overlay(this.tmp,Ro(this.useW),false)):r.aiming&&(r.held==="pistol"||r.held==="rifle")?(bt(this.tmp),_r[r.held==="rifle"?"aimRifle":"aimPistol"](this.tmp,l),this.overlay(this.tmp,1,false),de(this.pose,"armR","rx",Math.max(-0.8,Math.min(.8,r.lookPitch))),de(this.pose,"armL","rx",Math.max(-0.8,Math.min(.8,r.lookPitch)))):r.held!=="none"&&!this.emote&&de(this.pose,"armR","rx",r.held==="staff"?.35:.2);for(let c of this.actions){c.t+=t;let p=Math.min(1,c.t/c.dur);bt(this.tmp),_r[c.clip](this.tmp,{...l,t:c.t,k:p}),this.overlay(this.tmp,1,bl.has(c.clip));}this.actions=this.actions.filter(c=>c.t<c.dur),this.state!=="dead"&&this.state!=="sleep"&&(de(this.pose,"head","ry",Math.max(-1.1,Math.min(1.1,r.lookYaw))),de(this.pose,"head","rx",Math.max(-1.2,Math.min(1.2,r.lookPitch)))),this.flash&&(this.flash.left-=t)<=0&&(this.flash=null);for(let c of b$1){let p=this.postureW.get(c)??0,h=p+((c===o?1:0)-p)*Math.min(1,t*6);this.postureW.set(c,h),this.state!=="dead"&&ts(this.pose,c,h);}for(let[c,p]of Object.entries(gl))for(let[h,m]of p(r,this.clock)){let d=c+"."+h,b=this.springs.get(d);b||this.springs.set(d,b={x:m,v:0});let u=60,R=9;b.v+=(u*(m-b.x)-R*b.v)*t,b.x+=b.v*t,de(this.pose,c,h,b.x);}return this.expression=this.face(r,t,o),this.pose}overlay(t,r,o){for(let[a,n]of t){let s=oe(this.pose,a);for(let l=0;l<9;l++)o?l>=I.sx?s[l]=s[l]*(1+(n[l]-1)*r):s[l]=s[l]+(n[l]-sr[l])*r:s[l]=s[l]+(n[l]-s[l])*r;}}face(t,r,o){let a=s=>s.find(l=>this.faces.has(l))??"neutral";if(t.dead||this.state==="dead"||t.sleeping)return a(["blink","hurt","neutral"]);let n=a(cr[o]);return t.viseme!==void 0?(this.talkT=0,t.viseme!=="rest"&&t.viseme!=="MBP"?a(["talk",n]):n):t.talk?(this.talkT+=r,Math.floor(this.talkT/.12)%2===0?a(["talk",n]):n):(this.talkT=0,this.blinking>0?(this.blinking-=r,a(["blink",n])):(this.blinkT-=r,this.blinkT<=0&&(this.blinkT=2.5+this.random()*3,o!=="surprised"&&o!=="scared"&&o!=="hurt"&&(this.blinking=.13)),n))}};var je="voxel-v1",Ut=1,Kt=["hair","top","bottom","shoes","hands","waist","back","neck","faceAcc","hat"],fa=["head","torso","sleeveL","sleeveR","forearmL","forearmR","handL","handR","legL","legR","footL","footR"],ba={sleeves:["sleeveL","sleeveR"],forearms:["forearmL","forearmR"],arms:["sleeveL","sleeveR","forearmL","forearmR"],hands:["handL","handR"],legs:["legL","legR"],feet:["footL","footR"]},qt="@skin",ya={hair:{bones:["head"],paint:["head"],paintFaces:["top","back","left","right"],parts:8,box:{min:[-6,22,-6],max:[6,35.5,6]}},hat:{bones:["head"],paint:[],parts:8,box:{min:[-7,21,-8],max:[7,38,7]}},top:{bones:["body","armL","armR","foreArmL","foreArmR"],paint:["torso","sleeveL","sleeveR","forearmL","forearmR"],parts:6,box:{min:[-10,9.5,-6],max:[10,26,6]}},bottom:{bones:["body","legL","legR","shinL","shinR"],paint:["legL","legR"],parts:4,box:{min:[-6.5,.5,-4.5],max:[6.5,17,4.5]}},shoes:{bones:["legL","legR","shinL","shinR"],paint:["footL","footR"],parts:4,box:{min:[-5.5,-0.5,-4.5],max:[5.5,7,4]}},hands:{bones:["armL","armR","foreArmL","foreArmR"],paint:["handL","handR"],parts:2,box:{min:[-10,9.5,-4],max:[10,16,4]}},waist:{bones:["body"],paint:[],parts:4,box:{min:[-7,9.5,-4],max:[7,16.5,4]}},back:{bones:["body"],paint:[],parts:8,box:{min:[-13.5,6,1.5],max:[13.5,36.5,13]}},faceAcc:{bones:["head"],paint:[],parts:8,box:{min:[-6,21,-6.5],max:[6,30.5,5]}},neck:{bones:["body"],paint:[],parts:6,box:{min:[-6,15,-4.5],max:[6,24.5,4.5]}}},Yt={palette:5,textures:4,textureSide:32,texturePixels:2048,id:40,textureId:12,name:40},Dr=["round","sparkle","wide","cat","sleepy","dot","anime","almond","button","narrow","starry","glam"],Br=["soft","thick","arched","none","straight","angled","bushy","thin"],Nr=["smile","grin","cat","small","smirk","open","teeth","fang","tongue","pout"],Hr=["none","freckles","mole","scar","plaster","whiskers","star"],jr=["block","round"],ga="round",xa=vr,wa=Ar,ct={walk:"bouncy",idle:"calm"},Et=[.5,1.8,7.5,5.4],xl={eyes:"round",eyeColor:"#3b2a20",brows:"soft",browColor:"#3b2a20",mouth:"smile",cheeks:true,marks:"none",emotion:"neutral"},Fr={min:.9,max:1.1},At=(e,t,r)=>typeof e=="string"&&t.includes(e)?e:r,ua=e=>typeof e=="string"&&Kt.includes(e);function pr(e){let t=X(e)?e:{},r=X(t.body)?t.body:{},o=X(t.face)?t.face:{},a=X(t.anim)?t.anim:{},n=xl,s={};if(X(t.wear))for(let[i,c]of Object.entries(t.wear))ua(i)&&typeof c=="string"&&c.trim()&&(s[i]=c.trim().slice(0,Yt.id));let l={};if(X(t.tint))for(let[i,c]of Object.entries(t.tint)){let p=ot(c);ua(i)&&p&&(l[i]=p);}return {version:Ut,style:je,body:{skin:ot(r.skin)??"#f2c9a0",height:Math.round(Ie(r.height,1,Fr.min,Fr.max)*1e3)/1e3,head:At(r.head,jr,ga)},face:{eyes:At(o.eyes,Dr,n.eyes),eyeColor:ot(o.eyeColor)??n.eyeColor,brows:At(o.brows,Br,n.brows),browColor:ot(o.browColor)??n.browColor,mouth:At(o.mouth,Nr,n.mouth),cheeks:typeof o.cheeks=="boolean"?o.cheeks:n.cheeks,marks:At(o.marks,Hr,"none"),emotion:At(o.emotion,b$1,n.emotion)},anim:{walk:At(a.walk,xa,ct.walk),idle:At(a.idle,wa,ct.idle)},wear:s,tint:l}}var wl=/^[a-z0-9][a-z0-9_.-]*$/,Rl=/^[A-Za-z0-9]+$/;function da(e){return !Array.isArray(e)||e.length!==3?null:e.every(t=>typeof t=="number"&&Number.isFinite(t))?e:null}function kl(e,t){if(!t||t.every(o=>o===0))return [e[0]/2,e[1]/2,e[2]/2];let r=Math.hypot(e[0],e[1],e[2])/2;return [r,r,r]}function mr(e){let t=[],r=(A,k,x)=>t.push(c({en:A,ru:k},x));if(!X(e))return {ok:false,errors:[c({en:"the item is not an object",ru:"\u0432\u0435\u0449\u044C: \u043D\u0435 \u043E\u0431\u044A\u0435\u043A\u0442"})]};let o=e,a=Yt;o.style!==void 0&&o.style!==je&&r("style \xAB{s}\xBB is not {need}","\u0441\u0442\u0438\u043B\u044C \xAB{s}\xBB: \u043D\u0435 {need}",{s:String(o.style),need:je});let n=typeof o.id=="string"?o.id.trim():"";if((!n||n.length>a.id||!wl.test(n))&&r("id must be 1, {n} characters: a-z, 0-9, _ . -","id: 1, {n} \u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432: a-z, 0-9, _ . -",{n:a.id}),!ua(o.slot))return r("unknown slot \xAB{s}\xBB","\u043D\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043D\u044B\u0439 \u0441\u043B\u043E\u0442 \xAB{s}\xBB",{s:String(o.slot)}),{ok:false,errors:t};let s=o.slot,l=ya[s],i=typeof o.name=="string"&&o.name.trim()?o.name.trim().slice(0,a.name):n,c$1={};if(!X(o.palette)||!Object.keys(o.palette).length)r("the palette is empty","\u043F\u0430\u043B\u0438\u0442\u0440\u0430 \u043F\u0443\u0441\u0442\u0430");else {let A=Object.entries(o.palette);A.length>a.palette&&r("more than {n} colours in the palette","\u0432 \u043F\u0430\u043B\u0438\u0442\u0440\u0435 \u0431\u043E\u043B\u044C\u0448\u0435 {n} \u0446\u0432\u0435\u0442\u043E\u0432",{n:a.palette});for(let[k,x]of A){let f=x===qt?qt:ot(x);k.length!==1||ft.has(k)||!f?r("palette colour \xAB{k}\xBB is not valid","\u0446\u0432\u0435\u0442 \u043F\u0430\u043B\u0438\u0442\u0440\u044B \xAB{k}\xBB \u043D\u0435 \u0433\u043E\u0434\u0438\u0442\u0441\u044F",{k}):c$1[k]=f;}}let p=typeof o.tint=="string"&&o.tint?o.tint:null;p!==null&&(!c$1[p]||c$1[p]===qt)&&r("tint \xAB{k}\xBB is not a colour of the palette","\u043F\u0435\u0440\u0435\u043A\u0440\u0430\u0441\u043A\u0430 \xAB{k}\xBB: \u043D\u0435 \u0446\u0432\u0435\u0442 \u043F\u0430\u043B\u0438\u0442\u0440\u044B",{k:p});let h={},m=0;if(o.textures!==void 0)if(!X(o.textures))r("textures is not an object","textures: \u043D\u0435 \u043E\u0431\u044A\u0435\u043A\u0442");else {let A=Object.entries(o.textures);A.length>a.textures&&r("more than {n} textures","\u0442\u0435\u043A\u0441\u0442\u0443\u0440 \u0431\u043E\u043B\u044C\u0448\u0435 {n}",{n:a.textures});for(let[k,x]of A){if(k.length>a.textureId||!Rl.test(k)){r("texture id \xAB{id}\xBB must be 1, {n} letters or digits","id \u0442\u0435\u043A\u0441\u0442\u0443\u0440\u044B \xAB{id}\xBB: 1, {n} \u0431\u0443\u043A\u0432 \u0438\u043B\u0438 \u0446\u0438\u0444\u0440",{id:k.slice(0,20),n:a.textureId});continue}let f=X(x)?x:null,S=f&&Array.isArray(f.rows)?f.rows:null,T=f?f.w:void 0,C=f?f.h:void 0;if(!S||typeof T!="number"||typeof C!="number"||!Number.isInteger(T)||!Number.isInteger(C)||T<1||C<1||T>a.textureSide||C>a.textureSide||S.length!==C||S.some(_=>typeof _!="string"||_.length!==T)){r("texture \xAB{id}\xBB must be w\xD7h \u2264 {n} with exactly h rows of w symbols","\u0442\u0435\u043A\u0441\u0442\u0443\u0440\u0430 \xAB{id}\xBB: w\xD7h \u2264 {n}, \u0440\u043E\u0432\u043D\u043E h \u0441\u0442\u0440\u043E\u043A \u043F\u043E w \u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432",{id:k,n:a.textureSide});continue}S.some(_=>[..._].some(M=>!ft.has(M)&&!c$1[M]))&&r("texture \xAB{id}\xBB uses symbols outside the palette","\u0432 \u0442\u0435\u043A\u0441\u0442\u0443\u0440\u0435 \xAB{id}\xBB \u0441\u0438\u043C\u0432\u043E\u043B\u044B \u043D\u0435 \u0438\u0437 \u043F\u0430\u043B\u0438\u0442\u0440\u044B",{id:k}),m+=T*C,h[k]={w:T,h:C,rows:S.map(_=>_.replace(/ /g,"."))};}m>a.texturePixels&&r("textures take {p} pixels, the limit is {n}","\u0442\u0435\u043A\u0441\u0442\u0443\u0440\u044B \u0437\u0430\u043D\u0438\u043C\u0430\u044E\u0442 {p} \u043F\u0438\u043A\u0441\u0435\u043B\u0435\u0439, \u043F\u0440\u0435\u0434\u0435\u043B {n}",{p:m,n:a.texturePixels});}let d=(A,k)=>typeof A!="string"?null:h[A]||c$1[A]?A:(r("{w}: \xAB{v}\xBB is neither a texture nor a palette colour","{w}: \xAB{v}\xBB: \u043D\u0438 \u0442\u0435\u043A\u0441\u0442\u0443\u0440\u0430, \u043D\u0438 \u0446\u0432\u0435\u0442 \u043F\u0430\u043B\u0438\u0442\u0440\u044B",{w:k,v:A}),null),b=(A,k,x=ut)=>{if(A===void 0)return;if(!X(A)){r("{w}: faces is not an object","{w}: faces: \u043D\u0435 \u043E\u0431\u044A\u0435\u043A\u0442",{w:k});return}let f={};for(let[S,T]of Object.entries(A)){if(!ut.includes(S)){r("{w}: unknown face \xAB{f}\xBB","{w}: \u043D\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043D\u0430\u044F \u0433\u0440\u0430\u043D\u044C \xAB{f}\xBB",{w:k,f:S});continue}if(!x.includes(S)){r("{w}: the {slot} slot may not paint the \xAB{f}\xBB face","{w}: \u0441\u043B\u043E\u0442 {slot} \u043D\u0435 \u043A\u0440\u0430\u0441\u0438\u0442 \u0433\u0440\u0430\u043D\u044C \xAB{f}\xBB",{w:k,slot:s,f:S});continue}let C=d(T,k);C&&(f[S]=C);}return Object.keys(f).length?f:void 0},u=[];o.paint!==void 0&&!Array.isArray(o.paint)&&r("paint is not a list","paint: \u043D\u0435 \u0441\u043F\u0438\u0441\u043E\u043A");for(let[A,k]of (Array.isArray(o.paint)?o.paint:[]).entries()){let x=`paint[${A}]`;if(!X(k)){r("{w} is not an object","{w}: \u043D\u0435 \u043E\u0431\u044A\u0435\u043A\u0442",{w:x});continue}let f=typeof k.region=="string"?k.region:"",S=ba[f]??(fa.includes(f)?[f]:[]);if(!S.length){r("{w}: unknown region \xAB{r}\xBB","{w}: \u043D\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043D\u0430\u044F \u043E\u0431\u043B\u0430\u0441\u0442\u044C \xAB{r}\xBB",{w:x,r:f});continue}let T=S.filter(_=>!l.paint.includes(_));if(T.length){r("{w}: the {slot} slot may not paint \xAB{r}\xBB","{w}: \u0441\u043B\u043E\u0442 {slot} \u043D\u0435 \u043A\u0440\u0430\u0441\u0438\u0442 \xAB{r}\xBB",{w:x,slot:s,r:T.join(", ")});continue}let C=typeof k.color=="string"&&c$1[k.color]?k.color:null;C||r("{w}: colour is not in the palette","{w}: \u0446\u0432\u0435\u0442\u0430 \u043D\u0435\u0442 \u0432 \u043F\u0430\u043B\u0438\u0442\u0440\u0435",{w:x});let z=b(k.faces,x,l.paintFaces);if(C)for(let _ of S){let M={region:_,color:C};z&&(M.faces={...z}),u.push(M);}}let R=[];o.parts!==void 0&&!Array.isArray(o.parts)&&r("parts is not a list","parts: \u043D\u0435 \u0441\u043F\u0438\u0441\u043E\u043A");let w=Array.isArray(o.parts)?o.parts:[];w.length>l.parts&&r("the {slot} slot allows {n} boxes, the item has {m}","\u0441\u043B\u043E\u0442\u0443 {slot} \u043C\u043E\u0436\u043D\u043E {n} \u043A\u043E\u0440\u043E\u0431\u043E\u043A, \u0443 \u0432\u0435\u0449\u0438 {m}",{slot:s,n:l.parts,m:w.length});for(let[A,k]of w.entries()){let x=`parts[${A}]`;if(!X(k)){r("{w} is not an object","{w}: \u043D\u0435 \u043E\u0431\u044A\u0435\u043A\u0442",{w:x});continue}let f=typeof k.bone=="string"?k.bone:"";if(!l.bones.includes(f)){r("{w}: the {slot} slot puts boxes only on {b}","{w}: \u0441\u043B\u043E\u0442 {slot} \u0441\u0442\u0430\u0432\u0438\u0442 \u043A\u043E\u0440\u043E\u0431\u043A\u0438 \u0442\u043E\u043B\u044C\u043A\u043E \u043D\u0430 {b}",{w:x,slot:s,b:l.bones.join(", ")});continue}let S=da(k.size),T=da(k.pos);if(!S||!T||S.some(se=>se<=0)){r("{w}: size and pos must be [x, y, z]","{w}: size \u0438 pos: [x, y, z]",{w:x});continue}let C=k.rot===void 0?void 0:da(k.rot);k.rot!==void 0&&!C&&r("{w}: rot must be [x, y, z]","{w}: rot: [x, y, z]",{w:x});let z=k.mirror===true,_=kl(S,C??void 0),V=(z?[T[0],-T[0]]:[T[0]]).some(se=>se-_[0]<l.box.min[0]-1e-6||se+_[0]>l.box.max[0]+1e-6)||[1,2].some(se=>T[se]-_[se]<l.box.min[se]-1e-6||T[se]+_[se]>l.box.max[se]+1e-6);V&&r("{w}: the box leaves the {slot} slot frame","{w}: \u043A\u043E\u0440\u043E\u0431\u043A\u0430 \u0432\u044B\u0445\u043E\u0434\u0438\u0442 \u0437\u0430 \u0440\u0430\u043C\u043A\u0443 \u0441\u043B\u043E\u0442\u0430 {slot}",{w:x,slot:s});let q=typeof k.color=="string"&&c$1[k.color]?k.color:null;q||r("{w}: colour is not in the palette","{w}: \u0446\u0432\u0435\u0442\u0430 \u043D\u0435\u0442 \u0432 \u043F\u0430\u043B\u0438\u0442\u0440\u0435",{w:x});let Y=b(k.faces,x),ce;if(k.mat!==void 0&&(typeof k.mat=="string"&&tr.includes(k.mat)?ce=k.mat:r("{w}: material \xAB{m}\xBB is not {list}","{w}: \u043C\u0430\u0442\u0435\u0440\u0438\u0430\u043B \xAB{m}\xBB: \u043D\u0435 {list}",{w:x,m:String(k.mat),list:tr.join(", ")})),!q||V)continue;let pe={bone:f,size:[...S],pos:[...T],color:q};Y&&(pe.faces=Y),C&&C.some(se=>se!==0)&&(pe.rot=[...C]),z&&(pe.mirror=true),typeof k.name=="string"&&k.name.trim()&&(pe.name=k.name.trim().slice(0,24)),ce&&(pe.mat=ce),R.push(pe);}return !w.length&&!(Array.isArray(o.paint)&&o.paint.length)&&r("the item neither paints nor adds anything","\u0432\u0435\u0449\u044C \u043D\u0438\u0447\u0435\u0433\u043E \u043D\u0435 \u043A\u0440\u0430\u0441\u0438\u0442 \u0438 \u043D\u0435 \u0434\u043E\u0431\u0430\u0432\u043B\u044F\u0435\u0442"),t.length?{ok:false,errors:t}:{ok:true,item:{version:Ut,style:je,id:n,slot:s,name:i,palette:c$1,tint:p,textures:h,paint:u,parts:R}}}var Oe="#2b2140",et="#7a2e2e",Wt="#e8707a",vl={neutral:{eye:"open",iris:1,white:1,lidOuter:0,lidInner:0,browUp:0,browInner:0,tear:false},happy:{eye:"happy",iris:1,white:1,lidOuter:0,lidInner:0,browUp:.04,browInner:0,tear:false},sad:{eye:"open",iris:1,white:1,lidOuter:.38,lidInner:.12,browUp:0,browInner:.09,tear:true},angry:{eye:"open",iris:.9,white:.95,lidOuter:.1,lidInner:.42,browUp:-0.02,browInner:-0.1,tear:false},surprised:{eye:"open",iris:.55,white:1.15,lidOuter:0,lidInner:0,browUp:.1,browInner:0,tear:false},scared:{eye:"open",iris:.42,white:1.08,lidOuter:0,lidInner:0,browUp:.08,browInner:.07,tear:false},tired:{eye:"open",iris:1,white:1,lidOuter:.5,lidInner:.5,browUp:-0.02,browInner:-0.02,tear:false},hurt:{eye:"hurt",iris:1,white:1,lidOuter:0,lidInner:0,browUp:0,browInner:-0.07,tear:false},love:{eye:"heart",iris:1,white:1,lidOuter:0,lidInner:0,browUp:.05,browInner:.03,tear:false,blush:.6},excited:{eye:"star",iris:1,white:1,lidOuter:0,lidInner:0,browUp:.09,browInner:0,tear:false},smug:{eye:"open",iris:.95,white:1,lidOuter:.42,lidInner:.36,browUp:0,browInner:-0.03,tear:false,look:.25,browTilt:.06},confused:{eye:"open",iris:.8,white:1.05,lidOuter:0,lidInner:0,browUp:.03,browInner:.04,tear:false,browTilt:.1,sweat:true},embarrassed:{eye:"happy",iris:1,white:1,lidOuter:0,lidInner:0,browUp:.02,browInner:.08,tear:false,blush:1,sweat:true},silly:{eye:"happy",iris:1,white:1,lidOuter:0,lidInner:0,browUp:.06,browInner:0,tear:false,wink:true},cool:{eye:"open",iris:.9,white:1,lidOuter:.38,lidInner:.38,browUp:-0.01,browInner:-0.02,tear:false},disgusted:{eye:"open",iris:.85,white:.95,lidOuter:.3,lidInner:.45,browUp:-0.02,browInner:-0.08,tear:false,look:-0.3},determined:{eye:"open",iris:1,white:1,lidOuter:.15,lidInner:.34,browUp:-0.01,browInner:-0.12,tear:false},crying:{eye:"closed",iris:1,white:1,lidOuter:0,lidInner:0,browUp:.02,browInner:.12,tear:false,stream:true},dizzy:{eye:"spiral",iris:1,white:1,lidOuter:0,lidInner:0,browUp:.04,browInner:.05,tear:false},sleepy:{eye:"closed",iris:1,white:1,lidOuter:0,lidInner:0,browUp:-0.02,browInner:0,tear:false,zzz:true},wink:{eye:"open",iris:1,white:1,lidOuter:0,lidInner:0,browUp:.04,browInner:0,tear:false,wink:true}};function Ra(e,t,r,o,a,n="neutral"){let s=a==="blink"||a==="talk"?n==="blink"||n==="talk"?"neutral":n:a,l=vl[s];e.clearRect(0,0,t,r),e.lineCap="round",e.lineJoin="round";let i=r*.5,c=t*.105,p=r*.2,h=a==="blink"?"closed":l.eye;if(o.cheeks&&s!=="scared"&&(e.fillStyle=s==="happy"?"rgba(236,110,140,0.5)":"rgba(236,120,140,0.32)",j(e,t*.12,r*.8,t*.07,r*.075),e.fill(),j(e,t*.88,r*.8,t*.07,r*.075),e.fill()),l.blush){e.fillStyle=`rgba(236,90,120,${.35*l.blush})`,j(e,t*.13,r*.8,t*.085,r*.09),e.fill(),j(e,t*.87,r*.8,t*.085,r*.09),e.fill(),e.strokeStyle=`rgba(200,60,90,${.7*l.blush})`,e.lineWidth=t*.008;for(let m of [t*.13,t*.87])for(let d=-1;d<=1;d++)e.beginPath(),e.moveTo(m+d*t*.025-t*.01,r*.84),e.lineTo(m+d*t*.025+t*.01,r*.76),e.stroke();}Al(e,t,r,o);for(let m of [-1,1]){let d=t*(.5+m*.22),b=l.wink&&m===1&&h!=="closed"?"happy":h;Sl(e,d,i,c,p,m,o,b,l);let u=(l.browTilt??0)*(m===1?1:-0.4);Tl(e,d,i-p-r*.07-r*u,t,r,m,o,l);}if(l.stream&&a!=="blink"){e.fillStyle="rgba(133,183,235,0.85)";for(let m of [-1,1]){let d=t*(.5+m*.22);e.beginPath(),e.moveTo(d-t*.03,i+p*.35),e.quadraticCurveTo(d-t*.045,r*.8,d-t*.025,r),e.lineTo(d+t*.025,r),e.quadraticCurveTo(d+t*.04,r*.8,d+t*.03,i+p*.35),e.closePath(),e.fill();}}if(l.sweat){e.fillStyle="#9fd3f5";let m=t*.95,d=r*.2;e.beginPath(),e.moveTo(m,d-r*.09),e.quadraticCurveTo(m+t*.035,d+r*.02,m,d+r*.05),e.quadraticCurveTo(m-t*.035,d+r*.02,m,d-r*.09),e.fill();}if(l.zzz){e.strokeStyle=Oe,e.lineWidth=t*.012;let m=(d,b,u)=>{e.beginPath(),e.moveTo(d,b),e.lineTo(d+u,b),e.lineTo(d,b+u),e.lineTo(d+u,b+u),e.stroke();};m(t*.8,r*.12,t*.05),m(t*.88,r*.02,t*.035);}if(l.tear&&h==="open"){e.fillStyle="#85b7eb";let m=t*.5-t*.22-c*.6,d=i+p*1.05;e.beginPath(),e.moveTo(m,d-r*.07),e.quadraticCurveTo(m+t*.03,d,m,d+r*.04),e.quadraticCurveTo(m-t*.03,d,m,d-r*.07),e.fill();}Ml(e,t*.5,r*.86,t,r,o,a==="talk"?"talk":s);}function Al(e,t,r,o){let a=o.marks;if(!(!a||a==="none"))switch(a){case "freckles":{e.fillStyle="rgba(150,90,50,0.55)";let n=[[.08,.7],[.13,.66],[.18,.71],[.11,.76],[.16,.78],[.92,.7],[.87,.66],[.82,.71],[.89,.76],[.84,.78]];for(let[s,l]of n)j(e,t*s,r*l,t*.009,t*.009),e.fill();return}case "mole":e.fillStyle="#4a2e22",j(e,t*.64,r*.82,t*.011,t*.011),e.fill();return;case "scar":{e.strokeStyle="rgba(150,60,60,0.75)",e.lineWidth=t*.012,e.beginPath(),e.moveTo(t*.2,r*.12),e.lineTo(t*.32,r*.78),e.stroke(),e.lineWidth=t*.007;for(let n=1;n<=4;n++){let s=n/5,l=t*(.2+.12*s),i=r*(.12+.66*s);e.beginPath(),e.moveTo(l-t*.025,i+r*.005),e.lineTo(l+t*.025,i-r*.005),e.stroke();}return}case "plaster":{e.save(),e.translate(t*.84,r*.74),e.rotate(-0.5),e.fillStyle="#f1d3a8",e.fillRect(-t*.07,-r*.04,t*.14,r*.08),e.fillStyle="#e3b98a",e.fillRect(-t*.025,-r*.04,t*.05,r*.08),e.restore();return}case "whiskers":{e.strokeStyle=Oe,e.lineWidth=t*.008;for(let n of [-1,1])for(let s of [-0.04,0,.04])e.beginPath(),e.moveTo(t*(.5+n*.24),r*(.78+s)),e.lineTo(t*(.5+n*.42),r*(.75+s*1.8)),e.stroke();return}case "star":vo(e,t*.84,r*.74,t*.045),e.fillStyle="#f2c14e",e.fill();return}}function El(e,t,r,o){e.beginPath(),e.moveTo(t,r+o*.9),e.bezierCurveTo(t-o*1.4,r-o*.1,t-o*.7,r-o*1.1,t,r-o*.4),e.bezierCurveTo(t+o*.7,r-o*1.1,t+o*1.4,r-o*.1,t,r+o*.9),e.closePath();}function j(e,t,r,o,a){e.beginPath(),e.ellipse(t,r,Math.max(.1,o),Math.max(.1,a),0,0,Math.PI*2);}function Sl(e,t,r,o,a,n,s,l,i){let c=o*.26;if(e.strokeStyle=Oe,e.lineWidth=c,l==="closed"){e.beginPath(),e.moveTo(t-o,r+a*.1),e.quadraticCurveTo(t,r+a*.55,t+o,r+a*.1),e.stroke(),s.eyes==="wide"&&rs(e,t,r+a*.15,o,a*.3,n,c);return}if(l==="happy"){e.lineWidth=c*1.2,e.beginPath(),e.moveTo(t-o,r+a*.35),e.quadraticCurveTo(t,r-a*.75,t+o,r+a*.35),e.stroke();return}if(l==="heart"){El(e,t,r,o*1.05),e.fillStyle="#e8436b",e.fill(),e.fillStyle="rgba(255,255,255,0.8)",j(e,t-o*.38,r-a*.25,o*.2,o*.16),e.fill();return}if(l==="star"){vo(e,t,r,Math.min(o,a)*1.15),e.fillStyle="#f2c14e",e.fill(),e.lineWidth=c*.6,e.stroke();return}if(l==="spiral"){e.lineWidth=c*.9,e.beginPath();for(let _=0;_<=36;_++){let M=_/36*Math.PI*4*n,V=_/36*Math.min(o,a)*.95,q=t+Math.cos(M)*V,Y=r+Math.sin(M)*V;_?e.lineTo(q,Y):e.moveTo(q,Y);}e.stroke();return}if(l==="hurt"){let _=t-n*o*.6,M=t+n*o*.8;e.lineWidth=c*1.2,e.beginPath(),e.moveTo(M,r-a*.55),e.lineTo(_,r),e.lineTo(M,r+a*.55),e.stroke();return}let p=s.eyes==="anime"?1.12:s.eyes==="narrow"?1.15:1,h=s.eyes==="anime"?1.25:s.eyes==="narrow"?.55:1,m=o*i.white*p,d=a*i.white*h,b=s.eyes==="sleepy"?.32:0,u=Math.max(i.lidOuter,b),R=Math.max(i.lidInner,b),w=r-d,A=t+n*(m+c),k=t-n*(m+c),x=w+2*d*u,f=w+2*d*R,S=u>0||R>0;e.save(),S&&(e.beginPath(),e.moveTo(A,x),e.lineTo(k,f),e.lineTo(k,r+d*2),e.lineTo(A,r+d*2),e.closePath(),e.clip());let T=Math.min(m,d)*.8*i.iris*(s.eyes==="narrow"?1.5:1),C=r+d*.12,z=(i.look??0)*m*.45;switch(s.eyes){case "button":{e.fillStyle=Oe,j(e,t+z,r+d*.05,m*.72,d*.8),e.fill(),e.fillStyle="#ffffff",j(e,t+z-m*.28,r-d*.25,m*.2,m*.2),e.fill(),j(e,t+z+m*.25,r+d*.3,m*.09,m*.09),e.fill();break}case "almond":{e.fillStyle="#ffffff",hr(e,t,r,m*1.05,d*.8,n),e.fill(),e.save(),hr(e,t,r,m*1.05,d*.8,n),e.clip(),e.fillStyle=s.eyeColor,j(e,t+z,C,T*1.05,T*1.05),e.fill(),e.fillStyle=Oe,j(e,t+z,C,T*.5,T*.5),e.fill(),e.fillStyle="#ffffff",j(e,t+z-T*.38,C-T*.4,T*.28,T*.28),e.fill(),e.restore(),e.strokeStyle=Oe,e.lineWidth=c*1.1,hr(e,t,r,m*1.05,d*.8,n),e.stroke();break}case "anime":case "starry":case "glam":case "narrow":{e.fillStyle="#ffffff",j(e,t,r,m,d),e.fill(),e.save(),j(e,t,r,m,d),e.clip();let _=s.eyes==="anime"?1.3:s.eyes==="narrow"?1:1.12,M=T*_,V=t+z;e.fillStyle=s.eyeColor,j(e,V,C,M*.95,M*(s.eyes==="anime"?1.25:1)),e.fill(),e.fillStyle="rgba(255,255,255,0.22)",j(e,V,C+M*.5,M*.7,M*.45),e.fill(),s.eyes==="starry"?(vo(e,V,C,M*.62),e.fillStyle="#fff3b0",e.fill()):(e.fillStyle=Oe,j(e,V,C,M*.46,M*(s.eyes==="anime"?.62:.5)),e.fill()),e.fillStyle="#ffffff",j(e,V-M*.38,C-M*.45,M*(s.eyes==="anime"?.38:.3),M*.3),e.fill(),j(e,V+M*.4,C+M*.4,M*.16,M*.16),e.fill(),e.restore(),e.strokeStyle=Oe,e.lineWidth=s.eyes==="anime"||s.eyes==="glam"?c*1.6:c,e.beginPath(),e.ellipse(t,r,m,d,0,Math.PI*1.05,Math.PI*1.95),e.stroke(),s.eyes==="glam"&&(e.beginPath(),e.moveTo(t+n*m*.85,r-d*.45),e.lineTo(t+n*m*1.45,r-d*.95),e.stroke());break}case "dot":{e.fillStyle=Oe,j(e,t+z,r+d*.1,m*.55,d*.72),e.fill(),e.fillStyle="#ffffff",j(e,t+z-m*.18,r-d*.18,m*.17,m*.17),e.fill();break}case "cat":{e.fillStyle="#ffffff",hr(e,t,r,m*1.08,d*.85,n),e.fill(),e.save(),hr(e,t,r,m*1.08,d*.85,n),e.clip(),e.fillStyle=s.eyeColor,j(e,t,C,T*1.05,T*1.2),e.fill(),e.fillStyle=Oe,j(e,t,C,T*.22*(i.iris<1?1.5:1),T*.95),e.fill(),e.fillStyle="#ffffff",j(e,t-T*.4,C-T*.45,T*.25,T*.25),e.fill(),e.restore(),e.strokeStyle=Oe,e.lineWidth=c,hr(e,t,r,m*1.08,d*.85,n),e.stroke();break}default:{let _=s.eyes==="sparkle"||s.eyes==="wide";e.fillStyle="#ffffff",j(e,t,r,m,d),e.fill(),e.save(),j(e,t,r,m,d),e.clip();let M=_?T*1.18:T;e.fillStyle=s.eyeColor,j(e,t+z,C,M*.95,M*(s.eyes==="sparkle"?1.15:1)),e.fill(),e.fillStyle="rgba(255,255,255,0.18)",j(e,t+z,C+M*.45,M*.7,M*.45),e.fill(),e.fillStyle=Oe,j(e,t+z,C,M*.48,M*.52),e.fill(),e.fillStyle="#ffffff",j(e,t+z-M*.38,C-M*.42,M*.32,M*.32),e.fill(),j(e,t+z+M*.38,C+M*.38,M*.14,M*.14),e.fill(),s.eyes==="sparkle"&&(vo(e,t+z+M*.3,C-M*.55,M*.22),e.fill()),e.restore(),e.strokeStyle=Oe,e.lineWidth=c,e.beginPath(),e.ellipse(t,r,m,d,0,Math.PI*1.08,Math.PI*1.92),e.stroke();break}}if(e.restore(),S){e.strokeStyle=Oe,e.lineWidth=c;let _=Y=>(Y-A)/(k-A),M=Y=>x+(f-x)*_(Y),V=t-m*.95,q=t+m*.95;e.beginPath(),e.moveTo(V,M(V)),e.lineTo(q,M(q)),e.stroke();}(s.eyes==="wide"||s.eyes==="glam")&&rs(e,t,r-d*.55,m,d*.45,n,c);}function hr(e,t,r,o,a,n){let s=t+n*o,l=t-n*o;e.beginPath(),e.moveTo(l,r+a*.15),e.quadraticCurveTo(t,r-a*1.5,s,r-a*.35),e.quadraticCurveTo(t,r+a*1.4,l,r+a*.15),e.closePath();}function rs(e,t,r,o,a,n,s){e.lineWidth=s*.8;let l=t+n*o;for(let i=0;i<2;i++){let c=r+i*a*.6;e.beginPath(),e.moveTo(l-n*o*.1,c),e.lineTo(l+n*o*.35,c-a*(.7-i*.2)),e.stroke();}}function vo(e,t,r,o){e.beginPath();for(let a=0;a<8;a++){let n=a%2?o*.35:o,s=a*Math.PI/4-Math.PI/2,l=t+Math.cos(s)*n,i=r+Math.sin(s)*n;a?e.lineTo(l,i):e.moveTo(l,i);}e.closePath(),e.fillStyle="#ffffff";}function Tl(e,t,r,o,a,n,s,l){if(s.brows==="none")return;let i=o*.095,c=r-a*l.browUp,p=t-n*i,h=t+n*i,m=c-a*l.browInner,d=c+a*l.browInner*.3;if(e.strokeStyle=s.browColor,e.fillStyle=s.browColor,s.brows==="bushy"){let u=a*.085;e.beginPath(),e.moveTo(h+n*o*.01,d+u*.2),e.quadraticCurveTo(t,Math.min(d,m)-u*.9,p,m-u*.1),e.lineTo(p,m+u*.8);for(let R=1;R<=4;R++){let w=p+(h-p)*R/4;e.lineTo(w-n*o*.01,m+(d-m)*(R/4)+u*(R%2?.5:.85));}e.closePath(),e.fill();return}if(s.brows==="straight"||s.brows==="thin"){e.lineWidth=o*(s.brows==="thin"?.014:.03),e.beginPath(),e.moveTo(h,d),e.lineTo(p,m),e.stroke();return}if(s.brows==="angled"){e.lineWidth=o*.028;let u=t+n*i*.3;e.beginPath(),e.moveTo(p,m),e.lineTo(u,Math.min(d,m)-a*.06),e.lineTo(h,d+a*.02),e.stroke();return}if(s.brows==="thick"){let u=a*.06;e.beginPath(),e.moveTo(h,d),e.quadraticCurveTo(t,Math.min(d,m)-u*.6,p,m),e.lineTo(p,m+u),e.quadraticCurveTo(t,Math.min(d,m)+u*.5,h,d+u*.6),e.closePath(),e.fill();return}e.lineWidth=o*(s.brows==="arched"?.026:.032),e.beginPath(),e.moveTo(h,d);let b=s.brows==="arched"?a*.09:a*.035;e.quadraticCurveTo(t+n*i*.2,Math.min(d,m)-b,p,m),e.stroke();}function Ml(e,t,r,o,a,n,s){let l=o*.026;e.strokeStyle=et,e.lineWidth=l;let i=o*(n.mouth==="small"||n.mouth==="pout"?.06:n.mouth==="grin"?.12:.09),c=(p,h=4)=>{e.beginPath();for(let m=0;m<=h;m++){let d=t-i+2*i*m/h,b=r+(m%2?-1:1)*a*p;m?e.lineTo(d,b):e.moveTo(d,b);}e.stroke();};switch(s){case "love":case "wink":case "embarrassed":if(s==="embarrassed"){c(.025,4);return}e.beginPath(),e.moveTo(t-i,r-a*.04),e.quadraticCurveTo(t,r+a*.09,t+i,r-a*.04),e.stroke();return;case "excited":case "silly":{let p=Math.max(i,o*.11);e.fillStyle=et,e.beginPath(),e.moveTo(t-p,r-a*.07),e.quadraticCurveTo(t,r-a*.03,t+p,r-a*.07),e.quadraticCurveTo(t,r+a*.22,t-p,r-a*.07),e.closePath(),e.fill(),s==="silly"?(e.fillStyle=Wt,j(e,t+p*.25,r+a*.11,p*.4,a*.08),e.fill(),e.strokeStyle="#c4505c",e.lineWidth=l*.5,e.beginPath(),e.moveTo(t+p*.25,r+a*.06),e.lineTo(t+p*.25,r+a*.14),e.stroke()):(e.save(),e.clip(),e.fillStyle=Wt,j(e,t,r+a*.12,p*.55,a*.06),e.fill(),e.restore());return}case "smug":case "cool":e.beginPath(),e.moveTo(t-i,r+a*.01),e.quadraticCurveTo(t+i*.3,r+a*.03,t+i*1.05,r-a*.06),e.stroke();return;case "confused":case "dizzy":c(s==="dizzy"?.035:.02,s==="dizzy"?6:4);return;case "disgusted":{e.beginPath(),e.moveTo(t-i,r+a*.05),e.lineTo(t-i*.3,r-a*.02),e.lineTo(t+i*.4,r+a*.03),e.lineTo(t+i,r-a*.01),e.stroke(),e.fillStyle=Wt,j(e,t-i*.1,r+a*.045,i*.3,a*.03),e.fill();return}case "determined":{e.fillStyle="#ffffff",e.fillRect(t-i,r-a*.035,i*2,a*.07),e.strokeStyle=et,e.lineWidth=l*.7,e.strokeRect(t-i,r-a*.035,i*2,a*.07),e.beginPath(),e.moveTo(t-i,r),e.lineTo(t+i,r),e.stroke();return}case "crying":{let p=Math.max(i,o*.1);e.fillStyle=et,e.beginPath(),e.moveTo(t-p,r+a*.09),e.quadraticCurveTo(t,r-a*.14,t+p,r+a*.09),e.closePath(),e.fill();return}case "sleepy":e.fillStyle=et,j(e,t,r+a*.01,o*.025,a*.035),e.fill();return;case "happy":{let p=Math.max(i,o*.1);e.fillStyle=et,e.beginPath(),e.moveTo(t-p,r-a*.06),e.quadraticCurveTo(t,r-a*.02,t+p,r-a*.06),e.quadraticCurveTo(t,r+a*.2,t-p,r-a*.06),e.closePath(),e.fill(),e.save(),e.clip(),e.fillStyle=Wt,j(e,t,r+a*.1,p*.55,a*.06),e.fill(),n.mouth==="grin"&&(e.fillStyle="#ffffff",e.fillRect(t-p,r-a*.08,p*2,a*.045)),e.restore();return}case "surprised":e.fillStyle=et,j(e,t,r,o*.045,a*.085),e.fill();return;case "talk":e.fillStyle=et,j(e,t,r,Math.max(i*.7,o*.06),a*.07),e.fill(),e.save(),e.clip(),e.fillStyle=Wt,j(e,t,r+a*.06,o*.045,a*.035),e.fill(),e.restore();return;case "sad":e.beginPath(),e.moveTo(t-i,r+a*.04),e.quadraticCurveTo(t,r-a*.07,t+i,r+a*.04),e.stroke();return;case "angry":e.beginPath(),e.moveTo(t-i,r+a*.01),e.quadraticCurveTo(t,r-a*.03,t+i,r+a*.01),e.stroke();return;case "scared":{e.beginPath();let p=4;for(let h=0;h<=p;h++){let m=t-i+2*i*h/p,d=r+(h%2?-1:1)*a*.022;h?e.lineTo(m,d):e.moveTo(m,d);}e.stroke();return}case "tired":e.beginPath(),e.moveTo(t-i*.6,r),e.lineTo(t+i*.6,r),e.stroke();return;case "hurt":{e.beginPath();let p=4;for(let h=0;h<=p;h++){let m=t-i+2*i*h/p,d=r+(h%2?-1:1)*a*.04;h?e.lineTo(m,d):e.moveTo(m,d);}e.stroke();return}}if(n.mouth==="smirk"){e.beginPath(),e.moveTo(t-i,r),e.quadraticCurveTo(t+i*.3,r+a*.03,t+i,r-a*.06),e.stroke();return}if(n.mouth==="pout"){e.lineWidth=l*.9,e.beginPath(),e.moveTo(t-i*.15,r-a*.05),e.quadraticCurveTo(t+i*.9,r-a*.03,t-i*.05,r),e.quadraticCurveTo(t+i*.9,r+a*.03,t-i*.15,r+a*.05),e.stroke();return}if(n.mouth==="open"||n.mouth==="teeth"||n.mouth==="fang"||n.mouth==="tongue"){e.fillStyle=et,e.beginPath(),e.moveTo(t-i,r-a*.04),e.quadraticCurveTo(t,r-a*.02,t+i,r-a*.04),e.quadraticCurveTo(t,r+a*.13,t-i,r-a*.04),e.closePath(),e.fill(),e.save(),e.clip(),n.mouth==="teeth"?(e.fillStyle="#ffffff",e.fillRect(t-i,r-a*.06,i*2,a*.045)):n.mouth!=="fang"&&(e.fillStyle=Wt,j(e,t,r+a*.07,i*.55,a*.05),e.fill()),e.restore(),n.mouth==="fang"&&(e.fillStyle="#ffffff",e.beginPath(),e.moveTo(t+i*.35,r-a*.035),e.lineTo(t+i*.6,r-a*.035),e.lineTo(t+i*.47,r+a*.03),e.closePath(),e.fill()),n.mouth==="tongue"&&(e.fillStyle=Wt,j(e,t+i*.3,r+a*.07,i*.32,a*.05),e.fill());return}if(n.mouth==="cat"){e.beginPath(),e.moveTo(t-i,r-a*.03),e.quadraticCurveTo(t-i*.5,r+a*.06,t,r-a*.01),e.quadraticCurveTo(t+i*.5,r+a*.06,t+i,r-a*.03),e.stroke();return}if(n.mouth==="grin"){e.fillStyle=et,e.beginPath(),e.moveTo(t-i,r-a*.04),e.quadraticCurveTo(t,r-a*.01,t+i,r-a*.04),e.quadraticCurveTo(t,r+a*.12,t-i,r-a*.04),e.closePath(),e.fill(),e.save(),e.clip(),e.fillStyle="#ffffff",e.fillRect(t-i,r-a*.06,i*2,a*.04),e.restore();return}e.beginPath(),e.moveTo(t-i,r-a*.03),e.quadraticCurveTo(t,r+a*.06,t+i,r-a*.03),e.stroke();}var os=16;function Ll(e,t){if(typeof document<"u"){let r=document.createElement("canvas");return r.width=e,r.height=t,r}return new OffscreenCanvas(e,t)}var dr=class{texture;g;w;h;face;current="neutral";base="neutral";constructor(t,r=Et){this.face=t,this.w=Math.round(r[2]*os),this.h=Math.round(r[3]*os);let o=Ll(this.w,this.h),a=o.getContext("2d");if(!a)throw new Error("DrawnFace: no 2D canvas");this.g=a,this.texture=new B.CanvasTexture(o),this.texture.colorSpace=B.SRGBColorSpace,this.texture.anisotropy=4,this.paint("neutral");}paint(t,r){let o=r&&t!=="blink"&&t!=="talk"&&cr[r].includes(t)?r:t;o!=="blink"&&o!=="talk"?this.base=o:r&&(this.base=r),this.current=o,Ra(this.g,this.w,this.h,this.face,o,this.base),this.texture.needsUpdate=true;}setFace(t){this.face=t,Ra(this.g,this.w,this.h,this.face,this.current,this.base),this.texture.needsUpdate=true;}dispose(){this.texture.dispose();}};var Cl={idle:{},talk:{},walk:{speed:1.6},run:{speed:5.2},surprised:{emote:"shrug"},point:{emote:"point"},sit:{sitting:true},wave:{emote:"wave"},jump:{air:true},fall:{emote:"facepalm"},dance:{emote:"dance"},carry:{speed:1.4,emote:"carry"},jog:{speed:3.4}},Pl=Object.fromEntries(i.map(e=>[e,Cl[e]??(ma(e)?{emote:e}:{})])),zl={handR:"handR",handL:"handL",head:"headTop"},Eo=class{view;animator;input=io();seed;ownFace;drawn=null;pose="idle";jumpT=-1;constructor(t,r={}){this.ownFace=!r.facePainter,this.ownFace&&(this.drawn=as(t)),this.view=new yo(t,{shadows:false,gloss:!!t?.face?.drawn,...r,facePainter:r.facePainter??this.drawn}),this.seed=r.seed??1,this.animator=this.newAnimator();}get group(){return this.view.group}get height(){return this.view.height}setSpec(t){let r=this.view.hash;if(this.view.setSpec(t),this.view.hash!==r&&(this.animator=this.newAnimator(),this.ownFace)){let o=this.drawn;this.drawn=as(t),this.view.setFacePainter(this.drawn),o?.dispose();}}setEmotion(t){this.animator.setEmotion(t);}setViseme(t){this.input.viseme=t;}setPose(t){if(t===this.pose)return;this.pose=t;let r=Pl[t];if(this.input.speed=r.speed??0,this.input.sitting=!!r.sitting,r.emote)this.animator.playEmote(r.emote);else {let o=this.animator.emoting;o&&"loop"in $e[o]&&$e[o].loop&&this.animator.stopEmote();}r.air&&(this.jumpT=0,this.animator.trigger("jump"));}playEmote(t){this.animator.playEmote(t);}stopEmote(){this.animator.stopEmote();}trigger(t){if(t==="jump"){this.jumpT=0,this.animator.trigger("jump");return}this.animator.trigger(t);}setGround(t){this.view.setGround(t);}lookAt(t){this.view.lookAt(t);}reach(t,r){this.view.reach(t,r);}seat(t){this.view.seat(t);}fall(t){return this.view.fall(t)}hit(t,r){return this.view.hit(t,r??null)}getUp(){this.view.getUp();}stopRagdoll(){this.view.stopRagdoll();}takeRagdollDrift(){return this.view.takeRagdollDrift()}get ragdollDrift(){return this.view.ragdollDrift}get ragdoll(){return this.view.ragdollState}setColliders(t){this.view.setColliders(t);}attach(t,r){this.view.attach(zl[t],r);}update(t){let r=this.input;this.jumpT>=0&&(this.jumpT+=t,r.onGround=this.jumpT>.6,r.vy=this.jumpT<.3?4:-4,r.onGround&&(this.jumpT=-1,r.vy=0,this.animator.trigger("land")));let o=this.animator.update(t,r);this.view.applyPose(o,{dt:t,plant:this.animator.plant,standing:this.animator.standing}),this.view.setExpression(this.animator.expression,this.animator.emotion);}dispose(){this.view.dispose(),this.drawn?.dispose();}newAnimator(){let t=this.view.spec,r=new ko(t.rig,t.style,this.view.expressions);return r.setRandom(a(this.seed)),r}};function as(e){let t=e?.face?.drawn;if(!t)return null;try{let{face:r}=pr({face:{...t,brows:t.brows,browColor:"#2a1c14"}});return new dr({...r,emotion:"neutral"},e.face.rect)}catch{return null}}var Il=wr.map(e=>{let t=Ae[e],r=t.bones.map(a=>`${a.name}@[${a.pivot.join(",")}]`).join(" "),o=t.defaultParts.map(a=>`${a.bone} ${a.size.join("x")} at [${a.pos.join(",")}]`).join("; ");return `- "${e}" \u2014 ${t.hint}. Bones (name@pivot): ${r}. Default body: ${o}.`}).join(`
25
+ `),mm=`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.
26
26
 
27
27
  The game builds and animates the character from your recipe. You give the SHAPE (boxes on a skeleton), the COLOURS (a palette) and small PIXEL-ART pictures for faces and clothes. Animations (walk, run, sneak, swim, fly, emotes, emotions) come from the skeleton \u2014 you never animate.
28
28
 
29
29
  COORDINATES are in model PIXELS (16 px = 1 block): x to the character's RIGHT hand, y UP (y = 0 is the soles of the feet), z BACKWARDS \u2014 the character LOOKS TOWARD -z (its face is on the -z side). A normal person is 32 px tall.
30
30
 
31
31
  SKELETONS ("rig"):
32
- ${zl}
32
+ ${Il}
33
33
 
34
34
  CharacterSpec:
35
35
  {
36
36
  "version": 1,
37
37
  "name": string (<= 40 chars, in the player's language),
38
38
  "description": string (<= 200 chars),
39
- "rig": ${gr.map(e=>`"${e}"`).join(" | ")},
39
+ "rig": ${wr.map(e=>`"${e}"`).join(" | ")},
40
40
  "scale": 0.25..3 (overall size; 1 = normal),
41
41
  "palette": { "<one character>": "#rrggbb", ... } (<= 32 colours; "." and " " are transparent),
42
42
  "textures": { "<id>": { "w": 1..32, "h": 1..32, "rows": [ "<w palette characters>", ... h rows, top row first ] } },
@@ -48,11 +48,11 @@ CharacterSpec:
48
48
  "mirror": true (also adds the mirrored copy on the paired bone: armL -> armR, legFL -> legFR),
49
49
  "name": string } ],
50
50
  "bones": [ <= 16 EXTRA bones for tails, ears, wings, capes, hair, antennas:
51
- { "name": string, "parent": "<bone>", "pivot": [x, y, z], "role": ${Zr.map(e=>`"${e}"`).join(" | ")} } ]
51
+ { "name": string, "parent": "<bone>", "pivot": [x, y, z], "role": ${to.map(e=>`"${e}"`).join(" | ")} } ]
52
52
  (a role makes the bone move by itself: a tail sways, ears twitch, a cape flutters when running, wings flap in flight; "static" \u2014 no motion),
53
53
  "face": { "bone": "head", "rect": [x, y, w, h] (where the face sits on the FRONT face of the head box, px from its top-left corner as seen by a viewer),
54
- "expressions": { ${wr.map(e=>`"${e}"`).join(", ")}: "<texture id of size w x h>" } } \u2014 eyes and mouth, drawn over the head; "neutral" is required, draw as many others as you can (at least blink, happy, sad, angry, surprised),
55
- "style": { "walk": ${Rr.map(e=>`"${e}"`).join(" | ")}, "idle": ${kr.map(e=>`"${e}"`).join(" | ")}, "energy": 0..1 },
54
+ "expressions": { ${kr.map(e=>`"${e}"`).join(", ")}: "<texture id of size w x h>" } } \u2014 eyes and mouth, drawn over the head; "neutral" is required, draw as many others as you can (at least blink, happy, sad, angry, surprised),
55
+ "style": { "walk": ${vr.map(e=>`"${e}"`).join(" | ")}, "idle": ${Ar.map(e=>`"${e}"`).join(" | ")}, "energy": 0..1 },
56
56
  "voice": { "pitch": 0.5..2 },
57
57
  "tags": [ <= 8 short words ],
58
58
  "finish": { "noise": 0..1, "outline": 0..1, "shade": 0..1, "density": 1..4 } (optional; defaults 0.5 / 0.4 / 0.25 / 2 \u2014 the game adds fabric noise, a dark outline on the edge of every box face and top-to-bottom shading by itself; set 0 for a clean flat look)
@@ -74,4 +74,4 @@ HOW TO BUILD A GOOD, DETAILED CHARACTER (the game's style: blocky people with fi
74
74
  - Clothes in the textures: a shirt front with a collar, a button placket and pockets; a striped t-shirt; a knitted sweater with a pattern band and a ribbed hem; trousers with a crease; shorts with skin below and socks; the belt with a buckle.
75
75
  - The head front texture: hair on the top rows and the sides, skin elsewhere, a slightly darker chin row; the eyes, brows and mouth go into "face" (e.g. rect [0, 3, 8, 5] with 16x10 pictures): white eyes 3 texels wide with a coloured iris in the middle, brows above them, a 4-texel mouth \u2014 one picture per expression, the same size, transparent where the skin shows through.
76
76
  - Add detail with extra boxes: hair fringe, a hood, armour plates, a crown, horns, a tail (an extra bone with role "tail").
77
- - When the player sends pictures (possibly of ONE character from different angles: front, side, back) study EVERY picture: get the silhouette, proportions, colours, clothes and the face right. Pictures can be photos, drawings or 3D renders \u2014 turn them into a clean blocky version.`;var os=["wolf","lion","tiger","panda","pig","cow","sheep","horse","deer","mouse","raccoon","elephant","hedgehog","turtle","frog","duck","chicken","owl","penguin","bat","bee","eagle","fish","shark"],Ao={h:"#efe6cf",n:"#f2a0a8",r:"#d8342c",y:"#f2a630",d:"#2a2a30",g:"#e8f6ff"},K={mirror:true},Il=["legFL","legFR","legBL","legBR"];function Te(e,t={}){let r=t.body??[8,8,16],o=t.bodyY??12;e("body","body",r,[0,o,0],"t"),t.belly!==false&&e("belly","body",[r[0]-2,1,r[2]-4],[0,o-r[1]/2,0],"l"),e("head","head",[8,8,8],[0,16,-12],t.head??"s");let a=t.leg??[3,8];for(let n of Il){let s=n.endsWith("L")?-3:3,l=n.startsWith("legF")?-6:6;e(n,n,[a[0],a[1],a[0]],[s,a[1]/2,l],t.legColor??"t"),t.paw!==null&&e(`${n}Paw`,n,[a[0]+.2,1.5,a[0]+.2],[s,.75,l],t.paw??"a");}}var Hr=(e,t="a",r=[4,3,3])=>{e("snout","head",r,[0,14.5,-16-r[2]/2+.5],"l"),e("nose","head",[1.4,1,.6],[0,15.6,-16-r[2]+.4],t);};function $t(e,t={}){let r=t.body??[6,6,8];e("body","body",r,[0,8,0],"t"),e("belly","body",[r[0]-1.4,r[1]-2,1],[0,7.5,-r[2]/2-.2],"l"),e("head","head",[5,5,5],[0,13,-4],t.head??"s");let o=t.wing??[8,1,6];e("wing","wingL",o,[-3-o[0]/2,10,0],t.wingColor??"a",K),e("leg","legL",[1,4,1],[-1.5,2,0],t.legColor??"a",K);}var _l={bone:"head",rect:[0,1,5,3]};function as(e,t){let r=(a,n,s)=>({rig:"quadruped",style:{walk:a,idle:n,energy:s},palette:Ao}),o=(a,n,s)=>({rig:"flyer",style:{walk:a,idle:n,energy:s},face:_l,palette:Ao});switch(e){case "wolf":return Te(t),t("ear","head",[2.4,3.4,1],[-2.5,21.5,-10.5],"t",K),Hr(t,"d"),t("ruff","body",[9,6,3],[0,13,-6.5],"l"),t("tail","tail",[3,3,10],[0,13,13],"t",{rot:[25,0,0]}),t("tailTip","tail",[3.1,3.1,2],[0,14.6,17.5],"l",{rot:[25,0,0]}),r("sneaky","proud",.6);case "lion":return Te(t),t("mane","head",[12,12,3],[0,16,-9.5],"a"),t("maneTop","head",[10,2,6],[0,21,-11.5],"a"),t("ear","head",[2,2,1],[-3,21.4,-12],"s",K),Hr(t,"d",[4,2.6,2]),t("tail","tail",[1.4,1.4,10],[0,13,13],"t",{rot:[30,0,0]}),t("tuft","tail",[2.6,2.6,2.6],[0,15.2,18],"a",{rot:[30,0,0]}),r("heavy","proud",.5);case "tiger":Te(t);for(let a of [-5,-1.5,2,5.5])t(`stripe${a}`,"body",[8.3,1,1.1],[0,12.6,a],"d");return t("stripeHead","head",[8.3,1,3],[0,19.8,-11],"d"),t("ear","head",[2,2,1],[-3,21,-10.5],"t",K),Hr(t,"n",[4,2.6,2]),t("tail","tail",[1.8,1.8,10],[0,14,13],"t",{rot:[20,0,0]}),t("tailRing","tail",[2,2,1],[0,15,15],"d",{rot:[20,0,0]}),r("sneaky","proud",.6);case "panda":return Te(t,{body:[9,9,15],legColor:"a",paw:"a"}),t("band","body",[9.2,9.2,4],[0,12,-4.5],"a"),t("ear","head",[2.4,2.4,1.2],[-3,21,-11],"a",K),t("nose","head",[1.6,1,.6],[0,15,-16.3],"a"),t("tail","tail",[2,2,2],[0,14,8.5],"l"),r("heavy","calm",.4);case "pig":return Te(t,{leg:[3,6],paw:"a"}),t("snout","head",[3.6,2.6,1.2],[0,14.6,-16.6],"n"),t("nostril","head",[.6,.8,.2],[-0.8,14.6,-17.3],"a",K),t("ear","head",[2.4,2,1],[-2.6,20.6,-10.5],"n",{mirror:true,rot:[-30,0,0]}),t("tail","tail",[1,1,2.6],[0,15,9],"n",{rot:[-40,0,0]}),r("bouncy","fidgety",.7);case "cow":return Te(t,{body:[9,9,16],paw:"d"}),t("spot","body",[9.2,3.6,4],[0,14,-2],"a"),t("spot2","body",[9.2,3,3],[0,11,5],"a"),t("muzzle","head",[6,3,1.6],[0,13.6,-16.6],"n"),t("horn","head",[1,2.4,1],[-2.8,21.2,-11],"h",K),t("ear","head",[2.6,1.2,1],[-5,18.6,-11],"t",K),t("tail","tail",[1,8,1],[0,11,9],"t"),t("tailTip","tail",[1.6,2,1.6],[0,6.6,9],"a"),r("heavy","calm",.3);case "sheep":return Te(t,{body:[10,9,16],leg:[2.6,7],legColor:"a",paw:"d",head:"a",belly:false}),t("woolTop","body",[9,2,13],[0,17,0],"t"),t("woolHead","head",[8.6,2.4,6],[0,20.4,-11.6],"t"),t("ear","head",[2.6,1,1.6],[-5,18,-11],"a",K),t("tail","tail",[2.6,2.6,2],[0,14,9],"t"),r("bouncy","calm",.5);case "horse":return Te(t,{body:[8,8,17],paw:"d"}),t("muzzle","head",[5,4.6,4],[0,13.8,-17.6],"s"),t("nose","head",[5.2,1.6,1],[0,12.6,-19.6],"l"),t("mane","head",[1.6,3,8],[0,21.4,-9],"a"),t("maneNeck","body",[1.6,3,5],[0,17,-5.5],"a"),t("ear","head",[1.4,2.4,1],[-2.4,21.2,-13.4],"s",K),t("tail","tail",[2.2,10,2.2],[0,10,9.4],"a"),r("normal","proud",.7);case "deer":Te(t,{body:[7,8,15]}),Hr(t,"d",[3.6,2.8,2.4]),t("ear","head",[2.6,1.4,1],[-5,19.6,-10.5],"t",K),t("antler","head",[.8,4,.8],[-2.4,22,-10.5],"h",K),t("antlerTine","head",[2.6,.8,.8],[-3.4,23.2,-10.5],"h",K),t("antlerTop","head",[.8,2,.8],[-4.3,24.4,-10.5],"h",K);for(let a of [-3,1,4])t(`spot${a}`,"body",[1.4,.4,1.4],[-1.6,16.1,a],"l",K);return t("tail","tail",[2,2.4,1.4],[0,14.6,8.4],"l"),r("bouncy","calm",.6);case "mouse":return Te(t,{body:[7,6,12],bodyY:11,leg:[2.4,8],paw:"n"}),t("ear","head",[3.4,3.4,.8],[-3.6,21.4,-10.6],"t",K),t("earIn","head",[2.2,2.2,.3],[-3.6,21.4,-11.1],"n",K),t("nose","head",[1.2,1,.6],[0,15,-16.3],"n"),t("tail","tail",[.8,.8,11],[0,12,13],"n",{rot:[15,0,0]}),r("sneaky","fidgety",.9);case "raccoon":Te(t,{paw:"d"}),t("mask","head",[8.3,1.4,8.3],[0,17,-12],"d",{shape:"cylinder"}),Hr(t,"d",[3.4,2.4,2]),t("ear","head",[2.2,2.4,1],[-2.8,21.2,-10.5],"a",K),t("tail","tail",[3,3,10],[0,14,13],"t",{rot:[20,0,0]});for(let a of [10,13.4,16.8])t(`ring${a}`,"tail",[3.2,3.2,1.4],[0,14+(a-13)*.36,a],"d",{rot:[20,0,0]});return r("sneaky","fidgety",.7);case "elephant":return Te(t,{body:[10,10,16],leg:[4,8],paw:"l"}),t("ear","head",[1,7,6],[-5,16.4,-10.6],"a",K),t("trunk","head",[2.6,4,2.4],[0,12.6,-17.2],"s"),t("trunk2","head",[2.2,4,2.2],[0,9,-17.6],"s"),t("trunkTip","head",[2,1.6,2.6],[0,6.6,-18],"s"),t("tusk","head",[.8,.8,3],[-2.2,12.6,-17.2],"h",K),t("tail","tail",[.8,6,.8],[0,12,8.4],"t"),r("heavy","calm",.3);case "hedgehog":Te(t,{body:[8,6,12],bodyY:10,leg:[2.4,8],paw:"l"}),t("spines","body",[9.4,5,12],[0,13.6,1],"a");for(let a of [-3,1,5])t(`spike${a}`,"body",[1,1.6,1],[-2.4,16.8,a],"a",K);return t("spikeTop","body",[1,1.8,1],[0,16.9,-1],"a"),t("nose","head",[1.4,1.2,1.4],[0,14.6,-16.6],"d"),t("ear","head",[1.4,1.4,.8],[-3,20.6,-10.6],"l",K),r("sneaky","fidgety",.8);case "turtle":return Te(t,{body:[8,5,12],bodyY:9,leg:[3,8],paw:null}),t("shell","body",[11,6,15],[0,13,.6],"a"),t("shellTop","body",[8,1.6,11],[0,16.6,.6],"a"),t("shellRim","body",[11.4,1,15.4],[0,10.4,.6],"l"),t("tail","tail",[1.4,1.4,2.6],[0,11,9],"t"),r("heavy","calm",.2);case "frog":return Te(t,{body:[9,6,12],bodyY:10,leg:[3,8],paw:"a"}),t("eyeBump","head",[2.6,2.4,2.6],[-2.4,21.2,-13],"t",K),t("eyeBall","head",[1.6,1.6,.4],[-2.4,21.4,-14.5],"w",K),t("pupil","head",[.8,.8,.2],[-2.4,21.4,-14.8],"k",K),t("backLeg","legBL",[3.6,3,5],[-3.4,3.5,7.4],"t",K),r("bouncy","calm",.8);case "duck":return $t(t,{wingColor:"t",legColor:"y"}),t("bill","head",[3,.9,2.6],[0,12,-7.6],"y"),t("tail","tail",[3,1,2.4],[0,9.6,5],"t",{rot:[-25,0,0]}),o("bouncy","fidgety",.6);case "chicken":return $t(t,{wing:[3,4,6],wingColor:"t",legColor:"y"}),t("comb","head",[1,2,3.6],[0,16.4,-4],"r"),t("beak","head",[1.4,1,1.6],[0,12.8,-7.2],"y"),t("wattle","head",[.8,1.4,.6],[0,11.2,-6.8],"r"),t("tail","tail",[3,4,3],[0,11,5],"t",{rot:[20,0,0]}),o("bouncy","fidgety",.9);case "owl":return $t(t,{body:[7,7,7],wingColor:"a"}),t("tuft","head",[1,2,1],[-2,16.4,-4],"a",K),t("beak","head",[1,1.2,1],[0,12.4,-7],"y"),t("tail","tail",[3,1,3],[0,6,5],"a"),o("normal","calm",.3);case "penguin":return $t(t,{body:[7,9,6],wing:[3,6,2],wingColor:"t",legColor:"y"}),t("belly2","body",[5,7,.6],[0,7.6,-3.3],"l"),t("beak","head",[1.4,1,1.8],[0,12.6,-7.2],"y"),t("feet","legL",[2,.6,2.4],[-1.5,.3,-0.8],"y",K),o("heavy","fidgety",.6);case "bat":return $t(t,{body:[5,5,5],wing:[9,.6,5],wingColor:"a",legColor:"d"}),t("ear","head",[1.4,2.6,.8],[-1.6,16.6,-4],"t",K),t("fang","head",[.5,.8,.3],[-0.8,11.2,-6.6],"w",K),o("sneaky","fidgety",.8);case "bee":return $t(t,{body:[6,6,8],wing:[5,.4,4],wingColor:"g",legColor:"d"}),t("stripe","body",[6.2,6.2,1.2],[0,8,0],"d"),t("stripe2","body",[6.2,6.2,1.2],[0,8,2.8],"d"),t("stinger","body",[.8,.8,1.6],[0,7.4,4.6],"d"),t("antenna","head",[.4,2.4,.4],[-1.2,16.4,-4.6],"d",K),t("antennaTip","head",[.8,.8,.8],[-1.2,17.8,-4.6],"d",K),o("bouncy","fidgety",1);case "eagle":return $t(t,{body:[6,7,8],wing:[10,1,6],wingColor:"t",legColor:"y",head:"l"}),t("beak","head",[1.6,1.4,2],[0,12.6,-7.4],"y"),t("beakTip","head",[1,1,.8],[0,11.6,-8],"y"),t("tail","tail",[4,1,4],[0,7.4,6],"l"),o("heavy","proud",.6);case "fish":return t("body","body",[5,7,9],[0,6,0],"t"),t("belly","body",[4,1,7],[0,2.4,0],"l"),t("head","head",[5,6,4],[0,6,-6.5],"s"),t("tailFin","tail",[.8,6,4],[0,6,7],"a"),t("dorsal","body",[.8,2.4,4],[0,10.6,0],"a"),t("fin","finL",[3,.6,2],[-4,5,-1],"a",K),{rig:"swimmer",style:{walk:"normal",idle:"calm",energy:.7},face:{bone:"head",rect:[0,1,5,3]},palette:Ao};case "shark":return t("body","body",[7,7,16],[0,6,1],"t"),t("belly","body",[5.6,1,13],[0,2.4,1],"l"),t("head","head",[7,6,6],[0,6,-9],"s"),t("jaw","head",[6,1.4,5],[0,3.4,-9],"l"),t("dorsal","body",[1,5,4],[0,11.6,0],"t"),t("tailFin","tail",[1,9,5],[0,7,11.4],"t"),t("fin","finL",[4,.8,3],[-5,4,-1],"t",K),{rig:"swimmer",style:{walk:"heavy",idle:"proud",energy:.6},face:{bone:"head",rect:[0,1,7,3]},palette:Ao}}throw new Error(`unknown creature kind: ${e}`)}var bm=["cat","dog","fox","bear","rabbit","bird","dragon","slime","ghost","robot",...os],Ol=e=>({k:"#2a1c14",w:"#f4f4ef",b:e,m:"#7a3a30",o:"#3a1a14"});function Vl(e){let t=e.light??e.body,r=e.accent??e.body,o={t:e.body,s:e.body,l:t,a:r,p:r,...Ol(e.eyes??"#3f6f3a")},a=[],n="quadruped",s=Ar("head",[0,3,8,5]),l={walk:"normal",idle:"calm",energy:.6},i=(u,R,w,A,k,x={})=>a.push({name:u,bone:R,size:w,pos:A,color:k,...x});switch(e.kind){case "cat":case "fox":case "dog":case "bear":case "rabbit":{let u=e.kind;i("body","body",[8,8,16],[0,12,0],"t"),i("belly","body",[6,1,12],[0,8,0],"l"),i("head","head",[8,8,8],[0,16,-12],"s");for(let R of ["legFL","legFR","legBL","legBR"]){let w=R.endsWith("L")?-3:3,A=R.startsWith("legF")?-6:6;i(R,R,[3,8,3],[w,4,A],"t"),i(`${R}Paw`,R,[3.2,1.5,3.2],[w,.75,A],"a");}u==="cat"?(i("ear","head",[2,2.5,1],[-2.5,21,-11],"a",{mirror:true}),i("tail","tail",[1.6,1.6,10],[0,15,13],"t",{rot:[20,0,0]}),l={walk:"sneaky",idle:"calm",energy:.5}):u==="fox"?(i("ear","head",[2.4,3.2,1],[-2.5,21.4,-11],"t",{mirror:true}),i("snout","head",[4,3,3],[0,14.5,-17],"l"),i("nose","head",[1.2,1,.6],[0,15.6,-18.6],"a"),i("tail","tail",[3.5,3.5,10],[0,14,13],"t",{rot:[15,0,0]}),i("tailTip","tail",[3.6,3.6,2.5],[0,15.2,18],"l"),l={walk:"bouncy",idle:"fidgety",energy:.7}):u==="dog"?(i("ear","head",[1.5,4,3],[-4.6,17.5,-11.5],"a",{mirror:true}),i("snout","head",[4,3,3],[0,14.5,-17],"l"),i("nose","head",[1.6,1.2,.6],[0,15.8,-18.6],"a"),i("tail","tail",[2,2,7],[0,16,11],"t",{rot:[40,0,0]}),l={walk:"bouncy",idle:"fidgety",energy:.9}):u==="bear"?(i("ear","head",[2,2,1],[-3,20.6,-10.5],"a",{mirror:true}),i("snout","head",[4,3,2.5],[0,14.5,-16.8],"l"),i("nose","head",[1.6,1.2,.6],[0,15.8,-18.2],"a"),i("tail","tail",[2,2,2],[0,14,9],"t"),l={walk:"heavy",idle:"proud",energy:.4}):(i("ear","head",[1.6,7,1],[-1.8,23.5,-11],"t",{mirror:true}),i("earInner","head",[.8,5.5,.4],[-1.8,23.5,-11.6],"l",{mirror:true}),i("tail","tail",[3,3,3],[0,14,9.5],"l"),l={walk:"bouncy",idle:"fidgety",energy:.8});break}case "bird":case "dragon":{n="flyer",s=Ar("head",[0,1,5,3]);let u=e.kind==="dragon";i("body","body",[6,6,8],[0,8,0],"t"),i("belly","body",[4.6,4,1],[0,7.5,-4.2],"l"),i("head","head",[5,5,5],[0,13,-4],"s"),i("wing","wingL",[8,1,6],[-7,10,0],"a",{mirror:true}),i("leg","legL",[1,4,1],[-1.5,2,0],"a",{mirror:true}),u?(i("horn","head",[.8,2,.8],[-1.4,16.4,-3],"l",{mirror:true}),i("snout","head",[3,2,2.4],[0,12.2,-7.4],"s"),i("tail","tail",[2,2,8],[0,7,7],"t"),i("spike","body",[1,1.5,6],[0,11.6,0],"a"),l={walk:"heavy",idle:"proud",energy:.6}):(i("beak","head",[1.6,1.2,2],[0,12.4,-7.2],"a"),i("tail","tail",[4,1,4],[0,8,6],"a"),i("crest","head",[1,2,2],[0,16.2,-3.6],"a"),l={walk:"bouncy",idle:"fidgety",energy:.8});break}case "slime":case "ghost":case "robot":{n="blob",s=Ar("body",[2,3,8,5]),e.kind==="slime"?(i("body","body",[12,10,12],[0,5,0],"t"),l={walk:"bouncy",idle:"fidgety",energy:.9}):e.kind==="ghost"?(i("body","body",[10,12,10],[0,7,0],"t"),i("hem","body",[10.4,2,10.4],[0,1,0],"l",{shape:"cylinder"}),l={walk:"sneaky",idle:"calm",energy:.4}):(i("body","body",[11,11,10],[0,5.5,0],"t"),i("antenna","body",[.8,3,.8],[0,12.5,0],"a"),i("bulb","body",[1.6,1.6,1.6],[0,14.6,0],"l"),i("screen","body",[9,6,.4],[0,6.5,-4.82],"l"),l={walk:"robotic",idle:"calm",energy:.5});break}default:{let u=as(e.kind,i);n=u.rig,l=u.style,u.face&&(s=Ar(u.face.bone,u.face.rect)),Object.assign(o,u.palette);}}Dl(a);let c=e.kind==="slime"||e.kind==="ghost"?"body":"head";for(let u of a)u.name===c&&u.bone===s.face.bone&&(u.shape="cylinder");let[p,h,m,d]=s.face.rect,b=[p+m*ns,h,m*(1-2*ns),d];return {version:1,name:e.name,description:e.description??"",rig:n,palette:o,textures:s.textures,parts:a,face:{...s.face,rect:b,drawn:{...Nl(e.kind),eyeColor:e.eyes??Bl}},style:l,finish:Fl,tags:e.tags??[e.kind]}}var Fl={noise:0,outline:0,shade:.12,density:4,round:.35},dr=1.5;function Dl(e){let t=e,r=p=>p.size[0]*p.size[1]*p.size[2],o=p=>t.filter(h=>h.bone===p).sort((h,m)=>r(m)-r(h))[0],a=o("body");if(!a)return;let n=(p,h)=>p.pos[h]-p.size[h]/2,s=(p,h)=>p.pos[h]+p.size[h]/2;for(let p of ["legFL","legFR","legBL","legBR","legL","legR"]){let h=o(p);if(!h||s(h,1)>n(a,1)+dr||s(h,1)<n(a,1)-3)continue;let m=n(h,1),d=n(a,1)+dr;h.size[1]=d-m,h.pos[1]=(d+m)/2;}let l=(p,h,m)=>{for(let d of t)d.bone===p&&(d.pos[h]=d.pos[h]+m);},i=o("head");if(i&&i.pos[2]<n(a,2)){let p=n(a,2)+dr-s(i,2);p>0&&l("head",2,p);}let c=o("tail");if(c&&c.pos[2]>s(a,2)){let p=n(c,2)-(s(a,2)-dr);p>0&&l("tail",2,-p);}for(let p of [o("wingL"),o("finL")]){if(!p)continue;let h=n(a,0)+dr,m=s(p,0);m<h&&(p.size[0]=p.size[0]+(h-m),p.pos[0]=p.pos[0]+(h-m)/2);}if(i)for(let p of t){if(p.bone!=="head"||p===i)continue;let h=n(p,1)-(s(i,1)-dr/2);h>0&&n(p,1)<s(i,1)+.6&&(p.pos[1]=p.pos[1]-h);}}var Bl="#2a1c14",ns=.07;function Nl(e){let t=(r,o,a=true)=>({eyes:r,brows:"none",mouth:o,cheeks:a});switch(e){case "cat":case "fox":case "lion":case "tiger":return t("cat","cat");case "dog":case "wolf":case "rabbit":case "mouse":case "raccoon":case "hedgehog":return t("round","cat");case "dragon":return t("almond","fang",false);case "slime":return t("sparkle","smile");case "ghost":return t("round","open",false);case "robot":return t("button","smile",false);case "owl":case "frog":return t("wide","smile");case "shark":return t("narrow","teeth",false);case "fish":return t("round","pout",false);case "bat":return t("round","fang");case "bee":case "turtle":return t("button","smile");default:return t("round","small")}}function ym(e){let t=Ye(Vl(e));if(!t.ok)throw new Error(`${e.kind}: ${t.error}`);return t.spec}var ss={torso:"#d9d3c5",legs:"#5f6b7a"},Hl="#2b2140",jl="#7a2e2e",Gl="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",ql=32,Ul=[10,7],jr=1,Kl={noise:0,outline:0,shade:.12,density:4,round:.35},Yl=["front","back","left","right"];function is(e){let t=parseInt(e.slice(1),16);return [t>>16&255,t>>8&255,t&255]}var wa=class{map={};next=0;key(t){let r=Object.entries(this.map).find(([,i])=>i===t);if(r)return r[0];if(this.next<ql){let i=Gl[this.next++];return this.map[i]=t,i}let[o,a,n]=is(t),s=Object.keys(this.map)[0],l=1/0;for(let[i,c]of Object.entries(this.map)){let[p,h,m]=is(c),d=(o-p)**2+(a-h)**2+(n-m)**2;d<l&&(l=d,s=i);}return s}};function Wl(e,t){return (typeof e=="function"?e(t):e[t])??null}function $l(e){let[t,r]=Ul,o=new U(t,r),a=n=>{n(1),n(6);};switch(e){case "blink":case "tired":a(n=>o.row(3,n,n+2,"k"));break;case "happy":a(n=>o.px(n,3,"k").px(n+1,2,"k").px(n+2,3,"k"));break;case "hurt":o.px(1,2,"k").px(2,3,"k").px(1,4,"k"),o.px(8,2,"k").px(7,3,"k").px(8,4,"k");break;case "surprised":case "scared":a(n=>o.rect(n,2,3,3,"w").px(n+1,3,"k"));break;default:a(n=>o.rect(n,2,3,3,"w").rect(n+1,3,2,2,"e").px(n+1,3,"k"));}switch(e==="angry"&&o.px(1,1,"k").px(2,1,"k").px(3,2,"k").px(8,1,"k").px(7,1,"k").px(6,2,"k"),e==="sad"&&o.px(3,1,"k").px(2,1,"k").px(6,1,"k").px(7,1,"k"),e){case "happy":case "talk":o.rect(4,5,2,2,"m");break;case "surprised":o.rect(4,5,2,2,"m");break;case "sad":o.px(3,6,"m").row(5,4,5,"m").px(6,6,"m");break;case "angry":case "tired":case "scared":case "hurt":o.row(6,4,5,"m");break;default:o.px(3,5,"m").row(6,4,5,"m").px(6,5,"m");}return o.tex()}function Ra(e,t){let r=Ae[Qt],o=new wa,a=o.key(e.body.skin),n=r.defaultParts.map(d=>({...d,size:[...d.size],pos:[...d.pos],color:d.name==="torso"?o.key(ss.torso):d.name?.startsWith("leg")||d.name?.startsWith("foot")?o.key(ss.legs):a})),s=new Map;for(let d of n){let b=s.get(d.name)??[];b.push(d),s.set(d.name,b);}for(let d of s.values())d.sort((b,u)=>u.pos[1]+u.size[1]/2-(b.pos[1]+b.size[1]/2));let l=(e.body.head??ba)==="round";if(l)for(let d of n)d.name==="head"?(d.shape="cylinder",d.size=[d.size[0],d.size[1]+jr,d.size[2]],d.pos=[d.pos[0],d.pos[1]+jr/2,d.pos[2]]):d.name==="neck"&&(d.size=[2.6,1.8,2.4],d.pos=[0,23.1,0]);let i={},c={k:o.key(Hl),w:o.key("#ffffff"),e:o.key(e.face.eyeColor),m:o.key(jl)},p={};for(let d of wr){let b=$l(d),u="face_"+d;i[u]={...b,rows:b.rows.map(R=>[...R].map(w=>c[w]??w).join(""))},p[d]=u;}p.neutral=p[d$1[e.face.emotion]]??p.neutral;for(let d of Kt){let b=e.wear[d];if(!b)continue;let u=Wl(t,b);if(!u||u.slot!==d||u.style!==je)continue;let R={};for(let[x,f]of Object.entries(u.palette))R[x]=f===qt?a:o.key(x===u.tint&&e.tint[d]?e.tint[d]:f);let w={};for(let[x,f]of Object.entries(u.textures)){let S=`${d}_${x}`;w[x]=S,i[S]={w:f.w,h:f.h,rows:f.rows.map(T=>[...T].map(C=>R[C]??C).join(""))};}let A=x=>{if(!x)return;let f={};for(let[S,T]of Object.entries(x)){let C=w[T]??R[T];C&&(f[S]=C);}return Object.keys(f).length?f:void 0};for(let x of u.paint){let f=s.get(x.region);if(!f)continue;let S=R[x.color],T=A(x.faces);f.forEach((C,z)=>{S&&(C.color=S);let _=T&&Xl(T,f,z,i);_?C.faces=_:delete C.faces;});}let k=d==="hair"||d==="hat"||d==="faceAcc"&&!u.parts.some(x=>x.mat);for(let x of u.parts){let f={bone:x.bone,size:[...x.size],pos:[...x.pos],color:R[x.color]??a},S=A(x.faces);if(S&&(f.faces=S),x.rot&&(f.rot=[...x.rot]),x.mirror&&(f.mirror=true),x.name&&(f.name=x.name),x.mat&&(f.mat=x.mat),l&&x.bone===r.faceBone){let T=d==="hair"||d==="hat"?jr:jr/2;f.pos=[f.pos[0],f.pos[1]+T,f.pos[2]],k&&(f.wrap=true);}n.push(f);}}let h={version:1,name:"Avatar",description:"",rig:Qt,scale:e.body.height,palette:o.map,textures:i,parts:n,bones:[],face:{bone:r.faceBone,rect:l?[Et[0],Et[1]+jr/2,Et[2],Et[3]]:[...Et],expressions:p},style:{walk:e.anim?.walk??At.walk,idle:e.anim?.idle??At.idle,energy:.6},voice:{pitch:1},tags:["avatar",je],finish:{...Kl}},m=Ye(h);if(!m.ok)throw new Error("composeAvatar: "+m.error);return m.spec}function Xl(e,t,r,o){if(t.length===1)return {...e};let a=t[0].pos[1]+t[0].size[1]/2,n=Math.min(...t.map(c=>c.pos[1]-c.size[1]/2)),s=Math.max(1e-6,a-n),l=c=>c<=0?0:c>=t.length?1:(a-(t[c-1].pos[1]-t[c-1].size[1]/2))/s,i={};for(let[c,p]of Object.entries(e)){let h=o[p];if(!h){i[c]=p;continue}if(c==="top"){r===0&&(i[c]=p);continue}if(c==="bottom"){r===t.length-1&&(i[c]=p);continue}if(!Yl.includes(c))continue;let m=Math.min(h.h-1,Math.round(l(r)*h.h)),d=Math.max(m+1,Math.round(l(r+1)*h.h)),b=`${p}_${r}`;o[b]||(o[b]={w:h.w,h:d-m,rows:h.rows.slice(m,d)}),i[c]=b;}return Object.keys(i).length?i:void 0}var Jl={paths:[{x:243,y:-2,d:"M147.333 12.333c-13.6 2.534-12.533 1.2-12.933 15.067l-.4 12.267-4.533-11.067c-2.534-6-5.067-10.933-5.734-10.933-2.666 0-27.866 8.666-36.533 12.666-11.733 5.334-26.667 14.8-36.133 22.934l-6.934 5.866L51.6 69.267c8.133 11.066 7.333 11.466-5.067 2.933-7.6-5.067-8.4-5.333-11.466-3.733-3.467 1.866-18.4 17.333-20.4 21.2-.8 1.6 7.066 8.8 33.733 30.933l34.667 28.933 8.8-8.266c14.666-13.867 28.666-22 48.133-28.267 9.067-2.933 14.8-3.733 28.533-4.4 34.267-1.333 60 7.467 81.6 28.133 21.6 20.4 34.934 49.6 37.467 81.734l.8 11.2 14.8 4.533c8.133 2.533 23.733 7.333 34.667 10.8 10.933 3.333 20.4 5.6 21.066 4.933 1.6-1.6 6.134-20.533 7.734-32.666.8-6 1.333-17.6 1.066-25.6l-.4-14.667-8-1.067c-4.4-.533-10.133-1.466-12.666-1.866l-4.667-.8 4.667-1.2c16.933-4.534 18.666-5.2 18.666-8 0-5.467-9.6-31.334-16.666-44.8-4-7.6-10.667-18.667-14.934-24.667-9.866-13.867-31.333-35.467-45.2-45.2-10.4-7.467-34.4-20.933-37.2-21.067-.8 0-4 4-7.333 8.8-3.2 4.8-6.133 8.134-6.4 7.334s.4-5.6 1.6-10.667c1.2-5.2 2.133-9.6 2.133-9.867 0-.933-19.866-6.133-34.4-9.066-14.8-2.934-49.333-4.4-59.6-2.534"},{x:243,y:-2,d:"M157.867 125.533c-21.067 3.334-42.134 14.8-57.467 31.334-13.333 14.133-13.733 12.8 5.6 22 9.2 4.4 16.667 8.266 16.667 8.533s-1.334.4-2.934.133c-13.866-2.133-41.6-5.866-41.733-5.6-.267.267-7.467 28.534-16.267 63.067l-16 62.667 7.334.4c4 .266 7.466.266 7.6 0 .266-.267 3.866-13.867 8.133-30.4 4.267-16.534 8.267-30.8 8.933-31.734.934-1.2 11.067-1.6 42.4-1.6 32.134 0 41.2.4 41.2 1.6 0 .934-1.733 4.667-3.866 8.4L153.733 261l-35.066 6.933c-19.334 3.867-35.2 7.2-35.467 7.467-.667.667-29.867 113.467-29.467 113.867.267.133 23.734-3.6 52.4-8.534l52-8.8 20.4-39.866c11.2-22 20.667-39.734 20.934-39.467.4.533-1.334 26.8-2.8 40.8l-.667 6.933 6.267-3.2c21.2-10.666 52.4-13.466 86.933-8l5.867.934-5.6-7.334C286.4 318.6 281.2 310.6 278 304.867c-5.867-10.134-6-10.8-6-21.867 0-6.267 1.467-20 3.333-30.667 1.867-10.666 3.334-19.466 3.334-19.466 0-.134-9.067-4.267-20.134-9.334s-19.466-9.333-18.8-9.6c.8-.266 7.734.8 15.6 2.267 7.734 1.6 14.4 2.8 14.8 2.8 1.2 0 .4-10.533-1.466-18-7.2-27.733-28-53.467-53.734-66-16.4-8-40.8-12-57.066-9.467"},{x:243,y:-2,d:"M235.6 346.333c-24 4.534-44.133 13.867-68.267 31.467-14 10.267-28.533 18.133-47.733 25.867-23.467 9.466-52.8 32.666-64.4 50.666l-2.533 4L58 454.2c9.333-7.333 30.133-19.467 49.333-28.667C173.733 393.667 246.4 382.2 312.8 393c11.2 1.733 39.2 8.533 45.067 10.8 2.266.8 2.266.667.8-2.267-4-7.6-15.6-21.866-25.867-31.466-12-11.467-24.667-18.934-37.6-22.4-11.467-3.067-46.267-3.867-59.6-1.334"},{x:-460,y:467,d:"M721.533 34.467c-14.933 5.466-22 17.466-22.933 38.666-.933 24.134 3.467 32.8 30.267 59.867 19.6 19.867 22.933 25.2 22.933 37.867.133 13.466-6.133 20.133-16.933 18.4-9.067-1.467-12.534-7.867-12.534-22.667V159H696.6l.667 13.333c.533 11.467 1.2 14.4 4.933 22 7.067 14.267 16.8 19.6 36.4 19.734 10.667.133 12.267-.134 20.667-4.4 7.6-3.867 9.733-5.867 13.2-11.734 7.6-12.533 9.066-32 3.733-47.6-3.733-11.066-10.667-20.4-27.867-37.2-19.866-19.6-22.533-24.133-22.666-38.4 0-8.933.4-10.533 3.2-13.6 6.266-6.666 18.266-5.6 22.133 2 1.067 2 2 7.067 2 11.2v7.334h27.067l-.934-9.2c-1.6-18.267-8.266-30.267-20-36.4-7.2-3.867-29.2-4.8-37.6-1.6M630.067 34.867c-11.734 4.666-18 11.6-21.734 24.4-1.866 6.4-2 15.333-1.733 67.2l.4 59.866 3.733 7.6c6.8 13.867 18.534 20.267 36.934 20.267 13.733 0 22.933-3.333 30.666-11.067 10.934-11.066 11.2-12.533 11.734-74.666.266-35.734-.134-56.934-1.067-62.8-2.667-16.134-11.6-27.467-24.8-31.467-8.933-2.667-26.4-2.267-34.133.667m28.666 26.8 3.6 4v56.666c0 40.934-.4 57.467-1.6 60-3.6 8-15.6 9.734-22.666 3.467l-4.4-3.867-.4-56.533c-.267-51.733-.134-56.8 2-61.067 3.066-5.866 7.6-8.266 14.4-7.466 3.733.4 6.4 1.866 9.066 4.8M511.667 123.133v89.334l29.066-.4c28.8-.4 28.934-.4 36.667-4.267 9.467-4.533 14.4-10.933 17.467-22.4 2-7.333 2.266-15.467 1.866-65.733l-.4-57.334-4.266-8.8c-8.267-16.666-17.2-19.866-55.334-19.866h-25.066zm53.6-60.266 4.4 3.866.4 52.8c.266 35.067-.134 54.4-1.067 58-2 7.467-5.733 9.6-18.667 10.4l-10.666.8V59h10.666c9.867 0 10.934.267 14.934 3.867M471.667 145v67.333h26.666V77.667h-26.666zM471.667 48.333V63h26.666V33.667h-26.666z"},{x:-106,y:244,d:"M893.4 259.733c-6.8 3.467-9.2 5.6-12.667 11.467-10.666 17.733-9.2 42.933 3.467 62.267 2.8 4.266 12.267 14.8 20.933 23.333 9.867 9.467 17.067 17.733 18.934 21.6 5.6 11.333 5.2 25.333-.934 30.8-3.466 3.067-11.333 4.133-16.133 2.133-5.867-2.4-8-7.466-8-19.333v-10h-27.067l.8 11.6c1.2 15.867 3.867 24.133 10.267 31.333 7.467 8.534 16.4 12.134 30 12.267 19.067.133 30.133-5.733 37.333-19.867 3.734-7.466 4-8.666 4-24 0-16 0-16.133-5.2-26.666-4.4-9.2-7.733-13.2-23.066-28.534-21.067-21.066-24.8-27.066-24.934-40.4-.133-10.4 2.8-15.6 9.734-17.6 10.133-2.933 17.2 3.334 18.4 16.267l.8 8.267H955.4l-.8-10.8c-.533-8.4-1.6-12.667-4.8-19.2-7.067-14.134-16.667-19.334-36.133-19.334-10.667 0-12.534.4-20.267 4.4M791 346v89.333h76v-24h-48v-54.666h37.333v-24H819V282h48v-25.333h-76zM661.667 346v89.333h22.666l.134-63.066c0-34.534.533-61.734 1.066-60.267.534 1.467 5.467 29.867 10.8 62.933l9.867 60.4h13.067c7.2 0 13.066-.4 13.066-1.066 0-3.067 18.8-124.8 19.334-125.334.4-.4.666 27.867.666 62.8v63.6h25.334V256.667h-38l-9.2 61.6c-5.067 34-9.6 62.133-10 62.666-.534.534-5.334-26.4-10.667-60-5.467-33.466-10.133-61.733-10.533-62.666-.4-1.2-5.467-1.6-19.067-1.6h-18.533zM586.467 258.267c-.8 2.666-27.467 172.4-27.467 174.933 0 1.867 1.733 2.133 12 2.133h11.867l.8-4.4c.533-2.266 1.6-9.333 2.4-15.6l1.6-11.333 17.6-.4 17.466-.4 1.467 8.4c.8 4.667 1.733 11.867 2.267 16l.933 7.733h13.733c7.6 0 13.867-.266 13.867-.666 0-.8-26.533-168.134-27.467-173.734l-.8-4.266h-19.866c-14.8 0-20.134.4-20.4 1.6M613 336.533c3.333 23.067 5.867 42.134 5.6 42.4-.4.267-6.533.267-13.867.134l-13.2-.4 4.934-33.334c2.8-18.4 5.733-38.4 6.666-44.666C604.2 292.533 605 290.133 605.8 292c.533 1.467 3.867 21.467 7.2 44.533M497.267 257.2c-10.134 3.733-15.2 8.267-19.867 17.733L473 284l-.4 59.067c-.4 51.2-.133 60.133 1.733 66.533 5.6 19.333 17.067 27.333 39.467 27.467 10.267.133 12.267-.267 20.133-4.134 9.334-4.533 13.867-9.733 17.867-20.266 2-4.934 2.4-12 2.933-41.067l.534-34.933h-38.934v23.866l6.4.4 6.267.4v19.334c0 13.466-.533 20.666-1.867 23.733-5.066 12-23.333 10.4-26.8-2.4-.933-3.6-1.333-23.2-1.066-59.067.4-48.533.666-54.133 2.666-57.333 3.334-4.8 11.2-7.067 17.6-4.933 6.934 2.266 9.067 7.2 9.867 22.933l.667 13.067H555.4l-.8-15.734c-.8-18-3.067-25.6-9.867-33.466-7.466-8.8-13.466-11.2-29.066-11.734-9.067-.266-14.934.134-18.4 1.467"}]},Ql={helmet:{paths:[0,1,2],box:[258,10,353,447]},wordmark:{paths:[3,4],box:[12,499,837,182]}},Zl={"top.idos":{color:"#f8f8fc",faces:["front","back"],layers:[{art:"helmet",y:19.4,z:2.3,height:3.9},{art:"wordmark",y:14.85,z:2.15,width:6.2}]}},ls=512,ps=.02,cs=new Map;function ec(e,t){if(typeof document<"u"){let r=document.createElement("canvas");return r.width=e,r.height=t,r}return new OffscreenCanvas(e,t)}function tc(e,t,r){let o=`${e}:${r}`,a=cs.get(o);if(a)return a;if(typeof Path2D>"u")return null;let[n,s,l,i]=t.box,c=i*ps,p=ls/(i+2*c),h=ec(Math.round((l+2*c)*p),ls),m=h.getContext("2d");if(!m)return null;m.clearRect(0,0,h.width,h.height),m.fillStyle=r;for(let b of t.paths){let u=Jl.paths[b];m.setTransform(p,0,0,p,(u.x-n+c)*p,(u.y-s+c)*p),m.fill(new Path2D(u.d));}let d=new B.CanvasTexture(h);return d.colorSpace=B.SRGBColorSpace,d.anisotropy=4,cs.set(o,d),d}function ka(e){let t=[];for(let r of Kt){let o=e.wear[r],a=o?Zl[o]:void 0;if(a)for(let n of a.layers){let s=Ql[n.art],l=tc(n.art,s,a.color);if(!l)continue;let[,,i,c]=s.box,p=i/c,h=n.height??(n.width??1)/p,m=n.width??h*p,d=2*ps*h;for(let b of a.faces){let u=(b==="front"?-1:1)*(n.z+.03),R=[0,n.y,u];t.push({bone:"body",center:R,w:m+d,h:h+d,facing:b,texture:l});}}}return t}var So=class extends vo{face;rest;mood="neutral";constructor(t,r,o={}){let a=new hr(t.face);super(Ra(t,r),{gloss:true,shadows:true,...o,facePainter:a}),this.face=a,this.rest=t.face.emotion,this.view.setPrints(ka(t)),this.applyMood();}setEmotion(t){this.mood=t,this.applyMood();}setAvatar(t,r){this.face.setFace(t.face),this.rest=t.face.emotion,this.setSpec(Ra(t,r)),this.view.setPrints(ka(t)),this.applyMood();}applyMood(){super.setEmotion(this.mood==="neutral"?this.rest:this.mood),this.animator.moodOverGestures=this.rest!=="neutral";}dispose(){super.dispose(),this.face.dispose();}};var oc=1.12,ac=.25,ms=1.6;function hs(e){e.outputColorSpace=B.SRGBColorSpace,e.toneMapping=B.NeutralToneMapping,e.toneMappingExposure=oc,e.shadowMap.enabled=true,e.shadowMap.type=B.PCFShadowMap;let t=new B.PMREMGenerator(e),r=new RoomEnvironment,o=t.fromScene(r,.04).texture;return r.dispose(),t.dispose(),{light(a){a.environment=o,a.environmentIntensity=ac,a.add(new B.HemisphereLight(14543103,8019024,.6));let n=new B.DirectionalLight(16772829,3.4);n.position.set(4,4.4,-2.2),n.castShadow=true;let s=n.shadow.camera;s.left=s.bottom=-ms,s.right=s.top=ms,s.near=.5,s.far=12,n.shadow.mapSize.set(1024,1024),n.shadow.bias=-5e-4,n.shadow.normalBias=.02,n.shadow.radius=4,n.shadow.intensity=.55,n.target.position.set(0,1,0),a.add(n,n.target);let l=new B.DirectionalLight(13623551,.45);l.position.set(-3,.8,-3),a.add(l);let i=new B.DirectionalLight(14478591,2.6);i.position.set(-3.2,2.6,2.6),a.add(i);},dispose(){o.dispose();}}}function nc(e){if(e==="walk")return .3;if(e==="idle")return 1.2;let t=$e[e];return t.loop?1:t.duration*.4}var Bm=["#a99cff","#5b4bd6"];function sc(e,t){switch(t){case "full":return {center:new B.Vector3(0,e*.5,0),size:e*1.12,lift:.04};case "torso":return {center:new B.Vector3(0,e*.57,0),size:e*.5,lift:.06};case "legs":return {center:new B.Vector3(0,e*.2,0),size:e*.5,lift:.1};case "feet":return {center:new B.Vector3(0,e*.08,0),size:e*.32,lift:.3};case "face":return {center:new B.Vector3(0,e*.86,0),size:e*.34,lift:.04};case "head":return {center:new B.Vector3(0,e*.88,0),size:e*.5,lift:.08};default:return {center:new B.Vector3(0,e*.8,0),size:e*.56,lift:.08}}}function ic(e){let t=e.view.spec.parts,r=t.find(a=>a.name==="head"),o=0;for(let a of t)o=Math.max(o,a.pos[1]+a.size[1]/2);return !r||o<=0?e.height:Math.min(e.height,e.height*(r.pos[1]+r.size[1]/2)*lc/o)}var lc=1.022;function cc(e){return typeof e=="number"?e:e==="side"?Math.PI/2:e==="back"?Math.PI:.18}function ds(e,t,r,o,a,n,s){let l=s.frame??"portrait",i={...a,face:{...a.face,emotion:"neutral"}},c=new So(i,n,{seed:7});try{e.setClearColor(0,0);let p=new B.Scene;t.light(p),c.group.rotation.y=cc(s.view),p.add(c.group);for(let f=0;f<20;f++)c.update(1/30);let h=s.motion;if(h){h==="walk"?c.setPose("walk"):h!=="idle"&&c.playEmote(h);let f=Math.round(Math.max(0,s.at??nc(h))*30);for(let S=0;S<f;S++)c.update(1/30);}if(!h||h==="walk"||h==="idle"||s.expression){let f=s.expression??a.face.emotion;c.view.setExpression(lr[f][0],f);}let{center:m,size:d,lift:b}=sc(l==="full"||l==="head"?c.height:ic(c),l),u=28,R=new B.PerspectiveCamera(u,1,.05,50),w=d/2/Math.tan(B.MathUtils.degToRad(u/2));R.position.set(m.x,m.y+d*b,m.z-w),R.lookAt(m),e.render(p,R);let A=document.createElement("canvas");A.width=o,A.height=o;let k=A.getContext("2d");if(!k)return r;let x=s.background;if(typeof x=="string")k.fillStyle=x,k.fillRect(0,0,o,o);else if(x){let f=k.createRadialGradient(o*.5,o*.38,o*.05,o*.5,o*.5,o*.72);f.addColorStop(0,x[0]),f.addColorStop(1,x[1]),k.fillStyle=f,k.fillRect(0,0,o,o);}return k.imageSmoothingEnabled=!s.pixelated,k.drawImage(r,0,0),A}finally{c.dispose();}}function us(e,t){let r=document.createElement("canvas");r.width=e,r.height=e;let o=new B.WebGLRenderer({canvas:r,antialias:!t,alpha:true,preserveDrawingBuffer:true});return o.setPixelRatio(1),o.setSize(e,e,false),{renderer:o,lighting:hs(o),gl:r}}function fs(e){e.lighting.dispose(),e.renderer.dispose(),e.renderer.forceContextLoss();}function pc(e,t,r={}){let o=Math.max(16,Math.round(r.size??256)),a=us(o,!!r.pixelated);try{return ds(a.renderer,a.lighting,a.gl,o,e,t,r)}finally{fs(a);}}function bs(e={}){let t=Math.max(16,Math.round(e.size??256)),r=us(t,!!e.pixelated);return {render(o,a,n={}){if(!r)throw new Error("snapshotter disposed");return ds(r.renderer,r.lighting,r.gl,t,o,a,{...n,pixelated:e.pixelated})},dispose(){r&&(fs(r),r=null);}}}function Nm(e,t,r={}){let o=pc(e,t,r);return new Promise(a=>o.toBlob(n=>a(n),"image/png"))}function Hm(e){if(!e?.spec)return null;let t={};for(let r of e.items??[])r&&typeof r.id=="string"&&(t[r.id]=r);return {spec:cr(e.spec),items:t}}function Me(e,t){let r=pr(e);if(!r.ok)throw new Error(`avatar set: ${String(e.id)}: ${r.errors.join("; ")}`);return t===void 0?{item:r.item}:{item:r.item,price:t}}var Z=e=>({w:e[0].length,h:e.length,rows:e}),g=(e,t,r,o={})=>({bone:"head",size:e,pos:t,color:r,...o}),L=(e,t,r,o={})=>({bone:"body",size:e,pos:t,color:r,...o}),W=(e,t,r,o,a={})=>({bone:e,size:t,pos:r,color:o,mirror:true,...a});var tt=(e,t,r,o,a,n)=>Me({id:`back.${e}`,slot:"back",name:t,palette:r,tint:o,parts:a},n),St=(e,t,r,o,a,n)=>Me({id:`neck.${e}`,slot:"neck",name:t,palette:r,tint:o,parts:a},n),le={mirror:true},ys=[L([2.25,7.5,1.47],[1.69,21.15,3.04],"b",le),L([10.13,3.13,.74],[7.31,26.15,3.86],"a",le),L([10.13,3.13,.74],[7.88,23.03,4.05],"b",le),L([9,3.13,.74],[8.44,19.9,4.23],"a",le),L([6.75,3.13,.74],[9,16.77,4.42],"b",le),L([4.5,3.13,.74],[9.56,13.65,4.6],"a",le)],gs=[tt("shield","Round shield",{a:"#a32d2d",b:"#d8b030",c:"#5a3a22"},"a",[L([8,8,.8],[0,17.5,3.4],"a"),L([8.6,.8,1],[0,21.6,3.4],"c"),L([8.6,.8,1],[0,13.4,3.4],"c"),L([2.2,2.2,.8],[0,17.5,4.2],"b",{mat:"metal"})]),tt("skateboard","Skateboard",{a:"#2ab0c0",b:"#1d1d21",c:"#f4f1ea"},"a",[L([3,11,.5],[0,18,3.4],"a"),L([1,1,1],[1,13.4,3.9],"c",le),L([1,1,1],[1,22.6,3.9],"c",le)]),tt("rocketpack","Rocket pack",{a:"#c8ccd2",b:"#2b2140",f:"#ff8a2a"},null,[L([2.6,7,2.6],[1.6,17.5,3.8],"a",{mirror:true,mat:"metal"}),L([1.8,.8,1.8],[1.6,13.6,3.8],"b",le),L([1.4,3,1.4],[1.6,11.6,3.8],"f",{mirror:true,mat:"glow"}),L([2.8,.8,2.8],[1.6,21.4,3.8],"b",le)],250),tt("guitar","Guitar",{a:"#c0612b",b:"#3a2414",c:"#1d1d21"},"a",[L([5,5,1.4],[0,12.5,3.6],"a"),L([1,9,.8],[0,19.5,3.6],"b"),L([1.6,1.8,.9],[0,24.9,3.6],"b"),L([1.4,1.4,.2],[0,12.8,4.35],"c")],150),tt("batwings","Bat wings",{a:"#3c2f5a",b:"#241a3a"},"a",ys,200),tt("dragonwings","Dragon wings",{a:"#3c9a3c",b:"#2a6a2a",c:"#e8d27a"},"a",[...ys.slice(0,5),L([1,1.6,1],[12.2,28.3,3.86],"c",le)],250),tt("butterfly","Butterfly wings",{a:"#f2a03a",b:"#2b2140"},"a",[L([6,7,.4],[4.2,21,3.2],"a",le),L([4.6,5,.4],[3.6,15,3.2],"a",le),L([1.4,1.4,.3],[5,22.4,3.5],"b",le),L([1,1,.3],[3.8,15,3.5],"b",le)],180),tt("fairy","Fairy wings",{a:"#c8f0ff",b:"#f6c8ff"},"a",[L([4.6,7,.3],[3.5,22,3],"a",{mirror:true,mat:"glass"}),L([3.4,4.6,.3],[3,16,3],"b",{mirror:true,mat:"glass"})],200),tt("quiver","Quiver",{a:"#7a4f2a",b:"#c8ccd2",c:"#f4f1ea"},"a",[L([2.4,8,2.4],[1.8,20,3.8],"a"),L([.4,3,.4],[1.2,25.5,3.6],"b"),L([.4,3,.4],[2.4,25.8,4],"b"),L([.8,.8,.3],[1.2,27.2,3.6],"c"),L([.8,.8,.3],[2.4,27.5,4],"c")],120),tt("shell","Turtle shell",{a:"#4c8a3a",b:"#2f5a24",c:"#c8b070"},"a",[L([8.6,9,2.8],[0,17.5,3.6],"a"),L([9.2,.9,3],[0,13,3.6],"c"),L([4,4,.4],[0,18,5.15],"b")],150)],xs=[St("scarf","Scarf",{a:"#c0392b",b:"#f4f1ea"},"a",[L([6,1.8,5.4],[0,22.5,0],"a"),L([1.6,4.5,.6],[1.2,19.4,-2.7],"a"),L([1.6,3.4,.6],[-0.6,19.9,-2.95],"b")]),St("bowtie","Bow tie",{a:"#c0392b"},"a",[L([.6,.7,.6],[0,21.9,-2.6],"a"),L([1.2,1.2,.4],[.85,21.9,-2.55],"a",le)]),St("bandana","Neck scarf",{a:"#2f5fd0"},"a",[L([6,1.4,5],[0,22.4,0],"a"),L([4,1.6,.6],[0,21,-2.6],"a"),L([2.4,1.2,.6],[0,19.8,-2.6],"a"),L([1,.8,.6],[0,19,-2.6],"a")]),St("chain","Gold chain",{a:"#e8b730"},null,[L([5.4,.5,4.8],[0,22.3,0],"a",{mat:"metal"}),L([.5,2.2,.4],[0,21,-2.55],"a",{mat:"metal"}),L([1.2,1.2,.4],[0,19.6,-2.6],"a",{mat:"metal"})],150),St("medal","Medal",{a:"#e8b730",b:"#2f5fd0"},"b",[L([5.4,.5,4.8],[0,22.3,0],"b"),L([1.2,3.4,.3],[0,20.4,-2.5],"b"),L([1.6,1.6,.4],[0,18.3,-2.6],"a",{mat:"metal"})],120),St("heart","Heart pendant",{a:"#e8436b",b:"#c8ccd2"},"a",[L([5.4,.4,4.8],[0,22.3,0],"b",{mat:"metal"}),L([.3,2.4,.3],[0,20.9,-2.5],"b",{mat:"metal"}),L([1.4,1.2,.4],[0,19.3,-2.6],"a"),L([.7,.5,.4],[.35,20,-2.6],"a",le)],100),St("lei","Flower lei",{a:"#4c9a4a",b:"#f08cb4",c:"#f2d33c",d:"#f4f1ea",e:"#ef9f27"},null,[L([6,1,5.4],[0,22.4,0],"a"),L([1.3,1.3,1.3],[2.4,21.4,-2.6],"b",le),L([1.3,1.3,1.3],[0,20.9,-2.8],"c"),L([1.3,1.3,1.3],[3,22,0],"d",le),L([1.3,1.3,1.3],[2,21.8,2.6],"e",le)],120),St("headphones","Headphones on the neck",{a:"#2b2140",b:"#4be0c8"},"b",[L([1.4,2,2.2],[3.6,22.2,-0.2],"a",le),L([.3,1.4,1.6],[4.35,22.2,-0.2],"b",{mirror:true,mat:"glow"}),L([6,.7,.8],[0,21.6,2.2],"a")],150)];var va=e=>({front:e,back:e,left:e,right:e}),rt=(e,t,r,o,a,n)=>Me({id:`bottom.${e}`,slot:"bottom",name:t,palette:r,tint:o,textures:a.textures??{},paint:a.paint,parts:a.parts??[]},n),ws=[rt("sweatpants","Sweatpants",{a:"#8a8f98",b:"#6a6f78"},"a",{paint:[{region:"legs",color:"a"}],parts:[W("shinR",[4.4,1,4.4],[2.1,1.4,0],"b")]}),rt("leggings","Leggings",{a:"#1d1d21",w:"#f4f1ea"},"a",{textures:{st:Z(["aawa","aawa","aawa","aawa"])},paint:[{region:"legs",color:"a",faces:{left:"st",right:"st"}}]}),rt("pleated","Pleated skirt",{a:"#2b2140",b:"#3c3450",s:"@skin"},"a",{textures:{pl:Z(["abababab","abababab","abababab","abababab"])},paint:[{region:"legs",color:"s"}],parts:[L([10.4,4.8,5.6],[0,11.3,0],"a",{faces:va("pl")})]}),rt("joggers","Joggers",{a:"#2f5fd0",b:"#1d3f90"},"a",{paint:[{region:"legs",color:"a"}],parts:[W("shinR",[4.3,1.2,4.3],[2.1,1.3,0],"b")]}),rt("plaidskirt","Plaid skirt",{a:"#a32d2d",b:"#2b2140",s:"@skin"},"a",{textures:{pl:Z(["abaabaab","bbbbbbbb","abaabaab","abaabaab","bbbbbbbb","abaabaab"])},paint:[{region:"legs",color:"s"}],parts:[L([10.13,4.38,5.52],[0,11.46,0],"a",{faces:va("pl")})]},100),rt("denimshorts","Denim shorts",{a:"#3f6fd8",b:"#6a8fe8",s:"@skin"},"a",{paint:[{region:"legs",color:"s"}],parts:[W("legR",[4.62,5.4,4.62],[2.1,9.7,0],"a"),W("legR",[4.8,.8,4.8],[2.1,7.3,0],"b")]},80),rt("ripped","Ripped jeans",{a:"#2f5fd0",s:"@skin"},"a",{textures:{rp:Z(["aaaa","asaa","aaaa","aaaa","assa","aaaa"])},paint:[{region:"legs",color:"a",faces:{front:"rp"}}]},100),rt("camo","Camo pants",{a:"#5a6b3a",b:"#3a4a28",c:"#8a8a5a"},"a",{textures:{cm:Z(["aabbac","abbaac","caabba","ccaaba","abccaa","aabcca"])},paint:[{region:"legs",color:"a",faces:va("cm")}]},120),rt("tutu","Tutu",{a:"#f08cb4",b:"#ffc0d8",c:"#f4d8e4"},"a",{paint:[{region:"legs",color:"c"}],parts:[L([12,1.6,8],[0,12.5,0],"a"),L([11,1.2,7.2],[0,11.4,0],"b")]},150),rt("flares","Flared pants",{a:"#c87f17",b:"#a8670f"},"a",{paint:[{region:"legs",color:"a"}],parts:[W("shinR",[5.2,3,5.2],[2.1,2.3,0],"a")]},100)];var G=-4.75,Xt=(e,t="a",r)=>[g([1.7,.3,.3],[3.6,e,G],t,{mirror:true,...r?{mat:r}:{}}),g([.3,.3,4.4],[4.45,e,-2.55],t,{mirror:true,...r?{mat:r}:{}})],Le=(e,t,r,o,a,n)=>Me({id:`face.${e}`,slot:"faceAcc",name:t,palette:r,tint:o,parts:a},n),ur={"face.glasses":Le("glasses","Round glasses",{a:"#2b2140",g:"#cfe8ff"},"a",[g([2.6,.3,.3],[1.6,27.1,G],"a",{mirror:true}),g([2.6,.3,.3],[1.6,24.5,G],"a",{mirror:true}),g([.3,2.9,.3],[2.9,25.8,G],"a",{mirror:true}),g([.3,2.9,.3],[.3,25.8,G],"a",{mirror:true}),g([2.3,2.3,.15],[1.6,25.8,G],"g",{mirror:true,mat:"glass"}),...Xt(26.6)]).item,"face.shades":Le("shades","Sunglasses",{a:"#1d1d21",g:"#2a2a30"},"a",[g([2.8,2.1,.3],[1.6,25.85,G],"g",{mirror:true,mat:"glass"}),g([6.8,.42,.36],[0,26.95,G],"a"),g([.36,1.6,.36],[3.05,26.1,G],"a",{mirror:true}),...Xt(26.75)]).item,"face.visor":Le("visor","Cyber visor",{a:"#33e0ff",b:"#1d1d21"},"a",[g([8.6,1.8,.35],[0,25.9,-4.6],"a",{mat:"glow"}),g([.4,1.2,2.4],[4.35,26,-3.4],"b",{mirror:true}),g([.3,.6,7.6],[4.45,26.2,.4],"b",{mirror:true}),g([8.9,.6,.3],[0,26.2,4.45],"b")]).item},Rs=[Le("mask","Face mask",{a:"#9ad0f0",b:"#f4f1ea"},"a",[g([6.4,2.8,.6],[0,23.6,-4.15],"a"),g([.4,2.4,1.6],[3.35,23.7,-3.35],"a",{mirror:true}),g([.25,.25,3],[4.35,24.9,-1.9],"b",{mirror:true})]),Le("clownnose","Clown nose",{a:"#e0302a",b:"#ffffff"},"a",[g([1.4,1.3,1.2],[0,24.9,-4.55],"a"),g([.4,.4,.2],[-0.3,25.25,-5.2],"b")]),Le("mustache","Mustache",{a:"#3b2a20"},"a",[g([3.4,.7,.5],[0,24.45,-4.25],"a"),g([.9,.9,.5],[1.95,24.3,-4.25],"a",{mirror:true})]),Le("beard","Beard",{a:"#3b2a20"},"a",[g([6.4,1.4,1.4],[0,22.2,-3.5],"a"),g([1.3,3.4,5.2],[3.75,23.6,-1.4],"a",{mirror:true}),g([2.4,.8,.5],[0,23.05,-4.25],"a"),g([3.6,.7,.5],[0,24.45,-4.25],"a")],120),Le("aviators","Aviators",{a:"#d8b030",g:"#c8843a"},"g",[g([2.6,1.6,.2],[1.6,26,G],"g",{mirror:true,mat:"glass"}),g([2,.8,.2],[1.6,24.85,G],"g",{mirror:true,mat:"glass"}),g([6.8,.25,.3],[0,26.85,G],"a",{mat:"metal"}),g([1,.25,.3],[0,26.35,G],"a",{mat:"metal"}),g([.25,2,.3],[2.95,25.8,G],"a",{mirror:true,mat:"metal"}),...Xt(26.7,"a","metal")],150),Le("square","Square glasses",{a:"#1d1d21",g:"#e0f0ff"},"a",[g([2.8,.45,.4],[1.6,27,G],"a",{mirror:true}),g([2.8,.45,.4],[1.6,24.6,G],"a",{mirror:true}),g([.45,2.4,.4],[3,25.8,G],"a",{mirror:true}),g([.45,2.4,.4],[.2,25.8,G],"a",{mirror:true}),g([2.2,2,.15],[1.6,25.8,G],"g",{mirror:true,mat:"glass"}),...Xt(26.7),g([.6,.3,.3],[0,26.3,G],"a")],100),Le("hearts","Heart glasses",{a:"#e8436b",b:"#ff8fb0"},"a",[g([2.6,1.3,.3],[1.6,26.1,G],"b",{mirror:true,mat:"glass"}),g([1.7,.8,.3],[1.6,25.1,G],"b",{mirror:true,mat:"glass"}),g([.8,.6,.3],[1.6,24.5,G],"b",{mirror:true,mat:"glass"}),g([1.1,.7,.32],[1,26.9,G],"a",{mirror:true}),g([1.1,.7,.32],[2.2,26.9,G],"a",{mirror:true}),g([.8,.3,.3],[0,26.3,G],"a"),...Xt(26.6)],120),Le("stars","Star glasses",{a:"#d8b030",b:"#ffe27a"},"a",[g([2.8,.9,.3],[1.6,26,G],"b",{mirror:true,mat:"glass"}),g([1.2,2.6,.3],[1.6,25.8,G],"b",{mirror:true,mat:"glass"}),g([.6,.7,.32],[1.6,27.3,G],"a",{mirror:true}),g([.8,.3,.3],[0,26.3,G],"a"),...Xt(26.6)],120),Le("goggles","Ski goggles",{a:"#2f5fd0",g:"#ff9a3c"},"a",[g([7.6,2.4,.4],[0,25.9,-4.8],"g",{mat:"glass"}),g([8.2,.5,.6],[0,27.35,-4.6],"a"),g([8.2,.5,.6],[0,24.45,-4.6],"a"),g([.5,1.4,8.6],[4.5,25.9,0],"a",{mirror:true}),g([9.4,1.4,.5],[0,25.9,4.5],"a")],150),Le("monocle","Monocle",{a:"#d8b030",g:"#e0f0ff"},null,[g([2.4,.25,.25],[-1.6,27,G],"a",{mat:"metal"}),g([2.4,.25,.25],[-1.6,24.6,G],"a",{mat:"metal"}),g([.25,2.4,.25],[-2.8,25.8,G],"a",{mat:"metal"}),g([.25,2.4,.25],[-0.4,25.8,G],"a",{mat:"metal"}),g([2.2,2.2,.12],[-1.6,25.8,G],"g",{mat:"glass"}),g([.2,3.2,.2],[-2.9,22.9,-4.7],"a",{mat:"metal"})],150),Le("3d","3D glasses",{a:"#f4f1ea",r:"#e0302a",c:"#2f8fe0"},null,[g([6.9,.5,.35],[0,27,G],"a"),g([6.9,.5,.35],[0,24.6,G],"a"),g([.5,2.9,.35],[3.2,25.8,G],"a",{mirror:true}),g([.8,2.9,.35],[0,25.8,G],"a"),g([2.3,1.9,.15],[1.6,25.8,G],"r",{mat:"glass"}),g([2.3,1.9,.15],[-1.6,25.8,G],"c",{mat:"glass"}),...Xt(26.6)],100),Le("eyepatch","Eye patch",{a:"#1d1d21"},null,[g([2.6,2.4,.4],[1.6,25.9,-4.3],"a"),g([5,.4,.3],[-1,27.3,-4.3],"a"),g([.3,.5,8.6],[4.4,27.3,0],"a",{mirror:true}),g([8.9,.5,.3],[0,27.3,4.4],"a")],100)];var Ea=(e,t)=>(r,o,a,n,s,l)=>Me({id:`${t}.${r}`,slot:e,name:o,palette:a,tint:n,textures:s.textures??{},paint:s.paint??[],parts:s.parts??[]},l),Tt=Ea("shoes","shoes"),To=Ea("hands","hands"),Mo=Ea("waist","waist"),Aa=(e="a")=>L([9.45,1.25,4.97],[0,13.15,0],e),ks=[Tt("bunny","Bunny slippers",{a:"#f4f1ea",b:"#f08cb4"},"b",{paint:[{region:"feet",color:"a"}],parts:[W("shinR",[.6,1.6,.4],[1.3,2.2,-2.4],"a"),W("shinR",[.6,1.6,.4],[2.9,2.2,-2.4],"a"),W("shinR",[.9,.7,.5],[2.1,1.1,-3.3],"b")]}),Tt("rainboots","Rain boots",{a:"#f2c14e",b:"#2b2140"},"a",{paint:[{region:"feet",color:"a",faces:{bottom:"b"}}],parts:[W("shinR",[4.6,5,4.6],[2.1,3.5,0],"a")]}),Tt("runners","Running shoes",{a:"#2ab0c0",b:"#f4f1ea",c:"#e8436b"},"a",{textures:{sd:Z(["aaaaa","acaca","bbbbb"])},paint:[{region:"feet",color:"a",faces:{left:"sd",right:"sd",bottom:"b"}}],parts:[W("shinR",[4.4,.5,5.5],[2.1,.25,-0.5],"b")]}),Tt("rollers","Roller skates",{a:"#e8436b",b:"#f4f1ea",c:"#2b2140"},"a",{paint:[{region:"feet",color:"a"}],parts:[W("shinR",[4.5,3,4.6],[2.1,2.6,0],"a"),W("shinR",[3.4,.4,5],[2.1,.2,-0.5],"b"),W("shinR",[3.6,.9,.9],[2.1,-0.05,-2.4],"c"),W("shinR",[3.6,.9,.9],[2.1,-0.05,1.4],"c")]},150),Tt("iceskates","Ice skates",{a:"#f4f1ea",b:"#c8ccd2"},"a",{paint:[{region:"feet",color:"a"}],parts:[W("shinR",[4.5,3.2,4.6],[2.1,2.7,0],"a"),W("shinR",[.35,.6,5.8],[2.1,-0.2,-0.5],"b",{mat:"metal"})]},150),Tt("cowboy","Cowboy boots",{a:"#7a4f2a",b:"#4a2e1a"},"a",{paint:[{region:"feet",color:"a"}],parts:[W("shinR",[4.7,4.6,4.7],[2.1,3.6,0],"a"),W("shinR",[3,.6,1.4],[2.1,.3,1.6],"b")]},120),Tt("space","Space boots",{a:"#f4f1ea",b:"#9aa4ae"},null,{paint:[{region:"feet",color:"a"}],parts:[W("shinR",[5,4.6,5],[2.1,3.3,0],"a"),W("shinR",[4.6,.6,5.8],[2.1,.3,-0.5],"b")]},150),Tt("platform","Platform sneakers",{a:"#1d1d21",w:"#f4f1ea"},"a",{textures:{toe:Z(["aaaa","wwww"]),side:Z(["aaaaa","wwwww"])},paint:[{region:"feet",color:"a",faces:{front:"toe",back:"toe",left:"side",right:"side",bottom:"w"}}],parts:[W("shinR",[4.5,1.2,5.6],[2.1,.6,-0.5],"w")]},100)],vs=[To("mittens","Mittens",{a:"#c0392b",b:"#f4f1ea"},"a",{paint:[{region:"hands",color:"a"}],parts:[W("foreArmR",[3.7,.9,3.7],[6.3,14.3,0],"b")]}),To("fingerless","Fingerless gloves",{a:"#2b2140",s:"@skin"},"a",{textures:{fl:Z(["sss","aaa","aaa"])},paint:[{region:"hands",color:"a",faces:{front:"fl",back:"fl",left:"fl",right:"fl",bottom:"s"}}]}),To("wristbands","Wristbands",{a:"#e8436b"},"a",{parts:[W("foreArmR",[3.8,1.2,3.8],[6.3,14.7,0],"a")]}),To("boxing","Boxing gloves",{a:"#c0392b",b:"#f4f1ea"},"a",{paint:[{region:"hands",color:"a"}],parts:[W("foreArmR",[4.2,3.6,4.2],[6.3,12.5,-0.2],"a"),W("foreArmR",[3.8,1,3.8],[6.3,14.6,0],"b")]},100)],As=[Mo("fannypack","Fanny pack",{a:"#2b2140",b:"#534ab7",m:"#c8ccd2"},"b",{parts:[L([9.45,.8,4.97],[0,13.6,0],"a"),L([4,2,1.6],[0,13.6,-3.1],"b"),L([3.2,.2,.15],[0,14.3,-3.92],"m",{mat:"metal"})]}),Mo("tools","Tool belt",{a:"#5a3a22",b:"#8a5a32",m:"#9aa4ae",h:"#c0612b"},"a",{parts:[Aa(),L([2.2,2.2,1.3],[3.2,12,-2.8],"b",{mirror:true}),L([.5,2.6,.5],[-1.4,11.8,-3.1],"h"),L([1.6,.7,.7],[-1.4,13.2,-3.1],"m",{mat:"metal"})]},80),Mo("sheath","Sword sheath",{a:"#3a2a22",b:"#5a3a22",m:"#c8ccd2"},"a",{parts:[Aa(),L([.9,4.8,1.2],[4.9,12.1,0],"b"),L([1.6,.4,.8],[4.9,14.7,0],"m",{mat:"metal"}),L([.6,1.4,.6],[4.9,15.6,0],"a")]},120),Mo("pouches","Double pouches",{a:"#3a2a22",b:"#6b6b4a"},"b",{parts:[Aa("a"),L([2.4,2.4,1.3],[2.6,11.8,-2.9],"b",{mirror:true})]},60)];var Xe=g([9.21,2.05,8.73],[0,29.91,0],"a"),Mt=g([9.21,1.7,.73],[0,28.72,-4.36],"a"),Gr=g([.71,1.7,2.8],[4.5,28.72,-2.9],"a",{mirror:true}),Lt=(e,t)=>g([.71,e,7.58],[4.6,t,.51],"a",{mirror:true}),Ct=(e,t)=>g([9.21,e,.73],[0,t,4.36],"a"),ke=(e,t,r,o,a={a:"#3b2a20"})=>Me({id:`hair.${e}`,slot:"hair",name:t,palette:a,tint:"a",parts:r},o),Es=[ke("afro","Afro",[g([11.4,4.4,10.2],[0,31.3,.6],"a"),g([10.6,2.2,8.2],[0,27.2,1.5],"a"),g([1.2,4.2,7.4],[5,26.4,1.2],"a",{mirror:true}),g([9.6,4.4,1.3],[0,26.2,4.9],"a"),g([8.6,1.9,.8],[0,28.95,-4.5],"a")]),ke("buzz","Buzz cut",[g([8.9,.6,8.4],[0,30.45,0],"a"),g([.4,2.6,7.6],[4.42,28.9,.2],"a",{mirror:true}),g([8.9,3.6,.4],[0,28.4,4.2],"a"),g([8.9,.8,.4],[0,29.75,-4.2],"a")]),ke("sidepart","Side part",[Xe,g([5.5,2.4,.9],[-1.85,28.6,-4.4],"a"),g([3.7,1.3,.73],[2.75,29.1,-4.36],"a"),Lt(3.41,27.86),Ct(4.77,27.18),g([3.2,1,3.4],[-1.6,31.3,-1.4],"a")]),ke("pigtails","Pigtails",[Xe,Mt,Gr,Lt(3.41,27.86),Ct(4.77,27.18),g([1.9,4.6,1.9],[4.9,26,1.6],"a",{mirror:true}),g([2.1,.8,2.1],[4.9,28.4,1.6],"b",{mirror:true})],void 0,{a:"#3b2a20",b:"#d4537e"}),ke("braids","Braids",[Xe,Mt,Lt(3.41,27.86),Ct(4.77,27.18),g([1.6,5.6,1.6],[3.4,25,3.9],"a",{mirror:true}),g([1.9,.6,1.9],[3.4,22.5,3.9],"b",{mirror:true})],void 0,{a:"#3b2a20",b:"#f2c14e"}),ke("bowl","Bowl cut",[g([9.9,3.2,9.4],[0,29,0],"a"),g([9.4,1,8.9],[0,30.9,0],"a"),g([9.6,3.6,.9],[0,27,4.5],"a")]),ke("dreads","Dreadlocks",[Xe,Mt,g([1.3,5,1.3],[4.75,25.6,-1.6],"a",{mirror:true}),g([1.3,5.6,1.3],[4.75,25.3,1.7],"a",{mirror:true}),g([1.3,6,1.3],[2.4,25,4.75],"a",{mirror:true}),g([1.3,6.2,1.3],[0,25.2,4.8],"a"),Ct(3.2,28.3)],120),ke("longwavy","Long waves",[Xe,Mt,Gr,g([1.06,6.82,7.88],[4.78,26.16,.66],"a",{mirror:true}),g([9.21,7.5,1.09],[0,26.16,4.55],"a"),g([1.3,2,8],[5.1,23.4,.9],"a",{mirror:true}),g([9.8,2,1.4],[0,23.2,4.85],"a")],120),ke("topknot","Top knot",[Xe,Mt,Gr,Lt(2.73,28.2),Ct(4.09,27.52),g([3.2,2.8,3.2],[0,32.3,0],"a"),g([3.5,.6,3.5],[0,31.1,0],"b")],100,{a:"#3b2a20",b:"#1d1d21"}),ke("spacebuns","Space buns",[Xe,Mt,Gr,Lt(3.41,27.86),Ct(4.77,27.18),g([3,3,3],[3,31.8,.5],"a",{mirror:true})],120),ke("emo","Swept fringe",[Xe,g([6.5,3.8,.9],[-1.3,27.6,-4.45],"a"),g([2.7,1.3,.73],[3.25,29.1,-4.36],"a"),Lt(4.5,27.3),Ct(5.4,26.9)],100),ke("quiff","Quiff",[Xe,g([8,2.4,3.2],[0,31.4,-2.6],"a"),g([8.6,1.2,1.2],[0,30.6,-4.4],"a"),Lt(2.73,28.2),Ct(4.09,27.52)],100),ke("mullet","Mullet",[Xe,Mt,Gr,Lt(2.73,28.2),g([9.21,7,1.09],[0,25.8,4.55],"a"),g([8,2,1.6],[0,23.2,4.9],"a")],80),ke("wavybob","Wavy bob",[Xe,Mt,g([1.06,6.13,8.6],[4.78,26.84,.3],"a",{mirror:true}),g([9.21,6.14,1.09],[0,26.5,4.55],"a"),g([1.5,1.2,8.8],[5.1,24.1,.3],"a",{mirror:true}),g([9.6,1.2,1.5],[0,24.1,4.8],"a")],100),ke("curls","Shoulder curls",[g([9.92,2.39,9.45],[0,30.08,0],"a"),g([9.21,1.36,.73],[0,28.89,-4.8],"a"),g([2.83,2.73,2.91],[3.54,28.89,-2.55],"a",{mirror:true}),g([2.83,2.73,2.91],[3.54,28.89,1.82],"a",{mirror:true}),g([5.67,2.05,5.82],[0,31.61,0],"a"),g([4.25,4.27,2.18],[2.13,27.27,4],"a",{mirror:true}),g([2.6,4,2.6],[4.4,24.4,2.4],"a",{mirror:true})],150),ke("undercut","Undercut",[g([9.21,2.6,8.73],[0,30.2,0],"a"),g([9.21,1.7,2],[0,29.9,-4.3],"a"),g([.4,2.6,7.6],[4.42,28.2,.2],"b",{mirror:true}),g([8.9,3.4,.4],[0,27.6,4.2],"b")],120,{a:"#3b2a20",b:"#2a1d16"})];var ye=(e,t,r,o,a,n)=>Me({id:`hat.${e}`,slot:"hat",name:t,palette:r,tint:o,parts:a},n),Sa=g([9.4,.7,1.2],[0,30.6,0],"c"),Ss=[ye("tophat","Top hat",{a:"#1d1d21",b:"#a32d2d"},"a",[g([11.4,.55,11],[0,30.6,0],"a"),g([8.6,6,8.2],[0,33.9,0],"a"),g([8.8,.9,8.4],[0,31.4,0],"b")],150),ye("cowboy","Cowboy hat",{a:"#9a6a3a",b:"#4a2e1a"},"a",[g([13,.6,12],[0,30.4,0],"a"),g([.8,1.2,11],[6.1,31,0],"a",{mirror:true}),g([8.4,3.5,8],[0,32.4,0],"a"),g([8.6,.7,8.2],[0,31.1,0],"b")],150),ye("tricorn","Tricorn",{a:"#2c2420",b:"#d8b030"},"a",[g([10.4,2.4,10],[0,31.2,0],"a"),g([.8,2.6,8],[5.2,31.6,0],"a",{mirror:true}),g([9,2.6,.8],[0,31.6,4.8],"a"),g([3,2.2,.8],[0,31.4,-5],"a"),g([8,.4,.6],[0,30.2,-5.2],"b",{mat:"metal"})],180),ye("chef","Chef hat",{a:"#f6f4ee",b:"#e2ded2"},null,[g([9.8,2,9.4],[0,30.7,0],"b"),g([10.6,4.5,10.2],[0,33.9,0],"a")],100),ye("beret","Beret",{a:"#a32d2d"},"a",[g([10,1.6,9.6],[-0.4,31,0],"a"),g([.8,.8,.8],[0,32,0],"a")]),ye("hardhat","Hard hat",{a:"#f2c14e",b:"#d8a030"},"a",[g([9.8,3,9.4],[0,31.3,0],"a"),g([9.8,.5,2.5],[0,30,-5.5],"a"),g([1,.8,9.6],[0,33,0],"b")],80),ye("viking","Viking helmet",{a:"#9aa4ae",b:"#6a5a3a",c:"#f0e6d0"},"a",[g([9.8,3.2,9.4],[0,31.2,0],"a",{mat:"metal"}),g([10.2,1,9.8],[0,29.9,0],"b"),g([1.4,1.4,1.4],[5.5,31.6,0],"c",{mirror:true}),g([1.1,2.4,1.1],[6.2,33.2,0],"c",{mirror:true}),g([.8,2.2,.5],[0,28.6,-5.05],"a",{mat:"metal"})],200),ye("space","Space helmet",{a:"#bfe6ff",b:"#d8dde4",c:"#ff5a3c"},null,[g([11,10.4,10.8],[0,27,0],"a",{mat:"glass"}),g([10,1,9.6],[0,22.3,0],"b",{mat:"metal"}),g([1.2,1.2,.6],[0,32.4,-1.6],"c",{mat:"glow"})],250),ye("catears","Cat ears",{a:"#2b2140",b:"#f08cb4",c:"#2b2140"},"a",[Sa,g([2,2.2,1],[2.9,32,0],"a",{mirror:true}),g([1.1,1.3,.4],[2.9,31.8,-0.65],"b",{mirror:true})]),ye("bunnyears","Bunny ears",{a:"#f4f1ea",b:"#f08cb4",c:"#f4f1ea"},"a",[Sa,g([1.5,5.4,.9],[1.9,33.6,0],"a",{mirror:true}),g([.8,4.2,.3],[1.9,33.4,-0.55],"b",{mirror:true})],80),ye("foxears","Fox ears",{a:"#e8862a",b:"#2a1c14",c:"#2a1c14"},"a",[Sa,g([2.4,2.8,1],[2.8,32.2,0],"a",{mirror:true}),g([2.4,.9,1.05],[2.8,33.55,0],"b",{mirror:true})],80),ye("halo","Halo",{a:"#ffe27a"},"a",[g([6,.5,1],[0,33.4,-2.5],"a",{mat:"glow"}),g([6,.5,1],[0,33.4,2.5],"a",{mat:"glow"}),g([1,.5,4],[2.5,33.4,0],"a",{mat:"glow",mirror:true})],250),ye("horns","Little horns",{a:"#c0392b",b:"#7a1d1d"},"a",[g([1.4,1.8,1.4],[2.6,31.1,-0.6],"a",{mirror:true}),g([.9,1.2,.9],[2.9,32.5,-0.6],"b",{mirror:true})],120),ye("party","Party hat",{a:"#7f77dd",b:"#f2c14e"},"a",[g([6,1.6,6],[0,31.1,0],"a"),g([4.4,1.8,4.4],[0,32.8,0],"b"),g([2.8,1.8,2.8],[0,34.6,0],"a"),g([1.4,1.6,1.4],[0,36.3,0],"b"),g([1.6,1.2,1.6],[0,37.3,0],"a")]),ye("flowers","Flower wreath",{a:"#4c9a4a",b:"#f08cb4",c:"#f2d33c",d:"#f4f1ea"},null,[g([9.6,.9,9.2],[0,30.4,0],"a"),g([1.4,1.2,1.4],[3,30.9,-4.4],"b",{mirror:true}),g([1.4,1.2,1.4],[0,31,-4.6],"c"),g([1.4,1.2,1.4],[4.7,30.9,.5],"d",{mirror:true}),g([1.4,1.2,1.4],[2.6,30.9,4.5],"c",{mirror:true})],120),ye("bandana","Bandana",{a:"#c0392b"},"a",[g([9.6,2.4,9.2],[0,30.1,0],"a"),g([2,1.6,1.6],[0,29.4,5],"a"),g([1,2.6,.6],[.7,27.6,5.2],"a",{mirror:true})]),ye("ninja","Ninja headband",{a:"#2b2140",b:"#c8ccd2"},"a",[g([9.4,1.3,9],[0,28.8,0],"a"),g([3,1.1,.4],[0,28.8,-4.7],"b",{mat:"metal"}),g([.9,3,.5],[.7,27,4.9],"a",{mirror:true})],100),ye("propeller","Propeller cap",{a:"#2f5fd0",b:"#f2d33c",c:"#c0392b"},"a",[g([9.63,2.73,9.16],[0,30.8,.15],"a"),g([7.79,.55,3.64],[0,29.57,-5.96],"a"),g([.6,1.2,.6],[0,32.7,0],"b"),g([7,.3,1.2],[0,33.4,0],"c"),g([1.2,.3,7],[0,33.4,0],"b")],150)];var Lo=e=>({front:e,back:e,left:e,right:e}),ge=(e,t,r,o,a,n)=>Me({id:`top.${e}`,slot:"top",name:t,palette:r,tint:o,textures:a.textures??{},paint:a.paint,parts:a.parts??[]},n),mc=Z(["abaabaab","bbbbbbbb","abaabaab","abaabaab","bbbbbbbb","abaabaab","abaabaab","abaabaab"]),Ts=[ge("flannel","Flannel shirt",{a:"#c0392b",b:"#2b2140"},"a",{textures:{pl:mc},paint:[{region:"torso",color:"a",faces:Lo("pl")},{region:"arms",color:"a",faces:Lo("pl")}],parts:[L([5.6,.8,.5],[0,22.2,-2.4],"b")]}),ge("polo","Polo shirt",{a:"#1d9e75",w:"#f4f1ea"},"a",{textures:{pk:Z(["aaawaaaa","aaawaaaa","aaawaaaa","aaaaaaaa","aaaaaaaa","aaaaaaaa","aaaaaaaa","aaaaaaaa"])},paint:[{region:"torso",color:"a",faces:{front:"pk"}},{region:"sleeves",color:"a"}],parts:[L([4.6,.9,.6],[0,22.4,-2.3],"a")]}),ge("heart","Heart sweater",{a:"#d4537e",b:"#f4f1ea"},"a",{textures:{h:Z(["aaaaaaaa","aabaabaa","abbbbbba","abbbbbba","aabbbbaa","aaabbaaa","aaaaaaaa","aaaaaaaa"])},paint:[{region:"torso",color:"a",faces:{front:"h"}},{region:"arms",color:"a"}]}),ge("gamer","Gamepad tee",{a:"#2b2140",b:"#9aa4ae",c:"#33e0ff",d:"#e8436b"},"a",{textures:{g:Z(["aaaaaaaa","aaaaaaaa","abbbbbba","bcbbbdbb","bbbbbbbb","abbaabba","aaaaaaaa","aaaaaaaa"])},paint:[{region:"torso",color:"a",faces:{front:"g"}},{region:"sleeves",color:"a"}]}),ge("jersey","Sports jersey",{a:"#2f5fd0",w:"#f4f1ea"},"a",{textures:{n:Z(["aaaaaaaa","aawwwwaa","aaaaawaa","aaaawaaa","aaawaaaa","aaawaaaa","aaaaaaaa","aaaaaaaa"]),sl:Z(["aaa","www","aaa"])},paint:[{region:"torso",color:"a",faces:{front:"n",back:"n"}},{region:"sleeves",color:"a",faces:Lo("sl")}]}),ge("dress","Dress",{a:"#7f77dd",b:"#f4f1ea"},"a",{paint:[{region:"torso",color:"a"},{region:"sleeves",color:"a"}],parts:[L([10.2,5,5.6],[0,12.1,0],"a"),L([9,.8,4.6],[0,14.9,0],"b")]}),ge("bomber","Varsity jacket",{a:"#a32d2d",b:"#f4f1ea",c:"#2b2140"},"a",{textures:{fr:Z(["aaabbaaa","aaabbaaa","abaabaaa","abaabaaa","aaabbaaa","aaabbaaa","aaabbaaa","aaabbaaa"]),cf:Z(["bbb","bbb","bbb","bbb","ccc"])},paint:[{region:"torso",color:"a",faces:{front:"fr"}},{region:"arms",color:"b",faces:Lo("cf")}],parts:[L([8.8,.9,4.6],[0,12.9,0],"c")]},120),ge("puffer","Puffer jacket",{a:"#ef9f27",b:"#c87f17"},"a",{paint:[{region:"torso",color:"a"},{region:"arms",color:"a"}],parts:[L([9.6,3.2,5.2],[0,20.6,0],"a"),L([9.4,3,5],[0,17.4,0],"b"),L([9,3,4.8],[0,14.3,0],"a"),W("armR",[4,2.2,4],[6.3,20.4,0],"a")]},150),ge("overalls","Overalls",{a:"#2f5fd0",b:"#f4f1ea",g:"#d8b030"},"a",{paint:[{region:"torso",color:"b"},{region:"sleeves",color:"b"}],parts:[L([6,5,.5],[0,17.8,-2.4],"a"),L([1.2,4,.5],[2.4,20.6,-2.4],"a",{mirror:true}),L([.6,.6,.3],[2.4,21.7,-2.75],"g",{mirror:true,mat:"metal"}),L([1.2,9,.5],[2.4,17.5,2.4],"a",{mirror:true}),L([8.8,4.4,4.6],[0,14.8,0],"a")]},100),ge("labcoat","Lab coat",{a:"#f4f1ea",b:"#9ad0f0"},null,{paint:[{region:"torso",color:"a"},{region:"arms",color:"a"}],parts:[L([9,4.5,4.8],[0,11.8,0],"a"),L([1.6,4,.4],[1.6,19.8,-2.45],"a",{mirror:true}),L([1.6,1.4,.3],[-2.6,17,-2.4],"b")]},120),ge("ninja","Ninja suit",{a:"#2b2140",r:"#c0392b",g:"#3c3450"},"a",{textures:{wr:Z(["agaaaaaa","aagaaaaa","aaagaaaa","aaaagaaa","aaaaagaa","aaaaaaga","aaaaaaaa","aaaaaaaa"])},paint:[{region:"torso",color:"a",faces:{front:"wr"}},{region:"arms",color:"a"}],parts:[L([9.2,1,4.8],[0,14.3,0],"r")]},150),ge("space","Space suit",{a:"#f4f1ea",b:"#9aa4ae",c:"#33e0ff",d:"#e8436b"},null,{paint:[{region:"torso",color:"a"},{region:"arms",color:"a"}],parts:[L([5,3.6,.6],[0,19,-2.5],"b"),L([.6,.6,.3],[-1.2,19.6,-2.9],"c",{mat:"glow"}),L([.6,.6,.3],[1.2,19.6,-2.9],"d",{mat:"glow"}),W("armR",[4.2,1,4.2],[6.3,22.4,0],"b"),L([7,.8,5],[0,22.6,0],"b",{mat:"metal"})]},250),ge("pirate","Pirate shirt",{a:"#f4f1ea",b:"#5a3a22",r:"#a32d2d"},null,{textures:{v:Z(["aabbbbaa","aaabbaaa","aabaabaa","aaabbaaa","aaaaaaaa","aaaaaaaa","aaaaaaaa","aaaaaaaa"])},paint:[{region:"torso",color:"a",faces:{front:"v"}},{region:"arms",color:"a"}],parts:[W("foreArmR",[4.2,3,4.2],[6.3,15.6,0],"a"),L([9.2,1.4,4.8],[0,13.6,0],"r")]},120),ge("raincoat","Raincoat",{a:"#f2c14e",b:"#d8a030"},"a",{textures:{bt:Z(["aaaaaaaa","aaabaaaa","aaaaaaaa","aaabaaaa","aaaaaaaa","aaabaaaa","aaaaaaaa","aaaaaaaa"])},paint:[{region:"torso",color:"a",faces:{front:"bt"}},{region:"arms",color:"a"}],parts:[L([7,3.6,2],[0,21.5,2.9],"a"),L([9,4,4.8],[0,12,0],"a")]},100),ge("vest","Vest and shirt",{a:"#5a3a22",b:"#f4f1ea"},"a",{paint:[{region:"torso",color:"b"},{region:"arms",color:"b"}],parts:[L([4.2,7,.5],[2.2,17.5,-2.4],"a",{mirror:true}),L([9,9,.5],[0,17.4,2.4],"a")]},80),ge("chef","Chef jacket",{a:"#f6f4ee",b:"#2b2140"},null,{textures:{db:Z(["aaaaaaaa","aabaabaa","aaaaaaaa","aabaabaa","aaaaaaaa","aabaabaa","aaaaaaaa","aaaaaaaa"])},paint:[{region:"torso",color:"a",faces:{front:"db"}},{region:"arms",color:"a"}],parts:[L([5,.8,.5],[0,22.3,-2.4],"a")]},80),ge("tuxedo","Tuxedo",{a:"#1d1d21",w:"#f4f1ea"},null,{textures:{tx:Z(["aawwwwaa","aaawwaaa","aaawwaaa","aaawwaaa","aaaaaaaa","aaaaaaaa","aaaaaaaa","aaaaaaaa"])},paint:[{region:"torso",color:"a",faces:{front:"tx"}},{region:"arms",color:"a"}],parts:[L([2,1,.4],[0,21.7,-2.6],"a"),L([8.6,4,.6],[0,11.6,2.4],"a")]},200),ge("leather","Leather jacket",{a:"#2a2420",b:"#c8ccd2"},"a",{paint:[{region:"torso",color:"a"},{region:"arms",color:"a"}],parts:[L([2.6,1.6,.6],[2.5,22.1,-2.25],"a",{mirror:true}),L([.4,8,.3],[-0.8,16.8,-2.45],"b",{mat:"metal"})]},180)];var qr=[...Es,...Ts,...ws,...ks,...vs,...As,...gs,...xs,...Rs,...Ss];function Ge(e){let t=pr(e);if(!t.ok)throw new Error(`avatar shop: ${String(e.id)}: ${t.errors.join("; ")}`);return t.item}var Ta=e=>({w:e[0].length,h:e.length,rows:e}),hc={bone:"head",size:[9.21,2.05,8.73],pos:[0,29.91,0],color:"a"},dc={bone:"head",size:[9.21,1.7,.73],pos:[0,28.72,-4.36],color:"a"},Ms=[{price:250,item:Ge({id:"hat.crown",slot:"hat",name:"Crown",palette:{a:"#e8b730",g:"#d23c4a"},tint:"a",parts:[{bone:"head",size:[9.21,1.7,.73],pos:[0,30.93,-4.36],color:"a"},{bone:"head",size:[9.21,1.7,.73],pos:[0,30.93,4.36],color:"a"},{bone:"head",size:[.71,1.7,8.73],pos:[4.6,30.93,0],color:"a",mirror:true},{bone:"head",size:[1.13,1.36,.73],pos:[2.98,32.47,-4.36],color:"a",mirror:true},{bone:"head",size:[1.13,1.77,.73],pos:[0,32.67,-4.36],color:"a"},{bone:"head",size:[.99,.95,.29],pos:[0,30.93,-4.87],color:"g"}]})},{price:250,item:Ge({id:"back.wings",slot:"back",name:"Angel wings",palette:{a:"#f7f5ff",b:"#d9d4f2"},tint:"a",parts:[{bone:"body",size:[2.25,7.5,1.47],pos:[1.69,21.15,3.04],color:"b",mirror:true},{bone:"body",size:[10.13,3.13,.74],pos:[7.31,26.15,3.86],color:"a",mirror:true},{bone:"body",size:[10.13,3.13,.74],pos:[7.88,23.03,4.05],color:"b",mirror:true},{bone:"body",size:[9,3.13,.74],pos:[8.44,19.9,4.23],color:"a",mirror:true},{bone:"body",size:[6.75,3.13,.74],pos:[9,16.77,4.42],color:"b",mirror:true},{bone:"body",size:[4.5,3.13,.74],pos:[9.56,13.65,4.6],color:"a",mirror:true},{bone:"body",size:[3.38,1.88,.74],pos:[11.25,28.65,3.86],color:"a",mirror:true}]})},{price:200,item:Ge({id:"hat.wizard",slot:"hat",name:"Wizard hat",palette:{a:"#3c2f8f",s:"#f2c14e"},tint:"a",parts:[{bone:"head",size:[10.63,.55,10.18],pos:[0,30.39,0],color:"a"},{bone:"head",size:[8.5,1.77,8],pos:[0,31.55,0],color:"a"},{bone:"head",size:[6.38,1.77,5.82],pos:[0,33.32,.36],color:"a"},{bone:"head",size:[4.25,1.77,4],pos:[0,35.09,.73],color:"a"},{bone:"head",size:[2.13,1.64,2.18],pos:[0,36.8,1.09],color:"a"},{bone:"head",size:[1.13,1.09,.29],pos:[0,31.61,-4.15],color:"s"}]})},{price:200,item:Ge({id:"top.armor",slot:"top",name:"Knight armor",palette:{a:"#b8c2cc",b:"#5b6672",g:"#e8b730"},tint:"a",paint:[{region:"torso",color:"b"},{region:"arms",color:"b"}],parts:[{bone:"body",size:[9.67,7.5,.74],pos:[0,18.65,-2.67],color:"a"},{bone:"armR",size:[4.32,2.94,4.32],pos:[6.3,22.38,0],color:"a",mirror:true},{bone:"body",size:[2.25,2.5,.37],pos:[0,19.27,-3.22],color:"g"}]})},{price:200,item:Ge({id:"back.sword",slot:"back",name:"Sword",palette:{a:"#d8dde4",g:"#e8b730",h:"#5a3a22"},tint:"g",parts:[{bone:"body",size:[1.35,12.5,.55],pos:[2.81,17.4,3.04],color:"a"},{bone:"body",size:[4.5,1.13,.92],pos:[2.81,24.21,3.04],color:"g"},{bone:"body",size:[1.01,3.75,.83],pos:[2.81,26.65,3.04],color:"h"},{bone:"body",size:[1.58,1.5,1.1],pos:[2.81,29.28,3.04],color:"g"}]})},{price:150,item:Ge({id:"hat.headphones",slot:"hat",name:"Headphones",palette:{a:"#2b2140",b:"#4be0c8"},tint:"b",parts:[{bone:"head",size:[9.63,.82,1.45],pos:[0,31.07,0],color:"a"},{bone:"head",size:[.57,3.41,.87],pos:[4.89,29.57,0],color:"a",mirror:true},{bone:"head",size:[1.13,2.45,2.62],pos:[4.96,27.39,0],color:"a",mirror:true},{bone:"head",size:[.28,1.64,1.75],pos:[5.6,27.39,0],color:"b",mirror:true}]})},{price:150,item:Ge({id:"hair.mohawk",slot:"hair",name:"Mohawk",palette:{a:"#d4537e"},tint:"a",parts:[{bone:"head",size:[1.84,3.07,8],pos:[0,31.78,0],color:"a"},{bone:"head",size:[1.84,2.05,1.45],pos:[0,31.27,-4.73],color:"a"},{bone:"head",size:[2.13,4.09,.73],pos:[0,28.2,4.36],color:"a"}]})},{price:150,item:Ge({id:"top.suit",slot:"top",name:"Suit and tie",palette:{a:"#2c2f3a",w:"#f4f1ea",r:"#c0392b"},tint:"a",textures:{front:Ta(["awwrrwwa","aawrrwaa","aaarraaa","aaarraaa","aaarraaa","aaaaaaaa","aaaaaaaa","aaaaaaaa"])},paint:[{region:"torso",color:"a",faces:{front:"front"}},{region:"arms",color:"a"}],parts:[{bone:"body",size:[1.35,1,.28],pos:[-2.92,19.9,-2.44],color:"w"}]})},{price:120,item:Ge({id:"hair.ponytail",slot:"hair",name:"Ponytail",palette:{a:"#3b2a20",b:"#d4537e"},tint:"a",parts:[hc,dc,{bone:"head",size:[.71,3.41,7.27],pos:[4.6,27.86,.36],color:"a",mirror:true},{bone:"head",size:[9.21,4.77,.73],pos:[0,27.18,4.36],color:"a"},{bone:"head",size:[2.27,1.02,1.75],pos:[0,28.55,4.95],color:"b"},{bone:"head",size:[1.84,5.45,1.45],pos:[0,25.82,5.09],color:"a"}]})},{price:120,item:ur["face.visor"]},{price:100,item:Ge({id:"shoes.hightops",slot:"shoes",name:"High-tops",palette:{a:"#7f77dd",w:"#f4f1ea",b:"#2b2140"},tint:"a",textures:{toe:Ta(["aaaa","wwww"]),side:Ta(["aaaaa","wwwww"])},paint:[{region:"feet",color:"a",faces:{front:"toe",back:"toe",left:"side",right:"side",bottom:"w"}}],parts:[{bone:"shinR",size:[4.62,4.32,4.62],pos:[2.1,3.76,0],color:"b",mirror:true}]})},{price:50,item:Ge({id:"hands.gauntlets",slot:"hands",name:"Golden gauntlets",palette:{a:"#e8b730",b:"#b8862a"},tint:"a",paint:[{region:"hands",color:"a"}],parts:[{bone:"foreArmR",size:[4.32,1.75,4.32],pos:[6.3,13.78,0],color:"b",mirror:true}]})},{price:50,item:Ge({id:"waist.pouch",slot:"waist",name:"Belt pouch",palette:{a:"#3a2a22",b:"#7a5233"},tint:"b",parts:[{bone:"body",size:[9.45,1.25,4.97],pos:[0,13.15,0],color:"a"},{bone:"body",size:[2.7,2.5,1.29],pos:[2.93,11.9,-3.04],color:"b"}]})}],Ls=qr.filter(e=>e.price!==void 0),Cs=[...Ms,...Ls].map(e=>e.item),Ma=Object.fromEntries([...Ms,...Ls].map(e=>[e.item.id,e.price])),Ps=e=>Object.prototype.hasOwnProperty.call(Ma,e);function Q(e){let t=pr(e);if(!t.ok)throw new Error(`avatar catalog: ${String(e.id)}: ${t.errors.join("; ")}`);return t.item}var fr=e=>({w:e[0].length,h:e.length,rows:e}),Ur={bone:"head",size:[9.21,2.05,8.73],pos:[0,29.91,0],color:"a"},La={bone:"head",size:[.71,1.7,2.8],pos:[4.5,28.72,-2.9],color:"a",mirror:true},Kr={bone:"head",size:[9.21,1.7,.73],pos:[0,28.72,-4.36],color:"a"},uc=[Q({id:"hair.short",slot:"hair",name:"Short",palette:{a:"#3b2a20"},tint:"a",parts:[Ur,Kr,La,{bone:"head",size:[.71,3.41,7.58],pos:[4.6,27.86,.51],color:"a",mirror:true},{bone:"head",size:[9.21,4.77,.73],pos:[0,27.18,4.36],color:"a"}]}),Q({id:"hair.bob",slot:"hair",name:"Bob",palette:{a:"#3b2a20"},tint:"a",parts:[Ur,Kr,{bone:"head",size:[1.06,6.13,8.6],pos:[4.78,26.84,.3],color:"a",mirror:true},{bone:"head",size:[9.21,6.14,1.09],pos:[0,26.5,4.55],color:"a"}]}),Q({id:"hair.spiky",slot:"hair",name:"Spiky",palette:{a:"#3b2a20"},tint:"a",parts:[Ur,Kr,{bone:"head",size:[.71,2.73,8.6],pos:[4.6,28.2,0],color:"a",mirror:true},{bone:"head",size:[9.21,2.73,.73],pos:[0,28.2,4.36],color:"a"},{bone:"head",size:[2.13,2.05,2.18],pos:[2.83,31.61,-0.73],color:"a",mirror:true},{bone:"head",size:[2.13,2.73,2.18],pos:[0,31.95,-0.73],color:"a"},{bone:"head",size:[2.13,2.05,2.18],pos:[-1.42,31.61,2.18],color:"a"},{bone:"head",size:[2.13,2.05,2.18],pos:[1.77,31.75,1.82],color:"a"}]}),Q({id:"hair.long",slot:"hair",name:"Long",palette:{a:"#3b2a20"},tint:"a",parts:[Ur,Kr,La,{bone:"head",size:[1.06,6.82,7.88],pos:[4.78,26.16,.66],color:"a",mirror:true},{bone:"head",size:[9.21,7.5,1.09],pos:[0,26.16,4.55],color:"a"}]}),Q({id:"hair.bun",slot:"hair",name:"Bun",palette:{a:"#3b2a20"},tint:"a",parts:[Ur,Kr,La,{bone:"head",size:[.71,2.73,6.48],pos:[4.6,28.2,1.06],color:"a",mirror:true},{bone:"head",size:[9.21,4.09,.73],pos:[0,27.52,4.36],color:"a"},{bone:"head",size:[4.25,3.41,3.64],pos:[0,32.64,1.82],color:"a"}]}),Q({id:"hair.curly",slot:"hair",name:"Curly",palette:{a:"#3b2a20"},tint:"a",parts:[{bone:"head",size:[9.92,2.39,9.45],pos:[0,30.08,0],color:"a"},{bone:"head",size:[9.21,1.36,.73],pos:[0,28.89,-4.8],color:"a"},{bone:"head",size:[2.83,2.73,2.91],pos:[3.54,28.89,-2.55],color:"a",mirror:true},{bone:"head",size:[2.83,2.73,2.91],pos:[3.54,28.89,1.82],color:"a",mirror:true},{bone:"head",size:[5.67,2.05,5.82],pos:[0,31.61,0],color:"a"},{bone:"head",size:[4.25,4.27,2.18],pos:[2.13,27.27,4],color:"a",mirror:true}]})],fc=[Q({id:"top.idos",slot:"top",name:"iDos Games tee",palette:{a:"#1565ff"},tint:null,paint:[{region:"torso",color:"a"},{region:"sleeves",color:"a"}]}),Q({id:"top.tee",slot:"top",name:"Star tee",palette:{a:"#1d9e75",b:"#f4f1ea"},tint:"a",textures:{print:fr(["aaaaaaaa","aaabbaaa","aabbbbaa","abbbbbba","aabbbbaa","aabaabaa","aaaaaaaa","aaaaaaaa"])},paint:[{region:"torso",color:"a",faces:{front:"print"}},{region:"sleeves",color:"a"}]}),Q({id:"top.hoodie",slot:"top",name:"Hoodie",palette:{a:"#378add",b:"#24578f",w:"#f0f0f0"},tint:"a",paint:[{region:"torso",color:"a"},{region:"arms",color:"a"}],parts:[{bone:"body",size:[7.88,4.38,1.84],pos:[0,21.78,3.04],color:"a"},{bone:"body",size:[5.63,2.5,.46],pos:[0,15.52,-2.53],color:"b"},{bone:"body",size:[.56,2.75,.37],pos:[1.24,19.65,-2.48],color:"w",mirror:true}]}),Q({id:"top.stripes",slot:"top",name:"Striped sweater",palette:{a:"#d4537e",b:"#f4f1ea"},tint:"a",textures:{st:fr(["aaaaaaaa","aaaaaaaa","bbbbbbbb","aaaaaaaa","aaaaaaaa","bbbbbbbb","aaaaaaaa","aaaaaaaa"]),sl:fr(["aaa","bbb","aaa","bbb","aaa"])},paint:[{region:"torso",color:"a",faces:{front:"st",back:"st",left:"st",right:"st"}},{region:"arms",color:"a",faces:{front:"sl",back:"sl",left:"sl",right:"sl"}}]}),Q({id:"top.jacket",slot:"top",name:"Jacket",palette:{a:"#444441",b:"#f4f1ea",c:"#c8c2b4"},tint:"a",textures:{open:fr(["aaabbaaa","aaabbaaa","aaabbaaa","aaabbaaa","aaabbaaa","aacbbcaa","aaabbaaa","aaabbaaa"])},paint:[{region:"torso",color:"a",faces:{front:"open"}},{region:"arms",color:"a"}],parts:[{bone:"body",size:[3.38,1.5,.92],pos:[2.48,22.53,-2.21],color:"a",mirror:true}]}),Q({id:"top.tank",slot:"top",name:"Tank top",palette:{a:"#ef9f27"},tint:"a",paint:[{region:"torso",color:"a"}]})],bc=[Q({id:"bottom.jeans",slot:"bottom",name:"Jeans",palette:{a:"#2f5fd0"},tint:"a",paint:[{region:"legs",color:"a"}]}),Q({id:"bottom.shorts",slot:"bottom",name:"Shorts",palette:{a:"#5f6b7a",s:"@skin"},tint:"a",paint:[{region:"legs",color:"s"}],parts:[{bone:"legR",size:[4.62,5.4,4.62],pos:[2.1,9.7,0],color:"a",mirror:true}]}),Q({id:"bottom.skirt",slot:"bottom",name:"Skirt",palette:{a:"#7f77dd",s:"@skin"},tint:"a",paint:[{region:"legs",color:"s"}],parts:[{bone:"body",size:[10.13,4.38,5.52],pos:[0,11.46,0],color:"a"}]}),Q({id:"bottom.cargo",slot:"bottom",name:"Cargo pants",palette:{a:"#6b6b4a",b:"#55553a"},tint:"a",paint:[{region:"legs",color:"a"}],parts:[{bone:"legR",size:[.84,4.32,2.52],pos:[4.62,7,0],color:"b",mirror:true}]})],yc=[Q({id:"shoes.sneakers",slot:"shoes",name:"Sneakers",palette:{a:"#d84a30",w:"#f4f1ea"},tint:"a",textures:{toe:fr(["aaaa","wwww"]),side:fr(["aaaaa","wwwww"])},paint:[{region:"feet",color:"a",faces:{front:"toe",back:"toe",left:"side",right:"side",bottom:"w"}}]}),Q({id:"shoes.boots",slot:"shoes",name:"Boots",palette:{a:"#5a3a22",b:"#3a2414"},tint:"a",paint:[{region:"feet",color:"a",faces:{bottom:"b"}}],parts:[{bone:"shinR",size:[4.83,4.32,4.83],pos:[2.1,3.76,0],color:"a",mirror:true}]}),Q({id:"shoes.sandals",slot:"shoes",name:"Sandals",palette:{a:"#b0773a",s:"@skin"},tint:"a",paint:[{region:"feet",color:"s"}],parts:[{bone:"shinR",size:[4.51,.48,5.57],pos:[2.1,.24,-0.53],color:"a",mirror:true},{bone:"shinR",size:[4.51,.4,1.05],pos:[2.1,1.12,-1.89],color:"a",mirror:true}]})],gc=[Q({id:"hands.gloves",slot:"hands",name:"Gloves",palette:{a:"#2b2140"},tint:"a",paint:[{region:"hands",color:"a"}]})],xc=[Q({id:"waist.belt",slot:"waist",name:"Belt",palette:{a:"#5a3a22",g:"#d8b030"},tint:"a",parts:[{bone:"body",size:[9.45,1.25,4.97],pos:[0,13.15,0],color:"a"},{bone:"body",size:[1.8,1.5,.37],pos:[0,13.15,-2.67],color:"g"}]})],wc=[Q({id:"back.backpack",slot:"back",name:"Backpack",palette:{a:"#c0612b",b:"#8a3f18"},tint:"a",parts:[{bone:"body",size:[6.75,8.75,2.76],pos:[0,17.4,3.68],color:"a"},{bone:"body",size:[4.5,3.75,.55],pos:[0,14.9,5.34],color:"b"}]}),Q({id:"back.cape",slot:"back",name:"Cape",palette:{a:"#a32d2d"},tint:"a",parts:[{bone:"body",size:[10.13,12.5,.55],pos:[0,16.15,2.67],color:"a"}]})],Rc=[ur["face.glasses"],ur["face.shades"]],kc=[Q({id:"hat.beanie",slot:"hat",name:"Beanie",palette:{a:"#534ab7",w:"#f4f1ea"},tint:"a",parts:[{bone:"head",size:[9.92,3.07,9.45],pos:[0,30.76,0],color:"a"},{bone:"head",size:[10.34,1.36,9.89],pos:[0,29.3,0],color:"a"},{bone:"head",size:[2.13,2.05,2.18],pos:[0,33.18,0],color:"w"}]}),Q({id:"hat.cap",slot:"hat",name:"Cap",palette:{a:"#c0392b"},tint:"a",parts:[{bone:"head",size:[9.63,2.73,9.16],pos:[0,30.8,.15],color:"a"},{bone:"head",size:[7.79,.55,3.64],pos:[0,29.57,-5.96],color:"a"}]}),Q({id:"hat.bucket",slot:"hat",name:"Bucket hat",palette:{a:"#c8b88a"},tint:"a",parts:[{bone:"head",size:[9.63,2.73,9.16],pos:[0,31.61,0],color:"a"},{bone:"head",size:[11.33,.55,10.91],pos:[0,30.39,0],color:"a"}]})],Co=[...uc,...fc,...bc,...yc,...gc,...xc,...wc,...Rc,...kc,...Cs.filter(e=>!qr.some(t=>t.item.id===e.id)),...qr.map(e=>e.item)],wh=Object.fromEntries(Co.map(e=>[e.id,e]));function vc(e){return Co.filter(t=>t.slot===e)}function zs(e){return vc(e).filter(t=>!Ps(t.id))}var Ac=["#f9e0cf","#f2c9a0","#e2ad80","#c88d62","#9c6844","#6e4a32"],Ec=["#3b2a20","#1d1d21","#f2c14e","#c0612b","#ece6da","#7f77dd","#d4537e","#2ab0a0"],Sc=["#3b2a20","#2f5fd0","#1d9e75","#7f77dd","#c0392b","#d8b030"],Tc=["#1d9e75","#378add","#d4537e","#444441","#ef9f27","#534ab7","#c0392b","#e8e4da"],_s={version:Ut,style:je,body:{skin:"#f2c9a0",height:1,head:"round"},face:{eyes:"round",eyeColor:"#3b2a20",brows:"soft",browColor:"#3b2a20",mouth:"smile",cheeks:true,marks:"none",emotion:"neutral"},anim:{...At},wear:{hair:"hair.short",top:"top.idos",bottom:"bottom.jeans",shoes:"shoes.sneakers"},tint:{}},Is={hair:.92,top:1,bottom:1,shoes:1,hands:.1,waist:.2,back:.2,neck:.15,faceAcc:.25,hat:.35};function Ah(e=Math.random){let t=n=>n[Math.floor(e()*n.length)],r=t(Ec),o={},a={};for(let n of Object.keys(Is)){if(e()>=Is[n])continue;let s=zs(n);s.length&&(o[n]=t(s).id,a[n]=n==="hair"?r:t(Tc));}return {version:Ut,style:je,body:{skin:t(Ac),height:.95+e()*.1,head:t(Nr)},face:{eyes:t(Vr),eyeColor:t(Sc),brows:t(Fr),browColor:r==="#ece6da"||r==="#f2c14e"?"#8a6a3a":r,mouth:t(Dr),cheeks:e()<.6,marks:e()<.3?t(Br):"none",emotion:"neutral"},anim:{...At},wear:o,tint:a}}var Mc={hair:{frame:"portrait",view:.5},hat:{frame:"head",view:.35},faceAcc:{frame:"portrait",view:.2},neck:{frame:"portrait",view:.3},top:{frame:"torso",view:.3},waist:{frame:"torso",view:.3},hands:{frame:"torso",view:.55},bottom:{frame:"legs",view:.3},shoes:{frame:"feet",view:.6},back:{frame:"full",view:Math.PI-.6}},Lc=["hair","top","bottom","shoes"];function Cc(e,t){let r=cr(JSON.parse(JSON.stringify(_s)));for(let o of Object.keys(r.wear))Lc.includes(o)||delete r.wear[o];return r.tint={},r.wear[e]=t,r}function Lh(e,t){return {key:`item:${e.id}`,make:()=>({spec:Cc(e.slot,e.id),items:{...t,[e.id]:e},opts:Mc[e.slot]})}}function Ch(e={}){let t=e.size??224,r=e.limit??800,o=e.budgetMs??14,a=new Map,n=new Map,s=[],l=null,i=false,c=(m,d)=>{for(a.delete(m),a.set(m,d);a.size>r;){let b=a.keys().next().value;URL.revokeObjectURL(a.get(b)),a.delete(b);}},p=()=>{if(i)return;i=true;let m=globalThis.requestIdleCallback;m?m(h,{timeout:120}):setTimeout(h,16);};function h(){i=false;let m=performance.now();for(;s.length&&performance.now()-m<o;){let d=s.shift(),b=n.get(d);if(b&&(n.delete(d),b.listeners.size!==0))try{l??=bs({size:t});let{spec:u,items:R,opts:w}=b.make(),A=l.render(u,R,w),k=[...b.listeners];A.toBlob(x=>{if(!x)return;let f=URL.createObjectURL(x);c(d,f);for(let S of k)S(f);},"image/png");}catch{l?.dispose(),l=null;}}s.length&&p();}return {peek:m=>a.get(m)??null,request(m,d){let b=a.get(m.key);if(b)return c(m.key,b),d(b),()=>{};let u=n.get(m.key);u||(u={make:m.make,listeners:new Set},n.set(m.key,u),s.push(m.key)),u.listeners.add(d),p();let R=u;return ()=>R.listeners.delete(d)},release(){l?.dispose(),l=null;}}}var Pc="voxel-avatar-v1";function Fh(){return {standard:Pc,style:je,version:Ut,slots:[...Kt],eyes:[...Vr],brows:[...Fr],mouths:[...Dr],emotions:[...b$1],heads:[...Nr],marks:[...Br],walks:[...ya],idles:[...ga],height:{min:Or.min,max:Or.max},items:[...Co],shop:{...Ma},rules:{slots:{...fa},limits:{...Yt},regions:[...da],regionPairs:Object.fromEntries(Object.entries(ua).map(([e,t])=>[e,[...t]])),faces:[...dt],skinColor:qt,materials:[...er]}}}var zc=(e,t,r)=>"#"+[e,t,r].map(o=>Math.max(0,Math.min(255,Math.round(o))).toString(16).padStart(2,"0")).join("");function Ic(e,t,r){let o=[];for(let a=0;a<r;a++)for(let n=0;n<t;n++){let s=Math.floor(n*e.width/t),l=Math.max(s+1,Math.floor((n+1)*e.width/t)),i=Math.floor(a*e.height/r),c=Math.max(i+1,Math.floor((a+1)*e.height/r)),p=0,h=0,m=0,d=0,b=0;for(let u=i;u<c;u++)for(let R=s;R<l;R++){let w=(u*e.width+R)*4;b++,!((e.data[w+3]??0)<128)&&(p+=e.data[w]??0,h+=e.data[w+1]??0,m+=e.data[w+2]??0,d++);}o.push(d*2<b?null:[p/d,h/d,m/d]);}return o}var Yr=(e,t)=>(e[0]-t[0])**2+(e[1]-t[1])**2+(e[2]-t[2])**2;function Nh(e,t){let r=Yt.textureSide,a=Math.min(1,16/Math.max(e.width,e.height,1)),n=Math.max(1,Math.min(r,Math.round(t.w??e.width*a))),s=Math.max(1,Math.min(r,Math.round(t.h??e.height*a))),l=[...new Set(t.symbols)].slice(0,Yt.palette);if(!l.length)throw new Error("pixelTextureFromImage: no palette symbols to use");let i=Ic(e,n,s),c=i.filter(u=>!!u),p=new Map;for(let u of c){let R=u.map(A=>Math.round(A/8)).join(","),w=p.get(R);w?w.n++:p.set(R,{n:1,c:u});}let h=[...p.values()].sort((u,R)=>R.n-u.n||(u.c.join()<R.c.join()?-1:1)),m=[];for(let u of h){if(m.length>=l.length)break;m.every(R=>Yr(R,u.c)>576)&&m.push([...u.c]);}!m.length&&h[0]&&(m=[[...h[0].c]]);for(let u=0;u<8&&m.length;u++){let R=m.map(()=>[0,0,0,0]);for(let w of c){let A=0;for(let x=1;x<m.length;x++)Yr(w,m[x])<Yr(w,m[A])&&(A=x);let k=R[A];k[0]+=w[0],k[1]+=w[1],k[2]+=w[2],k[3]+=1;}m=m.map((w,A)=>{let k=R[A];return k[3]?[k[0]/k[3],k[1]/k[3],k[2]/k[3]]:w});}let d={};m.forEach((u,R)=>d[l[R]]=zc(u[0],u[1],u[2]));let b=[];for(let u=0;u<s;u++){let R="";for(let w=0;w<n;w++){let A=i[u*n+w];if(!A||!m.length){R+=".";continue}let k=0;for(let x=1;x<m.length;x++)Yr(A,m[x])<Yr(A,m[k])&&(k=x);R+=l[k];}b.push(R);}return {texture:{w:n,h:s,rows:b},palette:d}}var _c="ugc.",Hh=e=>e.startsWith(_c);export{Un as ACTION_TIME,k1 as ANIM_EVENTS,_c as AVATAR_AUTHOR_ITEM_PREFIX,ss as AVATAR_BASE_COLORS,Et as AVATAR_FACE_RECT,Nr as AVATAR_HEADS,Or as AVATAR_HEIGHT,ga as AVATAR_IDLES,wh as AVATAR_ITEMS,Yt as AVATAR_ITEM_LIMITS,Co as AVATAR_ITEM_LIST,Zl as AVATAR_ITEM_PRINTS,Mc as AVATAR_ITEM_SHOTS,Bm as AVATAR_PORTRAIT_BACKGROUND,Qt as AVATAR_RIG_ID,Ma as AVATAR_SHOP_DEFAULT_PRICES,Cs as AVATAR_SHOP_ITEM_LIST,Kt as AVATAR_SLOTS,Ut as AVATAR_SPEC_VERSION,Pc as AVATAR_STANDARD_ID,je as AVATAR_STYLE,ya as AVATAR_WALKS,wo as Animator,U as Art,So as AvatarActor,da as BODY_REGIONS,Hc as BONE_ROLES,Fr as BROW_STYLES,I as CH,w1 as CHANNELS,ja as CHARACTER_LIMITS,Ba as CHARACTER_SPEC_VERSION,ut as CLEAR,zr as CLIPS,Tc as CLOTH_COLORS,bm as CREATURE_KINDS,fo as CharacterView,_s as DEFAULT_AVATAR,At as DEFAULT_AVATAR_ANIM,gl as DEFAULT_AVATAR_FACE,ba as DEFAULT_AVATAR_HEAD,jo as DEFAULT_CHARACTER_SOURCE,Ds as DEFAULT_COLORS,Zt as DEFAULT_FINISH,hr as DrawnFace,$e as EMOTES,Lp as EMOTE_IDS,Vp as EMOTION_EVENTS,Mp as EVERYDAY_IDS,wr as EXPRESSIONS,lr as EXPRESSION_CHAIN,Zr as EXTRA_BONE_ROLES,Sc as EYE_COLORS,Vr as EYE_STYLES,dt as FACE_NAMES,ts as FACE_TEXELS,Tp as GESTURE_IDS,Ec as HAIR_COLORS,R1 as HELD_KINDS,ln as HUMAN_BOTTOMS,y1 as HUMAN_HAIR,cn as HUMAN_SHOES,sn as HUMAN_TOPS,kr as IDLE_STYLES,Mr as IKSolver,dl as LOCOMOTION,Br as MARK_STYLES,Dr as MOUTH_STYLES,er as PART_MATERIALS,r1 as PART_SHAPES,pa as POSTURE,ua as REGION_PAIRS,nr as REST,Ae as RIGS,qn as RIG_CLIPS,gr as RIG_IDS,Pr as Ragdoll,ml as SEAT_HEIGHT_PX,qt as SKIN_COLOR,Ac as SKIN_TONES,fa as SLOT_RULES,jc as SOCKETS,pm as VOXEL_CHARACTER_SYSTEM_PROMPT,vo as VoxelActor,Rr as WALK_STYLES,Do as acquireCharacter,de as add,Zn as applyPosture,Fh as avatarCatalogExport,Hm as avatarFromServer,Lh as avatarItemShot,vc as avatarItemsForSlot,Cc as avatarMannequinWith,ka as avatarPrints,z0 as bandColors,oe as bone,qa as bonesOf,fp as characterFromImage,op as characterOf,ap as characterSpecs,ft as clearPose,Ra as composeAvatar,De as copyPose,hs as createAvatarLighting,bs as createAvatarSnapshotter,Ch as createAvatarThumbQueue,ym as creatureCharacter,Vl as creatureSource,Ot as defaultCharacter,to as defaultCharacterName,Go as disposeNameplate,xa as drawAvatarFace,Pp as emoteLabelOf,Fp as emotionFromText,zs as freeAvatarItemsForSlot,Ho as humanSource,Hh as isAuthorAvatarItem,Ps as isAvatarShopItem,Cp as isChairEmote,a1 as isDefaultCharacterName,ca as isEmote,X as isObj,Xa as layoutCharacter,mn as lerpPose,Ga as mirrorBone,pn as nameplate,no as newAnimInput,ot as normColor,pp as npcCharacter,Ie as num,np as onCharacterKnown,cr as parseAvatarSpec,Ye as parseCharacterSpec,Po as pick,Nh as pixelTextureFromImage,Ah as randomAvatar,No as recolor,rp as registerCharacter,oo as releaseCharacter,pc as renderAvatarCanvas,Nm as renderAvatarImage,o1 as rigOfSpec,Qn as sampleEmote,hl as sampleTrack,y as setCh,tr as specHash,zo as stableStringify,Ar as standardFace,oa as styleParams,pr as validateAvatarItem,eo as vec3};
77
+ - When the player sends pictures (possibly of ONE character from different angles: front, side, back) study EVERY picture: get the silhouette, proportions, colours, clothes and the face right. Pictures can be photos, drawings or 3D renders \u2014 turn them into a clean blocky version.`;var ns=["wolf","lion","tiger","panda","pig","cow","sheep","horse","deer","mouse","raccoon","elephant","hedgehog","turtle","frog","duck","chicken","owl","penguin","bat","bee","eagle","fish","shark"],So={h:"#efe6cf",n:"#f2a0a8",r:"#d8342c",y:"#f2a630",d:"#2a2a30",g:"#e8f6ff"},K={mirror:true},_l=["legFL","legFR","legBL","legBR"];function Te(e,t={}){let r=t.body??[8,8,16],o=t.bodyY??12;e("body","body",r,[0,o,0],"t"),t.belly!==false&&e("belly","body",[r[0]-2,1,r[2]-4],[0,o-r[1]/2,0],"l"),e("head","head",[8,8,8],[0,16,-12],t.head??"s");let a=t.leg??[3,8];for(let n of _l){let s=n.endsWith("L")?-3:3,l=n.startsWith("legF")?-6:6;e(n,n,[a[0],a[1],a[0]],[s,a[1]/2,l],t.legColor??"t"),t.paw!==null&&e(`${n}Paw`,n,[a[0]+.2,1.5,a[0]+.2],[s,.75,l],t.paw??"a");}}var Gr=(e,t="a",r=[4,3,3])=>{e("snout","head",r,[0,14.5,-16-r[2]/2+.5],"l"),e("nose","head",[1.4,1,.6],[0,15.6,-16-r[2]+.4],t);};function $t(e,t={}){let r=t.body??[6,6,8];e("body","body",r,[0,8,0],"t"),e("belly","body",[r[0]-1.4,r[1]-2,1],[0,7.5,-r[2]/2-.2],"l"),e("head","head",[5,5,5],[0,13,-4],t.head??"s");let o=t.wing??[8,1,6];e("wing","wingL",o,[-3-o[0]/2,10,0],t.wingColor??"a",K),e("leg","legL",[1,4,1],[-1.5,2,0],t.legColor??"a",K);}var Ol={bone:"head",rect:[0,1,5,3]};function ss(e,t){let r=(a,n,s)=>({rig:"quadruped",style:{walk:a,idle:n,energy:s},palette:So}),o=(a,n,s)=>({rig:"flyer",style:{walk:a,idle:n,energy:s},face:Ol,palette:So});switch(e){case "wolf":return Te(t),t("ear","head",[2.4,3.4,1],[-2.5,21.5,-10.5],"t",K),Gr(t,"d"),t("ruff","body",[9,6,3],[0,13,-6.5],"l"),t("tail","tail",[3,3,10],[0,13,13],"t",{rot:[25,0,0]}),t("tailTip","tail",[3.1,3.1,2],[0,14.6,17.5],"l",{rot:[25,0,0]}),r("sneaky","proud",.6);case "lion":return Te(t),t("mane","head",[12,12,3],[0,16,-9.5],"a"),t("maneTop","head",[10,2,6],[0,21,-11.5],"a"),t("ear","head",[2,2,1],[-3,21.4,-12],"s",K),Gr(t,"d",[4,2.6,2]),t("tail","tail",[1.4,1.4,10],[0,13,13],"t",{rot:[30,0,0]}),t("tuft","tail",[2.6,2.6,2.6],[0,15.2,18],"a",{rot:[30,0,0]}),r("heavy","proud",.5);case "tiger":Te(t);for(let a of [-5,-1.5,2,5.5])t(`stripe${a}`,"body",[8.3,1,1.1],[0,12.6,a],"d");return t("stripeHead","head",[8.3,1,3],[0,19.8,-11],"d"),t("ear","head",[2,2,1],[-3,21,-10.5],"t",K),Gr(t,"n",[4,2.6,2]),t("tail","tail",[1.8,1.8,10],[0,14,13],"t",{rot:[20,0,0]}),t("tailRing","tail",[2,2,1],[0,15,15],"d",{rot:[20,0,0]}),r("sneaky","proud",.6);case "panda":return Te(t,{body:[9,9,15],legColor:"a",paw:"a"}),t("band","body",[9.2,9.2,4],[0,12,-4.5],"a"),t("ear","head",[2.4,2.4,1.2],[-3,21,-11],"a",K),t("nose","head",[1.6,1,.6],[0,15,-16.3],"a"),t("tail","tail",[2,2,2],[0,14,8.5],"l"),r("heavy","calm",.4);case "pig":return Te(t,{leg:[3,6],paw:"a"}),t("snout","head",[3.6,2.6,1.2],[0,14.6,-16.6],"n"),t("nostril","head",[.6,.8,.2],[-0.8,14.6,-17.3],"a",K),t("ear","head",[2.4,2,1],[-2.6,20.6,-10.5],"n",{mirror:true,rot:[-30,0,0]}),t("tail","tail",[1,1,2.6],[0,15,9],"n",{rot:[-40,0,0]}),r("bouncy","fidgety",.7);case "cow":return Te(t,{body:[9,9,16],paw:"d"}),t("spot","body",[9.2,3.6,4],[0,14,-2],"a"),t("spot2","body",[9.2,3,3],[0,11,5],"a"),t("muzzle","head",[6,3,1.6],[0,13.6,-16.6],"n"),t("horn","head",[1,2.4,1],[-2.8,21.2,-11],"h",K),t("ear","head",[2.6,1.2,1],[-5,18.6,-11],"t",K),t("tail","tail",[1,8,1],[0,11,9],"t"),t("tailTip","tail",[1.6,2,1.6],[0,6.6,9],"a"),r("heavy","calm",.3);case "sheep":return Te(t,{body:[10,9,16],leg:[2.6,7],legColor:"a",paw:"d",head:"a",belly:false}),t("woolTop","body",[9,2,13],[0,17,0],"t"),t("woolHead","head",[8.6,2.4,6],[0,20.4,-11.6],"t"),t("ear","head",[2.6,1,1.6],[-5,18,-11],"a",K),t("tail","tail",[2.6,2.6,2],[0,14,9],"t"),r("bouncy","calm",.5);case "horse":return Te(t,{body:[8,8,17],paw:"d"}),t("muzzle","head",[5,4.6,4],[0,13.8,-17.6],"s"),t("nose","head",[5.2,1.6,1],[0,12.6,-19.6],"l"),t("mane","head",[1.6,3,8],[0,21.4,-9],"a"),t("maneNeck","body",[1.6,3,5],[0,17,-5.5],"a"),t("ear","head",[1.4,2.4,1],[-2.4,21.2,-13.4],"s",K),t("tail","tail",[2.2,10,2.2],[0,10,9.4],"a"),r("normal","proud",.7);case "deer":Te(t,{body:[7,8,15]}),Gr(t,"d",[3.6,2.8,2.4]),t("ear","head",[2.6,1.4,1],[-5,19.6,-10.5],"t",K),t("antler","head",[.8,4,.8],[-2.4,22,-10.5],"h",K),t("antlerTine","head",[2.6,.8,.8],[-3.4,23.2,-10.5],"h",K),t("antlerTop","head",[.8,2,.8],[-4.3,24.4,-10.5],"h",K);for(let a of [-3,1,4])t(`spot${a}`,"body",[1.4,.4,1.4],[-1.6,16.1,a],"l",K);return t("tail","tail",[2,2.4,1.4],[0,14.6,8.4],"l"),r("bouncy","calm",.6);case "mouse":return Te(t,{body:[7,6,12],bodyY:11,leg:[2.4,8],paw:"n"}),t("ear","head",[3.4,3.4,.8],[-3.6,21.4,-10.6],"t",K),t("earIn","head",[2.2,2.2,.3],[-3.6,21.4,-11.1],"n",K),t("nose","head",[1.2,1,.6],[0,15,-16.3],"n"),t("tail","tail",[.8,.8,11],[0,12,13],"n",{rot:[15,0,0]}),r("sneaky","fidgety",.9);case "raccoon":Te(t,{paw:"d"}),t("mask","head",[8.3,1.4,8.3],[0,17,-12],"d",{shape:"cylinder"}),Gr(t,"d",[3.4,2.4,2]),t("ear","head",[2.2,2.4,1],[-2.8,21.2,-10.5],"a",K),t("tail","tail",[3,3,10],[0,14,13],"t",{rot:[20,0,0]});for(let a of [10,13.4,16.8])t(`ring${a}`,"tail",[3.2,3.2,1.4],[0,14+(a-13)*.36,a],"d",{rot:[20,0,0]});return r("sneaky","fidgety",.7);case "elephant":return Te(t,{body:[10,10,16],leg:[4,8],paw:"l"}),t("ear","head",[1,7,6],[-5,16.4,-10.6],"a",K),t("trunk","head",[2.6,4,2.4],[0,12.6,-17.2],"s"),t("trunk2","head",[2.2,4,2.2],[0,9,-17.6],"s"),t("trunkTip","head",[2,1.6,2.6],[0,6.6,-18],"s"),t("tusk","head",[.8,.8,3],[-2.2,12.6,-17.2],"h",K),t("tail","tail",[.8,6,.8],[0,12,8.4],"t"),r("heavy","calm",.3);case "hedgehog":Te(t,{body:[8,6,12],bodyY:10,leg:[2.4,8],paw:"l"}),t("spines","body",[9.4,5,12],[0,13.6,1],"a");for(let a of [-3,1,5])t(`spike${a}`,"body",[1,1.6,1],[-2.4,16.8,a],"a",K);return t("spikeTop","body",[1,1.8,1],[0,16.9,-1],"a"),t("nose","head",[1.4,1.2,1.4],[0,14.6,-16.6],"d"),t("ear","head",[1.4,1.4,.8],[-3,20.6,-10.6],"l",K),r("sneaky","fidgety",.8);case "turtle":return Te(t,{body:[8,5,12],bodyY:9,leg:[3,8],paw:null}),t("shell","body",[11,6,15],[0,13,.6],"a"),t("shellTop","body",[8,1.6,11],[0,16.6,.6],"a"),t("shellRim","body",[11.4,1,15.4],[0,10.4,.6],"l"),t("tail","tail",[1.4,1.4,2.6],[0,11,9],"t"),r("heavy","calm",.2);case "frog":return Te(t,{body:[9,6,12],bodyY:10,leg:[3,8],paw:"a"}),t("eyeBump","head",[2.6,2.4,2.6],[-2.4,21.2,-13],"t",K),t("eyeBall","head",[1.6,1.6,.4],[-2.4,21.4,-14.5],"w",K),t("pupil","head",[.8,.8,.2],[-2.4,21.4,-14.8],"k",K),t("backLeg","legBL",[3.6,3,5],[-3.4,3.5,7.4],"t",K),r("bouncy","calm",.8);case "duck":return $t(t,{wingColor:"t",legColor:"y"}),t("bill","head",[3,.9,2.6],[0,12,-7.6],"y"),t("tail","tail",[3,1,2.4],[0,9.6,5],"t",{rot:[-25,0,0]}),o("bouncy","fidgety",.6);case "chicken":return $t(t,{wing:[3,4,6],wingColor:"t",legColor:"y"}),t("comb","head",[1,2,3.6],[0,16.4,-4],"r"),t("beak","head",[1.4,1,1.6],[0,12.8,-7.2],"y"),t("wattle","head",[.8,1.4,.6],[0,11.2,-6.8],"r"),t("tail","tail",[3,4,3],[0,11,5],"t",{rot:[20,0,0]}),o("bouncy","fidgety",.9);case "owl":return $t(t,{body:[7,7,7],wingColor:"a"}),t("tuft","head",[1,2,1],[-2,16.4,-4],"a",K),t("beak","head",[1,1.2,1],[0,12.4,-7],"y"),t("tail","tail",[3,1,3],[0,6,5],"a"),o("normal","calm",.3);case "penguin":return $t(t,{body:[7,9,6],wing:[3,6,2],wingColor:"t",legColor:"y"}),t("belly2","body",[5,7,.6],[0,7.6,-3.3],"l"),t("beak","head",[1.4,1,1.8],[0,12.6,-7.2],"y"),t("feet","legL",[2,.6,2.4],[-1.5,.3,-0.8],"y",K),o("heavy","fidgety",.6);case "bat":return $t(t,{body:[5,5,5],wing:[9,.6,5],wingColor:"a",legColor:"d"}),t("ear","head",[1.4,2.6,.8],[-1.6,16.6,-4],"t",K),t("fang","head",[.5,.8,.3],[-0.8,11.2,-6.6],"w",K),o("sneaky","fidgety",.8);case "bee":return $t(t,{body:[6,6,8],wing:[5,.4,4],wingColor:"g",legColor:"d"}),t("stripe","body",[6.2,6.2,1.2],[0,8,0],"d"),t("stripe2","body",[6.2,6.2,1.2],[0,8,2.8],"d"),t("stinger","body",[.8,.8,1.6],[0,7.4,4.6],"d"),t("antenna","head",[.4,2.4,.4],[-1.2,16.4,-4.6],"d",K),t("antennaTip","head",[.8,.8,.8],[-1.2,17.8,-4.6],"d",K),o("bouncy","fidgety",1);case "eagle":return $t(t,{body:[6,7,8],wing:[10,1,6],wingColor:"t",legColor:"y",head:"l"}),t("beak","head",[1.6,1.4,2],[0,12.6,-7.4],"y"),t("beakTip","head",[1,1,.8],[0,11.6,-8],"y"),t("tail","tail",[4,1,4],[0,7.4,6],"l"),o("heavy","proud",.6);case "fish":return t("body","body",[5,7,9],[0,6,0],"t"),t("belly","body",[4,1,7],[0,2.4,0],"l"),t("head","head",[5,6,4],[0,6,-6.5],"s"),t("tailFin","tail",[.8,6,4],[0,6,7],"a"),t("dorsal","body",[.8,2.4,4],[0,10.6,0],"a"),t("fin","finL",[3,.6,2],[-4,5,-1],"a",K),{rig:"swimmer",style:{walk:"normal",idle:"calm",energy:.7},face:{bone:"head",rect:[0,1,5,3]},palette:So};case "shark":return t("body","body",[7,7,16],[0,6,1],"t"),t("belly","body",[5.6,1,13],[0,2.4,1],"l"),t("head","head",[7,6,6],[0,6,-9],"s"),t("jaw","head",[6,1.4,5],[0,3.4,-9],"l"),t("dorsal","body",[1,5,4],[0,11.6,0],"t"),t("tailFin","tail",[1,9,5],[0,7,11.4],"t"),t("fin","finL",[4,.8,3],[-5,4,-1],"t",K),{rig:"swimmer",style:{walk:"heavy",idle:"proud",energy:.6},face:{bone:"head",rect:[0,1,7,3]},palette:So}}throw new Error(`unknown creature kind: ${e}`)}var ym=["cat","dog","fox","bear","rabbit","bird","dragon","slime","ghost","robot",...ns],Vl=e=>({k:"#2a1c14",w:"#f4f4ef",b:e,m:"#7a3a30",o:"#3a1a14"});function Fl(e){let t=e.light??e.body,r=e.accent??e.body,o={t:e.body,s:e.body,l:t,a:r,p:r,...Vl(e.eyes??"#3f6f3a")},a=[],n="quadruped",s=Sr("head",[0,3,8,5]),l={walk:"normal",idle:"calm",energy:.6},i=(u,R,w,A,k,x={})=>a.push({name:u,bone:R,size:w,pos:A,color:k,...x});switch(e.kind){case "cat":case "fox":case "dog":case "bear":case "rabbit":{let u=e.kind;i("body","body",[8,8,16],[0,12,0],"t"),i("belly","body",[6,1,12],[0,8,0],"l"),i("head","head",[8,8,8],[0,16,-12],"s");for(let R of ["legFL","legFR","legBL","legBR"]){let w=R.endsWith("L")?-3:3,A=R.startsWith("legF")?-6:6;i(R,R,[3,8,3],[w,4,A],"t"),i(`${R}Paw`,R,[3.2,1.5,3.2],[w,.75,A],"a");}u==="cat"?(i("ear","head",[2,2.5,1],[-2.5,21,-11],"a",{mirror:true}),i("tail","tail",[1.6,1.6,10],[0,15,13],"t",{rot:[20,0,0]}),l={walk:"sneaky",idle:"calm",energy:.5}):u==="fox"?(i("ear","head",[2.4,3.2,1],[-2.5,21.4,-11],"t",{mirror:true}),i("snout","head",[4,3,3],[0,14.5,-17],"l"),i("nose","head",[1.2,1,.6],[0,15.6,-18.6],"a"),i("tail","tail",[3.5,3.5,10],[0,14,13],"t",{rot:[15,0,0]}),i("tailTip","tail",[3.6,3.6,2.5],[0,15.2,18],"l"),l={walk:"bouncy",idle:"fidgety",energy:.7}):u==="dog"?(i("ear","head",[1.5,4,3],[-4.6,17.5,-11.5],"a",{mirror:true}),i("snout","head",[4,3,3],[0,14.5,-17],"l"),i("nose","head",[1.6,1.2,.6],[0,15.8,-18.6],"a"),i("tail","tail",[2,2,7],[0,16,11],"t",{rot:[40,0,0]}),l={walk:"bouncy",idle:"fidgety",energy:.9}):u==="bear"?(i("ear","head",[2,2,1],[-3,20.6,-10.5],"a",{mirror:true}),i("snout","head",[4,3,2.5],[0,14.5,-16.8],"l"),i("nose","head",[1.6,1.2,.6],[0,15.8,-18.2],"a"),i("tail","tail",[2,2,2],[0,14,9],"t"),l={walk:"heavy",idle:"proud",energy:.4}):(i("ear","head",[1.6,7,1],[-1.8,23.5,-11],"t",{mirror:true}),i("earInner","head",[.8,5.5,.4],[-1.8,23.5,-11.6],"l",{mirror:true}),i("tail","tail",[3,3,3],[0,14,9.5],"l"),l={walk:"bouncy",idle:"fidgety",energy:.8});break}case "bird":case "dragon":{n="flyer",s=Sr("head",[0,1,5,3]);let u=e.kind==="dragon";i("body","body",[6,6,8],[0,8,0],"t"),i("belly","body",[4.6,4,1],[0,7.5,-4.2],"l"),i("head","head",[5,5,5],[0,13,-4],"s"),i("wing","wingL",[8,1,6],[-7,10,0],"a",{mirror:true}),i("leg","legL",[1,4,1],[-1.5,2,0],"a",{mirror:true}),u?(i("horn","head",[.8,2,.8],[-1.4,16.4,-3],"l",{mirror:true}),i("snout","head",[3,2,2.4],[0,12.2,-7.4],"s"),i("tail","tail",[2,2,8],[0,7,7],"t"),i("spike","body",[1,1.5,6],[0,11.6,0],"a"),l={walk:"heavy",idle:"proud",energy:.6}):(i("beak","head",[1.6,1.2,2],[0,12.4,-7.2],"a"),i("tail","tail",[4,1,4],[0,8,6],"a"),i("crest","head",[1,2,2],[0,16.2,-3.6],"a"),l={walk:"bouncy",idle:"fidgety",energy:.8});break}case "slime":case "ghost":case "robot":{n="blob",s=Sr("body",[2,3,8,5]),e.kind==="slime"?(i("body","body",[12,10,12],[0,5,0],"t"),l={walk:"bouncy",idle:"fidgety",energy:.9}):e.kind==="ghost"?(i("body","body",[10,12,10],[0,7,0],"t"),i("hem","body",[10.4,2,10.4],[0,1,0],"l",{shape:"cylinder"}),l={walk:"sneaky",idle:"calm",energy:.4}):(i("body","body",[11,11,10],[0,5.5,0],"t"),i("antenna","body",[.8,3,.8],[0,12.5,0],"a"),i("bulb","body",[1.6,1.6,1.6],[0,14.6,0],"l"),i("screen","body",[9,6,.4],[0,6.5,-4.82],"l"),l={walk:"robotic",idle:"calm",energy:.5});break}default:{let u=ss(e.kind,i);n=u.rig,l=u.style,u.face&&(s=Sr(u.face.bone,u.face.rect)),Object.assign(o,u.palette);}}Bl(a);let c=e.kind==="slime"||e.kind==="ghost"?"body":"head";for(let u of a)u.name===c&&u.bone===s.face.bone&&(u.shape="cylinder");let[p,h,m,d]=s.face.rect,b=[p+m*is,h,m*(1-2*is),d];return {version:1,name:e.name,description:e.description??"",rig:n,palette:o,textures:s.textures,parts:a,face:{...s.face,rect:b,drawn:{...Hl(e.kind),eyeColor:e.eyes??Nl}},style:l,finish:Dl,tags:e.tags??[e.kind]}}var Dl={noise:0,outline:0,shade:.12,density:4,round:.35},ur=1.5;function Bl(e){let t=e,r=p=>p.size[0]*p.size[1]*p.size[2],o=p=>t.filter(h=>h.bone===p).sort((h,m)=>r(m)-r(h))[0],a=o("body");if(!a)return;let n=(p,h)=>p.pos[h]-p.size[h]/2,s=(p,h)=>p.pos[h]+p.size[h]/2;for(let p of ["legFL","legFR","legBL","legBR","legL","legR"]){let h=o(p);if(!h||s(h,1)>n(a,1)+ur||s(h,1)<n(a,1)-3)continue;let m=n(h,1),d=n(a,1)+ur;h.size[1]=d-m,h.pos[1]=(d+m)/2;}let l=(p,h,m)=>{for(let d of t)d.bone===p&&(d.pos[h]=d.pos[h]+m);},i=o("head");if(i&&i.pos[2]<n(a,2)){let p=n(a,2)+ur-s(i,2);p>0&&l("head",2,p);}let c=o("tail");if(c&&c.pos[2]>s(a,2)){let p=n(c,2)-(s(a,2)-ur);p>0&&l("tail",2,-p);}for(let p of [o("wingL"),o("finL")]){if(!p)continue;let h=n(a,0)+ur,m=s(p,0);m<h&&(p.size[0]=p.size[0]+(h-m),p.pos[0]=p.pos[0]+(h-m)/2);}if(i)for(let p of t){if(p.bone!=="head"||p===i)continue;let h=n(p,1)-(s(i,1)-ur/2);h>0&&n(p,1)<s(i,1)+.6&&(p.pos[1]=p.pos[1]-h);}}var Nl="#2a1c14",is=.07;function Hl(e){let t=(r,o,a=true)=>({eyes:r,brows:"none",mouth:o,cheeks:a});switch(e){case "cat":case "fox":case "lion":case "tiger":return t("cat","cat");case "dog":case "wolf":case "rabbit":case "mouse":case "raccoon":case "hedgehog":return t("round","cat");case "dragon":return t("almond","fang",false);case "slime":return t("sparkle","smile");case "ghost":return t("round","open",false);case "robot":return t("button","smile",false);case "owl":case "frog":return t("wide","smile");case "shark":return t("narrow","teeth",false);case "fish":return t("round","pout",false);case "bat":return t("round","fang");case "bee":case "turtle":return t("button","smile");default:return t("round","small")}}function gm(e){let t=Ye(Fl(e));if(!t.ok)throw new Error(`${e.kind}: ${t.error}`);return t.spec}var ls={torso:"#d9d3c5",legs:"#5f6b7a"},jl="#2b2140",Gl="#7a2e2e",ql="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",Ul=32,Kl=[10,7],qr=1,Yl={noise:0,outline:0,shade:.12,density:4,round:.35},Wl=["front","back","left","right"];function cs(e){let t=parseInt(e.slice(1),16);return [t>>16&255,t>>8&255,t&255]}var ka=class{map={};next=0;key(t){let r=Object.entries(this.map).find(([,i])=>i===t);if(r)return r[0];if(this.next<Ul){let i=ql[this.next++];return this.map[i]=t,i}let[o,a,n]=cs(t),s=Object.keys(this.map)[0],l=1/0;for(let[i,c]of Object.entries(this.map)){let[p,h,m]=cs(c),d=(o-p)**2+(a-h)**2+(n-m)**2;d<l&&(l=d,s=i);}return s}};function $l(e,t){return (typeof e=="function"?e(t):e[t])??null}function Xl(e){let[t,r]=Kl,o=new U(t,r),a=n=>{n(1),n(6);};switch(e){case "blink":case "tired":a(n=>o.row(3,n,n+2,"k"));break;case "happy":a(n=>o.px(n,3,"k").px(n+1,2,"k").px(n+2,3,"k"));break;case "hurt":o.px(1,2,"k").px(2,3,"k").px(1,4,"k"),o.px(8,2,"k").px(7,3,"k").px(8,4,"k");break;case "surprised":case "scared":a(n=>o.rect(n,2,3,3,"w").px(n+1,3,"k"));break;default:a(n=>o.rect(n,2,3,3,"w").rect(n+1,3,2,2,"e").px(n+1,3,"k"));}switch(e==="angry"&&o.px(1,1,"k").px(2,1,"k").px(3,2,"k").px(8,1,"k").px(7,1,"k").px(6,2,"k"),e==="sad"&&o.px(3,1,"k").px(2,1,"k").px(6,1,"k").px(7,1,"k"),e){case "happy":case "talk":o.rect(4,5,2,2,"m");break;case "surprised":o.rect(4,5,2,2,"m");break;case "sad":o.px(3,6,"m").row(5,4,5,"m").px(6,6,"m");break;case "angry":case "tired":case "scared":case "hurt":o.row(6,4,5,"m");break;default:o.px(3,5,"m").row(6,4,5,"m").px(6,5,"m");}return o.tex()}function va(e,t){let r=Ae[Zt],o=new ka,a=o.key(e.body.skin),n=r.defaultParts.map(d=>({...d,size:[...d.size],pos:[...d.pos],color:d.name==="torso"?o.key(ls.torso):d.name?.startsWith("leg")||d.name?.startsWith("foot")?o.key(ls.legs):a})),s=new Map;for(let d of n){let b=s.get(d.name)??[];b.push(d),s.set(d.name,b);}for(let d of s.values())d.sort((b,u)=>u.pos[1]+u.size[1]/2-(b.pos[1]+b.size[1]/2));let l=(e.body.head??ga)==="round";if(l)for(let d of n)d.name==="head"?(d.shape="cylinder",d.size=[d.size[0],d.size[1]+qr,d.size[2]],d.pos=[d.pos[0],d.pos[1]+qr/2,d.pos[2]]):d.name==="neck"&&(d.size=[2.6,1.8,2.4],d.pos=[0,23.1,0]);let i={},c={k:o.key(jl),w:o.key("#ffffff"),e:o.key(e.face.eyeColor),m:o.key(Gl)},p={};for(let d of kr){let b=Xl(d),u="face_"+d;i[u]={...b,rows:b.rows.map(R=>[...R].map(w=>c[w]??w).join(""))},p[d]=u;}p.neutral=p[d$1[e.face.emotion]]??p.neutral;for(let d of Kt){let b=e.wear[d];if(!b)continue;let u=$l(t,b);if(!u||u.slot!==d||u.style!==je)continue;let R={};for(let[x,f]of Object.entries(u.palette))R[x]=f===qt?a:o.key(x===u.tint&&e.tint[d]?e.tint[d]:f);let w={};for(let[x,f]of Object.entries(u.textures)){let S=`${d}_${x}`;w[x]=S,i[S]={w:f.w,h:f.h,rows:f.rows.map(T=>[...T].map(C=>R[C]??C).join(""))};}let A=x=>{if(!x)return;let f={};for(let[S,T]of Object.entries(x)){let C=w[T]??R[T];C&&(f[S]=C);}return Object.keys(f).length?f:void 0};for(let x of u.paint){let f=s.get(x.region);if(!f)continue;let S=R[x.color],T=A(x.faces);f.forEach((C,z)=>{S&&(C.color=S);let _=T&&Jl(T,f,z,i);_?C.faces=_:delete C.faces;});}let k=d==="hair"||d==="hat"||d==="faceAcc"&&!u.parts.some(x=>x.mat);for(let x of u.parts){let f={bone:x.bone,size:[...x.size],pos:[...x.pos],color:R[x.color]??a},S=A(x.faces);if(S&&(f.faces=S),x.rot&&(f.rot=[...x.rot]),x.mirror&&(f.mirror=true),x.name&&(f.name=x.name),x.mat&&(f.mat=x.mat),l&&x.bone===r.faceBone){let T=d==="hair"||d==="hat"?qr:qr/2;f.pos=[f.pos[0],f.pos[1]+T,f.pos[2]],k&&(f.wrap=true);}n.push(f);}}let h={version:1,name:"Avatar",description:"",rig:Zt,scale:e.body.height,palette:o.map,textures:i,parts:n,bones:[],face:{bone:r.faceBone,rect:l?[Et[0],Et[1]+qr/2,Et[2],Et[3]]:[...Et],expressions:p},style:{walk:e.anim?.walk??ct.walk,idle:e.anim?.idle??ct.idle,energy:.6},voice:{pitch:1},tags:["avatar",je],finish:{...Yl}},m=Ye(h);if(!m.ok)throw new Error("composeAvatar: "+m.error);return m.spec}function Jl(e,t,r,o){if(t.length===1)return {...e};let a=t[0].pos[1]+t[0].size[1]/2,n=Math.min(...t.map(c=>c.pos[1]-c.size[1]/2)),s=Math.max(1e-6,a-n),l=c=>c<=0?0:c>=t.length?1:(a-(t[c-1].pos[1]-t[c-1].size[1]/2))/s,i={};for(let[c,p]of Object.entries(e)){let h=o[p];if(!h){i[c]=p;continue}if(c==="top"){r===0&&(i[c]=p);continue}if(c==="bottom"){r===t.length-1&&(i[c]=p);continue}if(!Wl.includes(c))continue;let m=Math.min(h.h-1,Math.round(l(r)*h.h)),d=Math.max(m+1,Math.round(l(r+1)*h.h)),b=`${p}_${r}`;o[b]||(o[b]={w:h.w,h:d-m,rows:h.rows.slice(m,d)}),i[c]=b;}return Object.keys(i).length?i:void 0}var Ql={paths:[{x:243,y:-2,d:"M147.333 12.333c-13.6 2.534-12.533 1.2-12.933 15.067l-.4 12.267-4.533-11.067c-2.534-6-5.067-10.933-5.734-10.933-2.666 0-27.866 8.666-36.533 12.666-11.733 5.334-26.667 14.8-36.133 22.934l-6.934 5.866L51.6 69.267c8.133 11.066 7.333 11.466-5.067 2.933-7.6-5.067-8.4-5.333-11.466-3.733-3.467 1.866-18.4 17.333-20.4 21.2-.8 1.6 7.066 8.8 33.733 30.933l34.667 28.933 8.8-8.266c14.666-13.867 28.666-22 48.133-28.267 9.067-2.933 14.8-3.733 28.533-4.4 34.267-1.333 60 7.467 81.6 28.133 21.6 20.4 34.934 49.6 37.467 81.734l.8 11.2 14.8 4.533c8.133 2.533 23.733 7.333 34.667 10.8 10.933 3.333 20.4 5.6 21.066 4.933 1.6-1.6 6.134-20.533 7.734-32.666.8-6 1.333-17.6 1.066-25.6l-.4-14.667-8-1.067c-4.4-.533-10.133-1.466-12.666-1.866l-4.667-.8 4.667-1.2c16.933-4.534 18.666-5.2 18.666-8 0-5.467-9.6-31.334-16.666-44.8-4-7.6-10.667-18.667-14.934-24.667-9.866-13.867-31.333-35.467-45.2-45.2-10.4-7.467-34.4-20.933-37.2-21.067-.8 0-4 4-7.333 8.8-3.2 4.8-6.133 8.134-6.4 7.334s.4-5.6 1.6-10.667c1.2-5.2 2.133-9.6 2.133-9.867 0-.933-19.866-6.133-34.4-9.066-14.8-2.934-49.333-4.4-59.6-2.534"},{x:243,y:-2,d:"M157.867 125.533c-21.067 3.334-42.134 14.8-57.467 31.334-13.333 14.133-13.733 12.8 5.6 22 9.2 4.4 16.667 8.266 16.667 8.533s-1.334.4-2.934.133c-13.866-2.133-41.6-5.866-41.733-5.6-.267.267-7.467 28.534-16.267 63.067l-16 62.667 7.334.4c4 .266 7.466.266 7.6 0 .266-.267 3.866-13.867 8.133-30.4 4.267-16.534 8.267-30.8 8.933-31.734.934-1.2 11.067-1.6 42.4-1.6 32.134 0 41.2.4 41.2 1.6 0 .934-1.733 4.667-3.866 8.4L153.733 261l-35.066 6.933c-19.334 3.867-35.2 7.2-35.467 7.467-.667.667-29.867 113.467-29.467 113.867.267.133 23.734-3.6 52.4-8.534l52-8.8 20.4-39.866c11.2-22 20.667-39.734 20.934-39.467.4.533-1.334 26.8-2.8 40.8l-.667 6.933 6.267-3.2c21.2-10.666 52.4-13.466 86.933-8l5.867.934-5.6-7.334C286.4 318.6 281.2 310.6 278 304.867c-5.867-10.134-6-10.8-6-21.867 0-6.267 1.467-20 3.333-30.667 1.867-10.666 3.334-19.466 3.334-19.466 0-.134-9.067-4.267-20.134-9.334s-19.466-9.333-18.8-9.6c.8-.266 7.734.8 15.6 2.267 7.734 1.6 14.4 2.8 14.8 2.8 1.2 0 .4-10.533-1.466-18-7.2-27.733-28-53.467-53.734-66-16.4-8-40.8-12-57.066-9.467"},{x:243,y:-2,d:"M235.6 346.333c-24 4.534-44.133 13.867-68.267 31.467-14 10.267-28.533 18.133-47.733 25.867-23.467 9.466-52.8 32.666-64.4 50.666l-2.533 4L58 454.2c9.333-7.333 30.133-19.467 49.333-28.667C173.733 393.667 246.4 382.2 312.8 393c11.2 1.733 39.2 8.533 45.067 10.8 2.266.8 2.266.667.8-2.267-4-7.6-15.6-21.866-25.867-31.466-12-11.467-24.667-18.934-37.6-22.4-11.467-3.067-46.267-3.867-59.6-1.334"},{x:-460,y:467,d:"M721.533 34.467c-14.933 5.466-22 17.466-22.933 38.666-.933 24.134 3.467 32.8 30.267 59.867 19.6 19.867 22.933 25.2 22.933 37.867.133 13.466-6.133 20.133-16.933 18.4-9.067-1.467-12.534-7.867-12.534-22.667V159H696.6l.667 13.333c.533 11.467 1.2 14.4 4.933 22 7.067 14.267 16.8 19.6 36.4 19.734 10.667.133 12.267-.134 20.667-4.4 7.6-3.867 9.733-5.867 13.2-11.734 7.6-12.533 9.066-32 3.733-47.6-3.733-11.066-10.667-20.4-27.867-37.2-19.866-19.6-22.533-24.133-22.666-38.4 0-8.933.4-10.533 3.2-13.6 6.266-6.666 18.266-5.6 22.133 2 1.067 2 2 7.067 2 11.2v7.334h27.067l-.934-9.2c-1.6-18.267-8.266-30.267-20-36.4-7.2-3.867-29.2-4.8-37.6-1.6M630.067 34.867c-11.734 4.666-18 11.6-21.734 24.4-1.866 6.4-2 15.333-1.733 67.2l.4 59.866 3.733 7.6c6.8 13.867 18.534 20.267 36.934 20.267 13.733 0 22.933-3.333 30.666-11.067 10.934-11.066 11.2-12.533 11.734-74.666.266-35.734-.134-56.934-1.067-62.8-2.667-16.134-11.6-27.467-24.8-31.467-8.933-2.667-26.4-2.267-34.133.667m28.666 26.8 3.6 4v56.666c0 40.934-.4 57.467-1.6 60-3.6 8-15.6 9.734-22.666 3.467l-4.4-3.867-.4-56.533c-.267-51.733-.134-56.8 2-61.067 3.066-5.866 7.6-8.266 14.4-7.466 3.733.4 6.4 1.866 9.066 4.8M511.667 123.133v89.334l29.066-.4c28.8-.4 28.934-.4 36.667-4.267 9.467-4.533 14.4-10.933 17.467-22.4 2-7.333 2.266-15.467 1.866-65.733l-.4-57.334-4.266-8.8c-8.267-16.666-17.2-19.866-55.334-19.866h-25.066zm53.6-60.266 4.4 3.866.4 52.8c.266 35.067-.134 54.4-1.067 58-2 7.467-5.733 9.6-18.667 10.4l-10.666.8V59h10.666c9.867 0 10.934.267 14.934 3.867M471.667 145v67.333h26.666V77.667h-26.666zM471.667 48.333V63h26.666V33.667h-26.666z"},{x:-106,y:244,d:"M893.4 259.733c-6.8 3.467-9.2 5.6-12.667 11.467-10.666 17.733-9.2 42.933 3.467 62.267 2.8 4.266 12.267 14.8 20.933 23.333 9.867 9.467 17.067 17.733 18.934 21.6 5.6 11.333 5.2 25.333-.934 30.8-3.466 3.067-11.333 4.133-16.133 2.133-5.867-2.4-8-7.466-8-19.333v-10h-27.067l.8 11.6c1.2 15.867 3.867 24.133 10.267 31.333 7.467 8.534 16.4 12.134 30 12.267 19.067.133 30.133-5.733 37.333-19.867 3.734-7.466 4-8.666 4-24 0-16 0-16.133-5.2-26.666-4.4-9.2-7.733-13.2-23.066-28.534-21.067-21.066-24.8-27.066-24.934-40.4-.133-10.4 2.8-15.6 9.734-17.6 10.133-2.933 17.2 3.334 18.4 16.267l.8 8.267H955.4l-.8-10.8c-.533-8.4-1.6-12.667-4.8-19.2-7.067-14.134-16.667-19.334-36.133-19.334-10.667 0-12.534.4-20.267 4.4M791 346v89.333h76v-24h-48v-54.666h37.333v-24H819V282h48v-25.333h-76zM661.667 346v89.333h22.666l.134-63.066c0-34.534.533-61.734 1.066-60.267.534 1.467 5.467 29.867 10.8 62.933l9.867 60.4h13.067c7.2 0 13.066-.4 13.066-1.066 0-3.067 18.8-124.8 19.334-125.334.4-.4.666 27.867.666 62.8v63.6h25.334V256.667h-38l-9.2 61.6c-5.067 34-9.6 62.133-10 62.666-.534.534-5.334-26.4-10.667-60-5.467-33.466-10.133-61.733-10.533-62.666-.4-1.2-5.467-1.6-19.067-1.6h-18.533zM586.467 258.267c-.8 2.666-27.467 172.4-27.467 174.933 0 1.867 1.733 2.133 12 2.133h11.867l.8-4.4c.533-2.266 1.6-9.333 2.4-15.6l1.6-11.333 17.6-.4 17.466-.4 1.467 8.4c.8 4.667 1.733 11.867 2.267 16l.933 7.733h13.733c7.6 0 13.867-.266 13.867-.666 0-.8-26.533-168.134-27.467-173.734l-.8-4.266h-19.866c-14.8 0-20.134.4-20.4 1.6M613 336.533c3.333 23.067 5.867 42.134 5.6 42.4-.4.267-6.533.267-13.867.134l-13.2-.4 4.934-33.334c2.8-18.4 5.733-38.4 6.666-44.666C604.2 292.533 605 290.133 605.8 292c.533 1.467 3.867 21.467 7.2 44.533M497.267 257.2c-10.134 3.733-15.2 8.267-19.867 17.733L473 284l-.4 59.067c-.4 51.2-.133 60.133 1.733 66.533 5.6 19.333 17.067 27.333 39.467 27.467 10.267.133 12.267-.267 20.133-4.134 9.334-4.533 13.867-9.733 17.867-20.266 2-4.934 2.4-12 2.933-41.067l.534-34.933h-38.934v23.866l6.4.4 6.267.4v19.334c0 13.466-.533 20.666-1.867 23.733-5.066 12-23.333 10.4-26.8-2.4-.933-3.6-1.333-23.2-1.066-59.067.4-48.533.666-54.133 2.666-57.333 3.334-4.8 11.2-7.067 17.6-4.933 6.934 2.266 9.067 7.2 9.867 22.933l.667 13.067H555.4l-.8-15.734c-.8-18-3.067-25.6-9.867-33.466-7.466-8.8-13.466-11.2-29.066-11.734-9.067-.266-14.934.134-18.4 1.467"}]},Zl={helmet:{paths:[0,1,2],box:[258,10,353,447]},wordmark:{paths:[3,4],box:[12,499,837,182]}},ec={"top.idos":{color:"#f8f8fc",faces:["front","back"],layers:[{art:"helmet",y:19.4,z:2.3,height:3.9},{art:"wordmark",y:14.85,z:2.15,width:6.2}]}},ps=512,hs=.02,ms=new Map;function tc(e,t){if(typeof document<"u"){let r=document.createElement("canvas");return r.width=e,r.height=t,r}return new OffscreenCanvas(e,t)}function rc(e,t,r){let o=`${e}:${r}`,a=ms.get(o);if(a)return a;if(typeof Path2D>"u")return null;let[n,s,l,i]=t.box,c=i*hs,p=ps/(i+2*c),h=tc(Math.round((l+2*c)*p),ps),m=h.getContext("2d");if(!m)return null;m.clearRect(0,0,h.width,h.height),m.fillStyle=r;for(let b of t.paths){let u=Ql.paths[b];m.setTransform(p,0,0,p,(u.x-n+c)*p,(u.y-s+c)*p),m.fill(new Path2D(u.d));}let d=new B.CanvasTexture(h);return d.colorSpace=B.SRGBColorSpace,d.anisotropy=4,ms.set(o,d),d}function Aa(e){let t=[];for(let r of Kt){let o=e.wear[r],a=o?ec[o]:void 0;if(a)for(let n of a.layers){let s=Zl[n.art],l=rc(n.art,s,a.color);if(!l)continue;let[,,i,c]=s.box,p=i/c,h=n.height??(n.width??1)/p,m=n.width??h*p,d=2*hs*h;for(let b of a.faces){let u=(b==="front"?-1:1)*(n.z+.03),R=[0,n.y,u];t.push({bone:"body",center:R,w:m+d,h:h+d,facing:b,texture:l});}}}return t}var Mo=class extends Eo{face;rest;mood="neutral";constructor(t,r,o={}){let a=new dr(t.face);super(va(t,r),{gloss:true,shadows:true,...o,facePainter:a}),this.face=a,this.rest=t.face.emotion,this.view.setPrints(Aa(t)),this.applyMood();}setEmotion(t){this.mood=t,this.applyMood();}setAvatar(t,r){this.face.setFace(t.face),this.rest=t.face.emotion,this.setSpec(va(t,r)),this.view.setPrints(Aa(t)),this.applyMood();}applyMood(){super.setEmotion(this.mood==="neutral"?this.rest:this.mood),this.animator.moodOverGestures=this.rest!=="neutral";}dispose(){super.dispose(),this.face.dispose();}};var ac=1.12,nc=.25,ds=1.6;function us(e){e.outputColorSpace=B.SRGBColorSpace,e.toneMapping=B.NeutralToneMapping,e.toneMappingExposure=ac,e.shadowMap.enabled=true,e.shadowMap.type=B.PCFShadowMap;let t=new B.PMREMGenerator(e),r=new RoomEnvironment,o=t.fromScene(r,.04).texture;return r.dispose(),t.dispose(),{light(a){a.environment=o,a.environmentIntensity=nc,a.add(new B.HemisphereLight(14543103,8019024,.6));let n=new B.DirectionalLight(16772829,3.4);n.position.set(4,4.4,-2.2),n.castShadow=true;let s=n.shadow.camera;s.left=s.bottom=-ds,s.right=s.top=ds,s.near=.5,s.far=12,n.shadow.mapSize.set(1024,1024),n.shadow.bias=-5e-4,n.shadow.normalBias=.02,n.shadow.radius=4,n.shadow.intensity=.55,n.target.position.set(0,1,0),a.add(n,n.target);let l=new B.DirectionalLight(13623551,.45);l.position.set(-3,.8,-3),a.add(l);let i=new B.DirectionalLight(14478591,2.6);i.position.set(-3.2,2.6,2.6),a.add(i);},dispose(){o.dispose();}}}function sc(e){if(e==="walk")return .3;if(e==="idle")return 1.2;let t=$e[e];return t.loop?1:t.duration*.4}var Nm=["#a99cff","#5b4bd6"];function ic(e,t){switch(t){case "full":return {center:new B.Vector3(0,e*.5,0),size:e*1.12,lift:.04};case "torso":return {center:new B.Vector3(0,e*.57,0),size:e*.5,lift:.06};case "legs":return {center:new B.Vector3(0,e*.2,0),size:e*.5,lift:.1};case "feet":return {center:new B.Vector3(0,e*.08,0),size:e*.32,lift:.3};case "face":return {center:new B.Vector3(0,e*.86,0),size:e*.34,lift:.04};case "head":return {center:new B.Vector3(0,e*.88,0),size:e*.5,lift:.08};default:return {center:new B.Vector3(0,e*.8,0),size:e*.56,lift:.08}}}function lc(e){let t=e.view.spec.parts,r=t.find(a=>a.name==="head"),o=0;for(let a of t)o=Math.max(o,a.pos[1]+a.size[1]/2);return !r||o<=0?e.height:Math.min(e.height,e.height*(r.pos[1]+r.size[1]/2)*cc/o)}var cc=1.022;function pc(e){return typeof e=="number"?e:e==="side"?Math.PI/2:e==="back"?Math.PI:.18}function fs(e,t,r,o,a,n,s){let l=s.frame??"portrait",i={...a,face:{...a.face,emotion:"neutral"}},c=new Mo(i,n,{seed:7});try{e.setClearColor(0,0);let p=new B.Scene;t.light(p),c.group.rotation.y=pc(s.view),p.add(c.group);for(let f=0;f<20;f++)c.update(1/30);let h=s.motion;if(h){h==="walk"?c.setPose("walk"):h!=="idle"&&c.playEmote(h);let f=Math.round(Math.max(0,s.at??sc(h))*30);for(let S=0;S<f;S++)c.update(1/30);}if(!h||h==="walk"||h==="idle"||s.expression){let f=s.expression??a.face.emotion;c.view.setExpression(cr[f][0],f);}let{center:m,size:d,lift:b}=ic(l==="full"||l==="head"?c.height:lc(c),l),u=28,R=new B.PerspectiveCamera(u,1,.05,50),w=d/2/Math.tan(B.MathUtils.degToRad(u/2));R.position.set(m.x,m.y+d*b,m.z-w),R.lookAt(m),e.render(p,R);let A=document.createElement("canvas");A.width=o,A.height=o;let k=A.getContext("2d");if(!k)return r;let x=s.background;if(typeof x=="string")k.fillStyle=x,k.fillRect(0,0,o,o);else if(x){let f=k.createRadialGradient(o*.5,o*.38,o*.05,o*.5,o*.5,o*.72);f.addColorStop(0,x[0]),f.addColorStop(1,x[1]),k.fillStyle=f,k.fillRect(0,0,o,o);}return k.imageSmoothingEnabled=!s.pixelated,k.drawImage(r,0,0),A}finally{c.dispose();}}function bs(e,t){let r=document.createElement("canvas");r.width=e,r.height=e;let o=new B.WebGLRenderer({canvas:r,antialias:!t,alpha:true,preserveDrawingBuffer:true});return o.setPixelRatio(1),o.setSize(e,e,false),{renderer:o,lighting:us(o),gl:r}}function ys(e){e.lighting.dispose(),e.renderer.dispose(),e.renderer.forceContextLoss();}function mc(e,t,r={}){let o=Math.max(16,Math.round(r.size??256)),a=bs(o,!!r.pixelated);try{return fs(a.renderer,a.lighting,a.gl,o,e,t,r)}finally{ys(a);}}function gs(e={}){let t=Math.max(16,Math.round(e.size??256)),r=bs(t,!!e.pixelated);return {render(o,a,n={}){if(!r)throw new Error("snapshotter disposed");return fs(r.renderer,r.lighting,r.gl,t,o,a,{...n,pixelated:e.pixelated})},dispose(){r&&(ys(r),r=null);}}}function Hm(e,t,r={}){let o=mc(e,t,r);return new Promise(a=>o.toBlob(n=>a(n),"image/png"))}function jm(e){if(!e?.spec)return null;let t={};for(let r of e.items??[])r&&typeof r.id=="string"&&(t[r.id]=r);return {spec:pr(e.spec),items:t}}function Me(e,t){let r=mr(e);if(!r.ok)throw new Error(`avatar set: ${String(e.id)}: ${r.errors.join("; ")}`);return t===void 0?{item:r.item}:{item:r.item,price:t}}var Z=e=>({w:e[0].length,h:e.length,rows:e}),g=(e,t,r,o={})=>({bone:"head",size:e,pos:t,color:r,...o}),L=(e,t,r,o={})=>({bone:"body",size:e,pos:t,color:r,...o}),W=(e,t,r,o,a={})=>({bone:e,size:t,pos:r,color:o,mirror:true,...a});var tt=(e,t,r,o,a,n)=>Me({id:`back.${e}`,slot:"back",name:t,palette:r,tint:o,parts:a},n),St=(e,t,r,o,a,n)=>Me({id:`neck.${e}`,slot:"neck",name:t,palette:r,tint:o,parts:a},n),le={mirror:true},xs=[L([2.25,7.5,1.47],[1.69,21.15,3.04],"b",le),L([10.13,3.13,.74],[7.31,26.15,3.86],"a",le),L([10.13,3.13,.74],[7.88,23.03,4.05],"b",le),L([9,3.13,.74],[8.44,19.9,4.23],"a",le),L([6.75,3.13,.74],[9,16.77,4.42],"b",le),L([4.5,3.13,.74],[9.56,13.65,4.6],"a",le)],ws=[tt("shield","Round shield",{a:"#a32d2d",b:"#d8b030",c:"#5a3a22"},"a",[L([8,8,.8],[0,17.5,3.4],"a"),L([8.6,.8,1],[0,21.6,3.4],"c"),L([8.6,.8,1],[0,13.4,3.4],"c"),L([2.2,2.2,.8],[0,17.5,4.2],"b",{mat:"metal"})]),tt("skateboard","Skateboard",{a:"#2ab0c0",b:"#1d1d21",c:"#f4f1ea"},"a",[L([3,11,.5],[0,18,3.4],"a"),L([1,1,1],[1,13.4,3.9],"c",le),L([1,1,1],[1,22.6,3.9],"c",le)]),tt("rocketpack","Rocket pack",{a:"#c8ccd2",b:"#2b2140",f:"#ff8a2a"},null,[L([2.6,7,2.6],[1.6,17.5,3.8],"a",{mirror:true,mat:"metal"}),L([1.8,.8,1.8],[1.6,13.6,3.8],"b",le),L([1.4,3,1.4],[1.6,11.6,3.8],"f",{mirror:true,mat:"glow"}),L([2.8,.8,2.8],[1.6,21.4,3.8],"b",le)],250),tt("guitar","Guitar",{a:"#c0612b",b:"#3a2414",c:"#1d1d21"},"a",[L([5,5,1.4],[0,12.5,3.6],"a"),L([1,9,.8],[0,19.5,3.6],"b"),L([1.6,1.8,.9],[0,24.9,3.6],"b"),L([1.4,1.4,.2],[0,12.8,4.35],"c")],150),tt("batwings","Bat wings",{a:"#3c2f5a",b:"#241a3a"},"a",xs,200),tt("dragonwings","Dragon wings",{a:"#3c9a3c",b:"#2a6a2a",c:"#e8d27a"},"a",[...xs.slice(0,5),L([1,1.6,1],[12.2,28.3,3.86],"c",le)],250),tt("butterfly","Butterfly wings",{a:"#f2a03a",b:"#2b2140"},"a",[L([6,7,.4],[4.2,21,3.2],"a",le),L([4.6,5,.4],[3.6,15,3.2],"a",le),L([1.4,1.4,.3],[5,22.4,3.5],"b",le),L([1,1,.3],[3.8,15,3.5],"b",le)],180),tt("fairy","Fairy wings",{a:"#c8f0ff",b:"#f6c8ff"},"a",[L([4.6,7,.3],[3.5,22,3],"a",{mirror:true,mat:"glass"}),L([3.4,4.6,.3],[3,16,3],"b",{mirror:true,mat:"glass"})],200),tt("quiver","Quiver",{a:"#7a4f2a",b:"#c8ccd2",c:"#f4f1ea"},"a",[L([2.4,8,2.4],[1.8,20,3.8],"a"),L([.4,3,.4],[1.2,25.5,3.6],"b"),L([.4,3,.4],[2.4,25.8,4],"b"),L([.8,.8,.3],[1.2,27.2,3.6],"c"),L([.8,.8,.3],[2.4,27.5,4],"c")],120),tt("shell","Turtle shell",{a:"#4c8a3a",b:"#2f5a24",c:"#c8b070"},"a",[L([8.6,9,2.8],[0,17.5,3.6],"a"),L([9.2,.9,3],[0,13,3.6],"c"),L([4,4,.4],[0,18,5.15],"b")],150)],Rs=[St("scarf","Scarf",{a:"#c0392b",b:"#f4f1ea"},"a",[L([6,1.8,5.4],[0,22.5,0],"a"),L([1.6,4.5,.6],[1.2,19.4,-2.7],"a"),L([1.6,3.4,.6],[-0.6,19.9,-2.95],"b")]),St("bowtie","Bow tie",{a:"#c0392b"},"a",[L([.6,.7,.6],[0,21.9,-2.6],"a"),L([1.2,1.2,.4],[.85,21.9,-2.55],"a",le)]),St("bandana","Neck scarf",{a:"#2f5fd0"},"a",[L([6,1.4,5],[0,22.4,0],"a"),L([4,1.6,.6],[0,21,-2.6],"a"),L([2.4,1.2,.6],[0,19.8,-2.6],"a"),L([1,.8,.6],[0,19,-2.6],"a")]),St("chain","Gold chain",{a:"#e8b730"},null,[L([5.4,.5,4.8],[0,22.3,0],"a",{mat:"metal"}),L([.5,2.2,.4],[0,21,-2.55],"a",{mat:"metal"}),L([1.2,1.2,.4],[0,19.6,-2.6],"a",{mat:"metal"})],150),St("medal","Medal",{a:"#e8b730",b:"#2f5fd0"},"b",[L([5.4,.5,4.8],[0,22.3,0],"b"),L([1.2,3.4,.3],[0,20.4,-2.5],"b"),L([1.6,1.6,.4],[0,18.3,-2.6],"a",{mat:"metal"})],120),St("heart","Heart pendant",{a:"#e8436b",b:"#c8ccd2"},"a",[L([5.4,.4,4.8],[0,22.3,0],"b",{mat:"metal"}),L([.3,2.4,.3],[0,20.9,-2.5],"b",{mat:"metal"}),L([1.4,1.2,.4],[0,19.3,-2.6],"a"),L([.7,.5,.4],[.35,20,-2.6],"a",le)],100),St("lei","Flower lei",{a:"#4c9a4a",b:"#f08cb4",c:"#f2d33c",d:"#f4f1ea",e:"#ef9f27"},null,[L([6,1,5.4],[0,22.4,0],"a"),L([1.3,1.3,1.3],[2.4,21.4,-2.6],"b",le),L([1.3,1.3,1.3],[0,20.9,-2.8],"c"),L([1.3,1.3,1.3],[3,22,0],"d",le),L([1.3,1.3,1.3],[2,21.8,2.6],"e",le)],120),St("headphones","Headphones on the neck",{a:"#2b2140",b:"#4be0c8"},"b",[L([1.4,2,2.2],[3.6,22.2,-0.2],"a",le),L([.3,1.4,1.6],[4.35,22.2,-0.2],"b",{mirror:true,mat:"glow"}),L([6,.7,.8],[0,21.6,2.2],"a")],150)];var Ea=e=>({front:e,back:e,left:e,right:e}),rt=(e,t,r,o,a,n)=>Me({id:`bottom.${e}`,slot:"bottom",name:t,palette:r,tint:o,textures:a.textures??{},paint:a.paint,parts:a.parts??[]},n),ks=[rt("sweatpants","Sweatpants",{a:"#8a8f98",b:"#6a6f78"},"a",{paint:[{region:"legs",color:"a"}],parts:[W("shinR",[4.4,1,4.4],[2.1,1.4,0],"b")]}),rt("leggings","Leggings",{a:"#1d1d21",w:"#f4f1ea"},"a",{textures:{st:Z(["aawa","aawa","aawa","aawa"])},paint:[{region:"legs",color:"a",faces:{left:"st",right:"st"}}]}),rt("pleated","Pleated skirt",{a:"#2b2140",b:"#3c3450",s:"@skin"},"a",{textures:{pl:Z(["abababab","abababab","abababab","abababab"])},paint:[{region:"legs",color:"s"}],parts:[L([10.4,4.8,5.6],[0,11.3,0],"a",{faces:Ea("pl")})]}),rt("joggers","Joggers",{a:"#2f5fd0",b:"#1d3f90"},"a",{paint:[{region:"legs",color:"a"}],parts:[W("shinR",[4.3,1.2,4.3],[2.1,1.3,0],"b")]}),rt("plaidskirt","Plaid skirt",{a:"#a32d2d",b:"#2b2140",s:"@skin"},"a",{textures:{pl:Z(["abaabaab","bbbbbbbb","abaabaab","abaabaab","bbbbbbbb","abaabaab"])},paint:[{region:"legs",color:"s"}],parts:[L([10.13,4.38,5.52],[0,11.46,0],"a",{faces:Ea("pl")})]},100),rt("denimshorts","Denim shorts",{a:"#3f6fd8",b:"#6a8fe8",s:"@skin"},"a",{paint:[{region:"legs",color:"s"}],parts:[W("legR",[4.62,5.4,4.62],[2.1,9.7,0],"a"),W("legR",[4.8,.8,4.8],[2.1,7.3,0],"b")]},80),rt("ripped","Ripped jeans",{a:"#2f5fd0",s:"@skin"},"a",{textures:{rp:Z(["aaaa","asaa","aaaa","aaaa","assa","aaaa"])},paint:[{region:"legs",color:"a",faces:{front:"rp"}}]},100),rt("camo","Camo pants",{a:"#5a6b3a",b:"#3a4a28",c:"#8a8a5a"},"a",{textures:{cm:Z(["aabbac","abbaac","caabba","ccaaba","abccaa","aabcca"])},paint:[{region:"legs",color:"a",faces:Ea("cm")}]},120),rt("tutu","Tutu",{a:"#f08cb4",b:"#ffc0d8",c:"#f4d8e4"},"a",{paint:[{region:"legs",color:"c"}],parts:[L([12,1.6,8],[0,12.5,0],"a"),L([11,1.2,7.2],[0,11.4,0],"b")]},150),rt("flares","Flared pants",{a:"#c87f17",b:"#a8670f"},"a",{paint:[{region:"legs",color:"a"}],parts:[W("shinR",[5.2,3,5.2],[2.1,2.3,0],"a")]},100)];var G=-4.75,Xt=(e,t="a",r)=>[g([1.7,.3,.3],[3.6,e,G],t,{mirror:true,...r?{mat:r}:{}}),g([.3,.3,4.4],[4.45,e,-2.55],t,{mirror:true,...r?{mat:r}:{}})],Le=(e,t,r,o,a,n)=>Me({id:`face.${e}`,slot:"faceAcc",name:t,palette:r,tint:o,parts:a},n),fr={"face.glasses":Le("glasses","Round glasses",{a:"#2b2140",g:"#cfe8ff"},"a",[g([2.6,.3,.3],[1.6,27.1,G],"a",{mirror:true}),g([2.6,.3,.3],[1.6,24.5,G],"a",{mirror:true}),g([.3,2.9,.3],[2.9,25.8,G],"a",{mirror:true}),g([.3,2.9,.3],[.3,25.8,G],"a",{mirror:true}),g([2.3,2.3,.15],[1.6,25.8,G],"g",{mirror:true,mat:"glass"}),...Xt(26.6)]).item,"face.shades":Le("shades","Sunglasses",{a:"#1d1d21",g:"#2a2a30"},"a",[g([2.8,2.1,.3],[1.6,25.85,G],"g",{mirror:true,mat:"glass"}),g([6.8,.42,.36],[0,26.95,G],"a"),g([.36,1.6,.36],[3.05,26.1,G],"a",{mirror:true}),...Xt(26.75)]).item,"face.visor":Le("visor","Cyber visor",{a:"#33e0ff",b:"#1d1d21"},"a",[g([8.6,1.8,.35],[0,25.9,-4.6],"a",{mat:"glow"}),g([.4,1.2,2.4],[4.35,26,-3.4],"b",{mirror:true}),g([.3,.6,7.6],[4.45,26.2,.4],"b",{mirror:true}),g([8.9,.6,.3],[0,26.2,4.45],"b")]).item},vs=[Le("mask","Face mask",{a:"#9ad0f0",b:"#f4f1ea"},"a",[g([6.4,2.8,.6],[0,23.6,-4.15],"a"),g([.4,2.4,1.6],[3.35,23.7,-3.35],"a",{mirror:true}),g([.25,.25,3],[4.35,24.9,-1.9],"b",{mirror:true})]),Le("clownnose","Clown nose",{a:"#e0302a",b:"#ffffff"},"a",[g([1.4,1.3,1.2],[0,24.9,-4.55],"a"),g([.4,.4,.2],[-0.3,25.25,-5.2],"b")]),Le("mustache","Mustache",{a:"#3b2a20"},"a",[g([3.4,.7,.5],[0,24.45,-4.25],"a"),g([.9,.9,.5],[1.95,24.3,-4.25],"a",{mirror:true})]),Le("beard","Beard",{a:"#3b2a20"},"a",[g([6.4,1.4,1.4],[0,22.2,-3.5],"a"),g([1.3,3.4,5.2],[3.75,23.6,-1.4],"a",{mirror:true}),g([2.4,.8,.5],[0,23.05,-4.25],"a"),g([3.6,.7,.5],[0,24.45,-4.25],"a")],120),Le("aviators","Aviators",{a:"#d8b030",g:"#c8843a"},"g",[g([2.6,1.6,.2],[1.6,26,G],"g",{mirror:true,mat:"glass"}),g([2,.8,.2],[1.6,24.85,G],"g",{mirror:true,mat:"glass"}),g([6.8,.25,.3],[0,26.85,G],"a",{mat:"metal"}),g([1,.25,.3],[0,26.35,G],"a",{mat:"metal"}),g([.25,2,.3],[2.95,25.8,G],"a",{mirror:true,mat:"metal"}),...Xt(26.7,"a","metal")],150),Le("square","Square glasses",{a:"#1d1d21",g:"#e0f0ff"},"a",[g([2.8,.45,.4],[1.6,27,G],"a",{mirror:true}),g([2.8,.45,.4],[1.6,24.6,G],"a",{mirror:true}),g([.45,2.4,.4],[3,25.8,G],"a",{mirror:true}),g([.45,2.4,.4],[.2,25.8,G],"a",{mirror:true}),g([2.2,2,.15],[1.6,25.8,G],"g",{mirror:true,mat:"glass"}),...Xt(26.7),g([.6,.3,.3],[0,26.3,G],"a")],100),Le("hearts","Heart glasses",{a:"#e8436b",b:"#ff8fb0"},"a",[g([2.6,1.3,.3],[1.6,26.1,G],"b",{mirror:true,mat:"glass"}),g([1.7,.8,.3],[1.6,25.1,G],"b",{mirror:true,mat:"glass"}),g([.8,.6,.3],[1.6,24.5,G],"b",{mirror:true,mat:"glass"}),g([1.1,.7,.32],[1,26.9,G],"a",{mirror:true}),g([1.1,.7,.32],[2.2,26.9,G],"a",{mirror:true}),g([.8,.3,.3],[0,26.3,G],"a"),...Xt(26.6)],120),Le("stars","Star glasses",{a:"#d8b030",b:"#ffe27a"},"a",[g([2.8,.9,.3],[1.6,26,G],"b",{mirror:true,mat:"glass"}),g([1.2,2.6,.3],[1.6,25.8,G],"b",{mirror:true,mat:"glass"}),g([.6,.7,.32],[1.6,27.3,G],"a",{mirror:true}),g([.8,.3,.3],[0,26.3,G],"a"),...Xt(26.6)],120),Le("goggles","Ski goggles",{a:"#2f5fd0",g:"#ff9a3c"},"a",[g([7.6,2.4,.4],[0,25.9,-4.8],"g",{mat:"glass"}),g([8.2,.5,.6],[0,27.35,-4.6],"a"),g([8.2,.5,.6],[0,24.45,-4.6],"a"),g([.5,1.4,8.6],[4.5,25.9,0],"a",{mirror:true}),g([9.4,1.4,.5],[0,25.9,4.5],"a")],150),Le("monocle","Monocle",{a:"#d8b030",g:"#e0f0ff"},null,[g([2.4,.25,.25],[-1.6,27,G],"a",{mat:"metal"}),g([2.4,.25,.25],[-1.6,24.6,G],"a",{mat:"metal"}),g([.25,2.4,.25],[-2.8,25.8,G],"a",{mat:"metal"}),g([.25,2.4,.25],[-0.4,25.8,G],"a",{mat:"metal"}),g([2.2,2.2,.12],[-1.6,25.8,G],"g",{mat:"glass"}),g([.2,3.2,.2],[-2.9,22.9,-4.7],"a",{mat:"metal"})],150),Le("3d","3D glasses",{a:"#f4f1ea",r:"#e0302a",c:"#2f8fe0"},null,[g([6.9,.5,.35],[0,27,G],"a"),g([6.9,.5,.35],[0,24.6,G],"a"),g([.5,2.9,.35],[3.2,25.8,G],"a",{mirror:true}),g([.8,2.9,.35],[0,25.8,G],"a"),g([2.3,1.9,.15],[1.6,25.8,G],"r",{mat:"glass"}),g([2.3,1.9,.15],[-1.6,25.8,G],"c",{mat:"glass"}),...Xt(26.6)],100),Le("eyepatch","Eye patch",{a:"#1d1d21"},null,[g([2.6,2.4,.4],[1.6,25.9,-4.3],"a"),g([5,.4,.3],[-1,27.3,-4.3],"a"),g([.3,.5,8.6],[4.4,27.3,0],"a",{mirror:true}),g([8.9,.5,.3],[0,27.3,4.4],"a")],100)];var Ta=(e,t)=>(r,o,a,n,s,l)=>Me({id:`${t}.${r}`,slot:e,name:o,palette:a,tint:n,textures:s.textures??{},paint:s.paint??[],parts:s.parts??[]},l),Tt=Ta("shoes","shoes"),Lo=Ta("hands","hands"),Co=Ta("waist","waist"),Sa=(e="a")=>L([9.45,1.25,4.97],[0,13.15,0],e),As=[Tt("bunny","Bunny slippers",{a:"#f4f1ea",b:"#f08cb4"},"b",{paint:[{region:"feet",color:"a"}],parts:[W("shinR",[.6,1.6,.4],[1.3,2.2,-2.4],"a"),W("shinR",[.6,1.6,.4],[2.9,2.2,-2.4],"a"),W("shinR",[.9,.7,.5],[2.1,1.1,-3.3],"b")]}),Tt("rainboots","Rain boots",{a:"#f2c14e",b:"#2b2140"},"a",{paint:[{region:"feet",color:"a",faces:{bottom:"b"}}],parts:[W("shinR",[4.6,5,4.6],[2.1,3.5,0],"a")]}),Tt("runners","Running shoes",{a:"#2ab0c0",b:"#f4f1ea",c:"#e8436b"},"a",{textures:{sd:Z(["aaaaa","acaca","bbbbb"])},paint:[{region:"feet",color:"a",faces:{left:"sd",right:"sd",bottom:"b"}}],parts:[W("shinR",[4.4,.5,5.5],[2.1,.25,-0.5],"b")]}),Tt("rollers","Roller skates",{a:"#e8436b",b:"#f4f1ea",c:"#2b2140"},"a",{paint:[{region:"feet",color:"a"}],parts:[W("shinR",[4.5,3,4.6],[2.1,2.6,0],"a"),W("shinR",[3.4,.4,5],[2.1,.2,-0.5],"b"),W("shinR",[3.6,.9,.9],[2.1,-0.05,-2.4],"c"),W("shinR",[3.6,.9,.9],[2.1,-0.05,1.4],"c")]},150),Tt("iceskates","Ice skates",{a:"#f4f1ea",b:"#c8ccd2"},"a",{paint:[{region:"feet",color:"a"}],parts:[W("shinR",[4.5,3.2,4.6],[2.1,2.7,0],"a"),W("shinR",[.35,.6,5.8],[2.1,-0.2,-0.5],"b",{mat:"metal"})]},150),Tt("cowboy","Cowboy boots",{a:"#7a4f2a",b:"#4a2e1a"},"a",{paint:[{region:"feet",color:"a"}],parts:[W("shinR",[4.7,4.6,4.7],[2.1,3.6,0],"a"),W("shinR",[3,.6,1.4],[2.1,.3,1.6],"b")]},120),Tt("space","Space boots",{a:"#f4f1ea",b:"#9aa4ae"},null,{paint:[{region:"feet",color:"a"}],parts:[W("shinR",[5,4.6,5],[2.1,3.3,0],"a"),W("shinR",[4.6,.6,5.8],[2.1,.3,-0.5],"b")]},150),Tt("platform","Platform sneakers",{a:"#1d1d21",w:"#f4f1ea"},"a",{textures:{toe:Z(["aaaa","wwww"]),side:Z(["aaaaa","wwwww"])},paint:[{region:"feet",color:"a",faces:{front:"toe",back:"toe",left:"side",right:"side",bottom:"w"}}],parts:[W("shinR",[4.5,1.2,5.6],[2.1,.6,-0.5],"w")]},100)],Es=[Lo("mittens","Mittens",{a:"#c0392b",b:"#f4f1ea"},"a",{paint:[{region:"hands",color:"a"}],parts:[W("foreArmR",[3.7,.9,3.7],[6.3,14.3,0],"b")]}),Lo("fingerless","Fingerless gloves",{a:"#2b2140",s:"@skin"},"a",{textures:{fl:Z(["sss","aaa","aaa"])},paint:[{region:"hands",color:"a",faces:{front:"fl",back:"fl",left:"fl",right:"fl",bottom:"s"}}]}),Lo("wristbands","Wristbands",{a:"#e8436b"},"a",{parts:[W("foreArmR",[3.8,1.2,3.8],[6.3,14.7,0],"a")]}),Lo("boxing","Boxing gloves",{a:"#c0392b",b:"#f4f1ea"},"a",{paint:[{region:"hands",color:"a"}],parts:[W("foreArmR",[4.2,3.6,4.2],[6.3,12.5,-0.2],"a"),W("foreArmR",[3.8,1,3.8],[6.3,14.6,0],"b")]},100)],Ss=[Co("fannypack","Fanny pack",{a:"#2b2140",b:"#534ab7",m:"#c8ccd2"},"b",{parts:[L([9.45,.8,4.97],[0,13.6,0],"a"),L([4,2,1.6],[0,13.6,-3.1],"b"),L([3.2,.2,.15],[0,14.3,-3.92],"m",{mat:"metal"})]}),Co("tools","Tool belt",{a:"#5a3a22",b:"#8a5a32",m:"#9aa4ae",h:"#c0612b"},"a",{parts:[Sa(),L([2.2,2.2,1.3],[3.2,12,-2.8],"b",{mirror:true}),L([.5,2.6,.5],[-1.4,11.8,-3.1],"h"),L([1.6,.7,.7],[-1.4,13.2,-3.1],"m",{mat:"metal"})]},80),Co("sheath","Sword sheath",{a:"#3a2a22",b:"#5a3a22",m:"#c8ccd2"},"a",{parts:[Sa(),L([.9,4.8,1.2],[4.9,12.1,0],"b"),L([1.6,.4,.8],[4.9,14.7,0],"m",{mat:"metal"}),L([.6,1.4,.6],[4.9,15.6,0],"a")]},120),Co("pouches","Double pouches",{a:"#3a2a22",b:"#6b6b4a"},"b",{parts:[Sa("a"),L([2.4,2.4,1.3],[2.6,11.8,-2.9],"b",{mirror:true})]},60)];var Xe=g([9.21,2.05,8.73],[0,29.91,0],"a"),Mt=g([9.21,1.7,.73],[0,28.72,-4.36],"a"),Ur=g([.71,1.7,2.8],[4.5,28.72,-2.9],"a",{mirror:true}),Lt=(e,t)=>g([.71,e,7.58],[4.6,t,.51],"a",{mirror:true}),Ct=(e,t)=>g([9.21,e,.73],[0,t,4.36],"a"),ke=(e,t,r,o,a={a:"#3b2a20"})=>Me({id:`hair.${e}`,slot:"hair",name:t,palette:a,tint:"a",parts:r},o),Ts=[ke("afro","Afro",[g([11.4,4.4,10.2],[0,31.3,.6],"a"),g([10.6,2.2,8.2],[0,27.2,1.5],"a"),g([1.2,4.2,7.4],[5,26.4,1.2],"a",{mirror:true}),g([9.6,4.4,1.3],[0,26.2,4.9],"a"),g([8.6,1.9,.8],[0,28.95,-4.5],"a")]),ke("buzz","Buzz cut",[g([8.9,.6,8.4],[0,30.45,0],"a"),g([.4,2.6,7.6],[4.42,28.9,.2],"a",{mirror:true}),g([8.9,3.6,.4],[0,28.4,4.2],"a"),g([8.9,.8,.4],[0,29.75,-4.2],"a")]),ke("sidepart","Side part",[Xe,g([5.5,2.4,.9],[-1.85,28.6,-4.4],"a"),g([3.7,1.3,.73],[2.75,29.1,-4.36],"a"),Lt(3.41,27.86),Ct(4.77,27.18),g([3.2,1,3.4],[-1.6,31.3,-1.4],"a")]),ke("pigtails","Pigtails",[Xe,Mt,Ur,Lt(3.41,27.86),Ct(4.77,27.18),g([1.9,4.6,1.9],[4.9,26,1.6],"a",{mirror:true}),g([2.1,.8,2.1],[4.9,28.4,1.6],"b",{mirror:true})],void 0,{a:"#3b2a20",b:"#d4537e"}),ke("braids","Braids",[Xe,Mt,Lt(3.41,27.86),Ct(4.77,27.18),g([1.6,5.6,1.6],[3.4,25,3.9],"a",{mirror:true}),g([1.9,.6,1.9],[3.4,22.5,3.9],"b",{mirror:true})],void 0,{a:"#3b2a20",b:"#f2c14e"}),ke("bowl","Bowl cut",[g([9.9,3.2,9.4],[0,29,0],"a"),g([9.4,1,8.9],[0,30.9,0],"a"),g([9.6,3.6,.9],[0,27,4.5],"a")]),ke("dreads","Dreadlocks",[Xe,Mt,g([1.3,5,1.3],[4.75,25.6,-1.6],"a",{mirror:true}),g([1.3,5.6,1.3],[4.75,25.3,1.7],"a",{mirror:true}),g([1.3,6,1.3],[2.4,25,4.75],"a",{mirror:true}),g([1.3,6.2,1.3],[0,25.2,4.8],"a"),Ct(3.2,28.3)],120),ke("longwavy","Long waves",[Xe,Mt,Ur,g([1.06,6.82,7.88],[4.78,26.16,.66],"a",{mirror:true}),g([9.21,7.5,1.09],[0,26.16,4.55],"a"),g([1.3,2,8],[5.1,23.4,.9],"a",{mirror:true}),g([9.8,2,1.4],[0,23.2,4.85],"a")],120),ke("topknot","Top knot",[Xe,Mt,Ur,Lt(2.73,28.2),Ct(4.09,27.52),g([3.2,2.8,3.2],[0,32.3,0],"a"),g([3.5,.6,3.5],[0,31.1,0],"b")],100,{a:"#3b2a20",b:"#1d1d21"}),ke("spacebuns","Space buns",[Xe,Mt,Ur,Lt(3.41,27.86),Ct(4.77,27.18),g([3,3,3],[3,31.8,.5],"a",{mirror:true})],120),ke("emo","Swept fringe",[Xe,g([6.5,3.8,.9],[-1.3,27.6,-4.45],"a"),g([2.7,1.3,.73],[3.25,29.1,-4.36],"a"),Lt(4.5,27.3),Ct(5.4,26.9)],100),ke("quiff","Quiff",[Xe,g([8,2.4,3.2],[0,31.4,-2.6],"a"),g([8.6,1.2,1.2],[0,30.6,-4.4],"a"),Lt(2.73,28.2),Ct(4.09,27.52)],100),ke("mullet","Mullet",[Xe,Mt,Ur,Lt(2.73,28.2),g([9.21,7,1.09],[0,25.8,4.55],"a"),g([8,2,1.6],[0,23.2,4.9],"a")],80),ke("wavybob","Wavy bob",[Xe,Mt,g([1.06,6.13,8.6],[4.78,26.84,.3],"a",{mirror:true}),g([9.21,6.14,1.09],[0,26.5,4.55],"a"),g([1.5,1.2,8.8],[5.1,24.1,.3],"a",{mirror:true}),g([9.6,1.2,1.5],[0,24.1,4.8],"a")],100),ke("curls","Shoulder curls",[g([9.92,2.39,9.45],[0,30.08,0],"a"),g([9.21,1.36,.73],[0,28.89,-4.8],"a"),g([2.83,2.73,2.91],[3.54,28.89,-2.55],"a",{mirror:true}),g([2.83,2.73,2.91],[3.54,28.89,1.82],"a",{mirror:true}),g([5.67,2.05,5.82],[0,31.61,0],"a"),g([4.25,4.27,2.18],[2.13,27.27,4],"a",{mirror:true}),g([2.6,4,2.6],[4.4,24.4,2.4],"a",{mirror:true})],150),ke("undercut","Undercut",[g([9.21,2.6,8.73],[0,30.2,0],"a"),g([9.21,1.7,2],[0,29.9,-4.3],"a"),g([.4,2.6,7.6],[4.42,28.2,.2],"b",{mirror:true}),g([8.9,3.4,.4],[0,27.6,4.2],"b")],120,{a:"#3b2a20",b:"#2a1d16"})];var ye=(e,t,r,o,a,n)=>Me({id:`hat.${e}`,slot:"hat",name:t,palette:r,tint:o,parts:a},n),Ma=g([9.4,.7,1.2],[0,30.6,0],"c"),Ms=[ye("tophat","Top hat",{a:"#1d1d21",b:"#a32d2d"},"a",[g([11.4,.55,11],[0,30.6,0],"a"),g([8.6,6,8.2],[0,33.9,0],"a"),g([8.8,.9,8.4],[0,31.4,0],"b")],150),ye("cowboy","Cowboy hat",{a:"#9a6a3a",b:"#4a2e1a"},"a",[g([13,.6,12],[0,30.4,0],"a"),g([.8,1.2,11],[6.1,31,0],"a",{mirror:true}),g([8.4,3.5,8],[0,32.4,0],"a"),g([8.6,.7,8.2],[0,31.1,0],"b")],150),ye("tricorn","Tricorn",{a:"#2c2420",b:"#d8b030"},"a",[g([10.4,2.4,10],[0,31.2,0],"a"),g([.8,2.6,8],[5.2,31.6,0],"a",{mirror:true}),g([9,2.6,.8],[0,31.6,4.8],"a"),g([3,2.2,.8],[0,31.4,-5],"a"),g([8,.4,.6],[0,30.2,-5.2],"b",{mat:"metal"})],180),ye("chef","Chef hat",{a:"#f6f4ee",b:"#e2ded2"},null,[g([9.8,2,9.4],[0,30.7,0],"b"),g([10.6,4.5,10.2],[0,33.9,0],"a")],100),ye("beret","Beret",{a:"#a32d2d"},"a",[g([10,1.6,9.6],[-0.4,31,0],"a"),g([.8,.8,.8],[0,32,0],"a")]),ye("hardhat","Hard hat",{a:"#f2c14e",b:"#d8a030"},"a",[g([9.8,3,9.4],[0,31.3,0],"a"),g([9.8,.5,2.5],[0,30,-5.5],"a"),g([1,.8,9.6],[0,33,0],"b")],80),ye("viking","Viking helmet",{a:"#9aa4ae",b:"#6a5a3a",c:"#f0e6d0"},"a",[g([9.8,3.2,9.4],[0,31.2,0],"a",{mat:"metal"}),g([10.2,1,9.8],[0,29.9,0],"b"),g([1.4,1.4,1.4],[5.5,31.6,0],"c",{mirror:true}),g([1.1,2.4,1.1],[6.2,33.2,0],"c",{mirror:true}),g([.8,2.2,.5],[0,28.6,-5.05],"a",{mat:"metal"})],200),ye("space","Space helmet",{a:"#bfe6ff",b:"#d8dde4",c:"#ff5a3c"},null,[g([11,10.4,10.8],[0,27,0],"a",{mat:"glass"}),g([10,1,9.6],[0,22.3,0],"b",{mat:"metal"}),g([1.2,1.2,.6],[0,32.4,-1.6],"c",{mat:"glow"})],250),ye("catears","Cat ears",{a:"#2b2140",b:"#f08cb4",c:"#2b2140"},"a",[Ma,g([2,2.2,1],[2.9,32,0],"a",{mirror:true}),g([1.1,1.3,.4],[2.9,31.8,-0.65],"b",{mirror:true})]),ye("bunnyears","Bunny ears",{a:"#f4f1ea",b:"#f08cb4",c:"#f4f1ea"},"a",[Ma,g([1.5,5.4,.9],[1.9,33.6,0],"a",{mirror:true}),g([.8,4.2,.3],[1.9,33.4,-0.55],"b",{mirror:true})],80),ye("foxears","Fox ears",{a:"#e8862a",b:"#2a1c14",c:"#2a1c14"},"a",[Ma,g([2.4,2.8,1],[2.8,32.2,0],"a",{mirror:true}),g([2.4,.9,1.05],[2.8,33.55,0],"b",{mirror:true})],80),ye("halo","Halo",{a:"#ffe27a"},"a",[g([6,.5,1],[0,33.4,-2.5],"a",{mat:"glow"}),g([6,.5,1],[0,33.4,2.5],"a",{mat:"glow"}),g([1,.5,4],[2.5,33.4,0],"a",{mat:"glow",mirror:true})],250),ye("horns","Little horns",{a:"#c0392b",b:"#7a1d1d"},"a",[g([1.4,1.8,1.4],[2.6,31.1,-0.6],"a",{mirror:true}),g([.9,1.2,.9],[2.9,32.5,-0.6],"b",{mirror:true})],120),ye("party","Party hat",{a:"#7f77dd",b:"#f2c14e"},"a",[g([6,1.6,6],[0,31.1,0],"a"),g([4.4,1.8,4.4],[0,32.8,0],"b"),g([2.8,1.8,2.8],[0,34.6,0],"a"),g([1.4,1.6,1.4],[0,36.3,0],"b"),g([1.6,1.2,1.6],[0,37.3,0],"a")]),ye("flowers","Flower wreath",{a:"#4c9a4a",b:"#f08cb4",c:"#f2d33c",d:"#f4f1ea"},null,[g([9.6,.9,9.2],[0,30.4,0],"a"),g([1.4,1.2,1.4],[3,30.9,-4.4],"b",{mirror:true}),g([1.4,1.2,1.4],[0,31,-4.6],"c"),g([1.4,1.2,1.4],[4.7,30.9,.5],"d",{mirror:true}),g([1.4,1.2,1.4],[2.6,30.9,4.5],"c",{mirror:true})],120),ye("bandana","Bandana",{a:"#c0392b"},"a",[g([9.6,2.4,9.2],[0,30.1,0],"a"),g([2,1.6,1.6],[0,29.4,5],"a"),g([1,2.6,.6],[.7,27.6,5.2],"a",{mirror:true})]),ye("ninja","Ninja headband",{a:"#2b2140",b:"#c8ccd2"},"a",[g([9.4,1.3,9],[0,28.8,0],"a"),g([3,1.1,.4],[0,28.8,-4.7],"b",{mat:"metal"}),g([.9,3,.5],[.7,27,4.9],"a",{mirror:true})],100),ye("propeller","Propeller cap",{a:"#2f5fd0",b:"#f2d33c",c:"#c0392b"},"a",[g([9.63,2.73,9.16],[0,30.8,.15],"a"),g([7.79,.55,3.64],[0,29.57,-5.96],"a"),g([.6,1.2,.6],[0,32.7,0],"b"),g([7,.3,1.2],[0,33.4,0],"c"),g([1.2,.3,7],[0,33.4,0],"b")],150)];var Po=e=>({front:e,back:e,left:e,right:e}),ge=(e,t,r,o,a,n)=>Me({id:`top.${e}`,slot:"top",name:t,palette:r,tint:o,textures:a.textures??{},paint:a.paint,parts:a.parts??[]},n),hc=Z(["abaabaab","bbbbbbbb","abaabaab","abaabaab","bbbbbbbb","abaabaab","abaabaab","abaabaab"]),Ls=[ge("flannel","Flannel shirt",{a:"#c0392b",b:"#2b2140"},"a",{textures:{pl:hc},paint:[{region:"torso",color:"a",faces:Po("pl")},{region:"arms",color:"a",faces:Po("pl")}],parts:[L([5.6,.8,.5],[0,22.2,-2.4],"b")]}),ge("polo","Polo shirt",{a:"#1d9e75",w:"#f4f1ea"},"a",{textures:{pk:Z(["aaawaaaa","aaawaaaa","aaawaaaa","aaaaaaaa","aaaaaaaa","aaaaaaaa","aaaaaaaa","aaaaaaaa"])},paint:[{region:"torso",color:"a",faces:{front:"pk"}},{region:"sleeves",color:"a"}],parts:[L([4.6,.9,.6],[0,22.4,-2.3],"a")]}),ge("heart","Heart sweater",{a:"#d4537e",b:"#f4f1ea"},"a",{textures:{h:Z(["aaaaaaaa","aabaabaa","abbbbbba","abbbbbba","aabbbbaa","aaabbaaa","aaaaaaaa","aaaaaaaa"])},paint:[{region:"torso",color:"a",faces:{front:"h"}},{region:"arms",color:"a"}]}),ge("gamer","Gamepad tee",{a:"#2b2140",b:"#9aa4ae",c:"#33e0ff",d:"#e8436b"},"a",{textures:{g:Z(["aaaaaaaa","aaaaaaaa","abbbbbba","bcbbbdbb","bbbbbbbb","abbaabba","aaaaaaaa","aaaaaaaa"])},paint:[{region:"torso",color:"a",faces:{front:"g"}},{region:"sleeves",color:"a"}]}),ge("jersey","Sports jersey",{a:"#2f5fd0",w:"#f4f1ea"},"a",{textures:{n:Z(["aaaaaaaa","aawwwwaa","aaaaawaa","aaaawaaa","aaawaaaa","aaawaaaa","aaaaaaaa","aaaaaaaa"]),sl:Z(["aaa","www","aaa"])},paint:[{region:"torso",color:"a",faces:{front:"n",back:"n"}},{region:"sleeves",color:"a",faces:Po("sl")}]}),ge("dress","Dress",{a:"#7f77dd",b:"#f4f1ea"},"a",{paint:[{region:"torso",color:"a"},{region:"sleeves",color:"a"}],parts:[L([10.2,5,5.6],[0,12.1,0],"a"),L([9,.8,4.6],[0,14.9,0],"b")]}),ge("bomber","Varsity jacket",{a:"#a32d2d",b:"#f4f1ea",c:"#2b2140"},"a",{textures:{fr:Z(["aaabbaaa","aaabbaaa","abaabaaa","abaabaaa","aaabbaaa","aaabbaaa","aaabbaaa","aaabbaaa"]),cf:Z(["bbb","bbb","bbb","bbb","ccc"])},paint:[{region:"torso",color:"a",faces:{front:"fr"}},{region:"arms",color:"b",faces:Po("cf")}],parts:[L([8.8,.9,4.6],[0,12.9,0],"c")]},120),ge("puffer","Puffer jacket",{a:"#ef9f27",b:"#c87f17"},"a",{paint:[{region:"torso",color:"a"},{region:"arms",color:"a"}],parts:[L([9.6,3.2,5.2],[0,20.6,0],"a"),L([9.4,3,5],[0,17.4,0],"b"),L([9,3,4.8],[0,14.3,0],"a"),W("armR",[4,2.2,4],[6.3,20.4,0],"a")]},150),ge("overalls","Overalls",{a:"#2f5fd0",b:"#f4f1ea",g:"#d8b030"},"a",{paint:[{region:"torso",color:"b"},{region:"sleeves",color:"b"}],parts:[L([6,5,.5],[0,17.8,-2.4],"a"),L([1.2,4,.5],[2.4,20.6,-2.4],"a",{mirror:true}),L([.6,.6,.3],[2.4,21.7,-2.75],"g",{mirror:true,mat:"metal"}),L([1.2,9,.5],[2.4,17.5,2.4],"a",{mirror:true}),L([8.8,4.4,4.6],[0,14.8,0],"a")]},100),ge("labcoat","Lab coat",{a:"#f4f1ea",b:"#9ad0f0"},null,{paint:[{region:"torso",color:"a"},{region:"arms",color:"a"}],parts:[L([9,4.5,4.8],[0,11.8,0],"a"),L([1.6,4,.4],[1.6,19.8,-2.45],"a",{mirror:true}),L([1.6,1.4,.3],[-2.6,17,-2.4],"b")]},120),ge("ninja","Ninja suit",{a:"#2b2140",r:"#c0392b",g:"#3c3450"},"a",{textures:{wr:Z(["agaaaaaa","aagaaaaa","aaagaaaa","aaaagaaa","aaaaagaa","aaaaaaga","aaaaaaaa","aaaaaaaa"])},paint:[{region:"torso",color:"a",faces:{front:"wr"}},{region:"arms",color:"a"}],parts:[L([9.2,1,4.8],[0,14.3,0],"r")]},150),ge("space","Space suit",{a:"#f4f1ea",b:"#9aa4ae",c:"#33e0ff",d:"#e8436b"},null,{paint:[{region:"torso",color:"a"},{region:"arms",color:"a"}],parts:[L([5,3.6,.6],[0,19,-2.5],"b"),L([.6,.6,.3],[-1.2,19.6,-2.9],"c",{mat:"glow"}),L([.6,.6,.3],[1.2,19.6,-2.9],"d",{mat:"glow"}),W("armR",[4.2,1,4.2],[6.3,22.4,0],"b"),L([7,.8,5],[0,22.6,0],"b",{mat:"metal"})]},250),ge("pirate","Pirate shirt",{a:"#f4f1ea",b:"#5a3a22",r:"#a32d2d"},null,{textures:{v:Z(["aabbbbaa","aaabbaaa","aabaabaa","aaabbaaa","aaaaaaaa","aaaaaaaa","aaaaaaaa","aaaaaaaa"])},paint:[{region:"torso",color:"a",faces:{front:"v"}},{region:"arms",color:"a"}],parts:[W("foreArmR",[4.2,3,4.2],[6.3,15.6,0],"a"),L([9.2,1.4,4.8],[0,13.6,0],"r")]},120),ge("raincoat","Raincoat",{a:"#f2c14e",b:"#d8a030"},"a",{textures:{bt:Z(["aaaaaaaa","aaabaaaa","aaaaaaaa","aaabaaaa","aaaaaaaa","aaabaaaa","aaaaaaaa","aaaaaaaa"])},paint:[{region:"torso",color:"a",faces:{front:"bt"}},{region:"arms",color:"a"}],parts:[L([7,3.6,2],[0,21.5,2.9],"a"),L([9,4,4.8],[0,12,0],"a")]},100),ge("vest","Vest and shirt",{a:"#5a3a22",b:"#f4f1ea"},"a",{paint:[{region:"torso",color:"b"},{region:"arms",color:"b"}],parts:[L([4.2,7,.5],[2.2,17.5,-2.4],"a",{mirror:true}),L([9,9,.5],[0,17.4,2.4],"a")]},80),ge("chef","Chef jacket",{a:"#f6f4ee",b:"#2b2140"},null,{textures:{db:Z(["aaaaaaaa","aabaabaa","aaaaaaaa","aabaabaa","aaaaaaaa","aabaabaa","aaaaaaaa","aaaaaaaa"])},paint:[{region:"torso",color:"a",faces:{front:"db"}},{region:"arms",color:"a"}],parts:[L([5,.8,.5],[0,22.3,-2.4],"a")]},80),ge("tuxedo","Tuxedo",{a:"#1d1d21",w:"#f4f1ea"},null,{textures:{tx:Z(["aawwwwaa","aaawwaaa","aaawwaaa","aaawwaaa","aaaaaaaa","aaaaaaaa","aaaaaaaa","aaaaaaaa"])},paint:[{region:"torso",color:"a",faces:{front:"tx"}},{region:"arms",color:"a"}],parts:[L([2,1,.4],[0,21.7,-2.6],"a"),L([8.6,4,.6],[0,11.6,2.4],"a")]},200),ge("leather","Leather jacket",{a:"#2a2420",b:"#c8ccd2"},"a",{paint:[{region:"torso",color:"a"},{region:"arms",color:"a"}],parts:[L([2.6,1.6,.6],[2.5,22.1,-2.25],"a",{mirror:true}),L([.4,8,.3],[-0.8,16.8,-2.45],"b",{mat:"metal"})]},180)];var Kr=[...Ts,...Ls,...ks,...As,...Es,...Ss,...ws,...Rs,...vs,...Ms];function Ge(e){let t=mr(e);if(!t.ok)throw new Error(`avatar shop: ${String(e.id)}: ${t.errors.join("; ")}`);return t.item}var La=e=>({w:e[0].length,h:e.length,rows:e}),dc={bone:"head",size:[9.21,2.05,8.73],pos:[0,29.91,0],color:"a"},uc={bone:"head",size:[9.21,1.7,.73],pos:[0,28.72,-4.36],color:"a"},Cs=[{price:250,item:Ge({id:"hat.crown",slot:"hat",name:"Crown",palette:{a:"#e8b730",g:"#d23c4a"},tint:"a",parts:[{bone:"head",size:[9.21,1.7,.73],pos:[0,30.93,-4.36],color:"a"},{bone:"head",size:[9.21,1.7,.73],pos:[0,30.93,4.36],color:"a"},{bone:"head",size:[.71,1.7,8.73],pos:[4.6,30.93,0],color:"a",mirror:true},{bone:"head",size:[1.13,1.36,.73],pos:[2.98,32.47,-4.36],color:"a",mirror:true},{bone:"head",size:[1.13,1.77,.73],pos:[0,32.67,-4.36],color:"a"},{bone:"head",size:[.99,.95,.29],pos:[0,30.93,-4.87],color:"g"}]})},{price:250,item:Ge({id:"back.wings",slot:"back",name:"Angel wings",palette:{a:"#f7f5ff",b:"#d9d4f2"},tint:"a",parts:[{bone:"body",size:[2.25,7.5,1.47],pos:[1.69,21.15,3.04],color:"b",mirror:true},{bone:"body",size:[10.13,3.13,.74],pos:[7.31,26.15,3.86],color:"a",mirror:true},{bone:"body",size:[10.13,3.13,.74],pos:[7.88,23.03,4.05],color:"b",mirror:true},{bone:"body",size:[9,3.13,.74],pos:[8.44,19.9,4.23],color:"a",mirror:true},{bone:"body",size:[6.75,3.13,.74],pos:[9,16.77,4.42],color:"b",mirror:true},{bone:"body",size:[4.5,3.13,.74],pos:[9.56,13.65,4.6],color:"a",mirror:true},{bone:"body",size:[3.38,1.88,.74],pos:[11.25,28.65,3.86],color:"a",mirror:true}]})},{price:200,item:Ge({id:"hat.wizard",slot:"hat",name:"Wizard hat",palette:{a:"#3c2f8f",s:"#f2c14e"},tint:"a",parts:[{bone:"head",size:[10.63,.55,10.18],pos:[0,30.39,0],color:"a"},{bone:"head",size:[8.5,1.77,8],pos:[0,31.55,0],color:"a"},{bone:"head",size:[6.38,1.77,5.82],pos:[0,33.32,.36],color:"a"},{bone:"head",size:[4.25,1.77,4],pos:[0,35.09,.73],color:"a"},{bone:"head",size:[2.13,1.64,2.18],pos:[0,36.8,1.09],color:"a"},{bone:"head",size:[1.13,1.09,.29],pos:[0,31.61,-4.15],color:"s"}]})},{price:200,item:Ge({id:"top.armor",slot:"top",name:"Knight armor",palette:{a:"#b8c2cc",b:"#5b6672",g:"#e8b730"},tint:"a",paint:[{region:"torso",color:"b"},{region:"arms",color:"b"}],parts:[{bone:"body",size:[9.67,7.5,.74],pos:[0,18.65,-2.67],color:"a"},{bone:"armR",size:[4.32,2.94,4.32],pos:[6.3,22.38,0],color:"a",mirror:true},{bone:"body",size:[2.25,2.5,.37],pos:[0,19.27,-3.22],color:"g"}]})},{price:200,item:Ge({id:"back.sword",slot:"back",name:"Sword",palette:{a:"#d8dde4",g:"#e8b730",h:"#5a3a22"},tint:"g",parts:[{bone:"body",size:[1.35,12.5,.55],pos:[2.81,17.4,3.04],color:"a"},{bone:"body",size:[4.5,1.13,.92],pos:[2.81,24.21,3.04],color:"g"},{bone:"body",size:[1.01,3.75,.83],pos:[2.81,26.65,3.04],color:"h"},{bone:"body",size:[1.58,1.5,1.1],pos:[2.81,29.28,3.04],color:"g"}]})},{price:150,item:Ge({id:"hat.headphones",slot:"hat",name:"Headphones",palette:{a:"#2b2140",b:"#4be0c8"},tint:"b",parts:[{bone:"head",size:[9.63,.82,1.45],pos:[0,31.07,0],color:"a"},{bone:"head",size:[.57,3.41,.87],pos:[4.89,29.57,0],color:"a",mirror:true},{bone:"head",size:[1.13,2.45,2.62],pos:[4.96,27.39,0],color:"a",mirror:true},{bone:"head",size:[.28,1.64,1.75],pos:[5.6,27.39,0],color:"b",mirror:true}]})},{price:150,item:Ge({id:"hair.mohawk",slot:"hair",name:"Mohawk",palette:{a:"#d4537e"},tint:"a",parts:[{bone:"head",size:[1.84,3.07,8],pos:[0,31.78,0],color:"a"},{bone:"head",size:[1.84,2.05,1.45],pos:[0,31.27,-4.73],color:"a"},{bone:"head",size:[2.13,4.09,.73],pos:[0,28.2,4.36],color:"a"}]})},{price:150,item:Ge({id:"top.suit",slot:"top",name:"Suit and tie",palette:{a:"#2c2f3a",w:"#f4f1ea",r:"#c0392b"},tint:"a",textures:{front:La(["awwrrwwa","aawrrwaa","aaarraaa","aaarraaa","aaarraaa","aaaaaaaa","aaaaaaaa","aaaaaaaa"])},paint:[{region:"torso",color:"a",faces:{front:"front"}},{region:"arms",color:"a"}],parts:[{bone:"body",size:[1.35,1,.28],pos:[-2.92,19.9,-2.44],color:"w"}]})},{price:120,item:Ge({id:"hair.ponytail",slot:"hair",name:"Ponytail",palette:{a:"#3b2a20",b:"#d4537e"},tint:"a",parts:[dc,uc,{bone:"head",size:[.71,3.41,7.27],pos:[4.6,27.86,.36],color:"a",mirror:true},{bone:"head",size:[9.21,4.77,.73],pos:[0,27.18,4.36],color:"a"},{bone:"head",size:[2.27,1.02,1.75],pos:[0,28.55,4.95],color:"b"},{bone:"head",size:[1.84,5.45,1.45],pos:[0,25.82,5.09],color:"a"}]})},{price:120,item:fr["face.visor"]},{price:100,item:Ge({id:"shoes.hightops",slot:"shoes",name:"High-tops",palette:{a:"#7f77dd",w:"#f4f1ea",b:"#2b2140"},tint:"a",textures:{toe:La(["aaaa","wwww"]),side:La(["aaaaa","wwwww"])},paint:[{region:"feet",color:"a",faces:{front:"toe",back:"toe",left:"side",right:"side",bottom:"w"}}],parts:[{bone:"shinR",size:[4.62,4.32,4.62],pos:[2.1,3.76,0],color:"b",mirror:true}]})},{price:50,item:Ge({id:"hands.gauntlets",slot:"hands",name:"Golden gauntlets",palette:{a:"#e8b730",b:"#b8862a"},tint:"a",paint:[{region:"hands",color:"a"}],parts:[{bone:"foreArmR",size:[4.32,1.75,4.32],pos:[6.3,13.78,0],color:"b",mirror:true}]})},{price:50,item:Ge({id:"waist.pouch",slot:"waist",name:"Belt pouch",palette:{a:"#3a2a22",b:"#7a5233"},tint:"b",parts:[{bone:"body",size:[9.45,1.25,4.97],pos:[0,13.15,0],color:"a"},{bone:"body",size:[2.7,2.5,1.29],pos:[2.93,11.9,-3.04],color:"b"}]})}],Ps=Kr.filter(e=>e.price!==void 0),zs=[...Cs,...Ps].map(e=>e.item),Ca=Object.fromEntries([...Cs,...Ps].map(e=>[e.item.id,e.price])),Is=e=>Object.prototype.hasOwnProperty.call(Ca,e);function Q(e){let t=mr(e);if(!t.ok)throw new Error(`avatar catalog: ${String(e.id)}: ${t.errors.join("; ")}`);return t.item}var br=e=>({w:e[0].length,h:e.length,rows:e}),Yr={bone:"head",size:[9.21,2.05,8.73],pos:[0,29.91,0],color:"a"},Pa={bone:"head",size:[.71,1.7,2.8],pos:[4.5,28.72,-2.9],color:"a",mirror:true},Wr={bone:"head",size:[9.21,1.7,.73],pos:[0,28.72,-4.36],color:"a"},fc=[Q({id:"hair.short",slot:"hair",name:"Short",palette:{a:"#3b2a20"},tint:"a",parts:[Yr,Wr,Pa,{bone:"head",size:[.71,3.41,7.58],pos:[4.6,27.86,.51],color:"a",mirror:true},{bone:"head",size:[9.21,4.77,.73],pos:[0,27.18,4.36],color:"a"}]}),Q({id:"hair.bob",slot:"hair",name:"Bob",palette:{a:"#3b2a20"},tint:"a",parts:[Yr,Wr,{bone:"head",size:[1.06,6.13,8.6],pos:[4.78,26.84,.3],color:"a",mirror:true},{bone:"head",size:[9.21,6.14,1.09],pos:[0,26.5,4.55],color:"a"}]}),Q({id:"hair.spiky",slot:"hair",name:"Spiky",palette:{a:"#3b2a20"},tint:"a",parts:[Yr,Wr,{bone:"head",size:[.71,2.73,8.6],pos:[4.6,28.2,0],color:"a",mirror:true},{bone:"head",size:[9.21,2.73,.73],pos:[0,28.2,4.36],color:"a"},{bone:"head",size:[2.13,2.05,2.18],pos:[2.83,31.61,-0.73],color:"a",mirror:true},{bone:"head",size:[2.13,2.73,2.18],pos:[0,31.95,-0.73],color:"a"},{bone:"head",size:[2.13,2.05,2.18],pos:[-1.42,31.61,2.18],color:"a"},{bone:"head",size:[2.13,2.05,2.18],pos:[1.77,31.75,1.82],color:"a"}]}),Q({id:"hair.long",slot:"hair",name:"Long",palette:{a:"#3b2a20"},tint:"a",parts:[Yr,Wr,Pa,{bone:"head",size:[1.06,6.82,7.88],pos:[4.78,26.16,.66],color:"a",mirror:true},{bone:"head",size:[9.21,7.5,1.09],pos:[0,26.16,4.55],color:"a"}]}),Q({id:"hair.bun",slot:"hair",name:"Bun",palette:{a:"#3b2a20"},tint:"a",parts:[Yr,Wr,Pa,{bone:"head",size:[.71,2.73,6.48],pos:[4.6,28.2,1.06],color:"a",mirror:true},{bone:"head",size:[9.21,4.09,.73],pos:[0,27.52,4.36],color:"a"},{bone:"head",size:[4.25,3.41,3.64],pos:[0,32.64,1.82],color:"a"}]}),Q({id:"hair.curly",slot:"hair",name:"Curly",palette:{a:"#3b2a20"},tint:"a",parts:[{bone:"head",size:[9.92,2.39,9.45],pos:[0,30.08,0],color:"a"},{bone:"head",size:[9.21,1.36,.73],pos:[0,28.89,-4.8],color:"a"},{bone:"head",size:[2.83,2.73,2.91],pos:[3.54,28.89,-2.55],color:"a",mirror:true},{bone:"head",size:[2.83,2.73,2.91],pos:[3.54,28.89,1.82],color:"a",mirror:true},{bone:"head",size:[5.67,2.05,5.82],pos:[0,31.61,0],color:"a"},{bone:"head",size:[4.25,4.27,2.18],pos:[2.13,27.27,4],color:"a",mirror:true}]})],bc=[Q({id:"top.idos",slot:"top",name:"iDos Games tee",palette:{a:"#1565ff"},tint:null,paint:[{region:"torso",color:"a"},{region:"sleeves",color:"a"}]}),Q({id:"top.tee",slot:"top",name:"Star tee",palette:{a:"#1d9e75",b:"#f4f1ea"},tint:"a",textures:{print:br(["aaaaaaaa","aaabbaaa","aabbbbaa","abbbbbba","aabbbbaa","aabaabaa","aaaaaaaa","aaaaaaaa"])},paint:[{region:"torso",color:"a",faces:{front:"print"}},{region:"sleeves",color:"a"}]}),Q({id:"top.hoodie",slot:"top",name:"Hoodie",palette:{a:"#378add",b:"#24578f",w:"#f0f0f0"},tint:"a",paint:[{region:"torso",color:"a"},{region:"arms",color:"a"}],parts:[{bone:"body",size:[7.88,4.38,1.84],pos:[0,21.78,3.04],color:"a"},{bone:"body",size:[5.63,2.5,.46],pos:[0,15.52,-2.53],color:"b"},{bone:"body",size:[.56,2.75,.37],pos:[1.24,19.65,-2.48],color:"w",mirror:true}]}),Q({id:"top.stripes",slot:"top",name:"Striped sweater",palette:{a:"#d4537e",b:"#f4f1ea"},tint:"a",textures:{st:br(["aaaaaaaa","aaaaaaaa","bbbbbbbb","aaaaaaaa","aaaaaaaa","bbbbbbbb","aaaaaaaa","aaaaaaaa"]),sl:br(["aaa","bbb","aaa","bbb","aaa"])},paint:[{region:"torso",color:"a",faces:{front:"st",back:"st",left:"st",right:"st"}},{region:"arms",color:"a",faces:{front:"sl",back:"sl",left:"sl",right:"sl"}}]}),Q({id:"top.jacket",slot:"top",name:"Jacket",palette:{a:"#444441",b:"#f4f1ea",c:"#c8c2b4"},tint:"a",textures:{open:br(["aaabbaaa","aaabbaaa","aaabbaaa","aaabbaaa","aaabbaaa","aacbbcaa","aaabbaaa","aaabbaaa"])},paint:[{region:"torso",color:"a",faces:{front:"open"}},{region:"arms",color:"a"}],parts:[{bone:"body",size:[3.38,1.5,.92],pos:[2.48,22.53,-2.21],color:"a",mirror:true}]}),Q({id:"top.tank",slot:"top",name:"Tank top",palette:{a:"#ef9f27"},tint:"a",paint:[{region:"torso",color:"a"}]})],yc=[Q({id:"bottom.jeans",slot:"bottom",name:"Jeans",palette:{a:"#2f5fd0"},tint:"a",paint:[{region:"legs",color:"a"}]}),Q({id:"bottom.shorts",slot:"bottom",name:"Shorts",palette:{a:"#5f6b7a",s:"@skin"},tint:"a",paint:[{region:"legs",color:"s"}],parts:[{bone:"legR",size:[4.62,5.4,4.62],pos:[2.1,9.7,0],color:"a",mirror:true}]}),Q({id:"bottom.skirt",slot:"bottom",name:"Skirt",palette:{a:"#7f77dd",s:"@skin"},tint:"a",paint:[{region:"legs",color:"s"}],parts:[{bone:"body",size:[10.13,4.38,5.52],pos:[0,11.46,0],color:"a"}]}),Q({id:"bottom.cargo",slot:"bottom",name:"Cargo pants",palette:{a:"#6b6b4a",b:"#55553a"},tint:"a",paint:[{region:"legs",color:"a"}],parts:[{bone:"legR",size:[.84,4.32,2.52],pos:[4.62,7,0],color:"b",mirror:true}]})],gc=[Q({id:"shoes.sneakers",slot:"shoes",name:"Sneakers",palette:{a:"#d84a30",w:"#f4f1ea"},tint:"a",textures:{toe:br(["aaaa","wwww"]),side:br(["aaaaa","wwwww"])},paint:[{region:"feet",color:"a",faces:{front:"toe",back:"toe",left:"side",right:"side",bottom:"w"}}]}),Q({id:"shoes.boots",slot:"shoes",name:"Boots",palette:{a:"#5a3a22",b:"#3a2414"},tint:"a",paint:[{region:"feet",color:"a",faces:{bottom:"b"}}],parts:[{bone:"shinR",size:[4.83,4.32,4.83],pos:[2.1,3.76,0],color:"a",mirror:true}]}),Q({id:"shoes.sandals",slot:"shoes",name:"Sandals",palette:{a:"#b0773a",s:"@skin"},tint:"a",paint:[{region:"feet",color:"s"}],parts:[{bone:"shinR",size:[4.51,.48,5.57],pos:[2.1,.24,-0.53],color:"a",mirror:true},{bone:"shinR",size:[4.51,.4,1.05],pos:[2.1,1.12,-1.89],color:"a",mirror:true}]})],xc=[Q({id:"hands.gloves",slot:"hands",name:"Gloves",palette:{a:"#2b2140"},tint:"a",paint:[{region:"hands",color:"a"}]})],wc=[Q({id:"waist.belt",slot:"waist",name:"Belt",palette:{a:"#5a3a22",g:"#d8b030"},tint:"a",parts:[{bone:"body",size:[9.45,1.25,4.97],pos:[0,13.15,0],color:"a"},{bone:"body",size:[1.8,1.5,.37],pos:[0,13.15,-2.67],color:"g"}]})],Rc=[Q({id:"back.backpack",slot:"back",name:"Backpack",palette:{a:"#c0612b",b:"#8a3f18"},tint:"a",parts:[{bone:"body",size:[6.75,8.75,2.76],pos:[0,17.4,3.68],color:"a"},{bone:"body",size:[4.5,3.75,.55],pos:[0,14.9,5.34],color:"b"}]}),Q({id:"back.cape",slot:"back",name:"Cape",palette:{a:"#a32d2d"},tint:"a",parts:[{bone:"body",size:[10.13,12.5,.55],pos:[0,16.15,2.67],color:"a"}]})],kc=[fr["face.glasses"],fr["face.shades"]],vc=[Q({id:"hat.beanie",slot:"hat",name:"Beanie",palette:{a:"#534ab7",w:"#f4f1ea"},tint:"a",parts:[{bone:"head",size:[9.92,3.07,9.45],pos:[0,30.76,0],color:"a"},{bone:"head",size:[10.34,1.36,9.89],pos:[0,29.3,0],color:"a"},{bone:"head",size:[2.13,2.05,2.18],pos:[0,33.18,0],color:"w"}]}),Q({id:"hat.cap",slot:"hat",name:"Cap",palette:{a:"#c0392b"},tint:"a",parts:[{bone:"head",size:[9.63,2.73,9.16],pos:[0,30.8,.15],color:"a"},{bone:"head",size:[7.79,.55,3.64],pos:[0,29.57,-5.96],color:"a"}]}),Q({id:"hat.bucket",slot:"hat",name:"Bucket hat",palette:{a:"#c8b88a"},tint:"a",parts:[{bone:"head",size:[9.63,2.73,9.16],pos:[0,31.61,0],color:"a"},{bone:"head",size:[11.33,.55,10.91],pos:[0,30.39,0],color:"a"}]})],zo=[...fc,...bc,...yc,...gc,...xc,...wc,...Rc,...kc,...vc,...zs.filter(e=>!Kr.some(t=>t.item.id===e.id)),...Kr.map(e=>e.item)],Rh=Object.fromEntries(zo.map(e=>[e.id,e]));function Ac(e){return zo.filter(t=>t.slot===e)}function _s(e){return Ac(e).filter(t=>!Is(t.id))}var Ec=["#f9e0cf","#f2c9a0","#e2ad80","#c88d62","#9c6844","#6e4a32"],Sc=["#3b2a20","#1d1d21","#f2c14e","#c0612b","#ece6da","#7f77dd","#d4537e","#2ab0a0"],Tc=["#3b2a20","#2f5fd0","#1d9e75","#7f77dd","#c0392b","#d8b030"],Mc=["#1d9e75","#378add","#d4537e","#444441","#ef9f27","#534ab7","#c0392b","#e8e4da"],yr={version:Ut,style:je,body:{skin:"#f2c9a0",height:1,head:"round"},face:{eyes:"round",eyeColor:"#3b2a20",brows:"soft",browColor:"#3b2a20",mouth:"smile",cheeks:true,marks:"none",emotion:"neutral"},anim:{...ct},wear:{hair:"hair.short",top:"top.idos",bottom:"bottom.jeans",shoes:"shoes.sneakers"},tint:{}},Os={hair:.92,top:1,bottom:1,shoes:1,hands:.1,waist:.2,back:.2,neck:.15,faceAcc:.25,hat:.35};function Eh(e=Math.random){let t=n=>n[Math.floor(e()*n.length)],r=t(Sc),o={},a={};for(let n of Object.keys(Os)){if(e()>=Os[n])continue;let s=_s(n);s.length&&(o[n]=t(s).id,a[n]=n==="hair"?r:t(Mc));}return {version:Ut,style:je,body:{skin:t(Ec),height:.95+e()*.1,head:t(jr)},face:{eyes:t(Dr),eyeColor:t(Tc),brows:t(Br),browColor:r==="#ece6da"||r==="#f2c14e"?"#8a6a3a":r,mouth:t(Nr),cheeks:e()<.6,marks:e()<.3?t(Hr):"none",emotion:"neutral"},anim:{...ct},wear:o,tint:a}}function Jt(e,t,r,o={}){return {...yr,body:{...yr.body,skin:e},face:{...yr.face,...t},anim:{...ct},wear:r,tint:o}}var Sh=[yr,Jt("#e2ad80",{eyes:"sparkle",mouth:"grin"},{hair:"hair.bun",top:"top.hoodie",bottom:"bottom.leggings",shoes:"shoes.runners"},{hair:"#3b2a20",top:"#d4537e",bottom:"#444441",shoes:"#e8e4da"}),Jt("#6e4a32",{eyes:"wide",mouth:"grin",browColor:"#1d1d21"},{hair:"hair.afro",top:"top.jersey",bottom:"bottom.shorts",shoes:"shoes.sneakers",hands:"hands.wristbands"},{hair:"#1d1d21",top:"#ef9f27",bottom:"#444441",shoes:"#e8e4da",hands:"#c0392b"}),Jt("#f9e0cf",{eyes:"anime",mouth:"open",browColor:"#534ab7"},{hair:"hair.spiky",top:"top.gamer",bottom:"bottom.cargo",shoes:"shoes.sneakers",faceAcc:"face.shades"},{hair:"#7f77dd",top:"#534ab7",bottom:"#444441",shoes:"#e8e4da",faceAcc:"#1d1d21"}),Jt("#c88d62",{eyes:"almond",mouth:"smile",browColor:"#8a4a2a"},{hair:"hair.long",top:"top.dress",bottom:"bottom.leggings",shoes:"shoes.sandals"},{hair:"#c0612b",top:"#1d9e75",bottom:"#444441",shoes:"#e8e4da"}),Jt("#9c6844",{eyes:"round",mouth:"smirk",browColor:"#1d1d21"},{hair:"hair.buzz",hat:"hat.cap",top:"top.tee",bottom:"bottom.joggers",shoes:"shoes.sneakers",back:"back.skateboard"},{hair:"#1d1d21",hat:"#c0392b",top:"#378add",bottom:"#444441",shoes:"#e8e4da",back:"#ef9f27"}),Jt("#f2c9a0",{eyes:"starry",mouth:"cat",marks:"freckles",browColor:"#8a6a3a"},{hair:"hair.pigtails",top:"top.heart",bottom:"bottom.pleated",shoes:"shoes.rainboots"},{hair:"#f2c14e",top:"#d4537e",bottom:"#534ab7",shoes:"#ef9f27"}),Jt("#e2ad80",{eyes:"narrow",brows:"thick",mouth:"smirk"},{hair:"hair.sidepart",top:"top.jacket",bottom:"bottom.jeans",shoes:"shoes.boots",back:"back.cape",neck:"neck.scarf"},{hair:"#3b2a20",top:"#444441",bottom:"#378add",shoes:"#3b2a20",back:"#c0392b",neck:"#ef9f27"})];var Lc={hair:{frame:"portrait",view:.5},hat:{frame:"head",view:.35},faceAcc:{frame:"portrait",view:.2},neck:{frame:"portrait",view:.3},top:{frame:"torso",view:.3},waist:{frame:"torso",view:.3},hands:{frame:"torso",view:.55},bottom:{frame:"legs",view:.3},shoes:{frame:"feet",view:.6},back:{frame:"full",view:Math.PI-.6}},Cc=["hair","top","bottom","shoes"];function Pc(e,t){let r=pr(JSON.parse(JSON.stringify(yr)));for(let o of Object.keys(r.wear))Cc.includes(o)||delete r.wear[o];return r.tint={},r.wear[e]=t,r}function Ph(e,t){return {key:`item:${e.id}`,make:()=>({spec:Pc(e.slot,e.id),items:{...t,[e.id]:e},opts:Lc[e.slot]})}}function zh(e={}){let t=e.size??224,r=e.limit??800,o=e.budgetMs??14,a=new Map,n=new Map,s=[],l=null,i=false,c=(m,d)=>{for(a.delete(m),a.set(m,d);a.size>r;){let b=a.keys().next().value;URL.revokeObjectURL(a.get(b)),a.delete(b);}},p=()=>{if(i)return;i=true;let m=globalThis.requestIdleCallback;m?m(h,{timeout:120}):setTimeout(h,16);};function h(){i=false;let m=performance.now();for(;s.length&&performance.now()-m<o;){let d=s.shift(),b=n.get(d);if(b&&(n.delete(d),b.listeners.size!==0))try{l??=gs({size:t});let{spec:u,items:R,opts:w}=b.make(),A=l.render(u,R,w),k=[...b.listeners];A.toBlob(x=>{if(!x)return;let f=URL.createObjectURL(x);c(d,f);for(let S of k)S(f);},"image/png");}catch{l?.dispose(),l=null;}}s.length&&p();}return {peek:m=>a.get(m)??null,request(m,d){let b=a.get(m.key);if(b)return c(m.key,b),d(b),()=>{};let u=n.get(m.key);u||(u={make:m.make,listeners:new Set},n.set(m.key,u),s.push(m.key)),u.listeners.add(d),p();let R=u;return ()=>R.listeners.delete(d)},release(){l?.dispose(),l=null;}}}var zc="voxel-avatar-v1";function Bh(){return {standard:zc,style:je,version:Ut,slots:[...Kt],eyes:[...Dr],brows:[...Br],mouths:[...Nr],emotions:[...b$1],heads:[...jr],marks:[...Hr],walks:[...xa],idles:[...wa],height:{min:Fr.min,max:Fr.max},items:[...zo],shop:{...Ca},rules:{slots:{...ya},limits:{...Yt},regions:[...fa],regionPairs:Object.fromEntries(Object.entries(ba).map(([e,t])=>[e,[...t]])),faces:[...ut],skinColor:qt,materials:[...tr]}}}var Ic=(e,t,r)=>"#"+[e,t,r].map(o=>Math.max(0,Math.min(255,Math.round(o))).toString(16).padStart(2,"0")).join("");function _c(e,t,r){let o=[];for(let a=0;a<r;a++)for(let n=0;n<t;n++){let s=Math.floor(n*e.width/t),l=Math.max(s+1,Math.floor((n+1)*e.width/t)),i=Math.floor(a*e.height/r),c=Math.max(i+1,Math.floor((a+1)*e.height/r)),p=0,h=0,m=0,d=0,b=0;for(let u=i;u<c;u++)for(let R=s;R<l;R++){let w=(u*e.width+R)*4;b++,!((e.data[w+3]??0)<128)&&(p+=e.data[w]??0,h+=e.data[w+1]??0,m+=e.data[w+2]??0,d++);}o.push(d*2<b?null:[p/d,h/d,m/d]);}return o}var $r=(e,t)=>(e[0]-t[0])**2+(e[1]-t[1])**2+(e[2]-t[2])**2;function jh(e,t){let r=Yt.textureSide,a=Math.min(1,16/Math.max(e.width,e.height,1)),n=Math.max(1,Math.min(r,Math.round(t.w??e.width*a))),s=Math.max(1,Math.min(r,Math.round(t.h??e.height*a))),l=[...new Set(t.symbols)].slice(0,Yt.palette);if(!l.length)throw new Error("pixelTextureFromImage: no palette symbols to use");let i=_c(e,n,s),c=i.filter(u=>!!u),p=new Map;for(let u of c){let R=u.map(A=>Math.round(A/8)).join(","),w=p.get(R);w?w.n++:p.set(R,{n:1,c:u});}let h=[...p.values()].sort((u,R)=>R.n-u.n||(u.c.join()<R.c.join()?-1:1)),m=[];for(let u of h){if(m.length>=l.length)break;m.every(R=>$r(R,u.c)>576)&&m.push([...u.c]);}!m.length&&h[0]&&(m=[[...h[0].c]]);for(let u=0;u<8&&m.length;u++){let R=m.map(()=>[0,0,0,0]);for(let w of c){let A=0;for(let x=1;x<m.length;x++)$r(w,m[x])<$r(w,m[A])&&(A=x);let k=R[A];k[0]+=w[0],k[1]+=w[1],k[2]+=w[2],k[3]+=1;}m=m.map((w,A)=>{let k=R[A];return k[3]?[k[0]/k[3],k[1]/k[3],k[2]/k[3]]:w});}let d={};m.forEach((u,R)=>d[l[R]]=Ic(u[0],u[1],u[2]));let b=[];for(let u=0;u<s;u++){let R="";for(let w=0;w<n;w++){let A=i[u*n+w];if(!A||!m.length){R+=".";continue}let k=0;for(let x=1;x<m.length;x++)$r(A,m[x])<$r(A,m[k])&&(k=x);R+=l[k];}b.push(R);}return {texture:{w:n,h:s,rows:b},palette:d}}var Oc="ugc.",Gh=e=>e.startsWith(Oc);export{Yn as ACTION_TIME,v1 as ANIM_EVENTS,Oc as AVATAR_AUTHOR_ITEM_PREFIX,ls as AVATAR_BASE_COLORS,Et as AVATAR_FACE_RECT,jr as AVATAR_HEADS,Fr as AVATAR_HEIGHT,wa as AVATAR_IDLES,Rh as AVATAR_ITEMS,Yt as AVATAR_ITEM_LIMITS,zo as AVATAR_ITEM_LIST,ec as AVATAR_ITEM_PRINTS,Lc as AVATAR_ITEM_SHOTS,Nm as AVATAR_PORTRAIT_BACKGROUND,Zt as AVATAR_RIG_ID,Ca as AVATAR_SHOP_DEFAULT_PRICES,zs as AVATAR_SHOP_ITEM_LIST,Kt as AVATAR_SLOTS,Ut as AVATAR_SPEC_VERSION,zc as AVATAR_STANDARD_ID,je as AVATAR_STYLE,xa as AVATAR_WALKS,ko as Animator,U as Art,Mo as AvatarActor,fa as BODY_REGIONS,jc as BONE_ROLES,Br as BROW_STYLES,I as CH,R1 as CHANNELS,qa as CHARACTER_LIMITS,Ha as CHARACTER_SPEC_VERSION,ft as CLEAR,_r as CLIPS,Mc as CLOTH_COLORS,ym as CREATURE_KINDS,yo as CharacterView,yr as DEFAULT_AVATAR,ct as DEFAULT_AVATAR_ANIM,xl as DEFAULT_AVATAR_FACE,ga as DEFAULT_AVATAR_HEAD,qo as DEFAULT_CHARACTER_SOURCE,Bs as DEFAULT_COLORS,er as DEFAULT_FINISH,dr as DrawnFace,$e as EMOTES,Cp as EMOTE_IDS,Fp as EMOTION_EVENTS,Lp as EVERYDAY_IDS,kr as EXPRESSIONS,cr as EXPRESSION_CHAIN,to as EXTRA_BONE_ROLES,Tc as EYE_COLORS,Dr as EYE_STYLES,ut as FACE_NAMES,os as FACE_TEXELS,Mp as GESTURE_IDS,Sc as HAIR_COLORS,k1 as HELD_KINDS,pn as HUMAN_BOTTOMS,g1 as HUMAN_HAIR,mn as HUMAN_SHOES,cn as HUMAN_TOPS,Ar as IDLE_STYLES,Cr as IKSolver,ul as LOCOMOTION,Hr as MARK_STYLES,Nr as MOUTH_STYLES,tr as PART_MATERIALS,o1 as PART_SHAPES,ha as POSTURE,ba as REGION_PAIRS,sr as REST,Ae as RIGS,Kn as RIG_CLIPS,wr as RIG_IDS,Ir as Ragdoll,hl as SEAT_HEIGHT_PX,qt as SKIN_COLOR,Ec as SKIN_TONES,ya as SLOT_RULES,Gc as SOCKETS,Sh as STARTER_LOOKS,mm as VOXEL_CHARACTER_SYSTEM_PROMPT,Eo as VoxelActor,vr as WALK_STYLES,No as acquireCharacter,de as add,ts as applyPosture,Bh as avatarCatalogExport,jm as avatarFromServer,Ph as avatarItemShot,Ac as avatarItemsForSlot,Pc as avatarMannequinWith,Aa as avatarPrints,I0 as bandColors,oe as bone,Ka as bonesOf,bp as characterFromImage,ap as characterOf,np as characterSpecs,bt as clearPose,va as composeAvatar,De as copyPose,us as createAvatarLighting,gs as createAvatarSnapshotter,zh as createAvatarThumbQueue,gm as creatureCharacter,Fl as creatureSource,Ot as defaultCharacter,oo as defaultCharacterName,Uo as disposeNameplate,Ra as drawAvatarFace,zp as emoteLabelOf,Dp as emotionFromText,_s as freeAvatarItemsForSlot,Go as humanSource,Gh as isAuthorAvatarItem,Is as isAvatarShopItem,Pp as isChairEmote,n1 as isDefaultCharacterName,ma as isEmote,X as isObj,Qa as layoutCharacter,dn as lerpPose,Ua as mirrorBone,hn as nameplate,io as newAnimInput,ot as normColor,mp as npcCharacter,Ie as num,sp as onCharacterKnown,pr as parseAvatarSpec,Ye as parseCharacterSpec,Io as pick,jh as pixelTextureFromImage,Eh as randomAvatar,jo as recolor,op as registerCharacter,no as releaseCharacter,mc as renderAvatarCanvas,Hm as renderAvatarImage,a1 as rigOfSpec,es as sampleEmote,dl as sampleTrack,y as setCh,rr as specHash,_o as stableStringify,Sr as standardFace,na as styleParams,mr as validateAvatarItem,ro as vec3};