@splinetool/runtime 0.9.65 → 0.9.66
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/README.md +15 -15
- package/build/runtime.cjs +2 -2
- package/build/runtime.js +2 -2
- package/package.json +1 -1
- package/runtime.d.ts +6 -6
package/build/runtime.cjs
CHANGED
|
@@ -4488,7 +4488,7 @@ float vogelShadow(int index, sampler2D shadowMap, vec2 uv, float texelSize, floa
|
|
|
4488
4488
|
}
|
|
4489
4489
|
|
|
4490
4490
|
#endif
|
|
4491
|
-
`,gR=$e.lights_fragment_begin,yR=$e.shadowmask_pars_fragment,dy=!1,vR=n=>{switch(n){case"low":return 8;case"medium":return 16;case"high":return 32;default:return 16}},py=(n="medium")=>{if(!dy){dy=!0;let e=vR(n);$e.shadowmap_pars_fragment=mR(e);let t=gR.slice();t=t.replace("getShadow( spotShadowMap[ i ]",`getShadow( UNROLLED_LOOP_INDEX + ${3}, spotShadowMap[ i ]`),t=t.replace("getShadow( directionalShadowMap[ i ]","getShadow( UNROLLED_LOOP_INDEX, directionalShadowMap[ i ]"),$e.lights_fragment_begin=t;let r=yR.slice();r=r.replaceAll("getShadow(","getShadow( UNROLLED_LOOP_INDEX, "),$e.shadowmask_pars_fragment=r}},d1=n=>{dy=!1,py(n)};var Do=n=>"isEntity"in n,zt=n=>"isAbstractMesh"in n,xt=n=>n!==null&&n.isBooleanMesh,p1=n=>n.objectType==="CombinedCamera",m1=n=>Do(n)&&(n.objectType==="LightDirectional"||n.objectType==="LightSpot"||n.objectType==="LightPoint");var Xi=n=>"objectHelper"in n;function my(n,e){let t=!1;e.position&&(n.position.fromArray(e.position),t=!0),e.rotation&&(n.rotation.fromArray(e.rotation),t=!0),e.scale&&(t=!0,n.scale.fromArray(e.scale)),e.hiddenMatrix!==void 0&&"hiddenMatrix"in n&&(t=!0,n.hiddenMatrix.fromArray(e.hiddenMatrix??hi.identity)),t&&(n.updateMatrix(),xt(n.parent)&&zt(n)&&n.invalidateDownstreamBooleanData(!0).recomputeBoolean()),e.position&&e.rotation&&e.scale&&e.hiddenMatrix!==void 0&&n.updateWorldMatrix(!1,!0),n.objectType==="CombinedCamera"&&(e.isUpVectorFlipped!==void 0&&(n.isUpVectorFlipped=e.isUpVectorFlipped),n.updateUp())}function xR(n,e){my(n,e),e.name!==void 0&&(n.name=e.name),e.visible!==void 0&&(n.isEntity?n.visibility=e.visible:n.visible=e.visible)}function g1(n,e,t){xR(n,e),e.color!==void 0&&(n.color=Zt(e.color,t)),e.intensity!==void 0&&(n.intensity=e.intensity),e.shadows!==void 0&&!(n instanceof po)&&(n.castShadow=e.shadows),n.shadow&&!(n instanceof po)&&e.depth!==void 0&&(n.shadow.camera.far=e.depth,n.shadow.needsUpdate=!0),e.helper!==void 0&&Xi(n)&&(n.enableHelper=e.helper,n.gizmos.shadowmap.visible=e.helper)}function y1(n,e){n.shadow.camera.right=e/2,n.shadow.camera.left=-e/2,n.shadow.camera.top=e/2,n.shadow.camera.bottom=-e/2,n.shadow.needsUpdate=!0}var bl=new yr,bi=new A,wi=new A,wl=new Be,x1=[new A(-1,1,1),new A(-1,-1,1),new A(1,-1,1),new A(1,1,1),new A(-1,1,-1),new A(-1,-1,-1),new A(1,-1,-1),new A(1,1,-1)],bR=[[0,3],[1,2],[5,6],[4,7],[0,1],[3,2],[7,6],[4,5],[0,4],[1,5],[2,6],[3,7]],wR=[[0,2],[7,5],[4,1],[3,6],[4,3],[1,6]];function SR(n,e,t=0,r=e.count){let i=1/0,s=1/0,o=1/0,a=-1/0,l=-1/0,c=-1/0;for(let h=t;h<r;h++){let u=e.getX(h),f=e.getY(h),d=e.getZ(h);u<i&&(i=u),f<s&&(s=f),d<o&&(o=d),u>a&&(a=u),f>l&&(l=f),d>c&&(c=d)}return n.min.set(i,s,o),n.max.set(a,l,c),n}var v1=(n,e,t,r)=>{if(zt(n)){let i=n.geometry.userData.parameters,s=n.geometry.getAttribute("position");n.geometry.userData.type==="SubdivGeometry"?bi.copy(n.originalGeometry.boundingSphere.center):s!==void 0&&(SR(bl,s,n.geometry.drawRange.start,n.geometry.drawRange.count<1/0?n.geometry.drawRange.count:s.count),bl.getCenter(bi)),n.forceComputeSize?bl.getSize(wi).multiplyScalar(.5):wi.set(i.width,i.height,i.depth??0).multiplyScalar(.5)}else if(Xi(n)&&r===!0){let i=n.geometryHelper.getAttribute("position");bl.setFromArray(i.array),bl.getCenter(bi),bl.getSize(wi).multiplyScalar(.5)}else bi.setScalar(0),wi.setScalar(0);wl.copy(e).multiply(n.matrixWorld),wi.x===0&&wi.y===0&&wi.z===0?t.push(new A(bi.x,bi.y,bi.z).applyMatrix4(wl)):x1.forEach(i=>{t.push(i.clone().multiply(wi).add(bi).applyMatrix4(wl))})},xh=class extends yr{constructor(){super(...arguments);this.matrix=new Be;this.vertices=[];this.faces=[];this.edges=[];this.centerEdges=[]}copy(t){return super.copy(t),this.matrix.copy(t.matrix),this.vertices=t.vertices.map(r=>r.clone()),this.faces=t.faces.map(r=>r.clone()),this.edges=t.edges.map(r=>r.clone()),this.centerEdges=t.centerEdges.map(r=>r.clone()),this}setFromObjectSize(t,r=!1){t.updateWorldMatrix(!1,r),this.makeEmpty(),this.matrix.copy(t.matrixWorld);let i=new Be().copy(t.matrixWorld).invert();return this.expandByObjectSize(t,i,r)}expandByObjectSize(t,r,i=!1){let s=[];return i===!0?t.traverseEntity(o=>{o.visible&&v1(o,r,s,t.enableHelper===!0)}):v1(t,r,s,t.enableHelper===!0),this.setFromPoints(s)}getCenter(t){return t=super.getCenter(t),t.applyMatrix4(this.matrix),t}getPositionToCenter(t){return t=super.getCenter(t),t.applyMatrix4(wl.copy(this.matrix).setPosition(0,0,0)),t}computeVertices(){this.getSize(wi).multiplyScalar(.5),this.getCenter(bi),wl.copy(this.matrix).setPosition(bi),this.vertices=x1.map(t=>t.clone().multiply(wi).applyMatrix4(wl))}computeEdges(){this.vertices.length>0&&this.computeVertices(),this.edges=bR.map(([t,r])=>new Cu(this.vertices[t],this.vertices[r])),this.centerEdges=this.edges.map(t=>t.getCenter(new A))}computeFaces(){this.vertices.length>0&&this.computeVertices(),this.faces=wR.map(([t,r])=>this.vertices[t].clone().add(this.vertices[r]).multiplyScalar(.5))}};function bh(n){let e=[];for(let t in n){let r=n[t];delete r.metadata,e.push(r)}return e}function AR(n){let e=[];for(let t in n)e.push(n[t]);return e}var Md=n=>class extends n{hasEntityChild(){return this.children.some(t=>Do(t))}isDescendantOf(t){t instanceof lt&&(t=t.uuid);let r=this;for(;r.parent;){if(r.parent.uuid===t)return!0;r=r.parent}return!1}attach(t,r){this.updateWorldMatrix(!0,!1);let i=new Be().copy(this.matrixWorld).invert();return t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),i.multiply(t.parent.matrixWorld)),Do(t)?t.hiddenMatrix.premultiply(i):t.applyMatrix4(i),t.updateWorldMatrix(!1,!1),this.add(t),r!==void 0&&(this.children.pop(),this.children.splice(r,0,t)),this}copy(t,r=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),r===!0)for(let i=0;i<t.children.length;i++){let s=t.children[i];this.add(s.clone())}return this}toJSON(t){let r=t===void 0,i={object:{uuid:"",objectType:""}};t===void 0&&(t={geometries:{},materials:{},textures:{},images:{},interactionStates:{},nodes:{}},i.metadata={version:1.5,type:"Object",generator:"Object3D.toJSON"});let s={uuid:this.uuid,objectType:this.type};if(this.name!==""&&(s.name=this.name),s.matrix=this.matrix.toArray(),this.castShadow===!0&&(s.castShadow=!0),this.receiveShadow===!0&&(s.receiveShadow=!0),this.visible===!1&&(s.visible=!1),this.frustumCulled===!1&&(s.frustumCulled=!1),this.renderOrder!==0&&(s.renderOrder=this.renderOrder),s.layers=this.layers.mask,JSON.stringify(this.userData)!=="{}"&&(s.userData=this.userData),this.children.length>0){s.children=[];for(let o of this.children)(Do(o)||o instanceof bs)&&s.children.push(o.toJSON(t).object)}if(r){let o=bh(t.geometries),a=bh(t.materials),l=bh(t.textures),c=bh(t.images),h=bh(t.interactionStates),u=AR(t.nodes);o.length>0&&(i.geometries=o),a.length>0&&(i.materials=a),l.length>0&&(i.textures=l),c.length>0&&(i.images=c),h.length>0&&(i.interactionStates=h),u.length>0&&(i.nodes=u)}return i.object=s,i}fromJSON(t){return this.uuid=t.uuid,t.name!==void 0&&(this.name=t.name),t.matrix!==void 0?(this.matrix.fromArray(t.matrix),t.matrixAutoUpdate!==void 0&&(this.matrixAutoUpdate=t.matrixAutoUpdate),this.matrixAutoUpdate&&this.matrix.decompose(this.position,this.quaternion,this.scale)):(t.position!==void 0&&this.position.fromArray(t.position),t.rotation!==void 0&&this.rotation.fromArray(t.rotation),t.quaternion!==void 0&&this.quaternion.fromArray(t.quaternion),t.scale!==void 0&&this.scale.fromArray(t.scale)),this.castShadow=t.castShadow!==void 0,this.receiveShadow=t.receiveShadow!==void 0,t.visible!==void 0&&(this.visible=t.visible),t.frustumCulled!==void 0&&(this.frustumCulled=t.frustumCulled),t.renderOrder!==void 0&&(this.renderOrder=t.renderOrder),t.layers!==void 0&&(this.layers.mask=t.layers),t.userData!==void 0&&(this.userData=t.userData),this}};var En=n=>"isEntity"in n,b1=n=>"isAbstractMesh"in n,Cn=n=>class extends Md(n){constructor(){super(...arguments);this.objectType="";this.isEntity=!0;this.raycastLock=!1;this.scaleLock=!1;this.hiddenMatrix=new Be;this._singleBBox=new xh;this._recursiveBBox=new xh;this.singleBBoxNeedsUpdate=!0;this.recursiveBBoxNeedsUpdate=!0;this.forceComputeSize=!1}set visibility(r){this.visible=r;for(let i of this.children)En(i)&&i.traverseEntity(s=>{Xi(s)&&s.visible&&(s.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=>{En(r)&&(r.singleBBoxNeedsUpdate=!0,r.recursiveBBoxNeedsUpdate=!0)}),this.traverseEntity(r=>{r.singleBBoxNeedsUpdate=!0,r.recursiveBBoxNeedsUpdate=!0})}traverseEntity(r){r(this);for(let i of this.children)En(i)&&i.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 i of this.children)i.updateMatrixWorld(r)}updateWorldMatrix(r,i){let s=this.parent;if(r&&s!==null&&s.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)),i)for(let o of this.children)o.updateWorldMatrix(!1,!0)}shallowClone(r){return new this.constructor().shallowCopy(this,r)}shallowCopy(r,i=!0){if(super.copy(r,!1),this.raycastLock=r.raycastLock,this.scaleLock=r.scaleLock,this.hiddenMatrix.copy(r.hiddenMatrix),i===!0)for(let s of r.children)En(s)&&this.add(s.shallowClone());return this}clone(r){return new this.constructor().copy(this,r)}copy(r,i=!0){if(super.copy(r,!1),this.raycastLock=r.raycastLock,this.scaleLock=r.scaleLock,this.hiddenMatrix.copy(r.hiddenMatrix),i===!0)for(let s of r.children)En(s)&&this.add(s.clone());return this}keepChildrenMatrixWorld(){let r=new Be,i=this.matrixWorld.clone();this.updateWorldMatrix(!1,!1),r.copy(this.matrixWorld).invert(),r.multiply(i);for(let s of this.children)En(s)&&s.hiddenMatrix.premultiply(r)}toJSON(r){let i=super.toJSON(r),s=i.object;return this.raycastLock===!0&&(s.raycastLock=!0),this.scaleLock===!0&&(s.scaleLock=!0),s.hiddenMatrix=this.hiddenMatrix.toArray(),i}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 i=r.children;return r.children=[],Object.assign(r,{raycastLock:!1,scaleLock:!1,hiddenMatrix:new Be}),this.copy(r),r.children=i,this}toObjectTransformState(r=[]){this.updateWorldMatrix(!0,!1);let i={position:this.position.toArray(),rotation:[this.rotation.x,this.rotation.y,this.rotation.z],scale:this.scale.toArray(),hiddenMatrix:this.hiddenMatrix.toArray()};return ja(i,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 i={name:this.name,visible:this.visible,raycastLock:this.raycastLock,...this.toObjectTransformState(r)};return ja(i,r)}fromState(r,i){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}};var wh=class extends lt{constructor(t,r={}){super();this.object=t;let i=t.recursiveBBox.getSize(new A),s=.1;this.parameters=Af.defaultData(i.toArray(),s),bo(this.parameters,r),this.update(),this.setHideBase(this.parameters.hideBase)}refreshMaterial(){if("material"in this.object)for(let t of this.children)t.material=this.object.material}setHideBase(t){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(t){let r=this.object.material.map(i=>i.clone());for(let i of this.children)i.material=r}else for(let r of this.children)r.material=this.object.material}for(let r of this.object.material)r.visible=!t}else{if(this.children.length>0)if(this.object.material.visible=!0,t){let r=this.object.material.clone();for(let i of this.children)i.material=r}else for(let r of this.children)r.material=this.object.material;this.object.material.visible=!t}this.parameters.hideBase=t}}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(t=>t.updateMatrix())}_updateCount(){let t=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!==t)if(this.children.length<t)for(let r=0,i=t-this.children.length;r<i;++r){let s=this.object.shallowClone(!1);s.visible=!0,this.add(s),this.parameters.hideBase&&this.setHideBase(!0)}else for(let r=0,i=this.children.length-t;r<i;++r)this.remove(this.children[0])}_updateRadial(t){let r=t.radial,i=r.start*je.DEG2RAD,s=r.end*je.DEG2RAD,o=i-s,a=new bn(r.rotation[0]*je.DEG2RAD,r.rotation[1]*je.DEG2RAD,r.rotation[2]*je.DEG2RAD),l;switch(r.axis){case"z":l=new A(0,0,1);break;case"y":l=new A(0,1,0);break;default:case"x":l=new A(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 u=o/t.count*c-i;switch(r.axis){case"x":h.rotation.set(0,u,0);break;case"y":h.rotation.set(0,0,u);break;case"z":h.rotation.set(u,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(t){if(t.type!=="linear")throw new Error;let r=t.linear,i=new bn(r.rotation[0]*je.DEG2RAD,r.rotation[1]*je.DEG2RAD,r.rotation[2]*je.DEG2RAD);for(let[s,o]of this.children.entries())o.hiddenMatrix.identity(),o.scale.x=1+(r.scale[0]-1)*s,o.scale.y=1+(r.scale[1]-1)*s,o.scale.z=1+(r.scale[2]-1)*s,o.rotation.x=i.x*s,o.rotation.y=i.y*s,o.rotation.z=i.z*s,o.position.x=r.position[0]*s,o.position.y=r.position[1]*s,o.position.z=r.position[2]*s}_updateGrid(t){let r=0,i=t.grid;if(i.useCenter===!0){let s={x:i.count[0]%2===0?2:1,y:i.count[1]%2===0?2:1,z:i.count[2]%2===0?2:1},o=new A(i.size[0]*(i.count[0]-s.x)*.5,i.size[1]*(i.count[1]-s.y)*.5,i.size[2]*(i.count[2]-s.z)*.5);for(let a=0;a<i.count[0];a++)for(let l=0;l<i.count[1];l++)for(let c=0;c<i.count[2];c++){let h=this.children[r++];h.hiddenMatrix.identity(),h.scale.setScalar(1),h.rotation.set(0,0,0),h.position.x=i.size[0]*a-o.x,h.position.y=i.size[1]*l-o.y,h.position.z=i.size[2]*c-o.z}}else for(let s=0;s<i.count[0];s++)for(let o=0;o<i.count[1];o++)for(let a=0;a<i.count[2];a++){let l=this.children[r++];l.hiddenMatrix.identity(),l.scale.setScalar(1),l.rotation.set(0,0,0),l.position.x=i.size[0]*s,l.position.y=-i.size[1]*o,l.position.z=-i.size[2]*a}}fromJSON(t){return this}toJSON(){return{}}fromClonerState(t){return t.hideBase!==void 0&&this.setHideBase(t.hideBase),bo(this.parameters,t),this.update(),this}};var Ct=class extends Cn(ir){constructor(t,r){super(t,r);this.isAbstractMesh=!0;this.isBooleanMesh=!1;this.booleanMeshSetAddress=-1;this.booleanWasTransformed=!1;this.booleanMatrixInvOld=new Be;this.booleanExclude=null;Array.isArray(r)&&(this.selectedMaterial=0,t.groups.length===0&&t.addGroup(0,t.getAttribute("position").count,0))}get cloner(){return this._cloner}set cloner(t){this._cloner&&this.remove(this._cloner),t&&this.add(t),this._cloner=t}getSelectedMaterial(t){return Array.isArray(this.material)?(this.selectedMaterial===void 0&&(this.selectedMaterial=t??0),this.material[t??this.selectedMaterial]):this.material}setSelectedMaterial(t,r){Array.isArray(this.material)?(this.selectedMaterial===void 0&&(this.selectedMaterial=r??0),r=r??this.selectedMaterial,this.material[r].dispose(),this.material[r]=t):(this.material.dispose(),this.material=t)}updateGeometry(t){let r=this.geometry,i=gy[r.userData.type],s=this.objectType==="NonParametric"?Object.assign({},r.userData,{geometry:r}):r.userData,o=i.build(i.normalizeInputs(t,s)),a=r.uuid;if(this.geometry.dispose(),this.geometry=o,this.geometry.uuid=a,this.geometry.computeBoundingSphere(),this.cloner)for(let l of this.cloner.children)l.geometry=this.geometry}resizeGeometry(t,r,i){ad.resizeGeometry(this.geometry,{width:t,height:r,depth:i})}shallowClone(t){return new this.constructor(this.geometry,this.material).shallowCopy(this,t)}clone(t){let r=this.objectType==="NonParametric"?Object.assign({},this.geometry.userData,{geometry:this.geometry.clone()}):this.geometry.userData,i=Sh(r),s=Array.isArray(this.material)?this.material.map(o=>o.clone()):this.material.clone();return new this.constructor(i,s).copy(this,t)}copy(t,r=!0){return super.copy(t,r),t.cloner&&(this.cloner=new wh(t,t.cloner.parameters),this.add(this.cloner)),this}setFromClonerState(t){t===null?this.cloner=void 0:(this.cloner===void 0&&(this.cloner=new wh(this)),this.cloner.fromClonerState(t))}fromState(t,r){return super.fromState(t),t.type==="Mesh"&&(this.setFromClonerState(t.cloner),this.castShadow=t.castShadow??!0,this.receiveShadow=t.receiveShadow??!0,this.booleanExclude=t.booleanExclude??null),this}freeBooleanPointer(){this.booleanMeshSetAddress!==-1&&(Qn.freeMeshSet(this.booleanMeshSetAddress),this.booleanMeshSetAddress=-1)}invalidateDownstreamBooleanData(t=!1){return t?this.booleanWasTransformed=!0:this.freeBooleanPointer(),xt(this.parent)?this.parent.invalidateDownstreamBooleanData():this}invalidateUpstreamBooleanData(){this.freeBooleanPointer();for(let t of this.children)zt(t)&&(t.freeBooleanPointer(),xt(t)&&t.invalidateUpstreamBooleanData())}};var MR=new A(0,0,1),w1=new A,S1=new A,A1=new Ht,ks=class extends Ct{constructor(t=Er.create({}),r=new Ir({side:Wt})){super(t,r);this.recursiveSelection=!1;this.objectType="VectorObject";this.eventDispatcher=new Ot;this._onShapeUpdate=()=>{this.updateGeometry({}),this.geometry.computeBoundingSphere(),this.geometry.computeBoundingBox()};this.castShadow=!0,this.receiveShadow=!0,this.forceComputeSize=!0,this.shape=t.userData.shape,this.shape.eventDispatcher?.addEventListener("update",this._onShapeUpdate)}toJSON(t){let r=super.toJSON(t);return r.object.objectType="VectorObject",r}fromState(t){return super.fromState(t),this.shape.update(),this}setHelperVisibility(){}updateGeometry(t){if(super.updateGeometry(t),"userData"in this.geometry){let r=this.geometry.userData.parameters;this.eventDispatcher.dispatchEvent({type:"geometryUpdate",parameters:r})}}setShape(t){this.shape&&this.shape.eventDispatcher?.removeEventListener("update",this._onShapeUpdate),this.shape=t,this.shape.eventDispatcher?.addEventListener("update",this._onShapeUpdate)}updateWorldMatrix(t,r){super.updateWorldMatrix(t,r),A1.getNormalMatrix(this.matrixWorld),w1.copy(MR).applyMatrix3(A1).normalize(),S1.setFromMatrixPosition(this.matrixWorld),this.shape.plane.setFromNormalAndCoplanarPoint(w1,S1)}clone(t){let r=this.shape.clone(),i=this.material.clone(),s=this.geometry.userData,o=Er.create(Object.assign({},s,{shape:r})),a=new ks(o,i).copy(this,t);return a.shape=r,r.update(),a}raycast(t,r){Ct.prototype.raycast.call(this,t,r)}};function _d(n,e){return _R(n)}function _R(n){let e={parameters:n,type:n.type};if(n.type==="VectorGeometry"){let r=dt.createFromState(n.shape,n.width,n.height);e.shape=r}else n.type==="NonParametricGeometry"&&(n.data.groups&&n.data.groups.forEach(r=>r.materialIndex=Math.max(r.materialIndex??0,0)),e.geometry=new ws().parse(n));let t;try{t=Sh(e)}catch(r){console.error(r)}if(!t){let r=dt.createFromState(Ka.defaultData(),100,100);e.shape=r,t=Sh(e)}return t}var We;ld.then(n=>{We=n});var M1=new Float32Array([10,10,0,-10,10,0,-10,-10,0,10,-10,0]),_1=new Uint32Array([0,1,2,3]),T1=new Uint8Array([4]),Dn=class{static build(n,e,t,r,i){let s,o,a,l=n?.phongAngle??e?.phongAngle??35;if(r===!1&&(l=-1),n.positionWASM!==void 0){t&&t!==0&&(We.free_bvh(t),We.free_subdivision_surface(t));try{s=Dn.allocate(n,i)}catch(c){console.error(c,n),s=Dn.allocate({positionWASM:M1,indexWASM:_1,verticesPerFaceWASM:T1},i)}We.set_destination_refinement_level(s,0),o=Dn.buildLevel(s,!0,l)}else s=t,n.phongAngle!==void 0&&(o=Dn.buildLevel(s,!0,l));return n.subdivisions!==void 0&&(We.set_destination_refinement_level(s,n.subdivisions),n.subdivisions>0?a=Dn.buildLevel(s,!1,l):a=null),{subdivPointer:s,originalGeometry:o,subdividedGeometry:a}}static primitiveToQuads(n,e){n.widthSegments>16&&(n.widthSegments=16),n.heightSegments>16&&(n.heightSegments=16),n.depthSegments>16&&(n.depthSegments=16),n.radialSegments>16&&(n.radialSegments=16),n.type==="DodecahedronGeometry"&&(n.detail=0);let t=n.shape!==void 0?e.geometry:_d(n),r,i,s,o;return{positions:r,triIndices:o}=by(t.getAttribute("position"),t.getIndex()),{indices:i,verticesPerFace:s}=wy(r,o,t),{positions:r,indices:i,verticesPerFace:s}}static allocate(n,e){let t,r,i,s=[],o=[];n.positionWASM&&n.positionWASM.length>0?(t=n.positionWASM,r=n.indexWASM,i=n.verticesPerFaceWASM):(t=M1,r=_1,i=T1);let a=t.length,l=r.length,c=i.length,h=t.length+s.length+o.length,u=r.length+i.length,f=h*Float32Array.BYTES_PER_ELEMENT+u*Uint32Array.BYTES_PER_ELEMENT,d=h*Float32Array.BYTES_PER_ELEMENT,m=u*Uint32Array.BYTES_PER_ELEMENT,p=We._malloc(f),g=new Float32Array(We.HEAPF32.buffer,p,h),x=new Uint32Array(We.HEAPU32.buffer,p+d,u);g.set(t,0),g.set(s,t.length),g.set(o,t.length+s.length),x.set(r,0),x.set(i,r.length);let v;n?.scaleBaked?.some(b=>b!==1)&&(v=new Be().makeScale(...n.scaleBaked)),e&&(v?v.premultiply(e):v=e);let w=v?We.alloc_subdivision_surface2(p,a,p+d,l,p+d+r.length*Uint32Array.BYTES_PER_ELEMENT,c,v.elements):We.alloc_subdivision_surface(p,a,p+d,l,p+d+r.length*Uint32Array.BYTES_PER_ELEMENT,c);return We._free(p),w}static buildLevel(n,e,t,r,i){let s=i?We.get_mesh_data2(n,e?We.Level.CONTROL:We.Level.REFINED,t,i.elements):We.get_mesh_data(n,e?We.Level.CONTROL:We.Level.REFINED,t),o=8,a=We.HEAPU32.subarray(s>>2,(s>>2)+o),l=a.subarray(4,4+4),c=0,h=We.HEAPU32[a[c]>>2],u=We.HEAPF32.subarray(h>>2,(h>>2)+l[c]);c++;let f=We.HEAPU32[a[c]>>2],d=We.HEAPF32.subarray(f>>2,(f>>2)+l[c]);c++;let m=We.HEAPU32[a[c]>>2],p=We.HEAPU32.subarray(m>>2,(m>>2)+l[c]);c++;let g=We.HEAPU32[a[c]>>2],x=We.HEAPU32.subarray(g>>2,(g>>2)+l[c]);if(c++,r===void 0){let v=new Le;if(v.setIndex(new ms(x,1)),v.setAttribute("position",new Ae(u,3)),v.setAttribute("normal",new Ae(d,3)),e){v.setAttribute("faceMap",new ms(p,1));let w=new Float32Array(d.length/3*4).fill(0);v.setAttribute("color",new Xe(w,4))}return We.free_mesh_data(s),v.userData.type="SubdivGeometry",v}r.getAttribute("position").copyArray(u),r.getAttribute("normal").copyArray(d),r.attributes.position.needsUpdate=!0,r.attributes.normal.needsUpdate=!0,We.free_mesh_data(s)}static buildControlCageWireframe(n,e,t){let r=We.get_wireframe_data_for_base_level(n),i=4,s=We.HEAPU32.subarray(r>>2,(r>>2)+i),o=s.subarray(2,2+2),a=0,l=We.HEAPU32[s[a]>>2],c=We.HEAPF32.subarray(l>>2,(l>>2)+o[a]);a++;let h=We.HEAPU32[s[a]>>2],u=We.HEAPU32.subarray(h>>2,(h>>2)+o[a]);if(e===void 0){let f=new Le;f.setAttribute("position",new Ae(c,3));let d=new Float32Array(c.length);for(let m=0,p=c.length;m<p;)d[m++]=t.r,d[m++]=t.g,d[m++]=t.b;return f.setAttribute("color",new Xe(d,3)),f.setIndex(new ms(u,1)),We.free_wireframe_data_for_base_level(r),f}e.getAttribute("position").copyArray(c),e.attributes.position.needsUpdate=!0,We.free_wireframe_data_for_base_level(r)}static updateCollabMesh(n,e,t){e||We.set_destination_refinement_level(n,1);let r=t?We.get_topological_data2(n,e?We.Level.CONTROL:We.Level.REFINED,t.elements):We.get_topological_data(n,e?We.Level.CONTROL:We.Level.REFINED),i=6,s=We.HEAPU32.subarray(r>>2,(r>>2)+i),o=s.subarray(3,3+3),a=0,l=We.HEAPU32[s[a]>>2],c=new Float32Array(We.HEAPF32.subarray(l>>2,(l>>2)+o[a]));a++;let h=We.HEAPU32[s[a]>>2],u=new Uint32Array(We.HEAPU32.subarray(h>>2,(h>>2)+o[a]));a++;let f=We.HEAPU32[s[a]>>2],d=new Uint8Array(We.HEAPU32.subarray(f>>2,(f>>2)+o[a]));return We.free_topological_data(r),{positions:c,indices:u,verticesPerFace:d}}};var E1=["getX","getY","getZ"];function by(n,e){let t={},r=e?e.count:n.count,i=0,s=[],o=[],a=1e4;for(let c=0;c<r;c++){let h=e?e.getX(c):c,u="";for(let f=0;f<3;f++)u+=`${~~(n[E1[f]](h)*a)},`;if(u in t)s.push(t[u]);else{for(let f=0;f<3;f++)o.push(n[E1[f]](h));t[u]=i,s.push(i),i++}}let l=[];for(let c=0;c<s.length;c+=3)s[c]===s[c+1]||s[c]===s[c+2]||s[c+1]===s[c+2]||l.push(s[c],s[c+1],s[c+2]);return{positions:o,triIndices:l}}var Td=new A,yy=new A,vy=new A,xy=new A;function wy(n,e,t){let r=[],i=[];if(t.userData.shape!==void 0&&t.userData.parameters.depth===0){let s=t.userData.shape.extractShapePointsToFlatArray([]),o=0;for(let l=0;l<s.length;l+=2)o+=(s[l]-s[(l===0?s.length:l)-2])*(s[l+1]+s[(l===0?s.length:l)-1]);n.length=0;let a=0;if(o<0)for(let l=0;l<s.length;l+=2)n.push(s[l],s[l+1],0),r.push(a++);else for(let l=s.length-2;l>=0;l-=2)n.push(s[l],s[l+1],0),r.push(a++);return i.push(a),{indices:r,verticesPerFace:i}}for(let s=0,o=t.capStartIndex??e.length;s<o;)if(e[s+1]===e[s+3]&&e[s+2]===e[s+5]||e[s+0]===e[s+3]&&e[s+2]===e[s+4]){Td.set(n[e[s]*3],n[e[s]*3+1],n[e[s]*3+2]),yy.set(n[e[s+1]*3],n[e[s+1]*3+1],n[e[s+1]*3+2]),vy.set(n[e[s+4]*3],n[e[s+4]*3+1],n[e[s+4]*3+2]),xy.set(n[e[s+5]*3],n[e[s+5]*3+1],n[e[s+5]*3+2]),yy.sub(Td).normalize(),vy.sub(Td).normalize(),xy.sub(Td).normalize();let a=yy.cross(vy).dot(xy);Math.abs(a)>.005?(r.push(e[s],e[s+1],e[s+2]),i.push(3),s+=3):(r.push(e[s],e[s+1],e[s+4],e[s+5]),i.push(4),s+=6)}else r.push(e[s],e[s+1],e[s+2]),i.push(3),s+=3;if(t.capStartIndex!==void 0){let s=[],o=[],a=0;for(let l=0,c=0;l<n.length;l+=3,c++)n[l+2]===0&&(s.push(c),a++),n[l+2]===t.userData.parameters.depth&&o.push(c);if(t.userData.parameters.extrudeBevelSize===0){let l=o[0];o[0]=o[1],o[1]=l}s.reverse(),r.push(...s,...o),i.push(a,a)}return{indices:r,verticesPerFace:i}}var Qn={};ip(Qn,{calcBoolean:()=>CR,calcBooleanTopological:()=>ER,freeMeshSet:()=>LR,getMeshSet:()=>DR,transformMeshSet:()=>PR});var D1,P1=new Promise(n=>{D1=n}),C1=!1;async function L1(){if(C1)return;let e=!1?".":"https://unpkg.com/@splinetool/boolean-wasm@0.9.65/build",[t,r]=await Promise.all([import("./boolean.js"),fetch(`${e}/boolean.wasm`).then(o=>o.arrayBuffer())]),s=await t.default({wasmBinary:r});D1(s),C1=!0}var ot,Sl;P1.then(n=>ot=n);function TR(n,e){let t,{positions:r,triIndices:i}=by(n.getAttribute("position"),n.getIndex()),s;if(e){let{indices:o,verticesPerFace:a}=wy(r,i,n);s=a.length,t=[];for(let l=0,c=0;l<s;l++){t.push(a[l]);for(let h=0;h<a[l];h++)t.push(o[c++])}}else{let o=i.length;t=Array(o+o/3),s=0;for(let a=0,l=0;l<t.length;)t[l++]=3,s++,t[l++]=i[a++],t[l++]=i[a++],t[l++]=i[a++]}return{positions:r,faceIndices:t,nFaces:s}}function I1(n){let e=n.length,t=e*Uint32Array.BYTES_PER_ELEMENT,r=e*Float32Array.BYTES_PER_ELEMENT,i=Number.isInteger(n[0])?t:r,s=ot._malloc(i);return(Number.isInteger(n[0])?new Uint32Array(ot.HEAPU32.buffer,s,e):new Float32Array(ot.HEAPF32.buffer,s,e)).set(n,0),s}function N1(n){switch(n){case 0:return ot.OP.UNION;case 1:return ot.OP.INTERSECTION;case 2:return ot.OP.A_MINUS_B;case 3:return ot.OP.B_MINUS_A;case 4:return ot.OP.SYMMETRIC_DIFFERENCE;case 5:return ot.OP.ALL;default:throw new Error("Unknown boolean operation "+n)}}function ER(n,e){Sl===void 0&&(Sl=ot.init_csg());let t=I1(n),r=ot.csg_calc_topological(Sl,t,n.length,N1(e));ot._free(t);let i=6,s=ot.HEAPU32.subarray(r>>2,(r>>2)+i),o=s.subarray(3,3+3),a=0,l=ot.HEAPU32[s[a]>>2],c=new Float32Array(ot.HEAPF32.subarray(l>>2,(l>>2)+o[a]));a++;let h=ot.HEAPU32[s[a]>>2],u=new Uint32Array(ot.HEAPU32.subarray(h>>2,(h>>2)+o[a]));a++;let f=ot.HEAPU32[s[a]>>2],d=new Uint8Array(ot.HEAPU32.subarray(f>>2,(f>>2)+o[a]));return ot.free_mesh_data(r),{positions:c,indices:u,verticesPerFace:d}}function CR(n,e,t,r){Sl===void 0&&(Sl=ot.init_csg());let i=I1(n),s=ot.csg_calc(Sl,i,n.length,r,N1(e));ot._free(i);let o=5,a=ot.HEAPU32.subarray(s>>2,(s>>2)+o),l=a.subarray(2,2+3),c=0,h=ot.HEAPU32[a[c]>>2],u=ot.HEAPF32.subarray(h>>2,(h>>2)+l[c]);c++;let f=ot.HEAPU32[a[c]>>2],d=ot.HEAPF32.subarray(f>>2,(f>>2)+l[c]);c++;let m=l[c];t.setAttribute("position",new Ae(u,3)),t.setAttribute("normal",new Ae(d,3));let p=ot.HEAPF32.subarray((s>>2)+5,(s>>2)+5+6);return t.boundingSphere===null&&(t.boundingSphere=new Br),t.boundingSphere.center.set(p[0],p[1],p[2]),t.boundingSphere.radius=(p[3]**2+p[4]**2+p[5]**2)**.5,t.userData.parameters={width:p[3]*2,height:p[4]*2,depth:p[5]*2},ot.free_mesh_data(s),m}function DR(n,e){if(ot===void 0)return-1;let t,r,i;if(e&&n.userData.positions!==void 0){let p=n.userData;i=p.verticesPerFace.length,t=p.positions,r=Array(p.verticesPerFace.reduce((g,x)=>g+x,0)+i);for(let g=0,x=0,v=0;g<p.verticesPerFace.length;g++){r[v++]=p.verticesPerFace[g];for(let w=0;w<p.verticesPerFace[g];w++)r[v++]=p.indices[x++]}}else({positions:t,faceIndices:r,nFaces:i}=TR(n,e));let s=t.length,o=r.length,a=t.length,l=r.length,c=a*Float32Array.BYTES_PER_ELEMENT+l*Uint32Array.BYTES_PER_ELEMENT,h=a*Float32Array.BYTES_PER_ELEMENT,u=l*Uint32Array.BYTES_PER_ELEMENT,f=ot._malloc(c),d=new Float32Array(ot.HEAPF32.buffer,f,a),m=new Uint32Array(ot.HEAPU32.buffer,f+h,l);return d.set(t,0),m.set(r,0),ot.get_csg_mesh(f,s,f+h,o,i)}function PR(n,e){ot.transform_csg_mesh(n,e.elements)}function LR(n){ot.free_csg_mesh(n)}var gy={ConeGeometry:gS,CubeGeometry:yS,CylinderGeometry:mS,DodecahedronGeometry:vS,EllipseGeometry:GS,HelixGeometry:WS,IcosahedronGeometry:jS,LatheGeometry:qS,NonParametricGeometry:YS,PolygonGeometry:XS,PyramidGeometry:JS,RectangleGeometry:sd,SphereGeometry:QS,PlaneGeometry:KS,BackdropGeometry:ZS,StarGeometry:$S,TextFrameGeometry:od,TorusGeometry:e1,TorusKnotGeometry:t1,TriangleGeometry:r1,VectorGeometry:Er},Sh=n=>gy[n.type].create(n);var B1=new Be;function Sy(n){let e=!1;return n.scene.objects.traverse((t,r)=>{r.geometry?.type==="BooleanGeometry"&&(e=!0)}),e}var Ed=class extends Ct{constructor(t=new Le,r=new Yr){super(t,r);this.booleanOp=2;this.phongAngle=35;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(t){if(this.booleanMeshSetAddress!==-1)return;for(let i=0;i<this.children.length;i++){let s=this.children[i];xt(s)&&s.recomputeBoolean(t===!0)}this.meshSetAddresses=[];for(let i=0;i<this.children.length;i++){let s=this.children[i];if(b1(s)&&s.booleanExclude===!1&&s.geometry.attributes.position?.count>0&&s.geometry.drawRange.count>0){if(s.booleanMeshSetAddress===-1){if(s.booleanMeshSetAddress=Qn.getMeshSet(s.geometry,t===!0),s.booleanMeshSetAddress===-1)return;Qn.transformMeshSet(s.booleanMeshSetAddress,s.matrix),s.booleanMatrixInvOld.copy(s.matrix).invert(),s.booleanWasTransformed=!1}else xt(s)&&s.needsTransformForDownstream===!0?(Qn.transformMeshSet(s.booleanMeshSetAddress,s.matrix),s.needsTransformForDownstream=!1):s.booleanWasTransformed===!0&&(B1.multiplyMatrices(s.matrix,s.booleanMatrixInvOld),Qn.transformMeshSet(s.booleanMeshSetAddress,B1),s.booleanMatrixInvOld.copy(s.matrix).invert(),s.booleanWasTransformed=!1);this.meshSetAddresses.push(s.booleanMeshSetAddress)}}if(this.meshSetAddresses.length===0){this.geometry.setDrawRange(0,0);return}if(t===!0)return Qn.calcBooleanTopological(this.meshSetAddresses,this.booleanOp);let r=this.geometry;r.dispose(),this.geometry=new Le,this.geometry.userData=r.userData,this.geometry.boundingSphere=r.boundingSphere;try{this.booleanMeshSetAddress=Qn.calcBoolean(this.meshSetAddresses,this.booleanOp,this.geometry,this.phongAngle)}catch(i){this.booleanMeshSetAddress=0,console.error(i)}this.booleanMatrixInvOld.copy(this.matrix).invert(),this.needsTransformForDownstream=!0}toJSON(t){let r=super.toJSON(t);return r.object.objectType="Mesh3D",r}updateGeometry(t){let r=t.parameters;r.operation!==void 0&&(this.booleanOp=r.operation),r.phongAngle!==void 0&&(this.phongAngle=r.phongAngle),this.invalidateDownstreamBooleanData().recomputeBoolean()}};var Si=n=>{var e;return e=class extends n{constructor(){super(...arguments);this.isObjectHelper=!0}},e.geometryHelper=new Kr(30,30,30),e};var Cd=new io,Ay=new Br,O1=new Be,Ai=(n,e,t,r,i=!1)=>{let s=e,o=n.matrixWorld;if(s.boundingSphere===null&&s.computeBoundingSphere(),Ay.copy(s.boundingSphere),Ay.applyMatrix4(o),t.ray.intersectsSphere(Ay)===!1||(O1.copy(o).invert(),Cd.copy(t.ray).applyMatrix4(O1),s.boundingBox!==null&&Cd.intersectsBox(s.boundingBox)===!1))return;let a,l,c,h,u=s.index,f=s.attributes.position,d=s.drawRange,m,p;if(i===!1){let x=Math.max(0,d.start),v=Math.min(u.count,d.start+d.count);for(m=x,p=v;m<p;m+=3)if(l=u.getX(m),c=u.getX(m+1),h=u.getX(m+2),a=g(n,t,Cd,f,l,c,h),a){a.faceIndex=Math.floor(m/3),r.push(a);return}}else{let v=s.attributes.position,w=new A,b=new A,S=new A,M=new A,_=2,T=1/((n.scale.x+n.scale.y+n.scale.z)/3),E=T*T,C=Math.max(0,d.start),I=Math.min(v.count,d.start+d.count);for(let B=C,N=I-1;B<N;B+=_){if(w.fromBufferAttribute(v,B),b.fromBufferAttribute(v,B+1),Cd.distanceSqToSegment(w,b,M,S)>E)continue;M.applyMatrix4(n.matrixWorld);let j=t.ray.origin.distanceTo(M);j<t.near||j>t.far||r.push({distance:j,point:S.clone().applyMatrix4(n.matrixWorld),object:n})}}function g(x,v,w,b,S,M,_){let y=new A,T=new A,E=new A,C=new A,I=new A;if(y.fromBufferAttribute(b,S),T.fromBufferAttribute(b,M),E.fromBufferAttribute(b,_),w.intersectTriangle(y,T,E,!1,C)===null)return null;I.copy(C),I.applyMatrix4(x.matrixWorld);let N=v.ray.origin.distanceTo(I);return N<v.near||N>v.far?null:{faceIndex:1,distance:N,point:I.clone(),object:x}}};var Dd=new A,Pn=new Un,My=class extends gs{constructor(t){let r=new Le,i=new Zr({color:16777215,vertexColors:!0,toneMapped:!1}),s=[],o=[],a={},l=new Se(15711266),c=new Se(15711266),h=new Se(2857471);u("n1","n2",l),u("n2","n4",l),u("n4","n3",l),u("n3","n1",l),u("f1","f2",l),u("f2","f4",l),u("f4","f3",l),u("f3","f1",l),u("n1","f1",l),u("n2","f2",l),u("n3","f3",l),u("n4","f4",l),u("p","n1",c),u("p","n2",c),u("p","n3",c),u("p","n4",c),u("u1","u2",h),u("u2","u3",h),u("u3","u1",h);function u(d,m,p){f(d,p),f(m,p)}function f(d,m){s.push(0,0,0),o.push(m.r,m.g,m.b),a[d]===void 0&&(a[d]=[]),a[d].push(s.length/3-1)}r.setAttribute("position",new Ae(s,3)),r.setAttribute("color",new Ae(o,3));super(r,i);this.type="CameraHelper",this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update()}update(){let t=this.geometry,r=this.pointMap,i=!0;Pn.projectionMatrixInverse.elements=[.5112609807824982,-0,-0,-0,-0,.41421356237309503,-0,-0,-0,-0,-0,-.099999,-0,-0,-1.0000000000000002,.100001];let s=1,o=1,a=i?.8:1e-4;Kn("n1",r,t,Pn,-s,-o,a),Kn("n2",r,t,Pn,s,-o,a),Kn("n3",r,t,Pn,-s,o,a),Kn("n4",r,t,Pn,s,o,a);let l=a;Kn("f1",r,t,Pn,-s,-o,l),Kn("f2",r,t,Pn,s,-o,l),Kn("f3",r,t,Pn,-s,o,l),Kn("f4",r,t,Pn,s,o,l);let c=l,h=.5;Kn("u1",r,t,Pn,s*.7*h,o*1.1,c),Kn("u2",r,t,Pn,-s*.7*h,o*1.1,c),Kn("u3",r,t,Pn,0,o*(1.1+.9*h),c),t.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}};function Kn(n,e,t,r,i,s,o){Dd.set(i,s,o).unproject(r);let a=e[n];if(a!==void 0){let l=t.getAttribute("position");for(let c=0,h=a.length;c<h;c++)l.setXYZ(a[c],Dd.x,Dd.y,Dd.z)}}var Pd=class extends Si(My){constructor(t){super(t);this.object=t;this.object=t,this.name=`CombinedCameraHelper: ${t.uuid}`}updateMatrixWorld(t){super.updateMatrixWorld(t),this.updateTarget()}updateTarget(){let t=this.object.getTarget();this.updateWorldMatrix(!0,!1),this.worldToLocal(t)}raycast(t,r){Ai(this.object,this.geometry,t,r,!0)}};var Al=class extends Si(Lu){constructor(t,r=15,i=10066329){super(t,r,i);this.object=t;this.added=!1;this.name=`DirectionalLightHelper: ${t.uuid}`}raycast(t,r){Ai(this.object,Al.geometryHelper,t,r)}};var Ml=class extends Si(Iu){constructor(t,r=15){super(r);this.object=t;this.object.updateMatrixWorld(),this.name=`EmptyObjectHelper: ${t.uuid}`,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1}raycast(t,r){Ai(this.object,Ml.geometryHelper,t,r)}update(){}};var _l=class extends Si(Pu){constructor(t,r=15,i=6710886){super(t,r,i);this.object=t;this.name=`PointLightHelper: ${t.uuid}`}raycast(t,r){Ai(this.object,_l.geometryHelper,t,r)}};var Ld=class extends Si(Du){constructor(t,r=6710886){super(t,r);this.object=t;this.name=`SpotLightHelper: ${t.uuid}`}raycast(t,r){Ai(this.object,Ld.geometryHelper,t,r)}update(){if(this.object!==void 0){let t=Ld._vector,r=this.object.distance?this.object.distance:1e3,i=r*Math.tan(this.object.angle);this.cone.scale.set(i,i,r),t.setFromMatrixPosition(this.object.target.matrixWorld),this.cone.lookAt(t);let s=this.color!==void 0?this.color:this.light.color;if(this.cone.material instanceof Array)for(let o=0,a=this.cone.material.length;o<a;o++)this.cone.material[o].color.set(s);else this.cone.material.color.set(s)}}},Ah=Ld;Ah._vector=new A;var Mi=(n,e)=>class extends n{constructor(){super(...arguments);this.objectHelper=new e(this);this.enableHelper=!1}set visibility(i){this.visible=i,this.setHelperVisibility(i),this.setHelperChildrenVisibility(i)}get visibility(){return this.visible}get geometryHelper(){return e.geometryHelper}setHelperVisibility(i){this.objectHelper.visible=i}setHelperChildrenVisibility(i){for(let s of this.children)En(s)&&s.traverseEntity(o=>{Xi(o)&&o.visible&&(o.objectHelper.visible=i)})}raycast(i,s){this.objectHelper.raycast(i,s)}copy(i,s=!0){return super.copy(i,s),i.enableHelper!==void 0&&(this.enableHelper=i.enableHelper),i.objectHelper!==void 0&&(this.objectHelper.visible=i.objectHelper.visible),this}toJSON(i){let s=super.toJSON(i),o=s.object;return o.enableHelper=this.enableHelper,s}fromJSON(i){return super.fromJSON(i),i.enableHelper!==void 0&&(this.enableHelper=!0),this}fromLightState(i,s){if(this.objectType==="LightDirectional"||this.objectType==="LightPoint"||this.objectType==="LightSpot"){let o=this;i.color!==void 0&&(o.color=Zt(i.color,s)),i.intensity!==void 0&&(o.intensity=i.intensity),i.depth!==void 0&&(o.shadow.camera.far=i.depth,o.shadow.needsUpdate=!0),i.shadows!==void 0&&(this.castShadow=i.shadows),i.helper!==void 0&&(this.enableHelper=i.helper,o.gizmos.shadowmap.visible=i.helper)}return this}};var Tl=new A,_y=new A,yn=class extends Mi(Cn(Un),Pd){constructor(t=window.innerWidth,r=window.innerHeight,i=45,s,o=1e5){super();this.objectType="CombinedCamera";this._cameraType="OrthographicCamera";this.targetOffset=So.DefaultTargetOffset;this.isUpVectorFlipped=!1;this.angleOffsetFromUp=0;this.width=t,this.height=r,this.orthoCamera=new oa(t*-.5,t*.5,r*.5,r*-.5,s??-5e4,o),this.perspCamera=new Jt(i,t/r,s??50,o),this.left=this.orthoCamera.left,this.right=this.orthoCamera.right,this.top=this.orthoCamera.top,this.bottom=this.orthoCamera.bottom,this.far=this.orthoCamera.far,this.view=this.orthoCamera.view,this.aspect=this.perspCamera.aspect,this.fov=this.perspCamera.fov,this.focus=this.perspCamera.focus,this.filmGauge=this.perspCamera.filmGauge,this.filmOffset=this.perspCamera.filmOffset,this.toOrthographic(!0)}static createFromState(t,r){let i=new yn().fromState(r);return i.enableHelper=!0,i.objectHelper.update(),i.uuid=t,i}get isPerspectiveCamera(){return this.cameraType==="PerspectiveCamera"}get isOrthographicCamera(){return!this.isPerspectiveCamera}get cameraType(){return this._cameraType}setNear(t,r){t==="PerspectiveCamera"?this.perspCamera.near=r:this.orthoCamera.near=r}setZoom(t,r){r>=0&&(t==="PerspectiveCamera"?this.perspCamera.zoom=r:this.orthoCamera.zoom=r)}set cameraType(t){t==="PerspectiveCamera"?this.toPerspective():t==="OrthographicCamera"&&this.toOrthographic()}get near(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.near:this.orthoCamera.near}set near(t){this._cameraType==="PerspectiveCamera"?this.perspCamera.near=t:this.orthoCamera.near=t}get zoom(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom:this.orthoCamera.zoom}set zoom(t){t>=0&&(this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom=t:this.orthoCamera.zoom=t)}lookAt(t){super.lookAt(t),this.getWorldPosition(Tl),this.targetOffset=Tl.distanceTo(t)}getTarget(t=new A){return this.getWorldDirection(_y),this.getWorldPosition(Tl),_y.multiplyScalar(this.targetOffset),t.copy(Tl).add(_y),t}getDistanceToTarget(){let t=this.getTarget();return this.getWorldPosition(Tl),Tl.distanceTo(t)}updateUp(){let t=this.getWorldQuaternion(new jt),r=new A(0,0,1).applyQuaternion(t),i=new A().copy(lt.DefaultUp);this.isUpVectorFlipped&&i.negate(),i.applyQuaternion(t);let s=new A().copy(lt.DefaultUp).projectOnPlane(r),o=new A().crossVectors(s,i).dot(r)>=0?1:-1;this.angleOffsetFromUp=s.angleTo(i)*o}getViewFrontToObject(t){let r=t.getWorldPosition(new A),s=t.getWorldDirection(new A).multiplyScalar(this.targetOffset);return{position:r.clone().add(s),target:r}}getViewToObject(t){let r=t.getWorldPosition(new A),s=this.getWorldDirection(new A).multiplyScalar(this.targetOffset);return{position:r.clone().sub(s),target:r}}setViewplaneSize(t,r){this.left=-t*.5,this.right=t*.5,this.top=r*.5,this.bottom=-r*.5,this.aspect=t/r,this.updateProjectionMatrix()}toOrthographic(t){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||t===!0)&&this.objectHelper.update()}toPerspective(t){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||t===!0)&&this.objectHelper.update()}setFocalLength(t){this.perspCamera.setFocalLength(t),this.toPerspective()}getFocalLength(){return this.perspCamera.getFocalLength()}getEffectiveFOV(){return this.perspCamera.getEffectiveFOV()}getFilmWidth(){return this.perspCamera.getFilmWidth()}getFilmHeight(){return this.perspCamera.getFilmHeight()}setViewOffset(t,r,i,s,o,a){this._cameraType==="PerspectiveCamera"?this.perspCamera.setViewOffset(t,r,i,s,o,a):this.orthoCamera.setViewOffset(t,r,i,s,o,a)}clearViewOffset(){this._cameraType==="PerspectiveCamera"?(this.perspCamera.clearViewOffset(),this.toPerspective()):(this.orthoCamera.clearViewOffset(),this.toOrthographic())}updateProjectionMatrix(t){this._cameraType==="PerspectiveCamera"?this.toPerspective(t):this._cameraType==="OrthographicCamera"&&this.toOrthographic(t)}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,r){super.updateWorldMatrix(t,r),this.matrixWorldInverse.copy(this.matrixWorld).invert()}copy(t,r){return super.copy(t,r),this.orthoCamera.copy(t.orthoCamera),this.perspCamera.copy(t.perspCamera),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.far=t.far,this.view=t.view===null?null:Object.assign({},t.view),this._cameraType=t._cameraType,this.aspect=t.aspect,this.fov=t.fov,this.focus=t.focus,this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this.targetOffset=t.targetOffset,this.updateProjectionMatrix(),this}fromCameraRender(t){let r={near:this.orthoCamera.near,far:this.orthoCamera.far},i={near:this.perspCamera.near,far:this.perspCamera.far};return this.copy(t),this.name="",this.enableHelper=!0,this.objectHelper.visible=!0,this.orthoCamera.near=r.near,this.orthoCamera.far=r.far,this.perspCamera.near=i.near,this.perspCamera.far=i.far,this.updateProjectionMatrix(),this}toJSON(t){let r=super.toJSON(t),i=r.object;return i.objectType="CombinedCamera",i.cameraType=this.cameraType,i.targetOffset=this.targetOffset,i.isUpVectorFlipped=this.isUpVectorFlipped,i.angleOffsetFromUp=this.angleOffsetFromUp,i.left=this.left,i.right=this.right,i.top=this.top,i.bottom=this.bottom,this.view!==null&&(i.view=Object.assign({},this.view)),i.zoomOrtho=this.orthoCamera.zoom,i.nearOrtho=this.orthoCamera.near,i.far=this.far,i.aspect=this.aspect,i.fov=this.fov,i.focus=this.focus,i.filmGauge=this.filmGauge,i.filmOffset=this.filmOffset,i.zoomPersp=this.perspCamera.zoom,i.nearPersp=this.perspCamera.near,r}fromJSON(t){if(super.fromJSON(t),this.cameraType=t.cameraType,t.targetOffset!==void 0&&(this.targetOffset=t.targetOffset),t.orbitControlsTarget!==void 0){let r=this.getWorldPosition(new A),i=new A().fromArray(t.orbitControlsTarget);this.targetOffset=i.distanceTo(r)}else t.targetOffset!==void 0&&(this.targetOffset=t.targetOffset);return this.isUpVectorFlipped=!1,this.angleOffsetFromUp=t.angleOffsetFromUp??0,t.left!==void 0&&(this.left=t.left),t.right!==void 0&&(this.right=t.right),t.top!==void 0&&(this.top=t.top),t.bottom!==void 0&&(this.bottom=t.bottom),t.view!==void 0&&(this.view=Object.assign({},t.view)),t.zoomOrtho!==void 0&&(this.orthoCamera.zoom=t.zoomOrtho),t.nearOrtho!==void 0&&(this.orthoCamera.near=t.nearOrtho),t.far!==void 0&&(this.far=t.far),t.aspect!==void 0&&(this.aspect=t.aspect),t.fov!==void 0&&(this.fov=t.fov),t.focus!==void 0&&(this.focus=t.focus),t.filmGauge!==void 0&&(this.filmGauge=t.filmGauge),t.filmOffset!==void 0&&(this.filmOffset=t.filmOffset),t.zoomPersp!==void 0&&(this.perspCamera.zoom=t.zoomPersp),t.nearPersp!==void 0&&(this.perspCamera.near=t.nearPersp),this.updateProjectionMatrix(),this}toCameraState(t=[]){let r={type:this.cameraType,far:this.far,orthographic:{near:this.orthoCamera.near,zoom:this.orthoCamera.zoom},perspective:{near:this.perspCamera.near,fov:this.perspCamera.fov,zoom:this.perspCamera.zoom},up:this.up.toArray(),targetOffset:this.targetOffset,isUpVectorFlipped:this.isUpVectorFlipped};return ja(r,t)}fromCameraState(t){let{orthographic:r,perspective:i}=t;return t.type!==void 0&&(this.cameraType=t.type),t.far!==void 0&&(this.far=t.far),r!==void 0&&(r.near!==void 0&&(this.orthoCamera.near=r.near),r.zoom!==void 0&&(this.orthoCamera.zoom=r.zoom)),i!==void 0&&(i.near!==void 0&&(this.perspCamera.near=i.near),i.fov!==void 0&&(this.perspCamera.fov=i.fov),i.zoom!==void 0&&(this.perspCamera.zoom=i.zoom)),t.up!==void 0&&this.up.fromArray(t.up),t.targetOffset!==void 0&&(this.targetOffset=t.targetOffset),t.isUpVectorFlipped!==void 0&&(this.isUpVectorFlipped=t.isUpVectorFlipped),this.updateProjectionMatrix(),this}toState(t){return{...super.toState(t),...this.toCameraState(t),type:this.cameraType}}fromState(t){return super.fromState(t),this.fromCameraState(t),this}};var Ji=class extends Mi(Cn(ls),Ml){constructor(){super(...arguments);this.objectType="EmptyObject"}static createFromState(t,r){let i=new Ji().fromState(r);return i.uuid=t,i.enableHelper=!0,i.objectHelper.update(),i}toJSON(t){let r=super.toJSON(t);return r.object.objectType="EmptyObject",r}};var El=class extends Mi(Cn(_u),Al){constructor(...t){super(...t);this.objectType="LightDirectional";this._gizmos={};this.castShadow=!0,this.shadow.mapSize.width=2048,this.shadow.mapSize.height=2048,this.shadow.normalBias=1;let i=this.shadow.camera;i.top=1250,i.bottom=-1250,i.right=1250,i.left=-1250,i.near=-1e4,i.far=2500;let s=new Sn(this.shadow.camera);s.visible=!1,this._gizmos.shadowmap=s,this.update()}static createFromState(t,r,i){let s=new El().fromState(r,i);return s.uuid=t,s}get gizmos(){return this._gizmos}showGizmos(){for(let t in this._gizmos){let r=this._gizmos[t];r instanceof Sn&&(r.visible=!0)}}hideGizmos(){for(let t in this._gizmos){let r=this._gizmos[t];r instanceof Sn&&(r.visible=!1)}}update(){this.shadow.camera.updateProjectionMatrix();for(let t in this._gizmos){let r=this._gizmos[t];r instanceof Sn&&r.update()}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.enableHelper===!0&&this.objectHelper.visible===!0&&this.objectHelper.update()}copy(t,r=!0){return super.copy(t,r),this.color.copy(t.color),this.intensity=t.intensity,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}toJSON(t){let r=super.toJSON(t),i=r.object;return i.objectType="LightDirectional",i.color=this.color.getHex(),i.intensity=this.intensity,i.shadow=this.shadow.toJSON(),r}fromJSON(t){super.fromJSON(t),this.color.set(t.color),this.intensity=t.intensity,this.shadow.normalBias=t.shadow.normalBias??0,this.shadow.radius=t.shadow.radius,this.shadow.mapSize.fromArray(t.shadow.mapSize);let r=this.shadow.camera,i=t.shadow.camera;return r.near=i.near,r.far=i.far,r.zoom=i.zoom,r.left=i.left,r.right=i.right,r.top=i.top,r.bottom=i.bottom,i.view!==void 0&&(r.view=Object.assign({},i.view)),this}fromDirectionalLightState(t,r){let i=t.depth!==void 0&&t.depth!==this.shadow.camera.far||t.size!==void 0&&t.size/2!==this.shadow.camera.right;return super.fromLightState(t,r),t.size!==void 0&&y1(this,t.size),t.shadowRadius!==void 0&&(this.shadow.radius=t.shadowRadius),t.shadowResolution!==void 0&&(this.shadow.mapSize.set(t.shadowResolution,t.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null)),i&&this.update(),this}fromState(t,r){return super.fromState(t),this.fromDirectionalLightState(t,r),this}};var Cl=class extends Mi(Cn(Mu),_l){constructor(...t){super(...t);this.objectType="LightPoint";this._gizmos={};this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024,this.shadow.normalBias=1;let i=this.shadow.camera;i.fov=90,i.aspect=1,i.near=100,i.far=2500;let s=new A(-i.far+this.position.x,-i.far+this.position.y,-i.far+this.position.z),o=new A(i.far+this.position.x,i.far+this.position.y,i.far+this.position.z),a=new yr(s,o),l=new mo(a,new Se(16755200));l.visible=!1,this._gizmos.shadowmap=l,this.update()}static createFromState(t,r,i){let s=new Cl().fromState(r,i);return s.uuid=t,s}get gizmos(){return this._gizmos}showGizmos(){for(let t in this._gizmos){let r=this._gizmos[t];r instanceof mo&&(r.visible=!0)}}hideGizmos(){for(let t in this._gizmos){let r=this._gizmos[t];r instanceof mo&&(r.visible=!1)}}update(){if(this.shadow&&(this.shadow.camera.updateProjectionMatrix(),this._gizmos))for(let t in this._gizmos){let r=this._gizmos[t];if(r instanceof mo){let i=this.shadow.camera,s=new A(-i.far+this.position.x,-i.far+this.position.y,-i.far+this.position.z),o=new A(i.far+this.position.x,i.far+this.position.y,i.far+this.position.z);r.box.set(s,o),r.updateMatrixWorld(!0)}}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.enableHelper===!0&&this.objectHelper.visible===!0&&this.objectHelper.update()}copy(t,r=!0){return super.copy(t,r),this.color.copy(t.color),this.intensity=t.intensity,this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}toJSON(t){let r=super.toJSON(t),i=r.object;return i.objectType="LightPoint",i.color=this.color.getHex(),i.intensity=this.intensity,i.distance=this.distance,i.decay=this.decay,i.shadow=this.shadow.toJSON(),r}fromJSON(t){super.fromJSON(t),this.color.set(t.color),this.intensity=t.intensity,this.distance=t.distance,this.decay=t.decay,this.shadow.normalBias=t.shadow.normalBias??0,this.shadow.radius=t.shadow.radius,this.shadow.mapSize.fromArray(t.shadow.mapSize??[512,512]),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null);let r=this.shadow.camera,i=t.shadow.camera;return r.near=i.near,r.far=i.far,r.zoom=i.zoom,r.fov=i.fov,r.focus=i.focus,r.aspect=i.aspect,r.filmGauge=i.filmGauge,r.filmOffset=i.filmOffset,i.view!==void 0&&(r.view=Object.assign({},i.view)),this}fromPointLightState(t,r){return super.fromLightState(t,r),t.distance!==void 0&&(this.distance=t.distance),t.decay!==void 0&&(this.decay=t.decay),t.shadowRadius!==void 0&&(this.shadow.radius=t.shadowRadius),t.shadowResolution!==void 0&&(this.shadow.mapSize.set(t.shadowResolution,t.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null)),this}fromState(t,r){return super.fromState(t),this.fromPointLightState(t,r),this}};var R1=new A,F1=new A,z1=new jt,Dl=class extends Mi(Cn(Au),Ah){constructor(...t){super(...t);this.objectType="LightSpot";this._gizmos={};this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024,this.shadow.normalBias=1;let i=this.shadow.camera;i.fov=je.RAD2DEG*2*this.angle,i.aspect=1,i.near=100,i.far=2500;let s=new Sn(this.shadow.camera);s.visible=!1,this._gizmos.shadowmap=s,this.update()}static createFromState(t,r,i){let s=new Dl().fromState(r,i);return s.uuid=t,s}get gizmos(){return this._gizmos}showGizmos(){for(let t in this._gizmos){let r=this._gizmos[t];r instanceof Sn&&(r.visible=!0)}}hideGizmos(){for(let t in this._gizmos){let r=this._gizmos[t];r instanceof Sn&&(r.visible=!1)}}update(){this.shadow.camera.updateProjectionMatrix();for(let t in this._gizmos){let r=this._gizmos[t];r instanceof Sn&&r.update()}}updateMatrixWorld(t){super.updateMatrixWorld(t),F1.setFromMatrixPosition(this.matrixWorld),z1.setFromRotationMatrix(this.matrixWorld),R1.copy(this.up).applyQuaternion(z1).negate().multiplyScalar(this.distance),this.target.position.copy(F1).add(R1),this.target.updateMatrixWorld(),this.enableHelper===!0&&this.objectHelper.visible===!0&&this.objectHelper.update()}copy(t,r=!0){return super.copy(t,r),this.color.copy(t.color),this.intensity=t.intensity,this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}toJSON(t){let r=super.toJSON(t),i=r.object;return i.objectType="LightSpot",i.color=this.color.getHex(),i.intensity=this.intensity,i.distance=this.distance,i.angle=this.angle,i.decay=this.decay,i.penumbra=this.penumbra,i.shadow=this.shadow.toJSON(),r}fromJSON(t){super.fromJSON(t),this.color.set(t.color),this.intensity=t.intensity,this.distance=t.distance,this.angle=t.angle,this.decay=t.decay,this.penumbra=t.penumbra,this.shadow.normalBias=t.shadow.normalBias??0,this.shadow.radius=t.shadow.radius,this.shadow.mapSize.fromArray(t.shadow.mapSize);let r=this.shadow.camera,i=t.shadow.camera;return r.near=i.near,r.far=i.far,r.zoom=i.zoom,r.fov=i.fov,r.focus=i.focus,r.aspect=i.aspect,r.filmGauge=i.filmGauge,r.filmOffset=i.filmOffset,i.view!==void 0&&(r.view=Object.assign({},i.view)),this}fromSpotLightState(t,r){return super.fromLightState(t,r),t.distance!==void 0&&(this.distance=t.distance),t.decay!==void 0&&(this.decay=t.decay),t.angle!==void 0&&(this.angle=t.angle),t.penumbra!==void 0&&(this.penumbra=t.penumbra),t.shadowRadius!==void 0&&(this.shadow.radius=t.shadowRadius),t.shadowResolution!==void 0&&(this.shadow.mapSize.set(t.shadowResolution,t.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null)),this}fromState(t,r){return super.fromState(t),this.fromSpotLightState(t,r),this}};var U1=n=>n.tagName==="VIDEO",Po=class{static resize(e,t,r){let i=e/t,s;if(!r.image)return;let o=r.image;U1(o)?s=o.videoWidth/o.videoHeight:s=o.width/o.height,i>s&&(r.imageType=="WEBCAM"?r.repeat.set(-1,1*s/i):r.repeat.set(1,1*s/i)),i<s&&(r.imageType=="WEBCAM"?r.repeat.set(1*i/s*-1,1):r.repeat.set(1*i/s,1)),i==s&&(r.imageType=="WEBCAM"?r.repeat.set(-1,1):r.repeat.set(1,1))}static resizeTextureLayer(e,t,r){let i=e/t,s=r.image!==void 0?r.image.width/r.image.height:1,o;i>s?o={x:1,y:s/i}:i<s?o={x:i/s,y:1}:o={x:1,y:1},r.repeat.set(o.x,o.y),r.updateMatrix()}static resizeTextureLayers(e,t,r){let i=r.userData.layers,s=i.getLayers();for(let o=0;o<s.length;o++){let a=s[o];a1(a)&&(Po.resizeTextureLayer(e,t,a.uniforms[`f${a.id}_texture`].value),i.updateLayerUniform())}}static resizeComplex(e,t,r,i){let s=e/t,o,a=r.image;U1(a)?o=a.videoWidth/a.videoHeight:o=a.width/a.height,i.geometry.type.includes("Shape")?(s>o&&(r.imageType=="WEBCAM"?r.repeat.set(1/e*-1,1/t*o/s):r.repeat.set(1/e,1/t*o/s)),s<o&&(r.imageType=="WEBCAM"?r.repeat.set(1/e*s/o*-1,1/t):r.repeat.set(1/e*s/o,1/t)),s==o&&(r.imageType=="WEBCAM"?r.repeat.set(1/e*-1,1/t):r.repeat.set(1/e,1/t))):(s>o&&(r.imageType=="WEBCAM"?r.repeat.set(-1,1*o/s):r.repeat.set(1,1*o/s)),s<o&&(r.imageType=="WEBCAM"?r.repeat.set(1*s/o*-1,1):r.repeat.set(1*s/o,1)),s==o&&(r.imageType=="WEBCAM"?r.repeat.set(-1,1):r.repeat.set(1,1)))}};var Pl=class extends Ct{constructor(t,r=new Ir){super(t,r);this.objectType="Mesh2D";this.castShadow=!0,this.receiveShadow=!0}updateGeometry(t){super.updateGeometry(t),this.material.userData.layers&&Po.resizeTextureLayers(this.geometry.userData.parameters.width,this.geometry.userData.parameters.height,this.material)}resizeGeometry(t,r){super.resizeGeometry(t,r,0),this.material.userData.layers&&Po.resizeTextureLayers(this.geometry.userData.parameters.width,this.geometry.userData.parameters.height,this.material)}toJSON(t){let r=super.toJSON(t);return r.object.objectType="Mesh2D",r}clone(){let t=super.clone();return t.updateGeometry({}),t}static fromTexture(t){let r,i;if(t instanceof wu){let a=t.image;r=a.videoWidth*.5,i=a.videoHeight*.5}else{let a=t.image;r=a.width*.5,i=a.height*.5}let s=sd.create({parameters:{width:r,height:i}}),o=new Ir;return o.layersList.changeLayer(0,{type:"texture",texture:t}),o.layersList.moveLayer(0,1),o.dispose(),new Pl(s,o)}};var Ll=class extends Ct{constructor(t,r=new Yr){super(t,r);this.objectType="Mesh3D";this.castShadow=!0,this.receiveShadow=!0}toJSON(t){let r=super.toJSON(t);return r.object.objectType="Mesh3D",r}};var Il=class extends Ll{constructor(t,r=new Yr){super(t,r);this.objectType="NonParametric"}toJSON(t){let r=super.toJSON(t);return r.object.objectType="NonParametric",r}};var Id=class extends vs{constructor(e){super(e)}load(e,t,r,i){let s=this,o=new xs(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(s.withCredentials),o.load(e,function(a){let l;try{l=JSON.parse(a)}catch{console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),l=JSON.parse(a.substring(65,a.length-2))}let c=s.parse(l);t&&t(c)},r,i)}parse(e){return new Ty(e)}},Ty=class{constructor(e){this.isFont=!0,this.type="Font",this.data=e}generateShapes(e,t=100){let r=[],i=NR(e,t,this.data);for(let s=0,o=i.length;s<o;s++)Array.prototype.push.apply(r,i[s].toShapes());return r}};function NR(n,e,t){let r=Array.from(n),i=e/t.resolution,s=(t.boundingBox.yMax-t.boundingBox.yMin+t.underlineThickness)*i,o=[],a=0,l=0;for(let c=0;c<r.length;c++){let h=r[c];if(h===`
|
|
4491
|
+
`,gR=$e.lights_fragment_begin,yR=$e.shadowmask_pars_fragment,dy=!1,vR=n=>{switch(n){case"low":return 8;case"medium":return 16;case"high":return 32;default:return 16}},py=(n="medium")=>{if(!dy){dy=!0;let e=vR(n);$e.shadowmap_pars_fragment=mR(e);let t=gR.slice();t=t.replace("getShadow( spotShadowMap[ i ]",`getShadow( UNROLLED_LOOP_INDEX + ${3}, spotShadowMap[ i ]`),t=t.replace("getShadow( directionalShadowMap[ i ]","getShadow( UNROLLED_LOOP_INDEX, directionalShadowMap[ i ]"),$e.lights_fragment_begin=t;let r=yR.slice();r=r.replaceAll("getShadow(","getShadow( UNROLLED_LOOP_INDEX, "),$e.shadowmask_pars_fragment=r}},d1=n=>{dy=!1,py(n)};var Do=n=>"isEntity"in n,zt=n=>"isAbstractMesh"in n,xt=n=>n!==null&&n.isBooleanMesh,p1=n=>n.objectType==="CombinedCamera",m1=n=>Do(n)&&(n.objectType==="LightDirectional"||n.objectType==="LightSpot"||n.objectType==="LightPoint");var Xi=n=>"objectHelper"in n;function my(n,e){let t=!1;e.position&&(n.position.fromArray(e.position),t=!0),e.rotation&&(n.rotation.fromArray(e.rotation),t=!0),e.scale&&(t=!0,n.scale.fromArray(e.scale)),e.hiddenMatrix!==void 0&&"hiddenMatrix"in n&&(t=!0,n.hiddenMatrix.fromArray(e.hiddenMatrix??hi.identity)),t&&(n.updateMatrix(),xt(n.parent)&&zt(n)&&n.invalidateDownstreamBooleanData(!0).recomputeBoolean()),e.position&&e.rotation&&e.scale&&e.hiddenMatrix!==void 0&&n.updateWorldMatrix(!1,!0),n.objectType==="CombinedCamera"&&(e.isUpVectorFlipped!==void 0&&(n.isUpVectorFlipped=e.isUpVectorFlipped),n.updateUp())}function xR(n,e){my(n,e),e.name!==void 0&&(n.name=e.name),e.visible!==void 0&&(n.isEntity?n.visibility=e.visible:n.visible=e.visible)}function g1(n,e,t){xR(n,e),e.color!==void 0&&(n.color=Zt(e.color,t)),e.intensity!==void 0&&(n.intensity=e.intensity),e.shadows!==void 0&&!(n instanceof po)&&(n.castShadow=e.shadows),n.shadow&&!(n instanceof po)&&e.depth!==void 0&&(n.shadow.camera.far=e.depth,n.shadow.needsUpdate=!0),e.helper!==void 0&&Xi(n)&&(n.enableHelper=e.helper,n.gizmos.shadowmap.visible=e.helper)}function y1(n,e){n.shadow.camera.right=e/2,n.shadow.camera.left=-e/2,n.shadow.camera.top=e/2,n.shadow.camera.bottom=-e/2,n.shadow.needsUpdate=!0}var bl=new yr,bi=new A,wi=new A,wl=new Be,x1=[new A(-1,1,1),new A(-1,-1,1),new A(1,-1,1),new A(1,1,1),new A(-1,1,-1),new A(-1,-1,-1),new A(1,-1,-1),new A(1,1,-1)],bR=[[0,3],[1,2],[5,6],[4,7],[0,1],[3,2],[7,6],[4,5],[0,4],[1,5],[2,6],[3,7]],wR=[[0,2],[7,5],[4,1],[3,6],[4,3],[1,6]];function SR(n,e,t=0,r=e.count){let i=1/0,s=1/0,o=1/0,a=-1/0,l=-1/0,c=-1/0;for(let h=t;h<r;h++){let u=e.getX(h),f=e.getY(h),d=e.getZ(h);u<i&&(i=u),f<s&&(s=f),d<o&&(o=d),u>a&&(a=u),f>l&&(l=f),d>c&&(c=d)}return n.min.set(i,s,o),n.max.set(a,l,c),n}var v1=(n,e,t,r)=>{if(zt(n)){let i=n.geometry.userData.parameters,s=n.geometry.getAttribute("position");n.geometry.userData.type==="SubdivGeometry"?bi.copy(n.originalGeometry.boundingSphere.center):s!==void 0&&(SR(bl,s,n.geometry.drawRange.start,n.geometry.drawRange.count<1/0?n.geometry.drawRange.count:s.count),bl.getCenter(bi)),n.forceComputeSize?bl.getSize(wi).multiplyScalar(.5):wi.set(i.width,i.height,i.depth??0).multiplyScalar(.5)}else if(Xi(n)&&r===!0){let i=n.geometryHelper.getAttribute("position");bl.setFromArray(i.array),bl.getCenter(bi),bl.getSize(wi).multiplyScalar(.5)}else bi.setScalar(0),wi.setScalar(0);wl.copy(e).multiply(n.matrixWorld),wi.x===0&&wi.y===0&&wi.z===0?t.push(new A(bi.x,bi.y,bi.z).applyMatrix4(wl)):x1.forEach(i=>{t.push(i.clone().multiply(wi).add(bi).applyMatrix4(wl))})},xh=class extends yr{constructor(){super(...arguments);this.matrix=new Be;this.vertices=[];this.faces=[];this.edges=[];this.centerEdges=[]}copy(t){return super.copy(t),this.matrix.copy(t.matrix),this.vertices=t.vertices.map(r=>r.clone()),this.faces=t.faces.map(r=>r.clone()),this.edges=t.edges.map(r=>r.clone()),this.centerEdges=t.centerEdges.map(r=>r.clone()),this}setFromObjectSize(t,r=!1){t.updateWorldMatrix(!1,r),this.makeEmpty(),this.matrix.copy(t.matrixWorld);let i=new Be().copy(t.matrixWorld).invert();return this.expandByObjectSize(t,i,r)}expandByObjectSize(t,r,i=!1){let s=[];return i===!0?t.traverseEntity(o=>{o.visible&&v1(o,r,s,t.enableHelper===!0)}):v1(t,r,s,t.enableHelper===!0),this.setFromPoints(s)}getCenter(t){return t=super.getCenter(t),t.applyMatrix4(this.matrix),t}getPositionToCenter(t){return t=super.getCenter(t),t.applyMatrix4(wl.copy(this.matrix).setPosition(0,0,0)),t}computeVertices(){this.getSize(wi).multiplyScalar(.5),this.getCenter(bi),wl.copy(this.matrix).setPosition(bi),this.vertices=x1.map(t=>t.clone().multiply(wi).applyMatrix4(wl))}computeEdges(){this.vertices.length>0&&this.computeVertices(),this.edges=bR.map(([t,r])=>new Cu(this.vertices[t],this.vertices[r])),this.centerEdges=this.edges.map(t=>t.getCenter(new A))}computeFaces(){this.vertices.length>0&&this.computeVertices(),this.faces=wR.map(([t,r])=>this.vertices[t].clone().add(this.vertices[r]).multiplyScalar(.5))}};function bh(n){let e=[];for(let t in n){let r=n[t];delete r.metadata,e.push(r)}return e}function AR(n){let e=[];for(let t in n)e.push(n[t]);return e}var Md=n=>class extends n{hasEntityChild(){return this.children.some(t=>Do(t))}isDescendantOf(t){t instanceof lt&&(t=t.uuid);let r=this;for(;r.parent;){if(r.parent.uuid===t)return!0;r=r.parent}return!1}attach(t,r){this.updateWorldMatrix(!0,!1);let i=new Be().copy(this.matrixWorld).invert();return t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),i.multiply(t.parent.matrixWorld)),Do(t)?t.hiddenMatrix.premultiply(i):t.applyMatrix4(i),t.updateWorldMatrix(!1,!1),this.add(t),r!==void 0&&(this.children.pop(),this.children.splice(r,0,t)),this}copy(t,r=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),r===!0)for(let i=0;i<t.children.length;i++){let s=t.children[i];this.add(s.clone())}return this}toJSON(t){let r=t===void 0,i={object:{uuid:"",objectType:""}};t===void 0&&(t={geometries:{},materials:{},textures:{},images:{},interactionStates:{},nodes:{}},i.metadata={version:1.5,type:"Object",generator:"Object3D.toJSON"});let s={uuid:this.uuid,objectType:this.type};if(this.name!==""&&(s.name=this.name),s.matrix=this.matrix.toArray(),this.castShadow===!0&&(s.castShadow=!0),this.receiveShadow===!0&&(s.receiveShadow=!0),this.visible===!1&&(s.visible=!1),this.frustumCulled===!1&&(s.frustumCulled=!1),this.renderOrder!==0&&(s.renderOrder=this.renderOrder),s.layers=this.layers.mask,JSON.stringify(this.userData)!=="{}"&&(s.userData=this.userData),this.children.length>0){s.children=[];for(let o of this.children)(Do(o)||o instanceof bs)&&s.children.push(o.toJSON(t).object)}if(r){let o=bh(t.geometries),a=bh(t.materials),l=bh(t.textures),c=bh(t.images),h=bh(t.interactionStates),u=AR(t.nodes);o.length>0&&(i.geometries=o),a.length>0&&(i.materials=a),l.length>0&&(i.textures=l),c.length>0&&(i.images=c),h.length>0&&(i.interactionStates=h),u.length>0&&(i.nodes=u)}return i.object=s,i}fromJSON(t){return this.uuid=t.uuid,t.name!==void 0&&(this.name=t.name),t.matrix!==void 0?(this.matrix.fromArray(t.matrix),t.matrixAutoUpdate!==void 0&&(this.matrixAutoUpdate=t.matrixAutoUpdate),this.matrixAutoUpdate&&this.matrix.decompose(this.position,this.quaternion,this.scale)):(t.position!==void 0&&this.position.fromArray(t.position),t.rotation!==void 0&&this.rotation.fromArray(t.rotation),t.quaternion!==void 0&&this.quaternion.fromArray(t.quaternion),t.scale!==void 0&&this.scale.fromArray(t.scale)),this.castShadow=t.castShadow!==void 0,this.receiveShadow=t.receiveShadow!==void 0,t.visible!==void 0&&(this.visible=t.visible),t.frustumCulled!==void 0&&(this.frustumCulled=t.frustumCulled),t.renderOrder!==void 0&&(this.renderOrder=t.renderOrder),t.layers!==void 0&&(this.layers.mask=t.layers),t.userData!==void 0&&(this.userData=t.userData),this}};var En=n=>"isEntity"in n,b1=n=>"isAbstractMesh"in n,Cn=n=>class extends Md(n){constructor(){super(...arguments);this.objectType="";this.isEntity=!0;this.raycastLock=!1;this.scaleLock=!1;this.hiddenMatrix=new Be;this._singleBBox=new xh;this._recursiveBBox=new xh;this.singleBBoxNeedsUpdate=!0;this.recursiveBBoxNeedsUpdate=!0;this.forceComputeSize=!1}set visibility(r){this.visible=r;for(let i of this.children)En(i)&&i.traverseEntity(s=>{Xi(s)&&s.visible&&(s.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=>{En(r)&&(r.singleBBoxNeedsUpdate=!0,r.recursiveBBoxNeedsUpdate=!0)}),this.traverseEntity(r=>{r.singleBBoxNeedsUpdate=!0,r.recursiveBBoxNeedsUpdate=!0})}traverseEntity(r){r(this);for(let i of this.children)En(i)&&i.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 i of this.children)i.updateMatrixWorld(r)}updateWorldMatrix(r,i){let s=this.parent;if(r&&s!==null&&s.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)),i)for(let o of this.children)o.updateWorldMatrix(!1,!0)}shallowClone(r){return new this.constructor().shallowCopy(this,r)}shallowCopy(r,i=!0){if(super.copy(r,!1),this.raycastLock=r.raycastLock,this.scaleLock=r.scaleLock,this.hiddenMatrix.copy(r.hiddenMatrix),i===!0)for(let s of r.children)En(s)&&this.add(s.shallowClone());return this}clone(r){return new this.constructor().copy(this,r)}copy(r,i=!0){if(super.copy(r,!1),this.raycastLock=r.raycastLock,this.scaleLock=r.scaleLock,this.hiddenMatrix.copy(r.hiddenMatrix),i===!0)for(let s of r.children)En(s)&&this.add(s.clone());return this}keepChildrenMatrixWorld(){let r=new Be,i=this.matrixWorld.clone();this.updateWorldMatrix(!1,!1),r.copy(this.matrixWorld).invert(),r.multiply(i);for(let s of this.children)En(s)&&s.hiddenMatrix.premultiply(r)}toJSON(r){let i=super.toJSON(r),s=i.object;return this.raycastLock===!0&&(s.raycastLock=!0),this.scaleLock===!0&&(s.scaleLock=!0),s.hiddenMatrix=this.hiddenMatrix.toArray(),i}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 i=r.children;return r.children=[],Object.assign(r,{raycastLock:!1,scaleLock:!1,hiddenMatrix:new Be}),this.copy(r),r.children=i,this}toObjectTransformState(r=[]){this.updateWorldMatrix(!0,!1);let i={position:this.position.toArray(),rotation:[this.rotation.x,this.rotation.y,this.rotation.z],scale:this.scale.toArray(),hiddenMatrix:this.hiddenMatrix.toArray()};return ja(i,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 i={name:this.name,visible:this.visible,raycastLock:this.raycastLock,...this.toObjectTransformState(r)};return ja(i,r)}fromState(r,i){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}};var wh=class extends lt{constructor(t,r={}){super();this.object=t;let i=t.recursiveBBox.getSize(new A),s=.1;this.parameters=Af.defaultData(i.toArray(),s),bo(this.parameters,r),this.update(),this.setHideBase(this.parameters.hideBase)}refreshMaterial(){if("material"in this.object)for(let t of this.children)t.material=this.object.material}setHideBase(t){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(t){let r=this.object.material.map(i=>i.clone());for(let i of this.children)i.material=r}else for(let r of this.children)r.material=this.object.material}for(let r of this.object.material)r.visible=!t}else{if(this.children.length>0)if(this.object.material.visible=!0,t){let r=this.object.material.clone();for(let i of this.children)i.material=r}else for(let r of this.children)r.material=this.object.material;this.object.material.visible=!t}this.parameters.hideBase=t}}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(t=>t.updateMatrix())}_updateCount(){let t=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!==t)if(this.children.length<t)for(let r=0,i=t-this.children.length;r<i;++r){let s=this.object.shallowClone(!1);s.visible=!0,this.add(s),this.parameters.hideBase&&this.setHideBase(!0)}else for(let r=0,i=this.children.length-t;r<i;++r)this.remove(this.children[0])}_updateRadial(t){let r=t.radial,i=r.start*je.DEG2RAD,s=r.end*je.DEG2RAD,o=i-s,a=new bn(r.rotation[0]*je.DEG2RAD,r.rotation[1]*je.DEG2RAD,r.rotation[2]*je.DEG2RAD),l;switch(r.axis){case"z":l=new A(0,0,1);break;case"y":l=new A(0,1,0);break;default:case"x":l=new A(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 u=o/t.count*c-i;switch(r.axis){case"x":h.rotation.set(0,u,0);break;case"y":h.rotation.set(0,0,u);break;case"z":h.rotation.set(u,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(t){if(t.type!=="linear")throw new Error;let r=t.linear,i=new bn(r.rotation[0]*je.DEG2RAD,r.rotation[1]*je.DEG2RAD,r.rotation[2]*je.DEG2RAD);for(let[s,o]of this.children.entries())o.hiddenMatrix.identity(),o.scale.x=1+(r.scale[0]-1)*s,o.scale.y=1+(r.scale[1]-1)*s,o.scale.z=1+(r.scale[2]-1)*s,o.rotation.x=i.x*s,o.rotation.y=i.y*s,o.rotation.z=i.z*s,o.position.x=r.position[0]*s,o.position.y=r.position[1]*s,o.position.z=r.position[2]*s}_updateGrid(t){let r=0,i=t.grid;if(i.useCenter===!0){let s={x:i.count[0]%2===0?2:1,y:i.count[1]%2===0?2:1,z:i.count[2]%2===0?2:1},o=new A(i.size[0]*(i.count[0]-s.x)*.5,i.size[1]*(i.count[1]-s.y)*.5,i.size[2]*(i.count[2]-s.z)*.5);for(let a=0;a<i.count[0];a++)for(let l=0;l<i.count[1];l++)for(let c=0;c<i.count[2];c++){let h=this.children[r++];h.hiddenMatrix.identity(),h.scale.setScalar(1),h.rotation.set(0,0,0),h.position.x=i.size[0]*a-o.x,h.position.y=i.size[1]*l-o.y,h.position.z=i.size[2]*c-o.z}}else for(let s=0;s<i.count[0];s++)for(let o=0;o<i.count[1];o++)for(let a=0;a<i.count[2];a++){let l=this.children[r++];l.hiddenMatrix.identity(),l.scale.setScalar(1),l.rotation.set(0,0,0),l.position.x=i.size[0]*s,l.position.y=-i.size[1]*o,l.position.z=-i.size[2]*a}}fromJSON(t){return this}toJSON(){return{}}fromClonerState(t){return t.hideBase!==void 0&&this.setHideBase(t.hideBase),bo(this.parameters,t),this.update(),this}};var Ct=class extends Cn(ir){constructor(t,r){super(t,r);this.isAbstractMesh=!0;this.isBooleanMesh=!1;this.booleanMeshSetAddress=-1;this.booleanWasTransformed=!1;this.booleanMatrixInvOld=new Be;this.booleanExclude=null;Array.isArray(r)&&(this.selectedMaterial=0,t.groups.length===0&&t.addGroup(0,t.getAttribute("position").count,0))}get cloner(){return this._cloner}set cloner(t){this._cloner&&this.remove(this._cloner),t&&this.add(t),this._cloner=t}getSelectedMaterial(t){return Array.isArray(this.material)?(this.selectedMaterial===void 0&&(this.selectedMaterial=t??0),this.material[t??this.selectedMaterial]):this.material}setSelectedMaterial(t,r){Array.isArray(this.material)?(this.selectedMaterial===void 0&&(this.selectedMaterial=r??0),r=r??this.selectedMaterial,this.material[r].dispose(),this.material[r]=t):(this.material.dispose(),this.material=t)}updateGeometry(t){let r=this.geometry,i=gy[r.userData.type],s=this.objectType==="NonParametric"?Object.assign({},r.userData,{geometry:r}):r.userData,o=i.build(i.normalizeInputs(t,s)),a=r.uuid;if(this.geometry.dispose(),this.geometry=o,this.geometry.uuid=a,this.geometry.computeBoundingSphere(),this.cloner)for(let l of this.cloner.children)l.geometry=this.geometry}resizeGeometry(t,r,i){ad.resizeGeometry(this.geometry,{width:t,height:r,depth:i})}shallowClone(t){return new this.constructor(this.geometry,this.material).shallowCopy(this,t)}clone(t){let r=this.objectType==="NonParametric"?Object.assign({},this.geometry.userData,{geometry:this.geometry.clone()}):this.geometry.userData,i=Sh(r),s=Array.isArray(this.material)?this.material.map(o=>o.clone()):this.material.clone();return new this.constructor(i,s).copy(this,t)}copy(t,r=!0){return super.copy(t,r),t.cloner&&(this.cloner=new wh(t,t.cloner.parameters),this.add(this.cloner)),this}setFromClonerState(t){t===null?this.cloner=void 0:(this.cloner===void 0&&(this.cloner=new wh(this)),this.cloner.fromClonerState(t))}fromState(t,r){return super.fromState(t),t.type==="Mesh"&&(this.setFromClonerState(t.cloner),this.castShadow=t.castShadow??!0,this.receiveShadow=t.receiveShadow??!0,this.booleanExclude=t.booleanExclude??null),this}freeBooleanPointer(){this.booleanMeshSetAddress!==-1&&(Qn.freeMeshSet(this.booleanMeshSetAddress),this.booleanMeshSetAddress=-1)}invalidateDownstreamBooleanData(t=!1){return t?this.booleanWasTransformed=!0:this.freeBooleanPointer(),xt(this.parent)?this.parent.invalidateDownstreamBooleanData():this}invalidateUpstreamBooleanData(){this.freeBooleanPointer();for(let t of this.children)zt(t)&&(t.freeBooleanPointer(),xt(t)&&t.invalidateUpstreamBooleanData())}};var MR=new A(0,0,1),w1=new A,S1=new A,A1=new Ht,ks=class extends Ct{constructor(t=Er.create({}),r=new Ir({side:Wt})){super(t,r);this.recursiveSelection=!1;this.objectType="VectorObject";this.eventDispatcher=new Ot;this._onShapeUpdate=()=>{this.updateGeometry({}),this.geometry.computeBoundingSphere(),this.geometry.computeBoundingBox()};this.castShadow=!0,this.receiveShadow=!0,this.forceComputeSize=!0,this.shape=t.userData.shape,this.shape.eventDispatcher?.addEventListener("update",this._onShapeUpdate)}toJSON(t){let r=super.toJSON(t);return r.object.objectType="VectorObject",r}fromState(t){return super.fromState(t),this.shape.update(),this}setHelperVisibility(){}updateGeometry(t){if(super.updateGeometry(t),"userData"in this.geometry){let r=this.geometry.userData.parameters;this.eventDispatcher.dispatchEvent({type:"geometryUpdate",parameters:r})}}setShape(t){this.shape&&this.shape.eventDispatcher?.removeEventListener("update",this._onShapeUpdate),this.shape=t,this.shape.eventDispatcher?.addEventListener("update",this._onShapeUpdate)}updateWorldMatrix(t,r){super.updateWorldMatrix(t,r),A1.getNormalMatrix(this.matrixWorld),w1.copy(MR).applyMatrix3(A1).normalize(),S1.setFromMatrixPosition(this.matrixWorld),this.shape.plane.setFromNormalAndCoplanarPoint(w1,S1)}clone(t){let r=this.shape.clone(),i=this.material.clone(),s=this.geometry.userData,o=Er.create(Object.assign({},s,{shape:r})),a=new ks(o,i).copy(this,t);return a.shape=r,r.update(),a}raycast(t,r){Ct.prototype.raycast.call(this,t,r)}};function _d(n,e){return _R(n)}function _R(n){let e={parameters:n,type:n.type};if(n.type==="VectorGeometry"){let r=dt.createFromState(n.shape,n.width,n.height);e.shape=r}else n.type==="NonParametricGeometry"&&(n.data.groups&&n.data.groups.forEach(r=>r.materialIndex=Math.max(r.materialIndex??0,0)),e.geometry=new ws().parse(n));let t;try{t=Sh(e)}catch(r){console.error(r)}if(!t){let r=dt.createFromState(Ka.defaultData(),100,100);e.shape=r,t=Sh(e)}return t}var We;ld.then(n=>{We=n});var M1=new Float32Array([10,10,0,-10,10,0,-10,-10,0,10,-10,0]),_1=new Uint32Array([0,1,2,3]),T1=new Uint8Array([4]),Dn=class{static build(n,e,t,r,i){let s,o,a,l=n?.phongAngle??e?.phongAngle??35;if(r===!1&&(l=-1),n.positionWASM!==void 0){t&&t!==0&&(We.free_bvh(t),We.free_subdivision_surface(t));try{s=Dn.allocate(n,i)}catch(c){console.error(c,n),s=Dn.allocate({positionWASM:M1,indexWASM:_1,verticesPerFaceWASM:T1},i)}We.set_destination_refinement_level(s,0),o=Dn.buildLevel(s,!0,l)}else s=t,n.phongAngle!==void 0&&(o=Dn.buildLevel(s,!0,l));return n.subdivisions!==void 0&&(We.set_destination_refinement_level(s,n.subdivisions),n.subdivisions>0?a=Dn.buildLevel(s,!1,l):a=null),{subdivPointer:s,originalGeometry:o,subdividedGeometry:a}}static primitiveToQuads(n,e){n.widthSegments>16&&(n.widthSegments=16),n.heightSegments>16&&(n.heightSegments=16),n.depthSegments>16&&(n.depthSegments=16),n.radialSegments>16&&(n.radialSegments=16),n.type==="DodecahedronGeometry"&&(n.detail=0);let t=n.shape!==void 0?e.geometry:_d(n),r,i,s,o;return{positions:r,triIndices:o}=by(t.getAttribute("position"),t.getIndex()),{indices:i,verticesPerFace:s}=wy(r,o,t),{positions:r,indices:i,verticesPerFace:s}}static allocate(n,e){let t,r,i,s=[],o=[];n.positionWASM&&n.positionWASM.length>0?(t=n.positionWASM,r=n.indexWASM,i=n.verticesPerFaceWASM):(t=M1,r=_1,i=T1);let a=t.length,l=r.length,c=i.length,h=t.length+s.length+o.length,u=r.length+i.length,f=h*Float32Array.BYTES_PER_ELEMENT+u*Uint32Array.BYTES_PER_ELEMENT,d=h*Float32Array.BYTES_PER_ELEMENT,m=u*Uint32Array.BYTES_PER_ELEMENT,p=We._malloc(f),g=new Float32Array(We.HEAPF32.buffer,p,h),x=new Uint32Array(We.HEAPU32.buffer,p+d,u);g.set(t,0),g.set(s,t.length),g.set(o,t.length+s.length),x.set(r,0),x.set(i,r.length);let v;n?.scaleBaked?.some(b=>b!==1)&&(v=new Be().makeScale(...n.scaleBaked)),e&&(v?v.premultiply(e):v=e);let w=v?We.alloc_subdivision_surface2(p,a,p+d,l,p+d+r.length*Uint32Array.BYTES_PER_ELEMENT,c,v.elements):We.alloc_subdivision_surface(p,a,p+d,l,p+d+r.length*Uint32Array.BYTES_PER_ELEMENT,c);return We._free(p),w}static buildLevel(n,e,t,r,i){let s=i?We.get_mesh_data2(n,e?We.Level.CONTROL:We.Level.REFINED,t,i.elements):We.get_mesh_data(n,e?We.Level.CONTROL:We.Level.REFINED,t),o=8,a=We.HEAPU32.subarray(s>>2,(s>>2)+o),l=a.subarray(4,4+4),c=0,h=We.HEAPU32[a[c]>>2],u=We.HEAPF32.subarray(h>>2,(h>>2)+l[c]);c++;let f=We.HEAPU32[a[c]>>2],d=We.HEAPF32.subarray(f>>2,(f>>2)+l[c]);c++;let m=We.HEAPU32[a[c]>>2],p=We.HEAPU32.subarray(m>>2,(m>>2)+l[c]);c++;let g=We.HEAPU32[a[c]>>2],x=We.HEAPU32.subarray(g>>2,(g>>2)+l[c]);if(c++,r===void 0){let v=new Le;if(v.setIndex(new ms(x,1)),v.setAttribute("position",new Ae(u,3)),v.setAttribute("normal",new Ae(d,3)),e){v.setAttribute("faceMap",new ms(p,1));let w=new Float32Array(d.length/3*4).fill(0);v.setAttribute("color",new Xe(w,4))}return We.free_mesh_data(s),v.userData.type="SubdivGeometry",v}r.getAttribute("position").copyArray(u),r.getAttribute("normal").copyArray(d),r.attributes.position.needsUpdate=!0,r.attributes.normal.needsUpdate=!0,We.free_mesh_data(s)}static buildControlCageWireframe(n,e,t){let r=We.get_wireframe_data_for_base_level(n),i=4,s=We.HEAPU32.subarray(r>>2,(r>>2)+i),o=s.subarray(2,2+2),a=0,l=We.HEAPU32[s[a]>>2],c=We.HEAPF32.subarray(l>>2,(l>>2)+o[a]);a++;let h=We.HEAPU32[s[a]>>2],u=We.HEAPU32.subarray(h>>2,(h>>2)+o[a]);if(e===void 0){let f=new Le;f.setAttribute("position",new Ae(c,3));let d=new Float32Array(c.length);for(let m=0,p=c.length;m<p;)d[m++]=t.r,d[m++]=t.g,d[m++]=t.b;return f.setAttribute("color",new Xe(d,3)),f.setIndex(new ms(u,1)),We.free_wireframe_data_for_base_level(r),f}e.getAttribute("position").copyArray(c),e.attributes.position.needsUpdate=!0,We.free_wireframe_data_for_base_level(r)}static updateCollabMesh(n,e,t){e||We.set_destination_refinement_level(n,1);let r=t?We.get_topological_data2(n,e?We.Level.CONTROL:We.Level.REFINED,t.elements):We.get_topological_data(n,e?We.Level.CONTROL:We.Level.REFINED),i=6,s=We.HEAPU32.subarray(r>>2,(r>>2)+i),o=s.subarray(3,3+3),a=0,l=We.HEAPU32[s[a]>>2],c=new Float32Array(We.HEAPF32.subarray(l>>2,(l>>2)+o[a]));a++;let h=We.HEAPU32[s[a]>>2],u=new Uint32Array(We.HEAPU32.subarray(h>>2,(h>>2)+o[a]));a++;let f=We.HEAPU32[s[a]>>2],d=new Uint8Array(We.HEAPU32.subarray(f>>2,(f>>2)+o[a]));return We.free_topological_data(r),{positions:c,indices:u,verticesPerFace:d}}};var E1=["getX","getY","getZ"];function by(n,e){let t={},r=e?e.count:n.count,i=0,s=[],o=[],a=1e4;for(let c=0;c<r;c++){let h=e?e.getX(c):c,u="";for(let f=0;f<3;f++)u+=`${~~(n[E1[f]](h)*a)},`;if(u in t)s.push(t[u]);else{for(let f=0;f<3;f++)o.push(n[E1[f]](h));t[u]=i,s.push(i),i++}}let l=[];for(let c=0;c<s.length;c+=3)s[c]===s[c+1]||s[c]===s[c+2]||s[c+1]===s[c+2]||l.push(s[c],s[c+1],s[c+2]);return{positions:o,triIndices:l}}var Td=new A,yy=new A,vy=new A,xy=new A;function wy(n,e,t){let r=[],i=[];if(t.userData.shape!==void 0&&t.userData.parameters.depth===0){let s=t.userData.shape.extractShapePointsToFlatArray([]),o=0;for(let l=0;l<s.length;l+=2)o+=(s[l]-s[(l===0?s.length:l)-2])*(s[l+1]+s[(l===0?s.length:l)-1]);n.length=0;let a=0;if(o<0)for(let l=0;l<s.length;l+=2)n.push(s[l],s[l+1],0),r.push(a++);else for(let l=s.length-2;l>=0;l-=2)n.push(s[l],s[l+1],0),r.push(a++);return i.push(a),{indices:r,verticesPerFace:i}}for(let s=0,o=t.capStartIndex??e.length;s<o;)if(e[s+1]===e[s+3]&&e[s+2]===e[s+5]||e[s+0]===e[s+3]&&e[s+2]===e[s+4]){Td.set(n[e[s]*3],n[e[s]*3+1],n[e[s]*3+2]),yy.set(n[e[s+1]*3],n[e[s+1]*3+1],n[e[s+1]*3+2]),vy.set(n[e[s+4]*3],n[e[s+4]*3+1],n[e[s+4]*3+2]),xy.set(n[e[s+5]*3],n[e[s+5]*3+1],n[e[s+5]*3+2]),yy.sub(Td).normalize(),vy.sub(Td).normalize(),xy.sub(Td).normalize();let a=yy.cross(vy).dot(xy);Math.abs(a)>.005?(r.push(e[s],e[s+1],e[s+2]),i.push(3),s+=3):(r.push(e[s],e[s+1],e[s+4],e[s+5]),i.push(4),s+=6)}else r.push(e[s],e[s+1],e[s+2]),i.push(3),s+=3;if(t.capStartIndex!==void 0){let s=[],o=[],a=0;for(let l=0,c=0;l<n.length;l+=3,c++)n[l+2]===0&&(s.push(c),a++),n[l+2]===t.userData.parameters.depth&&o.push(c);if(t.userData.parameters.extrudeBevelSize===0){let l=o[0];o[0]=o[1],o[1]=l}s.reverse(),r.push(...s,...o),i.push(a,a)}return{indices:r,verticesPerFace:i}}var Qn={};ip(Qn,{calcBoolean:()=>CR,calcBooleanTopological:()=>ER,freeMeshSet:()=>LR,getMeshSet:()=>DR,transformMeshSet:()=>PR});var D1,P1=new Promise(n=>{D1=n}),C1=!1;async function L1(){if(C1)return;let e=!1?".":"https://unpkg.com/@splinetool/boolean-wasm@0.9.66/build",[t,r]=await Promise.all([import("./boolean.js"),fetch(`${e}/boolean.wasm`).then(o=>o.arrayBuffer())]),s=await t.default({wasmBinary:r});D1(s),C1=!0}var ot,Sl;P1.then(n=>ot=n);function TR(n,e){let t,{positions:r,triIndices:i}=by(n.getAttribute("position"),n.getIndex()),s;if(e){let{indices:o,verticesPerFace:a}=wy(r,i,n);s=a.length,t=[];for(let l=0,c=0;l<s;l++){t.push(a[l]);for(let h=0;h<a[l];h++)t.push(o[c++])}}else{let o=i.length;t=Array(o+o/3),s=0;for(let a=0,l=0;l<t.length;)t[l++]=3,s++,t[l++]=i[a++],t[l++]=i[a++],t[l++]=i[a++]}return{positions:r,faceIndices:t,nFaces:s}}function I1(n){let e=n.length,t=e*Uint32Array.BYTES_PER_ELEMENT,r=e*Float32Array.BYTES_PER_ELEMENT,i=Number.isInteger(n[0])?t:r,s=ot._malloc(i);return(Number.isInteger(n[0])?new Uint32Array(ot.HEAPU32.buffer,s,e):new Float32Array(ot.HEAPF32.buffer,s,e)).set(n,0),s}function N1(n){switch(n){case 0:return ot.OP.UNION;case 1:return ot.OP.INTERSECTION;case 2:return ot.OP.A_MINUS_B;case 3:return ot.OP.B_MINUS_A;case 4:return ot.OP.SYMMETRIC_DIFFERENCE;case 5:return ot.OP.ALL;default:throw new Error("Unknown boolean operation "+n)}}function ER(n,e){Sl===void 0&&(Sl=ot.init_csg());let t=I1(n),r=ot.csg_calc_topological(Sl,t,n.length,N1(e));ot._free(t);let i=6,s=ot.HEAPU32.subarray(r>>2,(r>>2)+i),o=s.subarray(3,3+3),a=0,l=ot.HEAPU32[s[a]>>2],c=new Float32Array(ot.HEAPF32.subarray(l>>2,(l>>2)+o[a]));a++;let h=ot.HEAPU32[s[a]>>2],u=new Uint32Array(ot.HEAPU32.subarray(h>>2,(h>>2)+o[a]));a++;let f=ot.HEAPU32[s[a]>>2],d=new Uint8Array(ot.HEAPU32.subarray(f>>2,(f>>2)+o[a]));return ot.free_mesh_data(r),{positions:c,indices:u,verticesPerFace:d}}function CR(n,e,t,r){Sl===void 0&&(Sl=ot.init_csg());let i=I1(n),s=ot.csg_calc(Sl,i,n.length,r,N1(e));ot._free(i);let o=5,a=ot.HEAPU32.subarray(s>>2,(s>>2)+o),l=a.subarray(2,2+3),c=0,h=ot.HEAPU32[a[c]>>2],u=ot.HEAPF32.subarray(h>>2,(h>>2)+l[c]);c++;let f=ot.HEAPU32[a[c]>>2],d=ot.HEAPF32.subarray(f>>2,(f>>2)+l[c]);c++;let m=l[c];t.setAttribute("position",new Ae(u,3)),t.setAttribute("normal",new Ae(d,3));let p=ot.HEAPF32.subarray((s>>2)+5,(s>>2)+5+6);return t.boundingSphere===null&&(t.boundingSphere=new Br),t.boundingSphere.center.set(p[0],p[1],p[2]),t.boundingSphere.radius=(p[3]**2+p[4]**2+p[5]**2)**.5,t.userData.parameters={width:p[3]*2,height:p[4]*2,depth:p[5]*2},ot.free_mesh_data(s),m}function DR(n,e){if(ot===void 0)return-1;let t,r,i;if(e&&n.userData.positions!==void 0){let p=n.userData;i=p.verticesPerFace.length,t=p.positions,r=Array(p.verticesPerFace.reduce((g,x)=>g+x,0)+i);for(let g=0,x=0,v=0;g<p.verticesPerFace.length;g++){r[v++]=p.verticesPerFace[g];for(let w=0;w<p.verticesPerFace[g];w++)r[v++]=p.indices[x++]}}else({positions:t,faceIndices:r,nFaces:i}=TR(n,e));let s=t.length,o=r.length,a=t.length,l=r.length,c=a*Float32Array.BYTES_PER_ELEMENT+l*Uint32Array.BYTES_PER_ELEMENT,h=a*Float32Array.BYTES_PER_ELEMENT,u=l*Uint32Array.BYTES_PER_ELEMENT,f=ot._malloc(c),d=new Float32Array(ot.HEAPF32.buffer,f,a),m=new Uint32Array(ot.HEAPU32.buffer,f+h,l);return d.set(t,0),m.set(r,0),ot.get_csg_mesh(f,s,f+h,o,i)}function PR(n,e){ot.transform_csg_mesh(n,e.elements)}function LR(n){ot.free_csg_mesh(n)}var gy={ConeGeometry:gS,CubeGeometry:yS,CylinderGeometry:mS,DodecahedronGeometry:vS,EllipseGeometry:GS,HelixGeometry:WS,IcosahedronGeometry:jS,LatheGeometry:qS,NonParametricGeometry:YS,PolygonGeometry:XS,PyramidGeometry:JS,RectangleGeometry:sd,SphereGeometry:QS,PlaneGeometry:KS,BackdropGeometry:ZS,StarGeometry:$S,TextFrameGeometry:od,TorusGeometry:e1,TorusKnotGeometry:t1,TriangleGeometry:r1,VectorGeometry:Er},Sh=n=>gy[n.type].create(n);var B1=new Be;function Sy(n){let e=!1;return n.scene.objects.traverse((t,r)=>{r.geometry?.type==="BooleanGeometry"&&(e=!0)}),e}var Ed=class extends Ct{constructor(t=new Le,r=new Yr){super(t,r);this.booleanOp=2;this.phongAngle=35;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(t){if(this.booleanMeshSetAddress!==-1)return;for(let i=0;i<this.children.length;i++){let s=this.children[i];xt(s)&&s.recomputeBoolean(t===!0)}this.meshSetAddresses=[];for(let i=0;i<this.children.length;i++){let s=this.children[i];if(b1(s)&&s.booleanExclude===!1&&s.geometry.attributes.position?.count>0&&s.geometry.drawRange.count>0){if(s.booleanMeshSetAddress===-1){if(s.booleanMeshSetAddress=Qn.getMeshSet(s.geometry,t===!0),s.booleanMeshSetAddress===-1)return;Qn.transformMeshSet(s.booleanMeshSetAddress,s.matrix),s.booleanMatrixInvOld.copy(s.matrix).invert(),s.booleanWasTransformed=!1}else xt(s)&&s.needsTransformForDownstream===!0?(Qn.transformMeshSet(s.booleanMeshSetAddress,s.matrix),s.needsTransformForDownstream=!1):s.booleanWasTransformed===!0&&(B1.multiplyMatrices(s.matrix,s.booleanMatrixInvOld),Qn.transformMeshSet(s.booleanMeshSetAddress,B1),s.booleanMatrixInvOld.copy(s.matrix).invert(),s.booleanWasTransformed=!1);this.meshSetAddresses.push(s.booleanMeshSetAddress)}}if(this.meshSetAddresses.length===0){this.geometry.setDrawRange(0,0);return}if(t===!0)return Qn.calcBooleanTopological(this.meshSetAddresses,this.booleanOp);let r=this.geometry;r.dispose(),this.geometry=new Le,this.geometry.userData=r.userData,this.geometry.boundingSphere=r.boundingSphere;try{this.booleanMeshSetAddress=Qn.calcBoolean(this.meshSetAddresses,this.booleanOp,this.geometry,this.phongAngle)}catch(i){this.booleanMeshSetAddress=0,console.error(i)}this.booleanMatrixInvOld.copy(this.matrix).invert(),this.needsTransformForDownstream=!0}toJSON(t){let r=super.toJSON(t);return r.object.objectType="Mesh3D",r}updateGeometry(t){let r=t.parameters;r.operation!==void 0&&(this.booleanOp=r.operation),r.phongAngle!==void 0&&(this.phongAngle=r.phongAngle),this.invalidateDownstreamBooleanData().recomputeBoolean()}};var Si=n=>{var e;return e=class extends n{constructor(){super(...arguments);this.isObjectHelper=!0}},e.geometryHelper=new Kr(30,30,30),e};var Cd=new io,Ay=new Br,O1=new Be,Ai=(n,e,t,r,i=!1)=>{let s=e,o=n.matrixWorld;if(s.boundingSphere===null&&s.computeBoundingSphere(),Ay.copy(s.boundingSphere),Ay.applyMatrix4(o),t.ray.intersectsSphere(Ay)===!1||(O1.copy(o).invert(),Cd.copy(t.ray).applyMatrix4(O1),s.boundingBox!==null&&Cd.intersectsBox(s.boundingBox)===!1))return;let a,l,c,h,u=s.index,f=s.attributes.position,d=s.drawRange,m,p;if(i===!1){let x=Math.max(0,d.start),v=Math.min(u.count,d.start+d.count);for(m=x,p=v;m<p;m+=3)if(l=u.getX(m),c=u.getX(m+1),h=u.getX(m+2),a=g(n,t,Cd,f,l,c,h),a){a.faceIndex=Math.floor(m/3),r.push(a);return}}else{let v=s.attributes.position,w=new A,b=new A,S=new A,M=new A,_=2,T=1/((n.scale.x+n.scale.y+n.scale.z)/3),E=T*T,C=Math.max(0,d.start),I=Math.min(v.count,d.start+d.count);for(let B=C,N=I-1;B<N;B+=_){if(w.fromBufferAttribute(v,B),b.fromBufferAttribute(v,B+1),Cd.distanceSqToSegment(w,b,M,S)>E)continue;M.applyMatrix4(n.matrixWorld);let j=t.ray.origin.distanceTo(M);j<t.near||j>t.far||r.push({distance:j,point:S.clone().applyMatrix4(n.matrixWorld),object:n})}}function g(x,v,w,b,S,M,_){let y=new A,T=new A,E=new A,C=new A,I=new A;if(y.fromBufferAttribute(b,S),T.fromBufferAttribute(b,M),E.fromBufferAttribute(b,_),w.intersectTriangle(y,T,E,!1,C)===null)return null;I.copy(C),I.applyMatrix4(x.matrixWorld);let N=v.ray.origin.distanceTo(I);return N<v.near||N>v.far?null:{faceIndex:1,distance:N,point:I.clone(),object:x}}};var Dd=new A,Pn=new Un,My=class extends gs{constructor(t){let r=new Le,i=new Zr({color:16777215,vertexColors:!0,toneMapped:!1}),s=[],o=[],a={},l=new Se(15711266),c=new Se(15711266),h=new Se(2857471);u("n1","n2",l),u("n2","n4",l),u("n4","n3",l),u("n3","n1",l),u("f1","f2",l),u("f2","f4",l),u("f4","f3",l),u("f3","f1",l),u("n1","f1",l),u("n2","f2",l),u("n3","f3",l),u("n4","f4",l),u("p","n1",c),u("p","n2",c),u("p","n3",c),u("p","n4",c),u("u1","u2",h),u("u2","u3",h),u("u3","u1",h);function u(d,m,p){f(d,p),f(m,p)}function f(d,m){s.push(0,0,0),o.push(m.r,m.g,m.b),a[d]===void 0&&(a[d]=[]),a[d].push(s.length/3-1)}r.setAttribute("position",new Ae(s,3)),r.setAttribute("color",new Ae(o,3));super(r,i);this.type="CameraHelper",this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update()}update(){let t=this.geometry,r=this.pointMap,i=!0;Pn.projectionMatrixInverse.elements=[.5112609807824982,-0,-0,-0,-0,.41421356237309503,-0,-0,-0,-0,-0,-.099999,-0,-0,-1.0000000000000002,.100001];let s=1,o=1,a=i?.8:1e-4;Kn("n1",r,t,Pn,-s,-o,a),Kn("n2",r,t,Pn,s,-o,a),Kn("n3",r,t,Pn,-s,o,a),Kn("n4",r,t,Pn,s,o,a);let l=a;Kn("f1",r,t,Pn,-s,-o,l),Kn("f2",r,t,Pn,s,-o,l),Kn("f3",r,t,Pn,-s,o,l),Kn("f4",r,t,Pn,s,o,l);let c=l,h=.5;Kn("u1",r,t,Pn,s*.7*h,o*1.1,c),Kn("u2",r,t,Pn,-s*.7*h,o*1.1,c),Kn("u3",r,t,Pn,0,o*(1.1+.9*h),c),t.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}};function Kn(n,e,t,r,i,s,o){Dd.set(i,s,o).unproject(r);let a=e[n];if(a!==void 0){let l=t.getAttribute("position");for(let c=0,h=a.length;c<h;c++)l.setXYZ(a[c],Dd.x,Dd.y,Dd.z)}}var Pd=class extends Si(My){constructor(t){super(t);this.object=t;this.object=t,this.name=`CombinedCameraHelper: ${t.uuid}`}updateMatrixWorld(t){super.updateMatrixWorld(t),this.updateTarget()}updateTarget(){let t=this.object.getTarget();this.updateWorldMatrix(!0,!1),this.worldToLocal(t)}raycast(t,r){Ai(this.object,this.geometry,t,r,!0)}};var Al=class extends Si(Lu){constructor(t,r=15,i=10066329){super(t,r,i);this.object=t;this.added=!1;this.name=`DirectionalLightHelper: ${t.uuid}`}raycast(t,r){Ai(this.object,Al.geometryHelper,t,r)}};var Ml=class extends Si(Iu){constructor(t,r=15){super(r);this.object=t;this.object.updateMatrixWorld(),this.name=`EmptyObjectHelper: ${t.uuid}`,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1}raycast(t,r){Ai(this.object,Ml.geometryHelper,t,r)}update(){}};var _l=class extends Si(Pu){constructor(t,r=15,i=6710886){super(t,r,i);this.object=t;this.name=`PointLightHelper: ${t.uuid}`}raycast(t,r){Ai(this.object,_l.geometryHelper,t,r)}};var Ld=class extends Si(Du){constructor(t,r=6710886){super(t,r);this.object=t;this.name=`SpotLightHelper: ${t.uuid}`}raycast(t,r){Ai(this.object,Ld.geometryHelper,t,r)}update(){if(this.object!==void 0){let t=Ld._vector,r=this.object.distance?this.object.distance:1e3,i=r*Math.tan(this.object.angle);this.cone.scale.set(i,i,r),t.setFromMatrixPosition(this.object.target.matrixWorld),this.cone.lookAt(t);let s=this.color!==void 0?this.color:this.light.color;if(this.cone.material instanceof Array)for(let o=0,a=this.cone.material.length;o<a;o++)this.cone.material[o].color.set(s);else this.cone.material.color.set(s)}}},Ah=Ld;Ah._vector=new A;var Mi=(n,e)=>class extends n{constructor(){super(...arguments);this.objectHelper=new e(this);this.enableHelper=!1}set visibility(i){this.visible=i,this.setHelperVisibility(i),this.setHelperChildrenVisibility(i)}get visibility(){return this.visible}get geometryHelper(){return e.geometryHelper}setHelperVisibility(i){this.objectHelper.visible=i}setHelperChildrenVisibility(i){for(let s of this.children)En(s)&&s.traverseEntity(o=>{Xi(o)&&o.visible&&(o.objectHelper.visible=i)})}raycast(i,s){this.objectHelper.raycast(i,s)}copy(i,s=!0){return super.copy(i,s),i.enableHelper!==void 0&&(this.enableHelper=i.enableHelper),i.objectHelper!==void 0&&(this.objectHelper.visible=i.objectHelper.visible),this}toJSON(i){let s=super.toJSON(i),o=s.object;return o.enableHelper=this.enableHelper,s}fromJSON(i){return super.fromJSON(i),i.enableHelper!==void 0&&(this.enableHelper=!0),this}fromLightState(i,s){if(this.objectType==="LightDirectional"||this.objectType==="LightPoint"||this.objectType==="LightSpot"){let o=this;i.color!==void 0&&(o.color=Zt(i.color,s)),i.intensity!==void 0&&(o.intensity=i.intensity),i.depth!==void 0&&(o.shadow.camera.far=i.depth,o.shadow.needsUpdate=!0),i.shadows!==void 0&&(this.castShadow=i.shadows),i.helper!==void 0&&(this.enableHelper=i.helper,o.gizmos.shadowmap.visible=i.helper)}return this}};var Tl=new A,_y=new A,yn=class extends Mi(Cn(Un),Pd){constructor(t=window.innerWidth,r=window.innerHeight,i=45,s,o=1e5){super();this.objectType="CombinedCamera";this._cameraType="OrthographicCamera";this.targetOffset=So.DefaultTargetOffset;this.isUpVectorFlipped=!1;this.angleOffsetFromUp=0;this.width=t,this.height=r,this.orthoCamera=new oa(t*-.5,t*.5,r*.5,r*-.5,s??-5e4,o),this.perspCamera=new Jt(i,t/r,s??50,o),this.left=this.orthoCamera.left,this.right=this.orthoCamera.right,this.top=this.orthoCamera.top,this.bottom=this.orthoCamera.bottom,this.far=this.orthoCamera.far,this.view=this.orthoCamera.view,this.aspect=this.perspCamera.aspect,this.fov=this.perspCamera.fov,this.focus=this.perspCamera.focus,this.filmGauge=this.perspCamera.filmGauge,this.filmOffset=this.perspCamera.filmOffset,this.toOrthographic(!0)}static createFromState(t,r){let i=new yn().fromState(r);return i.enableHelper=!0,i.objectHelper.update(),i.uuid=t,i}get isPerspectiveCamera(){return this.cameraType==="PerspectiveCamera"}get isOrthographicCamera(){return!this.isPerspectiveCamera}get cameraType(){return this._cameraType}setNear(t,r){t==="PerspectiveCamera"?this.perspCamera.near=r:this.orthoCamera.near=r}setZoom(t,r){r>=0&&(t==="PerspectiveCamera"?this.perspCamera.zoom=r:this.orthoCamera.zoom=r)}set cameraType(t){t==="PerspectiveCamera"?this.toPerspective():t==="OrthographicCamera"&&this.toOrthographic()}get near(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.near:this.orthoCamera.near}set near(t){this._cameraType==="PerspectiveCamera"?this.perspCamera.near=t:this.orthoCamera.near=t}get zoom(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom:this.orthoCamera.zoom}set zoom(t){t>=0&&(this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom=t:this.orthoCamera.zoom=t)}lookAt(t){super.lookAt(t),this.getWorldPosition(Tl),this.targetOffset=Tl.distanceTo(t)}getTarget(t=new A){return this.getWorldDirection(_y),this.getWorldPosition(Tl),_y.multiplyScalar(this.targetOffset),t.copy(Tl).add(_y),t}getDistanceToTarget(){let t=this.getTarget();return this.getWorldPosition(Tl),Tl.distanceTo(t)}updateUp(){let t=this.getWorldQuaternion(new jt),r=new A(0,0,1).applyQuaternion(t),i=new A().copy(lt.DefaultUp);this.isUpVectorFlipped&&i.negate(),i.applyQuaternion(t);let s=new A().copy(lt.DefaultUp).projectOnPlane(r),o=new A().crossVectors(s,i).dot(r)>=0?1:-1;this.angleOffsetFromUp=s.angleTo(i)*o}getViewFrontToObject(t){let r=t.getWorldPosition(new A),s=t.getWorldDirection(new A).multiplyScalar(this.targetOffset);return{position:r.clone().add(s),target:r}}getViewToObject(t){let r=t.getWorldPosition(new A),s=this.getWorldDirection(new A).multiplyScalar(this.targetOffset);return{position:r.clone().sub(s),target:r}}setViewplaneSize(t,r){this.left=-t*.5,this.right=t*.5,this.top=r*.5,this.bottom=-r*.5,this.aspect=t/r,this.updateProjectionMatrix()}toOrthographic(t){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||t===!0)&&this.objectHelper.update()}toPerspective(t){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||t===!0)&&this.objectHelper.update()}setFocalLength(t){this.perspCamera.setFocalLength(t),this.toPerspective()}getFocalLength(){return this.perspCamera.getFocalLength()}getEffectiveFOV(){return this.perspCamera.getEffectiveFOV()}getFilmWidth(){return this.perspCamera.getFilmWidth()}getFilmHeight(){return this.perspCamera.getFilmHeight()}setViewOffset(t,r,i,s,o,a){this._cameraType==="PerspectiveCamera"?this.perspCamera.setViewOffset(t,r,i,s,o,a):this.orthoCamera.setViewOffset(t,r,i,s,o,a)}clearViewOffset(){this._cameraType==="PerspectiveCamera"?(this.perspCamera.clearViewOffset(),this.toPerspective()):(this.orthoCamera.clearViewOffset(),this.toOrthographic())}updateProjectionMatrix(t){this._cameraType==="PerspectiveCamera"?this.toPerspective(t):this._cameraType==="OrthographicCamera"&&this.toOrthographic(t)}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,r){super.updateWorldMatrix(t,r),this.matrixWorldInverse.copy(this.matrixWorld).invert()}copy(t,r){return super.copy(t,r),this.orthoCamera.copy(t.orthoCamera),this.perspCamera.copy(t.perspCamera),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.far=t.far,this.view=t.view===null?null:Object.assign({},t.view),this._cameraType=t._cameraType,this.aspect=t.aspect,this.fov=t.fov,this.focus=t.focus,this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this.targetOffset=t.targetOffset,this.updateProjectionMatrix(),this}fromCameraRender(t){let r={near:this.orthoCamera.near,far:this.orthoCamera.far},i={near:this.perspCamera.near,far:this.perspCamera.far};return this.copy(t),this.name="",this.enableHelper=!0,this.objectHelper.visible=!0,this.orthoCamera.near=r.near,this.orthoCamera.far=r.far,this.perspCamera.near=i.near,this.perspCamera.far=i.far,this.updateProjectionMatrix(),this}toJSON(t){let r=super.toJSON(t),i=r.object;return i.objectType="CombinedCamera",i.cameraType=this.cameraType,i.targetOffset=this.targetOffset,i.isUpVectorFlipped=this.isUpVectorFlipped,i.angleOffsetFromUp=this.angleOffsetFromUp,i.left=this.left,i.right=this.right,i.top=this.top,i.bottom=this.bottom,this.view!==null&&(i.view=Object.assign({},this.view)),i.zoomOrtho=this.orthoCamera.zoom,i.nearOrtho=this.orthoCamera.near,i.far=this.far,i.aspect=this.aspect,i.fov=this.fov,i.focus=this.focus,i.filmGauge=this.filmGauge,i.filmOffset=this.filmOffset,i.zoomPersp=this.perspCamera.zoom,i.nearPersp=this.perspCamera.near,r}fromJSON(t){if(super.fromJSON(t),this.cameraType=t.cameraType,t.targetOffset!==void 0&&(this.targetOffset=t.targetOffset),t.orbitControlsTarget!==void 0){let r=this.getWorldPosition(new A),i=new A().fromArray(t.orbitControlsTarget);this.targetOffset=i.distanceTo(r)}else t.targetOffset!==void 0&&(this.targetOffset=t.targetOffset);return this.isUpVectorFlipped=!1,this.angleOffsetFromUp=t.angleOffsetFromUp??0,t.left!==void 0&&(this.left=t.left),t.right!==void 0&&(this.right=t.right),t.top!==void 0&&(this.top=t.top),t.bottom!==void 0&&(this.bottom=t.bottom),t.view!==void 0&&(this.view=Object.assign({},t.view)),t.zoomOrtho!==void 0&&(this.orthoCamera.zoom=t.zoomOrtho),t.nearOrtho!==void 0&&(this.orthoCamera.near=t.nearOrtho),t.far!==void 0&&(this.far=t.far),t.aspect!==void 0&&(this.aspect=t.aspect),t.fov!==void 0&&(this.fov=t.fov),t.focus!==void 0&&(this.focus=t.focus),t.filmGauge!==void 0&&(this.filmGauge=t.filmGauge),t.filmOffset!==void 0&&(this.filmOffset=t.filmOffset),t.zoomPersp!==void 0&&(this.perspCamera.zoom=t.zoomPersp),t.nearPersp!==void 0&&(this.perspCamera.near=t.nearPersp),this.updateProjectionMatrix(),this}toCameraState(t=[]){let r={type:this.cameraType,far:this.far,orthographic:{near:this.orthoCamera.near,zoom:this.orthoCamera.zoom},perspective:{near:this.perspCamera.near,fov:this.perspCamera.fov,zoom:this.perspCamera.zoom},up:this.up.toArray(),targetOffset:this.targetOffset,isUpVectorFlipped:this.isUpVectorFlipped};return ja(r,t)}fromCameraState(t){let{orthographic:r,perspective:i}=t;return t.type!==void 0&&(this.cameraType=t.type),t.far!==void 0&&(this.far=t.far),r!==void 0&&(r.near!==void 0&&(this.orthoCamera.near=r.near),r.zoom!==void 0&&(this.orthoCamera.zoom=r.zoom)),i!==void 0&&(i.near!==void 0&&(this.perspCamera.near=i.near),i.fov!==void 0&&(this.perspCamera.fov=i.fov),i.zoom!==void 0&&(this.perspCamera.zoom=i.zoom)),t.up!==void 0&&this.up.fromArray(t.up),t.targetOffset!==void 0&&(this.targetOffset=t.targetOffset),t.isUpVectorFlipped!==void 0&&(this.isUpVectorFlipped=t.isUpVectorFlipped),this.updateProjectionMatrix(),this}toState(t){return{...super.toState(t),...this.toCameraState(t),type:this.cameraType}}fromState(t){return super.fromState(t),this.fromCameraState(t),this}};var Ji=class extends Mi(Cn(ls),Ml){constructor(){super(...arguments);this.objectType="EmptyObject"}static createFromState(t,r){let i=new Ji().fromState(r);return i.uuid=t,i.enableHelper=!0,i.objectHelper.update(),i}toJSON(t){let r=super.toJSON(t);return r.object.objectType="EmptyObject",r}};var El=class extends Mi(Cn(_u),Al){constructor(...t){super(...t);this.objectType="LightDirectional";this._gizmos={};this.castShadow=!0,this.shadow.mapSize.width=2048,this.shadow.mapSize.height=2048,this.shadow.normalBias=1;let i=this.shadow.camera;i.top=1250,i.bottom=-1250,i.right=1250,i.left=-1250,i.near=-1e4,i.far=2500;let s=new Sn(this.shadow.camera);s.visible=!1,this._gizmos.shadowmap=s,this.update()}static createFromState(t,r,i){let s=new El().fromState(r,i);return s.uuid=t,s}get gizmos(){return this._gizmos}showGizmos(){for(let t in this._gizmos){let r=this._gizmos[t];r instanceof Sn&&(r.visible=!0)}}hideGizmos(){for(let t in this._gizmos){let r=this._gizmos[t];r instanceof Sn&&(r.visible=!1)}}update(){this.shadow.camera.updateProjectionMatrix();for(let t in this._gizmos){let r=this._gizmos[t];r instanceof Sn&&r.update()}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.enableHelper===!0&&this.objectHelper.visible===!0&&this.objectHelper.update()}copy(t,r=!0){return super.copy(t,r),this.color.copy(t.color),this.intensity=t.intensity,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}toJSON(t){let r=super.toJSON(t),i=r.object;return i.objectType="LightDirectional",i.color=this.color.getHex(),i.intensity=this.intensity,i.shadow=this.shadow.toJSON(),r}fromJSON(t){super.fromJSON(t),this.color.set(t.color),this.intensity=t.intensity,this.shadow.normalBias=t.shadow.normalBias??0,this.shadow.radius=t.shadow.radius,this.shadow.mapSize.fromArray(t.shadow.mapSize);let r=this.shadow.camera,i=t.shadow.camera;return r.near=i.near,r.far=i.far,r.zoom=i.zoom,r.left=i.left,r.right=i.right,r.top=i.top,r.bottom=i.bottom,i.view!==void 0&&(r.view=Object.assign({},i.view)),this}fromDirectionalLightState(t,r){let i=t.depth!==void 0&&t.depth!==this.shadow.camera.far||t.size!==void 0&&t.size/2!==this.shadow.camera.right;return super.fromLightState(t,r),t.size!==void 0&&y1(this,t.size),t.shadowRadius!==void 0&&(this.shadow.radius=t.shadowRadius),t.shadowResolution!==void 0&&(this.shadow.mapSize.set(t.shadowResolution,t.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null)),i&&this.update(),this}fromState(t,r){return super.fromState(t),this.fromDirectionalLightState(t,r),this}};var Cl=class extends Mi(Cn(Mu),_l){constructor(...t){super(...t);this.objectType="LightPoint";this._gizmos={};this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024,this.shadow.normalBias=1;let i=this.shadow.camera;i.fov=90,i.aspect=1,i.near=100,i.far=2500;let s=new A(-i.far+this.position.x,-i.far+this.position.y,-i.far+this.position.z),o=new A(i.far+this.position.x,i.far+this.position.y,i.far+this.position.z),a=new yr(s,o),l=new mo(a,new Se(16755200));l.visible=!1,this._gizmos.shadowmap=l,this.update()}static createFromState(t,r,i){let s=new Cl().fromState(r,i);return s.uuid=t,s}get gizmos(){return this._gizmos}showGizmos(){for(let t in this._gizmos){let r=this._gizmos[t];r instanceof mo&&(r.visible=!0)}}hideGizmos(){for(let t in this._gizmos){let r=this._gizmos[t];r instanceof mo&&(r.visible=!1)}}update(){if(this.shadow&&(this.shadow.camera.updateProjectionMatrix(),this._gizmos))for(let t in this._gizmos){let r=this._gizmos[t];if(r instanceof mo){let i=this.shadow.camera,s=new A(-i.far+this.position.x,-i.far+this.position.y,-i.far+this.position.z),o=new A(i.far+this.position.x,i.far+this.position.y,i.far+this.position.z);r.box.set(s,o),r.updateMatrixWorld(!0)}}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.enableHelper===!0&&this.objectHelper.visible===!0&&this.objectHelper.update()}copy(t,r=!0){return super.copy(t,r),this.color.copy(t.color),this.intensity=t.intensity,this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}toJSON(t){let r=super.toJSON(t),i=r.object;return i.objectType="LightPoint",i.color=this.color.getHex(),i.intensity=this.intensity,i.distance=this.distance,i.decay=this.decay,i.shadow=this.shadow.toJSON(),r}fromJSON(t){super.fromJSON(t),this.color.set(t.color),this.intensity=t.intensity,this.distance=t.distance,this.decay=t.decay,this.shadow.normalBias=t.shadow.normalBias??0,this.shadow.radius=t.shadow.radius,this.shadow.mapSize.fromArray(t.shadow.mapSize??[512,512]),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null);let r=this.shadow.camera,i=t.shadow.camera;return r.near=i.near,r.far=i.far,r.zoom=i.zoom,r.fov=i.fov,r.focus=i.focus,r.aspect=i.aspect,r.filmGauge=i.filmGauge,r.filmOffset=i.filmOffset,i.view!==void 0&&(r.view=Object.assign({},i.view)),this}fromPointLightState(t,r){return super.fromLightState(t,r),t.distance!==void 0&&(this.distance=t.distance),t.decay!==void 0&&(this.decay=t.decay),t.shadowRadius!==void 0&&(this.shadow.radius=t.shadowRadius),t.shadowResolution!==void 0&&(this.shadow.mapSize.set(t.shadowResolution,t.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null)),this}fromState(t,r){return super.fromState(t),this.fromPointLightState(t,r),this}};var R1=new A,F1=new A,z1=new jt,Dl=class extends Mi(Cn(Au),Ah){constructor(...t){super(...t);this.objectType="LightSpot";this._gizmos={};this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024,this.shadow.normalBias=1;let i=this.shadow.camera;i.fov=je.RAD2DEG*2*this.angle,i.aspect=1,i.near=100,i.far=2500;let s=new Sn(this.shadow.camera);s.visible=!1,this._gizmos.shadowmap=s,this.update()}static createFromState(t,r,i){let s=new Dl().fromState(r,i);return s.uuid=t,s}get gizmos(){return this._gizmos}showGizmos(){for(let t in this._gizmos){let r=this._gizmos[t];r instanceof Sn&&(r.visible=!0)}}hideGizmos(){for(let t in this._gizmos){let r=this._gizmos[t];r instanceof Sn&&(r.visible=!1)}}update(){this.shadow.camera.updateProjectionMatrix();for(let t in this._gizmos){let r=this._gizmos[t];r instanceof Sn&&r.update()}}updateMatrixWorld(t){super.updateMatrixWorld(t),F1.setFromMatrixPosition(this.matrixWorld),z1.setFromRotationMatrix(this.matrixWorld),R1.copy(this.up).applyQuaternion(z1).negate().multiplyScalar(this.distance),this.target.position.copy(F1).add(R1),this.target.updateMatrixWorld(),this.enableHelper===!0&&this.objectHelper.visible===!0&&this.objectHelper.update()}copy(t,r=!0){return super.copy(t,r),this.color.copy(t.color),this.intensity=t.intensity,this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}toJSON(t){let r=super.toJSON(t),i=r.object;return i.objectType="LightSpot",i.color=this.color.getHex(),i.intensity=this.intensity,i.distance=this.distance,i.angle=this.angle,i.decay=this.decay,i.penumbra=this.penumbra,i.shadow=this.shadow.toJSON(),r}fromJSON(t){super.fromJSON(t),this.color.set(t.color),this.intensity=t.intensity,this.distance=t.distance,this.angle=t.angle,this.decay=t.decay,this.penumbra=t.penumbra,this.shadow.normalBias=t.shadow.normalBias??0,this.shadow.radius=t.shadow.radius,this.shadow.mapSize.fromArray(t.shadow.mapSize);let r=this.shadow.camera,i=t.shadow.camera;return r.near=i.near,r.far=i.far,r.zoom=i.zoom,r.fov=i.fov,r.focus=i.focus,r.aspect=i.aspect,r.filmGauge=i.filmGauge,r.filmOffset=i.filmOffset,i.view!==void 0&&(r.view=Object.assign({},i.view)),this}fromSpotLightState(t,r){return super.fromLightState(t,r),t.distance!==void 0&&(this.distance=t.distance),t.decay!==void 0&&(this.decay=t.decay),t.angle!==void 0&&(this.angle=t.angle),t.penumbra!==void 0&&(this.penumbra=t.penumbra),t.shadowRadius!==void 0&&(this.shadow.radius=t.shadowRadius),t.shadowResolution!==void 0&&(this.shadow.mapSize.set(t.shadowResolution,t.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null)),this}fromState(t,r){return super.fromState(t),this.fromSpotLightState(t,r),this}};var U1=n=>n.tagName==="VIDEO",Po=class{static resize(e,t,r){let i=e/t,s;if(!r.image)return;let o=r.image;U1(o)?s=o.videoWidth/o.videoHeight:s=o.width/o.height,i>s&&(r.imageType=="WEBCAM"?r.repeat.set(-1,1*s/i):r.repeat.set(1,1*s/i)),i<s&&(r.imageType=="WEBCAM"?r.repeat.set(1*i/s*-1,1):r.repeat.set(1*i/s,1)),i==s&&(r.imageType=="WEBCAM"?r.repeat.set(-1,1):r.repeat.set(1,1))}static resizeTextureLayer(e,t,r){let i=e/t,s=r.image!==void 0?r.image.width/r.image.height:1,o;i>s?o={x:1,y:s/i}:i<s?o={x:i/s,y:1}:o={x:1,y:1},r.repeat.set(o.x,o.y),r.updateMatrix()}static resizeTextureLayers(e,t,r){let i=r.userData.layers,s=i.getLayers();for(let o=0;o<s.length;o++){let a=s[o];a1(a)&&(Po.resizeTextureLayer(e,t,a.uniforms[`f${a.id}_texture`].value),i.updateLayerUniform())}}static resizeComplex(e,t,r,i){let s=e/t,o,a=r.image;U1(a)?o=a.videoWidth/a.videoHeight:o=a.width/a.height,i.geometry.type.includes("Shape")?(s>o&&(r.imageType=="WEBCAM"?r.repeat.set(1/e*-1,1/t*o/s):r.repeat.set(1/e,1/t*o/s)),s<o&&(r.imageType=="WEBCAM"?r.repeat.set(1/e*s/o*-1,1/t):r.repeat.set(1/e*s/o,1/t)),s==o&&(r.imageType=="WEBCAM"?r.repeat.set(1/e*-1,1/t):r.repeat.set(1/e,1/t))):(s>o&&(r.imageType=="WEBCAM"?r.repeat.set(-1,1*o/s):r.repeat.set(1,1*o/s)),s<o&&(r.imageType=="WEBCAM"?r.repeat.set(1*s/o*-1,1):r.repeat.set(1*s/o,1)),s==o&&(r.imageType=="WEBCAM"?r.repeat.set(-1,1):r.repeat.set(1,1)))}};var Pl=class extends Ct{constructor(t,r=new Ir){super(t,r);this.objectType="Mesh2D";this.castShadow=!0,this.receiveShadow=!0}updateGeometry(t){super.updateGeometry(t),this.material.userData.layers&&Po.resizeTextureLayers(this.geometry.userData.parameters.width,this.geometry.userData.parameters.height,this.material)}resizeGeometry(t,r){super.resizeGeometry(t,r,0),this.material.userData.layers&&Po.resizeTextureLayers(this.geometry.userData.parameters.width,this.geometry.userData.parameters.height,this.material)}toJSON(t){let r=super.toJSON(t);return r.object.objectType="Mesh2D",r}clone(){let t=super.clone();return t.updateGeometry({}),t}static fromTexture(t){let r,i;if(t instanceof wu){let a=t.image;r=a.videoWidth*.5,i=a.videoHeight*.5}else{let a=t.image;r=a.width*.5,i=a.height*.5}let s=sd.create({parameters:{width:r,height:i}}),o=new Ir;return o.layersList.changeLayer(0,{type:"texture",texture:t}),o.layersList.moveLayer(0,1),o.dispose(),new Pl(s,o)}};var Ll=class extends Ct{constructor(t,r=new Yr){super(t,r);this.objectType="Mesh3D";this.castShadow=!0,this.receiveShadow=!0}toJSON(t){let r=super.toJSON(t);return r.object.objectType="Mesh3D",r}};var Il=class extends Ll{constructor(t,r=new Yr){super(t,r);this.objectType="NonParametric"}toJSON(t){let r=super.toJSON(t);return r.object.objectType="NonParametric",r}};var Id=class extends vs{constructor(e){super(e)}load(e,t,r,i){let s=this,o=new xs(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(s.withCredentials),o.load(e,function(a){let l;try{l=JSON.parse(a)}catch{console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),l=JSON.parse(a.substring(65,a.length-2))}let c=s.parse(l);t&&t(c)},r,i)}parse(e){return new Ty(e)}},Ty=class{constructor(e){this.isFont=!0,this.type="Font",this.data=e}generateShapes(e,t=100){let r=[],i=NR(e,t,this.data);for(let s=0,o=i.length;s<o;s++)Array.prototype.push.apply(r,i[s].toShapes());return r}};function NR(n,e,t){let r=Array.from(n),i=e/t.resolution,s=(t.boundingBox.yMax-t.boundingBox.yMin+t.underlineThickness)*i,o=[],a=0,l=0;for(let c=0;c<r.length;c++){let h=r[c];if(h===`
|
|
4492
4492
|
`)a=0,l-=s;else{let u=BR(h,i,a,l,t);a+=u.offsetX,o.push(u.path)}}return o}function BR(n,e,t,r,i){let s=i.glyphs[n]||i.glyphs["?"];if(!s){console.error('THREE.Font: character "'+n+'" does not exists in font family '+i.familyName+".");return}let o=new Nu,a,l,c,h,u,f,d,m;if(s.o){let p=s._cachedOutline||(s._cachedOutline=s.o.split(" "));for(let g=0,x=p.length;g<x;)switch(p[g++]){case"m":a=p[g++]*e+t,l=p[g++]*e+r,o.moveTo(a,l);break;case"l":a=p[g++]*e+t,l=p[g++]*e+r,o.lineTo(a,l);break;case"q":c=p[g++]*e+t,h=p[g++]*e+r,u=p[g++]*e+t,f=p[g++]*e+r,o.quadraticCurveTo(u,f,c,h);break;case"b":c=p[g++]*e+t,h=p[g++]*e+r,u=p[g++]*e+t,f=p[g++]*e+r,d=p[g++]*e+t,m=p[g++]*e+r,o.bezierCurveTo(u,f,d,m,c,h);break}}return{offsetX:s.ha*e,path:o}}var $t=class extends ir{constructor({char:t,originalChar:r,fontFamily:i,letterSpacing:s,fontSize:o,LOD:a=16},l=new zn({color:0,opacity:1,visible:!0,transparent:!0,side:Wt})){let c=$t.loadChar(t,i,a);super(c.geometry,l);this.char=t,this.originalChar=r??t,this.fontFamily=i,this.letterSpacing=s,this.fontSize=o,this.LOD=a,this.resolution=c.resolution,this.glyphsHa=c.glyphsHa,this.localPosition=new O,this.charSize=0,this.geometry.userData={type:"CharacterGeometry",parameters:{char:this.char,fontFamily:this.fontFamily,letterSpacing:this.letterSpacing,fontSize:this.fontSize,lod:this.LOD,resolution:this.resolution,charSize:this.charSize,localPosition:this.localPosition}},this.updateFontSize(this.fontSize)}static get FONTS_PATH(){return $t._fontPath}static set FONTS_PATH(t){$t._fontPath=t}updatePosition(t,r){this.localPosition.copy(t);let i=new A(this.localPosition.x,-this.localPosition.y,0);this.position.copy(i).add(r)}updateFontSize(t){let r=t/this.resolution;this.fontSize=t,this.scale.set(this.fontSize,this.fontSize,1),this.charSize=this.glyphsHa*r*this.letterSpacing}updateFontFamily(t){if(this.fontFamily===t)return;this.fontFamily=t;let r=$t.loadChar(this.char,t,this.LOD);this.geometry=r.geometry,this.resolution=r.resolution,this.glyphsHa=r.glyphsHa,this.geometry.userData={type:"CharacterGeometry",parameters:{char:this.char,fontFamily:this.fontFamily,letterSpacing:this.letterSpacing,fontSize:this.fontSize,lod:this.LOD,resolution:this.resolution,charSize:this.charSize,localPosition:this.localPosition}},this.updateFontSize(this.fontSize)}updateChar(t){if(this.char===t)return;this.char=t;let r=$t.loadChar(t,this.fontFamily,this.LOD);this.geometry=r.geometry,this.resolution=r.resolution,this.glyphsHa=r.glyphsHa,this.geometry.userData={type:"CharacterGeometry",parameters:{char:this.char,fontFamily:this.fontFamily,letterSpacing:this.letterSpacing,fontSize:this.fontSize,lod:this.LOD,resolution:this.resolution,charSize:this.charSize,localPosition:this.localPosition}},this.updateFontSize(this.fontSize)}updateLetterSpacing(t){this.letterSpacing!==t&&(this.letterSpacing=t,this.updateFontSize(this.fontSize))}updateLOD(t){if(this.LOD===t)return;this.LOD=t;let r=$t.loadChar(this.char,this.fontFamily,this.LOD);this.geometry=r.geometry,this.resolution=r.resolution,this.glyphsHa=r.glyphsHa,this.geometry.userData={type:"CharacterGeometry",parameters:{char:this.char,fontFamily:this.fontFamily,letterSpacing:this.letterSpacing,fontSize:this.fontSize,lod:this.LOD,resolution:this.resolution,charSize:this.charSize,localPosition:this.localPosition}},this.updateFontSize(this.fontSize)}clone(){let t={char:this.char,originalChar:this.originalChar,fontFamily:this.fontFamily,letterSpacing:this.letterSpacing,fontSize:this.fontSize,LOD:this.LOD};return new $t(t).copy(this)}static loadFont(t){return new Promise(function(r,i){$t.fontCache[t]?r($t.fontCache[t]):new Id().load($t.FONTS_PATH+t+".json",o=>{$t.fontCache[t]=o,r(o)},void 0,i)})}static loadChar(t,r,i){if($t.charCache[t]){if($t.charCache[t][i]&&$t.charCache[t][i].fontFamily===r)return $t.charCache[t][i]}else $t.charCache[t]={};let s=$t.fontCache[r],o=s.generateShapes(t,1);return $t.charCache[t][i]={geometry:new pa(o,i),fontFamily:r,resolution:s.data.resolution,glyphsHa:s.data.glyphs[t].ha},$t.charCache[t][i]}},Xr=$t;Xr.charCache={},Xr.fontCache={},Xr._fontPath="/_assets/_fonts/";var Nd=new O,Vs=class{constructor(e,t,r){this.message=[];this.endLine=!0;this.yLinePos=e,this.lineHeight=t,this.maxCharSize=r,this.nextChar3DPos=new O(0,this.yLinePos+this.maxCharSize*this.lineHeight),this.align=1}addChar3D(e,t,r=this.message.length){this.message.splice(r,0,e),e.fontSize>this.maxCharSize?(this.maxCharSize=e.fontSize,this.nextChar3DPos.y=this.yLinePos+this.maxCharSize*this.lineHeight,this.fullUpdate(t)):(e.updatePosition(this.nextChar3DPos,t),this.nextChar3DPos.x+=e.charSize)}deleteChar3D(e=this.message.length-1){let t=this.message[e];if(t)return this.message.splice(e,1),this.nextChar3DPos.x-=t.charSize,t}isEndLine(e){this.endLine=e}fullUpdate(e,t=0){this.nextChar3DPos.x=0;for(let r=t,i=this.message.length;r<i;r+=1)this.message[r].updatePosition(this.nextChar3DPos,e),this.nextChar3DPos.x+=this.message[r].charSize}checkOverFlow(e){let t,r=this.message.length-1;if(r<=0)return!1;for(;r>=0;){if(this.message[r].char!==" "){t=this.message[r];break}r-=1}return!!(r>=0&&t&&t.localPosition.x+t.charSize>e)}containSpaceOverFlow(e=this.message.length-1){for(let t=e;t>=0;t-=1)if(this.message[t].char===" ")return!0;return!1}containSpace(e=this.message.length-1){if(this.endLine)return!0;for(let t=e;t>=0;t-=1)if(this.message[t].char===" ")return!0;return!1}popWord(e=this.message.length-1){let t=[],r=!0,i;for(i=e;i>=0;i-=1)if(this.message[i].char===" "){r=!1,t.length===0&&(i-=1,t.splice(0,0,this.message[i]));break}else t.splice(0,0,this.message[i]);return r?t=[]:this.message.splice(i+1,t.length),t}getWord(e=0,t=1){let r=[],i=e;for(i=e;;i+=t){if(!this.message[i]||this.message[i].char===" "){r.length===0&&this.message[i]&&(r.push(this.message[i]),this.message.splice(i,1));break}t>0?(r.push(this.message[i]),this.message.splice(i,1),i-=t):(r.splice(0,0,this.message[i]),this.message.splice(i,1))}return r}getWordAtIndex(e){let t=[];for(let r=e;r<this.message.length&&this.message[r].char!==" ";r++)t.push(this.message[r]);for(let r=e-1;r>=0&&this.message[r].char!==" ";r--)t.splice(0,0,this.message[r]);return t}wordSize(e=0,t=-1){let r=0,i=e;for(;i>=0&&i<this.message.length;){if(this.message[i].char===" "){r===0&&(r=this.message[i].charSize);break}r+=this.message[i].charSize,i+=t}return(i<0||i>=this.message.length)&&!this.endLine?this.message[e]?this.message[e].charSize:999999999:r===0?999999999:r}spaceLeft(e){return e-this.nextChar3DPos.x}popChar(e=this.message.length-1){return this.nextChar3DPos.x-=this.message[e].charSize,this.message.splice(e,1)}isEmpty(){return!this.message.length}updateNextCharPosY(){this.nextChar3DPos.y=this.yLinePos+this.maxCharSize*this.lineHeight}updateYLinePos(e){this.yLinePos=e,this.updateNextCharPosY()}updatelineHeight(e){this.lineHeight=e,this.updateNextCharPosY()}updateFontSize(e,t=0,r=this.message.length-1){for(let i=t;i<=r;i+=1)this.message[i].updateFontSize(e);this.maxCharSize=e,this.nextChar3DPos.y=this.yLinePos+this.maxCharSize*this.lineHeight}countSpaces(){let e=0;for(let t=0;t<this.message.length;t++)this.message[t].char===" "&&(e+=1);return e}alignText(e,t,r,i,s){switch(r){case 1:this.leftAlign(e,s);break;case 3:this.centerAlign(this.spaceLeft(t),e,s);break;case 2:this.rightAlign(this.spaceLeft(t),e,s);break;case 4:this.justifyAlign(this.spaceLeft(t),e,s);break}}offsetCharacters(e,t,r){Nd.set(t,r);let i=this.message.length;for(let s=0;s<i;s++)this.message[s].updatePosition(this.message[s].localPosition.add(Nd),e)}leftAlign(e,t){this.align=1,this.offsetCharacters(e,0,t)}centerAlign(e,t,r){this.align=3,this.offsetCharacters(t,e/2,r)}rightAlign(e,t,r){this.align=2,this.offsetCharacters(t,e,r)}justifyAlign(e,t,r){if(this.align=4,this.endLine){this.offsetCharacters(t,0,r);return}let i=this.countSpaces();if(i===0){this.offsetCharacters(t,0,r);return}let s=e/i,o=0;for(let a=0;a<this.message.length;a++)this.message[a].char===" "&&(o+=s),Nd.set(o,r),this.message[a].updatePosition(this.message[a].localPosition.add(Nd),t)}clone(){let e=new Vs(this.yLinePos,this.lineHeight,this.maxCharSize);e.nextChar3DPos=this.nextChar3DPos.clone(),e.align=this.align,e.endLine=this.endLine;for(let t=0;t<this.message.length;t++)e.message.push(this.message[t].clone());return e}};var Ey=class extends Ct{constructor(t,r=new Ir({transparent:!0,opacity:1,visible:!1,side:Wt})){super(t,r);this.objectType="TextFrame";this.charContainer=new lt,this.add(this.charContainer),this.material.visible=!1,this._geometryUserData=t.userData,this.userData.textFrame={hexColor:null,opacity:1,visible:!0,text:"",fontSize:16,lineHeight:1.5,letterSpacing:1,fontFamily:"roboto_regular",textTransform:1,horizontalAlignment:1,verticalAlignment:1,LOD:16,maxLineSize:this._geometryUserData.parameters.width,textOrigin:new A(this._geometryUserData.parameters.width*-.5,this._geometryUserData.parameters.height*.5,0),textLines:[]},this.createTextLine()}static createFromState(t,r,i){let s=od.create({parameters:{width:r.width,height:r.height}}),o=new Ey(s).fromState(r,i);return o.uuid=t,o}async updateText(t){this.clearText();let r=this.userData.textFrame,i=r.fontFamily;await Xr.loadFont(i),r.text=t;let s=r.textOrigin,o=new zn({visible:r.visible,transparent:!0,side:Wt}),a=t.split(`
|
|
4493
4493
|
`),l=0;this.userData.textFrame.textLines=a.map((c,h)=>{let u=new Vs(l,r.lineHeight,r.fontSize);return u.message=c.split("").map(f=>{let d={char:f,fontFamily:i,letterSpacing:r.letterSpacing,fontSize:r.fontSize,LOD:16},m=o.clone();m.color=r.hexColor,m.opacity=r.opacity;let p=new Xr(d,m);return u.addChar3D(p,s),this.charContainer.add(p),p}),l+=u.maxCharSize*u.lineHeight,u}),this.textFullUpdate(),this.checkOverFlow()}clearText(){let t=this.userData.textFrame.textLines;for(;this.charContainer.children.length;){let r=this.charContainer.children[0];this.charContainer.remove(r)}for(;t.length;)t.pop()}raycast(t,r){let i=[];if(super.raycast(t,i),i.length>0){r.push(i[0]);return}let s=[];for(let o=0,a=this.charContainer.children.length;o<a;++o)if(this.charContainer.children[o]instanceof Xr&&(t.intersectObject(this.charContainer.children[o],!1,s),s.length>0)){s[0].object=this,r.push(s[0]);return}}updateGeometry(t){let r=this.userData,i=this.geometry.userData,s=i.parameters.width,o=i.parameters.height,a=t.parameters?.width??s,l=t.parameters?.height??o,c=r.textFrame;super.updateGeometry(t),c.maxLineSize=a,c.textOrigin.set(-.5*a,.5*l,0),l!==o?(this.checkOverFlow(),this.checkCapacity()):a!==s&&(s<a?this.checkCapacity():s>a&&this.checkOverFlow())}checkOverFlow(t=0){let r=this.userData,i=r.textFrame.textOrigin,s=r.textFrame.textLines;for(let o=t;o<s.length;o++){s[o].updateYLinePos(this.getNewLinePosition(o)),s[o].fullUpdate(i);let a=[];for(;s[o].checkOverFlow(r.textFrame.maxLineSize);)s[o].containSpaceOverFlow()?a.unshift(s[o].getWord(s[o].message.length-1,-1)):a.unshift(s[o].popChar());if(a.length>0){s[o+1]===void 0?(s[o].isEndLine(!1),this.createTextLine()):s[o].endLine&&(this.createTextLine(o+1),s[o].isEndLine(!1),s[o+1].isEndLine(!0));let l=0;for(let c=0;c<a.length;c+=1)for(let h=0;h<a[c].length;h+=1)s[o+1].addChar3D(a[c][h],i,l),l+=1;s[o+1].fullUpdate(i)}s[o].fullUpdate(i)}this.textFullUpdate(t)}checkCapacity(t=0){let r=this.userData,i=r.textFrame.textOrigin,s=r.textFrame.maxLineSize,o=r.textFrame.textLines;for(let a=t;a<o.length;a+=1)if(o[a].updateYLinePos(this.getNewLinePosition(a)),o[a].fullUpdate(i),!!o[a-1])for(;!o[a-1].endLine;){let l,c=o[a-1].spaceLeft(s);if(o[a].wordSize(0,1)<=c){o[a].containSpace()?l=o[a].getWord(0,1):l=o[a].popChar(0);for(let h=0;h<l.length;h+=1)l[h]&&o[a-1].addChar3D(l[h],i)}else{o[a].isEmpty()?(o[a].endLine&&o[a-1].isEndLine(!0),o.splice(a,1),a-=1):(o[a].updateYLinePos(this.getNewLinePosition(a)),o[a].fullUpdate(i));break}}this.textFullUpdate(t)}createTextLine(t=this.userData.textFrame.textLines.length){let i=this.userData.textFrame;i.textLines.splice(t,0,new Vs(this.getNewLinePosition(t),i.lineHeight,i.fontSize))}textFullUpdate(t=0){let i=this.userData.textFrame,s=i.textLines,o=this.getVerticalAlignmentOffSet();for(let a=t;a<s.length;a++)s[a].updateYLinePos(this.getNewLinePosition(a)),s[a].fullUpdate(i.textOrigin),s[a].alignText(i.textOrigin,i.maxLineSize,i.horizontalAlignment,i.verticalAlignment,o)}getVerticalAlignmentOffSet(){switch(this.userData.textFrame.verticalAlignment){case 1:return 0;case 2:return this.getRemainingVerticalSpace()/2;case 3:return this.getRemainingVerticalSpace();default:return 0}}getRemainingVerticalSpace(){let r=this.userData.textFrame.textLines;return this.geometry.userData.parameters.height-this.getNewLinePosition(r.length)}getNewLinePosition(t){let i=this.userData.textFrame.textLines,s=0;for(let o=0;o<t;o+=1)s+=i[o].maxCharSize*i[o].lineHeight;return s}updateColor(t){let r=this.userData;r.textFrame.hexColor=t;let i=r.textFrame.textLines;for(let s=0;s<i.length;s++){let o=i[s].message;for(let a=0;a<o.length;a++){let l=o[a].material;l.color?.isColor&&(l.color=t)}}}updateOpacity(t){let r=this.userData;r.textFrame.opacity=t;let i=r.textFrame.textLines;for(let s=0;s<i.length;s++){let o=i[s].message;for(let a=0;a<o.length;a++){let l=o[a].material;l.opacity=t}}}updateVisible(t){let r=this.userData;r.textFrame.visible=t;let i=r.textFrame.textLines;for(let s=0;s<i.length;s++){let o=i[s].message;for(let a=0;a<o.length;a++){let l=o[a].material;l.visible=t}}}async updateFontFamily(t){await Xr.loadFont(t);let i=this.userData.textFrame,s=i.textLines;i.fontFamily=t;for(let o=0;o<s.length;o++){let a=s[o].message;for(let l=0;l<a.length;l++)a[l].updateFontFamily(t)}this.textFullUpdate(),this.checkOverFlow(),this.checkCapacity()}updateFontSize(t){let i=this.userData.textFrame,s=i.textLines,o=i.fontSize;i.fontSize=t;for(let a=0;a<s.length;a++)s[a].updateFontSize(t);this.textFullUpdate(),t>o?this.checkOverFlow():t<o&&this.checkCapacity()}async updateTextTransform(t){let i=this.userData.textFrame;await Xr.loadFont(i.fontFamily);let s=i.textLines;switch(i.textTransform=t,t){case 2:for(let o=0;o<s.length;o++){let a=s[o].message;for(let l=0;l<a.length;l++)s[o].message[l].updateChar(a[l].char.toUpperCase())}break;case 3:for(let o=0;o<s.length;o++){let a=s[o].message;for(let l=0;l<a.length;l++)s[o].message[l].updateChar(a[l].char.toLowerCase())}break;default:for(let o=0;o<s.length;o++){let a=s[o].message;for(let l=0;l<a.length;l++)s[o].message[l].updateChar(a[l].originalChar)}}this.textFullUpdate(),this.checkOverFlow(),this.checkCapacity()}updateLetterSpacing(t){let r=this.userData,i=r.textFrame.textLines;r.textFrame.letterSpacing=t;for(let s=0;s<i.length;s++){let o=i[s].message;for(let a=0;a<o.length;a++)o[a].updateLetterSpacing(t)}this.textFullUpdate(),this.checkOverFlow(),this.checkCapacity()}updateLOD(t){let r=this.userData;r.textFrame.LOD=t;let i=r.textFrame.textLines;for(let s=0;s<i.length;s++);this.textFullUpdate(),this.checkOverFlow(),this.checkCapacity()}updateLineHeight(t){let r=this.userData,i=r.textFrame.textLines;r.textFrame.lineHeight=t;for(let s=0;s<i.length;s++)i[s].updatelineHeight(t);this.textFullUpdate()}updateVerticalAlignment(t){let r=this.userData;r.textFrame.verticalAlignment=t,this.textFullUpdate()}updateHorizontalAlignment(t){let r=this.userData;r.textFrame.horizontalAlignment=t,this.textFullUpdate()}toJSON(t){let r=super.toJSON(t),i=r.object;i.objectType="TextFrame";let o=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 i.userData.textFrame.textLinesData=o,r}async fromJSONasync(t){if(super.fromJSON(t),t.userData!==void 0){let r=t.userData.textFrame;await Xr.loadFont(r.fontFamily),r.textOrigin=new A(r.textOrigin.x,r.textOrigin.y,r.textOrigin.z);let i=new zn({color:r.hexColor,opacity:r.opacity,visible:r.visible,transparent:!0,side:Wt});r.textLinesData&&(r.textLines=r.textLinesData.map((s,o)=>{let a=new Vs(Number(s.yLinePos),Number(s.lineHeight),Number(s.maxCharSize)),l=s.message.map((c,h)=>{if(c.char===void 0){let d=r.textLines[o].message[h];if("geometries"in d){let m=d.geometries[0].userData.parameters;Object.assign(c,{LOD:m.lod,char:m.char,fontFamily:m.fontFamily,fontSize:m.fontSize,letterSpacing:m.letterSpacing,originalChar:m.char})}}let u={char:c.char,fontFamily:c.fontFamily,letterSpacing:Number(c.letterSpacing),fontSize:Number(c.fontSize),LOD:c.LOD},f=new Xr(u,i.clone());return a.addChar3D(f,r.textOrigin),this.charContainer.add(f),f});return a.message=l,a}),this.userData.textFrame=r),this.textFullUpdate()}return this}fromTextFrameData(t,r){if(t.color!==void 0){let i=Zt(t.color,r);this.updateColor(i),this.updateOpacity(i.a)}t.alpha!==void 0&&this.updateOpacity(t.alpha),t.font!==void 0&&this.updateFontFamily(t.font),t.horizontalAlign!==void 0&&this.updateHorizontalAlignment(t.horizontalAlign),t.verticalAlign!==void 0&&this.updateVerticalAlignment(t.verticalAlign),t.textTransform!==void 0&&this.updateTextTransform(t.textTransform),t.fontSize!==void 0&&this.updateFontSize(t.fontSize),t.lineHeight!==void 0&&this.updateLineHeight(t.lineHeight),t.letterSpacing!==void 0&&this.updateLetterSpacing(t.letterSpacing),t.text!==void 0&&t.text!==""&&this.updateText(t.text),(t.width!==void 0||t.height!==void 0)&&this.updateGeometry({parameters:{width:t.width,height:t.height}})}fromState(t,r){return super.fromState(t),this.fromTextFrameData(t,r),this}convertToVector(){let{fontFamily:t,hexColor:r}=this.userData.textFrame,i=new Ji;i.name="Text Shape";let s=Xr.fontCache[t];for(let o of this.charContainer.children)o instanceof Xr&&s.generateShapes(o.char,1).forEach(a=>{let l=new dt().fromShape(a);l.applyScale(o.scale.x,o.scale.y);let c=Er.create({shape:l}),h=new Ir({side:Wt});h.color=r;let u=new ks(c,h);u.name=o.char,u.position.copy(o.position),u.rotation.copy(o.rotation),i.attach(u)});return i}},Lo=Ey;Lo.VerticalAlign=Eg,Lo.HorizontalAlign=Tg,Lo.TextTransform=Cg;var H1=mv(k1());var Cy;ld.then(n=>{Cy=n});var W1=new Be,OR=new Be,RR=new Be,Zn=new yr,Hs=new A,FR=new Be,zR=new Be,Ws=class extends Ct{constructor(t,r,i,s=new Yr){super(i??r,s);this.subdivPointer=t;this.originalGeometry=r;this.subdividedGeometry=i;this.objectType="SubdivObject";this.hiddenMatrixOld=new Be;this.smoothShading=!0;this.phongAngle=35;this.matrixWorldRigid=new Be;this.castShadow=!0,this.receiveShadow=!0,this.forceComputeSize=!1}static createFromState(t,r,i){let{subdivPointer:s,originalGeometry:o,subdividedGeometry:a}=Dn.build(r.geometry,void 0,void 0,!r.flatShading),l=vh(r.material,i),c=new Ws(s,o,a||void 0,l);return r.geometry.phongAngle!==void 0&&(c.phongAngle=r.geometry.phongAngle),c.calcBoundingBox(),c.freeSubdivPointer(),c.uuid=t,c.fromState(r),c}shallowClone(t){return new Il(this.geometry,this.material).shallowCopy(this,t)}toJSON(t){let r=super.toJSON(t);return r.object.objectType="SubdivObject",r}buildFromStore(t,r){let{originalGeometry:i,subdividedGeometry:s,subdivPointer:o}=Dn.build(t,r,this.subdivPointer,this.smoothShading,this.shearScale);if(t.phongAngle!==void 0&&(this.phongAngle=t.phongAngle),this.subdivPointer=o,i!==void 0&&(this.originalGeometry?.dispose(),this.originalGeometry=i),s!==void 0&&(this.subdividedGeometry?.dispose(),this.subdividedGeometry=s??void 0),this.geometry=this.subdividedGeometry??this.originalGeometry,this.cloner)for(let a of this.cloner.children)a.geometry=this.geometry;t.width&&(this.geometry.userData.parameters={width:t.width,height:t.height,depth:t.depth})}updateMesh(t=!1){Dn.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1,this.originalGeometry,t?this.shearScaleInv:void 0),this.subdividedGeometry&&Dn.buildLevel(this.subdivPointer,!1,this.smoothShading?this.phongAngle:-1,this.subdividedGeometry,t?this.shearScaleInv:void 0)}updateTopology(){this.originalGeometry.dispose(),this.originalGeometry=Dn.buildLevel(this.subdivPointer,!0,this.smoothShading?this.phongAngle:-1),this.subdividedGeometry&&(this.subdividedGeometry.dispose(),this.subdividedGeometry=Dn.buildLevel(this.subdivPointer,!1,this.smoothShading?this.phongAngle:-1)),this.geometry=this.subdividedGeometry??this.originalGeometry}raycast(t,r){this.geometry=this.originalGeometry,Ct.prototype.raycast.call(this,t,r),this.geometry=this.subdividedGeometry??this.originalGeometry}updateMatrixWorldSVD(){let t=this.matrixWorld.elements,r=[[t[0],t[4],t[8]],[t[1],t[5],t[9]],[t[2],t[6],t[10]]],{u:i,v:s,q:o}=(0,H1.SVD)(r),a=W1.set(i[0][0],i[0][1],i[0][2],0,i[1][0],i[1][1],i[1][2],0,i[2][0],i[2][1],i[2][2],0,0,0,0,1),l=OR.set(s[0][0],s[0][1],s[0][2],0,s[1][0],s[1][1],s[1][2],0,s[2][0],s[2][1],s[2][2],0,0,0,0,1),c=RR.copy(l).transpose();this.shearScale=FR.makeScale(o[0],o[1],o[2]).multiply(c).premultiply(l),this.shearScaleInv=zR.copy(this.shearScale).invert(),this.matrixWorldRigid.multiplyMatrices(a,c),o.every(h=>Math.abs(o[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 t=this.originalGeometry;t.boundingSphere===null&&(t.boundingSphere=new Br);let r=t.attributes.position,i=t.boundingSphere.center;Zn.setFromBufferAttribute(r),Zn.getCenter(i),t.boundingSphere.radius=i.distanceTo(Zn.max),isNaN(t.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),Zn.getSize(Hs);let s={width:Hs.x,height:Hs.y,depth:Hs.z};return this.geometry.userData.parameters=s,s}updateBoundingBox(t){let r=this.originalGeometry;Zn.min.set(t[0],t[2],t[4]),Zn.max.set(t[1],t[3],t[5]),this.shearScaleInv&&(Zn.min.applyMatrix4(this.shearScaleInv),Zn.max.applyMatrix4(this.shearScaleInv)),r.boundingSphere===null&&(r.boundingSphere=new Br);let i=r.boundingSphere.center;Zn.getCenter(i),r.boundingSphere.radius=i.distanceTo(Zn.max),isNaN(r.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),Zn.getSize(Hs);let s={width:Hs.x,height:Hs.y,depth:Hs.z};return this.geometry.userData.parameters=s,s}freeSubdivPointer(){this.subdivPointer&&(Cy.free_bvh(this.subdivPointer),Cy.free_subdivision_surface(this.subdivPointer),this.subdivPointer=0)}updateGeometry(t){this.geometry.userData.scale||(this.geometry.userData.scale=Array(3)),this.geometry.userData.scale[0]=this.geometry.userData.parameters.width===0?1:t.parameters.width/this.geometry.userData.parameters.width,this.geometry.userData.scale[1]=this.geometry.userData.parameters.height===0?1:t.parameters.height/this.geometry.userData.parameters.height,this.geometry.userData.scale[2]=this.geometry.userData.parameters.depth===0?1:t.parameters.depth/this.geometry.userData.parameters.depth,V1(this.originalGeometry.attributes,...this.geometry.userData.scale),this.originalGeometry.attributes.position.needsUpdate=!0,this.originalGeometry.attributes.normal.needsUpdate=!0,this.subdividedGeometry&&(V1(this.subdividedGeometry.attributes,...this.subdividedGeometry.userData.scale),this.subdividedGeometry.attributes.position.needsUpdate=!0,this.subdividedGeometry.attributes.normal.needsUpdate=!0),this.geometry.userData.parameters={...t.parameters}}};function V1(n,e,t,r){let i=n.position.array,s=n.normal.array,o=W1.makeScale(e,t,r).invert().elements,a,l,c;for(var h=0,u=i.length;h<u;h+=3)i[h]*=e,i[h+1]*=t,i[h+2]*=r,a=s[h],l=s[h+1],c=s[h+2],s[h]=o[0]*a+o[4]*l+o[8]*c,s[h+1]=o[1]*a+o[5]*l+o[9]*c,s[h+2]=o[2]*a+o[6]*l+o[10]*c}function j1(n,e){e.flatShading!==void 0&&(n.flatShading=e.flatShading,n.needsUpdate=!0),e.wireframe!==void 0&&(n.wireframe=e.wireframe),e.side!==void 0&&(e.side===0?n.side=Fn:e.side===1?n.side=gr:n.side=Wt)}function UR(n,e){if(Array.isArray(n.material))for(let t of n.material)j1(t,e);else{let t=n.material;j1(t,e)}n.objectType==="SubdivObject"&&e.flatShading!==void 0&&(n.material.flatShading=!1,n.smoothShading=!e.flatShading,n.updateMesh())}function q1(n,e,t){let r;if(e.geometry.type==="SubdivGeometry")r=Ws.createFromState(n,e,t);else{let i=e.geometry.type==="BooleanGeometry"?new Le:_d(e.geometry,t),s="materials"in e?f1(e.materials,t):vh(e.material,t);qf.is2DParametricMesh(i.userData.type)?r=new Pl(i,s):i?.userData.type==="VectorGeometry"?r=new ks(i,s):e.geometry.type==="NonParametricGeometry"?r=new Il(i,s):e.geometry.type==="BooleanGeometry"?(r=new Ed(void 0,s),r.booleanOp=e.geometry.operation,e.geometry.phongAngle!==void 0&&(r.phongAngle=e.geometry.phongAngle)):r=new Ll(i,s),r.uuid=n,r.fromState(e)}return UR(r,e),r}function Y1(n,e,t){return e.type==="Mesh"?q1(n,e,t):e.type==="TextFrame"?Lo.createFromState(n,e,t):e.type==="Empty"?Ji.createFromState(n,e):e.type==="PointLight"?Cl.createFromState(n,e,t):e.type==="SpotLight"?Dl.createFromState(n,e,t):e.type==="DirectionalLight"?El.createFromState(n,e,t):Ls.is(e.type)?yn.createFromState(n,e):(console.error(e),new Ji)}function GR(n,e){e.uniforms[`f${e.id}_transmissionSamplerMap`].value=n.texture,e.uniforms[`f${e.id}_transmissionDepthMap`].value=n.depthTexture}function X1(n,e,t){if(!t.userData.layers)return!1;let r=!1,i=t.userData.layers.getLayersOfType("transmission");return i.length>0?(e.layers.set(3),r=!0,n!==void 0&&i.forEach(s=>GR(n,s))):e.layers.set(0),r}function J1(n,e){let t=!1;return e.traverseEntity(r=>{if(r instanceof Ct)if(Array.isArray(r.material))for(let i=0;i<r.material.length;i++)X1(n,r,r.material[i])&&(t=!0);else X1(n,r,r.material)&&(t=!0)}),t}function Q1(n,e){"material"in n&&kR(n.material,e),"geometry"in n&&n.geometry.dispose()}function kR(n,e){Ew(n).forEach(t=>{e.isSharedMaterial(t)||t.dispose()})}var K1=new A,Dy=class extends Md(hn){constructor(t,r){super();this.objectType="Scene";this.alpha=1;this.backupFog=new aa(16777215,.1,2e3);this.fogUseBGColor=!1;this.wireframeState=!1;this.needsTransmissionDirty=!0;this._needsTransmission=!1;this._color=new Se(1,0,0);this.bgColor=new Se(1,1,1);this.entityByUuid={};this.ambientLight=new po(13882323,8553090,.75),this.ambientLight.name="Default Ambient Light",this.personalCamera=this.createPersonalCamera(),this.activeCamera=this.personalCamera,this.sharedAssetManager=r,this.init(t,r)}needsTransmission(t){return this.needsTransmissionDirty&&(this._needsTransmission=J1(t,this),t!==void 0&&(this.needsTransmissionDirty=!1)),this._needsTransmission}find(t){if(t===""||t===void 0)return;let r=this.entityByUuid[t];return r===void 0?this.getObjectByProperty("uuid",t):r}get color(){return this._color}set color(t){this.fogUseBGColor===!0&&this.backupFog.color.copy(t),this._color.copy(t)}get enableFog(){return this.fog!==null}set enableFog(t){this.fog=t===!0?this.backupFog:null}init(t,r){if(this.createChildrenObjects(t.objects,this,r),this.personalCamera.removeFromParent(),this.add(this.personalCamera),this.ambientLight.removeFromParent(),this.add(this.ambientLight),this.setBackgroundColor(Zt(t.backgroundColor,r)),this.updateFog(t.fog,r),this.updateAmbientLight(t.environment.ambientLight,r),this.activeCamera=this.personalCamera,t.publish.playCamera!==null){let i=this.find(t.publish.playCamera);i instanceof yn&&this.switchActiveCamera(i)}this.traverse(i=>{xt(i)&&i.recomputeBoolean()})}clearScene(t){this.traverseEntity(r=>{Q1(r,t)});for(let r of this.children)En(r)&&r.removeFromParent()}resetAfterClear(t,r){this.init(t,r)}createPersonalCamera(){let t=yn.createFromState(Dy.PERSONAL_CAMERA_ID,{...Xf.defaultData,name:"Personal Camera"});return t.enableHelper=!1,t.objectHelper.visible=!1,delete t.isEntity,this.registerObjectCreatedInLegacy(t),t}raycast(t){let r=[],i=s=>{for(let o of s.children)En(o)&&!o.raycastLock&&o.visible&&((zt(o)||Xi(o)&&o.enableHelper&&o.objectHelper.parent)&&t.intersectObject(o,!1,r),i(o))};return i(this),r}traverseEntity(t){for(let r of this.children)En(r)&&r.traverseEntity(t)}updateFog(t,r){this.enableFog=t.enabled,this.fogUseBGColor=t.useBackgroundColor,t.useBackgroundColor?this.backupFog.color.set(this.bgColor):this.backupFog.color=Zt(t.color,r),this.backupFog.near=t.near,this.backupFog.far=t.far}toJSON(t){return{}}fromJSON(t){return this}dispose(){this.clearScene(this.sharedAssetManager),this.sharedAssetManager.dispose()}updateAmbientLight(t,r){g1(this.ambientLight,t,r),t.groundColor!==void 0&&(this.ambientLight.groundColor=Zt(t.groundColor,r)),t.enabled!==void 0&&(this.ambientLight.visible=t.enabled)}switchActiveCamera(t){this.activeCamera!==this.personalCamera&&(this.activeCamera.enableHelper=!0),this.activeCamera=t,t.enableHelper=!1}setBackgroundColor(t){this.bgColor=t,this.alpha=t.a}createChildrenObjects(t,r,i){for(let s of t)this.createChildObject(s.id,s.data,s.children,r,i)}registerObjectCreatedInLegacy(t){this.entityByUuid[t.uuid]=t}unregisterObject(t){delete this.entityByUuid[t.uuid];for(let r of t.children)this.unregisterObject(r)}createChildObject(t,r,i,s,o){let a=Y1(t,r,o);return a&&(this.entityByUuid[t]=a,s.add(a),xt(s)&&zt(a)&&(a.prevBooleanObjectParent=s),this.createChildrenObjects(i,a,o)),a}getCenter(t){let r=[];for(let s=0,o=t.length;s<o;++s){let{id:a,recursive:l}=t[s],c=this.find(a),h=l?c.recursiveBBox:c.singleBBox;r.push(...h.vertices)}let i=new yr;return i.setFromPoints(r),i.getCenter(K1),K1}copyMatrixWorld(t,r){if(t===null){r.identity();return}let i=this.find(t);i?r.copy(i.matrixWorld):r.identity()}copyParentMatrixWorld(t,r){if(t===null){r.identity();return}let i=this.find(t)?.parent;i?r.copy(i.matrixWorld):r.identity()}traverseMaterial(t){this.traverseEntity(r=>{if(r instanceof Ct)if(Array.isArray(r.material))for(let i=0;i<r.material.length;i++)t(r.material[i]);else t(r.material)})}updateCanvasSize(t,r){this.activeCamera.setViewplaneSize(t,r);let i,s;t>=r?(i=r/t,s=1):(i=1,s=t/r),this.traverseMaterial(o=>{o.layersList.getLayersOfType("transmission").forEach(l=>{l.uniforms[`f${l.id}_aspectRatio`].value.x=i,l.uniforms[`f${l.id}_aspectRatio`].value.y=s})})}},Mh=Dy;Mh.PERSONAL_CAMERA_ID="f23858d0-4a3b-4bd8-8173-66ed0af7f6fb-personalCamera";var iA={RED:0,GREEN:1,BLUE:2,ALPHA:3};var _h="varying vec2 vUv;void main(){vUv=position.xy*0.5+0.5;gl_Position=vec4(position.xy,1.0,1.0);}";var VR=`#ifdef FRAMEBUFFER_PRECISION_HIGH
|
|
4494
4494
|
uniform mediump sampler2D inputBuffer;
|
|
@@ -4767,4 +4767,4 @@ float d=distance(uv,center);color*=smoothstep(0.8,offset*0.799,d*(darkness+offse
|
|
|
4767
4767
|
vec2 coord=(uv-center)*vec2(offset);color=mix(color,vec3(1.0-darkness),dot(coord,coord));
|
|
4768
4768
|
#endif
|
|
4769
4769
|
outputColor=vec4(color,inputColor.a);}`,Rd={DEFAULT:0,ESKIL:1},yA=class extends Ti{constructor({blendFunction:n=at.NORMAL,technique:e=Rd.DEFAULT,eskil:t=!1,offset:r=.5,darkness:i=.5}={}){super("VignetteEffect",YF,{blendFunction:n,defines:new Map([["VIGNETTE_TECHNIQUE",e.toFixed(0)]]),uniforms:new Map([["offset",new we(r)],["darkness",new we(i)]])})}get technique(){return Number(this.defines.get("VIGNETTE_TECHNIQUE"))}set technique(n){this.technique!==n&&(this.defines.set("VIGNETTE_TECHNIQUE",n.toFixed(0)),this.setChanged())}get eskil(){return this.technique===Rd.ESKIL}set eskil(n){this.technique=n?Rd.ESKIL:Rd.DEFAULT}getTechnique(){return this.technique}setTechnique(n){this.technique=n}get offset(){return this.uniforms.get("offset").value}set offset(n){this.uniforms.get("offset").value=n}getOffset(){return this.offset}setOffset(n){this.offset=n}get darkness(){return this.uniforms.get("darkness").value}set darkness(n){this.uniforms.get("darkness").value=n}getDarkness(){return this.darkness}setDarkness(n){this.darkness=n}},xoe=[new Float32Array(3),new Float32Array(3)],boe=[new Float32Array(3),new Float32Array(3),new Float32Array(3),new Float32Array(3)],woe=[[new Float32Array([0,0,0]),new Float32Array([1,0,0]),new Float32Array([1,1,0]),new Float32Array([1,1,1])],[new Float32Array([0,0,0]),new Float32Array([1,0,0]),new Float32Array([1,0,1]),new Float32Array([1,1,1])],[new Float32Array([0,0,0]),new Float32Array([0,0,1]),new Float32Array([1,0,1]),new Float32Array([1,1,1])],[new Float32Array([0,0,0]),new Float32Array([0,1,0]),new Float32Array([1,1,0]),new Float32Array([1,1,1])],[new Float32Array([0,0,0]),new Float32Array([0,1,0]),new Float32Array([0,1,1]),new Float32Array([1,1,1])],[new Float32Array([0,0,0]),new Float32Array([0,0,1]),new Float32Array([0,1,1]),new Float32Array([1,1,1])]];var Soe=[new Float32Array(2),new Float32Array(2)];var Aoe=new Float32Array([0,-.25,.25,-.125,.125,-.375,.375]),Moe=[new Float32Array([0,0]),new Float32Array([.25,-.25]),new Float32Array([-.25,.25]),new Float32Array([.125,-.125]),new Float32Array([-.125,.125])],_oe=[new Uint8Array([0,0]),new Uint8Array([3,0]),new Uint8Array([0,3]),new Uint8Array([3,3]),new Uint8Array([1,0]),new Uint8Array([4,0]),new Uint8Array([1,3]),new Uint8Array([4,3]),new Uint8Array([0,1]),new Uint8Array([3,1]),new Uint8Array([0,4]),new Uint8Array([3,4]),new Uint8Array([1,1]),new Uint8Array([4,1]),new Uint8Array([1,4]),new Uint8Array([4,4])],Toe=[new Uint8Array([0,0]),new Uint8Array([1,0]),new Uint8Array([0,2]),new Uint8Array([1,2]),new Uint8Array([2,0]),new Uint8Array([3,0]),new Uint8Array([2,2]),new Uint8Array([3,2]),new Uint8Array([0,1]),new Uint8Array([1,1]),new Uint8Array([0,3]),new Uint8Array([1,3]),new Uint8Array([2,1]),new Uint8Array([3,1]),new Uint8Array([2,3]),new Uint8Array([3,3])];var Eoe=new Map([[Fr(0,0,0,0),new Float32Array([0,0,0,0])],[Fr(0,0,0,1),new Float32Array([0,0,0,1])],[Fr(0,0,1,0),new Float32Array([0,0,1,0])],[Fr(0,0,1,1),new Float32Array([0,0,1,1])],[Fr(0,1,0,0),new Float32Array([0,1,0,0])],[Fr(0,1,0,1),new Float32Array([0,1,0,1])],[Fr(0,1,1,0),new Float32Array([0,1,1,0])],[Fr(0,1,1,1),new Float32Array([0,1,1,1])],[Fr(1,0,0,0),new Float32Array([1,0,0,0])],[Fr(1,0,0,1),new Float32Array([1,0,0,1])],[Fr(1,0,1,0),new Float32Array([1,0,1,0])],[Fr(1,0,1,1),new Float32Array([1,0,1,1])],[Fr(1,1,0,0),new Float32Array([1,1,0,0])],[Fr(1,1,0,1),new Float32Array([1,1,0,1])],[Fr(1,1,1,0),new Float32Array([1,1,1,0])],[Fr(1,1,1,1),new Float32Array([1,1,1,1])]]);function Ny(n,e,t){return n+(e-n)*t}function Fr(n,e,t,r){let i=Ny(n,e,.75),s=Ny(t,r,1-.25);return Ny(i,s,1-.125)}var er=class{constructor(e,t){this.enabled=!1;this.effect=new e(t),Object.defineProperty(this,"opacity",{enumerable:!0,set(r){this.effect.blendMode.opacity.value=r},get(){return this.effect.blendMode.opacity.value}}),Object.defineProperty(this,"blendFunction",{enumerable:!0,set(r){this.effect.blendMode.setBlendFunction(Number(r))},get(){return this.effect.blendMode.blendFunction}}),this.blendFunction=at.NORMAL}toJSON(){let e=["constructor","effect","subscriptions"],t={...this},r=Object.getPrototypeOf(this),i=Object.getOwnPropertyNames(r);for(let s of i){let o=Object.getOwnPropertyDescriptor(r,s);o&&typeof o.get=="function"&&(t[s]=this[s])}return e.forEach(s=>delete t[s]),t}};var Nl=class extends er{constructor(){super(lA),this.blendFunction=at.SCREEN}set intensity(e){this.effect.intensity=e}get intensity(){return this.effect.intensity}set luminanceThreshold(e){this.effect.luminanceMaterial.threshold=e}get luminanceThreshold(){return this.effect.luminanceMaterial.threshold}set luminanceSmoothing(e){this.effect.luminanceMaterial.smoothing=e}get luminanceSmoothing(){return this.effect.luminanceMaterial.smoothing}set blurScale(e){this.effect.blurPass.scale=e}get blurScale(){return this.effect.blurPass.scale}set kernelSize(e){this.effect.blurPass.kernelSize=e}get kernelSize(){return this.effect.blurPass.kernelSize}};var Bl=class extends er{constructor(){super(cA)}set contrast(e){this.effect.uniforms.get("contrast").value=e}get contrast(){return this.effect.uniforms.get("contrast").value}set brightness(e){this.effect.uniforms.get("brightness").value=e}get brightness(){return this.effect.uniforms.get("brightness").value}};var Ol=class extends er{constructor(){super(uA),this.effect.offset=new O(.01,.01)}set offset(e){this.effect.offset.set(e[0]/1e3,e[1]/1e3)}get offset(){return[this.effect.offset.x*1e3,this.effect.offset.y*1e3]}};var Rl=class extends er{constructor(){super(hA)}};var Fl=class extends er{constructor(){super(dA);this._hue=0}set hue(t){this._hue=t,this.effect.setHue(t)}get hue(){return this._hue}set saturation(t){this.effect.uniforms.get("saturation").value=t}get saturation(){return this.effect.uniforms.get("saturation").value}};var zl=class extends er{constructor(){super(pA),this.blendFunction=at.OVERLAY}};var Ul=class extends er{constructor(){super(yA)}get eskil(){return this.effect.eskil}set eskil(e){this.effect.eskil=e}get darkness(){return this.effect.uniforms.get("darkness").value}set darkness(e){this.effect.uniforms.get("darkness").value=e}get offset(){return this.effect.uniforms.get("offset").value}set offset(e){this.effect.uniforms.get("offset").value=e}};var Gl=class extends er{constructor(e){super(fA,e)}set focalLength(e){this.effect.circleOfConfusionMaterial.uniforms.focalLength.value=e}get focalLength(){return this.effect.circleOfConfusionMaterial.uniforms.focalLength.value}set focusDistance(e){this.effect.circleOfConfusionMaterial.uniforms.focusDistance.value=e}get focusDistance(){return this.effect.circleOfConfusionMaterial.uniforms.focusDistance.value}get bokehScale(){return this.effect.bokehScale}set bokehScale(e){this.effect.bokehScale=e}};var kl=class extends er{constructor(){super(mA)}get granularity(){return this.effect.getGranularity()}set granularity(e){this.effect.setGranularity(e)}};function vA(n,e){return e&&e.enabled&&n.push(e.effect),n}var Th=class extends Ot{constructor(){super();this._scene=new hn;this._camera=new yn;this.effects=new Map;this.loadingManager=new fo;this.renderPass=new Uy;this._renderToScreen=!0;this._hasSmaa=!1;this.clock=new Tu,this.enabled=!1,this.debug=!1,this.effects.set("bloom",new Nl),this.effects.set("chromaticAberration",new Ol),this.effects.set("vignette",new Ul),this.effects.set("noise",new zl),this.effects.set("colorAverage",new Rl),this.effects.set("hueSaturation",new Fl),this.effects.set("brightnessContrast",new Bl),this.effects.set("depthOfField",new Gl),this.effects.set("pixelation",new kl)}get scene(){return this._scene}set scene(t){this._scene=t}get camera(){return this._camera}set camera(t){this._camera=t}_initSmaa(){if(!this.effectComposer)return;let t=this.effectComposer.passes.length,r=new gA({preset:Io.ULTRA,edgeDetectionMode:Fd.COLOR}),i=()=>{r.removeEventListener("load",i),this.dispatchEvent({type:"smaaloaded"})};r.addEventListener("load",i),r.edgeDetectionMaterial.setPredicationMode(Ry.DEPTH),r.edgeDetectionMaterial.setEdgeDetectionThreshold(.05),r.edgeDetectionMaterial.setPredicationThreshold(.002),r.edgeDetectionMaterial.setPredicationScale(1),this.effectComposer.addPass(new zd(this.camera,r),t),this._hasSmaa=!0}_initPasses(){if(!this.effectComposer||!this.renderer)return;let t;if(this.effectComposer.removeAllPasses(),this._hasSmaa=!1,this.renderPass=new Uy(this.scene,this.camera),this.enabled){this.effectComposer.addPass(this.renderPass),this._initSmaa();let r=[this.effects.get("chromaticAberration"),this.effects.get("bloom"),this.effects.get("colorAverage"),this.effects.get("hueSaturation"),this.effects.get("brightnessContrast"),this.effects.get("vignette"),this.effects.get("noise")].reduce(vA,[]),i=[this.effects.get("pixelation")].reduce(vA,[]);i.length>0&&this.effectComposer.addPass(new zd(this.camera,...i)),this.effectComposer.addPass(new zd(this.camera,...r))}else this.effectComposer.addPass(this.renderPass),(_w||wo)&&Tw<15.5&&this._initSmaa();if(t)return t}reinit(){if(!this.renderer)return Promise.all([]);this.effectComposer=new aA(this.renderer),this._initPasses()}init({renderer:t,camera:r,scene:i}){this.renderer=t,this.scene=i,this.camera=r,this._initCopyPass(),this.reinit()}_initCopyPass(){if(this._savePass)return;let t=new O;this.renderer.getDrawingBufferSize(t),this._rt=new ut(t.x,t.y,{depthBuffer:!1,stencilBuffer:!1,wrapS:na,wrapT:na}),this._rt.samples=this.renderer.capabilities.isWebGL2?4:0,this._savePass=new Fy(this._rt,!1),this._savePass.renderToScreen=!1}get renderToScreen(){return this._renderToScreen}set renderToScreen(t){let r=this.effectComposer;!r||(t===!0?(this.renderer?.capabilities.isWebGL2&&(r.multisampling=0),r.removePass(this._savePass),r.passes[r.passes.length-1].renderToScreen=!0,r.autoRenderToScreen=!0):(this.renderer?.capabilities.isWebGL2&&!this._hasSmaa&&(r.multisampling=4),r.autoRenderToScreen=!1,r.passes[r.passes.length-1].renderToScreen=!1,this._savePass.renderToScreen=!1,this.enabled||(this._savePass.needsDepthTexture=!0),r.addPass(this._savePass)),this._renderToScreen=t)}get texture(){return this._rt&&this._rt.texture}get renderTarget(){return this._rt}fromJSON(t){t&&(Object.keys(t).forEach(r=>{let i=t[r],s=this.effects.get(r);Object.keys(i).forEach(o=>{s[o]=i[o]})}),this.enabled=t.enabled)}toJSON(){let t={};return this.effects.forEach((r,i)=>{t[i]=r.toJSON()},t),{enabled:this.enabled,...t}}render(){this.effectComposer?.render(this.clock.getDelta())}setScissor(t,r,i,s){if(!this.effectComposer||!this.renderer)return;t instanceof Ke?(this.effectComposer.inputBuffer.scissor.set(t.x,t.y,t.z,t.w),this.effectComposer.outputBuffer.scissor.set(t.x,t.y,t.z,t.w)):(this.effectComposer.inputBuffer.scissor.set(t,r,i,s),this.effectComposer.outputBuffer.scissor.set(t,r,i,s));let o=this.renderer.getPixelRatio();this.effectComposer.inputBuffer.scissor.multiplyScalar(o),this.effectComposer.outputBuffer.scissor.multiplyScalar(o),this.renderer.setScissor(t,r,i,s)}setScissorTest(t){!this.effectComposer||!this.renderer||(this.effectComposer.inputBuffer.scissorTest=t,this.effectComposer.outputBuffer.scissorTest=t,this.renderer.setScissorTest(t))}setViewport(t,r,i,s){!this.effectComposer||(t instanceof Ke?(this.effectComposer.inputBuffer.viewport.copy(t),this.effectComposer.outputBuffer.viewport.copy(t)):(this.effectComposer.inputBuffer.viewport.set(t,r,i,s),this.effectComposer.outputBuffer.viewport.set(t,r,i,s)))}resize(t,r,i){if(this.effectComposer?.setSize(t,r,i),this._rt){let s=this.renderer?.getPixelRatio()||window.devicePixelRatio;this._rt.setSize(t*s,r*s)}}dispose(){this._listeners=void 0,this.effectComposer?.dispose()}};var Ud=class extends Mh{constructor(t,r){super(t,r);this.postprocessing=new Th;this.initPostprocessing(t.postprocessing)}resetAfterClear(t,r){super.resetAfterClear(t,r),this.initPostprocessing(t.postprocessing)}initPostprocessing(t){let{enabled:r,...i}=t;for(let s of Object.entries(i)){let o=s[1],a=this.postprocessing.effects.get(s[0]);if(a){a.enabled=o.enabled;for(let[l,c]of Object.entries(o))a[l]=c}}this.postprocessing.enabled=r,this.postprocessing.reinit()}dispose(){super.dispose(),this.postprocessing.dispose()}switchActiveCamera(t){super.switchActiveCamera(t),this.postprocessing&&(this.postprocessing.camera=t)}};var ky=new WeakMap,Gd=class extends vs{constructor(e){super(e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,t,r,i){let s=new xs(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,o=>{let a={attributeIDs:this.defaultAttributeIDs,attributeTypes:this.defaultAttributeTypes,useUniqueIDs:!1};this.decodeGeometry(o,a).then(t).catch(i)},r,i)}decodeDracoFile(e,t,r,i){let s={attributeIDs:r||this.defaultAttributeIDs,attributeTypes:i||this.defaultAttributeTypes,useUniqueIDs:!!r};this.decodeGeometry(e,s).then(t)}decodeGeometry(e,t){for(let l in t.attributeTypes){let c=t.attributeTypes[l];c.BYTES_PER_ELEMENT!==void 0&&(t.attributeTypes[l]=c.name)}let r=JSON.stringify(t);if(ky.has(e)){let l=ky.get(e);if(l.key===r)return l.promise;if(e.byteLength===0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let i,s=this.workerNextTaskID++,o=e.byteLength,a=this._getWorker(s,o).then(l=>(i=l,new Promise((c,h)=>{i._callbacks[s]={resolve:c,reject:h},i.postMessage({type:"decode",id:s,taskConfig:t,buffer:e},[e])}))).then(l=>this._createGeometry(l.geometry));return a.catch(()=>!0).then(()=>{i&&s&&this._releaseTask(i,s)}),ky.set(e,{key:r,promise:a}),a}_createGeometry(e){let t=new Le;e.index&&t.setIndex(new Xe(e.index.array,1));for(let r=0;r<e.attributes.length;r++){let i=e.attributes[r],s=i.name,o=i.array,a=i.itemSize;t.setAttribute(s,new Xe(o,a))}return t}_loadLibrary(e,t){let r=new xs(this.manager);return r.setPath(this.decoderPath),r.setResponseType(t),r.setWithCredentials(this.withCredentials),new Promise((i,s)=>{r.load(e,i,void 0,s)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;let e=typeof WebAssembly!="object"||this.decoderConfig.type==="js",t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(r=>{let i=r[0];e||(this.decoderConfig.wasmBinary=r[1]);let s=JF.toString(),o=["/* draco decoder */",i,"","/* worker */",s.substring(s.indexOf("{")+1,s.lastIndexOf("}"))].join(`
|
|
4770
|
-
`);this.workerSourceURL=URL.createObjectURL(new Blob([o]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){let i=new Worker(this.workerSourceURL);i._callbacks={},i._taskCosts={},i._taskLoad=0,i.postMessage({type:"init",decoderConfig:this.decoderConfig}),i.onmessage=function(s){let o=s.data;switch(o.type){case"decode":i._callbacks[o.id].resolve(o);break;case"error":i._callbacks[o.id].reject(o);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+o.type+'"')}},this.workerPool.push(i)}else this.workerPool.sort(function(i,s){return i._taskLoad>s._taskLoad?-1:1});let r=this.workerPool[this.workerPool.length-1];return r._taskCosts[e]=t,r._taskLoad+=t,r})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this}};function JF(){let n,e;onmessage=function(o){let a=o.data;switch(a.type){case"init":n=a.decoderConfig,e=new Promise(function(h){n.onModuleLoaded=function(u){h({draco:u})},DracoDecoderModule(n)});break;case"decode":let l=a.buffer,c=a.taskConfig;e.then(h=>{let u=h.draco,f=new u.Decoder,d=new u.DecoderBuffer;d.Init(new Int8Array(l),l.byteLength);try{let m=t(u,f,d,c),p=m.attributes.map(g=>g.array.buffer);m.index&&p.push(m.index.array.buffer),self.postMessage({type:"decode",id:a.id,geometry:m},p)}catch(m){console.error(m),self.postMessage({type:"error",id:a.id,error:m.message})}finally{u.destroy(d),u.destroy(f)}});break}};function t(o,a,l,c){let h=c.attributeIDs,u=c.attributeTypes,f,d,m=a.GetEncodedGeometryType(l);if(m===o.TRIANGULAR_MESH)f=new o.Mesh,d=a.DecodeBufferToMesh(l,f);else if(m===o.POINT_CLOUD)f=new o.PointCloud,d=a.DecodeBufferToPointCloud(l,f);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!d.ok()||f.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+d.error_msg());let p={index:null,attributes:[]};for(let g in h){let x=self[u[g]],v,w;if(c.useUniqueIDs)w=h[g],v=a.GetAttributeByUniqueId(f,w);else{if(w=a.GetAttributeId(f,o[h[g]]),w===-1)continue;v=a.GetAttribute(f,w)}p.attributes.push(i(o,a,f,g,x,v))}return m===o.TRIANGULAR_MESH&&(p.index=r(o,a,f)),o.destroy(f),p}function r(o,a,l){let h=l.num_faces()*3,u=h*4,f=o._malloc(u);a.GetTrianglesUInt32Array(l,u,f);let d=new Uint32Array(o.HEAPF32.buffer,f,h).slice();return o._free(f),{array:d,itemSize:1}}function i(o,a,l,c,h,u){let f=u.num_components(),m=l.num_points()*f,p=m*h.BYTES_PER_ELEMENT,g=s(o,h),x=o._malloc(p);a.GetAttributeDataArrayForAllPoints(l,u,g,p,x);let v=new h(o.HEAPF32.buffer,x,m).slice();return o._free(x),{name:c,array:v,itemSize:f}}function s(o,a){switch(a){case Float32Array:return o.DT_FLOAT32;case Int8Array:return o.DT_INT8;case Int16Array:return o.DT_INT16;case Int32Array:return o.DT_INT32;case Uint8Array:return o.DT_UINT8;case Uint16Array:return o.DT_UINT16;case Uint32Array:return o.DT_UINT32}}}var Xs;function QF(){return Xs||(Xs=new Gd,Xs.setDecoderPath("https://www.gstatic.com/draco/versioned/decoders/1.5.2/").preload()),Xs.decoderPending}async function KF(n){if(Xs){let e={attributeIDs:Xs.defaultAttributeIDs,attributeTypes:Xs.defaultAttributeTypes,useUniqueIDs:!1},t;try{t=await Xs.decodeGeometry(new Int8Array(n).buffer,e)}catch(r){console.error(r)}if(t)return{index:t.index?{array:t.index.array}:void 0,attributes:Object.entries(t.attributes).map(([r,i])=>({name:r,itemSize:i.itemSize,array:i.array}))}}return null}async function xA(n){let[e,t]=cg(kf.deserialize(new Uint8Array(n))),r=[];e.scene.objects.traverse((i,s)=>{s.type==="Mesh"&&s.geometry.type==="NonParametricGeometry"&&s.geometry.data.draco!==void 0&&r.push(s)}),r.length&&await QF();for(let i of r){let s=await KF(ug(i.geometry.data.draco));if(s){s.index&&(i.geometry.data.index={array:s.index.array,itemSize:1,normalized:!1,type:"Uint32Array"});let o={};s.attributes.forEach(({name:a,array:l,itemSize:c})=>{o[a]={array:l,itemSize:c,type:"Float32Array",normalized:!1}}),i.geometry.data.attributes=o,i.geometry.data.draco=void 0}}return t.result().data}var _A={update:null,begin:null,loopBegin:null,changeBegin:null,change:null,changeComplete:null,loopComplete:null,complete:null,loop:1,direction:"normal",autoplay:!0,timelineOffset:0,rewind:!0},jy={duration:1e3,delay:0,endDelay:0,easing:"easeOutElastic(1, .5)",round:0},ZF=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY","perspective","matrix","matrix3d"],Vd={CSS:{},springs:{}};function Ei(n,e,t){return Math.min(Math.max(n,e),t)}function Eh(n,e){return n.indexOf(e)>-1}function Vy(n,e){return n.apply(null,e)}var Ve={arr:function(n){return Array.isArray(n)},obj:function(n){return Eh(Object.prototype.toString.call(n),"Object")},pth:function(n){return Ve.obj(n)&&n.hasOwnProperty("totalLength")},svg:function(n){return n instanceof SVGElement},inp:function(n){return n instanceof HTMLInputElement},dom:function(n){return!("isNode"in n)&&(n.nodeType||Ve.svg(n))},str:function(n){return typeof n=="string"},fnc:function(n){return typeof n=="function"},und:function(n){return typeof n>"u"},hex:function(n){return/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(n)},rgb:function(n){return/^rgb/.test(n)},hsl:function(n){return/^hsl/.test(n)},col:function(n){return Ve.hex(n)||Ve.rgb(n)||Ve.hsl(n)},key:function(n){return!_A.hasOwnProperty(n)&&!jy.hasOwnProperty(n)&&n!=="targets"&&n!=="keyframes"}};function TA(n){var e=/\(([^)]+)\)/.exec(n);return e?e[1].split(",").map(function(t){return parseFloat(t)}):[]}function EA(n,e){var t=TA(n),r=Ei(Ve.und(t[0])?1:t[0],.1,100),i=Ei(Ve.und(t[1])?100:t[1],.1,100),s=Ei(Ve.und(t[2])?10:t[2],.1,100),o=Ei(Ve.und(t[3])?0:t[3],.1,100),a=Math.sqrt(i/r),l=s/(2*Math.sqrt(i*r)),c=l<1?a*Math.sqrt(1-l*l):0,h=1,u=l<1?(l*a+-o)/c:-o+a;function f(m){var p=e?e*m/1e3:m;return l<1?p=Math.exp(-p*l*a)*(h*Math.cos(c*p)+u*Math.sin(c*p)):p=(h+u*p)*Math.exp(-p*a),m===0||m===1?m:1-p}function d(){var m=Vd.springs[n];if(m)return m;for(var p=1/6,g=0,x=0;;)if(g+=p,f(g)===1){if(x++,x>=16)break}else x=0;var v=g*p*1e3;return Vd.springs[n]=v,v}return e?f:d}function $F(n){return n===void 0&&(n=10),function(e){return Math.ceil(Ei(e,1e-6,1)*n)*(1/n)}}var ez=function(){var n=11,e=1/(n-1);function t(h,u){return 1-3*u+3*h}function r(h,u){return 3*u-6*h}function i(h){return 3*h}function s(h,u,f){return((t(u,f)*h+r(u,f))*h+i(u))*h}function o(h,u,f){return 3*t(u,f)*h*h+2*r(u,f)*h+i(u)}function a(h,u,f,d,m){var p,g,x=0;do g=u+(f-u)/2,p=s(g,d,m)-h,p>0?f=g:u=g;while(Math.abs(p)>1e-7&&++x<10);return g}function l(h,u,f,d){for(var m=0;m<4;++m){var p=o(u,f,d);if(p===0)return u;var g=s(u,f,d)-h;u-=g/p}return u}function c(h,u,f,d){if(!(0<=h&&h<=1&&0<=f&&f<=1))return;var m=new Float32Array(n);if(h!==u||f!==d)for(var p=0;p<n;++p)m[p]=s(p*e,h,f);function g(x){for(var v=0,w=1,b=n-1;w!==b&&m[w]<=x;++w)v+=e;--w;var S=(x-m[w])/(m[w+1]-m[w]),M=v+S*e,_=o(M,h,f);return _>=.001?l(x,M,h,f):_===0?M:a(x,v,v+e,h,f)}return function(x){return h===u&&f===d||x===0||x===1?x:s(g(x),u,d)}}return c}(),CA=function(){var n={linear:function(){return function(r){return r}}},e={Sine:function(){return function(r){return 1-Math.cos(r*Math.PI/2)}},Circ:function(){return function(r){return 1-Math.sqrt(1-r*r)}},Back:function(){return function(r){return r*r*(3*r-2)}},Bounce:function(){return function(r){for(var i,s=4;r<((i=Math.pow(2,--s))-1)/11;);return 1/Math.pow(4,3-s)-7.5625*Math.pow((i*3-2)/22-r,2)}},Elastic:function(r,i){r===void 0&&(r=1),i===void 0&&(i=.5);var s=Ei(r,1,10),o=Ei(i,.1,2);return function(a){return a===0||a===1?a:-s*Math.pow(2,10*(a-1))*Math.sin((a-1-o/(Math.PI*2)*Math.asin(1/s))*(Math.PI*2)/o)}}},t=["Quad","Cubic","Quart","Quint","Expo"];return t.forEach(function(r,i){e[r]=function(){return function(s){return Math.pow(s,i+2)}}}),Object.keys(e).forEach(function(r){var i=e[r];n["easeIn"+r]=i,n["easeOut"+r]=function(s,o){return function(a){return 1-i(s,o)(1-a)}},n["easeInOut"+r]=function(s,o){return function(a){return a<.5?i(s,o)(a*2)/2:1-i(s,o)(a*-2+2)/2}}}),n}();function qy(n,e){if(Ve.fnc(n))return n;var t=n.split("(")[0],r=CA[t],i=TA(n);switch(t){case"spring":return EA(n,e);case"cubicBezier":return Vy(ez,i);case"steps":return Vy($F,i);default:return Vy(r,i)}}function DA(n){try{var e=document.querySelectorAll(n);return e}catch{return}}function Hd(n,e){for(var t=n.length,r=arguments.length>=2?arguments[1]:void 0,i=[],s=0;s<t;s++)if(s in n){var o=n[s];e.call(r,o,s,n)&&i.push(o)}return i}function Wd(n){return n.reduce(function(e,t){return e.concat(Ve.arr(t)?Wd(t):t)},[])}function bA(n){return Ve.arr(n)?n:(Ve.str(n)&&(n=DA(n)||n),n instanceof NodeList||n instanceof HTMLCollection?[].slice.call(n):[n])}function Yy(n,e){return n.some(function(t){return t===e})}function Xy(n){var e={};for(var t in n)e[t]=n[t];return e}function Hy(n,e){var t=Xy(n);for(var r in n)t[r]=e.hasOwnProperty(r)?e[r]:n[r];return t}function jd(n,e){var t=Xy(n);for(var r in e)t[r]=Ve.und(n[r])?e[r]:n[r];return t}function tz(n){var e=/rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g.exec(n);return e?"rgba("+e[1]+",1)":n}function rz(n){var e=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,t=n.replace(e,function(a,l,c,h){return l+l+c+c+h+h}),r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t),i=parseInt(r[1],16),s=parseInt(r[2],16),o=parseInt(r[3],16);return"rgba("+i+","+s+","+o+",1)"}function nz(n){var e=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(n)||/hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(n),t=parseInt(e[1],10)/360,r=parseInt(e[2],10)/100,i=parseInt(e[3],10)/100,s=e[4]||1;function o(f,d,m){return m<0&&(m+=1),m>1&&(m-=1),m<1/6?f+(d-f)*6*m:m<1/2?d:m<2/3?f+(d-f)*(2/3-m)*6:f}var a,l,c;if(r==0)a=l=c=i;else{var h=i<.5?i*(1+r):i+r-i*r,u=2*i-h;a=o(u,h,t+1/3),l=o(u,h,t),c=o(u,h,t-1/3)}return"rgba("+a*255+","+l*255+","+c*255+","+s+")"}function iz(n){if(Ve.rgb(n))return tz(n);if(Ve.hex(n))return rz(n);if(Ve.hsl(n))return nz(n)}function Ki(n){var e=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn)?$/.exec(n);if(e)return e[1]}function sz(n){if(Eh(n,"translate")||n==="perspective")return"px";if(Eh(n,"rotate")||Eh(n,"skew"))return"deg"}function Wy(n,e){return Ve.fnc(n)?n(e.target,e.id,e.total):n}function Ci(n,e){return n.getAttribute(e)}function Jy(n,e,t){var r=Ki(e);if(Yy([t,"deg","rad","turn"],r))return e;var i=Vd.CSS[e+t];if(!Ve.und(i))return i;var s=100,o=document.createElement(n.tagName),a=n.parentNode&&n.parentNode!==document?n.parentNode:document.body;a.appendChild(o),o.style.position="absolute",o.style.width=s+t;var l=s/o.offsetWidth;a.removeChild(o);var c=l*parseFloat(e);return Vd.CSS[e+t]=c,c}function PA(n,e,t){if(e in n.style){var r=e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),i=n.style[e]||getComputedStyle(n).getPropertyValue(r)||"0";return t?Jy(n,i,t):i}}function Qy(n,e){if(Ve.dom(n)&&!Ve.inp(n)&&(Ci(n,e)||Ve.svg(n)&&n[e]))return"attribute";if(Ve.dom(n)&&Yy(ZF,e))return"transform";if(Ve.dom(n)&&e!=="transform"&&PA(n,e))return"css";if(n[e]!=null)return"object"}function LA(n){if(!!Ve.dom(n)){for(var e=n.style.transform||"",t=/(\w+)\(([^)]*)\)/g,r=new Map,i;i=t.exec(e);)r.set(i[1],i[2]);return r}}function oz(n,e,t,r){var i=Eh(e,"scale")?1:0+sz(e),s=LA(n).get(e)||i;return t&&(t.transforms.list.set(e,s),t.transforms.last=e),r?Jy(n,s,r):s}function Ky(n,e,t,r){switch(Qy(n,e)){case"transform":return oz(n,e,r,t);case"css":return PA(n,e,t);case"attribute":return Ci(n,e);default:return n[e]||0}}function Zy(n,e){var t=/^(\*=|\+=|-=)/.exec(n);if(!t)return n;var r=Ki(n)||0,i=parseFloat(e),s=parseFloat(n.replace(t[0],""));switch(t[0][0]){case"+":return i+s+r;case"-":return i-s+r;case"*":return i*s+r}}function IA(n,e){if(Ve.col(n))return iz(n);if(/\s/g.test(n))return n;var t=Ki(n),r=t?n.substr(0,n.length-t.length):n;return e?r+e:r}function $y(n,e){return Math.sqrt(Math.pow(e.x-n.x,2)+Math.pow(e.y-n.y,2))}function az(n){return Math.PI*2*Ci(n,"r")}function lz(n){return Ci(n,"width")*2+Ci(n,"height")*2}function cz(n){return $y({x:Ci(n,"x1"),y:Ci(n,"y1")},{x:Ci(n,"x2"),y:Ci(n,"y2")})}function NA(n){for(var e=n.points,t=0,r,i=0;i<e.numberOfItems;i++){var s=e.getItem(i);i>0&&(t+=$y(r,s)),r=s}return t}function hz(n){var e=n.points;return NA(n)+$y(e.getItem(e.numberOfItems-1),e.getItem(0))}function BA(n){if(n.getTotalLength)return n.getTotalLength();switch(n.tagName.toLowerCase()){case"circle":return az(n);case"rect":return lz(n);case"line":return cz(n);case"polyline":return NA(n);case"polygon":return hz(n)}}function uz(n){var e=BA(n);return n.setAttribute("stroke-dasharray",e),e}function fz(n){for(var e=n.parentNode;Ve.svg(e)&&Ve.svg(e.parentNode);)e=e.parentNode;return e}function OA(n,e){var t=e||{},r=t.el||fz(n),i=r.getBoundingClientRect(),s=Ci(r,"viewBox"),o=i.width,a=i.height,l=t.viewBox||(s?s.split(" "):[0,0,o,a]);return{el:r,viewBox:l,x:l[0]/1,y:l[1]/1,w:o/l[2],h:a/l[3]}}function dz(n,e){var t=Ve.str(n)?DA(n)[0]:n,r=e||100;return function(i){return{property:i,el:t,svg:OA(t),totalLength:BA(t)*(r/100)}}}function pz(n,e){function t(a){a===void 0&&(a=0);var l=e+a>=1?e+a:0;return n.el.getPointAtLength(l)}var r=OA(n.el,n.svg),i=t(),s=t(-1),o=t(1);switch(n.property){case"x":return(i.x-r.x)*r.w;case"y":return(i.y-r.y)*r.h;case"angle":return Math.atan2(o.y-s.y,o.x-s.x)*180/Math.PI}}function wA(n,e){var t=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g,r=IA(Ve.pth(n)?n.totalLength:n,e)+"";return{original:r,numbers:r.match(t)?r.match(t).map(Number):[0],strings:Ve.str(n)||e?r.split(t):[]}}function RA(n){var e=n?Wd(Ve.arr(n)?n.map(bA):bA(n)):[];return Hd(e,function(t,r,i){return i.indexOf(t)===r})}function FA(n){var e=RA(n);return e.map(function(t,r){return{target:t,id:r,total:e.length,transforms:{list:LA(t)}}})}function mz(n,e){var t=Xy(e);if(/^spring/.test(t.easing)&&(t.duration=EA(t.easing)),Ve.arr(n)){var r=n.length,i=r===2&&!Ve.obj(n[0]);i?n={value:n}:Ve.fnc(e.duration)||(t.duration=e.duration/r)}var s=Ve.arr(n)?n:[n];return s.map(function(o,a){var l=Ve.obj(o)&&!Ve.pth(o)?o:{value:o};return Ve.und(l.delay)&&(l.delay=a?0:e.delay),Ve.und(l.endDelay)&&(l.endDelay=a===s.length-1?e.endDelay:0),l}).map(function(o){return jd(o,t)})}function gz(n){for(var e=Hd(Wd(n.map(function(s){return Object.keys(s)})),function(s){return Ve.key(s)}).reduce(function(s,o){return s.indexOf(o)<0&&s.push(o),s},[]),t={},r=function(s){var o=e[s];t[o]=n.map(function(a){var l={};for(var c in a)Ve.key(c)?c==o&&(l.value=a[c]):l[c]=a[c];return l})},i=0;i<e.length;i++)r(i);return t}function yz(n,e){var t=[],r=e.keyframes;r&&(e=jd(gz(r),e));for(var i in e)Ve.key(i)&&t.push({name:i,tweens:mz(e[i],n)});return t}function vz(n,e){var t={};for(var r in n){var i=Wy(n[r],e);Ve.arr(i)&&(i=i.map(function(s){return Wy(s,e)}),i.length===1&&(i=i[0])),t[r]=i}return t.duration=parseFloat(t.duration),t.delay=parseFloat(t.delay),t}function xz(n,e){var t;return n.tweens.map(function(r){var i=vz(r,e),s=i.value,o=Ve.arr(s)?s[1]:s,a=Ki(o),l=Ky(e.target,n.name,a,e),c=t?t.to.original:l,h=Ve.arr(s)?s[0]:c,u=Ki(h)||Ki(l),f=a||u;return Ve.und(o)&&(o=c),i.from=wA(h,f),i.to=wA(Zy(o,h),f),i.start=t?t.end:0,i.end=i.start+i.delay+i.duration+i.endDelay,i.easing=qy(i.easing,i.duration),i.isPath=Ve.pth(s),i.isColor=Ve.col(i.from.original),i.isColor&&(i.round=1),t=i,i})}var zA={css:function(n,e,t){return n.style[e]=t},attribute:function(n,e,t){return n.setAttribute(e,t)},object:function(n,e,t){return n[e]=t},transform:function(n,e,t,r,i){if(r.list.set(e,t),e===r.last||i){var s="";r.list.forEach(function(o,a){s+=a+"("+o+") "}),n.style.transform=s}}};function UA(n,e){var t=FA(n);t.forEach(function(r){for(var i in e){var s=Wy(e[i],r),o=r.target,a=Ki(s),l=Ky(o,i,a,r),c=a||Ki(l),h=Zy(IA(s,c),l),u=Qy(o,i);zA[u](o,i,h,r.transforms,!0)}})}function bz(n,e){var t=Qy(n.target,e.name);if(t){var r=xz(e,n),i=r[r.length-1];return{type:t,property:e.name,animatable:n,tweens:r,duration:i.end,delay:r[0].delay,endDelay:i.endDelay}}}function wz(n,e){return Hd(Wd(n.map(function(t){return e.map(function(r){return bz(t,r)})})),function(t){return!Ve.und(t)})}function GA(n,e){var t=n.length,r=function(s){return s.timelineOffset?s.timelineOffset:0},i={};return i.duration=t?Math.max.apply(Math,n.map(function(s){return r(s)+s.duration})):e.duration,i.delay=t?Math.min.apply(Math,n.map(function(s){return r(s)+s.delay})):e.delay,i.endDelay=t?i.duration-Math.max.apply(Math,n.map(function(s){return r(s)+s.duration-s.endDelay})):e.endDelay,i}var SA=0;function Sz(n){var e=Hy(_A,n),t=Hy(jy,n),r=yz(t,n),i=FA(n.targets),s=wz(i,r),o=GA(s,t),a=SA;return SA++,jd(e,{id:a,children:[],animatables:i,animations:s,duration:o.duration,delay:o.delay,endDelay:o.endDelay})}var on=[],AA=[],kd,Az=function(){function n(){kd=requestAnimationFrame(e)}function e(t){var r=on.length;if(r){for(var i=0;i<r;){var s=on[i];if(!s.paused)s.tick(t);else{var o=on.indexOf(s);o>-1&&(on.splice(o,1),r=on.length)}i++}n()}else kd=cancelAnimationFrame(kd)}return n}();function Mz(){document.hidden?(on.forEach(function(n){return n.pause()}),AA=on.slice(0),or.running=on=[]):AA.forEach(function(n){return n.play()})}typeof document<"u"&&document.addEventListener("visibilitychange",Mz);function or(n){n===void 0&&(n={});var e=0,t=0,r=0,i,s=0,o=null;function a(w){var b=window.Promise&&new Promise(function(S){return o=S});return w.finished=b,b}var l=Sz(n),c=a(l);function h(){var w=l.direction;w!=="alternate"&&(l.direction=w!=="normal"?"normal":"reverse"),l.reversed=!l.reversed,i.forEach(function(b){return b.reversed=l.reversed})}function u(w){return l.reversed?l.duration-w:w}function f(){e=0,t=u(l.currentTime)*(1/or.speed)}function d(w,b){b&&b.seek(w-b.timelineOffset)}function m(w){if(l.reversePlayback)for(var S=s;S--;)d(w,i[S]);else for(var b=0;b<s;b++)d(w,i[b])}function p(w){var b=0,S=l.animations,M=S.length;for(l.reversePlayback===!0&&l.rewind===!1&&(w=l.duration+l.delay-l.endDelay-w);b<M;){var _=S[b],y=_.animatable,T=_.tweens,E=T.length-1,C=T[E];E&&(C=Hd(T,function(K){return w<K.end})[0]||C);for(var I=Ei(w-C.start-C.delay,0,C.duration)/C.duration,B=isNaN(I)?1:C.easing(I),N=C.to.strings,H=C.round,j=[],Q=C.to.numbers.length,X=void 0,U=0;U<Q;U++){var F=void 0;if(l.reversePlayback===!0&&l.rewind===!1)var V=C.to.numbers[U],R=C.from.numbers[U]||0;else var R=C.to.numbers[U],V=C.from.numbers[U]||0;C.isPath?F=pz(C.value,B*R):F=V+B*(R-V),H&&(C.isColor&&U>2||(F=Math.round(F*H)/H)),j.push(F)}var G=N.length;if(!G)X=j[0];else{X=N[0];for(var W=0;W<G;W++){var Y=N[W],q=N[W+1],se=j[W];isNaN(se)||(q?X+=se+q:X+=se+" ")}}zA[_.type](y.target,_.property,X,y.transforms),_.currentValue=X,b++}}function g(w){l[w]&&!l.passThrough&&l[w](l)}function x(){l.remaining&&l.remaining!==!0&&l.remaining--}function v(w){var b=l.duration,S=l.delay,M=b-l.endDelay,_=u(w);l.progress=Ei(_/b*100,0,100),l.reversePlayback=_<l.currentTime,i&&m(_),!l.began&&l.currentTime>=0&&(l.began=!0,g("begin")),!l.loopBegan&&l.currentTime>0&&(l.loopBegan=!0,g("loopBegin")),_<=S&&l.currentTime!==0&&(p(0),g("change")),(_>=M&&l.currentTime!==b||!b)&&(p(b),g("change")),_>S&&_<M?(l.changeBegan||(l.changeBegan=!0,l.changeCompleted=!1,g("changeBegin")),g("change"),p(_)):l.changeBegan?(l.changeCompleted=!0,l.changeBegan=!1,g("change"),g("changeComplete")):l.began&&_>M&&(g("change"),g("changeComplete")),l.currentTime=Ei(_,0,b),l.began&&g("update"),w>=b&&(t=0,x(),l.remaining?(e=r,g("loopComplete"),l.loopBegan=!1,l.direction==="alternate"&&h()):(l.paused=!0,l.completed||(l.completed=!0,g("loopComplete"),g("complete"),!l.passThrough&&"Promise"in window&&(o(),c=a(l)))))}return l.reset=function(){var w=l.direction;l.passThrough=!1,l.currentTime=0,l.progress=0,l.paused=!0,l.began=!1,l.loopBegan=!1,l.changeBegan=!1,l.completed=!1,l.changeCompleted=!1,l.reversePlayback=!1,l.reversed=w==="reverse",l.remaining=l.loop,i=l.children,s=i.length;for(var b=s;b--;)l.children[b].reset();(l.reversed&&l.loop!==!0||w==="alternate"&&l.loop===1)&&l.remaining++,p(l.reversed?l.duration:0)},l.set=function(w,b){return UA(w,b),l},l.tick=function(w){r=w,e||(e=r),v((r+(t-e))*or.speed)},l.seek=function(w){v(u(w))},l.pause=function(){l.paused=!0,f()},l.play=function(){!l.paused||(l.completed&&l.reset(),l.paused=!1,on.push(l),f(),kd||Az())},l.reverse=function(){h(),l.completed=!l.reversed,f()},l.restart=function(){l.reset(),l.play()},l.reset(),l.autoplay&&l.play(),l}function MA(n,e){for(var t=e.length;t--;)Yy(n,e[t].animatable.target)&&e.splice(t,1)}function _z(n){for(var e=RA(n),t=on.length;t--;){var r=on[t],i=r.animations,s=r.children;MA(e,i);for(var o=s.length;o--;){var a=s[o],l=a.animations;MA(e,l),!l.length&&!a.children.length&&s.splice(o,1)}!i.length&&!s.length&&r.pause()}}function Tz(n,e){e===void 0&&(e={});var t=e.direction||"normal",r=e.easing?qy(e.easing):null,i=e.grid,s=e.axis,o=e.from||0,a=o==="first",l=o==="center",c=o==="last",h=Ve.arr(n),u=parseFloat(h?n[0]:n),f=h?parseFloat(n[1]):0,d=Ki(h?n[1]:n)||0,m=e.start||0+(h?u:0),p=[],g=0;return function(x,v,w){if(a&&(o=0),l&&(o=(w-1)/2),c&&(o=w-1),!p.length){for(var b=0;b<w;b++){if(!i)p.push(Math.abs(o-b));else{var S=l?(i[0]-1)/2:o%i[0],M=l?(i[1]-1)/2:Math.floor(o/i[0]),_=b%i[0],y=Math.floor(b/i[0]),T=S-_,E=M-y,C=Math.sqrt(T*T+E*E);s==="x"&&(C=-T),s==="y"&&(C=-E),p.push(C)}g=Math.max.apply(Math,p)}r&&(p=p.map(function(B){return r(B/g)*g})),t==="reverse"&&(p=p.map(function(B){return s?B<0?B*-1:-B:Math.abs(g-B)}))}var I=h?(f-u)/g:u;return m+I*(Math.round(p[v]*100)/100)+d}}function Ez(n){n===void 0&&(n={});var e=or(n);return e.duration=0,e.add=function(t,r){var i=on.indexOf(e),s=e.children;i>-1&&on.splice(i,1);function o(f){f.passThrough=!0}for(var a=0;a<s.length;a++)o(s[a]);var l=jd(t,Hy(jy,n));l.targets=l.targets||n.targets;var c=e.duration;l.autoplay=!1,l.direction=e.direction,l.timelineOffset=Ve.und(r)?c:Zy(r,c),o(e),l.rewind=e.rewind,e.seek(l.timelineOffset);var h=or(l);o(h),s.push(h);var u=GA(s,n);return e.delay=u.delay,e.endDelay=u.endDelay,e.duration=u.duration,e.seek(0),e.reset(),e.autoplay&&e.play(),e},e}or.version="3.2.0";or.speed=1;or.running=on;or.remove=_z;or.get=Ky;or.set=UA;or.convertPx=Jy;or.path=dz;or.setDashoffset=uz;or.stagger=Tz;or.timeline=Ez;or.easing=qy;or.penner=CA;or.random=function(n,e){return Math.floor(Math.random()*(e-n+1))+n};var kA=or;function VA(n,e,t){let r=n.cameraType==="OrthographicCamera"?e.orthographic?.zoom:e.perspective?.zoom;if(r!==void 0){let i=n.zoom;i!==r&&t.push({change:s=>{n.zoom=je.lerp(i,r,s),n.updateProjectionMatrix()}})}if(e.targetOffset!==void 0){let i=n.targetOffset,s=e.targetOffset;i!==s&&t.push({change:o=>{n.targetOffset=je.lerp(i,s,o)}})}}function HA(n,e,t){if(e.width!==void 0&&e.height!==void 0&&e.depth!==void 0){let{width:r,height:i,depth:s}=n.geometry.userData.parameters,o=[r,i,s],a=[e.width,e.height,e.depth];!sr.isEqual(o,a)&&!xt(n)&&t.push({change:l=>{let[c,h,u]=sr.lerp(o,a,l);n.updateGeometry({parameters:{width:c,height:h,depth:u}}),n.invalidateDownstreamBooleanData()}})}}function WA(n,e,t,r){if(e.intensity!==void 0){let i=n.intensity,s=e.intensity;i!==s&&t.push({change:o=>{n.intensity=je.lerp(i,s,o)}})}if(e.color!==void 0){let i=n.color.clone(),s=typeof e.color=="string"?r.getColor(e.color):e.color;if(!hr.equals(i,s)){let o=i.clone();n.color=o,t.push({change:a=>{let{r:l,g:c,b:h}=hr.lerp(i,s,a);o.setRGB(l,c,h)}})}}}function jA(n,e,t,r){let i=n.layersList.head;for(;i;){let s=e.layers.data(i.uuid);if(s&&(i.visible??!0)&&(s.visible??!0)){let o=i.getNames().filter(a=>!tS.some(l=>a.includes(l)));for(let a of o)try{let l=i.getValue(a);if(a==="steps")Nz(i,s,a,t);else if(a==="colors")Bz(i,s,a,t);else if(typeof l=="number")Cz(i,s,a,t);else{if(typeof l=="boolean")continue;"isVector2"in l?Dz(i,s,a,t):"isVector3"in l?Pz(i,s,a,t):"isColorA"in l?Iz(i,s,a,t,r):"isColor"in l?Lz(i,s,a,t,r):"isTexture"in l&&Oz(i,s,a,t)}}catch(l){console.error(`animateMaterial: unexpected material layer for ${a}`,l)}}i=i.next}}function Cz(n,e,t,r){if(!n.hasValue(t)||!(t in e))return;let i=n.getValue(t),s=e[t];i!==s&&r.push({change:o=>{n.setValue(t,je.lerp(i,s,o))}})}function Dz(n,e,t,r){if(!n.hasValue(t)||!(t in e))return;let i=n.getValue(t),s=i.toArray(),o=e[t];Hi.isEqual(s,o)||r.push({change:a=>{i.fromArray(Hi.lerp(s,o,a))}})}function Pz(n,e,t,r){if(!n.hasValue(t)||!(t in e))return;let i=n.getValue(t),s=i.toArray(),o=e[t];sr.isEqual(s,o)||r.push({change:a=>{i.fromArray(sr.lerp(s,o,a))}})}function Lz(n,e,t,r,i){if(!n.hasValue(t)||!(t in e))return;let s=n.getValue(t).clone(),o=e[t],a=typeof o=="string"?i.getColor(o):o;if(hr.equals(s,a))return;let l=s.clone();n.setValue(t,l),r.push({change:c=>{let{r:h,g:u,b:f}=hr.lerp(s,a,c);l.setRGB(h,u,f)}})}function Iz(n,e,t,r,i){if(!n.hasValue(t)||!(t in e))return;let s=n.getValue(t).clone(),o=e[t],a=typeof o=="string"?i.getColor(o):o;if(pn.equals(s,a))return;let l=s.clone();n.setValue(t,l),r.push({change:c=>{let{r:h,g:u,b:f,a:d}=pn.lerp(s,a,c);l.setRGBA(h,u,f,d)}})}function Nz(n,e,t="steps",r){if(!n.hasValue(t)||!(t in e))return;let i=[...n.getValue(t)],s=e[t];for(let o=0;o<i.length;++o){let a=i[o],l=s[o];a!==l&&r.push({change:c=>{i[o]=je.lerp(a,l,c),n.setValue("steps",i)}})}}function Bz(n,e,t="colors",r){if(!n.hasValue(t)||!(t in e))return;let i=n.getValue(t),s=e[t];for(let o=0;o<i.length;++o){let a=i[o].toArray(),l=s[o];Fc.isEqual(a,l)||r.push({change:c=>{i[o].fromArray(Fc.lerp(a,l,c))}})}}function Oz(n,e,t="texture",r){if(!n.hasValue(t)||!(t in e))return;let i=n.getValue("texture"),s=e[t],o=i.repeat.toArray(),a=i.offset.toArray(),l=s.repeat,c=s.offset;(!Hi.isEqual(o,l)||!Hi.isEqual(a,c))&&r.push({change:h=>{i.repeat.fromArray(Hi.lerp(o,l,h)),i.offset.fromArray(Hi.lerp(a,c,h)),i.updateMatrix(),i.needsUpdate=!0}})}function qA(n,e,t,r){if(r===0)return t.copy(n);if(r===1)return t.copy(e);let i=n.w*e.w+n.x*e.x+n.y*e.y+n.z*e.z;if(i>=1)return t.copy(n);let s=1-i*i;if(s<=Number.EPSILON){let h=1-r;return t.w=h*n.w+r*e.w,t.x=h*n.x+r*e.x,t.y=h*n.y+r*e.y,t.z=h*n.z+r*e.z,t.normalize(),t}let o=Math.sqrt(s),a=Math.atan2(o,i),l=Math.sin((1-r)*a)/o,c=Math.sin(r*a)/o;return t.w=n.w*l+e.w*c,t.x=n.x*l+e.x*c,t.y=n.y*l+e.y*c,t.z=n.z*l+e.z*c,t}function YA(n,e,t=0){let r=Array.isArray(n.material)?n.material[t]:n.material,i;return"materials"in e?i=e.materials[t]:"material"in e&&(i=e.material),[r,i]}var ev=new A,tv=new A,XA=new jt,Rz=new bn,Fz=new Be;function JA(n,e,t,r){if(t.position!==void 0){let i=n.position.toArray(),s=t.position;sr.isEqual(i,s)||r.push({change:o=>{n.position.fromArray(sr.lerp(i,s,o)),n.updateMatrix(),zt(n)&&xt(n.parent)&&n.invalidateDownstreamBooleanData(!0)}})}if(t.scale!==void 0){let i=n.scale.toArray(),s=t.scale;sr.isEqual(i,s)||r.push({change:o=>{n.scale.fromArray(sr.lerp(i,s,o)),n.updateMatrix(),zt(n)&&xt(n.parent)&&n.invalidateDownstreamBooleanData(!0)}})}zz(n,e,t,r),Uz(n,t,r)}function zz(n,e,t,r){if(t.rotation===void 0)return;let i=ev.setFromEuler(n.rotation).toArray(),s=t.rotation;if(sr.isEqual(i,s))return;if(sr.sub(t.rotation,e?e.rotation:n.rotation).every(a=>Math.abs(a)<2*Math.PI)){let a=n.quaternion.clone(),l=new jt().setFromEuler(Rz.set(t.rotation[0],t.rotation[1],t.rotation[2]));r.push({change:c=>{qA(a,l,n.quaternion,c),n.updateMatrix(),zt(n)&&xt(n.parent)&&n.invalidateDownstreamBooleanData(!0)}})}else r.push({change:a=>{n.rotation.setFromVector3(tv.fromArray(sr.lerp(i,s,a))),n.updateMatrix(),zt(n)&&xt(n.parent)&&n.invalidateDownstreamBooleanData(!0)}})}function Uz(n,e,t){if(e.hiddenMatrix!==void 0&&!hi.isEqual(n.hiddenMatrix.toArray(),e.hiddenMatrix)){let r=new A,i=new jt,s=new A;n.hiddenMatrix.decompose(r,i,s);let o=new A,a=new jt,l=new A;Fz.fromArray(e.hiddenMatrix).decompose(o,a,l),t.push({change:c=>{XA.slerpQuaternions(i,a,c),ev.lerpVectors(r,o,c),tv.lerpVectors(s,l,c),n.hiddenMatrix.compose(ev,XA,tv),zt(n)&&xt(n.parent)&&n.invalidateDownstreamBooleanData(!0)}})}}function QA(n,e,t,r){let i=[];if((n.visible||xt(n.parent))&&JA(n,e?.objectState,t.objectState,i),zt(n)){if((n.visible||xt(n.parent))&&"geometry"in t.objectState&&HA(n,t.objectState.geometry,i),n.visible&&("material"in t.objectState||"materials"in t.objectState)){let[s,o]=YA(n,t.objectState,n.selectedMaterial);s&&o&&typeof o!="string"&&jA(s,o,i,r)}}else n.visible&&m1(n)?WA(n,t.objectState,i,r):p1(n)&&VA(n,t.objectState,i);return i.length?{change:s=>{i.forEach(o=>{o.change&&o.change(s)})}}:void 0}function Gz(n,e,t){switch(n){case 0:return"cubicBezier( 0, 0, 1, 1 )";case 1:return"cubicBezier( .25, .1, .25, 1 )";case 2:return"cubicBezier( .42, 0, 1, 1 )";case 3:return"cubicBezier( 0, 0, .58, 1 )";case 4:return"cubicBezier( .42, 0, .58, 1 )";case 5:let{control1:r,control2:i}=e??{...Sf.defaultData};return`cubicBezier( ${r[0]}, ${r[1]}, ${i[0]}, ${i[1]} )`;case 6:let{mass:s,stiffness:o,damping:a,velocity:l}=t??{...wf.defaultData};return`spring( ${s}, ${o}, ${a}, ${l} )`}}var qd=class{constructor(e,t){this.object=e;this.sharedAssets=t;this.uuid=je.generateUUID();this.states=[];this.events={};this.animatingState=0;this._scrollCounter=null}get fromState(){return this._fromState}get animation(){return this._animation}start(){this._animation!==void 0&&(this._animation.pause(),this._animation=void 0,this._scrollCounter=null),this.states.length>1&&(this.states[0].execute(this.object,this.sharedAssets),this._toState=this.states[0],this._fromState=void 0)}end(){this._animation!==void 0&&(this._animation.pause(),this._animation=void 0),this.states.length>1&&this.states[0].execute(this.object,this.sharedAssets),this._toState=void 0,this._fromState=void 0}seek(e,t,r,i,s){this._scrollCounter===null&&(this.animate(e,i,s),this._scrollCounter=0),this._scrollCounter+=t,this._scrollCounter=Math.min(Math.max(this._scrollCounter,0),r),this._animation?.seek(this._scrollCounter/r*(i.duration?i.duration:1))}animate(e,t,r){if(this._fromState===e&&this._animation?.reversed){let i=this._animation?.currentTime??0;this._animation?.reset(),this._animation?.seek(i),this._animation?.play()}else if(this._toState!==e){this._animation!==void 0&&this._animation.pause(),this.animatingState=0,this._fromState=this._toState,this._toState=e;let i=QA(this.object,this._fromState,e,this.sharedAssets);if(!i)return;let s={t:0};this._animation=kA({autoplay:!1,loop:t.repeat?!0:t.cycle?1:!1,direction:t.cycle?"alternate":"normal",rewind:t.rewind,delay:t.startDelay,endDelay:t.endDelay,duration:t.duration,easing:Gz(t.easing,t.cubicControls,t.springParameters),targets:s,t:1,change:()=>{i.change&&i.change(s.t),r?.change&&r.change(s.t)},loopBegin:o=>{if(this.animatingState===0){this.animatingState=1;return}o.reversed?(this._toState=this._fromState,this._fromState=e):(this._fromState=this._toState,this._toState=e)}}),t.autoplay?t.startOnceDelay>0?setTimeout(()=>this._animation?.play(),t.startOnceDelay):this._animation?.play():this._animation.finished.then(()=>{this._animation=void 0,this.animatingState=0})}}emitEvent(e){if(e==="keyDown"||e==="keyUp"||e==="mouseDown"||e==="mouseUp"||e==="mouseHover"||e==="scroll"||e==="start"){let t=this.events[e];if(t){for(let r of t)if("targets"in r)for(let{object:i,state:s,params:o}of r.targets)i.interaction?.animate(s,o)}}}emitEventReverse(e){if(e==="keyDown"||e==="keyUp"||e==="mouseDown"||e==="mouseUp"||e==="mouseHover"||e==="scroll"||e==="start"){let t=this.events[e];if(t){for(let r of t)if("targets"in r)for(let{object:i,params:s}of r.targets){let o=i.interaction;o?._fromState!==void 0&&o.animate(o._fromState,s)}}}}};var Vl=class{static create(e,t){if(e.object){let r=t.find(e.object);if(r?.interaction){let i=e.state?r.interaction.states.find(s=>s.uuid===e.state):r.interaction.states[0];if(i){let s=e.delay??0,o={cycle:e.cycle??!1,rewind:e.rewind??!1,repeat:e.repeat??!1,duration:e.duration??1e3,startOnceDelay:e.delayDirection==="start-once"?s:0,startDelay:e.delayDirection==="start"||!e.delayDirection?s:0,endDelay:e.delayDirection==="end"||!e.delayDirection?s:0,easing:e.easing??4,autoplay:!0};if(e.easing===5){let a=e;o.cubicControls={control1:[...a.control1],control2:[...a.control2]}}if(e.easing===6){let a=e;o.springParameters={mass:a.mass,stiffness:a.stiffness,damping:a.damping,velocity:a.velocity}}return new Vl(r,i,o)}}}}constructor(e,t,r){this.object=e,this.state=t,this.params=r}};var rv=new Map,Ch={url:"head",time:0,data:null,next:null,prev:null},Hl={url:"tail",time:1/0,data:null,next:null,prev:null};Ch.next=Hl;Hl.prev=Ch;var KA=0;function Gs(n){if(typeof n=="string")return n;let e=Date.now(),t=rv.get(n);return t===void 0?(t={url:URL.createObjectURL(new Blob([n])),data:n,time:e,next:null,prev:null},rv.set(n,t)):(t.time=e,t.prev.next=t.next,t.next.prev=t.prev),t.prev=Hl.prev,t.next=Hl,Hl.prev.next=t,Hl.prev=t,e-KA>1e3*10&&(KA=e+1e3,setTimeout(()=>{let r=Date.now(),i=Ch.next;for(;i.time<r-1e3*10;)URL.revokeObjectURL(i.url),rv.delete(i.data),i=i.next,i.prev=Ch,Ch.next=i},900)),t.url}var ZA=new Ir,No=class extends Cr{},Yd=class{constructor(e){this.materials={};this.images={};this.colors={};this.transmissionRenderTarget=new ut(2048,2048,{generateMipmaps:!0,minFilter:Ss,magFilter:et,wrapS:mr,wrapT:mr}),this.transmissionRenderTarget.depthTexture=new li(2048,2048),this.penumbraSizeNode=new Lr(5,e.penumbraSize),this.reset(e)}reset(e){for(let[t,r]of Object.entries(e.images))this.addImage(t,r.data);for(let[t,r]of Object.entries(e.colors))this.addColor(t,r);for(let[t,r]of Object.entries(e.materials))this.addMaterial(t,fy(r,this))}get transmissionSamplerMap(){return this.transmissionRenderTarget.texture}get transmissionDepthMap(){return this.transmissionRenderTarget.depthTexture}addMaterial(e,t){t.uuid=e,this.materials[e]=t}deleteMaterial(e){this.materials[e]&&(this.materials[e].dispose(),delete this.materials[e])}isSharedMaterial(e){return e.uuid in this.materials||e===ZA}getMaterial(e){let t=this.materials[e];return t}getMaterialOrDeletedPlaceholder(e){return this.materials[e]??ZA}getMaterials(){return this.materials}addImage(e,t){if(this.images[e])return this.images[e].onload=()=>{this.onImageLoad&&this.onImageLoad()},this.images[e].src=Gs(t),!0;{let r=new Image;return r.src=Gs(t),r.onload=()=>{this.onImageLoad&&this.onImageLoad()},this.images[e]=r,!1}}deleteImage(e){this.images[e]&&delete this.images[e]}getDefaultImage(){return this.images.image_0}getImage(e){return this.images[e]}getImages(){return this.images}addColor(e,t){return this.colors[e]?("a"in t?this.colors[e].setRGBA(t.r,t.g,t.b,t.a):this.colors[e].setRGBA(t.r,t.g,t.b,1),!0):("a"in t?this.colors[e]=new No(t.r,t.g,t.b,t.a):this.colors[e]=new No(t.r,t.g,t.b,1),!1)}updateColor(e,t){if(this.colors[e]){let r=this.colors[e];return this.colors[e].r=t.r??r.r,this.colors[e].g=t.g??r.g,this.colors[e].b=t.b??r.b,this.colors[e].a=t.a??r.a,!0}return!1}deleteColor(e){this.colors[e]&&delete this.colors[e]}getColor(e){return this.colors[e]}dispose(){Object.keys(this.materials).forEach(t=>this.deleteMaterial(t)),this.transmissionRenderTarget.depthTexture.dispose(),this.transmissionRenderTarget.dispose(),this.onImageLoad=void 0}};function kz(n,e){switch(n.type){case"noise":return e==="noiseType";case"texture":return e==="projection"||e==="axis"||e==="side";case"displace":return e==="noiseType";case"depth":return e==="num"||e==="smooth"||e==="isWorldSpace"||e==="gradientType";default:return!1}}function nv(n,e,t,r,i){let s=!1;for(let[o,a]of Object.entries(n)){if(!o||a===void 0||Ad(o,t,i))continue;t.visible=i.visible;let l=t.uniforms[`f${t.id}_${o}`];if(!!l)switch(l.constructor){case _t:if(typeof a=="string"){let c=e.getColor(a);c&&(l.value=c);break}else{let c=a;l.value instanceof No?l.value=new Cr(c.r,c.g,c.b,c.a):l.setRGBA(c);break}case qn:if(typeof a=="string"){let c=e.getColor(a);c&&(l.value=c);break}else{let c=a;l.value instanceof No?l.value=new Cr(c.r,c.g,c.b,c.a):l.value.setRGBA(c.r,c.g,c.b,c.a);break}case wr:{let c=a;l.value.setX(c[0]),l.value.setY(c[1]);break}case Sr:{let c=a;l.value.setX(c[0]),l.value.setY(c[1]),l.value.setZ(c[2]);break}case Dr:{let c=a;if("image"in c){let h=c.image;if(typeof h=="string"){let u=e.getImage(h);u&&(l.value.image=u)}else{let u=new Image;u.src=Gs(h.data),l.value.image=u}}"wrapping"in c&&(l.value.wrapS=l.value.wrapT=c.wrapping),"repeat"in c&&l.value.repeat.fromArray(c.repeat),"offset"in c&&l.value.offset.fromArray(c.offset),l.value.needsUpdate=!0;break}case qi:{a.forEach((c,h)=>{l.value[h].setX(c[0]),l.value[h].setY(c[1]),l.value[h].setZ(c[2]),l.value[h].setW(c[3])});break}default:{s=s||kz(t,o),l.value=a;break}}}if(s&&i){let o=Sd({id:"0",fi:0,data:i},e);r.userData.layers?.changeLayer(t.id,{...o}),r.dispose(),r.needsUpdate=!0}}var iv=new A,$A=new Gr,eM=new Be,Dh={type:"follow",normal:new A,raycaster:new Os},Wl;(t=>{function n(r){if(r.type===10)return{type:"follow"}}t.create=n;function e({target:r,normal:i,raycaster:s,begin:o,change:a}){!r||!i||!s||(o&&o("follow",r.uuid),$A.setFromNormalAndCoplanarPoint(i,r.getWorldPosition(iv)),s.ray.intersectPlane($A,iv),r.position.copy(iv),r.parent!==null&&r.position.applyMatrix4(eM.copy(r.parent.matrixWorld).invert()),r.position.applyMatrix4(eM.copy(r.hiddenMatrix).invert()),r.updateMatrix(),zt(r)&&xt(r.parent)&&r.invalidateDownstreamBooleanData(!0),a&&a())}t.listener=e})(Wl||(Wl={}));var sv=new A,tM=new Gr,Ph={type:"lookAt",normal:new A,raycaster:new Os},jl;(t=>{function n(r){if(r.type===9&&r.distance)return{type:"lookAt",distance:r.distance}}t.create=n;function e({target:r,normal:i,raycaster:s,begin:o,change:a}){if(!r?.interaction?.events.lookAt?.length||!i||!s)return;o&&o("lookAt",r.uuid);let l=r.interaction.events.lookAt[0].distance;tM.set(i,-l),s.ray.intersectPlane(tM,sv),r.lookAt(sv),r.updateMatrix(),r.interaction.animation?.finished.then(()=>{r.lookAt(sv),r.updateMatrix(),zt(r)&&xt(r.parent)&&r.invalidateDownstreamBooleanData(!0)}),zt(r)&&xt(r.parent)&&r.invalidateDownstreamBooleanData(!0),a&&a()}t.listener=e})(jl||(jl={}));var ov={type:"start"},ql;(t=>{function n(r){if(r.type===7)return{type:"start",targets:[]}}t.create=n;function e({target:r,begin:i,change:s}){if(!r?.interaction?.events.start?.length)return;i&&i("start",r.uuid);let o={change:s};r.interaction.events.start.forEach(a=>{a.targets.forEach(({object:l,state:c,params:h})=>l.interaction?.animate(c,h,o))})}t.listener=e})(ql||(ql={}));var Xd={type:"scroll"},Yl;(t=>{function n(r){if(!(r.type!==11||r.steps===void 0))return{type:"scroll",targets:[],steps:r.steps}}t.create=n;function e({target:r,deltaY:i,begin:s,change:o}){if(!r?.interaction?.events.scroll?.length||!i)return;s&&s("scroll",r.uuid);let a={change:o},l=i>0?1:-1;r.interaction.events.scroll.forEach(c=>{c.targets.forEach(({object:h,state:u,params:f})=>{let d={...f,autoplay:!1};h.interaction?.seek(u,l,c.steps,d,a)})})}t.listener=e})(Yl||(Yl={}));var Jl={type:"mouseHover"},Xl;(t=>{function n(r){if(r.type===2)return{type:"mouseHover",targets:[]}}t.create=n;function e({target:r,begin:i,change:s,enter:o}){if(!r?.interaction?.events.mouseHover?.length||o===void 0)return;i&&i("mouseHover",r.uuid);let a={change:s};o?r.interaction.events.mouseHover.forEach(l=>{l.targets.forEach(({object:c,state:h,params:u})=>{c.interaction?.animate(h,u,a)})}):r.interaction.events.mouseHover.forEach(l=>{l.targets.forEach(({object:c,params:h})=>{let u=c.interaction;u?.fromState!==void 0&&u.animate(u.fromState,h,a)})})}t.listener=e})(Xl||(Xl={}));var av={type:"mouseDown"},lv={type:"mouseUp"},Jd={type:"keyDown"},Qd={type:"keyUp"},Zi;(t=>{function n(r){let i,s;if(r.type===0)i={type:"mousedown"},s="mouseDown";else if(r.type===1)i={type:"mouseup"},s="mouseUp";else if(r.type===5){if(!r.key)return;i={type:"keydown",key:r.key},s="keyDown"}else if(r.type===6){if(!r.key)return;i={type:"keyup",key:r.key},s="keyUp"}else return;return{type:s,domEvent:i,targets:[],url:r.url??void 0,toggle:r.toggle??!1,enable:!1}}t.create=n;function e({target:r,interactionEvents:i,type:s,begin:o,change:a}){if(!r)return;i||(i=r.interaction?.events[s]),o&&o(s,r.uuid);let l={change:a};i.forEach(c=>{if(c.toggle){c.enable=!c.enable;for(let{object:h,state:u,params:f}of c.targets){let d=h.interaction;if(d!==void 0){let m={...f,cycle:!1,rewind:!1,repeat:!1};c.enable?d.animate(u,m,l):d.fromState!==void 0&&d.animate(d.fromState,m,l)}}}else c.targets.forEach(({object:h,state:u,params:f})=>h.interaction?.animate(u,f,l));c.url&&(wo?window.location.assign(c.url):window.open(c.url,"_blank"))})}t.listener=e})(Zi||(Zi={}));function Vz(n){let e,{type:t}=n;return t===10?e=Wl.create(n):t===0||t===1||t===5||t===6?e=Zi.create(n):t===9?e=jl.create(n):t===2?e=Xl.create(n):t===11?e=Yl.create(n):t===7&&(e=ql.create(n)),e}function rM(n,e,t){let r=[];n.objects.traverse((i,s)=>{let o=e.find(i);if(delete o.interaction,!s.visible&&!xt(o.parent)||s.states===void 0)return;let a=new qd(o,t),l=a.states;l.push(Bo.create(i,s));for(let h of s.states){let u=jc.patch(s,h.data);l.push(Bo.create(h.id,u))}let c=a.events;if(s.events)for(let{data:h}of s.events){let u=Vz(h);if(!u)continue;let f=u.type;c[f]?c[f].push(u):c[f]=[u],"targets"in h&&r.push([h,u])}(l.length>0||Object.keys(c).length>0)&&(o.interaction=a)});for(let[i,s]of r)if("targets"in i&&"targets"in s)for(let{data:o}of i.targets){let a=Vl.create(o,e);a&&s.targets.push(a)}}function nM(n,e,t,r,i=!1){if(!i&&e.states.length===0)return;let s=t===null?e:jc.patch(e,e.states.data(t));if(my(n,s),n instanceof Ct&&s.type==="Mesh"){if(n instanceof Ws?n.buildFromStore(s.geometry):n.updateGeometry({parameters:s.geometry}),n.freeBooleanPointer(),xt(n.parent)&&n.parent.invalidateDownstreamBooleanData().recomputeBoolean(),"material"in s){if(n.material instanceof Array)return;if(typeof s.material!="string"){let a=s.material.layers;for(let l of a){let c=n.material.userData.layers.getLayerByUuid(l.id);nv(l.data,r,c,n.material,l.data)}}}else if("materials"in s){if(!(n.material instanceof Array))return;var o=0;for(let a of s.materials){if(typeof a!="string"){let l=a.layers;for(let c of l){let h=n.material[o].userData.layers.getLayerByUuid(c.id);nv(c.data,r,h,n.material[o],c.data)}}o++}}}else if(s.type==="DirectionalLight")n.fromDirectionalLightState(s,r);else if(s.type==="PointLight")n.fromPointLightState(s,r);else if(s.type==="SpotLight")n.fromSpotLightState(s,r);else if(n instanceof yn&&Ls.is(s.type)){let a=s;n.setZoom("PerspectiveCamera",a.perspective.zoom),n.setZoom("OrthographicCamera",a.orthographic.zoom),n.isUpVectorFlipped=a.isUpVectorFlipped,n.targetOffset=a.targetOffset}}var Bo=class{constructor(e){this.objectState=e;this.uuid=je.generateUUID()}static create(e,t){let r=new Bo(t);return r.uuid=e,r}execute(e,t){nM(e,this.objectState,null,t,!0)}};var Di=new Os,Ln=new A,cv={follow:Wl.listener,keyDown:Zi.listener,keyUp:Zi.listener,lookAt:jl.listener,mouseDown:Zi.listener,mouseUp:Zi.listener,mouseHover:Xl.listener,scroll:Yl.listener,start:ql.listener},iM={follow:Dh,keyDown:Jd,keyUp:Qd,lookAt:Ph,mouseDown:av,mouseUp:lv,mouseHover:Jl,scroll:Xd,start:ov};function Hz(n){if(n.style.transform!==""){let e=getComputedStyle(n).getPropertyValue("transform");if(e!=="none"){let t=e.replace("matrix(","").split(",");return{x:parseFloat(t[0]),y:parseFloat(t[3])}}}return{x:1,y:1}}function sM(n){let e=n.getViewport(new Ke),t=Hz(n.domElement);return{left:e.x*t.x,top:e.y*t.y,width:e.z*t.x,height:e.w*t.y}}function hv(n,e){if(zt(e)){if(!e.raycastLock&&e.visible){let t=n.intersectObject(e,!1);return t.length?t[0]:void 0}}else if(e.objectType==="EmptyObject")return oM(n,e)}function oM(n,e){if(zt(e)&&!e.raycastLock&&e.visible){let t=n.intersectObject(e,!1);if(t.length)return t[0]}for(let t of e.children)if(Do(t)){let r=oM(n,t);if(r)return r}}var Kd=class{constructor(e,t,r,i){this.isEnable=!1;this.splineEvents={};this._map={};this._prevObjects=[];this._onMouseDown=e=>{Di.setFromCamera(this._getPointer(e.clientX,e.clientY),this._camera),this._camera.getWorldDirection(Ln),Ln.negate(),this._handleMouseDownEvent(e)};this._onMouseUp=e=>{Di.setFromCamera(this._getPointer(e.clientX,e.clientY),this._camera),this._camera.getWorldDirection(Ln),Ln.negate(),this._handleMouseUpEvent(e)};this._onMouseMove=e=>{Di.setFromCamera(this._getPointer(e.clientX,e.clientY),this._camera),this._camera.getWorldDirection(Ln),Ln.negate(),this._handleMouseHoverEvent(e),this._handleLookAtEvent(e),this._handleFollowEvent(e)};this._onTouchStart=e=>{e.touches.length===1&&(Di.setFromCamera(this._getPointer(e.touches[0].clientX,e.touches[0].clientY),this._camera),this._camera.getWorldDirection(Ln),Ln.negate(),this._handleMouseDownEvent(e),this._handleMouseHoverEvent(e),this._handleLookAtEvent(e),this._handleFollowEvent(e))};this._onTouchEnd=e=>{this._handleMouseUpEvent(e),this._handleMouseHoverEvent(e,!0)};this._onTouchMove=e=>{e.touches.length===1&&(Di.setFromCamera(this._getPointer(e.touches[0].clientX,e.touches[0].clientY),this._camera),this._camera.getWorldDirection(Ln),Ln.negate(),this._handleMouseHoverEvent(e),this._handleLookAtEvent(e),this._handleFollowEvent(e))};this._onWheel=e=>{this._handleWheelEvent(e)};this._onKeyDown=e=>{this._handleKeyDownEvent(e)};this._onKeyUp=e=>{this._handleKeyUpEvent(e)};this._renderer=e,this._domElement=e.domElement,this._camera=r,this._scene=t,this._app=i,this._domRect=this._domElement.getBoundingClientRect(),this._viewRect=sM(e)}activate(){this.isEnable=!0,this._map={},this._scene.traverseEntity(e=>{e.interaction!==void 0&&(e.interaction.start(),Object.keys(e.interaction.events).forEach(t=>{let r=t;this._addDOMCustomEvent(r,e),(e.visible||r!=="mouseDown"&&r!=="mouseUp"&&r!=="mouseHover")&&this._addSPEEvent(r,e)}))}),xf?((this._map.mouseDown?.length||this._map.mouseHover?.length||this._map.lookAt?.length||this._map.follow?.length)&&this._domElement.addEventListener("touchstart",this._onTouchStart),(this._map.mouseUp?.length||this._map.mouseHover?.length)&&this._domElement.addEventListener("touchend",this._onTouchEnd),(this._map.mouseHover?.length||this._map.lookAt?.length||this._map.follow?.length)&&this._domElement.addEventListener("touchmove",this._onTouchMove)):(this._map.mouseDown?.length&&this._domElement.addEventListener("pointerdown",this._onMouseDown),this._map.mouseUp?.length&&this._domElement.addEventListener("pointerup",this._onMouseUp),(this._map.mouseHover?.length||this._map.lookAt?.length||this._map.follow?.length)&&this._domElement.addEventListener("pointermove",this._onMouseMove)),this._map.scroll?.length&&this._domElement.addEventListener("wheel",this._onWheel),this._map.keyDown?.length&&document.addEventListener("keydown",this._onKeyDown),this._map.keyUp?.length&&document.addEventListener("keyup",this._onKeyUp),this._map.start?.length&&this._handleStartEvent(),this.resize()}deactivate(){this._scene.traverseEntity(e=>{if(!e.interaction)return;e.interaction.end();let t=e;Object.keys(cv).forEach(r=>{let i=r;t.removeEventListener(i,cv[i])})}),this._domElement.removeEventListener("pointerdown",this._onMouseDown),this._domElement.removeEventListener("pointerup",this._onMouseUp),this._domElement.removeEventListener("pointermove",this._onMouseMove),this._domElement.removeEventListener("touchstart",this._onTouchStart),this._domElement.removeEventListener("touchend",this._onTouchEnd),this._domElement.removeEventListener("touchmove",this._onTouchMove),this._domElement.removeEventListener("wheel",this._onWheel),document.removeEventListener("keydown",this._onKeyDown),document.removeEventListener("keyup",this._onKeyUp),this._map={},this.isEnable=!1}reset(){this._scene.traverseEntity(e=>{e.interaction?.start()}),this._handleStartEvent()}resize(){this._domRect=this._domElement.getBoundingClientRect(),this._viewRect=sM(this._renderer)}_getPointer(e,t){let r=this._domRect,i=this._viewRect,s=r.height-i.height,o=(e-i.left-r.left)*(r.width/i.width),a=(t-s+i.top-r.top)*(r.height/i.height);return{x:o/r.width*2-1,y:-(a/r.height)*2+1}}_handleStartEvent(){this._map.start?.forEach(e=>{e.dispatchEvent(ov)})}_handleWheelEvent(e){this._map.scroll?.length&&(Xd.deltaY=e.deltaY,this._map.scroll.forEach(t=>{t.dispatchEvent(Xd)}))}_handleMouseDownEvent(e){this._map.mouseDown?.forEach(t=>{hv(Di,t)&&t.dispatchEvent(av)})}_handleMouseUpEvent(e){this._map.mouseUp?.forEach(t=>{hv(Di,t)&&t.dispatchEvent(lv)})}_handleMouseHoverEvent(e,t=!1){let r=[];t||this._map.mouseHover?.forEach(i=>{hv(Di,i)&&r.push(i)}),this._prevObjects.length&&(Jl.enter=!1,this._prevObjects.forEach(i=>{r.includes(i)||i.dispatchEvent(Jl)})),r.length&&(Jl.enter=!0,r.forEach(i=>{i.dispatchEvent(Jl)})),this._prevObjects=r}_handleLookAtEvent(e){this._map.lookAt?.length&&(Ph.normal=Ln,Ph.raycaster=Di,this._map.lookAt.forEach(t=>{t.dispatchEvent(Ph)}))}_handleFollowEvent(e){this._map.follow&&(Dh.normal=Ln,Dh.raycaster=Di,this._map.follow.forEach(t=>t.dispatchEvent(Dh)))}_handleKeyDownEvent(e){this._map.keyDown?.forEach(t=>{Jd.interactionEvents=t.interaction?.events?.keyDown?.filter(r=>r.domEvent.type==="keydown"&&r.domEvent.key===e.key),t.dispatchEvent(Jd)})}_handleKeyUpEvent(e){this._map.keyUp?.forEach(t=>{Qd.interactionEvents=t.interaction?.events?.keyUp?.filter(r=>r.domEvent.type==="keyup"&&r.domEvent.key===e.key),t.dispatchEvent(Qd)})}_addSPEEvent(e,t){!t.interaction||(iM[e].begin=this._dispatchDOMCustomEvent.bind(this),iM[e].change=this._app.requestRender.bind(this),t.interaction.events[e]?.length&&(t.addEventListener(e,cv[e]),this._map[e]===void 0?this._map[e]=[t]:this._map[e].push(t)))}_addDOMCustomEvent(e,t){if(e){let r=new CustomEvent(e,{bubbles:!0});Object.defineProperty(r,"target",{writable:!1,value:{id:t.uuid,name:t.name}}),this.splineEvents[e]?this.splineEvents[e][t.uuid]=r:this.splineEvents[e]={[t.uuid]:r}}}_dispatchDOMCustomEvent(e,t){let r=this.splineEvents[e]?.[t];r&&this._domElement.dispatchEvent(r)}};var Zd=class{constructor(e,t,r,i,s){this._aspect=1;this._renderer=e,this._camera=t,this._frameSize=new O().copy(r),this._editorSize=new O().copy(i),this._aspect=t.aspect,this._fov=s??t.fov}set frameSize(e){this._frameSize.copy(e)}updateRenderer(){!this._renderer||this._renderer.setSize(this._frameSize.x,this._frameSize.y,!1)}updateViewportForImageExport(){if(!this._renderer||!this._camera||this._camera.cameraType!=="PerspectiveCamera")return;let e=this._frameSize.x,t=this._frameSize.y,r=this._editorSize.x,i=this._editorSize.y;this._aspect=e/t,this._camera.zoom*=Math.min(r/e,i/t),this._renderer.setViewport(0,0,e,t)}updateViewport(){if(!this._renderer||!this._camera||this._camera.cameraType!=="PerspectiveCamera")return;let e=this._frameSize.x,t=this._frameSize.y,r=this._editorSize.x,i=this._editorSize.y,s=0,o=0,a=e,l=t;e<r&&(s=(r-e)*.5,s=-s,a=r),t<i&&(o=(i-t)*.5,o=-o,l=i),this._aspect=a/l,this._renderer.setViewport(s,o,a,l)}updateCamera(){if(!!this._camera)if(this._camera.cameraType==="PerspectiveCamera"){let e=this._frameSize.y,t=this._editorSize.y,r=this._fov;if(e>t){let i=Wz(e,1080,2160,1,15)/100;r*=e/t,r*=1-i}this._camera.aspect=this._aspect,this._camera.fov=r,this._camera.updateProjectionMatrix()}else this._camera.setViewplaneSize(this._frameSize.x,this._frameSize.y)}revert(){let e=window.innerWidth,t=window.innerHeight;this._renderer&&(this._renderer.setViewport(0,0,e,t),this._renderer.setSize(e,t,!1)),this._camera&&(this._camera.aspect=e/t,this._camera.fov=this._fov,this._camera.setViewplaneSize(e,t),this._camera.updateProjectionMatrix())}};function Wz(n,e,t,r,i){return(n-e)/(t-e)*(i-r)+r}var $d=class{constructor(e){this.sharedAssets=new Yd(e.shared),this.scene=new Ud(e.scene,this.sharedAssets),this.scene.switchActiveCamera(this.scene.activeCamera)}reset(e,t){this.scene.clearScene(this.sharedAssets),this.sharedAssets.reset(e.shared),this.scene.resetAfterClear(e.scene,this.sharedAssets)}dispose(){this.scene.dispose()}};var ep=class{constructor({x:e=10,y:t=10}){this._startTime=0;let r=document.getElementById("spe-perfs");r?this.element=r:(this.element=document.createElement("div"),document.body.appendChild(this.element),this.element.style.position="absolute",this.element.style.zIndex="10000",this.element.style.fontFamily="monospace",this.element.style.background="black",this.element.style.color="white",this.element.style.padding="10px",this.element.style.opacity="0.5",this.element.style.fontSize="11px",this.element.setAttribute("id","spe-perfs")),this.element.style.left=`${e}px`,this.element.style.top=`${t}px`}dispose(){this.element.parentElement?.removeChild(this.element)}start(){this._startTime=performance.now()}end(){let t=performance.now()-this._startTime;this.element.innerHTML=t.toFixed(3)+" ms"}};function jz(n){let e;if(!!n.index)for(let t=0;t<n.index.array.length;t+=3)e=n.index.array[t],n.index.array[t]=n.index.array[t+2],n.index.array[t+2]=e}function uv(n){return n==="SubdivObject"||n==="NonParametric"?n:"Mesh"}function qz(n,e){let t={};return n.traverseEntity(r=>{if(r.type!=="Mesh"||!("material"in r)||!r.visible||!(r instanceof Ct)||Array.isArray(r.material)||r&&r.interaction&&r.interaction.states.length>0)return;let i=r.parent;for(;i;){if(i instanceof Ct&&i.interaction&&i.interaction.states.length>1)return;i=i.parent}let s=r.material.uuid,o=e.shared.materials[s];if(o){if(!Wn.isMergable(o))return}else{let c=e.scene.objects.get(r.uuid)?.data;if(c&&"material"in c&&typeof c.material!="string"){if(!Wn.isMergable(c.material))return;s=Wn.getHash(c.material)}}t[s]||(t[s]={});let l=t[s][uv(r.objectType)];if(l){if(l.push(r),r.cloner)for(let c of r.cloner.children)l.push(c)}else if(t[s][uv(r.objectType)]=[r],r.cloner)for(let c of r.cloner.children)t[s][uv(r.objectType)].push(c)}),t}function Yz(n){let e=0;return Object.values(n).forEach(t=>{Object.values(t).forEach(r=>{let i=r.length;i>e&&(e=i)})}),e}function aM(n,e){let t=qz(e,n),r=Yz(t),i=new Array(r),s=0,o=new Array(r),a=0,l=new Array(r),c=0,h=new Array(r),u=0;for(let f of Object.values(t))for(let d of Object.values(f)){if(a=0,c=0,d.forEach(p=>{p instanceof Ct&&(o[a++]=p.geometry.clone(),l[c++]=p)}),c<2)continue;for(let p=0;p<c;p++)l[p].updateWorldMatrix(!0,!1),o[p].applyMatrix4(l[p].matrixWorld),l[p].matrixWorld.determinant()<0&&jz(o[p]);let m=aS(o.slice(0,a),!1);if(m){let p;switch(d[0].objectType){case"SubdivObject":{console.warn("Turning subdiv object into mesh"),p=new ir(m,l[0].material);break}default:{p=new ir(m,l[0].material);break}}p.castShadow=l[0].castShadow,p.receiveShadow=l[0].receiveShadow,e.add(p);let g=x=>{u=0;for(let v of x)v.children&&g(v.children),v instanceof Ct&&(Array.isArray(v.material)||t[v.material.uuid]&&t[v.material.uuid][v.objectType]&&t[v.material.uuid][v.objectType].length>1||(h[u++]=v));for(let v=0;v<u;v++)e.attach(h[v])};for(let x=0;x<c;x++){let v=l[x];g(v.children),i[s++]=v}}}for(let f=0;f<s;f++)i[f].removeFromParent()}var Xz=new O,lM="The Spline Runtime only accepts .splinecode files that are generated from Spline export panel.",fv=class{constructor(e,{autoRender:t=!1}={}){this._viewportMode=1;this._viewportWidth=window.innerWidth;this._viewportHeight=window.innerHeight;this._proxyObjectCache=new Map;this._skipRender=!0;this.autoRender=!1;this.disposed=!1;this.requestRender=()=>{this._skipRender=!1};this.render=()=>{!this._renderer||(this._rafId=requestAnimationFrame(this.render),this._perfs?.start(),!(!this.autoRender&&this._skipRender)&&(this._controls&&(this._controls.enableDamping||this._controls.autoRotate)?this._skipRender=!this._controls.update():this._skipRender=!0,this._playmode&&!this._playmode.isEnable&&this._playmode.activate(),this._scene&&this._camera&&(this._renderer.autoClear=!1,this._transmissionRenderTarget&&(this._renderer.setRenderTarget(this._transmissionRenderTarget),this._renderer.clear(),this._camera.layers.enable(0),this._camera.layers.disable(3),this._renderer.render(this._scene,this._camera),this._renderer.setRenderTarget(null),this._camera.layers.enable(3)),this._scene.postprocessing?.enabled?(this._renderer.autoClear=!1,this._scene.postprocessing.render()):(this._renderer.autoClear=!0,this._renderer.render(this._scene,this._camera))),this._perfs?.end()))};this.resize=Ic(()=>{!this._renderer||(this._viewportMode===1&&this._frameView&&(this._frameView.frameSize=Xz.set(this._viewportWidth,this._viewportHeight)),this._frameView?.updateRenderer(),this._scene?.postprocessing&&this._scene.postprocessing.resize(this._viewportWidth,this._viewportHeight,!1),this._viewportMode!==1&&this._frameView?.updateViewport(),this._camera&&(this._frameView?.updateCamera(),this._camera.cameraType==="PerspectiveCamera"&&this._viewportMode===1&&(this._camera.aspect=this._viewportWidth/this._viewportHeight),this._camera.updateProjectionMatrix()),this._playmode?.resize(),this.requestRender())},10);this.canvas=e,this.autoRender=t,py(),window.location.search.includes("perfs")&&(this._perfs=new ep({x:10,y:10}))}async load(e){e.endsWith(".spline")?console.warn(lM+" The .spline files are only meant to be used by the Editor."):e.endsWith(".splinecode")||console.warn(lM);let r=await(await fetch(e)).arrayBuffer();await this.start(r)}async start(e){if(this.disposed)return;let t=await xA(e);Sy(t)&&await L1();let r=new $d(t);if(window.location.search.includes("merge-geometries")){let f=performance.now();aM(t,r.scene);let d=performance.now();console.log("Merged geometries in ",d-f," ms")}this._scene=r.scene,Sy(t)&&this._scene.traverse(f=>{xt(f)&&f.recomputeBoolean()}),this._sharedAssetsManager=r.sharedAssets,this._sharedAssetsManager.onImageLoad=()=>{this.requestRender()},rM(t.scene,this._scene,this._sharedAssetsManager),this._camera=this._scene.activeCamera;let i=Object.values(t.frames)[0],s,o;if(i)if(i.preset==="fullscreen"){this._viewportMode=1;let{width:f,height:d}=window.getComputedStyle(this.canvas);this.canvas.parentElement&&(f==="300px"||f==="auto")?(this._viewportWidth=this.canvas.parentElement.clientWidth||300,this.canvas.style.width="100%",s=this.canvas.style.width):this._viewportWidth=this.canvas.clientWidth,this.canvas.parentElement&&(d==="150px"||d==="auto")?(this._viewportHeight=this.canvas.parentElement.clientHeight||150,this.canvas.style.height="100%",o=this.canvas.style.height):this._viewportHeight=this.canvas.clientHeight}else this._viewportMode=2,this._viewportWidth=i.size[0],this._viewportHeight=i.size[1],s=this._viewportWidth+"px",o=this._viewportHeight+"px";this._scene.postprocessing?.enabled?(this._renderer=new zu({canvas:this.canvas,antialias:!1,alpha:!0,stencil:!1,depth:!1,powerPreference:"high-performance"}),this._scene.postprocessing.init({renderer:this._renderer,camera:this._camera,scene:this._scene}),this._scene.postprocessing.addEventListener("smaaloaded",this.requestRender)):this._renderer=new zu({canvas:this.canvas,antialias:!0,alpha:!0,stencil:!0,depth:!0,powerPreference:"high-performance"}),s&&(this.canvas.style.width=s),o&&(this.canvas.style.height=o),this._scene.needsTransmission(void 0)&&(this._transmissionRenderTarget=new ut(2048,2048,{generateMipmaps:!0,minFilter:Ss,magFilter:et,wrapS:mr,wrapT:mr}),this._transmissionRenderTarget.depthTexture=new li(2048,2048),this._scene.needsTransmission(this._transmissionRenderTarget)),this._renderer.setPixelRatio(window.devicePixelRatio),this._renderer.setSize(this._viewportWidth,this._viewportHeight,!1),this._scene.postprocessing&&this._scene.postprocessing.resize(this._viewportWidth,this._viewportHeight,!1),this._renderer.shadowMap.enabled=!0,this._renderer.shadowMap.type=t.scene.environment.ambientLight.softShadows?Ou:zm,d1(t.scene.environment.ambientLight.softShadowQuality),this._renderer.setClearColor(this._scene.bgColor,this._scene.alpha),this._frameView=new Zd(this._renderer,this._camera,new O(this._viewportWidth,this._viewportHeight),new O(window.innerWidth,window.innerHeight)),this._publishData=t.scene.publish;let{enableRotate:a,enablePan:l,enableZoom:c,autoRotate:h,hoverRotatePanMode:u}=this._publishData.orbitControls;if((a||l||c||h||u!==0)&&(this._camera.interaction===void 0||this._camera.interaction.states.length<=1)&&(this._controls=new Jf(this._camera,this._renderer.domElement),this._controls.fromJSON(this._publishData.orbitControls),this._controls.useKeyEvents=!1,this._controls.addEventListener("change",this.requestRender),this._controls.addEventListener("start",this.requestRender)),this._playmode=new Kd(this._renderer,this._scene,this._camera,this),this.resize(),this.render(),this.canvas.parentElement){let f=!0;this._resizeObserver=new ResizeObserver(()=>{if(f){f=!1;return}this._viewportWidth=this.canvas.clientWidth,this._viewportHeight=this.canvas.clientHeight,this.resize()}),this._resizeObserver.observe(this.canvas.parentElement)}}findObjectById(e){let t=this._scene?.getObjectByProperty("uuid",e);return this._createProxyObject(t)}findObjectByName(e){let t=this._scene?.getObjectByName(e);return this._createProxyObject(t)}getSplineEvents(){return this._playmode?.splineEvents}emitEvent(e,t){this.findObjectById(t)?.emitEvent(e)}emitEventReverse(e,t){this.findObjectById(t)?.emitEventReverse(e)}addEventListener(e,t){this._renderer?.domElement.addEventListener(e,t)}removeEventListener(e,t){this._renderer?.domElement.removeEventListener(e,t)}setZoom(e){this._controls?.zoomOut(e)}setSize(e,t){this._viewportWidth=e,this._viewportHeight=t,this._viewportMode=2,this.resize()}dispose(){this.disposed=!0,this._playmode?.deactivate(),this._scene?.dispose(),this._rafId&&cancelAnimationFrame(this._rafId),this._proxyObjectCache.forEach(e=>{$m.unsubscribe(e)}),this._renderer?.dispose(),this._transmissionRenderTarget?.dispose(),this._transmissionRenderTarget?.depthTexture?.dispose(),this._sharedAssetsManager?.dispose(),this._resizeObserver&&this._resizeObserver.disconnect(),this.canvas.style.width="",this.canvas.style.height=""}_createProxyObject(e){if(e==null)return;if(this._proxyObjectCache.has(e.uuid))return this._proxyObjectCache.get(e.uuid);let t={name:e.name,uuid:e.uuid,visible:e.visible,intensity:e.intensity,position:e.position,rotation:e.rotation,scale:e.scale,emitEvent(i){e.interaction?.emitEvent(i)},emitEventReverse(i){e.interaction?.emitEventReverse(i)}},r=$m(t,(i,s)=>{typeof e[i]!="object"&&Object.getOwnPropertyDescriptor(e,i)?.writable&&(e[i]=s),this.requestRender(),e.updateMatrix()});return this._proxyObjectCache.set(e.uuid,r),r}};
|
|
4770
|
+
`);this.workerSourceURL=URL.createObjectURL(new Blob([o]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){let i=new Worker(this.workerSourceURL);i._callbacks={},i._taskCosts={},i._taskLoad=0,i.postMessage({type:"init",decoderConfig:this.decoderConfig}),i.onmessage=function(s){let o=s.data;switch(o.type){case"decode":i._callbacks[o.id].resolve(o);break;case"error":i._callbacks[o.id].reject(o);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+o.type+'"')}},this.workerPool.push(i)}else this.workerPool.sort(function(i,s){return i._taskLoad>s._taskLoad?-1:1});let r=this.workerPool[this.workerPool.length-1];return r._taskCosts[e]=t,r._taskLoad+=t,r})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this}};function JF(){let n,e;onmessage=function(o){let a=o.data;switch(a.type){case"init":n=a.decoderConfig,e=new Promise(function(h){n.onModuleLoaded=function(u){h({draco:u})},DracoDecoderModule(n)});break;case"decode":let l=a.buffer,c=a.taskConfig;e.then(h=>{let u=h.draco,f=new u.Decoder,d=new u.DecoderBuffer;d.Init(new Int8Array(l),l.byteLength);try{let m=t(u,f,d,c),p=m.attributes.map(g=>g.array.buffer);m.index&&p.push(m.index.array.buffer),self.postMessage({type:"decode",id:a.id,geometry:m},p)}catch(m){console.error(m),self.postMessage({type:"error",id:a.id,error:m.message})}finally{u.destroy(d),u.destroy(f)}});break}};function t(o,a,l,c){let h=c.attributeIDs,u=c.attributeTypes,f,d,m=a.GetEncodedGeometryType(l);if(m===o.TRIANGULAR_MESH)f=new o.Mesh,d=a.DecodeBufferToMesh(l,f);else if(m===o.POINT_CLOUD)f=new o.PointCloud,d=a.DecodeBufferToPointCloud(l,f);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!d.ok()||f.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+d.error_msg());let p={index:null,attributes:[]};for(let g in h){let x=self[u[g]],v,w;if(c.useUniqueIDs)w=h[g],v=a.GetAttributeByUniqueId(f,w);else{if(w=a.GetAttributeId(f,o[h[g]]),w===-1)continue;v=a.GetAttribute(f,w)}p.attributes.push(i(o,a,f,g,x,v))}return m===o.TRIANGULAR_MESH&&(p.index=r(o,a,f)),o.destroy(f),p}function r(o,a,l){let h=l.num_faces()*3,u=h*4,f=o._malloc(u);a.GetTrianglesUInt32Array(l,u,f);let d=new Uint32Array(o.HEAPF32.buffer,f,h).slice();return o._free(f),{array:d,itemSize:1}}function i(o,a,l,c,h,u){let f=u.num_components(),m=l.num_points()*f,p=m*h.BYTES_PER_ELEMENT,g=s(o,h),x=o._malloc(p);a.GetAttributeDataArrayForAllPoints(l,u,g,p,x);let v=new h(o.HEAPF32.buffer,x,m).slice();return o._free(x),{name:c,array:v,itemSize:f}}function s(o,a){switch(a){case Float32Array:return o.DT_FLOAT32;case Int8Array:return o.DT_INT8;case Int16Array:return o.DT_INT16;case Int32Array:return o.DT_INT32;case Uint8Array:return o.DT_UINT8;case Uint16Array:return o.DT_UINT16;case Uint32Array:return o.DT_UINT32}}}var Xs;function QF(){return Xs||(Xs=new Gd,Xs.setDecoderPath("https://www.gstatic.com/draco/versioned/decoders/1.5.2/").preload()),Xs.decoderPending}async function KF(n){if(Xs){let e={attributeIDs:Xs.defaultAttributeIDs,attributeTypes:Xs.defaultAttributeTypes,useUniqueIDs:!1},t;try{t=await Xs.decodeGeometry(new Int8Array(n).buffer,e)}catch(r){console.error(r)}if(t)return{index:t.index?{array:t.index.array}:void 0,attributes:Object.entries(t.attributes).map(([r,i])=>({name:r,itemSize:i.itemSize,array:i.array}))}}return null}async function xA(n){let[e,t]=cg(kf.deserialize(new Uint8Array(n))),r=[];e.scene.objects.traverse((i,s)=>{s.type==="Mesh"&&s.geometry.type==="NonParametricGeometry"&&s.geometry.data.draco!==void 0&&r.push(s)}),r.length&&await QF();for(let i of r){let s=await KF(ug(i.geometry.data.draco));if(s){s.index&&(i.geometry.data.index={array:s.index.array,itemSize:1,normalized:!1,type:"Uint32Array"});let o={};s.attributes.forEach(({name:a,array:l,itemSize:c})=>{o[a]={array:l,itemSize:c,type:"Float32Array",normalized:!1}}),i.geometry.data.attributes=o,i.geometry.data.draco=void 0}}return t.result().data}var _A={update:null,begin:null,loopBegin:null,changeBegin:null,change:null,changeComplete:null,loopComplete:null,complete:null,loop:1,direction:"normal",autoplay:!0,timelineOffset:0,rewind:!0},jy={duration:1e3,delay:0,endDelay:0,easing:"easeOutElastic(1, .5)",round:0},ZF=["translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY","perspective","matrix","matrix3d"],Vd={CSS:{},springs:{}};function Ei(n,e,t){return Math.min(Math.max(n,e),t)}function Eh(n,e){return n.indexOf(e)>-1}function Vy(n,e){return n.apply(null,e)}var Ve={arr:function(n){return Array.isArray(n)},obj:function(n){return Eh(Object.prototype.toString.call(n),"Object")},pth:function(n){return Ve.obj(n)&&n.hasOwnProperty("totalLength")},svg:function(n){return n instanceof SVGElement},inp:function(n){return n instanceof HTMLInputElement},dom:function(n){return!("isNode"in n)&&(n.nodeType||Ve.svg(n))},str:function(n){return typeof n=="string"},fnc:function(n){return typeof n=="function"},und:function(n){return typeof n>"u"},hex:function(n){return/(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(n)},rgb:function(n){return/^rgb/.test(n)},hsl:function(n){return/^hsl/.test(n)},col:function(n){return Ve.hex(n)||Ve.rgb(n)||Ve.hsl(n)},key:function(n){return!_A.hasOwnProperty(n)&&!jy.hasOwnProperty(n)&&n!=="targets"&&n!=="keyframes"}};function TA(n){var e=/\(([^)]+)\)/.exec(n);return e?e[1].split(",").map(function(t){return parseFloat(t)}):[]}function EA(n,e){var t=TA(n),r=Ei(Ve.und(t[0])?1:t[0],.1,100),i=Ei(Ve.und(t[1])?100:t[1],.1,100),s=Ei(Ve.und(t[2])?10:t[2],.1,100),o=Ei(Ve.und(t[3])?0:t[3],.1,100),a=Math.sqrt(i/r),l=s/(2*Math.sqrt(i*r)),c=l<1?a*Math.sqrt(1-l*l):0,h=1,u=l<1?(l*a+-o)/c:-o+a;function f(m){var p=e?e*m/1e3:m;return l<1?p=Math.exp(-p*l*a)*(h*Math.cos(c*p)+u*Math.sin(c*p)):p=(h+u*p)*Math.exp(-p*a),m===0||m===1?m:1-p}function d(){var m=Vd.springs[n];if(m)return m;for(var p=1/6,g=0,x=0;;)if(g+=p,f(g)===1){if(x++,x>=16)break}else x=0;var v=g*p*1e3;return Vd.springs[n]=v,v}return e?f:d}function $F(n){return n===void 0&&(n=10),function(e){return Math.ceil(Ei(e,1e-6,1)*n)*(1/n)}}var ez=function(){var n=11,e=1/(n-1);function t(h,u){return 1-3*u+3*h}function r(h,u){return 3*u-6*h}function i(h){return 3*h}function s(h,u,f){return((t(u,f)*h+r(u,f))*h+i(u))*h}function o(h,u,f){return 3*t(u,f)*h*h+2*r(u,f)*h+i(u)}function a(h,u,f,d,m){var p,g,x=0;do g=u+(f-u)/2,p=s(g,d,m)-h,p>0?f=g:u=g;while(Math.abs(p)>1e-7&&++x<10);return g}function l(h,u,f,d){for(var m=0;m<4;++m){var p=o(u,f,d);if(p===0)return u;var g=s(u,f,d)-h;u-=g/p}return u}function c(h,u,f,d){if(!(0<=h&&h<=1&&0<=f&&f<=1))return;var m=new Float32Array(n);if(h!==u||f!==d)for(var p=0;p<n;++p)m[p]=s(p*e,h,f);function g(x){for(var v=0,w=1,b=n-1;w!==b&&m[w]<=x;++w)v+=e;--w;var S=(x-m[w])/(m[w+1]-m[w]),M=v+S*e,_=o(M,h,f);return _>=.001?l(x,M,h,f):_===0?M:a(x,v,v+e,h,f)}return function(x){return h===u&&f===d||x===0||x===1?x:s(g(x),u,d)}}return c}(),CA=function(){var n={linear:function(){return function(r){return r}}},e={Sine:function(){return function(r){return 1-Math.cos(r*Math.PI/2)}},Circ:function(){return function(r){return 1-Math.sqrt(1-r*r)}},Back:function(){return function(r){return r*r*(3*r-2)}},Bounce:function(){return function(r){for(var i,s=4;r<((i=Math.pow(2,--s))-1)/11;);return 1/Math.pow(4,3-s)-7.5625*Math.pow((i*3-2)/22-r,2)}},Elastic:function(r,i){r===void 0&&(r=1),i===void 0&&(i=.5);var s=Ei(r,1,10),o=Ei(i,.1,2);return function(a){return a===0||a===1?a:-s*Math.pow(2,10*(a-1))*Math.sin((a-1-o/(Math.PI*2)*Math.asin(1/s))*(Math.PI*2)/o)}}},t=["Quad","Cubic","Quart","Quint","Expo"];return t.forEach(function(r,i){e[r]=function(){return function(s){return Math.pow(s,i+2)}}}),Object.keys(e).forEach(function(r){var i=e[r];n["easeIn"+r]=i,n["easeOut"+r]=function(s,o){return function(a){return 1-i(s,o)(1-a)}},n["easeInOut"+r]=function(s,o){return function(a){return a<.5?i(s,o)(a*2)/2:1-i(s,o)(a*-2+2)/2}}}),n}();function qy(n,e){if(Ve.fnc(n))return n;var t=n.split("(")[0],r=CA[t],i=TA(n);switch(t){case"spring":return EA(n,e);case"cubicBezier":return Vy(ez,i);case"steps":return Vy($F,i);default:return Vy(r,i)}}function DA(n){try{var e=document.querySelectorAll(n);return e}catch{return}}function Hd(n,e){for(var t=n.length,r=arguments.length>=2?arguments[1]:void 0,i=[],s=0;s<t;s++)if(s in n){var o=n[s];e.call(r,o,s,n)&&i.push(o)}return i}function Wd(n){return n.reduce(function(e,t){return e.concat(Ve.arr(t)?Wd(t):t)},[])}function bA(n){return Ve.arr(n)?n:(Ve.str(n)&&(n=DA(n)||n),n instanceof NodeList||n instanceof HTMLCollection?[].slice.call(n):[n])}function Yy(n,e){return n.some(function(t){return t===e})}function Xy(n){var e={};for(var t in n)e[t]=n[t];return e}function Hy(n,e){var t=Xy(n);for(var r in n)t[r]=e.hasOwnProperty(r)?e[r]:n[r];return t}function jd(n,e){var t=Xy(n);for(var r in e)t[r]=Ve.und(n[r])?e[r]:n[r];return t}function tz(n){var e=/rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g.exec(n);return e?"rgba("+e[1]+",1)":n}function rz(n){var e=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,t=n.replace(e,function(a,l,c,h){return l+l+c+c+h+h}),r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t),i=parseInt(r[1],16),s=parseInt(r[2],16),o=parseInt(r[3],16);return"rgba("+i+","+s+","+o+",1)"}function nz(n){var e=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(n)||/hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(n),t=parseInt(e[1],10)/360,r=parseInt(e[2],10)/100,i=parseInt(e[3],10)/100,s=e[4]||1;function o(f,d,m){return m<0&&(m+=1),m>1&&(m-=1),m<1/6?f+(d-f)*6*m:m<1/2?d:m<2/3?f+(d-f)*(2/3-m)*6:f}var a,l,c;if(r==0)a=l=c=i;else{var h=i<.5?i*(1+r):i+r-i*r,u=2*i-h;a=o(u,h,t+1/3),l=o(u,h,t),c=o(u,h,t-1/3)}return"rgba("+a*255+","+l*255+","+c*255+","+s+")"}function iz(n){if(Ve.rgb(n))return tz(n);if(Ve.hex(n))return rz(n);if(Ve.hsl(n))return nz(n)}function Ki(n){var e=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn)?$/.exec(n);if(e)return e[1]}function sz(n){if(Eh(n,"translate")||n==="perspective")return"px";if(Eh(n,"rotate")||Eh(n,"skew"))return"deg"}function Wy(n,e){return Ve.fnc(n)?n(e.target,e.id,e.total):n}function Ci(n,e){return n.getAttribute(e)}function Jy(n,e,t){var r=Ki(e);if(Yy([t,"deg","rad","turn"],r))return e;var i=Vd.CSS[e+t];if(!Ve.und(i))return i;var s=100,o=document.createElement(n.tagName),a=n.parentNode&&n.parentNode!==document?n.parentNode:document.body;a.appendChild(o),o.style.position="absolute",o.style.width=s+t;var l=s/o.offsetWidth;a.removeChild(o);var c=l*parseFloat(e);return Vd.CSS[e+t]=c,c}function PA(n,e,t){if(e in n.style){var r=e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),i=n.style[e]||getComputedStyle(n).getPropertyValue(r)||"0";return t?Jy(n,i,t):i}}function Qy(n,e){if(Ve.dom(n)&&!Ve.inp(n)&&(Ci(n,e)||Ve.svg(n)&&n[e]))return"attribute";if(Ve.dom(n)&&Yy(ZF,e))return"transform";if(Ve.dom(n)&&e!=="transform"&&PA(n,e))return"css";if(n[e]!=null)return"object"}function LA(n){if(!!Ve.dom(n)){for(var e=n.style.transform||"",t=/(\w+)\(([^)]*)\)/g,r=new Map,i;i=t.exec(e);)r.set(i[1],i[2]);return r}}function oz(n,e,t,r){var i=Eh(e,"scale")?1:0+sz(e),s=LA(n).get(e)||i;return t&&(t.transforms.list.set(e,s),t.transforms.last=e),r?Jy(n,s,r):s}function Ky(n,e,t,r){switch(Qy(n,e)){case"transform":return oz(n,e,r,t);case"css":return PA(n,e,t);case"attribute":return Ci(n,e);default:return n[e]||0}}function Zy(n,e){var t=/^(\*=|\+=|-=)/.exec(n);if(!t)return n;var r=Ki(n)||0,i=parseFloat(e),s=parseFloat(n.replace(t[0],""));switch(t[0][0]){case"+":return i+s+r;case"-":return i-s+r;case"*":return i*s+r}}function IA(n,e){if(Ve.col(n))return iz(n);if(/\s/g.test(n))return n;var t=Ki(n),r=t?n.substr(0,n.length-t.length):n;return e?r+e:r}function $y(n,e){return Math.sqrt(Math.pow(e.x-n.x,2)+Math.pow(e.y-n.y,2))}function az(n){return Math.PI*2*Ci(n,"r")}function lz(n){return Ci(n,"width")*2+Ci(n,"height")*2}function cz(n){return $y({x:Ci(n,"x1"),y:Ci(n,"y1")},{x:Ci(n,"x2"),y:Ci(n,"y2")})}function NA(n){for(var e=n.points,t=0,r,i=0;i<e.numberOfItems;i++){var s=e.getItem(i);i>0&&(t+=$y(r,s)),r=s}return t}function hz(n){var e=n.points;return NA(n)+$y(e.getItem(e.numberOfItems-1),e.getItem(0))}function BA(n){if(n.getTotalLength)return n.getTotalLength();switch(n.tagName.toLowerCase()){case"circle":return az(n);case"rect":return lz(n);case"line":return cz(n);case"polyline":return NA(n);case"polygon":return hz(n)}}function uz(n){var e=BA(n);return n.setAttribute("stroke-dasharray",e),e}function fz(n){for(var e=n.parentNode;Ve.svg(e)&&Ve.svg(e.parentNode);)e=e.parentNode;return e}function OA(n,e){var t=e||{},r=t.el||fz(n),i=r.getBoundingClientRect(),s=Ci(r,"viewBox"),o=i.width,a=i.height,l=t.viewBox||(s?s.split(" "):[0,0,o,a]);return{el:r,viewBox:l,x:l[0]/1,y:l[1]/1,w:o/l[2],h:a/l[3]}}function dz(n,e){var t=Ve.str(n)?DA(n)[0]:n,r=e||100;return function(i){return{property:i,el:t,svg:OA(t),totalLength:BA(t)*(r/100)}}}function pz(n,e){function t(a){a===void 0&&(a=0);var l=e+a>=1?e+a:0;return n.el.getPointAtLength(l)}var r=OA(n.el,n.svg),i=t(),s=t(-1),o=t(1);switch(n.property){case"x":return(i.x-r.x)*r.w;case"y":return(i.y-r.y)*r.h;case"angle":return Math.atan2(o.y-s.y,o.x-s.x)*180/Math.PI}}function wA(n,e){var t=/[+-]?\d*\.?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?/g,r=IA(Ve.pth(n)?n.totalLength:n,e)+"";return{original:r,numbers:r.match(t)?r.match(t).map(Number):[0],strings:Ve.str(n)||e?r.split(t):[]}}function RA(n){var e=n?Wd(Ve.arr(n)?n.map(bA):bA(n)):[];return Hd(e,function(t,r,i){return i.indexOf(t)===r})}function FA(n){var e=RA(n);return e.map(function(t,r){return{target:t,id:r,total:e.length,transforms:{list:LA(t)}}})}function mz(n,e){var t=Xy(e);if(/^spring/.test(t.easing)&&(t.duration=EA(t.easing)),Ve.arr(n)){var r=n.length,i=r===2&&!Ve.obj(n[0]);i?n={value:n}:Ve.fnc(e.duration)||(t.duration=e.duration/r)}var s=Ve.arr(n)?n:[n];return s.map(function(o,a){var l=Ve.obj(o)&&!Ve.pth(o)?o:{value:o};return Ve.und(l.delay)&&(l.delay=a?0:e.delay),Ve.und(l.endDelay)&&(l.endDelay=a===s.length-1?e.endDelay:0),l}).map(function(o){return jd(o,t)})}function gz(n){for(var e=Hd(Wd(n.map(function(s){return Object.keys(s)})),function(s){return Ve.key(s)}).reduce(function(s,o){return s.indexOf(o)<0&&s.push(o),s},[]),t={},r=function(s){var o=e[s];t[o]=n.map(function(a){var l={};for(var c in a)Ve.key(c)?c==o&&(l.value=a[c]):l[c]=a[c];return l})},i=0;i<e.length;i++)r(i);return t}function yz(n,e){var t=[],r=e.keyframes;r&&(e=jd(gz(r),e));for(var i in e)Ve.key(i)&&t.push({name:i,tweens:mz(e[i],n)});return t}function vz(n,e){var t={};for(var r in n){var i=Wy(n[r],e);Ve.arr(i)&&(i=i.map(function(s){return Wy(s,e)}),i.length===1&&(i=i[0])),t[r]=i}return t.duration=parseFloat(t.duration),t.delay=parseFloat(t.delay),t}function xz(n,e){var t;return n.tweens.map(function(r){var i=vz(r,e),s=i.value,o=Ve.arr(s)?s[1]:s,a=Ki(o),l=Ky(e.target,n.name,a,e),c=t?t.to.original:l,h=Ve.arr(s)?s[0]:c,u=Ki(h)||Ki(l),f=a||u;return Ve.und(o)&&(o=c),i.from=wA(h,f),i.to=wA(Zy(o,h),f),i.start=t?t.end:0,i.end=i.start+i.delay+i.duration+i.endDelay,i.easing=qy(i.easing,i.duration),i.isPath=Ve.pth(s),i.isColor=Ve.col(i.from.original),i.isColor&&(i.round=1),t=i,i})}var zA={css:function(n,e,t){return n.style[e]=t},attribute:function(n,e,t){return n.setAttribute(e,t)},object:function(n,e,t){return n[e]=t},transform:function(n,e,t,r,i){if(r.list.set(e,t),e===r.last||i){var s="";r.list.forEach(function(o,a){s+=a+"("+o+") "}),n.style.transform=s}}};function UA(n,e){var t=FA(n);t.forEach(function(r){for(var i in e){var s=Wy(e[i],r),o=r.target,a=Ki(s),l=Ky(o,i,a,r),c=a||Ki(l),h=Zy(IA(s,c),l),u=Qy(o,i);zA[u](o,i,h,r.transforms,!0)}})}function bz(n,e){var t=Qy(n.target,e.name);if(t){var r=xz(e,n),i=r[r.length-1];return{type:t,property:e.name,animatable:n,tweens:r,duration:i.end,delay:r[0].delay,endDelay:i.endDelay}}}function wz(n,e){return Hd(Wd(n.map(function(t){return e.map(function(r){return bz(t,r)})})),function(t){return!Ve.und(t)})}function GA(n,e){var t=n.length,r=function(s){return s.timelineOffset?s.timelineOffset:0},i={};return i.duration=t?Math.max.apply(Math,n.map(function(s){return r(s)+s.duration})):e.duration,i.delay=t?Math.min.apply(Math,n.map(function(s){return r(s)+s.delay})):e.delay,i.endDelay=t?i.duration-Math.max.apply(Math,n.map(function(s){return r(s)+s.duration-s.endDelay})):e.endDelay,i}var SA=0;function Sz(n){var e=Hy(_A,n),t=Hy(jy,n),r=yz(t,n),i=FA(n.targets),s=wz(i,r),o=GA(s,t),a=SA;return SA++,jd(e,{id:a,children:[],animatables:i,animations:s,duration:o.duration,delay:o.delay,endDelay:o.endDelay})}var on=[],AA=[],kd,Az=function(){function n(){kd=requestAnimationFrame(e)}function e(t){var r=on.length;if(r){for(var i=0;i<r;){var s=on[i];if(!s.paused)s.tick(t);else{var o=on.indexOf(s);o>-1&&(on.splice(o,1),r=on.length)}i++}n()}else kd=cancelAnimationFrame(kd)}return n}();function Mz(){document.hidden?(on.forEach(function(n){return n.pause()}),AA=on.slice(0),or.running=on=[]):AA.forEach(function(n){return n.play()})}typeof document<"u"&&document.addEventListener("visibilitychange",Mz);function or(n){n===void 0&&(n={});var e=0,t=0,r=0,i,s=0,o=null;function a(w){var b=window.Promise&&new Promise(function(S){return o=S});return w.finished=b,b}var l=Sz(n),c=a(l);function h(){var w=l.direction;w!=="alternate"&&(l.direction=w!=="normal"?"normal":"reverse"),l.reversed=!l.reversed,i.forEach(function(b){return b.reversed=l.reversed})}function u(w){return l.reversed?l.duration-w:w}function f(){e=0,t=u(l.currentTime)*(1/or.speed)}function d(w,b){b&&b.seek(w-b.timelineOffset)}function m(w){if(l.reversePlayback)for(var S=s;S--;)d(w,i[S]);else for(var b=0;b<s;b++)d(w,i[b])}function p(w){var b=0,S=l.animations,M=S.length;for(l.reversePlayback===!0&&l.rewind===!1&&(w=l.duration+l.delay-l.endDelay-w);b<M;){var _=S[b],y=_.animatable,T=_.tweens,E=T.length-1,C=T[E];E&&(C=Hd(T,function(K){return w<K.end})[0]||C);for(var I=Ei(w-C.start-C.delay,0,C.duration)/C.duration,B=isNaN(I)?1:C.easing(I),N=C.to.strings,H=C.round,j=[],Q=C.to.numbers.length,X=void 0,U=0;U<Q;U++){var F=void 0;if(l.reversePlayback===!0&&l.rewind===!1)var V=C.to.numbers[U],R=C.from.numbers[U]||0;else var R=C.to.numbers[U],V=C.from.numbers[U]||0;C.isPath?F=pz(C.value,B*R):F=V+B*(R-V),H&&(C.isColor&&U>2||(F=Math.round(F*H)/H)),j.push(F)}var G=N.length;if(!G)X=j[0];else{X=N[0];for(var W=0;W<G;W++){var Y=N[W],q=N[W+1],se=j[W];isNaN(se)||(q?X+=se+q:X+=se+" ")}}zA[_.type](y.target,_.property,X,y.transforms),_.currentValue=X,b++}}function g(w){l[w]&&!l.passThrough&&l[w](l)}function x(){l.remaining&&l.remaining!==!0&&l.remaining--}function v(w){var b=l.duration,S=l.delay,M=b-l.endDelay,_=u(w);l.progress=Ei(_/b*100,0,100),l.reversePlayback=_<l.currentTime,i&&m(_),!l.began&&l.currentTime>=0&&(l.began=!0,g("begin")),!l.loopBegan&&l.currentTime>0&&(l.loopBegan=!0,g("loopBegin")),_<=S&&l.currentTime!==0&&(p(0),g("change")),(_>=M&&l.currentTime!==b||!b)&&(p(b),g("change")),_>S&&_<M?(l.changeBegan||(l.changeBegan=!0,l.changeCompleted=!1,g("changeBegin")),g("change"),p(_)):l.changeBegan?(l.changeCompleted=!0,l.changeBegan=!1,g("change"),g("changeComplete")):l.began&&_>M&&(g("change"),g("changeComplete")),l.currentTime=Ei(_,0,b),l.began&&g("update"),w>=b&&(t=0,x(),l.remaining?(e=r,g("loopComplete"),l.loopBegan=!1,l.direction==="alternate"&&h()):(l.paused=!0,l.completed||(l.completed=!0,g("loopComplete"),g("complete"),!l.passThrough&&"Promise"in window&&(o(),c=a(l)))))}return l.reset=function(){var w=l.direction;l.passThrough=!1,l.currentTime=0,l.progress=0,l.paused=!0,l.began=!1,l.loopBegan=!1,l.changeBegan=!1,l.completed=!1,l.changeCompleted=!1,l.reversePlayback=!1,l.reversed=w==="reverse",l.remaining=l.loop,i=l.children,s=i.length;for(var b=s;b--;)l.children[b].reset();(l.reversed&&l.loop!==!0||w==="alternate"&&l.loop===1)&&l.remaining++,p(l.reversed?l.duration:0)},l.set=function(w,b){return UA(w,b),l},l.tick=function(w){r=w,e||(e=r),v((r+(t-e))*or.speed)},l.seek=function(w){v(u(w))},l.pause=function(){l.paused=!0,f()},l.play=function(){!l.paused||(l.completed&&l.reset(),l.paused=!1,on.push(l),f(),kd||Az())},l.reverse=function(){h(),l.completed=!l.reversed,f()},l.restart=function(){l.reset(),l.play()},l.reset(),l.autoplay&&l.play(),l}function MA(n,e){for(var t=e.length;t--;)Yy(n,e[t].animatable.target)&&e.splice(t,1)}function _z(n){for(var e=RA(n),t=on.length;t--;){var r=on[t],i=r.animations,s=r.children;MA(e,i);for(var o=s.length;o--;){var a=s[o],l=a.animations;MA(e,l),!l.length&&!a.children.length&&s.splice(o,1)}!i.length&&!s.length&&r.pause()}}function Tz(n,e){e===void 0&&(e={});var t=e.direction||"normal",r=e.easing?qy(e.easing):null,i=e.grid,s=e.axis,o=e.from||0,a=o==="first",l=o==="center",c=o==="last",h=Ve.arr(n),u=parseFloat(h?n[0]:n),f=h?parseFloat(n[1]):0,d=Ki(h?n[1]:n)||0,m=e.start||0+(h?u:0),p=[],g=0;return function(x,v,w){if(a&&(o=0),l&&(o=(w-1)/2),c&&(o=w-1),!p.length){for(var b=0;b<w;b++){if(!i)p.push(Math.abs(o-b));else{var S=l?(i[0]-1)/2:o%i[0],M=l?(i[1]-1)/2:Math.floor(o/i[0]),_=b%i[0],y=Math.floor(b/i[0]),T=S-_,E=M-y,C=Math.sqrt(T*T+E*E);s==="x"&&(C=-T),s==="y"&&(C=-E),p.push(C)}g=Math.max.apply(Math,p)}r&&(p=p.map(function(B){return r(B/g)*g})),t==="reverse"&&(p=p.map(function(B){return s?B<0?B*-1:-B:Math.abs(g-B)}))}var I=h?(f-u)/g:u;return m+I*(Math.round(p[v]*100)/100)+d}}function Ez(n){n===void 0&&(n={});var e=or(n);return e.duration=0,e.add=function(t,r){var i=on.indexOf(e),s=e.children;i>-1&&on.splice(i,1);function o(f){f.passThrough=!0}for(var a=0;a<s.length;a++)o(s[a]);var l=jd(t,Hy(jy,n));l.targets=l.targets||n.targets;var c=e.duration;l.autoplay=!1,l.direction=e.direction,l.timelineOffset=Ve.und(r)?c:Zy(r,c),o(e),l.rewind=e.rewind,e.seek(l.timelineOffset);var h=or(l);o(h),s.push(h);var u=GA(s,n);return e.delay=u.delay,e.endDelay=u.endDelay,e.duration=u.duration,e.seek(0),e.reset(),e.autoplay&&e.play(),e},e}or.version="3.2.0";or.speed=1;or.running=on;or.remove=_z;or.get=Ky;or.set=UA;or.convertPx=Jy;or.path=dz;or.setDashoffset=uz;or.stagger=Tz;or.timeline=Ez;or.easing=qy;or.penner=CA;or.random=function(n,e){return Math.floor(Math.random()*(e-n+1))+n};var kA=or;function VA(n,e,t){let r=n.cameraType==="OrthographicCamera"?e.orthographic?.zoom:e.perspective?.zoom;if(r!==void 0){let i=n.zoom;i!==r&&t.push({change:s=>{n.zoom=je.lerp(i,r,s),n.updateProjectionMatrix()}})}if(e.targetOffset!==void 0){let i=n.targetOffset,s=e.targetOffset;i!==s&&t.push({change:o=>{n.targetOffset=je.lerp(i,s,o)}})}}function HA(n,e,t){if(e.width!==void 0&&e.height!==void 0&&e.depth!==void 0){let{width:r,height:i,depth:s}=n.geometry.userData.parameters,o=[r,i,s],a=[e.width,e.height,e.depth];!sr.isEqual(o,a)&&!xt(n)&&t.push({change:l=>{let[c,h,u]=sr.lerp(o,a,l);n.updateGeometry({parameters:{width:c,height:h,depth:u}}),n.invalidateDownstreamBooleanData()}})}}function WA(n,e,t,r){if(e.intensity!==void 0){let i=n.intensity,s=e.intensity;i!==s&&t.push({change:o=>{n.intensity=je.lerp(i,s,o)}})}if(e.color!==void 0){let i=n.color.clone(),s=typeof e.color=="string"?r.getColor(e.color):e.color;if(!hr.equals(i,s)){let o=i.clone();n.color=o,t.push({change:a=>{let{r:l,g:c,b:h}=hr.lerp(i,s,a);o.setRGB(l,c,h)}})}}}function jA(n,e,t,r){let i=n.layersList.head;for(;i;){let s=e.layers.data(i.uuid);if(s&&(i.visible??!0)&&(s.visible??!0)){let o=i.getNames().filter(a=>!tS.some(l=>a.includes(l)));for(let a of o)try{let l=i.getValue(a);if(a==="steps")Nz(i,s,a,t);else if(a==="colors")Bz(i,s,a,t);else if(typeof l=="number")Cz(i,s,a,t);else{if(typeof l=="boolean")continue;"isVector2"in l?Dz(i,s,a,t):"isVector3"in l?Pz(i,s,a,t):"isColorA"in l?Iz(i,s,a,t,r):"isColor"in l?Lz(i,s,a,t,r):"isTexture"in l&&Oz(i,s,a,t)}}catch(l){console.error(`animateMaterial: unexpected material layer for ${a}`,l)}}i=i.next}}function Cz(n,e,t,r){if(!n.hasValue(t)||!(t in e))return;let i=n.getValue(t),s=e[t];i!==s&&r.push({change:o=>{n.setValue(t,je.lerp(i,s,o))}})}function Dz(n,e,t,r){if(!n.hasValue(t)||!(t in e))return;let i=n.getValue(t),s=i.toArray(),o=e[t];Hi.isEqual(s,o)||r.push({change:a=>{i.fromArray(Hi.lerp(s,o,a))}})}function Pz(n,e,t,r){if(!n.hasValue(t)||!(t in e))return;let i=n.getValue(t),s=i.toArray(),o=e[t];sr.isEqual(s,o)||r.push({change:a=>{i.fromArray(sr.lerp(s,o,a))}})}function Lz(n,e,t,r,i){if(!n.hasValue(t)||!(t in e))return;let s=n.getValue(t).clone(),o=e[t],a=typeof o=="string"?i.getColor(o):o;if(hr.equals(s,a))return;let l=s.clone();n.setValue(t,l),r.push({change:c=>{let{r:h,g:u,b:f}=hr.lerp(s,a,c);l.setRGB(h,u,f)}})}function Iz(n,e,t,r,i){if(!n.hasValue(t)||!(t in e))return;let s=n.getValue(t).clone(),o=e[t],a=typeof o=="string"?i.getColor(o):o;if(pn.equals(s,a))return;let l=s.clone();n.setValue(t,l),r.push({change:c=>{let{r:h,g:u,b:f,a:d}=pn.lerp(s,a,c);l.setRGBA(h,u,f,d)}})}function Nz(n,e,t="steps",r){if(!n.hasValue(t)||!(t in e))return;let i=[...n.getValue(t)],s=e[t];for(let o=0;o<i.length;++o){let a=i[o],l=s[o];a!==l&&r.push({change:c=>{i[o]=je.lerp(a,l,c),n.setValue("steps",i)}})}}function Bz(n,e,t="colors",r){if(!n.hasValue(t)||!(t in e))return;let i=n.getValue(t),s=e[t];for(let o=0;o<i.length;++o){let a=i[o].toArray(),l=s[o];Fc.isEqual(a,l)||r.push({change:c=>{i[o].fromArray(Fc.lerp(a,l,c))}})}}function Oz(n,e,t="texture",r){if(!n.hasValue(t)||!(t in e))return;let i=n.getValue("texture"),s=e[t],o=i.repeat.toArray(),a=i.offset.toArray(),l=s.repeat,c=s.offset;(!Hi.isEqual(o,l)||!Hi.isEqual(a,c))&&r.push({change:h=>{i.repeat.fromArray(Hi.lerp(o,l,h)),i.offset.fromArray(Hi.lerp(a,c,h)),i.updateMatrix(),i.needsUpdate=!0}})}function qA(n,e,t,r){if(r===0)return t.copy(n);if(r===1)return t.copy(e);let i=n.w*e.w+n.x*e.x+n.y*e.y+n.z*e.z;if(i>=1)return t.copy(n);let s=1-i*i;if(s<=Number.EPSILON){let h=1-r;return t.w=h*n.w+r*e.w,t.x=h*n.x+r*e.x,t.y=h*n.y+r*e.y,t.z=h*n.z+r*e.z,t.normalize(),t}let o=Math.sqrt(s),a=Math.atan2(o,i),l=Math.sin((1-r)*a)/o,c=Math.sin(r*a)/o;return t.w=n.w*l+e.w*c,t.x=n.x*l+e.x*c,t.y=n.y*l+e.y*c,t.z=n.z*l+e.z*c,t}function YA(n,e,t=0){let r=Array.isArray(n.material)?n.material[t]:n.material,i;return"materials"in e?i=e.materials[t]:"material"in e&&(i=e.material),[r,i]}var ev=new A,tv=new A,XA=new jt,Rz=new bn,Fz=new Be;function JA(n,e,t,r){if(t.position!==void 0){let i=n.position.toArray(),s=t.position;sr.isEqual(i,s)||r.push({change:o=>{n.position.fromArray(sr.lerp(i,s,o)),n.updateMatrix(),zt(n)&&xt(n.parent)&&n.invalidateDownstreamBooleanData(!0)}})}if(t.scale!==void 0){let i=n.scale.toArray(),s=t.scale;sr.isEqual(i,s)||r.push({change:o=>{n.scale.fromArray(sr.lerp(i,s,o)),n.updateMatrix(),zt(n)&&xt(n.parent)&&n.invalidateDownstreamBooleanData(!0)}})}zz(n,e,t,r),Uz(n,t,r)}function zz(n,e,t,r){if(t.rotation===void 0)return;let i=ev.setFromEuler(n.rotation).toArray(),s=t.rotation;if(sr.isEqual(i,s))return;if(sr.sub(t.rotation,e?e.rotation:n.rotation).every(a=>Math.abs(a)<2*Math.PI)){let a=n.quaternion.clone(),l=new jt().setFromEuler(Rz.set(t.rotation[0],t.rotation[1],t.rotation[2]));r.push({change:c=>{qA(a,l,n.quaternion,c),n.updateMatrix(),zt(n)&&xt(n.parent)&&n.invalidateDownstreamBooleanData(!0)}})}else r.push({change:a=>{n.rotation.setFromVector3(tv.fromArray(sr.lerp(i,s,a))),n.updateMatrix(),zt(n)&&xt(n.parent)&&n.invalidateDownstreamBooleanData(!0)}})}function Uz(n,e,t){if(e.hiddenMatrix!==void 0&&!hi.isEqual(n.hiddenMatrix.toArray(),e.hiddenMatrix)){let r=new A,i=new jt,s=new A;n.hiddenMatrix.decompose(r,i,s);let o=new A,a=new jt,l=new A;Fz.fromArray(e.hiddenMatrix).decompose(o,a,l),t.push({change:c=>{XA.slerpQuaternions(i,a,c),ev.lerpVectors(r,o,c),tv.lerpVectors(s,l,c),n.hiddenMatrix.compose(ev,XA,tv),zt(n)&&xt(n.parent)&&n.invalidateDownstreamBooleanData(!0)}})}}function QA(n,e,t,r){let i=[];if((n.visible||xt(n.parent))&&JA(n,e?.objectState,t.objectState,i),zt(n)){if((n.visible||xt(n.parent))&&"geometry"in t.objectState&&HA(n,t.objectState.geometry,i),n.visible&&("material"in t.objectState||"materials"in t.objectState)){let[s,o]=YA(n,t.objectState,n.selectedMaterial);s&&o&&typeof o!="string"&&jA(s,o,i,r)}}else n.visible&&m1(n)?WA(n,t.objectState,i,r):p1(n)&&VA(n,t.objectState,i);return i.length?{change:s=>{i.forEach(o=>{o.change&&o.change(s)})}}:void 0}function Gz(n,e,t){switch(n){case 0:return"cubicBezier( 0, 0, 1, 1 )";case 1:return"cubicBezier( .25, .1, .25, 1 )";case 2:return"cubicBezier( .42, 0, 1, 1 )";case 3:return"cubicBezier( 0, 0, .58, 1 )";case 4:return"cubicBezier( .42, 0, .58, 1 )";case 5:let{control1:r,control2:i}=e??{...Sf.defaultData};return`cubicBezier( ${r[0]}, ${r[1]}, ${i[0]}, ${i[1]} )`;case 6:let{mass:s,stiffness:o,damping:a,velocity:l}=t??{...wf.defaultData};return`spring( ${s}, ${o}, ${a}, ${l} )`}}var qd=class{constructor(e,t){this.object=e;this.sharedAssets=t;this.uuid=je.generateUUID();this.states=[];this.events={};this.animatingState=0;this._scrollCounter=null}get fromState(){return this._fromState}get animation(){return this._animation}start(){this._animation!==void 0&&(this._animation.pause(),this._animation=void 0,this._scrollCounter=null),this.states.length>1&&(this.states[0].execute(this.object,this.sharedAssets),this._toState=this.states[0],this._fromState=void 0)}end(){this._animation!==void 0&&(this._animation.pause(),this._animation=void 0),this.states.length>1&&this.states[0].execute(this.object,this.sharedAssets),this._toState=void 0,this._fromState=void 0}seek(e,t,r,i,s){this._scrollCounter===null&&(this.animate(e,i,s),this._scrollCounter=0),this._scrollCounter+=t,this._scrollCounter=Math.min(Math.max(this._scrollCounter,0),r),this._animation?.seek(this._scrollCounter/r*(i.duration?i.duration:1))}animate(e,t,r){if(this._fromState===e&&this._animation?.reversed){let i=this._animation?.currentTime??0;this._animation?.reset(),this._animation?.seek(i),this._animation?.play()}else if(this._toState!==e){this._animation!==void 0&&this._animation.pause(),this.animatingState=0,this._fromState=this._toState,this._toState=e;let i=QA(this.object,this._fromState,e,this.sharedAssets);if(!i)return;let s={t:0};this._animation=kA({autoplay:!1,loop:t.repeat?!0:t.cycle?1:!1,direction:t.cycle?"alternate":"normal",rewind:t.rewind,delay:t.startDelay,endDelay:t.endDelay,duration:t.duration,easing:Gz(t.easing,t.cubicControls,t.springParameters),targets:s,t:1,change:()=>{i.change&&i.change(s.t),r?.change&&r.change(s.t)},loopBegin:o=>{if(this.animatingState===0){this.animatingState=1;return}o.reversed?(this._toState=this._fromState,this._fromState=e):(this._fromState=this._toState,this._toState=e)}}),t.autoplay?t.startOnceDelay>0?setTimeout(()=>this._animation?.play(),t.startOnceDelay):this._animation?.play():this._animation.finished.then(()=>{this._animation=void 0,this.animatingState=0})}}emitEvent(e,t){if(e==="keyDown"||e==="keyUp"||e==="mouseDown"||e==="mouseUp"||e==="mouseHover"||e==="scroll"||e==="start"){let r=this.events[e];if(r){for(let i of r)if("targets"in i)for(let{object:s,state:o,params:a}of i.targets)s.interaction?.animate(o,a,{change:t})}}}emitEventReverse(e,t){if(e==="keyDown"||e==="keyUp"||e==="mouseDown"||e==="mouseUp"||e==="mouseHover"||e==="scroll"||e==="start"){let r=this.events[e];if(r){for(let i of r)if("targets"in i)for(let{object:s,params:o}of i.targets){let a=s.interaction;a?._fromState!==void 0&&a.animate(a._fromState,o,{change:t})}}}}};var Vl=class{static create(e,t){if(e.object){let r=t.find(e.object);if(r?.interaction){let i=e.state?r.interaction.states.find(s=>s.uuid===e.state):r.interaction.states[0];if(i){let s=e.delay??0,o={cycle:e.cycle??!1,rewind:e.rewind??!1,repeat:e.repeat??!1,duration:e.duration??1e3,startOnceDelay:e.delayDirection==="start-once"?s:0,startDelay:e.delayDirection==="start"||!e.delayDirection?s:0,endDelay:e.delayDirection==="end"||!e.delayDirection?s:0,easing:e.easing??4,autoplay:!0};if(e.easing===5){let a=e;o.cubicControls={control1:[...a.control1],control2:[...a.control2]}}if(e.easing===6){let a=e;o.springParameters={mass:a.mass,stiffness:a.stiffness,damping:a.damping,velocity:a.velocity}}return new Vl(r,i,o)}}}}constructor(e,t,r){this.object=e,this.state=t,this.params=r}};var rv=new Map,Ch={url:"head",time:0,data:null,next:null,prev:null},Hl={url:"tail",time:1/0,data:null,next:null,prev:null};Ch.next=Hl;Hl.prev=Ch;var KA=0;function Gs(n){if(typeof n=="string")return n;let e=Date.now(),t=rv.get(n);return t===void 0?(t={url:URL.createObjectURL(new Blob([n])),data:n,time:e,next:null,prev:null},rv.set(n,t)):(t.time=e,t.prev.next=t.next,t.next.prev=t.prev),t.prev=Hl.prev,t.next=Hl,Hl.prev.next=t,Hl.prev=t,e-KA>1e3*10&&(KA=e+1e3,setTimeout(()=>{let r=Date.now(),i=Ch.next;for(;i.time<r-1e3*10;)URL.revokeObjectURL(i.url),rv.delete(i.data),i=i.next,i.prev=Ch,Ch.next=i},900)),t.url}var ZA=new Ir,No=class extends Cr{},Yd=class{constructor(e){this.materials={};this.images={};this.colors={};this.transmissionRenderTarget=new ut(2048,2048,{generateMipmaps:!0,minFilter:Ss,magFilter:et,wrapS:mr,wrapT:mr}),this.transmissionRenderTarget.depthTexture=new li(2048,2048),this.penumbraSizeNode=new Lr(5,e.penumbraSize),this.reset(e)}reset(e){for(let[t,r]of Object.entries(e.images))this.addImage(t,r.data);for(let[t,r]of Object.entries(e.colors))this.addColor(t,r);for(let[t,r]of Object.entries(e.materials))this.addMaterial(t,fy(r,this))}get transmissionSamplerMap(){return this.transmissionRenderTarget.texture}get transmissionDepthMap(){return this.transmissionRenderTarget.depthTexture}addMaterial(e,t){t.uuid=e,this.materials[e]=t}deleteMaterial(e){this.materials[e]&&(this.materials[e].dispose(),delete this.materials[e])}isSharedMaterial(e){return e.uuid in this.materials||e===ZA}getMaterial(e){let t=this.materials[e];return t}getMaterialOrDeletedPlaceholder(e){return this.materials[e]??ZA}getMaterials(){return this.materials}addImage(e,t){if(this.images[e])return this.images[e].onload=()=>{this.onImageLoad&&this.onImageLoad()},this.images[e].src=Gs(t),!0;{let r=new Image;return r.src=Gs(t),r.onload=()=>{this.onImageLoad&&this.onImageLoad()},this.images[e]=r,!1}}deleteImage(e){this.images[e]&&delete this.images[e]}getDefaultImage(){return this.images.image_0}getImage(e){return this.images[e]}getImages(){return this.images}addColor(e,t){return this.colors[e]?("a"in t?this.colors[e].setRGBA(t.r,t.g,t.b,t.a):this.colors[e].setRGBA(t.r,t.g,t.b,1),!0):("a"in t?this.colors[e]=new No(t.r,t.g,t.b,t.a):this.colors[e]=new No(t.r,t.g,t.b,1),!1)}updateColor(e,t){if(this.colors[e]){let r=this.colors[e];return this.colors[e].r=t.r??r.r,this.colors[e].g=t.g??r.g,this.colors[e].b=t.b??r.b,this.colors[e].a=t.a??r.a,!0}return!1}deleteColor(e){this.colors[e]&&delete this.colors[e]}getColor(e){return this.colors[e]}dispose(){Object.keys(this.materials).forEach(t=>this.deleteMaterial(t)),this.transmissionRenderTarget.depthTexture.dispose(),this.transmissionRenderTarget.dispose(),this.onImageLoad=void 0}};function kz(n,e){switch(n.type){case"noise":return e==="noiseType";case"texture":return e==="projection"||e==="axis"||e==="side";case"displace":return e==="noiseType";case"depth":return e==="num"||e==="smooth"||e==="isWorldSpace"||e==="gradientType";default:return!1}}function nv(n,e,t,r,i){let s=!1;for(let[o,a]of Object.entries(n)){if(!o||a===void 0||Ad(o,t,i))continue;t.visible=i.visible;let l=t.uniforms[`f${t.id}_${o}`];if(!!l)switch(l.constructor){case _t:if(typeof a=="string"){let c=e.getColor(a);c&&(l.value=c);break}else{let c=a;l.value instanceof No?l.value=new Cr(c.r,c.g,c.b,c.a):l.setRGBA(c);break}case qn:if(typeof a=="string"){let c=e.getColor(a);c&&(l.value=c);break}else{let c=a;l.value instanceof No?l.value=new Cr(c.r,c.g,c.b,c.a):l.value.setRGBA(c.r,c.g,c.b,c.a);break}case wr:{let c=a;l.value.setX(c[0]),l.value.setY(c[1]);break}case Sr:{let c=a;l.value.setX(c[0]),l.value.setY(c[1]),l.value.setZ(c[2]);break}case Dr:{let c=a;if("image"in c){let h=c.image;if(typeof h=="string"){let u=e.getImage(h);u&&(l.value.image=u)}else{let u=new Image;u.src=Gs(h.data),l.value.image=u}}"wrapping"in c&&(l.value.wrapS=l.value.wrapT=c.wrapping),"repeat"in c&&l.value.repeat.fromArray(c.repeat),"offset"in c&&l.value.offset.fromArray(c.offset),l.value.needsUpdate=!0;break}case qi:{a.forEach((c,h)=>{l.value[h].setX(c[0]),l.value[h].setY(c[1]),l.value[h].setZ(c[2]),l.value[h].setW(c[3])});break}default:{s=s||kz(t,o),l.value=a;break}}}if(s&&i){let o=Sd({id:"0",fi:0,data:i},e);r.userData.layers?.changeLayer(t.id,{...o}),r.dispose(),r.needsUpdate=!0}}var iv=new A,$A=new Gr,eM=new Be,Dh={type:"follow",normal:new A,raycaster:new Os},Wl;(t=>{function n(r){if(r.type===10)return{type:"follow"}}t.create=n;function e({target:r,normal:i,raycaster:s,begin:o,change:a}){!r||!i||!s||(o&&o("follow",r.uuid),$A.setFromNormalAndCoplanarPoint(i,r.getWorldPosition(iv)),s.ray.intersectPlane($A,iv),r.position.copy(iv),r.parent!==null&&r.position.applyMatrix4(eM.copy(r.parent.matrixWorld).invert()),r.position.applyMatrix4(eM.copy(r.hiddenMatrix).invert()),r.updateMatrix(),zt(r)&&xt(r.parent)&&r.invalidateDownstreamBooleanData(!0),a&&a())}t.listener=e})(Wl||(Wl={}));var sv=new A,tM=new Gr,Ph={type:"lookAt",normal:new A,raycaster:new Os},jl;(t=>{function n(r){if(r.type===9&&r.distance)return{type:"lookAt",distance:r.distance}}t.create=n;function e({target:r,normal:i,raycaster:s,begin:o,change:a}){if(!r?.interaction?.events.lookAt?.length||!i||!s)return;o&&o("lookAt",r.uuid);let l=r.interaction.events.lookAt[0].distance;tM.set(i,-l),s.ray.intersectPlane(tM,sv),r.lookAt(sv),r.updateMatrix(),r.interaction.animation?.finished.then(()=>{r.lookAt(sv),r.updateMatrix(),zt(r)&&xt(r.parent)&&r.invalidateDownstreamBooleanData(!0)}),zt(r)&&xt(r.parent)&&r.invalidateDownstreamBooleanData(!0),a&&a()}t.listener=e})(jl||(jl={}));var ov={type:"start"},ql;(t=>{function n(r){if(r.type===7)return{type:"start",targets:[]}}t.create=n;function e({target:r,begin:i,change:s}){if(!r?.interaction?.events.start?.length)return;i&&i("start",r.uuid);let o={change:s};r.interaction.events.start.forEach(a=>{a.targets.forEach(({object:l,state:c,params:h})=>l.interaction?.animate(c,h,o))})}t.listener=e})(ql||(ql={}));var Xd={type:"scroll"},Yl;(t=>{function n(r){if(!(r.type!==11||r.steps===void 0))return{type:"scroll",targets:[],steps:r.steps}}t.create=n;function e({target:r,deltaY:i,begin:s,change:o}){if(!r?.interaction?.events.scroll?.length||!i)return;s&&s("scroll",r.uuid);let a={change:o},l=i>0?1:-1;r.interaction.events.scroll.forEach(c=>{c.targets.forEach(({object:h,state:u,params:f})=>{let d={...f,autoplay:!1};h.interaction?.seek(u,l,c.steps,d,a)})})}t.listener=e})(Yl||(Yl={}));var Jl={type:"mouseHover"},Xl;(t=>{function n(r){if(r.type===2)return{type:"mouseHover",targets:[]}}t.create=n;function e({target:r,begin:i,change:s,enter:o}){if(!r?.interaction?.events.mouseHover?.length||o===void 0)return;i&&i("mouseHover",r.uuid);let a={change:s};o?r.interaction.events.mouseHover.forEach(l=>{l.targets.forEach(({object:c,state:h,params:u})=>{c.interaction?.animate(h,u,a)})}):r.interaction.events.mouseHover.forEach(l=>{l.targets.forEach(({object:c,params:h})=>{let u=c.interaction;u?.fromState!==void 0&&u.animate(u.fromState,h,a)})})}t.listener=e})(Xl||(Xl={}));var av={type:"mouseDown"},lv={type:"mouseUp"},Jd={type:"keyDown"},Qd={type:"keyUp"},Zi;(t=>{function n(r){let i,s;if(r.type===0)i={type:"mousedown"},s="mouseDown";else if(r.type===1)i={type:"mouseup"},s="mouseUp";else if(r.type===5){if(!r.key)return;i={type:"keydown",key:r.key},s="keyDown"}else if(r.type===6){if(!r.key)return;i={type:"keyup",key:r.key},s="keyUp"}else return;return{type:s,domEvent:i,targets:[],url:r.url??void 0,toggle:r.toggle??!1,enable:!1}}t.create=n;function e({target:r,interactionEvents:i,type:s,begin:o,change:a}){if(!r)return;i||(i=r.interaction?.events[s]),o&&o(s,r.uuid);let l={change:a};i.forEach(c=>{if(c.toggle){c.enable=!c.enable;for(let{object:h,state:u,params:f}of c.targets){let d=h.interaction;if(d!==void 0){let m={...f,cycle:!1,rewind:!1,repeat:!1};c.enable?d.animate(u,m,l):d.fromState!==void 0&&d.animate(d.fromState,m,l)}}}else c.targets.forEach(({object:h,state:u,params:f})=>h.interaction?.animate(u,f,l));c.url&&(wo?window.location.assign(c.url):window.open(c.url,"_blank"))})}t.listener=e})(Zi||(Zi={}));function Vz(n){let e,{type:t}=n;return t===10?e=Wl.create(n):t===0||t===1||t===5||t===6?e=Zi.create(n):t===9?e=jl.create(n):t===2?e=Xl.create(n):t===11?e=Yl.create(n):t===7&&(e=ql.create(n)),e}function rM(n,e,t){let r=[];n.objects.traverse((i,s)=>{let o=e.find(i);if(delete o.interaction,!s.visible&&!xt(o.parent)||s.states===void 0)return;let a=new qd(o,t),l=a.states;l.push(Bo.create(i,s));for(let h of s.states){let u=jc.patch(s,h.data);l.push(Bo.create(h.id,u))}let c=a.events;if(s.events)for(let{data:h}of s.events){let u=Vz(h);if(!u)continue;let f=u.type;c[f]?c[f].push(u):c[f]=[u],"targets"in h&&r.push([h,u])}(l.length>0||Object.keys(c).length>0)&&(o.interaction=a)});for(let[i,s]of r)if("targets"in i&&"targets"in s)for(let{data:o}of i.targets){let a=Vl.create(o,e);a&&s.targets.push(a)}}function nM(n,e,t,r,i=!1){if(!i&&e.states.length===0)return;let s=t===null?e:jc.patch(e,e.states.data(t));if(my(n,s),n instanceof Ct&&s.type==="Mesh"){if(n instanceof Ws?n.buildFromStore(s.geometry):n.updateGeometry({parameters:s.geometry}),n.freeBooleanPointer(),xt(n.parent)&&n.parent.invalidateDownstreamBooleanData().recomputeBoolean(),"material"in s){if(n.material instanceof Array)return;if(typeof s.material!="string"){let a=s.material.layers;for(let l of a){let c=n.material.userData.layers.getLayerByUuid(l.id);nv(l.data,r,c,n.material,l.data)}}}else if("materials"in s){if(!(n.material instanceof Array))return;var o=0;for(let a of s.materials){if(typeof a!="string"){let l=a.layers;for(let c of l){let h=n.material[o].userData.layers.getLayerByUuid(c.id);nv(c.data,r,h,n.material[o],c.data)}}o++}}}else if(s.type==="DirectionalLight")n.fromDirectionalLightState(s,r);else if(s.type==="PointLight")n.fromPointLightState(s,r);else if(s.type==="SpotLight")n.fromSpotLightState(s,r);else if(n instanceof yn&&Ls.is(s.type)){let a=s;n.setZoom("PerspectiveCamera",a.perspective.zoom),n.setZoom("OrthographicCamera",a.orthographic.zoom),n.isUpVectorFlipped=a.isUpVectorFlipped,n.targetOffset=a.targetOffset}}var Bo=class{constructor(e){this.objectState=e;this.uuid=je.generateUUID()}static create(e,t){let r=new Bo(t);return r.uuid=e,r}execute(e,t){nM(e,this.objectState,null,t,!0)}};var Di=new Os,Ln=new A,cv={follow:Wl.listener,keyDown:Zi.listener,keyUp:Zi.listener,lookAt:jl.listener,mouseDown:Zi.listener,mouseUp:Zi.listener,mouseHover:Xl.listener,scroll:Yl.listener,start:ql.listener},iM={follow:Dh,keyDown:Jd,keyUp:Qd,lookAt:Ph,mouseDown:av,mouseUp:lv,mouseHover:Jl,scroll:Xd,start:ov};function Hz(n){if(n.style.transform!==""){let e=getComputedStyle(n).getPropertyValue("transform");if(e!=="none"){let t=e.replace("matrix(","").split(",");return{x:parseFloat(t[0]),y:parseFloat(t[3])}}}return{x:1,y:1}}function sM(n){let e=n.getViewport(new Ke),t=Hz(n.domElement);return{left:e.x*t.x,top:e.y*t.y,width:e.z*t.x,height:e.w*t.y}}function hv(n,e){if(zt(e)){if(!e.raycastLock&&e.visible){let t=n.intersectObject(e,!1);return t.length?t[0]:void 0}}else if(e.objectType==="EmptyObject")return oM(n,e)}function oM(n,e){if(zt(e)&&!e.raycastLock&&e.visible){let t=n.intersectObject(e,!1);if(t.length)return t[0]}for(let t of e.children)if(Do(t)){let r=oM(n,t);if(r)return r}}var Kd=class{constructor(e,t,r,i){this.isEnable=!1;this.splineEvents={};this._map={};this._prevObjects=[];this._onMouseDown=e=>{Di.setFromCamera(this._getPointer(e.clientX,e.clientY),this._camera),this._camera.getWorldDirection(Ln),Ln.negate(),this._handleMouseDownEvent(e)};this._onMouseUp=e=>{Di.setFromCamera(this._getPointer(e.clientX,e.clientY),this._camera),this._camera.getWorldDirection(Ln),Ln.negate(),this._handleMouseUpEvent(e)};this._onMouseMove=e=>{Di.setFromCamera(this._getPointer(e.clientX,e.clientY),this._camera),this._camera.getWorldDirection(Ln),Ln.negate(),this._handleMouseHoverEvent(e),this._handleLookAtEvent(e),this._handleFollowEvent(e)};this._onTouchStart=e=>{e.touches.length===1&&(Di.setFromCamera(this._getPointer(e.touches[0].clientX,e.touches[0].clientY),this._camera),this._camera.getWorldDirection(Ln),Ln.negate(),this._handleMouseDownEvent(e),this._handleMouseHoverEvent(e),this._handleLookAtEvent(e),this._handleFollowEvent(e))};this._onTouchEnd=e=>{this._handleMouseUpEvent(e),this._handleMouseHoverEvent(e,!0)};this._onTouchMove=e=>{e.touches.length===1&&(Di.setFromCamera(this._getPointer(e.touches[0].clientX,e.touches[0].clientY),this._camera),this._camera.getWorldDirection(Ln),Ln.negate(),this._handleMouseHoverEvent(e),this._handleLookAtEvent(e),this._handleFollowEvent(e))};this._onWheel=e=>{this._handleWheelEvent(e)};this._onKeyDown=e=>{this._handleKeyDownEvent(e)};this._onKeyUp=e=>{this._handleKeyUpEvent(e)};this._renderer=e,this._domElement=e.domElement,this._camera=r,this._scene=t,this._app=i,this._domRect=this._domElement.getBoundingClientRect(),this._viewRect=sM(e)}activate(){this.isEnable=!0,this._map={},this._scene.traverseEntity(e=>{e.interaction!==void 0&&(e.interaction.start(),Object.keys(e.interaction.events).forEach(t=>{let r=t;this._addDOMCustomEvent(r,e),(e.visible||r!=="mouseDown"&&r!=="mouseUp"&&r!=="mouseHover")&&this._addSPEEvent(r,e)}))}),xf?((this._map.mouseDown?.length||this._map.mouseHover?.length||this._map.lookAt?.length||this._map.follow?.length)&&this._domElement.addEventListener("touchstart",this._onTouchStart),(this._map.mouseUp?.length||this._map.mouseHover?.length)&&this._domElement.addEventListener("touchend",this._onTouchEnd),(this._map.mouseHover?.length||this._map.lookAt?.length||this._map.follow?.length)&&this._domElement.addEventListener("touchmove",this._onTouchMove)):(this._map.mouseDown?.length&&this._domElement.addEventListener("pointerdown",this._onMouseDown),this._map.mouseUp?.length&&this._domElement.addEventListener("pointerup",this._onMouseUp),(this._map.mouseHover?.length||this._map.lookAt?.length||this._map.follow?.length)&&this._domElement.addEventListener("pointermove",this._onMouseMove)),this._map.scroll?.length&&this._domElement.addEventListener("wheel",this._onWheel),this._map.keyDown?.length&&document.addEventListener("keydown",this._onKeyDown),this._map.keyUp?.length&&document.addEventListener("keyup",this._onKeyUp),this._map.start?.length&&this._handleStartEvent(),this.resize()}deactivate(){this._scene.traverseEntity(e=>{if(!e.interaction)return;e.interaction.end();let t=e;Object.keys(cv).forEach(r=>{let i=r;t.removeEventListener(i,cv[i])})}),this._domElement.removeEventListener("pointerdown",this._onMouseDown),this._domElement.removeEventListener("pointerup",this._onMouseUp),this._domElement.removeEventListener("pointermove",this._onMouseMove),this._domElement.removeEventListener("touchstart",this._onTouchStart),this._domElement.removeEventListener("touchend",this._onTouchEnd),this._domElement.removeEventListener("touchmove",this._onTouchMove),this._domElement.removeEventListener("wheel",this._onWheel),document.removeEventListener("keydown",this._onKeyDown),document.removeEventListener("keyup",this._onKeyUp),this._map={},this.isEnable=!1}reset(){this._scene.traverseEntity(e=>{e.interaction?.start()}),this._handleStartEvent()}resize(){this._domRect=this._domElement.getBoundingClientRect(),this._viewRect=sM(this._renderer)}_getPointer(e,t){let r=this._domRect,i=this._viewRect,s=r.height-i.height,o=(e-i.left-r.left)*(r.width/i.width),a=(t-s+i.top-r.top)*(r.height/i.height);return{x:o/r.width*2-1,y:-(a/r.height)*2+1}}_handleStartEvent(){this._map.start?.forEach(e=>{e.dispatchEvent(ov)})}_handleWheelEvent(e){this._map.scroll?.length&&(Xd.deltaY=e.deltaY,this._map.scroll.forEach(t=>{t.dispatchEvent(Xd)}))}_handleMouseDownEvent(e){this._map.mouseDown?.forEach(t=>{hv(Di,t)&&t.dispatchEvent(av)})}_handleMouseUpEvent(e){this._map.mouseUp?.forEach(t=>{hv(Di,t)&&t.dispatchEvent(lv)})}_handleMouseHoverEvent(e,t=!1){let r=[];t||this._map.mouseHover?.forEach(i=>{hv(Di,i)&&r.push(i)}),this._prevObjects.length&&(Jl.enter=!1,this._prevObjects.forEach(i=>{r.includes(i)||i.dispatchEvent(Jl)})),r.length&&(Jl.enter=!0,r.forEach(i=>{i.dispatchEvent(Jl)})),this._prevObjects=r}_handleLookAtEvent(e){this._map.lookAt?.length&&(Ph.normal=Ln,Ph.raycaster=Di,this._map.lookAt.forEach(t=>{t.dispatchEvent(Ph)}))}_handleFollowEvent(e){this._map.follow&&(Dh.normal=Ln,Dh.raycaster=Di,this._map.follow.forEach(t=>t.dispatchEvent(Dh)))}_handleKeyDownEvent(e){this._map.keyDown?.forEach(t=>{Jd.interactionEvents=t.interaction?.events?.keyDown?.filter(r=>r.domEvent.type==="keydown"&&r.domEvent.key===e.key),t.dispatchEvent(Jd)})}_handleKeyUpEvent(e){this._map.keyUp?.forEach(t=>{Qd.interactionEvents=t.interaction?.events?.keyUp?.filter(r=>r.domEvent.type==="keyup"&&r.domEvent.key===e.key),t.dispatchEvent(Qd)})}_addSPEEvent(e,t){!t.interaction||(iM[e].begin=this._dispatchDOMCustomEvent.bind(this),iM[e].change=this._app.requestRender.bind(this),t.interaction.events[e]?.length&&(t.addEventListener(e,cv[e]),this._map[e]===void 0?this._map[e]=[t]:this._map[e].push(t)))}_addDOMCustomEvent(e,t){if(e){let r=new CustomEvent(e,{bubbles:!0});Object.defineProperty(r,"target",{writable:!1,value:{id:t.uuid,name:t.name}}),this.splineEvents[e]?this.splineEvents[e][t.uuid]=r:this.splineEvents[e]={[t.uuid]:r}}}_dispatchDOMCustomEvent(e,t){let r=this.splineEvents[e]?.[t];r&&this._domElement.dispatchEvent(r)}};var Zd=class{constructor(e,t,r,i,s){this._aspect=1;this._renderer=e,this._camera=t,this._frameSize=new O().copy(r),this._editorSize=new O().copy(i),this._aspect=t.aspect,this._fov=s??t.fov}set frameSize(e){this._frameSize.copy(e)}updateRenderer(){!this._renderer||this._renderer.setSize(this._frameSize.x,this._frameSize.y,!1)}updateViewportForImageExport(){if(!this._renderer||!this._camera||this._camera.cameraType!=="PerspectiveCamera")return;let e=this._frameSize.x,t=this._frameSize.y,r=this._editorSize.x,i=this._editorSize.y;this._aspect=e/t,this._camera.zoom*=Math.min(r/e,i/t),this._renderer.setViewport(0,0,e,t)}updateViewport(){if(!this._renderer||!this._camera||this._camera.cameraType!=="PerspectiveCamera")return;let e=this._frameSize.x,t=this._frameSize.y,r=this._editorSize.x,i=this._editorSize.y,s=0,o=0,a=e,l=t;e<r&&(s=(r-e)*.5,s=-s,a=r),t<i&&(o=(i-t)*.5,o=-o,l=i),this._aspect=a/l,this._renderer.setViewport(s,o,a,l)}updateCamera(){if(!!this._camera)if(this._camera.cameraType==="PerspectiveCamera"){let e=this._frameSize.y,t=this._editorSize.y,r=this._fov;if(e>t){let i=Wz(e,1080,2160,1,15)/100;r*=e/t,r*=1-i}this._camera.aspect=this._aspect,this._camera.fov=r,this._camera.updateProjectionMatrix()}else this._camera.setViewplaneSize(this._frameSize.x,this._frameSize.y)}revert(){let e=window.innerWidth,t=window.innerHeight;this._renderer&&(this._renderer.setViewport(0,0,e,t),this._renderer.setSize(e,t,!1)),this._camera&&(this._camera.aspect=e/t,this._camera.fov=this._fov,this._camera.setViewplaneSize(e,t),this._camera.updateProjectionMatrix())}};function Wz(n,e,t,r,i){return(n-e)/(t-e)*(i-r)+r}var $d=class{constructor(e){this.sharedAssets=new Yd(e.shared),this.scene=new Ud(e.scene,this.sharedAssets),this.scene.switchActiveCamera(this.scene.activeCamera)}reset(e,t){this.scene.clearScene(this.sharedAssets),this.sharedAssets.reset(e.shared),this.scene.resetAfterClear(e.scene,this.sharedAssets)}dispose(){this.scene.dispose()}};var ep=class{constructor({x:e=10,y:t=10}){this._startTime=0;let r=document.getElementById("spe-perfs");r?this.element=r:(this.element=document.createElement("div"),document.body.appendChild(this.element),this.element.style.position="absolute",this.element.style.zIndex="10000",this.element.style.fontFamily="monospace",this.element.style.background="black",this.element.style.color="white",this.element.style.padding="10px",this.element.style.opacity="0.5",this.element.style.fontSize="11px",this.element.setAttribute("id","spe-perfs")),this.element.style.left=`${e}px`,this.element.style.top=`${t}px`}dispose(){this.element.parentElement?.removeChild(this.element)}start(){this._startTime=performance.now()}end(){let t=performance.now()-this._startTime;this.element.innerHTML=t.toFixed(3)+" ms"}};function jz(n){let e;if(!!n.index)for(let t=0;t<n.index.array.length;t+=3)e=n.index.array[t],n.index.array[t]=n.index.array[t+2],n.index.array[t+2]=e}function uv(n){return n==="SubdivObject"||n==="NonParametric"?n:"Mesh"}function qz(n,e){let t={};return n.traverseEntity(r=>{if(r.type!=="Mesh"||!("material"in r)||!r.visible||!(r instanceof Ct)||Array.isArray(r.material)||r&&r.interaction&&r.interaction.states.length>0)return;let i=r.parent;for(;i;){if(i instanceof Ct&&i.interaction&&i.interaction.states.length>1)return;i=i.parent}let s=r.material.uuid,o=e.shared.materials[s];if(o){if(!Wn.isMergable(o))return}else{let c=e.scene.objects.get(r.uuid)?.data;if(c&&"material"in c&&typeof c.material!="string"){if(!Wn.isMergable(c.material))return;s=Wn.getHash(c.material)}}t[s]||(t[s]={});let l=t[s][uv(r.objectType)];if(l){if(l.push(r),r.cloner)for(let c of r.cloner.children)l.push(c)}else if(t[s][uv(r.objectType)]=[r],r.cloner)for(let c of r.cloner.children)t[s][uv(r.objectType)].push(c)}),t}function Yz(n){let e=0;return Object.values(n).forEach(t=>{Object.values(t).forEach(r=>{let i=r.length;i>e&&(e=i)})}),e}function aM(n,e){let t=qz(e,n),r=Yz(t),i=new Array(r),s=0,o=new Array(r),a=0,l=new Array(r),c=0,h=new Array(r),u=0;for(let f of Object.values(t))for(let d of Object.values(f)){if(a=0,c=0,d.forEach(p=>{p instanceof Ct&&(o[a++]=p.geometry.clone(),l[c++]=p)}),c<2)continue;for(let p=0;p<c;p++)l[p].updateWorldMatrix(!0,!1),o[p].applyMatrix4(l[p].matrixWorld),l[p].matrixWorld.determinant()<0&&jz(o[p]);let m=aS(o.slice(0,a),!1);if(m){let p;switch(d[0].objectType){case"SubdivObject":{console.warn("Turning subdiv object into mesh"),p=new ir(m,l[0].material);break}default:{p=new ir(m,l[0].material);break}}p.castShadow=l[0].castShadow,p.receiveShadow=l[0].receiveShadow,e.add(p);let g=x=>{u=0;for(let v of x)v.children&&g(v.children),v instanceof Ct&&(Array.isArray(v.material)||t[v.material.uuid]&&t[v.material.uuid][v.objectType]&&t[v.material.uuid][v.objectType].length>1||(h[u++]=v));for(let v=0;v<u;v++)e.attach(h[v])};for(let x=0;x<c;x++){let v=l[x];g(v.children),i[s++]=v}}}for(let f=0;f<s;f++)i[f].removeFromParent()}var Xz=new O,lM="The Spline Runtime only accepts .splinecode files that are generated from Spline export panel.",fv=class{constructor(e,{autoRender:t=!1}={}){this._viewportMode=1;this._viewportWidth=window.innerWidth;this._viewportHeight=window.innerHeight;this._proxyObjectCache=new Map;this._skipRender=!0;this.autoRender=!1;this.disposed=!1;this.requestRender=()=>{this._skipRender=!1};this.render=()=>{!this._renderer||(this._rafId=requestAnimationFrame(this.render),this._perfs?.start(),!(!this.autoRender&&this._skipRender)&&(this._controls&&(this._controls.enableDamping||this._controls.autoRotate)?this._skipRender=!this._controls.update():this._skipRender=!0,this._playmode&&!this._playmode.isEnable&&this._playmode.activate(),this._scene&&this._camera&&(this._renderer.autoClear=!1,this._transmissionRenderTarget&&(this._renderer.setRenderTarget(this._transmissionRenderTarget),this._renderer.clear(),this._camera.layers.enable(0),this._camera.layers.disable(3),this._renderer.render(this._scene,this._camera),this._renderer.setRenderTarget(null),this._camera.layers.enable(3)),this._scene.postprocessing?.enabled?(this._renderer.autoClear=!1,this._scene.postprocessing.render()):(this._renderer.autoClear=!0,this._renderer.render(this._scene,this._camera))),this._perfs?.end()))};this.resize=Ic(()=>{!this._renderer||(this._viewportMode===1&&this._frameView&&(this._frameView.frameSize=Xz.set(this._viewportWidth,this._viewportHeight)),this._frameView?.updateRenderer(),this._scene?.postprocessing&&this._scene.postprocessing.resize(this._viewportWidth,this._viewportHeight,!1),this._viewportMode!==1&&this._frameView?.updateViewport(),this._camera&&(this._frameView?.updateCamera(),this._camera.cameraType==="PerspectiveCamera"&&this._viewportMode===1&&(this._camera.aspect=this._viewportWidth/this._viewportHeight),this._camera.updateProjectionMatrix()),this._playmode?.resize(),this.requestRender())},10);this.canvas=e,this.autoRender=t,py(),window.location.search.includes("perfs")&&(this._perfs=new ep({x:10,y:10}))}async load(e){e.endsWith(".spline")?console.warn(lM+" The .spline files are only meant to be used by the Editor."):e.endsWith(".splinecode")||console.warn(lM);let r=await(await fetch(e)).arrayBuffer();await this.start(r)}async start(e){if(this.disposed)return;let t=await xA(e);Sy(t)&&await L1();let r=new $d(t);if(window.location.search.includes("merge-geometries")){let f=performance.now();aM(t,r.scene);let d=performance.now();console.log("Merged geometries in ",d-f," ms")}this._scene=r.scene,Sy(t)&&this._scene.traverse(f=>{xt(f)&&f.recomputeBoolean()}),this._sharedAssetsManager=r.sharedAssets,this._sharedAssetsManager.onImageLoad=()=>{this.requestRender()},rM(t.scene,this._scene,this._sharedAssetsManager),this._camera=this._scene.activeCamera;let i=Object.values(t.frames)[0],s,o;if(i)if(i.preset==="fullscreen"){this._viewportMode=1;let{width:f,height:d}=window.getComputedStyle(this.canvas);this.canvas.parentElement&&(f==="300px"||f==="auto")?(this._viewportWidth=this.canvas.parentElement.clientWidth||300,this.canvas.style.width="100%",s=this.canvas.style.width):this._viewportWidth=this.canvas.clientWidth,this.canvas.parentElement&&(d==="150px"||d==="auto")?(this._viewportHeight=this.canvas.parentElement.clientHeight||150,this.canvas.style.height="100%",o=this.canvas.style.height):this._viewportHeight=this.canvas.clientHeight}else this._viewportMode=2,this._viewportWidth=i.size[0],this._viewportHeight=i.size[1],s=this._viewportWidth+"px",o=this._viewportHeight+"px";this._scene.postprocessing?.enabled?(this._renderer=new zu({canvas:this.canvas,antialias:!1,alpha:!0,stencil:!1,depth:!1,powerPreference:"high-performance"}),this._scene.postprocessing.init({renderer:this._renderer,camera:this._camera,scene:this._scene}),this._scene.postprocessing.addEventListener("smaaloaded",this.requestRender)):this._renderer=new zu({canvas:this.canvas,antialias:!0,alpha:!0,stencil:!0,depth:!0,powerPreference:"high-performance"}),s&&(this.canvas.style.width=s),o&&(this.canvas.style.height=o),this._scene.needsTransmission(void 0)&&(this._transmissionRenderTarget=new ut(2048,2048,{generateMipmaps:!0,minFilter:Ss,magFilter:et,wrapS:mr,wrapT:mr}),this._transmissionRenderTarget.depthTexture=new li(2048,2048),this._scene.needsTransmission(this._transmissionRenderTarget)),this._renderer.setPixelRatio(window.devicePixelRatio),this._renderer.setSize(this._viewportWidth,this._viewportHeight,!1),this._scene.postprocessing&&this._scene.postprocessing.resize(this._viewportWidth,this._viewportHeight,!1),this._renderer.shadowMap.enabled=!0,this._renderer.shadowMap.type=t.scene.environment.ambientLight.softShadows?Ou:zm,d1(t.scene.environment.ambientLight.softShadowQuality),this._renderer.setClearColor(this._scene.bgColor,this._scene.alpha),this._frameView=new Zd(this._renderer,this._camera,new O(this._viewportWidth,this._viewportHeight),new O(window.innerWidth,window.innerHeight)),this._publishData=t.scene.publish;let{enableRotate:a,enablePan:l,enableZoom:c,autoRotate:h,hoverRotatePanMode:u}=this._publishData.orbitControls;if((a||l||c||h||u!==0)&&(this._camera.interaction===void 0||this._camera.interaction.states.length<=1)&&(this._controls=new Jf(this._camera,this._renderer.domElement),this._controls.fromJSON(this._publishData.orbitControls),this._controls.useKeyEvents=!1,this._controls.addEventListener("change",this.requestRender),this._controls.addEventListener("start",this.requestRender)),this._playmode=new Kd(this._renderer,this._scene,this._camera,this),this.resize(),this.render(),this.canvas.parentElement){let f=!0;this._resizeObserver=new ResizeObserver(()=>{if(f){f=!1;return}this._viewportWidth=this.canvas.clientWidth,this._viewportHeight=this.canvas.clientHeight,this.resize()}),this._resizeObserver.observe(this.canvas.parentElement)}}findObjectById(e){let t=this._scene?.getObjectByProperty("uuid",e);return this._createProxyObject(t)}findObjectByName(e){let t=this._scene?.getObjectByName(e);return this._createProxyObject(t)}getSplineEvents(){return this._playmode?.splineEvents}emitEvent(e,t){(this.findObjectById(t)||this.findObjectByName(t))?.emitEvent(e)}emitEventReverse(e,t){(this.findObjectById(t)||this.findObjectByName(t))?.emitEventReverse(e)}addEventListener(e,t){this._renderer?.domElement.addEventListener(e,t)}removeEventListener(e,t){this._renderer?.domElement.removeEventListener(e,t)}setZoom(e){this._controls?.zoomOut(e)}setSize(e,t){this._viewportWidth=e,this._viewportHeight=t,this._viewportMode=2,this.resize()}dispose(){this.disposed=!0,this._playmode?.deactivate(),this._scene?.dispose(),this._rafId&&cancelAnimationFrame(this._rafId),this._proxyObjectCache.forEach(e=>{$m.unsubscribe(e)}),this._renderer?.dispose(),this._transmissionRenderTarget?.dispose(),this._transmissionRenderTarget?.depthTexture?.dispose(),this._sharedAssetsManager?.dispose(),this._resizeObserver&&this._resizeObserver.disconnect(),this.canvas.style.width="",this.canvas.style.height=""}_createProxyObject(e){if(e==null)return;if(this._proxyObjectCache.has(e.uuid))return this._proxyObjectCache.get(e.uuid);let{requestRender:t}=this,r={name:e.name,uuid:e.uuid,visible:e.visible,intensity:e.intensity,position:e.position,rotation:e.rotation,scale:e.scale,emitEvent(s){e.interaction?.emitEvent(s,t)},emitEventReverse(s){e.interaction?.emitEventReverse(s,t)}},i=$m(r,(s,o)=>{typeof e[s]!="object"&&Object.getOwnPropertyDescriptor(e,s)?.writable&&(e[s]=o),this.requestRender(),e.updateMatrix()});return this._proxyObjectCache.set(e.uuid,i),i}};
|