@splinetool/runtime 0.9.94 → 0.9.95

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/runtime.cjs CHANGED
@@ -4902,7 +4902,7 @@ float contrastDepth = (gl_FragCoord.z - 0.5) * depthContrast + 0.5;
4902
4902
  vec3 resultColor = mix(mix(vColor, normal, 0.2), vec3(contrastDepth), 0.4);
4903
4903
  gl_FragColor = vec4(resultColor, vColor.r);
4904
4904
  }
4905
- `,Ef=new ht({vertexShader:hF,fragmentShader:dF,uniforms:{depthContrast:{value:1}}});function fF(n){if(n.geometry.attributes.extrudeNormal||!n.geometry.attributes.position)return;let e=new Map,t=n.geometry.attributes.position.array,r=n.geometry.attributes.normal.array,i=new Float32Array(t.length);for(let s=0;s<t.length;s+=3){let o=`${t[s]}_${t[s+1]}_${t[s+2]}`,a=new _(r[s],r[s+1],r[s+2]);e.has(o)?e.get(o)?.normals.push(a):e.set(o,{normals:[a],result:new _})}e.forEach((s,o)=>{for(let a of s.normals)s.result.add(a);s.result.divideScalar(s.normals.length)});for(let s=0;s<t.length;s+=3){let o=`${t[s]}_${t[s+1]}_${t[s+2]}`,a=e.get(o)?.result;a&&(i[s]=a.x,i[s+1]=a.y,i[s+2]=a.z)}n.geometry.setAttribute("extrudeNormal",new Se(i,3))}function pF(n){if(n.geometry.attributes.extrudeNormals||!n.geometry.attributes.position)return;let e=n.geometry.attributes.position.array,t=new Float32Array(e.length),r=new _;for(let i=0;i<e.length;i+=3)r.set(e[i],e[i+1],e[i+2]).normalize(),t[i]=r.x,t[i+1]=r.y,t[i+2]=r.z;n.geometry.setAttribute("extrudeNormal",new Se(t,3))}function Vs(n){if(n.objectType!=="TextFrame"){if(Array.isArray(n.material)){for(let e of n.material)if(e.getLayersOfType("outline").length===0)return}else if(!(n.material instanceof vn)||n.material.getLayersOfType("outline").length===0)return;n.objectType==="Mesh2D"?pF(n):fF(n)}}function Hs(n){if(!n.geometry.attributes.position)return;let e=n.geometry.attributes.position.array,t=new Float32Array(e.length),r=parseInt(n.uuid.replace(/\D/g,"")),i=[Je.seededRandom(r),Je.seededRandom(r+1e4),Je.seededRandom(r+2e4)];for(let s=0;s<e.length;s++)t[s]=i[s%3];n.geometry.setAttribute("randomColor",new je(t,3))}var Pt=class extends Cn(kt){constructor(t,r){super(t,r);this.isAbstractMesh=!0;this.booleanMeshSetAddress=-1;this.booleanWasTransformed=!1;this.booleanMatrixInvOld=new Re;this.booleanExclude=null;Array.isArray(r)&&t.groups.length===0&&t.addGroup(0,t.getAttribute("position").count,0)}get isGroup(){return this._cloner?.parameters.hideBase===!0}get isMesh(){return!this.isGroup}set isMesh(t){}get cloner(){return this._cloner}set cloner(t){this._cloner&&this.remove(this._cloner),t&&this.add(t),this._cloner=t}updateGeometry(t){let r=this.geometry,i=Iy[r.userData.type],s=this.objectType==="NonParametric"?Object.assign({},r.userData,{geometry:r}):r.userData,o=i.build(i.normalizeInputs(t,s)),a=r.uuid;this.geometry.dispose(),this.geometry=o,this.geometry.uuid=a,this.geometry.computeBoundingSphere(),Vs(this),r.getAttribute("randomColor")&&Hs(this)}clone(t){let r=this.objectType==="NonParametric"?Object.assign({},this.geometry.userData,{geometry:this.geometry.clone()}):this.geometry.userData,i=Fu(r),s=this.material;return new this.constructor(i,s).copy(this,t)}copy(t,r=!0){return super.copy(t,r),t.cloner&&(this.cloner=new fu(t,t.cloner.parameters),this.add(this.cloner)),this}setFromClonerState(t){t===null?this.cloner=void 0:(this.cloner===void 0&&(this.cloner=new fu(this)),this.cloner.fromClonerState(t))}fromState(t,r){return super.fromState(t),t.type==="Mesh"&&(this.setFromClonerState(t.cloner),this.castShadow=t.castShadow??!0,this.receiveShadow=t.receiveShadow??!0,this.booleanExclude=t.booleanExclude??null),this}freeBooleanPointer(){this.booleanMeshSetAddress!==-1&&(Xn.freeMeshSet(this.booleanMeshSetAddress),this.booleanMeshSetAddress=-1)}invalidateDownstreamBooleanData(t=!1){return t?this.booleanWasTransformed=!0:this.freeBooleanPointer(),At(this.parent)?this.parent.invalidateDownstreamBooleanData():this}invalidateUpstreamBooleanData(){this.freeBooleanPointer();for(let t of this.children)Ut(t)&&(t.freeBooleanPointer(),At(t)&&t.invalidateUpstreamBooleanData())}};var mF=new _(0,0,1),z1=new _,G1=new _,k1=new Gt,Ml=class extends Pt{constructor(t=qr.create({}),r){super(t,r);this.recursiveSelection=!1;this.objectType="VectorObject";this.eventDispatcher=new Bt;this._onShapeUpdate=()=>{this.updateGeometry({}),this.geometry.computeBoundingSphere(),this.geometry.computeBoundingBox()};this.castShadow=!0,this.receiveShadow=!0,this.forceComputeSize=!0,this.shape=t.userData.shape,this.shape.eventDispatcher?.addEventListener("update",this._onShapeUpdate)}fromState(t){return super.fromState(t),this.shape.update(),this}setHelperVisibility(){}updateGeometry(t){if(super.updateGeometry(t),"userData"in this.geometry){let r=this.geometry.userData.parameters;this.eventDispatcher.dispatchEvent({type:"geometryUpdate",parameters:r})}}setShape(t){this.shape&&this.shape.eventDispatcher?.removeEventListener("update",this._onShapeUpdate),this.shape=t,this.shape.eventDispatcher?.addEventListener("update",this._onShapeUpdate)}updateWorldMatrix(t,r){super.updateWorldMatrix(t,r),k1.getNormalMatrix(this.matrixWorld),z1.copy(mF).applyMatrix3(k1).normalize(),G1.setFromMatrixPosition(this.matrixWorld),this.shape.plane.setFromNormalAndCoplanarPoint(z1,G1)}clone(t){let r=this.shape.clone(),i=this.material,s=this.geometry.userData,o=qr.create(Object.assign({},s,{shape:r})),a=new Ml(o,i).copy(this,t);return a.shape=r,r.update(),a}raycast(t,r){Pt.prototype.raycast.call(this,t,r)}};function Cf(n,e){return gF(n)}function gF(n){let e={parameters:n,type:n.type};if(n.type==="VectorGeometry"){let r=vt.createFromState(n.shape,n.width,n.height);e.shape=r}else n.type==="NonParametricGeometry"&&(n.data.groups&&n.data.groups.forEach(r=>r.materialIndex=Math.max(r.materialIndex??0,0)),e.geometry=new wa().parse(n));let t;try{t=Fu(e)}catch(r){console.error(r)}if(!t){let r=vt.createFromState(nl.defaultData(),100,100);e.shape=r,t=Fu(e)}return t}var He;yf.then(n=>{He=n});var V1=new Float32Array([10,10,0,-10,10,0,-10,-10,0,10,-10,0]),H1=new Uint32Array([0,1,2,3]),W1=new Uint8Array([4]),Dn=class{static build(n,e,t,r,i){let s,o,a,l=n?.phongAngle??e?.phongAngle??35;if(r===!1&&(l=-1),n.positionWASM!==void 0){t&&t!==0&&(He.free_bvh(t),He.free_subdivision_surface(t));try{s=Dn.allocate(n,i)}catch(u){console.error(u,n),s=Dn.allocate({positionWASM:V1,indexWASM:H1,verticesPerFaceWASM:W1},i)}He.set_destination_refinement_level(s,0),o=Dn.buildLevel(s,!0,l)}else s=t,n.phongAngle!==void 0&&(o=Dn.buildLevel(s,!0,l));return n.subdivisions!==void 0&&(He.set_destination_refinement_level(s,n.subdivisions),n.subdivisions>0?a=Dn.buildLevel(s,!1,l):a=null),{subdivPointer:s,originalGeometry:o,subdividedGeometry:a}}static primitiveToQuads(n,e){n.widthSegments>16&&(n.widthSegments=16),n.heightSegments>16&&(n.heightSegments=16),n.depthSegments>16&&(n.depthSegments=16),n.radialSegments>16&&(n.radialSegments=16),n.type==="DodecahedronGeometry"&&(n.detail=0);let t=n.shape!==void 0?e.geometry:Cf(n),r,i,s,o;({positions:r,triIndices:o}=By(t.getAttribute("position"),t.getIndex()));let a;if(n.type==="CylinderGeometry"&&n.cornerRadius===0&&n.hollow===0&&n.openEnded===!1){let l=n.radialSegments*n.heightSegments*3*2,u=l+n.radialSegments*3;a=[l,u]}return{indices:i,verticesPerFace:s}=Oy(r,o,t,a),{positions:r,indices:i,verticesPerFace:s}}static allocate(n,e){let t,r,i,s=[],o=[];n.positionWASM&&n.positionWASM.length>0?(t=n.positionWASM,r=n.indexWASM,i=n.verticesPerFaceWASM):(t=V1,r=H1,i=W1);let a=t.length,l=r.length,u=i.length,c=t.length+s.length+o.length,h=r.length+i.length,d=c*Float32Array.BYTES_PER_ELEMENT+h*Uint32Array.BYTES_PER_ELEMENT,f=c*Float32Array.BYTES_PER_ELEMENT,m=h*Uint32Array.BYTES_PER_ELEMENT,p=He._malloc(d),g=new Float32Array(He.HEAPF32.buffer,p,c),y=new Uint32Array(He.HEAPU32.buffer,p+f,h);g.set(t,0),g.set(s,t.length),g.set(o,t.length+s.length),y.set(r,0),y.set(i,r.length);let x;n?.scaleBaked?.some(b=>b!==1)&&(x=new Re().makeScale(...n.scaleBaked)),e&&(x?x.premultiply(e):x=e);let w=x?He.alloc_subdivision_surface2(p,a,p+f,l,p+f+r.length*Uint32Array.BYTES_PER_ELEMENT,u,x.elements):He.alloc_subdivision_surface(p,a,p+f,l,p+f+r.length*Uint32Array.BYTES_PER_ELEMENT,u);return He._free(p),w}static buildLevel(n,e,t,r,i){let s=i?He.get_mesh_data2(n,e?He.Level.CONTROL:He.Level.REFINED,t,i.elements):He.get_mesh_data(n,e?He.Level.CONTROL:He.Level.REFINED,t),o=8,a=He.HEAPU32.subarray(s>>2,(s>>2)+o),l=a.subarray(4,4+4),u=0,c=He.HEAPU32[a[u]>>2],h=He.HEAPF32.subarray(c>>2,(c>>2)+l[u]);u++;let d=He.HEAPU32[a[u]>>2],f=He.HEAPF32.subarray(d>>2,(d>>2)+l[u]);u++;let m=He.HEAPU32[a[u]>>2],p=He.HEAPU32.subarray(m>>2,(m>>2)+l[u]);u++;let g=He.HEAPU32[a[u]>>2],y=He.HEAPU32.subarray(g>>2,(g>>2)+l[u]);if(u++,r===void 0){let x=new De;if(x.setIndex(new ds(y,1)),x.setAttribute("position",new Se(h,3)),x.setAttribute("normal",new Se(f,3)),e){x.setAttribute("faceMap",new ds(p,1));let w=new Float32Array(f.length/3*4).fill(0);x.setAttribute("color",new je(w,4))}return He.free_mesh_data(s),x.userData.type="SubdivGeometry",x}r.getAttribute("position").copyArray(h),r.getAttribute("normal").copyArray(f),r.attributes.position.needsUpdate=!0,r.attributes.normal.needsUpdate=!0,He.free_mesh_data(s)}static buildControlCageWireframe(n,e,t){let r=He.get_wireframe_data_for_base_level(n),i=4,s=He.HEAPU32.subarray(r>>2,(r>>2)+i),o=s.subarray(2,2+2),a=0,l=He.HEAPU32[s[a]>>2],u=He.HEAPF32.subarray(l>>2,(l>>2)+o[a]);a++;let c=He.HEAPU32[s[a]>>2],h=He.HEAPU32.subarray(c>>2,(c>>2)+o[a]);if(e===void 0){let d=new De;d.setAttribute("position",new Se(u,3));let f=new Float32Array(u.length);for(let m=0,p=u.length;m<p;)f[m++]=t.r,f[m++]=t.g,f[m++]=t.b;return d.setAttribute("color",new je(f,3)),d.setIndex(new ds(h,1)),He.free_wireframe_data_for_base_level(r),d}e.getAttribute("position").copyArray(u),e.attributes.position.needsUpdate=!0,He.free_wireframe_data_for_base_level(r)}static updateCollabMesh(n,e,t){let r=e===0;r||He.set_destination_refinement_level(n,e);let i=t?He.get_topological_data2(n,r?He.Level.CONTROL:He.Level.REFINED,t.elements):He.get_topological_data(n,r?He.Level.CONTROL:He.Level.REFINED),s=6,o=He.HEAPU32.subarray(i>>2,(i>>2)+s),a=o.subarray(3,3+3),l=0,u=He.HEAPU32[o[l]>>2],c=new Float32Array(He.HEAPF32.subarray(u>>2,(u>>2)+a[l]));l++;let h=He.HEAPU32[o[l]>>2],d=new Uint32Array(He.HEAPU32.subarray(h>>2,(h>>2)+a[l]));l++;let f=He.HEAPU32[o[l]>>2],m=new Uint8Array(He.HEAPU32.subarray(f>>2,(f>>2)+a[l]));return He.free_topological_data(i),{positions:c,indices:d,verticesPerFace:m}}};var j1=["getX","getY","getZ"];function By(n,e){let t={},r=e?e.count:n.count,i=0,s=[],o=[],a=1e4;for(let u=0;u<r;u++){let c=e?e.getX(u):u,h="";for(let d=0;d<3;d++)h+=`${~~(n[j1[d]](c)*a)},`;if(h in t)s.push(t[h]);else{for(let d=0;d<3;d++)o.push(n[j1[d]](c));t[h]=i,s.push(i),i++}}let l=[];for(let u=0;u<s.length;u+=3)s[u]===s[u+1]||s[u]===s[u+2]||s[u+1]===s[u+2]||l.push(s[u],s[u+1],s[u+2]);return{positions:o,triIndices:l}}var Pf=new _,Ly=new _,Ry=new _,Ny=new _;function Oy(n,e,t,r){let i=[],s=[];if(t.userData.shape!==void 0&&t.userData.parameters.depth===0&&t.userData.shape.shapeHoles.length===0){let o=t.userData.shape.extractShapePointsToFlatArray([]),a=0;for(let u=0;u<o.length;u+=2)a+=(o[u]-o[(u===0?o.length:u)-2])*(o[u+1]+o[(u===0?o.length:u)-1]);n.length=0;let l=0;if(a<0)for(let u=0;u<o.length;u+=2)n.push(o[u],o[u+1],0),i.push(l++);else for(let u=o.length-2;u>=0;u-=2)n.push(o[u],o[u+1],0),i.push(l++);return s.push(l),{indices:i,verticesPerFace:s}}for(let o=0,a=t.capStartIndex??e.length;o<a;)if(e[o+1]===e[o+3]&&e[o+2]===e[o+5]||e[o+0]===e[o+3]&&e[o+2]===e[o+4]){Pf.set(n[e[o]*3],n[e[o]*3+1],n[e[o]*3+2]),Ly.set(n[e[o+1]*3],n[e[o+1]*3+1],n[e[o+1]*3+2]),Ry.set(n[e[o+4]*3],n[e[o+4]*3+1],n[e[o+4]*3+2]),Ny.set(n[e[o+5]*3],n[e[o+5]*3+1],n[e[o+5]*3+2]),Ly.sub(Pf).normalize(),Ry.sub(Pf).normalize(),Ny.sub(Pf).normalize();let l=Ly.cross(Ry).dot(Ny);Math.abs(l)>.005||r&&r.some((u,c)=>c%2===1?!1:o>=r[c]&&o<r[c+1])?(i.push(e[o],e[o+1],e[o+2]),s.push(3),o+=3):(i.push(e[o],e[o+1],e[o+4],e[o+5]),s.push(4),o+=6)}else i.push(e[o],e[o+1],e[o+2]),s.push(3),o+=3;if(t.capStartIndex!==void 0){let o=[],a=[],l=0;for(let u=0,c=0;u<n.length;u+=3,c++)n[u+2]===0&&(o.push(c),l++),n[u+2]===t.userData.parameters.depth&&a.push(c);if(t.userData.parameters.extrudeBevelSize===0){let u=a[0];a[0]=a[1],a[1]=u}o.reverse(),i.push(...o,...a),s.push(l,l)}return{indices:i,verticesPerFace:s}}var Xn={};Pv(Xn,{calcBoolean:()=>xF,calcBooleanTopological:()=>vF,freeMeshSet:()=>SF,getMeshSet:()=>bF,transformMeshSet:()=>wF});var X1,Y1=new Promise(n=>{X1=n}),q1=!1;async function Q1(){if(q1)return;let e=!1?".":"https://unpkg.com/@splinetool/boolean-wasm@0.9.94/build",[t,r]=await Promise.all([import("./boolean.js"),fetch(`${e}/boolean.wasm`).then(o=>o.arrayBuffer())]),s=await t.default({wasmBinary:r});X1(s),q1=!0}var st,Tl;Y1.then(n=>st=n);function yF(n,e){let t,{positions:r,triIndices:i}=By(n.getAttribute("position"),n.getIndex()),s;if(e){let{indices:o,verticesPerFace:a}=Oy(r,i,n);s=a.length,t=[];for(let l=0,u=0;l<s;l++){t.push(a[l]);for(let c=0;c<a[l];c++)t.push(o[u++])}}else{let o=i.length;t=Array(o+o/3),s=0;for(let a=0,l=0;l<t.length;)t[l++]=3,s++,t[l++]=i[a++],t[l++]=i[a++],t[l++]=i[a++]}return{positions:r,faceIndices:t,nFaces:s}}function Z1(n){let e=n.length,t=e*Uint32Array.BYTES_PER_ELEMENT,r=e*Float32Array.BYTES_PER_ELEMENT,i=Number.isInteger(n[0])?t:r,s=st._malloc(i);return(Number.isInteger(n[0])?new Uint32Array(st.HEAPU32.buffer,s,e):new Float32Array(st.HEAPF32.buffer,s,e)).set(n,0),s}function K1(n){switch(n){case 0:return st.OP.UNION;case 1:return st.OP.INTERSECTION;case 2:return st.OP.A_MINUS_B;case 3:return st.OP.B_MINUS_A;case 4:return st.OP.SYMMETRIC_DIFFERENCE;case 5:return st.OP.ALL;default:throw new Error("Unknown boolean operation "+n)}}function vF(n,e){Tl===void 0&&(Tl=st.init_csg());let t=Z1(n),r=st.csg_calc_topological(Tl,t,n.length,K1(e));st._free(t);let i=6,s=st.HEAPU32.subarray(r>>2,(r>>2)+i),o=s.subarray(3,3+3),a=0,l=st.HEAPU32[s[a]>>2],u=new Float32Array(st.HEAPF32.subarray(l>>2,(l>>2)+o[a]));a++;let c=st.HEAPU32[s[a]>>2],h=new Uint32Array(st.HEAPU32.subarray(c>>2,(c>>2)+o[a]));a++;let d=st.HEAPU32[s[a]>>2],f=new Uint8Array(st.HEAPU32.subarray(d>>2,(d>>2)+o[a]));return st.free_mesh_data(r),{positions:u,indices:h,verticesPerFace:f}}function xF(n,e,t,r){Tl===void 0&&(Tl=st.init_csg());let i=Z1(n),s=st.csg_calc(Tl,i,n.length,r,K1(e));st._free(i);let o=5,a=st.HEAPU32.subarray(s>>2,(s>>2)+o),l=a.subarray(2,2+3),u=0,c=st.HEAPU32[a[u]>>2],h=st.HEAPF32.subarray(c>>2,(c>>2)+l[u]);u++;let d=st.HEAPU32[a[u]>>2],f=st.HEAPF32.subarray(d>>2,(d>>2)+l[u]);u++;let m=l[u];t.setAttribute("position",new Se(h,3)),t.setAttribute("normal",new Se(f,3));let p=st.HEAPF32.subarray((s>>2)+5,(s>>2)+5+6);return t.boundingSphere===null&&(t.boundingSphere=new Dr),t.boundingSphere.center.set(p[0],p[1],p[2]),t.boundingSphere.radius=(p[3]**2+p[4]**2+p[5]**2)**.5,t.userData.parameters={width:p[3]*2,height:p[4]*2,depth:p[5]*2},st.free_mesh_data(s),m}function bF(n,e){if(st===void 0)return-1;let t,r,i;if(e&&n.userData.positions!==void 0){let p=n.userData;i=p.verticesPerFace.length,t=p.positions,r=Array(p.verticesPerFace.reduce((g,y)=>g+y,0)+i);for(let g=0,y=0,x=0;g<p.verticesPerFace.length;g++){r[x++]=p.verticesPerFace[g];for(let w=0;w<p.verticesPerFace[g];w++)r[x++]=p.indices[y++]}}else({positions:t,faceIndices:r,nFaces:i}=yF(n,e));let s=t.length,o=r.length,a=t.length,l=r.length,u=a*Float32Array.BYTES_PER_ELEMENT+l*Uint32Array.BYTES_PER_ELEMENT,c=a*Float32Array.BYTES_PER_ELEMENT,h=l*Uint32Array.BYTES_PER_ELEMENT,d=st._malloc(u),f=new Float32Array(st.HEAPF32.buffer,d,a),m=new Uint32Array(st.HEAPU32.buffer,d+c,l);return f.set(t,0),m.set(r,0),st.get_csg_mesh(d,s,d+c,o,i)}function wF(n,e){st.transform_csg_mesh(n,e.elements)}function SF(n){st.free_csg_mesh(n)}var Iy={ConeGeometry:BS,CubeGeometry:OS,CylinderGeometry:NS,DodecahedronGeometry:FS,EllipseGeometry:s1,HelixGeometry:c1,IcosahedronGeometry:u1,LatheGeometry:h1,NonParametricGeometry:d1,PolygonGeometry:f1,PyramidGeometry:p1,RectangleGeometry:m1,SphereGeometry:g1,PlaneGeometry:y1,BackdropGeometry:v1,StarGeometry:x1,TextFrameGeometry:gf,TorusGeometry:b1,TorusKnotGeometry:w1,TriangleGeometry:S1,VectorGeometry:qr},Fu=n=>Iy[n.type].create(n);var J1=new Re;function Fy(n){let e=!1;return n.scene.objects.traverse((t,r)=>{r.geometry?.type==="BooleanGeometry"&&(e=!0)}),e}var Df=class extends Pt{constructor(t=new De,r){super(t,r);this.booleanOp=2;this.phongAngle=35;this.meshSetAddresses=[];this.needsTransformForDownstream=!1;this.objectType="BooleanObject",this.castShadow=!0,this.receiveShadow=!0,this.geometry.userData.parameters={width:0,height:0,depth:0},this.onAfterRender=this.recomputeBoolean.bind(this)}reInit(){this.objectType="BooleanObject",this.meshSetAddresses=[],this.needsTransformForDownstream=!1,this.geometry.userData.parameters={width:0,height:0,depth:0},this.onAfterRender=this.recomputeBoolean.bind(this)}recomputeBoolean(t){if(this.booleanMeshSetAddress!==-1)return;for(let i=0;i<this.children.length;i++){let s=this.children[i];At(s)&&s.recomputeBoolean(t===!0)}this.meshSetAddresses=[];for(let i=0;i<this.children.length;i++){let s=this.children[i];if(P1(s)&&s.booleanExclude===!1&&s.geometry.attributes.position?.count>0&&s.geometry.drawRange.count>0){if(s.booleanMeshSetAddress===-1){if(s.booleanMeshSetAddress=Xn.getMeshSet(s.geometry,t===!0),s.booleanMeshSetAddress===-1)return;Xn.transformMeshSet(s.booleanMeshSetAddress,s.matrix),s.booleanMatrixInvOld.copy(s.matrix).invert(),s.booleanWasTransformed=!1}else At(s)&&s.needsTransformForDownstream===!0?(Xn.transformMeshSet(s.booleanMeshSetAddress,s.matrix),s.needsTransformForDownstream=!1):s.booleanWasTransformed===!0&&(J1.multiplyMatrices(s.matrix,s.booleanMatrixInvOld),Xn.transformMeshSet(s.booleanMeshSetAddress,J1),s.booleanMatrixInvOld.copy(s.matrix).invert(),s.booleanWasTransformed=!1);this.meshSetAddresses.push(s.booleanMeshSetAddress)}}if(this.meshSetAddresses.length===0){this.geometry.setDrawRange(0,0);return}if(t===!0)return Xn.calcBooleanTopological(this.meshSetAddresses,this.booleanOp);let r=this.geometry;r.dispose(),this.geometry=new De,this.geometry.userData=r.userData,this.geometry.boundingSphere=r.boundingSphere;try{this.booleanMeshSetAddress=Xn.calcBoolean(this.meshSetAddresses,this.booleanOp,this.geometry,this.phongAngle)}catch(i){this.booleanMeshSetAddress=0,console.error(i)}this.booleanMatrixInvOld.copy(this.matrix).invert(),this.needsTransformForDownstream=!0,Vs(this),Hs(this)}updateGeometry(t){let r=t.parameters;r.operation!==void 0&&(this.booleanOp=r.operation),r.phongAngle!==void 0&&(this.phongAngle=r.phongAngle),this.invalidateDownstreamBooleanData().recomputeBoolean()}};var _i=n=>{var e;return e=class extends n{constructor(){super(...arguments);this.isObjectHelper=!0}},e.geometryHelper=new Zr(30,30,30),e};var If=new ki,Uy=new Dr,$1=new Re,Ai=(n,e,t,r,i=!1)=>{let s=e,o=n.matrixWorld;if(s.boundingSphere===null&&s.computeBoundingSphere(),Uy.copy(s.boundingSphere),Uy.applyMatrix4(o),t.ray.intersectsSphere(Uy)===!1||($1.copy(o).invert(),If.copy(t.ray).applyMatrix4($1),s.boundingBox!==null&&If.intersectsBox(s.boundingBox)===!1))return;let a,l,u,c,h=s.index,d=s.attributes.position,f=s.drawRange,m,p;if(i===!1){let y=Math.max(0,f.start),x=Math.min(h.count,f.start+f.count);for(m=y,p=x;m<p;m+=3)if(l=h.getX(m),u=h.getX(m+1),c=h.getX(m+2),a=g(n,t,If,d,l,u,c),a){a.faceIndex=Math.floor(m/3),r.push(a);return}}else{let x=s.attributes.position,w=new _,b=new _,S=new _,A=new _,M=2,T=1/((n.scale.x+n.scale.y+n.scale.z)/3),E=T*T,C=Math.max(0,f.start),L=Math.min(x.count,f.start+f.count);for(let N=C,R=L-1;N<R;N+=M){if(w.fromBufferAttribute(x,N),b.fromBufferAttribute(x,N+1),If.distanceSqToSegment(w,b,A,S)>E)continue;A.applyMatrix4(n.matrixWorld);let j=t.ray.origin.distanceTo(A);j<t.near||j>t.far||r.push({distance:j,point:S.clone().applyMatrix4(n.matrixWorld),object:n})}}function g(y,x,w,b,S,A,M){let v=new _,T=new _,E=new _,C=new _,L=new _;if(v.fromBufferAttribute(b,S),T.fromBufferAttribute(b,A),E.fromBufferAttribute(b,M),w.intersectTriangle(v,T,E,!1,C)===null)return null;L.copy(C),L.applyMatrix4(y.matrixWorld);let R=x.ray.origin.distanceTo(L);return R<x.near||R>x.far?null:{faceIndex:1,distance:R,point:L.clone(),object:y}}};var Lf=new _,In=new Un,zy=class extends ps{constructor(t){let r=new De,i=new wn({color:16777215,vertexColors:!0,toneMapped:!1}),s=[],o=[],a={},l=new Oe(15711266),u=new Oe(15711266),c=new Oe(2857471);h("n1","n2",l),h("n2","n4",l),h("n4","n3",l),h("n3","n1",l),h("f1","f2",l),h("f2","f4",l),h("f4","f3",l),h("f3","f1",l),h("n1","f1",l),h("n2","f2",l),h("n3","f3",l),h("n4","f4",l),h("p","n1",u),h("p","n2",u),h("p","n3",u),h("p","n4",u),h("u1","u2",c),h("u2","u3",c),h("u3","u1",c);function h(f,m,p){d(f,p),d(m,p)}function d(f,m){s.push(0,0,0),o.push(m.r,m.g,m.b),a[f]===void 0&&(a[f]=[]),a[f].push(s.length/3-1)}r.setAttribute("position",new Se(s,3)),r.setAttribute("color",new Se(o,3));super(r,i);this.type="CameraHelper",this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update()}update(){let t=this.geometry,r=this.pointMap,i=!0;In.projectionMatrixInverse.elements=[.5112609807824982,-0,-0,-0,-0,.41421356237309503,-0,-0,-0,-0,-0,-.099999,-0,-0,-1.0000000000000002,.100001];let s=1,o=1,a=i?.8:1e-4;Yn("n1",r,t,In,-s,-o,a),Yn("n2",r,t,In,s,-o,a),Yn("n3",r,t,In,-s,o,a),Yn("n4",r,t,In,s,o,a);let l=a;Yn("f1",r,t,In,-s,-o,l),Yn("f2",r,t,In,s,-o,l),Yn("f3",r,t,In,-s,o,l),Yn("f4",r,t,In,s,o,l);let u=l,c=.5;Yn("u1",r,t,In,s*.7*c,o*1.1,u),Yn("u2",r,t,In,-s*.7*c,o*1.1,u),Yn("u3",r,t,In,0,o*(1.1+.9*c),u),t.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}};function Yn(n,e,t,r,i,s,o){Lf.set(i,s,o).unproject(r);let a=e[n];if(a!==void 0){let l=t.getAttribute("position");for(let u=0,c=a.length;u<c;u++)l.setXYZ(a[u],Lf.x,Lf.y,Lf.z)}}var Rf=class extends _i(zy){constructor(t){super(t);this.object=t;this.object=t,this.name=`CombinedCameraHelper: ${t.uuid}`}updateMatrixWorld(t){super.updateMatrixWorld(t),this.updateTarget()}updateTarget(){let t=this.object.getTarget();this.updateWorldMatrix(!0,!1),this.worldToLocal(t)}raycast(t,r){Ai(this.object,this.geometry,t,r,!0)}};var El=class extends _i(kh){constructor(t,r=15,i=10066329){super(t,r,i);this.object=t;this.added=!1;this.name=`DirectionalLightHelper: ${t.uuid}`}raycast(t,r){Ai(this.object,El.geometryHelper,t,r)}};var Cl=class extends _i(Vh){constructor(t,r=15){super(r);this.object=t;this.object.updateMatrixWorld(),this.name=`EmptyObjectHelper: ${t.uuid}`,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1}raycast(t,r){Ai(this.object,Cl.geometryHelper,t,r)}update(){}};var Pl=class extends _i(Gh){constructor(t,r=15,i=6710886){super(t,r,i);this.object=t;this.name=`PointLightHelper: ${t.uuid}`}raycast(t,r){Ai(this.object,Pl.geometryHelper,t,r)}};var Nf=class extends _i(zh){constructor(t,r=6710886){super(t,r);this.object=t;this.name=`SpotLightHelper: ${t.uuid}`}raycast(t,r){Ai(this.object,Nf.geometryHelper,t,r)}update(){if(this.object!==void 0){let t=Nf._vector,r=this.object.distance?this.object.distance:1e3,i=r*Math.tan(this.object.angle);this.cone.scale.set(i,i,r),t.setFromMatrixPosition(this.object.target.matrixWorld),this.cone.lookAt(t);let s=this.color!==void 0?this.color:this.light.color;if(this.cone.material instanceof Array)for(let o=0,a=this.cone.material.length;o<a;o++)this.cone.material[o].color.set(s);else this.cone.material.color.set(s)}}},Uu=Nf;Uu._vector=new _;var Mi=(n,e)=>class extends n{constructor(){super(...arguments);this.objectHelper=new e(this)}get geometryHelper(){return e.geometryHelper}raycast(i,s){this.objectHelper.raycast(i,s)}fromLightState(i,s){if(this.objectType==="LightDirectional"||this.objectType==="LightPoint"||this.objectType==="LightSpot"){let o=this;i.color!==void 0&&(o.color=or(i.color,s)),i.intensity!==void 0&&(o.intensity=i.intensity),i.depth!==void 0&&(o.shadow.camera.far=i.depth,o.shadow.needsUpdate=!0),i.shadows!==void 0&&(this.castShadow=i.shadows)}return this}};var Dl=new _,Gy=new _,Yr=class extends Mi(Cn(Un),Rf){constructor(t=window.innerWidth,r=window.innerHeight,i=45,s,o=1e5){super();this.objectType="CombinedCamera";this._cameraType="OrthographicCamera";this.targetOffset=So.DefaultTargetOffset;this.isUpVectorFlipped=!1;this.angleOffsetFromUp=0;this.width=t,this.height=r,this.orthoCamera=new ca(t*-.5,t*.5,r*.5,r*-.5,s??-5e4,o),this.perspCamera=new Zt(i,t/r,s??50,o),this.left=this.orthoCamera.left,this.right=this.orthoCamera.right,this.top=this.orthoCamera.top,this.bottom=this.orthoCamera.bottom,this.far=this.orthoCamera.far,this.view=this.orthoCamera.view,this.aspect=this.perspCamera.aspect,this.fov=this.perspCamera.fov,this.focus=this.perspCamera.focus,this.filmGauge=this.perspCamera.filmGauge,this.filmOffset=this.perspCamera.filmOffset,this.toOrthographic()}static createFromState(t,r){let i=new Yr().fromState(r);return i.objectHelper.update(),i.uuid=t,i}get isPerspectiveCamera(){return this.cameraType==="PerspectiveCamera"}get isOrthographicCamera(){return!this.isPerspectiveCamera}get cameraType(){return this._cameraType}setNear(t,r){t==="PerspectiveCamera"?this.perspCamera.near=r:this.orthoCamera.near=r}setZoom(t,r){r>=0&&(t==="PerspectiveCamera"?this.perspCamera.zoom=r:this.orthoCamera.zoom=r)}set cameraType(t){t==="PerspectiveCamera"?this.toPerspective():t==="OrthographicCamera"&&this.toOrthographic()}get near(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.near:this.orthoCamera.near}set near(t){this._cameraType==="PerspectiveCamera"?this.perspCamera.near=t:this.orthoCamera.near=t}get zoom(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom:this.orthoCamera.zoom}set zoom(t){t>=0&&(this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom=t:this.orthoCamera.zoom=t)}lookAt(t){super.lookAt(t),this.getWorldPosition(Dl),this.targetOffset=Dl.distanceTo(t)}getTarget(t=new _){return this.getWorldDirection(Gy),this.getWorldPosition(Dl),Gy.multiplyScalar(this.targetOffset),t.copy(Dl).add(Gy),t}getDistanceToTarget(){let t=this.getTarget();return this.getWorldPosition(Dl),Dl.distanceTo(t)}updateUp(){let t=this.getWorldQuaternion(new qt),r=new _(0,0,1).applyQuaternion(t),i=new _().copy(ot.DefaultUp);this.isUpVectorFlipped&&i.negate(),i.applyQuaternion(t);let s=new _().copy(ot.DefaultUp).projectOnPlane(r),o=new _().crossVectors(s,i).dot(r)>=0?1:-1;this.angleOffsetFromUp=s.angleTo(i)*o}getViewFrontToObject(t){let r=t.getWorldPosition(new _),s=t.getWorldDirection(new _).multiplyScalar(this.targetOffset);return{position:r.clone().add(s),target:r}}getViewToObject(t){let r=t.getWorldPosition(new _),s=this.getWorldDirection(new _).multiplyScalar(this.targetOffset);return{position:r.clone().sub(s),target:r}}setViewplaneSize(t,r){this.left=-t*.5,this.right=t*.5,this.top=r*.5,this.bottom=-r*.5,this.aspect=t/r,this.updateProjectionMatrix()}toOrthographic(){this.orthoCamera.left=this.left,this.orthoCamera.right=this.right,this.orthoCamera.top=this.top,this.orthoCamera.bottom=this.bottom,this.orthoCamera.view=this.view,this.orthoCamera.far=this.far,this.orthoCamera.updateProjectionMatrix(),this.projectionMatrix=this.orthoCamera.projectionMatrix,this.projectionMatrixInverse=this.orthoCamera.projectionMatrixInverse,this._cameraType="OrthographicCamera",this.objectHelper&&this.objectHelper.update()}toPerspective(){this.perspCamera.aspect=this.aspect,this.perspCamera.fov=this.fov,this.perspCamera.view=this.view,this.perspCamera.far=this.far,this.perspCamera.updateProjectionMatrix(),this.projectionMatrix=this.perspCamera.projectionMatrix,this.projectionMatrixInverse=this.perspCamera.projectionMatrixInverse,this._cameraType="PerspectiveCamera",this.objectHelper&&this.objectHelper.update()}setFocalLength(t){this.perspCamera.setFocalLength(t),this.toPerspective()}getFocalLength(){return this.perspCamera.getFocalLength()}getEffectiveFOV(){return this.perspCamera.getEffectiveFOV()}getFilmWidth(){return this.perspCamera.getFilmWidth()}getFilmHeight(){return this.perspCamera.getFilmHeight()}setViewOffset(t,r,i,s,o,a){this._cameraType==="PerspectiveCamera"?this.perspCamera.setViewOffset(t,r,i,s,o,a):this.orthoCamera.setViewOffset(t,r,i,s,o,a)}clearViewOffset(){this._cameraType==="PerspectiveCamera"?(this.perspCamera.clearViewOffset(),this.toPerspective()):(this.orthoCamera.clearViewOffset(),this.toOrthographic())}updateProjectionMatrix(){this._cameraType==="PerspectiveCamera"?this.toPerspective():this._cameraType==="OrthographicCamera"&&this.toOrthographic()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,r){super.updateWorldMatrix(t,r),this.matrixWorldInverse.copy(this.matrixWorld).invert()}copy(t,r){return super.copy(t,r),this.orthoCamera.copy(t.orthoCamera),this.perspCamera.copy(t.perspCamera),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.far=t.far,this.view=t.view===null?null:Object.assign({},t.view),this._cameraType=t._cameraType,this.aspect=t.aspect,this.fov=t.fov,this.focus=t.focus,this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this.targetOffset=t.targetOffset,this.updateProjectionMatrix(),this}toCameraState(t=[]){let r={type:this.cameraType,far:this.far,orthographic:{near:this.orthoCamera.near,zoom:this.orthoCamera.zoom},perspective:{near:this.perspCamera.near,fov:this.perspCamera.fov,zoom:this.perspCamera.zoom},up:this.up.toArray(),targetOffset:this.targetOffset,isUpVectorFlipped:this.isUpVectorFlipped};return Ja(r,t)}fromCameraState(t){let{orthographic:r,perspective:i}=t;return t.type!==void 0&&(this.cameraType=t.type),t.far!==void 0&&(this.far=t.far),r!==void 0&&(r.near!==void 0&&(this.orthoCamera.near=r.near),r.zoom!==void 0&&(this.orthoCamera.zoom=r.zoom)),i!==void 0&&(i.near!==void 0&&(this.perspCamera.near=i.near),i.fov!==void 0&&(this.perspCamera.fov=i.fov),i.zoom!==void 0&&(this.perspCamera.zoom=i.zoom)),t.up!==void 0&&this.up.fromArray(t.up),t.targetOffset!==void 0&&(this.targetOffset=t.targetOffset),t.isUpVectorFlipped!==void 0&&(this.isUpVectorFlipped=t.isUpVectorFlipped),this.updateProjectionMatrix(),this}toState(t){return{...super.toState(t),...this.toCameraState(t),type:this.cameraType}}fromState(t){return super.fromState(t),this.fromCameraState(t),this}};var Io=class extends Mi(Cn(ss),Cl){constructor(){super(...arguments);this.objectType="EmptyObject"}static createFromState(t,r){let i=new Io().fromState(r);return i.uuid=t,i.objectHelper.update(),i}};var Il=class extends Mi(Cn(Oh),El){constructor(...t){super(...t);this.objectType="LightDirectional";this._gizmos={};this.castShadow=!0,this.shadow.mapSize.width=2048,this.shadow.mapSize.height=2048,this.shadow.normalBias=1,this.layers.enable(3);let i=this.shadow.camera;i.top=1250,i.bottom=-1250,i.right=1250,i.left=-1250,i.near=-1e4,i.far=2500;let s=new _n(this.shadow.camera);s.visible=!1,this._gizmos.shadowmap=s,this.update()}static createFromState(t,r,i){let s=new Il().fromState(r,i);return s.uuid=t,s}get gizmos(){return this._gizmos}showGizmos(){for(let t in this._gizmos){let r=this._gizmos[t];r instanceof _n&&(r.visible=!0)}}hideGizmos(){for(let t in this._gizmos){let r=this._gizmos[t];r instanceof _n&&(r.visible=!1)}}update(){this.shadow.camera.updateProjectionMatrix();for(let t in this._gizmos){let r=this._gizmos[t];r instanceof _n&&r.update()}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.objectHelper&&this.objectHelper.update()}fromDirectionalLightState(t,r){let i=t.depth!==void 0&&t.depth!==this.shadow.camera.far||t.size!==void 0&&t.size/2!==this.shadow.camera.right;return super.fromLightState(t,r),t.size!==void 0&&T1(this,t.size),t.shadowRadius!==void 0&&(this.shadow.radius=t.shadowRadius),t.shadowResolution!==void 0&&(this.shadow.mapSize.set(t.shadowResolution,t.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null)),i&&this.update(),this}fromState(t,r){return super.fromState(t),this.fromDirectionalLightState(t,r),this}};var Ll=class extends Mi(Cn(Bh),Pl){constructor(...t){super(...t);this.objectType="LightPoint";this._gizmos={};this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024,this.shadow.normalBias=1,this.layers.enable(3);let i=this.shadow.camera;i.fov=90,i.aspect=1,i.near=100,i.far=2500;let s=new _(-i.far+this.position.x,-i.far+this.position.y,-i.far+this.position.z),o=new _(i.far+this.position.x,i.far+this.position.y,i.far+this.position.z),a=new br(s,o),l=new yo(a,new Oe(16755200));l.visible=!1,this._gizmos.shadowmap=l,this.update()}static createFromState(t,r,i){let s=new Ll().fromState(r,i);return s.uuid=t,s}get gizmos(){return this._gizmos}showGizmos(){for(let t in this._gizmos){let r=this._gizmos[t];r instanceof yo&&(r.visible=!0)}}hideGizmos(){for(let t in this._gizmos){let r=this._gizmos[t];r instanceof yo&&(r.visible=!1)}}update(){if(this.shadow&&(this.shadow.camera.updateProjectionMatrix(),this._gizmos))for(let t in this._gizmos){let r=this._gizmos[t];if(r instanceof yo){let i=this.shadow.camera,s=new _(-i.far+this.position.x,-i.far+this.position.y,-i.far+this.position.z),o=new _(i.far+this.position.x,i.far+this.position.y,i.far+this.position.z);r.box.set(s,o),r.updateMatrixWorld(!0)}}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.objectHelper&&this.objectHelper.update()}fromPointLightState(t,r){return super.fromLightState(t,r),t.distance!==void 0&&(this.distance=t.distance),t.decay!==void 0&&(this.decay=t.decay),t.shadowRadius!==void 0&&(this.shadow.radius=t.shadowRadius),t.shadowResolution!==void 0&&(this.shadow.mapSize.set(t.shadowResolution,t.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null)),this}fromState(t,r){return super.fromState(t),this.fromPointLightState(t,r),this}};var e_=new _,t_=new _,r_=new qt,Rl=class extends Mi(Cn(Nh),Uu){constructor(...t){super(...t);this.objectType="LightSpot";this._gizmos={};this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024,this.shadow.normalBias=1,this.layers.enable(3);let i=this.shadow.camera;i.fov=Je.RAD2DEG*2*this.angle,i.aspect=1,i.near=100,i.far=2500;let s=new _n(this.shadow.camera);s.visible=!1,this._gizmos.shadowmap=s,this.update()}static createFromState(t,r,i){let s=new Rl().fromState(r,i);return s.uuid=t,s}get gizmos(){return this._gizmos}showGizmos(){for(let t in this._gizmos){let r=this._gizmos[t];r instanceof _n&&(r.visible=!0)}}hideGizmos(){for(let t in this._gizmos){let r=this._gizmos[t];r instanceof _n&&(r.visible=!1)}}update(){this.shadow.camera.updateProjectionMatrix();for(let t in this._gizmos){let r=this._gizmos[t];r instanceof _n&&r.update()}}updateMatrixWorld(t){super.updateMatrixWorld(t),t_.setFromMatrixPosition(this.matrixWorld),r_.setFromRotationMatrix(this.matrixWorld),e_.copy(this.up).applyQuaternion(r_).negate().multiplyScalar(this.distance),this.target.position.copy(t_).add(e_),this.target.updateMatrixWorld(),this.objectHelper&&this.objectHelper.update()}fromSpotLightState(t,r){return super.fromLightState(t,r),t.distance!==void 0&&(this.distance=t.distance),t.decay!==void 0&&(this.decay=t.decay),t.angle!==void 0&&(this.angle=t.angle),t.penumbra!==void 0&&(this.penumbra=t.penumbra),t.shadowRadius!==void 0&&(this.shadow.radius=t.shadowRadius),t.shadowResolution!==void 0&&(this.shadow.mapSize.set(t.shadowResolution,t.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null)),this}fromState(t,r){return super.fromState(t),this.fromSpotLightState(t,r),this}};var n_=n=>n.tagName==="VIDEO",Nl=class{static resize(e,t,r){let i=e/t,s;if(!r.image)return;let o=r.image;n_(o)?s=o.videoWidth/o.videoHeight:s=o.width/o.height,i>s&&(r.imageType=="WEBCAM"?r.repeat.set(-1,1*s/i):r.repeat.set(1,1*s/i)),i<s&&(r.imageType=="WEBCAM"?r.repeat.set(1*i/s*-1,1):r.repeat.set(1*i/s,1)),i==s&&(r.imageType=="WEBCAM"?r.repeat.set(-1,1):r.repeat.set(1,1))}static resizeTextureLayer(e,t,r){let i=e/t,s=r.image!==void 0?r.image.width/r.image.height:1,o;i>s?o={x:1,y:s/i}:i<s?o={x:i/s,y:1}:o={x:1,y:1},r.repeat.set(o.x,o.y),r.updateMatrix()}static resizeTextureLayers(e,t,r){let i=r.layers;for(let s=0;s<i.length;s++){let o=i[s];F1(o)&&Nl.resizeTextureLayer(e,t,o.uniforms[`f${o.id}_texture`].value)}}static resizeComplex(e,t,r,i){let s=e/t,o,a=r.image;n_(a)?o=a.videoWidth/a.videoHeight:o=a.width/a.height,i.geometry.type.includes("Shape")?(s>o&&(r.imageType=="WEBCAM"?r.repeat.set(1/e*-1,1/t*o/s):r.repeat.set(1/e,1/t*o/s)),s<o&&(r.imageType=="WEBCAM"?r.repeat.set(1/e*s/o*-1,1/t):r.repeat.set(1/e*s/o,1/t)),s==o&&(r.imageType=="WEBCAM"?r.repeat.set(1/e*-1,1/t):r.repeat.set(1/e,1/t))):(s>o&&(r.imageType=="WEBCAM"?r.repeat.set(-1,1*o/s):r.repeat.set(1,1*o/s)),s<o&&(r.imageType=="WEBCAM"?r.repeat.set(1*s/o*-1,1):r.repeat.set(1*s/o,1)),s==o&&(r.imageType=="WEBCAM"?r.repeat.set(-1,1):r.repeat.set(1,1)))}};var Bf=class extends Pt{constructor(t,r){super(t,r);this.objectType="Mesh2D";this.castShadow=!0,this.receiveShadow=!0}updateGeometry(t){super.updateGeometry(t),this.material.layers&&Nl.resizeTextureLayers(this.geometry.userData.parameters.width,this.geometry.userData.parameters.height,this.material)}};var Bl=class extends Pt{constructor(t,r){super(t,r);this.objectType="Mesh3D";this.castShadow=!0,this.receiveShadow=!0}};var Of=class extends Bl{constructor(t,r){super(t,r);this.objectType="NonParametric"}};var Ff=class extends gs{constructor(e){super(e)}load(e,t,r,i){let s=this,o=new ys(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(s.withCredentials),o.load(e,function(a){let l;try{l=JSON.parse(a)}catch{console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),l=JSON.parse(a.substring(65,a.length-2))}let u=s.parse(l);t&&t(u)},r,i)}parse(e){return new ky(e)}},ky=class{constructor(e){this.isFont=!0,this.type="Font",this.data=e}generateShapes(e,t=100){let r=[],i=AF(e,t,this.data);for(let s=0,o=i.length;s<o;s++)r.push(...i[s].toShapes());return r}};function AF(n,e,t){let r=Array.from(n),i=e/t.resolution,s=(t.boundingBox.yMax-t.boundingBox.yMin+t.underlineThickness)*i,o=[],a=0,l=0;for(let u=0;u<r.length;u++){let c=r[u];if(c===`
4905
+ `,Ef=new ht({vertexShader:hF,fragmentShader:dF,uniforms:{depthContrast:{value:1}}});function fF(n){if(n.geometry.attributes.extrudeNormal||!n.geometry.attributes.position)return;let e=new Map,t=n.geometry.attributes.position.array,r=n.geometry.attributes.normal.array,i=new Float32Array(t.length);for(let s=0;s<t.length;s+=3){let o=`${t[s]}_${t[s+1]}_${t[s+2]}`,a=new _(r[s],r[s+1],r[s+2]);e.has(o)?e.get(o)?.normals.push(a):e.set(o,{normals:[a],result:new _})}e.forEach((s,o)=>{for(let a of s.normals)s.result.add(a);s.result.divideScalar(s.normals.length)});for(let s=0;s<t.length;s+=3){let o=`${t[s]}_${t[s+1]}_${t[s+2]}`,a=e.get(o)?.result;a&&(i[s]=a.x,i[s+1]=a.y,i[s+2]=a.z)}n.geometry.setAttribute("extrudeNormal",new Se(i,3))}function pF(n){if(n.geometry.attributes.extrudeNormals||!n.geometry.attributes.position)return;let e=n.geometry.attributes.position.array,t=new Float32Array(e.length),r=new _;for(let i=0;i<e.length;i+=3)r.set(e[i],e[i+1],e[i+2]).normalize(),t[i]=r.x,t[i+1]=r.y,t[i+2]=r.z;n.geometry.setAttribute("extrudeNormal",new Se(t,3))}function Vs(n){if(n.objectType!=="TextFrame"){if(Array.isArray(n.material)){for(let e of n.material)if(e.getLayersOfType("outline").length===0)return}else if(!(n.material instanceof vn)||n.material.getLayersOfType("outline").length===0)return;n.objectType==="Mesh2D"?pF(n):fF(n)}}function Hs(n){if(!n.geometry.attributes.position)return;let e=n.geometry.attributes.position.array,t=new Float32Array(e.length),r=parseInt(n.uuid.replace(/\D/g,"")),i=[Je.seededRandom(r),Je.seededRandom(r+1e4),Je.seededRandom(r+2e4)];for(let s=0;s<e.length;s++)t[s]=i[s%3];n.geometry.setAttribute("randomColor",new je(t,3))}var Pt=class extends Cn(kt){constructor(t,r){super(t,r);this.isAbstractMesh=!0;this.booleanMeshSetAddress=-1;this.booleanWasTransformed=!1;this.booleanMatrixInvOld=new Re;this.booleanExclude=null;Array.isArray(r)&&t.groups.length===0&&t.addGroup(0,t.getAttribute("position").count,0)}get isGroup(){return this._cloner?.parameters.hideBase===!0}get isMesh(){return!this.isGroup}set isMesh(t){}get cloner(){return this._cloner}set cloner(t){this._cloner&&this.remove(this._cloner),t&&this.add(t),this._cloner=t}updateGeometry(t){let r=this.geometry,i=Iy[r.userData.type],s=this.objectType==="NonParametric"?Object.assign({},r.userData,{geometry:r}):r.userData,o=i.build(i.normalizeInputs(t,s)),a=r.uuid;this.geometry.dispose(),this.geometry=o,this.geometry.uuid=a,this.geometry.computeBoundingSphere(),Vs(this),r.getAttribute("randomColor")&&Hs(this)}clone(t){let r=this.objectType==="NonParametric"?Object.assign({},this.geometry.userData,{geometry:this.geometry.clone()}):this.geometry.userData,i=Fu(r),s=this.material;return new this.constructor(i,s).copy(this,t)}copy(t,r=!0){return super.copy(t,r),t.cloner&&(this.cloner=new fu(t,t.cloner.parameters),this.add(this.cloner)),this}setFromClonerState(t){t===null?this.cloner=void 0:(this.cloner===void 0&&(this.cloner=new fu(this)),this.cloner.fromClonerState(t))}fromState(t,r){return super.fromState(t),t.type==="Mesh"&&(this.setFromClonerState(t.cloner),this.castShadow=t.castShadow??!0,this.receiveShadow=t.receiveShadow??!0,this.booleanExclude=t.booleanExclude??null),this}freeBooleanPointer(){this.booleanMeshSetAddress!==-1&&(Xn.freeMeshSet(this.booleanMeshSetAddress),this.booleanMeshSetAddress=-1)}invalidateDownstreamBooleanData(t=!1){return t?this.booleanWasTransformed=!0:this.freeBooleanPointer(),At(this.parent)?this.parent.invalidateDownstreamBooleanData():this}invalidateUpstreamBooleanData(){this.freeBooleanPointer();for(let t of this.children)Ut(t)&&(t.freeBooleanPointer(),At(t)&&t.invalidateUpstreamBooleanData())}};var mF=new _(0,0,1),z1=new _,G1=new _,k1=new Gt,Ml=class extends Pt{constructor(t=qr.create({}),r){super(t,r);this.recursiveSelection=!1;this.objectType="VectorObject";this.eventDispatcher=new Bt;this._onShapeUpdate=()=>{this.updateGeometry({}),this.geometry.computeBoundingSphere(),this.geometry.computeBoundingBox()};this.castShadow=!0,this.receiveShadow=!0,this.forceComputeSize=!0,this.shape=t.userData.shape,this.shape.eventDispatcher?.addEventListener("update",this._onShapeUpdate)}fromState(t){return super.fromState(t),this.shape.update(),this}setHelperVisibility(){}updateGeometry(t){if(super.updateGeometry(t),"userData"in this.geometry){let r=this.geometry.userData.parameters;this.eventDispatcher.dispatchEvent({type:"geometryUpdate",parameters:r})}}setShape(t){this.shape&&this.shape.eventDispatcher?.removeEventListener("update",this._onShapeUpdate),this.shape=t,this.shape.eventDispatcher?.addEventListener("update",this._onShapeUpdate)}updateWorldMatrix(t,r){super.updateWorldMatrix(t,r),k1.getNormalMatrix(this.matrixWorld),z1.copy(mF).applyMatrix3(k1).normalize(),G1.setFromMatrixPosition(this.matrixWorld),this.shape.plane.setFromNormalAndCoplanarPoint(z1,G1)}clone(t){let r=this.shape.clone(),i=this.material,s=this.geometry.userData,o=qr.create(Object.assign({},s,{shape:r})),a=new Ml(o,i).copy(this,t);return a.shape=r,r.update(),a}raycast(t,r){Pt.prototype.raycast.call(this,t,r)}};function Cf(n,e){return gF(n)}function gF(n){let e={parameters:n,type:n.type};if(n.type==="VectorGeometry"){let r=vt.createFromState(n.shape,n.width,n.height);e.shape=r}else n.type==="NonParametricGeometry"&&(n.data.groups&&n.data.groups.forEach(r=>r.materialIndex=Math.max(r.materialIndex??0,0)),e.geometry=new wa().parse(n));let t;try{t=Fu(e)}catch(r){console.error(r)}if(!t){let r=vt.createFromState(nl.defaultData(),100,100);e.shape=r,t=Fu(e)}return t}var He;yf.then(n=>{He=n});var V1=new Float32Array([10,10,0,-10,10,0,-10,-10,0,10,-10,0]),H1=new Uint32Array([0,1,2,3]),W1=new Uint8Array([4]),Dn=class{static build(n,e,t,r,i){let s,o,a,l=n?.phongAngle??e?.phongAngle??35;if(r===!1&&(l=-1),n.positionWASM!==void 0){t&&t!==0&&(He.free_bvh(t),He.free_subdivision_surface(t));try{s=Dn.allocate(n,i)}catch(u){console.error(u,n),s=Dn.allocate({positionWASM:V1,indexWASM:H1,verticesPerFaceWASM:W1},i)}He.set_destination_refinement_level(s,0),o=Dn.buildLevel(s,!0,l)}else s=t,n.phongAngle!==void 0&&(o=Dn.buildLevel(s,!0,l));return n.subdivisions!==void 0&&(He.set_destination_refinement_level(s,n.subdivisions),n.subdivisions>0?a=Dn.buildLevel(s,!1,l):a=null),{subdivPointer:s,originalGeometry:o,subdividedGeometry:a}}static primitiveToQuads(n,e){n.widthSegments>16&&(n.widthSegments=16),n.heightSegments>16&&(n.heightSegments=16),n.depthSegments>16&&(n.depthSegments=16),n.radialSegments>16&&(n.radialSegments=16),n.type==="DodecahedronGeometry"&&(n.detail=0);let t=n.shape!==void 0?e.geometry:Cf(n),r,i,s,o;({positions:r,triIndices:o}=By(t.getAttribute("position"),t.getIndex()));let a;if(n.type==="CylinderGeometry"&&n.cornerRadius===0&&n.hollow===0&&n.openEnded===!1){let l=n.radialSegments*n.heightSegments*3*2,u=l+n.radialSegments*3;a=[l,u]}return{indices:i,verticesPerFace:s}=Oy(r,o,t,a),{positions:r,indices:i,verticesPerFace:s}}static allocate(n,e){let t,r,i,s=[],o=[];n.positionWASM&&n.positionWASM.length>0?(t=n.positionWASM,r=n.indexWASM,i=n.verticesPerFaceWASM):(t=V1,r=H1,i=W1);let a=t.length,l=r.length,u=i.length,c=t.length+s.length+o.length,h=r.length+i.length,d=c*Float32Array.BYTES_PER_ELEMENT+h*Uint32Array.BYTES_PER_ELEMENT,f=c*Float32Array.BYTES_PER_ELEMENT,m=h*Uint32Array.BYTES_PER_ELEMENT,p=He._malloc(d),g=new Float32Array(He.HEAPF32.buffer,p,c),y=new Uint32Array(He.HEAPU32.buffer,p+f,h);g.set(t,0),g.set(s,t.length),g.set(o,t.length+s.length),y.set(r,0),y.set(i,r.length);let x;n?.scaleBaked?.some(b=>b!==1)&&(x=new Re().makeScale(...n.scaleBaked)),e&&(x?x.premultiply(e):x=e);let w=x?He.alloc_subdivision_surface2(p,a,p+f,l,p+f+r.length*Uint32Array.BYTES_PER_ELEMENT,u,x.elements):He.alloc_subdivision_surface(p,a,p+f,l,p+f+r.length*Uint32Array.BYTES_PER_ELEMENT,u);return He._free(p),w}static buildLevel(n,e,t,r,i){let s=i?He.get_mesh_data2(n,e?He.Level.CONTROL:He.Level.REFINED,t,i.elements):He.get_mesh_data(n,e?He.Level.CONTROL:He.Level.REFINED,t),o=8,a=He.HEAPU32.subarray(s>>2,(s>>2)+o),l=a.subarray(4,4+4),u=0,c=He.HEAPU32[a[u]>>2],h=He.HEAPF32.subarray(c>>2,(c>>2)+l[u]);u++;let d=He.HEAPU32[a[u]>>2],f=He.HEAPF32.subarray(d>>2,(d>>2)+l[u]);u++;let m=He.HEAPU32[a[u]>>2],p=He.HEAPU32.subarray(m>>2,(m>>2)+l[u]);u++;let g=He.HEAPU32[a[u]>>2],y=He.HEAPU32.subarray(g>>2,(g>>2)+l[u]);if(u++,r===void 0){let x=new De;if(x.setIndex(new ds(y,1)),x.setAttribute("position",new Se(h,3)),x.setAttribute("normal",new Se(f,3)),e){x.setAttribute("faceMap",new ds(p,1));let w=new Float32Array(f.length/3*4).fill(0);x.setAttribute("color",new je(w,4))}return He.free_mesh_data(s),x.userData.type="SubdivGeometry",x}r.getAttribute("position").copyArray(h),r.getAttribute("normal").copyArray(f),r.attributes.position.needsUpdate=!0,r.attributes.normal.needsUpdate=!0,He.free_mesh_data(s)}static buildControlCageWireframe(n,e,t){let r=He.get_wireframe_data_for_base_level(n),i=4,s=He.HEAPU32.subarray(r>>2,(r>>2)+i),o=s.subarray(2,2+2),a=0,l=He.HEAPU32[s[a]>>2],u=He.HEAPF32.subarray(l>>2,(l>>2)+o[a]);a++;let c=He.HEAPU32[s[a]>>2],h=He.HEAPU32.subarray(c>>2,(c>>2)+o[a]);if(e===void 0){let d=new De;d.setAttribute("position",new Se(u,3));let f=new Float32Array(u.length);for(let m=0,p=u.length;m<p;)f[m++]=t.r,f[m++]=t.g,f[m++]=t.b;return d.setAttribute("color",new je(f,3)),d.setIndex(new ds(h,1)),He.free_wireframe_data_for_base_level(r),d}e.getAttribute("position").copyArray(u),e.attributes.position.needsUpdate=!0,He.free_wireframe_data_for_base_level(r)}static updateCollabMesh(n,e,t){let r=e===0;r||He.set_destination_refinement_level(n,e);let i=t?He.get_topological_data2(n,r?He.Level.CONTROL:He.Level.REFINED,t.elements):He.get_topological_data(n,r?He.Level.CONTROL:He.Level.REFINED),s=6,o=He.HEAPU32.subarray(i>>2,(i>>2)+s),a=o.subarray(3,3+3),l=0,u=He.HEAPU32[o[l]>>2],c=new Float32Array(He.HEAPF32.subarray(u>>2,(u>>2)+a[l]));l++;let h=He.HEAPU32[o[l]>>2],d=new Uint32Array(He.HEAPU32.subarray(h>>2,(h>>2)+a[l]));l++;let f=He.HEAPU32[o[l]>>2],m=new Uint8Array(He.HEAPU32.subarray(f>>2,(f>>2)+a[l]));return He.free_topological_data(i),{positions:c,indices:d,verticesPerFace:m}}};var j1=["getX","getY","getZ"];function By(n,e){let t={},r=e?e.count:n.count,i=0,s=[],o=[],a=1e4;for(let u=0;u<r;u++){let c=e?e.getX(u):u,h="";for(let d=0;d<3;d++)h+=`${~~(n[j1[d]](c)*a)},`;if(h in t)s.push(t[h]);else{for(let d=0;d<3;d++)o.push(n[j1[d]](c));t[h]=i,s.push(i),i++}}let l=[];for(let u=0;u<s.length;u+=3)s[u]===s[u+1]||s[u]===s[u+2]||s[u+1]===s[u+2]||l.push(s[u],s[u+1],s[u+2]);return{positions:o,triIndices:l}}var Pf=new _,Ly=new _,Ry=new _,Ny=new _;function Oy(n,e,t,r){let i=[],s=[];if(t.userData.shape!==void 0&&t.userData.parameters.depth===0&&t.userData.shape.shapeHoles.length===0){let o=t.userData.shape.extractShapePointsToFlatArray([]),a=0;for(let u=0;u<o.length;u+=2)a+=(o[u]-o[(u===0?o.length:u)-2])*(o[u+1]+o[(u===0?o.length:u)-1]);n.length=0;let l=0;if(a<0)for(let u=0;u<o.length;u+=2)n.push(o[u],o[u+1],0),i.push(l++);else for(let u=o.length-2;u>=0;u-=2)n.push(o[u],o[u+1],0),i.push(l++);return s.push(l),{indices:i,verticesPerFace:s}}for(let o=0,a=t.capStartIndex??e.length;o<a;)if(e[o+1]===e[o+3]&&e[o+2]===e[o+5]||e[o+0]===e[o+3]&&e[o+2]===e[o+4]){Pf.set(n[e[o]*3],n[e[o]*3+1],n[e[o]*3+2]),Ly.set(n[e[o+1]*3],n[e[o+1]*3+1],n[e[o+1]*3+2]),Ry.set(n[e[o+4]*3],n[e[o+4]*3+1],n[e[o+4]*3+2]),Ny.set(n[e[o+5]*3],n[e[o+5]*3+1],n[e[o+5]*3+2]),Ly.sub(Pf).normalize(),Ry.sub(Pf).normalize(),Ny.sub(Pf).normalize();let l=Ly.cross(Ry).dot(Ny);Math.abs(l)>.005||r&&r.some((u,c)=>c%2===1?!1:o>=r[c]&&o<r[c+1])?(i.push(e[o],e[o+1],e[o+2]),s.push(3),o+=3):(i.push(e[o],e[o+1],e[o+4],e[o+5]),s.push(4),o+=6)}else i.push(e[o],e[o+1],e[o+2]),s.push(3),o+=3;if(t.capStartIndex!==void 0){let o=[],a=[],l=0;for(let u=0,c=0;u<n.length;u+=3,c++)n[u+2]===0&&(o.push(c),l++),n[u+2]===t.userData.parameters.depth&&a.push(c);if(t.userData.parameters.extrudeBevelSize===0){let u=a[0];a[0]=a[1],a[1]=u}o.reverse(),i.push(...o,...a),s.push(l,l)}return{indices:i,verticesPerFace:s}}var Xn={};Pv(Xn,{calcBoolean:()=>xF,calcBooleanTopological:()=>vF,freeMeshSet:()=>SF,getMeshSet:()=>bF,transformMeshSet:()=>wF});var X1,Y1=new Promise(n=>{X1=n}),q1=!1;async function Q1(){if(q1)return;let e=!1?".":"https://unpkg.com/@splinetool/boolean-wasm@0.9.95/build",[t,r]=await Promise.all([import("./boolean.js"),fetch(`${e}/boolean.wasm`).then(o=>o.arrayBuffer())]),s=await t.default({wasmBinary:r});X1(s),q1=!0}var st,Tl;Y1.then(n=>st=n);function yF(n,e){let t,{positions:r,triIndices:i}=By(n.getAttribute("position"),n.getIndex()),s;if(e){let{indices:o,verticesPerFace:a}=Oy(r,i,n);s=a.length,t=[];for(let l=0,u=0;l<s;l++){t.push(a[l]);for(let c=0;c<a[l];c++)t.push(o[u++])}}else{let o=i.length;t=Array(o+o/3),s=0;for(let a=0,l=0;l<t.length;)t[l++]=3,s++,t[l++]=i[a++],t[l++]=i[a++],t[l++]=i[a++]}return{positions:r,faceIndices:t,nFaces:s}}function Z1(n){let e=n.length,t=e*Uint32Array.BYTES_PER_ELEMENT,r=e*Float32Array.BYTES_PER_ELEMENT,i=Number.isInteger(n[0])?t:r,s=st._malloc(i);return(Number.isInteger(n[0])?new Uint32Array(st.HEAPU32.buffer,s,e):new Float32Array(st.HEAPF32.buffer,s,e)).set(n,0),s}function K1(n){switch(n){case 0:return st.OP.UNION;case 1:return st.OP.INTERSECTION;case 2:return st.OP.A_MINUS_B;case 3:return st.OP.B_MINUS_A;case 4:return st.OP.SYMMETRIC_DIFFERENCE;case 5:return st.OP.ALL;default:throw new Error("Unknown boolean operation "+n)}}function vF(n,e){Tl===void 0&&(Tl=st.init_csg());let t=Z1(n),r=st.csg_calc_topological(Tl,t,n.length,K1(e));st._free(t);let i=6,s=st.HEAPU32.subarray(r>>2,(r>>2)+i),o=s.subarray(3,3+3),a=0,l=st.HEAPU32[s[a]>>2],u=new Float32Array(st.HEAPF32.subarray(l>>2,(l>>2)+o[a]));a++;let c=st.HEAPU32[s[a]>>2],h=new Uint32Array(st.HEAPU32.subarray(c>>2,(c>>2)+o[a]));a++;let d=st.HEAPU32[s[a]>>2],f=new Uint8Array(st.HEAPU32.subarray(d>>2,(d>>2)+o[a]));return st.free_mesh_data(r),{positions:u,indices:h,verticesPerFace:f}}function xF(n,e,t,r){Tl===void 0&&(Tl=st.init_csg());let i=Z1(n),s=st.csg_calc(Tl,i,n.length,r,K1(e));st._free(i);let o=5,a=st.HEAPU32.subarray(s>>2,(s>>2)+o),l=a.subarray(2,2+3),u=0,c=st.HEAPU32[a[u]>>2],h=st.HEAPF32.subarray(c>>2,(c>>2)+l[u]);u++;let d=st.HEAPU32[a[u]>>2],f=st.HEAPF32.subarray(d>>2,(d>>2)+l[u]);u++;let m=l[u];t.setAttribute("position",new Se(h,3)),t.setAttribute("normal",new Se(f,3));let p=st.HEAPF32.subarray((s>>2)+5,(s>>2)+5+6);return t.boundingSphere===null&&(t.boundingSphere=new Dr),t.boundingSphere.center.set(p[0],p[1],p[2]),t.boundingSphere.radius=(p[3]**2+p[4]**2+p[5]**2)**.5,t.userData.parameters={width:p[3]*2,height:p[4]*2,depth:p[5]*2},st.free_mesh_data(s),m}function bF(n,e){if(st===void 0)return-1;let t,r,i;if(e&&n.userData.positions!==void 0){let p=n.userData;i=p.verticesPerFace.length,t=p.positions,r=Array(p.verticesPerFace.reduce((g,y)=>g+y,0)+i);for(let g=0,y=0,x=0;g<p.verticesPerFace.length;g++){r[x++]=p.verticesPerFace[g];for(let w=0;w<p.verticesPerFace[g];w++)r[x++]=p.indices[y++]}}else({positions:t,faceIndices:r,nFaces:i}=yF(n,e));let s=t.length,o=r.length,a=t.length,l=r.length,u=a*Float32Array.BYTES_PER_ELEMENT+l*Uint32Array.BYTES_PER_ELEMENT,c=a*Float32Array.BYTES_PER_ELEMENT,h=l*Uint32Array.BYTES_PER_ELEMENT,d=st._malloc(u),f=new Float32Array(st.HEAPF32.buffer,d,a),m=new Uint32Array(st.HEAPU32.buffer,d+c,l);return f.set(t,0),m.set(r,0),st.get_csg_mesh(d,s,d+c,o,i)}function wF(n,e){st.transform_csg_mesh(n,e.elements)}function SF(n){st.free_csg_mesh(n)}var Iy={ConeGeometry:BS,CubeGeometry:OS,CylinderGeometry:NS,DodecahedronGeometry:FS,EllipseGeometry:s1,HelixGeometry:c1,IcosahedronGeometry:u1,LatheGeometry:h1,NonParametricGeometry:d1,PolygonGeometry:f1,PyramidGeometry:p1,RectangleGeometry:m1,SphereGeometry:g1,PlaneGeometry:y1,BackdropGeometry:v1,StarGeometry:x1,TextFrameGeometry:gf,TorusGeometry:b1,TorusKnotGeometry:w1,TriangleGeometry:S1,VectorGeometry:qr},Fu=n=>Iy[n.type].create(n);var J1=new Re;function Fy(n){let e=!1;return n.scene.objects.traverse((t,r)=>{r.geometry?.type==="BooleanGeometry"&&(e=!0)}),e}var Df=class extends Pt{constructor(t=new De,r){super(t,r);this.booleanOp=2;this.phongAngle=35;this.meshSetAddresses=[];this.needsTransformForDownstream=!1;this.objectType="BooleanObject",this.castShadow=!0,this.receiveShadow=!0,this.geometry.userData.parameters={width:0,height:0,depth:0},this.onAfterRender=this.recomputeBoolean.bind(this)}reInit(){this.objectType="BooleanObject",this.meshSetAddresses=[],this.needsTransformForDownstream=!1,this.geometry.userData.parameters={width:0,height:0,depth:0},this.onAfterRender=this.recomputeBoolean.bind(this)}recomputeBoolean(t){if(this.booleanMeshSetAddress!==-1)return;for(let i=0;i<this.children.length;i++){let s=this.children[i];At(s)&&s.recomputeBoolean(t===!0)}this.meshSetAddresses=[];for(let i=0;i<this.children.length;i++){let s=this.children[i];if(P1(s)&&s.booleanExclude===!1&&s.geometry.attributes.position?.count>0&&s.geometry.drawRange.count>0){if(s.booleanMeshSetAddress===-1){if(s.booleanMeshSetAddress=Xn.getMeshSet(s.geometry,t===!0),s.booleanMeshSetAddress===-1)return;Xn.transformMeshSet(s.booleanMeshSetAddress,s.matrix),s.booleanMatrixInvOld.copy(s.matrix).invert(),s.booleanWasTransformed=!1}else At(s)&&s.needsTransformForDownstream===!0?(Xn.transformMeshSet(s.booleanMeshSetAddress,s.matrix),s.needsTransformForDownstream=!1):s.booleanWasTransformed===!0&&(J1.multiplyMatrices(s.matrix,s.booleanMatrixInvOld),Xn.transformMeshSet(s.booleanMeshSetAddress,J1),s.booleanMatrixInvOld.copy(s.matrix).invert(),s.booleanWasTransformed=!1);this.meshSetAddresses.push(s.booleanMeshSetAddress)}}if(this.meshSetAddresses.length===0){this.geometry.setDrawRange(0,0);return}if(t===!0)return Xn.calcBooleanTopological(this.meshSetAddresses,this.booleanOp);let r=this.geometry;r.dispose(),this.geometry=new De,this.geometry.userData=r.userData,this.geometry.boundingSphere=r.boundingSphere;try{this.booleanMeshSetAddress=Xn.calcBoolean(this.meshSetAddresses,this.booleanOp,this.geometry,this.phongAngle)}catch(i){this.booleanMeshSetAddress=0,console.error(i)}this.booleanMatrixInvOld.copy(this.matrix).invert(),this.needsTransformForDownstream=!0,Vs(this),Hs(this)}updateGeometry(t){let r=t.parameters;r.operation!==void 0&&(this.booleanOp=r.operation),r.phongAngle!==void 0&&(this.phongAngle=r.phongAngle),this.invalidateDownstreamBooleanData().recomputeBoolean()}};var _i=n=>{var e;return e=class extends n{constructor(){super(...arguments);this.isObjectHelper=!0}},e.geometryHelper=new Zr(30,30,30),e};var If=new ki,Uy=new Dr,$1=new Re,Ai=(n,e,t,r,i=!1)=>{let s=e,o=n.matrixWorld;if(s.boundingSphere===null&&s.computeBoundingSphere(),Uy.copy(s.boundingSphere),Uy.applyMatrix4(o),t.ray.intersectsSphere(Uy)===!1||($1.copy(o).invert(),If.copy(t.ray).applyMatrix4($1),s.boundingBox!==null&&If.intersectsBox(s.boundingBox)===!1))return;let a,l,u,c,h=s.index,d=s.attributes.position,f=s.drawRange,m,p;if(i===!1){let y=Math.max(0,f.start),x=Math.min(h.count,f.start+f.count);for(m=y,p=x;m<p;m+=3)if(l=h.getX(m),u=h.getX(m+1),c=h.getX(m+2),a=g(n,t,If,d,l,u,c),a){a.faceIndex=Math.floor(m/3),r.push(a);return}}else{let x=s.attributes.position,w=new _,b=new _,S=new _,A=new _,M=2,T=1/((n.scale.x+n.scale.y+n.scale.z)/3),E=T*T,C=Math.max(0,f.start),L=Math.min(x.count,f.start+f.count);for(let N=C,R=L-1;N<R;N+=M){if(w.fromBufferAttribute(x,N),b.fromBufferAttribute(x,N+1),If.distanceSqToSegment(w,b,A,S)>E)continue;A.applyMatrix4(n.matrixWorld);let j=t.ray.origin.distanceTo(A);j<t.near||j>t.far||r.push({distance:j,point:S.clone().applyMatrix4(n.matrixWorld),object:n})}}function g(y,x,w,b,S,A,M){let v=new _,T=new _,E=new _,C=new _,L=new _;if(v.fromBufferAttribute(b,S),T.fromBufferAttribute(b,A),E.fromBufferAttribute(b,M),w.intersectTriangle(v,T,E,!1,C)===null)return null;L.copy(C),L.applyMatrix4(y.matrixWorld);let R=x.ray.origin.distanceTo(L);return R<x.near||R>x.far?null:{faceIndex:1,distance:R,point:L.clone(),object:y}}};var Lf=new _,In=new Un,zy=class extends ps{constructor(t){let r=new De,i=new wn({color:16777215,vertexColors:!0,toneMapped:!1}),s=[],o=[],a={},l=new Oe(15711266),u=new Oe(15711266),c=new Oe(2857471);h("n1","n2",l),h("n2","n4",l),h("n4","n3",l),h("n3","n1",l),h("f1","f2",l),h("f2","f4",l),h("f4","f3",l),h("f3","f1",l),h("n1","f1",l),h("n2","f2",l),h("n3","f3",l),h("n4","f4",l),h("p","n1",u),h("p","n2",u),h("p","n3",u),h("p","n4",u),h("u1","u2",c),h("u2","u3",c),h("u3","u1",c);function h(f,m,p){d(f,p),d(m,p)}function d(f,m){s.push(0,0,0),o.push(m.r,m.g,m.b),a[f]===void 0&&(a[f]=[]),a[f].push(s.length/3-1)}r.setAttribute("position",new Se(s,3)),r.setAttribute("color",new Se(o,3));super(r,i);this.type="CameraHelper",this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update()}update(){let t=this.geometry,r=this.pointMap,i=!0;In.projectionMatrixInverse.elements=[.5112609807824982,-0,-0,-0,-0,.41421356237309503,-0,-0,-0,-0,-0,-.099999,-0,-0,-1.0000000000000002,.100001];let s=1,o=1,a=i?.8:1e-4;Yn("n1",r,t,In,-s,-o,a),Yn("n2",r,t,In,s,-o,a),Yn("n3",r,t,In,-s,o,a),Yn("n4",r,t,In,s,o,a);let l=a;Yn("f1",r,t,In,-s,-o,l),Yn("f2",r,t,In,s,-o,l),Yn("f3",r,t,In,-s,o,l),Yn("f4",r,t,In,s,o,l);let u=l,c=.5;Yn("u1",r,t,In,s*.7*c,o*1.1,u),Yn("u2",r,t,In,-s*.7*c,o*1.1,u),Yn("u3",r,t,In,0,o*(1.1+.9*c),u),t.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}};function Yn(n,e,t,r,i,s,o){Lf.set(i,s,o).unproject(r);let a=e[n];if(a!==void 0){let l=t.getAttribute("position");for(let u=0,c=a.length;u<c;u++)l.setXYZ(a[u],Lf.x,Lf.y,Lf.z)}}var Rf=class extends _i(zy){constructor(t){super(t);this.object=t;this.object=t,this.name=`CombinedCameraHelper: ${t.uuid}`}updateMatrixWorld(t){super.updateMatrixWorld(t),this.updateTarget()}updateTarget(){let t=this.object.getTarget();this.updateWorldMatrix(!0,!1),this.worldToLocal(t)}raycast(t,r){Ai(this.object,this.geometry,t,r,!0)}};var El=class extends _i(kh){constructor(t,r=15,i=10066329){super(t,r,i);this.object=t;this.added=!1;this.name=`DirectionalLightHelper: ${t.uuid}`}raycast(t,r){Ai(this.object,El.geometryHelper,t,r)}};var Cl=class extends _i(Vh){constructor(t,r=15){super(r);this.object=t;this.object.updateMatrixWorld(),this.name=`EmptyObjectHelper: ${t.uuid}`,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1}raycast(t,r){Ai(this.object,Cl.geometryHelper,t,r)}update(){}};var Pl=class extends _i(Gh){constructor(t,r=15,i=6710886){super(t,r,i);this.object=t;this.name=`PointLightHelper: ${t.uuid}`}raycast(t,r){Ai(this.object,Pl.geometryHelper,t,r)}};var Nf=class extends _i(zh){constructor(t,r=6710886){super(t,r);this.object=t;this.name=`SpotLightHelper: ${t.uuid}`}raycast(t,r){Ai(this.object,Nf.geometryHelper,t,r)}update(){if(this.object!==void 0){let t=Nf._vector,r=this.object.distance?this.object.distance:1e3,i=r*Math.tan(this.object.angle);this.cone.scale.set(i,i,r),t.setFromMatrixPosition(this.object.target.matrixWorld),this.cone.lookAt(t);let s=this.color!==void 0?this.color:this.light.color;if(this.cone.material instanceof Array)for(let o=0,a=this.cone.material.length;o<a;o++)this.cone.material[o].color.set(s);else this.cone.material.color.set(s)}}},Uu=Nf;Uu._vector=new _;var Mi=(n,e)=>class extends n{constructor(){super(...arguments);this.objectHelper=new e(this)}get geometryHelper(){return e.geometryHelper}raycast(i,s){this.objectHelper.raycast(i,s)}fromLightState(i,s){if(this.objectType==="LightDirectional"||this.objectType==="LightPoint"||this.objectType==="LightSpot"){let o=this;i.color!==void 0&&(o.color=or(i.color,s)),i.intensity!==void 0&&(o.intensity=i.intensity),i.depth!==void 0&&(o.shadow.camera.far=i.depth,o.shadow.needsUpdate=!0),i.shadows!==void 0&&(this.castShadow=i.shadows)}return this}};var Dl=new _,Gy=new _,Yr=class extends Mi(Cn(Un),Rf){constructor(t=window.innerWidth,r=window.innerHeight,i=45,s,o=1e5){super();this.objectType="CombinedCamera";this._cameraType="OrthographicCamera";this.targetOffset=So.DefaultTargetOffset;this.isUpVectorFlipped=!1;this.angleOffsetFromUp=0;this.width=t,this.height=r,this.orthoCamera=new ca(t*-.5,t*.5,r*.5,r*-.5,s??-5e4,o),this.perspCamera=new Zt(i,t/r,s??50,o),this.left=this.orthoCamera.left,this.right=this.orthoCamera.right,this.top=this.orthoCamera.top,this.bottom=this.orthoCamera.bottom,this.far=this.orthoCamera.far,this.view=this.orthoCamera.view,this.aspect=this.perspCamera.aspect,this.fov=this.perspCamera.fov,this.focus=this.perspCamera.focus,this.filmGauge=this.perspCamera.filmGauge,this.filmOffset=this.perspCamera.filmOffset,this.toOrthographic()}static createFromState(t,r){let i=new Yr().fromState(r);return i.objectHelper.update(),i.uuid=t,i}get isPerspectiveCamera(){return this.cameraType==="PerspectiveCamera"}get isOrthographicCamera(){return!this.isPerspectiveCamera}get cameraType(){return this._cameraType}setNear(t,r){t==="PerspectiveCamera"?this.perspCamera.near=r:this.orthoCamera.near=r}setZoom(t,r){r>=0&&(t==="PerspectiveCamera"?this.perspCamera.zoom=r:this.orthoCamera.zoom=r)}set cameraType(t){t==="PerspectiveCamera"?this.toPerspective():t==="OrthographicCamera"&&this.toOrthographic()}get near(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.near:this.orthoCamera.near}set near(t){this._cameraType==="PerspectiveCamera"?this.perspCamera.near=t:this.orthoCamera.near=t}get zoom(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom:this.orthoCamera.zoom}set zoom(t){t>=0&&(this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom=t:this.orthoCamera.zoom=t)}lookAt(t){super.lookAt(t),this.getWorldPosition(Dl),this.targetOffset=Dl.distanceTo(t)}getTarget(t=new _){return this.getWorldDirection(Gy),this.getWorldPosition(Dl),Gy.multiplyScalar(this.targetOffset),t.copy(Dl).add(Gy),t}getDistanceToTarget(){let t=this.getTarget();return this.getWorldPosition(Dl),Dl.distanceTo(t)}updateUp(){let t=this.getWorldQuaternion(new qt),r=new _(0,0,1).applyQuaternion(t),i=new _().copy(ot.DefaultUp);this.isUpVectorFlipped&&i.negate(),i.applyQuaternion(t);let s=new _().copy(ot.DefaultUp).projectOnPlane(r),o=new _().crossVectors(s,i).dot(r)>=0?1:-1;this.angleOffsetFromUp=s.angleTo(i)*o}getViewFrontToObject(t){let r=t.getWorldPosition(new _),s=t.getWorldDirection(new _).multiplyScalar(this.targetOffset);return{position:r.clone().add(s),target:r}}getViewToObject(t){let r=t.getWorldPosition(new _),s=this.getWorldDirection(new _).multiplyScalar(this.targetOffset);return{position:r.clone().sub(s),target:r}}setViewplaneSize(t,r){this.left=-t*.5,this.right=t*.5,this.top=r*.5,this.bottom=-r*.5,this.aspect=t/r,this.updateProjectionMatrix()}toOrthographic(){this.orthoCamera.left=this.left,this.orthoCamera.right=this.right,this.orthoCamera.top=this.top,this.orthoCamera.bottom=this.bottom,this.orthoCamera.view=this.view,this.orthoCamera.far=this.far,this.orthoCamera.updateProjectionMatrix(),this.projectionMatrix=this.orthoCamera.projectionMatrix,this.projectionMatrixInverse=this.orthoCamera.projectionMatrixInverse,this._cameraType="OrthographicCamera",this.objectHelper&&this.objectHelper.update()}toPerspective(){this.perspCamera.aspect=this.aspect,this.perspCamera.fov=this.fov,this.perspCamera.view=this.view,this.perspCamera.far=this.far,this.perspCamera.updateProjectionMatrix(),this.projectionMatrix=this.perspCamera.projectionMatrix,this.projectionMatrixInverse=this.perspCamera.projectionMatrixInverse,this._cameraType="PerspectiveCamera",this.objectHelper&&this.objectHelper.update()}setFocalLength(t){this.perspCamera.setFocalLength(t),this.toPerspective()}getFocalLength(){return this.perspCamera.getFocalLength()}getEffectiveFOV(){return this.perspCamera.getEffectiveFOV()}getFilmWidth(){return this.perspCamera.getFilmWidth()}getFilmHeight(){return this.perspCamera.getFilmHeight()}setViewOffset(t,r,i,s,o,a){this._cameraType==="PerspectiveCamera"?this.perspCamera.setViewOffset(t,r,i,s,o,a):this.orthoCamera.setViewOffset(t,r,i,s,o,a)}clearViewOffset(){this._cameraType==="PerspectiveCamera"?(this.perspCamera.clearViewOffset(),this.toPerspective()):(this.orthoCamera.clearViewOffset(),this.toOrthographic())}updateProjectionMatrix(){this._cameraType==="PerspectiveCamera"?this.toPerspective():this._cameraType==="OrthographicCamera"&&this.toOrthographic()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,r){super.updateWorldMatrix(t,r),this.matrixWorldInverse.copy(this.matrixWorld).invert()}copy(t,r){return super.copy(t,r),this.orthoCamera.copy(t.orthoCamera),this.perspCamera.copy(t.perspCamera),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.far=t.far,this.view=t.view===null?null:Object.assign({},t.view),this._cameraType=t._cameraType,this.aspect=t.aspect,this.fov=t.fov,this.focus=t.focus,this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this.targetOffset=t.targetOffset,this.updateProjectionMatrix(),this}toCameraState(t=[]){let r={type:this.cameraType,far:this.far,orthographic:{near:this.orthoCamera.near,zoom:this.orthoCamera.zoom},perspective:{near:this.perspCamera.near,fov:this.perspCamera.fov,zoom:this.perspCamera.zoom},up:this.up.toArray(),targetOffset:this.targetOffset,isUpVectorFlipped:this.isUpVectorFlipped};return Ja(r,t)}fromCameraState(t){let{orthographic:r,perspective:i}=t;return t.type!==void 0&&(this.cameraType=t.type),t.far!==void 0&&(this.far=t.far),r!==void 0&&(r.near!==void 0&&(this.orthoCamera.near=r.near),r.zoom!==void 0&&(this.orthoCamera.zoom=r.zoom)),i!==void 0&&(i.near!==void 0&&(this.perspCamera.near=i.near),i.fov!==void 0&&(this.perspCamera.fov=i.fov),i.zoom!==void 0&&(this.perspCamera.zoom=i.zoom)),t.up!==void 0&&this.up.fromArray(t.up),t.targetOffset!==void 0&&(this.targetOffset=t.targetOffset),t.isUpVectorFlipped!==void 0&&(this.isUpVectorFlipped=t.isUpVectorFlipped),this.updateProjectionMatrix(),this}toState(t){return{...super.toState(t),...this.toCameraState(t),type:this.cameraType}}fromState(t){return super.fromState(t),this.fromCameraState(t),this}};var Io=class extends Mi(Cn(ss),Cl){constructor(){super(...arguments);this.objectType="EmptyObject"}static createFromState(t,r){let i=new Io().fromState(r);return i.uuid=t,i.objectHelper.update(),i}};var Il=class extends Mi(Cn(Oh),El){constructor(...t){super(...t);this.objectType="LightDirectional";this._gizmos={};this.castShadow=!0,this.shadow.mapSize.width=2048,this.shadow.mapSize.height=2048,this.shadow.normalBias=1,this.layers.enable(3);let i=this.shadow.camera;i.top=1250,i.bottom=-1250,i.right=1250,i.left=-1250,i.near=-1e4,i.far=2500;let s=new _n(this.shadow.camera);s.visible=!1,this._gizmos.shadowmap=s,this.update()}static createFromState(t,r,i){let s=new Il().fromState(r,i);return s.uuid=t,s}get gizmos(){return this._gizmos}showGizmos(){for(let t in this._gizmos){let r=this._gizmos[t];r instanceof _n&&(r.visible=!0)}}hideGizmos(){for(let t in this._gizmos){let r=this._gizmos[t];r instanceof _n&&(r.visible=!1)}}update(){this.shadow.camera.updateProjectionMatrix();for(let t in this._gizmos){let r=this._gizmos[t];r instanceof _n&&r.update()}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.objectHelper&&this.objectHelper.update()}fromDirectionalLightState(t,r){let i=t.depth!==void 0&&t.depth!==this.shadow.camera.far||t.size!==void 0&&t.size/2!==this.shadow.camera.right;return super.fromLightState(t,r),t.size!==void 0&&T1(this,t.size),t.shadowRadius!==void 0&&(this.shadow.radius=t.shadowRadius),t.shadowResolution!==void 0&&(this.shadow.mapSize.set(t.shadowResolution,t.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null)),i&&this.update(),this}fromState(t,r){return super.fromState(t),this.fromDirectionalLightState(t,r),this}};var Ll=class extends Mi(Cn(Bh),Pl){constructor(...t){super(...t);this.objectType="LightPoint";this._gizmos={};this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024,this.shadow.normalBias=1,this.layers.enable(3);let i=this.shadow.camera;i.fov=90,i.aspect=1,i.near=100,i.far=2500;let s=new _(-i.far+this.position.x,-i.far+this.position.y,-i.far+this.position.z),o=new _(i.far+this.position.x,i.far+this.position.y,i.far+this.position.z),a=new br(s,o),l=new yo(a,new Oe(16755200));l.visible=!1,this._gizmos.shadowmap=l,this.update()}static createFromState(t,r,i){let s=new Ll().fromState(r,i);return s.uuid=t,s}get gizmos(){return this._gizmos}showGizmos(){for(let t in this._gizmos){let r=this._gizmos[t];r instanceof yo&&(r.visible=!0)}}hideGizmos(){for(let t in this._gizmos){let r=this._gizmos[t];r instanceof yo&&(r.visible=!1)}}update(){if(this.shadow&&(this.shadow.camera.updateProjectionMatrix(),this._gizmos))for(let t in this._gizmos){let r=this._gizmos[t];if(r instanceof yo){let i=this.shadow.camera,s=new _(-i.far+this.position.x,-i.far+this.position.y,-i.far+this.position.z),o=new _(i.far+this.position.x,i.far+this.position.y,i.far+this.position.z);r.box.set(s,o),r.updateMatrixWorld(!0)}}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.objectHelper&&this.objectHelper.update()}fromPointLightState(t,r){return super.fromLightState(t,r),t.distance!==void 0&&(this.distance=t.distance),t.decay!==void 0&&(this.decay=t.decay),t.shadowRadius!==void 0&&(this.shadow.radius=t.shadowRadius),t.shadowResolution!==void 0&&(this.shadow.mapSize.set(t.shadowResolution,t.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null)),this}fromState(t,r){return super.fromState(t),this.fromPointLightState(t,r),this}};var e_=new _,t_=new _,r_=new qt,Rl=class extends Mi(Cn(Nh),Uu){constructor(...t){super(...t);this.objectType="LightSpot";this._gizmos={};this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024,this.shadow.normalBias=1,this.layers.enable(3);let i=this.shadow.camera;i.fov=Je.RAD2DEG*2*this.angle,i.aspect=1,i.near=100,i.far=2500;let s=new _n(this.shadow.camera);s.visible=!1,this._gizmos.shadowmap=s,this.update()}static createFromState(t,r,i){let s=new Rl().fromState(r,i);return s.uuid=t,s}get gizmos(){return this._gizmos}showGizmos(){for(let t in this._gizmos){let r=this._gizmos[t];r instanceof _n&&(r.visible=!0)}}hideGizmos(){for(let t in this._gizmos){let r=this._gizmos[t];r instanceof _n&&(r.visible=!1)}}update(){this.shadow.camera.updateProjectionMatrix();for(let t in this._gizmos){let r=this._gizmos[t];r instanceof _n&&r.update()}}updateMatrixWorld(t){super.updateMatrixWorld(t),t_.setFromMatrixPosition(this.matrixWorld),r_.setFromRotationMatrix(this.matrixWorld),e_.copy(this.up).applyQuaternion(r_).negate().multiplyScalar(this.distance),this.target.position.copy(t_).add(e_),this.target.updateMatrixWorld(),this.objectHelper&&this.objectHelper.update()}fromSpotLightState(t,r){return super.fromLightState(t,r),t.distance!==void 0&&(this.distance=t.distance),t.decay!==void 0&&(this.decay=t.decay),t.angle!==void 0&&(this.angle=t.angle),t.penumbra!==void 0&&(this.penumbra=t.penumbra),t.shadowRadius!==void 0&&(this.shadow.radius=t.shadowRadius),t.shadowResolution!==void 0&&(this.shadow.mapSize.set(t.shadowResolution,t.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null)),this}fromState(t,r){return super.fromState(t),this.fromSpotLightState(t,r),this}};var n_=n=>n.tagName==="VIDEO",Nl=class{static resize(e,t,r){let i=e/t,s;if(!r.image)return;let o=r.image;n_(o)?s=o.videoWidth/o.videoHeight:s=o.width/o.height,i>s&&(r.imageType=="WEBCAM"?r.repeat.set(-1,1*s/i):r.repeat.set(1,1*s/i)),i<s&&(r.imageType=="WEBCAM"?r.repeat.set(1*i/s*-1,1):r.repeat.set(1*i/s,1)),i==s&&(r.imageType=="WEBCAM"?r.repeat.set(-1,1):r.repeat.set(1,1))}static resizeTextureLayer(e,t,r){let i=e/t,s=r.image!==void 0?r.image.width/r.image.height:1,o;i>s?o={x:1,y:s/i}:i<s?o={x:i/s,y:1}:o={x:1,y:1},r.repeat.set(o.x,o.y),r.updateMatrix()}static resizeTextureLayers(e,t,r){let i=r.layers;for(let s=0;s<i.length;s++){let o=i[s];F1(o)&&Nl.resizeTextureLayer(e,t,o.uniforms[`f${o.id}_texture`].value)}}static resizeComplex(e,t,r,i){let s=e/t,o,a=r.image;n_(a)?o=a.videoWidth/a.videoHeight:o=a.width/a.height,i.geometry.type.includes("Shape")?(s>o&&(r.imageType=="WEBCAM"?r.repeat.set(1/e*-1,1/t*o/s):r.repeat.set(1/e,1/t*o/s)),s<o&&(r.imageType=="WEBCAM"?r.repeat.set(1/e*s/o*-1,1/t):r.repeat.set(1/e*s/o,1/t)),s==o&&(r.imageType=="WEBCAM"?r.repeat.set(1/e*-1,1/t):r.repeat.set(1/e,1/t))):(s>o&&(r.imageType=="WEBCAM"?r.repeat.set(-1,1*o/s):r.repeat.set(1,1*o/s)),s<o&&(r.imageType=="WEBCAM"?r.repeat.set(1*s/o*-1,1):r.repeat.set(1*s/o,1)),s==o&&(r.imageType=="WEBCAM"?r.repeat.set(-1,1):r.repeat.set(1,1)))}};var Bf=class extends Pt{constructor(t,r){super(t,r);this.objectType="Mesh2D";this.castShadow=!0,this.receiveShadow=!0}updateGeometry(t){super.updateGeometry(t),this.material.layers&&Nl.resizeTextureLayers(this.geometry.userData.parameters.width,this.geometry.userData.parameters.height,this.material)}};var Bl=class extends Pt{constructor(t,r){super(t,r);this.objectType="Mesh3D";this.castShadow=!0,this.receiveShadow=!0}};var Of=class extends Bl{constructor(t,r){super(t,r);this.objectType="NonParametric"}};var Ff=class extends gs{constructor(e){super(e)}load(e,t,r,i){let s=this,o=new ys(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(s.withCredentials),o.load(e,function(a){let l;try{l=JSON.parse(a)}catch{console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),l=JSON.parse(a.substring(65,a.length-2))}let u=s.parse(l);t&&t(u)},r,i)}parse(e){return new ky(e)}},ky=class{constructor(e){this.isFont=!0,this.type="Font",this.data=e}generateShapes(e,t=100){let r=[],i=AF(e,t,this.data);for(let s=0,o=i.length;s<o;s++)r.push(...i[s].toShapes());return r}};function AF(n,e,t){let r=Array.from(n),i=e/t.resolution,s=(t.boundingBox.yMax-t.boundingBox.yMin+t.underlineThickness)*i,o=[],a=0,l=0;for(let u=0;u<r.length;u++){let c=r[u];if(c===`
4906
4906
  `)a=0,l-=s;else{let h=MF(c,i,a,l,t);a+=h.offsetX,o.push(h.path)}}return o}function MF(n,e,t,r,i){let s=i.glyphs[n]||i.glyphs["?"];if(!s){console.error('THREE.Font: character "'+n+'" does not exists in font family '+i.familyName+".");return}let o=new Hh,a,l,u,c,h,d,f,m;if(s.o){let p=s._cachedOutline||(s._cachedOutline=s.o.split(" "));for(let g=0,y=p.length;g<y;)switch(p[g++]){case"m":a=p[g++]*e+t,l=p[g++]*e+r,o.moveTo(a,l);break;case"l":a=p[g++]*e+t,l=p[g++]*e+r,o.lineTo(a,l);break;case"q":u=p[g++]*e+t,c=p[g++]*e+r,h=p[g++]*e+t,d=p[g++]*e+r,o.quadraticCurveTo(h,d,u,c);break;case"b":u=p[g++]*e+t,c=p[g++]*e+r,h=p[g++]*e+t,d=p[g++]*e+r,f=p[g++]*e+t,m=p[g++]*e+r,o.bezierCurveTo(h,d,f,m,u,c);break}}return{offsetX:s.ha*e,path:o}}var $t=class extends kt{constructor({char:t,originalChar:r,fontFamily:i,letterSpacing:s,fontSize:o,LOD:a=16},l=new ii({color:0,opacity:1,visible:!0,transparent:!0,side:xr})){let u=$t.loadChar(t,i,a);super(u.geometry,l);this.char=t,this.originalChar=r??t,this.fontFamily=i,this.letterSpacing=s,this.fontSize=o,this.LOD=a,this.resolution=u.resolution,this.glyphsHa=u.glyphsHa,this.localPosition=new B,this.charSize=0,this.geometry.userData={type:"CharacterGeometry",parameters:{char:this.char,fontFamily:this.fontFamily,letterSpacing:this.letterSpacing,fontSize:this.fontSize,lod:this.LOD,resolution:this.resolution,charSize:this.charSize,localPosition:this.localPosition}},this.updateFontSize(this.fontSize)}static get FONTS_PATH(){return $t._fontPath}static set FONTS_PATH(t){$t._fontPath=t}updatePosition(t,r){this.localPosition.copy(t);let i=new _(this.localPosition.x,-this.localPosition.y,0);this.position.copy(i).add(r)}updateFontSize(t){let r=t/this.resolution;this.fontSize=t,this.scale.set(this.fontSize,this.fontSize,1),this.charSize=this.glyphsHa*r*this.letterSpacing}updateFontFamily(t){if(this.fontFamily===t)return;this.fontFamily=t;let r=$t.loadChar(this.char,t,this.LOD);this.geometry=r.geometry,this.resolution=r.resolution,this.glyphsHa=r.glyphsHa,this.geometry.userData={type:"CharacterGeometry",parameters:{char:this.char,fontFamily:this.fontFamily,letterSpacing:this.letterSpacing,fontSize:this.fontSize,lod:this.LOD,resolution:this.resolution,charSize:this.charSize,localPosition:this.localPosition}},this.updateFontSize(this.fontSize)}updateChar(t){if(this.char===t)return;this.char=t;let r=$t.loadChar(t,this.fontFamily,this.LOD);this.geometry=r.geometry,this.resolution=r.resolution,this.glyphsHa=r.glyphsHa,this.geometry.userData={type:"CharacterGeometry",parameters:{char:this.char,fontFamily:this.fontFamily,letterSpacing:this.letterSpacing,fontSize:this.fontSize,lod:this.LOD,resolution:this.resolution,charSize:this.charSize,localPosition:this.localPosition}},this.updateFontSize(this.fontSize)}updateLetterSpacing(t){this.letterSpacing!==t&&(this.letterSpacing=t,this.updateFontSize(this.fontSize))}updateLOD(t){if(this.LOD===t)return;this.LOD=t;let r=$t.loadChar(this.char,this.fontFamily,this.LOD);this.geometry=r.geometry,this.resolution=r.resolution,this.glyphsHa=r.glyphsHa,this.geometry.userData={type:"CharacterGeometry",parameters:{char:this.char,fontFamily:this.fontFamily,letterSpacing:this.letterSpacing,fontSize:this.fontSize,lod:this.LOD,resolution:this.resolution,charSize:this.charSize,localPosition:this.localPosition}},this.updateFontSize(this.fontSize)}clone(){let t={char:this.char,originalChar:this.originalChar,fontFamily:this.fontFamily,letterSpacing:this.letterSpacing,fontSize:this.fontSize,LOD:this.LOD};return new $t(t).copy(this)}static loadFont(t){return new Promise(function(r,i){$t.fontCache[t]?r($t.fontCache[t]):new Ff().load($t.FONTS_PATH+t+".json",o=>{$t.fontCache[t]=o,r(o)},void 0,i)})}static loadChar(t,r,i){if($t.charCache[t]){if($t.charCache[t][i]&&$t.charCache[t][i].fontFamily===r)return $t.charCache[t][i]}else $t.charCache[t]={};let s=$t.fontCache[r],o=s.generateShapes(t,1);return $t.charCache[t][i]={geometry:new ya(o,i),fontFamily:r,resolution:s.data.resolution,glyphsHa:s.data.glyphs[t].ha},$t.charCache[t][i]}},Qn=$t;Qn.charCache={},Qn.fontCache={},Qn._fontPath="/_assets/_fonts/";var Uf=new B,Lo=class{constructor(e,t,r){this.message=[];this.endLine=!0;this.yLinePos=e,this.lineHeight=t,this.maxCharSize=r,this.nextChar3DPos=new B(0,this.yLinePos+this.maxCharSize*this.lineHeight),this.align=1}addChar3D(e,t,r=this.message.length){this.message.splice(r,0,e),e.fontSize>this.maxCharSize?(this.maxCharSize=e.fontSize,this.nextChar3DPos.y=this.yLinePos+this.maxCharSize*this.lineHeight,this.fullUpdate(t)):(e.updatePosition(this.nextChar3DPos,t),this.nextChar3DPos.x+=e.charSize)}deleteChar3D(e=this.message.length-1){let t=this.message[e];if(t)return this.message.splice(e,1),this.nextChar3DPos.x-=t.charSize,t}isEndLine(e){this.endLine=e}fullUpdate(e,t=0){this.nextChar3DPos.x=0;for(let r=t,i=this.message.length;r<i;r+=1)this.message[r].updatePosition(this.nextChar3DPos,e),this.nextChar3DPos.x+=this.message[r].charSize}checkOverFlow(e){let t,r=this.message.length-1;if(r<=0)return!1;for(;r>=0;){if(this.message[r].char!==" "){t=this.message[r];break}r-=1}return!!(r>=0&&t&&t.localPosition.x+t.charSize>e)}containSpaceOverFlow(e=this.message.length-1){for(let t=e;t>=0;t-=1)if(this.message[t].char===" ")return!0;return!1}containSpace(e=this.message.length-1){if(this.endLine)return!0;for(let t=e;t>=0;t-=1)if(this.message[t].char===" ")return!0;return!1}popWord(e=this.message.length-1){let t=[],r=!0,i;for(i=e;i>=0;i-=1)if(this.message[i].char===" "){r=!1,t.length===0&&(i-=1,t.splice(0,0,this.message[i]));break}else t.splice(0,0,this.message[i]);return r?t=[]:this.message.splice(i+1,t.length),t}getWord(e=0,t=1){let r=[],i=e;for(i=e;;i+=t){if(!this.message[i]||this.message[i].char===" "){r.length===0&&this.message[i]&&(r.push(this.message[i]),this.message.splice(i,1));break}t>0?(r.push(this.message[i]),this.message.splice(i,1),i-=t):(r.splice(0,0,this.message[i]),this.message.splice(i,1))}return r}getWordAtIndex(e){let t=[];for(let r=e;r<this.message.length&&this.message[r].char!==" ";r++)t.push(this.message[r]);for(let r=e-1;r>=0&&this.message[r].char!==" ";r--)t.splice(0,0,this.message[r]);return t}wordSize(e=0,t=-1){let r=0,i=e;for(;i>=0&&i<this.message.length;){if(this.message[i].char===" "){r===0&&(r=this.message[i].charSize);break}r+=this.message[i].charSize,i+=t}return(i<0||i>=this.message.length)&&!this.endLine?this.message[e]?this.message[e].charSize:999999999:r===0?999999999:r}spaceLeft(e){return e-this.nextChar3DPos.x}popChar(e=this.message.length-1){return this.nextChar3DPos.x-=this.message[e].charSize,this.message.splice(e,1)}isEmpty(){return!this.message.length}updateNextCharPosY(){this.nextChar3DPos.y=this.yLinePos+this.maxCharSize*this.lineHeight}updateYLinePos(e){this.yLinePos=e,this.updateNextCharPosY()}updatelineHeight(e){this.lineHeight=e,this.updateNextCharPosY()}updateFontSize(e,t=0,r=this.message.length-1){for(let i=t;i<=r;i+=1)this.message[i].updateFontSize(e);this.maxCharSize=e,this.nextChar3DPos.y=this.yLinePos+this.maxCharSize*this.lineHeight}countSpaces(){let e=0;for(let t=0;t<this.message.length;t++)this.message[t].char===" "&&(e+=1);return e}alignText(e,t,r,i,s){switch(r){case 1:this.leftAlign(e,s);break;case 3:this.centerAlign(this.spaceLeft(t),e,s);break;case 2:this.rightAlign(this.spaceLeft(t),e,s);break;case 4:this.justifyAlign(this.spaceLeft(t),e,s);break}}offsetCharacters(e,t,r){Uf.set(t,r);let i=this.message.length;for(let s=0;s<i;s++)this.message[s].updatePosition(this.message[s].localPosition.add(Uf),e)}leftAlign(e,t){this.align=1,this.offsetCharacters(e,0,t)}centerAlign(e,t,r){this.align=3,this.offsetCharacters(t,e/2,r)}rightAlign(e,t,r){this.align=2,this.offsetCharacters(t,e,r)}justifyAlign(e,t,r){if(this.align=4,this.endLine){this.offsetCharacters(t,0,r);return}let i=this.countSpaces();if(i===0){this.offsetCharacters(t,0,r);return}let s=e/i,o=0;for(let a=0;a<this.message.length;a++)this.message[a].char===" "&&(o+=s),Uf.set(o,r),this.message[a].updatePosition(this.message[a].localPosition.add(Uf),t)}clone(){let e=new Lo(this.yLinePos,this.lineHeight,this.maxCharSize);e.nextChar3DPos=this.nextChar3DPos.clone(),e.align=this.align,e.endLine=this.endLine;for(let t=0;t<this.message.length;t++)e.message.push(this.message[t].clone());return e}};var Vy=class extends Pt{constructor(t){super(t,new ii({transparent:!0,opacity:1,visible:!1,side:xr}));this.objectType="TextFrame";this.charContainer=new ot,this.add(this.charContainer),this.material.visible=!1,this._geometryUserData=t.userData,this.userData.textFrame={hexColor:null,opacity:1,visible:!0,text:"",fontSize:16,lineHeight:1.5,letterSpacing:1,fontFamily:"roboto_regular",textTransform:1,horizontalAlignment:1,verticalAlignment:1,LOD:16,maxLineSize:this._geometryUserData.parameters.width,textOrigin:new _(this._geometryUserData.parameters.width*-.5,this._geometryUserData.parameters.height*.5,0),textLines:[]},this.createTextLine()}static createFromState(t,r,i){let s=gf.create({parameters:{width:r.width,height:r.height}}),o=new Vy(s).fromState(r,i);return o.uuid=t,o}async updateText(t){this.clearText();let r=this.userData.textFrame,i=r.fontFamily;await Qn.loadFont(i),r.text=t;let s=r.textOrigin,o=new ii({visible:r.visible,transparent:!0,side:xr}),a=t.split(`
4907
4907
  `),l=0;this.userData.textFrame.textLines=a.map((u,c)=>{let h=new Lo(l,r.lineHeight,r.fontSize);return h.message=u.split("").map(d=>{let f={char:d,fontFamily:i,letterSpacing:r.letterSpacing,fontSize:r.fontSize,LOD:16},m=o.clone();m.color=r.hexColor,m.opacity=r.opacity;let p=new Qn(f,m);return h.addChar3D(p,s),this.charContainer.add(p),p}),l+=h.maxCharSize*h.lineHeight,h}),this.textFullUpdate(),this.checkOverFlow()}clearText(){let t=this.userData.textFrame.textLines;for(;this.charContainer.children.length;){let r=this.charContainer.children[0];this.charContainer.remove(r)}for(;t.length;)t.pop()}raycast(t,r){let i=[];if(super.raycast(t,i),i.length>0){r.push(i[0]);return}let s=[];for(let o=0,a=this.charContainer.children.length;o<a;++o)if(this.charContainer.children[o]instanceof Qn&&(t.intersectObject(this.charContainer.children[o],!1,s),s.length>0)){s[0].object=this,r.push(s[0]);return}}updateGeometry(t){let r=this.userData,i=this.geometry.userData,s=i.parameters.width,o=i.parameters.height,a=t.parameters?.width??s,l=t.parameters?.height??o,u=r.textFrame;super.updateGeometry(t),u.maxLineSize=a,u.textOrigin.set(-.5*a,.5*l,0),l!==o?(this.checkOverFlow(),this.checkCapacity()):a!==s&&(s<a?this.checkCapacity():s>a&&this.checkOverFlow())}checkOverFlow(t=0){let r=this.userData,i=r.textFrame.textOrigin,s=r.textFrame.textLines;for(let o=t;o<s.length;o++){s[o].updateYLinePos(this.getNewLinePosition(o)),s[o].fullUpdate(i);let a=[];for(;s[o].checkOverFlow(r.textFrame.maxLineSize);)s[o].containSpaceOverFlow()?a.unshift(s[o].getWord(s[o].message.length-1,-1)):a.unshift(s[o].popChar());if(a.length>0){s[o+1]===void 0?(s[o].isEndLine(!1),this.createTextLine()):s[o].endLine&&(this.createTextLine(o+1),s[o].isEndLine(!1),s[o+1].isEndLine(!0));let l=0;for(let u=0;u<a.length;u+=1)for(let c=0;c<a[u].length;c+=1)s[o+1].addChar3D(a[u][c],i,l),l+=1;s[o+1].fullUpdate(i)}s[o].fullUpdate(i)}this.textFullUpdate(t)}checkCapacity(t=0){let r=this.userData,i=r.textFrame.textOrigin,s=r.textFrame.maxLineSize,o=r.textFrame.textLines;for(let a=t;a<o.length;a+=1)if(o[a].updateYLinePos(this.getNewLinePosition(a)),o[a].fullUpdate(i),!!o[a-1])for(;!o[a-1].endLine;){let l,u=o[a-1].spaceLeft(s);if(o[a].wordSize(0,1)<=u){o[a].containSpace()?l=o[a].getWord(0,1):l=o[a].popChar(0);for(let c=0;c<l.length;c+=1)l[c]&&o[a-1].addChar3D(l[c],i)}else{o[a].isEmpty()?(o[a].endLine&&o[a-1].isEndLine(!0),o.splice(a,1),a-=1):(o[a].updateYLinePos(this.getNewLinePosition(a)),o[a].fullUpdate(i));break}}this.textFullUpdate(t)}createTextLine(t=this.userData.textFrame.textLines.length){let i=this.userData.textFrame;i.textLines.splice(t,0,new Lo(this.getNewLinePosition(t),i.lineHeight,i.fontSize))}textFullUpdate(t=0){let i=this.userData.textFrame,s=i.textLines,o=this.getVerticalAlignmentOffSet();for(let a=t;a<s.length;a++)s[a].updateYLinePos(this.getNewLinePosition(a)),s[a].fullUpdate(i.textOrigin),s[a].alignText(i.textOrigin,i.maxLineSize,i.horizontalAlignment,i.verticalAlignment,o)}getVerticalAlignmentOffSet(){switch(this.userData.textFrame.verticalAlignment){case 1:return 0;case 2:return this.getRemainingVerticalSpace()/2;case 3:return this.getRemainingVerticalSpace();default:return 0}}getRemainingVerticalSpace(){let r=this.userData.textFrame.textLines;return this.geometry.userData.parameters.height-this.getNewLinePosition(r.length)}getNewLinePosition(t){let i=this.userData.textFrame.textLines,s=0;for(let o=0;o<t;o+=1)s+=i[o].maxCharSize*i[o].lineHeight;return s}updateColor(t){let r=this.userData;r.textFrame.hexColor=t;let i=r.textFrame.textLines;for(let s=0;s<i.length;s++){let o=i[s].message;for(let a=0;a<o.length;a++){let l=o[a].material;l.color?.isColor&&(l.color=t)}}}updateOpacity(t){let r=this.userData;r.textFrame.opacity=t;let i=r.textFrame.textLines;for(let s=0;s<i.length;s++){let o=i[s].message;for(let a=0;a<o.length;a++){let l=o[a].material;l.opacity=t}}}updateVisible(t){let r=this.userData;r.textFrame.visible=t;let i=r.textFrame.textLines;for(let s=0;s<i.length;s++){let o=i[s].message;for(let a=0;a<o.length;a++){let l=o[a].material;l.visible=t}}}async updateFontFamily(t){await Qn.loadFont(t);let i=this.userData.textFrame,s=i.textLines;i.fontFamily=t;for(let o=0;o<s.length;o++){let a=s[o].message;for(let l=0;l<a.length;l++)a[l].updateFontFamily(t)}this.textFullUpdate(),this.checkOverFlow(),this.checkCapacity()}updateFontSize(t){let i=this.userData.textFrame,s=i.textLines,o=i.fontSize;i.fontSize=t;for(let a=0;a<s.length;a++)s[a].updateFontSize(t);this.textFullUpdate(),t>o?this.checkOverFlow():t<o&&this.checkCapacity()}async updateTextTransform(t){let i=this.userData.textFrame;await Qn.loadFont(i.fontFamily);let s=i.textLines;switch(i.textTransform=t,t){case 2:for(let o=0;o<s.length;o++){let a=s[o].message;for(let l=0;l<a.length;l++)s[o].message[l].updateChar(a[l].char.toUpperCase())}break;case 3:for(let o=0;o<s.length;o++){let a=s[o].message;for(let l=0;l<a.length;l++)s[o].message[l].updateChar(a[l].char.toLowerCase())}break;default:for(let o=0;o<s.length;o++){let a=s[o].message;for(let l=0;l<a.length;l++)s[o].message[l].updateChar(a[l].originalChar)}}this.textFullUpdate(),this.checkOverFlow(),this.checkCapacity()}updateLetterSpacing(t){let r=this.userData,i=r.textFrame.textLines;r.textFrame.letterSpacing=t;for(let s=0;s<i.length;s++){let o=i[s].message;for(let a=0;a<o.length;a++)o[a].updateLetterSpacing(t)}this.textFullUpdate(),this.checkOverFlow(),this.checkCapacity()}updateLOD(t){let r=this.userData;r.textFrame.LOD=t;let i=r.textFrame.textLines;for(let s=0;s<i.length;s++);this.textFullUpdate(),this.checkOverFlow(),this.checkCapacity()}updateLineHeight(t){let r=this.userData,i=r.textFrame.textLines;r.textFrame.lineHeight=t;for(let s=0;s<i.length;s++)i[s].updatelineHeight(t);this.textFullUpdate()}updateVerticalAlignment(t){let r=this.userData;r.textFrame.verticalAlignment=t,this.textFullUpdate()}updateHorizontalAlignment(t){let r=this.userData;r.textFrame.horizontalAlignment=t,this.textFullUpdate()}fromTextFrameData(t,r){if(t.color!==void 0){let i=or(t.color,r);this.updateColor(i),this.updateOpacity(i.a)}t.alpha!==void 0&&this.updateOpacity(t.alpha),t.font!==void 0&&this.updateFontFamily(t.font),t.horizontalAlign!==void 0&&this.updateHorizontalAlignment(t.horizontalAlign),t.verticalAlign!==void 0&&this.updateVerticalAlignment(t.verticalAlign),t.textTransform!==void 0&&this.updateTextTransform(t.textTransform),t.fontSize!==void 0&&this.updateFontSize(t.fontSize),t.lineHeight!==void 0&&this.updateLineHeight(t.lineHeight),t.letterSpacing!==void 0&&this.updateLetterSpacing(t.letterSpacing),t.text!==void 0&&t.text!==""&&this.updateText(t.text),(t.width!==void 0||t.height!==void 0)&&this.updateGeometry({parameters:{width:t.width,height:t.height}})}fromState(t,r){return super.fromState(t),this.fromTextFrameData(t,r),this}},Ro=Vy;Ro.VerticalAlign=Rg,Ro.HorizontalAlign=Lg,Ro.TextTransform=Ng;var No=class extends vn{};var a_=xp(i_());var s_=new Map;function o_(n){if(typeof n=="string")return n;let e=s_.get(n);return e||(e={url:URL.createObjectURL(new Blob([n]))},s_.set(n,e)),e.url}var Ws=class{constructor({src:e,volume:t,delay:r,loop:i}){this._volume=1;this.delay=0;this._loop=1;this.loopsRemaining=0;this._isStarted=!1;this.onEnd=()=>{this._loop>1?this.loopsRemaining===1/0?this.play():this.loopsRemaining>1?(this.play(),this.loopsRemaining--):this._isStarted=!1:this._isStarted=!1};let s;typeof e=="string"?s={src:e}:s={src:o_(e),format:"wav"},this.sound=new a_.Howl(s),this.sound.on("end",this.onEnd),this._src=e,t!==void 0&&(this.volume=t),r!==void 0&&(this.delay=r),i!==void 0&&(this.loop=i)}get src(){return this._src}get isStarted(){return this._isStarted}get volume(){return this._volume}set volume(e){this._volume=e,this.sound.volume(e)}get loop(){return this._loop}set loop(e){this._loop=e,this.loopsRemaining=e}fade(e,t=1e3){e?(this.sound.volume(this._volume),this.clearFade(),this.fadeTimerId=window.setTimeout(()=>{this.sound.fade(this._volume,0,t),this.clearFade()},e)):this.sound.fade(this._volume,0,t)}on(e,t,r){this.sound.on(e,t,r)}off(e,t,r){this.sound.off(e,t,r)}play(){this._isStarted=!0,this.delay?(this.clearDelay(),this.delayTimerId=window.setTimeout(()=>{this.sound.play(),this.clearDelay()},this.delay)):this.sound.play()}pause(){this._isStarted=!1,this.sound.pause(),this.clearFade(),this.clearDelay()}stop(){this._isStarted=!1,this.sound.stop(),this.loopsRemaining=this._loop,this.clearFade(),this.clearDelay()}clearFade(){this.fadeTimerId&&(clearTimeout(this.fadeTimerId),delete this.fadeTimerId)}clearDelay(){this.delayTimerId&&(clearTimeout(this.delayTimerId),delete this.delayTimerId)}dispose(e=!1){this.off(),this.stop(),this.clearFade(),this.clearDelay()}};var zu=class{constructor(e){this.deletedMaterial=new No(gn.defaultTwoLayerData("basic"),this);this.deletedImage=new Do(sf.emptyImage);this.materials={};this.images={};this.colors={};this.audios={};this.penumbraSize=[];this.onImageLoad=()=>{this._onImageLoad&&this._onImageLoad()};this.reset(e)}setOnImageLoad(e){this._onImageLoad=e}reset(e){for(let[t,r]of Object.entries(e.images))this.addImage(t,r);for(let[t,r]of Object.entries(e.colors))this.addColor(t,r);for(let[t,r]of Object.entries(e.materials))this.addMaterial(t,new No(r,this));for(let[t,r]of Object.entries(e.audios))this.addAudio(t,r.data);this.penumbraSize=e.penumbraSize}addMaterial(e,t){t.uuid=e,this.materials[e]=t}deleteMaterial(e){this.materials[e]&&(this.materials[e].dispose(),delete this.materials[e])}getMaterial(e){let t=this.materials[e];return t}getMaterialOrDeletedPlaceholder(e){return this.materials[e]??this.deletedMaterial}material(e){return typeof e=="string"?this.getMaterialOrDeletedPlaceholder(e):new vn(e,this)}getMaterials(){return this.materials}addImage(e,t){return this.images[e]?(this.images[e].updateSrc(t.data),!0):(this.images[e]=new Do(t,this.onImageLoad),!1)}deleteImage(e){this.images[e]&&delete this.images[e]}getDefaultImage(){return this.images.image_0}getImage(e){return this.images[e]??this.deletedImage}image(e){return typeof e=="string"?this.getImage(e):new Al(e,this.onImageLoad)}getImages(){return this.images}addColor(e,t){return this.colors[e]?("a"in t?this.colors[e].setRGBA(t.r,t.g,t.b,t.a):this.colors[e].setRGBA(t.r,t.g,t.b,1),!0):("a"in t?this.colors[e]=new Gs(t.r,t.g,t.b,t.a):this.colors[e]=new Gs(t.r,t.g,t.b,1),!1)}updateColor(e,t){if(this.colors[e]){let r=this.colors[e];return this.colors[e].r=t.r??r.r,this.colors[e].g=t.g??r.g,this.colors[e].b=t.b??r.b,this.colors[e].a=t.a??r.a,!0}return!1}deleteColor(e){this.colors[e]&&delete this.colors[e]}getColor(e){return this.colors[e]}color(e){let t;if(typeof e=="string"){let r=this.getColor(e);r?t=r:(console.warn("Tried to create color layer params with a color key that does not exist in the assets manager"),t=new dr(0,0,0,0))}else return"a"in e?new dr(e.r,e.g,e.b,e.a):new dr(e.r,e.g,e.b,1);return t}addAudio(e,t){this.audios[e]=t}getAudio(e){let t=this.audios[e];if(t instanceof Ws)return t;{let r=new Ws({src:t});return this.audios[e]=r,r}}deleteAudio(e){this.audios[e]&&delete this.audios[e]}dispose(){Object.keys(this.materials).forEach(t=>this.deleteMaterial(t)),this._onImageLoad=void 0,Object.values(this.audios).forEach(t=>{t instanceof Ws&&t.dispose()}),this.audios={}}},Kse=new zu(nf.emptyData());var Hy=new WeakMap,Gf=class extends gs{constructor(e){super(e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,t,r,i){let s=new ys(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,o=>{let a={attributeIDs:this.defaultAttributeIDs,attributeTypes:this.defaultAttributeTypes,useUniqueIDs:!1};this.decodeGeometry(o,a).then(t).catch(i)},r,i)}decodeDracoFile(e,t,r,i){let s={attributeIDs:r||this.defaultAttributeIDs,attributeTypes:i||this.defaultAttributeTypes,useUniqueIDs:!!r};this.decodeGeometry(e,s).then(t)}decodeGeometry(e,t){for(let l in t.attributeTypes){let u=t.attributeTypes[l];u.BYTES_PER_ELEMENT!==void 0&&(t.attributeTypes[l]=u.name)}let r=JSON.stringify(t);if(Hy.has(e)){let l=Hy.get(e);if(l.key===r)return l.promise;if(e.byteLength===0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let i,s=this.workerNextTaskID++,o=e.byteLength,a=this._getWorker(s,o).then(l=>(i=l,new Promise((u,c)=>{i._callbacks[s]={resolve:u,reject:c},i.postMessage({type:"decode",id:s,taskConfig:t,buffer:e},[e])}))).then(l=>this._createGeometry(l.geometry));return a.catch(()=>!0).then(()=>{i&&s&&this._releaseTask(i,s)}),Hy.set(e,{key:r,promise:a}),a}_createGeometry(e){let t=new De;e.index&&t.setIndex(new je(e.index.array,1));for(let r=0;r<e.attributes.length;r++){let i=e.attributes[r],s=i.name,o=i.array,a=i.itemSize;t.setAttribute(s,new je(o,a))}return t}_loadLibrary(e,t){let r=new ys(this.manager);return r.setPath(this.decoderPath),r.setResponseType(t),r.setWithCredentials(this.withCredentials),new Promise((i,s)=>{r.load(e,i,void 0,s)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;let e=typeof WebAssembly!="object"||this.decoderConfig.type==="js",t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(r=>{let i=r[0];e||(this.decoderConfig.wasmBinary=r[1]);let s=TF.toString(),o=["/* draco decoder */",i,"","/* worker */",s.substring(s.indexOf("{")+1,s.lastIndexOf("}"))].join(`
4908
4908
  `);this.workerSourceURL=URL.createObjectURL(new Blob([o]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){let i=new Worker(this.workerSourceURL);i._callbacks={},i._taskCosts={},i._taskLoad=0,i.postMessage({type:"init",decoderConfig:this.decoderConfig}),i.onmessage=function(s){let o=s.data;switch(o.type){case"decode":i._callbacks[o.id].resolve(o);break;case"error":i._callbacks[o.id].reject(o);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+o.type+'"')}},this.workerPool.push(i)}else this.workerPool.sort(function(i,s){return i._taskLoad>s._taskLoad?-1:1});let r=this.workerPool[this.workerPool.length-1];return r._taskCosts[e]=t,r._taskLoad+=t,r})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this}};function TF(){let n,e;onmessage=function(o){let a=o.data;switch(a.type){case"init":n=a.decoderConfig,e=new Promise(function(c){n.onModuleLoaded=function(h){c({draco:h})},DracoDecoderModule(n)});break;case"decode":let l=a.buffer,u=a.taskConfig;e.then(c=>{let h=c.draco,d=new h.Decoder,f=new h.DecoderBuffer;f.Init(new Int8Array(l),l.byteLength);try{let m=t(h,d,f,u),p=m.attributes.map(g=>g.array.buffer);m.index&&p.push(m.index.array.buffer),self.postMessage({type:"decode",id:a.id,geometry:m},p)}catch(m){console.error(m),self.postMessage({type:"error",id:a.id,error:m.message})}finally{h.destroy(f),h.destroy(d)}});break}};function t(o,a,l,u){let c=u.attributeIDs,h=u.attributeTypes,d,f,m=a.GetEncodedGeometryType(l);if(m===o.TRIANGULAR_MESH)d=new o.Mesh,f=a.DecodeBufferToMesh(l,d);else if(m===o.POINT_CLOUD)d=new o.PointCloud,f=a.DecodeBufferToPointCloud(l,d);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!f.ok()||d.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+f.error_msg());let p={index:null,attributes:[]};for(let g in c){let y=self[h[g]],x,w;if(u.useUniqueIDs)w=c[g],x=a.GetAttributeByUniqueId(d,w);else{if(w=a.GetAttributeId(d,o[c[g]]),w===-1)continue;x=a.GetAttribute(d,w)}p.attributes.push(i(o,a,d,g,y,x))}return m===o.TRIANGULAR_MESH&&(p.index=r(o,a,d)),o.destroy(d),p}function r(o,a,l){let c=l.num_faces()*3,h=c*4,d=o._malloc(h);a.GetTrianglesUInt32Array(l,h,d);let f=new Uint32Array(o.HEAPF32.buffer,d,c).slice();return o._free(d),{array:f,itemSize:1}}function i(o,a,l,u,c,h){let d=h.num_components(),m=l.num_points()*d,p=m*c.BYTES_PER_ELEMENT,g=s(o,c),y=o._malloc(p);a.GetAttributeDataArrayForAllPoints(l,h,g,p,y);let x=new c(o.HEAPF32.buffer,y,m).slice();return o._free(y),{name:u,array:x,itemSize:d}}function s(o,a){switch(a){case Float32Array:return o.DT_FLOAT32;case Int8Array:return o.DT_INT8;case Int16Array:return o.DT_INT16;case Int32Array:return o.DT_INT32;case Uint8Array:return o.DT_UINT8;case Uint16Array:return o.DT_UINT16;case Uint32Array:return o.DT_UINT32}}}var js;function EF(){return js||(js=new Gf,js.setDecoderPath("https://www.gstatic.com/draco/versioned/decoders/1.5.2/").preload()),js.decoderPending}async function CF(n){if(js){let e={attributeIDs:js.defaultAttributeIDs,attributeTypes:js.defaultAttributeTypes,useUniqueIDs:!1},t;try{t=await js.decodeGeometry(new Int8Array(n).buffer,e)}catch(r){console.error(r)}if(t)return{index:t.index?{array:t.index.array}:void 0,attributes:Object.entries(t.attributes).map(([r,i])=>({name:r,itemSize:i.itemSize,array:i.array}))}}return null}async function l_(n,e){let[t,r]=gg(qd.deserialize(new Uint8Array(n)));AS(t);let i=[];t.scene.objects.traverse((s,o)=>{o.type==="Mesh"&&o.geometry.type==="NonParametricGeometry"&&o.geometry.data.draco!==void 0&&i.push(o)}),i.length&&await EF();for(let s of i){let o=await CF(li(s.geometry.data.draco));if(o){o.index&&(s.geometry.data.index={array:o.index.array,itemSize:1,normalized:!1,type:"Uint32Array"});let a={};o.attributes.forEach(({name:l,array:u,itemSize:c})=>{a[l]={array:u,itemSize:c,type:"Float32Array",normalized:!1}}),s.geometry.data.attributes=a,s.geometry.data.draco=void 0}}return e&&e(t),r.result().data}var p_={update:null,begin:null,loopBegin:null,changeBegin:null,change:null,changeComplete:null,loopComplete:null,complete:null,loop:1,direction:"normal",autoplay:!0,timelineOffset:0,rewind:!0},Xy={duration:1e3,delay:0,endDelay:0,easing:"easeOutElastic(1, .5)",round:0},PF=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY","perspective","matrix","matrix3d"],Vf={CSS:{},springs:{}};function Ti(n,e,t){return Math.min(Math.max(n,e),t)}function Gu(n,e){return n.indexOf(e)>-1}function Wy(n,e){return n.apply(null,e)}var ke={arr:function(n){return Array.isArray(n)},obj:function(n){return Gu(Object.prototype.toString.call(n),"Object")},pth:function(n){return ke.obj(n)&&n.hasOwnProperty("totalLength")},svg:function(n){return n instanceof SVGElement},inp:function(n){return n instanceof HTMLInputElement},dom:function(n){return!("isNode"in n)&&(n.nodeType||ke.svg(n))},str:function(n){return typeof n=="string"},fnc:function(n){return typeof n=="function"},und:function(n){return typeof n>"u"},hex:function(n){return/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(n)},rgb:function(n){return/^rgb/.test(n)},hsl:function(n){return/^hsl/.test(n)},col:function(n){return ke.hex(n)||ke.rgb(n)||ke.hsl(n)},key:function(n){return!p_.hasOwnProperty(n)&&!Xy.hasOwnProperty(n)&&n!=="targets"&&n!=="keyframes"}};function m_(n){var e=/\(([^)]+)\)/.exec(n);return e?e[1].split(",").map(function(t){return parseFloat(t)}):[]}function g_(n,e){var t=m_(n),r=Ti(ke.und(t[0])?1:t[0],.1,100),i=Ti(ke.und(t[1])?100:t[1],.1,100),s=Ti(ke.und(t[2])?10:t[2],.1,100),o=Ti(ke.und(t[3])?0:t[3],.1,100),a=Math.sqrt(i/r),l=s/(2*Math.sqrt(i*r)),u=l<1?a*Math.sqrt(1-l*l):0,c=1,h=l<1?(l*a+-o)/u:-o+a;function d(m){var p=e?e*m/1e3:m;return l<1?p=Math.exp(-p*l*a)*(c*Math.cos(u*p)+h*Math.sin(u*p)):p=(c+h*p)*Math.exp(-p*a),m===0||m===1?m:1-p}function f(){var m=Vf.springs[n];if(m)return m;for(var p=1/6,g=0,y=0;;)if(g+=p,d(g)===1){if(y++,y>=16)break}else y=0;var x=g*p*1e3;return Vf.springs[n]=x,x}return e?d:f}function DF(n){return n===void 0&&(n=10),function(e){return Math.ceil(Ti(e,1e-6,1)*n)*(1/n)}}var IF=function(){var n=11,e=1/(n-1);function t(c,h){return 1-3*h+3*c}function r(c,h){return 3*h-6*c}function i(c){return 3*c}function s(c,h,d){return((t(h,d)*c+r(h,d))*c+i(h))*c}function o(c,h,d){return 3*t(h,d)*c*c+2*r(h,d)*c+i(h)}function a(c,h,d,f,m){var p,g,y=0;do g=h+(d-h)/2,p=s(g,f,m)-c,p>0?d=g:h=g;while(Math.abs(p)>1e-7&&++y<10);return g}function l(c,h,d,f){for(var m=0;m<4;++m){var p=o(h,d,f);if(p===0)return h;var g=s(h,d,f)-c;h-=g/p}return h}function u(c,h,d,f){if(!(0<=c&&c<=1&&0<=d&&d<=1))return;var m=new Float32Array(n);if(c!==h||d!==f)for(var p=0;p<n;++p)m[p]=s(p*e,c,d);function g(y){for(var x=0,w=1,b=n-1;w!==b&&m[w]<=y;++w)x+=e;--w;var S=(y-m[w])/(m[w+1]-m[w]),A=x+S*e,M=o(A,c,d);return M>=.001?l(y,A,c,d):M===0?A:a(y,x,x+e,c,d)}return function(y){return c===h&&d===f||y===0||y===1?y:s(g(y),h,f)}}return u}(),y_=function(){var n={linear:function(){return function(r){return r}}},e={Sine:function(){return function(r){return 1-Math.cos(r*Math.PI/2)}},Circ:function(){return function(r){return 1-Math.sqrt(1-r*r)}},Back:function(){return function(r){return r*r*(3*r-2)}},Bounce:function(){return function(r){for(var i,s=4;r<((i=Math.pow(2,--s))-1)/11;);return 1/Math.pow(4,3-s)-7.5625*Math.pow((i*3-2)/22-r,2)}},Elastic:function(r,i){r===void 0&&(r=1),i===void 0&&(i=.5);var s=Ti(r,1,10),o=Ti(i,.1,2);return function(a){return a===0||a===1?a:-s*Math.pow(2,10*(a-1))*Math.sin((a-1-o/(Math.PI*2)*Math.asin(1/s))*(Math.PI*2)/o)}}},t=["Quad","Cubic","Quart","Quint","Expo"];return t.forEach(function(r,i){e[r]=function(){return function(s){return Math.pow(s,i+2)}}}),Object.keys(e).forEach(function(r){var i=e[r];n["easeIn"+r]=i,n["easeOut"+r]=function(s,o){return function(a){return 1-i(s,o)(1-a)}},n["easeInOut"+r]=function(s,o){return function(a){return a<.5?i(s,o)(a*2)/2:1-i(s,o)(a*-2+2)/2}}}),n}();function Yy(n,e){if(ke.fnc(n))return n;var t=n.split("(")[0],r=y_[t],i=m_(n);switch(t){case"spring":return g_(n,e);case"cubicBezier":return Wy(IF,i);case"steps":return Wy(DF,i);default:return Wy(r,i)}}function v_(n){try{var e=document.querySelectorAll(n);return e}catch{return}}function Hf(n,e){for(var t=n.length,r=arguments.length>=2?arguments[1]:void 0,i=[],s=0;s<t;s++)if(s in n){var o=n[s];e.call(r,o,s,n)&&i.push(o)}return i}function Wf(n){return n.reduce(function(e,t){return e.concat(ke.arr(t)?Wf(t):t)},[])}function c_(n){return ke.arr(n)?n:(ke.str(n)&&(n=v_(n)||n),n instanceof NodeList||n instanceof HTMLCollection?[].slice.call(n):[n])}function Qy(n,e){return n.some(function(t){return t===e})}function Zy(n){var e={};for(var t in n)e[t]=n[t];return e}function jy(n,e){var t=Zy(n);for(var r in n)t[r]=e.hasOwnProperty(r)?e[r]:n[r];return t}function jf(n,e){var t=Zy(n);for(var r in e)t[r]=ke.und(n[r])?e[r]:n[r];return t}function LF(n){var e=/rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g.exec(n);return e?"rgba("+e[1]+",1)":n}function RF(n){var e=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,t=n.replace(e,function(a,l,u,c){return l+l+u+u+c+c}),r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t),i=parseInt(r[1],16),s=parseInt(r[2],16),o=parseInt(r[3],16);return"rgba("+i+","+s+","+o+",1)"}function NF(n){var e=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(n)||/hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(n),t=parseInt(e[1],10)/360,r=parseInt(e[2],10)/100,i=parseInt(e[3],10)/100,s=e[4]||1;function o(d,f,m){return m<0&&(m+=1),m>1&&(m-=1),m<1/6?d+(f-d)*6*m:m<1/2?f:m<2/3?d+(f-d)*(2/3-m)*6:d}var a,l,u;if(r==0)a=l=u=i;else{var c=i<.5?i*(1+r):i+r-i*r,h=2*i-c;a=o(h,c,t+1/3),l=o(h,c,t),u=o(h,c,t-1/3)}return"rgba("+a*255+","+l*255+","+u*255+","+s+")"}function BF(n){if(ke.rgb(n))return LF(n);if(ke.hex(n))return RF(n);if(ke.hsl(n))return NF(n)}function Zi(n){var e=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn)?$/.exec(n);if(e)return e[1]}function OF(n){if(Gu(n,"translate")||n==="perspective")return"px";if(Gu(n,"rotate")||Gu(n,"skew"))return"deg"}function qy(n,e){return ke.fnc(n)?n(e.target,e.id,e.total):n}function Ei(n,e){return n.getAttribute(e)}function Ky(n,e,t){var r=Zi(e);if(Qy([t,"deg","rad","turn"],r))return e;var i=Vf.CSS[e+t];if(!ke.und(i))return i;var s=100,o=document.createElement(n.tagName),a=n.parentNode&&n.parentNode!==document?n.parentNode:document.body;a.appendChild(o),o.style.position="absolute",o.style.width=s+t;var l=s/o.offsetWidth;a.removeChild(o);var u=l*parseFloat(e);return Vf.CSS[e+t]=u,u}function x_(n,e,t){if(e in n.style){var r=e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),i=n.style[e]||getComputedStyle(n).getPropertyValue(r)||"0";return t?Ky(n,i,t):i}}function Jy(n,e){if(ke.dom(n)&&!ke.inp(n)&&(Ei(n,e)||ke.svg(n)&&n[e]))return"attribute";if(ke.dom(n)&&Qy(PF,e))return"transform";if(ke.dom(n)&&e!=="transform"&&x_(n,e))return"css";if(n[e]!=null)return"object"}function b_(n){if(!!ke.dom(n)){for(var e=n.style.transform||"",t=/(\w+)\(([^)]*)\)/g,r=new Map,i;i=t.exec(e);)r.set(i[1],i[2]);return r}}function FF(n,e,t,r){var i=Gu(e,"scale")?1:0+OF(e),s=b_(n).get(e)||i;return t&&(t.transforms.list.set(e,s),t.transforms.last=e),r?Ky(n,s,r):s}function $y(n,e,t,r){switch(Jy(n,e)){case"transform":return FF(n,e,r,t);case"css":return x_(n,e,t);case"attribute":return Ei(n,e);default:return n[e]||0}}function ev(n,e){var t=/^(\*=|\+=|-=)/.exec(n);if(!t)return n;var r=Zi(n)||0,i=parseFloat(e),s=parseFloat(n.replace(t[0],""));switch(t[0][0]){case"+":return i+s+r;case"-":return i-s+r;case"*":return i*s+r}}function w_(n,e){if(ke.col(n))return BF(n);if(/\s/g.test(n))return n;var t=Zi(n),r=t?n.substr(0,n.length-t.length):n;return e?r+e:r}function tv(n,e){return Math.sqrt(Math.pow(e.x-n.x,2)+Math.pow(e.y-n.y,2))}function UF(n){return Math.PI*2*Ei(n,"r")}function zF(n){return Ei(n,"width")*2+Ei(n,"height")*2}function GF(n){return tv({x:Ei(n,"x1"),y:Ei(n,"y1")},{x:Ei(n,"x2"),y:Ei(n,"y2")})}function S_(n){for(var e=n.points,t=0,r,i=0;i<e.numberOfItems;i++){var s=e.getItem(i);i>0&&(t+=tv(r,s)),r=s}return t}function kF(n){var e=n.points;return S_(n)+tv(e.getItem(e.numberOfItems-1),e.getItem(0))}function __(n){if(n.getTotalLength)return n.getTotalLength();switch(n.tagName.toLowerCase()){case"circle":return UF(n);case"rect":return zF(n);case"line":return GF(n);case"polyline":return S_(n);case"polygon":return kF(n)}}function VF(n){var e=__(n);return n.setAttribute("stroke-dasharray",e),e}function HF(n){for(var e=n.parentNode;ke.svg(e)&&ke.svg(e.parentNode);)e=e.parentNode;return e}function A_(n,e){var t=e||{},r=t.el||HF(n),i=r.getBoundingClientRect(),s=Ei(r,"viewBox"),o=i.width,a=i.height,l=t.viewBox||(s?s.split(" "):[0,0,o,a]);return{el:r,viewBox:l,x:l[0]/1,y:l[1]/1,w:o/l[2],h:a/l[3]}}function WF(n,e){var t=ke.str(n)?v_(n)[0]:n,r=e||100;return function(i){return{property:i,el:t,svg:A_(t),totalLength:__(t)*(r/100)}}}function jF(n,e){function t(a){a===void 0&&(a=0);var l=e+a>=1?e+a:0;return n.el.getPointAtLength(l)}var r=A_(n.el,n.svg),i=t(),s=t(-1),o=t(1);switch(n.property){case"x":return(i.x-r.x)*r.w;case"y":return(i.y-r.y)*r.h;case"angle":return Math.atan2(o.y-s.y,o.x-s.x)*180/Math.PI}}function u_(n,e){var t=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g,r=w_(ke.pth(n)?n.totalLength:n,e)+"";return{original:r,numbers:r.match(t)?r.match(t).map(Number):[0],strings:ke.str(n)||e?r.split(t):[]}}function M_(n){var e=n?Wf(ke.arr(n)?n.map(c_):c_(n)):[];return Hf(e,function(t,r,i){return i.indexOf(t)===r})}function T_(n){var e=M_(n);return e.map(function(t,r){return{target:t,id:r,total:e.length,transforms:{list:b_(t)}}})}function qF(n,e){var t=Zy(e);if(/^spring/.test(t.easing)&&(t.duration=g_(t.easing)),ke.arr(n)){var r=n.length,i=r===2&&!ke.obj(n[0]);i?n={value:n}:ke.fnc(e.duration)||(t.duration=e.duration/r)}var s=ke.arr(n)?n:[n];return s.map(function(o,a){var l=ke.obj(o)&&!ke.pth(o)?o:{value:o};return ke.und(l.delay)&&(l.delay=a?0:e.delay),ke.und(l.endDelay)&&(l.endDelay=a===s.length-1?e.endDelay:0),l}).map(function(o){return jf(o,t)})}function XF(n){for(var e=Hf(Wf(n.map(function(s){return Object.keys(s)})),function(s){return ke.key(s)}).reduce(function(s,o){return s.indexOf(o)<0&&s.push(o),s},[]),t={},r=function(s){var o=e[s];t[o]=n.map(function(a){var l={};for(var u in a)ke.key(u)?u==o&&(l.value=a[u]):l[u]=a[u];return l})},i=0;i<e.length;i++)r(i);return t}function YF(n,e){var t=[],r=e.keyframes;r&&(e=jf(XF(r),e));for(var i in e)ke.key(i)&&t.push({name:i,tweens:qF(e[i],n)});return t}function QF(n,e){var t={};for(var r in n){var i=qy(n[r],e);ke.arr(i)&&(i=i.map(function(s){return qy(s,e)}),i.length===1&&(i=i[0])),t[r]=i}return t.duration=parseFloat(t.duration),t.delay=parseFloat(t.delay),t}function ZF(n,e){var t;return n.tweens.map(function(r){var i=QF(r,e),s=i.value,o=ke.arr(s)?s[1]:s,a=Zi(o),l=$y(e.target,n.name,a,e),u=t?t.to.original:l,c=ke.arr(s)?s[0]:u,h=Zi(c)||Zi(l),d=a||h;return ke.und(o)&&(o=u),i.from=u_(c,d),i.to=u_(ev(o,c),d),i.start=t?t.end:0,i.end=i.start+i.delay+i.duration+i.endDelay,i.easing=Yy(i.easing,i.duration),i.isPath=ke.pth(s),i.isColor=ke.col(i.from.original),i.isColor&&(i.round=1),t=i,i})}var E_={css:function(n,e,t){return n.style[e]=t},attribute:function(n,e,t){return n.setAttribute(e,t)},object:function(n,e,t){return n[e]=t},transform:function(n,e,t,r,i){if(r.list.set(e,t),e===r.last||i){var s="";r.list.forEach(function(o,a){s+=a+"("+o+") "}),n.style.transform=s}}};function C_(n,e){var t=T_(n);t.forEach(function(r){for(var i in e){var s=qy(e[i],r),o=r.target,a=Zi(s),l=$y(o,i,a,r),u=a||Zi(l),c=ev(w_(s,u),l),h=Jy(o,i);E_[h](o,i,c,r.transforms,!0)}})}function KF(n,e){var t=Jy(n.target,e.name);if(t){var r=ZF(e,n),i=r[r.length-1];return{type:t,property:e.name,animatable:n,tweens:r,duration:i.end,delay:r[0].delay,endDelay:i.endDelay}}}function JF(n,e){return Hf(Wf(n.map(function(t){return e.map(function(r){return KF(t,r)})})),function(t){return!ke.und(t)})}function P_(n,e){var t=n.length,r=function(s){return s.timelineOffset?s.timelineOffset:0},i={};return i.duration=t?Math.max.apply(Math,n.map(function(s){return r(s)+s.duration})):e.duration,i.delay=t?Math.min.apply(Math,n.map(function(s){return r(s)+s.delay})):e.delay,i.endDelay=t?i.duration-Math.max.apply(Math,n.map(function(s){return r(s)+s.duration-s.endDelay})):e.endDelay,i}var h_=0;function $F(n){var e=jy(p_,n),t=jy(Xy,n),r=YF(t,n),i=T_(n.targets),s=JF(i,r),o=P_(s,t),a=h_;return h_++,jf(e,{id:a,children:[],animatables:i,animations:s,duration:o.duration,delay:o.delay,endDelay:o.endDelay})}var sn=[],d_=[],kf,eU=function(){function n(){kf=requestAnimationFrame(e)}function e(t){var r=sn.length;if(r){for(var i=0;i<r;){var s=sn[i];if(!s.paused)s.tick(t);else{var o=sn.indexOf(s);o>-1&&(sn.splice(o,1),r=sn.length)}i++}n()}else kf=cancelAnimationFrame(kf)}return n}();function tU(){document.hidden?(sn.forEach(function(n){return n.pause()}),d_=sn.slice(0),ar.running=sn=[]):d_.forEach(function(n){return n.play()})}typeof document<"u"&&document.addEventListener("visibilitychange",tU);function ar(n){n===void 0&&(n={});var e=0,t=0,r=0,i,s=0,o=null;function a(w){var b=window.Promise&&new Promise(function(S){return o=S});return w.finished=b,b}var l=$F(n),u=a(l);function c(){var w=l.direction;w!=="alternate"&&(l.direction=w!=="normal"?"normal":"reverse"),l.reversed=!l.reversed,i.forEach(function(b){return b.reversed=l.reversed})}function h(w){return l.reversed?l.duration-w:w}function d(){e=0,t=h(l.currentTime)*(1/ar.speed)}function f(w,b){b&&b.seek(w-b.timelineOffset)}function m(w){if(l.reversePlayback)for(var S=s;S--;)f(w,i[S]);else for(var b=0;b<s;b++)f(w,i[b])}function p(w){var b=0,S=l.animations,A=S.length;for(l.reversePlayback===!0&&l.rewind===!1&&(w=l.duration+l.delay-l.endDelay-w);b<A;){var M=S[b],v=M.animatable,T=M.tweens,E=T.length-1,C=T[E];E&&(C=Hf(T,function($){return w<$.end})[0]||C);for(var L=Ti(w-C.start-C.delay,0,C.duration)/C.duration,N=isNaN(L)?1:C.easing(L),R=C.to.strings,W=C.round,j=[],Z=C.to.numbers.length,Y=void 0,z=0;z<Z;z++){var F=void 0;if(l.reversePlayback===!0&&l.rewind===!1)var G=C.to.numbers[z],O=C.from.numbers[z]||0;else var O=C.to.numbers[z],G=C.from.numbers[z]||0;C.isPath?F=jF(C.value,N*O):F=G+N*(O-G),W&&(C.isColor&&z>2||(F=Math.round(F*W)/W)),j.push(F)}var k=R.length;if(!k)Y=j[0];else{Y=R[0];for(var H=0;H<k;H++){var X=R[H],q=R[H+1],ae=j[H];isNaN(ae)||(q?Y+=ae+q:Y+=ae+" ")}}E_[M.type](v.target,M.property,Y,v.transforms),M.currentValue=Y,b++}}function g(w){l[w]&&!l.passThrough&&l[w](l)}function y(){l.remaining&&l.remaining!==!0&&l.remaining--}function x(w){var b=l.duration,S=l.delay,A=b-l.endDelay,M=h(w);l.progress=Ti(M/b*100,0,100),l.reversePlayback=M<l.currentTime,i&&m(M),!l.began&&l.currentTime>=0&&(l.began=!0,g("begin")),!l.loopBegan&&l.currentTime>0&&(l.loopBegan=!0,g("loopBegin")),M<=S&&l.currentTime!==0&&(p(0),g("change")),(M>=A&&l.currentTime!==b||!b)&&(p(b),g("change")),M>S&&M<A?(l.changeBegan||(l.changeBegan=!0,l.changeCompleted=!1,g("changeBegin")),g("change"),p(M)):l.changeBegan?(l.changeCompleted=!0,l.changeBegan=!1,g("change"),g("changeComplete")):l.began&&M>A&&(g("change"),g("changeComplete")),l.currentTime=Ti(M,0,b),l.began&&g("update"),w>=b&&(t=0,y(),l.remaining?(e=r,g("loopComplete"),l.loopBegan=!1,l.direction==="alternate"&&c()):(l.paused=!0,l.completed||(l.completed=!0,g("loopComplete"),g("complete"),!l.passThrough&&"Promise"in window&&(o(),u=a(l)))))}return l.reset=function(){var w=l.direction;l.passThrough=!1,l.currentTime=0,l.progress=0,l.paused=!0,l.began=!1,l.loopBegan=!1,l.changeBegan=!1,l.completed=!1,l.changeCompleted=!1,l.reversePlayback=!1,l.reversed=w==="reverse",l.remaining=l.loop,i=l.children,s=i.length;for(var b=s;b--;)l.children[b].reset();(l.reversed&&l.loop!==!0||w==="alternate"&&l.loop===1)&&l.remaining++,p(l.reversed?l.duration:0)},l.set=function(w,b){return C_(w,b),l},l.tick=function(w){r=w,e||(e=r),x((r+(t-e))*ar.speed)},l.seek=function(w){x(h(w))},l.pause=function(){l.paused=!0,d()},l.play=function(){!l.paused||(l.completed&&l.reset(),l.paused=!1,sn.push(l),d(),kf||eU())},l.reverse=function(){c(),l.completed=!l.reversed,d()},l.restart=function(){l.reset(),l.play()},l.reset(),l.autoplay&&l.play(),l}function f_(n,e){for(var t=e.length;t--;)Qy(n,e[t].animatable.target)&&e.splice(t,1)}function rU(n){for(var e=M_(n),t=sn.length;t--;){var r=sn[t],i=r.animations,s=r.children;f_(e,i);for(var o=s.length;o--;){var a=s[o],l=a.animations;f_(e,l),!l.length&&!a.children.length&&s.splice(o,1)}!i.length&&!s.length&&r.pause()}}function nU(n,e){e===void 0&&(e={});var t=e.direction||"normal",r=e.easing?Yy(e.easing):null,i=e.grid,s=e.axis,o=e.from||0,a=o==="first",l=o==="center",u=o==="last",c=ke.arr(n),h=parseFloat(c?n[0]:n),d=c?parseFloat(n[1]):0,f=Zi(c?n[1]:n)||0,m=e.start||0+(c?h:0),p=[],g=0;return function(y,x,w){if(a&&(o=0),l&&(o=(w-1)/2),u&&(o=w-1),!p.length){for(var b=0;b<w;b++){if(!i)p.push(Math.abs(o-b));else{var S=l?(i[0]-1)/2:o%i[0],A=l?(i[1]-1)/2:Math.floor(o/i[0]),M=b%i[0],v=Math.floor(b/i[0]),T=S-M,E=A-v,C=Math.sqrt(T*T+E*E);s==="x"&&(C=-T),s==="y"&&(C=-E),p.push(C)}g=Math.max.apply(Math,p)}r&&(p=p.map(function(N){return r(N/g)*g})),t==="reverse"&&(p=p.map(function(N){return s?N<0?N*-1:-N:Math.abs(g-N)}))}var L=c?(d-h)/g:h;return m+L*(Math.round(p[x]*100)/100)+f}}function iU(n){n===void 0&&(n={});var e=ar(n);return e.duration=0,e.add=function(t,r){var i=sn.indexOf(e),s=e.children;i>-1&&sn.splice(i,1);function o(d){d.passThrough=!0}for(var a=0;a<s.length;a++)o(s[a]);var l=jf(t,jy(Xy,n));l.targets=l.targets||n.targets;var u=e.duration;l.autoplay=!1,l.direction=e.direction,l.timelineOffset=ke.und(r)?u:ev(r,u),o(e),l.rewind=e.rewind,e.seek(l.timelineOffset);var c=ar(l);o(c),s.push(c);var h=P_(s,n);return e.delay=h.delay,e.endDelay=h.endDelay,e.duration=h.duration,e.seek(0),e.reset(),e.autoplay&&e.play(),e},e}ar.version="3.2.0";ar.speed=1;ar.running=sn;ar.remove=rU;ar.get=$y;ar.set=C_;ar.convertPx=Ky;ar.path=WF;ar.setDashoffset=VF;ar.stagger=nU;ar.timeline=iU;ar.easing=Yy;ar.penner=y_;ar.random=function(n,e){return Math.floor(Math.random()*(e-n+1))+n};var D_=ar;function I_(n,e,t){let r=n.cameraType==="OrthographicCamera"?e.orthographic?.zoom:e.perspective?.zoom;if(r!==void 0){let i=n.zoom;i!==r&&t.push({change:s=>{n.zoom=Je.lerp(i,r,s),n.updateProjectionMatrix()}})}if(e.targetOffset!==void 0){let i=n.targetOffset,s=e.targetOffset;i!==s&&t.push({change:o=>{n.targetOffset=Je.lerp(i,s,o)}})}}function L_(n,e,t){if(e.width!==void 0&&e.height!==void 0&&e.depth!==void 0){let{width:r,height:i,depth:s}=n.geometry.userData.parameters,o=[r,i,s],a=[e.width,e.height,e.depth];!ir.isEqual(o,a)&&!At(n)&&t.push({change:l=>{let[u,c,h]=ir.lerp(o,a,l);n.updateGeometry({parameters:{width:u,height:c,depth:h}}),n.invalidateDownstreamBooleanData()}})}}function R_(n,e,t,r){if(e.intensity!==void 0){let i=n.intensity,s=e.intensity;i!==s&&t.push({change:o=>{n.intensity=Je.lerp(i,s,o)}})}if(e.color!==void 0){let i=n.color.clone(),s=typeof e.color=="string"?r.getColor(e.color):e.color;if(!nr.equals(i,s)){let o=i.clone();n.color=o,t.push({change:a=>{let{r:l,g:u,b:c}=nr.lerp(i,s,a);o.setRGB(l,u,c)}})}}}function N_(n,e,t,r){let i=0,s=n.layers[i];for(;s;){let o=e.layers.data(s.uuid);if(o&&(s.visible??!0)&&(o.visible??!0)){let a=s.getNames().filter(l=>!Jd.some(u=>l.includes(u)));for(let l of a)try{let u=s.getValue(l);if(l==="steps")uU(s,o,l,t);else if(l==="colors")hU(s,o,l,t);else if(typeof u=="number")sU(s,o,l,t);else{if(typeof u=="boolean")continue;"isVector2"in u?oU(s,o,l,t):"isVector3"in u?aU(s,o,l,t):"isColorA"in u?cU(s,o,l,t,r):"isColor"in u?lU(s,o,l,t,r):"isTexture"in u&&dU(s,o,l,t)}}catch(u){console.error(`animateMaterial: unexpected material layer for ${l}`,u)}}i+=1,s=n.layers[i]}}function sU(n,e,t,r){if(!n.hasValue(t)||!(t in e))return;let i=n.getValue(t),s=e[t];i!==s&&r.push({change:o=>{n.setValue(t,Je.lerp(i,s,o))}})}function oU(n,e,t,r){if(!n.hasValue(t)||!(t in e))return;let i=n.getValue(t),s=i.toArray(),o=e[t];Xi.isEqual(s,o)||r.push({change:a=>{i.fromArray(Xi.lerp(s,o,a))}})}function aU(n,e,t,r){if(!n.hasValue(t)||!(t in e))return;let i=n.getValue(t),s=i.toArray(),o=e[t];ir.isEqual(s,o)||r.push({change:a=>{i.fromArray(ir.lerp(s,o,a))}})}function lU(n,e,t,r,i){if(!n.hasValue(t)||!(t in e))return;let s=n.getValue(t).clone(),o=e[t],a=typeof o=="string"?i.getColor(o):o;if(nr.equals(s,a))return;let l=s.clone();n.setValue(t,l),r.push({change:u=>{let{r:c,g:h,b:d}=nr.lerp(s,a,u);l.setRGB(c,h,d)}})}function cU(n,e,t,r,i){if(!n.hasValue(t)||!(t in e))return;let s=n.getValue(t).clone(),o=e[t],a=typeof o=="string"?i.getColor(o):o;if(Lr.equals(s,a))return;let l=s.clone();n.setValue(t,l),r.push({change:u=>{let{r:c,g:h,b:d,a:f}=Lr.lerp(s,a,u);l.setRGBA(c,h,d,f)}})}function uU(n,e,t="steps",r){if(!n.hasValue(t)||!(t in e))return;let i=[...n.getValue(t)],s=e[t];for(let o=0;o<i.length;++o){let a=i[o],l=s[o];a!==l&&r.push({change:u=>{i[o]=Je.lerp(a,l,u),n.setValue("steps",i)}})}}function hU(n,e,t="colors",r){if(!n.hasValue(t)||!(t in e))return;let i=n.getValue(t),s=e[t];for(let o=0;o<i.length;++o){let a=i[o].toArray(),l=s[o];qc.isEqual(a,l)||r.push({change:u=>{i[o].fromArray(qc.lerp(a,l,u))}})}}function dU(n,e,t="texture",r){if(!n.hasValue(t)||!(t in e))return;let i=n.getNode("mat"),s=e[t],o=i.repeat,a=i.offset,l=s.repeat,u=s.offset;(!Xi.isEqual(o,l)||!Xi.isEqual(a,u))&&r.push({change:c=>{i.repeat=Xi.lerp(o,l,c),i.offset=Xi.lerp(a,u,c),i.updateMatrix()}})}function B_(n,e,t,r){if(r===0)return t.copy(n);if(r===1)return t.copy(e);let i=n.w*e.w+n.x*e.x+n.y*e.y+n.z*e.z;if(i>=1)return t.copy(n);let s=1-i*i;if(s<=Number.EPSILON){let c=1-r;return t.w=c*n.w+r*e.w,t.x=c*n.x+r*e.x,t.y=c*n.y+r*e.y,t.z=c*n.z+r*e.z,t.normalize(),t}let o=Math.sqrt(s),a=Math.atan2(o,i),l=Math.sin((1-r)*a)/o,u=Math.sin(r*a)/o;return t.w=n.w*l+e.w*u,t.x=n.x*l+e.x*u,t.y=n.y*l+e.y*u,t.z=n.z*l+e.z*u,t}function O_(n,e,t=0){let r=Array.isArray(n.material)?n.material[t]:n.material,i;return"materials"in e?i=e.materials[t]:"material"in e&&(i=e.material),[r,i]}var rv=new _,nv=new _,F_=new qt,fU=new bn,pU=new Re;function U_(n,e,t,r){if(t.position!==void 0){let i=n.position.toArray(),s=t.position;ir.isEqual(i,s)||r.push({change:o=>{n.position.fromArray(ir.lerp(i,s,o)),n.updateMatrix(),Ut(n)&&At(n.parent)&&n.invalidateDownstreamBooleanData(!0)}})}if(t.scale!==void 0){let i=n.scale.toArray(),s=t.scale;ir.isEqual(i,s)||r.push({change:o=>{n.scale.fromArray(ir.lerp(i,s,o)),n.updateMatrix(),Ut(n)&&At(n.parent)&&n.invalidateDownstreamBooleanData(!0)}})}mU(n,e,t,r),gU(n,t,r)}function mU(n,e,t,r){if(t.rotation===void 0)return;let i=rv.setFromEuler(n.rotation).toArray(),s=t.rotation;if(ir.isEqual(i,s))return;if(ir.sub(t.rotation,e?e.rotation:n.rotation).every(a=>Math.abs(a)<2*Math.PI)){let a=n.quaternion.clone(),l=new qt().setFromEuler(fU.set(t.rotation[0],t.rotation[1],t.rotation[2]));r.push({change:u=>{B_(a,l,n.quaternion,u),n.updateMatrix(),Ut(n)&&At(n.parent)&&n.invalidateDownstreamBooleanData(!0)}})}else r.push({change:a=>{n.rotation.setFromVector3(nv.fromArray(ir.lerp(i,s,a))),n.updateMatrix(),Ut(n)&&At(n.parent)&&n.invalidateDownstreamBooleanData(!0)}})}function gU(n,e,t){if(e.hiddenMatrix!==void 0&&!oi.isEqual(n.hiddenMatrix.toArray(),e.hiddenMatrix)){let r=new _,i=new qt,s=new _;n.hiddenMatrix.decompose(r,i,s);let o=new _,a=new qt,l=new _;pU.fromArray(e.hiddenMatrix).decompose(o,a,l),t.push({change:u=>{F_.slerpQuaternions(i,a,u),rv.lerpVectors(r,o,u),nv.lerpVectors(s,l,u),n.hiddenMatrix.compose(rv,F_,nv),Ut(n)&&At(n.parent)&&n.invalidateDownstreamBooleanData(!0)}})}}function z_(n,e,t,r){let i=[];if((n.visible||At(n.parent))&&U_(n,e?.objectState,t.objectState,i),Ut(n)){if((n.visible||At(n.parent))&&"geometry"in t.objectState&&L_(n,t.objectState.geometry,i),n.visible&&("material"in t.objectState||"materials"in t.objectState)){let[s,o]=O_(n,t.objectState,0);s&&o&&typeof o!="string"&&N_(s,o,i,r)}}else n.visible&&A1(n)?R_(n,t.objectState,i,r):_1(n)&&I_(n,t.objectState,i);return i.length?{change:s=>{i.forEach(o=>{o.change&&o.change(s)})}}:void 0}function yU(n,e,t){switch(n){case 0:return"cubicBezier( 0, 0, 1, 1 )";case 1:return"cubicBezier( .25, .1, .25, 1 )";case 2:return"cubicBezier( .42, 0, 1, 1 )";case 3:return"cubicBezier( 0, 0, .58, 1 )";case 4:return"cubicBezier( .42, 0, .58, 1 )";case 5:let{control1:r,control2:i}=e??{...Ed.defaultData};return`cubicBezier( ${r[0]}, ${r[1]}, ${i[0]}, ${i[1]} )`;case 6:let{mass:s,stiffness:o,damping:a,velocity:l}=t??{...Td.defaultData};return`spring( ${s}, ${o}, ${a}, ${l} )`}}var qf=class{constructor(e,t){this.object=e;this.sharedAssets=t;this.uuid=Je.generateUUID();this.states=[];this.events={};this.animatingState=0;this._scrollCounter=null}get fromState(){return this._fromState}get animation(){return this._animation}start(){this._animation!==void 0&&(this._animation.pause(),this._animation=void 0,this._scrollCounter=null),this.states.length>1&&(this.states[0].execute(this.object,this.sharedAssets),this._toState=this.states[0],this._fromState=void 0)}end(){this._animation!==void 0&&(this._animation.pause(),this._animation=void 0),this.states.length>1&&this.states[0].execute(this.object,this.sharedAssets),this._toState=void 0,this._fromState=void 0}seek(e,t,r,i,s){this._scrollCounter===null&&(this.animate(e,i,s),this._scrollCounter=0),this._scrollCounter+=t,this._scrollCounter=Math.min(Math.max(this._scrollCounter,0),r),this._animation?.seek(this._scrollCounter/r*(i.duration?i.duration:1))}animate(e,t,r){if(this._fromState===e&&this._animation?.reversed){let i=this._animation?.currentTime??0;this._animation?.reset(),this._animation?.seek(i),this._animation?.play()}else if(this._toState!==e){this._animation!==void 0&&this._animation.pause(),this.animatingState=0,this._fromState=this._toState,this._toState=e;let i=z_(this.object,this._fromState,e,this.sharedAssets);if(!i)return;let s={t:0};this._animation=D_({autoplay:!1,loop:t.repeat?!0:t.cycle?1:!1,direction:t.cycle?"alternate":"normal",rewind:t.rewind,delay:t.startDelay,endDelay:t.endDelay,duration:t.duration,easing:yU(t.easing,t.cubicControls,t.springParameters),targets:s,t:1,change:()=>{i.change&&i.change(s.t),r?.change&&r.change(s.t)},loopBegin:o=>{if(this.animatingState===0){this.animatingState=1;return}o.reversed?(this._toState=this._fromState,this._fromState=e):(this._fromState=this._toState,this._toState=e)}}),t.autoplay?t.startOnceDelay>0?setTimeout(()=>this._animation?.play(),t.startOnceDelay):this._animation?.play():this._animation.finished.then(()=>{this.animatingState=0})}}emitEvent(e,t){if(e==="keyDown"||e==="keyUp"||e==="mouseDown"||e==="mouseUp"||e==="mouseHover"||e==="scroll"||e==="start"){let r=this.events[e];if(r){for(let i of r)if("targets"in i)for(let{object:s,state:o,params:a}of i.targets)s.interaction?.animate(o,a,{change:t})}}}emitEventReverse(e,t){if(e==="keyDown"||e==="keyUp"||e==="mouseDown"||e==="mouseUp"||e==="mouseHover"||e==="scroll"||e==="start"){let r=this.events[e];if(r){for(let i of r)if("targets"in i)for(let{object:s,params:o}of i.targets){let a=s.interaction;a?._fromState!==void 0&&a.animate(a._fromState,o,{change:t})}}}}};var Ol=class{static create(e,t){if(e.object){let r=t.find(e.object);if(r?.interaction){let i=e.state?r.interaction.states.find(s=>s.uuid===e.state):r.interaction.states[0];if(i){let s=e.delay??0,o={cycle:e.cycle??!1,rewind:e.rewind??!1,repeat:e.repeat??!1,duration:e.duration??1e3,startOnceDelay:e.delayDirection==="start-once"?s:0,startDelay:e.delayDirection==="start"||!e.delayDirection?s:0,endDelay:e.delayDirection==="end"||!e.delayDirection?s:0,easing:e.easing??4,autoplay:!0};if(e.easing===5){let a=e;o.cubicControls={control1:[...a.control1],control2:[...a.control2]}}if(e.easing===6){let a=e;o.springParameters={mass:a.mass,stiffness:a.stiffness,damping:a.damping,velocity:a.velocity}}return new Ol(r,i,o)}}}}constructor(e,t,r){this.object=e,this.state=t,this.params=r}};var Nr=class{constructor(e){this.raycastState=e;this.domEventsNeeded=[]}init(e,t){}dispose(){}};var iv=new _,G_=new Ur,k_=new Re,Xf={type:"follow",normal:new _,raycaster:new Rs},Fl;(t=>{function n(r){if(r.type===10)return{type:"follow"}}t.create=n;function e({target:r,normal:i,raycaster:s,begin:o,change:a}){!r||!i||!s||(o&&o("follow",r.uuid),G_.setFromNormalAndCoplanarPoint(i,r.getWorldPosition(iv)),s.ray.intersectPlane(G_,iv),r.position.copy(iv),r.parent!==null&&r.position.applyMatrix4(k_.copy(r.parent.matrixWorld).invert()),r.position.applyMatrix4(k_.copy(r.hiddenMatrix).invert()),r.updateMatrix(),Ut(r)&&At(r.parent)&&r.invalidateDownstreamBooleanData(!0),a&&a())}t.listener=e})(Fl||(Fl={}));var Yf=class extends Nr{constructor(){super(...arguments);this.objects=[];this.onTouchMove=t=>{t.touches.length===1&&(this.raycastState.updateRaycaster(t),this.handleFollowEvent())};this.onMouseMove=t=>{this.raycastState.updateRaycaster(t),this.handleFollowEvent()}}init(t,r){let{scene:i,domElement:s}=this.raycastState;this.objects=[],Xf.change=r,i.traverseEntity(o=>{!o.interaction?.events.follow?.length||(o.addEventListener("follow",Fl.listener),this.objects.push(o))}),this.domEventsNeeded=[],this.objects.length&&(Kt?(this.domEventsNeeded.push("touchstart","touchmove"),s.addEventListener("touchstart",this.onTouchMove),s.addEventListener("touchmove",this.onTouchMove)):(this.domEventsNeeded.push("pointermove"),s.addEventListener("pointermove",this.onMouseMove)))}dispose(){let{domElement:t}=this.raycastState;this.objects.forEach(r=>{r.removeEventListener("follow",Fl.listener)}),this.objects=[],Kt?(t.removeEventListener("touchstart",this.onTouchMove),t.removeEventListener("touchmove",this.onTouchMove)):t.removeEventListener("pointermove",this.onMouseMove),this.domEventsNeeded=[]}handleFollowEvent(){let{normal:t,raycaster:r}=this.raycastState;Xf.normal=t,Xf.raycaster=r,this.objects.forEach(i=>i.dispatchEvent(Xf))}};var sv=new _,V_=new Ur,Qf={type:"lookAt",normal:new _,raycaster:new Rs},Ul;(t=>{function n(r){if(r.type===9&&r.distance)return{type:"lookAt",distance:r.distance}}t.create=n;function e({target:r,normal:i,raycaster:s,begin:o,change:a}){if(!r?.interaction?.events.lookAt?.length||!i||!s)return;o&&o("lookAt",r.uuid);let l=r.interaction.events.lookAt[0].distance;V_.set(i,-l),s.ray.intersectPlane(V_,sv),r.lookAt(sv),r.updateMatrix(),r.interaction.animation?.finished.then(()=>{r.lookAt(sv),r.updateMatrix(),Ut(r)&&At(r.parent)&&r.invalidateDownstreamBooleanData(!0)}),Ut(r)&&At(r.parent)&&r.invalidateDownstreamBooleanData(!0),a&&a()}t.listener=e})(Ul||(Ul={}));var Zf=class extends Nr{constructor(){super(...arguments);this.objects=[];this.onTouchMove=t=>{t.touches.length===1&&(this.raycastState.updateRaycaster(t),this._handleLookAtEvent())};this.onMouseMove=t=>{this.raycastState.updateRaycaster(t),this._handleLookAtEvent()}}init(t,r){let{scene:i,domElement:s}=this.raycastState;this.objects=[],Qf.change=r,i.traverseEntity(o=>{!o.interaction?.events.lookAt?.length||(o.addEventListener("lookAt",Ul.listener),this.objects.push(o))}),this.domEventsNeeded=[],this.objects.length&&(Kt?(this.domEventsNeeded.push("touchstart","touchmove"),s.addEventListener("touchstart",this.onTouchMove),s.addEventListener("touchmove",this.onTouchMove)):(this.domEventsNeeded.push("pointermove"),s.addEventListener("pointermove",this.onMouseMove)))}dispose(){let{domElement:t}=this.raycastState;this.objects.forEach(r=>{r.removeEventListener("lookAt",Ul.listener)}),this.objects=[],Kt?(t.removeEventListener("touchstart",this.onTouchMove),t.removeEventListener("touchmove",this.onTouchMove)):t.removeEventListener("pointermove",this.onMouseMove),this.domEventsNeeded=[]}_handleLookAtEvent(){let{normal:t,raycaster:r}=this.raycastState;Qf.normal=t,Qf.raycaster=r,this.objects.forEach(i=>{i.dispatchEvent(Qf)})}};var ov={type:"start"},zl;(t=>{function n(r){if(r.type===7)return{type:"start",targets:[]}}t.create=n;function e({target:r,begin:i,change:s}){if(!r?.interaction?.events.start?.length)return;i&&i("start",r.uuid);let o={change:s};r.interaction.events.start.forEach(a=>{a.targets.forEach(({object:l,state:u,params:c})=>l.interaction?.animate(u,c,o))})}t.listener=e})(zl||(zl={}));var Kf=class extends Nr{constructor(){super(...arguments);this.objects=[]}init(t,r){let{scene:i}=this.raycastState;this.objects=[],ov.begin=t,ov.change=r,i.traverseEntity(s=>{!s.interaction?.events.start?.length||(s.addEventListener("start",zl.listener),this.objects.push(s))}),this.objects.forEach(s=>{s.dispatchEvent(ov)})}dispose(){this.objects.forEach(t=>{t.removeEventListener("start",zl.listener)}),this.objects=[]}};var Jf={type:"scroll"},Gl;(t=>{function n(r){if(!(r.type!==11||r.steps===void 0))return{type:"scroll",targets:[],steps:r.steps}}t.create=n;function e({target:r,deltaY:i,begin:s,change:o}){if(!r?.interaction?.events.scroll?.length||!i)return;s&&s("scroll",r.uuid);let a={change:o},l=i>0?1:-1;r.interaction.events.scroll.forEach(u=>{u.targets.forEach(({object:c,state:h,params:d})=>{let f={...d,autoplay:!1};c.interaction?.seek(h,l,u.steps,f,a)})})}t.listener=e})(Gl||(Gl={}));var $f=class extends Nr{constructor(){super(...arguments);this.objects=[];this.onWheel=t=>{Jf.deltaY=t.deltaY,this.objects.forEach(r=>{r.dispatchEvent(Jf)})}}init(t,r){let{scene:i,domElement:s}=this.raycastState;this.objects=[],Jf.begin=t,Jf.change=r,i.traverseEntity(o=>{!o.interaction?.events.scroll?.length||(o.addEventListener("scroll",Gl.listener),this.objects.push(o))}),this.domEventsNeeded=[],this.objects.length&&(this.domEventsNeeded.push("wheel"),s.addEventListener("wheel",this.onWheel))}dispose(){let{domElement:t}=this.raycastState;this.objects.forEach(r=>{r.removeEventListener("scroll",Gl.listener)}),this.objects=[],t.removeEventListener("wheel",this.onWheel),this.domEventsNeeded=[]}};function vU(n,e){return n.distance-e.distance}function H_(n,e,t){if(Us(e)&&e.visible&&!e.raycastLock)e.raycast(n,t);else return;for(let r of e.children)H_(n,r,t)}function kl(n,e,t){if(!t.some(i=>Bo(n,i)!==void 0))return[];let r=[];return e.children.forEach(i=>H_(n,i,r)),r.sort(vU),r}function Vl(n,e){let t=[];if(n.length){let r=n[0].object;Us(r)&&r.interaction?.events[e]?.length&&t.push(r);let i=r.parent;for(;i;)cy(i)&&i.interaction?.events[e]?.length&&t.push(i),i=i.parent}return t}function Bo(n,e){if(Ut(e)){if(!e.raycastLock&&e.visible){let t=[];return e.raycast(n,t),t.length?t[0]:void 0}}else if(cy(e))return W_(n,e)}function W_(n,e){if(Ut(e)&&!e.raycastLock&&e.visible){let t=[];if(e.raycast(n,t),t.length)return t[0]}for(let t of e.children)if(Us(t)){let r=W_(n,t);if(r)return r}}function xU(n){if(n.style.transform!==""){let e=getComputedStyle(n).getPropertyValue("transform");if(e!=="none"){let t=e.replace("matrix(","").split(",");return{x:parseFloat(t[0]),y:parseFloat(t[3])}}}return{x:1,y:1}}function av(n){let e=n.getViewport(new Ve),t=xU(n.domElement);return{left:e.x*t.x,top:e.y*t.y,width:e.z*t.x,height:e.w*t.y}}var ep=class{constructor(e,t,r,i){this.renderer=e;this.scene=t;this.camera=r;this.stopRaycast=i;this.raycaster=new Rs;this.normal=new _;this.raycasterNeedsUpdate=!0;this.domElement=e.domElement,this.domRect=this.domElement.getBoundingClientRect(),this.viewRect=av(e)}getPointer(e,t){let r=this.domRect,i=this.viewRect,s=r.height-i.height,o=(e-i.left-r.left)*(r.width/i.width),a=(t-s+i.top-r.top)*(r.height/i.height);return{x:o/r.width*2-1,y:-(a/r.height)*2+1}}updateRaycaster(e){if(this.raycasterNeedsUpdate){let{clientX:t,clientY:r}=Kt?e.touches[0]:e;this.raycaster.setFromCamera(this.getPointer(t,r),this.camera),this.camera.getWorldDirection(this.normal),this.normal.negate(),this.raycasterNeedsUpdate=!1}}};var Hl={type:"mouseHover"},Wl;(t=>{function n(r){if(r.type===2)return{type:"mouseHover",targets:[]}}t.create=n;function e({target:r,begin:i,change:s,enter:o}){if(!r?.interaction?.events.mouseHover?.length||o===void 0)return;i&&i("mouseHover",r.uuid);let a={change:s};o?r.interaction.events.mouseHover.forEach(l=>{l.targets.forEach(({object:u,state:c,params:h})=>{u.interaction?.animate(c,h,a)})}):r.interaction.events.mouseHover.forEach(l=>{l.targets.forEach(({object:u,params:c})=>{let h=u.interaction;h?.fromState!==void 0&&h.animate(h.fromState,c,a)})})}t.listener=e})(Wl||(Wl={}));var tp=class extends Nr{constructor(){super(...arguments);this.objects=[];this._prevObjects=[];this.onTouchStart=t=>{t.touches.length===1&&(this.raycastState.updateRaycaster(t),this.handleMouseHoverEvent())};this.onTouchEnd=t=>{this.handleMouseHoverEvent(!0)};this.onTouchMove=t=>{t.touches.length===1&&(this.raycastState.updateRaycaster(t),this.handleMouseHoverEvent())};this.onMouseMove=t=>{this.raycastState.updateRaycaster(t),this.handleMouseHoverEvent()}}init(t,r){let{scene:i,domElement:s}=this.raycastState;this.objects=[],Hl.begin=t,Hl.change=r,i.traverseEntity(o=>{!o.visible||!o.interaction?.events.mouseHover?.length||(o.addEventListener("mouseHover",Wl.listener),this.objects.push(o))}),this.domEventsNeeded=[],this.objects.length&&(Kt?(this.domEventsNeeded.push("touchstart","touchend","touchmove"),s.addEventListener("touchstart",this.onTouchStart),s.addEventListener("touchend",this.onTouchEnd),s.addEventListener("touchmove",this.onTouchMove)):(this.domEventsNeeded.push("pointermove"),s.addEventListener("pointermove",this.onMouseMove)))}dispose(){let{domElement:t}=this.raycastState;this.objects.forEach(r=>{r.removeEventListener("mouseHover",Wl.listener)}),this.objects=[],Kt?(t.removeEventListener("touchstart",this.onTouchStart),t.removeEventListener("touchend",this.onTouchEnd),t.removeEventListener("touchmove",this.onTouchMove)):t.removeEventListener("pointermove",this.onMouseMove),this.domEventsNeeded=[]}handleMouseHoverEvent(t=!1){let r=[];if(!t){let{stopRaycast:i,raycaster:s,scene:o}=this.raycastState;if(i){let a=kl(s,o,this.objects);r=Vl(a,"mouseHover")}else this.objects.forEach(a=>{Bo(s,a)&&r.push(a)})}this._prevObjects.length&&(Hl.enter=!1,this._prevObjects.forEach(i=>{r.includes(i)||i.dispatchEvent(Hl)})),r.length&&(Hl.enter=!0,r.forEach(i=>{i.dispatchEvent(Hl)})),this._prevObjects=r}};var bU="text/plain",wU="us-ascii",j_=(n,e)=>e.some(t=>t instanceof RegExp?t.test(n):t===n),SU=(n,{stripHash:e})=>{let t=/^data:(?<type>[^,]*?),(?<data>[^#]*?)(?:#(?<hash>.*))?$/.exec(n);if(!t)throw new Error(`Invalid URL: ${n}`);let{type:r,data:i,hash:s}=t.groups,o=r.split(";");s=e?"":s;let a=!1;o[o.length-1]==="base64"&&(o.pop(),a=!0);let l=(o.shift()||"").toLowerCase(),c=[...o.map(h=>{let[d,f=""]=h.split("=").map(m=>m.trim());return d==="charset"&&(f=f.toLowerCase(),f===wU)?"":`${d}${f?`=${f}`:""}`}).filter(Boolean)];return a&&c.push("base64"),(c.length>0||l&&l!==bU)&&c.unshift(l),`data:${c.join(";")},${a?i.trim():i}${s?`#${s}`:""}`};function lv(n,e){if(e={defaultProtocol:"http:",normalizeProtocol:!0,forceHttp:!1,forceHttps:!1,stripAuthentication:!0,stripHash:!1,stripTextFragment:!0,stripWWW:!0,removeQueryParameters:[/^utm_\w+/i],removeTrailingSlash:!0,removeSingleSlash:!0,removeDirectoryIndex:!1,sortQueryParameters:!0,...e},n=n.trim(),/^data:/i.test(n))return SU(n,e);if(/^view-source:/i.test(n))throw new Error("`view-source:` is not supported as it is a non-standard protocol");let t=n.startsWith("//");!t&&/^\.*\//.test(n)||(n=n.replace(/^(?!(?:\w+:)?\/\/)|^\/\//,e.defaultProtocol));let i=new URL(n);if(e.forceHttp&&e.forceHttps)throw new Error("The `forceHttp` and `forceHttps` options cannot be used together");if(e.forceHttp&&i.protocol==="https:"&&(i.protocol="http:"),e.forceHttps&&i.protocol==="http:"&&(i.protocol="https:"),e.stripAuthentication&&(i.username="",i.password=""),e.stripHash?i.hash="":e.stripTextFragment&&(i.hash=i.hash.replace(/#?:~:text.*?$/i,"")),i.pathname){let o=/\b[a-z][a-z\d+\-.]{1,50}:\/\//g,a=0,l="";for(;;){let c=o.exec(i.pathname);if(!c)break;let h=c[0],d=c.index;l+=i.pathname.slice(a,d).replace(/\/{2,}/g,"/"),l+=h,a=d+h.length}l+=i.pathname.slice(a,i.pathname.length).replace(/\/{2,}/g,"/"),i.pathname=l}if(i.pathname)try{i.pathname=decodeURI(i.pathname)}catch{}if(e.removeDirectoryIndex===!0&&(e.removeDirectoryIndex=[/^index\.[a-z]+$/]),Array.isArray(e.removeDirectoryIndex)&&e.removeDirectoryIndex.length>0){let o=i.pathname.split("/"),a=o[o.length-1];j_(a,e.removeDirectoryIndex)&&(o=o.slice(0,-1),i.pathname=o.slice(1).join("/")+"/")}if(i.hostname&&(i.hostname=i.hostname.replace(/\.$/,""),e.stripWWW&&/^www\.(?!www\.)[a-z\-\d]{1,63}\.[a-z.\-\d]{2,63}$/.test(i.hostname)&&(i.hostname=i.hostname.replace(/^www\./,""))),Array.isArray(e.removeQueryParameters))for(let o of[...i.searchParams.keys()])j_(o,e.removeQueryParameters)&&i.searchParams.delete(o);if(e.removeQueryParameters===!0&&(i.search=""),e.sortQueryParameters){i.searchParams.sort();try{i.search=decodeURIComponent(i.search)}catch{}}e.removeTrailingSlash&&(i.pathname=i.pathname.replace(/\/$/,""));let s=n;return n=i.toString(),!e.removeSingleSlash&&i.pathname==="/"&&!s.endsWith("/")&&i.hash===""&&(n=n.replace(/\/$/,"")),(e.removeTrailingSlash||i.pathname==="/")&&i.hash===""&&e.removeSingleSlash&&(n=n.replace(/\/$/,"")),t&&!e.normalizeProtocol&&(n=n.replace(/^http:\/\//,"//")),e.stripProtocol&&(n=n.replace(/^(?:https?:)?\/\//,"")),n}var uv={type:"mouseDown"},hv={type:"mouseUp"},dv={type:"keyDown"},X_={type:"keyUp"},qs;(t=>{function n(r){let i,s;if(r.type===0)i={type:"mousedown"},s="mouseDown";else if(r.type===1)i={type:"mouseup"},s="mouseUp";else if(r.type===5){if(!r.key)return;i={type:"keydown",key:r.key},s="keyDown"}else if(r.type===6){if(!r.key)return;i={type:"keyup",key:r.key},s="keyUp"}else return;return{type:s,domEvent:i,targets:[],url:r.url??void 0,toggle:r.toggle??!1,enable:!1}}t.create=n;function e({target:r,interactionEvents:i,type:s,begin:o,change:a}){if(!r)return;i||(i=r.interaction?.events[s]),o&&o(s,r.uuid);let l={change:a};i.forEach(u=>{if(u.toggle){u.enable=!u.enable;for(let{object:c,state:h,params:d}of u.targets){let f=c.interaction;if(f!==void 0){let m={...d,cycle:!1,rewind:!1,repeat:!1};u.enable?f.animate(h,m,l):f.fromState!==void 0&&f.animate(f.fromState,m,l)}}}else u.targets.forEach(({object:c,state:h,params:d})=>c.interaction?.animate(h,d,l));if(u.url){let c=lv(u.url);Wc?window.location.assign(c):window.open(c,"_blank")}})}t.listener=e})(qs||(qs={}));var q_={keyDown:dv,keyUp:X_,mouseDown:uv,mouseUp:hv},cv={keyDown:qs.listener,keyUp:qs.listener,mouseDown:qs.listener,mouseUp:qs.listener};var rp=class extends Nr{constructor(){super(...arguments);this.map={};this.types=["mouseDown","mouseUp","keyDown","keyUp"];this.onTouchStart=t=>{t.touches.length===1&&(this.raycastState.updateRaycaster(t),this.handleMouseEvent("mouseDown"))};this.onTouchEnd=t=>{this.raycastState.updateRaycaster(t),this.handleMouseEvent("mouseUp")};this.onMouseDown=t=>{this.raycastState.updateRaycaster(t),this.handleMouseEvent("mouseDown")};this.onMouseUp=t=>{this.raycastState.updateRaycaster(t),this.handleMouseEvent("mouseUp")};this.onKeyDown=t=>{this.handleKeyEvent(t,"keyDown","keydown")};this.onKeyUp=t=>{this.handleKeyEvent(t,"keyUp","keyup")}}init(t,r){let{scene:i,domElement:s}=this.raycastState;this.map={};for(let o of this.types)q_[o].begin=t,q_[o].change=r;i.traverseEntity(o=>{!o.interaction||(o.visible&&["mouseDown","mouseUp"].forEach(a=>{o.interaction?.events[a]?.length&&(o.addEventListener(a,cv[a]),this.map[a]?this.map[a].push(o):this.map[a]=[o])}),["keyDown","keyUp"].forEach(a=>{o.interaction?.events[a]?.length&&(o.addEventListener(a,cv[a]),this.map[a]?this.map[a].push(o):this.map[a]=[o])}))}),this.domEventsNeeded=[],Kt?(this.map.mouseDown?.length&&(this.domEventsNeeded.push("touchstart"),s.addEventListener("touchstart",this.onTouchStart)),this.map.mouseUp?.length&&(this.domEventsNeeded.push("touchend"),s.addEventListener("touchend",this.onTouchEnd))):(this.map.mouseDown?.length&&(this.domEventsNeeded.push("pointerdown"),s.addEventListener("pointerdown",this.onMouseDown)),this.map.mouseUp?.length&&(this.domEventsNeeded.push("pointerup"),s.addEventListener("pointerup",this.onMouseUp))),this.map.keyDown?.length&&(this.domEventsNeeded.push("keydown"),document.addEventListener("keydown",this.onKeyDown)),this.map.keyUp?.length&&(this.domEventsNeeded.push("keyup"),document.addEventListener("keyup",this.onKeyUp))}dispose(){let{domElement:t}=this.raycastState;for(let r of this.types)this.map[r]?.forEach(i=>{i.removeEventListener(r,cv[r])});this.map={},Kt?(t.removeEventListener("touchstart",this.onTouchStart),t.removeEventListener("touchend",this.onTouchEnd)):(t.removeEventListener("pointerdown",this.onMouseDown),t.removeEventListener("pointerup",this.onMouseUp)),document.removeEventListener("keydown",this.onKeyDown),document.removeEventListener("keyup",this.onKeyUp),this.domEventsNeeded=[]}handleMouseEvent(t){let{stopRaycast:r,raycaster:i,scene:s}=this.raycastState;if(r){let o=this.map[t];if(o?.length){let a=kl(i,s,o);Vl(a,t).forEach(l=>l.dispatchEvent(t==="mouseDown"?uv:hv))}}else this.map[t]?.forEach(o=>{Bo(i,o)&&o.dispatchEvent(t==="mouseDown"?uv:hv)})}handleKeyEvent(t,r,i){this.map[r]?.forEach(s=>{dv.interactionEvents=s.interaction?.events?.keyDown?.filter(o=>o.domEvent.type===i&&o.domEvent.key===t.key),s.dispatchEvent(r==="keyDown"?dv:X_)})}};var jl;(t=>(t.isPlayable=r=>r.type==="audio"&&r.data.interaction==="play",t.create=function(r,i,s,o){if(!((i.trigger==="keyDown"||i.trigger==="keyUp")&&i.key===void 0))if(i.interaction==="play"){if(i.audio){let a=new Ci(r,i,s);return Ci.cache.set(r,a),a}}else return new fv(i,o)}))(jl||(jl={}));var Ci=class{constructor(e,t,r){this.id=e;this.type="audio";let{audio:i,volume:s,delay:o,loop:a}=t,l=typeof i=="string"?r.getAudio(i).src:i.data;this.audioPlayer=new Ws({src:l,volume:s,delay:o,loop:a}),this.data=t}dispatch(){this.data.toggle==="stop"?this.audioPlayer.isStarted?this.audioPlayer.stop():(this.audioPlayer.stop(),this.audioPlayer.play()):this.data.toggle==="pause"?this.audioPlayer.isStarted?this.audioPlayer.pause():this.audioPlayer.play():(this.audioPlayer.stop(),this.audioPlayer.play())}dispose(){this.audioPlayer.dispose()}};Ci.cache=new Map;var fv=class{constructor(e,t){this.type="audio";this.data=e,this.scene=t}dispatch(){this.data.object?this.data.audioEvent?this.pauseAudio(this.data.audioEvent):this.pauseAudiosByObject(this.data.object):this.pauseAudios()}pauseAudio(e){let t=Ci.cache.get(e),r=this.data.interaction;!t||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{t.audioPlayer[r](),this.disposeDelay()},this.data.delay)):t.audioPlayer[r]())}pauseAudiosByObject(e){let r=this.scene.find(e)?.interaction?.events.audio,i=this.data.interaction;if(!!r)if(this.data.delay>0)this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{for(let s of r)jl.isPlayable(s)&&s.audioPlayer[i]();this.disposeDelay()},this.data.delay);else for(let s of r)jl.isPlayable(s)&&s.audioPlayer[i]()}pauseAudios(){let e=this.data.interaction;if(this.data.delay>0)this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{for(let t of Ci.cache.values())t.audioPlayer[e]();this.disposeDelay()},this.data.delay);else for(let t of Ci.cache.values())t.audioPlayer[e]()}disposeDelay(){clearTimeout(this.timeoutId),delete this.timeoutId}dispose(){clearTimeout(this.timeoutId),delete this.timeoutId}},np=class extends Nr{constructor(){super(...arguments);this.heldKeys={};this.map={};this.startMap={};this.onStartMouseDown=()=>{this.startMap.mouseDown?.forEach(t=>t.dispatch()),this.raycastState.domElement.removeEventListener(Kt?"touchstart":"pointerdown",this.onStartAny)};this.onStartKeyDown=()=>{this.startMap.keyDown?.forEach(t=>t.dispatch()),document.removeEventListener("keydown",this.onStartAny)};this.onStartAny=()=>{this.startMap.any?.forEach(t=>t.dispatch()),this.raycastState.domElement.removeEventListener(Kt?"touchstart":"pointerdown",this.onStartAny),document.removeEventListener("keydown",this.onStartAny)};this.onMouseEvent=(t,r)=>{let i=this.map[r];if(i?.length){let{stopRaycast:s,raycaster:o,scene:a}=this.raycastState;if(this.raycastState.updateRaycaster(t),s){let l=kl(o,a,i);Vl(l,"audio").forEach(u=>this.dispatch(u,r))}else i.forEach(l=>{Bo(o,l)&&this.dispatch(l,r)})}};this.onMouseDown=t=>{this.onMouseEvent(t,"mouseDown")};this.onMouseUp=t=>{this.onMouseEvent(t,"mouseUp")};this.onKeyDown=t=>{let r=this.heldKeys[t.key];this.map.keyDown?.forEach(i=>{r||this.dispatch(i,"keyDown",t.key)}),this.heldKeys[t.key]=!0};this.onKeyUp=t=>{this.map.keyUp?.forEach(r=>this.dispatch(r,"keyUp",t.key))};this.releaseHeldKey=t=>{delete this.heldKeys[t.key]}}init(t,r){let{scene:i,domElement:s}=this.raycastState;this.map={},this.startMap={},this.heldKeys={},Ci.cache=new Map,i.traverseEntity(o=>{!o.interaction?.events.audio||o.interaction.events.audio.forEach(a=>{a.data.trigger==="start"&&(this.startMap[a.data.after]?.length?this.startMap[a.data.after].push(a):this.startMap[a.data.after]=[a]),o.visible&&["mouseDown","mouseUp"].forEach(l=>{a.data.trigger===l&&(this.map[l]?.length?this.map[l].push(o):this.map[l]=[o])}),["keyDown","keyUp"].forEach(l=>{a.data.trigger===l&&(this.map[l]?.length?this.map[l].push(o):this.map[l]=[o])})})}),this.domEventsNeeded=[],Kt?(this.startMap.mouseDown?.length&&s.addEventListener("touchstart",this.onStartMouseDown,{once:!0}),this.startMap.any?.length&&s.addEventListener("touchstart",this.onStartAny,{once:!0}),this.map.mouseDown?.length&&(this.domEventsNeeded.push("touchstart"),s.addEventListener("touchstart",this.onMouseDown)),this.map.mouseUp?.length&&(this.domEventsNeeded.push("touchend"),s.addEventListener("touchend",this.onMouseUp))):(this.startMap.mouseDown?.length&&s.addEventListener("pointerdown",this.onStartMouseDown,{once:!0}),this.startMap.any?.length&&s.addEventListener("pointerdown",this.onStartAny,{once:!0}),this.map.mouseDown?.length&&(this.domEventsNeeded.push("pointerdown"),s.addEventListener("pointerdown",this.onMouseDown)),this.map.mouseUp?.length&&(this.domEventsNeeded.push("pointerup"),s.addEventListener("pointerup",this.onMouseUp))),this.startMap.keyDown?.length&&document.addEventListener("keydown",this.onStartKeyDown,{once:!0}),this.startMap.any?.length&&document.addEventListener("keydown",this.onStartAny,{once:!0}),this.map.keyDown?.length&&(this.domEventsNeeded.push("keydown"),document.addEventListener("keydown",this.onKeyDown),document.addEventListener("keyup",this.releaseHeldKey)),this.map.keyUp?.length&&(this.domEventsNeeded.push("keyup"),document.addEventListener("keyup",this.onKeyUp))}dispose(){let{scene:t,domElement:r}=this.raycastState;t.traverseEntity(i=>{!i.interaction?.events.audio||i.interaction.events.audio.forEach(s=>{s.dispose()})}),this.map={},this.startMap={},this.heldKeys={},Ci.cache=new Map,Kt?(r.removeEventListener("touchstart",this.onStartMouseDown),r.removeEventListener("touchstart",this.onStartAny),r.removeEventListener("touchstart",this.onMouseDown),r.removeEventListener("touchend",this.onMouseUp)):(r.removeEventListener("pointerdown",this.onStartMouseDown),r.removeEventListener("pointerdown",this.onStartAny),r.removeEventListener("pointerdown",this.onMouseDown),r.removeEventListener("pointerup",this.onMouseUp)),r.removeEventListener("keyDown",this.onStartKeyDown),r.removeEventListener("keyDown",this.onStartAny),r.removeEventListener("keydown",this.onKeyDown),document.removeEventListener("keyup",this.releaseHeldKey),r.removeEventListener("keyup",this.onKeyUp),this.domEventsNeeded=[]}dispatch(t,r,i){let s=t.interaction?.events.audio;if(s)if(r==="keyDown"||r==="keyUp")for(let o of s)o.data.trigger===r&&o.data.key===i&&o.dispatch();else for(let o of s)o.data.trigger===r&&o.dispatch()}};function _U(n,e,t,r){let i,{type:s}=e;return s===10?i=Fl.create(e):s===0||s===1||s===5||s===6?i=qs.create(e):s===9?i=Ul.create(e):s===2?i=Wl.create(e):s===11?i=Gl.create(e):s===7?i=zl.create(e):s===12&&(i=jl.create(n,e,t,r)),i}function Q_(n,e,t){let r=[];n.objects.traverse((i,s)=>{let o=e.find(i);if(delete o.interaction,s.states===void 0)return;let a=new qf(o,t),l=a.states;l.push(Oo.create(i,s));for(let c of s.states){let h=eu.patch(s,c.data);l.push(Oo.create(c.id,h))}let u=a.events;if(s.events)for(let{id:c,data:h}of s.events){let d=_U(c,h,t,e);if(!d)continue;let f=d.type;u[f]?u[f].push(d):u[f]=[d],"targets"in h&&r.push([h,d])}(l.length>0||Object.keys(u).length>0)&&(o.interaction=a)});for(let[i,s]of r)if("targets"in i&&"targets"in s)for(let{data:o}of i.targets){let a=Ol.create(o,e);a&&s.targets.push(a)}}function Y_(n,e,t){typeof e!="string"&&n.reset(e,t)}function Z_(n,e,t,r,i=!1){if(!i&&e.states.length===0)return;let s=t===null?e:eu.patch(e,e.states.data(t));if(uy(n,s),n instanceof Pt&&s.type==="Mesh"){if(n instanceof Xs?n.buildFromStore(s.geometry):n.updateGeometry({parameters:s.geometry}),n.freeBooleanPointer(),At(n.parent)&&n.parent.invalidateDownstreamBooleanData().recomputeBoolean(),"material"in s){if(n.material instanceof Array)return;Y_(n.material,s.material,r)}else if("materials"in s){if(!(n.material instanceof Array))return;var o=0;for(let a of s.materials)Y_(n.material[o],a,r),o++}}else if(s.type==="DirectionalLight")n.fromDirectionalLightState(s,r);else if(s.type==="PointLight")n.fromPointLightState(s,r);else if(s.type==="SpotLight")n.fromSpotLightState(s,r);else if(n instanceof Yr&&Cs.is(s.type)){let a=s;n.setZoom("PerspectiveCamera",a.perspective.zoom),n.setZoom("OrthographicCamera",a.orthographic.zoom),n.isUpVectorFlipped=a.isUpVectorFlipped,n.targetOffset=a.targetOffset}}var Oo=class{constructor(e){this.objectState=e;this.uuid=Je.generateUUID()}static create(e,t){let r=new Oo(t);return r.uuid=e,r}execute(e,t){Z_(e,this.objectState,null,t,!0)}};var K_=["touchstart","touchend","touchmove","pointerdown","pointerup","pointermove"],ip=class{constructor(e,t,r,i,s){this.app=s;this.isEnable=!1;this.splineEvents={};this.handlers=[];this.onResetRaycaster=()=>{this.raycastState.raycasterNeedsUpdate=!0};this.begin=(e,t)=>{let r=this.splineEvents[e][t];if(r){let{domElement:i}=this.raycastState;i.dispatchEvent(r)}};this.change=()=>{this.app.requestRender()};this.raycastState=new ep(e,t,r,i),this.handlers=[new Kf(this.raycastState),new rp(this.raycastState),new tp(this.raycastState),new $f(this.raycastState),new Yf(this.raycastState),new Zf(this.raycastState),new np(this.raycastState)]}activate(){let{scene:e,domElement:t}=this.raycastState;this.isEnable=!0,e.traverseEntity(r=>{if(!r.interaction)return;r.interaction.start(),["start","keyDown","keyUp","mouseDown","mouseUp","mouseHover","scroll"].forEach(s=>this.addDOMCustomEvent(s,r))}),this.handlers.forEach(r=>r.init(this.begin,this.change)),K_.forEach(r=>{this.handlers.some(i=>i.domEventsNeeded.includes(r))&&t.addEventListener(r,this.onResetRaycaster)}),this.resize()}deactivate(){let{scene:e,domElement:t}=this.raycastState;this.isEnable=!1,e.traverseEntity(r=>{r.interaction?.end()}),this.handlers.forEach(r=>r.dispose()),K_.forEach(r=>{t.removeEventListener(r,this.onResetRaycaster)})}resize(){let{domElement:e,renderer:t}=this.raycastState;this.raycastState.domRect=e.getBoundingClientRect(),this.raycastState.viewRect=av(t)}addDOMCustomEvent(e,t){let r=new CustomEvent(e,{bubbles:!0});Object.defineProperty(r,"target",{writable:!1,value:{id:t.uuid,name:t.name}}),this.splineEvents[e]?this.splineEvents[e][t.uuid]=r:this.splineEvents[e]={[t.uuid]:r}}};var sp=class{constructor(e,t,r,i,s){this._aspect=1;this._renderer=e,this._camera=t,this._frameSize=new B().copy(r),this._editorSize=new B().copy(i),this._aspect=t.aspect,this._fov=s??t.fov}set frameSize(e){this._frameSize.copy(e)}updateRenderer(){!this._renderer||this._renderer.setSize(this._frameSize.x,this._frameSize.y)}updateViewportForImageExport(){if(!this._renderer||!this._camera||this._camera.cameraType!=="PerspectiveCamera")return;let e=this._frameSize.x,t=this._frameSize.y,r=this._editorSize.x,i=this._editorSize.y;this._aspect=e/t,this._camera.zoom*=Math.min(r/e,i/t),this._renderer.setViewport(0,0,e,t)}updateViewport(){if(!this._renderer||!this._camera||this._camera.cameraType!=="PerspectiveCamera")return;let e=this._frameSize.x,t=this._frameSize.y,r=this._editorSize.x,i=this._editorSize.y,s=0,o=0,a=e,l=t;e<r&&(s=(r-e)*.5,s=-s,a=r),t<i&&(o=(i-t)*.5,o=-o,l=i),this._aspect=a/l,this._renderer.setViewport(s,o,a,l)}updateCamera(){if(!!this._camera)if(this._camera.cameraType==="PerspectiveCamera"){let e=this._frameSize.y,t=this._editorSize.y,r=this._fov;if(e>t){let i=AU(e,1080,2160,1,15)/100;r*=e/t,r*=1-i}this._camera.aspect=this._aspect,this._camera.fov=r,this._camera.updateProjectionMatrix()}else this._camera.setViewplaneSize(this._frameSize.x,this._frameSize.y)}revert(){let e=window.innerWidth,t=window.innerHeight;this._renderer&&(this._renderer.setViewport(0,0,e,t),this._renderer.setSize(e,t)),this._camera&&(this._camera.aspect=e/t,this._camera.fov=this._fov,this._camera.setViewplaneSize(e,t),this._camera.updateProjectionMatrix())}};function AU(n,e,t,r,i){return(n-e)/(t-e)*(i-r)+r}var tA=xp($_());var pv;yf.then(n=>{pv=n});var rA=new Re,MU=new Re,TU=new Re,Zn=new br,Ys=new _,EU=new Re,CU=new Re,Xs=class extends Pt{constructor(t,r,i,s){super(i??r,s);this.subdivPointer=t;this.originalGeometry=r;this.subdividedGeometry=i;this.objectType="SubdivObject";this.hiddenMatrixOld=new Re;this.smoothShading=!0;this.phongAngle=35;this.matrixWorldRigid=new Re;this.castShadow=!0,this.receiveShadow=!0,this.forceComputeSize=!1}static createFromState(t,r,i){let{subdivPointer:s,originalGeometry:o,subdividedGeometry:a}=Dn.build(r.geometry,void 0,void 0,!r.flatShading),l=i.material(r.material),u=new Xs(s,o,a||void 0,l);return r.geometry.phongAngle!==void 0&&(u.phongAngle=r.geometry.phongAngle),u.calcBoundingBox(),u.freeSubdivPointer(),u.uuid=t,u.fromState(r),u}buildFromStore(t,r){let{originalGeometry:i,subdividedGeometry:s,subdivPointer:o}=Dn.build(t,r,this.subdivPointer,this.smoothShading,this.shearScale);t.phongAngle!==void 0&&(this.phongAngle=t.phongAngle),this.subdivPointer=o,i!==void 0&&(this.originalGeometry?.dispose(),this.originalGeometry=i),s!==void 0&&(this.subdividedGeometry?.dispose(),this.subdividedGeometry=s??void 0),this.geometry=this.subdividedGeometry??this.originalGeometry,Vs(this),Hs(this),t.width&&(this.geometry.userData.parameters={width:t.width,height:t.height,depth:t.depth})}updateMesh(t=!1){Dn.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1,this.originalGeometry,t?this.shearScaleInv:void 0),this.subdividedGeometry&&Dn.buildLevel(this.subdivPointer,!1,this.smoothShading?this.phongAngle:-1,this.subdividedGeometry,t?this.shearScaleInv:void 0)}updateTopology(){this.originalGeometry.dispose(),this.originalGeometry=Dn.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1),this.subdividedGeometry&&(this.subdividedGeometry.dispose(),this.subdividedGeometry=Dn.buildLevel(this.subdivPointer,!1,this.smoothShading?this.phongAngle:-1)),this.geometry=this.subdividedGeometry??this.originalGeometry}raycast(t,r){this.geometry=this.originalGeometry,Pt.prototype.raycast.call(this,t,r),this.geometry=this.subdividedGeometry??this.originalGeometry}updateMatrixWorldSVD(){let t=this.matrixWorld.elements,r=[[t[0],t[4],t[8]],[t[1],t[5],t[9]],[t[2],t[6],t[10]]],{u:i,v:s,q:o}=(0,tA.SVD)(r),a=rA.set(i[0][0],i[0][1],i[0][2],0,i[1][0],i[1][1],i[1][2],0,i[2][0],i[2][1],i[2][2],0,0,0,0,1),l=MU.set(s[0][0],s[0][1],s[0][2],0,s[1][0],s[1][1],s[1][2],0,s[2][0],s[2][1],s[2][2],0,0,0,0,1),u=TU.copy(l).transpose();this.shearScale=EU.makeScale(o[0],o[1],o[2]).multiply(u).premultiply(l),this.shearScaleInv=CU.copy(this.shearScale).invert(),this.matrixWorldRigid.multiplyMatrices(a,u),o.every(c=>Math.abs(o[0]-c)<.01)&&(this.shearScale=void 0,this.shearScaleInv=void 0)}activateSVDCompensation(){this.shearScale!==void 0&&(this.matrixAutoUpdate=!1,this.matrix.copy(this.matrixWorldRigid).copyPosition(this.matrixWorld),this.hiddenMatrixOld.copy(this.hiddenMatrix),this.hiddenMatrix.copy(this.parent.matrixWorld).invert())}deactivateSVDCompensation(){this.shearScale!==void 0&&(this.shearScale=void 0,this.shearScaleInv=void 0,this.matrixAutoUpdate=!0,this.hiddenMatrix.copy(this.hiddenMatrixOld))}calcBoundingBox(){let t=this.originalGeometry;t.boundingSphere===null&&(t.boundingSphere=new Dr);let r=t.attributes.position,i=t.boundingSphere.center;Zn.setFromBufferAttribute(r),Zn.getCenter(i),t.boundingSphere.radius=i.distanceTo(Zn.max),isNaN(t.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),Zn.getSize(Ys);let s={width:Ys.x,height:Ys.y,depth:Ys.z};return this.geometry.userData.parameters=s,s}updateBoundingBox(t){let r=this.originalGeometry;Zn.min.set(t[0],t[2],t[4]),Zn.max.set(t[1],t[3],t[5]),this.shearScaleInv&&(Zn.min.applyMatrix4(this.shearScaleInv),Zn.max.applyMatrix4(this.shearScaleInv)),r.boundingSphere===null&&(r.boundingSphere=new Dr);let i=r.boundingSphere.center;Zn.getCenter(i),r.boundingSphere.radius=i.distanceTo(Zn.max),isNaN(r.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),Zn.getSize(Ys);let s={width:Ys.x,height:Ys.y,depth:Ys.z};return this.geometry.userData.parameters=s,s}freeSubdivPointer(){this.subdivPointer&&(pv.free_bvh(this.subdivPointer),pv.free_subdivision_surface(this.subdivPointer),this.subdivPointer=0)}updateGeometry(t){this.geometry.userData.scale||(this.geometry.userData.scale=Array(3)),this.geometry.userData.scale[0]=this.geometry.userData.parameters.width===0?1:t.parameters.width/this.geometry.userData.parameters.width,this.geometry.userData.scale[1]=this.geometry.userData.parameters.height===0?1:t.parameters.height/this.geometry.userData.parameters.height,this.geometry.userData.scale[2]=this.geometry.userData.parameters.depth===0?1:t.parameters.depth/this.geometry.userData.parameters.depth,eA(this.originalGeometry.attributes,...this.geometry.userData.scale),this.originalGeometry.attributes.position.needsUpdate=!0,this.originalGeometry.attributes.normal.needsUpdate=!0,this.subdividedGeometry&&(eA(this.subdividedGeometry.attributes,...this.subdividedGeometry.userData.scale),this.subdividedGeometry.attributes.position.needsUpdate=!0,this.subdividedGeometry.attributes.normal.needsUpdate=!0),this.geometry.userData.parameters={...t.parameters}}};function eA(n,e,t,r){let i=n.position.array,s=n.normal.array,o=rA.makeScale(e,t,r).invert().elements,a,l,u;for(var c=0,h=i.length;c<h;c+=3)i[c]*=e,i[c+1]*=t,i[c+2]*=r,a=s[c],l=s[c+1],u=s[c+2],s[c]=o[0]*a+o[4]*l+o[8]*u,s[c+1]=o[1]*a+o[5]*l+o[9]*u,s[c+2]=o[2]*a+o[6]*l+o[10]*u}function nA(n,e){e.flatShading!==void 0&&(n.flatShading=e.flatShading,n.needsUpdate=!0),e.wireframe!==void 0&&(n.wireframe=e.wireframe),e.side!==void 0&&(e.side===0?n.side=Gi:e.side===1?n.side=vr:n.side=xr)}function PU(n,e){if(Array.isArray(n.material))for(let t of n.material)nA(t,e);else{let t=n.material;nA(t,e)}n.objectType==="SubdivObject"&&e.flatShading!==void 0&&(n.material.flatShading=!1,n.smoothShading=!e.flatShading,n.updateMesh())}function iA(n,e,t){let r;if(e.geometry.type==="SubdivGeometry")r=Xs.createFromState(n,e,t);else{let i=e.geometry.type==="BooleanGeometry"?new De:Cf(e.geometry,t),s="materials"in e?e.materials.map(o=>t.material(o)):t.material(e.material);$d.is2DParametricMesh(i.userData.type)?r=new Bf(i,s):i?.userData.type==="VectorGeometry"?r=new Ml(i,s):e.geometry.type==="NonParametricGeometry"?r=new Of(i,s):e.geometry.type==="BooleanGeometry"?(r=new Df(void 0,s),r.booleanOp=e.geometry.operation,e.geometry.phongAngle!==void 0&&(r.phongAngle=e.geometry.phongAngle)):r=new Bl(i,s),r.uuid=n,r.fromState(e,t)}return PU(r,e),r}function sA(n,e,t){return e.type==="Mesh"?iA(n,e,t):e.type==="TextFrame"?Ro.createFromState(n,e,t):e.type==="Empty"?Io.createFromState(n,e):e.type==="PointLight"?Ll.createFromState(n,e,t):e.type==="SpotLight"?Rl.createFromState(n,e,t):e.type==="DirectionalLight"?Il.createFromState(n,e,t):Cs.is(e.type)?Yr.createFromState(n,e):(console.error(e),new Io)}function oA(n,e){let t=!1,r=e.getLayersOfType("transmission"),i=e.getLayersOfType("outline");return i.length>0&&(n.layers.set(8),r.length>0&&n.layers.enable(3),t=!0,Hs(n),Vs(n)),r.length===0&&i.length===0&&n.layers.set(0),t}function aA(n,e){if(!e.layers)return!1;let t=!1,r=e.getLayersOfType("transmission"),i=e.getLayersOfType("outline");return r.length>0&&(n.layers.set(3),i.length>0&&n.layers.enable(8),t=!0),r.length===0&&i.length===0&&n.layers.set(0),t}function lA(n){let e=!1;return n.traverseEntity(t=>{if(t instanceof kt&&t.objectType!=="TextFrame")if(Array.isArray(t.material))for(let r=0;r<t.material.length;r++)oA(t,t.material[r])&&(e=!0);else oA(t,t.material)&&(e=!0)}),e}function cA(n){let e=!1;return n.traverseEntity(t=>{if(t instanceof kt)if(Array.isArray(t.material))for(let r=0;r<t.material.length;r++)aA(t,t.material[r])&&(e=!0);else aA(t,t.material)&&(e=!0)}),e}function uA(n){"material"in n&&DU(n.material),"geometry"in n&&n.geometry.dispose()}function DU(n){Hw(n).forEach(e=>{e instanceof No||e.dispose()})}var IU=new Sa,LU=new Re,RU=new ki;function hA(n,e,t){let r=n.cloner;if(r)for(let i of r.children){let s=LU.copy(i.matrixWorld).invert(),o=RU.copy(e.ray).applyMatrix4(s),a=n.matrixWorld;o.applyMatrix4(a);let l=IU;l.set(o.origin,o.direction),l.near=e.near,l.far=e.far,l.intersectObject(n,!1).length>0&&t.push({object:n})}}var dA=new _,mv=class extends xf(Vr){constructor(t,r){super();this.objectType="Scene";this.backupFog=new ua(16777215,.1,2e3);this.fogUseBGColor=!1;this.enableHelpers=!1;this.wireframeState=!1;this.needsTransmissionDirty=!0;this.needsNormalDirty=!0;this._needsTransmission=!1;this._needsNormal=!1;this.bgColor=new dr(1,1,1,1);this.entityByUuid={};this.ambientLight=new go(13882323,8553090,.75),this.ambientLight.name="Default Ambient Light",this.ambientLight.layers.enable(3),this.personalCamera=this.createPersonalCamera(),this.activeCamera=this.personalCamera,this.postprocessing=t.postprocessing,this.init(t,r)}needsTransmission(){return this.needsTransmissionDirty&&(this._needsTransmission=cA(this),this.needsTransmissionDirty=!1),this._needsTransmission}needsNormal(){return this.needsNormalDirty&&(this._needsNormal=lA(this),this.needsNormalDirty=!1),this._needsNormal}find(t){if(t===""||t===void 0)return;let r=this.entityByUuid[t];return r===void 0?this.getObjectByProperty("uuid",t):r}get enableFog(){return this.fog!==null}set enableFog(t){this.fog=t===!0?this.backupFog:null}init(t,r){if(this.createChildrenObjects(t.objects,this,r),this.personalCamera.removeFromParent(),this.add(this.personalCamera),this.ambientLight.removeFromParent(),this.add(this.ambientLight),this.setBackgroundColor(or(t.backgroundColor,r)),this.updateFog(t.fog,r),this.updateAmbientLight(t.environment.ambientLight,r),this.activeCamera=this.personalCamera,t.publish.playCamera!==null){let i=this.find(t.publish.playCamera);i instanceof Yr&&this.switchActiveCamera(i)}this.traverse(i=>{At(i)&&i.recomputeBoolean()})}clearScene(){this.traverseEntity(t=>{uA(t)});for(let t of this.children)gi(t)&&t.removeFromParent()}resetAfterClear(t,r){this.init(t,r)}createPersonalCamera(){let t=Yr.createFromState(mv.PERSONAL_CAMERA_ID,{...tf.defaultData,name:"Personal Camera"});return t.objectHelper.visible=!1,delete t.isEntity,this.registerObjectCreatedInLegacy(t),t}raycast(t){let r=[],i=s=>{for(let o of s.children)gi(o)&&!o.raycastLock&&o.visible&&((Ut(o)||vf(o)&&this.enableHelpers&&o.objectHelper.visible)&&(t.intersectObject(o,!1,r),hA(o,t,r)),i(o))};return i(this),r}traverseEntity(t){for(let r of this.children)gi(r)&&r.traverseEntity(t)}traverseVisibleEntity(t){for(let r of this.children)gi(r)&&r.visible&&r.traverseVisibleEntity(t)}updateFog(t,r){this.enableFog=t.enabled,this.fogUseBGColor=t.useBackgroundColor,t.useBackgroundColor?this.backupFog.color.set(this.bgColor):this.backupFog.color=or(t.color,r),this.backupFog.near=t.near,this.backupFog.far=t.far}dispose(){this.clearScene()}updateAmbientLight(t,r){M1(this.ambientLight,t,r),t.groundColor!==void 0&&(this.ambientLight.groundColor=or(t.groundColor,r)),t.enabled!==void 0&&(this.ambientLight.visible=t.enabled)}switchActiveCamera(t){this.activeCamera!==this.personalCamera&&(this.activeCamera.objectHelper.visible=!0),this.activeCamera=t,t.objectHelper.visible=!1}setBackgroundColor(t){this.bgColor=t,this.fogUseBGColor===!0&&(this.backupFog.color=t)}createChildrenObjects(t,r,i){for(let s of t)this.createChildObject(s.id,s.data,s.children,r,i)}registerObjectCreatedInLegacy(t){this.entityByUuid[t.uuid]=t}unregisterObject(t){delete this.entityByUuid[t.uuid];for(let r of t.children)this.unregisterObject(r)}createChildObject(t,r,i,s,o){let a=sA(t,r,o);return a&&(this.entityByUuid[t]=a,s.add(a),At(s)&&Ut(a)&&(a.prevBooleanObjectParent=s),this.createChildrenObjects(i,a,o)),a}getCenter(t){let r=[];for(let s=0,o=t.length;s<o;++s){let{id:a,recursive:l}=t[s],u=this.find(a),c=l?u.recursiveBBox:u.singleBBox;r.push(...c.vertices)}let i=new br;return i.setFromPoints(r),i.getCenter(dA),dA}copyMatrixWorld(t,r){if(t===null){r.identity();return}let i=this.find(t);i?r.copy(i.matrixWorld):r.identity()}copyParentMatrixWorld(t,r){if(t===null){r.identity();return}let i=this.find(t)?.parent;i?r.copy(i.matrixWorld):r.identity()}traverseMaterial(t){this.traverseEntity(r=>{if(r instanceof Pt)if(Array.isArray(r.material))for(let i=0;i<r.material.length;i++)r.material[i]instanceof vn&&t(r.material[i]);else r.material instanceof vn&&t(r.material)})}updateCanvasSize(t,r){this.activeCamera.setViewplaneSize(t,r);let i,s;t>=r?(i=r/t,s=1):(i=1,s=t/r),this.traverseMaterial(o=>{o.getLayersOfType("transmission").forEach(l=>{l.uniforms[`f${l.id}_aspectRatio`].value.x=i,l.uniforms[`f${l.id}_aspectRatio`].value.y=s})})}},ku=mv;ku.PERSONAL_CAMERA_ID="f23858d0-4a3b-4bd8-8173-66ed0af7f6fb-personalCamera";var ap=class extends ku{constructor(e,t){super(e,t)}dispose(){super.dispose()}};var xA={RED:0,GREEN:1,BLUE:2,ALPHA:3};var Vu="varying vec2 vUv;void main(){vUv=position.xy*0.5+0.5;gl_Position=vec4(position.xy,1.0,1.0);}";var NU=`#ifdef FRAMEBUFFER_PRECISION_HIGH
package/build/runtime.js CHANGED
@@ -4902,7 +4902,7 @@ float contrastDepth = (gl_FragCoord.z - 0.5) * depthContrast + 0.5;
4902
4902
  vec3 resultColor = mix(mix(vColor, normal, 0.2), vec3(contrastDepth), 0.4);
4903
4903
  gl_FragColor = vec4(resultColor, vColor.r);
4904
4904
  }
4905
- `,Tf=new ht({vertexShader:uF,fragmentShader:hF,uniforms:{depthContrast:{value:1}}});function dF(n){if(n.geometry.attributes.extrudeNormal||!n.geometry.attributes.position)return;let e=new Map,t=n.geometry.attributes.position.array,r=n.geometry.attributes.normal.array,i=new Float32Array(t.length);for(let s=0;s<t.length;s+=3){let o=`${t[s]}_${t[s+1]}_${t[s+2]}`,a=new _(r[s],r[s+1],r[s+2]);e.has(o)?e.get(o)?.normals.push(a):e.set(o,{normals:[a],result:new _})}e.forEach((s,o)=>{for(let a of s.normals)s.result.add(a);s.result.divideScalar(s.normals.length)});for(let s=0;s<t.length;s+=3){let o=`${t[s]}_${t[s+1]}_${t[s+2]}`,a=e.get(o)?.result;a&&(i[s]=a.x,i[s+1]=a.y,i[s+2]=a.z)}n.geometry.setAttribute("extrudeNormal",new Se(i,3))}function fF(n){if(n.geometry.attributes.extrudeNormals||!n.geometry.attributes.position)return;let e=n.geometry.attributes.position.array,t=new Float32Array(e.length),r=new _;for(let i=0;i<e.length;i+=3)r.set(e[i],e[i+1],e[i+2]).normalize(),t[i]=r.x,t[i+1]=r.y,t[i+2]=r.z;n.geometry.setAttribute("extrudeNormal",new Se(t,3))}function Vs(n){if(n.objectType!=="TextFrame"){if(Array.isArray(n.material)){for(let e of n.material)if(e.getLayersOfType("outline").length===0)return}else if(!(n.material instanceof vn)||n.material.getLayersOfType("outline").length===0)return;n.objectType==="Mesh2D"?fF(n):dF(n)}}function Hs(n){if(!n.geometry.attributes.position)return;let e=n.geometry.attributes.position.array,t=new Float32Array(e.length),r=parseInt(n.uuid.replace(/\D/g,"")),i=[Je.seededRandom(r),Je.seededRandom(r+1e4),Je.seededRandom(r+2e4)];for(let s=0;s<e.length;s++)t[s]=i[s%3];n.geometry.setAttribute("randomColor",new je(t,3))}var Pt=class extends Cn(kt){constructor(t,r){super(t,r);this.isAbstractMesh=!0;this.booleanMeshSetAddress=-1;this.booleanWasTransformed=!1;this.booleanMatrixInvOld=new Re;this.booleanExclude=null;Array.isArray(r)&&t.groups.length===0&&t.addGroup(0,t.getAttribute("position").count,0)}get isGroup(){return this._cloner?.parameters.hideBase===!0}get isMesh(){return!this.isGroup}set isMesh(t){}get cloner(){return this._cloner}set cloner(t){this._cloner&&this.remove(this._cloner),t&&this.add(t),this._cloner=t}updateGeometry(t){let r=this.geometry,i=Dy[r.userData.type],s=this.objectType==="NonParametric"?Object.assign({},r.userData,{geometry:r}):r.userData,o=i.build(i.normalizeInputs(t,s)),a=r.uuid;this.geometry.dispose(),this.geometry=o,this.geometry.uuid=a,this.geometry.computeBoundingSphere(),Vs(this),r.getAttribute("randomColor")&&Hs(this)}clone(t){let r=this.objectType==="NonParametric"?Object.assign({},this.geometry.userData,{geometry:this.geometry.clone()}):this.geometry.userData,i=Fu(r),s=this.material;return new this.constructor(i,s).copy(this,t)}copy(t,r=!0){return super.copy(t,r),t.cloner&&(this.cloner=new fu(t,t.cloner.parameters),this.add(this.cloner)),this}setFromClonerState(t){t===null?this.cloner=void 0:(this.cloner===void 0&&(this.cloner=new fu(this)),this.cloner.fromClonerState(t))}fromState(t,r){return super.fromState(t),t.type==="Mesh"&&(this.setFromClonerState(t.cloner),this.castShadow=t.castShadow??!0,this.receiveShadow=t.receiveShadow??!0,this.booleanExclude=t.booleanExclude??null),this}freeBooleanPointer(){this.booleanMeshSetAddress!==-1&&(Xn.freeMeshSet(this.booleanMeshSetAddress),this.booleanMeshSetAddress=-1)}invalidateDownstreamBooleanData(t=!1){return t?this.booleanWasTransformed=!0:this.freeBooleanPointer(),At(this.parent)?this.parent.invalidateDownstreamBooleanData():this}invalidateUpstreamBooleanData(){this.freeBooleanPointer();for(let t of this.children)Ut(t)&&(t.freeBooleanPointer(),At(t)&&t.invalidateUpstreamBooleanData())}};var pF=new _(0,0,1),O1=new _,F1=new _,U1=new Gt,Ml=class extends Pt{constructor(t=qr.create({}),r){super(t,r);this.recursiveSelection=!1;this.objectType="VectorObject";this.eventDispatcher=new Bt;this._onShapeUpdate=()=>{this.updateGeometry({}),this.geometry.computeBoundingSphere(),this.geometry.computeBoundingBox()};this.castShadow=!0,this.receiveShadow=!0,this.forceComputeSize=!0,this.shape=t.userData.shape,this.shape.eventDispatcher?.addEventListener("update",this._onShapeUpdate)}fromState(t){return super.fromState(t),this.shape.update(),this}setHelperVisibility(){}updateGeometry(t){if(super.updateGeometry(t),"userData"in this.geometry){let r=this.geometry.userData.parameters;this.eventDispatcher.dispatchEvent({type:"geometryUpdate",parameters:r})}}setShape(t){this.shape&&this.shape.eventDispatcher?.removeEventListener("update",this._onShapeUpdate),this.shape=t,this.shape.eventDispatcher?.addEventListener("update",this._onShapeUpdate)}updateWorldMatrix(t,r){super.updateWorldMatrix(t,r),U1.getNormalMatrix(this.matrixWorld),O1.copy(pF).applyMatrix3(U1).normalize(),F1.setFromMatrixPosition(this.matrixWorld),this.shape.plane.setFromNormalAndCoplanarPoint(O1,F1)}clone(t){let r=this.shape.clone(),i=this.material,s=this.geometry.userData,o=qr.create(Object.assign({},s,{shape:r})),a=new Ml(o,i).copy(this,t);return a.shape=r,r.update(),a}raycast(t,r){Pt.prototype.raycast.call(this,t,r)}};function Ef(n,e){return mF(n)}function mF(n){let e={parameters:n,type:n.type};if(n.type==="VectorGeometry"){let r=vt.createFromState(n.shape,n.width,n.height);e.shape=r}else n.type==="NonParametricGeometry"&&(n.data.groups&&n.data.groups.forEach(r=>r.materialIndex=Math.max(r.materialIndex??0,0)),e.geometry=new wa().parse(n));let t;try{t=Fu(e)}catch(r){console.error(r)}if(!t){let r=vt.createFromState(nl.defaultData(),100,100);e.shape=r,t=Fu(e)}return t}var He;gf.then(n=>{He=n});var z1=new Float32Array([10,10,0,-10,10,0,-10,-10,0,10,-10,0]),G1=new Uint32Array([0,1,2,3]),k1=new Uint8Array([4]),Dn=class{static build(n,e,t,r,i){let s,o,a,l=n?.phongAngle??e?.phongAngle??35;if(r===!1&&(l=-1),n.positionWASM!==void 0){t&&t!==0&&(He.free_bvh(t),He.free_subdivision_surface(t));try{s=Dn.allocate(n,i)}catch(u){console.error(u,n),s=Dn.allocate({positionWASM:z1,indexWASM:G1,verticesPerFaceWASM:k1},i)}He.set_destination_refinement_level(s,0),o=Dn.buildLevel(s,!0,l)}else s=t,n.phongAngle!==void 0&&(o=Dn.buildLevel(s,!0,l));return n.subdivisions!==void 0&&(He.set_destination_refinement_level(s,n.subdivisions),n.subdivisions>0?a=Dn.buildLevel(s,!1,l):a=null),{subdivPointer:s,originalGeometry:o,subdividedGeometry:a}}static primitiveToQuads(n,e){n.widthSegments>16&&(n.widthSegments=16),n.heightSegments>16&&(n.heightSegments=16),n.depthSegments>16&&(n.depthSegments=16),n.radialSegments>16&&(n.radialSegments=16),n.type==="DodecahedronGeometry"&&(n.detail=0);let t=n.shape!==void 0?e.geometry:Ef(n),r,i,s,o;({positions:r,triIndices:o}=Ny(t.getAttribute("position"),t.getIndex()));let a;if(n.type==="CylinderGeometry"&&n.cornerRadius===0&&n.hollow===0&&n.openEnded===!1){let l=n.radialSegments*n.heightSegments*3*2,u=l+n.radialSegments*3;a=[l,u]}return{indices:i,verticesPerFace:s}=By(r,o,t,a),{positions:r,indices:i,verticesPerFace:s}}static allocate(n,e){let t,r,i,s=[],o=[];n.positionWASM&&n.positionWASM.length>0?(t=n.positionWASM,r=n.indexWASM,i=n.verticesPerFaceWASM):(t=z1,r=G1,i=k1);let a=t.length,l=r.length,u=i.length,c=t.length+s.length+o.length,h=r.length+i.length,d=c*Float32Array.BYTES_PER_ELEMENT+h*Uint32Array.BYTES_PER_ELEMENT,f=c*Float32Array.BYTES_PER_ELEMENT,m=h*Uint32Array.BYTES_PER_ELEMENT,p=He._malloc(d),g=new Float32Array(He.HEAPF32.buffer,p,c),y=new Uint32Array(He.HEAPU32.buffer,p+f,h);g.set(t,0),g.set(s,t.length),g.set(o,t.length+s.length),y.set(r,0),y.set(i,r.length);let x;n?.scaleBaked?.some(b=>b!==1)&&(x=new Re().makeScale(...n.scaleBaked)),e&&(x?x.premultiply(e):x=e);let w=x?He.alloc_subdivision_surface2(p,a,p+f,l,p+f+r.length*Uint32Array.BYTES_PER_ELEMENT,u,x.elements):He.alloc_subdivision_surface(p,a,p+f,l,p+f+r.length*Uint32Array.BYTES_PER_ELEMENT,u);return He._free(p),w}static buildLevel(n,e,t,r,i){let s=i?He.get_mesh_data2(n,e?He.Level.CONTROL:He.Level.REFINED,t,i.elements):He.get_mesh_data(n,e?He.Level.CONTROL:He.Level.REFINED,t),o=8,a=He.HEAPU32.subarray(s>>2,(s>>2)+o),l=a.subarray(4,4+4),u=0,c=He.HEAPU32[a[u]>>2],h=He.HEAPF32.subarray(c>>2,(c>>2)+l[u]);u++;let d=He.HEAPU32[a[u]>>2],f=He.HEAPF32.subarray(d>>2,(d>>2)+l[u]);u++;let m=He.HEAPU32[a[u]>>2],p=He.HEAPU32.subarray(m>>2,(m>>2)+l[u]);u++;let g=He.HEAPU32[a[u]>>2],y=He.HEAPU32.subarray(g>>2,(g>>2)+l[u]);if(u++,r===void 0){let x=new De;if(x.setIndex(new ds(y,1)),x.setAttribute("position",new Se(h,3)),x.setAttribute("normal",new Se(f,3)),e){x.setAttribute("faceMap",new ds(p,1));let w=new Float32Array(f.length/3*4).fill(0);x.setAttribute("color",new je(w,4))}return He.free_mesh_data(s),x.userData.type="SubdivGeometry",x}r.getAttribute("position").copyArray(h),r.getAttribute("normal").copyArray(f),r.attributes.position.needsUpdate=!0,r.attributes.normal.needsUpdate=!0,He.free_mesh_data(s)}static buildControlCageWireframe(n,e,t){let r=He.get_wireframe_data_for_base_level(n),i=4,s=He.HEAPU32.subarray(r>>2,(r>>2)+i),o=s.subarray(2,2+2),a=0,l=He.HEAPU32[s[a]>>2],u=He.HEAPF32.subarray(l>>2,(l>>2)+o[a]);a++;let c=He.HEAPU32[s[a]>>2],h=He.HEAPU32.subarray(c>>2,(c>>2)+o[a]);if(e===void 0){let d=new De;d.setAttribute("position",new Se(u,3));let f=new Float32Array(u.length);for(let m=0,p=u.length;m<p;)f[m++]=t.r,f[m++]=t.g,f[m++]=t.b;return d.setAttribute("color",new je(f,3)),d.setIndex(new ds(h,1)),He.free_wireframe_data_for_base_level(r),d}e.getAttribute("position").copyArray(u),e.attributes.position.needsUpdate=!0,He.free_wireframe_data_for_base_level(r)}static updateCollabMesh(n,e,t){let r=e===0;r||He.set_destination_refinement_level(n,e);let i=t?He.get_topological_data2(n,r?He.Level.CONTROL:He.Level.REFINED,t.elements):He.get_topological_data(n,r?He.Level.CONTROL:He.Level.REFINED),s=6,o=He.HEAPU32.subarray(i>>2,(i>>2)+s),a=o.subarray(3,3+3),l=0,u=He.HEAPU32[o[l]>>2],c=new Float32Array(He.HEAPF32.subarray(u>>2,(u>>2)+a[l]));l++;let h=He.HEAPU32[o[l]>>2],d=new Uint32Array(He.HEAPU32.subarray(h>>2,(h>>2)+a[l]));l++;let f=He.HEAPU32[o[l]>>2],m=new Uint8Array(He.HEAPU32.subarray(f>>2,(f>>2)+a[l]));return He.free_topological_data(i),{positions:c,indices:d,verticesPerFace:m}}};var V1=["getX","getY","getZ"];function Ny(n,e){let t={},r=e?e.count:n.count,i=0,s=[],o=[],a=1e4;for(let u=0;u<r;u++){let c=e?e.getX(u):u,h="";for(let d=0;d<3;d++)h+=`${~~(n[V1[d]](c)*a)},`;if(h in t)s.push(t[h]);else{for(let d=0;d<3;d++)o.push(n[V1[d]](c));t[h]=i,s.push(i),i++}}let l=[];for(let u=0;u<s.length;u+=3)s[u]===s[u+1]||s[u]===s[u+2]||s[u+1]===s[u+2]||l.push(s[u],s[u+1],s[u+2]);return{positions:o,triIndices:l}}var Cf=new _,Iy=new _,Ly=new _,Ry=new _;function By(n,e,t,r){let i=[],s=[];if(t.userData.shape!==void 0&&t.userData.parameters.depth===0&&t.userData.shape.shapeHoles.length===0){let o=t.userData.shape.extractShapePointsToFlatArray([]),a=0;for(let u=0;u<o.length;u+=2)a+=(o[u]-o[(u===0?o.length:u)-2])*(o[u+1]+o[(u===0?o.length:u)-1]);n.length=0;let l=0;if(a<0)for(let u=0;u<o.length;u+=2)n.push(o[u],o[u+1],0),i.push(l++);else for(let u=o.length-2;u>=0;u-=2)n.push(o[u],o[u+1],0),i.push(l++);return s.push(l),{indices:i,verticesPerFace:s}}for(let o=0,a=t.capStartIndex??e.length;o<a;)if(e[o+1]===e[o+3]&&e[o+2]===e[o+5]||e[o+0]===e[o+3]&&e[o+2]===e[o+4]){Cf.set(n[e[o]*3],n[e[o]*3+1],n[e[o]*3+2]),Iy.set(n[e[o+1]*3],n[e[o+1]*3+1],n[e[o+1]*3+2]),Ly.set(n[e[o+4]*3],n[e[o+4]*3+1],n[e[o+4]*3+2]),Ry.set(n[e[o+5]*3],n[e[o+5]*3+1],n[e[o+5]*3+2]),Iy.sub(Cf).normalize(),Ly.sub(Cf).normalize(),Ry.sub(Cf).normalize();let l=Iy.cross(Ly).dot(Ry);Math.abs(l)>.005||r&&r.some((u,c)=>c%2===1?!1:o>=r[c]&&o<r[c+1])?(i.push(e[o],e[o+1],e[o+2]),s.push(3),o+=3):(i.push(e[o],e[o+1],e[o+4],e[o+5]),s.push(4),o+=6)}else i.push(e[o],e[o+1],e[o+2]),s.push(3),o+=3;if(t.capStartIndex!==void 0){let o=[],a=[],l=0;for(let u=0,c=0;u<n.length;u+=3,c++)n[u+2]===0&&(o.push(c),l++),n[u+2]===t.userData.parameters.depth&&a.push(c);if(t.userData.parameters.extrudeBevelSize===0){let u=a[0];a[0]=a[1],a[1]=u}o.reverse(),i.push(...o,...a),s.push(l,l)}return{indices:i,verticesPerFace:s}}var Xn={};jA(Xn,{calcBoolean:()=>vF,calcBooleanTopological:()=>yF,freeMeshSet:()=>wF,getMeshSet:()=>xF,transformMeshSet:()=>bF});var W1,j1=new Promise(n=>{W1=n}),H1=!1;async function q1(){if(H1)return;let e=!1?".":"https://unpkg.com/@splinetool/boolean-wasm@0.9.94/build",[t,r]=await Promise.all([import("./boolean.js"),fetch(`${e}/boolean.wasm`).then(o=>o.arrayBuffer())]),s=await t.default({wasmBinary:r});W1(s),H1=!0}var st,Tl;j1.then(n=>st=n);function gF(n,e){let t,{positions:r,triIndices:i}=Ny(n.getAttribute("position"),n.getIndex()),s;if(e){let{indices:o,verticesPerFace:a}=By(r,i,n);s=a.length,t=[];for(let l=0,u=0;l<s;l++){t.push(a[l]);for(let c=0;c<a[l];c++)t.push(o[u++])}}else{let o=i.length;t=Array(o+o/3),s=0;for(let a=0,l=0;l<t.length;)t[l++]=3,s++,t[l++]=i[a++],t[l++]=i[a++],t[l++]=i[a++]}return{positions:r,faceIndices:t,nFaces:s}}function X1(n){let e=n.length,t=e*Uint32Array.BYTES_PER_ELEMENT,r=e*Float32Array.BYTES_PER_ELEMENT,i=Number.isInteger(n[0])?t:r,s=st._malloc(i);return(Number.isInteger(n[0])?new Uint32Array(st.HEAPU32.buffer,s,e):new Float32Array(st.HEAPF32.buffer,s,e)).set(n,0),s}function Y1(n){switch(n){case 0:return st.OP.UNION;case 1:return st.OP.INTERSECTION;case 2:return st.OP.A_MINUS_B;case 3:return st.OP.B_MINUS_A;case 4:return st.OP.SYMMETRIC_DIFFERENCE;case 5:return st.OP.ALL;default:throw new Error("Unknown boolean operation "+n)}}function yF(n,e){Tl===void 0&&(Tl=st.init_csg());let t=X1(n),r=st.csg_calc_topological(Tl,t,n.length,Y1(e));st._free(t);let i=6,s=st.HEAPU32.subarray(r>>2,(r>>2)+i),o=s.subarray(3,3+3),a=0,l=st.HEAPU32[s[a]>>2],u=new Float32Array(st.HEAPF32.subarray(l>>2,(l>>2)+o[a]));a++;let c=st.HEAPU32[s[a]>>2],h=new Uint32Array(st.HEAPU32.subarray(c>>2,(c>>2)+o[a]));a++;let d=st.HEAPU32[s[a]>>2],f=new Uint8Array(st.HEAPU32.subarray(d>>2,(d>>2)+o[a]));return st.free_mesh_data(r),{positions:u,indices:h,verticesPerFace:f}}function vF(n,e,t,r){Tl===void 0&&(Tl=st.init_csg());let i=X1(n),s=st.csg_calc(Tl,i,n.length,r,Y1(e));st._free(i);let o=5,a=st.HEAPU32.subarray(s>>2,(s>>2)+o),l=a.subarray(2,2+3),u=0,c=st.HEAPU32[a[u]>>2],h=st.HEAPF32.subarray(c>>2,(c>>2)+l[u]);u++;let d=st.HEAPU32[a[u]>>2],f=st.HEAPF32.subarray(d>>2,(d>>2)+l[u]);u++;let m=l[u];t.setAttribute("position",new Se(h,3)),t.setAttribute("normal",new Se(f,3));let p=st.HEAPF32.subarray((s>>2)+5,(s>>2)+5+6);return t.boundingSphere===null&&(t.boundingSphere=new Dr),t.boundingSphere.center.set(p[0],p[1],p[2]),t.boundingSphere.radius=(p[3]**2+p[4]**2+p[5]**2)**.5,t.userData.parameters={width:p[3]*2,height:p[4]*2,depth:p[5]*2},st.free_mesh_data(s),m}function xF(n,e){if(st===void 0)return-1;let t,r,i;if(e&&n.userData.positions!==void 0){let p=n.userData;i=p.verticesPerFace.length,t=p.positions,r=Array(p.verticesPerFace.reduce((g,y)=>g+y,0)+i);for(let g=0,y=0,x=0;g<p.verticesPerFace.length;g++){r[x++]=p.verticesPerFace[g];for(let w=0;w<p.verticesPerFace[g];w++)r[x++]=p.indices[y++]}}else({positions:t,faceIndices:r,nFaces:i}=gF(n,e));let s=t.length,o=r.length,a=t.length,l=r.length,u=a*Float32Array.BYTES_PER_ELEMENT+l*Uint32Array.BYTES_PER_ELEMENT,c=a*Float32Array.BYTES_PER_ELEMENT,h=l*Uint32Array.BYTES_PER_ELEMENT,d=st._malloc(u),f=new Float32Array(st.HEAPF32.buffer,d,a),m=new Uint32Array(st.HEAPU32.buffer,d+c,l);return f.set(t,0),m.set(r,0),st.get_csg_mesh(d,s,d+c,o,i)}function bF(n,e){st.transform_csg_mesh(n,e.elements)}function wF(n){st.free_csg_mesh(n)}var Dy={ConeGeometry:LS,CubeGeometry:RS,CylinderGeometry:IS,DodecahedronGeometry:NS,EllipseGeometry:r1,HelixGeometry:o1,IcosahedronGeometry:a1,LatheGeometry:l1,NonParametricGeometry:c1,PolygonGeometry:u1,PyramidGeometry:h1,RectangleGeometry:d1,SphereGeometry:f1,PlaneGeometry:p1,BackdropGeometry:m1,StarGeometry:g1,TextFrameGeometry:mf,TorusGeometry:y1,TorusKnotGeometry:v1,TriangleGeometry:x1,VectorGeometry:qr},Fu=n=>Dy[n.type].create(n);var Q1=new Re;function Oy(n){let e=!1;return n.scene.objects.traverse((t,r)=>{r.geometry?.type==="BooleanGeometry"&&(e=!0)}),e}var Pf=class extends Pt{constructor(t=new De,r){super(t,r);this.booleanOp=2;this.phongAngle=35;this.meshSetAddresses=[];this.needsTransformForDownstream=!1;this.objectType="BooleanObject",this.castShadow=!0,this.receiveShadow=!0,this.geometry.userData.parameters={width:0,height:0,depth:0},this.onAfterRender=this.recomputeBoolean.bind(this)}reInit(){this.objectType="BooleanObject",this.meshSetAddresses=[],this.needsTransformForDownstream=!1,this.geometry.userData.parameters={width:0,height:0,depth:0},this.onAfterRender=this.recomputeBoolean.bind(this)}recomputeBoolean(t){if(this.booleanMeshSetAddress!==-1)return;for(let i=0;i<this.children.length;i++){let s=this.children[i];At(s)&&s.recomputeBoolean(t===!0)}this.meshSetAddresses=[];for(let i=0;i<this.children.length;i++){let s=this.children[i];if(T1(s)&&s.booleanExclude===!1&&s.geometry.attributes.position?.count>0&&s.geometry.drawRange.count>0){if(s.booleanMeshSetAddress===-1){if(s.booleanMeshSetAddress=Xn.getMeshSet(s.geometry,t===!0),s.booleanMeshSetAddress===-1)return;Xn.transformMeshSet(s.booleanMeshSetAddress,s.matrix),s.booleanMatrixInvOld.copy(s.matrix).invert(),s.booleanWasTransformed=!1}else At(s)&&s.needsTransformForDownstream===!0?(Xn.transformMeshSet(s.booleanMeshSetAddress,s.matrix),s.needsTransformForDownstream=!1):s.booleanWasTransformed===!0&&(Q1.multiplyMatrices(s.matrix,s.booleanMatrixInvOld),Xn.transformMeshSet(s.booleanMeshSetAddress,Q1),s.booleanMatrixInvOld.copy(s.matrix).invert(),s.booleanWasTransformed=!1);this.meshSetAddresses.push(s.booleanMeshSetAddress)}}if(this.meshSetAddresses.length===0){this.geometry.setDrawRange(0,0);return}if(t===!0)return Xn.calcBooleanTopological(this.meshSetAddresses,this.booleanOp);let r=this.geometry;r.dispose(),this.geometry=new De,this.geometry.userData=r.userData,this.geometry.boundingSphere=r.boundingSphere;try{this.booleanMeshSetAddress=Xn.calcBoolean(this.meshSetAddresses,this.booleanOp,this.geometry,this.phongAngle)}catch(i){this.booleanMeshSetAddress=0,console.error(i)}this.booleanMatrixInvOld.copy(this.matrix).invert(),this.needsTransformForDownstream=!0,Vs(this),Hs(this)}updateGeometry(t){let r=t.parameters;r.operation!==void 0&&(this.booleanOp=r.operation),r.phongAngle!==void 0&&(this.phongAngle=r.phongAngle),this.invalidateDownstreamBooleanData().recomputeBoolean()}};var _i=n=>{var e;return e=class extends n{constructor(){super(...arguments);this.isObjectHelper=!0}},e.geometryHelper=new Zr(30,30,30),e};var Df=new ki,Fy=new Dr,Z1=new Re,Ai=(n,e,t,r,i=!1)=>{let s=e,o=n.matrixWorld;if(s.boundingSphere===null&&s.computeBoundingSphere(),Fy.copy(s.boundingSphere),Fy.applyMatrix4(o),t.ray.intersectsSphere(Fy)===!1||(Z1.copy(o).invert(),Df.copy(t.ray).applyMatrix4(Z1),s.boundingBox!==null&&Df.intersectsBox(s.boundingBox)===!1))return;let a,l,u,c,h=s.index,d=s.attributes.position,f=s.drawRange,m,p;if(i===!1){let y=Math.max(0,f.start),x=Math.min(h.count,f.start+f.count);for(m=y,p=x;m<p;m+=3)if(l=h.getX(m),u=h.getX(m+1),c=h.getX(m+2),a=g(n,t,Df,d,l,u,c),a){a.faceIndex=Math.floor(m/3),r.push(a);return}}else{let x=s.attributes.position,w=new _,b=new _,S=new _,A=new _,M=2,T=1/((n.scale.x+n.scale.y+n.scale.z)/3),E=T*T,C=Math.max(0,f.start),L=Math.min(x.count,f.start+f.count);for(let N=C,R=L-1;N<R;N+=M){if(w.fromBufferAttribute(x,N),b.fromBufferAttribute(x,N+1),Df.distanceSqToSegment(w,b,A,S)>E)continue;A.applyMatrix4(n.matrixWorld);let j=t.ray.origin.distanceTo(A);j<t.near||j>t.far||r.push({distance:j,point:S.clone().applyMatrix4(n.matrixWorld),object:n})}}function g(y,x,w,b,S,A,M){let v=new _,T=new _,E=new _,C=new _,L=new _;if(v.fromBufferAttribute(b,S),T.fromBufferAttribute(b,A),E.fromBufferAttribute(b,M),w.intersectTriangle(v,T,E,!1,C)===null)return null;L.copy(C),L.applyMatrix4(y.matrixWorld);let R=x.ray.origin.distanceTo(L);return R<x.near||R>x.far?null:{faceIndex:1,distance:R,point:L.clone(),object:y}}};var If=new _,In=new Un,Uy=class extends ps{constructor(t){let r=new De,i=new wn({color:16777215,vertexColors:!0,toneMapped:!1}),s=[],o=[],a={},l=new Oe(15711266),u=new Oe(15711266),c=new Oe(2857471);h("n1","n2",l),h("n2","n4",l),h("n4","n3",l),h("n3","n1",l),h("f1","f2",l),h("f2","f4",l),h("f4","f3",l),h("f3","f1",l),h("n1","f1",l),h("n2","f2",l),h("n3","f3",l),h("n4","f4",l),h("p","n1",u),h("p","n2",u),h("p","n3",u),h("p","n4",u),h("u1","u2",c),h("u2","u3",c),h("u3","u1",c);function h(f,m,p){d(f,p),d(m,p)}function d(f,m){s.push(0,0,0),o.push(m.r,m.g,m.b),a[f]===void 0&&(a[f]=[]),a[f].push(s.length/3-1)}r.setAttribute("position",new Se(s,3)),r.setAttribute("color",new Se(o,3));super(r,i);this.type="CameraHelper",this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update()}update(){let t=this.geometry,r=this.pointMap,i=!0;In.projectionMatrixInverse.elements=[.5112609807824982,-0,-0,-0,-0,.41421356237309503,-0,-0,-0,-0,-0,-.099999,-0,-0,-1.0000000000000002,.100001];let s=1,o=1,a=i?.8:1e-4;Yn("n1",r,t,In,-s,-o,a),Yn("n2",r,t,In,s,-o,a),Yn("n3",r,t,In,-s,o,a),Yn("n4",r,t,In,s,o,a);let l=a;Yn("f1",r,t,In,-s,-o,l),Yn("f2",r,t,In,s,-o,l),Yn("f3",r,t,In,-s,o,l),Yn("f4",r,t,In,s,o,l);let u=l,c=.5;Yn("u1",r,t,In,s*.7*c,o*1.1,u),Yn("u2",r,t,In,-s*.7*c,o*1.1,u),Yn("u3",r,t,In,0,o*(1.1+.9*c),u),t.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}};function Yn(n,e,t,r,i,s,o){If.set(i,s,o).unproject(r);let a=e[n];if(a!==void 0){let l=t.getAttribute("position");for(let u=0,c=a.length;u<c;u++)l.setXYZ(a[u],If.x,If.y,If.z)}}var Lf=class extends _i(Uy){constructor(t){super(t);this.object=t;this.object=t,this.name=`CombinedCameraHelper: ${t.uuid}`}updateMatrixWorld(t){super.updateMatrixWorld(t),this.updateTarget()}updateTarget(){let t=this.object.getTarget();this.updateWorldMatrix(!0,!1),this.worldToLocal(t)}raycast(t,r){Ai(this.object,this.geometry,t,r,!0)}};var El=class extends _i(Gh){constructor(t,r=15,i=10066329){super(t,r,i);this.object=t;this.added=!1;this.name=`DirectionalLightHelper: ${t.uuid}`}raycast(t,r){Ai(this.object,El.geometryHelper,t,r)}};var Cl=class extends _i(kh){constructor(t,r=15){super(r);this.object=t;this.object.updateMatrixWorld(),this.name=`EmptyObjectHelper: ${t.uuid}`,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1}raycast(t,r){Ai(this.object,Cl.geometryHelper,t,r)}update(){}};var Pl=class extends _i(zh){constructor(t,r=15,i=6710886){super(t,r,i);this.object=t;this.name=`PointLightHelper: ${t.uuid}`}raycast(t,r){Ai(this.object,Pl.geometryHelper,t,r)}};var Rf=class extends _i(Uh){constructor(t,r=6710886){super(t,r);this.object=t;this.name=`SpotLightHelper: ${t.uuid}`}raycast(t,r){Ai(this.object,Rf.geometryHelper,t,r)}update(){if(this.object!==void 0){let t=Rf._vector,r=this.object.distance?this.object.distance:1e3,i=r*Math.tan(this.object.angle);this.cone.scale.set(i,i,r),t.setFromMatrixPosition(this.object.target.matrixWorld),this.cone.lookAt(t);let s=this.color!==void 0?this.color:this.light.color;if(this.cone.material instanceof Array)for(let o=0,a=this.cone.material.length;o<a;o++)this.cone.material[o].color.set(s);else this.cone.material.color.set(s)}}},Uu=Rf;Uu._vector=new _;var Mi=(n,e)=>class extends n{constructor(){super(...arguments);this.objectHelper=new e(this)}get geometryHelper(){return e.geometryHelper}raycast(i,s){this.objectHelper.raycast(i,s)}fromLightState(i,s){if(this.objectType==="LightDirectional"||this.objectType==="LightPoint"||this.objectType==="LightSpot"){let o=this;i.color!==void 0&&(o.color=or(i.color,s)),i.intensity!==void 0&&(o.intensity=i.intensity),i.depth!==void 0&&(o.shadow.camera.far=i.depth,o.shadow.needsUpdate=!0),i.shadows!==void 0&&(this.castShadow=i.shadows)}return this}};var Dl=new _,zy=new _,Yr=class extends Mi(Cn(Un),Lf){constructor(t=window.innerWidth,r=window.innerHeight,i=45,s,o=1e5){super();this.objectType="CombinedCamera";this._cameraType="OrthographicCamera";this.targetOffset=So.DefaultTargetOffset;this.isUpVectorFlipped=!1;this.angleOffsetFromUp=0;this.width=t,this.height=r,this.orthoCamera=new ca(t*-.5,t*.5,r*.5,r*-.5,s??-5e4,o),this.perspCamera=new Zt(i,t/r,s??50,o),this.left=this.orthoCamera.left,this.right=this.orthoCamera.right,this.top=this.orthoCamera.top,this.bottom=this.orthoCamera.bottom,this.far=this.orthoCamera.far,this.view=this.orthoCamera.view,this.aspect=this.perspCamera.aspect,this.fov=this.perspCamera.fov,this.focus=this.perspCamera.focus,this.filmGauge=this.perspCamera.filmGauge,this.filmOffset=this.perspCamera.filmOffset,this.toOrthographic()}static createFromState(t,r){let i=new Yr().fromState(r);return i.objectHelper.update(),i.uuid=t,i}get isPerspectiveCamera(){return this.cameraType==="PerspectiveCamera"}get isOrthographicCamera(){return!this.isPerspectiveCamera}get cameraType(){return this._cameraType}setNear(t,r){t==="PerspectiveCamera"?this.perspCamera.near=r:this.orthoCamera.near=r}setZoom(t,r){r>=0&&(t==="PerspectiveCamera"?this.perspCamera.zoom=r:this.orthoCamera.zoom=r)}set cameraType(t){t==="PerspectiveCamera"?this.toPerspective():t==="OrthographicCamera"&&this.toOrthographic()}get near(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.near:this.orthoCamera.near}set near(t){this._cameraType==="PerspectiveCamera"?this.perspCamera.near=t:this.orthoCamera.near=t}get zoom(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom:this.orthoCamera.zoom}set zoom(t){t>=0&&(this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom=t:this.orthoCamera.zoom=t)}lookAt(t){super.lookAt(t),this.getWorldPosition(Dl),this.targetOffset=Dl.distanceTo(t)}getTarget(t=new _){return this.getWorldDirection(zy),this.getWorldPosition(Dl),zy.multiplyScalar(this.targetOffset),t.copy(Dl).add(zy),t}getDistanceToTarget(){let t=this.getTarget();return this.getWorldPosition(Dl),Dl.distanceTo(t)}updateUp(){let t=this.getWorldQuaternion(new qt),r=new _(0,0,1).applyQuaternion(t),i=new _().copy(ot.DefaultUp);this.isUpVectorFlipped&&i.negate(),i.applyQuaternion(t);let s=new _().copy(ot.DefaultUp).projectOnPlane(r),o=new _().crossVectors(s,i).dot(r)>=0?1:-1;this.angleOffsetFromUp=s.angleTo(i)*o}getViewFrontToObject(t){let r=t.getWorldPosition(new _),s=t.getWorldDirection(new _).multiplyScalar(this.targetOffset);return{position:r.clone().add(s),target:r}}getViewToObject(t){let r=t.getWorldPosition(new _),s=this.getWorldDirection(new _).multiplyScalar(this.targetOffset);return{position:r.clone().sub(s),target:r}}setViewplaneSize(t,r){this.left=-t*.5,this.right=t*.5,this.top=r*.5,this.bottom=-r*.5,this.aspect=t/r,this.updateProjectionMatrix()}toOrthographic(){this.orthoCamera.left=this.left,this.orthoCamera.right=this.right,this.orthoCamera.top=this.top,this.orthoCamera.bottom=this.bottom,this.orthoCamera.view=this.view,this.orthoCamera.far=this.far,this.orthoCamera.updateProjectionMatrix(),this.projectionMatrix=this.orthoCamera.projectionMatrix,this.projectionMatrixInverse=this.orthoCamera.projectionMatrixInverse,this._cameraType="OrthographicCamera",this.objectHelper&&this.objectHelper.update()}toPerspective(){this.perspCamera.aspect=this.aspect,this.perspCamera.fov=this.fov,this.perspCamera.view=this.view,this.perspCamera.far=this.far,this.perspCamera.updateProjectionMatrix(),this.projectionMatrix=this.perspCamera.projectionMatrix,this.projectionMatrixInverse=this.perspCamera.projectionMatrixInverse,this._cameraType="PerspectiveCamera",this.objectHelper&&this.objectHelper.update()}setFocalLength(t){this.perspCamera.setFocalLength(t),this.toPerspective()}getFocalLength(){return this.perspCamera.getFocalLength()}getEffectiveFOV(){return this.perspCamera.getEffectiveFOV()}getFilmWidth(){return this.perspCamera.getFilmWidth()}getFilmHeight(){return this.perspCamera.getFilmHeight()}setViewOffset(t,r,i,s,o,a){this._cameraType==="PerspectiveCamera"?this.perspCamera.setViewOffset(t,r,i,s,o,a):this.orthoCamera.setViewOffset(t,r,i,s,o,a)}clearViewOffset(){this._cameraType==="PerspectiveCamera"?(this.perspCamera.clearViewOffset(),this.toPerspective()):(this.orthoCamera.clearViewOffset(),this.toOrthographic())}updateProjectionMatrix(){this._cameraType==="PerspectiveCamera"?this.toPerspective():this._cameraType==="OrthographicCamera"&&this.toOrthographic()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,r){super.updateWorldMatrix(t,r),this.matrixWorldInverse.copy(this.matrixWorld).invert()}copy(t,r){return super.copy(t,r),this.orthoCamera.copy(t.orthoCamera),this.perspCamera.copy(t.perspCamera),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.far=t.far,this.view=t.view===null?null:Object.assign({},t.view),this._cameraType=t._cameraType,this.aspect=t.aspect,this.fov=t.fov,this.focus=t.focus,this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this.targetOffset=t.targetOffset,this.updateProjectionMatrix(),this}toCameraState(t=[]){let r={type:this.cameraType,far:this.far,orthographic:{near:this.orthoCamera.near,zoom:this.orthoCamera.zoom},perspective:{near:this.perspCamera.near,fov:this.perspCamera.fov,zoom:this.perspCamera.zoom},up:this.up.toArray(),targetOffset:this.targetOffset,isUpVectorFlipped:this.isUpVectorFlipped};return Ja(r,t)}fromCameraState(t){let{orthographic:r,perspective:i}=t;return t.type!==void 0&&(this.cameraType=t.type),t.far!==void 0&&(this.far=t.far),r!==void 0&&(r.near!==void 0&&(this.orthoCamera.near=r.near),r.zoom!==void 0&&(this.orthoCamera.zoom=r.zoom)),i!==void 0&&(i.near!==void 0&&(this.perspCamera.near=i.near),i.fov!==void 0&&(this.perspCamera.fov=i.fov),i.zoom!==void 0&&(this.perspCamera.zoom=i.zoom)),t.up!==void 0&&this.up.fromArray(t.up),t.targetOffset!==void 0&&(this.targetOffset=t.targetOffset),t.isUpVectorFlipped!==void 0&&(this.isUpVectorFlipped=t.isUpVectorFlipped),this.updateProjectionMatrix(),this}toState(t){return{...super.toState(t),...this.toCameraState(t),type:this.cameraType}}fromState(t){return super.fromState(t),this.fromCameraState(t),this}};var Io=class extends Mi(Cn(ss),Cl){constructor(){super(...arguments);this.objectType="EmptyObject"}static createFromState(t,r){let i=new Io().fromState(r);return i.uuid=t,i.objectHelper.update(),i}};var Il=class extends Mi(Cn(Bh),El){constructor(...t){super(...t);this.objectType="LightDirectional";this._gizmos={};this.castShadow=!0,this.shadow.mapSize.width=2048,this.shadow.mapSize.height=2048,this.shadow.normalBias=1,this.layers.enable(3);let i=this.shadow.camera;i.top=1250,i.bottom=-1250,i.right=1250,i.left=-1250,i.near=-1e4,i.far=2500;let s=new _n(this.shadow.camera);s.visible=!1,this._gizmos.shadowmap=s,this.update()}static createFromState(t,r,i){let s=new Il().fromState(r,i);return s.uuid=t,s}get gizmos(){return this._gizmos}showGizmos(){for(let t in this._gizmos){let r=this._gizmos[t];r instanceof _n&&(r.visible=!0)}}hideGizmos(){for(let t in this._gizmos){let r=this._gizmos[t];r instanceof _n&&(r.visible=!1)}}update(){this.shadow.camera.updateProjectionMatrix();for(let t in this._gizmos){let r=this._gizmos[t];r instanceof _n&&r.update()}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.objectHelper&&this.objectHelper.update()}fromDirectionalLightState(t,r){let i=t.depth!==void 0&&t.depth!==this.shadow.camera.far||t.size!==void 0&&t.size/2!==this.shadow.camera.right;return super.fromLightState(t,r),t.size!==void 0&&_1(this,t.size),t.shadowRadius!==void 0&&(this.shadow.radius=t.shadowRadius),t.shadowResolution!==void 0&&(this.shadow.mapSize.set(t.shadowResolution,t.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null)),i&&this.update(),this}fromState(t,r){return super.fromState(t),this.fromDirectionalLightState(t,r),this}};var Ll=class extends Mi(Cn(Nh),Pl){constructor(...t){super(...t);this.objectType="LightPoint";this._gizmos={};this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024,this.shadow.normalBias=1,this.layers.enable(3);let i=this.shadow.camera;i.fov=90,i.aspect=1,i.near=100,i.far=2500;let s=new _(-i.far+this.position.x,-i.far+this.position.y,-i.far+this.position.z),o=new _(i.far+this.position.x,i.far+this.position.y,i.far+this.position.z),a=new br(s,o),l=new yo(a,new Oe(16755200));l.visible=!1,this._gizmos.shadowmap=l,this.update()}static createFromState(t,r,i){let s=new Ll().fromState(r,i);return s.uuid=t,s}get gizmos(){return this._gizmos}showGizmos(){for(let t in this._gizmos){let r=this._gizmos[t];r instanceof yo&&(r.visible=!0)}}hideGizmos(){for(let t in this._gizmos){let r=this._gizmos[t];r instanceof yo&&(r.visible=!1)}}update(){if(this.shadow&&(this.shadow.camera.updateProjectionMatrix(),this._gizmos))for(let t in this._gizmos){let r=this._gizmos[t];if(r instanceof yo){let i=this.shadow.camera,s=new _(-i.far+this.position.x,-i.far+this.position.y,-i.far+this.position.z),o=new _(i.far+this.position.x,i.far+this.position.y,i.far+this.position.z);r.box.set(s,o),r.updateMatrixWorld(!0)}}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.objectHelper&&this.objectHelper.update()}fromPointLightState(t,r){return super.fromLightState(t,r),t.distance!==void 0&&(this.distance=t.distance),t.decay!==void 0&&(this.decay=t.decay),t.shadowRadius!==void 0&&(this.shadow.radius=t.shadowRadius),t.shadowResolution!==void 0&&(this.shadow.mapSize.set(t.shadowResolution,t.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null)),this}fromState(t,r){return super.fromState(t),this.fromPointLightState(t,r),this}};var K1=new _,J1=new _,$1=new qt,Rl=class extends Mi(Cn(Rh),Uu){constructor(...t){super(...t);this.objectType="LightSpot";this._gizmos={};this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024,this.shadow.normalBias=1,this.layers.enable(3);let i=this.shadow.camera;i.fov=Je.RAD2DEG*2*this.angle,i.aspect=1,i.near=100,i.far=2500;let s=new _n(this.shadow.camera);s.visible=!1,this._gizmos.shadowmap=s,this.update()}static createFromState(t,r,i){let s=new Rl().fromState(r,i);return s.uuid=t,s}get gizmos(){return this._gizmos}showGizmos(){for(let t in this._gizmos){let r=this._gizmos[t];r instanceof _n&&(r.visible=!0)}}hideGizmos(){for(let t in this._gizmos){let r=this._gizmos[t];r instanceof _n&&(r.visible=!1)}}update(){this.shadow.camera.updateProjectionMatrix();for(let t in this._gizmos){let r=this._gizmos[t];r instanceof _n&&r.update()}}updateMatrixWorld(t){super.updateMatrixWorld(t),J1.setFromMatrixPosition(this.matrixWorld),$1.setFromRotationMatrix(this.matrixWorld),K1.copy(this.up).applyQuaternion($1).negate().multiplyScalar(this.distance),this.target.position.copy(J1).add(K1),this.target.updateMatrixWorld(),this.objectHelper&&this.objectHelper.update()}fromSpotLightState(t,r){return super.fromLightState(t,r),t.distance!==void 0&&(this.distance=t.distance),t.decay!==void 0&&(this.decay=t.decay),t.angle!==void 0&&(this.angle=t.angle),t.penumbra!==void 0&&(this.penumbra=t.penumbra),t.shadowRadius!==void 0&&(this.shadow.radius=t.shadowRadius),t.shadowResolution!==void 0&&(this.shadow.mapSize.set(t.shadowResolution,t.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null)),this}fromState(t,r){return super.fromState(t),this.fromSpotLightState(t,r),this}};var e_=n=>n.tagName==="VIDEO",Nl=class{static resize(e,t,r){let i=e/t,s;if(!r.image)return;let o=r.image;e_(o)?s=o.videoWidth/o.videoHeight:s=o.width/o.height,i>s&&(r.imageType=="WEBCAM"?r.repeat.set(-1,1*s/i):r.repeat.set(1,1*s/i)),i<s&&(r.imageType=="WEBCAM"?r.repeat.set(1*i/s*-1,1):r.repeat.set(1*i/s,1)),i==s&&(r.imageType=="WEBCAM"?r.repeat.set(-1,1):r.repeat.set(1,1))}static resizeTextureLayer(e,t,r){let i=e/t,s=r.image!==void 0?r.image.width/r.image.height:1,o;i>s?o={x:1,y:s/i}:i<s?o={x:i/s,y:1}:o={x:1,y:1},r.repeat.set(o.x,o.y),r.updateMatrix()}static resizeTextureLayers(e,t,r){let i=r.layers;for(let s=0;s<i.length;s++){let o=i[s];N1(o)&&Nl.resizeTextureLayer(e,t,o.uniforms[`f${o.id}_texture`].value)}}static resizeComplex(e,t,r,i){let s=e/t,o,a=r.image;e_(a)?o=a.videoWidth/a.videoHeight:o=a.width/a.height,i.geometry.type.includes("Shape")?(s>o&&(r.imageType=="WEBCAM"?r.repeat.set(1/e*-1,1/t*o/s):r.repeat.set(1/e,1/t*o/s)),s<o&&(r.imageType=="WEBCAM"?r.repeat.set(1/e*s/o*-1,1/t):r.repeat.set(1/e*s/o,1/t)),s==o&&(r.imageType=="WEBCAM"?r.repeat.set(1/e*-1,1/t):r.repeat.set(1/e,1/t))):(s>o&&(r.imageType=="WEBCAM"?r.repeat.set(-1,1*o/s):r.repeat.set(1,1*o/s)),s<o&&(r.imageType=="WEBCAM"?r.repeat.set(1*s/o*-1,1):r.repeat.set(1*s/o,1)),s==o&&(r.imageType=="WEBCAM"?r.repeat.set(-1,1):r.repeat.set(1,1)))}};var Nf=class extends Pt{constructor(t,r){super(t,r);this.objectType="Mesh2D";this.castShadow=!0,this.receiveShadow=!0}updateGeometry(t){super.updateGeometry(t),this.material.layers&&Nl.resizeTextureLayers(this.geometry.userData.parameters.width,this.geometry.userData.parameters.height,this.material)}};var Bl=class extends Pt{constructor(t,r){super(t,r);this.objectType="Mesh3D";this.castShadow=!0,this.receiveShadow=!0}};var Bf=class extends Bl{constructor(t,r){super(t,r);this.objectType="NonParametric"}};var Of=class extends gs{constructor(e){super(e)}load(e,t,r,i){let s=this,o=new ys(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(s.withCredentials),o.load(e,function(a){let l;try{l=JSON.parse(a)}catch{console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),l=JSON.parse(a.substring(65,a.length-2))}let u=s.parse(l);t&&t(u)},r,i)}parse(e){return new Gy(e)}},Gy=class{constructor(e){this.isFont=!0,this.type="Font",this.data=e}generateShapes(e,t=100){let r=[],i=_F(e,t,this.data);for(let s=0,o=i.length;s<o;s++)r.push(...i[s].toShapes());return r}};function _F(n,e,t){let r=Array.from(n),i=e/t.resolution,s=(t.boundingBox.yMax-t.boundingBox.yMin+t.underlineThickness)*i,o=[],a=0,l=0;for(let u=0;u<r.length;u++){let c=r[u];if(c===`
4905
+ `,Tf=new ht({vertexShader:uF,fragmentShader:hF,uniforms:{depthContrast:{value:1}}});function dF(n){if(n.geometry.attributes.extrudeNormal||!n.geometry.attributes.position)return;let e=new Map,t=n.geometry.attributes.position.array,r=n.geometry.attributes.normal.array,i=new Float32Array(t.length);for(let s=0;s<t.length;s+=3){let o=`${t[s]}_${t[s+1]}_${t[s+2]}`,a=new _(r[s],r[s+1],r[s+2]);e.has(o)?e.get(o)?.normals.push(a):e.set(o,{normals:[a],result:new _})}e.forEach((s,o)=>{for(let a of s.normals)s.result.add(a);s.result.divideScalar(s.normals.length)});for(let s=0;s<t.length;s+=3){let o=`${t[s]}_${t[s+1]}_${t[s+2]}`,a=e.get(o)?.result;a&&(i[s]=a.x,i[s+1]=a.y,i[s+2]=a.z)}n.geometry.setAttribute("extrudeNormal",new Se(i,3))}function fF(n){if(n.geometry.attributes.extrudeNormals||!n.geometry.attributes.position)return;let e=n.geometry.attributes.position.array,t=new Float32Array(e.length),r=new _;for(let i=0;i<e.length;i+=3)r.set(e[i],e[i+1],e[i+2]).normalize(),t[i]=r.x,t[i+1]=r.y,t[i+2]=r.z;n.geometry.setAttribute("extrudeNormal",new Se(t,3))}function Vs(n){if(n.objectType!=="TextFrame"){if(Array.isArray(n.material)){for(let e of n.material)if(e.getLayersOfType("outline").length===0)return}else if(!(n.material instanceof vn)||n.material.getLayersOfType("outline").length===0)return;n.objectType==="Mesh2D"?fF(n):dF(n)}}function Hs(n){if(!n.geometry.attributes.position)return;let e=n.geometry.attributes.position.array,t=new Float32Array(e.length),r=parseInt(n.uuid.replace(/\D/g,"")),i=[Je.seededRandom(r),Je.seededRandom(r+1e4),Je.seededRandom(r+2e4)];for(let s=0;s<e.length;s++)t[s]=i[s%3];n.geometry.setAttribute("randomColor",new je(t,3))}var Pt=class extends Cn(kt){constructor(t,r){super(t,r);this.isAbstractMesh=!0;this.booleanMeshSetAddress=-1;this.booleanWasTransformed=!1;this.booleanMatrixInvOld=new Re;this.booleanExclude=null;Array.isArray(r)&&t.groups.length===0&&t.addGroup(0,t.getAttribute("position").count,0)}get isGroup(){return this._cloner?.parameters.hideBase===!0}get isMesh(){return!this.isGroup}set isMesh(t){}get cloner(){return this._cloner}set cloner(t){this._cloner&&this.remove(this._cloner),t&&this.add(t),this._cloner=t}updateGeometry(t){let r=this.geometry,i=Dy[r.userData.type],s=this.objectType==="NonParametric"?Object.assign({},r.userData,{geometry:r}):r.userData,o=i.build(i.normalizeInputs(t,s)),a=r.uuid;this.geometry.dispose(),this.geometry=o,this.geometry.uuid=a,this.geometry.computeBoundingSphere(),Vs(this),r.getAttribute("randomColor")&&Hs(this)}clone(t){let r=this.objectType==="NonParametric"?Object.assign({},this.geometry.userData,{geometry:this.geometry.clone()}):this.geometry.userData,i=Fu(r),s=this.material;return new this.constructor(i,s).copy(this,t)}copy(t,r=!0){return super.copy(t,r),t.cloner&&(this.cloner=new fu(t,t.cloner.parameters),this.add(this.cloner)),this}setFromClonerState(t){t===null?this.cloner=void 0:(this.cloner===void 0&&(this.cloner=new fu(this)),this.cloner.fromClonerState(t))}fromState(t,r){return super.fromState(t),t.type==="Mesh"&&(this.setFromClonerState(t.cloner),this.castShadow=t.castShadow??!0,this.receiveShadow=t.receiveShadow??!0,this.booleanExclude=t.booleanExclude??null),this}freeBooleanPointer(){this.booleanMeshSetAddress!==-1&&(Xn.freeMeshSet(this.booleanMeshSetAddress),this.booleanMeshSetAddress=-1)}invalidateDownstreamBooleanData(t=!1){return t?this.booleanWasTransformed=!0:this.freeBooleanPointer(),At(this.parent)?this.parent.invalidateDownstreamBooleanData():this}invalidateUpstreamBooleanData(){this.freeBooleanPointer();for(let t of this.children)Ut(t)&&(t.freeBooleanPointer(),At(t)&&t.invalidateUpstreamBooleanData())}};var pF=new _(0,0,1),O1=new _,F1=new _,U1=new Gt,Ml=class extends Pt{constructor(t=qr.create({}),r){super(t,r);this.recursiveSelection=!1;this.objectType="VectorObject";this.eventDispatcher=new Bt;this._onShapeUpdate=()=>{this.updateGeometry({}),this.geometry.computeBoundingSphere(),this.geometry.computeBoundingBox()};this.castShadow=!0,this.receiveShadow=!0,this.forceComputeSize=!0,this.shape=t.userData.shape,this.shape.eventDispatcher?.addEventListener("update",this._onShapeUpdate)}fromState(t){return super.fromState(t),this.shape.update(),this}setHelperVisibility(){}updateGeometry(t){if(super.updateGeometry(t),"userData"in this.geometry){let r=this.geometry.userData.parameters;this.eventDispatcher.dispatchEvent({type:"geometryUpdate",parameters:r})}}setShape(t){this.shape&&this.shape.eventDispatcher?.removeEventListener("update",this._onShapeUpdate),this.shape=t,this.shape.eventDispatcher?.addEventListener("update",this._onShapeUpdate)}updateWorldMatrix(t,r){super.updateWorldMatrix(t,r),U1.getNormalMatrix(this.matrixWorld),O1.copy(pF).applyMatrix3(U1).normalize(),F1.setFromMatrixPosition(this.matrixWorld),this.shape.plane.setFromNormalAndCoplanarPoint(O1,F1)}clone(t){let r=this.shape.clone(),i=this.material,s=this.geometry.userData,o=qr.create(Object.assign({},s,{shape:r})),a=new Ml(o,i).copy(this,t);return a.shape=r,r.update(),a}raycast(t,r){Pt.prototype.raycast.call(this,t,r)}};function Ef(n,e){return mF(n)}function mF(n){let e={parameters:n,type:n.type};if(n.type==="VectorGeometry"){let r=vt.createFromState(n.shape,n.width,n.height);e.shape=r}else n.type==="NonParametricGeometry"&&(n.data.groups&&n.data.groups.forEach(r=>r.materialIndex=Math.max(r.materialIndex??0,0)),e.geometry=new wa().parse(n));let t;try{t=Fu(e)}catch(r){console.error(r)}if(!t){let r=vt.createFromState(nl.defaultData(),100,100);e.shape=r,t=Fu(e)}return t}var He;gf.then(n=>{He=n});var z1=new Float32Array([10,10,0,-10,10,0,-10,-10,0,10,-10,0]),G1=new Uint32Array([0,1,2,3]),k1=new Uint8Array([4]),Dn=class{static build(n,e,t,r,i){let s,o,a,l=n?.phongAngle??e?.phongAngle??35;if(r===!1&&(l=-1),n.positionWASM!==void 0){t&&t!==0&&(He.free_bvh(t),He.free_subdivision_surface(t));try{s=Dn.allocate(n,i)}catch(u){console.error(u,n),s=Dn.allocate({positionWASM:z1,indexWASM:G1,verticesPerFaceWASM:k1},i)}He.set_destination_refinement_level(s,0),o=Dn.buildLevel(s,!0,l)}else s=t,n.phongAngle!==void 0&&(o=Dn.buildLevel(s,!0,l));return n.subdivisions!==void 0&&(He.set_destination_refinement_level(s,n.subdivisions),n.subdivisions>0?a=Dn.buildLevel(s,!1,l):a=null),{subdivPointer:s,originalGeometry:o,subdividedGeometry:a}}static primitiveToQuads(n,e){n.widthSegments>16&&(n.widthSegments=16),n.heightSegments>16&&(n.heightSegments=16),n.depthSegments>16&&(n.depthSegments=16),n.radialSegments>16&&(n.radialSegments=16),n.type==="DodecahedronGeometry"&&(n.detail=0);let t=n.shape!==void 0?e.geometry:Ef(n),r,i,s,o;({positions:r,triIndices:o}=Ny(t.getAttribute("position"),t.getIndex()));let a;if(n.type==="CylinderGeometry"&&n.cornerRadius===0&&n.hollow===0&&n.openEnded===!1){let l=n.radialSegments*n.heightSegments*3*2,u=l+n.radialSegments*3;a=[l,u]}return{indices:i,verticesPerFace:s}=By(r,o,t,a),{positions:r,indices:i,verticesPerFace:s}}static allocate(n,e){let t,r,i,s=[],o=[];n.positionWASM&&n.positionWASM.length>0?(t=n.positionWASM,r=n.indexWASM,i=n.verticesPerFaceWASM):(t=z1,r=G1,i=k1);let a=t.length,l=r.length,u=i.length,c=t.length+s.length+o.length,h=r.length+i.length,d=c*Float32Array.BYTES_PER_ELEMENT+h*Uint32Array.BYTES_PER_ELEMENT,f=c*Float32Array.BYTES_PER_ELEMENT,m=h*Uint32Array.BYTES_PER_ELEMENT,p=He._malloc(d),g=new Float32Array(He.HEAPF32.buffer,p,c),y=new Uint32Array(He.HEAPU32.buffer,p+f,h);g.set(t,0),g.set(s,t.length),g.set(o,t.length+s.length),y.set(r,0),y.set(i,r.length);let x;n?.scaleBaked?.some(b=>b!==1)&&(x=new Re().makeScale(...n.scaleBaked)),e&&(x?x.premultiply(e):x=e);let w=x?He.alloc_subdivision_surface2(p,a,p+f,l,p+f+r.length*Uint32Array.BYTES_PER_ELEMENT,u,x.elements):He.alloc_subdivision_surface(p,a,p+f,l,p+f+r.length*Uint32Array.BYTES_PER_ELEMENT,u);return He._free(p),w}static buildLevel(n,e,t,r,i){let s=i?He.get_mesh_data2(n,e?He.Level.CONTROL:He.Level.REFINED,t,i.elements):He.get_mesh_data(n,e?He.Level.CONTROL:He.Level.REFINED,t),o=8,a=He.HEAPU32.subarray(s>>2,(s>>2)+o),l=a.subarray(4,4+4),u=0,c=He.HEAPU32[a[u]>>2],h=He.HEAPF32.subarray(c>>2,(c>>2)+l[u]);u++;let d=He.HEAPU32[a[u]>>2],f=He.HEAPF32.subarray(d>>2,(d>>2)+l[u]);u++;let m=He.HEAPU32[a[u]>>2],p=He.HEAPU32.subarray(m>>2,(m>>2)+l[u]);u++;let g=He.HEAPU32[a[u]>>2],y=He.HEAPU32.subarray(g>>2,(g>>2)+l[u]);if(u++,r===void 0){let x=new De;if(x.setIndex(new ds(y,1)),x.setAttribute("position",new Se(h,3)),x.setAttribute("normal",new Se(f,3)),e){x.setAttribute("faceMap",new ds(p,1));let w=new Float32Array(f.length/3*4).fill(0);x.setAttribute("color",new je(w,4))}return He.free_mesh_data(s),x.userData.type="SubdivGeometry",x}r.getAttribute("position").copyArray(h),r.getAttribute("normal").copyArray(f),r.attributes.position.needsUpdate=!0,r.attributes.normal.needsUpdate=!0,He.free_mesh_data(s)}static buildControlCageWireframe(n,e,t){let r=He.get_wireframe_data_for_base_level(n),i=4,s=He.HEAPU32.subarray(r>>2,(r>>2)+i),o=s.subarray(2,2+2),a=0,l=He.HEAPU32[s[a]>>2],u=He.HEAPF32.subarray(l>>2,(l>>2)+o[a]);a++;let c=He.HEAPU32[s[a]>>2],h=He.HEAPU32.subarray(c>>2,(c>>2)+o[a]);if(e===void 0){let d=new De;d.setAttribute("position",new Se(u,3));let f=new Float32Array(u.length);for(let m=0,p=u.length;m<p;)f[m++]=t.r,f[m++]=t.g,f[m++]=t.b;return d.setAttribute("color",new je(f,3)),d.setIndex(new ds(h,1)),He.free_wireframe_data_for_base_level(r),d}e.getAttribute("position").copyArray(u),e.attributes.position.needsUpdate=!0,He.free_wireframe_data_for_base_level(r)}static updateCollabMesh(n,e,t){let r=e===0;r||He.set_destination_refinement_level(n,e);let i=t?He.get_topological_data2(n,r?He.Level.CONTROL:He.Level.REFINED,t.elements):He.get_topological_data(n,r?He.Level.CONTROL:He.Level.REFINED),s=6,o=He.HEAPU32.subarray(i>>2,(i>>2)+s),a=o.subarray(3,3+3),l=0,u=He.HEAPU32[o[l]>>2],c=new Float32Array(He.HEAPF32.subarray(u>>2,(u>>2)+a[l]));l++;let h=He.HEAPU32[o[l]>>2],d=new Uint32Array(He.HEAPU32.subarray(h>>2,(h>>2)+a[l]));l++;let f=He.HEAPU32[o[l]>>2],m=new Uint8Array(He.HEAPU32.subarray(f>>2,(f>>2)+a[l]));return He.free_topological_data(i),{positions:c,indices:d,verticesPerFace:m}}};var V1=["getX","getY","getZ"];function Ny(n,e){let t={},r=e?e.count:n.count,i=0,s=[],o=[],a=1e4;for(let u=0;u<r;u++){let c=e?e.getX(u):u,h="";for(let d=0;d<3;d++)h+=`${~~(n[V1[d]](c)*a)},`;if(h in t)s.push(t[h]);else{for(let d=0;d<3;d++)o.push(n[V1[d]](c));t[h]=i,s.push(i),i++}}let l=[];for(let u=0;u<s.length;u+=3)s[u]===s[u+1]||s[u]===s[u+2]||s[u+1]===s[u+2]||l.push(s[u],s[u+1],s[u+2]);return{positions:o,triIndices:l}}var Cf=new _,Iy=new _,Ly=new _,Ry=new _;function By(n,e,t,r){let i=[],s=[];if(t.userData.shape!==void 0&&t.userData.parameters.depth===0&&t.userData.shape.shapeHoles.length===0){let o=t.userData.shape.extractShapePointsToFlatArray([]),a=0;for(let u=0;u<o.length;u+=2)a+=(o[u]-o[(u===0?o.length:u)-2])*(o[u+1]+o[(u===0?o.length:u)-1]);n.length=0;let l=0;if(a<0)for(let u=0;u<o.length;u+=2)n.push(o[u],o[u+1],0),i.push(l++);else for(let u=o.length-2;u>=0;u-=2)n.push(o[u],o[u+1],0),i.push(l++);return s.push(l),{indices:i,verticesPerFace:s}}for(let o=0,a=t.capStartIndex??e.length;o<a;)if(e[o+1]===e[o+3]&&e[o+2]===e[o+5]||e[o+0]===e[o+3]&&e[o+2]===e[o+4]){Cf.set(n[e[o]*3],n[e[o]*3+1],n[e[o]*3+2]),Iy.set(n[e[o+1]*3],n[e[o+1]*3+1],n[e[o+1]*3+2]),Ly.set(n[e[o+4]*3],n[e[o+4]*3+1],n[e[o+4]*3+2]),Ry.set(n[e[o+5]*3],n[e[o+5]*3+1],n[e[o+5]*3+2]),Iy.sub(Cf).normalize(),Ly.sub(Cf).normalize(),Ry.sub(Cf).normalize();let l=Iy.cross(Ly).dot(Ry);Math.abs(l)>.005||r&&r.some((u,c)=>c%2===1?!1:o>=r[c]&&o<r[c+1])?(i.push(e[o],e[o+1],e[o+2]),s.push(3),o+=3):(i.push(e[o],e[o+1],e[o+4],e[o+5]),s.push(4),o+=6)}else i.push(e[o],e[o+1],e[o+2]),s.push(3),o+=3;if(t.capStartIndex!==void 0){let o=[],a=[],l=0;for(let u=0,c=0;u<n.length;u+=3,c++)n[u+2]===0&&(o.push(c),l++),n[u+2]===t.userData.parameters.depth&&a.push(c);if(t.userData.parameters.extrudeBevelSize===0){let u=a[0];a[0]=a[1],a[1]=u}o.reverse(),i.push(...o,...a),s.push(l,l)}return{indices:i,verticesPerFace:s}}var Xn={};jA(Xn,{calcBoolean:()=>vF,calcBooleanTopological:()=>yF,freeMeshSet:()=>wF,getMeshSet:()=>xF,transformMeshSet:()=>bF});var W1,j1=new Promise(n=>{W1=n}),H1=!1;async function q1(){if(H1)return;let e=!1?".":"https://unpkg.com/@splinetool/boolean-wasm@0.9.95/build",[t,r]=await Promise.all([import("./boolean.js"),fetch(`${e}/boolean.wasm`).then(o=>o.arrayBuffer())]),s=await t.default({wasmBinary:r});W1(s),H1=!0}var st,Tl;j1.then(n=>st=n);function gF(n,e){let t,{positions:r,triIndices:i}=Ny(n.getAttribute("position"),n.getIndex()),s;if(e){let{indices:o,verticesPerFace:a}=By(r,i,n);s=a.length,t=[];for(let l=0,u=0;l<s;l++){t.push(a[l]);for(let c=0;c<a[l];c++)t.push(o[u++])}}else{let o=i.length;t=Array(o+o/3),s=0;for(let a=0,l=0;l<t.length;)t[l++]=3,s++,t[l++]=i[a++],t[l++]=i[a++],t[l++]=i[a++]}return{positions:r,faceIndices:t,nFaces:s}}function X1(n){let e=n.length,t=e*Uint32Array.BYTES_PER_ELEMENT,r=e*Float32Array.BYTES_PER_ELEMENT,i=Number.isInteger(n[0])?t:r,s=st._malloc(i);return(Number.isInteger(n[0])?new Uint32Array(st.HEAPU32.buffer,s,e):new Float32Array(st.HEAPF32.buffer,s,e)).set(n,0),s}function Y1(n){switch(n){case 0:return st.OP.UNION;case 1:return st.OP.INTERSECTION;case 2:return st.OP.A_MINUS_B;case 3:return st.OP.B_MINUS_A;case 4:return st.OP.SYMMETRIC_DIFFERENCE;case 5:return st.OP.ALL;default:throw new Error("Unknown boolean operation "+n)}}function yF(n,e){Tl===void 0&&(Tl=st.init_csg());let t=X1(n),r=st.csg_calc_topological(Tl,t,n.length,Y1(e));st._free(t);let i=6,s=st.HEAPU32.subarray(r>>2,(r>>2)+i),o=s.subarray(3,3+3),a=0,l=st.HEAPU32[s[a]>>2],u=new Float32Array(st.HEAPF32.subarray(l>>2,(l>>2)+o[a]));a++;let c=st.HEAPU32[s[a]>>2],h=new Uint32Array(st.HEAPU32.subarray(c>>2,(c>>2)+o[a]));a++;let d=st.HEAPU32[s[a]>>2],f=new Uint8Array(st.HEAPU32.subarray(d>>2,(d>>2)+o[a]));return st.free_mesh_data(r),{positions:u,indices:h,verticesPerFace:f}}function vF(n,e,t,r){Tl===void 0&&(Tl=st.init_csg());let i=X1(n),s=st.csg_calc(Tl,i,n.length,r,Y1(e));st._free(i);let o=5,a=st.HEAPU32.subarray(s>>2,(s>>2)+o),l=a.subarray(2,2+3),u=0,c=st.HEAPU32[a[u]>>2],h=st.HEAPF32.subarray(c>>2,(c>>2)+l[u]);u++;let d=st.HEAPU32[a[u]>>2],f=st.HEAPF32.subarray(d>>2,(d>>2)+l[u]);u++;let m=l[u];t.setAttribute("position",new Se(h,3)),t.setAttribute("normal",new Se(f,3));let p=st.HEAPF32.subarray((s>>2)+5,(s>>2)+5+6);return t.boundingSphere===null&&(t.boundingSphere=new Dr),t.boundingSphere.center.set(p[0],p[1],p[2]),t.boundingSphere.radius=(p[3]**2+p[4]**2+p[5]**2)**.5,t.userData.parameters={width:p[3]*2,height:p[4]*2,depth:p[5]*2},st.free_mesh_data(s),m}function xF(n,e){if(st===void 0)return-1;let t,r,i;if(e&&n.userData.positions!==void 0){let p=n.userData;i=p.verticesPerFace.length,t=p.positions,r=Array(p.verticesPerFace.reduce((g,y)=>g+y,0)+i);for(let g=0,y=0,x=0;g<p.verticesPerFace.length;g++){r[x++]=p.verticesPerFace[g];for(let w=0;w<p.verticesPerFace[g];w++)r[x++]=p.indices[y++]}}else({positions:t,faceIndices:r,nFaces:i}=gF(n,e));let s=t.length,o=r.length,a=t.length,l=r.length,u=a*Float32Array.BYTES_PER_ELEMENT+l*Uint32Array.BYTES_PER_ELEMENT,c=a*Float32Array.BYTES_PER_ELEMENT,h=l*Uint32Array.BYTES_PER_ELEMENT,d=st._malloc(u),f=new Float32Array(st.HEAPF32.buffer,d,a),m=new Uint32Array(st.HEAPU32.buffer,d+c,l);return f.set(t,0),m.set(r,0),st.get_csg_mesh(d,s,d+c,o,i)}function bF(n,e){st.transform_csg_mesh(n,e.elements)}function wF(n){st.free_csg_mesh(n)}var Dy={ConeGeometry:LS,CubeGeometry:RS,CylinderGeometry:IS,DodecahedronGeometry:NS,EllipseGeometry:r1,HelixGeometry:o1,IcosahedronGeometry:a1,LatheGeometry:l1,NonParametricGeometry:c1,PolygonGeometry:u1,PyramidGeometry:h1,RectangleGeometry:d1,SphereGeometry:f1,PlaneGeometry:p1,BackdropGeometry:m1,StarGeometry:g1,TextFrameGeometry:mf,TorusGeometry:y1,TorusKnotGeometry:v1,TriangleGeometry:x1,VectorGeometry:qr},Fu=n=>Dy[n.type].create(n);var Q1=new Re;function Oy(n){let e=!1;return n.scene.objects.traverse((t,r)=>{r.geometry?.type==="BooleanGeometry"&&(e=!0)}),e}var Pf=class extends Pt{constructor(t=new De,r){super(t,r);this.booleanOp=2;this.phongAngle=35;this.meshSetAddresses=[];this.needsTransformForDownstream=!1;this.objectType="BooleanObject",this.castShadow=!0,this.receiveShadow=!0,this.geometry.userData.parameters={width:0,height:0,depth:0},this.onAfterRender=this.recomputeBoolean.bind(this)}reInit(){this.objectType="BooleanObject",this.meshSetAddresses=[],this.needsTransformForDownstream=!1,this.geometry.userData.parameters={width:0,height:0,depth:0},this.onAfterRender=this.recomputeBoolean.bind(this)}recomputeBoolean(t){if(this.booleanMeshSetAddress!==-1)return;for(let i=0;i<this.children.length;i++){let s=this.children[i];At(s)&&s.recomputeBoolean(t===!0)}this.meshSetAddresses=[];for(let i=0;i<this.children.length;i++){let s=this.children[i];if(T1(s)&&s.booleanExclude===!1&&s.geometry.attributes.position?.count>0&&s.geometry.drawRange.count>0){if(s.booleanMeshSetAddress===-1){if(s.booleanMeshSetAddress=Xn.getMeshSet(s.geometry,t===!0),s.booleanMeshSetAddress===-1)return;Xn.transformMeshSet(s.booleanMeshSetAddress,s.matrix),s.booleanMatrixInvOld.copy(s.matrix).invert(),s.booleanWasTransformed=!1}else At(s)&&s.needsTransformForDownstream===!0?(Xn.transformMeshSet(s.booleanMeshSetAddress,s.matrix),s.needsTransformForDownstream=!1):s.booleanWasTransformed===!0&&(Q1.multiplyMatrices(s.matrix,s.booleanMatrixInvOld),Xn.transformMeshSet(s.booleanMeshSetAddress,Q1),s.booleanMatrixInvOld.copy(s.matrix).invert(),s.booleanWasTransformed=!1);this.meshSetAddresses.push(s.booleanMeshSetAddress)}}if(this.meshSetAddresses.length===0){this.geometry.setDrawRange(0,0);return}if(t===!0)return Xn.calcBooleanTopological(this.meshSetAddresses,this.booleanOp);let r=this.geometry;r.dispose(),this.geometry=new De,this.geometry.userData=r.userData,this.geometry.boundingSphere=r.boundingSphere;try{this.booleanMeshSetAddress=Xn.calcBoolean(this.meshSetAddresses,this.booleanOp,this.geometry,this.phongAngle)}catch(i){this.booleanMeshSetAddress=0,console.error(i)}this.booleanMatrixInvOld.copy(this.matrix).invert(),this.needsTransformForDownstream=!0,Vs(this),Hs(this)}updateGeometry(t){let r=t.parameters;r.operation!==void 0&&(this.booleanOp=r.operation),r.phongAngle!==void 0&&(this.phongAngle=r.phongAngle),this.invalidateDownstreamBooleanData().recomputeBoolean()}};var _i=n=>{var e;return e=class extends n{constructor(){super(...arguments);this.isObjectHelper=!0}},e.geometryHelper=new Zr(30,30,30),e};var Df=new ki,Fy=new Dr,Z1=new Re,Ai=(n,e,t,r,i=!1)=>{let s=e,o=n.matrixWorld;if(s.boundingSphere===null&&s.computeBoundingSphere(),Fy.copy(s.boundingSphere),Fy.applyMatrix4(o),t.ray.intersectsSphere(Fy)===!1||(Z1.copy(o).invert(),Df.copy(t.ray).applyMatrix4(Z1),s.boundingBox!==null&&Df.intersectsBox(s.boundingBox)===!1))return;let a,l,u,c,h=s.index,d=s.attributes.position,f=s.drawRange,m,p;if(i===!1){let y=Math.max(0,f.start),x=Math.min(h.count,f.start+f.count);for(m=y,p=x;m<p;m+=3)if(l=h.getX(m),u=h.getX(m+1),c=h.getX(m+2),a=g(n,t,Df,d,l,u,c),a){a.faceIndex=Math.floor(m/3),r.push(a);return}}else{let x=s.attributes.position,w=new _,b=new _,S=new _,A=new _,M=2,T=1/((n.scale.x+n.scale.y+n.scale.z)/3),E=T*T,C=Math.max(0,f.start),L=Math.min(x.count,f.start+f.count);for(let N=C,R=L-1;N<R;N+=M){if(w.fromBufferAttribute(x,N),b.fromBufferAttribute(x,N+1),Df.distanceSqToSegment(w,b,A,S)>E)continue;A.applyMatrix4(n.matrixWorld);let j=t.ray.origin.distanceTo(A);j<t.near||j>t.far||r.push({distance:j,point:S.clone().applyMatrix4(n.matrixWorld),object:n})}}function g(y,x,w,b,S,A,M){let v=new _,T=new _,E=new _,C=new _,L=new _;if(v.fromBufferAttribute(b,S),T.fromBufferAttribute(b,A),E.fromBufferAttribute(b,M),w.intersectTriangle(v,T,E,!1,C)===null)return null;L.copy(C),L.applyMatrix4(y.matrixWorld);let R=x.ray.origin.distanceTo(L);return R<x.near||R>x.far?null:{faceIndex:1,distance:R,point:L.clone(),object:y}}};var If=new _,In=new Un,Uy=class extends ps{constructor(t){let r=new De,i=new wn({color:16777215,vertexColors:!0,toneMapped:!1}),s=[],o=[],a={},l=new Oe(15711266),u=new Oe(15711266),c=new Oe(2857471);h("n1","n2",l),h("n2","n4",l),h("n4","n3",l),h("n3","n1",l),h("f1","f2",l),h("f2","f4",l),h("f4","f3",l),h("f3","f1",l),h("n1","f1",l),h("n2","f2",l),h("n3","f3",l),h("n4","f4",l),h("p","n1",u),h("p","n2",u),h("p","n3",u),h("p","n4",u),h("u1","u2",c),h("u2","u3",c),h("u3","u1",c);function h(f,m,p){d(f,p),d(m,p)}function d(f,m){s.push(0,0,0),o.push(m.r,m.g,m.b),a[f]===void 0&&(a[f]=[]),a[f].push(s.length/3-1)}r.setAttribute("position",new Se(s,3)),r.setAttribute("color",new Se(o,3));super(r,i);this.type="CameraHelper",this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update()}update(){let t=this.geometry,r=this.pointMap,i=!0;In.projectionMatrixInverse.elements=[.5112609807824982,-0,-0,-0,-0,.41421356237309503,-0,-0,-0,-0,-0,-.099999,-0,-0,-1.0000000000000002,.100001];let s=1,o=1,a=i?.8:1e-4;Yn("n1",r,t,In,-s,-o,a),Yn("n2",r,t,In,s,-o,a),Yn("n3",r,t,In,-s,o,a),Yn("n4",r,t,In,s,o,a);let l=a;Yn("f1",r,t,In,-s,-o,l),Yn("f2",r,t,In,s,-o,l),Yn("f3",r,t,In,-s,o,l),Yn("f4",r,t,In,s,o,l);let u=l,c=.5;Yn("u1",r,t,In,s*.7*c,o*1.1,u),Yn("u2",r,t,In,-s*.7*c,o*1.1,u),Yn("u3",r,t,In,0,o*(1.1+.9*c),u),t.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}};function Yn(n,e,t,r,i,s,o){If.set(i,s,o).unproject(r);let a=e[n];if(a!==void 0){let l=t.getAttribute("position");for(let u=0,c=a.length;u<c;u++)l.setXYZ(a[u],If.x,If.y,If.z)}}var Lf=class extends _i(Uy){constructor(t){super(t);this.object=t;this.object=t,this.name=`CombinedCameraHelper: ${t.uuid}`}updateMatrixWorld(t){super.updateMatrixWorld(t),this.updateTarget()}updateTarget(){let t=this.object.getTarget();this.updateWorldMatrix(!0,!1),this.worldToLocal(t)}raycast(t,r){Ai(this.object,this.geometry,t,r,!0)}};var El=class extends _i(Gh){constructor(t,r=15,i=10066329){super(t,r,i);this.object=t;this.added=!1;this.name=`DirectionalLightHelper: ${t.uuid}`}raycast(t,r){Ai(this.object,El.geometryHelper,t,r)}};var Cl=class extends _i(kh){constructor(t,r=15){super(r);this.object=t;this.object.updateMatrixWorld(),this.name=`EmptyObjectHelper: ${t.uuid}`,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1}raycast(t,r){Ai(this.object,Cl.geometryHelper,t,r)}update(){}};var Pl=class extends _i(zh){constructor(t,r=15,i=6710886){super(t,r,i);this.object=t;this.name=`PointLightHelper: ${t.uuid}`}raycast(t,r){Ai(this.object,Pl.geometryHelper,t,r)}};var Rf=class extends _i(Uh){constructor(t,r=6710886){super(t,r);this.object=t;this.name=`SpotLightHelper: ${t.uuid}`}raycast(t,r){Ai(this.object,Rf.geometryHelper,t,r)}update(){if(this.object!==void 0){let t=Rf._vector,r=this.object.distance?this.object.distance:1e3,i=r*Math.tan(this.object.angle);this.cone.scale.set(i,i,r),t.setFromMatrixPosition(this.object.target.matrixWorld),this.cone.lookAt(t);let s=this.color!==void 0?this.color:this.light.color;if(this.cone.material instanceof Array)for(let o=0,a=this.cone.material.length;o<a;o++)this.cone.material[o].color.set(s);else this.cone.material.color.set(s)}}},Uu=Rf;Uu._vector=new _;var Mi=(n,e)=>class extends n{constructor(){super(...arguments);this.objectHelper=new e(this)}get geometryHelper(){return e.geometryHelper}raycast(i,s){this.objectHelper.raycast(i,s)}fromLightState(i,s){if(this.objectType==="LightDirectional"||this.objectType==="LightPoint"||this.objectType==="LightSpot"){let o=this;i.color!==void 0&&(o.color=or(i.color,s)),i.intensity!==void 0&&(o.intensity=i.intensity),i.depth!==void 0&&(o.shadow.camera.far=i.depth,o.shadow.needsUpdate=!0),i.shadows!==void 0&&(this.castShadow=i.shadows)}return this}};var Dl=new _,zy=new _,Yr=class extends Mi(Cn(Un),Lf){constructor(t=window.innerWidth,r=window.innerHeight,i=45,s,o=1e5){super();this.objectType="CombinedCamera";this._cameraType="OrthographicCamera";this.targetOffset=So.DefaultTargetOffset;this.isUpVectorFlipped=!1;this.angleOffsetFromUp=0;this.width=t,this.height=r,this.orthoCamera=new ca(t*-.5,t*.5,r*.5,r*-.5,s??-5e4,o),this.perspCamera=new Zt(i,t/r,s??50,o),this.left=this.orthoCamera.left,this.right=this.orthoCamera.right,this.top=this.orthoCamera.top,this.bottom=this.orthoCamera.bottom,this.far=this.orthoCamera.far,this.view=this.orthoCamera.view,this.aspect=this.perspCamera.aspect,this.fov=this.perspCamera.fov,this.focus=this.perspCamera.focus,this.filmGauge=this.perspCamera.filmGauge,this.filmOffset=this.perspCamera.filmOffset,this.toOrthographic()}static createFromState(t,r){let i=new Yr().fromState(r);return i.objectHelper.update(),i.uuid=t,i}get isPerspectiveCamera(){return this.cameraType==="PerspectiveCamera"}get isOrthographicCamera(){return!this.isPerspectiveCamera}get cameraType(){return this._cameraType}setNear(t,r){t==="PerspectiveCamera"?this.perspCamera.near=r:this.orthoCamera.near=r}setZoom(t,r){r>=0&&(t==="PerspectiveCamera"?this.perspCamera.zoom=r:this.orthoCamera.zoom=r)}set cameraType(t){t==="PerspectiveCamera"?this.toPerspective():t==="OrthographicCamera"&&this.toOrthographic()}get near(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.near:this.orthoCamera.near}set near(t){this._cameraType==="PerspectiveCamera"?this.perspCamera.near=t:this.orthoCamera.near=t}get zoom(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom:this.orthoCamera.zoom}set zoom(t){t>=0&&(this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom=t:this.orthoCamera.zoom=t)}lookAt(t){super.lookAt(t),this.getWorldPosition(Dl),this.targetOffset=Dl.distanceTo(t)}getTarget(t=new _){return this.getWorldDirection(zy),this.getWorldPosition(Dl),zy.multiplyScalar(this.targetOffset),t.copy(Dl).add(zy),t}getDistanceToTarget(){let t=this.getTarget();return this.getWorldPosition(Dl),Dl.distanceTo(t)}updateUp(){let t=this.getWorldQuaternion(new qt),r=new _(0,0,1).applyQuaternion(t),i=new _().copy(ot.DefaultUp);this.isUpVectorFlipped&&i.negate(),i.applyQuaternion(t);let s=new _().copy(ot.DefaultUp).projectOnPlane(r),o=new _().crossVectors(s,i).dot(r)>=0?1:-1;this.angleOffsetFromUp=s.angleTo(i)*o}getViewFrontToObject(t){let r=t.getWorldPosition(new _),s=t.getWorldDirection(new _).multiplyScalar(this.targetOffset);return{position:r.clone().add(s),target:r}}getViewToObject(t){let r=t.getWorldPosition(new _),s=this.getWorldDirection(new _).multiplyScalar(this.targetOffset);return{position:r.clone().sub(s),target:r}}setViewplaneSize(t,r){this.left=-t*.5,this.right=t*.5,this.top=r*.5,this.bottom=-r*.5,this.aspect=t/r,this.updateProjectionMatrix()}toOrthographic(){this.orthoCamera.left=this.left,this.orthoCamera.right=this.right,this.orthoCamera.top=this.top,this.orthoCamera.bottom=this.bottom,this.orthoCamera.view=this.view,this.orthoCamera.far=this.far,this.orthoCamera.updateProjectionMatrix(),this.projectionMatrix=this.orthoCamera.projectionMatrix,this.projectionMatrixInverse=this.orthoCamera.projectionMatrixInverse,this._cameraType="OrthographicCamera",this.objectHelper&&this.objectHelper.update()}toPerspective(){this.perspCamera.aspect=this.aspect,this.perspCamera.fov=this.fov,this.perspCamera.view=this.view,this.perspCamera.far=this.far,this.perspCamera.updateProjectionMatrix(),this.projectionMatrix=this.perspCamera.projectionMatrix,this.projectionMatrixInverse=this.perspCamera.projectionMatrixInverse,this._cameraType="PerspectiveCamera",this.objectHelper&&this.objectHelper.update()}setFocalLength(t){this.perspCamera.setFocalLength(t),this.toPerspective()}getFocalLength(){return this.perspCamera.getFocalLength()}getEffectiveFOV(){return this.perspCamera.getEffectiveFOV()}getFilmWidth(){return this.perspCamera.getFilmWidth()}getFilmHeight(){return this.perspCamera.getFilmHeight()}setViewOffset(t,r,i,s,o,a){this._cameraType==="PerspectiveCamera"?this.perspCamera.setViewOffset(t,r,i,s,o,a):this.orthoCamera.setViewOffset(t,r,i,s,o,a)}clearViewOffset(){this._cameraType==="PerspectiveCamera"?(this.perspCamera.clearViewOffset(),this.toPerspective()):(this.orthoCamera.clearViewOffset(),this.toOrthographic())}updateProjectionMatrix(){this._cameraType==="PerspectiveCamera"?this.toPerspective():this._cameraType==="OrthographicCamera"&&this.toOrthographic()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,r){super.updateWorldMatrix(t,r),this.matrixWorldInverse.copy(this.matrixWorld).invert()}copy(t,r){return super.copy(t,r),this.orthoCamera.copy(t.orthoCamera),this.perspCamera.copy(t.perspCamera),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.far=t.far,this.view=t.view===null?null:Object.assign({},t.view),this._cameraType=t._cameraType,this.aspect=t.aspect,this.fov=t.fov,this.focus=t.focus,this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this.targetOffset=t.targetOffset,this.updateProjectionMatrix(),this}toCameraState(t=[]){let r={type:this.cameraType,far:this.far,orthographic:{near:this.orthoCamera.near,zoom:this.orthoCamera.zoom},perspective:{near:this.perspCamera.near,fov:this.perspCamera.fov,zoom:this.perspCamera.zoom},up:this.up.toArray(),targetOffset:this.targetOffset,isUpVectorFlipped:this.isUpVectorFlipped};return Ja(r,t)}fromCameraState(t){let{orthographic:r,perspective:i}=t;return t.type!==void 0&&(this.cameraType=t.type),t.far!==void 0&&(this.far=t.far),r!==void 0&&(r.near!==void 0&&(this.orthoCamera.near=r.near),r.zoom!==void 0&&(this.orthoCamera.zoom=r.zoom)),i!==void 0&&(i.near!==void 0&&(this.perspCamera.near=i.near),i.fov!==void 0&&(this.perspCamera.fov=i.fov),i.zoom!==void 0&&(this.perspCamera.zoom=i.zoom)),t.up!==void 0&&this.up.fromArray(t.up),t.targetOffset!==void 0&&(this.targetOffset=t.targetOffset),t.isUpVectorFlipped!==void 0&&(this.isUpVectorFlipped=t.isUpVectorFlipped),this.updateProjectionMatrix(),this}toState(t){return{...super.toState(t),...this.toCameraState(t),type:this.cameraType}}fromState(t){return super.fromState(t),this.fromCameraState(t),this}};var Io=class extends Mi(Cn(ss),Cl){constructor(){super(...arguments);this.objectType="EmptyObject"}static createFromState(t,r){let i=new Io().fromState(r);return i.uuid=t,i.objectHelper.update(),i}};var Il=class extends Mi(Cn(Bh),El){constructor(...t){super(...t);this.objectType="LightDirectional";this._gizmos={};this.castShadow=!0,this.shadow.mapSize.width=2048,this.shadow.mapSize.height=2048,this.shadow.normalBias=1,this.layers.enable(3);let i=this.shadow.camera;i.top=1250,i.bottom=-1250,i.right=1250,i.left=-1250,i.near=-1e4,i.far=2500;let s=new _n(this.shadow.camera);s.visible=!1,this._gizmos.shadowmap=s,this.update()}static createFromState(t,r,i){let s=new Il().fromState(r,i);return s.uuid=t,s}get gizmos(){return this._gizmos}showGizmos(){for(let t in this._gizmos){let r=this._gizmos[t];r instanceof _n&&(r.visible=!0)}}hideGizmos(){for(let t in this._gizmos){let r=this._gizmos[t];r instanceof _n&&(r.visible=!1)}}update(){this.shadow.camera.updateProjectionMatrix();for(let t in this._gizmos){let r=this._gizmos[t];r instanceof _n&&r.update()}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.objectHelper&&this.objectHelper.update()}fromDirectionalLightState(t,r){let i=t.depth!==void 0&&t.depth!==this.shadow.camera.far||t.size!==void 0&&t.size/2!==this.shadow.camera.right;return super.fromLightState(t,r),t.size!==void 0&&_1(this,t.size),t.shadowRadius!==void 0&&(this.shadow.radius=t.shadowRadius),t.shadowResolution!==void 0&&(this.shadow.mapSize.set(t.shadowResolution,t.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null)),i&&this.update(),this}fromState(t,r){return super.fromState(t),this.fromDirectionalLightState(t,r),this}};var Ll=class extends Mi(Cn(Nh),Pl){constructor(...t){super(...t);this.objectType="LightPoint";this._gizmos={};this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024,this.shadow.normalBias=1,this.layers.enable(3);let i=this.shadow.camera;i.fov=90,i.aspect=1,i.near=100,i.far=2500;let s=new _(-i.far+this.position.x,-i.far+this.position.y,-i.far+this.position.z),o=new _(i.far+this.position.x,i.far+this.position.y,i.far+this.position.z),a=new br(s,o),l=new yo(a,new Oe(16755200));l.visible=!1,this._gizmos.shadowmap=l,this.update()}static createFromState(t,r,i){let s=new Ll().fromState(r,i);return s.uuid=t,s}get gizmos(){return this._gizmos}showGizmos(){for(let t in this._gizmos){let r=this._gizmos[t];r instanceof yo&&(r.visible=!0)}}hideGizmos(){for(let t in this._gizmos){let r=this._gizmos[t];r instanceof yo&&(r.visible=!1)}}update(){if(this.shadow&&(this.shadow.camera.updateProjectionMatrix(),this._gizmos))for(let t in this._gizmos){let r=this._gizmos[t];if(r instanceof yo){let i=this.shadow.camera,s=new _(-i.far+this.position.x,-i.far+this.position.y,-i.far+this.position.z),o=new _(i.far+this.position.x,i.far+this.position.y,i.far+this.position.z);r.box.set(s,o),r.updateMatrixWorld(!0)}}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.objectHelper&&this.objectHelper.update()}fromPointLightState(t,r){return super.fromLightState(t,r),t.distance!==void 0&&(this.distance=t.distance),t.decay!==void 0&&(this.decay=t.decay),t.shadowRadius!==void 0&&(this.shadow.radius=t.shadowRadius),t.shadowResolution!==void 0&&(this.shadow.mapSize.set(t.shadowResolution,t.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null)),this}fromState(t,r){return super.fromState(t),this.fromPointLightState(t,r),this}};var K1=new _,J1=new _,$1=new qt,Rl=class extends Mi(Cn(Rh),Uu){constructor(...t){super(...t);this.objectType="LightSpot";this._gizmos={};this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024,this.shadow.normalBias=1,this.layers.enable(3);let i=this.shadow.camera;i.fov=Je.RAD2DEG*2*this.angle,i.aspect=1,i.near=100,i.far=2500;let s=new _n(this.shadow.camera);s.visible=!1,this._gizmos.shadowmap=s,this.update()}static createFromState(t,r,i){let s=new Rl().fromState(r,i);return s.uuid=t,s}get gizmos(){return this._gizmos}showGizmos(){for(let t in this._gizmos){let r=this._gizmos[t];r instanceof _n&&(r.visible=!0)}}hideGizmos(){for(let t in this._gizmos){let r=this._gizmos[t];r instanceof _n&&(r.visible=!1)}}update(){this.shadow.camera.updateProjectionMatrix();for(let t in this._gizmos){let r=this._gizmos[t];r instanceof _n&&r.update()}}updateMatrixWorld(t){super.updateMatrixWorld(t),J1.setFromMatrixPosition(this.matrixWorld),$1.setFromRotationMatrix(this.matrixWorld),K1.copy(this.up).applyQuaternion($1).negate().multiplyScalar(this.distance),this.target.position.copy(J1).add(K1),this.target.updateMatrixWorld(),this.objectHelper&&this.objectHelper.update()}fromSpotLightState(t,r){return super.fromLightState(t,r),t.distance!==void 0&&(this.distance=t.distance),t.decay!==void 0&&(this.decay=t.decay),t.angle!==void 0&&(this.angle=t.angle),t.penumbra!==void 0&&(this.penumbra=t.penumbra),t.shadowRadius!==void 0&&(this.shadow.radius=t.shadowRadius),t.shadowResolution!==void 0&&(this.shadow.mapSize.set(t.shadowResolution,t.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null)),this}fromState(t,r){return super.fromState(t),this.fromSpotLightState(t,r),this}};var e_=n=>n.tagName==="VIDEO",Nl=class{static resize(e,t,r){let i=e/t,s;if(!r.image)return;let o=r.image;e_(o)?s=o.videoWidth/o.videoHeight:s=o.width/o.height,i>s&&(r.imageType=="WEBCAM"?r.repeat.set(-1,1*s/i):r.repeat.set(1,1*s/i)),i<s&&(r.imageType=="WEBCAM"?r.repeat.set(1*i/s*-1,1):r.repeat.set(1*i/s,1)),i==s&&(r.imageType=="WEBCAM"?r.repeat.set(-1,1):r.repeat.set(1,1))}static resizeTextureLayer(e,t,r){let i=e/t,s=r.image!==void 0?r.image.width/r.image.height:1,o;i>s?o={x:1,y:s/i}:i<s?o={x:i/s,y:1}:o={x:1,y:1},r.repeat.set(o.x,o.y),r.updateMatrix()}static resizeTextureLayers(e,t,r){let i=r.layers;for(let s=0;s<i.length;s++){let o=i[s];N1(o)&&Nl.resizeTextureLayer(e,t,o.uniforms[`f${o.id}_texture`].value)}}static resizeComplex(e,t,r,i){let s=e/t,o,a=r.image;e_(a)?o=a.videoWidth/a.videoHeight:o=a.width/a.height,i.geometry.type.includes("Shape")?(s>o&&(r.imageType=="WEBCAM"?r.repeat.set(1/e*-1,1/t*o/s):r.repeat.set(1/e,1/t*o/s)),s<o&&(r.imageType=="WEBCAM"?r.repeat.set(1/e*s/o*-1,1/t):r.repeat.set(1/e*s/o,1/t)),s==o&&(r.imageType=="WEBCAM"?r.repeat.set(1/e*-1,1/t):r.repeat.set(1/e,1/t))):(s>o&&(r.imageType=="WEBCAM"?r.repeat.set(-1,1*o/s):r.repeat.set(1,1*o/s)),s<o&&(r.imageType=="WEBCAM"?r.repeat.set(1*s/o*-1,1):r.repeat.set(1*s/o,1)),s==o&&(r.imageType=="WEBCAM"?r.repeat.set(-1,1):r.repeat.set(1,1)))}};var Nf=class extends Pt{constructor(t,r){super(t,r);this.objectType="Mesh2D";this.castShadow=!0,this.receiveShadow=!0}updateGeometry(t){super.updateGeometry(t),this.material.layers&&Nl.resizeTextureLayers(this.geometry.userData.parameters.width,this.geometry.userData.parameters.height,this.material)}};var Bl=class extends Pt{constructor(t,r){super(t,r);this.objectType="Mesh3D";this.castShadow=!0,this.receiveShadow=!0}};var Bf=class extends Bl{constructor(t,r){super(t,r);this.objectType="NonParametric"}};var Of=class extends gs{constructor(e){super(e)}load(e,t,r,i){let s=this,o=new ys(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(s.withCredentials),o.load(e,function(a){let l;try{l=JSON.parse(a)}catch{console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),l=JSON.parse(a.substring(65,a.length-2))}let u=s.parse(l);t&&t(u)},r,i)}parse(e){return new Gy(e)}},Gy=class{constructor(e){this.isFont=!0,this.type="Font",this.data=e}generateShapes(e,t=100){let r=[],i=_F(e,t,this.data);for(let s=0,o=i.length;s<o;s++)r.push(...i[s].toShapes());return r}};function _F(n,e,t){let r=Array.from(n),i=e/t.resolution,s=(t.boundingBox.yMax-t.boundingBox.yMin+t.underlineThickness)*i,o=[],a=0,l=0;for(let u=0;u<r.length;u++){let c=r[u];if(c===`
4906
4906
  `)a=0,l-=s;else{let h=AF(c,i,a,l,t);a+=h.offsetX,o.push(h.path)}}return o}function AF(n,e,t,r,i){let s=i.glyphs[n]||i.glyphs["?"];if(!s){console.error('THREE.Font: character "'+n+'" does not exists in font family '+i.familyName+".");return}let o=new Vh,a,l,u,c,h,d,f,m;if(s.o){let p=s._cachedOutline||(s._cachedOutline=s.o.split(" "));for(let g=0,y=p.length;g<y;)switch(p[g++]){case"m":a=p[g++]*e+t,l=p[g++]*e+r,o.moveTo(a,l);break;case"l":a=p[g++]*e+t,l=p[g++]*e+r,o.lineTo(a,l);break;case"q":u=p[g++]*e+t,c=p[g++]*e+r,h=p[g++]*e+t,d=p[g++]*e+r,o.quadraticCurveTo(h,d,u,c);break;case"b":u=p[g++]*e+t,c=p[g++]*e+r,h=p[g++]*e+t,d=p[g++]*e+r,f=p[g++]*e+t,m=p[g++]*e+r,o.bezierCurveTo(h,d,f,m,u,c);break}}return{offsetX:s.ha*e,path:o}}var $t=class extends kt{constructor({char:t,originalChar:r,fontFamily:i,letterSpacing:s,fontSize:o,LOD:a=16},l=new ii({color:0,opacity:1,visible:!0,transparent:!0,side:xr})){let u=$t.loadChar(t,i,a);super(u.geometry,l);this.char=t,this.originalChar=r??t,this.fontFamily=i,this.letterSpacing=s,this.fontSize=o,this.LOD=a,this.resolution=u.resolution,this.glyphsHa=u.glyphsHa,this.localPosition=new B,this.charSize=0,this.geometry.userData={type:"CharacterGeometry",parameters:{char:this.char,fontFamily:this.fontFamily,letterSpacing:this.letterSpacing,fontSize:this.fontSize,lod:this.LOD,resolution:this.resolution,charSize:this.charSize,localPosition:this.localPosition}},this.updateFontSize(this.fontSize)}static get FONTS_PATH(){return $t._fontPath}static set FONTS_PATH(t){$t._fontPath=t}updatePosition(t,r){this.localPosition.copy(t);let i=new _(this.localPosition.x,-this.localPosition.y,0);this.position.copy(i).add(r)}updateFontSize(t){let r=t/this.resolution;this.fontSize=t,this.scale.set(this.fontSize,this.fontSize,1),this.charSize=this.glyphsHa*r*this.letterSpacing}updateFontFamily(t){if(this.fontFamily===t)return;this.fontFamily=t;let r=$t.loadChar(this.char,t,this.LOD);this.geometry=r.geometry,this.resolution=r.resolution,this.glyphsHa=r.glyphsHa,this.geometry.userData={type:"CharacterGeometry",parameters:{char:this.char,fontFamily:this.fontFamily,letterSpacing:this.letterSpacing,fontSize:this.fontSize,lod:this.LOD,resolution:this.resolution,charSize:this.charSize,localPosition:this.localPosition}},this.updateFontSize(this.fontSize)}updateChar(t){if(this.char===t)return;this.char=t;let r=$t.loadChar(t,this.fontFamily,this.LOD);this.geometry=r.geometry,this.resolution=r.resolution,this.glyphsHa=r.glyphsHa,this.geometry.userData={type:"CharacterGeometry",parameters:{char:this.char,fontFamily:this.fontFamily,letterSpacing:this.letterSpacing,fontSize:this.fontSize,lod:this.LOD,resolution:this.resolution,charSize:this.charSize,localPosition:this.localPosition}},this.updateFontSize(this.fontSize)}updateLetterSpacing(t){this.letterSpacing!==t&&(this.letterSpacing=t,this.updateFontSize(this.fontSize))}updateLOD(t){if(this.LOD===t)return;this.LOD=t;let r=$t.loadChar(this.char,this.fontFamily,this.LOD);this.geometry=r.geometry,this.resolution=r.resolution,this.glyphsHa=r.glyphsHa,this.geometry.userData={type:"CharacterGeometry",parameters:{char:this.char,fontFamily:this.fontFamily,letterSpacing:this.letterSpacing,fontSize:this.fontSize,lod:this.LOD,resolution:this.resolution,charSize:this.charSize,localPosition:this.localPosition}},this.updateFontSize(this.fontSize)}clone(){let t={char:this.char,originalChar:this.originalChar,fontFamily:this.fontFamily,letterSpacing:this.letterSpacing,fontSize:this.fontSize,LOD:this.LOD};return new $t(t).copy(this)}static loadFont(t){return new Promise(function(r,i){$t.fontCache[t]?r($t.fontCache[t]):new Of().load($t.FONTS_PATH+t+".json",o=>{$t.fontCache[t]=o,r(o)},void 0,i)})}static loadChar(t,r,i){if($t.charCache[t]){if($t.charCache[t][i]&&$t.charCache[t][i].fontFamily===r)return $t.charCache[t][i]}else $t.charCache[t]={};let s=$t.fontCache[r],o=s.generateShapes(t,1);return $t.charCache[t][i]={geometry:new ya(o,i),fontFamily:r,resolution:s.data.resolution,glyphsHa:s.data.glyphs[t].ha},$t.charCache[t][i]}},Qn=$t;Qn.charCache={},Qn.fontCache={},Qn._fontPath="/_assets/_fonts/";var Ff=new B,Lo=class{constructor(e,t,r){this.message=[];this.endLine=!0;this.yLinePos=e,this.lineHeight=t,this.maxCharSize=r,this.nextChar3DPos=new B(0,this.yLinePos+this.maxCharSize*this.lineHeight),this.align=1}addChar3D(e,t,r=this.message.length){this.message.splice(r,0,e),e.fontSize>this.maxCharSize?(this.maxCharSize=e.fontSize,this.nextChar3DPos.y=this.yLinePos+this.maxCharSize*this.lineHeight,this.fullUpdate(t)):(e.updatePosition(this.nextChar3DPos,t),this.nextChar3DPos.x+=e.charSize)}deleteChar3D(e=this.message.length-1){let t=this.message[e];if(t)return this.message.splice(e,1),this.nextChar3DPos.x-=t.charSize,t}isEndLine(e){this.endLine=e}fullUpdate(e,t=0){this.nextChar3DPos.x=0;for(let r=t,i=this.message.length;r<i;r+=1)this.message[r].updatePosition(this.nextChar3DPos,e),this.nextChar3DPos.x+=this.message[r].charSize}checkOverFlow(e){let t,r=this.message.length-1;if(r<=0)return!1;for(;r>=0;){if(this.message[r].char!==" "){t=this.message[r];break}r-=1}return!!(r>=0&&t&&t.localPosition.x+t.charSize>e)}containSpaceOverFlow(e=this.message.length-1){for(let t=e;t>=0;t-=1)if(this.message[t].char===" ")return!0;return!1}containSpace(e=this.message.length-1){if(this.endLine)return!0;for(let t=e;t>=0;t-=1)if(this.message[t].char===" ")return!0;return!1}popWord(e=this.message.length-1){let t=[],r=!0,i;for(i=e;i>=0;i-=1)if(this.message[i].char===" "){r=!1,t.length===0&&(i-=1,t.splice(0,0,this.message[i]));break}else t.splice(0,0,this.message[i]);return r?t=[]:this.message.splice(i+1,t.length),t}getWord(e=0,t=1){let r=[],i=e;for(i=e;;i+=t){if(!this.message[i]||this.message[i].char===" "){r.length===0&&this.message[i]&&(r.push(this.message[i]),this.message.splice(i,1));break}t>0?(r.push(this.message[i]),this.message.splice(i,1),i-=t):(r.splice(0,0,this.message[i]),this.message.splice(i,1))}return r}getWordAtIndex(e){let t=[];for(let r=e;r<this.message.length&&this.message[r].char!==" ";r++)t.push(this.message[r]);for(let r=e-1;r>=0&&this.message[r].char!==" ";r--)t.splice(0,0,this.message[r]);return t}wordSize(e=0,t=-1){let r=0,i=e;for(;i>=0&&i<this.message.length;){if(this.message[i].char===" "){r===0&&(r=this.message[i].charSize);break}r+=this.message[i].charSize,i+=t}return(i<0||i>=this.message.length)&&!this.endLine?this.message[e]?this.message[e].charSize:999999999:r===0?999999999:r}spaceLeft(e){return e-this.nextChar3DPos.x}popChar(e=this.message.length-1){return this.nextChar3DPos.x-=this.message[e].charSize,this.message.splice(e,1)}isEmpty(){return!this.message.length}updateNextCharPosY(){this.nextChar3DPos.y=this.yLinePos+this.maxCharSize*this.lineHeight}updateYLinePos(e){this.yLinePos=e,this.updateNextCharPosY()}updatelineHeight(e){this.lineHeight=e,this.updateNextCharPosY()}updateFontSize(e,t=0,r=this.message.length-1){for(let i=t;i<=r;i+=1)this.message[i].updateFontSize(e);this.maxCharSize=e,this.nextChar3DPos.y=this.yLinePos+this.maxCharSize*this.lineHeight}countSpaces(){let e=0;for(let t=0;t<this.message.length;t++)this.message[t].char===" "&&(e+=1);return e}alignText(e,t,r,i,s){switch(r){case 1:this.leftAlign(e,s);break;case 3:this.centerAlign(this.spaceLeft(t),e,s);break;case 2:this.rightAlign(this.spaceLeft(t),e,s);break;case 4:this.justifyAlign(this.spaceLeft(t),e,s);break}}offsetCharacters(e,t,r){Ff.set(t,r);let i=this.message.length;for(let s=0;s<i;s++)this.message[s].updatePosition(this.message[s].localPosition.add(Ff),e)}leftAlign(e,t){this.align=1,this.offsetCharacters(e,0,t)}centerAlign(e,t,r){this.align=3,this.offsetCharacters(t,e/2,r)}rightAlign(e,t,r){this.align=2,this.offsetCharacters(t,e,r)}justifyAlign(e,t,r){if(this.align=4,this.endLine){this.offsetCharacters(t,0,r);return}let i=this.countSpaces();if(i===0){this.offsetCharacters(t,0,r);return}let s=e/i,o=0;for(let a=0;a<this.message.length;a++)this.message[a].char===" "&&(o+=s),Ff.set(o,r),this.message[a].updatePosition(this.message[a].localPosition.add(Ff),t)}clone(){let e=new Lo(this.yLinePos,this.lineHeight,this.maxCharSize);e.nextChar3DPos=this.nextChar3DPos.clone(),e.align=this.align,e.endLine=this.endLine;for(let t=0;t<this.message.length;t++)e.message.push(this.message[t].clone());return e}};var ky=class extends Pt{constructor(t){super(t,new ii({transparent:!0,opacity:1,visible:!1,side:xr}));this.objectType="TextFrame";this.charContainer=new ot,this.add(this.charContainer),this.material.visible=!1,this._geometryUserData=t.userData,this.userData.textFrame={hexColor:null,opacity:1,visible:!0,text:"",fontSize:16,lineHeight:1.5,letterSpacing:1,fontFamily:"roboto_regular",textTransform:1,horizontalAlignment:1,verticalAlignment:1,LOD:16,maxLineSize:this._geometryUserData.parameters.width,textOrigin:new _(this._geometryUserData.parameters.width*-.5,this._geometryUserData.parameters.height*.5,0),textLines:[]},this.createTextLine()}static createFromState(t,r,i){let s=mf.create({parameters:{width:r.width,height:r.height}}),o=new ky(s).fromState(r,i);return o.uuid=t,o}async updateText(t){this.clearText();let r=this.userData.textFrame,i=r.fontFamily;await Qn.loadFont(i),r.text=t;let s=r.textOrigin,o=new ii({visible:r.visible,transparent:!0,side:xr}),a=t.split(`
4907
4907
  `),l=0;this.userData.textFrame.textLines=a.map((u,c)=>{let h=new Lo(l,r.lineHeight,r.fontSize);return h.message=u.split("").map(d=>{let f={char:d,fontFamily:i,letterSpacing:r.letterSpacing,fontSize:r.fontSize,LOD:16},m=o.clone();m.color=r.hexColor,m.opacity=r.opacity;let p=new Qn(f,m);return h.addChar3D(p,s),this.charContainer.add(p),p}),l+=h.maxCharSize*h.lineHeight,h}),this.textFullUpdate(),this.checkOverFlow()}clearText(){let t=this.userData.textFrame.textLines;for(;this.charContainer.children.length;){let r=this.charContainer.children[0];this.charContainer.remove(r)}for(;t.length;)t.pop()}raycast(t,r){let i=[];if(super.raycast(t,i),i.length>0){r.push(i[0]);return}let s=[];for(let o=0,a=this.charContainer.children.length;o<a;++o)if(this.charContainer.children[o]instanceof Qn&&(t.intersectObject(this.charContainer.children[o],!1,s),s.length>0)){s[0].object=this,r.push(s[0]);return}}updateGeometry(t){let r=this.userData,i=this.geometry.userData,s=i.parameters.width,o=i.parameters.height,a=t.parameters?.width??s,l=t.parameters?.height??o,u=r.textFrame;super.updateGeometry(t),u.maxLineSize=a,u.textOrigin.set(-.5*a,.5*l,0),l!==o?(this.checkOverFlow(),this.checkCapacity()):a!==s&&(s<a?this.checkCapacity():s>a&&this.checkOverFlow())}checkOverFlow(t=0){let r=this.userData,i=r.textFrame.textOrigin,s=r.textFrame.textLines;for(let o=t;o<s.length;o++){s[o].updateYLinePos(this.getNewLinePosition(o)),s[o].fullUpdate(i);let a=[];for(;s[o].checkOverFlow(r.textFrame.maxLineSize);)s[o].containSpaceOverFlow()?a.unshift(s[o].getWord(s[o].message.length-1,-1)):a.unshift(s[o].popChar());if(a.length>0){s[o+1]===void 0?(s[o].isEndLine(!1),this.createTextLine()):s[o].endLine&&(this.createTextLine(o+1),s[o].isEndLine(!1),s[o+1].isEndLine(!0));let l=0;for(let u=0;u<a.length;u+=1)for(let c=0;c<a[u].length;c+=1)s[o+1].addChar3D(a[u][c],i,l),l+=1;s[o+1].fullUpdate(i)}s[o].fullUpdate(i)}this.textFullUpdate(t)}checkCapacity(t=0){let r=this.userData,i=r.textFrame.textOrigin,s=r.textFrame.maxLineSize,o=r.textFrame.textLines;for(let a=t;a<o.length;a+=1)if(o[a].updateYLinePos(this.getNewLinePosition(a)),o[a].fullUpdate(i),!!o[a-1])for(;!o[a-1].endLine;){let l,u=o[a-1].spaceLeft(s);if(o[a].wordSize(0,1)<=u){o[a].containSpace()?l=o[a].getWord(0,1):l=o[a].popChar(0);for(let c=0;c<l.length;c+=1)l[c]&&o[a-1].addChar3D(l[c],i)}else{o[a].isEmpty()?(o[a].endLine&&o[a-1].isEndLine(!0),o.splice(a,1),a-=1):(o[a].updateYLinePos(this.getNewLinePosition(a)),o[a].fullUpdate(i));break}}this.textFullUpdate(t)}createTextLine(t=this.userData.textFrame.textLines.length){let i=this.userData.textFrame;i.textLines.splice(t,0,new Lo(this.getNewLinePosition(t),i.lineHeight,i.fontSize))}textFullUpdate(t=0){let i=this.userData.textFrame,s=i.textLines,o=this.getVerticalAlignmentOffSet();for(let a=t;a<s.length;a++)s[a].updateYLinePos(this.getNewLinePosition(a)),s[a].fullUpdate(i.textOrigin),s[a].alignText(i.textOrigin,i.maxLineSize,i.horizontalAlignment,i.verticalAlignment,o)}getVerticalAlignmentOffSet(){switch(this.userData.textFrame.verticalAlignment){case 1:return 0;case 2:return this.getRemainingVerticalSpace()/2;case 3:return this.getRemainingVerticalSpace();default:return 0}}getRemainingVerticalSpace(){let r=this.userData.textFrame.textLines;return this.geometry.userData.parameters.height-this.getNewLinePosition(r.length)}getNewLinePosition(t){let i=this.userData.textFrame.textLines,s=0;for(let o=0;o<t;o+=1)s+=i[o].maxCharSize*i[o].lineHeight;return s}updateColor(t){let r=this.userData;r.textFrame.hexColor=t;let i=r.textFrame.textLines;for(let s=0;s<i.length;s++){let o=i[s].message;for(let a=0;a<o.length;a++){let l=o[a].material;l.color?.isColor&&(l.color=t)}}}updateOpacity(t){let r=this.userData;r.textFrame.opacity=t;let i=r.textFrame.textLines;for(let s=0;s<i.length;s++){let o=i[s].message;for(let a=0;a<o.length;a++){let l=o[a].material;l.opacity=t}}}updateVisible(t){let r=this.userData;r.textFrame.visible=t;let i=r.textFrame.textLines;for(let s=0;s<i.length;s++){let o=i[s].message;for(let a=0;a<o.length;a++){let l=o[a].material;l.visible=t}}}async updateFontFamily(t){await Qn.loadFont(t);let i=this.userData.textFrame,s=i.textLines;i.fontFamily=t;for(let o=0;o<s.length;o++){let a=s[o].message;for(let l=0;l<a.length;l++)a[l].updateFontFamily(t)}this.textFullUpdate(),this.checkOverFlow(),this.checkCapacity()}updateFontSize(t){let i=this.userData.textFrame,s=i.textLines,o=i.fontSize;i.fontSize=t;for(let a=0;a<s.length;a++)s[a].updateFontSize(t);this.textFullUpdate(),t>o?this.checkOverFlow():t<o&&this.checkCapacity()}async updateTextTransform(t){let i=this.userData.textFrame;await Qn.loadFont(i.fontFamily);let s=i.textLines;switch(i.textTransform=t,t){case 2:for(let o=0;o<s.length;o++){let a=s[o].message;for(let l=0;l<a.length;l++)s[o].message[l].updateChar(a[l].char.toUpperCase())}break;case 3:for(let o=0;o<s.length;o++){let a=s[o].message;for(let l=0;l<a.length;l++)s[o].message[l].updateChar(a[l].char.toLowerCase())}break;default:for(let o=0;o<s.length;o++){let a=s[o].message;for(let l=0;l<a.length;l++)s[o].message[l].updateChar(a[l].originalChar)}}this.textFullUpdate(),this.checkOverFlow(),this.checkCapacity()}updateLetterSpacing(t){let r=this.userData,i=r.textFrame.textLines;r.textFrame.letterSpacing=t;for(let s=0;s<i.length;s++){let o=i[s].message;for(let a=0;a<o.length;a++)o[a].updateLetterSpacing(t)}this.textFullUpdate(),this.checkOverFlow(),this.checkCapacity()}updateLOD(t){let r=this.userData;r.textFrame.LOD=t;let i=r.textFrame.textLines;for(let s=0;s<i.length;s++);this.textFullUpdate(),this.checkOverFlow(),this.checkCapacity()}updateLineHeight(t){let r=this.userData,i=r.textFrame.textLines;r.textFrame.lineHeight=t;for(let s=0;s<i.length;s++)i[s].updatelineHeight(t);this.textFullUpdate()}updateVerticalAlignment(t){let r=this.userData;r.textFrame.verticalAlignment=t,this.textFullUpdate()}updateHorizontalAlignment(t){let r=this.userData;r.textFrame.horizontalAlignment=t,this.textFullUpdate()}fromTextFrameData(t,r){if(t.color!==void 0){let i=or(t.color,r);this.updateColor(i),this.updateOpacity(i.a)}t.alpha!==void 0&&this.updateOpacity(t.alpha),t.font!==void 0&&this.updateFontFamily(t.font),t.horizontalAlign!==void 0&&this.updateHorizontalAlignment(t.horizontalAlign),t.verticalAlign!==void 0&&this.updateVerticalAlignment(t.verticalAlign),t.textTransform!==void 0&&this.updateTextTransform(t.textTransform),t.fontSize!==void 0&&this.updateFontSize(t.fontSize),t.lineHeight!==void 0&&this.updateLineHeight(t.lineHeight),t.letterSpacing!==void 0&&this.updateLetterSpacing(t.letterSpacing),t.text!==void 0&&t.text!==""&&this.updateText(t.text),(t.width!==void 0||t.height!==void 0)&&this.updateGeometry({parameters:{width:t.width,height:t.height}})}fromState(t,r){return super.fromState(t),this.fromTextFrameData(t,r),this}},Ro=ky;Ro.VerticalAlign=Lg,Ro.HorizontalAlign=Ig,Ro.TextTransform=Rg;var No=class extends vn{};var i_=Ev(t_());var r_=new Map;function n_(n){if(typeof n=="string")return n;let e=r_.get(n);return e||(e={url:URL.createObjectURL(new Blob([n]))},r_.set(n,e)),e.url}var Ws=class{constructor({src:e,volume:t,delay:r,loop:i}){this._volume=1;this.delay=0;this._loop=1;this.loopsRemaining=0;this._isStarted=!1;this.onEnd=()=>{this._loop>1?this.loopsRemaining===1/0?this.play():this.loopsRemaining>1?(this.play(),this.loopsRemaining--):this._isStarted=!1:this._isStarted=!1};let s;typeof e=="string"?s={src:e}:s={src:n_(e),format:"wav"},this.sound=new i_.Howl(s),this.sound.on("end",this.onEnd),this._src=e,t!==void 0&&(this.volume=t),r!==void 0&&(this.delay=r),i!==void 0&&(this.loop=i)}get src(){return this._src}get isStarted(){return this._isStarted}get volume(){return this._volume}set volume(e){this._volume=e,this.sound.volume(e)}get loop(){return this._loop}set loop(e){this._loop=e,this.loopsRemaining=e}fade(e,t=1e3){e?(this.sound.volume(this._volume),this.clearFade(),this.fadeTimerId=window.setTimeout(()=>{this.sound.fade(this._volume,0,t),this.clearFade()},e)):this.sound.fade(this._volume,0,t)}on(e,t,r){this.sound.on(e,t,r)}off(e,t,r){this.sound.off(e,t,r)}play(){this._isStarted=!0,this.delay?(this.clearDelay(),this.delayTimerId=window.setTimeout(()=>{this.sound.play(),this.clearDelay()},this.delay)):this.sound.play()}pause(){this._isStarted=!1,this.sound.pause(),this.clearFade(),this.clearDelay()}stop(){this._isStarted=!1,this.sound.stop(),this.loopsRemaining=this._loop,this.clearFade(),this.clearDelay()}clearFade(){this.fadeTimerId&&(clearTimeout(this.fadeTimerId),delete this.fadeTimerId)}clearDelay(){this.delayTimerId&&(clearTimeout(this.delayTimerId),delete this.delayTimerId)}dispose(e=!1){this.off(),this.stop(),this.clearFade(),this.clearDelay()}};var zu=class{constructor(e){this.deletedMaterial=new No(gn.defaultTwoLayerData("basic"),this);this.deletedImage=new Do(nf.emptyImage);this.materials={};this.images={};this.colors={};this.audios={};this.penumbraSize=[];this.onImageLoad=()=>{this._onImageLoad&&this._onImageLoad()};this.reset(e)}setOnImageLoad(e){this._onImageLoad=e}reset(e){for(let[t,r]of Object.entries(e.images))this.addImage(t,r);for(let[t,r]of Object.entries(e.colors))this.addColor(t,r);for(let[t,r]of Object.entries(e.materials))this.addMaterial(t,new No(r,this));for(let[t,r]of Object.entries(e.audios))this.addAudio(t,r.data);this.penumbraSize=e.penumbraSize}addMaterial(e,t){t.uuid=e,this.materials[e]=t}deleteMaterial(e){this.materials[e]&&(this.materials[e].dispose(),delete this.materials[e])}getMaterial(e){let t=this.materials[e];return t}getMaterialOrDeletedPlaceholder(e){return this.materials[e]??this.deletedMaterial}material(e){return typeof e=="string"?this.getMaterialOrDeletedPlaceholder(e):new vn(e,this)}getMaterials(){return this.materials}addImage(e,t){return this.images[e]?(this.images[e].updateSrc(t.data),!0):(this.images[e]=new Do(t,this.onImageLoad),!1)}deleteImage(e){this.images[e]&&delete this.images[e]}getDefaultImage(){return this.images.image_0}getImage(e){return this.images[e]??this.deletedImage}image(e){return typeof e=="string"?this.getImage(e):new Al(e,this.onImageLoad)}getImages(){return this.images}addColor(e,t){return this.colors[e]?("a"in t?this.colors[e].setRGBA(t.r,t.g,t.b,t.a):this.colors[e].setRGBA(t.r,t.g,t.b,1),!0):("a"in t?this.colors[e]=new Gs(t.r,t.g,t.b,t.a):this.colors[e]=new Gs(t.r,t.g,t.b,1),!1)}updateColor(e,t){if(this.colors[e]){let r=this.colors[e];return this.colors[e].r=t.r??r.r,this.colors[e].g=t.g??r.g,this.colors[e].b=t.b??r.b,this.colors[e].a=t.a??r.a,!0}return!1}deleteColor(e){this.colors[e]&&delete this.colors[e]}getColor(e){return this.colors[e]}color(e){let t;if(typeof e=="string"){let r=this.getColor(e);r?t=r:(console.warn("Tried to create color layer params with a color key that does not exist in the assets manager"),t=new dr(0,0,0,0))}else return"a"in e?new dr(e.r,e.g,e.b,e.a):new dr(e.r,e.g,e.b,1);return t}addAudio(e,t){this.audios[e]=t}getAudio(e){let t=this.audios[e];if(t instanceof Ws)return t;{let r=new Ws({src:t});return this.audios[e]=r,r}}deleteAudio(e){this.audios[e]&&delete this.audios[e]}dispose(){Object.keys(this.materials).forEach(t=>this.deleteMaterial(t)),this._onImageLoad=void 0,Object.values(this.audios).forEach(t=>{t instanceof Ws&&t.dispose()}),this.audios={}}},Qse=new zu(rf.emptyData());var Vy=new WeakMap,zf=class extends gs{constructor(e){super(e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,t,r,i){let s=new ys(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,o=>{let a={attributeIDs:this.defaultAttributeIDs,attributeTypes:this.defaultAttributeTypes,useUniqueIDs:!1};this.decodeGeometry(o,a).then(t).catch(i)},r,i)}decodeDracoFile(e,t,r,i){let s={attributeIDs:r||this.defaultAttributeIDs,attributeTypes:i||this.defaultAttributeTypes,useUniqueIDs:!!r};this.decodeGeometry(e,s).then(t)}decodeGeometry(e,t){for(let l in t.attributeTypes){let u=t.attributeTypes[l];u.BYTES_PER_ELEMENT!==void 0&&(t.attributeTypes[l]=u.name)}let r=JSON.stringify(t);if(Vy.has(e)){let l=Vy.get(e);if(l.key===r)return l.promise;if(e.byteLength===0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let i,s=this.workerNextTaskID++,o=e.byteLength,a=this._getWorker(s,o).then(l=>(i=l,new Promise((u,c)=>{i._callbacks[s]={resolve:u,reject:c},i.postMessage({type:"decode",id:s,taskConfig:t,buffer:e},[e])}))).then(l=>this._createGeometry(l.geometry));return a.catch(()=>!0).then(()=>{i&&s&&this._releaseTask(i,s)}),Vy.set(e,{key:r,promise:a}),a}_createGeometry(e){let t=new De;e.index&&t.setIndex(new je(e.index.array,1));for(let r=0;r<e.attributes.length;r++){let i=e.attributes[r],s=i.name,o=i.array,a=i.itemSize;t.setAttribute(s,new je(o,a))}return t}_loadLibrary(e,t){let r=new ys(this.manager);return r.setPath(this.decoderPath),r.setResponseType(t),r.setWithCredentials(this.withCredentials),new Promise((i,s)=>{r.load(e,i,void 0,s)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;let e=typeof WebAssembly!="object"||this.decoderConfig.type==="js",t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(r=>{let i=r[0];e||(this.decoderConfig.wasmBinary=r[1]);let s=MF.toString(),o=["/* draco decoder */",i,"","/* worker */",s.substring(s.indexOf("{")+1,s.lastIndexOf("}"))].join(`
4908
4908
  `);this.workerSourceURL=URL.createObjectURL(new Blob([o]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){let i=new Worker(this.workerSourceURL);i._callbacks={},i._taskCosts={},i._taskLoad=0,i.postMessage({type:"init",decoderConfig:this.decoderConfig}),i.onmessage=function(s){let o=s.data;switch(o.type){case"decode":i._callbacks[o.id].resolve(o);break;case"error":i._callbacks[o.id].reject(o);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+o.type+'"')}},this.workerPool.push(i)}else this.workerPool.sort(function(i,s){return i._taskLoad>s._taskLoad?-1:1});let r=this.workerPool[this.workerPool.length-1];return r._taskCosts[e]=t,r._taskLoad+=t,r})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this}};function MF(){let n,e;onmessage=function(o){let a=o.data;switch(a.type){case"init":n=a.decoderConfig,e=new Promise(function(c){n.onModuleLoaded=function(h){c({draco:h})},DracoDecoderModule(n)});break;case"decode":let l=a.buffer,u=a.taskConfig;e.then(c=>{let h=c.draco,d=new h.Decoder,f=new h.DecoderBuffer;f.Init(new Int8Array(l),l.byteLength);try{let m=t(h,d,f,u),p=m.attributes.map(g=>g.array.buffer);m.index&&p.push(m.index.array.buffer),self.postMessage({type:"decode",id:a.id,geometry:m},p)}catch(m){console.error(m),self.postMessage({type:"error",id:a.id,error:m.message})}finally{h.destroy(f),h.destroy(d)}});break}};function t(o,a,l,u){let c=u.attributeIDs,h=u.attributeTypes,d,f,m=a.GetEncodedGeometryType(l);if(m===o.TRIANGULAR_MESH)d=new o.Mesh,f=a.DecodeBufferToMesh(l,d);else if(m===o.POINT_CLOUD)d=new o.PointCloud,f=a.DecodeBufferToPointCloud(l,d);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!f.ok()||d.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+f.error_msg());let p={index:null,attributes:[]};for(let g in c){let y=self[h[g]],x,w;if(u.useUniqueIDs)w=c[g],x=a.GetAttributeByUniqueId(d,w);else{if(w=a.GetAttributeId(d,o[c[g]]),w===-1)continue;x=a.GetAttribute(d,w)}p.attributes.push(i(o,a,d,g,y,x))}return m===o.TRIANGULAR_MESH&&(p.index=r(o,a,d)),o.destroy(d),p}function r(o,a,l){let c=l.num_faces()*3,h=c*4,d=o._malloc(h);a.GetTrianglesUInt32Array(l,h,d);let f=new Uint32Array(o.HEAPF32.buffer,d,c).slice();return o._free(d),{array:f,itemSize:1}}function i(o,a,l,u,c,h){let d=h.num_components(),m=l.num_points()*d,p=m*c.BYTES_PER_ELEMENT,g=s(o,c),y=o._malloc(p);a.GetAttributeDataArrayForAllPoints(l,h,g,p,y);let x=new c(o.HEAPF32.buffer,y,m).slice();return o._free(y),{name:u,array:x,itemSize:d}}function s(o,a){switch(a){case Float32Array:return o.DT_FLOAT32;case Int8Array:return o.DT_INT8;case Int16Array:return o.DT_INT16;case Int32Array:return o.DT_INT32;case Uint8Array:return o.DT_UINT8;case Uint16Array:return o.DT_UINT16;case Uint32Array:return o.DT_UINT32}}}var js;function TF(){return js||(js=new zf,js.setDecoderPath("https://www.gstatic.com/draco/versioned/decoders/1.5.2/").preload()),js.decoderPending}async function EF(n){if(js){let e={attributeIDs:js.defaultAttributeIDs,attributeTypes:js.defaultAttributeTypes,useUniqueIDs:!1},t;try{t=await js.decodeGeometry(new Int8Array(n).buffer,e)}catch(r){console.error(r)}if(t)return{index:t.index?{array:t.index.array}:void 0,attributes:Object.entries(t.attributes).map(([r,i])=>({name:r,itemSize:i.itemSize,array:i.array}))}}return null}async function s_(n,e){let[t,r]=mg(jd.deserialize(new Uint8Array(n)));wS(t);let i=[];t.scene.objects.traverse((s,o)=>{o.type==="Mesh"&&o.geometry.type==="NonParametricGeometry"&&o.geometry.data.draco!==void 0&&i.push(o)}),i.length&&await TF();for(let s of i){let o=await EF(li(s.geometry.data.draco));if(o){o.index&&(s.geometry.data.index={array:o.index.array,itemSize:1,normalized:!1,type:"Uint32Array"});let a={};o.attributes.forEach(({name:l,array:u,itemSize:c})=>{a[l]={array:u,itemSize:c,type:"Float32Array",normalized:!1}}),s.geometry.data.attributes=a,s.geometry.data.draco=void 0}}return e&&e(t),r.result().data}var h_={update:null,begin:null,loopBegin:null,changeBegin:null,change:null,changeComplete:null,loopComplete:null,complete:null,loop:1,direction:"normal",autoplay:!0,timelineOffset:0,rewind:!0},qy={duration:1e3,delay:0,endDelay:0,easing:"easeOutElastic(1, .5)",round:0},CF=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY","perspective","matrix","matrix3d"],kf={CSS:{},springs:{}};function Ti(n,e,t){return Math.min(Math.max(n,e),t)}function Gu(n,e){return n.indexOf(e)>-1}function Hy(n,e){return n.apply(null,e)}var ke={arr:function(n){return Array.isArray(n)},obj:function(n){return Gu(Object.prototype.toString.call(n),"Object")},pth:function(n){return ke.obj(n)&&n.hasOwnProperty("totalLength")},svg:function(n){return n instanceof SVGElement},inp:function(n){return n instanceof HTMLInputElement},dom:function(n){return!("isNode"in n)&&(n.nodeType||ke.svg(n))},str:function(n){return typeof n=="string"},fnc:function(n){return typeof n=="function"},und:function(n){return typeof n>"u"},hex:function(n){return/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(n)},rgb:function(n){return/^rgb/.test(n)},hsl:function(n){return/^hsl/.test(n)},col:function(n){return ke.hex(n)||ke.rgb(n)||ke.hsl(n)},key:function(n){return!h_.hasOwnProperty(n)&&!qy.hasOwnProperty(n)&&n!=="targets"&&n!=="keyframes"}};function d_(n){var e=/\(([^)]+)\)/.exec(n);return e?e[1].split(",").map(function(t){return parseFloat(t)}):[]}function f_(n,e){var t=d_(n),r=Ti(ke.und(t[0])?1:t[0],.1,100),i=Ti(ke.und(t[1])?100:t[1],.1,100),s=Ti(ke.und(t[2])?10:t[2],.1,100),o=Ti(ke.und(t[3])?0:t[3],.1,100),a=Math.sqrt(i/r),l=s/(2*Math.sqrt(i*r)),u=l<1?a*Math.sqrt(1-l*l):0,c=1,h=l<1?(l*a+-o)/u:-o+a;function d(m){var p=e?e*m/1e3:m;return l<1?p=Math.exp(-p*l*a)*(c*Math.cos(u*p)+h*Math.sin(u*p)):p=(c+h*p)*Math.exp(-p*a),m===0||m===1?m:1-p}function f(){var m=kf.springs[n];if(m)return m;for(var p=1/6,g=0,y=0;;)if(g+=p,d(g)===1){if(y++,y>=16)break}else y=0;var x=g*p*1e3;return kf.springs[n]=x,x}return e?d:f}function PF(n){return n===void 0&&(n=10),function(e){return Math.ceil(Ti(e,1e-6,1)*n)*(1/n)}}var DF=function(){var n=11,e=1/(n-1);function t(c,h){return 1-3*h+3*c}function r(c,h){return 3*h-6*c}function i(c){return 3*c}function s(c,h,d){return((t(h,d)*c+r(h,d))*c+i(h))*c}function o(c,h,d){return 3*t(h,d)*c*c+2*r(h,d)*c+i(h)}function a(c,h,d,f,m){var p,g,y=0;do g=h+(d-h)/2,p=s(g,f,m)-c,p>0?d=g:h=g;while(Math.abs(p)>1e-7&&++y<10);return g}function l(c,h,d,f){for(var m=0;m<4;++m){var p=o(h,d,f);if(p===0)return h;var g=s(h,d,f)-c;h-=g/p}return h}function u(c,h,d,f){if(!(0<=c&&c<=1&&0<=d&&d<=1))return;var m=new Float32Array(n);if(c!==h||d!==f)for(var p=0;p<n;++p)m[p]=s(p*e,c,d);function g(y){for(var x=0,w=1,b=n-1;w!==b&&m[w]<=y;++w)x+=e;--w;var S=(y-m[w])/(m[w+1]-m[w]),A=x+S*e,M=o(A,c,d);return M>=.001?l(y,A,c,d):M===0?A:a(y,x,x+e,c,d)}return function(y){return c===h&&d===f||y===0||y===1?y:s(g(y),h,f)}}return u}(),p_=function(){var n={linear:function(){return function(r){return r}}},e={Sine:function(){return function(r){return 1-Math.cos(r*Math.PI/2)}},Circ:function(){return function(r){return 1-Math.sqrt(1-r*r)}},Back:function(){return function(r){return r*r*(3*r-2)}},Bounce:function(){return function(r){for(var i,s=4;r<((i=Math.pow(2,--s))-1)/11;);return 1/Math.pow(4,3-s)-7.5625*Math.pow((i*3-2)/22-r,2)}},Elastic:function(r,i){r===void 0&&(r=1),i===void 0&&(i=.5);var s=Ti(r,1,10),o=Ti(i,.1,2);return function(a){return a===0||a===1?a:-s*Math.pow(2,10*(a-1))*Math.sin((a-1-o/(Math.PI*2)*Math.asin(1/s))*(Math.PI*2)/o)}}},t=["Quad","Cubic","Quart","Quint","Expo"];return t.forEach(function(r,i){e[r]=function(){return function(s){return Math.pow(s,i+2)}}}),Object.keys(e).forEach(function(r){var i=e[r];n["easeIn"+r]=i,n["easeOut"+r]=function(s,o){return function(a){return 1-i(s,o)(1-a)}},n["easeInOut"+r]=function(s,o){return function(a){return a<.5?i(s,o)(a*2)/2:1-i(s,o)(a*-2+2)/2}}}),n}();function Xy(n,e){if(ke.fnc(n))return n;var t=n.split("(")[0],r=p_[t],i=d_(n);switch(t){case"spring":return f_(n,e);case"cubicBezier":return Hy(DF,i);case"steps":return Hy(PF,i);default:return Hy(r,i)}}function m_(n){try{var e=document.querySelectorAll(n);return e}catch{return}}function Vf(n,e){for(var t=n.length,r=arguments.length>=2?arguments[1]:void 0,i=[],s=0;s<t;s++)if(s in n){var o=n[s];e.call(r,o,s,n)&&i.push(o)}return i}function Hf(n){return n.reduce(function(e,t){return e.concat(ke.arr(t)?Hf(t):t)},[])}function o_(n){return ke.arr(n)?n:(ke.str(n)&&(n=m_(n)||n),n instanceof NodeList||n instanceof HTMLCollection?[].slice.call(n):[n])}function Yy(n,e){return n.some(function(t){return t===e})}function Qy(n){var e={};for(var t in n)e[t]=n[t];return e}function Wy(n,e){var t=Qy(n);for(var r in n)t[r]=e.hasOwnProperty(r)?e[r]:n[r];return t}function Wf(n,e){var t=Qy(n);for(var r in e)t[r]=ke.und(n[r])?e[r]:n[r];return t}function IF(n){var e=/rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g.exec(n);return e?"rgba("+e[1]+",1)":n}function LF(n){var e=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,t=n.replace(e,function(a,l,u,c){return l+l+u+u+c+c}),r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t),i=parseInt(r[1],16),s=parseInt(r[2],16),o=parseInt(r[3],16);return"rgba("+i+","+s+","+o+",1)"}function RF(n){var e=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(n)||/hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(n),t=parseInt(e[1],10)/360,r=parseInt(e[2],10)/100,i=parseInt(e[3],10)/100,s=e[4]||1;function o(d,f,m){return m<0&&(m+=1),m>1&&(m-=1),m<1/6?d+(f-d)*6*m:m<1/2?f:m<2/3?d+(f-d)*(2/3-m)*6:d}var a,l,u;if(r==0)a=l=u=i;else{var c=i<.5?i*(1+r):i+r-i*r,h=2*i-c;a=o(h,c,t+1/3),l=o(h,c,t),u=o(h,c,t-1/3)}return"rgba("+a*255+","+l*255+","+u*255+","+s+")"}function NF(n){if(ke.rgb(n))return IF(n);if(ke.hex(n))return LF(n);if(ke.hsl(n))return RF(n)}function Zi(n){var e=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn)?$/.exec(n);if(e)return e[1]}function BF(n){if(Gu(n,"translate")||n==="perspective")return"px";if(Gu(n,"rotate")||Gu(n,"skew"))return"deg"}function jy(n,e){return ke.fnc(n)?n(e.target,e.id,e.total):n}function Ei(n,e){return n.getAttribute(e)}function Zy(n,e,t){var r=Zi(e);if(Yy([t,"deg","rad","turn"],r))return e;var i=kf.CSS[e+t];if(!ke.und(i))return i;var s=100,o=document.createElement(n.tagName),a=n.parentNode&&n.parentNode!==document?n.parentNode:document.body;a.appendChild(o),o.style.position="absolute",o.style.width=s+t;var l=s/o.offsetWidth;a.removeChild(o);var u=l*parseFloat(e);return kf.CSS[e+t]=u,u}function g_(n,e,t){if(e in n.style){var r=e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),i=n.style[e]||getComputedStyle(n).getPropertyValue(r)||"0";return t?Zy(n,i,t):i}}function Ky(n,e){if(ke.dom(n)&&!ke.inp(n)&&(Ei(n,e)||ke.svg(n)&&n[e]))return"attribute";if(ke.dom(n)&&Yy(CF,e))return"transform";if(ke.dom(n)&&e!=="transform"&&g_(n,e))return"css";if(n[e]!=null)return"object"}function y_(n){if(!!ke.dom(n)){for(var e=n.style.transform||"",t=/(\w+)\(([^)]*)\)/g,r=new Map,i;i=t.exec(e);)r.set(i[1],i[2]);return r}}function OF(n,e,t,r){var i=Gu(e,"scale")?1:0+BF(e),s=y_(n).get(e)||i;return t&&(t.transforms.list.set(e,s),t.transforms.last=e),r?Zy(n,s,r):s}function Jy(n,e,t,r){switch(Ky(n,e)){case"transform":return OF(n,e,r,t);case"css":return g_(n,e,t);case"attribute":return Ei(n,e);default:return n[e]||0}}function $y(n,e){var t=/^(\*=|\+=|-=)/.exec(n);if(!t)return n;var r=Zi(n)||0,i=parseFloat(e),s=parseFloat(n.replace(t[0],""));switch(t[0][0]){case"+":return i+s+r;case"-":return i-s+r;case"*":return i*s+r}}function v_(n,e){if(ke.col(n))return NF(n);if(/\s/g.test(n))return n;var t=Zi(n),r=t?n.substr(0,n.length-t.length):n;return e?r+e:r}function ev(n,e){return Math.sqrt(Math.pow(e.x-n.x,2)+Math.pow(e.y-n.y,2))}function FF(n){return Math.PI*2*Ei(n,"r")}function UF(n){return Ei(n,"width")*2+Ei(n,"height")*2}function zF(n){return ev({x:Ei(n,"x1"),y:Ei(n,"y1")},{x:Ei(n,"x2"),y:Ei(n,"y2")})}function x_(n){for(var e=n.points,t=0,r,i=0;i<e.numberOfItems;i++){var s=e.getItem(i);i>0&&(t+=ev(r,s)),r=s}return t}function GF(n){var e=n.points;return x_(n)+ev(e.getItem(e.numberOfItems-1),e.getItem(0))}function b_(n){if(n.getTotalLength)return n.getTotalLength();switch(n.tagName.toLowerCase()){case"circle":return FF(n);case"rect":return UF(n);case"line":return zF(n);case"polyline":return x_(n);case"polygon":return GF(n)}}function kF(n){var e=b_(n);return n.setAttribute("stroke-dasharray",e),e}function VF(n){for(var e=n.parentNode;ke.svg(e)&&ke.svg(e.parentNode);)e=e.parentNode;return e}function w_(n,e){var t=e||{},r=t.el||VF(n),i=r.getBoundingClientRect(),s=Ei(r,"viewBox"),o=i.width,a=i.height,l=t.viewBox||(s?s.split(" "):[0,0,o,a]);return{el:r,viewBox:l,x:l[0]/1,y:l[1]/1,w:o/l[2],h:a/l[3]}}function HF(n,e){var t=ke.str(n)?m_(n)[0]:n,r=e||100;return function(i){return{property:i,el:t,svg:w_(t),totalLength:b_(t)*(r/100)}}}function WF(n,e){function t(a){a===void 0&&(a=0);var l=e+a>=1?e+a:0;return n.el.getPointAtLength(l)}var r=w_(n.el,n.svg),i=t(),s=t(-1),o=t(1);switch(n.property){case"x":return(i.x-r.x)*r.w;case"y":return(i.y-r.y)*r.h;case"angle":return Math.atan2(o.y-s.y,o.x-s.x)*180/Math.PI}}function a_(n,e){var t=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g,r=v_(ke.pth(n)?n.totalLength:n,e)+"";return{original:r,numbers:r.match(t)?r.match(t).map(Number):[0],strings:ke.str(n)||e?r.split(t):[]}}function S_(n){var e=n?Hf(ke.arr(n)?n.map(o_):o_(n)):[];return Vf(e,function(t,r,i){return i.indexOf(t)===r})}function __(n){var e=S_(n);return e.map(function(t,r){return{target:t,id:r,total:e.length,transforms:{list:y_(t)}}})}function jF(n,e){var t=Qy(e);if(/^spring/.test(t.easing)&&(t.duration=f_(t.easing)),ke.arr(n)){var r=n.length,i=r===2&&!ke.obj(n[0]);i?n={value:n}:ke.fnc(e.duration)||(t.duration=e.duration/r)}var s=ke.arr(n)?n:[n];return s.map(function(o,a){var l=ke.obj(o)&&!ke.pth(o)?o:{value:o};return ke.und(l.delay)&&(l.delay=a?0:e.delay),ke.und(l.endDelay)&&(l.endDelay=a===s.length-1?e.endDelay:0),l}).map(function(o){return Wf(o,t)})}function qF(n){for(var e=Vf(Hf(n.map(function(s){return Object.keys(s)})),function(s){return ke.key(s)}).reduce(function(s,o){return s.indexOf(o)<0&&s.push(o),s},[]),t={},r=function(s){var o=e[s];t[o]=n.map(function(a){var l={};for(var u in a)ke.key(u)?u==o&&(l.value=a[u]):l[u]=a[u];return l})},i=0;i<e.length;i++)r(i);return t}function XF(n,e){var t=[],r=e.keyframes;r&&(e=Wf(qF(r),e));for(var i in e)ke.key(i)&&t.push({name:i,tweens:jF(e[i],n)});return t}function YF(n,e){var t={};for(var r in n){var i=jy(n[r],e);ke.arr(i)&&(i=i.map(function(s){return jy(s,e)}),i.length===1&&(i=i[0])),t[r]=i}return t.duration=parseFloat(t.duration),t.delay=parseFloat(t.delay),t}function QF(n,e){var t;return n.tweens.map(function(r){var i=YF(r,e),s=i.value,o=ke.arr(s)?s[1]:s,a=Zi(o),l=Jy(e.target,n.name,a,e),u=t?t.to.original:l,c=ke.arr(s)?s[0]:u,h=Zi(c)||Zi(l),d=a||h;return ke.und(o)&&(o=u),i.from=a_(c,d),i.to=a_($y(o,c),d),i.start=t?t.end:0,i.end=i.start+i.delay+i.duration+i.endDelay,i.easing=Xy(i.easing,i.duration),i.isPath=ke.pth(s),i.isColor=ke.col(i.from.original),i.isColor&&(i.round=1),t=i,i})}var A_={css:function(n,e,t){return n.style[e]=t},attribute:function(n,e,t){return n.setAttribute(e,t)},object:function(n,e,t){return n[e]=t},transform:function(n,e,t,r,i){if(r.list.set(e,t),e===r.last||i){var s="";r.list.forEach(function(o,a){s+=a+"("+o+") "}),n.style.transform=s}}};function M_(n,e){var t=__(n);t.forEach(function(r){for(var i in e){var s=jy(e[i],r),o=r.target,a=Zi(s),l=Jy(o,i,a,r),u=a||Zi(l),c=$y(v_(s,u),l),h=Ky(o,i);A_[h](o,i,c,r.transforms,!0)}})}function ZF(n,e){var t=Ky(n.target,e.name);if(t){var r=QF(e,n),i=r[r.length-1];return{type:t,property:e.name,animatable:n,tweens:r,duration:i.end,delay:r[0].delay,endDelay:i.endDelay}}}function KF(n,e){return Vf(Hf(n.map(function(t){return e.map(function(r){return ZF(t,r)})})),function(t){return!ke.und(t)})}function T_(n,e){var t=n.length,r=function(s){return s.timelineOffset?s.timelineOffset:0},i={};return i.duration=t?Math.max.apply(Math,n.map(function(s){return r(s)+s.duration})):e.duration,i.delay=t?Math.min.apply(Math,n.map(function(s){return r(s)+s.delay})):e.delay,i.endDelay=t?i.duration-Math.max.apply(Math,n.map(function(s){return r(s)+s.duration-s.endDelay})):e.endDelay,i}var l_=0;function JF(n){var e=Wy(h_,n),t=Wy(qy,n),r=XF(t,n),i=__(n.targets),s=KF(i,r),o=T_(s,t),a=l_;return l_++,Wf(e,{id:a,children:[],animatables:i,animations:s,duration:o.duration,delay:o.delay,endDelay:o.endDelay})}var sn=[],c_=[],Gf,$F=function(){function n(){Gf=requestAnimationFrame(e)}function e(t){var r=sn.length;if(r){for(var i=0;i<r;){var s=sn[i];if(!s.paused)s.tick(t);else{var o=sn.indexOf(s);o>-1&&(sn.splice(o,1),r=sn.length)}i++}n()}else Gf=cancelAnimationFrame(Gf)}return n}();function eU(){document.hidden?(sn.forEach(function(n){return n.pause()}),c_=sn.slice(0),ar.running=sn=[]):c_.forEach(function(n){return n.play()})}typeof document<"u"&&document.addEventListener("visibilitychange",eU);function ar(n){n===void 0&&(n={});var e=0,t=0,r=0,i,s=0,o=null;function a(w){var b=window.Promise&&new Promise(function(S){return o=S});return w.finished=b,b}var l=JF(n),u=a(l);function c(){var w=l.direction;w!=="alternate"&&(l.direction=w!=="normal"?"normal":"reverse"),l.reversed=!l.reversed,i.forEach(function(b){return b.reversed=l.reversed})}function h(w){return l.reversed?l.duration-w:w}function d(){e=0,t=h(l.currentTime)*(1/ar.speed)}function f(w,b){b&&b.seek(w-b.timelineOffset)}function m(w){if(l.reversePlayback)for(var S=s;S--;)f(w,i[S]);else for(var b=0;b<s;b++)f(w,i[b])}function p(w){var b=0,S=l.animations,A=S.length;for(l.reversePlayback===!0&&l.rewind===!1&&(w=l.duration+l.delay-l.endDelay-w);b<A;){var M=S[b],v=M.animatable,T=M.tweens,E=T.length-1,C=T[E];E&&(C=Vf(T,function($){return w<$.end})[0]||C);for(var L=Ti(w-C.start-C.delay,0,C.duration)/C.duration,N=isNaN(L)?1:C.easing(L),R=C.to.strings,W=C.round,j=[],Z=C.to.numbers.length,Y=void 0,z=0;z<Z;z++){var F=void 0;if(l.reversePlayback===!0&&l.rewind===!1)var G=C.to.numbers[z],O=C.from.numbers[z]||0;else var O=C.to.numbers[z],G=C.from.numbers[z]||0;C.isPath?F=WF(C.value,N*O):F=G+N*(O-G),W&&(C.isColor&&z>2||(F=Math.round(F*W)/W)),j.push(F)}var k=R.length;if(!k)Y=j[0];else{Y=R[0];for(var H=0;H<k;H++){var X=R[H],q=R[H+1],ae=j[H];isNaN(ae)||(q?Y+=ae+q:Y+=ae+" ")}}A_[M.type](v.target,M.property,Y,v.transforms),M.currentValue=Y,b++}}function g(w){l[w]&&!l.passThrough&&l[w](l)}function y(){l.remaining&&l.remaining!==!0&&l.remaining--}function x(w){var b=l.duration,S=l.delay,A=b-l.endDelay,M=h(w);l.progress=Ti(M/b*100,0,100),l.reversePlayback=M<l.currentTime,i&&m(M),!l.began&&l.currentTime>=0&&(l.began=!0,g("begin")),!l.loopBegan&&l.currentTime>0&&(l.loopBegan=!0,g("loopBegin")),M<=S&&l.currentTime!==0&&(p(0),g("change")),(M>=A&&l.currentTime!==b||!b)&&(p(b),g("change")),M>S&&M<A?(l.changeBegan||(l.changeBegan=!0,l.changeCompleted=!1,g("changeBegin")),g("change"),p(M)):l.changeBegan?(l.changeCompleted=!0,l.changeBegan=!1,g("change"),g("changeComplete")):l.began&&M>A&&(g("change"),g("changeComplete")),l.currentTime=Ti(M,0,b),l.began&&g("update"),w>=b&&(t=0,y(),l.remaining?(e=r,g("loopComplete"),l.loopBegan=!1,l.direction==="alternate"&&c()):(l.paused=!0,l.completed||(l.completed=!0,g("loopComplete"),g("complete"),!l.passThrough&&"Promise"in window&&(o(),u=a(l)))))}return l.reset=function(){var w=l.direction;l.passThrough=!1,l.currentTime=0,l.progress=0,l.paused=!0,l.began=!1,l.loopBegan=!1,l.changeBegan=!1,l.completed=!1,l.changeCompleted=!1,l.reversePlayback=!1,l.reversed=w==="reverse",l.remaining=l.loop,i=l.children,s=i.length;for(var b=s;b--;)l.children[b].reset();(l.reversed&&l.loop!==!0||w==="alternate"&&l.loop===1)&&l.remaining++,p(l.reversed?l.duration:0)},l.set=function(w,b){return M_(w,b),l},l.tick=function(w){r=w,e||(e=r),x((r+(t-e))*ar.speed)},l.seek=function(w){x(h(w))},l.pause=function(){l.paused=!0,d()},l.play=function(){!l.paused||(l.completed&&l.reset(),l.paused=!1,sn.push(l),d(),Gf||$F())},l.reverse=function(){c(),l.completed=!l.reversed,d()},l.restart=function(){l.reset(),l.play()},l.reset(),l.autoplay&&l.play(),l}function u_(n,e){for(var t=e.length;t--;)Yy(n,e[t].animatable.target)&&e.splice(t,1)}function tU(n){for(var e=S_(n),t=sn.length;t--;){var r=sn[t],i=r.animations,s=r.children;u_(e,i);for(var o=s.length;o--;){var a=s[o],l=a.animations;u_(e,l),!l.length&&!a.children.length&&s.splice(o,1)}!i.length&&!s.length&&r.pause()}}function rU(n,e){e===void 0&&(e={});var t=e.direction||"normal",r=e.easing?Xy(e.easing):null,i=e.grid,s=e.axis,o=e.from||0,a=o==="first",l=o==="center",u=o==="last",c=ke.arr(n),h=parseFloat(c?n[0]:n),d=c?parseFloat(n[1]):0,f=Zi(c?n[1]:n)||0,m=e.start||0+(c?h:0),p=[],g=0;return function(y,x,w){if(a&&(o=0),l&&(o=(w-1)/2),u&&(o=w-1),!p.length){for(var b=0;b<w;b++){if(!i)p.push(Math.abs(o-b));else{var S=l?(i[0]-1)/2:o%i[0],A=l?(i[1]-1)/2:Math.floor(o/i[0]),M=b%i[0],v=Math.floor(b/i[0]),T=S-M,E=A-v,C=Math.sqrt(T*T+E*E);s==="x"&&(C=-T),s==="y"&&(C=-E),p.push(C)}g=Math.max.apply(Math,p)}r&&(p=p.map(function(N){return r(N/g)*g})),t==="reverse"&&(p=p.map(function(N){return s?N<0?N*-1:-N:Math.abs(g-N)}))}var L=c?(d-h)/g:h;return m+L*(Math.round(p[x]*100)/100)+f}}function nU(n){n===void 0&&(n={});var e=ar(n);return e.duration=0,e.add=function(t,r){var i=sn.indexOf(e),s=e.children;i>-1&&sn.splice(i,1);function o(d){d.passThrough=!0}for(var a=0;a<s.length;a++)o(s[a]);var l=Wf(t,Wy(qy,n));l.targets=l.targets||n.targets;var u=e.duration;l.autoplay=!1,l.direction=e.direction,l.timelineOffset=ke.und(r)?u:$y(r,u),o(e),l.rewind=e.rewind,e.seek(l.timelineOffset);var c=ar(l);o(c),s.push(c);var h=T_(s,n);return e.delay=h.delay,e.endDelay=h.endDelay,e.duration=h.duration,e.seek(0),e.reset(),e.autoplay&&e.play(),e},e}ar.version="3.2.0";ar.speed=1;ar.running=sn;ar.remove=tU;ar.get=Jy;ar.set=M_;ar.convertPx=Zy;ar.path=HF;ar.setDashoffset=kF;ar.stagger=rU;ar.timeline=nU;ar.easing=Xy;ar.penner=p_;ar.random=function(n,e){return Math.floor(Math.random()*(e-n+1))+n};var E_=ar;function C_(n,e,t){let r=n.cameraType==="OrthographicCamera"?e.orthographic?.zoom:e.perspective?.zoom;if(r!==void 0){let i=n.zoom;i!==r&&t.push({change:s=>{n.zoom=Je.lerp(i,r,s),n.updateProjectionMatrix()}})}if(e.targetOffset!==void 0){let i=n.targetOffset,s=e.targetOffset;i!==s&&t.push({change:o=>{n.targetOffset=Je.lerp(i,s,o)}})}}function P_(n,e,t){if(e.width!==void 0&&e.height!==void 0&&e.depth!==void 0){let{width:r,height:i,depth:s}=n.geometry.userData.parameters,o=[r,i,s],a=[e.width,e.height,e.depth];!ir.isEqual(o,a)&&!At(n)&&t.push({change:l=>{let[u,c,h]=ir.lerp(o,a,l);n.updateGeometry({parameters:{width:u,height:c,depth:h}}),n.invalidateDownstreamBooleanData()}})}}function D_(n,e,t,r){if(e.intensity!==void 0){let i=n.intensity,s=e.intensity;i!==s&&t.push({change:o=>{n.intensity=Je.lerp(i,s,o)}})}if(e.color!==void 0){let i=n.color.clone(),s=typeof e.color=="string"?r.getColor(e.color):e.color;if(!nr.equals(i,s)){let o=i.clone();n.color=o,t.push({change:a=>{let{r:l,g:u,b:c}=nr.lerp(i,s,a);o.setRGB(l,u,c)}})}}}function I_(n,e,t,r){let i=0,s=n.layers[i];for(;s;){let o=e.layers.data(s.uuid);if(o&&(s.visible??!0)&&(o.visible??!0)){let a=s.getNames().filter(l=>!Kd.some(u=>l.includes(u)));for(let l of a)try{let u=s.getValue(l);if(l==="steps")cU(s,o,l,t);else if(l==="colors")uU(s,o,l,t);else if(typeof u=="number")iU(s,o,l,t);else{if(typeof u=="boolean")continue;"isVector2"in u?sU(s,o,l,t):"isVector3"in u?oU(s,o,l,t):"isColorA"in u?lU(s,o,l,t,r):"isColor"in u?aU(s,o,l,t,r):"isTexture"in u&&hU(s,o,l,t)}}catch(u){console.error(`animateMaterial: unexpected material layer for ${l}`,u)}}i+=1,s=n.layers[i]}}function iU(n,e,t,r){if(!n.hasValue(t)||!(t in e))return;let i=n.getValue(t),s=e[t];i!==s&&r.push({change:o=>{n.setValue(t,Je.lerp(i,s,o))}})}function sU(n,e,t,r){if(!n.hasValue(t)||!(t in e))return;let i=n.getValue(t),s=i.toArray(),o=e[t];Xi.isEqual(s,o)||r.push({change:a=>{i.fromArray(Xi.lerp(s,o,a))}})}function oU(n,e,t,r){if(!n.hasValue(t)||!(t in e))return;let i=n.getValue(t),s=i.toArray(),o=e[t];ir.isEqual(s,o)||r.push({change:a=>{i.fromArray(ir.lerp(s,o,a))}})}function aU(n,e,t,r,i){if(!n.hasValue(t)||!(t in e))return;let s=n.getValue(t).clone(),o=e[t],a=typeof o=="string"?i.getColor(o):o;if(nr.equals(s,a))return;let l=s.clone();n.setValue(t,l),r.push({change:u=>{let{r:c,g:h,b:d}=nr.lerp(s,a,u);l.setRGB(c,h,d)}})}function lU(n,e,t,r,i){if(!n.hasValue(t)||!(t in e))return;let s=n.getValue(t).clone(),o=e[t],a=typeof o=="string"?i.getColor(o):o;if(Lr.equals(s,a))return;let l=s.clone();n.setValue(t,l),r.push({change:u=>{let{r:c,g:h,b:d,a:f}=Lr.lerp(s,a,u);l.setRGBA(c,h,d,f)}})}function cU(n,e,t="steps",r){if(!n.hasValue(t)||!(t in e))return;let i=[...n.getValue(t)],s=e[t];for(let o=0;o<i.length;++o){let a=i[o],l=s[o];a!==l&&r.push({change:u=>{i[o]=Je.lerp(a,l,u),n.setValue("steps",i)}})}}function uU(n,e,t="colors",r){if(!n.hasValue(t)||!(t in e))return;let i=n.getValue(t),s=e[t];for(let o=0;o<i.length;++o){let a=i[o].toArray(),l=s[o];qc.isEqual(a,l)||r.push({change:u=>{i[o].fromArray(qc.lerp(a,l,u))}})}}function hU(n,e,t="texture",r){if(!n.hasValue(t)||!(t in e))return;let i=n.getNode("mat"),s=e[t],o=i.repeat,a=i.offset,l=s.repeat,u=s.offset;(!Xi.isEqual(o,l)||!Xi.isEqual(a,u))&&r.push({change:c=>{i.repeat=Xi.lerp(o,l,c),i.offset=Xi.lerp(a,u,c),i.updateMatrix()}})}function L_(n,e,t,r){if(r===0)return t.copy(n);if(r===1)return t.copy(e);let i=n.w*e.w+n.x*e.x+n.y*e.y+n.z*e.z;if(i>=1)return t.copy(n);let s=1-i*i;if(s<=Number.EPSILON){let c=1-r;return t.w=c*n.w+r*e.w,t.x=c*n.x+r*e.x,t.y=c*n.y+r*e.y,t.z=c*n.z+r*e.z,t.normalize(),t}let o=Math.sqrt(s),a=Math.atan2(o,i),l=Math.sin((1-r)*a)/o,u=Math.sin(r*a)/o;return t.w=n.w*l+e.w*u,t.x=n.x*l+e.x*u,t.y=n.y*l+e.y*u,t.z=n.z*l+e.z*u,t}function R_(n,e,t=0){let r=Array.isArray(n.material)?n.material[t]:n.material,i;return"materials"in e?i=e.materials[t]:"material"in e&&(i=e.material),[r,i]}var tv=new _,rv=new _,N_=new qt,dU=new bn,fU=new Re;function B_(n,e,t,r){if(t.position!==void 0){let i=n.position.toArray(),s=t.position;ir.isEqual(i,s)||r.push({change:o=>{n.position.fromArray(ir.lerp(i,s,o)),n.updateMatrix(),Ut(n)&&At(n.parent)&&n.invalidateDownstreamBooleanData(!0)}})}if(t.scale!==void 0){let i=n.scale.toArray(),s=t.scale;ir.isEqual(i,s)||r.push({change:o=>{n.scale.fromArray(ir.lerp(i,s,o)),n.updateMatrix(),Ut(n)&&At(n.parent)&&n.invalidateDownstreamBooleanData(!0)}})}pU(n,e,t,r),mU(n,t,r)}function pU(n,e,t,r){if(t.rotation===void 0)return;let i=tv.setFromEuler(n.rotation).toArray(),s=t.rotation;if(ir.isEqual(i,s))return;if(ir.sub(t.rotation,e?e.rotation:n.rotation).every(a=>Math.abs(a)<2*Math.PI)){let a=n.quaternion.clone(),l=new qt().setFromEuler(dU.set(t.rotation[0],t.rotation[1],t.rotation[2]));r.push({change:u=>{L_(a,l,n.quaternion,u),n.updateMatrix(),Ut(n)&&At(n.parent)&&n.invalidateDownstreamBooleanData(!0)}})}else r.push({change:a=>{n.rotation.setFromVector3(rv.fromArray(ir.lerp(i,s,a))),n.updateMatrix(),Ut(n)&&At(n.parent)&&n.invalidateDownstreamBooleanData(!0)}})}function mU(n,e,t){if(e.hiddenMatrix!==void 0&&!oi.isEqual(n.hiddenMatrix.toArray(),e.hiddenMatrix)){let r=new _,i=new qt,s=new _;n.hiddenMatrix.decompose(r,i,s);let o=new _,a=new qt,l=new _;fU.fromArray(e.hiddenMatrix).decompose(o,a,l),t.push({change:u=>{N_.slerpQuaternions(i,a,u),tv.lerpVectors(r,o,u),rv.lerpVectors(s,l,u),n.hiddenMatrix.compose(tv,N_,rv),Ut(n)&&At(n.parent)&&n.invalidateDownstreamBooleanData(!0)}})}}function O_(n,e,t,r){let i=[];if((n.visible||At(n.parent))&&B_(n,e?.objectState,t.objectState,i),Ut(n)){if((n.visible||At(n.parent))&&"geometry"in t.objectState&&P_(n,t.objectState.geometry,i),n.visible&&("material"in t.objectState||"materials"in t.objectState)){let[s,o]=R_(n,t.objectState,0);s&&o&&typeof o!="string"&&I_(s,o,i,r)}}else n.visible&&w1(n)?D_(n,t.objectState,i,r):b1(n)&&C_(n,t.objectState,i);return i.length?{change:s=>{i.forEach(o=>{o.change&&o.change(s)})}}:void 0}function gU(n,e,t){switch(n){case 0:return"cubicBezier( 0, 0, 1, 1 )";case 1:return"cubicBezier( .25, .1, .25, 1 )";case 2:return"cubicBezier( .42, 0, 1, 1 )";case 3:return"cubicBezier( 0, 0, .58, 1 )";case 4:return"cubicBezier( .42, 0, .58, 1 )";case 5:let{control1:r,control2:i}=e??{...Td.defaultData};return`cubicBezier( ${r[0]}, ${r[1]}, ${i[0]}, ${i[1]} )`;case 6:let{mass:s,stiffness:o,damping:a,velocity:l}=t??{...Md.defaultData};return`spring( ${s}, ${o}, ${a}, ${l} )`}}var jf=class{constructor(e,t){this.object=e;this.sharedAssets=t;this.uuid=Je.generateUUID();this.states=[];this.events={};this.animatingState=0;this._scrollCounter=null}get fromState(){return this._fromState}get animation(){return this._animation}start(){this._animation!==void 0&&(this._animation.pause(),this._animation=void 0,this._scrollCounter=null),this.states.length>1&&(this.states[0].execute(this.object,this.sharedAssets),this._toState=this.states[0],this._fromState=void 0)}end(){this._animation!==void 0&&(this._animation.pause(),this._animation=void 0),this.states.length>1&&this.states[0].execute(this.object,this.sharedAssets),this._toState=void 0,this._fromState=void 0}seek(e,t,r,i,s){this._scrollCounter===null&&(this.animate(e,i,s),this._scrollCounter=0),this._scrollCounter+=t,this._scrollCounter=Math.min(Math.max(this._scrollCounter,0),r),this._animation?.seek(this._scrollCounter/r*(i.duration?i.duration:1))}animate(e,t,r){if(this._fromState===e&&this._animation?.reversed){let i=this._animation?.currentTime??0;this._animation?.reset(),this._animation?.seek(i),this._animation?.play()}else if(this._toState!==e){this._animation!==void 0&&this._animation.pause(),this.animatingState=0,this._fromState=this._toState,this._toState=e;let i=O_(this.object,this._fromState,e,this.sharedAssets);if(!i)return;let s={t:0};this._animation=E_({autoplay:!1,loop:t.repeat?!0:t.cycle?1:!1,direction:t.cycle?"alternate":"normal",rewind:t.rewind,delay:t.startDelay,endDelay:t.endDelay,duration:t.duration,easing:gU(t.easing,t.cubicControls,t.springParameters),targets:s,t:1,change:()=>{i.change&&i.change(s.t),r?.change&&r.change(s.t)},loopBegin:o=>{if(this.animatingState===0){this.animatingState=1;return}o.reversed?(this._toState=this._fromState,this._fromState=e):(this._fromState=this._toState,this._toState=e)}}),t.autoplay?t.startOnceDelay>0?setTimeout(()=>this._animation?.play(),t.startOnceDelay):this._animation?.play():this._animation.finished.then(()=>{this.animatingState=0})}}emitEvent(e,t){if(e==="keyDown"||e==="keyUp"||e==="mouseDown"||e==="mouseUp"||e==="mouseHover"||e==="scroll"||e==="start"){let r=this.events[e];if(r){for(let i of r)if("targets"in i)for(let{object:s,state:o,params:a}of i.targets)s.interaction?.animate(o,a,{change:t})}}}emitEventReverse(e,t){if(e==="keyDown"||e==="keyUp"||e==="mouseDown"||e==="mouseUp"||e==="mouseHover"||e==="scroll"||e==="start"){let r=this.events[e];if(r){for(let i of r)if("targets"in i)for(let{object:s,params:o}of i.targets){let a=s.interaction;a?._fromState!==void 0&&a.animate(a._fromState,o,{change:t})}}}}};var Ol=class{static create(e,t){if(e.object){let r=t.find(e.object);if(r?.interaction){let i=e.state?r.interaction.states.find(s=>s.uuid===e.state):r.interaction.states[0];if(i){let s=e.delay??0,o={cycle:e.cycle??!1,rewind:e.rewind??!1,repeat:e.repeat??!1,duration:e.duration??1e3,startOnceDelay:e.delayDirection==="start-once"?s:0,startDelay:e.delayDirection==="start"||!e.delayDirection?s:0,endDelay:e.delayDirection==="end"||!e.delayDirection?s:0,easing:e.easing??4,autoplay:!0};if(e.easing===5){let a=e;o.cubicControls={control1:[...a.control1],control2:[...a.control2]}}if(e.easing===6){let a=e;o.springParameters={mass:a.mass,stiffness:a.stiffness,damping:a.damping,velocity:a.velocity}}return new Ol(r,i,o)}}}}constructor(e,t,r){this.object=e,this.state=t,this.params=r}};var Nr=class{constructor(e){this.raycastState=e;this.domEventsNeeded=[]}init(e,t){}dispose(){}};var nv=new _,F_=new Ur,U_=new Re,qf={type:"follow",normal:new _,raycaster:new Rs},Fl;(t=>{function n(r){if(r.type===10)return{type:"follow"}}t.create=n;function e({target:r,normal:i,raycaster:s,begin:o,change:a}){!r||!i||!s||(o&&o("follow",r.uuid),F_.setFromNormalAndCoplanarPoint(i,r.getWorldPosition(nv)),s.ray.intersectPlane(F_,nv),r.position.copy(nv),r.parent!==null&&r.position.applyMatrix4(U_.copy(r.parent.matrixWorld).invert()),r.position.applyMatrix4(U_.copy(r.hiddenMatrix).invert()),r.updateMatrix(),Ut(r)&&At(r.parent)&&r.invalidateDownstreamBooleanData(!0),a&&a())}t.listener=e})(Fl||(Fl={}));var Xf=class extends Nr{constructor(){super(...arguments);this.objects=[];this.onTouchMove=t=>{t.touches.length===1&&(this.raycastState.updateRaycaster(t),this.handleFollowEvent())};this.onMouseMove=t=>{this.raycastState.updateRaycaster(t),this.handleFollowEvent()}}init(t,r){let{scene:i,domElement:s}=this.raycastState;this.objects=[],qf.change=r,i.traverseEntity(o=>{!o.interaction?.events.follow?.length||(o.addEventListener("follow",Fl.listener),this.objects.push(o))}),this.domEventsNeeded=[],this.objects.length&&(Kt?(this.domEventsNeeded.push("touchstart","touchmove"),s.addEventListener("touchstart",this.onTouchMove),s.addEventListener("touchmove",this.onTouchMove)):(this.domEventsNeeded.push("pointermove"),s.addEventListener("pointermove",this.onMouseMove)))}dispose(){let{domElement:t}=this.raycastState;this.objects.forEach(r=>{r.removeEventListener("follow",Fl.listener)}),this.objects=[],Kt?(t.removeEventListener("touchstart",this.onTouchMove),t.removeEventListener("touchmove",this.onTouchMove)):t.removeEventListener("pointermove",this.onMouseMove),this.domEventsNeeded=[]}handleFollowEvent(){let{normal:t,raycaster:r}=this.raycastState;qf.normal=t,qf.raycaster=r,this.objects.forEach(i=>i.dispatchEvent(qf))}};var iv=new _,z_=new Ur,Yf={type:"lookAt",normal:new _,raycaster:new Rs},Ul;(t=>{function n(r){if(r.type===9&&r.distance)return{type:"lookAt",distance:r.distance}}t.create=n;function e({target:r,normal:i,raycaster:s,begin:o,change:a}){if(!r?.interaction?.events.lookAt?.length||!i||!s)return;o&&o("lookAt",r.uuid);let l=r.interaction.events.lookAt[0].distance;z_.set(i,-l),s.ray.intersectPlane(z_,iv),r.lookAt(iv),r.updateMatrix(),r.interaction.animation?.finished.then(()=>{r.lookAt(iv),r.updateMatrix(),Ut(r)&&At(r.parent)&&r.invalidateDownstreamBooleanData(!0)}),Ut(r)&&At(r.parent)&&r.invalidateDownstreamBooleanData(!0),a&&a()}t.listener=e})(Ul||(Ul={}));var Qf=class extends Nr{constructor(){super(...arguments);this.objects=[];this.onTouchMove=t=>{t.touches.length===1&&(this.raycastState.updateRaycaster(t),this._handleLookAtEvent())};this.onMouseMove=t=>{this.raycastState.updateRaycaster(t),this._handleLookAtEvent()}}init(t,r){let{scene:i,domElement:s}=this.raycastState;this.objects=[],Yf.change=r,i.traverseEntity(o=>{!o.interaction?.events.lookAt?.length||(o.addEventListener("lookAt",Ul.listener),this.objects.push(o))}),this.domEventsNeeded=[],this.objects.length&&(Kt?(this.domEventsNeeded.push("touchstart","touchmove"),s.addEventListener("touchstart",this.onTouchMove),s.addEventListener("touchmove",this.onTouchMove)):(this.domEventsNeeded.push("pointermove"),s.addEventListener("pointermove",this.onMouseMove)))}dispose(){let{domElement:t}=this.raycastState;this.objects.forEach(r=>{r.removeEventListener("lookAt",Ul.listener)}),this.objects=[],Kt?(t.removeEventListener("touchstart",this.onTouchMove),t.removeEventListener("touchmove",this.onTouchMove)):t.removeEventListener("pointermove",this.onMouseMove),this.domEventsNeeded=[]}_handleLookAtEvent(){let{normal:t,raycaster:r}=this.raycastState;Yf.normal=t,Yf.raycaster=r,this.objects.forEach(i=>{i.dispatchEvent(Yf)})}};var sv={type:"start"},zl;(t=>{function n(r){if(r.type===7)return{type:"start",targets:[]}}t.create=n;function e({target:r,begin:i,change:s}){if(!r?.interaction?.events.start?.length)return;i&&i("start",r.uuid);let o={change:s};r.interaction.events.start.forEach(a=>{a.targets.forEach(({object:l,state:u,params:c})=>l.interaction?.animate(u,c,o))})}t.listener=e})(zl||(zl={}));var Zf=class extends Nr{constructor(){super(...arguments);this.objects=[]}init(t,r){let{scene:i}=this.raycastState;this.objects=[],sv.begin=t,sv.change=r,i.traverseEntity(s=>{!s.interaction?.events.start?.length||(s.addEventListener("start",zl.listener),this.objects.push(s))}),this.objects.forEach(s=>{s.dispatchEvent(sv)})}dispose(){this.objects.forEach(t=>{t.removeEventListener("start",zl.listener)}),this.objects=[]}};var Kf={type:"scroll"},Gl;(t=>{function n(r){if(!(r.type!==11||r.steps===void 0))return{type:"scroll",targets:[],steps:r.steps}}t.create=n;function e({target:r,deltaY:i,begin:s,change:o}){if(!r?.interaction?.events.scroll?.length||!i)return;s&&s("scroll",r.uuid);let a={change:o},l=i>0?1:-1;r.interaction.events.scroll.forEach(u=>{u.targets.forEach(({object:c,state:h,params:d})=>{let f={...d,autoplay:!1};c.interaction?.seek(h,l,u.steps,f,a)})})}t.listener=e})(Gl||(Gl={}));var Jf=class extends Nr{constructor(){super(...arguments);this.objects=[];this.onWheel=t=>{Kf.deltaY=t.deltaY,this.objects.forEach(r=>{r.dispatchEvent(Kf)})}}init(t,r){let{scene:i,domElement:s}=this.raycastState;this.objects=[],Kf.begin=t,Kf.change=r,i.traverseEntity(o=>{!o.interaction?.events.scroll?.length||(o.addEventListener("scroll",Gl.listener),this.objects.push(o))}),this.domEventsNeeded=[],this.objects.length&&(this.domEventsNeeded.push("wheel"),s.addEventListener("wheel",this.onWheel))}dispose(){let{domElement:t}=this.raycastState;this.objects.forEach(r=>{r.removeEventListener("scroll",Gl.listener)}),this.objects=[],t.removeEventListener("wheel",this.onWheel),this.domEventsNeeded=[]}};function yU(n,e){return n.distance-e.distance}function G_(n,e,t){if(Us(e)&&e.visible&&!e.raycastLock)e.raycast(n,t);else return;for(let r of e.children)G_(n,r,t)}function kl(n,e,t){if(!t.some(i=>Bo(n,i)!==void 0))return[];let r=[];return e.children.forEach(i=>G_(n,i,r)),r.sort(yU),r}function Vl(n,e){let t=[];if(n.length){let r=n[0].object;Us(r)&&r.interaction?.events[e]?.length&&t.push(r);let i=r.parent;for(;i;)ly(i)&&i.interaction?.events[e]?.length&&t.push(i),i=i.parent}return t}function Bo(n,e){if(Ut(e)){if(!e.raycastLock&&e.visible){let t=[];return e.raycast(n,t),t.length?t[0]:void 0}}else if(ly(e))return k_(n,e)}function k_(n,e){if(Ut(e)&&!e.raycastLock&&e.visible){let t=[];if(e.raycast(n,t),t.length)return t[0]}for(let t of e.children)if(Us(t)){let r=k_(n,t);if(r)return r}}function vU(n){if(n.style.transform!==""){let e=getComputedStyle(n).getPropertyValue("transform");if(e!=="none"){let t=e.replace("matrix(","").split(",");return{x:parseFloat(t[0]),y:parseFloat(t[3])}}}return{x:1,y:1}}function ov(n){let e=n.getViewport(new Ve),t=vU(n.domElement);return{left:e.x*t.x,top:e.y*t.y,width:e.z*t.x,height:e.w*t.y}}var $f=class{constructor(e,t,r,i){this.renderer=e;this.scene=t;this.camera=r;this.stopRaycast=i;this.raycaster=new Rs;this.normal=new _;this.raycasterNeedsUpdate=!0;this.domElement=e.domElement,this.domRect=this.domElement.getBoundingClientRect(),this.viewRect=ov(e)}getPointer(e,t){let r=this.domRect,i=this.viewRect,s=r.height-i.height,o=(e-i.left-r.left)*(r.width/i.width),a=(t-s+i.top-r.top)*(r.height/i.height);return{x:o/r.width*2-1,y:-(a/r.height)*2+1}}updateRaycaster(e){if(this.raycasterNeedsUpdate){let{clientX:t,clientY:r}=Kt?e.touches[0]:e;this.raycaster.setFromCamera(this.getPointer(t,r),this.camera),this.camera.getWorldDirection(this.normal),this.normal.negate(),this.raycasterNeedsUpdate=!1}}};var Hl={type:"mouseHover"},Wl;(t=>{function n(r){if(r.type===2)return{type:"mouseHover",targets:[]}}t.create=n;function e({target:r,begin:i,change:s,enter:o}){if(!r?.interaction?.events.mouseHover?.length||o===void 0)return;i&&i("mouseHover",r.uuid);let a={change:s};o?r.interaction.events.mouseHover.forEach(l=>{l.targets.forEach(({object:u,state:c,params:h})=>{u.interaction?.animate(c,h,a)})}):r.interaction.events.mouseHover.forEach(l=>{l.targets.forEach(({object:u,params:c})=>{let h=u.interaction;h?.fromState!==void 0&&h.animate(h.fromState,c,a)})})}t.listener=e})(Wl||(Wl={}));var ep=class extends Nr{constructor(){super(...arguments);this.objects=[];this._prevObjects=[];this.onTouchStart=t=>{t.touches.length===1&&(this.raycastState.updateRaycaster(t),this.handleMouseHoverEvent())};this.onTouchEnd=t=>{this.handleMouseHoverEvent(!0)};this.onTouchMove=t=>{t.touches.length===1&&(this.raycastState.updateRaycaster(t),this.handleMouseHoverEvent())};this.onMouseMove=t=>{this.raycastState.updateRaycaster(t),this.handleMouseHoverEvent()}}init(t,r){let{scene:i,domElement:s}=this.raycastState;this.objects=[],Hl.begin=t,Hl.change=r,i.traverseEntity(o=>{!o.visible||!o.interaction?.events.mouseHover?.length||(o.addEventListener("mouseHover",Wl.listener),this.objects.push(o))}),this.domEventsNeeded=[],this.objects.length&&(Kt?(this.domEventsNeeded.push("touchstart","touchend","touchmove"),s.addEventListener("touchstart",this.onTouchStart),s.addEventListener("touchend",this.onTouchEnd),s.addEventListener("touchmove",this.onTouchMove)):(this.domEventsNeeded.push("pointermove"),s.addEventListener("pointermove",this.onMouseMove)))}dispose(){let{domElement:t}=this.raycastState;this.objects.forEach(r=>{r.removeEventListener("mouseHover",Wl.listener)}),this.objects=[],Kt?(t.removeEventListener("touchstart",this.onTouchStart),t.removeEventListener("touchend",this.onTouchEnd),t.removeEventListener("touchmove",this.onTouchMove)):t.removeEventListener("pointermove",this.onMouseMove),this.domEventsNeeded=[]}handleMouseHoverEvent(t=!1){let r=[];if(!t){let{stopRaycast:i,raycaster:s,scene:o}=this.raycastState;if(i){let a=kl(s,o,this.objects);r=Vl(a,"mouseHover")}else this.objects.forEach(a=>{Bo(s,a)&&r.push(a)})}this._prevObjects.length&&(Hl.enter=!1,this._prevObjects.forEach(i=>{r.includes(i)||i.dispatchEvent(Hl)})),r.length&&(Hl.enter=!0,r.forEach(i=>{i.dispatchEvent(Hl)})),this._prevObjects=r}};var xU="text/plain",bU="us-ascii",V_=(n,e)=>e.some(t=>t instanceof RegExp?t.test(n):t===n),wU=(n,{stripHash:e})=>{let t=/^data:(?<type>[^,]*?),(?<data>[^#]*?)(?:#(?<hash>.*))?$/.exec(n);if(!t)throw new Error(`Invalid URL: ${n}`);let{type:r,data:i,hash:s}=t.groups,o=r.split(";");s=e?"":s;let a=!1;o[o.length-1]==="base64"&&(o.pop(),a=!0);let l=(o.shift()||"").toLowerCase(),c=[...o.map(h=>{let[d,f=""]=h.split("=").map(m=>m.trim());return d==="charset"&&(f=f.toLowerCase(),f===bU)?"":`${d}${f?`=${f}`:""}`}).filter(Boolean)];return a&&c.push("base64"),(c.length>0||l&&l!==xU)&&c.unshift(l),`data:${c.join(";")},${a?i.trim():i}${s?`#${s}`:""}`};function av(n,e){if(e={defaultProtocol:"http:",normalizeProtocol:!0,forceHttp:!1,forceHttps:!1,stripAuthentication:!0,stripHash:!1,stripTextFragment:!0,stripWWW:!0,removeQueryParameters:[/^utm_\w+/i],removeTrailingSlash:!0,removeSingleSlash:!0,removeDirectoryIndex:!1,sortQueryParameters:!0,...e},n=n.trim(),/^data:/i.test(n))return wU(n,e);if(/^view-source:/i.test(n))throw new Error("`view-source:` is not supported as it is a non-standard protocol");let t=n.startsWith("//");!t&&/^\.*\//.test(n)||(n=n.replace(/^(?!(?:\w+:)?\/\/)|^\/\//,e.defaultProtocol));let i=new URL(n);if(e.forceHttp&&e.forceHttps)throw new Error("The `forceHttp` and `forceHttps` options cannot be used together");if(e.forceHttp&&i.protocol==="https:"&&(i.protocol="http:"),e.forceHttps&&i.protocol==="http:"&&(i.protocol="https:"),e.stripAuthentication&&(i.username="",i.password=""),e.stripHash?i.hash="":e.stripTextFragment&&(i.hash=i.hash.replace(/#?:~:text.*?$/i,"")),i.pathname){let o=/\b[a-z][a-z\d+\-.]{1,50}:\/\//g,a=0,l="";for(;;){let c=o.exec(i.pathname);if(!c)break;let h=c[0],d=c.index;l+=i.pathname.slice(a,d).replace(/\/{2,}/g,"/"),l+=h,a=d+h.length}l+=i.pathname.slice(a,i.pathname.length).replace(/\/{2,}/g,"/"),i.pathname=l}if(i.pathname)try{i.pathname=decodeURI(i.pathname)}catch{}if(e.removeDirectoryIndex===!0&&(e.removeDirectoryIndex=[/^index\.[a-z]+$/]),Array.isArray(e.removeDirectoryIndex)&&e.removeDirectoryIndex.length>0){let o=i.pathname.split("/"),a=o[o.length-1];V_(a,e.removeDirectoryIndex)&&(o=o.slice(0,-1),i.pathname=o.slice(1).join("/")+"/")}if(i.hostname&&(i.hostname=i.hostname.replace(/\.$/,""),e.stripWWW&&/^www\.(?!www\.)[a-z\-\d]{1,63}\.[a-z.\-\d]{2,63}$/.test(i.hostname)&&(i.hostname=i.hostname.replace(/^www\./,""))),Array.isArray(e.removeQueryParameters))for(let o of[...i.searchParams.keys()])V_(o,e.removeQueryParameters)&&i.searchParams.delete(o);if(e.removeQueryParameters===!0&&(i.search=""),e.sortQueryParameters){i.searchParams.sort();try{i.search=decodeURIComponent(i.search)}catch{}}e.removeTrailingSlash&&(i.pathname=i.pathname.replace(/\/$/,""));let s=n;return n=i.toString(),!e.removeSingleSlash&&i.pathname==="/"&&!s.endsWith("/")&&i.hash===""&&(n=n.replace(/\/$/,"")),(e.removeTrailingSlash||i.pathname==="/")&&i.hash===""&&e.removeSingleSlash&&(n=n.replace(/\/$/,"")),t&&!e.normalizeProtocol&&(n=n.replace(/^http:\/\//,"//")),e.stripProtocol&&(n=n.replace(/^(?:https?:)?\/\//,"")),n}var cv={type:"mouseDown"},uv={type:"mouseUp"},hv={type:"keyDown"},W_={type:"keyUp"},qs;(t=>{function n(r){let i,s;if(r.type===0)i={type:"mousedown"},s="mouseDown";else if(r.type===1)i={type:"mouseup"},s="mouseUp";else if(r.type===5){if(!r.key)return;i={type:"keydown",key:r.key},s="keyDown"}else if(r.type===6){if(!r.key)return;i={type:"keyup",key:r.key},s="keyUp"}else return;return{type:s,domEvent:i,targets:[],url:r.url??void 0,toggle:r.toggle??!1,enable:!1}}t.create=n;function e({target:r,interactionEvents:i,type:s,begin:o,change:a}){if(!r)return;i||(i=r.interaction?.events[s]),o&&o(s,r.uuid);let l={change:a};i.forEach(u=>{if(u.toggle){u.enable=!u.enable;for(let{object:c,state:h,params:d}of u.targets){let f=c.interaction;if(f!==void 0){let m={...d,cycle:!1,rewind:!1,repeat:!1};u.enable?f.animate(h,m,l):f.fromState!==void 0&&f.animate(f.fromState,m,l)}}}else u.targets.forEach(({object:c,state:h,params:d})=>c.interaction?.animate(h,d,l));if(u.url){let c=av(u.url);Wc?window.location.assign(c):window.open(c,"_blank")}})}t.listener=e})(qs||(qs={}));var H_={keyDown:hv,keyUp:W_,mouseDown:cv,mouseUp:uv},lv={keyDown:qs.listener,keyUp:qs.listener,mouseDown:qs.listener,mouseUp:qs.listener};var tp=class extends Nr{constructor(){super(...arguments);this.map={};this.types=["mouseDown","mouseUp","keyDown","keyUp"];this.onTouchStart=t=>{t.touches.length===1&&(this.raycastState.updateRaycaster(t),this.handleMouseEvent("mouseDown"))};this.onTouchEnd=t=>{this.raycastState.updateRaycaster(t),this.handleMouseEvent("mouseUp")};this.onMouseDown=t=>{this.raycastState.updateRaycaster(t),this.handleMouseEvent("mouseDown")};this.onMouseUp=t=>{this.raycastState.updateRaycaster(t),this.handleMouseEvent("mouseUp")};this.onKeyDown=t=>{this.handleKeyEvent(t,"keyDown","keydown")};this.onKeyUp=t=>{this.handleKeyEvent(t,"keyUp","keyup")}}init(t,r){let{scene:i,domElement:s}=this.raycastState;this.map={};for(let o of this.types)H_[o].begin=t,H_[o].change=r;i.traverseEntity(o=>{!o.interaction||(o.visible&&["mouseDown","mouseUp"].forEach(a=>{o.interaction?.events[a]?.length&&(o.addEventListener(a,lv[a]),this.map[a]?this.map[a].push(o):this.map[a]=[o])}),["keyDown","keyUp"].forEach(a=>{o.interaction?.events[a]?.length&&(o.addEventListener(a,lv[a]),this.map[a]?this.map[a].push(o):this.map[a]=[o])}))}),this.domEventsNeeded=[],Kt?(this.map.mouseDown?.length&&(this.domEventsNeeded.push("touchstart"),s.addEventListener("touchstart",this.onTouchStart)),this.map.mouseUp?.length&&(this.domEventsNeeded.push("touchend"),s.addEventListener("touchend",this.onTouchEnd))):(this.map.mouseDown?.length&&(this.domEventsNeeded.push("pointerdown"),s.addEventListener("pointerdown",this.onMouseDown)),this.map.mouseUp?.length&&(this.domEventsNeeded.push("pointerup"),s.addEventListener("pointerup",this.onMouseUp))),this.map.keyDown?.length&&(this.domEventsNeeded.push("keydown"),document.addEventListener("keydown",this.onKeyDown)),this.map.keyUp?.length&&(this.domEventsNeeded.push("keyup"),document.addEventListener("keyup",this.onKeyUp))}dispose(){let{domElement:t}=this.raycastState;for(let r of this.types)this.map[r]?.forEach(i=>{i.removeEventListener(r,lv[r])});this.map={},Kt?(t.removeEventListener("touchstart",this.onTouchStart),t.removeEventListener("touchend",this.onTouchEnd)):(t.removeEventListener("pointerdown",this.onMouseDown),t.removeEventListener("pointerup",this.onMouseUp)),document.removeEventListener("keydown",this.onKeyDown),document.removeEventListener("keyup",this.onKeyUp),this.domEventsNeeded=[]}handleMouseEvent(t){let{stopRaycast:r,raycaster:i,scene:s}=this.raycastState;if(r){let o=this.map[t];if(o?.length){let a=kl(i,s,o);Vl(a,t).forEach(l=>l.dispatchEvent(t==="mouseDown"?cv:uv))}}else this.map[t]?.forEach(o=>{Bo(i,o)&&o.dispatchEvent(t==="mouseDown"?cv:uv)})}handleKeyEvent(t,r,i){this.map[r]?.forEach(s=>{hv.interactionEvents=s.interaction?.events?.keyDown?.filter(o=>o.domEvent.type===i&&o.domEvent.key===t.key),s.dispatchEvent(r==="keyDown"?hv:W_)})}};var jl;(t=>(t.isPlayable=r=>r.type==="audio"&&r.data.interaction==="play",t.create=function(r,i,s,o){if(!((i.trigger==="keyDown"||i.trigger==="keyUp")&&i.key===void 0))if(i.interaction==="play"){if(i.audio){let a=new Ci(r,i,s);return Ci.cache.set(r,a),a}}else return new dv(i,o)}))(jl||(jl={}));var Ci=class{constructor(e,t,r){this.id=e;this.type="audio";let{audio:i,volume:s,delay:o,loop:a}=t,l=typeof i=="string"?r.getAudio(i).src:i.data;this.audioPlayer=new Ws({src:l,volume:s,delay:o,loop:a}),this.data=t}dispatch(){this.data.toggle==="stop"?this.audioPlayer.isStarted?this.audioPlayer.stop():(this.audioPlayer.stop(),this.audioPlayer.play()):this.data.toggle==="pause"?this.audioPlayer.isStarted?this.audioPlayer.pause():this.audioPlayer.play():(this.audioPlayer.stop(),this.audioPlayer.play())}dispose(){this.audioPlayer.dispose()}};Ci.cache=new Map;var dv=class{constructor(e,t){this.type="audio";this.data=e,this.scene=t}dispatch(){this.data.object?this.data.audioEvent?this.pauseAudio(this.data.audioEvent):this.pauseAudiosByObject(this.data.object):this.pauseAudios()}pauseAudio(e){let t=Ci.cache.get(e),r=this.data.interaction;!t||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{t.audioPlayer[r](),this.disposeDelay()},this.data.delay)):t.audioPlayer[r]())}pauseAudiosByObject(e){let r=this.scene.find(e)?.interaction?.events.audio,i=this.data.interaction;if(!!r)if(this.data.delay>0)this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{for(let s of r)jl.isPlayable(s)&&s.audioPlayer[i]();this.disposeDelay()},this.data.delay);else for(let s of r)jl.isPlayable(s)&&s.audioPlayer[i]()}pauseAudios(){let e=this.data.interaction;if(this.data.delay>0)this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{for(let t of Ci.cache.values())t.audioPlayer[e]();this.disposeDelay()},this.data.delay);else for(let t of Ci.cache.values())t.audioPlayer[e]()}disposeDelay(){clearTimeout(this.timeoutId),delete this.timeoutId}dispose(){clearTimeout(this.timeoutId),delete this.timeoutId}},rp=class extends Nr{constructor(){super(...arguments);this.heldKeys={};this.map={};this.startMap={};this.onStartMouseDown=()=>{this.startMap.mouseDown?.forEach(t=>t.dispatch()),this.raycastState.domElement.removeEventListener(Kt?"touchstart":"pointerdown",this.onStartAny)};this.onStartKeyDown=()=>{this.startMap.keyDown?.forEach(t=>t.dispatch()),document.removeEventListener("keydown",this.onStartAny)};this.onStartAny=()=>{this.startMap.any?.forEach(t=>t.dispatch()),this.raycastState.domElement.removeEventListener(Kt?"touchstart":"pointerdown",this.onStartAny),document.removeEventListener("keydown",this.onStartAny)};this.onMouseEvent=(t,r)=>{let i=this.map[r];if(i?.length){let{stopRaycast:s,raycaster:o,scene:a}=this.raycastState;if(this.raycastState.updateRaycaster(t),s){let l=kl(o,a,i);Vl(l,"audio").forEach(u=>this.dispatch(u,r))}else i.forEach(l=>{Bo(o,l)&&this.dispatch(l,r)})}};this.onMouseDown=t=>{this.onMouseEvent(t,"mouseDown")};this.onMouseUp=t=>{this.onMouseEvent(t,"mouseUp")};this.onKeyDown=t=>{let r=this.heldKeys[t.key];this.map.keyDown?.forEach(i=>{r||this.dispatch(i,"keyDown",t.key)}),this.heldKeys[t.key]=!0};this.onKeyUp=t=>{this.map.keyUp?.forEach(r=>this.dispatch(r,"keyUp",t.key))};this.releaseHeldKey=t=>{delete this.heldKeys[t.key]}}init(t,r){let{scene:i,domElement:s}=this.raycastState;this.map={},this.startMap={},this.heldKeys={},Ci.cache=new Map,i.traverseEntity(o=>{!o.interaction?.events.audio||o.interaction.events.audio.forEach(a=>{a.data.trigger==="start"&&(this.startMap[a.data.after]?.length?this.startMap[a.data.after].push(a):this.startMap[a.data.after]=[a]),o.visible&&["mouseDown","mouseUp"].forEach(l=>{a.data.trigger===l&&(this.map[l]?.length?this.map[l].push(o):this.map[l]=[o])}),["keyDown","keyUp"].forEach(l=>{a.data.trigger===l&&(this.map[l]?.length?this.map[l].push(o):this.map[l]=[o])})})}),this.domEventsNeeded=[],Kt?(this.startMap.mouseDown?.length&&s.addEventListener("touchstart",this.onStartMouseDown,{once:!0}),this.startMap.any?.length&&s.addEventListener("touchstart",this.onStartAny,{once:!0}),this.map.mouseDown?.length&&(this.domEventsNeeded.push("touchstart"),s.addEventListener("touchstart",this.onMouseDown)),this.map.mouseUp?.length&&(this.domEventsNeeded.push("touchend"),s.addEventListener("touchend",this.onMouseUp))):(this.startMap.mouseDown?.length&&s.addEventListener("pointerdown",this.onStartMouseDown,{once:!0}),this.startMap.any?.length&&s.addEventListener("pointerdown",this.onStartAny,{once:!0}),this.map.mouseDown?.length&&(this.domEventsNeeded.push("pointerdown"),s.addEventListener("pointerdown",this.onMouseDown)),this.map.mouseUp?.length&&(this.domEventsNeeded.push("pointerup"),s.addEventListener("pointerup",this.onMouseUp))),this.startMap.keyDown?.length&&document.addEventListener("keydown",this.onStartKeyDown,{once:!0}),this.startMap.any?.length&&document.addEventListener("keydown",this.onStartAny,{once:!0}),this.map.keyDown?.length&&(this.domEventsNeeded.push("keydown"),document.addEventListener("keydown",this.onKeyDown),document.addEventListener("keyup",this.releaseHeldKey)),this.map.keyUp?.length&&(this.domEventsNeeded.push("keyup"),document.addEventListener("keyup",this.onKeyUp))}dispose(){let{scene:t,domElement:r}=this.raycastState;t.traverseEntity(i=>{!i.interaction?.events.audio||i.interaction.events.audio.forEach(s=>{s.dispose()})}),this.map={},this.startMap={},this.heldKeys={},Ci.cache=new Map,Kt?(r.removeEventListener("touchstart",this.onStartMouseDown),r.removeEventListener("touchstart",this.onStartAny),r.removeEventListener("touchstart",this.onMouseDown),r.removeEventListener("touchend",this.onMouseUp)):(r.removeEventListener("pointerdown",this.onStartMouseDown),r.removeEventListener("pointerdown",this.onStartAny),r.removeEventListener("pointerdown",this.onMouseDown),r.removeEventListener("pointerup",this.onMouseUp)),r.removeEventListener("keyDown",this.onStartKeyDown),r.removeEventListener("keyDown",this.onStartAny),r.removeEventListener("keydown",this.onKeyDown),document.removeEventListener("keyup",this.releaseHeldKey),r.removeEventListener("keyup",this.onKeyUp),this.domEventsNeeded=[]}dispatch(t,r,i){let s=t.interaction?.events.audio;if(s)if(r==="keyDown"||r==="keyUp")for(let o of s)o.data.trigger===r&&o.data.key===i&&o.dispatch();else for(let o of s)o.data.trigger===r&&o.dispatch()}};function SU(n,e,t,r){let i,{type:s}=e;return s===10?i=Fl.create(e):s===0||s===1||s===5||s===6?i=qs.create(e):s===9?i=Ul.create(e):s===2?i=Wl.create(e):s===11?i=Gl.create(e):s===7?i=zl.create(e):s===12&&(i=jl.create(n,e,t,r)),i}function q_(n,e,t){let r=[];n.objects.traverse((i,s)=>{let o=e.find(i);if(delete o.interaction,s.states===void 0)return;let a=new jf(o,t),l=a.states;l.push(Oo.create(i,s));for(let c of s.states){let h=eu.patch(s,c.data);l.push(Oo.create(c.id,h))}let u=a.events;if(s.events)for(let{id:c,data:h}of s.events){let d=SU(c,h,t,e);if(!d)continue;let f=d.type;u[f]?u[f].push(d):u[f]=[d],"targets"in h&&r.push([h,d])}(l.length>0||Object.keys(u).length>0)&&(o.interaction=a)});for(let[i,s]of r)if("targets"in i&&"targets"in s)for(let{data:o}of i.targets){let a=Ol.create(o,e);a&&s.targets.push(a)}}function j_(n,e,t){typeof e!="string"&&n.reset(e,t)}function X_(n,e,t,r,i=!1){if(!i&&e.states.length===0)return;let s=t===null?e:eu.patch(e,e.states.data(t));if(cy(n,s),n instanceof Pt&&s.type==="Mesh"){if(n instanceof Xs?n.buildFromStore(s.geometry):n.updateGeometry({parameters:s.geometry}),n.freeBooleanPointer(),At(n.parent)&&n.parent.invalidateDownstreamBooleanData().recomputeBoolean(),"material"in s){if(n.material instanceof Array)return;j_(n.material,s.material,r)}else if("materials"in s){if(!(n.material instanceof Array))return;var o=0;for(let a of s.materials)j_(n.material[o],a,r),o++}}else if(s.type==="DirectionalLight")n.fromDirectionalLightState(s,r);else if(s.type==="PointLight")n.fromPointLightState(s,r);else if(s.type==="SpotLight")n.fromSpotLightState(s,r);else if(n instanceof Yr&&Cs.is(s.type)){let a=s;n.setZoom("PerspectiveCamera",a.perspective.zoom),n.setZoom("OrthographicCamera",a.orthographic.zoom),n.isUpVectorFlipped=a.isUpVectorFlipped,n.targetOffset=a.targetOffset}}var Oo=class{constructor(e){this.objectState=e;this.uuid=Je.generateUUID()}static create(e,t){let r=new Oo(t);return r.uuid=e,r}execute(e,t){X_(e,this.objectState,null,t,!0)}};var Y_=["touchstart","touchend","touchmove","pointerdown","pointerup","pointermove"],np=class{constructor(e,t,r,i,s){this.app=s;this.isEnable=!1;this.splineEvents={};this.handlers=[];this.onResetRaycaster=()=>{this.raycastState.raycasterNeedsUpdate=!0};this.begin=(e,t)=>{let r=this.splineEvents[e][t];if(r){let{domElement:i}=this.raycastState;i.dispatchEvent(r)}};this.change=()=>{this.app.requestRender()};this.raycastState=new $f(e,t,r,i),this.handlers=[new Zf(this.raycastState),new tp(this.raycastState),new ep(this.raycastState),new Jf(this.raycastState),new Xf(this.raycastState),new Qf(this.raycastState),new rp(this.raycastState)]}activate(){let{scene:e,domElement:t}=this.raycastState;this.isEnable=!0,e.traverseEntity(r=>{if(!r.interaction)return;r.interaction.start(),["start","keyDown","keyUp","mouseDown","mouseUp","mouseHover","scroll"].forEach(s=>this.addDOMCustomEvent(s,r))}),this.handlers.forEach(r=>r.init(this.begin,this.change)),Y_.forEach(r=>{this.handlers.some(i=>i.domEventsNeeded.includes(r))&&t.addEventListener(r,this.onResetRaycaster)}),this.resize()}deactivate(){let{scene:e,domElement:t}=this.raycastState;this.isEnable=!1,e.traverseEntity(r=>{r.interaction?.end()}),this.handlers.forEach(r=>r.dispose()),Y_.forEach(r=>{t.removeEventListener(r,this.onResetRaycaster)})}resize(){let{domElement:e,renderer:t}=this.raycastState;this.raycastState.domRect=e.getBoundingClientRect(),this.raycastState.viewRect=ov(t)}addDOMCustomEvent(e,t){let r=new CustomEvent(e,{bubbles:!0});Object.defineProperty(r,"target",{writable:!1,value:{id:t.uuid,name:t.name}}),this.splineEvents[e]?this.splineEvents[e][t.uuid]=r:this.splineEvents[e]={[t.uuid]:r}}};var ip=class{constructor(e,t,r,i,s){this._aspect=1;this._renderer=e,this._camera=t,this._frameSize=new B().copy(r),this._editorSize=new B().copy(i),this._aspect=t.aspect,this._fov=s??t.fov}set frameSize(e){this._frameSize.copy(e)}updateRenderer(){!this._renderer||this._renderer.setSize(this._frameSize.x,this._frameSize.y)}updateViewportForImageExport(){if(!this._renderer||!this._camera||this._camera.cameraType!=="PerspectiveCamera")return;let e=this._frameSize.x,t=this._frameSize.y,r=this._editorSize.x,i=this._editorSize.y;this._aspect=e/t,this._camera.zoom*=Math.min(r/e,i/t),this._renderer.setViewport(0,0,e,t)}updateViewport(){if(!this._renderer||!this._camera||this._camera.cameraType!=="PerspectiveCamera")return;let e=this._frameSize.x,t=this._frameSize.y,r=this._editorSize.x,i=this._editorSize.y,s=0,o=0,a=e,l=t;e<r&&(s=(r-e)*.5,s=-s,a=r),t<i&&(o=(i-t)*.5,o=-o,l=i),this._aspect=a/l,this._renderer.setViewport(s,o,a,l)}updateCamera(){if(!!this._camera)if(this._camera.cameraType==="PerspectiveCamera"){let e=this._frameSize.y,t=this._editorSize.y,r=this._fov;if(e>t){let i=_U(e,1080,2160,1,15)/100;r*=e/t,r*=1-i}this._camera.aspect=this._aspect,this._camera.fov=r,this._camera.updateProjectionMatrix()}else this._camera.setViewplaneSize(this._frameSize.x,this._frameSize.y)}revert(){let e=window.innerWidth,t=window.innerHeight;this._renderer&&(this._renderer.setViewport(0,0,e,t),this._renderer.setSize(e,t)),this._camera&&(this._camera.aspect=e/t,this._camera.fov=this._fov,this._camera.setViewplaneSize(e,t),this._camera.updateProjectionMatrix())}};function _U(n,e,t,r,i){return(n-e)/(t-e)*(i-r)+r}var J_=Ev(Z_());var fv;gf.then(n=>{fv=n});var $_=new Re,AU=new Re,MU=new Re,Zn=new br,Ys=new _,TU=new Re,EU=new Re,Xs=class extends Pt{constructor(t,r,i,s){super(i??r,s);this.subdivPointer=t;this.originalGeometry=r;this.subdividedGeometry=i;this.objectType="SubdivObject";this.hiddenMatrixOld=new Re;this.smoothShading=!0;this.phongAngle=35;this.matrixWorldRigid=new Re;this.castShadow=!0,this.receiveShadow=!0,this.forceComputeSize=!1}static createFromState(t,r,i){let{subdivPointer:s,originalGeometry:o,subdividedGeometry:a}=Dn.build(r.geometry,void 0,void 0,!r.flatShading),l=i.material(r.material),u=new Xs(s,o,a||void 0,l);return r.geometry.phongAngle!==void 0&&(u.phongAngle=r.geometry.phongAngle),u.calcBoundingBox(),u.freeSubdivPointer(),u.uuid=t,u.fromState(r),u}buildFromStore(t,r){let{originalGeometry:i,subdividedGeometry:s,subdivPointer:o}=Dn.build(t,r,this.subdivPointer,this.smoothShading,this.shearScale);t.phongAngle!==void 0&&(this.phongAngle=t.phongAngle),this.subdivPointer=o,i!==void 0&&(this.originalGeometry?.dispose(),this.originalGeometry=i),s!==void 0&&(this.subdividedGeometry?.dispose(),this.subdividedGeometry=s??void 0),this.geometry=this.subdividedGeometry??this.originalGeometry,Vs(this),Hs(this),t.width&&(this.geometry.userData.parameters={width:t.width,height:t.height,depth:t.depth})}updateMesh(t=!1){Dn.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1,this.originalGeometry,t?this.shearScaleInv:void 0),this.subdividedGeometry&&Dn.buildLevel(this.subdivPointer,!1,this.smoothShading?this.phongAngle:-1,this.subdividedGeometry,t?this.shearScaleInv:void 0)}updateTopology(){this.originalGeometry.dispose(),this.originalGeometry=Dn.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1),this.subdividedGeometry&&(this.subdividedGeometry.dispose(),this.subdividedGeometry=Dn.buildLevel(this.subdivPointer,!1,this.smoothShading?this.phongAngle:-1)),this.geometry=this.subdividedGeometry??this.originalGeometry}raycast(t,r){this.geometry=this.originalGeometry,Pt.prototype.raycast.call(this,t,r),this.geometry=this.subdividedGeometry??this.originalGeometry}updateMatrixWorldSVD(){let t=this.matrixWorld.elements,r=[[t[0],t[4],t[8]],[t[1],t[5],t[9]],[t[2],t[6],t[10]]],{u:i,v:s,q:o}=(0,J_.SVD)(r),a=$_.set(i[0][0],i[0][1],i[0][2],0,i[1][0],i[1][1],i[1][2],0,i[2][0],i[2][1],i[2][2],0,0,0,0,1),l=AU.set(s[0][0],s[0][1],s[0][2],0,s[1][0],s[1][1],s[1][2],0,s[2][0],s[2][1],s[2][2],0,0,0,0,1),u=MU.copy(l).transpose();this.shearScale=TU.makeScale(o[0],o[1],o[2]).multiply(u).premultiply(l),this.shearScaleInv=EU.copy(this.shearScale).invert(),this.matrixWorldRigid.multiplyMatrices(a,u),o.every(c=>Math.abs(o[0]-c)<.01)&&(this.shearScale=void 0,this.shearScaleInv=void 0)}activateSVDCompensation(){this.shearScale!==void 0&&(this.matrixAutoUpdate=!1,this.matrix.copy(this.matrixWorldRigid).copyPosition(this.matrixWorld),this.hiddenMatrixOld.copy(this.hiddenMatrix),this.hiddenMatrix.copy(this.parent.matrixWorld).invert())}deactivateSVDCompensation(){this.shearScale!==void 0&&(this.shearScale=void 0,this.shearScaleInv=void 0,this.matrixAutoUpdate=!0,this.hiddenMatrix.copy(this.hiddenMatrixOld))}calcBoundingBox(){let t=this.originalGeometry;t.boundingSphere===null&&(t.boundingSphere=new Dr);let r=t.attributes.position,i=t.boundingSphere.center;Zn.setFromBufferAttribute(r),Zn.getCenter(i),t.boundingSphere.radius=i.distanceTo(Zn.max),isNaN(t.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),Zn.getSize(Ys);let s={width:Ys.x,height:Ys.y,depth:Ys.z};return this.geometry.userData.parameters=s,s}updateBoundingBox(t){let r=this.originalGeometry;Zn.min.set(t[0],t[2],t[4]),Zn.max.set(t[1],t[3],t[5]),this.shearScaleInv&&(Zn.min.applyMatrix4(this.shearScaleInv),Zn.max.applyMatrix4(this.shearScaleInv)),r.boundingSphere===null&&(r.boundingSphere=new Dr);let i=r.boundingSphere.center;Zn.getCenter(i),r.boundingSphere.radius=i.distanceTo(Zn.max),isNaN(r.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),Zn.getSize(Ys);let s={width:Ys.x,height:Ys.y,depth:Ys.z};return this.geometry.userData.parameters=s,s}freeSubdivPointer(){this.subdivPointer&&(fv.free_bvh(this.subdivPointer),fv.free_subdivision_surface(this.subdivPointer),this.subdivPointer=0)}updateGeometry(t){this.geometry.userData.scale||(this.geometry.userData.scale=Array(3)),this.geometry.userData.scale[0]=this.geometry.userData.parameters.width===0?1:t.parameters.width/this.geometry.userData.parameters.width,this.geometry.userData.scale[1]=this.geometry.userData.parameters.height===0?1:t.parameters.height/this.geometry.userData.parameters.height,this.geometry.userData.scale[2]=this.geometry.userData.parameters.depth===0?1:t.parameters.depth/this.geometry.userData.parameters.depth,K_(this.originalGeometry.attributes,...this.geometry.userData.scale),this.originalGeometry.attributes.position.needsUpdate=!0,this.originalGeometry.attributes.normal.needsUpdate=!0,this.subdividedGeometry&&(K_(this.subdividedGeometry.attributes,...this.subdividedGeometry.userData.scale),this.subdividedGeometry.attributes.position.needsUpdate=!0,this.subdividedGeometry.attributes.normal.needsUpdate=!0),this.geometry.userData.parameters={...t.parameters}}};function K_(n,e,t,r){let i=n.position.array,s=n.normal.array,o=$_.makeScale(e,t,r).invert().elements,a,l,u;for(var c=0,h=i.length;c<h;c+=3)i[c]*=e,i[c+1]*=t,i[c+2]*=r,a=s[c],l=s[c+1],u=s[c+2],s[c]=o[0]*a+o[4]*l+o[8]*u,s[c+1]=o[1]*a+o[5]*l+o[9]*u,s[c+2]=o[2]*a+o[6]*l+o[10]*u}function eA(n,e){e.flatShading!==void 0&&(n.flatShading=e.flatShading,n.needsUpdate=!0),e.wireframe!==void 0&&(n.wireframe=e.wireframe),e.side!==void 0&&(e.side===0?n.side=Gi:e.side===1?n.side=vr:n.side=xr)}function CU(n,e){if(Array.isArray(n.material))for(let t of n.material)eA(t,e);else{let t=n.material;eA(t,e)}n.objectType==="SubdivObject"&&e.flatShading!==void 0&&(n.material.flatShading=!1,n.smoothShading=!e.flatShading,n.updateMesh())}function tA(n,e,t){let r;if(e.geometry.type==="SubdivGeometry")r=Xs.createFromState(n,e,t);else{let i=e.geometry.type==="BooleanGeometry"?new De:Ef(e.geometry,t),s="materials"in e?e.materials.map(o=>t.material(o)):t.material(e.material);Jd.is2DParametricMesh(i.userData.type)?r=new Nf(i,s):i?.userData.type==="VectorGeometry"?r=new Ml(i,s):e.geometry.type==="NonParametricGeometry"?r=new Bf(i,s):e.geometry.type==="BooleanGeometry"?(r=new Pf(void 0,s),r.booleanOp=e.geometry.operation,e.geometry.phongAngle!==void 0&&(r.phongAngle=e.geometry.phongAngle)):r=new Bl(i,s),r.uuid=n,r.fromState(e,t)}return CU(r,e),r}function rA(n,e,t){return e.type==="Mesh"?tA(n,e,t):e.type==="TextFrame"?Ro.createFromState(n,e,t):e.type==="Empty"?Io.createFromState(n,e):e.type==="PointLight"?Ll.createFromState(n,e,t):e.type==="SpotLight"?Rl.createFromState(n,e,t):e.type==="DirectionalLight"?Il.createFromState(n,e,t):Cs.is(e.type)?Yr.createFromState(n,e):(console.error(e),new Io)}function nA(n,e){let t=!1,r=e.getLayersOfType("transmission"),i=e.getLayersOfType("outline");return i.length>0&&(n.layers.set(8),r.length>0&&n.layers.enable(3),t=!0,Hs(n),Vs(n)),r.length===0&&i.length===0&&n.layers.set(0),t}function iA(n,e){if(!e.layers)return!1;let t=!1,r=e.getLayersOfType("transmission"),i=e.getLayersOfType("outline");return r.length>0&&(n.layers.set(3),i.length>0&&n.layers.enable(8),t=!0),r.length===0&&i.length===0&&n.layers.set(0),t}function sA(n){let e=!1;return n.traverseEntity(t=>{if(t instanceof kt&&t.objectType!=="TextFrame")if(Array.isArray(t.material))for(let r=0;r<t.material.length;r++)nA(t,t.material[r])&&(e=!0);else nA(t,t.material)&&(e=!0)}),e}function oA(n){let e=!1;return n.traverseEntity(t=>{if(t instanceof kt)if(Array.isArray(t.material))for(let r=0;r<t.material.length;r++)iA(t,t.material[r])&&(e=!0);else iA(t,t.material)&&(e=!0)}),e}function aA(n){"material"in n&&PU(n.material),"geometry"in n&&n.geometry.dispose()}function PU(n){Gw(n).forEach(e=>{e instanceof No||e.dispose()})}var DU=new Sa,IU=new Re,LU=new ki;function lA(n,e,t){let r=n.cloner;if(r)for(let i of r.children){let s=IU.copy(i.matrixWorld).invert(),o=LU.copy(e.ray).applyMatrix4(s),a=n.matrixWorld;o.applyMatrix4(a);let l=DU;l.set(o.origin,o.direction),l.near=e.near,l.far=e.far,l.intersectObject(n,!1).length>0&&t.push({object:n})}}var cA=new _,pv=class extends vf(Vr){constructor(t,r){super();this.objectType="Scene";this.backupFog=new ua(16777215,.1,2e3);this.fogUseBGColor=!1;this.enableHelpers=!1;this.wireframeState=!1;this.needsTransmissionDirty=!0;this.needsNormalDirty=!0;this._needsTransmission=!1;this._needsNormal=!1;this.bgColor=new dr(1,1,1,1);this.entityByUuid={};this.ambientLight=new go(13882323,8553090,.75),this.ambientLight.name="Default Ambient Light",this.ambientLight.layers.enable(3),this.personalCamera=this.createPersonalCamera(),this.activeCamera=this.personalCamera,this.postprocessing=t.postprocessing,this.init(t,r)}needsTransmission(){return this.needsTransmissionDirty&&(this._needsTransmission=oA(this),this.needsTransmissionDirty=!1),this._needsTransmission}needsNormal(){return this.needsNormalDirty&&(this._needsNormal=sA(this),this.needsNormalDirty=!1),this._needsNormal}find(t){if(t===""||t===void 0)return;let r=this.entityByUuid[t];return r===void 0?this.getObjectByProperty("uuid",t):r}get enableFog(){return this.fog!==null}set enableFog(t){this.fog=t===!0?this.backupFog:null}init(t,r){if(this.createChildrenObjects(t.objects,this,r),this.personalCamera.removeFromParent(),this.add(this.personalCamera),this.ambientLight.removeFromParent(),this.add(this.ambientLight),this.setBackgroundColor(or(t.backgroundColor,r)),this.updateFog(t.fog,r),this.updateAmbientLight(t.environment.ambientLight,r),this.activeCamera=this.personalCamera,t.publish.playCamera!==null){let i=this.find(t.publish.playCamera);i instanceof Yr&&this.switchActiveCamera(i)}this.traverse(i=>{At(i)&&i.recomputeBoolean()})}clearScene(){this.traverseEntity(t=>{aA(t)});for(let t of this.children)gi(t)&&t.removeFromParent()}resetAfterClear(t,r){this.init(t,r)}createPersonalCamera(){let t=Yr.createFromState(pv.PERSONAL_CAMERA_ID,{...ef.defaultData,name:"Personal Camera"});return t.objectHelper.visible=!1,delete t.isEntity,this.registerObjectCreatedInLegacy(t),t}raycast(t){let r=[],i=s=>{for(let o of s.children)gi(o)&&!o.raycastLock&&o.visible&&((Ut(o)||yf(o)&&this.enableHelpers&&o.objectHelper.visible)&&(t.intersectObject(o,!1,r),lA(o,t,r)),i(o))};return i(this),r}traverseEntity(t){for(let r of this.children)gi(r)&&r.traverseEntity(t)}traverseVisibleEntity(t){for(let r of this.children)gi(r)&&r.visible&&r.traverseVisibleEntity(t)}updateFog(t,r){this.enableFog=t.enabled,this.fogUseBGColor=t.useBackgroundColor,t.useBackgroundColor?this.backupFog.color.set(this.bgColor):this.backupFog.color=or(t.color,r),this.backupFog.near=t.near,this.backupFog.far=t.far}dispose(){this.clearScene()}updateAmbientLight(t,r){S1(this.ambientLight,t,r),t.groundColor!==void 0&&(this.ambientLight.groundColor=or(t.groundColor,r)),t.enabled!==void 0&&(this.ambientLight.visible=t.enabled)}switchActiveCamera(t){this.activeCamera!==this.personalCamera&&(this.activeCamera.objectHelper.visible=!0),this.activeCamera=t,t.objectHelper.visible=!1}setBackgroundColor(t){this.bgColor=t,this.fogUseBGColor===!0&&(this.backupFog.color=t)}createChildrenObjects(t,r,i){for(let s of t)this.createChildObject(s.id,s.data,s.children,r,i)}registerObjectCreatedInLegacy(t){this.entityByUuid[t.uuid]=t}unregisterObject(t){delete this.entityByUuid[t.uuid];for(let r of t.children)this.unregisterObject(r)}createChildObject(t,r,i,s,o){let a=rA(t,r,o);return a&&(this.entityByUuid[t]=a,s.add(a),At(s)&&Ut(a)&&(a.prevBooleanObjectParent=s),this.createChildrenObjects(i,a,o)),a}getCenter(t){let r=[];for(let s=0,o=t.length;s<o;++s){let{id:a,recursive:l}=t[s],u=this.find(a),c=l?u.recursiveBBox:u.singleBBox;r.push(...c.vertices)}let i=new br;return i.setFromPoints(r),i.getCenter(cA),cA}copyMatrixWorld(t,r){if(t===null){r.identity();return}let i=this.find(t);i?r.copy(i.matrixWorld):r.identity()}copyParentMatrixWorld(t,r){if(t===null){r.identity();return}let i=this.find(t)?.parent;i?r.copy(i.matrixWorld):r.identity()}traverseMaterial(t){this.traverseEntity(r=>{if(r instanceof Pt)if(Array.isArray(r.material))for(let i=0;i<r.material.length;i++)r.material[i]instanceof vn&&t(r.material[i]);else r.material instanceof vn&&t(r.material)})}updateCanvasSize(t,r){this.activeCamera.setViewplaneSize(t,r);let i,s;t>=r?(i=r/t,s=1):(i=1,s=t/r),this.traverseMaterial(o=>{o.getLayersOfType("transmission").forEach(l=>{l.uniforms[`f${l.id}_aspectRatio`].value.x=i,l.uniforms[`f${l.id}_aspectRatio`].value.y=s})})}},ku=pv;ku.PERSONAL_CAMERA_ID="f23858d0-4a3b-4bd8-8173-66ed0af7f6fb-personalCamera";var op=class extends ku{constructor(e,t){super(e,t)}dispose(){super.dispose()}};var gA={RED:0,GREEN:1,BLUE:2,ALPHA:3};var Vu="varying vec2 vUv;void main(){vUv=position.xy*0.5+0.5;gl_Position=vec4(position.xy,1.0,1.0);}";var RU=`#ifdef FRAMEBUFFER_PRECISION_HIGH
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@splinetool/runtime",
3
- "version": "0.9.94",
3
+ "version": "0.9.95",
4
4
  "type": "module",
5
5
  "main": "./build/runtime.js",
6
6
  "module": "./build/runtime.js",