@7ots/cli 0.1.36 → 0.1.38
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/.env.example +9 -4
- package/README.md +3 -0
- package/cli/lib/account.mjs +2 -2
- package/cli/lib/assistant.mjs +6 -4
- package/cli/lib/integrations.mjs +1 -0
- package/cli/lib/pet-server.mjs +7 -4
- package/cli/pet/electron/main.cjs +51 -26
- package/cli/pet/pet.html +9 -7
- package/dist/7ots.esm.js +20 -19
- package/dist/7ots.esm.js.map +4 -4
- package/dist/7ots.iife.js +52 -51
- package/dist/7ots.iife.js.map +4 -4
- package/package.json +1 -1
- package/server/server.mjs +1 -1
- package/src/avatar/AvatarStage.js +1 -1
- package/src/character3d/room.js +1 -1
- package/src/character3d/stage.js +7 -2
- package/src/index.js +1 -0
package/dist/7ots.esm.js
CHANGED
|
@@ -16,7 +16,7 @@ var B0=Object.create;var gi=Object.defineProperty;var D0=Object.getOwnPropertyDe
|
|
|
16
16
|
@keyframes otsc-breathe{0%,100%{transform:scale(1,1)}50%{transform:scale(1.014,.982)}}
|
|
17
17
|
@keyframes otsc-sway{0%,100%{transform:rotate(-.6deg)}50%{transform:rotate(.6deg)}}
|
|
18
18
|
@media (prefers-reduced-motion:reduce){.otsc-breathe,.otsc-sway{animation:none!important}}
|
|
19
|
-
`,sf={angry:[["spikes",{ms:900}],["anger"],["steam"]],surprised:[["exclaim"]],love:[["hearts"],["blush"]],happy:[["sparkles"]],sad:[["tears"]],fear:[["sweat"]],disgust:[["squish",{ms:700}]],sleep:[["zzz",{hold:!0,tag:"mood"}]]},nf=1800,Kl=380,Ir=300,Xl=300,lf=Object.keys($a),ao=()=>typeof performance<"u"?performance.now():Date.now(),Ki=(e,t,o)=>e.map((a,s)=>[de(a[0],t[s][0],o),de(a[1],t[s][1],o)])});var Do=Mr((
|
|
19
|
+
`,sf={angry:[["spikes",{ms:900}],["anger"],["steam"]],surprised:[["exclaim"]],love:[["hearts"],["blush"]],happy:[["sparkles"]],sad:[["tears"]],fear:[["sweat"]],disgust:[["squish",{ms:700}]],sleep:[["zzz",{hold:!0,tag:"mood"}]]},nf=1800,Kl=380,Ir=300,Xl=300,lf=Object.keys($a),ao=()=>typeof performance<"u"?performance.now():Date.now(),Ki=(e,t,o)=>e.map((a,s)=>[de(a[0],t[s][0],o),de(a[1],t[s][1],o)])});var Do=Mr((c2,uc)=>{uc.exports=globalThis.__OTS_THREE__.three});var sn=Mr((d2,pc)=>{pc.exports=globalThis.__OTS_THREE__.RoomEnvironment});function qs(e={}){let t=e.key||"page";return nn.has(t)||nn.set(t,new ln(e)),nn.get(t)}var St,mc,nn,ln,$c=Ye(()=>{St=_t(Do(),1),mc=_t(sn(),1),nn=new Map;ln=class{constructor(t){this.maxDpr=t.supersample?t.maxDpr||2:Math.min(t.maxDpr||1.5,window.devicePixelRatio||1),this.minDpr=Math.min(t.minDpr||.75,this.maxDpr),this.dpr=this.maxDpr,this.adaptive=t.adaptive!==!1,this.fps=t.fps||0;let o=document.createElement("canvas");o.className="ots3d-canvas",o.setAttribute("aria-hidden","true"),o.style.cssText=`position:fixed;left:0;top:0;width:100vw;height:100vh;pointer-events:none;z-index:${t.zIndex??1};display:block`,(t.parent||document.body).appendChild(o),this.canvas=o;let a=new St.WebGLRenderer({canvas:o,antialias:!0,alpha:!0,powerPreference:"high-performance",preserveDrawingBuffer:!!t.preserve});a.setPixelRatio(this.dpr),a.outputColorSpace=St.SRGBColorSpace,a.toneMapping=St.NeutralToneMapping,a.toneMappingExposure=1.05,a.setClearColor(0,0),a.info.autoReset=!1,a.autoClear=!1,this.renderer=a;let s=new St.PMREMGenerator(a);this.envMap=s.fromScene(new mc.RoomEnvironment,.04).texture,s.dispose(),this.views=new Set,this.visible=new Set,this.raf=0,this.last=0,this.stats={fps:0,ms:0,calls:0,triangles:0,dpr:this.dpr,views:0,characters:0},this._frames=0,this._acc=0,this._statT=0,this._good=0,this._w=0,this._h=0,this.io=new IntersectionObserver(r=>{for(let i of r){let n=i.target.__ots3dView;n&&(i.isIntersecting?this.visible.add(n):this.visible.delete(n))}this.wake()},{rootMargin:"64px"}),this._vis=()=>document.hidden?this.sleep():this.wake(),document.addEventListener("visibilitychange",this._vis)}makeScene(){let t=new St.Scene;t.environment=this.envMap,t.environmentIntensity=.75,t.add(new St.HemisphereLight(15265023,4206670,.7));let o=new St.DirectionalLight(16773600,2.4);o.position.set(2.2,3.4,3.2);let a=new St.DirectionalLight(13623551,2.2);a.position.set(-2.6,2.2,-3);let s=new St.DirectionalLight(16770804,.5);return s.position.set(-3,.5,2),t.add(o,a,s),t}addView(t){this.views.add(t),t.el.__ots3dView=t,this.io.observe(t.el),this.wake()}removeView(t){this.views.delete(t),this.visible.delete(t),this.io.unobserve(t.el),delete t.el.__ots3dView,this.visible.size||this.clear()}clear(){this.sleep(),this.renderer.setScissorTest(!1),this.renderer.clear()}wake(){this.raf||document.hidden||!this.visible.size||(this.last=performance.now(),this.raf=requestAnimationFrame(t=>this.frame(t)))}sleep(){cancelAnimationFrame(this.raf),this.raf=0}resize(){let t=window.innerWidth,o=window.innerHeight,a=this.renderer;(t!==this._w||o!==this._h||a.getPixelRatio()!==this.dpr)&&(this._w=t,this._h=o,a.setPixelRatio(this.dpr),a.setSize(t,o,!1))}frame(t){if(this.raf=0,document.hidden)return;for(let i of this.visible)i.el.isConnected||this.visible.delete(i);if(!this.visible.size)return this.clear();if(this.fps&&t-this.last<1e3/this.fps-4)return this.raf=requestAnimationFrame(i=>this.frame(i));let o=Math.min(64,Math.max(0,t-this.last));this.last=t;let a=performance.now();this.resize();let s=this.renderer;s.info.reset(),s.setScissorTest(!1),s.clear(),s.setScissorTest(!0);let r=0;for(let i of this.visible){let n=i.el.getBoundingClientRect();if(n.bottom<0||n.top>this._h||n.right<0||n.left>this._w||n.width<2||n.height<2)continue;i.rect=n,i.tick(t,o),r+=i.characters.length;let l=n;if(i.bleed){let f=i.bleed==="window"?null:i.bleed;l=f==null?{left:0,top:0,width:this._w,height:this._h}:{left:n.left-f,top:n.top-f,width:n.width+2*f,height:n.height+2*f},i.camera.setViewOffset(n.width,n.height,l.left-n.left,l.top-n.top,l.width,l.height)}i.vrect=l;let h=this._h-(l.top+l.height);s.setViewport(l.left,h,l.width,l.height),s.setScissor(l.left,h,l.width,l.height),s.render(i.scene,i.camera)}if(this._frames++,this._acc+=performance.now()-a,t-this._statT>1e3){let i=(t-this._statT)/1e3,n=this._statT?this._frames/i:60;if(Object.assign(this.stats,{fps:Math.round(n),ms:Math.round(this._acc/this._frames*10)/10,calls:s.info.render.calls,triangles:s.info.render.triangles,dpr:this.dpr,views:this.visible.size,characters:r}),this.adaptive&&this._statT){let l=this.fps||60;n<l*.8&&this.dpr>this.minDpr?(this.dpr=Math.max(this.minDpr,Math.round((this.dpr-.25)*100)/100),this._good=0):n>l*.95&&this.dpr<this.maxDpr&&++this._good>=3&&(this.dpr=Math.min(this.maxDpr,this.dpr+.25),this._good=0)}this._statT=t,this._frames=0,this._acc=0}this.raf=requestAnimationFrame(i=>this.frame(i))}}});var cn=Mr((f2,gc)=>{gc.exports=globalThis.__OTS_THREE__.GLTFLoader});var dn=Mr((u2,yc)=>{yc.exports=globalThis.__OTS_THREE__.BufferGeometryUtils});function cf(e,t=12){let o=e.length,a=r=>e[(r+o)%o],s=[];for(let r=0;r<o;r++){let[i,n,l,h]=[a(r-1),a(r),a(r+1),a(r+2)],f=[n[0]+(l[0]-i[0])/6,n[1]+(l[1]-i[1])/6],c=[l[0]-(h[0]-n[0])/6,l[1]-(h[1]-n[1])/6];for(let d=0;d<t;d++){let p=d/t,u=(1-p)**3,g=3*(1-p)**2*p,m=3*(1-p)*p*p,w=p**3;s.push([u*n[0]+g*f[0]+m*c[0]+w*l[0],u*n[1]+g*f[1]+m*c[1]+w*l[1]])}}return s}function df(e,t,o){let a=new Float32Array(so),s=e.length;for(let i=0;i<so;i++){let n=i/so*Math.PI*2,l=Math.cos(n),h=Math.sin(n),f=0;for(let c=0;c<s;c++){let[d,p]=e[c],[u,g]=e[(c+1)%s],m=u-d,w=g-p,k=l*w-h*m;if(Math.abs(k)<1e-9)continue;let b=d-t,x=p-o,E=(b*w-x*m)/k,T=(b*h-x*l)/k;E>0&&T>=0&&T<=1&&E>f&&(f=E)}a[i]=f}let r=new Float32Array(so);for(let i=0;i<so;i++)r[i]=(a[(i+so-1)%so]+2*a[i]+a[(i+1)%so])/4;return r}function hn(e,t,o="high"){let a=`${o}|${e.map(k=>`${Math.round(k[0])},${Math.round(k[1])}`).join(" ")}`;if(fr.has(a))return fr.get(a);let s=t.x+t.w/2,r=t.y+t.h*.54,i=t.y+t.h,n=df(cf(e),s,r),l=0;for(let k=0;k<so;k++)l+=n[k];l/=so;let h=.86,f=h*l,[c,d]=o==="high"?[96,64]:[40,26],p=(k,b,x,E=new ft.Vector3)=>{let T=k*k+b*b,v=Math.atan2(-b,k),_=hf(n,v),C=h*Math.min(_,l*1.05),L=f+(C-f)*T,z=(i-r)*Ae+b*_*Ae;return z<.03&&(z=.03+(z-.03)*.35),E.set(k*_*Ae,z,x*L*Ae)},u=new ft.SphereGeometry(1,c,d);u.deleteAttribute("uv"),u.deleteAttribute("normal"),u=(0,bc.mergeVertices)(u,1e-5);let g=u.attributes.position,m=new ft.Vector3;for(let k=0;k<g.count;k++)m.fromBufferAttribute(g,k).normalize(),p(m.x,m.y,m.z,m),g.setXYZ(k,m.x,m.y,m.z);u.computeVertexNormals(),u.computeBoundingBox(),u.computeBoundingSphere(),u.userData.shared=!0;let w={geometry:u,table:n,cx:s,cy:r,bottom:i,mean:l,depth:f*Ae,surface:p,segments:[c,d]};return fr.set(a,w),fr.size>160&&fr.delete(fr.keys().next().value),w}function fn(e){let t=new ft.Mesh(e,new ft.MeshBasicMaterial({side:ft.DoubleSide})),o=new ft.Raycaster,a=new ft.Vector3,s=new ft.Vector3,r=(i,n,l,h,f,c)=>{a.set(i,n,l),s.set(h,f,c).normalize(),o.set(a,s);let d=o.intersectObject(t,!1)[0];return d?{p:d.point.clone(),n:d.face.normal.clone()}:null};return{front(i,n){return r(i,n,10,0,0,-1)||{p:new ft.Vector3(i,n,0),n:new ft.Vector3(0,0,1)}},top(i,n=0){return r(i,10,n,0,-1,0)||{p:new ft.Vector3(i,1,n),n:new ft.Vector3(0,1,0)}},section(i){let n=r(10,i,0,-1,0,0),l=r(0,i,10,0,0,-1);return{w:n?Math.abs(n.p.x):.5,d:l?Math.abs(l.p.z):.4,z:l?l.p.z:.4}}}}var ft,bc,Ae,so,hf,fr,un=Ye(()=>{ft=_t(Do(),1),bc=_t(dn(),1),Ae=1/100,so=360;hf=(e,t)=>{let o=(t/(Math.PI*2)%1+1)%1*so,a=Math.floor(o);return o-=a,e[a%so]*(1-o)+e[(a+1)%so]*o},fr=new Map});function mn(e){let t=pn[e.texture]??0,o={uPat:{value:new ge.Color(e.patternColor)},uPatType:{value:ff[e.pattern]??0},uDims:{value:new ge.Vector4(1,1,.6,.1)},uCheek:{value:new ge.Vector4(.3,.4,.4,.1)},uCheekColor:{value:new ge.Color(e.cheekColor||"#ff6b8a")},uCheekOn:{value:0},uCheekType:{value:1},uDensity:{value:e.density||70},uShells:{value:16},uFurLen:{value:e.furLen||.06},uTime:{value:0},uGravity:{value:new ge.Vector3(0,-.9,.15)},uBald:{value:[new ge.Vector4(0,-9,0,0),new ge.Vector4(0,-9,0,0),new ge.Vector4(0,-9,0,0)]},uTex:{value:t},uSp:{value:.2},uBlush:{value:0},uMorph:{value:new ge.Vector4(0,0,0,0)}},a=(e.finish==="toon"||e.finish==="sketch")&&!e.plush,s=r=>{let i=e.plush?"plush":e.finish,n=new ge.Color(e.color);e.plush&&n.multiplyScalar(1.12),(i==="pearl"||i==="glass")&&n.lerp(new ge.Color("#ffffff"),i==="pearl"?.45:.2);let l=(t===4||t===11||i==="glass")&&!e.plush,h={pearl:1,holo:1}[i]||0,f=new ge.MeshPhysicalMaterial({color:n,roughness:l?.08:{plush:.92,glossy:.28,soft3d:.55,clay:.85,flat:.75,toon:.6,neon:.4,sketch:.9,metal:.3,pearl:.3,holo:.22,velvet:.95,pastel:.6}[i]??.5,metalness:{metal:.9,holo:.45}[i]||0,clearcoat:l?1:{glossy:1,soft3d:.35,toon:.6,neon:.8,metal:.4,pearl:1,holo:1}[i]??0,iridescence:h,iridescenceIOR:i==="holo"?2:1.5,iridescenceThicknessRange:[120,520],clearcoatRoughness:i==="soft3d"?.35:.08,sheen:e.plush||i==="velvet"?1:i==="clay"?.4:0,sheenRoughness:.5,sheenColor:new ge.Color(e.color).lerp(new ge.Color("#ffffff"),.45),emissive:i==="neon"?new ge.Color(e.color).multiplyScalar(.55):new ge.Color(0),envMapIntensity:e.plush?.7:l?1.5:i==="metal"?1.6:1});return r&&(f.alphaTest=.5,f.alphaToCoverage=!0),f.defines={...e.plush?{FUR:""}:{},...r?{FUR_SHELL:""}:{},...a&&!r?{TOON:""}:{},...e.finish==="sketch"&&!r?{SKETCH:""}:{},...l?{GEL:"",GLASS_RIM:i==="glass"?"0.55":"0.0"}:{}},f.customProgramCacheKey=()=>`ots3d-${e.plush?"fur":"solid"}-${r?"shell":"base"}-${a?e.finish:""}-${l?i==="glass"?"glass":"gel":""}`,f.onBeforeCompile=c=>{Object.assign(c.uniforms,o),c.vertexShader=c.vertexShader.replace("#include <common>",kc).replace("#include <begin_vertex>",`${vc}
|
|
20
20
|
#ifdef FUR_SHELL
|
|
21
21
|
float fh = (float(gl_InstanceID) + 1.0) / uShells;
|
|
22
22
|
vH = fh;
|
|
@@ -336,7 +336,7 @@ uniform vec3 uGravity;`,vc=`vec3 dN = normal;
|
|
|
336
336
|
float det = dot(sx, r1);
|
|
337
337
|
vec3 grad = sign(det) * (dh.x * r1 + dh.y * r2);
|
|
338
338
|
normal = normalize(abs(det) * normal - grad);
|
|
339
|
-
}`;wc=new Map;Zr=null});function Ds(e){let t=Mc[e];return t||(t=Mc[e]=$f[e](),t.userData.shared=!0),t}function mt(e,t,o){let a=new me.InstancedMesh(Ds(e),t,o);return a.frustumCulled=!1,a.instanceMatrix.setUsage(me.DynamicDrawUsage),a.userData.instFx=!0,a}function ut(e,t,o,a,s,r,i=0,n=0,l=0,h=r){mr.position.set(o,a,s),mr.rotation.set(n,l,i),mr.scale.set(r,h,r),r<=1e-4&&mr.scale.setScalar(1e-5),mr.updateMatrix(),e.setMatrixAt(t,mr.matrix)}function $r(e){e?.traverse?.(t=>{t.isInstancedMesh&&t.dispose()}),e?.removeFromParent()}var me,_c,ur,Ba,pr,Qo,Mc,gn,mf,Wr,$f,Ec,gf,mr,Ct,Qs,Tc=Ye(()=>{me=_t(Do(),1),_c=_t(dn(),1);ya();Bs();ur=Math.PI*2,Ba=Math.PI/180,pr=(e,t=.2)=>xe.backOut(U(e/t)),Qo=(e,t=.25)=>U((1-e)/t),Mc={},gn=(e,t=.25)=>new me.ExtrudeGeometry(e,{depth:t,bevelEnabled:!0,bevelThickness:.08,bevelSize:.07,bevelSegments:2,curveSegments:8}).center(),mf=e=>{for(let t of Object.keys(e.attributes))t!=="position"&&t!=="normal"&&e.deleteAttribute(t);return e},Wr=(...e)=>(0,_c.mergeGeometries)(e.map(t=>mf(t.index?t.toNonIndexed():t))),$f={star:()=>{let e=new me.Shape;e.moveTo(0,1);for(let[t,o,a,s]of[[0,0,1,0],[0,0,0,-1],[0,0,-1,0],[0,0,0,1]])e.quadraticCurveTo(t,o,a,s);return gn(e,.3)},heart:()=>{let e=new me.Shape;return e.moveTo(0,-.9),e.bezierCurveTo(-1.4,.1,-.7,1.05,0,.35),e.bezierCurveTo(.7,1.05,1.4,.1,0,-.9),gn(e,.35)},drop:()=>{let e=[];for(let t=0;t<=12;t++){let o=t/12*Math.PI,a=Math.sin(o)*(o>Math.PI/2?1:.35+.65*Math.sin(o));e.push(new me.Vector2(Math.max(.001,a*.8),Math.cos(o)*1.2))}return new me.LatheGeometry(e,14)},z:()=>{let e=new me.Shape;return e.moveTo(-1,1),e.lineTo(1,1),e.lineTo(1,.62),e.lineTo(-.35,-.62),e.lineTo(1,-.62),e.lineTo(1,-1),e.lineTo(-1,-1),e.lineTo(-1,-.62),e.lineTo(.35,.62),e.lineTo(-1,.62),e.lineTo(-1,1),gn(e,.4)},note:()=>Wr(new me.SphereGeometry(.42,12,8).scale(1.25,.95,.7).rotateZ(.35).translate(-.3,-.75,0),new me.CylinderGeometry(.08,.08,1.5,6).translate(.18,0,0),new me.BoxGeometry(.5,.18,.12).rotateZ(-.5).translate(.38,.6,0)),bang:()=>Wr(new me.CylinderGeometry(.2,.12,1.15,12).translate(0,.62,0),new me.SphereGeometry(.17,12,8).translate(0,-.12,0)),ask:()=>{let e=new me.CatmullRomCurve3([[-.35,.75],[-.25,1.05],[.15,1.12],[.42,.9],[.35,.6],[.05,.45],[0,.18]].map(([t,o])=>new me.Vector3(t,o,0)));return Wr(new me.TubeGeometry(e,24,.11,8),new me.SphereGeometry(.15,12,8).translate(0,-.12,0))},anger:()=>{let e=[];for(let[t,o]of[[1,-1],[1,1],[-1,1],[-1,-1]]){let a=new me.QuadraticBezierCurve3(new me.Vector3(.25*t,.9*o,0),new me.Vector3(.25*t,.25*o,0),new me.Vector3(.9*t,.25*o,0));e.push(new me.TubeGeometry(a,10,.13,6))}return Wr(...e)},cloud:()=>Wr(...[[0,0,.55],[-.5,-.05,.4],[.5,-.02,.42],[-.22,.28,.4],[.25,.3,.38],[0,-.2,.42]].map(([e,t,o])=>new me.SphereGeometry(o,14,10).scale(1,1,.6).translate(e,t,0))),ball:()=>new me.SphereGeometry(1,14,10),ballHi:()=>new me.SphereGeometry(1,24,16),chip:()=>new me.BoxGeometry(1,.5,.12)};Ec=null,gf=()=>Ec||(Ec=new me.MeshPhysicalMaterial({color:"#bfe9ff",roughness:.02,clearcoat:1,transparent:!0,opacity:.4,depthWrite:!1,envMapIntensity:2,iridescence:1})),mr=new me.Object3D;Ct=(...e)=>{for(let t of e)t.instanceMatrix.needsUpdate=!0},Qs={sparkles:{ms:1300,make:(e,t)=>t.m=mt("star",j("gloss","#ffd84d"),6),draw:(e,t,o,a,s,r)=>{for(let i=0;i<6;i++){let n=r()*ur,l=.55+r()*.25,h=(r()-.3)*e.D,f=U((o-i*.08)/.5),c=e.W*.07*(.6+r()*.6)*Math.sin(Math.PI*f)*s;ut(t.m,i,Math.cos(n)*e.W*l,e.H*.55-Math.sin(n)*e.H*l*.85,h,c,-a*.08*Ba)}Ct(t.m)}},sweat:{ms:1800,make:(e,t)=>t.m=mt("drop",j("gloss","#8fd3ff"),1),draw:(e,t,o,a,s)=>{ut(t.m,0,t.dir*e.W*.4,e.H*(.8-.08*xe.inOut(o)),e.D*.45,e.W*.05*pr(o,.15)*Math.min(s,Qo(o)),-t.dir*12*Ba),Ct(t.m)}},blush:{ms:2e3,make:()=>null,draw:(e,t,o,a,s)=>{t.blush=Math.min(U(o/.15),Qo(o))*s}},hearts:{ms:1900,make:(e,t)=>t.m=mt("heart",j("gloss","#ff4d7a"),3),draw:(e,t,o,a,s,r)=>{for(let i=0;i<3;i++){let n=U((o-i*.15)/.7),l=n<=0?0:e.W*(.07+r()*.03)*pr(n)*Qo(n,.3)*s;ut(t.m,i,(i-1)*e.W*.28+Math.sin(n*ur+i)*e.W*.05,e.H*.88+e.H*.5*xe.out(n),e.D*.3,l,Math.sin(n*9+i)*.25)}Ct(t.m)}},zzz:{ms:2600,loop:!0,make:(e,t)=>t.m=mt("z",j("gloss","#5b6ee1"),3),draw:(e,t,o,a,s)=>{for(let r=0;r<3;r++){let i=(o+r/3)%1;ut(t.m,r,t.dir*(e.W*.32+e.W*.25*i),e.H*.88+e.H*.45*i,e.D*.2,e.W*(.033+.05*i)*Math.sin(Math.PI*i)*s,t.dir*-.2)}Ct(t.m)}},exclaim:{ms:1100,make:(e,t)=>t.m=mt("bang",j("gloss","#ff3b30"),1),draw:(e,t,o,a,s)=>{ut(t.m,0,t.dir*e.W*.36,e.H*1.04,e.D*.2,e.W*.24*pr(o,.18)*Math.min(s,Qo(o,.2)),Math.sin(a/60)*6*Qo(o,.6)*Ba),Ct(t.m)}},question:{ms:1500,make:(e,t)=>t.m=mt("ask",j("gloss","#4f7cff"),1),draw:(e,t,o,a,s)=>{ut(t.m,0,t.dir*e.W*.4,e.H*1.02+Math.sin(a/200)*e.H*.015,e.D*.2,e.W*.24*pr(o)*Math.min(s,Qo(o,.2)),-t.dir*12*Ba),Ct(t.m)}},anger:{ms:1300,make:(e,t)=>t.m=mt("anger",j("gloss","#ff2d2d"),1),draw:(e,t,o,a,s)=>{ut(t.m,0,t.dir*e.W*.33,e.H*.86,e.D*.55,e.W*.075*pr(o,.15)*(1+.12*Math.sin(a/70))*Math.min(s,Qo(o)),0,0,t.dir*.5),Ct(t.m)}},steam:{ms:1500,make:(e,t)=>t.m=mt("ball",j("felt","#eef0f3"),6),draw:(e,t,o,a,s)=>{let r=0;for(let i of[-1,1])for(let n=0;n<3;n++){let l=U((o-n*.15)/.65),h=l<=0||l>=1?0:e.W*(.04+.07*l)*Math.min(1,(1-l)*3)*s;ut(t.m,r++,i*(e.W*.28+e.W*.18*l),e.H*.88+e.H*.38*l,0,h)}Ct(t.m)}},confetti:{ms:1900,make:(e,t)=>{let o=e.low?12:22,a=t.m=mt("chip",j("plastic","#ffffff"),o),s=["#ff4d7a","#ffd84d","#4dd2ff","#7cff6b","#b18cff","#ff9f43"],r=new me.Color;for(let i=0;i<o;i++)a.setColorAt(i,r.set(s[i%s.length]));return a},draw:(e,t,o,a,s,r)=>{let i=o*1.9,n=t.m.count,l=e.W*.035*Math.min(s,Qo(o,.3));for(let h=0;h<n;h++){let f=-Math.PI/2+(r()-.5)*2.2,c=e.H*(.9+r()*.8),d=(r()-.4)*c*.6,p=.3+r()*.5,u=Math.max(.005,e.H*.95-Math.sin(f)*c*i-e.H*1.1*i*i);ut(t.m,h,Math.cos(f)*c*i*.7,u,d*i,l,a*p*Ba+h,a*p*.7*Ba,h*.7)}Ct(t.m)}},tears:{ms:2200,rig:!0,make:(e,t)=>t.m=mt("drop",j("gloss","#8fd3ff"),4),draw:(e,t,o,a,s)=>{let r=0;for(let i of e.tears)for(let n=0;n<2;n++){let l=(o*2+n*.5)%1*(o<.9?1:0),h=l*l*(i.length-1),f=Math.min(i.length-2,Math.floor(h)),c=h-f,d=i[f],p=i[f+1];ut(t.m,r++,d[0]+(p[0]-d[0])*c,d[1]+(p[1]-d[1])*c,d[2]+(p[2]-d[2])*c,l<=0?0:e.r*.28*(1-l)*s*1.4)}Ct(t.m)}},thought:{ms:2200,make:(e,t)=>{t.m=mt("ball",j("felt","#ffffff"),2),t.c=mt("cloud",j("felt","#ffffff"),1),t.d=mt("ball",j("felt","#64748b"),3);let o=new me.Group;return o.add(t.m,t.c,t.d),o},draw:(e,t,o,a,s)=>{let r=Math.min(s,Qo(o,.15)),i=c=>pr(U((o-c)/.4),.5),n=t.dir*e.W*.55,l=e.H*1.22,h=e.D*.15;ut(t.m,0,t.dir*e.W*.3,e.H*.98,h,e.W*.025*i(0)*r),ut(t.m,1,t.dir*e.W*.4,e.H*1.08,h,e.W*.042*i(.08)*r);let f=e.W*.36*i(.16)*r;ut(t.c,0,n,l,h,f);for(let c=0;c<3;c++)ut(t.d,c,n+(c-1)*f*.32,l,h+f*.36,f*.07*(.6+.6*Math.max(0,Math.sin(a/180-c*.9))));Ct(t.m,t.c,t.d)}},notes:{ms:2200,make:(e,t)=>t.m=mt("note",j("gloss","#8b5cf6"),3),draw:(e,t,o,a,s)=>{for(let r=0;r<3;r++){let i=U((o-r*.18)/.65),n=r%2?-1:1;ut(t.m,r,n*e.W*(.42+.1*i)+Math.sin(i*ur)*e.W*.03,e.H*.75+e.H*.5*i,e.D*.25,i<=0||i>=1?0:e.W*.11*Math.sin(Math.PI*i)*s,-n*10*Ba)}Ct(t.m)}},sneeze:{ms:700,make:(e,t)=>t.m=mt("ball",j("gloss","#9fd8ff"),e.low?6:10),draw:(e,t,o,a,s,r)=>{let i=xe.out(o),n=e.mouth;for(let l=0;l<t.m.count;l++){let h=(r()-.5)*1.1,f=(r()-.5)*.8,c=e.W*(.15+r()*.45)*i;ut(t.m,l,n.x+t.dir*e.W*.05+Math.sin(h)*c,n.y+Math.sin(f)*c*.5-e.H*.15*i*i,n.z+Math.cos(h)*c,e.W*(.012+r()*.015)*(1-o)*s)}Ct(t.m)}},bubble:{ms:1e3,make:(e,t)=>t.m=mt("ballHi",gf(),1),draw:(e,t,o,a,s)=>{let r=xe.out(U(o/.85)),i=U((o-.85)/.15),n=e.W*(.03+.05*r)*(1+i*.4)*(1-i)*s;ut(t.m,0,e.mouth.x+t.dir*e.W*.06+Math.sin(o*9)*e.W*.02,e.mouth.y+e.H*.3*r,e.mouth.z+e.W*.08,n),Ct(t.m)}},aura:{ms:2600,make:(e,t)=>t.m=mt("drop",j("gloss","#c4b5fd"),8),draw:(e,t,o,a,s,r)=>{let i=Math.min(U(o/.15),Qo(o))*s;for(let n=0;n<8;n++){let l=r()*ur,h=.5+r()*.12,f=(o*1.6+n/8)%1;ut(t.m,n,Math.cos(l)*e.W*h,e.H*(.1+.95*f),Math.sin(l)*e.D*h,e.W*.045*Math.sin(Math.PI*f)*i,Math.PI)}Ct(t.m)}},dizzy:{ms:1600,loop:!0,make:(e,t)=>t.m=mt("star",j("gloss","#ffd84d"),3),draw:(e,t,o,a,s)=>{for(let r=0;r<3;r++){let i=o*ur+r*ur/3;ut(t.m,r,Math.cos(i)*e.W*.42,e.H*1+Math.sin(i)*e.H*.04,Math.sin(i)*e.D*1.1,e.W*.045*s,a*.004,0,i)}Ct(t.m)}}}});function kf(e){return new Promise((t,o)=>{let a=new Ac.GLTFLoader;if(e.startsWith("data:")){let s=atob(e.slice(e.indexOf(",")+1)),r=new Uint8Array(s.length);for(let i=0;i<s.length;i++)r[i]=s.charCodeAt(i);a.parse(r.buffer,"",t,o)}else a.load(e,t,void 0,o)})}async function Mf(e){let t={},o=(r,i,n,l)=>{Number.isInteger(n)&&(t[r]||=[]).push({mesh:i,index:n,w:l})},{parser:a}=e,s=a.json.extensions||{};if(s.VRMC_vrm){let r={...s.VRMC_vrm.expressions?.preset,...s.VRMC_vrm.expressions?.custom};for(let[i,n]of Object.entries(r))for(let l of n?.morphTargetBinds||[]){let h=await a.getDependency("node",l.node).catch(()=>null);if(h)for(let f of vf(h))o(i,f,l.index,l.weight??1)}}else if(s.VRM){let r=new Map;e.scene.traverse(i=>{let n=a.associations.get(i);i.isMesh&&n?.meshes!=null&&(r.get(n.meshes)||r.set(n.meshes,[]).get(n.meshes)).push(i)});for(let i of s.VRM.blendShapeMaster?.blendShapeGroups||[]){let n=bf[String(i.presetName||"").toLowerCase()];if(n)for(let l of i.binds||[])for(let h of r.get(l.mesh)||[])o(n,h,l.index,(l.weight??100)/100)}}else e.scene.traverse(r=>{if(!(!r.isMesh||!r.morphTargetDictionary))for(let[i,n]of Object.entries(r.morphTargetDictionary)){let l=wf.find(([,h])=>h.test(i));l&&o(l[0],r,n,1)}});return t}async function Ef(e){let{parser:t}=e,o=t.json.extensions||{},a=o.VRMC_vrm?.humanoid?.humanBones?.head?.node??o.VRM?.humanoid?.humanBones?.find(i=>i.bone==="head")?.node;if(a!=null)return t.getDependency("node",a).catch(()=>null);let s=null,r=/^(mixamorig:?)?head$|^head[_\d]*$/i;return e.scene.traverse(i=>{!s&&i.isBone&&r.test(i.name)&&(s=i)}),s||e.scene.traverse(i=>{!s&&!i.isMesh&&r.test(i.name)&&(s=i)}),s}async function _f(e){let{parser:t}=e,o=t.json.extensions||{},a=o.VRMC_vrm?.humanoid?.humanBones,s=o.VRM?.humanoid?.humanBones,r=h=>{let f=a?a[h]?.node:s?.find(c=>c.bone===h)?.node;return f==null?null:t.getDependency("node",f).catch(()=>null)},i=[];e.scene.traverse(h=>{h.isBone&&i.push(h)}),i.length||e.scene.traverse(h=>{h.isMesh||i.push(h)});let n=(h,f)=>{let c=h==="left"?"l(eft)?":"r(ight)?",d={up:new RegExp(`^(mixamorig\\d*:?)?(${c}[_.]?(upper_?)?arm|(upper_?)?arm[_.]?${c})$`,"i"),low:new RegExp(`^(mixamorig\\d*:?)?(${c}[_.]?(fore_?arm|lower_?arm)|(fore_?arm|lower_?arm)[_.]?${c})$`,"i"),end:new RegExp(`^(mixamorig\\d*:?)?(${c}[_.]?hand|hand[_.]?${c})$`,"i")}[f];return i.find(p=>d.test(p.name.replace(/\s+/g,"")))||null},l=[];for(let h of["left","right"]){let f=h[0].toUpperCase()+h.slice(1),[c,d,p]=await Promise.all(["UpperArm","LowerArm","Hand"].map(u=>a||s?r(h+u):null));c||=n(h,"up"),d||=n(h,"low"),p||=n(h,"end"),!(!c||!d||!p||d.parent!==c)&&l.push({side:f,up:c,low:d,end:p,q0:[c.quaternion.clone(),d.quaternion.clone()]})}return l.length===2?l:[]}function Rc(e,t,o,a){let s=e.getWorldPosition(Cc[0]),r=t.getWorldPosition(Cc[1]).sub(s).normalize(),i=Is[0].setFromUnitVectors(r,o);a<1&&i.slerp(Is[2].identity(),1-a);let n=e.parent.getWorldQuaternion(Is[1]);e.quaternion.premultiply(n.clone().invert().multiply(i).multiply(n)),e.updateMatrixWorld(!0)}function Sf(e,t,o,a,s){let r=o.def,i=s?0:a-o.start,n=xe.inOut(U(Math.min(i/250,(o.ms-i)/300)));if(!(n>0))return;let l=ga[r.hands]||ga.rest,h=t.getWorldQuaternion(Is[2]).clone();t.updateMatrixWorld(!0);for(let f of e.arms){let d=t.worldToLocal(f.up.getWorldPosition(new He.Vector3)).x>=0?1:-1,p=l(d,i,o.dir||1,Tf),u=p.x??d*p.u,g=-(p.y??p.v),m=new He.Vector3(u-d*.55,g-.3,.35).normalize().applyQuaternion(h);Rc(f.up,f.low,m,n);let w=(p.ang||0)*yn,k=new He.Vector3(d*Math.sin(w),Math.cos(w),.3).normalize().applyQuaternion(h);Rc(f.low,f.end,k,n)}}function Hc(e){let t=e._model,o=this.L=ro(e),a=this.W=o.box.w*Ae,s=this.H=Math.max(o.box.h*Ae,a)*1.2;this.modelMode=!0,this.kk=Math.sqrt(a*s)/1.25,this.depth=a*.6,this.furLen=0,this.plush=!1,this.maxShells=0,this.pal={body:e.body.color},this.furs=[],this.parts=[],this.anims=[],this.bodyMeshes=[],this.eyes=[],this.brows=[],this.hands=[],this.eyeY=s*.86,this.r3=a*.07,this.model={ex:{},w:{},head:null,q0:null,mixer:null,clips:[],idle:null,act:null,ready:!1},this.fxc={W:a,H:s,D:this.depth,eyeY:this.eyeY,r:this.r3,sp:a*.12,mouth:new He.Vector3(0,s*.78,this.depth*.5),low:this.quality==="low",tears:[]};let r=new He.Mesh(new He.PlaneGeometry(1,1),new He.MeshBasicMaterial({map:Ns(),transparent:!0,depthWrite:!1,toneMapped:!1}));r.rotation.x=-Math.PI/2,r.position.y=.002,r.scale.set(a*1.2,this.depth*2,1),r.renderOrder=-1,this.shadow=r,this.root.add(r),this.bounds=new He.Box3(new He.Vector3(-a/2,0,-this.depth/2),new He.Vector3(a/2,s,this.depth/2)),this.boundsRev=(this.boundsRev||0)+1;let i=this.modelTok={};kf(t.url).then(async n=>{if(this.modelTok!==i)return;let l=n.scene;(n.parser.json.extensions||{}).VRM&&(l.rotation.y=Math.PI),l.traverse(w=>{w.isMesh&&(w.frustumCulled=!1,Array.isArray(w.material)||(w.userData.ownMaterial=!0))}),l.updateMatrixWorld(!0);let f=new He.Box3().setFromObject(l),c=f.getSize(new He.Vector3),d=f.getCenter(new He.Vector3);if(!(c.y>0))throw new Error("empty model");l.position.set(-d.x,-f.min.y,-d.z);let p=new He.Group;p.add(l);let u=s/c.y*t.scale;p.scale.setScalar(u),p.rotation.y=t.rot*yn,p.position.y=t.y*s,this.rig.add(p);let g=this.model;if(g.ex=await Mf(n),g.head=await Ef(n),this.modelTok!==i||(g.head&&(g.q0=g.head.quaternion.clone()),g.arms=await _f(n),this.modelTok!==i))return;if(n.animations.length){g.mixer=new He.AnimationMixer(l),g.clips=n.animations;let w=g.clips.find(k=>Lc.test(k.name));w&&(g.idle=g.mixer.clipAction(w),g.idle.play()),g.mixer.addEventListener("finished",k=>{k.action===g.act&&(g.act=null,k.action.fadeOut(.25),g.idle?.reset().fadeIn(.25).play())})}g.ready=!0,this.rig.updateMatrixWorld(!0);let m=new He.Box3().setFromObject(p);if(this.bounds=m,this.depth=Math.max(.05,m.max.z-m.min.z),this.W=Math.max(.05,m.max.x-m.min.x),this.shadow.scale.set(this.W*1.1,this.depth*1.6,1),g.head){let w=g.head.getWorldPosition(new He.Vector3);this.rig.worldToLocal(w),this.eyeY=this.fxc.eyeY=w.y+s*.04,this.fxc.mouth.set(w.x,w.y-s*.01,m.max.z*.6)}this.fxc.W=this.W,this.fxc.D=this.depth,this.boundsRev++}).catch(n=>{if(this.modelTok!==i)return;console.warn("[7ots] modelo 3D del mod no disponible:",n?.message||n);let{_model:l,...h}=e;this.modelFailed=t.url,this.build({...h,mods:(h.mods||[]).filter(f=>!f.model)})})}function Pc(e){let t=this.model;if(!t?.mixer)return!1;let o=yf[e],a=o&&t.clips.find(r=>o.test(r.name)&&!Lc.test(r.name));if(!a)return!1;let s=t.mixer.clipAction(a);return t.act&&t.act!==s&&t.act.fadeOut(.2),s.reset(),s.setLoop(He.LoopOnce,1),s.clampWhenFinished=!1,s.fadeIn(.2).play(),t.idle?.fadeOut(.2),t.act=s,!0}function zc(e,t){let o=typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches,a=this.opts.idle!==!1,s=this.model;a&&e>=this.nextBlink&&(this.moodName!=="sleep"&&!o&&(this.blinkAt=e,e-this.look.at>3e3&&Math.random()<.45&&(this.look.tx=Math.random()<.5?0:(Math.random()-.5)*.9,this.look.ty=Math.random()<.5?0:(Math.random()-.5)*.5)),this.nextBlink=e+1800+Math.random()*3600),this.speech&&!this.speech.tick(e)&&this.endSpeech();let r=this.mo;r.open=Ie(r.open,r.target,t,r.target>r.open?35:70),r.msx=Ie(r.msx,r.tmsx,t,60);let i=this.look;i.x=o?i.tx:Ie(i.x,i.tx,t,70),i.y=o?i.ty:Ie(i.y,i.ty,t,70),this.sleepK=Ie(this.sleepK,this.moodName==="sleep"?1:0,t,o?1:260);let n={x:0,y:0,r:0,sx:1,sy:1,blink:0},l=0,h=this.gest;if(h){let v=e-h.start,_=U(v/h.ms);h.clip===void 0&&(h.clip=s.ready&&this.modelGesture(h.name)),h.clip||(Object.assign(n,h.def.pose(_,o?0:v,h)),h.dir<0&&(n.x=-n.x,n.r=-n.r),n.sx=1+(n.sx-1)*.4,n.sy=1+(n.sy-1)*.4,h.name==="spin"&&(l=xe.inOut(U((_-.12)/.76))*Sc));for(let C of h.def.fx||[])_>=C[0]&&!h.fired.has(C)&&(h.fired.add(C),this.effect(C[1],{dir:h.dir,...C[2]||{}}));_>=1&&this.endGesture()}o&&Object.assign(n,{x:0,y:0,r:0,sx:1,sy:1});let{ksx:f,ksy:c}=this.tickMorphs(e,o),d=this.W,p=this.H,u=e/1e3,g=o||!a||s.idle?0:Math.sin(u*Sc/3.4+this.phase),m=this.rig;m.position.set(n.x*d,-n.y*p,0),m.rotation.set(s.head?0:i.y*.1,this.yaw+i.x*(s.head?.12:.3)+l+(o||!a?0:Math.sin(u*.7+this.phase)*.03),-(n.r+i.x*1.5)*yn),m.scale.set(n.sx*f*(1-.004*g),n.sy*c*(1+.01*g),n.sx*f);let w=Math.max(0,-n.y);this.shadow.material.opacity=1-w*1.5,s.head&&s.q0&&s.head.quaternion.copy(s.q0);for(let v of s.arms||[])v.up.quaternion.copy(v.q0[0]),v.low.quaternion.copy(v.q0[1]);if(s.mixer?.update(o?0:t/1e3),h&&!h.clip&&h.def.hands&&s.arms?.length&&Sf(s,m,h,e,o),s.head&&s.head.parent){let v=s.head.parent.getWorldQuaternion(new He.Quaternion),_=m.getWorldQuaternion(new He.Quaternion),C=new He.Quaternion().setFromEuler(new He.Euler(i.y*.35,i.x*.55,0,"YXZ"));C.premultiply(_).multiply(_.clone().invert()),s.head.quaternion.premultiply(v.clone().invert().multiply(C).multiply(v))}let k=Math.max(this.blinkValue(e),n.blink,this.sleepK>.02?Math.min(1,this.sleepK*1.1):0),b=U((1-r.msx)/.35),x={...xf[this.moodName]||{}};for(let v in s.w)v in x||(x[v]=0);for(let v in x)s.w[v]=o?x[v]:Ie(s.w[v]||0,x[v],t,120);let E={...s.w,blink:Math.max(k,s.w.blink||0),aa:r.open*(s.ex.oh?1-b:1),oh:r.open*b};E.happy>.3&&(E.blink=Math.max(E.blink*(1-E.happy),0));let T=new Set;for(let v in s.ex)for(let _ of s.ex[v])T.has(_)||(_.mesh.morphTargetInfluences[_.index]=0,T.add(_));for(let v in s.ex){let _=E[v]||0;if(_)for(let C of s.ex[v])C.mesh.morphTargetInfluences[C.index]=Math.min(1,C.mesh.morphTargetInfluences[C.index]+_*C.w)}this.tickEffects(e,o),this.fxg.position.copy(m.position),this.fxg.rotation.y=this.yaw}var He,Ac,yn,Sc,yf,Lc,bf,wf,xf,vf,Cc,Is,Tf,jc=Ye(()=>{He=_t(Do(),1),Ac=_t(cn(),1);mo();ya();un();Bs();yn=Math.PI/180,Sc=Math.PI*2,yf={wave:/wave|hello|greet|hi\b/i,dance:/dance/i,celebrate:/victory|celebrat|cheer|dance/i,jump:/jump/i,bounce:/jump|hop/i,nod:/\byes\b|nod/i,shake:/^no$|\bno\b|shake_?head/i,thumbsup:/thumbs?_?up|\byes\b/i,thumbsdown:/thumbs?_?down|\bno\b/i,bow:/bow/i,think:/think/i,clap:/clap/i,point:/point/i,laugh:/laugh/i,stomp:/stomp|punch/i,shrug:/shrug/i,dizzy:/dizz|death|die/i,yawn:/yawn|sit/i,fly:/fly/i,floss:/floss/i,robot:/robot/i,shuffle:/shuffle|running_?man/i,dab:/\bdab/i,groove:/groove|hip_?hop|default_?dance/i,armwave:/arm_?wave|wave_?arms/i,disco:/disco|boogie/i,moonwalk:/moonwalk|slide/i,routine:/routine|macarena/i},Lc=/idle|breath|stand/i,bf={a:"aa",i:"ih",u:"ou",e:"ee",o:"oh",joy:"happy",sorrow:"sad",fun:"relaxed",angry:"angry",blink:"blink",surprised:"surprised"},wf=[["aa",/jaw_?open|mouth_?open|viseme_?aa|^v_?aa$|^aa$|^a$/i],["oh",/viseme_?(oh|o|ou)$|^oh$|^o$|mouth_?(funnel|pucker)/i],["blink",/^blink$|blink_?both|eyes?_?clos|^eyeblink$|^blink/i],["happy",/happy|joy|smile/i],["sad",/sad|sorrow/i],["angry",/angry|anger|\bmad\b/i],["surprised",/surpris|shock/i]],xf={happy:{happy:.8},love:{happy:.7,relaxed:.3},angry:{angry:.85},disgust:{angry:.5},sad:{sad:.85},fear:{surprised:.5,sad:.3},surprised:{surprised:.9},sleep:{relaxed:.6}};vf=e=>{let t=[];return e.traverse(o=>{o.isMesh&&o.morphTargetInfluences&&t.push(o)}),t};Cc=[new He.Vector3,new He.Vector3,new He.Vector3],Is=[new He.Quaternion,new He.Quaternion,new He.Quaternion],Tf={cx:0,W:2,H:2,mid:0,mouthY:-.4,eyeY:-.7,mw:.2,sp:.3,pts:null}});function Af(e){return e.eyes={...e.eyes,type:aa("eyes",e.eyes.type)},e.brows={...e.brows,type:aa("brows",e.brows.type)},e.mouth={...e.mouth,type:aa("mouths",e.mouth.type)},e.cheeks={...e.cheeks,type:aa("cheeks",e.cheeks.type)},e.body={...e.body,pattern:aa("patterns",e.body.pattern)},e.finish=aa("finishes",e.finish),e.accessories=e.accessories.map(t=>({...t,id:aa("accessories",t.id)})),e}function Lf(e){let t=Af(hr(e));if(!t._style)return t;let o=t.finish;return t.finish=Cf[t._style.id]||(o==="clay"||o==="sketch"?o:t._style.lw>0?"toon":o==="flat"?"soft3d":o),t}function Vf(e){if(!Vs.has(e)){let t=new Promise((o,a)=>{let s=new Bc.GLTFLoader,r=i=>o(i.scene);if(e.startsWith("data:")){let i=atob(e.slice(e.indexOf(",")+1)),n=new Uint8Array(i.length);for(let l=0;l<i.length;l++)n[l]=i.charCodeAt(l);s.parse(n.buffer,"",r,a)}else s.load(e,r,void 0,a)});t.catch(()=>Vs.delete(e)),Vs.set(e,t)}return Vs.get(e)}function O(e,t,o,a,s){let r=new H.Mesh(e,t);return o&&r.position.set(...o),a&&r.rotation.set(...a),s&&(typeof s=="number"?r.scale.setScalar(s):r.scale.set(...s)),r}var H,Bc,Cf,Rf,Hf,Mo,bt,Oc,Ur,Fs,Dc,qc,Qc,Ic,Pf,zf,jf,Gc,Of,bn,qf,Gf,Nf,Nc,Yr,Bf,Vc,Fc,Df,Io,Qf,If,Vs,he,sa,wn=Ye(()=>{H=_t(Do(),1);mo();Na();Ss();Bc=_t(cn(),1);pa();Nr();ya();un();Bs();Tc();jc();Cf={ukiyoe:"toon",glass:"glossy",bauhaus:"toon",manuscript:"toon",glitch:"neon",clay:"clay",ink:"sketch",pop:"toon",watercolor:"soft3d",pixel:"toon",synthwave:"neon",nouveau:"toon",cubism:"toon",crayon:"sketch",blueprint:"neon",pointillism:"soft3d",woodcut:"sketch",riso:"toon",dotmatrix:"toon",chalk:"sketch",sticker:"glossy",felt:"clay",papercut:"soft3d",lowpoly:"toon",marble:"soft3d",candy:"glossy",holo:"glossy",sumie:"sketch",tarot:"toon",retro70:"toon",mosaic:"toon",neonsign:"neon",graffiti:"toon",thermal:"soft3d"},Rf={clay:{finish:"clay",texture:"none"},metal:{finish:"metal",texture:"none"},glass:{finish:"glass",texture:"none"},pearl:{finish:"pearl",texture:"none"},holo:{finish:"holo",texture:"none"},wood:{finish:"clay",texture:"wood"},stone:{finish:"clay",texture:"stone"},knit:{finish:"velvet",texture:"knit"},glitter:{finish:"glossy",texture:"glitter"},quilt:{finish:"velvet",texture:"quilt"},honeycomb:{finish:"glossy",texture:"honeycomb"},bubbles:{finish:"glass",texture:"bubbles"}};Hf=new Set(["metal","glass","pearl","holo","velvet","pastel"]),Mo=Math.PI/180,bt=Math.PI*2,Oc=new H.Vector3(0,0,1),Ur=new H.Object3D,Fs={neutral:{curve:.15,tilt:0},happy:{curve:.85,tilt:-.25,squash:.85},angry:{curve:-.45,tilt:1},sad:{curve:-.85,tilt:-1},fear:{curve:-.35,tilt:-.8,eye:1.15,open:.15},disgust:{curve:-.55,tilt:.6,squash:.8},love:{curve:.75,tilt:-.3},sleep:{curve:0,tilt:0,closed:!0},surprised:{curve:0,tilt:-.4,eye:1.2,open:.45,lift:4}},Dc={curve:0,tilt:0,squash:1,eye:1,open:0,lift:0},qc=e=>({...Dc,...Fs[e]||Fs.neutral}),Qc=Object.keys(Fs),Ic=Object.keys(Ft),Pf=new Set(["dot","kawaii","bean","sparkle","teary","button","pixel","villain"]),zf=new Set(["kawaii","sparkle","teary"]),jf={sleepy:[.5,0],tired:[.42,0],angry:[.42,1],sad:[.42,-1],focused:[.33,0]},Gc={grin:.35,laugh:.6,open:.35,vampire:.25,buck:.12,braces:.35,monster:.45,gap:.35,toothless:.45,drool:.2,mustachio:.1},Of=new Set(["grin","braces","monster","gap","mustachio","vampire","buck"]),bn=new Set(["oh","kiss","whistle"]),qf={frown:-.7,flat:-.15,smile:.25,smirk:.2,pout:-.5,cat:.3},Gf={angry:[["spikes",{ms:900}],["anger"],["steam"]],surprised:[["exclaim"]],love:[["hearts"],["blush"]],happy:[["sparkles"]],sad:[["tears"]],fear:[["sweat"]],disgust:[["squish",{ms:700}]],sleep:[["zzz",{hold:!0,tag:"mood"}]]},Nf=1800,Nc=380,Yr=300,Bf=300,Vc=Object.keys(xo),Fc=Object.keys(ja),Df={puff:e=>[1+.2*e,1+.14*e],squish:e=>[1+.22*e,1-.22*e],stretch:e=>[1-.12*e,1+.26*e],melt:e=>[1+.06*e,1-.38*e]},Io=()=>performance.now(),Qf=()=>typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches,If=e=>(e.userData.shared=!0,e),Vs=new Map;he=(...e)=>{let t=new H.Group;return e.length&&t.add(...e),t},sa=class{constructor(t,o={}){this.opts=o,this.quality=o.quality||"high",this.q=this.quality==="high"?1:.45,this.root=new H.Group,this.rig=new H.Group,this.root.add(this.rig),this.yaw=0,this.view=null,this.phase=Math.random()*bt,this.moodName="neutral",this.mv=qc("neutral"),this.sleepK=0,this.look={x:0,y:0,tx:0,ty:0,at:-1e9},this.mo={open:0,target:0,msx:1,tmsx:1},this.blinkAt=-1e9,this.nextBlink=Io()+600+Math.random()*3e3,this.gest=null,this.speech=null,this.shells=0,this.morphs=new Map,this.fxs=[],this.fxSeq=0,this.fxg=new H.Group,this.root.add(this.fxg),this.build(t)}build(t){this.disposeRig(),this.clearMorphObjects();for(let te of this.fxs)$r(te.obj);this.fxs=[];let o=this.spec=Lf(Ha(Xe(t),Xe));if(this.modelMode=!1,this.modelTok=null,o._model&&o._model.url!==this.modelFailed)return this.buildModel(o);let a=o._style,s=ra(o),r=this.L=ro(o),i=this.B=hn(s,r.box,this.quality),n=fn(i.geometry),l=this.W=r.box.w*Ae,h=this.H=r.box.h*Ae;this.depth=i.depth;let f=this.kk=Math.sqrt(l*h)/1.25,c=this.Y=te=>(i.bottom-te)*Ae,d=this.X=te=>(te-r.cx)*Ae,p=!a&&Rf[this.opts.material];p&&(o.finish=p.finish);let u=this.tex=p?p.texture:aa("textures",Ni(o)),g=!p&&(Hf.has(o.finish)||o.texture&&o.texture!=="auto"&&u in pn),m=this.plush=!a&&!p&&(["fur","fuzz","feathers"].includes(u)||(this.opts.material||"plush")==="plush"&&!g),w=this.furLen=m?(u==="fuzz"||u==="none"?.05:.065)*f:0,k=this.density=w?this.quality==="high"?1/(w*.2):1/(w*.32):0;this.maxShells=this.quality==="high"?28:10;let b=o.body.color,x=yo(b)<.28,E=this.pal={body:b,brow:o.brows.color||Z(b,x?.6:-.6),lip:o.mouth.color||Z(b,x?.6:-.55)};this.furs=[],this.pending=[],this.parts=[],this.anims=[],this.bodyMeshes=[],this.zGrid=null,this.hideMouth=!1;let T=mn({color:b,patternColor:o.body.patternColor,pattern:o.body.pattern,finish:o.finish,plush:m,furLen:w,density:k,cheekColor:o.cheeks.color,texture:u});this.bodyU=T.uniforms,this.bodyMat=T.base;let v=r.r*Ae,_=c(r.eyeY);this.r3=v,this.eyeY=_,T.uniforms.uDims.value.set(l,h,_,v),T.uniforms.uSp.value=r.sp*Ae;let C=If(new H.Mesh(i.geometry,T.base));C.userData.ownMaterial=!0,this.rig.add(C),this.bodyMeshes.push(C),T.shell&&this.bodyMeshes.push(this.addShells(i.geometry,T,this.rig)),this.probe=n;let L=a?a.lw*.0042:o.finish==="toon"?.016:.009;if(o.finish==="toon"||o.finish==="sketch"||a&&a.lw>0){let te=new H.Mesh(i.geometry,$n(T.uniforms,{outline:!0,color:a?.ink||"#1f2937",off:w*1.05+L*f,wobble:o.finish==="sketch"?.6:0}));te.userData.ownMaterial=!0,te.userData.noBounds=!0,this.rig.add(te),this.bodyMeshes.push(te)}this.eyes=[];let z=o.eyes.type==="cyclops",N=z?[0]:[-r.sp*Ae,r.sp*Ae];if(N.forEach((te,ue)=>{let be=z||ue?1:-1,fe=n.front(te,_),Fe=this.buildEye(o.eyes.type,z?v*1.7:v,be);Fe.root.position.copy(fe.p),Fe.root.quaternion.setFromUnitVectors(Oc,fe.n.clone().lerp(Oc,.5).normalize()),this.rig.add(Fe.root),this.eyes.push(Fe),this.part(Fe.root,!0),T.uniforms.uBald.value[ue]&&T.uniforms.uBald.value[ue].set(fe.p.x,fe.p.y,fe.p.z,(z?v*1.7:v)*1.05)}),this.brows=[],o.brows.type!=="none"){let te=o.brows.type,ue={thick:.2,thin:.06,bushy:.16,dots:.18,soft:.09}[te]||.11,be=te==="unibrow",fe=be?[0]:N.length===1?[0]:N;for(let Fe of fe){let Y=Fe<0?-1:1,$e=_+v*1.65*(z?1.5:1),Oe=n.front(Fe,$e),Ge=be?r.sp*Ae+v:v*.85,qe=(Ne,Gt)=>new H.Vector3(Ne*v*Y,Gt*v,v*.06),Ze;te==="arched"?Ze=new H.QuadraticBezierCurve3(qe(-.9,-.25),qe(.1,.7),qe(.95,-.05)):te==="angled"?(Ze=new H.CurvePath,Ze.add(new H.LineCurve3(qe(-.9,-.15),qe(.35,.35))),Ze.add(new H.LineCurve3(qe(.35,.35),qe(.9,.05)))):Ze=new H.QuadraticBezierCurve3(new H.Vector3(-Ge,0,0),new H.Vector3(0,v*(te==="soft"?.45:.35),v*.12),new H.Vector3(Ge,0,0));let lo=te==="dots"?this.sph(v*.3,16,12).scale(1.3,.8,.6):new H.TubeGeometry(Ze,te==="angled"?24:16,v*ue,8,!1),We=O(lo,j("felt",E.brow)),st=he(We);st.position.copy(Oe.p).addScaledVector(Oe.n,w*.7+v*.05),st.userData.base=st.position.y,this.rig.add(st),this.brows.push({g:st,side:be?0:Y}),this.part(st,!0)}}this.buildMouth(o,n,d(r.cx),c(r.mouthY),r.mw*Ae,T),this.part(this.mouthRig.g,!0);let Q=o.cheeks.type;if(Q==="whiskers"){let te=j("matte","#1f2937");for(let ue of[-1,1])for(let be of[-.25,0,.25]){let fe=ue*r.sp*Ae*.7,Fe=_-v*(2.4+be*2),Y=n.front(fe,Fe);if(!Y)continue;let $e=Y.p.clone().addScaledVector(Y.n,w*.8+.004),Oe=new H.Vector3(ue*(r.sp*Ae+v*2.6),_-v*(2.2+be*3.2),$e.z*.75+w),Ge=$e.clone().lerp(Oe,.5);Ge.z+=.02*f;let qe=he(O(new H.TubeGeometry(new H.QuadraticBezierCurve3($e,Ge,Oe),8,Math.max(.002,v*.05),5),te));this.rig.add(qe),this.part(qe,!0)}}else if(Q!=="none"){let te=r.sp*Ae+v*.45,ue=_-v*1.8,be=n.front(te,ue);T.uniforms.uCheek.value.set(te,ue,be?be.p.z:0,v*(Q==="blush"?1:.7)),T.uniforms.uCheekOn.value=1,T.uniforms.uCheekType.value=xc[Q]||1;let fe=o.cheeks.color||"#ff6b8a";Q==="stars"?T.uniforms.uCheekColor.value.set("#facc15"):Q==="freckles"?T.uniforms.uCheekColor.value.set(Z(o.cheeks.color||Z(b,-.25),-.35)):Q==="hearts"?T.uniforms.uCheekColor.value.set(o.cheeks.color||"#ff4d7a"):T.uniforms.uCheekColor.value.set(fe)}for(let te of o.accessories){let ue=this.buildAccessory(te,{L:r,X:d,Y:c,W:l,H:h,kk:f,probe:n,eyeY:_,r3:v,bm:T});if(!ue)continue;ue.updateMatrixWorld(!0);let be=ue.userData.surface?new H.Vector3:ue.userData.pivot?ue.userData.pivot.clone():new H.Box3().setFromObject(ue).getCenter(new H.Vector3),fe=he(ue);ue.position.sub(be),fe.position.copy(be),ue.userData.surface||(fe.position.x+=te.x*Ae,fe.position.y-=te.y*Ae,fe.rotation.z-=te.rot*Mo,fe.scale.multiplyScalar(te.scale),te.flip&&(fe.scale.x*=-1)),this.rig.add(fe),ue.userData.surface||this.part(fe,!1)}this.hideMouth&&(this.mouthRig.g.visible=!1);let F=this.sph(.1*f,24,16).scale(1,1.1,.85),A=new H.CapsuleGeometry(.032*f,.07*f,4,8).translate(0,.1*f,.02*f);this.hands=[-1,1].map(te=>{let ue=he();m?this.addFur(F,b,ue,.7):ue.add(O(F,T.base));let be=m?this.addFur(A,b,he(),.5):O(A,T.base);return be.visible=!1,ue.add(be),ue.userData.finger=be,ue.visible=!1,this.rig.add(ue),ue});let B=this.eyes.map(te=>{let ue=te.root.position.x,be=[];for(let fe=0;fe<=6;fe++){let Fe=n.front(ue+Math.sign(ue||1)*v*.05*fe,_-v*(.9+fe*.5)),Y=Fe.p.clone().addScaledVector(Fe.n,w+.006*f);be.push([Y.x,Y.y,Y.z])}return be});this.fxc={W:l,H:h,D:i.depth,eyeY:_,r:v,sp:r.sp*Ae,mouth:this.mouthRig.g.position,low:this.quality==="low",tears:B};let W=new H.Mesh(new H.PlaneGeometry(1,1),new H.MeshBasicMaterial({map:Ns(),transparent:!0,depthWrite:!1,toneMapped:!1}));W.rotation.x=-Math.PI/2,W.position.y=.002,W.scale.set(l*1.55,i.depth*2.6,1),W.renderOrder=-1,this.shadow=W,this.root.add(W),this.rig.updateMatrixWorld(!0);let ae=this.bounds=new H.Box3,Me=new H.Box3;this.rig.traverseVisible(te=>{!te.isMesh||te.isInstancedMesh||te.userData.noBounds||(te.geometry.boundingBox||te.geometry.computeBoundingBox(),ae.union(Me.copy(te.geometry.boundingBox).applyMatrix4(te.matrixWorld)))}),ae.expandByScalar(this.furLen),this.shells=-1,this.setShells(this.maxShells)}part(t,o){this.parts.push({o:t,p0:t.position.clone(),face:o,d:new H.Vector3})}frontZ(t,o){let s=this.W,r=this.H;if(!this.zGrid){let w=this.zGrid=new Float32Array(144);for(let k=0;k<12;k++)for(let b=0;b<12;b++)w[k*12+b]=this.probe.front((b/11-.5)*s,k/11*r)?.p.z??NaN}let i=U((t/s+.5)*11,0,11),n=U(o/r*11,0,11),l=Math.min(10,Math.floor(i)),h=Math.min(10,Math.floor(n)),f=i-l,c=n-h,d=this.zGrid,p=d[h*12+l],u=d[h*12+l+1],g=d[(h+1)*12+l],m=d[(h+1)*12+l+1];if(Number.isNaN(p)||Number.isNaN(u)||Number.isNaN(g)||Number.isNaN(m)){let w=d[Math.round(n)*12+Math.round(i)];return Number.isNaN(w)?null:w}return de(de(p,u,f),de(g,m,f),c)}sph(t,o=32,a=16,...s){let r=this.q;return new H.SphereGeometry(t,Math.max(8,Math.round(o*r)),Math.max(6,Math.round(a*r)),...s)}tor(t,o,a=12,s=48,r=bt){let i=this.q;return new H.TorusGeometry(t,o,Math.max(4,Math.round(a*i)),Math.max(8,Math.round(s*i)),r)}addShells(t,o,a){let s=new H.InstancedMesh(t,o.shell,this.maxShells);return s.frustumCulled=!1,s.userData.ownMaterial=!0,a.add(s),this.furs.push({inst:s,u:o.uniforms}),s}addFur(t,o,a,s=.8){let r=mn({color:o,patternColor:o,pattern:"none",finish:"clay",plush:!0,furLen:this.furLen*s||.04,density:this.density||60});r.uniforms.uDims.value.set(1,.001,-9,.01);let i=new H.Mesh(t,r.base);return i.userData.ownMaterial=!0,a.add(i),this.addShells(t,r,a),a}setShells(t){if(t=Math.max(0,Math.min(this.maxShells,Math.round(t))),t!==this.shells){this.shells=t;for(let o of this.furs)o.inst.count=t,o.u.uShells.value=Math.max(1,t)}}buildEye(t,o,a){let s=this.spec.eyes,r=he(),i=he(),n=he();r.add(i),i.add(n);let l=j("gloss",s.ink),h=t;h==="wink"&&(h=a>0?"happy":"round");let f=!1;if(Pf.has(h)){let d=h==="kawaii"?1.15:h==="dot"?.75:h==="button"?1:.9,p=h==="bean"?[.55,1.2,.5]:h==="dot"?[.8,1.05,.6]:[.92,1,.6];n.add(O(this.sph(o*d,32,24),l,[0,0,-o*.18],null,p)),h==="button"&&n.add(O(this.tor(o*.72,o*.07,8,32),j("gloss",Z(s.ink,.25)),[0,0,o*.45])),zf.has(h)&&(n.add(O(this.sph(o*.2,12,8),j("emissive","#ffffff"),[-o*.32,o*.36,o*.38])),n.add(O(this.sph(o*.09,10,6),j("emissive","#ffffff"),[o*.34,-o*.34,o*.38])))}else if(h==="happy"||h==="closed"||h==="cross")if(f=!0,h==="cross")for(let d of[45,-45])i.add(O(new H.CapsuleGeometry(o*.13,o*1.3,4,8),j("felt",s.ink),[0,0,o*.1],[0,0,d*Mo]));else i.add(O(this.tor(o*.72,o*.14,10,24,Math.PI),j("felt",s.ink),[0,h==="happy"?-o*.25:o*.25,o*.08],[0,0,h==="happy"?0:Math.PI]));else if(h==="star"||h==="heart"){let d=new H.Shape;if(h==="star")for(let u=0;u<10;u++){let g=-Math.PI/2+u*Math.PI/5,m=u%2?o*.5:o*1.1;u?d.lineTo(Math.cos(g)*m,-Math.sin(g)*m):d.moveTo(Math.cos(g)*m,-Math.sin(g)*m)}else{let u=o*1.05;d.moveTo(0,-u*.9),d.bezierCurveTo(-u*1.4,u*.1,-u*.7,u*1.05,0,u*.35),d.bezierCurveTo(u*.7,u*1.05,u*1.4,u*.1,0,-u*.9)}let p=new H.ExtrudeGeometry(d,{depth:o*.2,bevelEnabled:!0,bevelThickness:o*.12,bevelSize:o*.1,bevelSegments:3,curveSegments:10});n.add(O(p,j("gloss",h==="heart"?"#ef3b5d":s.iris),[0,0,-o*.05]))}else if(h==="robot"||h==="led"||h==="glow"||h==="pixel")h==="robot"?(i.add(O(new H.BoxGeometry(o*2,o*1.6,o*.3),j("plastic","#0b1220"),[0,0,0])),n.add(O(new H.BoxGeometry(o*1.3,o*.9,o*.1),j("emissive",s.iris),[0,0,o*.16]))):h==="led"?n.add(O(new H.CapsuleGeometry(o*.3,o*1.6,4,12),j("emissive",s.iris),[0,0,o*.05],[0,0,Math.PI/2])):n.add(O(this.sph(o*.95,24,16),j("emissive",s.iris),[0,0,-o*.3],null,[1,1,.6]));else if(h==="spiral"||h==="dollar"){i.add(O(this.sph(o,32,24),j("gloss","#ffffff"),[0,0,-o*.2],null,[1,1,.75]));let d=o*.56,p;if(h==="spiral"){let g=[];for(let m=0;m<=48;m++){let w=m/48*Math.PI*5,k=o*(.06+.78*(m/48));g.push(new H.Vector3(Math.cos(w)*k,Math.sin(w)*k,d-m/48*o*.12))}p=new H.TubeGeometry(new H.CatmullRomCurve3(g),96,o*.07,6,!1)}else{let g=[[.45,.5],[0,.66],[-.45,.42],[-.28,.1],[.28,-.1],[.45,-.42],[0,-.66],[-.45,-.5]].map(([m,w])=>new H.Vector3(m*o*.6,w*o*.6,d));p=new H.TubeGeometry(new H.CatmullRomCurve3(g),40,o*.09,6,!1)}let u=O(p,j("gloss",h==="spiral"?s.ink:"#16a34a"));n.add(u),h==="dollar"?n.add(O(new H.CapsuleGeometry(o*.07,o*.95,3,6),j("gloss","#16a34a"),[0,0,d])):this.anims.push(g=>{u.rotation.z=-g*4*a})}else{let p=o*(h==="googly"?1.15:h==="wide"?1.12:h==="anime"?1.05:1),u=O(this.sph(p,32,24),j("gloss",h==="googly"||h==="hypno"?"#ffffff":s.white),[0,0,-p*.2],null,h==="anime"?[.9,1.2,.75]:h==="focused"?[1,.75,.75]:h==="almond"?[1.15,.72,.75]:[1,1,.75]);if(i.add(u),n.position.z=-p*.2,h==="almond"&&n.scale.set(1,.85,1),h==="lashes")for(let k=0;k<3;k++){let b=Math.cos(a>0?(30+k*30)*Mo:(150-k*30)*Mo),x=Math.sin((30+k*30)*Mo);i.add(O(new H.CapsuleGeometry(p*.07,p*.32,3,6),j("felt",s.ink),[b*p*1.05,x*p*1.05,p*.2],[0,0,Math.atan2(x,b)-Math.PI/2]))}let g=h==="cat"?.92:h==="anime"?.7:h==="almond"?.72:h==="wide"||h==="googly"?0:.58;g&&n.add(O(this.sph(p*g,24,16),j("gloss",s.iris),[0,0,p*.62],null,h==="anime"?[1,1.3,.3]:[1,1,.3]));let m=h==="wide"?.3:h==="googly"?.55:h==="cat"?.5:.32;n.add(O(this.sph(p*m,20,12),l,[0,0,p*.68],null,h==="cat"?[.3,1.5,.3]:[1,1,.32])),n.add(O(this.sph(p*.11,10,6),j("emissive","#ffffff"),[-p*.22,p*.26,p*.78]));let w=jf[h];if(w){let k=this.sph(p*1.07,32,12,0,bt,0,Math.PI*w[0]),b=O(k,j("felt",Z(this.spec.body.color,-.06)),[0,0,-p*.2],[0,0,w[1]*a*.45],[1,1,.8]);i.add(b)}}let c=O(this.tor(o*.72,o*.13,10,24,Math.PI),j("felt",s.ink),[0,o*.25,o*.08],[0,0,Math.PI]);return c.visible=!1,r.add(c),{root:r,main:i,gaze:n,closed:c,noBlink:f}}buildMouth(t,o,a,s,r,i){let n=t.mouth.type,l=he(),h=o.front(a,s),f=this.plush?this.furLen*.55:.006;l.position.copy(h.p).addScaledVector(h.n,f),this.rig.add(l),i.uniforms.uBald.value[2]&&i.uniforms.uBald.value[2].set(h.p.x,h.p.y,h.p.z,r*1.1);let c=this.mouthRig={g:l,type:n,line:null,cav:null,min:Gc[n]||0,bias:qf[n]||0,mw:r,round:null},d=j("felt",this.pal.lip),p=n==="grit"||n==="lips";if(!Gc[n]&&!bn.has(n)&&n!=="beak"&&!p){let u=k=>{let b=[];for(let x=0;x<=8;x++){let E=x/4-1,T=E*r*(n==="tiny"||n==="pout"?.5:1),v=k*r*.5*(E*E-.45)+(n==="smirk"?E*r*.12:0)+(n==="wavy"?Math.sin(E*Math.PI*2)*r*.12:0),_=o.front(a+T,s+v).p.z-h.p.z;b.push(new H.Vector3(T,v,_))}return new H.TubeGeometry(new H.CatmullRomCurve3(b),32,Math.max(.006,r*.085),8,!1)},g=u(0),m=u(1),w=u(-1);g.morphAttributes.position=[m.attributes.position,w.attributes.position],g.morphAttributes.normal=[m.attributes.normal,w.attributes.normal],m.dispose(),w.dispose(),c.line=O(g,d),c.line.morphTargetInfluences=[0,0],l.add(c.line),n==="tongue"&&l.add(O(new H.CapsuleGeometry(r*.32,r*.3,4,12),j("gloss","#ff7a8a"),[r*.1,-r*.38,r*.05],null,[1,1,.45]))}if(bn.has(n)&&(c.round=he(O(this.tor(r*.32,r*.1,10,24),n==="kiss"?j("gloss","#e11d48"):d),O(new H.CircleGeometry(r*.3,20),j("matte","#3a0d14"),[0,0,-.002])),n==="whistle"&&(c.round.position.x=r*.35),l.add(c.round)),n==="beak"&&l.add(O(new H.ConeGeometry(r*.6,r*1.1,24),j("plastic","#f59e0b"),[0,0,r*.4],[Math.PI/2,0,0],[1,1,.55])),n==="grit"){let u=he(O(new H.BoxGeometry(r*2,r*.5,r*.12),j("plastic","#ffffff"))),g=j("matte","#1f2937");u.add(O(new H.BoxGeometry(r*2,r*.05,r*.02),g,[0,0,r*.065]));for(let m=1;m<5;m++)u.add(O(new H.BoxGeometry(r*.05,r*.5,r*.02),g,[(m/5-.5)*r*2,0,r*.065]));u.add(O(this.tor(1,.06,6,4).rotateZ(Math.PI/4).scale(r*1.45,r*.36,r*.2),d)),c.grit=u,l.add(u)}if(n==="lips"){let u=j("gloss",t.mouth.color||"#e11d48"),g=he();for(let k of[-1,1])g.add(O(this.sph(1,20,12),u,[k*r*.42,0,0],[0,0,k*.25],[r*.55,r*.22,r*.2]));let m=O(this.sph(1,24,12),u,[0,0,0],null,[r*.85,r*.28,r*.22]),w=O(this.sph(1,20,10),j("gloss","#3a0d14"),[0,0,-r*.05],null,[r*.7,.001,r*.1]);c.lips={up:g,lo:m,hole:w},l.add(g,m,w)}if(n!=="beak"&&!bn.has(n)&&!p){let u=he(),g=n==="robot"||n==="square";u.add(O(g?new H.BoxGeometry(2,2,1):this.sph(1,28,16),j("gloss","#3a0d14"),[0,0,0],null,g?[1,.5,.5]:[1,1,1]));let m=O(this.sph(.6,20,12),j("felt","#ff7a8a"),[0,-.45,.35],null,[1,.55,.5]);if(u.add(m),Of.has(n)&&u.add(O(new H.BoxGeometry(n==="buck"?.6:1.4,.3,.3),j("plastic","#ffffff"),[0,.68,.55])),n==="vampire"||n==="monster")for(let w of[-.5,.5])u.add(O(new H.ConeGeometry(.14,.4,8),j("plastic","#ffffff"),[w,.62,.62],[Math.PI,0,0]));u.add(O(this.tor(1,.09,8,32),d,[0,0,.1],null,[1,1,1])),u.visible=!1,c.cav=u,l.add(u)}}buildAccessory(t,o){let{kk:a,probe:s,H:r,W:i,eyeY:n,r3:l,Y:h,X:f,L:c,bm:d}=o,p=.01*a,u=t.color,g=t.color2,m=t.id,w=s.top(0,0).p,k=v=>s.section(w.y-v*a),b=(v,_,C=.8)=>this.addFur(v,_,he(),C),x=he(),E=(v,_=.05)=>(x.position.set(w.x,w.y-_*a,0),x.add(v),x),T=v=>{let _=k(v);return{w:_.w,d:_.d,y:w.y-v*a}};switch(m){case"crown":case"tiara":{let v=j("metal",u),_=m==="crown"?6:3,C=.24*a;m==="crown"?x.add(O(new H.CylinderGeometry(C,C*1.05,.12*a,32,1,!0),v)):x.add(O(this.tor(C,.02*a,8,32,Math.PI),v,[0,0,0],[-Math.PI/2+.3,0,0]));for(let L=0;L<_;L++){let z=m==="crown"?L/_*bt:L/(_-1)*Math.PI,N=[Math.cos(z)*C,.1*a,m==="crown"?Math.sin(z)*C:Math.sin(z)*C*.3+.05*a];x.add(O(new H.ConeGeometry(.05*a,.12*a,12),v,N)),x.add(O(this.sph(.025*a,12,8),j("gloss",m==="crown"?"#dc2626":"#60a5fa"),[N[0],N[1]+.07*a,N[2]]))}return E(he(...x.children.splice(0)),.02)}case"tophat":{let v=he(O(new H.CylinderGeometry(.36*a,.36*a,.025*a,40),j("felt",u)),O(new H.CylinderGeometry(.22*a,.24*a,.4*a,40),j("felt",u),[0,.2*a,0]),O(new H.CylinderGeometry(.245*a,.245*a,.07*a,40),j("felt",g==="#ffffff"?"#dc2626":g),[0,.05*a,0]));return v.rotation.z=-.12,E(v,.06)}case"fedora":case"bowler":{let v=j("felt",u),_=m==="fedora",C=he(O(new H.CylinderGeometry((_?.4:.32)*a,(_?.4:.32)*a,.022*a,48),v,null,_?[-.08,0,0]:null),_?O(new H.CylinderGeometry(.19*a,.23*a,.24*a,40),v,[0,.12*a,0],null,[1,1,.85]):O(this.sph(.23*a,40,20,0,bt,0,Math.PI/2),v,[0,.06*a,0],null,[1,1.05,.92]),O(new H.CylinderGeometry(.235*a,.235*a,.05*a,40),j("felt",g),[0,.045*a,0],null,[1,1,_?.88:.93]));return _||C.add(O(new H.CylinderGeometry(.23*a,.23*a,.06*a,40),v,[0,.03*a,0],null,[1,1,.92])),_&&C.add(O(this.sph(.12*a,24,10),j("felt",Z(u,-.25)),[0,.24*a,0],null,[1,.25,.6])),C.rotation.z=_?-.14:-.06,E(C,.06)}case"witch":{let v=j("felt",u),_=he(O(new H.CylinderGeometry(.46*a,.46*a,.02*a,48),v)),C=0,L=0,z=[[.25,.17,.3,0],[.17,.09,.22,-.35],[.09,.01,.2,-.9]];for(let[N,Q,F,A]of z){let B=O(new H.CylinderGeometry(Q*a,N*a,F*a,32),v);B.geometry.translate(0,F/2*a,0),B.position.set(L,C,0),B.rotation.z=A,_.add(B),L+=-Math.sin(A)*F*a,C+=Math.cos(A)*F*a}return _.add(O(new H.CylinderGeometry(.245*a,.25*a,.06*a,40),j("felt",g),[0,.04*a,0])),_.add(O(new H.BoxGeometry(.08*a,.06*a,.02*a),j("metal","#facc15"),[0,.04*a,.25*a])),_.rotation.z=.1,E(_,.05)}case"fez":{let v=he(O(new H.CylinderGeometry(.16*a,.2*a,.3*a,36),j("felt",u),[0,.15*a,0]),O(new H.CylinderGeometry(.006*a,.006*a,.14*a,6),j("felt",g),[.07*a,.305*a,.02*a],[0,0,Math.PI/2])),_=he(O(new H.CylinderGeometry(.006*a,.006*a,.2*a,6),j("felt",g),[0,-.1*a,0]),O(new H.ConeGeometry(.035*a,.09*a,12),j("felt",g),[0,-.2*a,0]));return _.position.set(.14*a,.3*a,.02*a),_.rotation.z=.2,v.add(_),this.anims.push(C=>{_.rotation.z=.2+Math.sin(C*2.4)*.12}),v.rotation.z=-.1,E(v,.06)}case"sombrero":{let v=j("felt",u),_=he(O(this.tor(.5*a,.035*a,10,56),v,[0,.03*a,0],[Math.PI/2,0,0]),O(new H.CylinderGeometry(.52*a,.52*a,.02*a,56),v),O(new H.CylinderGeometry(.13*a,.21*a,.26*a,36),v,[0,.13*a,0]),O(this.sph(.13*a,32,12,0,bt,0,Math.PI/2),v,[0,.26*a,0],null,[1,.7,1]),O(new H.CylinderGeometry(.205*a,.215*a,.05*a,36),j("felt",g),[0,.04*a,0]));for(let C=0;C<12;C++){let L=C/12*bt;_.add(O(this.sph(.025*a,10,8),j("felt",g),[Math.cos(L)*.53*a,0,Math.sin(L)*.53*a]))}return E(_,.05)}case"bucket":{let v=j("felt",u),_=he(O(new H.CylinderGeometry(.21*a,.26*a,.2*a,40),v,[0,.1*a,0]),O(this.sph(.21*a,40,10,0,bt,0,Math.PI/2),v,[0,.2*a,0],null,[1,.25,1]),O(new H.CylinderGeometry(.27*a,.37*a,.06*a,48),j("felt",Z(u,-.08)),[0,-.01*a,0]));return E(_,.08)}case"jester":{let v=he(b(new H.TorusGeometry(.24*a,.04*a,12,40).rotateX(Math.PI/2),Z(u,-.2),.6)),_=[u,g,u];return[-1,0,1].forEach((C,L)=>{let z=C?.42:.5,N=he(O(new H.ConeGeometry(.12*a,z*a,24),j("felt",_[L]),[0,z/2*a,0]));N.add(O(this.sph(.04*a,14,10),j("metal","#facc15"),[0,z*a,0])),N.position.set(C*.12*a,.02*a,0),N.rotation.z=-C*.95,v.add(N);let Q=L*1.7;this.anims.push(F=>{N.rotation.z=-C*.95+Math.sin(F*1.8+Q)*.06})}),E(v,.05)}case"beanie":case"santa":case"cap":case"hardhat":case"viking":case"beret":case"propeller":{let v=T(m==="beret"?.14:.24),_=this.sph(1,40,20,0,bt,0,Math.PI/2).scale(v.w*1.08,w.y-v.y+.05*a,v.d*1.1),C=he();if(m==="beanie"||m==="santa")C.add(b(_,u,.7)),C.add(b(this.sph(.09*a,20,14),m==="santa"?"#fafafa":g,1)),C.children[1].position.y=w.y-v.y+.08*a,m==="santa"&&C.add(b(this.tor(1,.12,12,40).rotateX(Math.PI/2).scale(v.w*1.08,a*.5,v.d*1.1),"#fafafa",.9));else if(m==="beret")C.add(O(_,j("felt",u),null,[0,0,-.25],[1.25,.45,1.2]));else{let L=m==="viking"?j("metal","#a3a3a3"):m==="cap"||m==="propeller"?j("felt",u):j("plastic",u);if(C.add(O(_,L)),m==="propeller"){let z=w.y-v.y+.05*a;C.add(O(this.sph(1,24,12,Math.PI/2-.35,.7,0,Math.PI/2).scale(v.w*1.085,z*1.005,v.d*1.105),j("felt",g))),C.add(O(new H.CylinderGeometry(.008*a,.008*a,.09*a,8),j("metal","#9ca3af"),[0,z+.04*a,0]));let N=he(O(this.sph(.02*a,12,8),j("plastic",g)));for(let[Q,F]of[[-1,"#ef4444"],[1,"#22c55e"]])N.add(O(this.sph(1,16,8),j("plastic",F),[Q*.085*a,0,0],[Q*.3,0,0],[.085*a,.008*a,.028*a]));N.position.y=z+.085*a,C.add(N),this.anims.push(Q=>{N.rotation.y=Q*5})}if(m==="cap"&&C.add(O(new H.CylinderGeometry(v.w*.75,v.w*.75,.02*a,32,1,!1,-Math.PI/2,Math.PI),j("felt",g==="#ffffff"?Z(u,-.2):g),[0,.01,v.d*.9],null,[1,1,.9])),m==="hardhat"&&C.add(O(new H.CylinderGeometry(v.w*1.25,v.w*1.25,.02*a,40),j("plastic",u),[0,0,.02])),m==="viking")for(let z of[-1,1])C.add(O(new H.ConeGeometry(.06*a,.3*a,16),j("plastic","#fef3c7"),[z*v.w*1.05,(w.y-v.y)*.5,0],[0,0,-z*1]))}return C.position.y=v.y,C}case"hair":{let v=this.sph(1,36,20).scale(.3*a,.17*a,.26*a),_=b(v,u,1.3);return _.position.set(0,w.y+.02*a,.04*a),_.rotation.x=.15,_}case"party":case"wizard":{let v=m==="party"?.42:.62,_=he(O(new H.ConeGeometry((m==="party"?.16:.27)*a,v*a,32),j(m==="party"?"plastic":"felt",u),[0,v/2*a,0]));return m==="party"&&_.add(b(this.sph(.06*a,16,10),g,1)),m==="party"&&(_.children[1].position.y=v*a),m==="wizard"&&_.add(O(new H.CylinderGeometry(.42*a,.42*a,.02*a,40),j("felt",u))),_.rotation.z=-.15,E(_,.04)}case"cowboy":{let v=he(O(this.sph(1,40,10,0,bt,Math.PI*.35,Math.PI*.3),j("felt",u),[0,.05*a,0],null,[.55*a,.12*a,.45*a]),O(new H.CapsuleGeometry(.2*a,.1*a,6,24),j("felt",u),[0,.15*a,0],null,[1,1,.8]),O(new H.CylinderGeometry(.205*a,.205*a,.04*a,32),j("felt",Z(u,-.35)),[0,.1*a,0]));return E(v,.05)}case"chef":{let v=he(O(new H.CylinderGeometry(.2*a,.2*a,.14*a,32),j("felt","#fafafa")));for(let[_,C,L,z]of[[0,.2,0,.17],[-.13,.15,0,.12],[.13,.15,0,.12],[0,.15,.1,.12]])v.add(O(this.sph(z*a,20,14),j("felt","#fafafa"),[_*a,C*a,L*a]));return E(v,.04)}case"grad":{let v=he(O(new H.CylinderGeometry(.17*a,.19*a,.1*a,32),j("felt",u)),O(new H.BoxGeometry(.46*a,.025*a,.46*a),j("felt",u),[0,.06*a,0],[0,Math.PI/4,0]),O(new H.CylinderGeometry(.008*a,.008*a,.16*a,6),j("felt",g==="#ffffff"?"#facc15":g),[.2*a,-.01*a,0]));return E(v,.03)}case"bow":case"flower":{let v=he();if(m==="bow"){for(let _ of[-1,1])v.add(O(new H.ConeGeometry(.08*a,.15*a,20),j("plastic",u),[_*.08*a,0,0],[0,0,_*Math.PI/2],[1,1,.5]));v.add(O(this.sph(.04*a,16,10),j("plastic",u)))}else{for(let _=0;_<5;_++){let C=_/5*bt;v.add(O(this.sph(.055*a,16,10),j("felt",u),[Math.cos(C)*.06*a,Math.sin(C)*.06*a,0],null,[1,1,.4]))}v.add(O(this.sph(.04*a,16,10),j("felt","#facc15"),[0,0,.01*a]))}return v.position.set(.14*a,w.y-.02*a,.06*a),v.rotation.z=-.3,v}case"halo":{let v=O(this.tor(.22*a,.025*a,12,48),j("emissive",u),null,[Math.PI/2,0,0]);return v.position.y=w.y+.14*a,v}case"horns":case"catears":case"bunny":case"antenna":case"sprout":{for(let v of m==="sprout"?[0]:[-1,1]){let _=he();if(m==="horns"&&_.add(O(new H.ConeGeometry(.06*a,.22*a,20),j("gloss",u),[0,.09*a,0])),m==="catears"&&_.add(b(new H.ConeGeometry(.12*a,.22*a,24).scale(1,1,.45).translate(0,.09*a,0),u,.8)),m==="bunny"&&(_.add(b(this.sph(1,24,16).scale(.08*a,.26*a,.05*a).translate(0,.22*a,0),u,.8)),_.add(O(this.sph(1,20,12),j("felt",g),[0,.22*a,.035*a],null,[.045*a,.18*a,.02*a]))),m==="antenna"&&(_.add(O(new H.CylinderGeometry(.01*a,.01*a,.22*a,8),j("plastic",u),[0,.11*a,0])),_.add(O(this.sph(.045*a,16,10),j("emissive",g),[0,.23*a,0]))),m==="sprout"){_.add(O(new H.CylinderGeometry(.012*a,.015*a,.16*a,8),j("plastic","#16a34a"),[0,.08*a,0]));for(let z of[-1,1])_.add(O(this.sph(1,16,10),j("plastic",u),[z*.07*a,.17*a,0],[0,0,z*.5],[.08*a,.035*a,.02*a]))}let C=v*(m==="antenna"?.12:.22)*a,L=s.top(C,0).p;_.position.set(C,L.y-.03*a,0),_.rotation.z=-v*(m==="bunny"?.15:m==="catears"?.3:.35),x.add(_)}return x}case"headphones":case"headband":case"bandana":{let v=m==="bandana"?w.y-.12*a:n+(m==="headband"?l*2.2:0),_=s.section(v);if(m==="headphones"){let C=_.w+.04*a;x.add(O(this.tor(C,.025*a,10,40,Math.PI),j("plastic",u),[0,v,0],null,[1,(w.y-v+.06*a)/C,1]));for(let L of[-1,1])x.add(O(new H.CylinderGeometry(.1*a,.1*a,.07*a,28),j("plastic",g),[L*C,v,0],[0,0,Math.PI/2]));return x}return x.add(O(this.tor(1,.05,10,48),j("felt",u),[0,v,0],[Math.PI/2,0,0],[_.w*1.04,_.d*1.06,a*.9])),x}case"glasses":case"square":case"nerd":case"sunglasses":case"aviator":case"heartglasses":case"starglasses":case"3d":case"monocle":case"goggles":case"visor":case"eyepatch":{let v=Math.max(...this.eyes.map(z=>z.root.position.z))+l*.55,_=l*(m==="nerd"?1.7:1.5),C=m==="monocle"?[1]:m==="eyepatch"?[-1]:[-1,1],L=j(m==="3d"?"plastic":"gloss",u);for(let z of C){let N=z*c.sp*Ae;if(m==="eyepatch"){x.add(O(this.sph(_*.9,24,12),j("felt",u),[N,n,v-_*.5],null,[1,.85,.35]));continue}if(m==="visor")continue;let Q=m==="square"||m==="nerd"||m==="3d",F=this.tor(_,_*.13,8,Q?4:32);x.add(O(F,L,[N,n,v],[0,0,Q?Math.PI/4:0],Q?[1.15,.85,1]:[1,1,1]));let A=m==="sunglasses"||m==="aviator"?"#0f172a":m==="goggles"?g:m==="3d"?z<0?"#ef4444":"#22d3ee":m==="heartglasses"?"#f9a8d4":m==="starglasses"?"#fde68a":null;if(A){let B=O(new H.CircleGeometry(_,Q?4:32),new H.MeshPhysicalMaterial({color:A,roughness:.05,clearcoat:1,transparent:!0,opacity:m==="sunglasses"?.92:.55}),[N,n,v-.002],[0,0,Q?Math.PI/4:0],Q?[1.15,.85,1]:[1,1,1]);x.add(B)}}if(m==="visor"&&x.add(O(new H.CapsuleGeometry(_*.8,c.sp*Ae*2.2,6,16),new H.MeshPhysicalMaterial({color:u,roughness:.05,clearcoat:1,transparent:!0,opacity:.75}),[0,n,v],[0,0,Math.PI/2],[1,1,.3])),C.length===2&&m!=="visor"&&x.add(O(new H.CylinderGeometry(_*.1,_*.1,c.sp*Ae*2-_*2,8),L,[0,n+_*.15,v],[0,0,Math.PI/2])),m==="eyepatch"){let z=s.section(n+l);x.add(O(this.tor(1,.02,6,48),j("felt",u),[0,n+l*.4,0],[Math.PI/2,-.35,0],[z.w*1.03,z.d*1.05,a]))}return x}case"mustache":case"handlebar":case"beard":case"wizardbeard":case"goatee":{let v=h(c.mouthY),_=s.front(0,v);if(m==="mustache"||m==="handlebar"){let N=he();for(let Q of[-1,1])N.add(b(this.sph(1,20,12).scale(.1*a,.04*a,.04*a).rotateZ(Q*(m==="handlebar"?-.4:.25)).translate(Q*.085*a,0,0),u,.6));return N.position.copy(_.p).add(new H.Vector3(0,c.mw*Ae*.5,this.furLen*.6)),N}let C=m==="wizardbeard"?1.8:m==="goatee"?.6:1,L=m==="goatee"?.08:.3,z=b(this.sph(1,28,18).scale(L*a,.16*C*a,.12*a),u,1.1);return z.position.set(0,v-.1*C*a,_.p.z-.04*a),z}case"clownnose":case"nose":case"pignose":{let v=h(c.anchors.nose.y),_=s.front(0,v),C=he();if(m==="clownnose")C.add(O(this.sph(.075*a,24,16),j("gloss",u)));else if(m==="nose")C.add(O(this.sph(.035*a,20,12),j("gloss",u),null,null,[1.3,.9,.8]));else{C.add(O(new H.CylinderGeometry(.08*a,.08*a,.05*a,28),j("felt",u),null,[Math.PI/2,0,0],[1,1,.75]));for(let L of[-1,1])C.add(O(this.sph(.018*a,12,8),j("matte",Z(u,-.5)),[L*.03*a,0,.026*a]))}return C.position.copy(_.p).addScaledVector(_.n,this.furLen*.6+.02*a),C}case"bowtie":case"tie":case"medal":case"bell":case"scarf":case"pearls":case"ruff":{let v=h(c.anchors.neck.y),_=s.section(v),C=_.z+this.furLen*.6;if(m==="scarf"||m==="ruff")return x.add(b(this.tor(1,.1,14,48).rotateX(Math.PI/2).scale(_.w*1.05,a*(m==="ruff"?.9:.75),_.d*1.08),u,.9)),m==="scarf"&&x.add(b(new H.BoxGeometry(.1*a,.26*a,.04*a,2,6,2).translate(.12*a,-.12*a,C+.02*a),u,.9)),x.position.y=v,x;if(m==="pearls"){for(let z=0;z<=12;z++){let N=Math.PI*(z/12);x.add(O(this.sph(.025*a,12,8),j("gloss",u),[Math.cos(N)*_.w*1.02,v-Math.sin(N)*.03*a,Math.sin(N)*_.d*1.05]))}return x}let L=he();if(m==="bowtie"){for(let z of[-1,1])L.add(O(new H.ConeGeometry(.07*a,.14*a,20),j("felt",u),[z*.065*a,0,0],[0,0,z*Math.PI/2],[1,1,.5]));L.add(O(this.sph(.035*a,16,10),j("felt",Z(u,-.2))))}else m==="tie"?(L.add(O(this.sph(.035*a,16,10),j("felt",Z(u,-.2)))),L.add(O(new H.ConeGeometry(.06*a,.3*a,4),j("felt",u),[0,-.17*a,0],[Math.PI,Math.PI/4,0],[1,1,.35]))):m==="medal"?(L.add(O(new H.CylinderGeometry(.06*a,.06*a,.015*a,32),j("metal",u),[0,-.08*a,0],[Math.PI/2,0,0])),L.add(O(new H.BoxGeometry(.04*a,.1*a,.005*a),j("felt",g),[0,-.02*a,0]))):(L.add(O(this.sph(.06*a,20,14),j("metal",u),[0,-.05*a,0])),x.add(O(this.tor(1,.045,10,48),j("felt",g),[0,v,0],[Math.PI/2,0,0],[_.w*1.03,_.d*1.05,a])));return L.position.set(0,v,C),x.add(L),x}case"cape":case"superhero":{let v=s.section(r*.5),_=new H.CylinderGeometry(v.w*1.02,v.w*1.35,r*.75,32,1,!0,Math.PI/2+.35,Math.PI-.7);_.scale(1,1,v.d/v.w*1.1);let C=new H.MeshPhysicalMaterial({color:u,roughness:.6,sheen:.6,side:H.DoubleSide});return x.add(O(_,C,[0,r*.4,0])),x}case"wings":case"batwings":{let v=s.section(r*.5);for(let _ of[-1,1]){let C=he(O(this.sph(1,24,12),m==="wings"?j("felt",u):j("plastic",u),[_*.2*a,.08*a,0],null,[.24*a,.15*a,.03*a]));C.position.set(_*v.w*.5,r*.55,-v.d*.85),C.rotation.set(0,_*.5,_*.35),x.add(C)}return x}case"tail":{let v=new H.CatmullRomCurve3([new H.Vector3(0,.12*a,-.1),new H.Vector3(.12*a,.1*a,-.45*a),new H.Vector3(.25*a,.32*a,-.5*a)]);return x.add(O(new H.TubeGeometry(v,24,.02*a,8),j("gloss",u))),x.add(O(new H.ConeGeometry(.06*a,.1*a,4),j("gloss",u),[.25*a,.36*a,-.5*a],null,[1,1,.4])),x}case"jetpack":{let v=s.section(r*.5);for(let _ of[-1,1])x.add(O(new H.CapsuleGeometry(.07*a,.22*a,6,16),j("metal",u),[_*.09*a,r*.5,-v.d-.04*a])),x.add(O(new H.ConeGeometry(.05*a,.14*a,16),j("emissive","#f97316"),[_*.09*a,r*.5-.22*a,-v.d-.04*a],[Math.PI,0,0]));return x}case"pirate":{let v=T(.2),_=w.y-v.y+.06*a,C=j("felt",u),L=he(O(this.sph(1,32,16,0,bt,0,Math.PI/2),C,null,null,[v.w*.95,_*1.1,v.d]));for(let Q=0;Q<3;Q++){let F=he(O(this.sph(1,24,10),C,[0,0,v.d*.85],[-.75,0,0],[v.w*.95,.1*a,.07*a]));F.rotation.y=Q/3*bt,F.position.y=_*.12,L.add(F)}let z=j("felt",g),N=he(O(this.sph(.045*a,16,10),z));for(let Q of[.7,-.7])N.add(O(new H.CapsuleGeometry(.012*a,.11*a,3,6),z,[0,0,-.01*a],[0,0,Q]));for(let Q of[-1,1])N.add(O(this.sph(.011*a,8,6),j("matte","#111827"),[Q*.016*a,.005*a,.04*a]));return N.position.set(0,_*.5,v.d*.97),N.rotation.x=-.3,L.add(N),L.position.y=v.y,L}case"pipe":case"lollipop":{let v=h(c.mouthY),_=s.front(c.mw*Ae*.5,v).p,C=he();C.position.copy(_),C.position.z+=this.furLen*.5;let L=(N,Q,F,A)=>{let B=Q.clone().sub(N),W=O(new H.CylinderGeometry(F,F,B.length(),8),A);return W.position.copy(N).addScaledVector(B,.5),W.quaternion.setFromUnitVectors(new H.Vector3(0,1,0),B.normalize()),W},z=(N,Q,F)=>new H.Vector3(N*p,Q*p,F*p);if(m==="pipe"){C.add(L(z(0,0,0),z(22,-10,14),2*p,j("gloss","#1f2937")));let N=z(26,-16,16);C.add(O(new H.CylinderGeometry(8*p,7*p,16*p,20),j("gloss",u),N.toArray())),C.add(O(new H.CircleGeometry(6.5*p,16),j("matte","#292524"),[N.x,N.y+8.05*p,N.z],[-Math.PI/2,0,0]));let Q=[0,1,2].map(()=>O(this.sph(1,10,8),j("felt","#d6d3d1")));C.add(...Q),this.anims.push(F=>Q.forEach((A,B)=>{let W=(F*.5+B/3)%1;A.position.set(N.x+Math.sin(W*7+B)*4*p,N.y+(10+W*40)*p,N.z),A.scale.setScalar(Math.max(1e-4,(2+W*5)*p*Math.sin(Math.PI*W)))}))}else{C.add(L(z(0,0,0),z(26,10,10),1.6*p,j("plastic","#fafafa")));let N=he(O(new H.CylinderGeometry(11*p,11*p,4*p,28),j("gloss",u),null,[Math.PI/2,0,0])),Q=[];for(let F=0;F<=30;F++){let A=F/30*Math.PI*4,B=(1+8*(F/30))*p;Q.push(new H.Vector3(Math.cos(A)*B,Math.sin(A)*B,2.2*p))}N.add(O(new H.TubeGeometry(new H.CatmullRomCurve3(Q),48,1*p,5),j("plastic","#ffffff"))),N.position.copy(z(31,13,12)),C.add(N)}return C}case"bandaid":case"ninjamask":case"facemask":{let v=this.depth,_=this.furLen*1.02+.004*a,C=(L,z,N,Q=0,F=0)=>{let A=new H.Mesh(this.B.geometry,$n(d.uniforms,{color:L,off:_+F,box:z,kind:N,round:Q}));return A.userData.ownMaterial=!0,A.userData.noBounds=!0,this.bodyMeshes.push(A),A};if(m==="bandaid"){let L=c.sp*Ae+l*.4,z=n-l*2.4;x.add(C(u,{c:[L,z,v],h:[12*p,4.5*p,v],rot:30*Mo},"plastic",4.4*p)),x.add(C(Z(u,-.1),{c:[L,z,v],h:[4*p,4.6*p,v],rot:30*Mo},"plastic",0,.002*a))}else if(m==="ninjamask"){let L=n-l*1.6;x.add(C(u,{c:[0,L/2,0],h:[9,L/2,9],rot:0},"felt")),this.hideMouth=!0}else{let L=h(c.mouthY),z=c.mw*Ae;x.add(C(u,{c:[0,L-5*p,v],h:[z+12*p,17*p,v],rot:0},"felt",8*p)),this.hideMouth=!0}return x.userData.surface=!0,x}case"scar":{let v=-c.sp*Ae,_=this.furLen*.9+.004*a,C=(N,Q)=>{let F=s.front(N,Q);return F.p.clone().addScaledVector(F.n,_)},L=[];for(let N=0;N<=8;N++){let Q=N/8;L.push(C(v+de(-6,6,Q)*p,n+l*de(2.6,-2.4,Q)))}let z=j("felt",u);x.add(O(new H.TubeGeometry(new H.CatmullRomCurve3(L),16,1.4*p,5),z));for(let N of[-8,0,8]){let Q=n-N*p,F=v+-N/8*2*p;x.add(O(new H.TubeGeometry(new H.LineCurve3(C(F-4*p,Q),C(F+4*p,Q)),2,1.1*p,5),z))}return x.userData.surface=!0,x}case"parrot":{let v=f(c.anchors.shoulder.x),_=s.top(v,0).p,C=he(),L=a*1.1;C.add(O(this.sph(1,20,14),j("felt",u),[0,.09*L,0],[.2,0,0],[.065*L,.1*L,.065*L])),C.add(O(this.sph(.055*L,18,12),j("felt",u),[0,.2*L,.015*L])),C.add(O(new H.ConeGeometry(.03*L,.07*L,10),j("felt",g),[0,.265*L,-.01*L],[-.4,0,0])),C.add(O(new H.ConeGeometry(.02*L,.05*L,10),j("gloss","#facc15"),[0,.19*L,.07*L],[Math.PI/2+.5,0,0]));for(let Q of[-1,1])C.add(O(this.sph(.011*L,8,6),j("gloss","#111111"),[Q*.035*L,.21*L,.04*L]));C.add(O(new H.CapsuleGeometry(.018*L,.12*L,3,8),j("felt","#2563eb"),[0,.02*L,-.06*L],[-.9,0,0]));for(let Q of[-1,1])C.add(O(this.sph(1,14,10),j("felt",Z(u,-.2)),[Q*.06*L,.1*L,-.005*L],[.2,0,Q*.15],[.02*L,.07*L,.05*L]));let z=_.y-.01*a;C.position.set(v,z,0),C.rotation.y=-.4;let N=Math.random()*bt;return this.anims.push(Q=>{C.rotation.x=Math.sin(Q*2.2+N)*.08,C.position.y=z+Math.max(0,Math.sin(Q*1.3+N))*.01*a}),he(C)}case"sparkles":case"hearts":case"zzz":{let v=m==="sparkles"?[[-.75,-.55,9],[.8,-.35,7],[.7,.55,6],[-.8,.35,5]].map(([L,z,N])=>[L*i*.62,r*.5-z*r*.55,N*1.3]):m==="hearts"?[[-40,-10,7],[36,-18,9],[8,-34,6]].map(([L,z,N])=>[L*p,w.y-z*p,N]):[[30,-10,9],[46,-26,6.5],[58,-38,5]].map(([L,z,N])=>[L*p,w.y-z*p,N]),_=j("gloss",m==="hearts"?"#f43f5e":u),C=v.map(([L,z,N],Q)=>{let F=O(Ds(m==="sparkles"?"star":m==="hearts"?"heart":"z"),_,[L,z,this.depth*.5]);return F.scale.setScalar(N*p),F.userData.r=N*p,F.userData.i=Q,F});return x.add(...C),this.anims.push(L=>C.forEach(z=>{let N=z.userData.i;m==="sparkles"?(z.scale.setScalar(z.userData.r*(.7+.3*Math.sin(L*3+N*1.7))),z.rotation.z=L*.6+N):z.rotation.y=Math.sin(L*1.5+N)*.4})),x}case"sweat":{let v=s.front(c.sp*Ae+l*2.4,n+l*2.4),_=O(Ds("drop"),j("gloss",u),null,[0,0,-.15]);return _.scale.setScalar(7*p),_.position.copy(v.p).addScaledVector(v.n,this.furLen+6*p),x.add(_),x}case"helmet":{let v=Math.max(i,r)*.62,_=O(this.sph(v,48,32),j("glass",u),[0,r*.5,0]);return _.renderOrder=2,_.userData.noBounds=!0,x.add(_),x.add(O(this.tor(v*.78,.035*a,10,48),j("metal",g),[0,r*.5-v*.62,0],[Math.PI/2,0,0])),x}default:return this.spec._modParts?.[m]?this.buildModPart(this.spec._modParts[m],t,o):null}}buildModPart(t,o,a){let{L:s,X:r,Y:i,probe:n}=a,l=s.anchors[t.anchor]||s.anchors.center,h=s.box.w/120*Ae,f=r(l.x),c=i(l.y),d=t.depth==="center"?0:(n.front(f,c)?.p.z??0)+this.furLen,p=he();p.position.set(f,c,d),p.userData.pivot=p.position.clone();let u=()=>this.modPlane(t,o,h);if(!t.glb)return p.add(u()),p;let g=he();g.scale.setScalar(h),p.add(g);let m=t.tint==="body"?this.spec.body.color:t.tint==="color"?o.color:"",w=Vf(t.glb).then(k=>{let b=k.clone(!0);b.traverse(x=>{x.isMesh&&(x.geometry.userData.shared=!0,m&&(x.material=x.material.clone(),x.material.color?.set(m),x.userData.ownMaterial=!0))}),g.add(b)}).catch(()=>p.add(u()));return this.pending.push(w),p}modPlane(t,o,a){let[s,r,i,n]=t.view,l=Ts(this.spec,o.id,Z),h=l?l.draw({k:1,color:o.color,color2:o.color2,body:this.spec.body.color}):"",f=256/Math.max(i,n),c=document.createElement("canvas");c.width=Math.max(2,Math.round(i*f)),c.height=Math.max(2,Math.round(n*f));let d=new H.CanvasTexture(c);d.colorSpace=H.SRGBColorSpace;let p=new Image;p.onload=()=>{c.getContext("2d").drawImage(p,0,0,c.width,c.height),d.needsUpdate=!0};let u=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${s} ${r} ${i} ${n}" width="${c.width}" height="${c.height}">${h}</svg>`;p.src=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(u)}`;let g=new H.Mesh(new H.PlaneGeometry(i*a,n*a),new H.MeshBasicMaterial({map:d,transparent:!0,depthWrite:!1,side:H.DoubleSide}));return g.position.set((s+i/2)*a,-(r+n/2)*a,t.layer==="back"?-.01:.01),g.userData.ownMaterial=!0,g.userData.modPlane={svg:u,w:c.width,h:c.height},g}disposeRig(){this.rig.traverse(t=>{t.isMesh&&(t.geometry.userData.shared||t.geometry.dispose(),t.userData.ownMaterial&&t.material.dispose())}),this.model?.mixer?.stopAllAction(),this.model=null,this.rig.clear(),this.shadow&&(this.shadow.material.dispose(),this.shadow.geometry.dispose(),this.root.remove(this.shadow),this.shadow=null)}blinkValue(t){let o=t-this.blinkAt;return o<0||o>=180?0:o<70?xe.in(o/70)**.5:1-xe.out((o-70)/110)}tick(t,o){if(this.modelMode)return this.tickModel(t,o);let a=Qf(),s=this.opts.idle!==!1;if(s&&t>=this.nextBlink){if(this.moodName!=="sleep"&&!a&&(this.blinkAt=t,Math.random()<.2&&(this.nextDouble=t+240),t-this.look.at>3e3&&Math.random()<.45)){let Y=Math.abs(this.look.tx)+Math.abs(this.look.ty)>.1&&Math.random()<.6;this.look.tx=Y?0:(Math.random()-.5)*.9,this.look.ty=Y?0:(Math.random()-.5)*.5}this.nextBlink=t+1800+Math.random()*3600}this.nextDouble&&t>=this.nextDouble&&(this.blinkAt=t,this.nextDouble=0),this.speech&&!this.speech.tick(t)&&this.endSpeech();let r=this.mo;r.open=Ie(r.open,r.target,o,r.target>r.open?35:70),r.msx=Ie(r.msx,r.tmsx,o,60);let i=this.look;i.x=a?i.tx:Ie(i.x,i.tx,o,70),i.y=a?i.ty:Ie(i.y,i.ty,o,70);let n=qc(this.moodName);for(let Y in Dc)this.mv[Y]=a?n[Y]:Ie(this.mv[Y],n[Y],o,90);this.sleepK=Ie(this.sleepK,this.moodName==="sleep"?1:0,o,a?1:260);let l={x:0,y:0,r:0,sx:1,sy:1,lx:0,ly:0,blink:0,eye:1,lift:0,open:0,curve:0,msx:1},h=0,f=this.gest;if(f){let Y=t-f.start,$e=U(Y/f.ms);Object.assign(l,f.def.pose($e,a?0:Y,f)),f.dir<0&&(l.x=-l.x,l.r=-l.r,l.lx=-l.lx),f.name==="spin"&&(h=xe.inOut(U(($e-.12)/.76))*bt,l.sx=1+(l.sy<1?(1-l.sy)*.6:0));for(let Oe of f.def.fx||[])$e>=Oe[0]&&!f.fired.has(Oe)&&(f.fired.add(Oe),this.effect(Oe[1],{dir:f.dir,...Oe[2]||{}}));$e>=1&&this.endGesture()}a&&Object.assign(l,{x:0,y:0,r:0,sx:1,sy:1});let{ksx:c,ksy:d,act:p}=this.tickMorphs(t,a);p.shape&&!p.shape.ready&&this.startShape(p.shape);let u=p.shape?.ready?p.shape.k:0;this.bodyU.uMorph.value.set(p.melt?.k||0,a?0:p.jelly?.k||0,u,0);let g=this.mv,m=this.W,w=this.H,k=this.kk,b=t/1e3,x=a||!s?0:Math.sin(b*bt/3.4+this.phase),E=r.open,T=l.sx*(1-.015*E)*(1-.006*x)*c,v=l.sy*(1+.03*E)*(1+.014*x)*d,_=this.rig;_.position.set(l.x*m,-l.y*w,0),_.rotation.set(i.y*.12,this.yaw+i.x*.35+h+(a||!s?0:Math.sin(b*.7+this.phase)*.04),-(l.r+i.x*2)*Mo),_.scale.set(T,v,T);let C=Math.max(0,-l.y);this.shadow.scale.set(m*1.55*(1-C*.9)*c,this.shadow.scale.y,1),this.shadow.material.opacity=1-C*1.5;for(let Y of this.parts)Y.o.position.copy(Y.p0).addScaledVector(Y.d,u);let L=Math.max(this.blinkValue(t),l.blink,this.sleepK>.02?Math.min(1,this.sleepK*1.1):0),z=this.sleepK>.85,N=U(i.x+l.lx,-1,1),Q=U(i.y+l.ly,-1,1),F=g.eye*l.eye;for(let Y of this.eyes){Y.main.visible=!z,Y.closed.visible=z,Y.gaze.rotation.set(Q*.4,N*.5,0);let $e=Y.noBlink?1:Math.max(.08,1-L);Y.main.scale.set(F,F*(g.squash||1)*$e,F)}for(let Y of this.brows)Y.g.position.y+=(g.lift+l.lift)*Ae+(g.eye*l.eye-1)*this.L.r*Ae*1.65,Y.g.rotation.z=-Y.side*g.tilt*14*Mo;let A=this.mouthRig,B=U(g.curve+l.curve+A.bias,-1,1),W=U(Math.max(r.open+l.open,g.open,A.min)),ae=r.msx*l.msx;if(A.g.scale.x=ae,A.line&&(A.line.morphTargetInfluences[0]=Math.max(0,B),A.line.morphTargetInfluences[1]=Math.max(0,-B),A.line.visible=W<=.12),A.cav){let Y=W>.12;if(A.cav.visible=Y,Y){let $e=A.mw*(.75+Math.max(0,B)*.15),Oe=A.mw*(.12+W*.75);A.cav.scale.set($e,Oe,A.mw*.18),A.cav.position.y=-Oe*.55+B*A.mw*.1}}if(A.round&&A.round.scale.setScalar(.85+W*.6),A.grit&&(A.grit.scale.y=1+W*1.6,A.grit.position.y=B*A.mw*.08),A.lips){let Y=W*A.mw*.45;A.lips.up.position.y=A.mw*.16+Y*.5+B*A.mw*.05,A.lips.lo.position.y=-A.mw*.14-Y*.5,A.lips.hole.scale.y=Math.max(.001,Y*.6)}let Me=this.mobj,te=p.spikes;if(te){let Y=Me.spikes||(Me.spikes=this.makeSpikes(te.o.color));Y.visible=!0;let $e=Y.userData.list;for(let Oe=0;Oe<$e.length;Oe++){let Ge=$e[Oe],qe=Math.max(1e-4,xe.backOut(U(te.k*1.5-Ge.ord*.07))*(te.phase==="out"?te.k:1));Ur.position.copy(Ge.p),Ur.quaternion.copy(Ge.q),Ur.scale.set(qe,qe,qe),Ur.updateMatrix(),Y.setMatrixAt(Oe,Ur.matrix)}Y.instanceMatrix.needsUpdate=!0}else Me.spikes&&(Me.spikes.visible=!1);let ue=p.horns;if(ue){let Y=Me.horns||(Me.horns=this.makeHorns(ue.o.color));Y.visible=!0;for(let $e of Y.children)$e.scale.setScalar(Math.max(1e-4,ue.k))}else Me.horns&&(Me.horns.visible=!1);let be=p.wings;if(be){let Y=Me.wings||(Me.wings=this.makeWings(be.o.color));Y.visible=!0;let $e=be.o.flap==="fast",Oe=a?0:Math.sin((t-be.start)/1e3*bt*($e?3.2:.9))*($e?32:11)*Mo;for(let Ge of Y.children){let qe=Ge.userData.side;Ge.rotation.set(0,qe*(.55-Oe),qe*.25),Ge.scale.setScalar(Math.max(1e-4,be.k))}}else Me.wings&&(Me.wings.visible=!1);let fe=p.hands;for(let Y=0;Y<2;Y++){let $e=this.hands[Y];if($e.visible=!!fe,!fe){$e.userData.on=!1;continue}let Oe=Y?1:-1,Ge=this.L,qe=this.handCtx||(this.handCtx={cx:Ge.cx,W:Ge.box.w,H:Ge.box.h,mid:Ge.box.y+Ge.box.h*.55,mouthY:Ge.mouthY,mw:Ge.mw,sp:Ge.sp,eyeY:Ge.eyeY,pts:Ge.pts}),Ze=(ga[fe.o.pose]||ga.rest)(Oe,a?0:t-fe.start,fe.o.dir||1,qe),lo=this.X(Ze.x??qe.cx+Oe*Ze.u*qe.W*.5),We=this.Y(Ze.y??qe.mid+Ze.v*qe.H*.5),st=this.frontZ(lo,We),Ne=st==null?this.depth*.15:st+.06*k+this.furLen,Gt=-Oe*(Ze.ang||0)*Mo;!$e.userData.on||a?($e.position.set(lo,We,Ne),$e.rotation.z=Gt,$e.userData.on=!0):($e.position.set(Ie($e.position.x,lo,o,70),Ie($e.position.y,We,o,70),Ie($e.position.z,Ne,o,70)),$e.rotation.z=Ie($e.rotation.z,Gt,o,70));let co=Ze.type||"open",Co=$e.userData.finger;Co.visible=co==="point"||co==="thumb"||co==="thumbdown",Co.rotation.z=co==="thumbdown"?Math.PI:0,$e.scale.setScalar(Math.max(.01,fe.k*(Ze.s||1))*(co==="open"?1:.9))}let Fe=this.tickEffects(t,a);this.bodyU.uBlush.value=Fe,this.fxg.position.copy(_.position),this.fxg.rotation.y=this.yaw;for(let Y of this.furs)Y.u.uTime.value=b;this.bodyU.uTime.value=b;for(let Y of this.anims)Y(a?0:b)}tickMorphs(t,o){let a=1,s=1,r={};for(let[i,n]of this.morphs){if(n.phase!=="out"&&t>=n.until&&(n.phase="out",n.outAt=t,n.k0=n.k),n.phase==="in"){let h=U((t-n.start)/Nc);n.k=o?1:n.shape?xe.inOut(h):xe.backOut(h),h>=1&&(n.phase="on")}else if(n.phase==="on")n.k=1;else{let h=U((t-n.outAt)/Yr);if(n.k=o?0:n.k0*(1-xe.inOut(h)),h>=1){this.morphs.delete(i),this.endMorph(i);continue}}r[i]=n;let l=Df[i];if(l){let[h,f]=l(n.k);a*=h,s*=f}}return{ksx:a,ksy:s,act:r}}tickEffects(t,o){let a=0;if(this.fxs.length){let s=this.fxc;this.fxs=this.fxs.filter(r=>{let i=t-r.start,n=1,l;if(r.loop)!r.hold&&i>=r.ms&&r.end==null&&(r.end=t),l=o?.3:i%r.cycle/r.cycle;else{if(i>=r.ms)return $r(r.obj),!1;l=o?.5:i/r.ms}return r.end!=null&&(n=1-U((t-r.end)/Bf),n<=0)?($r(r.obj),!1):(r.def.draw(s,r,l,o?0:i,n,Go(r.seed)),r.blush&&(a=Math.max(a,r.blush)),!0)})}return a}makeSpikes(t){let o=this.L,a=[],s=new H.Vector3(0,1,0),r=new H.Vector3(0,this.H*.5,0);o.pts.forEach(([l,h],f)=>{if(f>=6&&f<=10)return;let c=new H.Vector3(this.X(l),this.Y(h),0),d=c.clone().sub(r).normalize();c.addScaledVector(d,-.02*this.kk),a.push({p:c,q:new H.Quaternion().setFromUnitVectors(s,d),ord:Math.min(f,16-f)})});for(let l of[.82,.62,.42]){let h=this.H*l,f=this.probe.section(h);a.push({p:new H.Vector3(0,h,-f.d*.9),q:new H.Quaternion().setFromUnitVectors(s,new H.Vector3(0,.4,-1).normalize()),ord:3+a.length*.1})}let i=new H.ConeGeometry(.05*this.kk,.16*this.kk,Math.max(6,Math.round(12*this.q))).translate(0,.08*this.kk,0),n=new H.InstancedMesh(i,j(this.plush?"felt":"gloss",t||Z(this.spec.body.color,-.12)),a.length);return n.instanceMatrix.setUsage(H.DynamicDrawUsage),n.frustumCulled=!1,n.userData.list=a,n.userData.noBounds=!0,this.rig.add(n),n}makeHorns(t){let o=this.L,a=he(),s=j("gloss",t||"#f5f0e6");for(let r of[1,15]){let[i,n]=o.pts[r],l=i>o.cx?1:-1,h=he(O(new H.ConeGeometry(.06*this.kk,.24*this.kk,16).translate(0,.12*this.kk,0),s));h.children[0].rotation.z=-l*.25;let f=this.X(i)*.8;h.position.set(f,this.probe.top(f,0).p.y-.04*this.kk,0),h.rotation.z=-l*.45,a.add(h)}return a.userData.noBounds=!0,this.rig.add(a),a}makeWings(t){let o=he(),a=this.kk,s=this.probe.section(this.H*.6),r=j(this.plush?"felt":"plastic",t||"#ffffff");for(let i of[-1,1]){let n=he();for(let l=0;l<3;l++){let h=O(this.sph(1,20,12),r,[i*(.16+l*.05)*a,(.1-l*.07)*a,0],[0,0,i*(.5-l*.35)],[(.2-l*.03)*a,.07*a,.025*a]);n.add(h)}n.position.set(i*s.w*.45,this.H*.62,-s.d*.7),n.userData.side=i,o.add(n)}return o.userData.noBounds=!0,this.rig.add(o),o}startShape(t){t.ready=!0;let o=t.target,a=ro(this.spec,o),s=hn(o,a.box,this.quality),r=s.geometry.attributes;if(r.position.count!==this.B.geometry.attributes.position.count)return;let i=this.shapeGeo;if(!i){i=this.shapeGeo=this.B.geometry.clone(),i.userData={};for(let f of this.bodyMeshes)f.geometry=i}i.setAttribute("aShape",r.position.clone()),i.setAttribute("aShapeN",r.normal.clone());let n=a.box.w*Ae/this.W,l=a.box.h*Ae/this.H,h=fn(s.geometry);for(let f of this.parts){let{x:c,y:d}=f.p0,p=c*n,u=d*l;f.d.set(p-c,u-d,f.face?h.front(p,u).p.z-this.probe.front(c,d).p.z:0)}}endMorph(t){if(t==="shape"&&this.B){for(let o of this.bodyMeshes)o.geometry=this.B.geometry;this.shapeGeo?.dispose(),this.shapeGeo=null;for(let o of this.parts)o.d.set(0,0,0),o.o.position.copy(o.p0)}t==="hands"&&(this.handCtx=null)}clearMorphObjects(){this.shapeGeo&&(this.shapeGeo.dispose(),this.shapeGeo=null),this.mobj={},this.handCtx=null;for(let t of this.morphs.values())t.ready=!1}lod(t){this.plush&&this.setShells(U(t/(this.quality==="high"?14:20),3,this.maxShells))}mood(t,o={}){if(!Fs[t])return!1;if(t===this.moodName)return!0;if(this.moodName=t,this.clearEffects("mood"),this.opts.moodFx!==!1&&o.fx!==!1)for(let[a,s]of Gf[t]||[])this.effect(a,s||{});return!0}endGesture(){let t=this.gest;if(!t)return;this.gest=null;let o=this.morphs.get("hands");t.def.hands&&o&&!o.byGesture&&o.userPose!==void 0&&(o.o.pose=o.userPose);let a=this.morphs.get("wings");t.def.wings&&a&&!a.byGesture&&(a.o.flap=a.userFlap)}gesture(t,o={}){let a=Object.hasOwn(Ft,t)?t:za[t];if(!a)return!1;typeof o=="number"&&(o={ms:o});let s=Ft[a],r=Io(),i=U(Number(o.ms)||s.ms,200,6e4),n=o.dir===-1||o.mirror===!0?-1:1;this.gest&&this.endGesture(),this.gest={name:a,def:s,start:r,ms:i,dir:n,fired:new Set};let l=this.morphs.get("hands");s.hands?l&&l.phase!=="out"?(l.o.pose=s.hands,l.o.dir=n,l.byGesture&&(l.until=r+i-Yr)):this.morph("hands",{pose:s.hands,dir:n,ms:i-Yr,byGesture:!0}):l?.byGesture&&l.phase!=="out"&&(l.until=r);let h=this.morphs.get("wings");return s.wings?h&&h.phase!=="out"?(h.o.flap=s.wings,h.byGesture&&(h.until=r+i-Yr)):this.morph("wings",{flap:s.wings,ms:i-Yr,byGesture:!0}):h?.byGesture&&h.phase!=="out"&&(h.until=r),!0}morph(t,o={}){if(typeof t!="string")return!1;if(o===!1)return this.unmorph(t);if(typeof o=="number"&&(o={ms:o}),!Object.hasOwn(xo,t)&&Object.hasOwn(Qs,t))return this.effect(t,o);let a=t,s=null;if(t.startsWith("shape:")){if(s=As(t.slice(6)),!s)return!1;a="shape"}else if(!Object.hasOwn(xo,t))return!1;let r=Io(),n=o.hold===!0||o.ms===1/0?1/0:U(Number(o.ms)||Nf,200,6e5),l=!o.byGesture,h=/^#[0-9a-f]{6}$/i.test(o.color||"")?o.color:void 0,f=this.morphs.get(a);if(f)f.phase==="out"&&(f.phase="in",f.start=r-Nc*U(f.k)),f.until=Math.max(l?0:f.until,r+n),l&&(f.byGesture=!1),a==="shape"&&f.target!==s&&(f.target=s,f.ready=!1),o.pose&&(f.o.pose=o.pose),o.dir&&(f.o.dir=o.dir),o.flap&&(f.o.flap=o.flap),l&&(f.userPose=f.o.pose,f.userFlap=f.o.flap);else{let c={pose:t==="hands"?o.pose||"rest":void 0,dir:o.dir===-1?-1:1,flap:o.flap,color:h};this.morphs.set(a,{name:a,start:r,until:r+n,phase:"in",k:0,o:c,target:s,shape:a==="shape",ready:!1,byGesture:!l,userPose:l?c.pose:void 0,userFlap:l?c.flap:void 0})}return!0}unmorph(t){let o=Io(),a=typeof t=="string"&&t.startsWith("shape")?"shape":t;for(let[s,r]of this.morphs)a&&s!==a||r.phase!=="out"&&(r.phase="out",r.outAt=o,r.k0=r.k);return!0}effect(t,o={}){if(typeof t!="string")return!1;if(typeof o=="number"&&(o={ms:o}),Object.hasOwn(xo,t)||t.startsWith("shape:"))return this.morph(t,o);if(!Object.hasOwn(Qs,t))return!1;let a=Qs[t],s={name:t,def:a,start:Io(),ms:U(Number(o.ms)||(a.loop?a.ms*1.5:a.ms),100,6e5),cycle:a.ms,loop:!!a.loop||o.hold===!0,hold:o.hold===!0,dir:o.dir===-1?-1:1,o,tag:o.tag,seed:++this.fxSeq*7919^Math.floor(this.phase*1e4),end:null,obj:null},r=a.make(this.fxc,s);return r&&(s.obj=r,(a.rig?this.rig:this.fxg).add(r),a.draw(this.fxc,s,0,0,1,Go(s.seed))),this.fxs.push(s),this.fxs.length>24&&$r(this.fxs.shift().obj),!0}clearEffects(t){let o=Io();for(let a of this.fxs)(!t||a.name===t||a.tag===t)&&(a.end??=o)}blink(){this.blinkAt=Io()}lookAt(t,o){this.look.tx=U(Number(t)||0,-1,1),this.look.ty=U(Number(o)||0,-1,1),this.look.at=Io()}lookAtPoint(t,o){let a=this.view?.screenOf(this);a&&this.lookAt((t-a.x)/(window.innerWidth/2),(o-a.y)/(window.innerHeight/2))}mouth(t){this.mo.target=U(Number(t)||0)}viseme(t,o){let a=Ot[t]||Ot.X;return this.mo.target=U(o??a.open),this.mo.tmsx=a.w,!!Ot[t]}endSpeech(){let t=this.speech;this.speech=null,this.mo.target=0,this.mo.tmsx=1,t?.resolve?.()}speak(t,o={}){this.speech&&this.endSpeech();let a,s;if(typeof t=="number")s=U(t,0,6e5),a=Ls(s,Math.floor(Math.random()*1e6));else{let d=String(t??"");a=Oa(d),s=Number(o.durationMs)||Math.max(300,d.length/14/(Number(o.rate)||1)*1e3)}let r,i=new Promise(d=>{r=d});if(!a.length||!s)return r(),Object.assign(i,{stop(){}});let n=0;for(let d of a)d.t0=n,n+=d.w;let l=Io(),h=0,f=Number(o.gain)||1,c={resolve:r,tick:d=>{if(d-l>=s)return!1;let p=U((d-l)/s)*n;for(;h<a.length-1&&a[h+1].t0<=p;)h++;let u=a[h],g=Ot[u.v]||Ot.X,m=U((p-u.t0)/(u.w||1));return this.mo.target=U(g.open*(.82+.18*Math.sin(Math.PI*m))*f),this.mo.tmsx=g.w,!0}};return this.speech=c,Object.assign(i,{stop:()=>{this.speech===c&&this.endSpeech()}})}stopSpeaking(){this.speech&&this.endSpeech()}lipsync(t,o={}){if(this.stopSpeaking(),!t||typeof t.getByteTimeDomainData!="function")return()=>{};let a=t.fftSize||512,s=new Uint8Array(a),r=Number(o.gain)||1,i=o.text?Oa(String(o.text)):[],n=0;for(let p of i)p.t0=n,n+=p.w;let l=Number(o.durationMs)||Math.max(300,String(o.text||"").length/14*1e3),h=Io(),f=0,c=.05,d={tick:p=>{if(t.context?.state==="closed")return!1;t.getByteTimeDomainData(s);let u=0;for(let w=0;w<a;w++){let k=(s[w]-128)/128;u+=k*k}u=Math.sqrt(u/a),c=Math.max(u,c*.995,.02);let g=U(U((u-.006)/(c*.7))**.8*r),m=1;if(i.length&&p-h<l){let w=U((p-h)/l)*n;for(;f<i.length-1&&i[f+1].t0<=w;)f++;m=(Ot[i[f].v]||Ot.X).w}return this.mo.target=g,this.mo.tmsx=de(1,m,U(g*2)),!0}};return this.speech=d,()=>{this.speech===d&&this.endSpeech()}}update(t){this.build(t)}get state(){return{mood:this.moodName,gesture:this.gest?.name||null,speaking:!!this.speech,shells:this.shells,morphs:[...this.morphs.keys()].filter(t=>this.morphs.get(t).phase!=="out"),effects:this.fxs.map(t=>t.name)}}dispose(){for(let t of this.fxs)$r(t.obj);this.fxs=[],this.disposeRig(),this.root.removeFromParent()}};Object.assign(sa.prototype,{buildModel:Hc,tickModel:zc,modelGesture:Pc})});var Wc=Mr((P2,Zc)=>{Zc.exports=globalThis.__OTS_THREE__.RoundedBoxGeometry});function su(){let e=new Map,t=new Map,o=(w,k,b)=>b&&Object.values(b).some(x=>x&&typeof x=="object")?null:`${w}${k}${b?JSON.stringify(b):""}`,a=(w,k)=>{if(!w)return k();let b=e.get(w);return b||e.set(w,b=k()),b},s=(w,k)=>a(o("s",w,k),()=>new V.MeshStandardMaterial({color:w,roughness:.85,metalness:0,...k})),r=(w,k)=>a(o("b",w,k),()=>new V.MeshBasicMaterial({color:w,toneMapped:!1,...k})),i=(w,k=1,b)=>s(w,{emissive:w,emissiveIntensity:k,...b}),n=(w,k)=>{let b=t.get(w);return b||t.set(w,b=k()),b},l=(w,k)=>w?.isMaterial?w:s(w,k),h=(w,k,b=0,x=0,E=0)=>{let T=new V.Mesh(w,k);return T.position.set(b,x,E),T},f=(w,k,b,x,E,T,v,_=.06,C)=>h(n(`b${w},${k},${b},${_}`,()=>new Xc.RoundedBoxGeometry(w,k,b,3,Math.min(_,w/2,k/2,b/2))),l(x,C),E,T,v),c=(w,k,b,x,E,T,v,_,C=32)=>h(n(`c${w},${k},${b},${C}`,()=>new V.CylinderGeometry(w,k,b,C)),l(x,_),E,T,v),d=(w,k,b,x,E,T,v=16,_=10)=>h(n(`s${w},${v},${_}`,()=>new V.SphereGeometry(w,v,_)),l(k,T),b,x,E),p=(w,k,b,x,E,T,v=0)=>{let _=h(n(`p${w},${k}`,()=>new V.PlaneGeometry(w,k)),b,x,E,T);return _.rotation.y=v,_},u,g;return{std:s,basic:r,glow:i,geo:n,mesh:h,rbox:f,cyl:c,ball:d,plane:p,shadow:(w,k,b,x)=>{g||(u=kt(128,128,T=>{let v=T.createRadialGradient(64,64,0,64,64,64);v.addColorStop(0,"rgba(0,0,0,.45)"),v.addColorStop(.5,"rgba(0,0,0,.22)"),v.addColorStop(1,"rgba(0,0,0,0)"),T.fillStyle=v,T.fillRect(0,0,128,128)}),g=new V.MeshBasicMaterial({map:u,transparent:!0,depthWrite:!1,toneMapped:!1}));let E=h(n(`p${w},${k}`,()=>new V.PlaneGeometry(w,k)),g,b,.012,x);return E.rotation.x=-Math.PI/2,E}}}function Xr(e,t,o,a,s,r,{color:i="#ffcf6b",light:n="#ffb35c",power:l=2.2,dist:h=4,size:f=.035,ly:c=.14}={}){let d=e.ball(f,e.basic(i),a,s,r,null,12,8);d.scale.y=1.8,t.add(d);let p=null;n&&(p=new V.PointLight(n,l,h,1.6),p.position.set(a,s+c,r),t.add(p));let u=o.length*377;return o.push(g=>{let m=1+Math.sin((g+u)*.013)*.08+Math.sin((g+u)*.031)*.06;p&&(p.intensity=l*m),d.scale.set(1,1.8*m,1)}),d}function iu(e,t,o){let a=o.win,s=a.frame,r=kt(256,256,a.sky),i=Ce;if(a.shape==="round"){let n=(De+Rt)/2,l=.78;t.add(e.mesh(new V.CircleGeometry(l+.32,48),e.std(a.plate||"#6b7480",{metalness:.6,roughness:.4}),Je,n,i+.005)),t.add(e.mesh(new V.CircleGeometry(l,48),e.basic("#ffffff",{map:r}),Je,n,i+.012));let h=e.mesh(new V.TorusGeometry(l+.04,.09,12,48),e.std(s,{metalness:.7,roughness:.3}),Je,n,i+.04);t.add(h);for(let f=0;f<8;f++){let c=f/8*Math.PI*2;t.add(e.ball(.04,"#cfd6de",Je+Math.cos(c)*(l+.22),n+Math.sin(c)*(l+.22),i+.03,{metalness:.8,roughness:.3},8,6))}}else if(a.shape==="arch"||a.shape==="pointed"){let n=$t/2,l=Rt+.3,h=a.shape==="arch"?l-n:De+.75,f=w=>{if(w.lineTo(n,h-De),a.shape==="arch")w.absarc(0,h-De,n,0,Math.PI,!1);else{let k=h-De+(l-h)*.72;w.quadraticCurveTo(n,k,0,l-De),w.quadraticCurveTo(-n,k,-n,h-De)}w.lineTo(-n,0)},c=new V.Shape;c.moveTo(-n,0),c.lineTo(n,0),f(c);let d=new V.ShapeGeometry(c,24),p=d.attributes.position,u=d.attributes.uv;for(let w=0;w<p.count;w++)u.setXY(w,(p.getX(w)+n)/$t,p.getY(w)/(l-De));t.add(e.mesh(d,e.basic("#ffffff",{map:r}),Je,De,i+.01));let g=new V.Path;g.moveTo(n,0),f(g);let m=g.getSpacedPoints(90).map(w=>new V.Vector3(Je+w.x,De+w.y,i+.06));if(t.add(e.mesh(new V.TubeGeometry(new V.CatmullRomCurve3(m),120,.07,8),e.std(s))),t.add(e.rbox($t+.3,.1,.25,s,Je,De-.05,i+.12)),t.add(e.rbox(.05,l-De-.05,.06,s,Je,(De+l)/2,i+.04),e.rbox($t,.05,.06,s,Je,h,i+.04)),a.shape==="pointed"){let w=e.mesh(new V.TorusGeometry(.2,.03,8,24),e.std(s),Je,h+(l-h)*.5,i+.05);t.add(w)}}else if(t.add(e.plane($t,Rt-De,e.basic("#ffffff",{map:r}),Je,(De+Rt)/2,i+.01)),t.add(e.rbox($t+.2,.1,.12,s,Je,Rt+.05,i+.06),e.rbox($t+.3,.1,.25,s,Je,De-.05,i+.12),e.rbox(.1,Rt-De,.12,s,Je-$t/2-.05,(De+Rt)/2,i+.06),e.rbox(.1,Rt-De,.12,s,Je+$t/2+.05,(De+Rt)/2,i+.06)),a.bars==="grid"){for(let n=1;n<4;n++)t.add(e.rbox(.04,Rt-De,.05,s,Je-$t/2+n*$t/4,(De+Rt)/2,i+.04,.01));for(let n=1;n<3;n++)t.add(e.rbox($t,.04,.05,s,Je,De+n*(Rt-De)/3,i+.04,.01))}else a.bars!=="none"&&t.add(e.rbox(.05,Rt-De,.06,s,Je,(De+Rt)/2,i+.04),e.rbox($t,.05,.06,s,Je,(De+Rt)/2,i+.04));if(a.curtain){let n=a.curtainH||2.1,l=a.curtainY||2.3;for(let h of[-1,1])t.add(e.rbox(.45,n,.08,a.curtain,Je+h*($t/2+.35),l,i+.12,.04));if(a.rod){let h=e.cyl(.03,.03,$t+1.4,a.rod,Je,l+n/2+.06,i+.14,null,12);h.rotation.z=Math.PI/2,t.add(h,e.ball(.06,a.rod,Je-$t/2-.7,l+n/2+.06,i+.14),e.ball(.06,a.rod,Je+$t/2+.7,l+n/2+.06,i+.14))}}}function nu(e,t,o,a){let s=a.win,r=Je,i=De,n=Rt,l=$t,h=(A,B)=>new V.Vector3(A+.35*B,.02,Ce+B),f=kt(4,128,(A,B,W)=>{let ae=A.createLinearGradient(0,0,0,W);ae.addColorStop(0,"#fff"),ae.addColorStop(1,"#000"),A.fillStyle=ae,A.fillRect(0,0,B,W)});f.colorSpace=V.NoColorSpace;let c=(A,B,W,ae)=>{let Me=new V.BufferGeometry;return Me.setAttribute("position",new V.Float32BufferAttribute([...A.toArray(),...B.toArray(),...W.toArray(),...ae.toArray()],3)),Me.setAttribute("uv",new V.Float32BufferAttribute([0,1,1,1,1,0,0,0],2)),Me.setIndex([0,1,2,0,2,3]),Me},d=new V.MeshBasicMaterial({color:s.shaft,alphaMap:f,transparent:!0,opacity:s.shaftOp,blending:V.AdditiveBlending,depthWrite:!1,side:V.DoubleSide,toneMapped:!1}),p=r-l/2,u=r+l/2,g=Ce+.02,m=new V.Vector3(p,n,g),w=new V.Vector3(u,n,g),k=new V.Vector3(p,i,g),b=new V.Vector3(u,i,g),x=h(p,n),E=h(u,n),T=h(p,i),v=h(u,i);for(let A of[c(m,w,E,x),c(k,b,v,T),c(m,k,T,x),c(w,b,v,E)])t.add(new V.Mesh(A,d));let _=kt(128,128,(A,B,W)=>{let ae=A.createRadialGradient(64,64,10,64,64,70);ae.addColorStop(0,"#fff"),ae.addColorStop(1,"#000"),A.fillStyle=ae,A.fillRect(0,0,B,W)});_.colorSpace=V.NoColorSpace,t.add(new V.Mesh(c(T,v,E,x),new V.MeshBasicMaterial({color:s.patch,alphaMap:_,transparent:!0,opacity:s.patchOp,blending:V.AdditiveBlending,depthWrite:!1,toneMapped:!1})));let C=70,L=new Float32Array(C*3),z=A=>{let B=Math.random(),W=i+Math.random()*(n-i),ae=h(p+Math.random()*l,W);L.set([V.MathUtils.lerp(p+Math.random()*l,ae.x,B),W*(1-B),V.MathUtils.lerp(g,ae.z,B)],A*3)};for(let A=0;A<C;A++)z(A);let N=new V.BufferGeometry;N.setAttribute("position",new V.BufferAttribute(L,3)),t.add(new V.Points(N,new V.PointsMaterial({color:s.dust,size:.035,transparent:!0,opacity:.8,blending:V.AdditiveBlending,depthWrite:!1,toneMapped:!1})));let Q=new V.DirectionalLight(s.sun[0],s.sun[1]);Q.position.set(r-3.5,10,Ce-10),Q.target.position.set(r+.5,0,-2),t.add(Q,Q.target);let F=0;o.push((A,B)=>{if(F+=B,!(F<=33)){F=0;for(let W=0;W<C;W++)L[W*3+1]+=.0015*Math.sin(A*.001+W),L[W*3]+=.0012,(L[W*3]>u+1.2||L[W*3+1]<.05)&&z(W);N.attributes.position.needsUpdate=!0}})}function lu(e,t,o){let{a,b:s,pillow:r}=o;if(o.kind==="bench"){let i=o.frame;if(t.add(e.rbox(1.1,.46,2.6,i,-4.4,.23,.5,.05)),t.add(e.rbox(.92,.2,1.14,s,-4.3,.56,-.07,.09),e.rbox(.92,.2,1.14,s,-4.3,.56,1.07,.09)),o.back&&t.add(e.rbox(.16,o.back,2.6,i,-4.88,o.back/2,.5,.04),e.rbox(.18,.62,2.3,a,-4.72,.98,.5,.08)),o.bolster)for(let n of[-.62,1.62]){let l=e.cyl(.15,.15,.9,o.bolster,-4.3,.78,n,null,20);l.rotation.z=Math.PI/2,t.add(l)}o.trim&&t.add(e.rbox(1.12,.05,2.62,o.trim,-4.4,.44,.5,.02,{metalness:.7,roughness:.35}))}else{let i=o.r??.12,n=o.backH||1;if(t.add(e.rbox(1.1,.45,2.4,a,-4.4,.25,.5,i),e.rbox(.32,n,2.4,a,-4.82,.1+n/2,.5,i+.02),e.rbox(1.1,.7,.3,a,-4.4,.35,-.75,i),e.rbox(1.1,.7,.3,a,-4.4,.35,1.75,i),e.rbox(.85,.2,1.08,s,-4.3,.56,0,i*.75),e.rbox(.85,.2,1.08,s,-4.3,.56,1,i*.75)),o.tufts)for(let l=0;l<2;l++)for(let h=0;h<6;h++)t.add(e.ball(.03,o.tufts,-4.65,.95+l*.32,-.4+h*.36+(l?.18:0),{metalness:.6,roughness:.3},8,6));if(o.legs)for(let l of[-4.85,-3.95])for(let h of[-.8,1.8])t.add(e.cyl(.04,.03,.12,o.legs,l,.06,h,null,10));o.glow&&t.add(e.rbox(1.14,.04,2.44,e.glow(o.glow,2.2),-4.4,.035,.5,.02))}r&&t.add(e.rbox(.18,.5,.5,r,-4.55,.85,-.25,.08)),t.add(e.shadow(1.6,3.2,-4.3,.5))}function cu(e,t,o){if(!(!o||!o.items))for(let[a,s,r,i,n,l=2.4]of o.items){o.frame&&t.add(e.rbox(.05,i+.12,r+.12,o.frame,_e+.03,l,a,.02,o.frameMetal?{metalness:.75,roughness:.3}:void 0));let h=n?e.std("#ffffff",{map:kt(128,Math.round(128*i/r),n),emissive:"#ffffff",emissiveIntensity:.06}):e.std(s,{emissive:s,emissiveIntensity:.15}),f=e.plane(r,i,h,_e+.06,l,a,Math.PI/2);t.add(f)}}function du(e,t,o,a){if(a.kind==="stump"?t.add(e.cyl(.3,.34,.58,a.top,-4.3,.29,-1.45,null,18),e.cyl(.3,.3,.01,a.leg,-4.3,.585,-1.45,null,18)):t.add(e.cyl(.32,.26,.06,a.top,-4.3,.55,-1.45),e.cyl(.05,.05,.52,a.leg,-4.3,.26,-1.45),e.cyl(.2,.22,.03,a.leg,-4.3,.015,-1.45)),t.add(e.shadow(.8,.8,-4.3,-1.45)),a.orb){t.add(e.ball(.11,e.glow(a.orb,2),-4.3,.7,-1.45,null,20,14),e.cyl(.08,.1,.04,"#3a3f4a",-4.3,.6,-1.45,null,16));let s=Vo(t,a.light,a.power,-4.3,.9,-1.45,4);o.push(r=>{s.intensity=a.power*(.85+Math.sin(r*.002)*.15)})}else t.add(e.cyl(.07,.07,.22,a.candle,-4.3,.69,-1.45)),Xr(e,t,o,-4.3,.86,-1.45,{color:a.flame,light:a.light,power:a.power})}function hu(e,t,o){if(o.shape==="rect"){let r=kt(512,384,ru(o)),i=e.mesh(new V.PlaneGeometry(3.4,2.5),o.glow?e.std("#ffffff",{map:r,emissive:"#ffffff",emissiveMap:r,emissiveIntensity:.5}):e.std("#ffffff",{map:r}),.6,.006,.9);i.rotation.x=-Math.PI/2,t.add(i);return}let a=e.mesh(new V.CircleGeometry(1.8,64),e.std(o.a),.6,.006,.9);a.rotation.x=-Math.PI/2;let s=e.mesh(new V.RingGeometry(1.25,1.42,64),o.glow?e.glow(o.b,1.6):e.std(o.b),.6,.008,.9);s.rotation.x=-Math.PI/2,o.shape==="oval"&&(a.scale.set(1.15,.8,1),s.scale.set(1.15,.8,1)),t.add(a,s)}function fu(e,t,o){let a=o.r??.08;if(t.add(e.rbox(2.1,.38,3,o.frame,3.55,.2,-2.5,a),e.rbox(2,.26,2.9,o.sheet,3.55,.5,-2.5,.1),e.rbox(2.06,.08,1.95,o.blanket,3.55,.64,-1.97,.05),e.rbox(1.3,.2,.55,o.pillow,3.55,.72,-3.55,.1),e.rbox(2.1,o.headH||1.3,.14,o.head,3.55,(o.headH||1.3)/2,-3.95,a*.75),e.shadow(2.6,3.5,3.55,-2.5)),o.stripe&&t.add(e.rbox(2.08,.085,.18,o.stripe,3.55,.645,-1.3,.03)),o.glow&&t.add(e.rbox(2.16,.05,3.06,e.glow(o.glow,2.2),3.55,.04,-2.5,.02)),o.posts){let s=o.postH||2.6;for(let r of[2.56,4.54])for(let i of[-1.06,-3.94])t.add(e.cyl(.055,.065,s,o.posts,r,s/2,i,null,12),e.ball(.08,o.finial||o.posts,r,s+.05,i,null,12,8));for(let r of[-1.06,-3.94])t.add(e.rbox(2.06,.08,.08,o.posts,3.55,s-.04,r,.02));for(let r of[2.56,4.54])t.add(e.rbox(.08,.08,2.9,o.posts,r,s-.04,-2.5,.02));if(o.drape){t.add(e.rbox(2.04,.04,2.86,o.drape,3.55,s-.02,-2.5,.015)),t.add(e.rbox(2.04,.36,.05,o.drape,3.55,s-.2,-1.04,.02));for(let r of[2.56,4.54])t.add(e.rbox(.05,.36,2.86,o.drape,r,s-.2,-2.5,.02));for(let r of[2.62,4.48])t.add(e.rbox(.22,s-.5,.16,o.drape,r,(s-.5)/2+.3,-1.12,.06),e.rbox(.3,s-.3,.12,o.drape,r,(s-.3)/2+.15,-3.86,.05))}}}function uu(e,t,o,a){if(t.add(e.rbox(1.9,.08,.85,a.top,1,.78,-3.5,.03)),a.legW)for(let[n,l]of[[.12,-3.83],[1.88,-3.83],[.12,-3.17],[1.88,-3.17]])t.add(e.rbox(a.legW,.76,a.legW,a.leg,n,.38,l,.02));else for(let[n,l]of[[.1,-3.85],[1.9,-3.85],[.1,-3.15],[1.9,-3.15]])t.add(e.cyl(.035,.035,.76,a.leg,n,.38,l));t.add(e.shadow(2.3,1.2,1,-3.5));let s=kt(256,160,au(a.screen));if(a.screenKind==="holo"){let n=e.plane(.86,.54,new V.MeshBasicMaterial({map:s,transparent:!0,opacity:.85,blending:V.AdditiveBlending,depthWrite:!1,side:V.DoubleSide,toneMapped:!1}),.9,1.22,-3.7);t.add(n,e.cyl(.16,.18,.04,a.dark,.9,.84,-3.7,{metalness:.6,roughness:.35},24),e.cyl(.12,.12,.012,e.glow(a.screen.ink,2),.9,.865,-3.7,null,24)),o.push(l=>{n.material.opacity=.78+Math.sin(l*.006)*.06})}else{let n=a.screenKind==="mirror",l=n?1:.9,h=n?.68:.58;t.add(e.rbox(l,h,.05,a.dark,.9,1.18,-3.73,.02,n?{metalness:.8,roughness:.3}:void 0)),t.add(e.plane(.82,.5,e.basic("#ffffff",{map:s}),.9,1.18,-3.7)),t.add(e.cyl(.03,.03,.18,a.dark,.9,.9,-3.75),e.cyl(.14,.14,.02,a.dark,.9,.83,-3.75)),n&&t.add(e.ball(.06,a.dark,.9,1.56,-3.73,{metalness:.8,roughness:.3},12,8))}let r=1.65,i=-3.6;if(a.lamp==="candles"){t.add(e.cyl(.1,.12,.03,a.lampColor,r,.83,i,{metalness:.7,roughness:.35}),e.cyl(.015,.02,.36,a.lampColor,r,1,i,{metalness:.7,roughness:.35}));let n=e.rbox(.42,.025,.025,a.lampColor,r,1.12,i,.01,{metalness:.7,roughness:.35});t.add(n);for(let l of[-.2,0,.2]){let h=l?1.2:1.26;t.add(e.cyl(.025,.025,l?.14:.26,a.candle||"#f3ead6",r+l,h-(l?0:.06),i)),Xr(e,t,o,r+l,h+.1,i,{size:.025,light:l===0?a.lampLight:null,power:2.6,dist:4.5})}}else if(a.lamp==="lantern"){t.add(e.rbox(.2,.04,.2,a.lampColor,r,.84,i,.01),e.rbox(.17,.3,.17,e.glow(a.lampGlow||"#fff1c9",1.3),r,1,i,.02),e.rbox(.22,.04,.22,a.lampColor,r,1.17,i,.01));for(let[n,l]of[[-.09,-.09],[.09,-.09],[-.09,.09],[.09,.09]])t.add(e.rbox(.02,.32,.02,a.lampColor,r+n,1,i+l,.005));Vo(t,a.lampLight,2.5,r,1.15,-3.45,4.5)}else if(a.lamp==="neon")t.add(e.cyl(.08,.1,.03,a.dark,r,.83,i,null,16),e.cyl(.025,.025,.6,e.glow(a.lampColor,3),r,1.14,i,null,12)),Vo(t,a.lampLight,2.6,r,1.15,-3.45,4.5);else if(a.lamp==="oil"){let n=e.ball(.09,a.lampColor,r,.88,i,{metalness:.7,roughness:.35},16,10);n.scale.set(1.5,.6,1),t.add(n,e.cyl(.02,.03,.08,a.lampColor,r+.13,.9,i,{metalness:.7,roughness:.35},10)),Xr(e,t,o,r+.14,.98,i,{size:.03,light:a.lampLight,power:2.6,dist:4.5,ly:.17})}else t.add(e.cyl(.1,.12,.03,a.lampColor,r,.83,i),e.cyl(.015,.015,.42,a.lampColor,r,1.04,i),e.cyl(.07,.17,.18,a.lampColor,r,1.3,i,{emissive:a.lampColor,emissiveIntensity:.25})),Vo(t,a.lampLight,2.5,r,1.15,-3.45,4.5).decay=1.4}function pu(e,t,o){if(!o)return;t.add(e.rbox(1.7,.06,.3,o.board,1,2.15,-3.85,.02));let a=.3;for(let[s,r]of o.books)t.add(e.rbox(.11,s,.22,r,a,2.18+s/2,-3.84,.015)),a+=.13;o.vase&&t.add(e.cyl(.12,.09,.16,o.vase,1.55,2.26,-3.84))}function mu(e,t,o,a){t.add(e.shadow(1,1,-4.35,-3.4));let n=(()=>{if(a.potKind==="barrel"){t.add(e.cyl(.32,.28,.55,a.pot,-4.35,.28,-3.4,null,20));for(let h of[.12,.44])t.add(e.cyl(.33,.33,.04,"#3a3a3a",-4.35,h,-3.4,{metalness:.6,roughness:.4},20))}else if(a.potKind==="amphora"){let h=e.ball(.3,a.pot,-4.35,.36,-3.4,null,20,14);return h.scale.set(1,1.25,1),t.add(h,e.cyl(.16,.2,.18,a.pot,-4.35,.78,-3.4,null,20),e.cyl(.2,.16,.05,a.pot,-4.35,.88,-3.4,null,20)),.9}else{if(a.potKind==="stand")return t.add(e.rbox(.72,.42,.62,a.stand,-4.35,.21,-3.4,.03),e.rbox(.62,.14,.42,a.pot,-4.35,.49,-3.4,.03)),.56;t.add(e.cyl(.32,.24,.55,a.pot,-4.35,.28,-3.4,a.potMetal?{metalness:.7,roughness:.35}:void 0))}return .55})(),l=(h,f,c,d,p)=>{for(let u=0;u<h;u++){let g=u/h*Math.PI*2,m=f[u%f.length],w=e.ball(.22,p?e.glow(m,p):m,-4.35+Math.cos(g)*.18,d+u%3*.12,-3.4+Math.sin(g)*.18);w.scale.set(...c),w.rotation.set(Math.sin(g)*.5,0,-Math.cos(g)*.5),t.add(w)}};if(a.kind==="bonsai"){let h=a.trunk||"#5a3b26",f=e.cyl(.05,.08,.45,h,-4.35+.05,n+.2,-3.4,null,10);f.rotation.z=-.35;let c=e.cyl(.035,.05,.4,h,-4.35-.06,n+.52,-3.4,null,10);c.rotation.z=.6,t.add(f,c);for(let[d,p,u,g]of[[-.2,.7,0,1],[.18,.55,.05,.8],[.02,.85,-.05,.75],[-.05,.6,.18,.6]]){let m=e.ball(.24,d>0?a.leaves[0]:a.leaves[1],-4.35+d,n+p,-3.4+u,null,14,8);m.scale.set(1.2*g,.45*g,1*g),t.add(m)}}else if(a.kind==="palm"){let h=-4.35,f=n;for(let c=0;c<6;c++){let d=e.cyl(.06,.075,.24,a.trunk||"#8a6a44",h,f+.12,-3.4,null,10);d.rotation.z=-.08*c,t.add(d),h+=.025*c,f+=.22}for(let c=0;c<8;c++){let d=c/8*Math.PI*2,p=e.ball(.3,a.leaves[c%2],h+Math.cos(d)*.3,f+.02,-3.4+Math.sin(d)*.3,null,12,6);p.scale.set(1.4,.08,.32),p.rotation.set(0,-d,-.45),t.add(p)}t.add(e.ball(.06,"#6b4a2a",h,f-.05,-3.4+.05,null,10,6),e.ball(.06,"#6b4a2a",h+.06,f-.06,-3.4-.03,null,10,6))}else if(a.kind==="topiary"){t.add(e.cyl(.03,.035,.55,a.trunk||"#6b4a2a",-4.35,n+.27,-3.4,null,10));let h=e.ball(.36,a.leaves[0],-4.35,n+.78,-3.4,null,20,14);t.add(h);for(let f=0;f<26;f++){let c=Math.random()*Math.PI*2,d=Math.acos(ke(-1,1));t.add(e.ball(.07,a.leaves[1],-4.35+Math.sin(d)*Math.cos(c)*.34,n+.78+Math.cos(d)*.34,-3.4+Math.sin(d)*Math.sin(c)*.34,null,8,6))}if(a.berries)for(let f=0;f<8;f++){let c=f/8*Math.PI*2;t.add(e.ball(.035,a.berries,-4.35+Math.cos(c)*.37,n+.8+Math.sin(c*3)*.12,-3.4+Math.sin(c)*.37,null,8,6))}}else if(a.kind==="crystal"){let h=e.geo("oct",()=>new V.OctahedronGeometry(.16,0)),f=[];for(let[d,p,u,g]of[[0,0,1.4,0],[.14,.06,.9,1],[-.12,.08,1,0],[.05,-.14,.7,1],[-.1,-.1,.6,1]]){let m=e.mesh(h,e.glow(a.leaves[g],1.2,{roughness:.2,metalness:.1,transparent:!0,opacity:.9}),-4.35+d,n+.16*u*1.6,-3.4+p);m.scale.set(.6,u*1.6,.6),m.rotation.set(p*2,0,-d*2),t.add(m),f.push(m)}let c=Vo(t,a.leaves[0],1.6,-4.35,n+.5,-3.4+.3,3);o.push(d=>{c.intensity=1.6+Math.sin(d*.0025)*.4})}else if(l(a.n||9,a.leaves,a.leafScale||[.55,1.6,.35],n+.4,a.glow),a.flowers)for(let h=0;h<6;h++){let f=h/6*Math.PI*2+.3;t.add(e.ball(.06,a.flowers,-4.35+Math.cos(f)*.26,n+.62+h%3*.13,-3.4+Math.sin(f)*.26,null,10,8))}}function e0(e,t=Ks){let o=Ys[t]?t:Ks,a=yu(o),s=su(),r=new V.Group;r.name=`room:${o}`;let i=[],n=kt(512,512,a.floor.paint);n.wrapS=n.wrapT=V.RepeatWrapping,n.repeat.set(...a.floor.repeat);let l=new V.Mesh(new V.PlaneGeometry(wt,At),s.std("#ffffff",{map:n,roughness:a.floor.rough,metalness:a.floor.metal||0}));l.rotation.x=-Math.PI/2,l.name="floor",r.add(l);let h,f;if(a.wall.paint){let p=kt(512,512,a.wall.paint);p.wrapS=p.wrapT=V.RepeatWrapping;let u=p.clone();p.repeat.set(wt/a.wall.tile,Be/a.wall.tile),u.repeat.set(At/a.wall.tile,Be/a.wall.tile),u.needsUpdate=!0,h=s.std(a.wall.back,{map:p}),f=s.std(a.wall.left,{map:u})}else h=s.std(a.wall.back),f=s.std(a.wall.left);let c=new V.Mesh(new V.PlaneGeometry(wt,Be),h);c.position.set(0,Be/2,Ce);let d=new V.Mesh(new V.PlaneGeometry(At,Be),f);if(d.rotation.y=Math.PI/2,d.position.set(_e,Be/2,0),r.add(c,d),a.wains){let p=a.wains,u=p.h;if(r.add(s.rbox(wt,u,.06,p.back,0,u/2,Ce+.03,.02),s.rbox(.06,u,At,p.left,_e+.03,u/2,0,.02)),p.paint){let g=kt(512,64,p.paint);g.wrapS=V.RepeatWrapping;let m=g.clone();g.repeat.set(wt/(u*8),1),m.repeat.set(At/(u*8),1),m.needsUpdate=!0,r.add(s.plane(wt,u,s.std("#ffffff",{map:g}),0,u/2,Ce+.062),s.plane(At,u,s.std("#ffffff",{map:m}),_e+.062,u/2,0,Math.PI/2))}if(p.rail){let g=p.railGlow?s.glow(p.rail,p.railGlow):p.rail;r.add(s.rbox(wt,.08,.08,g,0,u+.02,Ce+.05,.03),s.rbox(.08,.08,At,g,_e+.05,u+.02,0,.03))}}return iu(s,r,a),nu(s,r,i,a),lu(s,r,a.sofa),cu(s,r,a.art),du(s,r,i,a.table),hu(s,r,a.rug),fu(s,r,a.bed),uu(s,r,i,a.desk),pu(s,r,a.shelf),mu(s,r,i,a.plant),$u[o]?.(s,r,i,a),e.add(r),{id:o,group:r,floor:l,look:{bg:a.bg,...a.light},tick(p,u){for(let g of i)g(p,u)}}}var V,Xc,wt,At,Be,Ce,_e,Je,De,Rt,$t,ke,Ws,kt,$o,xt,gr,xn,Eo,Uc,yr,Kr,Jc,Ff,Zf,Us,Wf,Uf,Yf,Kf,Xf,Jf,eu,tu,ou,_o,au,ru,Vo,Zs,Yc,Kc,Da,$u,gu,Ys,kn,Ks,yu,t0=Ye(()=>{V=_t(Do(),1),Xc=_t(Wc(),1),wt=10,At=8,Be=4.2,Ce=-At/2,_e=-wt/2,Je=-1.2,De=1.6,Rt=3.1,$t=2,ke=(e,t)=>e+Math.random()*(t-e),Ws=e=>e[Math.floor(Math.random()*e.length)],kt=(e,t,o)=>{let a=document.createElement("canvas");a.width=e,a.height=t,o(a.getContext("2d"),e,t);let s=new V.CanvasTexture(a);return s.colorSpace=V.SRGBColorSpace,s},$o=(e,t,o,a)=>{let s=e.createLinearGradient(0,0,0,o);for(let[r,i]of a)s.addColorStop(r,i);e.fillStyle=s,e.fillRect(0,0,t,o)},xt=(e,t,o,a,s)=>{e.fillStyle=s,e.beginPath(),e.arc(t,o,a,0,Math.PI*2),e.fill()},gr=(e,t,o,a,s)=>{let r=e.createRadialGradient(t,o,0,t,o,a);r.addColorStop(0,s),r.addColorStop(1,"rgba(0,0,0,0)"),e.fillStyle=r,e.fillRect(t-a,o-a,a*2,a*2)},xn=(e,t,o,a,s=.9)=>{for(let r=0;r<a;r++){let i=Math.random()<.12?2:1;e.fillStyle=`rgba(255,255,255,${ke(.25,s)})`,e.fillRect(ke(0,t),ke(0,o),i,i)}},Eo=(e,t,o,a,s)=>{e.fillStyle=a,e.beginPath(),e.moveTo(0,o);for(let[r,i]of s)e.lineTo(r,i);e.lineTo(t,o),e.fill()},Uc=(e,t,o,a,s,r)=>{e.fillStyle=s;for(let i=0;i<3;i++){let n=o-i*a*.55;e.beginPath(),e.moveTo(t-a*(.55-i*.12),n),e.lineTo(t,n-a*.75),e.lineTo(t+a*(.55-i*.12),n),e.fill()}r&&(e.fillStyle=r,e.beginPath(),e.moveTo(t-a*.13,o-a*1.6),e.lineTo(t,o-a*1.85),e.lineTo(t+a*.13,o-a*1.6),e.fill())},yr=(e,t,o,a,s,r=[1,3])=>{for(let i=0;i<a;i++){e.fillStyle=s.replace("$",ke(.02,.09).toFixed(3));let n=ke(r[0],r[1]);e.fillRect(ke(0,t),ke(0,o),n,n)}},Kr=({base:e,a:t,b:o,seam:a,grain:s,n:r=8})=>(i,n,l)=>{i.fillStyle=e,i.fillRect(0,0,n,l);for(let h=0;h<r;h++){let f=h*l/r;i.fillStyle=h%2?t:o,i.fillRect(0,f,n,l/r-3),i.fillStyle=a,i.fillRect(h*197%n,f,3,l/r);for(let c=0;c<6;c++)i.fillStyle=`rgba(${s},${.05+Math.random()*.05})`,i.fillRect(Math.random()*n,f+Math.random()*(l/r),40+Math.random()*80,2)}},Jc=(e,t,o,a,s=14)=>{e.strokeStyle=a;for(let r=0;r<s;r++){e.globalAlpha=ke(.12,.4),e.lineWidth=ke(.6,2.2);let i=ke(0,t),n=ke(-40,o);e.beginPath(),e.moveTo(i,n);for(let l=0;l<7;l++)i+=ke(-50,50),n+=ke(10,50),e.lineTo(i,n);e.stroke()}e.globalAlpha=1},Ff=({a:e,b:t,n:o=4,vein:a,grout:s})=>(r,i,n)=>{let l=i/o;for(let h=0;h<o;h++)for(let f=0;f<o;f++)r.fillStyle=(h+f)%2?e:t,r.fillRect(h*l,f*l,l,l);if(a&&Jc(r,i,n,a,18),s){r.fillStyle=s;for(let h=0;h<=o;h++)r.fillRect(h*l-1,0,2,n),r.fillRect(0,h*l-1,i,2)}},Zf=(e,t)=>(o,a,s)=>{o.fillStyle=e,o.fillRect(0,0,a,s),yr(o,a,s,300,"rgba(120,100,80,$)"),Jc(o,a,s,t,16)},Us=({cols:e,grout:t,rows:o=6,minW:a=60,maxW:s=140})=>(r,i,n)=>{r.fillStyle=t,r.fillRect(0,0,i,n);let l=n/o;for(let h=0;h<o;h++){let f=h%2?-s/2:0;for(;f<i;){let c=Math.min(ke(a,s),i-f+s);r.fillStyle=Ws(e),r.fillRect(f+3,h*l+3,c-6,l-6);for(let d=0;d<10;d++)r.fillStyle=`rgba(0,0,0,${ke(.03,.12).toFixed(3)})`,r.fillRect(ke(f,f+c-8),ke(h*l+3,h*l+l-8),ke(2,9),ke(2,6));r.fillStyle="rgba(255,255,255,.06)",r.fillRect(f+3,h*l+3,c-6,3),f+=c}}},Wf=(e,t,o)=>{let a=(s,r,i,n,l)=>{if(e.fillStyle="#cfc58c",e.fillRect(s,r,i,n),e.fillStyle="rgba(110,100,40,.16)",l)for(let h=0;h<i;h+=4)e.fillRect(s+h,r,1,n);else for(let h=0;h<n;h+=4)e.fillRect(s,r+h,i,1);e.fillStyle="#2f3b2c",l?(e.fillRect(s,r,9,n),e.fillRect(s+i-9,r,9,n)):(e.fillRect(s,r,i,9),e.fillRect(s,r+n-9,i,9)),e.fillStyle="rgba(40,30,10,.35)",e.fillRect(s,r,i,1),e.fillRect(s,r,1,n)};a(0,0,t,o/2,!1),a(0,o/2,t/2,o/2,!0),a(t/2,o/2,t/2,o/2,!0)},Uf=({base:e,light:t,seam:o,rivet:a})=>(s,r,i)=>{let n=r/2;for(let l=0;l<2;l++)for(let h=0;h<2;h++){let f=s.createLinearGradient(l*n,h*n,l*n+n,h*n+n);f.addColorStop(0,t),f.addColorStop(1,e),s.fillStyle=f,s.fillRect(l*n,h*n,n,n),s.fillStyle=o,s.fillRect(l*n,h*n,n,4),s.fillRect(l*n,h*n,4,n),s.fillStyle=a;for(let[c,d]of[[16,16],[n-16,16],[16,n-16],[n-16,n-16]])s.beginPath(),s.arc(l*n+c,h*n+d,5,0,7),s.fill();s.fillStyle="rgba(0,0,0,.12)";for(let c=0;c<6;c++)s.fillRect(l*n+40,h*n+50+c*28,n-80,6)}},Yf=(e,t,o)=>{e.fillStyle="#140d2a",e.fillRect(0,0,t,o),yr(e,t,o,600,"rgba(255,255,255,$)"),e.fillStyle="rgba(0,240,255,.35)";for(let a=0;a<4;a++)e.fillRect(a*(t/4),0,2,o),e.fillRect(0,a*(o/4),t,2);e.fillStyle="rgba(255,60,200,.22)",e.fillRect(t/8,0,1,o),e.fillRect(0,o/8*5,t,1)},Kf=({cols:e,n:t=7})=>(o,a,s)=>{let r=s/t;for(let i=0;i<t;i++){let n=i*r,l=e[i%e.length],h=o.createLinearGradient(0,n,0,n+r);h.addColorStop(0,"rgba(20,10,0,.55)"),h.addColorStop(.18,l),h.addColorStop(.6,l),h.addColorStop(1,"rgba(20,10,0,.65)"),o.fillStyle=l,o.fillRect(0,n,a,r),o.fillStyle=h,o.fillRect(0,n,a,r);for(let f=0;f<10;f++)o.fillStyle=`rgba(50,25,5,${ke(.08,.2).toFixed(3)})`,o.fillRect(ke(0,a),n+ke(r*.25,r*.75),ke(30,110),2);for(let f=0;f<2;f++)o.fillStyle="rgba(40,20,5,.35)",o.beginPath(),o.ellipse(ke(0,a),n+r/2,6,4,0,0,7),o.fill()}},Xf=(e,t)=>(o,a,s)=>{o.fillStyle=e,o.fillRect(0,0,a,s);for(let r=0;r<a;r+=32)o.fillStyle=t,o.fillRect(r,0,3,s),o.fillStyle="rgba(255,255,255,.35)",o.fillRect(r+3,0,2,s);yr(o,a,s,200,"rgba(120,100,70,$)")},Jf=({base:e,line:t,dark:o})=>(a,s,r)=>{a.fillStyle=e,a.fillRect(0,0,s,r);for(let[i,n,l,h]of[[0,0,s/2,r/3],[s/2,0,s/2,r/3],[0,r/3,s,r/3],[0,r/3*2,s/3,r/3],[s/3,r/3*2,s/3*2,r/3]])a.fillStyle=t,a.fillRect(i,n,l,3),a.fillRect(i,n,3,h),a.fillStyle="rgba(255,255,255,.35)",a.fillRect(i+3,n+3,l-6,2),a.fillStyle=o,a.fillRect(i+14,n+h-24,40,8)},eu=e=>(t,o,a)=>{t.fillStyle=e,t.fillRect(0,0,o,a),yr(t,o,a,1400,"rgba(255,255,255,$)",[1,4]),yr(t,o,a,900,"rgba(0,0,0,$)",[2,6]),t.fillStyle="rgba(0,0,0,.25)";for(let s=0;s<=o;s+=o/2)t.fillRect(s,0,3,a);t.fillRect(0,a/2,o,3)},tu=e=>(t,o,a)=>{t.fillStyle=e,t.fillRect(0,0,o,a),yr(t,o,a,900,"rgba(110,90,60,$)",[1,5])},ou=(e,t)=>(o,a,s)=>{o.fillStyle=e,o.fillRect(0,0,a,s),o.fillStyle=t,o.fillRect(0,6,a,5),o.fillRect(0,s-11,a,5);let r=(s-34)/4,i=17;for(let n=0;n<a;n+=r*5)o.fillRect(n,i,r,r*4),o.fillRect(n,i,r*4,r),o.fillRect(n+r*3,i,r,r*3),o.fillRect(n+r*2,i+r*2,r*2,r),o.fillRect(n+r*2,i+r*2,r,r*2-0),o.fillRect(n,i+r*3,r*5,r)},_o={cozy:(e,t,o)=>{let a=e.createLinearGradient(0,0,0,o);a.addColorStop(0,"#7cc4ff"),a.addColorStop(.65,"#ffd9a8"),a.addColorStop(1,"#ffb88a"),e.fillStyle=a,e.fillRect(0,0,t,o),e.fillStyle="rgba(255,255,255,.85)";for(let[s,r,i]of[[60,70,22],[85,64,28],[112,72,20],[180,120,16],[198,114,22]])e.beginPath(),e.arc(s,r,i,0,Math.PI*2),e.fill();e.fillStyle="#8d6fd1",e.beginPath(),e.moveTo(0,o),e.lineTo(70,180),e.lineTo(130,215),e.lineTo(200,170),e.lineTo(t,200),e.lineTo(t,o),e.fill()},gothic:(e,t,o)=>{$o(e,t,o,[[0,"#0d0626"],[.6,"#341a5c"],[1,"#6d2350"]]),xn(e,t,o*.7,90),gr(e,172,74,70,"rgba(255,240,210,.35)"),xt(e,172,74,30,"#f3ead0"),xt(e,162,66,6,"rgba(180,170,150,.5)"),xt(e,182,84,4,"rgba(180,170,150,.5)"),e.fillStyle="#0a0518",e.beginPath(),e.moveTo(0,o),e.lineTo(0,200),e.lineTo(40,196),e.lineTo(40,150),e.lineTo(52,110),e.lineTo(64,150),e.lineTo(64,190),e.lineTo(110,186),e.lineTo(110,160),e.lineTo(118,140),e.lineTo(126,160),e.lineTo(126,184),e.lineTo(200,188),e.lineTo(200,130),e.lineTo(214,84),e.lineTo(228,130),e.lineTo(228,192),e.lineTo(t,198),e.lineTo(t,o),e.fill(),e.strokeStyle="#0a0518",e.lineWidth=2;for(let[a,s]of[[90,60],[120,84],[70,96]])e.beginPath(),e.moveTo(a-7,s-3),e.quadraticCurveTo(a-3,s,a,s+2),e.quadraticCurveTo(a+3,s,a+7,s-3),e.stroke()},roman:(e,t,o)=>{$o(e,t,o,[[0,"#5fb3f0"],[.7,"#cfe8f5"],[1,"#f6e3c0"]]),gr(e,200,50,60,"rgba(255,250,220,.7)"),xt(e,200,50,16,"#fffbe8"),Eo(e,t,o,"#a7b07a",[[0,190],[60,170],[140,182],[210,166],[t,178]]),Eo(e,t,o,"#7d8a4f",[[0,215],[90,200],[170,212],[t,204]]),e.fillStyle="#f2ecdf",e.fillRect(120,160,46,4),e.beginPath(),e.moveTo(118,160),e.lineTo(143,148),e.lineTo(168,160),e.fill();for(let a=0;a<5;a++)e.fillRect(122+a*10,164,3,16);e.fillRect(118,180,50,3),e.fillStyle="#2f4a26";for(let[a,s]of[[30,1],[44,.8],[226,1.1],[240,.85]])e.beginPath(),e.ellipse(a,205-34*s,7*s,36*s,0,0,7),e.fill()},japanese:(e,t,o)=>{$o(e,t,o,[[0,"#ffb3c7"],[.55,"#ffd2b0"],[1,"#ffe9c9"]]),xt(e,70,90,22,"#ff6b5b"),e.fillStyle="#7a86b8",e.beginPath(),e.moveTo(20,230),e.lineTo(110,120),e.lineTo(146,120),e.lineTo(236,230),e.fill(),e.fillStyle="#ffffff",e.beginPath(),e.moveTo(92,142),e.lineTo(110,120),e.lineTo(146,120),e.lineTo(164,142),e.lineTo(150,136),e.lineTo(138,146),e.lineTo(126,136),e.lineTo(112,146),e.lineTo(102,136),e.fill(),Eo(e,t,o,"#4d5a7c",[[0,220],[80,214],[180,222],[t,212]]),e.strokeStyle="#4a2a20",e.lineWidth=4,e.beginPath(),e.moveTo(t,20),e.quadraticCurveTo(200,30,160,10),e.stroke();for(let a=0;a<26;a++)xt(e,ke(150,t),ke(0,50),ke(4,9),Ws(["#ffc0d4","#ff9fbe","#ffe0ea"]))},scandi:(e,t,o)=>{$o(e,t,o,[[0,"#a9c4dc"],[.7,"#dfe8ef"],[1,"#f4f6f8"]]),Eo(e,t,o,"#eef2f5",[[0,190],[70,176],[150,186],[t,172]]);for(let[a,s,r]of[[26,200,30],[58,196,22],[190,194,34],[228,200,26],[120,206,18]])Uc(e,a,s,r,"#3e5a4f","#ffffff");Eo(e,t,o,"#ffffff",[[0,214],[120,208],[t,216]]);for(let a=0;a<40;a++)xt(e,ke(0,t),ke(0,o),ke(1,2.4),"rgba(255,255,255,.85)")},cyberpunk:(e,t,o)=>{$o(e,t,o,[[0,"#0a0620"],[.55,"#2a0b4a"],[1,"#ff2fa0"]]);for(let a=0;a<18;a++){let s=ke(16,34),r=ke(60,190),i=ke(-10,t),n=o-r;e.fillStyle=Ws(["#120a2a","#1a0f38","#0e0822"]),e.fillRect(i,n,s,r);for(let l=n+6;l<o-4;l+=8)for(let h=i+3;h<i+s-3;h+=6)Math.random()<.35&&(e.fillStyle=Ws(["#ffe36b","#00f0ff","#ff4fd8","#9b7bff"]),e.fillRect(h,l,3,3))}e.fillStyle="#00f0ff",e.fillRect(30,120,34,6),e.fillStyle="#ff4fd8",e.fillRect(180,96,8,30),e.strokeStyle="rgba(160,200,255,.35)",e.lineWidth=1;for(let a=0;a<90;a++){let s=ke(0,t),r=ke(0,o);e.beginPath(),e.moveTo(s,r),e.lineTo(s-3,r+12),e.stroke()}},beach:(e,t,o)=>{$o(e,t,o,[[0,"#4fb6f2"],[.55,"#bfe9ff"],[.62,"#bfe9ff"]]),gr(e,190,70,60,"rgba(255,250,200,.7)"),xt(e,190,70,18,"#fff6c8"),e.fillStyle="rgba(255,255,255,.9)";for(let[s,r,i]of[[50,50,14],[68,46,18],[86,52,12]])e.beginPath(),e.arc(s,r,i,0,7),e.fill();let a=e.createLinearGradient(0,150,0,205);a.addColorStop(0,"#1ba3c6"),a.addColorStop(1,"#5fe0d6"),e.fillStyle=a,e.fillRect(0,150,t,60),e.fillStyle="rgba(255,255,255,.7)";for(let s=0;s<14;s++)e.fillRect(ke(0,t),ke(156,200),ke(10,26),2);Eo(e,t,o,"#f5deb0",[[0,212],[100,204],[t,214]]),e.strokeStyle="#5a3d22",e.lineWidth=6,e.beginPath(),e.moveTo(40,o),e.quadraticCurveTo(30,170,56,120),e.stroke(),e.fillStyle="#2f8a4a";for(let s of[-2.6,-2,-1.2,-.5,.2])e.beginPath(),e.ellipse(56+Math.cos(s)*26,120+Math.sin(s)*12+8,30,7,s,0,7),e.fill()},cabin:(e,t,o)=>{$o(e,t,o,[[0,"#2c2a5a"],[.5,"#a85a7a"],[1,"#ffb27a"]]),xn(e,t,o*.35,30,.7),Eo(e,t,o,"#6a6aa0",[[0,170],[50,120],[96,160],[150,104],[210,158],[t,136]]),e.fillStyle="#ffffff";for(let[a,s]of[[50,120],[150,104]])e.beginPath(),e.moveTo(a-16,s+18),e.lineTo(a,s),e.lineTo(a+18,s+20),e.fill();Eo(e,t,o,"#eef0ff",[[0,210],[130,202],[t,212]]);for(let[a,s,r]of[[20,214,36],[62,206,28],[200,210,40],[236,214,30],[130,216,22]])Uc(e,a,s,r,"#1d3330","#e8ecff")},space:(e,t,o)=>{e.fillStyle="#04030c",e.fillRect(0,0,t,o),gr(e,80,170,120,"rgba(120,60,200,.35)"),gr(e,190,60,80,"rgba(40,140,220,.25)"),xn(e,t,o,220);for(let s=0;s<8;s++){let r=ke(0,t),i=ke(0,o);gr(e,r,i,5,"rgba(255,255,255,.8)")}let a=e.createRadialGradient(150,140,6,166,156,56);a.addColorStop(0,"#ffd2a0"),a.addColorStop(.6,"#e0743c"),a.addColorStop(1,"#5a1e2a"),e.fillStyle=a,e.beginPath(),e.arc(166,156,52,0,7),e.fill(),e.strokeStyle="rgba(255,220,180,.75)",e.lineWidth=4,e.beginPath(),e.ellipse(166,156,90,18,-.3,0,7),e.stroke()},castle:(e,t,o)=>{$o(e,t,o,[[0,"#5aa8e8"],[.75,"#cde9f7"],[1,"#e8f4e0"]]),e.fillStyle="rgba(255,255,255,.9)";for(let[a,s,r]of[[40,60,16],[60,54,22],[84,62,15],[190,40,14],[206,36,18]])e.beginPath(),e.arc(a,s,r,0,7),e.fill();Eo(e,t,o,"#86b860",[[0,180],[70,164],[140,178],[t,160]]),e.fillStyle="#9a9aa6",e.fillRect(170,112,26,56),e.fillRect(200,130,30,38);for(let a=0;a<3;a++)e.fillRect(170+a*10,106,6,6);e.fillStyle="#c0392b",e.beginPath(),e.moveTo(166,112),e.lineTo(183,86),e.lineTo(200,112),e.fill(),e.fillStyle="#3a3a4a",e.fillRect(181,130,4,8),Eo(e,t,o,"#5f9a44",[[0,210],[110,196],[t,206]]),e.fillStyle="#e8c35a",e.fillRect(182,72,2,16),e.beginPath(),e.moveTo(184,72),e.lineTo(196,76),e.lineTo(184,80),e.fill()}},au=({bg:e,ink:t,dots:o,line:a="rgba(255,255,255,.55)",font:s="bold 22px sans-serif"})=>(r,i,n)=>{r.fillStyle=e,r.fillRect(0,0,i,n),r.fillStyle=t,r.font=s,r.fillText("plaza",14,32);for(let l=0;l<4;l++)r.fillStyle=o[l],r.beginPath(),r.arc(28,60+l*26,9,0,7),r.fill(),r.fillStyle=a,r.fillRect(46,54+l*26,80+l*53%110,10)},ru=({a:e,b:t,c:o=t,pattern:a="border"})=>(s,r,i)=>{if(s.fillStyle=e,s.fillRect(0,0,r,i),s.fillStyle=t,s.fillRect(14,14,r-28,10),s.fillRect(14,i-24,r-28,10),s.fillRect(14,14,10,i-28),s.fillRect(r-24,14,10,i-28),s.fillStyle=o,a==="diamond")for(let n=60;n<r-40;n+=64)for(let l=60;l<i-40;l+=64)s.beginPath(),s.moveTo(n,l-18),s.lineTo(n+18,l),s.lineTo(n,l+18),s.lineTo(n-18,l),s.closePath(),s.lineWidth=4,s.strokeStyle=o,s.stroke();else if(a==="stripes")for(let n=40;n<i-40;n+=36)s.fillRect(30,n,r-60,14);else if(a==="medallion")s.beginPath(),s.ellipse(r/2,i/2,r*.22,i*.26,0,0,7),s.fill(),s.fillStyle=e,s.beginPath(),s.ellipse(r/2,i/2,r*.12,i*.14,0,0,7),s.fill();else if(a==="glow"){s.fillStyle="rgba(255,255,255,.04)";for(let n=40;n<r;n+=40)s.fillRect(n,30,2,i-60)}};Vo=(e,t,o,a,s,r,i=5)=>{let n=new V.PointLight(t,o,i,1.5);return n.position.set(a,s,r),e.add(n),n};Zs=(e,t,o,a,s,r,i,{metal:n="#2a2a2a",flameCol:l="#ffb84a",light:h="#ff9a3c",power:f=2.4,torch:c=!1}={})=>{let p=i==="left"?a+.16:a,u=i==="left"?r:r+.16;t.add(e.rbox(i==="left"?.04:.14,.24,i==="left"?.14:.04,n,a+(i==="left"?.02:0),s-.05,r+(i==="left"?0:.02),.01,{metalness:.6,roughness:.4}));let g=e.rbox(i==="left"?.18:.03,.03,i==="left"?.03:.18,n,a+(i==="left"?.09:0),s-.12,r+(i==="left"?0:.09),.01,{metalness:.6,roughness:.4});if(t.add(g),c){let m=e.cyl(.035,.025,.36,"#5a3a22",p,s,u,null,8);m.rotation[i==="left"?"z":"x"]=i==="left"?-.3:.3,t.add(m,e.cyl(.05,.04,.08,n,p+(i==="left"?.05:0),s+.18,u+(i==="left"?0:.05),null,10)),Xr(e,t,o,p+(i==="left"?.05:0),s+.29,u+(i==="left"?0:.05),{size:.06,color:l,light:h,power:f,dist:5,ly:.1})}else t.add(e.cyl(.06,.04,.03,n,p,s-.1,u,null,12),e.cyl(.03,.03,.16,"#efe6d2",p,s,u,null,10)),Xr(e,t,o,p,s+.12,u,{size:.028,color:l,light:h,power:f,dist:4.5})},Yc=(e,t,o,a,s,r,i,n,l,h="#6b4a2a")=>{let f=kt(128,Math.round(128*i/r),l),c=e.plane(r,i,e.std("#ffffff",{map:f,transparent:!0,alphaTest:.5,side:V.DoubleSide}),o,a,s,n==="left"?Math.PI/2:0),d=e.cyl(.025,.025,r+.2,h,o,a+i/2+.02,s,null,10);n==="left"?d.rotation.x=Math.PI/2:d.rotation.z=Math.PI/2,t.add(c,d)},Kc=(e,t,o)=>(a,s,r)=>{a.fillStyle=e,a.beginPath(),a.moveTo(0,0),a.lineTo(s,0),a.lineTo(s,r),a.lineTo(s/2,r-s*.35),a.lineTo(0,r),a.closePath(),a.fill(),a.strokeStyle=t,a.lineWidth=8,a.stroke(),o(a,s,r)},Da=(e,t,o,a,s,r,i,n,l,h=3)=>t.add(e.rbox(a,s,r,e.glow(o,h),i,n,l,Math.min(a,s,r)/2)),$u={gothic(e,t,o){Zs(e,t,o,-3.35,2.5,Ce,"back",{metal:"#1a1420"}),Zs(e,t,o,_e,2.5,-2.4,"left",{metal:"#1a1420"});for(let r of[-4.95,2.3,4.95])t.add(e.rbox(.18,Be,.12,"#2a2234",r,Be/2,Ce+.06,.03));for(let r of[-3.95,-2.4,2.4])t.add(e.rbox(.12,Be,.18,"#2a2234",_e+.06,Be/2,r,.03));t.add(e.rbox(wt,.14,.12,"#2a2234",0,3.85,Ce+.06,.03),e.rbox(.12,.14,At,"#2a2234",_e+.06,3.85,0,.03)),t.add(e.ball(.09,"#e9e2cf",.25,2.27,-3.8,null,14,10),e.rbox(.1,.06,.08,"#e9e2cf",.25,2.2,-3.76,.02)),t.add(e.ball(.022,"#120a18",.22,2.28,-3.72,null,8,6),e.ball(.022,"#120a18",.28,2.28,-3.72,null,8,6));let a=kt(128,128,(r,i,n)=>{r.fillStyle="#1a0d22",r.fillRect(0,0,i,n);for(let l=0;l<8;l++)r.fillStyle=["#c0264a","#5a2a9a","#2a6ab0","#d9a62a"][l%4],r.beginPath(),r.moveTo(64,64),r.arc(64,64,58,l/8*Math.PI*2,(l+1)/8*Math.PI*2),r.fill();xt(r,64,64,18,"#d9a62a"),r.strokeStyle="#1a0d22",r.lineWidth=6;for(let l=0;l<8;l++)r.beginPath(),r.moveTo(64,64),r.lineTo(64+Math.cos(l/8*Math.PI*2)*64,64+Math.sin(l/8*Math.PI*2)*64),r.stroke()}),s=e.mesh(new V.CircleGeometry(.42,32),e.basic("#ffffff",{map:a}),3.55,3.05,Ce+.01);t.add(s,e.mesh(new V.TorusGeometry(.44,.05,8,32),e.std("#2a2234"),3.55,3.05,Ce+.03))},roman(e,t){let o="#efe9de",a=(i,n,l)=>{let h=l==="left"?_e+.12:i,f=l==="left"?n:Ce+.12;t.add(e.cyl(.14,.16,Be-.5,o,h,(Be-.5)/2+.2,f,null,16));for(let c=0;c<8;c++){let d=c/8*Math.PI*2;t.add(e.rbox(.025,Be-.6,.025,"#d8d0c0",h+Math.cos(d)*.15,(Be-.5)/2+.2,f+Math.sin(d)*.15,.01))}t.add(e.rbox(.42,.2,.42,o,h,.1,f,.03),e.rbox(.42,.16,.42,o,h,Be-.22,f,.03)),t.add(e.cyl(.2,.15,.12,o,h,Be-.36,f,null,16))};a(-3.4,0,"back"),a(2.25,0,"back"),a(0,-2.4,"left"),t.add(e.rbox(wt,.16,.22,o,0,Be-.08,Ce+.11,.03),e.rbox(.22,.16,At,o,_e+.11,Be-.08,0,.03)),t.add(e.rbox(wt,.06,.12,"#c1693c",0,Be-.2,Ce+.06,.02),e.rbox(.12,.06,At,"#c1693c",_e+.06,Be-.2,0,.02));let s=e.mesh(new V.TorusGeometry(.42,.035,8,32),e.std("#5f7a3a"),_e+.06,2.45,.5);s.rotation.y=Math.PI/2,t.add(s);for(let i=0;i<22;i++){let n=i/22*Math.PI*2;if(Math.abs(n-Math.PI*1.5)<.35)continue;let l=e.ball(.08,i%2?"#6f8f42":"#86a852",_e+.08,2.45+Math.sin(n)*.42,.5+Math.cos(n)*.42,null,8,6);l.scale.set(.4,1.4,.6),l.rotation.x=-n+(i%2?.5:-.5),t.add(l)}t.add(e.rbox(.03,.3,.06,"#c9302c",_e+.08,1.95,.42,.01),e.rbox(.03,.3,.06,"#c9302c",_e+.08,1.95,.58,.01));let r=kt(256,160,(i,n,l)=>{$o(i,n,l,[[0,"#9ad0e6"],[1,"#f2e2c4"]]),Eo(i,n,l,"#8a9a5a",[[0,110],[80,96],[170,112],[n,100]]),i.fillStyle="#c1693c",i.fillRect(110,70,40,40),i.beginPath(),i.moveTo(104,70),i.lineTo(130,52),i.lineTo(156,70),i.fill(),i.fillStyle="#efe9de";for(let h=0;h<4;h++)i.fillRect(114+h*10,76,4,34);i.fillStyle="#3d5a2a";for(let h of[40,60,210])i.beginPath(),i.ellipse(h,100,8,30,0,0,7),i.fill();i.strokeStyle="#7a2a1a",i.lineWidth=10,i.strokeRect(5,5,n-10,l-10)});t.add(e.plane(1.8,1.1,e.std("#ffffff",{map:r}),3.55,2.45,Ce+.012))},japanese(e,t){let o="#4a3020";for(let r of[-4.94,-3.25,2.25,4.94])t.add(e.rbox(.14,Be,.1,o,r,Be/2,Ce+.05,.02));for(let r of[-3.94,-2.4,2.4])t.add(e.rbox(.1,Be,.14,o,_e+.05,Be/2,r,.02));t.add(e.rbox(wt,.14,.12,o,0,3.45,Ce+.06,.02),e.rbox(.12,.14,At,o,_e+.06,3.45,0,.02));let a=e.ball(.26,e.glow("#fff0d0",.9),-3.95,3,-3.3,null,16,12);a.scale.y=1.25,t.add(a,e.cyl(.12,.12,.05,"#2a1a12",-3.95,3.34,-3.3,null,14),e.cyl(.12,.12,.05,"#2a1a12",-3.95,2.66,-3.3,null,14),e.cyl(.008,.008,.9,"#2a1a12",-3.95,3.8,-3.3,null,6)),Vo(t,"#ffd9a0",1.6,-3.95,3,-3,4);let s=e.cyl(.012,.016,.5,"#4a2a20",1.55,2.55,-3.84,null,6);s.rotation.z=-.4,t.add(s);for(let r=0;r<9;r++)t.add(e.ball(.035,r%2?"#ffb7cf":"#ffd6e3",1.55+.05+ke(0,.2),2.45+ke(0,.32),-3.84+ke(-.06,.06),null,8,6))},scandi(e,t){let o=e.geo("hex",()=>new V.CylinderGeometry(.3,.3,.2,6,1,!0)),a=e.std("#d9b98c",{side:V.DoubleSide});for(let[s,r]of[[2.2,-2.55],[2.62,-2.2]]){let i=e.mesh(o,a,_e+.11,s,r);i.rotation.z=Math.PI/2,i.rotation.x=Math.PI/6,t.add(i)}t.add(e.cyl(.07,.06,.1,"#ffffff",_e+.12,2.1,-2.55,null,14),e.ball(.09,"#6f9a6a",_e+.12,2.2,-2.55,null,10,8)),t.add(e.rbox(.12,.16,.06,"#e6b04a",_e+.1,2.56,-2.25,.02)),t.add(e.cyl(.16,.18,.04,"#2b2b2b",-4.72,.02,2.6,null,20),e.cyl(.018,.018,1.7,"#2b2b2b",-4.72,.87,2.6,null,8),e.cyl(.1,.24,.24,"#2b2b2b",-4.6,1.78,2.6,{side:V.DoubleSide},20),e.ball(.06,e.glow("#fff4dc",2),-4.6,1.7,2.6,null,10,8)),Vo(t,"#fff0d6",1.4,-4.4,1.6,2.4,5),t.add(e.rbox(2.08,.1,.5,"#c9b9a0",3.55,.66,-1.35,.04))},cyberpunk(e,t,o){Da(e,t,"#ff2fd0",wt,.04,.04,0,.08,Ce+.04),Da(e,t,"#00e5ff",.04,.04,At,_e+.04,.08,0),Da(e,t,"#00e5ff",wt,.04,.04,0,3.7,Ce+.04),Da(e,t,"#ff2fd0",.04,.04,At,_e+.04,3.7,0),Da(e,t,"#9b5cff",.05,Be,.05,_e+.05,Be/2,Ce+.05);let a=kt(512,192,(n,l,h)=>{n.clearRect(0,0,l,h),n.font="bold 128px sans-serif",n.textAlign="center",n.textBaseline="middle",n.shadowColor="#ff2fd0",n.shadowBlur=28,n.fillStyle="#ffd0f4",n.fillText("7ots",l/2,h/2+6),n.shadowBlur=10,n.fillText("7ots",l/2,h/2+6)}),s=new V.MeshBasicMaterial({map:a,transparent:!0,depthWrite:!1,toneMapped:!1});t.add(e.plane(2.2,.82,s,_e+.07,2.5,.5,Math.PI/2));let r=Vo(t,"#ff2fd0",3,-4.3,2.4,.5,5);o.push(n=>{let l=Math.sin(n*.0021)>-.96||Math.sin(n*.05)>0;s.opacity=l?1:.35,r.intensity=l?3:1}),Vo(t,"#00e5ff",2.4,3.5,2.6,-1.4,6);let i=kt(128,256,(n,l,h)=>{n.fillStyle="#0b0618",n.fillRect(0,0,l,h),n.fillStyle="#00e5ff",n.font="bold 34px sans-serif",n.textAlign="center";for(let[f,c]of["\u30CD","\u30AA","\u30F3"].entries())n.fillText(c,l/2,70+f*60);n.strokeStyle="#00e5ff",n.lineWidth=4,n.strokeRect(10,10,l-20,h-20)});t.add(e.plane(.6,1.2,e.basic("#ffffff",{map:i}),4.4,2.6,Ce+.012))},beach(e,t){let o=e.ball(.5,"#ffcf4a",_e+.12,1.1,-2.42,null,20,14);o.scale.set(.08,2.1,.5),o.rotation.z=-.12,t.add(o);let a=e.ball(.5,"#ff6f61",_e+.15,1.1,-2.42,null,20,14);a.scale.set(.08,2,.12),a.rotation.z=-.12,t.add(a);let s=e.mesh(new V.TorusGeometry(.3,.09,12,32),e.std("#ffffff"),3.55,2.5,Ce+.1);t.add(s);for(let i=0;i<4;i++){let n=e.mesh(new V.TorusGeometry(.3,.095,12,6,Math.PI/4),e.std("#ef4444"),3.55,2.5,Ce+.1);n.rotation.z=i*Math.PI/2,t.add(n)}t.add(e.ball(.07,"#ffd7c2",.3,2.22,-3.8,null,10,8),e.ball(.05,"#fff1e0",.45,2.21,-3.78,null,10,8));let r=e.mesh(new V.CylinderGeometry(.11,.11,.03,5),e.std("#ff8a5b"),.75,2.2,-3.8);t.add(r);for(let i=0;i<9;i++){let n=Je-1.4+i*.35,l=3.6-Math.sin(i/8*Math.PI)*.18;t.add(e.ball(.04,e.glow(i%2?"#ffe28a":"#ffffff",1.6),n,l,Ce+.08,null,8,6))}},cabin(e,t,o){let s=kt(256,256,Us({cols:["#8a8378","#7a7368","#9a9488","#6e675e"],grout:"#4a453f",rows:7,minW:40,maxW:80}));s.wrapS=s.wrapT=V.RepeatWrapping,s.repeat.set(.8,Be*.8);let r=e.std("#ffffff",{map:s});t.add(e.mesh(new V.BoxGeometry(1,Be,.3),r,-3.3,Be/2,Ce+.15)),t.add(e.rbox(1.16,.1,.42,"#5a3a22",-3.3,1.2,Ce+.2,.02)),t.add(e.mesh(new V.BoxGeometry(.62,.55,.05),e.std("#120a06"),-3.3,.45,Ce+.29)),t.add(e.rbox(1.12,.08,.5,"#6e675e",-3.3,.04,Ce+.3,.02));for(let l of[.22,.3]){let h=e.cyl(.05,.05,.5,"#5a3a22",-3.3,.24,Ce+l,null,10);h.rotation.z=Math.PI/2,h.rotation.y=l>.25?.3:-.3,t.add(h)}let i=[];for(let[l,h,f]of[[-.12,.3,"#ff7a1a"],[.1,.26,"#ff9a2a"],[0,.38,"#ffcf4a"]]){let c=e.mesh(e.geo(`cone${h}`,()=>new V.ConeGeometry(.08,h,10)),e.basic(f),-3.3+l,.3+h/2,Ce+.24);t.add(c),i.push([c,h])}let n=Vo(t,"#ff8a3a",3.2,-3.3,.6,Ce+.7,6);o.push(l=>{let h=1+Math.sin(l*.017)*.12+Math.sin(l*.041)*.08;n.intensity=3.2*h,i.forEach(([f],c)=>f.scale.set(1,h+Math.sin(l*.02+c)*.1,1))}),t.add(e.rbox(.03,.4,.5,"#5a3a22",_e+.03,2.5,-2.4,.01));for(let l of[-1,1])for(let h=0;h<3;h++){let f=e.cyl(.018,.025,.32-h*.06,"#e9dcc0",_e+.15+h*.03,2.62+h*.12,-2.4+l*(.1+h*.09),null,6);f.rotation.x=l*(.6+h*.25),t.add(f)}},space(e,t,o){Da(e,t,"#5ce1ff",wt,.03,.03,0,3.6,Ce+.04,2.5),Da(e,t,"#5ce1ff",.03,.03,At,_e+.04,3.6,0,2.5),t.add(e.rbox(.08,.7,1,"#3b4552",_e+.04,1.9,-2.4,.03,{metalness:.6,roughness:.35}));let a=[];for(let r=0;r<4;r++)for(let i=0;i<3;i++){let n=e.ball(.03,e.basic(["#5ce1ff","#ff6b6b","#7dff8a"][(r+i)%3],{transparent:!0}),_e+.09,1.72+i*.16,-2.75+r*.22,null,8,6);n.material=n.material.clone(),t.add(n),a.push(n)}o.push(r=>{a.forEach((i,n)=>{i.material.opacity=Math.sin(r*.004+n*1.7)>0?1:.25})});for(let r of[-3.2,-3.5]){let i=e.cyl(.05,.05,wt,"#8a95a3",0,3.95,r,{metalness:.7,roughness:.3},12);i.rotation.z=Math.PI/2,t.add(i)}let s=kt(256,160,(r,i,n)=>{r.fillStyle="#06101e",r.fillRect(0,0,i,n),r.strokeStyle="rgba(92,225,255,.25)";for(let l=0;l<i;l+=32)r.beginPath(),r.moveTo(l,0),r.lineTo(l,n),r.stroke();for(let l=0;l<n;l+=32)r.beginPath(),r.moveTo(0,l),r.lineTo(i,l),r.stroke();r.strokeStyle="#5ce1ff",r.lineWidth=2,r.beginPath(),r.ellipse(128,80,90,40,0,0,7),r.stroke(),r.beginPath(),r.ellipse(128,80,50,22,0,0,7),r.stroke(),xt(r,128,80,10,"#ffd36b"),xt(r,218,80,5,"#ff8a5b"),xt(r,160,59,4,"#7dff8a")});t.add(e.rbox(1.9,1.1,.06,"#3b4552",3.55,2.5,Ce+.03,.03,{metalness:.6,roughness:.35}),e.plane(1.76,.96,e.basic("#ffffff",{map:s}),3.55,2.5,Ce+.065))},castle(e,t,o){Zs(e,t,o,-3.35,2.2,Ce,"back",{torch:!0,metal:"#2a2420"}),Zs(e,t,o,_e,2.2,-2.4,"left",{torch:!0,metal:"#2a2420"});let a=(r,i,n)=>{r.fillStyle="#e8c35a",r.beginPath(),r.moveTo(i/2,n*.22),r.lineTo(i*.78,n*.32),r.lineTo(i*.72,n*.55),r.lineTo(i/2,n*.66),r.lineTo(i*.28,n*.55),r.lineTo(i*.22,n*.32),r.fill(),r.fillStyle="#7a1a1a",r.fillRect(i/2-4,n*.3,8,n*.3),r.fillRect(i*.32,n*.4,i*.36,8)};Yc(e,t,2.95,2.55,Ce+.02,.7,1.5,"back",Kc("#8e1b1b","#e8c35a",a)),Yc(e,t,4.15,2.55,Ce+.02,.7,1.5,"back",Kc("#1f3c8a","#e8c35a",a));let s=e.cyl(.42,.42,.06,"#1f3c8a",_e+.06,2.45,.5,{metalness:.2,roughness:.6},32);s.rotation.z=Math.PI/2,s.scale.set(1,1,1),t.add(s,e.mesh(new V.TorusGeometry(.42,.04,8,32),e.std("#c9a64a",{metalness:.8,roughness:.3}),_e+.1,2.45,.5)),t.children[t.children.length-1].rotation.y=Math.PI/2,t.add(e.rbox(.03,.5,.08,"#e8c35a",_e+.1,2.45,.5,.01),e.rbox(.03,.08,.5,"#e8c35a",_e+.1,2.5,.5,.01));for(let r of[-1,1]){let i=e.rbox(.03,1.3,.06,"#c8ccd2",_e+.04,2.45,.5,.01,{metalness:.9,roughness:.2});i.rotation.x=r*.7,t.add(i);let n=e.rbox(.04,.05,.3,"#7a5a2a",_e+.05,2.45-Math.cos(.7)*.5,.5-r*Math.sin(.7)*.5,.01);n.rotation.x=r*.7,t.add(n)}t.add(e.rbox(wt,.2,.16,"#4a3020",0,3.9,Ce+.08,.02),e.rbox(.16,.2,At,"#4a3020",_e+.08,3.9,0,.02))}},gu={bg:"#2a1f55",light:{hemi:["#e8ecff","#40304e",.56],amb:["#ffe9d6",.25],key:1,env:.45,exposure:1.05},floor:{paint:Kr({base:"#b97f52",a:"#c38a5c",b:"#b07649",seam:"rgba(60,30,10,.35)",grain:"80,40,15"}),repeat:[2.5,2],rough:.7,metal:0},wall:{back:"#b6a3ea",left:"#a895e0",paint:null,tile:2.5},wains:{back:"#8a76cf",left:"#7f6bc6",rail:"#f4efff",h:1.1,paint:null,railGlow:0},win:{shape:"rect",bars:"cross",frame:"#fbf8ff",sky:_o.cozy,curtain:"#ff9fb8",curtainH:0,curtainY:0,rod:null,shaft:"#ffe2a8",shaftOp:.22,patch:"#ffd49a",patchOp:.55,dust:"#fff3d0",sun:["#ffd9a0",1.3]},sofa:{kind:"sofa",a:"#3aa6a0",b:"#5cc4bd",pillow:"#ffd23f"},art:{frame:"#fbf8ff",items:[[-.2,"#ff8fb1",.9,.7],[1,"#7ee0c3",.7,.9]]},table:{kind:"table",top:"#e8d5b5",leg:"#c9b38f",candle:"#fff6e6",flame:"#ffcf6b",light:"#ffb35c",power:2.2,orb:null},rug:{shape:"circle",a:"#d9739b",b:"#ffd0e0"},bed:{frame:"#8a5a3b",head:"#7a4d31",sheet:"#fbf8ff",blanket:"#8b7bff",pillow:"#ffffff"},desk:{top:"#e9d8bd",leg:"#cfbd9f",dark:"#2b2440",screenKind:"monitor",screen:{bg:"#1c1550",ink:"#ffd23f",dots:["#8b7bff","#7ee0c3","#ff8fb1","#8fd3ff"]},lamp:"lamp",lampColor:"#ffd23f",lampLight:"#ffd08a"},shelf:{board:"#e9d8bd",books:[[.36,"#ef4444"],[.42,"#3b82f6"],[.32,"#ffd23f"],[.4,"#7ee0c3"],[.3,"#a855f7"],[.38,"#f97316"]],vase:"#fbf8ff"},plant:{kind:"leafy",pot:"#d9774b",leaves:["#58b86c","#3f9d55"]}},Ys={cozy:{emoji:"\u{1F3E0}"},gothic:{emoji:"\u{1F987}",bg:"#120a1c",light:{hemi:["#b8a8ff","#2a1020",.36],amb:["#c9a0ff",.14],key:.55,env:.3,exposure:1.1},floor:{paint:Kr({base:"#2e1f1c",a:"#3a2722",b:"#2a1b18",seam:"rgba(0,0,0,.5)",grain:"0,0,0",n:8}),rough:.55},wall:{back:"#8f8aa0",left:"#7c7790",paint:Us({cols:["#5c566a","#534d60","#665f74","#4c4658"],grout:"#2c2836",rows:6}),tile:2.2},wains:{back:"#3a1a2a",left:"#321624",rail:"#2a2234",h:.9},win:{shape:"pointed",frame:"#2a2234",sky:_o.gothic,curtain:"#8e1030",curtainH:2.9,curtainY:2.05,rod:"#c9a64a",shaft:"#b9b8ff",shaftOp:.18,patch:"#a7a6ff",patchOp:.4,dust:"#d8d0ff",sun:["#9aa0ff",1]},sofa:{kind:"sofa",a:"#4a1a5c",b:"#5e2470",pillow:"#a3122e",backH:1.45,tufts:"#c9a64a",legs:"#c9a64a",r:.08},art:{frame:"#c9a64a",frameMetal:!0,items:[[-.2,"#000",.7,.9,(e,t,o)=>{$o(e,t,o,[[0,"#2a1830"],[1,"#100812"]]),xt(e,t/2,o*.38,t*.2,"#d8c6b0"),e.fillStyle="#1a0d14",e.fillRect(t*.25,o*.55,t*.5,o*.5)}],[1.15,"#000",.7,.9,(e,t,o)=>{$o(e,t,o,[[0,"#2e1a1a"],[1,"#0c0608"]]),xt(e,t/2,o*.4,t*.18,"#cdb8a8"),e.fillStyle="#5a0f1f",e.fillRect(t*.22,o*.56,t*.56,o*.5)}]]},table:{top:"#2a1b18",leg:"#c9a64a",candle:"#efe6d2",flame:"#ffb84a",light:"#ff9a3c",power:2.6},rug:{shape:"rect",a:"#5a0f1f",b:"#c9a64a",c:"#3a0814",pattern:"medallion"},bed:{frame:"#2a1b18",head:"#1f1412",sheet:"#d8cfe0",blanket:"#5a0f1f",pillow:"#e8e0ec",headH:1.6,posts:"#1f1412",postH:2.75,drape:"#4a1a5c",finial:"#c9a64a"},desk:{top:"#2e1f1c",leg:"#1f1412",legW:.1,dark:"#c9a64a",screenKind:"mirror",screen:{bg:"#170b22",ink:"#c9a64a",dots:["#a3122e","#7a4cff","#c9a64a","#d8d0ff"],font:"italic bold 24px serif"},lamp:"candles",lampColor:"#c9a64a",lampLight:"#ffad5c"},shelf:{board:"#2e1f1c",books:[[.36,"#3a0814"],[.42,"#1f1430"],[.34,"#2a2a1a"],[.4,"#5a0f1f"],[.3,"#1a2a2a"],[.38,"#3a1a4a"]],vase:null},plant:{kind:"leafy",pot:"#1f1a24",potMetal:!0,leaves:["#1f3a2a","#2a4a30"],flowers:"#b0102e",n:9}},roman:{emoji:"\u{1F3DB}\uFE0F",bg:"#2a2030",light:{hemi:["#fff6e6","#6a5040",.62],amb:["#fff0dc",.3],key:1.05,env:.5,exposure:1.05},floor:{paint:Ff({a:"#efe6d6",b:"#c1693c",n:8,vein:"#9a8a78",grout:"rgba(80,50,30,.35)"}),repeat:[2.5,2],rough:.45},wall:{back:"#ffffff",left:"#ece6dc",paint:Zf("#f3ece0","#b8a890"),tile:3},wains:{back:"#ffffff",left:"#eeeeee",rail:"#efe9de",h:1,paint:ou("#a8452a","#efe2c4")},win:{shape:"arch",bars:"none",frame:"#efe9de",sky:_o.roman,curtain:null,shaft:"#fff0c8",shaftOp:.24,patch:"#ffe6b0",patchOp:.55,dust:"#fff6dc",sun:["#fff0c8",1.4]},sofa:{kind:"bench",frame:"#e8e1d4",a:"#a8452a",b:"#c1693c",pillow:null,bolster:"#d4a64a",trim:"#c9a64a"},art:{items:[]},table:{top:"#e8e1d4",leg:"#c9a64a",candle:"#f3ead6",flame:"#ffcf6b",light:"#ffb35c",power:2.2},rug:{shape:"rect",a:"#efe2c4",b:"#a8452a",c:"#c1693c",pattern:"medallion"},bed:{frame:"#e8e1d4",head:"#d8d0c0",sheet:"#fbf8f0",blanket:"#a8452a",pillow:"#d4a64a",stripe:"#d4a64a",r:.05},desk:{top:"#ece6dc",leg:"#c9a64a",dark:"#c9a64a",screenKind:"mirror",screen:{bg:"#3a2418",ink:"#e8c35a",dots:["#c1693c","#86a852","#efe2c4","#e8c35a"],font:"bold 22px serif"},lamp:"oil",lampColor:"#b8862a",lampLight:"#ffcf8a"},shelf:{board:"#ece6dc",books:[[.3,"#e9dcb8"],[.3,"#d9c9a0"],[.3,"#e9dcb8"],[.3,"#d9c9a0"]],vase:"#c1693c"},plant:{kind:"topiary",potKind:"amphora",pot:"#b8582e",leaves:["#4e6e2e","#6f8f42"],berries:"#2a2a40"}},japanese:{emoji:"\u{1F3EF}",bg:"#1e1a24",light:{hemi:["#fff4e6","#5a4a3a",.58],amb:["#ffeedd",.28],key:1,env:.45,exposure:1.05},floor:{paint:Wf,repeat:[3,2.4],rough:.9},wall:{back:"#ffffff",left:"#ece4d4",paint:tu("#efe4cc"),tile:2.5},wains:{back:"#5a3b26",left:"#4e3320",rail:"#4a3020",h:.3},win:{shape:"rect",bars:"grid",frame:"#4a3020",sky:_o.japanese,curtain:null,shaft:"#ffd9c8",shaftOp:.22,patch:"#ffd0b8",patchOp:.5,dust:"#fff0e8",sun:["#ffd6c0",1.3]},sofa:{kind:"bench",frame:"#5a3b26",a:"#2c3e6b",b:"#34497a",pillow:"#c0392b",back:1.2},art:{frame:"#3a2418",items:[[.5,"#000",.6,1.5,(e,t,o)=>{e.fillStyle="#f4ecd8",e.fillRect(0,0,t,o),e.fillStyle="#7a8a6a",e.fillRect(0,0,t,14),e.fillRect(0,o-14,t,14),e.fillStyle="rgba(30,30,40,.75)",e.beginPath(),e.moveTo(10,o*.7),e.lineTo(46,o*.45),e.lineTo(70,o*.58),e.lineTo(100,o*.36),e.lineTo(t-6,o*.7),e.fill(),xt(e,t*.7,o*.24,12,"#c0392b"),e.fillStyle="#222",e.font="bold 30px serif",e.textAlign="center",e.fillText("\u548C",t/2,o*.86)},2.2]]},table:{top:"#4a3020",leg:"#3a2418",candle:"#f4ecd8",flame:"#ffcf6b",light:"#ffb35c",power:2},rug:{shape:"rect",a:"#2c3e6b",b:"#e9e0c8",c:"#3a5080",pattern:"border"},bed:{frame:"#5a3b26",head:"#4a3020",sheet:"#f6f1e6",blanket:"#2c3e6b",pillow:"#e9e0c8",headH:.8,stripe:"#e9e0c8",r:.03},desk:{top:"#5a3b26",leg:"#3a2418",legW:.08,dark:"#2a1a12",screen:{bg:"#f4ecd8",ink:"#c0392b",dots:["#2c3e6b","#7a8a6a","#c0392b","#d9a62a"],line:"rgba(40,30,20,.45)"},lamp:"lantern",lampColor:"#2a1a12",lampGlow:"#fff1d0",lampLight:"#ffd9a0"},shelf:{board:"#5a3b26",books:[[.3,"#2c3e6b"],[.34,"#c0392b"],[.28,"#e9e0c8"]],vase:"#2a2a30"},plant:{kind:"bonsai",potKind:"stand",stand:"#4a3020",pot:"#2a3a4a",leaves:["#3e6a3a","#4f7d45"],trunk:"#5a3b26"}},scandi:{emoji:"\u{1F33F}",bg:"#2a2e36",light:{hemi:["#f4f7ff","#6a6a70",.66],amb:["#ffffff",.32],key:1.05,env:.55,exposure:1.05},floor:{paint:Kr({base:"#d9bf98",a:"#e2caa6",b:"#d4b88f",seam:"rgba(120,90,60,.25)",grain:"140,100,60",n:8}),rough:.65},wall:{back:"#f1efe9",left:"#e6e3dc"},wains:null,win:{shape:"rect",bars:"cross",frame:"#2b2b2b",sky:_o.scandi,curtain:"#e8e2d6",shaft:"#f0f6ff",shaftOp:.2,patch:"#eef4ff",patchOp:.45,dust:"#ffffff",sun:["#eef4ff",1.2]},sofa:{kind:"sofa",a:"#9aa3a8",b:"#aeb6ba",pillow:"#e6b04a",legs:"#c9a273",r:.08},art:{frame:"#2b2b2b",items:[[-.25,"#000",.7,.95,(e,t,o)=>{e.fillStyle="#f4efe6",e.fillRect(0,0,t,o),xt(e,t/2,o*.42,t*.26,"#e6b04a"),e.fillStyle="#6f8f86",e.fillRect(0,o*.62,t,o*.38)}],[.95,"#000",.7,.95,(e,t,o)=>{e.fillStyle="#ece6dc",e.fillRect(0,0,t,o),e.strokeStyle="#2b2b2b",e.lineWidth=3,e.beginPath(),e.arc(t/2,o*.75,t*.32,Math.PI,0),e.stroke(),e.beginPath(),e.moveTo(t*.2,o*.3),e.bezierCurveTo(t*.4,o*.1,t*.6,o*.5,t*.8,o*.3),e.stroke(),e.fillStyle="#c96f4a",e.beginPath(),e.arc(t*.68,o*.55,10,0,7),e.fill()}]]},table:{top:"#d9b98c",leg:"#2b2b2b",candle:"#ffffff",flame:"#ffcf6b",light:"#ffc27a",power:2},rug:{shape:"rect",a:"#f0ebe0",b:"#2b2b2b",c:"#2b2b2b",pattern:"diamond"},bed:{frame:"#d9b98c",head:"#cfae80",sheet:"#ffffff",blanket:"#9cb3a0",pillow:"#f2f2f2",headH:1},desk:{top:"#f4f4f2",leg:"#d9b98c",dark:"#2b2b2b",screen:{bg:"#2f3640",ink:"#e6b04a",dots:["#9cb3a0","#e6b04a","#c96f4a","#aeb6ba"]},lamp:"lamp",lampColor:"#2b2b2b",lampLight:"#fff0d6"},shelf:{board:"#d9b98c",books:[[.36,"#e8e2d6"],[.42,"#9cb3a0"],[.32,"#2b2b2b"],[.4,"#c96f4a"],[.3,"#aeb6ba"]],vase:"#ffffff"},plant:{kind:"leafy",pot:"#f4f4f2",leaves:["#2e5a3a","#3e7048"],leafScale:[.9,1.6,.18],n:8}},cyberpunk:{emoji:"\u{1F303}",bg:"#07040f",light:{hemi:["#8a7bff","#200a30",.3],amb:["#9a7bff",.12],key:.45,env:.25,exposure:1.1},floor:{paint:Yf,repeat:[2.5,2],rough:.35,metal:.3},wall:{back:"#ffffff",left:"#d8d8e8",paint:eu("#2a2438"),tile:2.5},wains:{back:"#16121f",left:"#13101c",rail:"#00e5ff",h:.5,railGlow:2.5},win:{shape:"rect",bars:"grid",frame:"#1a1626",sky:_o.cyberpunk,curtain:null,shaft:"#ff6fd8",shaftOp:.16,patch:"#ff4fd8",patchOp:.35,dust:"#9ff6ff",sun:["#d06cff",.9]},sofa:{kind:"sofa",a:"#1e1a2e",b:"#2a2440",pillow:"#00e5ff",r:.16,glow:"#ff2fd0"},art:{items:[]},table:{top:"#1a1626",leg:"#3a3550",orb:"#00e5ff",light:"#00e5ff",power:2},rug:{shape:"circle",a:"#140d2a",b:"#ff2fd0",glow:!0},bed:{frame:"#1a1626",head:"#221d33",sheet:"#2a2440",blanket:"#3a1f6e",pillow:"#5a4a8a",r:.14,glow:"#00e5ff",headH:1},desk:{top:"#1a1626",leg:"#3a3550",dark:"#2a2438",screenKind:"holo",screen:{bg:"#001a24",ink:"#00e5ff",dots:["#ff2fd0","#00e5ff","#ffe36b","#9b5cff"],line:"rgba(0,229,255,.6)"},lamp:"neon",lampColor:"#ff2fd0",lampLight:"#ff4fd8"},shelf:{board:"#2a2438",books:[[.36,"#ff2fd0"],[.42,"#1e1a2e"],[.32,"#00e5ff"],[.4,"#2a2440"],[.3,"#9b5cff"]],vase:null},plant:{kind:"leafy",pot:"#1e1a2e",potMetal:!0,leaves:["#00ffa3","#00c2ff"],glow:.9}},beach:{emoji:"\u{1F3D6}\uFE0F",bg:"#123a4a",light:{hemi:["#f0fbff","#8a7a5a",.66],amb:["#fff8e8",.32],key:1.05,env:.55,exposure:1.05},floor:{paint:Kr({base:"#d8c3a0",a:"#e3d0ae",b:"#cfb994",seam:"rgba(120,90,60,.3)",grain:"150,120,80",n:8}),rough:.8},wall:{back:"#ffffff",left:"#e8f2f2",paint:Xf("#bfe6e0","rgba(60,110,110,.25)"),tile:2},wains:{back:"#f4efe4",left:"#e8e2d6",rail:"#ffffff",h:1},win:{shape:"rect",bars:"cross",frame:"#ffffff",sky:_o.beach,curtain:"#f6ecd8",shaft:"#fff2c0",shaftOp:.26,patch:"#ffe8a8",patchOp:.55,dust:"#fffbe6",sun:["#fff0c0",1.45]},sofa:{kind:"bench",frame:"#c8a26a",a:"#f4efe4",b:"#5fc4c0",pillow:"#ff6f61",back:1.1},art:{frame:"#ffffff",items:[[.5,"#000",1.3,.8,(e,t,o)=>{$o(e,t,o,[[0,"#8fd3ff"],[.55,"#d8f2ff"],[.56,"#2ab0c6"],[1,"#5fe0d6"]]),xt(e,t*.75,o*.3,10,"#fff2b0"),e.fillStyle="#ffffff",e.beginPath(),e.moveTo(t*.3,o*.55),e.lineTo(t*.36,o*.2),e.lineTo(t*.42,o*.55),e.fill(),e.fillStyle="#7a4a2a",e.fillRect(t*.25,o*.55,t*.22,5)}]]},table:{kind:"table",top:"#c8a26a",leg:"#a8824a",candle:"#ffffff",flame:"#ffcf6b",light:"#ffb35c",power:2},rug:{shape:"rect",a:"#f6ecd8",b:"#2a9db0",c:"#5fc4c0",pattern:"stripes"},bed:{frame:"#e8e2d6",head:"#f4efe4",sheet:"#ffffff",blanket:"#5fc4c0",pillow:"#ffe0d0",stripe:"#ff6f61"},desk:{top:"#e3d0ae",leg:"#c8a26a",dark:"#2a3a44",screen:{bg:"#0f4a5a",ink:"#ffe28a",dots:["#ff6f61","#5fc4c0","#ffe28a","#ffffff"]},lamp:"lamp",lampColor:"#ff6f61",lampLight:"#ffe0b0"},shelf:{board:"#c8a26a",books:[[.36,"#2a9db0"],[.32,"#f6ecd8"],[.4,"#ff6f61"]],vase:"#5fc4c0"},plant:{kind:"palm",pot:"#c8a26a",leaves:["#2f8a4a","#45a85a"],trunk:"#9a7a4a"}},cabin:{emoji:"\u{1FAB5}",bg:"#1a1210",light:{hemi:["#ffe8d0","#40281a",.46],amb:["#ffd8b0",.2],key:.8,env:.38,exposure:1.08},floor:{paint:Kr({base:"#5a3a24",a:"#6a442a",b:"#4e321f",seam:"rgba(20,10,0,.55)",grain:"20,10,0",n:6}),rough:.7},wall:{back:"#ffffff",left:"#e6dcd0",paint:Kf({cols:["#9a6a3e","#8a5c34","#a67444"]}),tile:2.1},wains:null,win:{shape:"rect",bars:"cross",frame:"#5a3a22",sky:_o.cabin,curtain:"#a8302a",rod:"#3a2418",shaft:"#ffc8a0",shaftOp:.16,patch:"#ffb890",patchOp:.4,dust:"#ffe6d0",sun:["#ffb890",.9]},sofa:{kind:"sofa",a:"#7a4a2a",b:"#8a5634",pillow:"#a8302a",r:.1,legs:"#3a2418"},art:{frame:"#5a3a22",items:[[.5,"#000",1.2,.8,_o.cabin]]},table:{kind:"stump",top:"#7a5434",leg:"#c9a273",candle:"#f4ead6",flame:"#ffcf6b",light:"#ffb35c",power:2.2},rug:{shape:"oval",a:"#e8dcc4",b:"#a8302a"},bed:{frame:"#6a442a",head:"#5a3a22",sheet:"#f4ead6",blanket:"#a8302a",pillow:"#f4ead6",stripe:"#2a2a2a",posts:"#6a442a",postH:1.5,finial:"#6a442a"},desk:{top:"#6a442a",leg:"#4e321f",legW:.1,dark:"#2a1a12",screen:{bg:"#20140e",ink:"#ffcf6b",dots:["#a8302a","#6f9a5a","#e8dcc4","#ffcf6b"]},lamp:"lantern",lampColor:"#2a2a2a",lampGlow:"#ffd8a0",lampLight:"#ffb870"},shelf:{board:"#6a442a",books:[[.36,"#7a2a20"],[.42,"#2f4a3a"],[.32,"#c9a273"],[.4,"#5a3a22"],[.3,"#a8302a"]],vase:"#e8dcc4"},plant:{kind:"leafy",potKind:"barrel",pot:"#7a5434",leaves:["#2f5a34","#3e6e40","#285030"],leafScale:[.35,1.9,.2],n:13}},space:{emoji:"\u{1F680}",bg:"#05060f",light:{hemi:["#dfeaff","#1a2030",.45],amb:["#cfe4ff",.18],key:.8,env:.5,exposure:1.05},floor:{paint:Uf({base:"#4a525c",light:"#6b747f",seam:"#2a3038",rivet:"#8a949f"}),repeat:[2.5,2],rough:.4,metal:.55},wall:{back:"#ffffff",left:"#e2e8ef",paint:Jf({base:"#c9d2dc",line:"#8a95a3",dark:"#3b4552"}),tile:2.5},wains:{back:"#3b4552",left:"#343d49",rail:"#5ce1ff",h:.6,railGlow:2},win:{shape:"round",frame:"#9aa5b2",plate:"#5a6470",sky:_o.space,curtain:null,shaft:"#9fd8ff",shaftOp:.1,patch:"#9fd8ff",patchOp:.25,dust:"#cfeaff",sun:["#bfe0ff",.8]},sofa:{kind:"sofa",a:"#e8edf2",b:"#3b4b63",pillow:"#ff8a3c",r:.18,glow:"#5ce1ff"},art:{items:[]},table:{top:"#d0d8e2",leg:"#7a8592",orb:"#5ce1ff",light:"#5ce1ff",power:2},rug:{shape:"circle",a:"#2a3240",b:"#5ce1ff",glow:!0},bed:{frame:"#e8edf2",head:"#d0d8e2",sheet:"#f4f8fc",blanket:"#3b4b63",pillow:"#ffffff",r:.16,glow:"#5ce1ff",stripe:"#ff8a3c"},desk:{top:"#e8edf2",leg:"#7a8592",dark:"#3b4552",screenKind:"holo",screen:{bg:"#02121e",ink:"#5ce1ff",dots:["#ff8a3c","#7dff8a","#5ce1ff","#ffd36b"],line:"rgba(92,225,255,.6)"},lamp:"neon",lampColor:"#5ce1ff",lampLight:"#9fe8ff"},shelf:{board:"#9aa5b2",books:[[.3,"#3b4b63"],[.3,"#e8edf2"],[.3,"#ff8a3c"],[.3,"#3b4b63"]],vase:null},plant:{kind:"crystal",pot:"#7a8592",potMetal:!0,leaves:["#c77dff","#5ce1ff"]}},castle:{emoji:"\u{1F3F0}",bg:"#141218",light:{hemi:["#f0e8ff","#3a2a20",.46],amb:["#ffe2c0",.2],key:.85,env:.38,exposure:1.08},floor:{paint:Us({cols:["#77726a","#6a655e","#827c73","#5f5a54"],grout:"#3a3632",rows:4,minW:90,maxW:170}),repeat:[2.5,2],rough:.85},wall:{back:"#ffffff",left:"#e0dcd6",paint:Us({cols:["#9a958c","#8d8880","#a6a198","#857f77"],grout:"#5a5650",rows:7}),tile:2.2},wains:null,win:{shape:"arch",bars:"cross",frame:"#6a655e",sky:_o.castle,curtain:null,shaft:"#fff0d0",shaftOp:.22,patch:"#ffe6b8",patchOp:.5,dust:"#fff3d8",sun:["#ffe8c0",1.25]},sofa:{kind:"bench",frame:"#5a3a22",a:"#8e1b1b",b:"#a32424",pillow:"#e8c35a",back:1.6},art:{items:[]},table:{top:"#5a3a22",leg:"#3a2418",candle:"#efe6d2",flame:"#ffb84a",light:"#ff9a3c",power:2.4},rug:{shape:"rect",a:"#8e1b1b",b:"#e8c35a",c:"#6a1010",pattern:"border"},bed:{frame:"#5a3a22",head:"#4a3020",sheet:"#efe6d2",blanket:"#1f3c8a",pillow:"#efe6d2",stripe:"#e8c35a",posts:"#4a3020",postH:2.7,drape:"#1f3c8a",finial:"#e8c35a",headH:1.5},desk:{top:"#5a3a22",leg:"#3a2418",legW:.12,dark:"#8a6a2a",screenKind:"mirror",screen:{bg:"#2a1c10",ink:"#e8c35a",dots:["#8e1b1b","#1f3c8a","#e8c35a","#86b860"],font:"bold 22px serif"},lamp:"candles",lampColor:"#8a6a2a",lampLight:"#ffad5c"},shelf:{board:"#5a3a22",books:[[.36,"#5a1a10"],[.42,"#1f2c5a"],[.34,"#4a3a20"],[.4,"#2a4a2a"]],vase:"#c9a64a"},plant:{kind:"topiary",potKind:"barrel",pot:"#6a442a",leaves:["#3e5a2e","#4f6e38"],berries:"#c0392b"}}},kn=Object.entries(Ys).map(([e,t])=>({id:e,emoji:t.emoji})),Ks="cozy",yu=e=>{let t=Ys[e]||Ys.cozy,o={};for(let[a,s]of Object.entries(gu))t[a]===null?o[a]=null:s&&typeof s=="object"&&!Array.isArray(s)?o[a]={...s,...t[a]}:o[a]=t[a]??s;return o}});var bu,wu,xu,ku,vu,vn=Ye(()=>{Qe();bu={creator:{stepOf:"Paso {n} de {total}",steps:{body:"Cuerpo",face:"Cara",paint:"Pintar",acc:"Accesorios"},tabs:{shape:"Forma",style:"Estilo",color:"Color",finish:"Acabado",preset:"Plantillas",eyes:"Ojos",brows:"Cejas",mouth:"Boca",cheeks:"Mejillas",pattern:"Patr\xF3n",texture:"Textura"},bodyColor:"Color del cuerpo",eyeColor:"Color de los ojos",adjust:"Ajustes",size:"Tama\xF1o",spacing:"Separaci\xF3n",height:"Altura",color:"Color",patternColor:"Color del patr\xF3n",otherColor:"Otro color",back:"\u2190 Atr\xE1s",next:"Siguiente \u2192",play:"Jugar",playNext:"\u25B6 Jugar",random:"Sorpr\xE9ndeme",undo:"Deshacer",clearAll:"Quitar todos ({n})",modBody:"Lleva el cuerpo 3D \xAB{name}\xBB (un mod), que tapa el ot. Al editar cualquier cosa aqu\xED se lo quitas (puedes deshacer).",modRemove:"Quitar el cuerpo 3D",drag:"Arrastra para girarlo",empty:"Nada por aqu\xED."},room:{auto:"Solo",control:"Controlar",edit:"Editar",message:"Mensaje",messageHint:"Simula un mensaje entrante",keys:"WASD o flechas \xB7 clic en el suelo para ir \xB7 Espacio saltar \xB7 E usar",use:"E \xB7 {label}",getOff:"E \xB7 Bajarse",inRoom:"est\xE1 en su pieza",walk:"camina",run:"va corriendo",you:"lo controlas t\xFA",themes:{cozy:"Acogedora",gothic:"G\xF3tica",roman:"Romana",japanese:"Japonesa",scandi:"N\xF3rdica",cyberpunk:"Cyberpunk",beach:"Playa",cabin:"Caba\xF1a",space:"Nave espacial",castle:"Castillo"},theme:"Tipo de casa",places:{window:"Mirar por la ventana",sofa:"Sentarse en el sof\xE1",rug:"Bailar en la alfombra",bed:"Dormir una siesta",desk:"Revisar la plaza",plant:"Regar la planta",front:"Saludar"},doing:{window:"mira por la ventana",sofa:"descansa en el sof\xE1",rug:"baila en la alfombra",bed:"duerme una siesta",desk:"revisa la plaza",plant:"riega la planta",front:"te saluda"},say:{hello:"\xA1Hola! Soy {name}",window:"Qu\xE9 lindo est\xE1 afuera\u2026",sofa:"Ahh\u2026 qu\xE9 rico",desk:"A ver qu\xE9 hay en la plaza\u2026",plant:"Hay que regarla \u{1F331}",gotMsg:"\u{1F4E9} \xA1Me lleg\xF3 un mensaje!",replied:"Respondido \u2713",takeMe:"\xA1Ll\xE9vame! \u{1F3AE}"},pad:{up:"Arriba",down:"Abajo",left:"Izquierda",right:"Derecha",use:"Usar"}}},wu={creator:{stepOf:"Step {n} of {total}",steps:{body:"Body",face:"Face",paint:"Paint",acc:"Accessories"},tabs:{shape:"Shape",style:"Style",color:"Color",finish:"Finish",preset:"Presets",eyes:"Eyes",brows:"Brows",mouth:"Mouth",cheeks:"Cheeks",pattern:"Pattern",texture:"Texture"},bodyColor:"Body color",eyeColor:"Eye color",adjust:"Adjust",size:"Size",spacing:"Spacing",height:"Height",color:"Color",patternColor:"Pattern color",otherColor:"Other color",back:"\u2190 Back",next:"Next \u2192",play:"Play",playNext:"\u25B6 Play",random:"Surprise me",undo:"Undo",clearAll:"Remove all ({n})",modBody:"It wears the 3D body \u201C{name}\u201D (a mod), which covers the ot. Editing anything here takes it off (you can undo).",modRemove:"Remove the 3D body",drag:"Drag to turn it",empty:"Nothing here."},room:{auto:"On its own",control:"Control",edit:"Edit",message:"Message",messageHint:"Simulate an incoming message",keys:"WASD or arrows \xB7 click the floor to go \xB7 Space jump \xB7 E use",use:"E \xB7 {label}",getOff:"E \xB7 Get down",inRoom:"is in its room",walk:"walks",run:"is running",you:"you're in control",themes:{cozy:"Cozy",gothic:"Gothic",roman:"Roman",japanese:"Japanese",scandi:"Scandi",cyberpunk:"Cyberpunk",beach:"Beach",cabin:"Cabin",space:"Spaceship",castle:"Castle"},theme:"House style",places:{window:"Look out the window",sofa:"Sit on the sofa",rug:"Dance on the rug",bed:"Take a nap",desk:"Check the plaza",plant:"Water the plant",front:"Say hi"},doing:{window:"looks out the window",sofa:"rests on the sofa",rug:"dances on the rug",bed:"takes a nap",desk:"checks the plaza",plant:"waters the plant",front:"says hi"},say:{hello:"Hi! I'm {name}",window:"It's lovely out there\u2026",sofa:"Ahh\u2026 so comfy",desk:"Let's see what's on the plaza\u2026",plant:"Needs water \u{1F331}",gotMsg:"\u{1F4E9} I got a message!",replied:"Replied \u2713",takeMe:"Take me around! \u{1F3AE}"},pad:{up:"Up",down:"Down",left:"Left",right:"Right",use:"Use"}}},xu={creator:{stepOf:"Passo {n} de {total}",steps:{body:"Corpo",face:"Rosto",paint:"Pintar",acc:"Acess\xF3rios"},tabs:{shape:"Forma",style:"Estilo",color:"Cor",finish:"Acabamento",preset:"Modelos",eyes:"Olhos",brows:"Sobrancelhas",mouth:"Boca",cheeks:"Bochechas",pattern:"Padr\xE3o",texture:"Textura"},bodyColor:"Cor do corpo",eyeColor:"Cor dos olhos",adjust:"Ajustes",size:"Tamanho",spacing:"Separa\xE7\xE3o",height:"Altura",color:"Cor",patternColor:"Cor do padr\xE3o",otherColor:"Outra cor",back:"\u2190 Voltar",next:"Pr\xF3ximo \u2192",play:"Jogar",playNext:"\u25B6 Jogar",random:"Surpreenda-me",undo:"Desfazer",clearAll:"Tirar todos ({n})",modBody:"Est\xE1 usando o corpo 3D \u201C{name}\u201D (um mod), que cobre o ot. Editar qualquer coisa aqui tira ele (d\xE1 para desfazer).",modRemove:"Tirar o corpo 3D",drag:"Arraste para gir\xE1-lo",empty:"Nada por aqui."},room:{auto:"Sozinho",control:"Controlar",edit:"Editar",message:"Mensagem",messageHint:"Simula uma mensagem recebida",keys:"WASD ou setas \xB7 clique no ch\xE3o para ir \xB7 Espa\xE7o pular \xB7 E usar",use:"E \xB7 {label}",getOff:"E \xB7 Descer",inRoom:"est\xE1 no quarto",walk:"anda",run:"vai correndo",you:"voc\xEA controla",themes:{cozy:"Aconchegante",gothic:"G\xF3tica",roman:"Romana",japanese:"Japonesa",scandi:"N\xF3rdica",cyberpunk:"Cyberpunk",beach:"Praia",cabin:"Cabana",space:"Nave espacial",castle:"Castelo"},theme:"Tipo de casa",places:{window:"Olhar pela janela",sofa:"Sentar no sof\xE1",rug:"Dan\xE7ar no tapete",bed:"Tirar um cochilo",desk:"Ver a pra\xE7a",plant:"Regar a planta",front:"Dizer oi"},doing:{window:"olha pela janela",sofa:"descansa no sof\xE1",rug:"dan\xE7a no tapete",bed:"tira um cochilo",desk:"v\xEA a pra\xE7a",plant:"rega a planta",front:"te d\xE1 oi"},say:{hello:"Oi! Eu sou {name}",window:"Que lindo l\xE1 fora\u2026",sofa:"Ahh\u2026 que gostoso",desk:"Vamos ver o que tem na pra\xE7a\u2026",plant:"Precisa de \xE1gua \u{1F331}",gotMsg:"\u{1F4E9} Chegou uma mensagem!",replied:"Respondido \u2713",takeMe:"Me leva! \u{1F3AE}"},pad:{up:"Cima",down:"Baixo",left:"Esquerda",right:"Direita",use:"Usar"}}},ku={creator:{stepOf:"\u7B2C {n} \u6B65\uFF0C\u5171 {total} \u6B65",steps:{body:"\u8EAB\u4F53",face:"\u8138",paint:"\u4E0A\u8272",acc:"\u914D\u9970"},tabs:{shape:"\u5F62\u72B6",style:"\u98CE\u683C",color:"\u989C\u8272",finish:"\u8D28\u611F",preset:"\u6A21\u677F",eyes:"\u773C\u775B",brows:"\u7709\u6BDB",mouth:"\u5634\u5DF4",cheeks:"\u8138\u988A",pattern:"\u56FE\u6848",texture:"\u7EB9\u7406"},bodyColor:"\u8EAB\u4F53\u989C\u8272",eyeColor:"\u773C\u775B\u989C\u8272",adjust:"\u8C03\u6574",size:"\u5927\u5C0F",spacing:"\u95F4\u8DDD",height:"\u9AD8\u5EA6",color:"\u989C\u8272",patternColor:"\u56FE\u6848\u989C\u8272",otherColor:"\u5176\u4ED6\u989C\u8272",back:"\u2190 \u8FD4\u56DE",next:"\u4E0B\u4E00\u6B65 \u2192",play:"\u5F00\u73A9",playNext:"\u25B6 \u5F00\u73A9",random:"\u7ED9\u6211\u60CA\u559C",undo:"\u64A4\u9500",clearAll:"\u5168\u90E8\u79FB\u9664\uFF08{n}\uFF09",modBody:"\u5B83\u7A7F\u7740 3D \u8EAB\u4F53\u201C{name}\u201D\uFF08\u4E00\u4E2A mod\uFF09\uFF0C\u4F1A\u76D6\u4F4F ot\u3002\u5728\u8FD9\u91CC\u7F16\u8F91\u4EFB\u4F55\u5185\u5BB9\u90FD\u4F1A\u628A\u5B83\u53D6\u4E0B\uFF08\u53EF\u4EE5\u64A4\u9500\uFF09\u3002",modRemove:"\u79FB\u9664 3D \u8EAB\u4F53",drag:"\u62D6\u52A8\u6765\u65CB\u8F6C",empty:"\u8FD9\u91CC\u4EC0\u4E48\u90FD\u6CA1\u6709\u3002"},room:{auto:"\u81EA\u5DF1\u73A9",control:"\u64CD\u63A7",edit:"\u7F16\u8F91",message:"\u6D88\u606F",messageHint:"\u6A21\u62DF\u4E00\u6761\u6536\u5230\u7684\u6D88\u606F",keys:"WASD \u6216\u65B9\u5411\u952E \xB7 \u70B9\u51FB\u5730\u9762\u524D\u5F80 \xB7 \u7A7A\u683C\u8DF3\u8DC3 \xB7 E \u4F7F\u7528",use:"E \xB7 {label}",getOff:"E \xB7 \u4E0B\u6765",inRoom:"\u5728\u81EA\u5DF1\u7684\u623F\u95F4\u91CC",walk:"\u5728\u8D70\u8DEF",run:"\u5728\u5954\u8DD1",you:"\u7531\u4F60\u64CD\u63A7",themes:{cozy:"\u6E29\u99A8",gothic:"\u54E5\u7279",roman:"\u7F57\u9A6C",japanese:"\u65E5\u5F0F",scandi:"\u5317\u6B27",cyberpunk:"\u8D5B\u535A\u670B\u514B",beach:"\u6D77\u6EE9",cabin:"\u5C0F\u6728\u5C4B",space:"\u5B87\u5B99\u98DE\u8239",castle:"\u57CE\u5821"},theme:"\u623F\u5C4B\u98CE\u683C",places:{window:"\u770B\u770B\u7A97\u5916",sofa:"\u5750\u5728\u6C99\u53D1\u4E0A",rug:"\u5728\u5730\u6BEF\u4E0A\u8DF3\u821E",bed:"\u7761\u4E2A\u5348\u89C9",desk:"\u770B\u770B\u5E7F\u573A",plant:"\u7ED9\u690D\u7269\u6D47\u6C34",front:"\u6253\u4E2A\u62DB\u547C"},doing:{window:"\u6B63\u770B\u7740\u7A97\u5916",sofa:"\u5728\u6C99\u53D1\u4E0A\u4F11\u606F",rug:"\u5728\u5730\u6BEF\u4E0A\u8DF3\u821E",bed:"\u5728\u7761\u5348\u89C9",desk:"\u5728\u770B\u5E7F\u573A",plant:"\u5728\u7ED9\u690D\u7269\u6D47\u6C34",front:"\u5728\u8DDF\u4F60\u6253\u62DB\u547C"},say:{hello:"\u4F60\u597D\uFF01\u6211\u662F {name}",window:"\u5916\u9762\u771F\u7F8E\u2026",sofa:"\u554A\u2026\u597D\u8212\u670D",desk:"\u770B\u770B\u5E7F\u573A\u4E0A\u6709\u4EC0\u4E48\u2026",plant:"\u8BE5\u6D47\u6C34\u4E86 \u{1F331}",gotMsg:"\u{1F4E9} \u6211\u6536\u5230\u4E00\u6761\u6D88\u606F\uFF01",replied:"\u5DF2\u56DE\u590D \u2713",takeMe:"\u5E26\u6211\u53BB\u901B\u901B\uFF01\u{1F3AE}"},pad:{up:"\u4E0A",down:"\u4E0B",left:"\u5DE6",right:"\u53F3",use:"\u4F7F\u7528"}}},vu={creator:{stepOf:"\u091A\u0930\u0923 {n} / {total}",steps:{body:"\u0936\u0930\u0940\u0930",face:"\u091A\u0947\u0939\u0930\u093E",paint:"\u0930\u0902\u0917",acc:"\u090F\u0915\u094D\u0938\u0947\u0938\u0930\u0940\u091C\u093C"},tabs:{shape:"\u0906\u0915\u093E\u0930",style:"\u0938\u094D\u091F\u093E\u0907\u0932",color:"\u0930\u0902\u0917",finish:"\u092B\u093C\u093F\u0928\u093F\u0936",preset:"\u091F\u0947\u092E\u094D\u092A\u0932\u0947\u091F",eyes:"\u0906\u0901\u0916\u0947\u0902",brows:"\u092D\u094C\u0902\u0939\u0947\u0902",mouth:"\u092E\u0941\u0901\u0939",cheeks:"\u0917\u093E\u0932",pattern:"\u092A\u0948\u091F\u0930\u094D\u0928",texture:"\u091F\u0947\u0915\u094D\u0938\u091A\u0930"},bodyColor:"\u0936\u0930\u0940\u0930 \u0915\u093E \u0930\u0902\u0917",eyeColor:"\u0906\u0901\u0916\u094B\u0902 \u0915\u093E \u0930\u0902\u0917",adjust:"\u0938\u092E\u093E\u092F\u094B\u091C\u0928",size:"\u0906\u0915\u093E\u0930",spacing:"\u0926\u0942\u0930\u0940",height:"\u090A\u0901\u091A\u093E\u0908",color:"\u0930\u0902\u0917",patternColor:"\u092A\u0948\u091F\u0930\u094D\u0928 \u0915\u093E \u0930\u0902\u0917",otherColor:"\u0926\u0942\u0938\u0930\u093E \u0930\u0902\u0917",back:"\u2190 \u092A\u0940\u091B\u0947",next:"\u0906\u0917\u0947 \u2192",play:"\u0916\u0947\u0932\u0947\u0902",playNext:"\u25B6 \u0916\u0947\u0932\u0947\u0902",random:"\u0938\u0930\u092A\u094D\u0930\u093E\u0907\u091C\u093C \u0926\u094B",undo:"\u092A\u0942\u0930\u094D\u0935\u0935\u0924 \u0915\u0930\u0947\u0902",clearAll:"\u0938\u092C \u0939\u091F\u093E\u090F\u0901 ({n})",modBody:"\u0907\u0938\u0928\u0947 3D \u0936\u0930\u0940\u0930 \u201C{name}\u201D (\u090F\u0915 mod) \u092A\u0939\u0928\u093E \u0939\u0948, \u091C\u094B ot \u0915\u094B \u0922\u0915 \u0926\u0947\u0924\u093E \u0939\u0948\u0964 \u092F\u0939\u093E\u0901 \u0915\u0941\u091B \u092D\u0940 \u092C\u0926\u0932\u0928\u0947 \u092A\u0930 \u0935\u0939 \u0939\u091F \u091C\u093E\u090F\u0917\u093E (\u0906\u092A \u092A\u0942\u0930\u094D\u0935\u0935\u0924 \u0915\u0930 \u0938\u0915\u0924\u0947 \u0939\u0948\u0902)\u0964",modRemove:"3D \u0936\u0930\u0940\u0930 \u0939\u091F\u093E\u090F\u0901",drag:"\u0918\u0941\u092E\u093E\u0928\u0947 \u0915\u0947 \u0932\u093F\u090F \u0916\u0940\u0902\u091A\u0947\u0902",empty:"\u092F\u0939\u093E\u0901 \u0915\u0941\u091B \u0928\u0939\u0940\u0902 \u0939\u0948\u0964"},room:{auto:"\u0905\u092A\u0928\u0947 \u0906\u092A",control:"\u0928\u093F\u092F\u0902\u0924\u094D\u0930\u0923",edit:"\u0938\u0902\u092A\u093E\u0926\u093F\u0924 \u0915\u0930\u0947\u0902",message:"\u0938\u0902\u0926\u0947\u0936",messageHint:"\u0906\u0928\u0947 \u0935\u093E\u0932\u0947 \u0938\u0902\u0926\u0947\u0936 \u0915\u093E \u0905\u0928\u0941\u0915\u0930\u0923 \u0915\u0930\u0947\u0902",keys:"WASD \u092F\u093E \u0924\u0940\u0930 \u0915\u0941\u0902\u091C\u093F\u092F\u093E\u0901 \xB7 \u091C\u093E\u0928\u0947 \u0915\u0947 \u0932\u093F\u090F \u092B\u093C\u0930\u094D\u0936 \u092A\u0930 \u0915\u094D\u0932\u093F\u0915 \u0915\u0930\u0947\u0902 \xB7 Space \u0915\u0942\u0926\u0947\u0902 \xB7 E \u0907\u0938\u094D\u0924\u0947\u092E\u093E\u0932 \u0915\u0930\u0947\u0902",use:"E \xB7 {label}",getOff:"E \xB7 \u0928\u0940\u091A\u0947 \u0909\u0924\u0930\u0947\u0902",inRoom:"\u0905\u092A\u0928\u0947 \u0915\u092E\u0930\u0947 \u092E\u0947\u0902 \u0939\u0948",walk:"\u091A\u0932 \u0930\u0939\u093E \u0939\u0948",run:"\u0926\u094C\u0921\u093C \u0930\u0939\u093E \u0939\u0948",you:"\u0928\u093F\u092F\u0902\u0924\u094D\u0930\u0923 \u0906\u092A\u0915\u0947 \u0939\u093E\u0925 \u092E\u0947\u0902",themes:{cozy:"\u0906\u0930\u093E\u092E\u0926\u093E\u092F\u0915",gothic:"\u0917\u0949\u0925\u093F\u0915",roman:"\u0930\u094B\u092E\u0928",japanese:"\u091C\u093E\u092A\u093E\u0928\u0940",scandi:"\u0928\u0949\u0930\u094D\u0921\u093F\u0915",cyberpunk:"\u0938\u093E\u0907\u092C\u0930\u092A\u0902\u0915",beach:"\u0938\u092E\u0941\u0926\u094D\u0930 \u0924\u091F",cabin:"\u0915\u0947\u092C\u093F\u0928",space:"\u0905\u0902\u0924\u0930\u093F\u0915\u094D\u0937 \u092F\u093E\u0928",castle:"\u092E\u0939\u0932"},theme:"\u0918\u0930 \u0915\u0940 \u0936\u0948\u0932\u0940",places:{window:"\u0916\u093F\u0921\u093C\u0915\u0940 \u0938\u0947 \u092C\u093E\u0939\u0930 \u0926\u0947\u0916\u0947\u0902",sofa:"\u0938\u094B\u092B\u093C\u0947 \u092A\u0930 \u092C\u0948\u0920\u0947\u0902",rug:"\u0915\u093E\u0932\u0940\u0928 \u092A\u0930 \u0928\u093E\u091A\u0947\u0902",bed:"\u091D\u092A\u0915\u0940 \u0932\u0947\u0902",desk:"\u092A\u094D\u0932\u093E\u091C\u093C\u093E \u0926\u0947\u0916\u0947\u0902",plant:"\u092A\u094C\u0927\u0947 \u0915\u094B \u092A\u093E\u0928\u0940 \u0926\u0947\u0902",front:"\u0939\u093E\u092F \u0915\u0939\u0947\u0902"},doing:{window:"\u0916\u093F\u0921\u093C\u0915\u0940 \u0938\u0947 \u092C\u093E\u0939\u0930 \u0926\u0947\u0916 \u0930\u0939\u093E \u0939\u0948",sofa:"\u0938\u094B\u092B\u093C\u0947 \u092A\u0930 \u0906\u0930\u093E\u092E \u0915\u0930 \u0930\u0939\u093E \u0939\u0948",rug:"\u0915\u093E\u0932\u0940\u0928 \u092A\u0930 \u0928\u093E\u091A \u0930\u0939\u093E \u0939\u0948",bed:"\u091D\u092A\u0915\u0940 \u0932\u0947 \u0930\u0939\u093E \u0939\u0948",desk:"\u092A\u094D\u0932\u093E\u091C\u093C\u093E \u0926\u0947\u0916 \u0930\u0939\u093E \u0939\u0948",plant:"\u092A\u094C\u0927\u0947 \u0915\u094B \u092A\u093E\u0928\u0940 \u0926\u0947 \u0930\u0939\u093E \u0939\u0948",front:"\u0906\u092A\u0915\u094B \u0939\u093E\u092F \u0915\u0939 \u0930\u0939\u093E \u0939\u0948"},say:{hello:"\u0928\u092E\u0938\u094D\u0924\u0947! \u092E\u0948\u0902 {name} \u0939\u0942\u0901",window:"\u092C\u093E\u0939\u0930 \u0915\u093F\u0924\u0928\u093E \u0938\u0941\u0902\u0926\u0930 \u0939\u0948\u2026",sofa:"\u0906\u0939\u2026 \u0915\u093F\u0924\u0928\u093E \u0906\u0930\u093E\u092E",desk:"\u0926\u0947\u0916\u0947\u0902 \u092A\u094D\u0932\u093E\u091C\u093C\u093E \u092E\u0947\u0902 \u0915\u094D\u092F\u093E \u0939\u0948\u2026",plant:"\u092A\u093E\u0928\u0940 \u091A\u093E\u0939\u093F\u090F \u{1F331}",gotMsg:"\u{1F4E9} \u092E\u0941\u091D\u0947 \u090F\u0915 \u0938\u0902\u0926\u0947\u0936 \u092E\u093F\u0932\u093E!",replied:"\u091C\u0935\u093E\u092C \u0926\u093F\u092F\u093E \u2713",takeMe:"\u092E\u0941\u091D\u0947 \u0918\u0941\u092E\u093E\u0913! \u{1F3AE}"},pad:{up:"\u090A\u092A\u0930",down:"\u0928\u0940\u091A\u0947",left:"\u092C\u093E\u090F\u0901",right:"\u0926\u093E\u090F\u0901",use:"\u0907\u0938\u094D\u0924\u0947\u092E\u093E\u0932"}}};Bt({es:bu,en:wu,pt:xu,zh:ku,hi:vu})});function s0(e,t,o={}){Tu();let a=pe(o.locale),s=o.name||"ot",r=o.controls!==!1,i=matchMedia("(hover: none)").matches;e.classList.add("otr"),e.classList.toggle("compact",!!o.compact),e.hasAttribute("tabindex")||(e.tabIndex=0);let n=document.createElement("div");n.style.cssText="position:absolute;inset:0;pointer-events:none",n.innerHTML=`
|
|
339
|
+
}`;wc=new Map;Zr=null});function Ds(e){let t=Mc[e];return t||(t=Mc[e]=$f[e](),t.userData.shared=!0),t}function mt(e,t,o){let a=new me.InstancedMesh(Ds(e),t,o);return a.frustumCulled=!1,a.instanceMatrix.setUsage(me.DynamicDrawUsage),a.userData.instFx=!0,a}function ut(e,t,o,a,s,r,i=0,n=0,l=0,h=r){mr.position.set(o,a,s),mr.rotation.set(n,l,i),mr.scale.set(r,h,r),r<=1e-4&&mr.scale.setScalar(1e-5),mr.updateMatrix(),e.setMatrixAt(t,mr.matrix)}function $r(e){e?.traverse?.(t=>{t.isInstancedMesh&&t.dispose()}),e?.removeFromParent()}var me,_c,ur,Ba,pr,Qo,Mc,gn,mf,Wr,$f,Ec,gf,mr,Ct,Qs,Tc=Ye(()=>{me=_t(Do(),1),_c=_t(dn(),1);ya();Bs();ur=Math.PI*2,Ba=Math.PI/180,pr=(e,t=.2)=>xe.backOut(U(e/t)),Qo=(e,t=.25)=>U((1-e)/t),Mc={},gn=(e,t=.25)=>new me.ExtrudeGeometry(e,{depth:t,bevelEnabled:!0,bevelThickness:.08,bevelSize:.07,bevelSegments:2,curveSegments:8}).center(),mf=e=>{for(let t of Object.keys(e.attributes))t!=="position"&&t!=="normal"&&e.deleteAttribute(t);return e},Wr=(...e)=>(0,_c.mergeGeometries)(e.map(t=>mf(t.index?t.toNonIndexed():t))),$f={star:()=>{let e=new me.Shape;e.moveTo(0,1);for(let[t,o,a,s]of[[0,0,1,0],[0,0,0,-1],[0,0,-1,0],[0,0,0,1]])e.quadraticCurveTo(t,o,a,s);return gn(e,.3)},heart:()=>{let e=new me.Shape;return e.moveTo(0,-.9),e.bezierCurveTo(-1.4,.1,-.7,1.05,0,.35),e.bezierCurveTo(.7,1.05,1.4,.1,0,-.9),gn(e,.35)},drop:()=>{let e=[];for(let t=0;t<=12;t++){let o=t/12*Math.PI,a=Math.sin(o)*(o>Math.PI/2?1:.35+.65*Math.sin(o));e.push(new me.Vector2(Math.max(.001,a*.8),Math.cos(o)*1.2))}return new me.LatheGeometry(e,14)},z:()=>{let e=new me.Shape;return e.moveTo(-1,1),e.lineTo(1,1),e.lineTo(1,.62),e.lineTo(-.35,-.62),e.lineTo(1,-.62),e.lineTo(1,-1),e.lineTo(-1,-1),e.lineTo(-1,-.62),e.lineTo(.35,.62),e.lineTo(-1,.62),e.lineTo(-1,1),gn(e,.4)},note:()=>Wr(new me.SphereGeometry(.42,12,8).scale(1.25,.95,.7).rotateZ(.35).translate(-.3,-.75,0),new me.CylinderGeometry(.08,.08,1.5,6).translate(.18,0,0),new me.BoxGeometry(.5,.18,.12).rotateZ(-.5).translate(.38,.6,0)),bang:()=>Wr(new me.CylinderGeometry(.2,.12,1.15,12).translate(0,.62,0),new me.SphereGeometry(.17,12,8).translate(0,-.12,0)),ask:()=>{let e=new me.CatmullRomCurve3([[-.35,.75],[-.25,1.05],[.15,1.12],[.42,.9],[.35,.6],[.05,.45],[0,.18]].map(([t,o])=>new me.Vector3(t,o,0)));return Wr(new me.TubeGeometry(e,24,.11,8),new me.SphereGeometry(.15,12,8).translate(0,-.12,0))},anger:()=>{let e=[];for(let[t,o]of[[1,-1],[1,1],[-1,1],[-1,-1]]){let a=new me.QuadraticBezierCurve3(new me.Vector3(.25*t,.9*o,0),new me.Vector3(.25*t,.25*o,0),new me.Vector3(.9*t,.25*o,0));e.push(new me.TubeGeometry(a,10,.13,6))}return Wr(...e)},cloud:()=>Wr(...[[0,0,.55],[-.5,-.05,.4],[.5,-.02,.42],[-.22,.28,.4],[.25,.3,.38],[0,-.2,.42]].map(([e,t,o])=>new me.SphereGeometry(o,14,10).scale(1,1,.6).translate(e,t,0))),ball:()=>new me.SphereGeometry(1,14,10),ballHi:()=>new me.SphereGeometry(1,24,16),chip:()=>new me.BoxGeometry(1,.5,.12)};Ec=null,gf=()=>Ec||(Ec=new me.MeshPhysicalMaterial({color:"#bfe9ff",roughness:.02,clearcoat:1,transparent:!0,opacity:.4,depthWrite:!1,envMapIntensity:2,iridescence:1})),mr=new me.Object3D;Ct=(...e)=>{for(let t of e)t.instanceMatrix.needsUpdate=!0},Qs={sparkles:{ms:1300,make:(e,t)=>t.m=mt("star",j("gloss","#ffd84d"),6),draw:(e,t,o,a,s,r)=>{for(let i=0;i<6;i++){let n=r()*ur,l=.55+r()*.25,h=(r()-.3)*e.D,f=U((o-i*.08)/.5),c=e.W*.07*(.6+r()*.6)*Math.sin(Math.PI*f)*s;ut(t.m,i,Math.cos(n)*e.W*l,e.H*.55-Math.sin(n)*e.H*l*.85,h,c,-a*.08*Ba)}Ct(t.m)}},sweat:{ms:1800,make:(e,t)=>t.m=mt("drop",j("gloss","#8fd3ff"),1),draw:(e,t,o,a,s)=>{ut(t.m,0,t.dir*e.W*.4,e.H*(.8-.08*xe.inOut(o)),e.D*.45,e.W*.05*pr(o,.15)*Math.min(s,Qo(o)),-t.dir*12*Ba),Ct(t.m)}},blush:{ms:2e3,make:()=>null,draw:(e,t,o,a,s)=>{t.blush=Math.min(U(o/.15),Qo(o))*s}},hearts:{ms:1900,make:(e,t)=>t.m=mt("heart",j("gloss","#ff4d7a"),3),draw:(e,t,o,a,s,r)=>{for(let i=0;i<3;i++){let n=U((o-i*.15)/.7),l=n<=0?0:e.W*(.07+r()*.03)*pr(n)*Qo(n,.3)*s;ut(t.m,i,(i-1)*e.W*.28+Math.sin(n*ur+i)*e.W*.05,e.H*.88+e.H*.5*xe.out(n),e.D*.3,l,Math.sin(n*9+i)*.25)}Ct(t.m)}},zzz:{ms:2600,loop:!0,make:(e,t)=>t.m=mt("z",j("gloss","#5b6ee1"),3),draw:(e,t,o,a,s)=>{for(let r=0;r<3;r++){let i=(o+r/3)%1;ut(t.m,r,t.dir*(e.W*.32+e.W*.25*i),e.H*.88+e.H*.45*i,e.D*.2,e.W*(.033+.05*i)*Math.sin(Math.PI*i)*s,t.dir*-.2)}Ct(t.m)}},exclaim:{ms:1100,make:(e,t)=>t.m=mt("bang",j("gloss","#ff3b30"),1),draw:(e,t,o,a,s)=>{ut(t.m,0,t.dir*e.W*.36,e.H*1.04,e.D*.2,e.W*.24*pr(o,.18)*Math.min(s,Qo(o,.2)),Math.sin(a/60)*6*Qo(o,.6)*Ba),Ct(t.m)}},question:{ms:1500,make:(e,t)=>t.m=mt("ask",j("gloss","#4f7cff"),1),draw:(e,t,o,a,s)=>{ut(t.m,0,t.dir*e.W*.4,e.H*1.02+Math.sin(a/200)*e.H*.015,e.D*.2,e.W*.24*pr(o)*Math.min(s,Qo(o,.2)),-t.dir*12*Ba),Ct(t.m)}},anger:{ms:1300,make:(e,t)=>t.m=mt("anger",j("gloss","#ff2d2d"),1),draw:(e,t,o,a,s)=>{ut(t.m,0,t.dir*e.W*.33,e.H*.86,e.D*.55,e.W*.075*pr(o,.15)*(1+.12*Math.sin(a/70))*Math.min(s,Qo(o)),0,0,t.dir*.5),Ct(t.m)}},steam:{ms:1500,make:(e,t)=>t.m=mt("ball",j("felt","#eef0f3"),6),draw:(e,t,o,a,s)=>{let r=0;for(let i of[-1,1])for(let n=0;n<3;n++){let l=U((o-n*.15)/.65),h=l<=0||l>=1?0:e.W*(.04+.07*l)*Math.min(1,(1-l)*3)*s;ut(t.m,r++,i*(e.W*.28+e.W*.18*l),e.H*.88+e.H*.38*l,0,h)}Ct(t.m)}},confetti:{ms:1900,make:(e,t)=>{let o=e.low?12:22,a=t.m=mt("chip",j("plastic","#ffffff"),o),s=["#ff4d7a","#ffd84d","#4dd2ff","#7cff6b","#b18cff","#ff9f43"],r=new me.Color;for(let i=0;i<o;i++)a.setColorAt(i,r.set(s[i%s.length]));return a},draw:(e,t,o,a,s,r)=>{let i=o*1.9,n=t.m.count,l=e.W*.035*Math.min(s,Qo(o,.3));for(let h=0;h<n;h++){let f=-Math.PI/2+(r()-.5)*2.2,c=e.H*(.9+r()*.8),d=(r()-.4)*c*.6,p=.3+r()*.5,u=Math.max(.005,e.H*.95-Math.sin(f)*c*i-e.H*1.1*i*i);ut(t.m,h,Math.cos(f)*c*i*.7,u,d*i,l,a*p*Ba+h,a*p*.7*Ba,h*.7)}Ct(t.m)}},tears:{ms:2200,rig:!0,make:(e,t)=>t.m=mt("drop",j("gloss","#8fd3ff"),4),draw:(e,t,o,a,s)=>{let r=0;for(let i of e.tears)for(let n=0;n<2;n++){let l=(o*2+n*.5)%1*(o<.9?1:0),h=l*l*(i.length-1),f=Math.min(i.length-2,Math.floor(h)),c=h-f,d=i[f],p=i[f+1];ut(t.m,r++,d[0]+(p[0]-d[0])*c,d[1]+(p[1]-d[1])*c,d[2]+(p[2]-d[2])*c,l<=0?0:e.r*.28*(1-l)*s*1.4)}Ct(t.m)}},thought:{ms:2200,make:(e,t)=>{t.m=mt("ball",j("felt","#ffffff"),2),t.c=mt("cloud",j("felt","#ffffff"),1),t.d=mt("ball",j("felt","#64748b"),3);let o=new me.Group;return o.add(t.m,t.c,t.d),o},draw:(e,t,o,a,s)=>{let r=Math.min(s,Qo(o,.15)),i=c=>pr(U((o-c)/.4),.5),n=t.dir*e.W*.55,l=e.H*1.22,h=e.D*.15;ut(t.m,0,t.dir*e.W*.3,e.H*.98,h,e.W*.025*i(0)*r),ut(t.m,1,t.dir*e.W*.4,e.H*1.08,h,e.W*.042*i(.08)*r);let f=e.W*.36*i(.16)*r;ut(t.c,0,n,l,h,f);for(let c=0;c<3;c++)ut(t.d,c,n+(c-1)*f*.32,l,h+f*.36,f*.07*(.6+.6*Math.max(0,Math.sin(a/180-c*.9))));Ct(t.m,t.c,t.d)}},notes:{ms:2200,make:(e,t)=>t.m=mt("note",j("gloss","#8b5cf6"),3),draw:(e,t,o,a,s)=>{for(let r=0;r<3;r++){let i=U((o-r*.18)/.65),n=r%2?-1:1;ut(t.m,r,n*e.W*(.42+.1*i)+Math.sin(i*ur)*e.W*.03,e.H*.75+e.H*.5*i,e.D*.25,i<=0||i>=1?0:e.W*.11*Math.sin(Math.PI*i)*s,-n*10*Ba)}Ct(t.m)}},sneeze:{ms:700,make:(e,t)=>t.m=mt("ball",j("gloss","#9fd8ff"),e.low?6:10),draw:(e,t,o,a,s,r)=>{let i=xe.out(o),n=e.mouth;for(let l=0;l<t.m.count;l++){let h=(r()-.5)*1.1,f=(r()-.5)*.8,c=e.W*(.15+r()*.45)*i;ut(t.m,l,n.x+t.dir*e.W*.05+Math.sin(h)*c,n.y+Math.sin(f)*c*.5-e.H*.15*i*i,n.z+Math.cos(h)*c,e.W*(.012+r()*.015)*(1-o)*s)}Ct(t.m)}},bubble:{ms:1e3,make:(e,t)=>t.m=mt("ballHi",gf(),1),draw:(e,t,o,a,s)=>{let r=xe.out(U(o/.85)),i=U((o-.85)/.15),n=e.W*(.03+.05*r)*(1+i*.4)*(1-i)*s;ut(t.m,0,e.mouth.x+t.dir*e.W*.06+Math.sin(o*9)*e.W*.02,e.mouth.y+e.H*.3*r,e.mouth.z+e.W*.08,n),Ct(t.m)}},aura:{ms:2600,make:(e,t)=>t.m=mt("drop",j("gloss","#c4b5fd"),8),draw:(e,t,o,a,s,r)=>{let i=Math.min(U(o/.15),Qo(o))*s;for(let n=0;n<8;n++){let l=r()*ur,h=.5+r()*.12,f=(o*1.6+n/8)%1;ut(t.m,n,Math.cos(l)*e.W*h,e.H*(.1+.95*f),Math.sin(l)*e.D*h,e.W*.045*Math.sin(Math.PI*f)*i,Math.PI)}Ct(t.m)}},dizzy:{ms:1600,loop:!0,make:(e,t)=>t.m=mt("star",j("gloss","#ffd84d"),3),draw:(e,t,o,a,s)=>{for(let r=0;r<3;r++){let i=o*ur+r*ur/3;ut(t.m,r,Math.cos(i)*e.W*.42,e.H*1+Math.sin(i)*e.H*.04,Math.sin(i)*e.D*1.1,e.W*.045*s,a*.004,0,i)}Ct(t.m)}}}});function kf(e){return new Promise((t,o)=>{let a=new Ac.GLTFLoader;if(e.startsWith("data:")){let s=atob(e.slice(e.indexOf(",")+1)),r=new Uint8Array(s.length);for(let i=0;i<s.length;i++)r[i]=s.charCodeAt(i);a.parse(r.buffer,"",t,o)}else a.load(e,t,void 0,o)})}async function Mf(e){let t={},o=(r,i,n,l)=>{Number.isInteger(n)&&(t[r]||=[]).push({mesh:i,index:n,w:l})},{parser:a}=e,s=a.json.extensions||{};if(s.VRMC_vrm){let r={...s.VRMC_vrm.expressions?.preset,...s.VRMC_vrm.expressions?.custom};for(let[i,n]of Object.entries(r))for(let l of n?.morphTargetBinds||[]){let h=await a.getDependency("node",l.node).catch(()=>null);if(h)for(let f of vf(h))o(i,f,l.index,l.weight??1)}}else if(s.VRM){let r=new Map;e.scene.traverse(i=>{let n=a.associations.get(i);i.isMesh&&n?.meshes!=null&&(r.get(n.meshes)||r.set(n.meshes,[]).get(n.meshes)).push(i)});for(let i of s.VRM.blendShapeMaster?.blendShapeGroups||[]){let n=bf[String(i.presetName||"").toLowerCase()];if(n)for(let l of i.binds||[])for(let h of r.get(l.mesh)||[])o(n,h,l.index,(l.weight??100)/100)}}else e.scene.traverse(r=>{if(!(!r.isMesh||!r.morphTargetDictionary))for(let[i,n]of Object.entries(r.morphTargetDictionary)){let l=wf.find(([,h])=>h.test(i));l&&o(l[0],r,n,1)}});return t}async function Ef(e){let{parser:t}=e,o=t.json.extensions||{},a=o.VRMC_vrm?.humanoid?.humanBones?.head?.node??o.VRM?.humanoid?.humanBones?.find(i=>i.bone==="head")?.node;if(a!=null)return t.getDependency("node",a).catch(()=>null);let s=null,r=/^(mixamorig:?)?head$|^head[_\d]*$/i;return e.scene.traverse(i=>{!s&&i.isBone&&r.test(i.name)&&(s=i)}),s||e.scene.traverse(i=>{!s&&!i.isMesh&&r.test(i.name)&&(s=i)}),s}async function _f(e){let{parser:t}=e,o=t.json.extensions||{},a=o.VRMC_vrm?.humanoid?.humanBones,s=o.VRM?.humanoid?.humanBones,r=h=>{let f=a?a[h]?.node:s?.find(c=>c.bone===h)?.node;return f==null?null:t.getDependency("node",f).catch(()=>null)},i=[];e.scene.traverse(h=>{h.isBone&&i.push(h)}),i.length||e.scene.traverse(h=>{h.isMesh||i.push(h)});let n=(h,f)=>{let c=h==="left"?"l(eft)?":"r(ight)?",d={up:new RegExp(`^(mixamorig\\d*:?)?(${c}[_.]?(upper_?)?arm|(upper_?)?arm[_.]?${c})$`,"i"),low:new RegExp(`^(mixamorig\\d*:?)?(${c}[_.]?(fore_?arm|lower_?arm)|(fore_?arm|lower_?arm)[_.]?${c})$`,"i"),end:new RegExp(`^(mixamorig\\d*:?)?(${c}[_.]?hand|hand[_.]?${c})$`,"i")}[f];return i.find(p=>d.test(p.name.replace(/\s+/g,"")))||null},l=[];for(let h of["left","right"]){let f=h[0].toUpperCase()+h.slice(1),[c,d,p]=await Promise.all(["UpperArm","LowerArm","Hand"].map(u=>a||s?r(h+u):null));c||=n(h,"up"),d||=n(h,"low"),p||=n(h,"end"),!(!c||!d||!p||d.parent!==c)&&l.push({side:f,up:c,low:d,end:p,q0:[c.quaternion.clone(),d.quaternion.clone()]})}return l.length===2?l:[]}function Rc(e,t,o,a){let s=e.getWorldPosition(Cc[0]),r=t.getWorldPosition(Cc[1]).sub(s).normalize(),i=Is[0].setFromUnitVectors(r,o);a<1&&i.slerp(Is[2].identity(),1-a);let n=e.parent.getWorldQuaternion(Is[1]);e.quaternion.premultiply(n.clone().invert().multiply(i).multiply(n)),e.updateMatrixWorld(!0)}function Sf(e,t,o,a,s){let r=o.def,i=s?0:a-o.start,n=xe.inOut(U(Math.min(i/250,(o.ms-i)/300)));if(!(n>0))return;let l=ga[r.hands]||ga.rest,h=t.getWorldQuaternion(Is[2]).clone();t.updateMatrixWorld(!0);for(let f of e.arms){let d=t.worldToLocal(f.up.getWorldPosition(new He.Vector3)).x>=0?1:-1,p=l(d,i,o.dir||1,Tf),u=p.x??d*p.u,g=-(p.y??p.v),m=new He.Vector3(u-d*.55,g-.3,.35).normalize().applyQuaternion(h);Rc(f.up,f.low,m,n);let w=(p.ang||0)*yn,k=new He.Vector3(d*Math.sin(w),Math.cos(w),.3).normalize().applyQuaternion(h);Rc(f.low,f.end,k,n)}}function Hc(e){let t=e._model,o=this.L=ro(e),a=this.W=o.box.w*Ae,s=this.H=Math.max(o.box.h*Ae,a)*1.2;this.modelMode=!0,this.kk=Math.sqrt(a*s)/1.25,this.depth=a*.6,this.furLen=0,this.plush=!1,this.maxShells=0,this.pal={body:e.body.color},this.furs=[],this.parts=[],this.anims=[],this.bodyMeshes=[],this.eyes=[],this.brows=[],this.hands=[],this.eyeY=s*.86,this.r3=a*.07,this.model={ex:{},w:{},head:null,q0:null,mixer:null,clips:[],idle:null,act:null,ready:!1},this.fxc={W:a,H:s,D:this.depth,eyeY:this.eyeY,r:this.r3,sp:a*.12,mouth:new He.Vector3(0,s*.78,this.depth*.5),low:this.quality==="low",tears:[]};let r=new He.Mesh(new He.PlaneGeometry(1,1),new He.MeshBasicMaterial({map:Ns(),transparent:!0,depthWrite:!1,toneMapped:!1}));r.rotation.x=-Math.PI/2,r.position.y=.002,r.scale.set(a*1.2,this.depth*2,1),r.renderOrder=-1,this.shadow=r,this.root.add(r),this.bounds=new He.Box3(new He.Vector3(-a/2,0,-this.depth/2),new He.Vector3(a/2,s,this.depth/2)),this.boundsRev=(this.boundsRev||0)+1;let i=this.modelTok={};kf(t.url).then(async n=>{if(this.modelTok!==i)return;let l=n.scene;(n.parser.json.extensions||{}).VRM&&(l.rotation.y=Math.PI),l.traverse(w=>{w.isMesh&&(w.frustumCulled=!1,Array.isArray(w.material)||(w.userData.ownMaterial=!0))}),l.updateMatrixWorld(!0);let f=new He.Box3().setFromObject(l),c=f.getSize(new He.Vector3),d=f.getCenter(new He.Vector3);if(!(c.y>0))throw new Error("empty model");l.position.set(-d.x,-f.min.y,-d.z);let p=new He.Group;p.add(l);let u=s/c.y*t.scale;p.scale.setScalar(u),p.rotation.y=t.rot*yn,p.position.y=t.y*s,this.rig.add(p);let g=this.model;if(g.ex=await Mf(n),g.head=await Ef(n),this.modelTok!==i||(g.head&&(g.q0=g.head.quaternion.clone()),g.arms=await _f(n),this.modelTok!==i))return;if(n.animations.length){g.mixer=new He.AnimationMixer(l),g.clips=n.animations;let w=g.clips.find(k=>Lc.test(k.name));w&&(g.idle=g.mixer.clipAction(w),g.idle.play()),g.mixer.addEventListener("finished",k=>{k.action===g.act&&(g.act=null,k.action.fadeOut(.25),g.idle?.reset().fadeIn(.25).play())})}g.ready=!0,this.rig.updateMatrixWorld(!0);let m=new He.Box3().setFromObject(p);if(this.bounds=m,this.depth=Math.max(.05,m.max.z-m.min.z),this.W=Math.max(.05,m.max.x-m.min.x),this.shadow.scale.set(this.W*1.1,this.depth*1.6,1),g.head){let w=g.head.getWorldPosition(new He.Vector3);this.rig.worldToLocal(w),this.eyeY=this.fxc.eyeY=w.y+s*.04,this.fxc.mouth.set(w.x,w.y-s*.01,m.max.z*.6)}this.fxc.W=this.W,this.fxc.D=this.depth,this.boundsRev++}).catch(n=>{if(this.modelTok!==i)return;console.warn("[7ots] modelo 3D del mod no disponible:",n?.message||n);let{_model:l,...h}=e;this.modelFailed=t.url,this.build({...h,mods:(h.mods||[]).filter(f=>!f.model)})})}function Pc(e){let t=this.model;if(!t?.mixer)return!1;let o=yf[e],a=o&&t.clips.find(r=>o.test(r.name)&&!Lc.test(r.name));if(!a)return!1;let s=t.mixer.clipAction(a);return t.act&&t.act!==s&&t.act.fadeOut(.2),s.reset(),s.setLoop(He.LoopOnce,1),s.clampWhenFinished=!1,s.fadeIn(.2).play(),t.idle?.fadeOut(.2),t.act=s,!0}function zc(e,t){let o=typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches,a=this.opts.idle!==!1,s=this.model;a&&e>=this.nextBlink&&(this.moodName!=="sleep"&&!o&&(this.blinkAt=e,e-this.look.at>3e3&&Math.random()<.45&&(this.look.tx=Math.random()<.5?0:(Math.random()-.5)*.9,this.look.ty=Math.random()<.5?0:(Math.random()-.5)*.5)),this.nextBlink=e+1800+Math.random()*3600),this.speech&&!this.speech.tick(e)&&this.endSpeech();let r=this.mo;r.open=Ie(r.open,r.target,t,r.target>r.open?35:70),r.msx=Ie(r.msx,r.tmsx,t,60);let i=this.look;i.x=o?i.tx:Ie(i.x,i.tx,t,70),i.y=o?i.ty:Ie(i.y,i.ty,t,70),this.sleepK=Ie(this.sleepK,this.moodName==="sleep"?1:0,t,o?1:260);let n={x:0,y:0,r:0,sx:1,sy:1,blink:0},l=0,h=this.gest;if(h){let v=e-h.start,_=U(v/h.ms);h.clip===void 0&&(h.clip=s.ready&&this.modelGesture(h.name)),h.clip||(Object.assign(n,h.def.pose(_,o?0:v,h)),h.dir<0&&(n.x=-n.x,n.r=-n.r),n.sx=1+(n.sx-1)*.4,n.sy=1+(n.sy-1)*.4,h.name==="spin"&&(l=xe.inOut(U((_-.12)/.76))*Sc));for(let C of h.def.fx||[])_>=C[0]&&!h.fired.has(C)&&(h.fired.add(C),this.effect(C[1],{dir:h.dir,...C[2]||{}}));_>=1&&this.endGesture()}o&&Object.assign(n,{x:0,y:0,r:0,sx:1,sy:1});let{ksx:f,ksy:c}=this.tickMorphs(e,o),d=this.W,p=this.H,u=e/1e3,g=o||!a||s.idle?0:Math.sin(u*Sc/3.4+this.phase),m=this.rig;m.position.set(n.x*d,-n.y*p,0),m.rotation.set(s.head?0:i.y*.1,this.yaw+i.x*(s.head?.12:.3)+l+(o||!a?0:Math.sin(u*.7+this.phase)*.03),-(n.r+i.x*1.5)*yn),m.scale.set(n.sx*f*(1-.004*g),n.sy*c*(1+.01*g),n.sx*f);let w=Math.max(0,-n.y);this.shadow.material.opacity=1-w*1.5,s.head&&s.q0&&s.head.quaternion.copy(s.q0);for(let v of s.arms||[])v.up.quaternion.copy(v.q0[0]),v.low.quaternion.copy(v.q0[1]);if(s.mixer?.update(o?0:t/1e3),h&&!h.clip&&h.def.hands&&s.arms?.length&&Sf(s,m,h,e,o),s.head&&s.head.parent){let v=s.head.parent.getWorldQuaternion(new He.Quaternion),_=m.getWorldQuaternion(new He.Quaternion),C=new He.Quaternion().setFromEuler(new He.Euler(i.y*.35,i.x*.55,0,"YXZ"));C.premultiply(_).multiply(_.clone().invert()),s.head.quaternion.premultiply(v.clone().invert().multiply(C).multiply(v))}let k=Math.max(this.blinkValue(e),n.blink,this.sleepK>.02?Math.min(1,this.sleepK*1.1):0),b=U((1-r.msx)/.35),x={...xf[this.moodName]||{}};for(let v in s.w)v in x||(x[v]=0);for(let v in x)s.w[v]=o?x[v]:Ie(s.w[v]||0,x[v],t,120);let E={...s.w,blink:Math.max(k,s.w.blink||0),aa:r.open*(s.ex.oh?1-b:1),oh:r.open*b};E.happy>.3&&(E.blink=Math.max(E.blink*(1-E.happy),0));let T=new Set;for(let v in s.ex)for(let _ of s.ex[v])T.has(_)||(_.mesh.morphTargetInfluences[_.index]=0,T.add(_));for(let v in s.ex){let _=E[v]||0;if(_)for(let C of s.ex[v])C.mesh.morphTargetInfluences[C.index]=Math.min(1,C.mesh.morphTargetInfluences[C.index]+_*C.w)}this.tickEffects(e,o),this.fxg.position.copy(m.position),this.fxg.rotation.y=this.yaw}var He,Ac,yn,Sc,yf,Lc,bf,wf,xf,vf,Cc,Is,Tf,jc=Ye(()=>{He=_t(Do(),1),Ac=_t(cn(),1);mo();ya();un();Bs();yn=Math.PI/180,Sc=Math.PI*2,yf={wave:/wave|hello|greet|hi\b/i,dance:/dance/i,celebrate:/victory|celebrat|cheer|dance/i,jump:/jump/i,bounce:/jump|hop/i,nod:/\byes\b|nod/i,shake:/^no$|\bno\b|shake_?head/i,thumbsup:/thumbs?_?up|\byes\b/i,thumbsdown:/thumbs?_?down|\bno\b/i,bow:/bow/i,think:/think/i,clap:/clap/i,point:/point/i,laugh:/laugh/i,stomp:/stomp|punch/i,shrug:/shrug/i,dizzy:/dizz|death|die/i,yawn:/yawn|sit/i,fly:/fly/i,floss:/floss/i,robot:/robot/i,shuffle:/shuffle|running_?man/i,dab:/\bdab/i,groove:/groove|hip_?hop|default_?dance/i,armwave:/arm_?wave|wave_?arms/i,disco:/disco|boogie/i,moonwalk:/moonwalk|slide/i,routine:/routine|macarena/i},Lc=/idle|breath|stand/i,bf={a:"aa",i:"ih",u:"ou",e:"ee",o:"oh",joy:"happy",sorrow:"sad",fun:"relaxed",angry:"angry",blink:"blink",surprised:"surprised"},wf=[["aa",/jaw_?open|mouth_?open|viseme_?aa|^v_?aa$|^aa$|^a$/i],["oh",/viseme_?(oh|o|ou)$|^oh$|^o$|mouth_?(funnel|pucker)/i],["blink",/^blink$|blink_?both|eyes?_?clos|^eyeblink$|^blink/i],["happy",/happy|joy|smile/i],["sad",/sad|sorrow/i],["angry",/angry|anger|\bmad\b/i],["surprised",/surpris|shock/i]],xf={happy:{happy:.8},love:{happy:.7,relaxed:.3},angry:{angry:.85},disgust:{angry:.5},sad:{sad:.85},fear:{surprised:.5,sad:.3},surprised:{surprised:.9},sleep:{relaxed:.6}};vf=e=>{let t=[];return e.traverse(o=>{o.isMesh&&o.morphTargetInfluences&&t.push(o)}),t};Cc=[new He.Vector3,new He.Vector3,new He.Vector3],Is=[new He.Quaternion,new He.Quaternion,new He.Quaternion],Tf={cx:0,W:2,H:2,mid:0,mouthY:-.4,eyeY:-.7,mw:.2,sp:.3,pts:null}});function Af(e){return e.eyes={...e.eyes,type:aa("eyes",e.eyes.type)},e.brows={...e.brows,type:aa("brows",e.brows.type)},e.mouth={...e.mouth,type:aa("mouths",e.mouth.type)},e.cheeks={...e.cheeks,type:aa("cheeks",e.cheeks.type)},e.body={...e.body,pattern:aa("patterns",e.body.pattern)},e.finish=aa("finishes",e.finish),e.accessories=e.accessories.map(t=>({...t,id:aa("accessories",t.id)})),e}function Lf(e){let t=Af(hr(e));if(!t._style)return t;let o=t.finish;return t.finish=Cf[t._style.id]||(o==="clay"||o==="sketch"?o:t._style.lw>0?"toon":o==="flat"?"soft3d":o),t}function Vf(e){if(!Vs.has(e)){let t=new Promise((o,a)=>{let s=new Bc.GLTFLoader,r=i=>o(i.scene);if(e.startsWith("data:")){let i=atob(e.slice(e.indexOf(",")+1)),n=new Uint8Array(i.length);for(let l=0;l<i.length;l++)n[l]=i.charCodeAt(l);s.parse(n.buffer,"",r,a)}else s.load(e,r,void 0,a)});t.catch(()=>Vs.delete(e)),Vs.set(e,t)}return Vs.get(e)}function O(e,t,o,a,s){let r=new H.Mesh(e,t);return o&&r.position.set(...o),a&&r.rotation.set(...a),s&&(typeof s=="number"?r.scale.setScalar(s):r.scale.set(...s)),r}var H,Bc,Cf,Rf,Hf,Mo,bt,Oc,Ur,Fs,Dc,qc,Qc,Ic,Pf,zf,jf,Gc,Of,bn,qf,Gf,Nf,Nc,Yr,Bf,Vc,Fc,Df,Io,Qf,If,Vs,he,sa,wn=Ye(()=>{H=_t(Do(),1);mo();Na();Ss();Bc=_t(cn(),1);pa();Nr();ya();un();Bs();Tc();jc();Cf={ukiyoe:"toon",glass:"glossy",bauhaus:"toon",manuscript:"toon",glitch:"neon",clay:"clay",ink:"sketch",pop:"toon",watercolor:"soft3d",pixel:"toon",synthwave:"neon",nouveau:"toon",cubism:"toon",crayon:"sketch",blueprint:"neon",pointillism:"soft3d",woodcut:"sketch",riso:"toon",dotmatrix:"toon",chalk:"sketch",sticker:"glossy",felt:"clay",papercut:"soft3d",lowpoly:"toon",marble:"soft3d",candy:"glossy",holo:"glossy",sumie:"sketch",tarot:"toon",retro70:"toon",mosaic:"toon",neonsign:"neon",graffiti:"toon",thermal:"soft3d"},Rf={clay:{finish:"clay",texture:"none"},metal:{finish:"metal",texture:"none"},glass:{finish:"glass",texture:"none"},pearl:{finish:"pearl",texture:"none"},holo:{finish:"holo",texture:"none"},wood:{finish:"clay",texture:"wood"},stone:{finish:"clay",texture:"stone"},knit:{finish:"velvet",texture:"knit"},glitter:{finish:"glossy",texture:"glitter"},quilt:{finish:"velvet",texture:"quilt"},honeycomb:{finish:"glossy",texture:"honeycomb"},bubbles:{finish:"glass",texture:"bubbles"}};Hf=new Set(["metal","glass","pearl","holo","velvet","pastel"]),Mo=Math.PI/180,bt=Math.PI*2,Oc=new H.Vector3(0,0,1),Ur=new H.Object3D,Fs={neutral:{curve:.15,tilt:0},happy:{curve:.85,tilt:-.25,squash:.85},angry:{curve:-.45,tilt:1},sad:{curve:-.85,tilt:-1},fear:{curve:-.35,tilt:-.8,eye:1.15,open:.15},disgust:{curve:-.55,tilt:.6,squash:.8},love:{curve:.75,tilt:-.3},sleep:{curve:0,tilt:0,closed:!0},surprised:{curve:0,tilt:-.4,eye:1.2,open:.45,lift:4}},Dc={curve:0,tilt:0,squash:1,eye:1,open:0,lift:0},qc=e=>({...Dc,...Fs[e]||Fs.neutral}),Qc=Object.keys(Fs),Ic=Object.keys(Ft),Pf=new Set(["dot","kawaii","bean","sparkle","teary","button","pixel","villain"]),zf=new Set(["kawaii","sparkle","teary"]),jf={sleepy:[.5,0],tired:[.42,0],angry:[.42,1],sad:[.42,-1],focused:[.33,0]},Gc={grin:.35,laugh:.6,open:.35,vampire:.25,buck:.12,braces:.35,monster:.45,gap:.35,toothless:.45,drool:.2,mustachio:.1},Of=new Set(["grin","braces","monster","gap","mustachio","vampire","buck"]),bn=new Set(["oh","kiss","whistle"]),qf={frown:-.7,flat:-.15,smile:.25,smirk:.2,pout:-.5,cat:.3},Gf={angry:[["spikes",{ms:900}],["anger"],["steam"]],surprised:[["exclaim"]],love:[["hearts"],["blush"]],happy:[["sparkles"]],sad:[["tears"]],fear:[["sweat"]],disgust:[["squish",{ms:700}]],sleep:[["zzz",{hold:!0,tag:"mood"}]]},Nf=1800,Nc=380,Yr=300,Bf=300,Vc=Object.keys(xo),Fc=Object.keys(ja),Df={puff:e=>[1+.2*e,1+.14*e],squish:e=>[1+.22*e,1-.22*e],stretch:e=>[1-.12*e,1+.26*e],melt:e=>[1+.06*e,1-.38*e]},Io=()=>performance.now(),Qf=()=>typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches,If=e=>(e.userData.shared=!0,e),Vs=new Map;he=(...e)=>{let t=new H.Group;return e.length&&t.add(...e),t},sa=class{constructor(t,o={}){this.opts=o,this.quality=o.quality||"high",this.q=this.quality==="high"?1:.45,this.root=new H.Group,this.rig=new H.Group,this.root.add(this.rig),this.yaw=0,this.view=null,this.phase=Math.random()*bt,this.moodName="neutral",this.mv=qc("neutral"),this.sleepK=0,this.look={x:0,y:0,tx:0,ty:0,at:-1e9},this.mo={open:0,target:0,msx:1,tmsx:1},this.blinkAt=-1e9,this.nextBlink=Io()+600+Math.random()*3e3,this.gest=null,this.speech=null,this.shells=0,this.morphs=new Map,this.fxs=[],this.fxSeq=0,this.fxg=new H.Group,this.root.add(this.fxg),this.build(t)}build(t){this.disposeRig(),this.clearMorphObjects();for(let te of this.fxs)$r(te.obj);this.fxs=[];let o=this.spec=Lf(Ha(Xe(t),Xe));if(this.modelMode=!1,this.modelTok=null,o._model&&o._model.url!==this.modelFailed)return this.buildModel(o);let a=o._style,s=ra(o),r=this.L=ro(o),i=this.B=hn(s,r.box,this.quality),n=fn(i.geometry),l=this.W=r.box.w*Ae,h=this.H=r.box.h*Ae;this.depth=i.depth;let f=this.kk=Math.sqrt(l*h)/1.25,c=this.Y=te=>(i.bottom-te)*Ae,d=this.X=te=>(te-r.cx)*Ae,p=!a&&Rf[this.opts.material];p&&(o.finish=p.finish);let u=this.tex=p?p.texture:aa("textures",Ni(o)),g=!p&&(Hf.has(o.finish)||o.texture&&o.texture!=="auto"&&u in pn),m=this.plush=!a&&!p&&(["fur","fuzz","feathers"].includes(u)||(this.opts.material||"plush")==="plush"&&!g),w=this.furLen=m?(u==="fuzz"||u==="none"?.05:.065)*f:0,k=this.density=w?this.quality==="high"?1/(w*.2):1/(w*.32):0;this.maxShells=this.quality==="high"?28:10;let b=o.body.color,x=yo(b)<.28,E=this.pal={body:b,brow:o.brows.color||Z(b,x?.6:-.6),lip:o.mouth.color||Z(b,x?.6:-.55)};this.furs=[],this.pending=[],this.parts=[],this.anims=[],this.bodyMeshes=[],this.zGrid=null,this.hideMouth=!1;let T=mn({color:b,patternColor:o.body.patternColor,pattern:o.body.pattern,finish:o.finish,plush:m,furLen:w,density:k,cheekColor:o.cheeks.color,texture:u});this.bodyU=T.uniforms,this.bodyMat=T.base;let v=r.r*Ae,_=c(r.eyeY);this.r3=v,this.eyeY=_,T.uniforms.uDims.value.set(l,h,_,v),T.uniforms.uSp.value=r.sp*Ae;let C=If(new H.Mesh(i.geometry,T.base));C.userData.ownMaterial=!0,this.rig.add(C),this.bodyMeshes.push(C),T.shell&&this.bodyMeshes.push(this.addShells(i.geometry,T,this.rig)),this.probe=n;let L=a?a.lw*.0042:o.finish==="toon"?.016:.009;if(o.finish==="toon"||o.finish==="sketch"||a&&a.lw>0){let te=new H.Mesh(i.geometry,$n(T.uniforms,{outline:!0,color:a?.ink||"#1f2937",off:w*1.05+L*f,wobble:o.finish==="sketch"?.6:0}));te.userData.ownMaterial=!0,te.userData.noBounds=!0,this.rig.add(te),this.bodyMeshes.push(te)}this.eyes=[];let z=o.eyes.type==="cyclops",N=z?[0]:[-r.sp*Ae,r.sp*Ae];if(N.forEach((te,ue)=>{let be=z||ue?1:-1,fe=n.front(te,_),Fe=this.buildEye(o.eyes.type,z?v*1.7:v,be);Fe.root.position.copy(fe.p),Fe.root.quaternion.setFromUnitVectors(Oc,fe.n.clone().lerp(Oc,.5).normalize()),this.rig.add(Fe.root),this.eyes.push(Fe),this.part(Fe.root,!0),T.uniforms.uBald.value[ue]&&T.uniforms.uBald.value[ue].set(fe.p.x,fe.p.y,fe.p.z,(z?v*1.7:v)*1.05)}),this.brows=[],o.brows.type!=="none"){let te=o.brows.type,ue={thick:.2,thin:.06,bushy:.16,dots:.18,soft:.09}[te]||.11,be=te==="unibrow",fe=be?[0]:N.length===1?[0]:N;for(let Fe of fe){let Y=Fe<0?-1:1,$e=_+v*1.65*(z?1.5:1),Oe=n.front(Fe,$e),Ge=be?r.sp*Ae+v:v*.85,qe=(Ne,Gt)=>new H.Vector3(Ne*v*Y,Gt*v,v*.06),Ze;te==="arched"?Ze=new H.QuadraticBezierCurve3(qe(-.9,-.25),qe(.1,.7),qe(.95,-.05)):te==="angled"?(Ze=new H.CurvePath,Ze.add(new H.LineCurve3(qe(-.9,-.15),qe(.35,.35))),Ze.add(new H.LineCurve3(qe(.35,.35),qe(.9,.05)))):Ze=new H.QuadraticBezierCurve3(new H.Vector3(-Ge,0,0),new H.Vector3(0,v*(te==="soft"?.45:.35),v*.12),new H.Vector3(Ge,0,0));let lo=te==="dots"?this.sph(v*.3,16,12).scale(1.3,.8,.6):new H.TubeGeometry(Ze,te==="angled"?24:16,v*ue,8,!1),We=O(lo,j("felt",E.brow)),st=he(We);st.position.copy(Oe.p).addScaledVector(Oe.n,w*.7+v*.05),st.userData.base=st.position.y,this.rig.add(st),this.brows.push({g:st,side:be?0:Y}),this.part(st,!0)}}this.buildMouth(o,n,d(r.cx),c(r.mouthY),r.mw*Ae,T),this.part(this.mouthRig.g,!0);let Q=o.cheeks.type;if(Q==="whiskers"){let te=j("matte","#1f2937");for(let ue of[-1,1])for(let be of[-.25,0,.25]){let fe=ue*r.sp*Ae*.7,Fe=_-v*(2.4+be*2),Y=n.front(fe,Fe);if(!Y)continue;let $e=Y.p.clone().addScaledVector(Y.n,w*.8+.004),Oe=new H.Vector3(ue*(r.sp*Ae+v*2.6),_-v*(2.2+be*3.2),$e.z*.75+w),Ge=$e.clone().lerp(Oe,.5);Ge.z+=.02*f;let qe=he(O(new H.TubeGeometry(new H.QuadraticBezierCurve3($e,Ge,Oe),8,Math.max(.002,v*.05),5),te));this.rig.add(qe),this.part(qe,!0)}}else if(Q!=="none"){let te=r.sp*Ae+v*.45,ue=_-v*1.8,be=n.front(te,ue);T.uniforms.uCheek.value.set(te,ue,be?be.p.z:0,v*(Q==="blush"?1:.7)),T.uniforms.uCheekOn.value=1,T.uniforms.uCheekType.value=xc[Q]||1;let fe=o.cheeks.color||"#ff6b8a";Q==="stars"?T.uniforms.uCheekColor.value.set("#facc15"):Q==="freckles"?T.uniforms.uCheekColor.value.set(Z(o.cheeks.color||Z(b,-.25),-.35)):Q==="hearts"?T.uniforms.uCheekColor.value.set(o.cheeks.color||"#ff4d7a"):T.uniforms.uCheekColor.value.set(fe)}for(let te of o.accessories){let ue=this.buildAccessory(te,{L:r,X:d,Y:c,W:l,H:h,kk:f,probe:n,eyeY:_,r3:v,bm:T});if(!ue)continue;ue.updateMatrixWorld(!0);let be=ue.userData.surface?new H.Vector3:ue.userData.pivot?ue.userData.pivot.clone():new H.Box3().setFromObject(ue).getCenter(new H.Vector3),fe=he(ue);ue.position.sub(be),fe.position.copy(be),ue.userData.surface||(fe.position.x+=te.x*Ae,fe.position.y-=te.y*Ae,fe.rotation.z-=te.rot*Mo,fe.scale.multiplyScalar(te.scale),te.flip&&(fe.scale.x*=-1)),this.rig.add(fe),ue.userData.surface||this.part(fe,!1)}this.hideMouth&&(this.mouthRig.g.visible=!1);let F=this.sph(.1*f,24,16).scale(1,1.1,.85),A=new H.CapsuleGeometry(.032*f,.07*f,4,8).translate(0,.1*f,.02*f);this.hands=[-1,1].map(te=>{let ue=he();m?this.addFur(F,b,ue,.7):ue.add(O(F,T.base));let be=m?this.addFur(A,b,he(),.5):O(A,T.base);return be.visible=!1,ue.add(be),ue.userData.finger=be,ue.visible=!1,this.rig.add(ue),ue});let B=this.eyes.map(te=>{let ue=te.root.position.x,be=[];for(let fe=0;fe<=6;fe++){let Fe=n.front(ue+Math.sign(ue||1)*v*.05*fe,_-v*(.9+fe*.5)),Y=Fe.p.clone().addScaledVector(Fe.n,w+.006*f);be.push([Y.x,Y.y,Y.z])}return be});this.fxc={W:l,H:h,D:i.depth,eyeY:_,r:v,sp:r.sp*Ae,mouth:this.mouthRig.g.position,low:this.quality==="low",tears:B};let W=new H.Mesh(new H.PlaneGeometry(1,1),new H.MeshBasicMaterial({map:Ns(),transparent:!0,depthWrite:!1,toneMapped:!1}));W.rotation.x=-Math.PI/2,W.position.y=.002,W.scale.set(l*1.55,i.depth*2.6,1),W.renderOrder=-1,this.shadow=W,this.root.add(W),this.rig.updateMatrixWorld(!0);let ae=this.bounds=new H.Box3,Me=new H.Box3;this.rig.traverseVisible(te=>{!te.isMesh||te.isInstancedMesh||te.userData.noBounds||(te.geometry.boundingBox||te.geometry.computeBoundingBox(),ae.union(Me.copy(te.geometry.boundingBox).applyMatrix4(te.matrixWorld)))}),ae.expandByScalar(this.furLen),this.shells=-1,this.setShells(this.maxShells)}part(t,o){this.parts.push({o:t,p0:t.position.clone(),face:o,d:new H.Vector3})}frontZ(t,o){let s=this.W,r=this.H;if(!this.zGrid){let w=this.zGrid=new Float32Array(144);for(let k=0;k<12;k++)for(let b=0;b<12;b++)w[k*12+b]=this.probe.front((b/11-.5)*s,k/11*r)?.p.z??NaN}let i=U((t/s+.5)*11,0,11),n=U(o/r*11,0,11),l=Math.min(10,Math.floor(i)),h=Math.min(10,Math.floor(n)),f=i-l,c=n-h,d=this.zGrid,p=d[h*12+l],u=d[h*12+l+1],g=d[(h+1)*12+l],m=d[(h+1)*12+l+1];if(Number.isNaN(p)||Number.isNaN(u)||Number.isNaN(g)||Number.isNaN(m)){let w=d[Math.round(n)*12+Math.round(i)];return Number.isNaN(w)?null:w}return de(de(p,u,f),de(g,m,f),c)}sph(t,o=32,a=16,...s){let r=this.q;return new H.SphereGeometry(t,Math.max(8,Math.round(o*r)),Math.max(6,Math.round(a*r)),...s)}tor(t,o,a=12,s=48,r=bt){let i=this.q;return new H.TorusGeometry(t,o,Math.max(4,Math.round(a*i)),Math.max(8,Math.round(s*i)),r)}addShells(t,o,a){let s=new H.InstancedMesh(t,o.shell,this.maxShells);return s.frustumCulled=!1,s.userData.ownMaterial=!0,a.add(s),this.furs.push({inst:s,u:o.uniforms}),s}addFur(t,o,a,s=.8){let r=mn({color:o,patternColor:o,pattern:"none",finish:"clay",plush:!0,furLen:this.furLen*s||.04,density:this.density||60});r.uniforms.uDims.value.set(1,.001,-9,.01);let i=new H.Mesh(t,r.base);return i.userData.ownMaterial=!0,a.add(i),this.addShells(t,r,a),a}setShells(t){if(t=Math.max(0,Math.min(this.maxShells,Math.round(t))),t!==this.shells){this.shells=t;for(let o of this.furs)o.inst.count=t,o.u.uShells.value=Math.max(1,t)}}buildEye(t,o,a){let s=this.spec.eyes,r=he(),i=he(),n=he();r.add(i),i.add(n);let l=j("gloss",s.ink),h=t;h==="wink"&&(h=a>0?"happy":"round");let f=!1;if(Pf.has(h)){let d=h==="kawaii"?1.15:h==="dot"?.75:h==="button"?1:.9,p=h==="bean"?[.55,1.2,.5]:h==="dot"?[.8,1.05,.6]:[.92,1,.6];n.add(O(this.sph(o*d,32,24),l,[0,0,-o*.18],null,p)),h==="button"&&n.add(O(this.tor(o*.72,o*.07,8,32),j("gloss",Z(s.ink,.25)),[0,0,o*.45])),zf.has(h)&&(n.add(O(this.sph(o*.2,12,8),j("emissive","#ffffff"),[-o*.32,o*.36,o*.38])),n.add(O(this.sph(o*.09,10,6),j("emissive","#ffffff"),[o*.34,-o*.34,o*.38])))}else if(h==="happy"||h==="closed"||h==="cross")if(f=!0,h==="cross")for(let d of[45,-45])i.add(O(new H.CapsuleGeometry(o*.13,o*1.3,4,8),j("felt",s.ink),[0,0,o*.1],[0,0,d*Mo]));else i.add(O(this.tor(o*.72,o*.14,10,24,Math.PI),j("felt",s.ink),[0,h==="happy"?-o*.25:o*.25,o*.08],[0,0,h==="happy"?0:Math.PI]));else if(h==="star"||h==="heart"){let d=new H.Shape;if(h==="star")for(let u=0;u<10;u++){let g=-Math.PI/2+u*Math.PI/5,m=u%2?o*.5:o*1.1;u?d.lineTo(Math.cos(g)*m,-Math.sin(g)*m):d.moveTo(Math.cos(g)*m,-Math.sin(g)*m)}else{let u=o*1.05;d.moveTo(0,-u*.9),d.bezierCurveTo(-u*1.4,u*.1,-u*.7,u*1.05,0,u*.35),d.bezierCurveTo(u*.7,u*1.05,u*1.4,u*.1,0,-u*.9)}let p=new H.ExtrudeGeometry(d,{depth:o*.2,bevelEnabled:!0,bevelThickness:o*.12,bevelSize:o*.1,bevelSegments:3,curveSegments:10});n.add(O(p,j("gloss",h==="heart"?"#ef3b5d":s.iris),[0,0,-o*.05]))}else if(h==="robot"||h==="led"||h==="glow"||h==="pixel")h==="robot"?(i.add(O(new H.BoxGeometry(o*2,o*1.6,o*.3),j("plastic","#0b1220"),[0,0,0])),n.add(O(new H.BoxGeometry(o*1.3,o*.9,o*.1),j("emissive",s.iris),[0,0,o*.16]))):h==="led"?n.add(O(new H.CapsuleGeometry(o*.3,o*1.6,4,12),j("emissive",s.iris),[0,0,o*.05],[0,0,Math.PI/2])):n.add(O(this.sph(o*.95,24,16),j("emissive",s.iris),[0,0,-o*.3],null,[1,1,.6]));else if(h==="spiral"||h==="dollar"){i.add(O(this.sph(o,32,24),j("gloss","#ffffff"),[0,0,-o*.2],null,[1,1,.75]));let d=o*.56,p;if(h==="spiral"){let g=[];for(let m=0;m<=48;m++){let w=m/48*Math.PI*5,k=o*(.06+.78*(m/48));g.push(new H.Vector3(Math.cos(w)*k,Math.sin(w)*k,d-m/48*o*.12))}p=new H.TubeGeometry(new H.CatmullRomCurve3(g),96,o*.07,6,!1)}else{let g=[[.45,.5],[0,.66],[-.45,.42],[-.28,.1],[.28,-.1],[.45,-.42],[0,-.66],[-.45,-.5]].map(([m,w])=>new H.Vector3(m*o*.6,w*o*.6,d));p=new H.TubeGeometry(new H.CatmullRomCurve3(g),40,o*.09,6,!1)}let u=O(p,j("gloss",h==="spiral"?s.ink:"#16a34a"));n.add(u),h==="dollar"?n.add(O(new H.CapsuleGeometry(o*.07,o*.95,3,6),j("gloss","#16a34a"),[0,0,d])):this.anims.push(g=>{u.rotation.z=-g*4*a})}else{let p=o*(h==="googly"?1.15:h==="wide"?1.12:h==="anime"?1.05:1),u=O(this.sph(p,32,24),j("gloss",h==="googly"||h==="hypno"?"#ffffff":s.white),[0,0,-p*.2],null,h==="anime"?[.9,1.2,.75]:h==="focused"?[1,.75,.75]:h==="almond"?[1.15,.72,.75]:[1,1,.75]);if(i.add(u),n.position.z=-p*.2,h==="almond"&&n.scale.set(1,.85,1),h==="lashes")for(let k=0;k<3;k++){let b=Math.cos(a>0?(30+k*30)*Mo:(150-k*30)*Mo),x=Math.sin((30+k*30)*Mo);i.add(O(new H.CapsuleGeometry(p*.07,p*.32,3,6),j("felt",s.ink),[b*p*1.05,x*p*1.05,p*.2],[0,0,Math.atan2(x,b)-Math.PI/2]))}let g=h==="cat"?.92:h==="anime"?.7:h==="almond"?.72:h==="wide"||h==="googly"?0:.58;g&&n.add(O(this.sph(p*g,24,16),j("gloss",s.iris),[0,0,p*.62],null,h==="anime"?[1,1.3,.3]:[1,1,.3]));let m=h==="wide"?.3:h==="googly"?.55:h==="cat"?.5:.32;n.add(O(this.sph(p*m,20,12),l,[0,0,p*.68],null,h==="cat"?[.3,1.5,.3]:[1,1,.32])),n.add(O(this.sph(p*.11,10,6),j("emissive","#ffffff"),[-p*.22,p*.26,p*.78]));let w=jf[h];if(w){let k=this.sph(p*1.07,32,12,0,bt,0,Math.PI*w[0]),b=O(k,j("felt",Z(this.spec.body.color,-.06)),[0,0,-p*.2],[0,0,w[1]*a*.45],[1,1,.8]);i.add(b)}}let c=O(this.tor(o*.72,o*.13,10,24,Math.PI),j("felt",s.ink),[0,o*.25,o*.08],[0,0,Math.PI]);return c.visible=!1,r.add(c),{root:r,main:i,gaze:n,closed:c,noBlink:f}}buildMouth(t,o,a,s,r,i){let n=t.mouth.type,l=he(),h=o.front(a,s),f=this.plush?this.furLen*.55:.006;l.position.copy(h.p).addScaledVector(h.n,f),this.rig.add(l),i.uniforms.uBald.value[2]&&i.uniforms.uBald.value[2].set(h.p.x,h.p.y,h.p.z,r*1.1);let c=this.mouthRig={g:l,type:n,line:null,cav:null,min:Gc[n]||0,bias:qf[n]||0,mw:r,round:null},d=j("felt",this.pal.lip),p=n==="grit"||n==="lips";if(!Gc[n]&&!bn.has(n)&&n!=="beak"&&!p){let u=k=>{let b=[];for(let x=0;x<=8;x++){let E=x/4-1,T=E*r*(n==="tiny"||n==="pout"?.5:1),v=k*r*.5*(E*E-.45)+(n==="smirk"?E*r*.12:0)+(n==="wavy"?Math.sin(E*Math.PI*2)*r*.12:0),_=o.front(a+T,s+v).p.z-h.p.z;b.push(new H.Vector3(T,v,_))}return new H.TubeGeometry(new H.CatmullRomCurve3(b),32,Math.max(.006,r*.085),8,!1)},g=u(0),m=u(1),w=u(-1);g.morphAttributes.position=[m.attributes.position,w.attributes.position],g.morphAttributes.normal=[m.attributes.normal,w.attributes.normal],m.dispose(),w.dispose(),c.line=O(g,d),c.line.morphTargetInfluences=[0,0],l.add(c.line),n==="tongue"&&l.add(O(new H.CapsuleGeometry(r*.32,r*.3,4,12),j("gloss","#ff7a8a"),[r*.1,-r*.38,r*.05],null,[1,1,.45]))}if(bn.has(n)&&(c.round=he(O(this.tor(r*.32,r*.1,10,24),n==="kiss"?j("gloss","#e11d48"):d),O(new H.CircleGeometry(r*.3,20),j("matte","#3a0d14"),[0,0,-.002])),n==="whistle"&&(c.round.position.x=r*.35),l.add(c.round)),n==="beak"&&l.add(O(new H.ConeGeometry(r*.6,r*1.1,24),j("plastic","#f59e0b"),[0,0,r*.4],[Math.PI/2,0,0],[1,1,.55])),n==="grit"){let u=he(O(new H.BoxGeometry(r*2,r*.5,r*.12),j("plastic","#ffffff"))),g=j("matte","#1f2937");u.add(O(new H.BoxGeometry(r*2,r*.05,r*.02),g,[0,0,r*.065]));for(let m=1;m<5;m++)u.add(O(new H.BoxGeometry(r*.05,r*.5,r*.02),g,[(m/5-.5)*r*2,0,r*.065]));u.add(O(this.tor(1,.06,6,4).rotateZ(Math.PI/4).scale(r*1.45,r*.36,r*.2),d)),c.grit=u,l.add(u)}if(n==="lips"){let u=j("gloss",t.mouth.color||"#e11d48"),g=he();for(let k of[-1,1])g.add(O(this.sph(1,20,12),u,[k*r*.42,0,0],[0,0,k*.25],[r*.55,r*.22,r*.2]));let m=O(this.sph(1,24,12),u,[0,0,0],null,[r*.85,r*.28,r*.22]),w=O(this.sph(1,20,10),j("gloss","#3a0d14"),[0,0,-r*.05],null,[r*.7,.001,r*.1]);c.lips={up:g,lo:m,hole:w},l.add(g,m,w)}if(n!=="beak"&&!bn.has(n)&&!p){let u=he(),g=n==="robot"||n==="square";u.add(O(g?new H.BoxGeometry(2,2,1):this.sph(1,28,16),j("gloss","#3a0d14"),[0,0,0],null,g?[1,.5,.5]:[1,1,1]));let m=O(this.sph(.6,20,12),j("felt","#ff7a8a"),[0,-.45,.35],null,[1,.55,.5]);if(u.add(m),Of.has(n)&&u.add(O(new H.BoxGeometry(n==="buck"?.6:1.4,.3,.3),j("plastic","#ffffff"),[0,.68,.55])),n==="vampire"||n==="monster")for(let w of[-.5,.5])u.add(O(new H.ConeGeometry(.14,.4,8),j("plastic","#ffffff"),[w,.62,.62],[Math.PI,0,0]));u.add(O(this.tor(1,.09,8,32),d,[0,0,.1],null,[1,1,1])),u.visible=!1,c.cav=u,l.add(u)}}buildAccessory(t,o){let{kk:a,probe:s,H:r,W:i,eyeY:n,r3:l,Y:h,X:f,L:c,bm:d}=o,p=.01*a,u=t.color,g=t.color2,m=t.id,w=s.top(0,0).p,k=v=>s.section(w.y-v*a),b=(v,_,C=.8)=>this.addFur(v,_,he(),C),x=he(),E=(v,_=.05)=>(x.position.set(w.x,w.y-_*a,0),x.add(v),x),T=v=>{let _=k(v);return{w:_.w,d:_.d,y:w.y-v*a}};switch(m){case"crown":case"tiara":{let v=j("metal",u),_=m==="crown"?6:3,C=.24*a;m==="crown"?x.add(O(new H.CylinderGeometry(C,C*1.05,.12*a,32,1,!0),v)):x.add(O(this.tor(C,.02*a,8,32,Math.PI),v,[0,0,0],[-Math.PI/2+.3,0,0]));for(let L=0;L<_;L++){let z=m==="crown"?L/_*bt:L/(_-1)*Math.PI,N=[Math.cos(z)*C,.1*a,m==="crown"?Math.sin(z)*C:Math.sin(z)*C*.3+.05*a];x.add(O(new H.ConeGeometry(.05*a,.12*a,12),v,N)),x.add(O(this.sph(.025*a,12,8),j("gloss",m==="crown"?"#dc2626":"#60a5fa"),[N[0],N[1]+.07*a,N[2]]))}return E(he(...x.children.splice(0)),.02)}case"tophat":{let v=he(O(new H.CylinderGeometry(.36*a,.36*a,.025*a,40),j("felt",u)),O(new H.CylinderGeometry(.22*a,.24*a,.4*a,40),j("felt",u),[0,.2*a,0]),O(new H.CylinderGeometry(.245*a,.245*a,.07*a,40),j("felt",g==="#ffffff"?"#dc2626":g),[0,.05*a,0]));return v.rotation.z=-.12,E(v,.06)}case"fedora":case"bowler":{let v=j("felt",u),_=m==="fedora",C=he(O(new H.CylinderGeometry((_?.4:.32)*a,(_?.4:.32)*a,.022*a,48),v,null,_?[-.08,0,0]:null),_?O(new H.CylinderGeometry(.19*a,.23*a,.24*a,40),v,[0,.12*a,0],null,[1,1,.85]):O(this.sph(.23*a,40,20,0,bt,0,Math.PI/2),v,[0,.06*a,0],null,[1,1.05,.92]),O(new H.CylinderGeometry(.235*a,.235*a,.05*a,40),j("felt",g),[0,.045*a,0],null,[1,1,_?.88:.93]));return _||C.add(O(new H.CylinderGeometry(.23*a,.23*a,.06*a,40),v,[0,.03*a,0],null,[1,1,.92])),_&&C.add(O(this.sph(.12*a,24,10),j("felt",Z(u,-.25)),[0,.24*a,0],null,[1,.25,.6])),C.rotation.z=_?-.14:-.06,E(C,.06)}case"witch":{let v=j("felt",u),_=he(O(new H.CylinderGeometry(.46*a,.46*a,.02*a,48),v)),C=0,L=0,z=[[.25,.17,.3,0],[.17,.09,.22,-.35],[.09,.01,.2,-.9]];for(let[N,Q,F,A]of z){let B=O(new H.CylinderGeometry(Q*a,N*a,F*a,32),v);B.geometry.translate(0,F/2*a,0),B.position.set(L,C,0),B.rotation.z=A,_.add(B),L+=-Math.sin(A)*F*a,C+=Math.cos(A)*F*a}return _.add(O(new H.CylinderGeometry(.245*a,.25*a,.06*a,40),j("felt",g),[0,.04*a,0])),_.add(O(new H.BoxGeometry(.08*a,.06*a,.02*a),j("metal","#facc15"),[0,.04*a,.25*a])),_.rotation.z=.1,E(_,.05)}case"fez":{let v=he(O(new H.CylinderGeometry(.16*a,.2*a,.3*a,36),j("felt",u),[0,.15*a,0]),O(new H.CylinderGeometry(.006*a,.006*a,.14*a,6),j("felt",g),[.07*a,.305*a,.02*a],[0,0,Math.PI/2])),_=he(O(new H.CylinderGeometry(.006*a,.006*a,.2*a,6),j("felt",g),[0,-.1*a,0]),O(new H.ConeGeometry(.035*a,.09*a,12),j("felt",g),[0,-.2*a,0]));return _.position.set(.14*a,.3*a,.02*a),_.rotation.z=.2,v.add(_),this.anims.push(C=>{_.rotation.z=.2+Math.sin(C*2.4)*.12}),v.rotation.z=-.1,E(v,.06)}case"sombrero":{let v=j("felt",u),_=he(O(this.tor(.5*a,.035*a,10,56),v,[0,.03*a,0],[Math.PI/2,0,0]),O(new H.CylinderGeometry(.52*a,.52*a,.02*a,56),v),O(new H.CylinderGeometry(.13*a,.21*a,.26*a,36),v,[0,.13*a,0]),O(this.sph(.13*a,32,12,0,bt,0,Math.PI/2),v,[0,.26*a,0],null,[1,.7,1]),O(new H.CylinderGeometry(.205*a,.215*a,.05*a,36),j("felt",g),[0,.04*a,0]));for(let C=0;C<12;C++){let L=C/12*bt;_.add(O(this.sph(.025*a,10,8),j("felt",g),[Math.cos(L)*.53*a,0,Math.sin(L)*.53*a]))}return E(_,.05)}case"bucket":{let v=j("felt",u),_=he(O(new H.CylinderGeometry(.21*a,.26*a,.2*a,40),v,[0,.1*a,0]),O(this.sph(.21*a,40,10,0,bt,0,Math.PI/2),v,[0,.2*a,0],null,[1,.25,1]),O(new H.CylinderGeometry(.27*a,.37*a,.06*a,48),j("felt",Z(u,-.08)),[0,-.01*a,0]));return E(_,.08)}case"jester":{let v=he(b(new H.TorusGeometry(.24*a,.04*a,12,40).rotateX(Math.PI/2),Z(u,-.2),.6)),_=[u,g,u];return[-1,0,1].forEach((C,L)=>{let z=C?.42:.5,N=he(O(new H.ConeGeometry(.12*a,z*a,24),j("felt",_[L]),[0,z/2*a,0]));N.add(O(this.sph(.04*a,14,10),j("metal","#facc15"),[0,z*a,0])),N.position.set(C*.12*a,.02*a,0),N.rotation.z=-C*.95,v.add(N);let Q=L*1.7;this.anims.push(F=>{N.rotation.z=-C*.95+Math.sin(F*1.8+Q)*.06})}),E(v,.05)}case"beanie":case"santa":case"cap":case"hardhat":case"viking":case"beret":case"propeller":{let v=T(m==="beret"?.14:.24),_=this.sph(1,40,20,0,bt,0,Math.PI/2).scale(v.w*1.08,w.y-v.y+.05*a,v.d*1.1),C=he();if(m==="beanie"||m==="santa")C.add(b(_,u,.7)),C.add(b(this.sph(.09*a,20,14),m==="santa"?"#fafafa":g,1)),C.children[1].position.y=w.y-v.y+.08*a,m==="santa"&&C.add(b(this.tor(1,.12,12,40).rotateX(Math.PI/2).scale(v.w*1.08,a*.5,v.d*1.1),"#fafafa",.9));else if(m==="beret")C.add(O(_,j("felt",u),null,[0,0,-.25],[1.25,.45,1.2]));else{let L=m==="viking"?j("metal","#a3a3a3"):m==="cap"||m==="propeller"?j("felt",u):j("plastic",u);if(C.add(O(_,L)),m==="propeller"){let z=w.y-v.y+.05*a;C.add(O(this.sph(1,24,12,Math.PI/2-.35,.7,0,Math.PI/2).scale(v.w*1.085,z*1.005,v.d*1.105),j("felt",g))),C.add(O(new H.CylinderGeometry(.008*a,.008*a,.09*a,8),j("metal","#9ca3af"),[0,z+.04*a,0]));let N=he(O(this.sph(.02*a,12,8),j("plastic",g)));for(let[Q,F]of[[-1,"#ef4444"],[1,"#22c55e"]])N.add(O(this.sph(1,16,8),j("plastic",F),[Q*.085*a,0,0],[Q*.3,0,0],[.085*a,.008*a,.028*a]));N.position.y=z+.085*a,C.add(N),this.anims.push(Q=>{N.rotation.y=Q*5})}if(m==="cap"&&C.add(O(new H.CylinderGeometry(v.w*.75,v.w*.75,.02*a,32,1,!1,-Math.PI/2,Math.PI),j("felt",g==="#ffffff"?Z(u,-.2):g),[0,.01,v.d*.9],null,[1,1,.9])),m==="hardhat"&&C.add(O(new H.CylinderGeometry(v.w*1.25,v.w*1.25,.02*a,40),j("plastic",u),[0,0,.02])),m==="viking")for(let z of[-1,1])C.add(O(new H.ConeGeometry(.06*a,.3*a,16),j("plastic","#fef3c7"),[z*v.w*1.05,(w.y-v.y)*.5,0],[0,0,-z*1]))}return C.position.y=v.y,C}case"hair":{let v=this.sph(1,36,20).scale(.3*a,.17*a,.26*a),_=b(v,u,1.3);return _.position.set(0,w.y+.02*a,.04*a),_.rotation.x=.15,_}case"party":case"wizard":{let v=m==="party"?.42:.62,_=he(O(new H.ConeGeometry((m==="party"?.16:.27)*a,v*a,32),j(m==="party"?"plastic":"felt",u),[0,v/2*a,0]));return m==="party"&&_.add(b(this.sph(.06*a,16,10),g,1)),m==="party"&&(_.children[1].position.y=v*a),m==="wizard"&&_.add(O(new H.CylinderGeometry(.42*a,.42*a,.02*a,40),j("felt",u))),_.rotation.z=-.15,E(_,.04)}case"cowboy":{let v=he(O(this.sph(1,40,10,0,bt,Math.PI*.35,Math.PI*.3),j("felt",u),[0,.05*a,0],null,[.55*a,.12*a,.45*a]),O(new H.CapsuleGeometry(.2*a,.1*a,6,24),j("felt",u),[0,.15*a,0],null,[1,1,.8]),O(new H.CylinderGeometry(.205*a,.205*a,.04*a,32),j("felt",Z(u,-.35)),[0,.1*a,0]));return E(v,.05)}case"chef":{let v=he(O(new H.CylinderGeometry(.2*a,.2*a,.14*a,32),j("felt","#fafafa")));for(let[_,C,L,z]of[[0,.2,0,.17],[-.13,.15,0,.12],[.13,.15,0,.12],[0,.15,.1,.12]])v.add(O(this.sph(z*a,20,14),j("felt","#fafafa"),[_*a,C*a,L*a]));return E(v,.04)}case"grad":{let v=he(O(new H.CylinderGeometry(.17*a,.19*a,.1*a,32),j("felt",u)),O(new H.BoxGeometry(.46*a,.025*a,.46*a),j("felt",u),[0,.06*a,0],[0,Math.PI/4,0]),O(new H.CylinderGeometry(.008*a,.008*a,.16*a,6),j("felt",g==="#ffffff"?"#facc15":g),[.2*a,-.01*a,0]));return E(v,.03)}case"bow":case"flower":{let v=he();if(m==="bow"){for(let _ of[-1,1])v.add(O(new H.ConeGeometry(.08*a,.15*a,20),j("plastic",u),[_*.08*a,0,0],[0,0,_*Math.PI/2],[1,1,.5]));v.add(O(this.sph(.04*a,16,10),j("plastic",u)))}else{for(let _=0;_<5;_++){let C=_/5*bt;v.add(O(this.sph(.055*a,16,10),j("felt",u),[Math.cos(C)*.06*a,Math.sin(C)*.06*a,0],null,[1,1,.4]))}v.add(O(this.sph(.04*a,16,10),j("felt","#facc15"),[0,0,.01*a]))}return v.position.set(.14*a,w.y-.02*a,.06*a),v.rotation.z=-.3,v}case"halo":{let v=O(this.tor(.22*a,.025*a,12,48),j("emissive",u),null,[Math.PI/2,0,0]);return v.position.y=w.y+.14*a,v}case"horns":case"catears":case"bunny":case"antenna":case"sprout":{for(let v of m==="sprout"?[0]:[-1,1]){let _=he();if(m==="horns"&&_.add(O(new H.ConeGeometry(.06*a,.22*a,20),j("gloss",u),[0,.09*a,0])),m==="catears"&&_.add(b(new H.ConeGeometry(.12*a,.22*a,24).scale(1,1,.45).translate(0,.09*a,0),u,.8)),m==="bunny"&&(_.add(b(this.sph(1,24,16).scale(.08*a,.26*a,.05*a).translate(0,.22*a,0),u,.8)),_.add(O(this.sph(1,20,12),j("felt",g),[0,.22*a,.035*a],null,[.045*a,.18*a,.02*a]))),m==="antenna"&&(_.add(O(new H.CylinderGeometry(.01*a,.01*a,.22*a,8),j("plastic",u),[0,.11*a,0])),_.add(O(this.sph(.045*a,16,10),j("emissive",g),[0,.23*a,0]))),m==="sprout"){_.add(O(new H.CylinderGeometry(.012*a,.015*a,.16*a,8),j("plastic","#16a34a"),[0,.08*a,0]));for(let z of[-1,1])_.add(O(this.sph(1,16,10),j("plastic",u),[z*.07*a,.17*a,0],[0,0,z*.5],[.08*a,.035*a,.02*a]))}let C=v*(m==="antenna"?.12:.22)*a,L=s.top(C,0).p;_.position.set(C,L.y-.03*a,0),_.rotation.z=-v*(m==="bunny"?.15:m==="catears"?.3:.35),x.add(_)}return x}case"headphones":case"headband":case"bandana":{let v=m==="bandana"?w.y-.12*a:n+(m==="headband"?l*2.2:0),_=s.section(v);if(m==="headphones"){let C=_.w+.04*a;x.add(O(this.tor(C,.025*a,10,40,Math.PI),j("plastic",u),[0,v,0],null,[1,(w.y-v+.06*a)/C,1]));for(let L of[-1,1])x.add(O(new H.CylinderGeometry(.1*a,.1*a,.07*a,28),j("plastic",g),[L*C,v,0],[0,0,Math.PI/2]));return x}return x.add(O(this.tor(1,.05,10,48),j("felt",u),[0,v,0],[Math.PI/2,0,0],[_.w*1.04,_.d*1.06,a*.9])),x}case"glasses":case"square":case"nerd":case"sunglasses":case"aviator":case"heartglasses":case"starglasses":case"3d":case"monocle":case"goggles":case"visor":case"eyepatch":{let v=Math.max(...this.eyes.map(z=>z.root.position.z))+l*.55,_=l*(m==="nerd"?1.7:1.5),C=m==="monocle"?[1]:m==="eyepatch"?[-1]:[-1,1],L=j(m==="3d"?"plastic":"gloss",u);for(let z of C){let N=z*c.sp*Ae;if(m==="eyepatch"){x.add(O(this.sph(_*.9,24,12),j("felt",u),[N,n,v-_*.5],null,[1,.85,.35]));continue}if(m==="visor")continue;let Q=m==="square"||m==="nerd"||m==="3d",F=this.tor(_,_*.13,8,Q?4:32);x.add(O(F,L,[N,n,v],[0,0,Q?Math.PI/4:0],Q?[1.15,.85,1]:[1,1,1]));let A=m==="sunglasses"||m==="aviator"?"#0f172a":m==="goggles"?g:m==="3d"?z<0?"#ef4444":"#22d3ee":m==="heartglasses"?"#f9a8d4":m==="starglasses"?"#fde68a":null;if(A){let B=O(new H.CircleGeometry(_,Q?4:32),new H.MeshPhysicalMaterial({color:A,roughness:.05,clearcoat:1,transparent:!0,opacity:m==="sunglasses"?.92:.55}),[N,n,v-.002],[0,0,Q?Math.PI/4:0],Q?[1.15,.85,1]:[1,1,1]);x.add(B)}}if(m==="visor"&&x.add(O(new H.CapsuleGeometry(_*.8,c.sp*Ae*2.2,6,16),new H.MeshPhysicalMaterial({color:u,roughness:.05,clearcoat:1,transparent:!0,opacity:.75}),[0,n,v],[0,0,Math.PI/2],[1,1,.3])),C.length===2&&m!=="visor"&&x.add(O(new H.CylinderGeometry(_*.1,_*.1,c.sp*Ae*2-_*2,8),L,[0,n+_*.15,v],[0,0,Math.PI/2])),m==="eyepatch"){let z=s.section(n+l);x.add(O(this.tor(1,.02,6,48),j("felt",u),[0,n+l*.4,0],[Math.PI/2,-.35,0],[z.w*1.03,z.d*1.05,a]))}return x}case"mustache":case"handlebar":case"beard":case"wizardbeard":case"goatee":{let v=h(c.mouthY),_=s.front(0,v);if(m==="mustache"||m==="handlebar"){let N=he();for(let Q of[-1,1])N.add(b(this.sph(1,20,12).scale(.1*a,.04*a,.04*a).rotateZ(Q*(m==="handlebar"?-.4:.25)).translate(Q*.085*a,0,0),u,.6));return N.position.copy(_.p).add(new H.Vector3(0,c.mw*Ae*.5,this.furLen*.6)),N}let C=m==="wizardbeard"?1.8:m==="goatee"?.6:1,L=m==="goatee"?.08:.3,z=b(this.sph(1,28,18).scale(L*a,.16*C*a,.12*a),u,1.1);return z.position.set(0,v-.1*C*a,_.p.z-.04*a),z}case"clownnose":case"nose":case"pignose":{let v=h(c.anchors.nose.y),_=s.front(0,v),C=he();if(m==="clownnose")C.add(O(this.sph(.075*a,24,16),j("gloss",u)));else if(m==="nose")C.add(O(this.sph(.035*a,20,12),j("gloss",u),null,null,[1.3,.9,.8]));else{C.add(O(new H.CylinderGeometry(.08*a,.08*a,.05*a,28),j("felt",u),null,[Math.PI/2,0,0],[1,1,.75]));for(let L of[-1,1])C.add(O(this.sph(.018*a,12,8),j("matte",Z(u,-.5)),[L*.03*a,0,.026*a]))}return C.position.copy(_.p).addScaledVector(_.n,this.furLen*.6+.02*a),C}case"bowtie":case"tie":case"medal":case"bell":case"scarf":case"pearls":case"ruff":{let v=h(c.anchors.neck.y),_=s.section(v),C=_.z+this.furLen*.6;if(m==="scarf"||m==="ruff")return x.add(b(this.tor(1,.1,14,48).rotateX(Math.PI/2).scale(_.w*1.05,a*(m==="ruff"?.9:.75),_.d*1.08),u,.9)),m==="scarf"&&x.add(b(new H.BoxGeometry(.1*a,.26*a,.04*a,2,6,2).translate(.12*a,-.12*a,C+.02*a),u,.9)),x.position.y=v,x;if(m==="pearls"){for(let z=0;z<=12;z++){let N=Math.PI*(z/12);x.add(O(this.sph(.025*a,12,8),j("gloss",u),[Math.cos(N)*_.w*1.02,v-Math.sin(N)*.03*a,Math.sin(N)*_.d*1.05]))}return x}let L=he();if(m==="bowtie"){for(let z of[-1,1])L.add(O(new H.ConeGeometry(.07*a,.14*a,20),j("felt",u),[z*.065*a,0,0],[0,0,z*Math.PI/2],[1,1,.5]));L.add(O(this.sph(.035*a,16,10),j("felt",Z(u,-.2))))}else m==="tie"?(L.add(O(this.sph(.035*a,16,10),j("felt",Z(u,-.2)))),L.add(O(new H.ConeGeometry(.06*a,.3*a,4),j("felt",u),[0,-.17*a,0],[Math.PI,Math.PI/4,0],[1,1,.35]))):m==="medal"?(L.add(O(new H.CylinderGeometry(.06*a,.06*a,.015*a,32),j("metal",u),[0,-.08*a,0],[Math.PI/2,0,0])),L.add(O(new H.BoxGeometry(.04*a,.1*a,.005*a),j("felt",g),[0,-.02*a,0]))):(L.add(O(this.sph(.06*a,20,14),j("metal",u),[0,-.05*a,0])),x.add(O(this.tor(1,.045,10,48),j("felt",g),[0,v,0],[Math.PI/2,0,0],[_.w*1.03,_.d*1.05,a])));return L.position.set(0,v,C),x.add(L),x}case"cape":case"superhero":{let v=s.section(r*.5),_=new H.CylinderGeometry(v.w*1.02,v.w*1.35,r*.75,32,1,!0,Math.PI/2+.35,Math.PI-.7);_.scale(1,1,v.d/v.w*1.1);let C=new H.MeshPhysicalMaterial({color:u,roughness:.6,sheen:.6,side:H.DoubleSide});return x.add(O(_,C,[0,r*.4,0])),x}case"wings":case"batwings":{let v=s.section(r*.5);for(let _ of[-1,1]){let C=he(O(this.sph(1,24,12),m==="wings"?j("felt",u):j("plastic",u),[_*.2*a,.08*a,0],null,[.24*a,.15*a,.03*a]));C.position.set(_*v.w*.5,r*.55,-v.d*.85),C.rotation.set(0,_*.5,_*.35),x.add(C)}return x}case"tail":{let v=new H.CatmullRomCurve3([new H.Vector3(0,.12*a,-.1),new H.Vector3(.12*a,.1*a,-.45*a),new H.Vector3(.25*a,.32*a,-.5*a)]);return x.add(O(new H.TubeGeometry(v,24,.02*a,8),j("gloss",u))),x.add(O(new H.ConeGeometry(.06*a,.1*a,4),j("gloss",u),[.25*a,.36*a,-.5*a],null,[1,1,.4])),x}case"jetpack":{let v=s.section(r*.5);for(let _ of[-1,1])x.add(O(new H.CapsuleGeometry(.07*a,.22*a,6,16),j("metal",u),[_*.09*a,r*.5,-v.d-.04*a])),x.add(O(new H.ConeGeometry(.05*a,.14*a,16),j("emissive","#f97316"),[_*.09*a,r*.5-.22*a,-v.d-.04*a],[Math.PI,0,0]));return x}case"pirate":{let v=T(.2),_=w.y-v.y+.06*a,C=j("felt",u),L=he(O(this.sph(1,32,16,0,bt,0,Math.PI/2),C,null,null,[v.w*.95,_*1.1,v.d]));for(let Q=0;Q<3;Q++){let F=he(O(this.sph(1,24,10),C,[0,0,v.d*.85],[-.75,0,0],[v.w*.95,.1*a,.07*a]));F.rotation.y=Q/3*bt,F.position.y=_*.12,L.add(F)}let z=j("felt",g),N=he(O(this.sph(.045*a,16,10),z));for(let Q of[.7,-.7])N.add(O(new H.CapsuleGeometry(.012*a,.11*a,3,6),z,[0,0,-.01*a],[0,0,Q]));for(let Q of[-1,1])N.add(O(this.sph(.011*a,8,6),j("matte","#111827"),[Q*.016*a,.005*a,.04*a]));return N.position.set(0,_*.5,v.d*.97),N.rotation.x=-.3,L.add(N),L.position.y=v.y,L}case"pipe":case"lollipop":{let v=h(c.mouthY),_=s.front(c.mw*Ae*.5,v).p,C=he();C.position.copy(_),C.position.z+=this.furLen*.5;let L=(N,Q,F,A)=>{let B=Q.clone().sub(N),W=O(new H.CylinderGeometry(F,F,B.length(),8),A);return W.position.copy(N).addScaledVector(B,.5),W.quaternion.setFromUnitVectors(new H.Vector3(0,1,0),B.normalize()),W},z=(N,Q,F)=>new H.Vector3(N*p,Q*p,F*p);if(m==="pipe"){C.add(L(z(0,0,0),z(22,-10,14),2*p,j("gloss","#1f2937")));let N=z(26,-16,16);C.add(O(new H.CylinderGeometry(8*p,7*p,16*p,20),j("gloss",u),N.toArray())),C.add(O(new H.CircleGeometry(6.5*p,16),j("matte","#292524"),[N.x,N.y+8.05*p,N.z],[-Math.PI/2,0,0]));let Q=[0,1,2].map(()=>O(this.sph(1,10,8),j("felt","#d6d3d1")));C.add(...Q),this.anims.push(F=>Q.forEach((A,B)=>{let W=(F*.5+B/3)%1;A.position.set(N.x+Math.sin(W*7+B)*4*p,N.y+(10+W*40)*p,N.z),A.scale.setScalar(Math.max(1e-4,(2+W*5)*p*Math.sin(Math.PI*W)))}))}else{C.add(L(z(0,0,0),z(26,10,10),1.6*p,j("plastic","#fafafa")));let N=he(O(new H.CylinderGeometry(11*p,11*p,4*p,28),j("gloss",u),null,[Math.PI/2,0,0])),Q=[];for(let F=0;F<=30;F++){let A=F/30*Math.PI*4,B=(1+8*(F/30))*p;Q.push(new H.Vector3(Math.cos(A)*B,Math.sin(A)*B,2.2*p))}N.add(O(new H.TubeGeometry(new H.CatmullRomCurve3(Q),48,1*p,5),j("plastic","#ffffff"))),N.position.copy(z(31,13,12)),C.add(N)}return C}case"bandaid":case"ninjamask":case"facemask":{let v=this.depth,_=this.furLen*1.02+.004*a,C=(L,z,N,Q=0,F=0)=>{let A=new H.Mesh(this.B.geometry,$n(d.uniforms,{color:L,off:_+F,box:z,kind:N,round:Q}));return A.userData.ownMaterial=!0,A.userData.noBounds=!0,this.bodyMeshes.push(A),A};if(m==="bandaid"){let L=c.sp*Ae+l*.4,z=n-l*2.4;x.add(C(u,{c:[L,z,v],h:[12*p,4.5*p,v],rot:30*Mo},"plastic",4.4*p)),x.add(C(Z(u,-.1),{c:[L,z,v],h:[4*p,4.6*p,v],rot:30*Mo},"plastic",0,.002*a))}else if(m==="ninjamask"){let L=n-l*1.6;x.add(C(u,{c:[0,L/2,0],h:[9,L/2,9],rot:0},"felt")),this.hideMouth=!0}else{let L=h(c.mouthY),z=c.mw*Ae;x.add(C(u,{c:[0,L-5*p,v],h:[z+12*p,17*p,v],rot:0},"felt",8*p)),this.hideMouth=!0}return x.userData.surface=!0,x}case"scar":{let v=-c.sp*Ae,_=this.furLen*.9+.004*a,C=(N,Q)=>{let F=s.front(N,Q);return F.p.clone().addScaledVector(F.n,_)},L=[];for(let N=0;N<=8;N++){let Q=N/8;L.push(C(v+de(-6,6,Q)*p,n+l*de(2.6,-2.4,Q)))}let z=j("felt",u);x.add(O(new H.TubeGeometry(new H.CatmullRomCurve3(L),16,1.4*p,5),z));for(let N of[-8,0,8]){let Q=n-N*p,F=v+-N/8*2*p;x.add(O(new H.TubeGeometry(new H.LineCurve3(C(F-4*p,Q),C(F+4*p,Q)),2,1.1*p,5),z))}return x.userData.surface=!0,x}case"parrot":{let v=f(c.anchors.shoulder.x),_=s.top(v,0).p,C=he(),L=a*1.1;C.add(O(this.sph(1,20,14),j("felt",u),[0,.09*L,0],[.2,0,0],[.065*L,.1*L,.065*L])),C.add(O(this.sph(.055*L,18,12),j("felt",u),[0,.2*L,.015*L])),C.add(O(new H.ConeGeometry(.03*L,.07*L,10),j("felt",g),[0,.265*L,-.01*L],[-.4,0,0])),C.add(O(new H.ConeGeometry(.02*L,.05*L,10),j("gloss","#facc15"),[0,.19*L,.07*L],[Math.PI/2+.5,0,0]));for(let Q of[-1,1])C.add(O(this.sph(.011*L,8,6),j("gloss","#111111"),[Q*.035*L,.21*L,.04*L]));C.add(O(new H.CapsuleGeometry(.018*L,.12*L,3,8),j("felt","#2563eb"),[0,.02*L,-.06*L],[-.9,0,0]));for(let Q of[-1,1])C.add(O(this.sph(1,14,10),j("felt",Z(u,-.2)),[Q*.06*L,.1*L,-.005*L],[.2,0,Q*.15],[.02*L,.07*L,.05*L]));let z=_.y-.01*a;C.position.set(v,z,0),C.rotation.y=-.4;let N=Math.random()*bt;return this.anims.push(Q=>{C.rotation.x=Math.sin(Q*2.2+N)*.08,C.position.y=z+Math.max(0,Math.sin(Q*1.3+N))*.01*a}),he(C)}case"sparkles":case"hearts":case"zzz":{let v=m==="sparkles"?[[-.75,-.55,9],[.8,-.35,7],[.7,.55,6],[-.8,.35,5]].map(([L,z,N])=>[L*i*.62,r*.5-z*r*.55,N*1.3]):m==="hearts"?[[-40,-10,7],[36,-18,9],[8,-34,6]].map(([L,z,N])=>[L*p,w.y-z*p,N]):[[30,-10,9],[46,-26,6.5],[58,-38,5]].map(([L,z,N])=>[L*p,w.y-z*p,N]),_=j("gloss",m==="hearts"?"#f43f5e":u),C=v.map(([L,z,N],Q)=>{let F=O(Ds(m==="sparkles"?"star":m==="hearts"?"heart":"z"),_,[L,z,this.depth*.5]);return F.scale.setScalar(N*p),F.userData.r=N*p,F.userData.i=Q,F});return x.add(...C),this.anims.push(L=>C.forEach(z=>{let N=z.userData.i;m==="sparkles"?(z.scale.setScalar(z.userData.r*(.7+.3*Math.sin(L*3+N*1.7))),z.rotation.z=L*.6+N):z.rotation.y=Math.sin(L*1.5+N)*.4})),x}case"sweat":{let v=s.front(c.sp*Ae+l*2.4,n+l*2.4),_=O(Ds("drop"),j("gloss",u),null,[0,0,-.15]);return _.scale.setScalar(7*p),_.position.copy(v.p).addScaledVector(v.n,this.furLen+6*p),x.add(_),x}case"helmet":{let v=Math.max(i,r)*.62,_=O(this.sph(v,48,32),j("glass",u),[0,r*.5,0]);return _.renderOrder=2,_.userData.noBounds=!0,x.add(_),x.add(O(this.tor(v*.78,.035*a,10,48),j("metal",g),[0,r*.5-v*.62,0],[Math.PI/2,0,0])),x}default:return this.spec._modParts?.[m]?this.buildModPart(this.spec._modParts[m],t,o):null}}buildModPart(t,o,a){let{L:s,X:r,Y:i,probe:n}=a,l=s.anchors[t.anchor]||s.anchors.center,h=s.box.w/120*Ae,f=r(l.x),c=i(l.y),d=t.depth==="center"?0:(n.front(f,c)?.p.z??0)+this.furLen,p=he();p.position.set(f,c,d),p.userData.pivot=p.position.clone();let u=()=>this.modPlane(t,o,h);if(!t.glb)return p.add(u()),p;let g=he();g.scale.setScalar(h),p.add(g);let m=t.tint==="body"?this.spec.body.color:t.tint==="color"?o.color:"",w=Vf(t.glb).then(k=>{let b=k.clone(!0);b.traverse(x=>{x.isMesh&&(x.geometry.userData.shared=!0,m&&(x.material=x.material.clone(),x.material.color?.set(m),x.userData.ownMaterial=!0))}),g.add(b)}).catch(()=>p.add(u()));return this.pending.push(w),p}modPlane(t,o,a){let[s,r,i,n]=t.view,l=Ts(this.spec,o.id,Z),h=l?l.draw({k:1,color:o.color,color2:o.color2,body:this.spec.body.color}):"",f=256/Math.max(i,n),c=document.createElement("canvas");c.width=Math.max(2,Math.round(i*f)),c.height=Math.max(2,Math.round(n*f));let d=new H.CanvasTexture(c);d.colorSpace=H.SRGBColorSpace;let p=new Image;p.onload=()=>{c.getContext("2d").drawImage(p,0,0,c.width,c.height),d.needsUpdate=!0};let u=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${s} ${r} ${i} ${n}" width="${c.width}" height="${c.height}">${h}</svg>`;p.src=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(u)}`;let g=new H.Mesh(new H.PlaneGeometry(i*a,n*a),new H.MeshBasicMaterial({map:d,transparent:!0,depthWrite:!1,side:H.DoubleSide}));return g.position.set((s+i/2)*a,-(r+n/2)*a,t.layer==="back"?-.01:.01),g.userData.ownMaterial=!0,g.userData.modPlane={svg:u,w:c.width,h:c.height},g}disposeRig(){this.rig.traverse(t=>{t.isMesh&&(t.geometry.userData.shared||t.geometry.dispose(),t.userData.ownMaterial&&t.material.dispose())}),this.model?.mixer?.stopAllAction(),this.model=null,this.rig.clear(),this.shadow&&(this.shadow.material.dispose(),this.shadow.geometry.dispose(),this.root.remove(this.shadow),this.shadow=null)}blinkValue(t){let o=t-this.blinkAt;return o<0||o>=180?0:o<70?xe.in(o/70)**.5:1-xe.out((o-70)/110)}tick(t,o){if(this.modelMode)return this.tickModel(t,o);let a=Qf(),s=this.opts.idle!==!1;if(s&&t>=this.nextBlink){if(this.moodName!=="sleep"&&!a&&(this.blinkAt=t,Math.random()<.2&&(this.nextDouble=t+240),t-this.look.at>3e3&&Math.random()<.45)){let Y=Math.abs(this.look.tx)+Math.abs(this.look.ty)>.1&&Math.random()<.6;this.look.tx=Y?0:(Math.random()-.5)*.9,this.look.ty=Y?0:(Math.random()-.5)*.5}this.nextBlink=t+1800+Math.random()*3600}this.nextDouble&&t>=this.nextDouble&&(this.blinkAt=t,this.nextDouble=0),this.speech&&!this.speech.tick(t)&&this.endSpeech();let r=this.mo;r.open=Ie(r.open,r.target,o,r.target>r.open?35:70),r.msx=Ie(r.msx,r.tmsx,o,60);let i=this.look;i.x=a?i.tx:Ie(i.x,i.tx,o,70),i.y=a?i.ty:Ie(i.y,i.ty,o,70);let n=qc(this.moodName);for(let Y in Dc)this.mv[Y]=a?n[Y]:Ie(this.mv[Y],n[Y],o,90);this.sleepK=Ie(this.sleepK,this.moodName==="sleep"?1:0,o,a?1:260);let l={x:0,y:0,r:0,sx:1,sy:1,lx:0,ly:0,blink:0,eye:1,lift:0,open:0,curve:0,msx:1},h=0,f=this.gest;if(f){let Y=t-f.start,$e=U(Y/f.ms);Object.assign(l,f.def.pose($e,a?0:Y,f)),f.dir<0&&(l.x=-l.x,l.r=-l.r,l.lx=-l.lx),f.name==="spin"&&(h=xe.inOut(U(($e-.12)/.76))*bt,l.sx=1+(l.sy<1?(1-l.sy)*.6:0));for(let Oe of f.def.fx||[])$e>=Oe[0]&&!f.fired.has(Oe)&&(f.fired.add(Oe),this.effect(Oe[1],{dir:f.dir,...Oe[2]||{}}));$e>=1&&this.endGesture()}a&&Object.assign(l,{x:0,y:0,r:0,sx:1,sy:1});let{ksx:c,ksy:d,act:p}=this.tickMorphs(t,a);p.shape&&!p.shape.ready&&this.startShape(p.shape);let u=p.shape?.ready?p.shape.k:0;this.bodyU.uMorph.value.set(p.melt?.k||0,a?0:p.jelly?.k||0,u,0);let g=this.mv,m=this.W,w=this.H,k=this.kk,b=t/1e3,x=a||!s?0:Math.sin(b*bt/3.4+this.phase),E=r.open,T=l.sx*(1-.015*E)*(1-.006*x)*c,v=l.sy*(1+.03*E)*(1+.014*x)*d,_=this.rig;_.position.set(l.x*m,-l.y*w,0),_.rotation.set(i.y*.12,this.yaw+i.x*.35+h+(a||!s?0:Math.sin(b*.7+this.phase)*.04),-(l.r+i.x*2)*Mo),_.scale.set(T,v,T);let C=Math.max(0,-l.y);this.shadow.scale.set(m*1.55*(1-C*.9)*c,this.shadow.scale.y,1),this.shadow.material.opacity=1-C*1.5;for(let Y of this.parts)Y.o.position.copy(Y.p0).addScaledVector(Y.d,u);let L=Math.max(this.blinkValue(t),l.blink,this.sleepK>.02?Math.min(1,this.sleepK*1.1):0),z=this.sleepK>.85,N=U(i.x+l.lx,-1,1),Q=U(i.y+l.ly,-1,1),F=g.eye*l.eye;for(let Y of this.eyes){Y.main.visible=!z,Y.closed.visible=z,Y.gaze.rotation.set(Q*.4,N*.5,0);let $e=Y.noBlink?1:Math.max(.08,1-L);Y.main.scale.set(F,F*(g.squash||1)*$e,F)}for(let Y of this.brows)Y.g.position.y+=(g.lift+l.lift)*Ae+(g.eye*l.eye-1)*this.L.r*Ae*1.65,Y.g.rotation.z=-Y.side*g.tilt*14*Mo;let A=this.mouthRig,B=U(g.curve+l.curve+A.bias,-1,1),W=U(Math.max(r.open+l.open,g.open,A.min)),ae=r.msx*l.msx;if(A.g.scale.x=ae,A.line&&(A.line.morphTargetInfluences[0]=Math.max(0,B),A.line.morphTargetInfluences[1]=Math.max(0,-B),A.line.visible=W<=.12),A.cav){let Y=W>.12;if(A.cav.visible=Y,Y){let $e=A.mw*(.75+Math.max(0,B)*.15),Oe=A.mw*(.12+W*.75);A.cav.scale.set($e,Oe,A.mw*.18),A.cav.position.y=-Oe*.55+B*A.mw*.1}}if(A.round&&A.round.scale.setScalar(.85+W*.6),A.grit&&(A.grit.scale.y=1+W*1.6,A.grit.position.y=B*A.mw*.08),A.lips){let Y=W*A.mw*.45;A.lips.up.position.y=A.mw*.16+Y*.5+B*A.mw*.05,A.lips.lo.position.y=-A.mw*.14-Y*.5,A.lips.hole.scale.y=Math.max(.001,Y*.6)}let Me=this.mobj,te=p.spikes;if(te){let Y=Me.spikes||(Me.spikes=this.makeSpikes(te.o.color));Y.visible=!0;let $e=Y.userData.list;for(let Oe=0;Oe<$e.length;Oe++){let Ge=$e[Oe],qe=Math.max(1e-4,xe.backOut(U(te.k*1.5-Ge.ord*.07))*(te.phase==="out"?te.k:1));Ur.position.copy(Ge.p),Ur.quaternion.copy(Ge.q),Ur.scale.set(qe,qe,qe),Ur.updateMatrix(),Y.setMatrixAt(Oe,Ur.matrix)}Y.instanceMatrix.needsUpdate=!0}else Me.spikes&&(Me.spikes.visible=!1);let ue=p.horns;if(ue){let Y=Me.horns||(Me.horns=this.makeHorns(ue.o.color));Y.visible=!0;for(let $e of Y.children)$e.scale.setScalar(Math.max(1e-4,ue.k))}else Me.horns&&(Me.horns.visible=!1);let be=p.wings;if(be){let Y=Me.wings||(Me.wings=this.makeWings(be.o.color));Y.visible=!0;let $e=be.o.flap==="fast",Oe=a?0:Math.sin((t-be.start)/1e3*bt*($e?3.2:.9))*($e?32:11)*Mo;for(let Ge of Y.children){let qe=Ge.userData.side;Ge.rotation.set(0,qe*(.55-Oe),qe*.25),Ge.scale.setScalar(Math.max(1e-4,be.k))}}else Me.wings&&(Me.wings.visible=!1);let fe=p.hands;for(let Y=0;Y<2;Y++){let $e=this.hands[Y];if($e.visible=!!fe,!fe){$e.userData.on=!1;continue}let Oe=Y?1:-1,Ge=this.L,qe=this.handCtx||(this.handCtx={cx:Ge.cx,W:Ge.box.w,H:Ge.box.h,mid:Ge.box.y+Ge.box.h*.55,mouthY:Ge.mouthY,mw:Ge.mw,sp:Ge.sp,eyeY:Ge.eyeY,pts:Ge.pts}),Ze=(ga[fe.o.pose]||ga.rest)(Oe,a?0:t-fe.start,fe.o.dir||1,qe),lo=this.X(Ze.x??qe.cx+Oe*Ze.u*qe.W*.5),We=this.Y(Ze.y??qe.mid+Ze.v*qe.H*.5),st=this.frontZ(lo,We),Ne=st==null?this.depth*.15:st+.06*k+this.furLen,Gt=-Oe*(Ze.ang||0)*Mo;!$e.userData.on||a?($e.position.set(lo,We,Ne),$e.rotation.z=Gt,$e.userData.on=!0):($e.position.set(Ie($e.position.x,lo,o,70),Ie($e.position.y,We,o,70),Ie($e.position.z,Ne,o,70)),$e.rotation.z=Ie($e.rotation.z,Gt,o,70));let co=Ze.type||"open",Co=$e.userData.finger;Co.visible=co==="point"||co==="thumb"||co==="thumbdown",Co.rotation.z=co==="thumbdown"?Math.PI:0,$e.scale.setScalar(Math.max(.01,fe.k*(Ze.s||1))*(co==="open"?1:.9))}let Fe=this.tickEffects(t,a);this.bodyU.uBlush.value=Fe,this.fxg.position.copy(_.position),this.fxg.rotation.y=this.yaw;for(let Y of this.furs)Y.u.uTime.value=b;this.bodyU.uTime.value=b;for(let Y of this.anims)Y(a?0:b)}tickMorphs(t,o){let a=1,s=1,r={};for(let[i,n]of this.morphs){if(n.phase!=="out"&&t>=n.until&&(n.phase="out",n.outAt=t,n.k0=n.k),n.phase==="in"){let h=U((t-n.start)/Nc);n.k=o?1:n.shape?xe.inOut(h):xe.backOut(h),h>=1&&(n.phase="on")}else if(n.phase==="on")n.k=1;else{let h=U((t-n.outAt)/Yr);if(n.k=o?0:n.k0*(1-xe.inOut(h)),h>=1){this.morphs.delete(i),this.endMorph(i);continue}}r[i]=n;let l=Df[i];if(l){let[h,f]=l(n.k);a*=h,s*=f}}return{ksx:a,ksy:s,act:r}}tickEffects(t,o){let a=0;if(this.fxs.length){let s=this.fxc;this.fxs=this.fxs.filter(r=>{let i=t-r.start,n=1,l;if(r.loop)!r.hold&&i>=r.ms&&r.end==null&&(r.end=t),l=o?.3:i%r.cycle/r.cycle;else{if(i>=r.ms)return $r(r.obj),!1;l=o?.5:i/r.ms}return r.end!=null&&(n=1-U((t-r.end)/Bf),n<=0)?($r(r.obj),!1):(r.def.draw(s,r,l,o?0:i,n,Go(r.seed)),r.blush&&(a=Math.max(a,r.blush)),!0)})}return a}makeSpikes(t){let o=this.L,a=[],s=new H.Vector3(0,1,0),r=new H.Vector3(0,this.H*.5,0);o.pts.forEach(([l,h],f)=>{if(f>=6&&f<=10)return;let c=new H.Vector3(this.X(l),this.Y(h),0),d=c.clone().sub(r).normalize();c.addScaledVector(d,-.02*this.kk),a.push({p:c,q:new H.Quaternion().setFromUnitVectors(s,d),ord:Math.min(f,16-f)})});for(let l of[.82,.62,.42]){let h=this.H*l,f=this.probe.section(h);a.push({p:new H.Vector3(0,h,-f.d*.9),q:new H.Quaternion().setFromUnitVectors(s,new H.Vector3(0,.4,-1).normalize()),ord:3+a.length*.1})}let i=new H.ConeGeometry(.05*this.kk,.16*this.kk,Math.max(6,Math.round(12*this.q))).translate(0,.08*this.kk,0),n=new H.InstancedMesh(i,j(this.plush?"felt":"gloss",t||Z(this.spec.body.color,-.12)),a.length);return n.instanceMatrix.setUsage(H.DynamicDrawUsage),n.frustumCulled=!1,n.userData.list=a,n.userData.noBounds=!0,this.rig.add(n),n}makeHorns(t){let o=this.L,a=he(),s=j("gloss",t||"#f5f0e6");for(let r of[1,15]){let[i,n]=o.pts[r],l=i>o.cx?1:-1,h=he(O(new H.ConeGeometry(.06*this.kk,.24*this.kk,16).translate(0,.12*this.kk,0),s));h.children[0].rotation.z=-l*.25;let f=this.X(i)*.8;h.position.set(f,this.probe.top(f,0).p.y-.04*this.kk,0),h.rotation.z=-l*.45,a.add(h)}return a.userData.noBounds=!0,this.rig.add(a),a}makeWings(t){let o=he(),a=this.kk,s=this.probe.section(this.H*.6),r=j(this.plush?"felt":"plastic",t||"#ffffff");for(let i of[-1,1]){let n=he();for(let l=0;l<3;l++){let h=O(this.sph(1,20,12),r,[i*(.16+l*.05)*a,(.1-l*.07)*a,0],[0,0,i*(.5-l*.35)],[(.2-l*.03)*a,.07*a,.025*a]);n.add(h)}n.position.set(i*s.w*.45,this.H*.62,-s.d*.7),n.userData.side=i,o.add(n)}return o.userData.noBounds=!0,this.rig.add(o),o}startShape(t){t.ready=!0;let o=t.target,a=ro(this.spec,o),s=hn(o,a.box,this.quality),r=s.geometry.attributes;if(r.position.count!==this.B.geometry.attributes.position.count)return;let i=this.shapeGeo;if(!i){i=this.shapeGeo=this.B.geometry.clone(),i.userData={};for(let f of this.bodyMeshes)f.geometry=i}i.setAttribute("aShape",r.position.clone()),i.setAttribute("aShapeN",r.normal.clone());let n=a.box.w*Ae/this.W,l=a.box.h*Ae/this.H,h=fn(s.geometry);for(let f of this.parts){let{x:c,y:d}=f.p0,p=c*n,u=d*l;f.d.set(p-c,u-d,f.face?h.front(p,u).p.z-this.probe.front(c,d).p.z:0)}}endMorph(t){if(t==="shape"&&this.B){for(let o of this.bodyMeshes)o.geometry=this.B.geometry;this.shapeGeo?.dispose(),this.shapeGeo=null;for(let o of this.parts)o.d.set(0,0,0),o.o.position.copy(o.p0)}t==="hands"&&(this.handCtx=null)}clearMorphObjects(){this.shapeGeo&&(this.shapeGeo.dispose(),this.shapeGeo=null),this.mobj={},this.handCtx=null;for(let t of this.morphs.values())t.ready=!1}lod(t){this.plush&&this.setShells(U(t/(this.quality==="high"?14:20),3,this.maxShells))}mood(t,o={}){if(!Fs[t])return!1;if(t===this.moodName)return!0;if(this.moodName=t,this.clearEffects("mood"),this.opts.moodFx!==!1&&o.fx!==!1)for(let[a,s]of Gf[t]||[])this.effect(a,s||{});return!0}endGesture(){let t=this.gest;if(!t)return;this.gest=null;let o=this.morphs.get("hands");t.def.hands&&o&&!o.byGesture&&o.userPose!==void 0&&(o.o.pose=o.userPose);let a=this.morphs.get("wings");t.def.wings&&a&&!a.byGesture&&(a.o.flap=a.userFlap)}gesture(t,o={}){let a=Object.hasOwn(Ft,t)?t:za[t];if(!a)return!1;typeof o=="number"&&(o={ms:o});let s=Ft[a],r=Io(),i=U(Number(o.ms)||s.ms,200,6e4),n=o.dir===-1||o.mirror===!0?-1:1;this.gest&&this.endGesture(),this.gest={name:a,def:s,start:r,ms:i,dir:n,fired:new Set};let l=this.morphs.get("hands");s.hands?l&&l.phase!=="out"?(l.o.pose=s.hands,l.o.dir=n,l.byGesture&&(l.until=r+i-Yr)):this.morph("hands",{pose:s.hands,dir:n,ms:i-Yr,byGesture:!0}):l?.byGesture&&l.phase!=="out"&&(l.until=r);let h=this.morphs.get("wings");return s.wings?h&&h.phase!=="out"?(h.o.flap=s.wings,h.byGesture&&(h.until=r+i-Yr)):this.morph("wings",{flap:s.wings,ms:i-Yr,byGesture:!0}):h?.byGesture&&h.phase!=="out"&&(h.until=r),!0}morph(t,o={}){if(typeof t!="string")return!1;if(o===!1)return this.unmorph(t);if(typeof o=="number"&&(o={ms:o}),!Object.hasOwn(xo,t)&&Object.hasOwn(Qs,t))return this.effect(t,o);let a=t,s=null;if(t.startsWith("shape:")){if(s=As(t.slice(6)),!s)return!1;a="shape"}else if(!Object.hasOwn(xo,t))return!1;let r=Io(),n=o.hold===!0||o.ms===1/0?1/0:U(Number(o.ms)||Nf,200,6e5),l=!o.byGesture,h=/^#[0-9a-f]{6}$/i.test(o.color||"")?o.color:void 0,f=this.morphs.get(a);if(f)f.phase==="out"&&(f.phase="in",f.start=r-Nc*U(f.k)),f.until=Math.max(l?0:f.until,r+n),l&&(f.byGesture=!1),a==="shape"&&f.target!==s&&(f.target=s,f.ready=!1),o.pose&&(f.o.pose=o.pose),o.dir&&(f.o.dir=o.dir),o.flap&&(f.o.flap=o.flap),l&&(f.userPose=f.o.pose,f.userFlap=f.o.flap);else{let c={pose:t==="hands"?o.pose||"rest":void 0,dir:o.dir===-1?-1:1,flap:o.flap,color:h};this.morphs.set(a,{name:a,start:r,until:r+n,phase:"in",k:0,o:c,target:s,shape:a==="shape",ready:!1,byGesture:!l,userPose:l?c.pose:void 0,userFlap:l?c.flap:void 0})}return!0}unmorph(t){let o=Io(),a=typeof t=="string"&&t.startsWith("shape")?"shape":t;for(let[s,r]of this.morphs)a&&s!==a||r.phase!=="out"&&(r.phase="out",r.outAt=o,r.k0=r.k);return!0}effect(t,o={}){if(typeof t!="string")return!1;if(typeof o=="number"&&(o={ms:o}),Object.hasOwn(xo,t)||t.startsWith("shape:"))return this.morph(t,o);if(!Object.hasOwn(Qs,t))return!1;let a=Qs[t],s={name:t,def:a,start:Io(),ms:U(Number(o.ms)||(a.loop?a.ms*1.5:a.ms),100,6e5),cycle:a.ms,loop:!!a.loop||o.hold===!0,hold:o.hold===!0,dir:o.dir===-1?-1:1,o,tag:o.tag,seed:++this.fxSeq*7919^Math.floor(this.phase*1e4),end:null,obj:null},r=a.make(this.fxc,s);return r&&(s.obj=r,(a.rig?this.rig:this.fxg).add(r),a.draw(this.fxc,s,0,0,1,Go(s.seed))),this.fxs.push(s),this.fxs.length>24&&$r(this.fxs.shift().obj),!0}clearEffects(t){let o=Io();for(let a of this.fxs)(!t||a.name===t||a.tag===t)&&(a.end??=o)}blink(){this.blinkAt=Io()}lookAt(t,o){this.look.tx=U(Number(t)||0,-1,1),this.look.ty=U(Number(o)||0,-1,1),this.look.at=Io()}lookAtPoint(t,o){let a=this.view?.screenOf(this);a&&this.lookAt((t-a.x)/(window.innerWidth/2),(o-a.y)/(window.innerHeight/2))}mouth(t){this.mo.target=U(Number(t)||0)}viseme(t,o){let a=Ot[t]||Ot.X;return this.mo.target=U(o??a.open),this.mo.tmsx=a.w,!!Ot[t]}endSpeech(){let t=this.speech;this.speech=null,this.mo.target=0,this.mo.tmsx=1,t?.resolve?.()}speak(t,o={}){this.speech&&this.endSpeech();let a,s;if(typeof t=="number")s=U(t,0,6e5),a=Ls(s,Math.floor(Math.random()*1e6));else{let d=String(t??"");a=Oa(d),s=Number(o.durationMs)||Math.max(300,d.length/14/(Number(o.rate)||1)*1e3)}let r,i=new Promise(d=>{r=d});if(!a.length||!s)return r(),Object.assign(i,{stop(){}});let n=0;for(let d of a)d.t0=n,n+=d.w;let l=Io(),h=0,f=Number(o.gain)||1,c={resolve:r,tick:d=>{if(d-l>=s)return!1;let p=U((d-l)/s)*n;for(;h<a.length-1&&a[h+1].t0<=p;)h++;let u=a[h],g=Ot[u.v]||Ot.X,m=U((p-u.t0)/(u.w||1));return this.mo.target=U(g.open*(.82+.18*Math.sin(Math.PI*m))*f),this.mo.tmsx=g.w,!0}};return this.speech=c,Object.assign(i,{stop:()=>{this.speech===c&&this.endSpeech()}})}stopSpeaking(){this.speech&&this.endSpeech()}lipsync(t,o={}){if(this.stopSpeaking(),!t||typeof t.getByteTimeDomainData!="function")return()=>{};let a=t.fftSize||512,s=new Uint8Array(a),r=Number(o.gain)||1,i=o.text?Oa(String(o.text)):[],n=0;for(let p of i)p.t0=n,n+=p.w;let l=Number(o.durationMs)||Math.max(300,String(o.text||"").length/14*1e3),h=Io(),f=0,c=.05,d={tick:p=>{if(t.context?.state==="closed")return!1;t.getByteTimeDomainData(s);let u=0;for(let w=0;w<a;w++){let k=(s[w]-128)/128;u+=k*k}u=Math.sqrt(u/a),c=Math.max(u,c*.995,.02);let g=U(U((u-.006)/(c*.7))**.8*r),m=1;if(i.length&&p-h<l){let w=U((p-h)/l)*n;for(;f<i.length-1&&i[f+1].t0<=w;)f++;m=(Ot[i[f].v]||Ot.X).w}return this.mo.target=g,this.mo.tmsx=de(1,m,U(g*2)),!0}};return this.speech=d,()=>{this.speech===d&&this.endSpeech()}}update(t){this.build(t)}get state(){return{mood:this.moodName,gesture:this.gest?.name||null,speaking:!!this.speech,shells:this.shells,morphs:[...this.morphs.keys()].filter(t=>this.morphs.get(t).phase!=="out"),effects:this.fxs.map(t=>t.name)}}dispose(){for(let t of this.fxs)$r(t.obj);this.fxs=[],this.disposeRig(),this.root.removeFromParent()}};Object.assign(sa.prototype,{buildModel:Hc,tickModel:zc,modelGesture:Pc})});var Wc=Mr((z2,Zc)=>{Zc.exports=globalThis.__OTS_THREE__.RoundedBoxGeometry});function su(){let e=new Map,t=new Map,o=(w,k,b)=>b&&Object.values(b).some(x=>x&&typeof x=="object")?null:`${w}${k}${b?JSON.stringify(b):""}`,a=(w,k)=>{if(!w)return k();let b=e.get(w);return b||e.set(w,b=k()),b},s=(w,k)=>a(o("s",w,k),()=>new V.MeshStandardMaterial({color:w,roughness:.85,metalness:0,...k})),r=(w,k)=>a(o("b",w,k),()=>new V.MeshBasicMaterial({color:w,toneMapped:!1,...k})),i=(w,k=1,b)=>s(w,{emissive:w,emissiveIntensity:k,...b}),n=(w,k)=>{let b=t.get(w);return b||t.set(w,b=k()),b},l=(w,k)=>w?.isMaterial?w:s(w,k),h=(w,k,b=0,x=0,E=0)=>{let T=new V.Mesh(w,k);return T.position.set(b,x,E),T},f=(w,k,b,x,E,T,v,_=.06,C)=>h(n(`b${w},${k},${b},${_}`,()=>new Xc.RoundedBoxGeometry(w,k,b,3,Math.min(_,w/2,k/2,b/2))),l(x,C),E,T,v),c=(w,k,b,x,E,T,v,_,C=32)=>h(n(`c${w},${k},${b},${C}`,()=>new V.CylinderGeometry(w,k,b,C)),l(x,_),E,T,v),d=(w,k,b,x,E,T,v=16,_=10)=>h(n(`s${w},${v},${_}`,()=>new V.SphereGeometry(w,v,_)),l(k,T),b,x,E),p=(w,k,b,x,E,T,v=0)=>{let _=h(n(`p${w},${k}`,()=>new V.PlaneGeometry(w,k)),b,x,E,T);return _.rotation.y=v,_},u,g;return{std:s,basic:r,glow:i,geo:n,mesh:h,rbox:f,cyl:c,ball:d,plane:p,shadow:(w,k,b,x)=>{g||(u=kt(128,128,T=>{let v=T.createRadialGradient(64,64,0,64,64,64);v.addColorStop(0,"rgba(0,0,0,.45)"),v.addColorStop(.5,"rgba(0,0,0,.22)"),v.addColorStop(1,"rgba(0,0,0,0)"),T.fillStyle=v,T.fillRect(0,0,128,128)}),g=new V.MeshBasicMaterial({map:u,transparent:!0,depthWrite:!1,toneMapped:!1}));let E=h(n(`p${w},${k}`,()=>new V.PlaneGeometry(w,k)),g,b,.012,x);return E.rotation.x=-Math.PI/2,E}}}function Xr(e,t,o,a,s,r,{color:i="#ffcf6b",light:n="#ffb35c",power:l=2.2,dist:h=4,size:f=.035,ly:c=.14}={}){let d=e.ball(f,e.basic(i),a,s,r,null,12,8);d.scale.y=1.8,t.add(d);let p=null;n&&(p=new V.PointLight(n,l,h,1.6),p.position.set(a,s+c,r),t.add(p));let u=o.length*377;return o.push(g=>{let m=1+Math.sin((g+u)*.013)*.08+Math.sin((g+u)*.031)*.06;p&&(p.intensity=l*m),d.scale.set(1,1.8*m,1)}),d}function iu(e,t,o){let a=o.win,s=a.frame,r=kt(256,256,a.sky),i=Ce;if(a.shape==="round"){let n=(De+Rt)/2,l=.78;t.add(e.mesh(new V.CircleGeometry(l+.32,48),e.std(a.plate||"#6b7480",{metalness:.6,roughness:.4}),Je,n,i+.005)),t.add(e.mesh(new V.CircleGeometry(l,48),e.basic("#ffffff",{map:r}),Je,n,i+.012));let h=e.mesh(new V.TorusGeometry(l+.04,.09,12,48),e.std(s,{metalness:.7,roughness:.3}),Je,n,i+.04);t.add(h);for(let f=0;f<8;f++){let c=f/8*Math.PI*2;t.add(e.ball(.04,"#cfd6de",Je+Math.cos(c)*(l+.22),n+Math.sin(c)*(l+.22),i+.03,{metalness:.8,roughness:.3},8,6))}}else if(a.shape==="arch"||a.shape==="pointed"){let n=$t/2,l=Rt+.3,h=a.shape==="arch"?l-n:De+.75,f=w=>{if(w.lineTo(n,h-De),a.shape==="arch")w.absarc(0,h-De,n,0,Math.PI,!1);else{let k=h-De+(l-h)*.72;w.quadraticCurveTo(n,k,0,l-De),w.quadraticCurveTo(-n,k,-n,h-De)}w.lineTo(-n,0)},c=new V.Shape;c.moveTo(-n,0),c.lineTo(n,0),f(c);let d=new V.ShapeGeometry(c,24),p=d.attributes.position,u=d.attributes.uv;for(let w=0;w<p.count;w++)u.setXY(w,(p.getX(w)+n)/$t,p.getY(w)/(l-De));t.add(e.mesh(d,e.basic("#ffffff",{map:r}),Je,De,i+.01));let g=new V.Path;g.moveTo(n,0),f(g);let m=g.getSpacedPoints(90).map(w=>new V.Vector3(Je+w.x,De+w.y,i+.06));if(t.add(e.mesh(new V.TubeGeometry(new V.CatmullRomCurve3(m),120,.07,8),e.std(s))),t.add(e.rbox($t+.3,.1,.25,s,Je,De-.05,i+.12)),t.add(e.rbox(.05,l-De-.05,.06,s,Je,(De+l)/2,i+.04),e.rbox($t,.05,.06,s,Je,h,i+.04)),a.shape==="pointed"){let w=e.mesh(new V.TorusGeometry(.2,.03,8,24),e.std(s),Je,h+(l-h)*.5,i+.05);t.add(w)}}else if(t.add(e.plane($t,Rt-De,e.basic("#ffffff",{map:r}),Je,(De+Rt)/2,i+.01)),t.add(e.rbox($t+.2,.1,.12,s,Je,Rt+.05,i+.06),e.rbox($t+.3,.1,.25,s,Je,De-.05,i+.12),e.rbox(.1,Rt-De,.12,s,Je-$t/2-.05,(De+Rt)/2,i+.06),e.rbox(.1,Rt-De,.12,s,Je+$t/2+.05,(De+Rt)/2,i+.06)),a.bars==="grid"){for(let n=1;n<4;n++)t.add(e.rbox(.04,Rt-De,.05,s,Je-$t/2+n*$t/4,(De+Rt)/2,i+.04,.01));for(let n=1;n<3;n++)t.add(e.rbox($t,.04,.05,s,Je,De+n*(Rt-De)/3,i+.04,.01))}else a.bars!=="none"&&t.add(e.rbox(.05,Rt-De,.06,s,Je,(De+Rt)/2,i+.04),e.rbox($t,.05,.06,s,Je,(De+Rt)/2,i+.04));if(a.curtain){let n=a.curtainH||2.1,l=a.curtainY||2.3;for(let h of[-1,1])t.add(e.rbox(.45,n,.08,a.curtain,Je+h*($t/2+.35),l,i+.12,.04));if(a.rod){let h=e.cyl(.03,.03,$t+1.4,a.rod,Je,l+n/2+.06,i+.14,null,12);h.rotation.z=Math.PI/2,t.add(h,e.ball(.06,a.rod,Je-$t/2-.7,l+n/2+.06,i+.14),e.ball(.06,a.rod,Je+$t/2+.7,l+n/2+.06,i+.14))}}}function nu(e,t,o,a){let s=a.win,r=Je,i=De,n=Rt,l=$t,h=(A,B)=>new V.Vector3(A+.35*B,.02,Ce+B),f=kt(4,128,(A,B,W)=>{let ae=A.createLinearGradient(0,0,0,W);ae.addColorStop(0,"#fff"),ae.addColorStop(1,"#000"),A.fillStyle=ae,A.fillRect(0,0,B,W)});f.colorSpace=V.NoColorSpace;let c=(A,B,W,ae)=>{let Me=new V.BufferGeometry;return Me.setAttribute("position",new V.Float32BufferAttribute([...A.toArray(),...B.toArray(),...W.toArray(),...ae.toArray()],3)),Me.setAttribute("uv",new V.Float32BufferAttribute([0,1,1,1,1,0,0,0],2)),Me.setIndex([0,1,2,0,2,3]),Me},d=new V.MeshBasicMaterial({color:s.shaft,alphaMap:f,transparent:!0,opacity:s.shaftOp,blending:V.AdditiveBlending,depthWrite:!1,side:V.DoubleSide,toneMapped:!1}),p=r-l/2,u=r+l/2,g=Ce+.02,m=new V.Vector3(p,n,g),w=new V.Vector3(u,n,g),k=new V.Vector3(p,i,g),b=new V.Vector3(u,i,g),x=h(p,n),E=h(u,n),T=h(p,i),v=h(u,i);for(let A of[c(m,w,E,x),c(k,b,v,T),c(m,k,T,x),c(w,b,v,E)])t.add(new V.Mesh(A,d));let _=kt(128,128,(A,B,W)=>{let ae=A.createRadialGradient(64,64,10,64,64,70);ae.addColorStop(0,"#fff"),ae.addColorStop(1,"#000"),A.fillStyle=ae,A.fillRect(0,0,B,W)});_.colorSpace=V.NoColorSpace,t.add(new V.Mesh(c(T,v,E,x),new V.MeshBasicMaterial({color:s.patch,alphaMap:_,transparent:!0,opacity:s.patchOp,blending:V.AdditiveBlending,depthWrite:!1,toneMapped:!1})));let C=70,L=new Float32Array(C*3),z=A=>{let B=Math.random(),W=i+Math.random()*(n-i),ae=h(p+Math.random()*l,W);L.set([V.MathUtils.lerp(p+Math.random()*l,ae.x,B),W*(1-B),V.MathUtils.lerp(g,ae.z,B)],A*3)};for(let A=0;A<C;A++)z(A);let N=new V.BufferGeometry;N.setAttribute("position",new V.BufferAttribute(L,3)),t.add(new V.Points(N,new V.PointsMaterial({color:s.dust,size:.035,transparent:!0,opacity:.8,blending:V.AdditiveBlending,depthWrite:!1,toneMapped:!1})));let Q=new V.DirectionalLight(s.sun[0],s.sun[1]);Q.position.set(r-3.5,10,Ce-10),Q.target.position.set(r+.5,0,-2),t.add(Q,Q.target);let F=0;o.push((A,B)=>{if(F+=B,!(F<=33)){F=0;for(let W=0;W<C;W++)L[W*3+1]+=.0015*Math.sin(A*.001+W),L[W*3]+=.0012,(L[W*3]>u+1.2||L[W*3+1]<.05)&&z(W);N.attributes.position.needsUpdate=!0}})}function lu(e,t,o){let{a,b:s,pillow:r}=o;if(o.kind==="bench"){let i=o.frame;if(t.add(e.rbox(1.1,.46,2.6,i,-4.4,.23,.5,.05)),t.add(e.rbox(.92,.2,1.14,s,-4.3,.56,-.07,.09),e.rbox(.92,.2,1.14,s,-4.3,.56,1.07,.09)),o.back&&t.add(e.rbox(.16,o.back,2.6,i,-4.88,o.back/2,.5,.04),e.rbox(.18,.62,2.3,a,-4.72,.98,.5,.08)),o.bolster)for(let n of[-.62,1.62]){let l=e.cyl(.15,.15,.9,o.bolster,-4.3,.78,n,null,20);l.rotation.z=Math.PI/2,t.add(l)}o.trim&&t.add(e.rbox(1.12,.05,2.62,o.trim,-4.4,.44,.5,.02,{metalness:.7,roughness:.35}))}else{let i=o.r??.12,n=o.backH||1;if(t.add(e.rbox(1.1,.45,2.4,a,-4.4,.25,.5,i),e.rbox(.32,n,2.4,a,-4.82,.1+n/2,.5,i+.02),e.rbox(1.1,.7,.3,a,-4.4,.35,-.75,i),e.rbox(1.1,.7,.3,a,-4.4,.35,1.75,i),e.rbox(.85,.2,1.08,s,-4.3,.56,0,i*.75),e.rbox(.85,.2,1.08,s,-4.3,.56,1,i*.75)),o.tufts)for(let l=0;l<2;l++)for(let h=0;h<6;h++)t.add(e.ball(.03,o.tufts,-4.65,.95+l*.32,-.4+h*.36+(l?.18:0),{metalness:.6,roughness:.3},8,6));if(o.legs)for(let l of[-4.85,-3.95])for(let h of[-.8,1.8])t.add(e.cyl(.04,.03,.12,o.legs,l,.06,h,null,10));o.glow&&t.add(e.rbox(1.14,.04,2.44,e.glow(o.glow,2.2),-4.4,.035,.5,.02))}r&&t.add(e.rbox(.18,.5,.5,r,-4.55,.85,-.25,.08)),t.add(e.shadow(1.6,3.2,-4.3,.5))}function cu(e,t,o){if(!(!o||!o.items))for(let[a,s,r,i,n,l=2.4]of o.items){o.frame&&t.add(e.rbox(.05,i+.12,r+.12,o.frame,_e+.03,l,a,.02,o.frameMetal?{metalness:.75,roughness:.3}:void 0));let h=n?e.std("#ffffff",{map:kt(128,Math.round(128*i/r),n),emissive:"#ffffff",emissiveIntensity:.06}):e.std(s,{emissive:s,emissiveIntensity:.15}),f=e.plane(r,i,h,_e+.06,l,a,Math.PI/2);t.add(f)}}function du(e,t,o,a){if(a.kind==="stump"?t.add(e.cyl(.3,.34,.58,a.top,-4.3,.29,-1.45,null,18),e.cyl(.3,.3,.01,a.leg,-4.3,.585,-1.45,null,18)):t.add(e.cyl(.32,.26,.06,a.top,-4.3,.55,-1.45),e.cyl(.05,.05,.52,a.leg,-4.3,.26,-1.45),e.cyl(.2,.22,.03,a.leg,-4.3,.015,-1.45)),t.add(e.shadow(.8,.8,-4.3,-1.45)),a.orb){t.add(e.ball(.11,e.glow(a.orb,2),-4.3,.7,-1.45,null,20,14),e.cyl(.08,.1,.04,"#3a3f4a",-4.3,.6,-1.45,null,16));let s=Vo(t,a.light,a.power,-4.3,.9,-1.45,4);o.push(r=>{s.intensity=a.power*(.85+Math.sin(r*.002)*.15)})}else t.add(e.cyl(.07,.07,.22,a.candle,-4.3,.69,-1.45)),Xr(e,t,o,-4.3,.86,-1.45,{color:a.flame,light:a.light,power:a.power})}function hu(e,t,o){if(o.shape==="rect"){let r=kt(512,384,ru(o)),i=e.mesh(new V.PlaneGeometry(3.4,2.5),o.glow?e.std("#ffffff",{map:r,emissive:"#ffffff",emissiveMap:r,emissiveIntensity:.5}):e.std("#ffffff",{map:r}),.6,.006,.9);i.rotation.x=-Math.PI/2,t.add(i);return}let a=e.mesh(new V.CircleGeometry(1.8,64),e.std(o.a),.6,.006,.9);a.rotation.x=-Math.PI/2;let s=e.mesh(new V.RingGeometry(1.25,1.42,64),o.glow?e.glow(o.b,1.6):e.std(o.b),.6,.008,.9);s.rotation.x=-Math.PI/2,o.shape==="oval"&&(a.scale.set(1.15,.8,1),s.scale.set(1.15,.8,1)),t.add(a,s)}function fu(e,t,o){let a=o.r??.08;if(t.add(e.rbox(2.1,.38,3,o.frame,3.55,.2,-2.5,a),e.rbox(2,.26,2.9,o.sheet,3.55,.5,-2.5,.1),e.rbox(2.06,.08,1.95,o.blanket,3.55,.64,-1.97,.05),e.rbox(1.3,.2,.55,o.pillow,3.55,.72,-3.55,.1),e.rbox(2.1,o.headH||1.3,.14,o.head,3.55,(o.headH||1.3)/2,-3.95,a*.75),e.shadow(2.6,3.5,3.55,-2.5)),o.stripe&&t.add(e.rbox(2.08,.085,.18,o.stripe,3.55,.645,-1.3,.03)),o.glow&&t.add(e.rbox(2.16,.05,3.06,e.glow(o.glow,2.2),3.55,.04,-2.5,.02)),o.posts){let s=o.postH||2.6;for(let r of[2.56,4.54])for(let i of[-1.06,-3.94])t.add(e.cyl(.055,.065,s,o.posts,r,s/2,i,null,12),e.ball(.08,o.finial||o.posts,r,s+.05,i,null,12,8));for(let r of[-1.06,-3.94])t.add(e.rbox(2.06,.08,.08,o.posts,3.55,s-.04,r,.02));for(let r of[2.56,4.54])t.add(e.rbox(.08,.08,2.9,o.posts,r,s-.04,-2.5,.02));if(o.drape){t.add(e.rbox(2.04,.04,2.86,o.drape,3.55,s-.02,-2.5,.015)),t.add(e.rbox(2.04,.36,.05,o.drape,3.55,s-.2,-1.04,.02));for(let r of[2.56,4.54])t.add(e.rbox(.05,.36,2.86,o.drape,r,s-.2,-2.5,.02));for(let r of[2.62,4.48])t.add(e.rbox(.22,s-.5,.16,o.drape,r,(s-.5)/2+.3,-1.12,.06),e.rbox(.3,s-.3,.12,o.drape,r,(s-.3)/2+.15,-3.86,.05))}}}function uu(e,t,o,a){if(t.add(e.rbox(1.9,.08,.85,a.top,1,.78,-3.5,.03)),a.legW)for(let[n,l]of[[.12,-3.83],[1.88,-3.83],[.12,-3.17],[1.88,-3.17]])t.add(e.rbox(a.legW,.76,a.legW,a.leg,n,.38,l,.02));else for(let[n,l]of[[.1,-3.85],[1.9,-3.85],[.1,-3.15],[1.9,-3.15]])t.add(e.cyl(.035,.035,.76,a.leg,n,.38,l));t.add(e.shadow(2.3,1.2,1,-3.5));let s=kt(256,160,au(a.screen));if(a.screenKind==="holo"){let n=e.plane(.86,.54,new V.MeshBasicMaterial({map:s,transparent:!0,opacity:.85,blending:V.AdditiveBlending,depthWrite:!1,side:V.DoubleSide,toneMapped:!1}),.9,1.22,-3.7);t.add(n,e.cyl(.16,.18,.04,a.dark,.9,.84,-3.7,{metalness:.6,roughness:.35},24),e.cyl(.12,.12,.012,e.glow(a.screen.ink,2),.9,.865,-3.7,null,24)),o.push(l=>{n.material.opacity=.78+Math.sin(l*.006)*.06})}else{let n=a.screenKind==="mirror",l=n?1:.9,h=n?.68:.58;t.add(e.rbox(l,h,.05,a.dark,.9,1.18,-3.73,.02,n?{metalness:.8,roughness:.3}:void 0)),t.add(e.plane(.82,.5,e.basic("#ffffff",{map:s}),.9,1.18,-3.7)),t.add(e.cyl(.03,.03,.18,a.dark,.9,.9,-3.75),e.cyl(.14,.14,.02,a.dark,.9,.83,-3.75)),n&&t.add(e.ball(.06,a.dark,.9,1.56,-3.73,{metalness:.8,roughness:.3},12,8))}let r=1.65,i=-3.6;if(a.lamp==="candles"){t.add(e.cyl(.1,.12,.03,a.lampColor,r,.83,i,{metalness:.7,roughness:.35}),e.cyl(.015,.02,.36,a.lampColor,r,1,i,{metalness:.7,roughness:.35}));let n=e.rbox(.42,.025,.025,a.lampColor,r,1.12,i,.01,{metalness:.7,roughness:.35});t.add(n);for(let l of[-.2,0,.2]){let h=l?1.2:1.26;t.add(e.cyl(.025,.025,l?.14:.26,a.candle||"#f3ead6",r+l,h-(l?0:.06),i)),Xr(e,t,o,r+l,h+.1,i,{size:.025,light:l===0?a.lampLight:null,power:2.6,dist:4.5})}}else if(a.lamp==="lantern"){t.add(e.rbox(.2,.04,.2,a.lampColor,r,.84,i,.01),e.rbox(.17,.3,.17,e.glow(a.lampGlow||"#fff1c9",1.3),r,1,i,.02),e.rbox(.22,.04,.22,a.lampColor,r,1.17,i,.01));for(let[n,l]of[[-.09,-.09],[.09,-.09],[-.09,.09],[.09,.09]])t.add(e.rbox(.02,.32,.02,a.lampColor,r+n,1,i+l,.005));Vo(t,a.lampLight,2.5,r,1.15,-3.45,4.5)}else if(a.lamp==="neon")t.add(e.cyl(.08,.1,.03,a.dark,r,.83,i,null,16),e.cyl(.025,.025,.6,e.glow(a.lampColor,3),r,1.14,i,null,12)),Vo(t,a.lampLight,2.6,r,1.15,-3.45,4.5);else if(a.lamp==="oil"){let n=e.ball(.09,a.lampColor,r,.88,i,{metalness:.7,roughness:.35},16,10);n.scale.set(1.5,.6,1),t.add(n,e.cyl(.02,.03,.08,a.lampColor,r+.13,.9,i,{metalness:.7,roughness:.35},10)),Xr(e,t,o,r+.14,.98,i,{size:.03,light:a.lampLight,power:2.6,dist:4.5,ly:.17})}else t.add(e.cyl(.1,.12,.03,a.lampColor,r,.83,i),e.cyl(.015,.015,.42,a.lampColor,r,1.04,i),e.cyl(.07,.17,.18,a.lampColor,r,1.3,i,{emissive:a.lampColor,emissiveIntensity:.25})),Vo(t,a.lampLight,2.5,r,1.15,-3.45,4.5).decay=1.4}function pu(e,t,o){if(!o)return;t.add(e.rbox(1.7,.06,.3,o.board,1,2.15,-3.85,.02));let a=.3;for(let[s,r]of o.books)t.add(e.rbox(.11,s,.22,r,a,2.18+s/2,-3.84,.015)),a+=.13;o.vase&&t.add(e.cyl(.12,.09,.16,o.vase,1.55,2.26,-3.84))}function mu(e,t,o,a){t.add(e.shadow(1,1,-4.35,-3.4));let n=(()=>{if(a.potKind==="barrel"){t.add(e.cyl(.32,.28,.55,a.pot,-4.35,.28,-3.4,null,20));for(let h of[.12,.44])t.add(e.cyl(.33,.33,.04,"#3a3a3a",-4.35,h,-3.4,{metalness:.6,roughness:.4},20))}else if(a.potKind==="amphora"){let h=e.ball(.3,a.pot,-4.35,.36,-3.4,null,20,14);return h.scale.set(1,1.25,1),t.add(h,e.cyl(.16,.2,.18,a.pot,-4.35,.78,-3.4,null,20),e.cyl(.2,.16,.05,a.pot,-4.35,.88,-3.4,null,20)),.9}else{if(a.potKind==="stand")return t.add(e.rbox(.72,.42,.62,a.stand,-4.35,.21,-3.4,.03),e.rbox(.62,.14,.42,a.pot,-4.35,.49,-3.4,.03)),.56;t.add(e.cyl(.32,.24,.55,a.pot,-4.35,.28,-3.4,a.potMetal?{metalness:.7,roughness:.35}:void 0))}return .55})(),l=(h,f,c,d,p)=>{for(let u=0;u<h;u++){let g=u/h*Math.PI*2,m=f[u%f.length],w=e.ball(.22,p?e.glow(m,p):m,-4.35+Math.cos(g)*.18,d+u%3*.12,-3.4+Math.sin(g)*.18);w.scale.set(...c),w.rotation.set(Math.sin(g)*.5,0,-Math.cos(g)*.5),t.add(w)}};if(a.kind==="bonsai"){let h=a.trunk||"#5a3b26",f=e.cyl(.05,.08,.45,h,-4.35+.05,n+.2,-3.4,null,10);f.rotation.z=-.35;let c=e.cyl(.035,.05,.4,h,-4.35-.06,n+.52,-3.4,null,10);c.rotation.z=.6,t.add(f,c);for(let[d,p,u,g]of[[-.2,.7,0,1],[.18,.55,.05,.8],[.02,.85,-.05,.75],[-.05,.6,.18,.6]]){let m=e.ball(.24,d>0?a.leaves[0]:a.leaves[1],-4.35+d,n+p,-3.4+u,null,14,8);m.scale.set(1.2*g,.45*g,1*g),t.add(m)}}else if(a.kind==="palm"){let h=-4.35,f=n;for(let c=0;c<6;c++){let d=e.cyl(.06,.075,.24,a.trunk||"#8a6a44",h,f+.12,-3.4,null,10);d.rotation.z=-.08*c,t.add(d),h+=.025*c,f+=.22}for(let c=0;c<8;c++){let d=c/8*Math.PI*2,p=e.ball(.3,a.leaves[c%2],h+Math.cos(d)*.3,f+.02,-3.4+Math.sin(d)*.3,null,12,6);p.scale.set(1.4,.08,.32),p.rotation.set(0,-d,-.45),t.add(p)}t.add(e.ball(.06,"#6b4a2a",h,f-.05,-3.4+.05,null,10,6),e.ball(.06,"#6b4a2a",h+.06,f-.06,-3.4-.03,null,10,6))}else if(a.kind==="topiary"){t.add(e.cyl(.03,.035,.55,a.trunk||"#6b4a2a",-4.35,n+.27,-3.4,null,10));let h=e.ball(.36,a.leaves[0],-4.35,n+.78,-3.4,null,20,14);t.add(h);for(let f=0;f<26;f++){let c=Math.random()*Math.PI*2,d=Math.acos(ke(-1,1));t.add(e.ball(.07,a.leaves[1],-4.35+Math.sin(d)*Math.cos(c)*.34,n+.78+Math.cos(d)*.34,-3.4+Math.sin(d)*Math.sin(c)*.34,null,8,6))}if(a.berries)for(let f=0;f<8;f++){let c=f/8*Math.PI*2;t.add(e.ball(.035,a.berries,-4.35+Math.cos(c)*.37,n+.8+Math.sin(c*3)*.12,-3.4+Math.sin(c)*.37,null,8,6))}}else if(a.kind==="crystal"){let h=e.geo("oct",()=>new V.OctahedronGeometry(.16,0)),f=[];for(let[d,p,u,g]of[[0,0,1.4,0],[.14,.06,.9,1],[-.12,.08,1,0],[.05,-.14,.7,1],[-.1,-.1,.6,1]]){let m=e.mesh(h,e.glow(a.leaves[g],1.2,{roughness:.2,metalness:.1,transparent:!0,opacity:.9}),-4.35+d,n+.16*u*1.6,-3.4+p);m.scale.set(.6,u*1.6,.6),m.rotation.set(p*2,0,-d*2),t.add(m),f.push(m)}let c=Vo(t,a.leaves[0],1.6,-4.35,n+.5,-3.4+.3,3);o.push(d=>{c.intensity=1.6+Math.sin(d*.0025)*.4})}else if(l(a.n||9,a.leaves,a.leafScale||[.55,1.6,.35],n+.4,a.glow),a.flowers)for(let h=0;h<6;h++){let f=h/6*Math.PI*2+.3;t.add(e.ball(.06,a.flowers,-4.35+Math.cos(f)*.26,n+.62+h%3*.13,-3.4+Math.sin(f)*.26,null,10,8))}}function e0(e,t=Ks){let o=Ys[t]?t:Ks,a=yu(o),s=su(),r=new V.Group;r.name=`room:${o}`;let i=[],n=kt(512,512,a.floor.paint);n.wrapS=n.wrapT=V.RepeatWrapping,n.repeat.set(...a.floor.repeat);let l=new V.Mesh(new V.PlaneGeometry(wt,At),s.std("#ffffff",{map:n,roughness:a.floor.rough,metalness:a.floor.metal||0}));l.rotation.x=-Math.PI/2,l.name="floor",r.add(l);let h,f;if(a.wall.paint){let p=kt(512,512,a.wall.paint);p.wrapS=p.wrapT=V.RepeatWrapping;let u=p.clone();p.repeat.set(wt/a.wall.tile,Be/a.wall.tile),u.repeat.set(At/a.wall.tile,Be/a.wall.tile),u.needsUpdate=!0,h=s.std(a.wall.back,{map:p}),f=s.std(a.wall.left,{map:u})}else h=s.std(a.wall.back),f=s.std(a.wall.left);let c=new V.Mesh(new V.PlaneGeometry(wt,Be),h);c.position.set(0,Be/2,Ce);let d=new V.Mesh(new V.PlaneGeometry(At,Be),f);if(d.rotation.y=Math.PI/2,d.position.set(_e,Be/2,0),r.add(c,d),a.wains){let p=a.wains,u=p.h;if(r.add(s.rbox(wt,u,.06,p.back,0,u/2,Ce+.03,.02),s.rbox(.06,u,At,p.left,_e+.03,u/2,0,.02)),p.paint){let g=kt(512,64,p.paint);g.wrapS=V.RepeatWrapping;let m=g.clone();g.repeat.set(wt/(u*8),1),m.repeat.set(At/(u*8),1),m.needsUpdate=!0,r.add(s.plane(wt,u,s.std("#ffffff",{map:g}),0,u/2,Ce+.062),s.plane(At,u,s.std("#ffffff",{map:m}),_e+.062,u/2,0,Math.PI/2))}if(p.rail){let g=p.railGlow?s.glow(p.rail,p.railGlow):p.rail;r.add(s.rbox(wt,.08,.08,g,0,u+.02,Ce+.05,.03),s.rbox(.08,.08,At,g,_e+.05,u+.02,0,.03))}}return iu(s,r,a),nu(s,r,i,a),lu(s,r,a.sofa),cu(s,r,a.art),du(s,r,i,a.table),hu(s,r,a.rug),fu(s,r,a.bed),uu(s,r,i,a.desk),pu(s,r,a.shelf),mu(s,r,i,a.plant),$u[o]?.(s,r,i,a),e.add(r),{id:o,group:r,floor:l,look:{bg:a.bg,...a.light},tick(p,u){for(let g of i)g(p,u)}}}var V,Xc,wt,At,Be,Ce,_e,Je,De,Rt,$t,ke,Ws,kt,$o,xt,gr,xn,Eo,Uc,yr,Kr,Jc,Ff,Zf,Us,Wf,Uf,Yf,Kf,Xf,Jf,eu,tu,ou,_o,au,ru,Vo,Zs,Yc,Kc,Da,$u,gu,Ys,kn,Ks,yu,t0=Ye(()=>{V=_t(Do(),1),Xc=_t(Wc(),1),wt=10,At=8,Be=4.2,Ce=-At/2,_e=-wt/2,Je=-1.2,De=1.6,Rt=3.1,$t=2,ke=(e,t)=>e+Math.random()*(t-e),Ws=e=>e[Math.floor(Math.random()*e.length)],kt=(e,t,o)=>{let a=document.createElement("canvas");a.width=e,a.height=t,o(a.getContext("2d"),e,t);let s=new V.CanvasTexture(a);return s.colorSpace=V.SRGBColorSpace,s},$o=(e,t,o,a)=>{let s=e.createLinearGradient(0,0,0,o);for(let[r,i]of a)s.addColorStop(r,i);e.fillStyle=s,e.fillRect(0,0,t,o)},xt=(e,t,o,a,s)=>{e.fillStyle=s,e.beginPath(),e.arc(t,o,a,0,Math.PI*2),e.fill()},gr=(e,t,o,a,s)=>{let r=e.createRadialGradient(t,o,0,t,o,a);r.addColorStop(0,s),r.addColorStop(1,"rgba(0,0,0,0)"),e.fillStyle=r,e.fillRect(t-a,o-a,a*2,a*2)},xn=(e,t,o,a,s=.9)=>{for(let r=0;r<a;r++){let i=Math.random()<.12?2:1;e.fillStyle=`rgba(255,255,255,${ke(.25,s)})`,e.fillRect(ke(0,t),ke(0,o),i,i)}},Eo=(e,t,o,a,s)=>{e.fillStyle=a,e.beginPath(),e.moveTo(0,o);for(let[r,i]of s)e.lineTo(r,i);e.lineTo(t,o),e.fill()},Uc=(e,t,o,a,s,r)=>{e.fillStyle=s;for(let i=0;i<3;i++){let n=o-i*a*.55;e.beginPath(),e.moveTo(t-a*(.55-i*.12),n),e.lineTo(t,n-a*.75),e.lineTo(t+a*(.55-i*.12),n),e.fill()}r&&(e.fillStyle=r,e.beginPath(),e.moveTo(t-a*.13,o-a*1.6),e.lineTo(t,o-a*1.85),e.lineTo(t+a*.13,o-a*1.6),e.fill())},yr=(e,t,o,a,s,r=[1,3])=>{for(let i=0;i<a;i++){e.fillStyle=s.replace("$",ke(.02,.09).toFixed(3));let n=ke(r[0],r[1]);e.fillRect(ke(0,t),ke(0,o),n,n)}},Kr=({base:e,a:t,b:o,seam:a,grain:s,n:r=8})=>(i,n,l)=>{i.fillStyle=e,i.fillRect(0,0,n,l);for(let h=0;h<r;h++){let f=h*l/r;i.fillStyle=h%2?t:o,i.fillRect(0,f,n,l/r-3),i.fillStyle=a,i.fillRect(h*197%n,f,3,l/r);for(let c=0;c<6;c++)i.fillStyle=`rgba(${s},${.05+Math.random()*.05})`,i.fillRect(Math.random()*n,f+Math.random()*(l/r),40+Math.random()*80,2)}},Jc=(e,t,o,a,s=14)=>{e.strokeStyle=a;for(let r=0;r<s;r++){e.globalAlpha=ke(.12,.4),e.lineWidth=ke(.6,2.2);let i=ke(0,t),n=ke(-40,o);e.beginPath(),e.moveTo(i,n);for(let l=0;l<7;l++)i+=ke(-50,50),n+=ke(10,50),e.lineTo(i,n);e.stroke()}e.globalAlpha=1},Ff=({a:e,b:t,n:o=4,vein:a,grout:s})=>(r,i,n)=>{let l=i/o;for(let h=0;h<o;h++)for(let f=0;f<o;f++)r.fillStyle=(h+f)%2?e:t,r.fillRect(h*l,f*l,l,l);if(a&&Jc(r,i,n,a,18),s){r.fillStyle=s;for(let h=0;h<=o;h++)r.fillRect(h*l-1,0,2,n),r.fillRect(0,h*l-1,i,2)}},Zf=(e,t)=>(o,a,s)=>{o.fillStyle=e,o.fillRect(0,0,a,s),yr(o,a,s,300,"rgba(120,100,80,$)"),Jc(o,a,s,t,16)},Us=({cols:e,grout:t,rows:o=6,minW:a=60,maxW:s=140})=>(r,i,n)=>{r.fillStyle=t,r.fillRect(0,0,i,n);let l=n/o;for(let h=0;h<o;h++){let f=h%2?-s/2:0;for(;f<i;){let c=Math.min(ke(a,s),i-f+s);r.fillStyle=Ws(e),r.fillRect(f+3,h*l+3,c-6,l-6);for(let d=0;d<10;d++)r.fillStyle=`rgba(0,0,0,${ke(.03,.12).toFixed(3)})`,r.fillRect(ke(f,f+c-8),ke(h*l+3,h*l+l-8),ke(2,9),ke(2,6));r.fillStyle="rgba(255,255,255,.06)",r.fillRect(f+3,h*l+3,c-6,3),f+=c}}},Wf=(e,t,o)=>{let a=(s,r,i,n,l)=>{if(e.fillStyle="#cfc58c",e.fillRect(s,r,i,n),e.fillStyle="rgba(110,100,40,.16)",l)for(let h=0;h<i;h+=4)e.fillRect(s+h,r,1,n);else for(let h=0;h<n;h+=4)e.fillRect(s,r+h,i,1);e.fillStyle="#2f3b2c",l?(e.fillRect(s,r,9,n),e.fillRect(s+i-9,r,9,n)):(e.fillRect(s,r,i,9),e.fillRect(s,r+n-9,i,9)),e.fillStyle="rgba(40,30,10,.35)",e.fillRect(s,r,i,1),e.fillRect(s,r,1,n)};a(0,0,t,o/2,!1),a(0,o/2,t/2,o/2,!0),a(t/2,o/2,t/2,o/2,!0)},Uf=({base:e,light:t,seam:o,rivet:a})=>(s,r,i)=>{let n=r/2;for(let l=0;l<2;l++)for(let h=0;h<2;h++){let f=s.createLinearGradient(l*n,h*n,l*n+n,h*n+n);f.addColorStop(0,t),f.addColorStop(1,e),s.fillStyle=f,s.fillRect(l*n,h*n,n,n),s.fillStyle=o,s.fillRect(l*n,h*n,n,4),s.fillRect(l*n,h*n,4,n),s.fillStyle=a;for(let[c,d]of[[16,16],[n-16,16],[16,n-16],[n-16,n-16]])s.beginPath(),s.arc(l*n+c,h*n+d,5,0,7),s.fill();s.fillStyle="rgba(0,0,0,.12)";for(let c=0;c<6;c++)s.fillRect(l*n+40,h*n+50+c*28,n-80,6)}},Yf=(e,t,o)=>{e.fillStyle="#140d2a",e.fillRect(0,0,t,o),yr(e,t,o,600,"rgba(255,255,255,$)"),e.fillStyle="rgba(0,240,255,.35)";for(let a=0;a<4;a++)e.fillRect(a*(t/4),0,2,o),e.fillRect(0,a*(o/4),t,2);e.fillStyle="rgba(255,60,200,.22)",e.fillRect(t/8,0,1,o),e.fillRect(0,o/8*5,t,1)},Kf=({cols:e,n:t=7})=>(o,a,s)=>{let r=s/t;for(let i=0;i<t;i++){let n=i*r,l=e[i%e.length],h=o.createLinearGradient(0,n,0,n+r);h.addColorStop(0,"rgba(20,10,0,.55)"),h.addColorStop(.18,l),h.addColorStop(.6,l),h.addColorStop(1,"rgba(20,10,0,.65)"),o.fillStyle=l,o.fillRect(0,n,a,r),o.fillStyle=h,o.fillRect(0,n,a,r);for(let f=0;f<10;f++)o.fillStyle=`rgba(50,25,5,${ke(.08,.2).toFixed(3)})`,o.fillRect(ke(0,a),n+ke(r*.25,r*.75),ke(30,110),2);for(let f=0;f<2;f++)o.fillStyle="rgba(40,20,5,.35)",o.beginPath(),o.ellipse(ke(0,a),n+r/2,6,4,0,0,7),o.fill()}},Xf=(e,t)=>(o,a,s)=>{o.fillStyle=e,o.fillRect(0,0,a,s);for(let r=0;r<a;r+=32)o.fillStyle=t,o.fillRect(r,0,3,s),o.fillStyle="rgba(255,255,255,.35)",o.fillRect(r+3,0,2,s);yr(o,a,s,200,"rgba(120,100,70,$)")},Jf=({base:e,line:t,dark:o})=>(a,s,r)=>{a.fillStyle=e,a.fillRect(0,0,s,r);for(let[i,n,l,h]of[[0,0,s/2,r/3],[s/2,0,s/2,r/3],[0,r/3,s,r/3],[0,r/3*2,s/3,r/3],[s/3,r/3*2,s/3*2,r/3]])a.fillStyle=t,a.fillRect(i,n,l,3),a.fillRect(i,n,3,h),a.fillStyle="rgba(255,255,255,.35)",a.fillRect(i+3,n+3,l-6,2),a.fillStyle=o,a.fillRect(i+14,n+h-24,40,8)},eu=e=>(t,o,a)=>{t.fillStyle=e,t.fillRect(0,0,o,a),yr(t,o,a,1400,"rgba(255,255,255,$)",[1,4]),yr(t,o,a,900,"rgba(0,0,0,$)",[2,6]),t.fillStyle="rgba(0,0,0,.25)";for(let s=0;s<=o;s+=o/2)t.fillRect(s,0,3,a);t.fillRect(0,a/2,o,3)},tu=e=>(t,o,a)=>{t.fillStyle=e,t.fillRect(0,0,o,a),yr(t,o,a,900,"rgba(110,90,60,$)",[1,5])},ou=(e,t)=>(o,a,s)=>{o.fillStyle=e,o.fillRect(0,0,a,s),o.fillStyle=t,o.fillRect(0,6,a,5),o.fillRect(0,s-11,a,5);let r=(s-34)/4,i=17;for(let n=0;n<a;n+=r*5)o.fillRect(n,i,r,r*4),o.fillRect(n,i,r*4,r),o.fillRect(n+r*3,i,r,r*3),o.fillRect(n+r*2,i+r*2,r*2,r),o.fillRect(n+r*2,i+r*2,r,r*2-0),o.fillRect(n,i+r*3,r*5,r)},_o={cozy:(e,t,o)=>{let a=e.createLinearGradient(0,0,0,o);a.addColorStop(0,"#7cc4ff"),a.addColorStop(.65,"#ffd9a8"),a.addColorStop(1,"#ffb88a"),e.fillStyle=a,e.fillRect(0,0,t,o),e.fillStyle="rgba(255,255,255,.85)";for(let[s,r,i]of[[60,70,22],[85,64,28],[112,72,20],[180,120,16],[198,114,22]])e.beginPath(),e.arc(s,r,i,0,Math.PI*2),e.fill();e.fillStyle="#8d6fd1",e.beginPath(),e.moveTo(0,o),e.lineTo(70,180),e.lineTo(130,215),e.lineTo(200,170),e.lineTo(t,200),e.lineTo(t,o),e.fill()},gothic:(e,t,o)=>{$o(e,t,o,[[0,"#0d0626"],[.6,"#341a5c"],[1,"#6d2350"]]),xn(e,t,o*.7,90),gr(e,172,74,70,"rgba(255,240,210,.35)"),xt(e,172,74,30,"#f3ead0"),xt(e,162,66,6,"rgba(180,170,150,.5)"),xt(e,182,84,4,"rgba(180,170,150,.5)"),e.fillStyle="#0a0518",e.beginPath(),e.moveTo(0,o),e.lineTo(0,200),e.lineTo(40,196),e.lineTo(40,150),e.lineTo(52,110),e.lineTo(64,150),e.lineTo(64,190),e.lineTo(110,186),e.lineTo(110,160),e.lineTo(118,140),e.lineTo(126,160),e.lineTo(126,184),e.lineTo(200,188),e.lineTo(200,130),e.lineTo(214,84),e.lineTo(228,130),e.lineTo(228,192),e.lineTo(t,198),e.lineTo(t,o),e.fill(),e.strokeStyle="#0a0518",e.lineWidth=2;for(let[a,s]of[[90,60],[120,84],[70,96]])e.beginPath(),e.moveTo(a-7,s-3),e.quadraticCurveTo(a-3,s,a,s+2),e.quadraticCurveTo(a+3,s,a+7,s-3),e.stroke()},roman:(e,t,o)=>{$o(e,t,o,[[0,"#5fb3f0"],[.7,"#cfe8f5"],[1,"#f6e3c0"]]),gr(e,200,50,60,"rgba(255,250,220,.7)"),xt(e,200,50,16,"#fffbe8"),Eo(e,t,o,"#a7b07a",[[0,190],[60,170],[140,182],[210,166],[t,178]]),Eo(e,t,o,"#7d8a4f",[[0,215],[90,200],[170,212],[t,204]]),e.fillStyle="#f2ecdf",e.fillRect(120,160,46,4),e.beginPath(),e.moveTo(118,160),e.lineTo(143,148),e.lineTo(168,160),e.fill();for(let a=0;a<5;a++)e.fillRect(122+a*10,164,3,16);e.fillRect(118,180,50,3),e.fillStyle="#2f4a26";for(let[a,s]of[[30,1],[44,.8],[226,1.1],[240,.85]])e.beginPath(),e.ellipse(a,205-34*s,7*s,36*s,0,0,7),e.fill()},japanese:(e,t,o)=>{$o(e,t,o,[[0,"#ffb3c7"],[.55,"#ffd2b0"],[1,"#ffe9c9"]]),xt(e,70,90,22,"#ff6b5b"),e.fillStyle="#7a86b8",e.beginPath(),e.moveTo(20,230),e.lineTo(110,120),e.lineTo(146,120),e.lineTo(236,230),e.fill(),e.fillStyle="#ffffff",e.beginPath(),e.moveTo(92,142),e.lineTo(110,120),e.lineTo(146,120),e.lineTo(164,142),e.lineTo(150,136),e.lineTo(138,146),e.lineTo(126,136),e.lineTo(112,146),e.lineTo(102,136),e.fill(),Eo(e,t,o,"#4d5a7c",[[0,220],[80,214],[180,222],[t,212]]),e.strokeStyle="#4a2a20",e.lineWidth=4,e.beginPath(),e.moveTo(t,20),e.quadraticCurveTo(200,30,160,10),e.stroke();for(let a=0;a<26;a++)xt(e,ke(150,t),ke(0,50),ke(4,9),Ws(["#ffc0d4","#ff9fbe","#ffe0ea"]))},scandi:(e,t,o)=>{$o(e,t,o,[[0,"#a9c4dc"],[.7,"#dfe8ef"],[1,"#f4f6f8"]]),Eo(e,t,o,"#eef2f5",[[0,190],[70,176],[150,186],[t,172]]);for(let[a,s,r]of[[26,200,30],[58,196,22],[190,194,34],[228,200,26],[120,206,18]])Uc(e,a,s,r,"#3e5a4f","#ffffff");Eo(e,t,o,"#ffffff",[[0,214],[120,208],[t,216]]);for(let a=0;a<40;a++)xt(e,ke(0,t),ke(0,o),ke(1,2.4),"rgba(255,255,255,.85)")},cyberpunk:(e,t,o)=>{$o(e,t,o,[[0,"#0a0620"],[.55,"#2a0b4a"],[1,"#ff2fa0"]]);for(let a=0;a<18;a++){let s=ke(16,34),r=ke(60,190),i=ke(-10,t),n=o-r;e.fillStyle=Ws(["#120a2a","#1a0f38","#0e0822"]),e.fillRect(i,n,s,r);for(let l=n+6;l<o-4;l+=8)for(let h=i+3;h<i+s-3;h+=6)Math.random()<.35&&(e.fillStyle=Ws(["#ffe36b","#00f0ff","#ff4fd8","#9b7bff"]),e.fillRect(h,l,3,3))}e.fillStyle="#00f0ff",e.fillRect(30,120,34,6),e.fillStyle="#ff4fd8",e.fillRect(180,96,8,30),e.strokeStyle="rgba(160,200,255,.35)",e.lineWidth=1;for(let a=0;a<90;a++){let s=ke(0,t),r=ke(0,o);e.beginPath(),e.moveTo(s,r),e.lineTo(s-3,r+12),e.stroke()}},beach:(e,t,o)=>{$o(e,t,o,[[0,"#4fb6f2"],[.55,"#bfe9ff"],[.62,"#bfe9ff"]]),gr(e,190,70,60,"rgba(255,250,200,.7)"),xt(e,190,70,18,"#fff6c8"),e.fillStyle="rgba(255,255,255,.9)";for(let[s,r,i]of[[50,50,14],[68,46,18],[86,52,12]])e.beginPath(),e.arc(s,r,i,0,7),e.fill();let a=e.createLinearGradient(0,150,0,205);a.addColorStop(0,"#1ba3c6"),a.addColorStop(1,"#5fe0d6"),e.fillStyle=a,e.fillRect(0,150,t,60),e.fillStyle="rgba(255,255,255,.7)";for(let s=0;s<14;s++)e.fillRect(ke(0,t),ke(156,200),ke(10,26),2);Eo(e,t,o,"#f5deb0",[[0,212],[100,204],[t,214]]),e.strokeStyle="#5a3d22",e.lineWidth=6,e.beginPath(),e.moveTo(40,o),e.quadraticCurveTo(30,170,56,120),e.stroke(),e.fillStyle="#2f8a4a";for(let s of[-2.6,-2,-1.2,-.5,.2])e.beginPath(),e.ellipse(56+Math.cos(s)*26,120+Math.sin(s)*12+8,30,7,s,0,7),e.fill()},cabin:(e,t,o)=>{$o(e,t,o,[[0,"#2c2a5a"],[.5,"#a85a7a"],[1,"#ffb27a"]]),xn(e,t,o*.35,30,.7),Eo(e,t,o,"#6a6aa0",[[0,170],[50,120],[96,160],[150,104],[210,158],[t,136]]),e.fillStyle="#ffffff";for(let[a,s]of[[50,120],[150,104]])e.beginPath(),e.moveTo(a-16,s+18),e.lineTo(a,s),e.lineTo(a+18,s+20),e.fill();Eo(e,t,o,"#eef0ff",[[0,210],[130,202],[t,212]]);for(let[a,s,r]of[[20,214,36],[62,206,28],[200,210,40],[236,214,30],[130,216,22]])Uc(e,a,s,r,"#1d3330","#e8ecff")},space:(e,t,o)=>{e.fillStyle="#04030c",e.fillRect(0,0,t,o),gr(e,80,170,120,"rgba(120,60,200,.35)"),gr(e,190,60,80,"rgba(40,140,220,.25)"),xn(e,t,o,220);for(let s=0;s<8;s++){let r=ke(0,t),i=ke(0,o);gr(e,r,i,5,"rgba(255,255,255,.8)")}let a=e.createRadialGradient(150,140,6,166,156,56);a.addColorStop(0,"#ffd2a0"),a.addColorStop(.6,"#e0743c"),a.addColorStop(1,"#5a1e2a"),e.fillStyle=a,e.beginPath(),e.arc(166,156,52,0,7),e.fill(),e.strokeStyle="rgba(255,220,180,.75)",e.lineWidth=4,e.beginPath(),e.ellipse(166,156,90,18,-.3,0,7),e.stroke()},castle:(e,t,o)=>{$o(e,t,o,[[0,"#5aa8e8"],[.75,"#cde9f7"],[1,"#e8f4e0"]]),e.fillStyle="rgba(255,255,255,.9)";for(let[a,s,r]of[[40,60,16],[60,54,22],[84,62,15],[190,40,14],[206,36,18]])e.beginPath(),e.arc(a,s,r,0,7),e.fill();Eo(e,t,o,"#86b860",[[0,180],[70,164],[140,178],[t,160]]),e.fillStyle="#9a9aa6",e.fillRect(170,112,26,56),e.fillRect(200,130,30,38);for(let a=0;a<3;a++)e.fillRect(170+a*10,106,6,6);e.fillStyle="#c0392b",e.beginPath(),e.moveTo(166,112),e.lineTo(183,86),e.lineTo(200,112),e.fill(),e.fillStyle="#3a3a4a",e.fillRect(181,130,4,8),Eo(e,t,o,"#5f9a44",[[0,210],[110,196],[t,206]]),e.fillStyle="#e8c35a",e.fillRect(182,72,2,16),e.beginPath(),e.moveTo(184,72),e.lineTo(196,76),e.lineTo(184,80),e.fill()}},au=({bg:e,ink:t,dots:o,line:a="rgba(255,255,255,.55)",font:s="bold 22px sans-serif"})=>(r,i,n)=>{r.fillStyle=e,r.fillRect(0,0,i,n),r.fillStyle=t,r.font=s,r.fillText("plaza",14,32);for(let l=0;l<4;l++)r.fillStyle=o[l],r.beginPath(),r.arc(28,60+l*26,9,0,7),r.fill(),r.fillStyle=a,r.fillRect(46,54+l*26,80+l*53%110,10)},ru=({a:e,b:t,c:o=t,pattern:a="border"})=>(s,r,i)=>{if(s.fillStyle=e,s.fillRect(0,0,r,i),s.fillStyle=t,s.fillRect(14,14,r-28,10),s.fillRect(14,i-24,r-28,10),s.fillRect(14,14,10,i-28),s.fillRect(r-24,14,10,i-28),s.fillStyle=o,a==="diamond")for(let n=60;n<r-40;n+=64)for(let l=60;l<i-40;l+=64)s.beginPath(),s.moveTo(n,l-18),s.lineTo(n+18,l),s.lineTo(n,l+18),s.lineTo(n-18,l),s.closePath(),s.lineWidth=4,s.strokeStyle=o,s.stroke();else if(a==="stripes")for(let n=40;n<i-40;n+=36)s.fillRect(30,n,r-60,14);else if(a==="medallion")s.beginPath(),s.ellipse(r/2,i/2,r*.22,i*.26,0,0,7),s.fill(),s.fillStyle=e,s.beginPath(),s.ellipse(r/2,i/2,r*.12,i*.14,0,0,7),s.fill();else if(a==="glow"){s.fillStyle="rgba(255,255,255,.04)";for(let n=40;n<r;n+=40)s.fillRect(n,30,2,i-60)}};Vo=(e,t,o,a,s,r,i=5)=>{let n=new V.PointLight(t,o,i,1.5);return n.position.set(a,s,r),e.add(n),n};Zs=(e,t,o,a,s,r,i,{metal:n="#2a2a2a",flameCol:l="#ffb84a",light:h="#ff9a3c",power:f=2.4,torch:c=!1}={})=>{let p=i==="left"?a+.16:a,u=i==="left"?r:r+.16;t.add(e.rbox(i==="left"?.04:.14,.24,i==="left"?.14:.04,n,a+(i==="left"?.02:0),s-.05,r+(i==="left"?0:.02),.01,{metalness:.6,roughness:.4}));let g=e.rbox(i==="left"?.18:.03,.03,i==="left"?.03:.18,n,a+(i==="left"?.09:0),s-.12,r+(i==="left"?0:.09),.01,{metalness:.6,roughness:.4});if(t.add(g),c){let m=e.cyl(.035,.025,.36,"#5a3a22",p,s,u,null,8);m.rotation[i==="left"?"z":"x"]=i==="left"?-.3:.3,t.add(m,e.cyl(.05,.04,.08,n,p+(i==="left"?.05:0),s+.18,u+(i==="left"?0:.05),null,10)),Xr(e,t,o,p+(i==="left"?.05:0),s+.29,u+(i==="left"?0:.05),{size:.06,color:l,light:h,power:f,dist:5,ly:.1})}else t.add(e.cyl(.06,.04,.03,n,p,s-.1,u,null,12),e.cyl(.03,.03,.16,"#efe6d2",p,s,u,null,10)),Xr(e,t,o,p,s+.12,u,{size:.028,color:l,light:h,power:f,dist:4.5})},Yc=(e,t,o,a,s,r,i,n,l,h="#6b4a2a")=>{let f=kt(128,Math.round(128*i/r),l),c=e.plane(r,i,e.std("#ffffff",{map:f,transparent:!0,alphaTest:.5,side:V.DoubleSide}),o,a,s,n==="left"?Math.PI/2:0),d=e.cyl(.025,.025,r+.2,h,o,a+i/2+.02,s,null,10);n==="left"?d.rotation.x=Math.PI/2:d.rotation.z=Math.PI/2,t.add(c,d)},Kc=(e,t,o)=>(a,s,r)=>{a.fillStyle=e,a.beginPath(),a.moveTo(0,0),a.lineTo(s,0),a.lineTo(s,r),a.lineTo(s/2,r-s*.35),a.lineTo(0,r),a.closePath(),a.fill(),a.strokeStyle=t,a.lineWidth=8,a.stroke(),o(a,s,r)},Da=(e,t,o,a,s,r,i,n,l,h=3)=>t.add(e.rbox(a,s,r,e.glow(o,h),i,n,l,Math.min(a,s,r)/2)),$u={gothic(e,t,o){Zs(e,t,o,-3.35,2.5,Ce,"back",{metal:"#1a1420"}),Zs(e,t,o,_e,2.5,-2.4,"left",{metal:"#1a1420"});for(let r of[-4.95,2.3,4.95])t.add(e.rbox(.18,Be,.12,"#2a2234",r,Be/2,Ce+.06,.03));for(let r of[-3.95,-2.4,2.4])t.add(e.rbox(.12,Be,.18,"#2a2234",_e+.06,Be/2,r,.03));t.add(e.rbox(wt,.14,.12,"#2a2234",0,3.85,Ce+.06,.03),e.rbox(.12,.14,At,"#2a2234",_e+.06,3.85,0,.03)),t.add(e.ball(.09,"#e9e2cf",.25,2.27,-3.8,null,14,10),e.rbox(.1,.06,.08,"#e9e2cf",.25,2.2,-3.76,.02)),t.add(e.ball(.022,"#120a18",.22,2.28,-3.72,null,8,6),e.ball(.022,"#120a18",.28,2.28,-3.72,null,8,6));let a=kt(128,128,(r,i,n)=>{r.fillStyle="#1a0d22",r.fillRect(0,0,i,n);for(let l=0;l<8;l++)r.fillStyle=["#c0264a","#5a2a9a","#2a6ab0","#d9a62a"][l%4],r.beginPath(),r.moveTo(64,64),r.arc(64,64,58,l/8*Math.PI*2,(l+1)/8*Math.PI*2),r.fill();xt(r,64,64,18,"#d9a62a"),r.strokeStyle="#1a0d22",r.lineWidth=6;for(let l=0;l<8;l++)r.beginPath(),r.moveTo(64,64),r.lineTo(64+Math.cos(l/8*Math.PI*2)*64,64+Math.sin(l/8*Math.PI*2)*64),r.stroke()}),s=e.mesh(new V.CircleGeometry(.42,32),e.basic("#ffffff",{map:a}),3.55,3.05,Ce+.01);t.add(s,e.mesh(new V.TorusGeometry(.44,.05,8,32),e.std("#2a2234"),3.55,3.05,Ce+.03))},roman(e,t){let o="#efe9de",a=(i,n,l)=>{let h=l==="left"?_e+.12:i,f=l==="left"?n:Ce+.12;t.add(e.cyl(.14,.16,Be-.5,o,h,(Be-.5)/2+.2,f,null,16));for(let c=0;c<8;c++){let d=c/8*Math.PI*2;t.add(e.rbox(.025,Be-.6,.025,"#d8d0c0",h+Math.cos(d)*.15,(Be-.5)/2+.2,f+Math.sin(d)*.15,.01))}t.add(e.rbox(.42,.2,.42,o,h,.1,f,.03),e.rbox(.42,.16,.42,o,h,Be-.22,f,.03)),t.add(e.cyl(.2,.15,.12,o,h,Be-.36,f,null,16))};a(-3.4,0,"back"),a(2.25,0,"back"),a(0,-2.4,"left"),t.add(e.rbox(wt,.16,.22,o,0,Be-.08,Ce+.11,.03),e.rbox(.22,.16,At,o,_e+.11,Be-.08,0,.03)),t.add(e.rbox(wt,.06,.12,"#c1693c",0,Be-.2,Ce+.06,.02),e.rbox(.12,.06,At,"#c1693c",_e+.06,Be-.2,0,.02));let s=e.mesh(new V.TorusGeometry(.42,.035,8,32),e.std("#5f7a3a"),_e+.06,2.45,.5);s.rotation.y=Math.PI/2,t.add(s);for(let i=0;i<22;i++){let n=i/22*Math.PI*2;if(Math.abs(n-Math.PI*1.5)<.35)continue;let l=e.ball(.08,i%2?"#6f8f42":"#86a852",_e+.08,2.45+Math.sin(n)*.42,.5+Math.cos(n)*.42,null,8,6);l.scale.set(.4,1.4,.6),l.rotation.x=-n+(i%2?.5:-.5),t.add(l)}t.add(e.rbox(.03,.3,.06,"#c9302c",_e+.08,1.95,.42,.01),e.rbox(.03,.3,.06,"#c9302c",_e+.08,1.95,.58,.01));let r=kt(256,160,(i,n,l)=>{$o(i,n,l,[[0,"#9ad0e6"],[1,"#f2e2c4"]]),Eo(i,n,l,"#8a9a5a",[[0,110],[80,96],[170,112],[n,100]]),i.fillStyle="#c1693c",i.fillRect(110,70,40,40),i.beginPath(),i.moveTo(104,70),i.lineTo(130,52),i.lineTo(156,70),i.fill(),i.fillStyle="#efe9de";for(let h=0;h<4;h++)i.fillRect(114+h*10,76,4,34);i.fillStyle="#3d5a2a";for(let h of[40,60,210])i.beginPath(),i.ellipse(h,100,8,30,0,0,7),i.fill();i.strokeStyle="#7a2a1a",i.lineWidth=10,i.strokeRect(5,5,n-10,l-10)});t.add(e.plane(1.8,1.1,e.std("#ffffff",{map:r}),3.55,2.45,Ce+.012))},japanese(e,t){let o="#4a3020";for(let r of[-4.94,-3.25,2.25,4.94])t.add(e.rbox(.14,Be,.1,o,r,Be/2,Ce+.05,.02));for(let r of[-3.94,-2.4,2.4])t.add(e.rbox(.1,Be,.14,o,_e+.05,Be/2,r,.02));t.add(e.rbox(wt,.14,.12,o,0,3.45,Ce+.06,.02),e.rbox(.12,.14,At,o,_e+.06,3.45,0,.02));let a=e.ball(.26,e.glow("#fff0d0",.9),-3.95,3,-3.3,null,16,12);a.scale.y=1.25,t.add(a,e.cyl(.12,.12,.05,"#2a1a12",-3.95,3.34,-3.3,null,14),e.cyl(.12,.12,.05,"#2a1a12",-3.95,2.66,-3.3,null,14),e.cyl(.008,.008,.9,"#2a1a12",-3.95,3.8,-3.3,null,6)),Vo(t,"#ffd9a0",1.6,-3.95,3,-3,4);let s=e.cyl(.012,.016,.5,"#4a2a20",1.55,2.55,-3.84,null,6);s.rotation.z=-.4,t.add(s);for(let r=0;r<9;r++)t.add(e.ball(.035,r%2?"#ffb7cf":"#ffd6e3",1.55+.05+ke(0,.2),2.45+ke(0,.32),-3.84+ke(-.06,.06),null,8,6))},scandi(e,t){let o=e.geo("hex",()=>new V.CylinderGeometry(.3,.3,.2,6,1,!0)),a=e.std("#d9b98c",{side:V.DoubleSide});for(let[s,r]of[[2.2,-2.55],[2.62,-2.2]]){let i=e.mesh(o,a,_e+.11,s,r);i.rotation.z=Math.PI/2,i.rotation.x=Math.PI/6,t.add(i)}t.add(e.cyl(.07,.06,.1,"#ffffff",_e+.12,2.1,-2.55,null,14),e.ball(.09,"#6f9a6a",_e+.12,2.2,-2.55,null,10,8)),t.add(e.rbox(.12,.16,.06,"#e6b04a",_e+.1,2.56,-2.25,.02)),t.add(e.cyl(.16,.18,.04,"#2b2b2b",-4.72,.02,2.6,null,20),e.cyl(.018,.018,1.7,"#2b2b2b",-4.72,.87,2.6,null,8),e.cyl(.1,.24,.24,"#2b2b2b",-4.6,1.78,2.6,{side:V.DoubleSide},20),e.ball(.06,e.glow("#fff4dc",2),-4.6,1.7,2.6,null,10,8)),Vo(t,"#fff0d6",1.4,-4.4,1.6,2.4,5),t.add(e.rbox(2.08,.1,.5,"#c9b9a0",3.55,.66,-1.35,.04))},cyberpunk(e,t,o){Da(e,t,"#ff2fd0",wt,.04,.04,0,.08,Ce+.04),Da(e,t,"#00e5ff",.04,.04,At,_e+.04,.08,0),Da(e,t,"#00e5ff",wt,.04,.04,0,3.7,Ce+.04),Da(e,t,"#ff2fd0",.04,.04,At,_e+.04,3.7,0),Da(e,t,"#9b5cff",.05,Be,.05,_e+.05,Be/2,Ce+.05);let a=kt(512,192,(n,l,h)=>{n.clearRect(0,0,l,h),n.font="bold 128px sans-serif",n.textAlign="center",n.textBaseline="middle",n.shadowColor="#ff2fd0",n.shadowBlur=28,n.fillStyle="#ffd0f4",n.fillText("7ots",l/2,h/2+6),n.shadowBlur=10,n.fillText("7ots",l/2,h/2+6)}),s=new V.MeshBasicMaterial({map:a,transparent:!0,depthWrite:!1,toneMapped:!1});t.add(e.plane(2.2,.82,s,_e+.07,2.5,.5,Math.PI/2));let r=Vo(t,"#ff2fd0",3,-4.3,2.4,.5,5);o.push(n=>{let l=Math.sin(n*.0021)>-.96||Math.sin(n*.05)>0;s.opacity=l?1:.35,r.intensity=l?3:1}),Vo(t,"#00e5ff",2.4,3.5,2.6,-1.4,6);let i=kt(128,256,(n,l,h)=>{n.fillStyle="#0b0618",n.fillRect(0,0,l,h),n.fillStyle="#00e5ff",n.font="bold 34px sans-serif",n.textAlign="center";for(let[f,c]of["\u30CD","\u30AA","\u30F3"].entries())n.fillText(c,l/2,70+f*60);n.strokeStyle="#00e5ff",n.lineWidth=4,n.strokeRect(10,10,l-20,h-20)});t.add(e.plane(.6,1.2,e.basic("#ffffff",{map:i}),4.4,2.6,Ce+.012))},beach(e,t){let o=e.ball(.5,"#ffcf4a",_e+.12,1.1,-2.42,null,20,14);o.scale.set(.08,2.1,.5),o.rotation.z=-.12,t.add(o);let a=e.ball(.5,"#ff6f61",_e+.15,1.1,-2.42,null,20,14);a.scale.set(.08,2,.12),a.rotation.z=-.12,t.add(a);let s=e.mesh(new V.TorusGeometry(.3,.09,12,32),e.std("#ffffff"),3.55,2.5,Ce+.1);t.add(s);for(let i=0;i<4;i++){let n=e.mesh(new V.TorusGeometry(.3,.095,12,6,Math.PI/4),e.std("#ef4444"),3.55,2.5,Ce+.1);n.rotation.z=i*Math.PI/2,t.add(n)}t.add(e.ball(.07,"#ffd7c2",.3,2.22,-3.8,null,10,8),e.ball(.05,"#fff1e0",.45,2.21,-3.78,null,10,8));let r=e.mesh(new V.CylinderGeometry(.11,.11,.03,5),e.std("#ff8a5b"),.75,2.2,-3.8);t.add(r);for(let i=0;i<9;i++){let n=Je-1.4+i*.35,l=3.6-Math.sin(i/8*Math.PI)*.18;t.add(e.ball(.04,e.glow(i%2?"#ffe28a":"#ffffff",1.6),n,l,Ce+.08,null,8,6))}},cabin(e,t,o){let s=kt(256,256,Us({cols:["#8a8378","#7a7368","#9a9488","#6e675e"],grout:"#4a453f",rows:7,minW:40,maxW:80}));s.wrapS=s.wrapT=V.RepeatWrapping,s.repeat.set(.8,Be*.8);let r=e.std("#ffffff",{map:s});t.add(e.mesh(new V.BoxGeometry(1,Be,.3),r,-3.3,Be/2,Ce+.15)),t.add(e.rbox(1.16,.1,.42,"#5a3a22",-3.3,1.2,Ce+.2,.02)),t.add(e.mesh(new V.BoxGeometry(.62,.55,.05),e.std("#120a06"),-3.3,.45,Ce+.29)),t.add(e.rbox(1.12,.08,.5,"#6e675e",-3.3,.04,Ce+.3,.02));for(let l of[.22,.3]){let h=e.cyl(.05,.05,.5,"#5a3a22",-3.3,.24,Ce+l,null,10);h.rotation.z=Math.PI/2,h.rotation.y=l>.25?.3:-.3,t.add(h)}let i=[];for(let[l,h,f]of[[-.12,.3,"#ff7a1a"],[.1,.26,"#ff9a2a"],[0,.38,"#ffcf4a"]]){let c=e.mesh(e.geo(`cone${h}`,()=>new V.ConeGeometry(.08,h,10)),e.basic(f),-3.3+l,.3+h/2,Ce+.24);t.add(c),i.push([c,h])}let n=Vo(t,"#ff8a3a",3.2,-3.3,.6,Ce+.7,6);o.push(l=>{let h=1+Math.sin(l*.017)*.12+Math.sin(l*.041)*.08;n.intensity=3.2*h,i.forEach(([f],c)=>f.scale.set(1,h+Math.sin(l*.02+c)*.1,1))}),t.add(e.rbox(.03,.4,.5,"#5a3a22",_e+.03,2.5,-2.4,.01));for(let l of[-1,1])for(let h=0;h<3;h++){let f=e.cyl(.018,.025,.32-h*.06,"#e9dcc0",_e+.15+h*.03,2.62+h*.12,-2.4+l*(.1+h*.09),null,6);f.rotation.x=l*(.6+h*.25),t.add(f)}},space(e,t,o){Da(e,t,"#5ce1ff",wt,.03,.03,0,3.6,Ce+.04,2.5),Da(e,t,"#5ce1ff",.03,.03,At,_e+.04,3.6,0,2.5),t.add(e.rbox(.08,.7,1,"#3b4552",_e+.04,1.9,-2.4,.03,{metalness:.6,roughness:.35}));let a=[];for(let r=0;r<4;r++)for(let i=0;i<3;i++){let n=e.ball(.03,e.basic(["#5ce1ff","#ff6b6b","#7dff8a"][(r+i)%3],{transparent:!0}),_e+.09,1.72+i*.16,-2.75+r*.22,null,8,6);n.material=n.material.clone(),t.add(n),a.push(n)}o.push(r=>{a.forEach((i,n)=>{i.material.opacity=Math.sin(r*.004+n*1.7)>0?1:.25})});for(let r of[-3.2,-3.5]){let i=e.cyl(.05,.05,wt,"#8a95a3",0,3.95,r,{metalness:.7,roughness:.3},12);i.rotation.z=Math.PI/2,t.add(i)}let s=kt(256,160,(r,i,n)=>{r.fillStyle="#06101e",r.fillRect(0,0,i,n),r.strokeStyle="rgba(92,225,255,.25)";for(let l=0;l<i;l+=32)r.beginPath(),r.moveTo(l,0),r.lineTo(l,n),r.stroke();for(let l=0;l<n;l+=32)r.beginPath(),r.moveTo(0,l),r.lineTo(i,l),r.stroke();r.strokeStyle="#5ce1ff",r.lineWidth=2,r.beginPath(),r.ellipse(128,80,90,40,0,0,7),r.stroke(),r.beginPath(),r.ellipse(128,80,50,22,0,0,7),r.stroke(),xt(r,128,80,10,"#ffd36b"),xt(r,218,80,5,"#ff8a5b"),xt(r,160,59,4,"#7dff8a")});t.add(e.rbox(1.9,1.1,.06,"#3b4552",3.55,2.5,Ce+.03,.03,{metalness:.6,roughness:.35}),e.plane(1.76,.96,e.basic("#ffffff",{map:s}),3.55,2.5,Ce+.065))},castle(e,t,o){Zs(e,t,o,-3.35,2.2,Ce,"back",{torch:!0,metal:"#2a2420"}),Zs(e,t,o,_e,2.2,-2.4,"left",{torch:!0,metal:"#2a2420"});let a=(r,i,n)=>{r.fillStyle="#e8c35a",r.beginPath(),r.moveTo(i/2,n*.22),r.lineTo(i*.78,n*.32),r.lineTo(i*.72,n*.55),r.lineTo(i/2,n*.66),r.lineTo(i*.28,n*.55),r.lineTo(i*.22,n*.32),r.fill(),r.fillStyle="#7a1a1a",r.fillRect(i/2-4,n*.3,8,n*.3),r.fillRect(i*.32,n*.4,i*.36,8)};Yc(e,t,2.95,2.55,Ce+.02,.7,1.5,"back",Kc("#8e1b1b","#e8c35a",a)),Yc(e,t,4.15,2.55,Ce+.02,.7,1.5,"back",Kc("#1f3c8a","#e8c35a",a));let s=e.cyl(.42,.42,.06,"#1f3c8a",_e+.06,2.45,.5,{metalness:.2,roughness:.6},32);s.rotation.z=Math.PI/2,s.scale.set(1,1,1),t.add(s,e.mesh(new V.TorusGeometry(.42,.04,8,32),e.std("#c9a64a",{metalness:.8,roughness:.3}),_e+.1,2.45,.5)),t.children[t.children.length-1].rotation.y=Math.PI/2,t.add(e.rbox(.03,.5,.08,"#e8c35a",_e+.1,2.45,.5,.01),e.rbox(.03,.08,.5,"#e8c35a",_e+.1,2.5,.5,.01));for(let r of[-1,1]){let i=e.rbox(.03,1.3,.06,"#c8ccd2",_e+.04,2.45,.5,.01,{metalness:.9,roughness:.2});i.rotation.x=r*.7,t.add(i);let n=e.rbox(.04,.05,.3,"#7a5a2a",_e+.05,2.45-Math.cos(.7)*.5,.5-r*Math.sin(.7)*.5,.01);n.rotation.x=r*.7,t.add(n)}t.add(e.rbox(wt,.2,.16,"#4a3020",0,3.9,Ce+.08,.02),e.rbox(.16,.2,At,"#4a3020",_e+.08,3.9,0,.02))}},gu={bg:"#2a1f55",light:{hemi:["#e8ecff","#40304e",.56],amb:["#ffe9d6",.25],key:1,env:.45,exposure:1.05},floor:{paint:Kr({base:"#b97f52",a:"#c38a5c",b:"#b07649",seam:"rgba(60,30,10,.35)",grain:"80,40,15"}),repeat:[2.5,2],rough:.7,metal:0},wall:{back:"#b6a3ea",left:"#a895e0",paint:null,tile:2.5},wains:{back:"#8a76cf",left:"#7f6bc6",rail:"#f4efff",h:1.1,paint:null,railGlow:0},win:{shape:"rect",bars:"cross",frame:"#fbf8ff",sky:_o.cozy,curtain:"#ff9fb8",curtainH:0,curtainY:0,rod:null,shaft:"#ffe2a8",shaftOp:.22,patch:"#ffd49a",patchOp:.55,dust:"#fff3d0",sun:["#ffd9a0",1.3]},sofa:{kind:"sofa",a:"#3aa6a0",b:"#5cc4bd",pillow:"#ffd23f"},art:{frame:"#fbf8ff",items:[[-.2,"#ff8fb1",.9,.7],[1,"#7ee0c3",.7,.9]]},table:{kind:"table",top:"#e8d5b5",leg:"#c9b38f",candle:"#fff6e6",flame:"#ffcf6b",light:"#ffb35c",power:2.2,orb:null},rug:{shape:"circle",a:"#d9739b",b:"#ffd0e0"},bed:{frame:"#8a5a3b",head:"#7a4d31",sheet:"#fbf8ff",blanket:"#8b7bff",pillow:"#ffffff"},desk:{top:"#e9d8bd",leg:"#cfbd9f",dark:"#2b2440",screenKind:"monitor",screen:{bg:"#1c1550",ink:"#ffd23f",dots:["#8b7bff","#7ee0c3","#ff8fb1","#8fd3ff"]},lamp:"lamp",lampColor:"#ffd23f",lampLight:"#ffd08a"},shelf:{board:"#e9d8bd",books:[[.36,"#ef4444"],[.42,"#3b82f6"],[.32,"#ffd23f"],[.4,"#7ee0c3"],[.3,"#a855f7"],[.38,"#f97316"]],vase:"#fbf8ff"},plant:{kind:"leafy",pot:"#d9774b",leaves:["#58b86c","#3f9d55"]}},Ys={cozy:{emoji:"\u{1F3E0}"},gothic:{emoji:"\u{1F987}",bg:"#120a1c",light:{hemi:["#b8a8ff","#2a1020",.36],amb:["#c9a0ff",.14],key:.55,env:.3,exposure:1.1},floor:{paint:Kr({base:"#2e1f1c",a:"#3a2722",b:"#2a1b18",seam:"rgba(0,0,0,.5)",grain:"0,0,0",n:8}),rough:.55},wall:{back:"#8f8aa0",left:"#7c7790",paint:Us({cols:["#5c566a","#534d60","#665f74","#4c4658"],grout:"#2c2836",rows:6}),tile:2.2},wains:{back:"#3a1a2a",left:"#321624",rail:"#2a2234",h:.9},win:{shape:"pointed",frame:"#2a2234",sky:_o.gothic,curtain:"#8e1030",curtainH:2.9,curtainY:2.05,rod:"#c9a64a",shaft:"#b9b8ff",shaftOp:.18,patch:"#a7a6ff",patchOp:.4,dust:"#d8d0ff",sun:["#9aa0ff",1]},sofa:{kind:"sofa",a:"#4a1a5c",b:"#5e2470",pillow:"#a3122e",backH:1.45,tufts:"#c9a64a",legs:"#c9a64a",r:.08},art:{frame:"#c9a64a",frameMetal:!0,items:[[-.2,"#000",.7,.9,(e,t,o)=>{$o(e,t,o,[[0,"#2a1830"],[1,"#100812"]]),xt(e,t/2,o*.38,t*.2,"#d8c6b0"),e.fillStyle="#1a0d14",e.fillRect(t*.25,o*.55,t*.5,o*.5)}],[1.15,"#000",.7,.9,(e,t,o)=>{$o(e,t,o,[[0,"#2e1a1a"],[1,"#0c0608"]]),xt(e,t/2,o*.4,t*.18,"#cdb8a8"),e.fillStyle="#5a0f1f",e.fillRect(t*.22,o*.56,t*.56,o*.5)}]]},table:{top:"#2a1b18",leg:"#c9a64a",candle:"#efe6d2",flame:"#ffb84a",light:"#ff9a3c",power:2.6},rug:{shape:"rect",a:"#5a0f1f",b:"#c9a64a",c:"#3a0814",pattern:"medallion"},bed:{frame:"#2a1b18",head:"#1f1412",sheet:"#d8cfe0",blanket:"#5a0f1f",pillow:"#e8e0ec",headH:1.6,posts:"#1f1412",postH:2.75,drape:"#4a1a5c",finial:"#c9a64a"},desk:{top:"#2e1f1c",leg:"#1f1412",legW:.1,dark:"#c9a64a",screenKind:"mirror",screen:{bg:"#170b22",ink:"#c9a64a",dots:["#a3122e","#7a4cff","#c9a64a","#d8d0ff"],font:"italic bold 24px serif"},lamp:"candles",lampColor:"#c9a64a",lampLight:"#ffad5c"},shelf:{board:"#2e1f1c",books:[[.36,"#3a0814"],[.42,"#1f1430"],[.34,"#2a2a1a"],[.4,"#5a0f1f"],[.3,"#1a2a2a"],[.38,"#3a1a4a"]],vase:null},plant:{kind:"leafy",pot:"#1f1a24",potMetal:!0,leaves:["#1f3a2a","#2a4a30"],flowers:"#b0102e",n:9}},roman:{emoji:"\u{1F3DB}\uFE0F",bg:"#2a2030",light:{hemi:["#fff6e6","#6a5040",.62],amb:["#fff0dc",.3],key:1.05,env:.5,exposure:1.05},floor:{paint:Ff({a:"#efe6d6",b:"#c1693c",n:8,vein:"#9a8a78",grout:"rgba(80,50,30,.35)"}),repeat:[2.5,2],rough:.45},wall:{back:"#ffffff",left:"#ece6dc",paint:Zf("#f3ece0","#b8a890"),tile:3},wains:{back:"#ffffff",left:"#eeeeee",rail:"#efe9de",h:1,paint:ou("#a8452a","#efe2c4")},win:{shape:"arch",bars:"none",frame:"#efe9de",sky:_o.roman,curtain:null,shaft:"#fff0c8",shaftOp:.24,patch:"#ffe6b0",patchOp:.55,dust:"#fff6dc",sun:["#fff0c8",1.4]},sofa:{kind:"bench",frame:"#e8e1d4",a:"#a8452a",b:"#c1693c",pillow:null,bolster:"#d4a64a",trim:"#c9a64a"},art:{items:[]},table:{top:"#e8e1d4",leg:"#c9a64a",candle:"#f3ead6",flame:"#ffcf6b",light:"#ffb35c",power:2.2},rug:{shape:"rect",a:"#efe2c4",b:"#a8452a",c:"#c1693c",pattern:"medallion"},bed:{frame:"#e8e1d4",head:"#d8d0c0",sheet:"#fbf8f0",blanket:"#a8452a",pillow:"#d4a64a",stripe:"#d4a64a",r:.05},desk:{top:"#ece6dc",leg:"#c9a64a",dark:"#c9a64a",screenKind:"mirror",screen:{bg:"#3a2418",ink:"#e8c35a",dots:["#c1693c","#86a852","#efe2c4","#e8c35a"],font:"bold 22px serif"},lamp:"oil",lampColor:"#b8862a",lampLight:"#ffcf8a"},shelf:{board:"#ece6dc",books:[[.3,"#e9dcb8"],[.3,"#d9c9a0"],[.3,"#e9dcb8"],[.3,"#d9c9a0"]],vase:"#c1693c"},plant:{kind:"topiary",potKind:"amphora",pot:"#b8582e",leaves:["#4e6e2e","#6f8f42"],berries:"#2a2a40"}},japanese:{emoji:"\u{1F3EF}",bg:"#1e1a24",light:{hemi:["#fff4e6","#5a4a3a",.58],amb:["#ffeedd",.28],key:1,env:.45,exposure:1.05},floor:{paint:Wf,repeat:[3,2.4],rough:.9},wall:{back:"#ffffff",left:"#ece4d4",paint:tu("#efe4cc"),tile:2.5},wains:{back:"#5a3b26",left:"#4e3320",rail:"#4a3020",h:.3},win:{shape:"rect",bars:"grid",frame:"#4a3020",sky:_o.japanese,curtain:null,shaft:"#ffd9c8",shaftOp:.22,patch:"#ffd0b8",patchOp:.5,dust:"#fff0e8",sun:["#ffd6c0",1.3]},sofa:{kind:"bench",frame:"#5a3b26",a:"#2c3e6b",b:"#34497a",pillow:"#c0392b",back:1.2},art:{frame:"#3a2418",items:[[.5,"#000",.6,1.5,(e,t,o)=>{e.fillStyle="#f4ecd8",e.fillRect(0,0,t,o),e.fillStyle="#7a8a6a",e.fillRect(0,0,t,14),e.fillRect(0,o-14,t,14),e.fillStyle="rgba(30,30,40,.75)",e.beginPath(),e.moveTo(10,o*.7),e.lineTo(46,o*.45),e.lineTo(70,o*.58),e.lineTo(100,o*.36),e.lineTo(t-6,o*.7),e.fill(),xt(e,t*.7,o*.24,12,"#c0392b"),e.fillStyle="#222",e.font="bold 30px serif",e.textAlign="center",e.fillText("\u548C",t/2,o*.86)},2.2]]},table:{top:"#4a3020",leg:"#3a2418",candle:"#f4ecd8",flame:"#ffcf6b",light:"#ffb35c",power:2},rug:{shape:"rect",a:"#2c3e6b",b:"#e9e0c8",c:"#3a5080",pattern:"border"},bed:{frame:"#5a3b26",head:"#4a3020",sheet:"#f6f1e6",blanket:"#2c3e6b",pillow:"#e9e0c8",headH:.8,stripe:"#e9e0c8",r:.03},desk:{top:"#5a3b26",leg:"#3a2418",legW:.08,dark:"#2a1a12",screen:{bg:"#f4ecd8",ink:"#c0392b",dots:["#2c3e6b","#7a8a6a","#c0392b","#d9a62a"],line:"rgba(40,30,20,.45)"},lamp:"lantern",lampColor:"#2a1a12",lampGlow:"#fff1d0",lampLight:"#ffd9a0"},shelf:{board:"#5a3b26",books:[[.3,"#2c3e6b"],[.34,"#c0392b"],[.28,"#e9e0c8"]],vase:"#2a2a30"},plant:{kind:"bonsai",potKind:"stand",stand:"#4a3020",pot:"#2a3a4a",leaves:["#3e6a3a","#4f7d45"],trunk:"#5a3b26"}},scandi:{emoji:"\u{1F33F}",bg:"#2a2e36",light:{hemi:["#f4f7ff","#6a6a70",.66],amb:["#ffffff",.32],key:1.05,env:.55,exposure:1.05},floor:{paint:Kr({base:"#d9bf98",a:"#e2caa6",b:"#d4b88f",seam:"rgba(120,90,60,.25)",grain:"140,100,60",n:8}),rough:.65},wall:{back:"#f1efe9",left:"#e6e3dc"},wains:null,win:{shape:"rect",bars:"cross",frame:"#2b2b2b",sky:_o.scandi,curtain:"#e8e2d6",shaft:"#f0f6ff",shaftOp:.2,patch:"#eef4ff",patchOp:.45,dust:"#ffffff",sun:["#eef4ff",1.2]},sofa:{kind:"sofa",a:"#9aa3a8",b:"#aeb6ba",pillow:"#e6b04a",legs:"#c9a273",r:.08},art:{frame:"#2b2b2b",items:[[-.25,"#000",.7,.95,(e,t,o)=>{e.fillStyle="#f4efe6",e.fillRect(0,0,t,o),xt(e,t/2,o*.42,t*.26,"#e6b04a"),e.fillStyle="#6f8f86",e.fillRect(0,o*.62,t,o*.38)}],[.95,"#000",.7,.95,(e,t,o)=>{e.fillStyle="#ece6dc",e.fillRect(0,0,t,o),e.strokeStyle="#2b2b2b",e.lineWidth=3,e.beginPath(),e.arc(t/2,o*.75,t*.32,Math.PI,0),e.stroke(),e.beginPath(),e.moveTo(t*.2,o*.3),e.bezierCurveTo(t*.4,o*.1,t*.6,o*.5,t*.8,o*.3),e.stroke(),e.fillStyle="#c96f4a",e.beginPath(),e.arc(t*.68,o*.55,10,0,7),e.fill()}]]},table:{top:"#d9b98c",leg:"#2b2b2b",candle:"#ffffff",flame:"#ffcf6b",light:"#ffc27a",power:2},rug:{shape:"rect",a:"#f0ebe0",b:"#2b2b2b",c:"#2b2b2b",pattern:"diamond"},bed:{frame:"#d9b98c",head:"#cfae80",sheet:"#ffffff",blanket:"#9cb3a0",pillow:"#f2f2f2",headH:1},desk:{top:"#f4f4f2",leg:"#d9b98c",dark:"#2b2b2b",screen:{bg:"#2f3640",ink:"#e6b04a",dots:["#9cb3a0","#e6b04a","#c96f4a","#aeb6ba"]},lamp:"lamp",lampColor:"#2b2b2b",lampLight:"#fff0d6"},shelf:{board:"#d9b98c",books:[[.36,"#e8e2d6"],[.42,"#9cb3a0"],[.32,"#2b2b2b"],[.4,"#c96f4a"],[.3,"#aeb6ba"]],vase:"#ffffff"},plant:{kind:"leafy",pot:"#f4f4f2",leaves:["#2e5a3a","#3e7048"],leafScale:[.9,1.6,.18],n:8}},cyberpunk:{emoji:"\u{1F303}",bg:"#07040f",light:{hemi:["#8a7bff","#200a30",.3],amb:["#9a7bff",.12],key:.45,env:.25,exposure:1.1},floor:{paint:Yf,repeat:[2.5,2],rough:.35,metal:.3},wall:{back:"#ffffff",left:"#d8d8e8",paint:eu("#2a2438"),tile:2.5},wains:{back:"#16121f",left:"#13101c",rail:"#00e5ff",h:.5,railGlow:2.5},win:{shape:"rect",bars:"grid",frame:"#1a1626",sky:_o.cyberpunk,curtain:null,shaft:"#ff6fd8",shaftOp:.16,patch:"#ff4fd8",patchOp:.35,dust:"#9ff6ff",sun:["#d06cff",.9]},sofa:{kind:"sofa",a:"#1e1a2e",b:"#2a2440",pillow:"#00e5ff",r:.16,glow:"#ff2fd0"},art:{items:[]},table:{top:"#1a1626",leg:"#3a3550",orb:"#00e5ff",light:"#00e5ff",power:2},rug:{shape:"circle",a:"#140d2a",b:"#ff2fd0",glow:!0},bed:{frame:"#1a1626",head:"#221d33",sheet:"#2a2440",blanket:"#3a1f6e",pillow:"#5a4a8a",r:.14,glow:"#00e5ff",headH:1},desk:{top:"#1a1626",leg:"#3a3550",dark:"#2a2438",screenKind:"holo",screen:{bg:"#001a24",ink:"#00e5ff",dots:["#ff2fd0","#00e5ff","#ffe36b","#9b5cff"],line:"rgba(0,229,255,.6)"},lamp:"neon",lampColor:"#ff2fd0",lampLight:"#ff4fd8"},shelf:{board:"#2a2438",books:[[.36,"#ff2fd0"],[.42,"#1e1a2e"],[.32,"#00e5ff"],[.4,"#2a2440"],[.3,"#9b5cff"]],vase:null},plant:{kind:"leafy",pot:"#1e1a2e",potMetal:!0,leaves:["#00ffa3","#00c2ff"],glow:.9}},beach:{emoji:"\u{1F3D6}\uFE0F",bg:"#123a4a",light:{hemi:["#f0fbff","#8a7a5a",.66],amb:["#fff8e8",.32],key:1.05,env:.55,exposure:1.05},floor:{paint:Kr({base:"#d8c3a0",a:"#e3d0ae",b:"#cfb994",seam:"rgba(120,90,60,.3)",grain:"150,120,80",n:8}),rough:.8},wall:{back:"#ffffff",left:"#e8f2f2",paint:Xf("#bfe6e0","rgba(60,110,110,.25)"),tile:2},wains:{back:"#f4efe4",left:"#e8e2d6",rail:"#ffffff",h:1},win:{shape:"rect",bars:"cross",frame:"#ffffff",sky:_o.beach,curtain:"#f6ecd8",shaft:"#fff2c0",shaftOp:.26,patch:"#ffe8a8",patchOp:.55,dust:"#fffbe6",sun:["#fff0c0",1.45]},sofa:{kind:"bench",frame:"#c8a26a",a:"#f4efe4",b:"#5fc4c0",pillow:"#ff6f61",back:1.1},art:{frame:"#ffffff",items:[[.5,"#000",1.3,.8,(e,t,o)=>{$o(e,t,o,[[0,"#8fd3ff"],[.55,"#d8f2ff"],[.56,"#2ab0c6"],[1,"#5fe0d6"]]),xt(e,t*.75,o*.3,10,"#fff2b0"),e.fillStyle="#ffffff",e.beginPath(),e.moveTo(t*.3,o*.55),e.lineTo(t*.36,o*.2),e.lineTo(t*.42,o*.55),e.fill(),e.fillStyle="#7a4a2a",e.fillRect(t*.25,o*.55,t*.22,5)}]]},table:{kind:"table",top:"#c8a26a",leg:"#a8824a",candle:"#ffffff",flame:"#ffcf6b",light:"#ffb35c",power:2},rug:{shape:"rect",a:"#f6ecd8",b:"#2a9db0",c:"#5fc4c0",pattern:"stripes"},bed:{frame:"#e8e2d6",head:"#f4efe4",sheet:"#ffffff",blanket:"#5fc4c0",pillow:"#ffe0d0",stripe:"#ff6f61"},desk:{top:"#e3d0ae",leg:"#c8a26a",dark:"#2a3a44",screen:{bg:"#0f4a5a",ink:"#ffe28a",dots:["#ff6f61","#5fc4c0","#ffe28a","#ffffff"]},lamp:"lamp",lampColor:"#ff6f61",lampLight:"#ffe0b0"},shelf:{board:"#c8a26a",books:[[.36,"#2a9db0"],[.32,"#f6ecd8"],[.4,"#ff6f61"]],vase:"#5fc4c0"},plant:{kind:"palm",pot:"#c8a26a",leaves:["#2f8a4a","#45a85a"],trunk:"#9a7a4a"}},cabin:{emoji:"\u{1FAB5}",bg:"#1a1210",light:{hemi:["#ffe8d0","#40281a",.46],amb:["#ffd8b0",.2],key:.8,env:.38,exposure:1.08},floor:{paint:Kr({base:"#5a3a24",a:"#6a442a",b:"#4e321f",seam:"rgba(20,10,0,.55)",grain:"20,10,0",n:6}),rough:.7},wall:{back:"#ffffff",left:"#e6dcd0",paint:Kf({cols:["#9a6a3e","#8a5c34","#a67444"]}),tile:2.1},wains:null,win:{shape:"rect",bars:"cross",frame:"#5a3a22",sky:_o.cabin,curtain:"#a8302a",rod:"#3a2418",shaft:"#ffc8a0",shaftOp:.16,patch:"#ffb890",patchOp:.4,dust:"#ffe6d0",sun:["#ffb890",.9]},sofa:{kind:"sofa",a:"#7a4a2a",b:"#8a5634",pillow:"#a8302a",r:.1,legs:"#3a2418"},art:{frame:"#5a3a22",items:[[.5,"#000",1.2,.8,_o.cabin]]},table:{kind:"stump",top:"#7a5434",leg:"#c9a273",candle:"#f4ead6",flame:"#ffcf6b",light:"#ffb35c",power:2.2},rug:{shape:"oval",a:"#e8dcc4",b:"#a8302a"},bed:{frame:"#6a442a",head:"#5a3a22",sheet:"#f4ead6",blanket:"#a8302a",pillow:"#f4ead6",stripe:"#2a2a2a",posts:"#6a442a",postH:1.5,finial:"#6a442a"},desk:{top:"#6a442a",leg:"#4e321f",legW:.1,dark:"#2a1a12",screen:{bg:"#20140e",ink:"#ffcf6b",dots:["#a8302a","#6f9a5a","#e8dcc4","#ffcf6b"]},lamp:"lantern",lampColor:"#2a2a2a",lampGlow:"#ffd8a0",lampLight:"#ffb870"},shelf:{board:"#6a442a",books:[[.36,"#7a2a20"],[.42,"#2f4a3a"],[.32,"#c9a273"],[.4,"#5a3a22"],[.3,"#a8302a"]],vase:"#e8dcc4"},plant:{kind:"leafy",potKind:"barrel",pot:"#7a5434",leaves:["#2f5a34","#3e6e40","#285030"],leafScale:[.35,1.9,.2],n:13}},space:{emoji:"\u{1F680}",bg:"#05060f",light:{hemi:["#dfeaff","#1a2030",.45],amb:["#cfe4ff",.18],key:.8,env:.5,exposure:1.05},floor:{paint:Uf({base:"#4a525c",light:"#6b747f",seam:"#2a3038",rivet:"#8a949f"}),repeat:[2.5,2],rough:.4,metal:.55},wall:{back:"#ffffff",left:"#e2e8ef",paint:Jf({base:"#c9d2dc",line:"#8a95a3",dark:"#3b4552"}),tile:2.5},wains:{back:"#3b4552",left:"#343d49",rail:"#5ce1ff",h:.6,railGlow:2},win:{shape:"round",frame:"#9aa5b2",plate:"#5a6470",sky:_o.space,curtain:null,shaft:"#9fd8ff",shaftOp:.1,patch:"#9fd8ff",patchOp:.25,dust:"#cfeaff",sun:["#bfe0ff",.8]},sofa:{kind:"sofa",a:"#e8edf2",b:"#3b4b63",pillow:"#ff8a3c",r:.18,glow:"#5ce1ff"},art:{items:[]},table:{top:"#d0d8e2",leg:"#7a8592",orb:"#5ce1ff",light:"#5ce1ff",power:2},rug:{shape:"circle",a:"#2a3240",b:"#5ce1ff",glow:!0},bed:{frame:"#e8edf2",head:"#d0d8e2",sheet:"#f4f8fc",blanket:"#3b4b63",pillow:"#ffffff",r:.16,glow:"#5ce1ff",stripe:"#ff8a3c"},desk:{top:"#e8edf2",leg:"#7a8592",dark:"#3b4552",screenKind:"holo",screen:{bg:"#02121e",ink:"#5ce1ff",dots:["#ff8a3c","#7dff8a","#5ce1ff","#ffd36b"],line:"rgba(92,225,255,.6)"},lamp:"neon",lampColor:"#5ce1ff",lampLight:"#9fe8ff"},shelf:{board:"#9aa5b2",books:[[.3,"#3b4b63"],[.3,"#e8edf2"],[.3,"#ff8a3c"],[.3,"#3b4b63"]],vase:null},plant:{kind:"crystal",pot:"#7a8592",potMetal:!0,leaves:["#c77dff","#5ce1ff"]}},castle:{emoji:"\u{1F3F0}",bg:"#141218",light:{hemi:["#f0e8ff","#3a2a20",.46],amb:["#ffe2c0",.2],key:.85,env:.38,exposure:1.08},floor:{paint:Us({cols:["#77726a","#6a655e","#827c73","#5f5a54"],grout:"#3a3632",rows:4,minW:90,maxW:170}),repeat:[2.5,2],rough:.85},wall:{back:"#ffffff",left:"#e0dcd6",paint:Us({cols:["#9a958c","#8d8880","#a6a198","#857f77"],grout:"#5a5650",rows:7}),tile:2.2},wains:null,win:{shape:"arch",bars:"cross",frame:"#6a655e",sky:_o.castle,curtain:null,shaft:"#fff0d0",shaftOp:.22,patch:"#ffe6b8",patchOp:.5,dust:"#fff3d8",sun:["#ffe8c0",1.25]},sofa:{kind:"bench",frame:"#5a3a22",a:"#8e1b1b",b:"#a32424",pillow:"#e8c35a",back:1.6},art:{items:[]},table:{top:"#5a3a22",leg:"#3a2418",candle:"#efe6d2",flame:"#ffb84a",light:"#ff9a3c",power:2.4},rug:{shape:"rect",a:"#8e1b1b",b:"#e8c35a",c:"#6a1010",pattern:"border"},bed:{frame:"#5a3a22",head:"#4a3020",sheet:"#efe6d2",blanket:"#1f3c8a",pillow:"#efe6d2",stripe:"#e8c35a",posts:"#4a3020",postH:2.7,drape:"#1f3c8a",finial:"#e8c35a",headH:1.5},desk:{top:"#5a3a22",leg:"#3a2418",legW:.12,dark:"#8a6a2a",screenKind:"mirror",screen:{bg:"#2a1c10",ink:"#e8c35a",dots:["#8e1b1b","#1f3c8a","#e8c35a","#86b860"],font:"bold 22px serif"},lamp:"candles",lampColor:"#8a6a2a",lampLight:"#ffad5c"},shelf:{board:"#5a3a22",books:[[.36,"#5a1a10"],[.42,"#1f2c5a"],[.34,"#4a3a20"],[.4,"#2a4a2a"]],vase:"#c9a64a"},plant:{kind:"topiary",potKind:"barrel",pot:"#6a442a",leaves:["#3e5a2e","#4f6e38"],berries:"#c0392b"}}},kn=Object.entries(Ys).map(([e,t])=>({id:e,emoji:t.emoji})),Ks="cozy",yu=e=>{let t=Ys[e]||Ys.cozy,o={};for(let[a,s]of Object.entries(gu))t[a]===null?o[a]=null:s&&typeof s=="object"&&!Array.isArray(s)?o[a]={...s,...t[a]}:o[a]=t[a]??s;return o}});var bu,wu,xu,ku,vu,vn=Ye(()=>{Qe();bu={creator:{stepOf:"Paso {n} de {total}",steps:{body:"Cuerpo",face:"Cara",paint:"Pintar",acc:"Accesorios"},tabs:{shape:"Forma",style:"Estilo",color:"Color",finish:"Acabado",preset:"Plantillas",eyes:"Ojos",brows:"Cejas",mouth:"Boca",cheeks:"Mejillas",pattern:"Patr\xF3n",texture:"Textura"},bodyColor:"Color del cuerpo",eyeColor:"Color de los ojos",adjust:"Ajustes",size:"Tama\xF1o",spacing:"Separaci\xF3n",height:"Altura",color:"Color",patternColor:"Color del patr\xF3n",otherColor:"Otro color",back:"\u2190 Atr\xE1s",next:"Siguiente \u2192",play:"Jugar",playNext:"\u25B6 Jugar",random:"Sorpr\xE9ndeme",undo:"Deshacer",clearAll:"Quitar todos ({n})",modBody:"Lleva el cuerpo 3D \xAB{name}\xBB (un mod), que tapa el ot. Al editar cualquier cosa aqu\xED se lo quitas (puedes deshacer).",modRemove:"Quitar el cuerpo 3D",drag:"Arrastra para girarlo",empty:"Nada por aqu\xED."},room:{auto:"Solo",control:"Controlar",edit:"Editar",message:"Mensaje",messageHint:"Simula un mensaje entrante",keys:"WASD o flechas \xB7 clic en el suelo para ir \xB7 Espacio saltar \xB7 E usar",use:"E \xB7 {label}",getOff:"E \xB7 Bajarse",inRoom:"est\xE1 en su pieza",walk:"camina",run:"va corriendo",you:"lo controlas t\xFA",themes:{cozy:"Acogedora",gothic:"G\xF3tica",roman:"Romana",japanese:"Japonesa",scandi:"N\xF3rdica",cyberpunk:"Cyberpunk",beach:"Playa",cabin:"Caba\xF1a",space:"Nave espacial",castle:"Castillo"},theme:"Tipo de casa",places:{window:"Mirar por la ventana",sofa:"Sentarse en el sof\xE1",rug:"Bailar en la alfombra",bed:"Dormir una siesta",desk:"Revisar la plaza",plant:"Regar la planta",front:"Saludar"},doing:{window:"mira por la ventana",sofa:"descansa en el sof\xE1",rug:"baila en la alfombra",bed:"duerme una siesta",desk:"revisa la plaza",plant:"riega la planta",front:"te saluda"},say:{hello:"\xA1Hola! Soy {name}",window:"Qu\xE9 lindo est\xE1 afuera\u2026",sofa:"Ahh\u2026 qu\xE9 rico",desk:"A ver qu\xE9 hay en la plaza\u2026",plant:"Hay que regarla \u{1F331}",gotMsg:"\u{1F4E9} \xA1Me lleg\xF3 un mensaje!",replied:"Respondido \u2713",takeMe:"\xA1Ll\xE9vame! \u{1F3AE}"},pad:{up:"Arriba",down:"Abajo",left:"Izquierda",right:"Derecha",use:"Usar"}}},wu={creator:{stepOf:"Step {n} of {total}",steps:{body:"Body",face:"Face",paint:"Paint",acc:"Accessories"},tabs:{shape:"Shape",style:"Style",color:"Color",finish:"Finish",preset:"Presets",eyes:"Eyes",brows:"Brows",mouth:"Mouth",cheeks:"Cheeks",pattern:"Pattern",texture:"Texture"},bodyColor:"Body color",eyeColor:"Eye color",adjust:"Adjust",size:"Size",spacing:"Spacing",height:"Height",color:"Color",patternColor:"Pattern color",otherColor:"Other color",back:"\u2190 Back",next:"Next \u2192",play:"Play",playNext:"\u25B6 Play",random:"Surprise me",undo:"Undo",clearAll:"Remove all ({n})",modBody:"It wears the 3D body \u201C{name}\u201D (a mod), which covers the ot. Editing anything here takes it off (you can undo).",modRemove:"Remove the 3D body",drag:"Drag to turn it",empty:"Nothing here."},room:{auto:"On its own",control:"Control",edit:"Edit",message:"Message",messageHint:"Simulate an incoming message",keys:"WASD or arrows \xB7 click the floor to go \xB7 Space jump \xB7 E use",use:"E \xB7 {label}",getOff:"E \xB7 Get down",inRoom:"is in its room",walk:"walks",run:"is running",you:"you're in control",themes:{cozy:"Cozy",gothic:"Gothic",roman:"Roman",japanese:"Japanese",scandi:"Scandi",cyberpunk:"Cyberpunk",beach:"Beach",cabin:"Cabin",space:"Spaceship",castle:"Castle"},theme:"House style",places:{window:"Look out the window",sofa:"Sit on the sofa",rug:"Dance on the rug",bed:"Take a nap",desk:"Check the plaza",plant:"Water the plant",front:"Say hi"},doing:{window:"looks out the window",sofa:"rests on the sofa",rug:"dances on the rug",bed:"takes a nap",desk:"checks the plaza",plant:"waters the plant",front:"says hi"},say:{hello:"Hi! I'm {name}",window:"It's lovely out there\u2026",sofa:"Ahh\u2026 so comfy",desk:"Let's see what's on the plaza\u2026",plant:"Needs water \u{1F331}",gotMsg:"\u{1F4E9} I got a message!",replied:"Replied \u2713",takeMe:"Take me around! \u{1F3AE}"},pad:{up:"Up",down:"Down",left:"Left",right:"Right",use:"Use"}}},xu={creator:{stepOf:"Passo {n} de {total}",steps:{body:"Corpo",face:"Rosto",paint:"Pintar",acc:"Acess\xF3rios"},tabs:{shape:"Forma",style:"Estilo",color:"Cor",finish:"Acabamento",preset:"Modelos",eyes:"Olhos",brows:"Sobrancelhas",mouth:"Boca",cheeks:"Bochechas",pattern:"Padr\xE3o",texture:"Textura"},bodyColor:"Cor do corpo",eyeColor:"Cor dos olhos",adjust:"Ajustes",size:"Tamanho",spacing:"Separa\xE7\xE3o",height:"Altura",color:"Cor",patternColor:"Cor do padr\xE3o",otherColor:"Outra cor",back:"\u2190 Voltar",next:"Pr\xF3ximo \u2192",play:"Jogar",playNext:"\u25B6 Jogar",random:"Surpreenda-me",undo:"Desfazer",clearAll:"Tirar todos ({n})",modBody:"Est\xE1 usando o corpo 3D \u201C{name}\u201D (um mod), que cobre o ot. Editar qualquer coisa aqui tira ele (d\xE1 para desfazer).",modRemove:"Tirar o corpo 3D",drag:"Arraste para gir\xE1-lo",empty:"Nada por aqui."},room:{auto:"Sozinho",control:"Controlar",edit:"Editar",message:"Mensagem",messageHint:"Simula uma mensagem recebida",keys:"WASD ou setas \xB7 clique no ch\xE3o para ir \xB7 Espa\xE7o pular \xB7 E usar",use:"E \xB7 {label}",getOff:"E \xB7 Descer",inRoom:"est\xE1 no quarto",walk:"anda",run:"vai correndo",you:"voc\xEA controla",themes:{cozy:"Aconchegante",gothic:"G\xF3tica",roman:"Romana",japanese:"Japonesa",scandi:"N\xF3rdica",cyberpunk:"Cyberpunk",beach:"Praia",cabin:"Cabana",space:"Nave espacial",castle:"Castelo"},theme:"Tipo de casa",places:{window:"Olhar pela janela",sofa:"Sentar no sof\xE1",rug:"Dan\xE7ar no tapete",bed:"Tirar um cochilo",desk:"Ver a pra\xE7a",plant:"Regar a planta",front:"Dizer oi"},doing:{window:"olha pela janela",sofa:"descansa no sof\xE1",rug:"dan\xE7a no tapete",bed:"tira um cochilo",desk:"v\xEA a pra\xE7a",plant:"rega a planta",front:"te d\xE1 oi"},say:{hello:"Oi! Eu sou {name}",window:"Que lindo l\xE1 fora\u2026",sofa:"Ahh\u2026 que gostoso",desk:"Vamos ver o que tem na pra\xE7a\u2026",plant:"Precisa de \xE1gua \u{1F331}",gotMsg:"\u{1F4E9} Chegou uma mensagem!",replied:"Respondido \u2713",takeMe:"Me leva! \u{1F3AE}"},pad:{up:"Cima",down:"Baixo",left:"Esquerda",right:"Direita",use:"Usar"}}},ku={creator:{stepOf:"\u7B2C {n} \u6B65\uFF0C\u5171 {total} \u6B65",steps:{body:"\u8EAB\u4F53",face:"\u8138",paint:"\u4E0A\u8272",acc:"\u914D\u9970"},tabs:{shape:"\u5F62\u72B6",style:"\u98CE\u683C",color:"\u989C\u8272",finish:"\u8D28\u611F",preset:"\u6A21\u677F",eyes:"\u773C\u775B",brows:"\u7709\u6BDB",mouth:"\u5634\u5DF4",cheeks:"\u8138\u988A",pattern:"\u56FE\u6848",texture:"\u7EB9\u7406"},bodyColor:"\u8EAB\u4F53\u989C\u8272",eyeColor:"\u773C\u775B\u989C\u8272",adjust:"\u8C03\u6574",size:"\u5927\u5C0F",spacing:"\u95F4\u8DDD",height:"\u9AD8\u5EA6",color:"\u989C\u8272",patternColor:"\u56FE\u6848\u989C\u8272",otherColor:"\u5176\u4ED6\u989C\u8272",back:"\u2190 \u8FD4\u56DE",next:"\u4E0B\u4E00\u6B65 \u2192",play:"\u5F00\u73A9",playNext:"\u25B6 \u5F00\u73A9",random:"\u7ED9\u6211\u60CA\u559C",undo:"\u64A4\u9500",clearAll:"\u5168\u90E8\u79FB\u9664\uFF08{n}\uFF09",modBody:"\u5B83\u7A7F\u7740 3D \u8EAB\u4F53\u201C{name}\u201D\uFF08\u4E00\u4E2A mod\uFF09\uFF0C\u4F1A\u76D6\u4F4F ot\u3002\u5728\u8FD9\u91CC\u7F16\u8F91\u4EFB\u4F55\u5185\u5BB9\u90FD\u4F1A\u628A\u5B83\u53D6\u4E0B\uFF08\u53EF\u4EE5\u64A4\u9500\uFF09\u3002",modRemove:"\u79FB\u9664 3D \u8EAB\u4F53",drag:"\u62D6\u52A8\u6765\u65CB\u8F6C",empty:"\u8FD9\u91CC\u4EC0\u4E48\u90FD\u6CA1\u6709\u3002"},room:{auto:"\u81EA\u5DF1\u73A9",control:"\u64CD\u63A7",edit:"\u7F16\u8F91",message:"\u6D88\u606F",messageHint:"\u6A21\u62DF\u4E00\u6761\u6536\u5230\u7684\u6D88\u606F",keys:"WASD \u6216\u65B9\u5411\u952E \xB7 \u70B9\u51FB\u5730\u9762\u524D\u5F80 \xB7 \u7A7A\u683C\u8DF3\u8DC3 \xB7 E \u4F7F\u7528",use:"E \xB7 {label}",getOff:"E \xB7 \u4E0B\u6765",inRoom:"\u5728\u81EA\u5DF1\u7684\u623F\u95F4\u91CC",walk:"\u5728\u8D70\u8DEF",run:"\u5728\u5954\u8DD1",you:"\u7531\u4F60\u64CD\u63A7",themes:{cozy:"\u6E29\u99A8",gothic:"\u54E5\u7279",roman:"\u7F57\u9A6C",japanese:"\u65E5\u5F0F",scandi:"\u5317\u6B27",cyberpunk:"\u8D5B\u535A\u670B\u514B",beach:"\u6D77\u6EE9",cabin:"\u5C0F\u6728\u5C4B",space:"\u5B87\u5B99\u98DE\u8239",castle:"\u57CE\u5821"},theme:"\u623F\u5C4B\u98CE\u683C",places:{window:"\u770B\u770B\u7A97\u5916",sofa:"\u5750\u5728\u6C99\u53D1\u4E0A",rug:"\u5728\u5730\u6BEF\u4E0A\u8DF3\u821E",bed:"\u7761\u4E2A\u5348\u89C9",desk:"\u770B\u770B\u5E7F\u573A",plant:"\u7ED9\u690D\u7269\u6D47\u6C34",front:"\u6253\u4E2A\u62DB\u547C"},doing:{window:"\u6B63\u770B\u7740\u7A97\u5916",sofa:"\u5728\u6C99\u53D1\u4E0A\u4F11\u606F",rug:"\u5728\u5730\u6BEF\u4E0A\u8DF3\u821E",bed:"\u5728\u7761\u5348\u89C9",desk:"\u5728\u770B\u5E7F\u573A",plant:"\u5728\u7ED9\u690D\u7269\u6D47\u6C34",front:"\u5728\u8DDF\u4F60\u6253\u62DB\u547C"},say:{hello:"\u4F60\u597D\uFF01\u6211\u662F {name}",window:"\u5916\u9762\u771F\u7F8E\u2026",sofa:"\u554A\u2026\u597D\u8212\u670D",desk:"\u770B\u770B\u5E7F\u573A\u4E0A\u6709\u4EC0\u4E48\u2026",plant:"\u8BE5\u6D47\u6C34\u4E86 \u{1F331}",gotMsg:"\u{1F4E9} \u6211\u6536\u5230\u4E00\u6761\u6D88\u606F\uFF01",replied:"\u5DF2\u56DE\u590D \u2713",takeMe:"\u5E26\u6211\u53BB\u901B\u901B\uFF01\u{1F3AE}"},pad:{up:"\u4E0A",down:"\u4E0B",left:"\u5DE6",right:"\u53F3",use:"\u4F7F\u7528"}}},vu={creator:{stepOf:"\u091A\u0930\u0923 {n} / {total}",steps:{body:"\u0936\u0930\u0940\u0930",face:"\u091A\u0947\u0939\u0930\u093E",paint:"\u0930\u0902\u0917",acc:"\u090F\u0915\u094D\u0938\u0947\u0938\u0930\u0940\u091C\u093C"},tabs:{shape:"\u0906\u0915\u093E\u0930",style:"\u0938\u094D\u091F\u093E\u0907\u0932",color:"\u0930\u0902\u0917",finish:"\u092B\u093C\u093F\u0928\u093F\u0936",preset:"\u091F\u0947\u092E\u094D\u092A\u0932\u0947\u091F",eyes:"\u0906\u0901\u0916\u0947\u0902",brows:"\u092D\u094C\u0902\u0939\u0947\u0902",mouth:"\u092E\u0941\u0901\u0939",cheeks:"\u0917\u093E\u0932",pattern:"\u092A\u0948\u091F\u0930\u094D\u0928",texture:"\u091F\u0947\u0915\u094D\u0938\u091A\u0930"},bodyColor:"\u0936\u0930\u0940\u0930 \u0915\u093E \u0930\u0902\u0917",eyeColor:"\u0906\u0901\u0916\u094B\u0902 \u0915\u093E \u0930\u0902\u0917",adjust:"\u0938\u092E\u093E\u092F\u094B\u091C\u0928",size:"\u0906\u0915\u093E\u0930",spacing:"\u0926\u0942\u0930\u0940",height:"\u090A\u0901\u091A\u093E\u0908",color:"\u0930\u0902\u0917",patternColor:"\u092A\u0948\u091F\u0930\u094D\u0928 \u0915\u093E \u0930\u0902\u0917",otherColor:"\u0926\u0942\u0938\u0930\u093E \u0930\u0902\u0917",back:"\u2190 \u092A\u0940\u091B\u0947",next:"\u0906\u0917\u0947 \u2192",play:"\u0916\u0947\u0932\u0947\u0902",playNext:"\u25B6 \u0916\u0947\u0932\u0947\u0902",random:"\u0938\u0930\u092A\u094D\u0930\u093E\u0907\u091C\u093C \u0926\u094B",undo:"\u092A\u0942\u0930\u094D\u0935\u0935\u0924 \u0915\u0930\u0947\u0902",clearAll:"\u0938\u092C \u0939\u091F\u093E\u090F\u0901 ({n})",modBody:"\u0907\u0938\u0928\u0947 3D \u0936\u0930\u0940\u0930 \u201C{name}\u201D (\u090F\u0915 mod) \u092A\u0939\u0928\u093E \u0939\u0948, \u091C\u094B ot \u0915\u094B \u0922\u0915 \u0926\u0947\u0924\u093E \u0939\u0948\u0964 \u092F\u0939\u093E\u0901 \u0915\u0941\u091B \u092D\u0940 \u092C\u0926\u0932\u0928\u0947 \u092A\u0930 \u0935\u0939 \u0939\u091F \u091C\u093E\u090F\u0917\u093E (\u0906\u092A \u092A\u0942\u0930\u094D\u0935\u0935\u0924 \u0915\u0930 \u0938\u0915\u0924\u0947 \u0939\u0948\u0902)\u0964",modRemove:"3D \u0936\u0930\u0940\u0930 \u0939\u091F\u093E\u090F\u0901",drag:"\u0918\u0941\u092E\u093E\u0928\u0947 \u0915\u0947 \u0932\u093F\u090F \u0916\u0940\u0902\u091A\u0947\u0902",empty:"\u092F\u0939\u093E\u0901 \u0915\u0941\u091B \u0928\u0939\u0940\u0902 \u0939\u0948\u0964"},room:{auto:"\u0905\u092A\u0928\u0947 \u0906\u092A",control:"\u0928\u093F\u092F\u0902\u0924\u094D\u0930\u0923",edit:"\u0938\u0902\u092A\u093E\u0926\u093F\u0924 \u0915\u0930\u0947\u0902",message:"\u0938\u0902\u0926\u0947\u0936",messageHint:"\u0906\u0928\u0947 \u0935\u093E\u0932\u0947 \u0938\u0902\u0926\u0947\u0936 \u0915\u093E \u0905\u0928\u0941\u0915\u0930\u0923 \u0915\u0930\u0947\u0902",keys:"WASD \u092F\u093E \u0924\u0940\u0930 \u0915\u0941\u0902\u091C\u093F\u092F\u093E\u0901 \xB7 \u091C\u093E\u0928\u0947 \u0915\u0947 \u0932\u093F\u090F \u092B\u093C\u0930\u094D\u0936 \u092A\u0930 \u0915\u094D\u0932\u093F\u0915 \u0915\u0930\u0947\u0902 \xB7 Space \u0915\u0942\u0926\u0947\u0902 \xB7 E \u0907\u0938\u094D\u0924\u0947\u092E\u093E\u0932 \u0915\u0930\u0947\u0902",use:"E \xB7 {label}",getOff:"E \xB7 \u0928\u0940\u091A\u0947 \u0909\u0924\u0930\u0947\u0902",inRoom:"\u0905\u092A\u0928\u0947 \u0915\u092E\u0930\u0947 \u092E\u0947\u0902 \u0939\u0948",walk:"\u091A\u0932 \u0930\u0939\u093E \u0939\u0948",run:"\u0926\u094C\u0921\u093C \u0930\u0939\u093E \u0939\u0948",you:"\u0928\u093F\u092F\u0902\u0924\u094D\u0930\u0923 \u0906\u092A\u0915\u0947 \u0939\u093E\u0925 \u092E\u0947\u0902",themes:{cozy:"\u0906\u0930\u093E\u092E\u0926\u093E\u092F\u0915",gothic:"\u0917\u0949\u0925\u093F\u0915",roman:"\u0930\u094B\u092E\u0928",japanese:"\u091C\u093E\u092A\u093E\u0928\u0940",scandi:"\u0928\u0949\u0930\u094D\u0921\u093F\u0915",cyberpunk:"\u0938\u093E\u0907\u092C\u0930\u092A\u0902\u0915",beach:"\u0938\u092E\u0941\u0926\u094D\u0930 \u0924\u091F",cabin:"\u0915\u0947\u092C\u093F\u0928",space:"\u0905\u0902\u0924\u0930\u093F\u0915\u094D\u0937 \u092F\u093E\u0928",castle:"\u092E\u0939\u0932"},theme:"\u0918\u0930 \u0915\u0940 \u0936\u0948\u0932\u0940",places:{window:"\u0916\u093F\u0921\u093C\u0915\u0940 \u0938\u0947 \u092C\u093E\u0939\u0930 \u0926\u0947\u0916\u0947\u0902",sofa:"\u0938\u094B\u092B\u093C\u0947 \u092A\u0930 \u092C\u0948\u0920\u0947\u0902",rug:"\u0915\u093E\u0932\u0940\u0928 \u092A\u0930 \u0928\u093E\u091A\u0947\u0902",bed:"\u091D\u092A\u0915\u0940 \u0932\u0947\u0902",desk:"\u092A\u094D\u0932\u093E\u091C\u093C\u093E \u0926\u0947\u0916\u0947\u0902",plant:"\u092A\u094C\u0927\u0947 \u0915\u094B \u092A\u093E\u0928\u0940 \u0926\u0947\u0902",front:"\u0939\u093E\u092F \u0915\u0939\u0947\u0902"},doing:{window:"\u0916\u093F\u0921\u093C\u0915\u0940 \u0938\u0947 \u092C\u093E\u0939\u0930 \u0926\u0947\u0916 \u0930\u0939\u093E \u0939\u0948",sofa:"\u0938\u094B\u092B\u093C\u0947 \u092A\u0930 \u0906\u0930\u093E\u092E \u0915\u0930 \u0930\u0939\u093E \u0939\u0948",rug:"\u0915\u093E\u0932\u0940\u0928 \u092A\u0930 \u0928\u093E\u091A \u0930\u0939\u093E \u0939\u0948",bed:"\u091D\u092A\u0915\u0940 \u0932\u0947 \u0930\u0939\u093E \u0939\u0948",desk:"\u092A\u094D\u0932\u093E\u091C\u093C\u093E \u0926\u0947\u0916 \u0930\u0939\u093E \u0939\u0948",plant:"\u092A\u094C\u0927\u0947 \u0915\u094B \u092A\u093E\u0928\u0940 \u0926\u0947 \u0930\u0939\u093E \u0939\u0948",front:"\u0906\u092A\u0915\u094B \u0939\u093E\u092F \u0915\u0939 \u0930\u0939\u093E \u0939\u0948"},say:{hello:"\u0928\u092E\u0938\u094D\u0924\u0947! \u092E\u0948\u0902 {name} \u0939\u0942\u0901",window:"\u092C\u093E\u0939\u0930 \u0915\u093F\u0924\u0928\u093E \u0938\u0941\u0902\u0926\u0930 \u0939\u0948\u2026",sofa:"\u0906\u0939\u2026 \u0915\u093F\u0924\u0928\u093E \u0906\u0930\u093E\u092E",desk:"\u0926\u0947\u0916\u0947\u0902 \u092A\u094D\u0932\u093E\u091C\u093C\u093E \u092E\u0947\u0902 \u0915\u094D\u092F\u093E \u0939\u0948\u2026",plant:"\u092A\u093E\u0928\u0940 \u091A\u093E\u0939\u093F\u090F \u{1F331}",gotMsg:"\u{1F4E9} \u092E\u0941\u091D\u0947 \u090F\u0915 \u0938\u0902\u0926\u0947\u0936 \u092E\u093F\u0932\u093E!",replied:"\u091C\u0935\u093E\u092C \u0926\u093F\u092F\u093E \u2713",takeMe:"\u092E\u0941\u091D\u0947 \u0918\u0941\u092E\u093E\u0913! \u{1F3AE}"},pad:{up:"\u090A\u092A\u0930",down:"\u0928\u0940\u091A\u0947",left:"\u092C\u093E\u090F\u0901",right:"\u0926\u093E\u090F\u0901",use:"\u0907\u0938\u094D\u0924\u0947\u092E\u093E\u0932"}}};Bt({es:bu,en:wu,pt:xu,zh:ku,hi:vu})});function s0(e,t,o={}){Tu();let a=pe(o.locale),s=o.name||"ot",r=o.controls!==!1,i=matchMedia("(hover: none)").matches;e.classList.add("otr"),e.classList.toggle("compact",!!o.compact),e.hasAttribute("tabindex")||(e.tabIndex=0);let n=document.createElement("div");n.style.cssText="position:absolute;inset:0;pointer-events:none",n.innerHTML=`
|
|
340
340
|
<div class="otr-bubble" data-bubble hidden></div>
|
|
341
341
|
<div class="otr-hud">
|
|
342
342
|
<div>${o.onEdit?`<button type="button" class="otr-btn" data-edit>\u270E ${Ea(a("room.edit"))}</button>`:""}<span class="otr-who"><b data-name></b> <span data-doing>${Ea(a("room.inRoom"))}</span></span></div>
|
|
@@ -344,7 +344,7 @@ uniform vec3 uGravity;`,vc=`vec3 dN = normal;
|
|
|
344
344
|
</div>
|
|
345
345
|
<p class="otr-keys" data-keys hidden>${Ea(a("room.keys"))}</p>
|
|
346
346
|
<p class="otr-prompt" data-prompt hidden></p>
|
|
347
|
-
<div class="otr-pad" data-pad hidden>${["up","left","use","right","down"].map(I=>`<button type="button" data-d="${I}" aria-label="${Ea(a(`room.pad.${I}`))}">${{up:"\u25B2",left:"\u25C0",use:"E",right:"\u25B6",down:"\u25BC"}[I]}</button>`).join("")}</div>`;let l=I=>n.querySelector(I);l("[data-name]").textContent=s;let h=document.createElement("canvas");h.setAttribute("aria-label",a("room.inRoom")),e.append(h,n);let f=new Te.WebGLRenderer({canvas:h,antialias:!0,powerPreference:"high-performance"});f.setPixelRatio(Math.min(o.maxDpr||1.5,devicePixelRatio||1)),f.outputColorSpace=Te.SRGBColorSpace,f.toneMapping=Te.NeutralToneMapping,f.toneMappingExposure=1.05;let c=new Te.PMREMGenerator(f),d=c.fromScene(new r0.RoomEnvironment,.04);c.dispose();let p=new Te.Scene;p.background=new Te.Color("#2a1f55"),p.environment=d.texture,p.environmentIntensity=.45;let u=new Te.HemisphereLight(15265023,4206670,.56),g=new Te.DirectionalLight(16773600,2.4*.55);g.position.set(2.2,3.4,3.2);let m=new Te.DirectionalLight(13623551,2.2*.55);m.position.set(-2.6,2.2,-3);let w=new Te.DirectionalLight(16770804,.5*.55);w.position.set(-3,.5,2);let k=new Te.AmbientLight("#ffe9d6",.25);p.add(u,g,m,w,k);let b=null,x=I=>{b&&(p.remove(b.group),a0(b.group)),b=e0(p,I);let K=b.look;p.background.set(K.bg),e.style.background=K.bg,p.environmentIntensity=K.env,f.toneMappingExposure=K.exposure,u.color.set(K.hemi[0]),u.groundColor.set(K.hemi[1]),u.intensity=K.hemi[2],k.color.set(K.amb[0]),k.intensity=K.amb[1],g.intensity=2.4*.55*K.key,m.intensity=2.2*.55*K.key,w.intensity=.5*.55*K.key};x(o.theme||Ks);let E=new Te.PerspectiveCamera(36,1,.1,80),T=null,v=new Te.Vector3(.9,0,2),_=.2,C=.2,L=0,z=0,N=0,Q=1,F=null,A=null,B=null,W="auto",ae=new Set,Me=new Te.Vector3(-.4,.6,-.6),te=l("[data-bubble]"),ue=0,be=(I,K=2600)=>{te.textContent=I,te.hidden=!1,ue=performance.now()+K},fe=I=>{l("[data-doing]").textContent=I},Fe=I=>{T&&(p.remove(T.root),T.dispose()),T=new sa(I,{quality:"high",material:o.material||"plush"}),T.root.scale.setScalar(Mu/T.H),p.add(T.root)},Y=(I,K,ie)=>{let Pe=(K-I+Math.PI)%(Math.PI*2)-Math.PI;return Pe<-Math.PI&&(Pe+=Math.PI*2),I+Pe*ie},$e=(I,K)=>I<Xs[0]||I>Xs[1]||K<Xs[2]||K>Xs[3]||Eu.some(([ie,Pe,Re,Ue])=>I>ie-Js&&I<Re+Js&&K>Pe-Js&&K<Ue+Js),Oe=(I,K,ie=1)=>new Promise(Pe=>{F={x:I,z:K,sp:ie,res:Pe}}),Ge=(I,K=520)=>new Promise(ie=>{A={from:new Te.Vector3(v.x,L,v.z),to:new Te.Vector3(...I),t0:performance.now(),ms:K,res:ie}}),qe=async()=>{if(!B)return;let I=B;B=null,T.moodName==="sleep"&&T.mood("neutral"),await Ge([I.at[0],0,I.at[1]])},Ze=0,lo=new Set,We=I=>new Promise(K=>{let ie=setTimeout(()=>{lo.delete(ie),K()},I);lo.add(ie)}),st=I=>{let K=++Ze;F=null,I(()=>K!==Ze).catch(()=>{})},Ne=I=>async K=>{let ie=await K;if(I())throw 0;return ie};async function Gt(I,K,{hurry:ie=!1,line:Pe=null}={}){let Re=Ne(K),Ue=br[I];if(await Re(qe()),T.mood("neutral"),fe(a(ie?"room.run":"room.walk")),await Re(Oe(Ue.at[0],Ue.at[1],ie?2.2:1)),C=Ue.face,fe(a(`room.doing.${I}`)),await Re(We(350)),Ue.seat&&(B=Ue,await Re(Ge(Ue.seat)),C=Ue.face),I==="window")T.gesture("think"),be(a("room.say.window")),await Re(We(3200)),T.effect("sparkles"),await Re(We(2400));else if(I==="sofa")T.mood("happy"),await Re(We(2200)),T.gesture("yawn"),be(a("room.say.sofa")),await Re(We(4200));else if(I==="rug")for(let Mt of["dance","groove","disco"].sort(()=>Math.random()-.5).slice(0,2))T.gesture(Mt),T.effect("notes"),await Re(We(2600));else if(I==="bed"){T.mood("sleep"),be("zzz\u2026",1800);for(let Mt=0;Mt<4;Mt++)T.effect("zzz"),await Re(We(2200));T.mood("neutral"),T.gesture("yawn"),await Re(We(1600))}else I==="desk"?(T.gesture("think"),T.effect("thought"),be(Pe||a("room.say.desk")),await Re(We(3400)),T.gesture("nod"),await Re(We(1600))):I==="plant"?(T.gesture("point"),be(a("room.say.plant")),await Re(We(2800)),T.effect("hearts"),await Re(We(1400))):I==="front"&&(T.gesture("wave"),be(a("room.say.hello",{name:s})),await Re(We(2600)))}let co="front",Co=I=>st(async K=>{let ie=Ne(K);for(I||await ie(Gt("front",K));;){let Pe=Object.keys(br).filter(Re=>Re!==co);co=Pe[Math.floor(Math.random()*Pe.length)],await ie(Gt(co,K)),T.mood("neutral"),await ie(We(600+Math.random()*1200))}}),vr=()=>{W==="auto"?Co(!0):fe(a("room.you"))},Ya=I=>st(async K=>{let ie=Ne(K);T.effect("exclaim"),T.gesture("surprise"),be(a("room.say.gotMsg"),2200),await ie(We(900)),await ie(Gt("desk",K,{hurry:!0,line:I?`\xAB${String(I).slice(0,90)}\xBB`:null})),T.mood("happy"),T.gesture("thumbsup"),be(a("room.say.replied")),await ie(We(2400)),vr()}),rs=(I,K)=>{if(I==="message")return Ya(K);if(I==="plaza")return st(async ie=>{await Ne(ie)(Gt("desk",ie,{line:K||null})),vr()});if(I==="poke")return T.gesture("wave"),T.effect("hearts"),be(K||a("room.say.hello",{name:s}));T.effect(I),K&&be(K)},Ka=()=>{let I=null,K=1.3;for(let[ie,Pe]of Object.entries(br)){let Re=Math.hypot(v.x-Pe.at[0],v.z-Pe.at[1]);Re<K&&(K=Re,I=ie)}return I},_a=()=>{if(W!=="ctl")return;if(B)return st(async K=>{await Ne(K)(qe()),T.mood("neutral")});let I=Ka();I?st(K=>Gt(I,K)):T.gesture("jump")},Ta=I=>{!r&&I==="ctl"||(W=I,n.querySelectorAll("[data-mode]").forEach(K=>K.setAttribute("aria-pressed",K.dataset.mode===I)),l("[data-keys]").hidden=I!=="ctl"||i,l("[data-pad]").hidden=I!=="ctl"||!(i||e.clientWidth<640),I==="auto"?(l("[data-prompt]").hidden=!0,Co(!0)):(Ze++,F=null,fe(a("room.you")),be(a("room.say.takeMe"),1600),e.focus({preventScroll:!0})))},Xa={KeyW:"up",ArrowUp:"up",KeyS:"down",ArrowDown:"down",KeyA:"left",ArrowLeft:"left",KeyD:"right",ArrowRight:"right"},Ja=!1,Wo=I=>{if(!r||I.target.closest?.("input,textarea,select,[contenteditable]"))return;let K=Xa[I.code];if(I.type==="keyup"){K&&ae.delete(K);return}(Ja||e.contains(document.activeElement))&&(W==="auto"&&(K||I.code==="Space")&&Ta("ctl"),K&&(I.preventDefault(),ae.add(K)),I.code==="Space"&&(I.preventDefault(),T.gesture("jump")),I.code==="KeyE"&&_a())},er=()=>ae.clear();addEventListener("keydown",Wo),addEventListener("keyup",Wo),addEventListener("blur",er),e.addEventListener("pointerenter",()=>{Ja=!0}),e.addEventListener("pointerleave",()=>{Ja=!1});let tr=l("[data-pad]");tr.addEventListener("pointerdown",I=>{let K=I.target.closest("[data-d]")?.dataset.d;K&&(I.preventDefault(),K==="use"?_a():ae.add(K))});let ss=I=>{let K=I.target.closest?.("[data-d]")?.dataset.d;K&&ae.delete(K)};tr.addEventListener("pointerup",ss),tr.addEventListener("pointercancel",ss),tr.addEventListener("pointerleave",er);let Sa=new Te.Raycaster,or=new Te.Vector2;h.addEventListener("pointerdown",I=>{let K=h.getBoundingClientRect();if(or.set((I.clientX-K.left)/K.width*2-1,-((I.clientY-K.top)/K.height)*2+1),Sa.setFromCamera(or,E),!r){Sa.intersectObject(T.root,!0).length&&rs("poke");return}let ie=Sa.intersectObject(b.floor)[0];if(!ie)return;W==="auto"&&Ta("ctl");let{x:Pe,z:Re}=ie.point;if(Math.hypot(Pe-v.x,Re-v.z)<.25){T.gesture("jump");return}let Ue=Object.keys(br).find(Mt=>{let ca=br[Mt];return Math.hypot(Pe-(ca.seat?.[0]??ca.at[0]),Re-(ca.seat?.[2]??ca.at[1]))<.9});if(Ue&&(br[Ue].seat||$e(Pe,Re)))return st(Mt=>Gt(Ue,Mt));$e(Pe,Re)||st(async Mt=>{await Ne(Mt)(qe()),fe(a("room.walk")),await Ne(Mt)(Oe(Pe,Re,1.3)),fe(a("room.you"))})}),n.addEventListener("click",I=>{let K=I.target.closest("button");K&&(K.dataset.mode?Ta(K.dataset.mode):K.dataset.msg!=null?Ya():K.dataset.edit!=null&&o.onEdit?.())});let q=0,D=0,J=()=>{let I=Math.max(1,e.clientWidth),K=Math.max(1,e.clientHeight);if(I===q&&K===D)return;q=I,D=K,f.setSize(I,K,!1);let ie=I/K;E.aspect=ie,E.fov=ie<1?50:36,E.updateProjectionMatrix(),W==="ctl"&&(l("[data-pad]").hidden=!(i||I<640))},ee=new ResizeObserver(J);ee.observe(e);let ne=new Te.Vector3,we=new Te.Vector3,Le=new Te.Vector3,lt=new Te.Vector3;function Ee(I,K){let ie=K/1e3,Pe=E.aspect;b.tick(I,K);let Re=!1;if(W==="ctl"&&ae.size&&!A&&(B?st(async ct=>{await Ne(ct)(qe())}):(E.getWorldDirection(ne),ne.y=0,ne.normalize(),we.crossVectors(ne,E.up).normalize(),Le.set(0,0,0),ae.has("up")&&Le.add(ne),ae.has("down")&&Le.sub(ne),ae.has("right")&&Le.add(we),ae.has("left")&&Le.sub(we),Le.lengthSq()>0&&(Ze&&F&&(Ze++,F=null,T.mood("neutral"),fe(a("room.you"))),Le.normalize().multiplyScalar(2.1*ie),$e(v.x+Le.x,v.z)||(v.x+=Le.x),$e(v.x,v.z+Le.z)||(v.z+=Le.z),C=Math.atan2(Le.x,Le.z),Re=!0,Q=1.4))),A){let ct=Math.min(1,(performance.now()-A.t0)/A.ms),Ht=ct<.5?2*ct*ct:1-(-2*ct+2)**2/2;if(v.x=Te.MathUtils.lerp(A.from.x,A.to.x,Ht),v.z=Te.MathUtils.lerp(A.from.z,A.to.z,Ht),L=Te.MathUtils.lerp(A.from.y,A.to.y,Ht)+Math.sin(Math.PI*ct)*.55,ct>.05&&ct<.6&&(C=Math.atan2(A.to.x-A.from.x,A.to.z-A.from.z)||C),ct>=1){let Se=A.res;L=A.to.y,A=null,Se()}}else if(F&&!Re){let ct=F.x-v.x,Ht=F.z-v.z,Se=Math.hypot(ct,Ht),oe=Math.min(Se,1.5*F.sp*ie);if(Se<.04){let ot=F.res;F=null,ot()}else v.x+=ct/Se*oe,v.z+=Ht/Se*oe,C=Math.atan2(ct,Ht),Re=!0,Q=F.sp}N+=((Re?1:0)-N)*Math.min(1,ie*10),z+=ie*11*Q,_=Y(_,C,Math.min(1,ie*9));let Ue=Math.abs(Math.sin(z))*.08*N;T.root.position.set(v.x,L+Ue,v.z),T.root.rotation.set(0,_,Math.sin(z)*.07*N),T.shadow&&(T.shadow.position.y=.002-Ue/T.root.scale.y,T.shadow.material.opacity=1-Math.min(.7,Ue*4)),T.tick(I,K),T.lod(Math.min(320,D*.35));let Mt=Pe<1?.75:.3,ca=Le.set(Te.MathUtils.lerp(-.3,v.x,Mt),.5,Te.MathUtils.lerp(-.6,v.z,Mt));Me.lerp(ca,Math.min(1,ie*2.5));let ar=Pe<1?10.5:o.compact?11.4:12.6;if(E.position.set(Me.x+ar*.42,Me.y+ar*.62,Me.z+ar*.66),E.lookAt(Me),f.render(p,E),te.hidden||(performance.now()>ue&&(te.hidden=!0),lt.set(0,T.H*1.12,0).applyMatrix4(T.root.matrixWorld).project(E),te.style.left=`${(lt.x+1)/2*q}px`,te.style.top=`${(1-lt.y)/2*D}px`),W==="ctl"){let ct=!F&&!A&&Ka(),Ht=B?a("room.getOff"):ct?a("room.use",{label:a(`room.places.${ct}`)}):"",Se=l("[data-prompt]");Se.textContent!==Ht&&(Se.textContent=Ht),Se.hidden=!Ht}}let se=0,tt=0,Xt=!0,ho=!1,Ro=I=>{if(se=0,ho||!Xt||document.hidden)return;let K=Math.min(100,tt?I-tt:16);tt=I,J(),Ee(I,K),se=requestAnimationFrame(Ro)},vt=()=>{!se&&!ho&&Xt&&!document.hidden&&(tt=0,se=requestAnimationFrame(Ro))},Uo=new IntersectionObserver(([I])=>{Xt=I.isIntersecting,vt()},{rootMargin:"64px"});return Uo.observe(e),document.addEventListener("visibilitychange",vt),Fe(t),J(),Co(!1),vt(),{el:e,say:be,message:Ya,react:rs,setMode:Ta,get mode(){return W},setName(I){s=I||"ot",l("[data-name]").textContent=s},setSpec(I){let K=T.moodName;Fe(I),T.mood(K||"neutral"),T.gesture("celebrate")},setTheme(I){ho||(x(I),vt())},get theme(){return b.id},destroy(){ho=!0,Ze++,cancelAnimationFrame(se);for(let I of lo)clearTimeout(I);Uo.disconnect(),ee.disconnect(),removeEventListener("keydown",Wo),removeEventListener("keyup",Wo),removeEventListener("blur",er),document.removeEventListener("visibilitychange",vt),T.dispose(),p.remove(T.root),a0(p),d.dispose(),f.dispose(),f.forceContextLoss?.(),h.remove(),n.remove(),e.classList.remove("otr","compact")}}}var Te,r0,Ea,Mu,br,Eu,Xs,Js,_u,o0,Tu,a0,i0=Ye(()=>{Te=_t(Do(),1),r0=_t(sn(),1);wn();t0();vn();Qe();Ea=e=>String(e??"").replace(/[&<>"]/g,t=>({"&":"&","<":"<",">":">",'"':"""})[t]),Mu=1.3,br={window:{at:[-1.2,-3],face:Math.PI},sofa:{at:[-3.2,.5],seat:[-4.15,.66,.5],face:Math.PI/2},rug:{at:[.6,.9],face:.35},bed:{at:[1.9,-2.2],seat:[3.55,.68,-2.3],face:.3},desk:{at:[.95,-2.75],face:Math.PI},plant:{at:[-3.5,-2.6],face:-2.3},front:{at:[.9,2],face:.25}},Eu=[[-5,-.95,-3.7,1.95],[-4.75,-1.85,-3.85,-1.05],[2.45,-4,4.65,-.95],[0,-4,2.05,-3],[-4.8,-3.85,-3.9,-2.95]],Xs=[-4.6,4.6,-3.6,3.6],Js=.32,_u=`
|
|
347
|
+
<div class="otr-pad" data-pad hidden>${["up","left","use","right","down"].map(I=>`<button type="button" data-d="${I}" aria-label="${Ea(a(`room.pad.${I}`))}">${{up:"\u25B2",left:"\u25C0",use:"E",right:"\u25B6",down:"\u25BC"}[I]}</button>`).join("")}</div>`;let l=I=>n.querySelector(I);l("[data-name]").textContent=s;let h=document.createElement("canvas");h.setAttribute("aria-label",a("room.inRoom")),e.append(h,n);let f=new Te.WebGLRenderer({canvas:h,antialias:!0,powerPreference:"high-performance"});f.setPixelRatio(Math.min(o.maxDpr||1.5,devicePixelRatio||1)),f.outputColorSpace=Te.SRGBColorSpace,f.toneMapping=Te.NeutralToneMapping,f.toneMappingExposure=1.05;let c=new Te.PMREMGenerator(f),d=c.fromScene(new r0.RoomEnvironment,.04);c.dispose();let p=new Te.Scene;p.background=new Te.Color("#2a1f55"),p.environment=d.texture,p.environmentIntensity=.45;let u=new Te.HemisphereLight(15265023,4206670,.56),g=new Te.DirectionalLight(16773600,2.4*.55);g.position.set(2.2,3.4,3.2);let m=new Te.DirectionalLight(13623551,2.2*.55);m.position.set(-2.6,2.2,-3);let w=new Te.DirectionalLight(16770804,.5*.55);w.position.set(-3,.5,2);let k=new Te.AmbientLight("#ffe9d6",.25);p.add(u,g,m,w,k);let b=null,x=I=>{b&&(p.remove(b.group),a0(b.group)),b=e0(p,I);let K=b.look;p.background.set(K.bg),e.style.background=K.bg,p.environmentIntensity=K.env,f.toneMappingExposure=K.exposure,u.color.set(K.hemi[0]),u.groundColor.set(K.hemi[1]),u.intensity=K.hemi[2],k.color.set(K.amb[0]),k.intensity=K.amb[1],g.intensity=2.4*.55*K.key,m.intensity=2.2*.55*K.key,w.intensity=.5*.55*K.key};x(o.theme||Ks);let E=new Te.PerspectiveCamera(36,1,.1,80),T=null,v=new Te.Vector3(.9,0,2),_=.2,C=.2,L=0,z=0,N=0,Q=1,F=null,A=null,B=null,W="auto",ae=new Set,Me=new Te.Vector3(-.4,.6,-.6),te=l("[data-bubble]"),ue=0,be=(I,K=2600)=>{te.textContent=I,te.hidden=!1,ue=performance.now()+K},fe=I=>{l("[data-doing]").textContent=I},Fe=I=>{T&&(p.remove(T.root),T.dispose()),T=new sa(I,{quality:"high",material:o.material||"plush"}),T.root.scale.setScalar(Mu/T.H),p.add(T.root)},Y=(I,K,ie)=>{let Pe=(K-I+Math.PI)%(Math.PI*2)-Math.PI;return Pe<-Math.PI&&(Pe+=Math.PI*2),I+Pe*ie},$e=(I,K)=>I<Xs[0]||I>Xs[1]||K<Xs[2]||K>Xs[3]||Eu.some(([ie,Pe,Re,Ue])=>I>ie-Js&&I<Re+Js&&K>Pe-Js&&K<Ue+Js),Oe=(I,K,ie=1)=>new Promise(Pe=>{F={x:I,z:K,sp:ie,res:Pe}}),Ge=(I,K=520)=>new Promise(ie=>{A={from:new Te.Vector3(v.x,L,v.z),to:new Te.Vector3(...I),t0:performance.now(),ms:K,res:ie}}),qe=async()=>{if(!B)return;let I=B;B=null,T.moodName==="sleep"&&T.mood("neutral"),await Ge([I.at[0],0,I.at[1]])},Ze=0,lo=new Set,We=I=>new Promise(K=>{let ie=setTimeout(()=>{lo.delete(ie),K()},I);lo.add(ie)}),st=I=>{let K=++Ze;F=null,I(()=>K!==Ze).catch(()=>{})},Ne=I=>async K=>{let ie=await K;if(I())throw 0;return ie};async function Gt(I,K,{hurry:ie=!1,line:Pe=null}={}){let Re=Ne(K),Ue=br[I];if(await Re(qe()),T.mood("neutral"),fe(a(ie?"room.run":"room.walk")),await Re(Oe(Ue.at[0],Ue.at[1],ie?2.2:1)),C=Ue.face,fe(a(`room.doing.${I}`)),await Re(We(350)),Ue.seat&&(B=Ue,await Re(Ge(Ue.seat)),C=Ue.face),I==="window")T.gesture("think"),be(a("room.say.window")),await Re(We(3200)),T.effect("sparkles"),await Re(We(2400));else if(I==="sofa")T.mood("happy"),await Re(We(2200)),T.gesture("yawn"),be(a("room.say.sofa")),await Re(We(4200));else if(I==="rug")for(let Mt of["dance","groove","disco"].sort(()=>Math.random()-.5).slice(0,2))T.gesture(Mt),T.effect("notes"),await Re(We(2600));else if(I==="bed"){T.mood("sleep"),be("zzz\u2026",1800);for(let Mt=0;Mt<4;Mt++)T.effect("zzz"),await Re(We(2200));T.mood("neutral"),T.gesture("yawn"),await Re(We(1600))}else I==="desk"?(T.gesture("think"),T.effect("thought"),be(Pe||a("room.say.desk")),await Re(We(3400)),T.gesture("nod"),await Re(We(1600))):I==="plant"?(T.gesture("point"),be(a("room.say.plant")),await Re(We(2800)),T.effect("hearts"),await Re(We(1400))):I==="front"&&(T.gesture("wave"),be(a("room.say.hello",{name:s})),await Re(We(2600)))}let co="front",Co=I=>st(async K=>{let ie=Ne(K);for(I||await ie(Gt("front",K));;){let Pe=Object.keys(br).filter(Re=>Re!==co);co=Pe[Math.floor(Math.random()*Pe.length)],await ie(Gt(co,K)),T.mood("neutral"),await ie(We(600+Math.random()*1200))}}),vr=()=>{W==="auto"?Co(!0):fe(a("room.you"))},Ya=I=>st(async K=>{let ie=Ne(K);T.effect("exclaim"),T.gesture("surprise"),be(a("room.say.gotMsg"),2200),await ie(We(900)),await ie(Gt("desk",K,{hurry:!0,line:I?`\xAB${String(I).slice(0,90)}\xBB`:null})),T.mood("happy"),T.gesture("thumbsup"),be(a("room.say.replied")),await ie(We(2400)),vr()}),rs=(I,K)=>{if(I==="message")return Ya(K);if(I==="plaza")return st(async ie=>{await Ne(ie)(Gt("desk",ie,{line:K||null})),vr()});if(I==="poke")return T.gesture("wave"),T.effect("hearts"),be(K||a("room.say.hello",{name:s}));T.effect(I),K&&be(K)},Ka=()=>{let I=null,K=1.3;for(let[ie,Pe]of Object.entries(br)){let Re=Math.hypot(v.x-Pe.at[0],v.z-Pe.at[1]);Re<K&&(K=Re,I=ie)}return I},_a=()=>{if(W!=="ctl")return;if(B)return st(async K=>{await Ne(K)(qe()),T.mood("neutral")});let I=Ka();I?st(K=>Gt(I,K)):T.gesture("jump")},Ta=I=>{!r&&I==="ctl"||(W=I,n.querySelectorAll("[data-mode]").forEach(K=>K.setAttribute("aria-pressed",K.dataset.mode===I)),l("[data-keys]").hidden=I!=="ctl"||i,l("[data-pad]").hidden=I!=="ctl"||!(i||e.clientWidth<640),I==="auto"?(l("[data-prompt]").hidden=!0,Co(!0)):(Ze++,F=null,fe(a("room.you")),be(a("room.say.takeMe"),1600),e.focus({preventScroll:!0})))},Xa={KeyW:"up",ArrowUp:"up",KeyS:"down",ArrowDown:"down",KeyA:"left",ArrowLeft:"left",KeyD:"right",ArrowRight:"right"},Ja=!1,Wo=I=>{if(!r||I.target.closest?.("input,textarea,select,[contenteditable]"))return;let K=Xa[I.code];if(I.type==="keyup"){K&&ae.delete(K);return}(Ja||e.contains(document.activeElement))&&(W==="auto"&&(K||I.code==="Space")&&Ta("ctl"),K&&(I.preventDefault(),ae.add(K)),I.code==="Space"&&(I.preventDefault(),T.gesture("jump")),I.code==="KeyE"&&_a())},er=()=>ae.clear();addEventListener("keydown",Wo),addEventListener("keyup",Wo),addEventListener("blur",er),e.addEventListener("pointerenter",()=>{Ja=!0}),e.addEventListener("pointerleave",()=>{Ja=!1});let tr=l("[data-pad]");tr.addEventListener("pointerdown",I=>{let K=I.target.closest("[data-d]")?.dataset.d;K&&(I.preventDefault(),K==="use"?_a():ae.add(K))});let ss=I=>{let K=I.target.closest?.("[data-d]")?.dataset.d;K&&ae.delete(K)};tr.addEventListener("pointerup",ss),tr.addEventListener("pointercancel",ss),tr.addEventListener("pointerleave",er);let Sa=new Te.Raycaster,or=new Te.Vector2;h.addEventListener("pointerdown",I=>{let K=h.getBoundingClientRect();if(or.set((I.clientX-K.left)/K.width*2-1,-((I.clientY-K.top)/K.height)*2+1),Sa.setFromCamera(or,E),!r){Sa.intersectObject(T.root,!0).length&&rs("poke");return}let ie=Sa.intersectObject(b.floor)[0];if(!ie)return;W==="auto"&&Ta("ctl");let{x:Pe,z:Re}=ie.point;if(Math.hypot(Pe-v.x,Re-v.z)<.25){T.gesture("jump");return}let Ue=Object.keys(br).find(Mt=>{let ca=br[Mt];return Math.hypot(Pe-(ca.seat?.[0]??ca.at[0]),Re-(ca.seat?.[2]??ca.at[1]))<.9});if(Ue&&(br[Ue].seat||$e(Pe,Re)))return st(Mt=>Gt(Ue,Mt));$e(Pe,Re)||st(async Mt=>{await Ne(Mt)(qe()),fe(a("room.walk")),await Ne(Mt)(Oe(Pe,Re,1.3)),fe(a("room.you")),e.focus({preventScroll:!0})})}),n.addEventListener("click",I=>{let K=I.target.closest("button");K&&(K.dataset.mode?Ta(K.dataset.mode):K.dataset.msg!=null?Ya():K.dataset.edit!=null&&o.onEdit?.())});let q=0,D=0,J=()=>{let I=Math.max(1,e.clientWidth),K=Math.max(1,e.clientHeight);if(I===q&&K===D)return;q=I,D=K,f.setSize(I,K,!1);let ie=I/K;E.aspect=ie,E.fov=ie<1?50:36,E.updateProjectionMatrix(),W==="ctl"&&(l("[data-pad]").hidden=!(i||I<640))},ee=new ResizeObserver(J);ee.observe(e);let ne=new Te.Vector3,we=new Te.Vector3,Le=new Te.Vector3,lt=new Te.Vector3;function Ee(I,K){let ie=K/1e3,Pe=E.aspect;b.tick(I,K);let Re=!1;if(W==="ctl"&&ae.size&&!A&&(B?st(async ct=>{await Ne(ct)(qe())}):(E.getWorldDirection(ne),ne.y=0,ne.normalize(),we.crossVectors(ne,E.up).normalize(),Le.set(0,0,0),ae.has("up")&&Le.add(ne),ae.has("down")&&Le.sub(ne),ae.has("right")&&Le.add(we),ae.has("left")&&Le.sub(we),Le.lengthSq()>0&&(Ze&&F&&(Ze++,F=null,T.mood("neutral"),fe(a("room.you"))),Le.normalize().multiplyScalar(2.1*ie),$e(v.x+Le.x,v.z)||(v.x+=Le.x),$e(v.x,v.z+Le.z)||(v.z+=Le.z),C=Math.atan2(Le.x,Le.z),Re=!0,Q=1.4))),A){let ct=Math.min(1,(performance.now()-A.t0)/A.ms),Ht=ct<.5?2*ct*ct:1-(-2*ct+2)**2/2;if(v.x=Te.MathUtils.lerp(A.from.x,A.to.x,Ht),v.z=Te.MathUtils.lerp(A.from.z,A.to.z,Ht),L=Te.MathUtils.lerp(A.from.y,A.to.y,Ht)+Math.sin(Math.PI*ct)*.55,ct>.05&&ct<.6&&(C=Math.atan2(A.to.x-A.from.x,A.to.z-A.from.z)||C),ct>=1){let Se=A.res;L=A.to.y,A=null,Se()}}else if(F&&!Re){let ct=F.x-v.x,Ht=F.z-v.z,Se=Math.hypot(ct,Ht),oe=Math.min(Se,1.5*F.sp*ie);if(Se<.04){let ot=F.res;F=null,ot()}else v.x+=ct/Se*oe,v.z+=Ht/Se*oe,C=Math.atan2(ct,Ht),Re=!0,Q=F.sp}N+=((Re?1:0)-N)*Math.min(1,ie*10),z+=ie*11*Q,_=Y(_,C,Math.min(1,ie*9));let Ue=Math.abs(Math.sin(z))*.08*N;T.root.position.set(v.x,L+Ue,v.z),T.root.rotation.set(0,_,Math.sin(z)*.07*N),T.shadow&&(T.shadow.position.y=.002-Ue/T.root.scale.y,T.shadow.material.opacity=1-Math.min(.7,Ue*4)),T.tick(I,K),T.lod(Math.min(320,D*.35));let Mt=Pe<1?.75:.3,ca=Le.set(Te.MathUtils.lerp(-.3,v.x,Mt),.5,Te.MathUtils.lerp(-.6,v.z,Mt));Me.lerp(ca,Math.min(1,ie*2.5));let ar=Pe<1?10.5:o.compact?11.4:12.6;if(E.position.set(Me.x+ar*.42,Me.y+ar*.62,Me.z+ar*.66),E.lookAt(Me),f.render(p,E),te.hidden||(performance.now()>ue&&(te.hidden=!0),lt.set(0,T.H*1.12,0).applyMatrix4(T.root.matrixWorld).project(E),te.style.left=`${(lt.x+1)/2*q}px`,te.style.top=`${(1-lt.y)/2*D}px`),W==="ctl"){let ct=!F&&!A&&Ka(),Ht=B?a("room.getOff"):ct?a("room.use",{label:a(`room.places.${ct}`)}):"",Se=l("[data-prompt]");Se.textContent!==Ht&&(Se.textContent=Ht),Se.hidden=!Ht}}let se=0,tt=0,Xt=!0,ho=!1,Ro=I=>{if(se=0,ho||!Xt||document.hidden)return;let K=Math.min(100,tt?I-tt:16);tt=I,J(),Ee(I,K),se=requestAnimationFrame(Ro)},vt=()=>{!se&&!ho&&Xt&&!document.hidden&&(tt=0,se=requestAnimationFrame(Ro))},Uo=new IntersectionObserver(([I])=>{Xt=I.isIntersecting,vt()},{rootMargin:"64px"});return Uo.observe(e),document.addEventListener("visibilitychange",vt),Fe(t),J(),Co(!1),vt(),{el:e,say:be,message:Ya,react:rs,setMode:Ta,get mode(){return W},setName(I){s=I||"ot",l("[data-name]").textContent=s},setSpec(I){let K=T.moodName;Fe(I),T.mood(K||"neutral"),T.gesture("celebrate")},setTheme(I){ho||(x(I),vt())},get theme(){return b.id},destroy(){ho=!0,Ze++,cancelAnimationFrame(se);for(let I of lo)clearTimeout(I);Uo.disconnect(),ee.disconnect(),removeEventListener("keydown",Wo),removeEventListener("keyup",Wo),removeEventListener("blur",er),document.removeEventListener("visibilitychange",vt),T.dispose(),p.remove(T.root),a0(p),d.dispose(),f.dispose(),f.forceContextLoss?.(),h.remove(),n.remove(),e.classList.remove("otr","compact")}}}var Te,r0,Ea,Mu,br,Eu,Xs,Js,_u,o0,Tu,a0,i0=Ye(()=>{Te=_t(Do(),1),r0=_t(sn(),1);wn();t0();vn();Qe();Ea=e=>String(e??"").replace(/[&<>"]/g,t=>({"&":"&","<":"<",">":">",'"':"""})[t]),Mu=1.3,br={window:{at:[-1.2,-3],face:Math.PI},sofa:{at:[-3.2,.5],seat:[-4.15,.66,.5],face:Math.PI/2},rug:{at:[.6,.9],face:.35},bed:{at:[1.9,-2.2],seat:[3.55,.68,-2.3],face:.3},desk:{at:[.95,-2.75],face:Math.PI},plant:{at:[-3.5,-2.6],face:-2.3},front:{at:[.9,2],face:.25}},Eu=[[-5,-.95,-3.7,1.95],[-4.75,-1.85,-3.85,-1.05],[2.45,-4,4.65,-.95],[0,-4,2.05,-3],[-4.8,-3.85,-3.9,-2.95]],Xs=[-4.6,4.6,-3.6,3.6],Js=.32,_u=`
|
|
348
348
|
.otr{position:relative;overflow:hidden;border-radius:inherit;min-height:260px;background:#2a1f55;outline:none;--otr-glass:rgb(10 7 32 / .62);--otr-line:rgb(255 255 255 / .14);--otr-accent:#ffd23f;--otr-accent-ink:#1a1240;color:#f4f1ff}
|
|
349
349
|
.otr canvas{position:absolute;inset:0;width:100%;height:100%;display:block;touch-action:none;cursor:crosshair}
|
|
350
350
|
.otr button{font:inherit;color:inherit;cursor:pointer}
|
|
@@ -541,7 +541,7 @@ ${sd(this.brain?.persona?.locale||this.brain?.persona?.language)}`;await this.br
|
|
|
541
541
|
fill="${this.color}" stroke="#fff" stroke-width="1.6" stroke-linejoin="round"/></svg>
|
|
542
542
|
<div class="tag"><span class="n"></span><small class="s"></small></div>
|
|
543
543
|
</div>`,o.querySelector(".n").textContent=this.name,o.querySelector(".s").textContent=this.t("widget.pointer.hint"),document.documentElement.appendChild(t),this._host=t,this._place(this.x,this.y)}_show(){this.visible&&(this._mount(),this._host.shadowRoot.querySelector(".n").textContent=this.name,clearTimeout(this._hideTimer),this._raise(),this._host.classList.add("on"))}_raise(){let t=this._host;if(t?.showPopover)try{if(t.matches(":popover-open")){if(!document.querySelector("dialog:modal"))return;t.hidePopover()}t.showPopover()}catch{}}_scheduleHide(){clearTimeout(this._hideTimer),this._hideTimer=setTimeout(()=>this._host?.classList.remove("on"),2500)}_label(t){let o=this._host?.shadowRoot.querySelector(".s");o&&(o.textContent=t||this.t("widget.pointer.hint"))}_ripple(){let t=this._host?.shadowRoot.querySelector(".ring");t&&(t.classList.remove("go"),t.offsetWidth,t.classList.add("go"))}},zi=(e,t,o)=>Math.max(t,Math.min(o,e));async function wd(e,t){let o=e.getBoundingClientRect();if(t)return o;for(let a=0;a<30;a++){await ms(40);let s=e.getBoundingClientRect();if(Math.abs(s.top-o.top)<1&&Math.abs(s.left-o.left)<1)return s;o=s}return o}function xd(e){let t=e.getBoundingClientRect();return(t.width<2||t.height<2||getComputedStyle(e).opacity==="0")&&e.labels?.length?e.labels[0]:e}function kd(e){return e.closest?.("label")?.control||null}function tl(e){let t=[];for(let o=e;o&&o.nodeType===1;o=o.parentElement||o.getRootNode()?.host)t.push(o);return t}function vd(e){let t=(e.getAttribute?.("aria-label")||e.innerText||"").trim().replace(/\s+/g," ").slice(0,50),o=e.id?`#${e.id}`:"";return`${e.tagName.toLowerCase()}${o}${t?` \xAB${t}\xBB`:""}`}function La(){let e=document.activeElement;for(;e?.shadowRoot?.activeElement;)e=e.shadowRoot.activeElement;return e}function Li(e){let t=e.closest?.(Hi)||(e.matches?.(Hi)?e:null);t&&La()!==t&&t.focus({preventScroll:!0})}function rl(e){return e.isContentEditable?!0:e.tagName==="TEXTAREA"?!e.readOnly&&!e.disabled:e.tagName!=="INPUT"?!1:!e.readOnly&&!e.disabled&&/^(text|search|email|url|tel|number|password|date|time|datetime-local|month|week)?$/.test(e.type==="text"?"":e.type)}function sl(e){if(e.select)e.select();else if(e.isContentEditable){let t=document.createRange();t.selectNodeContents(e);let o=getSelection();o.removeAllRanges(),o.addRange(t)}}function $s(e,t){let o=e.value??e.textContent,a=!1;try{a=document.execCommand("insertText",!1,t)}catch{}let s=e.value??e.textContent;if(a&&s!==o)return;if(e.isContentEditable){e.textContent+=t,e.dispatchEvent(new InputEvent("input",{bubbles:!0,inputType:"insertText",data:t}));return}let r=null;try{r=e.selectionStart}catch{}let i=e.value;if(r==null)gs(e,i+t);else{let n=e.selectionEnd;gs(e,i.slice(0,r)+t+i.slice(n));try{e.setSelectionRange(r+t.length,r+t.length)}catch{}}e.dispatchEvent(new InputEvent("input",{bubbles:!0,inputType:"insertText",data:t}))}function gs(e,t){let o=e.tagName==="TEXTAREA"?HTMLTextAreaElement.prototype:e.tagName==="SELECT"?HTMLSelectElement.prototype:HTMLInputElement.prototype;Object.getOwnPropertyDescriptor(o,"value").set.call(e,t)}function Md(){return[...document.querySelectorAll(Hi)].filter(e=>{if(e.closest("[data-ots-root], [inert], [hidden]"))return!1;let t=e.getBoundingClientRect();return t.width>0&&t.height>0&&getComputedStyle(e).visibility!=="hidden"})}function Ed(e,t){for(let o=e;o&&o!==document.body&&o!==document.documentElement;o=o.parentElement){let a=getComputedStyle(o),s=t==="x"?a.overflowX:a.overflowY;if((t==="x"?o.scrollWidth>o.clientWidth:o.scrollHeight>o.clientHeight)&&/(auto|scroll|overlay)/.test(s))return o}return document.scrollingElement||document.documentElement}var _d={enter:"Enter",return:"Enter",tab:"Tab",esc:"Escape",escape:"Escape",space:" ",spacebar:" ",backspace:"Backspace",delete:"Delete",supr:"Delete",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",arrowup:"ArrowUp",arrowdown:"ArrowDown",arrowleft:"ArrowLeft",arrowright:"ArrowRight",home:"Home",end:"End",pageup:"PageUp",pagedown:"PageDown"};function Td(e){return _d[e.toLowerCase()]||(e.length===1?e:e[0].toUpperCase()+e.slice(1))}function Sd(e){return/^[a-z]$/i.test(e)?`Key${e.toUpperCase()}`:/^\d$/.test(e)?`Digit${e}`:e===" "?"Space":e.length>1?e:""}function Cd(e,t,o){let a=e.tagName,s=rl(e);if((o.ctrlKey||o.metaKey)&&t.toLowerCase()==="a")return sl(e);if(!(o.ctrlKey||o.metaKey||o.altKey))switch(t){case"Enter":return a==="TEXTAREA"||e.isContentEditable?$s(e,`
|
|
544
|
-
`):a==="INPUT"&&e.form&&!/^(checkbox|radio|button|submit|reset)$/.test(e.type)?e.form.requestSubmit?e.form.requestSubmit():e.form.submit():e.matches("a[href], button, summary, [role=button], [role=link], [role=tab], [role=menuitem], input[type=submit], input[type=button]")?e.click():void 0;case" ":return s?$s(e," "):e.matches("button, summary, [role=button], [role=checkbox], [role=switch], [role=tab], input[type=checkbox], input[type=radio]")?e.click():window.scrollBy({top:window.innerHeight*.8});case"Tab":{let r=Md(),i=r.indexOf(e);return r[(i+(o.shiftKey?-1:1)+r.length)%r.length]?.focus()}case"Backspace":return s?document.execCommand("delete")||ol(e,-1):void 0;case"Delete":return s?document.execCommand("forwardDelete")||ol(e,1):void 0;case"ArrowUp":case"ArrowDown":{let r=t==="ArrowDown"?1:-1;if(a==="SELECT"){let i=zi(e.selectedIndex+r,0,e.options.length-1);i!==e.selectedIndex&&(e.selectedIndex=i,e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0})));return}return a==="INPUT"&&(e.type==="number"||e.type==="range")?al(e,r):s?void 0:window.scrollBy({top:r*60})}case"ArrowLeft":case"ArrowRight":return a==="INPUT"&&e.type==="range"?al(e,t==="ArrowRight"?1:-1):void 0;case"PageDown":case"PageUp":s||window.scrollBy({top:(t==="PageDown"?1:-1)*window.innerHeight*.85});return;case"Home":case"End":s||window.scrollTo({top:t==="Home"?0:document.documentElement.scrollHeight});return;default:t.length===1&&s&&$s(e,t)}}function ol(e,t){if(e.value==null)return;let o=e.selectionStart??e.value.length,a=e.selectionEnd??o;o===a&&(t<0?o=Math.max(0,o-1):a=Math.min(e.value.length,a+1)),gs(e,e.value.slice(0,o)+e.value.slice(a)),e.setSelectionRange?.(o,o),e.dispatchEvent(new InputEvent("input",{bubbles:!0,inputType:t<0?"deleteContentBackward":"deleteContentForward"}))}function al(e,t){try{t>0?e.stepUp():e.stepDown()}catch{return}e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0}))}Qe();var dl="input[type=password], [autocomplete^=cc-], [autocomplete=one-time-code], [data-ots-private], [data-ots-private] *",Rd=1500,jr=class{constructor({actions:t,context:o,bus:a,pointer:s=null,t:r=pe()}){this.t=r,this.actions=t,this.context=o,this.bus=a,this.pointer=s,this._tools=new Map,this._offs=[],this._timer=null}start(){let t=()=>{clearTimeout(this._timer),this._timer=setTimeout(()=>this.scan(),250)};this._offs.push(this.bus.on("context:mutation",t),this.bus.on("context:route",t)),this.scan()}stop(){clearTimeout(this._timer),this._offs.forEach(t=>t?.()),this._offs=[];for(let t of this._tools.keys())this.actions.unregister(t);this._tools.clear()}scan(){let t=new Map;for(let o of document.querySelectorAll("[data-ots-tool]")){if(o.closest("[data-ots-ignore], [data-ots-root]"))continue;let a=String(o.dataset.otsTool).trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"_").slice(0,64);if(!(!a||t.has(a))){if(this.actions.has(a)&&!this._tools.has(a)){console.warn(`[7ots] data-ots-tool="${a}" choca con una acci\xF3n existente; se ignora.`);continue}t.set(a,o)}}for(let[o,a]of this._tools)t.get(o)!==a&&(this.actions.unregister(o),this._tools.delete(o));for(let[o,a]of t)this._tools.get(o)!==a&&(this.actions.register(a.tagName==="FORM"?this._formTool(o,a):this._buttonTool(o,a)),this._tools.set(o,a))}list(){return[...this._tools.keys()]}_formTool(t,o){let a=Ad(o),s={},r=[];for(let n of a)s[n.name]=n.schema,n.required&&r.push(n.name);let i=[...o.querySelectorAll(dl)].some(n=>n.required);return{name:t,category:"page",title:o.dataset.otsTitle||t,description:`[p\xE1gina] ${o.dataset.otsDescription||o.getAttribute("aria-label")||o.querySelector("legend, h2, h3")?.textContent?.trim()||t}`+(i?" (tiene campos privados que el usuario debe escribir antes)":""),parameters:{type:"object",properties:s,required:r},requiresAuth:o.hasAttribute("data-ots-auth"),confirm:il(o,this.t),timeoutMs:6e4,handler:async(n,{ui:l})=>{if(!o.isConnected)return{ok:!1,error:"El formulario ya no est\xE1 en la p\xE1gina."};let h=ys(o);for(let d of a){if(!(d.name in n))continue;let p=n[d.name],u=d.pick(p);if(!u)return{ok:!1,error:`Valor no v\xE1lido para ${d.name}: ${p}`};if(this.pointer&&h&&ys(u))if(d.kind==="text")await this.pointer.type(u,String(p),{clear:!0}),u.dispatchEvent(new Event("change",{bubbles:!0}));else if(d.kind==="check"||d.kind==="radio"){let g=d.kind==="radio"?!0:p===!0||p==="true";u.checked!==g&&await this.pointer.click(u)}else await this.pointer.moveTo(u),Hr(u,d.kind==="number"?String(p):p);else Hr(u,String(p))}if(!o.checkValidity()){let d=[...o.elements].filter(p=>p.willValidate&&!p.validity.valid);return h&&o.reportValidity(),{ok:!1,error:`El formulario no es v\xE1lido: ${d.map(p=>`${p.name||p.id}: ${p.validationMessage}`).join("; ")}`}}let f=o.querySelector("[type=submit], button:not([type])");this.pointer&&h&&f&&ys(f)&&await this.pointer.moveTo(f);let c=nl(o);return o.requestSubmit?o.requestSubmit(f||void 0):o.submit(),h||l?.toast?.({message:this.t("widget.pageTools.done",{title:o.dataset.otsTitle||t.replace(/_/g," ")}),type:"success"}),{ok:!0,data:await c??"Enviado."}}}}_buttonTool(t,o){return{name:t,category:"page",title:o.dataset.otsTitle||t,description:`[p\xE1gina] ${o.dataset.otsDescription||o.getAttribute("aria-label")||o.textContent.trim().slice(0,80)||t}`,parameters:{type:"object",properties:{}},requiresAuth:o.hasAttribute("data-ots-auth"),confirm:il(o,this.t),handler:async()=>{if(!o.isConnected)return{ok:!1,error:"El bot\xF3n ya no est\xE1 en la p\xE1gina."};let a=nl(o);return this.pointer&&ys(o)?await this.pointer.click(o):o.click(),{ok:!0,data:await a??"Hecho."}}}}};function Ad(e){let t=new Map;for(let a of e.elements)!a.name||a.disabled||a.matches(dl)||a.closest("[data-ots-ignore]")||/^(hidden|submit|button|reset|file|image)$/.test(a.type)||(t.has(a.name)||t.set(a.name,[]),t.get(a.name).push(a));let o=[];for(let[a,s]of t){let r=s[0],i=r.dataset.otsDescription||cl(r)||r.placeholder||a,n,l="text",h=()=>r;r.type==="radio"?(l="radio",n={type:"string",enum:s.map(c=>c.value),description:`${cl(r.closest("fieldset")?.querySelector("legend"))||i}`},h=c=>s.find(d=>d.value===c)||null):r.type==="checkbox"?(l="check",n={type:"boolean",description:i}):r.tagName==="SELECT"?(l="select",n={type:"string",enum:[...r.options].filter(f=>!f.disabled&&f.value!=="").map(f=>f.value),description:i}):r.type==="number"||r.type==="range"?(l="number",n={type:"number",description:[i,r.min&&`m\xEDn. ${r.min}`,r.max&&`m\xE1x. ${r.max}`].filter(Boolean).join(", ")}):n={type:"string",description:i+(r.type&&r.type!=="text"&&r.tagName==="INPUT"?` (${r.type})`:"")},o.push({name:a,schema:n,kind:l,pick:h,required:s.some(f=>f.required)})}return o}function il(e,t=pe()){let o=e.dataset.otsConfirm;if(o==="false")return!1;let a=e.dataset.otsTitle||e.dataset.otsTool.replace(/_/g," ");return s=>{if(o&&o!=="true")return o.replace(/\{(\w+)\}/g,(i,n)=>String(s?.[n]??""));let r=Object.entries(s||{}).map(([i,n])=>`${i}: **${n}**`).join(", ");return r?t("widget.confirm.pageToolWith",{title:a,detail:r}):t("widget.confirm.pageTool",{title:a})}}function nl(e){let t=e.closest("form, [role=dialog], section, main")||document.body,o=ll(t);return new Promise(a=>{let s=n=>{clearTimeout(i),e.removeEventListener("ots-result",r),a(n)},r=n=>s(n.detail??"Hecho."),i=setTimeout(()=>{let n=ll(t.isConnected?t:document.body);s(n&&n!==o?n:null)},Rd);e.addEventListener("ots-result",r)})}function ll(e){return[...e.querySelectorAll("[role=status], [role=alert], [aria-live]")].map(t=>t.innerText?.trim()).filter(Boolean).join(" \xB7 ").slice(0,500)}function cl(e){if(!e)return"";let t=e.labels?.[0]||(e.tagName==="LEGEND"?e:null);return(t?[...t.childNodes].filter(a=>a.nodeType===3).map(a=>a.textContent).join(" "):e.getAttribute?.("aria-label")||"").replace(/\s+/g," ").trim().slice(0,80)}function ys(e){if(!e.isConnected||e.closest("[hidden], [inert]"))return!1;let t=e.getBoundingClientRect();return t.width>0&&t.height>0}var Or=class{constructor({endpoint:t,siteKey:o=null,timeoutMs:a=6e4,locale:s=null}={}){if(!t)throw new Error("[7ots] llm.endpoint es obligatorio");this.endpoint=t.replace(/\/$/,""),this.siteKey=o,this.timeoutMs=a,this.locale=s,this.session=Ld()}async step({system:t,messages:o,tools:a,signal:s}){let r=new AbortController,i=setTimeout(()=>r.abort(),this.timeoutMs);s?.addEventListener("abort",()=>r.abort(),{once:!0});try{let n=await fetch(`${this.endpoint}/chat`,{method:"POST",headers:{"Content-Type":"application/json",...this.siteKey?{"X-Site-Key":this.siteKey}:{},...Lo(this.locale)},body:JSON.stringify({system:t,messages:o,tools:a,session:this.session}),signal:r.signal});if(!n.ok){let l=await n.text().catch(()=>"");throw new Error(`LLM proxy ${n.status}: ${l.slice(0,200)}`)}return await n.json()}finally{clearTimeout(i)}}};function Lo(e){let t=typeof e=="function"?e():e;return t?{"Accept-Language":String(t)}:{}}function Ld(){let e=rr("llm"),t=e.get("session");if(!t){let o=new Uint8Array(12);globalThis.crypto?.getRandomValues?.(o),t=[...o].map(a=>(a||Math.floor(Math.random()*256)).toString(16).padStart(2,"0")).join(""),e.set("session",t)}return t}mo();var Au="0.170.0",Lu=`https://cdn.jsdelivr.net/npm/three@${Au}`,oi=()=>String(globalThis.OTS_THREE_BASE||Lu).replace(/\/$/,"");function Hu(){return{imports:{three:`${oi()}/build/three.module.js`,"three/addons/":`${oi()}/examples/jsm/`}}}function En(){if(typeof document>"u")return!1;for(let t of document.querySelectorAll('script[type="importmap"]'))try{if(JSON.parse(t.textContent||"{}").imports?.three)return!0}catch{}let e=document.createElement("script");return e.type="importmap",e.textContent=JSON.stringify(Hu()),(document.head||document.documentElement).prepend(e),!0}var ti=null;function Pu(){return ti??=(async()=>{if(globalThis.__OTS_THREE__?.three)return globalThis.__OTS_THREE__;let e=i=>`${oi()}/${i}/+esm`,[t,o,a,s,r]=await Promise.all([import(`${oi()}/+esm`),import(e("examples/jsm/utils/BufferGeometryUtils.js")),import(e("examples/jsm/environments/RoomEnvironment.js")),import(e("examples/jsm/loaders/GLTFLoader.js")),import(e("examples/jsm/geometries/RoundedBoxGeometry.js"))]);return globalThis.__OTS_THREE__={three:t,BufferGeometryUtils:o,RoomEnvironment:a,GLTFLoader:s,RoundedBoxGeometry:r}})(),ti.catch(()=>{ti=null}),ti}async function ia(){return En(),await Pu(),Promise.resolve().then(()=>(h0(),d0))}var zu="https://cdn.jsdelivr.net/gh/met4citizen/TalkingHead@1.7.0/modules/talkinghead.mjs",ju="https://cdn.jsdelivr.net/gh/met4citizen/TalkingHead@1.7.0/avatars/brunette.glb",_n=["neutral","happy","angry","sad","fear","disgust","love","sleep"],Tn=["handup","index","ok","thumbup","thumbdown","side","shrug","namaste"],Sn=[..._n,"surprised"],Cn=[...new Set([...Tn,...Fr,...Object.keys(za)])],p0={wave:"handup",hi:"handup",hello:"handup",celebrate:"thumbup",thumbsup:"thumbup",thumbsdown:"thumbdown",point:"index",nod:"ok",yes:"ok",shrug:"shrug",bow:"namaste",wiggle:"side",think:"index",clap:"thumbup",cheer:"thumbup"},Ou={es:"fi",it:"fi",pt:"fi",ca:"fi",en:"en",de:"de",fr:"fr",fi:"fi",lt:"lt"},Qa=class{constructor({container:t,config:o={},language:a=document.documentElement.lang||"es"}){this.container=t,this.cfg=o===!1?!1:{url:ju,body:"F",mood:"neutral",cameraView:"upper",module:zu,...o},this.lang=this.cfg&&this.cfg.lipsyncLang||Ou[a.slice(0,2).toLowerCase()]||"en",this.head=null,this.mode="none",this._ctx=null,this._src=null,this._mimicTimer=null,this._speakTimer=null,this._resolveSpeak=null}async load(t){if(this.cfg&&this.cfg.mode==="3d-plush"&&this.cfg.character&&!this.cfg.image)return this._loadPlush();if(this.cfg===!1||this.cfg.mode==="2d"||this.cfg.mode==="3d-plush"||this.cfg.character&&!this.cfg.url&&this.cfg.mode!=="3d")return this._load2D();if(!u0())return console.info("[7ots] el navegador no tiene WebGL: avatar 2D"),this._load2D();try{En();let{TalkingHead:o}=await import(this.cfg.module);this.head=new o(this.container,{ttsEndpoint:"",lipsyncModules:[this.lang],lipsyncLang:this.lang,cameraView:this.cfg.cameraView,avatarMood:this.cfg.mood,modelFPS:30}),await this.head.showAvatar({url:this.cfg.url,body:this.cfg.body,avatarMood:this.cfg.mood,lipsyncLang:this.lang},a=>t?.(a.lengthComputable?a.loaded/a.total:null)),this.mode="3d",this._vis=()=>document.hidden?this.head?.stop():this.head?.start(),document.addEventListener("visibilitychange",this._vis)}catch(o){console.warn("[7ots] avatar 3D no disponible, uso 2D:",o?.message||o);try{this.head?.dispose?.()}catch{}this.head=null,this.container.replaceChildren(),this._load2D()}return this.mode}async _loadPlush(){let t=this._plushToken={};if(!u0())return this._load2D();try{let o=await ia();if(this._plushToken!==t||!this.cfg)return this.mode;this._ch?.destroy(),this.container.replaceChildren(),this._mouth=null,this._face=null;let a=o.createCharacter3D(this.container,this.cfg.character,{material:this.cfg.material||"plush",orbit:this.cfg.orbit===!0,quality:this.cfg.quality||"high",stage:{key:"overlay",zIndex:2147483001,maxDpr:1.5}});this._ch=a,this.mode=a.fallback?"2d":"3d-plush",this.cfg.mood&&a.mood(this.cfg.mood,{fx:!1})}catch(o){console.warn("[7ots] ot 3D no disponible, uso 2D:",o?.message||o),this._ch?.destroy?.(),this._ch=null,this.container.replaceChildren(),this._load2D()}return this.mode}_load2D(){this.mode="2d",this._ch?.destroy(),this._ch=null;let t=this.cfg&&this.cfg.character;if(t&&!this.cfg.image)return this.container.replaceChildren(),this._mouth=null,this._face=null,this._ch=Ut(this.container,t,{title:""}),this.cfg.mood&&this._ch.mood(this.cfg.mood),this.mode;let o=this.cfg&&this.cfg.image;if(o){this.container.innerHTML='<div class="ots-portrait"><img alt="" referrerpolicy="no-referrer"></div>';let a=this.container.querySelector("img");return a.onerror=()=>this._drawFace(),a.src=o,this._mouth=null,this._face=this.container.querySelector(".ots-portrait"),this.mode}return this._drawFace()}_drawFace(){this.mode="2d";let t=this.cfg&&this.cfg.face||{},o=[t.skin&&`--face-bg:${t.skin}`,t.eyes&&`--face-fg:${t.eyes}`].filter(Boolean).join(";");return this.container.innerHTML=`
|
|
544
|
+
`):a==="INPUT"&&e.form&&!/^(checkbox|radio|button|submit|reset)$/.test(e.type)?e.form.requestSubmit?e.form.requestSubmit():e.form.submit():e.matches("a[href], button, summary, [role=button], [role=link], [role=tab], [role=menuitem], input[type=submit], input[type=button]")?e.click():void 0;case" ":return s?$s(e," "):e.matches("button, summary, [role=button], [role=checkbox], [role=switch], [role=tab], input[type=checkbox], input[type=radio]")?e.click():window.scrollBy({top:window.innerHeight*.8});case"Tab":{let r=Md(),i=r.indexOf(e);return r[(i+(o.shiftKey?-1:1)+r.length)%r.length]?.focus()}case"Backspace":return s?document.execCommand("delete")||ol(e,-1):void 0;case"Delete":return s?document.execCommand("forwardDelete")||ol(e,1):void 0;case"ArrowUp":case"ArrowDown":{let r=t==="ArrowDown"?1:-1;if(a==="SELECT"){let i=zi(e.selectedIndex+r,0,e.options.length-1);i!==e.selectedIndex&&(e.selectedIndex=i,e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0})));return}return a==="INPUT"&&(e.type==="number"||e.type==="range")?al(e,r):s?void 0:window.scrollBy({top:r*60})}case"ArrowLeft":case"ArrowRight":return a==="INPUT"&&e.type==="range"?al(e,t==="ArrowRight"?1:-1):void 0;case"PageDown":case"PageUp":s||window.scrollBy({top:(t==="PageDown"?1:-1)*window.innerHeight*.85});return;case"Home":case"End":s||window.scrollTo({top:t==="Home"?0:document.documentElement.scrollHeight});return;default:t.length===1&&s&&$s(e,t)}}function ol(e,t){if(e.value==null)return;let o=e.selectionStart??e.value.length,a=e.selectionEnd??o;o===a&&(t<0?o=Math.max(0,o-1):a=Math.min(e.value.length,a+1)),gs(e,e.value.slice(0,o)+e.value.slice(a)),e.setSelectionRange?.(o,o),e.dispatchEvent(new InputEvent("input",{bubbles:!0,inputType:t<0?"deleteContentBackward":"deleteContentForward"}))}function al(e,t){try{t>0?e.stepUp():e.stepDown()}catch{return}e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0}))}Qe();var dl="input[type=password], [autocomplete^=cc-], [autocomplete=one-time-code], [data-ots-private], [data-ots-private] *",Rd=1500,jr=class{constructor({actions:t,context:o,bus:a,pointer:s=null,t:r=pe()}){this.t=r,this.actions=t,this.context=o,this.bus=a,this.pointer=s,this._tools=new Map,this._offs=[],this._timer=null}start(){let t=()=>{clearTimeout(this._timer),this._timer=setTimeout(()=>this.scan(),250)};this._offs.push(this.bus.on("context:mutation",t),this.bus.on("context:route",t)),this.scan()}stop(){clearTimeout(this._timer),this._offs.forEach(t=>t?.()),this._offs=[];for(let t of this._tools.keys())this.actions.unregister(t);this._tools.clear()}scan(){let t=new Map;for(let o of document.querySelectorAll("[data-ots-tool]")){if(o.closest("[data-ots-ignore], [data-ots-root]"))continue;let a=String(o.dataset.otsTool).trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"_").slice(0,64);if(!(!a||t.has(a))){if(this.actions.has(a)&&!this._tools.has(a)){console.warn(`[7ots] data-ots-tool="${a}" choca con una acci\xF3n existente; se ignora.`);continue}t.set(a,o)}}for(let[o,a]of this._tools)t.get(o)!==a&&(this.actions.unregister(o),this._tools.delete(o));for(let[o,a]of t)this._tools.get(o)!==a&&(this.actions.register(a.tagName==="FORM"?this._formTool(o,a):this._buttonTool(o,a)),this._tools.set(o,a))}list(){return[...this._tools.keys()]}_formTool(t,o){let a=Ad(o),s={},r=[];for(let n of a)s[n.name]=n.schema,n.required&&r.push(n.name);let i=[...o.querySelectorAll(dl)].some(n=>n.required);return{name:t,category:"page",title:o.dataset.otsTitle||t,description:`[p\xE1gina] ${o.dataset.otsDescription||o.getAttribute("aria-label")||o.querySelector("legend, h2, h3")?.textContent?.trim()||t}`+(i?" (tiene campos privados que el usuario debe escribir antes)":""),parameters:{type:"object",properties:s,required:r},requiresAuth:o.hasAttribute("data-ots-auth"),confirm:il(o,this.t),timeoutMs:6e4,handler:async(n,{ui:l})=>{if(!o.isConnected)return{ok:!1,error:"El formulario ya no est\xE1 en la p\xE1gina."};let h=ys(o);for(let d of a){if(!(d.name in n))continue;let p=n[d.name],u=d.pick(p);if(!u)return{ok:!1,error:`Valor no v\xE1lido para ${d.name}: ${p}`};if(this.pointer&&h&&ys(u))if(d.kind==="text")await this.pointer.type(u,String(p),{clear:!0}),u.dispatchEvent(new Event("change",{bubbles:!0}));else if(d.kind==="check"||d.kind==="radio"){let g=d.kind==="radio"?!0:p===!0||p==="true";u.checked!==g&&await this.pointer.click(u)}else await this.pointer.moveTo(u),Hr(u,d.kind==="number"?String(p):p);else Hr(u,String(p))}if(!o.checkValidity()){let d=[...o.elements].filter(p=>p.willValidate&&!p.validity.valid);return h&&o.reportValidity(),{ok:!1,error:`El formulario no es v\xE1lido: ${d.map(p=>`${p.name||p.id}: ${p.validationMessage}`).join("; ")}`}}let f=o.querySelector("[type=submit], button:not([type])");this.pointer&&h&&f&&ys(f)&&await this.pointer.moveTo(f);let c=nl(o);return o.requestSubmit?o.requestSubmit(f||void 0):o.submit(),h||l?.toast?.({message:this.t("widget.pageTools.done",{title:o.dataset.otsTitle||t.replace(/_/g," ")}),type:"success"}),{ok:!0,data:await c??"Enviado."}}}}_buttonTool(t,o){return{name:t,category:"page",title:o.dataset.otsTitle||t,description:`[p\xE1gina] ${o.dataset.otsDescription||o.getAttribute("aria-label")||o.textContent.trim().slice(0,80)||t}`,parameters:{type:"object",properties:{}},requiresAuth:o.hasAttribute("data-ots-auth"),confirm:il(o,this.t),handler:async()=>{if(!o.isConnected)return{ok:!1,error:"El bot\xF3n ya no est\xE1 en la p\xE1gina."};let a=nl(o);return this.pointer&&ys(o)?await this.pointer.click(o):o.click(),{ok:!0,data:await a??"Hecho."}}}}};function Ad(e){let t=new Map;for(let a of e.elements)!a.name||a.disabled||a.matches(dl)||a.closest("[data-ots-ignore]")||/^(hidden|submit|button|reset|file|image)$/.test(a.type)||(t.has(a.name)||t.set(a.name,[]),t.get(a.name).push(a));let o=[];for(let[a,s]of t){let r=s[0],i=r.dataset.otsDescription||cl(r)||r.placeholder||a,n,l="text",h=()=>r;r.type==="radio"?(l="radio",n={type:"string",enum:s.map(c=>c.value),description:`${cl(r.closest("fieldset")?.querySelector("legend"))||i}`},h=c=>s.find(d=>d.value===c)||null):r.type==="checkbox"?(l="check",n={type:"boolean",description:i}):r.tagName==="SELECT"?(l="select",n={type:"string",enum:[...r.options].filter(f=>!f.disabled&&f.value!=="").map(f=>f.value),description:i}):r.type==="number"||r.type==="range"?(l="number",n={type:"number",description:[i,r.min&&`m\xEDn. ${r.min}`,r.max&&`m\xE1x. ${r.max}`].filter(Boolean).join(", ")}):n={type:"string",description:i+(r.type&&r.type!=="text"&&r.tagName==="INPUT"?` (${r.type})`:"")},o.push({name:a,schema:n,kind:l,pick:h,required:s.some(f=>f.required)})}return o}function il(e,t=pe()){let o=e.dataset.otsConfirm;if(o==="false")return!1;let a=e.dataset.otsTitle||e.dataset.otsTool.replace(/_/g," ");return s=>{if(o&&o!=="true")return o.replace(/\{(\w+)\}/g,(i,n)=>String(s?.[n]??""));let r=Object.entries(s||{}).map(([i,n])=>`${i}: **${n}**`).join(", ");return r?t("widget.confirm.pageToolWith",{title:a,detail:r}):t("widget.confirm.pageTool",{title:a})}}function nl(e){let t=e.closest("form, [role=dialog], section, main")||document.body,o=ll(t);return new Promise(a=>{let s=n=>{clearTimeout(i),e.removeEventListener("ots-result",r),a(n)},r=n=>s(n.detail??"Hecho."),i=setTimeout(()=>{let n=ll(t.isConnected?t:document.body);s(n&&n!==o?n:null)},Rd);e.addEventListener("ots-result",r)})}function ll(e){return[...e.querySelectorAll("[role=status], [role=alert], [aria-live]")].map(t=>t.innerText?.trim()).filter(Boolean).join(" \xB7 ").slice(0,500)}function cl(e){if(!e)return"";let t=e.labels?.[0]||(e.tagName==="LEGEND"?e:null);return(t?[...t.childNodes].filter(a=>a.nodeType===3).map(a=>a.textContent).join(" "):e.getAttribute?.("aria-label")||"").replace(/\s+/g," ").trim().slice(0,80)}function ys(e){if(!e.isConnected||e.closest("[hidden], [inert]"))return!1;let t=e.getBoundingClientRect();return t.width>0&&t.height>0}var Or=class{constructor({endpoint:t,siteKey:o=null,timeoutMs:a=6e4,locale:s=null}={}){if(!t)throw new Error("[7ots] llm.endpoint es obligatorio");this.endpoint=t.replace(/\/$/,""),this.siteKey=o,this.timeoutMs=a,this.locale=s,this.session=Ld()}async step({system:t,messages:o,tools:a,signal:s}){let r=new AbortController,i=setTimeout(()=>r.abort(),this.timeoutMs);s?.addEventListener("abort",()=>r.abort(),{once:!0});try{let n=await fetch(`${this.endpoint}/chat`,{method:"POST",headers:{"Content-Type":"application/json",...this.siteKey?{"X-Site-Key":this.siteKey}:{},...Lo(this.locale)},body:JSON.stringify({system:t,messages:o,tools:a,session:this.session}),signal:r.signal});if(!n.ok){let l=await n.text().catch(()=>"");throw new Error(`LLM proxy ${n.status}: ${l.slice(0,200)}`)}return await n.json()}finally{clearTimeout(i)}}};function Lo(e){let t=typeof e=="function"?e():e;return t?{"Accept-Language":String(t)}:{}}function Ld(){let e=rr("llm"),t=e.get("session");if(!t){let o=new Uint8Array(12);globalThis.crypto?.getRandomValues?.(o),t=[...o].map(a=>(a||Math.floor(Math.random()*256)).toString(16).padStart(2,"0")).join(""),e.set("session",t)}return t}mo();var Au="0.170.0",Lu=`https://cdn.jsdelivr.net/npm/three@${Au}`,oi=()=>String(globalThis.OTS_THREE_BASE||Lu).replace(/\/$/,"");function Hu(){return{imports:{three:`${oi()}/build/three.module.js`,"three/addons/":`${oi()}/examples/jsm/`}}}function En(){if(typeof document>"u")return!1;for(let t of document.querySelectorAll('script[type="importmap"]'))try{if(JSON.parse(t.textContent||"{}").imports?.three)return!0}catch{}let e=document.createElement("script");return e.type="importmap",e.textContent=JSON.stringify(Hu()),(document.head||document.documentElement).prepend(e),!0}var ti=null;function Pu(){return ti??=(async()=>{if(globalThis.__OTS_THREE__?.three)return globalThis.__OTS_THREE__;let e=i=>`${oi()}/${i}/+esm`,[t,o,a,s,r]=await Promise.all([import(`${oi()}/+esm`),import(e("examples/jsm/utils/BufferGeometryUtils.js")),import(e("examples/jsm/environments/RoomEnvironment.js")),import(e("examples/jsm/loaders/GLTFLoader.js")),import(e("examples/jsm/geometries/RoundedBoxGeometry.js"))]);return globalThis.__OTS_THREE__={three:t,BufferGeometryUtils:o,RoomEnvironment:a,GLTFLoader:s,RoundedBoxGeometry:r}})(),ti.catch(()=>{ti=null}),ti}async function ia(){return En(),await Pu(),Promise.resolve().then(()=>(h0(),d0))}var zu="https://cdn.jsdelivr.net/gh/met4citizen/TalkingHead@1.7.0/modules/talkinghead.mjs",ju="https://cdn.jsdelivr.net/gh/met4citizen/TalkingHead@1.7.0/avatars/brunette.glb",_n=["neutral","happy","angry","sad","fear","disgust","love","sleep"],Tn=["handup","index","ok","thumbup","thumbdown","side","shrug","namaste"],Sn=[..._n,"surprised"],Cn=[...new Set([...Tn,...Fr,...Object.keys(za)])],p0={wave:"handup",hi:"handup",hello:"handup",celebrate:"thumbup",thumbsup:"thumbup",thumbsdown:"thumbdown",point:"index",nod:"ok",yes:"ok",shrug:"shrug",bow:"namaste",wiggle:"side",think:"index",clap:"thumbup",cheer:"thumbup"},Ou={es:"fi",it:"fi",pt:"fi",ca:"fi",en:"en",de:"de",fr:"fr",fi:"fi",lt:"lt"},Qa=class{constructor({container:t,config:o={},language:a=document.documentElement.lang||"es"}){this.container=t,this.cfg=o===!1?!1:{url:ju,body:"F",mood:"neutral",cameraView:"upper",module:zu,...o},this.lang=this.cfg&&this.cfg.lipsyncLang||Ou[a.slice(0,2).toLowerCase()]||"en",this.head=null,this.mode="none",this._ctx=null,this._src=null,this._mimicTimer=null,this._speakTimer=null,this._resolveSpeak=null}async load(t){if(this.cfg&&this.cfg.mode==="3d-plush"&&this.cfg.character&&!this.cfg.image)return this._loadPlush();if(this.cfg===!1||this.cfg.mode==="2d"||this.cfg.mode==="3d-plush"||this.cfg.character&&!this.cfg.url&&this.cfg.mode!=="3d")return this._load2D();if(!u0())return console.info("[7ots] el navegador no tiene WebGL: avatar 2D"),this._load2D();try{En();let{TalkingHead:o}=await import(this.cfg.module);this.head=new o(this.container,{ttsEndpoint:"",lipsyncModules:[this.lang],lipsyncLang:this.lang,cameraView:this.cfg.cameraView,avatarMood:this.cfg.mood,modelFPS:30}),await this.head.showAvatar({url:this.cfg.url,body:this.cfg.body,avatarMood:this.cfg.mood,lipsyncLang:this.lang},a=>t?.(a.lengthComputable?a.loaded/a.total:null)),this.mode="3d",this._vis=()=>document.hidden?this.head?.stop():this.head?.start(),document.addEventListener("visibilitychange",this._vis)}catch(o){console.warn("[7ots] avatar 3D no disponible, uso 2D:",o?.message||o);try{this.head?.dispose?.()}catch{}this.head=null,this.container.replaceChildren(),this._load2D()}return this.mode}async _loadPlush(){let t=this._plushToken={};if(!u0())return this._load2D();try{let o=await ia();if(this._plushToken!==t||!this.cfg)return this.mode;this._ch?.destroy(),this.container.replaceChildren(),this._mouth=null,this._face=null;let a=o.createCharacter3D(this.container,this.cfg.character,{material:this.cfg.material||"plush",orbit:this.cfg.orbit===!0,quality:this.cfg.quality||"high",stage:{key:"overlay",zIndex:2147483001,maxDpr:2}});this._ch=a,this.mode=a.fallback?"2d":"3d-plush",this.cfg.mood&&a.mood(this.cfg.mood,{fx:!1})}catch(o){console.warn("[7ots] ot 3D no disponible, uso 2D:",o?.message||o),this._ch?.destroy?.(),this._ch=null,this.container.replaceChildren(),this._load2D()}return this.mode}_load2D(){this.mode="2d",this._ch?.destroy(),this._ch=null;let t=this.cfg&&this.cfg.character;if(t&&!this.cfg.image)return this.container.replaceChildren(),this._mouth=null,this._face=null,this._ch=Ut(this.container,t,{title:""}),this.cfg.mood&&this._ch.mood(this.cfg.mood),this.mode;let o=this.cfg&&this.cfg.image;if(o){this.container.innerHTML='<div class="ots-portrait"><img alt="" referrerpolicy="no-referrer"></div>';let a=this.container.querySelector("img");return a.onerror=()=>this._drawFace(),a.src=o,this._mouth=null,this._face=this.container.querySelector(".ots-portrait"),this.mode}return this._drawFace()}_drawFace(){this.mode="2d";let t=this.cfg&&this.cfg.face||{},o=[t.skin&&`--face-bg:${t.skin}`,t.eyes&&`--face-fg:${t.eyes}`].filter(Boolean).join(";");return this.container.innerHTML=`
|
|
545
545
|
<svg class="ots-face" viewBox="0 0 120 120" aria-hidden="true"${o?` style="${o}"`:""}>
|
|
546
546
|
<circle cx="60" cy="60" r="54" class="ots-face-bg"/>
|
|
547
547
|
<g class="ots-eyes"><ellipse cx="42" cy="50" rx="6" ry="8"/><ellipse cx="78" cy="50" rx="6" ry="8"/></g>
|
|
@@ -755,7 +755,8 @@ ${sd(this.brain?.persona?.locale||this.brain?.persona?.language)}`;await this.br
|
|
|
755
755
|
@media (max-width: 480px) {
|
|
756
756
|
:host { ${t}: 12px; bottom: 12px; }
|
|
757
757
|
.panel { position: fixed; inset: 0; width: 100vw; height: 100dvh; border-radius: 0; bottom: 0; }
|
|
758
|
-
}`}customElements.get("ots-agent")||customElements.define("ots-agent",li);
|
|
758
|
+
}`}customElements.get("ots-agent")||customElements.define("ots-agent",li);function lp(e){return String(e??"").replace(/```[\s\S]*?```/g," ").replace(/^\s{0,3}(?:[-*_]\s*){3,}$/gm," ").replace(/^\s{0,3}#{1,6}\s+/gm,"").replace(/^\s{0,3}>\s?/gm,"").replace(/^\s*(?:[-*+]|\d+[.)])\s+/gm,"").replace(/!?\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/`([^`]*)`/g,"$1").replace(/(\*\*|__)(.+?)\1/g,"$2").replace(/(^|[\s(])[*_]([^*_\n]+)[*_](?=[\s).,;:!?]|$)/g,"$1$2").replace(/\|/g,", ").replace(/[ \t]*\n\s*/g,`
|
|
759
|
+
`).replace(/^\n+|\n+$/g,"").replace(/([^.!?:;,…\n])\n+/g,"$1. ").replace(/\n+/g," ").replace(/[ \t]{2,}/g," ").trim()}mo();var cp=["b","d","f","g","k","l","m","n","p","r","s","t","v","z","ch","br","tr","gl","pl","qu"],dp=["a","e","i","o","u","a","o","i"],hp=["","","","n","l","s","r","x","k","m"],x0={es:{roles:["asistente de la casa","gu\xEDa curioso","compa\xF1ero de c\xF3digo","anfitri\xF3n digital","ayudante incansable","explorador de p\xE1ginas","mascota con opiniones","vig\xEDa de la terminal"],tones:["cercano y juguet\xF3n","tranquilo y claro","entusiasta y directo","ir\xF3nico pero amable","tierno y curioso","serio con chispa"],traits:["curioso","paciente","bromista","ordenado","dram\xE1tico","optimista","despistado","leal","mand\xF3n","dormil\xF3n","glot\xF3n","valiente"],tagline:e=>`Hola, soy ${e}.`},en:{roles:["house assistant","curious guide","coding buddy","digital host","tireless helper","page explorer","opinionated pet","terminal lookout"],tones:["warm and playful","calm and clear","eager and direct","wry but kind","sweet and curious","serious with a spark"],traits:["curious","patient","cheeky","tidy","dramatic","optimistic","scatterbrained","loyal","bossy","sleepy","hungry","brave"],tagline:e=>`Hi, I'm ${e}.`},pt:{roles:["assistente da casa","guia curioso","parceiro de c\xF3digo","anfitri\xE3o digital","ajudante incans\xE1vel","explorador de p\xE1ginas","mascote com opini\xF5es","vigia do terminal"],tones:["pr\xF3ximo e brincalh\xE3o","calmo e claro","entusiasmado e direto","ir\xF4nico mas gentil","fofo e curioso","s\xE9rio com fa\xEDsca"],traits:["curioso","paciente","brincalh\xE3o","organizado","dram\xE1tico","otimista","distra\xEDdo","leal","mand\xE3o","dorminhoco","guloso","corajoso"],tagline:e=>`Oi, eu sou ${e}.`},zh:{roles:["\u5BB6\u5EAD\u52A9\u624B","\u597D\u5947\u7684\u5411\u5BFC","\u7F16\u7A0B\u4F19\u4F34","\u6570\u5B57\u4E3B\u6301\u4EBA","\u4E0D\u77E5\u75B2\u5026\u7684\u5E2E\u624B","\u7F51\u9875\u63A2\u9669\u5BB6","\u6709\u4E3B\u89C1\u7684\u5BA0\u7269","\u7EC8\u7AEF\u77AD\u671B\u5458"],tones:["\u4EB2\u5207\u53C8\u4FCF\u76AE","\u6C89\u7A33\u800C\u6E05\u6670","\u70ED\u60C5\u53C8\u76F4\u63A5","\u7231\u8C03\u4F83\u4F46\u53CB\u5584","\u53EF\u7231\u53C8\u597D\u5947","\u8BA4\u771F\u4E2D\u5E26\u70B9\u706B\u82B1"],traits:["\u597D\u5947","\u8010\u5FC3","\u7231\u5F00\u73A9\u7B11","\u7231\u6574\u6D01","\u620F\u7CBE","\u4E50\u89C2","\u8FF7\u7CCA","\u5FE0\u8BDA","\u7231\u6307\u6325","\u8D2A\u7761","\u8D2A\u5403","\u52C7\u6562"],tagline:e=>`\u4F60\u597D\uFF0C\u6211\u662F${e}\u3002`},hi:{roles:["\u0918\u0930 \u0915\u093E \u0938\u0939\u093E\u092F\u0915","\u091C\u093F\u091C\u094D\u091E\u093E\u0938\u0941 \u0917\u093E\u0907\u0921","\u0915\u094B\u0921\u093F\u0902\u0917 \u0938\u093E\u0925\u0940","\u0921\u093F\u091C\u093F\u091F\u0932 \u092E\u0947\u091C\u093C\u092C\u093E\u0928","\u0905\u0925\u0915 \u092E\u0926\u0926\u0917\u093E\u0930","\u092A\u0947\u091C \u0916\u094B\u091C\u0940","\u0930\u093E\u092F \u0930\u0916\u0928\u0947 \u0935\u093E\u0932\u093E \u092A\u093E\u0932\u0924\u0942","\u091F\u0930\u094D\u092E\u093F\u0928\u0932 \u0915\u093E \u092A\u0939\u0930\u0947\u0926\u093E\u0930"],tones:["\u0905\u092A\u0928\u093E\u092A\u0928 \u092D\u0930\u093E \u0914\u0930 \u091A\u0902\u091A\u0932","\u0936\u093E\u0902\u0924 \u0914\u0930 \u0938\u093E\u092B\u093C","\u0909\u0924\u094D\u0938\u093E\u0939\u0940 \u0914\u0930 \u0938\u0940\u0927\u093E","\u091A\u0941\u091F\u0940\u0932\u093E \u092A\u0930 \u0926\u092F\u093E\u0932\u0941","\u092A\u094D\u092F\u093E\u0930\u093E \u0914\u0930 \u091C\u093F\u091C\u094D\u091E\u093E\u0938\u0941","\u0917\u0902\u092D\u0940\u0930 \u092A\u0930 \u091A\u092E\u0915\u0926\u093E\u0930"],traits:["\u091C\u093F\u091C\u094D\u091E\u093E\u0938\u0941","\u0927\u0948\u0930\u094D\u092F\u0935\u093E\u0928","\u0928\u091F\u0916\u091F","\u0938\u0932\u0940\u0915\u0947\u0926\u093E\u0930","\u0928\u093E\u091F\u0915\u0940\u092F","\u0906\u0936\u093E\u0935\u093E\u0926\u0940","\u092D\u0941\u0932\u0915\u094D\u0915\u0921\u093C","\u0935\u092B\u093C\u093E\u0926\u093E\u0930","\u0939\u0941\u0915\u094D\u092E \u091A\u0932\u093E\u0928\u0947 \u0935\u093E\u0932\u093E","\u0928\u0940\u0902\u0926 \u0915\u093E \u092E\u093E\u0930\u093E","\u092A\u0947\u091F\u0942","\u092C\u0939\u093E\u0926\u0941\u0930"],tagline:e=>`\u0928\u092E\u0938\u094D\u0924\u0947, \u092E\u0948\u0902 ${e} \u0939\u0942\u0901\u0964`}};function k0(){let e="";for(let t=0;t<7;t++)e+=Math.floor(Math.random()*36).toString(36);return e}function fp(e){return ci(e).length!==7}function up(e){return Ma(qn(e),{legacy:fp(e)})}function ci(e){return String(e??"").toLowerCase().replace(/[^a-z0-9-]/g,"").slice(0,32)}function qn(e){let t=2166136261;for(let o of ci(e)||"7ots")t=Math.imul(t^o.charCodeAt(0),16777619)>>>0;return t||1}function v0(e){let t=e>>>0||1,o=()=>(t=Math.imul(t^t>>>15,2246822507)+2654435769>>>0)/2**32;return{rnd:o,pick:a=>a[Math.floor(o()*a.length)]}}function M0(e){let{rnd:t,pick:o}=v0(qn(e)^20973),a=t()<.55?2:t()<.8?1:3,s="";for(let r=0;r<a;r++)s+=o(cp)+o(dp);return s+=o(hp),s.charAt(0).toUpperCase()+s.slice(1)}function pp(e,{lang:t="en",name:o}={}){let a=ci(e)||k0(),s=x0[t]?t:"en",r=x0[s],{rnd:i,pick:n}=v0(qn(a)),l=up(a),h=String(o||"").trim().slice(0,40)||M0(a),f=[];for(;f.length<3;){let d=n(r.traits);f.includes(d)||f.push(d)}let c=i()<.5;return io({id:`${h}-${a}`,name:h,role:n(r.roles),tagline:r.tagline(h),language:s,personality:{tone:n(r.tones),traits:f},look:{kind:"character",character:l,color:l.body.color,accent:l.eyes.iris,meetAvatar:n(ii),meetScene:n(ni)},voice:{provider:"auto",lang:{es:"es-ES",en:"en-US",pt:"pt-BR",zh:"zh-CN",hi:"hi-IN"}[s],rate:Math.round((.95+i()*.2)*100)/100,pitch:Math.round((c?1.05+i()*.3:.8+i()*.25)*100)/100},seed:a})}Qe();async function di(e,t={}){if(!e)throw new Error("createFace necesita un elemento contenedor");let o=t.endpoint?t.endpoint.replace(/\/$/,""):"",a=pe(Dt(t.locale)),s=t.identity??(o?`${o}/identity`:{}),r=io(typeof s=="string"?await E0(s,a):s),i=Za(r),n=document.createElement("div");n.setAttribute("data-ots-root","face"),n.style.cssText=`display:block;position:relative;width:100%;height:${t.size?`${t.size}px`:"100%"};min-height:160px;`,e.appendChild(n);let l=n.attachShadow({mode:"open"});l.innerHTML=`<style>${$p()}</style><div class="wrap"><div class="stage"></div><div class="subs" aria-live="polite" aria-label="${mp(a("identity.face.subtitles"))}"></div></div>`;let h=l.querySelector(".wrap"),f=l.querySelector(".subs"),c=()=>h.style.setProperty("--p",r.look.color);c();let d=new Ra,p=t.avatar===!1?{mode:"2d"}:{...i.avatar,...t.avatar||{}},u=new Qa({container:l.querySelector(".stage"),config:p,language:r.language}),g=t.voice===!1?null:new Va({bus:d,avatar:u,store:rr(`face:${r.id}`),config:{endpoint:o,siteKey:t.siteKey,tts:o?"proxy":"browser",stt:!0,...i.voice,...t.voice||{}}});g?.muted&&g.setMuted(!1);let m=await u.load();h.dataset.mode=m;let w=0;return{get identity(){return r},mode:m,async say(b){await u.unlockAudio(),t.subtitles!==!1&&(clearTimeout(w),f.textContent=String(b||"")),await(g?g.say(b):Promise.resolve()),t.subtitles!==!1&&(w=setTimeout(()=>f.textContent="",1200))},listen:b=>g?.listen(b)??Promise.resolve(""),interrupt:()=>g?.interrupt(),mute:(b=!0)=>g?.setMuted(b),mood:b=>u.setMood(b),gesture:(b,x)=>u.gesture(b,x),morph:(b,x)=>u.morph(b,x),effect:(b,x)=>u.effect(b,x),lookAt:(b,x,E)=>u.lookAt(b,x,E),async setIdentity(b){return r=io(typeof b=="string"?await E0(b,a):b),i=Za(r),c(),g?.configure({...i.voice,...t.voice||{}}),h.dataset.mode=await u.applyLook({...i.avatar,...t.avatar||{}}),r},on:(b,x)=>d.on(b,x),destroy(){g?.interrupt(),u.dispose(),n.remove()}}}async function E0(e,t){let o=await fetch(e,{credentials:"omit"});if(!o.ok)throw new Error(t("identity.face.loadError",{status:o.status}));return o.json()}function mp(e){return String(e).replace(/[&<>"]/g,t=>({"&":"&","<":"<",">":">",'"':"""})[t])}function $p(){return`
|
|
759
760
|
:host { all: initial; display: block; }
|
|
760
761
|
.wrap { --p: #6d5dfc; position: absolute; inset: 0; overflow: hidden; border-radius: inherit;
|
|
761
762
|
background: radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--p) 22%, transparent), transparent 70%); font-family: system-ui, sans-serif; }
|
|
@@ -787,7 +788,7 @@ ${sd(this.brain?.persona?.locale||this.brain?.persona?.language)}`;await this.br
|
|
|
787
788
|
${c.length?`<nav class="acts">${c.join("")}</nav>`:""}
|
|
788
789
|
<p class="note" role="status" aria-live="polite"></p>
|
|
789
790
|
<footer>${at(h("identity.card.footer"))} \xB7 <a href="https://7ots.com" target="_blank" rel="noopener">7ots</a></footer>
|
|
790
|
-
</article>`,this.shadowRoot.querySelectorAll("button.act").forEach(p=>p.addEventListener("click",()=>this._act(p.dataset.act,p))),a&&this._mountFace()}async _mountFace(){let t=this.shadowRoot.querySelector(".pic");try{this._face=await di(t,{identity:this._raw&&!this.hasAttribute("src")?this._raw:this._card,endpoint:this.endpoint,subtitles:!1,locale:this._t.locale})}catch{t.innerHTML=this._card.look.image?`<img src="${at(this._card.look.image)}" alt="">`:`<span>${at(this._card.name.slice(0,1))}</span>`}}async _act(t,o){let a=this._card,s=this._t,r=i=>this.shadowRoot.querySelector(".note").textContent=i;if(t==="chat"){document.querySelector("ots-agent")?.api?.open();return}if(t==="mail"){location.href=`mailto:${a.contact.email}?subject=${encodeURIComponent(s("identity.card.mailSubject",{name:a.name}))}`;return}if(t==="apuchat"){try{await navigator.clipboard.writeText(`@${a.contact.apuchat}`),r(s("identity.card.apuchatCopied",{handle:a.contact.apuchat}))}catch{r(s("identity.card.apuchatSearch",{handle:a.contact.apuchat}))}return}if(t==="listen"){o.disabled=!0;try{await this._face?.say(this.getAttribute("greeting")
|
|
791
|
+
</article>`,this.shadowRoot.querySelectorAll("button.act").forEach(p=>p.addEventListener("click",()=>this._act(p.dataset.act,p))),a&&this._mountFace()}async _mountFace(){let t=this.shadowRoot.querySelector(".pic");try{this._face=await di(t,{identity:this._raw&&!this.hasAttribute("src")?this._raw:this._card,endpoint:this.endpoint,subtitles:!1,locale:this._t.locale})}catch{t.innerHTML=this._card.look.image?`<img src="${at(this._card.look.image)}" alt="">`:`<span>${at(this._card.name.slice(0,1))}</span>`}}async _act(t,o){let a=this._card,s=this._t,r=i=>this.shadowRoot.querySelector(".note").textContent=i;if(t==="chat"){document.querySelector("ots-agent")?.api?.open();return}if(t==="mail"){location.href=`mailto:${a.contact.email}?subject=${encodeURIComponent(s("identity.card.mailSubject",{name:a.name}))}`;return}if(t==="apuchat"){try{await navigator.clipboard.writeText(`@${a.contact.apuchat}`),r(s("identity.card.apuchatCopied",{handle:a.contact.apuchat}))}catch{r(s("identity.card.apuchatSearch",{handle:a.contact.apuchat}))}return}if(t==="listen"){o.disabled=!0;try{await this._face?.say(this.getAttribute("greeting")||gp(a))}finally{o.disabled=!1}return}if(t==="call"){let i=window.open("","_blank");o.disabled=!0,r(s("identity.card.callPreparing",{name:a.name}));try{let n=await fetch(`${this.endpoint}/identity/call`,{method:"POST",headers:{"Content-Type":"application/json"},body:"{}"}),l=await n.json().catch(()=>({}));if(!n.ok||!l.call_url)throw new Error(l.error||`HTTP ${n.status}`);i?(i.opener=null,i.location.href=l.call_url):location.href=l.call_url,r(s("identity.card.callReady",{name:a.name})),this.dispatchEvent(new CustomEvent("ots-identity:call",{detail:{url:l.call_url},bubbles:!0}))}catch(n){i?.close(),r(s("identity.card.callError",{error:n.message}))}finally{o.disabled=!1}}}};function gp(e){let t=pe(e.language||"es");return`${e.role?t("identity.greeting.introRole",{name:e.name,role:e.role}):t("identity.greeting.intro",{name:e.name})} ${e.tagline||t("identity.greeting.offer")}`}function _0(e){let t=io(e||{}),o=e?.contact||{};return{...t,contact:{...t.contact,call:!!o.call,meet:!!o.meet,answers:o.answers||{}}}}function at(e){return String(e??"").replace(/[&<>"']/g,t=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[t])}var xr=e=>`<svg viewBox="0 0 24 24" aria-hidden="true">${e}</svg>`,T0={chat:xr('<path d="M4 5a3 3 0 0 1 3-3h10a3 3 0 0 1 3 3v8a3 3 0 0 1-3 3h-6l-4.5 3.6A.9.9 0 0 1 5 18.9V16a3 3 0 0 1-1-2.2Z"/>'),mail:xr('<path d="M20 4H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2Zm0 4-8 5-8-5V6l8 5 8-5Z"/>'),at:xr('<path d="M12 2a10 10 0 1 0 5 18.7l-1-1.7A8 8 0 1 1 20 12v1a2 2 0 0 1-4 0V8h-2v.8A5 5 0 1 0 15 16a4 4 0 0 0 7-3v-1A10 10 0 0 0 12 2Zm0 13a3 3 0 1 1 3-3 3 3 0 0 1-3 3Z"/>'),video:xr('<path d="M15 8a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h9a2 2 0 0 0 2-2v-2.5l5 3.5V7l-5 3.5Z"/>'),voice:xr('<path d="M4 9v6h4l5 4V5L8 9H4Zm12.5 3a4.5 4.5 0 0 0-2.5-4v8a4.5 4.5 0 0 0 2.5-4Z"/>'),card:xr('<path d="M20 4H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2ZM9 8a2.5 2.5 0 1 1-2.5 2.5A2.5 2.5 0 0 1 9 8Zm5 9H4v-.8C4 14.3 7.3 13.5 9 13.5s5 .8 5 2.7Zm6-3h-4v-2h4Zm0-4h-4V8h4Z"/>')};function Gn(){return`
|
|
791
792
|
:host { all: initial; display: block; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ots-fg, #14141f); }
|
|
792
793
|
* { box-sizing: border-box; }
|
|
793
794
|
.card { --p: #6d5dfc; --a: #22d3ee; max-width: 380px; background: var(--ots-bg, #fff); border: 1px solid var(--ots-line, #e7e7ef); border-radius: 18px;
|
|
@@ -838,7 +839,7 @@ ${sd(this.brain?.persona?.locale||this.brain?.persona?.language)}`;await this.br
|
|
|
838
839
|
.act:hover { background: color-mix(in srgb, var(--p) 14%, #17171f); }
|
|
839
840
|
.tag, .act small, .hours { color: #9d9dad; }
|
|
840
841
|
}
|
|
841
|
-
`}typeof customElements<"u"&&!customElements.get("ots-identity")&&customElements.define("ots-identity",hi);mo();ya();ya();var
|
|
842
|
+
`}typeof customElements<"u"&&!customElements.get("ots-identity")&&customElements.define("ots-identity",hi);mo();ya();ya();var yp=["hype","funk","chip","trap","entrance","phonk","montagem"],Fo=e=>440*2**((e-69)/12),bp=null,wp=e=>{if(e.__noise)return e.__noise;let t=e.createBuffer(1,e.sampleRate,e.sampleRate),o=t.getChannelData(0),a=7;for(let s=0;s<o.length;s++)o[s]=(a=a*16807%2147483647)/2147483647*2-1;return e.__noise=t};function Lt(e,t,o,a,s,r){let i=e.createGain();return i.gain.setValueAtTime(1e-4,o),i.gain.exponentialRampToValueAtTime(Math.max(2e-4,a),o+s),i.gain.exponentialRampToValueAtTime(1e-4,o+s+r),i.connect(t),i}function Zo(e,t,o,a,s,r){let i=e.createOscillator();return i.type=t,i.frequency.setValueAtTime(o,a),i.connect(r),i.start(a),i.stop(a+s+.05),i}function Wa(e,t,o,a){let s=e.createBufferSource();return s.buffer=wp(e),s.loop=!0,s.connect(a),s.start(t,Math.random()*.5),s.stop(t+o+.05),s}function Kt(e,t,o,a,s){let r=e.createBiquadFilter();return r.type=t,r.frequency.value=o,r.Q.value=a,r.connect(s),r}function S0(e,t,o){let a=`__drive${t}`;if(!e[a]){let r=new Float32Array(1024);for(let i=0;i<r.length;i++)r[i]=Math.tanh((i/r.length*2-1)*t);e[a]=r}let s=e.createWaveShaper();return s.curve=e[a],s.connect(o),s}var ye={kick(e,t,o,a=1,s=45){let r=Lt(e,t,o,.9*a,.003,.32);Zo(e,"sine",150,o,.4,r).frequency.exponentialRampToValueAtTime(s,o+.12)},snare(e,t,o,a=1){Wa(e,o,.2,Kt(e,"bandpass",1900,.8,Lt(e,t,o,.5*a,.002,.18))),Zo(e,"triangle",190,o,.1,Lt(e,t,o,.25*a,.002,.08))},clap(e,t,o,a=1){for(let s=0;s<3;s++)Wa(e,o+s*.011,.12,Kt(e,"bandpass",1300,1.2,Lt(e,t,o+s*.011,.35*a,.001,s===2?.16:.02)))},hat(e,t,o,a=1,s=!1){Wa(e,o,s?.25:.05,Kt(e,"highpass",7500,.7,Lt(e,t,o,.16*a,.001,s?.2:.035)))},bass(e,t,o,a,s,r=1,i="sawtooth"){let n=Kt(e,"lowpass",420,6,Lt(e,t,o,.32*r,.005,s));n.frequency.setValueAtTime(1400,o),n.frequency.exponentialRampToValueAtTime(260,o+s),Zo(e,i,Fo(a),o,s,n)},sub(e,t,o,a,s,r=1,i=null){let n=Lt(e,t,o,.55*r,.004,s),l=Zo(e,"sine",Fo(i??a),o,s,n);i!=null&&l.frequency.exponentialRampToValueAtTime(Fo(a),o+.09)},lead(e,t,o,a,s,r=1,i="square"){let n=Lt(e,t,o,.11*r,.004,s);Zo(e,i,Fo(a),o,s,i==="square"?Kt(e,"lowpass",3200,.5,n):n)},chord(e,t,o,a,s,r=1,i="sawtooth"){let n=Kt(e,"lowpass",1500,.8,Lt(e,t,o,.07*r,.02,s));for(let l of a)for(let h of[-7,7])Zo(e,i,Fo(l),o,s,n).detune.value=h},power(e,t,o,a,s,r=1){let i=e.createWaveShaper(),n=new Float32Array(1024);for(let l=0;l<n.length;l++){let h=l/n.length*2-1;n[l]=Math.tanh(h*6)}i.curve=n,i.connect(Kt(e,"lowpass",2600,.7,Lt(e,t,o,.12*r,.004,s)));for(let l of[0,7,12])Zo(e,"sawtooth",Fo(a+l),o,s,i)},crowd(e,t,o,a,s=1){let r=e.createGain();r.gain.setValueAtTime(1e-4,o),r.gain.exponentialRampToValueAtTime(.22*s,o+a*.4),r.gain.exponentialRampToValueAtTime(1e-4,o+a),r.connect(t);let i=Kt(e,"bandpass",700,.6,r);i.frequency.setValueAtTime(500,o),i.frequency.linearRampToValueAtTime(1100,o+a*.5),Wa(e,o,a,i);for(let n=0;n<8;n++){let l=o+Math.random()*a*.8,h=Zo(e,"sawtooth",300+Math.random()*500,l,.35,Kt(e,"bandpass",900,3,Lt(e,t,l,.025*s,.05,.3)));h.frequency.linearRampToValueAtTime(h.frequency.value*1.3,l+.3)}},cowbell(e,t,o,a,s,r=1,i=0){let n=Lt(e,t,o,.16*r,.002,s),l=Kt(e,"bandpass",Fo(a)*1.8,1.4,i?S0(e,i,n):n);for(let h of[1,1.48])Zo(e,"square",Fo(a)*h,o,s,l)},bass808(e,t,o,a,s,r=1,i=null){let n=Lt(e,t,o,.5*r,.004,s),l=Zo(e,"sine",Fo(i??a),o,s,S0(e,3.5,Kt(e,"lowpass",900,.7,n)));i!=null&&l.frequency.exponentialRampToValueAtTime(Fo(a),o+.14)},boom(e,t,o,a=1){ye.kick(e,t,o,1.2*a,30),Wa(e,o,1.4,Kt(e,"lowpass",900,.5,Lt(e,t,o,.5*a,.005,1.3))),Wa(e,o+.05,.6,Kt(e,"highpass",4e3,.5,Lt(e,t,o+.05,.12*a,.01,.5)))}},na=(e,t)=>e[t%e.length]==="x",C0={hype:{chords:[[57,60,64],[53,57,60],[48,52,55],[55,59,62]],step(e,t,o,a,s,r){let i=this.chords[s%4];a%4===0&&ye.kick(e,t,o),(a===4||a===12)&&ye.clap(e,t,o),a%4===2?(ye.hat(e,t,o,1,!0),ye.bass(e,t,o,i[0]-24,r*1.6)):ye.hat(e,t,o,.35),a===0&&ye.chord(e,t,o,i,r*14,.8),s%2===1&&a%2===0&&ye.lead(e,t,o,i[a/2%3]+12+(a>=8?12:0),r*.9,.8)}},funk:{roots:[52,52,57,55],line:[0,null,12,null,0,null,10,7,0,null,12,null,3,5,7,10],step(e,t,o,a,s,r){let i=this.roots[s%4];na("x.....x.x.....x.",a)&&ye.kick(e,t,o),(a===4||a===12)&&ye.snare(e,t,o),a===15&&s%2&&ye.snare(e,t,o,.4),ye.hat(e,t,o,a%2?.25:.55,a===14);let n=this.line[a];n!=null&&ye.bass(e,t,o,i-24+n,r*.9,1.1,"square"),na("..x...x..x..x.x.",a)&&ye.chord(e,t,o,[i+7,i+10,i+14],r*.5,1.4,"square")}},chip:{chords:[[60,64,67],[55,59,62],[57,60,64],[53,57,60]],step(e,t,o,a,s,r){let i=this.chords[s%4];(a%8===0||a===10)&&ye.kick(e,t,o,.8),(a===4||a===12)&&Wa(e,o,.1,Kt(e,"highpass",1500,.5,Lt(e,t,o,.25,.001,.09))),ye.lead(e,t,o,i[a%3]+12+Math.floor(a/4)%2*12,r*.8,.9),a%4===0&&ye.lead(e,t,o,i[0]-12,r*3,2.2,"triangle"),s%4===3&&a>=12&&ye.lead(e,t,o,i[2]+24+(a-12)*2,r*.8,.7)}},trap:{roots:[45,45,41,43],step(e,t,o,a,s,r){let i=this.roots[s%4];if(na("x.......x.x.....",a)&&(ye.kick(e,t,o),ye.sub(e,t,o,i-12,r*(a===0?7:3),1,a===10?i:null)),a===8&&ye.clap(e,t,o,1.1),a>=12&&s%2)for(let n=0;n<3;n++)ye.hat(e,t,o+n*r/3,.4+n*.1);else a%2===0&&ye.hat(e,t,o,.5);a===0&&s%2===0&&ye.chord(e,t,o,[i+12,i+15,i+19],r*30,.7,"triangle")}},phonk:{roots:[49,49,45,47],riff:[[12,null,12,null,15,null,12,null,19,null,17,15,null,12,null,null],[12,null,12,null,15,null,12,null,10,null,12,null,7,null,null,null]],step(e,t,o,a,s,r){let i=this.roots[s%4];if(na("x......xx.x.....",a)&&(ye.kick(e,t,o,1.1,40),ye.bass808(e,t,o,i-24,r*(a===0?6:3),1,a===10?i-19:null)),a===8&&(ye.clap(e,t,o,1.2),ye.snare(e,t,o,.6)),a%4===0)for(let l=0;l<3;l++)ye.hat(e,t,o+l*r*4/3,l===1?.55:.3);let n=this.riff[s%2][a];n!=null&&ye.cowbell(e,t,o,i+n,r*1.6,1),a===0&&s%4===0&&ye.chord(e,t,o,[i+12,i+15,i+19],r*60,.45,"triangle")}},montagem:{roots:[50,50,53,48],riff:[0,null,0,3,null,0,null,7,null,5,3,null,0,null,3,null],step(e,t,o,a,s,r){let i=this.roots[s%4];na("x..x..x...x..x..",a)&&ye.kick(e,t,o,1.15,42),na("x.....x...x.....",a)&&ye.bass808(e,t,o,i-24,r*2.5,.8),(a===4||a===12)&&ye.clap(e,t,o,1.1),na("..x...x...x.x..x",a)&&ye.snare(e,t,o,.35),a%2&&ye.hat(e,t,o,.3);let n=this.riff[a];n!=null&&ye.cowbell(e,t,o,i+24+n,r*1.2,1.1,4)}},entrance:{intro:2.2,start(e,t,o){ye.crowd(e,t,o,4.5),ye.boom(e,t,o+1),ye.boom(e,t,o+1.6,.8),ye.power(e,t,o+1.6,40,.5,1.2)},step(e,t,o,a,s,r){let i=[40,40,43,38][s%4];na("x.....x.x.......",a)&&ye.kick(e,t,o,1.1),(a===4||a===12)&&ye.snare(e,t,o,1.2),a%2===0&&ye.hat(e,t,o,.4,a===14),na("x.x.xx..x.x.x..x",a)&&ye.power(e,t,o,i+(a===15?3:0),r*1.3),a===0&&s%2===0&&ye.crowd(e,t,o,2.5,.35)}}};function xp(e,{ms:t=6e3,volume:o=.5,bpm:a=Cs,ctx:s=null,out:r=null}={}){let i=globalThis.AudioContext||globalThis.webkitAudioContext;if(!i)return null;s||=bp||=new i,s.state==="suspended"&&s.resume().catch(()=>{});let n=C0[e]||C0.hype,l=s.createGain(),h=Math.max(0,Math.min(1,o))*.7;l.gain.value=h;let f=s.createDynamicsCompressor(),c=s.createAnalyser();c.fftSize=256,l.connect(f).connect(c).connect(s.destination),r&&c.connect(r);let d=60/a/4,p=s.currentTime+.05,u=p+t/1e3;n.start&&n.start(s,l,p);let g=p+(n.intro||0),m=0,w=!1,k,b=new Promise(v=>k=v),x=()=>{if(!w){for(;g<Math.min(u-.05,s.currentTime+.15);)n.step(s,l,g,m%16,Math.floor(m/16),d),g+=d,m++;s.currentTime>=u&&T(0)}},E=setInterval(x,25);x();function T(v=.4){if(w)return;w=!0,clearInterval(E);let _=s.currentTime;l.gain.cancelScheduledValues(_),l.gain.setValueAtTime(l.gain.value,_),l.gain.linearRampToValueAtTime(1e-4,_+Math.max(.05,v)),setTimeout(()=>(l.disconnect(),k()),(Math.max(.05,v)+1.5)*1e3)}return l.gain.setValueAtTime(h,Math.max(p,u-.8)),l.gain.linearRampToValueAtTime(1e-4,u),{stop:T,done:b,analyser:c,ctx:s}}mo();Qe();Na();mo();var os=["holo","prism","cosmos","gold","none"],R0={en:{stats:["Energy","Wit","Charm","Chaos"],rar:["Common","Rare","Epic","Legendary"]},es:{stats:["Energ\xEDa","Ingenio","Encanto","Caos"],rar:["Com\xFAn","Rara","\xC9pica","Legendaria"]},pt:{stats:["Energia","Engenho","Charme","Caos"],rar:["Comum","Rara","\xC9pica","Lend\xE1ria"]},zh:{stats:["\u80FD\u91CF","\u673A\u667A","\u9B45\u529B","\u6DF7\u6C8C"],rar:["\u666E\u901A","\u7A00\u6709","\u53F2\u8BD7","\u4F20\u8BF4"]},hi:{stats:["\u090A\u0930\u094D\u091C\u093E","\u091A\u0924\u0941\u0930\u093E\u0908","\u0906\u0915\u0930\u094D\u0937\u0923","\u0909\u0924\u094D\u092A\u093E\u0924"],rar:["\u0938\u093E\u0927\u093E\u0930\u0923","\u0926\u0941\u0930\u094D\u0932\u092D","\u092E\u0939\u093E\u0915\u093E\u0935\u094D\u092F","\u092A\u094C\u0930\u093E\u0923\u093F\u0915"]}},la=e=>String(e??"").replace(/[&<>"']/g,t=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[t]),fi=(e,t)=>/^#[0-9a-f]{6}$/i.test(e||"")?e:t,kp='<svg viewBox="0 0 24 24"><path d="M12 2l2.9 6.9 7.1.6-5.4 4.7 1.7 7-6.3-3.9-6.3 3.9 1.7-7L2 9.5l7.1-.6z"/></svg>';function A0(e,t,o="en"){let a=R0[String(o).slice(0,2)]||R0.en,s=2166136261;for(let h of`${e||t||"ot"}|${t||""}`)s=Math.imul(s^h.charCodeAt(0),16777619);let r=()=>(s=Math.imul(s^s>>>15,2246822507)^Math.imul(s^s>>>13,3266489909),(s>>>0)/4294967296),i=a.stats.map(h=>[h,25+Math.round(r()*74)]),n=r(),l=n>.94?3:n>.75?2:n>.4?1:0;return{stats:i,rarity:l,rarityName:a.rar[l],defaultFoil:["holo","holo","prism","cosmos"][l]}}var vp=`
|
|
842
843
|
:host{display:block;--rx:0deg;--ry:0deg;--mx:50%;--my:50%;--o:.6}
|
|
843
844
|
*{box-sizing:border-box}
|
|
844
845
|
.scene{perspective:1400px;display:grid;place-items:center}
|
|
@@ -896,7 +897,7 @@ footer{margin-top:auto;display:flex;align-items:center;gap:1.5cqw;padding:2cqw 3
|
|
|
896
897
|
.card[data-foil=none] .holo,.card[data-foil=none] .glitter{display:none}
|
|
897
898
|
.glare{mix-blend-mode:overlay;background:radial-gradient(farthest-corner circle at var(--mx) var(--my),rgb(255 255 255/.75) 0%,rgb(255 255 255/.15) 30%,rgb(0 0 0/.35) 90%);opacity:calc(.4 + var(--o)*.5)}
|
|
898
899
|
@media (prefers-reduced-motion:reduce){.rays{animation:none}}
|
|
899
|
-
`;function L0(e,t={}){let o=document.createElement("div");o.className="ots-trading-card",e.appendChild(o);let a=o.attachShadow({mode:"open"}),s={...t},r=null,i=0,n=!1,l=!1,h=()=>a.querySelector(".card");function f(){let g=s.identity||{},m=g.look||{},w=s.character||m.character||{},k=g.name||"ot",b=A0(s.id,k,s.locale),x=os.includes(s.foil)?s.foil:b.defaultFoil,E=fi(w.body?.color,fi(m.color,"#6d5dfc")),T=fi(m.accent,fi(w.cheeks?.color,"#22d3ee")),v=g.bio||g.tagline||"",_=new Date(s.createdAt||Date.now()).getFullYear(),C=`#${String(s.id||"local").replace(/^ots_/,"").slice(-6).toUpperCase()} \xB7 ${_}`;r?.destroy?.(),r=null,a.innerHTML=`<style>${
|
|
900
|
+
`;function L0(e,t={}){let o=document.createElement("div");o.className="ots-trading-card",e.appendChild(o);let a=o.attachShadow({mode:"open"}),s={...t},r=null,i=0,n=!1,l=!1,h=()=>a.querySelector(".card");function f(){let g=s.identity||{},m=g.look||{},w=s.character||m.character||{},k=g.name||"ot",b=A0(s.id,k,s.locale),x=os.includes(s.foil)?s.foil:b.defaultFoil,E=fi(w.body?.color,fi(m.color,"#6d5dfc")),T=fi(m.accent,fi(w.cheeks?.color,"#22d3ee")),v=g.bio||g.tagline||"",_=new Date(s.createdAt||Date.now()).getFullYear(),C=`#${String(s.id||"local").replace(/^ots_/,"").slice(-6).toUpperCase()} \xB7 ${_}`;r?.destroy?.(),r=null,a.innerHTML=`<style>${vp}</style>
|
|
900
901
|
<div class="scene"><div class="card" data-foil="${x}" style="--c:${E};--a:${T};${s.width?`--w:${s.width}px`:""}">
|
|
901
902
|
<div class="frame"><div class="face">
|
|
902
903
|
<header><span class="name">${la(k)}</span>${s.level?`<span class="lvl">LV <b>${la(s.level)}</b></span>`:""}</header>
|
|
@@ -904,10 +905,10 @@ footer{margin-top:auto;display:flex;align-items:center;gap:1.5cqw;padding:2cqw 3
|
|
|
904
905
|
<div class="type"><span>${la(g.role||"ot")}</span><span>${la(String(s.model||"").slice(0,24))}</span></div>
|
|
905
906
|
<div class="stats">${b.stats.map(([z,N])=>`<div class="stat"><span>${la(z)}</span><div class="bar"><i style="width:${N}%"></i></div><em>${N}</em></div>`).join("")}</div>
|
|
906
907
|
${v?`<div class="flavor">${la(v)}</div>`:""}
|
|
907
|
-
<footer><span>${la(C)}</span><span class="rar">${
|
|
908
|
+
<footer><span>${la(C)}</span><span class="rar">${kp.repeat(b.rarity+1)}<span>${la(b.rarityName)}</span></span></footer>
|
|
908
909
|
</div></div>
|
|
909
910
|
<div class="holo"></div><div class="glitter"></div><div class="glare"></div>
|
|
910
|
-
</div></div>`;let L=a.querySelector(".fig");m.kind==="image"&&m.image?L.innerHTML=`<img src="${la(m.image)}" alt="" referrerpolicy="no-referrer">`:(r=Ut(L,w,{locale:s.locale,title:k,moodFx:!1}),r.mood?.("happy",{fx:!1})),requestAnimationFrame(c)}function c(){let g=h()?.getBoundingClientRect(),m=a.querySelector(".art")?.getBoundingClientRect();if(!g?.width||!m)return;let[w,k,b,x]=[m.left-g.left,m.top-g.top,m.width,m.height].map(T=>T/g.width*100),E=g.height/g.width*100;h().style.setProperty("--artmask",`url("data:image/svg+xml,${encodeURIComponent(`<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 ${E}' preserveAspectRatio='none'><rect x='${w}' y='${k}' width='${b}' height='${x}' rx='2'/></svg>`)}") 0 0 / 100% 100%`)}function d(g,m){let w=h();w&&(w.style.setProperty("--mx",`${g*100}%`),w.style.setProperty("--my",`${m*100}%`),w.style.setProperty("--ry",`${(g-.5)*26}deg`),w.style.setProperty("--rx",`${(.5-m)*26}deg`),w.style.setProperty("--o",String(.35+Math.min(1,Math.hypot(g-.5,m-.5)*1.6)*.65)))}f();let p=typeof ResizeObserver<"u"?new ResizeObserver(c):null;p?.observe(o);let u=s.interactive===!1||matchMedia("(prefers-reduced-motion: reduce)").matches;if(s.interactive!==!1&&(a.addEventListener("pointermove",g=>{let m=h(),w=m.getBoundingClientRect();n=!0,m.classList.add("live"),d((g.clientX-w.left)/w.width,(g.clientY-w.top)/w.height)}),a.addEventListener("pointerleave",()=>{n=!1,h()?.classList.remove("live")})),u)d(.68,.3),h().style.setProperty("--rx","0deg"),h().style.setProperty("--ry","0deg");else{let g=performance.now(),m=w=>{if(!l){if(!n){let k=(w-g)/1e3;d(.5+Math.sin(k*.7)*.28,.45+Math.cos(k*.5)*.2)}i=requestAnimationFrame(m)}};i=requestAnimationFrame(m)}return{el:o,update(g={}){s={...s,...g},f()},setFoil(g){s.foil=g;let m=h();m&&(m.dataset.foil=os.includes(g)?g:A0(s.id,s.identity?.name,s.locale).defaultFoil)},get foil(){return h()?.dataset.foil},destroy(){l=!0,cancelAnimationFrame(i),p?.disconnect(),r?.destroy?.(),o.remove()}}}var H0=[-20,-50,240,270],Nn=100,ve=e=>String(e??"").replace(/[&<>"']/g,t=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[t]),j0=["character","plush","image"],ui=12,O0=zn,
|
|
911
|
+
</div></div>`;let L=a.querySelector(".fig");m.kind==="image"&&m.image?L.innerHTML=`<img src="${la(m.image)}" alt="" referrerpolicy="no-referrer">`:(r=Ut(L,w,{locale:s.locale,title:k,moodFx:!1}),r.mood?.("happy",{fx:!1})),requestAnimationFrame(c)}function c(){let g=h()?.getBoundingClientRect(),m=a.querySelector(".art")?.getBoundingClientRect();if(!g?.width||!m)return;let[w,k,b,x]=[m.left-g.left,m.top-g.top,m.width,m.height].map(T=>T/g.width*100),E=g.height/g.width*100;h().style.setProperty("--artmask",`url("data:image/svg+xml,${encodeURIComponent(`<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 ${E}' preserveAspectRatio='none'><rect x='${w}' y='${k}' width='${b}' height='${x}' rx='2'/></svg>`)}") 0 0 / 100% 100%`)}function d(g,m){let w=h();w&&(w.style.setProperty("--mx",`${g*100}%`),w.style.setProperty("--my",`${m*100}%`),w.style.setProperty("--ry",`${(g-.5)*26}deg`),w.style.setProperty("--rx",`${(.5-m)*26}deg`),w.style.setProperty("--o",String(.35+Math.min(1,Math.hypot(g-.5,m-.5)*1.6)*.65)))}f();let p=typeof ResizeObserver<"u"?new ResizeObserver(c):null;p?.observe(o);let u=s.interactive===!1||matchMedia("(prefers-reduced-motion: reduce)").matches;if(s.interactive!==!1&&(a.addEventListener("pointermove",g=>{let m=h(),w=m.getBoundingClientRect();n=!0,m.classList.add("live"),d((g.clientX-w.left)/w.width,(g.clientY-w.top)/w.height)}),a.addEventListener("pointerleave",()=>{n=!1,h()?.classList.remove("live")})),u)d(.68,.3),h().style.setProperty("--rx","0deg"),h().style.setProperty("--ry","0deg");else{let g=performance.now(),m=w=>{if(!l){if(!n){let k=(w-g)/1e3;d(.5+Math.sin(k*.7)*.28,.45+Math.cos(k*.5)*.2)}i=requestAnimationFrame(m)}};i=requestAnimationFrame(m)}return{el:o,update(g={}){s={...s,...g},f()},setFoil(g){s.foil=g;let m=h();m&&(m.dataset.foil=os.includes(g)?g:A0(s.id,s.identity?.name,s.locale).defaultFoil)},get foil(){return h()?.dataset.foil},destroy(){l=!0,cancelAnimationFrame(i),p?.disconnect(),r?.destroy?.(),o.remove()}}}var H0=[-20,-50,240,270],Nn=100,ve=e=>String(e??"").replace(/[&<>"']/g,t=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[t]),j0=["character","plush","image"],ui=12,O0=zn,Mp=["styles","shape","color","eyes","mouth","face","acc"],Ep=Fr,_p=an.filter(e=>!e.startsWith("shape")),Tp=["auto","none","thin","bold","tone","sticker"],P0=16,Sp=`
|
|
911
912
|
:host{all:initial;display:block;font:14px/1.45 system-ui,-apple-system,"Segoe UI",sans-serif;color:var(--ae-fg);
|
|
912
913
|
--ae-bg:#ffffff;--ae-soft:#f4f4fa;--ae-line:#e4e4ee;--ae-fg:#17171f;--ae-muted:#6b6f82;--ae-p:#6d5dfc;--ae-p-soft:#6d5dfc1f;--ae-stage:radial-gradient(circle at 50% 35%,#ffffff,#eceaf7)}
|
|
913
914
|
@media (prefers-color-scheme:dark){:host{--ae-bg:#17171e;--ae-soft:#1f1f28;--ae-line:#2c2c38;--ae-fg:#ececf3;--ae-muted:#9a9db0;--ae-stage:radial-gradient(circle at 50% 35%,#2a2a36,#15151c)}}
|
|
@@ -983,7 +984,7 @@ input[type=text],input[type=url]{font:inherit;width:100%;padding:7px 9px;border-
|
|
|
983
984
|
.alt .tcard{padding:8px 0}
|
|
984
985
|
.alt .side{display:grid;gap:14px;align-content:start}
|
|
985
986
|
@media (max-width:640px){.alt.cardv{grid-template-columns:1fr}}
|
|
986
|
-
`,
|
|
987
|
+
`,Cp=["#a0714f","#f1c27d","#fcd9b6","#e0a97e","#8d5524","#ef4444","#f97316","#facc15","#84cc16","#22c55e","#14b8a6","#06b6d4","#3b82f6","#6366f1","#a855f7","#ec4899","#f8fafc","#94a3b8","#1f2937"];function z0(e={}){return{kind:j0.includes(e.kind)?e.kind:"character",character:Xe(e.character||{}),material:O0.includes(e.material)?e.material:"plush",avatar:{url:typeof e.avatar?.url=="string"?e.avatar.url:"",body:e.avatar?.body==="M"?"M":"F"},image:typeof e.image=="string"?e.image:"",card:{foil:os.includes(e.card?.foil)?e.card.foil:""}}}function q0(e,t={}){let o=document.createElement("ots-avatar-editor");return(t.plush===!1||t.realistic===!1)&&o.setAttribute("no-plush",""),t.simple&&o.setAttribute("simple",""),t.theme&&o.setAttribute("theme",t.theme),t.locale&&o.setAttribute("lang",t.locale),(t.identity||t.otsId)&&(o.identity={...t.identity||{},id:t.otsId,createdAt:t.createdAt}),t.lookFree&&(o.lookFree=t.lookFree),t.value&&(o.value=t.value),t.onChange&&o.addEventListener("change",a=>t.onChange(a.detail)),e.appendChild(o),{el:o,get value(){return o.value},set value(a){o.value=a},destroy:()=>o.remove()}}var Rp=typeof HTMLElement>"u"?class{}:HTMLElement,pi=class extends Rp{static get observedAttributes(){return["lang"]}constructor(){super(),this._v=z0(),this._tab="styles",this._accGroup="head",this._sel=-1,this._sym=!0,this._past=[],this._future=[],this._ready=!1,this._t=pe(Dt())}get locale(){return this._t.locale}attributeChangedCallback(t,o,a){t==="lang"&&o!==a&&this._applyLocale()}_resolveLocale(){let t=this.getAttribute("lang");return t?Dt(t):this._followGlobal?Ko():Dt(this.parentElement?.closest?.("[lang]")?.getAttribute("lang"))}_applyLocale(){this._t=pe(this._resolveLocale()),this._ready&&(this._renderChrome(),this._renderAll())}get identity(){return this._ident||{}}set identity(t){this._ident={...t||{}},this._ready&&this._v.kind==="image"&&this._renderImage()}get value(){return structuredClone(this._v)}set value(t){this._v=z0(t),this._past=[],this._future=[],this._sel=-1,this._ready&&this._renderAll()}connectedCallback(){if(this._offLocale?.(),this._g0=Ko(),this._offLocale=_r(o=>{o!==this._g0&&(this._g0=o,this._followGlobal=!0),!this._localeQueued&&(this._localeQueued=!0,queueMicrotask(()=>{this._localeQueued=!1,this._applyLocale()}))}),this._ready)return this._renderKind();this._ready=!0,this._t=pe(this._resolveLocale());let t=this.attachShadow({mode:"open"});t.innerHTML=`<style>${Sp}</style>
|
|
987
988
|
<div class="wrap">
|
|
988
989
|
<div class="kinds" role="group"></div>
|
|
989
990
|
<div class="body" data-view="character">
|
|
@@ -1010,15 +1011,15 @@ input[type=text],input[type=url]{font:inherit;width:100%;padding:7px 9px;border-
|
|
|
1010
1011
|
<span class="sp"></span>
|
|
1011
1012
|
<button class="btn" type="button" data-a="talk">\u{1F5E3} ${ve(t("editor.talk"))}</button>
|
|
1012
1013
|
<select class="btn" data-a="mood" aria-label="${ve(t("editor.mood"))}">${on.map(s=>`<option value="${s}">${ve(pt(t,"moods",s))}</option>`).join("")}</select>
|
|
1013
|
-
<select class="btn" data-a="gesture" aria-label="${ve(t("editor.gesture"))}"><option value="">${ve(t("editor.gesturePick"))}</option>${
|
|
1014
|
-
<select class="btn" data-a="morph" aria-label="${ve(t("editor.morph"))}"><option value="">${ve(t("editor.morphPick"))}</option>${
|
|
1014
|
+
<select class="btn" data-a="gesture" aria-label="${ve(t("editor.gesture"))}"><option value="">${ve(t("editor.gesturePick"))}</option>${Ep.map(s=>`<option value="${s}">${ve(pt(t,"gestures",s))}</option>`).join("")}</select>
|
|
1015
|
+
<select class="btn" data-a="morph" aria-label="${ve(t("editor.morph"))}"><option value="">${ve(t("editor.morphPick"))}</option>${_p.map(s=>`<option value="${s}">${ve(pt(t,"morphs",s))}</option>`).join("")}</select>`,this.$("[data-a=mood]").value=a,this.$("[data-bar=material]").innerHTML=`<span class="hint" style="margin:0">${ve(t("editor.plush.material"))}</span>
|
|
1015
1016
|
<span class="chips">${O0.map(s=>`<button type="button" class="chip" data-material="${s}">${ve(t(`editor.plush.materials.${s}`))}</button>`).join("")}</span>
|
|
1016
1017
|
<span class="hint" style="margin:0">${ve(t("editor.plush.hint"))}</span>`,this.$("[data-bar=export]").innerHTML=`
|
|
1017
1018
|
<button class="btn" type="button" data-a="svg">\u2B07 SVG</button>
|
|
1018
1019
|
<button class="btn" type="button" data-a="png">\u2B07 PNG</button>
|
|
1019
1020
|
<button class="btn" type="button" data-a="json">\u29C9 ${ve(t("editor.copyJson"))}</button>
|
|
1020
1021
|
<span class="sp"></span>
|
|
1021
|
-
<span class="hint" data-msg aria-live="polite"></span>`,this.$(".tabs").innerHTML=
|
|
1022
|
+
<span class="hint" data-msg aria-live="polite"></span>`,this.$(".tabs").innerHTML=Mp.map(s=>`<button type="button" role="tab" data-tab="${s}">${ve(t(`editor.tabs.${s}`))}</button>`).join("")}_syncBar(){this.$("[data-a=undo]").disabled=!this._past.length,this.$("[data-a=redo]").disabled=!this._future.length}_renderKind(){let t=this._v.kind,o=t==="plush";this.$$("[data-kind]").forEach(s=>s.setAttribute("aria-pressed",String(s.dataset.kind===t))),this.$$("[data-view]").forEach(s=>s.classList.toggle("hidden",s.dataset.view!==(o?"character":t))),o&&!this._failed3d&&this._mount3d();let a=o&&!!this._ch3;this.$(".ch").classList.toggle("hidden",a),this.$(".ch3").classList.toggle("hidden",!a),this.$(".ov").classList.toggle("hidden",o),this.$("[data-bar=material]").classList.toggle("hidden",!o),this.$$("[data-material]").forEach(s=>s.setAttribute("aria-pressed",String(s.dataset.material===this._v.material))),t==="image"?this._renderImage():this._dropCard()}_dropCard(){this._card&&(this._card.destroy(),this._card=null,this.$("[data-view=image]").innerHTML="")}_renderImage(){let t=this._v.image,o=this._t,a=this.$("[data-view=image]"),s=this.identity,r={...s.look||{},kind:"image",image:/^https?:\/\//.test(t)?t:"",character:this._v.character},i={identity:{...s,look:r},id:s.id,createdAt:s.createdAt,foil:this._v.card.foil,locale:this.locale},n=this._v.card.foil;a.querySelector(".tcard")?this._card.update(i):(a.classList.add("cardv"),a.innerHTML='<div class="tcard"></div><div class="side"></div>',this._card?.destroy(),this._card=L0(a.querySelector(".tcard"),i)),a.querySelector(".side").innerHTML=`
|
|
1022
1023
|
<div><h4>${ve(o("editor.image.title"))}</h4><p class="hint" style="margin:0">${ve(o("editor.image.intro"))}</p></div>
|
|
1023
1024
|
<div><span class="hint" style="margin:0 0 6px;display:block">${ve(o("editor.image.foil"))}</span>
|
|
1024
1025
|
<span class="chips"><button type="button" class="chip" data-foil="" aria-pressed="${!n}">${ve(o("editor.image.foils.auto"))}</button>${os.map(l=>`<button type="button" class="chip" data-foil="${l}" aria-pressed="${n===l}">${ve(o(`editor.image.foils.${l}`))}</button>`).join("")}</span></div>
|
|
@@ -1033,11 +1034,11 @@ input[type=text],input[type=url]{font:inherit;width:100%;padding:7px 9px;border-
|
|
|
1033
1034
|
<button type="button" class="chip" data-a="reshape" ${t.body.points?"":"disabled"}>${a("editor.shape.reset")}</button>
|
|
1034
1035
|
<button type="button" class="chip" data-a="squash">${a("editor.shape.wider")}</button>
|
|
1035
1036
|
<button type="button" class="chip" data-a="stretch">${a("editor.shape.taller")}</button>
|
|
1036
|
-
</div>`;break;case"color":n=`<h4>${a("editor.color.body")}</h4><div class="sw">${
|
|
1037
|
+
</div>`;break;case"color":n=`<h4>${a("editor.color.body")}</h4><div class="sw">${Cp.map(f=>`<button type="button" data-swatch="${f}" style="background:${f}" title="${f}" aria-label="${a("editor.color.swatch",{color:f})}"></button>`).join("")}</div>
|
|
1037
1038
|
<div class="row" style="margin-top:10px">${this._color("body.color","editor.color.custom",t.body.color)}</div>
|
|
1038
1039
|
<h4>${a("editor.color.finish")}</h4>${this._grid("finishes",oa,t.finish,"data-finish",f=>s({finish:f.id}),i)}
|
|
1039
1040
|
<h4>${a("editor.color.texture")}</h4>${this._grid("textures",fa,t.texture,"data-texture",f=>s({texture:f.id}),i)}
|
|
1040
|
-
<h4>${a("editor.color.outline")}</h4><div class="chips">${
|
|
1041
|
+
<h4>${a("editor.color.outline")}</h4><div class="chips">${Tp.map(f=>`<button type="button" class="chip" data-outline="${f}" aria-pressed="${t.outline===f}">${a(`editor.color.outlines.${f}`)}</button>`).join("")}</div>
|
|
1041
1042
|
<h4>${a("editor.color.pattern")}</h4>${this._grid("patterns",ta,t.body.pattern,"data-pattern",f=>s({body:{...t.body,pattern:f.id}}),i)}
|
|
1042
1043
|
<div class="row" style="margin-top:10px">${this._color("body.patternColor","editor.color.patternColor",t.body.patternColor)}</div>`;break;case"eyes":n=`<h4>${a("editor.eyes.title",{count:zo.length})}</h4>${this._grid("eyes",zo,t.eyes.type,"data-eyes",f=>s({eyes:{...t.eyes,type:f.id}}),r)}
|
|
1043
1044
|
<h4>${a("editor.settings")}</h4><div class="row">
|
|
@@ -1072,7 +1073,7 @@ input[type=text],input[type=url]{font:inherit;width:100%;padding:7px 9px;border-
|
|
|
1072
1073
|
<button type="button" class="chip" data-a="accdown">${o("editor.acc.back")}</button>
|
|
1073
1074
|
<button type="button" class="chip" data-a="accreset">${o("editor.acc.reset")}</button>
|
|
1074
1075
|
<button type="button" class="chip" data-a="accdel">\u2715 ${o("editor.acc.remove")}</button>
|
|
1075
|
-
</div><p class="hint">${o("editor.acc.hint")}</p></div>`:`<p class="hint">${o("editor.acc.select")}</p>`}`}_drawOverlay(){let t=this._c,o=this._t,a=ro(t),s="";if(this._v.kind==="character"){if(this._tab==="shape"){let r=ra(t);s+=`<path class="hl" d="M${r.map(i=>i.join(" ")).join("L")}Z"/>`,s+=r.map((i,n)=>`<circle class="h${this._sym&&(n===0||n===oo/2)?" axis":""}" tabindex="0" role="slider" aria-label="${ve(o("editor.shape.point",{n:cs(n+1,o.locale)}))}" data-pt="${n}" cx="${i[0]}" cy="${i[1]}" r="5.5"/>`).join("")}this._tab==="eyes"&&(s+=`<circle class="h" tabindex="0" aria-label="${ve(o("editor.eyes.drag"))}" data-face="eyes" cx="${a.cx+a.sp}" cy="${a.eyeY}" r="${Math.max(6,a.r*.5)}"/>`),this._tab==="mouth"&&(s+=`<circle class="h" tabindex="0" aria-label="${ve(o("editor.mouth.drag"))}" data-face="mouth" cx="${a.cx}" cy="${a.mouthY}" r="6"/>`),this._tab==="acc"&&t.accessories.forEach((r,i)=>{let n=Qt.find(h=>h.id===r.id),l=a.anchors[n.anchor]||a.anchors.center;s+=`<circle class="h${i===this._sel?" sel":""}" tabindex="0" aria-label="${ve(o("editor.acc.drag",{name:pt(o,"accessories",n.id)}))}" data-acch="${i}" cx="${l.x+r.x}" cy="${l.y+r.y}" r="6"/>`})}this._ov.innerHTML=s,this._focusSel&&(this._ov.querySelector(this._focusSel)?.focus(),this._focusSel=null)}_svgPoint(t){let o=this._ov.getScreenCTM();if(!o)return null;let a=new DOMPoint(t.clientX,t.clientY).matrixTransform(o.inverse());return[a.x,a.y]}_onDown(t){let o=t.target;if(!(o instanceof SVGElement)||!o.classList.contains("h"))return;t.preventDefault();let a=this._svgPoint(t);if(!a)return;let s=structuredClone(this._c),r;if(o.dataset.pt)r=["pt",+o.dataset.pt];else if(o.dataset.face)r=["face",o.dataset.face];else if(o.dataset.acch)r=["acc",+o.dataset.acch],this._sel!==r[1]&&(this._sel=r[1],this._renderPanel());else return;this._drag=!0,this._ov.setPointerCapture(t.pointerId);let i=0,n=a,l=c=>{n=this._svgPoint(c)||n,i||(i=requestAnimationFrame(()=>{i=0,h(!1)}))},h=c=>{let d=n[0]-a[0],p=n[1]-a[1];this._set(u=>this._dragMut(u,s,r,d,p,n),{commit:c,panel:c}),c||this._drawOverlay()},f=()=>{cancelAnimationFrame(i),this._ov.removeEventListener("pointermove",l),this._ov.removeEventListener("pointerup",f),this._ov.removeEventListener("pointercancel",f),this._drag=!1,h(!0)};this._ov.addEventListener("pointermove",l),this._ov.addEventListener("pointerup",f),this._ov.addEventListener("pointercancel",f)}_dragMut(t,o,[a,s],r,i,n){if(a==="pt"){let l=structuredClone(o.body.points||ra(o)),h=s,f=h===0||h===oo/2;if(l[h]=[this._sym&&f?l[h][0]:n[0],n[1]],this._sym&&!f){let c=(oo-h)%oo;l[c]=[2*Nn-n[0],n[1]]}t.body.points=l.map(([c,d])=>[Math.min(235,Math.max(-35,c)),Math.min(235,Math.max(-35,d))])}else if(a==="face"&&s==="eyes"){t.eyes.y=o.eyes.y+i;let l=ro(o);t.eyes.spacing=o.eyes.spacing*Math.max(.1,(l.sp+r)/l.sp)}else a==="face"&&s==="mouth"?t.mouth.y=o.mouth.y+i:a==="acc"&&(t.accessories[s].x=o.accessories[s].x+r,t.accessories[s].y=o.accessories[s].y+i)}_onHandleKey(t){let o=t.target,a={ArrowLeft:[-2,0],ArrowRight:[2,0],ArrowUp:[0,-2],ArrowDown:[0,2]}[t.key];if(!a||!(o instanceof SVGElement))return;t.preventDefault();let[s,r]=t.shiftKey?[a[0]*5,a[1]*5]:a,i=structuredClone(this._c),n,l;if(o.dataset.pt)n=["pt",+o.dataset.pt],l=`[data-pt="${o.dataset.pt}"]`;else if(o.dataset.face)n=["face",o.dataset.face],l=`[data-face="${o.dataset.face}"]`;else if(o.dataset.acch)n=["acc",+o.dataset.acch],l=`[data-acch="${o.dataset.acch}"]`;else return;let h=+o.getAttribute("cx"),f=+o.getAttribute("cy");this._focusSel=l,this._set(c=>this._dragMut(c,i,n,s,r,[h+s,f+r]),{panel:!1})}_onWheel(t){if(this._tab!=="acc"||this._sel<0)return;t.preventDefault();let o=this._sel;this._set(a=>{let s=a.accessories[o];t.shiftKey?s.rot=Math.max(-180,Math.min(180,s.rot+Math.sign(t.deltaY)*5)):s.scale=Math.max(.2,Math.min(3,s.scale*(t.deltaY>0?.95:1.05)))},{commit:!1,panel:!1}),clearTimeout(this._wheelT),this._wheelT=setTimeout(()=>this._commit(!0),350)}_onClick(t){let o=t.target.closest?.("button");if(!o)return;let a=o.dataset,s=this._c;if(a.kind)return this._setMeta(i=>i.kind=a.kind),this._drawOverlay();if(a.tab){this._tab=a.tab,this._renderPanel(),this._drawOverlay();return}if(a.rand){let i=structuredClone(this._rand?.[+a.rand]);return i?this._set(n=>{let l=this._keepBody?{body:n.body,finish:n.finish}:{};Object.assign(n,i,l,{style:n.style})}):void 0}if(a.preset)return this._set(i=>Object.assign(i,rn(i,a.preset,this._keepBody?["body","finish"]:[])));if(a.artstyle)return this._set(i=>{i.style=a.artstyle});if(a.shape)return this._set(i=>{i.body.shape=a.shape,i.body.points=null});if(a.swatch)return this._set(i=>{i.body.color=a.swatch});if(a.finish)return this._set(i=>{i.finish=a.finish});if(a.texture)return this._set(i=>{i.texture=a.texture});if(a.outline)return this._set(i=>{i.outline=a.outline});if(a.pattern)return this._set(i=>{i.body.pattern=a.pattern});if(a.eyes)return this._set(i=>{i.eyes.type=a.eyes});if(a.mouth)return this._set(i=>{i.mouth.type=a.mouth});if(a.brows)return this._set(i=>{i.brows.type=a.brows});if(a.cheeks)return this._set(i=>{i.cheeks.type=a.cheeks});if(a.accgroup)return this._accGroup=a.accgroup,this._renderPanel();if(a.acc){let i=s.accessories.findIndex(n=>n.id===a.acc);return i>=0?(this._sel=-1,this._set(n=>n.accessories.splice(i,1))):s.accessories.length>=P0?this._msg(this._t("editor.acc.max",{max:P0})):(this._sel=s.accessories.length,this._set(n=>n.accessories.push({id:a.acc})))}if(a.selacc)return this._sel=+a.selacc,this._renderPanel(),this._drawOverlay();if(a.foil!==void 0)return this._setMeta(i=>i.card={foil:a.foil});if(a.material)return this._setMeta(i=>i.material=a.material),this._sync3d();let r=this._sel;switch(a.a){case"undo":return this._undo();case"redo":return this._redo();case"random":return this._set(i=>Object.assign(i,Ma()));case"reroll":return this._rand=null,this._renderPanel();case"sym":return this._sym=!this._sym,o.setAttribute("aria-pressed",String(this._sym)),this._drawOverlay();case"reshape":return this._set(i=>{i.body.points=null});case"squash":case"stretch":{let i=a.a==="squash"?[1.08,.96]:[.95,1.06];return this._set(n=>{let l=n.body.points||ra(n),h=l.map(c=>c[1]),f=(Math.min(...h)+Math.max(...h))/2;n.body.points=l.map(([c,d])=>[Nn+(c-Nn)*i[0],f+(d-f)*i[1]])})}case"accflip":return this._set(i=>{i.accessories[r].flip=!i.accessories[r].flip});case"accreset":return this._set(i=>Object.assign(i.accessories[r],{x:0,y:0,scale:1,rot:0,flip:!1}));case"accdel":return this._sel=-1,this._set(i=>i.accessories.splice(r,1));case"accup":case"accdown":{let i=a.a==="accup"?r+1:r-1;return i<0||i>=s.accessories.length?void 0:(this._sel=i,this._set(n=>{[n.accessories[r],n.accessories[i]]=[n.accessories[i],n.accessories[r]]}))}case"talk":return this._talk();case"svg":return this._download("avatar.svg",new Blob([this._exportSVG()],{type:"image/svg+xml"}));case"png":return this._png();case"json":navigator.clipboard?.writeText(JSON.stringify(this._c,null,2)).then(()=>this._msg(this._t("editor.jsonCopied")),()=>this._msg(this._t("editor.copyFailed")));return}}_onInput(t,o){let a=t.target;if(a.dataset?.a==="mood"&&o)return this._ch.mood(a.value),this._ch3?.mood(a.value);if(a.dataset?.a==="gesture"&&o){a.value&&this._pv.gesture(a.value),a.value="";return}if(a.dataset?.a==="morph"&&o){a.value&&this._pv.morph(a.value),a.value="";return}if(a.hasAttribute?.("data-keep-body")){this._keepBody=a.checked;return}if(a.dataset?.m)return o?this._setMeta(h=>{a.dataset.m==="image"&&(h.image=a.value.trim())}):void 0;let s=a.dataset?.k;if(!s)return;let r=a.type==="range"?Number(a.value):a.value,[i,n,l]=s.split(".");this._set(h=>{i==="acc"?h.accessories[+n][l]=r:h[i][n]=r},{commit:o,panel:!1})}_talk(){this._speech?.stop?.(),this._speech=this._pv.speak(this._t("editor.talkSample"))}_exportSVG(){return Bo(this._c,{},{viewBox:this._ch.svg.getAttribute("viewBox"),title:"Avatar 7ots"}).replace("<svg ",'<svg width="512" height="576" ')}_png(){let t=new Image,o=URL.createObjectURL(new Blob([this._exportSVG()],{type:"image/svg+xml"}));t.onload=()=>{let a=document.createElement("canvas");a.width=512,a.height=576,a.getContext("2d").drawImage(t,0,0,512,576),URL.revokeObjectURL(o),a.toBlob(s=>s&&this._download("avatar.png",s))},t.onerror=()=>{URL.revokeObjectURL(o),this._msg(this._t("editor.pngFailed"))},t.src=o}_download(t,o){let a=document.createElement("a");a.href=URL.createObjectURL(o),a.download=t,a.click(),setTimeout(()=>URL.revokeObjectURL(a.href),1e3)}_msg(t){let o=this.$("[data-msg]");o.textContent=t,clearTimeout(this._msgT),this._msgT=setTimeout(()=>o.textContent="",2500)}};typeof customElements<"u"&&!customElements.get("ots-avatar-editor")&&customElements.define("ots-avatar-editor",pi);mo();ji();vn();Qe();mo();Na();var rt=e=>String(e??"").replace(/[&<>"]/g,t=>({"&":"&","<":"<",">":">",'"':"""})[t]),kr=e=>JSON.parse(JSON.stringify(e)),Rp=["#f3efff","#ffd6e7","#ffb4a2","#ffd23f","#b8f2a1","#7ee0c3","#8fd3ff","#8b7bff","#c084fc","#a0714f","#5b4636","#3a3a4a","#1f1f2b","#ef4444"],mi=["#ffffff","#c9b8ff","#ff8fb1","#ffd23f","#86efac","#67e8f9","#3b82f6","#a855f7","#f97316","#6b4423","#1a1a24"],Ua=[{id:"body",icon:"\u{1FAE7}",tabs:["shape","style","color","finish","preset"]},{id:"face",icon:"\u{1F440}",tabs:["eyes","brows","mouth","cheeks"]},{id:"paint",icon:"\u{1F3A8}",tabs:["pattern","texture"]},{id:"acc",icon:"\u{1F3A9}",tabs:ua.map(([e])=>`acc:${e}`)}],Ap=new Set(["head","eyes","face","neck","back"]),Lp=e=>Qt.find(t=>t.id===e)?.group,Hp=(e,t)=>{let o=e.accessories.some(a=>a.id===t.id);e.accessories=e.accessories.filter(a=>Ap.has(t.group)?Lp(a.id)!==t.group:a.id!==t.id),o||e.accessories.push({id:t.id})};function Pp(e){let t={shape:[zt,"shapes",(o,a)=>{o.body.shape=a.id,o.body.points=null},o=>e().body.shape===o.id,"bounce"],style:[Ga,"styles",(o,a)=>{o.style=a.id},o=>(e().style||"none")===o.id,"celebrate"],finish:[oa,"finishes",(o,a)=>{o.finish=a.id},o=>e().finish===o.id,"bounce"],preset:[ir,"presets",(o,a)=>Object.assign(o,Xe(a.spec)),()=>!1,"celebrate"],eyes:[zo,"eyes",(o,a)=>{o.eyes.type=a.id},o=>e().eyes.type===o.id,"nod"],brows:[Jo,"brows",(o,a)=>{o.brows.type=a.id},o=>e().brows.type===o.id,"nod"],mouth:[jo,"mouths",(o,a)=>{o.mouth.type=a.id},o=>e().mouth.type===o.id,"laugh"],cheeks:[ea,"cheeks",(o,a)=>{o.cheeks.type=a.id},o=>e().cheeks.type===o.id,"nod"],pattern:[ta,"patterns",(o,a)=>{o.body.pattern=a.id},o=>e().body.pattern===o.id,"spin"],texture:[fa,"textures",(o,a)=>{o.texture=a.id},o=>e().texture===o.id,"wiggle"]};for(let[o]of ua)t[`acc:${o}`]=[Qt.filter(a=>a.group===o),"accessories",Hp,a=>e().accessories.some(s=>s.id===a.id),"spin"];return t}var zp=`
|
|
1076
|
+
</div><p class="hint">${o("editor.acc.hint")}</p></div>`:`<p class="hint">${o("editor.acc.select")}</p>`}`}_drawOverlay(){let t=this._c,o=this._t,a=ro(t),s="";if(this._v.kind==="character"){if(this._tab==="shape"){let r=ra(t);s+=`<path class="hl" d="M${r.map(i=>i.join(" ")).join("L")}Z"/>`,s+=r.map((i,n)=>`<circle class="h${this._sym&&(n===0||n===oo/2)?" axis":""}" tabindex="0" role="slider" aria-label="${ve(o("editor.shape.point",{n:cs(n+1,o.locale)}))}" data-pt="${n}" cx="${i[0]}" cy="${i[1]}" r="5.5"/>`).join("")}this._tab==="eyes"&&(s+=`<circle class="h" tabindex="0" aria-label="${ve(o("editor.eyes.drag"))}" data-face="eyes" cx="${a.cx+a.sp}" cy="${a.eyeY}" r="${Math.max(6,a.r*.5)}"/>`),this._tab==="mouth"&&(s+=`<circle class="h" tabindex="0" aria-label="${ve(o("editor.mouth.drag"))}" data-face="mouth" cx="${a.cx}" cy="${a.mouthY}" r="6"/>`),this._tab==="acc"&&t.accessories.forEach((r,i)=>{let n=Qt.find(h=>h.id===r.id),l=a.anchors[n.anchor]||a.anchors.center;s+=`<circle class="h${i===this._sel?" sel":""}" tabindex="0" aria-label="${ve(o("editor.acc.drag",{name:pt(o,"accessories",n.id)}))}" data-acch="${i}" cx="${l.x+r.x}" cy="${l.y+r.y}" r="6"/>`})}this._ov.innerHTML=s,this._focusSel&&(this._ov.querySelector(this._focusSel)?.focus(),this._focusSel=null)}_svgPoint(t){let o=this._ov.getScreenCTM();if(!o)return null;let a=new DOMPoint(t.clientX,t.clientY).matrixTransform(o.inverse());return[a.x,a.y]}_onDown(t){let o=t.target;if(!(o instanceof SVGElement)||!o.classList.contains("h"))return;t.preventDefault();let a=this._svgPoint(t);if(!a)return;let s=structuredClone(this._c),r;if(o.dataset.pt)r=["pt",+o.dataset.pt];else if(o.dataset.face)r=["face",o.dataset.face];else if(o.dataset.acch)r=["acc",+o.dataset.acch],this._sel!==r[1]&&(this._sel=r[1],this._renderPanel());else return;this._drag=!0,this._ov.setPointerCapture(t.pointerId);let i=0,n=a,l=c=>{n=this._svgPoint(c)||n,i||(i=requestAnimationFrame(()=>{i=0,h(!1)}))},h=c=>{let d=n[0]-a[0],p=n[1]-a[1];this._set(u=>this._dragMut(u,s,r,d,p,n),{commit:c,panel:c}),c||this._drawOverlay()},f=()=>{cancelAnimationFrame(i),this._ov.removeEventListener("pointermove",l),this._ov.removeEventListener("pointerup",f),this._ov.removeEventListener("pointercancel",f),this._drag=!1,h(!0)};this._ov.addEventListener("pointermove",l),this._ov.addEventListener("pointerup",f),this._ov.addEventListener("pointercancel",f)}_dragMut(t,o,[a,s],r,i,n){if(a==="pt"){let l=structuredClone(o.body.points||ra(o)),h=s,f=h===0||h===oo/2;if(l[h]=[this._sym&&f?l[h][0]:n[0],n[1]],this._sym&&!f){let c=(oo-h)%oo;l[c]=[2*Nn-n[0],n[1]]}t.body.points=l.map(([c,d])=>[Math.min(235,Math.max(-35,c)),Math.min(235,Math.max(-35,d))])}else if(a==="face"&&s==="eyes"){t.eyes.y=o.eyes.y+i;let l=ro(o);t.eyes.spacing=o.eyes.spacing*Math.max(.1,(l.sp+r)/l.sp)}else a==="face"&&s==="mouth"?t.mouth.y=o.mouth.y+i:a==="acc"&&(t.accessories[s].x=o.accessories[s].x+r,t.accessories[s].y=o.accessories[s].y+i)}_onHandleKey(t){let o=t.target,a={ArrowLeft:[-2,0],ArrowRight:[2,0],ArrowUp:[0,-2],ArrowDown:[0,2]}[t.key];if(!a||!(o instanceof SVGElement))return;t.preventDefault();let[s,r]=t.shiftKey?[a[0]*5,a[1]*5]:a,i=structuredClone(this._c),n,l;if(o.dataset.pt)n=["pt",+o.dataset.pt],l=`[data-pt="${o.dataset.pt}"]`;else if(o.dataset.face)n=["face",o.dataset.face],l=`[data-face="${o.dataset.face}"]`;else if(o.dataset.acch)n=["acc",+o.dataset.acch],l=`[data-acch="${o.dataset.acch}"]`;else return;let h=+o.getAttribute("cx"),f=+o.getAttribute("cy");this._focusSel=l,this._set(c=>this._dragMut(c,i,n,s,r,[h+s,f+r]),{panel:!1})}_onWheel(t){if(this._tab!=="acc"||this._sel<0)return;t.preventDefault();let o=this._sel;this._set(a=>{let s=a.accessories[o];t.shiftKey?s.rot=Math.max(-180,Math.min(180,s.rot+Math.sign(t.deltaY)*5)):s.scale=Math.max(.2,Math.min(3,s.scale*(t.deltaY>0?.95:1.05)))},{commit:!1,panel:!1}),clearTimeout(this._wheelT),this._wheelT=setTimeout(()=>this._commit(!0),350)}_onClick(t){let o=t.target.closest?.("button");if(!o)return;let a=o.dataset,s=this._c;if(a.kind)return this._setMeta(i=>i.kind=a.kind),this._drawOverlay();if(a.tab){this._tab=a.tab,this._renderPanel(),this._drawOverlay();return}if(a.rand){let i=structuredClone(this._rand?.[+a.rand]);return i?this._set(n=>{let l=this._keepBody?{body:n.body,finish:n.finish}:{};Object.assign(n,i,l,{style:n.style})}):void 0}if(a.preset)return this._set(i=>Object.assign(i,rn(i,a.preset,this._keepBody?["body","finish"]:[])));if(a.artstyle)return this._set(i=>{i.style=a.artstyle});if(a.shape)return this._set(i=>{i.body.shape=a.shape,i.body.points=null});if(a.swatch)return this._set(i=>{i.body.color=a.swatch});if(a.finish)return this._set(i=>{i.finish=a.finish});if(a.texture)return this._set(i=>{i.texture=a.texture});if(a.outline)return this._set(i=>{i.outline=a.outline});if(a.pattern)return this._set(i=>{i.body.pattern=a.pattern});if(a.eyes)return this._set(i=>{i.eyes.type=a.eyes});if(a.mouth)return this._set(i=>{i.mouth.type=a.mouth});if(a.brows)return this._set(i=>{i.brows.type=a.brows});if(a.cheeks)return this._set(i=>{i.cheeks.type=a.cheeks});if(a.accgroup)return this._accGroup=a.accgroup,this._renderPanel();if(a.acc){let i=s.accessories.findIndex(n=>n.id===a.acc);return i>=0?(this._sel=-1,this._set(n=>n.accessories.splice(i,1))):s.accessories.length>=P0?this._msg(this._t("editor.acc.max",{max:P0})):(this._sel=s.accessories.length,this._set(n=>n.accessories.push({id:a.acc})))}if(a.selacc)return this._sel=+a.selacc,this._renderPanel(),this._drawOverlay();if(a.foil!==void 0)return this._setMeta(i=>i.card={foil:a.foil});if(a.material)return this._setMeta(i=>i.material=a.material),this._sync3d();let r=this._sel;switch(a.a){case"undo":return this._undo();case"redo":return this._redo();case"random":return this._set(i=>Object.assign(i,Ma()));case"reroll":return this._rand=null,this._renderPanel();case"sym":return this._sym=!this._sym,o.setAttribute("aria-pressed",String(this._sym)),this._drawOverlay();case"reshape":return this._set(i=>{i.body.points=null});case"squash":case"stretch":{let i=a.a==="squash"?[1.08,.96]:[.95,1.06];return this._set(n=>{let l=n.body.points||ra(n),h=l.map(c=>c[1]),f=(Math.min(...h)+Math.max(...h))/2;n.body.points=l.map(([c,d])=>[Nn+(c-Nn)*i[0],f+(d-f)*i[1]])})}case"accflip":return this._set(i=>{i.accessories[r].flip=!i.accessories[r].flip});case"accreset":return this._set(i=>Object.assign(i.accessories[r],{x:0,y:0,scale:1,rot:0,flip:!1}));case"accdel":return this._sel=-1,this._set(i=>i.accessories.splice(r,1));case"accup":case"accdown":{let i=a.a==="accup"?r+1:r-1;return i<0||i>=s.accessories.length?void 0:(this._sel=i,this._set(n=>{[n.accessories[r],n.accessories[i]]=[n.accessories[i],n.accessories[r]]}))}case"talk":return this._talk();case"svg":return this._download("avatar.svg",new Blob([this._exportSVG()],{type:"image/svg+xml"}));case"png":return this._png();case"json":navigator.clipboard?.writeText(JSON.stringify(this._c,null,2)).then(()=>this._msg(this._t("editor.jsonCopied")),()=>this._msg(this._t("editor.copyFailed")));return}}_onInput(t,o){let a=t.target;if(a.dataset?.a==="mood"&&o)return this._ch.mood(a.value),this._ch3?.mood(a.value);if(a.dataset?.a==="gesture"&&o){a.value&&this._pv.gesture(a.value),a.value="";return}if(a.dataset?.a==="morph"&&o){a.value&&this._pv.morph(a.value),a.value="";return}if(a.hasAttribute?.("data-keep-body")){this._keepBody=a.checked;return}if(a.dataset?.m)return o?this._setMeta(h=>{a.dataset.m==="image"&&(h.image=a.value.trim())}):void 0;let s=a.dataset?.k;if(!s)return;let r=a.type==="range"?Number(a.value):a.value,[i,n,l]=s.split(".");this._set(h=>{i==="acc"?h.accessories[+n][l]=r:h[i][n]=r},{commit:o,panel:!1})}_talk(){this._speech?.stop?.(),this._speech=this._pv.speak(this._t("editor.talkSample"))}_exportSVG(){return Bo(this._c,{},{viewBox:this._ch.svg.getAttribute("viewBox"),title:"Avatar 7ots"}).replace("<svg ",'<svg width="512" height="576" ')}_png(){let t=new Image,o=URL.createObjectURL(new Blob([this._exportSVG()],{type:"image/svg+xml"}));t.onload=()=>{let a=document.createElement("canvas");a.width=512,a.height=576,a.getContext("2d").drawImage(t,0,0,512,576),URL.revokeObjectURL(o),a.toBlob(s=>s&&this._download("avatar.png",s))},t.onerror=()=>{URL.revokeObjectURL(o),this._msg(this._t("editor.pngFailed"))},t.src=o}_download(t,o){let a=document.createElement("a");a.href=URL.createObjectURL(o),a.download=t,a.click(),setTimeout(()=>URL.revokeObjectURL(a.href),1e3)}_msg(t){let o=this.$("[data-msg]");o.textContent=t,clearTimeout(this._msgT),this._msgT=setTimeout(()=>o.textContent="",2500)}};typeof customElements<"u"&&!customElements.get("ots-avatar-editor")&&customElements.define("ots-avatar-editor",pi);mo();ji();vn();Qe();mo();Na();var rt=e=>String(e??"").replace(/[&<>"]/g,t=>({"&":"&","<":"<",">":">",'"':"""})[t]),kr=e=>JSON.parse(JSON.stringify(e)),Ap=["#f3efff","#ffd6e7","#ffb4a2","#ffd23f","#b8f2a1","#7ee0c3","#8fd3ff","#8b7bff","#c084fc","#a0714f","#5b4636","#3a3a4a","#1f1f2b","#ef4444"],mi=["#ffffff","#c9b8ff","#ff8fb1","#ffd23f","#86efac","#67e8f9","#3b82f6","#a855f7","#f97316","#6b4423","#1a1a24"],Ua=[{id:"body",icon:"\u{1FAE7}",tabs:["shape","style","color","finish","preset"]},{id:"face",icon:"\u{1F440}",tabs:["eyes","brows","mouth","cheeks"]},{id:"paint",icon:"\u{1F3A8}",tabs:["pattern","texture"]},{id:"acc",icon:"\u{1F3A9}",tabs:ua.map(([e])=>`acc:${e}`)}],Lp=new Set(["head","eyes","face","neck","back"]),Hp=e=>Qt.find(t=>t.id===e)?.group,Pp=(e,t)=>{let o=e.accessories.some(a=>a.id===t.id);e.accessories=e.accessories.filter(a=>Lp.has(t.group)?Hp(a.id)!==t.group:a.id!==t.id),o||e.accessories.push({id:t.id})};function zp(e){let t={shape:[zt,"shapes",(o,a)=>{o.body.shape=a.id,o.body.points=null},o=>e().body.shape===o.id,"bounce"],style:[Ga,"styles",(o,a)=>{o.style=a.id},o=>(e().style||"none")===o.id,"celebrate"],finish:[oa,"finishes",(o,a)=>{o.finish=a.id},o=>e().finish===o.id,"bounce"],preset:[ir,"presets",(o,a)=>Object.assign(o,Xe(a.spec)),()=>!1,"celebrate"],eyes:[zo,"eyes",(o,a)=>{o.eyes.type=a.id},o=>e().eyes.type===o.id,"nod"],brows:[Jo,"brows",(o,a)=>{o.brows.type=a.id},o=>e().brows.type===o.id,"nod"],mouth:[jo,"mouths",(o,a)=>{o.mouth.type=a.id},o=>e().mouth.type===o.id,"laugh"],cheeks:[ea,"cheeks",(o,a)=>{o.cheeks.type=a.id},o=>e().cheeks.type===o.id,"nod"],pattern:[ta,"patterns",(o,a)=>{o.body.pattern=a.id},o=>e().body.pattern===o.id,"spin"],texture:[fa,"textures",(o,a)=>{o.texture=a.id},o=>e().texture===o.id,"wiggle"]};for(let[o]of ua)t[`acc:${o}`]=[Qt.filter(a=>a.group===o),"accessories",Pp,a=>e().accessories.some(s=>s.id===a.id),"spin"];return t}var jp=`
|
|
1076
1077
|
.osc{container-type:inline-size;--osc-line:color-mix(in srgb,currentColor 14%,transparent);--osc-card:color-mix(in srgb,currentColor 6%,transparent);--osc-hover:color-mix(in srgb,currentColor 11%,transparent);--osc-muted:color-mix(in srgb,currentColor 62%,transparent);--osc-sel:#8b7bff;--osc-accent:#ffd23f;--osc-accent-ink:#1a1240}
|
|
1077
1078
|
.osc *{box-sizing:border-box}
|
|
1078
1079
|
.osc button{font:inherit;color:inherit;cursor:pointer}
|
|
@@ -1137,7 +1138,7 @@ input[type=text],input[type=url]{font:inherit;width:100%;padding:7px 9px;border-
|
|
|
1137
1138
|
.osc-hint{display:none}
|
|
1138
1139
|
}
|
|
1139
1140
|
@container (max-width:420px){.osc-grid{grid-template-columns:repeat(3,1fr)}}
|
|
1140
|
-
`,G0=!1,
|
|
1141
|
+
`,G0=!1,Op=()=>{if(G0||typeof document>"u")return;G0=!0;let e=document.createElement("style");e.dataset.ots="step-creator",e.textContent=jp,document.head.appendChild(e)};function qp(e,t={}){Op();let o=pe(t.locale),a=Xe(t.value||{}),s=[],r=zp(()=>a),i=0,n=Ua.map(A=>A.tabs[0]),l=new Set([0]),h=!0,f=document.createElement("div");f.className="osc",f.innerHTML=`<div class="osc-wrap"${t.height?` style="--osc-h:${rt(t.height)}"`:""}>
|
|
1141
1142
|
<nav class="osc-rail" data-rail></nav>
|
|
1142
1143
|
<section class="osc-stage">
|
|
1143
1144
|
<div class="osc-prev" data-prev></div>
|
|
@@ -1157,5 +1158,5 @@ input[type=text],input[type=url]{font:inherit;width:100%;padding:7px 9px;border-
|
|
|
1157
1158
|
<div class="osc-body" data-body></div>
|
|
1158
1159
|
<footer class="osc-foot"><button type="button" class="osc-btn" data-back></button><button type="button" class="osc-btn p" data-next></button></footer>
|
|
1159
1160
|
</aside>
|
|
1160
|
-
</div>`,e.appendChild(f);let c=A=>f.querySelector(A),d=null,p=!0,u=0,g=async()=>{let A=++u;d?.destroy?.(),d=null,c("[data-prev]").innerHTML="";let B=null;if(p)try{let W=await ia();h&&A===u&&W.webglAvailable()&&(B=W.createCharacter3D(c("[data-prev]"),a,{material:t.material||"plush",orbit:!0,stage:{key:"overlay",zIndex:2147483001,maxDpr:1.5}}))}catch{}if(!h||A!==u)return B?.destroy?.();B||(p=!1),d=B||Ut(c("[data-prev]"),a),c("[data-dim]").textContent=p?"2D":"3D",c(".osc-hint").hidden=!p};g();let m=0,w=A=>{cancelAnimationFrame(m),m=requestAnimationFrame(()=>{d?.update(a),A&&setTimeout(()=>d?.gesture?.(A),60)}),c("[data-undo]").disabled=!s.length},k=(A,B)=>{s.push(kr(a)),s.length>50&&s.shift();let W=kr(a);b()&&(W.mods=W.mods.filter(ae=>!ae.model)),A(W),a=Xe(W),w(B),t.onChange?.(kr(a))},b=()=>(a.mods||[]).find(A=>A.model),x=A=>(A.name&&typeof A.name=="object"?A.name[t.locale]||A.name.en||Object.values(A.name)[0]:A.name)||A.id,E=(A,B,W)=>{let[ae,Me]=B.split(".");A[ae][Me]=W},T=A=>A.startsWith("acc:")?pt(o,"groups",A.slice(4)):o(`creator.tabs.${A}`),v=A=>{let B=kr(a);return A(B),Bo(B,{},{backdrop:!1})},_=(A,B)=>`<section class="osc-sec"><h3>${rt(A)}</h3>${B}</section>`,C=(A,B,W)=>`<div class="osc-sws">${A.map(ae=>`<button type="button" class="osc-sw" style="background:${ae}" data-sw="${W}" data-c="${ae}" aria-pressed="${B===ae}" aria-label="${ae}"></button>`).join("")}<label class="osc-sw osc-pick" title="${rt(o("creator.otherColor"))}"><input type="color" data-sw="${W}" value="${rt(B||"#ffffff")}" aria-label="${rt(o("creator.otherColor"))}"></label></div>`,L=(A,B,W,ae,Me,te)=>`<label class="osc-sl">${rt(A)}<input type="range" data-sl="${B}" min="${ae}" max="${Me}" step="${te}" value="${W}"></label>`;function z(){c("[data-rail]").innerHTML=Ua.map((A,B)=>`<button type="button" data-step="${B}" class="${l.has(B)&&B!==i?"done":""}" aria-current="${B===i?"step":"false"}"><i>${A.icon}</i>${rt(o(`creator.steps.${A.id}`))}</button>`).join("")+(t.onPlay?`<button type="button" class="osc-play" data-play><i>\u25B6</i>${rt(o("creator.play"))}</button>`:"")}function N(){let A=n[i],B="";if(A==="color")B=_(o("creator.bodyColor"),C(
|
|
1161
|
+
</div>`,e.appendChild(f);let c=A=>f.querySelector(A),d=null,p=!0,u=0,g=async()=>{let A=++u;d?.destroy?.(),d=null,c("[data-prev]").innerHTML="";let B=null;if(p)try{let W=await ia();h&&A===u&&W.webglAvailable()&&(B=W.createCharacter3D(c("[data-prev]"),a,{material:t.material||"plush",orbit:!0,stage:{key:"overlay",zIndex:2147483001,maxDpr:1.5}}))}catch{}if(!h||A!==u)return B?.destroy?.();B||(p=!1),d=B||Ut(c("[data-prev]"),a),c("[data-dim]").textContent=p?"2D":"3D",c(".osc-hint").hidden=!p};g();let m=0,w=A=>{cancelAnimationFrame(m),m=requestAnimationFrame(()=>{d?.update(a),A&&setTimeout(()=>d?.gesture?.(A),60)}),c("[data-undo]").disabled=!s.length},k=(A,B)=>{s.push(kr(a)),s.length>50&&s.shift();let W=kr(a);b()&&(W.mods=W.mods.filter(ae=>!ae.model)),A(W),a=Xe(W),w(B),t.onChange?.(kr(a))},b=()=>(a.mods||[]).find(A=>A.model),x=A=>(A.name&&typeof A.name=="object"?A.name[t.locale]||A.name.en||Object.values(A.name)[0]:A.name)||A.id,E=(A,B,W)=>{let[ae,Me]=B.split(".");A[ae][Me]=W},T=A=>A.startsWith("acc:")?pt(o,"groups",A.slice(4)):o(`creator.tabs.${A}`),v=A=>{let B=kr(a);return A(B),Bo(B,{},{backdrop:!1})},_=(A,B)=>`<section class="osc-sec"><h3>${rt(A)}</h3>${B}</section>`,C=(A,B,W)=>`<div class="osc-sws">${A.map(ae=>`<button type="button" class="osc-sw" style="background:${ae}" data-sw="${W}" data-c="${ae}" aria-pressed="${B===ae}" aria-label="${ae}"></button>`).join("")}<label class="osc-sw osc-pick" title="${rt(o("creator.otherColor"))}"><input type="color" data-sw="${W}" value="${rt(B||"#ffffff")}" aria-label="${rt(o("creator.otherColor"))}"></label></div>`,L=(A,B,W,ae,Me,te)=>`<label class="osc-sl">${rt(A)}<input type="range" data-sl="${B}" min="${ae}" max="${Me}" step="${te}" value="${W}"></label>`;function z(){c("[data-rail]").innerHTML=Ua.map((A,B)=>`<button type="button" data-step="${B}" class="${l.has(B)&&B!==i?"done":""}" aria-current="${B===i?"step":"false"}"><i>${A.icon}</i>${rt(o(`creator.steps.${A.id}`))}</button>`).join("")+(t.onPlay?`<button type="button" class="osc-play" data-play><i>\u25B6</i>${rt(o("creator.play"))}</button>`:"")}function N(){let A=n[i],B="";if(A==="color")B=_(o("creator.bodyColor"),C(Ap,a.body.color,"body.color"))+_(o("creator.eyeColor"),C(mi,a.eyes.iris,"eyes.iris"));else if(r[A]){let[ae,Me,te,ue]=r[A],be=Ua[i].id==="face"||["acc:head","acc:eyes","acc:face"].includes(A);B=_(T(A),`<div class="osc-grid${be?" face":""}">${ae.map((fe,Fe)=>`<button type="button" class="osc-tile" data-i="${Fe}" aria-pressed="${ue(fe)}">${v(Y=>te(Y,fe))}<span>${rt(pt(o,Me,fe.id))}</span></button>`).join("")}</div>`),A==="eyes"&&(B=_(o("creator.adjust"),L(o("creator.size"),"eyes.size",a.eyes.size,.6,1.5,.05)+L(o("creator.spacing"),"eyes.spacing",a.eyes.spacing,.6,1.5,.05)+L(o("creator.height"),"eyes.y",a.eyes.y,-20,20,1))+B),A==="mouth"&&(B=_(o("creator.adjust"),L(o("creator.size"),"mouth.size",a.mouth.size,.6,1.6,.05))+B),A==="brows"&&(B+=_(o("creator.color"),C(mi,a.brows.color,"brows.color"))),A==="cheeks"&&(B+=_(o("creator.color"),C(mi.concat("#ff6b8a"),a.cheeks.color,"cheeks.color"))),A==="pattern"&&(B=_(o("creator.patternColor"),C(mi,a.body.patternColor,"body.patternColor"))+B),A.startsWith("acc:")&&a.accessories.length&&(B+=`<button type="button" class="osc-btn" data-clear>${rt(o("creator.clearAll",{n:a.accessories.length}))}</button>`)}let W=b();c("[data-body]").innerHTML=(W?`<div class="osc-mod"><p>${rt(o("creator.modBody",{name:x(W)}))}</p><button type="button" class="osc-btn" data-unmod>${rt(o("creator.modRemove"))}</button></div>`:"")+(B||`<p>${rt(o("creator.empty"))}</p>`)}function Q(){let A=Ua[i];c("[data-kick]").textContent=o("creator.stepOf",{n:i+1,total:Ua.length}),c("[data-title]").textContent=o(`creator.steps.${A.id}`),c("[data-tabs]").innerHTML=A.tabs.map(W=>`<button type="button" role="tab" data-tab="${W}" aria-selected="${W===n[i]}">${rt(T(W))}</button>`).join(""),c("[data-back]").textContent=o("creator.back"),c("[data-back]").disabled=i===0;let B=i===Ua.length-1;c("[data-next]").textContent=B?t.onPlay?o("creator.playNext"):o("creator.steps.body"):o("creator.next"),z(),N()}let F=A=>{i=A,l.add(A),Q()};return f.addEventListener("click",A=>{let B=A.target.closest("button");if(B){if(B.dataset.play!=null)return t.onPlay?.();if(B.dataset.step!=null)return F(Number(B.dataset.step));if(B.dataset.tab)return n[i]=B.dataset.tab,Q();if(B.dataset.g)return d?.gesture?.(B.dataset.g);if(B.dataset.dim!=null)return p=!p,g();if(B.dataset.random!=null)return k(W=>Object.assign(W,Ma(Math.random()*1e9)),"celebrate"),N();if(B.dataset.undo!=null)return s.length?(a=s.pop(),w("shake"),t.onChange?.(kr(a)),N()):void 0;if(B.dataset.back!=null)return i>0&&F(i-1);if(B.dataset.next!=null){i<Ua.length-1?(F(i+1),d?.gesture?.("jump")):t.onPlay?t.onPlay():F(0);return}if(B.classList.contains("osc-tile")){let[W,,ae,,Me]=r[n[i]],te=W[Number(B.dataset.i)];return k(ue=>ae(ue,te),Me),N()}if(B.dataset.sw)return k(W=>E(W,B.dataset.sw,B.dataset.c)),N();if(B.dataset.unmod!=null)return k(()=>{},"celebrate"),N();B.dataset.clear!=null&&(k(W=>{W.accessories=[]},"shrug"),N())}}),f.addEventListener("input",A=>{let B=A.target;B.dataset.sl?k(W=>E(W,B.dataset.sl,Number(B.value))):B.type==="color"&&B.dataset.sw&&k(W=>E(W,B.dataset.sw,B.value))}),f.addEventListener("change",A=>{(A.target.dataset.sl||A.target.type==="color")&&N()}),Q(),{el:f,get value(){return kr(a)},set value(A){a=Xe(A||{}),s.length=0,w(),N()},gesture:A=>d?.gesture?.(A),destroy(){h=!1,cancelAnimationFrame(m),d?.destroy?.(),f.remove()}}}Qe();Qe();async function j$(e,t,o){return(await ia()).createRoom3D(e,t,o)}var Gp="0.1.0",as=null;function Np(e={}){if(as?.widget.isConnected)return console.warn("[7ots] ya inicializado; se devuelve la instancia existente"),as;let t=document.createElement("ots-agent");return(document.body||document.documentElement).appendChild(t),t.configure(e),as=t.api,as}function Bp(){return as}typeof window<"u"&&(window.SevenOts=Object.assign(window.SevenOts||{},{init:Np,get:Bp,version:Gp,createFace:di,defineIdentity:io,createAvatarEditor:q0,createCharacter:Ut,renderCharacter:Bo,i18n:{t:Er,translator:pe,addMessages:ns,setLocale:xi,getLocale:Ko,LOCALES:wi}}));export{Qt as ACCESSORIES,ua as ACCESSORY_GROUPS,Cn as ALL_GESTURES,Gl as AURA_MOVES,Mh as AURA_POINTS,vh as AURA_STYLE,Rr as ActionRegistry,Tr as AgentBrain,li as AgentWidget,ts as ApuchatBridge,Pr as AuthManager,pi as AvatarEditor,Qa as AvatarStage,yp as BEAT_STYLES,Jo as BROWS,Uh as CHARACTER_EFFECTS,Fr as CHARACTER_GESTURES,za as CHARACTER_GESTURE_ALIAS,on as CHARACTER_MOODS,an as CHARACTER_MORPHS,ea as CHEEKS,es as Companion,Sr as ContextManager,ql as DANCES,Cs as DANCE_BPM,kh as DANCE_STYLE,sc as DEFAULT_CHARACTER,W0 as DEFAULT_LOCALE,zo as EYES,Ra as EventBus,oa as FINISHES,Tn as GESTURES,p0 as GESTURE_3D,Xu as GROK_VOICES,Fa as IDENTITY_DEFAULTS,hi as IdentityCard,wi as LOCALES,U0 as LOCALE_NAMES,Vi as MAX_MODS,ii as MEET_AVATARS,ni as MEET_SCENES,Qi as MOD_ANCHORS,Ii as MOD_FACE,Es as MOD_SLOTS,_n as MOODS,Sn as MOODS_2D,jo as MOUTHS,Cr as McpClient,Ju as OPENAI_VOICES,ta as PATTERNS,ir as PRESETS,jr as PageTools,Or as ProxyLLM,zt as SHAPES,Ar as UIManager,Ot as VISEMES,zr as VirtualPointer,Va as VoiceEngine,Bt as addCatalog,ns as addMessages,rn as applyPreset,Y0 as availableLocales,ci as cleanSeed,Hn as createApuchatActions,Ln as createApumailActions,q0 as createAvatarEditor,Ri as createBuiltinActions,Ut as createCharacter,An as createCompanionActions,di as createFace,j$ as createOtRoom,qp as createStepCreator,Ai as decodeJwt,io as defineIdentity,Dt as detectLocale,K0 as formatList,cs as formatNumber,Bp as get,Ko as getLocale,Za as identityToWidgetConfig,Np as init,ia as loadCharacter3D,Al as modName,k0 as newSeed,Xe as normalizeCharacter,Zi as normalizeMod,_s as normalizeMods,_r as onLocaleChange,pt as partLabel,xp as playBeat,op as publicIdentity,Ma as randomCharacter,pp as randomIdentity,M0 as randomName,Bo as renderCharacter,Jh as resolveCharacter,ls as resolveLocale,Fi as sanitizeSvg,Hr as setFieldValue,xi as setLocale,lp as stripMarkdown,Er as t,Oa as textToVisemes,ap as toVCard,pe as translator,fs as validate,Gp as version};
|
|
1161
1162
|
//# sourceMappingURL=7ots.esm.js.map
|