@idosgames/characters 0.1.8 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{PartsManager-CmrzoyJR.d.cts → PartsManager-CjsNhtVp.d.cts} +1 -1
- package/dist/{PartsManager-BpAUMQXw.d.ts → PartsManager-DzJD-pyV.d.ts} +1 -1
- package/dist/{chunk-JZU255IQ.js → chunk-7P4UMCIQ.js} +1 -1
- package/dist/chunk-MNDPJKUD.js +1 -0
- package/dist/chunk-UFZRW76X.js +2 -0
- package/dist/{chunk-CMQ6UYQV.js → chunk-XUQ63CSO.js} +1 -1
- package/dist/{chunk-I7UPBAMR.js → chunk-YXOP7OHP.js} +1 -1
- package/dist/contract-BtI1o_ow.d.cts +49 -0
- package/dist/contract-BtI1o_ow.d.ts +49 -0
- package/dist/gltf/index.cjs +1 -1
- package/dist/gltf/index.d.cts +1 -1
- package/dist/gltf/index.d.ts +1 -1
- package/dist/gltf/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/rig2d/editor/index.cjs +2 -2
- package/dist/rig2d/editor/index.d.cts +3 -3
- package/dist/rig2d/editor/index.d.ts +3 -3
- package/dist/rig2d/editor/index.js +1 -1
- package/dist/rig2d/index.cjs +4 -4
- package/dist/rig2d/index.d.cts +4 -4
- package/dist/rig2d/index.d.ts +4 -4
- package/dist/rig2d/index.js +1 -1
- package/dist/rig2d/phaser/index.cjs +2 -2
- package/dist/rig2d/phaser/index.d.cts +2 -2
- package/dist/rig2d/phaser/index.d.ts +2 -2
- package/dist/rig2d/phaser/index.js +1 -1
- package/dist/rig2d/three/index.cjs +2 -2
- package/dist/rig2d/three/index.d.cts +2 -2
- package/dist/rig2d/three/index.d.ts +2 -2
- package/dist/rig2d/three/index.js +1 -1
- package/dist/{thumbnail-B7wrQe1B.d.ts → thumbnail-BRsomuLZ.d.ts} +1 -1
- package/dist/{thumbnail-B1WjbWcW.d.cts → thumbnail-CTpr-C1A.d.cts} +1 -1
- package/dist/voxel/index.cjs +15 -15
- package/dist/voxel/index.d.cts +1060 -26
- package/dist/voxel/index.d.ts +1060 -26
- package/dist/voxel/index.js +15 -15
- package/package.json +1 -1
- package/dist/chunk-64D567CX.js +0 -1
- package/dist/chunk-UUX4NEC2.js +0 -2
- package/dist/contract-DhZuKNIf.d.cts +0 -24
- package/dist/contract-DhZuKNIf.d.ts +0 -24
package/dist/voxel/index.cjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
'use strict';var _=require('three'),BufferGeometryUtils_js=require('three/examples/jsm/utils/BufferGeometryUtils.js'),RoomEnvironment_js=require('three/examples/jsm/environments/RoomEnvironment.js');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var ___namespace=/*#__PURE__*/_interopNamespace(_);function rt(e){let t=e>>>0;return function(){t|=0,t=t+1831565813|0;let r=Math.imul(t^t>>>15,1|t);return r=r+Math.imul(r^r>>>7,61|r)^r,((r^r>>>14)>>>0)/4294967296}}function Re(e){let t=2166136261;for(let r=0;r<e.length;r++)t^=e.charCodeAt(r),t=Math.imul(t,16777619);return t>>>0}var io="en";function B(e,t){let r=typeof e=="string"?e:e[io]??e.en;if(t)for(let[o,n]of Object.entries(t))r=r.split(`{${o}}`).join(String(n));return r}function sr(e){let t=e.trim(),r=/```(?:json)?\s*([\s\S]*?)(?:```|$)/i.exec(t);r&&r[1]!==void 0&&(t=r[1]);let o=t.indexOf("{");if(o<0)return {ok:false,error:B({en:"the answer has no JSON object",ru:"\u0432 \u043E\u0442\u0432\u0435\u0442\u0435 \u043D\u0435\u0442 JSON-\u043E\u0431\u044A\u0435\u043A\u0442\u0430"}),truncated:false};let n=0,a=false,i=false,c=-1;for(let s=o;s<t.length;s++){let l=t[s];if(a){i?i=false:l==="\\"?i=true:l==='"'&&(a=false);continue}if(l==='"')a=true;else if(l==="{"||l==="[")n++;else if((l==="}"||l==="]")&&(n--,n===0)){c=s;break}}if(c<0)return {ok:false,error:B({en:"the JSON is cut off",ru:"JSON \u043E\u0431\u043E\u0440\u0432\u0430\u043D"}),truncated:true};try{return {ok:!0,value:JSON.parse(t.slice(o,c+1))}}catch{return {ok:false,error:B({en:"invalid JSON",ru:"\u043D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u044B\u0439 JSON"}),truncated:false}}}var ir={id:"avatar",label:"\u0410\u0432\u0430\u0442\u0430\u0440",hint:"the iDos Games account avatar: soft blocks with elbows and knees",bones:[{name:"body",role:"body",parent:null,pivot:[0,12.4,0]},{name:"head",role:"head",parent:"body",pivot:[0,22.4,0]},{name:"armL",role:"armL",parent:"body",pivot:[-6.3,21.4,0]},{name:"armR",role:"armR",parent:"body",pivot:[6.3,21.4,0]},{name:"foreArmL",role:"foreArmL",parent:"armL",pivot:[-6.3,17.2,0]},{name:"foreArmR",role:"foreArmR",parent:"armR",pivot:[6.3,17.2,0]},{name:"legL",role:"legL",parent:null,pivot:[-2.1,12.4,0]},{name:"legR",role:"legR",parent:null,pivot:[2.1,12.4,0]},{name:"shinL",role:"shinL",parent:"legL",pivot:[-2.1,6.4,0]},{name:"shinR",role:"shinR",parent:"legR",pivot:[2.1,6.4,0]}],sockets:[{name:"handR",bone:"foreArmR",at:[6.3,11.6,-1]},{name:"handL",bone:"foreArmL",at:[-6.3,11.6,-1]},{name:"headTop",bone:"head",at:[0,30.3,0]},{name:"face",bone:"head",at:[0,26.7,-4]},{name:"back",bone:"body",at:[0,18.5,2.3]},{name:"waist",bone:"body",at:[0,12.8,0]},{name:"shoulders",bone:"body",at:[0,22.4,0]}],hitbox:{w:.6,h:1.9},eye:26.4,height:{min:24,max:40},faceBone:"head",defaultParts:[{bone:"head",size:[8.5,7.5,8],pos:[0,26.5,0],color:"s",name:"head"},{bone:"head",size:[2.9,.8,2.7],pos:[0,22.6,0],color:"s",name:"neck"},{bone:"body",size:[9,6,4.6],pos:[0,19.4,0],color:"t",name:"torso"},{bone:"body",size:[8.5,5.2,4.3],pos:[0,15,0],color:"t",name:"torso"},{bone:"armL",size:[3.6,5,3.6],pos:[-6.3,19.7,0],color:"s",name:"sleeveL"},{bone:"armR",size:[3.6,5,3.6],pos:[6.3,19.7,0],color:"s",name:"sleeveR"},{bone:"foreArmL",size:[3.45,5.4,3.45],pos:[-6.3,15.7,0],color:"s",name:"forearmL"},{bone:"foreArmR",size:[3.45,5.4,3.45],pos:[6.3,15.7,0],color:"s",name:"forearmR"},{bone:"foreArmL",size:[3.3,3,3.3],pos:[-6.3,12.7,0],color:"s",name:"handL"},{bone:"foreArmR",size:[3.3,3,3.3],pos:[6.3,12.7,0],color:"s",name:"handR"},{bone:"legL",size:[4.2,6,4.2],pos:[-2.1,9.4,0],color:"p",name:"legL"},{bone:"legR",size:[4.2,6,4.2],pos:[2.1,9.4,0],color:"p",name:"legR"},{bone:"shinL",size:[4.05,7.2,4.05],pos:[-2.1,4,0],color:"p",name:"legL"},{bone:"shinR",size:[4.05,7.2,4.05],pos:[2.1,4,0],color:"p",name:"legR"},{bone:"shinL",size:[4.2,1.6,5.2],pos:[-2.1,.8,-0.5],color:"p",name:"footL"},{bone:"shinR",size:[4.2,1.6,5.2],pos:[2.1,.8,-0.5],color:"p",name:"footR"}]};var lr={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 cr={id:"flyer",label:"\u041A\u0440\u044B\u043B\u0430\u0442\u044B\u0439",hint:"birds, bats, dragons, fairies, insects \u2014 creatures whose wings matter",bones:[{name:"body",role:"body",parent:null,pivot:[0,6,0]},{name:"head",role:"head",parent:"body",pivot:[0,11,-3]},{name:"wingL",role:"wingL",parent:"body",pivot:[-3,10,0]},{name:"wingR",role:"wingR",parent:"body",pivot:[3,10,0]},{name:"legL",role:"legL",parent:null,pivot:[-1.5,4,0]},{name:"legR",role:"legR",parent:null,pivot:[1.5,4,0]},{name:"tail",role:"tail",parent:"body",pivot:[0,8,4]}],sockets:[{name:"headTop",bone:"head",at:[0,16,-4]},{name:"face",bone:"head",at:[0,13,-7]},{name:"back",bone:"body",at:[0,11,1]},{name:"waist",bone:"body",at:[0,6,0]},{name:"shoulders",bone:"body",at:[0,10,-2]},{name:"handR",bone:"legR",at:[1.5,0,-1]},{name:"handL",bone:"legL",at:[-1.5,0,-1]}],hitbox:{w:.6,h:.9},eye:14,height:{min:6,max:40},faceBone:"head",defaultParts:[{bone:"body",size:[6,6,8],pos:[0,8,0],color:"t"},{bone:"head",size:[5,5,5],pos:[0,13,-4],color:"s"},{bone:"wingL",size:[8,1,6],pos:[-7,10,0],color:"t"},{bone:"wingR",size:[8,1,6],pos:[7,10,0],color:"t"},{bone:"legL",size:[1,4,1],pos:[-1.5,2,0],color:"p"},{bone:"legR",size:[1,4,1],pos:[1.5,2,0],color:"p"},{bone:"tail",size:[4,1,4],pos:[0,8,6],color:"t"}]};var pr={id:"humanoid",label:"\u0427\u0435\u043B\u043E\u0432\u0435\u043A",hint:"people, humanoids, robots, elves, zombies \u2014 anything on two legs with two arms",bones:[{name:"body",role:"body",parent:null,pivot:[0,12,0]},{name:"head",role:"head",parent:"body",pivot:[0,24,0]},{name:"armL",role:"armL",parent:"body",pivot:[-6,22,0]},{name:"armR",role:"armR",parent:"body",pivot:[6,22,0]},{name:"legL",role:"legL",parent:null,pivot:[-2,12,0]},{name:"legR",role:"legR",parent:null,pivot:[2,12,0]}],sockets:[{name:"handR",bone:"armR",at:[6,11,-1]},{name:"handL",bone:"armL",at:[-6,11,-1]},{name:"headTop",bone:"head",at:[0,32,0]},{name:"face",bone:"head",at:[0,28,-4]},{name:"back",bone:"body",at:[0,18,2]},{name:"waist",bone:"body",at:[0,12,0]},{name:"shoulders",bone:"body",at:[0,24,0]}],hitbox:{w:.6,h:1.8},eye:27,height:{min:16,max:48},faceBone:"head",defaultParts:[{bone:"head",size:[8,8,8],pos:[0,28,0],color:"s"},{bone:"body",size:[8,12,4],pos:[0,18,0],color:"t"},{bone:"armL",size:[4,12,4],pos:[-6,18,0],color:"s"},{bone:"armR",size:[4,12,4],pos:[6,18,0],color:"s"},{bone:"legL",size:[4,12,4],pos:[-2,6,0],color:"p"},{bone:"legR",size:[4,12,4],pos:[2,6,0],color:"p"}]};var hr={id:"quadruped",label:"\u0427\u0435\u0442\u0432\u0435\u0440\u043E\u043D\u043E\u0433\u043E\u0435",hint:"dogs, cats, horses, wolves, bears, lizards \u2014 any animal on four legs",bones:[{name:"body",role:"body",parent:null,pivot:[0,12,0]},{name:"head",role:"head",parent:"body",pivot:[0,14,-8]},{name:"legFL",role:"legFL",parent:null,pivot:[-3,8,-6]},{name:"legFR",role:"legFR",parent:null,pivot:[3,8,-6]},{name:"legBL",role:"legBL",parent:null,pivot:[-3,8,6]},{name:"legBR",role:"legBR",parent:null,pivot:[3,8,6]},{name:"tail",role:"tail",parent:"body",pivot:[0,14,8]}],sockets:[{name:"headTop",bone:"head",at:[0,20,-12]},{name:"face",bone:"head",at:[0,16,-16]},{name:"back",bone:"body",at:[0,16,0]},{name:"waist",bone:"body",at:[0,12,4]},{name:"shoulders",bone:"body",at:[0,16,-6]},{name:"handR",bone:"head",at:[2,13,-16]},{name:"handL",bone:"head",at:[-2,13,-16]}],hitbox:{w:.9,h:1},eye:17,height:{min:8,max:40},faceBone:"head",defaultParts:[{bone:"body",size:[8,8,16],pos:[0,12,0],color:"t"},{bone:"head",size:[8,8,8],pos:[0,16,-12],color:"s"},{bone:"legFL",size:[3,8,3],pos:[-3,4,-6],color:"p"},{bone:"legFR",size:[3,8,3],pos:[3,4,-6],color:"p"},{bone:"legBL",size:[3,8,3],pos:[-3,4,6],color:"p"},{bone:"legBR",size:[3,8,3],pos:[3,4,6],color:"p"},{bone:"tail",size:[2,2,8],pos:[0,14,12],color:"t"}]};var bs=["root","body","head","armL","armR","legL","legR","foreArmL","foreArmR","shinL","shinR","legFL","legFR","legBL","legBR","tail","wingL","wingR","ear","hair","cape","antenna","static"],ot=["tail","wingL","wingR","ear","hair","cape","antenna","static"],ys=["handR","handL","headTop","face","back","waist","shoulders"],Be=["humanoid","quadruped","flyer","blob"],Oe="avatar";var ie={humanoid:pr,quadruped:hr,flyer:cr,blob:lr,avatar:ir};var mr=1,be=["front","back","left","right","top","bottom"],je=["neutral","blink","happy","sad","angry","surprised","scared","tired","hurt","talk"],Pt=["normal","bouncy","heavy","sneaky","robotic"],Lt=["calm","fidgety","proud"],ur={parts:64,bones:16,palette:32,textures:48,texturePixels:32768,textureSide:32,partSide:32,coord:64},_e={noise:.5,outline:.4,shade:.25,density:2},N=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Ve=e=>Array.isArray(e)?e:[];function Q(e,t,r,o){let n=typeof e=="number"?e:typeof e=="string"?Number(e):NaN;return Number.isFinite(n)?Math.min(o,Math.max(r,n)):t}function Mt(e,t,r){if(typeof e!="string")return r;let o=e.trim();if(t.includes(o))return o;let n=o.toLowerCase().replace(/[\s-]+/g,"_");return t.find(i=>i.toLowerCase()===n)??r}function fe(e,t,r){return typeof e=="string"?e.trim().slice(0,r):t}function nt(e,t,r=null){if(!Array.isArray(e)||e.length<3)return r;let o=e.slice(0,3).map(n=>Q(n,NaN,-t,t));return o.every(Number.isFinite)?o:r}var dr={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 ue(e){if(typeof e!="string")return null;let t=e.trim().toLowerCase();if(dr[t])return dr[t];let r=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/.exec(t);if(!r)return null;let o=r[1];return "#"+(o.length===3?o.split("").map(n=>n+n).join(""):o)}var ye=new Set(["."," "]),fr=e=>/^[A-Za-z0-9_]{1,24}$/.test(e),lo={human:"humanoid",biped:"humanoid",person:"humanoid",animal:"quadruped",four_legs:"quadruped",quadrupedal:"quadruped",bird:"flyer",winged:"flyer",dragon:"flyer",slime:"blob",ghost:"blob"};function co(e){if(typeof e!="string")return "humanoid";let t=e.trim().toLowerCase().replace(/[\s-]+/g,"_");return Be.includes(t)?t:t===Oe?Oe:lo[t]??"humanoid"}function br(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 le(e){if(typeof e=="string"){let d=sr(e);if(!d.ok)return {ok:false,error:d.error,truncated:d.truncated};e=d.value;}if(!N(e))return {ok:false,error:B({en:"the character recipe is not an object",ru:"\u0440\u0435\u0446\u0435\u043F\u0442 \u043F\u0435\u0440\u0441\u043E\u043D\u0430\u0436\u0430 \u2014 \u043D\u0435 \u043E\u0431\u044A\u0435\u043A\u0442"})};if(!("parts"in e)&&!("rig"in e)){let d=e.character??e.spec??e.characterSpec;N(d)&&(e=d);}let t=e,r=ur,o=[];typeof t.version=="number"&&t.version>mr&&o.push(B({en:"recipe version {v} is newer than the game \u2014 read what could be read",ru:"\u0440\u0435\u0446\u0435\u043F\u0442 \u0432\u0435\u0440\u0441\u0438\u0438 {v} \u2014 \u043D\u043E\u0432\u0435\u0435 \u0438\u0433\u0440\u044B, \u0440\u0430\u0437\u043E\u0431\u0440\u0430\u043D\u043E \u0447\u0442\u043E \u043F\u043E\u043D\u044F\u0442\u043D\u043E"},{v:t.version}));let n=co(t.rig),a=ie[n],i={};if(N(t.palette))for(let[d,R]of Object.entries(t.palette)){if(Object.keys(i).length>=r.palette){o.push(B({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 S=ue(R);if(d.length!==1||ye.has(d)||!S){o.push(B({en:"palette colour \xAB{k}\xBB was not understood",ru:"\u0446\u0432\u0435\u0442 \u043F\u0430\u043B\u0438\u0442\u0440\u044B \xAB{k}\xBB \u043D\u0435 \u043F\u043E\u043D\u044F\u0442"},{k:d}));continue}i[d]=S;}let c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",s=(d,R)=>{if(typeof d!="string")return R;if(d.length===1&&i[d])return d;let S=ue(d);if(!S)return R;let v=Object.entries(i).find(([,C])=>C===S);if(v)return v[0];if(Object.keys(i).length>=r.palette)return R;let I=[...c].find(C=>!i[C]);return I?(i[I]=S,I):R},l={},h=0;if(N(t.textures))for(let[d,R]of Object.entries(t.textures)){if(!fr(d)){o.push(B({en:"texture name \xAB{id}\xBB does not fit",ru:"\u0438\u043C\u044F \u0442\u0435\u043A\u0441\u0442\u0443\u0440\u044B \xAB{id}\xBB \u043D\u0435 \u043F\u043E\u0434\u0445\u043E\u0434\u0438\u0442"},{id:d.slice(0,30)}));continue}if(Object.keys(l).length>=r.textures){o.push(B({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 S=mo(R,i,o,d);if(S){if(h+S.w*S.h>r.texturePixels){o.push(B({en:"texture \xAB{id}\xBB did not fit the pixel limit",ru:"\u0442\u0435\u043A\u0441\u0442\u0443\u0440\u0430 \xAB{id}\xBB \u043D\u0435 \u0432\u043B\u0435\u0437\u043B\u0430 \u0432 \u043B\u0438\u043C\u0438\u0442 \u043F\u0438\u043A\u0441\u0435\u043B\u0435\u0439"},{id:d}));continue}h+=S.w*S.h,l[d]=S;}}let m=new Set(a.bones.map(d=>d.name)),p=[];for(let d of Ve(t.bones)){if(!N(d))continue;let R=fe(d.name,"",24);if(!R||!fr(R))continue;let S=nt(d.pivot,r.coord);if(!S||p.some(L=>L.name===R))continue;if(p.length>=r.bones){o.push(B({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 v=m.has(R),I=fe(d.parent,"",24),C=v?a.bones.find(L=>L.name===R).parent??"":m.has(I)||p.some(L=>L.name===I)?I:a.bones.find(L=>L.role==="body").name;p.push({name:R,parent:C,pivot:S,role:v?"static":Mt(d.role,ot,"static")}),m.add(R);}let y=Object.keys(i)[0]??"s",x=[];for(let d of Ve(t.parts)){if(x.length>=r.parts){o.push(B({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(!N(d))continue;let R=nt(d.size,r.partSide),S=nt(d.pos??d.center??d.at,r.coord);if(!R||!S||R.some(G=>G<=0))continue;let v=fe(d.bone,"",24);m.has(v)||(v&&o.push(B({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:v})),v=a.bones.find(G=>G.role==="body").name);let I={bone:v,size:R,pos:S,color:s(d.color,y)};if(N(d.faces)){let G={};for(let w of be){let A=d.faces[w];if(typeof A=="string")if(l[A])G[w]=A;else {let M=s(A,"");M&&(G[w]=M);}}Object.keys(G).length&&(I.faces=G);}let C=nt(d.rot??d.rotation,180);C&&C.some(G=>G!==0)&&(I.rot=C),(d.mirror===true||d.mirror==="x")&&(I.mirror=true);let L=fe(d.name,"",24);L&&(I.name=L),x.push(I);}if(!x.length){for(let[d,R]of Object.entries(po))i[d]||(i[d]=R);x.push(...a.defaultParts.map(ho));}let b=null;if(N(t.face)){let d=t.face,R=m.has(fe(d.bone,"",24))?fe(d.bone,"",24):a.faceBone,S=Ve(d.rect).map(I=>Math.round(Q(I,NaN,0,r.partSide)*10)/10),v={};if(N(d.expressions))for(let I of je){let C=d.expressions[I];typeof C=="string"&&l[C]&&(v[I]=C);}if(!v.neutral){let I=Object.values(v)[0];I&&(v.neutral=I);}if(v.neutral){let I=l[v.neutral];b={bone:R,rect:S.length===4&&S.every(Number.isFinite)&&S[2]>0&&S[3]>0?S:[0,0,I.w,I.h],expressions:v};}else Object.keys(d).length&&o.push(B({en:"the face has no pictures \u2014 no face is drawn",ru:"\u0443 \u043B\u0438\u0446\u0430 \u043D\u0435\u0442 \u043D\u0438 \u043E\u0434\u043D\u043E\u0439 \u043A\u0430\u0440\u0442\u0438\u043D\u043A\u0438 \u2014 \u043B\u0438\u0446\u043E \u043D\u0435 \u043D\u0430\u0440\u0438\u0441\u043E\u0432\u0430\u043D\u043E"}));}let T=N(t.style)?t.style:{},k=N(t.voice)?t.voice:{},g=N(t.finish)?t.finish:{},f={version:mr,name:fe(t.name,at(),40)||at(),description:fe(t.description,"",300),rig:n,scale:Q(t.scale,1,.25,3),palette:i,textures:l,parts:x,bones:p,face:b,style:{walk:Mt(T.walk,Pt,"normal"),idle:Mt(T.idle,Lt,"calm"),energy:Q(T.energy,.5,0,1)},voice:{pitch:Q(k.pitch,1,.5,2)},tags:Ve(t.tags).filter(d=>typeof d=="string"&&!!d.trim()).slice(0,8).map(d=>d.trim().slice(0,24)),finish:{noise:Q(g.noise,_e.noise,0,1),outline:Q(g.outline,_e.outline,0,1),shade:Q(g.shade,_e.shade,0,1),density:Math.round(Q(g.density,_e.density,1,4))}},E=Q(g.round,0,0,1);return E>0&&(f.finish.round=E),{ok:true,spec:f,warnings:o}}var po={s:"#c69c7c",t:"#3a8fd6",p:"#2c3e6b"};function ho(e){return JSON.parse(JSON.stringify(e))}function mo(e,t,r,o){let n=Array.isArray(e)?{rows:e}:N(e)?e:null;if(!n)return null;let a=ur.textureSide,i=Ve(n.rows??n.pixels).filter(h=>typeof h=="string");if(!i.length)return null;let c=Math.round(Q(n.h??n.height,i.length,1,a)),s=Math.round(Q(n.w??n.width,Math.max(...i.map(h=>h.length)),1,a)),l=false;for(i=i.slice(0,c).map(h=>{let m="";for(let p=0;p<s;p++){let y=h[p]??".";ye.has(y)||t[y]?m+=y===" "?".":y:(l=true,m+=".");}return m});i.length<c;)i.push(".".repeat(s));return l&&r.push(B({en:"texture \xAB{id}\xBB has symbols not in the palette \u2014 they became transparent",ru:"\u0432 \u0442\u0435\u043A\u0441\u0442\u0443\u0440\u0435 \xAB{id}\xBB \u0441\u0438\u043C\u0432\u043E\u043B\u044B \u043D\u0435 \u0438\u0437 \u043F\u0430\u043B\u0438\u0442\u0440\u044B \u2014 \u0441\u0442\u0430\u043B\u0438 \u043F\u0440\u043E\u0437\u0440\u0430\u0447\u043D\u044B\u043C\u0438"},{id:o})),{w:s,h:c,rows:i}}function It(e){return Array.isArray(e)?"["+e.map(It).join(",")+"]":N(e)?"{"+Object.keys(e).filter(t=>e[t]!==void 0).sort().map(t=>JSON.stringify(t)+":"+It(e[t])).join(",")+"}":JSON.stringify(e)}function ze(e){let t=It(e),r=Re(t),o=Re("~"+t);return r.toString(16).padStart(8,"0")+o.toString(16).padStart(8,"0")}function Is(e){return ie[e.rig]}function yr(e){let r=ie[e.rig].bones.map(o=>{let n=e.bones.find(a=>a.name===o.name);return {name:o.name,role:o.role,parent:o.parent,pivot:(n?.pivot??o.pivot).slice()}});for(let o of e.bones)r.some(n=>n.name===o.name)||r.push({name:o.name,role:o.role,parent:o.parent,pivot:o.pivot.slice()});return r}function at(){return B({en:"Character",ru:"\u041F\u0435\u0440\u0441\u043E\u043D\u0430\u0436"})}var Ps=e=>e==="\u041F\u0435\u0440\u0441\u043E\u043D\u0430\u0436"||e==="Character";var fo={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 Ot(e){let t=parseInt(e.slice(1),16);return [t>>16&255,t>>8&255,t&255]}function gr(e,t,r,o,n,a){let i=((r-1-n)*t+o)*4;e[i]=a[0],e[i+1]=a[1],e[i+2]=a[2],e[i+3]=255;}function uo(e,t=0){e.sort((r,o)=>o.h-r.h||o.w-r.w||(r.key<o.key?-1:1));for(let r=16;;r*=2){let o=0,n=0,a=0;for(let c of e)o+c.w+t*2>r&&(o=0,n+=a,a=0),c.x=o+t,c.y=n+t,o+=c.w+t*2,a=Math.max(a,c.h+t*2);let i=n+a;if(i<=r||r>=1024){let c=16;for(;c<i;)c*=2;return {w:r,h:c}}}}function bo(e,t,r,o,n){let a=(i,c)=>((r-1-o.y-c)*t+o.x+i)*4;for(let i=-n;i<o.h+n;i++)for(let c=-n;c<o.w+n;c++){let s=Math.max(0,Math.min(o.w-1,c)),l=Math.max(0,Math.min(o.h-1,i));if(s===c&&l===i)continue;let h=a(s,l);e.copyWithin(a(c,i),h,h+4);}}function xr(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 yo(e,t,r,o,n,a,i,c){let l=1+(.55*xr(i,t,r)+.45*xr(i^1540483477,Math.floor(t/3),Math.floor(r/3))-.5)*2*c.noise*.14;return a==="s"?l+=c.shade*.16*(.5-(r+.5)/n):a==="t"?l+=c.shade*.08:l-=c.shade*.2,o>=3&&n>=3&&(t===0||r===0||t===o-1||r===n-1)&&(l*=1-.5*c.outline),[Math.max(0,Math.min(255,e[0]*l)),Math.max(0,Math.min(255,e[1]*l)),Math.max(0,Math.min(255,e[2]*l))]}var Fe=Math.PI/180;function st(e,t){if(!t)return e;let[r,o,n]=e,[a,i,c]=[t[0]*Fe,t[1]*Fe,t[2]*Fe],s=Math.cos(c),l=Math.sin(c);return [r,o]=[r*s-o*l,r*l+o*s],s=Math.cos(i),l=Math.sin(i),[r,n]=[r*s+n*l,-r*l+n*s],s=Math.cos(a),l=Math.sin(a),[o,n]=[o*s-n*l,o*l+n*s],[r,o,n]}function go(e,t){let r=[];for(let o of e.parts){if(r.push({...o,flip:false}),!o.mirror)continue;let n=o.faces?{...o.faces,left:o.faces.right,right:o.faces.left}:void 0;n&&(n.left===void 0&&delete n.left,n.right===void 0&&delete n.right);let a={...o,bone:br(o.bone,t),pos:[-o.pos[0],o.pos[1],o.pos[2]],flip:true};n?a.faces=n:delete a.faces,o.rot&&(a.rot=[o.rot[0],-o.rot[1],-o.rot[2]]),r.push(a);}return r}function vr(e){let t=ie[e.rig],r=yr(e),o=w=>r.some(A=>A.name===w),n=go(e,o),a=e.finish??_e,i=a.round??0,c=new Map,s=(w,A)=>{let M=w.faces?.[A],P=M!==void 0?e.textures[M]:void 0,U=M!==void 0&&e.palette[M]?M:w.color,[D,X]=A==="front"||A==="back"?[w.size[0],w.size[1]]:A==="left"||A==="right"?[w.size[2],w.size[1]]:[w.size[0],w.size[2]],W=(Le,we)=>Math.max(1,Math.min(64,we*Math.max(1,Math.round(Le*a.density/we)))),Y=P?W(D,P.w):W(D,1),q=P?W(X,P.h):W(X,1),z=A==="top"?"t":A==="bottom"?"b":"s",J=(P?"t:"+M:"c:"+U)+"|"+Y+"x"+q+z,te=c.get(J);if(te)return te;let oe=Re(J),de=P?null:Ot(e.palette[U]??"#ff00ff");return te={key:J,w:Y,h:q,x:0,y:0,paint:(Le,we,Qe,et,tt)=>{for(let ve=0;ve<q;ve++)for(let Z=0;Z<Y;Z++){let ae=de;if(P){let he=P.rows[Math.floor(ve*P.h/q)][Math.floor(Z*P.w/Y)];if(ye.has(he))continue;let se=e.palette[he];if(!se)continue;ae=Ot(se);}gr(Le,we,Qe,et+Z,tt+ve,yo(ae,Z,ve,Y,q,z,oe,a));}}},c.set(J,te),te},l=(w,A)=>{let M="e:"+w,P=c.get(M);return P||(P={key:M,w:A.w,h:A.h,x:0,y:0,paint:(U,D,X,W,Y)=>{for(let q=0;q<A.h;q++)for(let z=0;z<A.w;z++){let J=A.rows[q][z];if(ye.has(J))continue;let te=e.palette[J];te&&gr(U,D,X,W+z,Y+q,Ot(te));}}},c.set(M,P)),P},h=n.map(w=>({p:w,faces:be.map(A=>({f:A,cell:s(w,A)}))})),m=e.face,p=[];if(m)for(let[w,A]of Object.entries(m.expressions)){let M=e.textures[A];M&&p.push([w,l(A,M)]);}let y=i>0?2:0,{w:x,h:b}=uo([...c.values()],y),T=new Uint8Array(x*b*4);for(let w of c.values())w.paint(T,x,b,w.x,w.y),y&&bo(T,x,b,w,y);let k=.01,g=(w,A=k)=>[(w.x+A)/x,1-(w.y+A)/b,(w.x+w.w-A)/x,1-(w.y+w.h-A)/b],f=new Map;for(let w of r)f.set(w.name,{pos:[],nrm:[],uv:[],idx:[]});let E=new Map,d=w=>{let A=E.get(w);if(A===void 0){A=true;for(let M=0;M<w.h&&A;M++)for(let P=0;P<w.w;P++)if(T[((b-1-w.y-M)*x+w.x+P)*4+3]<128){A=false;break}E.set(w,A);}return A},R=new Map;for(let{p:w,faces:A}of h)if(A.every(({cell:M})=>d(M))){let M=R.get(w.bone)??[];M.push(w),R.set(w.bone,M);}let S=0;for(let{p:w,faces:A}of h){let M=f.get(w.bone),P=r.find(Y=>Y.name===w.bone).pivot,U=[w.size[0]/2,w.size[1]/2,w.size[2]/2];S=Math.max(S,w.pos[1]+U[1]);let D=(R.get(w.bone)??[]).filter(Y=>Y!==w),X=Math.min(w.size[0],w.size[1],w.size[2])>=Ro?vo:wo,W=(Y,q)=>{let z=fo[Y],J=(Z,ae)=>{let he=[U[0]*(z.tl[0]+2*(z.u[0]*Z+z.d[0]*ae)),U[1]*(z.tl[1]+2*(z.u[1]*Z+z.d[1]*ae)),U[2]*(z.tl[2]+2*(z.u[2]*Z+z.d[2]*ae))],se=st(he,w.rot);return [w.pos[0]+se[0]-P[0],w.pos[1]+se[1]-P[1],w.pos[2]+se[2]-P[2]]},te=st(z.n,w.rot),oe=M.pos.length/3,[de,Le,we,Qe]=g(q),[et,tt]=w.flip?[we,de]:[de,we];if(i>0){let[Z,ae,he,se]=g(q,.5);So(M,w,U,z,P,i,X,w.flip?[he,ae,Z,se]:[Z,ae,he,se]);return}let ve=[[0,0,et,Le],[1,0,tt,Le],[1,1,tt,Qe],[0,1,et,Qe]];for(let[Z,ae,he,se]of ve)M.pos.push(...J(Z,ae)),M.nrm.push(...te),M.uv.push(he,se);M.idx.push(oe,oe+2,oe+1,oe,oe+3,oe+2);};for(let{f:Y,cell:q}of A){let z=[M.pos.length,M.nrm.length,M.uv.length,M.idx.length];W(Y,q),D.length&&Ao(M.pos,z[0],P,D,i)&&(M.pos.length=z[0],M.nrm.length=z[1],M.uv.length=z[2],M.idx.length=z[3]);}}let v=r.map(w=>{let A=f.get(w.name);return {name:w.name,role:w.role,parent:w.parent,pivot:w.pivot,positions:Float32Array.from(A.pos),normals:Float32Array.from(A.nrm),uvs:Float32Array.from(A.uv),indices:Uint16Array.from(A.idx)}}),I=null;if(m&&p.length){let A=e.parts.filter(P=>P.bone===m.bone).sort((P,U)=>U.size[0]*U.size[1]*U.size[2]-P.size[0]*P.size[1]*P.size[2])[0],M=r.find(P=>P.name===m.bone);if(A&&M){let[P,U,D,X]=m.rect,W=A.pos[0]+A.size[0]/2-P,Y=A.pos[1]+A.size[1]/2-U,q=A.pos[2]-A.size[2]/2-.05,z=M.pivot,J=(oe,de)=>[oe-z[0],de-z[1],q-z[2]],te={};for(let[oe,de]of p)te[oe]=g(de);I={bone:m.bone,corners:Float32Array.from([...J(W,Y),...J(W-D,Y),...J(W-D,Y-X),...J(W,Y-X)]),uv:te};}}let C=t.sockets.filter(w=>o(w.bone)).map(w=>{let A=t.bones.find(M=>M.name===w.bone);return {name:w.name,bone:w.bone,at:[w.at[0]-A.pivot[0],w.at[1]-A.pivot[1],w.at[2]-A.pivot[2]]}}),L=Math.max(1,S),G=L>t.height.max?t.height.max/L:L<t.height.min?t.height.min/L:1;return {hash:ze(e),rig:e.rig,bones:v,atlas:{w:x,h:b,data:T},face:I,sockets:C,height:L,scale:e.scale*G,eye:t.eye*L/ko(e.rig)}}var Rr=3,xo=2.5,wo=1,wr=0,vo=2,Ro=4.1;function So(e,t,r,o,n,a,i,c){let s=Math.min(r[0],r[1],r[2]),l=Math.min(s,a*Rr),h=Math.min(s,l*xo),m=[r[0]-l,r[1]-l,r[2]-l],p=[r[0]-h,r[1]-h,r[2]-h],y=S=>Math.abs(S[0])*t.size[0]+Math.abs(S[1])*t.size[1]+Math.abs(S[2])*t.size[2],x=S=>{let v=[];for(let C=0;C<=i;C++)v.push(Math.min(.5,l*C/i/S));for(let C=1;C<=wr;C++)v.push(Math.min(.5,(l+(h-l)*C/wr)/S));let I=[...v,...v.map(C=>1-C)].sort((C,L)=>C-L);return I.filter((C,L)=>L===0||C-I[L-1]>1e-6)},b=x(y(o.u)),T=x(y(o.d)),k=e.pos.length/3,[g,f,E,d]=c;for(let S of T)for(let v of b){let I=[0,0,0],C=[0,0,0],L=[0,0,0];for(let D=0;D<3;D++){let X=r[D]*(o.tl[D]+2*(o.u[D]*v+o.d[D]*S)),W=Math.max(-m[D],Math.min(m[D],X));C[D]=X-W,I[D]=W,L[D]=X-Math.max(-p[D],Math.min(p[D],X));}let G=Math.hypot(C[0],C[1],C[2]),w=G>1e-9?[C[0]/G,C[1]/G,C[2]/G]:[o.n[0],o.n[1],o.n[2]],A=Math.hypot(L[0],L[1],L[2]),M=A>1e-9?[L[0]/A,L[1]/A,L[2]/A]:w,P=[I[0]+w[0]*l,I[1]+w[1]*l,I[2]+w[2]*l],U=st(P,t.rot);e.pos.push(t.pos[0]+U[0]-n[0],t.pos[1]+U[1]-n[1],t.pos[2]+U[2]-n[2]),e.nrm.push(...st(M,t.rot)),e.uv.push(g+(E-g)*v,f+(d-f)*S);}let R=b.length;for(let S=0;S+1<T.length;S++)for(let v=0;v+1<R;v++){let I=k+S*R+v;e.idx.push(I,I+R+1,I+1,I,I+R,I+R+1);}}function Eo(e,t){if(!t)return e;let[r,o,n]=e,[a,i,c]=[-t[0]*Fe,-t[1]*Fe,-t[2]*Fe],s=Math.cos(a),l=Math.sin(a);return [o,n]=[o*s-n*l,o*l+n*s],s=Math.cos(i),l=Math.sin(i),[r,n]=[r*s+n*l,-r*l+n*s],s=Math.cos(c),l=Math.sin(c),[r,o]=[r*s-o*l,r*l+o*s],[r,o,n]}function Ao(e,t,r,o,n){for(let i of o){let c=[i.size[0]/2,i.size[1]/2,i.size[2]/2],s=n>0?Math.min(c[0],c[1],c[2],n*Rr):0,l=true;for(let h=t;h<e.length&&l;h+=3){let m=Eo([e[h]+r[0]-i.pos[0],e[h+1]+r[1]-i.pos[1],e[h+2]+r[2]-i.pos[2]],i.rot),p=Math.abs(m[0])-(c[0]-s),y=Math.abs(m[1])-(c[1]-s),x=Math.abs(m[2])-(c[2]-s);Math.hypot(Math.max(p,0),Math.max(y,0),Math.max(x,0))+Math.min(Math.max(p,y,x),0)-s>=-0.01&&(l=false);}if(l)return true}return false}function ko(e){let t=1;for(let r of ie[e].defaultParts)t=Math.max(t,r.pos[1]+r.size[1]/2);return t}var _t=new Map;function To(e){let t=new Map;for(let c of e.bones){if(!c.indices.length){t.set(c.name,null);continue}let s=new ___namespace.BufferGeometry;s.setAttribute("position",new ___namespace.BufferAttribute(c.positions,3)),s.setAttribute("normal",new ___namespace.BufferAttribute(c.normals,3)),s.setAttribute("uv",new ___namespace.BufferAttribute(c.uvs,2)),s.setIndex(new ___namespace.BufferAttribute(c.indices,1)),s.computeBoundingSphere(),s.userData.shared=true,t.set(c.name,s);}let r=Co(e),{w:o,h:n,data:a}=e.atlas,i=new ___namespace.DataTexture(a,o,n,___namespace.RGBAFormat);return i.magFilter=___namespace.NearestFilter,i.minFilter=___namespace.NearestFilter,i.generateMipmaps=false,i.colorSpace=___namespace.SRGBColorSpace,i.needsUpdate=true,{layout:e,geometries:t,skinned:r,texture:i,refs:0}}function Co(e){let t=0,r=0;for(let p of e.bones)t+=p.positions.length/3,r+=p.indices.length;if(!r)return null;let o=new Float32Array(t*3),n=new Float32Array(t*3),a=new Float32Array(t*2),i=new Uint16Array(t*4),c=new Float32Array(t*4),s=t>65535?new Uint32Array(r):new Uint16Array(r),l=0,h=0;e.bones.forEach((p,y)=>{let x=p.positions.length/3;for(let b=0;b<x;b++)o[(l+b)*3]=p.positions[b*3]+p.pivot[0],o[(l+b)*3+1]=p.positions[b*3+1]+p.pivot[1],o[(l+b)*3+2]=p.positions[b*3+2]+p.pivot[2],i[(l+b)*4]=y,c[(l+b)*4]=1;n.set(p.normals,l*3),a.set(p.uvs,l*2);for(let b=0;b<p.indices.length;b++)s[h+b]=p.indices[b]+l;l+=x,h+=p.indices.length;});let m=new ___namespace.BufferGeometry;return m.setAttribute("position",new ___namespace.BufferAttribute(o,3)),m.setAttribute("normal",new ___namespace.BufferAttribute(n,3)),m.setAttribute("uv",new ___namespace.BufferAttribute(a,2)),m.setAttribute("skinIndex",new ___namespace.Uint16BufferAttribute(i,4)),m.setAttribute("skinWeight",new ___namespace.BufferAttribute(c,4)),m.setIndex(new ___namespace.BufferAttribute(s,1)),m.computeBoundingSphere(),m.userData.shared=true,m}function zt(e){let t=_t.get(ze(e));return t||(t=To(vr(e)),_t.set(t.layout.hash,t)),t.refs++,t}function it(e){if(!(--e.refs>0)){_t.delete(e.layout.hash);for(let t of e.geometries.values())t?.dispose();e.skinned?.dispose(),e.texture.dispose();}}var O=class e{constructor(t,r,o="."){this.w=t;this.h=r;this.g=Array.from({length:r},()=>new Array(t).fill(o));}w;h;g;px(t,r,o){return t>=0&&r>=0&&t<this.w&&r<this.h&&(this.g[r][t]=o),this}rect(t,r,o,n,a){for(let i=r;i<r+n;i++)for(let c=t;c<t+o;c++)this.px(c,i,a);return this}row(t,r,o,n){return this.rect(r,t,o-r+1,1,n)}col(t,r,o,n){return this.rect(t,r,1,o-r+1,n)}where(t,r){for(let o=0;o<this.h;o++)for(let n=0;n<this.w;n++)t(n,o)&&this.px(n,o,r);return this}flipped(){let t=new e(this.w,this.h);for(let r=0;r<this.h;r++)for(let o=0;o<this.w;o++)t.px(this.w-1-o,r,this.g[r][o]);return t}tex(){return {w:this.w,h:this.h,rows:this.g.map(t=>t.join(""))}}};var Mo={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 me(e,t){let r=parseInt(e.slice(1),16);return "#"+[r>>16&255,r>>8&255,r&255].map(n=>Math.max(0,Math.min(255,Math.round(n*t)))).map(n=>n.toString(16).padStart(2,"0")).join("")}function Nt(e,t){let r={...e};return t.skin&&(r.s=t.skin,r.S=me(t.skin,.86),r.m=me(t.skin,.66)),t.hair&&(r.h=t.hair,r.H=me(t.hair,1.25),r.k=me(t.hair,.6)),t.shirt&&(r.t=t.shirt,r.T=me(t.shirt,1.15),r.D=me(t.shirt,.8)),t.pants&&(r.p=t.pants,r.P=me(t.pants,.8)),t.boots&&(r.z=t.boots,r.Z=me(t.boots,.78)),t.eyes&&(r.b=t.eyes),r}var Io=new O(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"),Sr=new O(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"),Po=Sr.flipped(),Lo=new O(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"),Oo=new O(16,16,"h").where((e,t)=>(e+2*t)%5===0,"H").where((e,t)=>(3*e+t)%9===0,"k"),_o=new O(18,4,"h").where((e,t)=>(e*7+t*3)%5===0,"H").where((e,t)=>t===3&&e*5%3===0,"k"),zo=new O(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"),Fo=new O(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"),No=new O(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"),Ho=new O(16,2,"B").rect(7,0,2,2,"g").px(3,0,"k").px(12,0,"k"),Do=new O(6,24,"s").row(23,0,5,"S").col(2,21,23,"S"),Bo=new O(8,13,"t").col(0,0,9,"D").row(9,0,7,"D").rect(0,10,8,3,"T").row(12,0,7,"D"),Vo=new O(8,24,"p").col(4,1,21,"P").row(0,0,7,"P"),jo=new O(8,24,"p").col(3,0,21,"P").row(0,0,7,"P"),Go=new O(8,24,"p").col(3,0,21,"P"),Uo=new O(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"),Yo=new O(10,9,"z").row(0,0,9,"Z").rect(0,7,10,2,"Z").col(5,1,6,"Z");function ce(e){let t=new O(16,10,"."),r=(n,a,i)=>{if(e.brows==="flat")t.row(1,n,n+2,"k");else if(e.brows==="high")t.row(0,n,n+2,"k");else {let c=e.brows==="down"?1:0,s=1-c;t.px(a,c,"k").px(n+1,e.brows==="down"?0:1,"k"),t.px(i,s,"k");}};r(3,5,3),r(10,10,12);let o=n=>{if(e.eyes===0){t.row(3,n,n+2,"k");return}let a=e.eyes===3||e.eyes===2?2:3;for(let i=a;i<a+e.eyes;i++)t.px(n,i,"w").px(n+1,i,"b").px(n+2,i,"w");};switch(o(3),o(10),e.mouth){case "line":t.row(7,6,9,"m");break;case "smile":t.px(5,6,"m").px(10,6,"m").row(7,6,9,"m");break;case "frown":t.row(7,6,9,"m").px(5,8,"m").px(10,8,"m");break;case "open":t.rect(6,7,4,2,"o");break;case "small":t.rect(7,7,2,2,"o");break;case "wide":t.row(7,5,10,"m").rect(6,8,4,1,"o");break}return t}var Er={f_neutral:ce({brows:"flat",eyes:2,mouth:"line"}),f_blink:ce({brows:"flat",eyes:0,mouth:"line"}),f_happy:ce({brows:"high",eyes:2,mouth:"smile"}),f_sad:ce({brows:"up",eyes:2,mouth:"frown"}),f_angry:ce({brows:"down",eyes:1,mouth:"wide"}),f_surprised:ce({brows:"high",eyes:3,mouth:"small"}),f_scared:ce({brows:"up",eyes:3,mouth:"open"}),f_tired:ce({brows:"flat",eyes:1,mouth:"line"}),f_hurt:ce({brows:"down",eyes:0,mouth:"open"}),f_talk:ce({brows:"flat",eyes:2,mouth:"open"})},$o=new O(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"),qo=new O(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"),Wo=new O(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"),Ko=new O(8,9,"t").row(3,0,7,"D").rect(0,7,8,2,"T"),lt=(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"),Xo=lt(new O(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"),Jo=lt(new O(16,24,"t"),6).row(0,4,11,"T").where((e,t)=>t>=18&&t<=19,"D").rect(0,20,16,4,"p"),Zo=lt(new O(8,24,"t"),6).where((e,t)=>t>=18&&t<=19,"D").rect(0,20,8,4,"p"),Qo=lt(new O(8,22,"t"),9).where((e,t)=>t>=19&&e%2===0,"D"),Ar=e=>new O(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"),en=Ar(4),tn=Ar(3),rn=new O(9,5,"z").row(1,3,5,"l").rect(0,3,9,2,"l"),on=new O(10,5,"z").row(1,3,6,"Z").rect(0,3,10,2,"l"),nn=new O(17,6,"a").rect(0,4,17,2,"A"),an=new O(22,22,"a").where((e,t)=>(e*3+t*5)%11===0,"A"),sn=new O(17,20,"h").where((e,t)=>(e*5+t)%4===0,"H").where((e,t)=>t>10&&(e*3+t*2)%7===0,"k"),H=e=>e.tex(),kr=["shirt","tee","sweater"],Tr=["pants","shorts"],Cr=["boots","sneakers"],Us=["short","long","curly","none"],Se=(e,t={})=>({front:e,back:e,left:e,right:e,...t});function Ht(e={}){let t=e.top??"shirt",r=e.bottom??"pants",o=e.shoes??"boots",n=e.hair??"short",a=Nt(Mo,e.colors??{});a={...a,a:e.colors?.hat??"#d9c9a3"},a.A=me(a.a,.72);let i={head_front:H(Io),head_left:H(Sr),head_right:H(Po),head_back:H(Lo),hair_top:H(Oo),hair_band:H(_o),arm_skin:H(Do),...Object.fromEntries(Object.entries(Er).map(([x,b])=>[x,H(b)]))},c=[{name:"head",bone:"head",size:[8,8,8],pos:[0,28,0],color:"s",faces:{front:"head_front",left:"head_left",right:"head_right",back:"head_back",top:"hair_top"}},{name:"nose",bone:"head",size:[1,1.5,.8],pos:[0,26.9,-4.4],color:"S",faces:{front:"s"}}];if(n!=="none"){if(e.hat||c.push({name:"hair",bone:"head",size:n==="curly"?[9,2.2,9]:[8.6,1.6,8.6],pos:[0,n==="curly"?32.5:32.2,.15],color:"h",faces:Se("hair_band",{top:"hair_top"})}),n==="curly"&&!e.hat)for(let[x,b]of [[-2,-1.5],[2,.5],[-0.5,2.5]])c.push({name:"curl",bone:"head",size:[3.2,1.4,3.2],pos:[x,33.9,b],color:"h",faces:Se("hair_band",{top:"hair_top"})});n==="long"?(i.hair_long=H(sn),c.push({name:"hairLong",bone:"head",size:[8.8,10,1],pos:[0,27,4.4],color:"h",faces:Se("hair_long",{top:"hair_top"})},{name:"hairSide",bone:"head",size:[.8,9,6],pos:[-4.4,27.5,1],color:"h",faces:Se("hair_long",{top:"hair_top"}),mirror:true})):c.push({name:"hairBack",bone:"head",size:[8.6,5,.8],pos:[0,29.6,4.25],color:"h",faces:{back:"head_back",left:"hair_band",right:"hair_band"}});}e.hat&&(i.hat_crown=H(nn),i.hat_brim=H(an),c.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:Se("hat_crown")}));let s={shirt:[zo,Fo,No],tee:[$o,qo,Wo],sweater:[Xo,Jo,Zo]},[l,h,m]=s[t];i.top_front=H(l),i.top_back=H(h),i.top_side=H(m),c.push({name:"torso",bone:"body",size:[8,12,4],pos:[0,18,0],color:"t",faces:{front:"top_front",back:"top_back",left:"top_side",right:"top_side",bottom:"p"}}),t==="shirt"&&(i.belt=H(Ho),c.push({name:"belt",bone:"body",size:[8.4,1,4.4],pos:[0,13.5,0],color:"B",faces:{front:"belt",back:"belt"}})),c.push({name:"arm",bone:"armL",size:[3,12,3],pos:[-5.5,18,0],color:"s",faces:Se("arm_skin",{top:"t",bottom:"S"}),mirror:true});let p=t==="sweater"?11:t==="tee"?4.5:6.5;i.sleeve=H(t==="sweater"?Qo:t==="tee"?Ko:Bo),c.push({name:"sleeve",bone:"armL",size:[3.6,p,3.6],pos:[-5.5,24-p/2,0],color:"t",faces:Se("sleeve",{bottom:"D"}),mirror:true}),r==="shorts"?(i.leg_front=H(en),i.leg_side=H(tn)):(i.leg_front=H(Vo),i.leg_back=H(jo),i.leg_side=H(Go)),c.push({name:"leg",bone:"legL",size:[4,12,4],pos:[-2,6,0],color:"p",faces:{front:"leg_front",back:r==="shorts"?"leg_front":"leg_back",left:"leg_side",right:"leg_side"},mirror:true}),o==="boots"?(i.shoe_front=H(Uo),i.shoe_side=H(Yo)):(i.shoe_front=H(rn),i.shoe_side=H(on));let y=o==="boots"?4.5:2.5;return c.push({name:"shoe",bone:"legL",size:[4.6,y,5.2],pos:[-2,y/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??B({en:"Traveler",ru:"\u041F\u0443\u0442\u043D\u0438\u043A"}),description:e.description??B({en:"A traveler in a shirt with pockets, trousers and laced boots",ru:"\u041F\u0443\u0442\u043D\u0438\u043A \u0432 \u0440\u0443\u0431\u0430\u0448\u043A\u0435 \u0441 \u043A\u0430\u0440\u043C\u0430\u043D\u0430\u043C\u0438, \u0431\u0440\u044E\u043A\u0430\u0445 \u0438 \u0448\u043D\u0443\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0445 \u0431\u043E\u0442\u0438\u043D\u043A\u0430\u0445"}),rig:"humanoid",palette:a,textures:i,parts:c,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 ct(e,t){return {textures:Object.fromEntries(Object.entries(Er).map(([r,o])=>[r,H(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 Dt=Ht(),Ft=null;function Ee(){if(!Ft){let e=le(Dt);if(!e.ok)throw new Error(e.error);Ft=e.spec;}return Ft}function Mr(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 ___namespace.CanvasTexture(t),n=new ___namespace.Sprite(new ___namespace.SpriteMaterial({map:o,depthTest:false,transparent:true}));return n.scale.set(1.6,.3,1),n.renderOrder=10,n}function Bt(e){e.removeFromParent(),e.material.map?.dispose(),e.material.dispose();}var j={rx:0,ry:1,rz:2,px:3,py:4,pz:5,sx:6,sy:7,sz:8},qs=Object.keys(j),He=[0,0,0,0,0,0,1,1,1];function De(e,t){let r=e.get(t);return r||(r=Float64Array.from(He),e.set(t,r)),r}function pe(e,t,r,o){let n=De(e,t),a=j[r];a>=6?n[a]=n[a]*o:n[a]=n[a]+o;}function u(e,t,r,o){De(e,t)[j[r]]=o;}function Ae(e){for(let t of e.values())t.set(He);}function Ir(e,t,r,o){let n=new Set([...t.keys(),...r.keys()]);for(let a of n){let i=t.get(a)??He,c=r.get(a)??He,s=De(e,a);for(let l=0;l<9;l++)s[l]=i[l]+(c[l]-i[l])*o;}}function pt(e,t){Ae(e);for(let[r,o]of t)De(e,r).set(o);}var Ws=["none","block","tool","sword","bow","shield","food","staff","item"];function ht(){return {speed:0,vy:0,onGround:true,inWater:false,flying:false,gliding:false,sneaking:false,sprinting:false,riding:false,sitting:false,sleeping:false,dead:false,lookYaw:0,lookPitch:0,yawRate:0,held:"none",use:null,talk:false}}var Ks=["swing","hurt","place","land","jump","throw"];var Ge=1/16,cn=.68,Pr=.85,pn=1.2,hn=1.03,mn=1.1,dn=.12,fn=.1,un=.1;function Or(e){let t=r=>r.toFixed(4);e.fragmentShader=e.fragmentShader.replace("#include <tonemapping_fragment>",`{
|
|
1
|
+
'use strict';var V=require('three'),BufferGeometryUtils_js=require('three/examples/jsm/utils/BufferGeometryUtils.js'),RoomEnvironment_js=require('three/examples/jsm/environments/RoomEnvironment.js');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var V__namespace=/*#__PURE__*/_interopNamespace(V);function fr(e){let t=e>>>0;return function(){t|=0,t=t+1831565813|0;let r=Math.imul(t^t>>>15,1|t);return r=r+Math.imul(r^r>>>7,61|r)^r,((r^r>>>14)>>>0)/4294967296}}function lt(e){let t=2166136261;for(let r=0;r<e.length;r++)t^=e.charCodeAt(r),t=Math.imul(t,16777619);return t>>>0}var sn="en";function Z(e,t){let r=typeof e=="string"?e:e[sn]??e.en;if(t)for(let[a,o]of Object.entries(t))r=r.split(`{${a}}`).join(String(o));return r}function Ma(e){let t=e.trim(),r=/```(?:json)?\s*([\s\S]*?)(?:```|$)/i.exec(t);r&&r[1]!==void 0&&(t=r[1]);let a=t.indexOf("{");if(a<0)return {ok:false,error:Z({en:"the answer has no JSON object",ru:"\u0432 \u043E\u0442\u0432\u0435\u0442\u0435 \u043D\u0435\u0442 JSON-\u043E\u0431\u044A\u0435\u043A\u0442\u0430"}),truncated:false};let o=0,n=false,s=false,l=-1;for(let i=a;i<t.length;i++){let c=t[i];if(n){s?s=false:c==="\\"?s=true:c==='"'&&(n=false);continue}if(c==='"')n=true;else if(c==="{"||c==="[")o++;else if((c==="}"||c==="]")&&(o--,o===0)){l=i;break}}if(l<0)return {ok:false,error:Z({en:"the JSON is cut off",ru:"JSON \u043E\u0431\u043E\u0440\u0432\u0430\u043D"}),truncated:true};try{return {ok:!0,value:JSON.parse(t.slice(a,l+1))}}catch{return {ok:false,error:Z({en:"invalid JSON",ru:"\u043D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u044B\u0439 JSON"}),truncated:false}}}var Ca={id:"avatar",label:"\u0410\u0432\u0430\u0442\u0430\u0440",hint:"the iDos Games account avatar: soft blocks with elbows and knees",bones:[{name:"body",role:"body",parent:null,pivot:[0,12.4,0]},{name:"head",role:"head",parent:"body",pivot:[0,22.4,0]},{name:"armL",role:"armL",parent:"body",pivot:[-6.3,21.4,0]},{name:"armR",role:"armR",parent:"body",pivot:[6.3,21.4,0]},{name:"foreArmL",role:"foreArmL",parent:"armL",pivot:[-6.3,17.2,0]},{name:"foreArmR",role:"foreArmR",parent:"armR",pivot:[6.3,17.2,0]},{name:"legL",role:"legL",parent:null,pivot:[-2.1,12.4,0]},{name:"legR",role:"legR",parent:null,pivot:[2.1,12.4,0]},{name:"shinL",role:"shinL",parent:"legL",pivot:[-2.1,6.4,0]},{name:"shinR",role:"shinR",parent:"legR",pivot:[2.1,6.4,0]}],sockets:[{name:"handR",bone:"foreArmR",at:[6.3,11.6,-1]},{name:"handL",bone:"foreArmL",at:[-6.3,11.6,-1]},{name:"headTop",bone:"head",at:[0,30.3,0]},{name:"face",bone:"head",at:[0,26.7,-4]},{name:"back",bone:"body",at:[0,18.5,2.3]},{name:"waist",bone:"body",at:[0,12.8,0]},{name:"shoulders",bone:"body",at:[0,22.4,0]}],hitbox:{w:.6,h:1.9},eye:26.4,height:{min:24,max:40},faceBone:"head",defaultParts:[{bone:"head",size:[8.5,7.5,8],pos:[0,26.5,0],color:"s",name:"head"},{bone:"head",size:[2.9,.8,2.7],pos:[0,22.6,0],color:"s",name:"neck"},{bone:"body",size:[9,6,4.6],pos:[0,19.4,0],color:"t",name:"torso"},{bone:"body",size:[8.5,5.2,4.3],pos:[0,15,0],color:"t",name:"torso"},{bone:"armL",size:[3.6,5,3.6],pos:[-6.3,19.7,0],color:"s",name:"sleeveL"},{bone:"armR",size:[3.6,5,3.6],pos:[6.3,19.7,0],color:"s",name:"sleeveR"},{bone:"foreArmL",size:[3.45,5.4,3.45],pos:[-6.3,15.7,0],color:"s",name:"forearmL"},{bone:"foreArmR",size:[3.45,5.4,3.45],pos:[6.3,15.7,0],color:"s",name:"forearmR"},{bone:"foreArmL",size:[3.3,3,3.3],pos:[-6.3,12.7,0],color:"s",name:"handL"},{bone:"foreArmR",size:[3.3,3,3.3],pos:[6.3,12.7,0],color:"s",name:"handR"},{bone:"legL",size:[4.2,6,4.2],pos:[-2.1,9.4,0],color:"p",name:"legL"},{bone:"legR",size:[4.2,6,4.2],pos:[2.1,9.4,0],color:"p",name:"legR"},{bone:"shinL",size:[4.05,7.2,4.05],pos:[-2.1,4,0],color:"p",name:"legL"},{bone:"shinR",size:[4.05,7.2,4.05],pos:[2.1,4,0],color:"p",name:"legR"},{bone:"shinL",size:[4.2,1.6,5.2],pos:[-2.1,.8,-0.5],color:"p",name:"footL"},{bone:"shinR",size:[4.2,1.6,5.2],pos:[2.1,.8,-0.5],color:"p",name:"footR"}]};var za={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 Pa={id:"flyer",label:"\u041A\u0440\u044B\u043B\u0430\u0442\u044B\u0439",hint:"birds, bats, dragons, fairies, insects \u2014 creatures whose wings matter",bones:[{name:"body",role:"body",parent:null,pivot:[0,6,0]},{name:"head",role:"head",parent:"body",pivot:[0,11,-3]},{name:"wingL",role:"wingL",parent:"body",pivot:[-3,10,0]},{name:"wingR",role:"wingR",parent:"body",pivot:[3,10,0]},{name:"legL",role:"legL",parent:null,pivot:[-1.5,4,0]},{name:"legR",role:"legR",parent:null,pivot:[1.5,4,0]},{name:"tail",role:"tail",parent:"body",pivot:[0,8,4]}],sockets:[{name:"headTop",bone:"head",at:[0,16,-4]},{name:"face",bone:"head",at:[0,13,-7]},{name:"back",bone:"body",at:[0,11,1]},{name:"waist",bone:"body",at:[0,6,0]},{name:"shoulders",bone:"body",at:[0,10,-2]},{name:"handR",bone:"legR",at:[1.5,0,-1]},{name:"handL",bone:"legL",at:[-1.5,0,-1]}],hitbox:{w:.6,h:.9},eye:14,height:{min:6,max:40},faceBone:"head",defaultParts:[{bone:"body",size:[6,6,8],pos:[0,8,0],color:"t"},{bone:"head",size:[5,5,5],pos:[0,13,-4],color:"s"},{bone:"wingL",size:[8,1,6],pos:[-7,10,0],color:"t"},{bone:"wingR",size:[8,1,6],pos:[7,10,0],color:"t"},{bone:"legL",size:[1,4,1],pos:[-1.5,2,0],color:"p"},{bone:"legR",size:[1,4,1],pos:[1.5,2,0],color:"p"},{bone:"tail",size:[4,1,4],pos:[0,8,6],color:"t"}]};var Ia={id:"humanoid",label:"\u0427\u0435\u043B\u043E\u0432\u0435\u043A",hint:"people, humanoids, robots, elves, zombies \u2014 anything on two legs with two arms",bones:[{name:"body",role:"body",parent:null,pivot:[0,12,0]},{name:"head",role:"head",parent:"body",pivot:[0,24,0]},{name:"armL",role:"armL",parent:"body",pivot:[-6,22,0]},{name:"armR",role:"armR",parent:"body",pivot:[6,22,0]},{name:"legL",role:"legL",parent:null,pivot:[-2,12,0]},{name:"legR",role:"legR",parent:null,pivot:[2,12,0]}],sockets:[{name:"handR",bone:"armR",at:[6,11,-1]},{name:"handL",bone:"armL",at:[-6,11,-1]},{name:"headTop",bone:"head",at:[0,32,0]},{name:"face",bone:"head",at:[0,28,-4]},{name:"back",bone:"body",at:[0,18,2]},{name:"waist",bone:"body",at:[0,12,0]},{name:"shoulders",bone:"body",at:[0,24,0]}],hitbox:{w:.6,h:1.8},eye:27,height:{min:16,max:48},faceBone:"head",defaultParts:[{bone:"head",size:[8,8,8],pos:[0,28,0],color:"s"},{bone:"body",size:[8,12,4],pos:[0,18,0],color:"t"},{bone:"armL",size:[4,12,4],pos:[-6,18,0],color:"s"},{bone:"armR",size:[4,12,4],pos:[6,18,0],color:"s"},{bone:"legL",size:[4,12,4],pos:[-2,6,0],color:"p"},{bone:"legR",size:[4,12,4],pos:[2,6,0],color:"p"}]};var _a={id:"quadruped",label:"\u0427\u0435\u0442\u0432\u0435\u0440\u043E\u043D\u043E\u0433\u043E\u0435",hint:"dogs, cats, horses, wolves, bears, lizards \u2014 any animal on four legs",bones:[{name:"body",role:"body",parent:null,pivot:[0,12,0]},{name:"head",role:"head",parent:"body",pivot:[0,14,-8]},{name:"legFL",role:"legFL",parent:null,pivot:[-3,8,-6]},{name:"legFR",role:"legFR",parent:null,pivot:[3,8,-6]},{name:"legBL",role:"legBL",parent:null,pivot:[-3,8,6]},{name:"legBR",role:"legBR",parent:null,pivot:[3,8,6]},{name:"tail",role:"tail",parent:"body",pivot:[0,14,8]}],sockets:[{name:"headTop",bone:"head",at:[0,20,-12]},{name:"face",bone:"head",at:[0,16,-16]},{name:"back",bone:"body",at:[0,16,0]},{name:"waist",bone:"body",at:[0,12,4]},{name:"shoulders",bone:"body",at:[0,16,-6]},{name:"handR",bone:"head",at:[2,13,-16]},{name:"handL",bone:"head",at:[-2,13,-16]}],hitbox:{w:.9,h:1},eye:17,height:{min:8,max:40},faceBone:"head",defaultParts:[{bone:"body",size:[8,8,16],pos:[0,12,0],color:"t"},{bone:"head",size:[8,8,8],pos:[0,16,-12],color:"s"},{bone:"legFL",size:[3,8,3],pos:[-3,4,-6],color:"p"},{bone:"legFR",size:[3,8,3],pos:[3,4,-6],color:"p"},{bone:"legBL",size:[3,8,3],pos:[-3,4,6],color:"p"},{bone:"legBR",size:[3,8,3],pos:[3,4,6],color:"p"},{bone:"tail",size:[2,2,8],pos:[0,14,12],color:"t"}]};var Oa={id:"swimmer",label:"\u041F\u043B\u043E\u0432\u0435\u0446",hint:"fish, sharks, dolphins, whales \u2014 creatures that swim with a tail",bones:[{name:"body",role:"body",parent:null,pivot:[0,6,0]},{name:"head",role:"head",parent:"body",pivot:[0,6,-4]},{name:"tail",role:"tail",parent:"body",pivot:[0,6,4]},{name:"finL",role:"ear",parent:"body",pivot:[-3,5,-1]},{name:"finR",role:"ear",parent:"body",pivot:[3,5,-1]}],sockets:[{name:"headTop",bone:"head",at:[0,10,-6]},{name:"face",bone:"head",at:[0,7,-9]},{name:"back",bone:"body",at:[0,10,0]},{name:"waist",bone:"body",at:[0,6,0]},{name:"shoulders",bone:"body",at:[0,9,-3]},{name:"handR",bone:"head",at:[1,4,-9]},{name:"handL",bone:"head",at:[-1,4,-9]}],hitbox:{w:.7,h:.6},eye:8,height:{min:4,max:40},faceBone:"head",defaultParts:[{bone:"body",size:[5,7,9],pos:[0,6,0],color:"t"},{bone:"head",size:[5,6,4],pos:[0,6,-6.5],color:"s"},{bone:"tail",size:[1,6,4],pos:[0,6,7],color:"t"},{bone:"finL",size:[3,.6,2],pos:[-4,5,-1],color:"p"},{bone:"finR",size:[3,.6,2],pos:[4,5,-1],color:"p"}]};var q0=["root","body","head","armL","armR","legL","legR","foreArmL","foreArmR","shinL","shinR","legFL","legFR","legBL","legBR","tail","wingL","wingR","ear","hair","cape","antenna","static"],br=["tail","wingL","wingR","ear","hair","cape","antenna","static"],Y0=["handR","handL","headTop","face","back","waist","shoulders"],Ht=["humanoid","quadruped","flyer","blob","swimmer"],kt="avatar";var Ie={humanoid:Ia,quadruped:_a,flyer:Pa,blob:za,swimmer:Oa,avatar:Ca};var Fa=1,Ke=["front","back","left","right","top","bottom"],Gt=["neutral","blink","happy","sad","angry","surprised","scared","tired","hurt","talk"],Ut=["normal","bouncy","heavy","sneaky","robotic","swagger","skip","ninja","zombie","catwalk"],qt=["calm","fidgety","proud","cool","shy","ready","bored"],Ba={parts:96,bones:16,palette:32,textures:48,texturePixels:32768,textureSide:32,partSide:32,coord:64},St=["glass","metal","glow"],sl=["cylinder"],At={noise:.5,outline:.4,shade:.25,density:2},$=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),jt=e=>Array.isArray(e)?e:[];function Ae(e,t,r,a){let o=typeof e=="number"?e:typeof e=="string"?Number(e):NaN;return Number.isFinite(o)?Math.min(a,Math.max(r,o)):t}function jr(e,t,r){if(typeof e!="string")return r;let a=e.trim();if(t.includes(a))return a;let o=a.toLowerCase().replace(/[\s-]+/g,"_");return t.find(s=>s.toLowerCase()===o)??r}function _e(e,t,r){return typeof e=="string"?e.trim().slice(0,r):t}function yr(e,t,r=null){if(!Array.isArray(e)||e.length<3)return r;let a=e.slice(0,3).map(o=>Ae(o,NaN,-t,t));return a.every(Number.isFinite)?a:r}var Da={black:"#1d1d21",white:"#f0f0f0",gray:"#808080",grey:"#808080",red:"#c0392b",green:"#3c9a3c",blue:"#2f5fd0",yellow:"#f2d33c",orange:"#e8862a",purple:"#8a4fc4",pink:"#f08cb4",brown:"#7a4f2a",cyan:"#2ab0c0",gold:"#d8b030",silver:"#c0c4c8",skin:"#c69c7c"};function je(e){if(typeof e!="string")return null;let t=e.trim().toLowerCase();if(Da[t])return Da[t];let r=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/.exec(t);if(!r)return null;let a=r[1];return "#"+(a.length===3?a.split("").map(o=>o+o).join(""):a)}var Xe=new Set(["."," "]),Na=e=>/^[A-Za-z0-9_]{1,24}$/.test(e),ln={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 cn(e){if(typeof e!="string")return "humanoid";let t=e.trim().toLowerCase().replace(/[\s-]+/g,"_");return Ht.includes(t)?t:t===kt?kt:ln[t]??"humanoid"}function Va(e,t){let r=/^(.*?)(L|R)$/.exec(e);if(!r)return e;let a=r[1]+(r[2]==="L"?"R":"L");return t(a)?a:e}function Oe(e){if(typeof e=="string"){let y=Ma(e);if(!y.ok)return {ok:false,error:y.error,truncated:y.truncated};e=y.value;}if(!$(e))return {ok:false,error:Z({en:"the character recipe is not an object",ru:"\u0440\u0435\u0446\u0435\u043F\u0442 \u043F\u0435\u0440\u0441\u043E\u043D\u0430\u0436\u0430 \u2014 \u043D\u0435 \u043E\u0431\u044A\u0435\u043A\u0442"})};if(!("parts"in e)&&!("rig"in e)){let y=e.character??e.spec??e.characterSpec;$(y)&&(e=y);}let t=e,r=Ba,a=[];typeof t.version=="number"&&t.version>Fa&&a.push(Z({en:"recipe version {v} is newer than the game \u2014 read what could be read",ru:"\u0440\u0435\u0446\u0435\u043F\u0442 \u0432\u0435\u0440\u0441\u0438\u0438 {v} \u2014 \u043D\u043E\u0432\u0435\u0435 \u0438\u0433\u0440\u044B, \u0440\u0430\u0437\u043E\u0431\u0440\u0430\u043D\u043E \u0447\u0442\u043E \u043F\u043E\u043D\u044F\u0442\u043D\u043E"},{v:t.version}));let o=cn(t.rig),n=Ie[o],s={};if($(t.palette))for(let[y,z]of Object.entries(t.palette)){if(Object.keys(s).length>=r.palette){a.push(Z({en:"the palette is longer than {n} \u2014 the rest was dropped",ru:"\u043F\u0430\u043B\u0438\u0442\u0440\u0430 \u0434\u043B\u0438\u043D\u043D\u0435\u0435 {n} \u2014 \u043B\u0438\u0448\u043D\u0435\u0435 \u043E\u0442\u0431\u0440\u043E\u0448\u0435\u043D\u043E"},{n:r.palette}));break}let C=je(z);if(y.length!==1||Xe.has(y)||!C){a.push(Z({en:"palette colour \xAB{k}\xBB was not understood",ru:"\u0446\u0432\u0435\u0442 \u043F\u0430\u043B\u0438\u0442\u0440\u044B \xAB{k}\xBB \u043D\u0435 \u043F\u043E\u043D\u044F\u0442"},{k:y}));continue}s[y]=C;}let l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",i=(y,z)=>{if(typeof y!="string")return z;if(y.length===1&&s[y])return y;let C=je(y);if(!C)return z;let L=Object.entries(s).find(([,_])=>_===C);if(L)return L[0];if(Object.keys(s).length>=r.palette)return z;let I=[...l].find(_=>!s[_]);return I?(s[I]=C,I):z},c={},m=0;if($(t.textures))for(let[y,z]of Object.entries(t.textures)){if(!Na(y)){a.push(Z({en:"texture name \xAB{id}\xBB does not fit",ru:"\u0438\u043C\u044F \u0442\u0435\u043A\u0441\u0442\u0443\u0440\u044B \xAB{id}\xBB \u043D\u0435 \u043F\u043E\u0434\u0445\u043E\u0434\u0438\u0442"},{id:y.slice(0,30)}));continue}if(Object.keys(c).length>=r.textures){a.push(Z({en:"more than {n} textures \u2014 the rest were dropped",ru:"\u0442\u0435\u043A\u0441\u0442\u0443\u0440 \u0431\u043E\u043B\u044C\u0448\u0435 {n} \u2014 \u043B\u0438\u0448\u043D\u0438\u0435 \u043E\u0442\u0431\u0440\u043E\u0448\u0435\u043D\u044B"},{n:r.textures}));break}let C=dn(z,s,a,y);if(C){if(m+C.w*C.h>r.texturePixels){a.push(Z({en:"texture \xAB{id}\xBB did not fit the pixel limit",ru:"\u0442\u0435\u043A\u0441\u0442\u0443\u0440\u0430 \xAB{id}\xBB \u043D\u0435 \u0432\u043B\u0435\u0437\u043B\u0430 \u0432 \u043B\u0438\u043C\u0438\u0442 \u043F\u0438\u043A\u0441\u0435\u043B\u0435\u0439"},{id:y}));continue}m+=C.w*C.h,c[y]=C;}}let h=new Set(n.bones.map(y=>y.name)),d=[];for(let y of jt(t.bones)){if(!$(y))continue;let z=_e(y.name,"",24);if(!z||!Na(z))continue;let C=yr(y.pivot,r.coord);if(!C||d.some(T=>T.name===z))continue;if(d.length>=r.bones){a.push(Z({en:"more than {n} bones \u2014 the rest were dropped",ru:"\u043A\u043E\u0441\u0442\u0435\u0439 \u0431\u043E\u043B\u044C\u0448\u0435 {n} \u2014 \u043B\u0438\u0448\u043D\u0438\u0435 \u043E\u0442\u0431\u0440\u043E\u0448\u0435\u043D\u044B"},{n:r.bones}));break}let L=h.has(z),I=_e(y.parent,"",24),_=L?n.bones.find(T=>T.name===z).parent??"":h.has(I)||d.some(T=>T.name===I)?I:n.bones.find(T=>T.role==="body").name;d.push({name:z,parent:_,pivot:C,role:L?"static":jr(y.role,br,"static")}),h.add(z);}let p=Object.keys(s)[0]??"s",g=[];for(let y of jt(t.parts)){if(g.length>=r.parts){a.push(Z({en:"more than {n} parts \u2014 the rest were dropped",ru:"\u0434\u0435\u0442\u0430\u043B\u0435\u0439 \u0431\u043E\u043B\u044C\u0448\u0435 {n} \u2014 \u043B\u0438\u0448\u043D\u0438\u0435 \u043E\u0442\u0431\u0440\u043E\u0448\u0435\u043D\u044B"},{n:r.parts}));break}if(!$(y))continue;let z=yr(y.size,r.partSide),C=yr(y.pos??y.center??y.at,r.coord);if(!z||!C||z.some(D=>D<=0))continue;let L=_e(y.bone,"",24);h.has(L)||(L&&a.push(Z({en:"bone \xAB{b}\xBB not found \u2014 the part is on the body",ru:"\u043A\u043E\u0441\u0442\u044C \xAB{b}\xBB \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u0430 \u2014 \u0434\u0435\u0442\u0430\u043B\u044C \u043D\u0430 \u0442\u0435\u043B\u0435"},{b:L})),L=n.bones.find(D=>D.role==="body").name);let I={bone:L,size:z,pos:C,color:i(y.color,p)};if($(y.faces)){let D={};for(let W of Ke){let ee=y.faces[W];if(typeof ee=="string")if(c[ee])D[W]=ee;else {let ve=i(ee,"");ve&&(D[W]=ve);}}Object.keys(D).length&&(I.faces=D);}let _=yr(y.rot??y.rotation,180);_&&_.some(D=>D!==0)&&(I.rot=_),(y.mirror===true||y.mirror==="x")&&(I.mirror=true);let T=_e(y.name,"",24);T&&(I.name=T),y.shape==="cylinder"&&(I.shape="cylinder"),typeof y.mat=="string"&&St.includes(y.mat)&&(I.mat=y.mat),y.wrap===true&&(I.wrap=true),g.push(I);}if(!g.length){for(let[y,z]of Object.entries(mn))s[y]||(s[y]=z);g.push(...n.defaultParts.map(pn));}let b=null;if($(t.face)){let y=t.face,z=h.has(_e(y.bone,"",24))?_e(y.bone,"",24):n.faceBone,C=jt(y.rect).map(I=>Math.round(Ae(I,NaN,0,r.partSide)*10)/10),L={};if($(y.expressions))for(let I of Gt){let _=y.expressions[I];typeof _=="string"&&c[_]&&(L[I]=_);}if(!L.neutral){let I=Object.values(L)[0];I&&(L.neutral=I);}if(L.neutral){let I=c[L.neutral];if(b={bone:z,rect:C.length===4&&C.every(Number.isFinite)&&C[2]>0&&C[3]>0?C:[0,0,I.w,I.h],expressions:L},$(y.drawn)){let _=y.drawn;b.drawn={eyes:_e(_.eyes,"round",16),brows:_e(_.brows,"none",16),mouth:_e(_.mouth,"smile",16),eyeColor:je(_.eyeColor)??"#3b2a20",cheeks:_.cheeks===true};}}else Object.keys(y).length&&a.push(Z({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 E=$(t.style)?t.style:{},v=$(t.voice)?t.voice:{},M=$(t.finish)?t.finish:{},R={version:Fa,name:_e(t.name,gr(),40)||gr(),description:_e(t.description,"",300),rig:o,scale:Ae(t.scale,1,.25,3),palette:s,textures:c,parts:g,bones:d,face:b,style:{walk:jr(E.walk,Ut,"normal"),idle:jr(E.idle,qt,"calm"),energy:Ae(E.energy,.5,0,1)},voice:{pitch:Ae(v.pitch,1,.5,2)},tags:jt(t.tags).filter(y=>typeof y=="string"&&!!y.trim()).slice(0,8).map(y=>y.trim().slice(0,24)),finish:{noise:Ae(M.noise,At.noise,0,1),outline:Ae(M.outline,At.outline,0,1),shade:Ae(M.shade,At.shade,0,1),density:Math.round(Ae(M.density,At.density,1,4))}},A=Ae(M.round,0,0,1);return A>0&&(R.finish.round=A),{ok:true,spec:R,warnings:a}}var mn={s:"#c69c7c",t:"#3a8fd6",p:"#2c3e6b"};function pn(e){return JSON.parse(JSON.stringify(e))}function dn(e,t,r,a){let o=Array.isArray(e)?{rows:e}:$(e)?e:null;if(!o)return null;let n=Ba.textureSide,s=jt(o.rows??o.pixels).filter(m=>typeof m=="string");if(!s.length)return null;let l=Math.round(Ae(o.h??o.height,s.length,1,n)),i=Math.round(Ae(o.w??o.width,Math.max(...s.map(m=>m.length)),1,n)),c=false;for(s=s.slice(0,l).map(m=>{let h="";for(let d=0;d<i;d++){let p=m[d]??".";Xe.has(p)||t[p]?h+=p===" "?".":p:(c=true,h+=".");}return h});s.length<l;)s.push(".".repeat(i));return c&&r.push(Z({en:"texture \xAB{id}\xBB has symbols not in the palette \u2014 they became transparent",ru:"\u0432 \u0442\u0435\u043A\u0441\u0442\u0443\u0440\u0435 \xAB{id}\xBB \u0441\u0438\u043C\u0432\u043E\u043B\u044B \u043D\u0435 \u0438\u0437 \u043F\u0430\u043B\u0438\u0442\u0440\u044B \u2014 \u0441\u0442\u0430\u043B\u0438 \u043F\u0440\u043E\u0437\u0440\u0430\u0447\u043D\u044B\u043C\u0438"},{id:a})),{w:i,h:l,rows:s}}function Gr(e){return Array.isArray(e)?"["+e.map(Gr).join(",")+"]":$(e)?"{"+Object.keys(e).filter(t=>e[t]!==void 0).sort().map(t=>JSON.stringify(t)+":"+Gr(e[t])).join(",")+"}":JSON.stringify(e)}function Et(e){let t=Gr(e),r=lt(t),a=lt("~"+t);return r.toString(16).padStart(8,"0")+a.toString(16).padStart(8,"0")}function il(e){return Ie[e.rig]}function Ha(e){let r=Ie[e.rig].bones.map(a=>{let o=e.bones.find(n=>n.name===a.name);return {name:a.name,role:a.role,parent:a.parent,pivot:(o?.pivot??a.pivot).slice()}});for(let a of e.bones)r.some(o=>o.name===a.name)||r.push({name:a.name,role:a.role,parent:a.parent,pivot:a.pivot.slice()});return r}function gr(){return Z({en:"Character",ru:"\u041F\u0435\u0440\u0441\u043E\u043D\u0430\u0436"})}var ll=e=>e==="\u041F\u0435\u0440\u0441\u043E\u043D\u0430\u0436"||e==="Character";var ja={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 Ur(e){let t=parseInt(e.slice(1),16);return [t>>16&255,t>>8&255,t&255]}function Ga(e,t,r,a,o,n){let s=((r-1-o)*t+a)*4;e[s]=n[0],e[s+1]=n[1],e[s+2]=n[2],e[s+3]=255;}function hn(e,t=0){e.sort((r,a)=>a.h-r.h||a.w-r.w||(r.key<a.key?-1:1));for(let r=16;;r*=2){let a=0,o=0,n=0;for(let l of e)a+l.w+t*2>r&&(a=0,o+=n,n=0),l.x=a+t,l.y=o+t,a+=l.w+t*2,n=Math.max(n,l.h+t*2);let s=o+n;if(s<=r||r>=1024){let l=16;for(;l<s;)l*=2;return {w:r,h:l}}}}function un(e,t,r,a,o){let n=(s,l)=>((r-1-a.y-l)*t+a.x+s)*4;for(let s=-o;s<a.h+o;s++)for(let l=-o;l<a.w+o;l++){let i=Math.max(0,Math.min(a.w-1,l)),c=Math.max(0,Math.min(a.h-1,s));if(i===l&&c===s)continue;let m=n(i,c);e.copyWithin(n(l,s),m,m+4);}}function Ua(e,t,r){let a=Math.imul(t,374761393)+Math.imul(r,668265263)+Math.imul(e,2246822519);return a=Math.imul(a^a>>>13,1274126177),((a^a>>>16)>>>0)/4294967296}function fn(e,t,r,a,o,n,s,l){let c=1+(.55*Ua(s,t,r)+.45*Ua(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)/o):n==="t"?c+=l.shade*.08:c-=l.shade*.2,a>=3&&o>=3&&(t===0||r===0||t===a-1||r===o-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 vt=Math.PI/180;function Tt(e,t){if(!t)return e;let[r,a,o]=e,[n,s,l]=[t[0]*vt,t[1]*vt,t[2]*vt],i=Math.cos(l),c=Math.sin(l);return [r,a]=[r*i-a*c,r*c+a*i],i=Math.cos(s),c=Math.sin(s),[r,o]=[r*i+o*c,-r*c+o*i],i=Math.cos(n),c=Math.sin(n),[a,o]=[a*i-o*c,a*c+o*i],[r,a,o]}function bn(e,t){let r=[];for(let a of e.parts){if(r.push({...a,flip:false}),!a.mirror)continue;let o=a.faces?{...a.faces,left:a.faces.right,right:a.faces.left}:void 0;o&&(o.left===void 0&&delete o.left,o.right===void 0&&delete o.right);let n={...a,bone:Va(a.bone,t),pos:[-a.pos[0],a.pos[1],a.pos[2]],flip:true};o?n.faces=o:delete n.faces,a.rot&&(n.rot=[a.rot[0],-a.rot[1],-a.rot[2]]),r.push(n);}return r}function $a(e){let t=Ie[e.rig],r=Ha(e),a=w=>r.some(P=>P.name===w),o=bn(e,a),n=e.finish??At,s=n.round??0,l=new Map,i=(w,P)=>{let F=w.faces?.[P],B=F!==void 0?e.textures[F]:void 0,ne=F!==void 0&&e.palette[F]?F:w.color,[we,Le]=P==="front"||P==="back"?[w.size[0],w.size[1]]:P==="left"||P==="right"?[w.size[2],w.size[1]]:[w.size[0],w.size[2]],Re=(Bt,ze)=>Math.max(1,Math.min(64,ze*Math.max(1,Math.round(Bt*n.density/ze)))),fe=B?Re(we,B.w):Re(we,1),ke=B?Re(Le,B.h):Re(Le,1),Te=P==="top"?"t":P==="bottom"?"b":"s",te=(B?"t:"+F:"c:"+ne)+"|"+fe+"x"+ke+Te,se=l.get(te);if(se)return se;let Y=lt(te),it=B?null:Ur(e.palette[ne]??"#ff00ff");return se={key:te,w:fe,h:ke,x:0,y:0,paint:(Bt,ze,pr,dr,hr)=>{for(let Ue=0;Ue<ke;Ue++)for(let qe=0;qe<fe;qe++){let Vt=it;if(B){let ur=B.rows[Math.floor(Ue*B.h/ke)][Math.floor(qe*B.w/fe)];if(Xe.has(ur))continue;let Pe=e.palette[ur];if(!Pe)continue;Vt=Ur(Pe);}Ga(Bt,ze,pr,dr+qe,hr+Ue,fn(Vt,qe,Ue,fe,ke,Te,Y,n));}}},l.set(te,se),se},c=(w,P)=>{let F="e:"+w,B=l.get(F);return B||(B={key:F,w:P.w,h:P.h,x:0,y:0,paint:(ne,we,Le,Re,fe)=>{for(let ke=0;ke<P.h;ke++)for(let Te=0;Te<P.w;Te++){let te=P.rows[ke][Te];if(Xe.has(te))continue;let se=e.palette[te];se&&Ga(ne,we,Le,Re+Te,fe+ke,Ur(se));}}},l.set(F,B)),B},m=o.map(w=>({p:w,faces:Ke.map(P=>({f:P,cell:i(w,P)}))})),h=e.face,d=[];if(h)for(let[w,P]of Object.entries(h.expressions)){let F=e.textures[P];F&&d.push([w,c(P,F)]);}let p=s>0?2:0,{w:g,h:b}=hn([...l.values()],p),E=new Uint8Array(g*b*4);for(let w of l.values())w.paint(E,g,b,w.x,w.y),p&&un(E,g,b,w,p);let v=.01,M=(w,P=v)=>[(w.x+P)/g,1-(w.y+P)/b,(w.x+w.w-P)/g,1-(w.y+w.h-P)/b],R=new Map;for(let w of r)R.set(w.name,{pos:[],nrm:[],uv:[],idx:[]});let A=new Map,y=w=>{let P=A.get(w);if(P===void 0){P=true;for(let F=0;F<w.h&&P;F++)for(let B=0;B<w.w;B++)if(E[((b-1-w.y-F)*g+w.x+B)*4+3]<128){P=false;break}A.set(w,P);}return P},z=new Map;for(let{p:w}of m)w.shape==="cylinder"&&!z.has(w.bone)&&z.set(w.bone,w);let C=w=>!!w.wrap&&z.has(w.bone),L=new Map;for(let{p:w,faces:P}of m)if(w.shape!=="cylinder"&&w.mat!=="glass"&&P.every(({cell:F})=>y(F))){let F=L.get(w.bone)??[];F.push(w),L.set(w.bone,F);}let I=new Map,_=w=>{if(!w.mat)return R.get(w.bone);let P=w.mat+"|"+w.bone,F=I.get(P);return F||I.set(P,F={bone:w.bone,mat:w.mat,pos:[],nrm:[],uv:[],idx:[]}),F},T=0;for(let{p:w,faces:P}of m){let F=_(w),B=r.find(te=>te.name===w.bone).pivot,ne=[w.size[0]/2,w.size[1]/2,w.size[2]/2];if(T=Math.max(T,w.pos[1]+ne[1]),w.shape==="cylinder"){for(let{f:te,cell:se}of P)En(F,w,ne,ja[te],B,M(se,.5));continue}let we=C(w),Le=we?z.get(w.bone):void 0,Re=(L.get(w.bone)??[]).filter(te=>te!==w&&C(te)===we),fe=Math.min(w.size[0],w.size[1],w.size[2])<Xa?0:s,ke=Math.min(w.size[0],w.size[1],w.size[2])>=wn?xn:gn,Te=(te,se)=>{let Y=ja[te],it=(Pe,Ye)=>{let Rt=[ne[0]*(Y.tl[0]+2*(Y.u[0]*Pe+Y.d[0]*Ye)),ne[1]*(Y.tl[1]+2*(Y.u[1]*Pe+Y.d[1]*Ye)),ne[2]*(Y.tl[2]+2*(Y.u[2]*Pe+Y.d[2]*Ye))],$e=Tt(Rt,w.rot);return [w.pos[0]+$e[0]-B[0],w.pos[1]+$e[1]-B[1],w.pos[2]+$e[2]-B[2]]},Bt=Tt(Y.n,w.rot),ze=F.pos.length/3,[pr,dr,hr,Ue]=M(se),[qe,Vt]=w.flip?[hr,pr]:[pr,hr];if(fe>0||we){let[Pe,Ye,Rt,$e]=M(se,.5);Rn(F,w,ne,Y,B,fe,ke,w.flip?[Rt,Ye,Pe,$e]:[Pe,Ye,Rt,$e],we);return}let ur=[[0,0,qe,dr],[1,0,Vt,dr],[1,1,Vt,Ue],[0,1,qe,Ue]];for(let[Pe,Ye,Rt,$e]of ur)F.pos.push(...it(Pe,Ye)),F.nrm.push(...Bt),F.uv.push(Rt,$e);F.idx.push(ze,ze+2,ze+1,ze,ze+3,ze+2);};for(let{f:te,cell:se}of P){let Y=[F.pos.length,F.nrm.length,F.uv.length,F.idx.length];Te(te,se),Re.length&&Dn(F.pos,Y[0],B,Re,s)?(F.pos.length=Y[0],F.nrm.length=Y[1],F.uv.length=Y[2],F.idx.length=Y[3]):Le&&(Pn(F,Y[0],B,Le,Mn(w,ne,Le)),zn(F.pos,Y[0],B,Le)&&(F.pos.length=Y[0],F.nrm.length=Y[1],F.uv.length=Y[2],F.idx.length=Y[3]));}}let D=r.map(w=>{let P=R.get(w.name);return {name:w.name,role:w.role,parent:w.parent,pivot:w.pivot,positions:Float32Array.from(P.pos),normals:Float32Array.from(P.nrm),uvs:Float32Array.from(P.uv),indices:Uint16Array.from(P.idx)}}),W=[...I.values()].map(w=>({bone:w.bone,mat:w.mat,positions:Float32Array.from(w.pos),normals:Float32Array.from(w.nrm),uvs:Float32Array.from(w.uv),indices:Uint16Array.from(w.idx)})),ee=null;if(h&&d.length){let w=e.parts.filter(B=>B.bone===h.bone),P=w.find(B=>B.name===h.bone)??w.sort((B,ne)=>ne.size[0]*ne.size[1]*ne.size[2]-B.size[0]*B.size[1]*B.size[2])[0],F=r.find(B=>B.name===h.bone);if(P&&F&&P.shape==="cylinder"){let B={};for(let[ne,we]of d)B[ne]=M(we);ee=On(h.bone,P,h.rect,F.pivot,B);}else if(P&&F){let[B,ne,we,Le]=h.rect,Re=P.pos[0]+P.size[0]/2-B,fe=P.pos[1]+P.size[1]/2-ne,ke=P.pos[2]-P.size[2]/2-.05,Te=F.pivot,te=(Y,it)=>[Y-Te[0],it-Te[1],ke-Te[2]],se={};for(let[Y,it]of d)se[Y]=M(it);ee={bone:h.bone,corners:Float32Array.from([...te(Re,fe),...te(Re-we,fe),...te(Re-we,fe-Le),...te(Re,fe-Le)]),uv:se};}}let ve=t.sockets.filter(w=>a(w.bone)).map(w=>{let P=t.bones.find(F=>F.name===w.bone);return {name:w.name,bone:w.bone,at:[w.at[0]-P.pivot[0],w.at[1]-P.pivot[1],w.at[2]-P.pivot[2]]}}),ue=Math.max(1,T),me=ue>t.height.max?t.height.max/ue:ue<t.height.min?t.height.min/ue:1;return {hash:Et(e),rig:e.rig,bones:D,mats:W,atlas:{w:g,h:b,data:E},face:ee,sockets:ve,height:ue,scale:e.scale*me,eye:t.eye*ue/Nn(e.rig)}}var Ka=3,yn=2.5,gn=1,qa=0,xn=2,wn=4.1;function Rn(e,t,r,a,o,n,s,l,i=false){let c=Math.min(r[0],r[1],r[2]),m=i?0:Math.min(c,n*Ka),h=Math.min(c,m*yn),d=[r[0]-m,r[1]-m,r[2]-m],p=[r[0]-h,r[1]-h,r[2]-h],g=L=>Math.abs(L[0])*t.size[0]+Math.abs(L[1])*t.size[1]+Math.abs(L[2])*t.size[2],b=L=>{let I=[];for(let T=0;T<=s;T++)I.push(Math.min(.5,m*T/s/L));if(!i)for(let T=1;T<=qa;T++)I.push(Math.min(.5,(m+(h-m)*T/qa)/L));if(i){let T=Math.max(1,Math.min(An,Math.ceil(L/kn)));for(let D=1;D<T;D++)I.push(Yr(D/T));}let _=[...I,...I.map(T=>1-T)].sort((T,D)=>T-D);return _.filter((T,D)=>D===0||T-_[D-1]>1e-6)},E=b(g(a.u)),v=b(g(a.d)),M=e.pos.length/3,[R,A,y,z]=l;for(let L of v)for(let I of E){let _=[0,0,0],T=[0,0,0],D=[0,0,0];for(let P=0;P<3;P++){let F=r[P]*(a.tl[P]+2*(a.u[P]*I+a.d[P]*L)),B=Math.max(-d[P],Math.min(d[P],F));T[P]=F-B,_[P]=B,D[P]=F-Math.max(-p[P],Math.min(p[P],F));}let W=Math.hypot(T[0],T[1],T[2]),ee=W>1e-9?[T[0]/W,T[1]/W,T[2]/W]:[a.n[0],a.n[1],a.n[2]],ve=Math.hypot(D[0],D[1],D[2]),ue=ve>1e-9?[D[0]/ve,D[1]/ve,D[2]/ve]:ee,me=[_[0]+ee[0]*m,_[1]+ee[1]*m,_[2]+ee[2]*m],w=Tt(me,t.rot);e.pos.push(t.pos[0]+w[0]-o[0],t.pos[1]+w[1]-o[1],t.pos[2]+w[2]-o[2]),e.nrm.push(...Tt(ue,t.rot)),e.uv.push(R+(y-R)*I,A+(z-A)*L);}let C=E.length;for(let L=0;L+1<v.length;L++)for(let I=0;I+1<C;I++){let _=M+L*C+I;e.idx.push(_,_+C+1,_+1,_,_+C,_+C+1);}}var Xa=.45,kn=1.5,An=5,Sn=10,Ya=.6,Yr=e=>(1-Ya)*e+Ya*(.5+.5*Math.sin(Math.PI*(e-.5))),Yt=4,xr=1.12,Wa=.35;function Ja(e,t,r){let a=e*e,o=t*t,n=r*r;return [e*Math.sqrt(Math.max(0,1-o/2-n/2+o*n/3)),t*Math.sqrt(Math.max(0,1-n/2-a/2+n*a/3)),r*Math.sqrt(Math.max(0,1-a/2-o/2+a*o/3))]}function Za(e){let t=Yt,r=Math.pow(Math.pow(e[0]*e[0]+e[2]*e[2],t/2)+Math.pow(Math.abs(e[1]),t),1/t)||1;return [e[0]/r,e[1]/r,e[2]/r]}function $r(e,t){let r=Yt,a=Math.pow(e[0]*e[0]+e[2]*e[2],(r-2)/2),o=[e[0]*a,Math.sign(e[1])*Math.pow(Math.abs(e[1]),r-1),e[2]*a],n=[o[0]/t[0],o[1]/t[1],o[2]/t[2]],s=Math.hypot(n[0],n[1],n[2])||1;return [n[0]/s,n[1]/s,n[2]/s]}function En(e,t,r,a,o,n){let s=Sn,l=e.pos.length/3,[i,c,m,h]=n;for(let p=0;p<=s;p++)for(let g=0;g<=s;g++){let b=Yr(g/s),E=Yr(p/s),v=[0,0,0];for(let A=0;A<3;A++)v[A]=a.tl[A]+2*(a.u[A]*b+a.d[A]*E);let M=Za(Ja(v[0],v[1],v[2])),R=Tt([r[0]*M[0],r[1]*M[1],r[2]*M[2]],t.rot);e.pos.push(t.pos[0]+R[0]-o[0],t.pos[1]+R[1]-o[1],t.pos[2]+R[2]-o[2]),e.nrm.push(...Tt($r(M,r),t.rot)),e.uv.push(i+(m-i)*b,c+(h-c)*E);}let d=s+1;for(let p=0;p<s;p++)for(let g=0;g<s;g++){let b=l+p*d+g;e.idx.push(b,b+d+1,b+1,b,b+d,b+d+1);}}function vn(e,t){let r=[t.size[0]/2,t.size[1]/2,t.size[2]/2],a=[(e[0]-t.pos[0])/r[0],(e[1]-t.pos[1])/r[1],(e[2]-t.pos[2])/r[2]],o=Math.max(Math.abs(a[0]),Math.abs(a[1]),Math.abs(a[2]));if(o<1e-6)return {p:e,w:0,s:[0,1,0]};let n=Za(Ja(a[0]/o,a[1]/o,a[2]/o)),s=o<=xr?1:Math.max(0,1-(o-xr)/Wa),l=s*s*(3-2*s),i=[t.pos[0]+r[0]*n[0]*o,t.pos[1]+r[1]*n[1]*o,t.pos[2]+r[2]*n[2]*o];return {p:[e[0]+(i[0]-e[0])*l,e[1]+(i[1]-e[1])*l,e[2]+(i[2]-e[2])*l],w:l,s:n}}var Tn=1.25,Ln=.85;function Mn(e,t,r){if(e.rot)return false;let a=(e.pos[1]+t[1]-r.pos[1])/(r.size[1]/2),o=Math.max(t[0]/(r.size[0]/2),t[2]/(r.size[2]/2));return a>Tn&&o>=Ln}function Cn(e,t){let r=t.size[0]/2,a=t.size[2]/2,o=(e[0]-t.pos[0])/r,n=(e[2]-t.pos[2])/a,s=Math.max(Math.abs(o),Math.abs(n));if(s<1e-6)return {p:e,w:0,s:[0,1,0]};let l=o/s,i=n/s,c=l*Math.sqrt(Math.max(0,1-i*i/2)),m=i*Math.sqrt(Math.max(0,1-l*l/2)),h=s<=xr?1:Math.max(0,1-(s-xr)/Wa),d=h*h*(3-2*h),p=t.pos[0]+r*c*s,g=t.pos[2]+a*m*s;return {p:[e[0]+(p-e[0])*d,e[1],e[2]+(g-e[2])*d],w:d,s:[c,0,m]}}function zn(e,t,r,a){let o=Yt;for(let n=t;n<e.length;n+=3){let s=(e[n]+r[0]-a.pos[0])/(a.size[0]/2),l=(e[n+1]+r[1]-a.pos[1])/(a.size[1]/2),i=(e[n+2]+r[2]-a.pos[2])/(a.size[2]/2);if(Math.pow(Math.pow(s*s+i*i,o/2)+Math.pow(Math.abs(l),o),1/o)>.97)return false}return true}function Pn(e,t,r,a,o=false){let n=[a.size[0]/2,a.size[1]/2,a.size[2]/2];for(let s=t;s<e.pos.length;s+=3){let l=[e.pos[s]+r[0],e.pos[s+1]+r[1],e.pos[s+2]+r[2]],{p:i,w:c,s:m}=o?Cn(l,a):vn(l,a);if(e.pos[s]=i[0]-r[0],e.pos[s+1]=i[1]-r[1],e.pos[s+2]=i[2]-r[2],c<=0)continue;let h=[e.nrm[s],e.nrm[s+1],e.nrm[s+2]],d=[l[0]-a.pos[0],l[1]-a.pos[1],l[2]-a.pos[2]],p=Math.hypot(d[0],d[1],d[2])||1;if((h[0]*d[0]+h[1]*d[1]+h[2]*d[2])/p<.3||o&&Math.abs(h[1])>.7)continue;let g=$r(m,n),b=[h[0]+(g[0]-h[0])*c,h[1]+(g[1]-h[1])*c,h[2]+(g[2]-h[2])*c],E=Math.hypot(b[0],b[1],b[2])||1;e.nrm[s]=b[0]/E,e.nrm[s+1]=b[1]/E,e.nrm[s+2]=b[2]/E;}}var qr=.16,In=12,_n=12;function On(e,t,r,a,o){let n=[t.size[0]/2,t.size[1]/2,t.size[2]/2],[s,l,i,c]=r,m=t.pos[0]+n[0]-s,h=t.pos[1]+n[1]-l,d=In,p=_n,g=new Float32Array((d+1)*(p+1)*3),b=new Float32Array((d+1)*(p+1)*3),E=new Float32Array((d+1)*(p+1)*2),v=0;for(let R=0;R<=p;R++)for(let A=0;A<=d;A++){let y=A/d,z=R/p,C=m-i*y,L=h-c*z,I=(C-t.pos[0])/n[0],_=(L-t.pos[1])/n[1],T=Math.pow(Math.max(0,1-Math.pow(Math.min(1,Math.abs(_)),Yt)),1/Yt),D=-Math.sqrt(Math.max(.02,T*T-I*I)),W=$r([I,_,D],n);g[v*3]=C+W[0]*qr-a[0],g[v*3+1]=L+W[1]*qr-a[1],g[v*3+2]=t.pos[2]+n[2]*D+W[2]*qr-a[2],b.set(W,v*3),E[v*2]=y,E[v*2+1]=z,v++;}let M=(R,A)=>[R-a[0],A-a[1],t.pos[2]-n[2]-a[2]];return {bone:e,corners:Float32Array.from([...M(m,h),...M(m-i,h),...M(m-i,h-c),...M(m,h-c)]),uv:o,grid:{cols:d,rows:p,positions:g,normals:b,t:E}}}function Fn(e,t){if(!t)return e;let[r,a,o]=e,[n,s,l]=[-t[0]*vt,-t[1]*vt,-t[2]*vt],i=Math.cos(n),c=Math.sin(n);return [a,o]=[a*i-o*c,a*c+o*i],i=Math.cos(s),c=Math.sin(s),[r,o]=[r*i+o*c,-r*c+o*i],i=Math.cos(l),c=Math.sin(l),[r,a]=[r*i-a*c,r*c+a*i],[r,a,o]}function Dn(e,t,r,a,o){for(let s of a){let l=[s.size[0]/2,s.size[1]/2,s.size[2]/2],i=Math.min(s.size[0],s.size[1],s.size[2])<Xa?0:o,c=i>0?Math.min(l[0],l[1],l[2],i*Ka):0,m=true;for(let h=t;h<e.length&&m;h+=3){let d=Fn([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),p=Math.abs(d[0])-(l[0]-c),g=Math.abs(d[1])-(l[1]-c),b=Math.abs(d[2])-(l[2]-c);Math.hypot(Math.max(p,0),Math.max(g,0),Math.max(b,0))+Math.min(Math.max(p,g,b),0)-c>=-0.01&&(m=false);}if(m)return true}return false}function Nn(e){let t=1;for(let r of Ie[e].defaultParts)t=Math.max(t,r.pos[1]+r.size[1]/2);return t}var Kr=new Map;function Bn(e){let t=new Map;for(let i of e.bones){if(!i.indices.length){t.set(i.name,null);continue}let c=new V__namespace.BufferGeometry;c.setAttribute("position",new V__namespace.BufferAttribute(i.positions,3)),c.setAttribute("normal",new V__namespace.BufferAttribute(i.normals,3)),c.setAttribute("uv",new V__namespace.BufferAttribute(i.uvs,2)),c.setIndex(new V__namespace.BufferAttribute(i.indices,1)),c.computeBoundingSphere(),c.userData.shared=true,t.set(i.name,c);}let r=Qa(e.bones,e),a=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(d=>d.name===h.bone).pivot})),m=Qa(c,e);m&&a.set(i,m);}let{w:o,h:n,data:s}=e.atlas,l=new V__namespace.DataTexture(s,o,n,V__namespace.RGBAFormat);return l.magFilter=V__namespace.NearestFilter,l.minFilter=V__namespace.NearestFilter,l.generateMipmaps=false,l.colorSpace=V__namespace.SRGBColorSpace,l.needsUpdate=true,{layout:e,geometries:t,skinned:r,skinnedMats:a,texture:l,refs:0}}function Qa(e,t){let r=g=>t.bones.findIndex(b=>b.name===(g.bone??g.name)),a=0,o=0;for(let g of e)a+=g.positions.length/3,o+=g.indices.length;if(!o)return null;let n=new Float32Array(a*3),s=new Float32Array(a*3),l=new Float32Array(a*2),i=new Uint16Array(a*4),c=new Float32Array(a*4),m=a>65535?new Uint32Array(o):new Uint16Array(o),h=0,d=0;e.forEach(g=>{let b=r(g),E=g.positions.length/3;for(let v=0;v<E;v++)n[(h+v)*3]=g.positions[v*3]+g.pivot[0],n[(h+v)*3+1]=g.positions[v*3+1]+g.pivot[1],n[(h+v)*3+2]=g.positions[v*3+2]+g.pivot[2],i[(h+v)*4]=b,c[(h+v)*4]=1;s.set(g.normals,h*3),l.set(g.uvs,h*2);for(let v=0;v<g.indices.length;v++)m[d+v]=g.indices[v]+h;h+=E,d+=g.indices.length;});let p=new V__namespace.BufferGeometry;return p.setAttribute("position",new V__namespace.BufferAttribute(n,3)),p.setAttribute("normal",new V__namespace.BufferAttribute(s,3)),p.setAttribute("uv",new V__namespace.BufferAttribute(l,2)),p.setAttribute("skinIndex",new V__namespace.Uint16BufferAttribute(i,4)),p.setAttribute("skinWeight",new V__namespace.BufferAttribute(c,4)),p.setIndex(new V__namespace.BufferAttribute(m,1)),p.computeBoundingSphere(),p.userData.shared=true,p}function Xr(e){let t=Kr.get(Et(e));return t||(t=Bn($a(e)),Kr.set(t.layout.hash,t)),t.refs++,t}function wr(e){if(!(--e.refs>0)){Kr.delete(e.layout.hash);for(let t of e.geometries.values())t?.dispose();e.skinned?.dispose();for(let t of e.skinnedMats.values())t.dispose();e.texture.dispose();}}var G=class e{constructor(t,r,a="."){this.w=t;this.h=r;this.g=Array.from({length:r},()=>new Array(t).fill(a));}w;h;g;px(t,r,a){return t>=0&&r>=0&&t<this.w&&r<this.h&&(this.g[r][t]=a),this}rect(t,r,a,o,n){for(let s=r;s<r+o;s++)for(let l=t;l<t+a;l++)this.px(l,s,n);return this}row(t,r,a,o){return this.rect(r,t,a-r+1,1,o)}col(t,r,a,o){return this.rect(t,r,1,a-r+1,o)}where(t,r){for(let a=0;a<this.h;a++)for(let o=0;o<this.w;o++)t(o,a)&&this.px(o,a,r);return this}flipped(){let t=new e(this.w,this.h);for(let r=0;r<this.h;r++)for(let a=0;a<this.w;a++)t.px(this.w-1-a,r,this.g[r][a]);return t}tex(){return {w:this.w,h:this.h,rows:this.g.map(t=>t.join(""))}}};var Vn={s:"#d9a982",S:"#bf8d68",h:"#6b4a2f",H:"#8a6644",k:"#3a2818",w:"#f4f4ef",b:"#3f8f9c",m:"#9a5544",o:"#4a2219",t:"#a7bea9",T:"#c4d6c4",D:"#84a08a",u:"#ece6d2",B:"#6a4e33",g:"#d8c48c",p:"#8c9ca6",P:"#6f808a",z:"#a07a55",Z:"#7c5c3f",l:"#e9e3cf"};function Ge(e,t){let r=parseInt(e.slice(1),16);return "#"+[r>>16&255,r>>8&255,r&255].map(o=>Math.max(0,Math.min(255,Math.round(o*t)))).map(o=>o.toString(16).padStart(2,"0")).join("")}function Jr(e,t){let r={...e};return t.skin&&(r.s=t.skin,r.S=Ge(t.skin,.86),r.m=Ge(t.skin,.66)),t.hair&&(r.h=t.hair,r.H=Ge(t.hair,1.25),r.k=Ge(t.hair,.6)),t.shirt&&(r.t=t.shirt,r.T=Ge(t.shirt,1.15),r.D=Ge(t.shirt,.8)),t.pants&&(r.p=t.pants,r.P=Ge(t.pants,.8)),t.boots&&(r.z=t.boots,r.Z=Ge(t.boots,.78)),t.eyes&&(r.b=t.eyes),r}var Hn=new G(16,16,"s").rect(0,0,16,3,"h").row(3,0,4,"h").row(3,10,15,"h").row(4,0,1,"h").row(4,13,15,"h").col(0,5,8,"h").col(15,5,8,"h").row(1,3,6,"H").row(1,9,12,"H").row(15,2,13,"S"),eo=new G(16,16,"s").rect(0,0,16,4,"h").rect(7,4,9,7,"h").rect(10,11,6,2,"h").rect(5,7,2,3,"S").row(1,2,13,"H").where((e,t)=>t>4&&t<11&&e>8&&(e+t)%4===0,"k"),jn=eo.flipped(),Gn=new G(16,16,"h").where((e,t)=>(e+2*t)%5===0,"H").where((e,t)=>t>8&&(e*3+t)%7===0,"k").rect(4,14,8,2,"s"),Un=new G(16,16,"h").where((e,t)=>(e+2*t)%5===0,"H").where((e,t)=>(3*e+t)%9===0,"k"),qn=new G(18,4,"h").where((e,t)=>(e*7+t*3)%5===0,"H").where((e,t)=>t===3&&e*5%3===0,"k"),Yn=new G(16,24,"t").row(0,6,9,"s").row(1,7,8,"s").row(0,3,5,"T").row(0,10,12,"T").row(1,4,6,"T").row(1,9,11,"T").row(2,5,6,"T").row(2,9,10,"T").col(8,2,19,"D").px(7,5,"u").px(7,9,"u").px(7,13,"u").px(7,17,"u").row(6,2,5,"D").col(2,7,10,"D").col(5,7,10,"D").row(10,2,5,"D").px(4,7,"u").row(6,10,13,"D").col(10,7,10,"D").col(13,7,10,"D").row(10,10,13,"D").px(11,7,"u").row(19,0,15,"D").rect(0,20,16,2,"B").rect(7,20,2,2,"g").rect(0,22,16,2,"p"),$n=new G(16,24,"t").row(5,0,15,"D").col(8,6,19,"D").row(19,0,15,"D").rect(0,20,16,2,"B").rect(0,22,16,2,"p"),Kn=new G(8,24,"t").col(4,0,19,"D").row(19,0,7,"D").rect(0,20,8,2,"B").rect(0,22,8,2,"p"),Xn=new G(16,2,"B").rect(7,0,2,2,"g").px(3,0,"k").px(12,0,"k"),Wn=new G(6,24,"s").row(23,0,5,"S").col(2,21,23,"S"),Jn=new G(8,13,"t").col(0,0,9,"D").row(9,0,7,"D").rect(0,10,8,3,"T").row(12,0,7,"D"),Zn=new G(8,24,"p").col(4,1,21,"P").row(0,0,7,"P"),Qn=new G(8,24,"p").col(3,0,21,"P").row(0,0,7,"P"),es=new G(8,24,"p").col(3,0,21,"P"),ts=new G(10,9,"z").row(0,0,9,"Z").row(2,3,6,"l").row(4,3,6,"l").row(6,3,6,"l").col(2,1,6,"Z").col(7,1,6,"Z").rect(0,7,10,2,"Z"),rs=new G(10,9,"z").row(0,0,9,"Z").rect(0,7,10,2,"Z").col(5,1,6,"Z");function De(e){let t=new G(16,10,"."),r=(o,n,s)=>{if(e.brows==="flat")t.row(1,o,o+2,"k");else if(e.brows==="high")t.row(0,o,o+2,"k");else {let l=e.brows==="down"?1:0,i=1-l;t.px(n,l,"k").px(o+1,e.brows==="down"?0:1,"k"),t.px(s,i,"k");}};r(3,5,3),r(10,10,12);let a=o=>{if(e.eyes===0){t.row(3,o,o+2,"k");return}let n=e.eyes===3||e.eyes===2?2:3;for(let s=n;s<n+e.eyes;s++)t.px(o,s,"w").px(o+1,s,"b").px(o+2,s,"w");};switch(a(3),a(10),e.mouth){case "line":t.row(7,6,9,"m");break;case "smile":t.px(5,6,"m").px(10,6,"m").row(7,6,9,"m");break;case "frown":t.row(7,6,9,"m").px(5,8,"m").px(10,8,"m");break;case "open":t.rect(6,7,4,2,"o");break;case "small":t.rect(7,7,2,2,"o");break;case "wide":t.row(7,5,10,"m").rect(6,8,4,1,"o");break}return t}var to={f_neutral:De({brows:"flat",eyes:2,mouth:"line"}),f_blink:De({brows:"flat",eyes:0,mouth:"line"}),f_happy:De({brows:"high",eyes:2,mouth:"smile"}),f_sad:De({brows:"up",eyes:2,mouth:"frown"}),f_angry:De({brows:"down",eyes:1,mouth:"wide"}),f_surprised:De({brows:"high",eyes:3,mouth:"small"}),f_scared:De({brows:"up",eyes:3,mouth:"open"}),f_tired:De({brows:"flat",eyes:1,mouth:"line"}),f_hurt:De({brows:"down",eyes:0,mouth:"open"}),f_talk:De({brows:"flat",eyes:2,mouth:"open"})},as=new G(16,24,"t").row(0,5,10,"s").row(1,6,9,"s").px(5,1,"T").px(10,1,"T").row(7,0,15,"D").row(10,0,15,"D").rect(0,18,16,2,"T").rect(0,20,16,4,"p").row(20,0,15,"P"),os=new G(16,24,"t").row(0,5,10,"T").row(7,0,15,"D").row(10,0,15,"D").rect(0,18,16,2,"T").rect(0,20,16,4,"p").row(20,0,15,"P"),ns=new G(8,24,"t").row(7,0,7,"D").row(10,0,7,"D").rect(0,18,8,2,"T").rect(0,20,8,4,"p").row(20,0,7,"P"),ss=new G(8,9,"t").row(3,0,7,"D").rect(0,7,8,2,"T"),Rr=(e,t)=>e.row(t-1,0,e.w-1,"D").where((r,a)=>a>=t&&a<=t+3&&(r+a)%2===0,"T").row(t+4,0,e.w-1,"D"),is=Rr(new G(16,24,"t"),6).row(0,6,9,"s").row(0,4,5,"T").row(0,10,11,"T").row(1,4,11,"T").where((e,t)=>t>=18&&t<=19&&e%2===0,"D").where((e,t)=>t>=18&&t<=19&&e%2===1,"T").rect(0,20,16,4,"p"),ls=Rr(new G(16,24,"t"),6).row(0,4,11,"T").where((e,t)=>t>=18&&t<=19,"D").rect(0,20,16,4,"p"),cs=Rr(new G(8,24,"t"),6).where((e,t)=>t>=18&&t<=19,"D").rect(0,20,8,4,"p"),ms=Rr(new G(8,22,"t"),9).where((e,t)=>t>=19&&e%2===0,"D"),ro=e=>new G(8,24,"s").rect(0,0,8,12,"p").col(e,1,10,"P").row(11,0,7,"P").row(12,0,7,"S").rect(0,19,8,5,"l"),ps=ro(4),ds=ro(3),hs=new G(9,5,"z").row(1,3,5,"l").rect(0,3,9,2,"l"),us=new G(10,5,"z").row(1,3,6,"Z").rect(0,3,10,2,"l"),fs=new G(17,6,"a").rect(0,4,17,2,"A"),bs=new G(22,22,"a").where((e,t)=>(e*3+t*5)%11===0,"A"),ys=new G(17,20,"h").where((e,t)=>(e*5+t)%4===0,"H").where((e,t)=>t>10&&(e*3+t*2)%7===0,"k"),K=e=>e.tex(),ao=["shirt","tee","sweater"],oo=["pants","shorts"],no=["boots","sneakers"],Rl=["short","long","curly","none"],ct=(e,t={})=>({front:e,back:e,left:e,right:e,...t});function Zr(e={}){let t=e.top??"shirt",r=e.bottom??"pants",a=e.shoes??"boots",o=e.hair??"short",n=Jr(Vn,e.colors??{});n={...n,a:e.colors?.hat??"#d9c9a3"},n.A=Ge(n.a,.72);let s={head_front:K(Hn),head_left:K(eo),head_right:K(jn),head_back:K(Gn),hair_top:K(Un),hair_band:K(qn),arm_skin:K(Wn),...Object.fromEntries(Object.entries(to).map(([g,b])=>[g,K(b)]))},l=[{name:"head",bone:"head",size:[8,8,8],pos:[0,28,0],color:"s",faces:{front:"head_front",left:"head_left",right:"head_right",back:"head_back",top:"hair_top"}},{name:"nose",bone:"head",size:[1,1.5,.8],pos:[0,26.9,-4.4],color:"S",faces:{front:"s"}}];if(o!=="none"){if(e.hat||l.push({name:"hair",bone:"head",size:o==="curly"?[9,2.2,9]:[8.6,1.6,8.6],pos:[0,o==="curly"?32.5:32.2,.15],color:"h",faces:ct("hair_band",{top:"hair_top"})}),o==="curly"&&!e.hat)for(let[g,b]of [[-2,-1.5],[2,.5],[-0.5,2.5]])l.push({name:"curl",bone:"head",size:[3.2,1.4,3.2],pos:[g,33.9,b],color:"h",faces:ct("hair_band",{top:"hair_top"})});o==="long"?(s.hair_long=K(ys),l.push({name:"hairLong",bone:"head",size:[8.8,10,1],pos:[0,27,4.4],color:"h",faces:ct("hair_long",{top:"hair_top"})},{name:"hairSide",bone:"head",size:[.8,9,6],pos:[-4.4,27.5,1],color:"h",faces:ct("hair_long",{top:"hair_top"}),mirror:true})):l.push({name:"hairBack",bone:"head",size:[8.6,5,.8],pos:[0,29.6,4.25],color:"h",faces:{back:"head_back",left:"hair_band",right:"hair_band"}});}e.hat&&(s.hat_crown=K(fs),s.hat_brim=K(bs),l.push({name:"hatBrim",bone:"head",size:[11,.8,11],pos:[0,32.4,0],color:"a",faces:{top:"hat_brim",bottom:"hat_brim"}},{name:"hatCrown",bone:"head",size:[8.4,3,8.4],pos:[0,34.3,0],color:"a",faces:ct("hat_crown")}));let i={shirt:[Yn,$n,Kn],tee:[as,os,ns],sweater:[is,ls,cs]},[c,m,h]=i[t];s.top_front=K(c),s.top_back=K(m),s.top_side=K(h),l.push({name:"torso",bone:"body",size:[8,12,4],pos:[0,18,0],color:"t",faces:{front:"top_front",back:"top_back",left:"top_side",right:"top_side",bottom:"p"}}),t==="shirt"&&(s.belt=K(Xn),l.push({name:"belt",bone:"body",size:[8.4,1,4.4],pos:[0,13.5,0],color:"B",faces:{front:"belt",back:"belt"}})),l.push({name:"arm",bone:"armL",size:[3,12,3],pos:[-5.5,18,0],color:"s",faces:ct("arm_skin",{top:"t",bottom:"S"}),mirror:true});let d=t==="sweater"?11:t==="tee"?4.5:6.5;s.sleeve=K(t==="sweater"?ms:t==="tee"?ss:Jn),l.push({name:"sleeve",bone:"armL",size:[3.6,d,3.6],pos:[-5.5,24-d/2,0],color:"t",faces:ct("sleeve",{bottom:"D"}),mirror:true}),r==="shorts"?(s.leg_front=K(ps),s.leg_side=K(ds)):(s.leg_front=K(Zn),s.leg_back=K(Qn),s.leg_side=K(es)),l.push({name:"leg",bone:"legL",size:[4,12,4],pos:[-2,6,0],color:"p",faces:{front:"leg_front",back:r==="shorts"?"leg_front":"leg_back",left:"leg_side",right:"leg_side"},mirror:true}),a==="boots"?(s.shoe_front=K(ts),s.shoe_side=K(rs)):(s.shoe_front=K(hs),s.shoe_side=K(us));let p=a==="boots"?4.5:2.5;return l.push({name:"shoe",bone:"legL",size:[4.6,p,5.2],pos:[-2,p/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??Z({en:"Traveler",ru:"\u041F\u0443\u0442\u043D\u0438\u043A"}),description:e.description??Z({en:"A traveler in a shirt with pockets, trousers and laced boots",ru:"\u041F\u0443\u0442\u043D\u0438\u043A \u0432 \u0440\u0443\u0431\u0430\u0448\u043A\u0435 \u0441 \u043A\u0430\u0440\u043C\u0430\u043D\u0430\u043C\u0438, \u0431\u0440\u044E\u043A\u0430\u0445 \u0438 \u0448\u043D\u0443\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0445 \u0431\u043E\u0442\u0438\u043D\u043A\u0430\u0445"}),rig:"humanoid",palette:n,textures:s,parts:l,face:{bone:"head",rect:[0,3,8,5],expressions:{neutral:"f_neutral",blink:"f_blink",happy:"f_happy",sad:"f_sad",angry:"f_angry",surprised:"f_surprised",scared:"f_scared",tired:"f_tired",hurt:"f_hurt",talk:"f_talk"}},style:{walk:"normal",idle:"calm",energy:.5},finish:{noise:.5,outline:.4,shade:.25,density:2},tags:e.tags??["player"]}}function $t(e,t){return {textures:Object.fromEntries(Object.entries(to).map(([r,a])=>[r,K(a)])),face:{bone:e,rect:t,expressions:{neutral:"f_neutral",blink:"f_blink",happy:"f_happy",sad:"f_sad",angry:"f_angry",surprised:"f_surprised",scared:"f_scared",tired:"f_tired",hurt:"f_hurt",talk:"f_talk"}}}}var Qr=Zr(),Wr=null;function mt(){if(!Wr){let e=Oe(Qr);if(!e.ok)throw new Error(e.error);Wr=e.spec;}return Wr}function so(e){let t=document.createElement("canvas");t.width=256,t.height=48;let r=t.getContext("2d");r&&(r.fillStyle="rgba(0,0,0,0.45)",r.fillRect(0,0,256,48),r.font="bold 28px sans-serif",r.fillStyle="#fff",r.textAlign="center",r.textBaseline="middle",r.fillText(e.slice(0,18),128,25));let a=new V__namespace.CanvasTexture(t),o=new V__namespace.Sprite(new V__namespace.SpriteMaterial({map:a,depthTest:false,transparent:true}));return o.scale.set(1.6,.3,1),o.renderOrder=10,o}function ea(e){e.removeFromParent(),e.material.map?.dispose(),e.material.dispose();}var re={rx:0,ry:1,rz:2,px:3,py:4,pz:5,sx:6,sy:7,sz:8},Sl=Object.keys(re),Mt=[0,0,0,0,0,0,1,1,1];function Ct(e,t){let r=e.get(t);return r||(r=Float64Array.from(Mt),e.set(t,r)),r}function pe(e,t,r,a){let o=Ct(e,t),n=re[r];n>=6?o[n]=o[n]*a:o[n]=o[n]+a;}function f(e,t,r,a){Ct(e,t)[re[r]]=a;}function pt(e){for(let t of e.values())t.set(Mt);}function io(e,t,r,a){let o=new Set([...t.keys(),...r.keys()]);for(let n of o){let s=t.get(n)??Mt,l=r.get(n)??Mt,i=Ct(e,n);for(let c=0;c<9;c++)i[c]=s[c]+(l[c]-s[c])*a;}}function kr(e,t){pt(e);for(let[r,a]of t)Ct(e,r).set(a);}var El=["none","block","tool","sword","bow","shield","food","staff","item"];function Ar(){return {speed:0,vy:0,onGround:true,inWater:false,flying:false,gliding:false,sneaking:false,sprinting:false,riding:false,sitting:false,sleeping:false,dead:false,lookYaw:0,lookPitch:0,yawRate:0,held:"none",use:null,talk:false}}var vl=["swing","hurt","place","land","jump","throw"];var Kt=1/16,xs=.68,lo=.85,ws=1.2,Rs=1.03,ks=1.1,As=.12,Ss=.1,Es=.1;function Sr(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(
|
|
4
|
+
c = mix(vec3(l), c, ${t(ws)});
|
|
5
5
|
#ifdef TONE_MAPPING
|
|
6
|
-
c = (c - 0.5) * ${t(
|
|
6
|
+
c = (c - 0.5) * ${t(Rs)} + 0.5;
|
|
7
7
|
#else
|
|
8
|
-
c = (c - 0.5) * ${t(
|
|
8
|
+
c = (c - 0.5) * ${t(ks)} + 0.5;
|
|
9
9
|
#endif
|
|
10
10
|
gl_FragColor.rgb = clamp(c, 0.0, 1.0);
|
|
11
11
|
}
|
|
@@ -14,29 +14,29 @@
|
|
|
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(
|
|
17
|
+
c += (avg - c) * (1.0 - 1.0 / (1.001 - ${t(As)}));
|
|
18
18
|
c = min(c, 1.0);
|
|
19
|
-
c = clamp((c - 0.5) / (1.0 - ${t(
|
|
19
|
+
c = clamp((c - 0.5) / (1.0 - ${t(Ss)}) + 0.5, 0.0, 1.0);
|
|
20
20
|
float lu = dot(c, vec3(0.2126, 0.7152, 0.0722));
|
|
21
|
-
c += ${t(
|
|
21
|
+
c += ${t(Es)} * lu * lu;
|
|
22
22
|
gl_FragColor.rgb = clamp(c, 0.0, 1.0);
|
|
23
23
|
}
|
|
24
|
-
#endif`);}function Vt(e,t,r){if(!e)return new ___namespace.MeshLambertMaterial(r);let o=new ___namespace.MeshStandardMaterial({...r,roughness:t,metalness:0});return o.onBeforeCompile=Or,o}var Lr=5921370;function _r(e){let t=(r,o)=>r.replace(`#include <${o}>`,___namespace.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 bn(e){_r(e),Or(e);}var mt=class{group=new ___namespace.Group;root=new ___namespace.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;constructor(t=Ee(),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=Vt(this.gloss,cn,{alphaTest:.5}),this.material.onBeforeCompile=this.gloss?bn:_r,this.decalMat=Vt(this.gloss,Pr,{alphaTest:.5,polygonOffset:true,polygonOffsetFactor:-2,polygonOffsetUnits:-2}),this.group.add(this.root),this.asset=zt(t),this.build(),r.name&&this.setName(r.name);}get height(){let t=this.asset.layout;return t.height*t.scale*Ge}get eye(){let t=this.asset.layout;return t.eye*t.scale*Ge}get expressions(){return Object.keys(this.asset.layout.face?.uv??{})}get hash(){return this.asset.layout.hash}setSpec(t){let r=zt(t);if(r===this.asset){it(r);return}this.clear(),it(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*Ge);let n=new Map(t.bones.map(s=>[s.name,s.pivot])),a=[],i=[];for(let s of t.bones){let l=new ___namespace.Bone;a.push(l),i.push(new ___namespace.Matrix4().makeTranslation(-s.pivot[0],-s.pivot[1],-s.pivot[2]));let h=s.parent?n.get(s.parent)??[0,0,0]:[0,0,0],m=[s.pivot[0]-h[0],s.pivot[1]-h[1],s.pivot[2]-h[2]];l.position.set(...m);let p={name:s.name,role:s.role,group:l,rest:m};this.bones.set(s.name,p);let y=this.byRole.get(s.role)??[];y.push(p),this.byRole.set(s.role,y);}for(let s of t.bones){let l=this.bones.get(s.name);((s.parent?this.bones.get(s.parent):void 0)?.group??this.root).add(l.group);}if(r){let s=new ___namespace.SkinnedMesh(r,this.material);s.bind(new ___namespace.Skeleton(a,i),new ___namespace.Matrix4);let l=r.boundingSphere;l&&(s.boundingSphere=new ___namespace.Sphere(l.center.clone(),l.radius*1.6)),s.castShadow=s.receiveShadow=this.shadows,s.layers.set(this.layer),this.meshes.push(s),this.root.add(s);}let c=t.face;if(c){let s=new ___namespace.BufferGeometry;s.setAttribute("position",new ___namespace.BufferAttribute(c.corners,3));let l=new Float32Array(12);for(let h=0;h<4;h++)l[h*3+2]=-1;s.setAttribute("normal",new ___namespace.BufferAttribute(l,3)),s.setAttribute("uv",new ___namespace.BufferAttribute(new Float32Array(8),2)),s.setIndex([0,2,1,0,3,2]),this.decal=new ___namespace.Mesh(s,this.decalMat),this.decal.layers.set(this.layer),this.bones.get(c.bone)?.group.add(this.decal),this.expression=null,this.setExpression("neutral");}for(let s of t.sockets){let l=new ___namespace.Object3D;l.position.set(...s.at),l.scale.setScalar(1/(t.scale*Ge)),this.bones.get(s.bone)?.group.add(l),this.sockets.set(s.name,l);let h=this.attached.get(s.name);h&&l.add(h);}this.buildPrints(),this.placeLabel(),this.setBrightness(this.brightness);}setPrints(t){this.prints=t??[],this.buildPrints(),this.setBrightness(this.brightness);}buildPrints(){for(let o of this.printMeshes)o.removeFromParent(),o.geometry.dispose();this.printMeshes=[];let t=new Set,r=new Map;for(let o of this.prints){let n=this.bones.get(o.bone),a=this.asset.layout.bones.find(h=>h.name===o.bone);if(!n||!a)continue;let i=this.printMats.get(o.texture);i||(i=Vt(this.gloss,Pr,{map:o.texture,emissiveMap:o.texture,emissive:Lr,transparent:true,alphaTest:.02,polygonOffset:true,polygonOffsetFactor:-2,polygonOffsetUnits:-2}),this.printMats.set(o.texture,i)),t.add(o.texture);let c=new ___namespace.PlaneGeometry(o.w,o.h);o.facing==="front"&&c.rotateY(Math.PI),c.translate(o.center[0]-a.pivot[0],o.center[1]-a.pivot[1],o.center[2]-a.pivot[2]);let s=`${o.bone}|${o.texture.uuid}`,l=r.get(s)??{node:n,mat:i,geos:[]};l.geos.push(c),r.set(s,l);}for(let{node:o,mat:n,geos:a}of r.values()){let i=a.length===1?a[0]:BufferGeometryUtils_js.mergeGeometries(a)??a[0];if(i!==a[0])for(let s of a)s.dispose();let c=new ___namespace.Mesh(i,n);c.layers.set(this.layer),o.group.add(c),this.printMeshes.push(c);}for(let[o,n]of this.printMats)t.has(o)||(n.dispose(),this.printMats.delete(o));}clear(){for(let t of this.sockets.values())for(let r of [...t.children])t.remove(r);this.root.clear();for(let t of this.printMeshes)t.geometry.dispose();this.printMeshes=[],this.decal?.geometry.dispose(),this.decal=null;for(let t of this.meshes)t instanceof ___namespace.SkinnedMesh&&t.skeleton.dispose();this.meshes=[],this.bones=new Map,this.byRole=new Map,this.sockets.clear();}applyPose(t){let r=t.get("root");if(r){this.root.rotation.set(r[j.rx],r[j.ry],r[j.rz]);let o=this.asset.layout.scale*Ge;this.root.position.set(r[j.px]*o,r[j.py]*o,r[j.pz]*o);}else this.root.rotation.set(0,0,0),this.root.position.set(0,0,0);for(let[o,n]of this.byRole){let a=t.get(o);for(let i of n){let c=i.group;if(!a){c.rotation.set(0,0,0),c.position.set(...i.rest),c.scale.set(1,1,1);continue}c.rotation.set(a[j.rx],a[j.ry],a[j.rz]),c.position.set(i.rest[0]+a[j.px],i.rest[1]+a[j.py],i.rest[2]+a[j.pz]),c.scale.set(a[j.sx],a[j.sy],a[j.sz]);}}}setFacePainter(t){if(t===this.painter)return;this.painter=t,this.useFaceMap();let r=this.expression??"neutral";this.expression=null,this.setExpression(r);}useFaceMap(){let t=this.painter;this.decalMat.map=t?t.texture:this.asset.texture,this.decalMat.transparent=!!t,this.decalMat.alphaTest=t?.02:.5,this.decalMat.needsUpdate=true;}setExpression(t){if(t===this.expression||!this.decal)return;let r=this.asset.layout.face?.uv,o=this.painter?[0,1,1,0]:r?.[t]??r?.neutral;if(!o)return;this.expression=t,this.painter?.paint(t);let[n,a,i,c]=o,s=this.decal.geometry.getAttribute("uv");s.setXY(0,n,a),s.setXY(1,i,a),s.setXY(2,i,c),s.setXY(3,n,c),s.needsUpdate=true;}materials(){return [this.material,this.decalMat]}setBrightness(t){this.brightness=t,this.material.color.setScalar(t),this.decalMat.color.setScalar(t);for(let r of this.printMats.values())r.color.setScalar(t);}setEmissive(t){if(this.material.emissive.getHex()!==t){this.material.emissive.setHex(t),this.decalMat.emissive.setHex(t);for(let r of this.printMats.values())r.emissive.setHex(t||Lr);}}setShadows(t){if(t!==this.shadows){this.shadows=t;for(let r of this.meshes)r.castShadow=t;}}attach(t,r){let o=this.attached.get(t);if(o!==r){if(o&&o.removeFromParent(),!r){this.attached.delete(t);return}this.attached.set(t,r),this.sockets.get(t)?.add(r);}}attachedAt(t){return this.attached.get(t)??null}setName(t){this.label&&Bt(this.label),this.label=t?Mr(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&&Bt(this.label),this.label=null,this.material.dispose(),this.decalMat.dispose();for(let t of this.printMats.values())t.dispose();this.printMats.clear(),it(this.asset);}};var dt=new Map,jt=new Set;function ni(e){let t=ze(e);if(!dt.has(t)){dt.set(t,e);for(let r of jt)r(t);}return t}function ai(e){return typeof e=="string"?dt.get(e):void 0}function si(e){let t={};for(let r of e){let o=dt.get(r);o&&(t[r]=o);}return t}function ii(e){return jt.add(e),()=>jt.delete(e)}var yn=["#b08a62","#8a6a4a","#c8a878","#9a9a92","#7a5c44"],gn=["#f1c9a5","#e6b892","#d9a982","#c08e68","#a0704c","#7a5238"],xn=["#6b4a2f","#4a3424","#8a5a3a","#c27a48","#d8b878","#2e2622","#a07850","#9a9690"],wn=["#a7bea9","#e6e0cc","#d9c9a3","#b9a083","#a9b8c4","#c8b4a0","#9fb0a0","#d8d2c4","#b98f74","#8fa3b5"],vn=["#8c9ca6","#a9b8b4","#8a8e94","#9fb3ad","#7d8a8f","#b0a58f"],Rn=["#d9c9a3","#c8b48a","#a08a6a","#e6e0cc"];function mi(e,t="",r=""){let o=rt(Re("npc:"+e+"|"+t)),n=c=>c[Math.floor(o()*c.length)],a=Ht({top:n(kr),bottom:n(Tr),shoes:n(Cr),hair:n(["short","short","long","curly"]),hat:o()<.2,colors:{skin:n(gn),hair:n(xn),shirt:n(wn),pants:n(vn),boots:n(yn),hat:n(Rn)}});a.name=e.slice(0,40),a.description=[t,r].filter(Boolean).join(" \u2014 ").slice(0,300),a.style={walk:n(["normal","normal","bouncy","heavy","sneaky"]),idle:n(["calm","calm","fidgety","proud"]),energy:Math.round(o()*10)/10},a.tags=["npc",...t?[t.slice(0,24)]:[]];let i=le(a);return i.ok?i.spec:Ee()}var ge=([e,t,r])=>"#"+[e,t,r].map(o=>Math.round(o).toString(16).padStart(2,"0")).join("");function Sn(e){if(!e.length)return null;let t=r=>{let o=e.map(n=>n[r]).sort((n,a)=>n-a);return o[o.length>>1]};return [t(0),t(1),t(2)]}function En(e,t){let{width:r,height:o,data:n}=e,a=(k,g)=>{let f=(g*r+k)*4;return [n[f],n[f+1],n[f+2]]},i=[a(0,0),a(r-1,0),a(0,o-1),a(r-1,o-1)],c=[0,1,2].map(k=>i.reduce((g,f)=>g+f[k],0)/4),s=k=>Math.abs(k[0]-c[0])+Math.abs(k[1]-c[1])+Math.abs(k[2]-c[2])>60,l=r,h=-1,m=o,p=-1;for(let k=0;k<o;k+=2)for(let g=0;g<r;g+=2)s(a(g,k))&&(l=Math.min(l,g),h=Math.max(h,g),m=Math.min(m,k),p=Math.max(p,k));h<0&&(l=0,h=r-1,m=0,p=o-1);let y=p-m+1,x=h-l+1,b=l+Math.floor(x*.3),T=l+Math.ceil(x*.7);return t.map(([k,g])=>{let f=[];for(let E=m+Math.floor(y*k);E<m+Math.ceil(y*g);E++)for(let d=b;d<T;d++){if(E<0||E>=o||d<0||d>=r)continue;let R=a(d,E);s(R)&&f.push(R);}return Sn(f)})}var An=[[0,.06],[.1,.22],[.3,.52],[.6,.86],[.92,1]];function yi(e,t="humanoid",r=at()){let[o,n,a,i,c]=En(e,An);if(t==="humanoid"){let l=JSON.parse(JSON.stringify(Dt));l.palette=Nt(l.palette,{...o?{hair:ge(o)}:{},...n?{skin:ge(n)}:{},...a?{shirt:ge(a)}:{},...i?{pants:ge(i)}:{},...c?{boots:ge(c)}:{}}),l.name=r,l.tags=[];let h=le(l);return h.ok?h.spec:Ee()}let s=le({name:r,rig:t,palette:{s:ge(n??o??[198,156,124]),t:ge(a??[58,143,214]),p:ge(i??c??[44,62,107]),w:"#f4f4f4",b:"#1d1d21"},textures:{f_neutral:{w:4,h:2,rows:["wbbw","...."]},f_blink:{w:4,h:2,rows:["bbbb","...."]}},face:{rect:t==="blob"?[4,4,4,2]:t==="flyer"?[0,1,4,2]:[2,2,4,2],expressions:{neutral:"f_neutral",blink:"f_blink"}}});return s.ok?s.spec:Ee()}var kn={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}},Tn={calm:{},fidgety:{fidget:1,breath:1.3},proud:{chest:.08,breath:.8}};function Gt(e){let t={amp:.8,arm:.6,bob:0,tempo:1,sway:0,quant:false,breath:1,fidget:0,chest:0,...kn[e.walk],...Tn[e.idle]};return t.tempo*=.8+.4*e.energy,t.amp*=.85+.3*e.energy,t}function ft(e,t=0){let r=Math.sin(e.phase+t);return e.style.quant?Math.max(-1,Math.min(1,r*3)):r}function Ut(e,t,r){let o=ft(t)*r;u(e,"legL","rx",o),u(e,"legR","rx",-o),u(e,"legFL","rx",o),u(e,"legBR","rx",o),u(e,"legFR","rx",-o),u(e,"legBL","rx",-o);}function Yt(e,t,r){let o=ft(t)*r;u(e,"armL","rx",-o),u(e,"armR","rx",o);}function $t(e,t,r,o){let n=ft(t),a=Math.max(0,Math.cos(t.phase))*Math.max(0,-n+.3),i=Math.max(0,-Math.cos(t.phase))*Math.max(0,n+.3);u(e,"shinL","rx",-r*(.15+a)),u(e,"shinR","rx",-r*(.15+i)),u(e,"foreArmL","rx",o*(.6+.4*Math.max(0,-n))),u(e,"foreArmR","rx",o*(.6+.4*Math.max(0,n)));}var Cn=(e,t)=>{let r=Math.sin(t.clock*2)*t.style.breath;u(e,"armL","rz",-0.04-.03*r),u(e,"armR","rz",.04+.03*r),u(e,"foreArmL","rx",.12+.02*r),u(e,"foreArmR","rx",.12+.02*r),u(e,"head","rx",.03*Math.sin(t.clock*1.7)+t.style.chest),u(e,"body","rx",t.style.chest*-0.5),t.style.fidget&&(u(e,"head","ry",.35*Math.sin(t.clock*.7)*Math.sin(t.clock*.31)),u(e,"root","ry",.05*Math.sin(t.clock*.9))),u(e,"body","sy",1+.04*Math.sin(t.clock*3));},Mn=(e,t)=>{Ut(e,t,t.style.amp),Yt(e,t,t.style.arm),$t(e,t,t.style.amp*1.1,.35),u(e,"root","py",t.style.bob*Math.abs(Math.cos(t.phase))),u(e,"body","rz",t.style.sway*ft(t));},In=(e,t)=>{Ut(e,t,t.style.amp*1.3),Yt(e,t,t.style.arm*1.6),$t(e,t,t.style.amp*1.6,1.1),u(e,"body","rx",-0.18),u(e,"head","rx",.18),u(e,"root","py",(.8+t.style.bob)*Math.abs(Math.cos(t.phase)));},Pn=(e,t)=>{Ut(e,t,t.style.amp*.5*Math.min(1,t.input.speed)),Yt(e,t,t.style.arm*.4*Math.min(1,t.input.speed)),u(e,"body","rx",-0.45),u(e,"head","rx",.45),pe(e,"armL","rx",.25),pe(e,"armR","rx",.25),$t(e,t,.9,.6),u(e,"root","py",-1.5);},Ln=(e,t)=>{u(e,"root","rx",-1.3),u(e,"head","rx",1),u(e,"armL","rx",Math.PI-.5+.5*Math.sin(t.t*3)),u(e,"armR","rx",Math.PI-.5+.5*Math.sin(t.t*3+Math.PI)),u(e,"legL","rx",.3*Math.sin(t.t*8)),u(e,"legR","rx",-0.3*Math.sin(t.t*8));},On=(e,t)=>{u(e,"legL","rx",.15),u(e,"legR","rx",.1),u(e,"armL","rz",-0.15),u(e,"armR","rz",.15),u(e,"root","py",.6*Math.sin(t.t*2));},_n=e=>{u(e,"root","rx",-1.35),u(e,"head","rx",1.1),u(e,"armL","rz",-1.3),u(e,"armR","rz",1.3);},zn=(e,t)=>{let r=.15*Math.sin(t.t*10);u(e,"armL","rz",-0.6-r),u(e,"armR","rz",.6+r),u(e,"legL","rx",.25),u(e,"legR","rx",-0.25),u(e,"shinL","rx",-0.5),u(e,"shinR","rx",-0.3),u(e,"foreArmL","rx",.4),u(e,"foreArmR","rx",.4);},Fn=e=>{u(e,"legL","rx",1.45),u(e,"legR","rx",1.45),u(e,"legL","ry",.1),u(e,"legR","ry",-0.1),u(e,"shinL","rx",-1.45),u(e,"shinR","rx",-1.45),u(e,"root","py",-10),u(e,"body","rx",.4),u(e,"legBL","rx",1.2),u(e,"legBR","rx",1.2);},Nn=e=>{u(e,"legL","rx",1.4),u(e,"legR","rx",1.4),u(e,"legL","rz",-0.3),u(e,"legR","rz",.3),u(e,"armL","rx",.45),u(e,"armR","rx",.45),u(e,"shinL","rx",-1.2),u(e,"shinR","rx",-1.2),u(e,"foreArmL","rx",.5),u(e,"foreArmR","rx",.5);},Hn=e=>{u(e,"root","rx",Math.PI/2),u(e,"root","py",2);},Dn=e=>{u(e,"root","rz",Math.PI/2),u(e,"root","py",2);},Bn=(e,t)=>{let r=Math.sin(t.phase*.5);u(e,"root","py",6*Math.max(0,r));let o=r<0?.2*-r:0;u(e,"body","sy",1-o+.1*Math.max(0,r)),u(e,"body","sx",1+o*.6),u(e,"body","sz",1+o*.6);},Vn=(e,t)=>{let r=Math.sin(Math.PI*t.k);u(e,"armR","rx",1.9*r),u(e,"armR","ry",.3*r),u(e,"body","ry",-0.3*r),u(e,"foreArmR","rx",.6*r);},jn=(e,t)=>{let r=Math.sin(Math.PI*t.k);u(e,"armR","rx",.9*r);},Gn=(e,t)=>{let r=t.k<.4?-1.5*(t.k/.4):-1.5+3.5*((t.k-.4)/.6);u(e,"armR","rx",t.k>.9?r*(1-t.k)*10:r);},Un=(e,t)=>{let r=Math.sin(Math.PI*t.k);u(e,"body","rx",.15*r),u(e,"head","rx",.2*r),u(e,"root","rz",.05*r);},Yn=(e,t)=>{let r=Math.sin(Math.PI*t.k);u(e,"root","py",-1.5*r),u(e,"legL","rx",.2*r),u(e,"legR","rx",.2*r),u(e,"shinL","rx",-0.5*r),u(e,"shinR","rx",-0.5*r),u(e,"body","sy",1-.2*r),u(e,"body","sx",1+.12*r),u(e,"body","sz",1+.12*r);},$n=(e,t)=>{u(e,"armR","rx",1.3+.1*Math.sin(t.t*16)),u(e,"armR","ry",-0.5),u(e,"head","rx",-0.1+.08*Math.sin(t.t*16));},qn=e=>{u(e,"armR","rx",2),u(e,"armR","ry",-0.4),u(e,"head","rx",.35);},Wn=e=>{u(e,"armR","rx",1.57),u(e,"armR","ry",-0.1),u(e,"armL","rx",1.57),u(e,"armL","ry",.35);},Kn=e=>{u(e,"armL","rx",.9),u(e,"armL","ry",-0.6);},ut={idle:Cn,walk:Mn,run:In,sneak:Pn,swim:Ln,fly:On,glide:_n,fall:zn,sit:Fn,ride:Nn,sleep:Hn,dead:Dn,hop:Bn,swing:Vn,place:jn,throw:Gn,hurt:Un,land:Yn,eat:$n,drink:qn,draw:Wn,block:Kn},zr={blob:{walk:"hop",run:"hop",sneak:"hop"}},Fr={swing:.3,place:.2,throw:.45,hurt:.3,land:.22};var bt=Math.PI,yt={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,bt*.46],[1,bt*.46]],"legR.rx":[[0,bt*.46],[1,bt*.46]],"root.py":[[0,-10],[1,-10]]}}},Ri=Object.keys(yt);function Si(e){return typeof e=="string"&&e in yt}function Xn(e,t){let r=e[0];if(t<=r[0])return r[1];for(let o=1;o<e.length;o++){let n=e[o];if(t<=n[0]){let a=e[o-1],i=(t-a[0])/Math.max(1e-6,n[0]-a[0]),c=i*i*(3-2*i);return a[1]+(n[1]-a[1])*c}}return e[e.length-1][1]}function Nr(e,t,r){let o=t.loop?r%t.duration:Math.min(r,t.duration);for(let[n,a]of Object.entries(t.tracks)){let i=n.lastIndexOf("."),c=n.slice(0,i),s=n.slice(i+1);s in j&&u(e,c,s,Xn(a,o));}}var xe=["neutral","happy","sad","angry","surprised","scared","tired","hurt"];function Jn(e){return typeof e=="string"&&xe.includes(e)}var Hr={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"]},qt={neutral:{add:{},tempo:1},happy:{add:{"head.rx":.08},tempo:1.1},sad:{add:{"head.rx":-0.3,"body.rx":-0.08,"tail.rx":.5},tempo:.8},angry:{add:{"body.rx":-0.12,"head.rx":.1,"armL.rz":-0.1,"armR.rz":.1},tempo:1.1},surprised:{add:{"head.rx":.15,"body.rx":.05},tempo:1},scared:{add:{"body.rx":-0.1,"head.rx":-0.1,"armL.rx":.3,"armR.rx":.3,"tail.rx":.6},tempo:1.3},tired:{add:{"head.rx":-0.35,"body.rx":-0.12},tempo:.7},hurt:{add:{"body.rx":-0.1},tempo:1}};function Dr(e,t,r){if(!(r<=0))for(let[o,n]of Object.entries(qt[t].add)){let a=o.lastIndexOf(".");pe(e,o.slice(0,a),o.slice(a+1),(n??0)*r);}}var Ci={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 Mi(e){let t=[[/(>:\(|😠|😡|🤬)/u,"angry"],[/(:'\(|😢|😭)/u,"sad"],[/(:\(|☹|🙁|😞)/u,"sad"],[/(:o|:O|😮|😲)/u,"surprised"],[/(😱|😨)/u,"scared"],[/(-_-|😴|😩|🥱)/u,"tired"],[/(:\)|:D|\^\^|😀|😃|😄|😁|🙂|😊|😂)/u,"happy"]];for(let[r,o]of t)if(r.test(e))return o;return null}var Zn=[{state:"dead",when:e=>e.dead,clip:"dead",blend:.25},{state:"sleep",when:e=>e.sleeping,clip:"sleep",blend:.3},{state:"ride",when:e=>e.riding,clip:"ride",blend:.2},{state:"sit",when:e=>e.sitting,clip:"sit",blend:.3},{state:"swim",when:e=>e.inWater&&!e.onGround&&!e.flying,clip:"swim",blend:.3},{state:"glide",when:e=>e.gliding,clip:"glide",blend:.25},{state:"fly",when:e=>e.flying,clip:"fly",blend:.25},{state:"fall",when:(e,t)=>t.airTime>.35&&e.vy<-4,clip:"fall",blend:.2},{state:"sneak",when:e=>e.sneaking,clip:"sneak",blend:.15},{state:"run",when:e=>e.sprinting&&e.speed>3||e.speed>6.5,clip:"run",blend:.15},{state:"walk",when:e=>e.speed>.4,clip:"walk",blend:.15},{state:"idle",when:()=>true,clip:"idle",blend:.2}],Qn=new Set(["hurt","land"]),ea={eat:"eat",drink:"drink",draw:"draw",block:"block"},ta={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)]]},gt=e=>{let t=Math.max(0,Math.min(1,e));return t*t*(3-2*t)},xt=class{rig;style;faces;pose=new Map;expression="neutral";state="idle";stateT=0;clock=0;phase=0;airTime=0;wasOnGround=true;loco=new Map;from=new Map;lastLoco=new Map;blendT=1;blendDur=.2;tmp=new Map;actions=[];useClip=null;useW=0;emote=null;mood="neutral";moodOverGestures=false;flash=null;postureW=new Map;blinkT=3;blinking=0;talkT=0;springs=new Map;constructor(t,r,o=[]){this.rig=t,this.style=Gt(r),this.faces=new Set(o);}setRandom(t){this.random=t;}random=Math.random;setStyle(t){this.style=Gt(t);}setEmotion(t,r){r&&r>0?this.flash={emotion:t,left:r}:this.mood=t;}get emotion(){return this.emote?.def.emotion&&!this.moodOverGestures?this.emote.def.emotion:this.flash?.emotion??this.mood}get emoting(){return this.emote?.id??null}playEmote(t){this.emote={id:t,def:yt[t],t:0};}stopEmote(){this.emote=null;}trigger(t){switch(t){case "swing":case "place":case "throw":case "hurt":case "land":{let r=t;this.actions=this.actions.filter(o=>o.clip!==r),this.actions.push({clip:r,t:0,dur:Fr[r]??.3}),t==="hurt"&&this.setEmotion("hurt",.8);break}}}update(t,r=ht()){t=Math.min(t,.1),this.clock+=t;let o=this.emotion,n=qt[o].tempo*this.style.tempo;!r.onGround&&!r.inWater?this.airTime+=t:(!this.wasOnGround&&this.airTime>.3&&r.onGround&&this.trigger("land"),this.airTime=0),this.wasOnGround=r.onGround,this.phase+=r.speed*t*3.5*n;let a=Zn.find(l=>l.when(r,this));a.state!==this.state&&(pt(this.from,this.lastLoco),this.state=a.state,this.stateT=0,this.blendT=0,this.blendDur=a.blend),this.stateT+=t,Ae(this.loco);let i=zr[this.rig]?.[a.clip]??a.clip,c={t:this.stateT,k:0,phase:this.phase,input:r,style:this.style,clock:this.clock*n};if(ut[i](this.loco,c),Ae(this.pose),this.blendT<this.blendDur?(this.blendT+=t,Ir(this.pose,this.from,this.loco,gt(this.blendT/this.blendDur))):pt(this.pose,this.loco),pt(this.lastLoco,this.pose),this.emote){let l=this.emote;if(l.t+=t,r.speed>1||this.state!=="idle"||!l.def.loop&&l.t>=l.def.duration)this.emote=null;else {let p=l.def.loop?gt(l.t/.15):gt(Math.min(l.t/.15,(l.def.duration-l.t)/.15));Ae(this.tmp),Nr(this.tmp,l.def,l.t),this.overlay(this.tmp,p,false);}}let s=r.use?ea[r.use]:null;s&&(this.useClip=s),this.useW=Math.max(0,Math.min(1,this.useW+(s?t:-t)*8)),this.useClip&&this.useW>0?(Ae(this.tmp),ut[this.useClip](this.tmp,{...c,t:this.clock}),this.overlay(this.tmp,gt(this.useW),false)):r.held!=="none"&&!this.emote&&pe(this.pose,"armR","rx",r.held==="staff"?.35:.2);for(let l of this.actions){l.t+=t;let h=Math.min(1,l.t/l.dur);Ae(this.tmp),ut[l.clip](this.tmp,{...c,t:l.t,k:h}),this.overlay(this.tmp,1,Qn.has(l.clip));}this.actions=this.actions.filter(l=>l.t<l.dur),this.state!=="dead"&&this.state!=="sleep"&&(pe(this.pose,"head","ry",Math.max(-1.1,Math.min(1.1,r.lookYaw))),pe(this.pose,"head","rx",Math.max(-1.2,Math.min(1.2,r.lookPitch)))),this.flash&&(this.flash.left-=t)<=0&&(this.flash=null);for(let l of xe){let h=this.postureW.get(l)??0,m=h+((l===o?1:0)-h)*Math.min(1,t*6);this.postureW.set(l,m),this.state!=="dead"&&Dr(this.pose,l,m);}for(let[l,h]of Object.entries(ta))for(let[m,p]of h(r,this.clock)){let y=l+"."+m,x=this.springs.get(y);x||this.springs.set(y,x={x:p,v:0});let b=60,T=9;x.v+=(b*(p-x.x)-T*x.v)*t,x.x+=x.v*t,pe(this.pose,l,m,x.x);}return this.expression=this.face(r,t,o),this.pose}overlay(t,r,o){for(let[n,a]of t){let i=De(this.pose,n);for(let c=0;c<9;c++)o?c>=j.sx?i[c]=i[c]*(1+(a[c]-1)*r):i[c]=i[c]+(a[c]-He[c])*r:i[c]=i[c]+(a[c]-i[c])*r;}}face(t,r,o){let n=i=>i.find(c=>this.faces.has(c))??"neutral";if(t.dead||this.state==="dead"||t.sleeping)return n(["blink","hurt","neutral"]);let a=n(Hr[o]);return t.viseme!==void 0?(this.talkT=0,t.viseme!=="rest"&&t.viseme!=="MBP"?n(["talk",a]):a):t.talk?(this.talkT+=r,Math.floor(this.talkT/.12)%2===0?n(["talk",a]):a):(this.talkT=0,this.blinking>0?(this.blinking-=r,n(["blink",a])):(this.blinkT-=r,this.blinkT<=0&&(this.blinkT=2.5+this.random()*3,o!=="surprised"&&o!=="scared"&&o!=="hurt"&&(this.blinking=.13)),a))}};var ra={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"}},oa={handR:"handR",handL:"handL",head:"headTop"},wt=class{view;animator;input=ht();seed;pose="idle";jumpT=-1;constructor(t,r={}){this.view=new mt(t,{shadows:false,...r}),this.seed=r.seed??1,this.animator=this.newAnimator();}get group(){return this.view.group}get height(){return this.view.height}setSpec(t){let r=this.view.hash;this.view.setSpec(t),this.view.hash!==r&&(this.animator=this.newAnimator());}setEmotion(t){this.animator.setEmotion(t);}setViseme(t){this.input.viseme=t;}setPose(t){if(t===this.pose)return;this.pose=t;let r=ra[t];this.input.speed=r.speed??0,this.input.sitting=!!r.sitting,r.emote&&this.animator.playEmote(r.emote),r.air&&(this.jumpT=0,this.animator.trigger("jump"));}playEmote(t){this.animator.playEmote(t);}trigger(t){if(t==="jump"){this.jumpT=0,this.animator.trigger("jump");return}this.animator.trigger(t);}attach(t,r){this.view.attach(oa[t],r);}update(t){let r=this.input;this.jumpT>=0&&(this.jumpT+=t,r.onGround=this.jumpT>.6,r.vy=this.jumpT<.3?4:-4,r.onGround&&(this.jumpT=-1,r.vy=0,this.animator.trigger("land")));let o=this.animator.update(t,r);this.view.applyPose(o),this.view.setExpression(this.animator.expression);}dispose(){this.view.dispose();}newAnimator(){let t=this.view.spec,r=new xt(t.rig,t.style,this.view.expressions);return r.setRandom(rt(this.seed)),r}};var na=Be.map(e=>{let t=ie[e],r=t.bones.map(n=>`${n.name}@[${n.pivot.join(",")}]`).join(" "),o=t.defaultParts.map(n=>`${n.bone} ${n.size.join("x")} at [${n.pos.join(",")}]`).join("; ");return `- "${e}" \u2014 ${t.hint}. Bones (name@pivot): ${r}. Default body: ${o}.`}).join(`
|
|
25
|
-
`),
|
|
24
|
+
#endif`);}function ta(e,t,r){if(!e)return new V__namespace.MeshLambertMaterial(r);let a=new V__namespace.MeshStandardMaterial({...r,roughness:t,metalness:0});return a.onBeforeCompile=Sr,a}function vs(e,t){if(e==="glass"){if(!t)return new V__namespace.MeshLambertMaterial({transparent:true,opacity:.5,depthWrite:false});let a=new V__namespace.MeshStandardMaterial({transparent:true,opacity:.42,depthWrite:false,roughness:.08,metalness:.2});return a.onBeforeCompile=Sr,a}if(e==="glow"){let a={emissive:16777215,emissiveIntensity:.85};return t?new V__namespace.MeshStandardMaterial({...a,roughness:.6}):new V__namespace.MeshLambertMaterial(a)}if(!t)return new V__namespace.MeshLambertMaterial({alphaTest:.5});let r=new V__namespace.MeshStandardMaterial({alphaTest:.5,roughness:.28,metalness:.85});return r.onBeforeCompile=Sr,r}var co=5921370;function mo(e){let t=(r,a)=>r.replace(`#include <${a}>`,V__namespace.ShaderChunk[a].replace("varying vec2 vMapUv","centroid varying vec2 vMapUv"));e.vertexShader=t(e.vertexShader,"uv_pars_vertex"),e.fragmentShader=t(e.fragmentShader,"uv_pars_fragment");}function Ts(e){mo(e),Sr(e);}var Er=class{group=new V__namespace.Group;root=new V__namespace.Group;asset;spec;bones=new Map;byRole=new Map;meshes=[];material;decalMat;gloss;decal=null;expression=null;sockets=new Map;attached=new Map;label=null;shadows;layer;brightness=1;painter;prints=[];printMeshes=[];printMats=new Map;partMats=new Map;emotion;constructor(t=mt(),r={}){this.spec=t,this.shadows=r.shadows??true,this.layer=r.layer??0,this.painter=r.facePainter??null,this.gloss=r.gloss??false,this.material=ta(this.gloss,xs,{alphaTest:.5}),this.material.onBeforeCompile=this.gloss?Ts:mo,this.decalMat=ta(this.gloss,lo,{alphaTest:.5,polygonOffset:true,polygonOffsetFactor:-2,polygonOffsetUnits:-2}),this.group.add(this.root),this.asset=Xr(t),this.build(),r.name&&this.setName(r.name);}get height(){let t=this.asset.layout;return t.height*t.scale*Kt}get eye(){let t=this.asset.layout;return t.eye*t.scale*Kt}get expressions(){return Object.keys(this.asset.layout.face?.uv??{})}get hash(){return this.asset.layout.hash}setSpec(t){let r=Xr(t);if(r===this.asset){wr(r);return}this.clear(),wr(this.asset),this.asset=r,this.spec=t,this.build();}build(){let{layout:t,skinned:r,texture:a}=this.asset;this.material.map=a,this.material.needsUpdate=true,this.useFaceMap(),this.root.scale.setScalar(t.scale*Kt);let o=new Map(t.bones.map(m=>[m.name,m.pivot])),n=[],s=[];for(let m of t.bones){let h=new V__namespace.Bone;n.push(h),s.push(new V__namespace.Matrix4().makeTranslation(-m.pivot[0],-m.pivot[1],-m.pivot[2]));let d=m.parent?o.get(m.parent)??[0,0,0]:[0,0,0],p=[m.pivot[0]-d[0],m.pivot[1]-d[1],m.pivot[2]-d[2]];h.position.set(...p);let g={name:m.name,role:m.role,group:h,rest:p};this.bones.set(m.name,g);let b=this.byRole.get(m.role)??[];b.push(g),this.byRole.set(m.role,b);}for(let m of t.bones){let h=this.bones.get(m.name);((m.parent?this.bones.get(m.parent):void 0)?.group??this.root).add(h.group);}let l=new V__namespace.Skeleton(n,s),i=(m,h,d)=>{let p=new V__namespace.SkinnedMesh(m,h);p.bind(l,new V__namespace.Matrix4);let g=(r??m).boundingSphere;g&&(p.boundingSphere=new V__namespace.Sphere(g.center.clone(),g.radius*1.6)),p.castShadow=d&&this.shadows,p.receiveShadow=this.shadows,p.layers.set(this.layer),this.meshes.push(p),this.root.add(p);};r&&i(r,this.material,true);for(let[m,h]of this.asset.skinnedMats){let d=this.partMats.get(m);d||this.partMats.set(m,d=vs(m,this.gloss)),d.map=this.asset.texture,m==="glow"&&(d.emissiveMap=this.asset.texture),d.needsUpdate=true,i(h,d,m!=="glass");}let c=t.face;if(c){let m=new V__namespace.BufferGeometry,h=c.grid;if(h){m.setAttribute("position",new V__namespace.BufferAttribute(h.positions,3)),m.setAttribute("normal",new V__namespace.BufferAttribute(h.normals,3)),m.setAttribute("uv",new V__namespace.BufferAttribute(new Float32Array(h.t.length),2));let d=[],p=h.cols+1;for(let g=0;g<h.rows;g++)for(let b=0;b<h.cols;b++){let E=g*p+b;d.push(E,E+p+1,E+1,E,E+p,E+p+1);}m.setIndex(d);}else {m.setAttribute("position",new V__namespace.BufferAttribute(c.corners,3));let d=new Float32Array(12);for(let p=0;p<4;p++)d[p*3+2]=-1;m.setAttribute("normal",new V__namespace.BufferAttribute(d,3)),m.setAttribute("uv",new V__namespace.BufferAttribute(new Float32Array(8),2)),m.setIndex([0,2,1,0,3,2]);}this.decal=new V__namespace.Mesh(m,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 m of t.sockets){let h=new V__namespace.Object3D;h.position.set(...m.at),h.scale.setScalar(1/(t.scale*Kt)),this.bones.get(m.bone)?.group.add(h),this.sockets.set(m.name,h);let d=this.attached.get(m.name);d&&h.add(d);}this.buildPrints(),this.placeLabel(),this.setBrightness(this.brightness);}setPrints(t){this.prints=t??[],this.buildPrints(),this.setBrightness(this.brightness);}buildPrints(){for(let a of this.printMeshes)a.removeFromParent(),a.geometry.dispose();this.printMeshes=[];let t=new Set,r=new Map;for(let a of this.prints){let o=this.bones.get(a.bone),n=this.asset.layout.bones.find(m=>m.name===a.bone);if(!o||!n)continue;let s=this.printMats.get(a.texture);s||(s=ta(this.gloss,lo,{map:a.texture,emissiveMap:a.texture,emissive:co,transparent:true,alphaTest:.02,polygonOffset:true,polygonOffsetFactor:-2,polygonOffsetUnits:-2}),this.printMats.set(a.texture,s)),t.add(a.texture);let l=new V__namespace.PlaneGeometry(a.w,a.h);a.facing==="front"&&l.rotateY(Math.PI),l.translate(a.center[0]-n.pivot[0],a.center[1]-n.pivot[1],a.center[2]-n.pivot[2]);let i=`${a.bone}|${a.texture.uuid}`,c=r.get(i)??{node:o,mat:s,geos:[]};c.geos.push(l),r.set(i,c);}for(let{node:a,mat:o,geos:n}of r.values()){let s=n.length===1?n[0]:BufferGeometryUtils_js.mergeGeometries(n)??n[0];if(s!==n[0])for(let i of n)i.dispose();let l=new V__namespace.Mesh(s,o);l.layers.set(this.layer),a.group.add(l),this.printMeshes.push(l);}for(let[a,o]of this.printMats)t.has(a)||(o.dispose(),this.printMats.delete(a));}clear(){for(let t of this.sockets.values())for(let r of [...t.children])t.remove(r);this.root.clear();for(let t of this.printMeshes)t.geometry.dispose();this.printMeshes=[],this.decal?.geometry.dispose(),this.decal=null;for(let t of this.meshes)t instanceof V__namespace.SkinnedMesh&&t.skeleton.dispose();this.meshes=[],this.bones=new Map,this.byRole=new Map,this.sockets.clear();}applyPose(t){let r=t.get("root");if(r){this.root.rotation.set(r[re.rx],r[re.ry],r[re.rz]);let a=this.asset.layout.scale*Kt;this.root.position.set(r[re.px]*a,r[re.py]*a,r[re.pz]*a);}else this.root.rotation.set(0,0,0),this.root.position.set(0,0,0);for(let[a,o]of this.byRole){let n=t.get(a);for(let s of o){let l=s.group;if(!n){l.rotation.set(0,0,0),l.position.set(...s.rest),l.scale.set(1,1,1);continue}l.rotation.set(n[re.rx],n[re.ry],n[re.rz]),l.position.set(s.rest[0]+n[re.px],s.rest[1]+n[re.py],s.rest[2]+n[re.pz]),l.scale.set(n[re.sx],n[re.sy],n[re.sz]);}}}setFacePainter(t){if(t===this.painter)return;this.painter=t,this.useFaceMap();let r=this.expression??"neutral";this.expression=null,this.setExpression(r);}useFaceMap(){let t=this.painter;this.decalMat.map=t?t.texture:this.asset.texture,this.decalMat.transparent=!!t,this.decalMat.alphaTest=t?.02:.5,this.decalMat.needsUpdate=true;}setExpression(t,r){if(t===this.expression&&(!this.painter||r===this.emotion)||!this.decal)return;let a=this.asset.layout.face?.uv,o=this.painter?[0,1,1,0]:a?.[t]??a?.neutral;if(!o)return;this.expression=t,this.emotion=r,this.painter?.paint(t,r);let[n,s,l,i]=o,c=this.decal.geometry.getAttribute("uv"),m=this.asset.layout.face?.grid;if(m)for(let h=0;h<c.count;h++)c.setXY(h,n+(l-n)*m.t[h*2],s+(i-s)*m.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||co);for(let[r,a]of this.partMats)r!=="glow"&&a.emissive.setHex(t);}}setShadows(t){if(t!==this.shadows){this.shadows=t;for(let r of this.meshes)r.castShadow=t&&!r.material.transparent;}}attach(t,r){let a=this.attached.get(t);if(a!==r){if(a&&a.removeFromParent(),!r){this.attached.delete(t);return}this.attached.set(t,r),this.sockets.get(t)?.add(r);}}attachedAt(t){return this.attached.get(t)??null}setName(t){this.label&&ea(this.label),this.label=t?so(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&&ea(this.label),this.label=null,this.material.dispose(),this.decalMat.dispose();for(let t of this.printMats.values())t.dispose();this.printMats.clear();for(let t of this.partMats.values())t.dispose();this.partMats.clear(),wr(this.asset);}};var vr=new Map,ra=new Set;function Ol(e){let t=Et(e);if(!vr.has(t)){vr.set(t,e);for(let r of ra)r(t);}return t}function Fl(e){return typeof e=="string"?vr.get(e):void 0}function Dl(e){let t={};for(let r of e){let a=vr.get(r);a&&(t[r]=a);}return t}function Nl(e){return ra.add(e),()=>ra.delete(e)}var Ls=["#b08a62","#8a6a4a","#c8a878","#9a9a92","#7a5c44"],Ms=["#f1c9a5","#e6b892","#d9a982","#c08e68","#a0704c","#7a5238"],Cs=["#6b4a2f","#4a3424","#8a5a3a","#c27a48","#d8b878","#2e2622","#a07850","#9a9690"],zs=["#a7bea9","#e6e0cc","#d9c9a3","#b9a083","#a9b8c4","#c8b4a0","#9fb0a0","#d8d2c4","#b98f74","#8fa3b5"],Ps=["#8c9ca6","#a9b8b4","#8a8e94","#9fb3ad","#7d8a8f","#b0a58f"],Is=["#d9c9a3","#c8b48a","#a08a6a","#e6e0cc"];function Gl(e,t="",r=""){let a=fr(lt("npc:"+e+"|"+t)),o=l=>l[Math.floor(a()*l.length)],n=Zr({top:o(ao),bottom:o(oo),shoes:o(no),hair:o(["short","short","long","curly"]),hat:a()<.2,colors:{skin:o(Ms),hair:o(Cs),shirt:o(zs),pants:o(Ps),boots:o(Ls),hat:o(Is)}});n.name=e.slice(0,40),n.description=[t,r].filter(Boolean).join(" \u2014 ").slice(0,300),n.style={walk:o(["normal","normal","bouncy","heavy","sneaky"]),idle:o(["calm","calm","fidgety","proud"]),energy:Math.round(a()*10)/10},n.tags=["npc",...t?[t.slice(0,24)]:[]];let s=Oe(n);return s.ok?s.spec:mt()}var We=([e,t,r])=>"#"+[e,t,r].map(a=>Math.round(a).toString(16).padStart(2,"0")).join("");function _s(e){if(!e.length)return null;let t=r=>{let a=e.map(o=>o[r]).sort((o,n)=>o-n);return a[a.length>>1]};return [t(0),t(1),t(2)]}function Os(e,t){let{width:r,height:a,data:o}=e,n=(v,M)=>{let R=(M*r+v)*4;return [o[R],o[R+1],o[R+2]]},s=[n(0,0),n(r-1,0),n(0,a-1),n(r-1,a-1)],l=[0,1,2].map(v=>s.reduce((M,R)=>M+R[v],0)/4),i=v=>Math.abs(v[0]-l[0])+Math.abs(v[1]-l[1])+Math.abs(v[2]-l[2])>60,c=r,m=-1,h=a,d=-1;for(let v=0;v<a;v+=2)for(let M=0;M<r;M+=2)i(n(M,v))&&(c=Math.min(c,M),m=Math.max(m,M),h=Math.min(h,v),d=Math.max(d,v));m<0&&(c=0,m=r-1,h=0,d=a-1);let p=d-h+1,g=m-c+1,b=c+Math.floor(g*.3),E=c+Math.ceil(g*.7);return t.map(([v,M])=>{let R=[];for(let A=h+Math.floor(p*v);A<h+Math.ceil(p*M);A++)for(let y=b;y<E;y++){if(A<0||A>=a||y<0||y>=r)continue;let z=n(y,A);i(z)&&R.push(z);}return _s(R)})}var Fs=[[0,.06],[.1,.22],[.3,.52],[.6,.86],[.92,1]];function Kl(e,t="humanoid",r=gr()){let[a,o,n,s,l]=Os(e,Fs);if(t==="humanoid"){let c=JSON.parse(JSON.stringify(Qr));c.palette=Jr(c.palette,{...a?{hair:We(a)}:{},...o?{skin:We(o)}:{},...n?{shirt:We(n)}:{},...s?{pants:We(s)}:{},...l?{boots:We(l)}:{}}),c.name=r,c.tags=[];let m=Oe(c);return m.ok?m.spec:mt()}let i=Oe({name:r,rig:t,palette:{s:We(o??a??[198,156,124]),t:We(n??[58,143,214]),p:We(s??l??[44,62,107]),w:"#f4f4f4",b:"#1d1d21"},textures:{f_neutral:{w:4,h:2,rows:["wbbw","...."]},f_blink:{w:4,h:2,rows:["bbbb","...."]}},face:{rect:t==="blob"?[4,4,4,2]:t==="flyer"?[0,1,4,2]:[2,2,4,2],expressions:{neutral:"f_neutral",blink:"f_blink"}}});return i.ok?i.spec:mt()}var Ds={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}},Ns={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 aa(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",...Ds[e.walk],...Ns[e.idle]};return t.tempo*=.8+.4*e.energy,t.amp*=.85+.3*e.energy,t}function dt(e,t=0){let r=Math.sin(e.phase+t);return e.style.quant?Math.max(-1,Math.min(1,r*3)):r}function oa(e,t,r){let a=dt(t)*r;f(e,"legL","rx",a),f(e,"legR","rx",-a),f(e,"legFL","rx",a),f(e,"legBR","rx",a),f(e,"legFR","rx",-a),f(e,"legBL","rx",-a);}function na(e,t,r){let a=dt(t)*r;f(e,"armL","rx",-a),f(e,"armR","rx",a);}function sa(e,t,r,a){let o=dt(t),n=Math.max(0,Math.cos(t.phase))*Math.max(0,-o+.3),s=Math.max(0,-Math.cos(t.phase))*Math.max(0,o+.3);f(e,"shinL","rx",-r*(.15+n)),f(e,"shinR","rx",-r*(.15+s)),f(e,"foreArmL","rx",a*(.6+.4*Math.max(0,-o))),f(e,"foreArmR","rx",a*(.6+.4*Math.max(0,o)));}var Bs=(e,t)=>{let r=Math.sin(t.clock*2)*t.style.breath;f(e,"armL","rz",-0.04-.03*r),f(e,"armR","rz",.04+.03*r),f(e,"foreArmL","rx",.12+.02*r),f(e,"foreArmR","rx",.12+.02*r),f(e,"head","rx",.03*Math.sin(t.clock*1.7)+t.style.chest),f(e,"body","rx",t.style.chest*-0.5),t.style.fidget&&(f(e,"head","ry",.35*Math.sin(t.clock*.7)*Math.sin(t.clock*.31)),f(e,"root","ry",.05*Math.sin(t.clock*.9))),f(e,"body","sy",1+.04*Math.sin(t.clock*3)),Vs(e,t);};function Vs(e,t){let r=Math.sin(t.clock*2);switch(t.style.pose){case "hips":f(e,"armL","rz",-0.75),f(e,"armR","rz",.75),f(e,"foreArmL","rx",.2),f(e,"foreArmR","rx",.2),f(e,"foreArmL","rz",1.5),f(e,"foreArmR","rz",-1.5),f(e,"legL","rz",-0.06),f(e,"legR","rz",.06);break;case "shy":f(e,"armL","rx",-0.35),f(e,"armR","rx",-0.35),f(e,"foreArmL","rx",.5),f(e,"foreArmR","rx",.5),f(e,"head","rx",-0.15+.03*r),f(e,"legR","rx",.15+.08*Math.sin(t.clock*1.3)),f(e,"shinR","rx",-0.3);break;case "ready":f(e,"legL","rz",-0.16),f(e,"legR","rz",.16),f(e,"legL","rx",.25),f(e,"legR","rx",-0.15),f(e,"shinL","rx",-0.35),f(e,"shinR","rx",-0.25),f(e,"armL","rx",.9),f(e,"armR","rx",.7),f(e,"foreArmL","rx",1.4),f(e,"foreArmR","rx",1.5),f(e,"root","py",-0.6+.3*Math.abs(Math.sin(t.clock*3.2)));break;case "bored":f(e,"root","rz",.04),f(e,"legL","rz",-0.04),f(e,"shinR","rx",-0.25),f(e,"legR","rx",.12),f(e,"head","rz",.12+.03*r),f(e,"body","rx",-0.06);break;}}var Hs=(e,t)=>{oa(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));f(e,"root","py",r),f(e,"body","rz",t.style.sway*dt(t)),js(e,t);};function js(e,t){let r=t.style;if(r.reach&&(f(e,"armL","rx",r.reach+.05*Math.sin(t.phase)),f(e,"armR","rx",r.reach-.05*Math.sin(t.phase)),f(e,"foreArmL","rx",.1),f(e,"foreArmR","rx",.1),f(e,"head","rz",.15*Math.sin(t.phase*.5))),r.crouch&&(f(e,"root","py",-r.crouch),f(e,"body","rx",-0.3),f(e,"head","rx",.25),pe(e,"shinL","rx",-0.5),pe(e,"shinR","rx",-0.5),pe(e,"legL","rx",.35),pe(e,"legR","rx",.35),f(e,"armL","rx",-0.9),f(e,"armR","rx",-0.9)),r.skip){let a=Math.max(0,Math.sin(t.phase));pe(e,"root","py",2.2*r.skip*a*a),pe(e,"armL","rz",-0.3*a),pe(e,"armR","rz",.3*a);}r.cross&&(f(e,"legL","rz",r.cross),f(e,"legR","rz",-r.cross),f(e,"root","ry",.12*dt(t))),r.swagger&&(f(e,"body","ry",r.swagger*dt(t)),f(e,"head","rz",-0.5*r.swagger*dt(t)),f(e,"armL","rz",-0.2),f(e,"armR","rz",.2));}var Gs=(e,t)=>{oa(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),f(e,"body","rx",-0.18),f(e,"head","rx",.18),f(e,"root","py",(.8+t.style.bob)*Math.abs(Math.cos(t.phase)));},Us=(e,t)=>{oa(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)),f(e,"body","rx",-0.45),f(e,"head","rx",.45),pe(e,"armL","rx",.25),pe(e,"armR","rx",.25),sa(e,t,.9,.6),f(e,"root","py",-1.5);},qs=(e,t)=>{f(e,"root","rx",-1.3),f(e,"head","rx",1),f(e,"armL","rx",Math.PI-.5+.5*Math.sin(t.t*3)),f(e,"armR","rx",Math.PI-.5+.5*Math.sin(t.t*3+Math.PI)),f(e,"legL","rx",.3*Math.sin(t.t*8)),f(e,"legR","rx",-0.3*Math.sin(t.t*8));},Ys=(e,t)=>{f(e,"legL","rx",.15),f(e,"legR","rx",.1),f(e,"armL","rz",-0.15),f(e,"armR","rz",.15),f(e,"root","py",.6*Math.sin(t.t*2));},$s=e=>{f(e,"root","rx",-1.35),f(e,"head","rx",1.1),f(e,"armL","rz",-1.3),f(e,"armR","rz",1.3);},Ks=(e,t)=>{let r=.15*Math.sin(t.t*10);f(e,"armL","rz",-0.6-r),f(e,"armR","rz",.6+r),f(e,"legL","rx",.25),f(e,"legR","rx",-0.25),f(e,"shinL","rx",-0.5),f(e,"shinR","rx",-0.3),f(e,"foreArmL","rx",.4),f(e,"foreArmR","rx",.4);},Xs=e=>{f(e,"legL","rx",1.45),f(e,"legR","rx",1.45),f(e,"legL","ry",.1),f(e,"legR","ry",-0.1),f(e,"shinL","rx",-1.45),f(e,"shinR","rx",-1.45),f(e,"root","py",-10),f(e,"body","rx",.4),f(e,"legBL","rx",1.2),f(e,"legBR","rx",1.2);},Ws=e=>{f(e,"legL","rx",1.4),f(e,"legR","rx",1.4),f(e,"legL","rz",-0.3),f(e,"legR","rz",.3),f(e,"armL","rx",.45),f(e,"armR","rx",.45),f(e,"shinL","rx",-1.2),f(e,"shinR","rx",-1.2),f(e,"foreArmL","rx",.5),f(e,"foreArmR","rx",.5);},Js=e=>{f(e,"root","rx",Math.PI/2),f(e,"root","py",2);},Zs=e=>{f(e,"root","rz",Math.PI/2),f(e,"root","py",2);},Qs=(e,t)=>{let r=Math.sin(t.phase*.5);f(e,"root","py",6*Math.max(0,r));let a=r<0?.2*-r:0;f(e,"body","sy",1-a+.1*Math.max(0,r)),f(e,"body","sx",1+a*.6),f(e,"body","sz",1+a*.6);},ei=(e,t)=>{let r=Math.min(t.input.speed,8),a=Math.sin(t.clock*(3+r*1.2)),o=.25+r*.04;f(e,"tail","ry",o*1.6*a),f(e,"body","ry",-o*.35*a),f(e,"root","py",.4*Math.sin(t.clock*1.6));},ti=(e,t)=>{let r=Math.sin(Math.PI*t.k);f(e,"armR","rx",1.9*r),f(e,"armR","ry",.3*r),f(e,"body","ry",-0.3*r),f(e,"foreArmR","rx",.6*r);},ri=(e,t)=>{let r=Math.sin(Math.PI*t.k);f(e,"armR","rx",.9*r);},ai=(e,t)=>{let r=t.k<.4?-1.5*(t.k/.4):-1.5+3.5*((t.k-.4)/.6);f(e,"armR","rx",t.k>.9?r*(1-t.k)*10:r);},oi=(e,t)=>{let r=Math.sin(Math.PI*t.k);f(e,"body","rx",.15*r),f(e,"head","rx",.2*r),f(e,"root","rz",.05*r);},ni=(e,t)=>{let r=Math.sin(Math.PI*t.k);f(e,"root","py",-1.5*r),f(e,"legL","rx",.2*r),f(e,"legR","rx",.2*r),f(e,"shinL","rx",-0.5*r),f(e,"shinR","rx",-0.5*r),f(e,"body","sy",1-.2*r),f(e,"body","sx",1+.12*r),f(e,"body","sz",1+.12*r);},si=(e,t)=>{f(e,"armR","rx",1.3+.1*Math.sin(t.t*16)),f(e,"armR","ry",-0.5),f(e,"head","rx",-0.1+.08*Math.sin(t.t*16));},ii=e=>{f(e,"armR","rx",2),f(e,"armR","ry",-0.4),f(e,"head","rx",.35);},li=e=>{f(e,"armR","rx",1.57),f(e,"armR","ry",-0.1),f(e,"armL","rx",1.57),f(e,"armL","ry",.35);},ci=e=>{f(e,"armL","rx",.9),f(e,"armL","ry",-0.6);},Tr={idle:Bs,walk:Hs,run:Gs,sneak:Us,swim:qs,fly:Ys,glide:$s,fall:Ks,sit:Xs,ride:Ws,sleep:Js,dead:Zs,hop:Qs,swing:ti,place:ri,throw:ai,hurt:oi,land:ni,eat:si,drink:ii,draw:li,block:ci,fin:ei},po={blob:{walk:"hop",run:"hop",sneak:"hop"},swimmer:{idle:"fin",walk:"fin",run:"fin",sneak:"fin",swim:"fin",fall:"fin"}},ho={swing:.3,place:.2,throw:.45,hurt:.3,land:.22};function ae(e,t,r=.3){let a={};for(let[o,n]of Object.entries(t))a[o]=[[0,0],[r,n],[Math.max(r,e-r),n],[e,0]];return a}function N(e,t){let r={};for(let[a,o]of Object.entries(t))r[a]=[[0,o],[e,o]];return r}function x(e,t,r,a,o,n=0,s=false){let l=Math.max(8,Math.round(o*8)),i=[];for(let c=0;c<=l;c++){let m=c/l,h=s?Math.min(1,m/.15,(1-m)/.15):1;i.push([e*m,(r+a*Math.sin(Math.PI*2*o*m+n))*h]);}return {[t]:i}}function Je(e,t){return [[0,t],[e,t]]}function S(e,t){return t.map(([r,a])=>[e*r,a])}function O(...e){return Object.assign({},...e)}var uo={"legL.rx":1.5,"legR.rx":1.5,"shinL.rx":-1.5,"shinR.rx":-1.5,"root.py":-6.2},mi=4.1,fo={"legL.rx":1.45,"legR.rx":1.45,"legL.ry":.75,"legR.ry":-0.75,"shinL.rx":-2.5,"shinR.rx":-2.5,"shinL.ry":-0.6,"shinR.ry":.6,"root.py":-10.2},Xt={"root.rx":Math.PI/2,"root.py":2.3,"root.pz":0};var ie=Math.PI,go={"armR.rx":.55,"foreArmR.rx":1.35,"armR.rz":-0.15},Wt={"armL.rx":.55,"foreArmL.rx":1.35,"armL.rz":.15},bo={...go,...Wt},yo={"armL.rx":.75,"armR.rx":.75,"foreArmL.rx":.85,"foreArmR.rx":.85,"head.rx":-0.2},be=(e,t)=>N(e,{...uo,...t}),Lr=(e,t,r,a)=>O(x(e,"legL.rx",0,r,t),x(e,"legR.rx",0,r,t,ie),x(e,"shinL.rx",-a,a,t,-ie/2),x(e,"shinR.rx",-a,a,t,ie/2)),ia={tiptoe:{label:"\u041D\u0430 \u0446\u044B\u043F\u043E\u0447\u043A\u0430\u0445",en:"Tiptoe",duration:1.6,loop:true,tracks:O(Lr(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}),x(1.6,"head.ry",0,.25,1))},limp:{label:"\u041A\u043E\u0432\u044B\u043B\u044F\u0442\u044C",en:"Limp",duration:1.6,loop:true,emotion:"hurt",tracks:{"legL.rx":S(1.6,[[0,.4],[.5,-0.3],[1,.4]]),"legR.rx":S(1.6,[[0,-0.15],[.5,.15],[1,-0.15]]),"shinL.rx":S(1.6,[[0,-0.2],[.25,-0.9],[.5,-0.1],[1,-0.2]]),"root.py":S(1.6,[[0,0],[.5,-1],[1,0]]),"body.rz":S(1.6,[[0,.04],[.5,-0.1],[1,.04]]),"armR.rz":Je(1.6,.2)}},crawl:{label:"\u041F\u043E\u043B\u0437\u0442\u0438",en:"Crawl",duration:1.6,loop:true,tracks:O(N(1.6,{"root.rx":-1.35,"root.py":3.2,"head.rx":1.1,"legL.rx":1.3,"legR.rx":1.3,"shinL.rx":-1.4,"shinR.rx":-1.4}),x(1.6,"armL.rx",2,.4,2),x(1.6,"armR.rx",2,.4,2,ie),x(1.6,"legL.ry",0,.15,2,ie),x(1.6,"legR.ry",0,.15,2))},climb:{label:"\u041B\u0435\u0437\u0442\u044C \u043F\u043E \u043B\u0435\u0441\u0442\u043D\u0438\u0446\u0435",en:"Climb",duration:1.6,loop:true,tracks:O(x(1.6,"armL.rx",2.6,.4,1),x(1.6,"armR.rx",2.6,.4,1,ie),x(1.6,"legL.rx",.7,.6,1,ie),x(1.6,"legR.rx",.7,.6,1),x(1.6,"shinL.rx",-1,.6,1,ie),x(1.6,"shinR.rx",-1,.6,1),N(1.6,{"head.rx":.4,"foreArmL.rx":.5,"foreArmR.rx":.5}))},jog:{label:"\u0411\u0435\u0433 \u0442\u0440\u0443\u0441\u0446\u043E\u0439",en:"Jog",duration:.9,loop:true,tracks:O(Lr(.9,1,.6,.6),x(.9,"armL.rx",0,.6,1,ie),x(.9,"armR.rx",0,.6,1),N(.9,{"foreArmL.rx":1.4,"foreArmR.rx":1.4,"body.rx":-0.1}),x(.9,"root.py",.8,.8,2))},carry:{label:"\u041D\u0435\u0441\u0442\u0438 \u043A\u043E\u0440\u043E\u0431\u043A\u0443",en:"Carry",duration:1,loop:true,layer:"upper",tracks:N(1,{"armL.rx":.9,"armR.rx":.9,"foreArmL.rx":.7,"foreArmR.rx":.7,"armL.rz":-0.25,"armR.rz":.25,"body.rx":.08})},push:{label:"\u0422\u043E\u043B\u043A\u0430\u0442\u044C",en:"Push",duration:1.4,loop:true,emotion:"determined",tracks:O(Lr(1.4,1,.3,.5),N(1.4,{"body.rx":-0.45,"head.rx":.4,"armL.rx":1.4,"armR.rx":1.4,"foreArmL.rx":.5,"foreArmR.rx":.5,"root.py":-0.8}))},pull:{label:"\u0422\u044F\u043D\u0443\u0442\u044C",en:"Pull",duration:1.4,loop:true,emotion:"determined",tracks:O(Lr(1.4,1,.25,.4),N(1.4,{"body.rx":.25,"armL.rx":1.2,"armR.rx":1.2,"foreArmL.rx":.3,"foreArmR.rx":.3,"root.py":-0.6}))},sitChair:{label:"\u0421\u0438\u0434\u0435\u0442\u044C \u043D\u0430 \u0441\u0442\u0443\u043B\u0435",en:"Sit on a chair",duration:2,loop:true,tracks:O(be(2,{"armL.rx":.4,"armR.rx":.4,"foreArmL.rx":.5,"foreArmR.rx":.5}),x(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,{...fo,"armL.rx":.5,"armR.rx":.5,"foreArmL.rx":.6,"foreArmR.rx":.6})},sitKneel:{label:"\u041D\u0430 \u043A\u043E\u043B\u0435\u043D\u044F\u0445",en:"Kneel",duration:2,loop:true,tracks:N(2,{"shinL.rx":-1.5,"shinR.rx":-1.5,"root.py":-6.1,"armL.rx":.2,"armR.rx":.2})},sitEdge:{label:"\u041D\u0430 \u043A\u0440\u0430\u044E",en:"Sit on the edge",duration:2.4,loop:true,tracks:O(be(2.4,{"armL.rz":-0.3,"armR.rz":.3,"armL.rx":-0.2,"armR.rx":-0.2}),x(2.4,"shinL.rx",-1.2,.3,2),x(2.4,"shinR.rx",-1.2,.3,2,ie))},sitLounge:{label:"\u0420\u0430\u0437\u0432\u0430\u043B\u0438\u0432\u0448\u0438\u0441\u044C",en:"Lounge",duration:2,loop:true,emotion:"cool",tracks:be(2,{"body.rx":.35,"head.rx":-0.2,"legL.rx":1.2,"shinL.rx":-0.6,"armL.rz":-2.6,"armR.rz":2.6,"foreArmL.rz":1.8,"foreArmR.rz":-1.8,"root.py":-6.8})},sitHug:{label:"\u041E\u0431\u0445\u0432\u0430\u0442\u0438\u0432 \u043A\u043E\u043B\u0435\u043D\u0438",en:"Hug knees",duration:2,loop:true,emotion:"sad",tracks:N(2,{"legL.rx":2.4,"legR.rx":2.4,"shinL.rx":-2.6,"shinR.rx":-2.6,"root.py":-10.2,"armL.rx":1,"armR.rx":1,"foreArmL.rx":.9,"foreArmR.rx":.9,"head.rx":-0.15,"body.rx":-0.15})},squat:{label:"\u041D\u0430 \u043A\u043E\u0440\u0442\u043E\u0447\u043A\u0430\u0445",en:"Squat",duration:2,loop:true,tracks:N(2,{"legL.rx":2,"legR.rx":2,"legL.rz":-0.2,"legR.rz":.2,"shinL.rx":-2.5,"shinR.rx":-2.5,"root.py":-7,"body.rx":-0.35,"head.rx":.3,"armL.rx":.7,"armR.rx":.7,"foreArmL.rx":.6,"foreArmR.rx":.6})},sitEat:{label:"\u0415\u0441\u0442\u044C \u0441\u0438\u0434\u044F",en:"Eat (seated)",duration:1.2,loop:true,tracks:O(be(1.2,{...Wt,"armR.rx":.9}),x(1.2,"foreArmR.rx",1.5,.45,1),x(1.2,"head.rx",-0.1,.06,2))},sitDrink:{label:"\u041F\u0438\u0442\u044C \u0441\u0438\u0434\u044F",en:"Drink (seated)",duration:2.4,loop:true,tracks:O(be(2.4,{}),{"armR.rx":S(2.4,[[0,.6],[.3,1.2],[.6,1.2],[1,.6]]),"foreArmR.rx":S(2.4,[[0,1.3],[.3,2],[.6,2],[1,1.3]]),"head.rx":S(2.4,[[0,0],[.3,.3],[.6,.3],[1,0]])})},sitRead:{label:"\u0427\u0438\u0442\u0430\u0442\u044C \u0441\u0438\u0434\u044F",en:"Read (seated)",duration:3,loop:true,tracks:O(be(3,{...bo,"head.rx":-0.3}),x(3,"head.ry",0,.08,1))},sitLaptop:{label:"\u0417\u0430 \u043D\u043E\u0443\u0442\u0431\u0443\u043A\u043E\u043C",en:"Laptop",duration:1.2,loop:true,tracks:O(be(1.2,yo),x(1.2,"foreArmL.rx",.85,.08,4),x(1.2,"foreArmR.rx",.85,.08,4,ie))},sitWrite:{label:"\u041F\u0438\u0441\u0430\u0442\u044C \u0441\u0438\u0434\u044F",en:"Write (seated)",duration:1.6,loop:true,tracks:O(be(1.6,{...yo,"armL.rx":.6}),x(1.6,"foreArmR.rz",0,.15,3),x(1.6,"head.rz",0,.05,1))},sitTalk:{label:"\u0413\u043E\u0432\u043E\u0440\u0438\u0442\u044C \u0441\u0438\u0434\u044F",en:"Talk (seated)",duration:2.4,loop:true,tracks:O(be(2.4,{"armL.rx":.6,"foreArmL.rx":1}),x(2.4,"armR.rx",.8,.3,2),x(2.4,"foreArmR.rx",1.2,.4,3),x(2.4,"head.rz",0,.08,2))},sitLaugh:{label:"\u0421\u043C\u0435\u044F\u0442\u044C\u0441\u044F \u0441\u0438\u0434\u044F",en:"Laugh (seated)",duration:1.6,loop:true,emotion:"happy",tracks:O(be(1.6,{"armL.rx":.5,"armR.rx":.5,"foreArmL.rx":1,"foreArmR.rx":1}),x(1.6,"body.rx",.12,.1,4),x(1.6,"head.rx",.2,.1,4))},sitCry:{label:"\u041F\u043B\u0430\u043A\u0430\u0442\u044C \u0441\u0438\u0434\u044F",en:"Cry (seated)",duration:2.4,loop:true,emotion:"crying",tracks:O(be(2.4,{"armL.rx":2.2,"armR.rx":2.2,"foreArmL.rx":1.5,"foreArmR.rx":1.5,"head.rx":-0.45,"body.rx":-0.25}),x(2.4,"body.sy",1,.02,4))},sitDoze:{label:"\u041A\u043B\u0435\u0432\u0430\u0442\u044C \u043D\u043E\u0441\u043E\u043C",en:"Doze",duration:3,loop:true,emotion:"sleepy",tracks:O(be(3,{"armL.rx":.3,"armR.rx":.3}),{"head.rx":S(3,[[0,-0.15],[.6,-0.6],[.7,-0.1],[1,-0.15]])})},sitDrive:{label:"\u0420\u0443\u043B\u0438\u0442\u044C",en:"Drive",duration:2.4,loop:true,tracks:O(be(2.4,{"armL.rx":1.2,"armR.rx":1.2,"foreArmL.rx":.5,"foreArmR.rx":.5}),x(2.4,"armL.rz",.2,.2,1),x(2.4,"armR.rz",-0.2,.2,1),x(2.4,"body.rz",0,.05,1,ie))},sitGamepad:{label:"\u0418\u0433\u0440\u0430\u0442\u044C \u0441 \u0433\u0435\u0439\u043C\u043F\u0430\u0434\u043E\u043C",en:"Gamepad",duration:1.2,loop:true,emotion:"determined",tracks:O(be(1.2,{"armL.rx":.8,"armR.rx":.8,"foreArmL.rx":1.2,"foreArmR.rx":1.2,"armL.rz":.25,"armR.rz":-0.25,"body.rx":-0.15,"head.rx":-0.05}),x(1.2,"foreArmL.rz",0,.08,4),x(1.2,"body.rz",0,.05,1))},sitClap:{label:"\u0425\u043B\u043E\u043F\u0430\u0442\u044C \u0441\u0438\u0434\u044F",en:"Clap (seated)",duration:1.2,loop:true,emotion:"happy",tracks:O(be(1.2,{"armL.rx":1.1,"armR.rx":1.1,"foreArmL.rx":.6,"foreArmR.rx":.6}),x(1.2,"foreArmL.rz",.55,.35,4),x(1.2,"foreArmR.rz",-0.55,-0.35,4))},lieBack:{label:"\u041B\u0435\u0436\u0430\u0442\u044C \u043D\u0430 \u0441\u043F\u0438\u043D\u0435",en:"Lie on the back",duration:3,loop:true,tracks:O(N(3,{...Xt,"armL.rz":-2.6,"armR.rz":2.6,"foreArmL.rz":1.6,"foreArmR.rz":-1.6,"legL.rx":.1}),x(3,"body.sy",1,.02,1))},lieSide:{label:"\u0421\u043F\u0430\u0442\u044C \u043D\u0430 \u0431\u043E\u043A\u0443",en:"Sleep on the side",duration:3,loop:true,emotion:"sleepy",tracks:O(N(3,{"root.rz":ie/2,"root.py":4.6,"legL.rx":.7,"legR.rx":.4,"shinL.rx":-0.9,"shinR.rx":-0.6,"armL.rx":1.2,"armR.rx":.9,"foreArmL.rx":1.2,"head.rz":-0.2}),x(3,"body.sy",1,.02,1))},lieFront:{label:"\u041D\u0430 \u0436\u0438\u0432\u043E\u0442\u0435",en:"Lie on the front",duration:2.4,loop:true,tracks:O(N(2.4,{"root.rx":-ie/2,"root.py":2.3,"head.rx":.9,"armL.rx":2.6,"armR.rx":2.6,"foreArmL.rx":1.6,"foreArmR.rx":1.6,"shinR.rx":-1.4}),x(2.4,"shinL.rx",-1.2,.5,1))},getUp:{label:"\u0412\u0441\u0442\u0430\u0442\u044C \u0441 \u043F\u043E\u043B\u0430",en:"Get up",duration:1.8,tracks:{"root.rx":S(1.8,[[0,ie/2],[.3,.6],[.6,0],[1,0]]),"root.py":S(1.8,[[0,2.3],[.3,-6],[.6,-6],[1,0]]),"legL.rx":S(1.8,[[0,0],[.3,1.8],[.6,1.5],[1,0]]),"legR.rx":S(1.8,[[0,0],[.3,.2],[.6,-0.1],[1,0]]),"shinL.rx":S(1.8,[[0,0],[.3,-2],[.6,-1.5],[1,0]]),"shinR.rx":S(1.8,[[0,0],[.3,-1.6],[.6,-1.4],[1,0]]),"armL.rx":S(1.8,[[0,0],[.3,-0.6],[.6,.4],[1,0]])}},phone:{label:"\u0413\u043E\u0432\u043E\u0440\u0438\u0442\u044C \u043F\u043E \u0442\u0435\u043B\u0435\u0444\u043E\u043D\u0443",en:"Phone call",duration:2.4,loop:true,layer:"upper",tracks:O(N(2.4,{"armR.rx":2.1,"armR.rz":-0.08,"head.rz":-0.15}),x(2.4,"head.rx",0,.05,2),x(2.4,"armL.rz",-0.15,.15,2))},phoneScroll:{label:"\u041B\u0438\u0441\u0442\u0430\u0442\u044C \u0442\u0435\u043B\u0435\u0444\u043E\u043D",en:"Scroll phone",duration:1.6,loop:true,layer:"upper",tracks:O(N(1.6,{...go,"armL.rx":.5,"foreArmL.rx":1.4,"armL.rz":.3,"head.rx":-0.4}),x(1.6,"foreArmL.rz",.1,.06,2))},selfie:{label:"\u0421\u0435\u043B\u0444\u0438",en:"Selfie",duration:2,loop:true,emotion:"happy",layer:"upper",tracks:O(N(2,{"armR.rx":1.8,"armR.rz":.6,"foreArmR.rx":.2,"head.rz":-0.15,"armL.rz":-1.4,"foreArmL.rz":1.2}),x(2,"head.ry",.2,.05,1))},photo:{label:"\u0424\u043E\u0442\u043E\u0433\u0440\u0430\u0444\u0438\u0440\u043E\u0432\u0430\u0442\u044C",en:"Take a photo",duration:2,loop:true,layer:"upper",tracks:N(2,{"armL.rx":1.4,"armR.rx":1.4,"foreArmL.rx":1.2,"foreArmR.rx":1.2,"armL.rz":.35,"armR.rz":-0.35,"head.rx":.05})},drinkCup:{label:"\u041F\u0438\u0442\u044C \u0438\u0437 \u043A\u0440\u0443\u0436\u043A\u0438",en:"Drink from a cup",duration:2.4,loop:true,layer:"upper",tracks:{"armR.rx":S(2.4,[[0,.55],[.3,1.2],[.6,1.2],[1,.55]]),"foreArmR.rx":S(2.4,[[0,1.35],[.3,2.1],[.6,2.1],[1,1.35]]),"head.rx":S(2.4,[[0,0],[.3,.3],[.6,.3],[1,0]])}},eat:{label:"\u0415\u0441\u0442\u044C",en:"Eat",duration:1.2,loop:true,layer:"upper",tracks:O(N(1.2,{...Wt,"armR.rx":.9}),x(1.2,"foreArmR.rx",1.5,.45,1),x(1.2,"head.rx",-0.1,.06,2))},read:{label:"\u0427\u0438\u0442\u0430\u0442\u044C",en:"Read",duration:3,loop:true,layer:"upper",tracks:O(N(3,{...bo,"head.rx":-0.35}),x(3,"head.ry",0,.08,1))},board:{label:"\u041F\u0438\u0441\u0430\u0442\u044C \u043D\u0430 \u0434\u043E\u0441\u043A\u0435",en:"Write on a board",duration:2,loop:true,tracks:O(N(2,{"armR.rx":2,"foreArmR.rx":.4,"body.ry":.15,"head.rx":.2}),x(2,"armR.rz",0,.25,2),x(2,"foreArmR.rz",0,.2,4))},cook:{label:"\u0413\u043E\u0442\u043E\u0432\u0438\u0442\u044C",en:"Cook",duration:1.6,loop:true,layer:"upper",tracks:O(N(1.6,{...Wt,"armR.rx":.9,"foreArmR.rx":.9,"head.rx":-0.3}),x(1.6,"armR.rz",0,.2,2),x(1.6,"armR.ry",0,.3,2,ie/2))},dishes:{label:"\u041C\u044B\u0442\u044C \u043F\u043E\u0441\u0443\u0434\u0443",en:"Wash dishes",duration:1.6,loop:true,tracks:O(N(1.6,{"armL.rx":.9,"armR.rx":.9,"foreArmL.rx":.6,"foreArmR.rx":.6,"head.rx":-0.35,"body.rx":-0.1}),x(1.6,"armR.rz",0,.15,3),x(1.6,"armL.rz",0,.12,3,ie))},sweep:{label:"\u041F\u043E\u0434\u043C\u0435\u0442\u0430\u0442\u044C",en:"Sweep",duration:1.6,loop:true,tracks:O(N(1.6,{"armL.rx":.6,"armR.rx":.4,"foreArmL.rx":.9,"foreArmR.rx":.5,"body.rx":-0.15,"head.rx":-0.2}),x(1.6,"body.ry",0,.3,2),x(1.6,"armL.rz",0,.25,2))},water:{label:"\u041F\u043E\u043B\u0438\u0432\u0430\u0442\u044C \u0446\u0432\u0435\u0442\u044B",en:"Water plants",duration:2.4,loop:true,tracks:O(N(2.4,{"armR.rx":.9,"foreArmR.rx":.5,"body.rx":-0.1,"head.rx":-0.3}),x(2.4,"armR.rz",-0.1,.25,1))},dig:{label:"\u041A\u043E\u043F\u0430\u0442\u044C",en:"Dig",duration:1.6,loop:true,emotion:"determined",tracks:{"body.rx":S(1.6,[[0,-0.1],[.4,-0.6],[.7,0],[1,-0.1]]),"armL.rx":S(1.6,[[0,.6],[.4,1.4],[.7,.5],[1,.6]]),"armR.rx":S(1.6,[[0,.4],[.4,.9],[.7,.2],[1,.4]]),"foreArmL.rx":Je(1.6,.8),"foreArmR.rx":Je(1.6,.6),"shinL.rx":S(1.6,[[0,0],[.4,-0.5],[.7,0],[1,0]]),"shinR.rx":S(1.6,[[0,0],[.4,-0.5],[.7,0],[1,0]]),"root.py":S(1.6,[[0,0],[.4,-1],[.7,0],[1,0]])}},fish:{label:"\u0420\u044B\u0431\u0430\u0447\u0438\u0442\u044C",en:"Fish",duration:3,loop:true,tracks:O(N(3,{"armL.rx":.9,"armR.rx":.9,"foreArmL.rx":.9,"foreArmR.rx":.7,"head.rx":.05}),x(3,"armR.rx",.9,.08,2))},paint:{label:"\u0420\u0438\u0441\u043E\u0432\u0430\u0442\u044C \u043D\u0430 \u043C\u043E\u043B\u044C\u0431\u0435\u0440\u0442\u0435",en:"Paint",duration:2,loop:true,layer:"upper",tracks:O(N(2,{"armR.rx":1.4,"foreArmR.rx":.6,...Wt,"head.rz":.1}),x(2,"armR.rz",0,.2,2),x(2,"foreArmR.rx",.6,.25,3))},brushTeeth:{label:"\u0427\u0438\u0441\u0442\u0438\u0442\u044C \u0437\u0443\u0431\u044B",en:"Brush teeth",duration:1.2,loop:true,layer:"upper",tracks:O(N(1.2,{"armR.rx":1,"foreArmR.rx":2,"armR.rz":-0.2,"head.rx":.05}),x(1.2,"armR.ry",0,.2,6))},washFace:{label:"\u0423\u043C\u044B\u0432\u0430\u0442\u044C\u0441\u044F",en:"Wash face",duration:1.6,loop:true,tracks:O(N(1.6,{"armL.rx":1.4,"armR.rx":1.4,"foreArmL.rx":1.9,"foreArmR.rx":1.9,"body.rx":-0.45,"head.rx":-0.3}),x(1.6,"foreArmL.rx",1.9,.25,3),x(1.6,"foreArmR.rx",1.9,.25,3))},openDoor:{label:"\u041E\u0442\u043A\u0440\u044B\u0442\u044C \u0434\u0432\u0435\u0440\u044C",en:"Open a door",duration:1.6,layer:"upper",tracks:{"armR.rx":S(1.6,[[0,0],[.3,1.3],[.6,1.3],[.9,.6],[1,0]]),"foreArmR.rx":S(1.6,[[0,0],[.3,.4],[.6,.4],[1,0]]),"armR.ry":S(1.6,[[0,0],[.3,0],[.45,-0.5],[.9,-0.6],[1,0]]),"body.ry":S(1.6,[[0,0],[.6,-0.2],[1,0]])}},knock:{label:"\u041F\u043E\u0441\u0442\u0443\u0447\u0430\u0442\u044C",en:"Knock",duration:1.4,layer:"upper",tracks:O({"armR.rx":S(1.4,[[0,0],[.2,1.3],[.85,1.3],[1,0]])},x(1.4,"foreArmR.rx",1.4,.35,3,0,true),{"head.rz":S(1.4,[[0,0],[.3,.1],[1,0]])})},checkWatch:{label:"\u041F\u043E\u0441\u043C\u043E\u0442\u0440\u0435\u0442\u044C \u043D\u0430 \u0447\u0430\u0441\u044B",en:"Check the time",duration:1.6,layer:"upper",tracks:{"armL.rx":S(1.6,[[0,0],[.25,.9],[.8,.9],[1,0]]),"foreArmL.rx":S(1.6,[[0,0],[.25,1.4],[.8,1.4],[1,0]]),"armL.rz":S(1.6,[[0,0],[.25,.4],[.8,.4],[1,0]]),"head.rx":S(1.6,[[0,0],[.3,-0.4],[.8,-0.4],[1,0]]),"head.ry":S(1.6,[[0,0],[.3,-0.25],[.8,-0.25],[1,0]])}},wait:{label:"\u0416\u0434\u0430\u0442\u044C",en:"Wait",duration:1.2,loop:true,emotion:"tired",tracks:O(N(1.2,{"armL.rz":-0.8,"armR.rz":.8,"foreArmL.rz":1.5,"foreArmR.rz":-1.5}),{"legR.rx":S(1.2,[[0,.15],[.25,.15],[.5,.15],[1,.15]]),"shinR.rx":S(1.2,[[0,-0.2],[.2,-0.45],[.4,-0.2],[.6,-0.45],[.8,-0.2],[1,-0.2]])})},pockets:{label:"\u0420\u0443\u043A\u0438 \u0432 \u043A\u0430\u0440\u043C\u0430\u043D\u0430\u0445",en:"Hands in pockets",duration:2,loop:true,emotion:"cool",layer:"upper",tracks:N(2,{"armL.rx":-0.25,"armR.rx":-0.25,"armL.rz":-0.12,"armR.rz":.12,"foreArmL.rx":.5,"foreArmR.rx":.5,"head.rx":.05})},armsCrossed:{label:"\u0420\u0443\u043A\u0438 \u0441\u043A\u0440\u0435\u0449\u0435\u043D\u044B",en:"Arms crossed",duration:2,loop:true,layer:"upper",tracks:N(2,{"armL.rx":.6,"armR.rx":.6,"armL.rz":.35,"armR.rz":-0.35,"foreArmL.rx":1.6,"foreArmR.rx":1.6,"foreArmL.ry":-0.7,"foreArmR.ry":.7,"head.rx":.08})},lean:{label:"\u041E\u0431\u043B\u043E\u043A\u043E\u0442\u0438\u0442\u044C\u0441\u044F \u043D\u0430 \u0441\u0442\u0435\u043D\u0443",en:"Lean on a wall",duration:2,loop:true,emotion:"cool",tracks:N(2,{"root.rz":-0.12,"root.px":-1,"legL.rx":.15,"legL.ry":.2,"shinL.rx":-0.4,"armR.rz":1.5,"foreArmR.rz":-1.4,"armL.rx":-0.2,"foreArmL.rx":.4,"head.rz":.06})},shiver:{label:"\u0414\u0440\u043E\u0436\u0430\u0442\u044C \u043E\u0442 \u0445\u043E\u043B\u043E\u0434\u0430",en:"Shiver",duration:1.2,loop:true,emotion:"scared",layer:"upper",tracks:O(N(1.2,{"armL.rx":.8,"armR.rx":.8,"armL.rz":.5,"armR.rz":-0.5,"foreArmL.rx":1.4,"foreArmR.rx":1.4,"head.rx":-0.15}),x(1.2,"body.rz",0,.03,10),x(1.2,"head.rz",0,.04,9))},fan:{label:"\u041E\u0431\u043C\u0430\u0445\u0438\u0432\u0430\u0442\u044C\u0441\u044F",en:"Fan yourself",duration:1.2,loop:true,emotion:"tired",layer:"upper",tracks:O(N(1.2,{"armR.rx":.9,"foreArmR.rx":1.7,"head.rx":.15}),x(1.2,"foreArmR.rz",0,.4,4))},sneeze:{label:"\u0427\u0438\u0445\u043D\u0443\u0442\u044C",en:"Sneeze",duration:1.4,tracks:{"head.rx":S(1.4,[[0,0],[.45,.4],[.55,-0.4],[.8,-0.2],[1,0]]),"body.rx":S(1.4,[[0,0],[.45,.1],[.55,-0.35],[.8,-0.1],[1,0]]),"armR.rx":S(1.4,[[0,0],[.4,1.3],[.8,1.3],[1,0]]),"foreArmR.rx":S(1.4,[[0,0],[.4,1.9],[.8,1.9],[1,0]])}},cough:{label:"\u041A\u0430\u0448\u043B\u044F\u0442\u044C",en:"Cough",duration:1.4,layer:"upper",tracks:O({"armR.rx":S(1.4,[[0,0],[.2,1.2],[.85,1.2],[1,0]]),"foreArmR.rx":S(1.4,[[0,0],[.2,2],[.85,2],[1,0]])},x(1.4,"body.rx",-0.1,.1,3,0,true),x(1.4,"head.rx",-0.1,.12,3,0,true))},hug:{label:"\u041E\u0431\u043D\u044F\u0442\u044C",en:"Hug",duration:2,loop:true,emotion:"love",layer:"upper",tracks:N(2,{"armL.rx":1.3,"armR.rx":1.3,"armL.rz":-0.4,"armR.rz":.4,"foreArmL.rz":1,"foreArmR.rz":-1,"foreArmL.rx":.4,"foreArmR.rx":.4,"head.rz":.1})},handshake:{label:"\u0420\u0443\u043A\u043E\u043F\u043E\u0436\u0430\u0442\u0438\u0435",en:"Handshake",duration:1.6,loop:true,emotion:"happy",layer:"upper",tracks:O(N(1.6,{"armR.rx":.9,"foreArmR.rx":.5}),x(1.6,"foreArmR.rx",.5,.15,3))},highFive:{label:"\u0414\u0430\u0442\u044C \u043F\u044F\u0442\u044C",en:"High five",duration:1.2,emotion:"excited",layer:"upper",tracks:{"armR.rz":S(1.2,[[0,0],[.3,.35],[1,0]]),"armR.rx":S(1.2,[[0,0],[.3,2.8],[.45,2.5],[.8,2.5],[1,0]]),"body.ry":S(1.2,[[0,0],[.4,-0.15],[1,0]])}},throw:{label:"\u0411\u0440\u043E\u0441\u0438\u0442\u044C",en:"Throw",duration:1.2,layer:"upper",tracks:{"armR.rx":S(1.2,[[0,0],[.35,-0.6],[.5,2.2],[.7,1.2],[1,0]]),"armR.rz":S(1.2,[[0,0],[.35,.8],[.5,.2],[1,0]]),"body.ry":S(1.2,[[0,0],[.35,.35],[.55,-0.3],[1,0]]),"armL.rx":S(1.2,[[0,0],[.35,1],[.55,.2],[1,0]])}},catch:{label:"\u041F\u043E\u0439\u043C\u0430\u0442\u044C",en:"Catch",duration:1.2,emotion:"surprised",layer:"upper",tracks:{"armL.rx":S(1.2,[[0,0],[.3,1.6],[.5,1.4],[.8,.9],[1,0]]),"armR.rx":S(1.2,[[0,0],[.3,1.6],[.5,1.4],[.8,.9],[1,0]]),"foreArmL.rx":S(1.2,[[0,0],[.5,.4],[.8,1.2],[1,0]]),"foreArmR.rx":S(1.2,[[0,0],[.5,.4],[.8,1.2],[1,0]]),"body.rx":S(1.2,[[0,0],[.5,.08],[1,0]])}},juggle:{label:"\u041F\u043E\u0434\u043A\u0438\u0434\u044B\u0432\u0430\u0442\u044C \u043C\u044F\u0447",en:"Juggle",duration:1.2,loop:true,layer:"upper",tracks:O(N(1.2,{"armL.rx":.7,"armR.rx":.7,"head.rx":.35}),x(1.2,"foreArmL.rx",1.2,.35,2),x(1.2,"foreArmR.rx",1.2,.35,2,ie))}};var ht=Math.PI,la={clap:{label:"\u0425\u043B\u043E\u043F\u0430\u0442\u044C",en:"Clap",duration:1.8,emotion:"happy",layer:"upper",tracks:O(ae(1.8,{"armL.rx":1.2,"armR.rx":1.2,"armL.rz":.25,"armR.rz":-0.25},.2),x(1.8,"foreArmL.rz",.55,.35,5,0,true),x(1.8,"foreArmR.rz",-0.55,-0.35,5,0,true),ae(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:ae(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:ae(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:ae(2,{"armL.rz":-2.3,"armR.rz":2.3,"armL.rx":.4,"armR.rx":.4,"foreArmL.rz":1.3,"foreArmR.rz":-1.3,"head.rz":.12})},think:{label:"\u0414\u0443\u043C\u0430\u0442\u044C",en:"Think",duration:2.4,emotion:"confused",layer:"upper",tracks:O(ae(2.4,{"armR.rx":.9,"armR.rz":-0.2,"foreArmR.rx":2.1,"armL.rx":.5,"foreArmL.rx":1.4,"armL.rz":.3}),x(2.4,"head.rz",.12,.05,2,0,true),ae(2.4,{"head.rx":.15}))},nod:{label:"\u0414\u0430",en:"Yes",duration:1.2,layer:"upper",tracks:x(1.2,"head.rx",-0.1,.22,3,0,true)},headShake:{label:"\u041D\u0435\u0442",en:"No",duration:1.2,layer:"upper",tracks:x(1.2,"head.ry",0,.4,3,0,true)},beckon:{label:"\u0418\u0434\u0438 \u0441\u044E\u0434\u0430",en:"Come here",duration:1.8,layer:"upper",tracks:O(ae(1.8,{"armR.rx":1.3,"armR.rz":.2}),x(1.8,"foreArmR.rx",1,.6,3,0,true),ae(1.8,{"head.rz":.1}))},stop:{label:"\u0421\u0442\u043E\u043F",en:"Stop",duration:1.4,emotion:"determined",layer:"upper",tracks:ae(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:ae(2.4,{"armR.rx":1.4,"foreArmR.rx":1.9,"armR.rz":-0.25,"armL.rz":-0.35,"armL.rx":-0.15,"head.rx":.35,"body.rx":.08},.5)},stretch:{label:"\u041F\u043E\u0442\u044F\u043D\u0443\u0442\u044C\u0441\u044F",en:"Stretch",duration:2.6,emotion:"sleepy",tracks:O(ae(2.6,{"armL.rz":-2.9,"armR.rz":2.9,"head.rx":.3,"body.rx":.12},.6),{"root.py":S(2.6,[[0,0],[.3,.8],[.7,.8],[1,0]])})},flex:{label:"\u0421\u0438\u043B\u0430",en:"Flex",duration:1.8,emotion:"determined",layer:"upper",tracks:O(ae(1.8,{"armL.rz":-1.5,"armR.rz":1.5,"foreArmL.rz":-1.6,"foreArmR.rz":1.6,"body.rx":.08},.25),x(1.8,"body.ry",0,.15,2,0,true))},jumpJoy:{label:"\u041F\u0440\u044B\u0436\u043E\u043A \u0440\u0430\u0434\u043E\u0441\u0442\u0438",en:"Jump for joy",duration:1.4,emotion:"excited",tracks:{"root.py":S(1.4,[[0,0],[.15,-1.5],[.4,6],[.6,6],[.8,0],[.9,-1],[1,0]]),"armL.rz":S(1.4,[[0,0],[.4,-2.8],[.7,-2.8],[1,0]]),"armR.rz":S(1.4,[[0,0],[.4,2.8],[.7,2.8],[1,0]]),"shinL.rx":S(1.4,[[0,0],[.15,-0.6],[.45,-1.4],[.7,-1.2],[.85,-0.4],[1,0]]),"shinR.rx":S(1.4,[[0,0],[.15,-0.6],[.45,-1.4],[.7,-1.2],[.85,-0.4],[1,0]])}},spin:{label:"\u041A\u0440\u0443\u0436\u0438\u0442\u044C\u0441\u044F",en:"Spin",duration:1.6,emotion:"happy",tracks:{"root.ry":S(1.6,[[0,0],[1,ht*2]]),"armL.rz":S(1.6,[[0,0],[.2,-1.5],[.8,-1.5],[1,0]]),"armR.rz":S(1.6,[[0,0],[.2,1.5],[.8,1.5],[1,0]])}},victory:{label:"\u041F\u043E\u0431\u0435\u0434\u0430",en:"Victory",duration:2,emotion:"excited",tracks:O(ae(2,{"armR.rz":2.9,"armL.rz":-0.4,"foreArmL.rx":1.3,"armL.rx":.3,"head.rx":.2,"body.rx":.08}),{"root.py":S(2,[[0,0],[.2,3],[.35,0],[1,0]])})},airGuitar:{label:"\u0413\u0438\u0442\u0430\u0440\u0430",en:"Air guitar",duration:2.4,loop:true,emotion:"excited",tracks:O(N(2.4,{"armL.rx":1.2,"armL.rz":-0.5,"foreArmL.rz":.7,"armR.rx":.5,"foreArmR.rx":1.2,"legL.rx":.3,"shinL.rx":-0.4}),x(2.4,"foreArmR.rz",-0.2,.35,8),x(2.4,"head.rx",-0.1,.18,4),x(2.4,"body.rx",-0.05,.06,4))},drum:{label:"\u0411\u0430\u0440\u0430\u0431\u0430\u043D",en:"Drum",duration:1.6,loop:true,emotion:"excited",tracks:O(N(1.6,{"armL.rx":.7,"armR.rx":.7}),x(1.6,"foreArmL.rx",1,.5,4),x(1.6,"foreArmR.rx",1,.5,4,ht),x(1.6,"head.rx",0,.12,4))},pushups:{label:"\u041E\u0442\u0436\u0438\u043C\u0430\u043D\u0438\u044F",en:"Push-ups",duration:2,loop:true,emotion:"determined",tracks:O(N(2,{"root.rx":-1.35,"armL.rx":1.45,"armR.rx":1.45,"head.rx":1.1}),x(2,"root.py",3.4,1.2,2),x(2,"foreArmL.rx",-0.5,.5,2),x(2,"foreArmR.rx",-0.5,.5,2))},kneel:{label:"\u041D\u0430 \u043A\u043E\u043B\u0435\u043D\u043E",en:"Kneel",duration:2.4,tracks:ae(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:ae(1.6,{"legR.rx":-0.4,"shinL.rx":-0.6,"shinR.rx":-0.6,"root.py":-1.4,"armL.rz":-0.5,"armR.rz":.5,"body.rx":-0.15,"head.rx":-0.2},.4)},scratchHead:{label:"\u041F\u043E\u0447\u0435\u0441\u0430\u0442\u044C \u0437\u0430\u0442\u044B\u043B\u043E\u043A",en:"Scratch head",duration:1.8,emotion:"confused",layer:"upper",tracks:O(ae(1.8,{"armR.rx":3.05,"armR.rz":-0.35,"head.rz":.15,"head.rx":.2}),x(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:ae(2,{"armL.rx":2.4,"armR.rx":2.4,"foreArmL.rx":1.4,"foreArmR.rx":1.4,"body.rx":-0.35,"head.rx":-0.4,"shinL.rx":-0.5,"shinR.rx":-0.5,"root.py":-1.5},.2)},stomp:{label:"\u0422\u043E\u043F\u043D\u0443\u0442\u044C",en:"Stomp",duration:1.2,emotion:"angry",tracks:O(ae(1.2,{"armL.rz":-0.35,"armR.rz":.35,"body.rx":-0.1},.15),{"legR.rx":S(1.2,[[0,0],[.3,.8],[.45,0],[.65,.8],[.8,0],[1,0]]),"shinR.rx":S(1.2,[[0,0],[.3,-1],[.45,0],[.65,-1],[.8,0],[1,0]])})},slump:{label:"\u041F\u043E\u043D\u0438\u043A",en:"Slump",duration:2.4,emotion:"sad",tracks:ae(2.4,{"body.rx":-0.35,"head.rx":-0.45,"armL.rz":.05,"armR.rz":-0.05,"shinL.rx":-0.15,"shinR.rx":-0.15},.6)},rollLaugh:{label:"\u0412\u0430\u043B\u044F\u0442\u044C\u0441\u044F \u043E\u0442 \u0441\u043C\u0435\u0445\u0430",en:"Rolling with laughter",duration:2.4,loop:true,emotion:"happy",tracks:O(N(2.4,{...Xt,"armL.rx":1.2,"armR.rx":1.2,"foreArmL.rx":1.2,"foreArmR.rx":1.2}),x(2.4,"root.rz",0,.35,2),x(2.4,"legL.rx",1,.5,4),x(2.4,"legR.rx",1,.5,4,ht),x(2.4,"head.rx",.2,.15,6))},blowKiss:{label:"\u0412\u043E\u0437\u0434\u0443\u0448\u043D\u044B\u0439 \u043F\u043E\u0446\u0435\u043B\u0443\u0439",en:"Blow a kiss",duration:1.6,emotion:"love",layer:"upper",tracks:{"armR.rx":S(1.6,[[0,0],[.3,1.2],[.55,1.2],[.75,1.6],[1,0]]),"foreArmR.rx":S(1.6,[[0,0],[.3,2],[.55,2],[.75,.3],[1,0]]),"armR.rz":S(1.6,[[0,0],[.3,-0.2],[.75,.4],[1,0]]),"head.rz":S(1.6,[[0,0],[.3,.12],[.9,.12],[1,0]])}},phew:{label:"\u0424\u0443\u0445",en:"Phew",duration:1.6,emotion:"tired",layer:"upper",tracks:{"armR.rz":S(1.6,[[0,0],[.3,1.7],[.7,2.1],[1,0]]),"foreArmR.rz":S(1.6,[[0,0],[.3,-1.4],[.7,-1.6],[1,0]]),"head.rx":S(1.6,[[0,0],[.3,.2],[.7,-0.2],[1,0]]),"body.rx":S(1.6,[[0,0],[.6,-0.08],[1,0]])}},lookAround:{label:"\u041E\u0441\u043C\u043E\u0442\u0440\u0435\u0442\u044C\u0441\u044F",en:"Look around",duration:2.6,layer:"upper",tracks:{"head.ry":S(2.6,[[0,0],[.2,.9],[.45,.9],[.65,-0.9],[.85,-0.9],[1,0]]),"body.ry":S(2.6,[[0,0],[.2,.25],[.45,.25],[.65,-0.25],[.85,-0.25],[1,0]]),"armR.rx":S(2.6,[[0,0],[.2,2.6],[.85,2.6],[1,0]]),"foreArmR.rx":S(2.6,[[0,0],[.2,.9],[.85,.9],[1,0]])}},karate:{label:"\u041A\u0430\u0440\u0430\u0442\u044D",en:"Karate",duration:1.8,emotion:"determined",tracks:{"armR.rx":S(1.8,[[0,.6],[.2,.6],[.3,1.57],[.45,.6],[1,0]]),"foreArmR.rx":S(1.8,[[0,1.6],[.2,1.6],[.3,0],[.45,1.6],[1,0]]),"armL.rx":S(1.8,[[0,.6],[.45,.6],[.55,1.57],[.7,.6],[1,0]]),"foreArmL.rx":S(1.8,[[0,1.6],[.45,1.6],[.55,0],[.7,1.6],[1,0]]),"legR.rx":S(1.8,[[0,0],[.7,0],[.8,1.4],[.9,0],[1,0]]),"body.ry":S(1.8,[[0,0],[.3,-0.3],[.55,.3],[.8,0],[1,0]]),"root.py":S(1.8,[[0,-1],[.9,-1],[1,0]])}},nap:{label:"\u0423\u0441\u043D\u0443\u0442\u044C",en:"Nap",duration:3,loop:true,emotion:"sleepy",tracks:O(N(3,{...Xt,"armL.rz":-0.3,"armR.rz":2.4,"foreArmR.rz":-1.4,"legL.rx":.15}),x(3,"body.sy",1,.03,1))},danceRobot:{label:"\u0422\u0430\u043D\u0435\u0446 \xAB\u0420\u043E\u0431\u043E\u0442\xBB",en:"Robot dance",duration:2,loop:true,emotion:"cool",tracks:{"armL.rx":S(2,[[0,1.57],[.25,1.57],[.26,0],[.5,0],[.51,1.57],[.75,1.57],[.76,0],[1,1.57]]),"foreArmL.rx":S(2,[[0,0],[.25,0],[.26,1.57],[.5,1.57],[.51,0],[1,0]]),"armR.rx":S(2,[[0,0],[.25,0],[.26,1.57],[.5,1.57],[.51,0],[.75,0],[.76,1.57],[1,0]]),"foreArmR.rx":S(2,[[0,1.57],[.25,1.57],[.26,0],[.75,0],[.76,1.57],[1,1.57]]),"head.ry":S(2,[[0,.4],[.25,.4],[.26,-0.4],[.75,-0.4],[.76,.4],[1,.4]]),"root.py":S(2,[[0,0],[.25,-0.8],[.5,0],[.75,-0.8],[1,0]])}},danceHop:{label:"\u0422\u0430\u043D\u0435\u0446 \xAB\u041F\u0440\u044B\u0433-\u0441\u043A\u043E\u043A\xBB",en:"Hop dance",duration:1.6,loop:true,emotion:"excited",tracks:O(x(1.6,"root.py",1.2,1.2,4),x(1.6,"legL.rx",.25,.35,2),x(1.6,"legR.rx",.25,.35,2,ht),x(1.6,"shinL.rx",-0.5,.3,2),x(1.6,"shinR.rx",-0.5,.3,2,ht),x(1.6,"armL.rz",-1.6,.9,2),x(1.6,"armR.rz",1.6,.9,2))},danceSway:{label:"\u0422\u0430\u043D\u0435\u0446 \xAB\u041F\u043E\u043A\u0430\u0447\u0438\u0432\u0430\u043D\u0438\u0435\xBB",en:"Sway dance",duration:2.4,loop:true,emotion:"happy",tracks:O(x(2.4,"body.rz",0,.12,2),x(2.4,"head.rz",0,.16,2,ht),x(2.4,"root.px",0,1.2,2),x(2.4,"armL.rz",-0.6,.4,2),x(2.4,"armR.rz",.6,.4,2),N(2.4,{"foreArmL.rx":1.1,"foreArmR.rx":1.1}),x(2.4,"shinL.rx",-0.2,.2,2),x(2.4,"shinR.rx",-0.2,.2,2,ht))},danceDisco:{label:"\u0422\u0430\u043D\u0435\u0446 \xAB\u0414\u0438\u0441\u043A\u043E\xBB",en:"Disco dance",duration:2,loop:true,emotion:"cool",tracks:{"armR.rz":S(2,[[0,2.6],[.25,.2],[.5,2.6],[.75,.2],[1,2.6]]),"armR.rx":S(2,[[0,.6],[.25,.9],[.5,.6],[.75,.9],[1,.6]]),"armL.rz":Je(2,-0.3),"armL.rx":Je(2,.4),"foreArmL.rx":Je(2,1.3),"body.ry":S(2,[[0,.3],[.25,-0.2],[.5,.3],[.75,-0.2],[1,.3]]),"root.py":S(2,[[0,0],[.125,-0.8],[.25,0],[.375,-0.8],[.5,0],[.625,-0.8],[.75,0],[.875,-0.8],[1,0]]),"legL.rz":S(2,[[0,0],[.25,-0.2],[.5,0],[.75,-0.2],[1,0]])}},danceWave:{label:"\u0422\u0430\u043D\u0435\u0446 \xAB\u0412\u043E\u043B\u043D\u0430\xBB",en:"Wave dance",duration:2,loop:true,emotion:"happy",tracks:O(x(2,"armL.rz",-1.57,.35,2,0),x(2,"foreArmL.rz",0,.6,2,.8),x(2,"armR.rz",1.57,-0.35,2,1.6),x(2,"foreArmR.rz",0,-0.6,2,2.4),x(2,"body.rz",0,.08,2,1.2),x(2,"head.rz",0,.12,2,2),x(2,"root.py",-0.4,.4,4))}};var Mr=Math.PI,xo={wave:{label:"\u041F\u043E\u043C\u0430\u0445\u0430\u0442\u044C",duration:2,emotion:"happy",tracks:{"armR.rz":[[0,0],[.25,2.7],[.5,2.3],[.75,2.8],[1,2.3],[1.25,2.8],[1.5,2.4],[2,0]],"armR.rx":[[0,0],[.25,.2],[1.75,.2],[2,0]],"head.rz":[[0,0],[.5,.1],[1.5,.1],[2,0]]}},cheer:{label:"\u0423\u0440\u0430!",duration:1.6,emotion:"happy",tracks:{"armL.rz":[[0,0],[.25,-2.8],[1.35,-2.8],[1.6,0]],"armR.rz":[[0,0],[.25,2.8],[1.35,2.8],[1.6,0]],"root.py":[[0,0],[.3,3],[.55,0],[.8,3],[1.05,0]]}},dance:{label:"\u0422\u0430\u043D\u0435\u0446",duration:2,loop:true,emotion:"happy",tracks:{"root.ry":[[0,.3],[.5,-0.3],[1,.3],[1.5,-0.3],[2,.3]],"armL.rz":[[0,-0.4],[.5,-2.4],[1,-0.4],[1.5,-2.4],[2,-0.4]],"armR.rz":[[0,2.4],[.5,.4],[1,2.4],[1.5,.4],[2,2.4]],"legL.rx":[[0,0],[.5,.5],[1,0],[2,0]],"legR.rx":[[0,0],[1,0],[1.5,.5],[2,0]],"root.py":[[0,0],[.25,1.5],[.5,0],[.75,1.5],[1,0],[1.25,1.5],[1.5,0],[1.75,1.5],[2,0]],"tail.ry":[[0,.6],[.5,-0.6],[1,.6],[1.5,-0.6],[2,.6]]}},point:{label:"\u0423\u043A\u0430\u0437\u0430\u0442\u044C",duration:1.6,tracks:{"armR.rx":[[0,0],[.2,1.55],[1.4,1.55],[1.6,0]]}},laugh:{label:"\u0421\u043C\u0435\u0445",duration:1.6,emotion:"happy",tracks:{"body.rx":[[0,0],[.2,.15],[.4,.05],[.6,.15],[.8,.05],[1,.15],[1.2,.05],[1.6,0]],"head.rx":[[0,0],[.2,.3],[1.4,.3],[1.6,0]],"armL.rx":[[0,0],[.2,.5],[1.4,.5],[1.6,0]],"armR.rx":[[0,0],[.2,.5],[1.4,.5],[1.6,0]]}},cry:{label:"\u041F\u043B\u0430\u043A\u0430\u0442\u044C",duration:2.4,emotion:"sad",tracks:{"head.rx":[[0,0],[.3,-0.4],[2.1,-0.4],[2.4,0]],"head.rz":[[0,0],[.6,.08],[.9,-0.08],[1.2,.08],[1.5,-0.08],[2.4,0]],"armR.rx":[[0,0],[.3,2.3],[2.1,2.3],[2.4,0]],"armR.ry":[[0,0],[.3,-0.6],[2.1,-0.6],[2.4,0]],"armL.rx":[[0,0],[.3,2.3],[2.1,2.3],[2.4,0]],"armL.ry":[[0,0],[.3,.6],[2.1,.6],[2.4,0]]}},bow:{label:"\u041F\u043E\u043A\u043B\u043E\u043D",duration:1.4,tracks:{"body.rx":[[0,0],[.4,-0.7],[1,-0.7],[1.4,0]],"armR.rx":[[0,0],[.4,.5],[1,.5],[1.4,0]]}},shrug:{label:"\u041F\u043E\u0436\u0430\u0442\u044C \u043F\u043B\u0435\u0447\u0430\u043C\u0438",duration:1.2,tracks:{"armL.rz":[[0,0],[.3,-0.5],[.9,-0.5],[1.2,0]],"armR.rz":[[0,0],[.3,.5],[.9,.5],[1.2,0]],"armL.rx":[[0,0],[.3,.6],[.9,.6],[1.2,0]],"armR.rx":[[0,0],[.3,.6],[.9,.6],[1.2,0]],"head.rz":[[0,0],[.3,.25],[.9,.25],[1.2,0]]}},facepalm:{label:"\u0420\u0443\u043A\u0430-\u043B\u0438\u0446\u043E",duration:1.6,emotion:"tired",tracks:{"armR.rx":[[0,0],[.3,2.5],[1.3,2.5],[1.6,0]],"armR.rz":[[0,0],[.3,-0.4],[1.3,-0.4],[1.6,0]],"head.rx":[[0,0],[.3,-0.35],[1.3,-0.35],[1.6,0]]}},sit:{label:"\u0421\u0435\u0441\u0442\u044C",duration:1,loop:true,tracks:{"legL.rx":[[0,Mr*.46],[1,Mr*.46]],"legR.rx":[[0,Mr*.46],[1,Mr*.46]],"root.py":[[0,-10],[1,-10]]}}},Ne={...xo,...la,...ia},sc=[...Object.keys(xo),...Object.keys(la)],ic=Object.keys(ia),lc=Object.keys(Ne);function wo(e){return typeof e=="string"&&Object.prototype.hasOwnProperty.call(Ne,e)}function cc(e,t){let r=Ne[e];return t?r.label:r.en??e}function pi(e,t){let r=e[0];if(t<=r[0])return r[1];for(let a=1;a<e.length;a++){let o=e[a];if(t<=o[0]){let n=e[a-1],s=(t-n[0])/Math.max(1e-6,o[0]-n[0]),l=s*s*(3-2*s);return n[1]+(o[1]-n[1])*l}}return e[e.length-1][1]}function Ro(e,t,r){let a=t.loop?r%t.duration:Math.min(r,t.duration);for(let[o,n]of Object.entries(t.tracks)){let s=o.lastIndexOf("."),l=o.slice(0,s),i=o.slice(s+1);i in re&&f(e,l,i,pi(n,a));}}var di=["neutral","happy","sad","angry","surprised","scared","tired","hurt"],Ze=[...di,"love","excited","smug","confused","embarrassed","silly","cool","disgusted","determined","crying","dizzy","sleepy","wink"];function hi(e){return typeof e=="string"&&Ze.includes(e)}var ko={neutral:"neutral",happy:"happy",sad:"sad",angry:"angry",surprised:"surprised",scared:"scared",tired:"tired",hurt:"hurt",love:"happy",excited:"happy",smug:"happy",confused:"surprised",embarrassed:"happy",silly:"happy",cool:"neutral",disgusted:"angry",determined:"angry",crying:"sad",dizzy:"hurt",sleepy:"tired",wink:"happy"};var Jt={move:["idle","talk","walk","run","jump","fall","tiptoe","limp","crawl","climb","jog","carry","push","pull"],sit:["sit","sitChair","sitFloor","sitKneel","sitEdge","sitLounge","sitHug","squat","sitEat","sitDrink","sitRead","sitLaptop","sitWrite","sitTalk","sitLaugh","sitCry","sitDoze","sitDrive","sitGamepad","sitClap"],lie:["lieBack","lieSide","lieFront","getUp"],home:["phone","phoneScroll","selfie","photo","drinkCup","eat","read","board","cook","dishes","sweep","water","dig","fish","paint","brushTeeth","washFace","openDoor","knock","checkWatch","wait","pockets","armsCrossed","lean","shiver","fan","sneeze","cough"],social:["wave","point","surprised","dance","hug","handshake","highFive","throw","catch","juggle"]},Ao=[...Jt.move,...Jt.sit,...Jt.lie,...Jt.home,...Jt.social];var zt={neutral:["neutral"],happy:["happy","neutral"],sad:["sad","tired","neutral"],angry:["angry","neutral"],surprised:["surprised","scared","neutral"],scared:["scared","surprised","sad","neutral"],tired:["tired","sad","neutral"],hurt:["hurt","angry","sad","neutral"],love:["happy","neutral"],excited:["happy","surprised","neutral"],smug:["happy","neutral"],confused:["surprised","neutral"],embarrassed:["happy","sad","neutral"],silly:["happy","neutral"],cool:["neutral"],disgusted:["angry","sad","neutral"],determined:["angry","neutral"],crying:["sad","tired","neutral"],dizzy:["hurt","tired","neutral"],sleepy:["tired","blink","neutral"],wink:["happy","neutral"]},ca={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 So(e,t,r){if(!(r<=0))for(let[a,o]of Object.entries(ca[t].add)){let n=a.lastIndexOf(".");pe(e,a.slice(0,n),a.slice(n+1),(o??0)*r);}}var fc={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 bc(e){let t=[[/(😍|🥰|😘|❤|💕)/u,"love"],[/(🤩|🥳)/u,"excited"],[/(😏)/u,"smug"],[/(😕|🤔|😵💫)/u,"confused"],[/(😳|☺)/u,"embarrassed"],[/(😜|😝|😛|:P|:p)/u,"silly"],[/(😎)/u,"cool"],[/(🤢|🤮)/u,"disgusted"],[/(😤|💪)/u,"determined"],[/(😭)/u,"crying"],[/(😵)/u,"dizzy"],[/(😴|💤)/u,"sleepy"],[/(😉|;\))/u,"wink"],[/(>:\(|😠|😡|🤬)/u,"angry"],[/(:'\(|😢)/u,"sad"],[/(:\(|☹|🙁|😞)/u,"sad"],[/(:o|:O|😮|😲)/u,"surprised"],[/(😱|😨)/u,"scared"],[/(-_-|😩|🥱)/u,"tired"],[/(:\)|:D|\^\^|😀|😃|😄|😁|🙂|😊|😂)/u,"happy"]];for(let[r,a]of t)if(r.test(e))return a;return null}var ui=[{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}],fi=new Set(["hurt","land"]),bi={eat:"eat",drink:"drink",draw:"draw",block:"block"},yi={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)]]},Cr=e=>{let t=Math.max(0,Math.min(1,e));return t*t*(3-2*t)},zr=class{rig;style;faces;pose=new Map;expression="neutral";state="idle";stateT=0;clock=0;phase=0;airTime=0;wasOnGround=true;loco=new Map;from=new Map;lastLoco=new Map;blendT=1;blendDur=.2;tmp=new Map;actions=[];useClip=null;useW=0;emote=null;mood="neutral";moodOverGestures=false;flash=null;postureW=new Map;blinkT=3;blinking=0;talkT=0;springs=new Map;constructor(t,r,a=[]){this.rig=t,this.style=aa(r),this.faces=new Set(a);}setRandom(t){this.random=t;}random=Math.random;setStyle(t){this.style=aa(t);}setEmotion(t,r){r&&r>0?this.flash={emotion:t,left:r}:this.mood=t;}get emotion(){return this.emote?.def.emotion&&!this.moodOverGestures?this.emote.def.emotion:this.flash?.emotion??this.mood}get emoting(){return this.emote?.id??null}playEmote(t){this.emote={id:t,def:Ne[t],t:0};}stopEmote(){this.emote=null;}trigger(t){switch(t){case "swing":case "place":case "throw":case "hurt":case "land":{let r=t;this.actions=this.actions.filter(a=>a.clip!==r),this.actions.push({clip:r,t:0,dur:ho[r]??.3}),t==="hurt"&&this.setEmotion("hurt",.8);break}}}update(t,r=Ar()){t=Math.min(t,.1),this.clock+=t;let a=this.emotion,o=ca[a].tempo*this.style.tempo;!r.onGround&&!r.inWater?this.airTime+=t:(!this.wasOnGround&&this.airTime>.3&&r.onGround&&this.trigger("land"),this.airTime=0),this.wasOnGround=r.onGround,this.phase+=r.speed*t*3.5*o;let n=ui.find(c=>c.when(r,this));n.state!==this.state&&(kr(this.from,this.lastLoco),this.state=n.state,this.stateT=0,this.blendT=0,this.blendDur=n.blend),this.stateT+=t,pt(this.loco);let s=po[this.rig]?.[n.clip]??n.clip,l={t:this.stateT,k:0,phase:this.phase,input:r,style:this.style,clock:this.clock*o};if(Tr[s](this.loco,l),pt(this.pose),this.blendT<this.blendDur?(this.blendT+=t,io(this.pose,this.from,this.loco,Cr(this.blendT/this.blendDur))):kr(this.pose,this.loco),kr(this.lastLoco,this.pose),this.emote){let c=this.emote;if(c.t+=t,(c.def.layer==="upper"?!(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 p=c.def.loop?Cr(c.t/.15):Cr(Math.min(c.t/.15,(c.def.duration-c.t)/.15));pt(this.tmp),Ro(this.tmp,c.def,c.t),this.overlay(this.tmp,p,false);}}let i=r.use?bi[r.use]:null;i&&(this.useClip=i),this.useW=Math.max(0,Math.min(1,this.useW+(i?t:-t)*8)),this.useClip&&this.useW>0?(pt(this.tmp),Tr[this.useClip](this.tmp,{...l,t:this.clock}),this.overlay(this.tmp,Cr(this.useW),false)):r.held!=="none"&&!this.emote&&pe(this.pose,"armR","rx",r.held==="staff"?.35:.2);for(let c of this.actions){c.t+=t;let m=Math.min(1,c.t/c.dur);pt(this.tmp),Tr[c.clip](this.tmp,{...l,t:c.t,k:m}),this.overlay(this.tmp,1,fi.has(c.clip));}this.actions=this.actions.filter(c=>c.t<c.dur),this.state!=="dead"&&this.state!=="sleep"&&(pe(this.pose,"head","ry",Math.max(-1.1,Math.min(1.1,r.lookYaw))),pe(this.pose,"head","rx",Math.max(-1.2,Math.min(1.2,r.lookPitch)))),this.flash&&(this.flash.left-=t)<=0&&(this.flash=null);for(let c of Ze){let m=this.postureW.get(c)??0,h=m+((c===a?1:0)-m)*Math.min(1,t*6);this.postureW.set(c,h),this.state!=="dead"&&So(this.pose,c,h);}for(let[c,m]of Object.entries(yi))for(let[h,d]of m(r,this.clock)){let p=c+"."+h,g=this.springs.get(p);g||this.springs.set(p,g={x:d,v:0});let b=60,E=9;g.v+=(b*(d-g.x)-E*g.v)*t,g.x+=g.v*t,pe(this.pose,c,h,g.x);}return this.expression=this.face(r,t,a),this.pose}overlay(t,r,a){for(let[o,n]of t){let s=Ct(this.pose,o);for(let l=0;l<9;l++)a?l>=re.sx?s[l]=s[l]*(1+(n[l]-1)*r):s[l]=s[l]+(n[l]-Mt[l])*r:s[l]=s[l]+(n[l]-s[l])*r;}}face(t,r,a){let o=s=>s.find(l=>this.faces.has(l))??"neutral";if(t.dead||this.state==="dead"||t.sleeping)return o(["blink","hurt","neutral"]);let n=o(zt[a]);return t.viseme!==void 0?(this.talkT=0,t.viseme!=="rest"&&t.viseme!=="MBP"?o(["talk",n]):n):t.talk?(this.talkT+=r,Math.floor(this.talkT/.12)%2===0?o(["talk",n]):n):(this.talkT=0,this.blinking>0?(this.blinking-=r,o(["blink",n])):(this.blinkT-=r,this.blinkT<=0&&(this.blinkT=2.5+this.random()*3,a!=="surprised"&&a!=="scared"&&a!=="hurt"&&(this.blinking=.13)),n))}};var Me="voxel-v1",ft=1,bt=["hair","top","bottom","shoes","hands","waist","back","neck","faceAcc","hat"],da=["head","torso","sleeveL","sleeveR","forearmL","forearmR","handL","handR","legL","legR","footL","footR"],ha={sleeves:["sleeveL","sleeveR"],forearms:["forearmL","forearmR"],arms:["sleeveL","sleeveR","forearmL","forearmR"],hands:["handL","handR"],legs:["legL","legR"],feet:["footL","footR"]},ut="@skin",ua={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},Qt=["round","sparkle","wide","cat","sleepy","dot","anime","almond","button","narrow","starry","glam"],er=["soft","thick","arched","none","straight","angled","bushy","thin"],tr=["smile","grin","cat","small","smirk","open","teeth","fang","tongue","pout"],rr=["none","freckles","mole","scar","plaster","whiskers","star"],ar=["block","round"],fa="round",ba=Ut,ya=qt,et={walk:"bouncy",idle:"calm"},tt=[.5,1.8,7.5,5.4],gi={eyes:"round",eyeColor:"#3b2a20",brows:"soft",browColor:"#3b2a20",mouth:"smile",cheeks:true,marks:"none",emotion:"neutral"},Zt={min:.9,max:1.1},Qe=(e,t,r)=>typeof e=="string"&&t.includes(e)?e:r,pa=e=>typeof e=="string"&&bt.includes(e);function Pt(e){let t=$(e)?e:{},r=$(t.body)?t.body:{},a=$(t.face)?t.face:{},o=$(t.anim)?t.anim:{},n=gi,s={};if($(t.wear))for(let[i,c]of Object.entries(t.wear))pa(i)&&typeof c=="string"&&c.trim()&&(s[i]=c.trim().slice(0,yt.id));let l={};if($(t.tint))for(let[i,c]of Object.entries(t.tint)){let m=je(c);pa(i)&&m&&(l[i]=m);}return {version:ft,style:Me,body:{skin:je(r.skin)??"#f2c9a0",height:Math.round(Ae(r.height,1,Zt.min,Zt.max)*1e3)/1e3,head:Qe(r.head,ar,fa)},face:{eyes:Qe(a.eyes,Qt,n.eyes),eyeColor:je(a.eyeColor)??n.eyeColor,brows:Qe(a.brows,er,n.brows),browColor:je(a.browColor)??n.browColor,mouth:Qe(a.mouth,tr,n.mouth),cheeks:typeof a.cheeks=="boolean"?a.cheeks:n.cheeks,marks:Qe(a.marks,rr,"none"),emotion:Qe(a.emotion,Ze,n.emotion)},anim:{walk:Qe(o.walk,ba,et.walk),idle:Qe(o.idle,ya,et.idle)},wear:s,tint:l}}var xi=/^[a-z0-9][a-z0-9_.-]*$/,wi=/^[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 Ri(e,t){if(!t||t.every(a=>a===0))return [e[0]/2,e[1]/2,e[2]/2];let r=Math.hypot(e[0],e[1],e[2])/2;return [r,r,r]}function It(e){let t=[],r=(M,R,A)=>t.push(Z({en:M,ru:R},A));if(!$(e))return {ok:false,errors:[Z({en:"the item is not an object",ru:"\u0432\u0435\u0449\u044C: \u043D\u0435 \u043E\u0431\u044A\u0435\u043A\u0442"})]};let a=e,o=yt;a.style!==void 0&&a.style!==Me&&r("style \xAB{s}\xBB is not {need}","\u0441\u0442\u0438\u043B\u044C \xAB{s}\xBB: \u043D\u0435 {need}",{s:String(a.style),need:Me});let n=typeof a.id=="string"?a.id.trim():"";if((!n||n.length>o.id||!xi.test(n))&&r("id must be 1, {n} characters: a-z, 0-9, _ . -","id: 1, {n} \u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432: a-z, 0-9, _ . -",{n:o.id}),!pa(a.slot))return r("unknown slot \xAB{s}\xBB","\u043D\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043D\u044B\u0439 \u0441\u043B\u043E\u0442 \xAB{s}\xBB",{s:String(a.slot)}),{ok:false,errors:t};let s=a.slot,l=ua[s],i=typeof a.name=="string"&&a.name.trim()?a.name.trim().slice(0,o.name):n,c={};if(!$(a.palette)||!Object.keys(a.palette).length)r("the palette is empty","\u043F\u0430\u043B\u0438\u0442\u0440\u0430 \u043F\u0443\u0441\u0442\u0430");else {let M=Object.entries(a.palette);M.length>o.palette&&r("more than {n} colours in the palette","\u0432 \u043F\u0430\u043B\u0438\u0442\u0440\u0435 \u0431\u043E\u043B\u044C\u0448\u0435 {n} \u0446\u0432\u0435\u0442\u043E\u0432",{n:o.palette});for(let[R,A]of M){let y=A===ut?ut:je(A);R.length!==1||Xe.has(R)||!y?r("palette colour \xAB{k}\xBB is not valid","\u0446\u0432\u0435\u0442 \u043F\u0430\u043B\u0438\u0442\u0440\u044B \xAB{k}\xBB \u043D\u0435 \u0433\u043E\u0434\u0438\u0442\u0441\u044F",{k:R}):c[R]=y;}}let m=typeof a.tint=="string"&&a.tint?a.tint:null;m!==null&&(!c[m]||c[m]===ut)&&r("tint \xAB{k}\xBB is not a colour of the palette","\u043F\u0435\u0440\u0435\u043A\u0440\u0430\u0441\u043A\u0430 \xAB{k}\xBB: \u043D\u0435 \u0446\u0432\u0435\u0442 \u043F\u0430\u043B\u0438\u0442\u0440\u044B",{k:m});let h={},d=0;if(a.textures!==void 0)if(!$(a.textures))r("textures is not an object","textures: \u043D\u0435 \u043E\u0431\u044A\u0435\u043A\u0442");else {let M=Object.entries(a.textures);M.length>o.textures&&r("more than {n} textures","\u0442\u0435\u043A\u0441\u0442\u0443\u0440 \u0431\u043E\u043B\u044C\u0448\u0435 {n}",{n:o.textures});for(let[R,A]of M){if(R.length>o.textureId||!wi.test(R)){r("texture id \xAB{id}\xBB must be 1, {n} letters or digits","id \u0442\u0435\u043A\u0441\u0442\u0443\u0440\u044B \xAB{id}\xBB: 1, {n} \u0431\u0443\u043A\u0432 \u0438\u043B\u0438 \u0446\u0438\u0444\u0440",{id:R.slice(0,20),n:o.textureId});continue}let y=$(A)?A:null,z=y&&Array.isArray(y.rows)?y.rows:null,C=y?y.w:void 0,L=y?y.h:void 0;if(!z||typeof C!="number"||typeof L!="number"||!Number.isInteger(C)||!Number.isInteger(L)||C<1||L<1||C>o.textureSide||L>o.textureSide||z.length!==L||z.some(_=>typeof _!="string"||_.length!==C)){r("texture \xAB{id}\xBB must be w\xD7h \u2264 {n} with exactly h rows of w symbols","\u0442\u0435\u043A\u0441\u0442\u0443\u0440\u0430 \xAB{id}\xBB: w\xD7h \u2264 {n}, \u0440\u043E\u0432\u043D\u043E h \u0441\u0442\u0440\u043E\u043A \u043F\u043E w \u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432",{id:R,n:o.textureSide});continue}z.some(_=>[..._].some(T=>!Xe.has(T)&&!c[T]))&&r("texture \xAB{id}\xBB uses symbols outside the palette","\u0432 \u0442\u0435\u043A\u0441\u0442\u0443\u0440\u0435 \xAB{id}\xBB \u0441\u0438\u043C\u0432\u043E\u043B\u044B \u043D\u0435 \u0438\u0437 \u043F\u0430\u043B\u0438\u0442\u0440\u044B",{id:R}),d+=C*L,h[R]={w:C,h:L,rows:z.map(_=>_.replace(/ /g,"."))};}d>o.texturePixels&&r("textures take {p} pixels, the limit is {n}","\u0442\u0435\u043A\u0441\u0442\u0443\u0440\u044B \u0437\u0430\u043D\u0438\u043C\u0430\u044E\u0442 {p} \u043F\u0438\u043A\u0441\u0435\u043B\u0435\u0439, \u043F\u0440\u0435\u0434\u0435\u043B {n}",{p:d,n:o.texturePixels});}let p=(M,R)=>typeof M!="string"?null:h[M]||c[M]?M:(r("{w}: \xAB{v}\xBB is neither a texture nor a palette colour","{w}: \xAB{v}\xBB: \u043D\u0438 \u0442\u0435\u043A\u0441\u0442\u0443\u0440\u0430, \u043D\u0438 \u0446\u0432\u0435\u0442 \u043F\u0430\u043B\u0438\u0442\u0440\u044B",{w:R,v:M}),null),g=(M,R,A=Ke)=>{if(M===void 0)return;if(!$(M)){r("{w}: faces is not an object","{w}: faces: \u043D\u0435 \u043E\u0431\u044A\u0435\u043A\u0442",{w:R});return}let y={};for(let[z,C]of Object.entries(M)){if(!Ke.includes(z)){r("{w}: unknown face \xAB{f}\xBB","{w}: \u043D\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043D\u0430\u044F \u0433\u0440\u0430\u043D\u044C \xAB{f}\xBB",{w:R,f:z});continue}if(!A.includes(z)){r("{w}: the {slot} slot may not paint the \xAB{f}\xBB face","{w}: \u0441\u043B\u043E\u0442 {slot} \u043D\u0435 \u043A\u0440\u0430\u0441\u0438\u0442 \u0433\u0440\u0430\u043D\u044C \xAB{f}\xBB",{w:R,slot:s,f:z});continue}let L=p(C,R);L&&(y[z]=L);}return Object.keys(y).length?y:void 0},b=[];a.paint!==void 0&&!Array.isArray(a.paint)&&r("paint is not a list","paint: \u043D\u0435 \u0441\u043F\u0438\u0441\u043E\u043A");for(let[M,R]of (Array.isArray(a.paint)?a.paint:[]).entries()){let A=`paint[${M}]`;if(!$(R)){r("{w} is not an object","{w}: \u043D\u0435 \u043E\u0431\u044A\u0435\u043A\u0442",{w:A});continue}let y=typeof R.region=="string"?R.region:"",z=ha[y]??(da.includes(y)?[y]:[]);if(!z.length){r("{w}: unknown region \xAB{r}\xBB","{w}: \u043D\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043D\u0430\u044F \u043E\u0431\u043B\u0430\u0441\u0442\u044C \xAB{r}\xBB",{w:A,r:y});continue}let C=z.filter(_=>!l.paint.includes(_));if(C.length){r("{w}: the {slot} slot may not paint \xAB{r}\xBB","{w}: \u0441\u043B\u043E\u0442 {slot} \u043D\u0435 \u043A\u0440\u0430\u0441\u0438\u0442 \xAB{r}\xBB",{w:A,slot:s,r:C.join(", ")});continue}let L=typeof R.color=="string"&&c[R.color]?R.color:null;L||r("{w}: colour is not in the palette","{w}: \u0446\u0432\u0435\u0442\u0430 \u043D\u0435\u0442 \u0432 \u043F\u0430\u043B\u0438\u0442\u0440\u0435",{w:A});let I=g(R.faces,A,l.paintFaces);if(L)for(let _ of z){let T={region:_,color:L};I&&(T.faces={...I}),b.push(T);}}let E=[];a.parts!==void 0&&!Array.isArray(a.parts)&&r("parts is not a list","parts: \u043D\u0435 \u0441\u043F\u0438\u0441\u043E\u043A");let v=Array.isArray(a.parts)?a.parts:[];v.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:v.length});for(let[M,R]of v.entries()){let A=`parts[${M}]`;if(!$(R)){r("{w} is not an object","{w}: \u043D\u0435 \u043E\u0431\u044A\u0435\u043A\u0442",{w:A});continue}let y=typeof R.bone=="string"?R.bone:"";if(!l.bones.includes(y)){r("{w}: the {slot} slot puts boxes only on {b}","{w}: \u0441\u043B\u043E\u0442 {slot} \u0441\u0442\u0430\u0432\u0438\u0442 \u043A\u043E\u0440\u043E\u0431\u043A\u0438 \u0442\u043E\u043B\u044C\u043A\u043E \u043D\u0430 {b}",{w:A,slot:s,b:l.bones.join(", ")});continue}let z=ma(R.size),C=ma(R.pos);if(!z||!C||z.some(me=>me<=0)){r("{w}: size and pos must be [x, y, z]","{w}: size \u0438 pos: [x, y, z]",{w:A});continue}let L=R.rot===void 0?void 0:ma(R.rot);R.rot!==void 0&&!L&&r("{w}: rot must be [x, y, z]","{w}: rot: [x, y, z]",{w:A});let I=R.mirror===true,_=Ri(z,L??void 0),D=(I?[C[0],-C[0]]:[C[0]]).some(me=>me-_[0]<l.box.min[0]-1e-6||me+_[0]>l.box.max[0]+1e-6)||[1,2].some(me=>C[me]-_[me]<l.box.min[me]-1e-6||C[me]+_[me]>l.box.max[me]+1e-6);D&&r("{w}: the box leaves the {slot} slot frame","{w}: \u043A\u043E\u0440\u043E\u0431\u043A\u0430 \u0432\u044B\u0445\u043E\u0434\u0438\u0442 \u0437\u0430 \u0440\u0430\u043C\u043A\u0443 \u0441\u043B\u043E\u0442\u0430 {slot}",{w:A,slot:s});let W=typeof R.color=="string"&&c[R.color]?R.color:null;W||r("{w}: colour is not in the palette","{w}: \u0446\u0432\u0435\u0442\u0430 \u043D\u0435\u0442 \u0432 \u043F\u0430\u043B\u0438\u0442\u0440\u0435",{w:A});let ee=g(R.faces,A),ve;if(R.mat!==void 0&&(typeof R.mat=="string"&&St.includes(R.mat)?ve=R.mat:r("{w}: material \xAB{m}\xBB is not {list}","{w}: \u043C\u0430\u0442\u0435\u0440\u0438\u0430\u043B \xAB{m}\xBB: \u043D\u0435 {list}",{w:A,m:String(R.mat),list:St.join(", ")})),!W||D)continue;let ue={bone:y,size:[...z],pos:[...C],color:W};ee&&(ue.faces=ee),L&&L.some(me=>me!==0)&&(ue.rot=[...L]),I&&(ue.mirror=true),typeof R.name=="string"&&R.name.trim()&&(ue.name=R.name.trim().slice(0,24)),ve&&(ue.mat=ve),E.push(ue);}return !v.length&&!(Array.isArray(a.paint)&&a.paint.length)&&r("the item neither paints nor adds anything","\u0432\u0435\u0449\u044C \u043D\u0438\u0447\u0435\u0433\u043E \u043D\u0435 \u043A\u0440\u0430\u0441\u0438\u0442 \u0438 \u043D\u0435 \u0434\u043E\u0431\u0430\u0432\u043B\u044F\u0435\u0442"),t.length?{ok:false,errors:t}:{ok:true,item:{version:ft,style:Me,id:n,slot:s,name:i,palette:c,tint:m,textures:h,paint:b,parts:E}}}var Se="#2b2140",Be="#7a2e2e",gt="#e8707a",ki={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 ga(e,t,r,a,o,n="neutral"){let s=o==="blink"||o==="talk"?n==="blink"||n==="talk"?"neutral":n:o,l=ki[s];e.clearRect(0,0,t,r),e.lineCap="round",e.lineJoin="round";let i=r*.5,c=t*.105,m=r*.2,h=o==="blink"?"closed":l.eye;if(a.cheeks&&s!=="scared"&&(e.fillStyle=s==="happy"?"rgba(236,110,140,0.5)":"rgba(236,120,140,0.32)",H(e,t*.12,r*.8,t*.07,r*.075),e.fill(),H(e,t*.88,r*.8,t*.07,r*.075),e.fill()),l.blush){e.fillStyle=`rgba(236,90,120,${.35*l.blush})`,H(e,t*.13,r*.8,t*.085,r*.09),e.fill(),H(e,t*.87,r*.8,t*.085,r*.09),e.fill(),e.strokeStyle=`rgba(200,60,90,${.7*l.blush})`,e.lineWidth=t*.008;for(let d of [t*.13,t*.87])for(let p=-1;p<=1;p++)e.beginPath(),e.moveTo(d+p*t*.025-t*.01,r*.84),e.lineTo(d+p*t*.025+t*.01,r*.76),e.stroke();}Ai(e,t,r,a);for(let d of [-1,1]){let p=t*(.5+d*.22),g=l.wink&&d===1&&h!=="closed"?"happy":h;Ei(e,p,i,c,m,d,a,g,l);let b=(l.browTilt??0)*(d===1?1:-0.4);vi(e,p,i-m-r*.07-r*b,t,r,d,a,l);}if(l.stream&&o!=="blink"){e.fillStyle="rgba(133,183,235,0.85)";for(let d of [-1,1]){let p=t*(.5+d*.22);e.beginPath(),e.moveTo(p-t*.03,i+m*.35),e.quadraticCurveTo(p-t*.045,r*.8,p-t*.025,r),e.lineTo(p+t*.025,r),e.quadraticCurveTo(p+t*.04,r*.8,p+t*.03,i+m*.35),e.closePath(),e.fill();}}if(l.sweat){e.fillStyle="#9fd3f5";let d=t*.95,p=r*.2;e.beginPath(),e.moveTo(d,p-r*.09),e.quadraticCurveTo(d+t*.035,p+r*.02,d,p+r*.05),e.quadraticCurveTo(d-t*.035,p+r*.02,d,p-r*.09),e.fill();}if(l.zzz){e.strokeStyle=Se,e.lineWidth=t*.012;let d=(p,g,b)=>{e.beginPath(),e.moveTo(p,g),e.lineTo(p+b,g),e.lineTo(p,g+b),e.lineTo(p+b,g+b),e.stroke();};d(t*.8,r*.12,t*.05),d(t*.88,r*.02,t*.035);}if(l.tear&&h==="open"){e.fillStyle="#85b7eb";let d=t*.5-t*.22-c*.6,p=i+m*1.05;e.beginPath(),e.moveTo(d,p-r*.07),e.quadraticCurveTo(d+t*.03,p,d,p+r*.04),e.quadraticCurveTo(d-t*.03,p,d,p-r*.07),e.fill();}Ti(e,t*.5,r*.86,t,r,a,o==="talk"?"talk":s);}function Ai(e,t,r,a){let o=a.marks;if(!(!o||o==="none"))switch(o){case "freckles":{e.fillStyle="rgba(150,90,50,0.55)";let n=[[.08,.7],[.13,.66],[.18,.71],[.11,.76],[.16,.78],[.92,.7],[.87,.66],[.82,.71],[.89,.76],[.84,.78]];for(let[s,l]of n)H(e,t*s,r*l,t*.009,t*.009),e.fill();return}case "mole":e.fillStyle="#4a2e22",H(e,t*.64,r*.82,t*.011,t*.011),e.fill();return;case "scar":{e.strokeStyle="rgba(150,60,60,0.75)",e.lineWidth=t*.012,e.beginPath(),e.moveTo(t*.2,r*.12),e.lineTo(t*.32,r*.78),e.stroke(),e.lineWidth=t*.007;for(let n=1;n<=4;n++){let s=n/5,l=t*(.2+.12*s),i=r*(.12+.66*s);e.beginPath(),e.moveTo(l-t*.025,i+r*.005),e.lineTo(l+t*.025,i-r*.005),e.stroke();}return}case "plaster":{e.save(),e.translate(t*.84,r*.74),e.rotate(-0.5),e.fillStyle="#f1d3a8",e.fillRect(-t*.07,-r*.04,t*.14,r*.08),e.fillStyle="#e3b98a",e.fillRect(-t*.025,-r*.04,t*.05,r*.08),e.restore();return}case "whiskers":{e.strokeStyle=Se,e.lineWidth=t*.008;for(let n of [-1,1])for(let s of [-0.04,0,.04])e.beginPath(),e.moveTo(t*(.5+n*.24),r*(.78+s)),e.lineTo(t*(.5+n*.42),r*(.75+s*1.8)),e.stroke();return}case "star":Pr(e,t*.84,r*.74,t*.045),e.fillStyle="#f2c14e",e.fill();return}}function Si(e,t,r,a){e.beginPath(),e.moveTo(t,r+a*.9),e.bezierCurveTo(t-a*1.4,r-a*.1,t-a*.7,r-a*1.1,t,r-a*.4),e.bezierCurveTo(t+a*.7,r-a*1.1,t+a*1.4,r-a*.1,t,r+a*.9),e.closePath();}function H(e,t,r,a,o){e.beginPath(),e.ellipse(t,r,Math.max(.1,a),Math.max(.1,o),0,0,Math.PI*2);}function Ei(e,t,r,a,o,n,s,l,i){let c=a*.26;if(e.strokeStyle=Se,e.lineWidth=c,l==="closed"){e.beginPath(),e.moveTo(t-a,r+o*.1),e.quadraticCurveTo(t,r+o*.55,t+a,r+o*.1),e.stroke(),s.eyes==="wide"&&Eo(e,t,r+o*.15,a,o*.3,n,c);return}if(l==="happy"){e.lineWidth=c*1.2,e.beginPath(),e.moveTo(t-a,r+o*.35),e.quadraticCurveTo(t,r-o*.75,t+a,r+o*.35),e.stroke();return}if(l==="heart"){Si(e,t,r,a*1.05),e.fillStyle="#e8436b",e.fill(),e.fillStyle="rgba(255,255,255,0.8)",H(e,t-a*.38,r-o*.25,a*.2,a*.16),e.fill();return}if(l==="star"){Pr(e,t,r,Math.min(a,o)*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 T=_/36*Math.PI*4*n,D=_/36*Math.min(a,o)*.95,W=t+Math.cos(T)*D,ee=r+Math.sin(T)*D;_?e.lineTo(W,ee):e.moveTo(W,ee);}e.stroke();return}if(l==="hurt"){let _=t-n*a*.6,T=t+n*a*.8;e.lineWidth=c*1.2,e.beginPath(),e.moveTo(T,r-o*.55),e.lineTo(_,r),e.lineTo(T,r+o*.55),e.stroke();return}let m=s.eyes==="anime"?1.12:s.eyes==="narrow"?1.15:1,h=s.eyes==="anime"?1.25:s.eyes==="narrow"?.55:1,d=a*i.white*m,p=o*i.white*h,g=s.eyes==="sleepy"?.32:0,b=Math.max(i.lidOuter,g),E=Math.max(i.lidInner,g),v=r-p,M=t+n*(d+c),R=t-n*(d+c),A=v+2*p*b,y=v+2*p*E,z=b>0||E>0;e.save(),z&&(e.beginPath(),e.moveTo(M,A),e.lineTo(R,y),e.lineTo(R,r+p*2),e.lineTo(M,r+p*2),e.closePath(),e.clip());let C=Math.min(d,p)*.8*i.iris*(s.eyes==="narrow"?1.5:1),L=r+p*.12,I=(i.look??0)*d*.45;switch(s.eyes){case "button":{e.fillStyle=Se,H(e,t+I,r+p*.05,d*.72,p*.8),e.fill(),e.fillStyle="#ffffff",H(e,t+I-d*.28,r-p*.25,d*.2,d*.2),e.fill(),H(e,t+I+d*.25,r+p*.3,d*.09,d*.09),e.fill();break}case "almond":{e.fillStyle="#ffffff",_t(e,t,r,d*1.05,p*.8,n),e.fill(),e.save(),_t(e,t,r,d*1.05,p*.8,n),e.clip(),e.fillStyle=s.eyeColor,H(e,t+I,L,C*1.05,C*1.05),e.fill(),e.fillStyle=Se,H(e,t+I,L,C*.5,C*.5),e.fill(),e.fillStyle="#ffffff",H(e,t+I-C*.38,L-C*.4,C*.28,C*.28),e.fill(),e.restore(),e.strokeStyle=Se,e.lineWidth=c*1.1,_t(e,t,r,d*1.05,p*.8,n),e.stroke();break}case "anime":case "starry":case "glam":case "narrow":{e.fillStyle="#ffffff",H(e,t,r,d,p),e.fill(),e.save(),H(e,t,r,d,p),e.clip();let _=s.eyes==="anime"?1.3:s.eyes==="narrow"?1:1.12,T=C*_,D=t+I;e.fillStyle=s.eyeColor,H(e,D,L,T*.95,T*(s.eyes==="anime"?1.25:1)),e.fill(),e.fillStyle="rgba(255,255,255,0.22)",H(e,D,L+T*.5,T*.7,T*.45),e.fill(),s.eyes==="starry"?(Pr(e,D,L,T*.62),e.fillStyle="#fff3b0",e.fill()):(e.fillStyle=Se,H(e,D,L,T*.46,T*(s.eyes==="anime"?.62:.5)),e.fill()),e.fillStyle="#ffffff",H(e,D-T*.38,L-T*.45,T*(s.eyes==="anime"?.38:.3),T*.3),e.fill(),H(e,D+T*.4,L+T*.4,T*.16,T*.16),e.fill(),e.restore(),e.strokeStyle=Se,e.lineWidth=s.eyes==="anime"||s.eyes==="glam"?c*1.6:c,e.beginPath(),e.ellipse(t,r,d,p,0,Math.PI*1.05,Math.PI*1.95),e.stroke(),s.eyes==="glam"&&(e.beginPath(),e.moveTo(t+n*d*.85,r-p*.45),e.lineTo(t+n*d*1.45,r-p*.95),e.stroke());break}case "dot":{e.fillStyle=Se,H(e,t+I,r+p*.1,d*.55,p*.72),e.fill(),e.fillStyle="#ffffff",H(e,t+I-d*.18,r-p*.18,d*.17,d*.17),e.fill();break}case "cat":{e.fillStyle="#ffffff",_t(e,t,r,d*1.08,p*.85,n),e.fill(),e.save(),_t(e,t,r,d*1.08,p*.85,n),e.clip(),e.fillStyle=s.eyeColor,H(e,t,L,C*1.05,C*1.2),e.fill(),e.fillStyle=Se,H(e,t,L,C*.22*(i.iris<1?1.5:1),C*.95),e.fill(),e.fillStyle="#ffffff",H(e,t-C*.4,L-C*.45,C*.25,C*.25),e.fill(),e.restore(),e.strokeStyle=Se,e.lineWidth=c,_t(e,t,r,d*1.08,p*.85,n),e.stroke();break}default:{let _=s.eyes==="sparkle"||s.eyes==="wide";e.fillStyle="#ffffff",H(e,t,r,d,p),e.fill(),e.save(),H(e,t,r,d,p),e.clip();let T=_?C*1.18:C;e.fillStyle=s.eyeColor,H(e,t+I,L,T*.95,T*(s.eyes==="sparkle"?1.15:1)),e.fill(),e.fillStyle="rgba(255,255,255,0.18)",H(e,t+I,L+T*.45,T*.7,T*.45),e.fill(),e.fillStyle=Se,H(e,t+I,L,T*.48,T*.52),e.fill(),e.fillStyle="#ffffff",H(e,t+I-T*.38,L-T*.42,T*.32,T*.32),e.fill(),H(e,t+I+T*.38,L+T*.38,T*.14,T*.14),e.fill(),s.eyes==="sparkle"&&(Pr(e,t+I+T*.3,L-T*.55,T*.22),e.fill()),e.restore(),e.strokeStyle=Se,e.lineWidth=c,e.beginPath(),e.ellipse(t,r,d,p,0,Math.PI*1.08,Math.PI*1.92),e.stroke();break}}if(e.restore(),z){e.strokeStyle=Se,e.lineWidth=c;let _=ee=>(ee-M)/(R-M),T=ee=>A+(y-A)*_(ee),D=t-d*.95,W=t+d*.95;e.beginPath(),e.moveTo(D,T(D)),e.lineTo(W,T(W)),e.stroke();}(s.eyes==="wide"||s.eyes==="glam")&&Eo(e,t,r-p*.55,d,p*.45,n,c);}function _t(e,t,r,a,o,n){let s=t+n*a,l=t-n*a;e.beginPath(),e.moveTo(l,r+o*.15),e.quadraticCurveTo(t,r-o*1.5,s,r-o*.35),e.quadraticCurveTo(t,r+o*1.4,l,r+o*.15),e.closePath();}function Eo(e,t,r,a,o,n,s){e.lineWidth=s*.8;let l=t+n*a;for(let i=0;i<2;i++){let c=r+i*o*.6;e.beginPath(),e.moveTo(l-n*a*.1,c),e.lineTo(l+n*a*.35,c-o*(.7-i*.2)),e.stroke();}}function Pr(e,t,r,a){e.beginPath();for(let o=0;o<8;o++){let n=o%2?a*.35:a,s=o*Math.PI/4-Math.PI/2,l=t+Math.cos(s)*n,i=r+Math.sin(s)*n;o?e.lineTo(l,i):e.moveTo(l,i);}e.closePath(),e.fillStyle="#ffffff";}function vi(e,t,r,a,o,n,s,l){if(s.brows==="none")return;let i=a*.095,c=r-o*l.browUp,m=t-n*i,h=t+n*i,d=c-o*l.browInner,p=c+o*l.browInner*.3;if(e.strokeStyle=s.browColor,e.fillStyle=s.browColor,s.brows==="bushy"){let b=o*.085;e.beginPath(),e.moveTo(h+n*a*.01,p+b*.2),e.quadraticCurveTo(t,Math.min(p,d)-b*.9,m,d-b*.1),e.lineTo(m,d+b*.8);for(let E=1;E<=4;E++){let v=m+(h-m)*E/4;e.lineTo(v-n*a*.01,d+(p-d)*(E/4)+b*(E%2?.5:.85));}e.closePath(),e.fill();return}if(s.brows==="straight"||s.brows==="thin"){e.lineWidth=a*(s.brows==="thin"?.014:.03),e.beginPath(),e.moveTo(h,p),e.lineTo(m,d),e.stroke();return}if(s.brows==="angled"){e.lineWidth=a*.028;let b=t+n*i*.3;e.beginPath(),e.moveTo(m,d),e.lineTo(b,Math.min(p,d)-o*.06),e.lineTo(h,p+o*.02),e.stroke();return}if(s.brows==="thick"){let b=o*.06;e.beginPath(),e.moveTo(h,p),e.quadraticCurveTo(t,Math.min(p,d)-b*.6,m,d),e.lineTo(m,d+b),e.quadraticCurveTo(t,Math.min(p,d)+b*.5,h,p+b*.6),e.closePath(),e.fill();return}e.lineWidth=a*(s.brows==="arched"?.026:.032),e.beginPath(),e.moveTo(h,p);let g=s.brows==="arched"?o*.09:o*.035;e.quadraticCurveTo(t+n*i*.2,Math.min(p,d)-g,m,d),e.stroke();}function Ti(e,t,r,a,o,n,s){let l=a*.026;e.strokeStyle=Be,e.lineWidth=l;let i=a*(n.mouth==="small"||n.mouth==="pout"?.06:n.mouth==="grin"?.12:.09),c=(m,h=4)=>{e.beginPath();for(let d=0;d<=h;d++){let p=t-i+2*i*d/h,g=r+(d%2?-1:1)*o*m;d?e.lineTo(p,g):e.moveTo(p,g);}e.stroke();};switch(s){case "love":case "wink":case "embarrassed":if(s==="embarrassed"){c(.025,4);return}e.beginPath(),e.moveTo(t-i,r-o*.04),e.quadraticCurveTo(t,r+o*.09,t+i,r-o*.04),e.stroke();return;case "excited":case "silly":{let m=Math.max(i,a*.11);e.fillStyle=Be,e.beginPath(),e.moveTo(t-m,r-o*.07),e.quadraticCurveTo(t,r-o*.03,t+m,r-o*.07),e.quadraticCurveTo(t,r+o*.22,t-m,r-o*.07),e.closePath(),e.fill(),s==="silly"?(e.fillStyle=gt,H(e,t+m*.25,r+o*.11,m*.4,o*.08),e.fill(),e.strokeStyle="#c4505c",e.lineWidth=l*.5,e.beginPath(),e.moveTo(t+m*.25,r+o*.06),e.lineTo(t+m*.25,r+o*.14),e.stroke()):(e.save(),e.clip(),e.fillStyle=gt,H(e,t,r+o*.12,m*.55,o*.06),e.fill(),e.restore());return}case "smug":case "cool":e.beginPath(),e.moveTo(t-i,r+o*.01),e.quadraticCurveTo(t+i*.3,r+o*.03,t+i*1.05,r-o*.06),e.stroke();return;case "confused":case "dizzy":c(s==="dizzy"?.035:.02,s==="dizzy"?6:4);return;case "disgusted":{e.beginPath(),e.moveTo(t-i,r+o*.05),e.lineTo(t-i*.3,r-o*.02),e.lineTo(t+i*.4,r+o*.03),e.lineTo(t+i,r-o*.01),e.stroke(),e.fillStyle=gt,H(e,t-i*.1,r+o*.045,i*.3,o*.03),e.fill();return}case "determined":{e.fillStyle="#ffffff",e.fillRect(t-i,r-o*.035,i*2,o*.07),e.strokeStyle=Be,e.lineWidth=l*.7,e.strokeRect(t-i,r-o*.035,i*2,o*.07),e.beginPath(),e.moveTo(t-i,r),e.lineTo(t+i,r),e.stroke();return}case "crying":{let m=Math.max(i,a*.1);e.fillStyle=Be,e.beginPath(),e.moveTo(t-m,r+o*.09),e.quadraticCurveTo(t,r-o*.14,t+m,r+o*.09),e.closePath(),e.fill();return}case "sleepy":e.fillStyle=Be,H(e,t,r+o*.01,a*.025,o*.035),e.fill();return;case "happy":{let m=Math.max(i,a*.1);e.fillStyle=Be,e.beginPath(),e.moveTo(t-m,r-o*.06),e.quadraticCurveTo(t,r-o*.02,t+m,r-o*.06),e.quadraticCurveTo(t,r+o*.2,t-m,r-o*.06),e.closePath(),e.fill(),e.save(),e.clip(),e.fillStyle=gt,H(e,t,r+o*.1,m*.55,o*.06),e.fill(),n.mouth==="grin"&&(e.fillStyle="#ffffff",e.fillRect(t-m,r-o*.08,m*2,o*.045)),e.restore();return}case "surprised":e.fillStyle=Be,H(e,t,r,a*.045,o*.085),e.fill();return;case "talk":e.fillStyle=Be,H(e,t,r,Math.max(i*.7,a*.06),o*.07),e.fill(),e.save(),e.clip(),e.fillStyle=gt,H(e,t,r+o*.06,a*.045,o*.035),e.fill(),e.restore();return;case "sad":e.beginPath(),e.moveTo(t-i,r+o*.04),e.quadraticCurveTo(t,r-o*.07,t+i,r+o*.04),e.stroke();return;case "angry":e.beginPath(),e.moveTo(t-i,r+o*.01),e.quadraticCurveTo(t,r-o*.03,t+i,r+o*.01),e.stroke();return;case "scared":{e.beginPath();let m=4;for(let h=0;h<=m;h++){let d=t-i+2*i*h/m,p=r+(h%2?-1:1)*o*.022;h?e.lineTo(d,p):e.moveTo(d,p);}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 m=4;for(let h=0;h<=m;h++){let d=t-i+2*i*h/m,p=r+(h%2?-1:1)*o*.04;h?e.lineTo(d,p):e.moveTo(d,p);}e.stroke();return}}if(n.mouth==="smirk"){e.beginPath(),e.moveTo(t-i,r),e.quadraticCurveTo(t+i*.3,r+o*.03,t+i,r-o*.06),e.stroke();return}if(n.mouth==="pout"){e.lineWidth=l*.9,e.beginPath(),e.moveTo(t-i*.15,r-o*.05),e.quadraticCurveTo(t+i*.9,r-o*.03,t-i*.05,r),e.quadraticCurveTo(t+i*.9,r+o*.03,t-i*.15,r+o*.05),e.stroke();return}if(n.mouth==="open"||n.mouth==="teeth"||n.mouth==="fang"||n.mouth==="tongue"){e.fillStyle=Be,e.beginPath(),e.moveTo(t-i,r-o*.04),e.quadraticCurveTo(t,r-o*.02,t+i,r-o*.04),e.quadraticCurveTo(t,r+o*.13,t-i,r-o*.04),e.closePath(),e.fill(),e.save(),e.clip(),n.mouth==="teeth"?(e.fillStyle="#ffffff",e.fillRect(t-i,r-o*.06,i*2,o*.045)):n.mouth!=="fang"&&(e.fillStyle=gt,H(e,t,r+o*.07,i*.55,o*.05),e.fill()),e.restore(),n.mouth==="fang"&&(e.fillStyle="#ffffff",e.beginPath(),e.moveTo(t+i*.35,r-o*.035),e.lineTo(t+i*.6,r-o*.035),e.lineTo(t+i*.47,r+o*.03),e.closePath(),e.fill()),n.mouth==="tongue"&&(e.fillStyle=gt,H(e,t+i*.3,r+o*.07,i*.32,o*.05),e.fill());return}if(n.mouth==="cat"){e.beginPath(),e.moveTo(t-i,r-o*.03),e.quadraticCurveTo(t-i*.5,r+o*.06,t,r-o*.01),e.quadraticCurveTo(t+i*.5,r+o*.06,t+i,r-o*.03),e.stroke();return}if(n.mouth==="grin"){e.fillStyle=Be,e.beginPath(),e.moveTo(t-i,r-o*.04),e.quadraticCurveTo(t,r-o*.01,t+i,r-o*.04),e.quadraticCurveTo(t,r+o*.12,t-i,r-o*.04),e.closePath(),e.fill(),e.save(),e.clip(),e.fillStyle="#ffffff",e.fillRect(t-i,r-o*.06,i*2,o*.04),e.restore();return}e.beginPath(),e.moveTo(t-i,r-o*.03),e.quadraticCurveTo(t,r+o*.06,t+i,r-o*.03),e.stroke();}var vo=16;function Li(e,t){if(typeof document<"u"){let r=document.createElement("canvas");return r.width=e,r.height=t,r}return new OffscreenCanvas(e,t)}var Ot=class{texture;g;w;h;face;current="neutral";base="neutral";constructor(t,r=tt){this.face=t,this.w=Math.round(r[2]*vo),this.h=Math.round(r[3]*vo);let a=Li(this.w,this.h),o=a.getContext("2d");if(!o)throw new Error("DrawnFace: no 2D canvas");this.g=o,this.texture=new V__namespace.CanvasTexture(a),this.texture.colorSpace=V__namespace.SRGBColorSpace,this.texture.anisotropy=4,this.paint("neutral");}paint(t,r){let a=r&&t!=="blink"&&t!=="talk"&&zt[r].includes(t)?r:t;a!=="blink"&&a!=="talk"?this.base=a:r&&(this.base=r),this.current=a,ga(this.g,this.w,this.h,this.face,a,this.base),this.texture.needsUpdate=true;}setFace(t){this.face=t,ga(this.g,this.w,this.h,this.face,this.current,this.base),this.texture.needsUpdate=true;}dispose(){this.texture.dispose();}};var Mi={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}},Ci=Object.fromEntries(Ao.map(e=>[e,Mi[e]??(wo(e)?{emote:e}:{})])),zi={handR:"handR",handL:"handL",head:"headTop"},_r=class{view;animator;input=Ar();seed;ownFace;drawn=null;pose="idle";jumpT=-1;constructor(t,r={}){this.ownFace=!r.facePainter,this.ownFace&&(this.drawn=To(t)),this.view=new Er(t,{shadows:false,gloss:!!t?.face?.drawn,...r,facePainter:r.facePainter??this.drawn}),this.seed=r.seed??1,this.animator=this.newAnimator();}get group(){return this.view.group}get height(){return this.view.height}setSpec(t){let r=this.view.hash;if(this.view.setSpec(t),this.view.hash!==r&&(this.animator=this.newAnimator(),this.ownFace)){let a=this.drawn;this.drawn=To(t),this.view.setFacePainter(this.drawn),a?.dispose();}}setEmotion(t){this.animator.setEmotion(t);}setViseme(t){this.input.viseme=t;}setPose(t){if(t===this.pose)return;this.pose=t;let r=Ci[t];if(this.input.speed=r.speed??0,this.input.sitting=!!r.sitting,r.emote)this.animator.playEmote(r.emote);else {let a=this.animator.emoting;a&&"loop"in Ne[a]&&Ne[a].loop&&this.animator.stopEmote();}r.air&&(this.jumpT=0,this.animator.trigger("jump"));}playEmote(t){this.animator.playEmote(t);}stopEmote(){this.animator.stopEmote();}trigger(t){if(t==="jump"){this.jumpT=0,this.animator.trigger("jump");return}this.animator.trigger(t);}attach(t,r){this.view.attach(zi[t],r);}update(t){let r=this.input;this.jumpT>=0&&(this.jumpT+=t,r.onGround=this.jumpT>.6,r.vy=this.jumpT<.3?4:-4,r.onGround&&(this.jumpT=-1,r.vy=0,this.animator.trigger("land")));let a=this.animator.update(t,r);this.view.applyPose(a),this.view.setExpression(this.animator.expression,this.animator.emotion);}dispose(){this.view.dispose(),this.drawn?.dispose();}newAnimator(){let t=this.view.spec,r=new zr(t.rig,t.style,this.view.expressions);return r.setRandom(fr(this.seed)),r}};function To(e){let t=e?.face?.drawn;if(!t)return null;try{let{face:r}=Pt({face:{...t,brows:t.brows,browColor:"#2a1c14"}});return new Ot({...r,emotion:"neutral"},e.face.rect)}catch{return null}}var Pi=Ht.map(e=>{let t=Ie[e],r=t.bones.map(o=>`${o.name}@[${o.pivot.join(",")}]`).join(" "),a=t.defaultParts.map(o=>`${o.bone} ${o.size.join("x")} at [${o.pos.join(",")}]`).join("; ");return `- "${e}" \u2014 ${t.hint}. Bones (name@pivot): ${r}. Default body: ${a}.`}).join(`
|
|
25
|
+
`),Gc=`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
|
-
${
|
|
32
|
+
${Pi}
|
|
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": ${
|
|
39
|
+
"rig": ${Ht.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": ${
|
|
51
|
+
{ "name": string, "parent": "<bone>", "pivot": [x, y, z], "role": ${br.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": { ${
|
|
55
|
-
"style": { "walk": ${
|
|
54
|
+
"expressions": { ${Gt.map(e=>`"${e}"`).join(", ")}: "<texture id of size w x h>" } } \u2014 eyes and mouth, drawn over the head; "neutral" is required, draw as many others as you can (at least blink, happy, sad, angry, surprised),
|
|
55
|
+
"style": { "walk": ${Ut.map(e=>`"${e}"`).join(" | ")}, "idle": ${qt.map(e=>`"${e}"`).join(" | ")}, "energy": 0..1 },
|
|
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 qi=["cat","dog","fox","bear","rabbit","bird","dragon","slime","ghost","robot"],aa=e=>({k:"#2a1c14",w:"#f4f4ef",b:e,m:"#7a3a30",o:"#3a1a14"});function sa(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,...aa(e.eyes??"#3f6f3a")},n=[],a="quadruped",i=ct("head",[0,3,8,5]),c={walk:"normal",idle:"calm",energy:.6},s=(l,h,m,p,y,x={})=>n.push({name:l,bone:h,size:m,pos:p,color:y,...x});switch(e.kind){case "cat":case "fox":case "dog":case "bear":case "rabbit":{let l=e.kind;s("body","body",[8,8,16],[0,12,0],"t"),s("belly","body",[6,1,12],[0,8,0],"l"),s("head","head",[8,8,8],[0,16,-12],"s");for(let h of ["legFL","legFR","legBL","legBR"]){let m=h.endsWith("L")?-3:3,p=h.startsWith("legF")?-6:6;s(h,h,[3,8,3],[m,4,p],"t"),s(`${h}Paw`,h,[3.2,1.5,3.2],[m,.75,p],"a");}l==="cat"?(s("ear","head",[2,2.5,1],[-2.5,21,-11],"a",{mirror:true}),s("tail","tail",[1.6,1.6,10],[0,15,13],"t",{rot:[20,0,0]}),c={walk:"sneaky",idle:"calm",energy:.5}):l==="fox"?(s("ear","head",[2.4,3.2,1],[-2.5,21.4,-11],"t",{mirror:true}),s("snout","head",[4,3,3],[0,14.5,-17],"l"),s("nose","head",[1.2,1,.6],[0,15.6,-18.6],"a"),s("tail","tail",[3.5,3.5,10],[0,14,13],"t",{rot:[15,0,0]}),s("tailTip","tail",[3.6,3.6,2.5],[0,15.2,18],"l"),c={walk:"bouncy",idle:"fidgety",energy:.7}):l==="dog"?(s("ear","head",[1.5,4,3],[-4.6,17.5,-11.5],"a",{mirror:true}),s("snout","head",[4,3,3],[0,14.5,-17],"l"),s("nose","head",[1.6,1.2,.6],[0,15.8,-18.6],"a"),s("tail","tail",[2,2,7],[0,16,11],"t",{rot:[40,0,0]}),c={walk:"bouncy",idle:"fidgety",energy:.9}):l==="bear"?(s("ear","head",[2,2,1],[-3,20.6,-10.5],"a",{mirror:true}),s("snout","head",[4,3,2.5],[0,14.5,-16.8],"l"),s("nose","head",[1.6,1.2,.6],[0,15.8,-18.2],"a"),s("tail","tail",[2,2,2],[0,14,9],"t"),c={walk:"heavy",idle:"proud",energy:.4}):(s("ear","head",[1.6,7,1],[-1.8,23.5,-11],"t",{mirror:true}),s("earInner","head",[.8,5.5,.4],[-1.8,23.5,-11.6],"l",{mirror:true}),s("tail","tail",[3,3,3],[0,14,9.5],"l"),c={walk:"bouncy",idle:"fidgety",energy:.8});break}case "bird":case "dragon":{a="flyer",i=ct("head",[0,1,5,3]);let l=e.kind==="dragon";s("body","body",[6,6,8],[0,8,0],"t"),s("belly","body",[4.6,4,1],[0,7.5,-4.2],"l"),s("head","head",[5,5,5],[0,13,-4],"s"),s("wing","wingL",[8,1,6],[-7,10,0],"a",{mirror:true}),s("leg","legL",[1,4,1],[-1.5,2,0],"a",{mirror:true}),l?(s("horn","head",[.8,2,.8],[-1.4,16.4,-3],"l",{mirror:true}),s("snout","head",[3,2,2.4],[0,12.2,-7.4],"s"),s("tail","tail",[2,2,8],[0,7,7],"t"),s("spike","body",[1,1.5,6],[0,11.6,0],"a"),c={walk:"heavy",idle:"proud",energy:.6}):(s("beak","head",[1.6,1.2,2],[0,12.4,-7.2],"a"),s("tail","tail",[4,1,4],[0,8,6],"a"),s("crest","head",[1,2,2],[0,16.2,-3.6],"a"),c={walk:"bouncy",idle:"fidgety",energy:.8});break}case "slime":case "ghost":case "robot":{a="blob",i=ct("body",[2,3,8,5]),e.kind==="slime"?(s("body","body",[12,10,12],[0,5,0],"t"),s("shine","body",[3,2,.4],[-3,8,-6.2],"l"),c={walk:"bouncy",idle:"fidgety",energy:.9}):e.kind==="ghost"?(s("body","body",[10,12,10],[0,7,0],"t"),s("hem","body",[10.4,2,10.4],[0,1,0],"l"),c={walk:"sneaky",idle:"calm",energy:.4}):(s("body","body",[11,11,10],[0,5.5,0],"t"),s("antenna","body",[.8,3,.8],[0,12.5,0],"a"),s("bulb","body",[1.6,1.6,1.6],[0,14.6,0],"l"),s("screen","body",[9,6,.4],[0,6.5,-5.2],"l"),c={walk:"robotic",idle:"calm",energy:.5});break}}return {version:1,name:e.name,description:e.description??"",rig:a,palette:o,textures:i.textures,parts:n,face:i.face,style:c,finish:{noise:.45,outline:.4,shade:.25,density:2},tags:e.tags??[e.kind]}}function Wi(e){let t=le(sa(e));if(!t.ok)throw new Error(`${e.kind}: ${t.error}`);return t.spec}var ne="voxel-v1",Te=1,Ce=["hair","top","bottom","shoes","hands","waist","back","faceAcc","hat"],Xt=["head","torso","sleeveL","sleeveR","forearmL","forearmR","handL","handR","legL","legR","footL","footR"],Jt={sleeves:["sleeveL","sleeveR"],forearms:["forearmL","forearmR"],arms:["sleeveL","sleeveR","forearmL","forearmR"],hands:["handL","handR"],legs:["legL","legR"],feet:["footL","footR"]},ke="@skin",Zt={hair:{bones:["head"],paint:["head"],paintFaces:["top","back","left","right"],parts:8,box:{min:[-6,22,-6],max:[6,35.5,6]}},hat:{bones:["head"],paint:[],parts:8,box:{min:[-7,26,-8],max:[7,38,7]}},top:{bones:["body","armL","armR","foreArmL","foreArmR"],paint:["torso","sleeveL","sleeveR","forearmL","forearmR"],parts:6,box:{min:[-10,9.5,-6],max:[10,26,6]}},bottom:{bones:["body","legL","legR","shinL","shinR"],paint:["legL","legR"],parts:4,box:{min:[-6.5,.5,-4.5],max:[6.5,17,4.5]}},shoes:{bones:["legL","legR","shinL","shinR"],paint:["footL","footR"],parts:4,box:{min:[-5.5,-0.5,-4.5],max:[5.5,7,4]}},hands:{bones:["armL","armR","foreArmL","foreArmR"],paint:["handL","handR"],parts:2,box:{min:[-10,9.5,-4],max:[10,16,4]}},waist:{bones:["body"],paint:[],parts:4,box:{min:[-7,9.5,-4],max:[7,16.5,4]}},back:{bones:["body"],paint:[],parts:8,box:{min:[-13.5,6,1.5],max:[13.5,36.5,13]}},faceAcc:{bones:["head"],paint:[],parts:4,box:{min:[-6,22.5,-6],max:[6,30.5,-2]}}},Me={palette:5,textures:4,textureSide:32,texturePixels:2048,id:40,textureId:12,name:40},Ye=["round","sparkle","wide","cat","sleepy","dot"],$e=["soft","thick","arched","none"],qe=["smile","grin","cat","small"],We=[.5,1.8,7.5,5.4],ia={eyes:"round",eyeColor:"#3b2a20",brows:"soft",browColor:"#3b2a20",mouth:"smile",cheeks:true,emotion:"neutral"},Ue={min:.9,max:1.1},vt=(e,t,r)=>typeof e=="string"&&t.includes(e)?e:r,Kt=e=>typeof e=="string"&&Ce.includes(e);function Rt(e){let t=N(e)?e:{},r=N(t.body)?t.body:{},o=N(t.face)?t.face:{},n=ia,a={};if(N(t.wear))for(let[c,s]of Object.entries(t.wear))Kt(c)&&typeof s=="string"&&s.trim()&&(a[c]=s.trim().slice(0,Me.id));let i={};if(N(t.tint))for(let[c,s]of Object.entries(t.tint)){let l=ue(s);Kt(c)&&l&&(i[c]=l);}return {version:Te,style:ne,body:{skin:ue(r.skin)??"#f2c9a0",height:Math.round(Q(r.height,1,Ue.min,Ue.max)*1e3)/1e3},face:{eyes:vt(o.eyes,Ye,n.eyes),eyeColor:ue(o.eyeColor)??n.eyeColor,brows:vt(o.brows,$e,n.brows),browColor:ue(o.browColor)??n.browColor,mouth:vt(o.mouth,qe,n.mouth),cheeks:typeof o.cheeks=="boolean"?o.cheeks:n.cheeks,emotion:vt(o.emotion,xe,n.emotion)},wear:a,tint:i}}var la=/^[a-z0-9][a-z0-9_.-]*$/,ca=/^[A-Za-z0-9]+$/;function Wt(e){return !Array.isArray(e)||e.length!==3?null:e.every(t=>typeof t=="number"&&Number.isFinite(t))?e:null}function pa(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 St(e){let t=[],r=(g,f,E)=>t.push(B({en:g,ru:f},E));if(!N(e))return {ok:false,errors:[B({en:"the item is not an object",ru:"\u0432\u0435\u0449\u044C: \u043D\u0435 \u043E\u0431\u044A\u0435\u043A\u0442"})]};let o=e,n=Me;o.style!==void 0&&o.style!==ne&&r("style \xAB{s}\xBB is not {need}","\u0441\u0442\u0438\u043B\u044C \xAB{s}\xBB: \u043D\u0435 {need}",{s:String(o.style),need:ne});let a=typeof o.id=="string"?o.id.trim():"";if((!a||a.length>n.id||!la.test(a))&&r("id must be 1, {n} characters: a-z, 0-9, _ . -","id: 1, {n} \u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432: a-z, 0-9, _ . -",{n:n.id}),!Kt(o.slot))return r("unknown slot \xAB{s}\xBB","\u043D\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043D\u044B\u0439 \u0441\u043B\u043E\u0442 \xAB{s}\xBB",{s:String(o.slot)}),{ok:false,errors:t};let i=o.slot,c=Zt[i],s=typeof o.name=="string"&&o.name.trim()?o.name.trim().slice(0,n.name):a,l={};if(!N(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 g=Object.entries(o.palette);g.length>n.palette&&r("more than {n} colours in the palette","\u0432 \u043F\u0430\u043B\u0438\u0442\u0440\u0435 \u0431\u043E\u043B\u044C\u0448\u0435 {n} \u0446\u0432\u0435\u0442\u043E\u0432",{n:n.palette});for(let[f,E]of g){let d=E===ke?ke:ue(E);f.length!==1||ye.has(f)||!d?r("palette colour \xAB{k}\xBB is not valid","\u0446\u0432\u0435\u0442 \u043F\u0430\u043B\u0438\u0442\u0440\u044B \xAB{k}\xBB \u043D\u0435 \u0433\u043E\u0434\u0438\u0442\u0441\u044F",{k:f}):l[f]=d;}}let h=typeof o.tint=="string"&&o.tint?o.tint:null;h!==null&&(!l[h]||l[h]===ke)&&r("tint \xAB{k}\xBB is not a colour of the palette","\u043F\u0435\u0440\u0435\u043A\u0440\u0430\u0441\u043A\u0430 \xAB{k}\xBB: \u043D\u0435 \u0446\u0432\u0435\u0442 \u043F\u0430\u043B\u0438\u0442\u0440\u044B",{k:h});let m={},p=0;if(o.textures!==void 0)if(!N(o.textures))r("textures is not an object","textures: \u043D\u0435 \u043E\u0431\u044A\u0435\u043A\u0442");else {let g=Object.entries(o.textures);g.length>n.textures&&r("more than {n} textures","\u0442\u0435\u043A\u0441\u0442\u0443\u0440 \u0431\u043E\u043B\u044C\u0448\u0435 {n}",{n:n.textures});for(let[f,E]of g){if(f.length>n.textureId||!ca.test(f)){r("texture id \xAB{id}\xBB must be 1, {n} letters or digits","id \u0442\u0435\u043A\u0441\u0442\u0443\u0440\u044B \xAB{id}\xBB: 1, {n} \u0431\u0443\u043A\u0432 \u0438\u043B\u0438 \u0446\u0438\u0444\u0440",{id:f.slice(0,20),n:n.textureId});continue}let d=N(E)?E:null,R=d&&Array.isArray(d.rows)?d.rows:null,S=d?d.w:void 0,v=d?d.h:void 0;if(!R||typeof S!="number"||typeof v!="number"||!Number.isInteger(S)||!Number.isInteger(v)||S<1||v<1||S>n.textureSide||v>n.textureSide||R.length!==v||R.some(C=>typeof C!="string"||C.length!==S)){r("texture \xAB{id}\xBB must be w\xD7h \u2264 {n} with exactly h rows of w symbols","\u0442\u0435\u043A\u0441\u0442\u0443\u0440\u0430 \xAB{id}\xBB: w\xD7h \u2264 {n}, \u0440\u043E\u0432\u043D\u043E h \u0441\u0442\u0440\u043E\u043A \u043F\u043E w \u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432",{id:f,n:n.textureSide});continue}R.some(C=>[...C].some(L=>!ye.has(L)&&!l[L]))&&r("texture \xAB{id}\xBB uses symbols outside the palette","\u0432 \u0442\u0435\u043A\u0441\u0442\u0443\u0440\u0435 \xAB{id}\xBB \u0441\u0438\u043C\u0432\u043E\u043B\u044B \u043D\u0435 \u0438\u0437 \u043F\u0430\u043B\u0438\u0442\u0440\u044B",{id:f}),p+=S*v,m[f]={w:S,h:v,rows:R.map(C=>C.replace(/ /g,"."))};}p>n.texturePixels&&r("textures take {p} pixels, the limit is {n}","\u0442\u0435\u043A\u0441\u0442\u0443\u0440\u044B \u0437\u0430\u043D\u0438\u043C\u0430\u044E\u0442 {p} \u043F\u0438\u043A\u0441\u0435\u043B\u0435\u0439, \u043F\u0440\u0435\u0434\u0435\u043B {n}",{p,n:n.texturePixels});}let y=(g,f)=>typeof g!="string"?null:m[g]||l[g]?g:(r("{w}: \xAB{v}\xBB is neither a texture nor a palette colour","{w}: \xAB{v}\xBB: \u043D\u0438 \u0442\u0435\u043A\u0441\u0442\u0443\u0440\u0430, \u043D\u0438 \u0446\u0432\u0435\u0442 \u043F\u0430\u043B\u0438\u0442\u0440\u044B",{w:f,v:g}),null),x=(g,f,E=be)=>{if(g===void 0)return;if(!N(g)){r("{w}: faces is not an object","{w}: faces: \u043D\u0435 \u043E\u0431\u044A\u0435\u043A\u0442",{w:f});return}let d={};for(let[R,S]of Object.entries(g)){if(!be.includes(R)){r("{w}: unknown face \xAB{f}\xBB","{w}: \u043D\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043D\u0430\u044F \u0433\u0440\u0430\u043D\u044C \xAB{f}\xBB",{w:f,f:R});continue}if(!E.includes(R)){r("{w}: the {slot} slot may not paint the \xAB{f}\xBB face","{w}: \u0441\u043B\u043E\u0442 {slot} \u043D\u0435 \u043A\u0440\u0430\u0441\u0438\u0442 \u0433\u0440\u0430\u043D\u044C \xAB{f}\xBB",{w:f,slot:i,f:R});continue}let v=y(S,f);v&&(d[R]=v);}return Object.keys(d).length?d:void 0},b=[];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[g,f]of (Array.isArray(o.paint)?o.paint:[]).entries()){let E=`paint[${g}]`;if(!N(f)){r("{w} is not an object","{w}: \u043D\u0435 \u043E\u0431\u044A\u0435\u043A\u0442",{w:E});continue}let d=typeof f.region=="string"?f.region:"",R=Jt[d]??(Xt.includes(d)?[d]:[]);if(!R.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:E,r:d});continue}let S=R.filter(C=>!c.paint.includes(C));if(S.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:E,slot:i,r:S.join(", ")});continue}let v=typeof f.color=="string"&&l[f.color]?f.color:null;v||r("{w}: colour is not in the palette","{w}: \u0446\u0432\u0435\u0442\u0430 \u043D\u0435\u0442 \u0432 \u043F\u0430\u043B\u0438\u0442\u0440\u0435",{w:E});let I=x(f.faces,E,c.paintFaces);if(v)for(let C of R){let L={region:C,color:v};I&&(L.faces={...I}),b.push(L);}}let T=[];o.parts!==void 0&&!Array.isArray(o.parts)&&r("parts is not a list","parts: \u043D\u0435 \u0441\u043F\u0438\u0441\u043E\u043A");let k=Array.isArray(o.parts)?o.parts:[];k.length>c.parts&&r("the {slot} slot allows {n} boxes, the item has {m}","\u0441\u043B\u043E\u0442\u0443 {slot} \u043C\u043E\u0436\u043D\u043E {n} \u043A\u043E\u0440\u043E\u0431\u043E\u043A, \u0443 \u0432\u0435\u0449\u0438 {m}",{slot:i,n:c.parts,m:k.length});for(let[g,f]of k.entries()){let E=`parts[${g}]`;if(!N(f)){r("{w} is not an object","{w}: \u043D\u0435 \u043E\u0431\u044A\u0435\u043A\u0442",{w:E});continue}let d=typeof f.bone=="string"?f.bone:"";if(!c.bones.includes(d)){r("{w}: the {slot} slot puts boxes only on {b}","{w}: \u0441\u043B\u043E\u0442 {slot} \u0441\u0442\u0430\u0432\u0438\u0442 \u043A\u043E\u0440\u043E\u0431\u043A\u0438 \u0442\u043E\u043B\u044C\u043A\u043E \u043D\u0430 {b}",{w:E,slot:i,b:c.bones.join(", ")});continue}let R=Wt(f.size),S=Wt(f.pos);if(!R||!S||R.some(P=>P<=0)){r("{w}: size and pos must be [x, y, z]","{w}: size \u0438 pos: [x, y, z]",{w:E});continue}let v=f.rot===void 0?void 0:Wt(f.rot);f.rot!==void 0&&!v&&r("{w}: rot must be [x, y, z]","{w}: rot: [x, y, z]",{w:E});let I=f.mirror===true,C=pa(R,v??void 0),G=(I?[S[0],-S[0]]:[S[0]]).some(P=>P-C[0]<c.box.min[0]-1e-6||P+C[0]>c.box.max[0]+1e-6)||[1,2].some(P=>S[P]-C[P]<c.box.min[P]-1e-6||S[P]+C[P]>c.box.max[P]+1e-6);G&&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:E,slot:i});let w=typeof f.color=="string"&&l[f.color]?f.color:null;w||r("{w}: colour is not in the palette","{w}: \u0446\u0432\u0435\u0442\u0430 \u043D\u0435\u0442 \u0432 \u043F\u0430\u043B\u0438\u0442\u0440\u0435",{w:E});let A=x(f.faces,E);if(!w||G)continue;let M={bone:d,size:[...R],pos:[...S],color:w};A&&(M.faces=A),v&&v.some(P=>P!==0)&&(M.rot=[...v]),I&&(M.mirror=true),typeof f.name=="string"&&f.name.trim()&&(M.name=f.name.trim().slice(0,24)),T.push(M);}return !k.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:Te,style:ne,id:a,slot:i,name:s,palette:l,tint:h,textures:m,paint:b,parts:T}}}var Br={torso:"#d9d3c5",legs:"#5f6b7a"},ha="#2b2140",ma="#7a2e2e",da="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",fa=32,ua=[10,7],ba={noise:0,outline:0,shade:.12,density:4,round:.35},ya=["front","back","left","right"];function Vr(e){let t=parseInt(e.slice(1),16);return [t>>16&255,t>>8&255,t&255]}var Qt=class{map={};next=0;key(t){let r=Object.entries(this.map).find(([,s])=>s===t);if(r)return r[0];if(this.next<fa){let s=da[this.next++];return this.map[s]=t,s}let[o,n,a]=Vr(t),i=Object.keys(this.map)[0],c=1/0;for(let[s,l]of Object.entries(this.map)){let[h,m,p]=Vr(l),y=(o-h)**2+(n-m)**2+(a-p)**2;y<c&&(c=y,i=s);}return i}};function ga(e,t){return (typeof e=="function"?e(t):e[t])??null}function xa(e){let[t,r]=ua,o=new O(t,r),n=a=>{a(1),a(6);};switch(e){case "blink":case "tired":n(a=>o.row(3,a,a+2,"k"));break;case "happy":n(a=>o.px(a,3,"k").px(a+1,2,"k").px(a+2,3,"k"));break;case "hurt":o.px(1,2,"k").px(2,3,"k").px(1,4,"k"),o.px(8,2,"k").px(7,3,"k").px(8,4,"k");break;case "surprised":case "scared":n(a=>o.rect(a,2,3,3,"w").px(a+1,3,"k"));break;default:n(a=>o.rect(a,2,3,3,"w").rect(a+1,3,2,2,"e").px(a+1,3,"k"));}switch(e==="angry"&&o.px(1,1,"k").px(2,1,"k").px(3,2,"k").px(8,1,"k").px(7,1,"k").px(6,2,"k"),e==="sad"&&o.px(3,1,"k").px(2,1,"k").px(6,1,"k").px(7,1,"k"),e){case "happy":case "talk":o.rect(4,5,2,2,"m");break;case "surprised":o.rect(4,5,2,2,"m");break;case "sad":o.px(3,6,"m").row(5,4,5,"m").px(6,6,"m");break;case "angry":case "tired":case "scared":case "hurt":o.row(6,4,5,"m");break;default:o.px(3,5,"m").row(6,4,5,"m").px(6,5,"m");}return o.tex()}function er(e,t){let r=ie[Oe],o=new Qt,n=o.key(e.body.skin),a=r.defaultParts.map(p=>({...p,size:[...p.size],pos:[...p.pos],color:p.name==="torso"?o.key(Br.torso):p.name?.startsWith("leg")||p.name?.startsWith("foot")?o.key(Br.legs):n})),i=new Map;for(let p of a){let y=i.get(p.name)??[];y.push(p),i.set(p.name,y);}for(let p of i.values())p.sort((y,x)=>x.pos[1]+x.size[1]/2-(y.pos[1]+y.size[1]/2));let c={},s={k:o.key(ha),w:o.key("#ffffff"),e:o.key(e.face.eyeColor),m:o.key(ma)},l={};for(let p of je){let y=xa(p),x="face_"+p;c[x]={...y,rows:y.rows.map(b=>[...b].map(T=>s[T]??T).join(""))},l[p]=x;}l.neutral=l[e.face.emotion]??l.neutral;for(let p of Ce){let y=e.wear[p];if(!y)continue;let x=ga(t,y);if(!x||x.slot!==p||x.style!==ne)continue;let b={};for(let[g,f]of Object.entries(x.palette))b[g]=f===ke?n:o.key(g===x.tint&&e.tint[p]?e.tint[p]:f);let T={};for(let[g,f]of Object.entries(x.textures)){let E=`${p}_${g}`;T[g]=E,c[E]={w:f.w,h:f.h,rows:f.rows.map(d=>[...d].map(R=>b[R]??R).join(""))};}let k=g=>{if(!g)return;let f={};for(let[E,d]of Object.entries(g)){let R=T[d]??b[d];R&&(f[E]=R);}return Object.keys(f).length?f:void 0};for(let g of x.paint){let f=i.get(g.region);if(!f)continue;let E=b[g.color],d=k(g.faces);f.forEach((R,S)=>{E&&(R.color=E);let v=d&&wa(d,f,S,c);v?R.faces=v:delete R.faces;});}for(let g of x.parts){let f={bone:g.bone,size:[...g.size],pos:[...g.pos],color:b[g.color]??n},E=k(g.faces);E&&(f.faces=E),g.rot&&(f.rot=[...g.rot]),g.mirror&&(f.mirror=true),g.name&&(f.name=g.name),a.push(f);}}let h={version:1,name:"Avatar",description:"",rig:Oe,scale:e.body.height,palette:o.map,textures:c,parts:a,bones:[],face:{bone:r.faceBone,rect:[...We],expressions:l},style:{walk:"bouncy",idle:"calm",energy:.6},voice:{pitch:1},tags:["avatar",ne],finish:{...ba}},m=le(h);if(!m.ok)throw new Error("composeAvatar: "+m.error);return m.spec}function wa(e,t,r,o){if(t.length===1)return {...e};let n=t[0].pos[1]+t[0].size[1]/2,a=Math.min(...t.map(l=>l.pos[1]-l.size[1]/2)),i=Math.max(1e-6,n-a),c=l=>l<=0?0:l>=t.length?1:(n-(t[l-1].pos[1]-t[l-1].size[1]/2))/i,s={};for(let[l,h]of Object.entries(e)){let m=o[h];if(!m){s[l]=h;continue}if(l==="top"){r===0&&(s[l]=h);continue}if(l==="bottom"){r===t.length-1&&(s[l]=h);continue}if(!ya.includes(l))continue;let p=Math.min(m.h-1,Math.round(c(r)*m.h)),y=Math.max(p+1,Math.round(c(r+1)*m.h)),x=`${h}_${r}`;o[x]||(o[x]={w:m.w,h:y-p,rows:m.rows.slice(p,y)}),s[l]=x;}return Object.keys(s).length?s:void 0}var Ie="#2b2140",Ke="#7a2e2e",jr="#e8707a",va={neutral:{eye:"open",iris:1,white:1,lidOuter:0,lidInner:0,browUp:0,browInner:0,tear:false},happy:{eye:"happy",iris:1,white:1,lidOuter:0,lidInner:0,browUp:.04,browInner:0,tear:false},sad:{eye:"open",iris:1,white:1,lidOuter:.38,lidInner:.12,browUp:0,browInner:.09,tear:true},angry:{eye:"open",iris:.9,white:.95,lidOuter:.1,lidInner:.42,browUp:-0.02,browInner:-0.1,tear:false},surprised:{eye:"open",iris:.55,white:1.15,lidOuter:0,lidInner:0,browUp:.1,browInner:0,tear:false},scared:{eye:"open",iris:.42,white:1.08,lidOuter:0,lidInner:0,browUp:.08,browInner:.07,tear:false},tired:{eye:"open",iris:1,white:1,lidOuter:.5,lidInner:.5,browUp:-0.02,browInner:-0.02,tear:false},hurt:{eye:"hurt",iris:1,white:1,lidOuter:0,lidInner:0,browUp:0,browInner:-0.07,tear:false}};function Ur(e,t,r,o,n,a="neutral"){let i=n==="blink"||n==="talk"?a==="blink"||a==="talk"?"neutral":a:n,c=va[i];e.clearRect(0,0,t,r),e.lineCap="round",e.lineJoin="round";let s=r*.5,l=t*.105,h=r*.2,m=n==="blink"?"closed":c.eye;o.cheeks&&i!=="scared"&&(e.fillStyle=i==="happy"?"rgba(236,110,140,0.5)":"rgba(236,120,140,0.32)",$(e,t*.12,r*.8,t*.07,r*.075),e.fill(),$(e,t*.88,r*.8,t*.07,r*.075),e.fill());for(let p of [-1,1]){let y=t*(.5+p*.22);Ra(e,y,s,l,h,p,o,m,c),Ea(e,y,s-h-r*.07,t,r,p,o,c);}if(c.tear&&m==="open"){e.fillStyle="#85b7eb";let p=t*.5-t*.22-l*.6,y=s+h*1.05;e.beginPath(),e.moveTo(p,y-r*.07),e.quadraticCurveTo(p+t*.03,y,p,y+r*.04),e.quadraticCurveTo(p-t*.03,y,p,y-r*.07),e.fill();}Aa(e,t*.5,r*.86,t,r,o,n==="talk"?"talk":i);}function $(e,t,r,o,n){e.beginPath(),e.ellipse(t,r,Math.max(.1,o),Math.max(.1,n),0,0,Math.PI*2);}function Ra(e,t,r,o,n,a,i,c,s){let l=o*.26;if(e.strokeStyle=Ie,e.lineWidth=l,c==="closed"){e.beginPath(),e.moveTo(t-o,r+n*.1),e.quadraticCurveTo(t,r+n*.55,t+o,r+n*.1),e.stroke(),i.eyes==="wide"&&Gr(e,t,r+n*.15,o,n*.3,a,l);return}if(c==="happy"){e.lineWidth=l*1.2,e.beginPath(),e.moveTo(t-o,r+n*.35),e.quadraticCurveTo(t,r-n*.75,t+o,r+n*.35),e.stroke();return}if(c==="hurt"){let S=t-a*o*.6,v=t+a*o*.8;e.lineWidth=l*1.2,e.beginPath(),e.moveTo(v,r-n*.55),e.lineTo(S,r),e.lineTo(v,r+n*.55),e.stroke();return}let h=o*s.white,m=n*s.white,p=i.eyes==="sleepy"?.32:0,y=Math.max(s.lidOuter,p),x=Math.max(s.lidInner,p),b=r-m,T=t+a*(h+l),k=t-a*(h+l),g=b+2*m*y,f=b+2*m*x,E=y>0||x>0;e.save(),E&&(e.beginPath(),e.moveTo(T,g),e.lineTo(k,f),e.lineTo(k,r+m*2),e.lineTo(T,r+m*2),e.closePath(),e.clip());let d=Math.min(h,m)*.8*s.iris,R=r+m*.12;switch(i.eyes){case "dot":{e.fillStyle=Ie,$(e,t,r+m*.1,h*.55,m*.72),e.fill(),e.fillStyle="#ffffff",$(e,t-h*.18,r-m*.18,h*.17,h*.17),e.fill();break}case "cat":{e.fillStyle="#ffffff",tr(e,t,r,h*1.08,m*.85,a),e.fill(),e.save(),tr(e,t,r,h*1.08,m*.85,a),e.clip(),e.fillStyle=i.eyeColor,$(e,t,R,d*1.05,d*1.2),e.fill(),e.fillStyle=Ie,$(e,t,R,d*.22*(s.iris<1?1.5:1),d*.95),e.fill(),e.fillStyle="#ffffff",$(e,t-d*.4,R-d*.45,d*.25,d*.25),e.fill(),e.restore(),e.strokeStyle=Ie,e.lineWidth=l,tr(e,t,r,h*1.08,m*.85,a),e.stroke();break}default:{let S=i.eyes==="sparkle"||i.eyes==="wide";e.fillStyle="#ffffff",$(e,t,r,h,m),e.fill(),e.save(),$(e,t,r,h,m),e.clip();let v=S?d*1.18:d;e.fillStyle=i.eyeColor,$(e,t,R,v*.95,v*(i.eyes==="sparkle"?1.15:1)),e.fill(),e.fillStyle="rgba(255,255,255,0.18)",$(e,t,R+v*.45,v*.7,v*.45),e.fill(),e.fillStyle=Ie,$(e,t,R,v*.48,v*.52),e.fill(),e.fillStyle="#ffffff",$(e,t-v*.38,R-v*.42,v*.32,v*.32),e.fill(),$(e,t+v*.38,R+v*.38,v*.14,v*.14),e.fill(),i.eyes==="sparkle"&&(Sa(e,t+v*.3,R-v*.55,v*.22),e.fill()),e.restore(),e.strokeStyle=Ie,e.lineWidth=l,e.beginPath(),e.ellipse(t,r,h,m,0,Math.PI*1.08,Math.PI*1.92),e.stroke();break}}if(e.restore(),E){e.strokeStyle=Ie,e.lineWidth=l;let S=L=>(L-T)/(k-T),v=L=>g+(f-g)*S(L),I=t-h*.95,C=t+h*.95;e.beginPath(),e.moveTo(I,v(I)),e.lineTo(C,v(C)),e.stroke();}i.eyes==="wide"&&Gr(e,t,r-m*.55,h,m*.45,a,l);}function tr(e,t,r,o,n,a){let i=t+a*o,c=t-a*o;e.beginPath(),e.moveTo(c,r+n*.15),e.quadraticCurveTo(t,r-n*1.5,i,r-n*.35),e.quadraticCurveTo(t,r+n*1.4,c,r+n*.15),e.closePath();}function Gr(e,t,r,o,n,a,i){e.lineWidth=i*.8;let c=t+a*o;for(let s=0;s<2;s++){let l=r+s*n*.6;e.beginPath(),e.moveTo(c-a*o*.1,l),e.lineTo(c+a*o*.35,l-n*(.7-s*.2)),e.stroke();}}function Sa(e,t,r,o){e.beginPath();for(let n=0;n<8;n++){let a=n%2?o*.35:o,i=n*Math.PI/4-Math.PI/2,c=t+Math.cos(i)*a,s=r+Math.sin(i)*a;n?e.lineTo(c,s):e.moveTo(c,s);}e.closePath(),e.fillStyle="#ffffff";}function Ea(e,t,r,o,n,a,i,c){if(i.brows==="none")return;let s=o*.095,l=r-n*c.browUp,h=t-a*s,m=t+a*s,p=l-n*c.browInner,y=l+n*c.browInner*.3;if(e.strokeStyle=i.browColor,e.fillStyle=i.browColor,i.brows==="thick"){let b=n*.06;e.beginPath(),e.moveTo(m,y),e.quadraticCurveTo(t,Math.min(y,p)-b*.6,h,p),e.lineTo(h,p+b),e.quadraticCurveTo(t,Math.min(y,p)+b*.5,m,y+b*.6),e.closePath(),e.fill();return}e.lineWidth=o*(i.brows==="arched"?.026:.032),e.beginPath(),e.moveTo(m,y);let x=i.brows==="arched"?n*.09:n*.035;e.quadraticCurveTo(t+a*s*.2,Math.min(y,p)-x,h,p),e.stroke();}function Aa(e,t,r,o,n,a,i){let c=o*.026;e.strokeStyle=Ke,e.lineWidth=c;let s=o*(a.mouth==="small"?.06:a.mouth==="grin"?.12:.09);switch(i){case "happy":{let l=Math.max(s,o*.1);e.fillStyle=Ke,e.beginPath(),e.moveTo(t-l,r-n*.06),e.quadraticCurveTo(t,r-n*.02,t+l,r-n*.06),e.quadraticCurveTo(t,r+n*.2,t-l,r-n*.06),e.closePath(),e.fill(),e.save(),e.clip(),e.fillStyle=jr,$(e,t,r+n*.1,l*.55,n*.06),e.fill(),a.mouth==="grin"&&(e.fillStyle="#ffffff",e.fillRect(t-l,r-n*.08,l*2,n*.045)),e.restore();return}case "surprised":e.fillStyle=Ke,$(e,t,r,o*.045,n*.085),e.fill();return;case "talk":e.fillStyle=Ke,$(e,t,r,Math.max(s*.7,o*.06),n*.07),e.fill(),e.save(),e.clip(),e.fillStyle=jr,$(e,t,r+n*.06,o*.045,n*.035),e.fill(),e.restore();return;case "sad":e.beginPath(),e.moveTo(t-s,r+n*.04),e.quadraticCurveTo(t,r-n*.07,t+s,r+n*.04),e.stroke();return;case "angry":e.beginPath(),e.moveTo(t-s,r+n*.01),e.quadraticCurveTo(t,r-n*.03,t+s,r+n*.01),e.stroke();return;case "scared":{e.beginPath();let l=4;for(let h=0;h<=l;h++){let m=t-s+2*s*h/l,p=r+(h%2?-1:1)*n*.022;h?e.lineTo(m,p):e.moveTo(m,p);}e.stroke();return}case "tired":e.beginPath(),e.moveTo(t-s*.6,r),e.lineTo(t+s*.6,r),e.stroke();return;case "hurt":{e.beginPath();let l=4;for(let h=0;h<=l;h++){let m=t-s+2*s*h/l,p=r+(h%2?-1:1)*n*.04;h?e.lineTo(m,p):e.moveTo(m,p);}e.stroke();return}}if(a.mouth==="cat"){e.beginPath(),e.moveTo(t-s,r-n*.03),e.quadraticCurveTo(t-s*.5,r+n*.06,t,r-n*.01),e.quadraticCurveTo(t+s*.5,r+n*.06,t+s,r-n*.03),e.stroke();return}if(a.mouth==="grin"){e.fillStyle=Ke,e.beginPath(),e.moveTo(t-s,r-n*.04),e.quadraticCurveTo(t,r-n*.01,t+s,r-n*.04),e.quadraticCurveTo(t,r+n*.12,t-s,r-n*.04),e.closePath(),e.fill(),e.save(),e.clip(),e.fillStyle="#ffffff",e.fillRect(t-s,r-n*.06,s*2,n*.04),e.restore();return}e.beginPath(),e.moveTo(t-s,r-n*.03),e.quadraticCurveTo(t,r+n*.06,t+s,r-n*.03),e.stroke();}var Yr=16;function ka(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 Et=class{texture;g;w;h;face;current="neutral";base="neutral";constructor(t){this.face=t,this.w=Math.round(We[2]*Yr),this.h=Math.round(We[3]*Yr);let r=ka(this.w,this.h),o=r.getContext("2d");if(!o)throw new Error("DrawnFace: no 2D canvas");this.g=o,this.texture=new ___namespace.CanvasTexture(r),this.texture.colorSpace=___namespace.SRGBColorSpace,this.texture.anisotropy=4,this.paint("neutral");}paint(t){t!=="blink"&&t!=="talk"&&(this.base=t),this.current=t,Ur(this.g,this.w,this.h,this.face,t,this.base),this.texture.needsUpdate=true;}setFace(t){this.face=t,this.paint(this.current);}dispose(){this.texture.dispose();}};var Ta={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"}]},Ca={helmet:{paths:[0,1,2],box:[258,10,353,447]},wordmark:{paths:[3,4],box:[12,499,837,182]}},Ma={"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}]}},$r=512,Wr=.02,qr=new Map;function Ia(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 Pa(e,t,r){let o=`${e}:${r}`,n=qr.get(o);if(n)return n;if(typeof Path2D>"u")return null;let[a,i,c,s]=t.box,l=s*Wr,h=$r/(s+2*l),m=Ia(Math.round((c+2*l)*h),$r),p=m.getContext("2d");if(!p)return null;p.clearRect(0,0,m.width,m.height),p.fillStyle=r;for(let x of t.paths){let b=Ta.paths[x];p.setTransform(h,0,0,h,(b.x-a+l)*h,(b.y-i+l)*h),p.fill(new Path2D(b.d));}let y=new ___namespace.CanvasTexture(m);return y.colorSpace=___namespace.SRGBColorSpace,y.anisotropy=4,qr.set(o,y),y}function rr(e){let t=[];for(let r of Ce){let o=e.wear[r],n=o?Ma[o]:void 0;if(n)for(let a of n.layers){let i=Ca[a.art],c=Pa(a.art,i,n.color);if(!c)continue;let[,,s,l]=i.box,h=s/l,m=a.height??(a.width??1)/h,p=a.width??m*h,y=2*Wr*m;for(let x of n.faces){let b=(x==="front"?-1:1)*(a.z+.03),T=[0,a.y,b];t.push({bone:"body",center:T,w:p+y,h:m+y,facing:x,texture:c});}}}return t}var Tt=class extends wt{face;rest;mood="neutral";constructor(t,r,o={}){let n=new Et(t.face);super(er(t,r),{gloss:true,shadows:true,...o,facePainter:n}),this.face=n,this.rest=t.face.emotion,this.view.setPrints(rr(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(er(t,r)),this.view.setPrints(rr(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 Oa=1.12,_a=.25,Kr=1.6;function Xr(e){e.outputColorSpace=___namespace.SRGBColorSpace,e.toneMapping=___namespace.NeutralToneMapping,e.toneMappingExposure=Oa,e.shadowMap.enabled=true,e.shadowMap.type=___namespace.PCFShadowMap;let t=new ___namespace.PMREMGenerator(e),r=new RoomEnvironment_js.RoomEnvironment,o=t.fromScene(r,.04).texture;return r.dispose(),t.dispose(),{light(n){n.environment=o,n.environmentIntensity=_a,n.add(new ___namespace.HemisphereLight(14543103,8019024,.6));let a=new ___namespace.DirectionalLight(16772829,3.4);a.position.set(4,4.4,-2.2),a.castShadow=true;let i=a.shadow.camera;i.left=i.bottom=-Kr,i.right=i.top=Kr,i.near=.5,i.far=12,a.shadow.mapSize.set(1024,1024),a.shadow.bias=-5e-4,a.shadow.normalBias=.02,a.shadow.radius=4,a.shadow.intensity=.55,a.target.position.set(0,1,0),n.add(a,a.target);let c=new ___namespace.DirectionalLight(13623551,.45);c.position.set(-3,.8,-3),n.add(c);let s=new ___namespace.DirectionalLight(14478591,2.6);s.position.set(-3.2,2.6,2.6),n.add(s);},dispose(){o.dispose();}}}var vl=["#a99cff","#5b4bd6"];function za(e,t){switch(t){case "full":return {center:new ___namespace.Vector3(0,e*.5,0),size:e*1.12,lift:.04};case "torso":return {center:new ___namespace.Vector3(0,e*.57,0),size:e*.5,lift:.06};case "legs":return {center:new ___namespace.Vector3(0,e*.2,0),size:e*.5,lift:.1};case "feet":return {center:new ___namespace.Vector3(0,e*.08,0),size:e*.32,lift:.3};case "face":return {center:new ___namespace.Vector3(0,e*.86,0),size:e*.34,lift:.04};case "head":return {center:new ___namespace.Vector3(0,e*.88,0),size:e*.5,lift:.08};default:return {center:new ___namespace.Vector3(0,e*.8,0),size:e*.56,lift:.08}}}function Fa(e){return typeof e=="number"?e:e==="side"?Math.PI/2:e==="back"?Math.PI:.18}function Jr(e,t,r,o,n,a,i){let c=i.frame??"portrait",s={...n,face:{...n.face,emotion:"neutral"}},l=new Tt(s,a,{seed:7});try{e.setClearColor(0,0);let h=new ___namespace.Scene;t.light(h),l.group.rotation.y=Fa(i.view),h.add(l.group);for(let E=0;E<20;E++)l.update(1/30);l.view.setExpression(i.expression??n.face.emotion);let{center:m,size:p,lift:y}=za(l.height,c),x=28,b=new ___namespace.PerspectiveCamera(x,1,.05,50),T=p/2/Math.tan(___namespace.MathUtils.degToRad(x/2));b.position.set(m.x,m.y+p*y,m.z-T),b.lookAt(m),e.render(h,b);let k=document.createElement("canvas");k.width=o,k.height=o;let g=k.getContext("2d");if(!g)return r;let f=i.background;if(typeof f=="string")g.fillStyle=f,g.fillRect(0,0,o,o);else if(f){let E=g.createRadialGradient(o*.5,o*.38,o*.05,o*.5,o*.5,o*.72);E.addColorStop(0,f[0]),E.addColorStop(1,f[1]),g.fillStyle=E,g.fillRect(0,0,o,o);}return g.imageSmoothingEnabled=!i.pixelated,g.drawImage(r,0,0),k}finally{l.dispose();}}function Zr(e,t){let r=document.createElement("canvas");r.width=e,r.height=e;let o=new ___namespace.WebGLRenderer({canvas:r,antialias:!t,alpha:true,preserveDrawingBuffer:true});return o.setPixelRatio(1),o.setSize(e,e,false),{renderer:o,lighting:Xr(o),gl:r}}function Qr(e){e.lighting.dispose(),e.renderer.dispose(),e.renderer.forceContextLoss();}function Na(e,t,r={}){let o=Math.max(16,Math.round(r.size??256)),n=Zr(o,!!r.pixelated);try{return Jr(n.renderer,n.lighting,n.gl,o,e,t,r)}finally{Qr(n);}}function eo(e={}){let t=Math.max(16,Math.round(e.size??256)),r=Zr(t,!!e.pixelated);return {render(o,n,a={}){if(!r)throw new Error("snapshotter disposed");return Jr(r.renderer,r.lighting,r.gl,t,o,n,{...a,pixelated:e.pixelated})},dispose(){r&&(Qr(r),r=null);}}}function Rl(e,t,r={}){let o=Na(e,t,r);return new Promise(n=>o.toBlob(a=>n(a),"image/png"))}function Sl(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:Rt(e.spec),items:t}}function re(e){let t=St(e);if(!t.ok)throw new Error(`avatar shop: ${String(e.id)}: ${t.errors.join("; ")}`);return t.item}var or=e=>({w:e[0].length,h:e.length,rows:e}),Ha={bone:"head",size:[9.21,2.05,8.73],pos:[0,29.91,0],color:"a"},Da={bone:"head",size:[9.21,1.7,.73],pos:[0,28.72,-4.36],color:"a"},to=[{price:250,item:re({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:re({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:re({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:re({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:re({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:re({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:re({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:re({id:"top.suit",slot:"top",name:"Suit and tie",palette:{a:"#2c2f3a",w:"#f4f1ea",r:"#c0392b"},tint:"a",textures:{front:or(["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:re({id:"hair.ponytail",slot:"hair",name:"Ponytail",palette:{a:"#3b2a20",b:"#d4537e"},tint:"a",parts:[Ha,Da,{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:re({id:"face.visor",slot:"faceAcc",name:"Cyber visor",palette:{a:"#33e0ff",b:"#1d1d21"},tint:"a",parts:[{bone:"head",size:[7.79,1.77,.36],pos:[0,25.89,-4.29],color:"a"},{bone:"head",size:[.35,1.02,1.89],pos:[4.07,26.16,-3.27],color:"b",mirror:true}]})},{price:100,item:re({id:"shoes.hightops",slot:"shoes",name:"High-tops",palette:{a:"#7f77dd",w:"#f4f1ea",b:"#2b2140"},tint:"a",textures:{toe:or(["aaaa","wwww"]),side:or(["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:re({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:re({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"}]})}],ro=to.map(e=>e.item),nr=Object.fromEntries(to.map(e=>[e.item.id,e.price])),oo=e=>Object.prototype.hasOwnProperty.call(nr,e);function F(e){let t=St(e);if(!t.ok)throw new Error(`avatar catalog: ${String(e.id)}: ${t.errors.join("; ")}`);return t.item}var Pe=e=>({w:e[0].length,h:e.length,rows:e}),Xe={bone:"head",size:[9.21,2.05,8.73],pos:[0,29.91,0],color:"a"},ar={bone:"head",size:[.71,1.7,2.8],pos:[4.5,28.72,-2.9],color:"a",mirror:true},Je={bone:"head",size:[9.21,1.7,.73],pos:[0,28.72,-4.36],color:"a"},Ba=[F({id:"hair.short",slot:"hair",name:"Short",palette:{a:"#3b2a20"},tint:"a",parts:[Xe,Je,ar,{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"}]}),F({id:"hair.bob",slot:"hair",name:"Bob",palette:{a:"#3b2a20"},tint:"a",parts:[Xe,Je,{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"}]}),F({id:"hair.spiky",slot:"hair",name:"Spiky",palette:{a:"#3b2a20"},tint:"a",parts:[Xe,Je,{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"}]}),F({id:"hair.long",slot:"hair",name:"Long",palette:{a:"#3b2a20"},tint:"a",parts:[Xe,Je,ar,{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"}]}),F({id:"hair.bun",slot:"hair",name:"Bun",palette:{a:"#3b2a20"},tint:"a",parts:[Xe,Je,ar,{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"}]}),F({id:"hair.curly",slot:"hair",name:"Curly",palette:{a:"#3b2a20"},tint:"a",parts:[{bone:"head",size:[9.92,2.39,9.45],pos:[0,30.08,0],color:"a"},{bone:"head",size:[9.21,1.36,.73],pos:[0,28.89,-4.8],color:"a"},{bone:"head",size:[2.83,2.73,2.91],pos:[3.54,28.89,-2.55],color:"a",mirror:true},{bone:"head",size:[2.83,2.73,2.91],pos:[3.54,28.89,1.82],color:"a",mirror:true},{bone:"head",size:[5.67,2.05,5.82],pos:[0,31.61,0],color:"a"},{bone:"head",size:[4.25,4.27,2.18],pos:[2.13,27.27,4],color:"a",mirror:true}]})],Va=[F({id:"top.idos",slot:"top",name:"iDos Games tee",palette:{a:"#1565ff"},tint:null,paint:[{region:"torso",color:"a"},{region:"sleeves",color:"a"}]}),F({id:"top.tee",slot:"top",name:"Star tee",palette:{a:"#1d9e75",b:"#f4f1ea"},tint:"a",textures:{print:Pe(["aaaaaaaa","aaabbaaa","aabbbbaa","abbbbbba","aabbbbaa","aabaabaa","aaaaaaaa","aaaaaaaa"])},paint:[{region:"torso",color:"a",faces:{front:"print"}},{region:"sleeves",color:"a"}]}),F({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}]}),F({id:"top.stripes",slot:"top",name:"Striped sweater",palette:{a:"#d4537e",b:"#f4f1ea"},tint:"a",textures:{st:Pe(["aaaaaaaa","aaaaaaaa","bbbbbbbb","aaaaaaaa","aaaaaaaa","bbbbbbbb","aaaaaaaa","aaaaaaaa"]),sl:Pe(["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"}}]}),F({id:"top.jacket",slot:"top",name:"Jacket",palette:{a:"#444441",b:"#f4f1ea",c:"#c8c2b4"},tint:"a",textures:{open:Pe(["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}]}),F({id:"top.tank",slot:"top",name:"Tank top",palette:{a:"#ef9f27"},tint:"a",paint:[{region:"torso",color:"a"}]})],ja=[F({id:"bottom.jeans",slot:"bottom",name:"Jeans",palette:{a:"#2f5fd0",b:"#24489e"},tint:"a",textures:{seam:Pe(["aaab","aaab","aaab","aaab","aaab"])},paint:[{region:"legs",color:"a",faces:{front:"seam"}}]}),F({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}]}),F({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"}]}),F({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}]})],Ga=[F({id:"shoes.sneakers",slot:"shoes",name:"Sneakers",palette:{a:"#d84a30",w:"#f4f1ea"},tint:"a",textures:{toe:Pe(["aaaa","wwww"]),side:Pe(["aaaaa","wwwww"])},paint:[{region:"feet",color:"a",faces:{front:"toe",back:"toe",left:"side",right:"side",bottom:"w"}}]}),F({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}]}),F({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}]})],Ua=[F({id:"hands.gloves",slot:"hands",name:"Gloves",palette:{a:"#2b2140"},tint:"a",paint:[{region:"hands",color:"a"}]})],Ya=[F({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"}]})],$a=[F({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"}]}),F({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"}]})],qa=[F({id:"face.glasses",slot:"faceAcc",name:"Round glasses",palette:{a:"#2b2140"},tint:"a",parts:[{bone:"head",size:[2.41,.27,.29],pos:[1.56,26.84,-4.29],color:"a",mirror:true},{bone:"head",size:[2.41,.27,.29],pos:[1.56,24.73,-4.29],color:"a",mirror:true},{bone:"head",size:[.28,2.39,.29],pos:[2.9,25.78,-4.29],color:"a",mirror:true},{bone:"head",size:[1.13,.27,.29],pos:[0,26.3,-4.29],color:"a"}]}),F({id:"face.shades",slot:"faceAcc",name:"Sunglasses",palette:{a:"#1d1d21"},tint:"a",parts:[{bone:"head",size:[2.55,1.64,.29],pos:[1.56,25.89,-4.29],color:"a",mirror:true},{bone:"head",size:[6.23,.34,.29],pos:[0,26.77,-4.29],color:"a"}]})],Wa=[F({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"}]}),F({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"}]}),F({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"}]})],Ct=[...Ba,...Va,...ja,...Ga,...Ua,...Ya,...$a,...qa,...Wa,...ro],Ml=Object.fromEntries(Ct.map(e=>[e.id,e]));function Ka(e){return Ct.filter(t=>t.slot===e)}function no(e){return Ka(e).filter(t=>!oo(t.id))}var Xa=["#f9e0cf","#f2c9a0","#e2ad80","#c88d62","#9c6844","#6e4a32"],Ja=["#3b2a20","#1d1d21","#f2c14e","#c0612b","#ece6da","#7f77dd","#d4537e","#2ab0a0"],Za=["#3b2a20","#2f5fd0","#1d9e75","#7f77dd","#c0392b","#d8b030"],Qa=["#1d9e75","#378add","#d4537e","#444441","#ef9f27","#534ab7","#c0392b","#e8e4da"],so={version:Te,style:ne,body:{skin:"#f2c9a0",height:1},face:{eyes:"round",eyeColor:"#3b2a20",brows:"soft",browColor:"#3b2a20",mouth:"smile",cheeks:true,emotion:"neutral"},wear:{hair:"hair.short",top:"top.idos",bottom:"bottom.jeans",shoes:"shoes.sneakers"},tint:{}},ao={hair:.92,top:1,bottom:1,shoes:1,hands:.1,waist:.2,back:.2,faceAcc:.25,hat:.35};function Ol(e=Math.random){let t=a=>a[Math.floor(e()*a.length)],r=t(Ja),o={},n={};for(let a of Object.keys(ao)){if(e()>=ao[a])continue;let i=no(a);i.length&&(o[a]=t(i).id,n[a]=a==="hair"?r:t(Qa));}return {version:Te,style:ne,body:{skin:t(Xa),height:.95+e()*.1},face:{eyes:t(Ye),eyeColor:t(Za),brows:t($e),browColor:r==="#ece6da"||r==="#f2c14e"?"#8a6a3a":r,mouth:t(qe),cheeks:e()<.6,emotion:"neutral"},wear:o,tint:n}}var es={hair:{frame:"portrait",view:.5},hat:{frame:"head",view:.35},faceAcc:{frame:"portrait",view:.2},top:{frame:"torso",view:.3},waist:{frame:"torso",view:.3},hands:{frame:"torso",view:.55},bottom:{frame:"legs",view:.3},shoes:{frame:"feet",view:.6},back:{frame:"full",view:Math.PI-.6}},ts=["hair","top","bottom","shoes"];function rs(e,t){let r=Rt(JSON.parse(JSON.stringify(so)));for(let o of Object.keys(r.wear))ts.includes(o)||delete r.wear[o];return r.tint={},r.wear[e]=t,r}function Hl(e,t){return {key:`item:${e.id}`,make:()=>({spec:rs(e.slot,e.id),items:{...t,[e.id]:e},opts:es[e.slot]})}}function Dl(e={}){let t=e.size??224,r=e.limit??800,o=e.budgetMs??14,n=new Map,a=new Map,i=[],c=null,s=false,l=(p,y)=>{for(n.delete(p),n.set(p,y);n.size>r;){let x=n.keys().next().value;URL.revokeObjectURL(n.get(x)),n.delete(x);}},h=()=>{if(s)return;s=true;let p=globalThis.requestIdleCallback;p?p(m,{timeout:120}):setTimeout(m,16);};function m(){s=false;let p=performance.now();for(;i.length&&performance.now()-p<o;){let y=i.shift(),x=a.get(y);if(x&&(a.delete(y),x.listeners.size!==0))try{c??=eo({size:t});let{spec:b,items:T,opts:k}=x.make(),g=c.render(b,T,k),f=[...x.listeners];g.toBlob(E=>{if(!E)return;let d=URL.createObjectURL(E);l(y,d);for(let R of f)R(d);},"image/png");}catch{c?.dispose(),c=null;}}i.length&&h();}return {peek:p=>n.get(p)??null,request(p,y){let x=n.get(p.key);if(x)return l(p.key,x),y(x),()=>{};let b=a.get(p.key);b||(b={make:p.make,listeners:new Set},a.set(p.key,b),i.push(p.key)),b.listeners.add(y),h();let T=b;return ()=>T.listeners.delete(y)},release(){c?.dispose(),c=null;}}}var os="voxel-avatar-v1";function $l(){return {standard:os,style:ne,version:Te,slots:[...Ce],eyes:[...Ye],brows:[...$e],mouths:[...qe],emotions:[...xe],height:{min:Ue.min,max:Ue.max},items:[...Ct],shop:{...nr},rules:{slots:{...Zt},limits:{...Me},regions:[...Xt],regionPairs:Object.fromEntries(Object.entries(Jt).map(([e,t])=>[e,[...t]])),faces:[...be],skinColor:ke}}}var ns=(e,t,r)=>"#"+[e,t,r].map(o=>Math.max(0,Math.min(255,Math.round(o))).toString(16).padStart(2,"0")).join("");function as(e,t,r){let o=[];for(let n=0;n<r;n++)for(let a=0;a<t;a++){let i=Math.floor(a*e.width/t),c=Math.max(i+1,Math.floor((a+1)*e.width/t)),s=Math.floor(n*e.height/r),l=Math.max(s+1,Math.floor((n+1)*e.height/r)),h=0,m=0,p=0,y=0,x=0;for(let b=s;b<l;b++)for(let T=i;T<c;T++){let k=(b*e.width+T)*4;x++,!((e.data[k+3]??0)<128)&&(h+=e.data[k]??0,m+=e.data[k+1]??0,p+=e.data[k+2]??0,y++);}o.push(y*2<x?null:[h/y,m/y,p/y]);}return o}var Ze=(e,t)=>(e[0]-t[0])**2+(e[1]-t[1])**2+(e[2]-t[2])**2;function Kl(e,t){let r=Me.textureSide,n=Math.min(1,16/Math.max(e.width,e.height,1)),a=Math.max(1,Math.min(r,Math.round(t.w??e.width*n))),i=Math.max(1,Math.min(r,Math.round(t.h??e.height*n))),c=[...new Set(t.symbols)].slice(0,Me.palette);if(!c.length)throw new Error("pixelTextureFromImage: no palette symbols to use");let s=as(e,a,i),l=s.filter(b=>!!b),h=new Map;for(let b of l){let T=b.map(g=>Math.round(g/8)).join(","),k=h.get(T);k?k.n++:h.set(T,{n:1,c:b});}let m=[...h.values()].sort((b,T)=>T.n-b.n||(b.c.join()<T.c.join()?-1:1)),p=[];for(let b of m){if(p.length>=c.length)break;p.every(T=>Ze(T,b.c)>576)&&p.push([...b.c]);}!p.length&&m[0]&&(p=[[...m[0].c]]);for(let b=0;b<8&&p.length;b++){let T=p.map(()=>[0,0,0,0]);for(let k of l){let g=0;for(let E=1;E<p.length;E++)Ze(k,p[E])<Ze(k,p[g])&&(g=E);let f=T[g];f[0]+=k[0],f[1]+=k[1],f[2]+=k[2],f[3]+=1;}p=p.map((k,g)=>{let f=T[g];return f[3]?[f[0]/f[3],f[1]/f[3],f[2]/f[3]]:k});}let y={};p.forEach((b,T)=>y[c[T]]=ns(b[0],b[1],b[2]));let x=[];for(let b=0;b<i;b++){let T="";for(let k=0;k<a;k++){let g=s[b*a+k];if(!g||!p.length){T+=".";continue}let f=0;for(let E=1;E<p.length;E++)Ze(g,p[E])<Ze(g,p[f])&&(f=E);T+=c[f];}x.push(T);}return {texture:{w:a,h:i,rows:x},palette:y}}var ss="ugc.",Xl=e=>e.startsWith(ss);exports.ACTION_TIME=Fr;exports.ANIM_EVENTS=Ks;exports.AVATAR_AUTHOR_ITEM_PREFIX=ss;exports.AVATAR_BASE_COLORS=Br;exports.AVATAR_FACE_RECT=We;exports.AVATAR_HEIGHT=Ue;exports.AVATAR_ITEMS=Ml;exports.AVATAR_ITEM_LIMITS=Me;exports.AVATAR_ITEM_LIST=Ct;exports.AVATAR_ITEM_PRINTS=Ma;exports.AVATAR_ITEM_SHOTS=es;exports.AVATAR_PORTRAIT_BACKGROUND=vl;exports.AVATAR_RIG_ID=Oe;exports.AVATAR_SHOP_DEFAULT_PRICES=nr;exports.AVATAR_SHOP_ITEM_LIST=ro;exports.AVATAR_SLOTS=Ce;exports.AVATAR_SPEC_VERSION=Te;exports.AVATAR_STANDARD_ID=os;exports.AVATAR_STYLE=ne;exports.Animator=xt;exports.Art=O;exports.AvatarActor=Tt;exports.BODY_REGIONS=Xt;exports.BONE_ROLES=bs;exports.BROW_STYLES=$e;exports.CH=j;exports.CHANNELS=qs;exports.CHARACTER_LIMITS=ur;exports.CHARACTER_SPEC_VERSION=mr;exports.CLEAR=ye;exports.CLIPS=ut;exports.CLOTH_COLORS=Qa;exports.CREATURE_KINDS=qi;exports.CharacterView=mt;exports.DEFAULT_AVATAR=so;exports.DEFAULT_AVATAR_FACE=ia;exports.DEFAULT_CHARACTER_SOURCE=Dt;exports.DEFAULT_COLORS=po;exports.DEFAULT_FINISH=_e;exports.DrawnFace=Et;exports.EMOTES=yt;exports.EMOTE_IDS=Ri;exports.EMOTIONS=xe;exports.EMOTION_EVENTS=Ci;exports.EXPRESSIONS=je;exports.EXPRESSION_CHAIN=Hr;exports.EXTRA_BONE_ROLES=ot;exports.EYE_COLORS=Za;exports.EYE_STYLES=Ye;exports.FACE_NAMES=be;exports.FACE_TEXELS=Yr;exports.HAIR_COLORS=Ja;exports.HELD_KINDS=Ws;exports.HUMAN_BOTTOMS=Tr;exports.HUMAN_HAIR=Us;exports.HUMAN_SHOES=Cr;exports.HUMAN_TOPS=kr;exports.IDLE_STYLES=Lt;exports.LOCOMOTION=Zn;exports.MOUTH_STYLES=qe;exports.POSTURE=qt;exports.REGION_PAIRS=Jt;exports.REST=He;exports.RIGS=ie;exports.RIG_CLIPS=zr;exports.RIG_IDS=Be;exports.SKIN_COLOR=ke;exports.SKIN_TONES=Xa;exports.SLOT_RULES=Zt;exports.SOCKETS=ys;exports.VOXEL_CHARACTER_SYSTEM_PROMPT=Gi;exports.VoxelActor=wt;exports.WALK_STYLES=Pt;exports.acquireCharacter=zt;exports.add=pe;exports.applyPosture=Dr;exports.avatarCatalogExport=$l;exports.avatarFromServer=Sl;exports.avatarItemShot=Hl;exports.avatarItemsForSlot=Ka;exports.avatarMannequinWith=rs;exports.avatarPrints=rr;exports.bandColors=En;exports.bone=De;exports.bonesOf=yr;exports.characterFromImage=yi;exports.characterOf=ai;exports.characterSpecs=si;exports.clearPose=Ae;exports.composeAvatar=er;exports.copyPose=pt;exports.createAvatarLighting=Xr;exports.createAvatarSnapshotter=eo;exports.createAvatarThumbQueue=Dl;exports.creatureCharacter=Wi;exports.creatureSource=sa;exports.defaultCharacter=Ee;exports.defaultCharacterName=at;exports.disposeNameplate=Bt;exports.drawAvatarFace=Ur;exports.emotionFromText=Mi;exports.freeAvatarItemsForSlot=no;exports.humanSource=Ht;exports.isAuthorAvatarItem=Xl;exports.isAvatarShopItem=oo;exports.isDefaultCharacterName=Ps;exports.isEmote=Si;exports.isEmotion=Jn;exports.isObj=N;exports.layoutCharacter=vr;exports.lerpPose=Ir;exports.mirrorBone=br;exports.nameplate=Mr;exports.newAnimInput=ht;exports.normColor=ue;exports.npcCharacter=mi;exports.num=Q;exports.onCharacterKnown=ii;exports.parseAvatarSpec=Rt;exports.parseCharacterSpec=le;exports.pick=Mt;exports.pixelTextureFromImage=Kl;exports.randomAvatar=Ol;exports.recolor=Nt;exports.registerCharacter=ni;exports.releaseCharacter=it;exports.renderAvatarCanvas=Na;exports.renderAvatarImage=Rl;exports.rigOfSpec=Is;exports.sampleEmote=Nr;exports.sampleTrack=Xn;exports.setCh=u;exports.specHash=ze;exports.stableStringify=It;exports.standardFace=ct;exports.styleParams=Gt;exports.validateAvatarItem=St;exports.vec3=nt;
|
|
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 Lo=["wolf","lion","tiger","panda","pig","cow","sheep","horse","deer","mouse","raccoon","elephant","hedgehog","turtle","frog","duck","chicken","owl","penguin","bat","bee","eagle","fish","shark"],Or={h:"#efe6cf",n:"#f2a0a8",r:"#d8342c",y:"#f2a630",d:"#2a2a30",g:"#e8f6ff"},U={mirror:true},Ii=["legFL","legFR","legBL","legBR"];function ye(e,t={}){let r=t.body??[8,8,16],a=t.bodyY??12;e("body","body",r,[0,a,0],"t"),t.belly!==false&&e("belly","body",[r[0]-2,1,r[2]-4],[0,a-r[1]/2,0],"l"),e("head","head",[8,8,8],[0,16,-12],t.head??"s");let o=t.leg??[3,8];for(let n of Ii){let s=n.endsWith("L")?-3:3,l=n.startsWith("legF")?-6:6;e(n,n,[o[0],o[1],o[0]],[s,o[1]/2,l],t.legColor??"t"),t.paw!==null&&e(`${n}Paw`,n,[o[0]+.2,1.5,o[0]+.2],[s,.75,l],t.paw??"a");}}var or=(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 xt(e,t={}){let r=t.body??[6,6,8];e("body","body",r,[0,8,0],"t"),e("belly","body",[r[0]-1.4,r[1]-2,1],[0,7.5,-r[2]/2-.2],"l"),e("head","head",[5,5,5],[0,13,-4],t.head??"s");let a=t.wing??[8,1,6];e("wing","wingL",a,[-3-a[0]/2,10,0],t.wingColor??"a",U),e("leg","legL",[1,4,1],[-1.5,2,0],t.legColor??"a",U);}var _i={bone:"head",rect:[0,1,5,3]};function Mo(e,t){let r=(o,n,s)=>({rig:"quadruped",style:{walk:o,idle:n,energy:s},palette:Or}),a=(o,n,s)=>({rig:"flyer",style:{walk:o,idle:n,energy:s},face:_i,palette:Or});switch(e){case "wolf":return ye(t),t("ear","head",[2.4,3.4,1],[-2.5,21.5,-10.5],"t",U),or(t,"d"),t("ruff","body",[9,6,3],[0,13,-6.5],"l"),t("tail","tail",[3,3,10],[0,13,13],"t",{rot:[25,0,0]}),t("tailTip","tail",[3.1,3.1,2],[0,14.6,17.5],"l",{rot:[25,0,0]}),r("sneaky","proud",.6);case "lion":return ye(t),t("mane","head",[12,12,3],[0,16,-9.5],"a"),t("maneTop","head",[10,2,6],[0,21,-11.5],"a"),t("ear","head",[2,2,1],[-3,21.4,-12],"s",U),or(t,"d",[4,2.6,2]),t("tail","tail",[1.4,1.4,10],[0,13,13],"t",{rot:[30,0,0]}),t("tuft","tail",[2.6,2.6,2.6],[0,15.2,18],"a",{rot:[30,0,0]}),r("heavy","proud",.5);case "tiger":ye(t);for(let o of [-5,-1.5,2,5.5])t(`stripe${o}`,"body",[8.3,1,1.1],[0,12.6,o],"d");return t("stripeHead","head",[8.3,1,3],[0,19.8,-11],"d"),t("ear","head",[2,2,1],[-3,21,-10.5],"t",U),or(t,"n",[4,2.6,2]),t("tail","tail",[1.8,1.8,10],[0,14,13],"t",{rot:[20,0,0]}),t("tailRing","tail",[2,2,1],[0,15,15],"d",{rot:[20,0,0]}),r("sneaky","proud",.6);case "panda":return ye(t,{body:[9,9,15],legColor:"a",paw:"a"}),t("band","body",[9.2,9.2,4],[0,12,-4.5],"a"),t("ear","head",[2.4,2.4,1.2],[-3,21,-11],"a",U),t("nose","head",[1.6,1,.6],[0,15,-16.3],"a"),t("tail","tail",[2,2,2],[0,14,8.5],"l"),r("heavy","calm",.4);case "pig":return ye(t,{leg:[3,6],paw:"a"}),t("snout","head",[3.6,2.6,1.2],[0,14.6,-16.6],"n"),t("nostril","head",[.6,.8,.2],[-0.8,14.6,-17.3],"a",U),t("ear","head",[2.4,2,1],[-2.6,20.6,-10.5],"n",{mirror:true,rot:[-30,0,0]}),t("tail","tail",[1,1,2.6],[0,15,9],"n",{rot:[-40,0,0]}),r("bouncy","fidgety",.7);case "cow":return ye(t,{body:[9,9,16],paw:"d"}),t("spot","body",[9.2,3.6,4],[0,14,-2],"a"),t("spot2","body",[9.2,3,3],[0,11,5],"a"),t("muzzle","head",[6,3,1.6],[0,13.6,-16.6],"n"),t("horn","head",[1,2.4,1],[-2.8,21.2,-11],"h",U),t("ear","head",[2.6,1.2,1],[-5,18.6,-11],"t",U),t("tail","tail",[1,8,1],[0,11,9],"t"),t("tailTip","tail",[1.6,2,1.6],[0,6.6,9],"a"),r("heavy","calm",.3);case "sheep":return ye(t,{body:[10,9,16],leg:[2.6,7],legColor:"a",paw:"d",head:"a",belly:false}),t("woolTop","body",[9,2,13],[0,17,0],"t"),t("woolHead","head",[8.6,2.4,6],[0,20.4,-11.6],"t"),t("ear","head",[2.6,1,1.6],[-5,18,-11],"a",U),t("tail","tail",[2.6,2.6,2],[0,14,9],"t"),r("bouncy","calm",.5);case "horse":return ye(t,{body:[8,8,17],paw:"d"}),t("muzzle","head",[5,4.6,4],[0,13.8,-17.6],"s"),t("nose","head",[5.2,1.6,1],[0,12.6,-19.6],"l"),t("mane","head",[1.6,3,8],[0,21.4,-9],"a"),t("maneNeck","body",[1.6,3,5],[0,17,-5.5],"a"),t("ear","head",[1.4,2.4,1],[-2.4,21.2,-13.4],"s",U),t("tail","tail",[2.2,10,2.2],[0,10,9.4],"a"),r("normal","proud",.7);case "deer":ye(t,{body:[7,8,15]}),or(t,"d",[3.6,2.8,2.4]),t("ear","head",[2.6,1.4,1],[-5,19.6,-10.5],"t",U),t("antler","head",[.8,4,.8],[-2.4,22,-10.5],"h",U),t("antlerTine","head",[2.6,.8,.8],[-3.4,23.2,-10.5],"h",U),t("antlerTop","head",[.8,2,.8],[-4.3,24.4,-10.5],"h",U);for(let o of [-3,1,4])t(`spot${o}`,"body",[1.4,.4,1.4],[-1.6,16.1,o],"l",U);return t("tail","tail",[2,2.4,1.4],[0,14.6,8.4],"l"),r("bouncy","calm",.6);case "mouse":return ye(t,{body:[7,6,12],bodyY:11,leg:[2.4,8],paw:"n"}),t("ear","head",[3.4,3.4,.8],[-3.6,21.4,-10.6],"t",U),t("earIn","head",[2.2,2.2,.3],[-3.6,21.4,-11.1],"n",U),t("nose","head",[1.2,1,.6],[0,15,-16.3],"n"),t("tail","tail",[.8,.8,11],[0,12,13],"n",{rot:[15,0,0]}),r("sneaky","fidgety",.9);case "raccoon":ye(t,{paw:"d"}),t("mask","head",[8.3,1.4,8.3],[0,17,-12],"d",{shape:"cylinder"}),or(t,"d",[3.4,2.4,2]),t("ear","head",[2.2,2.4,1],[-2.8,21.2,-10.5],"a",U),t("tail","tail",[3,3,10],[0,14,13],"t",{rot:[20,0,0]});for(let o of [10,13.4,16.8])t(`ring${o}`,"tail",[3.2,3.2,1.4],[0,14+(o-13)*.36,o],"d",{rot:[20,0,0]});return r("sneaky","fidgety",.7);case "elephant":return ye(t,{body:[10,10,16],leg:[4,8],paw:"l"}),t("ear","head",[1,7,6],[-5,16.4,-10.6],"a",U),t("trunk","head",[2.6,4,2.4],[0,12.6,-17.2],"s"),t("trunk2","head",[2.2,4,2.2],[0,9,-17.6],"s"),t("trunkTip","head",[2,1.6,2.6],[0,6.6,-18],"s"),t("tusk","head",[.8,.8,3],[-2.2,12.6,-17.2],"h",U),t("tail","tail",[.8,6,.8],[0,12,8.4],"t"),r("heavy","calm",.3);case "hedgehog":ye(t,{body:[8,6,12],bodyY:10,leg:[2.4,8],paw:"l"}),t("spines","body",[9.4,5,12],[0,13.6,1],"a");for(let o of [-3,1,5])t(`spike${o}`,"body",[1,1.6,1],[-2.4,16.8,o],"a",U);return t("spikeTop","body",[1,1.8,1],[0,16.9,-1],"a"),t("nose","head",[1.4,1.2,1.4],[0,14.6,-16.6],"d"),t("ear","head",[1.4,1.4,.8],[-3,20.6,-10.6],"l",U),r("sneaky","fidgety",.8);case "turtle":return ye(t,{body:[8,5,12],bodyY:9,leg:[3,8],paw:null}),t("shell","body",[11,6,15],[0,13,.6],"a"),t("shellTop","body",[8,1.6,11],[0,16.6,.6],"a"),t("shellRim","body",[11.4,1,15.4],[0,10.4,.6],"l"),t("tail","tail",[1.4,1.4,2.6],[0,11,9],"t"),r("heavy","calm",.2);case "frog":return ye(t,{body:[9,6,12],bodyY:10,leg:[3,8],paw:"a"}),t("eyeBump","head",[2.6,2.4,2.6],[-2.4,21.2,-13],"t",U),t("eyeBall","head",[1.6,1.6,.4],[-2.4,21.4,-14.5],"w",U),t("pupil","head",[.8,.8,.2],[-2.4,21.4,-14.8],"k",U),t("backLeg","legBL",[3.6,3,5],[-3.4,3.5,7.4],"t",U),r("bouncy","calm",.8);case "duck":return xt(t,{wingColor:"t",legColor:"y"}),t("bill","head",[3,.9,2.6],[0,12,-7.6],"y"),t("tail","tail",[3,1,2.4],[0,9.6,5],"t",{rot:[-25,0,0]}),a("bouncy","fidgety",.6);case "chicken":return xt(t,{wing:[3,4,6],wingColor:"t",legColor:"y"}),t("comb","head",[1,2,3.6],[0,16.4,-4],"r"),t("beak","head",[1.4,1,1.6],[0,12.8,-7.2],"y"),t("wattle","head",[.8,1.4,.6],[0,11.2,-6.8],"r"),t("tail","tail",[3,4,3],[0,11,5],"t",{rot:[20,0,0]}),a("bouncy","fidgety",.9);case "owl":return xt(t,{body:[7,7,7],wingColor:"a"}),t("tuft","head",[1,2,1],[-2,16.4,-4],"a",U),t("beak","head",[1,1.2,1],[0,12.4,-7],"y"),t("tail","tail",[3,1,3],[0,6,5],"a"),a("normal","calm",.3);case "penguin":return xt(t,{body:[7,9,6],wing:[3,6,2],wingColor:"t",legColor:"y"}),t("belly2","body",[5,7,.6],[0,7.6,-3.3],"l"),t("beak","head",[1.4,1,1.8],[0,12.6,-7.2],"y"),t("feet","legL",[2,.6,2.4],[-1.5,.3,-0.8],"y",U),a("heavy","fidgety",.6);case "bat":return xt(t,{body:[5,5,5],wing:[9,.6,5],wingColor:"a",legColor:"d"}),t("ear","head",[1.4,2.6,.8],[-1.6,16.6,-4],"t",U),t("fang","head",[.5,.8,.3],[-0.8,11.2,-6.6],"w",U),a("sneaky","fidgety",.8);case "bee":return xt(t,{body:[6,6,8],wing:[5,.4,4],wingColor:"g",legColor:"d"}),t("stripe","body",[6.2,6.2,1.2],[0,8,0],"d"),t("stripe2","body",[6.2,6.2,1.2],[0,8,2.8],"d"),t("stinger","body",[.8,.8,1.6],[0,7.4,4.6],"d"),t("antenna","head",[.4,2.4,.4],[-1.2,16.4,-4.6],"d",U),t("antennaTip","head",[.8,.8,.8],[-1.2,17.8,-4.6],"d",U),a("bouncy","fidgety",1);case "eagle":return xt(t,{body:[6,7,8],wing:[10,1,6],wingColor:"t",legColor:"y",head:"l"}),t("beak","head",[1.6,1.4,2],[0,12.6,-7.4],"y"),t("beakTip","head",[1,1,.8],[0,11.6,-8],"y"),t("tail","tail",[4,1,4],[0,7.4,6],"l"),a("heavy","proud",.6);case "fish":return t("body","body",[5,7,9],[0,6,0],"t"),t("belly","body",[4,1,7],[0,2.4,0],"l"),t("head","head",[5,6,4],[0,6,-6.5],"s"),t("tailFin","tail",[.8,6,4],[0,6,7],"a"),t("dorsal","body",[.8,2.4,4],[0,10.6,0],"a"),t("fin","finL",[3,.6,2],[-4,5,-1],"a",U),{rig:"swimmer",style:{walk:"normal",idle:"calm",energy:.7},face:{bone:"head",rect:[0,1,5,3]},palette:Or};case "shark":return t("body","body",[7,7,16],[0,6,1],"t"),t("belly","body",[5.6,1,13],[0,2.4,1],"l"),t("head","head",[7,6,6],[0,6,-9],"s"),t("jaw","head",[6,1.4,5],[0,3.4,-9],"l"),t("dorsal","body",[1,5,4],[0,11.6,0],"t"),t("tailFin","tail",[1,9,5],[0,7,11.4],"t"),t("fin","finL",[4,.8,3],[-5,4,-1],"t",U),{rig:"swimmer",style:{walk:"heavy",idle:"proud",energy:.6},face:{bone:"head",rect:[0,1,7,3]},palette:Or}}throw new Error(`unknown creature kind: ${e}`)}var Xc=["cat","dog","fox","bear","rabbit","bird","dragon","slime","ghost","robot",...Lo],Oi=e=>({k:"#2a1c14",w:"#f4f4ef",b:e,m:"#7a3a30",o:"#3a1a14"});function Fi(e){let t=e.light??e.body,r=e.accent??e.body,a={t:e.body,s:e.body,l:t,a:r,p:r,...Oi(e.eyes??"#3f6f3a")},o=[],n="quadruped",s=$t("head",[0,3,8,5]),l={walk:"normal",idle:"calm",energy:.6},i=(b,E,v,M,R,A={})=>o.push({name:b,bone:E,size:v,pos:M,color:R,...A});switch(e.kind){case "cat":case "fox":case "dog":case "bear":case "rabbit":{let b=e.kind;i("body","body",[8,8,16],[0,12,0],"t"),i("belly","body",[6,1,12],[0,8,0],"l"),i("head","head",[8,8,8],[0,16,-12],"s");for(let E of ["legFL","legFR","legBL","legBR"]){let v=E.endsWith("L")?-3:3,M=E.startsWith("legF")?-6:6;i(E,E,[3,8,3],[v,4,M],"t"),i(`${E}Paw`,E,[3.2,1.5,3.2],[v,.75,M],"a");}b==="cat"?(i("ear","head",[2,2.5,1],[-2.5,21,-11],"a",{mirror:true}),i("tail","tail",[1.6,1.6,10],[0,15,13],"t",{rot:[20,0,0]}),l={walk:"sneaky",idle:"calm",energy:.5}):b==="fox"?(i("ear","head",[2.4,3.2,1],[-2.5,21.4,-11],"t",{mirror:true}),i("snout","head",[4,3,3],[0,14.5,-17],"l"),i("nose","head",[1.2,1,.6],[0,15.6,-18.6],"a"),i("tail","tail",[3.5,3.5,10],[0,14,13],"t",{rot:[15,0,0]}),i("tailTip","tail",[3.6,3.6,2.5],[0,15.2,18],"l"),l={walk:"bouncy",idle:"fidgety",energy:.7}):b==="dog"?(i("ear","head",[1.5,4,3],[-4.6,17.5,-11.5],"a",{mirror:true}),i("snout","head",[4,3,3],[0,14.5,-17],"l"),i("nose","head",[1.6,1.2,.6],[0,15.8,-18.6],"a"),i("tail","tail",[2,2,7],[0,16,11],"t",{rot:[40,0,0]}),l={walk:"bouncy",idle:"fidgety",energy:.9}):b==="bear"?(i("ear","head",[2,2,1],[-3,20.6,-10.5],"a",{mirror:true}),i("snout","head",[4,3,2.5],[0,14.5,-16.8],"l"),i("nose","head",[1.6,1.2,.6],[0,15.8,-18.2],"a"),i("tail","tail",[2,2,2],[0,14,9],"t"),l={walk:"heavy",idle:"proud",energy:.4}):(i("ear","head",[1.6,7,1],[-1.8,23.5,-11],"t",{mirror:true}),i("earInner","head",[.8,5.5,.4],[-1.8,23.5,-11.6],"l",{mirror:true}),i("tail","tail",[3,3,3],[0,14,9.5],"l"),l={walk:"bouncy",idle:"fidgety",energy:.8});break}case "bird":case "dragon":{n="flyer",s=$t("head",[0,1,5,3]);let b=e.kind==="dragon";i("body","body",[6,6,8],[0,8,0],"t"),i("belly","body",[4.6,4,1],[0,7.5,-4.2],"l"),i("head","head",[5,5,5],[0,13,-4],"s"),i("wing","wingL",[8,1,6],[-7,10,0],"a",{mirror:true}),i("leg","legL",[1,4,1],[-1.5,2,0],"a",{mirror:true}),b?(i("horn","head",[.8,2,.8],[-1.4,16.4,-3],"l",{mirror:true}),i("snout","head",[3,2,2.4],[0,12.2,-7.4],"s"),i("tail","tail",[2,2,8],[0,7,7],"t"),i("spike","body",[1,1.5,6],[0,11.6,0],"a"),l={walk:"heavy",idle:"proud",energy:.6}):(i("beak","head",[1.6,1.2,2],[0,12.4,-7.2],"a"),i("tail","tail",[4,1,4],[0,8,6],"a"),i("crest","head",[1,2,2],[0,16.2,-3.6],"a"),l={walk:"bouncy",idle:"fidgety",energy:.8});break}case "slime":case "ghost":case "robot":{n="blob",s=$t("body",[2,3,8,5]),e.kind==="slime"?(i("body","body",[12,10,12],[0,5,0],"t"),l={walk:"bouncy",idle:"fidgety",energy:.9}):e.kind==="ghost"?(i("body","body",[10,12,10],[0,7,0],"t"),i("hem","body",[10.4,2,10.4],[0,1,0],"l",{shape:"cylinder"}),l={walk:"sneaky",idle:"calm",energy:.4}):(i("body","body",[11,11,10],[0,5.5,0],"t"),i("antenna","body",[.8,3,.8],[0,12.5,0],"a"),i("bulb","body",[1.6,1.6,1.6],[0,14.6,0],"l"),i("screen","body",[9,6,.4],[0,6.5,-4.82],"l"),l={walk:"robotic",idle:"calm",energy:.5});break}default:{let b=Mo(e.kind,i);n=b.rig,l=b.style,b.face&&(s=$t(b.face.bone,b.face.rect)),Object.assign(a,b.palette);}}Ni(o);let c=e.kind==="slime"||e.kind==="ghost"?"body":"head";for(let b of o)b.name===c&&b.bone===s.face.bone&&(b.shape="cylinder");let[m,h,d,p]=s.face.rect,g=[m+d*Co,h,d*(1-2*Co),p];return {version:1,name:e.name,description:e.description??"",rig:n,palette:a,textures:s.textures,parts:o,face:{...s.face,rect:g,drawn:{...Vi(e.kind),eyeColor:e.eyes??Bi}},style:l,finish:Di,tags:e.tags??[e.kind]}}var Di={noise:0,outline:0,shade:.12,density:4,round:.35},Ft=1.5;function Ni(e){let t=e,r=m=>m.size[0]*m.size[1]*m.size[2],a=m=>t.filter(h=>h.bone===m).sort((h,d)=>r(d)-r(h))[0],o=a("body");if(!o)return;let n=(m,h)=>m.pos[h]-m.size[h]/2,s=(m,h)=>m.pos[h]+m.size[h]/2;for(let m of ["legFL","legFR","legBL","legBR","legL","legR"]){let h=a(m);if(!h||s(h,1)>n(o,1)+Ft||s(h,1)<n(o,1)-3)continue;let d=n(h,1),p=n(o,1)+Ft;h.size[1]=p-d,h.pos[1]=(p+d)/2;}let l=(m,h,d)=>{for(let p of t)p.bone===m&&(p.pos[h]=p.pos[h]+d);},i=a("head");if(i&&i.pos[2]<n(o,2)){let m=n(o,2)+Ft-s(i,2);m>0&&l("head",2,m);}let c=a("tail");if(c&&c.pos[2]>s(o,2)){let m=n(c,2)-(s(o,2)-Ft);m>0&&l("tail",2,-m);}for(let m of [a("wingL"),a("finL")]){if(!m)continue;let h=n(o,0)+Ft,d=s(m,0);d<h&&(m.size[0]=m.size[0]+(h-d),m.pos[0]=m.pos[0]+(h-d)/2);}if(i)for(let m of t){if(m.bone!=="head"||m===i)continue;let h=n(m,1)-(s(i,1)-Ft/2);h>0&&n(m,1)<s(i,1)+.6&&(m.pos[1]=m.pos[1]-h);}}var Bi="#2a1c14",Co=.07;function Vi(e){let t=(r,a,o=true)=>({eyes:r,brows:"none",mouth:a,cheeks:o});switch(e){case "cat":case "fox":case "lion":case "tiger":return t("cat","cat");case "dog":case "wolf":case "rabbit":case "mouse":case "raccoon":case "hedgehog":return t("round","cat");case "dragon":return t("almond","fang",false);case "slime":return t("sparkle","smile");case "ghost":return t("round","open",false);case "robot":return t("button","smile",false);case "owl":case "frog":return t("wide","smile");case "shark":return t("narrow","teeth",false);case "fish":return t("round","pout",false);case "bat":return t("round","fang");case "bee":case "turtle":return t("button","smile");default:return t("round","small")}}function Wc(e){let t=Oe(Fi(e));if(!t.ok)throw new Error(`${e.kind}: ${t.error}`);return t.spec}var zo={torso:"#d9d3c5",legs:"#5f6b7a"},Hi="#2b2140",ji="#7a2e2e",Gi="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",Ui=32,qi=[10,7],nr=1,Yi={noise:0,outline:0,shade:.12,density:4,round:.35},$i=["front","back","left","right"];function Po(e){let t=parseInt(e.slice(1),16);return [t>>16&255,t>>8&255,t&255]}var xa=class{map={};next=0;key(t){let r=Object.entries(this.map).find(([,i])=>i===t);if(r)return r[0];if(this.next<Ui){let i=Gi[this.next++];return this.map[i]=t,i}let[a,o,n]=Po(t),s=Object.keys(this.map)[0],l=1/0;for(let[i,c]of Object.entries(this.map)){let[m,h,d]=Po(c),p=(a-m)**2+(o-h)**2+(n-d)**2;p<l&&(l=p,s=i);}return s}};function Ki(e,t){return (typeof e=="function"?e(t):e[t])??null}function Xi(e){let[t,r]=qi,a=new G(t,r),o=n=>{n(1),n(6);};switch(e){case "blink":case "tired":o(n=>a.row(3,n,n+2,"k"));break;case "happy":o(n=>a.px(n,3,"k").px(n+1,2,"k").px(n+2,3,"k"));break;case "hurt":a.px(1,2,"k").px(2,3,"k").px(1,4,"k"),a.px(8,2,"k").px(7,3,"k").px(8,4,"k");break;case "surprised":case "scared":o(n=>a.rect(n,2,3,3,"w").px(n+1,3,"k"));break;default:o(n=>a.rect(n,2,3,3,"w").rect(n+1,3,2,2,"e").px(n+1,3,"k"));}switch(e==="angry"&&a.px(1,1,"k").px(2,1,"k").px(3,2,"k").px(8,1,"k").px(7,1,"k").px(6,2,"k"),e==="sad"&&a.px(3,1,"k").px(2,1,"k").px(6,1,"k").px(7,1,"k"),e){case "happy":case "talk":a.rect(4,5,2,2,"m");break;case "surprised":a.rect(4,5,2,2,"m");break;case "sad":a.px(3,6,"m").row(5,4,5,"m").px(6,6,"m");break;case "angry":case "tired":case "scared":case "hurt":a.row(6,4,5,"m");break;default:a.px(3,5,"m").row(6,4,5,"m").px(6,5,"m");}return a.tex()}function wa(e,t){let r=Ie[kt],a=new xa,o=a.key(e.body.skin),n=r.defaultParts.map(p=>({...p,size:[...p.size],pos:[...p.pos],color:p.name==="torso"?a.key(zo.torso):p.name?.startsWith("leg")||p.name?.startsWith("foot")?a.key(zo.legs):o})),s=new Map;for(let p of n){let g=s.get(p.name)??[];g.push(p),s.set(p.name,g);}for(let p of s.values())p.sort((g,b)=>b.pos[1]+b.size[1]/2-(g.pos[1]+g.size[1]/2));let l=(e.body.head??fa)==="round";if(l)for(let p of n)p.name==="head"?(p.shape="cylinder",p.size=[p.size[0],p.size[1]+nr,p.size[2]],p.pos=[p.pos[0],p.pos[1]+nr/2,p.pos[2]]):p.name==="neck"&&(p.size=[2.6,1.8,2.4],p.pos=[0,23.1,0]);let i={},c={k:a.key(Hi),w:a.key("#ffffff"),e:a.key(e.face.eyeColor),m:a.key(ji)},m={};for(let p of Gt){let g=Xi(p),b="face_"+p;i[b]={...g,rows:g.rows.map(E=>[...E].map(v=>c[v]??v).join(""))},m[p]=b;}m.neutral=m[ko[e.face.emotion]]??m.neutral;for(let p of bt){let g=e.wear[p];if(!g)continue;let b=Ki(t,g);if(!b||b.slot!==p||b.style!==Me)continue;let E={};for(let[A,y]of Object.entries(b.palette))E[A]=y===ut?o:a.key(A===b.tint&&e.tint[p]?e.tint[p]:y);let v={};for(let[A,y]of Object.entries(b.textures)){let z=`${p}_${A}`;v[A]=z,i[z]={w:y.w,h:y.h,rows:y.rows.map(C=>[...C].map(L=>E[L]??L).join(""))};}let M=A=>{if(!A)return;let y={};for(let[z,C]of Object.entries(A)){let L=v[C]??E[C];L&&(y[z]=L);}return Object.keys(y).length?y:void 0};for(let A of b.paint){let y=s.get(A.region);if(!y)continue;let z=E[A.color],C=M(A.faces);y.forEach((L,I)=>{z&&(L.color=z);let _=C&&Wi(C,y,I,i);_?L.faces=_:delete L.faces;});}let R=p==="hair"||p==="hat"||p==="faceAcc"&&!b.parts.some(A=>A.mat);for(let A of b.parts){let y={bone:A.bone,size:[...A.size],pos:[...A.pos],color:E[A.color]??o},z=M(A.faces);if(z&&(y.faces=z),A.rot&&(y.rot=[...A.rot]),A.mirror&&(y.mirror=true),A.name&&(y.name=A.name),A.mat&&(y.mat=A.mat),l&&A.bone===r.faceBone){let C=p==="hair"||p==="hat"?nr:nr/2;y.pos=[y.pos[0],y.pos[1]+C,y.pos[2]],R&&(y.wrap=true);}n.push(y);}}let h={version:1,name:"Avatar",description:"",rig:kt,scale:e.body.height,palette:a.map,textures:i,parts:n,bones:[],face:{bone:r.faceBone,rect:l?[tt[0],tt[1]+nr/2,tt[2],tt[3]]:[...tt],expressions:m},style:{walk:e.anim?.walk??et.walk,idle:e.anim?.idle??et.idle,energy:.6},voice:{pitch:1},tags:["avatar",Me],finish:{...Yi}},d=Oe(h);if(!d.ok)throw new Error("composeAvatar: "+d.error);return d.spec}function Wi(e,t,r,a){if(t.length===1)return {...e};let o=t[0].pos[1]+t[0].size[1]/2,n=Math.min(...t.map(c=>c.pos[1]-c.size[1]/2)),s=Math.max(1e-6,o-n),l=c=>c<=0?0:c>=t.length?1:(o-(t[c-1].pos[1]-t[c-1].size[1]/2))/s,i={};for(let[c,m]of Object.entries(e)){let h=a[m];if(!h){i[c]=m;continue}if(c==="top"){r===0&&(i[c]=m);continue}if(c==="bottom"){r===t.length-1&&(i[c]=m);continue}if(!$i.includes(c))continue;let d=Math.min(h.h-1,Math.round(l(r)*h.h)),p=Math.max(d+1,Math.round(l(r+1)*h.h)),g=`${m}_${r}`;a[g]||(a[g]={w:h.w,h:p-d,rows:h.rows.slice(d,p)}),i[c]=g;}return Object.keys(i).length?i:void 0}var Ji={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"}]},Zi={helmet:{paths:[0,1,2],box:[258,10,353,447]},wordmark:{paths:[3,4],box:[12,499,837,182]}},Qi={"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}]}},Io=512,Oo=.02,_o=new Map;function e0(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 t0(e,t,r){let a=`${e}:${r}`,o=_o.get(a);if(o)return o;if(typeof Path2D>"u")return null;let[n,s,l,i]=t.box,c=i*Oo,m=Io/(i+2*c),h=e0(Math.round((l+2*c)*m),Io),d=h.getContext("2d");if(!d)return null;d.clearRect(0,0,h.width,h.height),d.fillStyle=r;for(let g of t.paths){let b=Ji.paths[g];d.setTransform(m,0,0,m,(b.x-n+c)*m,(b.y-s+c)*m),d.fill(new Path2D(b.d));}let p=new V__namespace.CanvasTexture(h);return p.colorSpace=V__namespace.SRGBColorSpace,p.anisotropy=4,_o.set(a,p),p}function Ra(e){let t=[];for(let r of bt){let a=e.wear[r],o=a?Qi[a]:void 0;if(o)for(let n of o.layers){let s=Zi[n.art],l=t0(n.art,s,o.color);if(!l)continue;let[,,i,c]=s.box,m=i/c,h=n.height??(n.width??1)/m,d=n.width??h*m,p=2*Oo*h;for(let g of o.faces){let b=(g==="front"?-1:1)*(n.z+.03),E=[0,n.y,b];t.push({bone:"body",center:E,w:d+p,h:h+p,facing:g,texture:l});}}}return t}var Dr=class extends _r{face;rest;mood="neutral";constructor(t,r,a={}){let o=new Ot(t.face);super(wa(t,r),{gloss:true,shadows:true,...a,facePainter:o}),this.face=o,this.rest=t.face.emotion,this.view.setPrints(Ra(t)),this.applyMood();}setEmotion(t){this.mood=t,this.applyMood();}setAvatar(t,r){this.face.setFace(t.face),this.rest=t.face.emotion,this.setSpec(wa(t,r)),this.view.setPrints(Ra(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 a0=1.12,o0=.25,Fo=1.6;function Do(e){e.outputColorSpace=V__namespace.SRGBColorSpace,e.toneMapping=V__namespace.NeutralToneMapping,e.toneMappingExposure=a0,e.shadowMap.enabled=true,e.shadowMap.type=V__namespace.PCFShadowMap;let t=new V__namespace.PMREMGenerator(e),r=new RoomEnvironment_js.RoomEnvironment,a=t.fromScene(r,.04).texture;return r.dispose(),t.dispose(),{light(o){o.environment=a,o.environmentIntensity=o0,o.add(new V__namespace.HemisphereLight(14543103,8019024,.6));let n=new V__namespace.DirectionalLight(16772829,3.4);n.position.set(4,4.4,-2.2),n.castShadow=true;let s=n.shadow.camera;s.left=s.bottom=-Fo,s.right=s.top=Fo,s.near=.5,s.far=12,n.shadow.mapSize.set(1024,1024),n.shadow.bias=-5e-4,n.shadow.normalBias=.02,n.shadow.radius=4,n.shadow.intensity=.55,n.target.position.set(0,1,0),o.add(n,n.target);let l=new V__namespace.DirectionalLight(13623551,.45);l.position.set(-3,.8,-3),o.add(l);let i=new V__namespace.DirectionalLight(14478591,2.6);i.position.set(-3.2,2.6,2.6),o.add(i);},dispose(){a.dispose();}}}function n0(e){if(e==="walk")return .3;if(e==="idle")return 1.2;let t=Ne[e];return t.loop?1:t.duration*.4}var g1=["#a99cff","#5b4bd6"];function s0(e,t){switch(t){case "full":return {center:new V__namespace.Vector3(0,e*.5,0),size:e*1.12,lift:.04};case "torso":return {center:new V__namespace.Vector3(0,e*.57,0),size:e*.5,lift:.06};case "legs":return {center:new V__namespace.Vector3(0,e*.2,0),size:e*.5,lift:.1};case "feet":return {center:new V__namespace.Vector3(0,e*.08,0),size:e*.32,lift:.3};case "face":return {center:new V__namespace.Vector3(0,e*.86,0),size:e*.34,lift:.04};case "head":return {center:new V__namespace.Vector3(0,e*.88,0),size:e*.5,lift:.08};default:return {center:new V__namespace.Vector3(0,e*.8,0),size:e*.56,lift:.08}}}function i0(e){let t=e.view.spec.parts,r=t.find(o=>o.name==="head"),a=0;for(let o of t)a=Math.max(a,o.pos[1]+o.size[1]/2);return !r||a<=0?e.height:Math.min(e.height,e.height*(r.pos[1]+r.size[1]/2)*l0/a)}var l0=1.022;function c0(e){return typeof e=="number"?e:e==="side"?Math.PI/2:e==="back"?Math.PI:.18}function No(e,t,r,a,o,n,s){let l=s.frame??"portrait",i={...o,face:{...o.face,emotion:"neutral"}},c=new Dr(i,n,{seed:7});try{e.setClearColor(0,0);let m=new V__namespace.Scene;t.light(m),c.group.rotation.y=c0(s.view),m.add(c.group);for(let y=0;y<20;y++)c.update(1/30);let h=s.motion;if(h){h==="walk"?c.setPose("walk"):h!=="idle"&&c.playEmote(h);let y=Math.round(Math.max(0,s.at??n0(h))*30);for(let z=0;z<y;z++)c.update(1/30);}if(!h||h==="walk"||h==="idle"||s.expression){let y=s.expression??o.face.emotion;c.view.setExpression(zt[y][0],y);}let{center:d,size:p,lift:g}=s0(l==="full"||l==="head"?c.height:i0(c),l),b=28,E=new V__namespace.PerspectiveCamera(b,1,.05,50),v=p/2/Math.tan(V__namespace.MathUtils.degToRad(b/2));E.position.set(d.x,d.y+p*g,d.z-v),E.lookAt(d),e.render(m,E);let M=document.createElement("canvas");M.width=a,M.height=a;let R=M.getContext("2d");if(!R)return r;let A=s.background;if(typeof A=="string")R.fillStyle=A,R.fillRect(0,0,a,a);else if(A){let y=R.createRadialGradient(a*.5,a*.38,a*.05,a*.5,a*.5,a*.72);y.addColorStop(0,A[0]),y.addColorStop(1,A[1]),R.fillStyle=y,R.fillRect(0,0,a,a);}return R.imageSmoothingEnabled=!s.pixelated,R.drawImage(r,0,0),M}finally{c.dispose();}}function Bo(e,t){let r=document.createElement("canvas");r.width=e,r.height=e;let a=new V__namespace.WebGLRenderer({canvas:r,antialias:!t,alpha:true,preserveDrawingBuffer:true});return a.setPixelRatio(1),a.setSize(e,e,false),{renderer:a,lighting:Do(a),gl:r}}function Vo(e){e.lighting.dispose(),e.renderer.dispose(),e.renderer.forceContextLoss();}function m0(e,t,r={}){let a=Math.max(16,Math.round(r.size??256)),o=Bo(a,!!r.pixelated);try{return No(o.renderer,o.lighting,o.gl,a,e,t,r)}finally{Vo(o);}}function Ho(e={}){let t=Math.max(16,Math.round(e.size??256)),r=Bo(t,!!e.pixelated);return {render(a,o,n={}){if(!r)throw new Error("snapshotter disposed");return No(r.renderer,r.lighting,r.gl,t,a,o,{...n,pixelated:e.pixelated})},dispose(){r&&(Vo(r),r=null);}}}function x1(e,t,r={}){let a=m0(e,t,r);return new Promise(o=>a.toBlob(n=>o(n),"image/png"))}function w1(e){if(!e?.spec)return null;let t={};for(let r of e.items??[])r&&typeof r.id=="string"&&(t[r.id]=r);return {spec:Pt(e.spec),items:t}}function ge(e,t){let r=It(e);if(!r.ok)throw new Error(`avatar set: ${String(e.id)}: ${r.errors.join("; ")}`);return t===void 0?{item:r.item}:{item:r.item,price:t}}var J=e=>({w:e[0].length,h:e.length,rows:e}),u=(e,t,r,a={})=>({bone:"head",size:e,pos:t,color:r,...a}),k=(e,t,r,a={})=>({bone:"body",size:e,pos:t,color:r,...a}),q=(e,t,r,a,o={})=>({bone:e,size:t,pos:r,color:a,mirror:true,...o});var Ve=(e,t,r,a,o,n)=>ge({id:`back.${e}`,slot:"back",name:t,palette:r,tint:a,parts:o},n),rt=(e,t,r,a,o,n)=>ge({id:`neck.${e}`,slot:"neck",name:t,palette:r,tint:a,parts:o},n),oe={mirror:true},jo=[k([2.25,7.5,1.47],[1.69,21.15,3.04],"b",oe),k([10.13,3.13,.74],[7.31,26.15,3.86],"a",oe),k([10.13,3.13,.74],[7.88,23.03,4.05],"b",oe),k([9,3.13,.74],[8.44,19.9,4.23],"a",oe),k([6.75,3.13,.74],[9,16.77,4.42],"b",oe),k([4.5,3.13,.74],[9.56,13.65,4.6],"a",oe)],Go=[Ve("shield","Round shield",{a:"#a32d2d",b:"#d8b030",c:"#5a3a22"},"a",[k([8,8,.8],[0,17.5,3.4],"a"),k([8.6,.8,1],[0,21.6,3.4],"c"),k([8.6,.8,1],[0,13.4,3.4],"c"),k([2.2,2.2,.8],[0,17.5,4.2],"b",{mat:"metal"})]),Ve("skateboard","Skateboard",{a:"#2ab0c0",b:"#1d1d21",c:"#f4f1ea"},"a",[k([3,11,.5],[0,18,3.4],"a"),k([1,1,1],[1,13.4,3.9],"c",oe),k([1,1,1],[1,22.6,3.9],"c",oe)]),Ve("rocketpack","Rocket pack",{a:"#c8ccd2",b:"#2b2140",f:"#ff8a2a"},null,[k([2.6,7,2.6],[1.6,17.5,3.8],"a",{mirror:true,mat:"metal"}),k([1.8,.8,1.8],[1.6,13.6,3.8],"b",oe),k([1.4,3,1.4],[1.6,11.6,3.8],"f",{mirror:true,mat:"glow"}),k([2.8,.8,2.8],[1.6,21.4,3.8],"b",oe)],250),Ve("guitar","Guitar",{a:"#c0612b",b:"#3a2414",c:"#1d1d21"},"a",[k([5,5,1.4],[0,12.5,3.6],"a"),k([1,9,.8],[0,19.5,3.6],"b"),k([1.6,1.8,.9],[0,24.9,3.6],"b"),k([1.4,1.4,.2],[0,12.8,4.35],"c")],150),Ve("batwings","Bat wings",{a:"#3c2f5a",b:"#241a3a"},"a",jo,200),Ve("dragonwings","Dragon wings",{a:"#3c9a3c",b:"#2a6a2a",c:"#e8d27a"},"a",[...jo.slice(0,5),k([1,1.6,1],[12.2,28.3,3.86],"c",oe)],250),Ve("butterfly","Butterfly wings",{a:"#f2a03a",b:"#2b2140"},"a",[k([6,7,.4],[4.2,21,3.2],"a",oe),k([4.6,5,.4],[3.6,15,3.2],"a",oe),k([1.4,1.4,.3],[5,22.4,3.5],"b",oe),k([1,1,.3],[3.8,15,3.5],"b",oe)],180),Ve("fairy","Fairy wings",{a:"#c8f0ff",b:"#f6c8ff"},"a",[k([4.6,7,.3],[3.5,22,3],"a",{mirror:true,mat:"glass"}),k([3.4,4.6,.3],[3,16,3],"b",{mirror:true,mat:"glass"})],200),Ve("quiver","Quiver",{a:"#7a4f2a",b:"#c8ccd2",c:"#f4f1ea"},"a",[k([2.4,8,2.4],[1.8,20,3.8],"a"),k([.4,3,.4],[1.2,25.5,3.6],"b"),k([.4,3,.4],[2.4,25.8,4],"b"),k([.8,.8,.3],[1.2,27.2,3.6],"c"),k([.8,.8,.3],[2.4,27.5,4],"c")],120),Ve("shell","Turtle shell",{a:"#4c8a3a",b:"#2f5a24",c:"#c8b070"},"a",[k([8.6,9,2.8],[0,17.5,3.6],"a"),k([9.2,.9,3],[0,13,3.6],"c"),k([4,4,.4],[0,18,5.15],"b")],150)],Uo=[rt("scarf","Scarf",{a:"#c0392b",b:"#f4f1ea"},"a",[k([6,1.8,5.4],[0,22.5,0],"a"),k([1.6,4.5,.6],[1.2,19.4,-2.7],"a"),k([1.6,3.4,.6],[-0.6,19.9,-2.95],"b")]),rt("bowtie","Bow tie",{a:"#c0392b"},"a",[k([.6,.7,.6],[0,21.9,-2.6],"a"),k([1.2,1.2,.4],[.85,21.9,-2.55],"a",oe)]),rt("bandana","Neck scarf",{a:"#2f5fd0"},"a",[k([6,1.4,5],[0,22.4,0],"a"),k([4,1.6,.6],[0,21,-2.6],"a"),k([2.4,1.2,.6],[0,19.8,-2.6],"a"),k([1,.8,.6],[0,19,-2.6],"a")]),rt("chain","Gold chain",{a:"#e8b730"},null,[k([5.4,.5,4.8],[0,22.3,0],"a",{mat:"metal"}),k([.5,2.2,.4],[0,21,-2.55],"a",{mat:"metal"}),k([1.2,1.2,.4],[0,19.6,-2.6],"a",{mat:"metal"})],150),rt("medal","Medal",{a:"#e8b730",b:"#2f5fd0"},"b",[k([5.4,.5,4.8],[0,22.3,0],"b"),k([1.2,3.4,.3],[0,20.4,-2.5],"b"),k([1.6,1.6,.4],[0,18.3,-2.6],"a",{mat:"metal"})],120),rt("heart","Heart pendant",{a:"#e8436b",b:"#c8ccd2"},"a",[k([5.4,.4,4.8],[0,22.3,0],"b",{mat:"metal"}),k([.3,2.4,.3],[0,20.9,-2.5],"b",{mat:"metal"}),k([1.4,1.2,.4],[0,19.3,-2.6],"a"),k([.7,.5,.4],[.35,20,-2.6],"a",oe)],100),rt("lei","Flower lei",{a:"#4c9a4a",b:"#f08cb4",c:"#f2d33c",d:"#f4f1ea",e:"#ef9f27"},null,[k([6,1,5.4],[0,22.4,0],"a"),k([1.3,1.3,1.3],[2.4,21.4,-2.6],"b",oe),k([1.3,1.3,1.3],[0,20.9,-2.8],"c"),k([1.3,1.3,1.3],[3,22,0],"d",oe),k([1.3,1.3,1.3],[2,21.8,2.6],"e",oe)],120),rt("headphones","Headphones on the neck",{a:"#2b2140",b:"#4be0c8"},"b",[k([1.4,2,2.2],[3.6,22.2,-0.2],"a",oe),k([.3,1.4,1.6],[4.35,22.2,-0.2],"b",{mirror:true,mat:"glow"}),k([6,.7,.8],[0,21.6,2.2],"a")],150)];var ka=e=>({front:e,back:e,left:e,right:e}),He=(e,t,r,a,o,n)=>ge({id:`bottom.${e}`,slot:"bottom",name:t,palette:r,tint:a,textures:o.textures??{},paint:o.paint,parts:o.parts??[]},n),qo=[He("sweatpants","Sweatpants",{a:"#8a8f98",b:"#6a6f78"},"a",{paint:[{region:"legs",color:"a"}],parts:[q("shinR",[4.4,1,4.4],[2.1,1.4,0],"b")]}),He("leggings","Leggings",{a:"#1d1d21",w:"#f4f1ea"},"a",{textures:{st:J(["aawa","aawa","aawa","aawa"])},paint:[{region:"legs",color:"a",faces:{left:"st",right:"st"}}]}),He("pleated","Pleated skirt",{a:"#2b2140",b:"#3c3450",s:"@skin"},"a",{textures:{pl:J(["abababab","abababab","abababab","abababab"])},paint:[{region:"legs",color:"s"}],parts:[k([10.4,4.8,5.6],[0,11.3,0],"a",{faces:ka("pl")})]}),He("joggers","Joggers",{a:"#2f5fd0",b:"#1d3f90"},"a",{paint:[{region:"legs",color:"a"}],parts:[q("shinR",[4.3,1.2,4.3],[2.1,1.3,0],"b")]}),He("plaidskirt","Plaid skirt",{a:"#a32d2d",b:"#2b2140",s:"@skin"},"a",{textures:{pl:J(["abaabaab","bbbbbbbb","abaabaab","abaabaab","bbbbbbbb","abaabaab"])},paint:[{region:"legs",color:"s"}],parts:[k([10.13,4.38,5.52],[0,11.46,0],"a",{faces:ka("pl")})]},100),He("denimshorts","Denim shorts",{a:"#3f6fd8",b:"#6a8fe8",s:"@skin"},"a",{paint:[{region:"legs",color:"s"}],parts:[q("legR",[4.62,5.4,4.62],[2.1,9.7,0],"a"),q("legR",[4.8,.8,4.8],[2.1,7.3,0],"b")]},80),He("ripped","Ripped jeans",{a:"#2f5fd0",s:"@skin"},"a",{textures:{rp:J(["aaaa","asaa","aaaa","aaaa","assa","aaaa"])},paint:[{region:"legs",color:"a",faces:{front:"rp"}}]},100),He("camo","Camo pants",{a:"#5a6b3a",b:"#3a4a28",c:"#8a8a5a"},"a",{textures:{cm:J(["aabbac","abbaac","caabba","ccaaba","abccaa","aabcca"])},paint:[{region:"legs",color:"a",faces:ka("cm")}]},120),He("tutu","Tutu",{a:"#f08cb4",b:"#ffc0d8",c:"#f4d8e4"},"a",{paint:[{region:"legs",color:"c"}],parts:[k([12,1.6,8],[0,12.5,0],"a"),k([11,1.2,7.2],[0,11.4,0],"b")]},150),He("flares","Flared pants",{a:"#c87f17",b:"#a8670f"},"a",{paint:[{region:"legs",color:"a"}],parts:[q("shinR",[5.2,3,5.2],[2.1,2.3,0],"a")]},100)];var j=-4.75,wt=(e,t="a",r)=>[u([1.7,.3,.3],[3.6,e,j],t,{mirror:true,...r?{mat:r}:{}}),u([.3,.3,4.4],[4.45,e,-2.55],t,{mirror:true,...r?{mat:r}:{}})],xe=(e,t,r,a,o,n)=>ge({id:`face.${e}`,slot:"faceAcc",name:t,palette:r,tint:a,parts:o},n),Dt={"face.glasses":xe("glasses","Round glasses",{a:"#2b2140",g:"#cfe8ff"},"a",[u([2.6,.3,.3],[1.6,27.1,j],"a",{mirror:true}),u([2.6,.3,.3],[1.6,24.5,j],"a",{mirror:true}),u([.3,2.9,.3],[2.9,25.8,j],"a",{mirror:true}),u([.3,2.9,.3],[.3,25.8,j],"a",{mirror:true}),u([2.3,2.3,.15],[1.6,25.8,j],"g",{mirror:true,mat:"glass"}),...wt(26.6)]).item,"face.shades":xe("shades","Sunglasses",{a:"#1d1d21",g:"#2a2a30"},"a",[u([2.8,2.1,.3],[1.6,25.85,j],"g",{mirror:true,mat:"glass"}),u([6.8,.42,.36],[0,26.95,j],"a"),u([.36,1.6,.36],[3.05,26.1,j],"a",{mirror:true}),...wt(26.75)]).item,"face.visor":xe("visor","Cyber visor",{a:"#33e0ff",b:"#1d1d21"},"a",[u([8.6,1.8,.35],[0,25.9,-4.6],"a",{mat:"glow"}),u([.4,1.2,2.4],[4.35,26,-3.4],"b",{mirror:true}),u([.3,.6,7.6],[4.45,26.2,.4],"b",{mirror:true}),u([8.9,.6,.3],[0,26.2,4.45],"b")]).item},Yo=[xe("mask","Face mask",{a:"#9ad0f0",b:"#f4f1ea"},"a",[u([6.4,2.8,.6],[0,23.6,-4.15],"a"),u([.4,2.4,1.6],[3.35,23.7,-3.35],"a",{mirror:true}),u([.25,.25,3],[4.35,24.9,-1.9],"b",{mirror:true})]),xe("clownnose","Clown nose",{a:"#e0302a",b:"#ffffff"},"a",[u([1.4,1.3,1.2],[0,24.9,-4.55],"a"),u([.4,.4,.2],[-0.3,25.25,-5.2],"b")]),xe("mustache","Mustache",{a:"#3b2a20"},"a",[u([3.4,.7,.5],[0,24.45,-4.25],"a"),u([.9,.9,.5],[1.95,24.3,-4.25],"a",{mirror:true})]),xe("beard","Beard",{a:"#3b2a20"},"a",[u([6.4,1.4,1.4],[0,22.2,-3.5],"a"),u([1.3,3.4,5.2],[3.75,23.6,-1.4],"a",{mirror:true}),u([2.4,.8,.5],[0,23.05,-4.25],"a"),u([3.6,.7,.5],[0,24.45,-4.25],"a")],120),xe("aviators","Aviators",{a:"#d8b030",g:"#c8843a"},"g",[u([2.6,1.6,.2],[1.6,26,j],"g",{mirror:true,mat:"glass"}),u([2,.8,.2],[1.6,24.85,j],"g",{mirror:true,mat:"glass"}),u([6.8,.25,.3],[0,26.85,j],"a",{mat:"metal"}),u([1,.25,.3],[0,26.35,j],"a",{mat:"metal"}),u([.25,2,.3],[2.95,25.8,j],"a",{mirror:true,mat:"metal"}),...wt(26.7,"a","metal")],150),xe("square","Square glasses",{a:"#1d1d21",g:"#e0f0ff"},"a",[u([2.8,.45,.4],[1.6,27,j],"a",{mirror:true}),u([2.8,.45,.4],[1.6,24.6,j],"a",{mirror:true}),u([.45,2.4,.4],[3,25.8,j],"a",{mirror:true}),u([.45,2.4,.4],[.2,25.8,j],"a",{mirror:true}),u([2.2,2,.15],[1.6,25.8,j],"g",{mirror:true,mat:"glass"}),...wt(26.7),u([.6,.3,.3],[0,26.3,j],"a")],100),xe("hearts","Heart glasses",{a:"#e8436b",b:"#ff8fb0"},"a",[u([2.6,1.3,.3],[1.6,26.1,j],"b",{mirror:true,mat:"glass"}),u([1.7,.8,.3],[1.6,25.1,j],"b",{mirror:true,mat:"glass"}),u([.8,.6,.3],[1.6,24.5,j],"b",{mirror:true,mat:"glass"}),u([1.1,.7,.32],[1,26.9,j],"a",{mirror:true}),u([1.1,.7,.32],[2.2,26.9,j],"a",{mirror:true}),u([.8,.3,.3],[0,26.3,j],"a"),...wt(26.6)],120),xe("stars","Star glasses",{a:"#d8b030",b:"#ffe27a"},"a",[u([2.8,.9,.3],[1.6,26,j],"b",{mirror:true,mat:"glass"}),u([1.2,2.6,.3],[1.6,25.8,j],"b",{mirror:true,mat:"glass"}),u([.6,.7,.32],[1.6,27.3,j],"a",{mirror:true}),u([.8,.3,.3],[0,26.3,j],"a"),...wt(26.6)],120),xe("goggles","Ski goggles",{a:"#2f5fd0",g:"#ff9a3c"},"a",[u([7.6,2.4,.4],[0,25.9,-4.8],"g",{mat:"glass"}),u([8.2,.5,.6],[0,27.35,-4.6],"a"),u([8.2,.5,.6],[0,24.45,-4.6],"a"),u([.5,1.4,8.6],[4.5,25.9,0],"a",{mirror:true}),u([9.4,1.4,.5],[0,25.9,4.5],"a")],150),xe("monocle","Monocle",{a:"#d8b030",g:"#e0f0ff"},null,[u([2.4,.25,.25],[-1.6,27,j],"a",{mat:"metal"}),u([2.4,.25,.25],[-1.6,24.6,j],"a",{mat:"metal"}),u([.25,2.4,.25],[-2.8,25.8,j],"a",{mat:"metal"}),u([.25,2.4,.25],[-0.4,25.8,j],"a",{mat:"metal"}),u([2.2,2.2,.12],[-1.6,25.8,j],"g",{mat:"glass"}),u([.2,3.2,.2],[-2.9,22.9,-4.7],"a",{mat:"metal"})],150),xe("3d","3D glasses",{a:"#f4f1ea",r:"#e0302a",c:"#2f8fe0"},null,[u([6.9,.5,.35],[0,27,j],"a"),u([6.9,.5,.35],[0,24.6,j],"a"),u([.5,2.9,.35],[3.2,25.8,j],"a",{mirror:true}),u([.8,2.9,.35],[0,25.8,j],"a"),u([2.3,1.9,.15],[1.6,25.8,j],"r",{mat:"glass"}),u([2.3,1.9,.15],[-1.6,25.8,j],"c",{mat:"glass"}),...wt(26.6)],100),xe("eyepatch","Eye patch",{a:"#1d1d21"},null,[u([2.6,2.4,.4],[1.6,25.9,-4.3],"a"),u([5,.4,.3],[-1,27.3,-4.3],"a"),u([.3,.5,8.6],[4.4,27.3,0],"a",{mirror:true}),u([8.9,.5,.3],[0,27.3,4.4],"a")],100)];var Sa=(e,t)=>(r,a,o,n,s,l)=>ge({id:`${t}.${r}`,slot:e,name:a,palette:o,tint:n,textures:s.textures??{},paint:s.paint??[],parts:s.parts??[]},l),at=Sa("shoes","shoes"),Nr=Sa("hands","hands"),Br=Sa("waist","waist"),Aa=(e="a")=>k([9.45,1.25,4.97],[0,13.15,0],e),$o=[at("bunny","Bunny slippers",{a:"#f4f1ea",b:"#f08cb4"},"b",{paint:[{region:"feet",color:"a"}],parts:[q("shinR",[.6,1.6,.4],[1.3,2.2,-2.4],"a"),q("shinR",[.6,1.6,.4],[2.9,2.2,-2.4],"a"),q("shinR",[.9,.7,.5],[2.1,1.1,-3.3],"b")]}),at("rainboots","Rain boots",{a:"#f2c14e",b:"#2b2140"},"a",{paint:[{region:"feet",color:"a",faces:{bottom:"b"}}],parts:[q("shinR",[4.6,5,4.6],[2.1,3.5,0],"a")]}),at("runners","Running shoes",{a:"#2ab0c0",b:"#f4f1ea",c:"#e8436b"},"a",{textures:{sd:J(["aaaaa","acaca","bbbbb"])},paint:[{region:"feet",color:"a",faces:{left:"sd",right:"sd",bottom:"b"}}],parts:[q("shinR",[4.4,.5,5.5],[2.1,.25,-0.5],"b")]}),at("rollers","Roller skates",{a:"#e8436b",b:"#f4f1ea",c:"#2b2140"},"a",{paint:[{region:"feet",color:"a"}],parts:[q("shinR",[4.5,3,4.6],[2.1,2.6,0],"a"),q("shinR",[3.4,.4,5],[2.1,.2,-0.5],"b"),q("shinR",[3.6,.9,.9],[2.1,-0.05,-2.4],"c"),q("shinR",[3.6,.9,.9],[2.1,-0.05,1.4],"c")]},150),at("iceskates","Ice skates",{a:"#f4f1ea",b:"#c8ccd2"},"a",{paint:[{region:"feet",color:"a"}],parts:[q("shinR",[4.5,3.2,4.6],[2.1,2.7,0],"a"),q("shinR",[.35,.6,5.8],[2.1,-0.2,-0.5],"b",{mat:"metal"})]},150),at("cowboy","Cowboy boots",{a:"#7a4f2a",b:"#4a2e1a"},"a",{paint:[{region:"feet",color:"a"}],parts:[q("shinR",[4.7,4.6,4.7],[2.1,3.6,0],"a"),q("shinR",[3,.6,1.4],[2.1,.3,1.6],"b")]},120),at("space","Space boots",{a:"#f4f1ea",b:"#9aa4ae"},null,{paint:[{region:"feet",color:"a"}],parts:[q("shinR",[5,4.6,5],[2.1,3.3,0],"a"),q("shinR",[4.6,.6,5.8],[2.1,.3,-0.5],"b")]},150),at("platform","Platform sneakers",{a:"#1d1d21",w:"#f4f1ea"},"a",{textures:{toe:J(["aaaa","wwww"]),side:J(["aaaaa","wwwww"])},paint:[{region:"feet",color:"a",faces:{front:"toe",back:"toe",left:"side",right:"side",bottom:"w"}}],parts:[q("shinR",[4.5,1.2,5.6],[2.1,.6,-0.5],"w")]},100)],Ko=[Nr("mittens","Mittens",{a:"#c0392b",b:"#f4f1ea"},"a",{paint:[{region:"hands",color:"a"}],parts:[q("foreArmR",[3.7,.9,3.7],[6.3,14.3,0],"b")]}),Nr("fingerless","Fingerless gloves",{a:"#2b2140",s:"@skin"},"a",{textures:{fl:J(["sss","aaa","aaa"])},paint:[{region:"hands",color:"a",faces:{front:"fl",back:"fl",left:"fl",right:"fl",bottom:"s"}}]}),Nr("wristbands","Wristbands",{a:"#e8436b"},"a",{parts:[q("foreArmR",[3.8,1.2,3.8],[6.3,14.7,0],"a")]}),Nr("boxing","Boxing gloves",{a:"#c0392b",b:"#f4f1ea"},"a",{paint:[{region:"hands",color:"a"}],parts:[q("foreArmR",[4.2,3.6,4.2],[6.3,12.5,-0.2],"a"),q("foreArmR",[3.8,1,3.8],[6.3,14.6,0],"b")]},100)],Xo=[Br("fannypack","Fanny pack",{a:"#2b2140",b:"#534ab7",m:"#c8ccd2"},"b",{parts:[k([9.45,.8,4.97],[0,13.6,0],"a"),k([4,2,1.6],[0,13.6,-3.1],"b"),k([3.2,.2,.15],[0,14.3,-3.92],"m",{mat:"metal"})]}),Br("tools","Tool belt",{a:"#5a3a22",b:"#8a5a32",m:"#9aa4ae",h:"#c0612b"},"a",{parts:[Aa(),k([2.2,2.2,1.3],[3.2,12,-2.8],"b",{mirror:true}),k([.5,2.6,.5],[-1.4,11.8,-3.1],"h"),k([1.6,.7,.7],[-1.4,13.2,-3.1],"m",{mat:"metal"})]},80),Br("sheath","Sword sheath",{a:"#3a2a22",b:"#5a3a22",m:"#c8ccd2"},"a",{parts:[Aa(),k([.9,4.8,1.2],[4.9,12.1,0],"b"),k([1.6,.4,.8],[4.9,14.7,0],"m",{mat:"metal"}),k([.6,1.4,.6],[4.9,15.6,0],"a")]},120),Br("pouches","Double pouches",{a:"#3a2a22",b:"#6b6b4a"},"b",{parts:[Aa("a"),k([2.4,2.4,1.3],[2.6,11.8,-2.9],"b",{mirror:true})]},60)];var Fe=u([9.21,2.05,8.73],[0,29.91,0],"a"),ot=u([9.21,1.7,.73],[0,28.72,-4.36],"a"),sr=u([.71,1.7,2.8],[4.5,28.72,-2.9],"a",{mirror:true}),nt=(e,t)=>u([.71,e,7.58],[4.6,t,.51],"a",{mirror:true}),st=(e,t)=>u([9.21,e,.73],[0,t,4.36],"a"),he=(e,t,r,a,o={a:"#3b2a20"})=>ge({id:`hair.${e}`,slot:"hair",name:t,palette:o,tint:"a",parts:r},a),Wo=[he("afro","Afro",[u([11.4,4.4,10.2],[0,31.3,.6],"a"),u([10.6,2.2,8.2],[0,27.2,1.5],"a"),u([1.2,4.2,7.4],[5,26.4,1.2],"a",{mirror:true}),u([9.6,4.4,1.3],[0,26.2,4.9],"a"),u([8.6,1.9,.8],[0,28.95,-4.5],"a")]),he("buzz","Buzz cut",[u([8.9,.6,8.4],[0,30.45,0],"a"),u([.4,2.6,7.6],[4.42,28.9,.2],"a",{mirror:true}),u([8.9,3.6,.4],[0,28.4,4.2],"a"),u([8.9,.8,.4],[0,29.75,-4.2],"a")]),he("sidepart","Side part",[Fe,u([5.5,2.4,.9],[-1.85,28.6,-4.4],"a"),u([3.7,1.3,.73],[2.75,29.1,-4.36],"a"),nt(3.41,27.86),st(4.77,27.18),u([3.2,1,3.4],[-1.6,31.3,-1.4],"a")]),he("pigtails","Pigtails",[Fe,ot,sr,nt(3.41,27.86),st(4.77,27.18),u([1.9,4.6,1.9],[4.9,26,1.6],"a",{mirror:true}),u([2.1,.8,2.1],[4.9,28.4,1.6],"b",{mirror:true})],void 0,{a:"#3b2a20",b:"#d4537e"}),he("braids","Braids",[Fe,ot,nt(3.41,27.86),st(4.77,27.18),u([1.6,5.6,1.6],[3.4,25,3.9],"a",{mirror:true}),u([1.9,.6,1.9],[3.4,22.5,3.9],"b",{mirror:true})],void 0,{a:"#3b2a20",b:"#f2c14e"}),he("bowl","Bowl cut",[u([9.9,3.2,9.4],[0,29,0],"a"),u([9.4,1,8.9],[0,30.9,0],"a"),u([9.6,3.6,.9],[0,27,4.5],"a")]),he("dreads","Dreadlocks",[Fe,ot,u([1.3,5,1.3],[4.75,25.6,-1.6],"a",{mirror:true}),u([1.3,5.6,1.3],[4.75,25.3,1.7],"a",{mirror:true}),u([1.3,6,1.3],[2.4,25,4.75],"a",{mirror:true}),u([1.3,6.2,1.3],[0,25.2,4.8],"a"),st(3.2,28.3)],120),he("longwavy","Long waves",[Fe,ot,sr,u([1.06,6.82,7.88],[4.78,26.16,.66],"a",{mirror:true}),u([9.21,7.5,1.09],[0,26.16,4.55],"a"),u([1.3,2,8],[5.1,23.4,.9],"a",{mirror:true}),u([9.8,2,1.4],[0,23.2,4.85],"a")],120),he("topknot","Top knot",[Fe,ot,sr,nt(2.73,28.2),st(4.09,27.52),u([3.2,2.8,3.2],[0,32.3,0],"a"),u([3.5,.6,3.5],[0,31.1,0],"b")],100,{a:"#3b2a20",b:"#1d1d21"}),he("spacebuns","Space buns",[Fe,ot,sr,nt(3.41,27.86),st(4.77,27.18),u([3,3,3],[3,31.8,.5],"a",{mirror:true})],120),he("emo","Swept fringe",[Fe,u([6.5,3.8,.9],[-1.3,27.6,-4.45],"a"),u([2.7,1.3,.73],[3.25,29.1,-4.36],"a"),nt(4.5,27.3),st(5.4,26.9)],100),he("quiff","Quiff",[Fe,u([8,2.4,3.2],[0,31.4,-2.6],"a"),u([8.6,1.2,1.2],[0,30.6,-4.4],"a"),nt(2.73,28.2),st(4.09,27.52)],100),he("mullet","Mullet",[Fe,ot,sr,nt(2.73,28.2),u([9.21,7,1.09],[0,25.8,4.55],"a"),u([8,2,1.6],[0,23.2,4.9],"a")],80),he("wavybob","Wavy bob",[Fe,ot,u([1.06,6.13,8.6],[4.78,26.84,.3],"a",{mirror:true}),u([9.21,6.14,1.09],[0,26.5,4.55],"a"),u([1.5,1.2,8.8],[5.1,24.1,.3],"a",{mirror:true}),u([9.6,1.2,1.5],[0,24.1,4.8],"a")],100),he("curls","Shoulder curls",[u([9.92,2.39,9.45],[0,30.08,0],"a"),u([9.21,1.36,.73],[0,28.89,-4.8],"a"),u([2.83,2.73,2.91],[3.54,28.89,-2.55],"a",{mirror:true}),u([2.83,2.73,2.91],[3.54,28.89,1.82],"a",{mirror:true}),u([5.67,2.05,5.82],[0,31.61,0],"a"),u([4.25,4.27,2.18],[2.13,27.27,4],"a",{mirror:true}),u([2.6,4,2.6],[4.4,24.4,2.4],"a",{mirror:true})],150),he("undercut","Undercut",[u([9.21,2.6,8.73],[0,30.2,0],"a"),u([9.21,1.7,2],[0,29.9,-4.3],"a"),u([.4,2.6,7.6],[4.42,28.2,.2],"b",{mirror:true}),u([8.9,3.4,.4],[0,27.6,4.2],"b")],120,{a:"#3b2a20",b:"#2a1d16"})];var le=(e,t,r,a,o,n)=>ge({id:`hat.${e}`,slot:"hat",name:t,palette:r,tint:a,parts:o},n),Ea=u([9.4,.7,1.2],[0,30.6,0],"c"),Jo=[le("tophat","Top hat",{a:"#1d1d21",b:"#a32d2d"},"a",[u([11.4,.55,11],[0,30.6,0],"a"),u([8.6,6,8.2],[0,33.9,0],"a"),u([8.8,.9,8.4],[0,31.4,0],"b")],150),le("cowboy","Cowboy hat",{a:"#9a6a3a",b:"#4a2e1a"},"a",[u([13,.6,12],[0,30.4,0],"a"),u([.8,1.2,11],[6.1,31,0],"a",{mirror:true}),u([8.4,3.5,8],[0,32.4,0],"a"),u([8.6,.7,8.2],[0,31.1,0],"b")],150),le("tricorn","Tricorn",{a:"#2c2420",b:"#d8b030"},"a",[u([10.4,2.4,10],[0,31.2,0],"a"),u([.8,2.6,8],[5.2,31.6,0],"a",{mirror:true}),u([9,2.6,.8],[0,31.6,4.8],"a"),u([3,2.2,.8],[0,31.4,-5],"a"),u([8,.4,.6],[0,30.2,-5.2],"b",{mat:"metal"})],180),le("chef","Chef hat",{a:"#f6f4ee",b:"#e2ded2"},null,[u([9.8,2,9.4],[0,30.7,0],"b"),u([10.6,4.5,10.2],[0,33.9,0],"a")],100),le("beret","Beret",{a:"#a32d2d"},"a",[u([10,1.6,9.6],[-0.4,31,0],"a"),u([.8,.8,.8],[0,32,0],"a")]),le("hardhat","Hard hat",{a:"#f2c14e",b:"#d8a030"},"a",[u([9.8,3,9.4],[0,31.3,0],"a"),u([9.8,.5,2.5],[0,30,-5.5],"a"),u([1,.8,9.6],[0,33,0],"b")],80),le("viking","Viking helmet",{a:"#9aa4ae",b:"#6a5a3a",c:"#f0e6d0"},"a",[u([9.8,3.2,9.4],[0,31.2,0],"a",{mat:"metal"}),u([10.2,1,9.8],[0,29.9,0],"b"),u([1.4,1.4,1.4],[5.5,31.6,0],"c",{mirror:true}),u([1.1,2.4,1.1],[6.2,33.2,0],"c",{mirror:true}),u([.8,2.2,.5],[0,28.6,-5.05],"a",{mat:"metal"})],200),le("space","Space helmet",{a:"#bfe6ff",b:"#d8dde4",c:"#ff5a3c"},null,[u([11,10.4,10.8],[0,27,0],"a",{mat:"glass"}),u([10,1,9.6],[0,22.3,0],"b",{mat:"metal"}),u([1.2,1.2,.6],[0,32.4,-1.6],"c",{mat:"glow"})],250),le("catears","Cat ears",{a:"#2b2140",b:"#f08cb4",c:"#2b2140"},"a",[Ea,u([2,2.2,1],[2.9,32,0],"a",{mirror:true}),u([1.1,1.3,.4],[2.9,31.8,-0.65],"b",{mirror:true})]),le("bunnyears","Bunny ears",{a:"#f4f1ea",b:"#f08cb4",c:"#f4f1ea"},"a",[Ea,u([1.5,5.4,.9],[1.9,33.6,0],"a",{mirror:true}),u([.8,4.2,.3],[1.9,33.4,-0.55],"b",{mirror:true})],80),le("foxears","Fox ears",{a:"#e8862a",b:"#2a1c14",c:"#2a1c14"},"a",[Ea,u([2.4,2.8,1],[2.8,32.2,0],"a",{mirror:true}),u([2.4,.9,1.05],[2.8,33.55,0],"b",{mirror:true})],80),le("halo","Halo",{a:"#ffe27a"},"a",[u([6,.5,1],[0,33.4,-2.5],"a",{mat:"glow"}),u([6,.5,1],[0,33.4,2.5],"a",{mat:"glow"}),u([1,.5,4],[2.5,33.4,0],"a",{mat:"glow",mirror:true})],250),le("horns","Little horns",{a:"#c0392b",b:"#7a1d1d"},"a",[u([1.4,1.8,1.4],[2.6,31.1,-0.6],"a",{mirror:true}),u([.9,1.2,.9],[2.9,32.5,-0.6],"b",{mirror:true})],120),le("party","Party hat",{a:"#7f77dd",b:"#f2c14e"},"a",[u([6,1.6,6],[0,31.1,0],"a"),u([4.4,1.8,4.4],[0,32.8,0],"b"),u([2.8,1.8,2.8],[0,34.6,0],"a"),u([1.4,1.6,1.4],[0,36.3,0],"b"),u([1.6,1.2,1.6],[0,37.3,0],"a")]),le("flowers","Flower wreath",{a:"#4c9a4a",b:"#f08cb4",c:"#f2d33c",d:"#f4f1ea"},null,[u([9.6,.9,9.2],[0,30.4,0],"a"),u([1.4,1.2,1.4],[3,30.9,-4.4],"b",{mirror:true}),u([1.4,1.2,1.4],[0,31,-4.6],"c"),u([1.4,1.2,1.4],[4.7,30.9,.5],"d",{mirror:true}),u([1.4,1.2,1.4],[2.6,30.9,4.5],"c",{mirror:true})],120),le("bandana","Bandana",{a:"#c0392b"},"a",[u([9.6,2.4,9.2],[0,30.1,0],"a"),u([2,1.6,1.6],[0,29.4,5],"a"),u([1,2.6,.6],[.7,27.6,5.2],"a",{mirror:true})]),le("ninja","Ninja headband",{a:"#2b2140",b:"#c8ccd2"},"a",[u([9.4,1.3,9],[0,28.8,0],"a"),u([3,1.1,.4],[0,28.8,-4.7],"b",{mat:"metal"}),u([.9,3,.5],[.7,27,4.9],"a",{mirror:true})],100),le("propeller","Propeller cap",{a:"#2f5fd0",b:"#f2d33c",c:"#c0392b"},"a",[u([9.63,2.73,9.16],[0,30.8,.15],"a"),u([7.79,.55,3.64],[0,29.57,-5.96],"a"),u([.6,1.2,.6],[0,32.7,0],"b"),u([7,.3,1.2],[0,33.4,0],"c"),u([1.2,.3,7],[0,33.4,0],"b")],150)];var Vr=e=>({front:e,back:e,left:e,right:e}),ce=(e,t,r,a,o,n)=>ge({id:`top.${e}`,slot:"top",name:t,palette:r,tint:a,textures:o.textures??{},paint:o.paint,parts:o.parts??[]},n),p0=J(["abaabaab","bbbbbbbb","abaabaab","abaabaab","bbbbbbbb","abaabaab","abaabaab","abaabaab"]),Zo=[ce("flannel","Flannel shirt",{a:"#c0392b",b:"#2b2140"},"a",{textures:{pl:p0},paint:[{region:"torso",color:"a",faces:Vr("pl")},{region:"arms",color:"a",faces:Vr("pl")}],parts:[k([5.6,.8,.5],[0,22.2,-2.4],"b")]}),ce("polo","Polo shirt",{a:"#1d9e75",w:"#f4f1ea"},"a",{textures:{pk:J(["aaawaaaa","aaawaaaa","aaawaaaa","aaaaaaaa","aaaaaaaa","aaaaaaaa","aaaaaaaa","aaaaaaaa"])},paint:[{region:"torso",color:"a",faces:{front:"pk"}},{region:"sleeves",color:"a"}],parts:[k([4.6,.9,.6],[0,22.4,-2.3],"a")]}),ce("heart","Heart sweater",{a:"#d4537e",b:"#f4f1ea"},"a",{textures:{h:J(["aaaaaaaa","aabaabaa","abbbbbba","abbbbbba","aabbbbaa","aaabbaaa","aaaaaaaa","aaaaaaaa"])},paint:[{region:"torso",color:"a",faces:{front:"h"}},{region:"arms",color:"a"}]}),ce("gamer","Gamepad tee",{a:"#2b2140",b:"#9aa4ae",c:"#33e0ff",d:"#e8436b"},"a",{textures:{g:J(["aaaaaaaa","aaaaaaaa","abbbbbba","bcbbbdbb","bbbbbbbb","abbaabba","aaaaaaaa","aaaaaaaa"])},paint:[{region:"torso",color:"a",faces:{front:"g"}},{region:"sleeves",color:"a"}]}),ce("jersey","Sports jersey",{a:"#2f5fd0",w:"#f4f1ea"},"a",{textures:{n:J(["aaaaaaaa","aawwwwaa","aaaaawaa","aaaawaaa","aaawaaaa","aaawaaaa","aaaaaaaa","aaaaaaaa"]),sl:J(["aaa","www","aaa"])},paint:[{region:"torso",color:"a",faces:{front:"n",back:"n"}},{region:"sleeves",color:"a",faces:Vr("sl")}]}),ce("dress","Dress",{a:"#7f77dd",b:"#f4f1ea"},"a",{paint:[{region:"torso",color:"a"},{region:"sleeves",color:"a"}],parts:[k([10.2,5,5.6],[0,12.1,0],"a"),k([9,.8,4.6],[0,14.9,0],"b")]}),ce("bomber","Varsity jacket",{a:"#a32d2d",b:"#f4f1ea",c:"#2b2140"},"a",{textures:{fr:J(["aaabbaaa","aaabbaaa","abaabaaa","abaabaaa","aaabbaaa","aaabbaaa","aaabbaaa","aaabbaaa"]),cf:J(["bbb","bbb","bbb","bbb","ccc"])},paint:[{region:"torso",color:"a",faces:{front:"fr"}},{region:"arms",color:"b",faces:Vr("cf")}],parts:[k([8.8,.9,4.6],[0,12.9,0],"c")]},120),ce("puffer","Puffer jacket",{a:"#ef9f27",b:"#c87f17"},"a",{paint:[{region:"torso",color:"a"},{region:"arms",color:"a"}],parts:[k([9.6,3.2,5.2],[0,20.6,0],"a"),k([9.4,3,5],[0,17.4,0],"b"),k([9,3,4.8],[0,14.3,0],"a"),q("armR",[4,2.2,4],[6.3,20.4,0],"a")]},150),ce("overalls","Overalls",{a:"#2f5fd0",b:"#f4f1ea",g:"#d8b030"},"a",{paint:[{region:"torso",color:"b"},{region:"sleeves",color:"b"}],parts:[k([6,5,.5],[0,17.8,-2.4],"a"),k([1.2,4,.5],[2.4,20.6,-2.4],"a",{mirror:true}),k([.6,.6,.3],[2.4,21.7,-2.75],"g",{mirror:true,mat:"metal"}),k([1.2,9,.5],[2.4,17.5,2.4],"a",{mirror:true}),k([8.8,4.4,4.6],[0,14.8,0],"a")]},100),ce("labcoat","Lab coat",{a:"#f4f1ea",b:"#9ad0f0"},null,{paint:[{region:"torso",color:"a"},{region:"arms",color:"a"}],parts:[k([9,4.5,4.8],[0,11.8,0],"a"),k([1.6,4,.4],[1.6,19.8,-2.45],"a",{mirror:true}),k([1.6,1.4,.3],[-2.6,17,-2.4],"b")]},120),ce("ninja","Ninja suit",{a:"#2b2140",r:"#c0392b",g:"#3c3450"},"a",{textures:{wr:J(["agaaaaaa","aagaaaaa","aaagaaaa","aaaagaaa","aaaaagaa","aaaaaaga","aaaaaaaa","aaaaaaaa"])},paint:[{region:"torso",color:"a",faces:{front:"wr"}},{region:"arms",color:"a"}],parts:[k([9.2,1,4.8],[0,14.3,0],"r")]},150),ce("space","Space suit",{a:"#f4f1ea",b:"#9aa4ae",c:"#33e0ff",d:"#e8436b"},null,{paint:[{region:"torso",color:"a"},{region:"arms",color:"a"}],parts:[k([5,3.6,.6],[0,19,-2.5],"b"),k([.6,.6,.3],[-1.2,19.6,-2.9],"c",{mat:"glow"}),k([.6,.6,.3],[1.2,19.6,-2.9],"d",{mat:"glow"}),q("armR",[4.2,1,4.2],[6.3,22.4,0],"b"),k([7,.8,5],[0,22.6,0],"b",{mat:"metal"})]},250),ce("pirate","Pirate shirt",{a:"#f4f1ea",b:"#5a3a22",r:"#a32d2d"},null,{textures:{v:J(["aabbbbaa","aaabbaaa","aabaabaa","aaabbaaa","aaaaaaaa","aaaaaaaa","aaaaaaaa","aaaaaaaa"])},paint:[{region:"torso",color:"a",faces:{front:"v"}},{region:"arms",color:"a"}],parts:[q("foreArmR",[4.2,3,4.2],[6.3,15.6,0],"a"),k([9.2,1.4,4.8],[0,13.6,0],"r")]},120),ce("raincoat","Raincoat",{a:"#f2c14e",b:"#d8a030"},"a",{textures:{bt:J(["aaaaaaaa","aaabaaaa","aaaaaaaa","aaabaaaa","aaaaaaaa","aaabaaaa","aaaaaaaa","aaaaaaaa"])},paint:[{region:"torso",color:"a",faces:{front:"bt"}},{region:"arms",color:"a"}],parts:[k([7,3.6,2],[0,21.5,2.9],"a"),k([9,4,4.8],[0,12,0],"a")]},100),ce("vest","Vest and shirt",{a:"#5a3a22",b:"#f4f1ea"},"a",{paint:[{region:"torso",color:"b"},{region:"arms",color:"b"}],parts:[k([4.2,7,.5],[2.2,17.5,-2.4],"a",{mirror:true}),k([9,9,.5],[0,17.4,2.4],"a")]},80),ce("chef","Chef jacket",{a:"#f6f4ee",b:"#2b2140"},null,{textures:{db:J(["aaaaaaaa","aabaabaa","aaaaaaaa","aabaabaa","aaaaaaaa","aabaabaa","aaaaaaaa","aaaaaaaa"])},paint:[{region:"torso",color:"a",faces:{front:"db"}},{region:"arms",color:"a"}],parts:[k([5,.8,.5],[0,22.3,-2.4],"a")]},80),ce("tuxedo","Tuxedo",{a:"#1d1d21",w:"#f4f1ea"},null,{textures:{tx:J(["aawwwwaa","aaawwaaa","aaawwaaa","aaawwaaa","aaaaaaaa","aaaaaaaa","aaaaaaaa","aaaaaaaa"])},paint:[{region:"torso",color:"a",faces:{front:"tx"}},{region:"arms",color:"a"}],parts:[k([2,1,.4],[0,21.7,-2.6],"a"),k([8.6,4,.6],[0,11.6,2.4],"a")]},200),ce("leather","Leather jacket",{a:"#2a2420",b:"#c8ccd2"},"a",{paint:[{region:"torso",color:"a"},{region:"arms",color:"a"}],parts:[k([2.6,1.6,.6],[2.5,22.1,-2.25],"a",{mirror:true}),k([.4,8,.3],[-0.8,16.8,-2.45],"b",{mat:"metal"})]},180)];var ir=[...Wo,...Zo,...qo,...$o,...Ko,...Xo,...Go,...Uo,...Yo,...Jo];function Ce(e){let t=It(e);if(!t.ok)throw new Error(`avatar shop: ${String(e.id)}: ${t.errors.join("; ")}`);return t.item}var va=e=>({w:e[0].length,h:e.length,rows:e}),d0={bone:"head",size:[9.21,2.05,8.73],pos:[0,29.91,0],color:"a"},h0={bone:"head",size:[9.21,1.7,.73],pos:[0,28.72,-4.36],color:"a"},Qo=[{price:250,item:Ce({id:"hat.crown",slot:"hat",name:"Crown",palette:{a:"#e8b730",g:"#d23c4a"},tint:"a",parts:[{bone:"head",size:[9.21,1.7,.73],pos:[0,30.93,-4.36],color:"a"},{bone:"head",size:[9.21,1.7,.73],pos:[0,30.93,4.36],color:"a"},{bone:"head",size:[.71,1.7,8.73],pos:[4.6,30.93,0],color:"a",mirror:true},{bone:"head",size:[1.13,1.36,.73],pos:[2.98,32.47,-4.36],color:"a",mirror:true},{bone:"head",size:[1.13,1.77,.73],pos:[0,32.67,-4.36],color:"a"},{bone:"head",size:[.99,.95,.29],pos:[0,30.93,-4.87],color:"g"}]})},{price:250,item:Ce({id:"back.wings",slot:"back",name:"Angel wings",palette:{a:"#f7f5ff",b:"#d9d4f2"},tint:"a",parts:[{bone:"body",size:[2.25,7.5,1.47],pos:[1.69,21.15,3.04],color:"b",mirror:true},{bone:"body",size:[10.13,3.13,.74],pos:[7.31,26.15,3.86],color:"a",mirror:true},{bone:"body",size:[10.13,3.13,.74],pos:[7.88,23.03,4.05],color:"b",mirror:true},{bone:"body",size:[9,3.13,.74],pos:[8.44,19.9,4.23],color:"a",mirror:true},{bone:"body",size:[6.75,3.13,.74],pos:[9,16.77,4.42],color:"b",mirror:true},{bone:"body",size:[4.5,3.13,.74],pos:[9.56,13.65,4.6],color:"a",mirror:true},{bone:"body",size:[3.38,1.88,.74],pos:[11.25,28.65,3.86],color:"a",mirror:true}]})},{price:200,item:Ce({id:"hat.wizard",slot:"hat",name:"Wizard hat",palette:{a:"#3c2f8f",s:"#f2c14e"},tint:"a",parts:[{bone:"head",size:[10.63,.55,10.18],pos:[0,30.39,0],color:"a"},{bone:"head",size:[8.5,1.77,8],pos:[0,31.55,0],color:"a"},{bone:"head",size:[6.38,1.77,5.82],pos:[0,33.32,.36],color:"a"},{bone:"head",size:[4.25,1.77,4],pos:[0,35.09,.73],color:"a"},{bone:"head",size:[2.13,1.64,2.18],pos:[0,36.8,1.09],color:"a"},{bone:"head",size:[1.13,1.09,.29],pos:[0,31.61,-4.15],color:"s"}]})},{price:200,item:Ce({id:"top.armor",slot:"top",name:"Knight armor",palette:{a:"#b8c2cc",b:"#5b6672",g:"#e8b730"},tint:"a",paint:[{region:"torso",color:"b"},{region:"arms",color:"b"}],parts:[{bone:"body",size:[9.67,7.5,.74],pos:[0,18.65,-2.67],color:"a"},{bone:"armR",size:[4.32,2.94,4.32],pos:[6.3,22.38,0],color:"a",mirror:true},{bone:"body",size:[2.25,2.5,.37],pos:[0,19.27,-3.22],color:"g"}]})},{price:200,item:Ce({id:"back.sword",slot:"back",name:"Sword",palette:{a:"#d8dde4",g:"#e8b730",h:"#5a3a22"},tint:"g",parts:[{bone:"body",size:[1.35,12.5,.55],pos:[2.81,17.4,3.04],color:"a"},{bone:"body",size:[4.5,1.13,.92],pos:[2.81,24.21,3.04],color:"g"},{bone:"body",size:[1.01,3.75,.83],pos:[2.81,26.65,3.04],color:"h"},{bone:"body",size:[1.58,1.5,1.1],pos:[2.81,29.28,3.04],color:"g"}]})},{price:150,item:Ce({id:"hat.headphones",slot:"hat",name:"Headphones",palette:{a:"#2b2140",b:"#4be0c8"},tint:"b",parts:[{bone:"head",size:[9.63,.82,1.45],pos:[0,31.07,0],color:"a"},{bone:"head",size:[.57,3.41,.87],pos:[4.89,29.57,0],color:"a",mirror:true},{bone:"head",size:[1.13,2.45,2.62],pos:[4.96,27.39,0],color:"a",mirror:true},{bone:"head",size:[.28,1.64,1.75],pos:[5.6,27.39,0],color:"b",mirror:true}]})},{price:150,item:Ce({id:"hair.mohawk",slot:"hair",name:"Mohawk",palette:{a:"#d4537e"},tint:"a",parts:[{bone:"head",size:[1.84,3.07,8],pos:[0,31.78,0],color:"a"},{bone:"head",size:[1.84,2.05,1.45],pos:[0,31.27,-4.73],color:"a"},{bone:"head",size:[2.13,4.09,.73],pos:[0,28.2,4.36],color:"a"}]})},{price:150,item:Ce({id:"top.suit",slot:"top",name:"Suit and tie",palette:{a:"#2c2f3a",w:"#f4f1ea",r:"#c0392b"},tint:"a",textures:{front:va(["awwrrwwa","aawrrwaa","aaarraaa","aaarraaa","aaarraaa","aaaaaaaa","aaaaaaaa","aaaaaaaa"])},paint:[{region:"torso",color:"a",faces:{front:"front"}},{region:"arms",color:"a"}],parts:[{bone:"body",size:[1.35,1,.28],pos:[-2.92,19.9,-2.44],color:"w"}]})},{price:120,item:Ce({id:"hair.ponytail",slot:"hair",name:"Ponytail",palette:{a:"#3b2a20",b:"#d4537e"},tint:"a",parts:[d0,h0,{bone:"head",size:[.71,3.41,7.27],pos:[4.6,27.86,.36],color:"a",mirror:true},{bone:"head",size:[9.21,4.77,.73],pos:[0,27.18,4.36],color:"a"},{bone:"head",size:[2.27,1.02,1.75],pos:[0,28.55,4.95],color:"b"},{bone:"head",size:[1.84,5.45,1.45],pos:[0,25.82,5.09],color:"a"}]})},{price:120,item:Dt["face.visor"]},{price:100,item:Ce({id:"shoes.hightops",slot:"shoes",name:"High-tops",palette:{a:"#7f77dd",w:"#f4f1ea",b:"#2b2140"},tint:"a",textures:{toe:va(["aaaa","wwww"]),side:va(["aaaaa","wwwww"])},paint:[{region:"feet",color:"a",faces:{front:"toe",back:"toe",left:"side",right:"side",bottom:"w"}}],parts:[{bone:"shinR",size:[4.62,4.32,4.62],pos:[2.1,3.76,0],color:"b",mirror:true}]})},{price:50,item:Ce({id:"hands.gauntlets",slot:"hands",name:"Golden gauntlets",palette:{a:"#e8b730",b:"#b8862a"},tint:"a",paint:[{region:"hands",color:"a"}],parts:[{bone:"foreArmR",size:[4.32,1.75,4.32],pos:[6.3,13.78,0],color:"b",mirror:true}]})},{price:50,item:Ce({id:"waist.pouch",slot:"waist",name:"Belt pouch",palette:{a:"#3a2a22",b:"#7a5233"},tint:"b",parts:[{bone:"body",size:[9.45,1.25,4.97],pos:[0,13.15,0],color:"a"},{bone:"body",size:[2.7,2.5,1.29],pos:[2.93,11.9,-3.04],color:"b"}]})}],en=ir.filter(e=>e.price!==void 0),tn=[...Qo,...en].map(e=>e.item),Ta=Object.fromEntries([...Qo,...en].map(e=>[e.item.id,e.price])),rn=e=>Object.prototype.hasOwnProperty.call(Ta,e);function X(e){let t=It(e);if(!t.ok)throw new Error(`avatar catalog: ${String(e.id)}: ${t.errors.join("; ")}`);return t.item}var Nt=e=>({w:e[0].length,h:e.length,rows:e}),lr={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},cr={bone:"head",size:[9.21,1.7,.73],pos:[0,28.72,-4.36],color:"a"},u0=[X({id:"hair.short",slot:"hair",name:"Short",palette:{a:"#3b2a20"},tint:"a",parts:[lr,cr,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"}]}),X({id:"hair.bob",slot:"hair",name:"Bob",palette:{a:"#3b2a20"},tint:"a",parts:[lr,cr,{bone:"head",size:[1.06,6.13,8.6],pos:[4.78,26.84,.3],color:"a",mirror:true},{bone:"head",size:[9.21,6.14,1.09],pos:[0,26.5,4.55],color:"a"}]}),X({id:"hair.spiky",slot:"hair",name:"Spiky",palette:{a:"#3b2a20"},tint:"a",parts:[lr,cr,{bone:"head",size:[.71,2.73,8.6],pos:[4.6,28.2,0],color:"a",mirror:true},{bone:"head",size:[9.21,2.73,.73],pos:[0,28.2,4.36],color:"a"},{bone:"head",size:[2.13,2.05,2.18],pos:[2.83,31.61,-0.73],color:"a",mirror:true},{bone:"head",size:[2.13,2.73,2.18],pos:[0,31.95,-0.73],color:"a"},{bone:"head",size:[2.13,2.05,2.18],pos:[-1.42,31.61,2.18],color:"a"},{bone:"head",size:[2.13,2.05,2.18],pos:[1.77,31.75,1.82],color:"a"}]}),X({id:"hair.long",slot:"hair",name:"Long",palette:{a:"#3b2a20"},tint:"a",parts:[lr,cr,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"}]}),X({id:"hair.bun",slot:"hair",name:"Bun",palette:{a:"#3b2a20"},tint:"a",parts:[lr,cr,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"}]}),X({id:"hair.curly",slot:"hair",name:"Curly",palette:{a:"#3b2a20"},tint:"a",parts:[{bone:"head",size:[9.92,2.39,9.45],pos:[0,30.08,0],color:"a"},{bone:"head",size:[9.21,1.36,.73],pos:[0,28.89,-4.8],color:"a"},{bone:"head",size:[2.83,2.73,2.91],pos:[3.54,28.89,-2.55],color:"a",mirror:true},{bone:"head",size:[2.83,2.73,2.91],pos:[3.54,28.89,1.82],color:"a",mirror:true},{bone:"head",size:[5.67,2.05,5.82],pos:[0,31.61,0],color:"a"},{bone:"head",size:[4.25,4.27,2.18],pos:[2.13,27.27,4],color:"a",mirror:true}]})],f0=[X({id:"top.idos",slot:"top",name:"iDos Games tee",palette:{a:"#1565ff"},tint:null,paint:[{region:"torso",color:"a"},{region:"sleeves",color:"a"}]}),X({id:"top.tee",slot:"top",name:"Star tee",palette:{a:"#1d9e75",b:"#f4f1ea"},tint:"a",textures:{print:Nt(["aaaaaaaa","aaabbaaa","aabbbbaa","abbbbbba","aabbbbaa","aabaabaa","aaaaaaaa","aaaaaaaa"])},paint:[{region:"torso",color:"a",faces:{front:"print"}},{region:"sleeves",color:"a"}]}),X({id:"top.hoodie",slot:"top",name:"Hoodie",palette:{a:"#378add",b:"#24578f",w:"#f0f0f0"},tint:"a",paint:[{region:"torso",color:"a"},{region:"arms",color:"a"}],parts:[{bone:"body",size:[7.88,4.38,1.84],pos:[0,21.78,3.04],color:"a"},{bone:"body",size:[5.63,2.5,.46],pos:[0,15.52,-2.53],color:"b"},{bone:"body",size:[.56,2.75,.37],pos:[1.24,19.65,-2.48],color:"w",mirror:true}]}),X({id:"top.stripes",slot:"top",name:"Striped sweater",palette:{a:"#d4537e",b:"#f4f1ea"},tint:"a",textures:{st:Nt(["aaaaaaaa","aaaaaaaa","bbbbbbbb","aaaaaaaa","aaaaaaaa","bbbbbbbb","aaaaaaaa","aaaaaaaa"]),sl:Nt(["aaa","bbb","aaa","bbb","aaa"])},paint:[{region:"torso",color:"a",faces:{front:"st",back:"st",left:"st",right:"st"}},{region:"arms",color:"a",faces:{front:"sl",back:"sl",left:"sl",right:"sl"}}]}),X({id:"top.jacket",slot:"top",name:"Jacket",palette:{a:"#444441",b:"#f4f1ea",c:"#c8c2b4"},tint:"a",textures:{open:Nt(["aaabbaaa","aaabbaaa","aaabbaaa","aaabbaaa","aaabbaaa","aacbbcaa","aaabbaaa","aaabbaaa"])},paint:[{region:"torso",color:"a",faces:{front:"open"}},{region:"arms",color:"a"}],parts:[{bone:"body",size:[3.38,1.5,.92],pos:[2.48,22.53,-2.21],color:"a",mirror:true}]}),X({id:"top.tank",slot:"top",name:"Tank top",palette:{a:"#ef9f27"},tint:"a",paint:[{region:"torso",color:"a"}]})],b0=[X({id:"bottom.jeans",slot:"bottom",name:"Jeans",palette:{a:"#2f5fd0"},tint:"a",paint:[{region:"legs",color:"a"}]}),X({id:"bottom.shorts",slot:"bottom",name:"Shorts",palette:{a:"#5f6b7a",s:"@skin"},tint:"a",paint:[{region:"legs",color:"s"}],parts:[{bone:"legR",size:[4.62,5.4,4.62],pos:[2.1,9.7,0],color:"a",mirror:true}]}),X({id:"bottom.skirt",slot:"bottom",name:"Skirt",palette:{a:"#7f77dd",s:"@skin"},tint:"a",paint:[{region:"legs",color:"s"}],parts:[{bone:"body",size:[10.13,4.38,5.52],pos:[0,11.46,0],color:"a"}]}),X({id:"bottom.cargo",slot:"bottom",name:"Cargo pants",palette:{a:"#6b6b4a",b:"#55553a"},tint:"a",paint:[{region:"legs",color:"a"}],parts:[{bone:"legR",size:[.84,4.32,2.52],pos:[4.62,7,0],color:"b",mirror:true}]})],y0=[X({id:"shoes.sneakers",slot:"shoes",name:"Sneakers",palette:{a:"#d84a30",w:"#f4f1ea"},tint:"a",textures:{toe:Nt(["aaaa","wwww"]),side:Nt(["aaaaa","wwwww"])},paint:[{region:"feet",color:"a",faces:{front:"toe",back:"toe",left:"side",right:"side",bottom:"w"}}]}),X({id:"shoes.boots",slot:"shoes",name:"Boots",palette:{a:"#5a3a22",b:"#3a2414"},tint:"a",paint:[{region:"feet",color:"a",faces:{bottom:"b"}}],parts:[{bone:"shinR",size:[4.83,4.32,4.83],pos:[2.1,3.76,0],color:"a",mirror:true}]}),X({id:"shoes.sandals",slot:"shoes",name:"Sandals",palette:{a:"#b0773a",s:"@skin"},tint:"a",paint:[{region:"feet",color:"s"}],parts:[{bone:"shinR",size:[4.51,.48,5.57],pos:[2.1,.24,-0.53],color:"a",mirror:true},{bone:"shinR",size:[4.51,.4,1.05],pos:[2.1,1.12,-1.89],color:"a",mirror:true}]})],g0=[X({id:"hands.gloves",slot:"hands",name:"Gloves",palette:{a:"#2b2140"},tint:"a",paint:[{region:"hands",color:"a"}]})],x0=[X({id:"waist.belt",slot:"waist",name:"Belt",palette:{a:"#5a3a22",g:"#d8b030"},tint:"a",parts:[{bone:"body",size:[9.45,1.25,4.97],pos:[0,13.15,0],color:"a"},{bone:"body",size:[1.8,1.5,.37],pos:[0,13.15,-2.67],color:"g"}]})],w0=[X({id:"back.backpack",slot:"back",name:"Backpack",palette:{a:"#c0612b",b:"#8a3f18"},tint:"a",parts:[{bone:"body",size:[6.75,8.75,2.76],pos:[0,17.4,3.68],color:"a"},{bone:"body",size:[4.5,3.75,.55],pos:[0,14.9,5.34],color:"b"}]}),X({id:"back.cape",slot:"back",name:"Cape",palette:{a:"#a32d2d"},tint:"a",parts:[{bone:"body",size:[10.13,12.5,.55],pos:[0,16.15,2.67],color:"a"}]})],R0=[Dt["face.glasses"],Dt["face.shades"]],k0=[X({id:"hat.beanie",slot:"hat",name:"Beanie",palette:{a:"#534ab7",w:"#f4f1ea"},tint:"a",parts:[{bone:"head",size:[9.92,3.07,9.45],pos:[0,30.76,0],color:"a"},{bone:"head",size:[10.34,1.36,9.89],pos:[0,29.3,0],color:"a"},{bone:"head",size:[2.13,2.05,2.18],pos:[0,33.18,0],color:"w"}]}),X({id:"hat.cap",slot:"hat",name:"Cap",palette:{a:"#c0392b"},tint:"a",parts:[{bone:"head",size:[9.63,2.73,9.16],pos:[0,30.8,.15],color:"a"},{bone:"head",size:[7.79,.55,3.64],pos:[0,29.57,-5.96],color:"a"}]}),X({id:"hat.bucket",slot:"hat",name:"Bucket hat",palette:{a:"#c8b88a"},tint:"a",parts:[{bone:"head",size:[9.63,2.73,9.16],pos:[0,31.61,0],color:"a"},{bone:"head",size:[11.33,.55,10.91],pos:[0,30.39,0],color:"a"}]})],Hr=[...u0,...f0,...b0,...y0,...g0,...x0,...w0,...R0,...k0,...tn.filter(e=>!ir.some(t=>t.item.id===e.id)),...ir.map(e=>e.item)],Q1=Object.fromEntries(Hr.map(e=>[e.id,e]));function A0(e){return Hr.filter(t=>t.slot===e)}function an(e){return A0(e).filter(t=>!rn(t.id))}var S0=["#f9e0cf","#f2c9a0","#e2ad80","#c88d62","#9c6844","#6e4a32"],E0=["#3b2a20","#1d1d21","#f2c14e","#c0612b","#ece6da","#7f77dd","#d4537e","#2ab0a0"],v0=["#3b2a20","#2f5fd0","#1d9e75","#7f77dd","#c0392b","#d8b030"],T0=["#1d9e75","#378add","#d4537e","#444441","#ef9f27","#534ab7","#c0392b","#e8e4da"],nn={version:ft,style:Me,body:{skin:"#f2c9a0",height:1,head:"round"},face:{eyes:"round",eyeColor:"#3b2a20",brows:"soft",browColor:"#3b2a20",mouth:"smile",cheeks:true,marks:"none",emotion:"neutral"},anim:{...et},wear:{hair:"hair.short",top:"top.idos",bottom:"bottom.jeans",shoes:"shoes.sneakers"},tint:{}},on={hair:.92,top:1,bottom:1,shoes:1,hands:.1,waist:.2,back:.2,neck:.15,faceAcc:.25,hat:.35};function am(e=Math.random){let t=n=>n[Math.floor(e()*n.length)],r=t(E0),a={},o={};for(let n of Object.keys(on)){if(e()>=on[n])continue;let s=an(n);s.length&&(a[n]=t(s).id,o[n]=n==="hair"?r:t(T0));}return {version:ft,style:Me,body:{skin:t(S0),height:.95+e()*.1,head:t(ar)},face:{eyes:t(Qt),eyeColor:t(v0),brows:t(er),browColor:r==="#ece6da"||r==="#f2c14e"?"#8a6a3a":r,mouth:t(tr),cheeks:e()<.6,marks:e()<.3?t(rr):"none",emotion:"neutral"},anim:{...et},wear:a,tint:o}}var L0={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}},M0=["hair","top","bottom","shoes"];function C0(e,t){let r=Pt(JSON.parse(JSON.stringify(nn)));for(let a of Object.keys(r.wear))M0.includes(a)||delete r.wear[a];return r.tint={},r.wear[e]=t,r}function lm(e,t){return {key:`item:${e.id}`,make:()=>({spec:C0(e.slot,e.id),items:{...t,[e.id]:e},opts:L0[e.slot]})}}function cm(e={}){let t=e.size??224,r=e.limit??800,a=e.budgetMs??14,o=new Map,n=new Map,s=[],l=null,i=false,c=(d,p)=>{for(o.delete(d),o.set(d,p);o.size>r;){let g=o.keys().next().value;URL.revokeObjectURL(o.get(g)),o.delete(g);}},m=()=>{if(i)return;i=true;let d=globalThis.requestIdleCallback;d?d(h,{timeout:120}):setTimeout(h,16);};function h(){i=false;let d=performance.now();for(;s.length&&performance.now()-d<a;){let p=s.shift(),g=n.get(p);if(g&&(n.delete(p),g.listeners.size!==0))try{l??=Ho({size:t});let{spec:b,items:E,opts:v}=g.make(),M=l.render(b,E,v),R=[...g.listeners];M.toBlob(A=>{if(!A)return;let y=URL.createObjectURL(A);c(p,y);for(let z of R)z(y);},"image/png");}catch{l?.dispose(),l=null;}}s.length&&m();}return {peek:d=>o.get(d)??null,request(d,p){let g=o.get(d.key);if(g)return c(d.key,g),p(g),()=>{};let b=n.get(d.key);b||(b={make:d.make,listeners:new Set},n.set(d.key,b),s.push(d.key)),b.listeners.add(p),m();let E=b;return ()=>E.listeners.delete(p)},release(){l?.dispose(),l=null;}}}var z0="voxel-avatar-v1";function bm(){return {standard:z0,style:Me,version:ft,slots:[...bt],eyes:[...Qt],brows:[...er],mouths:[...tr],emotions:[...Ze],heads:[...ar],marks:[...rr],walks:[...ba],idles:[...ya],height:{min:Zt.min,max:Zt.max},items:[...Hr],shop:{...Ta},rules:{slots:{...ua},limits:{...yt},regions:[...da],regionPairs:Object.fromEntries(Object.entries(ha).map(([e,t])=>[e,[...t]])),faces:[...Ke],skinColor:ut,materials:[...St]}}}var P0=(e,t,r)=>"#"+[e,t,r].map(a=>Math.max(0,Math.min(255,Math.round(a))).toString(16).padStart(2,"0")).join("");function I0(e,t,r){let a=[];for(let o=0;o<r;o++)for(let n=0;n<t;n++){let s=Math.floor(n*e.width/t),l=Math.max(s+1,Math.floor((n+1)*e.width/t)),i=Math.floor(o*e.height/r),c=Math.max(i+1,Math.floor((o+1)*e.height/r)),m=0,h=0,d=0,p=0,g=0;for(let b=i;b<c;b++)for(let E=s;E<l;E++){let v=(b*e.width+E)*4;g++,!((e.data[v+3]??0)<128)&&(m+=e.data[v]??0,h+=e.data[v+1]??0,d+=e.data[v+2]??0,p++);}a.push(p*2<g?null:[m/p,h/p,d/p]);}return a}var mr=(e,t)=>(e[0]-t[0])**2+(e[1]-t[1])**2+(e[2]-t[2])**2;function xm(e,t){let r=yt.textureSide,o=Math.min(1,16/Math.max(e.width,e.height,1)),n=Math.max(1,Math.min(r,Math.round(t.w??e.width*o))),s=Math.max(1,Math.min(r,Math.round(t.h??e.height*o))),l=[...new Set(t.symbols)].slice(0,yt.palette);if(!l.length)throw new Error("pixelTextureFromImage: no palette symbols to use");let i=I0(e,n,s),c=i.filter(b=>!!b),m=new Map;for(let b of c){let E=b.map(M=>Math.round(M/8)).join(","),v=m.get(E);v?v.n++:m.set(E,{n:1,c:b});}let h=[...m.values()].sort((b,E)=>E.n-b.n||(b.c.join()<E.c.join()?-1:1)),d=[];for(let b of h){if(d.length>=l.length)break;d.every(E=>mr(E,b.c)>576)&&d.push([...b.c]);}!d.length&&h[0]&&(d=[[...h[0].c]]);for(let b=0;b<8&&d.length;b++){let E=d.map(()=>[0,0,0,0]);for(let v of c){let M=0;for(let A=1;A<d.length;A++)mr(v,d[A])<mr(v,d[M])&&(M=A);let R=E[M];R[0]+=v[0],R[1]+=v[1],R[2]+=v[2],R[3]+=1;}d=d.map((v,M)=>{let R=E[M];return R[3]?[R[0]/R[3],R[1]/R[3],R[2]/R[3]]:v});}let p={};d.forEach((b,E)=>p[l[E]]=P0(b[0],b[1],b[2]));let g=[];for(let b=0;b<s;b++){let E="";for(let v=0;v<n;v++){let M=i[b*n+v];if(!M||!d.length){E+=".";continue}let R=0;for(let A=1;A<d.length;A++)mr(M,d[A])<mr(M,d[R])&&(R=A);E+=l[R];}g.push(E);}return {texture:{w:n,h:s,rows:g},palette:p}}var _0="ugc.",wm=e=>e.startsWith(_0);exports.ACTION_TIME=ho;exports.ANIM_EVENTS=vl;exports.AVATAR_AUTHOR_ITEM_PREFIX=_0;exports.AVATAR_BASE_COLORS=zo;exports.AVATAR_FACE_RECT=tt;exports.AVATAR_HEADS=ar;exports.AVATAR_HEIGHT=Zt;exports.AVATAR_IDLES=ya;exports.AVATAR_ITEMS=Q1;exports.AVATAR_ITEM_LIMITS=yt;exports.AVATAR_ITEM_LIST=Hr;exports.AVATAR_ITEM_PRINTS=Qi;exports.AVATAR_ITEM_SHOTS=L0;exports.AVATAR_PORTRAIT_BACKGROUND=g1;exports.AVATAR_RIG_ID=kt;exports.AVATAR_SHOP_DEFAULT_PRICES=Ta;exports.AVATAR_SHOP_ITEM_LIST=tn;exports.AVATAR_SLOTS=bt;exports.AVATAR_SPEC_VERSION=ft;exports.AVATAR_STANDARD_ID=z0;exports.AVATAR_STYLE=Me;exports.AVATAR_WALKS=ba;exports.Animator=zr;exports.Art=G;exports.AvatarActor=Dr;exports.BODY_REGIONS=da;exports.BONE_ROLES=q0;exports.BROW_STYLES=er;exports.CH=re;exports.CHANNELS=Sl;exports.CHARACTER_LIMITS=Ba;exports.CHARACTER_SPEC_VERSION=Fa;exports.CLEAR=Xe;exports.CLIPS=Tr;exports.CLOTH_COLORS=T0;exports.CREATURE_KINDS=Xc;exports.CharacterView=Er;exports.DEFAULT_AVATAR=nn;exports.DEFAULT_AVATAR_ANIM=et;exports.DEFAULT_AVATAR_FACE=gi;exports.DEFAULT_AVATAR_HEAD=fa;exports.DEFAULT_CHARACTER_SOURCE=Qr;exports.DEFAULT_COLORS=mn;exports.DEFAULT_FINISH=At;exports.DrawnFace=Ot;exports.EMOTES=Ne;exports.EMOTE_IDS=lc;exports.EMOTIONS=Ze;exports.EMOTION_EVENTS=fc;exports.EVERYDAY_IDS=ic;exports.EXPRESSIONS=Gt;exports.EXPRESSION_CHAIN=zt;exports.EXTRA_BONE_ROLES=br;exports.EYE_COLORS=v0;exports.EYE_STYLES=Qt;exports.FACE_NAMES=Ke;exports.FACE_TEXELS=vo;exports.GESTURE_IDS=sc;exports.HAIR_COLORS=E0;exports.HELD_KINDS=El;exports.HUMAN_BOTTOMS=oo;exports.HUMAN_HAIR=Rl;exports.HUMAN_SHOES=no;exports.HUMAN_TOPS=ao;exports.IDLE_STYLES=qt;exports.LOCOMOTION=ui;exports.MARK_STYLES=rr;exports.MOUTH_STYLES=tr;exports.PART_MATERIALS=St;exports.PART_SHAPES=sl;exports.POSTURE=ca;exports.REGION_PAIRS=ha;exports.REST=Mt;exports.RIGS=Ie;exports.RIG_CLIPS=po;exports.RIG_IDS=Ht;exports.SEAT_HEIGHT_PX=mi;exports.SKIN_COLOR=ut;exports.SKIN_TONES=S0;exports.SLOT_RULES=ua;exports.SOCKETS=Y0;exports.VOXEL_CHARACTER_SYSTEM_PROMPT=Gc;exports.VoxelActor=_r;exports.WALK_STYLES=Ut;exports.acquireCharacter=Xr;exports.add=pe;exports.applyPosture=So;exports.avatarCatalogExport=bm;exports.avatarFromServer=w1;exports.avatarItemShot=lm;exports.avatarItemsForSlot=A0;exports.avatarMannequinWith=C0;exports.avatarPrints=Ra;exports.bandColors=Os;exports.bone=Ct;exports.bonesOf=Ha;exports.characterFromImage=Kl;exports.characterOf=Fl;exports.characterSpecs=Dl;exports.clearPose=pt;exports.composeAvatar=wa;exports.copyPose=kr;exports.createAvatarLighting=Do;exports.createAvatarSnapshotter=Ho;exports.createAvatarThumbQueue=cm;exports.creatureCharacter=Wc;exports.creatureSource=Fi;exports.defaultCharacter=mt;exports.defaultCharacterName=gr;exports.disposeNameplate=ea;exports.drawAvatarFace=ga;exports.emoteLabelOf=cc;exports.emotionFromText=bc;exports.freeAvatarItemsForSlot=an;exports.humanSource=Zr;exports.isAuthorAvatarItem=wm;exports.isAvatarShopItem=rn;exports.isDefaultCharacterName=ll;exports.isEmote=wo;exports.isEmotion=hi;exports.isObj=$;exports.layoutCharacter=$a;exports.lerpPose=io;exports.mirrorBone=Va;exports.nameplate=so;exports.newAnimInput=Ar;exports.normColor=je;exports.npcCharacter=Gl;exports.num=Ae;exports.onCharacterKnown=Nl;exports.parseAvatarSpec=Pt;exports.parseCharacterSpec=Oe;exports.pick=jr;exports.pixelTextureFromImage=xm;exports.randomAvatar=am;exports.recolor=Jr;exports.registerCharacter=Ol;exports.releaseCharacter=wr;exports.renderAvatarCanvas=m0;exports.renderAvatarImage=x1;exports.rigOfSpec=il;exports.sampleEmote=Ro;exports.sampleTrack=pi;exports.setCh=f;exports.specHash=Et;exports.stableStringify=Gr;exports.standardFace=$t;exports.styleParams=aa;exports.validateAvatarItem=It;exports.vec3=yr;
|