@codeuxai/codeux 0.8.1 → 0.8.2

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.
Files changed (26) hide show
  1. package/dashboard/dist/assets/{AgentAvatarScene-DAjdNR8q.js → AgentAvatarScene-3Fa3RQHc.js} +1 -1
  2. package/dashboard/dist/assets/{AgentsPage-dG7HaQww.js → AgentsPage-woorcNHq.js} +2 -2
  3. package/dashboard/dist/assets/{BackgroundManager-CxjNC7ME.js → BackgroundManager-DbgGcx7x.js} +1 -1
  4. package/dashboard/dist/assets/{BranchNameSchemeEditor-wfv629Ml.js → BranchNameSchemeEditor-Bk2p-g2z.js} +1 -1
  5. package/dashboard/dist/assets/{BrowserPage-5eFh6pZt.js → BrowserPage-BLTJo_tK.js} +1 -1
  6. package/dashboard/dist/assets/{ChatPage-CfunB4-0.js → ChatPage-BljTU3OV.js} +1 -1
  7. package/dashboard/dist/assets/{ErrorPage-CEHtK2Hk.js → ErrorPage-DgYd7CGv.js} +1 -1
  8. package/dashboard/dist/assets/{FileBrowserPage-BOVIkrrv.js → FileBrowserPage-ChIelEM6.js} +1 -1
  9. package/dashboard/dist/assets/{KnowledgePage-CeKSiAys.js → KnowledgePage-DP7v0vk3.js} +1 -1
  10. package/dashboard/dist/assets/{ListWindowSelector-cshzGFot.js → ListWindowSelector-DtKcmXGY.js} +1 -1
  11. package/dashboard/dist/assets/{MemoryPage-Cctk6NFp.js → MemoryPage-2N_EfqqO.js} +1 -1
  12. package/dashboard/dist/assets/{OverviewTelemetry-D_V7-M2H.js → OverviewTelemetry-C1hoOMVQ.js} +1 -1
  13. package/dashboard/dist/assets/{ProjectsPage-D8ICYJVv.js → ProjectsPage-CEn6QDXI.js} +1 -1
  14. package/dashboard/dist/assets/{SchedulerPage-BM0sGrEZ.js → SchedulerPage-BDTm8Q3w.js} +1 -1
  15. package/dashboard/dist/assets/{SettingsPage-BlDplYC7.js → SettingsPage-CvSsreD8.js} +1 -1
  16. package/dashboard/dist/assets/{SprintBoatRace-DaP10JYZ.js → SprintBoatRace-Ryphd2ZR.js} +1 -1
  17. package/dashboard/dist/assets/{SprintDag-DbxJdjBK.js → SprintDag-BLP6gb8k.js} +1 -1
  18. package/dashboard/dist/assets/{SprintsPage-XGhd04Sn.js → SprintsPage-DORSqECT.js} +1 -1
  19. package/dashboard/dist/assets/{StatsPage-CrSwtTGq.js → StatsPage-BODQk1cJ.js} +1 -1
  20. package/dashboard/dist/assets/{TasksPage-DNpVBxt6.js → TasksPage-PeouQ4EB.js} +1 -1
  21. package/dashboard/dist/assets/{index-BViPTeJx.js → index-DddY8OV0.js} +5 -5
  22. package/dashboard/dist/assets/{monaco.contribution-KtWzfVt5.js → monaco.contribution-Bxle9Jvf.js} +2 -2
  23. package/dashboard/dist/assets/{tsMode-CalcmZZa.js → tsMode-BYb4cdGe.js} +1 -1
  24. package/dashboard/dist/index.html +1 -1
  25. package/package.json +1 -1
  26. package/.code-ux/debug.log +0 -97190
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-Cyuzqnbw.js";import{a as t,h as n,w as r,x as i,y as a}from"./vendor-Dl0fhdV0.js";import{$n as o,An as s,Bn as c,Dn as l,En as u,Fn as d,Hn as f,In as p,Ln as m,Mn as h,Nn as g,On as _,Pn as v,Rn as y,er as b,jn as x,kn as S,nr as C,tr as w,zn as T}from"./index-BViPTeJx.js";import{A as E,C as D,D as O,E as k,M as A,O as j,T as M,_ as N,a as P,b as F,c as I,d as L,f as R,g as z,h as B,i as V,j as ee,k as te,l as H,m as ne,n as re,p as U,r as W,s as G,t as ie,v as ae,w as K,x as oe,y as se}from"./WebGLRenderer-D904dTMp.js";import{n as ce,t as le}from"./Points-T2ogl268.js";var ue=class extends se{constructor(e,t=1){super(),this.isLight=!0,this.type=`Light`,this.color=new N(e),this.intensity=t}dispose(){this.dispatchEvent({type:`dispose`})}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){let t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,t}},de=class extends ue{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type=`AmbientLight`}},fe=new oe,pe=new k,me=new k,he=class{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.biasNode=null,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new M(512,512),this.mapType=A,this.map=null,this.mapPass=null,this.matrix=new oe,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new U,this._frameExtents=new M(1,1),this._viewportCount=1,this._viewports=[new ne(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,n=this.matrix;pe.setFromMatrixPosition(e.matrixWorld),t.position.copy(pe),me.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(me),t.updateMatrixWorld(),fe.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(fe,t.coordinateSystem,t.reversedDepth),t.coordinateSystem===2001||t.reversedDepth?n.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(fe)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this.biasNode=e.biasNode,this}clone(){return new this.constructor().copy(this)}toJSON(){let e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}},ge=class extends he{constructor(){super(new z(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}},_e=class extends ue{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type=`DirectionalLight`,this.position.copy(se.DEFAULT_UP),this.updateMatrix(),this.target=new se,this.shadow=new ge}dispose(){super.dispose(),this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.shadow=this.shadow.toJSON(),t.object.target=this.target.uuid,t}},ve=class extends ue{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type=`HemisphereLight`,this.position.copy(se.DEFAULT_UP),this.updateMatrix(),this.groundColor=new N(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}toJSON(e){let t=super.toJSON(e);return t.object.groundColor=this.groundColor.getHex(),t}},ye=class extends he{constructor(){super(new B(90,1,.5,500)),this.isPointLightShadow=!0}},be=class extends ue{constructor(e,t,n=0,r=2){super(e,t),this.isPointLight=!0,this.type=`PointLight`,this.distance=n,this.decay=r,this.shadow=new ye}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.distance=this.distance,t.object.decay=this.decay,t.object.shadow=this.shadow.toJSON(),t}},xe=class extends R{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type=`MeshStandardMaterial`,this.defines={STANDARD:``},this.color=new N(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new N(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new M(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new F,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=`round`,this.wireframeLinejoin=`round`,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:``},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}},Se=class extends xe{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:``,PHYSICAL:``},this.type=`MeshPhysicalMaterial`,this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new M(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return j(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(e){this.ior=(1+.4*e)/(1-.4*e)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new N(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new N(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new N(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:``,PHYSICAL:``},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}},Ce=class e extends ae{constructor(e=1,t=32,n=0,r=Math.PI*2){super(),this.type=`CircleGeometry`,this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:r},t=Math.max(3,t);let i=[],a=[],o=[],s=[],c=new k,l=new M;a.push(0,0,0),o.push(0,0,1),s.push(.5,.5);for(let i=0,u=3;i<=t;i++,u+=3){let d=n+i/t*r;c.x=e*Math.cos(d),c.y=e*Math.sin(d),a.push(c.x,c.y,c.z),o.push(0,0,1),l.x=(a[u]/e+1)/2,l.y=(a[u+1]/e+1)/2,s.push(l.x,l.y)}for(let e=1;e<=t;e++)i.push(e,e+1,0);this.setIndex(i),this.setAttribute(`position`,new K(a,3)),this.setAttribute(`normal`,new K(o,3)),this.setAttribute(`uv`,new K(s,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.radius,t.segments,t.thetaStart,t.thetaLength)}},q=class e extends ae{constructor(e=1,t=32,n=16,r=0,i=Math.PI*2,a=0,o=Math.PI){super(),this.type=`SphereGeometry`,this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:r,phiLength:i,thetaStart:a,thetaLength:o},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));let s=Math.min(a+o,Math.PI),c=0,l=[],u=new k,d=new k,f=[],p=[],m=[],h=[];for(let f=0;f<=n;f++){let g=[],_=f/n,v=0;f===0&&a===0?v=.5/t:f===n&&s===Math.PI&&(v=-.5/t);for(let n=0;n<=t;n++){let s=n/t;u.x=-e*Math.cos(r+s*i)*Math.sin(a+_*o),u.y=e*Math.cos(a+_*o),u.z=e*Math.sin(r+s*i)*Math.sin(a+_*o),p.push(u.x,u.y,u.z),d.copy(u).normalize(),m.push(d.x,d.y,d.z),h.push(s+v,1-_),g.push(c++)}l.push(g)}for(let e=0;e<n;e++)for(let r=0;r<t;r++){let t=l[e][r+1],i=l[e][r],o=l[e+1][r],c=l[e+1][r+1];(e!==0||a>0)&&f.push(t,i,c),(e!==n-1||s<Math.PI)&&f.push(i,o,c)}this.setIndex(f),this.setAttribute(`position`,new K(p,3)),this.setAttribute(`normal`,new K(m,3)),this.setAttribute(`uv`,new K(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.radius,t.widthSegments,t.heightSegments,t.phiStart,t.phiLength,t.thetaStart,t.thetaLength)}},J=class e extends ae{constructor(e=1,t=.4,n=12,r=48,i=Math.PI*2,a=0,o=Math.PI*2){super(),this.type=`TorusGeometry`,this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:r,arc:i,thetaStart:a,thetaLength:o},n=Math.floor(n),r=Math.floor(r);let s=[],c=[],l=[],u=[],d=new k,f=new k,p=new k;for(let s=0;s<=n;s++){let m=a+s/n*o;for(let a=0;a<=r;a++){let o=a/r*i;f.x=(e+t*Math.cos(m))*Math.cos(o),f.y=(e+t*Math.cos(m))*Math.sin(o),f.z=t*Math.sin(m),c.push(f.x,f.y,f.z),d.x=e*Math.cos(o),d.y=e*Math.sin(o),p.subVectors(f,d).normalize(),l.push(p.x,p.y,p.z),u.push(a/r),u.push(s/n)}}for(let e=1;e<=n;e++)for(let t=1;t<=r;t++){let n=(r+1)*e+t-1,i=(r+1)*(e-1)+t-1,a=(r+1)*(e-1)+t,o=(r+1)*e+t;s.push(n,i,o),s.push(i,a,o)}this.setIndex(s),this.setAttribute(`position`,new K(c,3)),this.setAttribute(`normal`,new K(l,3)),this.setAttribute(`uv`,new K(u,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.radius,t.tube,t.radialSegments,t.tubularSegments,t.arc)}},Y=class{constructor(){this.type=`Curve`,this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){ee(`Curve: .getPoint() not implemented.`)}getPointAt(e,t){let n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){let t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){let t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){let e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;let t=[],n,r=this.getPoint(0),i=0;t.push(0);for(let a=1;a<=e;a++)n=this.getPoint(a/e),i+=n.distanceTo(r),t.push(i),r=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t=null){let n=this.getLengths(),r=0,i=n.length,a;a=t||e*n[i-1];let o=0,s=i-1,c;for(;o<=s;)if(r=Math.floor(o+(s-o)/2),c=n[r]-a,c<0)o=r+1;else if(c>0)s=r-1;else{s=r;break}if(r=s,n[r]===a)return r/(i-1);let l=n[r],u=n[r+1]-l,d=(a-l)/u;return(r+d)/(i-1)}getTangent(e,t){let n=1e-4,r=e-n,i=e+n;r<0&&(r=0),i>1&&(i=1);let a=this.getPoint(r),o=this.getPoint(i),s=t||(a.isVector2?new M:new k);return s.copy(o).sub(a).normalize(),s}getTangentAt(e,t){let n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t=!1){let n=new k,r=[],i=[],a=[],o=new k,s=new oe;for(let t=0;t<=e;t++){let n=t/e;r[t]=this.getTangentAt(n,new k)}i[0]=new k,a[0]=new k;let c=Number.MAX_VALUE,l=Math.abs(r[0].x),u=Math.abs(r[0].y),d=Math.abs(r[0].z);l<=c&&(c=l,n.set(1,0,0)),u<=c&&(c=u,n.set(0,1,0)),d<=c&&n.set(0,0,1),o.crossVectors(r[0],n).normalize(),i[0].crossVectors(r[0],o),a[0].crossVectors(r[0],i[0]);for(let t=1;t<=e;t++){if(i[t]=i[t-1].clone(),a[t]=a[t-1].clone(),o.crossVectors(r[t-1],r[t]),o.length()>2**-52){o.normalize();let e=Math.acos(j(r[t-1].dot(r[t]),-1,1));i[t].applyMatrix4(s.makeRotationAxis(o,e))}a[t].crossVectors(r[t],i[t])}if(t===!0){let t=Math.acos(j(i[0].dot(i[e]),-1,1));t/=e,r[0].dot(o.crossVectors(i[0],i[e]))>0&&(t=-t);for(let n=1;n<=e;n++)i[n].applyMatrix4(s.makeRotationAxis(r[n],t*n)),a[n].crossVectors(r[n],i[n])}return{tangents:r,normals:i,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){let e={metadata:{version:4.7,type:`Curve`,generator:`Curve.toJSON`}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}},we=class extends Y{constructor(e=0,t=0,n=1,r=1,i=0,a=Math.PI*2,o=!1,s=0){super(),this.isEllipseCurve=!0,this.type=`EllipseCurve`,this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=r,this.aStartAngle=i,this.aEndAngle=a,this.aClockwise=o,this.aRotation=s}getPoint(e,t=new M){let n=t,r=Math.PI*2,i=this.aEndAngle-this.aStartAngle,a=Math.abs(i)<2**-52;for(;i<0;)i+=r;for(;i>r;)i-=r;i<2**-52&&(i=a?0:r),this.aClockwise===!0&&!a&&(i===r?i=-r:i-=r);let o=this.aStartAngle+e*i,s=this.aX+this.xRadius*Math.cos(o),c=this.aY+this.yRadius*Math.sin(o);if(this.aRotation!==0){let e=Math.cos(this.aRotation),t=Math.sin(this.aRotation),n=s-this.aX,r=c-this.aY;s=n*e-r*t+this.aX,c=n*t+r*e+this.aY}return n.set(s,c)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){let e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}},Te=class extends we{constructor(e,t,n,r,i,a){super(e,t,n,n,r,i,a),this.isArcCurve=!0,this.type=`ArcCurve`}};function Ee(){let e=0,t=0,n=0,r=0;function i(i,a,o,s){e=i,t=o,n=-3*i+3*a-2*o-s,r=2*i-2*a+o+s}return{initCatmullRom:function(e,t,n,r,a){i(t,n,a*(n-e),a*(r-t))},initNonuniformCatmullRom:function(e,t,n,r,a,o,s){let c=(t-e)/a-(n-e)/(a+o)+(n-t)/o,l=(n-t)/o-(r-t)/(o+s)+(r-n)/s;c*=o,l*=o,i(t,n,c,l)},calc:function(i){let a=i*i,o=a*i;return e+t*i+n*a+r*o}}}var De=new k,Oe=new Ee,ke=new Ee,Ae=new Ee,je=class extends Y{constructor(e=[],t=!1,n=`centripetal`,r=.5){super(),this.isCatmullRomCurve3=!0,this.type=`CatmullRomCurve3`,this.points=e,this.closed=t,this.curveType=n,this.tension=r}getPoint(e,t=new k){let n=t,r=this.points,i=r.length,a=(i-+!this.closed)*e,o=Math.floor(a),s=a-o;this.closed?o+=o>0?0:(Math.floor(Math.abs(o)/i)+1)*i:s===0&&o===i-1&&(o=i-2,s=1);let c,l;this.closed||o>0?c=r[(o-1)%i]:(De.subVectors(r[0],r[1]).add(r[0]),c=De);let u=r[o%i],d=r[(o+1)%i];if(this.closed||o+2<i?l=r[(o+2)%i]:(De.subVectors(r[i-1],r[i-2]).add(r[i-1]),l=De),this.curveType===`centripetal`||this.curveType===`chordal`){let e=this.curveType===`chordal`?.5:.25,t=c.distanceToSquared(u)**+e,n=u.distanceToSquared(d)**+e,r=d.distanceToSquared(l)**+e;n<1e-4&&(n=1),t<1e-4&&(t=n),r<1e-4&&(r=n),Oe.initNonuniformCatmullRom(c.x,u.x,d.x,l.x,t,n,r),ke.initNonuniformCatmullRom(c.y,u.y,d.y,l.y,t,n,r),Ae.initNonuniformCatmullRom(c.z,u.z,d.z,l.z,t,n,r)}else this.curveType===`catmullrom`&&(Oe.initCatmullRom(c.x,u.x,d.x,l.x,this.tension),ke.initCatmullRom(c.y,u.y,d.y,l.y,this.tension),Ae.initCatmullRom(c.z,u.z,d.z,l.z,this.tension));return n.set(Oe.calc(s),ke.calc(s),Ae.calc(s)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let n=e.points[t];this.points.push(n.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){let n=this.points[t];e.points.push(n.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let n=e.points[t];this.points.push(new k().fromArray(n))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}};function Me(e,t,n,r,i){let a=(r-t)*.5,o=(i-n)*.5,s=e*e,c=e*s;return(2*n-2*r+a+o)*c+(-3*n+3*r-2*a-o)*s+a*e+n}function Ne(e,t){let n=1-e;return n*n*t}function Pe(e,t){return 2*(1-e)*e*t}function Fe(e,t){return e*e*t}function Ie(e,t,n,r){return Ne(e,t)+Pe(e,n)+Fe(e,r)}function Le(e,t){let n=1-e;return n*n*n*t}function Re(e,t){let n=1-e;return 3*n*n*e*t}function ze(e,t){return 3*(1-e)*e*e*t}function Be(e,t){return e*e*e*t}function Ve(e,t,n,r,i){return Le(e,t)+Re(e,n)+ze(e,r)+Be(e,i)}var He=class extends Y{constructor(e=new M,t=new M,n=new M,r=new M){super(),this.isCubicBezierCurve=!0,this.type=`CubicBezierCurve`,this.v0=e,this.v1=t,this.v2=n,this.v3=r}getPoint(e,t=new M){let n=t,r=this.v0,i=this.v1,a=this.v2,o=this.v3;return n.set(Ve(e,r.x,i.x,a.x,o.x),Ve(e,r.y,i.y,a.y,o.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}},Ue=class extends Y{constructor(e=new k,t=new k,n=new k,r=new k){super(),this.isCubicBezierCurve3=!0,this.type=`CubicBezierCurve3`,this.v0=e,this.v1=t,this.v2=n,this.v3=r}getPoint(e,t=new k){let n=t,r=this.v0,i=this.v1,a=this.v2,o=this.v3;return n.set(Ve(e,r.x,i.x,a.x,o.x),Ve(e,r.y,i.y,a.y,o.y),Ve(e,r.z,i.z,a.z,o.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}},We=class extends Y{constructor(e=new M,t=new M){super(),this.isLineCurve=!0,this.type=`LineCurve`,this.v1=e,this.v2=t}getPoint(e,t=new M){let n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new M){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},Ge=class extends Y{constructor(e=new k,t=new k){super(),this.isLineCurve3=!0,this.type=`LineCurve3`,this.v1=e,this.v2=t}getPoint(e,t=new k){let n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new k){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},Ke=class extends Y{constructor(e=new M,t=new M,n=new M){super(),this.isQuadraticBezierCurve=!0,this.type=`QuadraticBezierCurve`,this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new M){let n=t,r=this.v0,i=this.v1,a=this.v2;return n.set(Ie(e,r.x,i.x,a.x),Ie(e,r.y,i.y,a.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},qe=class extends Y{constructor(e=new k,t=new k,n=new k){super(),this.isQuadraticBezierCurve3=!0,this.type=`QuadraticBezierCurve3`,this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new k){let n=t,r=this.v0,i=this.v1,a=this.v2;return n.set(Ie(e,r.x,i.x,a.x),Ie(e,r.y,i.y,a.y),Ie(e,r.z,i.z,a.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},Je=class extends Y{constructor(e=[]){super(),this.isSplineCurve=!0,this.type=`SplineCurve`,this.points=e}getPoint(e,t=new M){let n=t,r=this.points,i=(r.length-1)*e,a=Math.floor(i),o=i-a,s=r[a===0?a:a-1],c=r[a],l=r[a>r.length-2?r.length-1:a+1],u=r[a>r.length-3?r.length-1:a+2];return n.set(Me(o,s.x,c.x,l.x,u.x),Me(o,s.y,c.y,l.y,u.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let n=e.points[t];this.points.push(n.clone())}return this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){let n=this.points[t];e.points.push(n.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let n=e.points[t];this.points.push(new M().fromArray(n))}return this}},Ye=e({ArcCurve:()=>Te,CatmullRomCurve3:()=>je,CubicBezierCurve:()=>He,CubicBezierCurve3:()=>Ue,EllipseCurve:()=>we,LineCurve:()=>We,LineCurve3:()=>Ge,QuadraticBezierCurve:()=>Ke,QuadraticBezierCurve3:()=>qe,SplineCurve:()=>Je}),Xe=class extends Y{constructor(){super(),this.type=`CurvePath`,this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){let e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(t)){let n=e.isVector2===!0?`LineCurve`:`LineCurve3`;this.curves.push(new Ye[n](t,e))}return this}getPoint(e,t){let n=e*this.getLength(),r=this.getCurveLengths(),i=0;for(;i<r.length;){if(r[i]>=n){let e=r[i]-n,a=this.curves[i],o=a.getLength(),s=o===0?0:1-e/o;return a.getPointAt(s,t)}i++}return null}getLength(){let e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;let e=[],t=0;for(let n=0,r=this.curves.length;n<r;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){let t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){let t=[],n;for(let r=0,i=this.curves;r<i.length;r++){let a=i[r],o=a.isEllipseCurve?e*2:a.isLineCurve||a.isLineCurve3?1:a.isSplineCurve?e*a.points.length:e,s=a.getPoints(o);for(let e=0;e<s.length;e++){let r=s[e];n&&n.equals(r)||(t.push(r),n=r)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){let n=e.curves[t];this.curves.push(n.clone())}return this.autoClose=e.autoClose,this}toJSON(){let e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,n=this.curves.length;t<n;t++){let n=this.curves[t];e.curves.push(n.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){let n=e.curves[t];this.curves.push(new Ye[n.type]().fromJSON(n))}return this}},Ze=class extends Xe{constructor(e){super(),this.type=`Path`,this.currentPoint=new M,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){let n=new We(this.currentPoint.clone(),new M(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,r){let i=new Ke(this.currentPoint.clone(),new M(e,t),new M(n,r));return this.curves.push(i),this.currentPoint.set(n,r),this}bezierCurveTo(e,t,n,r,i,a){let o=new He(this.currentPoint.clone(),new M(e,t),new M(n,r),new M(i,a));return this.curves.push(o),this.currentPoint.set(i,a),this}splineThru(e){let t=new Je([this.currentPoint.clone()].concat(e));return this.curves.push(t),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,r,i,a){let o=this.currentPoint.x,s=this.currentPoint.y;return this.absarc(e+o,t+s,n,r,i,a),this}absarc(e,t,n,r,i,a){return this.absellipse(e,t,n,n,r,i,a),this}ellipse(e,t,n,r,i,a,o,s){let c=this.currentPoint.x,l=this.currentPoint.y;return this.absellipse(e+c,t+l,n,r,i,a,o,s),this}absellipse(e,t,n,r,i,a,o,s){let c=new we(e,t,n,r,i,a,o,s);if(this.curves.length>0){let e=c.getPoint(0);e.equals(this.currentPoint)||this.lineTo(e.x,e.y)}this.curves.push(c);let l=c.getPoint(1);return this.currentPoint.copy(l),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){let e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}},Qe=class extends Ze{constructor(e){super(e),this.uuid=te(),this.type=`Shape`,this.holes=[]}getPointsHoles(e){let t=[];for(let n=0,r=this.holes.length;n<r;n++)t[n]=this.holes[n].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){let n=e.holes[t];this.holes.push(n.clone())}return this}toJSON(){let e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,n=this.holes.length;t<n;t++){let n=this.holes[t];e.holes.push(n.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){let n=e.holes[t];this.holes.push(new Ze().fromJSON(n))}return this}};function $e(e,t,n=2){let r=t&&t.length,i=r?t[0]*n:e.length,a=et(e,0,i,n,!0),o=[];if(!a||a.next===a.prev)return o;let s,c,l;if(r&&(a=ot(e,t,a,n)),e.length>80*n){s=e[0],c=e[1];let t=s,r=c;for(let a=n;a<i;a+=n){let n=e[a],i=e[a+1];n<s&&(s=n),i<c&&(c=i),n>t&&(t=n),i>r&&(r=i)}l=Math.max(t-s,r-c),l=l===0?0:32767/l}return tt(a,o,n,s,c,l,0),o}function et(e,t,n,r,i){let a;if(i===kt(e,t,n,r)>0)for(let i=t;i<n;i+=r)a=Et(i/r|0,e[i],e[i+1],a);else for(let i=n-r;i>=t;i-=r)a=Et(i/r|0,e[i],e[i+1],a);return a&&vt(a,a.next)&&(Dt(a),a=a.next),a}function X(e,t){if(!e)return e;t||=e;let n=e,r;do if(r=!1,!n.steiner&&(vt(n,n.next)||Z(n.prev,n,n.next)===0)){if(Dt(n),n=t=n.prev,n===n.next)break;r=!0}else n=n.next;while(r||n!==t);return t}function tt(e,t,n,r,i,a,o){if(!e)return;!o&&a&&dt(e,r,i,a);let s=e;for(;e.prev!==e.next;){let c=e.prev,l=e.next;if(a?rt(e,r,i,a):nt(e)){t.push(c.i,e.i,l.i),Dt(e),e=l.next,s=l.next;continue}if(e=l,e===s){o?o===1?(e=it(X(e),t),tt(e,t,n,r,i,a,2)):o===2&&at(e,t,n,r,i,a):tt(X(e),t,n,r,i,a,1);break}}}function nt(e){let t=e.prev,n=e,r=e.next;if(Z(t,n,r)>=0)return!1;let i=t.x,a=n.x,o=r.x,s=t.y,c=n.y,l=r.y,u=Math.min(i,a,o),d=Math.min(s,c,l),f=Math.max(i,a,o),p=Math.max(s,c,l),m=r.next;for(;m!==t;){if(m.x>=u&&m.x<=f&&m.y>=d&&m.y<=p&&gt(i,s,a,c,o,l,m.x,m.y)&&Z(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function rt(e,t,n,r){let i=e.prev,a=e,o=e.next;if(Z(i,a,o)>=0)return!1;let s=i.x,c=a.x,l=o.x,u=i.y,d=a.y,f=o.y,p=Math.min(s,c,l),m=Math.min(u,d,f),h=Math.max(s,c,l),g=Math.max(u,d,f),_=pt(p,m,t,n,r),v=pt(h,g,t,n,r),y=e.prevZ,b=e.nextZ;for(;y&&y.z>=_&&b&&b.z<=v;){if(y.x>=p&&y.x<=h&&y.y>=m&&y.y<=g&&y!==i&&y!==o&&gt(s,u,c,d,l,f,y.x,y.y)&&Z(y.prev,y,y.next)>=0||(y=y.prevZ,b.x>=p&&b.x<=h&&b.y>=m&&b.y<=g&&b!==i&&b!==o&&gt(s,u,c,d,l,f,b.x,b.y)&&Z(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;y&&y.z>=_;){if(y.x>=p&&y.x<=h&&y.y>=m&&y.y<=g&&y!==i&&y!==o&&gt(s,u,c,d,l,f,y.x,y.y)&&Z(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;b&&b.z<=v;){if(b.x>=p&&b.x<=h&&b.y>=m&&b.y<=g&&b!==i&&b!==o&&gt(s,u,c,d,l,f,b.x,b.y)&&Z(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function it(e,t){let n=e;do{let r=n.prev,i=n.next.next;!vt(r,i)&&yt(r,n,n.next,i)&&Ct(r,i)&&Ct(i,r)&&(t.push(r.i,n.i,i.i),Dt(n),Dt(n.next),n=e=i),n=n.next}while(n!==e);return X(n)}function at(e,t,n,r,i,a){let o=e;do{let e=o.next.next;for(;e!==o.prev;){if(o.i!==e.i&&_t(o,e)){let s=Tt(o,e);o=X(o,o.next),s=X(s,s.next),tt(o,t,n,r,i,a,0),tt(s,t,n,r,i,a,0);return}e=e.next}o=o.next}while(o!==e)}function ot(e,t,n,r){let i=[];for(let n=0,a=t.length;n<a;n++){let o=et(e,t[n]*r,n<a-1?t[n+1]*r:e.length,r,!1);o===o.next&&(o.steiner=!0),i.push(mt(o))}i.sort(st);for(let e=0;e<i.length;e++)n=ct(i[e],n);return n}function st(e,t){let n=e.x-t.x;return n===0&&(n=e.y-t.y,n===0&&(n=(e.next.y-e.y)/(e.next.x-e.x)-(t.next.y-t.y)/(t.next.x-t.x))),n}function ct(e,t){let n=lt(e,t);if(!n)return t;let r=Tt(n,e);return X(r,r.next),X(n,n.next)}function lt(e,t){let n=t,r=e.x,i=e.y,a=-1/0,o;if(vt(e,n))return n;do{if(vt(e,n.next))return n.next;if(i<=n.y&&i>=n.next.y&&n.next.y!==n.y){let e=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(e<=r&&e>a&&(a=e,o=n.x<n.next.x?n:n.next,e===r))return o}n=n.next}while(n!==t);if(!o)return null;let s=o,c=o.x,l=o.y,u=1/0;n=o;do{if(r>=n.x&&n.x>=c&&r!==n.x&&ht(i<l?r:a,i,c,l,i<l?a:r,i,n.x,n.y)){let t=Math.abs(i-n.y)/(r-n.x);Ct(n,e)&&(t<u||t===u&&(n.x>o.x||n.x===o.x&&ut(o,n)))&&(o=n,u=t)}n=n.next}while(n!==s);return o}function ut(e,t){return Z(e.prev,e,t.prev)<0&&Z(t.next,e,e.next)<0}function dt(e,t,n,r){let i=e;do i.z===0&&(i.z=pt(i.x,i.y,t,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,ft(i)}function ft(e){let t,n=1;do{let r=e,i;e=null;let a=null;for(t=0;r;){t++;let o=r,s=0;for(let e=0;e<n&&(s++,o=o.nextZ,o);e++);let c=n;for(;s>0||c>0&&o;)s!==0&&(c===0||!o||r.z<=o.z)?(i=r,r=r.nextZ,s--):(i=o,o=o.nextZ,c--),a?a.nextZ=i:e=i,i.prevZ=a,a=i;r=o}a.nextZ=null,n*=2}while(t>1);return e}function pt(e,t,n,r,i){return e=(e-n)*i|0,t=(t-r)*i|0,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function mt(e){let t=e,n=e;do(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next;while(t!==e);return n}function ht(e,t,n,r,i,a,o,s){return(i-o)*(t-s)>=(e-o)*(a-s)&&(e-o)*(r-s)>=(n-o)*(t-s)&&(n-o)*(a-s)>=(i-o)*(r-s)}function gt(e,t,n,r,i,a,o,s){return!(e===o&&t===s)&&ht(e,t,n,r,i,a,o,s)}function _t(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!St(e,t)&&(Ct(e,t)&&Ct(t,e)&&wt(e,t)&&(Z(e.prev,e,t.prev)||Z(e,t.prev,t))||vt(e,t)&&Z(e.prev,e,e.next)>0&&Z(t.prev,t,t.next)>0)}function Z(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function vt(e,t){return e.x===t.x&&e.y===t.y}function yt(e,t,n,r){let i=xt(Z(e,t,n)),a=xt(Z(e,t,r)),o=xt(Z(n,r,e)),s=xt(Z(n,r,t));return!!(i!==a&&o!==s||i===0&&bt(e,n,t)||a===0&&bt(e,r,t)||o===0&&bt(n,e,r)||s===0&&bt(n,t,r))}function bt(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function xt(e){return e>0?1:e<0?-1:0}function St(e,t){let n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&yt(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}function Ct(e,t){return Z(e.prev,e,e.next)<0?Z(e,t,e.next)>=0&&Z(e,e.prev,t)>=0:Z(e,t,e.prev)<0||Z(e,e.next,t)<0}function wt(e,t){let n=e,r=!1,i=(e.x+t.x)/2,a=(e.y+t.y)/2;do n.y>a!=n.next.y>a&&n.next.y!==n.y&&i<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next;while(n!==e);return r}function Tt(e,t){let n=Ot(e.i,e.x,e.y),r=Ot(t.i,t.x,t.y),i=e.next,a=t.prev;return e.next=t,t.prev=e,n.next=i,i.prev=n,r.next=n,n.prev=r,a.next=r,r.prev=a,r}function Et(e,t,n,r){let i=Ot(e,t,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function Dt(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function Ot(e,t,n){return{i:e,x:t,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function kt(e,t,n,r){let i=0;for(let a=t,o=n-r;a<n;a+=r)i+=(e[o]-e[a])*(e[a+1]+e[o+1]),o=a;return i}var At=class{static triangulate(e,t,n=2){return $e(e,t,n)}},jt=class e{static area(e){let t=e.length,n=0;for(let r=t-1,i=0;i<t;r=i++)n+=e[r].x*e[i].y-e[i].x*e[r].y;return n*.5}static isClockWise(t){return e.area(t)<0}static triangulateShape(e,t){let n=[],r=[],i=[];Mt(e),Nt(n,e);let a=e.length;t.forEach(Mt);for(let e=0;e<t.length;e++)r.push(a),a+=t[e].length,Nt(n,t[e]);let o=At.triangulate(n,r);for(let e=0;e<o.length;e+=3)i.push(o.slice(e,e+3));return i}};function Mt(e){let t=e.length;t>2&&e[t-1].equals(e[0])&&e.pop()}function Nt(e,t){for(let n=0;n<t.length;n++)e.push(t[n].x),e.push(t[n].y)}var Pt=class e extends ae{constructor(e=new Qe([new M(.5,.5),new M(-.5,.5),new M(-.5,-.5),new M(.5,-.5)]),t={}){super(),this.type=`ExtrudeGeometry`,this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];let n=this,r=[],i=[];for(let t=0,n=e.length;t<n;t++){let n=e[t];a(n)}this.setAttribute(`position`,new K(r,3)),this.setAttribute(`uv`,new K(i,2)),this.computeVertexNormals();function a(e){let a=[],o=t.curveSegments===void 0?12:t.curveSegments,s=t.steps===void 0?1:t.steps,c=t.depth===void 0?1:t.depth,l=t.bevelEnabled===void 0?!0:t.bevelEnabled,u=t.bevelThickness===void 0?.2:t.bevelThickness,d=t.bevelSize===void 0?u-.1:t.bevelSize,f=t.bevelOffset===void 0?0:t.bevelOffset,p=t.bevelSegments===void 0?3:t.bevelSegments,m=t.extrudePath,h=t.UVGenerator===void 0?Ft:t.UVGenerator,g,_=!1,v,y,b,x;if(m){g=m.getSpacedPoints(s),_=!0,l=!1;let e=m.isCatmullRomCurve3?m.closed:!1;v=m.computeFrenetFrames(s,e),y=new k,b=new k,x=new k}l||(p=0,u=0,d=0,f=0);let S=e.extractPoints(o),C=S.shape,w=S.holes;if(!jt.isClockWise(C)){C=C.reverse();for(let e=0,t=w.length;e<t;e++){let t=w[e];jt.isClockWise(t)&&(w[e]=t.reverse())}}function T(e){let t=e[0];for(let n=1;n<=e.length;n++){let r=n%e.length,i=e[r],a=i.x-t.x,o=i.y-t.y,s=a*a+o*o,c=Math.max(Math.abs(i.x),Math.abs(i.y),Math.abs(t.x),Math.abs(t.y));if(s<=10000000000000001e-36*c*c){e.splice(r,1),n--;continue}t=i}}T(C),w.forEach(T);let D=w.length,O=C;for(let e=0;e<D;e++){let t=w[e];C=C.concat(t)}function A(e,t,n){return t||E(`ExtrudeGeometry: vec does not exist`),e.clone().addScaledVector(t,n)}let j=C.length;function N(e,t,n){let r,i,a,o=e.x-t.x,s=e.y-t.y,c=n.x-e.x,l=n.y-e.y,u=o*o+s*s,d=o*l-s*c;if(Math.abs(d)>2**-52){let d=Math.sqrt(u),f=Math.sqrt(c*c+l*l),p=t.x-s/d,m=t.y+o/d,h=n.x-l/f,g=n.y+c/f,_=((h-p)*l-(g-m)*c)/(o*l-s*c);r=p+o*_-e.x,i=m+s*_-e.y;let v=r*r+i*i;if(v<=2)return new M(r,i);a=Math.sqrt(v/2)}else{let e=!1;o>2**-52?c>2**-52&&(e=!0):o<-(2**-52)?c<-(2**-52)&&(e=!0):Math.sign(s)===Math.sign(l)&&(e=!0),e?(r=-s,i=o,a=Math.sqrt(u)):(r=o,i=s,a=Math.sqrt(u/2))}return new M(r/a,i/a)}let P=[];for(let e=0,t=O.length,n=t-1,r=e+1;e<t;e++,n++,r++)n===t&&(n=0),r===t&&(r=0),P[e]=N(O[e],O[n],O[r]);let F=[],I,L=P.concat();for(let e=0,t=D;e<t;e++){let t=w[e];I=[];for(let e=0,n=t.length,r=n-1,i=e+1;e<n;e++,r++,i++)r===n&&(r=0),i===n&&(i=0),I[e]=N(t[e],t[r],t[i]);F.push(I),L=L.concat(I)}let R;if(p===0)R=jt.triangulateShape(O,w);else{let e=[],t=[];for(let n=0;n<p;n++){let r=n/p,i=u*Math.cos(r*Math.PI/2),a=d*Math.sin(r*Math.PI/2)+f;for(let t=0,n=O.length;t<n;t++){let n=A(O[t],P[t],a);H(n.x,n.y,-i),r===0&&e.push(n)}for(let e=0,n=D;e<n;e++){let n=w[e];I=F[e];let o=[];for(let e=0,t=n.length;e<t;e++){let t=A(n[e],I[e],a);H(t.x,t.y,-i),r===0&&o.push(t)}r===0&&t.push(o)}}R=jt.triangulateShape(e,t)}let z=R.length,B=d+f;for(let e=0;e<j;e++){let t=l?A(C[e],L[e],B):C[e];_?(b.copy(v.normals[0]).multiplyScalar(t.x),y.copy(v.binormals[0]).multiplyScalar(t.y),x.copy(g[0]).add(b).add(y),H(x.x,x.y,x.z)):H(t.x,t.y,0)}for(let e=1;e<=s;e++)for(let t=0;t<j;t++){let n=l?A(C[t],L[t],B):C[t];_?(b.copy(v.normals[e]).multiplyScalar(n.x),y.copy(v.binormals[e]).multiplyScalar(n.y),x.copy(g[e]).add(b).add(y),H(x.x,x.y,x.z)):H(n.x,n.y,c/s*e)}for(let e=p-1;e>=0;e--){let t=e/p,n=u*Math.cos(t*Math.PI/2),r=d*Math.sin(t*Math.PI/2)+f;for(let e=0,t=O.length;e<t;e++){let t=A(O[e],P[e],r);H(t.x,t.y,c+n)}for(let e=0,t=w.length;e<t;e++){let t=w[e];I=F[e];for(let e=0,i=t.length;e<i;e++){let i=A(t[e],I[e],r);_?H(i.x,i.y+g[s-1].y,g[s-1].x+n):H(i.x,i.y,c+n)}}}V(),ee();function V(){let e=r.length/3;if(l){let e=0,t=j*e;for(let e=0;e<z;e++){let n=R[e];ne(n[2]+t,n[1]+t,n[0]+t)}e=s+p*2,t=j*e;for(let e=0;e<z;e++){let n=R[e];ne(n[0]+t,n[1]+t,n[2]+t)}}else{for(let e=0;e<z;e++){let t=R[e];ne(t[2],t[1],t[0])}for(let e=0;e<z;e++){let t=R[e];ne(t[0]+j*s,t[1]+j*s,t[2]+j*s)}}n.addGroup(e,r.length/3-e,0)}function ee(){let e=r.length/3,t=0;te(O,t),t+=O.length;for(let e=0,n=w.length;e<n;e++){let n=w[e];te(n,t),t+=n.length}n.addGroup(e,r.length/3-e,1)}function te(e,t){let n=e.length;for(;--n>=0;){let r=n,i=n-1;i<0&&(i=e.length-1);for(let e=0,n=s+p*2;e<n;e++){let n=j*e,a=j*(e+1);re(t+r+n,t+i+n,t+i+a,t+r+a)}}}function H(e,t,n){a.push(e),a.push(t),a.push(n)}function ne(e,t,i){U(e),U(t),U(i);let a=r.length/3,o=h.generateTopUV(n,r,a-3,a-2,a-1);W(o[0]),W(o[1]),W(o[2])}function re(e,t,i,a){U(e),U(t),U(a),U(t),U(i),U(a);let o=r.length/3,s=h.generateSideWallUV(n,r,o-6,o-3,o-2,o-1);W(s[0]),W(s[1]),W(s[3]),W(s[1]),W(s[2]),W(s[3])}function U(e){r.push(a[e*3+0]),r.push(a[e*3+1]),r.push(a[e*3+2])}function W(e){i.push(e.x),i.push(e.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){let e=super.toJSON(),t=this.parameters.shapes,n=this.parameters.options;return It(t,n,e)}static fromJSON(t,n){let r=[];for(let e=0,i=t.shapes.length;e<i;e++){let i=n[t.shapes[e]];r.push(i)}let i=t.options.extrudePath;return i!==void 0&&(t.options.extrudePath=new Ye[i.type]().fromJSON(i)),new e(r,t.options)}},Ft={generateTopUV:function(e,t,n,r,i){let a=t[n*3],o=t[n*3+1],s=t[r*3],c=t[r*3+1],l=t[i*3],u=t[i*3+1];return[new M(a,o),new M(s,c),new M(l,u)]},generateSideWallUV:function(e,t,n,r,i,a){let o=t[n*3],s=t[n*3+1],c=t[n*3+2],l=t[r*3],u=t[r*3+1],d=t[r*3+2],f=t[i*3],p=t[i*3+1],m=t[i*3+2],h=t[a*3],g=t[a*3+1],_=t[a*3+2];return Math.abs(s-u)<Math.abs(o-l)?[new M(o,1-c),new M(l,1-d),new M(f,1-m),new M(h,1-_)]:[new M(s,1-c),new M(u,1-d),new M(p,1-m),new M(g,1-_)]}};function It(e,t,n){if(n.shapes=[],Array.isArray(e))for(let t=0,r=e.length;t<r;t++){let r=e[t];n.shapes.push(r.uuid)}else n.shapes.push(e.uuid);return n.options=Object.assign({},t),t.extrudePath!==void 0&&(n.options.extrudePath=t.extrudePath.toJSON()),n}var Lt=class extends W{constructor(e,t,n,r,i,a,o,s,c){super(e,t,n,r,i,a,o,s,c),this.isCanvasTexture=!0,this.needsUpdate=!0}};i();var Rt=/[MLCZmlcz]|-?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?/g;function zt(e,t){let n=e.match(Rt)??[],r=[],i=null,a=``,o=0,s=e=>(e-t.cx)/t.pxPerUnit,c=e=>(t.cy-e)/t.pxPerUnit,l=()=>parseFloat(n[o++]);for(;o<n.length;){let e=n[o];if(/^[MLCZmlcz]$/.test(e)){a=e.toUpperCase(),o++,a===`Z`&&(i?.closePath(),a=``);continue}a===`M`?(i=new Qe,r.push(i),i.moveTo(s(l()),c(l())),a=`L`):a===`L`?i?.lineTo(s(l()),c(l())):a===`C`?i?.bezierCurveTo(s(l()),c(l()),s(l()),c(l()),s(l()),c(l())):o++}return r}function Q(e,t,n){let r=new Pt(zt(e,t),{depth:n.depth,bevelEnabled:!0,bevelSize:n.bevel,bevelThickness:n.bevel,bevelSegments:n.bevelSegments??4,curveSegments:n.curveSegments??14});return r.translate(0,0,-n.depth/2),r}function Bt(e,t=0){let n=e.match(/^#?([\da-f]{6})$/i);return n?parseInt(n[1],16):t}var Vt={cx:_.CX,cy:_.CY,pxPerUnit:_.PX_PER_UNIT},Ht=.3,Ut=.085,Wt=.24,Gt=.31500000000000006,$=(l.eyeR.x-l.eyeL.x)/2/_.PX_PER_UNIT,Kt=l.insetHalfW*2/_.PX_PER_UNIT,qt=-1.04;function Jt(e,t,n){let r=e/2,i=t/2,a=Math.min(n,r,i),o=new Qe;return o.moveTo(-r+a,-i),o.lineTo(r-a,-i),o.quadraticCurveTo(r,-i,r,-i+a),o.lineTo(r,i-a),o.quadraticCurveTo(r,i,r-a,i),o.lineTo(-r+a,i),o.quadraticCurveTo(-r,i,-r,i-a),o.lineTo(-r,-i+a),o.quadraticCurveTo(-r,-i,-r+a,-i),o}function Yt(e,t){let n=e/2,r=t/2,i=new Qe;return i.moveTo(-n,-r+n),i.bezierCurveTo(-n,-r,n,-r,n,-r+n),i.lineTo(n,r-n),i.bezierCurveTo(n,r,-n,r,-n,r-n),i.lineTo(-n,-r+n),i}function Xt(e,t,n,r=4){return new Pt(e,{depth:t,bevelEnabled:!0,bevelSize:n,bevelThickness:n,bevelSegments:r,curveSegments:24})}function Zt(e){try{let t=[],n=e>>16&255,r=e>>8&255,i=e&255,a=(e,t,n,r)=>{let i=128*t,a=128*n,o=e.createLinearGradient(0,i,0,i+a);o.addColorStop(0,`rgba(255,255,255,0)`),o.addColorStop(.5,`rgba(255,250,244,${r})`),o.addColorStop(1,`rgba(255,255,255,0)`),e.fillStyle=o,e.fillRect(0,i,128,a)};for(let e=0;e<6;e++){let o=document.createElement(`canvas`);o.width=128,o.height=128;let s=o.getContext(`2d`);if(!s||typeof s.createLinearGradient!=`function`)return null;let c=s.createLinearGradient(0,0,0,128);if(c.addColorStop(0,`rgb(46,48,58)`),c.addColorStop(.55,`rgb(20,21,27)`),c.addColorStop(1,`rgb(7,7,10)`),s.fillStyle=c,s.fillRect(0,0,128,128),e===2){let e=s.createRadialGradient(128/2,128/2,6,128/2,128/2,128*.72);e.addColorStop(0,`rgba(255,252,246,0.95)`),e.addColorStop(1,`rgba(255,255,255,0.05)`),s.fillStyle=e,s.fillRect(0,0,128,128)}else if(e===0)a(s,.16,.3,.85);else if(e===1)a(s,.22,.26,.4);else if(e===4)a(s,.2,.2,.28);else if(e===5){let e=s.createRadialGradient(128/2,128*.62,4,128/2,128*.62,128*.6);e.addColorStop(0,`rgba(${n},${r},${i},0.7)`),e.addColorStop(1,`rgba(0,0,0,0)`),s.fillStyle=e,s.fillRect(0,0,128,128)}else e===3&&(s.fillStyle=`rgba(64,52,40,0.35)`,s.fillRect(0,0,128,128));for(let e=0;e<90;e++)s.fillStyle=`rgba(255,255,255,${Math.random()*.05})`,s.fillRect(Math.random()*128,Math.random()*128,1,1);t.push(o)}let o=new re(t);return o.needsUpdate=!0,o}catch{return null}}function Qt(){try{let e=document.createElement(`canvas`);e.width=128,e.height=128;let t=e.getContext(`2d`);if(!t||typeof t.createRadialGradient!=`function`)return null;let n=t.createRadialGradient(128/2,128/2,2,128/2,128/2,128/2);return n.addColorStop(0,`rgba(0,0,0,0.55)`),n.addColorStop(.6,`rgba(0,0,0,0.22)`),n.addColorStop(1,`rgba(0,0,0,0)`),t.fillStyle=n,t.fillRect(0,0,128,128),new Lt(e)}catch{return null}}function $t(e){let{shell:t,inset:n,accent:r,envMap:i,light:a}=e;return{shell:new Se({color:t,metalness:.05,roughness:.34,clearcoat:.9,clearcoatRoughness:.32,envMap:i,envMapIntensity:a?.85:1}),inset:new Se({color:n,metalness:.1,roughness:.16,clearcoat:1,clearcoatRoughness:.1,envMap:i,envMapIntensity:1.15}),bezel:new xe({color:1052688,metalness:.7,roughness:.35,envMap:i,envMapIntensity:.4}),jade:new xe({color:r,emissive:r,emissiveIntensity:.95,metalness:.4,roughness:.18,envMap:i,envMapIntensity:.55}),jadeStem:new xe({color:r,emissive:r,emissiveIntensity:.7,metalness:.35,roughness:.25,envMap:i,envMapIntensity:.45}),jadeGlow:new L({color:r,transparent:!0,opacity:.45}),glint:new L({color:15663096,transparent:!0,opacity:.85}),sheen:new L({color:16777215,transparent:!0,opacity:.07,depthWrite:!1})}}function en(e,t,n){if(e===`bumper`)return;let r=c(l.earL.y),i=T(l.earL.x),a=T(l.earR.x),o=[{x:i,sign:-1},{x:a,sign:1}];if(e===`studio`){let e=new P(new J(Math.abs(i),.045,12,56,Math.PI),n.shell);e.position.set(0,r,.04),t.add(e),o.forEach(({x:e,sign:i})=>{let a=new q(.23,26,26);a.scale(.72,1,.85);let o=new P(a,n.inset);o.position.set(e+i*.04,r,.05),t.add(o);let s=new q(.12,20,20);s.scale(.5,1,1);let c=new P(s,n.jade);c.position.set(e+i*.16,r,.05),t.add(c);let l=new P(new J(.21,.016,10,36),n.shell);l.scale.set(.75,1,1),l.position.set(e+i*.02,r,.08),t.add(l)});return}if(e===`earbuds`){o.forEach(({x:e,sign:i})=>{let a=new P(new q(.09,20,20),n.jade);a.position.set(e+i*.08,r,.12),t.add(a);let o=new P(new J(.17,.013,8,24,Math.PI/2),n.jadeStem);o.rotation.z=i>0?-Math.PI/2:Math.PI,o.position.set(e+i*.08,r-.12,.12),t.add(o)});return}if(e===`loop`){o.forEach(({x:e})=>{let i=new P(new J(.2,.034,12,44),n.jade);i.scale.set(.72,1,1),i.position.set(e,r,.16),t.add(i);let a=new P(new Ce(.16,32),n.jadeGlow);a.scale.set(.72,1,1),a.position.set(e,r,.14),t.add(a)});return}if(e===`fins`){o.forEach(({x:e,sign:i})=>{let a=new Qe;a.moveTo(0,.2),a.lineTo(i*.4,-.05),a.lineTo(i*.46,-.18),a.lineTo(i*.13,-.13),a.lineTo(0,-.05),a.lineTo(0,.2);let o=new P(new Pt(a,{depth:.045,bevelEnabled:!0,bevelSize:.012,bevelThickness:.012,bevelSegments:3,curveSegments:16}),n.jade);o.position.set(e,r,.04),t.add(o)});return}}function tn(e,t){let n=new G,r=new G;n.add(r);let i=y(e.chassis),a=new G;a.scale.set(i.scaleX,i.scaleY,1),r.add(a);let o=new P(Q(p,Vt,{depth:Ht,bevel:Ut,bevelSegments:6,curveSegments:20}),t.shell);a.add(o);let u=new P(Q(h,Vt,{depth:.14,bevel:.05,bevelSegments:5,curveSegments:16}),t.shell);a.add(u);let f=new P(Q(g,Vt,{depth:.14,bevel:.05,bevelSegments:5,curveSegments:16}),t.shell);a.add(f);let b=new P(Q(m,Vt,{depth:.05,bevel:.03,bevelSegments:5,curveSegments:20}),t.inset);b.position.set(0,0,Wt),a.add(b);let C=new P(new I(.8,.2),t.sheen);C.rotation.z=-.3,C.position.set(-.24,-.18,.29900000000000004),a.add(C);let w=new P(new I(.8,.06),t.sheen);w.rotation.z=-.3,w.position.set(-.28,-.32,.29900000000000004),a.add(w);let E=new G;a.add(E),E.position.set(T(l.eyeMid.x),c(l.eyeMid.y),Gt);let D=e.eyes??`smile`,O,k=null,A=`smile`;if(D===`visor`){A=`visor`;let e=new G,n=Kt*.95,r=.24,i=.07,a=new P(Xt(Jt(n+.04,.27999999999999997,r*.48),.02,.005,3),t.inset);a.position.set(0,0,-.02),e.add(a);let o=new P(Xt(Jt(n,r,r*.45),i,.014,5),t.jade);e.add(o);let s=new xe({color:531734,emissive:268818,emissiveIntensity:.45,metalness:.55,roughness:.2}),c=new P(Xt(Jt(n*.92,r*.55,r*.22),.015,.004,3),s);c.position.set(0,0,i*.75),e.add(c);let l=new P(new H(n*.85,r*.2,.006),t.sheen);l.position.set(0,r*.32,i*.95),e.add(l);let u=new q(.034,18,18),d=new P(u,t.jade);d.position.set(-$,0,i*.95),e.add(d);let f=new P(u,t.jade);f.position.set($,0,i*.95),e.add(f);let p=new q(.013,12,12),m=new P(p,t.glint);m.position.set(-$,.005,.08800000000000001),e.add(m);let h=new P(p,t.glint);h.position.set($,.005,.08800000000000001),e.add(h);let g=Xt(Jt(.016,.085,.006),.018,.003,2);[-1,1].forEach(r=>{let a=new P(g,t.jade);a.position.set(r*n*.46,0,i*.85),e.add(a);let o=new P(g,t.jade);o.position.set(r*n*.42,0,i*.85),o.scale.set(1,.55,1),e.add(o)}),E.add(e),O=e}else if(D===`heart`){A=`heart`;let e=e=>{let n=new G,r=new q(.06,18,18),i=new P(r,t.jade);i.position.set(-.04,.025,0);let a=new P(r,t.jade);a.position.set(.04,.025,0),n.add(i),n.add(a);let o=new Qe;o.moveTo(-.07,.02),o.lineTo(.07,.02),o.lineTo(0,-.09),o.lineTo(-.07,.02);let s=new Pt(o,{depth:.04,bevelEnabled:!0,bevelSize:.008,bevelThickness:.008,bevelSegments:3,curveSegments:12});return n.add(new P(s,t.jade)),n.scale.set(1.75,1.75,1.75),n.position.set(e*$,0,.05),E.add(n),n};O=e(-1),k=e(1)}else if(D===`single`){A=`single`,O=new P(new q(.19,32,32),t.jade),E.add(O);let e=new P(new J(.24,.018,12,48),t.jade);E.add(e),k=e;let n=new P(new q(.045,10,10),t.glint);n.position.set(-.055,.055,.17),E.add(n)}else if(D===`pixel`){A=`pixel`;let e=new H(.16,.16,.05);O=new P(e,t.jade),O.position.set(-$,0,.02),E.add(O),k=new P(e,t.jade),k.position.set($,0,.02),E.add(k)}else{A=`smile`;let e={depth:.045,bevel:.014,bevelSegments:4,curveSegments:16};O=new P(Q(v,{cx:l.eyeL.x,cy:l.eyeL.y,pxPerUnit:_.PX_PER_UNIT},e),t.jade),O.position.set(-$,0,.02),E.add(O),k=new P(Q(d,{cx:l.eyeR.x,cy:l.eyeR.y,pxPerUnit:_.PX_PER_UNIT},e),t.jade),k.position.set($,0,.02),E.add(k)}en(e.headphones??`bumper`,a,t);let j=new G;a.add(j),j.position.set(T(l.antennaPivot.x),c(l.antennaPivot.y),0);let M=e.antenna??`jewel`,N=null,F={cx:l.antennaPivot.x,cy:l.antennaPivot.y,pxPerUnit:_.PX_PER_UNIT};if(M===`bunny`)[-1,1].forEach(e=>{let n=new P(Xt(Yt(.07,.42),.04,.012,3),t.jade);n.position.set(e*.18,.16,.02),n.rotation.z=e*.38,j.add(n);let r=new P(new q(.07,18,18),t.jade);r.position.set(e*.34,.36,.03),j.add(r),N||=r});else if(M===`beam`){let e=new P(Xt(Yt(.05,.46),.04,.01,3),t.jade);e.position.set(0,.2,.02),j.add(e);let n=new P(new q(.1,20,20),t.jade);n.position.set(0,.46,.03),j.add(n),N=n;let r=new P(new J(.16,.012,8,32),t.jadeGlow);r.rotation.x=Math.PI/2,r.position.copy(n.position),j.add(r)}else if(M===`wifi`){let e=new P(new q(.05,16,16),t.jade);e.position.set(0,.03,.02),j.add(e),N=e,[.15,.23,.31].forEach(e=>{let n=new P(new J(e,.018,10,24,Math.PI),t.jade);n.position.set(0,.03,.02),j.add(n)})}else if(M!==`none`){let e={depth:.07,bevel:.02,bevelSegments:4,curveSegments:14},n=new P(Q(S,F,e),t.jade);j.add(n),N=n;let r=new P(Q(s,F,e),t.jadeStem);j.add(r);let i=new P(Q(x,F,e),t.jadeStem);j.add(i)}let R=new G;n.add(R);let z=e.wings??`none`,B={kind:z};if(z===`halo`){let e=new P(new J(1,.035,12,80),t.jade);e.rotation.x=Math.PI/2.4,e.position.set(0,.95,-.2),R.add(e),B.halo=e;let n=new P(new J(.82,.02,10,64),t.jade);n.rotation.x=Math.PI/2.4,n.position.set(0,.95,-.2),R.add(n),[-1,0,1].forEach(e=>{let n=new P(new q(.04,14,14),t.jade),r=Math.PI/3*e+Math.PI/2;n.position.set(Math.cos(r)*1,.95+Math.sin(r)*.38-.05,-.2),R.add(n)})}else if(z===`pulse`){let e=new P(new J(1.1,.025,12,80),t.jade);e.rotation.x=Math.PI/2,e.position.y=-.95,R.add(e),B.r1=e;let n=new P(new J(1.3,.018,12,80),t.jadeStem);n.rotation.x=Math.PI/2,n.position.y=-.98,R.add(n),B.r2=n;let r=new P(new J(1.2,.014,10,64),t.jade);r.rotation.x=Math.PI/2,r.rotation.z=Math.PI/8,r.position.y=-.92,R.add(r),B.r3=r}else if(z===`orbit`){let e=[];[0,Math.PI*2/3,Math.PI*4/3].forEach(n=>{let r=new P(new q(.07,18,18),t.jade);r.position.set(Math.cos(n)*1.45,0,Math.sin(n)*.35),r.userData.phase=n,R.add(r),e.push(r)}),B.orbits=e}let V=null,ee=Qt();if(ee){let e=new L({map:ee,transparent:!0,opacity:.32,depthWrite:!1});V=new P(new I(2.2,.9),e),V.rotation.x=-Math.PI/2,V.position.set(0,qt,0),n.add(V)}return{root:n,headGroup:r,innerGroup:a,shell:o,inset:b,ears:[u,f],eyesGroup:E,leftEye:O,rightEye:k,eyesKind:A,antennaGroup:j,antennaTip:N,auraGroup:R,auraRefs:B,shadow:V}}function nn(e,t=[]){let n=new Set,r=new Set,i=new Set;e.traverse(e=>{let t=e;t.geometry&&!r.has(t.geometry)&&(r.add(t.geometry),t.geometry.dispose());let a=t.material;if(!a)return;let o=Array.isArray(a)?a:[a];for(let e of o){if(n.has(e))continue;n.add(e);let t=e;t.map&&!i.has(t.map)&&i.add(t.map),t.envMap&&!i.has(t.envMap)&&i.add(t.envMap),t.normalMap&&!i.has(t.normalMap)&&i.add(t.normalMap),e.dispose()}});for(let e of t)e&&!i.has(e)&&i.add(e);for(let e of i)e.dispose()}function rn({config:e=f,expression:i=`happy`,className:s=``,fallbackMode:c=!1}){let l=n(null),[d,p]=a(!1),[m,h]=a(!1),g=n(null),_=n(null),v=n({x:0,y:0,active:!1});r(()=>{if(typeof window>`u`||!window.matchMedia)return;let e=window.matchMedia(`(prefers-reduced-motion: reduce)`);h(e.matches);let t=e=>h(e.matches);return e.addEventListener?.(`change`,t),()=>e.removeEventListener?.(`change`,t)},[]);let y=`${e.chassis}-${e.eyes}-${e.antenna}-${e.wings}-${e.headphones}-${e.accent}-${e.baseColor}-${e.visorColor}`;return r(()=>{if(c||d)return;let e=l.current;if(!e)return;let t;try{t=new ie({alpha:!0,antialias:!0})}catch{p(!0);return}let{clientWidth:n,clientHeight:r}=e;t.setSize(n,r),t.setPixelRatio(Math.min(window.devicePixelRatio,2)),t.toneMapping=4,t.toneMappingExposure=1.15,e.appendChild(t.domElement);let i=new V,a=new B(34,n/r,.1,100);a.position.set(0,.12,4.8),a.lookAt(0,-.02,0);let o=new de(16777215,.3);i.add(o);let s=new ve(13623551,1315344,.5);i.add(s);let u=new _e(16777215,1.25);u.position.set(2.6,4.2,4.6),i.add(u);let f=new _e(11982079,.4);f.position.set(-3.6,1.2,2.6),i.add(f);let m=new _e(16767395,.3);m.position.set(0,2.6,-4),i.add(m);let h=new be(60075,1,8);h.position.set(0,-1.7,2.1),i.add(h);let y=new be(60075,.35,6);y.position.set(0,2.4,1.6),i.add(y);let b=new G;i.add(b),g.current={renderer:t,scene:i,camera:a,avatarGroup:b,ambient:o,rim:h,kicker:y,animationId:0};let x=()=>{let e=g.current;if(!l.current||!e)return;let{clientWidth:t,clientHeight:n}=l.current;e.renderer.setSize(t,n),e.camera.aspect=t/n,e.camera.updateProjectionMatrix()};window.addEventListener(`resize`,x);let S=t=>{let n=e.getBoundingClientRect();!n.width||!n.height||(v.current.x=(t.clientX-n.left)/n.width*2-1,v.current.y=(t.clientY-n.top)/n.height*2-1,v.current.active=!0)},C=()=>{v.current.active=!1};return e.addEventListener(`pointermove`,S),e.addEventListener(`pointerleave`,C),()=>{window.removeEventListener(`resize`,x),e.removeEventListener(`pointermove`,S),e.removeEventListener(`pointerleave`,C);let t=g.current;if(t){cancelAnimationFrame(t.animationId),_.current&&=(nn(t.avatarGroup,[_.current.envMap]),null),e.contains(t.renderer.domElement)&&e.removeChild(t.renderer.domElement);try{t.renderer.forceContextLoss()}catch{}t.renderer.dispose(),g.current=null}}},[c,d]),r(()=>{let t=g.current;if(!t||c||d)return;_.current&&=(t.avatarGroup.remove(_.current.parts.root),t.avatarGroup.remove(_.current.particles),nn(_.current.parts.root,[_.current.envMap]),_.current.particles.geometry.dispose(),_.current.particles.material.dispose(),null);let n=Bt(o(e.accent),60075),r=Bt(w(e.baseColor),16579580),i=Bt(b(e.baseColor,e.visorColor)),a=C(e.baseColor);t.ambient.intensity=a?.42:.3,t.rim.color.setHex(n),t.kicker.color.setHex(n);let s=Zt(n),l=tn(e,$t({shell:r,inset:i,accent:n,envMap:s,light:a}));t.avatarGroup.add(l.root);let u=e.wings===`dust`?36:16,f=new ae,p=new Float32Array(u*3);for(let e=0;e<u;e++)p[e*3]=(Math.random()-.5)*3.2,p[e*3+1]=-1.6+Math.random()*3.6,p[e*3+2]=-.6+Math.random()*.8;f.setAttribute(`position`,new D(p,3));let m=new le(f,new ce({color:n,size:e.wings===`dust`?.045:.025,transparent:!0,opacity:e.wings===`dust`?.7:.4}));t.avatarGroup.add(m),_.current={parts:l,particles:m,envMap:s}},[y,c,d]),r(()=>{let e=g.current;if(!e||c||d)return;let t=0,n=3+Math.random()*2,r=0,a=0,o=.04,s=1.4,l=.05,u=!1,f=1,p=.95;switch(i){case`happy`:o=.06,s=1.8,p=1;break;case`sad`:r=.14,o=.02,s=.6,u=!0,p=.4;break;case`angry`:r=-.05,o=.03,s=2.6,u=!0,f=.7,l=.1,p=1.25;break;case`sleepy`:f=.18,a=.18,r=.08,o=.02,s=.5,l=.015,p=.35;break;case`bored`:f=.35,a=.08,o=.02,s=.7,p=.5;break;case`hyped`:o=.14,s=3.2,l=.14,f=1.2,p=1.4;break;case`shake_head`:case`nod`:o=.04;break}let h=()=>{let e=g.current;if(!e)return;e.animationId=requestAnimationFrame(h);let c=_.current;if(!c){e.renderer.render(e.scene,e.camera);return}if(m){e.renderer.render(e.scene,e.camera);return}let d=c.parts,y=c.particles;t+=.016;let b=Math.sin(t*s)*o+.02;e.avatarGroup.position.y=b;let x=1+Math.sin(t*1.5)*.012;if(d.headGroup.scale.set(x,x,x),d.shadow){d.shadow.position.y=qt-b;let e=1-b*.35;d.shadow.scale.set(e,e,e),d.shadow.material.opacity=Math.max(.16,.34-b*.6)}let S=v.current;if(i===`shake_head`)d.headGroup.rotation.y=Math.sin(t*5)*.25;else if(i===`nod`)d.headGroup.rotation.x=Math.sin(t*4)*.18;else{let e=S.active?S.x*.34:Math.sin(t*.4)*.06,n=r+(S.active?S.y*.16:0);d.headGroup.rotation.y=O.lerp(d.headGroup.rotation.y,e,S.active?.12:.08),d.headGroup.rotation.x=O.lerp(d.headGroup.rotation.x,n,.08),d.headGroup.rotation.z=O.lerp(d.headGroup.rotation.z,a,.06)}d.antennaGroup.rotation.z=Math.sin(t*2)*l;let C=1;if(t>n){let e=t-n;e<.16?C=1-e/.16:e<.32?C=(e-.16)/.16:n=t+3+Math.random()*3}let w=f*Math.max(.08,C),T=d.eyesKind===`smile`&&u?-w:w;d.leftEye.scale.y=O.lerp(d.leftEye.scale.y,T,.35),d.rightEye&&(d.rightEye.scale.y=O.lerp(d.rightEye.scale.y,T,.35));let E=p*(.85+Math.sin(t*2.4)*.2),D=d.antennaTip?.material;if(D&&(D.emissiveIntensity=O.lerp(D.emissiveIntensity,E*1.05,.08)),d.auraRefs.kind===`pulse`&&d.auraRefs.r1&&d.auraRefs.r2){let e=1+Math.sin(t*1.8)*.06,n=1+Math.sin(t*1.8+.5)*.05;if(d.auraRefs.r1.scale.set(e,e,e),d.auraRefs.r2.scale.set(n*1.04,n*1.04,n*1.04),d.auraRefs.r3){let e=1+Math.sin(t*1.8+1)*.04;d.auraRefs.r3.scale.set(e*1.02,e*1.02,e*1.02),d.auraRefs.r3.rotation.z+=.004}}d.auraRefs.kind===`halo`&&d.auraRefs.halo&&(d.auraGroup.rotation.y+=.006),d.auraRefs.kind===`orbit`&&d.auraRefs.orbits&&d.auraRefs.orbits.forEach(e=>{let n=(e.userData.phase??0)+t*.6;e.position.x=Math.cos(n)*1.5,e.position.z=Math.sin(n)*.45,e.position.y=Math.sin(n*.5)*.18});let k=y.geometry.getAttribute(`position`);if(k&&k.count){for(let e=0;e<k.count;e++){let n=k.getY(e);n+=.008,n>2.4&&(n=-1.6),k.setY(e,n),k.setX(e,k.getX(e)+Math.sin(t+e*.4)*8e-4)}k.needsUpdate=!0}e.renderer.render(e.scene,e.camera)};return cancelAnimationFrame(e.animationId),h(),()=>{let e=g.current;e&&cancelAnimationFrame(e.animationId)}},[i,m,c,d]),c||d?t(`div`,{className:`flex items-center justify-center rounded-2xl bg-slate-50 dark:bg-void-800/40 ${s}`,style:{minHeight:`200px`,width:`100%`,height:`100%`},"data-testid":`agent-avatar-fallback`,children:t(u,{config:e,expression:i,className:`w-full h-full max-w-[220px]`})}):t(`div`,{ref:l,className:`w-full h-full relative ${s}`,style:{minHeight:`200px`},"data-testid":`agent-avatar-scene`})}export{rn as AgentAvatarScene};
1
+ import{r as e}from"./rolldown-runtime-Cyuzqnbw.js";import{a as t,h as n,w as r,x as i,y as a}from"./vendor-Dl0fhdV0.js";import{$n as o,An as s,Bn as c,Dn as l,En as u,Fn as d,Hn as f,In as p,Ln as m,Mn as h,Nn as g,On as _,Pn as v,Rn as y,er as b,jn as x,kn as S,nr as C,tr as w,zn as T}from"./index-DddY8OV0.js";import{A as E,C as D,D as O,E as k,M as A,O as j,T as M,_ as N,a as P,b as F,c as I,d as L,f as R,g as z,h as B,i as V,j as ee,k as te,l as H,m as ne,n as re,p as U,r as W,s as G,t as ie,v as ae,w as K,x as oe,y as se}from"./WebGLRenderer-D904dTMp.js";import{n as ce,t as le}from"./Points-T2ogl268.js";var ue=class extends se{constructor(e,t=1){super(),this.isLight=!0,this.type=`Light`,this.color=new N(e),this.intensity=t}dispose(){this.dispatchEvent({type:`dispose`})}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){let t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,t}},de=class extends ue{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type=`AmbientLight`}},fe=new oe,pe=new k,me=new k,he=class{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.biasNode=null,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new M(512,512),this.mapType=A,this.map=null,this.mapPass=null,this.matrix=new oe,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new U,this._frameExtents=new M(1,1),this._viewportCount=1,this._viewports=[new ne(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,n=this.matrix;pe.setFromMatrixPosition(e.matrixWorld),t.position.copy(pe),me.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(me),t.updateMatrixWorld(),fe.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(fe,t.coordinateSystem,t.reversedDepth),t.coordinateSystem===2001||t.reversedDepth?n.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(fe)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this.biasNode=e.biasNode,this}clone(){return new this.constructor().copy(this)}toJSON(){let e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}},ge=class extends he{constructor(){super(new z(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}},_e=class extends ue{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type=`DirectionalLight`,this.position.copy(se.DEFAULT_UP),this.updateMatrix(),this.target=new se,this.shadow=new ge}dispose(){super.dispose(),this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.shadow=this.shadow.toJSON(),t.object.target=this.target.uuid,t}},ve=class extends ue{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type=`HemisphereLight`,this.position.copy(se.DEFAULT_UP),this.updateMatrix(),this.groundColor=new N(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}toJSON(e){let t=super.toJSON(e);return t.object.groundColor=this.groundColor.getHex(),t}},ye=class extends he{constructor(){super(new B(90,1,.5,500)),this.isPointLightShadow=!0}},be=class extends ue{constructor(e,t,n=0,r=2){super(e,t),this.isPointLight=!0,this.type=`PointLight`,this.distance=n,this.decay=r,this.shadow=new ye}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e);return t.object.distance=this.distance,t.object.decay=this.decay,t.object.shadow=this.shadow.toJSON(),t}},xe=class extends R{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type=`MeshStandardMaterial`,this.defines={STANDARD:``},this.color=new N(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new N(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new M(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new F,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=`round`,this.wireframeLinejoin=`round`,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:``},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}},Se=class extends xe{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:``,PHYSICAL:``},this.type=`MeshPhysicalMaterial`,this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new M(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return j(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(e){this.ior=(1+.4*e)/(1-.4*e)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new N(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new N(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new N(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:``,PHYSICAL:``},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}},Ce=class e extends ae{constructor(e=1,t=32,n=0,r=Math.PI*2){super(),this.type=`CircleGeometry`,this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:r},t=Math.max(3,t);let i=[],a=[],o=[],s=[],c=new k,l=new M;a.push(0,0,0),o.push(0,0,1),s.push(.5,.5);for(let i=0,u=3;i<=t;i++,u+=3){let d=n+i/t*r;c.x=e*Math.cos(d),c.y=e*Math.sin(d),a.push(c.x,c.y,c.z),o.push(0,0,1),l.x=(a[u]/e+1)/2,l.y=(a[u+1]/e+1)/2,s.push(l.x,l.y)}for(let e=1;e<=t;e++)i.push(e,e+1,0);this.setIndex(i),this.setAttribute(`position`,new K(a,3)),this.setAttribute(`normal`,new K(o,3)),this.setAttribute(`uv`,new K(s,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.radius,t.segments,t.thetaStart,t.thetaLength)}},q=class e extends ae{constructor(e=1,t=32,n=16,r=0,i=Math.PI*2,a=0,o=Math.PI){super(),this.type=`SphereGeometry`,this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:r,phiLength:i,thetaStart:a,thetaLength:o},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));let s=Math.min(a+o,Math.PI),c=0,l=[],u=new k,d=new k,f=[],p=[],m=[],h=[];for(let f=0;f<=n;f++){let g=[],_=f/n,v=0;f===0&&a===0?v=.5/t:f===n&&s===Math.PI&&(v=-.5/t);for(let n=0;n<=t;n++){let s=n/t;u.x=-e*Math.cos(r+s*i)*Math.sin(a+_*o),u.y=e*Math.cos(a+_*o),u.z=e*Math.sin(r+s*i)*Math.sin(a+_*o),p.push(u.x,u.y,u.z),d.copy(u).normalize(),m.push(d.x,d.y,d.z),h.push(s+v,1-_),g.push(c++)}l.push(g)}for(let e=0;e<n;e++)for(let r=0;r<t;r++){let t=l[e][r+1],i=l[e][r],o=l[e+1][r],c=l[e+1][r+1];(e!==0||a>0)&&f.push(t,i,c),(e!==n-1||s<Math.PI)&&f.push(i,o,c)}this.setIndex(f),this.setAttribute(`position`,new K(p,3)),this.setAttribute(`normal`,new K(m,3)),this.setAttribute(`uv`,new K(h,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.radius,t.widthSegments,t.heightSegments,t.phiStart,t.phiLength,t.thetaStart,t.thetaLength)}},J=class e extends ae{constructor(e=1,t=.4,n=12,r=48,i=Math.PI*2,a=0,o=Math.PI*2){super(),this.type=`TorusGeometry`,this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:r,arc:i,thetaStart:a,thetaLength:o},n=Math.floor(n),r=Math.floor(r);let s=[],c=[],l=[],u=[],d=new k,f=new k,p=new k;for(let s=0;s<=n;s++){let m=a+s/n*o;for(let a=0;a<=r;a++){let o=a/r*i;f.x=(e+t*Math.cos(m))*Math.cos(o),f.y=(e+t*Math.cos(m))*Math.sin(o),f.z=t*Math.sin(m),c.push(f.x,f.y,f.z),d.x=e*Math.cos(o),d.y=e*Math.sin(o),p.subVectors(f,d).normalize(),l.push(p.x,p.y,p.z),u.push(a/r),u.push(s/n)}}for(let e=1;e<=n;e++)for(let t=1;t<=r;t++){let n=(r+1)*e+t-1,i=(r+1)*(e-1)+t-1,a=(r+1)*(e-1)+t,o=(r+1)*e+t;s.push(n,i,o),s.push(i,a,o)}this.setIndex(s),this.setAttribute(`position`,new K(c,3)),this.setAttribute(`normal`,new K(l,3)),this.setAttribute(`uv`,new K(u,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(t){return new e(t.radius,t.tube,t.radialSegments,t.tubularSegments,t.arc)}},Y=class{constructor(){this.type=`Curve`,this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){ee(`Curve: .getPoint() not implemented.`)}getPointAt(e,t){let n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){let t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){let t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){let e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;let t=[],n,r=this.getPoint(0),i=0;t.push(0);for(let a=1;a<=e;a++)n=this.getPoint(a/e),i+=n.distanceTo(r),t.push(i),r=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t=null){let n=this.getLengths(),r=0,i=n.length,a;a=t||e*n[i-1];let o=0,s=i-1,c;for(;o<=s;)if(r=Math.floor(o+(s-o)/2),c=n[r]-a,c<0)o=r+1;else if(c>0)s=r-1;else{s=r;break}if(r=s,n[r]===a)return r/(i-1);let l=n[r],u=n[r+1]-l,d=(a-l)/u;return(r+d)/(i-1)}getTangent(e,t){let n=1e-4,r=e-n,i=e+n;r<0&&(r=0),i>1&&(i=1);let a=this.getPoint(r),o=this.getPoint(i),s=t||(a.isVector2?new M:new k);return s.copy(o).sub(a).normalize(),s}getTangentAt(e,t){let n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t=!1){let n=new k,r=[],i=[],a=[],o=new k,s=new oe;for(let t=0;t<=e;t++){let n=t/e;r[t]=this.getTangentAt(n,new k)}i[0]=new k,a[0]=new k;let c=Number.MAX_VALUE,l=Math.abs(r[0].x),u=Math.abs(r[0].y),d=Math.abs(r[0].z);l<=c&&(c=l,n.set(1,0,0)),u<=c&&(c=u,n.set(0,1,0)),d<=c&&n.set(0,0,1),o.crossVectors(r[0],n).normalize(),i[0].crossVectors(r[0],o),a[0].crossVectors(r[0],i[0]);for(let t=1;t<=e;t++){if(i[t]=i[t-1].clone(),a[t]=a[t-1].clone(),o.crossVectors(r[t-1],r[t]),o.length()>2**-52){o.normalize();let e=Math.acos(j(r[t-1].dot(r[t]),-1,1));i[t].applyMatrix4(s.makeRotationAxis(o,e))}a[t].crossVectors(r[t],i[t])}if(t===!0){let t=Math.acos(j(i[0].dot(i[e]),-1,1));t/=e,r[0].dot(o.crossVectors(i[0],i[e]))>0&&(t=-t);for(let n=1;n<=e;n++)i[n].applyMatrix4(s.makeRotationAxis(r[n],t*n)),a[n].crossVectors(r[n],i[n])}return{tangents:r,normals:i,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){let e={metadata:{version:4.7,type:`Curve`,generator:`Curve.toJSON`}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}},we=class extends Y{constructor(e=0,t=0,n=1,r=1,i=0,a=Math.PI*2,o=!1,s=0){super(),this.isEllipseCurve=!0,this.type=`EllipseCurve`,this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=r,this.aStartAngle=i,this.aEndAngle=a,this.aClockwise=o,this.aRotation=s}getPoint(e,t=new M){let n=t,r=Math.PI*2,i=this.aEndAngle-this.aStartAngle,a=Math.abs(i)<2**-52;for(;i<0;)i+=r;for(;i>r;)i-=r;i<2**-52&&(i=a?0:r),this.aClockwise===!0&&!a&&(i===r?i=-r:i-=r);let o=this.aStartAngle+e*i,s=this.aX+this.xRadius*Math.cos(o),c=this.aY+this.yRadius*Math.sin(o);if(this.aRotation!==0){let e=Math.cos(this.aRotation),t=Math.sin(this.aRotation),n=s-this.aX,r=c-this.aY;s=n*e-r*t+this.aX,c=n*t+r*e+this.aY}return n.set(s,c)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){let e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}},Te=class extends we{constructor(e,t,n,r,i,a){super(e,t,n,n,r,i,a),this.isArcCurve=!0,this.type=`ArcCurve`}};function Ee(){let e=0,t=0,n=0,r=0;function i(i,a,o,s){e=i,t=o,n=-3*i+3*a-2*o-s,r=2*i-2*a+o+s}return{initCatmullRom:function(e,t,n,r,a){i(t,n,a*(n-e),a*(r-t))},initNonuniformCatmullRom:function(e,t,n,r,a,o,s){let c=(t-e)/a-(n-e)/(a+o)+(n-t)/o,l=(n-t)/o-(r-t)/(o+s)+(r-n)/s;c*=o,l*=o,i(t,n,c,l)},calc:function(i){let a=i*i,o=a*i;return e+t*i+n*a+r*o}}}var De=new k,Oe=new Ee,ke=new Ee,Ae=new Ee,je=class extends Y{constructor(e=[],t=!1,n=`centripetal`,r=.5){super(),this.isCatmullRomCurve3=!0,this.type=`CatmullRomCurve3`,this.points=e,this.closed=t,this.curveType=n,this.tension=r}getPoint(e,t=new k){let n=t,r=this.points,i=r.length,a=(i-+!this.closed)*e,o=Math.floor(a),s=a-o;this.closed?o+=o>0?0:(Math.floor(Math.abs(o)/i)+1)*i:s===0&&o===i-1&&(o=i-2,s=1);let c,l;this.closed||o>0?c=r[(o-1)%i]:(De.subVectors(r[0],r[1]).add(r[0]),c=De);let u=r[o%i],d=r[(o+1)%i];if(this.closed||o+2<i?l=r[(o+2)%i]:(De.subVectors(r[i-1],r[i-2]).add(r[i-1]),l=De),this.curveType===`centripetal`||this.curveType===`chordal`){let e=this.curveType===`chordal`?.5:.25,t=c.distanceToSquared(u)**+e,n=u.distanceToSquared(d)**+e,r=d.distanceToSquared(l)**+e;n<1e-4&&(n=1),t<1e-4&&(t=n),r<1e-4&&(r=n),Oe.initNonuniformCatmullRom(c.x,u.x,d.x,l.x,t,n,r),ke.initNonuniformCatmullRom(c.y,u.y,d.y,l.y,t,n,r),Ae.initNonuniformCatmullRom(c.z,u.z,d.z,l.z,t,n,r)}else this.curveType===`catmullrom`&&(Oe.initCatmullRom(c.x,u.x,d.x,l.x,this.tension),ke.initCatmullRom(c.y,u.y,d.y,l.y,this.tension),Ae.initCatmullRom(c.z,u.z,d.z,l.z,this.tension));return n.set(Oe.calc(s),ke.calc(s),Ae.calc(s)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let n=e.points[t];this.points.push(n.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){let n=this.points[t];e.points.push(n.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let n=e.points[t];this.points.push(new k().fromArray(n))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}};function Me(e,t,n,r,i){let a=(r-t)*.5,o=(i-n)*.5,s=e*e,c=e*s;return(2*n-2*r+a+o)*c+(-3*n+3*r-2*a-o)*s+a*e+n}function Ne(e,t){let n=1-e;return n*n*t}function Pe(e,t){return 2*(1-e)*e*t}function Fe(e,t){return e*e*t}function Ie(e,t,n,r){return Ne(e,t)+Pe(e,n)+Fe(e,r)}function Le(e,t){let n=1-e;return n*n*n*t}function Re(e,t){let n=1-e;return 3*n*n*e*t}function ze(e,t){return 3*(1-e)*e*e*t}function Be(e,t){return e*e*e*t}function Ve(e,t,n,r,i){return Le(e,t)+Re(e,n)+ze(e,r)+Be(e,i)}var He=class extends Y{constructor(e=new M,t=new M,n=new M,r=new M){super(),this.isCubicBezierCurve=!0,this.type=`CubicBezierCurve`,this.v0=e,this.v1=t,this.v2=n,this.v3=r}getPoint(e,t=new M){let n=t,r=this.v0,i=this.v1,a=this.v2,o=this.v3;return n.set(Ve(e,r.x,i.x,a.x,o.x),Ve(e,r.y,i.y,a.y,o.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}},Ue=class extends Y{constructor(e=new k,t=new k,n=new k,r=new k){super(),this.isCubicBezierCurve3=!0,this.type=`CubicBezierCurve3`,this.v0=e,this.v1=t,this.v2=n,this.v3=r}getPoint(e,t=new k){let n=t,r=this.v0,i=this.v1,a=this.v2,o=this.v3;return n.set(Ve(e,r.x,i.x,a.x,o.x),Ve(e,r.y,i.y,a.y,o.y),Ve(e,r.z,i.z,a.z,o.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}},We=class extends Y{constructor(e=new M,t=new M){super(),this.isLineCurve=!0,this.type=`LineCurve`,this.v1=e,this.v2=t}getPoint(e,t=new M){let n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new M){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},Ge=class extends Y{constructor(e=new k,t=new k){super(),this.isLineCurve3=!0,this.type=`LineCurve3`,this.v1=e,this.v2=t}getPoint(e,t=new k){let n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new k){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},Ke=class extends Y{constructor(e=new M,t=new M,n=new M){super(),this.isQuadraticBezierCurve=!0,this.type=`QuadraticBezierCurve`,this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new M){let n=t,r=this.v0,i=this.v1,a=this.v2;return n.set(Ie(e,r.x,i.x,a.x),Ie(e,r.y,i.y,a.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},qe=class extends Y{constructor(e=new k,t=new k,n=new k){super(),this.isQuadraticBezierCurve3=!0,this.type=`QuadraticBezierCurve3`,this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new k){let n=t,r=this.v0,i=this.v1,a=this.v2;return n.set(Ie(e,r.x,i.x,a.x),Ie(e,r.y,i.y,a.y),Ie(e,r.z,i.z,a.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},Je=class extends Y{constructor(e=[]){super(),this.isSplineCurve=!0,this.type=`SplineCurve`,this.points=e}getPoint(e,t=new M){let n=t,r=this.points,i=(r.length-1)*e,a=Math.floor(i),o=i-a,s=r[a===0?a:a-1],c=r[a],l=r[a>r.length-2?r.length-1:a+1],u=r[a>r.length-3?r.length-1:a+2];return n.set(Me(o,s.x,c.x,l.x,u.x),Me(o,s.y,c.y,l.y,u.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let n=e.points[t];this.points.push(n.clone())}return this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){let n=this.points[t];e.points.push(n.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){let n=e.points[t];this.points.push(new M().fromArray(n))}return this}},Ye=e({ArcCurve:()=>Te,CatmullRomCurve3:()=>je,CubicBezierCurve:()=>He,CubicBezierCurve3:()=>Ue,EllipseCurve:()=>we,LineCurve:()=>We,LineCurve3:()=>Ge,QuadraticBezierCurve:()=>Ke,QuadraticBezierCurve3:()=>qe,SplineCurve:()=>Je}),Xe=class extends Y{constructor(){super(),this.type=`CurvePath`,this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){let e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(t)){let n=e.isVector2===!0?`LineCurve`:`LineCurve3`;this.curves.push(new Ye[n](t,e))}return this}getPoint(e,t){let n=e*this.getLength(),r=this.getCurveLengths(),i=0;for(;i<r.length;){if(r[i]>=n){let e=r[i]-n,a=this.curves[i],o=a.getLength(),s=o===0?0:1-e/o;return a.getPointAt(s,t)}i++}return null}getLength(){let e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;let e=[],t=0;for(let n=0,r=this.curves.length;n<r;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){let t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){let t=[],n;for(let r=0,i=this.curves;r<i.length;r++){let a=i[r],o=a.isEllipseCurve?e*2:a.isLineCurve||a.isLineCurve3?1:a.isSplineCurve?e*a.points.length:e,s=a.getPoints(o);for(let e=0;e<s.length;e++){let r=s[e];n&&n.equals(r)||(t.push(r),n=r)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){let n=e.curves[t];this.curves.push(n.clone())}return this.autoClose=e.autoClose,this}toJSON(){let e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,n=this.curves.length;t<n;t++){let n=this.curves[t];e.curves.push(n.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){let n=e.curves[t];this.curves.push(new Ye[n.type]().fromJSON(n))}return this}},Ze=class extends Xe{constructor(e){super(),this.type=`Path`,this.currentPoint=new M,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){let n=new We(this.currentPoint.clone(),new M(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,r){let i=new Ke(this.currentPoint.clone(),new M(e,t),new M(n,r));return this.curves.push(i),this.currentPoint.set(n,r),this}bezierCurveTo(e,t,n,r,i,a){let o=new He(this.currentPoint.clone(),new M(e,t),new M(n,r),new M(i,a));return this.curves.push(o),this.currentPoint.set(i,a),this}splineThru(e){let t=new Je([this.currentPoint.clone()].concat(e));return this.curves.push(t),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,r,i,a){let o=this.currentPoint.x,s=this.currentPoint.y;return this.absarc(e+o,t+s,n,r,i,a),this}absarc(e,t,n,r,i,a){return this.absellipse(e,t,n,n,r,i,a),this}ellipse(e,t,n,r,i,a,o,s){let c=this.currentPoint.x,l=this.currentPoint.y;return this.absellipse(e+c,t+l,n,r,i,a,o,s),this}absellipse(e,t,n,r,i,a,o,s){let c=new we(e,t,n,r,i,a,o,s);if(this.curves.length>0){let e=c.getPoint(0);e.equals(this.currentPoint)||this.lineTo(e.x,e.y)}this.curves.push(c);let l=c.getPoint(1);return this.currentPoint.copy(l),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){let e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}},Qe=class extends Ze{constructor(e){super(e),this.uuid=te(),this.type=`Shape`,this.holes=[]}getPointsHoles(e){let t=[];for(let n=0,r=this.holes.length;n<r;n++)t[n]=this.holes[n].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){let n=e.holes[t];this.holes.push(n.clone())}return this}toJSON(){let e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,n=this.holes.length;t<n;t++){let n=this.holes[t];e.holes.push(n.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){let n=e.holes[t];this.holes.push(new Ze().fromJSON(n))}return this}};function $e(e,t,n=2){let r=t&&t.length,i=r?t[0]*n:e.length,a=et(e,0,i,n,!0),o=[];if(!a||a.next===a.prev)return o;let s,c,l;if(r&&(a=ot(e,t,a,n)),e.length>80*n){s=e[0],c=e[1];let t=s,r=c;for(let a=n;a<i;a+=n){let n=e[a],i=e[a+1];n<s&&(s=n),i<c&&(c=i),n>t&&(t=n),i>r&&(r=i)}l=Math.max(t-s,r-c),l=l===0?0:32767/l}return tt(a,o,n,s,c,l,0),o}function et(e,t,n,r,i){let a;if(i===kt(e,t,n,r)>0)for(let i=t;i<n;i+=r)a=Et(i/r|0,e[i],e[i+1],a);else for(let i=n-r;i>=t;i-=r)a=Et(i/r|0,e[i],e[i+1],a);return a&&vt(a,a.next)&&(Dt(a),a=a.next),a}function X(e,t){if(!e)return e;t||=e;let n=e,r;do if(r=!1,!n.steiner&&(vt(n,n.next)||Z(n.prev,n,n.next)===0)){if(Dt(n),n=t=n.prev,n===n.next)break;r=!0}else n=n.next;while(r||n!==t);return t}function tt(e,t,n,r,i,a,o){if(!e)return;!o&&a&&dt(e,r,i,a);let s=e;for(;e.prev!==e.next;){let c=e.prev,l=e.next;if(a?rt(e,r,i,a):nt(e)){t.push(c.i,e.i,l.i),Dt(e),e=l.next,s=l.next;continue}if(e=l,e===s){o?o===1?(e=it(X(e),t),tt(e,t,n,r,i,a,2)):o===2&&at(e,t,n,r,i,a):tt(X(e),t,n,r,i,a,1);break}}}function nt(e){let t=e.prev,n=e,r=e.next;if(Z(t,n,r)>=0)return!1;let i=t.x,a=n.x,o=r.x,s=t.y,c=n.y,l=r.y,u=Math.min(i,a,o),d=Math.min(s,c,l),f=Math.max(i,a,o),p=Math.max(s,c,l),m=r.next;for(;m!==t;){if(m.x>=u&&m.x<=f&&m.y>=d&&m.y<=p&&gt(i,s,a,c,o,l,m.x,m.y)&&Z(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function rt(e,t,n,r){let i=e.prev,a=e,o=e.next;if(Z(i,a,o)>=0)return!1;let s=i.x,c=a.x,l=o.x,u=i.y,d=a.y,f=o.y,p=Math.min(s,c,l),m=Math.min(u,d,f),h=Math.max(s,c,l),g=Math.max(u,d,f),_=pt(p,m,t,n,r),v=pt(h,g,t,n,r),y=e.prevZ,b=e.nextZ;for(;y&&y.z>=_&&b&&b.z<=v;){if(y.x>=p&&y.x<=h&&y.y>=m&&y.y<=g&&y!==i&&y!==o&&gt(s,u,c,d,l,f,y.x,y.y)&&Z(y.prev,y,y.next)>=0||(y=y.prevZ,b.x>=p&&b.x<=h&&b.y>=m&&b.y<=g&&b!==i&&b!==o&&gt(s,u,c,d,l,f,b.x,b.y)&&Z(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;y&&y.z>=_;){if(y.x>=p&&y.x<=h&&y.y>=m&&y.y<=g&&y!==i&&y!==o&&gt(s,u,c,d,l,f,y.x,y.y)&&Z(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;b&&b.z<=v;){if(b.x>=p&&b.x<=h&&b.y>=m&&b.y<=g&&b!==i&&b!==o&&gt(s,u,c,d,l,f,b.x,b.y)&&Z(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function it(e,t){let n=e;do{let r=n.prev,i=n.next.next;!vt(r,i)&&yt(r,n,n.next,i)&&Ct(r,i)&&Ct(i,r)&&(t.push(r.i,n.i,i.i),Dt(n),Dt(n.next),n=e=i),n=n.next}while(n!==e);return X(n)}function at(e,t,n,r,i,a){let o=e;do{let e=o.next.next;for(;e!==o.prev;){if(o.i!==e.i&&_t(o,e)){let s=Tt(o,e);o=X(o,o.next),s=X(s,s.next),tt(o,t,n,r,i,a,0),tt(s,t,n,r,i,a,0);return}e=e.next}o=o.next}while(o!==e)}function ot(e,t,n,r){let i=[];for(let n=0,a=t.length;n<a;n++){let o=et(e,t[n]*r,n<a-1?t[n+1]*r:e.length,r,!1);o===o.next&&(o.steiner=!0),i.push(mt(o))}i.sort(st);for(let e=0;e<i.length;e++)n=ct(i[e],n);return n}function st(e,t){let n=e.x-t.x;return n===0&&(n=e.y-t.y,n===0&&(n=(e.next.y-e.y)/(e.next.x-e.x)-(t.next.y-t.y)/(t.next.x-t.x))),n}function ct(e,t){let n=lt(e,t);if(!n)return t;let r=Tt(n,e);return X(r,r.next),X(n,n.next)}function lt(e,t){let n=t,r=e.x,i=e.y,a=-1/0,o;if(vt(e,n))return n;do{if(vt(e,n.next))return n.next;if(i<=n.y&&i>=n.next.y&&n.next.y!==n.y){let e=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(e<=r&&e>a&&(a=e,o=n.x<n.next.x?n:n.next,e===r))return o}n=n.next}while(n!==t);if(!o)return null;let s=o,c=o.x,l=o.y,u=1/0;n=o;do{if(r>=n.x&&n.x>=c&&r!==n.x&&ht(i<l?r:a,i,c,l,i<l?a:r,i,n.x,n.y)){let t=Math.abs(i-n.y)/(r-n.x);Ct(n,e)&&(t<u||t===u&&(n.x>o.x||n.x===o.x&&ut(o,n)))&&(o=n,u=t)}n=n.next}while(n!==s);return o}function ut(e,t){return Z(e.prev,e,t.prev)<0&&Z(t.next,e,e.next)<0}function dt(e,t,n,r){let i=e;do i.z===0&&(i.z=pt(i.x,i.y,t,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,ft(i)}function ft(e){let t,n=1;do{let r=e,i;e=null;let a=null;for(t=0;r;){t++;let o=r,s=0;for(let e=0;e<n&&(s++,o=o.nextZ,o);e++);let c=n;for(;s>0||c>0&&o;)s!==0&&(c===0||!o||r.z<=o.z)?(i=r,r=r.nextZ,s--):(i=o,o=o.nextZ,c--),a?a.nextZ=i:e=i,i.prevZ=a,a=i;r=o}a.nextZ=null,n*=2}while(t>1);return e}function pt(e,t,n,r,i){return e=(e-n)*i|0,t=(t-r)*i|0,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function mt(e){let t=e,n=e;do(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next;while(t!==e);return n}function ht(e,t,n,r,i,a,o,s){return(i-o)*(t-s)>=(e-o)*(a-s)&&(e-o)*(r-s)>=(n-o)*(t-s)&&(n-o)*(a-s)>=(i-o)*(r-s)}function gt(e,t,n,r,i,a,o,s){return!(e===o&&t===s)&&ht(e,t,n,r,i,a,o,s)}function _t(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!St(e,t)&&(Ct(e,t)&&Ct(t,e)&&wt(e,t)&&(Z(e.prev,e,t.prev)||Z(e,t.prev,t))||vt(e,t)&&Z(e.prev,e,e.next)>0&&Z(t.prev,t,t.next)>0)}function Z(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function vt(e,t){return e.x===t.x&&e.y===t.y}function yt(e,t,n,r){let i=xt(Z(e,t,n)),a=xt(Z(e,t,r)),o=xt(Z(n,r,e)),s=xt(Z(n,r,t));return!!(i!==a&&o!==s||i===0&&bt(e,n,t)||a===0&&bt(e,r,t)||o===0&&bt(n,e,r)||s===0&&bt(n,t,r))}function bt(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function xt(e){return e>0?1:e<0?-1:0}function St(e,t){let n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&yt(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}function Ct(e,t){return Z(e.prev,e,e.next)<0?Z(e,t,e.next)>=0&&Z(e,e.prev,t)>=0:Z(e,t,e.prev)<0||Z(e,e.next,t)<0}function wt(e,t){let n=e,r=!1,i=(e.x+t.x)/2,a=(e.y+t.y)/2;do n.y>a!=n.next.y>a&&n.next.y!==n.y&&i<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next;while(n!==e);return r}function Tt(e,t){let n=Ot(e.i,e.x,e.y),r=Ot(t.i,t.x,t.y),i=e.next,a=t.prev;return e.next=t,t.prev=e,n.next=i,i.prev=n,r.next=n,n.prev=r,a.next=r,r.prev=a,r}function Et(e,t,n,r){let i=Ot(e,t,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function Dt(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function Ot(e,t,n){return{i:e,x:t,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function kt(e,t,n,r){let i=0;for(let a=t,o=n-r;a<n;a+=r)i+=(e[o]-e[a])*(e[a+1]+e[o+1]),o=a;return i}var At=class{static triangulate(e,t,n=2){return $e(e,t,n)}},jt=class e{static area(e){let t=e.length,n=0;for(let r=t-1,i=0;i<t;r=i++)n+=e[r].x*e[i].y-e[i].x*e[r].y;return n*.5}static isClockWise(t){return e.area(t)<0}static triangulateShape(e,t){let n=[],r=[],i=[];Mt(e),Nt(n,e);let a=e.length;t.forEach(Mt);for(let e=0;e<t.length;e++)r.push(a),a+=t[e].length,Nt(n,t[e]);let o=At.triangulate(n,r);for(let e=0;e<o.length;e+=3)i.push(o.slice(e,e+3));return i}};function Mt(e){let t=e.length;t>2&&e[t-1].equals(e[0])&&e.pop()}function Nt(e,t){for(let n=0;n<t.length;n++)e.push(t[n].x),e.push(t[n].y)}var Pt=class e extends ae{constructor(e=new Qe([new M(.5,.5),new M(-.5,.5),new M(-.5,-.5),new M(.5,-.5)]),t={}){super(),this.type=`ExtrudeGeometry`,this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];let n=this,r=[],i=[];for(let t=0,n=e.length;t<n;t++){let n=e[t];a(n)}this.setAttribute(`position`,new K(r,3)),this.setAttribute(`uv`,new K(i,2)),this.computeVertexNormals();function a(e){let a=[],o=t.curveSegments===void 0?12:t.curveSegments,s=t.steps===void 0?1:t.steps,c=t.depth===void 0?1:t.depth,l=t.bevelEnabled===void 0?!0:t.bevelEnabled,u=t.bevelThickness===void 0?.2:t.bevelThickness,d=t.bevelSize===void 0?u-.1:t.bevelSize,f=t.bevelOffset===void 0?0:t.bevelOffset,p=t.bevelSegments===void 0?3:t.bevelSegments,m=t.extrudePath,h=t.UVGenerator===void 0?Ft:t.UVGenerator,g,_=!1,v,y,b,x;if(m){g=m.getSpacedPoints(s),_=!0,l=!1;let e=m.isCatmullRomCurve3?m.closed:!1;v=m.computeFrenetFrames(s,e),y=new k,b=new k,x=new k}l||(p=0,u=0,d=0,f=0);let S=e.extractPoints(o),C=S.shape,w=S.holes;if(!jt.isClockWise(C)){C=C.reverse();for(let e=0,t=w.length;e<t;e++){let t=w[e];jt.isClockWise(t)&&(w[e]=t.reverse())}}function T(e){let t=e[0];for(let n=1;n<=e.length;n++){let r=n%e.length,i=e[r],a=i.x-t.x,o=i.y-t.y,s=a*a+o*o,c=Math.max(Math.abs(i.x),Math.abs(i.y),Math.abs(t.x),Math.abs(t.y));if(s<=10000000000000001e-36*c*c){e.splice(r,1),n--;continue}t=i}}T(C),w.forEach(T);let D=w.length,O=C;for(let e=0;e<D;e++){let t=w[e];C=C.concat(t)}function A(e,t,n){return t||E(`ExtrudeGeometry: vec does not exist`),e.clone().addScaledVector(t,n)}let j=C.length;function N(e,t,n){let r,i,a,o=e.x-t.x,s=e.y-t.y,c=n.x-e.x,l=n.y-e.y,u=o*o+s*s,d=o*l-s*c;if(Math.abs(d)>2**-52){let d=Math.sqrt(u),f=Math.sqrt(c*c+l*l),p=t.x-s/d,m=t.y+o/d,h=n.x-l/f,g=n.y+c/f,_=((h-p)*l-(g-m)*c)/(o*l-s*c);r=p+o*_-e.x,i=m+s*_-e.y;let v=r*r+i*i;if(v<=2)return new M(r,i);a=Math.sqrt(v/2)}else{let e=!1;o>2**-52?c>2**-52&&(e=!0):o<-(2**-52)?c<-(2**-52)&&(e=!0):Math.sign(s)===Math.sign(l)&&(e=!0),e?(r=-s,i=o,a=Math.sqrt(u)):(r=o,i=s,a=Math.sqrt(u/2))}return new M(r/a,i/a)}let P=[];for(let e=0,t=O.length,n=t-1,r=e+1;e<t;e++,n++,r++)n===t&&(n=0),r===t&&(r=0),P[e]=N(O[e],O[n],O[r]);let F=[],I,L=P.concat();for(let e=0,t=D;e<t;e++){let t=w[e];I=[];for(let e=0,n=t.length,r=n-1,i=e+1;e<n;e++,r++,i++)r===n&&(r=0),i===n&&(i=0),I[e]=N(t[e],t[r],t[i]);F.push(I),L=L.concat(I)}let R;if(p===0)R=jt.triangulateShape(O,w);else{let e=[],t=[];for(let n=0;n<p;n++){let r=n/p,i=u*Math.cos(r*Math.PI/2),a=d*Math.sin(r*Math.PI/2)+f;for(let t=0,n=O.length;t<n;t++){let n=A(O[t],P[t],a);H(n.x,n.y,-i),r===0&&e.push(n)}for(let e=0,n=D;e<n;e++){let n=w[e];I=F[e];let o=[];for(let e=0,t=n.length;e<t;e++){let t=A(n[e],I[e],a);H(t.x,t.y,-i),r===0&&o.push(t)}r===0&&t.push(o)}}R=jt.triangulateShape(e,t)}let z=R.length,B=d+f;for(let e=0;e<j;e++){let t=l?A(C[e],L[e],B):C[e];_?(b.copy(v.normals[0]).multiplyScalar(t.x),y.copy(v.binormals[0]).multiplyScalar(t.y),x.copy(g[0]).add(b).add(y),H(x.x,x.y,x.z)):H(t.x,t.y,0)}for(let e=1;e<=s;e++)for(let t=0;t<j;t++){let n=l?A(C[t],L[t],B):C[t];_?(b.copy(v.normals[e]).multiplyScalar(n.x),y.copy(v.binormals[e]).multiplyScalar(n.y),x.copy(g[e]).add(b).add(y),H(x.x,x.y,x.z)):H(n.x,n.y,c/s*e)}for(let e=p-1;e>=0;e--){let t=e/p,n=u*Math.cos(t*Math.PI/2),r=d*Math.sin(t*Math.PI/2)+f;for(let e=0,t=O.length;e<t;e++){let t=A(O[e],P[e],r);H(t.x,t.y,c+n)}for(let e=0,t=w.length;e<t;e++){let t=w[e];I=F[e];for(let e=0,i=t.length;e<i;e++){let i=A(t[e],I[e],r);_?H(i.x,i.y+g[s-1].y,g[s-1].x+n):H(i.x,i.y,c+n)}}}V(),ee();function V(){let e=r.length/3;if(l){let e=0,t=j*e;for(let e=0;e<z;e++){let n=R[e];ne(n[2]+t,n[1]+t,n[0]+t)}e=s+p*2,t=j*e;for(let e=0;e<z;e++){let n=R[e];ne(n[0]+t,n[1]+t,n[2]+t)}}else{for(let e=0;e<z;e++){let t=R[e];ne(t[2],t[1],t[0])}for(let e=0;e<z;e++){let t=R[e];ne(t[0]+j*s,t[1]+j*s,t[2]+j*s)}}n.addGroup(e,r.length/3-e,0)}function ee(){let e=r.length/3,t=0;te(O,t),t+=O.length;for(let e=0,n=w.length;e<n;e++){let n=w[e];te(n,t),t+=n.length}n.addGroup(e,r.length/3-e,1)}function te(e,t){let n=e.length;for(;--n>=0;){let r=n,i=n-1;i<0&&(i=e.length-1);for(let e=0,n=s+p*2;e<n;e++){let n=j*e,a=j*(e+1);re(t+r+n,t+i+n,t+i+a,t+r+a)}}}function H(e,t,n){a.push(e),a.push(t),a.push(n)}function ne(e,t,i){U(e),U(t),U(i);let a=r.length/3,o=h.generateTopUV(n,r,a-3,a-2,a-1);W(o[0]),W(o[1]),W(o[2])}function re(e,t,i,a){U(e),U(t),U(a),U(t),U(i),U(a);let o=r.length/3,s=h.generateSideWallUV(n,r,o-6,o-3,o-2,o-1);W(s[0]),W(s[1]),W(s[3]),W(s[1]),W(s[2]),W(s[3])}function U(e){r.push(a[e*3+0]),r.push(a[e*3+1]),r.push(a[e*3+2])}function W(e){i.push(e.x),i.push(e.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){let e=super.toJSON(),t=this.parameters.shapes,n=this.parameters.options;return It(t,n,e)}static fromJSON(t,n){let r=[];for(let e=0,i=t.shapes.length;e<i;e++){let i=n[t.shapes[e]];r.push(i)}let i=t.options.extrudePath;return i!==void 0&&(t.options.extrudePath=new Ye[i.type]().fromJSON(i)),new e(r,t.options)}},Ft={generateTopUV:function(e,t,n,r,i){let a=t[n*3],o=t[n*3+1],s=t[r*3],c=t[r*3+1],l=t[i*3],u=t[i*3+1];return[new M(a,o),new M(s,c),new M(l,u)]},generateSideWallUV:function(e,t,n,r,i,a){let o=t[n*3],s=t[n*3+1],c=t[n*3+2],l=t[r*3],u=t[r*3+1],d=t[r*3+2],f=t[i*3],p=t[i*3+1],m=t[i*3+2],h=t[a*3],g=t[a*3+1],_=t[a*3+2];return Math.abs(s-u)<Math.abs(o-l)?[new M(o,1-c),new M(l,1-d),new M(f,1-m),new M(h,1-_)]:[new M(s,1-c),new M(u,1-d),new M(p,1-m),new M(g,1-_)]}};function It(e,t,n){if(n.shapes=[],Array.isArray(e))for(let t=0,r=e.length;t<r;t++){let r=e[t];n.shapes.push(r.uuid)}else n.shapes.push(e.uuid);return n.options=Object.assign({},t),t.extrudePath!==void 0&&(n.options.extrudePath=t.extrudePath.toJSON()),n}var Lt=class extends W{constructor(e,t,n,r,i,a,o,s,c){super(e,t,n,r,i,a,o,s,c),this.isCanvasTexture=!0,this.needsUpdate=!0}};i();var Rt=/[MLCZmlcz]|-?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?/g;function zt(e,t){let n=e.match(Rt)??[],r=[],i=null,a=``,o=0,s=e=>(e-t.cx)/t.pxPerUnit,c=e=>(t.cy-e)/t.pxPerUnit,l=()=>parseFloat(n[o++]);for(;o<n.length;){let e=n[o];if(/^[MLCZmlcz]$/.test(e)){a=e.toUpperCase(),o++,a===`Z`&&(i?.closePath(),a=``);continue}a===`M`?(i=new Qe,r.push(i),i.moveTo(s(l()),c(l())),a=`L`):a===`L`?i?.lineTo(s(l()),c(l())):a===`C`?i?.bezierCurveTo(s(l()),c(l()),s(l()),c(l()),s(l()),c(l())):o++}return r}function Q(e,t,n){let r=new Pt(zt(e,t),{depth:n.depth,bevelEnabled:!0,bevelSize:n.bevel,bevelThickness:n.bevel,bevelSegments:n.bevelSegments??4,curveSegments:n.curveSegments??14});return r.translate(0,0,-n.depth/2),r}function Bt(e,t=0){let n=e.match(/^#?([\da-f]{6})$/i);return n?parseInt(n[1],16):t}var Vt={cx:_.CX,cy:_.CY,pxPerUnit:_.PX_PER_UNIT},Ht=.3,Ut=.085,Wt=.24,Gt=.31500000000000006,$=(l.eyeR.x-l.eyeL.x)/2/_.PX_PER_UNIT,Kt=l.insetHalfW*2/_.PX_PER_UNIT,qt=-1.04;function Jt(e,t,n){let r=e/2,i=t/2,a=Math.min(n,r,i),o=new Qe;return o.moveTo(-r+a,-i),o.lineTo(r-a,-i),o.quadraticCurveTo(r,-i,r,-i+a),o.lineTo(r,i-a),o.quadraticCurveTo(r,i,r-a,i),o.lineTo(-r+a,i),o.quadraticCurveTo(-r,i,-r,i-a),o.lineTo(-r,-i+a),o.quadraticCurveTo(-r,-i,-r+a,-i),o}function Yt(e,t){let n=e/2,r=t/2,i=new Qe;return i.moveTo(-n,-r+n),i.bezierCurveTo(-n,-r,n,-r,n,-r+n),i.lineTo(n,r-n),i.bezierCurveTo(n,r,-n,r,-n,r-n),i.lineTo(-n,-r+n),i}function Xt(e,t,n,r=4){return new Pt(e,{depth:t,bevelEnabled:!0,bevelSize:n,bevelThickness:n,bevelSegments:r,curveSegments:24})}function Zt(e){try{let t=[],n=e>>16&255,r=e>>8&255,i=e&255,a=(e,t,n,r)=>{let i=128*t,a=128*n,o=e.createLinearGradient(0,i,0,i+a);o.addColorStop(0,`rgba(255,255,255,0)`),o.addColorStop(.5,`rgba(255,250,244,${r})`),o.addColorStop(1,`rgba(255,255,255,0)`),e.fillStyle=o,e.fillRect(0,i,128,a)};for(let e=0;e<6;e++){let o=document.createElement(`canvas`);o.width=128,o.height=128;let s=o.getContext(`2d`);if(!s||typeof s.createLinearGradient!=`function`)return null;let c=s.createLinearGradient(0,0,0,128);if(c.addColorStop(0,`rgb(46,48,58)`),c.addColorStop(.55,`rgb(20,21,27)`),c.addColorStop(1,`rgb(7,7,10)`),s.fillStyle=c,s.fillRect(0,0,128,128),e===2){let e=s.createRadialGradient(128/2,128/2,6,128/2,128/2,128*.72);e.addColorStop(0,`rgba(255,252,246,0.95)`),e.addColorStop(1,`rgba(255,255,255,0.05)`),s.fillStyle=e,s.fillRect(0,0,128,128)}else if(e===0)a(s,.16,.3,.85);else if(e===1)a(s,.22,.26,.4);else if(e===4)a(s,.2,.2,.28);else if(e===5){let e=s.createRadialGradient(128/2,128*.62,4,128/2,128*.62,128*.6);e.addColorStop(0,`rgba(${n},${r},${i},0.7)`),e.addColorStop(1,`rgba(0,0,0,0)`),s.fillStyle=e,s.fillRect(0,0,128,128)}else e===3&&(s.fillStyle=`rgba(64,52,40,0.35)`,s.fillRect(0,0,128,128));for(let e=0;e<90;e++)s.fillStyle=`rgba(255,255,255,${Math.random()*.05})`,s.fillRect(Math.random()*128,Math.random()*128,1,1);t.push(o)}let o=new re(t);return o.needsUpdate=!0,o}catch{return null}}function Qt(){try{let e=document.createElement(`canvas`);e.width=128,e.height=128;let t=e.getContext(`2d`);if(!t||typeof t.createRadialGradient!=`function`)return null;let n=t.createRadialGradient(128/2,128/2,2,128/2,128/2,128/2);return n.addColorStop(0,`rgba(0,0,0,0.55)`),n.addColorStop(.6,`rgba(0,0,0,0.22)`),n.addColorStop(1,`rgba(0,0,0,0)`),t.fillStyle=n,t.fillRect(0,0,128,128),new Lt(e)}catch{return null}}function $t(e){let{shell:t,inset:n,accent:r,envMap:i,light:a}=e;return{shell:new Se({color:t,metalness:.05,roughness:.34,clearcoat:.9,clearcoatRoughness:.32,envMap:i,envMapIntensity:a?.85:1}),inset:new Se({color:n,metalness:.1,roughness:.16,clearcoat:1,clearcoatRoughness:.1,envMap:i,envMapIntensity:1.15}),bezel:new xe({color:1052688,metalness:.7,roughness:.35,envMap:i,envMapIntensity:.4}),jade:new xe({color:r,emissive:r,emissiveIntensity:.95,metalness:.4,roughness:.18,envMap:i,envMapIntensity:.55}),jadeStem:new xe({color:r,emissive:r,emissiveIntensity:.7,metalness:.35,roughness:.25,envMap:i,envMapIntensity:.45}),jadeGlow:new L({color:r,transparent:!0,opacity:.45}),glint:new L({color:15663096,transparent:!0,opacity:.85}),sheen:new L({color:16777215,transparent:!0,opacity:.07,depthWrite:!1})}}function en(e,t,n){if(e===`bumper`)return;let r=c(l.earL.y),i=T(l.earL.x),a=T(l.earR.x),o=[{x:i,sign:-1},{x:a,sign:1}];if(e===`studio`){let e=new P(new J(Math.abs(i),.045,12,56,Math.PI),n.shell);e.position.set(0,r,.04),t.add(e),o.forEach(({x:e,sign:i})=>{let a=new q(.23,26,26);a.scale(.72,1,.85);let o=new P(a,n.inset);o.position.set(e+i*.04,r,.05),t.add(o);let s=new q(.12,20,20);s.scale(.5,1,1);let c=new P(s,n.jade);c.position.set(e+i*.16,r,.05),t.add(c);let l=new P(new J(.21,.016,10,36),n.shell);l.scale.set(.75,1,1),l.position.set(e+i*.02,r,.08),t.add(l)});return}if(e===`earbuds`){o.forEach(({x:e,sign:i})=>{let a=new P(new q(.09,20,20),n.jade);a.position.set(e+i*.08,r,.12),t.add(a);let o=new P(new J(.17,.013,8,24,Math.PI/2),n.jadeStem);o.rotation.z=i>0?-Math.PI/2:Math.PI,o.position.set(e+i*.08,r-.12,.12),t.add(o)});return}if(e===`loop`){o.forEach(({x:e})=>{let i=new P(new J(.2,.034,12,44),n.jade);i.scale.set(.72,1,1),i.position.set(e,r,.16),t.add(i);let a=new P(new Ce(.16,32),n.jadeGlow);a.scale.set(.72,1,1),a.position.set(e,r,.14),t.add(a)});return}if(e===`fins`){o.forEach(({x:e,sign:i})=>{let a=new Qe;a.moveTo(0,.2),a.lineTo(i*.4,-.05),a.lineTo(i*.46,-.18),a.lineTo(i*.13,-.13),a.lineTo(0,-.05),a.lineTo(0,.2);let o=new P(new Pt(a,{depth:.045,bevelEnabled:!0,bevelSize:.012,bevelThickness:.012,bevelSegments:3,curveSegments:16}),n.jade);o.position.set(e,r,.04),t.add(o)});return}}function tn(e,t){let n=new G,r=new G;n.add(r);let i=y(e.chassis),a=new G;a.scale.set(i.scaleX,i.scaleY,1),r.add(a);let o=new P(Q(p,Vt,{depth:Ht,bevel:Ut,bevelSegments:6,curveSegments:20}),t.shell);a.add(o);let u=new P(Q(h,Vt,{depth:.14,bevel:.05,bevelSegments:5,curveSegments:16}),t.shell);a.add(u);let f=new P(Q(g,Vt,{depth:.14,bevel:.05,bevelSegments:5,curveSegments:16}),t.shell);a.add(f);let b=new P(Q(m,Vt,{depth:.05,bevel:.03,bevelSegments:5,curveSegments:20}),t.inset);b.position.set(0,0,Wt),a.add(b);let C=new P(new I(.8,.2),t.sheen);C.rotation.z=-.3,C.position.set(-.24,-.18,.29900000000000004),a.add(C);let w=new P(new I(.8,.06),t.sheen);w.rotation.z=-.3,w.position.set(-.28,-.32,.29900000000000004),a.add(w);let E=new G;a.add(E),E.position.set(T(l.eyeMid.x),c(l.eyeMid.y),Gt);let D=e.eyes??`smile`,O,k=null,A=`smile`;if(D===`visor`){A=`visor`;let e=new G,n=Kt*.95,r=.24,i=.07,a=new P(Xt(Jt(n+.04,.27999999999999997,r*.48),.02,.005,3),t.inset);a.position.set(0,0,-.02),e.add(a);let o=new P(Xt(Jt(n,r,r*.45),i,.014,5),t.jade);e.add(o);let s=new xe({color:531734,emissive:268818,emissiveIntensity:.45,metalness:.55,roughness:.2}),c=new P(Xt(Jt(n*.92,r*.55,r*.22),.015,.004,3),s);c.position.set(0,0,i*.75),e.add(c);let l=new P(new H(n*.85,r*.2,.006),t.sheen);l.position.set(0,r*.32,i*.95),e.add(l);let u=new q(.034,18,18),d=new P(u,t.jade);d.position.set(-$,0,i*.95),e.add(d);let f=new P(u,t.jade);f.position.set($,0,i*.95),e.add(f);let p=new q(.013,12,12),m=new P(p,t.glint);m.position.set(-$,.005,.08800000000000001),e.add(m);let h=new P(p,t.glint);h.position.set($,.005,.08800000000000001),e.add(h);let g=Xt(Jt(.016,.085,.006),.018,.003,2);[-1,1].forEach(r=>{let a=new P(g,t.jade);a.position.set(r*n*.46,0,i*.85),e.add(a);let o=new P(g,t.jade);o.position.set(r*n*.42,0,i*.85),o.scale.set(1,.55,1),e.add(o)}),E.add(e),O=e}else if(D===`heart`){A=`heart`;let e=e=>{let n=new G,r=new q(.06,18,18),i=new P(r,t.jade);i.position.set(-.04,.025,0);let a=new P(r,t.jade);a.position.set(.04,.025,0),n.add(i),n.add(a);let o=new Qe;o.moveTo(-.07,.02),o.lineTo(.07,.02),o.lineTo(0,-.09),o.lineTo(-.07,.02);let s=new Pt(o,{depth:.04,bevelEnabled:!0,bevelSize:.008,bevelThickness:.008,bevelSegments:3,curveSegments:12});return n.add(new P(s,t.jade)),n.scale.set(1.75,1.75,1.75),n.position.set(e*$,0,.05),E.add(n),n};O=e(-1),k=e(1)}else if(D===`single`){A=`single`,O=new P(new q(.19,32,32),t.jade),E.add(O);let e=new P(new J(.24,.018,12,48),t.jade);E.add(e),k=e;let n=new P(new q(.045,10,10),t.glint);n.position.set(-.055,.055,.17),E.add(n)}else if(D===`pixel`){A=`pixel`;let e=new H(.16,.16,.05);O=new P(e,t.jade),O.position.set(-$,0,.02),E.add(O),k=new P(e,t.jade),k.position.set($,0,.02),E.add(k)}else{A=`smile`;let e={depth:.045,bevel:.014,bevelSegments:4,curveSegments:16};O=new P(Q(v,{cx:l.eyeL.x,cy:l.eyeL.y,pxPerUnit:_.PX_PER_UNIT},e),t.jade),O.position.set(-$,0,.02),E.add(O),k=new P(Q(d,{cx:l.eyeR.x,cy:l.eyeR.y,pxPerUnit:_.PX_PER_UNIT},e),t.jade),k.position.set($,0,.02),E.add(k)}en(e.headphones??`bumper`,a,t);let j=new G;a.add(j),j.position.set(T(l.antennaPivot.x),c(l.antennaPivot.y),0);let M=e.antenna??`jewel`,N=null,F={cx:l.antennaPivot.x,cy:l.antennaPivot.y,pxPerUnit:_.PX_PER_UNIT};if(M===`bunny`)[-1,1].forEach(e=>{let n=new P(Xt(Yt(.07,.42),.04,.012,3),t.jade);n.position.set(e*.18,.16,.02),n.rotation.z=e*.38,j.add(n);let r=new P(new q(.07,18,18),t.jade);r.position.set(e*.34,.36,.03),j.add(r),N||=r});else if(M===`beam`){let e=new P(Xt(Yt(.05,.46),.04,.01,3),t.jade);e.position.set(0,.2,.02),j.add(e);let n=new P(new q(.1,20,20),t.jade);n.position.set(0,.46,.03),j.add(n),N=n;let r=new P(new J(.16,.012,8,32),t.jadeGlow);r.rotation.x=Math.PI/2,r.position.copy(n.position),j.add(r)}else if(M===`wifi`){let e=new P(new q(.05,16,16),t.jade);e.position.set(0,.03,.02),j.add(e),N=e,[.15,.23,.31].forEach(e=>{let n=new P(new J(e,.018,10,24,Math.PI),t.jade);n.position.set(0,.03,.02),j.add(n)})}else if(M!==`none`){let e={depth:.07,bevel:.02,bevelSegments:4,curveSegments:14},n=new P(Q(S,F,e),t.jade);j.add(n),N=n;let r=new P(Q(s,F,e),t.jadeStem);j.add(r);let i=new P(Q(x,F,e),t.jadeStem);j.add(i)}let R=new G;n.add(R);let z=e.wings??`none`,B={kind:z};if(z===`halo`){let e=new P(new J(1,.035,12,80),t.jade);e.rotation.x=Math.PI/2.4,e.position.set(0,.95,-.2),R.add(e),B.halo=e;let n=new P(new J(.82,.02,10,64),t.jade);n.rotation.x=Math.PI/2.4,n.position.set(0,.95,-.2),R.add(n),[-1,0,1].forEach(e=>{let n=new P(new q(.04,14,14),t.jade),r=Math.PI/3*e+Math.PI/2;n.position.set(Math.cos(r)*1,.95+Math.sin(r)*.38-.05,-.2),R.add(n)})}else if(z===`pulse`){let e=new P(new J(1.1,.025,12,80),t.jade);e.rotation.x=Math.PI/2,e.position.y=-.95,R.add(e),B.r1=e;let n=new P(new J(1.3,.018,12,80),t.jadeStem);n.rotation.x=Math.PI/2,n.position.y=-.98,R.add(n),B.r2=n;let r=new P(new J(1.2,.014,10,64),t.jade);r.rotation.x=Math.PI/2,r.rotation.z=Math.PI/8,r.position.y=-.92,R.add(r),B.r3=r}else if(z===`orbit`){let e=[];[0,Math.PI*2/3,Math.PI*4/3].forEach(n=>{let r=new P(new q(.07,18,18),t.jade);r.position.set(Math.cos(n)*1.45,0,Math.sin(n)*.35),r.userData.phase=n,R.add(r),e.push(r)}),B.orbits=e}let V=null,ee=Qt();if(ee){let e=new L({map:ee,transparent:!0,opacity:.32,depthWrite:!1});V=new P(new I(2.2,.9),e),V.rotation.x=-Math.PI/2,V.position.set(0,qt,0),n.add(V)}return{root:n,headGroup:r,innerGroup:a,shell:o,inset:b,ears:[u,f],eyesGroup:E,leftEye:O,rightEye:k,eyesKind:A,antennaGroup:j,antennaTip:N,auraGroup:R,auraRefs:B,shadow:V}}function nn(e,t=[]){let n=new Set,r=new Set,i=new Set;e.traverse(e=>{let t=e;t.geometry&&!r.has(t.geometry)&&(r.add(t.geometry),t.geometry.dispose());let a=t.material;if(!a)return;let o=Array.isArray(a)?a:[a];for(let e of o){if(n.has(e))continue;n.add(e);let t=e;t.map&&!i.has(t.map)&&i.add(t.map),t.envMap&&!i.has(t.envMap)&&i.add(t.envMap),t.normalMap&&!i.has(t.normalMap)&&i.add(t.normalMap),e.dispose()}});for(let e of t)e&&!i.has(e)&&i.add(e);for(let e of i)e.dispose()}function rn({config:e=f,expression:i=`happy`,className:s=``,fallbackMode:c=!1}){let l=n(null),[d,p]=a(!1),[m,h]=a(!1),g=n(null),_=n(null),v=n({x:0,y:0,active:!1});r(()=>{if(typeof window>`u`||!window.matchMedia)return;let e=window.matchMedia(`(prefers-reduced-motion: reduce)`);h(e.matches);let t=e=>h(e.matches);return e.addEventListener?.(`change`,t),()=>e.removeEventListener?.(`change`,t)},[]);let y=`${e.chassis}-${e.eyes}-${e.antenna}-${e.wings}-${e.headphones}-${e.accent}-${e.baseColor}-${e.visorColor}`;return r(()=>{if(c||d)return;let e=l.current;if(!e)return;let t;try{t=new ie({alpha:!0,antialias:!0})}catch{p(!0);return}let{clientWidth:n,clientHeight:r}=e;t.setSize(n,r),t.setPixelRatio(Math.min(window.devicePixelRatio,2)),t.toneMapping=4,t.toneMappingExposure=1.15,e.appendChild(t.domElement);let i=new V,a=new B(34,n/r,.1,100);a.position.set(0,.12,4.8),a.lookAt(0,-.02,0);let o=new de(16777215,.3);i.add(o);let s=new ve(13623551,1315344,.5);i.add(s);let u=new _e(16777215,1.25);u.position.set(2.6,4.2,4.6),i.add(u);let f=new _e(11982079,.4);f.position.set(-3.6,1.2,2.6),i.add(f);let m=new _e(16767395,.3);m.position.set(0,2.6,-4),i.add(m);let h=new be(60075,1,8);h.position.set(0,-1.7,2.1),i.add(h);let y=new be(60075,.35,6);y.position.set(0,2.4,1.6),i.add(y);let b=new G;i.add(b),g.current={renderer:t,scene:i,camera:a,avatarGroup:b,ambient:o,rim:h,kicker:y,animationId:0};let x=()=>{let e=g.current;if(!l.current||!e)return;let{clientWidth:t,clientHeight:n}=l.current;e.renderer.setSize(t,n),e.camera.aspect=t/n,e.camera.updateProjectionMatrix()};window.addEventListener(`resize`,x);let S=t=>{let n=e.getBoundingClientRect();!n.width||!n.height||(v.current.x=(t.clientX-n.left)/n.width*2-1,v.current.y=(t.clientY-n.top)/n.height*2-1,v.current.active=!0)},C=()=>{v.current.active=!1};return e.addEventListener(`pointermove`,S),e.addEventListener(`pointerleave`,C),()=>{window.removeEventListener(`resize`,x),e.removeEventListener(`pointermove`,S),e.removeEventListener(`pointerleave`,C);let t=g.current;if(t){cancelAnimationFrame(t.animationId),_.current&&=(nn(t.avatarGroup,[_.current.envMap]),null),e.contains(t.renderer.domElement)&&e.removeChild(t.renderer.domElement);try{t.renderer.forceContextLoss()}catch{}t.renderer.dispose(),g.current=null}}},[c,d]),r(()=>{let t=g.current;if(!t||c||d)return;_.current&&=(t.avatarGroup.remove(_.current.parts.root),t.avatarGroup.remove(_.current.particles),nn(_.current.parts.root,[_.current.envMap]),_.current.particles.geometry.dispose(),_.current.particles.material.dispose(),null);let n=Bt(o(e.accent),60075),r=Bt(w(e.baseColor),16579580),i=Bt(b(e.baseColor,e.visorColor)),a=C(e.baseColor);t.ambient.intensity=a?.42:.3,t.rim.color.setHex(n),t.kicker.color.setHex(n);let s=Zt(n),l=tn(e,$t({shell:r,inset:i,accent:n,envMap:s,light:a}));t.avatarGroup.add(l.root);let u=e.wings===`dust`?36:16,f=new ae,p=new Float32Array(u*3);for(let e=0;e<u;e++)p[e*3]=(Math.random()-.5)*3.2,p[e*3+1]=-1.6+Math.random()*3.6,p[e*3+2]=-.6+Math.random()*.8;f.setAttribute(`position`,new D(p,3));let m=new le(f,new ce({color:n,size:e.wings===`dust`?.045:.025,transparent:!0,opacity:e.wings===`dust`?.7:.4}));t.avatarGroup.add(m),_.current={parts:l,particles:m,envMap:s}},[y,c,d]),r(()=>{let e=g.current;if(!e||c||d)return;let t=0,n=3+Math.random()*2,r=0,a=0,o=.04,s=1.4,l=.05,u=!1,f=1,p=.95;switch(i){case`happy`:o=.06,s=1.8,p=1;break;case`sad`:r=.14,o=.02,s=.6,u=!0,p=.4;break;case`angry`:r=-.05,o=.03,s=2.6,u=!0,f=.7,l=.1,p=1.25;break;case`sleepy`:f=.18,a=.18,r=.08,o=.02,s=.5,l=.015,p=.35;break;case`bored`:f=.35,a=.08,o=.02,s=.7,p=.5;break;case`hyped`:o=.14,s=3.2,l=.14,f=1.2,p=1.4;break;case`shake_head`:case`nod`:o=.04;break}let h=()=>{let e=g.current;if(!e)return;e.animationId=requestAnimationFrame(h);let c=_.current;if(!c){e.renderer.render(e.scene,e.camera);return}if(m){e.renderer.render(e.scene,e.camera);return}let d=c.parts,y=c.particles;t+=.016;let b=Math.sin(t*s)*o+.02;e.avatarGroup.position.y=b;let x=1+Math.sin(t*1.5)*.012;if(d.headGroup.scale.set(x,x,x),d.shadow){d.shadow.position.y=qt-b;let e=1-b*.35;d.shadow.scale.set(e,e,e),d.shadow.material.opacity=Math.max(.16,.34-b*.6)}let S=v.current;if(i===`shake_head`)d.headGroup.rotation.y=Math.sin(t*5)*.25;else if(i===`nod`)d.headGroup.rotation.x=Math.sin(t*4)*.18;else{let e=S.active?S.x*.34:Math.sin(t*.4)*.06,n=r+(S.active?S.y*.16:0);d.headGroup.rotation.y=O.lerp(d.headGroup.rotation.y,e,S.active?.12:.08),d.headGroup.rotation.x=O.lerp(d.headGroup.rotation.x,n,.08),d.headGroup.rotation.z=O.lerp(d.headGroup.rotation.z,a,.06)}d.antennaGroup.rotation.z=Math.sin(t*2)*l;let C=1;if(t>n){let e=t-n;e<.16?C=1-e/.16:e<.32?C=(e-.16)/.16:n=t+3+Math.random()*3}let w=f*Math.max(.08,C),T=d.eyesKind===`smile`&&u?-w:w;d.leftEye.scale.y=O.lerp(d.leftEye.scale.y,T,.35),d.rightEye&&(d.rightEye.scale.y=O.lerp(d.rightEye.scale.y,T,.35));let E=p*(.85+Math.sin(t*2.4)*.2),D=d.antennaTip?.material;if(D&&(D.emissiveIntensity=O.lerp(D.emissiveIntensity,E*1.05,.08)),d.auraRefs.kind===`pulse`&&d.auraRefs.r1&&d.auraRefs.r2){let e=1+Math.sin(t*1.8)*.06,n=1+Math.sin(t*1.8+.5)*.05;if(d.auraRefs.r1.scale.set(e,e,e),d.auraRefs.r2.scale.set(n*1.04,n*1.04,n*1.04),d.auraRefs.r3){let e=1+Math.sin(t*1.8+1)*.04;d.auraRefs.r3.scale.set(e*1.02,e*1.02,e*1.02),d.auraRefs.r3.rotation.z+=.004}}d.auraRefs.kind===`halo`&&d.auraRefs.halo&&(d.auraGroup.rotation.y+=.006),d.auraRefs.kind===`orbit`&&d.auraRefs.orbits&&d.auraRefs.orbits.forEach(e=>{let n=(e.userData.phase??0)+t*.6;e.position.x=Math.cos(n)*1.5,e.position.z=Math.sin(n)*.45,e.position.y=Math.sin(n*.5)*.18});let k=y.geometry.getAttribute(`position`);if(k&&k.count){for(let e=0;e<k.count;e++){let n=k.getY(e);n+=.008,n>2.4&&(n=-1.6),k.setY(e,n),k.setX(e,k.getX(e)+Math.sin(t+e*.4)*8e-4)}k.needsUpdate=!0}e.renderer.render(e.scene,e.camera)};return cancelAnimationFrame(e.animationId),h(),()=>{let e=g.current;e&&cancelAnimationFrame(e.animationId)}},[i,m,c,d]),c||d?t(`div`,{className:`flex items-center justify-center rounded-2xl bg-slate-50 dark:bg-void-800/40 ${s}`,style:{minHeight:`200px`,width:`100%`,height:`100%`},"data-testid":`agent-avatar-fallback`,children:t(u,{config:e,expression:i,className:`w-full h-full max-w-[220px]`})}):t(`div`,{ref:l,className:`w-full h-full relative ${s}`,style:{minHeight:`200px`},"data-testid":`agent-avatar-scene`})}export{rn as AgentAvatarScene};