@splinetool/loader 0.9.47 → 0.9.50
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/SplineLoader.js +1 -1
- package/package.json +1 -1
package/build/SplineLoader.js
CHANGED
|
@@ -938,5 +938,5 @@ vec4 getIBLVolumeRefraction( vec3 n, vec3 v, float roughness, vec3 position, mat
|
|
|
938
938
|
outgoingLight = spe_blend( diffuseColor, outgoingLight, ${l.result}, ${c.result} );
|
|
939
939
|
}
|
|
940
940
|
`),h&&u.push(h.code,`outgoingLight = spe_blend(outgoingLight, ${h.result}, 1.0, SPE_BLENDING_NORMAL);`),p?u.push(`gl_FragColor = vec4( outgoingLight, accumAlpha * ${p.result} );`):u.push("gl_FragColor = vec4( outgoingLight, 1.0 );"),u.push("#include <encodings_fragment>","#include <fog_fragment>","#include <dithering_fragment>"),r=u.join(`
|
|
941
|
-
`)}return r}copy(e){return super.copy(e),e.color&&(this.color=e.color.clone()),this.roughness=e.roughness.clone(),this.metalness=e.metalness.clone(),e.position&&(this.position=e.position.clone()),e.afterColor&&(this.afterColor=e.afterColor.clone()),e.alpha&&(this.alpha=e.alpha.clone()),e.reflectivity&&(this.reflectivity=e.reflectivity.clone()),e.shadingAlpha&&(this.shadingAlpha=e.shadingAlpha.clone()),e.shadingBlend&&(this.shadingBlend=e.shadingBlend.clone()),this}};var ma=class extends Vt{constructor(e=new ua,r){super(e,e,r);this.type="StandardNodeMaterial",this.fragment=e}get color(){return this.fragment.color}set color(e){this.fragment.color=e}get afterColor(){return this.fragment.afterColor}set afterColor(e){this.fragment.afterColor=e}get alpha(){return this.fragment.alpha}set alpha(e){this.fragment.alpha=e}get shadingAlpha(){return this.fragment.shadingAlpha}set shadingAlpha(e){this.fragment.shadingAlpha=e}get shadingBlend(){return this.fragment.shadingBlend}set shadingBlend(e){this.fragment.shadingBlend=e}get position(){return this.fragment.position}set position(e){this.fragment.position=e}get roughness(){return this.fragment.roughness}set roughness(e){this.fragment.roughness=e}get metalness(){return this.fragment.metalness}set metalness(e){this.fragment.metalness=e}get reflectivity(){return this.fragment.reflectivity}set reflectivity(e){this.fragment.reflectivity=e}};var bi=class extends ma{constructor(t,e,r){super(e,t),this.userData.type="PhysicalMaterial",this.userData.category="Physical",this.userData.layers=r!=null?r:this._getLayerStack(t==null?void 0:t.map)}get layersList(){return this.userData.layers}set layersList(t){this.userData.layers=t}equals(t){return this.userData.type===t.userData.type&&this.userData.layers.uuid==t.userData.layers.uuid}copy(t){if(t.userData.layers!==void 0&&t.userData.layers instanceof wt){let e=t.userData.layers,r=t.fragment;super.copy(t);let o=r.clone();this.fragment=o,this.vertex=o;let i=e.clone(this);this.userData.layers=i,o.shadingAlpha.value=r.shadingAlpha.value,o.shadingBlend.value=r.shadingBlend.value}else super.copy(t);return this}static fromJSON(t,e,r){let o=r.getNode(e.vertex),i=new bi(void 0,o);return i.fromJSON(e,r),i}dispose(){super.dispose()}};import{Color as $l}from"three";function Xe(n,t){let e;if(typeof n=="string"){let r=t==null?void 0:t.getColor(n);r?e=r:(console.warn("Tried to create color layer params with a color key that does not exist in the assets manager"),e=new Dt(0,0,0,0))}else return"a"in n?new Dt(n.r,n.g,n.b,n.a):new Dt(n.r,n.g,n.b,1);return e}import{Matrix3 as yu,Texture as Wl,Vector2 as Ln,Vector3 as to,Vector4 as gu}from"three";function xu(n,t){switch(n.data.type){case"light":return ir(n);case"fresnel":return fS(n,t);case"gradient":return yS(n);case"depth":return gS(n);case"normal":return xS(n);case"noise":return bS(n,t);case"texture":return vS(n,t);case"rainbow":return SS(n);case"transmission":return wS(n,t);case"matcap":return LS(n,t);case"displace":return CS(n);case"color":default:return mS(n,t)}}function bu(n){return{type:n.data.type}}function ir(n){let{alpha:t,mode:e}=n.data;return H(P({},bu(n)),{alpha:t,mode:e})}function mS(n,t){return H(P({},ir(n)),{color:Xe(n.data.color,t)})}function fS(n,t){let{bias:e,scale:r,intensity:o,factor:i,color:s}=n.data;return H(P({},ir(n)),{color:Xe(s,t),bias:e,scale:r,intensity:o,factor:i})}function yS(n){let{gradientType:t,smooth:e,colors:r,steps:o,angle:i,offset:s,morph:a}=n.data;return H(P({},ir(n)),{gradientType:t,smooth:e,colors:r.map(l=>new gu(l[0],l[1],l[2],l[3])),num:r.length,steps:o,offset:new Ln(...s),morph:new Ln(...a),angle:i})}function gS(n){let{gradientType:t,near:e,far:r,isVector:o,isWorldSpace:i,origin:s,direction:a,colors:l,steps:c,smooth:h,num:p}=n.data;return H(P({},ir(n)),{gradientType:t,near:e,far:r,isVector:o,isWorldSpace:i,origin:new to(...s),direction:a?new to(...a):new to(1,0,0),num:p,colors:l.map(d=>new gu(d[0],d[1],d[2],d[3])),steps:c,smooth:h})}function xS(n){let{cnormal:t}=n.data;return H(P({},ir(n)),{cnormal:new to(t[0],t[1],t[2])})}function bS(n,t){let{data:e}=n;return H(P({},ir(n)),{scale:e.scale,move:e.move,fA:new Ln(...e.fA),fB:new Ln(...e.fB),size:new to(...e.size),distortion:new Ln(...e.distortion),colorA:Xe(e.colorA,t),colorB:Xe(e.colorB,t),colorC:Xe(e.colorC,t),colorD:Xe(e.colorD,t),noiseType:e.noiseType})}function vS(n,t){let{projection:e,axis:r,side:o,crop:i,size:s}=n.data,{image:a,wrapping:l,repeat:c,offset:h}=n.data.texture,p=new Wl,d;if(typeof a=="string")d=t==null?void 0:t.getImage(a);else{let u=new Image;u.src=a.data,u.onload=()=>{t!=null&&t.onImageLoad&&(t==null||t.onImageLoad(a.data))},d=u}return p.image=d,p.repeat.set(c[0],c[1]),p.offset.set(h[0],h[1]),p.wrapS=p.wrapT=l,H(P({},ir(n)),{texture:p,mat:new yu().setUvTransform(h[0],h[1],c[0],c[1],0,0,0),crop:i,projection:e,axis:["x","y","z"].indexOf(r),side:[2,0,1].indexOf(o),size:s})}function SS(n){let{data:t}=n;return H(P({},ir(n)),{filmThickness:t.filmThickness,movement:t.movement,wavelengths:new to(...t.wavelengths),noiseStrength:t.noiseStrength,noiseScale:t.noiseScale,offset:new to(...t.offset)})}function wS(n,t){let{data:e}=n;return H(P({},ir(n)),{thickness:e.thickness,ior:e.ior,roughness:e.roughness,transmissionSamplerMap:t.transmissionSamplerMap,transmissionDepthMap:t.transmissionDepthMap})}function LS(n,t){let e=new Wl,{image:r}=n.data.texture,o;if(typeof r=="string")o=t==null?void 0:t.getImage(r);else{let s=new Image;s.src=r.data,s.onload=()=>{t!=null&&t.onImageLoad&&(t==null||t.onImageLoad(r.data))},o=s}e.image=o;let i=16777215;return H(P({},ir(n)),{color:i,texture:e})}function CS(n){let{data:t}=n,e=H(P({},bu(n)),{intensity:t.intensity});if(t.displacementType==="noise")return H(P({},e),{offset:new to(...t.offset),scale:t.scale,movement:t.movement,noiseType:t.noiseType});{let r=new Wl,o=new yu().setUvTransform(0,0,1,1,0,0,0);return H(P({},e),{texture:r,mat:o,crop:t.crop})}}function vu(n,t,e){if(e.type==="displace"&&(n==="intensity"||n==="visible")){let r=t.uniforms[`f${t.id}_intensity`];return r?(r.value=e.intensity*(e.visible?1:0),r):void 0}if(e.type!=="displace"&&(n==="alpha"||n==="visible")){let r=t.uniforms[`f${t.id}_alpha`];return r?(r.value=e.alpha*(e.visible?1:0),r):void 0}}import{Color as Lu,Vector4 as TS}from"three";var vi;(t=>{function n(e){return new Lu(e.x,e.y,e.z).getHex()}t.getHex=n})(vi||(vi={}));var Su;(t=>{function n(e){return new TS(e.r,e.g,e.b,e.a)}t.getThreeVector4=n})(Su||(Su={}));var wu;(e=>{function n(r,o){r.setRGB(o.r,o.g,o.b)}e.setThreeColor=n;function t(r){return new Lu(r.r,r.g,r.b).getHex()}e.getHex=t})(wu||(wu={}));function Cn(n,t){return typeof n=="string"?t.getMaterialOrDeletedPlaceholder(n):Jl(n,t)}function Cu(n,t){return n.map(e=>Cn(e,t))}function Jl(n,t){var s,a;let e=(s=n.layers)!=null?s:xo.defaultTwoLayerData("phong").layers,r=NS(e),o;switch(r.category){case"basic":o=new mt;break;case"lambert":{o=new gi;break}case"toon":{o=new xi;break}case"physical":o=new bi;break;case"phong":default:{o=new Ot;break}}o.name=(a=n.name)!=null?a:"Untitled Material";let i=o.userData.layers;MS(i);for(let l=e.length-1;l>=0;l--)OS(i,e[l],t);switch(r.category){case"basic":break;case"lambert":{let h=o,d=Xe(r.emissive,t);d instanceof $l?h.emissive.value=d:h.emissive.value.setHex(vi.getHex(d));break}case"toon":{let h=o,p=r;h.shininess.value=p.shininess;let d=Xe(p.specular,t);d instanceof $l?h.specular.value=d:h.specular.value.setHex(vi.getHex(d));break}case"physical":let l=o,c=r;l.metalness.value=c.metalness,l.roughness.value=c.roughness,l.reflectivity.value=c.reflectivity;break;case"phong":default:{let h=o,p=r;h.shininess.value=p.shininess;let d=Xe(p.specular,t);d instanceof $l?h.specular.value=d:h.specular.value.setHex(vi.getHex(d));break}}return i.blendColors(),i.blendAfterColors(),i.blendPositions(),o}function NS(n){for(let t of n)if(t.data.type==="light")return t.data;return{type:"light",category:"basic",visible:!0,alpha:1,mode:0}}function MS(n){for(let t of n.getLayers())n.removeLayer(t.id)}function OS(n,t,e){let r=xu(t,e);r.type==="transmission"&&(r.transmissionSamplerMap=e==null?void 0:e.transmissionSamplerMap,r.transmissionDepthMap=e==null?void 0:e.transmissionDepthMap);let o=n.addLayer(r);o.uuid=t.id;for(let i in t.data)vu(i,o,t.data)}import{Mesh as zS,Matrix4 as RS}from"three";import{Matrix4 as Yl}from"three";import{Box3 as Iu,Line3 as $t,Matrix4 as Kl,Vector3 as Ve}from"three";import{HemisphereLight as Tu}from"three";var fa=n=>"isEntity"in n,br=n=>"isAbstractMesh"in n,_r=n=>n!==null&&n.isBooleanMesh,Nu=n=>n.objectType==="CombinedCamera";var Gr=n=>"objectHelper"in n;function PS(n,t){var r;let e=!1;t.position&&(n.position.fromArray(t.position),e=!0),t.rotation&&(n.rotation.fromArray(t.rotation),e=!0),t.scale&&(e=!0,n.scale.fromArray(t.scale)),t.hiddenMatrix!==void 0&&"hiddenMatrix"in n&&(e=!0,n.hiddenMatrix.fromArray((r=t.hiddenMatrix)!=null?r:$r.identity)),e&&(n.updateMatrix(),_r(n.parent)&&br(n)&&n.invalidateDownstreamBooleanData().recomputeBoolean()),t.position&&t.rotation&&t.scale&&t.hiddenMatrix!==void 0&&n.updateWorldMatrix(!1,!0),n.objectType==="CombinedCamera"&&(t.isUpVectorFlipped!==void 0&&(n.isUpVectorFlipped=t.isUpVectorFlipped),n.updateUp())}function IS(n,t){PS(n,t),t.name!==void 0&&(n.name=t.name),t.visible!==void 0&&(n.isEntity?n.visibility=t.visible:n.visible=t.visible)}function Mu(n,t,e){IS(n,t),t.color!==void 0&&(n.color=Xe(t.color,e)),t.intensity!==void 0&&(n.intensity=t.intensity),t.shadows!==void 0&&!(n instanceof Tu)&&(n.castShadow=t.shadows),n.shadow&&!(n instanceof Tu)&&t.depth!==void 0&&(n.shadow.camera.far=t.depth,n.shadow.needsUpdate=!0),t.helper!==void 0&&Gr(n)&&(n.enableHelper=t.helper,n.gizmos.shadowmap.visible=t.helper)}function Ou(n,t){n.shadow.camera.right=t/2,n.shadow.camera.left=-t/2,n.shadow.camera.top=t/2,n.shadow.camera.bottom=-t/2,n.shadow.needsUpdate=!0}var Si=new Iu,ft=new Ve,le=new Ve,tt=new Kl;function AS(n,t,e=0,r=t.count){let o=1/0,i=1/0,s=1/0,a=-1/0,l=-1/0,c=-1/0;for(let h=e;h<r;h++){let p=t.getX(h),d=t.getY(h),u=t.getZ(h);p<o&&(o=p),d<i&&(i=d),u<s&&(s=u),p>a&&(a=p),d>l&&(l=d),u>c&&(c=u)}return n.min.set(o,i,s),n.max.set(a,l,c),n}var Pu=(n,t,e,r)=>{var o;if(br(n)){let i=n.geometry.userData.parameters,s=n.geometry.getAttribute("position");n.geometry.userData.type==="SubdivGeometry"?ft.copy(n.originalGeometry.boundingSphere.center):s!==void 0&&(AS(Si,s,n.geometry.drawRange.start,n.geometry.drawRange.count<1/0?n.geometry.drawRange.count:s.count),Si.getCenter(ft)),n.forceComputeSize?Si.getSize(le).multiplyScalar(.5):le.set(i.width,i.height,(o=i.depth)!=null?o:0).multiplyScalar(.5)}else if(Gr(n)&&r===!0){let i=n.geometryHelper.getAttribute("position");Si.setFromArray(i.array),Si.getCenter(ft),Si.getSize(le).multiplyScalar(.5)}else ft.setScalar(0),le.setScalar(0);tt.copy(t).multiply(n.matrixWorld),le.x===0&&le.y===0&&le.z===0?e.push(new Ve(ft.x,ft.y,ft.z).applyMatrix4(tt)):e.push(new Ve(-le.x,le.y,le.z).add(ft).applyMatrix4(tt),new Ve(-le.x,-le.y,le.z).add(ft).applyMatrix4(tt),new Ve(le.x,-le.y,le.z).add(ft).applyMatrix4(tt),new Ve(le.x,le.y,le.z).add(ft).applyMatrix4(tt),new Ve(-le.x,le.y,-le.z).add(ft).applyMatrix4(tt),new Ve(-le.x,-le.y,-le.z).add(ft).applyMatrix4(tt),new Ve(le.x,-le.y,-le.z).add(ft).applyMatrix4(tt),new Ve(le.x,le.y,-le.z).add(ft).applyMatrix4(tt))},Tn=class extends Iu{constructor(){super(...arguments);this.matrix=new Kl;this.vertices=[];this.faces=[];this.edges=[];this.centerEdges=[]}copy(e){return super.copy(e),this.matrix.copy(e.matrix),this.vertices=e.vertices.map(r=>r.clone()),this.faces=e.faces.map(r=>r.clone()),this.edges=e.edges.map(r=>r.clone()),this.centerEdges=e.centerEdges.map(r=>r.clone()),this}setFromObjectSize(e,r=!1){e.updateWorldMatrix(!1,r),this.makeEmpty(),this.matrix.copy(e.matrixWorld);let o=new Kl().copy(e.matrixWorld).invert();return this.expandByObjectSize(e,o,r)}expandByObjectSize(e,r,o=!1){let i=[];return o===!0?e.traverseEntity(s=>{s.visible&&Pu(s,r,i,e.enableHelper===!0)}):Pu(e,r,i,e.enableHelper===!0),this.setFromPoints(i)}getCenter(e){return e=super.getCenter(e),e.applyMatrix4(this.matrix),e}getPositionToCenter(e){return e=super.getCenter(e),e.applyMatrix4(tt.copy(this.matrix).setPosition(0,0,0)),e}computeVertices(){this.getSize(le).multiplyScalar(.5),this.getCenter(ft),tt.copy(this.matrix).setPosition(ft),this.vertices=[new Ve(-le.x,le.y,le.z).applyMatrix4(tt),new Ve(-le.x,-le.y,le.z).applyMatrix4(tt),new Ve(le.x,-le.y,le.z).applyMatrix4(tt),new Ve(le.x,le.y,le.z).applyMatrix4(tt),new Ve(-le.x,le.y,-le.z).applyMatrix4(tt),new Ve(-le.x,-le.y,-le.z).applyMatrix4(tt),new Ve(le.x,-le.y,-le.z).applyMatrix4(tt),new Ve(le.x,le.y,-le.z).applyMatrix4(tt)]}computeEdges(){this.vertices.length>0&&this.computeVertices(),this.edges=[new $t(this.vertices[0],this.vertices[3]),new $t(this.vertices[1],this.vertices[2]),new $t(this.vertices[5],this.vertices[6]),new $t(this.vertices[4],this.vertices[7]),new $t(this.vertices[0],this.vertices[1]),new $t(this.vertices[3],this.vertices[2]),new $t(this.vertices[7],this.vertices[6]),new $t(this.vertices[4],this.vertices[5]),new $t(this.vertices[0],this.vertices[4]),new $t(this.vertices[1],this.vertices[5]),new $t(this.vertices[2],this.vertices[6]),new $t(this.vertices[3],this.vertices[7])],this.centerEdges=this.edges.map(e=>e.getCenter(new Ve))}computeFaces(){this.vertices.length>0&&this.computeVertices(),this.faces=[new Ve().copy(this.vertices[0]).sub(this.vertices[2]).multiplyScalar(.5).add(this.vertices[2]),new Ve().copy(this.vertices[7]).sub(this.vertices[5]).multiplyScalar(.5).add(this.vertices[5]),new Ve().copy(this.vertices[4]).sub(this.vertices[1]).multiplyScalar(.5).add(this.vertices[1]),new Ve().copy(this.vertices[3]).sub(this.vertices[6]).multiplyScalar(.5).add(this.vertices[6]),new Ve().copy(this.vertices[4]).sub(this.vertices[3]).multiplyScalar(.5).add(this.vertices[3]),new Ve().copy(this.vertices[1]).sub(this.vertices[6]).multiplyScalar(.5).add(this.vertices[6])]}};import{Object3D as DS,Matrix4 as BS,Light as ES}from"three";function Nn(n){let t=[];for(let e in n){let r=n[e];delete r.metadata,t.push(r)}return t}function _S(n){let t=[];for(let e in n)t.push(n[e]);return t}var ya=n=>class extends n{hasEntityChild(){return this.children.some(e=>fa(e))}isDescendantOf(e){e instanceof DS&&(e=e.uuid);let r=this;for(;r.parent;){if(r.parent.uuid===e)return!0;r=r.parent}return!1}attach(e,r){this.updateWorldMatrix(!0,!1);let o=new BS().copy(this.matrixWorld).invert();return e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),o.multiply(e.parent.matrixWorld)),fa(e)?e.hiddenMatrix.premultiply(o):e.applyMatrix4(o),e.updateWorldMatrix(!1,!1),this.add(e),r!==void 0&&(this.children.pop(),this.children.splice(r,0,e)),this}copy(e,r=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),r===!0)for(let o=0;o<e.children.length;o++){let i=e.children[o];this.add(i.clone())}return this}toJSON(e){let r=e===void 0,o={object:{uuid:"",objectType:""}};e===void 0&&(e={geometries:{},materials:{},textures:{},images:{},interactionStates:{},nodes:{}},o.metadata={version:1.5,type:"Object",generator:"Object3D.toJSON"});let i={uuid:this.uuid,objectType:this.type};if(this.name!==""&&(i.name=this.name),i.matrix=this.matrix.toArray(),this.castShadow===!0&&(i.castShadow=!0),this.receiveShadow===!0&&(i.receiveShadow=!0),this.visible===!1&&(i.visible=!1),this.frustumCulled===!1&&(i.frustumCulled=!1),this.renderOrder!==0&&(i.renderOrder=this.renderOrder),i.layers=this.layers.mask,JSON.stringify(this.userData)!=="{}"&&(i.userData=this.userData),this.children.length>0){i.children=[];for(let s of this.children)(fa(s)||s instanceof ES)&&i.children.push(s.toJSON(e).object)}if(r){let s=Nn(e.geometries),a=Nn(e.materials),l=Nn(e.textures),c=Nn(e.images),h=Nn(e.interactionStates),p=_S(e.nodes);s.length>0&&(o.geometries=s),a.length>0&&(o.materials=a),l.length>0&&(o.textures=l),c.length>0&&(o.images=c),h.length>0&&(o.interactionStates=h),p.length>0&&(o.nodes=p)}return o.object=i,o}fromJSON(e){return this.uuid=e.uuid,e.name!==void 0&&(this.name=e.name),e.matrix!==void 0?(this.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(this.matrixAutoUpdate=e.matrixAutoUpdate),this.matrixAutoUpdate&&this.matrix.decompose(this.position,this.quaternion,this.scale)):(e.position!==void 0&&this.position.fromArray(e.position),e.rotation!==void 0&&this.rotation.fromArray(e.rotation),e.quaternion!==void 0&&this.quaternion.fromArray(e.quaternion),e.scale!==void 0&&this.scale.fromArray(e.scale)),this.castShadow=e.castShadow!==void 0,this.receiveShadow=e.receiveShadow!==void 0,e.visible!==void 0&&(this.visible=e.visible),e.frustumCulled!==void 0&&(this.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(this.renderOrder=e.renderOrder),e.layers!==void 0&&(this.layers.mask=e.layers),e.userData!==void 0&&(this.userData=e.userData),this}};var Jt=n=>"isEntity"in n,Au=n=>"isAbstractMesh"in n,Kt=n=>class extends ya(n){constructor(){super(...arguments);this.objectType="";this.isEntity=!0;this.raycastLock=!1;this.scaleLock=!1;this.hiddenMatrix=new Yl;this._singleBBox=new Tn;this._recursiveBBox=new Tn;this.singleBBoxNeedsUpdate=!0;this.recursiveBBoxNeedsUpdate=!0;this.forceComputeSize=!1}set visibility(r){this.visible=r;for(let o of this.children)Jt(o)&&o.traverseEntity(i=>{Gr(i)&&i.visible&&(i.objectHelper.visible=r)})}get visibility(){return this.visible}get singleBBox(){return this.singleBBoxNeedsUpdate&&(this.singleBBoxNeedsUpdate=!1,this._singleBBox.setFromObjectSize(this,!1),this._singleBBox.computeVertices(),this._singleBBox.computeEdges(),this._singleBBox.computeFaces()),this._singleBBox}get recursiveBBox(){return this.recursiveBBoxNeedsUpdate&&(this.recursiveBBoxNeedsUpdate=!1,this._recursiveBBox.setFromObjectSize(this,!0),this._recursiveBBox.computeVertices(),this._recursiveBBox.computeEdges(),this._recursiveBBox.computeFaces()),this._recursiveBBox}resetBBoxNeedsUpdate(){this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0,this.traverseAncestors(r=>{Jt(r)&&(r.singleBBoxNeedsUpdate=!0,r.recursiveBBoxNeedsUpdate=!0)}),this.traverseEntity(r=>{r.singleBBoxNeedsUpdate=!0,r.recursiveBBoxNeedsUpdate=!0})}traverseEntity(r){r(this);for(let o of this.children)Jt(o)&&o.traverseEntity(r)}updateMatrixWorld(r){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||r)&&(this.parent===null?this.matrixWorld.multiplyMatrices(this.hiddenMatrix,this.matrix):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,r=!0);for(let o of this.children)o.updateMatrixWorld(r)}updateWorldMatrix(r,o){let i=this.parent;if(r&&i!==null&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.multiplyMatrices(this.hiddenMatrix,this.matrix):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,this.matrix)),o)for(let s of this.children)s.updateWorldMatrix(!1,!0)}shallowClone(r){return new this.constructor().shallowCopy(this,r)}shallowCopy(r,o=!0){if(super.copy(r,!1),this.raycastLock=r.raycastLock,this.scaleLock=r.scaleLock,this.hiddenMatrix.copy(r.hiddenMatrix),o===!0)for(let i of r.children)Jt(i)&&this.add(i.shallowClone());return this}clone(r){return new this.constructor().copy(this,r)}copy(r,o=!0){if(super.copy(r,!1),this.raycastLock=r.raycastLock,this.scaleLock=r.scaleLock,this.hiddenMatrix.copy(r.hiddenMatrix),o===!0)for(let i of r.children)Jt(i)&&this.add(i.clone());return this}keepChildrenMatrixWorld(){let r=new Yl,o=this.matrixWorld.clone();this.updateWorldMatrix(!1,!1),r.copy(this.matrixWorld).invert(),r.multiply(o);for(let i of this.children)Jt(i)&&i.hiddenMatrix.premultiply(r)}toJSON(r){let o=super.toJSON(r),i=o.object;return this.raycastLock===!0&&(i.raycastLock=!0),this.scaleLock===!0&&(i.scaleLock=!0),i.hiddenMatrix=this.hiddenMatrix.toArray(),o}fromJSON(r){return super.fromJSON(r),r.raycastLock!==void 0&&(this.raycastLock=r.raycastLock),r.scaleLock!==void 0&&(this.scaleLock=r.scaleLock),this.hiddenMatrix.fromArray(r.hiddenMatrix),this}fromObject3D(r){let o=r.children;return r.children=[],Object.assign(r,{raycastLock:!1,scaleLock:!1,hiddenMatrix:new Yl}),this.copy(r),r.children=o,this}toObjectTransformState(r=[]){this.updateWorldMatrix(!0,!1);let o={position:this.position.toArray(),rotation:[this.rotation.x,this.rotation.y,this.rotation.z],scale:this.scale.toArray(),hiddenMatrix:this.hiddenMatrix.toArray()};return $o(o,r)}fromObjectTransformState(r){return r.position&&this.position.fromArray(r.position),r.rotation&&this.rotation.fromArray(r.rotation),r.scale&&this.scale.fromArray(r.scale),r.hiddenMatrix&&this.hiddenMatrix.fromArray(r.hiddenMatrix),this.updateMatrix(),this}toState(r=[]){let o=P({name:this.name,visible:this.visible,raycastLock:this.raycastLock},this.toObjectTransformState(r));return $o(o,r)}fromState(r,o){return r.name&&(this.name=r.name),r.raycastLock!==void 0&&(this.raycastLock=r.raycastLock),r.type!=="OrthographicCamera"&&r.type!=="PerspectiveCamera"&&(this.matrixAutoUpdate=!1),r.visible!==void 0&&(this.visibility=r.visible),this.fromObjectTransformState(r),this}};import{Object3D as GS,Vector3 as Mn,Euler as Du,MathUtils as ro}from"three";var Co=class extends GS{constructor(e,r={}){super();this.object=e;let o=e.recursiveBBox.getSize(new Mn),i=.1;this.parameters=fs.defaultData(o.toArray(),i),uo(this.parameters,r),this.update(),this.setHideBase(this.parameters.hideBase)}refreshMaterial(){if("material"in this.object)for(let e of this.children)e.material=this.object.material}setHideBase(e){if("material"in this.object){if(Array.isArray(this.object.material)){if(this.children.length>0){for(let r of this.object.material)r.visible=!0;if(e){let r=this.object.material.map(o=>o.clone());for(let o of this.children)o.material=r}else for(let r of this.children)r.material=this.object.material}for(let r of this.object.material)r.visible=!e}else{if(this.children.length>0)if(this.object.material.visible=!0,e){let r=this.object.material.clone();for(let o of this.children)o.material=r}else for(let r of this.children)r.material=this.object.material;this.object.material.visible=!e}this.parameters.hideBase=e}}update(){switch(this._updateCount(),this.parameters.type){case"radial":this._updateRadial(this.parameters);break;case"linear":this._updateLinear(this.parameters);break;case"grid":this._updateGrid(this.parameters)}this.children.forEach(e=>e.updateMatrix())}_updateCount(){let e=this.parameters.type==="grid"?this.parameters.grid.count[0]*this.parameters.grid.count[1]*this.parameters.grid.count[2]:this.parameters.count;if(this.children.length!==e)if(this.children.length<e)for(let r=0,o=e-this.children.length;r<o;++r){let i=this.object.shallowClone(!1);i.visible=!0,this.add(i),this.parameters.hideBase&&this.setHideBase(!0)}else for(let r=0,o=this.children.length-e;r<o;++r)this.remove(this.children[0])}_updateRadial(e){let r=e.radial,o=r.start*ro.DEG2RAD,i=r.end*ro.DEG2RAD,s=o-i,a=new Du(r.rotation[0]*ro.DEG2RAD,r.rotation[1]*ro.DEG2RAD,r.rotation[2]*ro.DEG2RAD),l;switch(r.axis){case"z":l=new Mn(0,0,1);break;case"y":l=new Mn(0,1,0);break;default:case"x":l=new Mn(1,0,0);break}for(let[c,h]of this.children.entries()){h.hiddenMatrix.identity(),h.scale.x=r.scale[0],h.scale.y=r.scale[1],h.scale.z=r.scale[2],h.position.setScalar(0);let p=s/e.count*c-o;switch(r.axis){case"x":h.rotation.set(0,p,0);break;case"y":h.rotation.set(0,0,p);break;case"z":h.rotation.set(p,0,0);break}h.translateOnAxis(l,r.radius),h.position.x+=r.position[0],h.position.y+=r.position[1],h.position.z+=r.position[2],r.alignment===!0?(h.rotation.x+=a.x,h.rotation.y+=a.y,h.rotation.z+=a.z):h.rotation.copy(a)}}_updateLinear(e){if(e.type!=="linear")throw new Error;let r=e.linear,o=new Du(r.rotation[0]*ro.DEG2RAD,r.rotation[1]*ro.DEG2RAD,r.rotation[2]*ro.DEG2RAD);for(let[i,s]of this.children.entries())s.hiddenMatrix.identity(),s.scale.x=1+(r.scale[0]-1)*i,s.scale.y=1+(r.scale[1]-1)*i,s.scale.z=1+(r.scale[2]-1)*i,s.rotation.x=o.x*i,s.rotation.y=o.y*i,s.rotation.z=o.z*i,s.position.x=r.position[0]*i,s.position.y=r.position[1]*i,s.position.z=r.position[2]*i}_updateGrid(e){let r=0,o=e.grid;if(o.useCenter===!0){let i={x:o.count[0]%2===0?2:1,y:o.count[1]%2===0?2:1,z:o.count[2]%2===0?2:1},s=new Mn(o.size[0]*(o.count[0]-i.x)*.5,o.size[1]*(o.count[1]-i.y)*.5,o.size[2]*(o.count[2]-i.z)*.5);for(let a=0;a<o.count[0];a++)for(let l=0;l<o.count[1];l++)for(let c=0;c<o.count[2];c++){let h=this.children[r++];h.hiddenMatrix.identity(),h.scale.setScalar(1),h.rotation.set(0,0,0),h.position.x=o.size[0]*a-s.x,h.position.y=o.size[1]*l-s.y,h.position.z=o.size[2]*c-s.z}}else for(let i=0;i<o.count[0];i++)for(let s=0;s<o.count[1];s++)for(let a=0;a<o.count[2];a++){let l=this.children[r++];l.hiddenMatrix.identity(),l.scale.setScalar(1),l.rotation.set(0,0,0),l.position.x=o.size[0]*i,l.position.y=-o.size[1]*s,l.position.z=-o.size[2]*a}}fromJSON(e){return this}toJSON(){return{}}fromClonerState(e){return e.hideBase!==void 0&&this.setHideBase(e.hideBase),uo(this.parameters,e),this.update(),this}};var rt=class extends Kt(zS){constructor(e,r){super(e,r);this.isAbstractMesh=!0;this.isBooleanMesh=!1;this.booleanMeshSetAddress=-1;this.booleanWasTransformed=!1;this.booleanMatrixInvOld=new RS;this.booleanExclude=null;Array.isArray(r)&&(this.selectedMaterial=0,e.groups.length===0&&e.addGroup(0,e.getAttribute("position").count,0))}get cloner(){return this._cloner}set cloner(e){this._cloner&&this.remove(this._cloner),e&&this.add(e),this._cloner=e}getSelectedMaterial(e){return Array.isArray(this.material)?(this.selectedMaterial===void 0&&(this.selectedMaterial=e!=null?e:0),this.material[e!=null?e:this.selectedMaterial]):this.material}setSelectedMaterial(e,r){Array.isArray(this.material)?(this.selectedMaterial===void 0&&(this.selectedMaterial=r!=null?r:0),r=r!=null?r:this.selectedMaterial,this.material[r].dispose(),this.material[r]=e):(this.material.dispose(),this.material=e)}updateGeometry(e){let r=this.geometry,o=Xl[r.userData.type],i=this.objectType==="NonParametric"?Object.assign({},r.userData,{geometry:r}):r.userData,s=o.build(o.normalizeInputs(e,i)),a=r.uuid;if(this.geometry.dispose(),this.geometry=s,this.geometry.uuid=a,this.geometry.computeBoundingSphere(),this.cloner)for(let l of this.cloner.children)l.geometry=this.geometry}resizeGeometry(e,r,o){sn.resizeGeometry(this.geometry,{width:e,height:r,depth:o})}shallowClone(e){return new this.constructor(this.geometry,this.material).shallowCopy(this,e)}clone(e){let r=this.objectType==="NonParametric"?Object.assign({},this.geometry.userData,{geometry:this.geometry.clone()}):this.geometry.userData,o=On(r),i=Array.isArray(this.material)?this.material.map(s=>s.clone()):this.material.clone();return new this.constructor(o,i).copy(this,e)}copy(e,r=!0){return super.copy(e,r),e.cloner&&(this.cloner=new Co(e,e.cloner.parameters),this.add(this.cloner)),this}setFromClonerState(e){e===null?this.cloner=void 0:(this.cloner===void 0&&(this.cloner=new Co(this)),this.cloner.fromClonerState(e))}fromState(e,r){var o,i,s;return super.fromState(e),e.type==="Mesh"&&(this.setFromClonerState(e.cloner),this.castShadow=(o=e.castShadow)!=null?o:!0,this.receiveShadow=(i=e.receiveShadow)!=null?i:!0,this.booleanExclude=(s=e.booleanExclude)!=null?s:null),this}freeBooleanPointer(){this.booleanMeshSetAddress!==-1&&(Yt.freeMeshSet(this.booleanMeshSetAddress),this.booleanMeshSetAddress=-1)}invalidateDownstreamBooleanData(e=!1){return e?this.booleanWasTransformed=!0:this.freeBooleanPointer(),_r(this.parent)?this.parent.invalidateDownstreamBooleanData():this}invalidateUpstreamBooleanData(){this.freeBooleanPointer();for(let e of this.children)br(e)&&(e.freeBooleanPointer(),_r(e)&&e.invalidateUpstreamBooleanData())}};var US=new Zl(0,0,1),Bu=new Zl,Eu=new Zl,_u=new jS,oo=class extends rt{constructor(e=dt.create({}),r=new mt({side:FS})){var o;super(e,r);this.recursiveSelection=!1;this.objectType="VectorObject";this.eventDispatcher=new VS;this._onShapeUpdate=()=>{this.updateGeometry({}),this.geometry.computeBoundingSphere(),this.geometry.computeBoundingBox()};this.castShadow=!0,this.receiveShadow=!0,this.forceComputeSize=!0,this.shape=e.userData.shape,(o=this.shape.eventDispatcher)==null||o.addEventListener("update",this._onShapeUpdate)}toJSON(e){let r=super.toJSON(e);return r.object.objectType="VectorObject",r}fromState(e){return super.fromState(e),this.shape.update(),this}setHelperVisibility(){}updateGeometry(e){if(super.updateGeometry(e),"userData"in this.geometry){let r=this.geometry.userData.parameters;this.eventDispatcher.dispatchEvent({type:"geometryUpdate",parameters:r})}}setShape(e){var r,o;this.shape&&((r=this.shape.eventDispatcher)==null||r.removeEventListener("update",this._onShapeUpdate)),this.shape=e,(o=this.shape.eventDispatcher)==null||o.addEventListener("update",this._onShapeUpdate)}updateWorldMatrix(e,r){super.updateWorldMatrix(e,r),_u.getNormalMatrix(this.matrixWorld),Bu.copy(US).applyMatrix3(_u).normalize(),Eu.setFromMatrixPosition(this.matrixWorld),this.shape.plane.setFromNormalAndCoplanarPoint(Bu,Eu)}clone(e){let r=this.shape.clone(),o=this.material.clone(),i=this.geometry.userData,s=dt.create(Object.assign({},i,{shape:r})),a=new oo(s,o).copy(this,e);return a.shape=r,r.update(),a}raycast(e,r){rt.prototype.raycast.call(this,e,r)}};function ga(n,t){return HS(n)}function HS(n){let t={parameters:n,type:n.type};if(n.type==="VectorGeometry"){let r=Oe.createFromState(n.shape,n.width,n.height);t.shape=r}else n.type==="NonParametricGeometry"&&(n.data.groups&&n.data.groups.forEach(r=>{var o;return r.materialIndex=Math.max((o=r.materialIndex)!=null?o:0,0)}),t.geometry=new kS().parse(n));let e;try{e=On(t)}catch(r){console.error(r)}if(!e){let r=Oe.createFromState(ti.defaultData(),100,100);t.shape=r,e=On(t)}return e}var fe;ea.then(n=>{fe=n});var Ru=new Float32Array([10,10,0,-10,10,0,-10,-10,0,10,-10,0]),Fu=new Uint32Array([0,1,2,3]),Vu=new Uint8Array([4]),nr=class{static build(n,t,e,r){let o,i,s;if((n==null?void 0:n.positionWASM)!==void 0){t&&t!==0&&(fe.free_bvh(t),fe.free_subdivision_surface(t));try{o=nr.allocate(n,r)}catch(a){console.error(a,n),o=nr.allocate({positionWASM:Ru,indexWASM:Fu,verticesPerFaceWASM:Vu},r)}fe.set_destination_refinement_level(o,0),i=nr.buildLevel(o,!0,e)}else o=t;if(n!==void 0&&n.subdivisions!==void 0){let a=WS(n.subdivisions,n.positionWASM.length);fe.set_destination_refinement_level(o,a),a>0?s=nr.buildLevel(o,!1,e):s=null}return{subdivPointer:o,originalGeometry:i,subdividedGeometry:s}}static primitiveToQuads(n,t){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 e=n.shape!==void 0?t.geometry:ga(n),r,o,i,s;return{positions:r,triIndices:s}=ic(e.getAttribute("position"),e.getIndex()),{indices:o,verticesPerFace:i}=nc(r,s,e),{positions:r,indices:o,verticesPerFace:i}}static allocate(n,t){var N;let e,r,o,i=[],s=[];n.positionWASM&&n.positionWASM.length>0?(e=n.positionWASM,r=n.indexWASM,o=n.verticesPerFaceWASM):(e=Ru,r=Fu,o=Vu);let a=e.length,l=r.length,c=o.length,h=e.length+i.length+s.length,p=r.length+o.length,d=h*Float32Array.BYTES_PER_ELEMENT+p*Uint32Array.BYTES_PER_ELEMENT,u=h*Float32Array.BYTES_PER_ELEMENT,f=p*Uint32Array.BYTES_PER_ELEMENT,g=fe._malloc(d),w=new Float32Array(fe.HEAPF32.buffer,g,h),y=new Uint32Array(fe.HEAPU32.buffer,g+u,p);w.set(e,0),w.set(i,e.length),w.set(s,e.length+i.length),y.set(r,0),y.set(o,r.length);let b;(N=n==null?void 0:n.scaleBaked)!=null&&N.some(v=>v!==1)&&(b=new qS().makeScale(...n.scaleBaked)),t&&(b?b.premultiply(t):b=t);let A=b?fe.alloc_subdivision_surface2(g,a,g+u,l,g+u+r.length*Uint32Array.BYTES_PER_ELEMENT,c,b.elements):fe.alloc_subdivision_surface(g,a,g+u,l,g+u+r.length*Uint32Array.BYTES_PER_ELEMENT,c);return fe._free(g),A}static buildLevel(n,t,e,r,o){let i=o?fe.get_mesh_data2(n,t?fe.Level.CONTROL:fe.Level.REFINED,e!=null?e:!t,o.elements):fe.get_mesh_data(n,t?fe.Level.CONTROL:fe.Level.REFINED,e!=null?e:!t),s=8,a=fe.HEAPU32.subarray(i>>2,(i>>2)+s),l=a.subarray(4,4+4),c=0,h=fe.HEAPU32[a[c]>>2],p=fe.HEAPF32.subarray(h>>2,(h>>2)+l[c]);c++;let d=fe.HEAPU32[a[c]>>2],u=fe.HEAPF32.subarray(d>>2,(d>>2)+l[c]);c++;let f=fe.HEAPU32[a[c]>>2],g=fe.HEAPU32.subarray(f>>2,(f>>2)+l[c]);c++;let w=fe.HEAPU32[a[c]>>2],y=fe.HEAPU32.subarray(w>>2,(w>>2)+l[c]);if(c++,r===void 0){let b=new Gu;if(b.setIndex(new Ql(y,1)),b.setAttribute("position",new ec(p,3)),b.setAttribute("normal",new ec(u,3)),t){b.setAttribute("faceMap",new Ql(g,1));let A=new Float32Array(u.length/3*4).fill(0);b.setAttribute("color",new zu(A,4))}return fe.free_mesh_data(i),b.userData.type="SubdivGeometry",b}r.getAttribute("position").copyArray(p),r.getAttribute("normal").copyArray(u),r.attributes.position.needsUpdate=!0,r.attributes.normal.needsUpdate=!0,fe.free_mesh_data(i)}static buildControlCageWireframe(n,t,e){let r=fe.get_wireframe_data_for_base_level(n),o=4,i=fe.HEAPU32.subarray(r>>2,(r>>2)+o),s=i.subarray(2,2+2),a=0,l=fe.HEAPU32[i[a]>>2],c=fe.HEAPF32.subarray(l>>2,(l>>2)+s[a]);a++;let h=fe.HEAPU32[i[a]>>2],p=fe.HEAPU32.subarray(h>>2,(h>>2)+s[a]);if(t===void 0){let d=new Gu;d.setAttribute("position",new ec(c,3));let u=new Float32Array(c.length);for(let f=0,g=c.length;f<g;)u[f++]=e.r,u[f++]=e.g,u[f++]=e.b;return d.setAttribute("color",new zu(u,3)),d.setIndex(new Ql(p,1)),fe.free_wireframe_data_for_base_level(r),d}t.getAttribute("position").copyArray(c),t.attributes.position.needsUpdate=!0,fe.free_wireframe_data_for_base_level(r)}static updateCollabMesh(n,t,e){t||fe.set_destination_refinement_level(n,1);let r=e?fe.get_topological_data2(n,t?fe.Level.CONTROL:fe.Level.REFINED,e.elements):fe.get_topological_data(n,t?fe.Level.CONTROL:fe.Level.REFINED),o=6,i=fe.HEAPU32.subarray(r>>2,(r>>2)+o),s=i.subarray(3,3+3),a=0,l=fe.HEAPU32[i[a]>>2],c=new Float32Array(fe.HEAPF32.subarray(l>>2,(l>>2)+s[a]));a++;let h=fe.HEAPU32[i[a]>>2],p=new Uint32Array(fe.HEAPU32.subarray(h>>2,(h>>2)+s[a]));a++;let d=fe.HEAPU32[i[a]>>2],u=new Uint8Array(fe.HEAPU32.subarray(d>>2,(d>>2)+s[a]));return fe.free_topological_data(r),{positions:c,indices:p,verticesPerFace:u}}};function WS(n,t){let e=n;return e=Math.min(e,3-Math.ceil(Math.log(t/172e3)/Math.log(4))),Math.max(e,0)}var ju=["getX","getY","getZ"];function ic(n,t){let e={},r=t?t.count:n.count,o=0,i=[],s=[],a=1e4;for(let c=0;c<r;c++){let h=t?t.getX(c):c,p="";for(let d=0;d<3;d++)p+=`${~~(n[ju[d]](h)*a)},`;if(p in e)i.push(e[p]);else{for(let d=0;d<3;d++)s.push(n[ju[d]](h));e[p]=o,i.push(o),o++}}let l=[];for(let c=0;c<i.length;c+=3)i[c]===i[c+1]||i[c]===i[c+2]||i[c+1]===i[c+2]||l.push(i[c],i[c+1],i[c+2]);return{positions:s,triIndices:l}}var xa=new ba,tc=new ba,rc=new ba,oc=new ba;function nc(n,t,e){var i;let r=[],o=[];if(e.userData.shape!==void 0&&e.userData.parameters.depth===0){let s=e.userData.shape.extractShapePointsToFlatArray([]),a=0;for(let c=0;c<s.length;c+=2)a+=(s[c]-s[(c===0?s.length:c)-2])*(s[c+1]+s[(c===0?s.length:c)-1]);n.length=0;let l=0;if(a<0)for(let c=0;c<s.length;c+=2)n.push(s[c],s[c+1],0),r.push(l++);else for(let c=s.length-2;c>=0;c-=2)n.push(s[c],s[c+1],0),r.push(l++);return o.push(l),{indices:r,verticesPerFace:o}}for(let s=0,a=(i=e.capStartIndex)!=null?i:t.length;s<a;)if(t[s+1]===t[s+3]&&t[s+2]===t[s+5]||t[s+0]===t[s+3]&&t[s+2]===t[s+4]){xa.set(n[t[s]*3],n[t[s]*3+1],n[t[s]*3+2]),tc.set(n[t[s+1]*3],n[t[s+1]*3+1],n[t[s+1]*3+2]),rc.set(n[t[s+4]*3],n[t[s+4]*3+1],n[t[s+4]*3+2]),oc.set(n[t[s+5]*3],n[t[s+5]*3+1],n[t[s+5]*3+2]),tc.sub(xa).normalize(),rc.sub(xa).normalize(),oc.sub(xa).normalize();let l=tc.cross(rc).dot(oc);Math.abs(l)>.005?(r.push(t[s],t[s+1],t[s+2]),o.push(3),s+=3):(r.push(t[s],t[s+1],t[s+4],t[s+5]),o.push(4),s+=6)}else r.push(t[s],t[s+1],t[s+2]),o.push(3),s+=3;if(e.capStartIndex!==void 0){let s=[],a=[],l=0;for(let c=0,h=0;c<n.length;c+=3,h++)n[c+2]===0&&(s.push(h),l++),n[c+2]===e.userData.parameters.depth&&a.push(h);if(e.userData.parameters.extrudeBevelSize===0){let c=a[0];a[0]=a[1],a[1]=c}s.reverse(),r.push(...s,...a),o.push(l,l)}return{indices:r,verticesPerFace:o}}var Yt={};xc(Yt,{calcBoolean:()=>XS,calcBooleanTopological:()=>YS,freeMeshSet:()=>ew,getMeshSet:()=>ZS,transformMeshSet:()=>QS});var $S,Uu=new Promise(n=>{$S=n});import{Float32BufferAttribute as ku,Sphere as JS}from"three";var Ce,wi;Uu.then(n=>Ce=n);function KS(n,t){let e,{positions:r,triIndices:o}=ic(n.getAttribute("position"),n.getIndex()),i;if(t){let{indices:s,verticesPerFace:a}=nc(r,o,n);i=a.length,e=[];for(let l=0,c=0;l<i;l++){e.push(a[l]);for(let h=0;h<a[l];h++)e.push(s[c++])}}else{let s=o.length;e=Array(s+s/3),i=0;for(let a=0,l=0;l<e.length;)e[l++]=3,i++,e[l++]=o[a++],e[l++]=o[a++],e[l++]=o[a++]}return{positions:r,faceIndices:e,nFaces:i}}function Hu(n){let t=n.length,e=t*Uint32Array.BYTES_PER_ELEMENT,r=t*Float32Array.BYTES_PER_ELEMENT,o=Number.isInteger(n[0])?e:r,i=Ce._malloc(o);return(Number.isInteger(n[0])?new Uint32Array(Ce.HEAPU32.buffer,i,t):new Float32Array(Ce.HEAPF32.buffer,i,t)).set(n,0),i}function qu(n){switch(n){case 0:return Ce.OP.UNION;case 1:return Ce.OP.INTERSECTION;case 2:return Ce.OP.A_MINUS_B;case 3:return Ce.OP.B_MINUS_A;case 4:return Ce.OP.SYMMETRIC_DIFFERENCE;case 5:return Ce.OP.ALL;default:throw new Error("Unknown boolean operation "+n)}}function YS(n,t){wi===void 0&&(wi=Ce.init_csg());let e=Ce.csg_calc(wi,Hu(n),n.length,qu(t),!0),r=6,o=Ce.HEAPU32.subarray(e>>2,(e>>2)+r),i=o.subarray(3,3+3),s=0,a=Ce.HEAPU32[o[s]>>2],l=new Float32Array(Ce.HEAPF32.subarray(a>>2,(a>>2)+i[s]));s++;let c=Ce.HEAPU32[o[s]>>2],h=new Uint32Array(Ce.HEAPU32.subarray(c>>2,(c>>2)+i[s]));s++;let p=Ce.HEAPU32[o[s]>>2],d=new Uint8Array(Ce.HEAPU32.subarray(p>>2,(p>>2)+i[s]));return Ce.free_mesh_data(e),{positions:l,indices:h,verticesPerFace:d}}function XS(n,t,e){wi===void 0&&(wi=Ce.init_csg());let r=Ce.csg_calc(wi,Hu(n),n.length,qu(t),!1),o=5,i=Ce.HEAPU32.subarray(r>>2,(r>>2)+o),s=i.subarray(2,2+3),a=0,l=Ce.HEAPU32[i[a]>>2],c=Ce.HEAPF32.subarray(l>>2,(l>>2)+s[a]);a++;let h=Ce.HEAPU32[i[a]>>2],p=Ce.HEAPF32.subarray(h>>2,(h>>2)+s[a]);a++;let d=s[a];e.setAttribute("position",new ku(c,3)),e.setAttribute("normal",new ku(p,3));let u=Ce.HEAPF32.subarray((r>>2)+5,(r>>2)+5+6);return e.boundingSphere===null&&(e.boundingSphere=new JS),e.boundingSphere.center.set(u[0],u[1],u[2]),e.boundingSphere.radius=(u[3]**2+u[4]**2+u[5]**2)**.5,e.userData.parameters={width:u[3]*2,height:u[4]*2,depth:u[5]*2},Ce.free_mesh_data(r),d}function ZS(n,t){if(Ce===void 0)return-1;let e,r,o;if(t&&n.userData.positions!==void 0){let g=n.userData;o=g.verticesPerFace.length,e=g.positions,r=Array(g.verticesPerFace.reduce((w,y)=>w+y,0)+o);for(let w=0,y=0,b=0;w<g.verticesPerFace.length;w++){r[b++]=g.verticesPerFace[w];for(let A=0;A<g.verticesPerFace[w];A++)r[b++]=g.indices[y++]}}else({positions:e,faceIndices:r,nFaces:o}=KS(n,t));let i=e.length,s=r.length,a=e.length,l=r.length,c=a*Float32Array.BYTES_PER_ELEMENT+l*Uint32Array.BYTES_PER_ELEMENT,h=a*Float32Array.BYTES_PER_ELEMENT,p=l*Uint32Array.BYTES_PER_ELEMENT,d=Ce._malloc(c),u=new Float32Array(Ce.HEAPF32.buffer,d,a),f=new Uint32Array(Ce.HEAPU32.buffer,d+h,l);return u.set(e,0),f.set(r,0),Ce.get_csg_mesh(d,i,d+h,s,o)}function QS(n,t){Ce.transform_csg_mesh(n,t.elements)}function ew(n){Ce.free_csg_mesh(n)}var Xl={ConeGeometry:pd,CubeGeometry:dd,CylinderGeometry:hd,DodecahedronGeometry:ud,EllipseGeometry:zd,HelixGeometry:Ud,IcosahedronGeometry:kd,LatheGeometry:Hd,NonParametricGeometry:Jd,PolygonGeometry:Kd,PyramidGeometry:Yd,RectangleGeometry:Zs,SphereGeometry:Xd,PlaneGeometry:Zd,StarGeometry:Qd,TextFrameGeometry:Qs,TorusGeometry:eu,TorusKnotGeometry:tu,TriangleGeometry:ru,VectorGeometry:dt},On=n=>Xl[n.type].create(n);import{VideoTexture as tw}from"three";var Wu=n=>n.tagName==="VIDEO",To=class{static resize(t,e,r){let o=t/e,i;if(!r.image)return;let s=r.image;Wu(s)?i=s.videoWidth/s.videoHeight:i=s.width/s.height,o>i&&(r.imageType=="WEBCAM"?r.repeat.set(-1,1*i/o):r.repeat.set(1,1*i/o)),o<i&&(r.imageType=="WEBCAM"?r.repeat.set(1*o/i*-1,1):r.repeat.set(1*o/i,1)),o==i&&(r.imageType=="WEBCAM"?r.repeat.set(-1,1):r.repeat.set(1,1))}static resizeTextureLayer(t,e,r){let o=t/e,i=r.image!==void 0?r.image.width/r.image.height:1,s;o>i?s={x:1,y:i/o}:o<i?s={x:o/i,y:1}:s={x:1,y:1},r.repeat.set(s.x,s.y),r.updateMatrix()}static resizeTextureLayers(t,e,r){let o=r.userData.layers,i=o.getLayers();for(let s=0;s<i.length;s++){let a=i[s];hu(a)&&(To.resizeTextureLayer(t,e,a.uniforms[`f${a.id}_texture`].value),o.updateLayerUniform())}}static resizeComplex(t,e,r,o){let i=t/e,s,a=r.image;Wu(a)?s=a.videoWidth/a.videoHeight:s=a.width/a.height,o.geometry.type.includes("Shape")?(i>s&&(r.imageType=="WEBCAM"?r.repeat.set(1/t*-1,1/e*s/i):r.repeat.set(1/t,1/e*s/i)),i<s&&(r.imageType=="WEBCAM"?r.repeat.set(1/t*i/s*-1,1/e):r.repeat.set(1/t*i/s,1/e)),i==s&&(r.imageType=="WEBCAM"?r.repeat.set(1/t*-1,1/e):r.repeat.set(1/t,1/e))):(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)))}};var Li=class extends rt{constructor(e,r=new mt){super(e,r);this.objectType="Mesh2D";this.castShadow=!0,this.receiveShadow=!0}updateGeometry(e){super.updateGeometry(e),this.material.userData.layers&&To.resizeTextureLayers(this.geometry.userData.parameters.width,this.geometry.userData.parameters.height,this.material)}resizeGeometry(e,r){super.resizeGeometry(e,r,0),this.material.userData.layers&&To.resizeTextureLayers(this.geometry.userData.parameters.width,this.geometry.userData.parameters.height,this.material)}toJSON(e){let r=super.toJSON(e);return r.object.objectType="Mesh2D",r}clone(){let e=super.clone();return e.updateGeometry({}),e}static fromTexture(e){let r,o;if(e instanceof tw){let a=e.image;r=a.videoWidth*.5,o=a.videoHeight*.5}else{let a=e.image;r=a.width*.5,o=a.height*.5}let i=Zs.create({parameters:{width:r,height:o}}),s=new mt;return s.layersList.changeLayer(0,{type:"texture",texture:e}),s.layersList.moveLayer(0,1),s.dispose(),new Li(i,s)}};import{BufferGeometry as $u,Matrix4 as rw}from"three";var ow=new rw;var va=class extends rt{constructor(e=new $u,r=new Ot){super(e,r);this.booleanOp=2;this.meshSetAddresses=[];this.needsTransformForDownstream=!1;this.isBooleanMesh=!0,this.castShadow=!0,this.receiveShadow=!0,this.geometry.userData.parameters={width:0,height:0,depth:0},this.onAfterRender=this.recomputeBoolean.bind(this)}reInit(){this.isBooleanMesh=!0,this.meshSetAddresses=[],this.needsTransformForDownstream=!1,this.geometry.userData.parameters={width:0,height:0,depth:0},this.onAfterRender=this.recomputeBoolean.bind(this)}recomputeBoolean(e){if(this.booleanMeshSetAddress!==-1)return;for(let o=0;o<this.children.length;o++){let i=this.children[o];_r(i)&&i.recomputeBoolean(e===!0)}this.meshSetAddresses=[];for(let o=0;o<this.children.length;o++){let i=this.children[o];if(Au(i)&&i.booleanExclude===!1&&i.geometry.drawRange.count>0){if(i.booleanMeshSetAddress===-1){if(i.booleanMeshSetAddress=Yt.getMeshSet(i.geometry,e===!0),i.booleanMeshSetAddress===-1)return;Yt.transformMeshSet(i.booleanMeshSetAddress,i.matrix),i.booleanMatrixInvOld.copy(i.matrix).invert(),i.booleanWasTransformed=!1}else _r(i)&&i.needsTransformForDownstream===!0?(Yt.transformMeshSet(i.booleanMeshSetAddress,i.matrix),i.needsTransformForDownstream=!1):i.booleanWasTransformed===!0&&(Yt.transformMeshSet(i.booleanMeshSetAddress,ow.multiplyMatrices(i.matrix,i.booleanMatrixInvOld)),i.booleanMatrixInvOld.copy(i.matrix).invert(),i.booleanWasTransformed=!1);this.meshSetAddresses.push(i.booleanMeshSetAddress)}}if(this.meshSetAddresses.length===0){this.geometry.setDrawRange(0,0);return}if(e===!0)return Yt.calcBooleanTopological(this.meshSetAddresses,this.booleanOp);let r=this.geometry;r.dispose(),this.geometry=new $u,this.geometry.userData=r.userData,this.geometry.boundingSphere=r.boundingSphere,this.booleanMeshSetAddress=Yt.calcBoolean(this.meshSetAddresses,this.booleanOp,this.geometry),this.booleanMatrixInvOld.copy(this.matrix).invert(),this.needsTransformForDownstream=!0}toJSON(e){let r=super.toJSON(e);return r.object.objectType="Mesh3D",r}updateGeometry(e){this.booleanOp=e.parameters.operation,this.invalidateDownstreamBooleanData().recomputeBoolean()}};import{Camera as bw,OrthographicCamera as vw,PerspectiveCamera as Sw,Vector3 as jt,Object3D as Yu,Quaternion as ww}from"three";import{BoxBufferGeometry as iw}from"three";var vr=n=>{var t;return t=class extends n{constructor(){super(...arguments);this.isObjectHelper=!0}},t.geometryHelper=new iw(30,30,30),t};import{Camera as cw,LineSegments as hw,BufferGeometry as pw,LineBasicMaterial as dw,Color as ac,Vector3 as uw,Float32BufferAttribute as Ku}from"three";import{Ray as nw,Sphere as sw,Matrix4 as aw,Vector3 as zr}from"three";var Sa=new nw,sc=new sw,Ju=new aw,Sr=(n,t,e,r,o=!1)=>{let i=t,s=n.matrixWorld;if(i.boundingSphere===null&&i.computeBoundingSphere(),sc.copy(i.boundingSphere),sc.applyMatrix4(s),e.ray.intersectsSphere(sc)===!1||(Ju.copy(s).invert(),Sa.copy(e.ray).applyMatrix4(Ju),i.boundingBox!==null&&Sa.intersectsBox(i.boundingBox)===!1))return;let a,l,c,h,p=i.index,d=i.attributes.position,u=i.drawRange,f,g;if(o===!1){let y=Math.max(0,u.start),b=Math.min(p.count,u.start+u.count);for(f=y,g=b;f<g;f+=3)if(l=p.getX(f),c=p.getX(f+1),h=p.getX(f+2),a=w(n,e,Sa,d,l,c,h),a){a.faceIndex=Math.floor(f/3),r.push(a);return}}else{let b=i.attributes.position,A=new zr,N=new zr,v=new zr,k=new zr,L=2,I=1/((n.scale.x+n.scale.y+n.scale.z)/3),x=I*I,C=Math.max(0,u.start),T=Math.min(b.count,u.start+u.count);for(let O=C,$=T-1;O<$;O+=L){if(A.fromBufferAttribute(b,O),N.fromBufferAttribute(b,O+1),Sa.distanceSqToSegment(A,N,k,v)>x)continue;k.applyMatrix4(n.matrixWorld);let ie=e.ray.origin.distanceTo(k);ie<e.near||ie>e.far||r.push({distance:ie,point:v.clone().applyMatrix4(n.matrixWorld),object:n})}}function w(y,b,A,N,v,k,L){let m=new zr,I=new zr,x=new zr,C=new zr,T=new zr;if(m.fromBufferAttribute(N,v),I.fromBufferAttribute(N,k),x.fromBufferAttribute(N,L),A.intersectTriangle(m,I,x,!1,C)===null)return null;T.copy(C),T.applyMatrix4(y.matrixWorld);let $=b.ray.origin.distanceTo(T);return $<b.near||$>b.far?null:{faceIndex:1,distance:$,point:T.clone(),object:y}}};var wa=new uw,Xt=new cw,lc=class extends hw{constructor(e){let r=new pw,o=new dw({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],s=[],a={},l=new ac(15711266),c=new ac(15711266),h=new ac(2857471);p("n1","n2",l),p("n2","n4",l),p("n4","n3",l),p("n3","n1",l),p("f1","f2",l),p("f2","f4",l),p("f4","f3",l),p("f3","f1",l),p("n1","f1",l),p("n2","f2",l),p("n3","f3",l),p("n4","f4",l),p("p","n1",c),p("p","n2",c),p("p","n3",c),p("p","n4",c),p("u1","u2",h),p("u2","u3",h),p("u3","u1",h);function p(u,f,g){d(u,g),d(f,g)}function d(u,f){i.push(0,0,0),s.push(f.r,f.g,f.b),a[u]===void 0&&(a[u]=[]),a[u].push(i.length/3-1)}r.setAttribute("position",new Ku(i,3)),r.setAttribute("color",new Ku(s,3));super(r,o);this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update()}update(){let e=this.geometry,r=this.pointMap,o=!0;Xt.projectionMatrixInverse.elements=[.5112609807824982,-0,-0,-0,-0,.41421356237309503,-0,-0,-0,-0,-0,-.099999,-0,-0,-1.0000000000000002,.100001];let i=1,s=1,a=o?.8:1e-4;sr("n1",r,e,Xt,-i,-s,a),sr("n2",r,e,Xt,i,-s,a),sr("n3",r,e,Xt,-i,s,a),sr("n4",r,e,Xt,i,s,a);let l=a;sr("f1",r,e,Xt,-i,-s,l),sr("f2",r,e,Xt,i,-s,l),sr("f3",r,e,Xt,-i,s,l),sr("f4",r,e,Xt,i,s,l);let c=l,h=.5;sr("u1",r,e,Xt,i*.7*h,s*1.1,c),sr("u2",r,e,Xt,-i*.7*h,s*1.1,c),sr("u3",r,e,Xt,0,s*(1.1+.9*h),c),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}};function sr(n,t,e,r,o,i,s){wa.set(o,i,s).unproject(r);let a=t[n];if(a!==void 0){let l=e.getAttribute("position");for(let c=0,h=a.length;c<h;c++)l.setXYZ(a[c],wa.x,wa.y,wa.z)}}var La=class extends vr(lc){constructor(e){super(e);this.object=e;this.object=e,this.name=`CombinedCameraHelper: ${e.uuid}`}updateMatrixWorld(e){super.updateMatrixWorld(e),this.updateTarget()}updateTarget(){let e=this.object.getTarget();this.updateWorldMatrix(!0,!1),this.worldToLocal(e)}raycast(e,r){Sr(this.object,this.geometry,e,r,!0)}};import{DirectionalLightHelper as mw}from"three";var Ci=class extends vr(mw){constructor(e,r=15,o=10066329){super(e,r,o);this.object=e;this.name=`DirectionalLightHelper: ${e.uuid}`}raycast(e,r){Sr(this.object,Ci.geometryHelper,e,r)}};import{AxesHelper as fw}from"three";var Ti=class extends vr(fw){constructor(e,r=15){super(r);this.object=e;this.object.updateMatrixWorld(),this.name=`EmptyObjectHelper: ${e.uuid}`,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}raycast(e,r){Sr(this.object,Ti.geometryHelper,e,r)}update(){}};import{PointLightHelper as yw}from"three";var Ni=class extends vr(yw){constructor(e,r=15,o=6710886){super(e,r,o);this.object=e;this.name=`PointLightHelper: ${e.uuid}`}raycast(e,r){Sr(this.object,Ni.geometryHelper,e,r)}};import{SpotLightHelper as gw,Vector3 as xw}from"three";var Ca=class extends vr(gw){constructor(e,r=6710886){super(e,r);this.object=e;this.name=`SpotLightHelper: ${e.uuid}`}raycast(e,r){Sr(this.object,Ca.geometryHelper,e,r)}update(){if(this.object!==void 0){let e=Ca._vector,r=this.object.distance?this.object.distance:1e3,o=r*Math.tan(this.object.angle);this.cone.scale.set(o,o,r),e.setFromMatrixPosition(this.object.target.matrixWorld),this.cone.lookAt(e);let i=this.color!==void 0?this.color:this.light.color;if(this.cone.material instanceof Array)for(let s=0,a=this.cone.material.length;s<a;s++)this.cone.material[s].color.set(i);else this.cone.material.color.set(i)}}},Pn=Ca;Pn._vector=new xw;var wr=(n,t)=>class extends n{constructor(){super(...arguments);this.objectHelper=new t(this);this.enableHelper=!1}set visibility(o){this.visible=o,this.setHelperVisibility(o),this.setHelperChildrenVisibility(o)}get visibility(){return this.visible}get geometryHelper(){return t.geometryHelper}setHelperVisibility(o){this.objectHelper.visible=o}setHelperChildrenVisibility(o){for(let i of this.children)Jt(i)&&i.traverseEntity(s=>{Gr(s)&&s.visible&&(s.objectHelper.visible=o)})}raycast(o,i){this.objectHelper.raycast(o,i)}copy(o,i=!0){return super.copy(o,i),o.enableHelper!==void 0&&(this.enableHelper=o.enableHelper),o.objectHelper!==void 0&&(this.objectHelper.visible=o.objectHelper.visible),this}toJSON(o){let i=super.toJSON(o),s=i.object;return s.enableHelper=this.enableHelper,i}fromJSON(o){return super.fromJSON(o),o.enableHelper!==void 0&&(this.enableHelper=!0),this}fromLightState(o,i){if(this.objectType==="LightDirectional"||this.objectType==="LightPoint"||this.objectType==="LightSpot"){let s=this;o.color!==void 0&&(s.color=Xe(o.color,i)),o.intensity!==void 0&&(s.intensity=o.intensity),o.depth!==void 0&&(s.shadow.camera.far=o.depth,s.shadow.needsUpdate=!0),o.shadows!==void 0&&(this.castShadow=o.shadows),o.helper!==void 0&&(this.enableHelper=o.helper,s.gizmos.shadowmap.visible=o.helper)}return this}};var Mi=new jt,cc=new jt,Rr=class extends wr(Kt(bw),La){constructor(e=window.innerWidth,r=window.innerHeight,o=45,i,s=1e5){super();this.objectType="CombinedCamera";this._cameraType="OrthographicCamera";this.targetOffset=mo.DefaultTargetOffset;this.isUpVectorFlipped=!1;this.angleOffsetFromUp=0;this.width=e,this.height=r,this.orthoCamera=new vw(e*-.5,e*.5,r*.5,r*-.5,i!=null?i:-5e4,s),this.perspCamera=new Sw(o,e/r,i!=null?i:50,s),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(!0)}static createFromState(e,r){let o=new Rr().fromState(r);return o.enableHelper=!0,o.objectHelper.update(),o.uuid=e,o}get isPerspectiveCamera(){return this.cameraType==="PerspectiveCamera"}get isOrthographicCamera(){return!this.isPerspectiveCamera}get cameraType(){return this._cameraType}setNear(e,r){e==="PerspectiveCamera"?this.perspCamera.near=r:this.orthoCamera.near=r}setZoom(e,r){r>=0&&(e==="PerspectiveCamera"?this.perspCamera.zoom=r:this.orthoCamera.zoom=r)}set cameraType(e){e==="PerspectiveCamera"?this.toPerspective():e==="OrthographicCamera"&&this.toOrthographic()}get near(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.near:this.orthoCamera.near}set near(e){this._cameraType==="PerspectiveCamera"?this.perspCamera.near=e:this.orthoCamera.near=e}get zoom(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom:this.orthoCamera.zoom}set zoom(e){e>=0&&(this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom=e:this.orthoCamera.zoom=e)}lookAt(e){super.lookAt(e),this.getWorldPosition(Mi),this.targetOffset=Mi.distanceTo(e)}getTarget(e=new jt){return this.getWorldDirection(cc),this.getWorldPosition(Mi),cc.multiplyScalar(this.targetOffset),e.copy(Mi).add(cc),e}getDistanceToTarget(){let e=this.getTarget();return this.getWorldPosition(Mi),Mi.distanceTo(e)}updateUp(){let e=this.getWorldQuaternion(new ww),r=new jt(0,0,1).applyQuaternion(e),o=new jt().copy(Yu.DefaultUp);this.isUpVectorFlipped&&o.negate(),o.applyQuaternion(e);let i=new jt().copy(Yu.DefaultUp).projectOnPlane(r),s=new jt().crossVectors(i,o).dot(r)>=0?1:-1;this.angleOffsetFromUp=i.angleTo(o)*s}getViewFrontToObject(e){let r=e.getWorldPosition(new jt),i=e.getWorldDirection(new jt).multiplyScalar(this.targetOffset);return{position:r.clone().add(i),target:r}}getViewToObject(e){let r=e.getWorldPosition(new jt),i=this.getWorldDirection(new jt).multiplyScalar(this.targetOffset);return{position:r.clone().sub(i),target:r}}setViewplaneSize(e,r){this.left=-e*.5,this.right=e*.5,this.top=r*.5,this.bottom=-r*.5,this.aspect=e/r,this.updateProjectionMatrix()}toOrthographic(e){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.enableHelper===!0||e===!0)&&this.objectHelper.update()}toPerspective(e){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.enableHelper===!0||e===!0)&&this.objectHelper.update()}setFocalLength(e){this.perspCamera.setFocalLength(e),this.toPerspective()}getFocalLength(){return this.perspCamera.getFocalLength()}getEffectiveFOV(){return this.perspCamera.getEffectiveFOV()}getFilmWidth(){return this.perspCamera.getFilmWidth()}getFilmHeight(){return this.perspCamera.getFilmHeight()}setViewOffset(e,r,o,i,s,a){this._cameraType==="PerspectiveCamera"?this.perspCamera.setViewOffset(e,r,o,i,s,a):this.orthoCamera.setViewOffset(e,r,o,i,s,a)}clearViewOffset(){this._cameraType==="PerspectiveCamera"?(this.perspCamera.clearViewOffset(),this.toPerspective()):(this.orthoCamera.clearViewOffset(),this.toOrthographic())}updateProjectionMatrix(e){this._cameraType==="PerspectiveCamera"?this.toPerspective(e):this._cameraType==="OrthographicCamera"&&this.toOrthographic(e)}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,r){super.updateWorldMatrix(e,r),this.matrixWorldInverse.copy(this.matrixWorld).invert()}copy(e,r){return super.copy(e,r),this.orthoCamera.copy(e.orthoCamera),this.perspCamera.copy(e.perspCamera),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.far=e.far,this.view=e.view===null?null:Object.assign({},e.view),this._cameraType=e._cameraType,this.aspect=e.aspect,this.fov=e.fov,this.focus=e.focus,this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this.targetOffset=e.targetOffset,this.updateProjectionMatrix(),this}fromCameraRender(e){let r={near:this.orthoCamera.near,far:this.orthoCamera.far},o={near:this.perspCamera.near,far:this.perspCamera.far};return this.copy(e),this.name="",this.enableHelper=!0,this.objectHelper.visible=!0,this.orthoCamera.near=r.near,this.orthoCamera.far=r.far,this.perspCamera.near=o.near,this.perspCamera.far=o.far,this.updateProjectionMatrix(),this}toJSON(e){let r=super.toJSON(e),o=r.object;return o.objectType="CombinedCamera",o.cameraType=this.cameraType,o.targetOffset=this.targetOffset,o.isUpVectorFlipped=this.isUpVectorFlipped,o.angleOffsetFromUp=this.angleOffsetFromUp,o.left=this.left,o.right=this.right,o.top=this.top,o.bottom=this.bottom,this.view!==null&&(o.view=Object.assign({},this.view)),o.zoomOrtho=this.orthoCamera.zoom,o.nearOrtho=this.orthoCamera.near,o.far=this.far,o.aspect=this.aspect,o.fov=this.fov,o.focus=this.focus,o.filmGauge=this.filmGauge,o.filmOffset=this.filmOffset,o.zoomPersp=this.perspCamera.zoom,o.nearPersp=this.perspCamera.near,r}fromJSON(e){var r;if(super.fromJSON(e),this.cameraType=e.cameraType,e.targetOffset!==void 0&&(this.targetOffset=e.targetOffset),e.orbitControlsTarget!==void 0){let o=this.getWorldPosition(new jt),i=new jt().fromArray(e.orbitControlsTarget);this.targetOffset=i.distanceTo(o)}else e.targetOffset!==void 0&&(this.targetOffset=e.targetOffset);return this.isUpVectorFlipped=!1,this.angleOffsetFromUp=(r=e.angleOffsetFromUp)!=null?r:0,e.left!==void 0&&(this.left=e.left),e.right!==void 0&&(this.right=e.right),e.top!==void 0&&(this.top=e.top),e.bottom!==void 0&&(this.bottom=e.bottom),e.view!==void 0&&(this.view=Object.assign({},e.view)),e.zoomOrtho!==void 0&&(this.orthoCamera.zoom=e.zoomOrtho),e.nearOrtho!==void 0&&(this.orthoCamera.near=e.nearOrtho),e.far!==void 0&&(this.far=e.far),e.aspect!==void 0&&(this.aspect=e.aspect),e.fov!==void 0&&(this.fov=e.fov),e.focus!==void 0&&(this.focus=e.focus),e.filmGauge!==void 0&&(this.filmGauge=e.filmGauge),e.filmOffset!==void 0&&(this.filmOffset=e.filmOffset),e.zoomPersp!==void 0&&(this.perspCamera.zoom=e.zoomPersp),e.nearPersp!==void 0&&(this.perspCamera.near=e.nearPersp),this.updateProjectionMatrix(),this}toCameraState(e=[]){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 $o(r,e)}fromCameraState(e){let{orthographic:r,perspective:o}=e;return e.type!==void 0&&(this.cameraType=e.type),e.far!==void 0&&(this.far=e.far),r!==void 0&&(r.near!==void 0&&(this.orthoCamera.near=r.near),r.zoom!==void 0&&(this.orthoCamera.zoom=r.zoom)),o!==void 0&&(o.near!==void 0&&(this.perspCamera.near=o.near),o.fov!==void 0&&(this.perspCamera.fov=o.fov),o.zoom!==void 0&&(this.perspCamera.zoom=o.zoom)),e.up!==void 0&&this.up.fromArray(e.up),e.targetOffset!==void 0&&(this.targetOffset=e.targetOffset),e.isUpVectorFlipped!==void 0&&(this.isUpVectorFlipped=e.isUpVectorFlipped),this.updateProjectionMatrix(),this}toState(e){return H(P(P({},super.toState(e)),this.toCameraState(e)),{type:this.cameraType})}fromState(e){return super.fromState(e),this.fromCameraState(e),this}};import{Group as Lw}from"three";var Fr=class extends wr(Kt(Lw),Ti){constructor(){super(...arguments);this.objectType="EmptyObject"}static createFromState(e,r){let o=new Fr().fromState(r);return o.uuid=e,o.enableHelper=!0,o.objectHelper.update(),o}toJSON(e){let r=super.toJSON(e);return r.object.objectType="EmptyObject",r}};import{DirectionalLight as Cw,CameraHelper as Ta}from"three";var Oi=class extends wr(Kt(Cw),Ci){constructor(...e){super(...e);this.objectType="LightDirectional";this._gizmos={};this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024;let o=this.shadow.camera;o.top=1250,o.bottom=-1250,o.right=1250,o.left=-1250,o.near=1,o.far=2500;let i=new Ta(this.shadow.camera);i.visible=!1,this._gizmos.shadowmap=i,this.update()}static createFromState(e,r,o){let i=new Oi().fromState(r,o);return i.uuid=e,i}get gizmos(){return this._gizmos}showGizmos(){for(let e in this._gizmos){let r=this._gizmos[e];r instanceof Ta&&(r.visible=!0)}}hideGizmos(){for(let e in this._gizmos){let r=this._gizmos[e];r instanceof Ta&&(r.visible=!1)}}update(){this.shadow.camera.updateProjectionMatrix();for(let e in this._gizmos){let r=this._gizmos[e];r instanceof Ta&&r.update()}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.enableHelper===!0&&this.objectHelper.visible===!0&&this.objectHelper.update()}copy(e,r=!0){return super.copy(e,r),this.color.copy(e.color),this.intensity=e.intensity,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){let r=super.toJSON(e),o=r.object;return o.objectType="LightDirectional",o.color=this.color.getHex(),o.intensity=this.intensity,o.shadow=this.shadow.toJSON(),r}fromJSON(e){var i;super.fromJSON(e),this.color.set(e.color),this.intensity=e.intensity,this.shadow.normalBias=(i=e.shadow.normalBias)!=null?i:0,this.shadow.radius=e.shadow.radius,this.shadow.mapSize.fromArray(e.shadow.mapSize);let r=this.shadow.camera,o=e.shadow.camera;return r.near=o.near,r.far=o.far,r.zoom=o.zoom,r.left=o.left,r.right=o.right,r.top=o.top,r.bottom=o.bottom,o.view!==void 0&&(r.view=Object.assign({},o.view)),this}fromDirectionalLightState(e,r){let o=e.depth!==void 0&&e.depth!==this.shadow.camera.far||e.size!==void 0&&e.size/2!==this.shadow.camera.right;return super.fromLightState(e,r),e.size!==void 0&&Ou(this,e.size),o&&this.update(),this}fromState(e,r){return super.fromState(e),this.fromDirectionalLightState(e,r),this}};import{PointLight as Tw,Vector3 as Na,Box3 as Nw,Box3Helper as Ma,Color as Mw}from"three";var Pi=class extends wr(Kt(Tw),Ni){constructor(...e){super(...e);this.objectType="LightPoint";this._gizmos={};this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024;let o=this.shadow.camera;o.fov=90,o.aspect=1,o.near=100,o.far=2500;let i=new Na(-o.far+this.position.x,-o.far+this.position.y,-o.far+this.position.z),s=new Na(o.far+this.position.x,o.far+this.position.y,o.far+this.position.z),a=new Nw(i,s),l=new Ma(a,new Mw(16755200));l.visible=!1,this._gizmos.shadowmap=l,this.update()}static createFromState(e,r,o){let i=new Pi().fromState(r,o);return i.uuid=e,i}get gizmos(){return this._gizmos}showGizmos(){for(let e in this._gizmos){let r=this._gizmos[e];r instanceof Ma&&(r.visible=!0)}}hideGizmos(){for(let e in this._gizmos){let r=this._gizmos[e];r instanceof Ma&&(r.visible=!1)}}update(){if(this.shadow&&(this.shadow.camera.updateProjectionMatrix(),this._gizmos))for(let e in this._gizmos){let r=this._gizmos[e];if(r instanceof Ma){let o=this.shadow.camera,i=new Na(-o.far+this.position.x,-o.far+this.position.y,-o.far+this.position.z),s=new Na(o.far+this.position.x,o.far+this.position.y,o.far+this.position.z);r.box.set(i,s),r.updateMatrixWorld(!0)}}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.enableHelper===!0&&this.objectHelper.visible===!0&&this.objectHelper.update()}copy(e,r=!0){return super.copy(e,r),this.color.copy(e.color),this.intensity=e.intensity,this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}toJSON(e){let r=super.toJSON(e),o=r.object;return o.objectType="LightPoint",o.color=this.color.getHex(),o.intensity=this.intensity,o.distance=this.distance,o.decay=this.decay,o.shadow=this.shadow.toJSON(),r}fromJSON(e){var i,s;super.fromJSON(e),this.color.set(e.color),this.intensity=e.intensity,this.distance=e.distance,this.decay=e.decay,this.shadow.normalBias=(i=e.shadow.normalBias)!=null?i:0,this.shadow.radius=e.shadow.radius,this.shadow.mapSize.fromArray((s=e.shadow.mapSize)!=null?s:[512,512]),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null);let r=this.shadow.camera,o=e.shadow.camera;return r.near=o.near,r.far=o.far,r.zoom=o.zoom,r.fov=o.fov,r.focus=o.focus,r.aspect=o.aspect,r.filmGauge=o.filmGauge,r.filmOffset=o.filmOffset,o.view!==void 0&&(r.view=Object.assign({},o.view)),this}fromPointLightState(e,r){return super.fromLightState(e,r),e.distance!==void 0&&(this.distance=e.distance),e.decay!==void 0&&(this.decay=e.decay),e.shadowRadius!==void 0&&(this.shadow.radius=e.shadowRadius),e.shadowResolution!==void 0&&(this.shadow.mapSize.set(e.shadowResolution,e.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null)),this}fromState(e,r){return super.fromState(e),this.fromPointLightState(e,r),this}};import{SpotLight as Ow,CameraHelper as Oa,MathUtils as Pw,Vector3 as em,Quaternion as Iw}from"three";var Xu=new em,Zu=new em,Qu=new Iw,Ii=class extends wr(Kt(Ow),Pn){constructor(...e){super(...e);this.objectType="LightSpot";this._gizmos={};this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024;let o=this.shadow.camera;o.fov=Pw.RAD2DEG*2*this.angle,o.aspect=1,o.near=100,o.far=2500;let i=new Oa(this.shadow.camera);i.visible=!1,this._gizmos.shadowmap=i,this.update()}static createFromState(e,r,o){let i=new Ii().fromState(r,o);return i.uuid=e,i}get gizmos(){return this._gizmos}showGizmos(){for(let e in this._gizmos){let r=this._gizmos[e];r instanceof Oa&&(r.visible=!0)}}hideGizmos(){for(let e in this._gizmos){let r=this._gizmos[e];r instanceof Oa&&(r.visible=!1)}}update(){this.shadow.camera.updateProjectionMatrix();for(let e in this._gizmos){let r=this._gizmos[e];r instanceof Oa&&r.update()}}updateMatrixWorld(e){super.updateMatrixWorld(e),Zu.setFromMatrixPosition(this.matrixWorld),Qu.setFromRotationMatrix(this.matrixWorld),Xu.copy(this.up).applyQuaternion(Qu).negate().multiplyScalar(this.distance),this.target.position.copy(Zu).add(Xu),this.target.updateMatrixWorld(),this.enableHelper===!0&&this.objectHelper.visible===!0&&this.objectHelper.update()}copy(e,r=!0){return super.copy(e,r),this.color.copy(e.color),this.intensity=e.intensity,this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){let r=super.toJSON(e),o=r.object;return o.objectType="LightSpot",o.color=this.color.getHex(),o.intensity=this.intensity,o.distance=this.distance,o.angle=this.angle,o.decay=this.decay,o.penumbra=this.penumbra,o.shadow=this.shadow.toJSON(),r}fromJSON(e){var i;super.fromJSON(e),this.color.set(e.color),this.intensity=e.intensity,this.distance=e.distance,this.angle=e.angle,this.decay=e.decay,this.penumbra=e.penumbra,this.shadow.normalBias=(i=e.shadow.normalBias)!=null?i:0,this.shadow.radius=e.shadow.radius,this.shadow.mapSize.fromArray(e.shadow.mapSize);let r=this.shadow.camera,o=e.shadow.camera;return r.near=o.near,r.far=o.far,r.zoom=o.zoom,r.fov=o.fov,r.focus=o.focus,r.aspect=o.aspect,r.filmGauge=o.filmGauge,r.filmOffset=o.filmOffset,o.view!==void 0&&(r.view=Object.assign({},o.view)),this}fromSpotLightState(e,r){return super.fromLightState(e,r),e.distance!==void 0&&(this.distance=e.distance),e.decay!==void 0&&(this.decay=e.decay),e.angle!==void 0&&(this.angle=e.angle),e.penumbra!==void 0&&(this.penumbra=e.penumbra),this}fromState(e,r){return super.fromState(e),this.fromSpotLightState(e,r),this}};var Ai=class extends rt{constructor(e,r=new Ot){super(e,r);this.objectType="Mesh3D";this.castShadow=!0,this.receiveShadow=!0}toJSON(e){let r=super.toJSON(e);return r.object.objectType="Mesh3D",r}};var Di=class extends Ai{constructor(e,r=new Ot){super(e,r);this.objectType="NonParametric"}toJSON(e){let r=super.toJSON(e);return r.object.objectType="NonParametric",r}};import{DoubleSide as Aw,Mesh as Dw,MeshBasicMaterial as Bw,ShapeBufferGeometry as Ew,Vector2 as _w,Vector3 as Gw}from"three";import{FontLoader as zw}from"three/examples/jsm/loaders/FontLoader.js";var Ze=class extends Dw{constructor({char:e,originalChar:r,fontFamily:o,letterSpacing:i,fontSize:s,LOD:a=16},l=new Bw({color:0,opacity:1,visible:!0,transparent:!0,side:Aw})){let c=Ze.loadChar(e,o,a);super(c.geometry,l);this.char=e,this.originalChar=r!=null?r:e,this.fontFamily=o,this.letterSpacing=i,this.fontSize=s,this.LOD=a,this.resolution=c.resolution,this.glyphsHa=c.glyphsHa,this.localPosition=new _w,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 Ze._fontPath}static set FONTS_PATH(e){Ze._fontPath=e}updatePosition(e,r){this.localPosition.copy(e);let o=new Gw(this.localPosition.x,-this.localPosition.y,0);this.position.copy(o).add(r)}updateFontSize(e){let r=e/this.resolution;this.fontSize=e,this.scale.set(this.fontSize,this.fontSize,1),this.charSize=this.glyphsHa*r*this.letterSpacing}updateFontFamily(e){if(this.fontFamily===e)return;this.fontFamily=e;let r=Ze.loadChar(this.char,e,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(e){if(this.char===e)return;this.char=e;let r=Ze.loadChar(e,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(e){this.letterSpacing!==e&&(this.letterSpacing=e,this.updateFontSize(this.fontSize))}updateLOD(e){if(this.LOD===e)return;this.LOD=e;let r=Ze.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 e={char:this.char,originalChar:this.originalChar,fontFamily:this.fontFamily,letterSpacing:this.letterSpacing,fontSize:this.fontSize,LOD:this.LOD};return new Ze(e).copy(this)}static loadFont(e){return new Promise(function(r,o){Ze.fontCache[e]?r(Ze.fontCache[e]):new zw().load(Ze.FONTS_PATH+e+".json",s=>{Ze.fontCache[e]=s,r(s)},void 0,o)})}static loadChar(e,r,o){if(Ze.charCache[e]){if(Ze.charCache[e][o]&&Ze.charCache[e][o].fontFamily===r)return Ze.charCache[e][o]}else Ze.charCache[e]={};let i=Ze.fontCache[r],s=i.generateShapes(e,1);return Ze.charCache[e][o]={geometry:new Ew(s,o),fontFamily:r,resolution:i.data.resolution,glyphsHa:i.data.glyphs[e].ha},Ze.charCache[e][o]}},Pt=Ze;Pt.charCache={},Pt.fontCache={},Pt._fontPath="/_assets/_fonts/";import{DoubleSide as Ia,MeshBasicMaterial as rm,Vector3 as om,Object3D as Rw}from"three";import{Vector2 as tm}from"three";var Pa=new tm,io=class{constructor(t,e,r){this.message=[];this.endLine=!0;this.yLinePos=t,this.lineHeight=e,this.maxCharSize=r,this.nextChar3DPos=new tm(0,this.yLinePos+this.maxCharSize*this.lineHeight),this.align=1}addChar3D(t,e,r=this.message.length){this.message.splice(r,0,t),t.fontSize>this.maxCharSize?(this.maxCharSize=t.fontSize,this.nextChar3DPos.y=this.yLinePos+this.maxCharSize*this.lineHeight,this.fullUpdate(e)):(t.updatePosition(this.nextChar3DPos,e),this.nextChar3DPos.x+=t.charSize)}deleteChar3D(t=this.message.length-1){let e=this.message[t];if(e)return this.message.splice(t,1),this.nextChar3DPos.x-=e.charSize,e}isEndLine(t){this.endLine=t}fullUpdate(t,e=0){this.nextChar3DPos.x=0;for(let r=e,o=this.message.length;r<o;r+=1)this.message[r].updatePosition(this.nextChar3DPos,t),this.nextChar3DPos.x+=this.message[r].charSize}checkOverFlow(t){let e,r=this.message.length-1;if(r<=0)return!1;for(;r>=0;){if(this.message[r].char!==" "){e=this.message[r];break}r-=1}return!!(r>=0&&e&&e.localPosition.x+e.charSize>t)}containSpaceOverFlow(t=this.message.length-1){for(let e=t;e>=0;e-=1)if(this.message[e].char===" ")return!0;return!1}containSpace(t=this.message.length-1){if(this.endLine)return!0;for(let e=t;e>=0;e-=1)if(this.message[e].char===" ")return!0;return!1}popWord(t=this.message.length-1){let e=[],r=!0,o;for(o=t;o>=0;o-=1)if(this.message[o].char===" "){r=!1,e.length===0&&(o-=1,e.splice(0,0,this.message[o]));break}else e.splice(0,0,this.message[o]);return r?e=[]:this.message.splice(o+1,e.length),e}getWord(t=0,e=1){let r=[],o=t;for(o=t;;o+=e){if(!this.message[o]||this.message[o].char===" "){r.length===0&&this.message[o]&&(r.push(this.message[o]),this.message.splice(o,1));break}e>0?(r.push(this.message[o]),this.message.splice(o,1),o-=e):(r.splice(0,0,this.message[o]),this.message.splice(o,1))}return r}getWordAtIndex(t){let e=[];for(let r=t;r<this.message.length&&this.message[r].char!==" ";r++)e.push(this.message[r]);for(let r=t-1;r>=0&&this.message[r].char!==" ";r--)e.splice(0,0,this.message[r]);return e}wordSize(t=0,e=-1){let r=0,o=t;for(;o>=0&&o<this.message.length;){if(this.message[o].char===" "){r===0&&(r=this.message[o].charSize);break}r+=this.message[o].charSize,o+=e}return(o<0||o>=this.message.length)&&!this.endLine?this.message[t]?this.message[t].charSize:999999999:r===0?999999999:r}spaceLeft(t){return t-this.nextChar3DPos.x}popChar(t=this.message.length-1){return this.nextChar3DPos.x-=this.message[t].charSize,this.message.splice(t,1)}isEmpty(){return!this.message.length}updateNextCharPosY(){this.nextChar3DPos.y=this.yLinePos+this.maxCharSize*this.lineHeight}updateYLinePos(t){this.yLinePos=t,this.updateNextCharPosY()}updatelineHeight(t){this.lineHeight=t,this.updateNextCharPosY()}updateFontSize(t,e=0,r=this.message.length-1){for(let o=e;o<=r;o+=1)this.message[o].updateFontSize(t);this.maxCharSize=t,this.nextChar3DPos.y=this.yLinePos+this.maxCharSize*this.lineHeight}countSpaces(){let t=0;for(let e=0;e<this.message.length;e++)this.message[e].char===" "&&(t+=1);return t}alignText(t,e,r,o,i){switch(r){case 1:this.leftAlign(t,i);break;case 3:this.centerAlign(this.spaceLeft(e),t,i);break;case 2:this.rightAlign(this.spaceLeft(e),t,i);break;case 4:this.justifyAlign(this.spaceLeft(e),t,i);break}}offsetCharacters(t,e,r){Pa.set(e,r);let o=this.message.length;for(let i=0;i<o;i++)this.message[i].updatePosition(this.message[i].localPosition.add(Pa),t)}leftAlign(t,e){this.align=1,this.offsetCharacters(t,0,e)}centerAlign(t,e,r){this.align=3,this.offsetCharacters(e,t/2,r)}rightAlign(t,e,r){this.align=2,this.offsetCharacters(e,t,r)}justifyAlign(t,e,r){if(this.align=4,this.endLine){this.offsetCharacters(e,0,r);return}let o=this.countSpaces();if(o===0){this.offsetCharacters(e,0,r);return}let i=t/o,s=0;for(let a=0;a<this.message.length;a++)this.message[a].char===" "&&(s+=i),Pa.set(s,r),this.message[a].updatePosition(this.message[a].localPosition.add(Pa),e)}clone(){let t=new io(this.yLinePos,this.lineHeight,this.maxCharSize);t.nextChar3DPos=this.nextChar3DPos.clone(),t.align=this.align,t.endLine=this.endLine;for(let e=0;e<this.message.length;e++)t.message.push(this.message[e].clone());return t}};var hc=class extends rt{constructor(e,r=new mt({transparent:!0,opacity:1,visible:!1,side:Ia})){super(e,r);this.objectType="TextFrame";this.charContainer=new Rw,this.add(this.charContainer),this.material.visible=!1,this._geometryUserData=e.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 om(this._geometryUserData.parameters.width*-.5,this._geometryUserData.parameters.height*.5,0),textLines:[]},this.createTextLine()}static createFromState(e,r,o){let i=Qs.create({parameters:{width:r.width,height:r.height}}),s=new hc(i).fromState(r,o);return s.uuid=e,s}async updateText(e){this.clearText();let r=this.userData.textFrame,o=r.fontFamily;await Pt.loadFont(o),r.text=e;let i=r.textOrigin,s=new rm({visible:r.visible,transparent:!0,side:Ia}),a=e.split(`
|
|
941
|
+
`)}return r}copy(e){return super.copy(e),e.color&&(this.color=e.color.clone()),this.roughness=e.roughness.clone(),this.metalness=e.metalness.clone(),e.position&&(this.position=e.position.clone()),e.afterColor&&(this.afterColor=e.afterColor.clone()),e.alpha&&(this.alpha=e.alpha.clone()),e.reflectivity&&(this.reflectivity=e.reflectivity.clone()),e.shadingAlpha&&(this.shadingAlpha=e.shadingAlpha.clone()),e.shadingBlend&&(this.shadingBlend=e.shadingBlend.clone()),this}};var ma=class extends Vt{constructor(e=new ua,r){super(e,e,r);this.type="StandardNodeMaterial",this.fragment=e}get color(){return this.fragment.color}set color(e){this.fragment.color=e}get afterColor(){return this.fragment.afterColor}set afterColor(e){this.fragment.afterColor=e}get alpha(){return this.fragment.alpha}set alpha(e){this.fragment.alpha=e}get shadingAlpha(){return this.fragment.shadingAlpha}set shadingAlpha(e){this.fragment.shadingAlpha=e}get shadingBlend(){return this.fragment.shadingBlend}set shadingBlend(e){this.fragment.shadingBlend=e}get position(){return this.fragment.position}set position(e){this.fragment.position=e}get roughness(){return this.fragment.roughness}set roughness(e){this.fragment.roughness=e}get metalness(){return this.fragment.metalness}set metalness(e){this.fragment.metalness=e}get reflectivity(){return this.fragment.reflectivity}set reflectivity(e){this.fragment.reflectivity=e}};var bi=class extends ma{constructor(t,e,r){super(e,t),this.userData.type="PhysicalMaterial",this.userData.category="Physical",this.userData.layers=r!=null?r:this._getLayerStack(t==null?void 0:t.map)}get layersList(){return this.userData.layers}set layersList(t){this.userData.layers=t}equals(t){return this.userData.type===t.userData.type&&this.userData.layers.uuid==t.userData.layers.uuid}copy(t){if(t.userData.layers!==void 0&&t.userData.layers instanceof wt){let e=t.userData.layers,r=t.fragment;super.copy(t);let o=r.clone();this.fragment=o,this.vertex=o;let i=e.clone(this);this.userData.layers=i,o.shadingAlpha.value=r.shadingAlpha.value,o.shadingBlend.value=r.shadingBlend.value}else super.copy(t);return this}static fromJSON(t,e,r){let o=r.getNode(e.vertex),i=new bi(void 0,o);return i.fromJSON(e,r),i}dispose(){super.dispose()}};import{Color as $l}from"three";function Xe(n,t){let e;if(typeof n=="string"){let r=t==null?void 0:t.getColor(n);r?e=r:(console.warn("Tried to create color layer params with a color key that does not exist in the assets manager"),e=new Dt(0,0,0,0))}else return"a"in n?new Dt(n.r,n.g,n.b,n.a):new Dt(n.r,n.g,n.b,1);return e}import{Matrix3 as yu,Texture as Wl,Vector2 as Ln,Vector3 as to,Vector4 as gu}from"three";function xu(n,t){switch(n.data.type){case"light":return ir(n);case"fresnel":return fS(n,t);case"gradient":return yS(n);case"depth":return gS(n);case"normal":return xS(n);case"noise":return bS(n,t);case"texture":return vS(n,t);case"rainbow":return SS(n);case"transmission":return wS(n,t);case"matcap":return LS(n,t);case"displace":return CS(n);case"color":default:return mS(n,t)}}function bu(n){return{type:n.data.type}}function ir(n){let{alpha:t,mode:e}=n.data;return H(P({},bu(n)),{alpha:t,mode:e})}function mS(n,t){return H(P({},ir(n)),{color:Xe(n.data.color,t)})}function fS(n,t){let{bias:e,scale:r,intensity:o,factor:i,color:s}=n.data;return H(P({},ir(n)),{color:Xe(s,t),bias:e,scale:r,intensity:o,factor:i})}function yS(n){let{gradientType:t,smooth:e,colors:r,steps:o,angle:i,offset:s,morph:a}=n.data;return H(P({},ir(n)),{gradientType:t,smooth:e,colors:r.map(l=>new gu(l[0],l[1],l[2],l[3])),num:r.length,steps:o,offset:new Ln(...s),morph:new Ln(...a),angle:i})}function gS(n){let{gradientType:t,near:e,far:r,isVector:o,isWorldSpace:i,origin:s,direction:a,colors:l,steps:c,smooth:h,num:p}=n.data;return H(P({},ir(n)),{gradientType:t,near:e,far:r,isVector:o,isWorldSpace:i,origin:new to(...s),direction:a?new to(...a):new to(1,0,0),num:p,colors:l.map(d=>new gu(d[0],d[1],d[2],d[3])),steps:c,smooth:h})}function xS(n){let{cnormal:t}=n.data;return H(P({},ir(n)),{cnormal:new to(t[0],t[1],t[2])})}function bS(n,t){let{data:e}=n;return H(P({},ir(n)),{scale:e.scale,move:e.move,fA:new Ln(...e.fA),fB:new Ln(...e.fB),size:new to(...e.size),distortion:new Ln(...e.distortion),colorA:Xe(e.colorA,t),colorB:Xe(e.colorB,t),colorC:Xe(e.colorC,t),colorD:Xe(e.colorD,t),noiseType:e.noiseType})}function vS(n,t){let{projection:e,axis:r,side:o,crop:i,size:s}=n.data,{image:a,wrapping:l,repeat:c,offset:h}=n.data.texture,p=new Wl,d;if(typeof a=="string")d=t==null?void 0:t.getImage(a);else{let u=new Image;u.src=a.data,u.onload=()=>{t!=null&&t.onImageLoad&&(t==null||t.onImageLoad(a.data))},d=u}return p.image=d,p.repeat.set(c[0],c[1]),p.offset.set(h[0],h[1]),p.wrapS=p.wrapT=l,H(P({},ir(n)),{texture:p,mat:new yu().setUvTransform(h[0],h[1],c[0],c[1],0,0,0),crop:i,projection:e,axis:["x","y","z"].indexOf(r),side:[2,0,1].indexOf(o),size:s})}function SS(n){let{data:t}=n;return H(P({},ir(n)),{filmThickness:t.filmThickness,movement:t.movement,wavelengths:new to(...t.wavelengths),noiseStrength:t.noiseStrength,noiseScale:t.noiseScale,offset:new to(...t.offset)})}function wS(n,t){let{data:e}=n;return H(P({},ir(n)),{thickness:e.thickness,ior:e.ior,roughness:e.roughness,transmissionSamplerMap:t.transmissionSamplerMap,transmissionDepthMap:t.transmissionDepthMap})}function LS(n,t){let e=new Wl,{image:r}=n.data.texture,o;if(typeof r=="string")o=t==null?void 0:t.getImage(r);else{let s=new Image;s.src=r.data,s.onload=()=>{t!=null&&t.onImageLoad&&(t==null||t.onImageLoad(r.data))},o=s}e.image=o;let i=16777215;return H(P({},ir(n)),{color:i,texture:e})}function CS(n){let{data:t}=n,e=H(P({},bu(n)),{intensity:t.intensity});if(t.displacementType==="noise")return H(P({},e),{offset:new to(...t.offset),scale:t.scale,movement:t.movement,noiseType:t.noiseType});{let r=new Wl,o=new yu().setUvTransform(0,0,1,1,0,0,0);return H(P({},e),{texture:r,mat:o,crop:t.crop})}}function vu(n,t,e){if(e.type==="displace"&&(n==="intensity"||n==="visible")){let r=t.uniforms[`f${t.id}_intensity`];return r?(r.value=e.intensity*(e.visible?1:0),r):void 0}if(e.type!=="displace"&&(n==="alpha"||n==="visible")){let r=t.uniforms[`f${t.id}_alpha`];return r?(r.value=e.alpha*(e.visible?1:0),r):void 0}}import{Color as Lu,Vector4 as TS}from"three";var vi;(t=>{function n(e){return new Lu(e.x,e.y,e.z).getHex()}t.getHex=n})(vi||(vi={}));var Su;(t=>{function n(e){return new TS(e.r,e.g,e.b,e.a)}t.getThreeVector4=n})(Su||(Su={}));var wu;(e=>{function n(r,o){r.setRGB(o.r,o.g,o.b)}e.setThreeColor=n;function t(r){return new Lu(r.r,r.g,r.b).getHex()}e.getHex=t})(wu||(wu={}));function Cn(n,t){return typeof n=="string"?t.getMaterialOrDeletedPlaceholder(n):Jl(n,t)}function Cu(n,t){return n.map(e=>Cn(e,t))}function Jl(n,t){var s,a;let e=(s=n.layers)!=null?s:xo.defaultTwoLayerData("phong").layers,r=NS(e),o;switch(r.category){case"basic":o=new mt;break;case"lambert":{o=new gi;break}case"toon":{o=new xi;break}case"physical":o=new bi;break;case"phong":default:{o=new Ot;break}}o.name=(a=n.name)!=null?a:"Untitled Material";let i=o.userData.layers;MS(i);for(let l=e.length-1;l>=0;l--)OS(i,e[l],t);switch(r.category){case"basic":break;case"lambert":{let h=o,d=Xe(r.emissive,t);d instanceof $l?h.emissive.value=d:h.emissive.value.setHex(vi.getHex(d));break}case"toon":{let h=o,p=r;h.shininess.value=p.shininess;let d=Xe(p.specular,t);d instanceof $l?h.specular.value=d:h.specular.value.setHex(vi.getHex(d));break}case"physical":let l=o,c=r;l.metalness.value=c.metalness,l.roughness.value=c.roughness,l.reflectivity.value=c.reflectivity;break;case"phong":default:{let h=o,p=r;h.shininess.value=p.shininess;let d=Xe(p.specular,t);d instanceof $l?h.specular.value=d:h.specular.value.setHex(vi.getHex(d));break}}return i.blendColors(),i.blendAfterColors(),i.blendPositions(),o}function NS(n){for(let t of n)if(t.data.type==="light")return t.data;return{type:"light",category:"basic",visible:!0,alpha:1,mode:0}}function MS(n){for(let t of n.getLayers())n.removeLayer(t.id)}function OS(n,t,e){let r=xu(t,e);r.type==="transmission"&&(r.transmissionSamplerMap=e==null?void 0:e.transmissionSamplerMap,r.transmissionDepthMap=e==null?void 0:e.transmissionDepthMap);let o=n.addLayer(r);o.uuid=t.id;for(let i in t.data)vu(i,o,t.data)}import{Mesh as zS,Matrix4 as RS}from"three";import{Matrix4 as Yl}from"three";import{Box3 as Iu,Line3 as $t,Matrix4 as Kl,Vector3 as Ve}from"three";import{HemisphereLight as Tu}from"three";var fa=n=>"isEntity"in n,br=n=>"isAbstractMesh"in n,_r=n=>n!==null&&n.isBooleanMesh,Nu=n=>n.objectType==="CombinedCamera";var Gr=n=>"objectHelper"in n;function PS(n,t){var r;let e=!1;t.position&&(n.position.fromArray(t.position),e=!0),t.rotation&&(n.rotation.fromArray(t.rotation),e=!0),t.scale&&(e=!0,n.scale.fromArray(t.scale)),t.hiddenMatrix!==void 0&&"hiddenMatrix"in n&&(e=!0,n.hiddenMatrix.fromArray((r=t.hiddenMatrix)!=null?r:$r.identity)),e&&(n.updateMatrix(),_r(n.parent)&&br(n)&&n.invalidateDownstreamBooleanData(!0).recomputeBoolean()),t.position&&t.rotation&&t.scale&&t.hiddenMatrix!==void 0&&n.updateWorldMatrix(!1,!0),n.objectType==="CombinedCamera"&&(t.isUpVectorFlipped!==void 0&&(n.isUpVectorFlipped=t.isUpVectorFlipped),n.updateUp())}function IS(n,t){PS(n,t),t.name!==void 0&&(n.name=t.name),t.visible!==void 0&&(n.isEntity?n.visibility=t.visible:n.visible=t.visible)}function Mu(n,t,e){IS(n,t),t.color!==void 0&&(n.color=Xe(t.color,e)),t.intensity!==void 0&&(n.intensity=t.intensity),t.shadows!==void 0&&!(n instanceof Tu)&&(n.castShadow=t.shadows),n.shadow&&!(n instanceof Tu)&&t.depth!==void 0&&(n.shadow.camera.far=t.depth,n.shadow.needsUpdate=!0),t.helper!==void 0&&Gr(n)&&(n.enableHelper=t.helper,n.gizmos.shadowmap.visible=t.helper)}function Ou(n,t){n.shadow.camera.right=t/2,n.shadow.camera.left=-t/2,n.shadow.camera.top=t/2,n.shadow.camera.bottom=-t/2,n.shadow.needsUpdate=!0}var Si=new Iu,ft=new Ve,le=new Ve,tt=new Kl;function AS(n,t,e=0,r=t.count){let o=1/0,i=1/0,s=1/0,a=-1/0,l=-1/0,c=-1/0;for(let h=e;h<r;h++){let p=t.getX(h),d=t.getY(h),u=t.getZ(h);p<o&&(o=p),d<i&&(i=d),u<s&&(s=u),p>a&&(a=p),d>l&&(l=d),u>c&&(c=u)}return n.min.set(o,i,s),n.max.set(a,l,c),n}var Pu=(n,t,e,r)=>{var o;if(br(n)){let i=n.geometry.userData.parameters,s=n.geometry.getAttribute("position");n.geometry.userData.type==="SubdivGeometry"?ft.copy(n.originalGeometry.boundingSphere.center):s!==void 0&&(AS(Si,s,n.geometry.drawRange.start,n.geometry.drawRange.count<1/0?n.geometry.drawRange.count:s.count),Si.getCenter(ft)),n.forceComputeSize?Si.getSize(le).multiplyScalar(.5):le.set(i.width,i.height,(o=i.depth)!=null?o:0).multiplyScalar(.5)}else if(Gr(n)&&r===!0){let i=n.geometryHelper.getAttribute("position");Si.setFromArray(i.array),Si.getCenter(ft),Si.getSize(le).multiplyScalar(.5)}else ft.setScalar(0),le.setScalar(0);tt.copy(t).multiply(n.matrixWorld),le.x===0&&le.y===0&&le.z===0?e.push(new Ve(ft.x,ft.y,ft.z).applyMatrix4(tt)):e.push(new Ve(-le.x,le.y,le.z).add(ft).applyMatrix4(tt),new Ve(-le.x,-le.y,le.z).add(ft).applyMatrix4(tt),new Ve(le.x,-le.y,le.z).add(ft).applyMatrix4(tt),new Ve(le.x,le.y,le.z).add(ft).applyMatrix4(tt),new Ve(-le.x,le.y,-le.z).add(ft).applyMatrix4(tt),new Ve(-le.x,-le.y,-le.z).add(ft).applyMatrix4(tt),new Ve(le.x,-le.y,-le.z).add(ft).applyMatrix4(tt),new Ve(le.x,le.y,-le.z).add(ft).applyMatrix4(tt))},Tn=class extends Iu{constructor(){super(...arguments);this.matrix=new Kl;this.vertices=[];this.faces=[];this.edges=[];this.centerEdges=[]}copy(e){return super.copy(e),this.matrix.copy(e.matrix),this.vertices=e.vertices.map(r=>r.clone()),this.faces=e.faces.map(r=>r.clone()),this.edges=e.edges.map(r=>r.clone()),this.centerEdges=e.centerEdges.map(r=>r.clone()),this}setFromObjectSize(e,r=!1){e.updateWorldMatrix(!1,r),this.makeEmpty(),this.matrix.copy(e.matrixWorld);let o=new Kl().copy(e.matrixWorld).invert();return this.expandByObjectSize(e,o,r)}expandByObjectSize(e,r,o=!1){let i=[];return o===!0?e.traverseEntity(s=>{s.visible&&Pu(s,r,i,e.enableHelper===!0)}):Pu(e,r,i,e.enableHelper===!0),this.setFromPoints(i)}getCenter(e){return e=super.getCenter(e),e.applyMatrix4(this.matrix),e}getPositionToCenter(e){return e=super.getCenter(e),e.applyMatrix4(tt.copy(this.matrix).setPosition(0,0,0)),e}computeVertices(){this.getSize(le).multiplyScalar(.5),this.getCenter(ft),tt.copy(this.matrix).setPosition(ft),this.vertices=[new Ve(-le.x,le.y,le.z).applyMatrix4(tt),new Ve(-le.x,-le.y,le.z).applyMatrix4(tt),new Ve(le.x,-le.y,le.z).applyMatrix4(tt),new Ve(le.x,le.y,le.z).applyMatrix4(tt),new Ve(-le.x,le.y,-le.z).applyMatrix4(tt),new Ve(-le.x,-le.y,-le.z).applyMatrix4(tt),new Ve(le.x,-le.y,-le.z).applyMatrix4(tt),new Ve(le.x,le.y,-le.z).applyMatrix4(tt)]}computeEdges(){this.vertices.length>0&&this.computeVertices(),this.edges=[new $t(this.vertices[0],this.vertices[3]),new $t(this.vertices[1],this.vertices[2]),new $t(this.vertices[5],this.vertices[6]),new $t(this.vertices[4],this.vertices[7]),new $t(this.vertices[0],this.vertices[1]),new $t(this.vertices[3],this.vertices[2]),new $t(this.vertices[7],this.vertices[6]),new $t(this.vertices[4],this.vertices[5]),new $t(this.vertices[0],this.vertices[4]),new $t(this.vertices[1],this.vertices[5]),new $t(this.vertices[2],this.vertices[6]),new $t(this.vertices[3],this.vertices[7])],this.centerEdges=this.edges.map(e=>e.getCenter(new Ve))}computeFaces(){this.vertices.length>0&&this.computeVertices(),this.faces=[new Ve().copy(this.vertices[0]).sub(this.vertices[2]).multiplyScalar(.5).add(this.vertices[2]),new Ve().copy(this.vertices[7]).sub(this.vertices[5]).multiplyScalar(.5).add(this.vertices[5]),new Ve().copy(this.vertices[4]).sub(this.vertices[1]).multiplyScalar(.5).add(this.vertices[1]),new Ve().copy(this.vertices[3]).sub(this.vertices[6]).multiplyScalar(.5).add(this.vertices[6]),new Ve().copy(this.vertices[4]).sub(this.vertices[3]).multiplyScalar(.5).add(this.vertices[3]),new Ve().copy(this.vertices[1]).sub(this.vertices[6]).multiplyScalar(.5).add(this.vertices[6])]}};import{Object3D as DS,Matrix4 as BS,Light as ES}from"three";function Nn(n){let t=[];for(let e in n){let r=n[e];delete r.metadata,t.push(r)}return t}function _S(n){let t=[];for(let e in n)t.push(n[e]);return t}var ya=n=>class extends n{hasEntityChild(){return this.children.some(e=>fa(e))}isDescendantOf(e){e instanceof DS&&(e=e.uuid);let r=this;for(;r.parent;){if(r.parent.uuid===e)return!0;r=r.parent}return!1}attach(e,r){this.updateWorldMatrix(!0,!1);let o=new BS().copy(this.matrixWorld).invert();return e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),o.multiply(e.parent.matrixWorld)),fa(e)?e.hiddenMatrix.premultiply(o):e.applyMatrix4(o),e.updateWorldMatrix(!1,!1),this.add(e),r!==void 0&&(this.children.pop(),this.children.splice(r,0,e)),this}copy(e,r=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),r===!0)for(let o=0;o<e.children.length;o++){let i=e.children[o];this.add(i.clone())}return this}toJSON(e){let r=e===void 0,o={object:{uuid:"",objectType:""}};e===void 0&&(e={geometries:{},materials:{},textures:{},images:{},interactionStates:{},nodes:{}},o.metadata={version:1.5,type:"Object",generator:"Object3D.toJSON"});let i={uuid:this.uuid,objectType:this.type};if(this.name!==""&&(i.name=this.name),i.matrix=this.matrix.toArray(),this.castShadow===!0&&(i.castShadow=!0),this.receiveShadow===!0&&(i.receiveShadow=!0),this.visible===!1&&(i.visible=!1),this.frustumCulled===!1&&(i.frustumCulled=!1),this.renderOrder!==0&&(i.renderOrder=this.renderOrder),i.layers=this.layers.mask,JSON.stringify(this.userData)!=="{}"&&(i.userData=this.userData),this.children.length>0){i.children=[];for(let s of this.children)(fa(s)||s instanceof ES)&&i.children.push(s.toJSON(e).object)}if(r){let s=Nn(e.geometries),a=Nn(e.materials),l=Nn(e.textures),c=Nn(e.images),h=Nn(e.interactionStates),p=_S(e.nodes);s.length>0&&(o.geometries=s),a.length>0&&(o.materials=a),l.length>0&&(o.textures=l),c.length>0&&(o.images=c),h.length>0&&(o.interactionStates=h),p.length>0&&(o.nodes=p)}return o.object=i,o}fromJSON(e){return this.uuid=e.uuid,e.name!==void 0&&(this.name=e.name),e.matrix!==void 0?(this.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(this.matrixAutoUpdate=e.matrixAutoUpdate),this.matrixAutoUpdate&&this.matrix.decompose(this.position,this.quaternion,this.scale)):(e.position!==void 0&&this.position.fromArray(e.position),e.rotation!==void 0&&this.rotation.fromArray(e.rotation),e.quaternion!==void 0&&this.quaternion.fromArray(e.quaternion),e.scale!==void 0&&this.scale.fromArray(e.scale)),this.castShadow=e.castShadow!==void 0,this.receiveShadow=e.receiveShadow!==void 0,e.visible!==void 0&&(this.visible=e.visible),e.frustumCulled!==void 0&&(this.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(this.renderOrder=e.renderOrder),e.layers!==void 0&&(this.layers.mask=e.layers),e.userData!==void 0&&(this.userData=e.userData),this}};var Jt=n=>"isEntity"in n,Au=n=>"isAbstractMesh"in n,Kt=n=>class extends ya(n){constructor(){super(...arguments);this.objectType="";this.isEntity=!0;this.raycastLock=!1;this.scaleLock=!1;this.hiddenMatrix=new Yl;this._singleBBox=new Tn;this._recursiveBBox=new Tn;this.singleBBoxNeedsUpdate=!0;this.recursiveBBoxNeedsUpdate=!0;this.forceComputeSize=!1}set visibility(r){this.visible=r;for(let o of this.children)Jt(o)&&o.traverseEntity(i=>{Gr(i)&&i.visible&&(i.objectHelper.visible=r)})}get visibility(){return this.visible}get singleBBox(){return this.singleBBoxNeedsUpdate&&(this.singleBBoxNeedsUpdate=!1,this._singleBBox.setFromObjectSize(this,!1),this._singleBBox.computeVertices(),this._singleBBox.computeEdges(),this._singleBBox.computeFaces()),this._singleBBox}get recursiveBBox(){return this.recursiveBBoxNeedsUpdate&&(this.recursiveBBoxNeedsUpdate=!1,this._recursiveBBox.setFromObjectSize(this,!0),this._recursiveBBox.computeVertices(),this._recursiveBBox.computeEdges(),this._recursiveBBox.computeFaces()),this._recursiveBBox}resetBBoxNeedsUpdate(){this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0,this.traverseAncestors(r=>{Jt(r)&&(r.singleBBoxNeedsUpdate=!0,r.recursiveBBoxNeedsUpdate=!0)}),this.traverseEntity(r=>{r.singleBBoxNeedsUpdate=!0,r.recursiveBBoxNeedsUpdate=!0})}traverseEntity(r){r(this);for(let o of this.children)Jt(o)&&o.traverseEntity(r)}updateMatrixWorld(r){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||r)&&(this.parent===null?this.matrixWorld.multiplyMatrices(this.hiddenMatrix,this.matrix):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,r=!0);for(let o of this.children)o.updateMatrixWorld(r)}updateWorldMatrix(r,o){let i=this.parent;if(r&&i!==null&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.multiplyMatrices(this.hiddenMatrix,this.matrix):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,this.matrix)),o)for(let s of this.children)s.updateWorldMatrix(!1,!0)}shallowClone(r){return new this.constructor().shallowCopy(this,r)}shallowCopy(r,o=!0){if(super.copy(r,!1),this.raycastLock=r.raycastLock,this.scaleLock=r.scaleLock,this.hiddenMatrix.copy(r.hiddenMatrix),o===!0)for(let i of r.children)Jt(i)&&this.add(i.shallowClone());return this}clone(r){return new this.constructor().copy(this,r)}copy(r,o=!0){if(super.copy(r,!1),this.raycastLock=r.raycastLock,this.scaleLock=r.scaleLock,this.hiddenMatrix.copy(r.hiddenMatrix),o===!0)for(let i of r.children)Jt(i)&&this.add(i.clone());return this}keepChildrenMatrixWorld(){let r=new Yl,o=this.matrixWorld.clone();this.updateWorldMatrix(!1,!1),r.copy(this.matrixWorld).invert(),r.multiply(o);for(let i of this.children)Jt(i)&&i.hiddenMatrix.premultiply(r)}toJSON(r){let o=super.toJSON(r),i=o.object;return this.raycastLock===!0&&(i.raycastLock=!0),this.scaleLock===!0&&(i.scaleLock=!0),i.hiddenMatrix=this.hiddenMatrix.toArray(),o}fromJSON(r){return super.fromJSON(r),r.raycastLock!==void 0&&(this.raycastLock=r.raycastLock),r.scaleLock!==void 0&&(this.scaleLock=r.scaleLock),this.hiddenMatrix.fromArray(r.hiddenMatrix),this}fromObject3D(r){let o=r.children;return r.children=[],Object.assign(r,{raycastLock:!1,scaleLock:!1,hiddenMatrix:new Yl}),this.copy(r),r.children=o,this}toObjectTransformState(r=[]){this.updateWorldMatrix(!0,!1);let o={position:this.position.toArray(),rotation:[this.rotation.x,this.rotation.y,this.rotation.z],scale:this.scale.toArray(),hiddenMatrix:this.hiddenMatrix.toArray()};return $o(o,r)}fromObjectTransformState(r){return r.position&&this.position.fromArray(r.position),r.rotation&&this.rotation.fromArray(r.rotation),r.scale&&this.scale.fromArray(r.scale),r.hiddenMatrix&&this.hiddenMatrix.fromArray(r.hiddenMatrix),this.updateMatrix(),this}toState(r=[]){let o=P({name:this.name,visible:this.visible,raycastLock:this.raycastLock},this.toObjectTransformState(r));return $o(o,r)}fromState(r,o){return r.name&&(this.name=r.name),r.raycastLock!==void 0&&(this.raycastLock=r.raycastLock),r.type!=="OrthographicCamera"&&r.type!=="PerspectiveCamera"&&(this.matrixAutoUpdate=!1),r.visible!==void 0&&(this.visibility=r.visible),this.fromObjectTransformState(r),this}};import{Object3D as GS,Vector3 as Mn,Euler as Du,MathUtils as ro}from"three";var Co=class extends GS{constructor(e,r={}){super();this.object=e;let o=e.recursiveBBox.getSize(new Mn),i=.1;this.parameters=fs.defaultData(o.toArray(),i),uo(this.parameters,r),this.update(),this.setHideBase(this.parameters.hideBase)}refreshMaterial(){if("material"in this.object)for(let e of this.children)e.material=this.object.material}setHideBase(e){if("material"in this.object){if(Array.isArray(this.object.material)){if(this.children.length>0){for(let r of this.object.material)r.visible=!0;if(e){let r=this.object.material.map(o=>o.clone());for(let o of this.children)o.material=r}else for(let r of this.children)r.material=this.object.material}for(let r of this.object.material)r.visible=!e}else{if(this.children.length>0)if(this.object.material.visible=!0,e){let r=this.object.material.clone();for(let o of this.children)o.material=r}else for(let r of this.children)r.material=this.object.material;this.object.material.visible=!e}this.parameters.hideBase=e}}update(){switch(this._updateCount(),this.parameters.type){case"radial":this._updateRadial(this.parameters);break;case"linear":this._updateLinear(this.parameters);break;case"grid":this._updateGrid(this.parameters)}this.children.forEach(e=>e.updateMatrix())}_updateCount(){let e=this.parameters.type==="grid"?this.parameters.grid.count[0]*this.parameters.grid.count[1]*this.parameters.grid.count[2]:this.parameters.count;if(this.children.length!==e)if(this.children.length<e)for(let r=0,o=e-this.children.length;r<o;++r){let i=this.object.shallowClone(!1);i.visible=!0,this.add(i),this.parameters.hideBase&&this.setHideBase(!0)}else for(let r=0,o=this.children.length-e;r<o;++r)this.remove(this.children[0])}_updateRadial(e){let r=e.radial,o=r.start*ro.DEG2RAD,i=r.end*ro.DEG2RAD,s=o-i,a=new Du(r.rotation[0]*ro.DEG2RAD,r.rotation[1]*ro.DEG2RAD,r.rotation[2]*ro.DEG2RAD),l;switch(r.axis){case"z":l=new Mn(0,0,1);break;case"y":l=new Mn(0,1,0);break;default:case"x":l=new Mn(1,0,0);break}for(let[c,h]of this.children.entries()){h.hiddenMatrix.identity(),h.scale.x=r.scale[0],h.scale.y=r.scale[1],h.scale.z=r.scale[2],h.position.setScalar(0);let p=s/e.count*c-o;switch(r.axis){case"x":h.rotation.set(0,p,0);break;case"y":h.rotation.set(0,0,p);break;case"z":h.rotation.set(p,0,0);break}h.translateOnAxis(l,r.radius),h.position.x+=r.position[0],h.position.y+=r.position[1],h.position.z+=r.position[2],r.alignment===!0?(h.rotation.x+=a.x,h.rotation.y+=a.y,h.rotation.z+=a.z):h.rotation.copy(a)}}_updateLinear(e){if(e.type!=="linear")throw new Error;let r=e.linear,o=new Du(r.rotation[0]*ro.DEG2RAD,r.rotation[1]*ro.DEG2RAD,r.rotation[2]*ro.DEG2RAD);for(let[i,s]of this.children.entries())s.hiddenMatrix.identity(),s.scale.x=1+(r.scale[0]-1)*i,s.scale.y=1+(r.scale[1]-1)*i,s.scale.z=1+(r.scale[2]-1)*i,s.rotation.x=o.x*i,s.rotation.y=o.y*i,s.rotation.z=o.z*i,s.position.x=r.position[0]*i,s.position.y=r.position[1]*i,s.position.z=r.position[2]*i}_updateGrid(e){let r=0,o=e.grid;if(o.useCenter===!0){let i={x:o.count[0]%2===0?2:1,y:o.count[1]%2===0?2:1,z:o.count[2]%2===0?2:1},s=new Mn(o.size[0]*(o.count[0]-i.x)*.5,o.size[1]*(o.count[1]-i.y)*.5,o.size[2]*(o.count[2]-i.z)*.5);for(let a=0;a<o.count[0];a++)for(let l=0;l<o.count[1];l++)for(let c=0;c<o.count[2];c++){let h=this.children[r++];h.hiddenMatrix.identity(),h.scale.setScalar(1),h.rotation.set(0,0,0),h.position.x=o.size[0]*a-s.x,h.position.y=o.size[1]*l-s.y,h.position.z=o.size[2]*c-s.z}}else for(let i=0;i<o.count[0];i++)for(let s=0;s<o.count[1];s++)for(let a=0;a<o.count[2];a++){let l=this.children[r++];l.hiddenMatrix.identity(),l.scale.setScalar(1),l.rotation.set(0,0,0),l.position.x=o.size[0]*i,l.position.y=-o.size[1]*s,l.position.z=-o.size[2]*a}}fromJSON(e){return this}toJSON(){return{}}fromClonerState(e){return e.hideBase!==void 0&&this.setHideBase(e.hideBase),uo(this.parameters,e),this.update(),this}};var rt=class extends Kt(zS){constructor(e,r){super(e,r);this.isAbstractMesh=!0;this.isBooleanMesh=!1;this.booleanMeshSetAddress=-1;this.booleanWasTransformed=!1;this.booleanMatrixInvOld=new RS;this.booleanExclude=null;Array.isArray(r)&&(this.selectedMaterial=0,e.groups.length===0&&e.addGroup(0,e.getAttribute("position").count,0))}get cloner(){return this._cloner}set cloner(e){this._cloner&&this.remove(this._cloner),e&&this.add(e),this._cloner=e}getSelectedMaterial(e){return Array.isArray(this.material)?(this.selectedMaterial===void 0&&(this.selectedMaterial=e!=null?e:0),this.material[e!=null?e:this.selectedMaterial]):this.material}setSelectedMaterial(e,r){Array.isArray(this.material)?(this.selectedMaterial===void 0&&(this.selectedMaterial=r!=null?r:0),r=r!=null?r:this.selectedMaterial,this.material[r].dispose(),this.material[r]=e):(this.material.dispose(),this.material=e)}updateGeometry(e){let r=this.geometry,o=Xl[r.userData.type],i=this.objectType==="NonParametric"?Object.assign({},r.userData,{geometry:r}):r.userData,s=o.build(o.normalizeInputs(e,i)),a=r.uuid;if(this.geometry.dispose(),this.geometry=s,this.geometry.uuid=a,this.geometry.computeBoundingSphere(),this.cloner)for(let l of this.cloner.children)l.geometry=this.geometry}resizeGeometry(e,r,o){sn.resizeGeometry(this.geometry,{width:e,height:r,depth:o})}shallowClone(e){return new this.constructor(this.geometry,this.material).shallowCopy(this,e)}clone(e){let r=this.objectType==="NonParametric"?Object.assign({},this.geometry.userData,{geometry:this.geometry.clone()}):this.geometry.userData,o=On(r),i=Array.isArray(this.material)?this.material.map(s=>s.clone()):this.material.clone();return new this.constructor(o,i).copy(this,e)}copy(e,r=!0){return super.copy(e,r),e.cloner&&(this.cloner=new Co(e,e.cloner.parameters),this.add(this.cloner)),this}setFromClonerState(e){e===null?this.cloner=void 0:(this.cloner===void 0&&(this.cloner=new Co(this)),this.cloner.fromClonerState(e))}fromState(e,r){var o,i,s;return super.fromState(e),e.type==="Mesh"&&(this.setFromClonerState(e.cloner),this.castShadow=(o=e.castShadow)!=null?o:!0,this.receiveShadow=(i=e.receiveShadow)!=null?i:!0,this.booleanExclude=(s=e.booleanExclude)!=null?s:null),this}freeBooleanPointer(){this.booleanMeshSetAddress!==-1&&(Yt.freeMeshSet(this.booleanMeshSetAddress),this.booleanMeshSetAddress=-1)}invalidateDownstreamBooleanData(e=!1){return e?this.booleanWasTransformed=!0:this.freeBooleanPointer(),_r(this.parent)?this.parent.invalidateDownstreamBooleanData():this}invalidateUpstreamBooleanData(){this.freeBooleanPointer();for(let e of this.children)br(e)&&(e.freeBooleanPointer(),_r(e)&&e.invalidateUpstreamBooleanData())}};var US=new Zl(0,0,1),Bu=new Zl,Eu=new Zl,_u=new jS,oo=class extends rt{constructor(e=dt.create({}),r=new mt({side:FS})){var o;super(e,r);this.recursiveSelection=!1;this.objectType="VectorObject";this.eventDispatcher=new VS;this._onShapeUpdate=()=>{this.updateGeometry({}),this.geometry.computeBoundingSphere(),this.geometry.computeBoundingBox()};this.castShadow=!0,this.receiveShadow=!0,this.forceComputeSize=!0,this.shape=e.userData.shape,(o=this.shape.eventDispatcher)==null||o.addEventListener("update",this._onShapeUpdate)}toJSON(e){let r=super.toJSON(e);return r.object.objectType="VectorObject",r}fromState(e){return super.fromState(e),this.shape.update(),this}setHelperVisibility(){}updateGeometry(e){if(super.updateGeometry(e),"userData"in this.geometry){let r=this.geometry.userData.parameters;this.eventDispatcher.dispatchEvent({type:"geometryUpdate",parameters:r})}}setShape(e){var r,o;this.shape&&((r=this.shape.eventDispatcher)==null||r.removeEventListener("update",this._onShapeUpdate)),this.shape=e,(o=this.shape.eventDispatcher)==null||o.addEventListener("update",this._onShapeUpdate)}updateWorldMatrix(e,r){super.updateWorldMatrix(e,r),_u.getNormalMatrix(this.matrixWorld),Bu.copy(US).applyMatrix3(_u).normalize(),Eu.setFromMatrixPosition(this.matrixWorld),this.shape.plane.setFromNormalAndCoplanarPoint(Bu,Eu)}clone(e){let r=this.shape.clone(),o=this.material.clone(),i=this.geometry.userData,s=dt.create(Object.assign({},i,{shape:r})),a=new oo(s,o).copy(this,e);return a.shape=r,r.update(),a}raycast(e,r){rt.prototype.raycast.call(this,e,r)}};function ga(n,t){return HS(n)}function HS(n){let t={parameters:n,type:n.type};if(n.type==="VectorGeometry"){let r=Oe.createFromState(n.shape,n.width,n.height);t.shape=r}else n.type==="NonParametricGeometry"&&(n.data.groups&&n.data.groups.forEach(r=>{var o;return r.materialIndex=Math.max((o=r.materialIndex)!=null?o:0,0)}),t.geometry=new kS().parse(n));let e;try{e=On(t)}catch(r){console.error(r)}if(!e){let r=Oe.createFromState(ti.defaultData(),100,100);t.shape=r,e=On(t)}return e}var fe;ea.then(n=>{fe=n});var Ru=new Float32Array([10,10,0,-10,10,0,-10,-10,0,10,-10,0]),Fu=new Uint32Array([0,1,2,3]),Vu=new Uint8Array([4]),nr=class{static build(n,t,e,r){let o,i,s;if((n==null?void 0:n.positionWASM)!==void 0){t&&t!==0&&(fe.free_bvh(t),fe.free_subdivision_surface(t));try{o=nr.allocate(n,r)}catch(a){console.error(a,n),o=nr.allocate({positionWASM:Ru,indexWASM:Fu,verticesPerFaceWASM:Vu},r)}fe.set_destination_refinement_level(o,0),i=nr.buildLevel(o,!0,e)}else o=t;if(n!==void 0&&n.subdivisions!==void 0){let a=WS(n.subdivisions,n.positionWASM.length);fe.set_destination_refinement_level(o,a),a>0?s=nr.buildLevel(o,!1,e):s=null}return{subdivPointer:o,originalGeometry:i,subdividedGeometry:s}}static primitiveToQuads(n,t){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 e=n.shape!==void 0?t.geometry:ga(n),r,o,i,s;return{positions:r,triIndices:s}=ic(e.getAttribute("position"),e.getIndex()),{indices:o,verticesPerFace:i}=nc(r,s,e),{positions:r,indices:o,verticesPerFace:i}}static allocate(n,t){var N;let e,r,o,i=[],s=[];n.positionWASM&&n.positionWASM.length>0?(e=n.positionWASM,r=n.indexWASM,o=n.verticesPerFaceWASM):(e=Ru,r=Fu,o=Vu);let a=e.length,l=r.length,c=o.length,h=e.length+i.length+s.length,p=r.length+o.length,d=h*Float32Array.BYTES_PER_ELEMENT+p*Uint32Array.BYTES_PER_ELEMENT,u=h*Float32Array.BYTES_PER_ELEMENT,f=p*Uint32Array.BYTES_PER_ELEMENT,g=fe._malloc(d),w=new Float32Array(fe.HEAPF32.buffer,g,h),y=new Uint32Array(fe.HEAPU32.buffer,g+u,p);w.set(e,0),w.set(i,e.length),w.set(s,e.length+i.length),y.set(r,0),y.set(o,r.length);let b;(N=n==null?void 0:n.scaleBaked)!=null&&N.some(v=>v!==1)&&(b=new qS().makeScale(...n.scaleBaked)),t&&(b?b.premultiply(t):b=t);let A=b?fe.alloc_subdivision_surface2(g,a,g+u,l,g+u+r.length*Uint32Array.BYTES_PER_ELEMENT,c,b.elements):fe.alloc_subdivision_surface(g,a,g+u,l,g+u+r.length*Uint32Array.BYTES_PER_ELEMENT,c);return fe._free(g),A}static buildLevel(n,t,e,r,o){let i=o?fe.get_mesh_data2(n,t?fe.Level.CONTROL:fe.Level.REFINED,e!=null?e:!t,o.elements):fe.get_mesh_data(n,t?fe.Level.CONTROL:fe.Level.REFINED,e!=null?e:!t),s=8,a=fe.HEAPU32.subarray(i>>2,(i>>2)+s),l=a.subarray(4,4+4),c=0,h=fe.HEAPU32[a[c]>>2],p=fe.HEAPF32.subarray(h>>2,(h>>2)+l[c]);c++;let d=fe.HEAPU32[a[c]>>2],u=fe.HEAPF32.subarray(d>>2,(d>>2)+l[c]);c++;let f=fe.HEAPU32[a[c]>>2],g=fe.HEAPU32.subarray(f>>2,(f>>2)+l[c]);c++;let w=fe.HEAPU32[a[c]>>2],y=fe.HEAPU32.subarray(w>>2,(w>>2)+l[c]);if(c++,r===void 0){let b=new Gu;if(b.setIndex(new Ql(y,1)),b.setAttribute("position",new ec(p,3)),b.setAttribute("normal",new ec(u,3)),t){b.setAttribute("faceMap",new Ql(g,1));let A=new Float32Array(u.length/3*4).fill(0);b.setAttribute("color",new zu(A,4))}return fe.free_mesh_data(i),b.userData.type="SubdivGeometry",b}r.getAttribute("position").copyArray(p),r.getAttribute("normal").copyArray(u),r.attributes.position.needsUpdate=!0,r.attributes.normal.needsUpdate=!0,fe.free_mesh_data(i)}static buildControlCageWireframe(n,t,e){let r=fe.get_wireframe_data_for_base_level(n),o=4,i=fe.HEAPU32.subarray(r>>2,(r>>2)+o),s=i.subarray(2,2+2),a=0,l=fe.HEAPU32[i[a]>>2],c=fe.HEAPF32.subarray(l>>2,(l>>2)+s[a]);a++;let h=fe.HEAPU32[i[a]>>2],p=fe.HEAPU32.subarray(h>>2,(h>>2)+s[a]);if(t===void 0){let d=new Gu;d.setAttribute("position",new ec(c,3));let u=new Float32Array(c.length);for(let f=0,g=c.length;f<g;)u[f++]=e.r,u[f++]=e.g,u[f++]=e.b;return d.setAttribute("color",new zu(u,3)),d.setIndex(new Ql(p,1)),fe.free_wireframe_data_for_base_level(r),d}t.getAttribute("position").copyArray(c),t.attributes.position.needsUpdate=!0,fe.free_wireframe_data_for_base_level(r)}static updateCollabMesh(n,t,e){t||fe.set_destination_refinement_level(n,1);let r=e?fe.get_topological_data2(n,t?fe.Level.CONTROL:fe.Level.REFINED,e.elements):fe.get_topological_data(n,t?fe.Level.CONTROL:fe.Level.REFINED),o=6,i=fe.HEAPU32.subarray(r>>2,(r>>2)+o),s=i.subarray(3,3+3),a=0,l=fe.HEAPU32[i[a]>>2],c=new Float32Array(fe.HEAPF32.subarray(l>>2,(l>>2)+s[a]));a++;let h=fe.HEAPU32[i[a]>>2],p=new Uint32Array(fe.HEAPU32.subarray(h>>2,(h>>2)+s[a]));a++;let d=fe.HEAPU32[i[a]>>2],u=new Uint8Array(fe.HEAPU32.subarray(d>>2,(d>>2)+s[a]));return fe.free_topological_data(r),{positions:c,indices:p,verticesPerFace:u}}};function WS(n,t){let e=n;return e=Math.min(e,3-Math.ceil(Math.log(t/172e3)/Math.log(4))),Math.max(e,0)}var ju=["getX","getY","getZ"];function ic(n,t){let e={},r=t?t.count:n.count,o=0,i=[],s=[],a=1e4;for(let c=0;c<r;c++){let h=t?t.getX(c):c,p="";for(let d=0;d<3;d++)p+=`${~~(n[ju[d]](h)*a)},`;if(p in e)i.push(e[p]);else{for(let d=0;d<3;d++)s.push(n[ju[d]](h));e[p]=o,i.push(o),o++}}let l=[];for(let c=0;c<i.length;c+=3)i[c]===i[c+1]||i[c]===i[c+2]||i[c+1]===i[c+2]||l.push(i[c],i[c+1],i[c+2]);return{positions:s,triIndices:l}}var xa=new ba,tc=new ba,rc=new ba,oc=new ba;function nc(n,t,e){var i;let r=[],o=[];if(e.userData.shape!==void 0&&e.userData.parameters.depth===0){let s=e.userData.shape.extractShapePointsToFlatArray([]),a=0;for(let c=0;c<s.length;c+=2)a+=(s[c]-s[(c===0?s.length:c)-2])*(s[c+1]+s[(c===0?s.length:c)-1]);n.length=0;let l=0;if(a<0)for(let c=0;c<s.length;c+=2)n.push(s[c],s[c+1],0),r.push(l++);else for(let c=s.length-2;c>=0;c-=2)n.push(s[c],s[c+1],0),r.push(l++);return o.push(l),{indices:r,verticesPerFace:o}}for(let s=0,a=(i=e.capStartIndex)!=null?i:t.length;s<a;)if(t[s+1]===t[s+3]&&t[s+2]===t[s+5]||t[s+0]===t[s+3]&&t[s+2]===t[s+4]){xa.set(n[t[s]*3],n[t[s]*3+1],n[t[s]*3+2]),tc.set(n[t[s+1]*3],n[t[s+1]*3+1],n[t[s+1]*3+2]),rc.set(n[t[s+4]*3],n[t[s+4]*3+1],n[t[s+4]*3+2]),oc.set(n[t[s+5]*3],n[t[s+5]*3+1],n[t[s+5]*3+2]),tc.sub(xa).normalize(),rc.sub(xa).normalize(),oc.sub(xa).normalize();let l=tc.cross(rc).dot(oc);Math.abs(l)>.005?(r.push(t[s],t[s+1],t[s+2]),o.push(3),s+=3):(r.push(t[s],t[s+1],t[s+4],t[s+5]),o.push(4),s+=6)}else r.push(t[s],t[s+1],t[s+2]),o.push(3),s+=3;if(e.capStartIndex!==void 0){let s=[],a=[],l=0;for(let c=0,h=0;c<n.length;c+=3,h++)n[c+2]===0&&(s.push(h),l++),n[c+2]===e.userData.parameters.depth&&a.push(h);if(e.userData.parameters.extrudeBevelSize===0){let c=a[0];a[0]=a[1],a[1]=c}s.reverse(),r.push(...s,...a),o.push(l,l)}return{indices:r,verticesPerFace:o}}var Yt={};xc(Yt,{calcBoolean:()=>XS,calcBooleanTopological:()=>YS,freeMeshSet:()=>ew,getMeshSet:()=>ZS,transformMeshSet:()=>QS});var $S,Uu=new Promise(n=>{$S=n});import{Float32BufferAttribute as ku,Sphere as JS}from"three";var Ce,wi;Uu.then(n=>Ce=n);function KS(n,t){let e,{positions:r,triIndices:o}=ic(n.getAttribute("position"),n.getIndex()),i;if(t||n.userData.shape!==void 0){let{indices:s,verticesPerFace:a}=nc(r,o,n);i=a.length,e=[];for(let l=0,c=0;l<i;l++){e.push(a[l]);for(let h=0;h<a[l];h++)e.push(s[c++])}}else{let s=o.length;e=Array(s+s/3),i=0;for(let a=0,l=0;l<e.length;)e[l++]=3,i++,e[l++]=o[a++],e[l++]=o[a++],e[l++]=o[a++]}return{positions:r,faceIndices:e,nFaces:i}}function Hu(n){let t=n.length,e=t*Uint32Array.BYTES_PER_ELEMENT,r=t*Float32Array.BYTES_PER_ELEMENT,o=Number.isInteger(n[0])?e:r,i=Ce._malloc(o);return(Number.isInteger(n[0])?new Uint32Array(Ce.HEAPU32.buffer,i,t):new Float32Array(Ce.HEAPF32.buffer,i,t)).set(n,0),i}function qu(n){switch(n){case 0:return Ce.OP.UNION;case 1:return Ce.OP.INTERSECTION;case 2:return Ce.OP.A_MINUS_B;case 3:return Ce.OP.B_MINUS_A;case 4:return Ce.OP.SYMMETRIC_DIFFERENCE;case 5:return Ce.OP.ALL;default:throw new Error("Unknown boolean operation "+n)}}function YS(n,t){wi===void 0&&(wi=Ce.init_csg());let e=Ce.csg_calc(wi,Hu(n),n.length,qu(t),!0),r=6,o=Ce.HEAPU32.subarray(e>>2,(e>>2)+r),i=o.subarray(3,3+3),s=0,a=Ce.HEAPU32[o[s]>>2],l=new Float32Array(Ce.HEAPF32.subarray(a>>2,(a>>2)+i[s]));s++;let c=Ce.HEAPU32[o[s]>>2],h=new Uint32Array(Ce.HEAPU32.subarray(c>>2,(c>>2)+i[s]));s++;let p=Ce.HEAPU32[o[s]>>2],d=new Uint8Array(Ce.HEAPU32.subarray(p>>2,(p>>2)+i[s]));return Ce.free_mesh_data(e),{positions:l,indices:h,verticesPerFace:d}}function XS(n,t,e){wi===void 0&&(wi=Ce.init_csg());let r=Ce.csg_calc(wi,Hu(n),n.length,qu(t),!1),o=5,i=Ce.HEAPU32.subarray(r>>2,(r>>2)+o),s=i.subarray(2,2+3),a=0,l=Ce.HEAPU32[i[a]>>2],c=Ce.HEAPF32.subarray(l>>2,(l>>2)+s[a]);a++;let h=Ce.HEAPU32[i[a]>>2],p=Ce.HEAPF32.subarray(h>>2,(h>>2)+s[a]);a++;let d=s[a];e.setAttribute("position",new ku(c,3)),e.setAttribute("normal",new ku(p,3));let u=Ce.HEAPF32.subarray((r>>2)+5,(r>>2)+5+6);return e.boundingSphere===null&&(e.boundingSphere=new JS),e.boundingSphere.center.set(u[0],u[1],u[2]),e.boundingSphere.radius=(u[3]**2+u[4]**2+u[5]**2)**.5,e.userData.parameters={width:u[3]*2,height:u[4]*2,depth:u[5]*2},Ce.free_mesh_data(r),d}function ZS(n,t){if(Ce===void 0)return-1;let e,r,o;if(t&&n.userData.positions!==void 0){let g=n.userData;o=g.verticesPerFace.length,e=g.positions,r=Array(g.verticesPerFace.reduce((w,y)=>w+y,0)+o);for(let w=0,y=0,b=0;w<g.verticesPerFace.length;w++){r[b++]=g.verticesPerFace[w];for(let A=0;A<g.verticesPerFace[w];A++)r[b++]=g.indices[y++]}}else({positions:e,faceIndices:r,nFaces:o}=KS(n,t));let i=e.length,s=r.length,a=e.length,l=r.length,c=a*Float32Array.BYTES_PER_ELEMENT+l*Uint32Array.BYTES_PER_ELEMENT,h=a*Float32Array.BYTES_PER_ELEMENT,p=l*Uint32Array.BYTES_PER_ELEMENT,d=Ce._malloc(c),u=new Float32Array(Ce.HEAPF32.buffer,d,a),f=new Uint32Array(Ce.HEAPU32.buffer,d+h,l);return u.set(e,0),f.set(r,0),Ce.get_csg_mesh(d,i,d+h,s,o)}function QS(n,t){Ce.transform_csg_mesh(n,t.elements)}function ew(n){Ce.free_csg_mesh(n)}var Xl={ConeGeometry:pd,CubeGeometry:dd,CylinderGeometry:hd,DodecahedronGeometry:ud,EllipseGeometry:zd,HelixGeometry:Ud,IcosahedronGeometry:kd,LatheGeometry:Hd,NonParametricGeometry:Jd,PolygonGeometry:Kd,PyramidGeometry:Yd,RectangleGeometry:Zs,SphereGeometry:Xd,PlaneGeometry:Zd,StarGeometry:Qd,TextFrameGeometry:Qs,TorusGeometry:eu,TorusKnotGeometry:tu,TriangleGeometry:ru,VectorGeometry:dt},On=n=>Xl[n.type].create(n);import{VideoTexture as tw}from"three";var Wu=n=>n.tagName==="VIDEO",To=class{static resize(t,e,r){let o=t/e,i;if(!r.image)return;let s=r.image;Wu(s)?i=s.videoWidth/s.videoHeight:i=s.width/s.height,o>i&&(r.imageType=="WEBCAM"?r.repeat.set(-1,1*i/o):r.repeat.set(1,1*i/o)),o<i&&(r.imageType=="WEBCAM"?r.repeat.set(1*o/i*-1,1):r.repeat.set(1*o/i,1)),o==i&&(r.imageType=="WEBCAM"?r.repeat.set(-1,1):r.repeat.set(1,1))}static resizeTextureLayer(t,e,r){let o=t/e,i=r.image!==void 0?r.image.width/r.image.height:1,s;o>i?s={x:1,y:i/o}:o<i?s={x:o/i,y:1}:s={x:1,y:1},r.repeat.set(s.x,s.y),r.updateMatrix()}static resizeTextureLayers(t,e,r){let o=r.userData.layers,i=o.getLayers();for(let s=0;s<i.length;s++){let a=i[s];hu(a)&&(To.resizeTextureLayer(t,e,a.uniforms[`f${a.id}_texture`].value),o.updateLayerUniform())}}static resizeComplex(t,e,r,o){let i=t/e,s,a=r.image;Wu(a)?s=a.videoWidth/a.videoHeight:s=a.width/a.height,o.geometry.type.includes("Shape")?(i>s&&(r.imageType=="WEBCAM"?r.repeat.set(1/t*-1,1/e*s/i):r.repeat.set(1/t,1/e*s/i)),i<s&&(r.imageType=="WEBCAM"?r.repeat.set(1/t*i/s*-1,1/e):r.repeat.set(1/t*i/s,1/e)),i==s&&(r.imageType=="WEBCAM"?r.repeat.set(1/t*-1,1/e):r.repeat.set(1/t,1/e))):(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)))}};var Li=class extends rt{constructor(e,r=new mt){super(e,r);this.objectType="Mesh2D";this.castShadow=!0,this.receiveShadow=!0}updateGeometry(e){super.updateGeometry(e),this.material.userData.layers&&To.resizeTextureLayers(this.geometry.userData.parameters.width,this.geometry.userData.parameters.height,this.material)}resizeGeometry(e,r){super.resizeGeometry(e,r,0),this.material.userData.layers&&To.resizeTextureLayers(this.geometry.userData.parameters.width,this.geometry.userData.parameters.height,this.material)}toJSON(e){let r=super.toJSON(e);return r.object.objectType="Mesh2D",r}clone(){let e=super.clone();return e.updateGeometry({}),e}static fromTexture(e){let r,o;if(e instanceof tw){let a=e.image;r=a.videoWidth*.5,o=a.videoHeight*.5}else{let a=e.image;r=a.width*.5,o=a.height*.5}let i=Zs.create({parameters:{width:r,height:o}}),s=new mt;return s.layersList.changeLayer(0,{type:"texture",texture:e}),s.layersList.moveLayer(0,1),s.dispose(),new Li(i,s)}};import{BufferGeometry as $u,Matrix4 as rw}from"three";var ow=new rw;var va=class extends rt{constructor(e=new $u,r=new Ot){super(e,r);this.booleanOp=2;this.meshSetAddresses=[];this.needsTransformForDownstream=!1;this.isBooleanMesh=!0,this.castShadow=!0,this.receiveShadow=!0,this.geometry.userData.parameters={width:0,height:0,depth:0},this.onAfterRender=this.recomputeBoolean.bind(this)}reInit(){this.isBooleanMesh=!0,this.meshSetAddresses=[],this.needsTransformForDownstream=!1,this.geometry.userData.parameters={width:0,height:0,depth:0},this.onAfterRender=this.recomputeBoolean.bind(this)}recomputeBoolean(e){if(this.booleanMeshSetAddress!==-1)return;for(let o=0;o<this.children.length;o++){let i=this.children[o];_r(i)&&i.recomputeBoolean(e===!0)}this.meshSetAddresses=[];for(let o=0;o<this.children.length;o++){let i=this.children[o];if(Au(i)&&i.booleanExclude===!1&&i.geometry.drawRange.count>0){if(i.booleanMeshSetAddress===-1){if(i.booleanMeshSetAddress=Yt.getMeshSet(i.geometry,e===!0),i.booleanMeshSetAddress===-1)return;Yt.transformMeshSet(i.booleanMeshSetAddress,i.matrix),i.booleanMatrixInvOld.copy(i.matrix).invert(),i.booleanWasTransformed=!1}else _r(i)&&i.needsTransformForDownstream===!0?(Yt.transformMeshSet(i.booleanMeshSetAddress,i.matrix),i.needsTransformForDownstream=!1):i.booleanWasTransformed===!0&&(Yt.transformMeshSet(i.booleanMeshSetAddress,ow.multiplyMatrices(i.matrix,i.booleanMatrixInvOld)),i.booleanMatrixInvOld.copy(i.matrix).invert(),i.booleanWasTransformed=!1);this.meshSetAddresses.push(i.booleanMeshSetAddress)}}if(this.meshSetAddresses.length===0){this.geometry.setDrawRange(0,0);return}if(e===!0)return Yt.calcBooleanTopological(this.meshSetAddresses,this.booleanOp);let r=this.geometry;r.dispose(),this.geometry=new $u,this.geometry.userData=r.userData,this.geometry.boundingSphere=r.boundingSphere,this.booleanMeshSetAddress=Yt.calcBoolean(this.meshSetAddresses,this.booleanOp,this.geometry),this.booleanMatrixInvOld.copy(this.matrix).invert(),this.needsTransformForDownstream=!0}toJSON(e){let r=super.toJSON(e);return r.object.objectType="Mesh3D",r}updateGeometry(e){this.booleanOp=e.parameters.operation,this.invalidateDownstreamBooleanData().recomputeBoolean()}};import{Camera as bw,OrthographicCamera as vw,PerspectiveCamera as Sw,Vector3 as jt,Object3D as Yu,Quaternion as ww}from"three";import{BoxBufferGeometry as iw}from"three";var vr=n=>{var t;return t=class extends n{constructor(){super(...arguments);this.isObjectHelper=!0}},t.geometryHelper=new iw(30,30,30),t};import{Camera as cw,LineSegments as hw,BufferGeometry as pw,LineBasicMaterial as dw,Color as ac,Vector3 as uw,Float32BufferAttribute as Ku}from"three";import{Ray as nw,Sphere as sw,Matrix4 as aw,Vector3 as zr}from"three";var Sa=new nw,sc=new sw,Ju=new aw,Sr=(n,t,e,r,o=!1)=>{let i=t,s=n.matrixWorld;if(i.boundingSphere===null&&i.computeBoundingSphere(),sc.copy(i.boundingSphere),sc.applyMatrix4(s),e.ray.intersectsSphere(sc)===!1||(Ju.copy(s).invert(),Sa.copy(e.ray).applyMatrix4(Ju),i.boundingBox!==null&&Sa.intersectsBox(i.boundingBox)===!1))return;let a,l,c,h,p=i.index,d=i.attributes.position,u=i.drawRange,f,g;if(o===!1){let y=Math.max(0,u.start),b=Math.min(p.count,u.start+u.count);for(f=y,g=b;f<g;f+=3)if(l=p.getX(f),c=p.getX(f+1),h=p.getX(f+2),a=w(n,e,Sa,d,l,c,h),a){a.faceIndex=Math.floor(f/3),r.push(a);return}}else{let b=i.attributes.position,A=new zr,N=new zr,v=new zr,k=new zr,L=2,I=1/((n.scale.x+n.scale.y+n.scale.z)/3),x=I*I,C=Math.max(0,u.start),T=Math.min(b.count,u.start+u.count);for(let O=C,$=T-1;O<$;O+=L){if(A.fromBufferAttribute(b,O),N.fromBufferAttribute(b,O+1),Sa.distanceSqToSegment(A,N,k,v)>x)continue;k.applyMatrix4(n.matrixWorld);let ie=e.ray.origin.distanceTo(k);ie<e.near||ie>e.far||r.push({distance:ie,point:v.clone().applyMatrix4(n.matrixWorld),object:n})}}function w(y,b,A,N,v,k,L){let m=new zr,I=new zr,x=new zr,C=new zr,T=new zr;if(m.fromBufferAttribute(N,v),I.fromBufferAttribute(N,k),x.fromBufferAttribute(N,L),A.intersectTriangle(m,I,x,!1,C)===null)return null;T.copy(C),T.applyMatrix4(y.matrixWorld);let $=b.ray.origin.distanceTo(T);return $<b.near||$>b.far?null:{faceIndex:1,distance:$,point:T.clone(),object:y}}};var wa=new uw,Xt=new cw,lc=class extends hw{constructor(e){let r=new pw,o=new dw({color:16777215,vertexColors:!0,toneMapped:!1}),i=[],s=[],a={},l=new ac(15711266),c=new ac(15711266),h=new ac(2857471);p("n1","n2",l),p("n2","n4",l),p("n4","n3",l),p("n3","n1",l),p("f1","f2",l),p("f2","f4",l),p("f4","f3",l),p("f3","f1",l),p("n1","f1",l),p("n2","f2",l),p("n3","f3",l),p("n4","f4",l),p("p","n1",c),p("p","n2",c),p("p","n3",c),p("p","n4",c),p("u1","u2",h),p("u2","u3",h),p("u3","u1",h);function p(u,f,g){d(u,g),d(f,g)}function d(u,f){i.push(0,0,0),s.push(f.r,f.g,f.b),a[u]===void 0&&(a[u]=[]),a[u].push(i.length/3-1)}r.setAttribute("position",new Ku(i,3)),r.setAttribute("color",new Ku(s,3));super(r,o);this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update()}update(){let e=this.geometry,r=this.pointMap,o=!0;Xt.projectionMatrixInverse.elements=[.5112609807824982,-0,-0,-0,-0,.41421356237309503,-0,-0,-0,-0,-0,-.099999,-0,-0,-1.0000000000000002,.100001];let i=1,s=1,a=o?.8:1e-4;sr("n1",r,e,Xt,-i,-s,a),sr("n2",r,e,Xt,i,-s,a),sr("n3",r,e,Xt,-i,s,a),sr("n4",r,e,Xt,i,s,a);let l=a;sr("f1",r,e,Xt,-i,-s,l),sr("f2",r,e,Xt,i,-s,l),sr("f3",r,e,Xt,-i,s,l),sr("f4",r,e,Xt,i,s,l);let c=l,h=.5;sr("u1",r,e,Xt,i*.7*h,s*1.1,c),sr("u2",r,e,Xt,-i*.7*h,s*1.1,c),sr("u3",r,e,Xt,0,s*(1.1+.9*h),c),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}};function sr(n,t,e,r,o,i,s){wa.set(o,i,s).unproject(r);let a=t[n];if(a!==void 0){let l=e.getAttribute("position");for(let c=0,h=a.length;c<h;c++)l.setXYZ(a[c],wa.x,wa.y,wa.z)}}var La=class extends vr(lc){constructor(e){super(e);this.object=e;this.object=e,this.name=`CombinedCameraHelper: ${e.uuid}`}updateMatrixWorld(e){super.updateMatrixWorld(e),this.updateTarget()}updateTarget(){let e=this.object.getTarget();this.updateWorldMatrix(!0,!1),this.worldToLocal(e)}raycast(e,r){Sr(this.object,this.geometry,e,r,!0)}};import{DirectionalLightHelper as mw}from"three";var Ci=class extends vr(mw){constructor(e,r=15,o=10066329){super(e,r,o);this.object=e;this.name=`DirectionalLightHelper: ${e.uuid}`}raycast(e,r){Sr(this.object,Ci.geometryHelper,e,r)}};import{AxesHelper as fw}from"three";var Ti=class extends vr(fw){constructor(e,r=15){super(r);this.object=e;this.object.updateMatrixWorld(),this.name=`EmptyObjectHelper: ${e.uuid}`,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}raycast(e,r){Sr(this.object,Ti.geometryHelper,e,r)}update(){}};import{PointLightHelper as yw}from"three";var Ni=class extends vr(yw){constructor(e,r=15,o=6710886){super(e,r,o);this.object=e;this.name=`PointLightHelper: ${e.uuid}`}raycast(e,r){Sr(this.object,Ni.geometryHelper,e,r)}};import{SpotLightHelper as gw,Vector3 as xw}from"three";var Ca=class extends vr(gw){constructor(e,r=6710886){super(e,r);this.object=e;this.name=`SpotLightHelper: ${e.uuid}`}raycast(e,r){Sr(this.object,Ca.geometryHelper,e,r)}update(){if(this.object!==void 0){let e=Ca._vector,r=this.object.distance?this.object.distance:1e3,o=r*Math.tan(this.object.angle);this.cone.scale.set(o,o,r),e.setFromMatrixPosition(this.object.target.matrixWorld),this.cone.lookAt(e);let i=this.color!==void 0?this.color:this.light.color;if(this.cone.material instanceof Array)for(let s=0,a=this.cone.material.length;s<a;s++)this.cone.material[s].color.set(i);else this.cone.material.color.set(i)}}},Pn=Ca;Pn._vector=new xw;var wr=(n,t)=>class extends n{constructor(){super(...arguments);this.objectHelper=new t(this);this.enableHelper=!1}set visibility(o){this.visible=o,this.setHelperVisibility(o),this.setHelperChildrenVisibility(o)}get visibility(){return this.visible}get geometryHelper(){return t.geometryHelper}setHelperVisibility(o){this.objectHelper.visible=o}setHelperChildrenVisibility(o){for(let i of this.children)Jt(i)&&i.traverseEntity(s=>{Gr(s)&&s.visible&&(s.objectHelper.visible=o)})}raycast(o,i){this.objectHelper.raycast(o,i)}copy(o,i=!0){return super.copy(o,i),o.enableHelper!==void 0&&(this.enableHelper=o.enableHelper),o.objectHelper!==void 0&&(this.objectHelper.visible=o.objectHelper.visible),this}toJSON(o){let i=super.toJSON(o),s=i.object;return s.enableHelper=this.enableHelper,i}fromJSON(o){return super.fromJSON(o),o.enableHelper!==void 0&&(this.enableHelper=!0),this}fromLightState(o,i){if(this.objectType==="LightDirectional"||this.objectType==="LightPoint"||this.objectType==="LightSpot"){let s=this;o.color!==void 0&&(s.color=Xe(o.color,i)),o.intensity!==void 0&&(s.intensity=o.intensity),o.depth!==void 0&&(s.shadow.camera.far=o.depth,s.shadow.needsUpdate=!0),o.shadows!==void 0&&(this.castShadow=o.shadows),o.helper!==void 0&&(this.enableHelper=o.helper,s.gizmos.shadowmap.visible=o.helper)}return this}};var Mi=new jt,cc=new jt,Rr=class extends wr(Kt(bw),La){constructor(e=window.innerWidth,r=window.innerHeight,o=45,i,s=1e5){super();this.objectType="CombinedCamera";this._cameraType="OrthographicCamera";this.targetOffset=mo.DefaultTargetOffset;this.isUpVectorFlipped=!1;this.angleOffsetFromUp=0;this.width=e,this.height=r,this.orthoCamera=new vw(e*-.5,e*.5,r*.5,r*-.5,i!=null?i:-5e4,s),this.perspCamera=new Sw(o,e/r,i!=null?i:50,s),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(!0)}static createFromState(e,r){let o=new Rr().fromState(r);return o.enableHelper=!0,o.objectHelper.update(),o.uuid=e,o}get isPerspectiveCamera(){return this.cameraType==="PerspectiveCamera"}get isOrthographicCamera(){return!this.isPerspectiveCamera}get cameraType(){return this._cameraType}setNear(e,r){e==="PerspectiveCamera"?this.perspCamera.near=r:this.orthoCamera.near=r}setZoom(e,r){r>=0&&(e==="PerspectiveCamera"?this.perspCamera.zoom=r:this.orthoCamera.zoom=r)}set cameraType(e){e==="PerspectiveCamera"?this.toPerspective():e==="OrthographicCamera"&&this.toOrthographic()}get near(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.near:this.orthoCamera.near}set near(e){this._cameraType==="PerspectiveCamera"?this.perspCamera.near=e:this.orthoCamera.near=e}get zoom(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom:this.orthoCamera.zoom}set zoom(e){e>=0&&(this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom=e:this.orthoCamera.zoom=e)}lookAt(e){super.lookAt(e),this.getWorldPosition(Mi),this.targetOffset=Mi.distanceTo(e)}getTarget(e=new jt){return this.getWorldDirection(cc),this.getWorldPosition(Mi),cc.multiplyScalar(this.targetOffset),e.copy(Mi).add(cc),e}getDistanceToTarget(){let e=this.getTarget();return this.getWorldPosition(Mi),Mi.distanceTo(e)}updateUp(){let e=this.getWorldQuaternion(new ww),r=new jt(0,0,1).applyQuaternion(e),o=new jt().copy(Yu.DefaultUp);this.isUpVectorFlipped&&o.negate(),o.applyQuaternion(e);let i=new jt().copy(Yu.DefaultUp).projectOnPlane(r),s=new jt().crossVectors(i,o).dot(r)>=0?1:-1;this.angleOffsetFromUp=i.angleTo(o)*s}getViewFrontToObject(e){let r=e.getWorldPosition(new jt),i=e.getWorldDirection(new jt).multiplyScalar(this.targetOffset);return{position:r.clone().add(i),target:r}}getViewToObject(e){let r=e.getWorldPosition(new jt),i=this.getWorldDirection(new jt).multiplyScalar(this.targetOffset);return{position:r.clone().sub(i),target:r}}setViewplaneSize(e,r){this.left=-e*.5,this.right=e*.5,this.top=r*.5,this.bottom=-r*.5,this.aspect=e/r,this.updateProjectionMatrix()}toOrthographic(e){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.enableHelper===!0||e===!0)&&this.objectHelper.update()}toPerspective(e){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.enableHelper===!0||e===!0)&&this.objectHelper.update()}setFocalLength(e){this.perspCamera.setFocalLength(e),this.toPerspective()}getFocalLength(){return this.perspCamera.getFocalLength()}getEffectiveFOV(){return this.perspCamera.getEffectiveFOV()}getFilmWidth(){return this.perspCamera.getFilmWidth()}getFilmHeight(){return this.perspCamera.getFilmHeight()}setViewOffset(e,r,o,i,s,a){this._cameraType==="PerspectiveCamera"?this.perspCamera.setViewOffset(e,r,o,i,s,a):this.orthoCamera.setViewOffset(e,r,o,i,s,a)}clearViewOffset(){this._cameraType==="PerspectiveCamera"?(this.perspCamera.clearViewOffset(),this.toPerspective()):(this.orthoCamera.clearViewOffset(),this.toOrthographic())}updateProjectionMatrix(e){this._cameraType==="PerspectiveCamera"?this.toPerspective(e):this._cameraType==="OrthographicCamera"&&this.toOrthographic(e)}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,r){super.updateWorldMatrix(e,r),this.matrixWorldInverse.copy(this.matrixWorld).invert()}copy(e,r){return super.copy(e,r),this.orthoCamera.copy(e.orthoCamera),this.perspCamera.copy(e.perspCamera),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.far=e.far,this.view=e.view===null?null:Object.assign({},e.view),this._cameraType=e._cameraType,this.aspect=e.aspect,this.fov=e.fov,this.focus=e.focus,this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this.targetOffset=e.targetOffset,this.updateProjectionMatrix(),this}fromCameraRender(e){let r={near:this.orthoCamera.near,far:this.orthoCamera.far},o={near:this.perspCamera.near,far:this.perspCamera.far};return this.copy(e),this.name="",this.enableHelper=!0,this.objectHelper.visible=!0,this.orthoCamera.near=r.near,this.orthoCamera.far=r.far,this.perspCamera.near=o.near,this.perspCamera.far=o.far,this.updateProjectionMatrix(),this}toJSON(e){let r=super.toJSON(e),o=r.object;return o.objectType="CombinedCamera",o.cameraType=this.cameraType,o.targetOffset=this.targetOffset,o.isUpVectorFlipped=this.isUpVectorFlipped,o.angleOffsetFromUp=this.angleOffsetFromUp,o.left=this.left,o.right=this.right,o.top=this.top,o.bottom=this.bottom,this.view!==null&&(o.view=Object.assign({},this.view)),o.zoomOrtho=this.orthoCamera.zoom,o.nearOrtho=this.orthoCamera.near,o.far=this.far,o.aspect=this.aspect,o.fov=this.fov,o.focus=this.focus,o.filmGauge=this.filmGauge,o.filmOffset=this.filmOffset,o.zoomPersp=this.perspCamera.zoom,o.nearPersp=this.perspCamera.near,r}fromJSON(e){var r;if(super.fromJSON(e),this.cameraType=e.cameraType,e.targetOffset!==void 0&&(this.targetOffset=e.targetOffset),e.orbitControlsTarget!==void 0){let o=this.getWorldPosition(new jt),i=new jt().fromArray(e.orbitControlsTarget);this.targetOffset=i.distanceTo(o)}else e.targetOffset!==void 0&&(this.targetOffset=e.targetOffset);return this.isUpVectorFlipped=!1,this.angleOffsetFromUp=(r=e.angleOffsetFromUp)!=null?r:0,e.left!==void 0&&(this.left=e.left),e.right!==void 0&&(this.right=e.right),e.top!==void 0&&(this.top=e.top),e.bottom!==void 0&&(this.bottom=e.bottom),e.view!==void 0&&(this.view=Object.assign({},e.view)),e.zoomOrtho!==void 0&&(this.orthoCamera.zoom=e.zoomOrtho),e.nearOrtho!==void 0&&(this.orthoCamera.near=e.nearOrtho),e.far!==void 0&&(this.far=e.far),e.aspect!==void 0&&(this.aspect=e.aspect),e.fov!==void 0&&(this.fov=e.fov),e.focus!==void 0&&(this.focus=e.focus),e.filmGauge!==void 0&&(this.filmGauge=e.filmGauge),e.filmOffset!==void 0&&(this.filmOffset=e.filmOffset),e.zoomPersp!==void 0&&(this.perspCamera.zoom=e.zoomPersp),e.nearPersp!==void 0&&(this.perspCamera.near=e.nearPersp),this.updateProjectionMatrix(),this}toCameraState(e=[]){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 $o(r,e)}fromCameraState(e){let{orthographic:r,perspective:o}=e;return e.type!==void 0&&(this.cameraType=e.type),e.far!==void 0&&(this.far=e.far),r!==void 0&&(r.near!==void 0&&(this.orthoCamera.near=r.near),r.zoom!==void 0&&(this.orthoCamera.zoom=r.zoom)),o!==void 0&&(o.near!==void 0&&(this.perspCamera.near=o.near),o.fov!==void 0&&(this.perspCamera.fov=o.fov),o.zoom!==void 0&&(this.perspCamera.zoom=o.zoom)),e.up!==void 0&&this.up.fromArray(e.up),e.targetOffset!==void 0&&(this.targetOffset=e.targetOffset),e.isUpVectorFlipped!==void 0&&(this.isUpVectorFlipped=e.isUpVectorFlipped),this.updateProjectionMatrix(),this}toState(e){return H(P(P({},super.toState(e)),this.toCameraState(e)),{type:this.cameraType})}fromState(e){return super.fromState(e),this.fromCameraState(e),this}};import{Group as Lw}from"three";var Fr=class extends wr(Kt(Lw),Ti){constructor(){super(...arguments);this.objectType="EmptyObject"}static createFromState(e,r){let o=new Fr().fromState(r);return o.uuid=e,o.enableHelper=!0,o.objectHelper.update(),o}toJSON(e){let r=super.toJSON(e);return r.object.objectType="EmptyObject",r}};import{DirectionalLight as Cw,CameraHelper as Ta}from"three";var Oi=class extends wr(Kt(Cw),Ci){constructor(...e){super(...e);this.objectType="LightDirectional";this._gizmos={};this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024;let o=this.shadow.camera;o.top=1250,o.bottom=-1250,o.right=1250,o.left=-1250,o.near=1,o.far=2500;let i=new Ta(this.shadow.camera);i.visible=!1,this._gizmos.shadowmap=i,this.update()}static createFromState(e,r,o){let i=new Oi().fromState(r,o);return i.uuid=e,i}get gizmos(){return this._gizmos}showGizmos(){for(let e in this._gizmos){let r=this._gizmos[e];r instanceof Ta&&(r.visible=!0)}}hideGizmos(){for(let e in this._gizmos){let r=this._gizmos[e];r instanceof Ta&&(r.visible=!1)}}update(){this.shadow.camera.updateProjectionMatrix();for(let e in this._gizmos){let r=this._gizmos[e];r instanceof Ta&&r.update()}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.enableHelper===!0&&this.objectHelper.visible===!0&&this.objectHelper.update()}copy(e,r=!0){return super.copy(e,r),this.color.copy(e.color),this.intensity=e.intensity,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){let r=super.toJSON(e),o=r.object;return o.objectType="LightDirectional",o.color=this.color.getHex(),o.intensity=this.intensity,o.shadow=this.shadow.toJSON(),r}fromJSON(e){var i;super.fromJSON(e),this.color.set(e.color),this.intensity=e.intensity,this.shadow.normalBias=(i=e.shadow.normalBias)!=null?i:0,this.shadow.radius=e.shadow.radius,this.shadow.mapSize.fromArray(e.shadow.mapSize);let r=this.shadow.camera,o=e.shadow.camera;return r.near=o.near,r.far=o.far,r.zoom=o.zoom,r.left=o.left,r.right=o.right,r.top=o.top,r.bottom=o.bottom,o.view!==void 0&&(r.view=Object.assign({},o.view)),this}fromDirectionalLightState(e,r){let o=e.depth!==void 0&&e.depth!==this.shadow.camera.far||e.size!==void 0&&e.size/2!==this.shadow.camera.right;return super.fromLightState(e,r),e.size!==void 0&&Ou(this,e.size),o&&this.update(),this}fromState(e,r){return super.fromState(e),this.fromDirectionalLightState(e,r),this}};import{PointLight as Tw,Vector3 as Na,Box3 as Nw,Box3Helper as Ma,Color as Mw}from"three";var Pi=class extends wr(Kt(Tw),Ni){constructor(...e){super(...e);this.objectType="LightPoint";this._gizmos={};this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024;let o=this.shadow.camera;o.fov=90,o.aspect=1,o.near=100,o.far=2500;let i=new Na(-o.far+this.position.x,-o.far+this.position.y,-o.far+this.position.z),s=new Na(o.far+this.position.x,o.far+this.position.y,o.far+this.position.z),a=new Nw(i,s),l=new Ma(a,new Mw(16755200));l.visible=!1,this._gizmos.shadowmap=l,this.update()}static createFromState(e,r,o){let i=new Pi().fromState(r,o);return i.uuid=e,i}get gizmos(){return this._gizmos}showGizmos(){for(let e in this._gizmos){let r=this._gizmos[e];r instanceof Ma&&(r.visible=!0)}}hideGizmos(){for(let e in this._gizmos){let r=this._gizmos[e];r instanceof Ma&&(r.visible=!1)}}update(){if(this.shadow&&(this.shadow.camera.updateProjectionMatrix(),this._gizmos))for(let e in this._gizmos){let r=this._gizmos[e];if(r instanceof Ma){let o=this.shadow.camera,i=new Na(-o.far+this.position.x,-o.far+this.position.y,-o.far+this.position.z),s=new Na(o.far+this.position.x,o.far+this.position.y,o.far+this.position.z);r.box.set(i,s),r.updateMatrixWorld(!0)}}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.enableHelper===!0&&this.objectHelper.visible===!0&&this.objectHelper.update()}copy(e,r=!0){return super.copy(e,r),this.color.copy(e.color),this.intensity=e.intensity,this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}toJSON(e){let r=super.toJSON(e),o=r.object;return o.objectType="LightPoint",o.color=this.color.getHex(),o.intensity=this.intensity,o.distance=this.distance,o.decay=this.decay,o.shadow=this.shadow.toJSON(),r}fromJSON(e){var i,s;super.fromJSON(e),this.color.set(e.color),this.intensity=e.intensity,this.distance=e.distance,this.decay=e.decay,this.shadow.normalBias=(i=e.shadow.normalBias)!=null?i:0,this.shadow.radius=e.shadow.radius,this.shadow.mapSize.fromArray((s=e.shadow.mapSize)!=null?s:[512,512]),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null);let r=this.shadow.camera,o=e.shadow.camera;return r.near=o.near,r.far=o.far,r.zoom=o.zoom,r.fov=o.fov,r.focus=o.focus,r.aspect=o.aspect,r.filmGauge=o.filmGauge,r.filmOffset=o.filmOffset,o.view!==void 0&&(r.view=Object.assign({},o.view)),this}fromPointLightState(e,r){return super.fromLightState(e,r),e.distance!==void 0&&(this.distance=e.distance),e.decay!==void 0&&(this.decay=e.decay),e.shadowRadius!==void 0&&(this.shadow.radius=e.shadowRadius),e.shadowResolution!==void 0&&(this.shadow.mapSize.set(e.shadowResolution,e.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null)),this}fromState(e,r){return super.fromState(e),this.fromPointLightState(e,r),this}};import{SpotLight as Ow,CameraHelper as Oa,MathUtils as Pw,Vector3 as em,Quaternion as Iw}from"three";var Xu=new em,Zu=new em,Qu=new Iw,Ii=class extends wr(Kt(Ow),Pn){constructor(...e){super(...e);this.objectType="LightSpot";this._gizmos={};this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024;let o=this.shadow.camera;o.fov=Pw.RAD2DEG*2*this.angle,o.aspect=1,o.near=100,o.far=2500;let i=new Oa(this.shadow.camera);i.visible=!1,this._gizmos.shadowmap=i,this.update()}static createFromState(e,r,o){let i=new Ii().fromState(r,o);return i.uuid=e,i}get gizmos(){return this._gizmos}showGizmos(){for(let e in this._gizmos){let r=this._gizmos[e];r instanceof Oa&&(r.visible=!0)}}hideGizmos(){for(let e in this._gizmos){let r=this._gizmos[e];r instanceof Oa&&(r.visible=!1)}}update(){this.shadow.camera.updateProjectionMatrix();for(let e in this._gizmos){let r=this._gizmos[e];r instanceof Oa&&r.update()}}updateMatrixWorld(e){super.updateMatrixWorld(e),Zu.setFromMatrixPosition(this.matrixWorld),Qu.setFromRotationMatrix(this.matrixWorld),Xu.copy(this.up).applyQuaternion(Qu).negate().multiplyScalar(this.distance),this.target.position.copy(Zu).add(Xu),this.target.updateMatrixWorld(),this.enableHelper===!0&&this.objectHelper.visible===!0&&this.objectHelper.update()}copy(e,r=!0){return super.copy(e,r),this.color.copy(e.color),this.intensity=e.intensity,this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){let r=super.toJSON(e),o=r.object;return o.objectType="LightSpot",o.color=this.color.getHex(),o.intensity=this.intensity,o.distance=this.distance,o.angle=this.angle,o.decay=this.decay,o.penumbra=this.penumbra,o.shadow=this.shadow.toJSON(),r}fromJSON(e){var i;super.fromJSON(e),this.color.set(e.color),this.intensity=e.intensity,this.distance=e.distance,this.angle=e.angle,this.decay=e.decay,this.penumbra=e.penumbra,this.shadow.normalBias=(i=e.shadow.normalBias)!=null?i:0,this.shadow.radius=e.shadow.radius,this.shadow.mapSize.fromArray(e.shadow.mapSize);let r=this.shadow.camera,o=e.shadow.camera;return r.near=o.near,r.far=o.far,r.zoom=o.zoom,r.fov=o.fov,r.focus=o.focus,r.aspect=o.aspect,r.filmGauge=o.filmGauge,r.filmOffset=o.filmOffset,o.view!==void 0&&(r.view=Object.assign({},o.view)),this}fromSpotLightState(e,r){return super.fromLightState(e,r),e.distance!==void 0&&(this.distance=e.distance),e.decay!==void 0&&(this.decay=e.decay),e.angle!==void 0&&(this.angle=e.angle),e.penumbra!==void 0&&(this.penumbra=e.penumbra),this}fromState(e,r){return super.fromState(e),this.fromSpotLightState(e,r),this}};var Ai=class extends rt{constructor(e,r=new Ot){super(e,r);this.objectType="Mesh3D";this.castShadow=!0,this.receiveShadow=!0}toJSON(e){let r=super.toJSON(e);return r.object.objectType="Mesh3D",r}};var Di=class extends Ai{constructor(e,r=new Ot){super(e,r);this.objectType="NonParametric"}toJSON(e){let r=super.toJSON(e);return r.object.objectType="NonParametric",r}};import{DoubleSide as Aw,Mesh as Dw,MeshBasicMaterial as Bw,ShapeBufferGeometry as Ew,Vector2 as _w,Vector3 as Gw}from"three";import{FontLoader as zw}from"three/examples/jsm/loaders/FontLoader.js";var Ze=class extends Dw{constructor({char:e,originalChar:r,fontFamily:o,letterSpacing:i,fontSize:s,LOD:a=16},l=new Bw({color:0,opacity:1,visible:!0,transparent:!0,side:Aw})){let c=Ze.loadChar(e,o,a);super(c.geometry,l);this.char=e,this.originalChar=r!=null?r:e,this.fontFamily=o,this.letterSpacing=i,this.fontSize=s,this.LOD=a,this.resolution=c.resolution,this.glyphsHa=c.glyphsHa,this.localPosition=new _w,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 Ze._fontPath}static set FONTS_PATH(e){Ze._fontPath=e}updatePosition(e,r){this.localPosition.copy(e);let o=new Gw(this.localPosition.x,-this.localPosition.y,0);this.position.copy(o).add(r)}updateFontSize(e){let r=e/this.resolution;this.fontSize=e,this.scale.set(this.fontSize,this.fontSize,1),this.charSize=this.glyphsHa*r*this.letterSpacing}updateFontFamily(e){if(this.fontFamily===e)return;this.fontFamily=e;let r=Ze.loadChar(this.char,e,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(e){if(this.char===e)return;this.char=e;let r=Ze.loadChar(e,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(e){this.letterSpacing!==e&&(this.letterSpacing=e,this.updateFontSize(this.fontSize))}updateLOD(e){if(this.LOD===e)return;this.LOD=e;let r=Ze.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 e={char:this.char,originalChar:this.originalChar,fontFamily:this.fontFamily,letterSpacing:this.letterSpacing,fontSize:this.fontSize,LOD:this.LOD};return new Ze(e).copy(this)}static loadFont(e){return new Promise(function(r,o){Ze.fontCache[e]?r(Ze.fontCache[e]):new zw().load(Ze.FONTS_PATH+e+".json",s=>{Ze.fontCache[e]=s,r(s)},void 0,o)})}static loadChar(e,r,o){if(Ze.charCache[e]){if(Ze.charCache[e][o]&&Ze.charCache[e][o].fontFamily===r)return Ze.charCache[e][o]}else Ze.charCache[e]={};let i=Ze.fontCache[r],s=i.generateShapes(e,1);return Ze.charCache[e][o]={geometry:new Ew(s,o),fontFamily:r,resolution:i.data.resolution,glyphsHa:i.data.glyphs[e].ha},Ze.charCache[e][o]}},Pt=Ze;Pt.charCache={},Pt.fontCache={},Pt._fontPath="/_assets/_fonts/";import{DoubleSide as Ia,MeshBasicMaterial as rm,Vector3 as om,Object3D as Rw}from"three";import{Vector2 as tm}from"three";var Pa=new tm,io=class{constructor(t,e,r){this.message=[];this.endLine=!0;this.yLinePos=t,this.lineHeight=e,this.maxCharSize=r,this.nextChar3DPos=new tm(0,this.yLinePos+this.maxCharSize*this.lineHeight),this.align=1}addChar3D(t,e,r=this.message.length){this.message.splice(r,0,t),t.fontSize>this.maxCharSize?(this.maxCharSize=t.fontSize,this.nextChar3DPos.y=this.yLinePos+this.maxCharSize*this.lineHeight,this.fullUpdate(e)):(t.updatePosition(this.nextChar3DPos,e),this.nextChar3DPos.x+=t.charSize)}deleteChar3D(t=this.message.length-1){let e=this.message[t];if(e)return this.message.splice(t,1),this.nextChar3DPos.x-=e.charSize,e}isEndLine(t){this.endLine=t}fullUpdate(t,e=0){this.nextChar3DPos.x=0;for(let r=e,o=this.message.length;r<o;r+=1)this.message[r].updatePosition(this.nextChar3DPos,t),this.nextChar3DPos.x+=this.message[r].charSize}checkOverFlow(t){let e,r=this.message.length-1;if(r<=0)return!1;for(;r>=0;){if(this.message[r].char!==" "){e=this.message[r];break}r-=1}return!!(r>=0&&e&&e.localPosition.x+e.charSize>t)}containSpaceOverFlow(t=this.message.length-1){for(let e=t;e>=0;e-=1)if(this.message[e].char===" ")return!0;return!1}containSpace(t=this.message.length-1){if(this.endLine)return!0;for(let e=t;e>=0;e-=1)if(this.message[e].char===" ")return!0;return!1}popWord(t=this.message.length-1){let e=[],r=!0,o;for(o=t;o>=0;o-=1)if(this.message[o].char===" "){r=!1,e.length===0&&(o-=1,e.splice(0,0,this.message[o]));break}else e.splice(0,0,this.message[o]);return r?e=[]:this.message.splice(o+1,e.length),e}getWord(t=0,e=1){let r=[],o=t;for(o=t;;o+=e){if(!this.message[o]||this.message[o].char===" "){r.length===0&&this.message[o]&&(r.push(this.message[o]),this.message.splice(o,1));break}e>0?(r.push(this.message[o]),this.message.splice(o,1),o-=e):(r.splice(0,0,this.message[o]),this.message.splice(o,1))}return r}getWordAtIndex(t){let e=[];for(let r=t;r<this.message.length&&this.message[r].char!==" ";r++)e.push(this.message[r]);for(let r=t-1;r>=0&&this.message[r].char!==" ";r--)e.splice(0,0,this.message[r]);return e}wordSize(t=0,e=-1){let r=0,o=t;for(;o>=0&&o<this.message.length;){if(this.message[o].char===" "){r===0&&(r=this.message[o].charSize);break}r+=this.message[o].charSize,o+=e}return(o<0||o>=this.message.length)&&!this.endLine?this.message[t]?this.message[t].charSize:999999999:r===0?999999999:r}spaceLeft(t){return t-this.nextChar3DPos.x}popChar(t=this.message.length-1){return this.nextChar3DPos.x-=this.message[t].charSize,this.message.splice(t,1)}isEmpty(){return!this.message.length}updateNextCharPosY(){this.nextChar3DPos.y=this.yLinePos+this.maxCharSize*this.lineHeight}updateYLinePos(t){this.yLinePos=t,this.updateNextCharPosY()}updatelineHeight(t){this.lineHeight=t,this.updateNextCharPosY()}updateFontSize(t,e=0,r=this.message.length-1){for(let o=e;o<=r;o+=1)this.message[o].updateFontSize(t);this.maxCharSize=t,this.nextChar3DPos.y=this.yLinePos+this.maxCharSize*this.lineHeight}countSpaces(){let t=0;for(let e=0;e<this.message.length;e++)this.message[e].char===" "&&(t+=1);return t}alignText(t,e,r,o,i){switch(r){case 1:this.leftAlign(t,i);break;case 3:this.centerAlign(this.spaceLeft(e),t,i);break;case 2:this.rightAlign(this.spaceLeft(e),t,i);break;case 4:this.justifyAlign(this.spaceLeft(e),t,i);break}}offsetCharacters(t,e,r){Pa.set(e,r);let o=this.message.length;for(let i=0;i<o;i++)this.message[i].updatePosition(this.message[i].localPosition.add(Pa),t)}leftAlign(t,e){this.align=1,this.offsetCharacters(t,0,e)}centerAlign(t,e,r){this.align=3,this.offsetCharacters(e,t/2,r)}rightAlign(t,e,r){this.align=2,this.offsetCharacters(e,t,r)}justifyAlign(t,e,r){if(this.align=4,this.endLine){this.offsetCharacters(e,0,r);return}let o=this.countSpaces();if(o===0){this.offsetCharacters(e,0,r);return}let i=t/o,s=0;for(let a=0;a<this.message.length;a++)this.message[a].char===" "&&(s+=i),Pa.set(s,r),this.message[a].updatePosition(this.message[a].localPosition.add(Pa),e)}clone(){let t=new io(this.yLinePos,this.lineHeight,this.maxCharSize);t.nextChar3DPos=this.nextChar3DPos.clone(),t.align=this.align,t.endLine=this.endLine;for(let e=0;e<this.message.length;e++)t.message.push(this.message[e].clone());return t}};var hc=class extends rt{constructor(e,r=new mt({transparent:!0,opacity:1,visible:!1,side:Ia})){super(e,r);this.objectType="TextFrame";this.charContainer=new Rw,this.add(this.charContainer),this.material.visible=!1,this._geometryUserData=e.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 om(this._geometryUserData.parameters.width*-.5,this._geometryUserData.parameters.height*.5,0),textLines:[]},this.createTextLine()}static createFromState(e,r,o){let i=Qs.create({parameters:{width:r.width,height:r.height}}),s=new hc(i).fromState(r,o);return s.uuid=e,s}async updateText(e){this.clearText();let r=this.userData.textFrame,o=r.fontFamily;await Pt.loadFont(o),r.text=e;let i=r.textOrigin,s=new rm({visible:r.visible,transparent:!0,side:Ia}),a=e.split(`
|
|
942
942
|
`),l=0;this.userData.textFrame.textLines=a.map((c,h)=>{let p=new io(l,r.lineHeight,r.fontSize);return p.message=c.split("").map(d=>{let u={char:d,fontFamily:o,letterSpacing:r.letterSpacing,fontSize:r.fontSize,LOD:16},f=s.clone();f.color=r.hexColor,f.opacity=r.opacity;let g=new Pt(u,f);return p.addChar3D(g,i),this.charContainer.add(g),g}),l+=p.maxCharSize*p.lineHeight,p}),this.textFullUpdate(),this.checkOverFlow()}clearText(){let e=this.userData.textFrame.textLines;for(;this.charContainer.children.length;){let r=this.charContainer.children[0];this.charContainer.remove(r)}for(;e.length;)e.pop()}raycast(e,r){let o=[];if(super.raycast(e,o),o.length>0){r.push(o[0]);return}let i=[];for(let s=0,a=this.charContainer.children.length;s<a;++s)if(this.charContainer.children[s]instanceof Pt&&(e.intersectObject(this.charContainer.children[s],!1,i),i.length>0)){i[0].object=this,r.push(i[0]);return}}updateGeometry(e){var h,p,d,u;let r=this.userData,o=this.geometry.userData,i=o.parameters.width,s=o.parameters.height,a=(p=(h=e.parameters)==null?void 0:h.width)!=null?p:i,l=(u=(d=e.parameters)==null?void 0:d.height)!=null?u:s,c=r.textFrame;super.updateGeometry(e),c.maxLineSize=a,c.textOrigin.set(-.5*a,.5*l,0),l!==s?(this.checkOverFlow(),this.checkCapacity()):a!==i&&(i<a?this.checkCapacity():i>a&&this.checkOverFlow())}checkOverFlow(e=0){let r=this.userData,o=r.textFrame.textOrigin,i=r.textFrame.textLines;for(let s=e;s<i.length;s++){i[s].updateYLinePos(this.getNewLinePosition(s)),i[s].fullUpdate(o);let a=[];for(;i[s].checkOverFlow(r.textFrame.maxLineSize);)i[s].containSpaceOverFlow()?a.unshift(i[s].getWord(i[s].message.length-1,-1)):a.unshift(i[s].popChar());if(a.length>0){i[s+1]===void 0?(i[s].isEndLine(!1),this.createTextLine()):i[s].endLine&&(this.createTextLine(s+1),i[s].isEndLine(!1),i[s+1].isEndLine(!0));let l=0;for(let c=0;c<a.length;c+=1)for(let h=0;h<a[c].length;h+=1)i[s+1].addChar3D(a[c][h],o,l),l+=1;i[s+1].fullUpdate(o)}i[s].fullUpdate(o)}this.textFullUpdate(e)}checkCapacity(e=0){let r=this.userData,o=r.textFrame.textOrigin,i=r.textFrame.maxLineSize,s=r.textFrame.textLines;for(let a=e;a<s.length;a+=1)if(s[a].updateYLinePos(this.getNewLinePosition(a)),s[a].fullUpdate(o),!!s[a-1])for(;!s[a-1].endLine;){let l,c=s[a-1].spaceLeft(i);if(s[a].wordSize(0,1)<=c){s[a].containSpace()?l=s[a].getWord(0,1):l=s[a].popChar(0);for(let h=0;h<l.length;h+=1)l[h]&&s[a-1].addChar3D(l[h],o)}else{s[a].isEmpty()?(s[a].endLine&&s[a-1].isEndLine(!0),s.splice(a,1),a-=1):(s[a].updateYLinePos(this.getNewLinePosition(a)),s[a].fullUpdate(o));break}}this.textFullUpdate(e)}createTextLine(e=this.userData.textFrame.textLines.length){let o=this.userData.textFrame;o.textLines.splice(e,0,new io(this.getNewLinePosition(e),o.lineHeight,o.fontSize))}textFullUpdate(e=0){let o=this.userData.textFrame,i=o.textLines,s=this.getVerticalAlignmentOffSet();for(let a=e;a<i.length;a++)i[a].updateYLinePos(this.getNewLinePosition(a)),i[a].fullUpdate(o.textOrigin),i[a].alignText(o.textOrigin,o.maxLineSize,o.horizontalAlignment,o.verticalAlignment,s)}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(e){let o=this.userData.textFrame.textLines,i=0;for(let s=0;s<e;s+=1)i+=o[s].maxCharSize*o[s].lineHeight;return i}updateColor(e){var i;let r=this.userData;r.textFrame.hexColor=e;let o=r.textFrame.textLines;for(let s=0;s<o.length;s++){let a=o[s].message;for(let l=0;l<a.length;l++){let c=a[l].material;(i=c.color)!=null&&i.isColor&&(c.color=e)}}}updateOpacity(e){let r=this.userData;r.textFrame.opacity=e;let o=r.textFrame.textLines;for(let i=0;i<o.length;i++){let s=o[i].message;for(let a=0;a<s.length;a++){let l=s[a].material;l.opacity=e}}}updateVisible(e){let r=this.userData;r.textFrame.visible=e;let o=r.textFrame.textLines;for(let i=0;i<o.length;i++){let s=o[i].message;for(let a=0;a<s.length;a++){let l=s[a].material;l.visible=e}}}async updateFontFamily(e){await Pt.loadFont(e);let o=this.userData.textFrame,i=o.textLines;o.fontFamily=e;for(let s=0;s<i.length;s++){let a=i[s].message;for(let l=0;l<a.length;l++)a[l].updateFontFamily(e)}this.textFullUpdate(),this.checkOverFlow(),this.checkCapacity()}updateFontSize(e){let o=this.userData.textFrame,i=o.textLines,s=o.fontSize;o.fontSize=e;for(let a=0;a<i.length;a++)i[a].updateFontSize(e);this.textFullUpdate(),e>s?this.checkOverFlow():e<s&&this.checkCapacity()}async updateTextTransform(e){let o=this.userData.textFrame;await Pt.loadFont(o.fontFamily);let i=o.textLines;switch(o.textTransform=e,e){case 2:for(let s=0;s<i.length;s++){let a=i[s].message;for(let l=0;l<a.length;l++)i[s].message[l].updateChar(a[l].char.toUpperCase())}break;case 3:for(let s=0;s<i.length;s++){let a=i[s].message;for(let l=0;l<a.length;l++)i[s].message[l].updateChar(a[l].char.toLowerCase())}break;default:for(let s=0;s<i.length;s++){let a=i[s].message;for(let l=0;l<a.length;l++)i[s].message[l].updateChar(a[l].originalChar)}}this.textFullUpdate(),this.checkOverFlow(),this.checkCapacity()}updateLetterSpacing(e){let r=this.userData,o=r.textFrame.textLines;r.textFrame.letterSpacing=e;for(let i=0;i<o.length;i++){let s=o[i].message;for(let a=0;a<s.length;a++)s[a].updateLetterSpacing(e)}this.textFullUpdate(),this.checkOverFlow(),this.checkCapacity()}updateLOD(e){let r=this.userData;r.textFrame.LOD=e;let o=r.textFrame.textLines;for(let i=0;i<o.length;i++);this.textFullUpdate(),this.checkOverFlow(),this.checkCapacity()}updateLineHeight(e){let r=this.userData,o=r.textFrame.textLines;r.textFrame.lineHeight=e;for(let i=0;i<o.length;i++)o[i].updatelineHeight(e);this.textFullUpdate()}updateVerticalAlignment(e){let r=this.userData;r.textFrame.verticalAlignment=e,this.textFullUpdate()}updateHorizontalAlignment(e){let r=this.userData;r.textFrame.horizontalAlignment=e,this.textFullUpdate()}toJSON(e){let r=super.toJSON(e),o=r.object;o.objectType="TextFrame";let s=this.userData.textFrame.textLines.map(a=>{let l=a.message.map(c=>({char:c.char,originalChar:c.originalChar,fontFamily:c.fontFamily,letterSpacing:c.letterSpacing,fontSize:c.fontSize,LOD:c.LOD}));return{align:a.align,endLine:a.endLine,lineHeight:a.lineHeight,maxCharSize:a.maxCharSize,yLinePos:a.yLinePos,message:l}});return o.userData.textFrame.textLinesData=s,r}async fromJSONasync(e){if(super.fromJSON(e),e.userData!==void 0){let r=e.userData.textFrame;await Pt.loadFont(r.fontFamily),r.textOrigin=new om(r.textOrigin.x,r.textOrigin.y,r.textOrigin.z);let o=new rm({color:r.hexColor,opacity:r.opacity,visible:r.visible,transparent:!0,side:Ia});r.textLinesData&&(r.textLines=r.textLinesData.map((i,s)=>{let a=new io(Number(i.yLinePos),Number(i.lineHeight),Number(i.maxCharSize)),l=i.message.map((c,h)=>{if(c.char===void 0){let u=r.textLines[s].message[h];if("geometries"in u){let f=u.geometries[0].userData.parameters;Object.assign(c,{LOD:f.lod,char:f.char,fontFamily:f.fontFamily,fontSize:f.fontSize,letterSpacing:f.letterSpacing,originalChar:f.char})}}let p={char:c.char,fontFamily:c.fontFamily,letterSpacing:Number(c.letterSpacing),fontSize:Number(c.fontSize),LOD:c.LOD},d=new Pt(p,o.clone());return a.addChar3D(d,r.textOrigin),this.charContainer.add(d),d});return a.message=l,a}),this.userData.textFrame=r),this.textFullUpdate()}return this}fromTextFrameData(e,r){if(e.color!==void 0){let o=Xe(e.color,r);this.updateColor(o),this.updateOpacity(o.a)}e.alpha!==void 0&&this.updateOpacity(e.alpha),e.font!==void 0&&this.updateFontFamily(e.font),e.horizontalAlign!==void 0&&this.updateHorizontalAlignment(e.horizontalAlign),e.verticalAlign!==void 0&&this.updateVerticalAlignment(e.verticalAlign),e.textTransform!==void 0&&this.updateTextTransform(e.textTransform),e.fontSize!==void 0&&this.updateFontSize(e.fontSize),e.lineHeight!==void 0&&this.updateLineHeight(e.lineHeight),e.letterSpacing!==void 0&&this.updateLetterSpacing(e.letterSpacing),e.text!==void 0&&e.text!==""&&this.updateText(e.text),(e.width!==void 0||e.height!==void 0)&&this.updateGeometry({parameters:{width:e.width,height:e.height}})}fromState(e,r){return super.fromState(e),this.fromTextFrameData(e,r),this}convertToVector(){let{fontFamily:e,hexColor:r}=this.userData.textFrame,o=new Fr;o.name="Text Shape";let i=Pt.fontCache[e];for(let s of this.charContainer.children)s instanceof Pt&&i.generateShapes(s.char,1).forEach(a=>{let l=new Oe().fromShape(a);l.applyScale(s.scale.x,s.scale.y);let c=dt.create({shape:l}),h=new mt({side:Ia});h.color=r;let p=new oo(c,h);p.name=s.char,p.position.copy(s.position),p.rotation.copy(s.rotation),o.attach(p)});return o}},No=hc;No.VerticalAlign=nl,No.HorizontalAlign=il,No.TextTransform=sl;import{HemisphereLight as Zw,Scene as Qw,Vector3 as e1,Color as ym,Fog as t1,Box3 as r1}from"three";import{Box3 as Fw,Matrix4 as Mo,Sphere as sm,Vector3 as Vw}from"three";var lm=zm(nm());var pc;ea.then(n=>{pc=n});var cm=new Mo,jw=new Mo,Uw=new Mo,ar=new Fw,no=new Vw,kw=new Mo,Hw=new Mo,Bi=class extends rt{constructor(e,r,o,i=new Ot){super(o!=null?o:r,i);this.subdivPointer=e;this.originalGeometry=r;this.subdividedGeometry=o;this.objectType="SubdivObject";this.hiddenMatrixOld=new Mo;this.smoothShading=!0;this.matrixWorldRigid=new Mo;this.castShadow=!0,this.receiveShadow=!0,this.forceComputeSize=!1}static createFromState(e,r,o){let{subdivPointer:i,originalGeometry:s,subdividedGeometry:a}=nr.build(r.geometry,void 0,!r.flatShading),l=Cn(r.material,o),c=new Bi(i,s,a||void 0,l);return c.calcBoundingBox(),c.freeSubdivPointer(),c.uuid=e,c.fromState(r),c}shallowClone(e){return new Di(this.geometry,this.material).shallowCopy(this,e)}toJSON(e){let r=super.toJSON(e);return r.object.objectType="SubdivObject",r}buildFromStore(e){var s,a,l;let{originalGeometry:r,subdividedGeometry:o,subdivPointer:i}=nr.build(e,this.subdivPointer,this.smoothShading,this.shearScale);if(this.subdivPointer=i,r!==void 0&&((s=this.originalGeometry)==null||s.dispose(),this.originalGeometry=r),o!==void 0&&((a=this.subdividedGeometry)==null||a.dispose(),this.subdividedGeometry=o!=null?o:void 0),this.geometry=(l=this.subdividedGeometry)!=null?l:this.originalGeometry,this.cloner)for(let c of this.cloner.children)c.geometry=this.geometry;e.width&&(this.geometry.userData.parameters={width:e.width,height:e.height,depth:e.depth})}updateMesh(e=!1){nr.buildLevel(this.subdivPointer,!0,this.smoothShading,this.originalGeometry,e?this.shearScaleInv:void 0),this.subdividedGeometry&&nr.buildLevel(this.subdivPointer,!1,this.smoothShading,this.subdividedGeometry,e?this.shearScaleInv:void 0)}updateTopology(){var e;this.originalGeometry.dispose(),this.originalGeometry=nr.buildLevel(this.subdivPointer,!0,this.smoothShading),this.subdividedGeometry&&(this.subdividedGeometry.dispose(),this.subdividedGeometry=nr.buildLevel(this.subdivPointer,!1,this.smoothShading)),this.geometry=(e=this.subdividedGeometry)!=null?e:this.originalGeometry}raycast(e,r){var o;this.geometry=this.originalGeometry,rt.prototype.raycast.call(this,e,r),this.geometry=(o=this.subdividedGeometry)!=null?o:this.originalGeometry}updateMatrixWorldSVD(){let e=this.matrixWorld.elements,r=[[e[0],e[4],e[8]],[e[1],e[5],e[9]],[e[2],e[6],e[10]]],{u:o,v:i,q:s}=(0,lm.SVD)(r),a=cm.set(o[0][0],o[0][1],o[0][2],0,o[1][0],o[1][1],o[1][2],0,o[2][0],o[2][1],o[2][2],0,0,0,0,1),l=jw.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),c=Uw.copy(l).transpose();this.shearScale=kw.makeScale(s[0],s[1],s[2]).multiply(c).premultiply(l),this.shearScaleInv=Hw.copy(this.shearScale).invert(),this.matrixWorldRigid.multiplyMatrices(a,c),s.every(h=>Math.abs(s[0]-h)<.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 e=this.originalGeometry;e.boundingSphere===null&&(e.boundingSphere=new sm);let r=e.attributes.position,o=e.boundingSphere.center;ar.setFromBufferAttribute(r),ar.getCenter(o),e.boundingSphere.radius=o.distanceTo(ar.max),isNaN(e.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),ar.getSize(no);let i={width:no.x,height:no.y,depth:no.z};return this.geometry.userData.parameters=i,i}updateBoundingBox(e){let r=this.originalGeometry;ar.min.set(e[0],e[2],e[4]),ar.max.set(e[1],e[3],e[5]),this.shearScaleInv&&(ar.min.applyMatrix4(this.shearScaleInv),ar.max.applyMatrix4(this.shearScaleInv)),r.boundingSphere===null&&(r.boundingSphere=new sm);let o=r.boundingSphere.center;ar.getCenter(o),r.boundingSphere.radius=o.distanceTo(ar.max),isNaN(r.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),ar.getSize(no);let i={width:no.x,height:no.y,depth:no.z};return this.geometry.userData.parameters=i,i}freeSubdivPointer(){this.subdivPointer&&(pc.free_bvh(this.subdivPointer),pc.free_subdivision_surface(this.subdivPointer),this.subdivPointer=0)}updateGeometry(e){this.geometry.userData.scale||(this.geometry.userData.scale=Array(3)),this.geometry.userData.scale[0]=this.geometry.userData.parameters.width===0?1:e.parameters.width/this.geometry.userData.parameters.width,this.geometry.userData.scale[1]=this.geometry.userData.parameters.height===0?1:e.parameters.height/this.geometry.userData.parameters.height,this.geometry.userData.scale[2]=this.geometry.userData.parameters.depth===0?1:e.parameters.depth/this.geometry.userData.parameters.depth,am(this.originalGeometry.attributes,...this.geometry.userData.scale),this.originalGeometry.attributes.position.needsUpdate=!0,this.originalGeometry.attributes.normal.needsUpdate=!0,this.subdividedGeometry&&(am(this.subdividedGeometry.attributes,...this.subdividedGeometry.userData.scale),this.subdividedGeometry.attributes.position.needsUpdate=!0,this.subdividedGeometry.attributes.normal.needsUpdate=!0),this.geometry.userData.parameters=P({},e.parameters)}};function am(n,t,e,r){let o=n.position.array,i=n.normal.array,s=cm.makeScale(t,e,r).invert().elements,a,l,c;for(var h=0,p=o.length;h<p;h+=3)o[h]*=t,o[h+1]*=e,o[h+2]*=r,a=i[h],l=i[h+1],c=i[h+2],i[h]=s[0]*a+s[4]*l+s[8]*c,i[h+1]=s[1]*a+s[5]*l+s[9]*c,i[h+2]=s[2]*a+s[6]*l+s[10]*c}import{BackSide as qw,BufferGeometry as Ww,DoubleSide as $w,FrontSide as Jw}from"three";function hm(n,t){t.flatShading!==void 0&&(n.flatShading=t.flatShading,n.needsUpdate=!0),t.wireframe!==void 0&&(n.wireframe=t.wireframe),t.side!==void 0&&(t.side===0?n.side=Jw:t.side===1?n.side=qw:n.side=$w)}function Kw(n,t){if(Array.isArray(n.material))for(let e of n.material)hm(e,t);else{let e=n.material;hm(e,t)}n.objectType==="SubdivObject"&&t.flatShading!==void 0&&(n.material.flatShading=!1,n.smoothShading=!t.flatShading,n.updateMesh())}function pm(n,t,e){let r;if(t.geometry.type==="SubdivGeometry")r=Bi.createFromState(n,t,e);else{let o=t.geometry.type==="BooleanGeometry"?new Ww:ga(t.geometry,e),i="materials"in t?Cu(t.materials,e):Cn(t.material,e);zs.is2DParametricMesh(o.userData.type)?r=new Li(o,i):(o==null?void 0:o.userData.type)==="VectorGeometry"?r=new oo(o,i):t.geometry.type==="NonParametricGeometry"?r=new Di(o,i):t.geometry.type==="BooleanGeometry"?(r=new va(void 0,i),r.booleanOp=t.geometry.operation):r=new Ai(o,i),r.uuid=n,r.fromState(t)}return Kw(r,t),r}function dm(n,t,e){return t.type==="Mesh"?pm(n,t,e):t.type==="TextFrame"?No.createFromState(n,t,e):t.type==="Empty"?Fr.createFromState(n,t):t.type==="PointLight"?Pi.createFromState(n,t,e):t.type==="SpotLight"?Ii.createFromState(n,t,e):t.type==="DirectionalLight"?Oi.createFromState(n,t,e):Jo.is(t.type)?Rr.createFromState(n,t):(console.error(t),new Fr)}function Yw(n,t){t.uniforms[`f${t.id}_transmissionSamplerMap`].value=n.texture,t.uniforms[`f${t.id}_transmissionDepthMap`].value=n.depthTexture}function um(n,t,e){if(!e.userData.layers)return!1;let r=!1,o=e.userData.layers.getLayersOfType("transmission");return o.length>0?(t.layers.set(3),r=!0,n!==void 0&&o.forEach(i=>Yw(n,i))):t.layers.set(0),r}function mm(n,t){let e=!1;return t.traverseEntity(r=>{if(r instanceof rt)if(Array.isArray(r.material))for(let o=0;o<r.material.length;o++)um(n,r,r.material[o])&&(e=!0);else um(n,r,r.material)&&(e=!0)}),e}function fm(n,t){"material"in n&&Xw(n.material,t),"geometry"in n&&n.geometry.dispose()}function Xw(n,t){bc(n).forEach(e=>{t.isSharedMaterial(e)||e.dispose()})}var gm=new e1,dc=class extends ya(Qw){constructor(e,r){super();this.objectType="Scene";this.alpha=1;this.backupFog=new t1(16777215,.1,2e3);this.fogUseBGColor=!1;this.wireframeState=!1;this.needsTransmissionDirty=!0;this._needsTransmission=!1;this._color=new ym(1,0,0);this.bgColor=new ym(1,1,1);this.entityByUuid={};this.ambientLight=new Zw(13882323,8553090,.75),this.ambientLight.name="Default Ambient Light",this.personalCamera=this.createPersonalCamera(),this.activeCamera=this.personalCamera,this.sharedAssetManager=r,this.init(e,r)}needsTransmission(e){return this.needsTransmissionDirty&&(this._needsTransmission=mm(e,this),e!==void 0&&(this.needsTransmissionDirty=!1)),this._needsTransmission}find(e){if(e===""||e===void 0)return;let r=this.entityByUuid[e];return r===void 0?this.getObjectByProperty("uuid",e):r}get color(){return this._color}set color(e){this.fogUseBGColor===!0&&this.backupFog.color.copy(e),this._color.copy(e)}get enableFog(){return this.fog!==null}set enableFog(e){this.fog=e===!0?this.backupFog:null}init(e,r){if(this.createChildrenObjects(e.objects,this,r),this.personalCamera.removeFromParent(),this.add(this.personalCamera),this.ambientLight.removeFromParent(),this.add(this.ambientLight),this.setBackgroundColor(Xe(e.backgroundColor,r)),this.updateFog(e.fog,r),this.updateAmbientLight(e.environment.ambientLight,r),this.activeCamera=this.personalCamera,e.publish.playCamera!==null){let o=this.find(e.publish.playCamera);o instanceof Rr&&this.switchActiveCamera(o)}}clearScene(e){this.traverseEntity(r=>{fm(r,e)});for(let r of this.children)Jt(r)&&r.removeFromParent()}resetAfterClear(e,r){this.init(e,r)}createPersonalCamera(){let e=Rr.createFromState(dc.PERSONAL_CAMERA_ID,H(P({},Fs.defaultData),{name:"Personal Camera"}));return e.enableHelper=!1,e.objectHelper.visible=!1,delete e.isEntity,this.registerObjectCreatedInLegacy(e),e}raycast(e){let r=[],o=i=>{for(let s of i.children)Jt(s)&&!s.raycastLock&&s.visible&&((br(s)||Gr(s)&&s.enableHelper&&s.objectHelper.parent)&&e.intersectObject(s,!1,r),o(s))};return o(this),r}traverseEntity(e){for(let r of this.children)Jt(r)&&r.traverseEntity(e)}updateFog(e,r){this.enableFog=e.enabled,this.fogUseBGColor=e.useBackgroundColor,e.useBackgroundColor?this.backupFog.color.set(this.bgColor):this.backupFog.color=Xe(e.color,r),this.backupFog.near=e.near,this.backupFog.far=e.far}toJSON(e){return{}}fromJSON(e){return this}dispose(){this.clearScene(this.sharedAssetManager),this.sharedAssetManager.dispose()}updateAmbientLight(e,r){Mu(this.ambientLight,e,r),e.groundColor!==void 0&&(this.ambientLight.groundColor=Xe(e.groundColor,r)),e.enabled!==void 0&&(this.ambientLight.visible=e.enabled)}switchActiveCamera(e){this.activeCamera!==this.personalCamera&&(this.activeCamera.enableHelper=!0),this.activeCamera=e,e.enableHelper=!1}setBackgroundColor(e){this.bgColor=e,this.alpha=e.a}createChildrenObjects(e,r,o){for(let i of e)this.createChildObject(i.id,i.data,i.children,r,o)}registerObjectCreatedInLegacy(e){this.entityByUuid[e.uuid]=e}unregisterObject(e){delete this.entityByUuid[e.uuid];for(let r of e.children)this.unregisterObject(r)}createChildObject(e,r,o,i,s){let a=dm(e,r,s);return a&&(this.entityByUuid[e]=a,i.add(a),_r(i)&&br(a)&&(a.prevBooleanObjectParent=i),this.createChildrenObjects(o,a,s)),a}getCenter(e){let r=[];for(let i=0,s=e.length;i<s;++i){let{id:a,recursive:l}=e[i],c=this.find(a),h=l?c.recursiveBBox:c.singleBBox;r.push(...h.vertices)}let o=new r1;return o.setFromPoints(r),o.getCenter(gm),gm}copyMatrixWorld(e,r){if(e===null){r.identity();return}let o=this.find(e);o?r.copy(o.matrixWorld):r.identity()}copyParentMatrixWorld(e,r){var i;if(e===null){r.identity();return}let o=(i=this.find(e))==null?void 0:i.parent;o?r.copy(o.matrixWorld):r.identity()}traverseMaterial(e){this.traverseEntity(r=>{if(r instanceof rt)if(Array.isArray(r.material))for(let o=0;o<r.material.length;o++)e(r.material[o]);else e(r.material)})}updateCanvasSize(e,r){this.activeCamera.setViewplaneSize(e,r);let o,i;e>=r?(o=r/e,i=1):(o=1,i=e/r),this.traverseMaterial(s=>{s.layersList.getLayersOfType("transmission").forEach(l=>{l.uniforms[`f${l.id}_aspectRatio`].value.x=o,l.uniforms[`f${l.id}_aspectRatio`].value.y=i})})}},In=dc;In.PERSONAL_CAMERA_ID="f23858d0-4a3b-4bd8-8173-66ed0af7f6fb-personalCamera";import{DRACOLoader as o1}from"three/examples/jsm/loaders/DRACOLoader.js";var so;function i1(){return so||(so=new o1,so.setDecoderPath("https://www.gstatic.com/draco/versioned/decoders/1.5.2/").preload()),so.decoderPending}async function n1(n){if(so){let t={attributeIDs:so.defaultAttributeIDs,attributeTypes:so.defaultAttributeTypes,useUniqueIDs:!1},e;try{e=await so.decodeGeometry(new Int8Array(n).buffer,t)}catch(r){console.error(r)}if(e)return{index:e.index?{array:e.index.array}:void 0,attributes:Object.entries(e.attributes).map(([r,o])=>({name:r,itemSize:o.itemSize,array:o.array}))}}return null}async function xm(n){let[t,e]=Ua(Ds.deserialize(new Uint8Array(n))),r=[];t.scene.objects.traverse((o,i)=>{i.type==="Mesh"&&i.geometry.type==="NonParametricGeometry"&&i.geometry.data.draco!==void 0&&r.push(i)}),r.length&&await i1();for(let o of r){let i=await n1(Ha(o.geometry.data.draco));if(i){i.index&&(o.geometry.data.index={array:i.index.array,itemSize:1,normalized:!1,type:"Uint32Array"});let s={};i.attributes.forEach(({name:a,array:l,itemSize:c})=>{s[a]={array:l,itemSize:c,type:"Float32Array",normalized:!1}}),o.geometry.data.attributes=s,o.geometry.data.draco=void 0}}return e.result().data}import{WebGLRenderTarget as s1,LinearMipmapLinearFilter as a1,LinearFilter as l1,ClampToEdgeWrapping as bm,DepthTexture as c1}from"three";var vm=new mt,Da=class extends Dt{},Ba=class{constructor(t){this.materials={};this.images={};this.colors={};this.transmissionRenderTarget=new s1(2048,2048,{generateMipmaps:!0,minFilter:a1,magFilter:l1,wrapS:bm,wrapT:bm}),this.transmissionRenderTarget.depthTexture=new c1(2048,2048),this.reset(t)}reset(t){for(let[e,r]of Object.entries(t.images))this.addImage(e,r.data);for(let[e,r]of Object.entries(t.colors))this.addColor(e,r);for(let[e,r]of Object.entries(t.materials))this.addMaterial(e,Jl(r,this))}get transmissionSamplerMap(){return this.transmissionRenderTarget.texture}get transmissionDepthMap(){return this.transmissionRenderTarget.depthTexture}addMaterial(t,e){e.uuid=t,this.materials[t]=e}deleteMaterial(t){this.materials[t]&&(this.materials[t].dispose(),delete this.materials[t])}isSharedMaterial(t){return t.uuid in this.materials||t===vm}getMaterial(t){let e=this.materials[t];return e}getMaterialOrDeletedPlaceholder(t){var e;return(e=this.materials[t])!=null?e:vm}getMaterials(){return this.materials}addImage(t,e){if(this.images[t])return this.images[t].onload=()=>{this.onImageLoad&&this.onImageLoad(t)},this.images[t].src=e,!0;{let r=new Image;return r.src=e,r.onload=()=>{this.onImageLoad&&this.onImageLoad(t)},this.images[t]=r,!1}}deleteImage(t){this.images[t]&&delete this.images[t]}getDefaultImage(){return this.images.image_0}getImage(t){return this.images[t]}getImages(){return this.images}addColor(t,e){return this.colors[t]?("a"in e?this.colors[t].setRGBA(e.r,e.g,e.b,e.a):this.colors[t].setRGBA(e.r,e.g,e.b,1),!0):("a"in e?this.colors[t]=new Da(e.r,e.g,e.b,e.a):this.colors[t]=new Da(e.r,e.g,e.b,1),!1)}updateColor(t,e){var r,o,i,s;if(this.colors[t]){let a=this.colors[t];return this.colors[t].r=(r=e.r)!=null?r:a.r,this.colors[t].g=(o=e.g)!=null?o:a.g,this.colors[t].b=(i=e.b)!=null?i:a.b,this.colors[t].a=(s=e.a)!=null?s:a.a,!0}return!1}deleteColor(t){this.colors[t]&&delete this.colors[t]}getColor(t){return this.colors[t]}dispose(){Object.keys(this.materials).forEach(e=>this.deleteMaterial(e)),this.transmissionRenderTarget.depthTexture.dispose(),this.transmissionRenderTarget.dispose(),this.onImageLoad=void 0}};import{Mesh as V4}from"three";import{mergeBufferGeometries as k4}from"three/examples/jsm/utils/BufferGeometryUtils.js";function Sm(n){let t;if(!!n.index)for(let e=0;e<n.index.array.length;e+=3)t=n.index.array[e],n.index.array[e]=n.index.array[e+2],n.index.array[e+2]=t}import{Color as wm,ShaderLib as h1}from"three";function Lm(n){let t=new Set;return n.traverse(e=>{if(br(e))if(et(e.material))e.material.forEach(r=>{let o=r;t.has(o)||t.add(o)});else{let r=e.material;t.has(r)||t.add(r)}}),t.forEach(e=>{if(e instanceof Array)return;let r=e.onBeforeCompile.bind(e);p1(e)?(Object.assign(e,{isMeshStandardMaterial:!0,isMeshPhysicalMaterial:!0,transmission:1,attenuationColor:new wm,specularColor:new wm}),e.onBeforeCompile=(o,i)=>{r&&r(o,i),o.uniforms=Object.assign(h1.physical.uniforms,o.uniforms),e.userData.layers.getLayersOfType("transmission").forEach(s=>{o.uniforms.transmissionSamplerMap.value&&(s.uniforms["f"+s.id+"_transmissionSamplerMap"].value=o.uniforms.transmissionSamplerMap.value,s.uniforms["f"+s.id+"_transmissionSamplerSize"].value=o.uniforms.transmissionSamplerSize.value)})}):d1(e)||(e.onBeforeCompile=(o,i)=>{r&&r(o,i),e.transparent=!1})}),n}function p1(n){return n.userData.layers.getLayersOfType("transmission").length>0}function d1(n){let t=n.userData.layers.head,e=0;for(;t!==void 0;){if(t.type!=="light"&&t.type!=="fresnel"){let r=t.uniforms["f"+t.id+"_alpha"];r&&(e+=(1-e)*r.value)}t=t.next}return e<1}function Cm(n){return n.traverse(t=>{if(t.type==="Camera"){let e=t;e.type=e.cameraType}}),n}function Tm(n){let t=[],e=(r,o=0)=>{let i=o>0?r+o:r;return t.includes(i)?e(r,o+1):i};return n.traverse(r=>{if(t.includes(r.name)){let o=r.name,i=e(r.name);if(r.name=i,r.isMesh){let s=r;s.material instanceof Array?s.material.forEach(a=>{a.name=a.name.replace(o,i)}):s.material.isAsset||(s.material.name=s.material.name.replace(o,i))}}t.push(r.name)}),n}import{mergeBufferGeometries as u1}from"three/examples/jsm/utils/BufferGeometryUtils";function Nm(n){let t=[];return n.traverse(e=>{e instanceof Co&&t.push(e)}),t.forEach(e=>{let r=e.object,o=e.children,i=o.map(a=>{a.updateMatrix();let l=a.geometry.clone().applyMatrix4(a.matrix);return a.matrix.determinant()<0&&Sm(l),l}),s=u1(e.parameters.hideBase?i:[r.geometry,...i]);r.geometry=s,r.material=o[0].material,r.remove(e)}),n}var Mm="The SplineLoader only accepts .splinecode files that are generated from Spline export panel.",uc=class extends f1{load(t,e,r,o=console.error){let i=new m1(this.manager);i.setPath(this.path),i.setResponseType("arraybuffer"),i.setRequestHeader(this.requestHeader),i.setWithCredentials(this.withCredentials),t.endsWith(".spline")?console.warn(Mm+" The .spline files are only meant to be used by the Editor."):t.endsWith(".splinecode")||console.warn(Mm),i.load(t,async s=>{try{if(typeof s=="string")throw new Error("The .spline file is not binary!");let a=await this.parse(s);e(a)}catch(a){o(a)}},r,o)}async parse(t){let e=await xm(t),r=new Ba(e.shared);Object.values(r.getMaterials()).forEach(s=>Object.assign(s,{isAsset:!0}));let o=new In(e.scene,r);o.remove(o.personalCamera),e.scene.environment.ambientLight.enabled||o.remove(o.ambientLight);let i=e.scene.publish.playCamera;if(i){let s=o.find(i);s&&Nu(s)&&Object.assign(s,{makeDefault:!0})}return o=Nm(o),o=Lm(o),o=Cm(o),o=Tm(o),o}};export{uc as default};
|