@idosgames/characters 0.1.3 → 0.1.5
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/chunk-CMQ6UYQV.js +2 -0
- package/dist/chunk-I7UPBAMR.js +1 -0
- package/dist/chunk-JZU255IQ.js +1 -0
- package/dist/chunk-YOAPVGXE.js +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/rig2d/editor/index.cjs +2 -2
- package/dist/rig2d/editor/index.js +1 -1
- package/dist/rig2d/index.cjs +4 -4
- package/dist/rig2d/index.d.cts +12 -0
- package/dist/rig2d/index.d.ts +12 -0
- package/dist/rig2d/index.js +3 -3
- package/dist/rig2d/phaser/index.cjs +2 -2
- package/dist/rig2d/phaser/index.js +1 -1
- package/dist/voxel/index.cjs +4 -4
- package/dist/voxel/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-BMZA5JIA.js +0 -1
- package/dist/chunk-SDZXML7V.js +0 -1
- package/dist/chunk-WKHHFTK2.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var F=require('phaser');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var F__default=/*#__PURE__*/_interopDefault(F);var R=Math.PI/180,ht=1e-5;function St(l,t){return l.type==="ik"?new O(l,t):new pt(l,t)}var dt=l=>l>180?l-360:l<=-180?l+360:l,O=class{constructor(t,e){this.data=t;this.bones=t.bones.map(o=>e.bones[o.index]),this.target=e.bones[t.target.index],this.mix=t.mix,this.bendDirection=t.bendDirection;}data;mix;bendDirection;bones;target;setupPose(){this.mix=this.data.mix,this.bendDirection=this.data.bendDirection;}sort(t){t.sortBone(this.target);let e=this.bones[0];t.sortBone(e),t.pushConstraint(this),e.sorted=false,t.sortReset(e.children);}update(t){if(this.mix===0)return;let e=this.target.applied;this.bones.length===1?Mt(t,this.bones[0].applied,e.worldX,e.worldY,this.mix):Ot(t,this.bones[0].applied,this.bones[1].applied,e.worldX,e.worldY,this.bendDirection,this.mix);}};function Mt(l,t,e,o,n){let r=t.bone.parent;if(!r)return;t.modifyLocal(l);let s=r.applied,i=s.a,c=s.b,a=s.c,h=s.d,d=-t.shearX-t.rotation,u=i*h-c*a,f=e-s.worldX,m=o-s.worldY,y=(f*h-m*c)/u-t.x,p=(m*i-f*a)/u-t.y;d+=Math.atan2(p,y)/R,t.scaleX<0&&(d+=180),t.rotation+=dt(d)*n;}function Ot(l,t,e,o,n,r,s){t.modifyLocal(l),e.modifyLocal(l);let i=t.x,c=t.y,a=t.scaleX,h=t.scaleY,d=e.scaleX,u,f,m;a<0?(a=-a,u=180,m=-1):(u=0,m=1),h<0&&(h=-h,m=-m),d<0?(d=-d,f=180):f=0;let y=Math.abs(a-h)<=ht,p,g;y?(p=t.a*e.x+t.b*e.y+t.worldX,g=t.c*e.x+t.d*e.y+t.worldY):(e.y=0,p=t.a*e.x+t.worldX,g=t.c*e.x+t.worldY);let v=t.bone.parent;if(!v)return;let b=v.applied,X=b.a,L=b.b,it=b.c,at=b.d,A=X*at-L*it,H=p-b.worldX,W=g-b.worldY;A=Math.abs(A)<=ht?0:1/A;let gt=(H*at-W*L)*A-i,yt=(W*X-H*it)*A-c,x=Math.sqrt(gt*gt+yt*yt),T=e.bone.data.length*d;if(x<ht){Mt(l,t,o,n,s),e.rotation=0;return}H=o-b.worldX,W=n-b.worldY;let G=(H*at-W*L)*A-i,N=(W*X-H*it)*A-c,K=G*G+N*N,P=0,S=0;if(y){T*=a;let k=(K-x*x-T*T)/(2*x*T);k<-1?(k=-1,S=Math.PI*r):k>1?(k=1,S=0):S=Math.acos(k)*r;let B=x+T*k,D=T*Math.sin(S);P=Math.atan2(N*B-G*D,G*B+N*D);}else {let k=a*T,B=h*T,D=k*k,q=B*B,lt=Math.atan2(N,G),w=q*x*x+D*K-D*q,z=-2*q*x,xt=q-D,kt=z*z-4*xt*w,vt=false;if(kt>=0){let M=Math.sqrt(kt);z<0&&(M=-M),M=-(z+M)*.5;let C=M/xt,$=w/M,I=Math.abs(C)<Math.abs($)?C:$,V=K-I*I;if(V>=0){let Y=Math.sqrt(V)*r;P=lt-Math.atan2(Y,I),S=Math.atan2(Y/h,(I-x)/a),vt=true;}}if(!vt){let M=Math.PI,C=x-k,$=C*C,I=0,V=0,Y=x+k,ct=Y*Y,wt=0;if(w=-k*x/(D-q),w>=-1&&w<=1){w=Math.acos(w);let _=k*Math.cos(w)+x,Z=B*Math.sin(w),Q=_*_+Z*Z;Q<$&&(M=w,$=Q,C=_,I=Z),Q>ct&&(V=w,ct=Q,Y=_,wt=Z);}K<=($+ct)*.5?(P=lt-Math.atan2(I*r,C),S=M*r):(P=lt-Math.atan2(wt*r,Y),S=V*r);}}let bt=Math.atan2(e.y,e.x)*m;P=dt((P-bt)/R+u-t.rotation),S=dt(((S+bt)/R-e.shearX)*m+f-e.rotation),t.rotation+=P*s,e.rotation+=S*s;}var pt=class{constructor(t,e){this.data=t;this.source=e.bones[t.source.index],this.bones=t.bones.map(o=>e.bones[o.index]),this.mix={...t.mix};}data;mix;source;bones;setupPose(){Object.assign(this.mix,this.data.mix);}sort(t){t.sortBone(this.source);for(let e of this.bones)t.sortBone(e);t.pushConstraint(this);for(let e of this.bones)t.sortReset(e.children);for(let e of this.bones)e.sorted=true;}update(t){let e=this.mix;if(!e.rotate&&!e.x&&!e.y&&!e.scaleX&&!e.scaleY&&!e.shearY)return;let o=this.source.applied,n=this.data.offsets;for(let r of this.bones){let s=r.applied;s.modifyWorld(t);for(let i of this.data.properties){let c=Et(t,o,i.prop,n)-i.offset;for(let a of i.to){let h=e[a.prop];h!==0&&Ft(t,s,a.prop,a.offset+c*a.scale,h);}}}}};function Et(l,t,e,o){let n=l.scaleX,r=l.scaleY;switch(e){case "rotate":{let s=(t.a*t.d-t.b*t.c)*n*r>0?1:-1,i=Math.atan2(t.c/r,t.a/n)/R+s*o.rotate;return i<0&&(i+=360),i}case "x":return (o.x*t.a+o.y*t.b+t.worldX)/n;case "y":return (o.x*t.c+o.y*t.d+t.worldY)/r;case "scaleX":return Math.hypot(t.a/n,t.c/r)+o.scaleX;case "scaleY":return Math.hypot(t.b/n,t.d/r)+o.scaleY;case "shearY":return (Math.atan2(t.d/r,t.b/n)-Math.atan2(t.c/r,t.a/n))/R-90+o.shearY}}function Ft(l,t,e,o,n){let r=l.scaleX,s=l.scaleY;switch(e){case "rotate":{let i=t.a/r,c=t.b/r,a=t.c/s,h=t.d/s,d=o*R-Math.atan2(a,i);d>Math.PI?d-=2*Math.PI:d<-Math.PI&&(d+=2*Math.PI),d*=n;let u=Math.cos(d),f=Math.sin(d);t.a=(u*i-f*a)*r,t.b=(u*c-f*h)*r,t.c=(f*i+u*a)*s,t.d=(f*c+u*h)*s;return}case "x":t.worldX+=(o-t.worldX/r)*n*r;return;case "y":t.worldY+=(o-t.worldY/s)*n*s;return;case "scaleX":{let i=Math.hypot(t.a/r,t.c/s);i!==0&&(i=1+(o-i)*n/i,t.a*=i,t.c*=i);return}case "scaleY":{let i=Math.hypot(t.b/r,t.d/s);i!==0&&(i=1+(o-i)*n/i,t.b*=i,t.d*=i);return}case "shearY":{let i=t.b/r,c=t.d/s,a=Math.atan2(c,i),h=(o+90)*R;h-=a-Math.atan2(t.c/s,t.a/r),h>Math.PI?h-=2*Math.PI:h<-Math.PI&&(h+=2*Math.PI),h=a+h*n;let d=Math.hypot(i,c);t.b=Math.cos(h)*d*r,t.d=Math.sin(h)*d*s;return}}}var tt=class{constructor(t,e,o=.2){this.skeleton=t;this.data=e;this.defaultMix=o;this.snapshot=new Float32Array(t.bones.length*5),this.slotSnapshot=new Float32Array(t.slots.length*4),this.ikSnapshot=new Float32Array(t.constraints.length);}skeleton;data;defaultMix;track=null;previous=null;mixTime=0;mixDuration=0;listeners=new Map;snapshot;slotSnapshot;ikSnapshot;blink=null;setBlink(t){let e=t?this.data.animations.get(t.animation):void 0;if(!t||!e){this.blink=null;return}let o={bones:new Set(t.bones.map(n=>this.data.bone(n).index)),slots:new Set(t.slots.map(n=>this.data.slot(n).index))};this.blink={source:e,filter:o,options:t,wait:this.nextBlink(t),at:-1};}blinkNow(){this.blink&&(this.blink.at=0);}blinking(){return (this.blink?.at??-1)>=0}setRandom(t){this.random=t;}random=Math.random;nextBlink(t){return t.every[0]+this.random()*(t.every[1]-t.every[0])}names(){return [...this.data.animations.keys()]}has(t){return this.data.animations.has(t)}play(t,e={}){let o=this.data.animations.get(t);if(!o)return false;let n=e.mix??this.defaultMix;return this.previous=this.track&&n>0?this.track:null,this.mixTime=0,this.mixDuration=this.previous?n:0,this.track={animation:o,time:Math.max(0,e.from??0),speed:e.speed??1,loop:e.loop??true,done:false},true}current(){return this.track?.animation.name??null}time(){return this.track?this.local(this.track):0}duration(){return this.track?.animation.duration??0}finished(){return this.track?.done??false}setSpeed(t){this.track&&(this.track.speed=t);}on(t,e){let o=this.listeners.get(t)??new Set;return o.add(e),this.listeners.set(t,o),()=>o.delete(e)}update(t){let e=[],o=this.track;if(o&&!o.done){let n=o.time;o.time+=Math.max(0,t)*o.speed,this.collect(o,n,o.time,e),!o.loop&&o.time>=o.animation.duration&&(o.time=o.animation.duration,o.done=true,e.push({name:"end",animation:o.animation.name}));}if(this.previous){let n=this.previous;n.time+=Math.max(0,t)*n.speed,this.mixTime+=Math.max(0,t),this.mixTime>=this.mixDuration&&(this.previous=null);}this.advanceBlink(Math.max(0,t)),this.pose();for(let n of e){for(let r of this.listeners.get(n.name)??[])r(n);for(let r of this.listeners.get("*")??[])r(n);}}pose(){let t=this.skeleton,e=this.previous;e&&this.mixDuration>0&&(t.setupPose(),e.animation.apply(t,this.local(e)),this.save()),t.setupPose(),this.track&&this.track.animation.apply(t,this.local(this.track)),e&&this.mixDuration>0&&this.blendFromSaved(Math.min(1,this.mixTime/this.mixDuration));let o=this.blink;o&&o.at>=0&&o.source.applyOnly(t,o.options.from+o.at,o.filter),t.resolveAttachments();}advanceBlink(t){let e=this.blink;if(e){if(this.track?.animation.touches(e.filter)){e.at=-1;return}if(e.at>=0){e.at+=t,e.at>=e.options.to-e.options.from&&(e.at=-1,e.wait=this.nextBlink(e.options));return}e.wait-=t,e.wait<=0&&(e.at=0);}}local(t){let e=t.animation.duration;return e<=0?0:t.loop?t.time%e:Math.min(t.time,e)}collect(t,e,o,n){let r=t.animation.duration;if(r<=0||o<=e)return;let s=Math.floor(e/r),i=t.loop?Math.floor(o/r):0;for(let c=s;c<=i;c++)for(let a of t.animation.events){let h=c*r+a.time;h>=e&&(h<o||!t.loop&&h<=o)&&n.push({name:a.name,animation:t.animation.name});}}save(){let t=this.skeleton;t.bones.forEach((e,o)=>{let n=e.pose;this.snapshot.set([n.x,n.y,n.rotation,n.scaleX,n.scaleY],o*5);}),t.slots.forEach((e,o)=>this.slotSnapshot.set([e.color.r,e.color.g,e.color.b,e.color.a],o*4)),t.constraints.forEach((e,o)=>{e instanceof O&&(this.ikSnapshot[o]=e.mix);});}blendFromSaved(t){let e=this.skeleton,o=(n,r)=>n+(r-n)*t;e.bones.forEach((n,r)=>{let s=this.snapshot,i=n.pose,c=r*5;i.x=o(s[c],i.x),i.y=o(s[c+1],i.y);let a=i.rotation-s[c+2];a-=Math.round(a/360)*360,i.rotation=s[c+2]+a*t,i.scaleX=o(s[c+3],i.scaleX),i.scaleY=o(s[c+4],i.scaleY);}),e.slots.forEach((n,r)=>{let s=this.slotSnapshot;n.color.r=o(s[r*4],n.color.r),n.color.g=o(s[r*4+1],n.color.g),n.color.b=o(s[r*4+2],n.color.b),n.color.a=o(s[r*4+3],n.color.a);}),e.constraints.forEach((n,r)=>{n instanceof O&&(n.mix=o(this.ikSnapshot[r],n.mix));});}};var Tt=Math.PI/180,Ht=new Float32Array([0,1,0,0,1,0,1,1]),Wt=new Uint16Array([0,1,2,2,3,0]),At=new WeakMap;function Gt(l){let t=At.get(l);if(t)return t;let e=-l.width/2*l.scaleX,o=-l.height/2*l.scaleY,n=l.width/2*l.scaleX,r=l.height/2*l.scaleY,s=Math.cos(l.rotation*Tt),i=Math.sin(l.rotation*Tt),c=(a,h)=>[a*s-h*i+l.x,a*i+h*s+l.y];return t=Float32Array.from([...c(e,o),...c(e,r),...c(n,r),...c(n,o)]),At.set(l,t),t}function et(l,t,e,o){if(e.type==="region"){let n=o&&o.length===8?o:new Float32Array(8),r=Gt(e),s=t.bone.applied;for(let i=0;i<8;i+=2){let c=r[i],a=r[i+1];n[i]=c*s.a+a*s.b+s.worldX,n[i+1]=c*s.c+a*s.d+s.worldY;}return {positions:n,uvs:Ht,triangles:Wt}}return Nt(l,t,e,o)}function Nt(l,t,e,o){let n=e.vertexCount*2,r=o&&o.length===n?o:new Float32Array(n),s=e.vertices;if(e.weighted){let i=0;for(let c=0;c<n;c+=2){let a=s[i++],h=0,d=0;for(let u=0;u<a;u++,i+=4){let f=l.bones[s[i]].applied,m=s[i+1],y=s[i+2],p=s[i+3];h+=(m*f.a+y*f.b+f.worldX)*p,d+=(m*f.c+y*f.d+f.worldY)*p;}r[c]=h,r[c+1]=d;}}else {let i=t.bone.applied;for(let c=0;c<n;c+=2){let a=s[c],h=s[c+1];r[c]=a*i.a+h*i.b+i.worldX,r[c+1]=a*i.c+h*i.d+i.worldY;}}return {positions:r,uvs:e.uvs,triangles:e.triangles}}function Pt(l){let t=/^#?([0-9a-f]{6})$/i.exec(l.trim());return t?parseInt(t[1],16):16777215}var Dt=new WeakMap;function Ct(l){let t=Dt.get(l);if(t)return t;t=new Map;for(let e of l.skins.values())for(let o of e.attachments.values())for(let n of o.values())t.has(n.path)||t.set(n.path,{w:n.width,h:n.height});return Dt.set(l,t),t}function It(l,t){let e=l.skins.get(t);if(!e)return [];let o=new Set;for(let n of e.attachments.values())for(let r of n.values())o.add(r.path);return [...o]}function Yt(l,t){return !l.skin?.length||l.skin.some(e=>e.toLowerCase()===t.toLowerCase())}var ot=class{constructor(t,e=()=>true){this.rig=t;this.drawable=e;let o=(n,r)=>t.colorTargets.find(s=>(s.into??"tint")===r&&s.slotPrefixes.some(i=>n.startsWith(i)))?.id??null;this.slotTarget=t.data.slots.map(n=>o(n.name,"tint")),this.slotArt=t.data.slots.map(n=>o(n.name,"art")),this.rebuildLists(),this.init();}rig;drawable;chosen=new Map;hidden=new Map;colors=new Map;lists=new Map;listeners=new Set;slotTarget;slotArt;face=null;emotionFace=null;speech="rest";body={};raceSaved=new Map;raceGiven=new Map;setDrawable(t){let e=new Set(this.rig.partTypes.filter(o=>!this.count(o.id)).map(o=>o.id));this.drawable=t,this.rebuildLists();for(let o of this.rig.partTypes){if(o.auto)continue;let n=this.chosen.get(o.id);(n&&!this.lists.get(o.id).includes(n)||!n&&e.has(o.id))&&this.chosen.set(o.id,this.first(o));}this.emit({kind:"part",type:"*",skin:null});}on(t){return this.listeners.add(t),()=>this.listeners.delete(t)}emit(t){for(let e of [...this.listeners])e(t);}typeDef(t){return this.rig.partTypes.find(e=>e.id===t)}list(t){return this.lists.get(t)??[]}count(t){return this.list(t).length}part(t){return this.chosen.get(t)??null}index(t){let e=this.part(t);return e?this.list(t).indexOf(e):-1}isHidden(t){return this.hidden.get(t)??false}isWorn(t){return this.part(t)!==null&&!this.isHidden(t)}color(t){return this.colors.get(t)??null}wornSkins(){let t=new Map;for(let a of this.rig.partTypes)t.set(a.id,!a.auto&&this.isWorn(a.id)?this.part(a.id):null);let e={worn:a=>t.get(a)??null,setWorn:(a,h)=>t.set(a,h),exists:a=>this.rig.data.skins.has(a)&&this.drawable(a),race:()=>this.race(),types:()=>this.rig.partTypes.map(a=>a.id)};for(let a of this.rig.rules)a.apply(e);let o=this.rig.expressions,n=this.face??this.emotionFace,r=n?o?.faces[n]:void 0;for(let[a,h]of Object.entries(r??{}))t.get(a)&&e.exists(h)&&t.set(a,h);let s=this.speech!=="rest"?o?.speech:void 0,i=s?.visemes[this.speech];s&&i&&t.get(s.type)&&e.exists(i)&&t.set(s.type,i);let c=[];for(let a of this.rig.partTypes){let h=t.get(a.id);h&&c.push(h);}return c}slotColor(t){let e=this.slotTarget[t];return e?this.color(e):null}artColor(t){let e=this.slotArt[t];return e?this.color(e):null}bodyLook(){return {...this.body}}race(){return this.rig.races?.get(this.body.race)??null}expression(){return this.face}equip(t,e){let o=this.lists.get(t);if(!o)return;let n;if(e===null||e===-1)n=null;else if(typeof e=="number")n=o[Math.max(0,Math.min(o.length-1,e))]??null;else if(o.includes(e))n=e;else return;n===null&&!this.typeDef(t)?.canHide||(this.chosen.set(t,n),this.emit({kind:"part",type:t,skin:n}));}unequip(t){this.equip(t,null);}setHidden(t,e){this.typeDef(t)?.canHide&&(this.hidden.set(t,e),this.emit({kind:"hidden",type:t,hidden:e}));}next(t){let e=this.count(t);if(!e)return;let o=this.index(t);this.typeDef(t)?.canHide?this.equip(t,o>=e-1?-1:o+1):this.equip(t,(o+1)%e);}prev(t){let e=this.count(t);if(!e)return;let o=this.index(t);this.typeDef(t)?.canHide?this.equip(t,o<=-1?e-1:o-1):this.equip(t,(o-1+e)%e);}setColor(t,e){this.colors.set(t,e),this.emit({kind:"color",target:t,color:e});}setExpression(t){let e=t&&this.rig.expressions?.faces[t]?t:null;e!==this.face&&(this.face=e,this.emit({kind:"expression",name:e}));}setEmotion(t){let e=this.rig.expressions?.emotions?.[t]??null,o=e&&this.rig.expressions?.faces[e]?e:null;o!==this.emotionFace&&(this.emotionFace=o,this.emit({kind:"expression",name:this.face??o}));}setSpeech(t){t!==this.speech&&(this.speech=t,this.emit({kind:"speech",viseme:t}));}setBody(t){let e=this.race();if(this.body={...t},this.body.race!==e?.id){this.dropRaceColors();let o=new Map(this.colors);this.fitRaceColors(false),this.rememberRaceColors(o);}this.emit({kind:"body",body:this.bodyLook()});}setRace(t){let e={...this.body};t?e.race=t:delete e.race,this.setBody(e);}randomize(t=Math.random){for(let e of this.rig.partTypes){if(e.auto)continue;let o=this.count(e.id);o&&this.equip(e.id,e.canHide&&t()<.3?-1:Math.floor(t()*o));}}reset(){this.init();for(let t of this.rig.partTypes)this.emit({kind:"part",type:t.id,skin:this.part(t.id)});}toLook(){let t={};for(let n of this.rig.partTypes)n.auto||(t[n.id]=this.isWorn(n.id)?this.part(n.id):null);let e={};for(let[n,r]of this.colors)r&&(e[n]=r);let o=this.bodyLook();return {v:2,parts:t,colors:e,...Object.keys(o).length?{body:o}:{}}}applyLook(t){let e=this.race(),o=!!t.body&&t.body.race!==e?.id;o&&this.dropRaceColors();let n=new Map(this.colors);for(let[r,s]of Object.entries(t.parts??{}))s===void 0||this.typeDef(r)?.auto||(this.equip(r,s),s!==null&&this.part(r)===s&&this.hidden.set(r,false));for(let[r,s]of Object.entries(t.colors??{}))s&&this.setColor(r,s);t.body&&(this.body={...this.body,...t.body},o&&(this.fitRaceColors(true,t),this.rememberRaceColors(n)),this.emit({kind:"body",body:this.bodyLook()}));}dropRaceColors(){for(let[t,e]of this.raceGiven)this.color(t)?.toLowerCase()===e.toLowerCase()&&this.setColor(t,this.raceSaved.get(t)??null);this.raceGiven.clear(),this.raceSaved.clear();}rememberRaceColors(t){let e=this.race();if(!e)return;let o=new Set(Object.keys(e.colors??{}));e.skin?.length&&o.add(this.rig.skinColor??"Skin");for(let n of o){let r=this.color(n);!r||r===(t.get(n)??null)||(this.raceSaved.set(n,t.get(n)??null),this.raceGiven.set(n,r));}}fitRaceColors(t,e){let o=this.race();if(!o)return;for(let[i,c]of Object.entries(o.colors??{}))(t?e?.colors?.[i]:this.color(i))||this.setColor(i,c);let n=this.rig.skinColor??"Skin",r=this.color(n),s=t?e?.colors?.[n]??r:r;o.skin?.length&&(!s||!Yt(o,s))&&this.setColor(n,o.skin[0]);}rebuildLists(){for(let t of this.rig.partTypes)this.lists.set(t.id,this.rig.data.skinOrder.filter(e=>e.startsWith(t.skinPrefix)&&this.drawable(e)));}first(t){return this.lists.get(t.id)?.[0]??null}init(){this.chosen.clear(),this.hidden.clear(),this.colors.clear(),this.body={},this.raceSaved.clear(),this.raceGiven.clear();for(let t of this.rig.partTypes)this.chosen.set(t.id,t.auto?null:this.first(t));}};var U=Math.PI/180,ut=1e-5,nt=class{constructor(t){this.bone=t;}bone;x=0;y=0;rotation=0;scaleX=1;scaleY=1;shearX=0;shearY=0;a=1;b=0;c=0;d=1;worldX=0;worldY=0;world=0;local=0;copyLocal(t){this.x=t.x,this.y=t.y,this.rotation=t.rotation,this.scaleX=t.scaleX,this.scaleY=t.scaleY,this.shearX=t.shearX,this.shearY=t.shearY;}update(t){this.world!==t.updateId&&this.updateWorldTransform(t);}updateWorldTransform(t){this.local===t.updateId?this.updateLocalTransform(t):this.world=t.updateId;let e=(this.rotation+this.shearX)*U,o=(this.rotation+90+this.shearY)*U,n=Math.cos(e)*this.scaleX,r=Math.cos(o)*this.scaleY,s=Math.sin(e)*this.scaleX,i=Math.sin(o)*this.scaleY,c=this.bone.parent;if(!c){let h=t.scaleX,d=t.scaleY;this.a=n*h,this.b=r*h,this.c=s*d,this.d=i*d,this.worldX=this.x*h+t.x,this.worldY=this.y*d+t.y;return}let a=c.applied;this.worldX=a.a*this.x+a.b*this.y+a.worldX,this.worldY=a.c*this.x+a.d*this.y+a.worldY,this.a=a.a*n+a.b*s,this.b=a.a*r+a.b*i,this.c=a.c*n+a.d*s,this.d=a.c*r+a.d*i;}updateLocalTransform(t){this.local=0,this.world=t.updateId;let e=this.bone.parent;if(!e){this.x=(this.worldX-t.x)/t.scaleX,this.y=(this.worldY-t.y)/t.scaleY,this.set5(this.a/t.scaleX,this.b/t.scaleX,this.c/t.scaleY,this.d/t.scaleY);return}let o=e.applied,n=1/(o.a*o.d-o.b*o.c),r=o.d*n,s=o.b*n,i=o.c*n,c=o.a*n,a=this.worldX-o.worldX,h=this.worldY-o.worldY;this.x=a*r-h*s,this.y=h*c-a*i,this.set5(r*this.a-s*this.c,r*this.b-s*this.d,c*this.c-i*this.a,c*this.d-i*this.b);}set5(t,e,o,n){this.shearX=0;let r=t*t+o*o,s=e*e+n*n;if(r>ut){let i=Math.atan2(o,t)/U;this.rotation=i,this.scaleX=Math.sqrt(r),this.scaleY=Math.sqrt(s),s>ut?(this.shearY=Math.atan2(n,e)/U,t*n-e*o<0?(this.scaleY=-this.scaleY,this.shearY+=90-i):this.shearY-=90+i,this.shearY>180?this.shearY-=360:this.shearY<=-180&&(this.shearY+=360)):this.shearY=0;}else this.scaleX=0,this.scaleY=Math.sqrt(s),this.shearY=0,this.rotation=s>ut?Math.atan2(n,e)/U-90:0;}modifyLocal(t){this.local===t.updateId&&this.updateLocalTransform(t),this.world=0,this.resetWorld(t);}modifyWorld(t){this.local=t.updateId,this.world=t.updateId,this.resetWorld(t);}resetWorld(t){for(let e of this.bone.children){let o=e.applied;o.world===t.updateId&&(o.local===t.updateId&&o.updateLocalTransform(t),o.world=0,o.resetWorld(t));}}},rt=class{constructor(t){this.data=t;this.pose=new nt(this),this.applied=new nt(this),this.setupPose();}data;pose;applied;parent=null;children=[];sorted=false;setupPose(){let t=this.data,e=this.pose;e.x=t.x,e.y=t.y,e.rotation=t.rotation,e.scaleX=t.scaleX,e.scaleY=t.scaleY,e.shearX=0,e.shearY=0;}},ft=class{constructor(t,e){this.data=t;this.bone=e;this.color={...t.color},this.attachmentKey=t.attachment;}data;bone;color;attachmentKey;attachment=null},E=class{constructor(t){this.data=t;this.bones=t.bones.map(e=>new rt(e));for(let e of this.bones)e.data.parent&&(e.parent=this.bones[e.data.parent.index],e.parent.children.push(e));this.slots=t.slots.map(e=>new ft(e,this.bones[e.bone.index])),this.constraints=t.constraints.map(e=>St(e,this)),this.updateCache();}data;bones;slots;constraints;skins=[];scaleX=1;scaleY=1;x=0;y=0;updateId=0;cache=[];bone(t){return this.bones[this.data.bone(t).index]}slot(t){return this.slots[this.data.slot(t).index]}setSkins(t){this.skins=[...t],this.resolveAttachments();}getAttachment(t,e){for(let o=this.skins.length-1;o>=0;o--){let n=this.skins[o].attachments.get(t)?.get(e);if(n)return n}return null}resolveAttachments(){for(let t of this.slots)t.attachment=t.attachmentKey?this.getAttachment(t.data.index,t.attachmentKey):null;}setupPose(){for(let t of this.bones)t.setupPose();for(let t of this.constraints)t.setupPose();for(let t of this.slots)Object.assign(t.color,t.data.color),t.attachmentKey=t.data.attachment;}updateWorldTransform(){this.updateId++;for(let t of this.bones)t.applied.copyLocal(t.pose),t.applied.world=0,t.applied.local=0;for(let t of this.cache)t instanceof rt?t.applied.update(this):t.update(this);}updateCache(){this.cache=[];for(let t of this.bones)t.sorted=false;for(let t of this.constraints)t.sort(this);for(let t of this.bones)this.sortBone(t);}sortBone(t){t.sorted||(t.parent&&this.sortBone(t.parent),t.sorted=true,this.cache.push(t));}sortReset(t){for(let e of t)e.sorted&&this.sortReset(e.children),e.sorted=false;}pushConstraint(t){this.cache.push(t);}};var Rt=new WeakMap;function Xt(l,t){let e=Rt.get(l);if(e)return e;e=new Map;let o=new E(l);o.setupPose(),o.updateWorldTransform();let[n,r]=t.light;for(let s of l.skins.values())for(let[i,c]of s.attachments)for(let a of c.values()){if(e.has(a.path)||t.skip?.some(p=>a.path.startsWith(p)))continue;let h=et(o,o.slots[i],a,null),d=qt(h.positions,h.uvs,a.width,a.height);if(!d)continue;let u=d.a*d.d-d.b*d.c;if(Math.abs(u)<1e-9)continue;let f=(d.d*n-d.b*r)/u,m=(-d.c*n+d.a*r)/u,y=Math.hypot(f,m)||1;e.set(a.path,{x:f/y,y:m/y});}return Rt.set(l,e),e}function qt(l,t,e,o){let n=t.length/2;if(n<3)return null;let r=0,s=0,i=0,c=0;for(let g=0;g<n;g++)r+=t[g*2]*e,s+=t[g*2+1]*o,i+=l[g*2],c+=l[g*2+1];r/=n,s/=n,i/=n,c/=n;let a=0,h=0,d=0,u=0,f=0,m=0,y=0;for(let g=0;g<n;g++){let v=t[g*2]*e-r,b=t[g*2+1]*o-s,X=l[g*2]-i,L=l[g*2+1]-c;a+=v*v,h+=v*b,d+=b*b,u+=X*v,f+=X*b,m+=L*v,y+=L*b;}let p=a*d-h*h;return Math.abs(p)<1e-9?null:{a:(u*d-f*h)/p,b:(f*a-u*h)/p,c:(m*d-y*h)/p,d:(y*a-m*h)/p}}var j=class{constructor(t,e){this.scene=t;let o=this.rig=e.rig;this.art=e.art,this.skeleton=new E(o.data),this.sizes=Ct(o.data),this.lights=o.shading?Xt(o.data,o.shading):new Map,this.parts=new ot(o,n=>this.drawsSkin(n)),e.look&&this.parts.applyLook(e.look),this.offs.push(this.parts.on(()=>this.skinsDirty=true)),this.animator=new tt(this.skeleton,o.data,o.mix),this.animator.setBlink(o.blink??null),this.play(e.animation??o.defaultAnimation,{mix:0}),this.root=t.add.container(e.x??0,e.y??0);for(let n=0;n<this.skeleton.slots.length;n++){let r=new F__default.default.GameObjects.Mesh2D(t,0,0,"__DEFAULT",[],[],true);r.setRenderAsTriangles(true),r.setVisible(false),this.root.add(r),this.slots.push({mesh:r,positions:null,vertices:[],indices:[],path:null,key:null,paint:null,waiting:false});}if(this.setScale(e.scale??1),e.autoUpdate!==false){let n=(r,s)=>this.update(s/1e3);t.events.on(F__default.default.Scenes.Events.UPDATE,n),this.offs.push(()=>t.events.off(F__default.default.Scenes.Events.UPDATE,n));}this.root.once(F__default.default.GameObjects.Events.DESTROY,()=>{for(let n of this.offs.splice(0))n();}),this.update(0);}scene;root;skeleton;animator;parts;slots=[];sizes;lights;skinsDirty=true;overlay=null;flashUntil=0;flashColor=16777215;facing=1;size=1;offs=[];asked=null;rig;art;play(t,e){return this.asked={name:t,...e?{options:e}:{}},this.animator.play(this.stanceOf(t),e)}animation(){return this.asked?.name??null}stanceOf(t){let e=this.parts;return this.rig.stance?.(t,o=>e.isWorn(o)?e.part(o):null)??t}on(t,e){let o=this.animator.on(t,e);return this.offs.push(o),o}setLook(t){this.parts.applyLook(t);}setArt(t){this.art=t;for(let e of this.slots)e.key=e.path=null,e.waiting=false;this.parts.setDrawable(e=>this.drawsSkin(e));}setPosition(t,e){return this.root.setPosition(t,e),this}setScale(t){return this.size=t,this.root.setScale(t*this.facing,t),this}setFacing(t){return this.facing=t,this.setScale(this.size)}setDepth(t){return this.root.setDepth(t),this}setVisible(t){return this.root.setVisible(t),this}setAlpha(t){return this.root.setAlpha(t),this}setOverlay(t){return this.overlay=t,this}flash(t=16777215,e=90){this.flashColor=t,this.flashUntil=this.scene.time.now+e;}worldPoint(t){let e=this.rig.anchors[t]??t,o=this.skeleton.bone(e).applied,n=this.root.getWorldTransformMatrix();return {x:n.tx+n.a*o.worldX+n.c*-o.worldY,y:n.ty+n.b*o.worldX+n.d*-o.worldY}}get displayHeight(){return this.rig.data.height*this.size}destroy(){this.root.destroy();}update(t){let e=this.skeleton,o=this.rig.expressions;if(o&&this.parts.setExpression(o.byAnimation[this.animator.current()??""]??null),this.skinsDirty){this.skinsDirty=false,e.setSkins(this.parts.wornSkins().flatMap(s=>{let i=this.rig.data.skins.get(s);return i?[i]:[]}));let r=this.asked;r&&this.stanceOf(r.name)!==this.animator.current()&&this.animator.play(this.stanceOf(r.name),{...r.options,mix:.15});}this.animator.update(t),e.slots.forEach((r,s)=>{let i=this.parts.slotColor(s);if(!i)return;let c=Pt(i);r.color.r=(c>>16&255)/255,r.color.g=(c>>8&255)/255,r.color.b=(c&255)/255,r.color.a=1;}),e.updateWorldTransform();let n=this.flashUntil>this.scene.time.now;e.slots.forEach((r,s)=>this.drawSlot(s,n));}drawSlot(t,e){let o=this.slots[t],n=this.skeleton.slots[t],r=n.attachment,s=o.mesh;if(!r||n.color.a<=0){s.setVisible(false);return}let i=this.parts.artColor(t);if((o.path!==r.path||o.paint!==i)&&(o.path=r.path,o.paint=i,o.key=null,o.waiting=false),!o.key&&!o.waiting){let p=this.sizes.get(r.path)??{w:r.width,h:r.height},g=r.path,v=this.art.texture(g,p,()=>{o.path===g&&(o.waiting=false);},{paint:i,light:this.lights.get(g)??null});v?(o.key=v,s.setTexture(v)):o.waiting=true;}if(!o.key){s.setVisible(false);return}let c=et(this.skeleton,n,r,o.positions);o.positions=c.positions;let a=c.uvs.length/2,h=o.vertices;h.length=a*4;for(let p=0;p<a;p++)h[p*4]=c.positions[p*2],h[p*4+1]=-c.positions[p*2+1],h[p*4+2]=c.uvs[p*2],h[p*4+3]=c.uvs[p*2+1];let d=c.triangles,u=o.indices;if(u.length!==d.length/3*4){u.length=0;for(let p=0;p<d.length;p+=3)u.push(d[p],d[p+1],d[p+2],0);}else for(let p=0,g=0;p<d.length;p+=3,g+=4)u[g]=d[p],u[g+1]=d[p+1],u[g+2]=d[p+2];s.vertices=h,s.indices=u;let f=n.color,m=r.color,y=Math.round(f.r*m.r*255)<<16|Math.round(f.g*m.g*255)<<8|Math.round(f.b*m.b*255);this.overlay!==null&&(y=Vt(y,this.overlay)),e?s.setTint(this.flashColor).setTintMode(F__default.default.TintModes.FILL):s.setTint(y).setTintMode(F__default.default.TintModes.MULTIPLY),s.setAlpha(f.a*m.a),s.setVisible(true);}drawsSkin(t){return It(this.rig.data,t).every(e=>this.art.has(e))}};function Vt(l,t){let e=o=>Math.round((l>>o&255)*(t>>o&255)/255)<<o;return e(16)|e(8)|e(0)}function Lt(l,t,e=1,o={}){let n=Math.max(1,Math.ceil(t.w*e)),r=Math.max(1,Math.ceil(t.h*e)),s=o.paint??l.paint,i=o.light?Ut(t,o.light):"";return `<svg xmlns="http://www.w3.org/2000/svg" width="${n}" height="${r}" viewBox="0 0 ${t.w} ${t.h}"${s?` color="${s}"`:""}>${i}<g stroke-linejoin="round" stroke-linecap="round"${i?' filter="url(#cel)"':""}>${l.svg}</g></svg>`}var J={depth:.18,min:2.6,max:11,dark:.3,shine:.36};function Ut(l,t){let e=Math.max(J.min,Math.min(J.max,Math.min(l.w,l.h)*J.depth)),o=n=>+n.toFixed(2);return `<defs><filter id="cel" filterUnits="userSpaceOnUse" x="0" y="0" width="${l.w}" height="${l.h}" color-interpolation-filters="sRGB"><feMorphology in="SourceAlpha" operator="erode" radius="${o(3.6*.7)}" result="body"/><feOffset in="body" dx="${o(t.x*e)}" dy="${o(t.y*e)}" result="moved"/><feComposite in="body" in2="moved" operator="out" result="far"/><feFlood flood-color="#000000" flood-opacity="${J.dark}"/><feComposite in2="far" operator="in" result="dark"/><feMorphology in="SourceAlpha" operator="erode" radius="${o(3.6*1.05)}" result="inner"/><feOffset in="inner" dx="${o(-t.x*e*.42)}" dy="${o(-t.y*e*.42)}" result="back"/><feComposite in="inner" in2="back" operator="out" result="near"/><feFlood flood-color="#ffffff" flood-opacity="${J.shine}"/><feComposite in2="near" operator="in" result="shine"/><feMerge><feMergeNode in="SourceGraphic"/><feMergeNode in="dark"/><feMergeNode in="shine"/></feMerge></filter></defs>`}var Bt=new WeakMap;function jt(l,t,e){return `chr:${l}@${t}${e||""}`}function $t(l,t,e,o,n,r,s={}){let i=e.paint?s.paint??null:null,c=jt(t,n,i);if(l.exists(c))return c;let a=Bt.get(l);a||Bt.set(l,a=new Map);let h=a.get(c);if(h)return h.push(r),null;let d=[r];a.set(c,d);let u=new Image,f=()=>{a.delete(c);for(let m of d)m();};return u.onload=()=>{l.exists(c)||l.addImage(c,u),f();},u.onerror=()=>{console.warn(`[character] art ${t} did not render`),f();},u.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(Lt(e,o,n,{paint:i,light:s.light??null})),null}function mt(l,t,e=2){return {has:o=>t.has(o),texture(o,n,r,s){let i=t.get(o);return i?$t(l,o,i,n,e,r,s):null}}}function Jt(l,t){return new Promise(e=>{let{width:o,height:n}=t,r=Math.min(2,Math.max(1,typeof devicePixelRatio=="number"&&devicePixelRatio||1));class s extends F__default.default.Scene{create(){this.cameras.main.setOrigin(0,0).setZoom(r);let a=t.scale??1,h=mt(this.textures,t.catalog,Math.max(2,Math.ceil(a*r*1.5))),d=new j(this,{rig:t.rig,art:h,...t.look?{look:t.look}:{},x:o/2,y:Math.round(n*.88),scale:a});e({view:d,game:i,vector:h,destroy:()=>i.destroy(true)});}}let i=new F__default.default.Game({type:F__default.default.WEBGL,parent:l,width:Math.ceil(o*r),height:Math.ceil(n*r),scale:{mode:F__default.default.Scale.NONE,zoom:1/r},render:{autoMobileTextures:false},transparent:!t.background,...t.background?{backgroundColor:t.background}:{},scene:s,banner:false,audio:{noAudio:true}});})}
|
|
2
|
-
exports.CharacterView=j;exports.createCharacterStage=
|
|
1
|
+
'use strict';var F=require('phaser');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var F__default=/*#__PURE__*/_interopDefault(F);var Y=Math.PI/180,fe=1e-5;function Me(i,e){return i.type==="ik"?new E(i,e):new le(i,e)}var be=i=>i>180?i-360:i<=-180?i+360:i,E=class{constructor(e,t){this.data=e;this.bones=e.bones.map(a=>t.bones[a.index]),this.target=t.bones[e.target.index],this.mix=e.mix,this.bendDirection=e.bendDirection;}data;mix;bendDirection;bones;target;setupPose(){this.mix=this.data.mix,this.bendDirection=this.data.bendDirection;}sort(e){e.sortBone(this.target);let t=this.bones[0];e.sortBone(t),e.pushConstraint(this),t.sorted=false,e.sortReset(t.children);}update(e){if(this.mix===0)return;let t=this.target.applied;this.bones.length===1?Te(e,this.bones[0].applied,t.worldX,t.worldY,this.mix):Ge(e,this.bones[0].applied,this.bones[1].applied,t.worldX,t.worldY,this.bendDirection,this.mix);}};function Te(i,e,t,a,o){let n=e.bone.parent;if(!n)return;e.modifyLocal(i);let r=n.applied,s=r.a,d=r.b,c=r.c,f=r.d,b=-e.shearX-e.rotation,h=s*f-d*c,p=t-r.worldX,m=a-r.worldY,g=(p*f-m*d)/h-e.x,l=(m*s-p*c)/h-e.y;b+=Math.atan2(l,g)/Y,e.scaleX<0&&(b+=180),e.rotation+=be(b)*o;}function Ge(i,e,t,a,o,n,r){e.modifyLocal(i),t.modifyLocal(i);let s=e.x,d=e.y,c=e.scaleX,f=e.scaleY,b=t.scaleX,h,p,m;c<0?(c=-c,h=180,m=-1):(h=0,m=1),f<0&&(f=-f,m=-m),b<0?(b=-b,p=180):p=0;let g=Math.abs(c-f)<=fe,l,u;g?(l=e.a*t.x+e.b*t.y+e.worldX,u=e.c*t.x+e.d*t.y+e.worldY):(t.y=0,l=e.a*t.x+e.worldX,u=e.c*t.x+e.worldY);let w=e.bone.parent;if(!w)return;let y=w.applied,B=y.a,L=y.b,se=y.c,ce=y.d,A=B*ce-L*se,H=l-y.worldX,W=u-y.worldY;A=Math.abs(A)<=fe?0:1/A;let ge=(H*ce-W*L)*A-s,ye=(W*B-H*se)*A-d,x=Math.sqrt(ge*ge+ye*ye),T=t.bone.data.length*b;if(x<fe){Te(i,e,a,o,r),t.rotation=0;return}H=a-y.worldX,W=o-y.worldY;let G=(H*ce-W*L)*A-s,N=(W*B-H*se)*A-d,K=G*G+N*N,P=0,S=0;if(g){T*=c;let k=(K-x*x-T*T)/(2*x*T);k<-1?(k=-1,S=Math.PI*n):k>1?(k=1,S=0):S=Math.acos(k)*n;let X=x+T*k,D=T*Math.sin(S);P=Math.atan2(N*X-G*D,G*X+N*D);}else {let k=c*T,X=f*T,D=k*k,q=X*X,ie=Math.atan2(N,G),v=q*x*x+D*K-D*q,J=-2*q*x,ke=q-D,we=J*J-4*ke*v,ve=false;if(we>=0){let M=Math.sqrt(we);J<0&&(M=-M),M=-(J+M)*.5;let I=M/ke,$=v/M,C=Math.abs(I)<Math.abs($)?I:$,V=K-C*C;if(V>=0){let R=Math.sqrt(V)*n;P=ie-Math.atan2(R,C),S=Math.atan2(R/f,(C-x)/c),ve=true;}}if(!ve){let M=Math.PI,I=x-k,$=I*I,C=0,V=0,R=x+k,de=R*R,Se=0;if(v=-k*x/(D-q),v>=-1&&v<=1){v=Math.acos(v);let z=k*Math.cos(v)+x,Z=X*Math.sin(v),Q=z*z+Z*Z;Q<$&&(M=v,$=Q,I=z,C=Z),Q>de&&(V=v,de=Q,R=z,Se=Z);}K<=($+de)*.5?(P=ie-Math.atan2(C*n,I),S=M*n):(P=ie-Math.atan2(Se*n,R),S=V*n);}}let xe=Math.atan2(t.y,t.x)*m;P=be((P-xe)/Y+h-e.rotation),S=be(((S+xe)/Y-t.shearX)*m+p-t.rotation),e.rotation+=P*r,t.rotation+=S*r;}var le=class{constructor(e,t){this.data=e;this.source=t.bones[e.source.index],this.bones=e.bones.map(a=>t.bones[a.index]),this.mix={...e.mix};}data;mix;source;bones;setupPose(){Object.assign(this.mix,this.data.mix);}sort(e){e.sortBone(this.source);for(let t of this.bones)e.sortBone(t);e.pushConstraint(this);for(let t of this.bones)e.sortReset(t.children);for(let t of this.bones)t.sorted=true;}update(e){let t=this.mix;if(!t.rotate&&!t.x&&!t.y&&!t.scaleX&&!t.scaleY&&!t.shearY)return;let a=this.source.applied,o=this.data.offsets;for(let n of this.bones){let r=n.applied;r.modifyWorld(e);for(let s of this.data.properties){let d=Ne(e,a,s.prop,o)-s.offset;for(let c of s.to){let f=t[c.prop];f!==0&&qe(e,r,c.prop,c.offset+d*c.scale,f);}}}}};function Ne(i,e,t,a){let o=i.scaleX,n=i.scaleY;switch(t){case "rotate":{let r=(e.a*e.d-e.b*e.c)*o*n>0?1:-1,s=Math.atan2(e.c/n,e.a/o)/Y+r*a.rotate;return s<0&&(s+=360),s}case "x":return (a.x*e.a+a.y*e.b+e.worldX)/o;case "y":return (a.x*e.c+a.y*e.d+e.worldY)/n;case "scaleX":return Math.hypot(e.a/o,e.c/n)+a.scaleX;case "scaleY":return Math.hypot(e.b/o,e.d/n)+a.scaleY;case "shearY":return (Math.atan2(e.d/n,e.b/o)-Math.atan2(e.c/n,e.a/o))/Y-90+a.shearY}}function qe(i,e,t,a,o){let n=i.scaleX,r=i.scaleY;switch(t){case "rotate":{let s=e.a/n,d=e.b/n,c=e.c/r,f=e.d/r,b=a*Y-Math.atan2(c,s);b>Math.PI?b-=2*Math.PI:b<-Math.PI&&(b+=2*Math.PI),b*=o;let h=Math.cos(b),p=Math.sin(b);e.a=(h*s-p*c)*n,e.b=(h*d-p*f)*n,e.c=(p*s+h*c)*r,e.d=(p*d+h*f)*r;return}case "x":e.worldX+=(a-e.worldX/n)*o*n;return;case "y":e.worldY+=(a-e.worldY/r)*o*r;return;case "scaleX":{let s=Math.hypot(e.a/n,e.c/r);s!==0&&(s=1+(a-s)*o/s,e.a*=s,e.c*=s);return}case "scaleY":{let s=Math.hypot(e.b/n,e.d/r);s!==0&&(s=1+(a-s)*o/s,e.b*=s,e.d*=s);return}case "shearY":{let s=e.b/n,d=e.d/r,c=Math.atan2(d,s),f=(a+90)*Y;f-=c-Math.atan2(e.c/r,e.a/n),f>Math.PI?f-=2*Math.PI:f<-Math.PI&&(f+=2*Math.PI),f=c+f*o;let b=Math.hypot(s,d);e.b=Math.cos(f)*b*n,e.d=Math.sin(f)*b*r;return}}}var ee=class{constructor(e,t,a=.2){this.skeleton=e;this.data=t;this.defaultMix=a;this.snapshot=new Float32Array(e.bones.length*5),this.slotSnapshot=new Float32Array(e.slots.length*4),this.ikSnapshot=new Float32Array(e.constraints.length);}skeleton;data;defaultMix;track=null;previous=null;mixTime=0;mixDuration=0;listeners=new Map;snapshot;slotSnapshot;ikSnapshot;blink=null;setBlink(e){let t=e?this.data.animations.get(e.animation):void 0;if(!e||!t){this.blink=null;return}let a={bones:new Set(e.bones.map(o=>this.data.bone(o).index)),slots:new Set(e.slots.map(o=>this.data.slot(o).index))};this.blink={source:t,filter:a,options:e,wait:this.nextBlink(e),at:-1};}blinkNow(){this.blink&&(this.blink.at=0);}blinking(){return (this.blink?.at??-1)>=0}setRandom(e){this.random=e;}random=Math.random;nextBlink(e){return e.every[0]+this.random()*(e.every[1]-e.every[0])}names(){return [...this.data.animations.keys()]}has(e){return this.data.animations.has(e)}play(e,t={}){let a=this.data.animations.get(e);if(!a)return false;let o=t.mix??this.defaultMix;return this.previous=this.track&&o>0?this.track:null,this.mixTime=0,this.mixDuration=this.previous?o:0,this.track={animation:a,time:Math.max(0,t.from??0),speed:t.speed??1,loop:t.loop??true,done:false},true}current(){return this.track?.animation.name??null}time(){return this.track?this.local(this.track):0}duration(){return this.track?.animation.duration??0}finished(){return this.track?.done??false}setSpeed(e){this.track&&(this.track.speed=e);}on(e,t){let a=this.listeners.get(e)??new Set;return a.add(t),this.listeners.set(e,a),()=>a.delete(t)}update(e){let t=[],a=this.track;if(a&&!a.done){let o=a.time;a.time+=Math.max(0,e)*a.speed,this.collect(a,o,a.time,t),!a.loop&&a.time>=a.animation.duration&&(a.time=a.animation.duration,a.done=true,t.push({name:"end",animation:a.animation.name}));}if(this.previous){let o=this.previous;o.time+=Math.max(0,e)*o.speed,this.mixTime+=Math.max(0,e),this.mixTime>=this.mixDuration&&(this.previous=null);}this.advanceBlink(Math.max(0,e)),this.pose();for(let o of t){for(let n of this.listeners.get(o.name)??[])n(o);for(let n of this.listeners.get("*")??[])n(o);}}pose(){let e=this.skeleton,t=this.previous;t&&this.mixDuration>0&&(e.setupPose(),t.animation.apply(e,this.local(t)),this.save()),e.setupPose(),this.track&&this.track.animation.apply(e,this.local(this.track)),t&&this.mixDuration>0&&this.blendFromSaved(Math.min(1,this.mixTime/this.mixDuration));let a=this.blink;a&&a.at>=0&&a.source.applyOnly(e,a.options.from+a.at,a.filter),e.resolveAttachments();}advanceBlink(e){let t=this.blink;if(t){if(this.track?.animation.touches(t.filter)){t.at=-1;return}if(t.at>=0){t.at+=e,t.at>=t.options.to-t.options.from&&(t.at=-1,t.wait=this.nextBlink(t.options));return}t.wait-=e,t.wait<=0&&(t.at=0);}}local(e){let t=e.animation.duration;return t<=0?0:e.loop?e.time%t:Math.min(e.time,t)}collect(e,t,a,o){let n=e.animation.duration;if(n<=0||a<=t)return;let r=Math.floor(t/n),s=e.loop?Math.floor(a/n):0;for(let d=r;d<=s;d++)for(let c of e.animation.events){let f=d*n+c.time;f>=t&&(f<a||!e.loop&&f<=a)&&o.push({name:c.name,animation:e.animation.name});}}save(){let e=this.skeleton;e.bones.forEach((t,a)=>{let o=t.pose;this.snapshot.set([o.x,o.y,o.rotation,o.scaleX,o.scaleY],a*5);}),e.slots.forEach((t,a)=>this.slotSnapshot.set([t.color.r,t.color.g,t.color.b,t.color.a],a*4)),e.constraints.forEach((t,a)=>{t instanceof E&&(this.ikSnapshot[a]=t.mix);});}blendFromSaved(e){let t=this.skeleton,a=(o,n)=>o+(n-o)*e;t.bones.forEach((o,n)=>{let r=this.snapshot,s=o.pose,d=n*5;s.x=a(r[d],s.x),s.y=a(r[d+1],s.y);let c=s.rotation-r[d+2];c-=Math.round(c/360)*360,s.rotation=r[d+2]+c*e,s.scaleX=a(r[d+3],s.scaleX),s.scaleY=a(r[d+4],s.scaleY);}),t.slots.forEach((o,n)=>{let r=this.slotSnapshot;o.color.r=a(r[n*4],o.color.r),o.color.g=a(r[n*4+1],o.color.g),o.color.b=a(r[n*4+2],o.color.b),o.color.a=a(r[n*4+3],o.color.a);}),t.constraints.forEach((o,n)=>{o instanceof E&&(o.mix=a(this.ikSnapshot[n],o.mix));});}};var Ae=Math.PI/180,Ve=new Float32Array([0,1,0,0,1,0,1,1]),Ue=new Uint16Array([0,1,2,2,3,0]),Pe=new WeakMap;function je(i){let e=Pe.get(i);if(e)return e;let t=-i.width/2*i.scaleX,a=-i.height/2*i.scaleY,o=i.width/2*i.scaleX,n=i.height/2*i.scaleY,r=Math.cos(i.rotation*Ae),s=Math.sin(i.rotation*Ae),d=(c,f)=>[c*r-f*s+i.x,c*s+f*r+i.y];return e=Float32Array.from([...d(t,a),...d(t,n),...d(o,n),...d(o,a)]),Pe.set(i,e),e}function te(i,e,t,a){if(t.type==="region"){let o=a&&a.length===8?a:new Float32Array(8),n=je(t),r=e.bone.applied;for(let s=0;s<8;s+=2){let d=n[s],c=n[s+1];o[s]=d*r.a+c*r.b+r.worldX,o[s+1]=d*r.c+c*r.d+r.worldY;}return {positions:o,uvs:Ve,triangles:Ue}}return _e(i,e,t,a)}function _e(i,e,t,a){let o=t.vertexCount*2,n=a&&a.length===o?a:new Float32Array(o),r=t.vertices;if(t.weighted){let s=0;for(let d=0;d<o;d+=2){let c=r[s++],f=0,b=0;for(let h=0;h<c;h++,s+=4){let p=i.bones[r[s]].applied,m=r[s+1],g=r[s+2],l=r[s+3];f+=(m*p.a+g*p.b+p.worldX)*l,b+=(m*p.c+g*p.d+p.worldY)*l;}n[d]=f,n[d+1]=b;}}else {let s=e.bone.applied;for(let d=0;d<o;d+=2){let c=r[d],f=r[d+1];n[d]=c*s.a+f*s.b+s.worldX,n[d+1]=c*s.c+f*s.d+s.worldY;}}return {positions:n,uvs:t.uvs,triangles:t.triangles}}function De(i){let e=/^#?([0-9a-f]{6})$/i.exec(i.trim());return e?parseInt(e[1],16):16777215}var Ie=new WeakMap;function Ce(i){let e=Ie.get(i);if(e)return e;e=new Map;for(let t of i.skins.values())for(let a of t.attachments.values())for(let o of a.values())e.has(o.path)||e.set(o.path,{w:o.width,h:o.height});return Ie.set(i,e),e}function Re(i,e){let t=i.skins.get(e);if(!t)return [];let a=new Set;for(let o of t.attachments.values())for(let n of o.values())a.add(n.path);return [...a]}function Ye(i,e){return !i.skin?.length||i.skin.some(t=>t.toLowerCase()===e.toLowerCase())}var ae=class{constructor(e,t=()=>true){this.rig=e;this.drawable=t;let a=(o,n)=>e.colorTargets.find(r=>(r.into??"tint")===n&&r.slotPrefixes.some(s=>o.startsWith(s)))?.id??null;this.slotTarget=e.data.slots.map(o=>a(o.name,"tint")),this.slotArt=e.data.slots.map(o=>a(o.name,"art")),this.rebuildLists(),this.init();}rig;drawable;chosen=new Map;hidden=new Map;colors=new Map;lists=new Map;listeners=new Set;slotTarget;slotArt;face=null;emotionFace=null;speech="rest";body={};raceSaved=new Map;raceGiven=new Map;setDrawable(e){let t=new Set(this.rig.partTypes.filter(a=>!this.count(a.id)).map(a=>a.id));this.drawable=e,this.rebuildLists();for(let a of this.rig.partTypes){if(a.auto)continue;let o=this.chosen.get(a.id);(o&&!this.lists.get(a.id).includes(o)||!o&&t.has(a.id))&&this.chosen.set(a.id,this.first(a));}this.emit({kind:"part",type:"*",skin:null});}on(e){return this.listeners.add(e),()=>this.listeners.delete(e)}emit(e){for(let t of [...this.listeners])t(e);}typeDef(e){return this.rig.partTypes.find(t=>t.id===e)}list(e){return this.lists.get(e)??[]}count(e){return this.list(e).length}part(e){return this.chosen.get(e)??null}index(e){let t=this.part(e);return t?this.list(e).indexOf(t):-1}isHidden(e){return this.hidden.get(e)??false}isWorn(e){return this.part(e)!==null&&!this.isHidden(e)}color(e){return this.colors.get(e)??null}wornSkins(){let e=new Map;for(let c of this.rig.partTypes)e.set(c.id,!c.auto&&this.isWorn(c.id)?this.part(c.id):null);let t={worn:c=>e.get(c)??null,setWorn:(c,f)=>e.set(c,f),exists:c=>this.rig.data.skins.has(c)&&this.drawable(c),race:()=>this.race(),types:()=>this.rig.partTypes.map(c=>c.id)};for(let c of this.rig.rules)c.apply(t);let a=this.rig.expressions,o=this.face??this.emotionFace,n=o?a?.faces[o]:void 0;for(let[c,f]of Object.entries(n??{}))e.get(c)&&t.exists(f)&&e.set(c,f);let r=this.speech!=="rest"?a?.speech:void 0,s=r?.visemes[this.speech];r&&s&&e.get(r.type)&&t.exists(s)&&e.set(r.type,s);let d=[];for(let c of this.rig.partTypes){let f=e.get(c.id);f&&d.push(f);}return d}slotColor(e){let t=this.slotTarget[e];return t?this.color(t):null}artColor(e){let t=this.slotArt[e];return t?this.color(t):null}bodyLook(){return {...this.body}}race(){return this.rig.races?.get(this.body.race)??null}expression(){return this.face}equip(e,t){let a=this.lists.get(e);if(!a)return;let o;if(t===null||t===-1)o=null;else if(typeof t=="number")o=a[Math.max(0,Math.min(a.length-1,t))]??null;else if(a.includes(t))o=t;else return;o===null&&!this.typeDef(e)?.canHide||(this.chosen.set(e,o),this.emit({kind:"part",type:e,skin:o}));}unequip(e){this.equip(e,null);}setHidden(e,t){this.typeDef(e)?.canHide&&(this.hidden.set(e,t),this.emit({kind:"hidden",type:e,hidden:t}));}next(e){let t=this.count(e);if(!t)return;let a=this.index(e);this.typeDef(e)?.canHide?this.equip(e,a>=t-1?-1:a+1):this.equip(e,(a+1)%t);}prev(e){let t=this.count(e);if(!t)return;let a=this.index(e);this.typeDef(e)?.canHide?this.equip(e,a<=-1?t-1:a-1):this.equip(e,(a-1+t)%t);}setColor(e,t){this.colors.set(e,t),this.emit({kind:"color",target:e,color:t});}setExpression(e){let t=e&&this.rig.expressions?.faces[e]?e:null;t!==this.face&&(this.face=t,this.emit({kind:"expression",name:t}));}setEmotion(e){let t=this.rig.expressions?.emotions?.[e]??null,a=t&&this.rig.expressions?.faces[t]?t:null;a!==this.emotionFace&&(this.emotionFace=a,this.emit({kind:"expression",name:this.face??a}));}setSpeech(e){e!==this.speech&&(this.speech=e,this.emit({kind:"speech",viseme:e}));}setBody(e){let t=this.race();if(this.body={...e},this.body.race!==t?.id){this.dropRaceColors();let a=new Map(this.colors);this.fitRaceColors(false),this.rememberRaceColors(a);}this.emit({kind:"body",body:this.bodyLook()});}setRace(e){let t={...this.body};e?t.race=e:delete t.race,this.setBody(t);}randomize(e=Math.random){for(let t of this.rig.partTypes){if(t.auto)continue;let a=this.count(t.id);a&&this.equip(t.id,t.canHide&&e()<.3?-1:Math.floor(e()*a));}}reset(){this.init();for(let e of this.rig.partTypes)this.emit({kind:"part",type:e.id,skin:this.part(e.id)});}toLook(){let e={};for(let o of this.rig.partTypes)o.auto||(e[o.id]=this.isWorn(o.id)?this.part(o.id):null);let t={};for(let[o,n]of this.colors)n&&(t[o]=n);let a=this.bodyLook();return {v:2,parts:e,colors:t,...Object.keys(a).length?{body:a}:{}}}applyLook(e){let t=this.race(),a=!!e.body&&e.body.race!==t?.id;a&&this.dropRaceColors();let o=new Map(this.colors);for(let[n,r]of Object.entries(e.parts??{}))r===void 0||this.typeDef(n)?.auto||(this.equip(n,r),r!==null&&this.part(n)===r&&this.hidden.set(n,false));for(let[n,r]of Object.entries(e.colors??{}))r&&this.setColor(n,r);e.body&&(this.body={...this.body,...e.body},a&&(this.fitRaceColors(true,e),this.rememberRaceColors(o)),this.emit({kind:"body",body:this.bodyLook()}));}dropRaceColors(){for(let[e,t]of this.raceGiven)this.color(e)?.toLowerCase()===t.toLowerCase()&&this.setColor(e,this.raceSaved.get(e)??null);this.raceGiven.clear(),this.raceSaved.clear();}rememberRaceColors(e){let t=this.race();if(!t)return;let a=new Set(Object.keys(t.colors??{}));t.skin?.length&&a.add(this.rig.skinColor??"Skin");for(let o of a){let n=this.color(o);!n||n===(e.get(o)??null)||(this.raceSaved.set(o,e.get(o)??null),this.raceGiven.set(o,n));}}fitRaceColors(e,t){let a=this.race();if(!a)return;for(let[s,d]of Object.entries(a.colors??{}))(e?t?.colors?.[s]:this.color(s))||this.setColor(s,d);let o=this.rig.skinColor??"Skin",n=this.color(o),r=e?t?.colors?.[o]??n:n;a.skin?.length&&(!r||!Ye(a,r))&&this.setColor(o,a.skin[0]);}rebuildLists(){for(let e of this.rig.partTypes)this.lists.set(e.id,this.rig.data.skinOrder.filter(t=>t.startsWith(e.skinPrefix)&&this.drawable(t)));}first(e){return this.lists.get(e.id)?.[0]??null}init(){this.chosen.clear(),this.hidden.clear(),this.colors.clear(),this.body={},this.raceSaved.clear(),this.raceGiven.clear();for(let e of this.rig.partTypes)this.chosen.set(e.id,e.auto?null:this.first(e));}};var U=Math.PI/180,he=1e-5,oe=class{constructor(e){this.bone=e;}bone;x=0;y=0;rotation=0;scaleX=1;scaleY=1;shearX=0;shearY=0;a=1;b=0;c=0;d=1;worldX=0;worldY=0;world=0;local=0;copyLocal(e){this.x=e.x,this.y=e.y,this.rotation=e.rotation,this.scaleX=e.scaleX,this.scaleY=e.scaleY,this.shearX=e.shearX,this.shearY=e.shearY;}update(e){this.world!==e.updateId&&this.updateWorldTransform(e);}updateWorldTransform(e){this.local===e.updateId?this.updateLocalTransform(e):this.world=e.updateId;let t=(this.rotation+this.shearX)*U,a=(this.rotation+90+this.shearY)*U,o=Math.cos(t)*this.scaleX,n=Math.cos(a)*this.scaleY,r=Math.sin(t)*this.scaleX,s=Math.sin(a)*this.scaleY,d=this.bone.parent;if(!d){let f=e.scaleX,b=e.scaleY;this.a=o*f,this.b=n*f,this.c=r*b,this.d=s*b,this.worldX=this.x*f+e.x,this.worldY=this.y*b+e.y;return}let c=d.applied;this.worldX=c.a*this.x+c.b*this.y+c.worldX,this.worldY=c.c*this.x+c.d*this.y+c.worldY,this.a=c.a*o+c.b*r,this.b=c.a*n+c.b*s,this.c=c.c*o+c.d*r,this.d=c.c*n+c.d*s;}updateLocalTransform(e){this.local=0,this.world=e.updateId;let t=this.bone.parent;if(!t){this.x=(this.worldX-e.x)/e.scaleX,this.y=(this.worldY-e.y)/e.scaleY,this.set5(this.a/e.scaleX,this.b/e.scaleX,this.c/e.scaleY,this.d/e.scaleY);return}let a=t.applied,o=1/(a.a*a.d-a.b*a.c),n=a.d*o,r=a.b*o,s=a.c*o,d=a.a*o,c=this.worldX-a.worldX,f=this.worldY-a.worldY;this.x=c*n-f*r,this.y=f*d-c*s,this.set5(n*this.a-r*this.c,n*this.b-r*this.d,d*this.c-s*this.a,d*this.d-s*this.b);}set5(e,t,a,o){this.shearX=0;let n=e*e+a*a,r=t*t+o*o;if(n>he){let s=Math.atan2(a,e)/U;this.rotation=s,this.scaleX=Math.sqrt(n),this.scaleY=Math.sqrt(r),r>he?(this.shearY=Math.atan2(o,t)/U,e*o-t*a<0?(this.scaleY=-this.scaleY,this.shearY+=90-s):this.shearY-=90+s,this.shearY>180?this.shearY-=360:this.shearY<=-180&&(this.shearY+=360)):this.shearY=0;}else this.scaleX=0,this.scaleY=Math.sqrt(r),this.shearY=0,this.rotation=r>he?Math.atan2(o,t)/U-90:0;}modifyLocal(e){this.local===e.updateId&&this.updateLocalTransform(e),this.world=0,this.resetWorld(e);}modifyWorld(e){this.local=e.updateId,this.world=e.updateId,this.resetWorld(e);}resetWorld(e){for(let t of this.bone.children){let a=t.applied;a.world===e.updateId&&(a.local===e.updateId&&a.updateLocalTransform(e),a.world=0,a.resetWorld(e));}}},ne=class{constructor(e){this.data=e;this.pose=new oe(this),this.applied=new oe(this),this.setupPose();}data;pose;applied;parent=null;children=[];sorted=false;setupPose(){let e=this.data,t=this.pose;t.x=e.x,t.y=e.y,t.rotation=e.rotation,t.scaleX=e.scaleX,t.scaleY=e.scaleY,t.shearX=0,t.shearY=0;}},pe=class{constructor(e,t){this.data=e;this.bone=t;this.color={...e.color},this.attachmentKey=e.attachment;}data;bone;color;attachmentKey;attachment=null},O=class{constructor(e){this.data=e;this.bones=e.bones.map(t=>new ne(t));for(let t of this.bones)t.data.parent&&(t.parent=this.bones[t.data.parent.index],t.parent.children.push(t));this.slots=e.slots.map(t=>new pe(t,this.bones[t.bone.index])),this.constraints=e.constraints.map(t=>Me(t,this)),this.updateCache();}data;bones;slots;constraints;skins=[];scaleX=1;scaleY=1;x=0;y=0;updateId=0;cache=[];bone(e){return this.bones[this.data.bone(e).index]}slot(e){return this.slots[this.data.slot(e).index]}setSkins(e){this.skins=[...e],this.resolveAttachments();}getAttachment(e,t){for(let a=this.skins.length-1;a>=0;a--){let o=this.skins[a].attachments.get(e)?.get(t);if(o)return o}return null}resolveAttachments(){for(let e of this.slots)e.attachment=e.attachmentKey?this.getAttachment(e.data.index,e.attachmentKey):null;}setupPose(){for(let e of this.bones)e.setupPose();for(let e of this.constraints)e.setupPose();for(let e of this.slots)Object.assign(e.color,e.data.color),e.attachmentKey=e.data.attachment;}updateWorldTransform(){this.updateId++;for(let e of this.bones)e.applied.copyLocal(e.pose),e.applied.world=0,e.applied.local=0;for(let e of this.cache)e instanceof ne?e.applied.update(this):e.update(this);}updateCache(){this.cache=[];for(let e of this.bones)e.sorted=false;for(let e of this.constraints)e.sort(this);for(let e of this.bones)this.sortBone(e);}sortBone(e){e.sorted||(e.parent&&this.sortBone(e.parent),e.sorted=true,this.cache.push(e));}sortReset(e){for(let t of e)t.sorted&&this.sortReset(t.children),t.sorted=false;}pushConstraint(e){this.cache.push(e);}};var Be=new WeakMap;function Le(i,e){let t=Be.get(i);if(t)return t;t=new Map;let a=new O(i);a.setupPose(),a.updateWorldTransform();let[o,n]=e.light;for(let r of i.skins.values())for(let[s,d]of r.attachments)for(let c of d.values()){if(t.has(c.path)||e.skip?.some(l=>c.path.startsWith(l)))continue;let f=te(a,a.slots[s],c,null),b=Ke(f.positions,f.uvs,c.width,c.height);if(!b)continue;let h=b.a*b.d-b.b*b.c;if(Math.abs(h)<1e-9)continue;let p=(b.d*o-b.b*n)/h,m=(-b.c*o+b.a*n)/h,g=Math.hypot(p,m)||1;t.set(c.path,{x:p/g,y:m/g});}return Be.set(i,t),t}function Ke(i,e,t,a){let o=e.length/2;if(o<3)return null;let n=0,r=0,s=0,d=0;for(let u=0;u<o;u++)n+=e[u*2]*t,r+=e[u*2+1]*a,s+=i[u*2],d+=i[u*2+1];n/=o,r/=o,s/=o,d/=o;let c=0,f=0,b=0,h=0,p=0,m=0,g=0;for(let u=0;u<o;u++){let w=e[u*2]*t-n,y=e[u*2+1]*a-r,B=i[u*2]-s,L=i[u*2+1]-d;c+=w*w,f+=w*y,b+=y*y,h+=B*w,p+=B*y,m+=L*w,g+=L*y;}let l=c*b-f*f;return Math.abs(l)<1e-9?null:{a:(h*b-p*f)/l,b:(p*c-h*f)/l,c:(m*b-g*f)/l,d:(g*c-m*f)/l}}var j=class{constructor(e,t){this.scene=e;let a=this.rig=t.rig;this.art=t.art,this.skeleton=new O(a.data),this.sizes=Ce(a.data),this.lights=a.shading?Le(a.data,a.shading):new Map,this.parts=new ae(a,o=>this.drawsSkin(o)),t.look&&this.parts.applyLook(t.look),this.offs.push(this.parts.on(()=>this.skinsDirty=true)),this.animator=new ee(this.skeleton,a.data,a.mix),this.animator.setBlink(a.blink??null),this.play(t.animation??a.defaultAnimation,{mix:0}),this.root=e.add.container(t.x??0,t.y??0);for(let o=0;o<this.skeleton.slots.length;o++){let n=new F__default.default.GameObjects.Mesh2D(e,0,0,"__DEFAULT",[],[],true);n.setRenderAsTriangles(true),n.setVisible(false),this.root.add(n),this.slots.push({mesh:n,positions:null,vertices:[],indices:[],path:null,key:null,paint:null,waiting:false});}if(this.setScale(t.scale??1),t.autoUpdate!==false){let o=(n,r)=>this.update(r/1e3);e.events.on(F__default.default.Scenes.Events.UPDATE,o),this.offs.push(()=>e.events.off(F__default.default.Scenes.Events.UPDATE,o));}this.root.once(F__default.default.GameObjects.Events.DESTROY,()=>{for(let o of this.offs.splice(0))o();}),this.update(0);}scene;root;skeleton;animator;parts;slots=[];sizes;lights;skinsDirty=true;overlay=null;flashUntil=0;flashColor=16777215;facing=1;size=1;offs=[];asked=null;rig;art;play(e,t){return this.asked={name:e,...t?{options:t}:{}},this.animator.play(this.stanceOf(e),t)}animation(){return this.asked?.name??null}stanceOf(e){let t=this.parts;return this.rig.stance?.(e,a=>t.isWorn(a)?t.part(a):null)??e}on(e,t){let a=this.animator.on(e,t);return this.offs.push(a),a}setLook(e){this.parts.applyLook(e);}setArt(e){this.art=e;for(let t of this.slots)t.key=t.path=null,t.waiting=false;this.parts.setDrawable(t=>this.drawsSkin(t));}setPosition(e,t){return this.root.setPosition(e,t),this}setScale(e){return this.size=e,this.root.setScale(e*this.facing,e),this}setFacing(e){return this.facing=e,this.setScale(this.size)}setDepth(e){return this.root.setDepth(e),this}setVisible(e){return this.root.setVisible(e),this}setAlpha(e){return this.root.setAlpha(e),this}setOverlay(e){return this.overlay=e,this}flash(e=16777215,t=90){this.flashColor=e,this.flashUntil=this.scene.time.now+t;}worldPoint(e){let t=this.rig.anchors[e]??e,a=this.skeleton.bone(t).applied,o=this.root.getWorldTransformMatrix();return {x:o.tx+o.a*a.worldX+o.c*-a.worldY,y:o.ty+o.b*a.worldX+o.d*-a.worldY}}get displayHeight(){return this.rig.data.height*this.size}destroy(){this.root.destroy();}update(e){let t=this.skeleton,a=this.rig.expressions;if(a&&this.parts.setExpression(a.byAnimation[this.animator.current()??""]??null),this.skinsDirty){this.skinsDirty=false,t.setSkins(this.parts.wornSkins().flatMap(r=>{let s=this.rig.data.skins.get(r);return s?[s]:[]}));let n=this.asked;n&&this.stanceOf(n.name)!==this.animator.current()&&this.animator.play(this.stanceOf(n.name),{...n.options,mix:.15});}this.animator.update(e),t.slots.forEach((n,r)=>{let s=this.parts.slotColor(r);if(!s)return;let d=De(s);n.color.r=(d>>16&255)/255,n.color.g=(d>>8&255)/255,n.color.b=(d&255)/255,n.color.a=1;}),t.updateWorldTransform();let o=this.flashUntil>this.scene.time.now;t.slots.forEach((n,r)=>this.drawSlot(r,o));}drawSlot(e,t){let a=this.slots[e],o=this.skeleton.slots[e],n=o.attachment,r=a.mesh;if(!n||o.color.a<=0){r.setVisible(false);return}let s=this.parts.artColor(e);if((a.path!==n.path||a.paint!==s)&&(a.path=n.path,a.paint=s,a.key=null,a.waiting=false),!a.key&&!a.waiting){let l=this.sizes.get(n.path)??{w:n.width,h:n.height},u=n.path,w=this.art.texture(u,l,()=>{a.path===u&&(a.waiting=false);},{paint:s,light:this.lights.get(u)??null});w?(a.key=w,r.setTexture(w)):a.waiting=true;}if(!a.key){r.setVisible(false);return}let d=te(this.skeleton,o,n,a.positions);a.positions=d.positions;let c=d.uvs.length/2,f=a.vertices;f.length=c*4;for(let l=0;l<c;l++)f[l*4]=d.positions[l*2],f[l*4+1]=-d.positions[l*2+1],f[l*4+2]=d.uvs[l*2],f[l*4+3]=d.uvs[l*2+1];let b=d.triangles,h=a.indices;if(h.length!==b.length/3*4){h.length=0;for(let l=0;l<b.length;l+=3)h.push(b[l],b[l+1],b[l+2],0);}else for(let l=0,u=0;l<b.length;l+=3,u+=4)h[u]=b[l],h[u+1]=b[l+1],h[u+2]=b[l+2];r.vertices=f,r.indices=h;let p=o.color,m=n.color,g=Math.round(p.r*m.r*255)<<16|Math.round(p.g*m.g*255)<<8|Math.round(p.b*m.b*255);this.overlay!==null&&(g=Je(g,this.overlay)),t?r.setTint(this.flashColor).setTintMode(F__default.default.TintModes.FILL):r.setTint(g).setTintMode(F__default.default.TintModes.MULTIPLY),r.setAlpha(p.a*m.a),r.setVisible(true);}drawsSkin(e){return Re(this.rig.data,e).every(t=>this.art.has(t))}};function Je(i,e){let t=a=>Math.round((i>>a&255)*(e>>a&255)/255)<<a;return t(16)|t(8)|t(0)}var Xe="https://static.idos.games/drive/art/",ue="0010240a6442981d13f 001651981b797fb464f 00a3822e41c7b33fc72 010735220f1a2fe18b3 014a1f057770e71b5dd 01a07ef86de374e65ea 021cc8a51ff6b2bf923 0230384e8537004e7be 02d0466946de00a5321 036be291739f5f26fa4 0371fcf128bae580b1f 04e7b28457ff27078c3 059692b24b6b9cc9d2c 059fe6eb1545c5b116ee 05b29db2b0ca03dc6d9 05bf1b359cc012166ad 06745e802f810b447a3 06ca4943baac7bb4869 07625c2af8ab2b56708 076c9c9ae414625dac4 079fbe3e9ff2e6416a0 07c0bb874992bed68fd 07d0aaf91e93bbffad7 08254e1257c2a9b98dc 083b4a35ea3e7cb4cdb 083fa03662360a61641 0851357a7a6a4e917d4 0860eafe887921be916 08861f775e7459bf983 093516724b3cae4d5a8 0937fa739c80409381c 0a4b965f2899919d1500 0af1f91ce219addc558 0b36bd5c038f61b1532 0be1d06b29d1b8615bb 0becb7359d51bbbc6c6 0c14ef46ddb3cf059a3 0c27e8c116d11ee5132d 0c44be274eac95a0510 0c4db038f6e5008d16f 0c73cf0806928017854 0d91e220959c99b570e 0ded6c0b6eb8cf03ff2 0eec507f747df195ae9 0eeeffd550d207ce713 0f25fabee1fa500f6cf 0f896826ccf91c886d1 0f89c1ce4ddbd777cf2 10316e6f2a634349837 106d9f21aba1080bfc7 11685af3622693bd5c7 11898f6dd218752211e8 11abb4c2a1c1fadf5da 11bff05432b069a888f 11e7eff68beb951d182d 11f906ce76940fb5161 12ab22b523d6578d701 12db460db58c0afc5cc 12e77d19e03faf8668c 1304431ba5231cb55c7 132d98837688831cd70 138a58e851fd8f7380d 13bdaf5f0f0279ee92b 13d97f4b06d66e35d1e 142576258e9af7bb5ac 14854e37a4c6fc895b6 14e5758386b4b8b0772 152dc4edc369039649f 156a9e45b5338df2759 15f495b4775c44f3556 1644beffde5820ce8a1 16ca881de7ae1a527b5 1788916f75b5c28a486 179f62fbe90b807a800 17cc1988a34794af1737 17ce3f1ab9a79b8d650 1857575702c6cf7c8bc 18bb73beadd2dd7249f 18e4231073114167641 196a970936b72684592 199500391538a97e5dc 199cb450d59cee1bc0b 19b1355ecf3c4c24b3c 19c0c6efbe9acf096fe 1a5c3139fbc84e31989 1a99395852ff4b665fb 1ab257ca654faf238b8 1ba4526b6298b7cd652 1c6acf7321cb9e2171c 1d60be97ffaaca5a63d 1dbbec8e9cfc39df5bd 1f21661a268664d85e4 1fe2523bc1afab6385e 208d32cec9cb30156cf 209dbd83a7a263bc706 212e11b219b62c0f8cd 21701a701f6701a77f1 21a56307f6e9a05377e 226d8c70e8a881ef7b8 22f4a4e7190a353b1d3 235b90277cbcc3f45c8 238fa94b7f0a668f69b 23a71f52dc097b1c391 254692c57a0122a213ce 25513e67064b2684511 2554ade47d3e2b7692b 255f72da3c0642c0776 25a5d617ec59dbf8706 261227872c0ccd307ab 2634edae83d8eda775a 269d4322e3a147929a7 269da8afe92268768e5 26b083f7020e4583556 26c316e4d3abc70e995 272cbc8268d9fd499ce 275dc8052833700cd1e 27cbe5dae7a024ce73f 27f39503e3fe587172c 2830856fe37ff0dc6ea 288d3b084e344d3e140 288d7ab7c498b41190e 28deec27b250b6bd730 29bcd497fd726e83133e 2a4f055b8c02fa754ac 2a97c475c5309a7c701 2ad1ec2e7710354c788 2afcb122c4de5ad7706 2b074d6ea4c76bb9bb3 2b56dee988a6a4466d9 2b941e6c3702dc039fd 2bc6b3aaa61459f36b0 2c9d8dbf96d9f9d270e 2d03527818499b45a1a 2dc68e4aadb958855df 2f95e1c47aac2ffc504 2fb716391cfaf00d6e9 2fe589e99a48100666f 302c6396c6dda8cf6cb 306b0c73e295f442fdd 30a5bfa41667b1806f7 30f361a68cc63b77706 31071310e6e1e54f129 310833971474b7a35ea 3157fa530f9aade96c7 31f8be8085e6e69e136e 325190e88e124d057f6 3297afc20a477554652 32de65d9aa5dfbe8cbb 32f14ca4b26dd6ad70e 33411b89b7b19c3849f 336b2c6f482eb83dd4c 33948e157e7945b54f3 33cf99eac608bd7d673 33ea9b67e80f7d5e852 34435cdc4cfb2ae9d79 3475a58b5f5e5d13ff2 34f3f9f48eb216592c4 3532f79d1ee34f39679 355d9f7792574e09772 3634caf7d1e1a6ae573 36953a9f783092d69b5 36b84d21e2a220c966d 37054d9172fb4057843 371a74a15eae0295ac4 372a4ceb8fcb7d83150a 3745173ca094e9bc614 375f0be293e88e175ca 3784f1fcf8c3be53645 383f0a0484bd96617bf 3859bbcf3df97d4369d 388de8302fcbc3f31a7 38fa4b925efc42061737 3916277176187e826d2 3921a95101bb3ecb5f9 3a118d09328d038469b 3a6c9144af6a0c116f5 3ac8320b838e70585f9 3adb7f55f34b1fc56b3 3b06916c08797f117b2 3b1d0b59bab037af4c1 3b338bc7863ff15c662 3b68ff671721fee887a 3b69b5e2ede2d77dfc7 3bdcd184a62286687f3 3c1884315232602b5df 3c23955e7927abfee6 3d596fccff420e48775 3d74dcb94d5a1c3f650 3dcf3bf518278dab4d1 3e65ab8e3560668296b 3e93dc5439de78715ca 3ec931b319d656167da 3f261f1ea5ebabcc49f 3fb90d577ad6c88b534 406e7bf133fc92c8fc7 40d5a38ae60e347b554 410714baf4f188057af 411f25011ea7c405664 41351c7d41f96db17ae 4154da2f7a14216e798 41ce9084c40537f063a 41edc6cc7c0023f9159d 4202386fb568f971ae3 4237b6222d282fbcd4c 4399d7578ff9afd7720 43bf545834d611a45d2 43fbb5365b9801d75ca 44badc6eb6aa399769a 45065e6ac600c14cb7b 450a7efa895017ff9b7 452526eb1cb420034af 4532f27556a17e3f6ea 457896aac8faca4749e 45fe5c79d1e14d325d2 460abf639a8967fcb05 4649ec58526338d05f9 46663c00bc1b8597cdb 468746a46a8f399a69b 47b24fcc4e2a4606573 47c5f71571bc104a559 49010d7dd6a0466a603 494e4c825c3a7cc572e 497cf8f598d2f644838 49a35739929ddf0b483 49c8a4a420b2ac535ea 49d0431c88a29f0f504 4a204d9b17e1e26369b 4a206e5500da2bc5a67 4a24281e43c2785a664 4a25498d54a65b98641 4a2fc033b50c9144699 4a328fb4b8a7a56d903 4a7065a49c1cb51a93d 4b1693cdcbdc84c15bb 4b6f5443189a59155f9 4b76b8d52a8edd40672 4b80cec93ee8a6cb735 4bd0000b0b6299586ea 4c7562d354b55d5d81e 4ccc2c10006585eea9e 4cec4a00b1005edd4e2 4d318915ad6748e018fc 4d5caccd37fb62b2708 4d9f26f49c1f1ff6465 4dc426050dc85edfa5e 4e20601b67fb96b592c 4eb76966c9f29fb7aa65 4edb3aa14b1c1a50796 4f3ac84f581f82c71665 5001f70f3d1b417489c 5019910086124b407d3 5041d36e32cd8ef5643 5079f1248b93c46b70c 50a179d2a342d7d2554 50d46fa5ec0f5d1b80c 51439e951b8df5bd6f7 51d7264ade06c4f7985 52167248761d5a695c0 522f003b481884d889f 5263a7433546e7ad4b1 529c393d4afb974c16c0 52a28729d84de4586d0 5300958e5af9fc0be42 5306460d85d754d156d 530f1eac267531907c7 53a8456de59b96a112a3 53d02f16b1daa318538 540eca4dbbd6af415af 543bf7144e04a594687 54646533e6ed7409649 550171afae94c30d5b9 551e0e3b8a29892bad6 55407591946588e86af 55a915700534ddd913ce 55d03a597c9f422f89b 55e16fc05daebc6a70e 56c9ff114b731633f16 57132822c5a38737867 57aa7c5b82fe2a545d3 57b19c5d74bcda158a4 585d390227816c1c749 587ff1c6eedeb82d81f 5897376d42c6357ba9e 589811de68bde67c556 58e2d0b736517eb4502 58ee5f1c4d333552806 597cab867f09dea2846 59934f44d6ef3a82573 5a195f67c21f2b404b1 5a64f5a29c10e3d1688 5a9b5c0ff6f511fdac4 5b509e3966b89ce1148 5bde38ac5deb82ad4b1 5bf002e1b8c963335ca 5c15143ea72d171b9c0 5c77c4cd43f113f76ed 5cd32e8c8c488aa7bad 5cd6b9e8f60e13a680e 5cddb8e27bfe36c1701 5cfbf3f38015970f132e 5d5b66897711c320a68 5d7fe92a36534f99867 5db09dffc876a974154b 5de43b94268010185fb 5de814204bfe321e5b6 5eac5238f98e45a5892 5ed6b553564c556e6b3 5eeb62a5671b9a81575 5f35e46fda1574a36ad 5f8e04d4a93353437d4 5fc4dc620c885271a37 601914c9f168da45dc5 6045abc3fee825d1bd8 6096290236d06252719 60c0cd740402d57d612 6109df6a321d0fdd556 610a5673aba3253d5ee 61a589b1524f427972e 61b59d9fe1c0a50796b 61ee8725dbc456c7e13 622015d628b0462e6be 624c9be547876711cf2 629d46e05a7ba68f556 631c3d977c6e3a50602 63a02684c745dfb2772 63b738269d26a7047ce 63ee25d8c142f26d7af 63fcd3cd24fa83cd554 64bfd8aac87e8f138bc 64d7e21b95a9aae17b1 6504a0f091538a10556 6513a3df956ce8f0e06 652f4f73c2d8fe83d2c 65d3c74c0fd6f41a7b8 6628164c674f93048fd 663a988898edf8881777 664ff5da22833979587 66739245f3846ae6e96 66de1912104860b469b 67299a88795a096b7b3 677dd00b86819fc971a 67c90c4a03cd0466923 6822ae2eb767cd545f6 6835f7544fde3234822 68a341dc13c0a73f5f8 69771f890dac69a9105f 6a2cc592ae8cbf841152 6a451f3b9c61f926703 6afb10900af491185b9 6b34e0a0ebafbeea6de 6b8665e29bd3346865f 6b9e80eac1123264dd3 6c03b436e7e9603f6e7 6c054698899ec0ca709 6c27bc0d641252247ee 6c9294223787d7fc177f 6ccc929611590721818 6d5163bc006066305c7 6d6fb6710e08885a5b6 6dadc49e623f7592910 6e5adcb2637fba4f833 6ec14636248eefbf840 6f09637239329ba3703 6f0cd480cfc476f2556 6f0f6e7ea7d25833f30 6f257a8a30a6c81f345 6f2fe31c47cce7ca6b4 70045bc771a246b2112 70738f95af5eb45512da 70af721c08073d47631 70cc3ad6489ae8ae779 71b194a08163c3a0720 71cb1717aed0d53f70b 7270cb189474285b6f5 72923a43467ee11b7d5 72f1941df3733628556 7323ade3c561d35e82b 741254e0561e5382588 743311cd792e737e905 745ef7fcc757ddcd7bb 746a74ae4a5f08b8cfc 748ab2403a8420e8f03 75269f5c1f969384626 7545cfbf99d701d26a8 75aed4ad9380f8a069d 76b02eb245c4201cbe6 7738c113e6b461b5660 77595d46c8a8b20749f 7765eef518860bb5661 776771af9c59587f70d 77c6f6aa27ed213a68d 77db9278041a796564f 78bda0b94af71499493 78fe361d1edcee221602 78fefc3502396c469a3 790659fb89d2165448b 7976411dc52d6d787a9 79b540397c126f7663d 79dca55aa5beb2ae108 7a1d7185cd25341a7b8 7a210d8b02d3e1ae1d4 7a2a19fd2f43865d698 7a806b655fde2caeb82 7ab744bfbebefe95708 7b1078026604c717d1e 7b43849b34fe89ef6c0 7b8f2cbb54004ff2d2c 7b9d8c9ef851fd04741 7ba34fefb29c96c56dc 7bc67ce62920460a98a 7bc86ba3e73c45f35ff 7bf75f7c5e2811b27ef 7cbfde80dfdd143bb22 7db44a844f7ff5bed76 7dc204a4ba9929fb5df 7e57bfc4ce9578ee556 7ebe21b05094d8f761a 7f1019ec5eb2cd465fb 7f36b697437be0d773f 7f44812d75e9a38d5fb 7f55d9aa84e9aab7538 7f6dab16dfb6fdc474d 7f90f55e896ebd6f5b8 8035a3a1130f8f6a9d2 8053a4b76b1db197872 806c682876e2404c904 80bbba61fdb81849708 80f0e2a81ef64b234a7 811a56af6ebf5407772 8147959490e616c96ee 816bbf5a2f3a93a6c54 81bcb6a9f67cbcf7fc7 81e0e012ca5fdfa6822 81f3990a2a42a7f54a1 827e87adf8b63a567af 8320f0b2115031048d5 83a0f99c81f94c685ff 84181bc1186c5cd614ef 8464d3e639f092b167f 84c800c38d037b2f69b 855605da195f7ca7620 856ab6a3f0f9aacf7e4 856c6dd9694e62d2f9d 85d35720b55e371982e 862826839b4a89e86b2 869d8349eef6363b5fa 86a5588edc4c8bfc634 86aa1b5b05138927774 871108c1f312aa874ea 872280a34240aa23a81 8777788cd0dcd73a78f 88fa1eb33235d2815f4 8914ea9f9f9f24485aa 8934b887e3baeee49a8 8957be465837f67d7bf 8a3d347e9db07211850 8a838443acb6ae167b0 8a9bc0b7e0ebba94483 8b1d4ed82c08b6ddd1e 8b41472e56e1f751643 8bbbdb91d7949745ee2 8bfac4bcc216cfd7ba8 8c3bc4cf1172e92d57b 8c4ecd38be22f0c3783 8c886cd991eed622cbb 8d15f97a2dec1968f37 8d2ce39bd7fc7af8599 8d3c7f97b982cd6ca7b 8dda48d08bdb05e35f6 8e02280c3e6c2d32192 8e30ef3ed7a4db27892 8e417ec6cf3cef95983 8e76a3442623b2685df 8ec8b57f96d830847f3 8ee65e2051ae0d84ad6 8eecaa41911d24f470f 8f44ef9a125bc9fd5f8 900284c7faf081e67b7 9094b78ef31f99b8d80 90c05996994bf5455ad 90d349c15a4c0dfc14aa 915cc548b05fe68d838 918bd69302eca570f84 91e3176fbb6bc5f27d3 923fd7b08038b6da713 9252746a8128002e7ae 927d66db77a63a4a6af 930b50cc30616dc4d80 9315b1af49eb53438a4 93a680a1ec2044d9586 93ad516445ee72ff6ad 945680a2c0de0f1149f 94616af8c5f928c8156e 950c1d56303feacd74d 954194fd0222b3e25f8 9573287f35b5067bb7d 9593338fd3afeb1f4de 95ed40aa9033e73671a 9672fae2778c77005bb 96cd04ab76c15337b5a 96fcb7509abfaef3ff 970cd9b4fe4f1c5d6ef 97315389ad7c1c0a1a5 97c683ef347d071c750 97ec0e70f7a6a6c2a78 97f8d2d850ca093f13d4 981db04026c21399d20 9867025069bf89005f4 98e3b3ba885d46917be 98eaf8c94d825a4660f 993a25a4be93906069d 9996b4db1579cbb22cc 99aa2339c234076a9a6 99ba8792e626c1796d7 99d55e6a63ea227f98a 9a32d00d9c169534751 9a624031914513608a7 9ab7fc0022e998bca7c 9b234cb6f69c1cb75f9 9b84b4a778c3366649f 9bb1a34ffae7369978e 9c045270a51dfcc18bb 9c095bfa05bcb6244e3 9c8891d94c12de4f258 9ccfc0135e8f5baf708 9e185aa4b6435a27d49 9e1d22cd288ff7db851 9e618eb2862c23b4ee2 9f4e99f0266c9feb6cf 9f58c3add180212075b a077b406cecd7589140b a0929e0f5bfb92fb6da a0980ffdebd40b3fff2 a17f68624e7f95e1bb3 a1c05c7c09f296bb64d a1d319eecd4b4a3b5bc a21fc4433e8dbc928dd a23634e77ae2adf2165f a33f476b084cda462b6 a3b5eddaa8090c24ff2 a411941f9df58cf1802 a49ad0d5c308f2fa75d a49fe263d77b522114be a4c9c9165224203ed73 a513a053163b82329cf a53a307ce7044986705 a57b6ea3390896add79 a5e776154664bac1cdb a6da232592b019cba7c a6e328d20e89442781f a7288112935d4f67cd7 a7716ed057815e1f8bc a81481ee5e4de7cb49f a94bc91c81ad0dfa133b a96dffc388b392fa646 a98d7b402e22b4b67b3 a9f7423bb3b432df9bb aa429bd608fb3a6eff5 aa547dd07390acb72cb ab5156f89f1ef27a630 ab9d7c2a51a8f000b55 abc6673b9b4feac1459 ac5546b5a05c731116e0 aca0d863e3b9f3bc551 ad38f8270071fa98eb ad4ceabe0965bd20aec ad62e3e7d8abc074748 ae3d0e3fb0ca64bf660 aec042140e8a530964f af4feb684edffc016d2 af7e41963c29aa55699 af8fc1756d26cc852ab af9bdb60c9a3d8fb7bb afe54898720ed42b70e b023b09b609b37c7752 b0a2eeae972a97af134c b0b864f302bb3d20713 b0be81cfe2aa41861b3 b0fa8aac7997b9666ef b0fb96abe3318c7158b b13ec8562971762e6ef b1f9e2e30693887fcf2 b29460535aefc933705 b2b42e144af482415ea b2d9144c148ccaf7765 b3be3335ddf7d8b96bf b4745690401489437c9 b4ad774e5e5b68e7650 b4e84accdd286560770 b53caa8262da36346de b620129ac2a8a2c465c b632f9b7e48282066de b636b48b1e54a65dac4 b652507f09a49b217dc b67ef590fbe6548d8e6 b80ddad8cfc5aabc772 b86d6374335eca8f1657 b8ae7ce12791fb91720 b8efbfbc8f2a3bff750 b9527c1a76a204b36f4 b964d2e852d852da4cb b995d75717ef639f5f8 b9e39957828f8eec832 ba0cbe8399402913718 ba7f3d2dc3fcce987ad bb1ea46e370f8363903 bb364932784a0f3e890 bb80d235f8d5efed65f bbaff72ed4a47c15730 bbc3dbf37f12fc17838 bc19226a73586d008bd bc4b986d97932a23108b bca8d57b98f16b947b0 bcf644200909f910852 bd7ec221e8cd8960705 bd935f9366cee5b51bed bdc2562c0da394ebdde bebed41a83d63df368b bf0cd5596fcc82535fc bf590209ccd265b46b2 bffbe3f8c4139633652 c00e5c0f84747c9b920 c01af6fa613a6642622 c02dca1364303f827af c0822d893f1c3da3a7c c0b4d0cd460d120bd4c c0e08fcc7f9ffe5e662 c12807c455bfe7ff16f1 c170d58565ff5009d80 c188a80aac748f709b5 c1c48a34fe257b7f7d6 c1f9e9c2dc610397f16 c25358239149285df18 c28cfc608b00f21b7a8 c2aeca8fbe7aab3292b c2bfeb77fe01f5f35b1 c30c4dd992c68fd7b55 c34e080ed4f0800e54a c360460494eb790214c c3b471514bb0cc4b5f4 c3b872f929a10d4fc79 c401a14f38363e52d70 c4296479ef4ff4209d4 c4eef830832da80e9e3 c4fb765ab0586b6d5ac c51e813177ab79826ed c53112e48c9a8cd345f c5c13aabb660b54bcf2 c5d8e5f1f6b898da985 c6b1e452778b7a84656 c6cb59a3045203d6750 c723a20f3c8ac612556 c7c73c1c319277635f9 c7e8984bc8bfff57483 c864f1db08e462528ae c8a4bffc3c3084e6652 c95d8a824cfd3bfc75e c97d45165989bb771360 c9b6c911e0b5dd45838 ca3dd8807eb8fbeb796 ca43d6b7bc4bf2ff780 cb1a7658c74e7d4870c cb6e7ada99be0d7613b6 cb7c01b8a5c3f34d4de cb8aaec998d5ca616ca ccdc26c13dbefad73009 cd291c1fd5cc67916e7 cdb4bac60bbaa2fd78b cdd787ac93510b8398a ce13d0f7ac2211d4981 ce9e1d5008015708cdb ceb67de755b24920561 cec07ed9dffef95678e cf1658b90171593c7ad cf8cf3f38a99c343167f cfa447e965e542d5646 cfb0f3c07e60db68cfc cfb767f7ef76355587a d09654a98e70a2c35f9 d09ad1b6afd17216620 d104694251ce7c0e92b d1145814dc4addf3832 d14854b538d088555b8 d15d77a9806f39e25ea d1604bedff851da86f2 d18ba2e46d6021fd95c d1b97188c191fd836be d2036d9438307a777b1 d21e8f25758a4f9b5bb d3037a39e1a2d3857ab d3653da52ac9d4d4556 d40b376b68b2f161701 d410d04bcbe1a2b45ea d477024681c94fb3796 d4caf7718a1cdb2d960 d4f3bee1e8dfb5db7b0 d4fa4a819aaa510a486 d52883c0bf86a19e79a d52be5ebf75d508d71c d54d7ff5660135667bc d5e93888a90997d4ee2 d681d560b40fe8f7612 d6ef69c791676f49718 d70cfadc571c73f3770 d758ba7f5f6c69e375e d76108c1429a50834b5 d768c00bb4521b734e9 d77ab9a5930f9c795fb d7e2ac19146711c05df d81fd251ff08fe36815 d851a835478509a170e d8bc6bdc3f627bea556 d949be243ae178b56f1 d966e51ccfc11f944de d96f4d7e01afcb93749 d9b7b06ccbf1118bee2 da02163f37534303d71 da3e9a563626ff19890 da842c9289823cbd96b da8609dbcfc389ed748 dac1754ca6c5b68d97a dc85c1b48a63bee470f dcb1045d8755660a77f dcb918deba4eb14f773 dcdc2384fd2b8f196e2 dce1f5ca9acef959a83 dd0f88e70a85dfc814fc ddb4d178b0502e792be ddc2602d3d1740d2183e dddedcc29e4459a65fb ddfde053e53e0cfd892 de3266fb9fadbe62873 de5ba7566146affb458 de9450c798ace0e8766 df1743b36106cc36839 dfa10c18af5004bd6ec dff64ed8a8b5fbde6ef e09442f575eff3816b2 e1bfe689d02158505b6 e1d1411850436741459 e27e5b80a8654b3f56d e2cdc6e79974850ff16 e2f8705b072c3d63822 e315077a1c7f41e77f5 e35eec79a36d64156b4 e39d4508b837c69c8b4 e41dc8128f13eb2e54a e43caff1b52193ef732 e4458b715a01847c99b e44629d14b54b682f16 e44cfb25db43d330748 e45660c81f3cf68d56d e481e6cddd8e57c47af e5d2c755c62d06d66f7 e63a7dc8a2f3dce2890 e6a834002c2998ae808 e6cfa7761cf71409708 e6e8aa8f1477bfc799c e750ed28656816954de e79895082c6809848b3 e7e56f3f096673b0eb e7eeb523b7ff1b1175b e82a5ad4a08552de8f3 e89fd189faee714f586 e8b2dafb7e4b539033f e8db205ebc2ad8ae621 e983e674a966a804531 e9a0c8a38fff236d6ae e9aca4c70d7017a55b8 e9d00a2b9898015b9b4 ea1c120d78716fad76a ea23a4b5df1be00118f ea3e41d5c75a7dad6cb ea4ad750d1a7aae3bcd ea5e257042c21c17ad2 ea93686f32c208e62af ea9d4479005506b9b23 eaa1bfa2d577fba95ca eac84b17fe3c4ff8798 eaddc8b09e50666b9b6 eafb35cc46cb852573d eb1f457858c27b52707 eb677257d72b01e7746 eb6cb20fdf3f7c8668c ebe091bf034f9e88c44 ebf92533231d66c75fb ec2b884af5e5e511871 ec5498ecd5fafabe7f8 ec681200d112700b5b8 ec9ad243d44720bf706 ec9fd076a5ba43bd6b5 ecf9c8152686acc04de ed0c8296cb62ebe316d7 ed622792e03f5affd3b ed96010700d48919c99 ee3b1f47d9f291952c9 ee4630f9db50decb781 ee9b1705c8b0304d14eb eee70441bd1b0930d4c ef582332c32b2cd15fb efbad2fb6d9f5537654 efc2cb9097dd13b9d2c f03d2ec99b0c60cd77c f06b6b3e167f275b7b9 f07e843334a39c17752 f0f75007dd4368ee78b f1955a3acb7ee5125fb f1b2df35b43ea66482a f1e0fa24cd8f20346ca f2750d4ef3efee88d3d f2900a030f07da985a8 f2be1132e77b601dd70 f34f243a343c7c7a4a1 f37a9b833eed2ed0991 f3eacb2a7f846533809 f40270ecf80d23d371a f4b7d8fd215ecaecd70 f4d52111f3d7cee8556 f5236d962f1e2c24556 f569281d34337b6d5b8 f5a09740e424311249f f5ac27ac975cad0f6b4 f5b9bee7ca0b86b9703 f5ba630c9946a313134b f5ee80423588dfb7766 f617e9f50eb7ee414de f69990daea258d669b4 f6a1d042b5d040e56dc f6c55aa64cc6b17745f f6dcd21f29bad8804de f70265f9a3380e92887 f71dbd9f64b2cf1c7c1 f72123e159afaed48e3 f766cf0630d180547f0 f77bbdf42075e38384a f7a37317dad3f44c65e f7cae9ceeda68e78b63 f7eae30513d1bcd91bf f836e244f334894d7ad f8805a93ad2311bf700 f8faa636928af1e987a f8faaf191759d6b5ae8 f96532c153de471b556 f9665ab01e2d677678d f9855340e86e58006e2 fa032e7280270111628 fa2998ef23e2b33a6b3 fac2cef3cda8c501458 fb7dbbff0829241c5dd fbe487ea8aa1c80a7dc fbe7af37016e2b3695c fc0797acdf902dd1cdb fcad6745b14c2439d80 fd2bb83d5f4cd7186af fd754ea4d099abee66a fd76403706a4d34ad79 fd8ea78d0a4da3a24a7 fdde1282c8a5b706c13 fe3335df1c03f93914e fe480f4b8361377d5f9 fe4dcbf4cf50147b829 fe5f1e2d37e2d013d79 ff525e54bb5ae8f6119b ff83ef32c75449265c8 ff98e21c8111ad306de";function $e(i,e,t=1,a={}){let o=Math.max(1,Math.ceil(e.w*t)),n=Math.max(1,Math.ceil(e.h*t)),r=a.paint??i.paint,s=a.light?ze(e,a.light):"";return `<svg xmlns="http://www.w3.org/2000/svg" width="${o}" height="${n}" viewBox="0 0 ${e.w} ${e.h}"${r?` color="${r}"`:""}>${s}<g stroke-linejoin="round" stroke-linecap="round"${s?' filter="url(#cel)"':""}>${i.svg}</g></svg>`}var _={depth:.18,min:2.6,max:11,dark:.3,shine:.36};function ze(i,e){let t=Math.max(_.min,Math.min(_.max,Math.min(i.w,i.h)*_.depth)),a=o=>+o.toFixed(2);return `<defs><filter id="cel" filterUnits="userSpaceOnUse" x="0" y="0" width="${i.w}" height="${i.h}" color-interpolation-filters="sRGB"><feMorphology in="SourceAlpha" operator="erode" radius="${a(3.6*.7)}" result="body"/><feOffset in="body" dx="${a(e.x*t)}" dy="${a(e.y*t)}" result="moved"/><feComposite in="body" in2="moved" operator="out" result="far"/><feFlood flood-color="#000000" flood-opacity="${_.dark}"/><feComposite in2="far" operator="in" result="dark"/><feMorphology in="SourceAlpha" operator="erode" radius="${a(3.6*1.05)}" result="inner"/><feOffset in="inner" dx="${a(-e.x*t*.42)}" dy="${a(-e.y*t*.42)}" result="back"/><feComposite in="inner" in2="back" operator="out" result="near"/><feFlood flood-color="#ffffff" flood-opacity="${_.shine}"/><feComposite in2="near" operator="in" result="shine"/><feMerge><feMergeNode in="SourceGraphic"/><feMergeNode in="dark"/><feMergeNode in="shine"/></feMerge></filter></defs>`}var Ee=new WeakMap,Ze=null,Qe=()=>Ze??=new Set(ue.split(" "));function et(i){let e=3735928559,t=1103547991;for(let a=0;a<i.length;a++){let o=i.charCodeAt(a);e=Math.imul(e^o,2654435761),t=Math.imul(t^o,1597334677);}return e=Math.imul(e^e>>>16,2246822507)^Math.imul(t^t>>>13,3266489909),t=Math.imul(t^t>>>16,2246822507)^Math.imul(e^e>>>13,3266489909),(t>>>0).toString(16).padStart(8,"0")+(e>>>0).toString(16).padStart(8,"0")+i.length.toString(16)}function Oe(i,e){return new Promise(t=>{let a=new Image;e&&(a.crossOrigin="anonymous"),a.onload=()=>{e&&typeof a.decode=="function"?a.decode().then(()=>t(a),()=>t(a)):t(a);},a.onerror=()=>t(null),a.src=i;})}function Fe(i,e,t,a={}){let o=a.paint??null,n=a.light??null,r=`${e.w}x${e.h}@${t}|${o??""}|${n?`${n.x},${n.y}`:""}`,s=Ee.get(i);s||Ee.set(i,s=new Map);let d=s.get(r);if(d)return d;let c=$e(i,e,t,{paint:o,light:n}),f=()=>Oe("data:image/svg+xml;charset=utf-8,"+encodeURIComponent(c),false),b=et(c);return d=Qe().has(b)?Oe(`${Xe}${b}.png`,true).then(h=>h??f()):f(),s.set(r,d),d}var He=new WeakMap;function tt(i,e,t){return `chr:${i}@${e}${t||""}`}function We(i,e,t,a,o,n,r={}){let s=t.paint?r.paint??null:null,d=tt(e,o,s);if(i.exists(d))return d;let c=He.get(i);c||He.set(i,c=new Map);let f=c.get(d);if(f)return f.push(n),null;let b=[n];return c.set(d,b),Fe(t,a,o,{paint:s,light:r.light??null}).then(h=>{h?i.exists(d)||i.addImage(d,h):console.warn(`[character] art ${e} did not render`),c.delete(d);for(let p of b)p();}),null}function me(i,e,t=2){return {has:a=>e.has(a),texture(a,o,n,r){let s=e.get(a);return s?We(i,a,s,o,t,n,r):null}}}function at(i,e){return new Promise(t=>{let{width:a,height:o}=e,n=Math.min(2,Math.max(1,typeof devicePixelRatio=="number"&&devicePixelRatio||1));class r extends F__default.default.Scene{create(){this.cameras.main.setOrigin(0,0).setZoom(n);let c=e.scale??1,f=me(this.textures,e.catalog,Math.max(2,Math.ceil(c*n*1.5))),b=new j(this,{rig:e.rig,art:f,...e.look?{look:e.look}:{},x:a/2,y:Math.round(o*.88),scale:c});t({view:b,game:s,vector:f,destroy:()=>s.destroy(true)});}}let s=new F__default.default.Game({type:F__default.default.WEBGL,parent:i,width:Math.ceil(a*n),height:Math.ceil(o*n),scale:{mode:F__default.default.Scale.NONE,zoom:1/n},render:{autoMobileTextures:false},transparent:!e.background,...e.background?{backgroundColor:e.background}:{},scene:r,banner:false,audio:{noAudio:true}});})}
|
|
2
|
+
exports.CharacterView=j;exports.createCharacterStage=at;exports.vectorArt=me;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as CharacterView,c as createCharacterStage,b as vectorArt}from'../../chunk-
|
|
1
|
+
export{a as CharacterView,c as createCharacterStage,b as vectorArt}from'../../chunk-I7UPBAMR.js';import'../../chunk-CMQ6UYQV.js';import'../../chunk-UUX4NEC2.js';
|
package/dist/voxel/index.cjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
'use strict';var _=require('three');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var ___namespace=/*#__PURE__*/_interopNamespace(_);function we(t){let e=t>>>0;return function(){e|=0,e=e+1831565813|0;let r=Math.imul(e^e>>>15,1|e);return r=r+Math.imul(r^r>>>7,61|r)^r,((r^r>>>14)>>>0)/4294967296}}function ae(t){let e=2166136261;for(let r=0;r<t.length;r++)e^=t.charCodeAt(r),e=Math.imul(e,16777619);return e>>>0}var Bt=["ru","kk","uk","be","ky","uz","tg"],Dt="idos:language",jt="idos:language";function Vt(){try{let e=globalThis.localStorage?.getItem(Dt);if(e==="en"||e==="ru")return e}catch{}if(typeof navigator>"u")return "en";let t=(navigator.language||"").toLowerCase();return Bt.some(e=>t.startsWith(e))?"ru":"en"}var lt=Vt();typeof window<"u"&&window.addEventListener(jt,t=>{let e=t.detail;(e==="en"||e==="ru")&&(lt=e);});function A(t,e){let r=typeof t=="string"?t:t[lt]??t.en;if(e)for(let[o,s]of Object.entries(e))r=r.split(`{${o}}`).join(String(s));return r}function ct(t){let e=t.trim(),r=/```(?:json)?\s*([\s\S]*?)(?:```|$)/i.exec(e);r&&r[1]!==void 0&&(e=r[1]);let o=e.indexOf("{");if(o<0)return {ok:false,error:A({en:"the answer has no JSON object",ru:"\u0432 \u043E\u0442\u0432\u0435\u0442\u0435 \u043D\u0435\u0442 JSON-\u043E\u0431\u044A\u0435\u043A\u0442\u0430"}),truncated:false};let s=0,a=false,n=false,i=-1;for(let l=o;l<e.length;l++){let c=e[l];if(a){n?n=false:c==="\\"?n=true:c==='"'&&(a=false);continue}if(c==='"')a=true;else if(c==="{"||c==="[")s++;else if((c==="}"||c==="]")&&(s--,s===0)){i=l;break}}if(i<0)return {ok:false,error:A({en:"the JSON is cut off",ru:"JSON \u043E\u0431\u043E\u0440\u0432\u0430\u043D"}),truncated:true};try{return {ok:!0,value:JSON.parse(e.slice(o,i+1))}}catch{return {ok:false,error:A({en:"invalid JSON",ru:"\u043D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u044B\u0439 JSON"}),truncated:false}}}var pt={id:"blob",label:"\u041A\u0430\u043F\u043B\u044F",hint:"slimes, ghosts, spirits, living objects \u2014 one body with a face, moves by hopping",bones:[{name:"body",role:"body",parent:null,pivot:[0,0,0]}],sockets:[{name:"headTop",bone:"body",at:[0,12,0]},{name:"face",bone:"body",at:[0,7,-6]},{name:"back",bone:"body",at:[0,6,6]},{name:"waist",bone:"body",at:[0,3,0]},{name:"shoulders",bone:"body",at:[0,10,0]},{name:"handR",bone:"body",at:[6,5,-2]},{name:"handL",bone:"body",at:[-6,5,-2]}],hitbox:{w:.8,h:.8},eye:8,height:{min:4,max:40},faceBone:"body",defaultParts:[{bone:"body",size:[12,12,12],pos:[0,6,0],color:"t"}]};var ht={id:"flyer",label:"\u041A\u0440\u044B\u043B\u0430\u0442\u044B\u0439",hint:"birds, bats, dragons, fairies, insects \u2014 creatures whose wings matter",bones:[{name:"body",role:"body",parent:null,pivot:[0,6,0]},{name:"head",role:"head",parent:"body",pivot:[0,11,-3]},{name:"wingL",role:"wingL",parent:"body",pivot:[-3,10,0]},{name:"wingR",role:"wingR",parent:"body",pivot:[3,10,0]},{name:"legL",role:"legL",parent:null,pivot:[-1.5,4,0]},{name:"legR",role:"legR",parent:null,pivot:[1.5,4,0]},{name:"tail",role:"tail",parent:"body",pivot:[0,8,4]}],sockets:[{name:"headTop",bone:"head",at:[0,16,-4]},{name:"face",bone:"head",at:[0,13,-7]},{name:"back",bone:"body",at:[0,11,1]},{name:"waist",bone:"body",at:[0,6,0]},{name:"shoulders",bone:"body",at:[0,10,-2]},{name:"handR",bone:"legR",at:[1.5,0,-1]},{name:"handL",bone:"legL",at:[-1.5,0,-1]}],hitbox:{w:.6,h:.9},eye:14,height:{min:6,max:40},faceBone:"head",defaultParts:[{bone:"body",size:[6,6,8],pos:[0,8,0],color:"t"},{bone:"head",size:[5,5,5],pos:[0,13,-4],color:"s"},{bone:"wingL",size:[8,1,6],pos:[-7,10,0],color:"t"},{bone:"wingR",size:[8,1,6],pos:[7,10,0],color:"t"},{bone:"legL",size:[1,4,1],pos:[-1.5,2,0],color:"p"},{bone:"legR",size:[1,4,1],pos:[1.5,2,0],color:"p"},{bone:"tail",size:[4,1,4],pos:[0,8,6],color:"t"}]};var mt={id:"humanoid",label:"\u0427\u0435\u043B\u043E\u0432\u0435\u043A",hint:"people, humanoids, robots, elves, zombies \u2014 anything on two legs with two arms",bones:[{name:"body",role:"body",parent:null,pivot:[0,12,0]},{name:"head",role:"head",parent:"body",pivot:[0,24,0]},{name:"armL",role:"armL",parent:"body",pivot:[-6,22,0]},{name:"armR",role:"armR",parent:"body",pivot:[6,22,0]},{name:"legL",role:"legL",parent:null,pivot:[-2,12,0]},{name:"legR",role:"legR",parent:null,pivot:[2,12,0]}],sockets:[{name:"handR",bone:"armR",at:[6,11,-1]},{name:"handL",bone:"armL",at:[-6,11,-1]},{name:"headTop",bone:"head",at:[0,32,0]},{name:"face",bone:"head",at:[0,28,-4]},{name:"back",bone:"body",at:[0,18,2]},{name:"waist",bone:"body",at:[0,12,0]},{name:"shoulders",bone:"body",at:[0,24,0]}],hitbox:{w:.6,h:1.8},eye:27,height:{min:16,max:48},faceBone:"head",defaultParts:[{bone:"head",size:[8,8,8],pos:[0,28,0],color:"s"},{bone:"body",size:[8,12,4],pos:[0,18,0],color:"t"},{bone:"armL",size:[4,12,4],pos:[-6,18,0],color:"s"},{bone:"armR",size:[4,12,4],pos:[6,18,0],color:"s"},{bone:"legL",size:[4,12,4],pos:[-2,6,0],color:"p"},{bone:"legR",size:[4,12,4],pos:[2,6,0],color:"p"}]};var dt={id:"quadruped",label:"\u0427\u0435\u0442\u0432\u0435\u0440\u043E\u043D\u043E\u0433\u043E\u0435",hint:"dogs, cats, horses, wolves, bears, lizards \u2014 any animal on four legs",bones:[{name:"body",role:"body",parent:null,pivot:[0,12,0]},{name:"head",role:"head",parent:"body",pivot:[0,14,-8]},{name:"legFL",role:"legFL",parent:null,pivot:[-3,8,-6]},{name:"legFR",role:"legFR",parent:null,pivot:[3,8,-6]},{name:"legBL",role:"legBL",parent:null,pivot:[-3,8,6]},{name:"legBR",role:"legBR",parent:null,pivot:[3,8,6]},{name:"tail",role:"tail",parent:"body",pivot:[0,14,8]}],sockets:[{name:"headTop",bone:"head",at:[0,20,-12]},{name:"face",bone:"head",at:[0,16,-16]},{name:"back",bone:"body",at:[0,16,0]},{name:"waist",bone:"body",at:[0,12,4]},{name:"shoulders",bone:"body",at:[0,16,-6]},{name:"handR",bone:"head",at:[2,13,-16]},{name:"handL",bone:"head",at:[-2,13,-16]}],hitbox:{w:.9,h:1},eye:17,height:{min:8,max:40},faceBone:"head",defaultParts:[{bone:"body",size:[8,8,16],pos:[0,12,0],color:"t"},{bone:"head",size:[8,8,8],pos:[0,16,-12],color:"s"},{bone:"legFL",size:[3,8,3],pos:[-3,4,-6],color:"p"},{bone:"legFR",size:[3,8,3],pos:[3,4,-6],color:"p"},{bone:"legBL",size:[3,8,3],pos:[-3,4,6],color:"p"},{bone:"legBR",size:[3,8,3],pos:[3,4,6],color:"p"},{bone:"tail",size:[2,2,8],pos:[0,14,12],color:"t"}]};var Oo=["root","body","head","armL","armR","legL","legR","legFL","legFR","legBL","legBR","tail","wingL","wingR","ear","hair","cape","antenna","static"],ke=["tail","wingL","wingR","ear","hair","cape","antenna","static"],Po=["handR","handL","headTop","face","back","waist","shoulders"],be=["humanoid","quadruped","flyer","blob"];var J={humanoid:mt,quadruped:dt,flyer:ht,blob:pt};var ut=1,De=["front","back","left","right","top","bottom"],je=["neutral","blink","happy","sad","angry","surprised","scared","tired","hurt","talk"],Ve=["normal","bouncy","heavy","sneaky","robotic"],Ge=["calm","fidgety","proud"],yt={parts:64,bones:16,palette:32,textures:48,texturePixels:32768,textureSide:32,partSide:32,coord:64},he={noise:.5,outline:.4,shade:.25,density:2},j=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),ge=t=>Array.isArray(t)?t:[];function W(t,e,r,o){let s=typeof t=="number"?t:typeof t=="string"?Number(t):NaN;return Number.isFinite(s)?Math.min(o,Math.max(r,s)):e}function He(t,e,r){if(typeof t!="string")return r;let o=t.trim();if(e.includes(o))return o;let s=o.toLowerCase().replace(/[\s-]+/g,"_");return e.find(n=>n.toLowerCase()===s)??r}function te(t,e,r){return typeof t=="string"?t.trim().slice(0,r):e}function Ee(t,e,r=null){if(!Array.isArray(t)||t.length<3)return r;let o=t.slice(0,3).map(s=>W(s,NaN,-e,e));return o.every(Number.isFinite)?o:r}var ft={black:"#1d1d21",white:"#f0f0f0",gray:"#808080",grey:"#808080",red:"#c0392b",green:"#3c9a3c",blue:"#2f5fd0",yellow:"#f2d33c",orange:"#e8862a",purple:"#8a4fc4",pink:"#f08cb4",brown:"#7a4f2a",cyan:"#2ab0c0",gold:"#d8b030",silver:"#c0c4c8",skin:"#c69c7c"};function bt(t){if(typeof t!="string")return null;let e=t.trim().toLowerCase();if(ft[e])return ft[e];let r=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/.exec(e);if(!r)return null;let o=r[1];return "#"+(o.length===3?o.split("").map(s=>s+s).join(""):o)}var ye=new Set(["."," "]),gt=t=>/^[A-Za-z0-9_]{1,24}$/.test(t),Gt={human:"humanoid",biped:"humanoid",person:"humanoid",animal:"quadruped",four_legs:"quadruped",quadrupedal:"quadruped",bird:"flyer",winged:"flyer",dragon:"flyer",slime:"blob",ghost:"blob"};function Ut(t){if(typeof t!="string")return "humanoid";let e=t.trim().toLowerCase().replace(/[\s-]+/g,"_");return be.includes(e)?e:Gt[e]??"humanoid"}function xt(t,e){let r=/^(.*?)(L|R)$/.exec(t);if(!r)return t;let o=r[1]+(r[2]==="L"?"R":"L");return e(o)?o:t}function q(t){if(typeof t=="string"){let m=ct(t);if(!m.ok)return {ok:false,error:m.error,truncated:m.truncated};t=m.value;}if(!j(t))return {ok:false,error:A({en:"the character recipe is not an object",ru:"\u0440\u0435\u0446\u0435\u043F\u0442 \u043F\u0435\u0440\u0441\u043E\u043D\u0430\u0436\u0430 \u2014 \u043D\u0435 \u043E\u0431\u044A\u0435\u043A\u0442"})};if(!("parts"in t)&&!("rig"in t)){let m=t.character??t.spec??t.characterSpec;j(m)&&(t=m);}let e=t,r=yt,o=[];typeof e.version=="number"&&e.version>ut&&o.push(A({en:"recipe version {v} is newer than the game \u2014 read what could be read",ru:"\u0440\u0435\u0446\u0435\u043F\u0442 \u0432\u0435\u0440\u0441\u0438\u0438 {v} \u2014 \u043D\u043E\u0432\u0435\u0435 \u0438\u0433\u0440\u044B, \u0440\u0430\u0437\u043E\u0431\u0440\u0430\u043D\u043E \u0447\u0442\u043E \u043F\u043E\u043D\u044F\u0442\u043D\u043E"},{v:e.version}));let s=Ut(e.rig),a=J[s],n={};if(j(e.palette))for(let[m,k]of Object.entries(e.palette)){if(Object.keys(n).length>=r.palette){o.push(A({en:"the palette is longer than {n} \u2014 the rest was dropped",ru:"\u043F\u0430\u043B\u0438\u0442\u0440\u0430 \u0434\u043B\u0438\u043D\u043D\u0435\u0435 {n} \u2014 \u043B\u0438\u0448\u043D\u0435\u0435 \u043E\u0442\u0431\u0440\u043E\u0448\u0435\u043D\u043E"},{n:r.palette}));break}let y=bt(k);if(m.length!==1||ye.has(m)||!y){o.push(A({en:"palette colour \xAB{k}\xBB was not understood",ru:"\u0446\u0432\u0435\u0442 \u043F\u0430\u043B\u0438\u0442\u0440\u044B \xAB{k}\xBB \u043D\u0435 \u043F\u043E\u043D\u044F\u0442"},{k:m}));continue}n[m]=y;}let i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",l=(m,k)=>{if(typeof m!="string")return k;if(m.length===1&&n[m])return m;let y=bt(m);if(!y)return k;let M=Object.entries(n).find(([,d])=>d===y);if(M)return M[0];if(Object.keys(n).length>=r.palette)return k;let h=[...i].find(d=>!n[d]);return h?(n[h]=y,h):k},c={},u=0;if(j(e.textures))for(let[m,k]of Object.entries(e.textures)){if(!gt(m)){o.push(A({en:"texture name \xAB{id}\xBB does not fit",ru:"\u0438\u043C\u044F \u0442\u0435\u043A\u0441\u0442\u0443\u0440\u044B \xAB{id}\xBB \u043D\u0435 \u043F\u043E\u0434\u0445\u043E\u0434\u0438\u0442"},{id:m.slice(0,30)}));continue}if(Object.keys(c).length>=r.textures){o.push(A({en:"more than {n} textures \u2014 the rest were dropped",ru:"\u0442\u0435\u043A\u0441\u0442\u0443\u0440 \u0431\u043E\u043B\u044C\u0448\u0435 {n} \u2014 \u043B\u0438\u0448\u043D\u0438\u0435 \u043E\u0442\u0431\u0440\u043E\u0448\u0435\u043D\u044B"},{n:r.textures}));break}let y=$t(k,n,o,m);if(y){if(u+y.w*y.h>r.texturePixels){o.push(A({en:"texture \xAB{id}\xBB did not fit the pixel limit",ru:"\u0442\u0435\u043A\u0441\u0442\u0443\u0440\u0430 \xAB{id}\xBB \u043D\u0435 \u0432\u043B\u0435\u0437\u043B\u0430 \u0432 \u043B\u0438\u043C\u0438\u0442 \u043F\u0438\u043A\u0441\u0435\u043B\u0435\u0439"},{id:m}));continue}u+=y.w*y.h,c[m]=y;}}let b=new Set(a.bones.map(m=>m.name)),g=[];for(let m of ge(e.bones)){if(!j(m))continue;let k=te(m.name,"",24);if(!k||!gt(k))continue;let y=Ee(m.pivot,r.coord);if(!y||g.some(x=>x.name===k))continue;if(g.length>=r.bones){o.push(A({en:"more than {n} bones \u2014 the rest were dropped",ru:"\u043A\u043E\u0441\u0442\u0435\u0439 \u0431\u043E\u043B\u044C\u0448\u0435 {n} \u2014 \u043B\u0438\u0448\u043D\u0438\u0435 \u043E\u0442\u0431\u0440\u043E\u0448\u0435\u043D\u044B"},{n:r.bones}));break}let M=b.has(k),h=te(m.parent,"",24),d=M?a.bones.find(x=>x.name===k).parent??"":b.has(h)||g.some(x=>x.name===h)?h:a.bones.find(x=>x.role==="body").name;g.push({name:k,parent:d,pivot:y,role:M?"static":He(m.role,ke,"static")}),b.add(k);}let E=Object.keys(n)[0]??"s",R=[];for(let m of ge(e.parts)){if(R.length>=r.parts){o.push(A({en:"more than {n} parts \u2014 the rest were dropped",ru:"\u0434\u0435\u0442\u0430\u043B\u0435\u0439 \u0431\u043E\u043B\u044C\u0448\u0435 {n} \u2014 \u043B\u0438\u0448\u043D\u0438\u0435 \u043E\u0442\u0431\u0440\u043E\u0448\u0435\u043D\u044B"},{n:r.parts}));break}if(!j(m))continue;let k=Ee(m.size,r.partSide),y=Ee(m.pos??m.center??m.at,r.coord);if(!k||!y||k.some(f=>f<=0))continue;let M=te(m.bone,"",24);b.has(M)||(M&&o.push(A({en:"bone \xAB{b}\xBB not found \u2014 the part is on the body",ru:"\u043A\u043E\u0441\u0442\u044C \xAB{b}\xBB \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u0430 \u2014 \u0434\u0435\u0442\u0430\u043B\u044C \u043D\u0430 \u0442\u0435\u043B\u0435"},{b:M})),M=a.bones.find(f=>f.role==="body").name);let h={bone:M,size:k,pos:y,color:l(m.color,E)};if(j(m.faces)){let f={};for(let O of De){let I=m.faces[O];if(typeof I=="string")if(c[I])f[O]=I;else {let V=l(I,"");V&&(f[O]=V);}}Object.keys(f).length&&(h.faces=f);}let d=Ee(m.rot??m.rotation,180);d&&d.some(f=>f!==0)&&(h.rot=d),(m.mirror===true||m.mirror==="x")&&(h.mirror=true);let x=te(m.name,"",24);x&&(h.name=x),R.push(h);}if(!R.length){for(let[m,k]of Object.entries(Wt))n[m]||(n[m]=k);R.push(...a.defaultParts.map(Kt));}let F=null;if(j(e.face)){let m=e.face,k=b.has(te(m.bone,"",24))?te(m.bone,"",24):a.faceBone,y=ge(m.rect).map(h=>Math.round(W(h,NaN,0,r.partSide))),M={};if(j(m.expressions))for(let h of je){let d=m.expressions[h];typeof d=="string"&&c[d]&&(M[h]=d);}if(!M.neutral){let h=Object.values(M)[0];h&&(M.neutral=h);}if(M.neutral){let h=c[M.neutral];F={bone:k,rect:y.length===4&&y.every(Number.isFinite)&&y[2]>0&&y[3]>0?y:[0,0,h.w,h.h],expressions:M};}else Object.keys(m).length&&o.push(A({en:"the face has no pictures \u2014 no face is drawn",ru:"\u0443 \u043B\u0438\u0446\u0430 \u043D\u0435\u0442 \u043D\u0438 \u043E\u0434\u043D\u043E\u0439 \u043A\u0430\u0440\u0442\u0438\u043D\u043A\u0438 \u2014 \u043B\u0438\u0446\u043E \u043D\u0435 \u043D\u0430\u0440\u0438\u0441\u043E\u0432\u0430\u043D\u043E"}));}let K=j(e.style)?e.style:{},T=j(e.voice)?e.voice:{},L=j(e.finish)?e.finish:{};return {ok:true,spec:{version:ut,name:te(e.name,Re(),40)||Re(),description:te(e.description,"",300),rig:s,scale:W(e.scale,1,.25,3),palette:n,textures:c,parts:R,bones:g,face:F,style:{walk:He(K.walk,Ve,"normal"),idle:He(K.idle,Ge,"calm"),energy:W(K.energy,.5,0,1)},voice:{pitch:W(T.pitch,1,.5,2)},tags:ge(e.tags).filter(m=>typeof m=="string"&&!!m.trim()).slice(0,8).map(m=>m.trim().slice(0,24)),finish:{noise:W(L.noise,he.noise,0,1),outline:W(L.outline,he.outline,0,1),shade:W(L.shade,he.shade,0,1),density:Math.round(W(L.density,he.density,1,4))}},warnings:o}}var Wt={s:"#c69c7c",t:"#3a8fd6",p:"#2c3e6b"};function Kt(t){return JSON.parse(JSON.stringify(t))}function $t(t,e,r,o){let s=Array.isArray(t)?{rows:t}:j(t)?t:null;if(!s)return null;let a=yt.textureSide,n=ge(s.rows??s.pixels).filter(u=>typeof u=="string");if(!n.length)return null;let i=Math.round(W(s.h??s.height,n.length,1,a)),l=Math.round(W(s.w??s.width,Math.max(...n.map(u=>u.length)),1,a)),c=false;for(n=n.slice(0,i).map(u=>{let b="";for(let g=0;g<l;g++){let E=u[g]??".";ye.has(E)||e[E]?b+=E===" "?".":E:(c=true,b+=".");}return b});n.length<i;)n.push(".".repeat(l));return c&&r.push(A({en:"texture \xAB{id}\xBB has symbols not in the palette \u2014 they became transparent",ru:"\u0432 \u0442\u0435\u043A\u0441\u0442\u0443\u0440\u0435 \xAB{id}\xBB \u0441\u0438\u043C\u0432\u043E\u043B\u044B \u043D\u0435 \u0438\u0437 \u043F\u0430\u043B\u0438\u0442\u0440\u044B \u2014 \u0441\u0442\u0430\u043B\u0438 \u043F\u0440\u043E\u0437\u0440\u0430\u0447\u043D\u044B\u043C\u0438"},{id:o})),{w:l,h:i,rows:n}}function Be(t){return Array.isArray(t)?"["+t.map(Be).join(",")+"]":j(t)?"{"+Object.keys(t).filter(e=>t[e]!==void 0).sort().map(e=>JSON.stringify(e)+":"+Be(t[e])).join(",")+"}":JSON.stringify(t)}function me(t){let e=Be(t),r=ae(e),o=ae("~"+e);return r.toString(16).padStart(8,"0")+o.toString(16).padStart(8,"0")}function Uo(t){return J[t.rig]}function wt(t){let r=J[t.rig].bones.map(o=>{let s=t.bones.find(a=>a.name===o.name);return {name:o.name,role:o.role,parent:o.parent,pivot:(s?.pivot??o.pivot).slice()}});for(let o of t.bones)r.some(s=>s.name===o.name)||r.push({name:o.name,role:o.role,parent:o.parent,pivot:o.pivot.slice()});return r}function Re(){return A({en:"Character",ru:"\u041F\u0435\u0440\u0441\u043E\u043D\u0430\u0436"})}var Wo=t=>t==="\u041F\u0435\u0440\u0441\u043E\u043D\u0430\u0436"||t==="Character";var Yt={front:{tl:[1,1,-1],u:[-1,0,0],d:[0,-1,0],n:[0,0,-1]},back:{tl:[-1,1,1],u:[1,0,0],d:[0,-1,0],n:[0,0,1]},right:{tl:[1,1,1],u:[0,0,-1],d:[0,-1,0],n:[1,0,0]},left:{tl:[-1,1,-1],u:[0,0,1],d:[0,-1,0],n:[-1,0,0]},top:{tl:[1,1,1],u:[-1,0,0],d:[0,0,-1],n:[0,1,0]},bottom:{tl:[-1,-1,1],u:[1,0,0],d:[0,0,-1],n:[0,-1,0]}};function Ue(t){let e=parseInt(t.slice(1),16);return [e>>16&255,e>>8&255,e&255]}function kt(t,e,r,o,s,a){let n=((r-1-s)*e+o)*4;t[n]=a[0],t[n+1]=a[1],t[n+2]=a[2],t[n+3]=255;}function Xt(t){t.sort((e,r)=>r.h-e.h||r.w-e.w||(e.key<r.key?-1:1));for(let e=16;;e*=2){let r=0,o=0,s=0;for(let n of t)r+n.w>e&&(r=0,o+=s,s=0),n.x=r,n.y=o,r+=n.w,s=Math.max(s,n.h);let a=o+s;if(a<=e||e>=1024){let n=16;for(;n<a;)n*=2;return {w:e,h:n}}}}function Et(t,e,r){let o=Math.imul(e,374761393)+Math.imul(r,668265263)+Math.imul(t,2246822519);return o=Math.imul(o^o>>>13,1274126177),((o^o>>>16)>>>0)/4294967296}function Jt(t,e,r,o,s,a,n,i){let c=1+(.55*Et(n,e,r)+.45*Et(n^1540483477,Math.floor(e/3),Math.floor(r/3))-.5)*2*i.noise*.14;return a==="s"?c+=i.shade*.16*(.5-(r+.5)/s):a==="t"?c+=i.shade*.08:c-=i.shade*.2,o>=3&&s>=3&&(e===0||r===0||e===o-1||r===s-1)&&(c*=1-.5*i.outline),[Math.max(0,Math.min(255,t[0]*c)),Math.max(0,Math.min(255,t[1]*c)),Math.max(0,Math.min(255,t[2]*c))]}var We=Math.PI/180;function Rt(t,e){if(!e)return t;let[r,o,s]=t,[a,n,i]=[e[0]*We,e[1]*We,e[2]*We],l=Math.cos(i),c=Math.sin(i);return [r,o]=[r*l-o*c,r*c+o*l],l=Math.cos(n),c=Math.sin(n),[r,s]=[r*l+s*c,-r*c+s*l],l=Math.cos(a),c=Math.sin(a),[o,s]=[o*l-s*c,o*c+s*l],[r,o,s]}function qt(t,e){let r=[];for(let o of t.parts){if(r.push({...o,flip:false}),!o.mirror)continue;let s=o.faces?{...o.faces,left:o.faces.right,right:o.faces.left}:void 0;s&&(s.left===void 0&&delete s.left,s.right===void 0&&delete s.right);let a={...o,bone:xt(o.bone,e),pos:[-o.pos[0],o.pos[1],o.pos[2]],flip:true};s?a.faces=s:delete a.faces,o.rot&&(a.rot=[o.rot[0],-o.rot[1],-o.rot[2]]),r.push(a);}return r}function St(t){let e=J[t.rig],r=wt(t),o=h=>r.some(d=>d.name===h),s=qt(t,o),a=t.finish??he,n=new Map,i=(h,d)=>{let x=h.faces?.[d],f=x!==void 0?t.textures[x]:void 0,O=x!==void 0&&t.palette[x]?x:h.color,[I,V]=d==="front"||d==="back"?[h.size[0],h.size[1]]:d==="left"||d==="right"?[h.size[2],h.size[1]]:[h.size[0],h.size[2]],C=(pe,oe)=>Math.max(1,Math.min(64,oe*Math.max(1,Math.round(pe*a.density/oe)))),H=f?C(I,f.w):C(I,1),B=f?C(V,f.h):C(V,1),P=d==="top"?"t":d==="bottom"?"b":"s",N=(f?"t:"+x:"c:"+O)+"|"+H+"x"+B+P,D=n.get(N);if(D)return D;let Q=ae(N),ee=f?null:Ue(t.palette[O]??"#ff00ff");return D={key:N,w:H,h:B,x:0,y:0,paint:(pe,oe,Ne,ne,se)=>{for(let X=0;X<B;X++)for(let U=0;U<H;U++){let st=ee;if(f){let at=f.rows[Math.floor(X*f.h/B)][Math.floor(U*f.w/H)];if(ye.has(at))continue;let it=t.palette[at];if(!it)continue;st=Ue(it);}kt(pe,oe,Ne,ne+U,se+X,Jt(st,U,X,H,B,P,Q,a));}}},n.set(N,D),D},l=(h,d)=>{let x="e:"+h,f=n.get(x);return f||(f={key:x,w:d.w,h:d.h,x:0,y:0,paint:(O,I,V,C,H)=>{for(let B=0;B<d.h;B++)for(let P=0;P<d.w;P++){let N=d.rows[B][P];if(ye.has(N))continue;let D=t.palette[N];D&&kt(O,I,V,C+P,H+B,Ue(D));}}},n.set(x,f)),f},c=s.map(h=>({p:h,faces:De.map(d=>({f:d,cell:i(h,d)}))})),u=t.face,b=[];if(u)for(let[h,d]of Object.entries(u.expressions)){let x=t.textures[d];x&&b.push([h,l(d,x)]);}let{w:g,h:E}=Xt([...n.values()]),R=new Uint8Array(g*E*4);for(let h of n.values())h.paint(R,g,E,h.x,h.y);let F=.01,K=h=>[(h.x+F)/g,1-(h.y+F)/E,(h.x+h.w-F)/g,1-(h.y+h.h-F)/E],T=new Map;for(let h of r)T.set(h.name,{pos:[],nrm:[],uv:[],idx:[]});let L=0;for(let{p:h,faces:d}of c){let x=T.get(h.bone),f=r.find(I=>I.name===h.bone).pivot,O=[h.size[0]/2,h.size[1]/2,h.size[2]/2];L=Math.max(L,h.pos[1]+O[1]);for(let{f:I,cell:V}of d){let C=Yt[I],H=(ne,se)=>{let X=[O[0]*(C.tl[0]+2*(C.u[0]*ne+C.d[0]*se)),O[1]*(C.tl[1]+2*(C.u[1]*ne+C.d[1]*se)),O[2]*(C.tl[2]+2*(C.u[2]*ne+C.d[2]*se))],U=Rt(X,h.rot);return [h.pos[0]+U[0]-f[0],h.pos[1]+U[1]-f[1],h.pos[2]+U[2]-f[2]]},B=Rt(C.n,h.rot),P=x.pos.length/3,[N,D,Q,ee]=K(V),[pe,oe]=h.flip?[Q,N]:[N,Q],Ne=[[0,0,pe,D],[1,0,oe,D],[1,1,oe,ee],[0,1,pe,ee]];for(let[ne,se,X,U]of Ne)x.pos.push(...H(ne,se)),x.nrm.push(...B),x.uv.push(X,U);x.idx.push(P,P+2,P+1,P,P+3,P+2);}}let G=r.map(h=>{let d=T.get(h.name);return {name:h.name,role:h.role,parent:h.parent,pivot:h.pivot,positions:Float32Array.from(d.pos),normals:Float32Array.from(d.nrm),uvs:Float32Array.from(d.uv),indices:Uint16Array.from(d.idx)}}),m=null;if(u&&b.length){let d=t.parts.filter(f=>f.bone===u.bone).sort((f,O)=>O.size[0]*O.size[1]*O.size[2]-f.size[0]*f.size[1]*f.size[2])[0],x=r.find(f=>f.name===u.bone);if(d&&x){let[f,O,I,V]=u.rect,C=d.pos[0]+d.size[0]/2-f,H=d.pos[1]+d.size[1]/2-O,B=d.pos[2]-d.size[2]/2-.05,P=x.pivot,N=(Q,ee)=>[Q-P[0],ee-P[1],B-P[2]],D={};for(let[Q,ee]of b)D[Q]=K(ee);m={bone:u.bone,corners:Float32Array.from([...N(C,H),...N(C-I,H),...N(C-I,H-V),...N(C,H-V)]),uv:D};}}let k=e.sockets.filter(h=>o(h.bone)).map(h=>{let d=e.bones.find(x=>x.name===h.bone);return {name:h.name,bone:h.bone,at:[h.at[0]-d.pivot[0],h.at[1]-d.pivot[1],h.at[2]-d.pivot[2]]}}),y=Math.max(1,L),M=y>e.height.max?e.height.max/y:y<e.height.min?e.height.min/y:1;return {hash:me(t),rig:t.rig,bones:G,atlas:{w:g,h:E,data:R},face:m,sockets:k,height:y,scale:t.scale*M,eye:e.eye*y/Zt(t.rig)}}function Zt(t){let e=1;for(let r of J[t].defaultParts)e=Math.max(e,r.pos[1]+r.size[1]/2);return e}var Ke=new Map;function Qt(t){let e=new Map;for(let n of t.bones){if(!n.indices.length){e.set(n.name,null);continue}let i=new ___namespace.BufferGeometry;i.setAttribute("position",new ___namespace.BufferAttribute(n.positions,3)),i.setAttribute("normal",new ___namespace.BufferAttribute(n.normals,3)),i.setAttribute("uv",new ___namespace.BufferAttribute(n.uvs,2)),i.setIndex(new ___namespace.BufferAttribute(n.indices,1)),i.computeBoundingSphere(),i.userData.shared=true,e.set(n.name,i);}let{w:r,h:o,data:s}=t.atlas,a=new ___namespace.DataTexture(s,r,o,___namespace.RGBAFormat);return a.magFilter=___namespace.NearestFilter,a.minFilter=___namespace.NearestFilter,a.generateMipmaps=false,a.colorSpace=___namespace.SRGBColorSpace,a.needsUpdate=true,{layout:t,geometries:e,texture:a,refs:0}}function $e(t){let e=Ke.get(me(t));return e||(e=Qt(St(t)),Ke.set(e.layout.hash,e)),e.refs++,e}function Se(t){if(!(--t.refs>0)){Ke.delete(t.layout.hash);for(let e of t.geometries.values())e?.dispose();t.texture.dispose();}}var w=class t{constructor(e,r,o="."){this.w=e;this.h=r;this.g=Array.from({length:r},()=>new Array(e).fill(o));}w;h;g;px(e,r,o){return e>=0&&r>=0&&e<this.w&&r<this.h&&(this.g[r][e]=o),this}rect(e,r,o,s,a){for(let n=r;n<r+s;n++)for(let i=e;i<e+o;i++)this.px(i,n,a);return this}row(e,r,o,s){return this.rect(r,e,o-r+1,1,s)}col(e,r,o,s){return this.rect(e,r,1,o-r+1,s)}where(e,r){for(let o=0;o<this.h;o++)for(let s=0;s<this.w;s++)e(s,o)&&this.px(s,o,r);return this}flipped(){let e=new t(this.w,this.h);for(let r=0;r<this.h;r++)for(let o=0;o<this.w;o++)e.px(this.w-1-o,r,this.g[r][o]);return e}tex(){return {w:this.w,h:this.h,rows:this.g.map(e=>e.join(""))}}};var er={s:"#d9a982",S:"#bf8d68",h:"#6b4a2f",H:"#8a6644",k:"#3a2818",w:"#f4f4ef",b:"#3f8f9c",m:"#9a5544",o:"#4a2219",t:"#a7bea9",T:"#c4d6c4",D:"#84a08a",u:"#ece6d2",B:"#6a4e33",g:"#d8c48c",p:"#8c9ca6",P:"#6f808a",z:"#a07a55",Z:"#7c5c3f",l:"#e9e3cf"};function Z(t,e){let r=parseInt(t.slice(1),16);return "#"+[r>>16&255,r>>8&255,r&255].map(s=>Math.max(0,Math.min(255,Math.round(s*e)))).map(s=>s.toString(16).padStart(2,"0")).join("")}function Xe(t,e){let r={...t};return e.skin&&(r.s=e.skin,r.S=Z(e.skin,.86),r.m=Z(e.skin,.66)),e.hair&&(r.h=e.hair,r.H=Z(e.hair,1.25),r.k=Z(e.hair,.6)),e.shirt&&(r.t=e.shirt,r.T=Z(e.shirt,1.15),r.D=Z(e.shirt,.8)),e.pants&&(r.p=e.pants,r.P=Z(e.pants,.8)),e.boots&&(r.z=e.boots,r.Z=Z(e.boots,.78)),e.eyes&&(r.b=e.eyes),r}var tr=new w(16,16,"s").rect(0,0,16,3,"h").row(3,0,4,"h").row(3,10,15,"h").row(4,0,1,"h").row(4,13,15,"h").col(0,5,8,"h").col(15,5,8,"h").row(1,3,6,"H").row(1,9,12,"H").row(15,2,13,"S"),vt=new w(16,16,"s").rect(0,0,16,4,"h").rect(7,4,9,7,"h").rect(10,11,6,2,"h").rect(5,7,2,3,"S").row(1,2,13,"H").where((t,e)=>e>4&&e<11&&t>8&&(t+e)%4===0,"k"),rr=vt.flipped(),or=new w(16,16,"h").where((t,e)=>(t+2*e)%5===0,"H").where((t,e)=>e>8&&(t*3+e)%7===0,"k").rect(4,14,8,2,"s"),nr=new w(16,16,"h").where((t,e)=>(t+2*e)%5===0,"H").where((t,e)=>(3*t+e)%9===0,"k"),sr=new w(18,4,"h").where((t,e)=>(t*7+e*3)%5===0,"H").where((t,e)=>e===3&&t*5%3===0,"k"),ar=new w(16,24,"t").row(0,6,9,"s").row(1,7,8,"s").row(0,3,5,"T").row(0,10,12,"T").row(1,4,6,"T").row(1,9,11,"T").row(2,5,6,"T").row(2,9,10,"T").col(8,2,19,"D").px(7,5,"u").px(7,9,"u").px(7,13,"u").px(7,17,"u").row(6,2,5,"D").col(2,7,10,"D").col(5,7,10,"D").row(10,2,5,"D").px(4,7,"u").row(6,10,13,"D").col(10,7,10,"D").col(13,7,10,"D").row(10,10,13,"D").px(11,7,"u").row(19,0,15,"D").rect(0,20,16,2,"B").rect(7,20,2,2,"g").rect(0,22,16,2,"p"),ir=new w(16,24,"t").row(5,0,15,"D").col(8,6,19,"D").row(19,0,15,"D").rect(0,20,16,2,"B").rect(0,22,16,2,"p"),lr=new w(8,24,"t").col(4,0,19,"D").row(19,0,7,"D").rect(0,20,8,2,"B").rect(0,22,8,2,"p"),cr=new w(16,2,"B").rect(7,0,2,2,"g").px(3,0,"k").px(12,0,"k"),pr=new w(6,24,"s").row(23,0,5,"S").col(2,21,23,"S"),hr=new w(8,13,"t").col(0,0,9,"D").row(9,0,7,"D").rect(0,10,8,3,"T").row(12,0,7,"D"),mr=new w(8,24,"p").col(4,1,21,"P").row(0,0,7,"P"),dr=new w(8,24,"p").col(3,0,21,"P").row(0,0,7,"P"),ur=new w(8,24,"p").col(3,0,21,"P"),fr=new w(10,9,"z").row(0,0,9,"Z").row(2,3,6,"l").row(4,3,6,"l").row(6,3,6,"l").col(2,1,6,"Z").col(7,1,6,"Z").rect(0,7,10,2,"Z"),br=new w(10,9,"z").row(0,0,9,"Z").rect(0,7,10,2,"Z").col(5,1,6,"Z");function $(t){let e=new w(16,10,"."),r=(s,a,n)=>{if(t.brows==="flat")e.row(1,s,s+2,"k");else if(t.brows==="high")e.row(0,s,s+2,"k");else {let i=t.brows==="down"?1:0,l=1-i;e.px(a,i,"k").px(s+1,t.brows==="down"?0:1,"k"),e.px(n,l,"k");}};r(3,5,3),r(10,10,12);let o=s=>{if(t.eyes===0){e.row(3,s,s+2,"k");return}let a=t.eyes===3||t.eyes===2?2:3;for(let n=a;n<a+t.eyes;n++)e.px(s,n,"w").px(s+1,n,"b").px(s+2,n,"w");};switch(o(3),o(10),t.mouth){case "line":e.row(7,6,9,"m");break;case "smile":e.px(5,6,"m").px(10,6,"m").row(7,6,9,"m");break;case "frown":e.row(7,6,9,"m").px(5,8,"m").px(10,8,"m");break;case "open":e.rect(6,7,4,2,"o");break;case "small":e.rect(7,7,2,2,"o");break;case "wide":e.row(7,5,10,"m").rect(6,8,4,1,"o");break}return e}var Ct={f_neutral:$({brows:"flat",eyes:2,mouth:"line"}),f_blink:$({brows:"flat",eyes:0,mouth:"line"}),f_happy:$({brows:"high",eyes:2,mouth:"smile"}),f_sad:$({brows:"up",eyes:2,mouth:"frown"}),f_angry:$({brows:"down",eyes:1,mouth:"wide"}),f_surprised:$({brows:"high",eyes:3,mouth:"small"}),f_scared:$({brows:"up",eyes:3,mouth:"open"}),f_tired:$({brows:"flat",eyes:1,mouth:"line"}),f_hurt:$({brows:"down",eyes:0,mouth:"open"}),f_talk:$({brows:"flat",eyes:2,mouth:"open"})},gr=new w(16,24,"t").row(0,5,10,"s").row(1,6,9,"s").px(5,1,"T").px(10,1,"T").row(7,0,15,"D").row(10,0,15,"D").rect(0,18,16,2,"T").rect(0,20,16,4,"p").row(20,0,15,"P"),yr=new w(16,24,"t").row(0,5,10,"T").row(7,0,15,"D").row(10,0,15,"D").rect(0,18,16,2,"T").rect(0,20,16,4,"p").row(20,0,15,"P"),xr=new w(8,24,"t").row(7,0,7,"D").row(10,0,7,"D").rect(0,18,8,2,"T").rect(0,20,8,4,"p").row(20,0,7,"P"),wr=new w(8,9,"t").row(3,0,7,"D").rect(0,7,8,2,"T"),ve=(t,e)=>t.row(e-1,0,t.w-1,"D").where((r,o)=>o>=e&&o<=e+3&&(r+o)%2===0,"T").row(e+4,0,t.w-1,"D"),kr=ve(new w(16,24,"t"),6).row(0,6,9,"s").row(0,4,5,"T").row(0,10,11,"T").row(1,4,11,"T").where((t,e)=>e>=18&&e<=19&&t%2===0,"D").where((t,e)=>e>=18&&e<=19&&t%2===1,"T").rect(0,20,16,4,"p"),Er=ve(new w(16,24,"t"),6).row(0,4,11,"T").where((t,e)=>e>=18&&e<=19,"D").rect(0,20,16,4,"p"),Rr=ve(new w(8,24,"t"),6).where((t,e)=>e>=18&&e<=19,"D").rect(0,20,8,4,"p"),Sr=ve(new w(8,22,"t"),9).where((t,e)=>e>=19&&t%2===0,"D"),Tt=t=>new w(8,24,"s").rect(0,0,8,12,"p").col(t,1,10,"P").row(11,0,7,"P").row(12,0,7,"S").rect(0,19,8,5,"l"),vr=Tt(4),Cr=Tt(3),Tr=new w(9,5,"z").row(1,3,5,"l").rect(0,3,9,2,"l"),Mr=new w(10,5,"z").row(1,3,6,"Z").rect(0,3,10,2,"l"),Ar=new w(17,6,"a").rect(0,4,17,2,"A"),Lr=new w(22,22,"a").where((t,e)=>(t*3+e*5)%11===0,"A"),Or=new w(17,20,"h").where((t,e)=>(t*5+e)%4===0,"H").where((t,e)=>e>10&&(t*3+e*2)%7===0,"k"),S=t=>t.tex(),Mt=["shirt","tee","sweater"],At=["pants","shorts"],Lt=["boots","sneakers"],nn=["short","long","curly","none"],ie=(t,e={})=>({front:t,back:t,left:t,right:t,...e});function Je(t={}){let e=t.top??"shirt",r=t.bottom??"pants",o=t.shoes??"boots",s=t.hair??"short",a=Xe(er,t.colors??{});a={...a,a:t.colors?.hat??"#d9c9a3"},a.A=Z(a.a,.72);let n={head_front:S(tr),head_left:S(vt),head_right:S(rr),head_back:S(or),hair_top:S(nr),hair_band:S(sr),arm_skin:S(pr),...Object.fromEntries(Object.entries(Ct).map(([R,F])=>[R,S(F)]))},i=[{name:"head",bone:"head",size:[8,8,8],pos:[0,28,0],color:"s",faces:{front:"head_front",left:"head_left",right:"head_right",back:"head_back",top:"hair_top"}},{name:"nose",bone:"head",size:[1,1.5,.8],pos:[0,26.9,-4.4],color:"S",faces:{front:"s"}}];if(s!=="none"){if(t.hat||i.push({name:"hair",bone:"head",size:s==="curly"?[9,2.2,9]:[8.6,1.6,8.6],pos:[0,s==="curly"?32.5:32.2,.15],color:"h",faces:ie("hair_band",{top:"hair_top"})}),s==="curly"&&!t.hat)for(let[R,F]of [[-2,-1.5],[2,.5],[-0.5,2.5]])i.push({name:"curl",bone:"head",size:[3.2,1.4,3.2],pos:[R,33.9,F],color:"h",faces:ie("hair_band",{top:"hair_top"})});s==="long"?(n.hair_long=S(Or),i.push({name:"hairLong",bone:"head",size:[8.8,10,1],pos:[0,27,4.4],color:"h",faces:ie("hair_long",{top:"hair_top"})},{name:"hairSide",bone:"head",size:[.8,9,6],pos:[-4.4,27.5,1],color:"h",faces:ie("hair_long",{top:"hair_top"}),mirror:true})):i.push({name:"hairBack",bone:"head",size:[8.6,5,.8],pos:[0,29.6,4.25],color:"h",faces:{back:"head_back",left:"hair_band",right:"hair_band"}});}t.hat&&(n.hat_crown=S(Ar),n.hat_brim=S(Lr),i.push({name:"hatBrim",bone:"head",size:[11,.8,11],pos:[0,32.4,0],color:"a",faces:{top:"hat_brim",bottom:"hat_brim"}},{name:"hatCrown",bone:"head",size:[8.4,3,8.4],pos:[0,34.3,0],color:"a",faces:ie("hat_crown")}));let l={shirt:[ar,ir,lr],tee:[gr,yr,xr],sweater:[kr,Er,Rr]},[c,u,b]=l[e];n.top_front=S(c),n.top_back=S(u),n.top_side=S(b),i.push({name:"torso",bone:"body",size:[8,12,4],pos:[0,18,0],color:"t",faces:{front:"top_front",back:"top_back",left:"top_side",right:"top_side",bottom:"p"}}),e==="shirt"&&(n.belt=S(cr),i.push({name:"belt",bone:"body",size:[8.4,1,4.4],pos:[0,13.5,0],color:"B",faces:{front:"belt",back:"belt"}})),i.push({name:"arm",bone:"armL",size:[3,12,3],pos:[-5.5,18,0],color:"s",faces:ie("arm_skin",{top:"t",bottom:"S"}),mirror:true});let g=e==="sweater"?11:e==="tee"?4.5:6.5;n.sleeve=S(e==="sweater"?Sr:e==="tee"?wr:hr),i.push({name:"sleeve",bone:"armL",size:[3.6,g,3.6],pos:[-5.5,24-g/2,0],color:"t",faces:ie("sleeve",{bottom:"D"}),mirror:true}),r==="shorts"?(n.leg_front=S(vr),n.leg_side=S(Cr)):(n.leg_front=S(mr),n.leg_back=S(dr),n.leg_side=S(ur)),i.push({name:"leg",bone:"legL",size:[4,12,4],pos:[-2,6,0],color:"p",faces:{front:"leg_front",back:r==="shorts"?"leg_front":"leg_back",left:"leg_side",right:"leg_side"},mirror:true}),o==="boots"?(n.shoe_front=S(fr),n.shoe_side=S(br)):(n.shoe_front=S(Tr),n.shoe_side=S(Mr));let E=o==="boots"?4.5:2.5;return i.push({name:"shoe",bone:"legL",size:[4.6,E,5.2],pos:[-2,E/2,-0.3],color:"z",faces:{front:"shoe_front",back:"shoe_side",left:"shoe_side",right:"shoe_side",bottom:"Z"},mirror:true}),{version:1,name:t.name??A({en:"Traveler",ru:"\u041F\u0443\u0442\u043D\u0438\u043A"}),description:t.description??A({en:"A traveler in a shirt with pockets, trousers and laced boots",ru:"\u041F\u0443\u0442\u043D\u0438\u043A \u0432 \u0440\u0443\u0431\u0430\u0448\u043A\u0435 \u0441 \u043A\u0430\u0440\u043C\u0430\u043D\u0430\u043C\u0438, \u0431\u0440\u044E\u043A\u0430\u0445 \u0438 \u0448\u043D\u0443\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0445 \u0431\u043E\u0442\u0438\u043D\u043A\u0430\u0445"}),rig:"humanoid",palette:a,textures:n,parts:i,face:{bone:"head",rect:[0,3,8,5],expressions:{neutral:"f_neutral",blink:"f_blink",happy:"f_happy",sad:"f_sad",angry:"f_angry",surprised:"f_surprised",scared:"f_scared",tired:"f_tired",hurt:"f_hurt",talk:"f_talk"}},style:{walk:"normal",idle:"calm",energy:.5},finish:{noise:.5,outline:.4,shade:.25,density:2},tags:t.tags??["player"]}}function Ce(t,e){return {textures:Object.fromEntries(Object.entries(Ct).map(([r,o])=>[r,S(o)])),face:{bone:t,rect:e,expressions:{neutral:"f_neutral",blink:"f_blink",happy:"f_happy",sad:"f_sad",angry:"f_angry",surprised:"f_surprised",scared:"f_scared",tired:"f_tired",hurt:"f_hurt",talk:"f_talk"}}}}var qe=Je(),Ye=null;function le(){if(!Ye){let t=q(qe);if(!t.ok)throw new Error(t.error);Ye=t.spec;}return Ye}function Ot(t){let e=document.createElement("canvas");e.width=256,e.height=48;let r=e.getContext("2d");r&&(r.fillStyle="rgba(0,0,0,0.45)",r.fillRect(0,0,256,48),r.font="bold 28px sans-serif",r.fillStyle="#fff",r.textAlign="center",r.textBaseline="middle",r.fillText(t.slice(0,18),128,25));let o=new ___namespace.CanvasTexture(e),s=new ___namespace.Sprite(new ___namespace.SpriteMaterial({map:o,depthTest:false,transparent:true}));return s.scale.set(1.6,.3,1),s.renderOrder=10,s}function Ze(t){t.removeFromParent(),t.material.map?.dispose(),t.material.dispose();}var v={rx:0,ry:1,rz:2,px:3,py:4,pz:5,sx:6,sy:7,sz:8},ln=Object.keys(v),ue=[0,0,0,0,0,0,1,1,1];function fe(t,e){let r=t.get(e);return r||(r=Float64Array.from(ue),t.set(e,r)),r}function Y(t,e,r,o){let s=fe(t,e),a=v[r];a>=6?s[a]=s[a]*o:s[a]=s[a]+o;}function p(t,e,r,o){fe(t,e)[v[r]]=o;}function ce(t){for(let e of t.values())e.set(ue);}function Pt(t,e,r,o){let s=new Set([...e.keys(),...r.keys()]);for(let a of s){let n=e.get(a)??ue,i=r.get(a)??ue,l=fe(t,a);for(let c=0;c<9;c++)l[c]=n[c]+(i[c]-n[c])*o;}}function Te(t,e){ce(t);for(let[r,o]of e)fe(t,r).set(o);}var cn=["none","block","tool","sword","bow","shield","food","staff","item"];function Me(){return {speed:0,vy:0,onGround:true,inWater:false,flying:false,gliding:false,sneaking:false,sprinting:false,riding:false,sitting:false,sleeping:false,dead:false,lookYaw:0,lookPitch:0,yawRate:0,held:"none",use:null,talk:false}}var pn=["swing","hurt","place","land","jump","throw"];var xe=1/16,Ae=class{group=new ___namespace.Group;root=new ___namespace.Group;asset;spec;bones=new Map;byRole=new Map;meshes=[];material;decalMat;decal=null;expression=null;sockets=new Map;attached=new Map;label=null;shadows;layer;brightness=1;constructor(e=le(),r={}){this.spec=e,this.shadows=r.shadows??true,this.layer=r.layer??0,this.material=new ___namespace.MeshLambertMaterial({alphaTest:.5}),this.decalMat=new ___namespace.MeshLambertMaterial({alphaTest:.5,polygonOffset:true,polygonOffsetFactor:-2,polygonOffsetUnits:-2}),this.group.add(this.root),this.asset=$e(e),this.build(),r.name&&this.setName(r.name);}get height(){let e=this.asset.layout;return e.height*e.scale*xe}get eye(){let e=this.asset.layout;return e.eye*e.scale*xe}get expressions(){return Object.keys(this.asset.layout.face?.uv??{})}get hash(){return this.asset.layout.hash}setSpec(e){let r=$e(e);if(r===this.asset){Se(r);return}this.clear(),Se(this.asset),this.asset=r,this.spec=e,this.build();}build(){let{layout:e,geometries:r,texture:o}=this.asset;this.material.map=o,this.material.needsUpdate=true,this.decalMat.map=o,this.decalMat.needsUpdate=true,this.root.scale.setScalar(e.scale*xe);let s=new Map(e.bones.map(n=>[n.name,n.pivot]));for(let n of e.bones){let i=new ___namespace.Group,l=n.parent?s.get(n.parent)??[0,0,0]:[0,0,0],c=[n.pivot[0]-l[0],n.pivot[1]-l[1],n.pivot[2]-l[2]];i.position.set(...c);let u={name:n.name,role:n.role,group:i,rest:c};this.bones.set(n.name,u);let b=this.byRole.get(n.role)??[];b.push(u),this.byRole.set(n.role,b);let g=r.get(n.name);if(g){let E=new ___namespace.Mesh(g,this.material);E.castShadow=E.receiveShadow=this.shadows,E.layers.set(this.layer),this.meshes.push(E),i.add(E);}}for(let n of e.bones){let i=this.bones.get(n.name);((n.parent?this.bones.get(n.parent):void 0)?.group??this.root).add(i.group);}let a=e.face;if(a){let n=new ___namespace.BufferGeometry;n.setAttribute("position",new ___namespace.BufferAttribute(a.corners,3));let i=new Float32Array(12);for(let l=0;l<4;l++)i[l*3+2]=-1;n.setAttribute("normal",new ___namespace.BufferAttribute(i,3)),n.setAttribute("uv",new ___namespace.BufferAttribute(new Float32Array(8),2)),n.setIndex([0,2,1,0,3,2]),this.decal=new ___namespace.Mesh(n,this.decalMat),this.decal.layers.set(this.layer),this.bones.get(a.bone)?.group.add(this.decal),this.expression=null,this.setExpression("neutral");}for(let n of e.sockets){let i=new ___namespace.Object3D;i.position.set(...n.at),i.scale.setScalar(1/(e.scale*xe)),this.bones.get(n.bone)?.group.add(i),this.sockets.set(n.name,i);let l=this.attached.get(n.name);l&&i.add(l);}this.placeLabel(),this.setBrightness(this.brightness);}clear(){for(let e of this.sockets.values())for(let r of [...e.children])e.remove(r);this.root.clear(),this.decal?.geometry.dispose(),this.decal=null,this.meshes=[],this.bones=new Map,this.byRole=new Map,this.sockets.clear();}applyPose(e){let r=e.get("root");if(r){this.root.rotation.set(r[v.rx],r[v.ry],r[v.rz]);let o=this.asset.layout.scale*xe;this.root.position.set(r[v.px]*o,r[v.py]*o,r[v.pz]*o);}else this.root.rotation.set(0,0,0),this.root.position.set(0,0,0);for(let[o,s]of this.byRole){let a=e.get(o);for(let n of s){let i=n.group;if(!a){i.rotation.set(0,0,0),i.position.set(...n.rest),i.scale.set(1,1,1);continue}i.rotation.set(a[v.rx],a[v.ry],a[v.rz]),i.position.set(n.rest[0]+a[v.px],n.rest[1]+a[v.py],n.rest[2]+a[v.pz]),i.scale.set(a[v.sx],a[v.sy],a[v.sz]);}}}setExpression(e){if(e===this.expression||!this.decal)return;let r=this.asset.layout.face?.uv,o=r?.[e]??r?.neutral;if(!o)return;this.expression=e;let[s,a,n,i]=o,l=this.decal.geometry.getAttribute("uv");l.setXY(0,s,a),l.setXY(1,n,a),l.setXY(2,n,i),l.setXY(3,s,i),l.needsUpdate=true;}materials(){return [this.material,this.decalMat]}setBrightness(e){this.brightness=e,this.material.color.setScalar(e),this.decalMat.color.setScalar(e);}setEmissive(e){this.material.emissive.getHex()!==e&&(this.material.emissive.setHex(e),this.decalMat.emissive.setHex(e));}setShadows(e){if(e!==this.shadows){this.shadows=e;for(let r of this.meshes)r.castShadow=e;}}attach(e,r){let o=this.attached.get(e);if(o!==r){if(o&&o.removeFromParent(),!r){this.attached.delete(e);return}this.attached.set(e,r),this.sockets.get(e)?.add(r);}}attachedAt(e){return this.attached.get(e)??null}setName(e){this.label&&Ze(this.label),this.label=e?Ot(e):null,this.label&&this.group.add(this.label),this.placeLabel();}setLabelVisible(e){this.label&&(this.label.visible=e);}placeLabel(){this.label&&(this.label.position.y=this.height+.25);}forEachMesh(e){for(let r of this.meshes)e(r);this.decal&&e(this.decal);}dispose(){this.group.removeFromParent();for(let e of this.attached.values())e.removeFromParent();this.attached.clear(),this.clear(),this.label&&Ze(this.label),this.label=null,this.material.dispose(),this.decalMat.dispose(),Se(this.asset);}};var Le=new Map,Qe=new Set;function yn(t){let e=me(t);if(!Le.has(e)){Le.set(e,t);for(let r of Qe)r(e);}return e}function xn(t){return typeof t=="string"?Le.get(t):void 0}function wn(t){let e={};for(let r of t){let o=Le.get(r);o&&(e[r]=o);}return e}function kn(t){return Qe.add(t),()=>Qe.delete(t)}var Pr=["#b08a62","#8a6a4a","#c8a878","#9a9a92","#7a5c44"],_r=["#f1c9a5","#e6b892","#d9a982","#c08e68","#a0704c","#7a5238"],Ir=["#6b4a2f","#4a3424","#8a5a3a","#c27a48","#d8b878","#2e2622","#a07850","#9a9690"],zr=["#a7bea9","#e6e0cc","#d9c9a3","#b9a083","#a9b8c4","#c8b4a0","#9fb0a0","#d8d2c4","#b98f74","#8fa3b5"],Fr=["#8c9ca6","#a9b8b4","#8a8e94","#9fb3ad","#7d8a8f","#b0a58f"],Nr=["#d9c9a3","#c8b48a","#a08a6a","#e6e0cc"];function Cn(t,e="",r=""){let o=we(ae("npc:"+t+"|"+e)),s=i=>i[Math.floor(o()*i.length)],a=Je({top:s(Mt),bottom:s(At),shoes:s(Lt),hair:s(["short","short","long","curly"]),hat:o()<.2,colors:{skin:s(_r),hair:s(Ir),shirt:s(zr),pants:s(Fr),boots:s(Pr),hat:s(Nr)}});a.name=t.slice(0,40),a.description=[e,r].filter(Boolean).join(" \u2014 ").slice(0,300),a.style={walk:s(["normal","normal","bouncy","heavy","sneaky"]),idle:s(["calm","calm","fidgety","proud"]),energy:Math.round(o()*10)/10},a.tags=["npc",...e?[e.slice(0,24)]:[]];let n=q(a);return n.ok?n.spec:le()}var re=([t,e,r])=>"#"+[t,e,r].map(o=>Math.round(o).toString(16).padStart(2,"0")).join("");function Hr(t){if(!t.length)return null;let e=r=>{let o=t.map(s=>s[r]).sort((s,a)=>s-a);return o[o.length>>1]};return [e(0),e(1),e(2)]}function Br(t,e){let{width:r,height:o,data:s}=t,a=(T,L)=>{let G=(L*r+T)*4;return [s[G],s[G+1],s[G+2]]},n=[a(0,0),a(r-1,0),a(0,o-1),a(r-1,o-1)],i=[0,1,2].map(T=>n.reduce((L,G)=>L+G[T],0)/4),l=T=>Math.abs(T[0]-i[0])+Math.abs(T[1]-i[1])+Math.abs(T[2]-i[2])>60,c=r,u=-1,b=o,g=-1;for(let T=0;T<o;T+=2)for(let L=0;L<r;L+=2)l(a(L,T))&&(c=Math.min(c,L),u=Math.max(u,L),b=Math.min(b,T),g=Math.max(g,T));u<0&&(c=0,u=r-1,b=0,g=o-1);let E=g-b+1,R=u-c+1,F=c+Math.floor(R*.3),K=c+Math.ceil(R*.7);return e.map(([T,L])=>{let G=[];for(let m=b+Math.floor(E*T);m<b+Math.ceil(E*L);m++)for(let k=F;k<K;k++){if(m<0||m>=o||k<0||k>=r)continue;let y=a(k,m);l(y)&&G.push(y);}return Hr(G)})}var Dr=[[0,.06],[.1,.22],[.3,.52],[.6,.86],[.92,1]];function On(t,e="humanoid",r=Re()){let[o,s,a,n,i]=Br(t,Dr);if(e==="humanoid"){let c=JSON.parse(JSON.stringify(qe));c.palette=Xe(c.palette,{...o?{hair:re(o)}:{},...s?{skin:re(s)}:{},...a?{shirt:re(a)}:{},...n?{pants:re(n)}:{},...i?{boots:re(i)}:{}}),c.name=r,c.tags=[];let u=q(c);return u.ok?u.spec:le()}let l=q({name:r,rig:e,palette:{s:re(s??o??[198,156,124]),t:re(a??[58,143,214]),p:re(n??i??[44,62,107]),w:"#f4f4f4",b:"#1d1d21"},textures:{f_neutral:{w:4,h:2,rows:["wbbw","...."]},f_blink:{w:4,h:2,rows:["bbbb","...."]}},face:{rect:e==="blob"?[4,4,4,2]:e==="flyer"?[0,1,4,2]:[2,2,4,2],expressions:{neutral:"f_neutral",blink:"f_blink"}}});return l.ok?l.spec:le()}var jr={normal:{},bouncy:{amp:.9,arm:.8,bob:1.6,tempo:1.1,sway:.04},heavy:{amp:.6,arm:.4,bob:.6,tempo:.8,sway:.12},sneaky:{amp:.5,arm:.3,tempo:1.2},robotic:{amp:.7,arm:.7,quant:true}},Vr={calm:{},fidgety:{fidget:1,breath:1.3},proud:{chest:.08,breath:.8}};function et(t){let e={amp:.8,arm:.6,bob:0,tempo:1,sway:0,quant:false,breath:1,fidget:0,chest:0,...jr[t.walk],...Vr[t.idle]};return e.tempo*=.8+.4*t.energy,e.amp*=.85+.3*t.energy,e}function tt(t,e=0){let r=Math.sin(t.phase+e);return t.style.quant?Math.max(-1,Math.min(1,r*3)):r}function rt(t,e,r){let o=tt(e)*r;p(t,"legL","rx",o),p(t,"legR","rx",-o),p(t,"legFL","rx",o),p(t,"legBR","rx",o),p(t,"legFR","rx",-o),p(t,"legBL","rx",-o);}function ot(t,e,r){let o=tt(e)*r;p(t,"armL","rx",-o),p(t,"armR","rx",o);}var Gr=(t,e)=>{let r=Math.sin(e.clock*2)*e.style.breath;p(t,"armL","rz",-0.04-.03*r),p(t,"armR","rz",.04+.03*r),p(t,"head","rx",.03*Math.sin(e.clock*1.7)+e.style.chest),p(t,"body","rx",e.style.chest*-0.5),e.style.fidget&&(p(t,"head","ry",.35*Math.sin(e.clock*.7)*Math.sin(e.clock*.31)),p(t,"root","ry",.05*Math.sin(e.clock*.9))),p(t,"body","sy",1+.04*Math.sin(e.clock*3));},Ur=(t,e)=>{rt(t,e,e.style.amp),ot(t,e,e.style.arm),p(t,"root","py",e.style.bob*Math.abs(Math.cos(e.phase))),p(t,"body","rz",e.style.sway*tt(e));},Wr=(t,e)=>{rt(t,e,e.style.amp*1.3),ot(t,e,e.style.arm*1.6),p(t,"body","rx",-0.18),p(t,"head","rx",.18),p(t,"root","py",(.8+e.style.bob)*Math.abs(Math.cos(e.phase)));},Kr=(t,e)=>{rt(t,e,e.style.amp*.5*Math.min(1,e.input.speed)),ot(t,e,e.style.arm*.4*Math.min(1,e.input.speed)),p(t,"body","rx",-0.45),p(t,"head","rx",.45),Y(t,"armL","rx",.25),Y(t,"armR","rx",.25),p(t,"root","py",-1.5);},$r=(t,e)=>{p(t,"root","rx",-1.3),p(t,"head","rx",1),p(t,"armL","rx",Math.PI-.5+.5*Math.sin(e.t*3)),p(t,"armR","rx",Math.PI-.5+.5*Math.sin(e.t*3+Math.PI)),p(t,"legL","rx",.3*Math.sin(e.t*8)),p(t,"legR","rx",-0.3*Math.sin(e.t*8));},Yr=(t,e)=>{p(t,"legL","rx",.15),p(t,"legR","rx",.1),p(t,"armL","rz",-0.15),p(t,"armR","rz",.15),p(t,"root","py",.6*Math.sin(e.t*2));},Xr=t=>{p(t,"root","rx",-1.35),p(t,"head","rx",1.1),p(t,"armL","rz",-1.3),p(t,"armR","rz",1.3);},Jr=(t,e)=>{let r=.15*Math.sin(e.t*10);p(t,"armL","rz",-0.6-r),p(t,"armR","rz",.6+r),p(t,"legL","rx",.25),p(t,"legR","rx",-0.25);},qr=t=>{p(t,"legL","rx",1.45),p(t,"legR","rx",1.45),p(t,"legL","ry",.1),p(t,"legR","ry",-0.1),p(t,"root","py",-10),p(t,"body","rx",.4),p(t,"legBL","rx",1.2),p(t,"legBR","rx",1.2);},Zr=t=>{p(t,"legL","rx",1.4),p(t,"legR","rx",1.4),p(t,"legL","rz",-0.3),p(t,"legR","rz",.3),p(t,"armL","rx",.45),p(t,"armR","rx",.45);},Qr=t=>{p(t,"root","rx",Math.PI/2),p(t,"root","py",2);},eo=t=>{p(t,"root","rz",Math.PI/2),p(t,"root","py",2);},to=(t,e)=>{let r=Math.sin(e.phase*.5);p(t,"root","py",6*Math.max(0,r));let o=r<0?.2*-r:0;p(t,"body","sy",1-o+.1*Math.max(0,r)),p(t,"body","sx",1+o*.6),p(t,"body","sz",1+o*.6);},ro=(t,e)=>{let r=Math.sin(Math.PI*e.k);p(t,"armR","rx",1.9*r),p(t,"armR","ry",.3*r),p(t,"body","ry",-0.3*r);},oo=(t,e)=>{let r=Math.sin(Math.PI*e.k);p(t,"armR","rx",.9*r);},no=(t,e)=>{let r=e.k<.4?-1.5*(e.k/.4):-1.5+3.5*((e.k-.4)/.6);p(t,"armR","rx",e.k>.9?r*(1-e.k)*10:r);},so=(t,e)=>{let r=Math.sin(Math.PI*e.k);p(t,"body","rx",.15*r),p(t,"head","rx",.2*r),p(t,"root","rz",.05*r);},ao=(t,e)=>{let r=Math.sin(Math.PI*e.k);p(t,"root","py",-1.5*r),p(t,"legL","rx",.2*r),p(t,"legR","rx",.2*r),p(t,"body","sy",1-.2*r),p(t,"body","sx",1+.12*r),p(t,"body","sz",1+.12*r);},io=(t,e)=>{p(t,"armR","rx",1.3+.1*Math.sin(e.t*16)),p(t,"armR","ry",-0.5),p(t,"head","rx",-0.1+.08*Math.sin(e.t*16));},lo=t=>{p(t,"armR","rx",2),p(t,"armR","ry",-0.4),p(t,"head","rx",.35);},co=t=>{p(t,"armR","rx",1.57),p(t,"armR","ry",-0.1),p(t,"armL","rx",1.57),p(t,"armL","ry",.35);},po=t=>{p(t,"armL","rx",.9),p(t,"armL","ry",-0.6);},Oe={idle:Gr,walk:Ur,run:Wr,sneak:Kr,swim:$r,fly:Yr,glide:Xr,fall:Jr,sit:qr,ride:Zr,sleep:Qr,dead:eo,hop:to,swing:ro,place:oo,throw:no,hurt:so,land:ao,eat:io,drink:lo,draw:co,block:po},_t={blob:{walk:"hop",run:"hop",sneak:"hop"}},It={swing:.3,place:.2,throw:.45,hurt:.3,land:.22};var Pe=Math.PI,_e={wave:{label:"\u041F\u043E\u043C\u0430\u0445\u0430\u0442\u044C",duration:2,emotion:"happy",tracks:{"armR.rz":[[0,0],[.25,2.7],[.5,2.3],[.75,2.8],[1,2.3],[1.25,2.8],[1.5,2.4],[2,0]],"armR.rx":[[0,0],[.25,.2],[1.75,.2],[2,0]],"head.rz":[[0,0],[.5,.1],[1.5,.1],[2,0]]}},cheer:{label:"\u0423\u0440\u0430!",duration:1.6,emotion:"happy",tracks:{"armL.rz":[[0,0],[.25,-2.8],[1.35,-2.8],[1.6,0]],"armR.rz":[[0,0],[.25,2.8],[1.35,2.8],[1.6,0]],"root.py":[[0,0],[.3,3],[.55,0],[.8,3],[1.05,0]]}},dance:{label:"\u0422\u0430\u043D\u0435\u0446",duration:2,loop:true,emotion:"happy",tracks:{"root.ry":[[0,.3],[.5,-0.3],[1,.3],[1.5,-0.3],[2,.3]],"armL.rz":[[0,-0.4],[.5,-2.4],[1,-0.4],[1.5,-2.4],[2,-0.4]],"armR.rz":[[0,2.4],[.5,.4],[1,2.4],[1.5,.4],[2,2.4]],"legL.rx":[[0,0],[.5,.5],[1,0],[2,0]],"legR.rx":[[0,0],[1,0],[1.5,.5],[2,0]],"root.py":[[0,0],[.25,1.5],[.5,0],[.75,1.5],[1,0],[1.25,1.5],[1.5,0],[1.75,1.5],[2,0]],"tail.ry":[[0,.6],[.5,-0.6],[1,.6],[1.5,-0.6],[2,.6]]}},point:{label:"\u0423\u043A\u0430\u0437\u0430\u0442\u044C",duration:1.6,tracks:{"armR.rx":[[0,0],[.2,1.55],[1.4,1.55],[1.6,0]]}},laugh:{label:"\u0421\u043C\u0435\u0445",duration:1.6,emotion:"happy",tracks:{"body.rx":[[0,0],[.2,.15],[.4,.05],[.6,.15],[.8,.05],[1,.15],[1.2,.05],[1.6,0]],"head.rx":[[0,0],[.2,.3],[1.4,.3],[1.6,0]],"armL.rx":[[0,0],[.2,.5],[1.4,.5],[1.6,0]],"armR.rx":[[0,0],[.2,.5],[1.4,.5],[1.6,0]]}},cry:{label:"\u041F\u043B\u0430\u043A\u0430\u0442\u044C",duration:2.4,emotion:"sad",tracks:{"head.rx":[[0,0],[.3,-0.4],[2.1,-0.4],[2.4,0]],"head.rz":[[0,0],[.6,.08],[.9,-0.08],[1.2,.08],[1.5,-0.08],[2.4,0]],"armR.rx":[[0,0],[.3,2.3],[2.1,2.3],[2.4,0]],"armR.ry":[[0,0],[.3,-0.6],[2.1,-0.6],[2.4,0]],"armL.rx":[[0,0],[.3,2.3],[2.1,2.3],[2.4,0]],"armL.ry":[[0,0],[.3,.6],[2.1,.6],[2.4,0]]}},bow:{label:"\u041F\u043E\u043A\u043B\u043E\u043D",duration:1.4,tracks:{"body.rx":[[0,0],[.4,-0.7],[1,-0.7],[1.4,0]],"armR.rx":[[0,0],[.4,.5],[1,.5],[1.4,0]]}},shrug:{label:"\u041F\u043E\u0436\u0430\u0442\u044C \u043F\u043B\u0435\u0447\u0430\u043C\u0438",duration:1.2,tracks:{"armL.rz":[[0,0],[.3,-0.5],[.9,-0.5],[1.2,0]],"armR.rz":[[0,0],[.3,.5],[.9,.5],[1.2,0]],"armL.rx":[[0,0],[.3,.6],[.9,.6],[1.2,0]],"armR.rx":[[0,0],[.3,.6],[.9,.6],[1.2,0]],"head.rz":[[0,0],[.3,.25],[.9,.25],[1.2,0]]}},facepalm:{label:"\u0420\u0443\u043A\u0430-\u043B\u0438\u0446\u043E",duration:1.6,emotion:"tired",tracks:{"armR.rx":[[0,0],[.3,2.5],[1.3,2.5],[1.6,0]],"armR.rz":[[0,0],[.3,-0.4],[1.3,-0.4],[1.6,0]],"head.rx":[[0,0],[.3,-0.35],[1.3,-0.35],[1.6,0]]}},sit:{label:"\u0421\u0435\u0441\u0442\u044C",duration:1,loop:true,tracks:{"legL.rx":[[0,Pe*.46],[1,Pe*.46]],"legR.rx":[[0,Pe*.46],[1,Pe*.46]],"root.py":[[0,-10],[1,-10]]}}},Fn=Object.keys(_e);function Nn(t){return typeof t=="string"&&t in _e}function ho(t,e){let r=t[0];if(e<=r[0])return r[1];for(let o=1;o<t.length;o++){let s=t[o];if(e<=s[0]){let a=t[o-1],n=(e-a[0])/Math.max(1e-6,s[0]-a[0]),i=n*n*(3-2*n);return a[1]+(s[1]-a[1])*i}}return t[t.length-1][1]}function zt(t,e,r){let o=e.loop?r%e.duration:Math.min(r,e.duration);for(let[s,a]of Object.entries(e.tracks)){let n=s.lastIndexOf("."),i=s.slice(0,n),l=s.slice(n+1);l in v&&p(t,i,l,ho(a,o));}}var Ie=["neutral","happy","sad","angry","surprised","scared","tired","hurt"];function mo(t){return typeof t=="string"&&Ie.includes(t)}var Ft={neutral:["neutral"],happy:["happy","neutral"],sad:["sad","tired","neutral"],angry:["angry","neutral"],surprised:["surprised","scared","neutral"],scared:["scared","surprised","sad","neutral"],tired:["tired","sad","neutral"],hurt:["hurt","angry","sad","neutral"]},nt={neutral:{add:{},tempo:1},happy:{add:{"head.rx":.08},tempo:1.1},sad:{add:{"head.rx":-0.3,"body.rx":-0.08,"tail.rx":.5},tempo:.8},angry:{add:{"body.rx":-0.12,"head.rx":.1,"armL.rz":-0.1,"armR.rz":.1},tempo:1.1},surprised:{add:{"head.rx":.15,"body.rx":.05},tempo:1},scared:{add:{"body.rx":-0.1,"head.rx":-0.1,"armL.rx":.3,"armR.rx":.3,"tail.rx":.6},tempo:1.3},tired:{add:{"head.rx":-0.35,"body.rx":-0.12},tempo:.7},hurt:{add:{"body.rx":-0.1},tempo:1}};function Nt(t,e,r){if(!(r<=0))for(let[o,s]of Object.entries(nt[e].add)){let a=o.lastIndexOf(".");Y(t,o.slice(0,a),o.slice(a+1),(s??0)*r);}}var Vn={damaged:{emotion:"hurt",seconds:.8},lowHealth:{emotion:"tired"},nearDeath:{emotion:"scared"},achievement:{emotion:"happy",seconds:3},bossKilled:{emotion:"happy",seconds:5},tamed:{emotion:"happy",seconds:3},traded:{emotion:"happy",seconds:2},petDied:{emotion:"sad",seconds:6},explosion:{emotion:"surprised",seconds:1.5}};function Gn(t){let e=[[/(>:\(|😠|😡|🤬)/u,"angry"],[/(:'\(|😢|😭)/u,"sad"],[/(:\(|☹|🙁|😞)/u,"sad"],[/(:o|:O|😮|😲)/u,"surprised"],[/(😱|😨)/u,"scared"],[/(-_-|😴|😩|🥱)/u,"tired"],[/(:\)|:D|\^\^|😀|😃|😄|😁|🙂|😊|😂)/u,"happy"]];for(let[r,o]of e)if(r.test(t))return o;return null}var uo=[{state:"dead",when:t=>t.dead,clip:"dead",blend:.25},{state:"sleep",when:t=>t.sleeping,clip:"sleep",blend:.3},{state:"ride",when:t=>t.riding,clip:"ride",blend:.2},{state:"sit",when:t=>t.sitting,clip:"sit",blend:.3},{state:"swim",when:t=>t.inWater&&!t.onGround&&!t.flying,clip:"swim",blend:.3},{state:"glide",when:t=>t.gliding,clip:"glide",blend:.25},{state:"fly",when:t=>t.flying,clip:"fly",blend:.25},{state:"fall",when:(t,e)=>e.airTime>.35&&t.vy<-4,clip:"fall",blend:.2},{state:"sneak",when:t=>t.sneaking,clip:"sneak",blend:.15},{state:"run",when:t=>t.sprinting&&t.speed>3||t.speed>6.5,clip:"run",blend:.15},{state:"walk",when:t=>t.speed>.4,clip:"walk",blend:.15},{state:"idle",when:()=>true,clip:"idle",blend:.2}],fo=new Set(["hurt","land"]),bo={eat:"eat",drink:"drink",draw:"draw",block:"block"},go={tail:(t,e)=>[["ry",-t.yawRate*.25+.12*Math.sin(e*2)],["rx",-(.1+Math.min(t.speed,8)*.06)]],cape:(t,e)=>[["rx",-(.05+Math.min(t.speed,8)*.12)-(t.speed>1?.06*Math.sin(e*9):0)-(t.vy<-3?.4:0)]],hair:t=>[["rx",-Math.min(t.speed,8)*.03]],ear:(t,e)=>[["rz",.08*Math.sin(e*1.3)+Math.min(t.speed,6)*.02]],antenna:(t,e)=>[["rx",.1*Math.sin(e*3)-t.vy*.02]],wingL:(t,e)=>t.flying||t.gliding||!t.onGround&&!t.inWater?[["rz",t.gliding?-0.05:-0.7*Math.sin(e*12)]]:[["rz",1.1+.05*Math.sin(e*1.5)]],wingR:(t,e)=>t.flying||t.gliding||!t.onGround&&!t.inWater?[["rz",t.gliding?.05:.7*Math.sin(e*12)]]:[["rz",-1.1-.05*Math.sin(e*1.5)]]},ze=t=>{let e=Math.max(0,Math.min(1,t));return e*e*(3-2*e)},Fe=class{rig;style;faces;pose=new Map;expression="neutral";state="idle";stateT=0;clock=0;phase=0;airTime=0;wasOnGround=true;loco=new Map;from=new Map;lastLoco=new Map;blendT=1;blendDur=.2;tmp=new Map;actions=[];useClip=null;useW=0;emote=null;mood="neutral";flash=null;postureW=new Map;blinkT=3;blinking=0;talkT=0;springs=new Map;constructor(e,r,o=[]){this.rig=e,this.style=et(r),this.faces=new Set(o);}setRandom(e){this.random=e;}random=Math.random;setStyle(e){this.style=et(e);}setEmotion(e,r){r&&r>0?this.flash={emotion:e,left:r}:this.mood=e;}get emotion(){return this.emote?.def.emotion?this.emote.def.emotion:this.flash?.emotion??this.mood}get emoting(){return this.emote?.id??null}playEmote(e){this.emote={id:e,def:_e[e],t:0};}stopEmote(){this.emote=null;}trigger(e){switch(e){case "swing":case "place":case "throw":case "hurt":case "land":{let r=e;this.actions=this.actions.filter(o=>o.clip!==r),this.actions.push({clip:r,t:0,dur:It[r]??.3}),e==="hurt"&&this.setEmotion("hurt",.8);break}}}update(e,r=Me()){e=Math.min(e,.1),this.clock+=e;let o=this.emotion,s=nt[o].tempo*this.style.tempo;!r.onGround&&!r.inWater?this.airTime+=e:(!this.wasOnGround&&this.airTime>.3&&r.onGround&&this.trigger("land"),this.airTime=0),this.wasOnGround=r.onGround,this.phase+=r.speed*e*3.5*s;let a=uo.find(c=>c.when(r,this));a.state!==this.state&&(Te(this.from,this.lastLoco),this.state=a.state,this.stateT=0,this.blendT=0,this.blendDur=a.blend),this.stateT+=e,ce(this.loco);let n=_t[this.rig]?.[a.clip]??a.clip,i={t:this.stateT,k:0,phase:this.phase,input:r,style:this.style,clock:this.clock*s};if(Oe[n](this.loco,i),ce(this.pose),this.blendT<this.blendDur?(this.blendT+=e,Pt(this.pose,this.from,this.loco,ze(this.blendT/this.blendDur))):Te(this.pose,this.loco),Te(this.lastLoco,this.pose),this.emote){let c=this.emote;if(c.t+=e,r.speed>1||this.state!=="idle"||!c.def.loop&&c.t>=c.def.duration)this.emote=null;else {let g=c.def.loop?ze(c.t/.15):ze(Math.min(c.t/.15,(c.def.duration-c.t)/.15));ce(this.tmp),zt(this.tmp,c.def,c.t),this.overlay(this.tmp,g,false);}}let l=r.use?bo[r.use]:null;l&&(this.useClip=l),this.useW=Math.max(0,Math.min(1,this.useW+(l?e:-e)*8)),this.useClip&&this.useW>0?(ce(this.tmp),Oe[this.useClip](this.tmp,{...i,t:this.clock}),this.overlay(this.tmp,ze(this.useW),false)):r.held!=="none"&&!this.emote&&Y(this.pose,"armR","rx",r.held==="staff"?.35:.2);for(let c of this.actions){c.t+=e;let u=Math.min(1,c.t/c.dur);ce(this.tmp),Oe[c.clip](this.tmp,{...i,t:c.t,k:u}),this.overlay(this.tmp,1,fo.has(c.clip));}this.actions=this.actions.filter(c=>c.t<c.dur),this.state!=="dead"&&this.state!=="sleep"&&(Y(this.pose,"head","ry",Math.max(-1.1,Math.min(1.1,r.lookYaw))),Y(this.pose,"head","rx",Math.max(-1.2,Math.min(1.2,r.lookPitch)))),this.flash&&(this.flash.left-=e)<=0&&(this.flash=null);for(let c of Ie){let u=this.postureW.get(c)??0,b=u+((c===o?1:0)-u)*Math.min(1,e*6);this.postureW.set(c,b),this.state!=="dead"&&Nt(this.pose,c,b);}for(let[c,u]of Object.entries(go))for(let[b,g]of u(r,this.clock)){let E=c+"."+b,R=this.springs.get(E);R||this.springs.set(E,R={x:g,v:0});let F=60,K=9;R.v+=(F*(g-R.x)-K*R.v)*e,R.x+=R.v*e,Y(this.pose,c,b,R.x);}return this.expression=this.face(r,e,o),this.pose}overlay(e,r,o){for(let[s,a]of e){let n=fe(this.pose,s);for(let i=0;i<9;i++)o?i>=v.sx?n[i]=n[i]*(1+(a[i]-1)*r):n[i]=n[i]+(a[i]-ue[i])*r:n[i]=n[i]+(a[i]-n[i])*r;}}face(e,r,o){let s=n=>n.find(i=>this.faces.has(i))??"neutral";if(e.dead||this.state==="dead"||e.sleeping)return s(["blink","hurt","neutral"]);let a=s(Ft[o]);return e.viseme!==void 0?(this.talkT=0,e.viseme!=="rest"&&e.viseme!=="MBP"?s(["talk",a]):a):e.talk?(this.talkT+=r,Math.floor(this.talkT/.12)%2===0?s(["talk",a]):a):(this.talkT=0,this.blinking>0?(this.blinking-=r,s(["blink",a])):(this.blinkT-=r,this.blinkT<=0&&(this.blinkT=2.5+this.random()*3,o!=="surprised"&&o!=="scared"&&o!=="hurt"&&(this.blinking=.13)),a))}};var yo={idle:{},talk:{},walk:{speed:1.6},run:{speed:5.2},surprised:{emote:"shrug"},point:{emote:"point"},sit:{sitting:true},wave:{emote:"wave"},jump:{air:true},fall:{emote:"facepalm"},dance:{emote:"dance"}},xo={handR:"handR",handL:"handL",head:"headTop"},Ht=class{view;animator;input=Me();seed;pose="idle";jumpT=-1;constructor(e,r={}){this.view=new Ae(e,{shadows:false,...r}),this.seed=r.seed??1,this.animator=this.newAnimator();}get group(){return this.view.group}get height(){return this.view.height}setSpec(e){let r=this.view.hash;this.view.setSpec(e),this.view.hash!==r&&(this.animator=this.newAnimator());}setEmotion(e){this.animator.setEmotion(e);}setViseme(e){this.input.viseme=e;}setPose(e){if(e===this.pose)return;this.pose=e;let r=yo[e];this.input.speed=r.speed??0,this.input.sitting=!!r.sitting,r.emote&&this.animator.playEmote(r.emote),r.air&&(this.jumpT=0,this.animator.trigger("jump"));}playEmote(e){this.animator.playEmote(e);}attach(e,r){this.view.attach(xo[e],r);}update(e){let r=this.input;this.jumpT>=0&&(this.jumpT+=e,r.onGround=this.jumpT>.6,r.vy=this.jumpT<.3?4:-4,r.onGround&&(this.jumpT=-1,r.vy=0,this.animator.trigger("land")));let o=this.animator.update(e,r);this.view.applyPose(o),this.view.setExpression(this.animator.expression);}dispose(){this.view.dispose();}newAnimator(){let e=this.view.spec,r=new Fe(e.rig,e.style,this.view.expressions);return r.setRandom(we(this.seed)),r}};var wo=be.map(t=>{let e=J[t],r=e.bones.map(s=>`${s.name}@[${s.pivot.join(",")}]`).join(" "),o=e.defaultParts.map(s=>`${s.bone} ${s.size.join("x")} at [${s.pos.join(",")}]`).join("; ");return `- "${t}" \u2014 ${e.hint}. Bones (name@pivot): ${r}. Default body: ${o}.`}).join(`
|
|
2
|
-
`),
|
|
1
|
+
'use strict';var _=require('three');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var ___namespace=/*#__PURE__*/_interopNamespace(_);function we(t){let e=t>>>0;return function(){e|=0,e=e+1831565813|0;let r=Math.imul(e^e>>>15,1|e);return r=r+Math.imul(r^r>>>7,61|r)^r,((r^r>>>14)>>>0)/4294967296}}function ae(t){let e=2166136261;for(let r=0;r<t.length;r++)e^=t.charCodeAt(r),e=Math.imul(e,16777619);return e>>>0}var Ht="en";function A(t,e){let r=typeof t=="string"?t:t[Ht]??t.en;if(e)for(let[o,s]of Object.entries(e))r=r.split(`{${o}}`).join(String(s));return r}function lt(t){let e=t.trim(),r=/```(?:json)?\s*([\s\S]*?)(?:```|$)/i.exec(e);r&&r[1]!==void 0&&(e=r[1]);let o=e.indexOf("{");if(o<0)return {ok:false,error:A({en:"the answer has no JSON object",ru:"\u0432 \u043E\u0442\u0432\u0435\u0442\u0435 \u043D\u0435\u0442 JSON-\u043E\u0431\u044A\u0435\u043A\u0442\u0430"}),truncated:false};let s=0,a=false,n=false,i=-1;for(let l=o;l<e.length;l++){let c=e[l];if(a){n?n=false:c==="\\"?n=true:c==='"'&&(a=false);continue}if(c==='"')a=true;else if(c==="{"||c==="[")s++;else if((c==="}"||c==="]")&&(s--,s===0)){i=l;break}}if(i<0)return {ok:false,error:A({en:"the JSON is cut off",ru:"JSON \u043E\u0431\u043E\u0440\u0432\u0430\u043D"}),truncated:true};try{return {ok:!0,value:JSON.parse(e.slice(o,i+1))}}catch{return {ok:false,error:A({en:"invalid JSON",ru:"\u043D\u0435\u0432\u0430\u043B\u0438\u0434\u043D\u044B\u0439 JSON"}),truncated:false}}}var ct={id:"blob",label:"\u041A\u0430\u043F\u043B\u044F",hint:"slimes, ghosts, spirits, living objects \u2014 one body with a face, moves by hopping",bones:[{name:"body",role:"body",parent:null,pivot:[0,0,0]}],sockets:[{name:"headTop",bone:"body",at:[0,12,0]},{name:"face",bone:"body",at:[0,7,-6]},{name:"back",bone:"body",at:[0,6,6]},{name:"waist",bone:"body",at:[0,3,0]},{name:"shoulders",bone:"body",at:[0,10,0]},{name:"handR",bone:"body",at:[6,5,-2]},{name:"handL",bone:"body",at:[-6,5,-2]}],hitbox:{w:.8,h:.8},eye:8,height:{min:4,max:40},faceBone:"body",defaultParts:[{bone:"body",size:[12,12,12],pos:[0,6,0],color:"t"}]};var pt={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 ht={id:"humanoid",label:"\u0427\u0435\u043B\u043E\u0432\u0435\u043A",hint:"people, humanoids, robots, elves, zombies \u2014 anything on two legs with two arms",bones:[{name:"body",role:"body",parent:null,pivot:[0,12,0]},{name:"head",role:"head",parent:"body",pivot:[0,24,0]},{name:"armL",role:"armL",parent:"body",pivot:[-6,22,0]},{name:"armR",role:"armR",parent:"body",pivot:[6,22,0]},{name:"legL",role:"legL",parent:null,pivot:[-2,12,0]},{name:"legR",role:"legR",parent:null,pivot:[2,12,0]}],sockets:[{name:"handR",bone:"armR",at:[6,11,-1]},{name:"handL",bone:"armL",at:[-6,11,-1]},{name:"headTop",bone:"head",at:[0,32,0]},{name:"face",bone:"head",at:[0,28,-4]},{name:"back",bone:"body",at:[0,18,2]},{name:"waist",bone:"body",at:[0,12,0]},{name:"shoulders",bone:"body",at:[0,24,0]}],hitbox:{w:.6,h:1.8},eye:27,height:{min:16,max:48},faceBone:"head",defaultParts:[{bone:"head",size:[8,8,8],pos:[0,28,0],color:"s"},{bone:"body",size:[8,12,4],pos:[0,18,0],color:"t"},{bone:"armL",size:[4,12,4],pos:[-6,18,0],color:"s"},{bone:"armR",size:[4,12,4],pos:[6,18,0],color:"s"},{bone:"legL",size:[4,12,4],pos:[-2,6,0],color:"p"},{bone:"legR",size:[4,12,4],pos:[2,6,0],color:"p"}]};var mt={id:"quadruped",label:"\u0427\u0435\u0442\u0432\u0435\u0440\u043E\u043D\u043E\u0433\u043E\u0435",hint:"dogs, cats, horses, wolves, bears, lizards \u2014 any animal on four legs",bones:[{name:"body",role:"body",parent:null,pivot:[0,12,0]},{name:"head",role:"head",parent:"body",pivot:[0,14,-8]},{name:"legFL",role:"legFL",parent:null,pivot:[-3,8,-6]},{name:"legFR",role:"legFR",parent:null,pivot:[3,8,-6]},{name:"legBL",role:"legBL",parent:null,pivot:[-3,8,6]},{name:"legBR",role:"legBR",parent:null,pivot:[3,8,6]},{name:"tail",role:"tail",parent:"body",pivot:[0,14,8]}],sockets:[{name:"headTop",bone:"head",at:[0,20,-12]},{name:"face",bone:"head",at:[0,16,-16]},{name:"back",bone:"body",at:[0,16,0]},{name:"waist",bone:"body",at:[0,12,4]},{name:"shoulders",bone:"body",at:[0,16,-6]},{name:"handR",bone:"head",at:[2,13,-16]},{name:"handL",bone:"head",at:[-2,13,-16]}],hitbox:{w:.9,h:1},eye:17,height:{min:8,max:40},faceBone:"head",defaultParts:[{bone:"body",size:[8,8,16],pos:[0,12,0],color:"t"},{bone:"head",size:[8,8,8],pos:[0,16,-12],color:"s"},{bone:"legFL",size:[3,8,3],pos:[-3,4,-6],color:"p"},{bone:"legFR",size:[3,8,3],pos:[3,4,-6],color:"p"},{bone:"legBL",size:[3,8,3],pos:[-3,4,6],color:"p"},{bone:"legBR",size:[3,8,3],pos:[3,4,6],color:"p"},{bone:"tail",size:[2,2,8],pos:[0,14,12],color:"t"}]};var To=["root","body","head","armL","armR","legL","legR","legFL","legFR","legBL","legBR","tail","wingL","wingR","ear","hair","cape","antenna","static"],ke=["tail","wingL","wingR","ear","hair","cape","antenna","static"],Mo=["handR","handL","headTop","face","back","waist","shoulders"],be=["humanoid","quadruped","flyer","blob"];var J={humanoid:ht,quadruped:mt,flyer:pt,blob:ct};var dt=1,De=["front","back","left","right","top","bottom"],je=["neutral","blink","happy","sad","angry","surprised","scared","tired","hurt","talk"],Ve=["normal","bouncy","heavy","sneaky","robotic"],Ge=["calm","fidgety","proud"],gt={parts:64,bones:16,palette:32,textures:48,texturePixels:32768,textureSide:32,partSide:32,coord:64},he={noise:.5,outline:.4,shade:.25,density:2},j=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),ge=t=>Array.isArray(t)?t:[];function W(t,e,r,o){let s=typeof t=="number"?t:typeof t=="string"?Number(t):NaN;return Number.isFinite(s)?Math.min(o,Math.max(r,s)):e}function He(t,e,r){if(typeof t!="string")return r;let o=t.trim();if(e.includes(o))return o;let s=o.toLowerCase().replace(/[\s-]+/g,"_");return e.find(n=>n.toLowerCase()===s)??r}function te(t,e,r){return typeof t=="string"?t.trim().slice(0,r):e}function Ee(t,e,r=null){if(!Array.isArray(t)||t.length<3)return r;let o=t.slice(0,3).map(s=>W(s,NaN,-e,e));return o.every(Number.isFinite)?o:r}var ut={black:"#1d1d21",white:"#f0f0f0",gray:"#808080",grey:"#808080",red:"#c0392b",green:"#3c9a3c",blue:"#2f5fd0",yellow:"#f2d33c",orange:"#e8862a",purple:"#8a4fc4",pink:"#f08cb4",brown:"#7a4f2a",cyan:"#2ab0c0",gold:"#d8b030",silver:"#c0c4c8",skin:"#c69c7c"};function ft(t){if(typeof t!="string")return null;let e=t.trim().toLowerCase();if(ut[e])return ut[e];let r=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/.exec(e);if(!r)return null;let o=r[1];return "#"+(o.length===3?o.split("").map(s=>s+s).join(""):o)}var ye=new Set(["."," "]),bt=t=>/^[A-Za-z0-9_]{1,24}$/.test(t),Bt={human:"humanoid",biped:"humanoid",person:"humanoid",animal:"quadruped",four_legs:"quadruped",quadrupedal:"quadruped",bird:"flyer",winged:"flyer",dragon:"flyer",slime:"blob",ghost:"blob"};function Dt(t){if(typeof t!="string")return "humanoid";let e=t.trim().toLowerCase().replace(/[\s-]+/g,"_");return be.includes(e)?e:Bt[e]??"humanoid"}function yt(t,e){let r=/^(.*?)(L|R)$/.exec(t);if(!r)return t;let o=r[1]+(r[2]==="L"?"R":"L");return e(o)?o:t}function q(t){if(typeof t=="string"){let m=lt(t);if(!m.ok)return {ok:false,error:m.error,truncated:m.truncated};t=m.value;}if(!j(t))return {ok:false,error:A({en:"the character recipe is not an object",ru:"\u0440\u0435\u0446\u0435\u043F\u0442 \u043F\u0435\u0440\u0441\u043E\u043D\u0430\u0436\u0430 \u2014 \u043D\u0435 \u043E\u0431\u044A\u0435\u043A\u0442"})};if(!("parts"in t)&&!("rig"in t)){let m=t.character??t.spec??t.characterSpec;j(m)&&(t=m);}let e=t,r=gt,o=[];typeof e.version=="number"&&e.version>dt&&o.push(A({en:"recipe version {v} is newer than the game \u2014 read what could be read",ru:"\u0440\u0435\u0446\u0435\u043F\u0442 \u0432\u0435\u0440\u0441\u0438\u0438 {v} \u2014 \u043D\u043E\u0432\u0435\u0435 \u0438\u0433\u0440\u044B, \u0440\u0430\u0437\u043E\u0431\u0440\u0430\u043D\u043E \u0447\u0442\u043E \u043F\u043E\u043D\u044F\u0442\u043D\u043E"},{v:e.version}));let s=Dt(e.rig),a=J[s],n={};if(j(e.palette))for(let[m,k]of Object.entries(e.palette)){if(Object.keys(n).length>=r.palette){o.push(A({en:"the palette is longer than {n} \u2014 the rest was dropped",ru:"\u043F\u0430\u043B\u0438\u0442\u0440\u0430 \u0434\u043B\u0438\u043D\u043D\u0435\u0435 {n} \u2014 \u043B\u0438\u0448\u043D\u0435\u0435 \u043E\u0442\u0431\u0440\u043E\u0448\u0435\u043D\u043E"},{n:r.palette}));break}let y=ft(k);if(m.length!==1||ye.has(m)||!y){o.push(A({en:"palette colour \xAB{k}\xBB was not understood",ru:"\u0446\u0432\u0435\u0442 \u043F\u0430\u043B\u0438\u0442\u0440\u044B \xAB{k}\xBB \u043D\u0435 \u043F\u043E\u043D\u044F\u0442"},{k:m}));continue}n[m]=y;}let i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",l=(m,k)=>{if(typeof m!="string")return k;if(m.length===1&&n[m])return m;let y=ft(m);if(!y)return k;let M=Object.entries(n).find(([,d])=>d===y);if(M)return M[0];if(Object.keys(n).length>=r.palette)return k;let h=[...i].find(d=>!n[d]);return h?(n[h]=y,h):k},c={},u=0;if(j(e.textures))for(let[m,k]of Object.entries(e.textures)){if(!bt(m)){o.push(A({en:"texture name \xAB{id}\xBB does not fit",ru:"\u0438\u043C\u044F \u0442\u0435\u043A\u0441\u0442\u0443\u0440\u044B \xAB{id}\xBB \u043D\u0435 \u043F\u043E\u0434\u0445\u043E\u0434\u0438\u0442"},{id:m.slice(0,30)}));continue}if(Object.keys(c).length>=r.textures){o.push(A({en:"more than {n} textures \u2014 the rest were dropped",ru:"\u0442\u0435\u043A\u0441\u0442\u0443\u0440 \u0431\u043E\u043B\u044C\u0448\u0435 {n} \u2014 \u043B\u0438\u0448\u043D\u0438\u0435 \u043E\u0442\u0431\u0440\u043E\u0448\u0435\u043D\u044B"},{n:r.textures}));break}let y=Gt(k,n,o,m);if(y){if(u+y.w*y.h>r.texturePixels){o.push(A({en:"texture \xAB{id}\xBB did not fit the pixel limit",ru:"\u0442\u0435\u043A\u0441\u0442\u0443\u0440\u0430 \xAB{id}\xBB \u043D\u0435 \u0432\u043B\u0435\u0437\u043B\u0430 \u0432 \u043B\u0438\u043C\u0438\u0442 \u043F\u0438\u043A\u0441\u0435\u043B\u0435\u0439"},{id:m}));continue}u+=y.w*y.h,c[m]=y;}}let b=new Set(a.bones.map(m=>m.name)),g=[];for(let m of ge(e.bones)){if(!j(m))continue;let k=te(m.name,"",24);if(!k||!bt(k))continue;let y=Ee(m.pivot,r.coord);if(!y||g.some(x=>x.name===k))continue;if(g.length>=r.bones){o.push(A({en:"more than {n} bones \u2014 the rest were dropped",ru:"\u043A\u043E\u0441\u0442\u0435\u0439 \u0431\u043E\u043B\u044C\u0448\u0435 {n} \u2014 \u043B\u0438\u0448\u043D\u0438\u0435 \u043E\u0442\u0431\u0440\u043E\u0448\u0435\u043D\u044B"},{n:r.bones}));break}let M=b.has(k),h=te(m.parent,"",24),d=M?a.bones.find(x=>x.name===k).parent??"":b.has(h)||g.some(x=>x.name===h)?h:a.bones.find(x=>x.role==="body").name;g.push({name:k,parent:d,pivot:y,role:M?"static":He(m.role,ke,"static")}),b.add(k);}let E=Object.keys(n)[0]??"s",R=[];for(let m of ge(e.parts)){if(R.length>=r.parts){o.push(A({en:"more than {n} parts \u2014 the rest were dropped",ru:"\u0434\u0435\u0442\u0430\u043B\u0435\u0439 \u0431\u043E\u043B\u044C\u0448\u0435 {n} \u2014 \u043B\u0438\u0448\u043D\u0438\u0435 \u043E\u0442\u0431\u0440\u043E\u0448\u0435\u043D\u044B"},{n:r.parts}));break}if(!j(m))continue;let k=Ee(m.size,r.partSide),y=Ee(m.pos??m.center??m.at,r.coord);if(!k||!y||k.some(f=>f<=0))continue;let M=te(m.bone,"",24);b.has(M)||(M&&o.push(A({en:"bone \xAB{b}\xBB not found \u2014 the part is on the body",ru:"\u043A\u043E\u0441\u0442\u044C \xAB{b}\xBB \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u0430 \u2014 \u0434\u0435\u0442\u0430\u043B\u044C \u043D\u0430 \u0442\u0435\u043B\u0435"},{b:M})),M=a.bones.find(f=>f.role==="body").name);let h={bone:M,size:k,pos:y,color:l(m.color,E)};if(j(m.faces)){let f={};for(let O of De){let I=m.faces[O];if(typeof I=="string")if(c[I])f[O]=I;else {let V=l(I,"");V&&(f[O]=V);}}Object.keys(f).length&&(h.faces=f);}let d=Ee(m.rot??m.rotation,180);d&&d.some(f=>f!==0)&&(h.rot=d),(m.mirror===true||m.mirror==="x")&&(h.mirror=true);let x=te(m.name,"",24);x&&(h.name=x),R.push(h);}if(!R.length){for(let[m,k]of Object.entries(jt))n[m]||(n[m]=k);R.push(...a.defaultParts.map(Vt));}let F=null;if(j(e.face)){let m=e.face,k=b.has(te(m.bone,"",24))?te(m.bone,"",24):a.faceBone,y=ge(m.rect).map(h=>Math.round(W(h,NaN,0,r.partSide))),M={};if(j(m.expressions))for(let h of je){let d=m.expressions[h];typeof d=="string"&&c[d]&&(M[h]=d);}if(!M.neutral){let h=Object.values(M)[0];h&&(M.neutral=h);}if(M.neutral){let h=c[M.neutral];F={bone:k,rect:y.length===4&&y.every(Number.isFinite)&&y[2]>0&&y[3]>0?y:[0,0,h.w,h.h],expressions:M};}else Object.keys(m).length&&o.push(A({en:"the face has no pictures \u2014 no face is drawn",ru:"\u0443 \u043B\u0438\u0446\u0430 \u043D\u0435\u0442 \u043D\u0438 \u043E\u0434\u043D\u043E\u0439 \u043A\u0430\u0440\u0442\u0438\u043D\u043A\u0438 \u2014 \u043B\u0438\u0446\u043E \u043D\u0435 \u043D\u0430\u0440\u0438\u0441\u043E\u0432\u0430\u043D\u043E"}));}let K=j(e.style)?e.style:{},T=j(e.voice)?e.voice:{},L=j(e.finish)?e.finish:{};return {ok:true,spec:{version:dt,name:te(e.name,Re(),40)||Re(),description:te(e.description,"",300),rig:s,scale:W(e.scale,1,.25,3),palette:n,textures:c,parts:R,bones:g,face:F,style:{walk:He(K.walk,Ve,"normal"),idle:He(K.idle,Ge,"calm"),energy:W(K.energy,.5,0,1)},voice:{pitch:W(T.pitch,1,.5,2)},tags:ge(e.tags).filter(m=>typeof m=="string"&&!!m.trim()).slice(0,8).map(m=>m.trim().slice(0,24)),finish:{noise:W(L.noise,he.noise,0,1),outline:W(L.outline,he.outline,0,1),shade:W(L.shade,he.shade,0,1),density:Math.round(W(L.density,he.density,1,4))}},warnings:o}}var jt={s:"#c69c7c",t:"#3a8fd6",p:"#2c3e6b"};function Vt(t){return JSON.parse(JSON.stringify(t))}function Gt(t,e,r,o){let s=Array.isArray(t)?{rows:t}:j(t)?t:null;if(!s)return null;let a=gt.textureSide,n=ge(s.rows??s.pixels).filter(u=>typeof u=="string");if(!n.length)return null;let i=Math.round(W(s.h??s.height,n.length,1,a)),l=Math.round(W(s.w??s.width,Math.max(...n.map(u=>u.length)),1,a)),c=false;for(n=n.slice(0,i).map(u=>{let b="";for(let g=0;g<l;g++){let E=u[g]??".";ye.has(E)||e[E]?b+=E===" "?".":E:(c=true,b+=".");}return b});n.length<i;)n.push(".".repeat(l));return c&&r.push(A({en:"texture \xAB{id}\xBB has symbols not in the palette \u2014 they became transparent",ru:"\u0432 \u0442\u0435\u043A\u0441\u0442\u0443\u0440\u0435 \xAB{id}\xBB \u0441\u0438\u043C\u0432\u043E\u043B\u044B \u043D\u0435 \u0438\u0437 \u043F\u0430\u043B\u0438\u0442\u0440\u044B \u2014 \u0441\u0442\u0430\u043B\u0438 \u043F\u0440\u043E\u0437\u0440\u0430\u0447\u043D\u044B\u043C\u0438"},{id:o})),{w:l,h:i,rows:n}}function Be(t){return Array.isArray(t)?"["+t.map(Be).join(",")+"]":j(t)?"{"+Object.keys(t).filter(e=>t[e]!==void 0).sort().map(e=>JSON.stringify(e)+":"+Be(t[e])).join(",")+"}":JSON.stringify(t)}function me(t){let e=Be(t),r=ae(e),o=ae("~"+e);return r.toString(16).padStart(8,"0")+o.toString(16).padStart(8,"0")}function Do(t){return J[t.rig]}function xt(t){let r=J[t.rig].bones.map(o=>{let s=t.bones.find(a=>a.name===o.name);return {name:o.name,role:o.role,parent:o.parent,pivot:(s?.pivot??o.pivot).slice()}});for(let o of t.bones)r.some(s=>s.name===o.name)||r.push({name:o.name,role:o.role,parent:o.parent,pivot:o.pivot.slice()});return r}function Re(){return A({en:"Character",ru:"\u041F\u0435\u0440\u0441\u043E\u043D\u0430\u0436"})}var jo=t=>t==="\u041F\u0435\u0440\u0441\u043E\u043D\u0430\u0436"||t==="Character";var Ut={front:{tl:[1,1,-1],u:[-1,0,0],d:[0,-1,0],n:[0,0,-1]},back:{tl:[-1,1,1],u:[1,0,0],d:[0,-1,0],n:[0,0,1]},right:{tl:[1,1,1],u:[0,0,-1],d:[0,-1,0],n:[1,0,0]},left:{tl:[-1,1,-1],u:[0,0,1],d:[0,-1,0],n:[-1,0,0]},top:{tl:[1,1,1],u:[-1,0,0],d:[0,0,-1],n:[0,1,0]},bottom:{tl:[-1,-1,1],u:[1,0,0],d:[0,0,-1],n:[0,-1,0]}};function Ue(t){let e=parseInt(t.slice(1),16);return [e>>16&255,e>>8&255,e&255]}function wt(t,e,r,o,s,a){let n=((r-1-s)*e+o)*4;t[n]=a[0],t[n+1]=a[1],t[n+2]=a[2],t[n+3]=255;}function Wt(t){t.sort((e,r)=>r.h-e.h||r.w-e.w||(e.key<r.key?-1:1));for(let e=16;;e*=2){let r=0,o=0,s=0;for(let n of t)r+n.w>e&&(r=0,o+=s,s=0),n.x=r,n.y=o,r+=n.w,s=Math.max(s,n.h);let a=o+s;if(a<=e||e>=1024){let n=16;for(;n<a;)n*=2;return {w:e,h:n}}}}function kt(t,e,r){let o=Math.imul(e,374761393)+Math.imul(r,668265263)+Math.imul(t,2246822519);return o=Math.imul(o^o>>>13,1274126177),((o^o>>>16)>>>0)/4294967296}function Kt(t,e,r,o,s,a,n,i){let c=1+(.55*kt(n,e,r)+.45*kt(n^1540483477,Math.floor(e/3),Math.floor(r/3))-.5)*2*i.noise*.14;return a==="s"?c+=i.shade*.16*(.5-(r+.5)/s):a==="t"?c+=i.shade*.08:c-=i.shade*.2,o>=3&&s>=3&&(e===0||r===0||e===o-1||r===s-1)&&(c*=1-.5*i.outline),[Math.max(0,Math.min(255,t[0]*c)),Math.max(0,Math.min(255,t[1]*c)),Math.max(0,Math.min(255,t[2]*c))]}var We=Math.PI/180;function Et(t,e){if(!e)return t;let[r,o,s]=t,[a,n,i]=[e[0]*We,e[1]*We,e[2]*We],l=Math.cos(i),c=Math.sin(i);return [r,o]=[r*l-o*c,r*c+o*l],l=Math.cos(n),c=Math.sin(n),[r,s]=[r*l+s*c,-r*c+s*l],l=Math.cos(a),c=Math.sin(a),[o,s]=[o*l-s*c,o*c+s*l],[r,o,s]}function $t(t,e){let r=[];for(let o of t.parts){if(r.push({...o,flip:false}),!o.mirror)continue;let s=o.faces?{...o.faces,left:o.faces.right,right:o.faces.left}:void 0;s&&(s.left===void 0&&delete s.left,s.right===void 0&&delete s.right);let a={...o,bone:yt(o.bone,e),pos:[-o.pos[0],o.pos[1],o.pos[2]],flip:true};s?a.faces=s:delete a.faces,o.rot&&(a.rot=[o.rot[0],-o.rot[1],-o.rot[2]]),r.push(a);}return r}function Rt(t){let e=J[t.rig],r=xt(t),o=h=>r.some(d=>d.name===h),s=$t(t,o),a=t.finish??he,n=new Map,i=(h,d)=>{let x=h.faces?.[d],f=x!==void 0?t.textures[x]:void 0,O=x!==void 0&&t.palette[x]?x:h.color,[I,V]=d==="front"||d==="back"?[h.size[0],h.size[1]]:d==="left"||d==="right"?[h.size[2],h.size[1]]:[h.size[0],h.size[2]],C=(pe,oe)=>Math.max(1,Math.min(64,oe*Math.max(1,Math.round(pe*a.density/oe)))),H=f?C(I,f.w):C(I,1),B=f?C(V,f.h):C(V,1),P=d==="top"?"t":d==="bottom"?"b":"s",N=(f?"t:"+x:"c:"+O)+"|"+H+"x"+B+P,D=n.get(N);if(D)return D;let Q=ae(N),ee=f?null:Ue(t.palette[O]??"#ff00ff");return D={key:N,w:H,h:B,x:0,y:0,paint:(pe,oe,Ne,ne,se)=>{for(let X=0;X<B;X++)for(let U=0;U<H;U++){let st=ee;if(f){let at=f.rows[Math.floor(X*f.h/B)][Math.floor(U*f.w/H)];if(ye.has(at))continue;let it=t.palette[at];if(!it)continue;st=Ue(it);}wt(pe,oe,Ne,ne+U,se+X,Kt(st,U,X,H,B,P,Q,a));}}},n.set(N,D),D},l=(h,d)=>{let x="e:"+h,f=n.get(x);return f||(f={key:x,w:d.w,h:d.h,x:0,y:0,paint:(O,I,V,C,H)=>{for(let B=0;B<d.h;B++)for(let P=0;P<d.w;P++){let N=d.rows[B][P];if(ye.has(N))continue;let D=t.palette[N];D&&wt(O,I,V,C+P,H+B,Ue(D));}}},n.set(x,f)),f},c=s.map(h=>({p:h,faces:De.map(d=>({f:d,cell:i(h,d)}))})),u=t.face,b=[];if(u)for(let[h,d]of Object.entries(u.expressions)){let x=t.textures[d];x&&b.push([h,l(d,x)]);}let{w:g,h:E}=Wt([...n.values()]),R=new Uint8Array(g*E*4);for(let h of n.values())h.paint(R,g,E,h.x,h.y);let F=.01,K=h=>[(h.x+F)/g,1-(h.y+F)/E,(h.x+h.w-F)/g,1-(h.y+h.h-F)/E],T=new Map;for(let h of r)T.set(h.name,{pos:[],nrm:[],uv:[],idx:[]});let L=0;for(let{p:h,faces:d}of c){let x=T.get(h.bone),f=r.find(I=>I.name===h.bone).pivot,O=[h.size[0]/2,h.size[1]/2,h.size[2]/2];L=Math.max(L,h.pos[1]+O[1]);for(let{f:I,cell:V}of d){let C=Ut[I],H=(ne,se)=>{let X=[O[0]*(C.tl[0]+2*(C.u[0]*ne+C.d[0]*se)),O[1]*(C.tl[1]+2*(C.u[1]*ne+C.d[1]*se)),O[2]*(C.tl[2]+2*(C.u[2]*ne+C.d[2]*se))],U=Et(X,h.rot);return [h.pos[0]+U[0]-f[0],h.pos[1]+U[1]-f[1],h.pos[2]+U[2]-f[2]]},B=Et(C.n,h.rot),P=x.pos.length/3,[N,D,Q,ee]=K(V),[pe,oe]=h.flip?[Q,N]:[N,Q],Ne=[[0,0,pe,D],[1,0,oe,D],[1,1,oe,ee],[0,1,pe,ee]];for(let[ne,se,X,U]of Ne)x.pos.push(...H(ne,se)),x.nrm.push(...B),x.uv.push(X,U);x.idx.push(P,P+2,P+1,P,P+3,P+2);}}let G=r.map(h=>{let d=T.get(h.name);return {name:h.name,role:h.role,parent:h.parent,pivot:h.pivot,positions:Float32Array.from(d.pos),normals:Float32Array.from(d.nrm),uvs:Float32Array.from(d.uv),indices:Uint16Array.from(d.idx)}}),m=null;if(u&&b.length){let d=t.parts.filter(f=>f.bone===u.bone).sort((f,O)=>O.size[0]*O.size[1]*O.size[2]-f.size[0]*f.size[1]*f.size[2])[0],x=r.find(f=>f.name===u.bone);if(d&&x){let[f,O,I,V]=u.rect,C=d.pos[0]+d.size[0]/2-f,H=d.pos[1]+d.size[1]/2-O,B=d.pos[2]-d.size[2]/2-.05,P=x.pivot,N=(Q,ee)=>[Q-P[0],ee-P[1],B-P[2]],D={};for(let[Q,ee]of b)D[Q]=K(ee);m={bone:u.bone,corners:Float32Array.from([...N(C,H),...N(C-I,H),...N(C-I,H-V),...N(C,H-V)]),uv:D};}}let k=e.sockets.filter(h=>o(h.bone)).map(h=>{let d=e.bones.find(x=>x.name===h.bone);return {name:h.name,bone:h.bone,at:[h.at[0]-d.pivot[0],h.at[1]-d.pivot[1],h.at[2]-d.pivot[2]]}}),y=Math.max(1,L),M=y>e.height.max?e.height.max/y:y<e.height.min?e.height.min/y:1;return {hash:me(t),rig:t.rig,bones:G,atlas:{w:g,h:E,data:R},face:m,sockets:k,height:y,scale:t.scale*M,eye:e.eye*y/Yt(t.rig)}}function Yt(t){let e=1;for(let r of J[t].defaultParts)e=Math.max(e,r.pos[1]+r.size[1]/2);return e}var Ke=new Map;function Xt(t){let e=new Map;for(let n of t.bones){if(!n.indices.length){e.set(n.name,null);continue}let i=new ___namespace.BufferGeometry;i.setAttribute("position",new ___namespace.BufferAttribute(n.positions,3)),i.setAttribute("normal",new ___namespace.BufferAttribute(n.normals,3)),i.setAttribute("uv",new ___namespace.BufferAttribute(n.uvs,2)),i.setIndex(new ___namespace.BufferAttribute(n.indices,1)),i.computeBoundingSphere(),i.userData.shared=true,e.set(n.name,i);}let{w:r,h:o,data:s}=t.atlas,a=new ___namespace.DataTexture(s,r,o,___namespace.RGBAFormat);return a.magFilter=___namespace.NearestFilter,a.minFilter=___namespace.NearestFilter,a.generateMipmaps=false,a.colorSpace=___namespace.SRGBColorSpace,a.needsUpdate=true,{layout:t,geometries:e,texture:a,refs:0}}function $e(t){let e=Ke.get(me(t));return e||(e=Xt(Rt(t)),Ke.set(e.layout.hash,e)),e.refs++,e}function Se(t){if(!(--t.refs>0)){Ke.delete(t.layout.hash);for(let e of t.geometries.values())e?.dispose();t.texture.dispose();}}var w=class t{constructor(e,r,o="."){this.w=e;this.h=r;this.g=Array.from({length:r},()=>new Array(e).fill(o));}w;h;g;px(e,r,o){return e>=0&&r>=0&&e<this.w&&r<this.h&&(this.g[r][e]=o),this}rect(e,r,o,s,a){for(let n=r;n<r+s;n++)for(let i=e;i<e+o;i++)this.px(i,n,a);return this}row(e,r,o,s){return this.rect(r,e,o-r+1,1,s)}col(e,r,o,s){return this.rect(e,r,1,o-r+1,s)}where(e,r){for(let o=0;o<this.h;o++)for(let s=0;s<this.w;s++)e(s,o)&&this.px(s,o,r);return this}flipped(){let e=new t(this.w,this.h);for(let r=0;r<this.h;r++)for(let o=0;o<this.w;o++)e.px(this.w-1-o,r,this.g[r][o]);return e}tex(){return {w:this.w,h:this.h,rows:this.g.map(e=>e.join(""))}}};var Jt={s:"#d9a982",S:"#bf8d68",h:"#6b4a2f",H:"#8a6644",k:"#3a2818",w:"#f4f4ef",b:"#3f8f9c",m:"#9a5544",o:"#4a2219",t:"#a7bea9",T:"#c4d6c4",D:"#84a08a",u:"#ece6d2",B:"#6a4e33",g:"#d8c48c",p:"#8c9ca6",P:"#6f808a",z:"#a07a55",Z:"#7c5c3f",l:"#e9e3cf"};function Z(t,e){let r=parseInt(t.slice(1),16);return "#"+[r>>16&255,r>>8&255,r&255].map(s=>Math.max(0,Math.min(255,Math.round(s*e)))).map(s=>s.toString(16).padStart(2,"0")).join("")}function Xe(t,e){let r={...t};return e.skin&&(r.s=e.skin,r.S=Z(e.skin,.86),r.m=Z(e.skin,.66)),e.hair&&(r.h=e.hair,r.H=Z(e.hair,1.25),r.k=Z(e.hair,.6)),e.shirt&&(r.t=e.shirt,r.T=Z(e.shirt,1.15),r.D=Z(e.shirt,.8)),e.pants&&(r.p=e.pants,r.P=Z(e.pants,.8)),e.boots&&(r.z=e.boots,r.Z=Z(e.boots,.78)),e.eyes&&(r.b=e.eyes),r}var qt=new w(16,16,"s").rect(0,0,16,3,"h").row(3,0,4,"h").row(3,10,15,"h").row(4,0,1,"h").row(4,13,15,"h").col(0,5,8,"h").col(15,5,8,"h").row(1,3,6,"H").row(1,9,12,"H").row(15,2,13,"S"),St=new w(16,16,"s").rect(0,0,16,4,"h").rect(7,4,9,7,"h").rect(10,11,6,2,"h").rect(5,7,2,3,"S").row(1,2,13,"H").where((t,e)=>e>4&&e<11&&t>8&&(t+e)%4===0,"k"),Zt=St.flipped(),Qt=new w(16,16,"h").where((t,e)=>(t+2*e)%5===0,"H").where((t,e)=>e>8&&(t*3+e)%7===0,"k").rect(4,14,8,2,"s"),er=new w(16,16,"h").where((t,e)=>(t+2*e)%5===0,"H").where((t,e)=>(3*t+e)%9===0,"k"),tr=new w(18,4,"h").where((t,e)=>(t*7+e*3)%5===0,"H").where((t,e)=>e===3&&t*5%3===0,"k"),rr=new w(16,24,"t").row(0,6,9,"s").row(1,7,8,"s").row(0,3,5,"T").row(0,10,12,"T").row(1,4,6,"T").row(1,9,11,"T").row(2,5,6,"T").row(2,9,10,"T").col(8,2,19,"D").px(7,5,"u").px(7,9,"u").px(7,13,"u").px(7,17,"u").row(6,2,5,"D").col(2,7,10,"D").col(5,7,10,"D").row(10,2,5,"D").px(4,7,"u").row(6,10,13,"D").col(10,7,10,"D").col(13,7,10,"D").row(10,10,13,"D").px(11,7,"u").row(19,0,15,"D").rect(0,20,16,2,"B").rect(7,20,2,2,"g").rect(0,22,16,2,"p"),or=new w(16,24,"t").row(5,0,15,"D").col(8,6,19,"D").row(19,0,15,"D").rect(0,20,16,2,"B").rect(0,22,16,2,"p"),nr=new w(8,24,"t").col(4,0,19,"D").row(19,0,7,"D").rect(0,20,8,2,"B").rect(0,22,8,2,"p"),sr=new w(16,2,"B").rect(7,0,2,2,"g").px(3,0,"k").px(12,0,"k"),ar=new w(6,24,"s").row(23,0,5,"S").col(2,21,23,"S"),ir=new w(8,13,"t").col(0,0,9,"D").row(9,0,7,"D").rect(0,10,8,3,"T").row(12,0,7,"D"),lr=new w(8,24,"p").col(4,1,21,"P").row(0,0,7,"P"),cr=new w(8,24,"p").col(3,0,21,"P").row(0,0,7,"P"),pr=new w(8,24,"p").col(3,0,21,"P"),hr=new w(10,9,"z").row(0,0,9,"Z").row(2,3,6,"l").row(4,3,6,"l").row(6,3,6,"l").col(2,1,6,"Z").col(7,1,6,"Z").rect(0,7,10,2,"Z"),mr=new w(10,9,"z").row(0,0,9,"Z").rect(0,7,10,2,"Z").col(5,1,6,"Z");function $(t){let e=new w(16,10,"."),r=(s,a,n)=>{if(t.brows==="flat")e.row(1,s,s+2,"k");else if(t.brows==="high")e.row(0,s,s+2,"k");else {let i=t.brows==="down"?1:0,l=1-i;e.px(a,i,"k").px(s+1,t.brows==="down"?0:1,"k"),e.px(n,l,"k");}};r(3,5,3),r(10,10,12);let o=s=>{if(t.eyes===0){e.row(3,s,s+2,"k");return}let a=t.eyes===3||t.eyes===2?2:3;for(let n=a;n<a+t.eyes;n++)e.px(s,n,"w").px(s+1,n,"b").px(s+2,n,"w");};switch(o(3),o(10),t.mouth){case "line":e.row(7,6,9,"m");break;case "smile":e.px(5,6,"m").px(10,6,"m").row(7,6,9,"m");break;case "frown":e.row(7,6,9,"m").px(5,8,"m").px(10,8,"m");break;case "open":e.rect(6,7,4,2,"o");break;case "small":e.rect(7,7,2,2,"o");break;case "wide":e.row(7,5,10,"m").rect(6,8,4,1,"o");break}return e}var vt={f_neutral:$({brows:"flat",eyes:2,mouth:"line"}),f_blink:$({brows:"flat",eyes:0,mouth:"line"}),f_happy:$({brows:"high",eyes:2,mouth:"smile"}),f_sad:$({brows:"up",eyes:2,mouth:"frown"}),f_angry:$({brows:"down",eyes:1,mouth:"wide"}),f_surprised:$({brows:"high",eyes:3,mouth:"small"}),f_scared:$({brows:"up",eyes:3,mouth:"open"}),f_tired:$({brows:"flat",eyes:1,mouth:"line"}),f_hurt:$({brows:"down",eyes:0,mouth:"open"}),f_talk:$({brows:"flat",eyes:2,mouth:"open"})},dr=new w(16,24,"t").row(0,5,10,"s").row(1,6,9,"s").px(5,1,"T").px(10,1,"T").row(7,0,15,"D").row(10,0,15,"D").rect(0,18,16,2,"T").rect(0,20,16,4,"p").row(20,0,15,"P"),ur=new w(16,24,"t").row(0,5,10,"T").row(7,0,15,"D").row(10,0,15,"D").rect(0,18,16,2,"T").rect(0,20,16,4,"p").row(20,0,15,"P"),fr=new w(8,24,"t").row(7,0,7,"D").row(10,0,7,"D").rect(0,18,8,2,"T").rect(0,20,8,4,"p").row(20,0,7,"P"),br=new w(8,9,"t").row(3,0,7,"D").rect(0,7,8,2,"T"),ve=(t,e)=>t.row(e-1,0,t.w-1,"D").where((r,o)=>o>=e&&o<=e+3&&(r+o)%2===0,"T").row(e+4,0,t.w-1,"D"),gr=ve(new w(16,24,"t"),6).row(0,6,9,"s").row(0,4,5,"T").row(0,10,11,"T").row(1,4,11,"T").where((t,e)=>e>=18&&e<=19&&t%2===0,"D").where((t,e)=>e>=18&&e<=19&&t%2===1,"T").rect(0,20,16,4,"p"),yr=ve(new w(16,24,"t"),6).row(0,4,11,"T").where((t,e)=>e>=18&&e<=19,"D").rect(0,20,16,4,"p"),xr=ve(new w(8,24,"t"),6).where((t,e)=>e>=18&&e<=19,"D").rect(0,20,8,4,"p"),wr=ve(new w(8,22,"t"),9).where((t,e)=>e>=19&&t%2===0,"D"),Ct=t=>new w(8,24,"s").rect(0,0,8,12,"p").col(t,1,10,"P").row(11,0,7,"P").row(12,0,7,"S").rect(0,19,8,5,"l"),kr=Ct(4),Er=Ct(3),Rr=new w(9,5,"z").row(1,3,5,"l").rect(0,3,9,2,"l"),Sr=new w(10,5,"z").row(1,3,6,"Z").rect(0,3,10,2,"l"),vr=new w(17,6,"a").rect(0,4,17,2,"A"),Cr=new w(22,22,"a").where((t,e)=>(t*3+e*5)%11===0,"A"),Tr=new w(17,20,"h").where((t,e)=>(t*5+e)%4===0,"H").where((t,e)=>e>10&&(t*3+e*2)%7===0,"k"),S=t=>t.tex(),Tt=["shirt","tee","sweater"],Mt=["pants","shorts"],At=["boots","sneakers"],en=["short","long","curly","none"],ie=(t,e={})=>({front:t,back:t,left:t,right:t,...e});function Je(t={}){let e=t.top??"shirt",r=t.bottom??"pants",o=t.shoes??"boots",s=t.hair??"short",a=Xe(Jt,t.colors??{});a={...a,a:t.colors?.hat??"#d9c9a3"},a.A=Z(a.a,.72);let n={head_front:S(qt),head_left:S(St),head_right:S(Zt),head_back:S(Qt),hair_top:S(er),hair_band:S(tr),arm_skin:S(ar),...Object.fromEntries(Object.entries(vt).map(([R,F])=>[R,S(F)]))},i=[{name:"head",bone:"head",size:[8,8,8],pos:[0,28,0],color:"s",faces:{front:"head_front",left:"head_left",right:"head_right",back:"head_back",top:"hair_top"}},{name:"nose",bone:"head",size:[1,1.5,.8],pos:[0,26.9,-4.4],color:"S",faces:{front:"s"}}];if(s!=="none"){if(t.hat||i.push({name:"hair",bone:"head",size:s==="curly"?[9,2.2,9]:[8.6,1.6,8.6],pos:[0,s==="curly"?32.5:32.2,.15],color:"h",faces:ie("hair_band",{top:"hair_top"})}),s==="curly"&&!t.hat)for(let[R,F]of [[-2,-1.5],[2,.5],[-0.5,2.5]])i.push({name:"curl",bone:"head",size:[3.2,1.4,3.2],pos:[R,33.9,F],color:"h",faces:ie("hair_band",{top:"hair_top"})});s==="long"?(n.hair_long=S(Tr),i.push({name:"hairLong",bone:"head",size:[8.8,10,1],pos:[0,27,4.4],color:"h",faces:ie("hair_long",{top:"hair_top"})},{name:"hairSide",bone:"head",size:[.8,9,6],pos:[-4.4,27.5,1],color:"h",faces:ie("hair_long",{top:"hair_top"}),mirror:true})):i.push({name:"hairBack",bone:"head",size:[8.6,5,.8],pos:[0,29.6,4.25],color:"h",faces:{back:"head_back",left:"hair_band",right:"hair_band"}});}t.hat&&(n.hat_crown=S(vr),n.hat_brim=S(Cr),i.push({name:"hatBrim",bone:"head",size:[11,.8,11],pos:[0,32.4,0],color:"a",faces:{top:"hat_brim",bottom:"hat_brim"}},{name:"hatCrown",bone:"head",size:[8.4,3,8.4],pos:[0,34.3,0],color:"a",faces:ie("hat_crown")}));let l={shirt:[rr,or,nr],tee:[dr,ur,fr],sweater:[gr,yr,xr]},[c,u,b]=l[e];n.top_front=S(c),n.top_back=S(u),n.top_side=S(b),i.push({name:"torso",bone:"body",size:[8,12,4],pos:[0,18,0],color:"t",faces:{front:"top_front",back:"top_back",left:"top_side",right:"top_side",bottom:"p"}}),e==="shirt"&&(n.belt=S(sr),i.push({name:"belt",bone:"body",size:[8.4,1,4.4],pos:[0,13.5,0],color:"B",faces:{front:"belt",back:"belt"}})),i.push({name:"arm",bone:"armL",size:[3,12,3],pos:[-5.5,18,0],color:"s",faces:ie("arm_skin",{top:"t",bottom:"S"}),mirror:true});let g=e==="sweater"?11:e==="tee"?4.5:6.5;n.sleeve=S(e==="sweater"?wr:e==="tee"?br:ir),i.push({name:"sleeve",bone:"armL",size:[3.6,g,3.6],pos:[-5.5,24-g/2,0],color:"t",faces:ie("sleeve",{bottom:"D"}),mirror:true}),r==="shorts"?(n.leg_front=S(kr),n.leg_side=S(Er)):(n.leg_front=S(lr),n.leg_back=S(cr),n.leg_side=S(pr)),i.push({name:"leg",bone:"legL",size:[4,12,4],pos:[-2,6,0],color:"p",faces:{front:"leg_front",back:r==="shorts"?"leg_front":"leg_back",left:"leg_side",right:"leg_side"},mirror:true}),o==="boots"?(n.shoe_front=S(hr),n.shoe_side=S(mr)):(n.shoe_front=S(Rr),n.shoe_side=S(Sr));let E=o==="boots"?4.5:2.5;return i.push({name:"shoe",bone:"legL",size:[4.6,E,5.2],pos:[-2,E/2,-0.3],color:"z",faces:{front:"shoe_front",back:"shoe_side",left:"shoe_side",right:"shoe_side",bottom:"Z"},mirror:true}),{version:1,name:t.name??A({en:"Traveler",ru:"\u041F\u0443\u0442\u043D\u0438\u043A"}),description:t.description??A({en:"A traveler in a shirt with pockets, trousers and laced boots",ru:"\u041F\u0443\u0442\u043D\u0438\u043A \u0432 \u0440\u0443\u0431\u0430\u0448\u043A\u0435 \u0441 \u043A\u0430\u0440\u043C\u0430\u043D\u0430\u043C\u0438, \u0431\u0440\u044E\u043A\u0430\u0445 \u0438 \u0448\u043D\u0443\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0445 \u0431\u043E\u0442\u0438\u043D\u043A\u0430\u0445"}),rig:"humanoid",palette:a,textures:n,parts:i,face:{bone:"head",rect:[0,3,8,5],expressions:{neutral:"f_neutral",blink:"f_blink",happy:"f_happy",sad:"f_sad",angry:"f_angry",surprised:"f_surprised",scared:"f_scared",tired:"f_tired",hurt:"f_hurt",talk:"f_talk"}},style:{walk:"normal",idle:"calm",energy:.5},finish:{noise:.5,outline:.4,shade:.25,density:2},tags:t.tags??["player"]}}function Ce(t,e){return {textures:Object.fromEntries(Object.entries(vt).map(([r,o])=>[r,S(o)])),face:{bone:t,rect:e,expressions:{neutral:"f_neutral",blink:"f_blink",happy:"f_happy",sad:"f_sad",angry:"f_angry",surprised:"f_surprised",scared:"f_scared",tired:"f_tired",hurt:"f_hurt",talk:"f_talk"}}}}var qe=Je(),Ye=null;function le(){if(!Ye){let t=q(qe);if(!t.ok)throw new Error(t.error);Ye=t.spec;}return Ye}function Lt(t){let e=document.createElement("canvas");e.width=256,e.height=48;let r=e.getContext("2d");r&&(r.fillStyle="rgba(0,0,0,0.45)",r.fillRect(0,0,256,48),r.font="bold 28px sans-serif",r.fillStyle="#fff",r.textAlign="center",r.textBaseline="middle",r.fillText(t.slice(0,18),128,25));let o=new ___namespace.CanvasTexture(e),s=new ___namespace.Sprite(new ___namespace.SpriteMaterial({map:o,depthTest:false,transparent:true}));return s.scale.set(1.6,.3,1),s.renderOrder=10,s}function Ze(t){t.removeFromParent(),t.material.map?.dispose(),t.material.dispose();}var v={rx:0,ry:1,rz:2,px:3,py:4,pz:5,sx:6,sy:7,sz:8},on=Object.keys(v),ue=[0,0,0,0,0,0,1,1,1];function fe(t,e){let r=t.get(e);return r||(r=Float64Array.from(ue),t.set(e,r)),r}function Y(t,e,r,o){let s=fe(t,e),a=v[r];a>=6?s[a]=s[a]*o:s[a]=s[a]+o;}function p(t,e,r,o){fe(t,e)[v[r]]=o;}function ce(t){for(let e of t.values())e.set(ue);}function Ot(t,e,r,o){let s=new Set([...e.keys(),...r.keys()]);for(let a of s){let n=e.get(a)??ue,i=r.get(a)??ue,l=fe(t,a);for(let c=0;c<9;c++)l[c]=n[c]+(i[c]-n[c])*o;}}function Te(t,e){ce(t);for(let[r,o]of e)fe(t,r).set(o);}var nn=["none","block","tool","sword","bow","shield","food","staff","item"];function Me(){return {speed:0,vy:0,onGround:true,inWater:false,flying:false,gliding:false,sneaking:false,sprinting:false,riding:false,sitting:false,sleeping:false,dead:false,lookYaw:0,lookPitch:0,yawRate:0,held:"none",use:null,talk:false}}var sn=["swing","hurt","place","land","jump","throw"];var xe=1/16,Ae=class{group=new ___namespace.Group;root=new ___namespace.Group;asset;spec;bones=new Map;byRole=new Map;meshes=[];material;decalMat;decal=null;expression=null;sockets=new Map;attached=new Map;label=null;shadows;layer;brightness=1;constructor(e=le(),r={}){this.spec=e,this.shadows=r.shadows??true,this.layer=r.layer??0,this.material=new ___namespace.MeshLambertMaterial({alphaTest:.5}),this.decalMat=new ___namespace.MeshLambertMaterial({alphaTest:.5,polygonOffset:true,polygonOffsetFactor:-2,polygonOffsetUnits:-2}),this.group.add(this.root),this.asset=$e(e),this.build(),r.name&&this.setName(r.name);}get height(){let e=this.asset.layout;return e.height*e.scale*xe}get eye(){let e=this.asset.layout;return e.eye*e.scale*xe}get expressions(){return Object.keys(this.asset.layout.face?.uv??{})}get hash(){return this.asset.layout.hash}setSpec(e){let r=$e(e);if(r===this.asset){Se(r);return}this.clear(),Se(this.asset),this.asset=r,this.spec=e,this.build();}build(){let{layout:e,geometries:r,texture:o}=this.asset;this.material.map=o,this.material.needsUpdate=true,this.decalMat.map=o,this.decalMat.needsUpdate=true,this.root.scale.setScalar(e.scale*xe);let s=new Map(e.bones.map(n=>[n.name,n.pivot]));for(let n of e.bones){let i=new ___namespace.Group,l=n.parent?s.get(n.parent)??[0,0,0]:[0,0,0],c=[n.pivot[0]-l[0],n.pivot[1]-l[1],n.pivot[2]-l[2]];i.position.set(...c);let u={name:n.name,role:n.role,group:i,rest:c};this.bones.set(n.name,u);let b=this.byRole.get(n.role)??[];b.push(u),this.byRole.set(n.role,b);let g=r.get(n.name);if(g){let E=new ___namespace.Mesh(g,this.material);E.castShadow=E.receiveShadow=this.shadows,E.layers.set(this.layer),this.meshes.push(E),i.add(E);}}for(let n of e.bones){let i=this.bones.get(n.name);((n.parent?this.bones.get(n.parent):void 0)?.group??this.root).add(i.group);}let a=e.face;if(a){let n=new ___namespace.BufferGeometry;n.setAttribute("position",new ___namespace.BufferAttribute(a.corners,3));let i=new Float32Array(12);for(let l=0;l<4;l++)i[l*3+2]=-1;n.setAttribute("normal",new ___namespace.BufferAttribute(i,3)),n.setAttribute("uv",new ___namespace.BufferAttribute(new Float32Array(8),2)),n.setIndex([0,2,1,0,3,2]),this.decal=new ___namespace.Mesh(n,this.decalMat),this.decal.layers.set(this.layer),this.bones.get(a.bone)?.group.add(this.decal),this.expression=null,this.setExpression("neutral");}for(let n of e.sockets){let i=new ___namespace.Object3D;i.position.set(...n.at),i.scale.setScalar(1/(e.scale*xe)),this.bones.get(n.bone)?.group.add(i),this.sockets.set(n.name,i);let l=this.attached.get(n.name);l&&i.add(l);}this.placeLabel(),this.setBrightness(this.brightness);}clear(){for(let e of this.sockets.values())for(let r of [...e.children])e.remove(r);this.root.clear(),this.decal?.geometry.dispose(),this.decal=null,this.meshes=[],this.bones=new Map,this.byRole=new Map,this.sockets.clear();}applyPose(e){let r=e.get("root");if(r){this.root.rotation.set(r[v.rx],r[v.ry],r[v.rz]);let o=this.asset.layout.scale*xe;this.root.position.set(r[v.px]*o,r[v.py]*o,r[v.pz]*o);}else this.root.rotation.set(0,0,0),this.root.position.set(0,0,0);for(let[o,s]of this.byRole){let a=e.get(o);for(let n of s){let i=n.group;if(!a){i.rotation.set(0,0,0),i.position.set(...n.rest),i.scale.set(1,1,1);continue}i.rotation.set(a[v.rx],a[v.ry],a[v.rz]),i.position.set(n.rest[0]+a[v.px],n.rest[1]+a[v.py],n.rest[2]+a[v.pz]),i.scale.set(a[v.sx],a[v.sy],a[v.sz]);}}}setExpression(e){if(e===this.expression||!this.decal)return;let r=this.asset.layout.face?.uv,o=r?.[e]??r?.neutral;if(!o)return;this.expression=e;let[s,a,n,i]=o,l=this.decal.geometry.getAttribute("uv");l.setXY(0,s,a),l.setXY(1,n,a),l.setXY(2,n,i),l.setXY(3,s,i),l.needsUpdate=true;}materials(){return [this.material,this.decalMat]}setBrightness(e){this.brightness=e,this.material.color.setScalar(e),this.decalMat.color.setScalar(e);}setEmissive(e){this.material.emissive.getHex()!==e&&(this.material.emissive.setHex(e),this.decalMat.emissive.setHex(e));}setShadows(e){if(e!==this.shadows){this.shadows=e;for(let r of this.meshes)r.castShadow=e;}}attach(e,r){let o=this.attached.get(e);if(o!==r){if(o&&o.removeFromParent(),!r){this.attached.delete(e);return}this.attached.set(e,r),this.sockets.get(e)?.add(r);}}attachedAt(e){return this.attached.get(e)??null}setName(e){this.label&&Ze(this.label),this.label=e?Lt(e):null,this.label&&this.group.add(this.label),this.placeLabel();}setLabelVisible(e){this.label&&(this.label.visible=e);}placeLabel(){this.label&&(this.label.position.y=this.height+.25);}forEachMesh(e){for(let r of this.meshes)e(r);this.decal&&e(this.decal);}dispose(){this.group.removeFromParent();for(let e of this.attached.values())e.removeFromParent();this.attached.clear(),this.clear(),this.label&&Ze(this.label),this.label=null,this.material.dispose(),this.decalMat.dispose(),Se(this.asset);}};var Le=new Map,Qe=new Set;function un(t){let e=me(t);if(!Le.has(e)){Le.set(e,t);for(let r of Qe)r(e);}return e}function fn(t){return typeof t=="string"?Le.get(t):void 0}function bn(t){let e={};for(let r of t){let o=Le.get(r);o&&(e[r]=o);}return e}function gn(t){return Qe.add(t),()=>Qe.delete(t)}var Mr=["#b08a62","#8a6a4a","#c8a878","#9a9a92","#7a5c44"],Ar=["#f1c9a5","#e6b892","#d9a982","#c08e68","#a0704c","#7a5238"],Lr=["#6b4a2f","#4a3424","#8a5a3a","#c27a48","#d8b878","#2e2622","#a07850","#9a9690"],Or=["#a7bea9","#e6e0cc","#d9c9a3","#b9a083","#a9b8c4","#c8b4a0","#9fb0a0","#d8d2c4","#b98f74","#8fa3b5"],Pr=["#8c9ca6","#a9b8b4","#8a8e94","#9fb3ad","#7d8a8f","#b0a58f"],_r=["#d9c9a3","#c8b48a","#a08a6a","#e6e0cc"];function En(t,e="",r=""){let o=we(ae("npc:"+t+"|"+e)),s=i=>i[Math.floor(o()*i.length)],a=Je({top:s(Tt),bottom:s(Mt),shoes:s(At),hair:s(["short","short","long","curly"]),hat:o()<.2,colors:{skin:s(Ar),hair:s(Lr),shirt:s(Or),pants:s(Pr),boots:s(Mr),hat:s(_r)}});a.name=t.slice(0,40),a.description=[e,r].filter(Boolean).join(" \u2014 ").slice(0,300),a.style={walk:s(["normal","normal","bouncy","heavy","sneaky"]),idle:s(["calm","calm","fidgety","proud"]),energy:Math.round(o()*10)/10},a.tags=["npc",...e?[e.slice(0,24)]:[]];let n=q(a);return n.ok?n.spec:le()}var re=([t,e,r])=>"#"+[t,e,r].map(o=>Math.round(o).toString(16).padStart(2,"0")).join("");function Ir(t){if(!t.length)return null;let e=r=>{let o=t.map(s=>s[r]).sort((s,a)=>s-a);return o[o.length>>1]};return [e(0),e(1),e(2)]}function zr(t,e){let{width:r,height:o,data:s}=t,a=(T,L)=>{let G=(L*r+T)*4;return [s[G],s[G+1],s[G+2]]},n=[a(0,0),a(r-1,0),a(0,o-1),a(r-1,o-1)],i=[0,1,2].map(T=>n.reduce((L,G)=>L+G[T],0)/4),l=T=>Math.abs(T[0]-i[0])+Math.abs(T[1]-i[1])+Math.abs(T[2]-i[2])>60,c=r,u=-1,b=o,g=-1;for(let T=0;T<o;T+=2)for(let L=0;L<r;L+=2)l(a(L,T))&&(c=Math.min(c,L),u=Math.max(u,L),b=Math.min(b,T),g=Math.max(g,T));u<0&&(c=0,u=r-1,b=0,g=o-1);let E=g-b+1,R=u-c+1,F=c+Math.floor(R*.3),K=c+Math.ceil(R*.7);return e.map(([T,L])=>{let G=[];for(let m=b+Math.floor(E*T);m<b+Math.ceil(E*L);m++)for(let k=F;k<K;k++){if(m<0||m>=o||k<0||k>=r)continue;let y=a(k,m);l(y)&&G.push(y);}return Ir(G)})}var Fr=[[0,.06],[.1,.22],[.3,.52],[.6,.86],[.92,1]];function Tn(t,e="humanoid",r=Re()){let[o,s,a,n,i]=zr(t,Fr);if(e==="humanoid"){let c=JSON.parse(JSON.stringify(qe));c.palette=Xe(c.palette,{...o?{hair:re(o)}:{},...s?{skin:re(s)}:{},...a?{shirt:re(a)}:{},...n?{pants:re(n)}:{},...i?{boots:re(i)}:{}}),c.name=r,c.tags=[];let u=q(c);return u.ok?u.spec:le()}let l=q({name:r,rig:e,palette:{s:re(s??o??[198,156,124]),t:re(a??[58,143,214]),p:re(n??i??[44,62,107]),w:"#f4f4f4",b:"#1d1d21"},textures:{f_neutral:{w:4,h:2,rows:["wbbw","...."]},f_blink:{w:4,h:2,rows:["bbbb","...."]}},face:{rect:e==="blob"?[4,4,4,2]:e==="flyer"?[0,1,4,2]:[2,2,4,2],expressions:{neutral:"f_neutral",blink:"f_blink"}}});return l.ok?l.spec:le()}var Nr={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}},Hr={calm:{},fidgety:{fidget:1,breath:1.3},proud:{chest:.08,breath:.8}};function et(t){let e={amp:.8,arm:.6,bob:0,tempo:1,sway:0,quant:false,breath:1,fidget:0,chest:0,...Nr[t.walk],...Hr[t.idle]};return e.tempo*=.8+.4*t.energy,e.amp*=.85+.3*t.energy,e}function tt(t,e=0){let r=Math.sin(t.phase+e);return t.style.quant?Math.max(-1,Math.min(1,r*3)):r}function rt(t,e,r){let o=tt(e)*r;p(t,"legL","rx",o),p(t,"legR","rx",-o),p(t,"legFL","rx",o),p(t,"legBR","rx",o),p(t,"legFR","rx",-o),p(t,"legBL","rx",-o);}function ot(t,e,r){let o=tt(e)*r;p(t,"armL","rx",-o),p(t,"armR","rx",o);}var Br=(t,e)=>{let r=Math.sin(e.clock*2)*e.style.breath;p(t,"armL","rz",-0.04-.03*r),p(t,"armR","rz",.04+.03*r),p(t,"head","rx",.03*Math.sin(e.clock*1.7)+e.style.chest),p(t,"body","rx",e.style.chest*-0.5),e.style.fidget&&(p(t,"head","ry",.35*Math.sin(e.clock*.7)*Math.sin(e.clock*.31)),p(t,"root","ry",.05*Math.sin(e.clock*.9))),p(t,"body","sy",1+.04*Math.sin(e.clock*3));},Dr=(t,e)=>{rt(t,e,e.style.amp),ot(t,e,e.style.arm),p(t,"root","py",e.style.bob*Math.abs(Math.cos(e.phase))),p(t,"body","rz",e.style.sway*tt(e));},jr=(t,e)=>{rt(t,e,e.style.amp*1.3),ot(t,e,e.style.arm*1.6),p(t,"body","rx",-0.18),p(t,"head","rx",.18),p(t,"root","py",(.8+e.style.bob)*Math.abs(Math.cos(e.phase)));},Vr=(t,e)=>{rt(t,e,e.style.amp*.5*Math.min(1,e.input.speed)),ot(t,e,e.style.arm*.4*Math.min(1,e.input.speed)),p(t,"body","rx",-0.45),p(t,"head","rx",.45),Y(t,"armL","rx",.25),Y(t,"armR","rx",.25),p(t,"root","py",-1.5);},Gr=(t,e)=>{p(t,"root","rx",-1.3),p(t,"head","rx",1),p(t,"armL","rx",Math.PI-.5+.5*Math.sin(e.t*3)),p(t,"armR","rx",Math.PI-.5+.5*Math.sin(e.t*3+Math.PI)),p(t,"legL","rx",.3*Math.sin(e.t*8)),p(t,"legR","rx",-0.3*Math.sin(e.t*8));},Ur=(t,e)=>{p(t,"legL","rx",.15),p(t,"legR","rx",.1),p(t,"armL","rz",-0.15),p(t,"armR","rz",.15),p(t,"root","py",.6*Math.sin(e.t*2));},Wr=t=>{p(t,"root","rx",-1.35),p(t,"head","rx",1.1),p(t,"armL","rz",-1.3),p(t,"armR","rz",1.3);},Kr=(t,e)=>{let r=.15*Math.sin(e.t*10);p(t,"armL","rz",-0.6-r),p(t,"armR","rz",.6+r),p(t,"legL","rx",.25),p(t,"legR","rx",-0.25);},$r=t=>{p(t,"legL","rx",1.45),p(t,"legR","rx",1.45),p(t,"legL","ry",.1),p(t,"legR","ry",-0.1),p(t,"root","py",-10),p(t,"body","rx",.4),p(t,"legBL","rx",1.2),p(t,"legBR","rx",1.2);},Yr=t=>{p(t,"legL","rx",1.4),p(t,"legR","rx",1.4),p(t,"legL","rz",-0.3),p(t,"legR","rz",.3),p(t,"armL","rx",.45),p(t,"armR","rx",.45);},Xr=t=>{p(t,"root","rx",Math.PI/2),p(t,"root","py",2);},Jr=t=>{p(t,"root","rz",Math.PI/2),p(t,"root","py",2);},qr=(t,e)=>{let r=Math.sin(e.phase*.5);p(t,"root","py",6*Math.max(0,r));let o=r<0?.2*-r:0;p(t,"body","sy",1-o+.1*Math.max(0,r)),p(t,"body","sx",1+o*.6),p(t,"body","sz",1+o*.6);},Zr=(t,e)=>{let r=Math.sin(Math.PI*e.k);p(t,"armR","rx",1.9*r),p(t,"armR","ry",.3*r),p(t,"body","ry",-0.3*r);},Qr=(t,e)=>{let r=Math.sin(Math.PI*e.k);p(t,"armR","rx",.9*r);},eo=(t,e)=>{let r=e.k<.4?-1.5*(e.k/.4):-1.5+3.5*((e.k-.4)/.6);p(t,"armR","rx",e.k>.9?r*(1-e.k)*10:r);},to=(t,e)=>{let r=Math.sin(Math.PI*e.k);p(t,"body","rx",.15*r),p(t,"head","rx",.2*r),p(t,"root","rz",.05*r);},ro=(t,e)=>{let r=Math.sin(Math.PI*e.k);p(t,"root","py",-1.5*r),p(t,"legL","rx",.2*r),p(t,"legR","rx",.2*r),p(t,"body","sy",1-.2*r),p(t,"body","sx",1+.12*r),p(t,"body","sz",1+.12*r);},oo=(t,e)=>{p(t,"armR","rx",1.3+.1*Math.sin(e.t*16)),p(t,"armR","ry",-0.5),p(t,"head","rx",-0.1+.08*Math.sin(e.t*16));},no=t=>{p(t,"armR","rx",2),p(t,"armR","ry",-0.4),p(t,"head","rx",.35);},so=t=>{p(t,"armR","rx",1.57),p(t,"armR","ry",-0.1),p(t,"armL","rx",1.57),p(t,"armL","ry",.35);},ao=t=>{p(t,"armL","rx",.9),p(t,"armL","ry",-0.6);},Oe={idle:Br,walk:Dr,run:jr,sneak:Vr,swim:Gr,fly:Ur,glide:Wr,fall:Kr,sit:$r,ride:Yr,sleep:Xr,dead:Jr,hop:qr,swing:Zr,place:Qr,throw:eo,hurt:to,land:ro,eat:oo,drink:no,draw:so,block:ao},Pt={blob:{walk:"hop",run:"hop",sneak:"hop"}},_t={swing:.3,place:.2,throw:.45,hurt:.3,land:.22};var Pe=Math.PI,_e={wave:{label:"\u041F\u043E\u043C\u0430\u0445\u0430\u0442\u044C",duration:2,emotion:"happy",tracks:{"armR.rz":[[0,0],[.25,2.7],[.5,2.3],[.75,2.8],[1,2.3],[1.25,2.8],[1.5,2.4],[2,0]],"armR.rx":[[0,0],[.25,.2],[1.75,.2],[2,0]],"head.rz":[[0,0],[.5,.1],[1.5,.1],[2,0]]}},cheer:{label:"\u0423\u0440\u0430!",duration:1.6,emotion:"happy",tracks:{"armL.rz":[[0,0],[.25,-2.8],[1.35,-2.8],[1.6,0]],"armR.rz":[[0,0],[.25,2.8],[1.35,2.8],[1.6,0]],"root.py":[[0,0],[.3,3],[.55,0],[.8,3],[1.05,0]]}},dance:{label:"\u0422\u0430\u043D\u0435\u0446",duration:2,loop:true,emotion:"happy",tracks:{"root.ry":[[0,.3],[.5,-0.3],[1,.3],[1.5,-0.3],[2,.3]],"armL.rz":[[0,-0.4],[.5,-2.4],[1,-0.4],[1.5,-2.4],[2,-0.4]],"armR.rz":[[0,2.4],[.5,.4],[1,2.4],[1.5,.4],[2,2.4]],"legL.rx":[[0,0],[.5,.5],[1,0],[2,0]],"legR.rx":[[0,0],[1,0],[1.5,.5],[2,0]],"root.py":[[0,0],[.25,1.5],[.5,0],[.75,1.5],[1,0],[1.25,1.5],[1.5,0],[1.75,1.5],[2,0]],"tail.ry":[[0,.6],[.5,-0.6],[1,.6],[1.5,-0.6],[2,.6]]}},point:{label:"\u0423\u043A\u0430\u0437\u0430\u0442\u044C",duration:1.6,tracks:{"armR.rx":[[0,0],[.2,1.55],[1.4,1.55],[1.6,0]]}},laugh:{label:"\u0421\u043C\u0435\u0445",duration:1.6,emotion:"happy",tracks:{"body.rx":[[0,0],[.2,.15],[.4,.05],[.6,.15],[.8,.05],[1,.15],[1.2,.05],[1.6,0]],"head.rx":[[0,0],[.2,.3],[1.4,.3],[1.6,0]],"armL.rx":[[0,0],[.2,.5],[1.4,.5],[1.6,0]],"armR.rx":[[0,0],[.2,.5],[1.4,.5],[1.6,0]]}},cry:{label:"\u041F\u043B\u0430\u043A\u0430\u0442\u044C",duration:2.4,emotion:"sad",tracks:{"head.rx":[[0,0],[.3,-0.4],[2.1,-0.4],[2.4,0]],"head.rz":[[0,0],[.6,.08],[.9,-0.08],[1.2,.08],[1.5,-0.08],[2.4,0]],"armR.rx":[[0,0],[.3,2.3],[2.1,2.3],[2.4,0]],"armR.ry":[[0,0],[.3,-0.6],[2.1,-0.6],[2.4,0]],"armL.rx":[[0,0],[.3,2.3],[2.1,2.3],[2.4,0]],"armL.ry":[[0,0],[.3,.6],[2.1,.6],[2.4,0]]}},bow:{label:"\u041F\u043E\u043A\u043B\u043E\u043D",duration:1.4,tracks:{"body.rx":[[0,0],[.4,-0.7],[1,-0.7],[1.4,0]],"armR.rx":[[0,0],[.4,.5],[1,.5],[1.4,0]]}},shrug:{label:"\u041F\u043E\u0436\u0430\u0442\u044C \u043F\u043B\u0435\u0447\u0430\u043C\u0438",duration:1.2,tracks:{"armL.rz":[[0,0],[.3,-0.5],[.9,-0.5],[1.2,0]],"armR.rz":[[0,0],[.3,.5],[.9,.5],[1.2,0]],"armL.rx":[[0,0],[.3,.6],[.9,.6],[1.2,0]],"armR.rx":[[0,0],[.3,.6],[.9,.6],[1.2,0]],"head.rz":[[0,0],[.3,.25],[.9,.25],[1.2,0]]}},facepalm:{label:"\u0420\u0443\u043A\u0430-\u043B\u0438\u0446\u043E",duration:1.6,emotion:"tired",tracks:{"armR.rx":[[0,0],[.3,2.5],[1.3,2.5],[1.6,0]],"armR.rz":[[0,0],[.3,-0.4],[1.3,-0.4],[1.6,0]],"head.rx":[[0,0],[.3,-0.35],[1.3,-0.35],[1.6,0]]}},sit:{label:"\u0421\u0435\u0441\u0442\u044C",duration:1,loop:true,tracks:{"legL.rx":[[0,Pe*.46],[1,Pe*.46]],"legR.rx":[[0,Pe*.46],[1,Pe*.46]],"root.py":[[0,-10],[1,-10]]}}},Pn=Object.keys(_e);function _n(t){return typeof t=="string"&&t in _e}function io(t,e){let r=t[0];if(e<=r[0])return r[1];for(let o=1;o<t.length;o++){let s=t[o];if(e<=s[0]){let a=t[o-1],n=(e-a[0])/Math.max(1e-6,s[0]-a[0]),i=n*n*(3-2*n);return a[1]+(s[1]-a[1])*i}}return t[t.length-1][1]}function It(t,e,r){let o=e.loop?r%e.duration:Math.min(r,e.duration);for(let[s,a]of Object.entries(e.tracks)){let n=s.lastIndexOf("."),i=s.slice(0,n),l=s.slice(n+1);l in v&&p(t,i,l,io(a,o));}}var Ie=["neutral","happy","sad","angry","surprised","scared","tired","hurt"];function lo(t){return typeof t=="string"&&Ie.includes(t)}var zt={neutral:["neutral"],happy:["happy","neutral"],sad:["sad","tired","neutral"],angry:["angry","neutral"],surprised:["surprised","scared","neutral"],scared:["scared","surprised","sad","neutral"],tired:["tired","sad","neutral"],hurt:["hurt","angry","sad","neutral"]},nt={neutral:{add:{},tempo:1},happy:{add:{"head.rx":.08},tempo:1.1},sad:{add:{"head.rx":-0.3,"body.rx":-0.08,"tail.rx":.5},tempo:.8},angry:{add:{"body.rx":-0.12,"head.rx":.1,"armL.rz":-0.1,"armR.rz":.1},tempo:1.1},surprised:{add:{"head.rx":.15,"body.rx":.05},tempo:1},scared:{add:{"body.rx":-0.1,"head.rx":-0.1,"armL.rx":.3,"armR.rx":.3,"tail.rx":.6},tempo:1.3},tired:{add:{"head.rx":-0.35,"body.rx":-0.12},tempo:.7},hurt:{add:{"body.rx":-0.1},tempo:1}};function Ft(t,e,r){if(!(r<=0))for(let[o,s]of Object.entries(nt[e].add)){let a=o.lastIndexOf(".");Y(t,o.slice(0,a),o.slice(a+1),(s??0)*r);}}var Hn={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 Bn(t){let e=[[/(>:\(|😠|😡|🤬)/u,"angry"],[/(:'\(|😢|😭)/u,"sad"],[/(:\(|☹|🙁|😞)/u,"sad"],[/(:o|:O|😮|😲)/u,"surprised"],[/(😱|😨)/u,"scared"],[/(-_-|😴|😩|🥱)/u,"tired"],[/(:\)|:D|\^\^|😀|😃|😄|😁|🙂|😊|😂)/u,"happy"]];for(let[r,o]of e)if(r.test(t))return o;return null}var co=[{state:"dead",when:t=>t.dead,clip:"dead",blend:.25},{state:"sleep",when:t=>t.sleeping,clip:"sleep",blend:.3},{state:"ride",when:t=>t.riding,clip:"ride",blend:.2},{state:"sit",when:t=>t.sitting,clip:"sit",blend:.3},{state:"swim",when:t=>t.inWater&&!t.onGround&&!t.flying,clip:"swim",blend:.3},{state:"glide",when:t=>t.gliding,clip:"glide",blend:.25},{state:"fly",when:t=>t.flying,clip:"fly",blend:.25},{state:"fall",when:(t,e)=>e.airTime>.35&&t.vy<-4,clip:"fall",blend:.2},{state:"sneak",when:t=>t.sneaking,clip:"sneak",blend:.15},{state:"run",when:t=>t.sprinting&&t.speed>3||t.speed>6.5,clip:"run",blend:.15},{state:"walk",when:t=>t.speed>.4,clip:"walk",blend:.15},{state:"idle",when:()=>true,clip:"idle",blend:.2}],po=new Set(["hurt","land"]),ho={eat:"eat",drink:"drink",draw:"draw",block:"block"},mo={tail:(t,e)=>[["ry",-t.yawRate*.25+.12*Math.sin(e*2)],["rx",-(.1+Math.min(t.speed,8)*.06)]],cape:(t,e)=>[["rx",-(.05+Math.min(t.speed,8)*.12)-(t.speed>1?.06*Math.sin(e*9):0)-(t.vy<-3?.4:0)]],hair:t=>[["rx",-Math.min(t.speed,8)*.03]],ear:(t,e)=>[["rz",.08*Math.sin(e*1.3)+Math.min(t.speed,6)*.02]],antenna:(t,e)=>[["rx",.1*Math.sin(e*3)-t.vy*.02]],wingL:(t,e)=>t.flying||t.gliding||!t.onGround&&!t.inWater?[["rz",t.gliding?-0.05:-0.7*Math.sin(e*12)]]:[["rz",1.1+.05*Math.sin(e*1.5)]],wingR:(t,e)=>t.flying||t.gliding||!t.onGround&&!t.inWater?[["rz",t.gliding?.05:.7*Math.sin(e*12)]]:[["rz",-1.1-.05*Math.sin(e*1.5)]]},ze=t=>{let e=Math.max(0,Math.min(1,t));return e*e*(3-2*e)},Fe=class{rig;style;faces;pose=new Map;expression="neutral";state="idle";stateT=0;clock=0;phase=0;airTime=0;wasOnGround=true;loco=new Map;from=new Map;lastLoco=new Map;blendT=1;blendDur=.2;tmp=new Map;actions=[];useClip=null;useW=0;emote=null;mood="neutral";flash=null;postureW=new Map;blinkT=3;blinking=0;talkT=0;springs=new Map;constructor(e,r,o=[]){this.rig=e,this.style=et(r),this.faces=new Set(o);}setRandom(e){this.random=e;}random=Math.random;setStyle(e){this.style=et(e);}setEmotion(e,r){r&&r>0?this.flash={emotion:e,left:r}:this.mood=e;}get emotion(){return this.emote?.def.emotion?this.emote.def.emotion:this.flash?.emotion??this.mood}get emoting(){return this.emote?.id??null}playEmote(e){this.emote={id:e,def:_e[e],t:0};}stopEmote(){this.emote=null;}trigger(e){switch(e){case "swing":case "place":case "throw":case "hurt":case "land":{let r=e;this.actions=this.actions.filter(o=>o.clip!==r),this.actions.push({clip:r,t:0,dur:_t[r]??.3}),e==="hurt"&&this.setEmotion("hurt",.8);break}}}update(e,r=Me()){e=Math.min(e,.1),this.clock+=e;let o=this.emotion,s=nt[o].tempo*this.style.tempo;!r.onGround&&!r.inWater?this.airTime+=e:(!this.wasOnGround&&this.airTime>.3&&r.onGround&&this.trigger("land"),this.airTime=0),this.wasOnGround=r.onGround,this.phase+=r.speed*e*3.5*s;let a=co.find(c=>c.when(r,this));a.state!==this.state&&(Te(this.from,this.lastLoco),this.state=a.state,this.stateT=0,this.blendT=0,this.blendDur=a.blend),this.stateT+=e,ce(this.loco);let n=Pt[this.rig]?.[a.clip]??a.clip,i={t:this.stateT,k:0,phase:this.phase,input:r,style:this.style,clock:this.clock*s};if(Oe[n](this.loco,i),ce(this.pose),this.blendT<this.blendDur?(this.blendT+=e,Ot(this.pose,this.from,this.loco,ze(this.blendT/this.blendDur))):Te(this.pose,this.loco),Te(this.lastLoco,this.pose),this.emote){let c=this.emote;if(c.t+=e,r.speed>1||this.state!=="idle"||!c.def.loop&&c.t>=c.def.duration)this.emote=null;else {let g=c.def.loop?ze(c.t/.15):ze(Math.min(c.t/.15,(c.def.duration-c.t)/.15));ce(this.tmp),It(this.tmp,c.def,c.t),this.overlay(this.tmp,g,false);}}let l=r.use?ho[r.use]:null;l&&(this.useClip=l),this.useW=Math.max(0,Math.min(1,this.useW+(l?e:-e)*8)),this.useClip&&this.useW>0?(ce(this.tmp),Oe[this.useClip](this.tmp,{...i,t:this.clock}),this.overlay(this.tmp,ze(this.useW),false)):r.held!=="none"&&!this.emote&&Y(this.pose,"armR","rx",r.held==="staff"?.35:.2);for(let c of this.actions){c.t+=e;let u=Math.min(1,c.t/c.dur);ce(this.tmp),Oe[c.clip](this.tmp,{...i,t:c.t,k:u}),this.overlay(this.tmp,1,po.has(c.clip));}this.actions=this.actions.filter(c=>c.t<c.dur),this.state!=="dead"&&this.state!=="sleep"&&(Y(this.pose,"head","ry",Math.max(-1.1,Math.min(1.1,r.lookYaw))),Y(this.pose,"head","rx",Math.max(-1.2,Math.min(1.2,r.lookPitch)))),this.flash&&(this.flash.left-=e)<=0&&(this.flash=null);for(let c of Ie){let u=this.postureW.get(c)??0,b=u+((c===o?1:0)-u)*Math.min(1,e*6);this.postureW.set(c,b),this.state!=="dead"&&Ft(this.pose,c,b);}for(let[c,u]of Object.entries(mo))for(let[b,g]of u(r,this.clock)){let E=c+"."+b,R=this.springs.get(E);R||this.springs.set(E,R={x:g,v:0});let F=60,K=9;R.v+=(F*(g-R.x)-K*R.v)*e,R.x+=R.v*e,Y(this.pose,c,b,R.x);}return this.expression=this.face(r,e,o),this.pose}overlay(e,r,o){for(let[s,a]of e){let n=fe(this.pose,s);for(let i=0;i<9;i++)o?i>=v.sx?n[i]=n[i]*(1+(a[i]-1)*r):n[i]=n[i]+(a[i]-ue[i])*r:n[i]=n[i]+(a[i]-n[i])*r;}}face(e,r,o){let s=n=>n.find(i=>this.faces.has(i))??"neutral";if(e.dead||this.state==="dead"||e.sleeping)return s(["blink","hurt","neutral"]);let a=s(zt[o]);return e.viseme!==void 0?(this.talkT=0,e.viseme!=="rest"&&e.viseme!=="MBP"?s(["talk",a]):a):e.talk?(this.talkT+=r,Math.floor(this.talkT/.12)%2===0?s(["talk",a]):a):(this.talkT=0,this.blinking>0?(this.blinking-=r,s(["blink",a])):(this.blinkT-=r,this.blinkT<=0&&(this.blinkT=2.5+this.random()*3,o!=="surprised"&&o!=="scared"&&o!=="hurt"&&(this.blinking=.13)),a))}};var uo={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"}},fo={handR:"handR",handL:"handL",head:"headTop"},Nt=class{view;animator;input=Me();seed;pose="idle";jumpT=-1;constructor(e,r={}){this.view=new Ae(e,{shadows:false,...r}),this.seed=r.seed??1,this.animator=this.newAnimator();}get group(){return this.view.group}get height(){return this.view.height}setSpec(e){let r=this.view.hash;this.view.setSpec(e),this.view.hash!==r&&(this.animator=this.newAnimator());}setEmotion(e){this.animator.setEmotion(e);}setViseme(e){this.input.viseme=e;}setPose(e){if(e===this.pose)return;this.pose=e;let r=uo[e];this.input.speed=r.speed??0,this.input.sitting=!!r.sitting,r.emote&&this.animator.playEmote(r.emote),r.air&&(this.jumpT=0,this.animator.trigger("jump"));}playEmote(e){this.animator.playEmote(e);}attach(e,r){this.view.attach(fo[e],r);}update(e){let r=this.input;this.jumpT>=0&&(this.jumpT+=e,r.onGround=this.jumpT>.6,r.vy=this.jumpT<.3?4:-4,r.onGround&&(this.jumpT=-1,r.vy=0,this.animator.trigger("land")));let o=this.animator.update(e,r);this.view.applyPose(o),this.view.setExpression(this.animator.expression);}dispose(){this.view.dispose();}newAnimator(){let e=this.view.spec,r=new Fe(e.rig,e.style,this.view.expressions);return r.setRandom(we(this.seed)),r}};var bo=be.map(t=>{let e=J[t],r=e.bones.map(s=>`${s.name}@[${s.pivot.join(",")}]`).join(" "),o=e.defaultParts.map(s=>`${s.bone} ${s.size.join("x")} at [${s.pos.join(",")}]`).join("; ");return `- "${t}" \u2014 ${e.hint}. Bones (name@pivot): ${r}. Default body: ${o}.`}).join(`
|
|
2
|
+
`),Qn=`You design blocky voxel characters for a Minecraft-like game. Reply with ONE JSON object \u2014 a CharacterSpec \u2014 and nothing else: no markdown, no comments, no explanations.
|
|
3
3
|
|
|
4
4
|
The game builds and animates the character from your recipe. You give the SHAPE (boxes on a skeleton), the COLOURS (a palette) and small PIXEL-ART pictures for faces and clothes. Animations (walk, run, sneak, swim, fly, emotes, emotions) come from the skeleton \u2014 you never animate.
|
|
5
5
|
|
|
6
6
|
COORDINATES are in model PIXELS (16 px = 1 block): x to the character's RIGHT hand, y UP (y = 0 is the soles of the feet), z BACKWARDS \u2014 the character LOOKS TOWARD -z (its face is on the -z side). A normal person is 32 px tall.
|
|
7
7
|
|
|
8
8
|
SKELETONS ("rig"):
|
|
9
|
-
${
|
|
9
|
+
${bo}
|
|
10
10
|
|
|
11
11
|
CharacterSpec:
|
|
12
12
|
{
|
|
@@ -51,4 +51,4 @@ HOW TO BUILD A GOOD, DETAILED CHARACTER (the game's style: blocky people with fi
|
|
|
51
51
|
- Clothes in the textures: a shirt front with a collar, a button placket and pockets; a striped t-shirt; a knitted sweater with a pattern band and a ribbed hem; trousers with a crease; shorts with skin below and socks; the belt with a buckle.
|
|
52
52
|
- The head front texture: hair on the top rows and the sides, skin elsewhere, a slightly darker chin row; the eyes, brows and mouth go into "face" (e.g. rect [0, 3, 8, 5] with 16x10 pictures): white eyes 3 texels wide with a coloured iris in the middle, brows above them, a 4-texel mouth \u2014 one picture per expression, the same size, transparent where the skin shows through.
|
|
53
53
|
- Add detail with extra boxes: hair fringe, a hood, armour plates, a crown, horns, a tail (an extra bone with role "tail").
|
|
54
|
-
- When the player sends pictures (possibly of ONE character from different angles: front, side, back) study EVERY picture: get the silhouette, proportions, colours, clothes and the face right. Pictures can be photos, drawings or 3D renders \u2014 turn them into a clean blocky version.`;var
|
|
54
|
+
- When the player sends pictures (possibly of ONE character from different angles: front, side, back) study EVERY picture: get the silhouette, proportions, colours, clothes and the face right. Pictures can be photos, drawings or 3D renders \u2014 turn them into a clean blocky version.`;var os=["cat","dog","fox","bear","rabbit","bird","dragon","slime","ghost","robot"],go=t=>({k:"#2a1c14",w:"#f4f4ef",b:t,m:"#7a3a30",o:"#3a1a14"});function yo(t){let e=t.light??t.body,r=t.accent??t.body,o={t:t.body,s:t.body,l:e,a:r,p:r,...go(t.eyes??"#3f6f3a")},s=[],a="quadruped",n=Ce("head",[0,3,8,5]),i={walk:"normal",idle:"calm",energy:.6},l=(c,u,b,g,E,R={})=>s.push({name:c,bone:u,size:b,pos:g,color:E,...R});switch(t.kind){case "cat":case "fox":case "dog":case "bear":case "rabbit":{let c=t.kind;l("body","body",[8,8,16],[0,12,0],"t"),l("belly","body",[6,1,12],[0,8,0],"l"),l("head","head",[8,8,8],[0,16,-12],"s");for(let u of ["legFL","legFR","legBL","legBR"]){let b=u.endsWith("L")?-3:3,g=u.startsWith("legF")?-6:6;l(u,u,[3,8,3],[b,4,g],"t"),l(`${u}Paw`,u,[3.2,1.5,3.2],[b,.75,g],"a");}c==="cat"?(l("ear","head",[2,2.5,1],[-2.5,21,-11],"a",{mirror:true}),l("tail","tail",[1.6,1.6,10],[0,15,13],"t",{rot:[20,0,0]}),i={walk:"sneaky",idle:"calm",energy:.5}):c==="fox"?(l("ear","head",[2.4,3.2,1],[-2.5,21.4,-11],"t",{mirror:true}),l("snout","head",[4,3,3],[0,14.5,-17],"l"),l("nose","head",[1.2,1,.6],[0,15.6,-18.6],"a"),l("tail","tail",[3.5,3.5,10],[0,14,13],"t",{rot:[15,0,0]}),l("tailTip","tail",[3.6,3.6,2.5],[0,15.2,18],"l"),i={walk:"bouncy",idle:"fidgety",energy:.7}):c==="dog"?(l("ear","head",[1.5,4,3],[-4.6,17.5,-11.5],"a",{mirror:true}),l("snout","head",[4,3,3],[0,14.5,-17],"l"),l("nose","head",[1.6,1.2,.6],[0,15.8,-18.6],"a"),l("tail","tail",[2,2,7],[0,16,11],"t",{rot:[40,0,0]}),i={walk:"bouncy",idle:"fidgety",energy:.9}):c==="bear"?(l("ear","head",[2,2,1],[-3,20.6,-10.5],"a",{mirror:true}),l("snout","head",[4,3,2.5],[0,14.5,-16.8],"l"),l("nose","head",[1.6,1.2,.6],[0,15.8,-18.2],"a"),l("tail","tail",[2,2,2],[0,14,9],"t"),i={walk:"heavy",idle:"proud",energy:.4}):(l("ear","head",[1.6,7,1],[-1.8,23.5,-11],"t",{mirror:true}),l("earInner","head",[.8,5.5,.4],[-1.8,23.5,-11.6],"l",{mirror:true}),l("tail","tail",[3,3,3],[0,14,9.5],"l"),i={walk:"bouncy",idle:"fidgety",energy:.8});break}case "bird":case "dragon":{a="flyer",n=Ce("head",[0,1,5,3]);let c=t.kind==="dragon";l("body","body",[6,6,8],[0,8,0],"t"),l("belly","body",[4.6,4,1],[0,7.5,-4.2],"l"),l("head","head",[5,5,5],[0,13,-4],"s"),l("wing","wingL",[8,1,6],[-7,10,0],"a",{mirror:true}),l("leg","legL",[1,4,1],[-1.5,2,0],"a",{mirror:true}),c?(l("horn","head",[.8,2,.8],[-1.4,16.4,-3],"l",{mirror:true}),l("snout","head",[3,2,2.4],[0,12.2,-7.4],"s"),l("tail","tail",[2,2,8],[0,7,7],"t"),l("spike","body",[1,1.5,6],[0,11.6,0],"a"),i={walk:"heavy",idle:"proud",energy:.6}):(l("beak","head",[1.6,1.2,2],[0,12.4,-7.2],"a"),l("tail","tail",[4,1,4],[0,8,6],"a"),l("crest","head",[1,2,2],[0,16.2,-3.6],"a"),i={walk:"bouncy",idle:"fidgety",energy:.8});break}case "slime":case "ghost":case "robot":{a="blob",n=Ce("body",[2,3,8,5]),t.kind==="slime"?(l("body","body",[12,10,12],[0,5,0],"t"),l("shine","body",[3,2,.4],[-3,8,-6.2],"l"),i={walk:"bouncy",idle:"fidgety",energy:.9}):t.kind==="ghost"?(l("body","body",[10,12,10],[0,7,0],"t"),l("hem","body",[10.4,2,10.4],[0,1,0],"l"),i={walk:"sneaky",idle:"calm",energy:.4}):(l("body","body",[11,11,10],[0,5.5,0],"t"),l("antenna","body",[.8,3,.8],[0,12.5,0],"a"),l("bulb","body",[1.6,1.6,1.6],[0,14.6,0],"l"),l("screen","body",[9,6,.4],[0,6.5,-5.2],"l"),i={walk:"robotic",idle:"calm",energy:.5});break}}return {version:1,name:t.name,description:t.description??"",rig:a,palette:o,textures:n.textures,parts:s,face:n.face,style:i,finish:{noise:.45,outline:.4,shade:.25,density:2},tags:t.tags??[t.kind]}}function ns(t){let e=q(yo(t));if(!e.ok)throw new Error(`${t.kind}: ${e.error}`);return e.spec}exports.ACTION_TIME=_t;exports.ANIM_EVENTS=sn;exports.Animator=Fe;exports.Art=w;exports.BONE_ROLES=To;exports.CH=v;exports.CHANNELS=on;exports.CHARACTER_LIMITS=gt;exports.CHARACTER_SPEC_VERSION=dt;exports.CLEAR=ye;exports.CLIPS=Oe;exports.CREATURE_KINDS=os;exports.CharacterView=Ae;exports.DEFAULT_CHARACTER_SOURCE=qe;exports.DEFAULT_COLORS=jt;exports.DEFAULT_FINISH=he;exports.EMOTES=_e;exports.EMOTE_IDS=Pn;exports.EMOTIONS=Ie;exports.EMOTION_EVENTS=Hn;exports.EXPRESSIONS=je;exports.EXPRESSION_CHAIN=zt;exports.EXTRA_BONE_ROLES=ke;exports.FACE_NAMES=De;exports.HELD_KINDS=nn;exports.HUMAN_BOTTOMS=Mt;exports.HUMAN_HAIR=en;exports.HUMAN_SHOES=At;exports.HUMAN_TOPS=Tt;exports.IDLE_STYLES=Ge;exports.LOCOMOTION=co;exports.POSTURE=nt;exports.REST=ue;exports.RIGS=J;exports.RIG_CLIPS=Pt;exports.RIG_IDS=be;exports.SOCKETS=Mo;exports.VOXEL_CHARACTER_SYSTEM_PROMPT=Qn;exports.VoxelActor=Nt;exports.WALK_STYLES=Ve;exports.acquireCharacter=$e;exports.add=Y;exports.applyPosture=Ft;exports.bandColors=zr;exports.bone=fe;exports.bonesOf=xt;exports.characterFromImage=Tn;exports.characterOf=fn;exports.characterSpecs=bn;exports.clearPose=ce;exports.copyPose=Te;exports.creatureCharacter=ns;exports.creatureSource=yo;exports.defaultCharacter=le;exports.defaultCharacterName=Re;exports.disposeNameplate=Ze;exports.emotionFromText=Bn;exports.humanSource=Je;exports.isDefaultCharacterName=jo;exports.isEmote=_n;exports.isEmotion=lo;exports.isObj=j;exports.layoutCharacter=Rt;exports.lerpPose=Ot;exports.mirrorBone=yt;exports.nameplate=Lt;exports.newAnimInput=Me;exports.normColor=ft;exports.npcCharacter=En;exports.num=W;exports.onCharacterKnown=gn;exports.parseCharacterSpec=q;exports.pick=He;exports.recolor=Xe;exports.registerCharacter=un;exports.releaseCharacter=Se;exports.rigOfSpec=Do;exports.sampleEmote=It;exports.sampleTrack=io;exports.setCh=p;exports.specHash=me;exports.stableStringify=Be;exports.standardFace=Ce;exports.styleParams=et;exports.vec3=Ee;
|